@bpmn-io/form-js-playground 0.9.6 → 0.9.8

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.
@@ -377,128 +377,45 @@
377
377
  */
378
378
 
379
379
  var proto = typeof Element !== 'undefined' ? Element.prototype : {};
380
- var vendor = proto.matches || proto.matchesSelector || proto.webkitMatchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector;
381
- var matchesSelector = match;
382
- /**
383
- * Match `el` to `selector`.
384
- *
385
- * @param {Element} el
386
- * @param {String} selector
387
- * @return {Boolean}
388
- * @api public
389
- */
390
-
391
- function match(el, selector) {
392
- if (!el || el.nodeType !== 1) return false;
393
- if (vendor) return vendor.call(el, selector);
394
- var nodes = el.parentNode.querySelectorAll(selector);
395
-
396
- for (var i = 0; i < nodes.length; i++) {
397
- if (nodes[i] == el) return true;
398
- }
399
-
400
- return false;
401
- }
402
- /**
403
- * Closest
404
- *
405
- * @param {Element} el
406
- * @param {String} selector
407
- * @param {Boolean} checkYourSelf (optional)
408
- */
409
-
410
-
411
- function closest(element, selector, checkYourSelf) {
412
- var currentElem = checkYourSelf ? element : element.parentNode;
413
-
414
- while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE && currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
415
- if (matchesSelector(currentElem, selector)) {
416
- return currentElem;
417
- }
418
-
419
- currentElem = currentElem.parentNode;
420
- }
421
-
422
- return matchesSelector(currentElem, selector) ? currentElem : null;
423
- }
424
-
425
- var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
426
- unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
427
- prefix = bind$1 !== 'addEventListener' ? 'on' : '';
428
- /**
429
- * Bind `el` event `type` to `fn`.
430
- *
431
- * @param {Element} el
432
- * @param {String} type
433
- * @param {Function} fn
434
- * @param {Boolean} capture
435
- * @return {Function}
436
- * @api public
437
- */
438
-
439
- var bind_1 = function (el, type, fn, capture) {
440
- el[bind$1](prefix + type, fn, capture || false);
441
- return fn;
442
- };
443
- /**
444
- * Unbind `el` event `type`'s callback `fn`.
445
- *
446
- * @param {Element} el
447
- * @param {String} type
448
- * @param {Function} fn
449
- * @param {Boolean} capture
450
- * @return {Function}
451
- * @api public
452
- */
453
-
454
-
455
- var unbind_1 = function (el, type, fn, capture) {
456
- el[unbind](prefix + type, fn, capture || false);
457
- return fn;
458
- };
459
-
460
- var componentEvent = {
461
- bind: bind_1,
462
- unbind: unbind_1
463
- };
380
+ proto.matches || proto.matchesSelector || proto.webkitMatchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector;
464
381
  /**
465
382
  * Expose `parse`.
466
383
  */
467
384
 
468
- var domify = parse;
385
+ var domify$2 = parse$1;
469
386
  /**
470
387
  * Tests for browser support.
471
388
  */
472
389
 
473
- var innerHTMLBug = false;
474
- var bugTestDiv;
390
+ var innerHTMLBug$1 = false;
391
+ var bugTestDiv$1;
475
392
 
476
393
  if (typeof document !== 'undefined') {
477
- bugTestDiv = document.createElement('div'); // Setup
394
+ bugTestDiv$1 = document.createElement('div'); // Setup
478
395
 
479
- bugTestDiv.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>'; // Make sure that link elements get serialized correctly by innerHTML
396
+ bugTestDiv$1.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>'; // Make sure that link elements get serialized correctly by innerHTML
480
397
  // This requires a wrapper element in IE
481
398
 
482
- innerHTMLBug = !bugTestDiv.getElementsByTagName('link').length;
483
- bugTestDiv = undefined;
399
+ innerHTMLBug$1 = !bugTestDiv$1.getElementsByTagName('link').length;
400
+ bugTestDiv$1 = undefined;
484
401
  }
485
402
  /**
486
403
  * Wrap map from jquery.
487
404
  */
488
405
 
489
406
 
