camunda-bpmn-js 0.13.0-alpha.3 → 0.13.0-alpha.6

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.
@@ -6,6 +6,21 @@
6
6
 
7
7
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
8
 
9
+ function getAugmentedNamespace(n) {
10
+ if (n.__esModule) return n;
11
+ var a = Object.defineProperty({}, '__esModule', {value: true});
12
+ Object.keys(n).forEach(function (k) {
13
+ var d = Object.getOwnPropertyDescriptor(n, k);
14
+ Object.defineProperty(a, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () {
17
+ return n[k];
18
+ }
19
+ });
20
+ });
21
+ return a;
22
+ }
23
+
9
24
  function createCommonjsModule(fn) {
10
25
  var module = { exports: {} };
11
26
  return fn(module, module.exports), module.exports;
@@ -659,6 +674,30 @@
659
674
  callback.cancel = clear;
660
675
  return callback;
661
676
  }
677
+ /**
678
+ * Throttle fn, calling at most once
679
+ * in the given interval.
680
+ *
681
+ * @param {Function} fn
682
+ * @param {Number} interval
683
+ *
684
+ * @return {Function} throttled function
685
+ */
686
+
687
+ function throttle(fn, interval) {
688
+ var throttling = false;
689
+ return function () {
690
+ if (throttling) {
691
+ return;
692
+ }
693
+
694
+ fn.apply(void 0, arguments);
695
+ throttling = true;
696
+ setTimeout(function () {
697
+ throttling = false;
698
+ }, interval);
699
+ };
700
+ }
662
701
  /**
663
702
  * Bind function against target <this>.
664
703
  *
@@ -825,6 +864,94 @@
825
864
  });
826
865
  return result;
827
866
  }
867
+ /**
868
+ * Recursively merge `...sources` into given target.
869
+ *
870
+ * Does support merging objects; does not support merging arrays.
871
+ *
872
+ * @param {Object} target
873
+ * @param {...Object} sources
874
+ *
875
+ * @return {Object} the target
876
+ */
877
+
878
+ function merge(target) {
879
+ for (var _len2 = arguments.length, sources = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
880
+ sources[_key2 - 1] = arguments[_key2];
881
+ }
882
+
883
+ if (!sources.length) {
884
+ return target;
885
+ }
886
+
887
+ forEach(sources, function (source) {
888
+ // skip non-obj sources, i.e. null
889
+ if (!source || !isObject(source)) {
890
+ return;
891
+ }
892
+
893
+ forEach(source, function (sourceVal, key) {
894
+ if (key === '__proto__') {
895
+ return;
896
+ }
897
+
898
+ var targetVal = target[key];
899
+
900
+ if (isObject(sourceVal)) {
901
+ if (!isObject(targetVal)) {
902
+ // override target[key] with object
903
+ targetVal = {};
904
+ }
905
+
906
+ target[key] = merge(targetVal, sourceVal);
907
+ } else {
908
+ target[key] = sourceVal;
909
+ }
910
+ });
911
+ });
912
+ return target;
913
+ }
914
+
915
+ var index_esm = /*#__PURE__*/Object.freeze({
916
+ __proto__: null,
917
+ assign: assign,
918
+ bind: bind,
919
+ debounce: debounce,
920
+ ensureArray: ensureArray,
921
+ every: every,
922
+ filter: filter,
923
+ find: find,
924
+ findIndex: findIndex,
925
+ flatten: flatten,
926
+ forEach: forEach,
927
+ get: get,
928
+ groupBy: groupBy,
929
+ has: has,
930
+ isArray: isArray,
931
+ isDefined: isDefined,
932
+ isFunction: isFunction,
933
+ isNil: isNil,
934
+ isNumber: isNumber,
935
+ isObject: isObject,
936
+ isString: isString,
937
+ isUndefined: isUndefined,
938
+ keys: keys,
939
+ map: map,
940
+ matchPattern: matchPattern,
941
+ merge: merge,
942
+ omit: omit,
943
+ pick: pick,
944
+ reduce: reduce,
945
+ set: set,
946
+ size: size,
947
+ some: some,
948
+ sortBy: sortBy,
949
+ throttle: throttle,
950
+ unionBy: unionBy,
951
+ uniqueBy: uniqueBy,
952
+ values: values,
953
+ without: without
954
+ });
828
955
 
829
956
  /**
830
957
  * Set attribute `name` to `val`, or get attr `name`.
@@ -2444,7 +2571,7 @@
2444
2571
  }
2445
2572
  });
2446
2573
 
2447
- eventBus.on([ 'render.getShapePath', 'render.getConnectionPath'], renderPriority, function(evt, element) {
2574
+ eventBus.on([ 'render.getShapePath', 'render.getConnectionPath' ], renderPriority, function(evt, element) {
2448
2575
  if (self.canRender(element)) {
2449
2576
  if (evt.type === 'render.getShapePath') {
2450
2577
  return self.getShapePath(element);
@@ -2756,7 +2883,7 @@
2756
2883
 
2757
2884
  stopRecursion = !!stopRecursion;
2758
2885
  if (!isArray(elements)) {
2759
- elements = [elements];
2886
+ elements = [ elements ];
2760
2887
  }
2761
2888
 
2762
2889
  var minX,
@@ -2936,11 +3063,11 @@
2936
3063
  height = shape.height;
2937
3064
 
2938
3065
  var shapePath = [
2939
- ['M', x, y],
2940
- ['l', width, 0],
2941
- ['l', 0, height],
2942
- ['l', -width, 0],
2943
- ['z']
3066
+ [ 'M', x, y ],
3067
+ [ 'l', width, 0 ],
3068
+ [ 'l', 0, height ],
3069
+ [ 'l', -width, 0 ],
3070
+ [ 'z' ]
2944
3071
  ];
2945
3072
 
2946
3073
  return componentsToPath(shapePath);
@@ -4666,6 +4793,25 @@
4666
4793
  return layer.group;
4667
4794
  };
4668
4795
 
4796
+ /**
4797
+ * For a given index, return the number of layers that have a higher index and
4798
+ * are visible.
4799
+ *
4800
+ * This is used to determine the node a layer should be inserted at.
4801
+ *
4802
+ * @param {Number} index
4803
+ * @returns {Number}
4804
+ */
4805
+ Canvas.prototype._getChildIndex = function(index) {
4806
+ return reduce(this._layers, function(childIndex, layer) {
4807
+ if (layer.visible && index >= layer.index) {
4808
+ childIndex++;
4809
+ }
4810
+
4811
+ return childIndex;
4812
+ }, 0);
4813
+ };
4814
+
4669
4815
  /**
4670
4816
  * Creates a given layer and returns it.
4671
4817
  *
@@ -4680,19 +4826,80 @@
4680
4826
  index = UTILITY_LAYER_INDEX;
4681
4827
  }
4682
4828
 
4683
- var childIndex = reduce(this._layers, function(childIndex, layer) {
4684
- if (index >= layer.index) {
4685
- childIndex++;
4686
- }
4687
-
4688
- return childIndex;
4689
- }, 0);
4829
+ var childIndex = this._getChildIndex(index);
4690
4830
 
4691
4831
  return {
4692
4832
  group: createGroup(this._viewport, 'layer-' + name, childIndex),
4693
- index: index
4833
+ index: index,
4834
+ visible: true
4694
4835
  };
4836
+ };
4837
+
4838
+
4839
+ /**
4840
+ * Shows a given layer.
4841
+ *
4842
+ * @param {String} layer
4843
+ * @returns {SVGElement}
4844
+ */
4845
+ Canvas.prototype.showLayer = function(name) {
4846
+
4847
+ if (!name) {
4848
+ throw new Error('must specify a name');
4849
+ }
4850
+
4851
+ var layer = this._layers[name];
4852
+
4853
+ if (!layer) {
4854
+ throw new Error('layer <' + name + '> does not exist');
4855
+ }
4856
+
4857
+ var viewport = this._viewport;
4858
+ var group = layer.group;
4859
+ var index = layer.index;
4860
+
4861
+ if (layer.visible) {
4862
+ return group;
4863
+ }
4864
+
4865
+ var childIndex = this._getChildIndex(index);
4866
+
4867
+ viewport.insertBefore(group, viewport.childNodes[childIndex] || null);
4868
+
4869
+ layer.visible = true;
4870
+
4871
+ return group;
4872
+ };
4873
+
4874
+ /**
4875
+ * Hides a given layer.
4876
+ *
4877
+ * @param {String} layer
4878
+ * @returns {SVGElement}
4879
+ */
4880
+ Canvas.prototype.hideLayer = function(name) {
4881
+
4882
+ if (!name) {
4883
+ throw new Error('must specify a name');
4884
+ }
4695
4885
 
4886
+ var layer = this._layers[name];
4887
+
4888
+ if (!layer) {
4889
+ throw new Error('layer <' + name + '> does not exist');
4890
+ }
4891
+
4892
+ var group = layer.group;
4893
+
4894
+ if (!layer.visible) {
4895
+ return group;
4896
+ }
4897
+
4898
+ remove$1(group);
4899
+
4900
+ layer.visible = false;
4901
+
4902
+ return group;
4696
4903
  };
4697
4904
 
4698
4905
 
@@ -4935,7 +5142,7 @@
4935
5142
 
4936
5143
  var layer = this.getLayer(layerName, PLANE_LAYER_INDEX);
4937
5144
 
4938
- attr$1(layer, 'display', 'none');
5145
+ this.hideLayer(layerName);
4939
5146
 
4940
5147
  this._addRoot(rootElement, layer);
4941
5148
 
@@ -5054,17 +5261,13 @@
5054
5261
 
5055
5262
  var currentRoot = this._rootElement;
5056
5263
 
5057
- var currentLayer;
5058
-
5059
5264
  if (currentRoot) {
5060
5265
 
5061
5266
  // un-associate previous root element <svg>
5062
5267
  this._elementRegistry.updateGraphics(currentRoot, null, true);
5063
5268
 
5064
5269
  // hide previous layer
5065
- currentLayer = this._findPlaneForRoot(currentRoot).layer;
5066
-
5067
- attr$1(currentLayer, 'display', 'none');
5270
+ this.hideLayer(currentRoot.layer);
5068
5271
  }
5069
5272
 
5070
5273
  if (rootElement) {
@@ -5077,7 +5280,7 @@
5077
5280
  this._elementRegistry.updateGraphics(rootElement, this._svg, true);
5078
5281
 
5079
5282
  // show root layer
5080
- attr$1(layer, 'display', null);
5283
+ this.showLayer(rootElement.layer);
5081
5284
  }
5082
5285
 
5083
5286
  this._rootElement = rootElement;
@@ -7473,7 +7676,7 @@
7473
7676
  options = options || {};
7474
7677
 
7475
7678
  var configModule = {
7476
- 'config': ['value', options]
7679
+ 'config': [ 'value', options ]
7477
7680
  };
7478
7681
 
7479
7682
  var modules = [ configModule, CoreModule ].concat(options.modules || []);
@@ -21046,7 +21249,7 @@
21046
21249
  };
21047
21250
 
21048
21251
 
21049
- Outline.$inject = ['eventBus', 'styles', 'elementRegistry'];
21252
+ Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
21050
21253
 
21051
21254
  var OutlineModule = {
21052
21255
  __init__: [ 'outline' ],
@@ -22076,7 +22279,7 @@
22076
22279
  ];
22077
22280
 
22078
22281
  var ChangeSupportModule = {
22079
- __init__: [ 'changeSupport'],
22282
+ __init__: [ 'changeSupport' ],
22080
22283
  changeSupport: [ 'type', ChangeSupport ]
22081
22284
  };
22082
22285
 
@@ -22248,7 +22451,7 @@
22248
22451
 
22249
22452
  inherits_browser(RootElementsBehavior, CommandInterceptor);
22250
22453
 
22251
- RootElementsBehavior.$inject = [ 'canvas', 'injector'];
22454
+ RootElementsBehavior.$inject = [ 'canvas', 'injector' ];
22252
22455
 
22253
22456
  var RootElementsModule = {
22254
22457
  __init__: [ 'rootElementsBehavior' ],
@@ -23353,7 +23556,7 @@
23353
23556
  var KEYCODE_Y = 89;
23354
23557
  var KEYCODE_Z = 90;
23355
23558
 
23356
- var KEYS_COPY = ['c', 'C', KEYCODE_C ];
23559
+ var KEYS_COPY = [ 'c', 'C', KEYCODE_C ];
23357
23560
  var KEYS_PASTE = [ 'v', 'V', KEYCODE_V ];
23358
23561
  var KEYS_REDO = [ 'y', 'Y', KEYCODE_Y ];
23359
23562
  var KEYS_UNDO = [ 'z', 'Z', KEYCODE_Z ];
@@ -23509,7 +23712,7 @@
23509
23712
 
23510
23713
  var event = context.keyEvent;
23511
23714
 
23512
- if (isKey(['Backspace', 'Delete', 'Del' ], event)) {
23715
+ if (isKey([ 'Backspace', 'Delete', 'Del' ], event)) {
23513
23716
  editorActions.trigger('removeSelection');
23514
23717
 
23515
23718
  return true;
@@ -29255,11 +29458,11 @@
29255
29458
  y = center.y;
29256
29459
 
29257
29460
  return [
29258
- ['M', x, y],
29259
- ['m', 0, -r],
29260
- ['a', r, r, 0, 1, 1, 0, 2 * r],
29261
- ['a', r, r, 0, 1, 1, 0, -2 * r],
29262
- ['z']
29461
+ [ 'M', x, y ],
29462
+ [ 'm', 0, -r ],
29463
+ [ 'a', r, r, 0, 1, 1, 0, 2 * r ],
29464
+ [ 'a', r, r, 0, 1, 1, 0, -2 * r ],
29465
+ [ 'z' ]
29263
29466
  ];
29264
29467
  }
29265
29468
 
@@ -30835,7 +31038,7 @@
30835
31038
  return parent.children || [];
30836
31039
  }
30837
31040
 
30838
- var abs$2= Math.abs,
31041
+ var abs$2 = Math.abs,
30839
31042
  round$5 = Math.round;
30840
31043
 
30841
31044
  var TOLERANCE = 10;
@@ -40726,7 +40929,8 @@
40726
40929
  'canvas.viewbox.changing',
40727
40930
  'drag.init',
40728
40931
  'element.mousedown',
40729
- 'popupMenu.open'
40932
+ 'popupMenu.open',
40933
+ 'root.set'
40730
40934
  ], function(event) {
40731
40935
 
40732
40936
  if (directEditing.isActive()) {
@@ -48853,7 +49057,7 @@
48853
49057
  }
48854
49058
 
48855
49059
  var LabelSupportModule = {
48856
- __init__: [ 'labelSupport'],
49060
+ __init__: [ 'labelSupport' ],
48857
49061
  labelSupport: [ 'type', LabelSupport ]
48858
49062
  };
48859
49063
 
@@ -49041,7 +49245,7 @@
49041
49245
  saveClear(oldShape.attachers, function(attacher) {
49042
49246
  var allowed = rules.allowed('elements.move', {
49043
49247
  target: newShape,
49044
- shapes: [attacher]
49248
+ shapes: [ attacher ]
49045
49249
  });
49046
49250
 
49047
49251
  if (allowed === 'attach') {
@@ -50175,7 +50379,7 @@
50175
50379
  }
50176
50380
 
50177
50381
  var SpaceToolModule = {
50178
- __init__: ['spaceToolPreview'],
50382
+ __init__: [ 'spaceToolPreview' ],
50179
50383
  __depends__: [
50180
50384
  DraggingModule,
50181
50385
  RulesModule,
@@ -50183,8 +50387,8 @@
50183
50387
  PreviewSupportModule,
50184
50388
  MouseModule
50185
50389
  ],
50186
- spaceTool: ['type', SpaceTool ],
50187
- spaceToolPreview: ['type', SpaceToolPreview ]
50390
+ spaceTool: [ 'type', SpaceTool ],
50391
+ spaceToolPreview: [ 'type', SpaceToolPreview ]
50188
50392
  };
50189
50393
 
50190
50394
  function BpmnFactory(moddle) {
@@ -52304,7 +52508,7 @@
52304
52508
  newParentIndex = context.newParentIndex,
52305
52509
  oldParent = shape.parent;
52306
52510
 
52307
- context.oldBounds = pick(shape, [ 'x', 'y', 'width', 'height']);
52511
+ context.oldBounds = pick(shape, [ 'x', 'y', 'width', 'height' ]);
52308
52512
 
52309
52513
  // save old parent in context
52310
52514
  context.oldParent = oldParent;
@@ -52950,7 +53154,7 @@
52950
53154
  // recursively hide/show children
52951
53155
  var result = setHiddenRecursive(children, shape.collapsed);
52952
53156
 
52953
- return [shape].concat(result);
53157
+ return [ shape ].concat(result);
52954
53158
  };
52955
53159
 
52956
53160
 
@@ -52967,7 +53171,7 @@
52967
53171
  // retoggle state
52968
53172
  shape.collapsed = !shape.collapsed;
52969
53173
 
52970
- return [shape].concat(result);
53174
+ return [ shape ].concat(result);
52971
53175
  };
52972
53176
 
52973
53177
 
@@ -59568,8 +59772,8 @@
59568
59772
  var h = box.height + offset * 2;
59569
59773
 
59570
59774
  var styles = [
59571
- 'width: '+ w +'px',
59572
- 'height: '+ h + 'px'
59775
+ 'width: ' + w + 'px',
59776
+ 'height: ' + h + 'px'
59573
59777
  ].join('; ');
59574
59778
 
59575
59779
  return {
@@ -61331,31 +61535,100 @@
61331
61535
  }());
61332
61536
  });
61333
61537
 
