chunk-KSLPIYOU.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861
  1. import {
  2. isEventSubProcess,
  3. isExpanded
  4. } from "./chunk-ZH5JUQV2.js";
  5. import {
  6. getParent
  7. } from "./chunk-NRHG7SAN.js";
  8. import {
  9. asBounds,
  10. asTRBL
  11. } from "./chunk-7FXQS3I2.js";
  12. import {
  13. is,
  14. isAny
  15. } from "./chunk-L5SG54UC.js";
  16. import {
  17. assign,
  18. every,
  19. filter,
  20. find,
  21. forEach,
  22. groupBy,
  23. isArray,
  24. isNumber,
  25. isObject,
  26. isUndefined
  27. } from "./chunk-4AK4GF4H.js";
  28. // node_modules/.pnpm/diagram-js@13.4.0/node_modules/diagram-js/lib/util/Elements.js
  29. function getParents(elements) {
  30. return filter(elements, function(element) {
  31. return !find(elements, function(e) {
  32. return e !== element && getParent2(element, e);
  33. });
  34. });
  35. }
  36. function getParent2(element, parent) {
  37. if (!parent) {
  38. return;
  39. }
  40. if (element === parent) {
  41. return parent;
  42. }
  43. if (!element.parent) {
  44. return;
  45. }
  46. return getParent2(element.parent, parent);
  47. }
  48. function add(elements, element, unique) {
  49. var canAdd = !unique || elements.indexOf(element) === -1;
  50. if (canAdd) {
  51. elements.push(element);
  52. }
  53. return canAdd;
  54. }
  55. function eachElement(elements, fn, depth) {
  56. depth = depth || 0;
  57. if (!isArray(elements)) {
  58. elements = [elements];
  59. }
  60. forEach(elements, function(s, i) {
  61. var filter2 = fn(s, i, depth);
  62. if (isArray(filter2) && filter2.length) {
  63. eachElement(filter2, fn, depth + 1);
  64. }
  65. });
  66. }
  67. function selfAndChildren(elements, unique, maxDepth) {
  68. var result = [], processedChildren = [];
  69. eachElement(elements, function(element, i, depth) {
  70. add(result, element, unique);
  71. var children = element.children;
  72. if (maxDepth === -1 || depth < maxDepth) {
  73. if (children && add(processedChildren, children, unique)) {
  74. return children;
  75. }
  76. }
  77. });
  78. return result;
  79. }
  80. function selfAndAllChildren(elements, allowDuplicates) {
  81. return selfAndChildren(elements, !allowDuplicates, -1);
  82. }
  83. function getClosure(elements, isTopLevel, closure) {
  84. if (isUndefined(isTopLevel)) {
  85. isTopLevel = true;
  86. }
  87. if (isObject(isTopLevel)) {
  88. closure = isTopLevel;
  89. isTopLevel = true;
  90. }
  91. closure = closure || {};
  92. var allShapes = copyObject(closure.allShapes), allConnections = copyObject(closure.allConnections), enclosedElements = copyObject(closure.enclosedElements), enclosedConnections = copyObject(closure.enclosedConnections);
  93. var topLevel = copyObject(
  94. closure.topLevel,
  95. isTopLevel && groupBy(elements, function(e) {
  96. return e.id;
  97. })
  98. );
  99. function handleConnection(c) {
  100. if (topLevel[c.source.id] && topLevel[c.target.id]) {
  101. topLevel[c.id] = [c];
  102. }
  103. if (allShapes[c.source.id] && allShapes[c.target.id]) {
  104. enclosedConnections[c.id] = enclosedElements[c.id] = c;
  105. }
  106. allConnections[c.id] = c;
  107. }
  108. function handleElement(element) {
  109. enclosedElements[element.id] = element;
  110. if (element.waypoints) {
  111. enclosedConnections[element.id] = allConnections[element.id] = element;
  112. } else {
  113. allShapes[element.id] = element;
  114. forEach(element.incoming, handleConnection);
  115. forEach(element.outgoing, handleConnection);
  116. return element.children;
  117. }
  118. }
  119. eachElement(elements, handleElement);
  120. return {
  121. allShapes,
  122. allConnections,
  123. topLevel,
  124. enclosedConnections,
  125. enclosedElements
  126. };
  127. }
  128. function getBBox(elements, stopRecursion) {
  129. stopRecursion = !!stopRecursion;
  130. if (!isArray(elements)) {
  131. elements = [elements];
  132. }
  133. var minX, minY, maxX, maxY;
  134. forEach(elements, function(element) {
  135. var bbox = element;
  136. if (element.waypoints && !stopRecursion) {
  137. bbox = getBBox(element.waypoints, true);
  138. }
  139. var x = bbox.x, y = bbox.y, height = bbox.height || 0, width = bbox.width || 0;
  140. if (x < minX || minX === void 0) {
  141. minX = x;
  142. }
  143. if (y < minY || minY === void 0) {
  144. minY = y;
  145. }
  146. if (x + width > maxX || maxX === void 0) {
  147. maxX = x + width;
  148. }
  149. if (y + height > maxY || maxY === void 0) {
  150. maxY = y + height;
  151. }
  152. });
  153. return {
  154. x: minX,
  155. y: minY,
  156. height: maxY - minY,
  157. width: maxX - minX
  158. };
  159. }
  160. function getEnclosedElements(elements, bbox) {
  161. var filteredElements = {};
  162. forEach(elements, function(element) {
  163. var e = element;
  164. if (e.waypoints) {
  165. e = getBBox(e);
  166. }
  167. if (!isNumber(bbox.y) && e.x > bbox.x) {
  168. filteredElements[element.id] = element;
  169. }
  170. if (!isNumber(bbox.x) && e.y > bbox.y) {
  171. filteredElements[element.id] = element;
  172. }
  173. if (e.x > bbox.x && e.y > bbox.y) {
  174. if (isNumber(bbox.width) && isNumber(bbox.height) && e.width + e.x < bbox.width + bbox.x && e.height + e.y < bbox.height + bbox.y) {
  175. filteredElements[element.id] = element;
  176. } else if (!isNumber(bbox.width) || !isNumber(bbox.height)) {
  177. filteredElements[element.id] = element;
  178. }
  179. }
  180. });
  181. return filteredElements;
  182. }
  183. function getType(element) {
  184. if ("waypoints" in element) {
  185. return "connection";
  186. }
  187. if ("x" in element) {
  188. return "shape";
  189. }
  190. return "root";
  191. }
  192. function isFrameElement(element) {
  193. return !!(element && element.isFrame);
  194. }
  195. function copyObject(src1, src2) {
  196. return assign({}, src1 || {}, src2 || {});
  197. }
  198. // node_modules/.pnpm/diagram-js@13.4.0/node_modules/diagram-js/lib/features/resize/ResizeUtil.js
  199. var max = Math.max;
  200. var min = Math.min;
  201. var DEFAULT_CHILD_BOX_PADDING = 20;
  202. function substractTRBL(trblA, trblB) {
  203. return {
  204. top: trblA.top - trblB.top,
  205. right: trblA.right - trblB.right,
  206. bottom: trblA.bottom - trblB.bottom,
  207. left: trblA.left - trblB.left
  208. };
  209. }
  210. function resizeBounds(bounds, direction, delta) {
  211. var dx = delta.x, dy = delta.y;
  212. var newBounds = {
  213. x: bounds.x,
  214. y: bounds.y,
  215. width: bounds.width,
  216. height: bounds.height
  217. };
  218. if (direction.indexOf("n") !== -1) {
  219. newBounds.y = bounds.y + dy;
  220. newBounds.height = bounds.height - dy;
  221. } else if (direction.indexOf("s") !== -1) {
  222. newBounds.height = bounds.height + dy;
  223. }
  224. if (direction.indexOf("e") !== -1) {
  225. newBounds.width = bounds.width + dx;
  226. } else if (direction.indexOf("w") !== -1) {
  227. newBounds.x = bounds.x + dx;
  228. newBounds.width = bounds.width - dx;
  229. }
  230. return newBounds;
  231. }
  232. function resizeTRBL(bounds, resize) {
  233. return {
  234. x: bounds.x + (resize.left || 0),
  235. y: bounds.y + (resize.top || 0),
  236. width: bounds.width - (resize.left || 0) + (resize.right || 0),
  237. height: bounds.height - (resize.top || 0) + (resize.bottom || 0)
  238. };
  239. }
  240. function applyConstraints(attr, trbl, resizeConstraints) {
  241. var value = trbl[attr], minValue = resizeConstraints.min && resizeConstraints.min[attr], maxValue = resizeConstraints.max && resizeConstraints.max[attr];
  242. if (isNumber(minValue)) {
  243. value = (/top|left/.test(attr) ? min : max)(value, minValue);
  244. }
  245. if (isNumber(maxValue)) {
  246. value = (/top|left/.test(attr) ? max : min)(value, maxValue);
  247. }
  248. return value;
  249. }
  250. function ensureConstraints(currentBounds, resizeConstraints) {
  251. if (!resizeConstraints) {
  252. return currentBounds;
  253. }
  254. var currentTrbl = asTRBL(currentBounds);
  255. return asBounds({
  256. top: applyConstraints("top", currentTrbl, resizeConstraints),
  257. right: applyConstraints("right", currentTrbl, resizeConstraints),
  258. bottom: applyConstraints("bottom", currentTrbl, resizeConstraints),
  259. left: applyConstraints("left", currentTrbl, resizeConstraints)
  260. });
  261. }
  262. function getMinResizeBounds(direction, currentBounds, minDimensions, childrenBounds) {
  263. var currentBox = asTRBL(currentBounds);
  264. var minBox = {
  265. top: /n/.test(direction) ? currentBox.bottom - minDimensions.height : currentBox.top,
  266. left: /w/.test(direction) ? currentBox.right - minDimensions.width : currentBox.left,
  267. bottom: /s/.test(direction) ? currentBox.top + minDimensions.height : currentBox.bottom,
  268. right: /e/.test(direction) ? currentBox.left + minDimensions.width : currentBox.right
  269. };
  270. var childrenBox = childrenBounds ? asTRBL(childrenBounds) : minBox;
  271. var combinedBox = {
  272. top: min(minBox.top, childrenBox.top),
  273. left: min(minBox.left, childrenBox.left),
  274. bottom: max(minBox.bottom, childrenBox.bottom),
  275. right: max(minBox.right, childrenBox.right)
  276. };
  277. return asBounds(combinedBox);
  278. }
  279. function asPadding(mayBePadding, defaultValue) {
  280. if (typeof mayBePadding !== "undefined") {
  281. return mayBePadding;
  282. } else {
  283. return DEFAULT_CHILD_BOX_PADDING;
  284. }
  285. }
  286. function addPadding(bbox, padding) {
  287. var left, right, top, bottom;
  288. if (typeof padding === "object") {
  289. left = asPadding(padding.left);
  290. right = asPadding(padding.right);
  291. top = asPadding(padding.top);
  292. bottom = asPadding(padding.bottom);
  293. } else {
  294. left = right = top = bottom = asPadding(padding);
  295. }
  296. return {
  297. x: bbox.x - left,
  298. y: bbox.y - top,
  299. width: bbox.width + left + right,
  300. height: bbox.height + top + bottom
  301. };
  302. }
  303. function isBBoxChild(element) {
  304. if (element.waypoints) {
  305. return false;
  306. }
  307. if (element.type === "label") {
  308. return false;
  309. }
  310. return true;
  311. }
  312. function computeChildrenBBox(shapeOrChildren, padding) {
  313. var elements;
  314. if (shapeOrChildren.length === void 0) {
  315. elements = filter(shapeOrChildren.children, isBBoxChild);
  316. } else {
  317. elements = shapeOrChildren;
  318. }
  319. if (elements.length) {
  320. return addPadding(getBBox(elements), padding);
  321. }
  322. }
  323. // node_modules/.pnpm/bpmn-js@16.3.2/node_modules/bpmn-js/lib/features/modeling/util/LaneUtil.js
  324. var abs = Math.abs;
  325. function getTRBLResize(oldBounds, newBounds) {
  326. return substractTRBL(asTRBL(newBounds), asTRBL(oldBounds));
  327. }
  328. var LANE_PARENTS = [
  329. "bpmn:Participant",
  330. "bpmn:Process",
  331. "bpmn:SubProcess"
  332. ];
  333. var LANE_INDENTATION = 30;
  334. function collectLanes(shape, collectedShapes) {
  335. collectedShapes = collectedShapes || [];
  336. shape.children.filter(function(s) {
  337. if (is(s, "bpmn:Lane")) {
  338. collectLanes(s, collectedShapes);
  339. collectedShapes.push(s);
  340. }
  341. });
  342. return collectedShapes;
  343. }
  344. function getChildLanes(shape) {
  345. return shape.children.filter(function(c) {
  346. return is(c, "bpmn:Lane");
  347. });
  348. }
  349. function getLanesRoot(shape) {
  350. return getParent(shape, LANE_PARENTS) || shape;
  351. }
  352. function computeLanesResize(shape, newBounds) {
  353. var rootElement = getLanesRoot(shape);
  354. var initialShapes = is(rootElement, "bpmn:Process") ? [] : [rootElement];
  355. var allLanes = collectLanes(rootElement, initialShapes), shapeTrbl = asTRBL(shape), shapeNewTrbl = asTRBL(newBounds), trblResize = getTRBLResize(shape, newBounds), resizeNeeded = [];
  356. allLanes.forEach(function(other) {
  357. if (other === shape) {
  358. return;
  359. }
  360. var topResize = 0, rightResize = trblResize.right, bottomResize = 0, leftResize = trblResize.left;
  361. var otherTrbl = asTRBL(other);
  362. if (trblResize.top) {
  363. if (abs(otherTrbl.bottom - shapeTrbl.top) < 10) {
  364. bottomResize = shapeNewTrbl.top - otherTrbl.bottom;
  365. }
  366. if (abs(otherTrbl.top - shapeTrbl.top) < 5) {
  367. topResize = shapeNewTrbl.top - otherTrbl.top;
  368. }
  369. }
  370. if (trblResize.bottom) {
  371. if (abs(otherTrbl.top - shapeTrbl.bottom) < 10) {
  372. topResize = shapeNewTrbl.bottom - otherTrbl.top;
  373. }
  374. if (abs(otherTrbl.bottom - shapeTrbl.bottom) < 5) {
  375. bottomResize = shapeNewTrbl.bottom - otherTrbl.bottom;
  376. }
  377. }
  378. if (topResize || rightResize || bottomResize || leftResize) {
  379. resizeNeeded.push({
  380. shape: other,
  381. newBounds: resizeTRBL(other, {
  382. top: topResize,
  383. right: rightResize,
  384. bottom: bottomResize,
  385. left: leftResize
  386. })
  387. });
  388. }
  389. });
  390. return resizeNeeded;
  391. }
  392. // node_modules/.pnpm/diagram-js@13.4.0/node_modules/diagram-js/lib/util/Event.js
  393. function __stopPropagation(event) {
  394. if (!event || typeof event.stopPropagation !== "function") {
  395. return;
  396. }
  397. event.stopPropagation();
  398. }
  399. function getOriginal(event) {
  400. return event.originalEvent || event.srcEvent;
  401. }
  402. function stopPropagation(event) {
  403. __stopPropagation(event);
  404. __stopPropagation(getOriginal(event));
  405. }
  406. function toPoint(event) {
  407. if (event.pointers && event.pointers.length) {
  408. event = event.pointers[0];
  409. }
  410. if (event.touches && event.touches.length) {
  411. event = event.touches[0];
  412. }
  413. return event ? {
  414. x: event.clientX,
  415. y: event.clientY
  416. } : null;
  417. }
  418. // node_modules/.pnpm/diagram-js@13.4.0/node_modules/diagram-js/lib/util/Platform.js
  419. function isMac() {
  420. return /mac/i.test(navigator.platform);
  421. }
  422. // node_modules/.pnpm/diagram-js@13.4.0/node_modules/diagram-js/lib/util/Mouse.js
  423. function isButton(event, button) {
  424. return (getOriginal(event) || event).button === button;
  425. }
  426. function isPrimaryButton(event) {
  427. return isButton(event, 0);
  428. }
  429. function isAuxiliaryButton(event) {
  430. return isButton(event, 1);
  431. }
  432. function hasPrimaryModifier(event) {
  433. var originalEvent = getOriginal(event) || event;
  434. if (!isPrimaryButton(event)) {
  435. return false;
  436. }
  437. if (isMac()) {
  438. return originalEvent.metaKey;
  439. } else {
  440. return originalEvent.ctrlKey;
  441. }
  442. }
  443. function hasSecondaryModifier(event) {
  444. var originalEvent = getOriginal(event) || event;
  445. return isPrimaryButton(event) && originalEvent.shiftKey;
  446. }
  447. // node_modules/.pnpm/bpmn-js@16.3.2/node_modules/bpmn-js/lib/features/context-pad/ContextPadProvider.js
  448. function ContextPadProvider(config, injector, eventBus, contextPad, modeling, elementFactory, connect, create, popupMenu, canvas, rules, translate, appendPreview) {
  449. config = config || {};
  450. contextPad.registerProvider(this);
  451. this._contextPad = contextPad;
  452. this._modeling = modeling;
  453. this._elementFactory = elementFactory;
  454. this._connect = connect;
  455. this._create = create;
  456. this._popupMenu = popupMenu;
  457. this._canvas = canvas;
  458. this._rules = rules;
  459. this._translate = translate;
  460. this._eventBus = eventBus;
  461. this._appendPreview = appendPreview;
  462. if (config.autoPlace !== false) {
  463. this._autoPlace = injector.get("autoPlace", false);
  464. }
  465. eventBus.on("create.end", 250, function(event) {
  466. var context = event.context, shape = context.shape;
  467. if (!hasPrimaryModifier(event) || !contextPad.isOpen(shape)) {
  468. return;
  469. }
  470. var entries = contextPad.getEntries(shape);
  471. if (entries.replace) {
  472. entries.replace.action.click(event, shape);
  473. }
  474. });
  475. }
  476. ContextPadProvider.$inject = [
  477. "config.contextPad",
  478. "injector",
  479. "eventBus",
  480. "contextPad",
  481. "modeling",
  482. "elementFactory",
  483. "connect",
  484. "create",
  485. "popupMenu",
  486. "canvas",
  487. "rules",
  488. "translate",
  489. "appendPreview"
  490. ];
  491. ContextPadProvider.prototype.getMultiElementContextPadEntries = function(elements) {
  492. var modeling = this._modeling;
  493. var actions = {};
  494. if (this._isDeleteAllowed(elements)) {
  495. assign(actions, {
  496. "delete": {
  497. group: "edit",
  498. className: "bpmn-icon-trash",
  499. title: this._translate("Remove"),
  500. action: {
  501. click: function(event, elements2) {
  502. modeling.removeElements(elements2.slice());
  503. }
  504. }
  505. }
  506. });
  507. }
  508. return actions;
  509. };
  510. ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
  511. var baseAllowed = this._rules.allowed("elements.delete", {
  512. elements
  513. });
  514. if (isArray(baseAllowed)) {
  515. return every(baseAllowed, function(element) {
  516. return includes(baseAllowed, element);
  517. });
  518. }
  519. return baseAllowed;
  520. };
  521. ContextPadProvider.prototype.getContextPadEntries = function(element) {
  522. var contextPad = this._contextPad, modeling = this._modeling, elementFactory = this._elementFactory, connect = this._connect, create = this._create, popupMenu = this._popupMenu, rules = this._rules, autoPlace = this._autoPlace, translate = this._translate, appendPreview = this._appendPreview;
  523. var actions = {};
  524. if (element.type === "label") {
  525. return actions;
  526. }
  527. var businessObject = element.businessObject;
  528. function startConnect(event, element2) {
  529. connect.start(event, element2);
  530. }
  531. function removeElement(e, element2) {
  532. modeling.removeElements([element2]);
  533. }
  534. function getReplaceMenuPosition(element2) {
  535. var Y_OFFSET = 5;
  536. var pad = contextPad.getPad(element2).html;
  537. var padRect = pad.getBoundingClientRect();
  538. var pos = {
  539. x: padRect.left,
  540. y: padRect.bottom + Y_OFFSET
  541. };
  542. return pos;
  543. }
  544. function appendAction(type, className, title, options) {
  545. function appendStart(event, element2) {
  546. var shape = elementFactory.createShape(assign({ type }, options));
  547. create.start(event, shape, {
  548. source: element2
  549. });
  550. appendPreview.cleanUp();
  551. }
  552. var append = autoPlace ? function(_, element2) {
  553. var shape = elementFactory.createShape(assign({ type }, options));
  554. autoPlace.append(element2, shape);
  555. appendPreview.cleanUp();
  556. } : appendStart;
  557. var previewAppend = autoPlace ? function(_, element2) {
  558. appendPreview.create(element2, type, options);
  559. return () => {
  560. appendPreview.cleanUp();
  561. };
  562. } : null;
  563. return {
  564. group: "model",
  565. className,
  566. title,
  567. action: {
  568. dragstart: appendStart,
  569. click: append,
  570. hover: previewAppend
  571. }
  572. };
  573. }
  574. function splitLaneHandler(count) {
  575. return function(_, element2) {
  576. modeling.splitLane(element2, count);
  577. contextPad.open(element2, true);
  578. };
  579. }
  580. if (isAny(businessObject, ["bpmn:Lane", "bpmn:Participant"]) && isExpanded(element)) {
  581. var childLanes = getChildLanes(element);
  582. assign(actions, {
  583. "lane-insert-above": {
  584. group: "lane-insert-above",
  585. className: "bpmn-icon-lane-insert-above",
  586. title: translate("Add lane above"),
  587. action: {
  588. click: function(event, element2) {
  589. modeling.addLane(element2, "top");
  590. }
  591. }
  592. }
  593. });
  594. if (childLanes.length < 2) {
  595. if (element.height >= 120) {
  596. assign(actions, {
  597. "lane-divide-two": {
  598. group: "lane-divide",
  599. className: "bpmn-icon-lane-divide-two",
  600. title: translate("Divide into two lanes"),
  601. action: {
  602. click: splitLaneHandler(2)
  603. }
  604. }
  605. });
  606. }
  607. if (element.height >= 180) {
  608. assign(actions, {
  609. "lane-divide-three": {
  610. group: "lane-divide",
  611. className: "bpmn-icon-lane-divide-three",
  612. title: translate("Divide into three lanes"),
  613. action: {
  614. click: splitLaneHandler(3)
  615. }
  616. }
  617. });
  618. }
  619. }
  620. assign(actions, {
  621. "lane-insert-below": {
  622. group: "lane-insert-below",
  623. className: "bpmn-icon-lane-insert-below",
  624. title: translate("Add lane below"),
  625. action: {
  626. click: function(event, element2) {
  627. modeling.addLane(element2, "bottom");
  628. }
  629. }
  630. }
  631. });
  632. }
  633. if (is(businessObject, "bpmn:FlowNode")) {
  634. if (is(businessObject, "bpmn:EventBasedGateway")) {
  635. assign(actions, {
  636. "append.receive-task": appendAction(
  637. "bpmn:ReceiveTask",
  638. "bpmn-icon-receive-task",
  639. translate("Append receive task")
  640. ),
  641. "append.message-intermediate-event": appendAction(
  642. "bpmn:IntermediateCatchEvent",
  643. "bpmn-icon-intermediate-event-catch-message",
  644. translate("Append message intermediate catch event"),
  645. { eventDefinitionType: "bpmn:MessageEventDefinition" }
  646. ),
  647. "append.timer-intermediate-event": appendAction(
  648. "bpmn:IntermediateCatchEvent",
  649. "bpmn-icon-intermediate-event-catch-timer",
  650. translate("Append timer intermediate catch event"),
  651. { eventDefinitionType: "bpmn:TimerEventDefinition" }
  652. ),
  653. "append.condition-intermediate-event": appendAction(
  654. "bpmn:IntermediateCatchEvent",
  655. "bpmn-icon-intermediate-event-catch-condition",
  656. translate("Append conditional intermediate catch event"),
  657. { eventDefinitionType: "bpmn:ConditionalEventDefinition" }
  658. ),
  659. "append.signal-intermediate-event": appendAction(
  660. "bpmn:IntermediateCatchEvent",
  661. "bpmn-icon-intermediate-event-catch-signal",
  662. translate("Append signal intermediate catch event"),
  663. { eventDefinitionType: "bpmn:SignalEventDefinition" }
  664. )
  665. });
  666. } else if (isEventType(businessObject, "bpmn:BoundaryEvent", "bpmn:CompensateEventDefinition")) {
  667. assign(actions, {
  668. "append.compensation-activity": appendAction(
  669. "bpmn:Task",
  670. "bpmn-icon-task",
  671. translate("Append compensation activity"),
  672. {
  673. isForCompensation: true
  674. }
  675. )
  676. });
  677. } else if (!is(businessObject, "bpmn:EndEvent") && !businessObject.isForCompensation && !isEventType(businessObject, "bpmn:IntermediateThrowEvent", "bpmn:LinkEventDefinition") && !isEventSubProcess(businessObject)) {
  678. assign(actions, {
  679. "append.end-event": appendAction(
  680. "bpmn:EndEvent",
  681. "bpmn-icon-end-event-none",
  682. translate("Append end event")
  683. ),
  684. "append.gateway": appendAction(
  685. "bpmn:ExclusiveGateway",
  686. "bpmn-icon-gateway-none",
  687. translate("Append gateway")
  688. ),
  689. "append.append-task": appendAction(
  690. "bpmn:Task",
  691. "bpmn-icon-task",
  692. translate("Append task")
  693. ),
  694. "append.intermediate-event": appendAction(
  695. "bpmn:IntermediateThrowEvent",
  696. "bpmn-icon-intermediate-event-none",
  697. translate("Append intermediate/boundary event")
  698. )
  699. });
  700. }
  701. }
  702. if (!popupMenu.isEmpty(element, "bpmn-replace")) {
  703. assign(actions, {
  704. "replace": {
  705. group: "edit",
  706. className: "bpmn-icon-screw-wrench",
  707. title: translate("Change type"),
  708. action: {
  709. click: function(event, element2) {
  710. var position = assign(getReplaceMenuPosition(element2), {
  711. cursor: { x: event.x, y: event.y }
  712. });
  713. popupMenu.open(element2, "bpmn-replace", position, {
  714. title: translate("Change element"),
  715. width: 300,
  716. search: true
  717. });
  718. }
  719. }
  720. }
  721. });
  722. }
  723. if (is(businessObject, "bpmn:SequenceFlow")) {
  724. assign(actions, {
  725. "append.text-annotation": appendAction(
  726. "bpmn:TextAnnotation",
  727. "bpmn-icon-text-annotation",
  728. translate("Append text annotation")
  729. )
  730. });
  731. }
  732. if (isAny(businessObject, [
  733. "bpmn:FlowNode",
  734. "bpmn:InteractionNode",
  735. "bpmn:DataObjectReference",
  736. "bpmn:DataStoreReference"
  737. ])) {
  738. assign(actions, {
  739. "append.text-annotation": appendAction(
  740. "bpmn:TextAnnotation",
  741. "bpmn-icon-text-annotation",
  742. translate("Append text annotation")
  743. ),
  744. "connect": {
  745. group: "connect",
  746. className: "bpmn-icon-connection-multi",
  747. title: translate(
  748. "Connect using " + (businessObject.isForCompensation ? "" : "sequence/message flow or ") + "association"
  749. ),
  750. action: {
  751. click: startConnect,
  752. dragstart: startConnect
  753. }
  754. }
  755. });
  756. }
  757. if (is(businessObject, "bpmn:TextAnnotation")) {
  758. assign(actions, {
  759. "connect": {
  760. group: "connect",
  761. className: "bpmn-icon-connection-multi",
  762. title: translate("Connect using association"),
  763. action: {
  764. click: startConnect,
  765. dragstart: startConnect
  766. }
  767. }
  768. });
  769. }
  770. if (isAny(businessObject, ["bpmn:DataObjectReference", "bpmn:DataStoreReference"])) {
  771. assign(actions, {
  772. "connect": {
  773. group: "connect",
  774. className: "bpmn-icon-connection-multi",
  775. title: translate("Connect using data input association"),
  776. action: {
  777. click: startConnect,
  778. dragstart: startConnect
  779. }
  780. }
  781. });
  782. }
  783. if (is(businessObject, "bpmn:Group")) {
  784. assign(actions, {
  785. "append.text-annotation": appendAction(
  786. "bpmn:TextAnnotation",
  787. "bpmn-icon-text-annotation",
  788. translate("Append text annotation")
  789. )
  790. });
  791. }
  792. var deleteAllowed = rules.allowed("elements.delete", { elements: [element] });
  793. if (isArray(deleteAllowed)) {
  794. deleteAllowed = deleteAllowed[0] === element;
  795. }
  796. if (deleteAllowed) {
  797. assign(actions, {
  798. "delete": {
  799. group: "edit",
  800. className: "bpmn-icon-trash",
  801. title: translate("Remove"),
  802. action: {
  803. click: removeElement
  804. }
  805. }
  806. });
  807. }
  808. return actions;
  809. };
  810. function isEventType(businessObject, type, eventDefinitionType) {
  811. var isType = businessObject.$instanceOf(type);
  812. var isDefinition = false;
  813. var definitions = businessObject.eventDefinitions || [];
  814. forEach(definitions, function(def) {
  815. if (def.$type === eventDefinitionType) {
  816. isDefinition = true;
  817. }
  818. });
  819. return isType && isDefinition;
  820. }
  821. function includes(array, item) {
  822. return array.indexOf(item) !== -1;
  823. }
  824. export {
  825. getParents,
  826. eachElement,
  827. selfAndAllChildren,
  828. getClosure,
  829. getBBox,
  830. getEnclosedElements,
  831. getType,
  832. isFrameElement,
  833. substractTRBL,
  834. resizeBounds,
  835. ensureConstraints,
  836. getMinResizeBounds,
  837. computeChildrenBBox,
  838. LANE_INDENTATION,
  839. collectLanes,
  840. getChildLanes,
  841. getLanesRoot,
  842. computeLanesResize,
  843. getOriginal,
  844. stopPropagation,
  845. toPoint,
  846. isMac,
  847. isPrimaryButton,
  848. isAuxiliaryButton,
  849. hasPrimaryModifier,
  850. hasSecondaryModifier,
  851. ContextPadProvider
  852. };
  853. //# sourceMappingURL=chunk-KSLPIYOU.js.map