490
- var map$1 = {
407
+ var map$1$1 = {
491
408
  legend: [1, '<fieldset>', '</fieldset>'],
492
409
  tr: [2, '<table><tbody>', '</tbody></table>'],
493
410
  col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
494
411
  // for script/link/style tags to work in IE6-8, you have to wrap
495
412
  // in a div with a non-whitespace character in front, ha!
496
- _default: innerHTMLBug ? [1, 'X<div>', '</div>'] : [0, '', '']
413
+ _default: innerHTMLBug$1 ? [1, 'X<div>', '</div>'] : [0, '', '']
497
414
  };
498
- map$1.td = map$1.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
499
- map$1.option = map$1.optgroup = [1, '<select multiple="multiple">', '</select>'];
500
- map$1.thead = map$1.tbody = map$1.colgroup = map$1.caption = map$1.tfoot = [1, '<table>', '</table>'];
501
- map$1.polyline = map$1.ellipse = map$1.polygon = map$1.circle = map$1.text = map$1.line = map$1.path = map$1.rect = map$1.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">', '</svg>'];
415
+ map$1$1.td = map$1$1.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
416
+ map$1$1.option = map$1$1.optgroup = [1, '<select multiple="multiple">', '</select>'];
417
+ map$1$1.thead = map$1$1.tbody = map$1$1.colgroup = map$1$1.caption = map$1$1.tfoot = [1, '<table>', '</table>'];
418
+ map$1$1.polyline = map$1$1.ellipse = map$1$1.polygon = map$1$1.circle = map$1$1.text = map$1$1.line = map$1$1.path = map$1$1.rect = map$1$1.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">', '</svg>'];
502
419
  /**
503
420
  * Parse `html` and return a DOM Node instance, which could be a TextNode,
504
421
  * HTML DOM Node of some kind (<div> for example), or a DocumentFragment
@@ -510,7 +427,7 @@
510
427
  * @api private
511
428
  */
512
429
 
513
- function parse(html, doc) {
430
+ function parse$1(html, doc) {
514
431
  if ('string' != typeof html) throw new TypeError('String expected'); // default to the global `document` object
515
432
 
516
433
  if (!doc) doc = document; // tag name
@@ -528,7 +445,7 @@
528
445
  } // wrap map
529
446
 
530
447
 
531
- var wrap = map$1[tag] || map$1._default;
448
+ var wrap = map$1$1[tag] || map$1$1._default;
532
449
  var depth = wrap[0];
533
450
  var prefix = wrap[1];
534
451
  var suffix = wrap[2];
@@ -552,11 +469,6 @@
552
469
  return fragment;
553
470
  }
554
471
 
555
- function query(selector, el) {
556
- el = el || document;
557
- return el.querySelector(selector);
558
- }
559
-
560
472
  var OVERLAY_HTML = '<div class="drop-overlay">' + '<div class="box">' + '<div class="label">{label}</div>' + '</div>' + '</div>';
561
473
  /**
562
474
  * Add file drop functionality to the given element,
@@ -736,7 +648,7 @@
736
648
 
737
649
  function createOverlay(label) {
738
650
  var markup = OVERLAY_HTML.replace('{label}', label);
739
- return domify(markup);
651
+ return domify$2(markup);
740
652
  }
741
653
 
742
654
  function preventDrop(event) {
@@ -1349,54 +1261,40 @@
1349
1261
  * @return {Array<?>}
1350
1262
  */
1351
1263
 
1352
- var nativeToString = Object.prototype.toString;
1353
- var nativeHasOwnProperty = Object.prototype.hasOwnProperty;
1264
+ const nativeToString$1 = Object.prototype.toString;
1265
+ const nativeHasOwnProperty$1 = Object.prototype.hasOwnProperty;
1354
1266
 
1355
- function isUndefined(obj) {
1267
+ function isUndefined$1(obj) {
1356
1268
  return obj === undefined;
1357
1269
  }
1358
1270
 
1359
- function isDefined(obj) {
1271
+ function isDefined$1(obj) {
1360
1272
  return obj !== undefined;
1361
1273
  }
1362
1274
 
1363
- function isNil(obj) {
1275
+ function isNil$1(obj) {
1364
1276
  return obj == null;
1365
1277
  }
1366
1278
 
1367
- function isArray$1(obj) {
1368
- return nativeToString.call(obj) === '[object Array]';
1279
+ function isArray$2(obj) {
1280
+ return nativeToString$1.call(obj) === '[object Array]';
1369
1281
  }
1370
1282
 
1371
- function isObject(obj) {
1372
- return nativeToString.call(obj) === '[object Object]';
1283
+ function isObject$1(obj) {
1284
+ return nativeToString$1.call(obj) === '[object Object]';
1373
1285
  }
1374
1286
 
1375
- function isNumber(obj) {
1376
- return nativeToString.call(obj) === '[object Number]';
1287
+ function isNumber$1(obj) {
1288
+ return nativeToString$1.call(obj) === '[object Number]';
1377
1289
  }
1378
1290
 
1379
- function isFunction(obj) {
1380
- var tag = nativeToString.call(obj);
1291
+ function isFunction$1(obj) {
1292
+ const tag = nativeToString$1.call(obj);
1381
1293
  return tag === '[object Function]' || tag === '[object AsyncFunction]' || tag === '[object GeneratorFunction]' || tag === '[object AsyncGeneratorFunction]' || tag === '[object Proxy]';
1382
1294
  }
1383
1295
 
1384
- function isString(obj) {
1385
- return nativeToString.call(obj) === '[object String]';
1386
- }
1387
- /**
1388
- * Ensure collection is an array.
1389
- *
1390
- * @param {Object} obj
1391
- */
1392
-
1393
-
1394
- function ensureArray(obj) {
1395
- if (isArray$1(obj)) {
1396
- return;
1397
- }
1398
-
1399
- throw new Error('must supply array');
1296
+ function isString$1(obj) {
1297
+ return nativeToString$1.call(obj) === '[object String]';
1400
1298
  }
1401
1299
  /**
1402
1300
  * Return true, if target owns a property with the given key.
@@ -1408,29 +1306,8 @@
1408
1306
  */
1409
1307
 
1410
1308
 
1411
- function has(target, key) {
1412
- return nativeHasOwnProperty.call(target, key);
1413
- }
1414
- /**
1415
- * Find element in collection.
1416
- *
1417
- * @param {Array|Object} collection
1418
- * @param {Function|Object} matcher
1419
- *
1420
- * @return {Object}
1421
- */
1422
-
1423
-
1424
- function find$3(collection, matcher) {
1425
- matcher = toMatcher(matcher);
1426
- var match;
1427
- forEach(collection, function (val, key) {
1428
- if (matcher(val, key)) {
1429
- match = val;
1430
- return false;
1431
- }
1432
- });
1433
- return match;
1309
+ function has$1(target, key) {
1310
+ return nativeHasOwnProperty$1.call(target, key);
1434
1311
  }
1435
1312
  /**
1436
1313
  * Iterate over collection; returning something
@@ -1443,17 +1320,17 @@
1443
1320
  */
1444
1321
 
1445
1322
 
1446
- function forEach(collection, iterator) {
1447
- var val, result;
1323
+ function forEach$1(collection, iterator) {
1324
+ let val, result;
1448
1325
 
1449
- if (isUndefined(collection)) {
1326
+ if (isUndefined$1(collection)) {
1450
1327
  return;
1451
1328
  }
1452
1329
 
1453
- var convertKey = isArray$1(collection) ? toNum : identity;
1330
+ const convertKey = isArray$2(collection) ? toNum$1 : identity$1;
1454
1331
 
1455
- for (var key in collection) {
1456
- if (has(collection, key)) {
1332
+ for (let key in collection) {
1333
+ if (has$1(collection, key)) {
1457
1334
  val = collection[key];
1458
1335
  result = iterator(val, convertKey(key));
1459
1336
 
@@ -1463,357 +1340,120 @@
1463
1340
  }
1464
1341
  }
1465
1342
  }
1343
+
1344
+ function identity$1(arg) {
1345
+ return arg;
1346
+ }
1347
+
1348
+ function toNum$1(arg) {
1349
+ return Number(arg);
1350
+ }
1466
1351
  /**
1467
- * Return collection without element.
1352
+ * Bind function against target <this>.
1468
1353
  *
1469
- * @param {Array} arr
1470
- * @param {Function} matcher
1354
+ * @param {Function} fn
1355
+ * @param {Object} target
1471
1356
  *
1472
- * @return {Array}
1357
+ * @return {Function} bound function
1473
1358
  */
1474
1359
 
1475
1360
 
1476
- function without(arr, matcher) {
1477
- if (isUndefined(arr)) {
1478
- return [];
1479
- }
1480
-
1481
- ensureArray(arr);
1482
- matcher = toMatcher(matcher);
1483
- return arr.filter(function (el, idx) {
1484
- return !matcher(el, idx);
1485
- });
1361
+ function bind$2(fn, target) {
1362
+ return fn.bind(target);
1486
1363
  }
1487
1364
  /**
1488
- * Transform a collection into another collection
1489
- * by piping each member through the given fn.
1365
+ * Convenience wrapper for `Object.assign`.
1490
1366
  *
1491
- * @param {Object|Array} collection
1492
- * @param {Function} fn
1367
+ * @param {Object} target
1368
+ * @param {...Object} others
1493
1369
  *
1494
- * @return {Array} transformed collection
1370
+ * @return {Object} the target
1495
1371
  */
1496
1372
 
1497
1373
 
1498
- function map(collection, fn) {
1499
- var result = [];
1500
- forEach(collection, function (val, key) {
1501
- result.push(fn(val, key));
1502
- });
1503
- return result;
1374
+ function assign$1(target, ...others) {
1375
+ return Object.assign(target, ...others);
1504
1376
  }
1505
1377
  /**
1506
- * Group collection members by attribute.
1378
+ * Sets a nested property of a given object to the specified value.
1507
1379
  *
1508
- * @param {Object|Array} collection
1509
- * @param {Function} extractor
1380
+ * This mutates the object and returns it.
1510
1381
  *
1511
- * @return {Object} map with { attrValue => [ a, b, c ] }
1382
+ * @param {Object} target The target of the set operation.
1383
+ * @param {(string|number)[]} path The path to the nested value.
1384
+ * @param {any} value The value to set.
1512
1385
  */
1513
1386
 
1514
1387
 
1515
- function groupBy(collection, extractor) {
1516
- var grouped = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1517
- extractor = toExtractor(extractor);
1518
- forEach(collection, function (val) {
1519
- var discriminator = extractor(val) || '_';
1520
- var group = grouped[discriminator];
1388
+ function set$1(target, path, value) {
1389
+ let currentTarget = target;
1390
+ forEach$1(path, function (key, idx) {
1391
+ if (typeof key !== 'number' && typeof key !== 'string') {
1392
+ throw new Error('illegal key type: ' + typeof key + '. Key should be of type number or string.');
1393
+ }
1521
1394
 
1522
- if (!group) {
1523
- group = grouped[discriminator] = [];
1395
+ if (key === 'constructor') {
1396
+ throw new Error('illegal key: constructor');
1524
1397
  }
1525
1398
 
1526
- group.push(val);
1527
- });
1528
- return grouped;
1529
- }
1399
+ if (key === '__proto__') {
1400
+ throw new Error('illegal key: __proto__');
1401
+ }
1530
1402
 
1531
- function uniqueBy(extractor) {
1532
- extractor = toExtractor(extractor);
1533
- var grouped = {};
1403
+ let nextKey = path[idx + 1];
1404
+ let nextTarget = currentTarget[key];
1534
1405
 
1535
- for (var _len = arguments.length, collections = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1536
- collections[_key - 1] = arguments[_key];
1537
- }
1406
+ if (isDefined$1(nextKey) && isNil$1(nextTarget)) {
1407
+ nextTarget = currentTarget[key] = isNaN(+nextKey) ? {} : [];
1408
+ }
1538
1409
 
1539
- forEach(collections, function (c) {
1540
- return groupBy(c, extractor, grouped);
1541
- });
1542
- var result = map(grouped, function (val, key) {
1543
- return val[0];
1410
+ if (isUndefined$1(nextKey)) {
1411
+ if (isUndefined$1(value)) {
1412
+ delete currentTarget[key];
1413
+ } else {
1414
+ currentTarget[key] = value;
1415
+ }
1416
+ } else {
1417
+ currentTarget = nextTarget;
1418
+ }
1544
1419
  });
1545
- return result;
1420
+ return target;
1546
1421
  }
1547
1422
  /**
1548
- * Sort collection by criteria.
1549
- *
1550
- * @param {Object|Array} collection
1551
- * @param {String|Function} extractor
1423
+ * Gets a nested property of a given object.
1552
1424
  *
1553
- * @return {Array}
1425
+ * @param {Object} target The target of the get operation.
1426
+ * @param {(string|number)[]} path The path to the nested value.
1427
+ * @param {any} [defaultValue] The value to return if no value exists.
1554
1428
  */
1555
1429
 
1556
- function sortBy(collection, extractor) {
1557
- extractor = toExtractor(extractor);
1558
- var sorted = [];
1559
- forEach(collection, function (value, key) {
1560
- var disc = extractor(value, key);
1561
- var entry = {
1562
- d: disc,
1563
- v: value
1564
- };
1565
-
1566
- for (var idx = 0; idx < sorted.length; idx++) {
1567
- var d = sorted[idx].d;
1568
-
1569
- if (disc < d) {
1570
- sorted.splice(idx, 0, entry);
1571
- return;
1572
- }
1573
- } // not inserted, append (!)
1574
1430
 
1431
+ function get$1(target, path, defaultValue) {
1432
+ let currentTarget = target;
1433
+ forEach$1(path, function (key) {
1434
+ // accessing nil property yields <undefined>
1435
+ if (isNil$1(currentTarget)) {
1436
+ currentTarget = undefined;
1437
+ return false;
1438
+ }
1575
1439
 
1576
- sorted.push(entry);
1577
- });
1578
- return map(sorted, function (e) {
1579
- return e.v;
1440
+ currentTarget = currentTarget[key];
1580
1441
  });
1442
+ return isUndefined$1(currentTarget) ? defaultValue : currentTarget;
1581
1443
  }
1582
1444
 
1583
- function toExtractor(extractor) {
1584
- return isFunction(extractor) ? extractor : function (e) {
1585
- return e[extractor];
1586
- };
1587
- }
1445
+ var e$2 = {
1446
+ "": ["<em>", "</em>"],
1447
+ _: ["<strong>", "</strong>"],
1448
+ "*": ["<strong>", "</strong>"],
1449
+ "~": ["<s>", "</s>"],
1450
+ "\n": ["<br />"],
1451
+ " ": ["<br />"],
1452
+ "-": ["<hr />"]
1453
+ };
1588
1454
 
1589
- function toMatcher(matcher) {
1590
- return isFunction(matcher) ? matcher : function (e) {
1591
- return e === matcher;
1592
- };
1593
- }
1594
-
1595
- function identity(arg) {
1596
- return arg;
1597
- }
1598
-
1599
- function toNum(arg) {
1600
- return Number(arg);
1601
- }
1602
- /**
1603
- * Debounce fn, calling it only once if the given time
1604
- * elapsed between calls.
1605
- *
1606
- * Lodash-style the function exposes methods to `#clear`
1607
- * and `#flush` to control internal behavior.
1608
- *
1609
- * @param {Function} fn
1610
- * @param {Number} timeout
1611
- *
1612
- * @return {Function} debounced function
1613
- */
1614
-
1615
-
1616
- function debounce$2(fn, timeout) {
1617
- var timer;
1618
- var lastArgs;
1619
- var lastThis;
1620
- var lastNow;
1621
-
1622
- function fire(force) {
1623
- var now = Date.now();
1624
- var scheduledDiff = force ? 0 : lastNow + timeout - now;
1625
-
1626
- if (scheduledDiff > 0) {
1627
- return schedule(scheduledDiff);
1628
- }
1629
-
1630
- fn.apply(lastThis, lastArgs);
1631
- clear();
1632
- }
1633
-
1634
- function schedule(timeout) {
1635
- timer = setTimeout(fire, timeout);
1636
- }
1637
-
1638
- function clear() {
1639
- if (timer) {
1640
- clearTimeout(timer);
1641
- }
1642
-
1643
- timer = lastNow = lastArgs = lastThis = undefined;
1644
- }
1645
-
1646
- function flush() {
1647
- if (timer) {
1648
- fire(true);
1649
- }
1650
-
1651
- clear();
1652
- }
1653
-
1654
- function callback() {
1655
- lastNow = Date.now();
1656
-
1657
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1658
- args[_key] = arguments[_key];
1659
- }
1660
-
1661
- lastArgs = args;
1662
- lastThis = this; // ensure an execution is scheduled
1663
-
1664
- if (!timer) {
1665
- schedule(timeout);
1666
- }
1667
- }
1668
-
1669
- callback.flush = flush;
1670
- callback.cancel = clear;
1671
- return callback;
1672
- }
1673
- /**
1674
- * Bind function against target <this>.
1675
- *
1676
- * @param {Function} fn
1677
- * @param {Object} target
1678
- *
1679
- * @return {Function} bound function
1680
- */
1681
-
1682
-
1683
- function bind(fn, target) {
1684
- return fn.bind(target);
1685
- }
1686
-
1687
- function _typeof(obj) {
1688
- "@babel/helpers - typeof";
1689
-
1690
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1691
- _typeof = function (obj) {
1692
- return typeof obj;
1693
- };
1694
- } else {
1695
- _typeof = function (obj) {
1696
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1697
- };
1698
- }
1699
-
1700
- return _typeof(obj);
1701
- }
1702
-
1703
- function _extends$d() {
1704
- _extends$d = Object.assign || function (target) {
1705
- for (var i = 1; i < arguments.length; i++) {
1706
- var source = arguments[i];
1707
-
1708
- for (var key in source) {
1709
- if (Object.prototype.hasOwnProperty.call(source, key)) {
1710
- target[key] = source[key];
1711
- }
1712
- }
1713
- }
1714
-
1715
- return target;
1716
- };
1717
-
1718
- return _extends$d.apply(this, arguments);
1719
- }
1720
- /**
1721
- * Convenience wrapper for `Object.assign`.
1722
- *
1723
- * @param {Object} target
1724
- * @param {...Object} others
1725
- *
1726
- * @return {Object} the target
1727
- */
1728
-
1729
-
1730
- function assign(target) {
1731
- for (var _len = arguments.length, others = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1732
- others[_key - 1] = arguments[_key];
1733
- }
1734
-
1735
- return _extends$d.apply(void 0, [target].concat(others));
1736
- }
1737
- /**
1738
- * Sets a nested property of a given object to the specified value.
1739
- *
1740
- * This mutates the object and returns it.
1741
- *
1742
- * @param {Object} target The target of the set operation.
1743
- * @param {(string|number)[]} path The path to the nested value.
1744
- * @param {any} value The value to set.
1745
- */
1746
-
1747
-
1748
- function set(target, path, value) {
1749
- var currentTarget = target;
1750
- forEach(path, function (key, idx) {
1751
- if (typeof key !== 'number' && typeof key !== 'string') {
1752
- throw new Error('illegal key type: ' + _typeof(key) + '. Key should be of type number or string.');
1753
- }
1754
-
1755
- if (key === 'constructor') {
1756
- throw new Error('illegal key: constructor');
1757
- }
1758
-
1759
- if (key === '__proto__') {
1760
- throw new Error('illegal key: __proto__');
1761
- }
1762
-
1763
- var nextKey = path[idx + 1];
1764
- var nextTarget = currentTarget[key];
1765
-
1766
- if (isDefined(nextKey) && isNil(nextTarget)) {
1767
- nextTarget = currentTarget[key] = isNaN(+nextKey) ? {} : [];
1768
- }
1769
-
1770
- if (isUndefined(nextKey)) {
1771
- if (isUndefined(value)) {
1772
- delete currentTarget[key];
1773
- } else {
1774
- currentTarget[key] = value;
1775
- }
1776
- } else {
1777
- currentTarget = nextTarget;
1778
- }
1779
- });
1780
- return target;
1781
- }
1782
- /**
1783
- * Gets a nested property of a given object.
1784
- *
1785
- * @param {Object} target The target of the get operation.
1786
- * @param {(string|number)[]} path The path to the nested value.
1787
- * @param {any} [defaultValue] The value to return if no value exists.
1788
- */
1789
-
1790
-
1791
- function get(target, path, defaultValue) {
1792
- var currentTarget = target;
1793
- forEach(path, function (key) {
1794
- // accessing nil property yields <undefined>
1795
- if (isNil(currentTarget)) {
1796
- currentTarget = undefined;
1797
- return false;
1798
- }
1799
-
1800
- currentTarget = currentTarget[key];
1801
- });
1802
- return isUndefined(currentTarget) ? defaultValue : currentTarget;
1803
- }
1804
-
1805
- var e$2 = {
1806
- "": ["<em>", "</em>"],
1807
- _: ["<strong>", "</strong>"],
1808
- "*": ["<strong>", "</strong>"],
1809
- "~": ["<s>", "</s>"],
1810
- "\n": ["<br />"],
1811
- " ": ["<br />"],
1812
- "-": ["<hr />"]
1813
- };
1814
-
1815
- function n$1(e) {
1816
- return e.replace(RegExp("^" + (e.match(/^(\t| )+/) || "")[0], "gm"), "");
1455
+ function n$1(e) {
1456
+ return e.replace(RegExp("^" + (e.match(/^(\t| )+/) || "")[0], "gm"), "");
1817
1457
  }
1818
1458
 
1819
1459
  function r(e) {
@@ -2442,7 +2082,7 @@
2442
2082
  */
2443
2083
 
2444
2084
 
2445
- function isArray(obj) {
2085
+ function isArray$1(obj) {
2446
2086
  return Array.isArray(obj);
2447
2087
  }
2448
2088
  /**
@@ -2470,7 +2110,7 @@
2470
2110
 
2471
2111
 
2472
2112
  function annotate(...args) {
2473
- if (args.length === 1 && isArray(args[0])) {
2113
+ if (args.length === 1 && isArray$1(args[0])) {
2474
2114
  args = args[0];
2475
2115
  }
2476
2116
 
@@ -2601,7 +2241,7 @@
2601
2241
  }
2602
2242
 
2603
2243
  if (typeof fn !== 'function') {
2604
- if (isArray(fn)) {
2244
+ if (isArray$1(fn)) {
2605
2245
  fn = annotate(fn.slice());
2606
2246
  } else {
2607
2247
  throw error(`Cannot invoke "${fn}". Expected a function!`);
@@ -2845,7 +2485,7 @@
2845
2485
 
2846
2486
 
2847
2487
  function arrayUnwrap(type, value) {
2848
- if (type !== 'value' && isArray(value)) {
2488
+ if (type !== 'value' && isArray$1(value)) {
2849
2489
  value = annotate(value.slice());
2850
2490
  }
2851
2491
 
@@ -2965,22 +2605,22 @@
2965
2605
 
2966
2606
 
2967
2607
  EventBus$1.prototype.on = function (events, priority, callback, that) {
2968
- events = isArray$1(events) ? events : [events];
2608
+ events = isArray$2(events) ? events : [events];
2969
2609
 
2970
- if (isFunction(priority)) {
2610
+ if (isFunction$1(priority)) {
2971
2611
  that = callback;
2972
2612
  callback = priority;
2973
2613
  priority = DEFAULT_PRIORITY$3;
2974
2614
  }
2975
2615
 
2976
- if (!isNumber(priority)) {
2616
+ if (!isNumber$1(priority)) {
2977
2617
  throw new Error('priority must be a number');
2978
2618
  }
2979
2619
 
2980
2620
  var actualCallback = callback;
2981
2621
 
2982
2622
  if (that) {
2983
- actualCallback = bind(callback, that); // make sure we remember and are able to remove
2623
+ actualCallback = bind$2(callback, that); // make sure we remember and are able to remove
2984
2624
  // bound callbacks via {@link #off} using the original
2985
2625
  // callback
2986
2626
 
@@ -3009,13 +2649,13 @@
3009
2649
  EventBus$1.prototype.once = function (event, priority, callback, that) {
3010
2650
  var self = this;
3011
2651
 
3012
- if (isFunction(priority)) {
2652
+ if (isFunction$1(priority)) {
3013
2653
  that = callback;
3014
2654
  callback = priority;
3015
2655
  priority = DEFAULT_PRIORITY$3;
3016
2656
  }
3017
2657
 
3018
- if (!isNumber(priority)) {
2658
+ if (!isNumber$1(priority)) {
3019
2659
  throw new Error('priority must be a number');
3020
2660
  }
3021
2661
 
@@ -3043,7 +2683,7 @@
3043
2683
 
3044
2684
 
3045
2685
  EventBus$1.prototype.off = function (events, callback) {
3046
- events = isArray$1(events) ? events : [events];
2686
+ events = isArray$2(events) ? events : [events];
3047
2687
  var self = this;
3048
2688
  events.forEach(function (event) {
3049
2689
  self._removeListener(event, callback);
@@ -3311,7 +2951,7 @@
3311
2951
  };
3312
2952
 
3313
2953
  InternalEvent$1.prototype.init = function (data) {
3314
- assign(this, data || {});
2954
+ assign$1(this, data || {});
3315
2955
  };
3316
2956
  /**
3317
2957
  * Invoke function. Be fast...
@@ -3342,7 +2982,7 @@
3342
2982
  errors = [...errors, `Field must match pattern ${validate.pattern}.`];
3343
2983
  }
3344
2984
 
3345
- if (validate.required && (isNil(value) || value === '')) {
2985
+ if (validate.required && (isNil$1(value) || value === '')) {
3346
2986
  errors = [...errors, 'Field is required.'];
3347
2987
  }
3348
2988
 
@@ -3614,7 +3254,7 @@
3614
3254
 
3615
3255
  if (valuesKey) {
3616
3256
  importedData = { ...importedData,
3617
- [valuesKey]: get(data, [valuesKey])
3257
+ [valuesKey]: get$1(data, [valuesKey])
3618
3258
  };
3619
3259
  } // try to get value from data
3620
3260
  // if unavailable - try to get default value from form field
@@ -3624,9 +3264,9 @@
3624
3264
  if (_path) {
3625
3265
  const fieldImplementation = this._formFields.get(type);
3626
3266
 
3627
- let valueData = get(data, _path);
3267
+ let valueData = get$1(data, _path);
3628
3268
 
3629
- if (!isUndefined(valueData) && fieldImplementation.sanitizeValue) {
3269
+ if (!isUndefined$1(valueData) && fieldImplementation.sanitizeValue) {
3630
3270
  valueData = fieldImplementation.sanitizeValue({
3631
3271
  formField,
3632
3272
  data,
@@ -3634,7 +3274,7 @@
3634
3274
  });
3635
3275
  }
3636
3276
 
3637
- const initialFieldValue = !isUndefined(valueData) ? valueData : !isUndefined(defaultValue) ? defaultValue : fieldImplementation.emptyValue;
3277
+ const initialFieldValue = !isUndefined$1(valueData) ? valueData : !isUndefined$1(defaultValue) ? defaultValue : fieldImplementation.emptyValue;
3638
3278
  importedData = { ...importedData,
3639
3279
  [_path[0]]: initialFieldValue
3640
3280
  };
@@ -3816,7 +3456,7 @@
3816
3456
  } = formField;
3817
3457
 
3818
3458
  try {
3819
- const validValues = (valuesKey ? get(data, [valuesKey]) : values).map(v => v.value) || [];
3459
+ const validValues = (valuesKey ? get$1(data, [valuesKey]) : values).map(v => v.value) || [];
3820
3460
  return validValues.includes(value) ? value : null;
3821
3461
  } catch (error) {
3822
3462
  // use default value in case of formatting error
@@ -3837,7 +3477,7 @@
3837
3477
  } = formField;
3838
3478
 
3839
3479
  try {
3840
- const validValues = (valuesKey ? get(data, [valuesKey]) : values).map(v => v.value) || [];
3480
+ const validValues = (valuesKey ? get$1(data, [valuesKey]) : values).map(v => v.value) || [];
3841
3481
  return value.filter(v => validValues.includes(v));
3842
3482
  } catch (error) {
3843
3483
  // use default value in case of formatting error
@@ -4200,7 +3840,7 @@
4200
3840
  throw new Error(`cannot render field <${field.type}>`);
4201
3841
  }
4202
3842
 
4203
- const value = get(data, _path);
3843
+ const value = get$1(data, _path);
4204
3844
  const fieldErrors = findErrors(errors, _path);
4205
3845
  const disabled = properties.readOnly || field.disabled || false;
4206
3846
  return e$1(Element, {
@@ -5018,7 +4658,7 @@
5018
4658
 
5019
4659
  Textfield$1.sanitizeValue = ({
5020
4660
  value
5021
- }) => isArray$1(value) || isObject(value) ? null : String(value);
4661
+ }) => isArray$2(value) || isObject$1(value) ? null : String(value);
5022
4662
 
5023
4663
  const formFields = [Button, Checkbox$1, Checklist, Default, Number$1, Radio, Select$1, Taglist, Text$3, Textfield$1];
5024
4664
 
@@ -5279,7 +4919,7 @@
5279
4919
  return data;
5280
4920
  }
5281
4921
 
5282
- const value = get(this._getState().data, _path);
4922
+ const value = get$1(this._getState().data, _path);
5283
4923
  return { ...data,
5284
4924
  [_path[0]]: value
5285
4925
  };
@@ -5328,9 +4968,9 @@
5328
4968
  return errors;
5329
4969
  }
5330
4970
 
5331
- const value = get(data, _path);
4971
+ const value = get$1(data, _path);
5332
4972
  const fieldErrors = validator.validateField(field, value);
5333
- return set(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
4973
+ return set$1(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
5334
4974
  },
5335
4975
  /** @type {Errors} */
5336
4976
  {});
@@ -5353,7 +4993,7 @@
5353
4993
 
5354
4994
  this.detach();
5355
4995
 
5356
- if (isString(parentNode)) {
4996
+ if (isString$1(parentNode)) {
5357
4997
  parentNode = document.querySelector(parentNode);
5358
4998
  }
5359
4999
 
@@ -5394,7 +5034,7 @@
5394
5034
 
5395
5035
 
5396
5036
  setProperty(property, value) {
5397
- const properties = set(this._getState().properties, [property], value);
5037
+ const properties = set$1(this._getState().properties, [property], value);
5398
5038
 
5399
5039
  this._setState({
5400
5040
  properties
@@ -5459,53 +5099,463 @@
5459
5099
  _path
5460
5100
  } = field;
5461
5101
 
5462
- let {
5463
- data,
5464
- errors
5465
- } = this._getState();
5102
+ let {
5103
+ data,
5104
+ errors
5105
+ } = this._getState();
5106
+
5107
+ const validator = this.get('validator');
5108
+ const fieldErrors = validator.validateField(field, value);
5109
+ set$1(data, _path, value);
5110
+ set$1(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
5111
+
5112
+ this._setState({
5113
+ data: clone(data),
5114
+ errors: clone(errors)
5115
+ });
5116
+ }
5117
+ /**
5118
+ * @internal
5119
+ */
5120
+
5121
+
5122
+ _getState() {
5123
+ return this._state;
5124
+ }
5125
+ /**
5126
+ * @internal
5127
+ */
5128
+
5129
+
5130
+ _setState(state) {
5131
+ this._state = { ...this._state,
5132
+ ...state
5133
+ };
5134
+
5135
+ this._emit('changed', this._getState());
5136
+ }
5137
+ /**
5138
+ * @internal
5139
+ */
5140
+
5141
+
5142
+ _onEvent(type, priority, handler) {
5143
+ this.get('eventBus').on(type, priority, handler);
5144
+ }
5145
+
5146
+ }
5147
+
5148
+ const schemaVersion = 5;
5149
+
5150
+ /**
5151
+ * Flatten array, one level deep.
5152
+ *
5153
+ * @param {Array<?>} arr
5154
+ *
5155
+ * @return {Array<?>}
5156
+ */
5157
+
5158
+ const nativeToString = Object.prototype.toString;
5159
+ const nativeHasOwnProperty = Object.prototype.hasOwnProperty;
5160
+
5161
+ function isUndefined(obj) {
5162
+ return obj === undefined;
5163
+ }
5164
+
5165
+ function isDefined(obj) {
5166
+ return obj !== undefined;
5167
+ }
5168
+
5169
+ function isNil(obj) {
5170
+ return obj == null;
5171
+ }
5172
+
5173
+ function isArray(obj) {
5174
+ return nativeToString.call(obj) === '[object Array]';
5175
+ }
5176
+
5177
+ function isObject(obj) {
5178
+ return nativeToString.call(obj) === '[object Object]';
5179
+ }
5180
+
5181
+ function isNumber(obj) {
5182
+ return nativeToString.call(obj) === '[object Number]';
5183
+ }
5184
+
5185
+ function isFunction(obj) {
5186
+ const tag = nativeToString.call(obj);
5187
+ return tag === '[object Function]' || tag === '[object AsyncFunction]' || tag === '[object GeneratorFunction]' || tag === '[object AsyncGeneratorFunction]' || tag === '[object Proxy]';
5188
+ }
5189
+
5190
+ function isString(obj) {
5191
+ return nativeToString.call(obj) === '[object String]';
5192
+ }
5193
+ /**
5194
+ * Ensure collection is an array.
5195
+ *
5196
+ * @param {Object} obj
5197
+ */
5198
+
5199
+
5200
+ function ensureArray(obj) {
5201
+ if (isArray(obj)) {
5202
+ return;
5203
+ }
5204
+
5205
+ throw new Error('must supply array');
5206
+ }
5207
+ /**
5208
+ * Return true, if target owns a property with the given key.
5209
+ *
5210
+ * @param {Object} target
5211
+ * @param {String} key
5212
+ *
5213
+ * @return {Boolean}
5214
+ */
5215
+
5216
+
5217
+ function has(target, key) {
5218
+ return nativeHasOwnProperty.call(target, key);
5219
+ }
5220
+ /**
5221
+ * Find element in collection.
5222
+ *
5223
+ * @param {Array|Object} collection
5224
+ * @param {Function|Object} matcher
5225
+ *
5226
+ * @return {Object}
5227
+ */
5228
+
5229
+
5230
+ function find$3(collection, matcher) {
5231
+ matcher = toMatcher(matcher);
5232
+ let match;
5233
+ forEach(collection, function (val, key) {
5234
+ if (matcher(val, key)) {
5235
+ match = val;
5236
+ return false;
5237
+ }
5238
+ });
5239
+ return match;
5240
+ }
5241
+ /**
5242
+ * Iterate over collection; returning something
5243
+ * (non-undefined) will stop iteration.
5244
+ *
5245
+ * @param {Array|Object} collection
5246
+ * @param {Function} iterator
5247
+ *
5248
+ * @return {Object} return result that stopped the iteration
5249
+ */
5250
+
5251
+
5252
+ function forEach(collection, iterator) {
5253
+ let val, result;
5254
+
5255
+ if (isUndefined(collection)) {
5256
+ return;
5257
+ }
5258
+
5259
+ const convertKey = isArray(collection) ? toNum : identity;
5260
+
5261
+ for (let key in collection) {
5262
+ if (has(collection, key)) {
5263
+ val = collection[key];
5264
+ result = iterator(val, convertKey(key));
5265
+
5266
+ if (result === false) {
5267
+ return val;
5268
+ }
5269
+ }
5270
+ }
5271
+ }
5272
+ /**
5273
+ * Return collection without element.
5274
+ *
5275
+ * @param {Array} arr
5276
+ * @param {Function} matcher
5277
+ *
5278
+ * @return {Array}
5279
+ */
5280
+
5281
+
5282
+ function without(arr, matcher) {
5283
+ if (isUndefined(arr)) {
5284
+ return [];
5285
+ }
5286
+
5287
+ ensureArray(arr);
5288
+ matcher = toMatcher(matcher);
5289
+ return arr.filter(function (el, idx) {
5290
+ return !matcher(el, idx);
5291
+ });
5292
+ }
5293
+ /**
5294
+ * Transform a collection into another collection
5295
+ * by piping each member through the given fn.
5296
+ *
5297
+ * @param {Object|Array} collection
5298
+ * @param {Function} fn
5299
+ *
5300
+ * @return {Array} transformed collection
5301
+ */
5302
+
5303
+
5304
+ function map$1(collection, fn) {
5305
+ let result = [];
5306
+ forEach(collection, function (val, key) {
5307
+ result.push(fn(val, key));
5308
+ });
5309
+ return result;
5310
+ }
5311
+ /**
5312
+ * Group collection members by attribute.
5313
+ *
5314
+ * @param {Object|Array} collection
5315
+ * @param {Function} extractor
5316
+ *
5317
+ * @return {Object} map with { attrValue => [ a, b, c ] }
5318
+ */
5319
+
5320
+
5321
+ function groupBy(collection, extractor, grouped = {}) {
5322
+ extractor = toExtractor(extractor);
5323
+ forEach(collection, function (val) {
5324
+ let discriminator = extractor(val) || '_';
5325
+ let group = grouped[discriminator];
5326
+
5327
+ if (!group) {
5328
+ group = grouped[discriminator] = [];
5329
+ }
5330
+
5331
+ group.push(val);
5332
+ });
5333
+ return grouped;
5334
+ }
5335
+
5336
+ function uniqueBy(extractor, ...collections) {
5337
+ extractor = toExtractor(extractor);
5338
+ let grouped = {};
5339
+ forEach(collections, c => groupBy(c, extractor, grouped));
5340
+ let result = map$1(grouped, function (val, key) {
5341
+ return val[0];
5342
+ });
5343
+ return result;
5344
+ }
5345
+ /**
5346
+ * Sort collection by criteria.
5347
+ *
5348
+ * @param {Object|Array} collection
5349
+ * @param {String|Function} extractor
5350
+ *
5351
+ * @return {Array}
5352
+ */
5353
+
5354
+ function sortBy(collection, extractor) {
5355
+ extractor = toExtractor(extractor);
5356
+ let sorted = [];
5357
+ forEach(collection, function (value, key) {
5358
+ let disc = extractor(value, key);
5359
+ let entry = {
5360
+ d: disc,
5361
+ v: value
5362
+ };
5363
+
5364
+ for (var idx = 0; idx < sorted.length; idx++) {
5365
+ let {
5366
+ d
5367
+ } = sorted[idx];
5368
+
5369
+ if (disc < d) {
5370
+ sorted.splice(idx, 0, entry);
5371
+ return;
5372
+ }
5373
+ } // not inserted, append (!)
5374
+
5375
+
5376
+ sorted.push(entry);
5377
+ });
5378
+ return map$1(sorted, e => e.v);
5379
+ }
5380
+
5381
+ function toExtractor(extractor) {
5382
+ return isFunction(extractor) ? extractor : e => {
5383
+ return e[extractor];
5384
+ };
5385
+ }
5386
+
5387
+ function toMatcher(matcher) {
5388
+ return isFunction(matcher) ? matcher : e => {
5389
+ return e === matcher;
5390
+ };
5391
+ }
5392
+
5393
+ function identity(arg) {
5394
+ return arg;
5395
+ }
5396
+
5397
+ function toNum(arg) {
5398
+ return Number(arg);
5399
+ }
5400
+ /**
5401
+ * Debounce fn, calling it only once if the given time
5402
+ * elapsed between calls.
5403
+ *
5404
+ * Lodash-style the function exposes methods to `#clear`
5405
+ * and `#flush` to control internal behavior.
5406
+ *
5407
+ * @param {Function} fn
5408
+ * @param {Number} timeout
5409
+ *
5410
+ * @return {Function} debounced function
5411
+ */
5412
+
5413
+
5414
+ function debounce$2(fn, timeout) {
5415
+ let timer;
5416
+ let lastArgs;
5417
+ let lastThis;
5418
+ let lastNow;
5419
+
5420
+ function fire(force) {
5421
+ let now = Date.now();
5422
+ let scheduledDiff = force ? 0 : lastNow + timeout - now;
5423
+
5424
+ if (scheduledDiff > 0) {
5425
+ return schedule(scheduledDiff);
5426
+ }
5427
+
5428
+ fn.apply(lastThis, lastArgs);
5429
+ clear();
5430
+ }
5431
+
5432
+ function schedule(timeout) {
5433
+ timer = setTimeout(fire, timeout);
5434
+ }
5435
+
5436
+ function clear() {
5437
+ if (timer) {
5438
+ clearTimeout(timer);
5439
+ }
5440
+
5441
+ timer = lastNow = lastArgs = lastThis = undefined;
5442
+ }
5443
+
5444
+ function flush() {
5445
+ if (timer) {
5446
+ fire(true);
5447
+ }
5448
+
5449
+ clear();
5450
+ }
5451
+
5452
+ function callback(...args) {
5453
+ lastNow = Date.now();
5454
+ lastArgs = args;
5455
+ lastThis = this; // ensure an execution is scheduled
5456
+
5457
+ if (!timer) {
5458
+ schedule(timeout);
5459
+ }
5460
+ }
5461
+
5462
+ callback.flush = flush;
5463
+ callback.cancel = clear;
5464
+ return callback;
5465
+ }
5466
+ /**
5467
+ * Bind function against target <this>.
5468
+ *
5469
+ * @param {Function} fn
5470
+ * @param {Object} target
5471
+ *
5472
+ * @return {Function} bound function
5473
+ */
5474
+
5466
5475
 
5467
- const validator = this.get('validator');
5468
- const fieldErrors = validator.validateField(field, value);
5469
- set(data, _path, value);
5470
- set(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
5476
+ function bind(fn, target) {
5477
+ return fn.bind(target);
5478
+ }
5479
+ /**
5480
+ * Convenience wrapper for `Object.assign`.
5481
+ *
5482
+ * @param {Object} target
5483
+ * @param {...Object} others
5484
+ *
5485
+ * @return {Object} the target
5486
+ */
5471
5487
 
5472
- this._setState({
5473
- data: clone(data),
5474
- errors: clone(errors)
5475
- });
5476
- }
5477
- /**
5478
- * @internal
5479
- */
5480
5488
 
5489
+ function assign(target, ...others) {
5490
+ return Object.assign(target, ...others);
5491
+ }
5492
+ /**
5493
+ * Sets a nested property of a given object to the specified value.
5494
+ *
5495
+ * This mutates the object and returns it.
5496
+ *
5497
+ * @param {Object} target The target of the set operation.
5498
+ * @param {(string|number)[]} path The path to the nested value.
5499
+ * @param {any} value The value to set.
5500
+ */
5481
5501
 
5482
- _getState() {
5483
- return this._state;
5484
- }
5485
- /**
5486
- * @internal
5487
- */
5488
5502
 
5503
+ function set(target, path, value) {
5504
+ let currentTarget = target;
5505
+ forEach(path, function (key, idx) {
5506
+ if (typeof key !== 'number' && typeof key !== 'string') {
5507
+ throw new Error('illegal key type: ' + typeof key + '. Key should be of type number or string.');
5508
+ }
5489
5509
 
5490
- _setState(state) {
5491
- this._state = { ...this._state,
5492
- ...state
5493
- };
5510
+ if (key === 'constructor') {
5511
+ throw new Error('illegal key: constructor');
5512
+ }
5494
5513
 
5495
- this._emit('changed', this._getState());
5496
- }
5497
- /**
5498
- * @internal
5499
- */
5514
+ if (key === '__proto__') {
5515
+ throw new Error('illegal key: __proto__');
5516
+ }
5500
5517
 
5518
+ let nextKey = path[idx + 1];
5519
+ let nextTarget = currentTarget[key];
5501
5520
 
5502
- _onEvent(type, priority, handler) {
5503
- this.get('eventBus').on(type, priority, handler);
5504
- }
5521
+ if (isDefined(nextKey) && isNil(nextTarget)) {
5522
+ nextTarget = currentTarget[key] = isNaN(+nextKey) ? {} : [];
5523
+ }
5505
5524
 
5525
+ if (isUndefined(nextKey)) {
5526
+ if (isUndefined(value)) {
5527
+ delete currentTarget[key];
5528
+ } else {
5529
+ currentTarget[key] = value;
5530
+ }
5531
+ } else {
5532
+ currentTarget = nextTarget;
5533
+ }
5534
+ });
5535
+ return target;
5506
5536
  }
5537
+ /**
5538
+ * Gets a nested property of a given object.
5539
+ *
5540
+ * @param {Object} target The target of the get operation.
5541
+ * @param {(string|number)[]} path The path to the nested value.
5542
+ * @param {any} [defaultValue] The value to return if no value exists.
5543
+ */
5507
5544
 
5508
- const schemaVersion = 5;
5545
+
5546
+ function get(target, path, defaultValue) {
5547
+ let currentTarget = target;
5548
+ forEach(path, function (key) {
5549
+ // accessing nil property yields <undefined>
5550
+ if (isNil(currentTarget)) {
5551
+ currentTarget = undefined;
5552
+ return false;
5553
+ }
5554
+
5555
+ currentTarget = currentTarget[key];
5556
+ });
5557
+ return isUndefined(currentTarget) ? defaultValue : currentTarget;
5558
+ }
5509
5559
 
5510
5560
  var atoa$1 = function atoa(a, n) {
5511
5561
  return Array.prototype.slice.call(a, n);
@@ -6644,6 +6694,196 @@
6644
6694
 
6645
6695
  var dragula_1 = dragula;
6646
6696
 
6697
+ function _mergeNamespaces(n, m) {
6698
+ m.forEach(function (e) {
6699
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
6700
+ if (k !== 'default' && !(k in n)) {
6701
+ var d = Object.getOwnPropertyDescriptor(e, k);
6702
+ Object.defineProperty(n, k, d.get ? d : {
6703
+ enumerable: true,
6704
+ get: function () {
6705
+ return e[k];
6706
+ }
6707
+ });
6708
+ }
6709
+ });
6710
+ });
6711
+ return Object.freeze(n);
6712
+ }
6713
+ /**
6714
+ * @param { HTMLElement } element
6715
+ * @param { String } selector
6716
+ *
6717
+ * @return { boolean }
6718
+ */
6719
+
6720
+
6721
+ function matches(element, selector) {
6722
+ return element && typeof element.matches === 'function' && element.matches(selector);
6723
+ }
6724
+ /**
6725
+ * Closest
6726
+ *
6727
+ * @param {Element} el
6728
+ * @param {String} selector
6729
+ * @param {Boolean} checkYourSelf (optional)
6730
+ */
6731
+
6732
+
6733
+ function closest(element, selector, checkYourSelf) {
6734
+ var currentElem = checkYourSelf ? element : element.parentNode;
6735
+
6736
+ while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE && currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
6737
+ if (matches(currentElem, selector)) {
6738
+ return currentElem;
6739
+ }
6740
+
6741
+ currentElem = currentElem.parentNode;
6742
+ }
6743
+
6744
+ return matches(currentElem, selector) ? currentElem : null;
6745
+ }
6746
+
6747
+ var componentEvent = {};
6748
+ var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
6749
+ unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
6750
+ prefix = bind$1 !== 'addEventListener' ? 'on' : '';
6751
+ /**
6752
+ * Bind `el` event `type` to `fn`.
6753
+ *
6754
+ * @param {Element} el
6755
+ * @param {String} type
6756
+ * @param {Function} fn
6757
+ * @param {Boolean} capture
6758
+ * @return {Function}
6759
+ * @api public
6760
+ */
6761
+
6762
+ var bind_1 = componentEvent.bind = function (el, type, fn, capture) {
6763
+ el[bind$1](prefix + type, fn, capture || false);
6764
+ return fn;
6765
+ };
6766
+ /**
6767
+ * Unbind `el` event `type`'s callback `fn`.
6768
+ *
6769
+ * @param {Element} el
6770
+ * @param {String} type
6771
+ * @param {Function} fn
6772
+ * @param {Boolean} capture
6773
+ * @return {Function}
6774
+ * @api public
6775
+ */
6776
+
6777
+
6778
+ var unbind_1 = componentEvent.unbind = function (el, type, fn, capture) {
6779
+ el[unbind$1](prefix + type, fn, capture || false);
6780
+ return fn;
6781
+ };
6782
+
6783
+ var event = /*#__PURE__*/_mergeNamespaces({
6784
+ __proto__: null,
6785
+ bind: bind_1,
6786
+ unbind: unbind_1,
6787
+ 'default': componentEvent
6788
+ }, [componentEvent]);
6789
+ /**
6790
+ * Expose `parse`.
6791
+ */
6792
+
6793
+ var domify = parse;
6794
+ /**
6795
+ * Tests for browser support.
6796
+ */
6797
+
6798
+ var innerHTMLBug = false;
6799
+ var bugTestDiv;
6800
+
6801
+ if (typeof document !== 'undefined') {
6802
+ bugTestDiv = document.createElement('div'); // Setup
6803
+
6804
+ bugTestDiv.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>'; // Make sure that link elements get serialized correctly by innerHTML
6805
+ // This requires a wrapper element in IE
6806
+
6807
+ innerHTMLBug = !bugTestDiv.getElementsByTagName('link').length;
6808
+ bugTestDiv = undefined;
6809
+ }
6810
+ /**
6811
+ * Wrap map from jquery.
6812
+ */
6813
+
6814
+
6815
+ var map = {
6816
+ legend: [1, '<fieldset>', '</fieldset>'],
6817
+ tr: [2, '<table><tbody>', '</tbody></table>'],
6818
+ col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
6819
+ // for script/link/style tags to work in IE6-8, you have to wrap
6820
+ // in a div with a non-whitespace character in front, ha!
6821
+ _default: innerHTMLBug ? [1, 'X<div>', '</div>'] : [0, '', '']
6822
+ };
6823
+ map.td = map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
6824
+ map.option = map.optgroup = [1, '<select multiple="multiple">', '</select>'];
6825
+ map.thead = map.tbody = map.colgroup = map.caption = map.tfoot = [1, '<table>', '</table>'];
6826
+ map.polyline = map.ellipse = map.polygon = map.circle = map.text = map.line = map.path = map.rect = map.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">', '</svg>'];
6827
+ /**
6828
+ * Parse `html` and return a DOM Node instance, which could be a TextNode,
6829
+ * HTML DOM Node of some kind (<div> for example), or a DocumentFragment
6830
+ * instance, depending on the contents of the `html` string.
6831
+ *
6832
+ * @param {String} html - HTML string to "domify"
6833
+ * @param {Document} doc - The `document` instance to create the Node for
6834
+ * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance
6835
+ * @api private
6836
+ */
6837
+
6838
+ function parse(html, doc) {
6839
+ if ('string' != typeof html) throw new TypeError('String expected'); // default to the global `document` object
6840
+
6841
+ if (!doc) doc = document; // tag name
6842
+
6843
+ var m = /<([\w:]+)/.exec(html);
6844
+ if (!m) return doc.createTextNode(html);
6845
+ html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace
6846
+
6847
+ var tag = m[1]; // body support
6848
+
6849
+ if (tag == 'body') {
6850
+ var el = doc.createElement('html');
6851
+ el.innerHTML = html;
6852
+ return el.removeChild(el.lastChild);
6853
+ } // wrap map
6854
+
6855
+
6856
+ var wrap = Object.prototype.hasOwnProperty.call(map, tag) ? map[tag] : map._default;
6857
+ var depth = wrap[0];
6858
+ var prefix = wrap[1];
6859
+ var suffix = wrap[2];
6860
+ var el = doc.createElement('div');
6861
+ el.innerHTML = prefix + html + suffix;
6862
+
6863
+ while (depth--) el = el.lastChild; // one element
6864
+
6865
+
6866
+ if (el.firstChild == el.lastChild) {
6867
+ return el.removeChild(el.firstChild);
6868
+ } // several elements
6869
+
6870
+
6871
+ var fragment = doc.createDocumentFragment();
6872
+
6873
+ while (el.firstChild) {
6874
+ fragment.appendChild(el.removeChild(el.firstChild));
6875
+ }
6876
+
6877
+ return fragment;
6878
+ }
6879
+
6880
+ var domify$1 = domify;
6881
+
6882
+ function query(selector, el) {
6883
+ el = el || document;
6884
+ return el.querySelector(selector);
6885
+ }
6886
+
6647
6887
  var arrayMove$1 = {exports: {}};
6648
6888
 
6649
6889
  const arrayMoveMutate = (array, from, to) => {
@@ -6765,7 +7005,7 @@
6765
7005
  * @param {number} [priority=1000] the priority in which this listener is called, larger is higher
6766
7006
  * @param {Function} callback
6767
7007
  * @param {Object} [that] Pass context (`this`) to the callback
6768
- */EventBus.prototype.on=function(events,priority,callback,that){events=isArray$1(events)?events:[events];if(isFunction(priority)){that=callback;callback=priority;priority=DEFAULT_PRIORITY$2;}if(!isNumber(priority)){throw new Error('priority must be a number');}var actualCallback=callback;if(that){actualCallback=bind(callback,that);// make sure we remember and are able to remove
7008
+ */EventBus.prototype.on=function(events,priority,callback,that){events=isArray(events)?events:[events];if(isFunction(priority)){that=callback;callback=priority;priority=DEFAULT_PRIORITY$2;}if(!isNumber(priority)){throw new Error('priority must be a number');}var actualCallback=callback;if(that){actualCallback=bind(callback,that);// make sure we remember and are able to remove
6769
7009
  // bound callbacks via {@link #off} using the original
6770
7010
  // callback
6771
7011
  actualCallback[FN_REF]=callback[FN_REF]||callback;}var self=this;events.forEach(function(e){self._addListener(e,{priority:priority,callback:actualCallback,next:null});});};/**
@@ -6785,7 +7025,7 @@
6785
7025
  *
6786
7026
  * @param {string|Array<string>} events
6787
7027
  * @param {Function} [callback]
6788
- */EventBus.prototype.off=function(events,callback){events=isArray$1(events)?events:[events];var self=this;events.forEach(function(event){self._removeListener(event,callback);});};/**
7028
+ */EventBus.prototype.off=function(events,callback){events=isArray(events)?events:[events];var self=this;events.forEach(function(event){self._removeListener(event,callback);});};/**
6789
7029
  * Create an EventBus event.
6790
7030
  *
6791
7031
  * @param {Object} data
@@ -6960,7 +7200,7 @@
6960
7200
  * @param {Injector} injector
6961
7201
  */EditorActions.prototype._registerDefaultActions=function(injector){// (1) retrieve optional components to integrate with
6962
7202
  var commandStack=injector.get('commandStack',false);var modeling=injector.get('modeling',false);var selection=injector.get('selection',false);var zoomScroll=injector.get('zoomScroll',false);var copyPaste=injector.get('copyPaste',false);var canvas=injector.get('canvas',false);var rules=injector.get('rules',false);var keyboardMove=injector.get('keyboardMove',false);var keyboardMoveSelection=injector.get('keyboardMoveSelection',false);// (2) check components and register actions
6963
- if(commandStack){this.register('undo',function(){commandStack.undo();});this.register('redo',function(){commandStack.redo();});}if(copyPaste&&selection){this.register('copy',function(){var selectedElements=selection.get();copyPaste.copy(selectedElements);});}if(copyPaste){this.register('paste',function(){copyPaste.paste();});}if(zoomScroll){this.register('stepZoom',function(opts){zoomScroll.stepZoom(opts.value);});}if(canvas){this.register('zoom',function(opts){canvas.zoom(opts.value);});}if(modeling&&selection&&rules){this.register('removeSelection',function(){var selectedElements=selection.get();if(!selectedElements.length){return;}var allowed=rules.allowed('elements.delete',{elements:selectedElements}),removableElements;if(allowed===false){return;}else if(isArray$1(allowed)){removableElements=allowed;}else {removableElements=selectedElements;}if(removableElements.length){modeling.removeElements(removableElements.slice());}});}if(keyboardMove){this.register('moveCanvas',function(opts){keyboardMove.moveCanvas(opts);});}if(keyboardMoveSelection){this.register('moveSelection',function(opts){keyboardMoveSelection.moveSelection(opts.direction,opts.accelerated);});}};/**
7203
+ if(commandStack){this.register('undo',function(){commandStack.undo();});this.register('redo',function(){commandStack.redo();});}if(copyPaste&&selection){this.register('copy',function(){var selectedElements=selection.get();if(selectedElements.length){return copyPaste.copy(selectedElements);}});}if(copyPaste){this.register('paste',function(){copyPaste.paste();});}if(zoomScroll){this.register('stepZoom',function(opts){zoomScroll.stepZoom(opts.value);});}if(canvas){this.register('zoom',function(opts){canvas.zoom(opts.value);});}if(modeling&&selection&&rules){this.register('removeSelection',function(){var selectedElements=selection.get();if(!selectedElements.length){return;}var allowed=rules.allowed('elements.delete',{elements:selectedElements}),removableElements;if(allowed===false){return;}else if(isArray(allowed)){removableElements=allowed;}else {removableElements=selectedElements;}if(removableElements.length){modeling.removeElements(removableElements.slice());}});}if(keyboardMove){this.register('moveCanvas',function(opts){keyboardMove.moveCanvas(opts);});}if(keyboardMoveSelection){this.register('moveSelection',function(opts){keyboardMoveSelection.moveSelection(opts.direction,opts.accelerated);});}};/**
6964
7204
  * Triggers a registered action
6965
7205
  *
6966
7206
  * @param {string} action
@@ -7010,7 +7250,7 @@
7010
7250
  */EditorActions.prototype.isRegistered=function(action){return !!this._actions[action];};function error(action,message){return new Error(action+' '+message);}var EditorActionsModule$1={__init__:['editorActions'],editorActions:['type',EditorActions]};class FormEditorActions extends EditorActions{constructor(eventBus,injector){super(eventBus,injector);eventBus.on('form.init',()=>{this._registerDefaultActions(injector);eventBus.fire('editorActions.init',{editorActions:this});});}_registerDefaultActions(injector){const commandStack=injector.get('commandStack',false),formFieldRegistry=injector.get('formFieldRegistry',false),selection=injector.get('selection',false);if(commandStack){// @ts-ignore
7011
7251
  this.register('undo',()=>{commandStack.undo();});// @ts-ignore
7012
7252
  this.register('redo',()=>{commandStack.redo();});}if(formFieldRegistry&&selection){// @ts-ignore
7013
- this.register('selectFormField',(options={})=>{const{id}=options;if(!id){return;}const formField=formFieldRegistry.get(id);if(formField){selection.set(formField);}});}}}FormEditorActions.$inject=['eventBus','injector'];var EditorActionsModule={__depends__:[EditorActionsModule$1],editorActions:['type',FormEditorActions]};/**
7253
+ this.register('selectFormField',(options={})=>{const{id}=options;if(!id){return;}const formField=formFieldRegistry.get(id);if(formField){selection.set(formField);}});}}}FormEditorActions.$inject=['eventBus','injector'];var EditorActionsModule={__depends__:[EditorActionsModule$1],editorActions:['type',FormEditorActions]};var KEYCODE_C=67;var KEYCODE_V=86;var KEYCODE_Y$1=89;var KEYCODE_Z$1=90;var KEYS_COPY=['c','C',KEYCODE_C];var KEYS_PASTE=['v','V',KEYCODE_V];var KEYS_REDO$1=['y','Y',KEYCODE_Y$1];var KEYS_UNDO$1=['z','Z',KEYCODE_Z$1];/**
7014
7254
  * Returns true if event was triggered with any modifier
7015
7255
  * @param {KeyboardEvent} event
7016
7256
  */function hasModifier(event){return event.ctrlKey||event.metaKey||event.shiftKey||event.altKey;}/**
@@ -7022,9 +7262,9 @@
7022
7262
  *
7023
7263
  * @param {string|Array<string>} keys
7024
7264
  * @param {KeyboardEvent} event
7025
- */function isKey(keys,event){keys=isArray$1(keys)?keys:[keys];return keys.indexOf(event.key)!==-1||keys.indexOf(event.keyCode)!==-1;}/**
7265
+ */function isKey(keys,event){keys=isArray(keys)?keys:[keys];return keys.indexOf(event.key)!==-1||keys.indexOf(event.keyCode)!==-1;}/**
7026
7266
  * @param {KeyboardEvent} event
7027
- */function isShift(event){return event.shiftKey;}var KEYDOWN_EVENT='keyboard.keydown',KEYUP_EVENT='keyboard.keyup';var HANDLE_MODIFIER_ATTRIBUTE='input-handle-modified-keys';var DEFAULT_PRIORITY$1=1000;/**
7267
+ */function isShift(event){return event.shiftKey;}function isCopy(event){return isCmd(event)&&isKey(KEYS_COPY,event);}function isPaste(event){return isCmd(event)&&isKey(KEYS_PASTE,event);}function isUndo(event){return isCmd(event)&&!isShift(event)&&isKey(KEYS_UNDO$1,event);}function isRedo(event){return isCmd(event)&&(isKey(KEYS_REDO$1,event)||isKey(KEYS_UNDO$1,event)&&isShift(event));}var KEYDOWN_EVENT='keyboard.keydown',KEYUP_EVENT='keyboard.keyup';var HANDLE_MODIFIER_ATTRIBUTE='input-handle-modified-keys';var DEFAULT_PRIORITY$1=1000;/**
7028
7268
  * A keyboard abstraction that may be activated and
7029
7269
  * deactivated by users at will, consuming key events
7030
7270
  * and triggering diagram actions.
@@ -7048,10 +7288,10 @@
7048
7288
  * @param {Config} config
7049
7289
  * @param {EventBus} eventBus
7050
7290
  */function Keyboard(config,eventBus){var self=this;this._config=config||{};this._eventBus=eventBus;this._keydownHandler=this._keydownHandler.bind(this);this._keyupHandler=this._keyupHandler.bind(this);// properly clean dom registrations
7051
- eventBus.on('diagram.destroy',function(){self._fire('destroy');self.unbind();});eventBus.on('diagram.init',function(){self._fire('init');});eventBus.on('attach',function(){if(config&&config.bindTo){self.bind(config.bindTo);}});eventBus.on('detach',function(){self.unbind();});}Keyboard.$inject=['config.keyboard','eventBus'];Keyboard.prototype._keydownHandler=function(event){this._keyHandler(event,KEYDOWN_EVENT);};Keyboard.prototype._keyupHandler=function(event){this._keyHandler(event,KEYUP_EVENT);};Keyboard.prototype._keyHandler=function(event,type){var eventBusResult;if(this._isEventIgnored(event)){return;}var context={keyEvent:event};eventBusResult=this._eventBus.fire(type||KEYDOWN_EVENT,context);if(eventBusResult){event.preventDefault();}};Keyboard.prototype._isEventIgnored=function(event){return isInput(event.target)&&this._isModifiedKeyIgnored(event);};Keyboard.prototype._isModifiedKeyIgnored=function(event){if(!isCmd(event)){return true;}var allowedModifiers=this._getAllowedModifiers(event.target);return !allowedModifiers.includes(event.key);};Keyboard.prototype._getAllowedModifiers=function(element){var modifierContainer=closest(element,'['+HANDLE_MODIFIER_ATTRIBUTE+']',true);if(!modifierContainer||this._node&&!this._node.contains(modifierContainer)){return [];}return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');};Keyboard.prototype.bind=function(node){// make sure that the keyboard is only bound once to the DOM
7291
+ eventBus.on('diagram.destroy',function(){self._fire('destroy');self.unbind();});eventBus.on('diagram.init',function(){self._fire('init');});eventBus.on('attach',function(){if(config&&config.bindTo){self.bind(config.bindTo);}});eventBus.on('detach',function(){self.unbind();});}Keyboard.$inject=['config.keyboard','eventBus'];Keyboard.prototype._keydownHandler=function(event){this._keyHandler(event,KEYDOWN_EVENT);};Keyboard.prototype._keyupHandler=function(event){this._keyHandler(event,KEYUP_EVENT);};Keyboard.prototype._keyHandler=function(event,type){var eventBusResult;if(this._isEventIgnored(event)){return;}var context={keyEvent:event};eventBusResult=this._eventBus.fire(type||KEYDOWN_EVENT,context);if(eventBusResult){event.preventDefault();}};Keyboard.prototype._isEventIgnored=function(event){return isInput(event.target)&&this._isModifiedKeyIgnored(event);};Keyboard.prototype._isModifiedKeyIgnored=function(event){if(!isCmd(event)){return true;}var allowedModifiers=this._getAllowedModifiers(event.target);return allowedModifiers.indexOf(event.key)===-1;};Keyboard.prototype._getAllowedModifiers=function(element){var modifierContainer=closest(element,'['+HANDLE_MODIFIER_ATTRIBUTE+']',true);if(!modifierContainer||this._node&&!this._node.contains(modifierContainer)){return [];}return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');};Keyboard.prototype.bind=function(node){// make sure that the keyboard is only bound once to the DOM
7052
7292
  this.unbind();this._node=node;// bind key events
7053
- componentEvent.bind(node,'keydown',this._keydownHandler,true);componentEvent.bind(node,'keyup',this._keyupHandler,true);this._fire('bind');};Keyboard.prototype.getBinding=function(){return this._node;};Keyboard.prototype.unbind=function(){var node=this._node;if(node){this._fire('unbind');// unbind key events
7054
- componentEvent.unbind(node,'keydown',this._keydownHandler,true);componentEvent.unbind(node,'keyup',this._keyupHandler,true);}this._node=null;};Keyboard.prototype._fire=function(event){this._eventBus.fire('keyboard.'+event,{node:this._node});};/**
7293
+ event.bind(node,'keydown',this._keydownHandler,true);event.bind(node,'keyup',this._keyupHandler,true);this._fire('bind');};Keyboard.prototype.getBinding=function(){return this._node;};Keyboard.prototype.unbind=function(){var node=this._node;if(node){this._fire('unbind');// unbind key events
7294
+ event.unbind(node,'keydown',this._keydownHandler,true);event.unbind(node,'keyup',this._keyupHandler,true);}this._node=null;};Keyboard.prototype._fire=function(event){this._eventBus.fire('keyboard.'+event,{node:this._node});};/**
7055
7295
  * Add a listener function that is notified with `KeyboardEvent` whenever
7056
7296
  * the keyboard is bound and the user presses a key. If no priority is
7057
7297
  * provided, the default value of 1000 is used.
@@ -7060,7 +7300,7 @@
7060
7300
  * @param {Function} listener
7061
7301
  * @param {string} type
7062
7302
  */Keyboard.prototype.addListener=function(priority,listener,type){if(isFunction(priority)){type=listener;listener=priority;priority=DEFAULT_PRIORITY$1;}this._eventBus.on(type||KEYDOWN_EVENT,priority,listener);};Keyboard.prototype.removeListener=function(listener,type){this._eventBus.off(type||KEYDOWN_EVENT,listener);};Keyboard.prototype.hasModifier=hasModifier;Keyboard.prototype.isCmd=isCmd;Keyboard.prototype.isShift=isShift;Keyboard.prototype.isKey=isKey;// helpers ///////
7063
- function isInput(target){return target&&(matchesSelector(target,'input, textarea')||target.contentEditable==='true');}var LOW_PRIORITY$1=500;var KEYCODE_C=67;var KEYCODE_V=86;var KEYCODE_Y=89;var KEYCODE_Z=90;var KEYS_COPY=['c','C',KEYCODE_C];var KEYS_PASTE=['v','V',KEYCODE_V];var KEYS_REDO=['y','Y',KEYCODE_Y];var KEYS_UNDO=['z','Z',KEYCODE_Z];/**
7303
+ function isInput(target){return target&&(matches(target,'input, textarea')||target.contentEditable==='true');}var LOW_PRIORITY$1=500;var KEYCODE_Y=89;var KEYCODE_Z=90;var KEYS_REDO=['y','Y',KEYCODE_Y];var KEYS_UNDO=['z','Z',KEYCODE_Z];/**
7064
7304
  * Adds default keyboard bindings.
7065
7305
  *
7066
7306
  * This does not pull in any features will bind only actions that
@@ -7081,14 +7321,14 @@
7081
7321
  * @param {Function} fn that implements the key binding
7082
7322
  */function addListener(action,fn){if(editorActions.isRegistered(action)){keyboard.addListener(fn);}}// undo
7083
7323
  // (CTRL|CMD) + Z
7084
- addListener('undo',function(context){var event=context.keyEvent;if(isCmd(event)&&!isShift(event)&&isKey(KEYS_UNDO,event)){editorActions.trigger('undo');return true;}});// redo
7324
+ addListener('undo',function(context){var event=context.keyEvent;if(isUndo(event)){editorActions.trigger('undo');return true;}});// redo
7085
7325
  // CTRL + Y
7086
7326
  // CMD + SHIFT + Z
7087
- addListener('redo',function(context){var event=context.keyEvent;if(isCmd(event)&&(isKey(KEYS_REDO,event)||isKey(KEYS_UNDO,event)&&isShift(event))){editorActions.trigger('redo');return true;}});// copy
7327
+ addListener('redo',function(context){var event=context.keyEvent;if(isRedo(event)){editorActions.trigger('redo');return true;}});// copy
7088
7328
  // CTRL/CMD + C
7089
- addListener('copy',function(context){var event=context.keyEvent;if(isCmd(event)&&isKey(KEYS_COPY,event)){editorActions.trigger('copy');return true;}});// paste
7329
+ addListener('copy',function(context){var event=context.keyEvent;if(isCopy(event)){editorActions.trigger('copy');return true;}});// paste
7090
7330
  // CTRL/CMD + V
7091
- addListener('paste',function(context){var event=context.keyEvent;if(isCmd(event)&&isKey(KEYS_PASTE,event)){editorActions.trigger('paste');return true;}});// zoom in one step
7331
+ addListener('paste',function(context){var event=context.keyEvent;if(isPaste(event)){editorActions.trigger('paste');return true;}});// zoom in one step
7092
7332
  // CTRL/CMD + +
7093
7333
  addListener('stepZoom',function(context){var event=context.keyEvent;// quirk: it has to be triggered by `=` as well to work on international keyboard layout
7094
7334
  // cf: https://github.com/bpmn-io/bpmn-js/issues/1362#issuecomment-722989754
@@ -7158,7 +7398,7 @@
7158
7398
  *
7159
7399
  * @example
7160
7400
  *
7161
- * import inherits from 'inherits';
7401
+ * import inherits from 'inherits-browser';
7162
7402
  *
7163
7403
  * import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
7164
7404
  *
@@ -7182,7 +7422,7 @@
7182
7422
  * @param {boolean} unwrap if true, unwrap the event and pass (context, command, event) to the
7183
7423
  * listener instead
7184
7424
  * @param {Object} [that] Pass context (`this`) to the handler function
7185
- */CommandInterceptor.prototype.on=function(events,hook,priority,handlerFn,unwrap,that){if(isFunction(hook)||isNumber(hook)){that=unwrap;unwrap=handlerFn;handlerFn=priority;priority=hook;hook=null;}if(isFunction(priority)){that=unwrap;unwrap=handlerFn;handlerFn=priority;priority=DEFAULT_PRIORITY;}if(isObject(unwrap)){that=unwrap;unwrap=false;}if(!isFunction(handlerFn)){throw new Error('handlerFn must be a function');}if(!isArray$1(events)){events=[events];}var eventBus=this._eventBus;forEach(events,function(event){// concat commandStack(.event)?(.hook)?
7425
+ */CommandInterceptor.prototype.on=function(events,hook,priority,handlerFn,unwrap,that){if(isFunction(hook)||isNumber(hook)){that=unwrap;unwrap=handlerFn;handlerFn=priority;priority=hook;hook=null;}if(isFunction(priority)){that=unwrap;unwrap=handlerFn;handlerFn=priority;priority=DEFAULT_PRIORITY;}if(isObject(unwrap)){that=unwrap;unwrap=false;}if(!isFunction(handlerFn)){throw new Error('handlerFn must be a function');}if(!isArray(events)){events=[events];}var eventBus=this._eventBus;forEach(events,function(event){// concat commandStack(.event)?(.hook)?
7186
7426
  var fullEvent=['commandStack',event,hook].filter(function(e){return e;}).join('.');eventBus.on(fullEvent,priority,unwrap?unwrapEvent(handlerFn,that):handlerFn,that);});};var hooks=['canExecute','preExecute','preExecuted','execute','executed','postExecute','postExecuted','revert','reverted'];/*
7187
7427
  * Install hook shortcuts
7188
7428
  *
@@ -7302,7 +7542,7 @@
7302
7542
  *
7303
7543
  * @param {string} command the command to execute
7304
7544
  * @param {Object} context the environment to execute the command in
7305
- */CommandStack.prototype.execute=function(command,context){if(!command){throw new Error('command required');}this._currentExecution.trigger='execute';var action={command:command,context:context};this._pushAction(action);this._internalExecute(action);this._popAction(action);};/**
7545
+ */CommandStack.prototype.execute=function(command,context){if(!command){throw new Error('command required');}this._currentExecution.trigger='execute';const action={command:command,context:context};this._pushAction(action);this._internalExecute(action);this._popAction(action);};/**
7306
7546
  * Ask whether a given command can be executed.
7307
7547
  *
7308
7548
  * Implementors may hook into the mechanism on two ways:
@@ -7321,15 +7561,15 @@
7321
7561
  * @param {Object} context the environment to execute the command in
7322
7562
  *
7323
7563
  * @return {boolean} true if the command can be executed
7324
- */CommandStack.prototype.canExecute=function(command,context){var action={command:command,context:context};var handler=this._getHandler(command);var result=this._fire(command,'canExecute',action);// handler#canExecute will only be called if no listener
7564
+ */CommandStack.prototype.canExecute=function(command,context){const action={command:command,context:context};const handler=this._getHandler(command);let result=this._fire(command,'canExecute',action);// handler#canExecute will only be called if no listener
7325
7565
  // decided on a result already
7326
7566
  if(result===undefined){if(!handler){return false;}if(handler.canExecute){result=handler.canExecute(context);}}return result;};/**
7327
7567
  * Clear the command stack, erasing all undo / redo history
7328
7568
  */CommandStack.prototype.clear=function(emit){this._stack.length=0;this._stackIdx=-1;if(emit!==false){this._fire('changed',{trigger:'clear'});}};/**
7329
7569
  * Undo last command(s)
7330
- */CommandStack.prototype.undo=function(){var action=this._getUndoAction(),next;if(action){this._currentExecution.trigger='undo';this._pushAction(action);while(action){this._internalUndo(action);next=this._getUndoAction();if(!next||next.id!==action.id){break;}action=next;}this._popAction();}};/**
7570
+ */CommandStack.prototype.undo=function(){let action=this._getUndoAction(),next;if(action){this._currentExecution.trigger='undo';this._pushAction(action);while(action){this._internalUndo(action);next=this._getUndoAction();if(!next||next.id!==action.id){break;}action=next;}this._popAction();}};/**
7331
7571
  * Redo last command(s)
7332
- */CommandStack.prototype.redo=function(){var action=this._getRedoAction(),next;if(action){this._currentExecution.trigger='redo';this._pushAction(action);while(action){this._internalExecute(action,true);next=this._getRedoAction();if(!next||next.id!==action.id){break;}action=next;}this._popAction();}};/**
7572
+ */CommandStack.prototype.redo=function(){let action=this._getRedoAction(),next;if(action){this._currentExecution.trigger='redo';this._pushAction(action);while(action){this._internalExecute(action,true);next=this._getRedoAction();if(!next||next.id!==action.id){break;}action=next;}this._popAction();}};/**
7333
7573
  * Register a handler instance with the command stack
7334
7574
  *
7335
7575
  * @param {string} command
@@ -7340,13 +7580,13 @@
7340
7580
  *
7341
7581
  * @param {string} command
7342
7582
  * @param {Function} a constructor for a {@link CommandHandler}
7343
- */CommandStack.prototype.registerHandler=function(command,handlerCls){if(!command||!handlerCls){throw new Error('command and handlerCls must be defined');}var handler=this._injector.instantiate(handlerCls);this.register(command,handler);};CommandStack.prototype.canUndo=function(){return !!this._getUndoAction();};CommandStack.prototype.canRedo=function(){return !!this._getRedoAction();};// stack access //////////////////////
7583
+ */CommandStack.prototype.registerHandler=function(command,handlerCls){if(!command||!handlerCls){throw new Error('command and handlerCls must be defined');}const handler=this._injector.instantiate(handlerCls);this.register(command,handler);};CommandStack.prototype.canUndo=function(){return !!this._getUndoAction();};CommandStack.prototype.canRedo=function(){return !!this._getRedoAction();};// stack access //////////////////////
7344
7584
  CommandStack.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1];};CommandStack.prototype._getUndoAction=function(){return this._stack[this._stackIdx];};// internal functionality //////////////////////
7345
- CommandStack.prototype._internalUndo=function(action){var self=this;var command=action.command,context=action.context;var handler=this._getHandler(command);// guard against illegal nested command stack invocations
7346
- this._atomicDo(function(){self._fire(command,'revert',action);if(handler.revert){self._markDirty(handler.revert(context));}self._revertedAction(action);self._fire(command,'reverted',action);});};CommandStack.prototype._fire=function(command,qualifier,event){if(arguments.length<3){event=qualifier;qualifier=null;}var names=qualifier?[command+'.'+qualifier,qualifier]:[command],i,name,result;event=this._eventBus.createEvent(event);for(i=0;name=names[i];i++){result=this._eventBus.fire('commandStack.'+name,event);if(event.cancelBubble){break;}}return result;};CommandStack.prototype._createId=function(){return this._uid++;};CommandStack.prototype._atomicDo=function(fn){var execution=this._currentExecution;execution.atomic=true;try{fn();}finally{execution.atomic=false;}};CommandStack.prototype._internalExecute=function(action,redo){var self=this;var command=action.command,context=action.context;var handler=this._getHandler(command);if(!handler){throw new Error('no command handler registered for <'+command+'>');}this._pushAction(action);if(!redo){this._fire(command,'preExecute',action);if(handler.preExecute){handler.preExecute(context);}this._fire(command,'preExecuted',action);}// guard against illegal nested command stack invocations
7347
- this._atomicDo(function(){self._fire(command,'execute',action);if(handler.execute){// actual execute + mark return results as dirty
7348
- self._markDirty(handler.execute(context));}// log to stack
7349
- self._executedAction(action,redo);self._fire(command,'executed',action);});if(!redo){this._fire(command,'postExecute',action);if(handler.postExecute){handler.postExecute(context);}this._fire(command,'postExecuted',action);}this._popAction(action);};CommandStack.prototype._pushAction=function(action){var execution=this._currentExecution,actions=execution.actions;var baseAction=actions[0];if(execution.atomic){throw new Error('illegal invocation in <execute> or <revert> phase (action: '+action.command+')');}if(!action.id){action.id=baseAction&&baseAction.id||this._createId();}actions.push(action);};CommandStack.prototype._popAction=function(){var execution=this._currentExecution,trigger=execution.trigger,actions=execution.actions,dirty=execution.dirty;actions.pop();if(!actions.length){this._eventBus.fire('elements.changed',{elements:uniqueBy('id',dirty.reverse())});dirty.length=0;this._fire('changed',{trigger:trigger});execution.trigger=null;}};CommandStack.prototype._markDirty=function(elements){var execution=this._currentExecution;if(!elements){return;}elements=isArray$1(elements)?elements:[elements];execution.dirty=execution.dirty.concat(elements);};CommandStack.prototype._executedAction=function(action,redo){var stackIdx=++this._stackIdx;if(!redo){this._stack.splice(stackIdx,this._stack.length,action);}};CommandStack.prototype._revertedAction=function(action){this._stackIdx--;};CommandStack.prototype._getHandler=function(command){return this._handlerMap[command];};CommandStack.prototype._setHandler=function(command,handler){if(!command||!handler){throw new Error('command and handler required');}if(this._handlerMap[command]){throw new Error('overriding handler for command <'+command+'>');}this._handlerMap[command]=handler;};var commandModule={commandStack:['type',CommandStack]};var ModelingModule={__depends__:[behaviorModule,commandModule],__init__:['modeling'],modeling:['type',Modeling]};class Selection{constructor(eventBus){this._eventBus=eventBus;this._selection=null;}get(){return this._selection;}set(selection){if(this._selection===selection){return;}this._selection=selection;this._eventBus.fire('selection.changed',{selection:this._selection});}toggle(selection){const newSelection=this._selection===selection?null:selection;this.set(newSelection);}clear(){this.set(null);}isSelected(formField){return this._selection===formField;}}Selection.$inject=['eventBus'];class SelectionBehavior{constructor(eventBus,selection){eventBus.on(['commandStack.formField.add.postExecuted','commandStack.formField.move.postExecuted'],({context})=>{const{formField}=context;selection.set(formField);});eventBus.on('commandStack.formField.remove.postExecuted',({context})=>{const{sourceFormField,sourceIndex}=context;const formField=sourceFormField.components[sourceIndex]||sourceFormField.components[sourceIndex-1];if(formField){selection.set(formField);}else {selection.clear();}});eventBus.on('formField.remove',({formField})=>{if(selection.isSelected(formField)){selection.clear();}});}}SelectionBehavior.$inject=['eventBus','selection'];var SelectionModule={__init__:['selection','selectionBehavior'],selection:['type',Selection],selectionBehavior:['type',SelectionBehavior]};const types$1=[{label:'Text Field',type:'textfield'},{label:'Number',type:'number'},{label:'Checkbox',type:'checkbox'},{label:'Checklist',type:'checklist'},{label:'Taglist',type:'taglist'},{label:'Radio',type:'radio'},{label:'Select',type:'select'},{label:'Text',type:'text'},{label:'Button',type:'button'}];function Palette(props){return e$1("div",{class:"fjs-palette",children:[e$1("div",{class:"fjs-palette-header",title:"Form elements library",children:[e$1("span",{class:"fjs-hide-compact",children:"FORM ELEMENTS "}),"LIBRARY"]}),e$1("div",{class:"fjs-palette-fields fjs-drag-container fjs-no-drop",children:types$1.map(({label,type})=>{const Icon=iconsByType[type];return e$1("div",{class:"fjs-palette-field fjs-drag-copy fjs-no-drop","data-field-type":type,title:`Create a ${label} element`,children:[Icon?e$1(Icon,{class:"fjs-palette-field-icon",width:"36",height:"36",viewBox:"0 0 54 54"}):null,e$1("span",{class:"fjs-palette-field-text",children:label})]});})})]});}class PaletteRenderer{constructor(paletteConfig,eventBus){const{parent}=paletteConfig||{};this._eventBus=eventBus;this._container=domify('<div class="fjs-palette-container"></div>');if(parent){this.attachTo(parent);}this._eventBus.once('formEditor.rendered',500,()=>{this._render();});}/**
7585
+ CommandStack.prototype._internalUndo=function(action){const command=action.command,context=action.context;const handler=this._getHandler(command);// guard against illegal nested command stack invocations
7586
+ this._atomicDo(()=>{this._fire(command,'revert',action);if(handler.revert){this._markDirty(handler.revert(context));}this._revertedAction(action);this._fire(command,'reverted',action);});};CommandStack.prototype._fire=function(command,qualifier,event){if(arguments.length<3){event=qualifier;qualifier=null;}const names=qualifier?[command+'.'+qualifier,qualifier]:[command];let result;event=this._eventBus.createEvent(event);for(const name of names){result=this._eventBus.fire('commandStack.'+name,event);if(event.cancelBubble){break;}}return result;};CommandStack.prototype._createId=function(){return this._uid++;};CommandStack.prototype._atomicDo=function(fn){const execution=this._currentExecution;execution.atomic=true;try{fn();}finally{execution.atomic=false;}};CommandStack.prototype._internalExecute=function(action,redo){const command=action.command,context=action.context;const handler=this._getHandler(command);if(!handler){throw new Error('no command handler registered for <'+command+'>');}this._pushAction(action);if(!redo){this._fire(command,'preExecute',action);if(handler.preExecute){handler.preExecute(context);}this._fire(command,'preExecuted',action);}// guard against illegal nested command stack invocations
7587
+ this._atomicDo(()=>{this._fire(command,'execute',action);if(handler.execute){// actual execute + mark return results as dirty
7588
+ this._markDirty(handler.execute(context));}// log to stack
7589
+ this._executedAction(action,redo);this._fire(command,'executed',action);});if(!redo){this._fire(command,'postExecute',action);if(handler.postExecute){handler.postExecute(context);}this._fire(command,'postExecuted',action);}this._popAction(action);};CommandStack.prototype._pushAction=function(action){const execution=this._currentExecution,actions=execution.actions;const baseAction=actions[0];if(execution.atomic){throw new Error('illegal invocation in <execute> or <revert> phase (action: '+action.command+')');}if(!action.id){action.id=baseAction&&baseAction.id||this._createId();}actions.push(action);};CommandStack.prototype._popAction=function(){const execution=this._currentExecution,trigger=execution.trigger,actions=execution.actions,dirty=execution.dirty;actions.pop();if(!actions.length){this._eventBus.fire('elements.changed',{elements:uniqueBy('id',dirty.reverse())});dirty.length=0;this._fire('changed',{trigger:trigger});execution.trigger=null;}};CommandStack.prototype._markDirty=function(elements){const execution=this._currentExecution;if(!elements){return;}elements=isArray(elements)?elements:[elements];execution.dirty=execution.dirty.concat(elements);};CommandStack.prototype._executedAction=function(action,redo){const stackIdx=++this._stackIdx;if(!redo){this._stack.splice(stackIdx,this._stack.length,action);}};CommandStack.prototype._revertedAction=function(action){this._stackIdx--;};CommandStack.prototype._getHandler=function(command){return this._handlerMap[command];};CommandStack.prototype._setHandler=function(command,handler){if(!command||!handler){throw new Error('command and handler required');}if(this._handlerMap[command]){throw new Error('overriding handler for command <'+command+'>');}this._handlerMap[command]=handler;};var commandModule={commandStack:['type',CommandStack]};var ModelingModule={__depends__:[behaviorModule,commandModule],__init__:['modeling'],modeling:['type',Modeling]};class Selection{constructor(eventBus){this._eventBus=eventBus;this._selection=null;}get(){return this._selection;}set(selection){if(this._selection===selection){return;}this._selection=selection;this._eventBus.fire('selection.changed',{selection:this._selection});}toggle(selection){const newSelection=this._selection===selection?null:selection;this.set(newSelection);}clear(){this.set(null);}isSelected(formField){return this._selection===formField;}}Selection.$inject=['eventBus'];class SelectionBehavior{constructor(eventBus,selection){eventBus.on(['commandStack.formField.add.postExecuted','commandStack.formField.move.postExecuted'],({context})=>{const{formField}=context;selection.set(formField);});eventBus.on('commandStack.formField.remove.postExecuted',({context})=>{const{sourceFormField,sourceIndex}=context;const formField=sourceFormField.components[sourceIndex]||sourceFormField.components[sourceIndex-1];if(formField){selection.set(formField);}else {selection.clear();}});eventBus.on('formField.remove',({formField})=>{if(selection.isSelected(formField)){selection.clear();}});}}SelectionBehavior.$inject=['eventBus','selection'];var SelectionModule={__init__:['selection','selectionBehavior'],selection:['type',Selection],selectionBehavior:['type',SelectionBehavior]};const types$1=[{label:'Text Field',type:'textfield'},{label:'Number',type:'number'},{label:'Checkbox',type:'checkbox'},{label:'Checklist',type:'checklist'},{label:'Taglist',type:'taglist'},{label:'Radio',type:'radio'},{label:'Select',type:'select'},{label:'Text',type:'text'},{label:'Button',type:'button'}];function Palette(props){return e$1("div",{class:"fjs-palette",children:[e$1("div",{class:"fjs-palette-header",title:"Form elements library",children:[e$1("span",{class:"fjs-hide-compact",children:"FORM ELEMENTS "}),"LIBRARY"]}),e$1("div",{class:"fjs-palette-fields fjs-drag-container fjs-no-drop",children:types$1.map(({label,type})=>{const Icon=iconsByType[type];return e$1("div",{class:"fjs-palette-field fjs-drag-copy fjs-no-drop","data-field-type":type,title:`Create a ${label} element`,children:[Icon?e$1(Icon,{class:"fjs-palette-field-icon",width:"36",height:"36",viewBox:"0 0 54 54"}):null,e$1("span",{class:"fjs-palette-field-text",children:label})]});})})]});}class PaletteRenderer{constructor(paletteConfig,eventBus){const{parent}=paletteConfig||{};this._eventBus=eventBus;this._container=domify$1('<div class="fjs-palette-container"></div>');if(parent){this.attachTo(parent);}this._eventBus.once('formEditor.rendered',500,()=>{this._render();});}/**
7350
7590
  * Attach the palette to a parent node.
7351
7591
  *
7352
7592
  * @param {HTMLElement} container
@@ -7521,7 +7761,7 @@
7521
7761
  const[layout,setLayout]=l$1(createLayout(layoutConfig));y(()=>{if(typeof layoutChanged==='function'){layoutChanged(layout);}},[layout,layoutChanged]);const getLayoutForKey=(key,defaultValue)=>{return get(layout,key,defaultValue);};const setLayoutForKey=(key,config)=>{const newLayout=assign({},layout);set(newLayout,key,config);setLayout(newLayout);};const layoutContext={layout,setLayout,getLayoutForKey,setLayoutForKey};// set-up description context
7522
7762
  const description=createDescriptionContext(descriptionConfig);if(typeof descriptionLoaded==='function'){descriptionLoaded(description);}const getDescriptionForId=(id,element)=>{return description[id]&&description[id](element);};const descriptionContext={description,getDescriptionForId};const[errors,setErrors]=l$1({});const onSetErrors=({errors})=>setErrors(errors);useEvent('propertiesPanel.setErrors',onSetErrors,eventBus);const errorsContext={errors};const eventContext={eventBus};const propertiesPanelContext={element};// empty state
7523
7763
  if(placeholderProvider&&!element){return e$1(Placeholder,{...placeholderProvider.getEmpty()});}// multiple state
7524
- if(placeholderProvider&&isArray$1(element)){return e$1(Placeholder,{...placeholderProvider.getMultiple()});}return e$1(LayoutContext.Provider,{value:propertiesPanelContext,children:e$1(ErrorsContext.Provider,{value:errorsContext,children:e$1(DescriptionContext.Provider,{value:descriptionContext,children:e$1(LayoutContext.Provider,{value:layoutContext,children:e$1(EventContext.Provider,{value:eventContext,children:e$1("div",{class:classNames('bio-properties-panel',layout.open?'open':''),children:[e$1(Header,{element:element,headerProvider:headerProvider}),e$1("div",{class:"bio-properties-panel-scroll-container",children:groups.map(group=>{const{component:Component=Group,id}=group;return v$1(Component,{...group,key:id,element:element});})})]})})})})})});}// helpers //////////////////
7764
+ if(placeholderProvider&&isArray(element)){return e$1(Placeholder,{...placeholderProvider.getMultiple()});}return e$1(LayoutContext.Provider,{value:propertiesPanelContext,children:e$1(ErrorsContext.Provider,{value:errorsContext,children:e$1(DescriptionContext.Provider,{value:descriptionContext,children:e$1(LayoutContext.Provider,{value:layoutContext,children:e$1(EventContext.Provider,{value:eventContext,children:e$1("div",{class:classNames('bio-properties-panel',layout.open?'open':''),children:[e$1(Header,{element:element,headerProvider:headerProvider}),e$1("div",{class:"bio-properties-panel-scroll-container",children:groups.map(group=>{const{component:Component=Group,id}=group;return v$1(Component,{...group,key:id,element:element});})})]})})})})})});}// helpers //////////////////
7525
7765
  function createLayout(overrides){return {...DEFAULT_LAYOUT,...overrides};}function createDescriptionContext(overrides){return {...DEFAULT_DESCRIPTION,...overrides};}function CollapsibleEntry(props){const{element,entries=[],id,label,open:shouldOpen,remove}=props;const[open,setOpen]=l$1(shouldOpen);const toggleOpen=()=>setOpen(!open);const{onShow}=F$1(LayoutContext);const propertiesPanelContext={...F$1(LayoutContext),onShow:A$1(()=>{setOpen(true);if(isFunction(onShow)){onShow();}},[onShow,setOpen])};// todo(pinussilvestrus): translate once we have a translate mechanism for the core
7526
7766
  const placeholderLabel='<empty>';return e$1("div",{"data-entry-id":id,class:classNames('bio-properties-panel-collapsible-entry',open?'open':''),children:[e$1("div",{class:"bio-properties-panel-collapsible-entry-header",onClick:toggleOpen,children:[e$1("div",{title:label||placeholderLabel,class:classNames('bio-properties-panel-collapsible-entry-header-title',!label&&'empty'),children:label||placeholderLabel}),e$1("button",{title:"Toggle list item",class:"bio-properties-panel-arrow bio-properties-panel-collapsible-entry-arrow",children:e$1(ArrowIcon,{class:open?'bio-properties-panel-arrow-down':'bio-properties-panel-arrow-right'})}),remove?e$1("button",{title:"Delete item",class:"bio-properties-panel-remove-entry",onClick:remove,children:e$1(DeleteIcon,{})}):null]}),e$1("div",{class:classNames('bio-properties-panel-collapsible-entry-entries',open?'open':''),children:e$1(LayoutContext.Provider,{value:propertiesPanelContext,children:entries.map(entry=>{const{component:Component,id}=entry;return v$1(Component,{...entry,element:element,key:id});})})})]});}function ListItem(props){const{autoFocusEntry,autoOpen}=props;// focus specified entry on auto open
7527
7767
  y(()=>{if(autoOpen&&autoFocusEntry){const entry=query(`[data-entry-id="${autoFocusEntry}"]`);const focusableInput=query('.bio-properties-panel-input',entry);if(focusableInput){if(isFunction(focusableInput.select)){focusableInput.select();}else if(isFunction(focusableInput.focus)){focusableInput.focus();}}}},[autoOpen,autoFocusEntry]);return e$1("div",{class:"bio-properties-panel-list-item",children:e$1(CollapsibleEntry,{...props,open:autoOpen})});}const noop$2=()=>{};/**
@@ -11250,7 +11490,8 @@ meta: meta$1,/// [Metadata](#highlight.tags.meta) that applies to the entire
11250
11490
  * @returns {Object}
11251
11491
  */function updateKey(properties,oldKey,newKey){return Object.entries(properties).reduce((newProperties,entry)=>{const[key,value]=entry;return {...newProperties,[key===oldKey?newKey:key]:value};},{});}const VALUES_SOURCES={STATIC:'static',INPUT:'input'};const VALUES_SOURCE_DEFAULT=VALUES_SOURCES.STATIC;const VALUES_SOURCES_LABELS={[VALUES_SOURCES.STATIC]:'Static',[VALUES_SOURCES.INPUT]:'Input data'};const VALUES_SOURCES_PATHS={[VALUES_SOURCES.STATIC]:['values'],[VALUES_SOURCES.INPUT]:['valuesKey']};const VALUES_SOURCES_DEFAULTS={[VALUES_SOURCES.STATIC]:[],[VALUES_SOURCES.INPUT]:''};// helpers ///////////////////
11252
11492
  function getValuesSource(field){for(const source of Object.values(VALUES_SOURCES)){if(get(field,VALUES_SOURCES_PATHS[source])!==undefined){return source;}}return VALUES_SOURCE_DEFAULT;}function ValuesSourceSelectEntry(props){const{editField,field,id}=props;return [{id:id+'-select',component:ValuesSourceSelect,isEdited:isEdited$4,editField,field}];}function ValuesSourceSelect(props){const{editField,field,id}=props;const getValue=getValuesSource;const setValue=value=>{let newField=field;const newProperties={};Object.values(VALUES_SOURCES).forEach(source=>{// Clear all values source definitions and default the newly selected one
11253
- const newValue=value===source?VALUES_SOURCES_DEFAULTS[source]:undefined;newProperties[VALUES_SOURCES_PATHS[source]]=newValue;});newField=editField(field,newProperties);return newField;};const getValuesSourceOptions=()=>{return Object.values(VALUES_SOURCES).map(valueSource=>({label:VALUES_SOURCES_LABELS[valueSource],value:valueSource}));};return SelectEntry({label:'Type',element:field,getOptions:getValuesSourceOptions,getValue,id,setValue});}function InputKeyValuesSourceEntry(props){const{editField,field,id}=props;return [{id:id+'-key',component:InputValuesKey,label:'Input values key',description:'Define which input property to populate the values from',isEdited:isEdited$1,editField,field}];}function InputValuesKey(props){const{editField,field,id,label,description}=props;const debounce=useService('debounce');const path=VALUES_SOURCES_PATHS[VALUES_SOURCES.INPUT];const getValue=()=>get(field,path,'');const setValue=value=>editField(field,path,value||'');return TextfieldEntry({debounce,description,element:field,getValue,id,label,setValue});}function StaticValuesSourceEntry(props){const{editField,field,id:idPrefix}=props;const{values}=field;const addEntry=e=>{e.stopPropagation();const index=values.length+1;const entry={label:`Value ${index}`,value:`value${index}`};editField(field,VALUES_SOURCES_PATHS[VALUES_SOURCES.STATIC],arrayAdd(values,values.length,entry));};const removeEntry=entry=>{editField(field,VALUES_SOURCES_PATHS[VALUES_SOURCES.STATIC],without(values,entry));};const validateFactory=key=>{return value=>{if(value===key){return;}if(isUndefined(value)||!value.length){return 'Must not be empty.';}const isValueAssigned=values.find(entry=>entry.value===value);if(isValueAssigned){return 'Must be unique.';}};};const items=values.map((entry,index)=>{const id=idPrefix+'-'+index;return {id,label:entry.label,entries:ValueEntry({editField,field,idPrefix:id,index,validateFactory}),autoFocusEntry:id+'-label',remove:()=>removeEntry(entry)};});return {items,add:addEntry};}function GeneralGroup(field,editField){const entries=[...IdEntry({field,editField}),...LabelEntry({field,editField}),...DescriptionEntry({field,editField}),...KeyEntry({field,editField}),...DefaultOptionEntry({field,editField}),...ActionEntry({field,editField}),...ColumnsEntry({field,editField}),...TextEntry({field,editField}),...DisabledEntry({field,editField})];return {id:'general',label:'General',entries};}function ValidationGroup(field,editField){const{type}=field;if(!(INPUTS.includes(type)&&type!=='checkbox'&&type!=='checklist'&&type!=='taglist')){return null;}const onChange=key=>{return value=>{const validate=get(field,['validate'],{});editField(field,['validate'],set(validate,[key],value));};};const getValue=key=>{return ()=>{return get(field,['validate',key]);};};let entries=[{id:'required',component:Required,getValue,field,isEdited:isEdited$7,onChange}];if(type==='textfield'){entries.push({id:'minLength',component:MinLength,getValue,field,isEdited:isEdited$5,onChange},{id:'maxLength',component:MaxLength,getValue,field,isEdited:isEdited$5,onChange},{id:'pattern',component:Pattern,getValue,field,isEdited:isEdited$1,onChange});}if(type==='number'){entries.push({id:'min',component:Min,getValue,field,isEdited:isEdited$5,onChange},{id:'max',component:Max,getValue,field,isEdited:isEdited$5,onChange});}return {id:'validation',label:'Validation',entries};}function Required(props){const{field,getValue,id,onChange}=props;return CheckboxEntry({element:field,getValue:getValue('required'),id,label:'Required',setValue:onChange('required')});}function MinLength(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('minLength'),id,label:'Minimum length',min:0,setValue:onChange('minLength')});}function MaxLength(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('maxLength'),id,label:'Maximum length',min:0,setValue:onChange('maxLength')});}function Pattern(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return TextfieldEntry({debounce,element:field,getValue:getValue('pattern'),id,label:'Regular expression pattern',setValue:onChange('pattern')});}function Min(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('min'),id,label:'Minimum',min:0,setValue:onChange('min')});}function Max(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('max'),id,label:'Maximum',min:0,setValue:onChange('max')});}function ValuesGroups(field,editField){const{type,id:fieldId}=field;if(!VALUES_INPUTS.includes(type)){return [];}const context={editField,field};const valuesSourceId=`${fieldId}-valuesSource`;/**
11493
+ const newValue=value===source?VALUES_SOURCES_DEFAULTS[source]:undefined;newProperties[VALUES_SOURCES_PATHS[source]]=newValue;});newField=editField(field,newProperties);return newField;};const getValuesSourceOptions=()=>{return Object.values(VALUES_SOURCES).map(valueSource=>({label:VALUES_SOURCES_LABELS[valueSource],value:valueSource}));};return SelectEntry({label:'Type',element:field,getOptions:getValuesSourceOptions,getValue,id,setValue});}function InputKeyValuesSourceEntry(props){const{editField,field,id}=props;return [{id:id+'-key',component:InputValuesKey,label:'Input values key',description:'Define which input property to populate the values from',isEdited:isEdited$1,editField,field}];}function InputValuesKey(props){const{editField,field,id,label,description}=props;const debounce=useService('debounce');const path=VALUES_SOURCES_PATHS[VALUES_SOURCES.INPUT];const getValue=()=>get(field,path,'');const setValue=value=>editField(field,path,value||'');return TextfieldEntry({debounce,description,element:field,getValue,id,label,setValue});}function StaticValuesSourceEntry(props){const{editField,field,id:idPrefix}=props;const{values}=field;const addEntry=e=>{e.stopPropagation();const index=values.length+1;const entry=getIndexedEntry(index);editField(field,VALUES_SOURCES_PATHS[VALUES_SOURCES.STATIC],arrayAdd(values,values.length,entry));};const removeEntry=entry=>{editField(field,VALUES_SOURCES_PATHS[VALUES_SOURCES.STATIC],without(values,entry));};const validateFactory=key=>{return value=>{if(value===key){return;}if(isUndefined(value)||!value.length){return 'Must not be empty.';}const isValueAssigned=values.find(entry=>entry.value===value);if(isValueAssigned){return 'Must be unique.';}};};const items=values.map((entry,index)=>{const id=idPrefix+'-'+index;return {id,label:entry.label,entries:ValueEntry({editField,field,idPrefix:id,index,validateFactory}),autoFocusEntry:id+'-label',remove:()=>removeEntry(entry)};});return {items,add:addEntry,shouldSort:false};}// helper
11494
+ function getIndexedEntry(index){const entry={label:'Value',value:'value'};if(index>1){entry.label+=` ${index}`;entry.value+=`${index}`;}return entry;}function GeneralGroup(field,editField){const entries=[...IdEntry({field,editField}),...LabelEntry({field,editField}),...DescriptionEntry({field,editField}),...KeyEntry({field,editField}),...DefaultOptionEntry({field,editField}),...ActionEntry({field,editField}),...ColumnsEntry({field,editField}),...TextEntry({field,editField}),...DisabledEntry({field,editField})];return {id:'general',label:'General',entries};}function ValidationGroup(field,editField){const{type}=field;if(!(INPUTS.includes(type)&&type!=='checkbox'&&type!=='checklist'&&type!=='taglist')){return null;}const onChange=key=>{return value=>{const validate=get(field,['validate'],{});editField(field,['validate'],set(validate,[key],value));};};const getValue=key=>{return ()=>{return get(field,['validate',key]);};};let entries=[{id:'required',component:Required,getValue,field,isEdited:isEdited$7,onChange}];if(type==='textfield'){entries.push({id:'minLength',component:MinLength,getValue,field,isEdited:isEdited$5,onChange},{id:'maxLength',component:MaxLength,getValue,field,isEdited:isEdited$5,onChange},{id:'pattern',component:Pattern,getValue,field,isEdited:isEdited$1,onChange});}if(type==='number'){entries.push({id:'min',component:Min,getValue,field,isEdited:isEdited$5,onChange},{id:'max',component:Max,getValue,field,isEdited:isEdited$5,onChange});}return {id:'validation',label:'Validation',entries};}function Required(props){const{field,getValue,id,onChange}=props;return CheckboxEntry({element:field,getValue:getValue('required'),id,label:'Required',setValue:onChange('required')});}function MinLength(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('minLength'),id,label:'Minimum length',min:0,setValue:onChange('minLength')});}function MaxLength(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('maxLength'),id,label:'Maximum length',min:0,setValue:onChange('maxLength')});}function Pattern(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return TextfieldEntry({debounce,element:field,getValue:getValue('pattern'),id,label:'Regular expression pattern',setValue:onChange('pattern')});}function Min(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('min'),id,label:'Minimum',min:0,setValue:onChange('min')});}function Max(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('max'),id,label:'Maximum',min:0,setValue:onChange('max')});}function ValuesGroups(field,editField){const{type,id:fieldId}=field;if(!VALUES_INPUTS.includes(type)){return [];}const context={editField,field};const valuesSourceId=`${fieldId}-valuesSource`;/**
11254
11495
  * @type {Array<Group|ListGroup>}
11255
11496
  */const groups=[{id:valuesSourceId,label:'Options source',component:Group,entries:ValuesSourceSelectEntry({...context,id:valuesSourceId})}];const valuesSource=getValuesSource(field);if(valuesSource===VALUES_SOURCES.INPUT){const dynamicValuesId=`${fieldId}-dynamicValues`;groups.push({id:dynamicValuesId,label:'Dynamic options',component:Group,entries:InputKeyValuesSourceEntry({...context,id:dynamicValuesId})});}else if(valuesSource===VALUES_SOURCES.STATIC){const staticValuesId=`${fieldId}-staticValues`;groups.push({id:staticValuesId,label:'Static options',component:ListGroup,...StaticValuesSourceEntry({...context,id:staticValuesId})});}return groups;}function CustomValuesGroup(field,editField){const{properties={},type}=field;if(type==='default'){return null;}const addEntry=event=>{event.stopPropagation();const index=Object.keys(properties).length+1;const key=`key${index}`,value='value';editField(field,['properties'],{...properties,[key]:value});};const validateFactory=key=>{return value=>{if(value===key){return;}if(isUndefined(value)||!value.length){return 'Must not be empty.';}if(has(properties,value)){return 'Must be unique.';}};};const items=Object.keys(properties).map((key,index)=>{const removeEntry=event=>{event.stopPropagation();return editField(field,['properties'],removeKey(properties,key));};const id=`${field.id}-property-${index}`;return {autoFocusEntry:id+'-key',entries:CustomValueEntry({editField,field,idPrefix:id,index,validateFactory}),id,label:key||'',remove:removeEntry};});return {add:addEntry,component:ListGroup,id:'custom-values',items,label:'Custom properties',shouldSort:false};}// helpers //////////
11256
11497
  /**
@@ -11265,7 +11506,7 @@ meta: meta$1,/// [Metadata](#highlight.tags.meta) that applies to the entire
11265
11506
  eventBus.fire('propertiesPanel.updated',{formField:field});};h(()=>{function onSelectionChange(event){_update(event.selection||schema);}eventBus.on('selection.changed',onSelectionChange);return ()=>{eventBus.off('selection.changed',onSelectionChange);};},[]);h(()=>{const onFieldChanged=()=>{/**
11266
11507
  * TODO(pinussilvestrus): update with actual updated element,
11267
11508
  * once we have a proper updater/change support
11268
- */_update(selection.get()||schema);};eventBus.on('changed',onFieldChanged);return ()=>{eventBus.off('changed',onFieldChanged);};},[]);const selectedFormField=state.selectedFormField;const propertiesPanelContext={getService(type,strict=true){return injector.get(type,strict);}};const onFocus=()=>eventBus.fire('propertiesPanel.focusin');const onBlur=()=>eventBus.fire('propertiesPanel.focusout');const editField=A$1((formField,key,value)=>modeling.editFormField(formField,key,value),[modeling]);return e$1("div",{class:"fjs-properties-panel","data-field":selectedFormField&&selectedFormField.id,onFocusCapture:onFocus,onBlurCapture:onBlur,children:e$1(PropertiesPanelContext.Provider,{value:propertiesPanelContext,children:e$1(PropertiesPanel,{element:selectedFormField,eventBus:eventBus,groups:getGroups(selectedFormField,editField),headerProvider:PropertiesPanelHeaderProvider,placeholderProvider:PropertiesPanelPlaceholderProvider})})});}class PropertiesPanelRenderer{constructor(propertiesPanelConfig,injector,eventBus){const{parent}=propertiesPanelConfig||{};this._eventBus=eventBus;this._injector=injector;this._container=domify('<div class="fjs-properties-container" input-handle-modified-keys="y,z"></div>');if(parent){this.attachTo(parent);}this._eventBus.once('formEditor.rendered',500,()=>{this._render();});}/**
11509
+ */_update(selection.get()||schema);};eventBus.on('changed',onFieldChanged);return ()=>{eventBus.off('changed',onFieldChanged);};},[]);const selectedFormField=state.selectedFormField;const propertiesPanelContext={getService(type,strict=true){return injector.get(type,strict);}};const onFocus=()=>eventBus.fire('propertiesPanel.focusin');const onBlur=()=>eventBus.fire('propertiesPanel.focusout');const editField=A$1((formField,key,value)=>modeling.editFormField(formField,key,value),[modeling]);return e$1("div",{class:"fjs-properties-panel","data-field":selectedFormField&&selectedFormField.id,onFocusCapture:onFocus,onBlurCapture:onBlur,children:e$1(PropertiesPanelContext.Provider,{value:propertiesPanelContext,children:e$1(PropertiesPanel,{element:selectedFormField,eventBus:eventBus,groups:getGroups(selectedFormField,editField),headerProvider:PropertiesPanelHeaderProvider,placeholderProvider:PropertiesPanelPlaceholderProvider})})});}class PropertiesPanelRenderer{constructor(propertiesPanelConfig,injector,eventBus){const{parent}=propertiesPanelConfig||{};this._eventBus=eventBus;this._injector=injector;this._container=domify$1('<div class="fjs-properties-container" input-handle-modified-keys="y,z"></div>');if(parent){this.attachTo(parent);}this._eventBus.once('formEditor.rendered',500,()=>{this._render();});}/**
11269
11510
  * Attach the properties panel to a parent node.
11270
11511
  *
11271
11512
  * @param {HTMLElement} container