61538
+ function C$1(n,t){for(var e in t)n[e]=t[e];return n}function S$1(n,t){for(var e in n)if("__source"!==e&&!(e in t))return !0;for(var r in t)if("__source"!==r&&n[r]!==t[r])return !0;return !1}function E(n){this.props=n;}function g$2(n,t){function e(n){var e=this.props.ref,r=e==n.ref;return !r&&e&&(e.call?e(null):e.current=null),t?!t(this.props,n)||!r:S$1(this.props,n)}function r(t){return this.shouldComponentUpdate=e,a(n,t)}return r.displayName="Memo("+(n.displayName||n.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(E.prototype=new p).isPureReactComponent=!0,E.prototype.shouldComponentUpdate=function(n,t){return S$1(this.props,n)||S$1(this.state,t)};var w$2=n.__b;n.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),w$2&&w$2(n);};var R="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function x$2(n){function t(t,e){var r=C$1({},t);return delete r.ref,n(r,(e=t.ref||e)&&("object"!=typeof e||"current"in e)?e:null)}return t.$$typeof=R,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(n.displayName||n.name)+")",t}var N$1=function(n,t){return null==n?null:w(w(n).map(t))},k$2={map:N$1,forEach:N$1,count:function(n){return n?w(n).length:0},only:function(n){var t=w(n);if(1!==t.length)throw "Children.only";return t[0]},toArray:w},A$2=n.__e;n.__e=function(n,t,e){if(n.then)for(var r,u=t;u=u.__;)if((r=u.__c)&&r.__c)return null==t.__e&&(t.__e=e.__e,t.__k=e.__k),r.__c(n,t);A$2(n,t,e);};var O$1=n.unmount;function L$1(){this.__u=0,this.t=null,this.__b=null;}function U(n){var t=n.__.__c;return t&&t.__e&&t.__e(n)}function D(n){var t,e,r;function u(u){if(t||(t=n()).then(function(n){e=n.default||n;},function(n){r=n;}),r)throw r;if(!e)throw t;return a(e,u)}return u.displayName="Lazy",u.__f=!0,u}function F$1(){this.u=null,this.o=null;}n.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&!0===n.__h&&(n.type=null),O$1&&O$1(n);},(L$1.prototype=new p).__c=function(n,t){var e=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(e);var u=U(r.__v),o=!1,i=function(){o||(o=!0,e.__R=null,u?u(l):l());};e.__R=i;var l=function(){if(!--r.__u){if(r.state.__e){var n=r.state.__e;r.__v.__k[0]=function n(t,e,r){return t&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(t){return n(t,e,r)}),t.__c&&t.__c.__P===e&&(t.__e&&r.insertBefore(t.__e,t.__d),t.__c.__e=!0,t.__c.__P=r)),t}(n,n.__c.__P,n.__c.__O);}var t;for(r.setState({__e:r.__b=null});t=r.t.pop();)t.forceUpdate();}},f=!0===t.__h;r.__u++||f||r.setState({__e:r.__b=r.__v.__k[0]}),n.then(i,i);},L$1.prototype.componentWillUnmount=function(){this.t=[];},L$1.prototype.render=function(n,t){if(this.__b){if(this.__v.__k){var e=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=function n(t,e,r){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(n){"function"==typeof n.__c&&n.__c();}),t.__c.__H=null),null!=(t=C$1({},t)).__c&&(t.__c.__P===r&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map(function(t){return n(t,e,r)})),t}(this.__b,e,r.__O=r.__P);}this.__b=null;}var u=t.__e&&a(y,null,n.fallback);return u&&(u.__h=null),[a(y,null,t.__e?null:n.children),u]};var M$1=function(n,t,e){if(++e[1]===e[0]&&n.o.delete(t),n.props.revealOrder&&("t"!==n.props.revealOrder[0]||!n.o.size))for(e=n.u;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;n.u=e=e[2];}};function T$2(n){return this.getChildContext=function(){return n.context},n.children}function j$2(n){var t=this,e=n.i;t.componentWillUnmount=function(){N(null,t.l),t.l=null,t.i=null;},t.i&&t.i!==e&&t.componentWillUnmount(),n.__v?(t.l||(t.i=e,t.l={nodeType:1,parentNode:e,childNodes:[],appendChild:function(n){this.childNodes.push(n),t.i.appendChild(n);},insertBefore:function(n,e){this.childNodes.push(n),t.i.appendChild(n);},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),t.i.removeChild(n);}}),N(a(T$2,{context:t.context},n.__v),t.l)):t.l&&t.componentWillUnmount();}function I$1(n,t){return a(j$2,{__v:n,i:t})}(F$1.prototype=new p).__e=function(n){var t=this,e=U(t.__v),r=t.o.get(n);return r[0]++,function(u){var o=function(){t.props.revealOrder?(r.push(u),M$1(t,n,r)):u();};e?e(o):o();}},F$1.prototype.render=function(n){this.u=null,this.o=new Map;var t=w(n.children);n.revealOrder&&"b"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.o.set(t[e],this.u=[1,0,this.u]);return n.children},F$1.prototype.componentDidUpdate=F$1.prototype.componentDidMount=function(){var n=this;this.o.forEach(function(t,e){M$1(n,e,t);});};var W="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,P$1=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,V=function(n){return ("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(n)};function z$1(n,t,e){return null==t.__k&&(t.textContent=""),N(n,t),"function"==typeof e&&e(),n?n.__c:null}function B(n,t,e){return O(n,t),"function"==typeof e&&e(),n?n.__c:null}p.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(p.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(t){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:t});}});});var H$1=n.event;function Z(){}function Y(){return this.cancelBubble}function $$1(){return this.defaultPrevented}n.event=function(n){return H$1&&(n=H$1(n)),n.persist=Z,n.isPropagationStopped=Y,n.isDefaultPrevented=$$1,n.nativeEvent=n};var q$1,G={configurable:!0,get:function(){return this.class}},J=n.vnode;n.vnode=function(n){var t=n.type,e=n.props,r=e;if("string"==typeof t){for(var u in r={},e){var o=e[u];"value"===u&&"defaultValue"in e&&null==o||("defaultValue"===u&&"value"in e&&null==e.value?u="value":"download"===u&&!0===o?o="":/ondoubleclick/i.test(u)?u="ondblclick":/^onchange(textarea|input)/i.test(u+t)&&!V(e.type)?u="oninput":/^on(Ani|Tra|Tou|BeforeInp)/.test(u)?u=u.toLowerCase():P$1.test(u)?u=u.replace(/[A-Z0-9]/,"-$&").toLowerCase():null===o&&(o=void 0),r[u]=o);}"select"==t&&r.multiple&&Array.isArray(r.value)&&(r.value=w(e.children).forEach(function(n){n.props.selected=-1!=r.value.indexOf(n.props.value);})),"select"==t&&null!=r.defaultValue&&(r.value=w(e.children).forEach(function(n){n.props.selected=r.multiple?-1!=r.defaultValue.indexOf(n.props.value):r.defaultValue==n.props.value;})),n.props=r;}t&&e.class!=e.className&&(G.enumerable="className"in e,null!=e.className&&(r.class=e.className),Object.defineProperty(r,"className",G)),n.$$typeof=W,J&&J(n);};var K=n.__r;n.__r=function(n){K&&K(n),q$1=n.__c;};var Q={ReactCurrentDispatcher:{current:{readContext:function(n){return q$1.__n[n.__c].props.value}}}};"object"==typeof performance&&"function"==typeof performance.now?performance.now.bind(performance):function(){return Date.now()};function fn(n){return a.bind(null,n)}function cn(n){return !!n&&n.$$typeof===W}function an(n){return cn(n)?S.apply(null,arguments):n}function sn(n){return !!n.__k&&(N(null,n),!0)}function hn(n){return n&&(n.base||1===n.nodeType&&n)||null}var pn=function(n,t){return n(t)};var React = {useState:l,useReducer:p$1,useEffect:y$1,useLayoutEffect:h$1,useRef:s$1,useImperativeHandle:_$1,useMemo:d$1,useCallback:A$1,useContext:F,useDebugValue:T$1,version:"16.8.0",Children:k$2,render:z$1,hydrate:B,unmountComponentAtNode:sn,createPortal:I$1,createElement:a,createContext:q,createFactory:fn,cloneElement:an,createRef:h,Fragment:y,isValidElement:cn,findDOMNode:hn,Component:p,PureComponent:E,memo:g$2,forwardRef:x$2,unstable_batchedUpdates:pn,StrictMode:y,Suspense:L$1,SuspenseList:F$1,lazy:D,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Q};
61539
+
61334
61540
  function o$2(_,o,e,n$1,t){var f={};for(var l in o)"ref"!=l&&(f[l]=o[l]);var s,u,a={type:_,props:f,key:e,ref:o&&o.ref,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:++n.__v,__source:n$1,__self:t};if("function"==typeof _&&(s=_.defaultProps))for(u in s)void 0===f[u]&&(f[u]=s[u]);return n.vnode&&n.vnode(a),a}
61335
61541
 
61336
- function C$1(n,t){for(var e in t)n[e]=t[e];return n}function S$1(n,t){for(var e in n)if("__source"!==e&&!(e in t))return !0;for(var r in t)if("__source"!==r&&n[r]!==t[r])return !0;return !1}function E(n){this.props=n;}function g$2(n,t){function e(n){var e=this.props.ref,r=e==n.ref;return !r&&e&&(e.call?e(null):e.current=null),t?!t(this.props,n)||!r:S$1(this.props,n)}function r(t){return this.shouldComponentUpdate=e,a(n,t)}return r.displayName="Memo("+(n.displayName||n.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(E.prototype=new p).isPureReactComponent=!0,E.prototype.shouldComponentUpdate=function(n,t){return S$1(this.props,n)||S$1(this.state,t)};var w$2=n.__b;n.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),w$2&&w$2(n);};var R="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function x$2(n){function t(t,e){var r=C$1({},t);return delete r.ref,n(r,(e=t.ref||e)&&("object"!=typeof e||"current"in e)?e:null)}return t.$$typeof=R,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(n.displayName||n.name)+")",t}var N$1=function(n,t){return null==n?null:w(w(n).map(t))},k$2={map:N$1,forEach:N$1,count:function(n){return n?w(n).length:0},only:function(n){var t=w(n);if(1!==t.length)throw "Children.only";return t[0]},toArray:w},A$2=n.__e;n.__e=function(n,t,e){if(n.then)for(var r,u=t;u=u.__;)if((r=u.__c)&&r.__c)return null==t.__e&&(t.__e=e.__e,t.__k=e.__k),r.__c(n,t);A$2(n,t,e);};var O$1=n.unmount;function L$1(){this.__u=0,this.t=null,this.__b=null;}function U(n){var t=n.__.__c;return t&&t.__e&&t.__e(n)}function D(n){var t,e,r;function u(u){if(t||(t=n()).then(function(n){e=n.default||n;},function(n){r=n;}),r)throw r;if(!e)throw t;return a(e,u)}return u.displayName="Lazy",u.__f=!0,u}function F$1(){this.u=null,this.o=null;}n.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&!0===n.__h&&(n.type=null),O$1&&O$1(n);},(L$1.prototype=new p).__c=function(n,t){var e=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(e);var u=U(r.__v),o=!1,i=function(){o||(o=!0,e.__R=null,u?u(l):l());};e.__R=i;var l=function(){if(!--r.__u){if(r.state.__e){var n=r.state.__e;r.__v.__k[0]=function n(t,e,r){return t&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(t){return n(t,e,r)}),t.__c&&t.__c.__P===e&&(t.__e&&r.insertBefore(t.__e,t.__d),t.__c.__e=!0,t.__c.__P=r)),t}(n,n.__c.__P,n.__c.__O);}var t;for(r.setState({__e:r.__b=null});t=r.t.pop();)t.forceUpdate();}},f=!0===t.__h;r.__u++||f||r.setState({__e:r.__b=r.__v.__k[0]}),n.then(i,i);},L$1.prototype.componentWillUnmount=function(){this.t=[];},L$1.prototype.render=function(n,t){if(this.__b){if(this.__v.__k){var e=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=function n(t,e,r){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(n){"function"==typeof n.__c&&n.__c();}),t.__c.__H=null),null!=(t=C$1({},t)).__c&&(t.__c.__P===r&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map(function(t){return n(t,e,r)})),t}(this.__b,e,r.__O=r.__P);}this.__b=null;}var u=t.__e&&a(y,null,n.fallback);return u&&(u.__h=null),[a(y,null,t.__e?null:n.children),u]};var M$1=function(n,t,e){if(++e[1]===e[0]&&n.o.delete(t),n.props.revealOrder&&("t"!==n.props.revealOrder[0]||!n.o.size))for(e=n.u;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;n.u=e=e[2];}};function T$2(n){return this.getChildContext=function(){return n.context},n.children}function j$2(n){var t=this,e=n.i;t.componentWillUnmount=function(){N(null,t.l),t.l=null,t.i=null;},t.i&&t.i!==e&&t.componentWillUnmount(),n.__v?(t.l||(t.i=e,t.l={nodeType:1,parentNode:e,childNodes:[],appendChild:function(n){this.childNodes.push(n),t.i.appendChild(n);},insertBefore:function(n,e){this.childNodes.push(n),t.i.appendChild(n);},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),t.i.removeChild(n);}}),N(a(T$2,{context:t.context},n.__v),t.l)):t.l&&t.componentWillUnmount();}function I$1(n,t){return a(j$2,{__v:n,i:t})}(F$1.prototype=new p).__e=function(n){var t=this,e=U(t.__v),r=t.o.get(n);return r[0]++,function(u){var o=function(){t.props.revealOrder?(r.push(u),M$1(t,n,r)):u();};e?e(o):o();}},F$1.prototype.render=function(n){this.u=null,this.o=new Map;var t=w(n.children);n.revealOrder&&"b"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.o.set(t[e],this.u=[1,0,this.u]);return n.children},F$1.prototype.componentDidUpdate=F$1.prototype.componentDidMount=function(){var n=this;this.o.forEach(function(t,e){M$1(n,e,t);});};var W="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,P$1=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,V=function(n){return ("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(n)};function z$1(n,t,e){return null==t.__k&&(t.textContent=""),N(n,t),"function"==typeof e&&e(),n?n.__c:null}function B(n,t,e){return O(n,t),"function"==typeof e&&e(),n?n.__c:null}p.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(p.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(t){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:t});}});});var H$1=n.event;function Z(){}function Y(){return this.cancelBubble}function $$1(){return this.defaultPrevented}n.event=function(n){return H$1&&(n=H$1(n)),n.persist=Z,n.isPropagationStopped=Y,n.isDefaultPrevented=$$1,n.nativeEvent=n};var q$1,G={configurable:!0,get:function(){return this.class}},J=n.vnode;n.vnode=function(n){var t=n.type,e=n.props,r=e;if("string"==typeof t){for(var u in r={},e){var o=e[u];"value"===u&&"defaultValue"in e&&null==o||("defaultValue"===u&&"value"in e&&null==e.value?u="value":"download"===u&&!0===o?o="":/ondoubleclick/i.test(u)?u="ondblclick":/^onchange(textarea|input)/i.test(u+t)&&!V(e.type)?u="oninput":/^on(Ani|Tra|Tou|BeforeInp)/.test(u)?u=u.toLowerCase():P$1.test(u)?u=u.replace(/[A-Z0-9]/,"-$&").toLowerCase():null===o&&(o=void 0),r[u]=o);}"select"==t&&r.multiple&&Array.isArray(r.value)&&(r.value=w(e.children).forEach(function(n){n.props.selected=-1!=r.value.indexOf(n.props.value);})),"select"==t&&null!=r.defaultValue&&(r.value=w(e.children).forEach(function(n){n.props.selected=r.multiple?-1!=r.defaultValue.indexOf(n.props.value):r.defaultValue==n.props.value;})),n.props=r;}t&&e.class!=e.className&&(G.enumerable="className"in e,null!=e.className&&(r.class=e.className),Object.defineProperty(r,"className",G)),n.$$typeof=W,J&&J(n);};var K=n.__r;n.__r=function(n){K&&K(n),q$1=n.__c;};var Q={ReactCurrentDispatcher:{current:{readContext:function(n){return q$1.__n[n.__c].props.value}}}};"object"==typeof performance&&"function"==typeof performance.now?performance.now.bind(performance):function(){return Date.now()};function fn(n){return a.bind(null,n)}function cn(n){return !!n&&n.$$typeof===W}function an(n){return cn(n)?S.apply(null,arguments):n}function sn(n){return !!n.__k&&(N(null,n),!0)}function hn(n){return n&&(n.base||1===n.nodeType&&n)||null}var pn=function(n,t){return n(t)};var React = {useState:l,useReducer:p$1,useEffect:y$1,useLayoutEffect:h$1,useRef:s$1,useImperativeHandle:_$1,useMemo:d$1,useCallback:A$1,useContext:F,useDebugValue:T$1,version:"16.8.0",Children:k$2,render:z$1,hydrate:B,unmountComponentAtNode:sn,createPortal:I$1,createElement:a,createContext:q,createFactory:fn,cloneElement:an,createRef:h,Fragment:y,isValidElement:cn,findDOMNode:hn,Component:p,PureComponent:E,memo:g$2,forwardRef:x$2,unstable_batchedUpdates:pn,StrictMode:y,Suspense:L$1,SuspenseList:F$1,lazy:D,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Q};
61542
+ var ArrowIcon = function ArrowIcon(props) {
61543
+ return o$2("svg", { ...props,
61544
+ children: o$2("path", {
61545
+ fillRule: "evenodd",
61546
+ d: "m11.657 8-4.95 4.95a1 1 0 0 1-1.414-1.414L8.828 8 5.293 4.464A1 1 0 1 1 6.707 3.05L11.657 8z"
61547
+ })
61548
+ });
61549
+ };
61337
61550
 
61338
- /**
61339
- * @typedef { { getElementLabel: Function, getTypeLabel: Function, getElementIcon: Function } } HeaderProvider
61340
- */
61551
+ ArrowIcon.defaultProps = {
61552
+ xmlns: "http://www.w3.org/2000/svg",
61553
+ width: "16",
61554
+ height: "16"
61555
+ };
61556
+
61557
+ var ExternalLinkIcon = function ExternalLinkIcon(props) {
61558
+ return o$2("svg", { ...props,
61559
+ children: o$2("path", {
61560
+ fillRule: "evenodd",
61561
+ clipRule: "evenodd",
61562
+ d: "M12.637 12.637v-4.72h1.362v4.721c0 .36-.137.676-.411.95-.275.275-.591.412-.95.412H3.362c-.38 0-.703-.132-.967-.396A1.315 1.315 0 0 1 2 12.638V3.362c0-.38.132-.703.396-.967S2.982 2 3.363 2h4.553v1.363H3.363v9.274h9.274zM14 2H9.28l-.001 1.362h2.408L5.065 9.984l.95.95 6.622-6.622v2.409H14V2z",
61563
+ fill: "#818798"
61564
+ })
61565
+ });
61566
+ };
61567
+
61568
+ ExternalLinkIcon.defaultProps = {
61569
+ width: "16",
61570
+ height: "16",
61571
+ fill: "none",
61572
+ xmlns: "http://www.w3.org/2000/svg"
61573
+ };
61574
+
61575
+ var FeelRequiredIcon = function FeelRequiredIcon(props) {
61576
+ return o$2("svg", { ...props,
61577
+ children: [o$2("path", {
61578
+ d: "M5.8 7.06V5.95h4.307v1.11H5.8zm0 3.071v-1.11h4.307v1.11H5.8z",
61579
+ fill: "#505562"
61580
+ }), o$2("path", {
61581
+ fillRule: "evenodd",
61582
+ clipRule: "evenodd",
61583
+ d: "M8 3.268A4.732 4.732 0 1 0 12.732 8H14a6 6 0 1 1-6-6v1.268z",
61584
+ fill: "#505562"
61585
+ }), o$2("path", {
61586
+ d: "m11.28 6.072-.832-.56 1.016-1.224L10 3.848l.312-.912 1.392.584L11.632 2h1.032l-.072 1.52 1.392-.584.312.912-1.464.44 1.008 1.224-.832.552-.864-1.296-.864 1.304z",
61587
+ fill: "#505562"
61588
+ })]
61589
+ });
61590
+ };
61591
+
61592
+ FeelRequiredIcon.defaultProps = {
61593
+ viewBox: "0 0 16 16",
61594
+ fill: "none",
61595
+ xmlns: "http://www.w3.org/2000/svg"
61596
+ };
61597
+
61598
+ var FeelOptionalIcon = function FeelOptionalIcon(props) {
61599
+ return o$2("svg", { ...props,
61600
+ children: [o$2("path", {
61601
+ d: "M5.845 7.04V5.93h4.307v1.11H5.845zm0 3.07V9h4.307v1.11H5.845z",
61602
+ fill: "#505562"
61603
+ }), o$2("path", {
61604
+ fillRule: "evenodd",
61605
+ clipRule: "evenodd",
61606
+ d: "M3.286 8a4.714 4.714 0 1 0 9.428 0 4.714 4.714 0 0 0-9.428 0zM8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2z",
61607
+ fill: "#505562"
61608
+ })]
61609
+ });
61610
+ };
61611
+
61612
+ FeelOptionalIcon.defaultProps = {
61613
+ viewBox: "0 0 16 16",
61614
+ fill: "none",
61615
+ xmlns: "http://www.w3.org/2000/svg"
61616
+ };
61341
61617
 
61342
- /**
61343
- * @param {Object} props
61344
- * @param {Object} props.element,
61345
- * @param {HeaderProvider} props.headerProvider
61346
- */
61347
61618
  function Header(props) {
61348
61619
  const {
61349
61620
  element,
61350
61621
  headerProvider
61351
61622
  } = props;
61352
61623
  const {
61624
+ getElementIcon,
61625
+ getDocumentationRef,
61353
61626
  getElementLabel,
61354
- getTypeLabel,
61355
- getElementIcon
61627
+ getTypeLabel
61356
61628
  } = headerProvider;
61357
61629
  const label = getElementLabel(element);
61358
61630
  const type = getTypeLabel(element);
61631
+ const documentationRef = getDocumentationRef && getDocumentationRef(element);
61359
61632
  const ElementIcon = getElementIcon(element);
61360
61633
  return o$2("div", {
61361
61634
  class: "bio-properties-panel-header",
@@ -61372,35 +61645,48 @@
61372
61645
  title: type,
61373
61646
  class: "bio-properties-panel-header-type",
61374
61647
  children: type
61375
- }), getElementLabel(element) ? o$2("div", {
61648
+ }), label ? o$2("div", {
61376
61649
  title: label,
61377
61650
  class: "bio-properties-panel-header-label",
61378
61651
  children: label
61379
61652
  }) : null]
61653
+ }), o$2("div", {
61654
+ class: "bio-properties-panel-header-actions",
61655
+ children: documentationRef ? o$2("a", {
61656
+ rel: "noopener",
61657
+ class: "bio-properties-panel-header-link",
61658
+ href: documentationRef,
61659
+ title: "Open documentation",
61660
+ target: "_blank",
61661
+ children: o$2(ExternalLinkIcon, {})
61662
+ }) : null
61380
61663
  })]
61381
61664
  });
61382
61665
  }
61383
61666
 
61384
- /**
61385
- * @pinussilvestrus: we need to introduce our own hook to persist the previous
61386
- * state on updates.
61387
- *
61388
- * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
61389
- */
61390
-
61391
- function usePrevious(value) {
61392
- const ref = s$1();
61393
- y$1(() => {
61394
- ref.current = value;
61395
- });
61396
- return ref.current;
61397
- }
61398
-
61399
61667
  const DescriptionContext = q({
61400
61668
  description: {},
61401
61669
  getDescriptionForId: () => {}
61402
61670
  });
61403
61671
 
61672
+ /**
61673
+ * @typedef {Function} <propertiesPanel.showEntry> callback
61674
+ *
61675
+ * @example
61676
+ *
61677
+ * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
61678
+ * // ...
61679
+ * });
61680
+ *
61681
+ * @param {Object} context
61682
+ * @param {boolean} [context.focus]
61683
+ *
61684
+ * @returns void
61685
+ */
61686
+ const EventContext = q({
61687
+ eventBus: null
61688
+ });
61689
+
61404
61690
  const LayoutContext = q({
61405
61691
  layout: {},
61406
61692
  setLayout: () => {},
@@ -61408,6 +61694,107 @@
61408
61694
  setLayoutForKey: () => {}
61409
61695
  });
61410
61696
 
61697
+ /**
61698
+ * Accesses the global DescriptionContext and returns a description for a given id and element.
61699
+ *
61700
+ * @example
61701
+ * ```jsx
61702
+ * function TextField(props) {
61703
+ * const description = useDescriptionContext('input1', element);
61704
+ * }
61705
+ * ```
61706
+ *
61707
+ * @param {string} id
61708
+ * @param {djs.model.Base} element
61709
+ *
61710
+ * @returns {string}
61711
+ */
61712
+
61713
+ function useDescriptionContext(id, element) {
61714
+ const {
61715
+ getDescriptionForId
61716
+ } = F(DescriptionContext);
61717
+ return getDescriptionForId(id, element);
61718
+ }
61719
+
61720
+ const DEFAULT_PRIORITY$6 = 1000;
61721
+ /**
61722
+ * Subscribe to an event.
61723
+ *
61724
+ * @param {string} event
61725
+ * @param {Function} callback
61726
+ * @param {number} [priority]
61727
+ *
61728
+ * @returns {import('preact').Ref}
61729
+ */
61730
+
61731
+ function useEvent(event, callback, priority = DEFAULT_PRIORITY$6) {
61732
+ const {
61733
+ eventBus
61734
+ } = F(EventContext);
61735
+ y$1(() => {
61736
+ if (!eventBus) {
61737
+ return;
61738
+ }
61739
+
61740
+ eventBus.on(event, priority, callback);
61741
+ return () => eventBus.off(event, callback);
61742
+ }, [callback, event, eventBus, priority]);
61743
+ }
61744
+
61745
+ const HIGH_PRIORITY$l = 10000;
61746
+ /**
61747
+ * Buffer events and re-fire during passive effect phase.
61748
+ *
61749
+ * @param {string[]} bufferedEvents
61750
+ * @param {Object} [eventBus]
61751
+ */
61752
+
61753
+ function useEventBuffer(bufferedEvents, eventBus) {
61754
+ const buffer = s$1([]),
61755
+ buffering = s$1(true);
61756
+
61757
+ const createCallback = event => data => {
61758
+ if (buffering.current === true) {
61759
+ buffer.current.unshift([event, data]);
61760
+ }
61761
+ }; // (1) buffer events
61762
+
61763
+
61764
+ y$1(() => {
61765
+ if (!eventBus) {
61766
+ return;
61767
+ }
61768
+
61769
+ const listeners = bufferedEvents.map(event => {
61770
+ return [event, createCallback(event)];
61771
+ });
61772
+ listeners.forEach(([event, callback]) => {
61773
+ eventBus.on(event, HIGH_PRIORITY$l, callback);
61774
+ });
61775
+ return () => {
61776
+ listeners.forEach(([event, callback]) => {
61777
+ eventBus.off(event, callback);
61778
+ });
61779
+ };
61780
+ }, [bufferedEvents, eventBus]); // (2) re-fire events
61781
+
61782
+ y$1(() => {
61783
+ if (!eventBus) {
61784
+ return;
61785
+ }
61786
+
61787
+ buffering.current = false;
61788
+
61789
+ while (buffer.current.length) {
61790
+ const [event, data] = buffer.current.pop();
61791
+ eventBus.fire(event, data);
61792
+ }
61793
+
61794
+ buffering.current = true;
61795
+ });
61796
+ }
61797
+
61411
61798
  /**
61412
61799
  * Creates a state that persists in the global LayoutContext.
61413
61800
  *
@@ -61443,51 +61830,104 @@
61443
61830
  }
61444
61831
 
61445
61832
  /**
61446
- * Accesses the global DescriptionContext and returns a description for a given id and element.
61833
+ * @pinussilvestrus: we need to introduce our own hook to persist the previous
61834
+ * state on updates.
61447
61835
  *
61448
- * @example
61449
- * ```jsx
61450
- * function TextField(props) {
61451
- * const description = useDescriptionContext('input1', element);
61452
- * }
61453
- * ```
61836
+ * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
61837
+ */
61838
+
61839
+ function usePrevious(value) {
61840
+ const ref = s$1();
61841
+ y$1(() => {
61842
+ ref.current = value;
61843
+ });
61844
+ return ref.current;
61845
+ }
61846
+
61847
+ /**
61848
+ * Subscribe to `propertiesPanel.showEntry`.
61454
61849
  *
61455
- * @param {string} id
61456
- * @param {djs.model.Base} element
61850
+ * @param {Function} show
61457
61851
  *
61458
- * @returns {string}
61852
+ * @returns {import('preact').Ref}
61459
61853
  */
61460
61854
 
61461
- function useDescriptionContext(id, element) {
61855
+ function useShowEntryEvent(show) {
61462
61856
  const {
61463
- getDescriptionForId
61464
- } = F(DescriptionContext);
61465
- return getDescriptionForId(id, element);
61857
+ onShow
61858
+ } = F(LayoutContext);
61859
+ const ref = s$1();
61860
+ const [focus, setFocus] = l(false);
61861
+ const onShowEntry = A$1(event => {
61862
+ if (show(event)) {
61863
+ if (isFunction(onShow)) {
61864
+ onShow();
61865
+ }
61866
+
61867
+ if (event.focus && !focus) {
61868
+ setFocus(true);
61869
+ }
61870
+ }
61871
+ }, [show]);
61872
+ y$1(() => {
61873
+ if (focus && ref.current) {
61874
+ if (isFunction(ref.current.focus)) {
61875
+ ref.current.focus();
61876
+ }
61877
+
61878
+ if (isFunction(ref.current.select)) {
61879
+ ref.current.select();
61880
+ }
61881
+
61882
+ setFocus(false);
61883
+ }
61884
+ }, [focus]);
61885
+ useEvent('propertiesPanel.showEntry', onShowEntry);
61886
+ return ref;
61466
61887
  }
61467
61888
 
61468
- var ArrowIcon = function ArrowIcon(props) {
61469
- return o$2("svg", { ...props,
61470
- children: o$2("path", {
61471
- fillRule: "evenodd",
61472
- d: "m11.657 8-4.95 4.95a1 1 0 0 1-1.414-1.414L8.828 8 5.293 4.464A1 1 0 1 1 6.707 3.05L11.657 8z"
61473
- })
61474
- });
61475
- };
61889
+ /**
61890
+ * Subscribe to `propertiesPanel.showError`. On `propertiesPanel.showError` set
61891
+ * temporary error. Fire `propertiesPanel.showEntry` for temporary error to be
61892
+ * visible. Unset error on `propertiesPanel.updated`.
61893
+ *
61894
+ * @param {Function} show
61895
+ *
61896
+ * @returns {import('preact').Ref}
61897
+ */
61476
61898
 
61477
- ArrowIcon.defaultProps = {
61478
- xmlns: "http://www.w3.org/2000/svg",
61479
- width: "16",
61480
- height: "16"
61481
- };
61899
+ function useShowErrorEvent(show) {
61900
+ const {
61901
+ eventBus
61902
+ } = F(EventContext);
61903
+ const [temporaryError, setTemporaryError] = l(null);
61904
+ const onPropertiesPanelUpdated = A$1(() => setTemporaryError(null), []);
61905
+ useEvent('propertiesPanel.updated', onPropertiesPanelUpdated);
61906
+ const onShowError = A$1(event => {
61907
+ setTemporaryError(null);
61908
+
61909
+ if (show(event)) {
61910
+ if (eventBus) {
61911
+ eventBus.fire('propertiesPanel.showEntry', event);
61912
+ }
61913
+
61914
+ setTemporaryError(event.message);
61915
+ }
61916
+ }, [show]);
61917
+ useEvent('propertiesPanel.showError', onShowError);
61918
+ return temporaryError;
61919
+ }
61482
61920
 
61483
61921
  function Group(props) {
61484
61922
  const {
61485
61923
  element,
61486
61924
  entries = [],
61487
61925
  id,
61488
- label
61926
+ label,
61927
+ shouldOpen = false
61489
61928
  } = props;
61490
- const [open, setOpen] = useLayoutState(['groups', id, 'open'], false);
61929
+ const [open, setOpen] = useLayoutState(['groups', id, 'open'], shouldOpen);
61930
+ const onShow = A$1(() => setOpen(true), [setOpen]);
61491
61931
 
61492
61932
  const toggleOpen = () => setOpen(!open);
61493
61933
 
@@ -61510,6 +61950,9 @@
61510
61950
  });
61511
61951
  setEdited(hasOneEditedEntry);
61512
61952
  }, [entries]);
61953
+ const propertiesPanelContext = { ...F(LayoutContext),
61954
+ onShow
61955
+ };
61513
61956
  return o$2("div", {
61514
61957
  class: "bio-properties-panel-group",
61515
61958
  "data-group-id": 'group-' + id,
@@ -61532,15 +61975,18 @@
61532
61975
  })]
61533
61976
  }), o$2("div", {
61534
61977
  class: classnames('bio-properties-panel-group-entries', open ? 'open' : ''),
61535
- children: entries.map(entry => {
61536
- const {
61537
- component: Component,
61538
- id
61539
- } = entry;
61540
- return a(Component, { ...entry,
61541
- key: id,
61542
- element: element
61543
- });
61978
+ children: o$2(LayoutContext.Provider, {
61979
+ value: propertiesPanelContext,
61980
+ children: entries.map(entry => {
61981
+ const {
61982
+ component: Component,
61983
+ id
61984
+ } = entry;
61985
+ return a(Component, { ...entry,
61986
+ element: element,
61987
+ key: id
61988
+ });
61989
+ })
61544
61990
  })
61545
61991
  })]
61546
61992
  });
@@ -61557,6 +62003,7 @@
61557
62003
  open: true
61558
62004
  };
61559
62005
  const DEFAULT_DESCRIPTION = {};
62006
+ const bufferedEvents = ['propertiesPanel.showEntry', 'propertiesPanel.showError'];
61560
62007
  /**
61561
62008
  * @typedef { {
61562
62009
  * component: import('preact').Component,
@@ -61588,7 +62035,8 @@
61588
62035
  * component?: import('preact').Component,
61589
62036
  * entries: Array<EntryDefinition>,
61590
62037
  * id: String,
61591
- * label: String
62038
+ * label: String,
62039
+ * shouldOpen?: Boolean
61592
62040
  * } } GroupDefinition
61593
62041
  *
61594
62042
  * @typedef { {
@@ -61615,6 +62063,7 @@
61615
62063
  * @param {Function} [props.layoutChanged]
61616
62064
  * @param {DescriptionConfig} [props.descriptionConfig]
61617
62065
  * @param {Function} [props.descriptionLoaded]
62066
+ * @param {Object} [props.eventBus]
61618
62067
  */
61619
62068
 
61620
62069
  function PropertiesPanel(props) {
@@ -61625,7 +62074,8 @@
61625
62074
  layoutConfig = {},
61626
62075
  layoutChanged,
61627
62076
  descriptionConfig = {},
61628
- descriptionLoaded
62077
+ descriptionLoaded,
62078
+ eventBus
61629
62079
  } = props; // set-up layout context
61630
62080
 
61631
62081
  const [layout, setLayout] = l(createLayout(layoutConfig));
@@ -61666,6 +62116,13 @@
61666
62116
  description,
61667
62117
  getDescriptionForId
61668
62118
  };
62119
+ useEventBuffer(bufferedEvents, eventBus);
62120
+ const eventContext = {
62121
+ eventBus
62122
+ };
62123
+ const propertiesPanelContext = {
62124
+ element
62125
+ };
61669
62126
 
61670
62127
  if (!element) {
61671
62128
  return o$2("div", {
@@ -61674,28 +62131,34 @@
61674
62131
  });
61675
62132
  }
61676
62133
 
61677
- return o$2(DescriptionContext.Provider, {
61678
- value: descriptionContext,
61679
- children: o$2(LayoutContext.Provider, {
61680
- value: layoutContext,
61681
- children: o$2("div", {
61682
- class: classnames('bio-properties-panel', layout.open ? 'open' : ''),
61683
- children: [o$2(Header, {
61684
- element: element,
61685
- headerProvider: headerProvider
61686
- }), o$2("div", {
61687
- class: "bio-properties-panel-scroll-container",
61688
- children: groups.map(group => {
61689
- const {
61690
- component: Component = Group,
61691
- id
61692
- } = group;
61693
- return a(Component, { ...group,
61694
- key: id,
61695
- element: element
61696
- });
62134
+ return o$2(LayoutContext.Provider, {
62135
+ value: propertiesPanelContext,
62136
+ children: o$2(DescriptionContext.Provider, {
62137
+ value: descriptionContext,
62138
+ children: o$2(LayoutContext.Provider, {
62139
+ value: layoutContext,
62140
+ children: o$2(EventContext.Provider, {
62141
+ value: eventContext,
62142
+ children: o$2("div", {
62143
+ class: classnames('bio-properties-panel', layout.open ? 'open' : ''),
62144
+ children: [o$2(Header, {
62145
+ element: element,
62146
+ headerProvider: headerProvider
62147
+ }), o$2("div", {
62148
+ class: "bio-properties-panel-scroll-container",
62149
+ children: groups.map(group => {
62150
+ const {
62151
+ component: Component = Group,
62152
+ id
62153
+ } = group;
62154
+ return a(Component, { ...group,
62155
+ key: id,
62156
+ element: element
62157
+ });
62158
+ })
62159
+ })]
61697
62160
  })
61698
- })]
62161
+ })
61699
62162
  })
61700
62163
  })
61701
62164
  });
@@ -61730,13 +62193,16 @@
61730
62193
  }
61731
62194
  }
61732
62195
 
62196
+ const noop$2 = () => {};
62197
+
61733
62198
  function Checkbox(props) {
61734
62199
  const {
61735
62200
  id,
61736
62201
  label,
61737
62202
  onChange,
61738
62203
  disabled,
61739
- value = false
62204
+ value = false,
62205
+ show = noop$2
61740
62206
  } = props;
61741
62207
 
61742
62208
  const handleChange = ({
@@ -61745,9 +62211,11 @@
61745
62211
  onChange(target.checked);
61746
62212
  };
61747
62213
 
62214
+ const ref = useShowEntryEvent(show);
61748
62215
  return o$2("div", {
61749
62216
  class: "bio-properties-panel-checkbox",
61750
62217
  children: [o$2("input", {
62218
+ ref: ref,
61751
62219
  id: prefixId$6(id),
61752
62220
  name: id,
61753
62221
  type: "checkbox",
@@ -61782,18 +62250,24 @@
61782
62250
  label,
61783
62251
  getValue,
61784
62252
  setValue,
61785
- disabled
62253
+ disabled,
62254
+ show = noop$2
61786
62255
  } = props;
61787
62256
  const value = getValue(element);
62257
+ const error = useShowErrorEvent(show);
61788
62258
  return o$2("div", {
61789
62259
  class: "bio-properties-panel-entry bio-properties-panel-checkbox-entry",
61790
62260
  "data-entry-id": id,
61791
62261
  children: [o$2(Checkbox, {
62262
+ disabled: disabled,
61792
62263
  id: id,
61793
62264
  label: label,
61794
62265
  onChange: setValue,
61795
- value: value,
61796
- disabled: disabled
62266
+ show: show,
62267
+ value: value
62268
+ }), error && o$2("div", {
62269
+ class: "bio-properties-panel-error",
62270
+ children: error
61797
62271
  }), o$2(Description, {
61798
62272
  forId: id,
61799
62273
  element: element,
@@ -61809,6 +62283,25 @@
61809
62283
  return `bio-properties-panel-${id}`;
61810
62284
  }
61811
62285
 
62286
+ const noop$1 = () => {};
62287
+ /**
62288
+ * @typedef { { value: string, label: string, disabled: boolean } } Option
62289
+ */
62290
+
62291
+ /**
62292
+ * Provides basic select input.
62293
+ *
62294
+ * @param {object} props
62295
+ * @param {string} props.id
62296
+ * @param {string[]} props.path
62297
+ * @param {string} props.label
62298
+ * @param {Function} props.onChange
62299
+ * @param {Array<Option>} [props.options]
62300
+ * @param {string} props.value
62301
+ * @param {boolean} [props.disabled]
62302
+ */
62303
+
62304
+
61812
62305
  function Select(props) {
61813
62306
  const {
61814
62307
  id,
@@ -61816,8 +62309,10 @@
61816
62309
  onChange,
61817
62310
  options = [],
61818
62311
  value,
61819
- disabled
62312
+ disabled,
62313
+ show = noop$1
61820
62314
  } = props;
62315
+ const ref = useShowEntryEvent(show);
61821
62316
 
61822
62317
  const handleChange = ({
61823
62318
  target
@@ -61832,6 +62327,7 @@
61832
62327
  class: "bio-properties-panel-label",
61833
62328
  children: label
61834
62329
  }), o$2("select", {
62330
+ ref: ref,
61835
62331
  id: prefixId$4(id),
61836
62332
  name: id,
61837
62333
  class: "bio-properties-panel-input",
@@ -61870,12 +62366,14 @@
61870
62366
  getValue,
61871
62367
  setValue,
61872
62368
  getOptions,
61873
- disabled
62369
+ disabled,
62370
+ show = noop$1
61874
62371
  } = props;
61875
62372
  const value = getValue(element);
61876
62373
  const options = getOptions(element);
62374
+ const error = useShowErrorEvent(show);
61877
62375
  return o$2("div", {
61878
- class: "bio-properties-panel-entry",
62376
+ class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
61879
62377
  "data-entry-id": id,
61880
62378
  children: [o$2(Select, {
61881
62379
  id: id,
@@ -61883,7 +62381,11 @@
61883
62381
  value: value,
61884
62382
  onChange: setValue,
61885
62383
  options: options,
61886
- disabled: disabled
62384
+ disabled: disabled,
62385
+ show: show
62386
+ }), error && o$2("div", {
62387
+ class: "bio-properties-panel-error",
62388
+ children: error
61887
62389
  }), o$2(Description, {
61888
62390
  forId: id,
61889
62391
  element: element,
@@ -61899,12 +62401,27 @@
61899
62401
  return `bio-properties-panel-${id}`;
61900
62402
  }
61901
62403
 
62404
+ function FeelIcon(props) {
62405
+ const {
62406
+ label,
62407
+ feel = false
62408
+ } = props;
62409
+ const feelRequiredLabel = ' must be a FEEL expression';
62410
+ const feelOptionalLabel = ' can optionally be a FEEL expression';
62411
+ return o$2("i", {
62412
+ class: "bio-properties-panel-feel-icon",
62413
+ title: label + (feel === 'required' ? feelRequiredLabel : feelOptionalLabel),
62414
+ children: feel === 'required' ? o$2(FeelRequiredIcon, {}) : o$2(FeelOptionalIcon, {})
62415
+ });
62416
+ }
62417
+
61902
62418
  function TextArea(props) {
61903
62419
  const {
61904
62420
  id,
61905
62421
  label,
61906
62422
  rows = 2,
61907
62423
  debounce,
62424
+ feel,
61908
62425
  onInput,
61909
62426
  value = '',
61910
62427
  disabled,
@@ -61920,7 +62437,10 @@
61920
62437
  children: [o$2("label", {
61921
62438
  for: prefixId$2(id),
61922
62439
  class: "bio-properties-panel-label",
61923
- children: label
62440
+ children: [label, feel && o$2(FeelIcon, {
62441
+ feel: feel,
62442
+ label: label
62443
+ })]
61924
62444
  }), o$2("textarea", {
61925
62445
  id: prefixId$2(id),
61926
62446
  name: id,
@@ -61956,6 +62476,7 @@
61956
62476
  id,
61957
62477
  description,
61958
62478
  debounce,
62479
+ feel,
61959
62480
  label,
61960
62481
  getValue,
61961
62482
  setValue,
@@ -61975,6 +62496,7 @@
61975
62496
  rows: rows,
61976
62497
  debounce: debounce,
61977
62498
  monospace: monospace,
62499
+ feel: feel,
61978
62500
  disabled: disabled
61979
62501
  }), o$2(Description, {
61980
62502
  forId: id,
@@ -61991,6 +62513,8 @@
61991
62513
  return `bio-properties-panel-${id}`;
61992
62514
  }
61993
62515
 
62516
+ const noop = () => {};
62517
+
61994
62518
  function Textfield(props) {
61995
62519
  const {
61996
62520
  debounce,
@@ -61998,8 +62522,11 @@
61998
62522
  id,
61999
62523
  label,
62000
62524
  onInput,
62001
- value = ''
62525
+ feel = false,
62526
+ value = '',
62527
+ show = noop
62002
62528
  } = props;
62529
+ const ref = useShowEntryEvent(show);
62003
62530
  const handleInput = d$1(() => {
62004
62531
  return debounce(({
62005
62532
  target
@@ -62010,8 +62537,12 @@
62010
62537
  children: [o$2("label", {
62011
62538
  for: prefixId$1(id),
62012
62539
  class: "bio-properties-panel-label",
62013
- children: label
62540
+ children: [label, feel && o$2(FeelIcon, {
62541
+ feel: feel,
62542
+ label: label
62543
+ })]
62014
62544
  }), o$2("input", {
62545
+ ref: ref,
62015
62546
  id: prefixId$1(id),
62016
62547
  type: "text",
62017
62548
  name: id,
@@ -62047,55 +62578,65 @@
62047
62578
  description,
62048
62579
  debounce,
62049
62580
  disabled,
62581
+ feel,
62050
62582
  label,
62051
62583
  getValue,
62052
62584
  setValue,
62053
- validate
62585
+ validate,
62586
+ show = noop
62054
62587
  } = props;
62055
- const [error, setError] = l(null);
62056
- const [invalidValueCache, setInvalidValueCache] = l(null);
62588
+ const [cachedInvalidValue, setCachedInvalidValue] = l(null);
62589
+ const [validationError, setValidationError] = l(null);
62057
62590
  let value = getValue(element);
62058
- const prevValue = usePrevious(value); // validate again when value prop changed
62059
-
62591
+ const previousValue = usePrevious(value);
62060
62592
  y$1(() => {
62061
- const err = validate ? validate(value) : null;
62062
- setError(err);
62063
- }, [value]); // validate on change
62593
+ if (isFunction(validate)) {
62594
+ const newValidationError = validate(value) || null;
62595
+ setValidationError(newValidationError);
62596
+ }
62597
+ }, [value]);
62064
62598
 
62065
- const handleChange = newValue => {
62066
- const err = validate ? validate(newValue) : null;
62599
+ const onInput = newValue => {
62600
+ let newValidationError = null;
62067
62601
 
62068
- if (err) {
62069
- setInvalidValueCache(newValue);
62602
+ if (isFunction(validate)) {
62603
+ newValidationError = validate(newValue) || null;
62604
+ }
62605
+
62606
+ if (newValidationError) {
62607
+ setCachedInvalidValue(newValue);
62070
62608
  } else {
62071
62609
  setValue(newValue);
62072
62610
  }
62073
62611
 
62074
- setError(err);
62075
- }; // keep showing invalid value on errors, although it was not set
62076
-
62612
+ setValidationError(newValidationError);
62613
+ };
62077
62614
 
62078
- if (prevValue === value && error) {
62079
- value = invalidValueCache;
62615
+ if (previousValue === value && validationError) {
62616
+ value = cachedInvalidValue;
62080
62617
  }
62081
62618
 
62619
+ const temporaryError = useShowErrorEvent(show);
62620
+ const error = temporaryError || validationError;
62082
62621
  return o$2("div", {
62083
62622
  class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
62084
62623
  "data-entry-id": id,
62085
62624
  children: [o$2(Textfield, {
62625
+ debounce: debounce,
62626
+ disabled: disabled,
62627
+ feel: feel,
62086
62628
  id: id,
62087
62629
  label: label,
62088
- value: value,
62089
- onInput: handleChange,
62090
- debounce: debounce,
62091
- disabled: disabled
62630
+ onInput: onInput,
62631
+ show: show,
62632
+ value: value
62633
+ }), error && o$2("div", {
62634
+ class: "bio-properties-panel-error",
62635
+ children: error
62092
62636
  }), o$2(Description, {
62093
62637
  forId: id,
62094
62638
  element: element,
62095
62639
  value: description
62096
- }), error && o$2("div", {
62097
- class: "bio-properties-panel-error",
62098
- children: error
62099
62640
  })]
62100
62641
  });
62101
62642
  }
@@ -62124,2792 +62665,264 @@
62124
62665
  debounceInput: ['factory', debounceInput]
62125
62666
  };
62126
62667
 
62127
- /**
62128
- * Failsafe remove an element from a collection
62129
- *
62130
- * @param {Array<Object>} [collection]
62131
- * @param {Object} [element]
62132
- *
62133
- * @return {number} the previous index of the element
62134
- */
62668
+ var require$$0 = /*@__PURE__*/getAugmentedNamespace(index_esm);
62669
+
62670
+ const {
62671
+ isNil: isNil$1,
62672
+ isString: isString$1,
62673
+ isUndefined: isUndefined$2
62674
+ } = require$$0;
62135
62675
 
62136
62676
  /**
62137
- * Fail save add an element to the given connection, ensuring
62138
- * it does not yet exist.
62677
+ * Get path from model element and optional parent model element. Falls back to
62678
+ * returning null.
62139
62679
  *
62140
- * @param {Array<Object>} collection
62141
- * @param {Object} element
62142
- * @param {number} idx
62680
+ * @param {ModdleElement} moddleElement
62681
+ * @param {ModdleElement} [parentModdleElement]
62682
+ *
62683
+ * @returns {string[]|null}
62143
62684
  */
62144
- function add$2(collection, element, idx) {
62145
-
62146
- if (!collection || !element) {
62147
- return;
62685
+ var getPath = function(moddleElement, parentModdleElement) {
62686
+ if (!moddleElement) {
62687
+ return null;
62148
62688
  }
62149
62689
 
62150
- if (typeof idx !== 'number') {
62151
- idx = -1;
62690
+ if (moddleElement === parentModdleElement) {
62691
+ return [];
62152
62692
  }
62153
62693
 
62154
- var currentIdx = collection.indexOf(element);
62155
-
62156
- if (currentIdx !== -1) {
62157
-
62158
- if (currentIdx === idx) {
62694
+ let path = [],
62695
+ parent;
62159
62696
 
62160
- // nothing to do, position has not changed
62161
- return;
62162
- } else {
62163
-
62164
- if (idx !== -1) {
62697
+ do {
62698
+ parent = moddleElement.$parent;
62165
62699
 
62166
- // remove from current position
62167
- collection.splice(currentIdx, 1);
62700
+ if (!parent) {
62701
+ if (moddleElement.$instanceOf('bpmn:Definitions')) {
62702
+ break;
62168
62703
  } else {
62169
-
62170
- // already exists in collection
62171
- return;
62704
+ return null;
62172
62705
  }
62173
62706
  }
62174
- }
62175
-
62176
- if (idx !== -1) {
62177
-
62178
- // insert at specified position
62179
- collection.splice(idx, 0, element);
62180
- } else {
62181
-
62182
- // push to end
62183
- collection.push(element);
62184
- }
62185
- }
62186
-
62187
- // Note: this is the semver.org version of the spec that it implements
62188
- // Not necessarily the package version of this code.
62189
- const SEMVER_SPEC_VERSION = '2.0.0';
62190
-
62191
- const MAX_LENGTH = 256;
62192
- const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
62193
- /* istanbul ignore next */ 9007199254740991;
62194
-
62195
- // Max safe segment length for coercion.
62196
- const MAX_SAFE_COMPONENT_LENGTH = 16;
62197
-
62198
- var constants = {
62199
- SEMVER_SPEC_VERSION,
62200
- MAX_LENGTH,
62201
- MAX_SAFE_INTEGER,
62202
- MAX_SAFE_COMPONENT_LENGTH
62203
- };
62204
-
62205
- const debug = (
62206
- typeof process === 'object' &&
62207
- process.env &&
62208
- process.env.NODE_DEBUG &&
62209
- /\bsemver\b/i.test(process.env.NODE_DEBUG)
62210
- ) ? (...args) => console.error('SEMVER', ...args)
62211
- : () => {};
62212
-
62213
- var debug_1 = debug;
62214
-
62215
- var re_1 = createCommonjsModule(function (module, exports) {
62216
- const { MAX_SAFE_COMPONENT_LENGTH } = constants;
62217
-
62218
- exports = module.exports = {};
62219
-
62220
- // The actual regexps go on exports.re
62221
- const re = exports.re = [];
62222
- const src = exports.src = [];
62223
- const t = exports.t = {};
62224
- let R = 0;
62225
-
62226
- const createToken = (name, value, isGlobal) => {
62227
- const index = R++;
62228
- debug_1(index, value);
62229
- t[name] = index;
62230
- src[index] = value;
62231
- re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
62232
- };
62233
-
62234
- // The following Regular Expressions can be used for tokenizing,
62235
- // validating, and parsing SemVer version strings.
62236
62707
 
62237
- // ## Numeric Identifier
62238
- // A single `0`, or a non-zero digit followed by zero or more digits.
62708
+ path = [ ...getPropertyName(moddleElement, parent), ...path ];
62239
62709
 
62240
- createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
62241
- createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+');
62710
+ moddleElement = parent;
62242
62711
 
62243
- // ## Non-numeric Identifier
62244
- // Zero or more digits, followed by a letter or hyphen, and then zero or
62245
- // more letters, digits, or hyphens.
62246
-
62247
- createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*');
62248
-
62249
- // ## Main Version
62250
- // Three dot-separated numeric identifiers.
62251
-
62252
- createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
62253
- `(${src[t.NUMERICIDENTIFIER]})\\.` +
62254
- `(${src[t.NUMERICIDENTIFIER]})`);
62255
-
62256
- createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
62257
- `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
62258
- `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
62259
-
62260
- // ## Pre-release Version Identifier
62261
- // A numeric identifier, or a non-numeric identifier.
62262
-
62263
- createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
62264
- }|${src[t.NONNUMERICIDENTIFIER]})`);
62265
-
62266
- createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
62267
- }|${src[t.NONNUMERICIDENTIFIER]})`);
62268
-
62269
- // ## Pre-release Version
62270
- // Hyphen, followed by one or more dot-separated pre-release version
62271
- // identifiers.
62272
-
62273
- createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
62274
- }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
62275
-
62276
- createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
62277
- }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
62278
-
62279
- // ## Build Metadata Identifier
62280
- // Any combination of digits, letters, or hyphens.
62281
-
62282
- createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+');
62283
-
62284
- // ## Build Metadata
62285
- // Plus sign, followed by one or more period-separated build metadata
62286
- // identifiers.
62287
-
62288
- createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
62289
- }(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
62290
-
62291
- // ## Full Version String
62292
- // A main version, followed optionally by a pre-release version and
62293
- // build metadata.
62294
-
62295
- // Note that the only major, minor, patch, and pre-release sections of
62296
- // the version string are capturing groups. The build metadata is not a
62297
- // capturing group, because it should not ever be used in version
62298
- // comparison.
62299
-
62300
- createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
62301
- }${src[t.PRERELEASE]}?${
62302
- src[t.BUILD]}?`);
62303
-
62304
- createToken('FULL', `^${src[t.FULLPLAIN]}$`);
62305
-
62306
- // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
62307
- // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
62308
- // common in the npm registry.
62309
- createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
62310
- }${src[t.PRERELEASELOOSE]}?${
62311
- src[t.BUILD]}?`);
62312
-
62313
- createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
62314
-
62315
- createToken('GTLT', '((?:<|>)?=?)');
62316
-
62317
- // Something like "2.*" or "1.2.x".
62318
- // Note that "x.x" is a valid xRange identifer, meaning "any version"
62319
- // Only the first item is strictly required.
62320
- createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
62321
- createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
62322
-
62323
- createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
62324
- `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
62325
- `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
62326
- `(?:${src[t.PRERELEASE]})?${
62327
- src[t.BUILD]}?` +
62328
- `)?)?`);
62329
-
62330
- createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
62331
- `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
62332
- `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
62333
- `(?:${src[t.PRERELEASELOOSE]})?${
62334
- src[t.BUILD]}?` +
62335
- `)?)?`);
62336
-
62337
- createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
62338
- createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
62339
-
62340
- // Coercion.
62341
- // Extract anything that could conceivably be a part of a valid semver
62342
- createToken('COERCE', `${'(^|[^\\d])' +
62343
- '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
62344
- `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
62345
- `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
62346
- `(?:$|[^\\d])`);
62347
- createToken('COERCERTL', src[t.COERCE], true);
62348
-
62349
- // Tilde ranges.
62350
- // Meaning is "reasonably at or greater than"
62351
- createToken('LONETILDE', '(?:~>?)');
62352
-
62353
- createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
62354
- exports.tildeTrimReplace = '$1~';
62355
-
62356
- createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
62357
- createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
62358
-
62359
- // Caret ranges.
62360
- // Meaning is "at least and backwards compatible with"
62361
- createToken('LONECARET', '(?:\\^)');
62362
-
62363
- createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
62364
- exports.caretTrimReplace = '$1^';
62365
-
62366
- createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
62367
- createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
62368
-
62369
- // A simple gt/lt/eq thing, or just "" to indicate "any version"
62370
- createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
62371
- createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
62372
-
62373
- // An expression to strip any whitespace between the gtlt and the thing
62374
- // it modifies, so that `> 1.2.3` ==> `>1.2.3`
62375
- createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
62376
- }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
62377
- exports.comparatorTrimReplace = '$1$2$3';
62378
-
62379
- // Something like `1.2.3 - 1.2.4`
62380
- // Note that these all use the loose form, because they'll be
62381
- // checked against either the strict or loose comparator form
62382
- // later.
62383
- createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
62384
- `\\s+-\\s+` +
62385
- `(${src[t.XRANGEPLAIN]})` +
62386
- `\\s*$`);
62387
-
62388
- createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
62389
- `\\s+-\\s+` +
62390
- `(${src[t.XRANGEPLAINLOOSE]})` +
62391
- `\\s*$`);
62392
-
62393
- // Star ranges basically just allow anything at all.
62394
- createToken('STAR', '(<|>)?=?\\s*\\*');
62395
- // >=0.0.0 is like a star
62396
- createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$');
62397
- createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$');
62398
- });
62399
-
62400
- // parse out just the options we care about so we always get a consistent
62401
- // obj with keys in a consistent order.
62402
- const opts = ['includePrerelease', 'loose', 'rtl'];
62403
- const parseOptions = options =>
62404
- !options ? {}
62405
- : typeof options !== 'object' ? { loose: true }
62406
- : opts.filter(k => options[k]).reduce((options, k) => {
62407
- options[k] = true;
62408
- return options
62409
- }, {});
62410
- var parseOptions_1 = parseOptions;
62411
-
62412
- const numeric = /^[0-9]+$/;
62413
- const compareIdentifiers = (a, b) => {
62414
- const anum = numeric.test(a);
62415
- const bnum = numeric.test(b);
62416
-
62417
- if (anum && bnum) {
62418
- a = +a;
62419
- b = +b;
62420
- }
62421
-
62422
- return a === b ? 0
62423
- : (anum && !bnum) ? -1
62424
- : (bnum && !anum) ? 1
62425
- : a < b ? -1
62426
- : 1
62427
- };
62428
-
62429
- const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
62712
+ if (parentModdleElement && moddleElement === parentModdleElement) {
62713
+ break;
62714
+ }
62715
+ } while (parent);
62430
62716
 
62431
- var identifiers = {
62432
- compareIdentifiers,
62433
- rcompareIdentifiers
62717
+ return path;
62434
62718
  };
62435
62719
 
62436
- const { MAX_LENGTH: MAX_LENGTH$1, MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1 } = constants;
62437
- const { re: re$2, t: t$2 } = re_1;
62438
-
62439
-
62440
- const { compareIdentifiers: compareIdentifiers$1 } = identifiers;
62441
- class SemVer {
62442
- constructor (version, options) {
62443
- options = parseOptions_1(options);
62444
-
62445
- if (version instanceof SemVer) {
62446
- if (version.loose === !!options.loose &&
62447
- version.includePrerelease === !!options.includePrerelease) {
62448
- return version
62449
- } else {
62450
- version = version.version;
62720
+ /**
62721
+ * Get property name from model element and parent model element.
62722
+ *
62723
+ * @param {ModdleElement} moddleElement
62724
+ * @param {ModdleElement} parentModdleElement
62725
+ *
62726
+ * @returns {string[]}
62727
+ */
62728
+ function getPropertyName(moddleElement, parentModdleElement) {
62729
+ for (let property of Object.values(parentModdleElement.$descriptor.propertiesByName)) {
62730
+ if (property.isMany) {
62731
+ if (parentModdleElement.get(property.name).includes(moddleElement)) {
62732
+ return [
62733
+ property.name,
62734
+ parentModdleElement.get(property.name).indexOf(moddleElement)
62735
+ ];
62451
62736
  }
62452
- } else if (typeof version !== 'string') {
62453
- throw new TypeError(`Invalid Version: ${version}`)
62454
- }
62455
-
62456
- if (version.length > MAX_LENGTH$1) {
62457
- throw new TypeError(
62458
- `version is longer than ${MAX_LENGTH$1} characters`
62459
- )
62460
- }
62461
-
62462
- debug_1('SemVer', version, options);
62463
- this.options = options;
62464
- this.loose = !!options.loose;
62465
- // this isn't actually relevant for versions, but keep it so that we
62466
- // don't run into trouble passing this.options around.
62467
- this.includePrerelease = !!options.includePrerelease;
62468
-
62469
- const m = version.trim().match(options.loose ? re$2[t$2.LOOSE] : re$2[t$2.FULL]);
62470
-
62471
- if (!m) {
62472
- throw new TypeError(`Invalid Version: ${version}`)
62473
- }
62474
-
62475
- this.raw = version;
62476
-
62477
- // these are actually numbers
62478
- this.major = +m[1];
62479
- this.minor = +m[2];
62480
- this.patch = +m[3];
62481
-
62482
- if (this.major > MAX_SAFE_INTEGER$1 || this.major < 0) {
62483
- throw new TypeError('Invalid major version')
62484
- }
62485
-
62486
- if (this.minor > MAX_SAFE_INTEGER$1 || this.minor < 0) {
62487
- throw new TypeError('Invalid minor version')
62488
- }
62489
-
62490
- if (this.patch > MAX_SAFE_INTEGER$1 || this.patch < 0) {
62491
- throw new TypeError('Invalid patch version')
62492
- }
62493
-
62494
- // numberify any prerelease numeric ids
62495
- if (!m[4]) {
62496
- this.prerelease = [];
62497
62737
  } else {
62498
- this.prerelease = m[4].split('.').map((id) => {
62499
- if (/^[0-9]+$/.test(id)) {
62500
- const num = +id;
62501
- if (num >= 0 && num < MAX_SAFE_INTEGER$1) {
62502
- return num
62503
- }
62504
- }
62505
- return id
62506
- });
62507
- }
62508
-
62509
- this.build = m[5] ? m[5].split('.') : [];
62510
- this.format();
62511
- }
62512
-
62513
- format () {
62514
- this.version = `${this.major}.${this.minor}.${this.patch}`;
62515
- if (this.prerelease.length) {
62516
- this.version += `-${this.prerelease.join('.')}`;
62517
- }
62518
- return this.version
62519
- }
62520
-
62521
- toString () {
62522
- return this.version
62523
- }
62524
-
62525
- compare (other) {
62526
- debug_1('SemVer.compare', this.version, this.options, other);
62527
- if (!(other instanceof SemVer)) {
62528
- if (typeof other === 'string' && other === this.version) {
62529
- return 0
62738
+ if (parentModdleElement.get(property.name) === moddleElement) {
62739
+ return [ property.name ];
62530
62740
  }
62531
- other = new SemVer(other, this.options);
62532
- }
62533
-
62534
- if (other.version === this.version) {
62535
- return 0
62536
- }
62537
-
62538
- return this.compareMain(other) || this.comparePre(other)
62539
- }
62540
-
62541
- compareMain (other) {
62542
- if (!(other instanceof SemVer)) {
62543
- other = new SemVer(other, this.options);
62544
62741
  }
62545
-
62546
- return (
62547
- compareIdentifiers$1(this.major, other.major) ||
62548
- compareIdentifiers$1(this.minor, other.minor) ||
62549
- compareIdentifiers$1(this.patch, other.patch)
62550
- )
62551
62742
  }
62552
62743
 
62553
- comparePre (other) {
62554
- if (!(other instanceof SemVer)) {
62555
- other = new SemVer(other, this.options);
62556
- }
62557
-
62558
- // NOT having a prerelease is > having one
62559
- if (this.prerelease.length && !other.prerelease.length) {
62560
- return -1
62561
- } else if (!this.prerelease.length && other.prerelease.length) {
62562
- return 1
62563
- } else if (!this.prerelease.length && !other.prerelease.length) {
62564
- return 0
62565
- }
62566
-
62567
- let i = 0;
62568
- do {
62569
- const a = this.prerelease[i];
62570
- const b = other.prerelease[i];
62571
- debug_1('prerelease compare', i, a, b);
62572
- if (a === undefined && b === undefined) {
62573
- return 0
62574
- } else if (b === undefined) {
62575
- return 1
62576
- } else if (a === undefined) {
62577
- return -1
62578
- } else if (a === b) {
62579
- continue
62580
- } else {
62581
- return compareIdentifiers$1(a, b)
62582
- }
62583
- } while (++i)
62584
- }
62585
-
62586
- compareBuild (other) {
62587
- if (!(other instanceof SemVer)) {
62588
- other = new SemVer(other, this.options);
62589
- }
62590
-
62591
- let i = 0;
62592
- do {
62593
- const a = this.build[i];
62594
- const b = other.build[i];
62595
- debug_1('prerelease compare', i, a, b);
62596
- if (a === undefined && b === undefined) {
62597
- return 0
62598
- } else if (b === undefined) {
62599
- return 1
62600
- } else if (a === undefined) {
62601
- return -1
62602
- } else if (a === b) {
62603
- continue
62604
- } else {
62605
- return compareIdentifiers$1(a, b)
62606
- }
62607
- } while (++i)
62608
- }
62609
-
62610
- // preminor will bump the version up to the next minor release, and immediately
62611
- // down to pre-release. premajor and prepatch work the same way.
62612
- inc (release, identifier) {
62613
- switch (release) {
62614
- case 'premajor':
62615
- this.prerelease.length = 0;
62616
- this.patch = 0;
62617
- this.minor = 0;
62618
- this.major++;
62619
- this.inc('pre', identifier);
62620
- break
62621
- case 'preminor':
62622
- this.prerelease.length = 0;
62623
- this.patch = 0;
62624
- this.minor++;
62625
- this.inc('pre', identifier);
62626
- break
62627
- case 'prepatch':
62628
- // If this is already a prerelease, it will bump to the next version
62629
- // drop any prereleases that might already exist, since they are not
62630
- // relevant at this point.
62631
- this.prerelease.length = 0;
62632
- this.inc('patch', identifier);
62633
- this.inc('pre', identifier);
62634
- break
62635
- // If the input is a non-prerelease version, this acts the same as
62636
- // prepatch.
62637
- case 'prerelease':
62638
- if (this.prerelease.length === 0) {
62639
- this.inc('patch', identifier);
62640
- }
62641
- this.inc('pre', identifier);
62642
- break
62643
-
62644
- case 'major':
62645
- // If this is a pre-major version, bump up to the same major version.
62646
- // Otherwise increment major.
62647
- // 1.0.0-5 bumps to 1.0.0
62648
- // 1.1.0 bumps to 2.0.0
62649
- if (
62650
- this.minor !== 0 ||
62651
- this.patch !== 0 ||
62652
- this.prerelease.length === 0
62653
- ) {
62654
- this.major++;
62655
- }
62656
- this.minor = 0;
62657
- this.patch = 0;
62658
- this.prerelease = [];
62659
- break
62660
- case 'minor':
62661
- // If this is a pre-minor version, bump up to the same minor version.
62662
- // Otherwise increment minor.
62663
- // 1.2.0-5 bumps to 1.2.0
62664
- // 1.2.1 bumps to 1.3.0
62665
- if (this.patch !== 0 || this.prerelease.length === 0) {
62666
- this.minor++;
62667
- }
62668
- this.patch = 0;
62669
- this.prerelease = [];
62670
- break
62671
- case 'patch':
62672
- // If this is not a pre-release version, it will increment the patch.
62673
- // If it is a pre-release it will bump up to the same patch version.
62674
- // 1.2.0-5 patches to 1.2.0
62675
- // 1.2.0 patches to 1.2.1
62676
- if (this.prerelease.length === 0) {
62677
- this.patch++;
62678
- }
62679
- this.prerelease = [];
62680
- break
62681
- // This probably shouldn't be used publicly.
62682
- // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
62683
- case 'pre':
62684
- if (this.prerelease.length === 0) {
62685
- this.prerelease = [0];
62686
- } else {
62687
- let i = this.prerelease.length;
62688
- while (--i >= 0) {
62689
- if (typeof this.prerelease[i] === 'number') {
62690
- this.prerelease[i]++;
62691
- i = -2;
62692
- }
62693
- }
62694
- if (i === -1) {
62695
- // didn't increment anything
62696
- this.prerelease.push(0);
62697
- }
62698
- }
62699
- if (identifier) {
62700
- // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
62701
- // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
62702
- if (this.prerelease[0] === identifier) {
62703
- if (isNaN(this.prerelease[1])) {
62704
- this.prerelease = [identifier, 0];
62705
- }
62706
- } else {
62707
- this.prerelease = [identifier, 0];
62708
- }
62709
- }
62710
- break
62711
-
62712
- default:
62713
- throw new Error(`invalid increment argument: ${release}`)
62714
- }
62715
- this.format();
62716
- this.raw = this.version;
62717
- return this
62718
- }
62744
+ return [];
62719
62745
  }
62720
62746
 
62721
- var semver = SemVer;
62722
-
62723
- const {MAX_LENGTH: MAX_LENGTH$2} = constants;
62724
- const { re: re$3, t: t$3 } = re_1;
62725
-
62726
-
62727
-
62728
- const parse$2 = (version, options) => {
62729
- options = parseOptions_1(options);
62730
-
62731
- if (version instanceof semver) {
62732
- return version
62733
- }
62734
-
62735
- if (typeof version !== 'string') {
62736
- return null
62737
- }
62738
-
62739
- if (version.length > MAX_LENGTH$2) {
62740
- return null
62741
- }
62742
-
62743
- const r = options.loose ? re$3[t$3.LOOSE] : re$3[t$3.FULL];
62744
- if (!r.test(version)) {
62745
- return null
62746
- }
62747
-
62748
- try {
62749
- return new semver(version, options)
62750
- } catch (er) {
62751
- return null
62752
- }
62753
- };
62754
-
62755
- var parse_1 = parse$2;
62756
-
62757
- const valid = (version, options) => {
62758
- const v = parse_1(version, options);
62759
- return v ? v.version : null
62760
- };
62761
- var valid_1 = valid;
62762
-
62763
- const clean = (version, options) => {
62764
- const s = parse_1(version.trim().replace(/^[=v]+/, ''), options);
62765
- return s ? s.version : null
62766
- };
62767
- var clean_1 = clean;
62768
-
62769
- const inc = (version, release, options, identifier) => {
62770
- if (typeof (options) === 'string') {
62771
- identifier = options;
62772
- options = undefined;
62773
- }
62774
-
62775
- try {
62776
- return new semver(version, options).inc(release, identifier).version
62777
- } catch (er) {
62778
- return null
62779
- }
62780
- };
62781
- var inc_1 = inc;
62782
-
62783
- const compare = (a, b, loose) =>
62784
- new semver(a, loose).compare(new semver(b, loose));
62785
-
62786
- var compare_1 = compare;
62787
-
62788
- const eq = (a, b, loose) => compare_1(a, b, loose) === 0;
62789
- var eq_1 = eq;
62790
-
62791
- const diff = (version1, version2) => {
62792
- if (eq_1(version1, version2)) {
62793
- return null
62794
- } else {
62795
- const v1 = parse_1(version1);
62796
- const v2 = parse_1(version2);
62797
- const hasPre = v1.prerelease.length || v2.prerelease.length;
62798
- const prefix = hasPre ? 'pre' : '';
62799
- const defaultResult = hasPre ? 'prerelease' : '';
62800
- for (const key in v1) {
62801
- if (key === 'major' || key === 'minor' || key === 'patch') {
62802
- if (v1[key] !== v2[key]) {
62803
- return prefix + key
62804
- }
62805
- }
62806
- }
62807
- return defaultResult // may be undefined
62808
- }
62809
- };
62810
- var diff_1 = diff;
62811
-
62812
- const major = (a, loose) => new semver(a, loose).major;
62813
- var major_1 = major;
62814
-
62815
- const minor = (a, loose) => new semver(a, loose).minor;
62816
- var minor_1 = minor;
62817
-
62818
- const patch = (a, loose) => new semver(a, loose).patch;
62819
- var patch_1 = patch;
62820
-
62821
- const prerelease = (version, options) => {
62822
- const parsed = parse_1(version, options);
62823
- return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
62824
- };
62825
- var prerelease_1 = prerelease;
62826
-
62827
- const rcompare = (a, b, loose) => compare_1(b, a, loose);
62828
- var rcompare_1 = rcompare;
62829
-
62830
- const compareLoose = (a, b) => compare_1(a, b, true);
62831
- var compareLoose_1 = compareLoose;
62832
-
62833
- const compareBuild = (a, b, loose) => {
62834
- const versionA = new semver(a, loose);
62835
- const versionB = new semver(b, loose);
62836
- return versionA.compare(versionB) || versionA.compareBuild(versionB)
62837
- };
62838
- var compareBuild_1 = compareBuild;
62839
-
62840
- const sort = (list, loose) => list.sort((a, b) => compareBuild_1(a, b, loose));
62841
- var sort_1 = sort;
62842
-
62843
- const rsort = (list, loose) => list.sort((a, b) => compareBuild_1(b, a, loose));
62844
- var rsort_1 = rsort;
62845
-
62846
- const gt = (a, b, loose) => compare_1(a, b, loose) > 0;
62847
- var gt_1 = gt;
62848
-
62849
- const lt = (a, b, loose) => compare_1(a, b, loose) < 0;
62850
- var lt_1 = lt;
62851
-
62852
- const neq = (a, b, loose) => compare_1(a, b, loose) !== 0;
62853
- var neq_1 = neq;
62854
-
62855
- const gte = (a, b, loose) => compare_1(a, b, loose) >= 0;
62856
- var gte_1 = gte;
62857
-
62858
- const lte = (a, b, loose) => compare_1(a, b, loose) <= 0;
62859
- var lte_1 = lte;
62860
-
62861
- const cmp = (a, op, b, loose) => {
62862
- switch (op) {
62863
- case '===':
62864
- if (typeof a === 'object')
62865
- a = a.version;
62866
- if (typeof b === 'object')
62867
- b = b.version;
62868
- return a === b
62869
-
62870
- case '!==':
62871
- if (typeof a === 'object')
62872
- a = a.version;
62873
- if (typeof b === 'object')
62874
- b = b.version;
62875
- return a !== b
62876
-
62877
- case '':
62878
- case '=':
62879
- case '==':
62880
- return eq_1(a, b, loose)
62881
-
62882
- case '!=':
62883
- return neq_1(a, b, loose)
62884
-
62885
- case '>':
62886
- return gt_1(a, b, loose)
62887
-
62888
- case '>=':
62889
- return gte_1(a, b, loose)
62890
-
62891
- case '<':
62892
- return lt_1(a, b, loose)
62893
-
62894
- case '<=':
62895
- return lte_1(a, b, loose)
62896
-
62897
- default:
62898
- throw new TypeError(`Invalid operator: ${op}`)
62899
- }
62900
- };
62901
- var cmp_1 = cmp;
62902
-
62903
- const {re: re$4, t: t$4} = re_1;
62904
-
62905
- const coerce = (version, options) => {
62906
- if (version instanceof semver) {
62907
- return version
62908
- }
62909
-
62910
- if (typeof version === 'number') {
62911
- version = String(version);
62912
- }
62913
-
62914
- if (typeof version !== 'string') {
62915
- return null
62916
- }
62917
-
62918
- options = options || {};
62919
-
62920
- let match = null;
62921
- if (!options.rtl) {
62922
- match = version.match(re$4[t$4.COERCE]);
62923
- } else {
62924
- // Find the right-most coercible string that does not share
62925
- // a terminus with a more left-ward coercible string.
62926
- // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
62927
- //
62928
- // Walk through the string checking with a /g regexp
62929
- // Manually set the index so as to pick up overlapping matches.
62930
- // Stop when we get a match that ends at the string end, since no
62931
- // coercible string can be more right-ward without the same terminus.
62932
- let next;
62933
- while ((next = re$4[t$4.COERCERTL].exec(version)) &&
62934
- (!match || match.index + match[0].length !== version.length)
62935
- ) {
62936
- if (!match ||
62937
- next.index + next[0].length !== match.index + match[0].length) {
62938
- match = next;
62939
- }
62940
- re$4[t$4.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
62941
- }
62942
- // leave it in a clean state
62943
- re$4[t$4.COERCERTL].lastIndex = -1;
62944
- }
62945
-
62946
- if (match === null)
62947
- return null
62948
-
62949
- return parse_1(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
62950
- };
62951
- var coerce_1 = coerce;
62747
+ /**
62748
+ * @param {(string|(number|string)[])[]} paths
62749
+ *
62750
+ * @returns {(number|string)[]}
62751
+ */
62752
+ var pathConcat = function(...paths) {
62753
+ let concatenatedPaths = [];
62952
62754
 
62953
- var iterator = function (Yallist) {
62954
- Yallist.prototype[Symbol.iterator] = function* () {
62955
- for (let walker = this.head; walker; walker = walker.next) {
62956
- yield walker.value;
62755
+ for (let path of paths) {
62756
+ if (isNil$1(path) || isUndefined$2(path)) {
62757
+ return null;
62957
62758
  }
62958
- };
62959
- };
62960
-
62961
- var yallist = Yallist;
62962
-
62963
- Yallist.Node = Node$1;
62964
- Yallist.create = Yallist;
62965
-
62966
- function Yallist (list) {
62967
- var self = this;
62968
- if (!(self instanceof Yallist)) {
62969
- self = new Yallist();
62970
- }
62971
-
62972
- self.tail = null;
62973
- self.head = null;
62974
- self.length = 0;
62975
62759
 
62976
- if (list && typeof list.forEach === 'function') {
62977
- list.forEach(function (item) {
62978
- self.push(item);
62979
- });
62980
- } else if (arguments.length > 0) {
62981
- for (var i = 0, l = arguments.length; i < l; i++) {
62982
- self.push(arguments[i]);
62760
+ if (isString$1(path)) {
62761
+ path = [ path ];
62983
62762
  }
62984
- }
62985
-
62986
- return self
62987
- }
62988
-
62989
- Yallist.prototype.removeNode = function (node) {
62990
- if (node.list !== this) {
62991
- throw new Error('removing node which does not belong to this list')
62992
- }
62993
-
62994
- var next = node.next;
62995
- var prev = node.prev;
62996
-
62997
- if (next) {
62998
- next.prev = prev;
62999
- }
63000
-
63001
- if (prev) {
63002
- prev.next = next;
63003
- }
63004
-
63005
- if (node === this.head) {
63006
- this.head = next;
63007
- }
63008
- if (node === this.tail) {
63009
- this.tail = prev;
63010
- }
63011
-
63012
- node.list.length--;
63013
- node.next = null;
63014
- node.prev = null;
63015
- node.list = null;
63016
-
63017
- return next
63018
- };
63019
-
63020
- Yallist.prototype.unshiftNode = function (node) {
63021
- if (node === this.head) {
63022
- return
63023
- }
63024
-
63025
- if (node.list) {
63026
- node.list.removeNode(node);
63027
- }
63028
-
63029
- var head = this.head;
63030
- node.list = this;
63031
- node.next = head;
63032
- if (head) {
63033
- head.prev = node;
63034
- }
63035
-
63036
- this.head = node;
63037
- if (!this.tail) {
63038
- this.tail = node;
63039
- }
63040
- this.length++;
63041
- };
63042
-
63043
- Yallist.prototype.pushNode = function (node) {
63044
- if (node === this.tail) {
63045
- return
63046
- }
63047
-
63048
- if (node.list) {
63049
- node.list.removeNode(node);
63050
- }
63051
-
63052
- var tail = this.tail;
63053
- node.list = this;
63054
- node.prev = tail;
63055
- if (tail) {
63056
- tail.next = node;
63057
- }
63058
-
63059
- this.tail = node;
63060
- if (!this.head) {
63061
- this.head = node;
63062
- }
63063
- this.length++;
63064
- };
63065
-
63066
- Yallist.prototype.push = function () {
63067
- for (var i = 0, l = arguments.length; i < l; i++) {
63068
- push(this, arguments[i]);
63069
- }
63070
- return this.length
63071
- };
63072
-
63073
- Yallist.prototype.unshift = function () {
63074
- for (var i = 0, l = arguments.length; i < l; i++) {
63075
- unshift(this, arguments[i]);
63076
- }
63077
- return this.length
63078
- };
63079
-
63080
- Yallist.prototype.pop = function () {
63081
- if (!this.tail) {
63082
- return undefined
63083
- }
63084
62763
 
63085
- var res = this.tail.value;
63086
- this.tail = this.tail.prev;
63087
- if (this.tail) {
63088
- this.tail.next = null;
63089
- } else {
63090
- this.head = null;
63091
- }
63092
- this.length--;
63093
- return res
63094
- };
63095
-
63096
- Yallist.prototype.shift = function () {
63097
- if (!this.head) {
63098
- return undefined
63099
- }
63100
-
63101
- var res = this.head.value;
63102
- this.head = this.head.next;
63103
- if (this.head) {
63104
- this.head.prev = null;
63105
- } else {
63106
- this.tail = null;
63107
- }
63108
- this.length--;
63109
- return res
63110
- };
63111
-
63112
- Yallist.prototype.forEach = function (fn, thisp) {
63113
- thisp = thisp || this;
63114
- for (var walker = this.head, i = 0; walker !== null; i++) {
63115
- fn.call(thisp, walker.value, i, this);
63116
- walker = walker.next;
63117
- }
63118
- };
63119
-
63120
- Yallist.prototype.forEachReverse = function (fn, thisp) {
63121
- thisp = thisp || this;
63122
- for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
63123
- fn.call(thisp, walker.value, i, this);
63124
- walker = walker.prev;
63125
- }
63126
- };
63127
-
63128
- Yallist.prototype.get = function (n) {
63129
- for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
63130
- // abort out of the list early if we hit a cycle
63131
- walker = walker.next;
63132
- }
63133
- if (i === n && walker !== null) {
63134
- return walker.value
63135
- }
63136
- };
63137
-
63138
- Yallist.prototype.getReverse = function (n) {
63139
- for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
63140
- // abort out of the list early if we hit a cycle
63141
- walker = walker.prev;
63142
- }
63143
- if (i === n && walker !== null) {
63144
- return walker.value
62764
+ concatenatedPaths = concatenatedPaths.concat(path);
63145
62765
  }
63146
- };
63147
62766
 
63148
- Yallist.prototype.map = function (fn, thisp) {
63149
- thisp = thisp || this;
63150
- var res = new Yallist();
63151
- for (var walker = this.head; walker !== null;) {
63152
- res.push(fn.call(thisp, walker.value, this));
63153
- walker = walker.next;
63154
- }
63155
- return res
62767
+ return concatenatedPaths;
63156
62768
  };
63157
62769
 
63158
- Yallist.prototype.mapReverse = function (fn, thisp) {
63159
- thisp = thisp || this;
63160
- var res = new Yallist();
63161
- for (var walker = this.tail; walker !== null;) {
63162
- res.push(fn.call(thisp, walker.value, this));
63163
- walker = walker.prev;
63164
- }
63165
- return res
63166
- };
63167
-
63168
- Yallist.prototype.reduce = function (fn, initial) {
63169
- var acc;
63170
- var walker = this.head;
63171
- if (arguments.length > 1) {
63172
- acc = initial;
63173
- } else if (this.head) {
63174
- walker = this.head.next;
63175
- acc = this.head.value;
63176
- } else {
63177
- throw new TypeError('Reduce of empty list with no initial value')
63178
- }
63179
-
63180
- for (var i = 0; walker !== null; i++) {
63181
- acc = fn(acc, walker.value, i);
63182
- walker = walker.next;
63183
- }
63184
-
63185
- return acc
63186
- };
63187
-
63188
- Yallist.prototype.reduceReverse = function (fn, initial) {
63189
- var acc;
63190
- var walker = this.tail;
63191
- if (arguments.length > 1) {
63192
- acc = initial;
63193
- } else if (this.tail) {
63194
- walker = this.tail.prev;
63195
- acc = this.tail.value;
63196
- } else {
63197
- throw new TypeError('Reduce of empty list with no initial value')
63198
- }
63199
-
63200
- for (var i = this.length - 1; walker !== null; i--) {
63201
- acc = fn(acc, walker.value, i);
63202
- walker = walker.prev;
63203
- }
63204
-
63205
- return acc
63206
- };
63207
-
63208
- Yallist.prototype.toArray = function () {
63209
- var arr = new Array(this.length);
63210
- for (var i = 0, walker = this.head; walker !== null; i++) {
63211
- arr[i] = walker.value;
63212
- walker = walker.next;
63213
- }
63214
- return arr
63215
- };
63216
-
63217
- Yallist.prototype.toArrayReverse = function () {
63218
- var arr = new Array(this.length);
63219
- for (var i = 0, walker = this.tail; walker !== null; i++) {
63220
- arr[i] = walker.value;
63221
- walker = walker.prev;
63222
- }
63223
- return arr
63224
- };
63225
-
63226
- Yallist.prototype.slice = function (from, to) {
63227
- to = to || this.length;
63228
- if (to < 0) {
63229
- to += this.length;
63230
- }
63231
- from = from || 0;
63232
- if (from < 0) {
63233
- from += this.length;
63234
- }
63235
- var ret = new Yallist();
63236
- if (to < from || to < 0) {
63237
- return ret
63238
- }
63239
- if (from < 0) {
63240
- from = 0;
63241
- }
63242
- if (to > this.length) {
63243
- to = this.length;
63244
- }
63245
- for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
63246
- walker = walker.next;
63247
- }
63248
- for (; walker !== null && i < to; i++, walker = walker.next) {
63249
- ret.push(walker.value);
63250
- }
63251
- return ret
63252
- };
63253
-
63254
- Yallist.prototype.sliceReverse = function (from, to) {
63255
- to = to || this.length;
63256
- if (to < 0) {
63257
- to += this.length;
63258
- }
63259
- from = from || 0;
63260
- if (from < 0) {
63261
- from += this.length;
63262
- }
63263
- var ret = new Yallist();
63264
- if (to < from || to < 0) {
63265
- return ret
63266
- }
63267
- if (from < 0) {
63268
- from = 0;
63269
- }
63270
- if (to > this.length) {
63271
- to = this.length;
63272
- }
63273
- for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
63274
- walker = walker.prev;
63275
- }
63276
- for (; walker !== null && i > from; i--, walker = walker.prev) {
63277
- ret.push(walker.value);
63278
- }
63279
- return ret
63280
- };
63281
-
63282
- Yallist.prototype.splice = function (start, deleteCount, ...nodes) {
63283
- if (start > this.length) {
63284
- start = this.length - 1;
63285
- }
63286
- if (start < 0) {
63287
- start = this.length + start;
63288
- }
63289
-
63290
- for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
63291
- walker = walker.next;
63292
- }
63293
-
63294
- var ret = [];
63295
- for (var i = 0; walker && i < deleteCount; i++) {
63296
- ret.push(walker.value);
63297
- walker = this.removeNode(walker);
63298
- }
63299
- if (walker === null) {
63300
- walker = this.tail;
62770
+ /**
62771
+ * @param {string|(number|string)[]} a
62772
+ * @param {string|(number|string)[]} b
62773
+ * @param {string} [separator]
62774
+ *
62775
+ * @returns {boolean}
62776
+ */
62777
+ var pathEquals = function(a, b, separator = '.') {
62778
+ if (isNil$1(a) || isUndefined$2(a) || isNil$1(b) || isUndefined$2(b)) {
62779
+ return false;
63301
62780
  }
63302
62781
 
63303
- if (walker !== this.head && walker !== this.tail) {
63304
- walker = walker.prev;
62782
+ if (!isString$1(a)) {
62783
+ a = pathStringify(a, separator);
63305
62784
  }
63306
62785
 
63307
- for (var i = 0; i < nodes.length; i++) {
63308
- walker = insert(this, walker, nodes[i]);
62786
+ if (!isString$1(b)) {
62787
+ b = pathStringify(b, separator);
63309
62788
  }
63310
- return ret;
63311
- };
63312
62789
 
63313
- Yallist.prototype.reverse = function () {
63314
- var head = this.head;
63315
- var tail = this.tail;
63316
- for (var walker = head; walker !== null; walker = walker.prev) {
63317
- var p = walker.prev;
63318
- walker.prev = walker.next;
63319
- walker.next = p;
63320
- }
63321
- this.head = tail;
63322
- this.tail = head;
63323
- return this
62790
+ return a === b;
63324
62791
  };
63325
62792
 
63326
- function insert (self, node, value) {
63327
- var inserted = node === self.head ?
63328
- new Node$1(value, null, node, self) :
63329
- new Node$1(value, node, node.next, self);
63330
-
63331
- if (inserted.next === null) {
63332
- self.tail = inserted;
63333
- }
63334
- if (inserted.prev === null) {
63335
- self.head = inserted;
63336
- }
63337
-
63338
- self.length++;
63339
-
63340
- return inserted
63341
- }
63342
-
63343
- function push (self, item) {
63344
- self.tail = new Node$1(item, self.tail, null, self);
63345
- if (!self.head) {
63346
- self.head = self.tail;
63347
- }
63348
- self.length++;
63349
- }
63350
-
63351
- function unshift (self, item) {
63352
- self.head = new Node$1(item, null, self.head, self);
63353
- if (!self.tail) {
63354
- self.tail = self.head;
63355
- }
63356
- self.length++;
63357
- }
63358
-
63359
- function Node$1 (value, prev, next, list) {
63360
- if (!(this instanceof Node$1)) {
63361
- return new Node$1(value, prev, next, list)
63362
- }
63363
-
63364
- this.list = list;
63365
- this.value = value;
63366
-
63367
- if (prev) {
63368
- prev.next = this;
63369
- this.prev = prev;
63370
- } else {
63371
- this.prev = null;
62793
+ /**
62794
+ * @param {(number|string)[]} path
62795
+ * @param {string} [separator]
62796
+ *
62797
+ * @returns {string}
62798
+ */
62799
+ function pathStringify(path, separator = '.') {
62800
+ if (isNil$1(path) || isUndefined$2(path)) {
62801
+ return null;
63372
62802
  }
63373
62803
 
63374
- if (next) {
63375
- next.prev = this;
63376
- this.next = next;
63377
- } else {
63378
- this.next = null;
63379
- }
62804
+ return path.join(separator);
63380
62805
  }
63381
62806
 
63382
- try {
63383
- // add if support for Symbol.iterator is present
63384
- iterator(Yallist);
63385
- } catch (er) {}
63386
-
63387
- // A linked list to keep track of recently-used-ness
63388
-
63389
-
63390
- const MAX = Symbol('max');
63391
- const LENGTH = Symbol('length');
63392
- const LENGTH_CALCULATOR = Symbol('lengthCalculator');
63393
- const ALLOW_STALE = Symbol('allowStale');
63394
- const MAX_AGE = Symbol('maxAge');
63395
- const DISPOSE = Symbol('dispose');
63396
- const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
63397
- const LRU_LIST = Symbol('lruList');
63398
- const CACHE = Symbol('cache');
63399
- const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
63400
-
63401
- const naiveLength = () => 1;
63402
-
63403
- // lruList is a yallist where the head is the youngest
63404
- // item, and the tail is the oldest. the list contains the Hit
63405
- // objects as the entries.
63406
- // Each Hit object has a reference to its Yallist.Node. This
63407
- // never changes.
63408
- //
63409
- // cache is a Map (or PseudoMap) that matches the keys to
63410
- // the Yallist.Node object.
63411
- class LRUCache {
63412
- constructor (options) {
63413
- if (typeof options === 'number')
63414
- options = { max: options };
63415
-
63416
- if (!options)
63417
- options = {};
63418
-
63419
- if (options.max && (typeof options.max !== 'number' || options.max < 0))
63420
- throw new TypeError('max must be a non-negative number')
63421
- // Kind of weird to have a default max of Infinity, but oh well.
63422
- this[MAX] = options.max || Infinity;
63423
-
63424
- const lc = options.length || naiveLength;
63425
- this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc;
63426
- this[ALLOW_STALE] = options.stale || false;
63427
- if (options.maxAge && typeof options.maxAge !== 'number')
63428
- throw new TypeError('maxAge must be a number')
63429
- this[MAX_AGE] = options.maxAge || 0;
63430
- this[DISPOSE] = options.dispose;
63431
- this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
63432
- this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
63433
- this.reset();
63434
- }
63435
-
63436
- // resize the cache when the max changes.
63437
- set max (mL) {
63438
- if (typeof mL !== 'number' || mL < 0)
63439
- throw new TypeError('max must be a non-negative number')
63440
-
63441
- this[MAX] = mL || Infinity;
63442
- trim(this);
63443
- }
63444
- get max () {
63445
- return this[MAX]
63446
- }
63447
-
63448
- set allowStale (allowStale) {
63449
- this[ALLOW_STALE] = !!allowStale;
63450
- }
63451
- get allowStale () {
63452
- return this[ALLOW_STALE]
63453
- }
63454
-
63455
- set maxAge (mA) {
63456
- if (typeof mA !== 'number')
63457
- throw new TypeError('maxAge must be a non-negative number')
63458
-
63459
- this[MAX_AGE] = mA;
63460
- trim(this);
63461
- }
63462
- get maxAge () {
63463
- return this[MAX_AGE]
63464
- }
63465
-
63466
- // resize the cache when the lengthCalculator changes.
63467
- set lengthCalculator (lC) {
63468
- if (typeof lC !== 'function')
63469
- lC = naiveLength;
63470
-
63471
- if (lC !== this[LENGTH_CALCULATOR]) {
63472
- this[LENGTH_CALCULATOR] = lC;
63473
- this[LENGTH] = 0;
63474
- this[LRU_LIST].forEach(hit => {
63475
- hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
63476
- this[LENGTH] += hit.length;
63477
- });
63478
- }
63479
- trim(this);
63480
- }
63481
- get lengthCalculator () { return this[LENGTH_CALCULATOR] }
63482
-
63483
- get length () { return this[LENGTH] }
63484
- get itemCount () { return this[LRU_LIST].length }
63485
-
63486
- rforEach (fn, thisp) {
63487
- thisp = thisp || this;
63488
- for (let walker = this[LRU_LIST].tail; walker !== null;) {
63489
- const prev = walker.prev;
63490
- forEachStep(this, fn, walker, thisp);
63491
- walker = prev;
63492
- }
63493
- }
63494
-
63495
- forEach (fn, thisp) {
63496
- thisp = thisp || this;
63497
- for (let walker = this[LRU_LIST].head; walker !== null;) {
63498
- const next = walker.next;
63499
- forEachStep(this, fn, walker, thisp);
63500
- walker = next;
63501
- }
63502
- }
63503
-
63504
- keys () {
63505
- return this[LRU_LIST].toArray().map(k => k.key)
63506
- }
63507
-
63508
- values () {
63509
- return this[LRU_LIST].toArray().map(k => k.value)
63510
- }
63511
-
63512
- reset () {
63513
- if (this[DISPOSE] &&
63514
- this[LRU_LIST] &&
63515
- this[LRU_LIST].length) {
63516
- this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
63517
- }
63518
-
63519
- this[CACHE] = new Map(); // hash of items by key
63520
- this[LRU_LIST] = new yallist(); // list of items in order of use recency
63521
- this[LENGTH] = 0; // length of items in the list
63522
- }
63523
-
63524
- dump () {
63525
- return this[LRU_LIST].map(hit =>
63526
- isStale(this, hit) ? false : {
63527
- k: hit.key,
63528
- v: hit.value,
63529
- e: hit.now + (hit.maxAge || 0)
63530
- }).toArray().filter(h => h)
63531
- }
63532
-
63533
- dumpLru () {
63534
- return this[LRU_LIST]
63535
- }
63536
-
63537
- set (key, value, maxAge) {
63538
- maxAge = maxAge || this[MAX_AGE];
63539
-
63540
- if (maxAge && typeof maxAge !== 'number')
63541
- throw new TypeError('maxAge must be a number')
63542
-
63543
- const now = maxAge ? Date.now() : 0;
63544
- const len = this[LENGTH_CALCULATOR](value, key);
63545
-
63546
- if (this[CACHE].has(key)) {
63547
- if (len > this[MAX]) {
63548
- del(this, this[CACHE].get(key));
63549
- return false
63550
- }
63551
-
63552
- const node = this[CACHE].get(key);
63553
- const item = node.value;
63554
-
63555
- // dispose of the old one before overwriting
63556
- // split out into 2 ifs for better coverage tracking
63557
- if (this[DISPOSE]) {
63558
- if (!this[NO_DISPOSE_ON_SET])
63559
- this[DISPOSE](key, item.value);
63560
- }
63561
-
63562
- item.now = now;
63563
- item.maxAge = maxAge;
63564
- item.value = value;
63565
- this[LENGTH] += len - item.length;
63566
- item.length = len;
63567
- this.get(key);
63568
- trim(this);
63569
- return true
63570
- }
63571
-
63572
- const hit = new Entry(key, value, len, now, maxAge);
63573
-
63574
- // oversized objects fall out of cache automatically.
63575
- if (hit.length > this[MAX]) {
63576
- if (this[DISPOSE])
63577
- this[DISPOSE](key, value);
63578
-
63579
- return false
63580
- }
63581
-
63582
- this[LENGTH] += hit.length;
63583
- this[LRU_LIST].unshift(hit);
63584
- this[CACHE].set(key, this[LRU_LIST].head);
63585
- trim(this);
63586
- return true
63587
- }
63588
-
63589
- has (key) {
63590
- if (!this[CACHE].has(key)) return false
63591
- const hit = this[CACHE].get(key).value;
63592
- return !isStale(this, hit)
63593
- }
63594
-
63595
- get (key) {
63596
- return get$3(this, key, true)
63597
- }
63598
-
63599
- peek (key) {
63600
- return get$3(this, key, false)
63601
- }
62807
+ /**
62808
+ * Failsafe remove an element from a collection
62809
+ *
62810
+ * @param {Array<Object>} [collection]
62811
+ * @param {Object} [element]
62812
+ *
62813
+ * @return {number} the previous index of the element
62814
+ */
63602
62815
 
63603
- pop () {
63604
- const node = this[LRU_LIST].tail;
63605
- if (!node)
63606
- return null
62816
+ /**
62817
+ * Fail save add an element to the given connection, ensuring
62818
+ * it does not yet exist.
62819
+ *
62820
+ * @param {Array<Object>} collection
62821
+ * @param {Object} element
62822
+ * @param {number} idx
62823
+ */
62824
+ function add$2(collection, element, idx) {
63607
62825
 
63608
- del(this, node);
63609
- return node.value
62826
+ if (!collection || !element) {
62827
+ return;
63610
62828
  }
63611
62829
 
63612
- del (key) {
63613
- del(this, this[CACHE].get(key));
62830
+ if (typeof idx !== 'number') {
62831
+ idx = -1;
63614
62832
  }
63615
62833
 
63616
- load (arr) {
63617
- // reset the cache
63618
- this.reset();
62834
+ var currentIdx = collection.indexOf(element);
63619
62835
 
63620
- const now = Date.now();
63621
- // A previous serialized cache has the most recent items first
63622
- for (let l = arr.length - 1; l >= 0; l--) {
63623
- const hit = arr[l];
63624
- const expiresAt = hit.e || 0;
63625
- if (expiresAt === 0)
63626
- // the item was created without expiration in a non aged cache
63627
- this.set(hit.k, hit.v);
63628
- else {
63629
- const maxAge = expiresAt - now;
63630
- // dont add already expired items
63631
- if (maxAge > 0) {
63632
- this.set(hit.k, hit.v, maxAge);
63633
- }
63634
- }
63635
- }
63636
- }
62836
+ if (currentIdx !== -1) {
63637
62837
 
63638
- prune () {
63639
- this[CACHE].forEach((value, key) => get$3(this, key, false));
63640
- }
63641
- }
62838
+ if (currentIdx === idx) {
63642
62839
 
63643
- const get$3 = (self, key, doUse) => {
63644
- const node = self[CACHE].get(key);
63645
- if (node) {
63646
- const hit = node.value;
63647
- if (isStale(self, hit)) {
63648
- del(self, node);
63649
- if (!self[ALLOW_STALE])
63650
- return undefined
62840
+ // nothing to do, position has not changed
62841
+ return;
63651
62842
  } else {
63652
- if (doUse) {
63653
- if (self[UPDATE_AGE_ON_GET])
63654
- node.value.now = Date.now();
63655
- self[LRU_LIST].unshiftNode(node);
63656
- }
63657
- }
63658
- return hit.value
63659
- }
63660
- };
63661
-
63662
- const isStale = (self, hit) => {
63663
- if (!hit || (!hit.maxAge && !self[MAX_AGE]))
63664
- return false
63665
-
63666
- const diff = Date.now() - hit.now;
63667
- return hit.maxAge ? diff > hit.maxAge
63668
- : self[MAX_AGE] && (diff > self[MAX_AGE])
63669
- };
63670
-
63671
- const trim = self => {
63672
- if (self[LENGTH] > self[MAX]) {
63673
- for (let walker = self[LRU_LIST].tail;
63674
- self[LENGTH] > self[MAX] && walker !== null;) {
63675
- // We know that we're about to delete this one, and also
63676
- // what the next least recently used key will be, so just
63677
- // go ahead and set it now.
63678
- const prev = walker.prev;
63679
- del(self, walker);
63680
- walker = prev;
63681
- }
63682
- }
63683
- };
63684
-
63685
- const del = (self, node) => {
63686
- if (node) {
63687
- const hit = node.value;
63688
- if (self[DISPOSE])
63689
- self[DISPOSE](hit.key, hit.value);
63690
-
63691
- self[LENGTH] -= hit.length;
63692
- self[CACHE].delete(hit.key);
63693
- self[LRU_LIST].removeNode(node);
63694
- }
63695
- };
63696
-
63697
- class Entry {
63698
- constructor (key, value, length, now, maxAge) {
63699
- this.key = key;
63700
- this.value = value;
63701
- this.length = length;
63702
- this.now = now;
63703
- this.maxAge = maxAge || 0;
63704
- }
63705
- }
63706
-
63707
- const forEachStep = (self, fn, node, thisp) => {
63708
- let hit = node.value;
63709
- if (isStale(self, hit)) {
63710
- del(self, node);
63711
- if (!self[ALLOW_STALE])
63712
- hit = undefined;
63713
- }
63714
- if (hit)
63715
- fn.call(thisp, hit.value, hit.key, self);
63716
- };
63717
-
63718
- var lruCache = LRUCache;
63719
62843
 
63720
- // hoisted class for cyclic dependency
63721
- class Range {
63722
- constructor (range, options) {
63723
- options = parseOptions_1(options);
62844
+ if (idx !== -1) {
63724
62845
 
63725
- if (range instanceof Range) {
63726
- if (
63727
- range.loose === !!options.loose &&
63728
- range.includePrerelease === !!options.includePrerelease
63729
- ) {
63730
- return range
62846
+ // remove from current position
62847
+ collection.splice(currentIdx, 1);
63731
62848
  } else {
63732
- return new Range(range.raw, options)
63733
- }
63734
- }
63735
-
63736
- if (range instanceof comparator) {
63737
- // just put it in the set and return
63738
- this.raw = range.value;
63739
- this.set = [[range]];
63740
- this.format();
63741
- return this
63742
- }
63743
-
63744
- this.options = options;
63745
- this.loose = !!options.loose;
63746
- this.includePrerelease = !!options.includePrerelease;
63747
-
63748
- // First, split based on boolean or ||
63749
- this.raw = range;
63750
- this.set = range
63751
- .split(/\s*\|\|\s*/)
63752
- // map the range to a 2d array of comparators
63753
- .map(range => this.parseRange(range.trim()))
63754
- // throw out any comparator lists that are empty
63755
- // this generally means that it was not a valid range, which is allowed
63756
- // in loose mode, but will still throw if the WHOLE range is invalid.
63757
- .filter(c => c.length);
63758
-
63759
- if (!this.set.length) {
63760
- throw new TypeError(`Invalid SemVer Range: ${range}`)
63761
- }
63762
-
63763
- // if we have any that are not the null set, throw out null sets.
63764
- if (this.set.length > 1) {
63765
- // keep the first one, in case they're all null sets
63766
- const first = this.set[0];
63767
- this.set = this.set.filter(c => !isNullSet(c[0]));
63768
- if (this.set.length === 0)
63769
- this.set = [first];
63770
- else if (this.set.length > 1) {
63771
- // if we have any that are *, then the range is just *
63772
- for (const c of this.set) {
63773
- if (c.length === 1 && isAny$1(c[0])) {
63774
- this.set = [c];
63775
- break
63776
- }
63777
- }
63778
- }
63779
- }
63780
-
63781
- this.format();
63782
- }
63783
62849
 
63784
- format () {
63785
- this.range = this.set
63786
- .map((comps) => {
63787
- return comps.join(' ').trim()
63788
- })
63789
- .join('||')
63790
- .trim();
63791
- return this.range
63792
- }
63793
-
63794
- toString () {
63795
- return this.range
63796
- }
63797
-
63798
- parseRange (range) {
63799
- range = range.trim();
63800
-
63801
- // memoize range parsing for performance.
63802
- // this is a very hot path, and fully deterministic.
63803
- const memoOpts = Object.keys(this.options).join(',');
63804
- const memoKey = `parseRange:${memoOpts}:${range}`;
63805
- const cached = cache.get(memoKey);
63806
- if (cached)
63807
- return cached
63808
-
63809
- const loose = this.options.loose;
63810
- // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
63811
- const hr = loose ? re$5[t$5.HYPHENRANGELOOSE] : re$5[t$5.HYPHENRANGE];
63812
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
63813
- debug_1('hyphen replace', range);
63814
- // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
63815
- range = range.replace(re$5[t$5.COMPARATORTRIM], comparatorTrimReplace);
63816
- debug_1('comparator trim', range, re$5[t$5.COMPARATORTRIM]);
63817
-
63818
- // `~ 1.2.3` => `~1.2.3`
63819
- range = range.replace(re$5[t$5.TILDETRIM], tildeTrimReplace);
63820
-
63821
- // `^ 1.2.3` => `^1.2.3`
63822
- range = range.replace(re$5[t$5.CARETTRIM], caretTrimReplace);
63823
-
63824
- // normalize spaces
63825
- range = range.split(/\s+/).join(' ');
63826
-
63827
- // At this point, the range is completely trimmed and
63828
- // ready to be split into comparators.
63829
-
63830
- const compRe = loose ? re$5[t$5.COMPARATORLOOSE] : re$5[t$5.COMPARATOR];
63831
- const rangeList = range
63832
- .split(' ')
63833
- .map(comp => parseComparator(comp, this.options))
63834
- .join(' ')
63835
- .split(/\s+/)
63836
- // >=0.0.0 is equivalent to *
63837
- .map(comp => replaceGTE0(comp, this.options))
63838
- // in loose mode, throw out any that are not valid comparators
63839
- .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
63840
- .map(comp => new comparator(comp, this.options));
63841
-
63842
- // if any comparators are the null set, then replace with JUST null set
63843
- // if more than one comparator, remove any * comparators
63844
- // also, don't include the same comparator more than once
63845
- rangeList.length;
63846
- const rangeMap = new Map();
63847
- for (const comp of rangeList) {
63848
- if (isNullSet(comp))
63849
- return [comp]
63850
- rangeMap.set(comp.value, comp);
63851
- }
63852
- if (rangeMap.size > 1 && rangeMap.has(''))
63853
- rangeMap.delete('');
63854
-
63855
- const result = [...rangeMap.values()];
63856
- cache.set(memoKey, result);
63857
- return result
63858
- }
63859
-
63860
- intersects (range, options) {
63861
- if (!(range instanceof Range)) {
63862
- throw new TypeError('a Range is required')
63863
- }
63864
-
63865
- return this.set.some((thisComparators) => {
63866
- return (
63867
- isSatisfiable(thisComparators, options) &&
63868
- range.set.some((rangeComparators) => {
63869
- return (
63870
- isSatisfiable(rangeComparators, options) &&
63871
- thisComparators.every((thisComparator) => {
63872
- return rangeComparators.every((rangeComparator) => {
63873
- return thisComparator.intersects(rangeComparator, options)
63874
- })
63875
- })
63876
- )
63877
- })
63878
- )
63879
- })
63880
- }
63881
-
63882
- // if ANY of the sets match ALL of its comparators, then pass
63883
- test (version) {
63884
- if (!version) {
63885
- return false
63886
- }
63887
-
63888
- if (typeof version === 'string') {
63889
- try {
63890
- version = new semver(version, this.options);
63891
- } catch (er) {
63892
- return false
63893
- }
63894
- }
63895
-
63896
- for (let i = 0; i < this.set.length; i++) {
63897
- if (testSet(this.set[i], version, this.options)) {
63898
- return true
62850
+ // already exists in collection
62851
+ return;
63899
62852
  }
63900
62853
  }
63901
- return false
63902
62854
  }
63903
- }
63904
- var range = Range;
63905
-
63906
-
63907
- const cache = new lruCache({ max: 1000 });
63908
-
63909
-
63910
-
63911
-
63912
-
63913
- const {
63914
- re: re$5,
63915
- t: t$5,
63916
- comparatorTrimReplace,
63917
- tildeTrimReplace,
63918
- caretTrimReplace
63919
- } = re_1;
63920
-
63921
- const isNullSet = c => c.value === '<0.0.0-0';
63922
- const isAny$1 = c => c.value === '';
63923
-
63924
- // take a set of comparators and determine whether there
63925
- // exists a version which can satisfy it
63926
- const isSatisfiable = (comparators, options) => {
63927
- let result = true;
63928
- const remainingComparators = comparators.slice();
63929
- let testComparator = remainingComparators.pop();
63930
-
63931
- while (result && remainingComparators.length) {
63932
- result = remainingComparators.every((otherComparator) => {
63933
- return testComparator.intersects(otherComparator, options)
63934
- });
63935
-
63936
- testComparator = remainingComparators.pop();
63937
- }
63938
-
63939
- return result
63940
- };
63941
-
63942
- // comprised of xranges, tildes, stars, and gtlt's at this point.
63943
- // already replaced the hyphen ranges
63944
- // turn into a set of JUST comparators.
63945
- const parseComparator = (comp, options) => {
63946
- debug_1('comp', comp, options);
63947
- comp = replaceCarets(comp, options);
63948
- debug_1('caret', comp);
63949
- comp = replaceTildes(comp, options);
63950
- debug_1('tildes', comp);
63951
- comp = replaceXRanges(comp, options);
63952
- debug_1('xrange', comp);
63953
- comp = replaceStars(comp, options);
63954
- debug_1('stars', comp);
63955
- return comp
63956
- };
63957
-
63958
- const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
63959
-
63960
- // ~, ~> --> * (any, kinda silly)
63961
- // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
63962
- // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
63963
- // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
63964
- // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
63965
- // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
63966
- const replaceTildes = (comp, options) =>
63967
- comp.trim().split(/\s+/).map((comp) => {
63968
- return replaceTilde(comp, options)
63969
- }).join(' ');
63970
-
63971
- const replaceTilde = (comp, options) => {
63972
- const r = options.loose ? re$5[t$5.TILDELOOSE] : re$5[t$5.TILDE];
63973
- return comp.replace(r, (_, M, m, p, pr) => {
63974
- debug_1('tilde', comp, _, M, m, p, pr);
63975
- let ret;
63976
-
63977
- if (isX(M)) {
63978
- ret = '';
63979
- } else if (isX(m)) {
63980
- ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
63981
- } else if (isX(p)) {
63982
- // ~1.2 == >=1.2.0 <1.3.0-0
63983
- ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
63984
- } else if (pr) {
63985
- debug_1('replaceTilde pr', pr);
63986
- ret = `>=${M}.${m}.${p}-${pr
63987
- } <${M}.${+m + 1}.0-0`;
63988
- } else {
63989
- // ~1.2.3 == >=1.2.3 <1.3.0-0
63990
- ret = `>=${M}.${m}.${p
63991
- } <${M}.${+m + 1}.0-0`;
63992
- }
63993
-
63994
- debug_1('tilde return', ret);
63995
- return ret
63996
- })
63997
- };
63998
-
63999
- // ^ --> * (any, kinda silly)
64000
- // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
64001
- // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
64002
- // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
64003
- // ^1.2.3 --> >=1.2.3 <2.0.0-0
64004
- // ^1.2.0 --> >=1.2.0 <2.0.0-0
64005
- const replaceCarets = (comp, options) =>
64006
- comp.trim().split(/\s+/).map((comp) => {
64007
- return replaceCaret(comp, options)
64008
- }).join(' ');
64009
-
64010
- const replaceCaret = (comp, options) => {
64011
- debug_1('caret', comp, options);
64012
- const r = options.loose ? re$5[t$5.CARETLOOSE] : re$5[t$5.CARET];
64013
- const z = options.includePrerelease ? '-0' : '';
64014
- return comp.replace(r, (_, M, m, p, pr) => {
64015
- debug_1('caret', comp, _, M, m, p, pr);
64016
- let ret;
64017
-
64018
- if (isX(M)) {
64019
- ret = '';
64020
- } else if (isX(m)) {
64021
- ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
64022
- } else if (isX(p)) {
64023
- if (M === '0') {
64024
- ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
64025
- } else {
64026
- ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
64027
- }
64028
- } else if (pr) {
64029
- debug_1('replaceCaret pr', pr);
64030
- if (M === '0') {
64031
- if (m === '0') {
64032
- ret = `>=${M}.${m}.${p}-${pr
64033
- } <${M}.${m}.${+p + 1}-0`;
64034
- } else {
64035
- ret = `>=${M}.${m}.${p}-${pr
64036
- } <${M}.${+m + 1}.0-0`;
64037
- }
64038
- } else {
64039
- ret = `>=${M}.${m}.${p}-${pr
64040
- } <${+M + 1}.0.0-0`;
64041
- }
64042
- } else {
64043
- debug_1('no pr');
64044
- if (M === '0') {
64045
- if (m === '0') {
64046
- ret = `>=${M}.${m}.${p
64047
- }${z} <${M}.${m}.${+p + 1}-0`;
64048
- } else {
64049
- ret = `>=${M}.${m}.${p
64050
- }${z} <${M}.${+m + 1}.0-0`;
64051
- }
64052
- } else {
64053
- ret = `>=${M}.${m}.${p
64054
- } <${+M + 1}.0.0-0`;
64055
- }
64056
- }
64057
-
64058
- debug_1('caret return', ret);
64059
- return ret
64060
- })
64061
- };
64062
62855
 
64063
- const replaceXRanges = (comp, options) => {
64064
- debug_1('replaceXRanges', comp, options);
64065
- return comp.split(/\s+/).map((comp) => {
64066
- return replaceXRange(comp, options)
64067
- }).join(' ')
64068
- };
64069
-
64070
- const replaceXRange = (comp, options) => {
64071
- comp = comp.trim();
64072
- const r = options.loose ? re$5[t$5.XRANGELOOSE] : re$5[t$5.XRANGE];
64073
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
64074
- debug_1('xRange', comp, ret, gtlt, M, m, p, pr);
64075
- const xM = isX(M);
64076
- const xm = xM || isX(m);
64077
- const xp = xm || isX(p);
64078
- const anyX = xp;
64079
-
64080
- if (gtlt === '=' && anyX) {
64081
- gtlt = '';
64082
- }
64083
-
64084
- // if we're including prereleases in the match, then we need
64085
- // to fix this to -0, the lowest possible prerelease value
64086
- pr = options.includePrerelease ? '-0' : '';
64087
-
64088
- if (xM) {
64089
- if (gtlt === '>' || gtlt === '<') {
64090
- // nothing is allowed
64091
- ret = '<0.0.0-0';
64092
- } else {
64093
- // nothing is forbidden
64094
- ret = '*';
64095
- }
64096
- } else if (gtlt && anyX) {
64097
- // we know patch is an x, because we have any x at all.
64098
- // replace X with 0
64099
- if (xm) {
64100
- m = 0;
64101
- }
64102
- p = 0;
64103
-
64104
- if (gtlt === '>') {
64105
- // >1 => >=2.0.0
64106
- // >1.2 => >=1.3.0
64107
- gtlt = '>=';
64108
- if (xm) {
64109
- M = +M + 1;
64110
- m = 0;
64111
- p = 0;
64112
- } else {
64113
- m = +m + 1;
64114
- p = 0;
64115
- }
64116
- } else if (gtlt === '<=') {
64117
- // <=0.7.x is actually <0.8.0, since any 0.7.x should
64118
- // pass. Similarly, <=7.x is actually <8.0.0, etc.
64119
- gtlt = '<';
64120
- if (xm) {
64121
- M = +M + 1;
64122
- } else {
64123
- m = +m + 1;
64124
- }
64125
- }
62856
+ if (idx !== -1) {
64126
62857
 
64127
- if (gtlt === '<')
64128
- pr = '-0';
64129
-
64130
- ret = `${gtlt + M}.${m}.${p}${pr}`;
64131
- } else if (xm) {
64132
- ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
64133
- } else if (xp) {
64134
- ret = `>=${M}.${m}.0${pr
64135
- } <${M}.${+m + 1}.0-0`;
64136
- }
64137
-
64138
- debug_1('xRange return', ret);
64139
-
64140
- return ret
64141
- })
64142
- };
64143
-
64144
- // Because * is AND-ed with everything else in the comparator,
64145
- // and '' means "any version", just remove the *s entirely.
64146
- const replaceStars = (comp, options) => {
64147
- debug_1('replaceStars', comp, options);
64148
- // Looseness is ignored here. star is always as loose as it gets!
64149
- return comp.trim().replace(re$5[t$5.STAR], '')
64150
- };
64151
-
64152
- const replaceGTE0 = (comp, options) => {
64153
- debug_1('replaceGTE0', comp, options);
64154
- return comp.trim()
64155
- .replace(re$5[options.includePrerelease ? t$5.GTE0PRE : t$5.GTE0], '')
64156
- };
64157
-
64158
- // This function is passed to string.replace(re[t.HYPHENRANGE])
64159
- // M, m, patch, prerelease, build
64160
- // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
64161
- // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
64162
- // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
64163
- const hyphenReplace = incPr => ($0,
64164
- from, fM, fm, fp, fpr, fb,
64165
- to, tM, tm, tp, tpr, tb) => {
64166
- if (isX(fM)) {
64167
- from = '';
64168
- } else if (isX(fm)) {
64169
- from = `>=${fM}.0.0${incPr ? '-0' : ''}`;
64170
- } else if (isX(fp)) {
64171
- from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`;
64172
- } else if (fpr) {
64173
- from = `>=${from}`;
64174
- } else {
64175
- from = `>=${from}${incPr ? '-0' : ''}`;
64176
- }
64177
-
64178
- if (isX(tM)) {
64179
- to = '';
64180
- } else if (isX(tm)) {
64181
- to = `<${+tM + 1}.0.0-0`;
64182
- } else if (isX(tp)) {
64183
- to = `<${tM}.${+tm + 1}.0-0`;
64184
- } else if (tpr) {
64185
- to = `<=${tM}.${tm}.${tp}-${tpr}`;
64186
- } else if (incPr) {
64187
- to = `<${tM}.${tm}.${+tp + 1}-0`;
62858
+ // insert at specified position
62859
+ collection.splice(idx, 0, element);
64188
62860
  } else {
64189
- to = `<=${to}`;
64190
- }
64191
-
64192
- return (`${from} ${to}`).trim()
64193
- };
64194
-
64195
- const testSet = (set, version, options) => {
64196
- for (let i = 0; i < set.length; i++) {
64197
- if (!set[i].test(version)) {
64198
- return false
64199
- }
64200
- }
64201
-
64202
- if (version.prerelease.length && !options.includePrerelease) {
64203
- // Find the set of versions that are allowed to have prereleases
64204
- // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
64205
- // That should allow `1.2.3-pr.2` to pass.
64206
- // However, `1.2.4-alpha.notready` should NOT be allowed,
64207
- // even though it's within the range set by the comparators.
64208
- for (let i = 0; i < set.length; i++) {
64209
- debug_1(set[i].semver);
64210
- if (set[i].semver === comparator.ANY) {
64211
- continue
64212
- }
64213
-
64214
- if (set[i].semver.prerelease.length > 0) {
64215
- const allowed = set[i].semver;
64216
- if (allowed.major === version.major &&
64217
- allowed.minor === version.minor &&
64218
- allowed.patch === version.patch) {
64219
- return true
64220
- }
64221
- }
64222
- }
64223
-
64224
- // Version has a -pre, but it's not one of the ones we like.
64225
- return false
64226
- }
64227
-
64228
- return true
64229
- };
64230
-
64231
- const ANY = Symbol('SemVer ANY');
64232
- // hoisted class for cyclic dependency
64233
- class Comparator {
64234
- static get ANY () {
64235
- return ANY
64236
- }
64237
- constructor (comp, options) {
64238
- options = parseOptions_1(options);
64239
-
64240
- if (comp instanceof Comparator) {
64241
- if (comp.loose === !!options.loose) {
64242
- return comp
64243
- } else {
64244
- comp = comp.value;
64245
- }
64246
- }
64247
-
64248
- debug_1('comparator', comp, options);
64249
- this.options = options;
64250
- this.loose = !!options.loose;
64251
- this.parse(comp);
64252
-
64253
- if (this.semver === ANY) {
64254
- this.value = '';
64255
- } else {
64256
- this.value = this.operator + this.semver.version;
64257
- }
64258
-
64259
- debug_1('comp', this);
64260
- }
64261
-
64262
- parse (comp) {
64263
- const r = this.options.loose ? re$6[t$6.COMPARATORLOOSE] : re$6[t$6.COMPARATOR];
64264
- const m = comp.match(r);
64265
-
64266
- if (!m) {
64267
- throw new TypeError(`Invalid comparator: ${comp}`)
64268
- }
64269
62861
 
64270
- this.operator = m[1] !== undefined ? m[1] : '';
64271
- if (this.operator === '=') {
64272
- this.operator = '';
64273
- }
64274
-
64275
- // if it literally is just '>' or '' then allow anything.
64276
- if (!m[2]) {
64277
- this.semver = ANY;
64278
- } else {
64279
- this.semver = new semver(m[2], this.options.loose);
64280
- }
64281
- }
64282
-
64283
- toString () {
64284
- return this.value
64285
- }
64286
-
64287
- test (version) {
64288
- debug_1('Comparator.test', version, this.options.loose);
64289
-
64290
- if (this.semver === ANY || version === ANY) {
64291
- return true
64292
- }
64293
-
64294
- if (typeof version === 'string') {
64295
- try {
64296
- version = new semver(version, this.options);
64297
- } catch (er) {
64298
- return false
64299
- }
64300
- }
64301
-
64302
- return cmp_1(version, this.operator, this.semver, this.options)
64303
- }
64304
-
64305
- intersects (comp, options) {
64306
- if (!(comp instanceof Comparator)) {
64307
- throw new TypeError('a Comparator is required')
64308
- }
64309
-
64310
- if (!options || typeof options !== 'object') {
64311
- options = {
64312
- loose: !!options,
64313
- includePrerelease: false
64314
- };
64315
- }
64316
-
64317
- if (this.operator === '') {
64318
- if (this.value === '') {
64319
- return true
64320
- }
64321
- return new range(comp.value, options).test(this.value)
64322
- } else if (comp.operator === '') {
64323
- if (comp.value === '') {
64324
- return true
64325
- }
64326
- return new range(this.value, options).test(comp.semver)
64327
- }
64328
-
64329
- const sameDirectionIncreasing =
64330
- (this.operator === '>=' || this.operator === '>') &&
64331
- (comp.operator === '>=' || comp.operator === '>');
64332
- const sameDirectionDecreasing =
64333
- (this.operator === '<=' || this.operator === '<') &&
64334
- (comp.operator === '<=' || comp.operator === '<');
64335
- const sameSemVer = this.semver.version === comp.semver.version;
64336
- const differentDirectionsInclusive =
64337
- (this.operator === '>=' || this.operator === '<=') &&
64338
- (comp.operator === '>=' || comp.operator === '<=');
64339
- const oppositeDirectionsLessThan =
64340
- cmp_1(this.semver, '<', comp.semver, options) &&
64341
- (this.operator === '>=' || this.operator === '>') &&
64342
- (comp.operator === '<=' || comp.operator === '<');
64343
- const oppositeDirectionsGreaterThan =
64344
- cmp_1(this.semver, '>', comp.semver, options) &&
64345
- (this.operator === '<=' || this.operator === '<') &&
64346
- (comp.operator === '>=' || comp.operator === '>');
64347
-
64348
- return (
64349
- sameDirectionIncreasing ||
64350
- sameDirectionDecreasing ||
64351
- (sameSemVer && differentDirectionsInclusive) ||
64352
- oppositeDirectionsLessThan ||
64353
- oppositeDirectionsGreaterThan
64354
- )
62862
+ // push to end
62863
+ collection.push(element);
64355
62864
  }
64356
62865
  }
64357
62866
 
64358
- var comparator = Comparator;
64359
-
64360
-
64361
- const {re: re$6, t: t$6} = re_1;
64362
-
64363
- const satisfies = (version, range$1, options) => {
64364
- try {
64365
- range$1 = new range(range$1, options);
64366
- } catch (er) {
64367
- return false
64368
- }
64369
- return range$1.test(version)
64370
- };
64371
- var satisfies_1 = satisfies;
64372
-
64373
- // Mostly just for testing and legacy API reasons
64374
- const toComparators = (range$1, options) =>
64375
- new range(range$1, options).set
64376
- .map(comp => comp.map(c => c.value).join(' ').trim().split(' '));
64377
-
64378
- var toComparators_1 = toComparators;
64379
-
64380
- const maxSatisfying = (versions, range$1, options) => {
64381
- let max = null;
64382
- let maxSV = null;
64383
- let rangeObj = null;
64384
- try {
64385
- rangeObj = new range(range$1, options);
64386
- } catch (er) {
64387
- return null
64388
- }
64389
- versions.forEach((v) => {
64390
- if (rangeObj.test(v)) {
64391
- // satisfies(v, range, options)
64392
- if (!max || maxSV.compare(v) === -1) {
64393
- // compare(max, v, true)
64394
- max = v;
64395
- maxSV = new semver(max, options);
64396
- }
64397
- }
64398
- });
64399
- return max
64400
- };
64401
- var maxSatisfying_1 = maxSatisfying;
64402
-
64403
- const minSatisfying = (versions, range$1, options) => {
64404
- let min = null;
64405
- let minSV = null;
64406
- let rangeObj = null;
64407
- try {
64408
- rangeObj = new range(range$1, options);
64409
- } catch (er) {
64410
- return null
64411
- }
64412
- versions.forEach((v) => {
64413
- if (rangeObj.test(v)) {
64414
- // satisfies(v, range, options)
64415
- if (!min || minSV.compare(v) === 1) {
64416
- // compare(min, v, true)
64417
- min = v;
64418
- minSV = new semver(min, options);
64419
- }
64420
- }
64421
- });
64422
- return min
64423
- };
64424
- var minSatisfying_1 = minSatisfying;
64425
-
64426
- const minVersion = (range$1, loose) => {
64427
- range$1 = new range(range$1, loose);
64428
-
64429
- let minver = new semver('0.0.0');
64430
- if (range$1.test(minver)) {
64431
- return minver
64432
- }
64433
-
64434
- minver = new semver('0.0.0-0');
64435
- if (range$1.test(minver)) {
64436
- return minver
64437
- }
64438
-
64439
- minver = null;
64440
- for (let i = 0; i < range$1.set.length; ++i) {
64441
- const comparators = range$1.set[i];
64442
-
64443
- let setMin = null;
64444
- comparators.forEach((comparator) => {
64445
- // Clone to avoid manipulating the comparator's semver object.
64446
- const compver = new semver(comparator.semver.version);
64447
- switch (comparator.operator) {
64448
- case '>':
64449
- if (compver.prerelease.length === 0) {
64450
- compver.patch++;
64451
- } else {
64452
- compver.prerelease.push(0);
64453
- }
64454
- compver.raw = compver.format();
64455
- /* fallthrough */
64456
- case '':
64457
- case '>=':
64458
- if (!setMin || gt_1(compver, setMin)) {
64459
- setMin = compver;
64460
- }
64461
- break
64462
- case '<':
64463
- case '<=':
64464
- /* Ignore maximum versions */
64465
- break
64466
- /* istanbul ignore next */
64467
- default:
64468
- throw new Error(`Unexpected operation: ${comparator.operator}`)
64469
- }
64470
- });
64471
- if (setMin && (!minver || gt_1(minver, setMin)))
64472
- minver = setMin;
64473
- }
64474
-
64475
- if (minver && range$1.test(minver)) {
64476
- return minver
64477
- }
64478
-
64479
- return null
64480
- };
64481
- var minVersion_1 = minVersion;
64482
-
64483
- const validRange = (range$1, options) => {
64484
- try {
64485
- // Return '*' instead of '' so that truthiness works.
64486
- // This will throw if it's invalid anyway
64487
- return new range(range$1, options).range || '*'
64488
- } catch (er) {
64489
- return null
64490
- }
64491
- };
64492
- var valid$1 = validRange;
64493
-
64494
- const {ANY: ANY$1} = comparator;
64495
-
64496
-
64497
-
64498
-
64499
-
64500
-
64501
-
64502
- const outside = (version, range$1, hilo, options) => {
64503
- version = new semver(version, options);
64504
- range$1 = new range(range$1, options);
64505
-
64506
- let gtfn, ltefn, ltfn, comp, ecomp;
64507
- switch (hilo) {
64508
- case '>':
64509
- gtfn = gt_1;
64510
- ltefn = lte_1;
64511
- ltfn = lt_1;
64512
- comp = '>';
64513
- ecomp = '>=';
64514
- break
64515
- case '<':
64516
- gtfn = lt_1;
64517
- ltefn = gte_1;
64518
- ltfn = gt_1;
64519
- comp = '<';
64520
- ecomp = '<=';
64521
- break
64522
- default:
64523
- throw new TypeError('Must provide a hilo val of "<" or ">"')
64524
- }
62867
+ const BpmnPropertiesPanelContext = q({
62868
+ selectedElement: null,
62869
+ injector: null,
64525
62870
 
64526
- // If it satisfies the range it is not outside
64527
- if (satisfies_1(version, range$1, options)) {
64528
- return false
62871
+ getService() {
62872
+ return null;
64529
62873
  }
64530
62874
 
64531
- // From now on, variable terms are as if we're in "gtr" mode.
64532
- // but note that everything is flipped for the "ltr" function.
62875
+ });
64533
62876
 
64534
- for (let i = 0; i < range$1.set.length; ++i) {
64535
- const comparators = range$1.set[i];
62877
+ function useService(type, strict) {
62878
+ const {
62879
+ getService
62880
+ } = F(BpmnPropertiesPanelContext);
62881
+ return getService(type, strict);
62882
+ }
64536
62883
 
64537
- let high = null;
64538
- let low = null;
62884
+ /**
62885
+ * Returns a memoized callback to be passed as `show` prop. Callback returns
62886
+ * true if (1) ID and path match or (2) ID matches and matcher returns true.
62887
+ *
62888
+ * @example
62889
+ *
62890
+ * // using path
62891
+ * const show = useShowCallback(businessObject, [ 'foo' ]);
62892
+ *
62893
+ * @example
62894
+ *
62895
+ * // using matcher
62896
+ * const show = useShowCallback(businessObject, (event) => event.foo === 'bar');
62897
+ *
62898
+ * @param {Object} businessObject
62899
+ * @param {string[]|Function} matcher
62900
+ *
62901
+ * @returns {Function}
62902
+ */
64539
62903
 
64540
- comparators.forEach((comparator$1) => {
64541
- if (comparator$1.semver === ANY$1) {
64542
- comparator$1 = new comparator('>=0.0.0');
64543
- }
64544
- high = high || comparator$1;
64545
- low = low || comparator$1;
64546
- if (gtfn(comparator$1.semver, high.semver, options)) {
64547
- high = comparator$1;
64548
- } else if (ltfn(comparator$1.semver, low.semver, options)) {
64549
- low = comparator$1;
64550
- }
64551
- });
62904
+ function useShowCallback(businessObject, matcher) {
62905
+ return A$1(event => {
62906
+ const {
62907
+ id,
62908
+ path
62909
+ } = event;
64552
62910
 
64553
- // If the edge version comparator has a operator then our version
64554
- // isn't outside it
64555
- if (high.operator === comp || high.operator === ecomp) {
64556
- return false
62911
+ if (id !== businessObject.get('id')) {
62912
+ return false;
64557
62913
  }
64558
62914
 
64559
- // If the lowest version comparator has an operator and our version
64560
- // is less than it then it isn't higher than the range
64561
- if ((!low.operator || low.operator === comp) &&
64562
- ltefn(version, low.semver)) {
64563
- return false
64564
- } else if (low.operator === ecomp && ltfn(version, low.semver)) {
64565
- return false
62915
+ if (isArray(matcher)) {
62916
+ return path && pathEquals(path, matcher);
64566
62917
  }
64567
- }
64568
- return true
64569
- };
64570
-
64571
- var outside_1 = outside;
64572
-
64573
- // Determine if version is greater than all the versions possible in the range.
64574
-
64575
- const gtr = (version, range, options) => outside_1(version, range, '>', options);
64576
- var gtr_1 = gtr;
64577
-
64578
- // Determine if version is less than all the versions possible in the range
64579
- const ltr = (version, range, options) => outside_1(version, range, '<', options);
64580
- var ltr_1 = ltr;
64581
62918
 
64582
- const intersects = (r1, r2, options) => {
64583
- r1 = new range(r1, options);
64584
- r2 = new range(r2, options);
64585
- return r1.intersects(r2)
64586
- };
64587
- var intersects_1 = intersects;
64588
-
64589
- // given a set of versions and a range, create a "simplified" range
64590
- // that includes the same versions that the original range does
64591
- // If the original range is shorter than the simplified one, return that.
64592
-
64593
-
64594
- var simplify = (versions, range, options) => {
64595
- const set = [];
64596
- let min = null;
64597
- let prev = null;
64598
- const v = versions.sort((a, b) => compare_1(a, b, options));
64599
- for (const version of v) {
64600
- const included = satisfies_1(version, range, options);
64601
- if (included) {
64602
- prev = version;
64603
- if (!min)
64604
- min = version;
64605
- } else {
64606
- if (prev) {
64607
- set.push([min, prev]);
64608
- }
64609
- prev = null;
64610
- min = null;
62919
+ if (isFunction(matcher)) {
62920
+ return !!matcher(event);
64611
62921
  }
64612
- }
64613
- if (min)
64614
- set.push([min, null]);
64615
62922
 
64616
- const ranges = [];
64617
- for (const [min, max] of set) {
64618
- if (min === max)
64619
- ranges.push(min);
64620
- else if (!max && min === v[0])
64621
- ranges.push('*');
64622
- else if (!max)
64623
- ranges.push(`>=${min}`);
64624
- else if (min === v[0])
64625
- ranges.push(`<=${max}`);
64626
- else
64627
- ranges.push(`${min} - ${max}`);
64628
- }
64629
- const simplified = ranges.join(' || ');
64630
- const original = typeof range.raw === 'string' ? range.raw : String(range);
64631
- return simplified.length < original.length ? simplified : range
64632
- };
64633
-
64634
- const { ANY: ANY$2 } = comparator;
64635
-
64636
-
64637
-
64638
- // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
64639
- // - Every simple range `r1, r2, ...` is a null set, OR
64640
- // - Every simple range `r1, r2, ...` which is not a null set is a subset of
64641
- // some `R1, R2, ...`
64642
- //
64643
- // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
64644
- // - If c is only the ANY comparator
64645
- // - If C is only the ANY comparator, return true
64646
- // - Else if in prerelease mode, return false
64647
- // - else replace c with `[>=0.0.0]`
64648
- // - If C is only the ANY comparator
64649
- // - if in prerelease mode, return true
64650
- // - else replace C with `[>=0.0.0]`
64651
- // - Let EQ be the set of = comparators in c
64652
- // - If EQ is more than one, return true (null set)
64653
- // - Let GT be the highest > or >= comparator in c
64654
- // - Let LT be the lowest < or <= comparator in c
64655
- // - If GT and LT, and GT.semver > LT.semver, return true (null set)
64656
- // - If any C is a = range, and GT or LT are set, return false
64657
- // - If EQ
64658
- // - If GT, and EQ does not satisfy GT, return true (null set)
64659
- // - If LT, and EQ does not satisfy LT, return true (null set)
64660
- // - If EQ satisfies every C, return true
64661
- // - Else return false
64662
- // - If GT
64663
- // - If GT.semver is lower than any > or >= comp in C, return false
64664
- // - If GT is >=, and GT.semver does not satisfy every C, return false
64665
- // - If GT.semver has a prerelease, and not in prerelease mode
64666
- // - If no C has a prerelease and the GT.semver tuple, return false
64667
- // - If LT
64668
- // - If LT.semver is greater than any < or <= comp in C, return false
64669
- // - If LT is <=, and LT.semver does not satisfy every C, return false
64670
- // - If GT.semver has a prerelease, and not in prerelease mode
64671
- // - If no C has a prerelease and the LT.semver tuple, return false
64672
- // - Else return true
64673
-
64674
- const subset = (sub, dom, options = {}) => {
64675
- if (sub === dom)
64676
- return true
64677
-
64678
- sub = new range(sub, options);
64679
- dom = new range(dom, options);
64680
- let sawNonNull = false;
64681
-
64682
- OUTER: for (const simpleSub of sub.set) {
64683
- for (const simpleDom of dom.set) {
64684
- const isSub = simpleSubset(simpleSub, simpleDom, options);
64685
- sawNonNull = sawNonNull || isSub !== null;
64686
- if (isSub)
64687
- continue OUTER
64688
- }
64689
- // the null set is a subset of everything, but null simple ranges in
64690
- // a complex range should be ignored. so if we saw a non-null range,
64691
- // then we know this isn't a subset, but if EVERY simple range was null,
64692
- // then it is a subset.
64693
- if (sawNonNull)
64694
- return false
64695
- }
64696
- return true
64697
- };
64698
-
64699
- const simpleSubset = (sub, dom, options) => {
64700
- if (sub === dom)
64701
- return true
64702
-
64703
- if (sub.length === 1 && sub[0].semver === ANY$2) {
64704
- if (dom.length === 1 && dom[0].semver === ANY$2)
64705
- return true
64706
- else if (options.includePrerelease)
64707
- sub = [ new comparator('>=0.0.0-0') ];
64708
- else
64709
- sub = [ new comparator('>=0.0.0') ];
64710
- }
64711
-
64712
- if (dom.length === 1 && dom[0].semver === ANY$2) {
64713
- if (options.includePrerelease)
64714
- return true
64715
- else
64716
- dom = [ new comparator('>=0.0.0') ];
64717
- }
64718
-
64719
- const eqSet = new Set();
64720
- let gt, lt;
64721
- for (const c of sub) {
64722
- if (c.operator === '>' || c.operator === '>=')
64723
- gt = higherGT(gt, c, options);
64724
- else if (c.operator === '<' || c.operator === '<=')
64725
- lt = lowerLT(lt, c, options);
64726
- else
64727
- eqSet.add(c.semver);
64728
- }
64729
-
64730
- if (eqSet.size > 1)
64731
- return null
64732
-
64733
- let gtltComp;
64734
- if (gt && lt) {
64735
- gtltComp = compare_1(gt.semver, lt.semver, options);
64736
- if (gtltComp > 0)
64737
- return null
64738
- else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<='))
64739
- return null
64740
- }
64741
-
64742
- // will iterate one or zero times
64743
- for (const eq of eqSet) {
64744
- if (gt && !satisfies_1(eq, String(gt), options))
64745
- return null
64746
-
64747
- if (lt && !satisfies_1(eq, String(lt), options))
64748
- return null
64749
-
64750
- for (const c of dom) {
64751
- if (!satisfies_1(eq, String(c), options))
64752
- return false
64753
- }
64754
-
64755
- return true
64756
- }
64757
-
64758
- let higher, lower;
64759
- let hasDomLT, hasDomGT;
64760
- // if the subset has a prerelease, we need a comparator in the superset
64761
- // with the same tuple and a prerelease, or it's not a subset
64762
- let needDomLTPre = lt &&
64763
- !options.includePrerelease &&
64764
- lt.semver.prerelease.length ? lt.semver : false;
64765
- let needDomGTPre = gt &&
64766
- !options.includePrerelease &&
64767
- gt.semver.prerelease.length ? gt.semver : false;
64768
- // exception: <1.2.3-0 is the same as <1.2.3
64769
- if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
64770
- lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
64771
- needDomLTPre = false;
64772
- }
64773
-
64774
- for (const c of dom) {
64775
- hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=';
64776
- hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=';
64777
- if (gt) {
64778
- if (needDomGTPre) {
64779
- if (c.semver.prerelease && c.semver.prerelease.length &&
64780
- c.semver.major === needDomGTPre.major &&
64781
- c.semver.minor === needDomGTPre.minor &&
64782
- c.semver.patch === needDomGTPre.patch) {
64783
- needDomGTPre = false;
64784
- }
64785
- }
64786
- if (c.operator === '>' || c.operator === '>=') {
64787
- higher = higherGT(gt, c, options);
64788
- if (higher === c && higher !== gt)
64789
- return false
64790
- } else if (gt.operator === '>=' && !satisfies_1(gt.semver, String(c), options))
64791
- return false
64792
- }
64793
- if (lt) {
64794
- if (needDomLTPre) {
64795
- if (c.semver.prerelease && c.semver.prerelease.length &&
64796
- c.semver.major === needDomLTPre.major &&
64797
- c.semver.minor === needDomLTPre.minor &&
64798
- c.semver.patch === needDomLTPre.patch) {
64799
- needDomLTPre = false;
64800
- }
64801
- }
64802
- if (c.operator === '<' || c.operator === '<=') {
64803
- lower = lowerLT(lt, c, options);
64804
- if (lower === c && lower !== lt)
64805
- return false
64806
- } else if (lt.operator === '<=' && !satisfies_1(lt.semver, String(c), options))
64807
- return false
64808
- }
64809
- if (!c.operator && (lt || gt) && gtltComp !== 0)
64810
- return false
64811
- }
64812
-
64813
- // if there was a < or >, and nothing in the dom, then must be false
64814
- // UNLESS it was limited by another range in the other direction.
64815
- // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
64816
- if (gt && hasDomLT && !lt && gtltComp !== 0)
64817
- return false
64818
-
64819
- if (lt && hasDomGT && !gt && gtltComp !== 0)
64820
- return false
64821
-
64822
- // we needed a prerelease range in a specific tuple, but didn't get one
64823
- // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
64824
- // because it includes prereleases in the 1.2.3 tuple
64825
- if (needDomGTPre || needDomLTPre)
64826
- return false
64827
-
64828
- return true
64829
- };
64830
-
64831
- // >=1.2.3 is lower than >1.2.3
64832
- const higherGT = (a, b, options) => {
64833
- if (!a)
64834
- return b
64835
- const comp = compare_1(a.semver, b.semver, options);
64836
- return comp > 0 ? a
64837
- : comp < 0 ? b
64838
- : b.operator === '>' && a.operator === '>=' ? b
64839
- : a
64840
- };
64841
-
64842
- // <=1.2.3 is higher than <1.2.3
64843
- const lowerLT = (a, b, options) => {
64844
- if (!a)
64845
- return b
64846
- const comp = compare_1(a.semver, b.semver, options);
64847
- return comp < 0 ? a
64848
- : comp > 0 ? b
64849
- : b.operator === '<' && a.operator === '<=' ? b
64850
- : a
64851
- };
64852
-
64853
- var subset_1 = subset;
64854
-
64855
- // just pre-load all the stuff that index.js lazily exports
64856
-
64857
- ({
64858
- re: re_1.re,
64859
- src: re_1.src,
64860
- tokens: re_1.t,
64861
- SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
64862
- SemVer: semver,
64863
- compareIdentifiers: identifiers.compareIdentifiers,
64864
- rcompareIdentifiers: identifiers.rcompareIdentifiers,
64865
- parse: parse_1,
64866
- valid: valid_1,
64867
- clean: clean_1,
64868
- inc: inc_1,
64869
- diff: diff_1,
64870
- major: major_1,
64871
- minor: minor_1,
64872
- patch: patch_1,
64873
- prerelease: prerelease_1,
64874
- compare: compare_1,
64875
- rcompare: rcompare_1,
64876
- compareLoose: compareLoose_1,
64877
- compareBuild: compareBuild_1,
64878
- sort: sort_1,
64879
- rsort: rsort_1,
64880
- gt: gt_1,
64881
- lt: lt_1,
64882
- eq: eq_1,
64883
- neq: neq_1,
64884
- gte: gte_1,
64885
- lte: lte_1,
64886
- cmp: cmp_1,
64887
- coerce: coerce_1,
64888
- Comparator: comparator,
64889
- Range: range,
64890
- satisfies: satisfies_1,
64891
- toComparators: toComparators_1,
64892
- maxSatisfying: maxSatisfying_1,
64893
- minSatisfying: minSatisfying_1,
64894
- minVersion: minVersion_1,
64895
- validRange: valid$1,
64896
- outside: outside_1,
64897
- gtr: gtr_1,
64898
- ltr: ltr_1,
64899
- intersects: intersects_1,
64900
- simplifyRange: simplify,
64901
- subset: subset_1,
64902
- });
64903
-
64904
- const BpmnPropertiesPanelContext = q({
64905
- selectedElement: null,
64906
- injector: null,
64907
-
64908
- getService() {
64909
- return null;
64910
- }
64911
-
64912
- });
62923
+ return false;
62924
+ }, [businessObject, matcher]);
62925
+ }
64913
62926
 
64914
62927
  function _extends$1m() { _extends$1m = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1m.apply(this, arguments); }
64915
62928
  var AssociationIcon = (({
@@ -66130,6 +64143,14 @@
66130
64143
  return type;
66131
64144
  }
66132
64145
  const PanelHeaderProvider = {
64146
+ getDocumentationRef: element => {
64147
+ // eslint-disable-next-line react-hooks/rules-of-hooks
64148
+ const elementTemplates = useService('elementTemplates', false);
64149
+
64150
+ if (elementTemplates) {
64151
+ return getTemplateDocumentation(element, elementTemplates);
64152
+ }
64153
+ },
66133
64154
  getElementLabel: element => {
66134
64155
  if (is$1(element, 'bpmn:Process')) {
66135
64156
  return getBusinessObject(element).name;
@@ -66142,6 +64163,17 @@
66142
64163
  return iconsByType[concreteType];
66143
64164
  },
66144
64165
  getTypeLabel: element => {
64166
+ // eslint-disable-next-line react-hooks/rules-of-hooks
64167
+ const elementTemplates = useService('elementTemplates', false);
64168
+
64169
+ if (elementTemplates) {
64170
+ const template = getTemplate(element, elementTemplates);
64171
+
64172
+ if (template && template.name) {
64173
+ return template.name;
64174
+ }
64175
+ }
64176
+
66145
64177
  const concreteType = getConcreteType(element);
66146
64178
  return concreteType.replace(/(\B[A-Z])/g, ' $1').replace(/(\bNon Interrupting)/g, '($1)');
66147
64179
  }
@@ -66187,8 +64219,7 @@
66187
64219
  }
66188
64220
 
66189
64221
  return businessObject.conditionExpression && is$1(sourceBusinessObject, 'bpmn:Activity');
66190
- } // helpers //////////
66191
-
64222
+ }
66192
64223
 
66193
64224
  function isPlane$1(element) {
66194
64225
  // Backwards compatibility for bpmn-js<8
@@ -66196,6 +64227,17 @@
66196
64227
  return is$1(di, 'bpmndi:BPMNPlane');
66197
64228
  }
66198
64229
 
64230
+ function getTemplate(element, elementTemplates) {
64231
+ const templateId = elementTemplates._getTemplateId(element);
64232
+
64233
+ return templateId && elementTemplates.get(templateId);
64234
+ }
64235
+
64236
+ function getTemplateDocumentation(element, elementTemplates) {
64237
+ const template = getTemplate(element, elementTemplates);
64238
+ return template && template.documentationRef;
64239
+ }
64240
+
66199
64241
  function BpmnPropertiesPanel(props) {
66200
64242
  const {
66201
64243
  element,
@@ -66343,7 +64385,8 @@
66343
64385
  layoutConfig: layoutConfig,
66344
64386
  layoutChanged: onLayoutChanged,
66345
64387
  descriptionConfig: descriptionConfig,
66346
- descriptionLoaded: onDescriptionLoaded
64388
+ descriptionLoaded: onDescriptionLoaded,
64389
+ eventBus: eventBus
66347
64390
  })
66348
64391
  });
66349
64392
  } // helpers //////////////////////////
@@ -66361,7 +64404,7 @@
66361
64404
  return element && elementRegistry.get(element.id);
66362
64405
  }
66363
64406
 
66364
- const DEFAULT_PRIORITY$6 = 1000;
64407
+ const DEFAULT_PRIORITY$7 = 1000;
66365
64408
  /**
66366
64409
  * @typedef { import('@bpmn-io/properties-panel').GroupDefinition } GroupDefinition
66367
64410
  * @typedef { import('@bpmn-io/properties-panel').ListGroupDefinition } ListGroupDefinition
@@ -66444,7 +64487,7 @@
66444
64487
  registerProvider(priority, provider) {
66445
64488
  if (!provider) {
66446
64489
  provider = priority;
66447
- priority = DEFAULT_PRIORITY$6;
64490
+ priority = DEFAULT_PRIORITY$7;
66448
64491
  }
66449
64492
 
66450
64493
  if (typeof provider.getGroups !== 'function') {
@@ -66556,13 +64599,6 @@
66556
64599
  propertiesPanel: ['type', BpmnPropertiesPanelRenderer]
66557
64600
  };
66558
64601
 
66559
- function useService (type, strict) {
66560
- const {
66561
- getService
66562
- } = F(BpmnPropertiesPanelContext);
66563
- return getService(type, strict);
66564
- }
66565
-
66566
64602
  function ReferenceSelectEntry(props) {
66567
64603
  const {
66568
64604
  autoFocusEntry,
@@ -66782,7 +64818,7 @@
66782
64818
  label: translate('<none>')
66783
64819
  }];
66784
64820
  const activities = findActivityRefs(element);
66785
- sortByName$7(activities).forEach(function (activity) {
64821
+ sortByName$6(activities).forEach(function (activity) {
66786
64822
  options.push({
66787
64823
  value: activity.id,
66788
64824
  label: createOptionLabel(activity)
@@ -66905,7 +64941,7 @@
66905
64941
  return `${name ? name + ' ' : ''}(id=${id})`;
66906
64942
  }
66907
64943
 
66908
- function sortByName$7(elements) {
64944
+ function sortByName$6(elements) {
66909
64945
  return sortBy(elements, e => (e.name || '').toLowerCase());
66910
64946
  }
66911
64947
 
@@ -67209,7 +65245,7 @@
67209
65245
  label: translate('Create new ...')
67210
65246
  }];
67211
65247
  const errors = findRootElementsByType(getBusinessObject(element), 'bpmn:Error');
67212
- sortByName$6(errors).forEach(error => {
65248
+ sortByName$5(errors).forEach(error => {
67213
65249
  options.push({
67214
65250
  value: error.get('id'),
67215
65251
  label: error.get('name')
@@ -67218,6 +65254,9 @@
67218
65254
  return options;
67219
65255
  };
67220
65256
 
65257
+ const businessObject = getBusinessObject(element),
65258
+ path = pathConcat(getPath(errorEventDefinition, businessObject), 'errorRef');
65259
+ const show = useShowCallback(businessObject, path);
67221
65260
  return ReferenceSelectEntry({
67222
65261
  element,
67223
65262
  id: 'errorRef',
@@ -67225,7 +65264,8 @@
67225
65264
  autoFocusEntry: 'errorName',
67226
65265
  getValue,
67227
65266
  setValue,
67228
- getOptions
65267
+ getOptions,
65268
+ show
67229
65269
  });
67230
65270
  }
67231
65271
 
@@ -67296,7 +65336,7 @@
67296
65336
  } // helper /////////////////////////
67297
65337
 
67298
65338
 
67299
- function sortByName$6(elements) {
65339
+ function sortByName$5(elements) {
67300
65340
  return sortBy(elements, e => (e.name || '').toLowerCase());
67301
65341
  }
67302
65342
 
@@ -67403,7 +65443,7 @@
67403
65443
  label: translate('Create new ...')
67404
65444
  }];
67405
65445
  const escalations = findRootElementsByType(getBusinessObject(element), 'bpmn:Escalation');
67406
- sortByName$5(escalations).forEach(escalation => {
65446
+ sortByName$4(escalations).forEach(escalation => {
67407
65447
  options.push({
67408
65448
  value: escalation.get('id'),
67409
65449
  label: escalation.get('name')
@@ -67490,7 +65530,7 @@
67490
65530
  } // helper /////////////////////////
67491
65531
 
67492
65532
 
67493
- function sortByName$5(elements) {
65533
+ function sortByName$4(elements) {
67494
65534
  return sortBy(elements, e => (e.name || '').toLowerCase());
67495
65535
  }
67496
65536
 
@@ -67752,7 +65792,7 @@
67752
65792
  if (message) {
67753
65793
  entries = [...entries, {
67754
65794
  id: 'messageName',
67755
- component: MessageName,
65795
+ component: MessageName$1,
67756
65796
  isEdited: isEdited$1
67757
65797
  }];
67758
65798
  }
@@ -67828,7 +65868,7 @@
67828
65868
  label: translate('Create new ...')
67829
65869
  }];
67830
65870
  const messages = findRootElementsByType(getBusinessObject(element), 'bpmn:Message');
67831
- sortByName$4(messages).forEach(message => {
65871
+ sortByName$3(messages).forEach(message => {
67832
65872
  options.push({
67833
65873
  value: message.get('id'),
67834
65874
  label: message.get('name')
@@ -67837,6 +65877,9 @@
67837
65877
  return options;
67838
65878
  };
67839
65879
 
65880
+ const businessObject = getBusinessObject(element),
65881
+ path = pathConcat(getPath(messageEventDefinition, businessObject), 'messageRef');
65882
+ const show = useShowCallback(businessObject, path);
67840
65883
  return ReferenceSelectEntry({
67841
65884
  element,
67842
65885
  id: 'messageRef',
@@ -67844,11 +65887,12 @@
67844
65887
  autoFocusEntry: 'messageName',
67845
65888
  getValue,
67846
65889
  setValue,
67847
- getOptions
65890
+ getOptions,
65891
+ show
67848
65892
  });
67849
65893
  }
67850
65894
 
67851
- function MessageName(props) {
65895
+ function MessageName$1(props) {
67852
65896
  const {
67853
65897
  element
67854
65898
  } = props;
@@ -67882,7 +65926,7 @@
67882
65926
  } // helper /////////////////////////
67883
65927
 
67884
65928
 
67885
- function sortByName$4(elements) {
65929
+ function sortByName$3(elements) {
67886
65930
  return sortBy(elements, e => (e.name || '').toLowerCase());
67887
65931
  }
67888
65932
 
@@ -68448,7 +66492,7 @@
68448
66492
  label: translate('Create new ...')
68449
66493
  }];
68450
66494
  const signals = findRootElementsByType(getBusinessObject(element), 'bpmn:Signal');
68451
- sortByName$3(signals).forEach(signal => {
66495
+ sortByName$2(signals).forEach(signal => {
68452
66496
  options.push({
68453
66497
  value: signal.get('id'),
68454
66498
  label: signal.get('name')
@@ -68502,7 +66546,7 @@
68502
66546
  } // helper /////////////////////////
68503
66547
 
68504
66548
 
68505
- function sortByName$3(elements) {
66549
+ function sortByName$2(elements) {
68506
66550
  return sortBy(elements, e => (e.name || '').toLowerCase());
68507
66551
  }
68508
66552