bpmn-js 0.30.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/bpmn-modeler.development.js +38 -28
- package/dist/bpmn-modeler.production.min.js +2 -2
- package/dist/bpmn-navigated-viewer.development.js +38 -28
- package/dist/bpmn-navigated-viewer.production.min.js +2 -2
- package/dist/bpmn-viewer.development.js +38 -28
- package/dist/bpmn-viewer.production.min.js +2 -2
- package/package.json +6 -6
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! bpmn-js - bpmn-modeler v0.
|
|
2
|
-
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).BpmnJS=e()}}(function(){var e,t,n={exports:{}};e=this,t=function(e){"use strict";function t(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(e){}return e}function n(e,n){return n.appendChild(t(e,n)),e}var i=2,r={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":i,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":i,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function o(e,t,n){var o=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),a=r[o];a?(a===i&&"number"==typeof n&&(n=String(n)+"px"),e.style[o]=n):e.setAttributeNS(null,t,n)}function a(e,t,n){if("string"==typeof t){if(void 0===n)return function(e,t){return r[t]?e.style[t]:e.getAttributeNS(null,t)}(e,t);o(e,t,n)}else!function(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)o(e,i,t[i])}(e,t);return e}function s(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}var c=/\s+/,p=Object.prototype.toString;function l(e){return void 0!==e}function u(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function h(e){var t=e.parentNode;return t&&t.removeChild(e),e}function d(e){for(var t;t=e.firstChild;)h(t);return e}u.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~s(t,e)||t.push(e),l(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},u.prototype.remove=function(e){if("[object RegExp]"===p.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=s(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},u.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},u.prototype.toggle=function(e,t){return this.list?(l(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(l(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},u.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(c);return""===e[0]&&e.shift(),e},u.prototype.has=u.prototype.contains=function(e){return this.list?this.list.contains(e):!!~s(this.array(),e)};var m={svg:"http://www.w3.org/2000/svg"},f='<svg xmlns="'+m.svg+'"';function y(e){return"<svg"===e.substring(0,4)?-1===e.indexOf(m.svg)&&(e=f+e.substring(4)):e=f+">"+e+"</svg>",function(e){var t;return(t=new DOMParser).async=!1,t.parseFromString(e,"text/xml")}(e)}function v(e,t){var n;return"<"===e.charAt(0)?(n=y(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(m.svg,e),t&&a(n,t),n}var g=v("svg");function b(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}var x=/([&<>]{1})/g,E=/([\n\r"]{1})/g,_={"&":"&","<":"<",">":">",'"':"'"};function w(e,t){return e.replace(t,function(e,t){return _[t]||t})}function S(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(w(e.textContent,x));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,i=(r=e.attributes).length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',w(o.value,E),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,i=(a=e.childNodes).length;n<i;++n)S(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",w(e.nodeValue,x),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function T(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}e.append=function(e,t){return n(t,e),e},e.attr=a,e.classes=function(e){return new u(e)},e.clear=d,e.clone=function(e){return e.cloneNode(!0)},e.create=v,e.innerSVG=function(e,t){if(void 0!==t){try{!function(e,t){var i,r=y(t).documentElement;if(d(e),t)for(i=r.firstChild;i;)n(i,e),i=i.nextSibling}(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}return function(e){for(var t=e.firstChild,n=[];t;)S(t,n),t=t.nextSibling;return n.join("")}(e)},e.remove=h,e.transform=function(e,t){var n=e.transform.baseVal;if(1===arguments.length)return n.consolidate();t.length?function(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(T(e,i));e.consolidate()}(n,t):n.initialize(T(n,t))},e.createMatrix=function(e,t,n,i,r,o){var a=g.createSVGMatrix();switch(arguments.length){case 0:return a;case 6:e={a:e,b:t,c:n,d:i,e:r,f:o}}return b(a,e)},e.createTransform=function(e){return e?g.createSVGTransformFromMatrix(e):g.createSVGTransform()},Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof n.exports?t(n.exports):t(e.TinySVG={});var i={},r=(n=n.exports).attr,o=n.create;function a(e){for(var t,n="",i=0;t=e[i];i++)n+=t.x+","+t.y+" ";return n}i.componentsToPath=function(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")},i.createLine=function(e,t){var n=o("polyline");return r(n,{points:a(e)}),t&&r(n,t),n},i.updateLine=function(e,t){return r(e,{points:a(t)}),e};var s={exports:{}};!function(e,t){"object"==typeof s.exports?t(s.exports):t(e.MinDash={})}(this,function(e){"use strict";var t=Object.prototype.toString,n=Object.prototype.hasOwnProperty;function i(e){return null==e}function r(e){return"[object Array]"===t.call(e)}function o(e){return"[object Object]"===t.call(e)}function a(e){return"[object Function]"===t.call(e)}function s(e){if(!r(e))throw new Error("must supply array")}function c(e,t){return n.call(e,t)}function p(e,t){var n;return t=b(t),l(e,function(e,i){if(t(e,i))return n=e,!1}),n}function l(e,t){if(!i(e)){var n=r(e)?E:x;for(var o in e){if(c(e,o))if(!1===t(e[o],n(o)))return}}}function u(e,t,n){return l(e,function(e,i){n=t(n,e,i)}),n}function h(e,t){return u(e,function(e,n,i){return e&&t(n,i)},!0)}function d(e,t){var n=[];return l(e,function(e,i){n.push(t(e,i))}),n}function m(e){return e&&Object.keys(e)||[]}function f(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=g(t),l(e,function(e){var i=t(e)||"_",r=n[i];r||(r=n[i]=[]),r.push(e)}),n}function y(e){e=g(e);for(var t={},n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return l(i,function(n){return f(n,e,t)}),d(t,function(e,t){return e[0]})}var v=y;function g(e){return a(e)?e:function(t){return t[e]}}function b(e){return a(e)?e:function(t){return t===e}}function x(e){return e}function E(e){return Number(e)}var _=Array.prototype.slice;var w=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};e.flatten=function(e){return Array.prototype.concat.apply([],e)},e.find=p,e.findIndex=function(e,t){t=b(t);var n=r(e)?-1:void 0;return l(e,function(e,i){if(t(e,i))return n=i,!1}),n},e.filter=function(e,t){var n=[];return l(e,function(e,i){t(e,i)&&n.push(e)}),n},e.forEach=l,e.without=function(e,t){return i(e)?[]:(s(e),t=b(t),e.filter(function(e,n){return!t(e,n)}))},e.reduce=u,e.every=h,e.some=function(e,t){return!!p(e,t)},e.map=d,e.keys=m,e.size=function(e){return m(e).length},e.values=function(e){return d(e,function(e){return e})},e.groupBy=f,e.uniqueBy=y,e.unionBy=v,e.sortBy=function(e,t){t=g(t);var n=[];return l(e,function(e,i){for(var r=t(e,i),o={d:r,v:e},a=0;a<n.length;a++)if(r<n[a].d)return void n.splice(a,0,o);n.push(o)}),d(n,function(e){return e.v})},e.matchPattern=function(e){return function(t){return h(e,function(e,n){return t[n]===e})}},e.debounce=function(e,t){var n;return function(){var i=_.call(arguments);n&&clearTimeout(n),n=setTimeout(function(){e.apply(void 0,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(i))},t)}},e.bind=function(e,t){return e.bind(t)},e.isArray=r,e.isObject=o,e.isNumber=function(e){return"[object Number]"===t.call(e)},e.isFunction=a,e.isString=function(e){return"[object String]"===t.call(e)},e.has=c,e.assign=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return w.apply(void 0,[e].concat(n))},e.pick=function(e,t){var n={},i=Object(e);return l(t,function(t){t in i&&(n[t]=e[t])}),n},e.omit=function(e,t){var n={};return l(Object(e),function(e,i){-1===t.indexOf(i)&&(n[i]=e)}),n},Object.defineProperty(e,"__esModule",{value:!0})});var c={},p=(s=s.exports).every,l=s.some,u=i.componentsToPath;function h(e){return e.businessObject.di}c.isTypedEvent=function(e,t,n){return l(e.eventDefinitions,function(i){return i.$type===t&&function(e,t){return p(t,function(t,n){return e[n]==t})}(e,n)})},c.isThrowEvent=function(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type},c.isCollection=function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection},c.getDi=h,c.getSemantic=function(e){return e.businessObject},c.getFillColor=function(e,t){return h(e).get("bioc:fill")||t||"white"},c.getStrokeColor=function(e,t){return h(e).get("bioc:stroke")||t||"black"},c.getCirclePath=function(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2;return u([["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]])},c.getRoundRectPath=function(e,t){var n=e.x,i=e.y,r=e.width,o=e.height;return u([["M",n+t,i],["l",r-2*t,0],["a",t,t,0,0,1,t,t],["l",0,o-2*t],["a",t,t,0,0,1,-t,t],["l",2*t-r,0],["a",t,t,0,0,1,-t,-t],["l",0,2*t-o],["a",t,t,0,0,1,t,-t],["z"]])},c.getDiamondPath=function(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2;return u([["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]])},c.getRectPath=function(e){var t=e.x,n=e.y,i=e.width,r=e.height;return u([["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]])};var d={};function m(e){return e&&e.businessObject||e}d.is=function(e,t){var n=m(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)},d.getBusinessObject=m;var f={},y=d.is,v=d.getBusinessObject,g=s.forEach;function b(e,t){var n=v(e),i=!1;return n.eventDefinitions&&g(n.eventDefinitions,function(e){y(e,t)&&(i=!0)}),i}f.isExpanded=function(e){return!y(e,"bpmn:CallActivity")&&(y(e,"bpmn:SubProcess")?!!v(e).di.isExpanded:!y(e,"bpmn:Participant")||!!v(e).processRef)},f.isInterrupting=function(e){return e&&!1!==v(e).isInterrupting},f.isEventSubProcess=function(e){return e&&!!v(e).triggeredByEvent},f.hasErrorEventDefinition=function(e){return b(e,"bpmn:ErrorEventDefinition")},f.hasEscalationEventDefinition=function(e){return b(e,"bpmn:EscalationEventDefinition")},f.hasCompensateEventDefinition=function(e){return b(e,"bpmn:CompensateEventDefinition")};var x=1e3;function E(e,t){var n=this;t=t||x,e.on(["render.shape","render.connection"],t,function(e,t){var i=e.type,r=t.element,o=t.gfx;if(n.canRender(r))return"render.shape"===i?n.drawShape(o,r):n.drawConnection(o,r)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(e,t){if(n.canRender(t))return"render.getShapePath"===e.type?n.getShapePath(t):n.getConnectionPath(t)})}E.prototype.canRender=function(){},E.prototype.drawShape=function(){},E.prototype.drawConnection=function(){},E.prototype.getShapePath=function(){},E.prototype.getConnectionPath=function(){};var _=E,w={},S=n.transform,T=n.createTransform;w.transform=function(e,t,n,i,r){var o=T();o.setTranslate(t,n);var a=T();a.setRotate(i,0,0);var s=T();s.setScale(r||1,r||1),S(e,[o,a,s])},w.translate=function(e,t,n){var i=T();i.setTranslate(t,n),S(e,i)},w.rotate=function(e,t){var n=T();n.setRotate(t,0,0),S(e,n)};var C=s.isObject,A=s.assign,R=s.pick,P=s.forEach,M=s.reduce,k=n.append,B=n.attr,N=n.create,D=n.remove,O=0,L={width:150,height:50};function I(e,t){t.textContent=e;try{var n,i=""===e;return t.textContent=i?"dummy":e,n=R(t.getBBox(),["width","height"]),i&&(n.width=0),n}catch(e){return{width:0,height:0}}}function j(e,t,n){for(var i,r=e.shift(),o=r;;){if((i=I(o,n)).width=o?i.width:0," "===o||""===o||i.width<Math.round(t)||o.length<2)return z(e,o,r,i);o=F(o,i.width,t)}}function z(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}function F(e,t,n){var i=Math.max(e.length*(n/t),1),r=function(e,t){var n,i=e.split(/(\s|-)/g),r=[],o=0;if(i.length>1)for(;n=i.shift();){if(!(n.length+o<t)){"-"===n&&r.pop();break}r.push(n),o+=n.length}return r.join("")}(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function $(e){this._config=A({},{size:L,padding:O,style:{},align:"center-top"},e||{})}$.prototype.createText=function(e,t){return this.layoutText(e,t).element},$.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},$.prototype.layoutText=function(e,t){var n=A({},this._config.size,t.box),i=A({},this._config.style,t.style),r=function(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}(t.align||this._config.align),o=function(e){return C(e)?A({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}(void 0!==t.padding?t.padding:this._config.padding),a=t.fitBox||!1,s=e.split(/\r?\n/g),c=[],p=n.width-o.left-o.right,l=N("text");B(l,{x:0,y:0}),B(l,i);var u=function(){var e=document.getElementById("helper-svg");return e||(e=N("svg"),B(e,{id:"helper-svg",width:0,height:0,style:"visibility: hidden; position: fixed"}),document.body.appendChild(e)),e}();for(k(u,l);s.length;)c.push(j(s,p,l));var h,d,m=M(c,function(e,t,n){return e+t.height},0),f=M(c,function(e,t,n){return t.width>e?t.width:e},0);switch(r.vertical){case"middle":h=(n.height-m)/2-c[0].height/4;break;default:h=o.top}var y=N("text");return B(y,i),P(c,function(e){switch(h+=e.height,r.horizontal){case"left":d=o.left;break;case"right":d=(a?f:p)-o.right-e.width;break;default:d=Math.max(((a?f:p)-e.width)/2+o.left,0)}var t=N("tspan");B(t,{x:d,y:h}),t.textContent=e.text,k(y,t)}),D(l),{dimensions:{width:f,height:m},element:y}};var G=$,W={},H=W=function(e,t){if(t||(t=16),void 0===e&&(e=128),e<=0)return"0";for(var n=Math.log(Math.pow(2,e))/Math.log(t),i=2;n===1/0;i*=2)n=Math.log(Math.pow(2,e/i))/Math.log(t)*i;var r=n-Math.floor(n),o="";for(i=0;i<Math.floor(n);i++){o=Math.floor(Math.random()*t).toString(t)+o}if(r){var a=Math.pow(t,r);o=Math.floor(Math.random()*a).toString(t)+o}var s=parseInt(o,t);return s!==1/0&&s>=Math.pow(2,e)?H(e,t):o};function V(e){if(!(this instanceof V))return new V(e);e=e||[128,36,1],this._seed=e.length?W.rack(e[0],e[1],e[2]):e}H.rack=function(e,t,n){var i=function(i){var o=0;do{if(o++>10){if(!n)throw new Error("too many ID collisions, use more bits");e+=n}var a=H(e,t)}while(Object.hasOwnProperty.call(r,a));return r[a]=i,a},r=i.hats={};return i.get=function(e){return i.hats[e]},i.set=function(e,t){return i.hats[e]=t,i},i.bits=e||128,i.base=t||16,i};var q=V;V.prototype.next=function(e){return this._seed(e||!0)},V.prototype.nextPrefixed=function(e,t){var n;do{n=e+this.next(!0)}while(this.assigned(n));return this.claim(n,t),n},V.prototype.claim=function(e,t){this._seed.set(e,t||!0)},V.prototype.assigned=function(e){return this._seed.get(e)||!1},V.prototype.unclaim=function(e){delete this._seed.hats[e]},V.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};var U={};U="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};var Y={exports:{}};!function(e,t){"object"==typeof Y.exports?t(Y.exports):t(e.MinDom={})}(this,function(e){"use strict";var t=[].indexOf,n=function(e,n){if(t)return e.indexOf(n);for(var i=0;i<e.length;++i)if(e[i]===n)return i;return-1},i=/\s+/,r=Object.prototype.toString;function o(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}o.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~n(t,e)||t.push(e),this.el.className=t.join(" "),this},o.prototype.remove=function(e){if("[object RegExp]"==r.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),i=n(t,e);return~i&&t.splice(i,1),this.el.className=t.join(" "),this},o.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},o.prototype.toggle=function(e,t){return this.list?(void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},o.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(i);return""===e[0]&&e.shift(),e},o.prototype.has=o.prototype.contains=function(e){return this.list?this.list.contains(e):!!~n(this.array(),e)};var a=Element.prototype,s=a.matchesSelector||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector,c=function(e,t){if(s)return s.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;++i)if(n[i]==e)return!0;return!1};var p,l=function(e,t,n){for(var i=n?e:e.parentNode;i&&i!==document;){if(c(i,t))return i;i=i.parentNode}},u=window.addEventListener?"addEventListener":"attachEvent",h=window.removeEventListener?"removeEventListener":"detachEvent",d="addEventListener"!==u?"on":"",m={bind:function(e,t,n,i){return e[u](d+t,n,i||!1),n},unbind:function(e,t,n,i){return e[h](d+t,n,i||!1),n}},f=["focus","blur"],y={bind:function(e,t,n,i,r){return-1!==f.indexOf(n)&&(r=!0),m.bind(e,n,function(n){var r=n.target||n.srcElement;n.delegateTarget=l(r,t,!0),n.delegateTarget&&i.call(e,n)},r)},unbind:function(e,t,n,i){-1!==f.indexOf(t)&&(i=!0),m.unbind(e,t,n,i)}},v=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var i=n[1];if("body"==i){var r=t.createElement("html");return r.innerHTML=e,r.removeChild(r.lastChild)}var o=b[i]||b._default,a=o[0],s=o[1],c=o[2];(r=t.createElement("div")).innerHTML=s+e+c;for(;a--;)r=r.lastChild;if(r.firstChild==r.lastChild)return r.removeChild(r.firstChild);var p=t.createDocumentFragment();for(;r.firstChild;)p.appendChild(r.removeChild(r.firstChild));return p},g=!1;"undefined"!=typeof document&&((p=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',g=!p.getElementsByTagName("link").length,p=void 0);var b={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:g?[1,"X<div>","</div>"]:[0,"",""]};b.td=b.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],b.option=b.optgroup=[1,'<select multiple="multiple">',"</select>"],b.thead=b.tbody=b.colgroup=b.caption=b.tfoot=[1,"<table>","</table>"],b.polyline=b.ellipse=b.polygon=b.circle=b.text=b.line=b.path=b.rect=b.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var x="undefined"!=typeof Element?Element.prototype:{},E=x.matches||x.matchesSelector||x.webkitMatchesSelector||x.mozMatchesSelector||x.msMatchesSelector||x.oMatchesSelector,_=function(e,t){if(!e||1!==e.nodeType)return!1;if(E)return E.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;i++)if(n[i]==e)return!0;return!1};e.attr=function(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)},e.classes=function(e){return new o(e)},e.clear=function(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e},e.closest=l,e.delegate=y,e.domify=v,e.event=m,e.matches=_,e.query=function(e,t){return(t=t||document).querySelector(e)},e.queryAll=function(e,t){return(t=t||document).querySelectorAll(e)},e.remove=function(e){e.parentNode&&e.parentNode.removeChild(e)},Object.defineProperty(e,"__esModule",{value:!0})}),Y=Y.exports;var K=s.isObject,X=s.assign,Z=s.forEach,Q=d.is,J=i.createLine,ee=c.isTypedEvent,te=c.isThrowEvent,ne=c.isCollection,ie=c.getDi,re=c.getSemantic,oe=c.getCirclePath,ae=c.getRoundRectPath,se=c.getDiamondPath,ce=c.getRectPath,pe=c.getFillColor,le=c.getStrokeColor,ue=Y.query,he=n.append,de=n.attr,me=n.create,fe=n.classes,ye=w.rotate,ve=w.transform,ge=w.translate,be=new q,xe=10,Ee=3,_e={fontFamily:"Arial, sans-serif",fontSize:12},we=.95,Se=.35;function Te(e,t,n,i,r){_.call(this,e,r);var o=be.next(),a=new G({style:_e,size:{width:100}}),s={},c=t.computeStyle;function p(e,t){var n=X({fill:"black",strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),r=t.ref||{x:0,y:0},o=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var a=me("marker");de(t.element,n),he(a,t.element),de(a,{id:e,viewBox:"0 0 20 20",refX:r.x,refY:r.y,markerWidth:20*o,markerHeight:20*o,orient:"auto"});var c=ue("defs",i._svg);c||(c=me("defs"),he(i._svg,c)),he(c,a),s[e]=a}function l(e,t,n){var i=e+"-"+t+"-"+n+"-"+o;return s[i]||function(e,t,n){var i=e+"-"+t+"-"+n+"-"+o;if("sequenceflow-end"===e){var r=me("path");de(r,{d:"M 1 5 L 11 10 L 1 15 Z"}),p(i,{element:r,ref:{x:11,y:10},scale:.5,attrs:{fill:n,stroke:n}})}if("messageflow-start"===e){var a=me("circle");de(a,{cx:6,cy:6,r:3.5}),p(i,{element:a,attrs:{fill:t,stroke:n},ref:{x:6,y:6}})}if("messageflow-end"===e){var s=me("path");de(s,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),p(i,{element:s,attrs:{fill:t,stroke:n,strokeLinecap:"butt"},ref:{x:8.5,y:5}})}if("association-start"===e){var c=me("path");de(c,{d:"M 11 5 L 1 10 L 11 15"}),p(i,{element:c,attrs:{fill:"none",stroke:n,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}if("association-end"===e){var l=me("path");de(l,{d:"M 1 5 L 11 10 L 1 15"}),p(i,{element:l,attrs:{fill:"none",stroke:n,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}if("conditional-flow-marker"===e){var u=me("path");de(u,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),p(i,{element:u,attrs:{fill:t,stroke:n},ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===e){var h=me("path");de(h,{d:"M 6 4 L 10 16"}),p(i,{element:h,attrs:{stroke:n},ref:{x:0,y:10},scale:.5})}}(e,t,n),"url(#"+i+")"}function u(e,t,n,i,r){K(i)&&(r=i,i=0),i=i||0,r=c(r,{stroke:"black",strokeWidth:2,fill:"white"});var o=t/2,a=n/2,s=me("circle");return de(s,{cx:o,cy:a,r:Math.round((t+n)/4-i)}),de(s,r),he(e,s),s}function h(e,t,n,i,r,o){K(r)&&(o=r,r=0),r=r||0,o=c(o,{stroke:"black",strokeWidth:2,fill:"white"});var a=me("rect");return de(a,{x:r,y:r,width:t-2*r,height:n-2*r,rx:i,ry:i}),de(a,o),he(e,a),a}function d(e,t,n){n=c(n,["no-fill"],{stroke:"black",strokeWidth:2,fill:"none"});var i=J(t,n);return he(e,i),i}function m(e,t,n){n=c(n,["no-fill"],{strokeWidth:2,stroke:"black"});var i=me("path");return de(i,{d:t}),de(i,n),he(e,i),i}function y(e,t,n,i){return m(t,n,X({"data-marker":e},i))}function v(e){return function(t,n){return T[e](t,n)}}function g(e){return T[e]}function b(e,t){var n=re(e),i=te(n);return ee(n,"bpmn:MessageEventDefinition")?g("bpmn:MessageEventDefinition")(t,e,i):ee(n,"bpmn:TimerEventDefinition")?g("bpmn:TimerEventDefinition")(t,e,i):ee(n,"bpmn:ConditionalEventDefinition")?g("bpmn:ConditionalEventDefinition")(t,e):ee(n,"bpmn:SignalEventDefinition")?g("bpmn:SignalEventDefinition")(t,e,i):ee(n,"bpmn:CancelEventDefinition")&&ee(n,"bpmn:TerminateEventDefinition",{parallelMultiple:!1})?g("bpmn:MultipleEventDefinition")(t,e,i):ee(n,"bpmn:CancelEventDefinition")&&ee(n,"bpmn:TerminateEventDefinition",{parallelMultiple:!0})?g("bpmn:ParallelMultipleEventDefinition")(t,e,i):ee(n,"bpmn:EscalationEventDefinition")?g("bpmn:EscalationEventDefinition")(t,e,i):ee(n,"bpmn:LinkEventDefinition")?g("bpmn:LinkEventDefinition")(t,e,i):ee(n,"bpmn:ErrorEventDefinition")?g("bpmn:ErrorEventDefinition")(t,e,i):ee(n,"bpmn:CancelEventDefinition")?g("bpmn:CancelEventDefinition")(t,e,i):ee(n,"bpmn:CompensateEventDefinition")?g("bpmn:CompensateEventDefinition")(t,e,i):ee(n,"bpmn:TerminateEventDefinition")?g("bpmn:TerminateEventDefinition")(t,e,i):null}function x(e,t,n){var i=a.createText(t||"",n);return fe(i).add("djs-label"),he(e,i),i}function E(e,t,n){return x(e,re(t).name,{box:t,align:n,padding:5,style:{fill:le(t)}})}function w(e,t,n){var i=x(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:le(n)}}),r=-1*n.height;ve(i,0,-r,270)}function S(e){for(var t=e.waypoints,n="m "+t[0].x+","+t[0].y,i=1;i<t.length;i++)n+="L"+t[i].x+","+t[i].y+" ";return n}var T=this.handlers={"bpmn:Event":function(e,t,n){return"fillOpacity"in n||(n.fillOpacity=we),u(e,t.width,t.height,n)},"bpmn:StartEvent":function(e,t){var n={fill:pe(t),stroke:le(t)};re(t).isInterrupting||(n={strokeDasharray:"6",strokeLinecap:"round"});var i=g("bpmn:Event")(e,t,n);return b(t,e),i},"bpmn:MessageEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{strokeWidth:1,fill:i?le(t):pe(t),stroke:i?pe(t):le(t)})},"bpmn:TimerEventDefinition":function(e,t){var i=u(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:pe(t),stroke:le(t)});m(e,n.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{strokeWidth:2,strokeLinecap:"square",stroke:le(t)});for(var r=0;r<12;r++){var o=n.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),a=t.width/2;m(e,o,{strokeWidth:1,strokeLinecap:"square",transform:"rotate("+30*r+","+t.height/2+","+a+")",stroke:le(t)})}return i},"bpmn:EscalationEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:ConditionalEventDefinition":function(e,t){return m(e,n.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{strokeWidth:1,stroke:le(t)})},"bpmn:LinkEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:ErrorEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:CancelEventDefinition":function(e,t,i){var r=m(e,n.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{strokeWidth:1,fill:i?"black":"none"});return ye(r,45),r},"bpmn:CompensateEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:SignalEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:MultipleEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{strokeWidth:1,fill:i?"black":"none"})},"bpmn:ParallelMultipleEventDefinition":function(e,t){return m(e,n.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{strokeWidth:1,fill:le(t),stroke:le(t)})},"bpmn:EndEvent":function(e,t){var n=g("bpmn:Event")(e,t,{strokeWidth:4,fill:pe(t),stroke:le(t)});return b(t,e),n},"bpmn:TerminateEventDefinition":function(e,t){return u(e,t.width,t.height,8,{strokeWidth:4,fill:le(t),stroke:le(t)})},"bpmn:IntermediateEvent":function(e,t){var n=g("bpmn:Event")(e,t,{strokeWidth:1,fill:pe(t),stroke:le(t)});return u(e,t.width,t.height,Ee,{strokeWidth:1,fill:pe(t,"none"),stroke:le(t)}),b(t,e),n},"bpmn:IntermediateCatchEvent":v("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":v("bpmn:IntermediateEvent"),"bpmn:Activity":function(e,t,n){return"fillOpacity"in(n=n||{})||(n.fillOpacity=we),h(e,t.width,t.height,xe,n)},"bpmn:Task":function(e,t){var n={fill:pe(t),stroke:le(t)},i=g("bpmn:Activity")(e,t,n);return E(e,t,"center-middle"),C(e,t),i},"bpmn:ServiceTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{strokeWidth:1,fill:pe(t),stroke:le(t)}),m(e,n.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}}),{strokeWidth:0,fill:pe(t)}),m(e,n.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{strokeWidth:1,fill:pe(t),stroke:le(t)}),i},"bpmn:UserTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:pe(t),stroke:le(t)}),m(e,n.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:pe(t),stroke:le(t)}),m(e,n.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:le(t),stroke:le(t)}),i},"bpmn:ManualTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{strokeWidth:.5,fill:pe(t),stroke:le(t)}),i},"bpmn:SendTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{strokeWidth:1,fill:le(t),stroke:pe(t)}),i},"bpmn:ReceiveTask":function(e,t){var i,r=re(t),o=g("bpmn:Task")(e,t);return r.instantiate?(u(e,28,28,4.4,{strokeWidth:1}),i=n.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):i=n.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),m(e,i,{strokeWidth:1,fill:pe(t),stroke:le(t)}),o},"bpmn:ScriptTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:le(t)}),i},"bpmn:BusinessRuleTask":function(e,t){var i=g("bpmn:Task")(e,t),r=m(e,n.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}));de(r,{strokeWidth:1,fill:pe(t,"#aaaaaa"),stroke:le(t)});var o=m(e,n.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}));return de(o,{strokeWidth:1,stroke:le(t)}),i},"bpmn:SubProcess":function(e,t,n){n=X({fill:pe(t),stroke:le(t)},n);var i=g("bpmn:Activity")(e,t,n),r=f.isExpanded(t);return f.isEventSubProcess(t)&&de(i,{strokeDasharray:"1,2"}),E(e,t,r?"center-top":"center-middle"),r?C(e,t):C(e,t,["SubProcessMarker"]),i},"bpmn:AdHocSubProcess":function(e,t){return g("bpmn:SubProcess")(e,t)},"bpmn:Transaction":function(e,n){var i=g("bpmn:SubProcess")(e,n),r=t.style(["no-fill","no-events"],{stroke:le(n)});return h(e,n.width,n.height,xe-2,Ee,r),i},"bpmn:CallActivity":function(e,t){return g("bpmn:SubProcess")(e,t,{strokeWidth:5})},"bpmn:Participant":function(e,t){var n={fillOpacity:we,fill:pe(t),stroke:le(t)},i=g("bpmn:Lane")(e,t,n);f.isExpanded(t)?(d(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:le(t)}),w(e,re(t).name,t)):x(e,re(t).name,{box:t,align:"center-middle",style:{fill:le(t)}});return!!re(t).participantMultiplicity&&g("ParticipantMultiplicityMarker")(e,t),i},"bpmn:Lane":function(e,t,n){var i=h(e,t.width,t.height,0,X({fill:pe(t),fillOpacity:Se,stroke:le(t)},n)),r=re(t);"bpmn:Lane"===r.$type&&w(e,r.name,t);return i},"bpmn:InclusiveGateway":function(e,t){var n=g("bpmn:Gateway")(e,t);return u(e,t.width,t.height,.24*t.height,{strokeWidth:2.5,fill:pe(t),stroke:le(t)}),n},"bpmn:ExclusiveGateway":function(e,t){var i=g("bpmn:Gateway")(e,t),r=n.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return ie(t).isMarkerVisible&&m(e,r,{strokeWidth:1,fill:le(t),stroke:le(t)}),i},"bpmn:ComplexGateway":function(e,t){var i=g("bpmn:Gateway")(e,t);return m(e,n.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{strokeWidth:1,fill:le(t),stroke:le(t)}),i},"bpmn:ParallelGateway":function(e,t){var i=g("bpmn:Gateway")(e,t);return m(e,n.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{strokeWidth:1,fill:le(t),stroke:le(t)}),i},"bpmn:EventBasedGateway":function(e,t){var i=re(t),r=g("bpmn:Gateway")(e,t);u(e,t.width,t.height,.2*t.height,{strokeWidth:1,fill:"none",stroke:le(t)});var o=i.eventGatewayType,a=!!i.instantiate;if("Parallel"===o){var s=n.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),c=m(e,s);de(c,{strokeWidth:1,fill:"none"})}else if("Exclusive"===o){if(!a){var p=u(e,t.width,t.height,.26*t.height);de(p,{strokeWidth:1,fill:"none",stroke:le(t)})}!function(){var i=n.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}}),r={strokeWidth:2,fill:pe(t,"none"),stroke:le(t)};m(e,i,r)}()}return r},"bpmn:Gateway":function(e,t){var n={fill:pe(t),fillOpacity:we,stroke:le(t)};return function(e,t,n,i){var r=t/2,o=n/2,a=[{x:r,y:0},{x:t,y:o},{x:r,y:n},{x:0,y:o}].map(function(e){return e.x+","+e.y}).join(" ");i=c(i,{stroke:"black",strokeWidth:2,fill:"white"});var s=me("polygon");return de(s,{points:a}),de(s,i),he(e,s),s}(e,t.width,t.height,n)},"bpmn:SequenceFlow":function(e,t){var n,i=S(t),r=pe(t),o=le(t),a=m(e,i,{strokeLinejoin:"round",markerEnd:l("sequenceflow-end",r,o),stroke:le(t)}),s=re(t);return t.source&&(n=t.source.businessObject,s.conditionExpression&&n.$instanceOf("bpmn:Activity")&&de(a,{markerStart:l("conditional-flow-marker",r,o)}),n.default&&(n.$instanceOf("bpmn:Gateway")||n.$instanceOf("bpmn:Activity"))&&n.default===s&&de(a,{markerStart:l("conditional-default-flow-marker",r,o)})),a},"bpmn:Association":function(e,t,n){var i=re(t),r=pe(t),o=le(t);return n=X({strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:le(t)},n||{}),"One"!==i.associationDirection&&"Both"!==i.associationDirection||(n.markerEnd=l("association-end",r,o)),"Both"===i.associationDirection&&(n.markerStart=l("association-start",r,o)),d(e,t.waypoints,n)},"bpmn:DataInputAssociation":function(e,t){var n=pe(t),i=le(t);return g("bpmn:Association")(e,t,{markerEnd:l("association-end",n,i)})},"bpmn:DataOutputAssociation":function(e,t){var n=pe(t),i=le(t);return g("bpmn:Association")(e,t,{markerEnd:l("association-end",n,i)})},"bpmn:MessageFlow":function(e,t){var i=re(t),r=ie(t),o=pe(t),a=le(t),s=m(e,S(t),{markerEnd:l("messageflow-end",o,a),markerStart:l("messageflow-start",o,a),strokeDasharray:"10, 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px",stroke:le(t)});if(i.messageRef){var c=s.getPointAtLength(s.getTotalLength()/2),p=n.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:c.x,y:c.y}}),u={strokeWidth:1};"initiating"===r.messageVisibleKind?(u.fill="white",u.stroke="black"):(u.fill="#888",u.stroke="white"),m(e,p,u)}return s},"bpmn:DataObject":function(e,t){var i=m(e,n.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:pe(t),fillOpacity:we,stroke:le(t)}),r=re(t);return ne(r)&&function(e,t){var i=(t.height-16)/t.height,r=n.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.451,my:i}});m(e,r,{strokeWidth:2})}(e,t),i},"bpmn:DataObjectReference":v("bpmn:DataObject"),"bpmn:DataInput":function(e,t){var i=n.getRawPath("DATA_ARROW"),r=g("bpmn:DataObject")(e,t);return m(e,i,{strokeWidth:1}),r},"bpmn:DataOutput":function(e,t){var i=n.getRawPath("DATA_ARROW"),r=g("bpmn:DataObject")(e,t);return m(e,i,{strokeWidth:1,fill:"black"}),r},"bpmn:DataStoreReference":function(e,t){return m(e,n.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{strokeWidth:2,fill:pe(t),fillOpacity:we,stroke:le(t)})},"bpmn:BoundaryEvent":function(e,t){var n=re(t).cancelActivity,i={strokeWidth:1,fill:pe(t),stroke:le(t),fillOpacity:1};n||(i.strokeDasharray="6",i.strokeLinecap="round");var r=g("bpmn:Event")(e,t,i);return u(e,t.width,t.height,Ee,X(i,{fill:"none"})),b(t,e),r},"bpmn:Group":function(e,t){return h(e,t.width,t.height,xe,{strokeWidth:1,strokeDasharray:"8,3,1,3",fill:"none",pointerEvents:"none"})},label:function(e,t){return function(e,t){var n=re(t),i={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return x(e,n.name,{box:i,fitBox:!0,style:{fontSize:"11px"}})}(e,t)},"bpmn:TextAnnotation":function(e,t){var i=h(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return m(e,n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:le(t)}),x(e,re(t).text||"",{box:t,align:"left-top",padding:5}),i},ParticipantMultiplicityMarker:function(e,t){y("participant-multiplicity",e,n.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:t.width/2/t.width,my:(t.height-15)/t.height}}))},SubProcessMarker:function(e,t){var i=h(e,14,14,0,{strokeWidth:1,fill:pe(t),stroke:le(t)});ge(i,t.width/2-7.5,t.height-20),y("sub-process",e,n.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2-7.5)/t.width,my:(t.height-20)/t.height}}),{fill:pe(t),stroke:le(t)})},ParallelMarker:function(e,t,i){y("parallel",e,n.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.parallel)/t.width,my:(t.height-20)/t.height}}))},SequentialMarker:function(e,t,i){y("sequential",e,n.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.seq)/t.width,my:(t.height-19)/t.height}}))},CompensationMarker:function(e,t,i){y("compensation",e,n.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.compensation)/t.width,my:(t.height-13)/t.height}}),{strokeWidth:1})},LoopMarker:function(e,t,i){y("loop",e,n.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.loop)/t.width,my:(t.height-7)/t.height}}),{strokeWidth:1,fill:"none",strokeLinecap:"round",strokeMiterlimit:.5})},AdhocMarker:function(e,t,i){y("adhoc",e,n.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.adhoc)/t.width,my:(t.height-15)/t.height}}),{strokeWidth:1,fill:"black"})}};function C(e,t,n){var i,r=re(t),o=n&&-1!==n.indexOf("SubProcessMarker");i=o?{seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},Z(n,function(n){g(n)(e,t,i)}),r.isForCompensation&&g("CompensationMarker")(e,t,i),"bpmn:AdHocSubProcess"===r.$type&&g("AdhocMarker")(e,t,i);var a=r.loopCharacteristics,s=a&&a.isSequential;a&&(void 0===s&&g("LoopMarker")(e,t,i),!1===s&&g("ParallelMarker")(e,t,i),!0===s&&g("SequentialMarker")(e,t,i))}this._drawPath=m}U(Te,_),Te.$inject=["eventBus","styles","pathMap","canvas"];var Ce=Te;Te.prototype.canRender=function(e){return Q(e,"bpmn:BaseElement")},Te.prototype.drawShape=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},Te.prototype.drawConnection=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},Te.prototype.getShapePath=function(e){return Q(e,"bpmn:Event")?oe(e):Q(e,"bpmn:Activity")?ae(e,xe):Q(e,"bpmn:Gateway")?se(e):ce(e)};var Ae=function(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m {mx}, {my} m 0 15 l 0 -15 m 4 15 l 0 -15 m 4 15 l 0 -15 ",height:61,width:51,heightElements:[12],widthElements:[1,6,12,15]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,i,r=this.pathMap[e];t.abspos?(n=t.abspos.x,i=t.abspos.y):(n=t.containerWidth*t.position.mx,i=t.containerHeight*t.position.my);var o,a,s={};if(t.position){for(var c=t.containerHeight/r.height*t.yScaleFactor,p=t.containerWidth/r.width*t.xScaleFactor,l=0;l<r.heightElements.length;l++)s["y"+l]=r.heightElements[l]*c;for(var u=0;u<r.widthElements.length;u++)s["x"+u]=r.widthElements[u]*p}return o=r.d,a={mx:n,my:i,e:s},String(o).replace(Re,function(e,t){return function(e,t,n){var i=n;return t.replace(Pe,function(e,t,n,r,o){t=t||r,i&&(t in i&&(i=i[t]),"function"==typeof i&&o&&(i=i()))}),i=(null==i||i==n?e:i)+""}(e,t,a)})}},Re=/\{([^}]+)\}/g,Pe=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Me={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ce],pathMap:["type",Ae]},ke={elementToString:function(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}},Be={},Ne=s.assign,De=d.is,Oe=Be.DEFAULT_LABEL_SIZE={width:90,height:20},Le=15;function Ie(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=je(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=Le:a+=Le,{x:a,y:s}}function je(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function ze(e){return e.waypoints?Ie(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+Oe.height/2}}Be.hasExternalLabel=function(e){return De(e,"bpmn:Event")||De(e,"bpmn:Gateway")||De(e,"bpmn:DataStoreReference")||De(e,"bpmn:DataObjectReference")||De(e,"bpmn:SequenceFlow")||De(e,"bpmn:MessageFlow")},Be.getExternalLabelMid=ze,Be.getExternalLabelBounds=function(e,t){var n,i,r,o=e.di.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Oe.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=ze(t),i=Oe),Ne({x:n.x-i.width/2,y:n.y-i.height/2},i)};var Fe=s.assign,$e=s.map,Ge=d.is,We=Be.hasExternalLabel,He=Be.getExternalLabelBounds,Ve=f.isExpanded,qe=ke.elementToString;function Ue(e,t){return Fe({id:e.id,type:e.$type,businessObject:e},t)}function Ye(e,t,n,i){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:qe(n),referenced:qe(t),property:i}))}function Ke(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._translate=r,this._textUtil=new G}Ke.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate"];var Xe=Ke;Ke.prototype.add=function(e,t){var n,i,r,o,a=e.di,s=this._translate;if(Ge(a,"bpmndi:BPMNPlane"))n=this._elementFactory.createRoot(Ue(e)),this._canvas.setRootElement(n);else if(Ge(a,"bpmndi:BPMNShape")){var c=!Ve(e);i=t&&(t.hidden||t.collapsed);var p=e.di.bounds;n=this._elementFactory.createShape(Ue(e,{collapsed:c,hidden:i,x:Math.round(p.x),y:Math.round(p.y),width:Math.round(p.width),height:Math.round(p.height)})),Ge(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,n),Ge(e,"bpmn:Lane")&&(r=0),this._canvas.addShape(n,t,r)}else{if(!Ge(a,"bpmndi:BPMNEdge"))throw new Error(s("unknown di {di} for element {semantic}",{di:qe(a),semantic:qe(e)}));var l=this._getSource(e),u=this._getTarget(e);i=t&&(t.hidden||t.collapsed),n=this._elementFactory.createConnection(Ue(e,{hidden:i,source:l,target:u,waypoints:(o=e.di.waypoint,$e(o,function(e){return{x:e.x,y:e.y}}))})),Ge(e,"bpmn:DataAssociation")&&(t=null),Ge(e,"bpmn:SequenceFlow")&&(r=0),this._canvas.addConnection(n,t,r)}return We(e)&&this.addLabel(e,n),this._eventBus.fire("bpmnElement.added",{element:n}),n},Ke.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:qe(e)}));var r=this._elementRegistry.get(i.id),o=r&&r.attachers;if(!r)throw Ye(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},Ke.prototype.addLabel=function(e,t){var n,i,r;return n=He(e,t),(i=e.name)&&(n=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:Ze});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(n,i,this._textUtil)),r=this._elementFactory.createLabel(Ue(e,{id:e.id+"_label",labelTarget:t,type:"label",hidden:t.hidden||!e.name,x:Math.round(n.x),y:Math.round(n.y),width:Math.round(n.width),height:Math.round(n.height)})),this._canvas.addShape(r,t.parent)},Ke.prototype._getEnd=function(e,t){var n,i,r=e.$type,o=this._translate;if(i=e[t+"Ref"],"source"===t&&"bpmn:DataInputAssociation"===r&&(i=i&&i[0]),("source"===t&&"bpmn:DataOutputAssociation"===r||"target"===t&&"bpmn:DataInputAssociation"===r)&&(i=e.$parent),n=i&&this._getElement(i))return n;throw i?Ye(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:qe(e),side:t}))},Ke.prototype._getSource=function(e){return this._getEnd(e,"source")},Ke.prototype._getTarget=function(e){return this._getEnd(e,"target")},Ke.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var Ze={fontFamily:"Arial, sans-serif",fontSize:"11px"};var Qe={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(e,n){return t[n]||"{"+n+"}"})}]},Je={__depends__:[Me,{__depends__:[Qe],bpmnImporter:["type",Xe]}]},et={};function tt(e,t,n){Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:et.extend(n[t.name]||[],e,t,n)})}function nt(e,t){if(!(this instanceof nt))return new nt(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}et.extend=function(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(e){var n=this.indexOf(e);return-1!==n&&(this.splice(n,1),t.unset(e,r,i)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e){this.contains(e)||(this.push(e),t.set(e,r,i))}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},et.isExtended=function(e){return!0===e.__refs_collection},nt.prototype.bind=function(e,t){if("string"==typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?tt(this,t,e):function(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{enumerable:t.enumerable,get:function(){return r},set:function(t){if(t!==r){var o=r;r=null,o&&e.unset(o,i,n),r=t,e.set(r,i,n)}}})}(this,t,e)},nt.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return et.isExtended(n)||tt(this,t,e),n},nt.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},nt.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},nt.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var it={};(it=nt).Collection=et;var rt=s.filter,ot=s.find,at=s.forEach,st=ke.elementToString,ct=new it({name:"bpmnElement",enumerable:!0},{name:"di"});function pt(e,t){return e.$instanceOf(t)}var lt=function(e,t){var n={},i=[];function r(e,t){return function(n){e(n,t)}}function o(e){n[e.id]=e}function a(n,i){try{var r=n.di&&function(n,i){if(n.gfx)throw new Error(t("already rendered {element}",{element:st(n)}));return e.element(n,i)}(n,i);return o(n),r}catch(e){s(e.message,{element:n,error:e}),console.error(t("failed to import {element}",{element:st(n)})),console.error(e)}}function s(t,n){e.error(t,n)}function c(e){var n=e.bpmnElement;n?n.di?s(t("multiple DI elements defined for {element}",{element:st(n)}),{element:n}):(ct.bind(n,"di"),n.di=e):s(t("no bpmnElement referenced in {element}",{element:st(e)}),{element:e})}function p(e){var t;c(t=e.plane),at(t.planeElement,l)}function l(e){c(e)}function u(e,t){w(e,t),g(e.ioSpecification,t),v(e.artifacts,t),o(e)}function h(e,t){a(e,t)}function d(e,t){a(e,t)}function m(e,t){a(e,t)}function f(e,t){a(e,t)}function y(e,t){a(e,t)}function v(e,t){at(e,function(e){pt(e,"bpmn:Association")?i.push(function(){y(e,t)}):y(e,t)})}function g(e,t){e&&(at(e.dataInputs,r(m,t)),at(e.dataOutputs,r(f,t)))}function b(e,t){var n=a(e,t);pt(e,"bpmn:SubProcess")&&function(e,t){w(e,t),v(e.artifacts,t)}(e,n||t),pt(e,"bpmn:Activity")&&g(e.ioSpecification,t),i.push(function(){at(e.dataInputAssociations,r(d,t)),at(e.dataOutputAssociations,r(d,t))})}function x(e,t){a(e,t)}function E(e,t){i.push(function(){var n=a(e,t);e.childLaneSet&&_(e.childLaneSet,n||t),function(e){at(e.flowNodeRef,function(t){var n=t.get("lanes");n&&n.push(e)})}(e)})}function _(e,t){at(e.lanes,r(E,t))}function w(e,n){!function(e,n){at(e,function(e){pt(e,"bpmn:SequenceFlow")?i.push(function(){!function(e,t){a(e,t)}(e,n)}):pt(e,"bpmn:BoundaryEvent")?i.unshift(function(){!function(e,t){a(e,t)}(e,n)}):pt(e,"bpmn:FlowNode")?b(e,n):pt(e,"bpmn:DataObject")||(pt(e,"bpmn:DataStoreReference")?x(e,n):pt(e,"bpmn:DataObjectReference")?x(e,n):s(t("unrecognized flowElement {element} in context {context}",{element:st(e),context:n?st(n.businessObject):"null"}),{element:e,context:n}))})}(e.flowElements,n),e.laneSets&&function(e,t){at(e,r(_,t))}(e.laneSets,n)}function S(e,t){var n=a(e,t),i=e.processRef;i&&u(i,n||t)}return{handleDefinitions:function(o,a){var l=o.diagrams;if(a&&-1===l.indexOf(a))throw new Error(t("diagram not part of bpmn:Definitions"));if(!a&&l&&l.length&&(a=l[0]),!a)throw new Error(t("no diagram to display"));p(a);var d=a.plane;if(!d)throw new Error(t("no plane for {element}",{element:st(a)}));var m=d.bpmnElement;if(!m){if(!(m=function(e){return ot(e.rootElements,function(e){return pt(e,"bpmn:Process")||pt(e,"bpmn:Collaboration")})}(o)))throw new Error(t("no process or collaboration to display"));s(t("correcting missing bpmnElement on {plane} to {rootElement}",{plane:st(d),rootElement:st(m)})),d.bpmnElement=m,c(d)}var f,y,g=function(t,n){return e.root(t,n)}(m,d);if(pt(m,"bpmn:Process"))u(m,g);else{if(!pt(m,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:st(d),rootElement:st(m)}));at((y=m).participants,r(S)),v(y.artifacts),i.push(function(){var e,t;e=y.messageFlows,at(e,r(h,t))}),f=o.rootElements,rt(f,function(e){return!n[e.id]&&pt(e,"bpmn:Process")&&e.laneSets}).forEach(r(u))}!function(e){for(;e.length;)e.shift()()}(i)}}},ut={};ut.importBpmnDiagram=function(e,t,n){var i,r,o,a,s=[];try{i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("translate"),r.fire("import.render.start",{definitions:t}),function(e){new lt({root:function(e){return i.add(e)},element:function(e,t){return i.add(e,t)},error:function(e,t){s.push({message:e,context:t})}},o).handleDefinitions(e)}(t),r.fire("import.render.complete",{error:a,warnings:s})}catch(e){a=e}n(a,s)};var ht={},dt=Y.domify,mt=Y.delegate,ft='<img width="52" height="52" src="'+("data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 960"><path fill="#fff" d="M960 60v839c0 33-27 61-60 61H60c-33 0-60-27-60-60V60C0 27 27 0 60 0h839c34 0 61 27 61 60z"/><path fill="#52b415" d="M217 548a205 205 0 0 0-144 58 202 202 0 0 0-4 286 202 202 0 0 0 285 3 200 200 0 0 0 48-219 203 203 0 0 0-185-128zM752 6a206 206 0 0 0-192 285 206 206 0 0 0 269 111 207 207 0 0 0 111-260A204 204 0 0 0 752 6zM62 0A62 62 0 0 0 0 62v398l60 46a259 259 0 0 1 89-36c5-28 10-57 14-85l99 2 12 85a246 246 0 0 1 88 38l70-52 69 71-52 68c17 30 29 58 35 90l86 14-2 100-86 12a240 240 0 0 1-38 89l43 58h413c37 0 60-27 60-61V407a220 220 0 0 1-44 40l21 85-93 39-45-76a258 258 0 0 1-98 1l-45 76-94-39 22-85a298 298 0 0 1-70-69l-86 22-38-94 76-45a258 258 0 0 1-1-98l-76-45 40-94 85 22a271 271 0 0 1 41-47z"/></svg>'))+'" />';function yt(e){return e.join(";")}var vt,gt='<div class="bjs-powered-by-lightbox" style="'+yt(["z-index: 1001","position: fixed","top: 0","left: 0","right: 0","bottom: 0"])+'"><div class="backdrop" style="'+yt(["width: 100%","height: 100%","background: rgba(0,0,0,0.2)"])+'"></div><div class="notice" style="'+yt(["position: absolute","left: 50%","top: 40%","margin: 0 -130px","width: 260px","padding: 10px","background: white","border: solid 1px #AAA","border-radius: 3px","font-family: Helvetica, Arial, sans-serif","font-size: 14px","line-height: 1.2em"])+'"><a href="http://bpmn.io" target="_blank" style="float: left; margin-right: 10px">'+ft+'</a>Web-based tooling for BPMN, DMN and CMMN diagrams powered by <a href="http://bpmn.io" target="_blank">bpmn.io</a>.</div></div>';ht.open=function(){vt||(vt=dt(gt),mt.bind(vt,".backdrop","click",function(e){document.body.removeChild(vt)})),document.body.appendChild(vt)},ht.BPMNIO_IMG=ft;var bt={};bt.hasLowerCaseAlias=function(e){return e.xml&&"lowerCase"===e.xml.tagAlias},bt.DEFAULT_NS_MAP={xsi:"http://www.w3.org/2001/XMLSchema-instance"};var xt=bt.XSI_TYPE="xsi:type";function Et(e){return e.xml&&e.xml.serialize}function _t(){}bt.serializeAsType=function(e){return Et(e)===xt},bt.serializeAsProperty=function(e){return"property"===Et(e)},_t.prototype.get=function(e){return this.$model.properties.get(this,e)},_t.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};var wt=_t,St=s.forEach,Tt=s.bind;function Ct(e,t){this.model=e,this.properties=t}var At=Ct;Ct.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(wt.prototype);St(e.properties,function(e){e.isMany||void 0===e.default||(i[e.name]=e.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(e){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),St(e,Tt(function(e,t){this.set(t,e)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var Rt={};function Pt(e){this.model=e}Rt.parseName=function(e,t){var n,i,r=e.split(/:/);if(1===r.length)n=e,i=t;else{if(2!==r.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=r[1],i=r[0]}return{name:e=(i?i+":":"")+n,prefix:i,localName:n}};var Mt=Pt;function kt(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}Pt.prototype.set=function(e,t,n){var i=this.model.getPropertyDescriptor(e,t),r=i&&i.name;void 0===n?i?delete e[r]:delete e.$attrs[t]:i?r in e?e[r]=n:kt(e,i,n):e.$attrs[t]=n},Pt.prototype.get=function(e,t){var n=this.model.getPropertyDescriptor(e,t);if(!n)return e.$attrs[t];var i=n.name;return!e[i]&&n.isMany&&kt(e,n,[]),e[i]},Pt.prototype.define=function(e,t,n){Object.defineProperty(e,t,n)},Pt.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Pt.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})};var Bt=s.pick,Nt=s.assign,Dt=s.forEach,Ot=s.bind,Lt=Rt.parseName;function It(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}var jt=It;It.prototype.build=function(){return Bt(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},It.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var i=this.properties;void 0!==t?i.splice(t,0,e):i.push(e)},It.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(-1===s)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},It.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Lt(r[0],i),a=Lt(r[1],o.prefix).name,s=this.propertiesByName[a];if(!s)throw new Error("refined property <"+a+"> not found");this.replaceProperty(s,e,n),delete e.redefines},It.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},It.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},It.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},It.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},It.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},It.prototype.hasProperty=function(e){return this.propertiesByName[e]},It.prototype.addTrait=function(e,t){var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(Dt(e.properties,Ot(function(n){n=Nt({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var i=n.replaces,r=n.redefines;i||r?this.redefineProperty(n,i||r,i):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))},this)),i.push(e),n[r]=e)};var zt={},Ft={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},$t={String:function(e){return e},Boolean:function(e){return"true"===e},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e,10)}};zt.coerceType=function(e,t){var n=$t[e];return n?n(t):t},zt.isBuiltIn=function(e){return!!Ft[e]},zt.isSimple=function(e){return!!$t[e]};var Gt=s.assign,Wt=s.forEach,Ht=s.bind,Vt=Rt.parseName,qt=zt.isBuiltIn;function Ut(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,Wt(e,Ht(this.registerPackage,this))}var Yt=Ut;function Kt(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}Ut.prototype.getPackage=function(e){return this.packageMap[e]},Ut.prototype.getPackages=function(){return this.packages},Ut.prototype.registerPackage=function(e){e=Gt({},e);var t=this.packageMap;Kt(t,e,"prefix"),Kt(t,e,"uri"),Wt(e.types,Ht(function(t){this.registerType(t,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ut.prototype.registerType=function(e,t){e=Gt({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:Gt(e.meta||{})});var n=Vt(e.name,t.prefix),i=n.name,r={};Wt(e.properties,Ht(function(e){var t=Vt(e.name,n.prefix),i=t.name;qt(e.type)||(e.type=Vt(e.type,t.prefix).name),Gt(e,{ns:t,name:i}),r[i]=e},this)),Gt(e,{ns:n,name:i,propertiesByName:r}),Wt(e.extends,Ht(function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Ut.prototype.mapTypes=function(e,t,n){var i=qt(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(e){return a(e,!0)}function a(n,i){var o=Vt(n,qt(n)?"":e.prefix);r.mapTypes(o,t,i)}if(!i)throw new Error("unknown type <"+e.name+">");Wt(i.superClass,n?o:a),t(i,!n),Wt(i.traits,o)},Ut.prototype.getEffectiveDescriptor=function(e){var t=Vt(e),n=new jt(t);this.mapTypes(t,function(e,t){n.addTrait(e,t)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Ut.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};var Xt=s.isString,Zt=s.isObject,Qt=s.forEach,Jt=Rt.parseName;function en(e){this.properties=new Mt(this),this.factory=new At(this,this.properties),this.registry=new Yt(e,this.properties),this.typeCache={}}var tn=en;en.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},en.prototype.getType=function(e){var t=this.typeCache,n=Xt(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},en.prototype.createAny=function(e,t,n){var i=Jt(e),r={$type:e,$instanceOf:function(e){return e===this.$type}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),Qt(n,function(e,t){Zt(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e}),r},en.prototype.getPackage=function(e){return this.registry.getPackage(e)},en.prototype.getPackages=function(){return this.registry.getPackages()},en.prototype.getElementDescriptor=function(e){return e.$descriptor},en.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},en.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},en.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var nn=tn,rn={exports:{}};!function(e,t){"object"==typeof rn.exports?t(rn.exports):t(e.Saxen={})}(this,function(e){"use strict";var t=String.fromCharCode,n=Object.prototype.hasOwnProperty,i=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,r={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function o(e,i,o,a){return a?n.call(r,a)?r[a]:"&"+a+";":t(i||parseInt(o,16))}function a(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(i,o):e}Object.keys(r).forEach(function(e){r[e.toUpperCase()]=r[e]});var s="http://www.w3.org/2001/XMLSchema-instance",c="xsi",p="xsi:type";function l(e){return new Error(e)}function u(e){return"missing namespace for prefix <"+e+">"}function h(e){return{get:e,enumerable:!0}}function d(e){var t,n={};for(t in e)n[t]=e[t];return n}function m(e){return e+"$uri"}function f(){return{line:0,column:0}}function y(e){throw e}e.Parser=function e(t){if(!this)return new e(t);var n,i,r,o,v,g,b,x,E,_=t&&t.proxy,w=y,S=f,T=!1,C=!1,A=null,R=!1;function P(e){e instanceof Error||(e=l(e)),A=e,w(e,S)}function M(e){v&&(e instanceof Error||(e=l(e)),v(e,S))}this.on=function(e,t){if("function"!=typeof t)throw l("required args <name, cb>");switch(e){case"openTag":i=t;break;case"text":n=t;break;case"closeTag":r=t;break;case"error":w=t;break;case"warn":v=t;break;case"cdata":o=t;break;case"attention":x=t;break;case"question":b=t;break;case"comment":g=t;break;default:throw l("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw l("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n[s]=c,C=!0,E=n,this},this.parse=function(e){if("string"!=typeof e)throw l("required args <xml=string>");return A=null,function(e){var t,s,c,l,f,y,v,w,A,k,B=C?[]:null,N=C?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[m(n)]=t;return i}(E):null,D=[],O=0,L=!1,I=!1,j=0,z=0,F="",$=0;function G(){if(null!==k)return k;var e,t,n,i,r,o,s,c,l,h,f,y=C&&N.xmlns,v=C&&T?[]:null,g=$,b=F,x=b.length,_={},w={};e:for(;g<x;g++)if(l=!1,!(32===(h=b.charCodeAt(g))||h<14&&h>8)){for((h<65||h>122||h>90&&h<97)&&95!==h&&58!==h&&(M("illegal first char attribute name"),l=!0),f=g+1;f<x;f++)if(!((h=b.charCodeAt(f))>96&&h<123||h>64&&h<91||h>47&&h<59||46===h||45===h||95===h)){if(32===h||h<14&&h>8){M("missing attribute value"),g=f;continue e}if(61===h)break;M("illegal attribute name char"),l=!0}if("xmlns:xmlns"===(c=b.substring(g,f))&&(M("illegal declaration of xmlns"),l=!0),34===(h=b.charCodeAt(f+1)))-1===(f=b.indexOf('"',g=f+2))&&-1!==(f=b.indexOf("'",g))&&(M("attribute value quote missmatch"),l=!0);else if(39===h)-1===(f=b.indexOf("'",g=f+2))&&-1!==(f=b.indexOf('"',g))&&(M("attribute value quote missmatch"),l=!0);else for(M("missing attribute value quotes"),l=!0,f+=1;f<x&&!(32===(h=b.charCodeAt(f+1))||h<14&&h>8);f++);for(-1===f&&(M("missing closing quotes"),f=x,l=!0),l||(o=b.substring(g,f)),g=f;f+1<x&&!(32===(h=b.charCodeAt(f+1))||h<14&&h>8);f++)g===f&&(M("illegal character after attribute end"),l=!0);if(g=f+1,!l)if(c in w)M("attribute <"+c+"> already defined");else if(w[c]=!0,C)if(T){if(null!==(r="xmlns"===c?"xmlns":120===c.charCodeAt(0)&&"xmlns:"===c.substr(0,6)?c.substr(6):null)){if(e=a(o),t=m(r),!(s=E[e])){if("xmlns"===r||t in N&&N[t]!==e)do{s="ns"+O++}while(void 0!==N[s]);else s=r;E[e]=s}N[r]!==s&&(i||(N=d(N),i=!0),N[r]=s,"xmlns"===r&&(N[m(s)]=e,y=s),N[t]=e),_[c]=o;continue}v.push(c,o)}else-1!==(h=c.indexOf(":"))?(n=N[c.substring(0,h)])?((c=y===n?c.substr(h+1):n+c.substr(h))===p&&(-1!==(h=o.indexOf(":"))?(n=o.substring(0,h),n=N[n]||n,o=n+o.substring(h)):o=y+":"+o),_[c]=o):M(u(c.substring(0,h))):_[c]=o;else _[c]=o}if(T)for(g=0,x=v.length;g<x;g++){if(c=v[g++],o=v[g],-1!==(h=c.indexOf(":"))){if(!(n=N[c.substring(0,h)])){M(u(c.substring(0,h)));continue}(c=y===n?c.substr(h+1):n+c.substr(h))===p&&(-1!==(h=o.indexOf(":"))?(n=o.substring(0,h),n=N[n]||n,o=n+o.substring(h)):o=y+":"+o)}_[c]=o}return k=_}for(S=function(){for(var t,n,i=/(\r\n|\r|\n)/g,r=0,o=0,a=0,s=z;j>=a&&(t=i.exec(e))&&!((s=t[0].length+t.index)>j);)r+=1,a=s;return-1==j?(o=s,n=""):(o=j-a,n=-1==z?e.substring(j):e.substring(j,z+1)),{data:n,line:r,column:o}},_&&(A=Object.create({},{name:h(function(){return v}),originalName:h(function(){return w}),attrs:h(G),ns:h(function(){return N})}));-1!==z;){if(-1===(j=60===e.charCodeAt(z)?z:e.indexOf("<",z)))return D.length?P("unexpected end of file"):0===z?P("missing start tag"):void 0;if(z!==j&&n&&(n(e.substring(z,j),a,S),R))return;if(33!==(f=e.charCodeAt(j+1)))if(63!==f){if(-1==(z=e.indexOf(">",j+1)))return P("unclosed tag");if(k={},47===f){if(L=!1,I=!0,!D.length)return P("missing open tag");if(s=v=D.pop(),l=j+2+s.length,e.substring(j+2,l)!==s)return P("closing tag mismatch");for(;l<z;l++)if(!(32===(f=e.charCodeAt(l))||f>8&&f<14))return P("close tag")}else{if(47===e.charCodeAt(z-1)?(s=v=e.substring(j+1,z-1),L=!0,I=!0):(s=v=e.substring(j+1,z),L=!0,I=!1),!(f>96&&f<123||f>64&&f<91||95===f||58===f))return P("illegal first char nodeName");for(l=1,c=s.length;l<c;l++)if(!((f=s.charCodeAt(l))>96&&f<123||f>64&&f<91||f>47&&f<59||45===f||95===f)){if(32===f||f<14&&f>8){v=s.substring(0,l),k=null;break}return P("invalid nodeName")}I||D.push(v)}if(C){if(t=N,L&&(I||B.push(t),null===k&&(T=-1!==s.indexOf("xmlns",l))&&($=l,F=s,G(),T=!1)),w=v,-1!==(f=v.indexOf(":"))){if(!(y=N[v.substring(0,f)]))return P("missing namespace on <"+w+">");v=v.substr(f+1)}else y=N.xmlns;y&&(v=y+":"+v)}if(L&&($=l,F=s,i&&(_?i(A,a,I,S):i(v,G,a,I,S),R)))return;if(I){if(r&&(r(_?A:v,a,L,S),R))return;C&&(N=L?t:B.pop())}z+=1}else{if(-1===(z=e.indexOf("?>",j)))return P("unclosed question");if(b&&(b(e.substring(j,z+2),S),R))return;z+=2}else{if(91===(f=e.charCodeAt(j+2))&&"CDATA["===e.substr(j+3,6)){if(-1===(z=e.indexOf("]]>",j)))return P("unclosed cdata");if(o&&(o(e.substring(j+9,z),S),R))return;z+=3;continue}if(45===f&&45===e.charCodeAt(j+3)){if(-1===(z=e.indexOf("--\x3e",j)))return P("unclosed comment");if(g&&(g(e.substring(j+4,z),a,S),R))return;z+=3;continue}if(-1===(z=e.indexOf(">",j+1)))return P("unclosed tag");if(x&&(x(e.substring(j,z+1),a,S),R))return;z+=1}}}(e),S=f,R=!1,A},this.stop=function(){R=!0}},Object.defineProperty(e,"__esModule",{value:!0})}),rn=rn.exports;var on={};!function(e){"use strict";function t(){this.data=[null],this.top=0}function n(){return new t}t.prototype.clear=function(){return this.data=[null],this.top=0,this},t.prototype.length=function(){return this.top},t.prototype.peek=function(){return this.data[this.top]},t.prototype.pop=function(){return this.top>0?(this.top--,this.data.pop()):void 0},t.prototype.push=function(e){return this.data[++this.top]=e,this},void 0!==on?on=n:e.stack=n}(this);var an={},sn=s.forEach,cn=s.find,pn=s.assign,ln=rn.Parser,un=Rt.parseName,hn=zt.coerceType,dn=zt.isSimple,mn=bt.XSI_TYPE,fn=bt.serializeAsType,yn=bt.hasLowerCaseAlias;function vn(e,t){return yn(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function gn(e){return new Error(e)}function bn(e){return e.$descriptor}function xn(){}function En(){}function _n(){}function wn(e,t){this.property=e,this.context=t}function Sn(e,t){this.element=t,this.propertyDesc=e}function Tn(){}function Cn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function An(e,t,n){Cn.call(this,e,t,n)}function Rn(e,t,n){this.model=e,this.context=n}function Pn(e){e instanceof nn&&(e={model:e}),pn(this,{lax:!1},e)}xn.prototype.handleEnd=function(){},xn.prototype.handleText=function(){},xn.prototype.handleNode=function(){},En.prototype=Object.create(xn.prototype),En.prototype.handleNode=function(){return this},_n.prototype=Object.create(xn.prototype),_n.prototype.handleText=function(e){this.body=(this.body||"")+e},wn.prototype=Object.create(_n.prototype),wn.prototype.handleNode=function(e){if(this.element)throw gn("expected no sub nodes");return this.element=this.createReference(e),this},wn.prototype.handleEnd=function(){this.element.id=this.body},wn.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},Sn.prototype=Object.create(_n.prototype),Sn.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=hn(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},Tn.prototype=Object.create(_n.prototype),Tn.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t},Cn.prototype=Object.create(Tn.prototype),Cn.prototype.addReference=function(e){this.context.addReference(e)},Cn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=bn(t).bodyProperty;n&&void 0!==e&&(e=hn(n.type,e),t.set(n.name,e))},Cn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=bn(n),r=this.context,o=new n({});return sn(t,function(e,t){var n,a=i.propertiesByName[t];a&&a.isReference?a.isMany?(n=e.split(" "),sn(n,function(e){r.addReference({element:o,property:a.ns.name,id:e})})):r.addReference({element:o,property:a.ns.name,id:e}):(a&&(e=hn(a.type,e)),o.set(t,e))}),o},Cn.prototype.getPropertyForNode=function(e){var t,n,i=e.name,r=un(i),o=this.type,a=this.model,s=bn(o),c=r.name,p=s.propertiesByName[c];if(p)return fn(p)&&(t=e.attributes[mn])?(t=function(e,t){var n=un(e);return function(e,t){var n=e.name,i=e.localName,r=t.xml&&t.xml.typePrefix;return r&&0===i.indexOf(r)?e.prefix+":"+i.slice(r.length):n}(n,t.getPackage(n.prefix))}(t,a),n=a.getType(t),pn({},p,{effectiveType:bn(n).name})):p;var l=a.getPackage(r.prefix);if(l){if(t=vn(r,l),n=a.getType(t),p=cn(s.properties,function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)}))return pn({},p,{effectiveType:bn(n).name})}else if(p=cn(s.properties,function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type}))return p;throw gn("unrecognized element <"+r.name+">")},Cn.prototype.toString=function(){return"ElementDescriptor["+bn(this.type).name+"]"},Cn.prototype.valueHandler=function(e,t){return new Sn(e,t)},Cn.prototype.referenceHandler=function(e){return new wn(e,this.context)},Cn.prototype.handler=function(e){return"Element"===e?new Rn(this.model,e,this.context):new Cn(this.model,e,this.context)},Cn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,dn(n))return this.valueHandler(t,i);var o=(r=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==o&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(pn(o,{element:i}),this.context.addReference(o)):o.$parent=i),r},An.prototype=Object.create(Cn.prototype),An.prototype.createElement=function(e){var t=e.name,n=un(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&vn(n,o)||t;if(!r.hasType(a))throw gn("unexpected element <"+e.originalName+">");return Cn.prototype.createElement.call(this,e)},Rn.prototype=Object.create(Tn.prototype),Rn.prototype.createElement=function(e){var t=e.name,n=un(t).prefix,i=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,i,r)},Rn.prototype.handleChild=function(e){var t=new Rn(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element;return void 0!==i&&((n.$children=n.$children||[]).push(i),i.$parent=n),t},Rn.prototype.handleText=function(e){this.body=this.body||""+e},Rn.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},Pn.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Cn?(i=t,t={}):"string"==typeof t?(i=this.handler(t),t={}):"string"==typeof i&&(i=this.handler(i));var r=this.model,o=this.lax,a=new function(e){pn(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw gn("expected element");var t,n=this.elementsById,i=bn(e).idProperty;if(i&&(t=e.get(i.name))){if(n[t])throw gn("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}(pn({},t,{rootHandler:i})),s=new ln({proxy:!0}),c=new on;function p(e,t,n){var i=t(),r=i.line,o=i.column,s=i.data;"<"===s.charAt(0)&&-1!==s.indexOf(" ")&&(s=s.slice(0,s.indexOf(" "))+">");var c="unparsable content "+(s?s+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return a.addWarning({message:c,error:e}),console.warn("could not parse node"),console.warn(e),!0;throw console.error("could not parse document"),console.error(e),gn(c)}i.context=a,c.push(i);var l=/^<\?xml /i,u=/ encoding="([^"]+)"/i,h=/^utf-8$/i;var d=r.getPackages().reduce(function(e,t){return e[t.uri]=t.prefix,e},{});s.ns(d).on("openTag",function(e,t,n,i){var r=e.attrs||{},a=Object.keys(r).reduce(function(e,n){var i=t(r[n]);return e[n]=i,e},{});!function(e,t){var n=c.peek();try{c.push(n.handleNode(e))}catch(e){p(e,t,o)&&c.push(new En)}}({name:e.name,originalName:e.originalName,attributes:a,ns:e.ns},i)}).on("question",function(e){if(l.test(e)){var t=u.exec(e),n=t&&t[1];n&&!h.test(n)&&a.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}}).on("closeTag",function(){c.pop().handleEnd()}).on("cdata",function(e){c.peek().handleText(e)}).on("text",function(e,t){!function(e){(e=e.trim())&&c.peek().handleText(e)}(t(e))}).on("error",p).on("warn",function(e,t){return p(e,t,!0)}),setTimeout(function(){var t;try{s.parse(e),function(){var e,t,n=a.elementsById,i=a.references;for(e=0;t=i[e];e++){var r=t.element,o=n[t.id],s=bn(r).propertiesByName[t.property];if(o||a.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),s.isMany){var c=r.get(s.name),p=c.indexOf(t);-1===p&&(p=c.length),o?c[p]=o:c.splice(p,1)}else r.set(s.name,o)}}()}catch(e){t=e}var r=i.element;t||r||(t=gn("failed to parse document as <"+i.type.$descriptor.name+">")),n(t,t?void 0:r,a)},0)},Pn.prototype.handler=function(e){return new An(this.model,e)},(an=Pn).ElementHandler=Cn;var Mn=s.map,kn=s.forEach,Bn=s.isString,Nn=s.filter,Dn=s.assign,On=Rt.parseName,Ln=bt.hasLowerCaseAlias,In=bt.serializeAsType,jn=bt.serializeAsProperty,zn='<?xml version="1.0" encoding="UTF-8"?>\n',Fn=/(<|>|'|"|&|\n\r|\n)/g,$n=bt.DEFAULT_NS_MAP,Gn=bt.XSI_TYPE;function Wn(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Hn(e){return Bn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function Vn(e,t){return t.isGeneric?Dn({localName:t.ns.localName},e):Dn({localName:(n=t.ns.localName,i=t.$pkg,Ln(i)?(r=n).charAt(0).toLowerCase()+r.slice(1):n)},e);var n,i,r}var qn={"\n":"10","\n\r":"10",'"':"34","'":"39","<":"60",">":"62","&":"38"};function Un(e){this.tagName=e}function Yn(){}function Kn(e){this.tagName=e}function Xn(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function Zn(e,t){Xn.call(this,e,t)}Un.prototype.build=function(e){return this.element=e,this},Un.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},Yn.prototype.serializeValue=Yn.prototype.serializeTo=function(e){var t=this.escape;t&&e.append("<![CDATA["),e.append(this.value),t&&e.append("]]>")},Yn.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(Fn)&&(this.escape=!0),this},Wn(Kn,Yn),Kn.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},Xn.prototype.build=function(e){this.element=e;var t,n,i=e.$descriptor,r=this.propertyDescriptor,o=i.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=r?this.nsPropertyTagName(r):this.nsTagName(i),this.tagName=this.addTagName(this.ns),o||(n=function(e){var t=e.$descriptor;return Nn(t.properties,function(t){var n=t.name;if(t.isVirtual)return!1;if(!e.hasOwnProperty(n))return!1;var i=e[n];return i!==t.default&&null!==i&&(!t.isMany||i.length)})}(e),this.parseAttributes(Nn(n,function(e){return e.isAttr})),this.parseContainments(function(e){return Nn(e,function(e){return!e.isAttr})}(n))),this.parseGenericAttributes(e,t),this},Xn.prototype.nsTagName=function(e){return Vn(this.logNamespaceUsed(e.ns),e)},Xn.prototype.nsPropertyTagName=function(e){return function(e,t){return Dn({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},Xn.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Xn.prototype.nsAttributeName=function(e){var t;if(t=Bn(e)?On(e):e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:Dn({localName:t.localName},n)},Xn.prototype.parseGeneric=function(e){var t=this,n=this.body,i=[];return kn(e,function(r,o){"$body"===o?n.push((new Yn).build({type:"String"},r)):"$children"===o?kn(r,function(e){n.push(new Xn(t).build(e))}):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,r)&&i.push({name:o,value:r})}),i},Xn.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,o=On(t);if("xmlns"===o.prefix&&(i={prefix:o.localName,uri:n}),o.prefix||"xmlns"!==o.localName||(i={uri:n}),!i)return{name:t,value:n};if(r&&r.getPackage(n))this.logNamespace(i,!0,!0);else{var a=this.logNamespaceUsed(i,!0);this.getNamespaces().logUsed(a)}},Xn.prototype.parseNsAttributes=function(e,t){var n=this,i=e.$attrs,r=[];return kn(i,function(t,i){var o=n.parseNsAttribute(e,i,t);o&&r.push(o)}),r},Xn.prototype.parseGenericAttributes=function(e,t){var n=this;kn(t,function(t){if(t.name!==Gn)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}})},Xn.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;kn(e,function(e){var r=i.get(e.name),o=e.isReference;if(e.isMany||(r=[r]),e.isBody)n.push((new Yn).build(e,r[0]));else if(zt.isSimple(e.type))kn(r,function(i){n.push(new Kn(t.addTagName(t.nsPropertyTagName(e))).build(e,i))});else if(o)kn(r,function(i){n.push(new Un(t.addTagName(t.nsPropertyTagName(e))).build(i))});else{var a=In(e),s=jn(e);kn(r,function(i){var r;r=a?new Zn(t,e):s?new Xn(t,e):new Xn(t),n.push(r.build(i))})}})},Xn.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new function(e){var t={},n={},i={},r=[],o=[];this.byUri=function(t){return n[t]||e&&e.byUri(t)},this.add=function(e,t){n[e.uri]=e,t?r.push(e):o.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return t[e||"xmlns"]},this.mapPrefix=function(e,n){t[e||"xmlns"]=n},this.logUsed=function(e){var t=e.uri;i[t]=this.byUri(t)},this.getUsed=function(e){return[].concat(r,o).filter(function(e){return i[e.uri]})}}(t):n=t),n},Xn.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix;return i.byUri(r)||i.add(e,t),i.mapPrefix(o,r),e},Xn.prototype.logNamespaceUsed=function(e,t){var n,i,r,o=this.element.$model,a=this.getNamespaces(t),s=e.prefix,c=e.uri;if(!s&&!c)return{localName:e.localName};if(r=$n[s]||o&&(o.getPackage(s)||{}).uri,!(c=c||r||a.uriByPrefix(s)))throw new Error("no namespace uri given for prefix <"+s+">");if(!(e=a.byUri(c))){for(n=s,i=1;a.uriByPrefix(n);)n=s+"_"+i++;e=this.logNamespace({prefix:n,uri:c},r===c)}return s&&a.mapPrefix(s,c),e},Xn.prototype.parseAttributes=function(e){var t=this,n=this.element;kn(e,function(e){var i=n.get(e.name);if(e.isReference)if(e.isMany){var r=[];kn(i,function(e){r.push(e.id)}),i=r.join(" ")}else i=i.id;t.addAttribute(t.nsAttributeName(e),i)})},Xn.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Hn(e)},Xn.prototype.addAttribute=function(e,t){var n,i=this.attrs;Bn(t)&&(t=(n=Bn(n=t)?n:""+n).replace(Fn,function(e){return"&#"+qn[e]+";"})),i.push({name:e,value:t})},Xn.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=function(e){return Mn(e.getUsed(),function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}})}(n).concat(t)),kn(t,function(t){e.append(" ").append(Hn(t.name)).append('="').append(t.value).append('"')})},Xn.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Yn;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),kn(this.body,function(t){t.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},Wn(Zn,Xn),Zn.prototype.parseNsAttributes=function(e){var t=Xn.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(Gn),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},Zn.prototype.isLocalNs=function(e){return e.uri===this.typeNs.uri};var Qn=function(e){return e=Dn({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var i=n||new function(){this.value="",this.write=function(e){this.value+=e}},r=new function(e,t){var n=[""];this.append=function(t){return e.write(t),this},this.appendNewLine=function(){return t&&e.write("\n"),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}(i,e.format);if(e.preamble&&r.append(zn),(new Xn).build(t).serializeTo(r),!n)return i.value}}},Jn=s.isString,ei=s.isFunction,ti=s.assign;function ni(e,t){nn.call(this,e,t)}ni.prototype=Object.create(nn.prototype);var ii=ni;ni.prototype.fromXML=function(e,t,n,i){Jn(t)||(i=n,n=t,t="bpmn:Definitions"),ei(n)&&(i=n,n={});var r=new an(ti({model:this,lax:!0},n)),o=r.handler(t);r.fromXML(e,o,i)},ni.prototype.toXML=function(e,t,n){ei(t)&&(n=t,t={});var i,r,o=new Qn(t);try{i=o.toXML(e)}catch(e){r=e}return n(r,i)};var ri=s.assign,oi={bpmn:{name:"BPMN20",uri:"http://www.omg.org/spec/BPMN/20100524/MODEL",associations:[],types:[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",type:"LaneSet",isMany:!0,replaces:"FlowElementsContainer#laneSets"},{name:"flowElements",type:"FlowElement",isMany:!0,replaces:"FlowElementsContainer#flowElements"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isAttr:!0,isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"assignment",type:"Assignment",isMany:!0},{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRefs",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",type:"String",isBody:!0}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",type:"String",isAttr:!0},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRefs",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["FlowElementsContainer","Collaboration"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isVirtual:!0,isMany:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"CallActivity",superClass:["Activity"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],enumerations:[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],prefix:"bpmn",xml:{tagAlias:"lowerCase",typePrefix:"t"}},bpmndi:{name:"BPMNDI",uri:"http://www.omg.org/spec/BPMN/20100524/DI",types:[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],enumerations:[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],associations:[],prefix:"bpmndi"},dc:{name:"DC",uri:"http://www.omg.org/spec/DD/20100524/DC",types:[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],prefix:"dc",associations:[]},di:{name:"DI",uri:"http://www.omg.org/spec/DD/20100524/DI",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isMany:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isVirtual:!0,isMany:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0}]},{name:"Extension",properties:[{name:"values",type:"Element",isMany:!0}]}],associations:[],prefix:"di",xml:{tagAlias:"lowerCase"}},bioc:{name:"bpmn.io colors for BPMN",uri:"http://bpmn.io/schema/bpmn/biocolor/1.0",prefix:"bioc",types:[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],enumerations:[],associations:[]}},ai=function(e,t){return new ii(ri({},oi,e),t)},si={remove:function(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n},add:function(e,t,n){if(e&&t){"number"!=typeof n&&(n=-1);var i=e.indexOf(t);if(-1!==i){if(i===n)return;if(-1===n)return;e.splice(i,1)}-1!==n?e.splice(n,0,t):e.push(t)}},indexOf:function(e,t){return e&&t?e.indexOf(t):-1}},ci={},pi=s.isArray,li=s.isNumber,ui=s.groupBy,hi=s.forEach;function di(e,t,n){var i=!n||-1===e.indexOf(t);return i&&e.push(t),i}function mi(e,t,n){n=n||0,pi(e)||(e=[e]),hi(e,function(e,i){var r=t(e,i,n);pi(r)&&r.length&&mi(r,t,n+1)})}function fi(e,t,n){var i=[],r=[];return mi(e,function(e,o,a){di(i,e,t);var s=e.children;if((-1===n||a<n)&&s&&di(r,s,t))return s}),i}function yi(e,t){var n,i,r,o;return t=!!t,pi(e)||(e=[e]),hi(e,function(e){var a=e;e.waypoints&&!t&&(a=yi(e.waypoints,!0));var s=a.x,c=a.y,p=a.height||0,l=a.width||0;(s<n||void 0===n)&&(n=s),(c<i||void 0===i)&&(i=c),(s+l>r||void 0===r)&&(r=s+l),(c+p>o||void 0===o)&&(o=c+p)}),{x:n,y:i,height:o-i,width:r-n}}ci.eachElement=mi,ci.selfAndAllChildren=function(e,t){return fi(e,!t,-1)},ci.getBBox=yi,ci.getEnclosedElements=function(e,t){var n={};return hi(e,function(e){var i=e;i.waypoints&&(i=yi(i)),!li(t.y)&&i.x>t.x&&(n[e.id]=e),!li(t.x)&&i.y>t.y&&(n[e.id]=e),i.x>t.x&&i.y>t.y&&(li(t.width)&&li(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.y<t.height+t.y?n[e.id]=e:li(t.width)&&li(t.height)||(n[e.id]=e))}),n},ci.getClosure=function(e){var t=ui(e,function(e){return e.id}),n={},i={},r={},o={};function a(e){t[e.source.id]&&t[e.target.id]&&(t[e.id]=[e]),n[e.source.id]&&n[e.target.id]&&(o[e.id]=r[e.id]=e),i[e.id]=e}return mi(e,function(e){if(r[e.id]=e,!e.waypoints)return n[e.id]=e,hi(e.incoming,a),hi(e.outgoing,a),e.children;o[e.id]=i[e.id]=e}),{allShapes:n,allConnections:i,topLevel:t,enclosedConnections:o,enclosedElements:r}},ci.getType=function(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"};var vi=s.isNumber,gi=s.assign,bi=s.forEach,xi=s.every,Ei=s.debounce,_i=s.bind,wi=s.reduce,Si=n.append,Ti=n.attr,Ci=n.classes,Ai=n.create,Ri=n.transform,Pi=n.createMatrix;function Mi(e,t){return Math.round(e*t)/t}function ki(e){return vi(e)?e+"px":e}function Bi(e,t,n){var i=Ai("g");Ci(i).add(t);var r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]),i}var Ni={shape:["x","y","width","height"],connection:["waypoints"]};function Di(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._init(e||{})}Di.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"];var Oi=Di;function Li(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Di.prototype._init=function(e){var t=this._eventBus,n=this._container=function(e){var t=(e=gi({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container"),gi(n.style,{position:"relative",overflow:"hidden",width:ki(e.width),height:ki(e.height)}),t.appendChild(n),n}(e),i=this._svg=Ai("svg");Ti(i,{width:"100%",height:"100%"}),Si(n,i);var r=this._viewport=Bi(i,"viewport");this._layers={},!1!==e.deferUpdate&&(this._viewboxChanged=Ei(_i(this._viewboxChanged,this),300)),t.on("diagram.init",function(){t.fire("canvas.init",{svg:i,viewport:r})},this),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed"],function(){delete this._cachedViewbox},this),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Di.prototype._destroy=function(e){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});var t=this._container.parentNode;t&&t.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._rootElement,delete this._viewport},Di.prototype._clear=function(){var e=this;this._elementRegistry.getAll().forEach(function(t){var n=ci.getType(t);"root"===n?e.setRootElement(null,!0):e._removeElement(t,n)}),delete this._cachedViewbox},Di.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Di.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");var n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),void 0!==t&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Di.prototype._createLayer=function(e,t){t||(t=0);var n=wi(this._layers,function(e,n){return t>=n.index&&e++,e},0);return{group:Bi(this._viewport,"layer-"+e,n),index:t}},Di.prototype.getContainer=function(){return this._container},Di.prototype._updateMarker=function(e,t,n){var i;e.id||(e=this._elementRegistry.get(e)),(i=this._elementRegistry._elements[e.id])&&(bi([i.gfx,i.secondaryGfx],function(e){e&&(n?Ci(e).add(t):Ci(e).remove(t))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Di.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Di.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Di.prototype.hasMarker=function(e,t){e.id||(e=this._elementRegistry.get(e));var n=this.getGraphics(e);return Ci(n).has(t)},Di.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Di.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},Di.prototype.setRootElement=function(e,t){e&&this._ensureValid("root",e);var n=this._rootElement,i=this._elementRegistry,r=this._eventBus;if(n){if(!t)throw new Error("rootElement already set, need to specify override");r.fire("root.remove",{element:n}),r.fire("root.removed",{element:n}),i.remove(n)}if(e){var o=this.getDefaultLayer();r.fire("root.add",{element:e}),i.add(e,o,this._svg),r.fire("root.added",{element:e,gfx:o})}return this._rootElement=e,e},Di.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element with id "+t.id+" already exists");var n=Ni[e];if(!xi(n,function(e){return void 0!==t[e]}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Di.prototype._setParent=function(e,t,n){si.add(t.children,e,n),e.parent=t},Di.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();var r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);var a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},Di.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Di.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Di.prototype._removeElement=function(e,t){var n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e))return r.fire(t+".remove",{element:e}),i.remove(e),si.remove(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Di.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Di.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Di.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Di.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Di.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Di.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;var t,n,i,r,o,a,s=this._viewport,c=this.getSize();return e?(this._changeViewbox(function(){r=Math.min(c.width/e.width,c.height/e.height);var t=this._svg.createSVGMatrix().scale(r).translate(-e.x,-e.y);Ri(s,t)}),e):(t=this.getDefaultLayer().getBBox(),n=(i=Ri(s))?i.matrix:Pi(),r=Mi(n.a,1e3),o=Mi(-n.e||0,1e3),a=Mi(-n.f||0,1e3),e=this._cachedViewbox={x:o?o/r:0,y:a?a/r:0,width:c.width/r,height:c.height/r,scale:r,inner:{width:t.width,height:t.height,x:t.x,y:t.y},outer:c})},Di.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox(function(){e=gi({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Li(t,n)}),{x:n.e,y:n.f}},Di.prototype.zoom=function(e,t){return e?"fit-viewport"===e?this._fitViewport(t):(this._changeViewbox(function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Mi(i.a,1e3)):this.viewbox(e).scale;var n,i},Di.prototype._fitViewport=function(e){var t,n,i=this.viewbox(),r=i.outer,o=i.inner;return o.x>=0&&o.y>=0&&o.x+o.width<=r.width&&o.y+o.height<=r.height&&!e?n={x:0,y:0,width:Math.max(o.width+o.x,r.width),height:Math.max(o.height+o.y,r.height)}:(t=Math.min(1,r.width/o.width,r.height/o.height),n={x:o.x+(e?o.width/2-r.width/t/2:0),y:o.y+(e?o.height/2-r.height/t/2:0),width:r.width/t,height:r.height/t}),this.viewbox(n),this.viewbox(!1).scale},Di.prototype._setZoom=function(e,t){var n,i,r,o,a=this._svg,s=this._viewport,c=a.createSVGMatrix(),p=a.createSVGPoint(),l=(i=s.getCTM()).a;return t?(n=gi(p,t).matrixTransform(i.inverse()),r=c.translate(n.x,n.y).scale(1/l*e).translate(-n.x,-n.y),o=i.multiply(r)):o=c.scale(e),Li(this._viewport,o),o},Di.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Di.prototype.getAbsoluteBBox=function(e){var t,n=this.viewbox();e.waypoints?t=this.getGraphics(e).getBBox():t=e;return{x:t.x*n.scale-n.x*n.scale,y:t.y*n.scale-n.y*n.scale,width:t.width*n.scale,height:t.height*n.scale}},Di.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Ii={},ji=s.assign,zi=new it({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Fi=new it({name:"label",enumerable:!0},{name:"labelTarget"}),$i=new it({name:"attachers",collection:!0},{name:"host"}),Gi=new it({name:"outgoing",collection:!0},{name:"source"}),Wi=new it({name:"incoming",collection:!0},{name:"target"});function Hi(){Object.defineProperty(this,"businessObject",{writable:!0}),zi.bind(this,"parent"),Fi.bind(this,"label"),Gi.bind(this,"outgoing"),Wi.bind(this,"incoming")}function Vi(){Hi.call(this),zi.bind(this,"children"),$i.bind(this,"host"),$i.bind(this,"attachers")}function qi(){Vi.call(this)}function Ui(){Vi.call(this),Fi.bind(this,"labelTarget")}function Yi(){Hi.call(this),Gi.bind(this,"source"),Wi.bind(this,"target")}U(Vi,Hi),U(qi,Vi),U(Ui,Vi),U(Yi,Hi);var Ki={connection:Yi,shape:Vi,label:Ui,root:qi};Ii.create=function(e,t){var n=Ki[e];if(!n)throw new Error("unknown type: <"+e+">");return ji(new n,t)},Ii.Base=Hi,Ii.Label=Ui;var Xi=s.assign;function Zi(){this._uid=12}var Qi=Zi;Zi.prototype.createRoot=function(e){return this.create("root",e)},Zi.prototype.createLabel=function(e){return this.create("label",e)},Zi.prototype.createShape=function(e){return this.create("shape",e)},Zi.prototype.createConnection=function(e){return this.create("connection",e)},Zi.prototype.create=function(e,t){return(t=Xi({},t||{})).id||(t.id=e+"_"+this._uid++),Ii.create(e,t)};var Ji="data-element-id",er=n.attr;function tr(e){this._elements={},this._eventBus=e}tr.$inject=["eventBus"];var nr=tr;tr.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),er(t,Ji,i),n&&er(n,Ji,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},tr.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(er(i.gfx,Ji,""),i.secondaryGfx&&er(i.secondaryGfx,Ji,""),delete t[n])},tr.prototype.updateId=function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},tr.prototype.get=function(e){var t;t="string"==typeof e?e:e&&er(e,Ji);var n=this._elements[t];return n&&n.element},tr.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},tr.prototype.getAll=function(){return this.filter(function(e){return e})},tr.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},tr.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},tr.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};var ir=s.isFunction,rr=s.isArray,or=s.isNumber,ar=s.bind,sr=s.assign,cr=Array.prototype.slice;function pr(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}var lr=pr;function ur(){}pr.prototype.on=function(e,t,n,i){if(e=rr(e)?e:[e],ir(t)&&(i=n,n=t,t=1e3),!or(t))throw new Error("priority must be a number");var r=n;i&&((r=ar(n,i)).__fn=n.__fn||n);var o=this,a={priority:t,callback:r};e.forEach(function(e){o._addListener(e,a)})},pr.prototype.once=function(e,t,n,i){var r=this;if(ir(t)&&(i=n,n=t,t=1e3),!or(t))throw new Error("priority must be a number");function o(){return r.off(e,o),n.apply(i,arguments)}o.__fn=n,this.on(e,t,o)},pr.prototype.off=function(e,t){var n,i,r,o=this._getListeners(e);if(t)for(r=o.length-1;n=o[r];r--)(i=n.callback)!==t&&i.__fn!==t||o.splice(r,1);else o.length=0},pr.prototype.createEvent=function(e){var t=new ur;return t.init(e),t},pr.prototype.fire=function(e,t){var n,i,r,o;if(o=cr.call(arguments),"object"==typeof e&&(e=(n=e).type),!e)throw new Error("no event type specified");if(i=this._listeners[e]){n=t instanceof ur?t:this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return void 0===r&&n.defaultPrevented&&(r=!1),r}},pr.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},pr.prototype._destroy=function(){this._listeners={}},pr.prototype._invokeListeners=function(e,t,n){var i,r,o;for(i=0;(r=n[i])&&!e.cancelBubble;i++)o=this._invokeListener(e,t,r);return o},pr.prototype._invokeListener=function(e,t,n){var i;try{void 0!==(i=function(e,t){return e.apply(null,t)}(n.callback,t))&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener"),console.error(e.stack),e}return i},pr.prototype._addListener=function(e,t){var n,i,r=this._getListeners(e);for(i=0;n=r[i];i++)if(n.priority<t.priority)return void r.splice(i,0,t);r.push(t)},pr.prototype._getListeners=function(e){var t=this._listeners[e];return t||(this._listeners[e]=t=[]),t},ur.prototype.stopPropagation=function(){this.cancelBubble=!0},ur.prototype.preventDefault=function(){this.defaultPrevented=!0},ur.prototype.init=function(e){sr(this,e||{})};var hr={},dr=Y.query;hr.getVisual=function(e){return dr(".djs-visual",e)},hr.getChildren=function(e){return e.parentNode.childNodes[1]};var mr=s.forEach,fr=s.reduce,yr=w.translate,vr=Y.clear,gr=n.append,br=n.attr,xr=n.classes,Er=n.create,_r=n.remove;function wr(e,t){this._eventBus=e,this._elementRegistry=t}wr.$inject=["eventBus","elementRegistry"];var Sr=wr;function Tr(e,t,n){t.insertBefore(e,n||t.firstChild)}wr.prototype._getChildren=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=hr.getChildren(n))||(t=Er("g"),xr(t).add("djs-children"),gr(n.parentNode,t)):t=n,t},wr.prototype._clear=function(e){var t=hr.getVisual(e);return vr(t),t},wr.prototype._createContainer=function(e,t,n){var i=Er("g");xr(i).add("djs-group"),void 0!==n?Tr(i,t,t.childNodes[n]):gr(t,i);var r=Er("g");xr(r).add("djs-element"),xr(r).add("djs-"+e),gr(i,r);var o=Er("g");return xr(o).add("djs-visual"),gr(r,o),r},wr.prototype.create=function(e,t,n){var i=this._getChildren(t.parent);return this._createContainer(e,i,n)},wr.prototype.updateContainments=function(e){var t,n=this,i=this._elementRegistry;t=fr(e,function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e},{}),mr(t,function(e){var t=e.children;if(t){var r=n._getChildren(e);mr(t.slice().reverse(),function(e){Tr(i.getGraphics(e).parentNode,r)})}})},wr.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},wr.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},wr.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},wr.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},wr.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),yr(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(i,t)}t.hidden?br(n,"display","none"):br(n,"display","block")}},wr.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);_r(t.parentNode)};var Cr=i.componentsToPath,Ar=i.createLine,Rr=n.append,Pr=n.attr,Mr=n.create,kr=1;function Br(e,t){_.call(this,e,kr),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2})}U(Br,_),Br.prototype.canRender=function(){return!0},Br.prototype.drawShape=function(e,t){var n=Mr("rect");return Pr(n,{x:0,y:0,width:t.width||0,height:t.height||0}),Pr(n,this.SHAPE_STYLE),Rr(e,n),n},Br.prototype.drawConnection=function(e,t){var n=Ar(t.waypoints,this.CONNECTION_STYLE);return Rr(e,n),n},Br.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width,r=e.height;return Cr([["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]])},Br.prototype.getConnectionPath=function(e){var t,n,i=e.waypoints,r=[];for(t=0;n=i[t];t++)n=n.original||n,r.push([0===t?"M":"L",n.x,n.y]);return Cr(r)},Br.$inject=["eventBus","styles"];var Nr=Br,Dr=s.isArray,Or=s.assign,Lr=s.reduce;var Ir={__depends__:[{__init__:["defaultRenderer"],defaultRenderer:["type",Nr],styles:["type",function(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(e,t,n){var i=this.style(t,n);return Or(i,{class:e})},this.style=function(t,n){Dr(t)||n||(n=t,t=[]);var i=Lr(t,function(t,n){return Or(t,e[n]||{})},{});return n?Or(i,n):i},this.computeStyle=function(e,n,i){return Dr(n)||(i=n,n=[]),t.style(n||[],Or({},i,e||{}))}}]}],__init__:["canvas"],canvas:["type",Oi],elementRegistry:["type",nr],elementFactory:["type",Qi],eventBus:["type",lr],graphicsFactory:["type",Sr]},jr={exports:{}};!function(e,t){"object"==typeof jr.exports?t(jr.exports):t(e.didi={})}(this,function(e){"use strict";var t=/^class /;function n(e){return"[object Array]"===Object.prototype.toString.call(e)}function i(){var e=Array.prototype.slice.call(arguments);1===e.length&&n(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var r=/constructor\s*[^(]*\(\s*([^)]*)\)/m,o=/^function\s*[^(]*\(\s*([^)]*)\)/m,a=/\/\*([^*]*)\*\//m;function s(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var n=e.toString().match(function(e){return t.test(e.toString())}(e)?r:o);return n&&n[1]&&n[1].split(",").map(function(e){return(n=e.match(a))?n[1].trim():e.trim()})||[]}function c(){var e=[];this.factory=function(t,n){return e.push([t,"factory",n]),this},this.value=function(t,n){return e.push([t,"value",n]),this},this.type=function(t,n){return e.push([t,"type",n]),this},this.forEach=function(t){e.forEach(t)}}var p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function l(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function u(e,t){return Object.hasOwnProperty.call(e,t)}e.Injector=function e(t,r){r=r||{get:function(e,t){if(o.push(e),!1===t)return null;throw m('No provider for "'+e+'"!')}};var o=[],a=this._providers=Object.create(r._providers||null),h=this._instances=Object.create(null),d=h.injector=this,m=function(e){var t=o.join(" -> ");return o.length=0,new Error(t?e+" (Resolving: "+t+")":e)},f=function e(t,n){if(!a[t]&&-1!==t.indexOf(".")){for(var i=t.split("."),s=e(i.shift());i.length;)s=s[i.shift()];return s}if(u(h,t))return h[t];if(u(a,t)){if(-1!==o.indexOf(t))throw o.push(t),m("Cannot resolve circular dependency!");return o.push(t),h[t]=a[t][0](a[t][1]),o.pop(),h[t]}return r.get(t,n)},y=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof e){if(!n(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=i(e.slice())}return{fn:e,dependencies:(e.$inject||s(e)).map(function(e){return u(t,e)?t[e]:f(e)})}},v=function(e){var t=y(e),n=t.dependencies,i=t.fn;return new(Function.prototype.bind.apply(i,[null].concat(l(n))))},g=function(e,t,n){var i=y(e,n),r=i.dependencies,o=i.fn;return o.call.apply(o,[t].concat(l(r)))},b=function(e){return i(function(t){return e.get(t)})},x={factory:g,type:v,value:function(e){return e}};t.forEach(function(t){function r(e,t){return"value"!==e&&n(t)&&(t=i(t.slice())),t}if(t instanceof c)t.forEach(function(e){var t=e[0],n=e[1],i=e[2];a[t]=[x[n],r(n,i),n]});else if("object"===(void 0===t?"undefined":p(t)))if(t.__exports__){var o=Object.keys(t).reduce(function(e,n){return"__"!==n.substring(0,2)&&(e[n]=t[n]),e},Object.create(null)),s=new e((t.__modules__||[]).concat([o]),d),l=i(function(e){return s.get(e)});t.__exports__.forEach(function(e){a[e]=[l,e,"private",s]})}else Object.keys(t).forEach(function(e){if("private"!==t[e][2]){var n=t[e][0],i=t[e][1];a[e]=[x[n],r(n,i),n]}else a[e]=t[e]})}),this.get=f,this.invoke=g,this.instantiate=v,this.createChild=function(t,n){if(n&&n.length){var i,r,o,s,c=Object.create(null),p=Object.create(null),l=[],u=[],h=[];for(var m in a)i=a[m],-1!==n.indexOf(m)&&("private"===i[2]?-1===(r=l.indexOf(i[3]))?(o=i[3].createChild([],n),s=b(o),l.push(i[3]),u.push(o),h.push(s),c[m]=[s,m,"private",o]):c[m]=[h[r],m,"private",u[r]]:c[m]=[i[2],i[1]],p[m]=!0),"factory"!==i[2]&&"type"!==i[2]||!i[1].$scope||n.forEach(function(e){-1!==i[1].$scope.indexOf(e)&&(c[m]=[i[2],i[1]],p[e]=!0)});n.forEach(function(e){if(!p[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')}),t.unshift(c)}return new e(t,d)}},Object.defineProperty(e,"__esModule",{value:!0})});var zr=(jr=jr.exports).Injector;function Fr(e){var t=[],n=[];function i(e){return t.indexOf(e)>=0}e.forEach(function e(r){i(r)||((r.__depends__||[]).forEach(e),i(r)||(function(e){t.push(e)}(r),(r.__init__||[]).forEach(function(e){n.push(e)})))});var r=new zr(t);return n.forEach(function(e){try{r["string"==typeof e?"get":"invoke"](e)}catch(e){throw console.error("Failed to instantiate component"),console.error(e.stack),e}}),r}function $r(e,t){this.injector=t=t||function(e){return Fr([{config:["value",e=e||{}]},Ir].concat(e.modules||[]))}(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}var Gr=$r;$r.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},$r.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};var Wr=Gr;function Hr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}var Vr=Hr;Hr.prototype.next=function(){return this._prefix+ ++this._counter};var qr=s.isArray,Ur=s.isString,Yr=s.isObject,Kr=s.assign,Xr=s.forEach,Zr=s.find,Qr=s.filter,Jr=s.matchPattern,eo=Y.domify,to=Y.classes,no=Y.attr,io=Y.remove,ro=Y.clear,oo=ci.getBBox,ao=new Vr("ov");function so(e,t,n){Kr(e.style,{left:t+"px",top:n+"px"})}function co(e,t){e.style.display=!1===t?"none":""}function po(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}function lo(e){return void 0!==e}function uo(e,t,n,i){var r,o;this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=ao,this._overlayDefaults=Kr({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(r=n.getContainer(),o=eo('<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'),r.insertBefore(o,r.firstChild),o),this._init()}uo.$inject=["config.overlays","eventBus","canvas","elementRegistry"];var ho=uo;uo.prototype.get=function(e){if(Ur(e)&&(e={id:e}),Ur(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Qr(t.overlays,Jr({type:e.type})):t.overlays.slice():[]}return e.type?Qr(this._overlays,Jr({type:e.type})):e.id?this._overlays[e.id]:null},uo.prototype.add=function(e,t,n){if(Yr(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=Kr({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},uo.prototype.remove=function(e){var t=this.get(e)||[];qr(t)||(t=[t]);var n=this;Xr(t,function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(io(e.html),io(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var i=t.overlays.indexOf(e);-1!==i&&t.overlays.splice(i,1)}})},uo.prototype.show=function(){co(this._overlayRoot)},uo.prototype.hide=function(){co(this._overlayRoot,!1)},uo.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ro(this._overlayRoot)},uo.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=oo(t);i=o.x,r=o.y}so(n,i,r),no(e.html,"data-container-id",t.id)},uo.prototype._updateOverlay=function(e){var t,n,i=e.position,r=e.htmlContainer,o=e.element,a=i.left,s=i.top;void 0!==i.right&&(t=o.waypoints?oo(o).width:o.width,a=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?oo(o).height:o.height,s=-1*i.bottom+n);so(r,a||0,s||0)},uo.prototype._createOverlayContainer=function(e){var t=eo('<div class="djs-overlays" style="position: absolute" />');this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},uo.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";po(this._overlayRoot,n)},uo.prototype._getOverlayContainer=function(e,t){var n=Zr(this._overlayContainers,function(t){return t.element===e});return n||t?n:this._createOverlayContainer(e)},uo.prototype._addOverlay=function(e){var t,n,i=e.id,r=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),Ur(o)&&(o=eo(o)),n=this._getOverlayContainer(r),(t=eo('<div class="djs-overlay" data-overlay-id="'+i+'" style="position: absolute">')).appendChild(o),e.type&&to(t).add("djs-overlay-"+e.type),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[i]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},uo.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=n&&n.minZoom,r=n&&n.maxZoom,o=e.htmlContainer,a=!0;n&&((lo(i)&&i>t.scale||lo(r)&&r<t.scale)&&(a=!1),co(o,a)),this._updateOverlayScale(e,t)},uo.prototype._updateOverlayScale=function(e,t){var n,i,r,o=e.scale,a=e.htmlContainer,s="";!0!==o&&(!1===o?(n=1,i=1):(n=o.min,i=o.max),lo(n)&&t.scale<n&&(r=(1/t.scale||1)*n),lo(i)&&t.scale>i&&(r=(1/t.scale||1)*i)),lo(r)&&(s="scale("+r+","+r+")"),po(a,s)},uo.prototype._updateOverlaysVisibilty=function(e){var t=this;Xr(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},uo.prototype._init=function(){var e=this._eventBus,t=this;e.on("canvas.viewbox.changing",function(e){t.hide()}),e.on("canvas.viewbox.changed",function(e){var n;n=e.viewbox,t._updateRoot(n),t._updateOverlaysVisibilty(n),t.show()}),e.on(["shape.remove","connection.remove"],function(e){var n=e.element,i=t.get({element:n});Xr(i,function(e){t.remove(e.id)});var r=t._getOverlayContainer(n);if(r){io(r.html);var o=t._overlayContainers.indexOf(r);-1!==o&&t._overlayContainers.splice(o,1)}}),e.on("element.changed",500,function(e){var n=e.element,i=t._getOverlayContainer(n,!0);i&&(Xr(i.overlays,function(e){t._updateOverlay(e)}),t._updateOverlayContainer(i))}),e.on("element.marker.update",function(e){var n=t._getOverlayContainer(e.element,!0);n&&to(n.html)[e.add?"add":"remove"](e.marker)}),e.on("diagram.clear",this.clear,this)};var mo={__init__:["overlays"],overlays:["type",ho]},fo={};function yo(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function vo(e){return e.originalEvent||e.srcEvent}fo.getOriginal=vo,fo.stopPropagation=function(e,t){yo(e),yo(vo(e))},fo.toPoint=function(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null};var go={isMac:function(){return/mac/i.test(navigator.platform)}},bo={},xo=fo.getOriginal,Eo=go.isMac;function _o(e){return!(xo(e)||e).button}bo.isPrimaryButton=_o,bo.hasPrimaryModifier=function(e){var t=xo(e)||e;return!!_o(e)&&(Eo()?t.metaKey:t.ctrlKey)},bo.hasSecondaryModifier=function(e){var t=xo(e)||e;return _o(e)&&t.shiftKey};var wo=s.forEach,So=Y.delegate,To=bo.isPrimaryButton,Co=n.append,Ao=n.attr,Ro=n.create,Po=Y.query,Mo=i.createLine,ko=i.updateLine;function Bo(e){return!0}var No=500;function Do(e,t,n){var i=n.cls("djs-hit",["no-fill","no-border"],{stroke:"white",strokeWidth:15});function r(n,i,r){var o,a;(function(e,t){return!(c[e]||To)(t)})(n,i)||(r?a=t.getGraphics(r):(o=i.delegateTarget||i.target)&&(a=o,r=t.get(a)),a&&r&&!1===e.fire(n,{element:r,gfx:a,originalEvent:i})&&(i.stopPropagation(),i.preventDefault()))}var o={};function a(e){return o[e]}var s={mouseover:"element.hover",mouseout:"element.out",click:"element.click",dblclick:"element.dblclick",mousedown:"element.mousedown",mouseup:"element.mouseup",contextmenu:"element.contextmenu"},c={"element.contextmenu":Bo};var p="svg, .djs-element";function l(e,t,n,i){var a=o[n]=function(e){r(n,e)};i&&(c[n]=i),a.$delegate=So.bind(e,p,t,a)}function u(e,t,n){var i=a(n);i&&So.unbind(e,t,i.$delegate)}e.on("canvas.destroy",function(e){var t;t=e.svg,wo(s,function(e,n){u(t,n,e)})}),e.on("canvas.init",function(e){var t;t=e.svg,wo(s,function(e,n){l(t,n,e)})}),e.on(["shape.added","connection.added"],function(e){var t,n=e.element,r=e.gfx;n.waypoints?t=Mo(n.waypoints):(t=Ro("rect"),Ao(t,{x:0,y:0,width:n.width,height:n.height})),Ao(t,i),Co(r,t)}),e.on("shape.changed",No,function(e){var t=e.element,n=e.gfx,i=Po(".djs-hit",n);Ao(i,{width:t.width,height:t.height})}),e.on("connection.changed",function(e){var t=e.element,n=e.gfx,i=Po(".djs-hit",n);ko(i,t.waypoints)}),this.fire=r,this.triggerMouseEvent=function(e,t,n){var i=s[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return r(i,t,n)},this.mouseHandler=a,this.registerEvent=l,this.unregisterEvent=u}Do.$inject=["eventBus","elementRegistry","styles"];var Oo={__init__:["interactionEvents"],interactionEvents:["type",Do]},Lo=ci.getBBox,Io=500,jo=n.append,zo=n.attr,Fo=n.create,$o=Y.query,Go=s.assign;function Wo(e,t,n){this.offset=6;var i=t.cls("djs-outline",["no-fill"]),r=this;function o(e,t){var n=Fo("rect");return zo(n,Go({x:10,y:10,width:100,height:100},i)),jo(e,n),n}e.on(["shape.added","shape.changed"],Io,function(e){var t=e.element,n=e.gfx,i=$o(".djs-outline",n);i||(i=o(n)),r.updateShapeOutline(i,t)}),e.on(["connection.added","connection.changed"],function(e){var t=e.element,n=e.gfx,i=$o(".djs-outline",n);i||(i=o(n)),r.updateConnectionOutline(i,t)})}Wo.prototype.updateShapeOutline=function(e,t){zo(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},Wo.prototype.updateConnectionOutline=function(e,t){var n=Lo(t);zo(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},Wo.$inject=["eventBus","styles","elementRegistry"];var Ho={__init__:["outline"],outline:["type",Wo]},Vo=s.isArray,qo=s.forEach;function Uo(e){this._eventBus=e,this._selectedElements=[];var t=this;e.on(["shape.remove","connection.remove"],function(e){var n=e.element;t.deselect(n)}),e.on(["diagram.clear"],function(e){t.select(null)})}Uo.$inject=["eventBus"];var Yo=Uo;Uo.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var i=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},Uo.prototype.get=function(){return this._selectedElements},Uo.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},Uo.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();Vo(e)||(e=e?[e]:[]),t?qo(e,function(e){-1===n.indexOf(e)&&n.push(e)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:n})};var Ko=bo.hasPrimaryModifier,Xo=s.find;function Zo(e,t,n,i){e.on("create.end",500,function(e){e.context.canExecute&&t.select(e.context.shape)}),e.on("connect.end",500,function(e){e.context.canExecute&&e.context.target&&t.select(e.context.target)}),e.on("shape.move.end",500,function(e){var n=e.previousSelection||[],r=i.get(e.context.shape.id);Xo(n,function(e){return r.id===e.id})||t.select(r)}),e.on("element.click",function(e){var i=e.element;i===n.getRootElement()&&(i=null);var r=t.isSelected(i),o=t.get().length>1,a=Ko(e);if(r&&o)return a?t.deselect(i):t.select(i);r?t.deselect(i):t.select(i,a)})}Zo.$inject=["eventBus","selection","canvas","elementRegistry"];var Qo=Zo,Jo=s.forEach,ea="hover",ta="selected";function na(e,t,n,i){function r(e,n){t.addMarker(e,n)}function o(e,n){t.removeMarker(e,n)}this._multiSelectionBox=null,e.on("element.hover",function(e){r(e.element,ea)}),e.on("element.out",function(e){o(e.element,ea)}),e.on("selection.changed",function(e){var t=e.oldSelection,n=e.newSelection;Jo(t,function(e){-1===n.indexOf(e)&&o(e,ta)}),Jo(n,function(e){-1===t.indexOf(e)&&r(e,ta)})})}na.$inject=["eventBus","canvas","selection","styles"];var ia={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Oo,Ho],selection:["type",Yo],selectionVisuals:["type",na],selectionBehavior:["type",Qo]},ra=s.assign,oa=s.isNumber,aa=s.omit,sa=Y.domify,ca=Y.query,pa=Y.remove,la=n.innerSVG,ua=ut.importBpmnDiagram;var ha={width:"100%",height:"100%",position:"relative"};function da(e){return e+(oa(e)?"px":"")}function ma(e){var t,n,i;e=ra({},ha,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),t=this._container,n=ht.BPMNIO_IMG,i=sa('<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" style="position: absolute; bottom: 15px; right: 15px; z-index: 100">'+n+"</a>"),t.appendChild(i),ya.bind(i,"click",function(e){ht.open(),e.preventDefault()}),this._init(this._container,this._moddle,e)}U(ma,Wr);var fa=ma;ma.prototype.importXML=function(e,t){t=t||function(){};var n=this;e=this._emit("import.parse.start",{xml:e})||e,this._moddle.fromXML(e,"bpmn:Definitions",function(e,i,r){i=n._emit("import.parse.complete",{error:e,definitions:i,context:r})||i;var o=r.warnings;if(e)return e=function(e){var t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+t[2]),e}(e),n._emit("import.done",{error:e,warnings:o}),t(e,o);n.importDefinitions(i,function(e,i){var r=[].concat(o,i||[]);n._emit("import.done",{error:e,warnings:r}),t(e,r)})})},ma.prototype.saveXML=function(e,t){t||(t=e,e={});var n=this._definitions;if(!n)return t(new Error("no definitions loaded"));this._moddle.toXML(n,e,t)},ma.prototype.saveSVG=function(e,t){var n,i;t||(t=e,e={});try{var r=this.get("canvas"),o=r.getDefaultLayer(),a=ca("defs",r._svg),s=la(o),c=a?"<defs>"+la(a)+"</defs>":"",p=o.getBBox();n='<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- created with bpmn-js / http://bpmn.io --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+p.width+'" height="'+p.height+'" viewBox="'+p.x+" "+p.y+" "+p.width+" "+p.height+'" version="1.1">'+c+s+"</svg>"}catch(e){i=e}t(i,n)},ma.prototype.importDefinitions=function(e,t){try{this._definitions&&this.clear(),this._definitions=e}catch(e){return t(e)}return ua(this,e,t)},ma.prototype.getModules=function(){return this._modules},ma.prototype.destroy=function(){Wr.prototype.destroy.call(this),pa(this._container)},ma.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},ma.prototype.off=function(e,t){this.get("eventBus").off(e,t)},ma.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),"string"==typeof e&&(e=ca(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},ma.prototype.getDefinitions=function(){return this._definitions},ma.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},ma.prototype._init=function(e,t,n){var i=n.modules||this.getModules(),r=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],i,r),a=ra(aa(n,["additionalModules"]),{canvas:ra({},n.canvas,{container:e}),modules:o});Wr.call(this,a),n&&n.container&&this.attachTo(n.container)},ma.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},ma.prototype._createContainer=function(e){var t=sa('<div class="bjs-container"></div>');return ra(t.style,{width:da(e.width),height:da(e.height),position:e.position}),t},ma.prototype._createModdle=function(e){var t=ra({},this._moddleExtensions,e.moddleExtensions);return new ai(t)},ma.prototype._modules=[Je,Qe,ia,mo],ma.prototype._moddleExtensions={};var ya=Y.event;var va={},ga=5e3;va.install=function(e,t){function n(){return!1}return t=t||"element.click",e.once(t,ga,n),function(){e.off(t,n)}};var ba={},xa=Y.classes,Ea=/^djs-cursor-.*$/;ba.set=function(e){var t=xa(document.body);t.removeMatching(Ea),e&&t.add("djs-cursor-"+e)},ba.unset=function(){this.set(null)};var _a={};_a.log10=function(e){return Math.log(e)/Math.log(10)},_a.substract=function(e,t){return{x:e.x-t.x,y:e.y-t.y}};var wa=_a.substract,Sa=Y.event,Ta=Y.closest;var Ca=15;function Aa(e,t){var n;function i(i){var r,o=n.start,a=fo.toPoint(i),s=wa(a,o);if(!n.dragging&&(r=s,Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))>Ca)&&(n.dragging=!0,va.install(e),ba.set("grab")),n.dragging){var c=n.last||n.start;s=wa(a,c),t.scroll({dx:s.x,dy:s.y}),n.last=a}i.preventDefault()}function r(e){Sa.unbind(document,"mousemove",i),Sa.unbind(document,"mouseup",r),n=null,ba.unset()}e.on("element.mousedown",500,function(e){return function(e){if(!Ta(e.target,".djs-draggable")&&!(e.button||e.ctrlKey||e.shiftKey||e.altKey))return n={start:fo.toPoint(e)},Sa.bind(document,"mousemove",i),Sa.bind(document,"mouseup",r),!0}(e.originalEvent)})}Aa.$inject=["eventBus","canvas"];var Ra={__init__:["moveCanvas"],moveCanvas:["type",Aa]},Pa={},Ma=_a.log10;Pa.getStepSize=function(e,t){var n=Ma(e.min),i=Ma(e.max);return(Math.abs(n)+Math.abs(i))/t},Pa.cap=function(e,t){return Math.max(e.min,Math.min(e.max,t))};var ka=Y.event,Ba=Y.closest,Na=Pa.getStepSize,Da=Pa.cap,Oa=_a.log10,La=s.bind,Ia=Math.sign||function(e){return e>=0?1:-1},ja={min:.2,max:4},za=.75;function Fa(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=La(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||za;var i=this;t.on("canvas.init",function(t){i._init(!1!==e.enabled)})}Fa.$inject=["config.zoomScroll","eventBus","canvas"];var $a=Fa;Fa.prototype.scroll=function(e){this._canvas.scroll(e)},Fa.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Fa.prototype.zoom=function(e,t){var n=Na(ja,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},Fa.prototype._handleWheel=function(e){if(!Ba(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=e.ctrlKey,r=e.shiftKey,o=-1*this._scale;if(o*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){var a=t.getBoundingClientRect(),s={x:e.clientX-a.left,y:e.clientY-a.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Ia(e.deltaY)*o,this.zoom(n,s)}else n=r?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},Fa.prototype.stepZoom=function(e,t){var n=Na(ja,10);this._zoom(e,t,n)},Fa.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Oa(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(Da(ja,s),t)},Fa.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&ka[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},Fa.prototype._init=function(e){this.toggle(e)};var Ga={__init__:["zoomScroll"],zoomScroll:["type",$a]};function Wa(e){fa.call(this,e)}U(Wa,fa);var Ha=Wa;Wa.prototype._navigationModules=[Ga,Ra],Wa.prototype._modules=[].concat(Wa.prototype._modules,Wa.prototype._navigationModules);var Va={};function qa(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}Va.pointDistance=qa,Va.pointsOnLine=function(e,t,n,i){if(void 0===i&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=qa(e,t);return Math.abs(r/o)<=i};var Ua=2;Va.pointsAligned=function(e,t){return Math.abs(e.x-t.x)<=Ua?"h":Math.abs(e.y-t.y)<=Ua&&"v"},Va.pointInRect=function(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n},Va.getMidPoint=function(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}};var Ya="hasOwnProperty",Ka=/,?([a-z]),?/gi,Xa=parseFloat,Za=Math,Qa=Za.PI,Ja=Za.min,es=Za.max,ts=Za.pow,ns=Za.abs,is=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,rs=/(-?\d*\.?\d*(?:e[-+]?\\d+)?)[\s]*,?[\s]*/gi;function os(e,t){return"finite"==(t=String.prototype.toLowerCase.call(t))?isFinite(e):!("array"!=t||!(e instanceof Array||Array.isArray&&Array.isArray(e)))||("null"==t&&null===e||t==typeof e&&null!==e||"object"==t&&e===Object(e)||Object.prototype.toString.call(e).slice(8,-1).toLowerCase()==t)}function as(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)e[Ya](n)&&(t[n]=as(e[n]));return t}function ss(e){var t=ss.ps=ss.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout(function(){for(var n in t)t[Ya](n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])}),t[e]}function cs(e,t,n,i){return null==e&&(e=t=n=i=0),null==t&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,w:n,height:i,h:i,x2:e+n,y2:t+i,cx:e+n/2,cy:t+i/2,r1:Za.min(n,i)/2,r2:Za.max(n,i)/2,r0:Za.sqrt(n*n+i*i)/2,path:function(e,t,n,i,r){if(r)return[["M",+e+ +r,t],["l",n-2*r,0],["a",r,r,0,0,1,r,r],["l",0,i-2*r],["a",r,r,0,0,1,-r,r],["l",2*r-n,0],["a",r,r,0,0,1,-r,-r],["l",0,2*r-i],["a",r,r,0,0,1,r,-r],["z"]];var o=[["M",e,t],["l",n,0],["l",0,i],["l",-n,0],["z"]];return o.toString=ps,o}(e,t,n,i),vb:[e,t,n,i].join(" ")}}function ps(){return this.join(",").replace(Ka,"$1")}function ls(e){var t=as(e);return t.toString=ps,t}function us(e,t,n,i,r,o,a,s,c){var p=1-c,l=ts(p,3),u=ts(p,2),h=c*c,d=h*c,m=e+2*c*(n-e)+h*(r-2*n+e),f=t+2*c*(i-t)+h*(o-2*i+t),y=n+2*c*(r-n)+h*(a-2*r+n),v=i+2*c*(o-i)+h*(s-2*o+i);return{x:l*e+3*u*c*n+3*p*c*c*r+d*a,y:l*t+3*u*c*i+3*p*c*c*o+d*s,m:{x:m,y:f},n:{x:y,y:v},start:{x:p*e+c*n,y:p*t+c*i},end:{x:p*r+c*a,y:p*o+c*s},alpha:90-180*Za.atan2(m-y,f-v)/Qa}}function hs(e,t,n,i,r,o,a,s){os(e,"array")||(e=[e,t,n,i,r,o,a,s]);var c=function(e,t,n,i,r,o,a,s){for(var c,p,l,u,h,d,m,f,y=[],v=[[],[]],g=0;g<2;++g)if(0==g?(p=6*e-12*n+6*r,c=-3*e+9*n-9*r+3*a,l=3*n-3*e):(p=6*t-12*i+6*o,c=-3*t+9*i-9*o+3*s,l=3*i-3*t),ns(c)<1e-12){if(ns(p)<1e-12)continue;0<(u=-l/p)&&u<1&&y.push(u)}else m=p*p-4*l*c,f=Za.sqrt(m),m<0||(0<(h=(-p+f)/(2*c))&&h<1&&y.push(h),0<(d=(-p-f)/(2*c))&&d<1&&y.push(d));var b,x=y.length,E=x;for(;x--;)u=y[x],b=1-u,v[0][x]=b*b*b*e+3*b*b*u*n+3*b*u*u*r+u*u*u*a,v[1][x]=b*b*b*t+3*b*b*u*i+3*b*u*u*o+u*u*u*s;return v[0][E]=e,v[1][E]=t,v[0][E+1]=a,v[1][E+1]=s,v[0].length=v[1].length=E+2,{min:{x:Ja.apply(0,v[0]),y:Ja.apply(0,v[1])},max:{x:es.apply(0,v[0]),y:es.apply(0,v[1])}}}.apply(null,e);return cs(c.min.x,c.min.y,c.max.x-c.min.x,c.max.y-c.min.y)}function ds(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function ms(e,t,n,i,r){return e*(e*(-3*t+9*n-9*i+3*r)+6*t-12*n+6*i)-3*t+3*n}function fs(e,t,n,i,r,o,a,s,c){null==c&&(c=1);for(var p=(c=c>1?1:c<0?0:c)/2,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,d=0;d<12;d++){var m=p*l[d]+p,f=ms(m,e,n,r,a),y=ms(m,t,i,o,s),v=f*f+y*y;h+=u[d]*Za.sqrt(v)}return p*h}function ys(e,t,n,i,r,o,a,s){if(!(es(e,n)<Ja(r,a)||Ja(e,n)>es(r,a)||es(t,i)<Ja(o,s)||Ja(t,i)>es(o,s))){var c=(e-n)*(o-s)-(t-i)*(r-a);if(c){var p=((e*i-t*n)*(r-a)-(e-n)*(r*s-o*a))/c,l=((e*i-t*n)*(o-s)-(t-i)*(r*s-o*a))/c,u=+p.toFixed(2),h=+l.toFixed(2);if(!(u<+Ja(e,n).toFixed(2)||u>+es(e,n).toFixed(2)||u<+Ja(r,a).toFixed(2)||u>+es(r,a).toFixed(2)||h<+Ja(t,i).toFixed(2)||h>+es(t,i).toFixed(2)||h<+Ja(o,s).toFixed(2)||h>+es(o,s).toFixed(2)))return{x:p,y:l}}}}function vs(e,t,n){if(!function(e,t){return e=cs(e),ds(t=cs(t),e.x,e.y)||ds(t,e.x2,e.y)||ds(t,e.x,e.y2)||ds(t,e.x2,e.y2)||ds(e,t.x,t.y)||ds(e,t.x2,t.y)||ds(e,t.x,t.y2)||ds(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}(hs(e),hs(t)))return n?0:[];for(var i=~~(fs.apply(0,e)/5),r=~~(fs.apply(0,t)/5),o=[],a=[],s={},c=n?0:[],p=0;p<i+1;p++){var l=us.apply(0,e.concat(p/i));o.push({x:l.x,y:l.y,t:p/i})}for(p=0;p<r+1;p++)l=us.apply(0,t.concat(p/r)),a.push({x:l.x,y:l.y,t:p/r});for(p=0;p<i;p++)for(var u=0;u<r;u++){var h=o[p],d=o[p+1],m=a[u],f=a[u+1],y=ns(d.x-h.x)<.01?"y":"x",v=ns(f.x-m.x)<.01?"y":"x",g=ys(h.x,h.y,d.x,d.y,m.x,m.y,f.x,f.y);if(g){if(s[g.x.toFixed(0)]==g.y.toFixed(0))continue;s[g.x.toFixed(0)]=g.y.toFixed(0);var b=h.t+ns((g[y]-h[y])/(d[y]-h[y]))*(d.t-h.t),x=m.t+ns((g[v]-m[v])/(f[v]-m[v]))*(f.t-m.t);b>=0&&b<=1&&x>=0&&x<=1&&(n?c++:c.push({x:g.x,y:g.y,t1:b,t2:x}))}}return c}function gs(e,t,n,i,r){if(null==r&&null==i&&(i=n),e=+e,t=+t,n=+n,i=+i,null!=r)var o=Math.PI/180,a=e+n*Math.cos(-i*o),s=e+n*Math.cos(-r*o),c=[["M",a,t+n*Math.sin(-i*o)],["A",n,n,0,+(r-i>180),0,s,t+n*Math.sin(-r*o)]];else c=[["M",e,t],["m",0,-i],["a",n,i,0,1,1,0,2*i],["a",n,i,0,1,1,0,-2*i],["z"]];return c.toString=ps,c}function bs(e){var t=ss(e);if(t.abs)return ls(t.abs);if(os(e,"array")&&os(e&&e[0],"array")||(e=function(e){if(!e)return null;var t=ss(e);if(t.arr)return as(t.arr);var n={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},i=[];return os(e,"array")&&os(e[0],"array")&&(i=as(e)),i.length||String(e).replace(is,function(e,t,r){var o=[],a=t.toLowerCase();if(r.replace(rs,function(e,t){t&&o.push(+t)}),"m"==a&&o.length>2&&(i.push([t].concat(o.splice(0,2))),a="l",t="m"==t?"l":"L"),"o"==a&&1==o.length&&i.push([t,o[0]]),"r"==a)i.push([t].concat(o));else for(;o.length>=n[a]&&(i.push([t].concat(o.splice(0,n[a]))),n[a]););}),i.toString=ss.toString,t.arr=as(i),i}(e)),!e||!e.length)return[["M",0,0]];var n,i=[],r=0,o=0,a=0,s=0,c=0;"M"==e[0][0]&&(a=r=+e[0][1],s=o=+e[0][2],c++,i[0]=["M",r,o]);for(var p,l,u=3==e.length&&"M"==e[0][0]&&"R"==e[1][0].toUpperCase()&&"Z"==e[2][0].toUpperCase(),h=c,d=e.length;h<d;h++){if(i.push(p=[]),(n=(l=e[h])[0])!=n.toUpperCase())switch(p[0]=n.toUpperCase(),p[0]){case"A":p[1]=l[1],p[2]=l[2],p[3]=l[3],p[4]=l[4],p[5]=l[5],p[6]=+l[6]+r,p[7]=+l[7]+o;break;case"V":p[1]=+l[1]+o;break;case"H":p[1]=+l[1]+r;break;case"R":for(var m=[r,o].concat(l.slice(1)),f=2,y=m.length;f<y;f++)m[f]=+m[f]+r,m[++f]=+m[f]+o;i.pop(),i=i.concat(ws(m,u));break;case"O":i.pop(),(m=gs(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);break;case"U":i.pop(),i=i.concat(gs(r,o,l[1],l[2],l[3])),p=["U"].concat(i[i.length-1].slice(-2));break;case"M":a=+l[1]+r,s=+l[2]+o;default:for(f=1,y=l.length;f<y;f++)p[f]=+l[f]+(f%2?r:o)}else if("R"==n)m=[r,o].concat(l.slice(1)),i.pop(),i=i.concat(ws(m,u)),p=["R"].concat(l.slice(-2));else if("O"==n)i.pop(),(m=gs(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);else if("U"==n)i.pop(),i=i.concat(gs(r,o,l[1],l[2],l[3])),p=["U"].concat(i[i.length-1].slice(-2));else for(var v=0,g=l.length;v<g;v++)p[v]=l[v];if("O"!=(n=n.toUpperCase()))switch(p[0]){case"Z":r=+a,o=+s;break;case"H":r=p[1];break;case"V":o=p[1];break;case"M":a=p[p.length-2],s=p[p.length-1];default:r=p[p.length-2],o=p[p.length-1]}}return i.toString=ps,t.abs=ls(i),i}function xs(e,t,n,i){return[e,t,n,i,n,i]}function Es(e,t,n,i,r,o){return[1/3*e+2/3*n,1/3*t+2/3*i,1/3*r+2/3*n,1/3*o+2/3*i,r,o]}function _s(e,t,n,i,r,o,a,s,c,p){var l,u,h,d,m=120*Qa/180,f=Qa/180*(+r||0),y=[],v=(u=function(e,t,n){return{x:e*Za.cos(n)-t*Za.sin(n),y:e*Za.sin(n)+t*Za.cos(n)}},function e(){var t=Array.prototype.slice.call(arguments,0),n=t.join("␀"),i=e.cache=e.cache||{},r=e.count=e.count||[];return i[Ya](n)?(function(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}(r,n),d?d(i[n]):i[n]):(r.length>=1e3&&delete i[r.shift()],r.push(n),i[n]=u.apply(h,t),d?d(i[n]):i[n])});if(p)C=p[0],A=p[1],S=p[2],T=p[3];else{e=(l=v(e,t,-f)).x,t=l.y;var g=(e-(s=(l=v(s,c,-f)).x))/2,b=(t-(c=l.y))/2,x=g*g/(n*n)+b*b/(i*i);x>1&&(n*=x=Za.sqrt(x),i*=x);var E=n*n,_=i*i,w=(o==a?-1:1)*Za.sqrt(ns((E*_-E*b*b-_*g*g)/(E*b*b+_*g*g))),S=w*n*b/i+(e+s)/2,T=w*-i*g/n+(t+c)/2,C=Za.asin(((t-T)/i).toFixed(9)),A=Za.asin(((c-T)/i).toFixed(9));(C=e<S?Qa-C:C)<0&&(C=2*Qa+C),(A=s<S?Qa-A:A)<0&&(A=2*Qa+A),a&&C>A&&(C-=2*Qa),!a&&A>C&&(A-=2*Qa)}var R=A-C;if(ns(R)>m){var P=A,M=s,k=c;A=C+m*(a&&A>C?1:-1),y=_s(s=S+n*Za.cos(A),c=T+i*Za.sin(A),n,i,r,0,a,M,k,[A,P,S,T])}R=A-C;var B=Za.cos(C),N=Za.sin(C),D=Za.cos(A),O=Za.sin(A),L=Za.tan(R/4),I=4/3*n*L,j=4/3*i*L,z=[e,t],F=[e+I*N,t-j*B],$=[s+I*O,c-j*D],G=[s,c];if(F[0]=2*z[0]-F[0],F[1]=2*z[1]-F[1],p)return[F,$,G].concat(y);for(var W=[],H=0,V=(y=[F,$,G].concat(y).join().split(",")).length;H<V;H++)W[H]=H%2?v(y[H-1],y[H],f).y:v(y[H],y[H+1],f).x;return W}function ws(e,t){for(var n=[],i=0,r=e.length;r-2*!t>i;i+=2){var o=[{x:+e[i-2],y:+e[i-1]},{x:+e[i],y:+e[i+1]},{x:+e[i+2],y:+e[i+3]},{x:+e[i+4],y:+e[i+5]}];t?i?r-4==i?o[3]={x:+e[0],y:+e[1]}:r-2==i&&(o[2]={x:+e[0],y:+e[1]},o[3]={x:+e[2],y:+e[3]}):o[0]={x:+e[r-2],y:+e[r-1]}:r-4==i?o[3]=o[2]:i||(o[0]={x:+e[i],y:+e[i+1]}),n.push(["C",(-o[0].x+6*o[1].x+o[2].x)/6,(-o[0].y+6*o[1].y+o[2].y)/6,(o[1].x+6*o[2].x-o[3].x)/6,(o[1].y+6*o[2].y-o[3].y)/6,o[2].x,o[2].y])}return n}function Ss(e,t){var n=!t&&ss(e);if(!t&&n.curve)return ls(n.curve);for(var i=bs(e),r=t&&bs(t),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s=function(e,t,n){var i,r;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"].concat(_s.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":"C"==n||"S"==n?(i=2*t.x-t.bx,r=2*t.y-t.by):(i=t.x,r=t.y),e=["C",i,r].concat(e.slice(1));break;case"T":"Q"==n||"T"==n?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),e=["C"].concat(Es(t.x,t.y,t.qx,t.qy,e[1],e[2]));break;case"Q":t.qx=e[1],t.qy=e[2],e=["C"].concat(Es(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(xs(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(xs(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(xs(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(xs(t.x,t.y,t.X,t.Y))}return e},c=function(e,t){if(e[t].length>7){e[t].shift();for(var n=e[t];n.length;)l[t]="A",r&&(u[t]="A"),e.splice(t++,0,["C"].concat(n.splice(0,6)));e.splice(t,1),f=es(i.length,r&&r.length||0)}},p=function(e,t,n,o,a){e&&t&&"M"==e[a][0]&&"M"!=t[a][0]&&(t.splice(a,0,["M",o.x,o.y]),n.bx=0,n.by=0,n.x=e[a][1],n.y=e[a][2],f=es(i.length,r&&r.length||0))},l=[],u=[],h="",d="",m=0,f=es(i.length,r&&r.length||0);m<f;m++){i[m]&&(h=i[m][0]),"C"!=h&&(l[m]=h,m&&(d=l[m-1])),i[m]=s(i[m],o,d),"A"!=l[m]&&"C"==h&&(l[m]="C"),c(i,m),r&&(r[m]&&(h=r[m][0]),"C"!=h&&(u[m]=h,m&&(d=u[m-1])),r[m]=s(r[m],a,d),"A"!=u[m]&&"C"==h&&(u[m]="C"),c(r,m)),p(i,r,o,a,m),p(r,i,a,o,m);var y=i[m],v=r&&r[m],g=y.length,b=r&&v.length;o.x=y[g-2],o.y=y[g-1],o.bx=Xa(y[g-4])||o.x,o.by=Xa(y[g-3])||o.y,a.bx=r&&(Xa(v[b-4])||a.x),a.by=r&&(Xa(v[b-3])||a.y),a.x=r&&v[b-2],a.y=r&&v[b-1]}return r||(n.curve=ls(i)),r?[i,r]:i}var Ts=function(e,t,n){e=Ss(e),t=Ss(t);for(var i,r,o,a,s,c,p,l,u,h,d=n?0:[],m=0,f=e.length;m<f;m++){var y=e[m];if("M"==y[0])i=s=y[1],r=c=y[2];else{"C"==y[0]?(i=(u=[i,r].concat(y.slice(1)))[6],r=u[7]):(u=[i,r,i,r,s,c,s,c],i=s,r=c);for(var v=0,g=t.length;v<g;v++){var b=t[v];if("M"==b[0])o=p=b[1],a=l=b[2];else{"C"==b[0]?(o=(h=[o,a].concat(b.slice(1)))[6],a=h[7]):(h=[o,a,o,a,p,l,p,l],o=p,a=l);var x=vs(u,h,n);if(n)d+=x;else{for(var E=0,_=x.length;E<_;E++)x[E].segment1=m,x[E].segment2=v,x[E].bez1=u,x[E].bez2=h;d=d.concat(x)}}}}}return d},Cs={},As=s.isObject,Rs=s.sortBy,Ps=Va.pointDistance;function Ms(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ks(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Bs(e,t){return Ts(e,t)}Cs.roundBounds=function(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}},Cs.roundPoint=Ms,Cs.asTRBL=ks,Cs.asBounds=function(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}},Cs.getMid=function(e){return Ms({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})},Cs.getOrientation=function(e,t,n){As(n=n||0)||(n={x:n,y:n});var i=ks(e),r=ks(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=o?"top":s?"bottom":null,p=i.right+n.x<=r.left?"left":a?"right":null;return p&&c?c+"-"+p:p||c||"intersect"},Cs.getElementLineIntersection=function(e,t,n){var i=Bs(e,t);return 1===i.length?Ms(i[0]):2===i.length&&Ps(i[0],i[1])<1?Ms(i[0]):i.length>1?Ms((i=Rs(i,function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t}))[n?0:i.length-1]):null};var Ns={},Ds=d.is,Os=Cs.getMid,Ls=Cs.asTRBL,Is=Cs.getOrientation,js=s.find,zs=s.reduce,Fs=50,$s=250,Gs=10;function Ws(e,t){var n=Ls(e);function i(e){return Ds(e,"bpmn:SequenceFlow")}var r,o=zs([].concat(Ks(e,i).map((r=5,function(e){return{shape:e,weight:r,distanceTo:function(e){return Ls(e).left-n.right}}})),Ys(e,i).map(function(e){return function(t){return{shape:t,weight:e,distanceTo:function(e){var t=Ls(e);return n.left-t.right}}}}(1))),function(e,t){return e[t.shape.id+"__weight_"+t.weight]=t,e},{}),a=zs(o,function(e,t){var n,i,r,o=t.shape,a=t.weight,s=t.distanceTo,c=e.fav;return(n=s(o))<0||n>$s?e:(i=(r=e[String(n)]=e[String(n)]||{value:n,count:0}).count+=1*a,(!c||c.count<i)&&(e.fav=r),e)},{});return a.fav?a.fav.value:Fs}function Hs(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=function(e,t){var n=Us(e);return e.host&&(n=n.concat(Us(e.host))),e.attachers&&(n=n.concat(e.attachers.reduce(function(e,t){return e.concat(Us(t))},[]))),n}(e);return js(r,function(e){return e!==n&&"intersect"===Is(e,i,Gs)})}function Vs(e,t,n,i){function r(e){var r={x:n.x,y:n.y};return["x","y"].forEach(function(a){var s=i[a];if(s){var c="x"===a?"width":"height",p=s.margin,l=s.rowSize;r[a]=p<0?Math.min(e[a]+p-t[c]/2,n[a]-l+p):Math.max(o[a]+o[c]+p+t[c]/2,n[a]+l+p)}}),r}for(var o;o=Hs(e,n,t);)n=r(o);return n}function qs(){return!0}function Us(e,t){return[].concat(Ks(e,t),Ys(e,t))}function Ys(e,t){return t||(t=qs),e.incoming.filter(t).map(function(e){return e.source})}function Ks(e,t){return t||(t=qs),e.outgoing.filter(t).map(function(e){return e.target})}Ns.getFlowNodePosition=function(e,t){var n=Ls(e),i=Os(e),r=Ws(e,t),o="left",a=30;Ds(e,"bpmn:BoundaryEvent")&&"top"===(o=Is(e,e.host,-25))&&(a*=-1);var s={left:0,right:0,top:-80,bottom:80};return Vs(e,t,{x:n.right+r+t.width/2,y:i.y+s[o]},{y:{margin:a,rowSize:80}})},Ns.getTextAnnotationPosition=function(e,t){var n=Ls(e);return Vs(e,t,{x:n.right+t.width/2,y:n.top-50-t.height/2},{y:{margin:-30,rowSize:20}})},Ns.getDataElementPosition=function(e,t){var n=Ls(e);return Vs(e,t,{x:n.right-10+t.width/2,y:n.bottom+40+t.width/2},{x:{margin:30,rowSize:30}})},Ns.getDefaultPosition=function(e,t){var n=Ls(e),i=Os(e);return{x:n.right+Fs+t.width/2,y:i.y}};var Xs={},Zs=s.some,Qs=d.is;function Js(e,t){return Zs(t,function(t){return Qs(e,t)})}Xs.isAny=Js,Xs.getParent=function(e,t){for("string"==typeof t&&(t=[t]);e=e.parent;)if(Js(e,t))return e;return null};var ec=d.is,tc=Xs.isAny,nc=Ns.getTextAnnotationPosition,ic=Ns.getDataElementPosition,rc=Ns.getFlowNodePosition,oc=Ns.getDefaultPosition;function ac(e,t){function n(t,n){return e.fire(t,n)}this.append=function(e,i){var r=n("autoPlace",{source:e,shape:i});r||(r=function(e,t){if(ec(t,"bpmn:TextAnnotation"))return nc(e,t);if(tc(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return ic(e,t);if(ec(t,"bpmn:FlowNode"))return rc(e,t);return oc(e,t)}(e,i));var o=t.appendShape(e,i,r,e.parent);return n("autoPlace.end",{shape:o}),o}}ac.$inject=["eventBus","modeling"];var sc=ac;function cc(e,t){e.on("autoPlace.end",500,function(e){t.select(e.shape)})}cc.$inject=["eventBus","selection"];var pc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",sc],autoPlaceSelectionBehavior:["type",cc]},lc=s.forEach,uc=s.isFunction,hc=s.isArray,dc=s.isNumber;function mc(e){this._eventBus=e}mc.$inject=["eventBus"];var fc=mc;mc.prototype.on=function(e,t,n,i,r,o){if((uc(t)||dc(t))&&(o=r,r=i,i=n,n=t,t=null),uc(n)&&(o=r,r=i,i=n,n=1e3),"object"==typeof r&&(o=r,r=!1),!uc(i))throw new Error("handlerFn must be a function");hc(e)||(e=[e]);var a=this._eventBus;lc(e,function(e){var s=["commandStack",e,t].filter(function(e){return e}).join(".");a.on(s,n,r?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(i,o):i,o)})};lc(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],function(e){mc.prototype[e]=function(t,n,i,r,o){(uc(t)||dc(t))&&(o=r,r=i,i=n,n=t,t=null),this.on(t,e,n,i,r,o)}});var yc=ci.getBBox,vc=Cs.asTRBL,gc=Cs.asBounds,bc=s.assign,xc=s.flatten,Ec=s.forEach,_c=s.values,wc=s.groupBy;function Sc(e,t,n,i){fc.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(e){var t=e.context,n=t.hints,i=t.shape,o=t.parent||t.newParent;n&&!1===n.root||r._expand([i],o)}),this.postExecuted(["elements.move"],function(e){var t=e.context,n=xc(_c(t.closure.topLevel)),i=t.hints;if(!i||!1!==i.autoResize){var o=wc(n,function(e){return e.parent.id});Ec(o,function(e,t){r._expand(e,t)})}})}Sc.$inject=["eventBus","elementRegistry","modeling","rules"],U(Sc,fc);var Tc=Sc;Sc.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=vc(yc(e)),o=vc(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),gc(bc({},o,a))},Sc.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){this.resize(t,n);var i=t.parent;i&&this._expand([t],i)}}},Sc.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Sc.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Sc.prototype.resize=function(e,t){this._modeling.resizeShape(e,t)};var Cc=d.is;function Ac(e,t,n,i){Tc.call(this,e,t,n,i)}Ac.$inject=["eventBus","elementRegistry","modeling","rules"],U(Ac,Tc);var Rc=Ac;function Pc(e){fc.call(this,e),this.init()}Ac.prototype.resize=function(e,t){Cc(e,"bpmn:Participant")?this._modeling.resizeLane(e,t):this._modeling.resizeShape(e,t)},Pc.$inject=["eventBus"],U(Pc,fc);var Mc=Pc;function kc(e){Mc.call(this,e);var t=this;this.addRule("element.autoResize",function(e){return t.canResize(e.elements,e.target)})}Pc.prototype.addRule=function(e,t,n){var i=this;"string"==typeof e&&(e=[e]),e.forEach(function(e){i.canExecute(e,t,function(e,t,i){return n(e)},!0)})},Pc.prototype.init=function(){},kc.$inject=["eventBus"],U(kc,Mc);var Bc=kc;kc.prototype.canResize=function(e,t){return!1};var Nc=d.is,Dc=s.forEach;function Oc(e,t){Bc.call(this,e),this._modeling=t}U(Oc,Bc),Oc.$inject=["eventBus","modeling"];var Lc=Oc;Oc.prototype.canResize=function(e,t){if(!Nc(t,"bpmn:Participant")&&!Nc(t,"bpmn:Lane")&&!Nc(t,"bpmn:SubProcess"))return!1;var n=!0;return Dc(e,function(e){(Nc(e,"bpmn:Lane")||e.labelTarget)&&(n=!1)}),n};var Ic={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Rc],bpmnAutoResizeProvider:["type",Lc]},jc={},zc=s.filter,Fc=Math.max,$c=Math.min,Gc=20,Wc=ci.getBBox,Hc=Cs.asTRBL,Vc=Cs.asBounds;function qc(e){return"number"==typeof e}function Uc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return qc(r)&&(i=(/top|left/.test(e)?$c:Fc)(i,r)),qc(o)&&(i=(/top|left/.test(e)?Fc:$c)(i,o)),i}function Yc(e,t){return void 0!==e?e:Gc}function Kc(e,t){var n,i,r,o;return"object"==typeof t?(n=Yc(t.left),i=Yc(t.right),r=Yc(t.top),o=Yc(t.bottom)):n=i=r=o=Yc(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function Xc(e){return!e.waypoints&&"label"!==e.type}jc.substractTRBL=function(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}},jc.resizeBounds=function(e,t,n){var i=n.x,r=n.y;switch(t){case"nw":return{x:e.x+i,y:e.y+r,width:e.width-i,height:e.height-r};case"sw":return{x:e.x+i,y:e.y,width:e.width-i,height:e.height+r};case"ne":return{x:e.x,y:e.y+r,width:e.width+i,height:e.height-r};case"se":return{x:e.x,y:e.y,width:e.width+i,height:e.height+r};default:throw new Error("unrecognized direction: "+t)}},jc.resizeTRBL=function(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}},jc.ensureConstraints=function(e,t){if(!t)return e;var n=Hc(e);return Vc({top:Uc("top",n,t),right:Uc("right",n,t),bottom:Uc("bottom",n,t),left:Uc("left",n,t)})},jc.getMinResizeBounds=function(e,t,n,i){var r=Hc(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Hc(i):o,s={top:$c(o.top,a.top),left:$c(o.left,a.left),bottom:Fc(o.bottom,a.bottom),right:Fc(o.right,a.right)};return Vc(s)},jc.computeChildrenBBox=function(e,t){var n;if((n=void 0===e.length?zc(e.children,Xc):e).length)return Kc(Wc(n),t)};var Zc={},Qc=d.is,Jc=Xs.getParent,ep=Cs.asTRBL,tp=jc.substractTRBL,np=jc.resizeTRBL,ip=Math.abs;var rp=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"];function op(e,t){return t=t||[],e.children.filter(function(e){Qc(e,"bpmn:Lane")&&(op(e,t),t.push(e))}),t}function ap(e){return Jc(e,rp)||e}Zc.LANE_INDENTATION=30,Zc.collectLanes=op,Zc.getChildLanes=function(e){return e.children.filter(function(e){return Qc(e,"bpmn:Lane")})},Zc.getLanesRoot=ap,Zc.computeLanesResize=function(e,t){var n=ap(e),i=op(n,Qc(n,"bpmn:Process")?[]:[n]),r=ep(e),o=ep(t),a=function(e,t){return tp(ep(t),ep(e))}(e,t),s=[];return i.forEach(function(t){if(t!==e){var n=0,i=a.right,c=0,p=a.left,l=ep(t);a.top&&(ip(l.bottom-r.top)<10&&(c=o.top-l.bottom),ip(l.top-r.top)<5&&(n=o.top-l.top)),a.bottom&&(ip(l.top-r.bottom)<10&&(n=o.bottom-l.top),ip(l.bottom-r.bottom)<5&&(c=o.bottom-l.bottom)),(n||i||c||p)&&s.push({shape:t,newBounds:np(t,{top:n,right:i,bottom:c,left:p})})}}),s};var sp=s.assign,cp=s.forEach,pp=s.isArray,lp=d.is,up=f.isExpanded,hp=Xs.isAny,dp=Zc.getChildLanes,mp=f.isEventSubProcess,fp=bo.hasPrimaryModifier;function yp(e,t,n,i,r,o,a,s,c,p,l,u){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=p,this._rules=l,this._translate=u,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(e){var t=e.context.shape;if(fp(e)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})}yp.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate"];var vp=yp;function gp(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return cp(o,function(e){e.$type===n&&(r=!0)}),i&&r}yp.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._canvas,c=this._rules,p=this._autoPlace,l=this._translate,u={};if("label"===e.type)return u;var h,d=e.businessObject;function m(e,t){r.start(e,t)}function f(e,t,n,r){function a(t,n){var a=i.createShape(sp({type:e},r));o.start(t,a,n)}return"string"!=typeof n&&(r=n,n=l("Append {type}",{type:e.replace(/^bpmn:/,"")})),{group:"model",className:t,title:n,action:{dragstart:a,click:p?function(t,n){var o=i.createShape(sp({type:e},r));p.append(n,o)}:a}}}function y(e){return function(i,r){n.splitLane(r,e),t.open(r,!0)}}if(hp(d,["bpmn:Lane","bpmn:Participant"])&&up(d)){var v=dp(e);sp(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:l("Add Lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),v.length<2&&(e.height>=120&&sp(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:l("Divide into two Lanes"),action:{click:y(2)}}}),e.height>=180&&sp(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:l("Divide into three Lanes"),action:{click:y(3)}}})),sp(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:l("Add Lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}lp(d,"bpmn:FlowNode")&&(lp(d,"bpmn:EventBasedGateway")?sp(u,{"append.receive-task":f("bpmn:ReceiveTask","bpmn-icon-receive-task"),"append.message-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condtion-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",{eventDefinitionType:"bpmn:SignalEventDefinition"})}):gp(d,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?sp(u,{"append.compensation-activity":f("bpmn:Task","bpmn-icon-task",l("Append compensation activity"),{isForCompensation:!0})}):lp(d,"bpmn:EndEvent")||d.isForCompensation||gp(d,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||mp(d)||sp(u,{"append.end-event":f("bpmn:EndEvent","bpmn-icon-end-event-none"),"append.gateway":f("bpmn:ExclusiveGateway","bpmn-icon-gateway-xor"),"append.append-task":f("bpmn:Task","bpmn-icon-task"),"append.intermediate-event":f("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none")})),a._providers["bpmn-replace"]&&(h=a.create("bpmn-replace",e)),h&&!h.isEmpty()&&sp(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:l("Change type"),action:{click:function(e,n){h.open(sp(function(e){var n=s.getContainer(),i=t.getPad(e).html,r=n.getBoundingClientRect(),o=i.getBoundingClientRect(),a=o.top-r.top;return{x:o.left-r.left,y:a+o.height+5}}(n),{cursor:{x:e.x,y:e.y}}),n)}}}}),hp(d,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&sp(u,{"append.text-annotation":f("bpmn:TextAnnotation","bpmn-icon-text-annotation"),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using "+(d.isForCompensation?"":"Sequence/MessageFlow or ")+"Association"),action:{click:m,dragstart:m}}}),hp(d,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&sp(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using DataInputAssociation"),action:{click:m,dragstart:m}}});var g=c.allowed("elements.delete",{elements:[e]});return pp(g)&&(g=g[0]===e),g&&sp(u,{delete:{group:"edit",className:"bpmn-icon-trash",title:l("Remove"),action:{click:function(t){n.removeElements([e])}}}}),u};var bp={},xp=d.getBusinessObject,Ep=f.isExpanded;bp.isDifferentType=function(e){return function(t){var n=t.target,i=xp(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=i.triggeredByEvent===n.triggeredByEvent,c=void 0===n.isExpanded||n.isExpanded===Ep(i);return!(o&&a&&s&&c)}};var _p={START_EVENT:[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message Start Event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Start Event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional Start Event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal Start Event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],INTERMEDIATE_EVENT:[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message Intermediate Catch Event",actionName:"replace-with-message-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message Intermediate Throw Event",actionName:"replace-with-message-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Intermediate Catch Event",actionName:"replace-with-timer-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Intermediate Throw Event",actionName:"replace-with-escalation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Intermediate Catch Event",actionName:"replace-with-conditional-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Link Intermediate Catch Event",actionName:"replace-with-link-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition"}},{label:"Link Intermediate Throw Event",actionName:"replace-with-link-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition"}},{label:"Compensation Intermediate Throw Event",actionName:"replace-with-compensation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal Intermediate Catch Event",actionName:"replace-with-signal-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal Intermediate Throw Event",actionName:"replace-with-signal-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],END_EVENT:[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message End Event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Escalation End Event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Error End Event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel End Event",actionName:"replace-with-cancel-end",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Compensation End Event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal End Event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Terminate End Event",actionName:"replace-with-terminate-end",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}],GATEWAY:[{label:"Exclusive Gateway",actionName:"replace-with-exclusive-gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},{label:"Parallel Gateway",actionName:"replace-with-parallel-gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},{label:"Inclusive Gateway",actionName:"replace-with-inclusive-gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},{label:"Complex Gateway",actionName:"replace-with-complex-gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},{label:"Event based Gateway",actionName:"replace-with-event-based-gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}}],SUBPROCESS_EXPANDED:[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event Sub Process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Sub Process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],TRANSACTION:[{label:"Sub Process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Event Sub Process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}}],EVENT_SUB_PROCESS:[{label:"Sub Process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}}],TASK:[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"Send Task",actionName:"replace-with-send-task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},{label:"Receive Task",actionName:"replace-with-receive-task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},{label:"User Task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Manual Task",actionName:"replace-with-manual-task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},{label:"Business Rule Task",actionName:"replace-with-rule-task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},{label:"Service Task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{label:"Script Task",actionName:"replace-with-script-task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},{label:"Call Activity",actionName:"replace-with-call-activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},{label:"Sub Process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},{label:"Sub Process (expanded)",actionName:"replace-with-expanded-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}}],BOUNDARY_EVENT:[{label:"Message Boundary Event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Boundary Event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Boundary Event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Boundary Event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Error Boundary Event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel Boundary Event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Signal Boundary Event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Compensation Boundary Event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-message-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},{label:"Timer Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},{label:"Escalation Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},{label:"Conditional Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},{label:"Signal Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}}],EVENT_SUB_PROCESS_START_EVENT:[{label:"Message Start Event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Start Event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional Start Event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal Start Event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Error Start Event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Escalation Start Event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Compensation Start Event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-message-start",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},{label:"Timer Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-start",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},{label:"Conditional Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-start",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},{label:"Signal Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-start",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},{label:"Escalation Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-start",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}}],SEQUENCE_FLOW:[{label:"Sequence Flow",actionName:"replace-with-sequence-flow",className:"bpmn-icon-connection"},{label:"Default Flow",actionName:"replace-with-default-flow",className:"bpmn-icon-default-flow"},{label:"Conditional Flow",actionName:"replace-with-conditional-flow",className:"bpmn-icon-conditional-flow"}],PARTICIPANT:[{label:"Expanded Pool",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:"Collapsed Pool",actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}]},wp=d.is,Sp=f.isEventSubProcess,Tp=d.getBusinessObject,Cp=f.isExpanded,Ap=bp.isDifferentType,Rp=s.forEach,Pp=s.filter;function Mp(e,t,n,i,r,o){this._popupMenu=e,this._modeling=t,this._moddle=n,this._bpmnReplace=i,this._rules=r,this._translate=o,this.register()}Mp.$inject=["popupMenu","modeling","moddle","bpmnReplace","rules","translate"],Mp.prototype.register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Mp.prototype.getEntries=function(e){var t,n=e.businessObject;if(!this._rules.allowed("shape.replace",{element:e}))return[];var i=Ap(e);return wp(n,"bpmn:StartEvent")&&!Sp(n.$parent)?(t=Pp(_p.START_EVENT,i),this._createEntries(e,t)):wp(n,"bpmn:Participant")?(t=Pp(_p.PARTICIPANT,function(e){return Cp(n)!==e.target.isExpanded}),this._createEntries(e,t)):wp(n,"bpmn:StartEvent")&&Sp(n.$parent)?(t=Pp(_p.EVENT_SUB_PROCESS_START_EVENT,function(t){var n=!1!==t.target.isInterrupting,r=Tp(e).isInterrupting===n;return i(t)||!i(t)&&!r}),this._createEntries(e,t)):wp(n,"bpmn:EndEvent")?(t=Pp(_p.END_EVENT,function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!wp(n.$parent,"bpmn:Transaction"))&&i(e)}),this._createEntries(e,t)):wp(n,"bpmn:BoundaryEvent")?(t=Pp(_p.BOUNDARY_EVENT,function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinition&&!wp(n.attachedToRef,"bpmn:Transaction"))return!1;var r=!1!==t.cancelActivity,o=n.cancelActivity==r;return i(e)||!i(e)&&!o}),this._createEntries(e,t)):wp(n,"bpmn:IntermediateCatchEvent")||wp(n,"bpmn:IntermediateThrowEvent")?(t=Pp(_p.INTERMEDIATE_EVENT,i),this._createEntries(e,t)):wp(n,"bpmn:Gateway")?(t=Pp(_p.GATEWAY,i),this._createEntries(e,t)):wp(n,"bpmn:Transaction")?(t=Pp(_p.TRANSACTION,i),this._createEntries(e,t)):Sp(n)&&Cp(n)?(t=Pp(_p.EVENT_SUB_PROCESS,i),this._createEntries(e,t)):wp(n,"bpmn:SubProcess")&&Cp(n)?(t=Pp(_p.SUBPROCESS_EXPANDED,i),this._createEntries(e,t)):wp(n,"bpmn:AdHocSubProcess")&&!Cp(n)?(t=Pp(_p.TASK,function(t){var n=t.target,i="bpmn:SubProcess"===n.type,r=!0===n.isExpanded;return Ap(e,n)&&(!i||r)}),this._createEntries(e,t)):wp(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,_p.SEQUENCE_FLOW):wp(n,"bpmn:FlowNode")?(t=Pp(_p.TASK,i),wp(n,"bpmn:SubProcess")&&!Cp(n)&&(t=Pp(t,function(e){return"Sub Process (collapsed)"!==e.label})),this._createEntries(e,t)):[]},Mp.prototype.getHeaderEntries=function(e){var t=[];return wp(e,"bpmn:Activity")&&!Sp(e)&&(t=t.concat(this._getLoopEntries(e))),!wp(e,"bpmn:SubProcess")||wp(e,"bpmn:Transaction")||Sp(e)||t.push(this._getAdHocEntry(e)),t},Mp.prototype._createEntries=function(e,t){var n=[],i=this;return Rp(t,function(t){var r=i._createMenuEntry(t,e);n.push(r)}),n},Mp.prototype._createSequenceFlowEntries=function(e,t){var n=Tp(e),i=[],r=this._modeling,o=this._moddle,a=this;return Rp(t,function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(wp(n.sourceRef,"bpmn:ExclusiveGateway")||wp(n.sourceRef,"bpmn:InclusiveGateway")||wp(n.sourceRef,"bpmn:ComplexGateway")||wp(n.sourceRef,"bpmn:Activity"))&&i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e.source,{default:n})}));break;case"replace-with-conditional-flow":!n.conditionExpression&&wp(n.sourceRef,"bpmn:Activity")&&i.push(a._createMenuEntry(t,e,function(){var t=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:t})}));break;default:if(wp(n.sourceRef,"bpmn:Activity")&&n.conditionExpression)return i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e,{conditionExpression:void 0})}));if((wp(n.sourceRef,"bpmn:ExclusiveGateway")||wp(n.sourceRef,"bpmn:InclusiveGateway")||wp(n.sourceRef,"bpmn:ComplexGateway")||wp(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n)return i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e.source,{default:void 0})}))}}),i},Mp.prototype._createMenuEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement;return n=n||function(){return r(t,e.target)},{label:i(e.label),className:e.className,id:e.actionName,action:n}},Mp.prototype._getLoopEntries=function(e){var t=this,n=this._translate;function i(n,i){var r;i.active?r=void 0:(r=t._moddle.create(i.options.loopCharacteristics),i.options.isSequential&&(r.isSequential=i.options.isSequential)),t._modeling.updateProperties(e,{loopCharacteristics:r})}var r,o,a,s=Tp(e).loopCharacteristics;return s&&(r=s.isSequential,o=void 0===s.isSequential,a=void 0!==s.isSequential&&!s.isSequential),[{id:"toggle-parallel-mi",className:"bpmn-icon-parallel-mi-marker",title:n("Parallel Multi Instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},{id:"toggle-sequential-mi",className:"bpmn-icon-sequential-mi-marker",title:n("Sequential Multi Instance"),active:r,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},{id:"toggle-loop",className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}]},Mp.prototype._getAdHocEntry=function(e){var t=this._translate,n=Tp(e),i=wp(n,"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{id:"toggle-adhoc",className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:i,action:function(t,n){return r(e,i?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"})}}};var kp=Mp,Bp={},Np=s.forEach;Bp.IGNORED_PROPERTIES=["lanes","incoming","outgoing","artifacts","default","flowElements","dataInputAssociations","dataOutputAssociations"],Bp.getProperties=function(e,t){var n=[];return Np(e.properties,function(e){t&&e.default||n.push(e.ns.name)}),n};var Dp=s.forEach,Op=s.filter,Lp=s.some,Ip=s.sortBy,jp=s.isArray,zp=Bp.IGNORED_PROPERTIES;function Fp(e,t){this._eventBus=e,this._bpmnFactory=t}var $p=Fp;Fp.prototype.clone=function(e,t,n){var i=this,r={newElement:t,hasNestedProperty:!1};return n=Ip(n,function(e){return"bpmn:extensionElements"===e}),Dp(n,function(n){var o,a,s,c=e.get(n),p=t.get(n),l=t.$model.getPropertyDescriptor(t,n);p!==c&&(l&&(l.isId||l.isReference)||(s=c,Lp(["boolean","string","number"],function(e){return typeof s===e})||null===c?t.set(n,c):jp(c)?Dp(c,function(e){var n;r.refTopLevelProperty=e,n=i._deepClone(e,r),r.hasNestedProperty&&(n.$parent=t,p.push(n)),r.hasNestedProperty=!1}):(a=n.replace(/bpmn:/,""),r.refTopLevelProperty=c,o=i._deepClone(c,r),r.hasNestedProperty&&(t[a]=o),r.hasNestedProperty=!1)))}),t},Fp.prototype._deepClone=function(e,t){var n=this,i=this._eventBus,r=this._bpmnFactory.create(e.$type),o=Op(Object.keys(e),function(e){var t=r.$model.getPropertyDescriptor(r,e);return(!t||!t.isId&&!t.isReference)&&(-1===zp.indexOf(e)&&"$type"!==e)});return o.length||(t.hasNestedProperty=!0),Dp(o,function(o){void 0!==e[o]&&(e[o].$type||jp(e[o]))?jp(e[o])?(r[o]=[],Dp(e[o],function(a){var s,c=e.$model.getTypeDescriptor(a.$type);if(c){if(!i.fire("property.clone",{newElement:t.newElement,refTopLevelProperty:t.refTopLevelProperty,propertyDescriptor:c})&&"bpmn:ExtensionElements"===e.$type&&c.meta&&c.meta.allowedIn&&!function(e,t){var n=e.meta.allowedIn;return 1===n.length&&"*"===n[0]||-1!==n.indexOf(t)}(c,t.newElement.$type))return!1;(s=n._deepClone(a,t)).$parent=r,r[o]||(r[o]=[]),t.hasNestedProperty=!0,r[o].push(s)}})):e[o].$type&&(r[o]=n._deepClone(e[o],t),r[o]&&(t.hasNestedProperty=!0,r[o].$parent=r)):(t.hasNestedProperty=!0,r[o]=e[o])}),r};var Gp=s.pick,Wp=s.assign,Hp=s.uniqueBy,Vp=s.findIndex,qp=s.filter,Up=s.has,Yp=d.is,Kp=Xs.isAny,Xp=f.isExpanded,Zp=f.isEventSubProcess,Qp=Bp.getProperties,Jp=Bp.IGNORED_PROPERTIES,el=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function tl(e,t,n,i,r){var o=new $p(r,e);this.replaceElement=function(r,a,s){s=s||{};var c=a.type,p=r.businessObject;if(il(p)&&"bpmn:SubProcess"===c&&function(e,t){var n=e&&Up(e,"collapsed")?e.collapsed:!Xp(e);return n!==(t&&(Up(t,"collapsed")||Up(t,"isExpanded"))?Up(t,"collapsed")?t.collapsed:!t.isExpanded:n)&&(e.collapsed=n,!0)}(r,a))return i.toggleCollapse(r),r;var l=e.create(c),u={type:c,businessObject:l},h=Qp(p.$descriptor),d=Qp(l.$descriptor,!0),m=Hp(function(e){return e},qp(h,function(e){return-1!==Vp(d,e)}));return Wp(l,Gp(a,el)),m=qp(m,function(e){var t=e.replace(/bpmn:/,"");return void 0===l[e]&&("loopCharacteristics"===t?!Zp(l):("processRef"!==t||!1!==a.isExpanded)&&"triggeredByEvent"!==t&&"eventDefinitions"!==t&&-1===Jp.indexOf(t))}),l=o.clone(p,l,m),a.eventDefinitionType&&(u.eventDefinitionType=a.eventDefinitionType),Yp(p,"bpmn:Activity")&&(il(p)?u.isExpanded=Xp(p):a&&Up(a,"isExpanded")&&(u.isExpanded=a.isExpanded),Xp(p)&&!Yp(p,"bpmn:Task")&&u.isExpanded&&(u.width=r.width,u.height=r.height)),il(p)&&!il(l)&&(s.moveChildren=!1),Yp(p,"bpmn:Participant")&&(!0===a.isExpanded?l.processRef=e.create("bpmn:Process"):s.moveChildren=!1,u.width=r.width,u.height=r.height),l.name=p.name,Kp(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Kp(l,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(l.default=p.default),("fill"in p.di||"stroke"in p.di)&&Wp(u,{colors:Gp(p.di,["fill","stroke"])}),u=t.replaceElement(r,u,s),!1!==s.select&&n.select(u),u}}tl.$inject=["bpmnFactory","replace","selection","modeling","eventBus"];var nl=tl;function il(e){return Yp(e,"bpmn:SubProcess")}function rl(e){this._modeling=e}var ol=rl;rl.$inject=["modeling"],rl.prototype.replaceElement=function(e,t,n){var i=this._modeling,r=null;return e.waypoints||(t.x=Math.ceil(e.x+(t.width||e.width)/2),t.y=Math.ceil(e.y+(t.height||e.height)/2),r=i.replaceShape(e,t,n)),r};var al={__depends__:[{__init__:["replace"],replace:["type",ol]},ia],bpmnReplace:["type",nl]},sl=s.forEach,cl=s.assign,pl=s.find,ll=s.matchPattern,ul=Y.delegate,hl=Y.domify,dl=Y.classes,ml=Y.attr,fl=Y.remove;function yl(e,t){this._eventBus=e,this._canvas=t,this._providers={}}yl.$inject=["eventBus","canvas"],yl.prototype.registerProvider=function(e,t){this._providers[e]=t},yl.prototype.create=function(e,t){var n=this._providers[e];if(!n)throw new Error("Provider is not registered: "+e);if(!t)throw new Error("Element is missing");var i=this._current={provider:n,className:e,element:t};return n.getHeaderEntries&&(i.headerEntries=n.getHeaderEntries(t)),i.entries=n.getEntries(t),this},yl.prototype.isEmpty=function(){var e=this._current;return 0===e.entries.length&&e.headerEntries&&0===e.headerEntries.length},yl.prototype.open=function(e){if(!e)throw new Error("the position argument is missing");this.isOpen()&&this.close();var t=this._current,n=this._canvas.getContainer();t.position=e,t.container=this._createContainer();var i=t.headerEntries||[],r=t.entries||[];return i.length&&t.container.appendChild(this._createEntries(t.headerEntries,"djs-popup-header")),r.length&&t.container.appendChild(this._createEntries(t.entries,"djs-popup-body")),this._attachContainer(t.container,n,e.cursor),this},yl.prototype.close=function(){this.isOpen()&&(this._unbindHandlers(),fl(this._current.container),this._current.container=null)},yl.prototype.isOpen=function(){return!!this._current.container},yl.prototype.trigger=function(e){e.preventDefault();var t=e.delegateTarget||e.target,n=ml(t,"data-id"),i=this._getEntry(n);if(i.action)return i.action.call(null,e,i)},yl.prototype._getEntry=function(e){var t=ll({id:e}),n=pl(this._current.entries,t)||pl(this._current.headerEntries,t);if(!n)throw new Error("entry not found");return n},yl.prototype._createContainer=function(){var e=hl('<div class="djs-popup">'),t=this._current.position,n=this._current.className;return cl(e.style,{position:"absolute",left:t.x+"px",top:t.y+"px",visibility:"hidden"}),dl(e).add(n),e},yl.prototype._attachContainer=function(e,t,n){var i=this;ul.bind(e,".entry","click",function(e){i.trigger(e)});var r=this._canvas.zoom();e.style.transformOrigin="top left",e.style.transform="scale("+r+")",t.appendChild(e),n&&this._assureIsInbounds(e,n),this._bindHandlers()},yl.prototype._assureIsInbounds=function(e,t){var n,i,r=this._canvas._container.getBoundingClientRect(),o=e.offsetLeft,a=e.offsetTop,s=e.scrollWidth,c=e.scrollHeight,p={},l=t.x-r.left,u=t.y-r.top;o+s>r.width&&(p.x=!0),a+c>r.height&&(p.y=!0),p.x&&p.y?(n=l-s+"px",i=u-c+"px"):p.x?(n=l-s+"px",i=u+"px"):p.y&&u<c?(n=l+"px",i="10px"):p.y&&(n=l+"px",i=u-c+"px"),cl(e.style,{left:n,top:i},{visibility:"visible","z-index":1e3})},yl.prototype._createEntries=function(e,t){var n=hl("<div>"),i=this;return dl(n).add(t),sl(e,function(e){var t=i._createEntry(e,n);n.appendChild(t)}),n},yl.prototype._createEntry=function(e){if(!e.id)throw new Error("every entry must have the id property set");var t=hl("<div>"),n=dl(t);if(n.add("entry"),e.className&&n.add(e.className),ml(t,"data-id",e.id),e.label){var i=hl("<span>");i.textContent=e.label,t.appendChild(i)}return e.imageUrl&&t.appendChild(hl('<img src="'+e.imageUrl+'" />')),!0===e.active&&n.add("active"),!0===e.disabled&&n.add("disabled"),e.title&&(t.title=e.title),t},yl.prototype._bindHandlers=function(){var e=this._eventBus,t=this;function n(){t.close()}e.once("contextPad.close",n),e.once("canvas.viewbox.changing",n),e.once("commandStack.changed",n)},yl.prototype._unbindHandlers=function(){var e=this._eventBus,t=this;function n(){t.close()}e.off("contextPad.close",n),e.off("canvas.viewbox.changed",n),e.off("commandStack.changed",n)};var vl={__depends__:[{__init__:["popupMenu"],popupMenu:["type",yl]},al],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",kp]},gl=s.assign,bl=s.bind,xl=s.pick,El=Y.domify,_l=Y.query,wl=Y.event,Sl=Y.remove,Tl=Math.min,Cl=Math.max;function Al(e){e.preventDefault()}function Rl(e){e.stopPropagation()}function Pl(e){this.container=e.container,this.parent=El('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=_l("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=bl(this.autoResize,this),this.handlePaste=bl(this.handlePaste,this)}var Ml=Pl;Pl.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,a=this.container;i=this.options=i||{},t=this.style=t||{};var s=xl(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);gl(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",wordWrap:"normal",textAlign:"center",outline:"none"},s);var c=xl(t,["fontSize","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return gl(o.style,{boxSizing:"border-box",width:"100%",outline:"none"},c),i.centerVertically&&gl(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},c),o.innerText=n,wl.bind(o,"keydown",this.keyHandler),wl.bind(o,"mousedown",Rl),wl.bind(o,"paste",this.handlePaste),i.autoResize&&wl.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),a.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},Pl.prototype.handlePaste=function(e){var t,n,i=this,r=this.options,o=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),!document.execCommand("insertHTML",!1,t)){var a,s,c=this.getSelection(),p=c.startContainer,l=c.endContainer,u=c.startOffset,h=c.endOffset,d=c.commonAncestorContainer,m=(n=d.childNodes,[].slice.call(n));if(d.nodeType===Node.TEXT_NODE){var f=p.textContent;p.textContent=f.substring(0,u)+t+f.substring(h),a=p,s=u+t.length}else if(p===this.content&&l===this.content){var y=document.createTextNode(t);this.content.insertBefore(y,m[u]),a=y,s=y.textContent.length}else{var v=m.indexOf(p),g=m.indexOf(l);m.forEach(function(e,n){n===v?e.textContent=p.textContent.substring(0,u)+t+l.textContent.substring(h):n>v&&n<=g&&Sl(e)}),a=p,s=u+t.length}a&&void 0!==s&&setTimeout(function(){i.setSelection(a,s)})}if(r.autoResize){var b=this.autoResize(o);b&&this.resizeHandler(b)}},Pl.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},Pl.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){var s,c,p,l;n=this.resizeHandle=El('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){Al(n),Rl(n);var u=Tl(Cl(p+n.clientX-s,i),o),h=Tl(Cl(l+n.clientY-c,r),a);t.style.width=u+"px",t.style.height=h+"px",e.resizeHandler({width:p,height:l,dx:n.clientX-s,dy:n.clientY-c})},h=function(e){Al(e),Rl(e),wl.unbind(document,"mousemove",u,!1),wl.unbind(document,"mouseup",h,!1)};wl.bind(n,"mousedown",function(e){Al(e),Rl(e),s=e.clientX,c=e.clientY;var n=t.getBoundingClientRect();p=n.width,l=n.height,wl.bind(document,"mousemove",u),wl.bind(document,"mouseup",h)})}gl(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Pl.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),wl.unbind(t,"keydown",this.keyHandler),wl.unbind(t,"mousedown",Rl),wl.unbind(t,"input",this.autoResize),wl.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),Sl(n)),Sl(e)},Pl.prototype.getValue=function(){return this.content.innerText},Pl.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Pl.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};var kl=s.bind,Bl=s.find;function Nl(e,t){this._eventBus=e,this._providers=[],this._textbox=new Ml({container:t.getContainer(),keyHandler:kl(this._handleKey,this),resizeHandler:kl(this._handleResize,this)})}Nl.$inject=["eventBus","canvas"],Nl.prototype.registerProvider=function(e){this._providers.push(e)},Nl.prototype.isActive=function(){return!!this._active},Nl.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Nl.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Nl.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},Nl.prototype.complete=function(){var e=this._active;if(e){var t=this.getValue(),n=this.$textbox.getBoundingClientRect();(t!==e.context.text||this.resizable)&&e.provider.update(e.element,t,e.context.text,{x:n.top,y:n.left,width:n.width,height:n.height}),this._fire("complete"),this.close()}},Nl.prototype.getValue=function(){return this._textbox.getValue()},Nl.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;return 27===t?(e.preventDefault(),this.cancel()):13!==t||e.shiftKey?void 0:(e.preventDefault(),this.complete())},Nl.prototype._handleResize=function(e){this._fire("resize",e)},Nl.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=Bl(this._providers,function(n){return(t=n.activate(e))?n:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};var Dl={__depends__:[Oo],__init__:["directEditing"],directEditing:["type",Nl]},Ol=Cs.getElementLineIntersection,Ll=Cs.getMid,Il="connect-ok",jl="connect-not-ok",zl=n.append,Fl=n.attr,$l=n.create,Gl=n.remove;function Wl(e,t,n,i,r,o){function a(e,t){return i.allowed("connection.create",{source:e,target:t})}e.on("connect.move",function(e){var t,n=e.context,i=n.source,r=n.target,a=n.visual;t=function(e,t,n,i){var r=o.getShapePath(n),a=i&&o.getShapePath(i),s=o.getConnectionPath({waypoints:[e,t]});return[e=Ol(r,s,!0)||e,t=i&&Ol(a,s,!1)||t]}(n.sourcePosition,{x:e.x,y:e.y},i,r),Fl(a,{points:[t[0].x,t[0].y,t[1].x,t[1].y]})}),e.on("connect.hover",function(e){var t,n=e.context,i=n.source,o=e.hover;null!==(t=n.canExecute=a(i,o))&&(n.target=o,r.addMarker(o,t?Il:jl))}),e.on(["connect.out","connect.cleanup"],function(e){var t=e.context;t.target&&r.removeMarker(t.target,t.canExecute?Il:jl),t.target=null,t.canExecute=!1}),e.on("connect.cleanup",function(e){var t=e.context;t.visual&&Gl(t.visual)}),e.on("connect.start",function(e){var t,n=e.context;t=$l("polyline"),Fl(t,{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),zl(r.getDefaultLayer(),t),n.visual=t}),e.on("connect.end",function(e){var t=e.context,i=t.source,r=t.sourcePosition,o=t.target,s={x:e.x,y:e.y},c=t.canExecute||a(i,o);if(!c)return!1;var p=null,l={connectionStart:r,connectionEnd:s};"object"==typeof c&&(p=c),n.connect(i,o,p,l)}),this.start=function(e,n,i,r){"object"!=typeof i&&(r=i,i=Ll(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{source:n,sourcePosition:i}}})}}Wl.$inject=["eventBus","dragging","modeling","rules","canvas","graphicsFactory"];var Hl=Wl,Vl=Math.round,ql=s.assign,Ul=Y.event,Yl="djs-drag-active";function Kl(e){e.preventDefault()}function Xl(e){fo.stopPropagation(e)}function Zl(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ql(e,t,n){var i,r={threshold:5,trapClick:!0};function o(e){var n=t.viewbox(),i=t._container.getBoundingClientRect();return{x:n.x+Vl((e.x-i.left)/n.scale),y:n.y+Vl((e.y-i.top)/n.scale)}}function a(t,n){n=n||i;var r=e.createEvent(ql({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,r)&&e.fire(n.prefix+"."+t,r)}function s(e,r){var s,c=i.payload,p=i.displacement,l=i.globalStart,u=fo.toPoint(e),h=Zl(u,l),d=i.localStart,f=o(u),y=Zl(f,d);if(!i.active&&(r||(s=h,Math.sqrt(Math.pow(s.x,2)+Math.pow(s.y,2))>i.threshold))){if(ql(c,{x:d.x+p.x,y:d.y+p.y,dx:0,dy:0},{originalEvent:e}),!1===a("start"))return m();i.active=!0,i.keepSelection||(c.previousSelection=n.get(),n.select(null)),i.cursor&&ba.set(i.cursor),t.addMarker(t.getRootElement(),Yl)}Xl(e),i.active&&(ql(c,{x:f.x+p.x,y:f.y+p.y,dx:y.x,dy:y.y},{originalEvent:e}),a("move"))}function c(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,Xl(e)),t=a("end")),!1===t&&a("rejected"),a("ended",f(!0!==t))}function p(e){27===e.which&&(e.preventDefault(),m())}function l(t){var n;i.active&&(n=va.install(e),setTimeout(n,400)),c(t)}function u(e){s(e)}function h(e){var t=i.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function d(e){a("out");var t=i.payload;t.hoverGfx=null,t.hover=null}function m(e){var t;if(i){var n=i.active;n&&a("cancel"),t=f(e),n&&a("canceled",t)}}function f(r){var o,f;a("cleanup"),ba.unset(),f=i.trapClick?l:c,Ul.unbind(document,"mousemove",s),Ul.unbind(document,"dragstart",Kl),Ul.unbind(document,"selectstart",Kl),Ul.unbind(document,"mousedown",f,!0),Ul.unbind(document,"mouseup",f,!0),Ul.unbind(document,"keyup",p),Ul.unbind(document,"touchstart",u,!0),Ul.unbind(document,"touchcancel",m,!0),Ul.unbind(document,"touchmove",s,!0),Ul.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",d),t.removeMarker(t.getRootElement(),Yl);var y=i.payload.previousSelection;return!1!==r&&y&&!n.get().length&&n.select(y),o=i,i=null,o}e.on("diagram.destroy",m),this.init=function(t,n,f,y){i&&m(!1),"string"==typeof n&&(y=f,f=n,n=null);var v,g,b,x,E,_=(y=ql({},r,y||{})).data||{};x=y.trapClick?l:c,t?(v=fo.getOriginal(t)||t,g=fo.toPoint(t),Xl(t),"dragstart"===v.type&&Kl(v)):(v=null,g={x:0,y:0}),b=o(g),n||(n=b),E=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(v),i=ql({prefix:f,data:_,payload:{},globalStart:g,displacement:Zl(n,b),localStart:b,isTouch:E},y),y.manual||(E?(Ul.bind(document,"touchstart",u,!0),Ul.bind(document,"touchcancel",m,!0),Ul.bind(document,"touchmove",s,!0),Ul.bind(document,"touchend",c,!0)):(Ul.bind(document,"mousemove",s),Ul.bind(document,"dragstart",Kl),Ul.bind(document,"selectstart",Kl),Ul.bind(document,"mousedown",x,!0),Ul.bind(document,"mouseup",x,!0)),Ul.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",d)),a("init"),y.autoActivate&&s(t,!0)},this.move=s,this.hover=h,this.out=d,this.end=c,this.cancel=m,this.context=function(){return i},this.setOptions=function(e){ql(r,e)}}Ql.$inject=["eventBus","canvas","selection"];var Jl=Ql,eu=Y.closest;function tu(e,t,n){var i=this;e.on("drag.start",function(t){e.once("drag.move",function(){e.once("drag.move",function(e){i.ensureHover(e)})})}),this.ensureHover=function(e){if(!e.hover){var i,r,o,a=e.originalEvent;a instanceof MouseEvent&&(i=fo.toPoint(a),(o=function(e){return eu(e,"svg, .djs-element",!0)}(document.elementFromPoint(i.x,i.y)))&&(r=n.get(o),t.hover({element:r,gfx:o})))}}}tu.$inject=["eventBus","dragging","elementRegistry"];var nu={__init__:["hoverFix"],__depends__:[ia],dragging:["type",Jl],hoverFix:["type",tu]};function iu(e){this._commandStack=e.get("commandStack",!1)}iu.$inject=["injector"];var ru=iu;iu.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var ou={__init__:["rules"],rules:["type",ru]},au={__depends__:[ia,ou,nu],connect:["type",Hl]},su=s.isFunction,cu=s.isArray,pu=s.forEach,lu=Y.delegate,uu=Y.event,hu=Y.attr,du=Y.query,mu=Y.classes,fu=Y.domify;function yu(e,t){this._providers=[],this._eventBus=e,this._overlays=t,this._current=null,this._init()}yu.$inject=["eventBus","overlays"];var vu=yu;yu.prototype._init=function(){var e=this._eventBus,t=this;e.on("selection.changed",function(e){var n=e.newSelection;1===n.length?t.open(n[0]):t.close()}),e.on("elements.delete",function(e){var n=e.elements;pu(n,function(e){t.isOpen(e)&&t.close()})}),e.on("element.changed",function(e){var n=e.element,i=t._current;i&&i.element===n&&t.open(n,!0)})},yu.prototype.registerProvider=function(e){this._providers.push(e)},yu.prototype.getEntries=function(e){var t={};return pu(this._providers,function(n){var i=n.getContextPadEntries(e);pu(i,function(e,n){t[n]=e})}),t},yu.prototype.trigger=function(e,t,n){var i,r,o=this._current.element,a=this._current.entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();if(i=a[hu(s,"data-action")].action,r=t.originalEvent||t,su(i)){if("click"===e)return i(r,o,n)}else if(i[e])return i[e](r,o,n);t.preventDefault()},yu.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},yu.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this.getPad(e),i=n.html;pu(t,function(e,t){var n,r,o,a,s=e.group||"default",c=fu(e.html||'<div class="entry" draggable="true"></div>');hu(c,"data-action",t),(n=du("[data-group="+s+"]",i))||(n=fu('<div class="group" data-group="'+s+'"></div>'),i.appendChild(n)),n.appendChild(c),e.className&&(r=c,o=e.className,a=mu(r),(cu(o)?o:o.split(/\s+/g)).forEach(function(e){a.add(e)})),e.title&&hu(c,"title",e.title),e.imageUrl&&c.appendChild(fu('<img src="'+e.imageUrl+'">'))}),mu(i).add("open"),this._current={element:e,pad:n,entries:t},this._eventBus.fire("contextPad.open",{current:this._current})},yu.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=fu('<div class="djs-context-pad"></div>');lu.bind(i,".entry","click",function(e){t.trigger("click",e)}),lu.bind(i,".entry","dragstart",function(e){t.trigger("dragstart",e)}),uu.bind(i,"mousedown",function(e){e.stopPropagation()}),this._overlayId=n.add(e,"context-pad",{position:{right:-9,top:-6},html:i});var r=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{element:e,pad:r}),r},yu.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},yu.prototype.isOpen=function(e){return!(!this._current||e&&this._current.element!==e)};var gu={__depends__:[Oo,mo],contextPad:["type",vu]},bu=750,xu="drop-ok",Eu="drop-not-ok",_u="attach-ok",wu="new-parent",Su=n.append,Tu=n.attr,Cu=n.classes,Au=n.create,Ru=n.remove,Pu=w.translate;function Mu(e,t,n,i,r,o,a){function s(e,t){[_u,xu,Eu,wu].forEach(function(n){n===t?r.addMarker(e,n):r.removeMarker(e,n)})}e.on("create.move",function(e){var t,i=e.context,r=e.hover,o=i.shape,a=i.source,c={x:e.x,y:e.y};t=i.canExecute=r&&function(e,t,i,r){if(!t)return!1;var o,a,s,c={source:i,shape:e,target:t,position:r};return(a=n.allowed("shape.attach",c))||(o=n.allowed("shape.create",c)),(o||a)&&(s=i&&n.allowed("connection.create",{source:i,target:e,hints:{targetParent:t,targetAttach:a}})),!(!o&&!a)&&{attach:a,connect:s}}(o,r,a,c),r&&null!==t&&(i.target=r,t&&t.attach?s(r,_u):s(r,t?wu:Eu))}),e.on("create.move",bu,function(e){var t=e.context,n=t.shape,i=t.visual;i||(i=t.visual=function(e){var t,n,i;t=Au("g"),Tu(t,o.cls("djs-drag-group",["no-events"])),Su(r.getDefaultLayer(),t),n=Au("g"),Cu(n).add("djs-dragger"),Su(t,n),Pu(n,e.width/-2,e.height/-2);var s=Au("g");return Cu(s).add("djs-visual"),Su(n,s),i=s,a.drawShape(i,e),t}(n)),Pu(i,e.x,e.y)}),e.on(["create.end","create.out","create.cleanup"],function(e){var t=e.context.target;t&&s(t,null)}),e.on("create.end",function(e){var t=e.context,n=t.source,r=t.shape,o=t.target,a=t.canExecute,s=a&&a.attach,c=a&&a.connect,p={x:e.x,y:e.y};if(!a)return!1;r=c?i.appendShape(n,r,p,o,{attach:s,connection:!0===c?{}:c}):i.createShape(r,p,o,{attach:s}),t.shape=r}),e.on("create.cleanup",function(e){var t=e.context;t.visual&&Ru(t.visual)}),this.start=function(e,n,i){t.init(e,"create",{cursor:"grabbing",autoActivate:!0,data:{shape:n,context:{shape:n,source:i}}})}}Mu.$inject=["eventBus","dragging","rules","modeling","canvas","styles","graphicsFactory"];var ku={__depends__:[nu,ia,ou],create:["type",Mu]},Bu={__depends__:[Dl,gu,ia,au,ku,vl],__init__:["contextPadProvider"],contextPadProvider:["type",vp]},Nu=d.getBusinessObject,Du=d.is,Ou=Bp.getProperties,Lu=Bp.IGNORED_PROPERTIES,Iu=s.filter,ju=s.forEach;function zu(e,t,n){ju(n,function(n){void 0!==t[n]&&(e[n]=t[n])})}function Fu(e,t,n,i,r,o){var a=new $p(t,e);n.registerDescriptor(function(e,t){var n=t.oldBusinessObject=Nu(e),i={};return t.type=e.type,zu(t,n.di,["isExpanded"]),zu(i,n.di,["fill","stroke"]),t.colors=i,"label"===e.type?t:(zu(t,n,["processRef","triggeredByEvent"]),n.default&&(t.default=n.default.id),t)}),t.on("element.paste",function(t){var n,i,s,c,p=t.descriptor,l=t.createdElements,u=p.parent,h=r.getRootElement(),d=p.oldBusinessObject;n=e.create(d.$type);var m=Ou(d.$descriptor);m=Iu(m,function(e){return-1===Lu.indexOf(e.replace(/bpmn:/,""))}),p.businessObject=a.clone(d,n,m),"label"!==p.type&&(Du(u,"bpmn:Process")&&(p.parent=Du(h,"bpmn:Collaboration")?h:u),"bpmn:DataOutputAssociation"!==p.type&&"bpmn:DataInputAssociation"!==p.type&&"bpmn:MessageFlow"!==p.type||(p.parent=h),Du(u,"bpmn:Lane")&&(p.parent=u.parent),p.waypoints&&(i=l[p.source],s=l[p.target],i&&s&&(i=i.element,s=s.element),(c=o.canConnect(i,s))&&(p.type=c.type)),delete n.id,e._ensureId(n),"bpmn:Participant"===p.type&&p.processRef&&(p.processRef=n.processRef=e.create("bpmn:Process")),zu(n,p,["isExpanded","triggeredByEvent"]),function(e,t){ju(t,function(t){e[t]&&delete e[t]})}(p,["triggeredByEvent"]))})}Fu.$inject=["bpmnFactory","eventBus","copyPaste","clipboard","canvas","bpmnRules"];var $u=Fu;function Gu(){}var Wu=Gu;Gu.prototype.get=function(){return this._data},Gu.prototype.set=function(e){this._data=e},Gu.prototype.clear=function(){var e=this._data;return delete this._data,e},Gu.prototype.isEmpty=function(){return!this._data};var Hu={clipboard:["type",Wu]},Vu={},qu=s.forEach;Vu.getTopLevel=function(e){var t={},n=[],i=[],r=[];return qu(e,function(e){var i=e.parent;t[i.id]||(t[i.id]=[]),-1===n.indexOf(i.id)&&n.push(i.id),t[i.id].push(e)}),qu(n,function(e){qu(t[e],function(e){t[e.id]&&r.push(e.id)})}),qu(n,function(e){-1===r.indexOf(e)&&(i=i.concat(t[e]))}),i};var Uu={};Uu.center=function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}},Uu.delta=function(e,t){return{x:e.x-t.x,y:e.y-t.y}};var Yu=s.isArray,Ku=s.forEach,Xu=s.map,Zu=s.matchPattern,Qu=s.find,Ju=s.findIndex,eh=s.sortBy,th=s.reduce,nh=ci.getBBox;function ih(e,t,n,i,r,o){this._eventBus=e,this._modeling=t,this._elementFactory=n,this._rules=i,this._canvas=o,this._clipboard=r,this._descriptors=[],this.registerDescriptor(function(e,t){return t.priority=1,t.id=e.id,e.parent&&(t.parent=e.parent.id),e.labelTarget&&(t.priority=4,t.labelTarget=e.labelTarget.id),e.host&&(t.priority=2,t.host=e.host.id),"number"==typeof e.x&&(t.x=e.x,t.y=e.y),e.width&&(t.width=e.width,t.height=e.height),e.waypoints&&(t.priority=3,t.waypoints=[],Ku(e.waypoints,function(e){var n={x:e.x,y:e.y};e.original&&(n.original={x:e.original.x,y:e.original.y}),t.waypoints.push(n)})),e.source&&e.target&&(t.source=e.source.id,t.target=e.target.id),t})}ih.$inject=["eventBus","modeling","elementFactory","rules","clipboard","canvas"];var rh=ih;ih.prototype.copy=function(e){var t,n,i=this._clipboard;if(Yu(e)||(e=e?[e]:[]),e.length)return t=this.createTree(e),n=this._bbox=Uu.center(nh(t.allShapes)),delete t.allShapes,Ku(t,function(e){Ku(e,function(t){var i,r;t.labelTarget?(r=Qu(e,Zu({id:t.labelTarget})),i=r.waypoints?Uu.delta(t,r.waypoints[0]):Uu.delta(t,r)):3===t.priority?(i=[],Ku(t.waypoints,function(e){var t=Uu.delta(e,n);i.push(t)})):i=Uu.delta(t,n),t.delta=i})}),this._eventBus.fire("elements.copy",{context:{tree:t}}),0===Object.keys(t).length?i.clear():i.set(t),this._eventBus.fire("elements.copied",{context:{tree:t}}),t},ih.prototype.paste=function(e){var t,n=this._clipboard,i=this._modeling,r=this._eventBus,o=this._rules,a=n.get(),s=e.element,c=e.point;n.isEmpty()||(t=th(a,function(e,t,n){var i=parseInt(n,10);return isNaN(i)?e:(e[i]=t,e)},{}),o.allowed("elements.paste",{tree:t,target:s})?i.pasteElements(t,s,c):r.fire("elements.paste.rejected",{context:{tree:t,position:c,target:s}}))},ih.prototype._computeDelta=function(e,t){var n=this._bbox,i={};return t.labelTarget?Uu.delta(t,t.labelTarget):(3===t.priority?(i=[],Ku(t.waypoints,function(e){var t=Uu.delta(e,n);i.push(t)})):i=Uu.delta(t,n),i)},ih.prototype.hasRelations=function(e,t){var n,i;return!(t.waypoints&&(n=Qu(e,Zu({id:t.source.id})),i=Qu(e,Zu({id:t.target.id})),!n||!i))&&!(t.labelTarget&&!Qu(e,Zu({id:t.labelTarget.id})))},ih.prototype.registerDescriptor=function(e){if("function"!=typeof e)throw new Error("the descriptor must be a function");if(-1!==this._descriptors.indexOf(e))throw new Error("this descriptor is already registered");this._descriptors.push(e)},ih.prototype._executeDescriptors=function(e){return e.descriptor||(e.descriptor={}),Ku(this._descriptors,function(t){e.descriptor=t(e.element,e.descriptor)}),e},ih.prototype.createTree=function(e){var t,n=this._rules,i=this,r={},o=[],a=Vu.getTopLevel(e);function s(e){var t=Ju(o,Zu({element:e.element}));if(-1===t)return o.push(e);o[t].depth<e.depth&&(o.splice(t,1),o.push(e))}return r.allShapes=[],ci.eachElement(a,function(e,t,n){var i,r=e.children;if(!e.labelTarget)return e.label&&s({element:e.label,depth:n}),i=[e.attachers,e.incoming,e.outgoing],Ku(i,function(e){e&&e.length&&Ku(e,function(e){e.label&&s({element:e.label,depth:n}),s({element:e,depth:n})})}),s({element:e,depth:n}),r||void 0}),o=Xu(o,function(e){return i._executeDescriptors(e)}),o=eh(o,function(e){return e.descriptor.priority}),t=Xu(o,function(e){return e.element}),Ku(o,function(e){var o,a,s=e.depth;i.hasRelations(r.allShapes,e.element)&&(o=t,a=e.element,n.allowed("element.copy",{collection:o,element:a})&&(r.allShapes.push(e.element),r[s]||(r[s]=[]),r[s].push(e.descriptor)))}),r};var oh=s.bind;function ah(e,t){this._eventBus=e,this._canvas=t,this._init()}ah.$inject=["eventBus","canvas"];var sh=ah;ah.prototype.getHoverContext=function(){var e=this._canvas.viewbox();return{element:this._hoverElement,point:{x:e.x+Math.round(this._mouseX/e.scale),y:e.y+Math.round(this._mouseY/e.scale)}}},ah.prototype._init=function(){var e=this._eventBus,t=this._canvas.getContainer();this._setMousePosition=oh(this._setMousePosition,this),t.addEventListener("mousemove",this._setMousePosition),e.on("diagram.destroy",function(){t.removeEventListener("mousemove",this._setMousePosition)},this),e.on("element.hover",this._setHoverElement,this)},ah.prototype._setHoverElement=function(e){this._hoverElement=e.element},ah.prototype._setMousePosition=function(e){this._mouseX=e.layerX,this._mouseY=e.layerY};var ch={__init__:["mouseTracking"],mouseTracking:["type",sh]},ph={__depends__:[Hu,ou,ch],__init__:["copyPaste"],copyPaste:["type",rh]},lh={__depends__:[ph],__init__:["bpmnCopyPaste"],bpmnCopyPaste:["type",$u]},uh=s.filter,hh=Xs.isAny;function dh(e){e.registerFilter(function(e){return uh(e,function(e){var t=hh(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:Participant","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})})}dh.$inject=["distributeElements"];var mh=dh,fh=s.sortBy,yh=s.forEach,vh=s.filter,gh={horizontal:["x","width"],vertical:["y","height"]};function bh(e){this._modeling=e,this._filters=[],this.registerFilter(function(e,t,n){var i,r=0,o=0;return yh(e,function(e){e.waypoints||e.labelTarget||(r+=e[n],o+=1)}),i=Math.round(r/o),vh(e,function(e){return e[n]<i+50})})}var xh=bh;bh.$inject=["modeling"],bh.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},bh.prototype.trigger=function(e,t){var n,i,r=this._modeling;if(!(e.length<3||(this._setOrientation(t),i=this._filterElements(e),(n=this._createGroups(i)).length<=2)))return r.distributeElements(n,this._axis,this._dimension),n},bh.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(yh(t,function(e){r=e(r,n,i)}),r):e},bh.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=fh(e,i);return yh(o,function(e,o){var a,s=n._findRange(e,i,r),c=t[t.length-1];c&&n._hasIntersection(c.range,s)?t[t.length-1].elements.push(e):(a={range:s,elements:[e]},t.push(a))}),t},bh.prototype._setOrientation=function(e){var t=gh[e];this._axis=t[0],this._dimension=t[1]},bh.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},bh.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Eh={__depends__:[{__init__:["distributeElements"],distributeElements:["type",xh]}],__init__:["bpmnDistributeElements"],bpmnDistributeElements:["type",mh]},_h=s.forEach,wh=s.isArray;function Sh(e,t,n,i,r,o,a,s,c){this._actions={undo:function(){t.undo()},redo:function(){t.redo()},copy:function(){var e=i.get();o.copy(e)},paste:function(){var e=c.getHoverContext();o.paste(e)},stepZoom:function(e){r.stepZoom(e.value)},zoom:function(e){a.zoom(e.value)},removeSelection:function(){var e=i.get();if(e.length){var t,r=s.allowed("elements.delete",{elements:e});if(!1===r)return;(t=wh(r)?r:e).length&&n.removeElements(t.slice())}},moveCanvas:function(e){var t=0,n=0,i=e.invertY,r=e.speed/Math.min(Math.sqrt(a.viewbox().scale),1);switch(e.direction){case"left":t=r;break;case"up":n=r;break;case"right":t=-r;break;case"down":n=-r}n&&i&&(n=-n),a.scroll({dx:t,dy:n})}}}Sh.$inject=["eventBus","commandStack","modeling","selection","zoomScroll","copyPaste","canvas","rules","mouseTracking"];var Th=Sh;function Ch(e,t){return new Error(e+" "+t)}Sh.prototype.trigger=function(e,t){if(!this._actions[e])throw Ch(e,"is not a registered action");return this._actions[e](t)},Sh.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);_h(e,function(e,t){n._registerAction(t,e)})},Sh.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Ch(e,"is already registered");this._actions[e]=t},Sh.prototype.unregister=function(e){if(!this.isRegistered(e))throw Ch(e,"is not a registered action");this._actions[e]=void 0},Sh.prototype.length=function(){return Object.keys(this._actions).length},Sh.prototype.isRegistered=function(e){return!!this._actions[e]};var Ah=s.filter,Rh=d.is,Ph=ci.getBBox;function Mh(e,t,n,i,r,o,a,s,c,p,l,u,h){e.invoke(Th,this),this.register({selectElements:function(){var e=t.getRootElement(),r=n.filter(function(t){return t!==e});return i.select(r),r},spaceTool:function(){r.toggle()},lassoTool:function(){o.toggle()},handTool:function(){a.toggle()},globalConnectTool:function(){s.toggle()},distributeElements:function(e){var t=i.get(),n=e.type;t.length&&c.trigger(t,n)},alignElements:function(e){var t=i.get(),n=[],r=e.type;t.length&&(n=Ah(t,function(e){return!Rh(e,"bpmn:Lane")}),p.trigger(n,r))},setColor:function(e){var t=i.get();t.length&&h.setColor(t,e)},directEditing:function(){var e=i.get();e.length&&l.activate(e[0])},find:function(){u.toggle()},moveToOrigin:function(){var e,i,r=t.getRootElement();i=Rh(r,"bpmn:Collaboration")?n.filter(function(e){return Rh(e.parent,"bpmn:Collaboration")}):n.filter(function(e){return e!==r&&!Rh(e.parent,"bpmn:SubProcess")}),e=Ph(i),h.moveElements(i,{x:-e.x,y:-e.y},r)}})}U(Mh,Th),Mh.$inject=["injector","canvas","elementRegistry","selection","spaceTool","lassoTool","handTool","globalConnect","distributeElements","alignElements","directEditing","searchPad","modeling"];var kh=Mh,Bh=Xs.isAny;function Nh(e){e.registerProvider(this)}Nh.$inject=["globalConnect"];var Dh=Nh;Nh.prototype.canStartConnect=function(e){if(!(t=e)||function(e){return e.labelTarget}(t))return null;var t,n=e.businessObject;return Bh(n,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])};var Oh="connect-ok",Lh="connect-not-ok";function Ih(e,t,n,i,r){var o=this;this._dragging=t,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(e){var t=e.context,n=e.hover,r=t.canStartConnect=o.canStartConnect(n);null!==r&&(t.startTarget=n,i.addMarker(n,r?Oh:Lh))}),e.on(["global-connect.out","global-connect.cleanup"],function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&i.removeMarker(t,n?Oh:Lh)}),e.on(["global-connect.ended"],function(t){var i=t.context.startTarget,r={x:t.x,y:t.y};if(o.canStartConnect(i))return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,i,r)}),!1})}Ih.$inject=["eventBus","dragging","connect","canvas","toolManager"];var jh=Ih;Ih.prototype.start=function(e){this._dragging.init(e,"global-connect",{trapClick:!1,data:{context:{}}})},Ih.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.start()},Ih.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Ih.prototype.registerProvider=function(e){this._provider=e},Ih.prototype.canStartConnect=function(e){return this._provider.canStartConnect(e)};var zh=s.forEach;function Fh(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}Fh.$inject=["eventBus","dragging"];var $h=Fh;Fh.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error('A tool has to be registered with it\'s "events"');n.push(e),this.bindEvents(e,t)},Fh.prototype.isActive=function(e){return e&&this._active===e},Fh.prototype.length=function(e){return this._tools.length},Fh.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Fh.prototype.bindEvents=function(e,t){var n=this._eventBus,i=this._dragging,r=[];n.on(t.tool+".init",function(t){if(!t.context.reactivate&&this.isActive(e))return this.setActive(null),void i.cancel();this.setActive(e)},this),zh(t,function(e){r.push(e+".ended"),r.push(e+".canceled")}),n.on(r,250,function(e){var t=e.originalEvent;!this._active||t&&"tools"===t.target.parentNode.getAttribute("data-group")||this.setActive(null)},this)};var Gh={__depends__:[nu],__init__:["toolManager"],toolManager:["type",$h]},Wh={__depends__:[{__depends__:[au,ou,nu,Gh],globalConnect:["type",jh]}],__init__:["bpmnGlobalConnect"],bpmnGlobalConnect:["type",Dh]},Hh={},Vh=d.is;function qh(e){return Vh(e,"bpmn:FlowElement")||Vh(e,"bpmn:Participant")||Vh(e,"bpmn:Lane")||Vh(e,"bpmn:SequenceFlow")||Vh(e,"bpmn:MessageFlow")?"name":Vh(e,"bpmn:TextAnnotation")?"text":void 0}Hh.getLabel=function(e){var t=e.businessObject,n=qh(t);if(n)return t[n]||""},Hh.setLabel=function(e,t,n){var i=e.businessObject,r=qh(i);return r&&(i[r]=t),n&&(e.hidden=!t),e};var Uh=s.map,Yh=s.filter,Kh=s.sortBy;function Xh(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}var Zh=Xh;function Qh(e){return Yh(e,function(e){return!!e.matched}).length>0}function Jh(e,t){var n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var r=e.indexOf(t);return r>-1?(0!==r&&n.push({normal:i.substr(0,r)}),n.push({matched:i.substr(r,t.length)}),t.length+r<e.length&&n.push({normal:i.substr(t.length+r,e.length)})):n.push({normal:i}),n}Xh.$inject=["elementRegistry","searchPad","canvas"],Xh.prototype.find=function(e){var t=this._canvas.getRootElement(),n=this._elementRegistry.filter(function(e){return!e.labelTarget});return n=Yh(n,function(e){return e!==t}),n=Uh(n,function(t){return{primaryTokens:Jh(Hh.getLabel(t),e),secondaryTokens:Jh(t.id,e),element:t}}),n=Yh(n,function(e){return Qh(e.primaryTokens)||Qh(e.secondaryTokens)}),n=Kh(n,function(e){return Hh.getLabel(e.element)+e.element.id})};var ed=Y.clear,td=Y.delegate,nd=Y.query,id=Y.classes,rd=Y.attr,od=Y.domify,ad=ci.getBBox;function sd(e,t,n,i){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=i,this._container=od(sd.BOX_HTML),this._searchInput=nd(sd.INPUT_SELECTOR,this._container),this._resultsContainer=nd(sd.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}sd.$inject=["canvas","eventBus","overlays","selection"],sd.prototype._bindEvents=function(){var e=this;function t(t,n,i,r){e._eventMaps.push({el:t,type:i,listener:td.bind(t,n,i,r)})}t(document,"html","click",function(t){e.close()}),t(this._container,sd.INPUT_SELECTOR,"click",function(e){e.stopPropagation(),e.delegateTarget.focus()}),t(this._container,sd.RESULT_SELECTOR,"mouseover",function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)}),t(this._container,sd.RESULT_SELECTOR,"click",function(t){t.stopPropagation(),e._select(t.delegateTarget)}),t(this._container,sd.INPUT_SELECTOR,"keydown",function(e){38===e.keyCode&&e.preventDefault(),40===e.keyCode&&e.preventDefault()}),t(this._container,sd.INPUT_SELECTOR,"keyup",function(t){if(27===t.keyCode)return e.close();if(13===t.keyCode){var n=e._getCurrentResult();return n?e._select(n):e.close()}return 38===t.keyCode?e._scrollToDirection(!0):40===t.keyCode?e._scrollToDirection():void(37!==t.keyCode&&39!==t.keyCode&&e._search(t.delegateTarget.value))})},sd.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){td.unbind(e.el,e.type,e.listener)})},sd.prototype._search=function(e){var t=this;if(this._clearResults(),e&&""!==e){var n=this._searchProvider.find(e);if(n.length){n.forEach(function(e){var n=e.element.id,i=t._createResultNode(e,n);t._results[n]={element:e.element,node:i}});var i=nd(sd.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}}},sd.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},sd.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},sd.prototype._clearResults=function(){ed(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},sd.prototype._getCurrentResult=function(){return nd(sd.RESULT_SELECTED_SELECTOR,this._resultsContainer)},sd.prototype._createResultNode=function(e,t){var n=od(sd.RESULT_HTML);return e.primaryTokens.length>0&&pd(n,e.primaryTokens,sd.RESULT_PRIMARY_HTML),pd(n,e.secondaryTokens,sd.RESULT_SECONDARY_HTML),rd(n,sd.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},sd.prototype.registerProvider=function(e){this._searchProvider=e},sd.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,id(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},sd.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,id(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},sd.prototype.toggle=function(){this.isOpen()?this.close():this.open()},sd.prototype.isOpen=function(){return this._open},sd.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&id(t).remove(sd.RESULT_SELECTED_CLASS);var n=rd(e,sd.RESULT_ID_ATTRIBUTE),i=this._results[n].element;id(e).add(sd.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._centerViewbox(i),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},sd.prototype._select=function(e){var t=rd(e,sd.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this.close(),this._resetOverlay(),this._centerViewbox(n),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},sd.prototype._centerViewbox=function(e){var t=this._canvas.viewbox(),n=ad(e),i={x:n.x+n.width/2-t.outer.width/2,y:n.y+n.height/2-t.outer.height/2,width:t.outer.width,height:t.outer.height};this._canvas.viewbox(i),this._canvas.zoom(t.scale)},sd.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=function(e){var t=e.width+12,n=e.height+12,i=["width: "+t+"px","height: "+n+"px"].join("; ");return{position:{bottom:n-6,right:t-6},show:!0,html:'<div style="'+i+'" class="'+sd.OVERLAY_CLASS+'"></div>'}}(ad(e));this._overlayId=this._overlays.add(e,t)}};var cd=sd;function pd(e,t,n){var i=function(e){var t="";return e.forEach(function(e){e.matched?t+='<strong class="'+sd.RESULT_HIGHLIGHT_CLASS+'">'+e.matched+"</strong>":t+=e.normal}),""!==t?t:null}(t),r=od(n);r.innerHTML=i,e.appendChild(r)}sd.CONTAINER_SELECTOR=".djs-search-container",sd.INPUT_SELECTOR=".djs-search-input input",sd.RESULTS_CONTAINER_SELECTOR=".djs-search-results",sd.RESULT_SELECTOR=".djs-search-result",sd.RESULT_SELECTED_CLASS="djs-search-result-selected",sd.RESULT_SELECTED_SELECTOR="."+sd.RESULT_SELECTED_CLASS,sd.RESULT_ID_ATTRIBUTE="data-result-id",sd.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",sd.OVERLAY_CLASS="djs-search-overlay",sd.BOX_HTML='<div class="djs-search-container djs-draggable djs-scrollable"><div class="djs-search-input"><input type="text"/></div><div class="djs-search-results"></div></div>',sd.RESULT_HTML='<div class="djs-search-result"></div>',sd.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',sd.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var ld={__depends__:[{__depends__:[mo,ia],searchPad:["type",cd]}],__init__:["bpmnSearch"],bpmnSearch:["type",Zh]},ud=s.filter,hd=s.forEach,dd=s.sortBy;function md(e){return e&&e[e.length-1]}function fd(e){return e.y}function yd(e){return e.x}var vd={left:yd,center:yd,right:function(e){return e.x+e.width},top:fd,middle:fd,bottom:function(e){return e.y+e.height}};function gd(e){this._modeling=e}var bd=gd;gd.$inject=["modeling"],gd.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},gd.prototype._isType=function(e,t){return-1!==t.indexOf(e)},gd.prototype._alignmentPosition=function(e,t){var n,i,r,o=this._getOrientationDetails(e),a=o.axis,s=o.dimension,c={},p={},l=!1;if(this._isType(e,["left","top"]))c[e]=t[0][a];else if(this._isType(e,["right","bottom"]))r=md(t),c[e]=r[a]+r[s];else if(this._isType(e,["center","middle"])){if(hd(t,function(e){var t=e[a]+Math.round(e[s]/2);p[t]?p[t].elements.push(e):p[t]={elements:[e],center:t}}),n=dd(p,function(e){return e.elements.length>1&&(l=!0),e.elements.length}),l)return c[e]=md(n).center,c;i=t[0],r=md(t=dd(t,function(e){return e[a]+e[s]})),c[e]=function(e,t){return Math.round((e[a]+t[a]+t[s])/2)}(i,r)}return c},gd.prototype.trigger=function(e,t){var n=this._modeling,i=ud(e,function(e){return!(e.waypoints||e.host||e.labelTarget)}),r=dd(i,vd[t]),o=this._alignmentPosition(t,r);n.alignElements(r,o)};var xd={__init__:["alignElements"],alignElements:["type",bd]},Ed={__depends__:[ia,ph,Ga],__init__:["editorActions"],editorActions:["type",Th]},_d=bo.hasPrimaryModifier,wd=1500;function Sd(e,t,n,i){this._dragging=n,i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",wd,function(e){if(_d(e))return this.activateMove(e.originalEvent),!1},this),e.on("hand.end",function(t){var n=t.originalEvent.target;if(!(t.hover||n instanceof SVGElement))return!1;e.once("hand.ended",function(){this.activateMove(t.originalEvent,{reactivate:!0})},this)},this),e.on("hand.move.move",function(e){var n=t.viewbox().scale;t.scroll({dx:e.dx*n,dy:e.dy*n})}),e.on("hand.move.end",function(t){var n=t.context.reactivate;return!_d(t)&&n&&e.once("hand.move.ended",function(e){this.activateHand(e.originalEvent,!0,!0)},this),!1},this)}Sd.$inject=["eventBus","canvas","dragging","toolManager"];var Td=Sd;Sd.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:"grab",data:{context:n||{}}})},Sd.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:"grab",data:{context:{reactivate:n}}})},Sd.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateHand()},Sd.prototype.isActive=function(){var e=this._dragging.context();return e&&/^hand/.test(e.prefix)};var Cd={__depends__:[Gh],__init__:["handTool"],handTool:["type",Td]},Ad=s.values,Rd=ci.getEnclosedElements,Pd=bo.hasSecondaryModifier,Md=n.append,kd=n.attr,Bd=n.create,Nd=n.remove;function Dd(e,t,n,i,r,o){this._selection=r,this._dragging=n;var a=this,s=function(e){var n,i=t.getDefaultLayer();n=e.frame=Bd("rect"),kd(n,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Md(i,n)},c=function(e){var t=e.frame,n=e.bbox;kd(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Nd(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",function(){a.activateLasso(t.originalEvent,!0)})}),e.on("lasso.end",function(e){var t=Ld(e),n=i.filter(function(e){return e});a.select(n,t)}),e.on("lasso.start",function(e){var t=e.context;t.bbox=Ld(e),s(t)}),e.on("lasso.move",function(e){var t=e.context;t.bbox=Ld(e),c(t)}),e.on("lasso.cleanup",function(e){var t=e.context;p(t)}),e.on("element.mousedown",1500,function(e){if(Pd(e))return a.activateLasso(e.originalEvent),!0})}Dd.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager"];var Od=Dd;function Ld(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y};return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?{x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?{x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?{x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:{x:n.x,y:n.y,width:0,height:0}}Dd.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:"crosshair",data:{context:{}}})},Dd.prototype.activateSelection=function(e){this._dragging.init(e,"lasso.selection",{trapClick:!1,cursor:"crosshair",data:{context:{}}})},Dd.prototype.select=function(e,t){var n=Rd(e,t);this._selection.select(Ad(n))},Dd.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},Dd.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Id={__depends__:[Gh],__init__:["lassoTool"],lassoTool:["type",Od]},jd=s.forEach,zd=n.append,Fd=n.attr,$d=n.clone,Gd=n.create;function Wd(e,t,n){this._elementRegistry=e,this._canvas=t,this._styles=n}var Hd=Wd;Wd.$inject=["elementRegistry","canvas","styles"],Wd.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Wd.prototype.addDragger=function(e,t){var n=this.getGfx(e),i=$d(n),r=n.getBoundingClientRect();return e.waypoints&&function e(t){t.children&&jd(t.children,function(t){e(t)});t.style.markerStart="";t.style.markerEnd=""}(i),Fd(i,this._styles.cls("djs-dragger",[],{x:r.top,y:r.left})),zd(t,i),i},Wd.prototype.addFrame=function(e,t){var n=Gd("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return zd(t,n),n};var Vd={__init__:["previewSupport"],previewSupport:["type",Hd]},qd={};qd.getDirection=function(e,t){if("x"===e){if(t>0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null},qd.resizeBounds=function(e,t,n){var i=n.x,r=n.y;switch(t){case"n":return{x:e.x,y:e.y+r,width:e.width,height:e.height-r};case"s":return{x:e.x,y:e.y,width:e.width,height:e.height+r};case"w":return{x:e.x+i,y:e.y,width:e.width-i,height:e.height};case"e":return{x:e.x,y:e.y,width:e.width+i,height:e.height};default:throw new Error("unrecognized direction: "+t)}};var Ud=bo.hasPrimaryModifier,Yd=Math.abs,Kd=Math.round,Xd=1500,Zd={x:"width",y:"height"},Qd={x:"y",y:"x"},Jd=ci.selfAndAllChildren,em=s.assign,tm=s.forEach;function nm(e,t,n,i,r,o){this._canvas=n,this._dragging=t,this._modeling=i,this._rules=r,this._toolManager=o;var a=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),e.on("spaceTool.selection.end",function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("spaceTool.selection.ended",function(){a.activateMakeSpace(t.originalEvent)})}),e.on("spaceTool.move",Xd,function(e){var t=e.context;t.initialized||(t.initialized=a.initializeMakeSpace(e,t))}),e.on("spaceTool.end",function(t){var n=t.context,i=n.axis,r=n.direction,o=n.movingShapes,s=n.resizingShapes;if(n.initialized){var c={x:Kd(t.dx),y:Kd(t.dy)};c[Qd[i]]=0;var p=!0;tm(s,function(e){("w"===r&&t.x>e.x+e.width||"e"===r&&t.x<e.x||"n"===r&&t.y>e.y+e.height||"s"===r&&t.y<e.y)&&(p=!1)}),p&&a.makeSpace(o,s,c,r),e.once("spaceTool.ended",function(e){a.activateSelection(e.originalEvent,!0,!0)})}})}nm.$inject=["eventBus","dragging","canvas","modeling","rules","toolManager"];var im=nm;nm.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{trapClick:!1,cursor:"crosshair",autoActivate:t,data:{context:{reactivate:n}}})},nm.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:"crosshair",data:{context:{}}})},nm.prototype.makeSpace=function(e,t,n,i){return this._modeling.createSpace(e,t,n,i)},nm.prototype.initializeMakeSpace=function(e,t){var n=Yd(e.dx)>Yd(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Yd(i)<5)return!1;i<0&&(i*=-1),Ud(e)&&(i*=-1);var o=this._canvas.getRootElement(),a=Jd(o,!0),s=this.calculateAdjustments(a,n,i,r);return em(t,s,{axis:n,direction:qd.getDirection(n,i)}),ba.set("resize-"+("x"===n?"ew":"ns")),!0},nm.prototype.calculateAdjustments=function(e,t,n,i){var r=[],o=[],a=this._rules;return e.forEach(function(e){var s=e[t],c=s+e[Zd[t]];if(e.parent&&!e.waypoints)return n>0&&s>i?r.push(e):n<0&&c<i?r.push(e):s<i&&c>i&&a.allowed("shape.resize",{shape:e})?o.push(e):void 0}),{movingShapes:r,resizingShapes:o}},nm.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},nm.prototype.isActive=function(){var e=this._dragging.context();return e&&/^spaceTool/.test(e.prefix)};var rm=s.forEach,om="djs-dragging",am="djs-resizing",sm=250,cm=n.append,pm=n.attr,lm=n.classes,um=n.create,hm=n.remove,dm=w.translate;function mm(e,t,n,i,r){function o(e,t){rm(e,function(e){r.addDragger(e,t),n.addMarker(e,om)})}e.on("spaceTool.selection.start",function(e){var t=n.getLayer("space"),r=e.context,o="M 0,-10000 L 0,10000",a="M -10000,0 L 10000,0",s=um("g");pm(s,i.cls("djs-crosshair-group",["no-events"])),cm(t,s);var c=um("path");pm(c,"d",o),lm(c).add("djs-crosshair"),cm(s,c);var p=um("path");pm(p,"d",a),lm(p).add("djs-crosshair"),cm(s,p),r.crosshairGroup=s}),e.on("spaceTool.selection.move",function(e){var t=e.context.crosshairGroup;dm(t,e.x,e.y)}),e.on("spaceTool.selection.cleanup",function(e){var t=e.context.crosshairGroup;t&&hm(t)}),e.on("spaceTool.move",sm,function(e){var a=e.context,s=a.line,c=a.axis,p=a.movingShapes,l=a.resizingShapes;if(a.initialized){if(!a.dragGroup){var u=n.getLayer("space");s=um("path"),pm(s,"d","M0,0 L0,0"),lm(s).add("djs-crosshair"),cm(u,s),a.line=s;var h=um("g");pm(h,i.cls("djs-drag-group",["no-events"])),cm(n.getDefaultLayer(),h),o(p,h),o(a.movingConnections=t.filter(function(e){var t=!1;rm(p,function(n){rm(n.outgoing,function(n){e===n&&(t=!0)})});var n=!1;rm(p,function(t){rm(t.incoming,function(t){e===t&&(n=!0)})});var i=!1;rm(l,function(t){rm(t.outgoing,function(t){e===t&&(i=!0)})});var r=!1;return rm(l,function(t){rm(t.incoming,function(t){e===t&&(r=!0)})}),function(e){return e.waypoints}(e)&&(t||i)&&(n||r)}),h),a.dragGroup=h}if(!a.frameGroup){var d=um("g");pm(d,i.cls("djs-frame-group",["no-events"])),cm(n.getDefaultLayer(),d);var m=[];rm(l,function(e){var t=r.addFrame(e,d);m.push({element:t,initialWidth:t.getBBox().width,initialHeight:t.getBBox().height}),n.addMarker(e,am)}),a.frameGroup=d,a.frames=m}var f={x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y};pm(s,{path:f[c],display:""});var y={x:e.dx,y:e.dy};y[{x:"y",y:"x"}[a.axis]]=0,dm(a.dragGroup,y.x,y.y),rm(a.frames,function(e){e.initialWidth+y.x>5&&pm(e.element,{width:e.initialWidth+y.x}),e.initialHeight+y.y>5&&pm(e.element,{height:e.initialHeight+y.y})})}}),e.on("spaceTool.cleanup",function(e){var t=e.context,i=t.movingShapes,r=t.movingConnections,o=t.resizingShapes,a=t.line,s=t.dragGroup,c=t.frameGroup;rm(i,function(e){n.removeMarker(e,om)}),rm(r,function(e){n.removeMarker(e,om)}),s&&(hm(a),hm(s)),rm(o,function(e){n.removeMarker(e,am)}),c&&hm(c)})}mm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var fm={__init__:["spaceToolPreview"],__depends__:[nu,ou,Gh,Vd],spaceTool:["type",im],spaceToolPreview:["type",mm]},ym={__depends__:[xd,Ed,Cd,Id,fm,Dl,Wh,lh,Eh,ld],editorActions:["type",kh]};function vm(e,t){e.addListener(function(n,i){return 65===n&&e.isCmd(i)?(t.trigger("selectElements"),!0):70===n&&e.isCmd(i)?(t.trigger("find"),!0):e.hasModifier(i)?void 0:83===n?(t.trigger("spaceTool"),!0):76===n?(t.trigger("lassoTool"),!0):72===n?(t.trigger("handTool"),!0):67===n?(t.trigger("globalConnectTool"),!0):69===n?(t.trigger("directEditing"),!0):void 0})}vm.$inject=["keyboard","editorActions"];var gm=vm,bm=Y.event,xm=Y.matches;function Em(e,t,n){var i=this;this._config=e||{},this._eventBus=t,this._editorActions=n,this._listeners=[],this._keyHandler=function(e){var t,n,r=e.target,o=i._listeners,a=e.keyCode||e.charCode||-1;if(!r||!xm(r,"input, textarea")&&"true"!==r.contentEditable)for(t=0;n=o[t];t++)n(a,e)&&(e.preventDefault(),e.stopPropagation())},t.on("diagram.destroy",function(){i._fire("destroy"),i.unbind(),i._listeners=null}),t.on("diagram.init",function(){i._fire("init")}),t.on("attach",function(){e&&e.bindTo&&i.bind(e.bindTo)}),t.on("detach",function(){i.unbind()}),this._init()}Em.$inject=["config.keyboard","eventBus","editorActions"];var _m=Em;function wm(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Sm(e){return e.shiftKey}Em.prototype.bind=function(e){this.unbind(),this._node=e,bm.bind(e,"keydown",this._keyHandler,!0),this._fire("bind")},Em.prototype.getBinding=function(){return this._node},Em.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),bm.unbind(e,"keydown",this._keyHandler,!0)),this._node=null},Em.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node,listeners:this._listeners})},Em.prototype._init=function(){var e=this._listeners,t=this._editorActions,n=this._config;e.push(function(e,n){if(wm(n)&&!Sm(n)&&90===e)return t.trigger("undo"),!0}),e.push(function(e,n){if(wm(n)&&(89===e||90===e&&Sm(n)))return t.trigger("redo"),!0}),e.push(function(e,n){if(wm(n)&&67===e)return t.trigger("copy"),!0}),e.push(function(e,n){if(wm(n)&&86===e)return t.trigger("paste"),!0}),e.push(function(e,n){if(46===e)return t.trigger("removeSelection"),!0}),e.push(function(e,n){if((107===e||187===e||171===e||61===e)&&wm(n))return t.trigger("stepZoom",{value:1}),!0}),e.push(function(e,n){if((109===e||189===e||173===e)&&wm(n))return t.trigger("stepZoom",{value:-1}),!0}),e.push(function(e,n){if((96===e||48===e)&&wm(n))return t.trigger("zoom",{value:1}),!0}),e.push(function(e,i){if([37,38,39,40].indexOf(e)>=0){var r={invertY:n.invertY,speed:n.speed||50};switch(e){case 37:r.direction="left";break;case 38:r.direction="up";break;case 39:r.direction="right";break;case 40:r.direction="down"}return t.trigger("moveCanvas",r),!0}})},Em.prototype.addListener=function(e){this._listeners.push(e)},Em.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Em.prototype.isCmd=wm,Em.prototype.isShift=Sm;var Tm={__depends__:[{__init__:["keyboard"],keyboard:["type",_m]}],__init__:["bpmnKeyBindings"],bpmnKeyBindings:["type",gm]},Cm=n.append,Am=n.attr,Rm=n.create,Pm=n.remove,Mm=d.getBusinessObject,km=d.is,Bm=w.translate,Nm="djs-element-hidden",Dm="djs-label-hidden";function Om(e,t,n,i){var r,o,a,s=this,c=t.getDefaultLayer();e.on("directEditing.activate",function(e){var n=e.active;if(r=n.element.label||n.element,km(r,"bpmn:TextAnnotation")){o=t.getAbsoluteBBox(r),a=Rm("g");var p=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),l=s.path=Rm("path");Am(l,{d:p,strokeWidth:2,stroke:function(e,t){return Mm(e).di.get("stroke")||t||"black"}(r)}),Cm(a,l),Cm(c,a),Bm(a,r.x,r.y)}km(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,Nm):(km(r,"bpmn:Task")||km(r,"bpmn:CallActivity")||km(r,"bpmn:SubProcess")||km(r,"bpmn:Participant"))&&t.addMarker(r,Dm)}),e.on("directEditing.resize",function(e){if(km(r,"bpmn:TextAnnotation")){var t=e.height,n=e.dy,a=Math.max(r.height/o.height*(t+n),0),c=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:a,position:{mx:0,my:0}});Am(s.path,{d:c})}}),e.on(["directEditing.complete","directEditing.cancel"],function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,Nm),t.removeMarker(r,Dm)),r=void 0,o=void 0,a&&(Pm(a),a=void 0)})}Om.$inject=["eventBus","canvas","elementRegistry","pathMap"];var Lm=Om,Im=s.assign,jm=d.is,zm=Xs.isAny,Fm=f.isExpanded;function $m(e,t,n,i,r){function o(e,t){(t||zm(e,["bpmn:Task","bpmn:TextAnnotation"])||Wm(e))&&n.activate(e)}this._canvas=t,this._modeling=i,n.registerProvider(this),e.on("element.dblclick",function(e){o(e.element,!0)}),e.on(["element.mousedown","drag.init","canvas.viewbox.changing","autoPlace"],function(e){n.complete()}),e.on(["commandStack.changed"],function(e){n.cancel()}),e.on("directEditing.activate",function(e){r.removeResizers()}),e.on("create.end",500,function(e){var t=e.shape,n=e.context.canExecute;e.isTouch||n&&o(t)}),e.on("autoPlace.end",500,function(e){o(e.shape)})}$m.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles"];var Gm=$m;function Wm(e){return jm(e,"bpmn:SubProcess")&&!Fm(e)}$m.prototype.activate=function(e){var t=Hh.getLabel(e);if(void 0!==t){var n={text:t},i=this.getEditingBBox(e);Im(n,i);var r=e.label||e,o={};return(zm(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Wm(e))&&Im(o,{centerVertically:!0}),r.labelTarget&&Im(o,{autoResize:!0}),jm(e,"bpmn:TextAnnotation")&&Im(o,{resizable:!0,autoResize:!0}),Im(n,{options:o}),n}},$m.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r=i.x+i.width/2,o=i.y+i.height/2,a={x:i.x,y:i.y},s=t.zoom(),c=11*s,p=13*s,l=12*s,u=14*s,h={};if((jm(e,"bpmn:Lane")||function(e){return jm(e,"bpmn:Participant")&&Fm(e)}(e))&&(Im(a,{width:i.height,height:30*s,x:i.x-i.height/2+15*s,y:o-30*s/2}),Im(h,{fontSize:l+"px",lineHeight:u+"px",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px",transform:"rotate(-90deg)"})),(zm(e,["bpmn:Task","bpmn:CallActivity"])||function(e){return jm(e,"bpmn:Participant")&&!Fm(e)}(e)||Wm(e))&&(Im(a,{width:i.width,height:i.height}),Im(h,{fontSize:l+"px",lineHeight:u+"px",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"})),function(e){return jm(e,"bpmn:SubProcess")&&Fm(e)}(e)&&(Im(a,{width:i.width,x:i.x}),Im(h,{fontSize:l+"px",lineHeight:u+"px",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"})),n.labelTarget){var d=90*s,m=7*s,f=4*s;Im(a,{width:d,height:i.height+m+f,x:r-d/2,y:i.y-m}),Im(h,{fontSize:c+"px",lineHeight:p+"px",paddingTop:m+"px",paddingBottom:f+"px"})}return jm(e,"bpmn:TextAnnotation")&&(Im(a,{width:i.width,height:i.height,minWidth:30*s,minHeight:10*s}),Im(h,{textAlign:"left",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px",fontSize:l+"px",lineHeight:u+"px"})),{bounds:a,style:h}},$m.prototype.update=function(e,t,n,i){var r,o;jm(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),this._modeling.updateLabel(e,t,r)};var Hm=ci.getType;function Vm(e,t,n,i){e.on("element.changed",function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=n.getGraphics(r)),i.gfx&&e.fire(Hm(r)+".changed",i)}),e.on("elements.changed",function(t){var n=t.elements;n.forEach(function(t){e.fire("element.changed",{element:t})}),i.updateContainments(n)}),e.on("shape.changed",function(e){i.update("shape",e.element,e.gfx)}),e.on("connection.changed",function(e){i.update("connection",e.element,e.gfx)})}Vm.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var qm={__init__:["changeSupport"],changeSupport:["type",Vm]},Um=s.pick,Ym=s.assign,Km=Cs.asTRBL,Xm=Cs.roundBounds;function Zm(e,t,n,i){this._dragging=i,this._rules=t;var r=this;e.on("resize.start",function(e){var t,n,i;t=e.context,n=t.resizeConstraints,i=t.minBounds,void 0===n&&(void 0===i&&(i=r.computeMinResizeBox(t)),t.resizeConstraints={min:Km(i)})}),e.on("resize.move",function(e){var t={x:e.dx,y:e.dy};!function(e,t){var n,i=e.shape,o=e.direction,a=e.resizeConstraints;e.delta=t,n=jc.resizeBounds(i,o,t),e.newBounds=jc.ensureConstraints(n,a),e.canExecute=r.canResize(e)}(e.context,t)}),e.on("resize.end",function(e){var t,i,r,o;t=e.context,i=t.shape,r=t.canExecute,o=t.newBounds,r&&(o=Xm(o),n.resizeShape(i,o))})}Zm.prototype.canResize=function(e){var t=this._rules,n=Um(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Zm.prototype.activate=function(e,t,n){var i,r,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(r=(i=Ym({shape:t},n)).direction))throw new Error("must provide a direction (nw|se|ne|sw)");o.init(e,"resize",{autoActivate:!0,cursor:"resize-"+(/nw|se/.test(r)?"nwse":"nesw"),data:{shape:t,context:i}})},Zm.prototype.computeMinResizeBox=function(e){var t,n,i=e.shape,r=e.direction;return t=e.minDimensions||{width:10,height:10},n=jc.computeChildrenBBox(i,e.childrenBoxPadding),jc.getMinResizeBounds(r,i,t,n)},Zm.$inject=["eventBus","rules","modeling","dragging"];var Qm=Zm,Jm=s.bind,ef=s.forEach,tf=n.append,nf=n.attr,rf=n.classes,of=n.clear,af=n.create,sf=Y.event,cf=bo.isPrimaryButton,pf=Cs.asTRBL,lf=w.transform;function uf(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(e){var t=e.newSelection;r.removeResizers(),1===t.length&&ef(t,Jm(r.addResizer,r))}),e.on("shape.changed",function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))})}uf.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(t){cf(t)&&i.activate(t,e,n)}sf.bind(t,"mousedown",r),sf.bind(t,"touchstart",r)},uf.prototype._createResizer=function(e,t,n,i,r){var o=this._getResizersParent(),a=af("g");rf(a).add("djs-resizer"),rf(a).add("djs-resizer-"+e.id),rf(a).add("djs-resizer-"+r),tf(o,a);var s=af("rect");nf(s,{x:-7,y:-7,width:5,height:5}),rf(s).add("djs-resizer-visual"),tf(a,s);var c=af("rect");return nf(c,{x:-7,y:-7,width:20,height:20}),rf(c).add("djs-resizer-hit"),tf(a,c),lf(a,t,n,i),a},uf.prototype.createResizer=function(e,t){var n,i=pf(e);n="nw"===t?this._createResizer(e,i.left,i.top,0,t):"ne"===t?this._createResizer(e,i.right,i.top,90,t):"se"===t?this._createResizer(e,i.right,i.bottom,180,t):this._createResizer(e,i.left,i.bottom,270,t),this.makeDraggable(e,n,t)},uf.prototype.addResizer=function(e){this._resize.canResize({shape:e})&&(this.createResizer(e,"nw"),this.createResizer(e,"ne"),this.createResizer(e,"se"),this.createResizer(e,"sw"))},uf.prototype.removeResizers=function(){var e=this._getResizersParent();of(e)},uf.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},uf.$inject=["eventBus","canvas","selection","resize"];var hf=uf,df="djs-resizing",mf="resize-not-ok",ff=500,yf=n.attr,vf=n.remove,gf=n.classes;function bf(e,t,n){e.on("resize.move",ff,function(e){var i,r,o,a;i=e.context,r=i.shape,o=i.newBounds,(a=i.frame)||(a=i.frame=n.addFrame(r,t.getDefaultLayer()),t.addMarker(r,df)),o.width>5&&yf(a,{x:o.x,width:o.width}),o.height>5&&yf(a,{y:o.y,height:o.height}),i.canExecute?gf(a).remove(mf):gf(a).add(mf)}),e.on("resize.cleanup",function(e){var n,i;n=e.context,i=n.shape,n.frame&&vf(n.frame),t.removeMarker(i,df)})}bf.$inject=["eventBus","canvas","previewSupport"];var xf={__depends__:[ou,nu,Vd],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Qm],resizePreview:["type",bf],resizeHandles:["type",hf]},Ef={__depends__:[qm,xf,Dl],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Gm],labelEditingPreview:["type",Lm]},_f=s.map,wf=s.assign,Sf=s.pick;function Tf(e){this._model=e}Tf.$inject=["moddle"],Tf.prototype._needsId=function(e){return e.$instanceOf("bpmn:RootElement")||e.$instanceOf("bpmn:FlowElement")||e.$instanceOf("bpmn:MessageFlow")||e.$instanceOf("bpmn:DataAssociation")||e.$instanceOf("bpmn:Artifact")||e.$instanceOf("bpmn:Participant")||e.$instanceOf("bpmn:Lane")||e.$instanceOf("bpmn:Process")||e.$instanceOf("bpmn:Collaboration")||e.$instanceOf("bpmndi:BPMNShape")||e.$instanceOf("bpmndi:BPMNEdge")||e.$instanceOf("bpmndi:BPMNDiagram")||e.$instanceOf("bpmndi:BPMNPlane")||e.$instanceOf("bpmn:Property")},Tf.prototype._ensureId=function(e){var t=(e.$type||"").replace(/^[^:]*:/g,"")+"_";!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Tf.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Tf.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Tf.prototype.createDiShape=function(e,t,n){return this.create("bpmndi:BPMNShape",wf({bpmnElement:e,bounds:this.createDiBounds(t)},n))},Tf.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Tf.prototype.createDiWaypoints=function(e){var t=this;return _f(e,function(e){return t.createDiWaypoint(e)})},Tf.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Sf(e,["x","y"]))},Tf.prototype.createDiEdge=function(e,t,n){return this.create("bpmndi:BPMNEdge",wf({bpmnElement:e},n))},Tf.prototype.createDiPlane=function(e){return this.create("bpmndi:BPMNPlane",{bpmnElement:e})};var Cf=Tf,Af=Cs.getMid;function Rf(){}var Pf=Rf;Rf.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||Af(e.source),t.connectionEnd||Af(e.target)]};var Mf={},kf=s.isArray,Bf=s.find,Nf=s.without,Df=s.assign,Of=Cs.getOrientation,Lf=Cs.getMid,If=Va.pointsAligned,jf=Va.pointInRect,zf=Va.pointDistance,Ff=20,$f={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Gf(e,t,n){var i,r;if("h:v"===(n=n||"h:h"))return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:i=Math.round((t.x-e.x)/2+e.x),y:e.y},{x:i,y:t.y}];if("v:v"===n)return r=Math.round((t.y-e.y)/2+e.y),[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("unknown directions: <"+n+">: directions must be specified as {a direction}:{b direction} (direction in h|v)")}function Wf(e,t,n){var i=[];return If(e,t)||(i=Gf(e,t,n)),i.unshift(e),i.push(t),i}function Hf(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Nf(o,"straight")[0]||"h:h",s=$f[a]||0,c=Of(e,t,s),p=function(e,t){switch(e){case"intersect":return null;case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}(c,a);if(n=n||Lf(e),i=i||Lf(t),p){if("h:h"===p)switch(c){case"top-right":case"right":case"bottom-right":n={original:n,x:e.x,y:n.y},i={original:i,x:t.x+t.width,y:i.y};break;case"top-left":case"left":case"bottom-left":n={original:n,x:e.x+e.width,y:n.y},i={original:i,x:t.x,y:i.y}}if("v:v"===p)switch(c){case"top-left":case"top":case"top-right":n={original:n,x:n.x,y:e.y+e.height},i={original:i,x:i.x,y:t.y};break;case"bottom-left":case"bottom":case"bottom-right":n={original:n,x:n.x,y:e.y},i={original:i,x:i.x,y:t.y+t.height}}return Wf(n,i,p)}}function Vf(e,t,n){return function(e,t,n){return e>=t&&e<=n}(t[e],n[e],n[e]+n[{x:"width",y:"height"}[e]])}function qf(e,t,n,i,r){var o,a,s={};return a=Of(e,t),/^(top|bottom|left|right)$/.test(a)?(/top|bottom/.test(a)&&(o="x"),/left|right/.test(a)&&(o="y"),"target"===r.preserveDocking?Vf(o,i,e)?(s[o]=i[o],[{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y,original:{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y}},{x:i.x,y:i.y}]):null:Vf(o,n,t)?(s[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y,original:{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y}}]):null):null}function Uf(e,t,n,i){if(function(e,t,n){return n.length<3||!(n.length>4)&&!!Bf(n,function(e,t){var i=n[t-1];return i&&zf(e,i)<3})}(0,0,i))return null;var r,o=i[0],a=i.slice();return a[0]=n,a[1]=function(e,t,n){switch(If(t,e)){case"v":return{x:e.x,y:n.y};case"h":return{x:n.x,y:e.y}}return{x:e.x,y:e.y}}(a[1],o,n),(r=function(e,t,n){var i;for(i=e.length-2;0!==i;i--)if(jf(e[i],t,Ff)||jf(e[i],n,Ff))return e.slice(i);return e}(a,e,t))!==a?Uf(e,t,n,r):a}Mf.repairConnection=function(e,t,n,i,r,o){var a;return kf(n)&&(r=n,o=i,n=Lf(e),i=Lf(t)),r=r||[],-1!==(o=Df({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&(a=qf(e,t,n,i,o)),a||(o.connectionEnd?a=(a=Uf(t,e,i,r.slice().reverse()))&&a.reverse():o.connectionStart?a=Uf(e,t,n,r):r&&r.length&&(a=r)),a||(a=Hf(e,t,n,i,o)),a};var Yf=s.assign,Kf=Va.pointsOnLine,Xf=f.isExpanded,Zf=Cs.getMid,Qf=Cs.getOrientation,Jf=d.is;function ey(){}U(ey,Pf);var ty=ey;function ny(e,t){return e?e.original||e:Zf(t)}function iy(e){var t=e.source,n=e.target;return Jf(n,"bpmn:Activity")&&Jf(t,"bpmn:BoundaryEvent")&&n.businessObject.isForCompensation}function ry(e){return Jf(e,"bpmn:SubProcess")&&Xf(e)}ey.prototype.layoutConnection=function(e,t){t=t||{};var n,i,r,o,a=e.source,s=e.target,c=e.waypoints,p=t.connectionStart,l=t.connectionEnd;if(p||(p=ny(c&&c[0],a)),l||(l=ny(c&&c[c.length-1],s)),(Jf(e,"bpmn:Association")||Jf(e,"bpmn:DataAssociation"))&&c&&!iy(e))return[].concat([p],c.slice(1,-1),[l]);if(Jf(e,"bpmn:MessageFlow"))n={preferredLayouts:["v:v"]},Jf(s,"bpmn:Participant")&&(n={preferredLayouts:["straight","v:v"]}),ry(s)&&(n={preferredLayouts:["straight","v:v"]}),ry(a)&&Jf(s,"bpmn:FlowNode")&&(n={preferredLayouts:["straight","v:v"],preserveDocking:ry(s)?"source":"target"}),Jf(a,"bpmn:Participant")&&Jf(s,"bpmn:FlowNode")&&(n={preferredLayouts:["straight","v:v"],preserveDocking:"target"}),Jf(s,"bpmn:Event")&&(n={preferredLayouts:["v:v"]});else if(Jf(e,"bpmn:SequenceFlow")||iy(e))if(Jf(a,"bpmn:BoundaryEvent")){var u=(o=(r=a).host,Qf(Zf(r),o,-10));/left|right/.test(u)?n={preferredLayouts:["h:v"]}:/top|bottom/.test(u)&&(n={preferredLayouts:["v:h"]})}else n=Jf(a,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:Jf(s,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]};return n&&(n=Yf(n,t),i=(i=Mf.repairConnection(a,s,p,l,c,n))&&i.reduce(function(e,t,n){var r=e[e.length-1],o=i[n+1];return Kf(r,o,t,0)||e.push(t),e},[])),i||[p,l]};var oy=s.assign,ay=s.forEach,sy=d.getBusinessObject,cy=d.is;function py(e,t,n,i){fc.call(this,e),this._bpmnFactory=t,this._translate=i;var r=this;function o(e){var t=e.context.oldRoot.children;ay(t,function(e){cy(e,"bpmn:BaseElement")&&r.updateParent(e)})}function a(e){var t=e.context.shape;cy(t,"bpmn:BaseElement")&&r.updateBounds(t)}function s(e){r.updateConnection(e.context)}function c(e){r.updateConnectionWaypoints(e.context.connection)}function p(e){r.updateAttachment(e.context)}this.executed(["connection.layout","connection.create","connection.reconnectEnd","connection.reconnectStart"],function(e){var t,i=e.context;i.cropped||((t=i.connection).waypoints=n.getCroppedWaypoints(t),i.cropped=!0)}),this.reverted(["connection.layout"],function(e){delete e.context.cropped}),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],uy(function(e){var t=e.context;r.updateParent(t.shape||t.connection,t.oldParent)})),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],uy(function(e){var t=e.context,n=t.shape||t.connection,i=t.parent||t.newParent;r.updateParent(n,i)})),this.executed(["canvas.updateRoot"],o),this.reverted(["canvas.updateRoot"],o),this.executed(["shape.move","shape.create","shape.resize"],uy(function(e){"label"!==e.context.shape.type&&a(e)})),this.reverted(["shape.move","shape.create","shape.resize"],uy(function(e){"label"!==e.context.shape.type&&a(e)})),e.on("shape.changed",function(e){"label"===e.element.type&&a({context:{shape:e.element}})}),this.executed(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],uy(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],uy(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints","connection.reconnectEnd","connection.reconnectStart"],uy(c)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints","connection.reconnectEnd","connection.reconnectStart"],uy(c)),this.executed(["connection.reconnectEnd","connection.reconnectStart"],uy(function(e){var t=e.context,n=t.connection,i=sy(n),r=sy(t.oldSource),o=sy(t.oldTarget),a=sy(n.source),s=sy(n.target);r!==a&&o!==s&&(r&&r.default===i&&(t.default=r.default,r.default=void 0),i.sourceRef&&i.sourceRef.default&&!(cy(s,"bpmn:Activity")||cy(s,"bpmn:EndEvent")||cy(s,"bpmn:Gateway")||cy(s,"bpmn:IntermediateThrowEvent"))&&(t.default=i.sourceRef.default,i.sourceRef.default=void 0),r&&i.conditionExpression&&!cy(a,"bpmn:Activity")&&!cy(a,"bpmn:Gateway")&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0),o&&i.conditionExpression&&!(cy(s,"bpmn:Activity")||cy(s,"bpmn:EndEvent")||cy(s,"bpmn:Gateway")||cy(s,"bpmn:IntermediateThrowEvent"))&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0))})),this.reverted(["connection.reconnectEnd","connection.reconnectStart"],uy(function(e){var t=e.context,n=t.connection,i=sy(n),r=sy(n.source);t.default&&(cy(r,"bpmn:ExclusiveGateway")||cy(r,"bpmn:InclusiveGateway")||cy(r,"bpmn:Activity"))&&(r.default=t.default),t.conditionExpression&&cy(r,"bpmn:Activity")&&(i.conditionExpression=t.conditionExpression)})),this.executed(["element.updateAttachment"],uy(p)),this.reverted(["element.updateAttachment"],uy(p))}U(py,fc);var ly=py;function uy(e){return function(t){var n=t.context,i=n.shape||n.connection;cy(i,"bpmn:BaseElement")&&e(t)}}py.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],py.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},py.prototype.updateParent=function(e,t){if(!(e instanceof Ii.Label)){var n=e.parent,i=e.businessObject,r=n&&n.businessObject,o=r&&r.di;cy(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),cy(e,"bpmn:DataOutputAssociation")&&(r=e.source?e.source.businessObject:null),cy(e,"bpmn:DataInputAssociation")&&(r=e.target?e.target.businessObject:null),this.updateSemanticParent(i,r),cy(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(i.di,o)}},py.prototype.updateBounds=function(e){var t=e.businessObject.di,n=e instanceof Ii.Label?this._getLabel(t).bounds:t.bounds;oy(n,{x:e.x,y:e.y,width:e.width,height:e.height})},py.prototype.updateFlowNodeRefs=function(e,t,n){var i,r;n!==t&&(cy(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),si.remove(i,e)),cy(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),si.add(r,e)))},py.prototype.updateDiConnection=function(e,t,n){e.sourceElement&&e.sourceElement.bpmnElement!==t&&(e.sourceElement=t&&t.di),e.targetElement&&e.targetElement.bpmnElement!==n&&(e.targetElement=n&&n.di)},py.prototype.updateDiParent=function(e,t){if(t&&!cy(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(si.remove(n,e),e.$parent=null)}},py.prototype.getLaneSet=function(e){var t,n;return cy(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(cy(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},py.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t){if(cy(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(cy(e,"bpmn:FlowElement")){if(t)if(cy(t,"bpmn:Participant"))t=t.processRef;else if(cy(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(cy(t,"bpmn:Lane"));i="flowElements"}else if(cy(e,"bpmn:Artifact")){for(;t&&!cy(t,"bpmn:Process")&&!cy(t,"bpmn:SubProcess")&&!cy(t,"bpmn:Collaboration");){if(cy(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(cy(e,"bpmn:MessageFlow"))i="messageFlows";else if(cy(e,"bpmn:Participant")){i="participants";var o,a=e.processRef;a&&(o=function(e){for(;e&&!cy(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(si.remove(o.get("rootElements"),a),a.$parent=null),t&&(si.add(o.get("rootElements"),a),a.$parent=o))}else cy(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":cy(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(r("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var s;if(e.$parent&&(s=e.$parent.get(i),si.remove(s,e)),t?((s=t.get(i)).push(e),e.$parent=t):e.$parent=null,n){var c=n.get(i);si.remove(s,e),t&&(c||(c=[],t.set(i,c)),c.push(e))}}},py.prototype.updateConnectionWaypoints=function(e){e.businessObject.di.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},py.prototype.updateConnection=function(e){var t,n=e.connection,i=sy(n),r=sy(n.source),o=sy(n.target);if(cy(i,"bpmn:DataAssociation"))cy(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=r,t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,parent.businessObject)):cy(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||r,this.updateSemanticParent(i,r,t),i.targetRef=o);else{var a=cy(i,"bpmn:SequenceFlow");i.sourceRef!==r&&(a&&(si.remove(i.sourceRef&&i.sourceRef.get("outgoing"),i),r&&r.get("outgoing")&&r.get("outgoing").push(i)),i.sourceRef=r),i.targetRef!==o&&(a&&(si.remove(i.targetRef&&i.targetRef.get("incoming"),i),o&&o.get("incoming")&&o.get("incoming").push(i)),i.targetRef=o)}this.updateConnectionWaypoints(n),this.updateDiConnection(i.di,r,o)},py.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};var hy=s.assign,dy=s.forEach,my=d.is,fy=f.isExpanded;function yy(e,t,n){Qi.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}U(yy,Qi),yy.$inject=["bpmnFactory","moddle","translate"];var vy=yy;function gy(e,t,n){e[n]=t[n],delete t[n]}yy.prototype.baseCreate=Qi.prototype.create,yy.prototype.create=function(e,t){return"label"===e?this.baseCreate(e,hy({type:"label"},Be.DEFAULT_LABEL_SIZE,t)):this.createBpmnElement(e,t)},yy.prototype.createBpmnElement=function(e,t){var n,i,r,o=this._translate,a=(t=t||{}).businessObject;if(!a){if(!t.type)throw new Error(o("no shape type specified"));a=this._bpmnFactory.create(t.type)}return a.di||(a.di="root"===e?this._bpmnFactory.createDiPlane(a,[],{id:a.id+"_di"}):"connection"===e?this._bpmnFactory.createDiEdge(a,[],{id:a.id+"_di"}):this._bpmnFactory.createDiShape(a,{},{id:a.id+"_di"})),t.colors&&(hy(a.di,t.colors),delete t.colors),function(e,t,n){dy(n,function(n){void 0!==t[n]&&gy(e,t,n)})}(a,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&gy(a.di,t,"isExpanded"),my(a,"bpmn:ExclusiveGateway")&&(a.di.isMarkerVisible=!0),t.eventDefinitionType&&(i=a.get("eventDefinitions")||[],r=this._moddle.create(t.eventDefinitionType),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(r.condition=this._moddle.create("bpmn:FormalExpression")),i.push(r),r.$parent=a,a.eventDefinitions=i,delete t.eventDefinitionType),n=this._getDefaultSize(a),t=hy({businessObject:a,id:a.id},n,t),this.baseCreate(e,t)},yy.prototype._getDefaultSize=function(e){return my(e,"bpmn:SubProcess")?fy(e)?{width:350,height:200}:{width:100,height:80}:my(e,"bpmn:Task")?{width:100,height:80}:my(e,"bpmn:Gateway")?{width:50,height:50}:my(e,"bpmn:Event")?{width:36,height:36}:my(e,"bpmn:Participant")?fy(e)?{width:600,height:250}:{width:400,height:100}:my(e,"bpmn:Lane")?{width:400,height:100}:my(e,"bpmn:DataObjectReference")?{width:36,height:50}:my(e,"bpmn:DataStoreReference")?{width:50,height:50}:my(e,"bpmn:TextAnnotation")?{width:100,height:30}:{width:100,height:80}},yy.prototype.createParticipantShape=function(e){var t={type:"bpmn:Participant"};return e||(t.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(t)};var by=Be.hasExternalLabel,xy=d.getBusinessObject,Ey=d.is,_y={width:0,height:0};function wy(e){var t=new G;function n(e,t){var n=e.label||e,i=e.labelTarget||e;return Hh.setLabel(n,t,i!==n),[n,i]}this.execute=function(e){return e.oldLabel=Hh.getLabel(e.element),n(e.element,e.newLabel)},this.revert=function(e){return n(e.element,e.oldLabel)},this.postExecute=function(n){var i=n.element,r=i.label||i,o=n.newBounds;if(by(i)||Ey(i,"bpmn:TextAnnotation")){var a=xy(r),s=a.name||a.text;s&&(void 0===o&&(o=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:Ty});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(r,s,t)),o&&e.resizeShape(r,o,_y))}}}wy.$inject=["modeling"];var Sy=wy,Ty={fontFamily:"Arial, sans-serif",fontSize:"11px"};var Cy=s.filter,Ay=Zc.getLanesRoot,Ry=Zc.getChildLanes,Py=Zc.LANE_INDENTATION;function My(e,t){this._modeling=e,this._spaceTool=t}My.$inject=["modeling","spaceTool"];var ky=My;function By(e){this._moddle=e}My.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Ay(i),a=o===i,s=a?i:i.parent;Ry(s).length||n.createShape({type:"bpmn:Lane"},{x:i.x+Py,y:i.y,width:i.width-Py,height:i.height},s);var c=[];ci.eachElement(o,function(e){return c.push(e),e===i?[]:Cy(e.children,function(e){return e!==i})});var p="top"===r?-120:120,l="top"===r?i.y:i.y+i.height,u=l+("top"===r?10:-10),h="top"===r?"n":"s",d=t.calculateAdjustments(c,"y",p,u);t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:p},h),e.newLane=n.createShape({type:"bpmn:Lane"},{x:i.x+(a?Py:0),y:l-("top"===r?120:0),width:i.width-(a?Py:0),height:120},s)},By.$inject=["moddle"];var Ny=By;By.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.claim(n,i):t.unclaim(n)},By.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.unclaim(n):t.claim(n,i)};var Dy=d.is,Oy=Zc.getLanesRoot,Ly=Zc.computeLanesResize,Iy=ci.eachElement,jy=Cs.asTRBL,zy=jc.substractTRBL;function Fy(e,t){this._modeling=e,this._spaceTool=t}Fy.$inject=["modeling","spaceTool"];var $y=Fy;Fy.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Fy.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Ly(e,t);n.resizeShape(e,t),i.forEach(function(e){n.resizeShape(e.shape,e.newBounds)})},Fy.prototype.resizeSpace=function(e,t){var n,i,r,o,a,s=this._spaceTool,c=jy(e),p=jy(t),l=zy(p,c),u=Oy(e),h=[],d=[];Iy(u,function(e){return h.push(e),(Dy(e,"bpmn:Lane")||Dy(e,"bpmn:Participant"))&&d.push(e),e.children}),(l.bottom||l.top)&&(n=l.bottom||l.top,i=e.y+(l.bottom?e.height:0)+(l.bottom?-10:10),r=l.bottom?"s":"n",o=l.top>0||l.bottom<0?-n:n,a=s.calculateAdjustments(h,"y",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:0,y:n},r)),(l.left||l.right)&&(n=l.right||l.left,i=e.x+(l.right?e.width:0)+(l.right?-10:100),r=l.right?"e":"w",o=l.left>0||l.right<0?-n:n,a=s.calculateAdjustments(d,"x",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:n,y:0},r))};var Gy=s.assign,Wy=s.forEach,Hy={fill:void 0,stroke:void 0};function Vy(e){this._commandStack=e}Vy.$inject=["commandStack"];var qy=Vy;Vy.prototype.postExecute=function(e){var t=e.elements,n=e.colors||Hy,i=this,r={};"fill"in n&&Gy(r,{fill:n.fill}),"stroke"in n&&Gy(r,{stroke:n.stroke}),Wy(t,function(e){i._commandStack.execute("element.updateProperties",{element:e,properties:{di:r}})})};var Uy=Zc.getChildLanes,Yy=Zc.LANE_INDENTATION;function Ky(e,t){this._modeling=e,this._translate=t}Ky.$inject=["modeling","translate"];var Xy=Ky;function Zy(e,t){this._canvas=e,this._modeling=t}Ky.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=Uy(i),a=o.length;if(a>r)throw new Error(n("more than {count} child lanes",{count:r}));var s,c,p,l,u,h=Math.round(i.height/r);for(u=0;u<r;u++)s=i.y+u*h,c=u===r-1?i.height-h*u:h,p={x:i.x+Yy,y:s,width:i.width-Yy,height:c},u<a?t.resizeShape(o[u],p):(l={type:"bpmn:Lane"},t.createShape(l,p,i))},Zy.$inject=["canvas","modeling"];var Qy=Zy;Zy.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=o.di;t.setRootElement(n,!0),si.add(a.rootElements,i),i.$parent=a,si.remove(a.rootElements,o),o.$parent=null,o.di=null,s.bpmnElement=i,i.di=s,e.oldRoot=r},Zy.prototype.revert=function(e){var t=this._canvas,n=e.newRoot.businessObject,i=e.oldRoot,r=i.businessObject,o=n.$parent,a=n.di;t.setRootElement(i,!0),si.remove(o.rootElements,n),n.$parent=null,si.add(o.rootElements,r),r.$parent=o,n.di=null,a.bpmnElement=r,r.di=a};var Jy=Zc.collectLanes,ev=Zc.getLanesRoot,tv=d.is,nv=Cs.asTRBL;function iv(e){this._elementRegistry=e}iv.$inject=["elementRegistry"];var rv=iv;iv.prototype.computeUpdates=function(e,t){var n={},i=[],r={},o=[];function a(e){n[e.id]||(o.push(e),n[e.id]=e)}function s(e){return e.parent?function(e){var t=ev(e);return r[t.id]||(r[t.id]=Jy(t)),r[t.id]}(e).filter(function(t){return n=e,i=nv(t),r=n.x+n.width/2,o=n.y+n.height/2,r>i.left&&r<i.right&&o>i.top&&o<i.bottom;var n,i,r,o}).map(function(e){return e.businessObject}):[]}return t.forEach(function(e){var t=ev(e);t&&!n[t.id]&&(t.children.filter(function(e){return tv(e,"bpmn:FlowNode")}).forEach(a),n[t.id]=t)}),e.forEach(a),o.forEach(function(e){var t=e.businessObject,n=t.get("lanes").slice(),r=s(e);i.push({flowNode:t,remove:n,add:r})}),t.forEach(function(e){var t=e.businessObject;e.parent||t.get("flowNodeRef").forEach(function(e){i.push({flowNode:e,remove:[t],add:[]})})}),i},iv.prototype.execute=function(e){var t=e.updates;t||(t=e.updates=this.computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(e){var t=e.flowNode,n=t.get("lanes");e.remove.forEach(function(e){si.remove(n,e),si.remove(e.get("flowNodeRef"),t)}),e.add.forEach(function(e){si.add(n,e),si.add(e.get("flowNodeRef"),t)})})},iv.prototype.revert=function(e){e.updates.forEach(function(e){var t=e.flowNode,n=t.get("lanes");e.add.forEach(function(e){si.remove(n,e),si.remove(e.get("flowNodeRef"),t)}),e.remove.forEach(function(e){si.add(n,e),si.add(e.get("flowNodeRef"),t)})})};var ov=s.reduce,av=s.keys,sv=s.forEach,cv=s.assign,pv=d.getBusinessObject,lv="id",uv="di",hv={width:0,height:0};function dv(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textUtil=new G}dv.$inject=["elementRegistry","moddle","translate","modeling"];var mv=dv;function fv(e,t){return lv in e&&e[lv]!==t[lv]}function yv(e,t){sv(t,function(t,n){var i;n!==uv?e.set(n,t):e.di&&(i=e.di,sv(t,function(e,t){i.set(t,e)}))})}dv.prototype.execute=function(e){var t=e.element,n=[t],i=this._translate;if(!t)throw new Error(i("element required"));var r=this._elementRegistry,o=this._moddle.ids,a=t.businessObject,s=function(e){var t=cv({},e);return vv.forEach(function(n){n in e&&(t[n]=pv(t[n]))}),t}(e.properties),c=e.oldProperties||function(e,t){var n=av(t);return ov(n,function(n,i){var r,o;return n[i]=i!==uv?e.get(i):(r=e.di,o=av(t.di),ov(o,function(e,t){return e[t]=r.get(t),e},{})),n},{})}(a,s);return fv(s,a)&&(o.unclaim(a[lv]),r.updateId(t,s[lv]),o.claim(s[lv],a)),"default"in s&&(s.default&&n.push(r.get(s.default.id)),a.default&&n.push(r.get(a.default.id))),"name"in s&&t.label&&(n.push(t.label),t.label.hidden=!s.name),yv(a,s),e.oldProperties=c,e.changed=n,n},dv.prototype.postExecute=function(e){var t=e.element.label,n=t&&pv(t).name;if(n){var i=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:gv});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(t,n,this._textUtil);this._modeling.resizeShape(t,i,hv)}},dv.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return yv(r,i),fv(n,r)&&(a.unclaim(n[lv]),o.updateId(t,i[lv]),a.claim(i[lv],r)),e.changed};var vv=["default"];var gv={fontFamily:"Arial, sans-serif",fontSize:"11px"};var bv=s.forEach;function xv(e,t){this._modeling=e,this._canvas=t}xv.$inject=["modeling","canvas"];var Ev=xv;function _v(){}xv.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;bv(n,function(e){var n={x:0,y:0};i.left?n.x=i.left-e.x:i.right?n.x=i.right-e.width-e.x:i.center?n.x=i.center-Math.round(e.width/2)-e.x:i.top?n.y=i.top-e.y:i.bottom?n.y=i.bottom-e.height-e.y:i.middle&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)})},xv.prototype.postExecute=function(e){};var wv=_v;_v.prototype.execute=function(){},_v.prototype.revert=function(){};var Sv=s.some;function Tv(e){this._modeling=e}U(Tv,wv),Tv.$inject=["modeling"];var Cv=Tv;function Av(e,t){this._canvas=e,this._layouter=t}Tv.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape;i=e.shape=this._modeling.createShape(i,e.position,n,{attach:e.attach}),e.shape=i},Tv.prototype.postExecute=function(e){var t,n,i=e.connectionParent||e.shape.parent;t=e.source,n=e.shape,Sv(t.outgoing,function(e){return e.target===n})||this._modeling.connect(e.source,e.shape,e.connection,i)},Av.$inject=["canvas","layouter"];var Rv=Av;Av.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},Av.prototype.revert=function(e){var t=e.connection;this._canvas.removeConnection(t),t.source=null,t.target=null};var Pv=s.assign,Mv=Math.round;function kv(e){this._canvas=e}kv.$inject=["canvas"];var Bv=kv;function Nv(e){Bv.call(this,e)}kv.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?Pv(t,n):Pv(t,{x:n.x-Mv(t.width/2),y:n.y-Mv(t.height/2)}),this._canvas.addShape(t,i,r),t},kv.prototype.revert=function(e){this._canvas.removeShape(e.shape)},U(Nv,Bv),Nv.$inject=["canvas"];var Dv=Nv,Ov=Bv.prototype.execute;Nv.prototype.execute=function(e){var t=e.shape;return function(e){["width","height"].forEach(function(t){void 0===e[t]&&(e[t]=0)})}(t),t.labelTarget=e.labelTarget,Ov.call(this,e)};var Lv=Bv.prototype.revert;function Iv(e,t){this._canvas=e,this._modeling=t}Nv.prototype.revert=function(e){return e.shape.labelTarget=null,Lv.call(this,e)},Iv.$inject=["canvas","modeling"];var jv=Iv;Iv.prototype.preExecute=function(e){var t=e.connection;t.label&&this._modeling.removeShape(t.label)},Iv.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=si.indexOf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t.label=null,t},Iv.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,si.add(n.children,t,i),this._canvas.addConnection(t,n),t};var zv=s.forEach;function Fv(e,t){this._modeling=e,this._elementRegistry=t}U(Fv,wv),Fv.$inject=["modeling","elementRegistry"];var $v=Fv;Fv.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;zv(i,function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))})};var Gv={saveClear:function(e,t){if("function"!=typeof t)throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}},Wv=Gv.saveClear;function Hv(e,t){this._canvas=e,this._modeling=t}Hv.$inject=["canvas","modeling"];var Vv=Hv;Hv.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=n.label;n.labelTarget&&(e.labelTarget=n.labelTarget,n.labelTarget=null),i&&this._modeling.removeShape(i,{nested:!0}),Wv(n.incoming,function(e){t.removeConnection(e,{nested:!0})}),Wv(n.outgoing,function(e){t.removeConnection(e,{nested:!0})}),Wv(n.children,function(e){e.waypoints?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})})},Hv.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=si.indexOf(i.children,n),n.label=null,t.removeShape(n),n},Hv.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex,o=e.labelTarget;return si.add(i.children,n,r),o&&(o.label=n),t.addShape(n,i),n};var qv=s.forEach,Uv=s.sortBy;function Yv(e){this._modeling=e}Yv.$inject=["modeling"];var Kv=Yv,Xv={x:"y",y:"x"};Yv.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(e,t){e.range.min=Math.min(t[i],e.range.min),e.range.max=Math.max(t[i]+t[r],e.range.max)}function a(e){return e[i]+e[r]/2}function s(e){return e.length-1}function c(e){return e.max-e.min}var p,l,u=n[0],h=s(n),d=n[h],m=0;qv(n,function(e,p){var l,u,d;e.elements.length<2?p&&p!==n.length-1&&(o(e,e.elements[0]),m+=c(e.range)):(u=(l=Uv(e.elements,i))[0],p===h&&(u=l[s(l)]),d=a(u),e.range=null,qv(l,function(n){!function(e,n){var r={y:0};r[i]=e-a(n),r[i]&&(r[Xv[i]]=0,t.moveElements([n],r,n.parent))}(d,n),null!==e.range?o(e,n):e.range={min:n[i],max:n[i]+n[r]}}),p&&p!==n.length-1&&(m+=c(e.range)))}),l=Math.abs(d.range.min-u.range.max),(p=Math.round((l-m)/(n.length-1)))<n.length-1||qv(n,function(e,o){var a,s={};e!==u&&e!==d&&(a=n[o-1],e.range.max=0,qv(e.elements,function(n,o){s[Xv[i]]=0,s[i]=a.range.max-n[i]+p,e.range.min!==n[i]&&(s[i]+=n[i]-e.range.min),s[i]&&t.moveElements([n],s,n.parent),e.range.max=Math.max(n[i]+n[r],o?e.range.max:0)}))})},Yv.prototype.postExecute=function(e){};var Zv=s.assign;function Qv(e,t){this._layouter=e,this._canvas=t}Qv.$inject=["layouter","canvas"];var Jv=Qv;Qv.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return Zv(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Qv.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};var eg=s.forEach;function tg(){}var ng=tg;tg.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=si.remove(o.children,t),si.add(i.children,t,r),t.parent=i,eg(t.waypoints,function(e){e.x+=n.x,e.y+=n.y,e.original&&(e.original.x+=n.x,e.original.y+=n.y)}),t},tg.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return si.remove(n.children,t),si.add(i.children,t,r),t.parent=i,eg(t.waypoints,function(e){e.x-=o.x,e.y-=o.y,e.original&&(e.original.x-=o.x,e.original.y-=o.y)}),t};var ig={},rg=Cs.roundPoint,og=Uu.center,ag=Uu.delta;ig.getNewAttachPoint=function(e,t,n){var i=og(t),r=og(n),o=ag(e,i),a=o.x*(n.width/t.width),s=o.y*(n.height/t.height);return rg({x:r.x+a,y:r.y+s})},ig.getNewAttachShapeDelta=function(e,t,n){var i=og(e),r=og(t),o=og(n),a=ag(e,i),s=ag(i,r),c=s.x*(n.width/t.width),p=s.y*(n.height/t.height),l=o.x+c,u=o.y+p;return rg({x:l+a.x-e.x,y:u+a.y-e.y})};var sg={},cg=ig.getNewAttachPoint;function pg(e,t,n){var i=hg(e)[0];return cg(i.original||i,n,t)}function lg(e,t,n){var i=hg(e),r=i[i.length-1];return cg(r.original||r,n,t)}function ug(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function hg(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}sg.getResizedSourceAnchor=pg,sg.getResizedTargetAnchor=lg,sg.getMovedSourceAnchor=function(e,t,n){return pg(e,t,ug(t,n))},sg.getMovedTargetAnchor=function(e,t,n){return lg(e,t,ug(t,n))};var dg=s.forEach,mg=sg.getMovedSourceAnchor,fg=sg.getMovedTargetAnchor;function yg(e){this._modeling=e}var vg=yg;function gg(e){this._helper=new vg(e)}yg.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},yg.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,p=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),dg(a,function(e){o.moveShape(e,t,p[e.id]&&!l&&n,{recurse:!1,layout:!1})}),dg(s,function(e){var i=!!a[e.source.id],r=!!a[e.target.id];c[e.id]&&i&&r?o.moveConnection(e,t,p[e.id]&&!l&&n):o.layoutConnection(e,{connectionStart:i&&mg(e,e.source,t),connectionEnd:r&&fg(e,e.target,t)})})},yg.prototype.getClosure=function(e){return ci.getClosure(e)},gg.$inject=["modeling"];var bg=gg;gg.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},gg.prototype.postExecute=function(e){var t,n=e.hints;n&&n.primaryShape&&(t=n.primaryShape,n.oldParent=t.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,t)},gg.prototype.execute=function(e){},gg.prototype.revert=function(e){};var xg=s.assign,Eg=s.forEach,_g=s.pick,wg=sg.getMovedSourceAnchor,Sg=sg.getMovedTargetAnchor;function Tg(e){this._modeling=e,this._helper=new vg(e)}Tg.$inject=["modeling"];var Cg=Tg;Tg.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=_g(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=si.remove(o.children,t),si.add(i.children,t,r),xg(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Tg.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(Eg(t.incoming,function(e){r.layoutConnection(e,{connectionEnd:Sg(e,t,n)})}),Eg(t.outgoing,function(e){r.layoutConnection(e,{connectionStart:wg(e,t,n)})})),!1!==i.recurse&&this.moveChildren(e)},Tg.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return si.add(n.children,t,i),xg(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Tg.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Tg.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};var Ag=s.forEach,Rg=s.map,Pg=s.sortBy,Mg=s.assign;function kg(e,t){Ag(t,function(t){e[t]&&delete e[t]})}function Bg(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._selection=n,this._elementFactory=i,this._modeling=r,this._rules=o}U(Bg,wv),Bg.$inject=["eventBus","canvas","selection","elementFactory","modeling","rules"];var Ng=Bg;Bg.prototype.preExecute=function(e){var t=this._eventBus,n=this,i=e.tree,r=e.topParent,o=e.position;i.createdElements={},i.labels=[],Ag(i,function(e,a){var s=parseInt(a,10);isNaN(s)||(s||(e=Rg(e,function(e){return e.parent=r,e})),e=Pg(e,"priority"),Ag(e,function(e){var a,c=e.id,p=e.parent,l={},u=Mg({},e);if(s&&(u.parent=n._getCreatedElement(p,i)),p)if(t.fire("element.paste",{createdElements:i.createdElements,descriptor:u}),p=u.parent,u.waypoints)(u=n._createConnection(u,p,o,i))&&(i.createdElements[c]={element:u,descriptor:e});else{if(u.parent!==r&&(l.root=!1),u.host&&(l.attach=!0,p=n._getCreatedElement(u.host,i)),u.labelTarget)return i.labels.push(u);a={x:Math.round(o.x+u.delta.x+u.width/2),y:Math.round(o.y+u.delta.y+u.height/2)},kg(u,["id","parent","delta","host","priority"]),(u=n._createShape(u,p,a,l))&&(i.createdElements[c]={element:u,descriptor:e})}}))})},Bg.prototype.postExecute=function(e){var t=this._modeling,n=this._selection,i=this,r=e.tree,o=r.labels,a=[];Ag(o,function(e){var n,o,a,s=i._getCreatedElement(e.labelTarget,r);s&&(n=s.label)&&(o={x:s.x,y:s.y},s.waypoints&&(o=s.waypoints[0]),a={x:Math.round(o.x-n.x+e.delta.x),y:Math.round(o.y-n.y+e.delta.y)},t.moveShape(n,a,s.parent))}),Ag(r[0],function(e){var t=e.id,n=r.createdElements[t];n&&a.push(n.element)}),n.select(a)},Bg.prototype._createConnection=function(e,t,n,i){var r,o,a=this._modeling,s=this._rules;return e.waypoints=Rg(e.waypoints,function(t,i){return{x:Math.round(n.x+e.delta[i].x),y:Math.round(n.y+e.delta[i].y)}}),r=this._getCreatedElement(e.source,i),o=this._getCreatedElement(e.target,i),r&&o&&s.allowed("element.paste",{source:r,target:o})?(kg(e,["id","parent","delta","source","target","width","height","priority"]),a.createConnection(r,o,e,t)):null},Bg.prototype._createShape=function(e,t,n,i,r){var o=this._modeling,a=this._elementFactory;if(!this._rules.allowed("element.paste",{element:e,position:n,parent:t}))return null;var s=a.createShape(e);return o.createShape(s,n,t,i,r),s},Bg.prototype._getCreatedElement=function(e,t){return t.createdElements[e]&&t.createdElements[e].element};var Dg=s.isArray;function Og(){}Og.$inject=[];var Lg=Og;Og.prototype.execute=function(e){var t,n=e.newSource,i=e.newTarget,r=e.connection,o=e.dockingOrPoints,a=r.waypoints;if(!n&&!i)throw new Error("newSource or newTarget are required");if(n&&i)throw new Error("must specify either newSource or newTarget");return e.oldWaypoints=a,Dg(o)?t=o:(t=a.slice()).splice(n?0:-1,1,o),n&&(e.oldSource=r.source,r.source=n),i&&(e.oldTarget=r.target,r.target=i),r.waypoints=t,r},Og.prototype.revert=function(e){var t=e.newSource,n=e.newTarget,i=e.connection;return t&&(i.source=e.oldSource),n&&(i.target=e.oldTarget),i.waypoints=e.oldWaypoints,i};var Ig=s.forEach;function jg(e,t){this._modeling=e,this._rules=t}jg.$inject=["modeling","rules"];var zg=jg;jg.prototype.preExecute=function(e){var t,n=this,i=this._modeling,r=this._rules,o=e.oldShape,a=e.newData,s=e.hints;function c(e,t,n,i){return r.allowed(e,{source:t,target:n,connection:i})}var p,l={x:a.x,y:a.y};t=e.newShape=e.newShape||n.createShape(a,l,o.parent),o.host&&i.updateAttachment(t,o.host),!1!==s.moveChildren&&(p=o.children.slice(),i.moveElements(p,{x:0,y:0},t));var u=o.incoming.slice(),h=o.outgoing.slice();Ig(u,function(e){var i=e.waypoints,r=i[i.length-1];c("connection.reconnectEnd",e.source,t,e)&&n.reconnectEnd(e,t,r)}),Ig(h,function(e){var i=e.waypoints[0],r=e.target;c("connection.reconnectStart",t,r,e)&&n.reconnectStart(e,t,i)})},jg.prototype.postExecute=function(e){var t=this._modeling,n=e.oldShape,i=e.newShape;Ig(i.incoming,function(e){t.layoutConnection(e,{endChanged:!0})}),Ig(i.outgoing,function(e){t.layoutConnection(e,{startChanged:!0})}),t.removeShape(n)},jg.prototype.execute=function(e){},jg.prototype.revert=function(e){},jg.prototype.createShape=function(e,t,n){return this._modeling.createShape(e,t,n)},jg.prototype.reconnectStart=function(e,t,n){this._modeling.reconnectStart(e,t,n)},jg.prototype.reconnectEnd=function(e,t,n){this._modeling.reconnectEnd(e,t,n)};var Fg=s.assign,$g=s.forEach,Gg=sg.getResizedSourceAnchor,Wg=sg.getResizedTargetAnchor;function Hg(e){this._modeling=e}Hg.$inject=["modeling"];var Vg=Hg;Hg.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},Fg(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Hg.prototype.postExecute=function(e){var t=e.shape,n=e.oldBounds,i=this._modeling;$g(t.incoming,function(e){i.layoutConnection(e,{connectionEnd:Wg(e,t,n)})}),$g(t.outgoing,function(e){i.layoutConnection(e,{connectionStart:Gg(e,t,n)})})},Hg.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return Fg(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};var qg=s.forEach;function Ug(e){this._modeling=e}Ug.$inject=["modeling"];var Yg=Ug;function Kg(e){this._modeling=e}Ug.prototype.preExecute=function(e){var t=this._modeling,n=e.resizingShapes,i=e.delta,r=e.direction;qg(n,function(e){var n=qd.resizeBounds(e,r,i);t.resizeShape(e,n)})},Ug.prototype.postExecute=function(e){var t=this._modeling,n=e.movingShapes,i=e.delta;t.moveElements(n,i,void 0,{autoResize:!1,attach:!1})},Ug.prototype.execute=function(e){},Ug.prototype.revert=function(e){},Kg.$inject=["modeling"];var Xg=Kg;function Zg(e){this._modeling=e}Kg.prototype.execute=function(e){var t,n=e.shape,i=n.children;return e.oldChildrenVisibility=(t={},i.forEach(function(e){t[e.id]=e.hidden}),t),n.collapsed=!n.collapsed,function(e,t){e.forEach(function(e){e.hidden=t})}(i,n.collapsed),[n].concat(i)},Kg.prototype.revert=function(e){var t,n=e.shape,i=e.oldChildrenVisibility,r=n.children;return t=i,r.forEach(function(e){e.hidden=t[e.id]}),n.collapsed=!n.collapsed,[n].concat(r)};var Qg=Zg;function Jg(e,t){return si.remove(e&&e.attachers,t)}function eb(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),si.add(i,t,n)}}function tb(){}Zg.$inject=["modeling"],Zg.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Jg(i,t),eb(n,t),t.host=n,t},Zg.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Jg(n,t),eb(i,t,r),t};var nb=tb;tb.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},tb.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};var ib=s.forEach;function rb(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}rb.$inject=["eventBus","elementFactory","commandStack"];var ob=rb;rb.prototype.getHandlers=function(){return{"shape.append":Cv,"shape.create":Bv,"shape.delete":Vv,"shape.move":Cg,"shape.resize":Vg,"shape.replace":zg,"shape.toggleCollapse":Xg,spaceTool:Yg,"label.create":Dv,"connection.create":Rv,"connection.delete":jv,"connection.move":ng,"connection.layout":Jv,"connection.updateWaypoints":nb,"connection.reconnectStart":Lg,"connection.reconnectEnd":Lg,"elements.move":bg,"elements.delete":$v,"elements.distribute":Kv,"elements.align":Ev,"element.updateAttachment":Qg,"elements.paste":Ng}},rb.prototype.registerHandlers=function(e){ib(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},rb.prototype.moveShape=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},rb.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},rb.prototype.moveElements=function(e,t,n,i){var r,o=(i=i||{}).attach,a=n;!0===o?(r=n,a=n.parent):!1===o&&(r=null);var s={shapes:e,delta:t,newParent:a,newHost:r,hints:i};this._commandStack.execute("elements.move",s)},rb.prototype.moveConnection=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},rb.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},rb.prototype.createConnection=function(e,t,n,i,r,o){"object"==typeof n&&(o=r,r=i,i=n,n=void 0);var a={source:e,target:t,parent:r,parentIndex:n,connection:i=this._create("connection",i),hints:o};return this._commandStack.execute("connection.create",a),a.connection},rb.prototype.createShape=function(e,t,n,i,r){"number"!=typeof i&&(r=i,i=void 0);var o,a,s=(r=r||{}).attach;e=this._create("shape",e),s?(o=n.parent,a=n):o=n;var c={position:t,shape:e,parent:o,parentIndex:i,host:a,hints:r};return this._commandStack.execute("shape.create",c),c.shape},rb.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},rb.prototype.appendShape=function(e,t,n,i,r){r=r||{};var o={source:e,position:n,target:i,shape:t=this._create("shape",t),connection:r.connection,connectionParent:r.connectionParent,attach:r.attach};return this._commandStack.execute("shape.append",o),o.shape},rb.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},rb.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},rb.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},rb.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},rb.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},rb.prototype.pasteElements=function(e,t,n){var i={tree:e,topParent:t,position:n};this._commandStack.execute("elements.paste",i)},rb.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},rb.prototype.resizeShape=function(e,t,n){var i={shape:e,newBounds:t,minBounds:n};this._commandStack.execute("shape.resize",i)},rb.prototype.createSpace=function(e,t,n,i){var r={movingShapes:e,resizingShapes:t,delta:n,direction:i};this._commandStack.execute("spaceTool",r)},rb.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},rb.prototype.reconnectStart=function(e,t,n){var i={connection:e,newSource:t,dockingOrPoints:n};this._commandStack.execute("connection.reconnectStart",i)},rb.prototype.reconnectEnd=function(e,t,n){var i={connection:e,newTarget:t,dockingOrPoints:n};this._commandStack.execute("connection.reconnectEnd",i)},rb.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},rb.prototype._create=function(e,t){return t instanceof Ii.Base?t:this._elementFactory.create(e,t)},rb.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function ab(e,t,n,i){ob.call(this,e,t,n),this._bpmnRules=i}U(ab,ob),ab.$inject=["eventBus","elementFactory","commandStack","bpmnRules"];var sb=ab;ab.prototype.getHandlers=function(){var e=ob.prototype.getHandlers.call(this);return e["element.updateProperties"]=mv,e["canvas.updateRoot"]=Qy,e["lane.add"]=ky,e["lane.resize"]=$y,e["lane.split"]=Xy,e["lane.updateRefs"]=rv,e["id.updateClaim"]=Ny,e["element.setColor"]=qy,e["element.updateLabel"]=Sy,e},ab.prototype.updateLabel=function(e,t,n){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n})},ab.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,i)},ab.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},ab.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},ab.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},ab.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},ab.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},ab.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},ab.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},ab.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},ab.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},ab.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};var cb=Cs.getOrientation,pb=Cs.getMid,lb=Cs.asTRBL,ub=_a.substract,hb=Be.hasExternalLabel;function db(e,t){function n(e){if(hb(e)){var n=function(e){var t=pb(e.label),n=pb(e),i=yb(n,t);if(r=i,-1===fb.indexOf(r))return;var r;var o=[].concat(e.incoming.map(function(e){return e.waypoints[e.waypoints.length-2]}),e.outgoing.map(function(e){return e.waypoints[1]})).map(function(e){return yb(n,e)}),a=fb.filter(function(e){return-1===o.indexOf(e)});if(-1!==a.indexOf(i))return;return a[0]}(e);n&&function(e,n){var r,o=pb(e),a=e.label,s=pb(a),c=lb(e);switch(n){case"top":r={x:o.x,y:c.top-i-a.height/2};break;case"left":r={x:c.left-i-a.width/2,y:o.y};break;case"bottom":r={x:o.x,y:c.bottom+i+a.height/2};break;case"right":r={x:c.right+i+a.width/2,y:o.y}}var p=ub(r,s);t.moveShape(a,p)}(e,n)}}fc.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.reconnectEnd","connection.reconnectStart","connection.updateWaypoints"],function(e){var t=e.context.connection,i=t.source,r=t.target;n(i),n(r)});var i=10}U(db,fc),db.$inject=["eventBus","modeling"];var mb=db;var fb=["top","bottom","left","right"];function yb(e,t){return cb(t,e,5)}var vb=d.is;function gb(e,t,n){fc.call(this,e),this.preExecute("shape.append",function(e){var t=e.source,n=e.shape;e.position||(vb(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})},!0)}gb.$inject=["eventBus","elementFactory","bpmnRules"],U(gb,fc);var bb=gb,xb=s.forEach,Eb=d.is;function _b(e,t,n){fc.call(this,e),this.preExecute("elements.paste",1500,function(e){var t=e.topParent;if(t.parent||(e.topParent=n.getRootElement()),Eb(t,"bpmn:Lane"))do{t=e.topParent=t.parent}while(Eb(t,"bpmn:Lane")||!Eb(t,"bpmn:Participant"))},!0),this.postExecute("elements.paste",function(e){var n=e.tree.createdElements;xb(n,function(e){var i,r=e.element,o=r.businessObject,a=e.descriptor;(Eb(o,"bpmn:ExclusiveGateway")||Eb(o,"bpmn:InclusiveGateway")||Eb(o,"bpmn:Activity"))&&a.default&&(i=(i=n[a.default])?i.element:void 0,delete r.default,t.updateProperties(r,{default:i}))})},!0)}_b.$inject=["eventBus","modeling","canvas"],U(_b,fc);var wb=_b,Sb=d.is;function Tb(e,t,n,i){fc.call(this,e),this.preExecute("shape.create",function(e){var t,r=e.shape,o=e.host,a={cancelActivity:!0};o&&Sb(r,"bpmn:IntermediateThrowEvent")&&(a.attachedToRef=o.businessObject,t={type:"bpmn:BoundaryEvent",businessObject:i.create("bpmn:BoundaryEvent",a)},e.shape=n.createShape(t))},!0)}Tb.$inject=["eventBus","modeling","elementFactory","bpmnFactory"],U(Tb,fc);var Cb=Tb,Ab=d.is;function Rb(e,t,n){fc.call(this,e),this.preExecute("shape.create",function(e){var n=e.context.shape;if(Ab(n,"bpmn:DataObjectReference")&&"label"!==n.type){var i=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=i}})}Rb.$inject=["eventBus","bpmnFactory","moddle"],U(Rb,fc);var Pb=Rb,Mb=d.is;function kb(e,t,n,i,r){fc.call(this,e),this.preExecute("shape.create",function(e){var n=e.parent,i=e.shape,o=e.position,a=r.getRootElement();if(Mb(n,"bpmn:Process")&&Mb(i,"bpmn:Participant")&&!Mb(a,"bpmn:Collaboration")){var s=t.makeCollaboration();e.position=o,e.parent=s,e.processRoot=n}},!0),this.execute("shape.create",function(e){var t=e.processRoot,n=e.shape;t&&(e.oldProcessRef=n.businessObject.processRef,n.businessObject.processRef=t.businessObject)},!0),this.revert("shape.create",function(e){var t=e.processRoot,n=e.shape;t&&(n.businessObject.processRef=e.oldProcessRef)},!0),this.postExecute("shape.create",function(e){var n=e.processRoot,i=e.shape;if(n){var r=n.children.slice();t.moveElements(r,{x:0,y:0},i)}},!0)}kb.$inject=["eventBus","modeling","elementFactory","bpmnFactory","canvas"],U(kb,fc);var Bb=kb,Nb=s.find,Db=d.is,Ob="__targetRef_placeholder";function Lb(e,t){function n(e,n){var i=e.get("properties"),r=Nb(i,function(e){return e.name===Ob});return!r&&n&&(r=t.create("bpmn:Property",{name:Ob}),si.add(i,r)),r}function i(e,t){var i=n(e);i&&(function(e,t,n){var i=e.get("dataInputAssociations");return Nb(i,function(e){return e!==n&&e.targetRef===t})}(e,i,t)||si.remove(e.get("properties"),i))}function r(e){var t,r=e.context,o=r.connection,a=o.businessObject,s=o.target,c=s&&s.businessObject,p=r.newTarget,l=p&&p.businessObject,u=r.oldTarget||r.target,h=u&&u.businessObject,d=o.businessObject;h&&h!==c&&i(h,a),l&&l!==c&&i(l,a),c?(t=n(c,!0),d.targetRef=t):d.targetRef=null}fc.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],jb(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],jb(r))}Lb.$inject=["eventBus","bpmnFactory"],U(Lb,fc);var Ib=Lb;function jb(e){return function(t){var n=t.context.connection;if(Db(n,"bpmn:DataInputAssociation"))return e(t)}}var zb=d.is,Fb=Zc.getChildLanes,$b=ci.eachElement,Gb=500;function Wb(e,t,n){fc.call(this,e),this.postExecuted("shape.delete",Gb,function(e){var t=e.context,i=t.hints,r=t.shape,o=t.oldParent;zb(r,"bpmn:Lane")&&(i&&i.nested||function(e,t){var i,r,o,a=Fb(t),s=[],c=[];$b(a,function(t){return t.y>e.y?c.push(t):s.push(t),t.children}),a.length&&(i=c.length&&s.length?e.height/2:e.height,s.length&&(r=n.calculateAdjustments(s,"y",i,e.y-10),n.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:i},"s")),c.length&&(o=n.calculateAdjustments(c,"y",-i,e.y+e.height+10),n.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-i},"n")))}(r,o))})}Wb.$inject=["eventBus","modeling","spaceTool"],U(Wb,fc);var Hb=Wb,Vb={},qb=Va.pointDistance,Ub=Math.round,Yb=Math.max;var Kb=10;Vb.getApproxIntersection=function(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(qb(i,t)<=Kb)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,r,o,a=Ts((r=Kb,[["M",(i=t).x,i.y],["m",0,-r],["a",r,r,0,1,1,0,2*r],["a",r,r,0,1,1,0,-2*r],["z"]]),(n=[],e.forEach(function(e,t){n.push([0===t?"M":"L",e.x,e.y])}),n)),s=a[0],c=a[a.length-1];return s?s!==c?s.segment2!==c.segment2?{point:e[o=Yb(s.segment2,c.segment2)-1],bendpoint:!0,index:o}:{point:{x:Ub(s.x+c.x)/2,y:Ub(s.y+c.y)/2},index:s.segment2}:{point:{x:Ub(s.x),y:Ub(s.y)},index:s.segment2}:null}(e,t)};var Xb=s.assign,Zb=s.find,Qb=Vb.getApproxIntersection;function Jb(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function ex(e){return Xb({},e)}function tx(e,t,n){function i(e,i,r){var o,a,s,c,p,l,u=i.waypoints,h=Qb(u,r);if(h){if(o=u.slice(0,h.index),a=u.slice(h.index+(h.bendpoint?1:0)),!o.length||!a.length)return;s=h.bendpoint?u[h.index]:r,Jb(e,o[o.length-1])||o.push(ex(s)),Jb(e,a[0])||a.unshift(ex(s))}c=i.source,p=i.target,t.canConnect(c,e,i)&&(n.reconnectEnd(i,e,o||r),l=!0),t.canConnect(e,p,i)&&(l?n.connect(e,p,{type:i.type,waypoints:a}):n.reconnectStart(i,e,a||r))}fc.call(this,e),this.preExecute("elements.move",function(e){var n=e.newParent,i=e.shapes,r=e.delta,o=i[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var a,s=(a=o,{x:Math.round(a.x+a.width/2),y:Math.round(a.y+a.height/2)}),c={x:s.x+r.x,y:s.y+r.y},p=Zb(n.children,function(e){return t.canInsert(i,e)&&Qb(e.waypoints,c)});p&&(e.targetFlow=p,e.position=c)}},!0),this.postExecuted("elements.move",function(e){var t=e.shapes,n=e.targetFlow,r=e.position;n&&i(t[0],n,r)},!0),this.preExecute("shape.create",function(e){var n=e.parent,i=e.shape;t.canInsert(i,n)&&(e.targetFlow=n,e.parent=n.parent)},!0),this.postExecuted("shape.create",function(e){var t=e.shape,n=e.targetFlow,r=e.position;n&&i(t,n,r)},!0)}U(tx,fc),tx.$inject=["eventBus","bpmnRules","modeling"];var nx=tx,ix=function(e,t,n,i){var r,o,a,s;return 0==(r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,a=e.x-n.x,s=((i.x-n.x)*o-(i.y-n.y)*a)/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})},rx=Cs.getMid;function ox(e){function t(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},a=ix(e,t,n,r),s=ix(e,t,n,o);i=a&&s?sx(a,n)>sx(s,n)?s:a:a||s,e.original=i}e.on("bpmnElement.added",function(e){var n,i,r=e.element;r.waypoints&&(t((i=(n=r).waypoints)[0],i[1],rx(n.source)),t(i[i.length-1],i[i.length-2],rx(n.target)))})}ox.$inject=["eventBus"];var ax=ox;function sx(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}var cx={};function px(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}cx.getAngle=function(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))},cx.rotateVector=function(e,t){return t?{x:Math.cos(t)*e.x-Math.sin(t)*e.y,y:Math.sin(t)*e.x+Math.cos(t)*e.y}:e},cx.getDistancePointPoint=function(e,t){return px({x:e.x-t.x,y:e.y-t.y})};var lx={},ux=Math.sqrt,hx=Math.min,dx=Math.max,mx=Math.abs;function fx(e){return Math.pow(e,2)}function yx(e,t){return ux(fx(e.x-t.x)+fx(e.y-t.y))}function vx(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,p=(r*a+o*s)/c,l=p*p-(a*a+s*s-i*i)/c;if(l<0&&l>-1e-6&&(l=0),l<0)return[];var u=ux(l),h=-p+u,d=-p-u,m={x:e.x-r*h,y:e.y-o*h};return 0===l?[m]:[m,{x:e.x-r*d,y:e.y-o*d}].filter(function(n){return function(e,t,n){return gx(e.x,t.x,n.x)&&gx(e.y,t.y,n.y)}(n,e,t)})}function gx(e,t,n){return e>=hx(t,n)-bx&&e<=dx(t,n)+bx}lx.getAttachment=function(e,t){var n,i,r,o,a,s,c,p,l,u,h,d,m=0;for(m=0;m<t.length-1;m++){if(xx(n=t[m],i=t[m+1])?s=[n]:(r=yx(e,n),o=yx(e,i),s=vx(n,i,e,hx(r,o))),s.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===s.length&&(c={type:"bendpoint",position:s[0],segmentIndex:m,bendpointIndex:xx(n,s[0])?m:m+1}),2===s.length&&(h=s[0],d=s[1],c={type:"segment",position:a={x:(h.x+d.x)/2,y:(h.y+d.y)/2},segmentIndex:m,relativeLocation:yx(n,a)/yx(n,i)}),p=yx(c.position,e),(!u||l>p)&&(u=c,l=p)}return u};var bx=.1;function xx(e,t){return mx(e.x-t.x)<=bx&&mx(e.y-t.y)<=bx}var Ex={},_x=cx.getDistancePointPoint,wx=cx.rotateVector,Sx=cx.getAngle,Tx=lx.getAttachment,Cx=Cs.roundPoint;function Ax(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c,p=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex;if(0===o)return r;if(r>=l&&(c=p?r+1:r-1),r<l)if(c=r,p&&"bendpoint"!==n.type&&l-1===r)Rx(t,l)<n.relativeLocation&&c++;return c}return 0===o?r:i.connectionStart?0===r?0:null:i.connectionEnd&&r===e.length-2?t.length-2:null}function Rx(e,t){var n=_x(e[t-1],e[t]);return n/(n+_x(e[t],e[t+1]))}function Px(e,t){return[e[t],e[t+1]]}Ex.getLabelAdjustment=function(e,t,n,i){var r=0,o=0,a=function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}(e),s=Tx(a,n),c=s.segmentIndex,p=Ax(n,t,s,i);if(null===p)return{x:r,y:o};if(p<0||p>t.length-2)return{x:r,y:o};var l,u,h,d,m,f,y=Px(n,c),v=Px(t,p),g=s.position,b=(d=g,m=_x((h=y)[0],h[1]),f=_x(h[0],d),0===m?0:f/m),x=(l=v,u=Sx(y),Sx(l)-u);if("bendpoint"===s.type){var E=t.length-n.length,_=s.bendpointIndex,w=n[_];if(-1!==t.indexOf(w))return{x:r,y:o};if(0===E){var S=t[_];return{x:S.x-s.position.x,y:S.y-s.position.y}}E<0&&0!==_&&_<n.length-1&&(b=Rx(n,_))}var T=(v[1].x-v[0].x)*b+v[0].x,C=(v[1].y-v[0].y)*b+v[0].y,A=wx({x:a.x-g.x,y:a.y-g.y},x);return r=T+A.x-a.x,o=C+A.y-a.y,Cx({x:r,y:o})};var Mx=s.assign,kx=d.is,Bx=d.getBusinessObject,Nx=Be.hasExternalLabel,Dx=Be.getExternalLabelMid,Ox=Ex.getLabelAdjustment,Lx={width:90,height:20};function Ix(e,t,n){fc.call(this,e);var i=new G;this.postExecute(["shape.create","connection.create"],function(e){var n=e.context,r=n.shape||n.connection,o=r.businessObject;if(Nx(r)){var a=Dx(r),s=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:zx});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(Lx,o.name||"",i);t.createLabel(r,a,{id:o.id+"_label",hidden:!o.name,businessObject:o,width:s.width,height:s.height})}}),this.executed(["label.create"],function(e){var t,i=e.context.shape;i.labelTarget&&kx(i.labelTarget||i,"bpmn:BaseElement")&&((t=i.businessObject.di).label||(t.label=n.create("bpmndi:BPMNLabel",{bounds:n.create("dc:Bounds")})),Mx(t.label.bounds,{x:i.x,y:i.y,width:i.width,height:i.height}))}),this.postExecute(["connection.layout","connection.reconnectEnd","connection.reconnectStart","connection.updateWaypoints"],function(e){var n,i=e.context.connection.label;i&&(n=i.hidden?function(e){var t=e.context.connection,n=t.label,i=Dx(t);return{x:i.x-n.x-n.width/2,y:i.y-n.y-n.height/2}}(e):function(e){var t=e.command,n=e.context,i=n.connection,r=i.label,o=Mx({},n.hints),a=n.newWaypoints||i.waypoints,s=n.oldWaypoints;return void 0===o.startChanged&&(o.startChanged="connection.reconnectStart"===t),void 0===o.endChanged&&(o.endChanged="connection.reconnectEnd"===t),Ox(r,a,s,o)}(e),t.moveShape(i,n))}),this.postExecute(["shape.replace"],function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=Bx(n);r&&Nx(r)&&(n.label.x=i.label.x,n.label.y=i.label.y)})}U(Ix,fc),Ix.$inject=["eventBus","modeling","bpmnFactory"];var jx=Ix,zx={fontFamily:"Arial, sans-serif",fontSize:"11px"};var Fx=d.is,$x="flow elements must be children of pools/participants",Gx="participants cannot be pasted onto a non-empty process diagram";function Wx(e,t,n){function i(e,n,i){t.add({position:{x:e.x+5,y:e.y+5},type:"error",timeout:i||2e3,html:"<div>"+n+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(e){var t=e.context,r=t.shape,o=t.target;Fx(o,"bpmn:Collaboration")&&Fx(r,"bpmn:FlowNode")&&i(e,n($x))}),e.on(["elements.paste.rejected"],function(e){var t=e.context,r=t.position,o=t.target;Fx(o,"bpmn:Collaboration")&&i(r,n($x)),Fx(o,"bpmn:Process")&&i(r,n(Gx),3e3)})}Wx.$inject=["eventBus","tooltips","translate"];var Hx=Wx;function Vx(e,t,n){fc.call(this,e),this.preExecute("shape.delete",function(e){var i,r,o,a=e.context.shape;if(1==a.incoming.length&&1==a.outgoing.length){var s=a.incoming[0],c=a.outgoing[0];if(t.canConnect(s.source,c.target,s)){var p=(i=s.waypoints,r=c.waypoints,(o=ix(Ux(i[i.length-2]),Ux(i[i.length-1]),Ux(r[1]),Ux(r[0])))?[].concat(i.slice(0,i.length-1),[o],r.slice(1)):[Ux(i[0]),Ux(r[r.length-1])]);n.reconnectEnd(s,c.target,p)}}})}U(Vx,fc),Vx.$inject=["eventBus","bpmnRules","modeling"];var qx=Vx;function Ux(e){return e.original||e}var Yx=d.is;function Kx(e,t){fc.call(this,e),this.preExecute("shape.delete",function(e){var t=e.shape,n=t.parent;Yx(t,"bpmn:Participant")&&(e.collaborationRoot=n)},!0),this.postExecute("shape.delete",function(e){var n=e.collaborationRoot;n&&!n.businessObject.participants.length&&t.makeProcess()},!0)}Kx.$inject=["eventBus","modeling"],U(Kx,fc);var Xx=Kx,Zx=s.forEach,Qx=s.find,Jx=s.matchPattern,eE=d.is;function tE(e,t,n){function i(e){var i,r,o=e.source,a=e.target;e.parent&&(eE(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,a)||(r=!0),n.canConnectMessageFlow(o,a)&&(i="bpmn:MessageFlow")),eE(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,a)||(r=!0),n.canConnectSequenceFlow(o,a)&&(i="bpmn:SequenceFlow")),eE(e,"bpmn:Association")&&!n.canConnectAssociation(o,a)&&(r=!0),r&&t.removeConnection(e),i&&t.connect(o,a,{type:i,waypoints:e.waypoints.slice()}))}fc.call(this,e),this.postExecuted("elements.move",function(e){var t=e.closure.allConnections;Zx(t,i)},!0),this.postExecuted(["connection.reconnectStart","connection.reconnectEnd"],function(e){i(e.context.connection)}),this.postExecuted("element.updateProperties",function(e){var n,i=e.context,r=i.properties,o=i.element,a=o.businessObject;r.default&&(n=Qx(o.outgoing,Jx({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),r.conditionExpression&&a.sourceRef.default===a&&t.updateProperties(o.source,{default:void 0})})}U(tE,fc),tE.$inject=["eventBus","modeling","bpmnRules"];var nE=tE,iE=s.forEach,rE=f.isEventSubProcess,oE=d.is;function aE(e,t,n,i,r,o){fc.call(this,e),this._bpmnReplace=t,this._elementRegistry=i,this._selection=r,this._modeling=o,this.postExecuted(["elements.move"],500,function(e){var t=e.context,i=t.newParent,r=t.newHost,o=[];iE(t.closure.topLevel,function(e){o=rE(e)?o.concat(e.children):o.concat(e)}),1===o.length&&r&&(i=r);var a=n.canReplace(o,i);a&&this.replaceElements(o,a.replacements,r)},this),this.postExecute(["shape.replace"],1500,function(e){var t,i=e.context,r=i.oldShape,o=i.newShape,a=r.attachers;a&&a.length&&(t=n.canReplace(a,o),this.replaceElements(a,t.replacements))},this),this.postExecuted(["shape.replace"],1500,function(e){var t=e.context,n=t.oldShape,i=t.newShape;o.unclaimId(n.businessObject.id,n.businessObject),o.updateProperties(i,{id:n.id})})}U(aE,fc),aE.prototype.replaceElements=function(e,t,n){var i=this._elementRegistry,r=this._bpmnReplace,o=this._selection,a=this._modeling;iE(t,function(t){var o={type:t.newElementType},s=i.get(t.oldElementId);n&&oE(s,"bpmn:BoundaryEvent")&&a.updateAttachment(s,null);var c=e.indexOf(s);e[c]=r.replaceElement(s,o,{select:!1}),n&&oE(e[c],"bpmn:BoundaryEvent")&&a.updateAttachment(e[c],n)}),t&&o.select(e)},aE.$inject=["eventBus","bpmnReplace","bpmnRules","elementRegistry","selection","modeling"];var sE=aE,cE=d.is,pE=Cs.roundBounds,lE=bo.hasPrimaryModifier,uE=1001;function hE(e,t){e.on("resize.start",uE+500,function(e){var t=e.context,n=t.shape;(cE(n,"bpmn:Lane")||cE(n,"bpmn:Participant"))&&(t.balanced=!lE(e))}),e.on("resize.end",uE,function(e){var n=e.context,i=n.shape,r=n.canExecute,o=n.newBounds;if(cE(i,"bpmn:Lane")||cE(i,"bpmn:Participant"))return r&&(o=pE(o),t.resizeLane(i,o,n.balanced)),!1})}hE.$inject=["eventBus","modeling"];var dE=hE,mE=d.getBusinessObject,fE=d.is,yE=jc.computeChildrenBBox,vE=500;function gE(e,t,n,i){fc.call(this,e),this.executed(["shape.toggleCollapse"],vE,function(e){var t,n=e.context.shape;fE(n,"bpmn:SubProcess")&&(n.collapsed?mE(n).di.isExpanded=!1:((t=n.children).length&&t.forEach(function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)}),mE(n).di.isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],vE,function(e){var t=e.context.shape;t.collapsed?mE(t).di.isExpanded=!1:mE(t).di.isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],vE,function(e){var i,r=e.context.shape,o=t._getDefaultSize(r);i=r.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(r,o):function(e,t){var n,i,r,o=e.children,a=t;return n=(r=o,r.filter(function(e){return!e.hidden})).concat([e]),(i=yE(n))?(a.width=Math.max(i.width,a.width),a.height=Math.max(i.height,a.height),a.x=i.x+(i.width-a.width)/2,a.y=i.y+(i.height-a.height)/2):(a.x=e.x+(e.width-a.width)/2,a.y=e.y+(e.height-a.height)/2),a}(r,o),n.resizeShape(r,i)})}U(gE,fc),gE.$inject=["eventBus","elementFactory","modeling"];var bE=gE;var xE=s.forEach;function EE(e,t){fc.call(this,e),this.preExecute("elements.delete",function(e){var n=e.context.elements;xE(n,function(e){t.unclaimId(e.businessObject.id,e.businessObject)})})}U(EE,fc),EE.$inject=["eventBus","modeling"];var _E=EE,wE=d.is,SE=d.getBusinessObject;function TE(e,t){fc.call(this,e),this.preExecute("connection.delete",function(e){var n=e.context.connection,i=n.source;(function(e,t){if(!wE(e,"bpmn:SequenceFlow"))return!1;var n=SE(t),i=SE(e);return n.get("default")===i})(n,i)&&t.updateProperties(i,{default:null})})}U(TE,fc),TE.$inject=["eventBus","modeling"];var CE=TE;var AE=d.is,RE=500,PE=5e3;function ME(e,t,n){var i;function r(){if(!i)throw new Error(n("out of bounds release"));return i}fc.call(this,e);var o=["spaceTool","lane.add","lane.resize","lane.split","elements.move","elements.delete","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(o,PE,function(e){(i=i||new function(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}).enter()}),this.postExecuted(o,RE,function(e){!function(){if(!i)throw new Error(n("out of bounds release"));var e=i.leave();e&&(t.updateLaneRefs(i.flowNodes,i.lanes),i=null)}()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(e){var t=e.context.shape,n=r();t.labelTarget||(AE(t,"bpmn:Lane")&&n.addLane(t),AE(t,"bpmn:FlowNode")&&n.addFlowNode(t))})}ME.$inject=["eventBus","modeling","translate"],U(ME,fc);var kE={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","copyPasteBehavior","createBoundaryEventBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","deleteLaneBehavior","dropOnFlowBehavior","importDockingFix","labelBehavior","modelingFeedback","removeElementBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeLaneBehavior","toggleElementCollapseBehaviour","unclaimIdBehavior","unsetDefaultFlowBehavior","updateFlowNodeRefsBehavior"],adaptiveLabelPositioningBehavior:["type",mb],appendBehavior:["type",bb],copyPasteBehavior:["type",wb],createBoundaryEventBehavior:["type",Cb],createDataObjectBehavior:["type",Pb],createParticipantBehavior:["type",Bb],dataInputAssociationBehavior:["type",Ib],deleteLaneBehavior:["type",Hb],dropOnFlowBehavior:["type",nx],importDockingFix:["type",ax],labelBehavior:["type",jx],modelingFeedback:["type",Hx],replaceConnectionBehavior:["type",nE],removeParticipantBehavior:["type",Xx],replaceElementBehaviour:["type",sE],resizeLaneBehavior:["type",dE],removeElementBehavior:["type",qx],toggleElementCollapseBehaviour:["type",bE],unclaimIdBehavior:["type",_E],updateFlowNodeRefsBehavior:["type",ME],unsetDefaultFlowBehavior:["type",CE]};function BE(e){fc.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(e){var n=e.context,i=n.shape||n.connection,r=n.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)}),this.preExecute(["shape.move","connection.move"],function(e){var n=e.context,i=n.shape||n.connection,r=n.newParent||i.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)})}BE.prototype.getOrdering=function(e,t){return null},U(BE,fc);var NE=BE,DE=Xs.isAny,OE=s.findIndex,LE=s.find;function IE(e,t){NE.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:3,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:Process"]}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(e){var t=e.order;return t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=LE(n,function(t){return DE(e,[t.type])});return t&&t.order||{level:1}}(e)),t}this.getOrdering=function(e,n){var r=i(e);r.containers&&(n=function(e,n,i){for(var r=n;r&&!DE(r,i);)r=r.parent;if(!r)throw new Error(t("no parent for {element} in {parent}",{element:e.id,parent:n.id}));return r}(e,n,r.containers));var o=n.children.indexOf(e),a=OE(n.children,function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level});return-1!==a&&-1!==o&&o<a&&(a-=1),{index:a,parent:n}}}IE.$inject=["eventBus","translate"],U(IE,NE);var jE={__init__:["bpmnOrderingProvider"],__depends__:[Qe],bpmnOrderingProvider:["type",IE]},zE={},FE=Cs.getOrientation;zE.getBoundaryAttachment=function(e,t){var n=FE(e,t,-15);return"intersect"!==n?n:null};var $E=d.is,GE=Cs.asTRBL,WE=Zc.collectLanes,HE=Zc.getLanesRoot,VE=Math.abs,qE=Math.min,UE=Math.max;function YE(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function KE(e,t,n){return YE(e,t,n,qE)}function XE(e,t,n){return YE(e,t,n,UE)}var ZE=60,QE=300,JE=20,e_=50,t_=20,n_=20;zE.getParticipantSizeConstraints=function(e,t,n){var i=HE(e),r=!0,o=!0,a=WE(i,[i]),s=GE(e),c={},p={};return/e/.test(t)?p.right=s.left+QE:/w/.test(t)&&(p.left=s.right-QE),a.forEach(function(e){var i=GE(e);/n/.test(t)&&(i.top<s.top-10&&(r=!1),n&&VE(s.top-i.bottom)<10&&XE(c,"top",i.top+ZE),VE(s.top-i.top)<5&&KE(p,"top",i.bottom-ZE)),/s/.test(t)&&(i.bottom>s.bottom+10&&(o=!1),n&&VE(s.bottom-i.top)<10&&KE(c,"bottom",i.bottom-ZE),VE(s.bottom-i.bottom)<5&&XE(p,"bottom",i.top+ZE))}),i.children.filter(function(e){return!e.hidden&&!e.waypoints&&($E(e,"bpmn:FlowElement")||$E(e,"bpmn:Artifact"))}).forEach(function(e){var n=GE(e);r&&/n/.test(t)&&KE(p,"top",n.top-t_),/e/.test(t)&&XE(p,"right",n.right+JE),o&&/s/.test(t)&&XE(p,"bottom",n.bottom+n_),/w/.test(t)&&KE(p,"left",n.left-e_)}),{min:p,max:c}};var i_=s.find,r_=s.some,o_=s.every,a_=s.filter,s_=s.forEach,c_=d.is,p_=Xs.isAny,l_=d.getBusinessObject,u_=f.isExpanded,h_=f.isEventSubProcess,d_=f.isInterrupting,m_=f.hasErrorEventDefinition,f_=f.hasEscalationEventDefinition,y_=f.hasCompensateEventDefinition,v_=zE.getBoundaryAttachment;function g_(e){Mc.call(this,e)}U(g_,Mc),g_.$inject=["eventBus"];var b_=g_;function x_(e){return!e||P_(e)}function E_(e,t){return e===t}function __(e){do{if(c_(e,"bpmn:Process"))return l_(e);if(c_(e,"bpmn:Participant"))return l_(e).processRef}while(e=e.parent)}function w_(e){return c_(e,"bpmn:TextAnnotation")}function S_(e){return c_(e,"bpmn:BoundaryEvent")&&A_(e,"bpmn:CompensateEventDefinition")}function T_(e){return l_(e).isForCompensation}function C_(e){for(var t=e;t=t.parent;){if(c_(t,"bpmn:FlowElementsContainer"))return l_(t);if(c_(t,"bpmn:Participant"))return l_(t).processRef}return null}function A_(e,t){var n=l_(e);return!!i_(n.eventDefinitions||[],function(e){return c_(e,t)})}function R_(e,t){return(l_(e).eventDefinitions||[]).every(function(e){return c_(e,t)})}function P_(e){return e.labelTarget}function M_(e){return e.waypoints}function k_(e,t){return-1!==function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t).indexOf(e)}function B_(e,t,n){if(x_(e)||x_(t))return null;if(E_(e,t))return!1;if(!c_(n,"bpmn:DataAssociation")){if(G_(e,t))return{type:"bpmn:MessageFlow"};if(W_(e,t))return{type:"bpmn:SequenceFlow"}}var i=H_(e,t);return i||(S_(e)&&T_(t)?{type:"bpmn:Association",associationDirection:"One"}:!!$_(e,t)&&{type:"bpmn:Association"})}function N_(e,t,n){return!(!P_(e)||M_(t))||!(c_(t,"bpmn:Participant")&&!u_(t))&&(c_(e,"bpmn:Participant")?c_(t,"bpmn:Process")||c_(t,"bpmn:Collaboration"):c_(e,"bpmn:Lane")?c_(t,"bpmn:Participant")||c_(t,"bpmn:Lane"):!c_(e,"bpmn:BoundaryEvent")&&(c_(e,"bpmn:FlowElement")?c_(t,"bpmn:FlowElementsContainer")?u_(t):p_(t,["bpmn:Participant","bpmn:Lane"]):p_(e,["bpmn:Artifact","bpmn:DataAssociation"])?p_(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!c_(e,"bpmn:MessageFlow")&&(c_(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function D_(e){return!P_(e)&&c_(e,"bpmn:BoundaryEvent")}function O_(e){return c_(e,"bpmn:Lane")}function L_(e,t,n,i){if(Array.isArray(e)||(e=[e]),n)return!1;if(1!==e.length)return!1;var r=e[0];return!P_(r)&&(!!function(e){return D_(e)||c_(e,"bpmn:IntermediateThrowEvent")&&!e.parent}(r)&&(!t||!h_(t)&&(!(!c_(t,"bpmn:Activity")||T_(t))&&(!(i&&!v_(i,t))&&"attach"))))}function I_(e,t,n){if(!t)return!1;var i={replacements:[]};return s_(e,function(e){h_(t)||c_(e,"bpmn:StartEvent")&&"label"!==e.type&&N_(e,t)&&(d_(e)||i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(m_(e)||f_(e)||y_(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),c_(t,"bpmn:Transaction")||A_(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(c_(e,"bpmn:EndEvent")&&N_(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),c_(e,"bpmn:BoundaryEvent")&&L_(e,t,null,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))}),!!i.replacements.length&&i}function j_(e,t){return!r_(e,D_)&&(!r_(e,O_)&&(!t||e.every(function(e){return N_(e,t)})))}function z_(e,t,n,i){return!!t&&(P_(t)?null:!E_(n,t)&&((!n||!k_(n,t))&&(N_(e,t)||V_(e,t,i))))}function F_(e,t){return c_(e,"bpmn:SubProcess")?u_(e)&&(!t||t.width>=100&&t.height>=80):c_(e,"bpmn:Lane")?!t||t.width>=130&&t.height>=60:c_(e,"bpmn:Participant")?!t||t.width>=250&&t.height>=50:!!w_(e)}function $_(e,t){return!M_(e)&&!M_(t)&&(!(!S_(e)||!T_(t))||!k_(t,e)&&!k_(e,t)&&function(e,t){var n=w_(e),i=w_(t);return(n||i)&&n!==i}(e,t))}function G_(e,t){return c_(i=e,"bpmn:InteractionNode")&&(!c_(i,"bpmn:Event")||c_(i,"bpmn:ThrowEvent")&&R_(i,"bpmn:MessageEventDefinition"))&&function(e){return c_(e,"bpmn:InteractionNode")&&!T_(e)&&(!c_(e,"bpmn:Event")||c_(e,"bpmn:CatchEvent")&&R_(e,"bpmn:MessageEventDefinition"))}(t)&&(n=t,!(__(e)===__(n)));var n,i}function W_(e,t){return c_(o=e,"bpmn:FlowNode")&&!c_(o,"bpmn:EndEvent")&&!h_(o)&&!(c_(o,"bpmn:IntermediateThrowEvent")&&A_(o,"bpmn:LinkEventDefinition"))&&!S_(o)&&!T_(o)&&function(e){return c_(e,"bpmn:FlowNode")&&!c_(e,"bpmn:StartEvent")&&!c_(e,"bpmn:BoundaryEvent")&&!h_(e)&&!(c_(e,"bpmn:IntermediateCatchEvent")&&A_(e,"bpmn:LinkEventDefinition"))&&!T_(e)}(t)&&(n=t,i=C_(e),r=C_(n),i&&i===r)&&!(c_(e,"bpmn:EventBasedGateway")&&!function(e){return c_(e,"bpmn:ReceiveTask")||c_(e,"bpmn:IntermediateCatchEvent")&&(A_(e,"bpmn:MessageEventDefinition")||A_(e,"bpmn:TimerEventDefinition")||A_(e,"bpmn:ConditionalEventDefinition")||A_(e,"bpmn:SignalEventDefinition"))}(t));var n,i,r,o}function H_(e,t){return p_(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&p_(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!p_(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!p_(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function V_(e,t,n){if(Array.isArray(e)){if(1!==e.length)return!1;e=e[0]}return p_(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!P_(t)&&c_(e,"bpmn:FlowNode")&&!c_(e,"bpmn:BoundaryEvent")&&N_(e,t.parent)}function q_(e,t){return e&&t&&-1!==e.indexOf(t)}function U_(e,t){return!(c_(t,"bpmn:Lane")&&!q_(e,t.parent))&&!(c_(t,"bpmn:BoundaryEvent")&&!q_(e,t.host))}g_.prototype.init=function(){this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent;if(i.targetAttach)return!1;r&&(n.parent=r);try{return B_(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnectStart",function(e){var t=e.connection;return B_(e.hover||e.source,t.target,t)}),this.addRule("connection.reconnectEnd",function(e){var t=e.connection;return B_(t.source,e.hover||e.target,t)}),this.addRule("connection.updateWaypoints",function(e){return null}),this.addRule("shape.resize",function(e){return F_(e.shape,e.newBounds)}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position;return L_(n,t,null,i)||I_(n,t,i)||j_(n,t)||V_(n,t,i)}),this.addRule("shape.create",function(e){return z_(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return L_(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){return U_(e.collection,e.element)}),this.addRule("element.paste",function(e){var t=e.parent,n=e.element,i=e.position,r=e.source,o=e.target;return r||o?B_(r,o):L_([n],t,null,i)||z_(n,t,null,i)}),this.addRule("elements.paste",function(e){return function(e,t){var n=e[0];if(c_(t,"bpmn:Collaboration"))return o_(n,function(e){return"bpmn:Participant"===e.type});if(c_(t,"bpmn:Process"))return!(r_(n,function(e){return"bpmn:Participant"===e.type})&&t.children.length>0);if(c_(t,"bpmn:Participant")&&!u_(t))return!1;if(c_(t,"bpmn:FlowElementsContainer"))return u_(t);return p_(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"])}(e.tree,e.target)}),this.addRule(["elements.delete"],function(e){return a_(e.elements,function(e){return!P_(e)})})},g_.prototype.canConnectMessageFlow=G_,g_.prototype.canConnectSequenceFlow=W_,g_.prototype.canConnectDataAssociation=H_,g_.prototype.canConnectAssociation=$_,g_.prototype.canMove=j_,g_.prototype.canAttach=L_,g_.prototype.canReplace=I_,g_.prototype.canDrop=N_,g_.prototype.canInsert=V_,g_.prototype.canCreate=z_,g_.prototype.canConnect=B_,g_.prototype.canResize=F_,g_.prototype.canCopy=U_;var Y_={__depends__:[ou],__init__:["bpmnRules"],bpmnRules:["type",b_]},K_=s.uniqueBy,X_=s.isArray;function Z_(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[]},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Z_.$inject=["eventBus","injector"];var Q_=Z_;Z_.prototype.execute=function(e,t){if(!e)throw new Error("command required");var n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction(n)},Z_.prototype.canExecute=function(e,t){var n={command:e,context:t},i=this._getHandler(e),r=this._fire(e,"canExecute",n);if(void 0===r){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Z_.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed")},Z_.prototype.undo=function(){var e,t=this._getUndoAction();if(t){for(this._pushAction(t);t&&(this._internalUndo(t),(e=this._getUndoAction())&&e.id===t.id);)t=e;this._popAction()}},Z_.prototype.redo=function(){var e,t=this._getRedoAction();if(t){for(this._pushAction(t);t&&(this._internalExecute(t,!0),(e=this._getRedoAction())&&e.id===t.id);)t=e;this._popAction()}},Z_.prototype.register=function(e,t){this._setHandler(e,t)},Z_.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");var n=this._injector.instantiate(t);this.register(e,n)},Z_.prototype.canUndo=function(){return!!this._getUndoAction()},Z_.prototype.canRedo=function(){return!!this._getRedoAction()},Z_.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Z_.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Z_.prototype._internalUndo=function(e){var t=this,n=e.command,i=e.context,r=this._getHandler(n);this._atomicDo(function(){t._fire(n,"revert",e),r.revert&&t._markDirty(r.revert(i)),t._revertedAction(e),t._fire(n,"reverted",e)})},Z_.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);var i,r,o,a=t?[e+"."+t,t]:[e];for(n=this._eventBus.createEvent(n),i=0;(r=a[i])&&(o=this._eventBus.fire("commandStack."+r,n),!n.cancelBubble);i++);return o},Z_.prototype._createId=function(){return this._uid++},Z_.prototype._atomicDo=function(e){var t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Z_.prototype._internalExecute=function(e,t){var n=this,i=e.command,r=e.context,o=this._getHandler(i);if(!o)throw new Error("no command handler registered for <"+i+">");this._pushAction(e),t||(this._fire(i,"preExecute",e),o.preExecute&&o.preExecute(r),this._fire(i,"preExecuted",e)),this._atomicDo(function(){n._fire(i,"execute",e),o.execute&&n._markDirty(o.execute(r)),n._executedAction(e,t),n._fire(i,"executed",e)}),t||(this._fire(i,"postExecute",e),o.postExecute&&o.postExecute(r),this._fire(i,"postExecuted",e)),this._popAction(e)},Z_.prototype._pushAction=function(e){var t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Z_.prototype._popAction=function(){var e=this._currentExecution,t=e.actions,n=e.dirty;t.pop(),t.length||(this._eventBus.fire("elements.changed",{elements:K_("id",n)}),n.length=0,this._fire("changed"))},Z_.prototype._markDirty=function(e){var t=this._currentExecution;e&&(e=X_(e)?e:[e],t.dirty=t.dirty.concat(e))},Z_.prototype._executedAction=function(e,t){var n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Z_.prototype._revertedAction=function(e){this._stackIdx--},Z_.prototype._getHandler=function(e){return this._handlerMap[e]},Z_.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};var J_={commandStack:["type",Q_]},ew=s.flatten,tw=s.filter,nw=s.forEach,iw=s.groupBy,rw=s.map,ow=s.unionBy,aw=Gv.saveClear,sw=ig.getNewAttachShapeDelta,cw=251,pw=1401;function lw(e,t,n,i){fc.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",pw,function(e){var t,n,i=e.context,r=i.shapes,o=i.validatedShapes;i.shapes=(n=uw(t=r),ow("id",t,n)),i.validatedShapes=function(e){var t=iw(e,"id");return tw(e,function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0})}(o)}),r&&t.on("shape.move.start",cw,function(e){var t=e.context,n=uw(t.shapes);nw(n,function(e){r.makeDraggable(t,e,!0),e.label&&r.makeDraggable(t,e.label,!0)})}),this.postExecuted("elements.move",function(e){var t=e.context,n=t.delta,r=t.newParent,o=t.closure.enclosedElements,a=uw(o);nw(a,function(e){o[e.id]||(i.moveShape(e,n,r),e.label&&i.moveShape(e.label,n,r))})}),this.postExecuted("elements.move",function(e){var t,n=e.context,r=n.shapes,o=n.newHost;r.length>1||(t=o?r:tw(r,function(e){return!!e.host}),nw(t,function(e){i.updateAttachment(e,o)}))}),this.postExecuted("elements.move",function(e){var t=e.context.shapes;nw(t,function(e){nw(e.attachers,function(e){nw(e.outgoing.slice(),function(e){n.allowed("connection.reconnectStart",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)}),nw(e.incoming.slice(),function(e){n.allowed("connection.reconnectEnd",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})})})}),this.postExecute("shape.create",function(e){var t=e.context,n=t.shape,r=t.host;r&&i.updateAttachment(n,r)}),this.postExecute("shape.replace",function(e){var t=e.context,r=t.oldShape,o=t.newShape;aw(r.attachers,function(e){"attach"===n.allowed("elements.move",{target:o,shapes:[e]})?i.updateAttachment(e,o):i.removeShape(e)}),o.attachers.length&&nw(o.attachers,function(e){var t=sw(e,r,o);i.moveShape(e,t,e.parent)})}),this.postExecute("shape.resize",function(e){var t=e.context,n=t.shape,r=t.oldBounds,o=t.newBounds,a=n.attachers;a.length&&nw(a,function(e){var t=sw(e,r,o);i.moveShape(e,t,e.parent),e.label&&i.moveShape(e.label,t,e.label.parent)})}),this.preExecute("shape.delete",function(e){var t=e.context.shape;aw(t.attachers,function(e){i.removeShape(e)}),t.host&&i.updateAttachment(t,null)}),t.on("spaceTool.move",function(e){var t=e.context,n=t.initialized,i=t.attachSupportInitialized;if(n&&!i){var r=t.movingShapes,o=tw(r,function(e){var t=e.host;return t&&-1===r.indexOf(t)});nw(o,function(e){si.remove(r,e),e.label&&si.remove(r,e.label)}),t.attachSupportInitialized=!0}})}function uw(e){return ew(rw(e,function(e){return e.attachers||[]}))}U(lw,fc),lw.$inject=["injector","eventBus","rules","modeling"];var hw={__depends__:[ou],__init__:["attachSupport"],attachSupport:["type",lw]},dw=s.forEach,mw=s.filter,fw=s.map,yw=250,vw=1400,gw=Cs.getMid;function bw(e,t,n){fc.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",vw,function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=xw(n),t.validatedShapes=xw(i)}),i&&t.on("shape.move.start",yw,function(e){var t=e.context,n=t.shapes,r=[];dw(n,function(e){var n=e.label;n&&!n.hidden&&-1===t.shapes.indexOf(n)&&r.push(n),e.labelTarget&&r.push(e)}),dw(r,function(e){i.makeDraggable(t,e,!0)})}),this.postExecute("elements.move",vw,function(e){var t=e.context,n=t.closure.enclosedElements;t.enclosedLabels=fw(n,function(e){var t=e.label;return t&&!n[t.id]?[t,gw(t)]:null}).filter(function(e){return e})}),this.postExecuted("elements.move",function(e){var t=e.context,i=t.enclosedLabels,r=t.delta;dw(i,function(e){var t=e[0],i=e[1],o=gw(t);o.x===i.x&&o.y===i.y&&n.moveShape(t,r,t.labelTarget.parent)})})}function xw(e){return mw(e,function(t){return-1===e.indexOf(t.labelTarget)})}U(bw,fc),bw.$inject=["injector","eventBus","modeling"];var Ew={__init__:["labelSupport"],labelSupport:["type",bw]},_w=s.isString,ww=s.assign,Sw=s.forEach,Tw=Y.domify,Cw=Y.attr,Aw=Y.classes,Rw=Y.remove,Pw=Y.delegate,Mw=new Vr("tt");function kw(e,t){e.style.display=!1===t?"none":""}var Bw=".djs-tooltip";function Nw(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=Mw,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),i=Tw('<div class="djs-tooltip-container" style="position: absolute; width: 0; height: 0;" />'),n.insertBefore(i,n.firstChild),i);var r=this;Pw.bind(this._tooltipRoot,Bw,"mousedown",function(e){e.stopPropagation()}),Pw.bind(this._tooltipRoot,Bw,"mouseover",function(e){r.trigger("mouseover",e)}),Pw.bind(this._tooltipRoot,Bw,"mouseout",function(e){r.trigger("mouseout",e)}),this._init()}Nw.$inject=["eventBus","canvas"];var Dw=Nw;Nw.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=ww({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Nw.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Cw(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Nw.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},Nw.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Nw.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},Nw.prototype.remove=function(e){var t=this.get(e);t&&(Rw(t.html),Rw(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Nw.prototype.show=function(){kw(this._tooltipRoot)},Nw.prototype.hide=function(){kw(this._tooltipRoot,!1)},Nw.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},Nw.prototype._addTooltip=function(e){var t,n=e.id,i=e.html,r=this._tooltipRoot;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),_w(i)&&(i=Tw(i)),(t=Tw('<div data-tooltip-id="'+n+'" class="djs-tooltip" style="position: absolute">')).appendChild(i),e.type&&Aw(t).add("djs-tooltip-"+e.type),e.className&&Aw(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},Nw.prototype._updateTooltip=function(e){var t,n,i,r=e.position,o=e.htmlContainer;t=o,n=r.x,i=r.y,ww(t.style,{left:n+"px",top:i+"px"})},Nw.prototype._updateTooltipVisibilty=function(e){Sw(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),kw(i,r))})},Nw.prototype._init=function(){var e=this;this._eventBus.on("canvas.viewbox.changing",function(t){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(t){var n;n=t.viewbox,e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()})};var Ow={__init__:["tooltips"],tooltips:["type",Dw]},Lw=s.assign,Iw=Cs.getElementLineIntersection;function jw(e){return Lw({original:e.point.original||e.point},e.actual)}function zw(e,t){this._elementRegistry=e,this._graphicsFactory=t}zw.$inject=["elementRegistry","graphicsFactory"];var Fw=zw;zw.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(jw(i)),o.push(jw(r)),o},zw.prototype.getDockingPoint=function(e,t,n){var i,r,o=e.waypoints;return{point:r=o[i=n?0:o.length-1],actual:this._getIntersection(t,e,n)||r,idx:i}},zw.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Iw(i,r,n)},zw.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},zw.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},zw.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var $w={__init__:["modeling","bpmnUpdater"],__depends__:[kE,Y_,jE,al,J_,Ow,Ew,hw,ia,qm,fm],bpmnFactory:["type",Cf],bpmnUpdater:["type",ly],elementFactory:["type",vy],modeling:["type",sb],layouter:["type",ty],connectionDocking:["type",Fw]},Gw=s.assign;function Ww(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}var Hw=Ww;Ww.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Ww.prototype.getPaletteEntries=function(e){var t={},n=this._create,i=this._elementFactory,r=this._spaceTool,o=this._lassoTool,a=this._handTool,s=this._globalConnect,c=this._translate;function p(e,t,r,o,a){function s(t){var r=i.createShape(Gw({type:e},a));a&&(r.businessObject.di.isExpanded=a.isExpanded),n.start(t,r)}var p=e.replace(/^bpmn:/,"");return{group:t,className:r,title:o||c("Create {type}",{type:p}),action:{dragstart:s,click:s}}}function l(e,t){n.start(e,i.createParticipantShape(t))}return Gw(t,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:c("Activate the hand tool"),action:{click:function(e){a.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:c("Activate the lasso tool"),action:{click:function(e){o.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:c("Activate the create/remove space tool"),action:{click:function(e){r.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:c("Activate the global connect tool"),action:{click:function(e){s.toggle(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":p("bpmn:StartEvent","event","bpmn-icon-start-event-none"),"create.intermediate-event":p("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",c("Create Intermediate/Boundary Event")),"create.end-event":p("bpmn:EndEvent","event","bpmn-icon-end-event-none"),"create.exclusive-gateway":p("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",c("Create Gateway")),"create.task":p("bpmn:Task","activity","bpmn-icon-task"),"create.data-object":p("bpmn:DataObjectReference","data-object","bpmn-icon-data-object"),"create.data-store":p("bpmn:DataStoreReference","data-store","bpmn-icon-data-store"),"create.subprocess-expanded":p("bpmn:SubProcess","activity","bpmn-icon-subprocess-expanded",c("Create expanded SubProcess"),{isExpanded:!0}),"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:c("Create Pool/Participant"),action:{dragstart:l,click:l}}}),t};var Vw=s.isFunction,qw=s.isArray,Uw=s.forEach,Yw=Y.domify,Kw=Y.query,Xw=Y.attr,Zw=Y.clear,Qw=Y.classes,Jw=Y.matches,eS=Y.delegate,tS=Y.event;function nS(e,t){this._eventBus=e,this._canvas=t,this._providers=[];var n=this;e.on("tool-manager.update",function(e){var t=e.tool;n.updateToolHighlight(t)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._providers.length&&(n._init(),n._update())})}nS.$inject=["eventBus","canvas"];var iS=nS;nS.prototype.registerProvider=function(e){this._providers.push(e),this._diagramInitialized&&(this._container||this._init(),this._update())},nS.prototype.getEntries=function(){var e={};return Uw(this._providers,function(t){var n=t.getPaletteEntries();Uw(n,function(t,n){e[n]=t})}),e},nS.prototype._init=function(){var e=this._canvas,t=this._eventBus,n=e.getContainer(),i=this._container=Yw(nS.HTML_MARKUP),r=this;n.appendChild(i),eS.bind(i,".djs-palette-toggle, .entry","click",function(e){var t=e.delegateTarget;if(Jw(t,".djs-palette-toggle"))return r.toggle();r.trigger("click",e)}),tS.bind(i,"mousedown",function(e){e.stopPropagation()}),eS.bind(i,".entry","dragstart",function(e){r.trigger("dragstart",e)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},nS.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=Qw(i);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle("two-column",t),"open"in e&&o.toggle("open",e.open),r.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},nS.prototype._update=function(){var e=Kw(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Zw(e),Uw(t,function(t,n){var i=t.group||"default",r=Kw("[data-group="+i+"]",e);r||(r=Yw('<div class="group" data-group="'+i+'"></div>'),e.appendChild(r));var o,a,s,c=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),p=Yw(c);r.appendChild(p),t.separator||(Xw(p,"data-action",n),t.title&&Xw(p,"title",t.title),t.className&&(o=p,a=t.className,s=Qw(o),(qw(a)?a:a.split(/\s+/g)).forEach(function(e){s.add(e)})),t.imageUrl&&p.appendChild(Yw('<img src="'+t.imageUrl+'">')))}),this.open()},nS.prototype.trigger=function(e,t,n){var i,r,o,a=this._entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();(i=a[Xw(s,"data-action")])&&(r=i.action,o=t.originalEvent||t,Vw(r)?"click"===e&&r(o,n):r[e]&&r[e](o,n),t.preventDefault())},nS.prototype._layoutChanged=function(){this._toggleState({})},nS.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},nS.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},nS.prototype.open=function(){this._toggleState({open:!0})},nS.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},nS.prototype.isActiveTool=function(e){return e&&this._activeTool===e},nS.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Kw(".djs-palette-entries",this._container),this._toolsContainer=Kw("[data-group=tools]",t)),n=this._toolsContainer,Uw(n.children,function(t){var n=t.getAttribute("data-action");if(n){var i=Qw(t);n=n.replace("-tool",""),i.contains("entry")&&n===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}})},nS.prototype.isOpen=function(){return Qw(this._container).has("open")},nS.prototype._getParentContainer=function(){return this._canvas.getContainer()},nS.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var rS={__depends__:[{__init__:["palette"],palette:["type",iS]},ku,fm,Id,Cd,Qe,Wh],__init__:["paletteProvider"],paletteProvider:["type",Hw]},oS=s.assign,aS=s.forEach,sS=Y.query,cS=n.attr,pS=250;function lS(e,t,n,i,r){fc.call(this,e),e.on("shape.move.move",pS,function(e){var o=e.context,a=o.canExecute;o.visualReplacements||(o.visualReplacements={}),a.replacements?function(e){var o=e.canExecute.replacements;aS(o,function(o){var a=o.oldElementId,s={type:o.newElementType};if(!e.visualReplacements[a]){var c=t.get(a);oS(s,{x:c.x,y:c.y});var p=n.createShape(s);i.addShape(p,c.parent);var l=sS("[data-element-id="+c.id+"]",e.dragGroup);l&&cS(l,{display:"none"});var u=r.addDragger(p,e.dragGroup);e.visualReplacements[a]=u,i.removeShape(p)}})}(o):function(e){var t=e.visualReplacements;aS(t,function(n,i){var r=sS("[data-element-id="+i+"]",e.dragGroup);r&&cS(r,{display:"inline"}),n.remove(),t[i]&&delete t[i]})}(o)})}lS.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],U(lS,fc);var uS={__depends__:[Vd],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",lS]},hS={},dS=Math.abs,mS=Math.round;hS.snapTo=function(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i<t.length;i++)if(r=t[i],dS(r-e)<=n)return r},hS.topLeft=function(e){return{x:e.x,y:e.y}},hS.mid=function(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:mS(e.x+e.width/2),y:mS(e.y+e.height/2)}},hS.bottomRight=function(e){return{x:e.x+e.width,y:e.y+e.height}},hS.isSnapped=function(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)},hS.setSnapped=function(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r};var fS=s.forEach,yS=hS.snapTo;function vS(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}vS.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},vS.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},vS.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},vS.prototype.getSnapLocations=function(){return this._snapLocations},vS.prototype.setSnapLocations=function(e){this._snapLocations=e},vS.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new bS).initDefaults(this._defaultSnaps),n};var gS=vS;function bS(e){this._snapValues={}}bS.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),-1===n.x.indexOf(t.x)&&n.x.push(t.x),-1===n.y.indexOf(t.y)&&n.y.push(t.y)},bS.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&yS(e[n],r[n],i)},bS.prototype.initDefaults=function(e){var t=this;fS(e||{},function(e,n){fS(e,function(e){t.add(n,e)})})};var xS=s.filter,ES=s.forEach,_S=s.debounce,wS=s.bind,SS=hS.mid,TS=1250,CS=hS.isSnapped,AS=hS.setSnapped,RS=n.append,PS=n.attr,MS=n.classes,kS=n.create;function BS(e,t){this._canvas=t;var n=this;e.on(["shape.move.start","create.start"],function(e){n.initSnap(e)}),e.on(["shape.move.move","shape.move.end","create.move","create.end"],TS,function(e){e.originalEvent&&e.originalEvent.ctrlKey||CS(e)||n.snap(e)}),e.on(["shape.move.cleanup","create.cleanup"],function(e){n.hide()}),this._asyncHide=_S(wS(this.hide,this),1e3)}BS.$inject=["eventBus","canvas"];var NS=BS;BS.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.snapContext;i||(i=t.snapContext=new gS);var r=SS(n,e);return i.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),i},BS.prototype.snap=function(e){var t=e.context,n=t.snapContext,i=t.shape,r=t.target,o=n.getSnapLocations();if(r){var a=n.pointsForTarget(r);a.initialized||(this.addTargetSnaps(a,i,r),a.initialized=!0);var s={x:CS(e,"x"),y:CS(e,"y")};ES(o,function(t){var i=n.getSnapOrigin(t),r={x:e.x+i.x,y:e.y+i.y};if(ES(["x","y"],function(e){var n;s[e]||void 0!==(n=a.snap(r,t,e,7))&&(s[e]={value:n,originValue:n-i[e]})}),s.x&&s.y)return!1}),this.showSnapLine("vertical",s.x&&s.x.value),this.showSnapLine("horizontal",s.y&&s.y.value),ES(["x","y"],function(t){var n=s[t];"object"==typeof n&&AS(e,t,n.originValue)})}},BS.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=kS("path");return PS(n,{d:"M0,0 L0,0"}),MS(n).add("djs-snap-line"),RS(t,n),{update:function(t){PS(n,"number"!=typeof t?{display:"none"}:"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""})}}},BS.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},BS.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},BS.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},BS.prototype.hide=function(){ES(this._snapLines,function(e){e.update()})},BS.prototype.addTargetSnaps=function(e,t,n){var i=this.getSiblings(t,n);ES(i,function(t){e.add("mid",SS(t))})},BS.prototype.getSiblings=function(e,t){return t&&xS(t.children,function(t){return!t.hidden&&!t.labelTarget&&t.host!==e&&t!==e})};var DS=s.forEach,OS=s.assign,LS=ci.getBBox,IS=d.is,jS=Xs.isAny,zS=f.isExpanded,FS=Cs.asTRBL,$S=Math.round,GS=hS.mid,WS=hS.topLeft,HS=hS.bottomRight,VS=hS.isSnapped,qS=hS.setSnapped,US=zE.getBoundaryAttachment,YS=zE.getParticipantSizeConstraints,KS=Zc.getLanesRoot,XS=1500;function ZS(e,t,n,i){NS.call(this,e,t),e.on("create.start",function(e){var n=e.context,i=n.shape,r=t.getRootElement();IS(i,"bpmn:Participant")&&IS(r,"bpmn:Process")&&JS(n,i,r.children)}),e.on(["create.move","create.end"],XS,function(e){var t=e.context,n=t.shape,i=t.participantSnapBox;!VS(e)&&i&&function(e,t,n,i){i=i||0;var r=t.width/2-i,o=t.height/2,a={x:n.x-r-i,y:n.y-o},s={x:n.x+r+i,y:n.y+o},c=e,p=HS(e);a.x>=c.x?qS(n,"x",c.x+i+r):s.x<=p.x&&qS(n,"x",p.x-i-r);a.y>=c.y?qS(n,"y",c.y+o):s.y<=p.y&&qS(n,"y",p.y-o)}(i,n,e)}),e.on("shape.move.start",function(e){var n=e.context,i=n.shape,r=t.getRootElement();IS(i,"bpmn:Participant")&&IS(r,"bpmn:Process")&&JS(n,i,r.children)}),e.on(["create.move","create.end","shape.move.move","shape.move.end"],XS,function(e){var t=e.context,i=t.target,r=t.shape;i&&!VS(e)&&function(e,t,i){return"attach"===n.canAttach([e],t,null,i)}(r,i,e)&&function(e,t,n){var i=FS(n),r=US(e,n);/top/.test(r)?qS(e,"y",i.top):/bottom/.test(r)&&qS(e,"y",i.bottom);/left/.test(r)?qS(e,"x",i.left):/right/.test(r)&&qS(e,"x",i.right)}(e,0,i)}),e.on(["shape.move.hover","shape.move.move","shape.move.end","create.hover","create.move","create.end"],XS,function(e){var t=e.context.shape,n=e.hover;IS(n,"bpmn:Lane")&&!jS(t,["bpmn:Lane","bpmn:Participant"])&&(e.hover=KS(n),e.hoverGfx=i.getGraphics(e.hover))}),e.on(["connect.move","connect.hover","connect.end"],XS,function(e){var t=e.context,i=t.source,r=t.target,o=function(e,t){return n.canConnect(e,t)}(i,r)||{};t.initialSourcePosition||(t.initialSourcePosition=t.sourcePosition),r&&"bpmn:SequenceFlow"===o.type?(t.sourcePosition=GS(i),OS(e,GS(r))):t.sourcePosition=t.initialSourcePosition}),e.on("resize.start",XS,function(e){var t=e.context,n=t.shape;IS(n,"bpmn:SubProcess")&&zS(n)&&(t.minDimensions={width:140,height:120}),IS(n,"bpmn:Participant")&&(t.minDimensions={width:300,height:150}),(IS(n,"bpmn:Lane")||IS(n,"bpmn:Participant"))&&(t.resizeConstraints=YS(n,t.direction,t.balanced)),IS(n,"bpmn:TextAnnotation")&&(t.minDimensions={width:50,height:30})})}U(ZS,NS),ZS.$inject=["eventBus","canvas","bpmnRules","elementRegistry"];var QS=ZS;function JS(e,t,n){if(n.length){var i=LS(n.filter(function(e){return!e.labelTarget&&!e.waypoints}));i.x-=50,i.y-=20,i.width+=70,i.height+=40,t.width=Math.max(t.width,i.width),t.height=Math.max(t.height,i.height),e.participantSnapBox=i}}ZS.prototype.initSnap=function(e){var t,n,i,r,o,a=e.context,s=e.shape;o=NS.prototype.initSnap.call(this,e),IS(s,"bpmn:Participant")&&o.setSnapLocations(["top-left","bottom-right","mid"]),s&&(t=GS(s,e),n={width:s.width,height:s.height,x:isNaN(s.x)?$S(t.x-s.width/2):s.x,y:isNaN(s.y)?$S(t.y-s.height/2):s.y},i=WS(n),r=HS(n),o.setSnapOrigin("top-left",{x:i.x-e.x,y:i.y-e.y}),o.setSnapOrigin("bottom-right",{x:r.x-e.x,y:r.y-e.y}),DS(s.outgoing,function(t){var n=t.waypoints[0];n=n.original||n,o.setSnapOrigin(t.id+"-docking",{x:n.x-e.x,y:n.y-e.y})}),DS(s.incoming,function(t){var n=t.waypoints[t.waypoints.length-1];n=n.original||n,o.setSnapOrigin(t.id+"-docking",{x:n.x-e.x,y:n.y-e.y})}));var c=a.source;c&&o.addDefaultSnap("mid",GS(c))},ZS.prototype.addTargetSnaps=function(e,t,n){IS(t,"bpmn:BoundaryEvent")&&"label"!==t.type&&(n=n.parent),IS(n,"bpmn:SequenceFlow")&&this.addTargetSnaps(e,t,n.parent);var i=this.getSiblings(t,n)||[];DS(i,function(t){IS(t,"bpmn:Lane")||(t.waypoints?DS(t.waypoints.slice(1,-1),function(n,i){var r=t.waypoints[i+2],o=t.waypoints[i];if(!r||!o)throw new Error("waypoints must exist");r.x!==n.x&&r.y!==n.y&&o.x!==n.x&&o.y!==n.y||e.add("mid",n)}):(e.add("mid",GS(t)),IS(t,"bpmn:Participant")&&(e.add("top-left",WS(t)),e.add("bottom-right",HS(t)))))}),DS(t.incoming,function(t){-1===i.indexOf(t.source)&&e.add("mid",GS(t.source));var n=t.waypoints[0];e.add(t.id+"-docking",n.original||n)}),DS(t.outgoing,function(t){-1===i.indexOf(t.target)&&e.add("mid",GS(t.target));var n=t.waypoints[t.waypoints.length-1];e.add(t.id+"-docking",n.original||n)})};var eT={__init__:["snapping"],snapping:["type",QS]},tT=s.assign;function nT(e,t,n,i){this._canvas=n,this._mouseTracking=i,this._opts=tT({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on("drag.move",function(e){var t=r._toBorderPoint(e);r.startScroll(t)}),t.on(["drag.cleanup"],function(){r.stopScroll()})}nT.$inject=["config.autoScroll","eventBus","canvas","mouseTracking"];var iT=nT;function rT(e,t,n){return t<e&&e<n}nT.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)rT(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(0===c?a=n.scrollStep:1==c?s=n.scrollStep:2==c?a=-n.scrollStep:3==c&&(s=-n.scrollStep));0===a&&0===s||(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))},nT.prototype.stopScroll=function(){clearTimeout(this._scrolling)},nT.prototype.setOptions=function(e){this._opts=tT({},this._opts,e)},nT.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=fo.toPoint(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var oT={__depends__:[nu,ch],__init__:["autoScroll"],autoScroll:["type",iT]},aT={},sT=aT.BENDPOINT_CLS="djs-bendpoint",cT=aT.SEGMENT_DRAGGER_CLS="djs-segment-dragger",pT=n.append,lT=n.attr,uT=n.classes,hT=n.create,dT=w.rotate,mT=w.translate;aT.toCanvasCoordinates=function(e,t){var n,i=fo.toPoint(t),r=e._container.getBoundingClientRect();n={x:r.left,y:r.top};var o=e.viewbox();return{x:o.x+(i.x-n.x)/o.scale,y:o.y+(i.y-n.y)/o.scale}},aT.addBendpoint=function(e,t){var n=hT("g");uT(n).add(sT),pT(e,n);var i=hT("circle");lT(i,{cx:0,cy:0,r:4}),uT(i).add("djs-visual"),pT(n,i);var r=hT("circle");return lT(r,{cx:0,cy:0,r:10}),uT(r).add("djs-hit"),pT(n,r),t&&uT(n).add(t),n},aT.addSegmentDragger=function(e,t,n){var i=hT("g"),r=Va.getMidPoint(t,n),o=Va.pointsAligned(t,n);return pT(e,i),function(e,t,n){var i=hT("g");pT(e,i);var r=hT("rect");lT(r,{x:-7,y:-1.5,width:14,height:3}),uT(r).add("djs-visual"),pT(i,r);var o=hT("rect");lT(o,{x:-10,y:-4.5,width:20,height:9}),uT(o).add("djs-hit"),pT(i,o),dT(i,"h"===n?90:0,0,0)}(i,0,o),uT(i).add(cT),uT(i).add("h"===o?"vertical":"horizontal"),mT(i,r.x,r.y),i};var fT="connect-ok",yT="connect-not-ok",vT="connect-hover",gT="djs-updating",bT="connection.updateWaypoints",xT="connection.reconnectStart",ET="connection.reconnectEnd",_T=Math.round,wT=n.classes,ST=n.remove,TT=w.translate;function CT(e,t,n,i,r,o,a){var s=e.get("connectionDocking",!1);function c(e){r.update("connection",e.connection,e.connectionGfx)}this.start=function(e,t,r,o){var a,s=t.waypoints,c=n.getGraphics(t);a={connection:t,bendpointIndex:r,insert:o,type:o||0!==r?o||r!==s.length-1?bT:ET:xT},i.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:c,context:a}})},t.on("bendpoint.move.start",function(e){var t=e.context,i=t.connection,r=i.waypoints,o=r.slice(),a=t.insert,s=t.bendpointIndex;t.originalWaypoints=r,a&&o.splice(s,0,null),i.waypoints=o,t.draggerGfx=aT.addBendpoint(n.getLayer("overlays")),wT(t.draggerGfx).add("djs-dragging"),n.addMarker(i,gT)}),t.on("bendpoint.move.hover",function(e){var t=e.context;if(t.hover=e.hover,e.hover){n.addMarker(e.hover,vT);var i=t.allowed=o.allowed(t.type,t);i?(n.removeMarker(t.hover,yT),n.addMarker(t.hover,fT),t.target=t.hover):!1===i&&(n.removeMarker(t.hover,fT),n.addMarker(t.hover,yT),t.target=null)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(e){var t=e.context.hover;t&&(n.removeMarker(t,vT),n.removeMarker(t,e.context.target?fT:yT))}),t.on("bendpoint.move.move",function(e){var t,n,i=e.context,r=i.type,o=e.connection;o.waypoints[i.bendpointIndex]={x:e.x,y:e.y},s&&(i.hover&&(r===xT&&(t=i.hover),r===ET&&(n=i.hover)),o.waypoints=s.getCroppedWaypoints(o,t,n)),TT(i.draggerGfx,e.x,e.y),c(e)}),t.on(["bendpoint.move.end","bendpoint.move.cancel"],function(e){var t=e.context,i=t.hover,r=t.connection;ST(t.draggerGfx),t.newWaypoints=r.waypoints.slice(),r.waypoints=t.originalWaypoints,n.removeMarker(r,gT),i&&(n.removeMarker(i,fT),n.removeMarker(i,yT))}),t.on("bendpoint.move.end",function(e){var t,n=e.context,i=n.newWaypoints,r=n.bendpointIndex,o=i[r],s=n.allowed;if(o.x=_T(o.x),o.y=_T(o.y),s&&n.type===xT)a.reconnectStart(n.connection,n.target,o);else if(s&&n.type===ET)a.reconnectEnd(n.connection,n.target,o);else{if(!1===s||n.type!==bT)return c(e),!1;t={bendpointMove:{insert:e.context.insert,bendpointIndex:r}},a.updateWaypoints(n.connection,function(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],i=e[r+1],0===Va.pointDistance(t,i)||Va.pointsOnLine(n,i,t)?e.splice(r,1):r++;return e}(i),t)}}),t.on("bendpoint.move.cancel",function(e){c(e)})}CT.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"];var AT=CT,RT=s.assign,PT=s.forEach,MT=s.isArray,kT=Math.abs,BT=Math.round,NT=10;function DT(e){function t(e,t){if(MT(e)){for(var n=e.length;n--;)if(kT(e[n]-t)<=NT)return e[n]}else{var i=t%(e=+e);if(i<NT)return t-i;if(i>e-NT)return t-i+e}return t}function n(e){if(e.width)return{x:BT(e.width/2+e.x),y:BT(e.height/2+e.y)}}e.on("connectionSegment.move.move",1500,function(e){var i,r,o=function(e){var t=e.snapPoints,i=e.connection,r=i.waypoints,o=e.segmentStart,a=e.segmentStartIndex,s=e.segmentEnd,c=e.segmentEndIndex,p=e.axis;if(t)return t;var l=[r[a-1],o,s,r[c+1]];return a<2&&l.unshift(n(i.source)),c>r.length-3&&l.unshift(n(i.target)),e.snapPoints=t={horizontal:[],vertical:[]},PT(l,function(e){e&&(e=e.original||e,"y"===p&&t.horizontal.push(e.y),"x"===p&&t.vertical.push(e.x))}),t}(e.context),a=e.x,s=e.y;if(o){var c=a-(i=t(o.vertical,a)),p=s-(r=t(o.horizontal,s));RT(e,{dx:e.dx-c,dy:e.dy-p,x:i,y:r})}}),e.on("bendpoint.move.move",1500,function(e){var i=e.context,r=function(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var r=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},PT(r,function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))}),t}(i),o=i.target,a=o&&n(o),s=e.x,c=e.y;if(r){var p=s-t(a?r.vertical.concat([a.x]):r.vertical,s),l=c-t(a?r.horizontal.concat([a.y]):r.horizontal,c);RT(e,{dx:e.dx-p,dy:e.dy-l,x:e.x-p,y:e.y-l})}})}DT.$inject=["eventBus"];var OT=DT,LT=s.forEach,IT=Y.event,jT=Y.query,zT=Y.queryAll,FT=Va.pointsAligned,$T=Va.getMidPoint,GT=aT.BENDPOINT_CLS,WT=aT.SEGMENT_DRAGGER_CLS,HT=Vb.getApproxIntersection,VT=n.append,qT=n.attr,UT=n.classes,YT=n.create,KT=n.remove,XT=w.translate;function ZT(e,t,n,i,r){function o(e,n){var i=aT.toCanvasCoordinates(t,n);return HT(e,i)}function a(e,t){var n=t.waypoints,a=o(n,e);if(a)return!function(e,t,n){var i,r,o,a,s,c,p=e.index,l=e.point;return!(p<=0||e.bendpoint)&&(i=t[p-1],r=t[p],o=$T(i,r),a=FT(i,r),s=Math.abs(l.x-o.x),c=Math.abs(l.y-o.y),a&&s<=n&&c<=n)}(a,n,10)?i.start(e,t,a.index,!a.bendpoint):r.start(e,t,a.index),!0}function s(e,t,i){IT.bind(e,t,function(e){n.triggerMouseEvent(t,e,i),e.stopPropagation()})}function c(e,n){var i=t.getLayer("overlays"),r=jT(".djs-bendpoints[data-element-id="+e.id+"]",i);return!r&&n&&(r=YT("g"),qT(r,{"data-element-id":e.id}),UT(r).add("djs-bendpoints"),VT(i,r),s(r,"mousedown",e),s(r,"click",e),s(r,"dblclick",e)),r}function p(e,t){t.waypoints.forEach(function(t,n){var i=aT.addBendpoint(e);VT(e,i),XT(i,t.x,t.y)}),aT.addBendpoint(e,"floating")}function l(e,t){for(var n,i,r=t.waypoints,o=1;o<r.length;o++)n=r[o-1],i=r[o],FT(n,i)&&aT.addSegmentDragger(e,n,i)}function u(e){var t=c(e);return t||(p(t=c(e,!0),e),l(t,e)),t}function h(e){var t=c(e);t&&(!function(e){LT(zT("."+WT,e),function(e){KT(e)})}(t),function(e){LT(zT("."+GT,e),function(e){KT(e)})}(t),l(t,e),p(t,e))}e.on("connection.changed",function(e){h(e.element)}),e.on("connection.remove",function(e){var t=c(e.element);t&&KT(t)}),e.on("element.marker.update",function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?UT(t).add(e.marker):UT(t).remove(e.marker))}),e.on("element.mousemove",function(e){var t,n,i,r=e.element,a=r.waypoints;if(a){if(t=c(r,!0),!(n=jT(".floating",t)))return;(i=o(a,e.originalEvent))&&XT(n,i.point.x,i.point.y)}}),e.on("element.mousedown",function(e){var t=e.originalEvent,n=e.element,i=n.waypoints;if(i)return a(t,n)}),e.on("selection.changed",function(e){var t=e.newSelection[0];t&&t.waypoints&&u(t)}),e.on("element.hover",function(e){var t=e.element;t.waypoints&&(u(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(e){var t=e.element,n=e.newId;if(t.waypoints){var i=c(t);i&&qT(i,{"data-element-id":n})}}),this.addHandles=u,this.updateHandles=h,this.getBendpointsContainer=c}ZT.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var QT=ZT,JT="connect-hover",eC="djs-updating",tC=n.classes,nC=n.remove,iC=w.translate;function rC(e,t,n){return oC(e,t,e[t]+n)}function oC(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function aC(e){return"x"===e?"y":"x"}function sC(e,t,n){var i,r;return e.original?e.original:(i=Cs.getMid(t),oC(e,r=aC(n),i[r]))}function cC(e,t,n,i,r,o,a){var s=e.get("connectionDocking",!1);function c(e,t){if(!s)return t;var n,i=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=i,n}function p(e){r.update("connection",e.connection,e.connectionGfx)}function l(e,t,n){var i=e.newWaypoints,r=function(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]);return oC(t,i,Math.min(Math.max(o+20,e[i]),r-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],aC(e.axis));iC(e.draggerGfx,r.x,r.y)}this.start=function(e,t,r){var o,a,s,c=n.getGraphics(t),p=r-1,l=r,u=t.waypoints,h=u[p],d=u[l];(a=Va.pointsAligned(h,d))&&(s="v"===a?"y":"x",0===p&&(h=sC(h,t.source,s)),l===u.length-1&&(d=sC(d,t.target,s)),o={connection:t,segmentStartIndex:p,segmentEndIndex:l,segmentStart:h,segmentEnd:d,axis:s},i.init(e,{x:(h.x+d.x)/2,y:(h.y+d.y)/2},"connectionSegment.move",{cursor:"x"===s?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:c,context:o}}))},t.on("connectionSegment.move.start",function(e){var t=e.context,i=e.connection,r=n.getLayer("overlays");t.originalWaypoints=i.waypoints.slice(),t.draggerGfx=aT.addSegmentDragger(r,t.segmentStart,t.segmentEnd),tC(t.draggerGfx).add("djs-dragging"),n.addMarker(i,eC)}),t.on("connectionSegment.move.move",function(e){var t,n,i=e.context,r=i.connection,o=i.segmentStartIndex,a=i.segmentEndIndex,s=i.segmentStart,u=i.segmentEnd,h=i.axis,d=i.originalWaypoints.slice(),m=rC(s,h,e["d"+h]),f=rC(u,h,e["d"+h]),y=d.length,v=0;d[o]=m,d[a]=f,o<2&&(t=Cs.getOrientation(r.source,m),1===o?"intersect"===t&&(d.shift(),d[0]=m,v--):"intersect"!==t&&(d.unshift(s),v++)),a>y-3&&(n=Cs.getOrientation(r.target,f),a===y-2?"intersect"===n&&(d.pop(),d[d.length-1]=f):"intersect"!==n&&d.push(u)),i.newWaypoints=r.waypoints=c(r,d),l(i,v,e),i.newSegmentStartIndex=o+v,p(e)}),t.on("connectionSegment.move.hover",function(e){e.context.hover=e.hover,n.addMarker(e.hover,JT)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(e){var t=e.context.hover;t&&n.removeMarker(t,JT)}),t.on("connectionSegment.move.cleanup",function(e){var t=e.context,i=t.connection;t.draggerGfx&&nC(t.draggerGfx),n.removeMarker(i,eC)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,p(e)}),t.on("connectionSegment.move.end",function(e){var t=e.context,n=t.connection,i=t.newWaypoints,r=t.newSegmentStartIndex,o=function(e,t){var n=0;return{waypoints:e.filter(function(i,r){return!Va.pointsOnLine(e[r-1],e[r+1],i)||(n=r<=t?n-1:n,!1)}),segmentOffset:n}}(i=i.map(function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}),r),s=c(n,o.waypoints),p=o.segmentOffset,l={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+p}};a.updateWaypoints(n,s,l)})}cC.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"];var pC={__depends__:[nu,ou],__init__:["bendpoints","bendpointSnapping"],bendpoints:["type",QT],bendpointMove:["type",AT],connectionSegmentMove:["type",cC],bendpointSnapping:["type",OT]},lC=s.assign,uC=s.filter,hC=s.groupBy,dC=500,mC=1250,fC=1500,yC=fo.getOriginal,vC=Math.round;function gC(e,t,n,i,r){function o(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function a(e,n,i){if(!n.waypoints&&n.parent){var r=function(e){return{x:e.x+vC(e.width/2),y:e.y+vC(e.height/2)}}(n);return t.init(e,r,"shape.move",{cursor:"grabbing",autoActivate:i,data:{shape:n,context:{}}}),!0}}e.on("shape.move.start",fC,function(e){var t,n,r=e.context,o=e.shape,a=i.get().slice();-1===a.indexOf(o)&&(a=[o]),n=hC(t=a,"id"),a=uC(t,function(e){for(;e=e.parent;)if(n[e.id])return!1;return!0}),lC(r,{shapes:a,validatedShapes:a,shape:o})}),e.on("shape.move.start",mC,function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=o(n)))return!1}),e.on("shape.move.move",dC,function(e){var t,n=e.context,i=n.validatedShapes,r=e.hover,a={x:e.dx,y:e.dy};t=o(i,a,{x:e.x,y:e.y},r),n.delta=a,n.canExecute=t,n.target=null!==t?r:null}),e.on("shape.move.end",function(e){var t=e.context,i=t.delta,r=t.canExecute,o="attach"===r,a=t.shapes;if(!r)return!1;i.x=vC(i.x),i.y=vC(i.y),n.moveElements(a,i,t.target,{primaryShape:t.shape,attach:o})}),e.on("element.mousedown",function(e){var t=yC(e);if(!t)throw new Error("must supply DOM mousedown event");return a(t,e.element)}),this.start=a}gC.$inject=["eventBus","dragging","modeling","selection","rules"];var bC=gC;var xC=s.flatten,EC=s.forEach,_C=s.filter,wC=s.find,SC=s.groupBy,TC=s.map,CC=s.matchPattern,AC=s.size,RC=n.append,PC=n.attr,MC=n.clear,kC=n.create,BC=w.translate,NC=499,DC="djs-dragging",OC="drop-ok",LC="drop-not-ok",IC="new-parent",jC="attach-ok";function zC(e,t,n,i,r){function o(e){return function(e){return _C(e,function(t){return!function(e){return e.waypoints}(t)||wC(e,CC({id:t.source.id}))&&wC(e,CC({id:t.target.id}))})}(a(e))}function a(e){var t=ci.selfAndAllChildren(e,!0),n=TC(t,function(e){return(e.incoming||[]).concat(e.outgoing||[])});return xC(t.concat(n),!0)}function s(e,t){[jC,OC,LC,IC].forEach(function(i){i===t?n.addMarker(e,i):n.removeMarker(e,i)})}e.on("shape.move.start",NC,function(e){var t=e.context,s=t.shapes,c=t.allDraggedElements,p=o(s);if(!t.dragGroup){var l=kC("g");PC(l,i.cls("djs-drag-group",["no-events"]));var u=n.getDefaultLayer();RC(u,l),t.dragGroup=l}p.forEach(function(e){r.addDragger(e,t.dragGroup)}),c=c?xC(c,a(s)):a(s),EC(c,function(e){n.addMarker(e,DC)}),t.allDraggedElements=c,t.differentParents=1!==AC(SC(s,function(e){return e.parent&&e.parent.id}))}),e.on("shape.move.move",NC,function(e){var t=e.context,n=t.dragGroup,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?s(i,jC):t.canExecute&&i&&i.id!==r.id?s(i,IC):s(i,t.canExecute?OC:LC)),BC(n,e.dx,e.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(e){var t=e.context.target;t&&s(t,null)}),e.on("shape.move.cleanup",function(e){var t=e.context,i=t.allDraggedElements,r=t.dragGroup;EC(i,function(e){n.removeMarker(e,DC)}),r&&MC(r)}),this.makeDraggable=function(e,t,i){r.addDragger(t,e.dragGroup),i&&n.addMarker(t,DC),e.allDraggedElements?e.allDraggedElements.push(t):e.allDraggedElements=[t]}}zC.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var FC={__depends__:[Oo,ia,Ho,ou,nu,Vd],__init__:["move","movePreview"],move:["type",bC],movePreview:["type",zC]},$C=n.append,GC=n.attr,WC=n.create;function HC(e,t){var n=this;t.on("canvas.init",function(e){n.addBBoxMarker(e.svg)})}HC.$inject=["canvas","eventBus"];var VC=HC;HC.prototype.addBBoxMarker=function(e){var t={fill:"none",class:"outer-bound-marker"},n=WC("rect");GC(n,{x:-1e4,y:1e4,width:10,height:10}),GC(n,t),$C(e,n);var i=WC("rect");GC(i,{x:1e4,y:1e4,width:10,height:10}),GC(i,t),$C(e,i)};var qC={exports:{}};!function(e,t,n,i){"use strict";var r,o=["","webkit","Moz","MS","ms","o"],a=t.createElement("div"),s="function",c=Math.round,p=Math.abs,l=Date.now;function u(e,t,n){return setTimeout(g(e,n),t)}function h(e,t,n){return!!Array.isArray(e)&&(d(e,n[t],n),!0)}function d(e,t,n){var r;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==i)for(r=0;r<e.length;)t.call(n,e[r],r,e),r++;else for(r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r,e)}function m(t,n,i){var r="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){var n=new Error("get-stack-trace"),i=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=e.console&&(e.console.warn||e.console.log);return o&&o.call(e.console,r,i),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(e){if(e===i||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(r!==i&&null!==r)for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])}return t}:Object.assign;var f=m(function(e,t,n){for(var r=Object.keys(t),o=0;o<r.length;)(!n||n&&e[r[o]]===i)&&(e[r[o]]=t[r[o]]),o++;return e},"extend","Use `assign`."),y=m(function(e,t){return f(e,t,!0)},"merge","Use `assign`.");function v(e,t,n){var i,o=t.prototype;(i=e.prototype=Object.create(o)).constructor=e,i._super=o,n&&r(i,n)}function g(e,t){return function(){return e.apply(t,arguments)}}function b(e,t){return typeof e==s?e.apply(t&&t[0]||i,t):e}function x(e,t){return e===i?t:e}function E(e,t,n){d(T(t),function(t){e.addEventListener(t,n,!1)})}function _(e,t,n){d(T(t),function(t){e.removeEventListener(t,n,!1)})}function w(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function S(e,t){return e.indexOf(t)>-1}function T(e){return e.trim().split(/\s+/g)}function C(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var i=0;i<e.length;){if(n&&e[i][n]==t||!n&&e[i]===t)return i;i++}return-1}function A(e){return Array.prototype.slice.call(e,0)}function R(e,t,n){for(var i=[],r=[],o=0;o<e.length;){var a=t?e[o][t]:e[o];C(r,a)<0&&i.push(e[o]),r[o]=a,o++}return n&&(i=t?i.sort(function(e,n){return e[t]>n[t]}):i.sort()),i}function P(e,t){for(var n,r,a=t[0].toUpperCase()+t.slice(1),s=0;s<o.length;){if((r=(n=o[s])?n+a:t)in e)return r;s++}return i}var M=1;function k(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var B="ontouchstart"in e,N=P(e,"PointerEvent")!==i,D=B&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),O=25,L=1,I=2,j=4,z=8,F=1,$=2,G=4,W=8,H=16,V=$|G,q=W|H,U=V|q,Y=["x","y"],K=["clientX","clientY"];function X(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){b(e.options.enable,[e])&&n.handler(t)},this.init()}function Z(e,t,n){var r=n.pointers.length,o=n.changedPointers.length,a=t&L&&r-o==0,s=t&(j|z)&&r-o==0;n.isFirst=!!a,n.isFinal=!!s,a&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,r=t.pointers,o=r.length;n.firstInput||(n.firstInput=Q(t));o>1&&!n.firstMultiple?n.firstMultiple=Q(t):1===o&&(n.firstMultiple=!1);var a=n.firstInput,s=n.firstMultiple,c=s?s.center:a.center,u=t.center=J(r);t.timeStamp=l(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=ie(c,u),t.distance=ne(c,u),function(e,t){var n=t.center,i=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};t.eventType!==L&&o.eventType!==j||(r=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=e.offsetDelta={x:n.x,y:n.y});t.deltaX=r.x+(n.x-i.x),t.deltaY=r.y+(n.y-i.y)}(n,t),t.offsetDirection=te(t.deltaX,t.deltaY);var h=ee(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=h.x,t.overallVelocityY=h.y,t.overallVelocity=p(h.x)>p(h.y)?h.x:h.y,t.scale=s?(d=s.pointers,m=r,ne(m[0],m[1],K)/ne(d[0],d[1],K)):1,t.rotation=s?function(e,t){return ie(t[1],t[0],K)+ie(e[1],e[0],K)}(s.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,function(e,t){var n,r,o,a,s=e.lastInterval||t,c=t.timeStamp-s.timeStamp;if(t.eventType!=z&&(c>O||s.velocity===i)){var l=t.deltaX-s.deltaX,u=t.deltaY-s.deltaY,h=ee(c,l,u);r=h.x,o=h.y,n=p(h.x)>p(h.y)?h.x:h.y,a=te(l,u),e.lastInterval=t}else n=s.velocity,r=s.velocityX,o=s.velocityY,a=s.direction;t.velocity=n,t.velocityX=r,t.velocityY=o,t.direction=a}(n,t);var d,m;var f=e.element;w(t.srcEvent.target,f)&&(f=t.srcEvent.target);t.target=f}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function Q(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:c(e.pointers[n].clientX),clientY:c(e.pointers[n].clientY)},n++;return{timeStamp:l(),pointers:t,center:J(t),deltaX:e.deltaX,deltaY:e.deltaY}}function J(e){var t=e.length;if(1===t)return{x:c(e[0].clientX),y:c(e[0].clientY)};for(var n=0,i=0,r=0;r<t;)n+=e[r].clientX,i+=e[r].clientY,r++;return{x:c(n/t),y:c(i/t)}}function ee(e,t,n){return{x:t/e||0,y:n/e||0}}function te(e,t){return e===t?F:p(e)>=p(t)?e<0?$:G:t<0?W:H}function ne(e,t,n){n||(n=Y);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return Math.sqrt(i*i+r*r)}function ie(e,t,n){n||(n=Y);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return 180*Math.atan2(r,i)/Math.PI}X.prototype={handler:function(){},init:function(){this.evEl&&E(this.element,this.evEl,this.domHandler),this.evTarget&&E(this.target,this.evTarget,this.domHandler),this.evWin&&E(k(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(k(this.element),this.evWin,this.domHandler)}};var re={mousedown:L,mousemove:I,mouseup:j},oe="mousedown",ae="mousemove mouseup";function se(){this.evEl=oe,this.evWin=ae,this.pressed=!1,X.apply(this,arguments)}v(se,X,{handler:function(e){var t=re[e.type];t&L&&0===e.button&&(this.pressed=!0),t&I&&1!==e.which&&(t=j),this.pressed&&(t&j&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:"mouse",srcEvent:e}))}});var ce={pointerdown:L,pointermove:I,pointerup:j,pointercancel:z,pointerout:z},pe={2:"touch",3:"pen",4:"mouse",5:"kinect"},le="pointerdown",ue="pointermove pointerup pointercancel";function he(){this.evEl=le,this.evWin=ue,X.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&(le="MSPointerDown",ue="MSPointerMove MSPointerUp MSPointerCancel"),v(he,X,{handler:function(e){var t=this.store,n=!1,i=e.type.toLowerCase().replace("ms",""),r=ce[i],o=pe[e.pointerType]||e.pointerType,a="touch"==o,s=C(t,e.pointerId,"pointerId");r&L&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):r&(j|z)&&(n=!0),s<0||(t[s]=e,this.callback(this.manager,r,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),n&&t.splice(s,1))}});var de={touchstart:L,touchmove:I,touchend:j,touchcancel:z},me="touchstart",fe="touchstart touchmove touchend touchcancel";function ye(){this.evTarget=me,this.evWin=fe,this.started=!1,X.apply(this,arguments)}v(ye,X,{handler:function(e){var t=de[e.type];if(t===L&&(this.started=!0),this.started){var n=function(e,t){var n=A(e.touches),i=A(e.changedTouches);t&(j|z)&&(n=R(n.concat(i),"identifier",!0));return[n,i]}.call(this,e,t);t&(j|z)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:"touch",srcEvent:e})}}});var ve={touchstart:L,touchmove:I,touchend:j,touchcancel:z},ge="touchstart touchmove touchend touchcancel";function be(){this.evTarget=ge,this.targetIds={},X.apply(this,arguments)}v(be,X,{handler:function(e){var t=ve[e.type],n=function(e,t){var n=A(e.touches),i=this.targetIds;if(t&(L|I)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,a=A(e.changedTouches),s=[],c=this.target;if(o=n.filter(function(e){return w(e.target,c)}),t===L)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;r=0;for(;r<a.length;)i[a[r].identifier]&&s.push(a[r]),t&(j|z)&&delete i[a[r].identifier],r++;if(!s.length)return;return[R(o.concat(s),"identifier",!0),s]}.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:"touch",srcEvent:e})}});var xe=2500,Ee=25;function _e(){X.apply(this,arguments);var e=g(this.handler,this);this.touch=new be(this.manager,e),this.mouse=new se(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function we(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout(function(){var e=i.indexOf(n);e>-1&&i.splice(e,1)},xe)}}v(_e,X,{handler:function(e,t,n){var i="touch"==n.pointerType,r="mouse"==n.pointerType;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)(function(e,t){e&L?(this.primaryTouch=t.changedPointers[0].identifier,we.call(this,t)):e&(j|z)&&we.call(this,t)}).call(this,t,n);else if(r&&function(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(t-r.x),a=Math.abs(n-r.y);if(o<=Ee&&a<=Ee)return!0}return!1}.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Se=P(a.style,"touchAction"),Te=Se!==i,Ce="auto",Ae="manipulation",Re="none",Pe="pan-x",Me="pan-y",ke=function(){if(!Te)return!1;var t={},n=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(i){t[i]=!n||e.CSS.supports("touch-action",i)}),t}();function Be(e,t){this.manager=e,this.set(t)}Be.prototype={set:function(e){"compute"==e&&(e=this.compute()),Te&&this.manager.element.style&&ke[e]&&(this.manager.element.style[Se]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return d(this.manager.recognizers,function(t){b(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),function(e){if(S(e,Re))return Re;var t=S(e,Pe),n=S(e,Me);if(t&&n)return Re;if(t||n)return t?Pe:Me;if(S(e,Ae))return Ae;return Ce}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var i=this.actions,r=S(i,Re)&&!ke[Re],o=S(i,Me)&&!ke[Me],a=S(i,Pe)&&!ke[Pe];if(r){var s=1===e.pointers.length,c=e.distance<2,p=e.deltaTime<250;if(s&&c&&p)return}if(!a||!o)return r||o&&n&V||a&&n&q?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Ne=1,De=2,Oe=4,Le=8,Ie=Le,je=16;function ze(e){this.options=r({},this.defaults,e||{}),this.id=M++,this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=Ne,this.simultaneous={},this.requireFail=[]}function Fe(e){return e&je?"cancel":e&Le?"end":e&Oe?"move":e&De?"start":""}function $e(e){return e==H?"down":e==W?"up":e==$?"left":e==G?"right":""}function Ge(e,t){var n=t.manager;return n?n.get(e):e}function We(){ze.apply(this,arguments)}function He(){We.apply(this,arguments),this.pX=null,this.pY=null}function Ve(){We.apply(this,arguments)}function qe(){ze.apply(this,arguments),this._timer=null,this._input=null}function Ue(){We.apply(this,arguments)}function Ye(){We.apply(this,arguments)}function Ke(){ze.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Xe(e,t){return(t=t||{}).recognizers=x(t.recognizers,Xe.defaults.preset),new Ze(e,t)}ze.prototype={defaults:{},set:function(e){return r(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(h(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Ge(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return h(e,"dropRecognizeWith",this)?this:(e=Ge(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(h(e,"requireFailure",this))return this;var t=this.requireFail;return-1===C(t,e=Ge(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(h(e,"dropRequireFailure",this))return this;e=Ge(e,this);var t=C(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function i(n){t.manager.emit(n,e)}n<Le&&i(t.options.event+Fe(n)),i(t.options.event),e.additionalEvent&&i(e.additionalEvent),n>=Le&&i(t.options.event+Fe(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=32},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(32|Ne)))return!1;e++}return!0},recognize:function(e){var t=r({},e);if(!b(this.options.enable,[this,t]))return this.reset(),void(this.state=32);this.state&(Ie|je|32)&&(this.state=Ne),this.state=this.process(t),this.state&(De|Oe|Le|je)&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},v(We,ze,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,i=t&(De|Oe),r=this.attrTest(e);return i&&(n&z||!r)?t|je:i||r?n&j?t|Le:t&De?t|Oe:De:32}}),v(He,We,{defaults:{event:"pan",threshold:10,pointers:1,direction:U},getTouchAction:function(){var e=this.options.direction,t=[];return e&V&&t.push(Me),e&q&&t.push(Pe),t},directionTest:function(e){var t=this.options,n=!0,i=e.distance,r=e.direction,o=e.deltaX,a=e.deltaY;return r&t.direction||(t.direction&V?(r=0===o?F:o<0?$:G,n=o!=this.pX,i=Math.abs(e.deltaX)):(r=0===a?F:a<0?W:H,n=a!=this.pY,i=Math.abs(e.deltaY))),e.direction=r,n&&i>t.threshold&&r&t.direction},attrTest:function(e){return We.prototype.attrTest.call(this,e)&&(this.state&De||!(this.state&De)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=$e(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),v(Ve,We,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Re]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&De)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),v(qe,ze,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ce]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime>t.time;if(this._input=e,!i||!n||e.eventType&(j|z)&&!r)this.reset();else if(e.eventType&L)this.reset(),this._timer=u(function(){this.state=Ie,this.tryEmit()},t.time,this);else if(e.eventType&j)return Ie;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===Ie&&(e&&e.eventType&j?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}}),v(Ue,We,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Re]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&De)}}),v(Ye,We,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:V|q,pointers:1},getTouchAction:function(){return He.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(V|q)?t=e.overallVelocity:n&V?t=e.overallVelocityX:n&q&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&p(t)>this.options.velocity&&e.eventType&j},emit:function(e){var t=$e(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),v(Ke,ze,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Ae]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),e.eventType&L&&0===this.count)return this.failTimeout();if(i&&r&&n){if(e.eventType!=j)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||ne(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,a&&o?this.count+=1:this.count=1,this._input=e,0===this.count%t.taps)return this.hasRequireFailures()?(this._timer=u(function(){this.state=Ie,this.tryEmit()},t.interval,this),De):Ie}return 32},failTimeout:function(){return this._timer=u(function(){this.state=32},this.options.interval,this),32},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Ie&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Xe.VERSION="2.0.7",Xe.defaults={domEvents:!1,touchAction:"compute",enable:!0,inputTarget:null,inputClass:null,preset:[[Ue,{enable:!1}],[Ve,{enable:!1},["rotate"]],[Ye,{direction:V}],[He,{direction:V},["swipe"]],[Ke],[Ke,{event:"doubletap",taps:2},["tap"]],[qe]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Ze(e,t){var n;this.options=r({},Xe.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new((n=this).options.inputClass||(N?he:D?be:B?_e:se))(n,Z),this.touchAction=new Be(this,this.options.touchAction),Qe(this,!0),d(this.options.recognizers,function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}function Qe(e,t){var n,i=e.element;i.style&&(d(e.options.cssProps,function(r,o){n=P(i.style,o),t?(e.oldCssProps[n]=i.style[n],i.style[n]=r):i.style[n]=e.oldCssProps[n]||""}),t||(e.oldCssProps={}))}Ze.prototype={set:function(e){return r(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var n;this.touchAction.preventDefaults(e);var i=this.recognizers,r=t.curRecognizer;(!r||r&&r.state&Ie)&&(r=t.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===t.stopped||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(e),!r&&n.state&(De|Oe|Le)&&(r=t.curRecognizer=n),o++}},get:function(e){if(e instanceof ze)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(h(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(h(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=C(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==i&&t!==i){var n=this.handlers;return d(T(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==i){var n=this.handlers;return d(T(e),function(e){t?n[e]&&n[e].splice(C(n[e],t),1):delete n[e]}),this}},emit:function(e,n){this.options.domEvents&&function(e,n){var i=t.createEvent("Event");i.initEvent(e,!0,!0),i.gesture=n,n.target.dispatchEvent(i)}(e,n);var i=this.handlers[e]&&this.handlers[e].slice();if(i&&i.length){n.type=e,n.preventDefault=function(){n.srcEvent.preventDefault()};for(var r=0;r<i.length;)i[r](n),r++}},destroy:function(){this.element&&Qe(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},r(Xe,{INPUT_START:L,INPUT_MOVE:I,INPUT_END:j,INPUT_CANCEL:z,STATE_POSSIBLE:Ne,STATE_BEGAN:De,STATE_CHANGED:Oe,STATE_ENDED:Le,STATE_RECOGNIZED:Ie,STATE_CANCELLED:je,STATE_FAILED:32,DIRECTION_NONE:F,DIRECTION_LEFT:$,DIRECTION_RIGHT:G,DIRECTION_UP:W,DIRECTION_DOWN:H,DIRECTION_HORIZONTAL:V,DIRECTION_VERTICAL:q,DIRECTION_ALL:U,Manager:Ze,Input:X,TouchAction:Be,TouchInput:be,MouseInput:se,PointerEventInput:he,TouchMouseInput:_e,SingleTouchInput:ye,Recognizer:ze,AttrRecognizer:We,Tap:Ke,Pan:He,Swipe:Ye,Pinch:Ve,Rotate:Ue,Press:qe,on:E,off:_,each:d,merge:y,extend:f,assign:r,inherit:v,bindFn:g,prefixed:P}),(void 0!==e?e:"undefined"!=typeof self?self:{}).Hammer=Xe,qC.exports?qC.exports=Xe:e.Hammer=Xe}(window,document),qC=qC.exports;var UC=s.forEach,YC=Y.event,KC=Y.closest,XC=.2,ZC=4,QC=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function JC(e,t){return t.get(e,!1)}function eA(e){e.preventDefault(),e.stopPropagation(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()}function tA(e){function t(t){setTimeout(function(){UC(QC,function(t){YC.unbind(e,t,eA,!0)})},500)}YC.bind(e,"touchstart",function(t){UC(QC,function(t){YC.bind(e,t,eA,!0)})},!0),YC.bind(e,"touchend",t,!0),YC.bind(e,"touchcancel",t,!0);var n=new qC.Manager(e,{inputClass:qC.TouchInput,recognizers:[]}),i=new qC.Tap,r=new qC.Pan({threshold:10}),o=new qC.Press,a=new qC.Pinch,s=new qC.Tap({event:"doubletap",taps:2});return a.requireFailure(r),a.requireFailure(o),n.add([r,o,a,s,i]),n.reset=function(e){var t=this.recognizers,i=this.session;i.stopped||(n.stop(e),setTimeout(function(){var e,n;for(e=0;n=t[e];e++)n.reset(),n.state=8;i.curRecognizer=null},0))},n.on("hammer.input",function(e){e.srcEvent.defaultPrevented&&n.reset(!0)}),n}function nA(e,t,n,i,r){var o,a=JC("dragging",e),s=JC("move",e),c=JC("contextPad",e),p=JC("palette",e);function l(e){return function(t){r.fire(e,t)}}function u(e){return KC(e,"svg, .djs-element",!0)}function h(e){function n(e){var n=u(e.target),r=n&&i.get(n);if(s&&t.getRootElement()!==r)return s.start(e,r,!0);!function(e){var n=0,i=0;function r(e){var r=e.deltaX-n,o=e.deltaY-i;t.scroll({dx:r,dy:o}),n=e.deltaX,i=e.deltaY}function a(e){o.off("panmove",r),o.off("panend",a),o.off("pancancel",a)}o.on("panmove",r),o.on("panend",a),o.on("pancancel",a)}()}(o=tA(e)).on("doubletap",l("element.dblclick")),o.on("tap",l("element.click")),o.on("panstart",n),o.on("press",n),o.on("pinchstart",function(e){var n=t.zoom(),i=e.center;function r(e){var r=1-(1-e.scale)/1.5,o=Math.max(XC,Math.min(ZC,r*n));t.zoom(o,i),eA(e)}function a(e){o.off("pinchmove",r),o.off("pinchend",a),o.off("pinchcancel",a),o.reset(!0)}o.on("pinchmove",r),o.on("pinchend",a),o.on("pinchcancel",a)})}a&&n.on("drag.move",function(e){var t=e.originalEvent;if(t&&!(t instanceof MouseEvent)){var n=fo.toPoint(t),r=u(document.elementFromPoint(n.x,n.y)),o=r&&i.get(r);o!==e.hover&&(e.hover&&a.out(e),o&&(a.hover({element:o,gfx:r}),e.hover=o,e.hoverGfx=r))}}),c&&n.on("contextPad.create",function(e){var t=tA(e.pad.html);t.on("panstart",function(e){c.trigger("dragstart",e,!0)}),t.on("press",function(e){c.trigger("dragstart",e,!0)}),t.on("tap",function(e){c.trigger("click",e)})}),p&&n.on("palette.create",function(e){var t=tA(e.container);t.on("panstart",function(e){p.trigger("dragstart",e,!0)}),t.on("press",function(e){p.trigger("dragstart",e,!0)}),t.on("tap",function(e){p.trigger("click",e)})}),n.on("canvas.init",function(e){h(e.svg)})}nA.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"];var iA={__depends__:[{__depends__:[Oo],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",nA],touchFix:["type",VC]}]},rA={};function oA(e){fa.call(this,e),this.on("import.parse.complete",function(e){e.error||this._collectIds(e.definitions,e.context)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}return U(oA,fa),(rA=oA).Viewer=fa,rA.NavigatedViewer=Ha,oA.prototype.createDiagram=function(e){return this.importXML('<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>',e)},oA.prototype._createModdle=function(e){var t=fa.prototype._createModdle.call(this,e);return t.ids=new q([32,36,1]),t},oA.prototype._collectIds=function(e,t){var n,i=e.$model.ids;for(n in i.clear(),t.elementsById)i.claim(n,t.elementsById[n])},oA.prototype._interactionModules=[Ra,iA,Ga],oA.prototype._modelingModules=[oT,pC,FC,xf,Ic,pc,ym,Bu,Tm,Ef,$w,rS,uS,eT],oA.prototype._modules=[].concat(oA.prototype._modules,oA.prototype._interactionModules,oA.prototype._modelingModules),rA});
|
|
1
|
+
/*! bpmn-js - bpmn-modeler v0.31.0 | Copyright (c) 2014-present, camunda Services GmbH | bpmn.io/license */
|
|
2
|
+
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).BpmnJS=e()}}(function(){var e,t,n={exports:{}};e=this,t=function(e){"use strict";function t(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(e){}return e}function n(e,n){return n.appendChild(t(e,n)),e}var i=2,r={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":i,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":i,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function o(e,t,n){var o=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),a=r[o];a?(a===i&&"number"==typeof n&&(n=String(n)+"px"),e.style[o]=n):e.setAttributeNS(null,t,n)}function a(e,t,n){if("string"==typeof t){if(void 0===n)return function(e,t){return r[t]?e.style[t]:e.getAttributeNS(null,t)}(e,t);o(e,t,n)}else!function(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)o(e,i,t[i])}(e,t);return e}function s(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}var c=/\s+/,p=Object.prototype.toString;function l(e){return void 0!==e}function u(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function h(e){var t=e.parentNode;return t&&t.removeChild(e),e}function d(e){for(var t;t=e.firstChild;)h(t);return e}u.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~s(t,e)||t.push(e),l(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},u.prototype.remove=function(e){if("[object RegExp]"===p.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=s(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},u.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},u.prototype.toggle=function(e,t){return this.list?(l(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(l(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},u.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(c);return""===e[0]&&e.shift(),e},u.prototype.has=u.prototype.contains=function(e){return this.list?this.list.contains(e):!!~s(this.array(),e)};var m={svg:"http://www.w3.org/2000/svg"},f='<svg xmlns="'+m.svg+'"';function y(e){return"<svg"===e.substring(0,4)?-1===e.indexOf(m.svg)&&(e=f+e.substring(4)):e=f+">"+e+"</svg>",function(e){var t;return(t=new DOMParser).async=!1,t.parseFromString(e,"text/xml")}(e)}function v(e,t){var n;return"<"===e.charAt(0)?(n=y(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(m.svg,e),t&&a(n,t),n}var g=v("svg");function b(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}var x=/([&<>]{1})/g,E=/([\n\r"]{1})/g,_={"&":"&","<":"<",">":">",'"':"'"};function w(e,t){return e.replace(t,function(e,t){return _[t]||t})}function S(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(w(e.textContent,x));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,i=(r=e.attributes).length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',w(o.value,E),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,i=(a=e.childNodes).length;n<i;++n)S(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",w(e.nodeValue,x),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function T(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}e.append=function(e,t){return n(t,e),e},e.attr=a,e.classes=function(e){return new u(e)},e.clear=d,e.clone=function(e){return e.cloneNode(!0)},e.create=v,e.innerSVG=function(e,t){if(void 0!==t){try{!function(e,t){var i,r=y(t).documentElement;if(d(e),t)for(i=r.firstChild;i;)n(i,e),i=i.nextSibling}(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}return function(e){for(var t=e.firstChild,n=[];t;)S(t,n),t=t.nextSibling;return n.join("")}(e)},e.remove=h,e.transform=function(e,t){var n=e.transform.baseVal;if(1===arguments.length)return n.consolidate();t.length?function(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(T(e,i));e.consolidate()}(n,t):n.initialize(T(n,t))},e.createMatrix=function(e,t,n,i,r,o){var a=g.createSVGMatrix();switch(arguments.length){case 0:return a;case 6:e={a:e,b:t,c:n,d:i,e:r,f:o}}return b(a,e)},e.createTransform=function(e){return e?g.createSVGTransformFromMatrix(e):g.createSVGTransform()},Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof n.exports?t(n.exports):t(e.TinySVG={});var i={},r=(n=n.exports).attr,o=n.create;function a(e){for(var t,n="",i=0;t=e[i];i++)n+=t.x+","+t.y+" ";return n}i.componentsToPath=function(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")},i.createLine=function(e,t){var n=o("polyline");return r(n,{points:a(e)}),t&&r(n,t),n},i.updateLine=function(e,t){return r(e,{points:a(t)}),e};var s={exports:{}};!function(e,t){"object"==typeof s.exports?t(s.exports):t(e.MinDash={})}(this,function(e){"use strict";var t=Object.prototype.toString,n=Object.prototype.hasOwnProperty;function i(e){return null==e}function r(e){return"[object Array]"===t.call(e)}function o(e){return"[object Object]"===t.call(e)}function a(e){return"[object Function]"===t.call(e)}function s(e){if(!r(e))throw new Error("must supply array")}function c(e,t){return n.call(e,t)}function p(e,t){var n;return t=b(t),l(e,function(e,i){if(t(e,i))return n=e,!1}),n}function l(e,t){if(!i(e)){var n=r(e)?E:x;for(var o in e){if(c(e,o))if(!1===t(e[o],n(o)))return}}}function u(e,t,n){return l(e,function(e,i){n=t(n,e,i)}),n}function h(e,t){return u(e,function(e,n,i){return e&&t(n,i)},!0)}function d(e,t){var n=[];return l(e,function(e,i){n.push(t(e,i))}),n}function m(e){return e&&Object.keys(e)||[]}function f(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=g(t),l(e,function(e){var i=t(e)||"_",r=n[i];r||(r=n[i]=[]),r.push(e)}),n}function y(e){e=g(e);for(var t={},n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return l(i,function(n){return f(n,e,t)}),d(t,function(e,t){return e[0]})}var v=y;function g(e){return a(e)?e:function(t){return t[e]}}function b(e){return a(e)?e:function(t){return t===e}}function x(e){return e}function E(e){return Number(e)}var _=Array.prototype.slice;var w=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};e.flatten=function(e){return Array.prototype.concat.apply([],e)},e.find=p,e.findIndex=function(e,t){t=b(t);var n=r(e)?-1:void 0;return l(e,function(e,i){if(t(e,i))return n=i,!1}),n},e.filter=function(e,t){var n=[];return l(e,function(e,i){t(e,i)&&n.push(e)}),n},e.forEach=l,e.without=function(e,t){return i(e)?[]:(s(e),t=b(t),e.filter(function(e,n){return!t(e,n)}))},e.reduce=u,e.every=h,e.some=function(e,t){return!!p(e,t)},e.map=d,e.keys=m,e.size=function(e){return m(e).length},e.values=function(e){return d(e,function(e){return e})},e.groupBy=f,e.uniqueBy=y,e.unionBy=v,e.sortBy=function(e,t){t=g(t);var n=[];return l(e,function(e,i){for(var r=t(e,i),o={d:r,v:e},a=0;a<n.length;a++)if(r<n[a].d)return void n.splice(a,0,o);n.push(o)}),d(n,function(e){return e.v})},e.matchPattern=function(e){return function(t){return h(e,function(e,n){return t[n]===e})}},e.debounce=function(e,t){var n;return function(){var i=_.call(arguments);n&&clearTimeout(n),n=setTimeout(function(){e.apply(void 0,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(i))},t)}},e.bind=function(e,t){return e.bind(t)},e.isArray=r,e.isObject=o,e.isNumber=function(e){return"[object Number]"===t.call(e)},e.isFunction=a,e.isString=function(e){return"[object String]"===t.call(e)},e.has=c,e.assign=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return w.apply(void 0,[e].concat(n))},e.pick=function(e,t){var n={},i=Object(e);return l(t,function(t){t in i&&(n[t]=e[t])}),n},e.omit=function(e,t){var n={};return l(Object(e),function(e,i){-1===t.indexOf(i)&&(n[i]=e)}),n},Object.defineProperty(e,"__esModule",{value:!0})});var c={},p=(s=s.exports).every,l=s.some,u=i.componentsToPath;function h(e){return e.businessObject.di}c.isTypedEvent=function(e,t,n){return l(e.eventDefinitions,function(i){return i.$type===t&&function(e,t){return p(t,function(t,n){return e[n]==t})}(e,n)})},c.isThrowEvent=function(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type},c.isCollection=function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection},c.getDi=h,c.getSemantic=function(e){return e.businessObject},c.getFillColor=function(e,t){return h(e).get("bioc:fill")||t||"white"},c.getStrokeColor=function(e,t){return h(e).get("bioc:stroke")||t||"black"},c.getCirclePath=function(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2;return u([["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]])},c.getRoundRectPath=function(e,t){var n=e.x,i=e.y,r=e.width,o=e.height;return u([["M",n+t,i],["l",r-2*t,0],["a",t,t,0,0,1,t,t],["l",0,o-2*t],["a",t,t,0,0,1,-t,t],["l",2*t-r,0],["a",t,t,0,0,1,-t,-t],["l",0,2*t-o],["a",t,t,0,0,1,t,-t],["z"]])},c.getDiamondPath=function(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2;return u([["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]])},c.getRectPath=function(e){var t=e.x,n=e.y,i=e.width,r=e.height;return u([["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]])};var d={};function m(e){return e&&e.businessObject||e}d.is=function(e,t){var n=m(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)},d.getBusinessObject=m;var f={},y=d.is,v=d.getBusinessObject,g=s.forEach;function b(e,t){var n=v(e),i=!1;return n.eventDefinitions&&g(n.eventDefinitions,function(e){y(e,t)&&(i=!0)}),i}f.isExpanded=function(e){return!y(e,"bpmn:CallActivity")&&(y(e,"bpmn:SubProcess")?!!v(e).di.isExpanded:!y(e,"bpmn:Participant")||!!v(e).processRef)},f.isInterrupting=function(e){return e&&!1!==v(e).isInterrupting},f.isEventSubProcess=function(e){return e&&!!v(e).triggeredByEvent},f.hasErrorEventDefinition=function(e){return b(e,"bpmn:ErrorEventDefinition")},f.hasEscalationEventDefinition=function(e){return b(e,"bpmn:EscalationEventDefinition")},f.hasCompensateEventDefinition=function(e){return b(e,"bpmn:CompensateEventDefinition")};var x=1e3;function E(e,t){var n=this;t=t||x,e.on(["render.shape","render.connection"],t,function(e,t){var i=e.type,r=t.element,o=t.gfx;if(n.canRender(r))return"render.shape"===i?n.drawShape(o,r):n.drawConnection(o,r)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(e,t){if(n.canRender(t))return"render.getShapePath"===e.type?n.getShapePath(t):n.getConnectionPath(t)})}E.prototype.canRender=function(){},E.prototype.drawShape=function(){},E.prototype.drawConnection=function(){},E.prototype.getShapePath=function(){},E.prototype.getConnectionPath=function(){};var _=E,w={},S=n.transform,T=n.createTransform;w.transform=function(e,t,n,i,r){var o=T();o.setTranslate(t,n);var a=T();a.setRotate(i,0,0);var s=T();s.setScale(r||1,r||1),S(e,[o,a,s])},w.translate=function(e,t,n){var i=T();i.setTranslate(t,n),S(e,i)},w.rotate=function(e,t){var n=T();n.setRotate(t,0,0),S(e,n)};var C=s.isObject,A=s.assign,R=s.pick,P=s.forEach,M=s.reduce,k=n.append,B=n.attr,N=n.create,D=n.remove,O=0,L={width:150,height:50};function I(e,t){t.textContent=e;try{var n,i=""===e;return t.textContent=i?"dummy":e,n=R(t.getBBox(),["width","height"]),i&&(n.width=0),n}catch(e){return{width:0,height:0}}}function j(e,t,n){for(var i,r=e.shift(),o=r;;){if((i=I(o,n)).width=o?i.width:0," "===o||""===o||i.width<Math.round(t)||o.length<2)return z(e,o,r,i);o=F(o,i.width,t)}}function z(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}function F(e,t,n){var i=Math.max(e.length*(n/t),1),r=function(e,t){var n,i=e.split(/(\s|-)/g),r=[],o=0;if(i.length>1)for(;n=i.shift();){if(!(n.length+o<t)){"-"===n&&r.pop();break}r.push(n),o+=n.length}return r.join("")}(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function $(e){this._config=A({},{size:L,padding:O,style:{},align:"center-top"},e||{})}$.prototype.createText=function(e,t){return this.layoutText(e,t).element},$.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},$.prototype.layoutText=function(e,t){var n=A({},this._config.size,t.box),i=A({},this._config.style,t.style),r=function(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}(t.align||this._config.align),o=function(e){return C(e)?A({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}(void 0!==t.padding?t.padding:this._config.padding),a=t.fitBox||!1,s=e.split(/\r?\n/g),c=[],p=n.width-o.left-o.right,l=N("text");B(l,{x:0,y:0}),B(l,i);var u=function(){var e=document.getElementById("helper-svg");return e||(e=N("svg"),B(e,{id:"helper-svg",width:0,height:0,style:"visibility: hidden; position: fixed"}),document.body.appendChild(e)),e}();for(k(u,l);s.length;)c.push(j(s,p,l));var h,d,m=M(c,function(e,t,n){return e+t.height},0),f=M(c,function(e,t,n){return t.width>e?t.width:e},0);switch(r.vertical){case"middle":h=(n.height-m)/2-c[0].height/4;break;default:h=o.top}var y=N("text");return B(y,i),P(c,function(e){switch(h+=e.height,r.horizontal){case"left":d=o.left;break;case"right":d=(a?f:p)-o.right-e.width;break;default:d=Math.max(((a?f:p)-e.width)/2+o.left,0)}var t=N("tspan");B(t,{x:d,y:h}),t.textContent=e.text,k(y,t)}),D(l),{dimensions:{width:f,height:m},element:y}};var G=$,W={},H=W=function(e,t){if(t||(t=16),void 0===e&&(e=128),e<=0)return"0";for(var n=Math.log(Math.pow(2,e))/Math.log(t),i=2;n===1/0;i*=2)n=Math.log(Math.pow(2,e/i))/Math.log(t)*i;var r=n-Math.floor(n),o="";for(i=0;i<Math.floor(n);i++){o=Math.floor(Math.random()*t).toString(t)+o}if(r){var a=Math.pow(t,r);o=Math.floor(Math.random()*a).toString(t)+o}var s=parseInt(o,t);return s!==1/0&&s>=Math.pow(2,e)?H(e,t):o};function V(e){if(!(this instanceof V))return new V(e);e=e||[128,36,1],this._seed=e.length?W.rack(e[0],e[1],e[2]):e}H.rack=function(e,t,n){var i=function(i){var o=0;do{if(o++>10){if(!n)throw new Error("too many ID collisions, use more bits");e+=n}var a=H(e,t)}while(Object.hasOwnProperty.call(r,a));return r[a]=i,a},r=i.hats={};return i.get=function(e){return i.hats[e]},i.set=function(e,t){return i.hats[e]=t,i},i.bits=e||128,i.base=t||16,i};var q=V;V.prototype.next=function(e){return this._seed(e||!0)},V.prototype.nextPrefixed=function(e,t){var n;do{n=e+this.next(!0)}while(this.assigned(n));return this.claim(n,t),n},V.prototype.claim=function(e,t){this._seed.set(e,t||!0)},V.prototype.assigned=function(e){return this._seed.get(e)||!1},V.prototype.unclaim=function(e){delete this._seed.hats[e]},V.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};var U={};U="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};var Y={exports:{}};!function(e,t){"object"==typeof Y.exports?t(Y.exports):t(e.MinDom={})}(this,function(e){"use strict";var t=[].indexOf,n=function(e,n){if(t)return e.indexOf(n);for(var i=0;i<e.length;++i)if(e[i]===n)return i;return-1},i=/\s+/,r=Object.prototype.toString;function o(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}o.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~n(t,e)||t.push(e),this.el.className=t.join(" "),this},o.prototype.remove=function(e){if("[object RegExp]"==r.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),i=n(t,e);return~i&&t.splice(i,1),this.el.className=t.join(" "),this},o.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},o.prototype.toggle=function(e,t){return this.list?(void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},o.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(i);return""===e[0]&&e.shift(),e},o.prototype.has=o.prototype.contains=function(e){return this.list?this.list.contains(e):!!~n(this.array(),e)};var a=Element.prototype,s=a.matchesSelector||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector,c=function(e,t){if(s)return s.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;++i)if(n[i]==e)return!0;return!1};var p,l=function(e,t,n){for(var i=n?e:e.parentNode;i&&i!==document;){if(c(i,t))return i;i=i.parentNode}},u=window.addEventListener?"addEventListener":"attachEvent",h=window.removeEventListener?"removeEventListener":"detachEvent",d="addEventListener"!==u?"on":"",m={bind:function(e,t,n,i){return e[u](d+t,n,i||!1),n},unbind:function(e,t,n,i){return e[h](d+t,n,i||!1),n}},f=["focus","blur"],y={bind:function(e,t,n,i,r){return-1!==f.indexOf(n)&&(r=!0),m.bind(e,n,function(n){var r=n.target||n.srcElement;n.delegateTarget=l(r,t,!0),n.delegateTarget&&i.call(e,n)},r)},unbind:function(e,t,n,i){-1!==f.indexOf(t)&&(i=!0),m.unbind(e,t,n,i)}},v=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var i=n[1];if("body"==i){var r=t.createElement("html");return r.innerHTML=e,r.removeChild(r.lastChild)}var o=b[i]||b._default,a=o[0],s=o[1],c=o[2];(r=t.createElement("div")).innerHTML=s+e+c;for(;a--;)r=r.lastChild;if(r.firstChild==r.lastChild)return r.removeChild(r.firstChild);var p=t.createDocumentFragment();for(;r.firstChild;)p.appendChild(r.removeChild(r.firstChild));return p},g=!1;"undefined"!=typeof document&&((p=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',g=!p.getElementsByTagName("link").length,p=void 0);var b={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:g?[1,"X<div>","</div>"]:[0,"",""]};b.td=b.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],b.option=b.optgroup=[1,'<select multiple="multiple">',"</select>"],b.thead=b.tbody=b.colgroup=b.caption=b.tfoot=[1,"<table>","</table>"],b.polyline=b.ellipse=b.polygon=b.circle=b.text=b.line=b.path=b.rect=b.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var x="undefined"!=typeof Element?Element.prototype:{},E=x.matches||x.matchesSelector||x.webkitMatchesSelector||x.mozMatchesSelector||x.msMatchesSelector||x.oMatchesSelector,_=function(e,t){if(!e||1!==e.nodeType)return!1;if(E)return E.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;i++)if(n[i]==e)return!0;return!1};e.attr=function(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)},e.classes=function(e){return new o(e)},e.clear=function(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e},e.closest=l,e.delegate=y,e.domify=v,e.event=m,e.matches=_,e.query=function(e,t){return(t=t||document).querySelector(e)},e.queryAll=function(e,t){return(t=t||document).querySelectorAll(e)},e.remove=function(e){e.parentNode&&e.parentNode.removeChild(e)},Object.defineProperty(e,"__esModule",{value:!0})}),Y=Y.exports;var K=s.isObject,X=s.assign,Z=s.forEach,Q=d.is,J=i.createLine,ee=c.isTypedEvent,te=c.isThrowEvent,ne=c.isCollection,ie=c.getDi,re=c.getSemantic,oe=c.getCirclePath,ae=c.getRoundRectPath,se=c.getDiamondPath,ce=c.getRectPath,pe=c.getFillColor,le=c.getStrokeColor,ue=Y.query,he=n.append,de=n.attr,me=n.create,fe=n.classes,ye=w.rotate,ve=w.transform,ge=w.translate,be=new q,xe=10,Ee=3,_e={fontFamily:"Arial, sans-serif",fontSize:12},we=.95,Se=.35;function Te(e,t,n,i,r){_.call(this,e,r);var o=be.next(),a=new G({style:_e,size:{width:100}}),s={},c=t.computeStyle;function p(e,t){var n=X({fill:"black",strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),r=t.ref||{x:0,y:0},o=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var a=me("marker");de(t.element,n),he(a,t.element),de(a,{id:e,viewBox:"0 0 20 20",refX:r.x,refY:r.y,markerWidth:20*o,markerHeight:20*o,orient:"auto"});var c=ue("defs",i._svg);c||(c=me("defs"),he(i._svg,c)),he(c,a),s[e]=a}function l(e,t,n){var i=e+"-"+t+"-"+n+"-"+o;return s[i]||function(e,t,n){var i=e+"-"+t+"-"+n+"-"+o;if("sequenceflow-end"===e){var r=me("path");de(r,{d:"M 1 5 L 11 10 L 1 15 Z"}),p(i,{element:r,ref:{x:11,y:10},scale:.5,attrs:{fill:n,stroke:n}})}if("messageflow-start"===e){var a=me("circle");de(a,{cx:6,cy:6,r:3.5}),p(i,{element:a,attrs:{fill:t,stroke:n},ref:{x:6,y:6}})}if("messageflow-end"===e){var s=me("path");de(s,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),p(i,{element:s,attrs:{fill:t,stroke:n,strokeLinecap:"butt"},ref:{x:8.5,y:5}})}if("association-start"===e){var c=me("path");de(c,{d:"M 11 5 L 1 10 L 11 15"}),p(i,{element:c,attrs:{fill:"none",stroke:n,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}if("association-end"===e){var l=me("path");de(l,{d:"M 1 5 L 11 10 L 1 15"}),p(i,{element:l,attrs:{fill:"none",stroke:n,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}if("conditional-flow-marker"===e){var u=me("path");de(u,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),p(i,{element:u,attrs:{fill:t,stroke:n},ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===e){var h=me("path");de(h,{d:"M 6 4 L 10 16"}),p(i,{element:h,attrs:{stroke:n},ref:{x:0,y:10},scale:.5})}}(e,t,n),"url(#"+i+")"}function u(e,t,n,i,r){K(i)&&(r=i,i=0),i=i||0,r=c(r,{stroke:"black",strokeWidth:2,fill:"white"});var o=t/2,a=n/2,s=me("circle");return de(s,{cx:o,cy:a,r:Math.round((t+n)/4-i)}),de(s,r),he(e,s),s}function h(e,t,n,i,r,o){K(r)&&(o=r,r=0),r=r||0,o=c(o,{stroke:"black",strokeWidth:2,fill:"white"});var a=me("rect");return de(a,{x:r,y:r,width:t-2*r,height:n-2*r,rx:i,ry:i}),de(a,o),he(e,a),a}function d(e,t,n){n=c(n,["no-fill"],{stroke:"black",strokeWidth:2,fill:"none"});var i=J(t,n);return he(e,i),i}function m(e,t,n){n=c(n,["no-fill"],{strokeWidth:2,stroke:"black"});var i=me("path");return de(i,{d:t}),de(i,n),he(e,i),i}function y(e,t,n,i){return m(t,n,X({"data-marker":e},i))}function v(e){return function(t,n){return T[e](t,n)}}function g(e){return T[e]}function b(e,t){var n=re(e),i=te(n);return ee(n,"bpmn:MessageEventDefinition")?g("bpmn:MessageEventDefinition")(t,e,i):ee(n,"bpmn:TimerEventDefinition")?g("bpmn:TimerEventDefinition")(t,e,i):ee(n,"bpmn:ConditionalEventDefinition")?g("bpmn:ConditionalEventDefinition")(t,e):ee(n,"bpmn:SignalEventDefinition")?g("bpmn:SignalEventDefinition")(t,e,i):ee(n,"bpmn:CancelEventDefinition")&&ee(n,"bpmn:TerminateEventDefinition",{parallelMultiple:!1})?g("bpmn:MultipleEventDefinition")(t,e,i):ee(n,"bpmn:CancelEventDefinition")&&ee(n,"bpmn:TerminateEventDefinition",{parallelMultiple:!0})?g("bpmn:ParallelMultipleEventDefinition")(t,e,i):ee(n,"bpmn:EscalationEventDefinition")?g("bpmn:EscalationEventDefinition")(t,e,i):ee(n,"bpmn:LinkEventDefinition")?g("bpmn:LinkEventDefinition")(t,e,i):ee(n,"bpmn:ErrorEventDefinition")?g("bpmn:ErrorEventDefinition")(t,e,i):ee(n,"bpmn:CancelEventDefinition")?g("bpmn:CancelEventDefinition")(t,e,i):ee(n,"bpmn:CompensateEventDefinition")?g("bpmn:CompensateEventDefinition")(t,e,i):ee(n,"bpmn:TerminateEventDefinition")?g("bpmn:TerminateEventDefinition")(t,e,i):null}function x(e,t,n){var i=a.createText(t||"",n);return fe(i).add("djs-label"),he(e,i),i}function E(e,t,n){return x(e,re(t).name,{box:t,align:n,padding:5,style:{fill:le(t)}})}function w(e,t,n){var i=x(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:le(n)}}),r=-1*n.height;ve(i,0,-r,270)}function S(e){for(var t=e.waypoints,n="m "+t[0].x+","+t[0].y,i=1;i<t.length;i++)n+="L"+t[i].x+","+t[i].y+" ";return n}var T=this.handlers={"bpmn:Event":function(e,t,n){return"fillOpacity"in n||(n.fillOpacity=we),u(e,t.width,t.height,n)},"bpmn:StartEvent":function(e,t){var n={fill:pe(t),stroke:le(t)};re(t).isInterrupting||(n={strokeDasharray:"6",strokeLinecap:"round"});var i=g("bpmn:Event")(e,t,n);return b(t,e),i},"bpmn:MessageEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{strokeWidth:1,fill:i?le(t):pe(t),stroke:i?pe(t):le(t)})},"bpmn:TimerEventDefinition":function(e,t){var i=u(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:pe(t),stroke:le(t)});m(e,n.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{strokeWidth:2,strokeLinecap:"square",stroke:le(t)});for(var r=0;r<12;r++){var o=n.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),a=t.width/2;m(e,o,{strokeWidth:1,strokeLinecap:"square",transform:"rotate("+30*r+","+t.height/2+","+a+")",stroke:le(t)})}return i},"bpmn:EscalationEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:ConditionalEventDefinition":function(e,t){return m(e,n.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{strokeWidth:1,stroke:le(t)})},"bpmn:LinkEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:ErrorEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:CancelEventDefinition":function(e,t,i){var r=m(e,n.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{strokeWidth:1,fill:i?"black":"none"});return ye(r,45),r},"bpmn:CompensateEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:SignalEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:MultipleEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{strokeWidth:1,fill:i?"black":"none"})},"bpmn:ParallelMultipleEventDefinition":function(e,t){return m(e,n.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{strokeWidth:1,fill:le(t),stroke:le(t)})},"bpmn:EndEvent":function(e,t){var n=g("bpmn:Event")(e,t,{strokeWidth:4,fill:pe(t),stroke:le(t)});return b(t,e),n},"bpmn:TerminateEventDefinition":function(e,t){return u(e,t.width,t.height,8,{strokeWidth:4,fill:le(t),stroke:le(t)})},"bpmn:IntermediateEvent":function(e,t){var n=g("bpmn:Event")(e,t,{strokeWidth:1,fill:pe(t),stroke:le(t)});return u(e,t.width,t.height,Ee,{strokeWidth:1,fill:pe(t,"none"),stroke:le(t)}),b(t,e),n},"bpmn:IntermediateCatchEvent":v("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":v("bpmn:IntermediateEvent"),"bpmn:Activity":function(e,t,n){return"fillOpacity"in(n=n||{})||(n.fillOpacity=we),h(e,t.width,t.height,xe,n)},"bpmn:Task":function(e,t){var n={fill:pe(t),stroke:le(t)},i=g("bpmn:Activity")(e,t,n);return E(e,t,"center-middle"),C(e,t),i},"bpmn:ServiceTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{strokeWidth:1,fill:pe(t),stroke:le(t)}),m(e,n.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}}),{strokeWidth:0,fill:pe(t)}),m(e,n.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{strokeWidth:1,fill:pe(t),stroke:le(t)}),i},"bpmn:UserTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:pe(t),stroke:le(t)}),m(e,n.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:pe(t),stroke:le(t)}),m(e,n.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:le(t),stroke:le(t)}),i},"bpmn:ManualTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{strokeWidth:.5,fill:pe(t),stroke:le(t)}),i},"bpmn:SendTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{strokeWidth:1,fill:le(t),stroke:pe(t)}),i},"bpmn:ReceiveTask":function(e,t){var i,r=re(t),o=g("bpmn:Task")(e,t);return r.instantiate?(u(e,28,28,4.4,{strokeWidth:1}),i=n.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):i=n.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),m(e,i,{strokeWidth:1,fill:pe(t),stroke:le(t)}),o},"bpmn:ScriptTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:le(t)}),i},"bpmn:BusinessRuleTask":function(e,t){var i=g("bpmn:Task")(e,t),r=m(e,n.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}));de(r,{strokeWidth:1,fill:pe(t,"#aaaaaa"),stroke:le(t)});var o=m(e,n.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}));return de(o,{strokeWidth:1,stroke:le(t)}),i},"bpmn:SubProcess":function(e,t,n){n=X({fill:pe(t),stroke:le(t)},n);var i=g("bpmn:Activity")(e,t,n),r=f.isExpanded(t);return f.isEventSubProcess(t)&&de(i,{strokeDasharray:"1,2"}),E(e,t,r?"center-top":"center-middle"),r?C(e,t):C(e,t,["SubProcessMarker"]),i},"bpmn:AdHocSubProcess":function(e,t){return g("bpmn:SubProcess")(e,t)},"bpmn:Transaction":function(e,n){var i=g("bpmn:SubProcess")(e,n),r=t.style(["no-fill","no-events"],{stroke:le(n)});return h(e,n.width,n.height,xe-2,Ee,r),i},"bpmn:CallActivity":function(e,t){return g("bpmn:SubProcess")(e,t,{strokeWidth:5})},"bpmn:Participant":function(e,t){var n={fillOpacity:we,fill:pe(t),stroke:le(t)},i=g("bpmn:Lane")(e,t,n);f.isExpanded(t)?(d(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:le(t)}),w(e,re(t).name,t)):x(e,re(t).name,{box:t,align:"center-middle",style:{fill:le(t)}});return!!re(t).participantMultiplicity&&g("ParticipantMultiplicityMarker")(e,t),i},"bpmn:Lane":function(e,t,n){var i=h(e,t.width,t.height,0,X({fill:pe(t),fillOpacity:Se,stroke:le(t)},n)),r=re(t);"bpmn:Lane"===r.$type&&w(e,r.name,t);return i},"bpmn:InclusiveGateway":function(e,t){var n=g("bpmn:Gateway")(e,t);return u(e,t.width,t.height,.24*t.height,{strokeWidth:2.5,fill:pe(t),stroke:le(t)}),n},"bpmn:ExclusiveGateway":function(e,t){var i=g("bpmn:Gateway")(e,t),r=n.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return ie(t).isMarkerVisible&&m(e,r,{strokeWidth:1,fill:le(t),stroke:le(t)}),i},"bpmn:ComplexGateway":function(e,t){var i=g("bpmn:Gateway")(e,t);return m(e,n.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{strokeWidth:1,fill:le(t),stroke:le(t)}),i},"bpmn:ParallelGateway":function(e,t){var i=g("bpmn:Gateway")(e,t);return m(e,n.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{strokeWidth:1,fill:le(t),stroke:le(t)}),i},"bpmn:EventBasedGateway":function(e,t){var i=re(t),r=g("bpmn:Gateway")(e,t);u(e,t.width,t.height,.2*t.height,{strokeWidth:1,fill:"none",stroke:le(t)});var o=i.eventGatewayType,a=!!i.instantiate;if("Parallel"===o){var s=n.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),c=m(e,s);de(c,{strokeWidth:1,fill:"none"})}else if("Exclusive"===o){if(!a){var p=u(e,t.width,t.height,.26*t.height);de(p,{strokeWidth:1,fill:"none",stroke:le(t)})}!function(){var i=n.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}}),r={strokeWidth:2,fill:pe(t,"none"),stroke:le(t)};m(e,i,r)}()}return r},"bpmn:Gateway":function(e,t){var n={fill:pe(t),fillOpacity:we,stroke:le(t)};return function(e,t,n,i){var r=t/2,o=n/2,a=[{x:r,y:0},{x:t,y:o},{x:r,y:n},{x:0,y:o}].map(function(e){return e.x+","+e.y}).join(" ");i=c(i,{stroke:"black",strokeWidth:2,fill:"white"});var s=me("polygon");return de(s,{points:a}),de(s,i),he(e,s),s}(e,t.width,t.height,n)},"bpmn:SequenceFlow":function(e,t){var n,i=S(t),r=pe(t),o=le(t),a=m(e,i,{strokeLinejoin:"round",markerEnd:l("sequenceflow-end",r,o),stroke:le(t)}),s=re(t);return t.source&&(n=t.source.businessObject,s.conditionExpression&&n.$instanceOf("bpmn:Activity")&&de(a,{markerStart:l("conditional-flow-marker",r,o)}),n.default&&(n.$instanceOf("bpmn:Gateway")||n.$instanceOf("bpmn:Activity"))&&n.default===s&&de(a,{markerStart:l("conditional-default-flow-marker",r,o)})),a},"bpmn:Association":function(e,t,n){var i=re(t),r=pe(t),o=le(t);return n=X({strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:le(t)},n||{}),"One"!==i.associationDirection&&"Both"!==i.associationDirection||(n.markerEnd=l("association-end",r,o)),"Both"===i.associationDirection&&(n.markerStart=l("association-start",r,o)),d(e,t.waypoints,n)},"bpmn:DataInputAssociation":function(e,t){var n=pe(t),i=le(t);return g("bpmn:Association")(e,t,{markerEnd:l("association-end",n,i)})},"bpmn:DataOutputAssociation":function(e,t){var n=pe(t),i=le(t);return g("bpmn:Association")(e,t,{markerEnd:l("association-end",n,i)})},"bpmn:MessageFlow":function(e,t){var i=re(t),r=ie(t),o=pe(t),a=le(t),s=m(e,S(t),{markerEnd:l("messageflow-end",o,a),markerStart:l("messageflow-start",o,a),strokeDasharray:"10, 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px",stroke:le(t)});if(i.messageRef){var c=s.getPointAtLength(s.getTotalLength()/2),p=n.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:c.x,y:c.y}}),u={strokeWidth:1};"initiating"===r.messageVisibleKind?(u.fill="white",u.stroke="black"):(u.fill="#888",u.stroke="white"),m(e,p,u)}return s},"bpmn:DataObject":function(e,t){var i=m(e,n.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:pe(t),fillOpacity:we,stroke:le(t)}),r=re(t);return ne(r)&&function(e,t){var i=(t.height-16)/t.height,r=n.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.451,my:i}});m(e,r,{strokeWidth:2})}(e,t),i},"bpmn:DataObjectReference":v("bpmn:DataObject"),"bpmn:DataInput":function(e,t){var i=n.getRawPath("DATA_ARROW"),r=g("bpmn:DataObject")(e,t);return m(e,i,{strokeWidth:1}),r},"bpmn:DataOutput":function(e,t){var i=n.getRawPath("DATA_ARROW"),r=g("bpmn:DataObject")(e,t);return m(e,i,{strokeWidth:1,fill:"black"}),r},"bpmn:DataStoreReference":function(e,t){return m(e,n.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{strokeWidth:2,fill:pe(t),fillOpacity:we,stroke:le(t)})},"bpmn:BoundaryEvent":function(e,t){var n=re(t).cancelActivity,i={strokeWidth:1,fill:pe(t),stroke:le(t),fillOpacity:1};n||(i.strokeDasharray="6",i.strokeLinecap="round");var r=g("bpmn:Event")(e,t,i);return u(e,t.width,t.height,Ee,X(i,{fill:"none"})),b(t,e),r},"bpmn:Group":function(e,t){return h(e,t.width,t.height,xe,{strokeWidth:1,strokeDasharray:"8,3,1,3",fill:"none",pointerEvents:"none"})},label:function(e,t){return function(e,t){var n=re(t),i={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return x(e,n.name,{box:i,fitBox:!0,style:{fontSize:"11px"}})}(e,t)},"bpmn:TextAnnotation":function(e,t){var i=h(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return m(e,n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:le(t)}),x(e,re(t).text||"",{box:t,align:"left-top",padding:5}),i},ParticipantMultiplicityMarker:function(e,t){y("participant-multiplicity",e,n.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:t.width/2/t.width,my:(t.height-15)/t.height}}))},SubProcessMarker:function(e,t){var i=h(e,14,14,0,{strokeWidth:1,fill:pe(t),stroke:le(t)});ge(i,t.width/2-7.5,t.height-20),y("sub-process",e,n.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2-7.5)/t.width,my:(t.height-20)/t.height}}),{fill:pe(t),stroke:le(t)})},ParallelMarker:function(e,t,i){y("parallel",e,n.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.parallel)/t.width,my:(t.height-20)/t.height}}))},SequentialMarker:function(e,t,i){y("sequential",e,n.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.seq)/t.width,my:(t.height-19)/t.height}}))},CompensationMarker:function(e,t,i){y("compensation",e,n.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.compensation)/t.width,my:(t.height-13)/t.height}}),{strokeWidth:1})},LoopMarker:function(e,t,i){y("loop",e,n.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.loop)/t.width,my:(t.height-7)/t.height}}),{strokeWidth:1,fill:"none",strokeLinecap:"round",strokeMiterlimit:.5})},AdhocMarker:function(e,t,i){y("adhoc",e,n.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.adhoc)/t.width,my:(t.height-15)/t.height}}),{strokeWidth:1,fill:"black"})}};function C(e,t,n){var i,r=re(t),o=n&&-1!==n.indexOf("SubProcessMarker");i=o?{seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},Z(n,function(n){g(n)(e,t,i)}),r.isForCompensation&&g("CompensationMarker")(e,t,i),"bpmn:AdHocSubProcess"===r.$type&&g("AdhocMarker")(e,t,i);var a=r.loopCharacteristics,s=a&&a.isSequential;a&&(void 0===s&&g("LoopMarker")(e,t,i),!1===s&&g("ParallelMarker")(e,t,i),!0===s&&g("SequentialMarker")(e,t,i))}this._drawPath=m}U(Te,_),Te.$inject=["eventBus","styles","pathMap","canvas"];var Ce=Te;Te.prototype.canRender=function(e){return Q(e,"bpmn:BaseElement")},Te.prototype.drawShape=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},Te.prototype.drawConnection=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},Te.prototype.getShapePath=function(e){return Q(e,"bpmn:Event")?oe(e):Q(e,"bpmn:Activity")?ae(e,xe):Q(e,"bpmn:Gateway")?se(e):ce(e)};var Ae=function(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m {mx}, {my} m 0 15 l 0 -15 m 4 15 l 0 -15 m 4 15 l 0 -15 ",height:61,width:51,heightElements:[12],widthElements:[1,6,12,15]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,i,r=this.pathMap[e];t.abspos?(n=t.abspos.x,i=t.abspos.y):(n=t.containerWidth*t.position.mx,i=t.containerHeight*t.position.my);var o,a,s={};if(t.position){for(var c=t.containerHeight/r.height*t.yScaleFactor,p=t.containerWidth/r.width*t.xScaleFactor,l=0;l<r.heightElements.length;l++)s["y"+l]=r.heightElements[l]*c;for(var u=0;u<r.widthElements.length;u++)s["x"+u]=r.widthElements[u]*p}return o=r.d,a={mx:n,my:i,e:s},String(o).replace(Re,function(e,t){return function(e,t,n){var i=n;return t.replace(Pe,function(e,t,n,r,o){t=t||r,i&&(t in i&&(i=i[t]),"function"==typeof i&&o&&(i=i()))}),i=(null==i||i==n?e:i)+""}(e,t,a)})}},Re=/\{([^}]+)\}/g,Pe=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Me={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ce],pathMap:["type",Ae]},ke={elementToString:function(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}},Be={},Ne=s.assign,De=d.is,Oe=Be.DEFAULT_LABEL_SIZE={width:90,height:20},Le=15;function Ie(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=je(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=Le:a+=Le,{x:a,y:s}}function je(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function ze(e){return e.waypoints?Ie(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+Oe.height/2}}Be.hasExternalLabel=function(e){return De(e,"bpmn:Event")||De(e,"bpmn:Gateway")||De(e,"bpmn:DataStoreReference")||De(e,"bpmn:DataObjectReference")||De(e,"bpmn:SequenceFlow")||De(e,"bpmn:MessageFlow")},Be.getExternalLabelMid=ze,Be.getExternalLabelBounds=function(e,t){var n,i,r,o=e.di.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Oe.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=ze(t),i=Oe),Ne({x:n.x-i.width/2,y:n.y-i.height/2},i)};var Fe=s.assign,$e=s.map,Ge=d.is,We=Be.hasExternalLabel,He=Be.getExternalLabelBounds,Ve=f.isExpanded,qe=ke.elementToString;function Ue(e,t){return Fe({id:e.id,type:e.$type,businessObject:e},t)}function Ye(e,t,n,i){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:qe(n),referenced:qe(t),property:i}))}function Ke(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._translate=r,this._textUtil=new G}Ke.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate"];var Xe=Ke;Ke.prototype.add=function(e,t){var n,i,r,o,a=e.di,s=this._translate;if(Ge(a,"bpmndi:BPMNPlane"))n=this._elementFactory.createRoot(Ue(e)),this._canvas.setRootElement(n);else if(Ge(a,"bpmndi:BPMNShape")){var c=!Ve(e);i=t&&(t.hidden||t.collapsed);var p=e.di.bounds;n=this._elementFactory.createShape(Ue(e,{collapsed:c,hidden:i,x:Math.round(p.x),y:Math.round(p.y),width:Math.round(p.width),height:Math.round(p.height)})),Ge(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,n),Ge(e,"bpmn:Lane")&&(r=0),this._canvas.addShape(n,t,r)}else{if(!Ge(a,"bpmndi:BPMNEdge"))throw new Error(s("unknown di {di} for element {semantic}",{di:qe(a),semantic:qe(e)}));var l=this._getSource(e),u=this._getTarget(e);i=t&&(t.hidden||t.collapsed),n=this._elementFactory.createConnection(Ue(e,{hidden:i,source:l,target:u,waypoints:(o=e.di.waypoint,$e(o,function(e){return{x:e.x,y:e.y}}))})),Ge(e,"bpmn:DataAssociation")&&(t=null),Ge(e,"bpmn:SequenceFlow")&&(r=0),this._canvas.addConnection(n,t,r)}return We(e)&&this.addLabel(e,n),this._eventBus.fire("bpmnElement.added",{element:n}),n},Ke.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:qe(e)}));var r=this._elementRegistry.get(i.id),o=r&&r.attachers;if(!r)throw Ye(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},Ke.prototype.addLabel=function(e,t){var n,i,r;return n=He(e,t),(i=e.name)&&(n=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:Ze});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(n,i,this._textUtil)),r=this._elementFactory.createLabel(Ue(e,{id:e.id+"_label",labelTarget:t,type:"label",hidden:t.hidden||!e.name,x:Math.round(n.x),y:Math.round(n.y),width:Math.round(n.width),height:Math.round(n.height)})),this._canvas.addShape(r,t.parent)},Ke.prototype._getEnd=function(e,t){var n,i,r=e.$type,o=this._translate;if(i=e[t+"Ref"],"source"===t&&"bpmn:DataInputAssociation"===r&&(i=i&&i[0]),("source"===t&&"bpmn:DataOutputAssociation"===r||"target"===t&&"bpmn:DataInputAssociation"===r)&&(i=e.$parent),n=i&&this._getElement(i))return n;throw i?Ye(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:qe(e),side:t}))},Ke.prototype._getSource=function(e){return this._getEnd(e,"source")},Ke.prototype._getTarget=function(e){return this._getEnd(e,"target")},Ke.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var Ze={fontFamily:"Arial, sans-serif",fontSize:"11px"};var Qe={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(e,n){return t[n]||"{"+n+"}"})}]},Je={__depends__:[Me,{__depends__:[Qe],bpmnImporter:["type",Xe]}]},et={};function tt(e,t,n){Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:et.extend(n[t.name]||[],e,t,n)})}function nt(e,t){if(!(this instanceof nt))return new nt(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}et.extend=function(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(e){var n=this.indexOf(e);return-1!==n&&(this.splice(n,1),t.unset(e,r,i)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e){this.contains(e)||(this.push(e),t.set(e,r,i))}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},et.isExtended=function(e){return!0===e.__refs_collection},nt.prototype.bind=function(e,t){if("string"==typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?tt(this,t,e):function(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{enumerable:t.enumerable,get:function(){return r},set:function(t){if(t!==r){var o=r;r=null,o&&e.unset(o,i,n),r=t,e.set(r,i,n)}}})}(this,t,e)},nt.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return et.isExtended(n)||tt(this,t,e),n},nt.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},nt.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},nt.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var it={};(it=nt).Collection=et;var rt=s.filter,ot=s.find,at=s.forEach,st=ke.elementToString,ct=new it({name:"bpmnElement",enumerable:!0},{name:"di"});function pt(e,t){return e.$instanceOf(t)}var lt=function(e,t){var n={},i=[];function r(e,t){return function(n){e(n,t)}}function o(e){n[e.id]=e}function a(n,i){try{var r=n.di&&function(n,i){if(n.gfx)throw new Error(t("already rendered {element}",{element:st(n)}));return e.element(n,i)}(n,i);return o(n),r}catch(e){s(e.message,{element:n,error:e}),console.error(t("failed to import {element}",{element:st(n)})),console.error(e)}}function s(t,n){e.error(t,n)}function c(e){var n=e.bpmnElement;n?n.di?s(t("multiple DI elements defined for {element}",{element:st(n)}),{element:n}):(ct.bind(n,"di"),n.di=e):s(t("no bpmnElement referenced in {element}",{element:st(e)}),{element:e})}function p(e){var t;c(t=e.plane),at(t.planeElement,l)}function l(e){c(e)}function u(e,t){w(e,t),g(e.ioSpecification,t),v(e.artifacts,t),o(e)}function h(e,t){a(e,t)}function d(e,t){a(e,t)}function m(e,t){a(e,t)}function f(e,t){a(e,t)}function y(e,t){a(e,t)}function v(e,t){at(e,function(e){pt(e,"bpmn:Association")?i.push(function(){y(e,t)}):y(e,t)})}function g(e,t){e&&(at(e.dataInputs,r(m,t)),at(e.dataOutputs,r(f,t)))}function b(e,t){var n=a(e,t);pt(e,"bpmn:SubProcess")&&function(e,t){w(e,t),v(e.artifacts,t)}(e,n||t),pt(e,"bpmn:Activity")&&g(e.ioSpecification,t),i.push(function(){at(e.dataInputAssociations,r(d,t)),at(e.dataOutputAssociations,r(d,t))})}function x(e,t){a(e,t)}function E(e,t){i.push(function(){var n=a(e,t);e.childLaneSet&&_(e.childLaneSet,n||t),function(e){at(e.flowNodeRef,function(t){var n=t.get("lanes");n&&n.push(e)})}(e)})}function _(e,t){at(e.lanes,r(E,t))}function w(e,n){!function(e,n){at(e,function(e){pt(e,"bpmn:SequenceFlow")?i.push(function(){!function(e,t){a(e,t)}(e,n)}):pt(e,"bpmn:BoundaryEvent")?i.unshift(function(){!function(e,t){a(e,t)}(e,n)}):pt(e,"bpmn:FlowNode")?b(e,n):pt(e,"bpmn:DataObject")||(pt(e,"bpmn:DataStoreReference")?x(e,n):pt(e,"bpmn:DataObjectReference")?x(e,n):s(t("unrecognized flowElement {element} in context {context}",{element:st(e),context:n?st(n.businessObject):"null"}),{element:e,context:n}))})}(e.flowElements,n),e.laneSets&&function(e,t){at(e,r(_,t))}(e.laneSets,n)}function S(e,t){var n=a(e,t),i=e.processRef;i&&u(i,n||t)}return{handleDefinitions:function(o,a){var l=o.diagrams;if(a&&-1===l.indexOf(a))throw new Error(t("diagram not part of bpmn:Definitions"));if(!a&&l&&l.length&&(a=l[0]),!a)throw new Error(t("no diagram to display"));p(a);var d=a.plane;if(!d)throw new Error(t("no plane for {element}",{element:st(a)}));var m=d.bpmnElement;if(!m){if(!(m=function(e){return ot(e.rootElements,function(e){return pt(e,"bpmn:Process")||pt(e,"bpmn:Collaboration")})}(o)))throw new Error(t("no process or collaboration to display"));s(t("correcting missing bpmnElement on {plane} to {rootElement}",{plane:st(d),rootElement:st(m)})),d.bpmnElement=m,c(d)}var f,y,g=function(t,n){return e.root(t,n)}(m,d);if(pt(m,"bpmn:Process"))u(m,g);else{if(!pt(m,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:st(d),rootElement:st(m)}));at((y=m).participants,r(S)),v(y.artifacts),i.push(function(){var e,t;e=y.messageFlows,at(e,r(h,t))}),f=o.rootElements,rt(f,function(e){return!n[e.id]&&pt(e,"bpmn:Process")&&e.laneSets}).forEach(r(u))}!function(e){for(;e.length;)e.shift()()}(i)}}},ut={};ut.importBpmnDiagram=function(e,t,n){var i,r,o,a,s=[];try{i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("translate"),r.fire("import.render.start",{definitions:t}),function(e){new lt({root:function(e){return i.add(e)},element:function(e,t){return i.add(e,t)},error:function(e,t){s.push({message:e,context:t})}},o).handleDefinitions(e)}(t),r.fire("import.render.complete",{error:a,warnings:s})}catch(e){a=e}n(a,s)};var ht={},dt=Y.domify,mt=Y.delegate,ft='<img width="52" height="52" src="'+("data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 960"><path fill="#fff" d="M960 60v839c0 33-27 61-60 61H60c-33 0-60-27-60-60V60C0 27 27 0 60 0h839c34 0 61 27 61 60z"/><path fill="#52b415" d="M217 548a205 205 0 0 0-144 58 202 202 0 0 0-4 286 202 202 0 0 0 285 3 200 200 0 0 0 48-219 203 203 0 0 0-185-128zM752 6a206 206 0 0 0-192 285 206 206 0 0 0 269 111 207 207 0 0 0 111-260A204 204 0 0 0 752 6zM62 0A62 62 0 0 0 0 62v398l60 46a259 259 0 0 1 89-36c5-28 10-57 14-85l99 2 12 85a246 246 0 0 1 88 38l70-52 69 71-52 68c17 30 29 58 35 90l86 14-2 100-86 12a240 240 0 0 1-38 89l43 58h413c37 0 60-27 60-61V407a220 220 0 0 1-44 40l21 85-93 39-45-76a258 258 0 0 1-98 1l-45 76-94-39 22-85a298 298 0 0 1-70-69l-86 22-38-94 76-45a258 258 0 0 1-1-98l-76-45 40-94 85 22a271 271 0 0 1 41-47z"/></svg>'))+'" />';function yt(e){return e.join(";")}var vt,gt='<div class="bjs-powered-by-lightbox" style="'+yt(["z-index: 1001","position: fixed","top: 0","left: 0","right: 0","bottom: 0"])+'"><div class="backdrop" style="'+yt(["width: 100%","height: 100%","background: rgba(0,0,0,0.2)"])+'"></div><div class="notice" style="'+yt(["position: absolute","left: 50%","top: 40%","margin: 0 -130px","width: 260px","padding: 10px","background: white","border: solid 1px #AAA","border-radius: 3px","font-family: Helvetica, Arial, sans-serif","font-size: 14px","line-height: 1.2em"])+'"><a href="http://bpmn.io" target="_blank" style="float: left; margin-right: 10px">'+ft+'</a>Web-based tooling for BPMN, DMN and CMMN diagrams powered by <a href="http://bpmn.io" target="_blank">bpmn.io</a>.</div></div>';ht.open=function(){vt||(vt=dt(gt),mt.bind(vt,".backdrop","click",function(e){document.body.removeChild(vt)})),document.body.appendChild(vt)},ht.BPMNIO_IMG=ft;var bt={};bt.hasLowerCaseAlias=function(e){return e.xml&&"lowerCase"===e.xml.tagAlias},bt.DEFAULT_NS_MAP={xsi:"http://www.w3.org/2001/XMLSchema-instance"};var xt=bt.XSI_TYPE="xsi:type";function Et(e){return e.xml&&e.xml.serialize}function _t(){}bt.serializeAsType=function(e){return Et(e)===xt},bt.serializeAsProperty=function(e){return"property"===Et(e)},_t.prototype.get=function(e){return this.$model.properties.get(this,e)},_t.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};var wt=_t,St=s.forEach,Tt=s.bind;function Ct(e,t){this.model=e,this.properties=t}var At=Ct;Ct.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(wt.prototype);St(e.properties,function(e){e.isMany||void 0===e.default||(i[e.name]=e.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(e){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),St(e,Tt(function(e,t){this.set(t,e)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var Rt={};function Pt(e){this.model=e}Rt.parseName=function(e,t){var n,i,r=e.split(/:/);if(1===r.length)n=e,i=t;else{if(2!==r.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=r[1],i=r[0]}return{name:e=(i?i+":":"")+n,prefix:i,localName:n}};var Mt=Pt;function kt(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}Pt.prototype.set=function(e,t,n){var i=this.model.getPropertyDescriptor(e,t),r=i&&i.name;void 0===n?i?delete e[r]:delete e.$attrs[t]:i?r in e?e[r]=n:kt(e,i,n):e.$attrs[t]=n},Pt.prototype.get=function(e,t){var n=this.model.getPropertyDescriptor(e,t);if(!n)return e.$attrs[t];var i=n.name;return!e[i]&&n.isMany&&kt(e,n,[]),e[i]},Pt.prototype.define=function(e,t,n){Object.defineProperty(e,t,n)},Pt.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Pt.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})};var Bt=s.pick,Nt=s.assign,Dt=s.forEach,Ot=s.bind,Lt=Rt.parseName;function It(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}var jt=It;It.prototype.build=function(){return Bt(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},It.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var i=this.properties;void 0!==t?i.splice(t,0,e):i.push(e)},It.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(-1===s)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},It.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Lt(r[0],i),a=Lt(r[1],o.prefix).name,s=this.propertiesByName[a];if(!s)throw new Error("refined property <"+a+"> not found");this.replaceProperty(s,e,n),delete e.redefines},It.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},It.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},It.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},It.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},It.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},It.prototype.hasProperty=function(e){return this.propertiesByName[e]},It.prototype.addTrait=function(e,t){var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(Dt(e.properties,Ot(function(n){n=Nt({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var i=n.replaces,r=n.redefines;i||r?this.redefineProperty(n,i||r,i):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))},this)),i.push(e),n[r]=e)};var zt={},Ft={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},$t={String:function(e){return e},Boolean:function(e){return"true"===e},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e,10)}};zt.coerceType=function(e,t){var n=$t[e];return n?n(t):t},zt.isBuiltIn=function(e){return!!Ft[e]},zt.isSimple=function(e){return!!$t[e]};var Gt=s.assign,Wt=s.forEach,Ht=s.bind,Vt=Rt.parseName,qt=zt.isBuiltIn;function Ut(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,Wt(e,Ht(this.registerPackage,this))}var Yt=Ut;function Kt(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}Ut.prototype.getPackage=function(e){return this.packageMap[e]},Ut.prototype.getPackages=function(){return this.packages},Ut.prototype.registerPackage=function(e){e=Gt({},e);var t=this.packageMap;Kt(t,e,"prefix"),Kt(t,e,"uri"),Wt(e.types,Ht(function(t){this.registerType(t,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ut.prototype.registerType=function(e,t){e=Gt({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:Gt(e.meta||{})});var n=Vt(e.name,t.prefix),i=n.name,r={};Wt(e.properties,Ht(function(e){var t=Vt(e.name,n.prefix),i=t.name;qt(e.type)||(e.type=Vt(e.type,t.prefix).name),Gt(e,{ns:t,name:i}),r[i]=e},this)),Gt(e,{ns:n,name:i,propertiesByName:r}),Wt(e.extends,Ht(function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Ut.prototype.mapTypes=function(e,t,n){var i=qt(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(e){return a(e,!0)}function a(n,i){var o=Vt(n,qt(n)?"":e.prefix);r.mapTypes(o,t,i)}if(!i)throw new Error("unknown type <"+e.name+">");Wt(i.superClass,n?o:a),t(i,!n),Wt(i.traits,o)},Ut.prototype.getEffectiveDescriptor=function(e){var t=Vt(e),n=new jt(t);this.mapTypes(t,function(e,t){n.addTrait(e,t)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Ut.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};var Xt=s.isString,Zt=s.isObject,Qt=s.forEach,Jt=Rt.parseName;function en(e){this.properties=new Mt(this),this.factory=new At(this,this.properties),this.registry=new Yt(e,this.properties),this.typeCache={}}var tn=en;en.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},en.prototype.getType=function(e){var t=this.typeCache,n=Xt(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},en.prototype.createAny=function(e,t,n){var i=Jt(e),r={$type:e,$instanceOf:function(e){return e===this.$type}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),Qt(n,function(e,t){Zt(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e}),r},en.prototype.getPackage=function(e){return this.registry.getPackage(e)},en.prototype.getPackages=function(){return this.registry.getPackages()},en.prototype.getElementDescriptor=function(e){return e.$descriptor},en.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},en.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},en.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var nn=tn,rn={exports:{}};!function(e,t){"object"==typeof rn.exports?t(rn.exports):t(e.Saxen={})}(this,function(e){"use strict";var t=String.fromCharCode,n=Object.prototype.hasOwnProperty,i=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,r={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function o(e,i,o,a){return a?n.call(r,a)?r[a]:"&"+a+";":t(i||parseInt(o,16))}function a(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(i,o):e}Object.keys(r).forEach(function(e){r[e.toUpperCase()]=r[e]});var s="http://www.w3.org/2001/XMLSchema-instance",c="xsi",p="xsi:type";function l(e){return new Error(e)}function u(e){return"missing namespace for prefix <"+e+">"}function h(e){return{get:e,enumerable:!0}}function d(e){var t,n={};for(t in e)n[t]=e[t];return n}function m(e){return e+"$uri"}function f(){return{line:0,column:0}}function y(e){throw e}e.Parser=function e(t){if(!this)return new e(t);var n,i,r,o,v,g,b,x,E,_=t&&t.proxy,w=y,S=f,T=!1,C=!1,A=null,R=!1;function P(e){e instanceof Error||(e=l(e)),A=e,w(e,S)}function M(e){v&&(e instanceof Error||(e=l(e)),v(e,S))}this.on=function(e,t){if("function"!=typeof t)throw l("required args <name, cb>");switch(e){case"openTag":i=t;break;case"text":n=t;break;case"closeTag":r=t;break;case"error":w=t;break;case"warn":v=t;break;case"cdata":o=t;break;case"attention":x=t;break;case"question":b=t;break;case"comment":g=t;break;default:throw l("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw l("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n[s]=c,C=!0,E=n,this},this.parse=function(e){if("string"!=typeof e)throw l("required args <xml=string>");return A=null,function(e){var t,s,c,l,f,y,v,w,A,k,B=C?[]:null,N=C?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[m(n)]=t;return i}(E):null,D=[],O=0,L=!1,I=!1,j=0,z=0,F="",$=0;function G(){if(null!==k)return k;var e,t,n,i,r,o,s,c,l,h,f,y=C&&N.xmlns,v=C&&T?[]:null,g=$,b=F,x=b.length,_={},w={};e:for(;g<x;g++)if(l=!1,!(32===(h=b.charCodeAt(g))||h<14&&h>8)){for((h<65||h>122||h>90&&h<97)&&95!==h&&58!==h&&(M("illegal first char attribute name"),l=!0),f=g+1;f<x;f++)if(!((h=b.charCodeAt(f))>96&&h<123||h>64&&h<91||h>47&&h<59||46===h||45===h||95===h)){if(32===h||h<14&&h>8){M("missing attribute value"),g=f;continue e}if(61===h)break;M("illegal attribute name char"),l=!0}if("xmlns:xmlns"===(c=b.substring(g,f))&&(M("illegal declaration of xmlns"),l=!0),34===(h=b.charCodeAt(f+1)))-1===(f=b.indexOf('"',g=f+2))&&-1!==(f=b.indexOf("'",g))&&(M("attribute value quote missmatch"),l=!0);else if(39===h)-1===(f=b.indexOf("'",g=f+2))&&-1!==(f=b.indexOf('"',g))&&(M("attribute value quote missmatch"),l=!0);else for(M("missing attribute value quotes"),l=!0,f+=1;f<x&&!(32===(h=b.charCodeAt(f+1))||h<14&&h>8);f++);for(-1===f&&(M("missing closing quotes"),f=x,l=!0),l||(o=b.substring(g,f)),g=f;f+1<x&&!(32===(h=b.charCodeAt(f+1))||h<14&&h>8);f++)g===f&&(M("illegal character after attribute end"),l=!0);if(g=f+1,!l)if(c in w)M("attribute <"+c+"> already defined");else if(w[c]=!0,C)if(T){if(null!==(r="xmlns"===c?"xmlns":120===c.charCodeAt(0)&&"xmlns:"===c.substr(0,6)?c.substr(6):null)){if(e=a(o),t=m(r),!(s=E[e])){if("xmlns"===r||t in N&&N[t]!==e)do{s="ns"+O++}while(void 0!==N[s]);else s=r;E[e]=s}N[r]!==s&&(i||(N=d(N),i=!0),N[r]=s,"xmlns"===r&&(N[m(s)]=e,y=s),N[t]=e),_[c]=o;continue}v.push(c,o)}else-1!==(h=c.indexOf(":"))?(n=N[c.substring(0,h)])?((c=y===n?c.substr(h+1):n+c.substr(h))===p&&(-1!==(h=o.indexOf(":"))?(n=o.substring(0,h),n=N[n]||n,o=n+o.substring(h)):o=y+":"+o),_[c]=o):M(u(c.substring(0,h))):_[c]=o;else _[c]=o}if(T)for(g=0,x=v.length;g<x;g++){if(c=v[g++],o=v[g],-1!==(h=c.indexOf(":"))){if(!(n=N[c.substring(0,h)])){M(u(c.substring(0,h)));continue}(c=y===n?c.substr(h+1):n+c.substr(h))===p&&(-1!==(h=o.indexOf(":"))?(n=o.substring(0,h),n=N[n]||n,o=n+o.substring(h)):o=y+":"+o)}_[c]=o}return k=_}for(S=function(){for(var t,n,i=/(\r\n|\r|\n)/g,r=0,o=0,a=0,s=z;j>=a&&(t=i.exec(e))&&!((s=t[0].length+t.index)>j);)r+=1,a=s;return-1==j?(o=s,n=""):(o=j-a,n=-1==z?e.substring(j):e.substring(j,z+1)),{data:n,line:r,column:o}},_&&(A=Object.create({},{name:h(function(){return v}),originalName:h(function(){return w}),attrs:h(G),ns:h(function(){return N})}));-1!==z;){if(-1===(j=60===e.charCodeAt(z)?z:e.indexOf("<",z)))return D.length?P("unexpected end of file"):0===z?P("missing start tag"):void 0;if(z!==j&&n&&(n(e.substring(z,j),a,S),R))return;if(33!==(f=e.charCodeAt(j+1)))if(63!==f){if(-1==(z=e.indexOf(">",j+1)))return P("unclosed tag");if(k={},47===f){if(L=!1,I=!0,!D.length)return P("missing open tag");if(s=v=D.pop(),l=j+2+s.length,e.substring(j+2,l)!==s)return P("closing tag mismatch");for(;l<z;l++)if(!(32===(f=e.charCodeAt(l))||f>8&&f<14))return P("close tag")}else{if(47===e.charCodeAt(z-1)?(s=v=e.substring(j+1,z-1),L=!0,I=!0):(s=v=e.substring(j+1,z),L=!0,I=!1),!(f>96&&f<123||f>64&&f<91||95===f||58===f))return P("illegal first char nodeName");for(l=1,c=s.length;l<c;l++)if(!((f=s.charCodeAt(l))>96&&f<123||f>64&&f<91||f>47&&f<59||45===f||95===f)){if(32===f||f<14&&f>8){v=s.substring(0,l),k=null;break}return P("invalid nodeName")}I||D.push(v)}if(C){if(t=N,L&&(I||B.push(t),null===k&&(T=-1!==s.indexOf("xmlns",l))&&($=l,F=s,G(),T=!1)),w=v,-1!==(f=v.indexOf(":"))){if(!(y=N[v.substring(0,f)]))return P("missing namespace on <"+w+">");v=v.substr(f+1)}else y=N.xmlns;y&&(v=y+":"+v)}if(L&&($=l,F=s,i&&(_?i(A,a,I,S):i(v,G,a,I,S),R)))return;if(I){if(r&&(r(_?A:v,a,L,S),R))return;C&&(N=L?t:B.pop())}z+=1}else{if(-1===(z=e.indexOf("?>",j)))return P("unclosed question");if(b&&(b(e.substring(j,z+2),S),R))return;z+=2}else{if(91===(f=e.charCodeAt(j+2))&&"CDATA["===e.substr(j+3,6)){if(-1===(z=e.indexOf("]]>",j)))return P("unclosed cdata");if(o&&(o(e.substring(j+9,z),S),R))return;z+=3;continue}if(45===f&&45===e.charCodeAt(j+3)){if(-1===(z=e.indexOf("--\x3e",j)))return P("unclosed comment");if(g&&(g(e.substring(j+4,z),a,S),R))return;z+=3;continue}if(-1===(z=e.indexOf(">",j+1)))return P("unclosed tag");if(x&&(x(e.substring(j,z+1),a,S),R))return;z+=1}}}(e),S=f,R=!1,A},this.stop=function(){R=!0}},Object.defineProperty(e,"__esModule",{value:!0})}),rn=rn.exports;var on={};!function(e){"use strict";function t(){this.data=[null],this.top=0}function n(){return new t}t.prototype.clear=function(){return this.data=[null],this.top=0,this},t.prototype.length=function(){return this.top},t.prototype.peek=function(){return this.data[this.top]},t.prototype.pop=function(){return this.top>0?(this.top--,this.data.pop()):void 0},t.prototype.push=function(e){return this.data[++this.top]=e,this},void 0!==on?on=n:e.stack=n}(this);var an={},sn=s.forEach,cn=s.find,pn=s.assign,ln=rn.Parser,un=Rt.parseName,hn=zt.coerceType,dn=zt.isSimple,mn=bt.XSI_TYPE,fn=bt.serializeAsType,yn=bt.hasLowerCaseAlias;function vn(e,t){return yn(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function gn(e){return new Error(e)}function bn(e){return e.$descriptor}function xn(){}function En(){}function _n(){}function wn(e,t){this.property=e,this.context=t}function Sn(e,t){this.element=t,this.propertyDesc=e}function Tn(){}function Cn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function An(e,t,n){Cn.call(this,e,t,n)}function Rn(e,t,n){this.model=e,this.context=n}function Pn(e){e instanceof nn&&(e={model:e}),pn(this,{lax:!1},e)}xn.prototype.handleEnd=function(){},xn.prototype.handleText=function(){},xn.prototype.handleNode=function(){},En.prototype=Object.create(xn.prototype),En.prototype.handleNode=function(){return this},_n.prototype=Object.create(xn.prototype),_n.prototype.handleText=function(e){this.body=(this.body||"")+e},wn.prototype=Object.create(_n.prototype),wn.prototype.handleNode=function(e){if(this.element)throw gn("expected no sub nodes");return this.element=this.createReference(e),this},wn.prototype.handleEnd=function(){this.element.id=this.body},wn.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},Sn.prototype=Object.create(_n.prototype),Sn.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=hn(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},Tn.prototype=Object.create(_n.prototype),Tn.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t},Cn.prototype=Object.create(Tn.prototype),Cn.prototype.addReference=function(e){this.context.addReference(e)},Cn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=bn(t).bodyProperty;n&&void 0!==e&&(e=hn(n.type,e),t.set(n.name,e))},Cn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=bn(n),r=this.context,o=new n({});return sn(t,function(e,t){var n,a=i.propertiesByName[t];a&&a.isReference?a.isMany?(n=e.split(" "),sn(n,function(e){r.addReference({element:o,property:a.ns.name,id:e})})):r.addReference({element:o,property:a.ns.name,id:e}):(a&&(e=hn(a.type,e)),o.set(t,e))}),o},Cn.prototype.getPropertyForNode=function(e){var t,n,i=e.name,r=un(i),o=this.type,a=this.model,s=bn(o),c=r.name,p=s.propertiesByName[c];if(p)return fn(p)&&(t=e.attributes[mn])?(t=function(e,t){var n=un(e);return function(e,t){var n=e.name,i=e.localName,r=t.xml&&t.xml.typePrefix;return r&&0===i.indexOf(r)?e.prefix+":"+i.slice(r.length):n}(n,t.getPackage(n.prefix))}(t,a),n=a.getType(t),pn({},p,{effectiveType:bn(n).name})):p;var l=a.getPackage(r.prefix);if(l){if(t=vn(r,l),n=a.getType(t),p=cn(s.properties,function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)}))return pn({},p,{effectiveType:bn(n).name})}else if(p=cn(s.properties,function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type}))return p;throw gn("unrecognized element <"+r.name+">")},Cn.prototype.toString=function(){return"ElementDescriptor["+bn(this.type).name+"]"},Cn.prototype.valueHandler=function(e,t){return new Sn(e,t)},Cn.prototype.referenceHandler=function(e){return new wn(e,this.context)},Cn.prototype.handler=function(e){return"Element"===e?new Rn(this.model,e,this.context):new Cn(this.model,e,this.context)},Cn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,dn(n))return this.valueHandler(t,i);var o=(r=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==o&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(pn(o,{element:i}),this.context.addReference(o)):o.$parent=i),r},An.prototype=Object.create(Cn.prototype),An.prototype.createElement=function(e){var t=e.name,n=un(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&vn(n,o)||t;if(!r.hasType(a))throw gn("unexpected element <"+e.originalName+">");return Cn.prototype.createElement.call(this,e)},Rn.prototype=Object.create(Tn.prototype),Rn.prototype.createElement=function(e){var t=e.name,n=un(t).prefix,i=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,i,r)},Rn.prototype.handleChild=function(e){var t=new Rn(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element;return void 0!==i&&((n.$children=n.$children||[]).push(i),i.$parent=n),t},Rn.prototype.handleText=function(e){this.body=this.body||""+e},Rn.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},Pn.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Cn?(i=t,t={}):"string"==typeof t?(i=this.handler(t),t={}):"string"==typeof i&&(i=this.handler(i));var r=this.model,o=this.lax,a=new function(e){pn(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw gn("expected element");var t,n=this.elementsById,i=bn(e).idProperty;if(i&&(t=e.get(i.name))){if(n[t])throw gn("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}(pn({},t,{rootHandler:i})),s=new ln({proxy:!0}),c=new on;function p(e,t,n){var i=t(),r=i.line,o=i.column,s=i.data;"<"===s.charAt(0)&&-1!==s.indexOf(" ")&&(s=s.slice(0,s.indexOf(" "))+">");var c="unparsable content "+(s?s+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return a.addWarning({message:c,error:e}),console.warn("could not parse node"),console.warn(e),!0;throw console.error("could not parse document"),console.error(e),gn(c)}i.context=a,c.push(i);var l=/^<\?xml /i,u=/ encoding="([^"]+)"/i,h=/^utf-8$/i;var d=r.getPackages().reduce(function(e,t){return e[t.uri]=t.prefix,e},{});s.ns(d).on("openTag",function(e,t,n,i){var r=e.attrs||{},a=Object.keys(r).reduce(function(e,n){var i=t(r[n]);return e[n]=i,e},{});!function(e,t){var n=c.peek();try{c.push(n.handleNode(e))}catch(e){p(e,t,o)&&c.push(new En)}}({name:e.name,originalName:e.originalName,attributes:a,ns:e.ns},i)}).on("question",function(e){if(l.test(e)){var t=u.exec(e),n=t&&t[1];n&&!h.test(n)&&a.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}}).on("closeTag",function(){c.pop().handleEnd()}).on("cdata",function(e){c.peek().handleText(e)}).on("text",function(e,t){!function(e){(e=e.trim())&&c.peek().handleText(e)}(t(e))}).on("error",p).on("warn",function(e,t){return p(e,t,!0)}),setTimeout(function(){var t;try{s.parse(e),function(){var e,t,n=a.elementsById,i=a.references;for(e=0;t=i[e];e++){var r=t.element,o=n[t.id],s=bn(r).propertiesByName[t.property];if(o||a.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),s.isMany){var c=r.get(s.name),p=c.indexOf(t);-1===p&&(p=c.length),o?c[p]=o:c.splice(p,1)}else r.set(s.name,o)}}()}catch(e){t=e}var r=i.element;t||r||(t=gn("failed to parse document as <"+i.type.$descriptor.name+">")),n(t,t?void 0:r,a)},0)},Pn.prototype.handler=function(e){return new An(this.model,e)},(an=Pn).ElementHandler=Cn;var Mn=s.map,kn=s.forEach,Bn=s.isString,Nn=s.filter,Dn=s.assign,On=Rt.parseName,Ln=bt.hasLowerCaseAlias,In=bt.serializeAsType,jn=bt.serializeAsProperty,zn='<?xml version="1.0" encoding="UTF-8"?>\n',Fn=/<|>|'|"|&|\n\r|\n/g,$n=/<|>|&/g,Gn=bt.DEFAULT_NS_MAP,Wn=bt.XSI_TYPE;function Hn(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Vn(e){return Bn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function qn(e,t){return t.isGeneric?Dn({localName:t.ns.localName},e):Dn({localName:(n=t.ns.localName,i=t.$pkg,Ln(i)?(r=n).charAt(0).toLowerCase()+r.slice(1):n)},e);var n,i,r}var Un={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},Yn={"<":"lt",">":"gt","&":"amp"};function Kn(e,t,n){return(e=Bn(e)?e:""+e).replace(t,function(e){return"&"+n[e]+";"})}function Xn(e){this.tagName=e}function Zn(){}function Qn(e){this.tagName=e}function Jn(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function ei(e,t){Jn.call(this,e,t)}Xn.prototype.build=function(e){return this.element=e,this},Xn.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},Zn.prototype.serializeValue=Zn.prototype.serializeTo=function(e){e.append(this.escape?Kn(this.value,$n,Yn):this.value)},Zn.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search($n)&&(this.escape=!0),this},Hn(Qn,Zn),Qn.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},Jn.prototype.build=function(e){this.element=e;var t,n,i=e.$descriptor,r=this.propertyDescriptor,o=i.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=r?this.nsPropertyTagName(r):this.nsTagName(i),this.tagName=this.addTagName(this.ns),o||(n=function(e){var t=e.$descriptor;return Nn(t.properties,function(t){var n=t.name;if(t.isVirtual)return!1;if(!e.hasOwnProperty(n))return!1;var i=e[n];return i!==t.default&&null!==i&&(!t.isMany||i.length)})}(e),this.parseAttributes(Nn(n,function(e){return e.isAttr})),this.parseContainments(function(e){return Nn(e,function(e){return!e.isAttr})}(n))),this.parseGenericAttributes(e,t),this},Jn.prototype.nsTagName=function(e){return qn(this.logNamespaceUsed(e.ns),e)},Jn.prototype.nsPropertyTagName=function(e){return function(e,t){return Dn({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},Jn.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Jn.prototype.nsAttributeName=function(e){var t;if(t=Bn(e)?On(e):e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:Dn({localName:t.localName},n)},Jn.prototype.parseGeneric=function(e){var t=this,n=this.body,i=[];return kn(e,function(r,o){"$body"===o?n.push((new Zn).build({type:"String"},r)):"$children"===o?kn(r,function(e){n.push(new Jn(t).build(e))}):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,r)&&i.push({name:o,value:r})}),i},Jn.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,o=On(t);if("xmlns"===o.prefix&&(i={prefix:o.localName,uri:n}),o.prefix||"xmlns"!==o.localName||(i={uri:n}),!i)return{name:t,value:n};if(r&&r.getPackage(n))this.logNamespace(i,!0,!0);else{var a=this.logNamespaceUsed(i,!0);this.getNamespaces().logUsed(a)}},Jn.prototype.parseNsAttributes=function(e,t){var n=this,i=e.$attrs,r=[];return kn(i,function(t,i){var o=n.parseNsAttribute(e,i,t);o&&r.push(o)}),r},Jn.prototype.parseGenericAttributes=function(e,t){var n=this;kn(t,function(t){if(t.name!==Wn)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}})},Jn.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;kn(e,function(e){var r=i.get(e.name),o=e.isReference;if(e.isMany||(r=[r]),e.isBody)n.push((new Zn).build(e,r[0]));else if(zt.isSimple(e.type))kn(r,function(i){n.push(new Qn(t.addTagName(t.nsPropertyTagName(e))).build(e,i))});else if(o)kn(r,function(i){n.push(new Xn(t.addTagName(t.nsPropertyTagName(e))).build(i))});else{var a=In(e),s=jn(e);kn(r,function(i){var r;r=a?new ei(t,e):s?new Jn(t,e):new Jn(t),n.push(r.build(i))})}})},Jn.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new function(e){var t={},n={},i={},r=[],o=[];this.byUri=function(t){return n[t]||e&&e.byUri(t)},this.add=function(e,t){n[e.uri]=e,t?r.push(e):o.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return t[e||"xmlns"]},this.mapPrefix=function(e,n){t[e||"xmlns"]=n},this.logUsed=function(e){var t=e.uri;i[t]=this.byUri(t)},this.getUsed=function(e){return[].concat(r,o).filter(function(e){return i[e.uri]})}}(t):n=t),n},Jn.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix;return i.byUri(r)||i.add(e,t),i.mapPrefix(o,r),e},Jn.prototype.logNamespaceUsed=function(e,t){var n,i,r,o=this.element.$model,a=this.getNamespaces(t),s=e.prefix,c=e.uri;if(!s&&!c)return{localName:e.localName};if(r=Gn[s]||o&&(o.getPackage(s)||{}).uri,!(c=c||r||a.uriByPrefix(s)))throw new Error("no namespace uri given for prefix <"+s+">");if(!(e=a.byUri(c))){for(n=s,i=1;a.uriByPrefix(n);)n=s+"_"+i++;e=this.logNamespace({prefix:n,uri:c},r===c)}return s&&a.mapPrefix(s,c),e},Jn.prototype.parseAttributes=function(e){var t=this,n=this.element;kn(e,function(e){var i=n.get(e.name);if(e.isReference)if(e.isMany){var r=[];kn(i,function(e){r.push(e.id)}),i=r.join(" ")}else i=i.id;t.addAttribute(t.nsAttributeName(e),i)})},Jn.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Vn(e)},Jn.prototype.addAttribute=function(e,t){var n=this.attrs;Bn(t)&&(t=Kn(t,Fn,Un)),n.push({name:e,value:t})},Jn.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=function(e){return Mn(e.getUsed(),function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}})}(n).concat(t)),kn(t,function(t){e.append(" ").append(Vn(t.name)).append('="').append(t.value).append('"')})},Jn.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Zn;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),kn(this.body,function(t){t.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},Hn(ei,Jn),ei.prototype.parseNsAttributes=function(e){var t=Jn.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(Wn),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},ei.prototype.isLocalNs=function(e){return e.uri===this.typeNs.uri};var ti=function(e){return e=Dn({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var i=n||new function(){this.value="",this.write=function(e){this.value+=e}},r=new function(e,t){var n=[""];this.append=function(t){return e.write(t),this},this.appendNewLine=function(){return t&&e.write("\n"),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}(i,e.format);if(e.preamble&&r.append(zn),(new Jn).build(t).serializeTo(r),!n)return i.value}}},ni=s.isString,ii=s.isFunction,ri=s.assign;function oi(e,t){nn.call(this,e,t)}oi.prototype=Object.create(nn.prototype);var ai=oi;oi.prototype.fromXML=function(e,t,n,i){ni(t)||(i=n,n=t,t="bpmn:Definitions"),ii(n)&&(i=n,n={});var r=new an(ri({model:this,lax:!0},n)),o=r.handler(t);r.fromXML(e,o,i)},oi.prototype.toXML=function(e,t,n){ii(t)&&(n=t,t={});var i,r,o=new ti(t);try{i=o.toXML(e)}catch(e){r=e}return n(r,i)};var si=s.assign,ci={bpmn:{name:"BPMN20",uri:"http://www.omg.org/spec/BPMN/20100524/MODEL",associations:[],types:[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",type:"LaneSet",isMany:!0,replaces:"FlowElementsContainer#laneSets"},{name:"flowElements",type:"FlowElement",isMany:!0,replaces:"FlowElementsContainer#flowElements"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isAttr:!0,isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"assignment",type:"Assignment",isMany:!0},{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRefs",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",type:"String",isBody:!0}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",type:"String",isAttr:!0},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRefs",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["FlowElementsContainer","Collaboration"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isVirtual:!0,isMany:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"CallActivity",superClass:["Activity"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],enumerations:[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],prefix:"bpmn",xml:{tagAlias:"lowerCase",typePrefix:"t"}},bpmndi:{name:"BPMNDI",uri:"http://www.omg.org/spec/BPMN/20100524/DI",types:[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],enumerations:[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],associations:[],prefix:"bpmndi"},dc:{name:"DC",uri:"http://www.omg.org/spec/DD/20100524/DC",types:[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],prefix:"dc",associations:[]},di:{name:"DI",uri:"http://www.omg.org/spec/DD/20100524/DI",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isMany:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isVirtual:!0,isMany:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0}]},{name:"Extension",properties:[{name:"values",type:"Element",isMany:!0}]}],associations:[],prefix:"di",xml:{tagAlias:"lowerCase"}},bioc:{name:"bpmn.io colors for BPMN",uri:"http://bpmn.io/schema/bpmn/biocolor/1.0",prefix:"bioc",types:[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],enumerations:[],associations:[]}},pi=function(e,t){return new ai(si({},ci,e),t)},li={remove:function(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n},add:function(e,t,n){if(e&&t){"number"!=typeof n&&(n=-1);var i=e.indexOf(t);if(-1!==i){if(i===n)return;if(-1===n)return;e.splice(i,1)}-1!==n?e.splice(n,0,t):e.push(t)}},indexOf:function(e,t){return e&&t?e.indexOf(t):-1}},ui={},hi=s.isArray,di=s.isNumber,mi=s.groupBy,fi=s.forEach;function yi(e,t,n){var i=!n||-1===e.indexOf(t);return i&&e.push(t),i}function vi(e,t,n){n=n||0,hi(e)||(e=[e]),fi(e,function(e,i){var r=t(e,i,n);hi(r)&&r.length&&vi(r,t,n+1)})}function gi(e,t,n){var i=[],r=[];return vi(e,function(e,o,a){yi(i,e,t);var s=e.children;if((-1===n||a<n)&&s&&yi(r,s,t))return s}),i}function bi(e,t){var n,i,r,o;return t=!!t,hi(e)||(e=[e]),fi(e,function(e){var a=e;e.waypoints&&!t&&(a=bi(e.waypoints,!0));var s=a.x,c=a.y,p=a.height||0,l=a.width||0;(s<n||void 0===n)&&(n=s),(c<i||void 0===i)&&(i=c),(s+l>r||void 0===r)&&(r=s+l),(c+p>o||void 0===o)&&(o=c+p)}),{x:n,y:i,height:o-i,width:r-n}}ui.eachElement=vi,ui.selfAndAllChildren=function(e,t){return gi(e,!t,-1)},ui.getBBox=bi,ui.getEnclosedElements=function(e,t){var n={};return fi(e,function(e){var i=e;i.waypoints&&(i=bi(i)),!di(t.y)&&i.x>t.x&&(n[e.id]=e),!di(t.x)&&i.y>t.y&&(n[e.id]=e),i.x>t.x&&i.y>t.y&&(di(t.width)&&di(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.y<t.height+t.y?n[e.id]=e:di(t.width)&&di(t.height)||(n[e.id]=e))}),n},ui.getClosure=function(e){var t=mi(e,function(e){return e.id}),n={},i={},r={},o={};function a(e){t[e.source.id]&&t[e.target.id]&&(t[e.id]=[e]),n[e.source.id]&&n[e.target.id]&&(o[e.id]=r[e.id]=e),i[e.id]=e}return vi(e,function(e){if(r[e.id]=e,!e.waypoints)return n[e.id]=e,fi(e.incoming,a),fi(e.outgoing,a),e.children;o[e.id]=i[e.id]=e}),{allShapes:n,allConnections:i,topLevel:t,enclosedConnections:o,enclosedElements:r}},ui.getType=function(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"};var xi=s.isNumber,Ei=s.assign,_i=s.forEach,wi=s.every,Si=s.debounce,Ti=s.bind,Ci=s.reduce,Ai=n.append,Ri=n.attr,Pi=n.classes,Mi=n.create,ki=n.transform,Bi=n.createMatrix;function Ni(e,t){return Math.round(e*t)/t}function Di(e){return xi(e)?e+"px":e}function Oi(e,t,n){var i=Mi("g");Pi(i).add(t);var r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]),i}var Li={shape:["x","y","width","height"],connection:["waypoints"]};function Ii(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._init(e||{})}Ii.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"];var ji=Ii;function zi(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ii.prototype._init=function(e){var t=this._eventBus,n=this._container=function(e){var t=(e=Ei({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container"),Ei(n.style,{position:"relative",overflow:"hidden",width:Di(e.width),height:Di(e.height)}),t.appendChild(n),n}(e),i=this._svg=Mi("svg");Ri(i,{width:"100%",height:"100%"}),Ai(n,i);var r=this._viewport=Oi(i,"viewport");this._layers={},!1!==e.deferUpdate&&(this._viewboxChanged=Si(Ti(this._viewboxChanged,this),300)),t.on("diagram.init",function(){t.fire("canvas.init",{svg:i,viewport:r})},this),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed"],function(){delete this._cachedViewbox},this),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Ii.prototype._destroy=function(e){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});var t=this._container.parentNode;t&&t.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._rootElement,delete this._viewport},Ii.prototype._clear=function(){var e=this;this._elementRegistry.getAll().forEach(function(t){var n=ui.getType(t);"root"===n?e.setRootElement(null,!0):e._removeElement(t,n)}),delete this._cachedViewbox},Ii.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Ii.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");var n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),void 0!==t&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Ii.prototype._createLayer=function(e,t){t||(t=0);var n=Ci(this._layers,function(e,n){return t>=n.index&&e++,e},0);return{group:Oi(this._viewport,"layer-"+e,n),index:t}},Ii.prototype.getContainer=function(){return this._container},Ii.prototype._updateMarker=function(e,t,n){var i;e.id||(e=this._elementRegistry.get(e)),(i=this._elementRegistry._elements[e.id])&&(_i([i.gfx,i.secondaryGfx],function(e){e&&(n?Pi(e).add(t):Pi(e).remove(t))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ii.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ii.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ii.prototype.hasMarker=function(e,t){e.id||(e=this._elementRegistry.get(e));var n=this.getGraphics(e);return Pi(n).has(t)},Ii.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ii.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},Ii.prototype.setRootElement=function(e,t){e&&this._ensureValid("root",e);var n=this._rootElement,i=this._elementRegistry,r=this._eventBus;if(n){if(!t)throw new Error("rootElement already set, need to specify override");r.fire("root.remove",{element:n}),r.fire("root.removed",{element:n}),i.remove(n)}if(e){var o=this.getDefaultLayer();r.fire("root.add",{element:e}),i.add(e,o,this._svg),r.fire("root.added",{element:e,gfx:o})}return this._rootElement=e,e},Ii.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element with id "+t.id+" already exists");var n=Li[e];if(!wi(n,function(e){return void 0!==t[e]}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ii.prototype._setParent=function(e,t,n){li.add(t.children,e,n),e.parent=t},Ii.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();var r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);var a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},Ii.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ii.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ii.prototype._removeElement=function(e,t){var n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e))return r.fire(t+".remove",{element:e}),i.remove(e),li.remove(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Ii.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ii.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ii.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ii.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ii.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ii.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;var t,n,i,r,o,a,s=this._viewport,c=this.getSize();return e?(this._changeViewbox(function(){r=Math.min(c.width/e.width,c.height/e.height);var t=this._svg.createSVGMatrix().scale(r).translate(-e.x,-e.y);ki(s,t)}),e):(t=this.getDefaultLayer().getBBox(),n=(i=ki(s))?i.matrix:Bi(),r=Ni(n.a,1e3),o=Ni(-n.e||0,1e3),a=Ni(-n.f||0,1e3),e=this._cachedViewbox={x:o?o/r:0,y:a?a/r:0,width:c.width/r,height:c.height/r,scale:r,inner:{width:t.width,height:t.height,x:t.x,y:t.y},outer:c})},Ii.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox(function(){e=Ei({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),zi(t,n)}),{x:n.e,y:n.f}},Ii.prototype.zoom=function(e,t){return e?"fit-viewport"===e?this._fitViewport(t):(this._changeViewbox(function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Ni(i.a,1e3)):this.viewbox(e).scale;var n,i},Ii.prototype._fitViewport=function(e){var t,n,i=this.viewbox(),r=i.outer,o=i.inner;return o.x>=0&&o.y>=0&&o.x+o.width<=r.width&&o.y+o.height<=r.height&&!e?n={x:0,y:0,width:Math.max(o.width+o.x,r.width),height:Math.max(o.height+o.y,r.height)}:(t=Math.min(1,r.width/o.width,r.height/o.height),n={x:o.x+(e?o.width/2-r.width/t/2:0),y:o.y+(e?o.height/2-r.height/t/2:0),width:r.width/t,height:r.height/t}),this.viewbox(n),this.viewbox(!1).scale},Ii.prototype._setZoom=function(e,t){var n,i,r,o,a=this._svg,s=this._viewport,c=a.createSVGMatrix(),p=a.createSVGPoint(),l=(i=s.getCTM()).a;return t?(n=Ei(p,t).matrixTransform(i.inverse()),r=c.translate(n.x,n.y).scale(1/l*e).translate(-n.x,-n.y),o=i.multiply(r)):o=c.scale(e),zi(this._viewport,o),o},Ii.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ii.prototype.getAbsoluteBBox=function(e){var t,n=this.viewbox();e.waypoints?t=this.getGraphics(e).getBBox():t=e;return{x:t.x*n.scale-n.x*n.scale,y:t.y*n.scale-n.y*n.scale,width:t.width*n.scale,height:t.height*n.scale}},Ii.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Fi={},$i=s.assign,Gi=new it({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Wi=new it({name:"label",enumerable:!0},{name:"labelTarget"}),Hi=new it({name:"attachers",collection:!0},{name:"host"}),Vi=new it({name:"outgoing",collection:!0},{name:"source"}),qi=new it({name:"incoming",collection:!0},{name:"target"});function Ui(){Object.defineProperty(this,"businessObject",{writable:!0}),Gi.bind(this,"parent"),Wi.bind(this,"label"),Vi.bind(this,"outgoing"),qi.bind(this,"incoming")}function Yi(){Ui.call(this),Gi.bind(this,"children"),Hi.bind(this,"host"),Hi.bind(this,"attachers")}function Ki(){Yi.call(this)}function Xi(){Yi.call(this),Wi.bind(this,"labelTarget")}function Zi(){Ui.call(this),Vi.bind(this,"source"),qi.bind(this,"target")}U(Yi,Ui),U(Ki,Yi),U(Xi,Yi),U(Zi,Ui);var Qi={connection:Zi,shape:Yi,label:Xi,root:Ki};Fi.create=function(e,t){var n=Qi[e];if(!n)throw new Error("unknown type: <"+e+">");return $i(new n,t)},Fi.Base=Ui,Fi.Label=Xi;var Ji=s.assign;function er(){this._uid=12}var tr=er;er.prototype.createRoot=function(e){return this.create("root",e)},er.prototype.createLabel=function(e){return this.create("label",e)},er.prototype.createShape=function(e){return this.create("shape",e)},er.prototype.createConnection=function(e){return this.create("connection",e)},er.prototype.create=function(e,t){return(t=Ji({},t||{})).id||(t.id=e+"_"+this._uid++),Fi.create(e,t)};var nr="data-element-id",ir=n.attr;function rr(e){this._elements={},this._eventBus=e}rr.$inject=["eventBus"];var or=rr;rr.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),ir(t,nr,i),n&&ir(n,nr,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},rr.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(ir(i.gfx,nr,""),i.secondaryGfx&&ir(i.secondaryGfx,nr,""),delete t[n])},rr.prototype.updateId=function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},rr.prototype.get=function(e){var t;t="string"==typeof e?e:e&&ir(e,nr);var n=this._elements[t];return n&&n.element},rr.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},rr.prototype.getAll=function(){return this.filter(function(e){return e})},rr.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},rr.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},rr.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};var ar=s.isFunction,sr=s.isArray,cr=s.isNumber,pr=s.bind,lr=s.assign,ur=Array.prototype.slice;function hr(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}var dr=hr;function mr(){}hr.prototype.on=function(e,t,n,i){if(e=sr(e)?e:[e],ar(t)&&(i=n,n=t,t=1e3),!cr(t))throw new Error("priority must be a number");var r=n;i&&((r=pr(n,i)).__fn=n.__fn||n);var o=this,a={priority:t,callback:r};e.forEach(function(e){o._addListener(e,a)})},hr.prototype.once=function(e,t,n,i){var r=this;if(ar(t)&&(i=n,n=t,t=1e3),!cr(t))throw new Error("priority must be a number");function o(){return r.off(e,o),n.apply(i,arguments)}o.__fn=n,this.on(e,t,o)},hr.prototype.off=function(e,t){var n,i,r,o=this._getListeners(e);if(t)for(r=o.length-1;n=o[r];r--)(i=n.callback)!==t&&i.__fn!==t||o.splice(r,1);else o.length=0},hr.prototype.createEvent=function(e){var t=new mr;return t.init(e),t},hr.prototype.fire=function(e,t){var n,i,r,o;if(o=ur.call(arguments),"object"==typeof e&&(e=(n=e).type),!e)throw new Error("no event type specified");if(i=this._listeners[e]){n=t instanceof mr?t:this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return void 0===r&&n.defaultPrevented&&(r=!1),r}},hr.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},hr.prototype._destroy=function(){this._listeners={}},hr.prototype._invokeListeners=function(e,t,n){var i,r,o;for(i=0;(r=n[i])&&!e.cancelBubble;i++)o=this._invokeListener(e,t,r);return o},hr.prototype._invokeListener=function(e,t,n){var i;try{void 0!==(i=function(e,t){return e.apply(null,t)}(n.callback,t))&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener"),console.error(e.stack),e}return i},hr.prototype._addListener=function(e,t){var n,i,r=this._getListeners(e);for(i=0;n=r[i];i++)if(n.priority<t.priority)return void r.splice(i,0,t);r.push(t)},hr.prototype._getListeners=function(e){var t=this._listeners[e];return t||(this._listeners[e]=t=[]),t},mr.prototype.stopPropagation=function(){this.cancelBubble=!0},mr.prototype.preventDefault=function(){this.defaultPrevented=!0},mr.prototype.init=function(e){lr(this,e||{})};var fr={},yr=Y.query;fr.getVisual=function(e){return yr(".djs-visual",e)},fr.getChildren=function(e){return e.parentNode.childNodes[1]};var vr=s.forEach,gr=s.reduce,br=w.translate,xr=Y.clear,Er=n.append,_r=n.attr,wr=n.classes,Sr=n.create,Tr=n.remove;function Cr(e,t){this._eventBus=e,this._elementRegistry=t}Cr.$inject=["eventBus","elementRegistry"];var Ar=Cr;function Rr(e,t,n){t.insertBefore(e,n||t.firstChild)}Cr.prototype._getChildren=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=fr.getChildren(n))||(t=Sr("g"),wr(t).add("djs-children"),Er(n.parentNode,t)):t=n,t},Cr.prototype._clear=function(e){var t=fr.getVisual(e);return xr(t),t},Cr.prototype._createContainer=function(e,t,n){var i=Sr("g");wr(i).add("djs-group"),void 0!==n?Rr(i,t,t.childNodes[n]):Er(t,i);var r=Sr("g");wr(r).add("djs-element"),wr(r).add("djs-"+e),Er(i,r);var o=Sr("g");return wr(o).add("djs-visual"),Er(r,o),r},Cr.prototype.create=function(e,t,n){var i=this._getChildren(t.parent);return this._createContainer(e,i,n)},Cr.prototype.updateContainments=function(e){var t,n=this,i=this._elementRegistry;t=gr(e,function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e},{}),vr(t,function(e){var t=e.children;if(t){var r=n._getChildren(e);vr(t.slice().reverse(),function(e){Rr(i.getGraphics(e).parentNode,r)})}})},Cr.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},Cr.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},Cr.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},Cr.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},Cr.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),br(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(i,t)}t.hidden?_r(n,"display","none"):_r(n,"display","block")}},Cr.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Tr(t.parentNode)};var Pr=i.componentsToPath,Mr=i.createLine,kr=n.append,Br=n.attr,Nr=n.create,Dr=1;function Or(e,t){_.call(this,e,Dr),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2})}U(Or,_),Or.prototype.canRender=function(){return!0},Or.prototype.drawShape=function(e,t){var n=Nr("rect");return Br(n,{x:0,y:0,width:t.width||0,height:t.height||0}),Br(n,this.SHAPE_STYLE),kr(e,n),n},Or.prototype.drawConnection=function(e,t){var n=Mr(t.waypoints,this.CONNECTION_STYLE);return kr(e,n),n},Or.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width,r=e.height;return Pr([["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]])},Or.prototype.getConnectionPath=function(e){var t,n,i=e.waypoints,r=[];for(t=0;n=i[t];t++)n=n.original||n,r.push([0===t?"M":"L",n.x,n.y]);return Pr(r)},Or.$inject=["eventBus","styles"];var Lr=Or,Ir=s.isArray,jr=s.assign,zr=s.reduce;var Fr={__depends__:[{__init__:["defaultRenderer"],defaultRenderer:["type",Lr],styles:["type",function(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(e,t,n){var i=this.style(t,n);return jr(i,{class:e})},this.style=function(t,n){Ir(t)||n||(n=t,t=[]);var i=zr(t,function(t,n){return jr(t,e[n]||{})},{});return n?jr(i,n):i},this.computeStyle=function(e,n,i){return Ir(n)||(i=n,n=[]),t.style(n||[],jr({},i,e||{}))}}]}],__init__:["canvas"],canvas:["type",ji],elementRegistry:["type",or],elementFactory:["type",tr],eventBus:["type",dr],graphicsFactory:["type",Ar]},$r={exports:{}};!function(e,t){"object"==typeof $r.exports?t($r.exports):t(e.didi={})}(this,function(e){"use strict";var t=/^class /;function n(e){return"[object Array]"===Object.prototype.toString.call(e)}function i(){var e=Array.prototype.slice.call(arguments);1===e.length&&n(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var r=/constructor\s*[^(]*\(\s*([^)]*)\)/m,o=/^function\s*[^(]*\(\s*([^)]*)\)/m,a=/\/\*([^*]*)\*\//m;function s(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var n=e.toString().match(function(e){return t.test(e.toString())}(e)?r:o);return n&&n[1]&&n[1].split(",").map(function(e){return(n=e.match(a))?n[1].trim():e.trim()})||[]}function c(){var e=[];this.factory=function(t,n){return e.push([t,"factory",n]),this},this.value=function(t,n){return e.push([t,"value",n]),this},this.type=function(t,n){return e.push([t,"type",n]),this},this.forEach=function(t){e.forEach(t)}}var p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function l(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function u(e,t){return Object.hasOwnProperty.call(e,t)}e.Injector=function e(t,r){r=r||{get:function(e,t){if(o.push(e),!1===t)return null;throw m('No provider for "'+e+'"!')}};var o=[],a=this._providers=Object.create(r._providers||null),h=this._instances=Object.create(null),d=h.injector=this,m=function(e){var t=o.join(" -> ");return o.length=0,new Error(t?e+" (Resolving: "+t+")":e)},f=function e(t,n){if(!a[t]&&-1!==t.indexOf(".")){for(var i=t.split("."),s=e(i.shift());i.length;)s=s[i.shift()];return s}if(u(h,t))return h[t];if(u(a,t)){if(-1!==o.indexOf(t))throw o.push(t),m("Cannot resolve circular dependency!");return o.push(t),h[t]=a[t][0](a[t][1]),o.pop(),h[t]}return r.get(t,n)},y=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof e){if(!n(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=i(e.slice())}return{fn:e,dependencies:(e.$inject||s(e)).map(function(e){return u(t,e)?t[e]:f(e)})}},v=function(e){var t=y(e),n=t.dependencies,i=t.fn;return new(Function.prototype.bind.apply(i,[null].concat(l(n))))},g=function(e,t,n){var i=y(e,n),r=i.dependencies,o=i.fn;return o.call.apply(o,[t].concat(l(r)))},b=function(e){return i(function(t){return e.get(t)})},x={factory:g,type:v,value:function(e){return e}};t.forEach(function(t){function r(e,t){return"value"!==e&&n(t)&&(t=i(t.slice())),t}if(t instanceof c)t.forEach(function(e){var t=e[0],n=e[1],i=e[2];a[t]=[x[n],r(n,i),n]});else if("object"===(void 0===t?"undefined":p(t)))if(t.__exports__){var o=Object.keys(t).reduce(function(e,n){return"__"!==n.substring(0,2)&&(e[n]=t[n]),e},Object.create(null)),s=new e((t.__modules__||[]).concat([o]),d),l=i(function(e){return s.get(e)});t.__exports__.forEach(function(e){a[e]=[l,e,"private",s]})}else Object.keys(t).forEach(function(e){if("private"!==t[e][2]){var n=t[e][0],i=t[e][1];a[e]=[x[n],r(n,i),n]}else a[e]=t[e]})}),this.get=f,this.invoke=g,this.instantiate=v,this.createChild=function(t,n){if(n&&n.length){var i,r,o,s,c=Object.create(null),p=Object.create(null),l=[],u=[],h=[];for(var m in a)i=a[m],-1!==n.indexOf(m)&&("private"===i[2]?-1===(r=l.indexOf(i[3]))?(o=i[3].createChild([],n),s=b(o),l.push(i[3]),u.push(o),h.push(s),c[m]=[s,m,"private",o]):c[m]=[h[r],m,"private",u[r]]:c[m]=[i[2],i[1]],p[m]=!0),"factory"!==i[2]&&"type"!==i[2]||!i[1].$scope||n.forEach(function(e){-1!==i[1].$scope.indexOf(e)&&(c[m]=[i[2],i[1]],p[e]=!0)});n.forEach(function(e){if(!p[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')}),t.unshift(c)}return new e(t,d)}},Object.defineProperty(e,"__esModule",{value:!0})});var Gr=($r=$r.exports).Injector;function Wr(e){var t=[],n=[];function i(e){return t.indexOf(e)>=0}e.forEach(function e(r){i(r)||((r.__depends__||[]).forEach(e),i(r)||(function(e){t.push(e)}(r),(r.__init__||[]).forEach(function(e){n.push(e)})))});var r=new Gr(t);return n.forEach(function(e){try{r["string"==typeof e?"get":"invoke"](e)}catch(e){throw console.error("Failed to instantiate component"),console.error(e.stack),e}}),r}function Hr(e,t){this.injector=t=t||function(e){return Wr([{config:["value",e=e||{}]},Fr].concat(e.modules||[]))}(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}var Vr=Hr;Hr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Hr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};var qr=Vr;function Ur(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}var Yr=Ur;Ur.prototype.next=function(){return this._prefix+ ++this._counter};var Kr=s.isArray,Xr=s.isString,Zr=s.isObject,Qr=s.assign,Jr=s.forEach,eo=s.find,to=s.filter,no=s.matchPattern,io=Y.domify,ro=Y.classes,oo=Y.attr,ao=Y.remove,so=Y.clear,co=ui.getBBox,po=new Yr("ov");function lo(e,t,n){Qr(e.style,{left:t+"px",top:n+"px"})}function uo(e,t){e.style.display=!1===t?"none":""}function ho(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}function mo(e){return void 0!==e}function fo(e,t,n,i){var r,o;this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=po,this._overlayDefaults=Qr({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(r=n.getContainer(),o=io('<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'),r.insertBefore(o,r.firstChild),o),this._init()}fo.$inject=["config.overlays","eventBus","canvas","elementRegistry"];var yo=fo;fo.prototype.get=function(e){if(Xr(e)&&(e={id:e}),Xr(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?to(t.overlays,no({type:e.type})):t.overlays.slice():[]}return e.type?to(this._overlays,no({type:e.type})):e.id?this._overlays[e.id]:null},fo.prototype.add=function(e,t,n){if(Zr(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=Qr({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},fo.prototype.remove=function(e){var t=this.get(e)||[];Kr(t)||(t=[t]);var n=this;Jr(t,function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(ao(e.html),ao(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var i=t.overlays.indexOf(e);-1!==i&&t.overlays.splice(i,1)}})},fo.prototype.show=function(){uo(this._overlayRoot)},fo.prototype.hide=function(){uo(this._overlayRoot,!1)},fo.prototype.clear=function(){this._overlays={},this._overlayContainers=[],so(this._overlayRoot)},fo.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=co(t);i=o.x,r=o.y}lo(n,i,r),oo(e.html,"data-container-id",t.id)},fo.prototype._updateOverlay=function(e){var t,n,i=e.position,r=e.htmlContainer,o=e.element,a=i.left,s=i.top;void 0!==i.right&&(t=o.waypoints?co(o).width:o.width,a=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?co(o).height:o.height,s=-1*i.bottom+n);lo(r,a||0,s||0)},fo.prototype._createOverlayContainer=function(e){var t=io('<div class="djs-overlays" style="position: absolute" />');this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},fo.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";ho(this._overlayRoot,n)},fo.prototype._getOverlayContainer=function(e,t){var n=eo(this._overlayContainers,function(t){return t.element===e});return n||t?n:this._createOverlayContainer(e)},fo.prototype._addOverlay=function(e){var t,n,i=e.id,r=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),Xr(o)&&(o=io(o)),n=this._getOverlayContainer(r),(t=io('<div class="djs-overlay" data-overlay-id="'+i+'" style="position: absolute">')).appendChild(o),e.type&&ro(t).add("djs-overlay-"+e.type),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[i]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},fo.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=n&&n.minZoom,r=n&&n.maxZoom,o=e.htmlContainer,a=!0;n&&((mo(i)&&i>t.scale||mo(r)&&r<t.scale)&&(a=!1),uo(o,a)),this._updateOverlayScale(e,t)},fo.prototype._updateOverlayScale=function(e,t){var n,i,r,o=e.scale,a=e.htmlContainer,s="";!0!==o&&(!1===o?(n=1,i=1):(n=o.min,i=o.max),mo(n)&&t.scale<n&&(r=(1/t.scale||1)*n),mo(i)&&t.scale>i&&(r=(1/t.scale||1)*i)),mo(r)&&(s="scale("+r+","+r+")"),ho(a,s)},fo.prototype._updateOverlaysVisibilty=function(e){var t=this;Jr(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},fo.prototype._init=function(){var e=this._eventBus,t=this;e.on("canvas.viewbox.changing",function(e){t.hide()}),e.on("canvas.viewbox.changed",function(e){var n;n=e.viewbox,t._updateRoot(n),t._updateOverlaysVisibilty(n),t.show()}),e.on(["shape.remove","connection.remove"],function(e){var n=e.element,i=t.get({element:n});Jr(i,function(e){t.remove(e.id)});var r=t._getOverlayContainer(n);if(r){ao(r.html);var o=t._overlayContainers.indexOf(r);-1!==o&&t._overlayContainers.splice(o,1)}}),e.on("element.changed",500,function(e){var n=e.element,i=t._getOverlayContainer(n,!0);i&&(Jr(i.overlays,function(e){t._updateOverlay(e)}),t._updateOverlayContainer(i))}),e.on("element.marker.update",function(e){var n=t._getOverlayContainer(e.element,!0);n&&ro(n.html)[e.add?"add":"remove"](e.marker)}),e.on("diagram.clear",this.clear,this)};var vo={__init__:["overlays"],overlays:["type",yo]},go={};function bo(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function xo(e){return e.originalEvent||e.srcEvent}go.getOriginal=xo,go.stopPropagation=function(e,t){bo(e),bo(xo(e))},go.toPoint=function(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null};var Eo={isMac:function(){return/mac/i.test(navigator.platform)}},_o={},wo=go.getOriginal,So=Eo.isMac;function To(e){return!(wo(e)||e).button}_o.isPrimaryButton=To,_o.hasPrimaryModifier=function(e){var t=wo(e)||e;return!!To(e)&&(So()?t.metaKey:t.ctrlKey)},_o.hasSecondaryModifier=function(e){var t=wo(e)||e;return To(e)&&t.shiftKey};var Co=s.forEach,Ao=Y.delegate,Ro=_o.isPrimaryButton,Po=n.append,Mo=n.attr,ko=n.create,Bo=Y.query,No=i.createLine,Do=i.updateLine;function Oo(e){return!0}var Lo=500;function Io(e,t,n){var i=n.cls("djs-hit",["no-fill","no-border"],{stroke:"white",strokeWidth:15});function r(n,i,r){var o,a;(function(e,t){return!(c[e]||Ro)(t)})(n,i)||(r?a=t.getGraphics(r):(o=i.delegateTarget||i.target)&&(a=o,r=t.get(a)),a&&r&&!1===e.fire(n,{element:r,gfx:a,originalEvent:i})&&(i.stopPropagation(),i.preventDefault()))}var o={};function a(e){return o[e]}var s={mouseover:"element.hover",mouseout:"element.out",click:"element.click",dblclick:"element.dblclick",mousedown:"element.mousedown",mouseup:"element.mouseup",contextmenu:"element.contextmenu"},c={"element.contextmenu":Oo};var p="svg, .djs-element";function l(e,t,n,i){var a=o[n]=function(e){r(n,e)};i&&(c[n]=i),a.$delegate=Ao.bind(e,p,t,a)}function u(e,t,n){var i=a(n);i&&Ao.unbind(e,t,i.$delegate)}e.on("canvas.destroy",function(e){var t;t=e.svg,Co(s,function(e,n){u(t,n,e)})}),e.on("canvas.init",function(e){var t;t=e.svg,Co(s,function(e,n){l(t,n,e)})}),e.on(["shape.added","connection.added"],function(e){var t,n=e.element,r=e.gfx;n.waypoints?t=No(n.waypoints):(t=ko("rect"),Mo(t,{x:0,y:0,width:n.width,height:n.height})),Mo(t,i),Po(r,t)}),e.on("shape.changed",Lo,function(e){var t=e.element,n=e.gfx,i=Bo(".djs-hit",n);Mo(i,{width:t.width,height:t.height})}),e.on("connection.changed",function(e){var t=e.element,n=e.gfx,i=Bo(".djs-hit",n);Do(i,t.waypoints)}),this.fire=r,this.triggerMouseEvent=function(e,t,n){var i=s[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return r(i,t,n)},this.mouseHandler=a,this.registerEvent=l,this.unregisterEvent=u}Io.$inject=["eventBus","elementRegistry","styles"];var jo={__init__:["interactionEvents"],interactionEvents:["type",Io]},zo=ui.getBBox,Fo=500,$o=n.append,Go=n.attr,Wo=n.create,Ho=Y.query,Vo=s.assign;function qo(e,t,n){this.offset=6;var i=t.cls("djs-outline",["no-fill"]),r=this;function o(e,t){var n=Wo("rect");return Go(n,Vo({x:10,y:10,width:100,height:100},i)),$o(e,n),n}e.on(["shape.added","shape.changed"],Fo,function(e){var t=e.element,n=e.gfx,i=Ho(".djs-outline",n);i||(i=o(n)),r.updateShapeOutline(i,t)}),e.on(["connection.added","connection.changed"],function(e){var t=e.element,n=e.gfx,i=Ho(".djs-outline",n);i||(i=o(n)),r.updateConnectionOutline(i,t)})}qo.prototype.updateShapeOutline=function(e,t){Go(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},qo.prototype.updateConnectionOutline=function(e,t){var n=zo(t);Go(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},qo.$inject=["eventBus","styles","elementRegistry"];var Uo={__init__:["outline"],outline:["type",qo]},Yo=s.isArray,Ko=s.forEach;function Xo(e){this._eventBus=e,this._selectedElements=[];var t=this;e.on(["shape.remove","connection.remove"],function(e){var n=e.element;t.deselect(n)}),e.on(["diagram.clear"],function(e){t.select(null)})}Xo.$inject=["eventBus"];var Zo=Xo;Xo.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var i=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},Xo.prototype.get=function(){return this._selectedElements},Xo.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},Xo.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();Yo(e)||(e=e?[e]:[]),t?Ko(e,function(e){-1===n.indexOf(e)&&n.push(e)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:n})};var Qo=_o.hasPrimaryModifier,Jo=s.find;function ea(e,t,n,i){e.on("create.end",500,function(e){e.context.canExecute&&t.select(e.context.shape)}),e.on("connect.end",500,function(e){e.context.canExecute&&e.context.target&&t.select(e.context.target)}),e.on("shape.move.end",500,function(e){var n=e.previousSelection||[],r=i.get(e.context.shape.id);Jo(n,function(e){return r.id===e.id})||t.select(r)}),e.on("element.click",function(e){var i=e.element;i===n.getRootElement()&&(i=null);var r=t.isSelected(i),o=t.get().length>1,a=Qo(e);if(r&&o)return a?t.deselect(i):t.select(i);r?t.deselect(i):t.select(i,a)})}ea.$inject=["eventBus","selection","canvas","elementRegistry"];var ta=ea,na=s.forEach,ia="hover",ra="selected";function oa(e,t,n,i){function r(e,n){t.addMarker(e,n)}function o(e,n){t.removeMarker(e,n)}this._multiSelectionBox=null,e.on("element.hover",function(e){r(e.element,ia)}),e.on("element.out",function(e){o(e.element,ia)}),e.on("selection.changed",function(e){var t=e.oldSelection,n=e.newSelection;na(t,function(e){-1===n.indexOf(e)&&o(e,ra)}),na(n,function(e){-1===t.indexOf(e)&&r(e,ra)})})}oa.$inject=["eventBus","canvas","selection","styles"];var aa={__init__:["selectionVisuals","selectionBehavior"],__depends__:[jo,Uo],selection:["type",Zo],selectionVisuals:["type",oa],selectionBehavior:["type",ta]},sa=s.assign,ca=s.isNumber,pa=s.omit,la=Y.domify,ua=Y.query,ha=Y.remove,da=n.innerSVG,ma=ut.importBpmnDiagram;var fa={width:"100%",height:"100%",position:"relative"};function ya(e){return e+(ca(e)?"px":"")}function va(e){var t,n,i;e=sa({},fa,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),t=this._container,n=ht.BPMNIO_IMG,i=la('<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" style="position: absolute; bottom: 15px; right: 15px; z-index: 100">'+n+"</a>"),t.appendChild(i),ba.bind(i,"click",function(e){ht.open(),e.preventDefault()}),this._init(this._container,this._moddle,e)}U(va,qr);var ga=va;va.prototype.importXML=function(e,t){t=t||function(){};var n=this;e=this._emit("import.parse.start",{xml:e})||e,this._moddle.fromXML(e,"bpmn:Definitions",function(e,i,r){i=n._emit("import.parse.complete",{error:e,definitions:i,context:r})||i;var o=r.warnings;if(e)return e=function(e){var t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+t[2]),e}(e),n._emit("import.done",{error:e,warnings:o}),t(e,o);n.importDefinitions(i,function(e,i){var r=[].concat(o,i||[]);n._emit("import.done",{error:e,warnings:r}),t(e,r)})})},va.prototype.saveXML=function(e,t){t||(t=e,e={});var n=this._definitions;if(!n)return t(new Error("no definitions loaded"));this._moddle.toXML(n,e,t)},va.prototype.saveSVG=function(e,t){var n,i;t||(t=e,e={});try{var r=this.get("canvas"),o=r.getDefaultLayer(),a=ua("defs",r._svg),s=da(o),c=a?"<defs>"+da(a)+"</defs>":"",p=o.getBBox();n='<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- created with bpmn-js / http://bpmn.io --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+p.width+'" height="'+p.height+'" viewBox="'+p.x+" "+p.y+" "+p.width+" "+p.height+'" version="1.1">'+c+s+"</svg>"}catch(e){i=e}t(i,n)},va.prototype.importDefinitions=function(e,t){try{this._definitions&&this.clear(),this._definitions=e}catch(e){return t(e)}return ma(this,e,t)},va.prototype.getModules=function(){return this._modules},va.prototype.destroy=function(){qr.prototype.destroy.call(this),ha(this._container)},va.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},va.prototype.off=function(e,t){this.get("eventBus").off(e,t)},va.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),"string"==typeof e&&(e=ua(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},va.prototype.getDefinitions=function(){return this._definitions},va.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},va.prototype._init=function(e,t,n){var i=n.modules||this.getModules(),r=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],i,r),a=sa(pa(n,["additionalModules"]),{canvas:sa({},n.canvas,{container:e}),modules:o});qr.call(this,a),n&&n.container&&this.attachTo(n.container)},va.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},va.prototype._createContainer=function(e){var t=la('<div class="bjs-container"></div>');return sa(t.style,{width:ya(e.width),height:ya(e.height),position:e.position}),t},va.prototype._createModdle=function(e){var t=sa({},this._moddleExtensions,e.moddleExtensions);return new pi(t)},va.prototype._modules=[Je,Qe,aa,vo],va.prototype._moddleExtensions={};var ba=Y.event;var xa={},Ea=5e3;xa.install=function(e,t){function n(){return!1}return t=t||"element.click",e.once(t,Ea,n),function(){e.off(t,n)}};var _a={},wa=Y.classes,Sa=/^djs-cursor-.*$/;_a.set=function(e){var t=wa(document.body);t.removeMatching(Sa),e&&t.add("djs-cursor-"+e)},_a.unset=function(){this.set(null)};var Ta={};Ta.log10=function(e){return Math.log(e)/Math.log(10)},Ta.substract=function(e,t){return{x:e.x-t.x,y:e.y-t.y}};var Ca=Ta.substract,Aa=Y.event,Ra=Y.closest;var Pa=15;function Ma(e,t){var n;function i(i){var r,o=n.start,a=go.toPoint(i),s=Ca(a,o);if(!n.dragging&&(r=s,Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))>Pa)&&(n.dragging=!0,xa.install(e),_a.set("grab")),n.dragging){var c=n.last||n.start;s=Ca(a,c),t.scroll({dx:s.x,dy:s.y}),n.last=a}i.preventDefault()}function r(e){Aa.unbind(document,"mousemove",i),Aa.unbind(document,"mouseup",r),n=null,_a.unset()}e.on("element.mousedown",500,function(e){return function(e){if(!Ra(e.target,".djs-draggable")&&!(e.button||e.ctrlKey||e.shiftKey||e.altKey))return n={start:go.toPoint(e)},Aa.bind(document,"mousemove",i),Aa.bind(document,"mouseup",r),!0}(e.originalEvent)})}Ma.$inject=["eventBus","canvas"];var ka={__init__:["moveCanvas"],moveCanvas:["type",Ma]},Ba={},Na=Ta.log10;Ba.getStepSize=function(e,t){var n=Na(e.min),i=Na(e.max);return(Math.abs(n)+Math.abs(i))/t},Ba.cap=function(e,t){return Math.max(e.min,Math.min(e.max,t))};var Da=Y.event,Oa=Y.closest,La=Ba.getStepSize,Ia=Ba.cap,ja=Ta.log10,za=s.bind,Fa=Math.sign||function(e){return e>=0?1:-1},$a={min:.2,max:4},Ga=.75;function Wa(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=za(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Ga;var i=this;t.on("canvas.init",function(t){i._init(!1!==e.enabled)})}Wa.$inject=["config.zoomScroll","eventBus","canvas"];var Ha=Wa;Wa.prototype.scroll=function(e){this._canvas.scroll(e)},Wa.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Wa.prototype.zoom=function(e,t){var n=La($a,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},Wa.prototype._handleWheel=function(e){if(!Oa(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=e.ctrlKey,r=e.shiftKey,o=-1*this._scale;if(o*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){var a=t.getBoundingClientRect(),s={x:e.clientX-a.left,y:e.clientY-a.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Fa(e.deltaY)*o,this.zoom(n,s)}else n=r?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},Wa.prototype.stepZoom=function(e,t){var n=La($a,10);this._zoom(e,t,n)},Wa.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=ja(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(Ia($a,s),t)},Wa.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&Da[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},Wa.prototype._init=function(e){this.toggle(e)};var Va={__init__:["zoomScroll"],zoomScroll:["type",Ha]};function qa(e){ga.call(this,e)}U(qa,ga);var Ua=qa;qa.prototype._navigationModules=[Va,ka],qa.prototype._modules=[].concat(qa.prototype._modules,qa.prototype._navigationModules);var Ya={};function Ka(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}Ya.pointDistance=Ka,Ya.pointsOnLine=function(e,t,n,i){if(void 0===i&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=Ka(e,t);return Math.abs(r/o)<=i};var Xa=2;Ya.pointsAligned=function(e,t){return Math.abs(e.x-t.x)<=Xa?"h":Math.abs(e.y-t.y)<=Xa&&"v"},Ya.pointInRect=function(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n},Ya.getMidPoint=function(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}};var Za="hasOwnProperty",Qa=/,?([a-z]),?/gi,Ja=parseFloat,es=Math,ts=es.PI,ns=es.min,is=es.max,rs=es.pow,os=es.abs,as=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,ss=/(-?\d*\.?\d*(?:e[-+]?\\d+)?)[\s]*,?[\s]*/gi;function cs(e,t){return"finite"==(t=String.prototype.toLowerCase.call(t))?isFinite(e):!("array"!=t||!(e instanceof Array||Array.isArray&&Array.isArray(e)))||("null"==t&&null===e||t==typeof e&&null!==e||"object"==t&&e===Object(e)||Object.prototype.toString.call(e).slice(8,-1).toLowerCase()==t)}function ps(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)e[Za](n)&&(t[n]=ps(e[n]));return t}function ls(e){var t=ls.ps=ls.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout(function(){for(var n in t)t[Za](n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])}),t[e]}function us(e,t,n,i){return null==e&&(e=t=n=i=0),null==t&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,w:n,height:i,h:i,x2:e+n,y2:t+i,cx:e+n/2,cy:t+i/2,r1:es.min(n,i)/2,r2:es.max(n,i)/2,r0:es.sqrt(n*n+i*i)/2,path:function(e,t,n,i,r){if(r)return[["M",+e+ +r,t],["l",n-2*r,0],["a",r,r,0,0,1,r,r],["l",0,i-2*r],["a",r,r,0,0,1,-r,r],["l",2*r-n,0],["a",r,r,0,0,1,-r,-r],["l",0,2*r-i],["a",r,r,0,0,1,r,-r],["z"]];var o=[["M",e,t],["l",n,0],["l",0,i],["l",-n,0],["z"]];return o.toString=hs,o}(e,t,n,i),vb:[e,t,n,i].join(" ")}}function hs(){return this.join(",").replace(Qa,"$1")}function ds(e){var t=ps(e);return t.toString=hs,t}function ms(e,t,n,i,r,o,a,s,c){var p=1-c,l=rs(p,3),u=rs(p,2),h=c*c,d=h*c,m=e+2*c*(n-e)+h*(r-2*n+e),f=t+2*c*(i-t)+h*(o-2*i+t),y=n+2*c*(r-n)+h*(a-2*r+n),v=i+2*c*(o-i)+h*(s-2*o+i);return{x:l*e+3*u*c*n+3*p*c*c*r+d*a,y:l*t+3*u*c*i+3*p*c*c*o+d*s,m:{x:m,y:f},n:{x:y,y:v},start:{x:p*e+c*n,y:p*t+c*i},end:{x:p*r+c*a,y:p*o+c*s},alpha:90-180*es.atan2(m-y,f-v)/ts}}function fs(e,t,n,i,r,o,a,s){cs(e,"array")||(e=[e,t,n,i,r,o,a,s]);var c=function(e,t,n,i,r,o,a,s){for(var c,p,l,u,h,d,m,f,y=[],v=[[],[]],g=0;g<2;++g)if(0==g?(p=6*e-12*n+6*r,c=-3*e+9*n-9*r+3*a,l=3*n-3*e):(p=6*t-12*i+6*o,c=-3*t+9*i-9*o+3*s,l=3*i-3*t),os(c)<1e-12){if(os(p)<1e-12)continue;0<(u=-l/p)&&u<1&&y.push(u)}else m=p*p-4*l*c,f=es.sqrt(m),m<0||(0<(h=(-p+f)/(2*c))&&h<1&&y.push(h),0<(d=(-p-f)/(2*c))&&d<1&&y.push(d));var b,x=y.length,E=x;for(;x--;)u=y[x],b=1-u,v[0][x]=b*b*b*e+3*b*b*u*n+3*b*u*u*r+u*u*u*a,v[1][x]=b*b*b*t+3*b*b*u*i+3*b*u*u*o+u*u*u*s;return v[0][E]=e,v[1][E]=t,v[0][E+1]=a,v[1][E+1]=s,v[0].length=v[1].length=E+2,{min:{x:ns.apply(0,v[0]),y:ns.apply(0,v[1])},max:{x:is.apply(0,v[0]),y:is.apply(0,v[1])}}}.apply(null,e);return us(c.min.x,c.min.y,c.max.x-c.min.x,c.max.y-c.min.y)}function ys(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function vs(e,t,n,i,r){return e*(e*(-3*t+9*n-9*i+3*r)+6*t-12*n+6*i)-3*t+3*n}function gs(e,t,n,i,r,o,a,s,c){null==c&&(c=1);for(var p=(c=c>1?1:c<0?0:c)/2,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,d=0;d<12;d++){var m=p*l[d]+p,f=vs(m,e,n,r,a),y=vs(m,t,i,o,s),v=f*f+y*y;h+=u[d]*es.sqrt(v)}return p*h}function bs(e,t,n,i,r,o,a,s){if(!(is(e,n)<ns(r,a)||ns(e,n)>is(r,a)||is(t,i)<ns(o,s)||ns(t,i)>is(o,s))){var c=(e-n)*(o-s)-(t-i)*(r-a);if(c){var p=((e*i-t*n)*(r-a)-(e-n)*(r*s-o*a))/c,l=((e*i-t*n)*(o-s)-(t-i)*(r*s-o*a))/c,u=+p.toFixed(2),h=+l.toFixed(2);if(!(u<+ns(e,n).toFixed(2)||u>+is(e,n).toFixed(2)||u<+ns(r,a).toFixed(2)||u>+is(r,a).toFixed(2)||h<+ns(t,i).toFixed(2)||h>+is(t,i).toFixed(2)||h<+ns(o,s).toFixed(2)||h>+is(o,s).toFixed(2)))return{x:p,y:l}}}}function xs(e,t,n){if(!function(e,t){return e=us(e),ys(t=us(t),e.x,e.y)||ys(t,e.x2,e.y)||ys(t,e.x,e.y2)||ys(t,e.x2,e.y2)||ys(e,t.x,t.y)||ys(e,t.x2,t.y)||ys(e,t.x,t.y2)||ys(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}(fs(e),fs(t)))return n?0:[];for(var i=~~(gs.apply(0,e)/5),r=~~(gs.apply(0,t)/5),o=[],a=[],s={},c=n?0:[],p=0;p<i+1;p++){var l=ms.apply(0,e.concat(p/i));o.push({x:l.x,y:l.y,t:p/i})}for(p=0;p<r+1;p++)l=ms.apply(0,t.concat(p/r)),a.push({x:l.x,y:l.y,t:p/r});for(p=0;p<i;p++)for(var u=0;u<r;u++){var h=o[p],d=o[p+1],m=a[u],f=a[u+1],y=os(d.x-h.x)<.01?"y":"x",v=os(f.x-m.x)<.01?"y":"x",g=bs(h.x,h.y,d.x,d.y,m.x,m.y,f.x,f.y);if(g){if(s[g.x.toFixed(0)]==g.y.toFixed(0))continue;s[g.x.toFixed(0)]=g.y.toFixed(0);var b=h.t+os((g[y]-h[y])/(d[y]-h[y]))*(d.t-h.t),x=m.t+os((g[v]-m[v])/(f[v]-m[v]))*(f.t-m.t);b>=0&&b<=1&&x>=0&&x<=1&&(n?c++:c.push({x:g.x,y:g.y,t1:b,t2:x}))}}return c}function Es(e,t,n,i,r){if(null==r&&null==i&&(i=n),e=+e,t=+t,n=+n,i=+i,null!=r)var o=Math.PI/180,a=e+n*Math.cos(-i*o),s=e+n*Math.cos(-r*o),c=[["M",a,t+n*Math.sin(-i*o)],["A",n,n,0,+(r-i>180),0,s,t+n*Math.sin(-r*o)]];else c=[["M",e,t],["m",0,-i],["a",n,i,0,1,1,0,2*i],["a",n,i,0,1,1,0,-2*i],["z"]];return c.toString=hs,c}function _s(e){var t=ls(e);if(t.abs)return ds(t.abs);if(cs(e,"array")&&cs(e&&e[0],"array")||(e=function(e){if(!e)return null;var t=ls(e);if(t.arr)return ps(t.arr);var n={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},i=[];return cs(e,"array")&&cs(e[0],"array")&&(i=ps(e)),i.length||String(e).replace(as,function(e,t,r){var o=[],a=t.toLowerCase();if(r.replace(ss,function(e,t){t&&o.push(+t)}),"m"==a&&o.length>2&&(i.push([t].concat(o.splice(0,2))),a="l",t="m"==t?"l":"L"),"o"==a&&1==o.length&&i.push([t,o[0]]),"r"==a)i.push([t].concat(o));else for(;o.length>=n[a]&&(i.push([t].concat(o.splice(0,n[a]))),n[a]););}),i.toString=ls.toString,t.arr=ps(i),i}(e)),!e||!e.length)return[["M",0,0]];var n,i=[],r=0,o=0,a=0,s=0,c=0;"M"==e[0][0]&&(a=r=+e[0][1],s=o=+e[0][2],c++,i[0]=["M",r,o]);for(var p,l,u=3==e.length&&"M"==e[0][0]&&"R"==e[1][0].toUpperCase()&&"Z"==e[2][0].toUpperCase(),h=c,d=e.length;h<d;h++){if(i.push(p=[]),(n=(l=e[h])[0])!=n.toUpperCase())switch(p[0]=n.toUpperCase(),p[0]){case"A":p[1]=l[1],p[2]=l[2],p[3]=l[3],p[4]=l[4],p[5]=l[5],p[6]=+l[6]+r,p[7]=+l[7]+o;break;case"V":p[1]=+l[1]+o;break;case"H":p[1]=+l[1]+r;break;case"R":for(var m=[r,o].concat(l.slice(1)),f=2,y=m.length;f<y;f++)m[f]=+m[f]+r,m[++f]=+m[f]+o;i.pop(),i=i.concat(Cs(m,u));break;case"O":i.pop(),(m=Es(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);break;case"U":i.pop(),i=i.concat(Es(r,o,l[1],l[2],l[3])),p=["U"].concat(i[i.length-1].slice(-2));break;case"M":a=+l[1]+r,s=+l[2]+o;default:for(f=1,y=l.length;f<y;f++)p[f]=+l[f]+(f%2?r:o)}else if("R"==n)m=[r,o].concat(l.slice(1)),i.pop(),i=i.concat(Cs(m,u)),p=["R"].concat(l.slice(-2));else if("O"==n)i.pop(),(m=Es(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);else if("U"==n)i.pop(),i=i.concat(Es(r,o,l[1],l[2],l[3])),p=["U"].concat(i[i.length-1].slice(-2));else for(var v=0,g=l.length;v<g;v++)p[v]=l[v];if("O"!=(n=n.toUpperCase()))switch(p[0]){case"Z":r=+a,o=+s;break;case"H":r=p[1];break;case"V":o=p[1];break;case"M":a=p[p.length-2],s=p[p.length-1];default:r=p[p.length-2],o=p[p.length-1]}}return i.toString=hs,t.abs=ds(i),i}function ws(e,t,n,i){return[e,t,n,i,n,i]}function Ss(e,t,n,i,r,o){return[1/3*e+2/3*n,1/3*t+2/3*i,1/3*r+2/3*n,1/3*o+2/3*i,r,o]}function Ts(e,t,n,i,r,o,a,s,c,p){var l,u,h,d,m=120*ts/180,f=ts/180*(+r||0),y=[],v=(u=function(e,t,n){return{x:e*es.cos(n)-t*es.sin(n),y:e*es.sin(n)+t*es.cos(n)}},function e(){var t=Array.prototype.slice.call(arguments,0),n=t.join("␀"),i=e.cache=e.cache||{},r=e.count=e.count||[];return i[Za](n)?(function(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}(r,n),d?d(i[n]):i[n]):(r.length>=1e3&&delete i[r.shift()],r.push(n),i[n]=u.apply(h,t),d?d(i[n]):i[n])});if(p)C=p[0],A=p[1],S=p[2],T=p[3];else{e=(l=v(e,t,-f)).x,t=l.y;var g=(e-(s=(l=v(s,c,-f)).x))/2,b=(t-(c=l.y))/2,x=g*g/(n*n)+b*b/(i*i);x>1&&(n*=x=es.sqrt(x),i*=x);var E=n*n,_=i*i,w=(o==a?-1:1)*es.sqrt(os((E*_-E*b*b-_*g*g)/(E*b*b+_*g*g))),S=w*n*b/i+(e+s)/2,T=w*-i*g/n+(t+c)/2,C=es.asin(((t-T)/i).toFixed(9)),A=es.asin(((c-T)/i).toFixed(9));(C=e<S?ts-C:C)<0&&(C=2*ts+C),(A=s<S?ts-A:A)<0&&(A=2*ts+A),a&&C>A&&(C-=2*ts),!a&&A>C&&(A-=2*ts)}var R=A-C;if(os(R)>m){var P=A,M=s,k=c;A=C+m*(a&&A>C?1:-1),y=Ts(s=S+n*es.cos(A),c=T+i*es.sin(A),n,i,r,0,a,M,k,[A,P,S,T])}R=A-C;var B=es.cos(C),N=es.sin(C),D=es.cos(A),O=es.sin(A),L=es.tan(R/4),I=4/3*n*L,j=4/3*i*L,z=[e,t],F=[e+I*N,t-j*B],$=[s+I*O,c-j*D],G=[s,c];if(F[0]=2*z[0]-F[0],F[1]=2*z[1]-F[1],p)return[F,$,G].concat(y);for(var W=[],H=0,V=(y=[F,$,G].concat(y).join().split(",")).length;H<V;H++)W[H]=H%2?v(y[H-1],y[H],f).y:v(y[H],y[H+1],f).x;return W}function Cs(e,t){for(var n=[],i=0,r=e.length;r-2*!t>i;i+=2){var o=[{x:+e[i-2],y:+e[i-1]},{x:+e[i],y:+e[i+1]},{x:+e[i+2],y:+e[i+3]},{x:+e[i+4],y:+e[i+5]}];t?i?r-4==i?o[3]={x:+e[0],y:+e[1]}:r-2==i&&(o[2]={x:+e[0],y:+e[1]},o[3]={x:+e[2],y:+e[3]}):o[0]={x:+e[r-2],y:+e[r-1]}:r-4==i?o[3]=o[2]:i||(o[0]={x:+e[i],y:+e[i+1]}),n.push(["C",(-o[0].x+6*o[1].x+o[2].x)/6,(-o[0].y+6*o[1].y+o[2].y)/6,(o[1].x+6*o[2].x-o[3].x)/6,(o[1].y+6*o[2].y-o[3].y)/6,o[2].x,o[2].y])}return n}function As(e,t){var n=!t&&ls(e);if(!t&&n.curve)return ds(n.curve);for(var i=_s(e),r=t&&_s(t),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s=function(e,t,n){var i,r;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"].concat(Ts.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":"C"==n||"S"==n?(i=2*t.x-t.bx,r=2*t.y-t.by):(i=t.x,r=t.y),e=["C",i,r].concat(e.slice(1));break;case"T":"Q"==n||"T"==n?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),e=["C"].concat(Ss(t.x,t.y,t.qx,t.qy,e[1],e[2]));break;case"Q":t.qx=e[1],t.qy=e[2],e=["C"].concat(Ss(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(ws(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(ws(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(ws(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(ws(t.x,t.y,t.X,t.Y))}return e},c=function(e,t){if(e[t].length>7){e[t].shift();for(var n=e[t];n.length;)l[t]="A",r&&(u[t]="A"),e.splice(t++,0,["C"].concat(n.splice(0,6)));e.splice(t,1),f=is(i.length,r&&r.length||0)}},p=function(e,t,n,o,a){e&&t&&"M"==e[a][0]&&"M"!=t[a][0]&&(t.splice(a,0,["M",o.x,o.y]),n.bx=0,n.by=0,n.x=e[a][1],n.y=e[a][2],f=is(i.length,r&&r.length||0))},l=[],u=[],h="",d="",m=0,f=is(i.length,r&&r.length||0);m<f;m++){i[m]&&(h=i[m][0]),"C"!=h&&(l[m]=h,m&&(d=l[m-1])),i[m]=s(i[m],o,d),"A"!=l[m]&&"C"==h&&(l[m]="C"),c(i,m),r&&(r[m]&&(h=r[m][0]),"C"!=h&&(u[m]=h,m&&(d=u[m-1])),r[m]=s(r[m],a,d),"A"!=u[m]&&"C"==h&&(u[m]="C"),c(r,m)),p(i,r,o,a,m),p(r,i,a,o,m);var y=i[m],v=r&&r[m],g=y.length,b=r&&v.length;o.x=y[g-2],o.y=y[g-1],o.bx=Ja(y[g-4])||o.x,o.by=Ja(y[g-3])||o.y,a.bx=r&&(Ja(v[b-4])||a.x),a.by=r&&(Ja(v[b-3])||a.y),a.x=r&&v[b-2],a.y=r&&v[b-1]}return r||(n.curve=ds(i)),r?[i,r]:i}var Rs=function(e,t,n){e=As(e),t=As(t);for(var i,r,o,a,s,c,p,l,u,h,d=n?0:[],m=0,f=e.length;m<f;m++){var y=e[m];if("M"==y[0])i=s=y[1],r=c=y[2];else{"C"==y[0]?(i=(u=[i,r].concat(y.slice(1)))[6],r=u[7]):(u=[i,r,i,r,s,c,s,c],i=s,r=c);for(var v=0,g=t.length;v<g;v++){var b=t[v];if("M"==b[0])o=p=b[1],a=l=b[2];else{"C"==b[0]?(o=(h=[o,a].concat(b.slice(1)))[6],a=h[7]):(h=[o,a,o,a,p,l,p,l],o=p,a=l);var x=xs(u,h,n);if(n)d+=x;else{for(var E=0,_=x.length;E<_;E++)x[E].segment1=m,x[E].segment2=v,x[E].bez1=u,x[E].bez2=h;d=d.concat(x)}}}}}return d},Ps={},Ms=s.isObject,ks=s.sortBy,Bs=Ya.pointDistance;function Ns(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ds(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Os(e,t){return Rs(e,t)}Ps.roundBounds=function(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}},Ps.roundPoint=Ns,Ps.asTRBL=Ds,Ps.asBounds=function(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}},Ps.getMid=function(e){return Ns({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})},Ps.getOrientation=function(e,t,n){Ms(n=n||0)||(n={x:n,y:n});var i=Ds(e),r=Ds(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=o?"top":s?"bottom":null,p=i.right+n.x<=r.left?"left":a?"right":null;return p&&c?c+"-"+p:p||c||"intersect"},Ps.getElementLineIntersection=function(e,t,n){var i=Os(e,t);return 1===i.length?Ns(i[0]):2===i.length&&Bs(i[0],i[1])<1?Ns(i[0]):i.length>1?Ns((i=ks(i,function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t}))[n?0:i.length-1]):null};var Ls={},Is=d.is,js=Ps.getMid,zs=Ps.asTRBL,Fs=Ps.getOrientation,$s=s.find,Gs=s.reduce,Ws=50,Hs=250,Vs=10;function qs(e,t){var n=zs(e);function i(e){return Is(e,"bpmn:SequenceFlow")}var r,o=Gs([].concat(Qs(e,i).map((r=5,function(e){return{shape:e,weight:r,distanceTo:function(e){return zs(e).left-n.right}}})),Zs(e,i).map(function(e){return function(t){return{shape:t,weight:e,distanceTo:function(e){var t=zs(e);return n.left-t.right}}}}(1))),function(e,t){return e[t.shape.id+"__weight_"+t.weight]=t,e},{}),a=Gs(o,function(e,t){var n,i,r,o=t.shape,a=t.weight,s=t.distanceTo,c=e.fav;return(n=s(o))<0||n>Hs?e:(i=(r=e[String(n)]=e[String(n)]||{value:n,count:0}).count+=1*a,(!c||c.count<i)&&(e.fav=r),e)},{});return a.fav?a.fav.value:Ws}function Us(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=function(e,t){var n=Xs(e);return e.host&&(n=n.concat(Xs(e.host))),e.attachers&&(n=n.concat(e.attachers.reduce(function(e,t){return e.concat(Xs(t))},[]))),n}(e);return $s(r,function(e){return e!==n&&"intersect"===Fs(e,i,Vs)})}function Ys(e,t,n,i){function r(e){var r={x:n.x,y:n.y};return["x","y"].forEach(function(a){var s=i[a];if(s){var c="x"===a?"width":"height",p=s.margin,l=s.rowSize;r[a]=p<0?Math.min(e[a]+p-t[c]/2,n[a]-l+p):Math.max(o[a]+o[c]+p+t[c]/2,n[a]+l+p)}}),r}for(var o;o=Us(e,n,t);)n=r(o);return n}function Ks(){return!0}function Xs(e,t){return[].concat(Qs(e,t),Zs(e,t))}function Zs(e,t){return t||(t=Ks),e.incoming.filter(t).map(function(e){return e.source})}function Qs(e,t){return t||(t=Ks),e.outgoing.filter(t).map(function(e){return e.target})}Ls.getFlowNodePosition=function(e,t){var n=zs(e),i=js(e),r=qs(e,t),o="left",a=30;Is(e,"bpmn:BoundaryEvent")&&"top"===(o=Fs(e,e.host,-25))&&(a*=-1);var s={left:0,right:0,top:-80,bottom:80};return Ys(e,t,{x:n.right+r+t.width/2,y:i.y+s[o]},{y:{margin:a,rowSize:80}})},Ls.getTextAnnotationPosition=function(e,t){var n=zs(e);return Ys(e,t,{x:n.right+t.width/2,y:n.top-50-t.height/2},{y:{margin:-30,rowSize:20}})},Ls.getDataElementPosition=function(e,t){var n=zs(e);return Ys(e,t,{x:n.right-10+t.width/2,y:n.bottom+40+t.width/2},{x:{margin:30,rowSize:30}})},Ls.getDefaultPosition=function(e,t){var n=zs(e),i=js(e);return{x:n.right+Ws+t.width/2,y:i.y}};var Js={},ec=s.some,tc=d.is;function nc(e,t){return ec(t,function(t){return tc(e,t)})}Js.isAny=nc,Js.getParent=function(e,t){for("string"==typeof t&&(t=[t]);e=e.parent;)if(nc(e,t))return e;return null};var ic=d.is,rc=Js.isAny,oc=Ls.getTextAnnotationPosition,ac=Ls.getDataElementPosition,sc=Ls.getFlowNodePosition,cc=Ls.getDefaultPosition;function pc(e,t){function n(t,n){return e.fire(t,n)}this.append=function(e,i){var r=n("autoPlace",{source:e,shape:i});r||(r=function(e,t){if(ic(t,"bpmn:TextAnnotation"))return oc(e,t);if(rc(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return ac(e,t);if(ic(t,"bpmn:FlowNode"))return sc(e,t);return cc(e,t)}(e,i));var o=t.appendShape(e,i,r,e.parent);return n("autoPlace.end",{shape:o}),o}}pc.$inject=["eventBus","modeling"];var lc=pc;function uc(e,t){e.on("autoPlace.end",500,function(e){t.select(e.shape)})}uc.$inject=["eventBus","selection"];var hc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",lc],autoPlaceSelectionBehavior:["type",uc]},dc=s.forEach,mc=s.isFunction,fc=s.isArray,yc=s.isNumber;function vc(e){this._eventBus=e}vc.$inject=["eventBus"];var gc=vc;vc.prototype.on=function(e,t,n,i,r,o){if((mc(t)||yc(t))&&(o=r,r=i,i=n,n=t,t=null),mc(n)&&(o=r,r=i,i=n,n=1e3),"object"==typeof r&&(o=r,r=!1),!mc(i))throw new Error("handlerFn must be a function");fc(e)||(e=[e]);var a=this._eventBus;dc(e,function(e){var s=["commandStack",e,t].filter(function(e){return e}).join(".");a.on(s,n,r?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(i,o):i,o)})};dc(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],function(e){vc.prototype[e]=function(t,n,i,r,o){(mc(t)||yc(t))&&(o=r,r=i,i=n,n=t,t=null),this.on(t,e,n,i,r,o)}});var bc=ui.getBBox,xc=Ps.asTRBL,Ec=Ps.asBounds,_c=s.assign,wc=s.flatten,Sc=s.forEach,Tc=s.values,Cc=s.groupBy;function Ac(e,t,n,i){gc.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(e){var t=e.context,n=t.hints,i=t.shape,o=t.parent||t.newParent;n&&!1===n.root||r._expand([i],o)}),this.postExecuted(["elements.move"],function(e){var t=e.context,n=wc(Tc(t.closure.topLevel)),i=t.hints;if(!i||!1!==i.autoResize){var o=Cc(n,function(e){return e.parent.id});Sc(o,function(e,t){r._expand(e,t)})}})}Ac.$inject=["eventBus","elementRegistry","modeling","rules"],U(Ac,gc);var Rc=Ac;Ac.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=xc(bc(e)),o=xc(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),Ec(_c({},o,a))},Ac.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){this.resize(t,n);var i=t.parent;i&&this._expand([t],i)}}},Ac.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Ac.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Ac.prototype.resize=function(e,t){this._modeling.resizeShape(e,t)};var Pc=d.is;function Mc(e,t,n,i){Rc.call(this,e,t,n,i)}Mc.$inject=["eventBus","elementRegistry","modeling","rules"],U(Mc,Rc);var kc=Mc;function Bc(e){gc.call(this,e),this.init()}Mc.prototype.resize=function(e,t){Pc(e,"bpmn:Participant")?this._modeling.resizeLane(e,t):this._modeling.resizeShape(e,t)},Bc.$inject=["eventBus"],U(Bc,gc);var Nc=Bc;function Dc(e){Nc.call(this,e);var t=this;this.addRule("element.autoResize",function(e){return t.canResize(e.elements,e.target)})}Bc.prototype.addRule=function(e,t,n){var i=this;"string"==typeof e&&(e=[e]),e.forEach(function(e){i.canExecute(e,t,function(e,t,i){return n(e)},!0)})},Bc.prototype.init=function(){},Dc.$inject=["eventBus"],U(Dc,Nc);var Oc=Dc;Dc.prototype.canResize=function(e,t){return!1};var Lc=d.is,Ic=s.forEach;function jc(e,t){Oc.call(this,e),this._modeling=t}U(jc,Oc),jc.$inject=["eventBus","modeling"];var zc=jc;jc.prototype.canResize=function(e,t){if(!Lc(t,"bpmn:Participant")&&!Lc(t,"bpmn:Lane")&&!Lc(t,"bpmn:SubProcess"))return!1;var n=!0;return Ic(e,function(e){(Lc(e,"bpmn:Lane")||e.labelTarget)&&(n=!1)}),n};var Fc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",kc],bpmnAutoResizeProvider:["type",zc]},$c={},Gc=s.filter,Wc=Math.max,Hc=Math.min,Vc=20,qc=ui.getBBox,Uc=Ps.asTRBL,Yc=Ps.asBounds;function Kc(e){return"number"==typeof e}function Xc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Kc(r)&&(i=(/top|left/.test(e)?Hc:Wc)(i,r)),Kc(o)&&(i=(/top|left/.test(e)?Wc:Hc)(i,o)),i}function Zc(e,t){return void 0!==e?e:Vc}function Qc(e,t){var n,i,r,o;return"object"==typeof t?(n=Zc(t.left),i=Zc(t.right),r=Zc(t.top),o=Zc(t.bottom)):n=i=r=o=Zc(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function Jc(e){return!e.waypoints&&"label"!==e.type}$c.substractTRBL=function(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}},$c.resizeBounds=function(e,t,n){var i=n.x,r=n.y;switch(t){case"nw":return{x:e.x+i,y:e.y+r,width:e.width-i,height:e.height-r};case"sw":return{x:e.x+i,y:e.y,width:e.width-i,height:e.height+r};case"ne":return{x:e.x,y:e.y+r,width:e.width+i,height:e.height-r};case"se":return{x:e.x,y:e.y,width:e.width+i,height:e.height+r};default:throw new Error("unrecognized direction: "+t)}},$c.resizeTRBL=function(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}},$c.ensureConstraints=function(e,t){if(!t)return e;var n=Uc(e);return Yc({top:Xc("top",n,t),right:Xc("right",n,t),bottom:Xc("bottom",n,t),left:Xc("left",n,t)})},$c.getMinResizeBounds=function(e,t,n,i){var r=Uc(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Uc(i):o,s={top:Hc(o.top,a.top),left:Hc(o.left,a.left),bottom:Wc(o.bottom,a.bottom),right:Wc(o.right,a.right)};return Yc(s)},$c.computeChildrenBBox=function(e,t){var n;if((n=void 0===e.length?Gc(e.children,Jc):e).length)return Qc(qc(n),t)};var ep={},tp=d.is,np=Js.getParent,ip=Ps.asTRBL,rp=$c.substractTRBL,op=$c.resizeTRBL,ap=Math.abs;var sp=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"];function cp(e,t){return t=t||[],e.children.filter(function(e){tp(e,"bpmn:Lane")&&(cp(e,t),t.push(e))}),t}function pp(e){return np(e,sp)||e}ep.LANE_INDENTATION=30,ep.collectLanes=cp,ep.getChildLanes=function(e){return e.children.filter(function(e){return tp(e,"bpmn:Lane")})},ep.getLanesRoot=pp,ep.computeLanesResize=function(e,t){var n=pp(e),i=cp(n,tp(n,"bpmn:Process")?[]:[n]),r=ip(e),o=ip(t),a=function(e,t){return rp(ip(t),ip(e))}(e,t),s=[];return i.forEach(function(t){if(t!==e){var n=0,i=a.right,c=0,p=a.left,l=ip(t);a.top&&(ap(l.bottom-r.top)<10&&(c=o.top-l.bottom),ap(l.top-r.top)<5&&(n=o.top-l.top)),a.bottom&&(ap(l.top-r.bottom)<10&&(n=o.bottom-l.top),ap(l.bottom-r.bottom)<5&&(c=o.bottom-l.bottom)),(n||i||c||p)&&s.push({shape:t,newBounds:op(t,{top:n,right:i,bottom:c,left:p})})}}),s};var lp=s.assign,up=s.forEach,hp=s.isArray,dp=d.is,mp=f.isExpanded,fp=Js.isAny,yp=ep.getChildLanes,vp=f.isEventSubProcess,gp=_o.hasPrimaryModifier;function bp(e,t,n,i,r,o,a,s,c,p,l,u){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=p,this._rules=l,this._translate=u,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(e){var t=e.context.shape;if(gp(e)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})}bp.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate"];var xp=bp;function Ep(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return up(o,function(e){e.$type===n&&(r=!0)}),i&&r}bp.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._canvas,c=this._rules,p=this._autoPlace,l=this._translate,u={};if("label"===e.type)return u;var h,d=e.businessObject;function m(e,t){r.start(e,t)}function f(e,t,n,r){function a(t,n){var a=i.createShape(lp({type:e},r));o.start(t,a,n)}return"string"!=typeof n&&(r=n,n=l("Append {type}",{type:e.replace(/^bpmn:/,"")})),{group:"model",className:t,title:n,action:{dragstart:a,click:p?function(t,n){var o=i.createShape(lp({type:e},r));p.append(n,o)}:a}}}function y(e){return function(i,r){n.splitLane(r,e),t.open(r,!0)}}if(fp(d,["bpmn:Lane","bpmn:Participant"])&&mp(d)){var v=yp(e);lp(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:l("Add Lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),v.length<2&&(e.height>=120&&lp(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:l("Divide into two Lanes"),action:{click:y(2)}}}),e.height>=180&&lp(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:l("Divide into three Lanes"),action:{click:y(3)}}})),lp(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:l("Add Lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}dp(d,"bpmn:FlowNode")&&(dp(d,"bpmn:EventBasedGateway")?lp(u,{"append.receive-task":f("bpmn:ReceiveTask","bpmn-icon-receive-task"),"append.message-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condtion-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Ep(d,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?lp(u,{"append.compensation-activity":f("bpmn:Task","bpmn-icon-task",l("Append compensation activity"),{isForCompensation:!0})}):dp(d,"bpmn:EndEvent")||d.isForCompensation||Ep(d,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||vp(d)||lp(u,{"append.end-event":f("bpmn:EndEvent","bpmn-icon-end-event-none"),"append.gateway":f("bpmn:ExclusiveGateway","bpmn-icon-gateway-xor"),"append.append-task":f("bpmn:Task","bpmn-icon-task"),"append.intermediate-event":f("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none")})),a._providers["bpmn-replace"]&&(h=a.create("bpmn-replace",e)),h&&!h.isEmpty()&&lp(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:l("Change type"),action:{click:function(e,n){h.open(lp(function(e){var n=s.getContainer(),i=t.getPad(e).html,r=n.getBoundingClientRect(),o=i.getBoundingClientRect(),a=o.top-r.top;return{x:o.left-r.left,y:a+o.height+5}}(n),{cursor:{x:e.x,y:e.y}}),n)}}}}),fp(d,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&lp(u,{"append.text-annotation":f("bpmn:TextAnnotation","bpmn-icon-text-annotation"),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using "+(d.isForCompensation?"":"Sequence/MessageFlow or ")+"Association"),action:{click:m,dragstart:m}}}),fp(d,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&lp(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using DataInputAssociation"),action:{click:m,dragstart:m}}});var g=c.allowed("elements.delete",{elements:[e]});return hp(g)&&(g=g[0]===e),g&&lp(u,{delete:{group:"edit",className:"bpmn-icon-trash",title:l("Remove"),action:{click:function(t){n.removeElements([e])}}}}),u};var _p={},wp=d.getBusinessObject,Sp=f.isExpanded;_p.isDifferentType=function(e){return function(t){var n=t.target,i=wp(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=i.triggeredByEvent===n.triggeredByEvent,c=void 0===n.isExpanded||n.isExpanded===Sp(i);return!(o&&a&&s&&c)}};var Tp={START_EVENT:[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message Start Event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Start Event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional Start Event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal Start Event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],INTERMEDIATE_EVENT:[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message Intermediate Catch Event",actionName:"replace-with-message-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message Intermediate Throw Event",actionName:"replace-with-message-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Intermediate Catch Event",actionName:"replace-with-timer-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Intermediate Throw Event",actionName:"replace-with-escalation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Intermediate Catch Event",actionName:"replace-with-conditional-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Link Intermediate Catch Event",actionName:"replace-with-link-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition"}},{label:"Link Intermediate Throw Event",actionName:"replace-with-link-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition"}},{label:"Compensation Intermediate Throw Event",actionName:"replace-with-compensation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal Intermediate Catch Event",actionName:"replace-with-signal-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal Intermediate Throw Event",actionName:"replace-with-signal-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],END_EVENT:[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message End Event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Escalation End Event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Error End Event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel End Event",actionName:"replace-with-cancel-end",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Compensation End Event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal End Event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Terminate End Event",actionName:"replace-with-terminate-end",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}],GATEWAY:[{label:"Exclusive Gateway",actionName:"replace-with-exclusive-gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},{label:"Parallel Gateway",actionName:"replace-with-parallel-gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},{label:"Inclusive Gateway",actionName:"replace-with-inclusive-gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},{label:"Complex Gateway",actionName:"replace-with-complex-gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},{label:"Event based Gateway",actionName:"replace-with-event-based-gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}}],SUBPROCESS_EXPANDED:[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event Sub Process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Sub Process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],TRANSACTION:[{label:"Sub Process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Event Sub Process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}}],EVENT_SUB_PROCESS:[{label:"Sub Process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}}],TASK:[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"Send Task",actionName:"replace-with-send-task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},{label:"Receive Task",actionName:"replace-with-receive-task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},{label:"User Task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Manual Task",actionName:"replace-with-manual-task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},{label:"Business Rule Task",actionName:"replace-with-rule-task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},{label:"Service Task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{label:"Script Task",actionName:"replace-with-script-task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},{label:"Call Activity",actionName:"replace-with-call-activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},{label:"Sub Process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},{label:"Sub Process (expanded)",actionName:"replace-with-expanded-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}}],BOUNDARY_EVENT:[{label:"Message Boundary Event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Boundary Event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Boundary Event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Boundary Event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Error Boundary Event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel Boundary Event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Signal Boundary Event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Compensation Boundary Event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-message-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},{label:"Timer Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},{label:"Escalation Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},{label:"Conditional Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},{label:"Signal Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}}],EVENT_SUB_PROCESS_START_EVENT:[{label:"Message Start Event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Start Event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional Start Event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal Start Event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Error Start Event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Escalation Start Event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Compensation Start Event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-message-start",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},{label:"Timer Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-start",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},{label:"Conditional Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-start",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},{label:"Signal Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-start",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},{label:"Escalation Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-start",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}}],SEQUENCE_FLOW:[{label:"Sequence Flow",actionName:"replace-with-sequence-flow",className:"bpmn-icon-connection"},{label:"Default Flow",actionName:"replace-with-default-flow",className:"bpmn-icon-default-flow"},{label:"Conditional Flow",actionName:"replace-with-conditional-flow",className:"bpmn-icon-conditional-flow"}],PARTICIPANT:[{label:"Expanded Pool",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:"Collapsed Pool",actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}]},Cp=d.is,Ap=f.isEventSubProcess,Rp=d.getBusinessObject,Pp=f.isExpanded,Mp=_p.isDifferentType,kp=s.forEach,Bp=s.filter;function Np(e,t,n,i,r,o){this._popupMenu=e,this._modeling=t,this._moddle=n,this._bpmnReplace=i,this._rules=r,this._translate=o,this.register()}Np.$inject=["popupMenu","modeling","moddle","bpmnReplace","rules","translate"],Np.prototype.register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Np.prototype.getEntries=function(e){var t,n=e.businessObject;if(!this._rules.allowed("shape.replace",{element:e}))return[];var i=Mp(e);return Cp(n,"bpmn:StartEvent")&&!Ap(n.$parent)?(t=Bp(Tp.START_EVENT,i),this._createEntries(e,t)):Cp(n,"bpmn:Participant")?(t=Bp(Tp.PARTICIPANT,function(e){return Pp(n)!==e.target.isExpanded}),this._createEntries(e,t)):Cp(n,"bpmn:StartEvent")&&Ap(n.$parent)?(t=Bp(Tp.EVENT_SUB_PROCESS_START_EVENT,function(t){var n=!1!==t.target.isInterrupting,r=Rp(e).isInterrupting===n;return i(t)||!i(t)&&!r}),this._createEntries(e,t)):Cp(n,"bpmn:EndEvent")?(t=Bp(Tp.END_EVENT,function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!Cp(n.$parent,"bpmn:Transaction"))&&i(e)}),this._createEntries(e,t)):Cp(n,"bpmn:BoundaryEvent")?(t=Bp(Tp.BOUNDARY_EVENT,function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinition&&!Cp(n.attachedToRef,"bpmn:Transaction"))return!1;var r=!1!==t.cancelActivity,o=n.cancelActivity==r;return i(e)||!i(e)&&!o}),this._createEntries(e,t)):Cp(n,"bpmn:IntermediateCatchEvent")||Cp(n,"bpmn:IntermediateThrowEvent")?(t=Bp(Tp.INTERMEDIATE_EVENT,i),this._createEntries(e,t)):Cp(n,"bpmn:Gateway")?(t=Bp(Tp.GATEWAY,i),this._createEntries(e,t)):Cp(n,"bpmn:Transaction")?(t=Bp(Tp.TRANSACTION,i),this._createEntries(e,t)):Ap(n)&&Pp(n)?(t=Bp(Tp.EVENT_SUB_PROCESS,i),this._createEntries(e,t)):Cp(n,"bpmn:SubProcess")&&Pp(n)?(t=Bp(Tp.SUBPROCESS_EXPANDED,i),this._createEntries(e,t)):Cp(n,"bpmn:AdHocSubProcess")&&!Pp(n)?(t=Bp(Tp.TASK,function(t){var n=t.target,i="bpmn:SubProcess"===n.type,r=!0===n.isExpanded;return Mp(e,n)&&(!i||r)}),this._createEntries(e,t)):Cp(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Tp.SEQUENCE_FLOW):Cp(n,"bpmn:FlowNode")?(t=Bp(Tp.TASK,i),Cp(n,"bpmn:SubProcess")&&!Pp(n)&&(t=Bp(t,function(e){return"Sub Process (collapsed)"!==e.label})),this._createEntries(e,t)):[]},Np.prototype.getHeaderEntries=function(e){var t=[];return Cp(e,"bpmn:Activity")&&!Ap(e)&&(t=t.concat(this._getLoopEntries(e))),!Cp(e,"bpmn:SubProcess")||Cp(e,"bpmn:Transaction")||Ap(e)||t.push(this._getAdHocEntry(e)),t},Np.prototype._createEntries=function(e,t){var n=[],i=this;return kp(t,function(t){var r=i._createMenuEntry(t,e);n.push(r)}),n},Np.prototype._createSequenceFlowEntries=function(e,t){var n=Rp(e),i=[],r=this._modeling,o=this._moddle,a=this;return kp(t,function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(Cp(n.sourceRef,"bpmn:ExclusiveGateway")||Cp(n.sourceRef,"bpmn:InclusiveGateway")||Cp(n.sourceRef,"bpmn:ComplexGateway")||Cp(n.sourceRef,"bpmn:Activity"))&&i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e.source,{default:n})}));break;case"replace-with-conditional-flow":!n.conditionExpression&&Cp(n.sourceRef,"bpmn:Activity")&&i.push(a._createMenuEntry(t,e,function(){var t=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:t})}));break;default:if(Cp(n.sourceRef,"bpmn:Activity")&&n.conditionExpression)return i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e,{conditionExpression:void 0})}));if((Cp(n.sourceRef,"bpmn:ExclusiveGateway")||Cp(n.sourceRef,"bpmn:InclusiveGateway")||Cp(n.sourceRef,"bpmn:ComplexGateway")||Cp(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n)return i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e.source,{default:void 0})}))}}),i},Np.prototype._createMenuEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement;return n=n||function(){return r(t,e.target)},{label:i(e.label),className:e.className,id:e.actionName,action:n}},Np.prototype._getLoopEntries=function(e){var t=this,n=this._translate;function i(n,i){var r;i.active?r=void 0:(r=t._moddle.create(i.options.loopCharacteristics),i.options.isSequential&&(r.isSequential=i.options.isSequential)),t._modeling.updateProperties(e,{loopCharacteristics:r})}var r,o,a,s=Rp(e).loopCharacteristics;return s&&(r=s.isSequential,o=void 0===s.isSequential,a=void 0!==s.isSequential&&!s.isSequential),[{id:"toggle-parallel-mi",className:"bpmn-icon-parallel-mi-marker",title:n("Parallel Multi Instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},{id:"toggle-sequential-mi",className:"bpmn-icon-sequential-mi-marker",title:n("Sequential Multi Instance"),active:r,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},{id:"toggle-loop",className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}]},Np.prototype._getAdHocEntry=function(e){var t=this._translate,n=Rp(e),i=Cp(n,"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{id:"toggle-adhoc",className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:i,action:function(t,n){return r(e,i?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"})}}};var Dp=Np,Op={},Lp=s.forEach;Op.IGNORED_PROPERTIES=["lanes","incoming","outgoing","artifacts","default","flowElements","dataInputAssociations","dataOutputAssociations"],Op.getProperties=function(e,t){var n=[];return Lp(e.properties,function(e){t&&e.default||n.push(e.ns.name)}),n};var Ip=s.forEach,jp=s.filter,zp=s.some,Fp=s.sortBy,$p=s.isArray,Gp=Op.IGNORED_PROPERTIES;function Wp(e,t){this._eventBus=e,this._bpmnFactory=t}var Hp=Wp;Wp.prototype.clone=function(e,t,n){var i=this,r={newElement:t,hasNestedProperty:!1};return n=Fp(n,function(e){return"bpmn:extensionElements"===e}),Ip(n,function(n){var o,a,s,c=e.get(n),p=t.get(n),l=t.$model.getPropertyDescriptor(t,n);p!==c&&(l&&(l.isId||l.isReference)||(s=c,zp(["boolean","string","number"],function(e){return typeof s===e})||null===c?t.set(n,c):$p(c)?Ip(c,function(e){var n;r.refTopLevelProperty=e,n=i._deepClone(e,r),r.hasNestedProperty&&(n.$parent=t,p.push(n)),r.hasNestedProperty=!1}):(a=n.replace(/bpmn:/,""),r.refTopLevelProperty=c,o=i._deepClone(c,r),r.hasNestedProperty&&(t[a]=o),r.hasNestedProperty=!1)))}),t},Wp.prototype._deepClone=function(e,t){var n=this,i=this._eventBus,r=this._bpmnFactory.create(e.$type),o=jp(Object.keys(e),function(e){var t=r.$model.getPropertyDescriptor(r,e);return(!t||!t.isId&&!t.isReference)&&(-1===Gp.indexOf(e)&&"$type"!==e)});return o.length||(t.hasNestedProperty=!0),Ip(o,function(o){void 0!==e[o]&&(e[o].$type||$p(e[o]))?$p(e[o])?(r[o]=[],Ip(e[o],function(a){var s,c=e.$model.getTypeDescriptor(a.$type);if(c){if(!i.fire("property.clone",{newElement:t.newElement,refTopLevelProperty:t.refTopLevelProperty,propertyDescriptor:c})&&"bpmn:ExtensionElements"===e.$type&&c.meta&&c.meta.allowedIn&&!function(e,t){var n=e.meta.allowedIn;return 1===n.length&&"*"===n[0]||-1!==n.indexOf(t)}(c,t.newElement.$type))return!1;(s=n._deepClone(a,t)).$parent=r,r[o]||(r[o]=[]),t.hasNestedProperty=!0,r[o].push(s)}})):e[o].$type&&(r[o]=n._deepClone(e[o],t),r[o]&&(t.hasNestedProperty=!0,r[o].$parent=r)):(t.hasNestedProperty=!0,r[o]=e[o])}),r};var Vp=s.pick,qp=s.assign,Up=s.uniqueBy,Yp=s.findIndex,Kp=s.filter,Xp=s.has,Zp=d.is,Qp=Js.isAny,Jp=f.isExpanded,el=f.isEventSubProcess,tl=Op.getProperties,nl=Op.IGNORED_PROPERTIES,il=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function rl(e,t,n,i,r){var o=new Hp(r,e);this.replaceElement=function(r,a,s){s=s||{};var c=a.type,p=r.businessObject;if(al(p)&&"bpmn:SubProcess"===c&&function(e,t){var n=e&&Xp(e,"collapsed")?e.collapsed:!Jp(e);return n!==(t&&(Xp(t,"collapsed")||Xp(t,"isExpanded"))?Xp(t,"collapsed")?t.collapsed:!t.isExpanded:n)&&(e.collapsed=n,!0)}(r,a))return i.toggleCollapse(r),r;var l=e.create(c),u={type:c,businessObject:l},h=tl(p.$descriptor),d=tl(l.$descriptor,!0),m=Up(function(e){return e},Kp(h,function(e){return-1!==Yp(d,e)}));return qp(l,Vp(a,il)),m=Kp(m,function(e){var t=e.replace(/bpmn:/,"");return void 0===l[e]&&("loopCharacteristics"===t?!el(l):("processRef"!==t||!1!==a.isExpanded)&&"triggeredByEvent"!==t&&"eventDefinitions"!==t&&-1===nl.indexOf(t))}),l=o.clone(p,l,m),a.eventDefinitionType&&(u.eventDefinitionType=a.eventDefinitionType),Zp(p,"bpmn:Activity")&&(al(p)?u.isExpanded=Jp(p):a&&Xp(a,"isExpanded")&&(u.isExpanded=a.isExpanded),Jp(p)&&!Zp(p,"bpmn:Task")&&u.isExpanded&&(u.width=r.width,u.height=r.height)),al(p)&&!al(l)&&(s.moveChildren=!1),Zp(p,"bpmn:Participant")&&(!0===a.isExpanded?l.processRef=e.create("bpmn:Process"):s.moveChildren=!1,u.width=r.width,u.height=r.height),l.name=p.name,Qp(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Qp(l,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(l.default=p.default),("fill"in p.di||"stroke"in p.di)&&qp(u,{colors:Vp(p.di,["fill","stroke"])}),u=t.replaceElement(r,u,s),!1!==s.select&&n.select(u),u}}rl.$inject=["bpmnFactory","replace","selection","modeling","eventBus"];var ol=rl;function al(e){return Zp(e,"bpmn:SubProcess")}function sl(e){this._modeling=e}var cl=sl;sl.$inject=["modeling"],sl.prototype.replaceElement=function(e,t,n){var i=this._modeling,r=null;return e.waypoints||(t.x=Math.ceil(e.x+(t.width||e.width)/2),t.y=Math.ceil(e.y+(t.height||e.height)/2),r=i.replaceShape(e,t,n)),r};var pl={__depends__:[{__init__:["replace"],replace:["type",cl]},aa],bpmnReplace:["type",ol]},ll=s.forEach,ul=s.assign,hl=s.find,dl=s.matchPattern,ml=Y.delegate,fl=Y.domify,yl=Y.classes,vl=Y.attr,gl=Y.remove;function bl(e,t){this._eventBus=e,this._canvas=t,this._providers={}}bl.$inject=["eventBus","canvas"],bl.prototype.registerProvider=function(e,t){this._providers[e]=t},bl.prototype.create=function(e,t){var n=this._providers[e];if(!n)throw new Error("Provider is not registered: "+e);if(!t)throw new Error("Element is missing");var i=this._current={provider:n,className:e,element:t};return n.getHeaderEntries&&(i.headerEntries=n.getHeaderEntries(t)),i.entries=n.getEntries(t),this},bl.prototype.isEmpty=function(){var e=this._current;return 0===e.entries.length&&e.headerEntries&&0===e.headerEntries.length},bl.prototype.open=function(e){if(!e)throw new Error("the position argument is missing");this.isOpen()&&this.close();var t=this._current,n=this._canvas.getContainer();t.position=e,t.container=this._createContainer();var i=t.headerEntries||[],r=t.entries||[];return i.length&&t.container.appendChild(this._createEntries(t.headerEntries,"djs-popup-header")),r.length&&t.container.appendChild(this._createEntries(t.entries,"djs-popup-body")),this._attachContainer(t.container,n,e.cursor),this},bl.prototype.close=function(){this.isOpen()&&(this._unbindHandlers(),gl(this._current.container),this._current.container=null)},bl.prototype.isOpen=function(){return!!this._current.container},bl.prototype.trigger=function(e){e.preventDefault();var t=e.delegateTarget||e.target,n=vl(t,"data-id"),i=this._getEntry(n);if(i.action)return i.action.call(null,e,i)},bl.prototype._getEntry=function(e){var t=dl({id:e}),n=hl(this._current.entries,t)||hl(this._current.headerEntries,t);if(!n)throw new Error("entry not found");return n},bl.prototype._createContainer=function(){var e=fl('<div class="djs-popup">'),t=this._current.position,n=this._current.className;return ul(e.style,{position:"absolute",left:t.x+"px",top:t.y+"px",visibility:"hidden"}),yl(e).add(n),e},bl.prototype._attachContainer=function(e,t,n){var i=this;ml.bind(e,".entry","click",function(e){i.trigger(e)});var r=this._canvas.zoom();e.style.transformOrigin="top left",e.style.transform="scale("+r+")",t.appendChild(e),n&&this._assureIsInbounds(e,n),this._bindHandlers()},bl.prototype._assureIsInbounds=function(e,t){var n,i,r=this._canvas._container.getBoundingClientRect(),o=e.offsetLeft,a=e.offsetTop,s=e.scrollWidth,c=e.scrollHeight,p={},l=t.x-r.left,u=t.y-r.top;o+s>r.width&&(p.x=!0),a+c>r.height&&(p.y=!0),p.x&&p.y?(n=l-s+"px",i=u-c+"px"):p.x?(n=l-s+"px",i=u+"px"):p.y&&u<c?(n=l+"px",i="10px"):p.y&&(n=l+"px",i=u-c+"px"),ul(e.style,{left:n,top:i},{visibility:"visible","z-index":1e3})},bl.prototype._createEntries=function(e,t){var n=fl("<div>"),i=this;return yl(n).add(t),ll(e,function(e){var t=i._createEntry(e,n);n.appendChild(t)}),n},bl.prototype._createEntry=function(e){if(!e.id)throw new Error("every entry must have the id property set");var t=fl("<div>"),n=yl(t);if(n.add("entry"),e.className&&n.add(e.className),vl(t,"data-id",e.id),e.label){var i=fl("<span>");i.textContent=e.label,t.appendChild(i)}return e.imageUrl&&t.appendChild(fl('<img src="'+e.imageUrl+'" />')),!0===e.active&&n.add("active"),!0===e.disabled&&n.add("disabled"),e.title&&(t.title=e.title),t},bl.prototype._bindHandlers=function(){var e=this._eventBus,t=this;function n(){t.close()}e.once("contextPad.close",n),e.once("canvas.viewbox.changing",n),e.once("commandStack.changed",n)},bl.prototype._unbindHandlers=function(){var e=this._eventBus,t=this;function n(){t.close()}e.off("contextPad.close",n),e.off("canvas.viewbox.changed",n),e.off("commandStack.changed",n)};var xl={__depends__:[{__init__:["popupMenu"],popupMenu:["type",bl]},pl],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Dp]},El=s.assign,_l=s.bind,wl=s.pick,Sl=Y.domify,Tl=Y.query,Cl=Y.event,Al=Y.remove,Rl=Math.min,Pl=Math.max;function Ml(e){e.preventDefault()}function kl(e){e.stopPropagation()}function Bl(e){this.container=e.container,this.parent=Sl('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Tl("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=_l(this.autoResize,this),this.handlePaste=_l(this.handlePaste,this)}var Nl=Bl;Bl.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,a=this.container;i=this.options=i||{},t=this.style=t||{};var s=wl(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);El(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",wordWrap:"normal",textAlign:"center",outline:"none"},s);var c=wl(t,["fontSize","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return El(o.style,{boxSizing:"border-box",width:"100%",outline:"none"},c),i.centerVertically&&El(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},c),o.innerText=n,Cl.bind(o,"keydown",this.keyHandler),Cl.bind(o,"mousedown",kl),Cl.bind(o,"paste",this.handlePaste),i.autoResize&&Cl.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),a.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},Bl.prototype.handlePaste=function(e){var t,n,i=this,r=this.options,o=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),!document.execCommand("insertHTML",!1,t)){var a,s,c=this.getSelection(),p=c.startContainer,l=c.endContainer,u=c.startOffset,h=c.endOffset,d=c.commonAncestorContainer,m=(n=d.childNodes,[].slice.call(n));if(d.nodeType===Node.TEXT_NODE){var f=p.textContent;p.textContent=f.substring(0,u)+t+f.substring(h),a=p,s=u+t.length}else if(p===this.content&&l===this.content){var y=document.createTextNode(t);this.content.insertBefore(y,m[u]),a=y,s=y.textContent.length}else{var v=m.indexOf(p),g=m.indexOf(l);m.forEach(function(e,n){n===v?e.textContent=p.textContent.substring(0,u)+t+l.textContent.substring(h):n>v&&n<=g&&Al(e)}),a=p,s=u+t.length}a&&void 0!==s&&setTimeout(function(){i.setSelection(a,s)})}if(r.autoResize){var b=this.autoResize(o);b&&this.resizeHandler(b)}},Bl.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},Bl.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){var s,c,p,l;n=this.resizeHandle=Sl('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){Ml(n),kl(n);var u=Rl(Pl(p+n.clientX-s,i),o),h=Rl(Pl(l+n.clientY-c,r),a);t.style.width=u+"px",t.style.height=h+"px",e.resizeHandler({width:p,height:l,dx:n.clientX-s,dy:n.clientY-c})},h=function(e){Ml(e),kl(e),Cl.unbind(document,"mousemove",u,!1),Cl.unbind(document,"mouseup",h,!1)};Cl.bind(n,"mousedown",function(e){Ml(e),kl(e),s=e.clientX,c=e.clientY;var n=t.getBoundingClientRect();p=n.width,l=n.height,Cl.bind(document,"mousemove",u),Cl.bind(document,"mouseup",h)})}El(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Bl.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Cl.unbind(t,"keydown",this.keyHandler),Cl.unbind(t,"mousedown",kl),Cl.unbind(t,"input",this.autoResize),Cl.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),Al(n)),Al(e)},Bl.prototype.getValue=function(){return this.content.innerText},Bl.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Bl.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};var Dl=s.bind,Ol=s.find;function Ll(e,t){this._eventBus=e,this._providers=[],this._textbox=new Nl({container:t.getContainer(),keyHandler:Dl(this._handleKey,this),resizeHandler:Dl(this._handleResize,this)})}Ll.$inject=["eventBus","canvas"],Ll.prototype.registerProvider=function(e){this._providers.push(e)},Ll.prototype.isActive=function(){return!!this._active},Ll.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Ll.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Ll.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},Ll.prototype.complete=function(){var e=this._active;if(e){var t=this.getValue(),n=this.$textbox.getBoundingClientRect();(t!==e.context.text||this.resizable)&&e.provider.update(e.element,t,e.context.text,{x:n.top,y:n.left,width:n.width,height:n.height}),this._fire("complete"),this.close()}},Ll.prototype.getValue=function(){return this._textbox.getValue()},Ll.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;return 27===t?(e.preventDefault(),this.cancel()):13!==t||e.shiftKey?void 0:(e.preventDefault(),this.complete())},Ll.prototype._handleResize=function(e){this._fire("resize",e)},Ll.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=Ol(this._providers,function(n){return(t=n.activate(e))?n:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};var Il={__depends__:[jo],__init__:["directEditing"],directEditing:["type",Ll]},jl=Ps.getElementLineIntersection,zl=Ps.getMid,Fl="connect-ok",$l="connect-not-ok",Gl=n.append,Wl=n.attr,Hl=n.create,Vl=n.remove;function ql(e,t,n,i,r,o){function a(e,t){return i.allowed("connection.create",{source:e,target:t})}e.on("connect.move",function(e){var t,n=e.context,i=n.source,r=n.target,a=n.visual;t=function(e,t,n,i){var r=o.getShapePath(n),a=i&&o.getShapePath(i),s=o.getConnectionPath({waypoints:[e,t]});return[e=jl(r,s,!0)||e,t=i&&jl(a,s,!1)||t]}(n.sourcePosition,{x:e.x,y:e.y},i,r),Wl(a,{points:[t[0].x,t[0].y,t[1].x,t[1].y]})}),e.on("connect.hover",function(e){var t,n=e.context,i=n.source,o=e.hover;null!==(t=n.canExecute=a(i,o))&&(n.target=o,r.addMarker(o,t?Fl:$l))}),e.on(["connect.out","connect.cleanup"],function(e){var t=e.context;t.target&&r.removeMarker(t.target,t.canExecute?Fl:$l),t.target=null,t.canExecute=!1}),e.on("connect.cleanup",function(e){var t=e.context;t.visual&&Vl(t.visual)}),e.on("connect.start",function(e){var t,n=e.context;t=Hl("polyline"),Wl(t,{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),Gl(r.getDefaultLayer(),t),n.visual=t}),e.on("connect.end",function(e){var t=e.context,i=t.source,r=t.sourcePosition,o=t.target,s={x:e.x,y:e.y},c=t.canExecute||a(i,o);if(!c)return!1;var p=null,l={connectionStart:r,connectionEnd:s};"object"==typeof c&&(p=c),n.connect(i,o,p,l)}),this.start=function(e,n,i,r){"object"!=typeof i&&(r=i,i=zl(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{source:n,sourcePosition:i}}})}}ql.$inject=["eventBus","dragging","modeling","rules","canvas","graphicsFactory"];var Ul=ql,Yl=Math.round,Kl=s.assign,Xl=Y.event,Zl="djs-drag-active";function Ql(e){e.preventDefault()}function Jl(e){go.stopPropagation(e)}function eu(e,t){return{x:e.x-t.x,y:e.y-t.y}}function tu(e,t,n){var i,r={threshold:5,trapClick:!0};function o(e){var n=t.viewbox(),i=t._container.getBoundingClientRect();return{x:n.x+Yl((e.x-i.left)/n.scale),y:n.y+Yl((e.y-i.top)/n.scale)}}function a(t,n){n=n||i;var r=e.createEvent(Kl({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,r)&&e.fire(n.prefix+"."+t,r)}function s(e,r){var s,c=i.payload,p=i.displacement,l=i.globalStart,u=go.toPoint(e),h=eu(u,l),d=i.localStart,f=o(u),y=eu(f,d);if(!i.active&&(r||(s=h,Math.sqrt(Math.pow(s.x,2)+Math.pow(s.y,2))>i.threshold))){if(Kl(c,{x:d.x+p.x,y:d.y+p.y,dx:0,dy:0},{originalEvent:e}),!1===a("start"))return m();i.active=!0,i.keepSelection||(c.previousSelection=n.get(),n.select(null)),i.cursor&&_a.set(i.cursor),t.addMarker(t.getRootElement(),Zl)}Jl(e),i.active&&(Kl(c,{x:f.x+p.x,y:f.y+p.y,dx:y.x,dy:y.y},{originalEvent:e}),a("move"))}function c(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,Jl(e)),t=a("end")),!1===t&&a("rejected"),a("ended",f(!0!==t))}function p(e){27===e.which&&(e.preventDefault(),m())}function l(t){var n;i.active&&(n=xa.install(e),setTimeout(n,400)),c(t)}function u(e){s(e)}function h(e){var t=i.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function d(e){a("out");var t=i.payload;t.hoverGfx=null,t.hover=null}function m(e){var t;if(i){var n=i.active;n&&a("cancel"),t=f(e),n&&a("canceled",t)}}function f(r){var o,f;a("cleanup"),_a.unset(),f=i.trapClick?l:c,Xl.unbind(document,"mousemove",s),Xl.unbind(document,"dragstart",Ql),Xl.unbind(document,"selectstart",Ql),Xl.unbind(document,"mousedown",f,!0),Xl.unbind(document,"mouseup",f,!0),Xl.unbind(document,"keyup",p),Xl.unbind(document,"touchstart",u,!0),Xl.unbind(document,"touchcancel",m,!0),Xl.unbind(document,"touchmove",s,!0),Xl.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",d),t.removeMarker(t.getRootElement(),Zl);var y=i.payload.previousSelection;return!1!==r&&y&&!n.get().length&&n.select(y),o=i,i=null,o}e.on("diagram.destroy",m),this.init=function(t,n,f,y){i&&m(!1),"string"==typeof n&&(y=f,f=n,n=null);var v,g,b,x,E,_=(y=Kl({},r,y||{})).data||{};x=y.trapClick?l:c,t?(v=go.getOriginal(t)||t,g=go.toPoint(t),Jl(t),"dragstart"===v.type&&Ql(v)):(v=null,g={x:0,y:0}),b=o(g),n||(n=b),E=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(v),i=Kl({prefix:f,data:_,payload:{},globalStart:g,displacement:eu(n,b),localStart:b,isTouch:E},y),y.manual||(E?(Xl.bind(document,"touchstart",u,!0),Xl.bind(document,"touchcancel",m,!0),Xl.bind(document,"touchmove",s,!0),Xl.bind(document,"touchend",c,!0)):(Xl.bind(document,"mousemove",s),Xl.bind(document,"dragstart",Ql),Xl.bind(document,"selectstart",Ql),Xl.bind(document,"mousedown",x,!0),Xl.bind(document,"mouseup",x,!0)),Xl.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",d)),a("init"),y.autoActivate&&s(t,!0)},this.move=s,this.hover=h,this.out=d,this.end=c,this.cancel=m,this.context=function(){return i},this.setOptions=function(e){Kl(r,e)}}tu.$inject=["eventBus","canvas","selection"];var nu=tu,iu=Y.closest;function ru(e,t,n){var i=this;e.on("drag.start",function(t){e.once("drag.move",function(){e.once("drag.move",function(e){i.ensureHover(e)})})}),this.ensureHover=function(e){if(!e.hover){var i,r,o,a=e.originalEvent;a instanceof MouseEvent&&(i=go.toPoint(a),(o=function(e){return iu(e,"svg, .djs-element",!0)}(document.elementFromPoint(i.x,i.y)))&&(r=n.get(o),t.hover({element:r,gfx:o})))}}}ru.$inject=["eventBus","dragging","elementRegistry"];var ou={__init__:["hoverFix"],__depends__:[aa],dragging:["type",nu],hoverFix:["type",ru]};function au(e){this._commandStack=e.get("commandStack",!1)}au.$inject=["injector"];var su=au;au.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var cu={__init__:["rules"],rules:["type",su]},pu={__depends__:[aa,cu,ou],connect:["type",Ul]},lu=s.isFunction,uu=s.isArray,hu=s.forEach,du=Y.delegate,mu=Y.event,fu=Y.attr,yu=Y.query,vu=Y.classes,gu=Y.domify;function bu(e,t){this._providers=[],this._eventBus=e,this._overlays=t,this._current=null,this._init()}bu.$inject=["eventBus","overlays"];var xu=bu;bu.prototype._init=function(){var e=this._eventBus,t=this;e.on("selection.changed",function(e){var n=e.newSelection;1===n.length?t.open(n[0]):t.close()}),e.on("elements.delete",function(e){var n=e.elements;hu(n,function(e){t.isOpen(e)&&t.close()})}),e.on("element.changed",function(e){var n=e.element,i=t._current;i&&i.element===n&&t.open(n,!0)})},bu.prototype.registerProvider=function(e){this._providers.push(e)},bu.prototype.getEntries=function(e){var t={};return hu(this._providers,function(n){var i=n.getContextPadEntries(e);hu(i,function(e,n){t[n]=e})}),t},bu.prototype.trigger=function(e,t,n){var i,r,o=this._current.element,a=this._current.entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();if(i=a[fu(s,"data-action")].action,r=t.originalEvent||t,lu(i)){if("click"===e)return i(r,o,n)}else if(i[e])return i[e](r,o,n);t.preventDefault()},bu.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},bu.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this.getPad(e),i=n.html;hu(t,function(e,t){var n,r,o,a,s=e.group||"default",c=gu(e.html||'<div class="entry" draggable="true"></div>');fu(c,"data-action",t),(n=yu("[data-group="+s+"]",i))||(n=gu('<div class="group" data-group="'+s+'"></div>'),i.appendChild(n)),n.appendChild(c),e.className&&(r=c,o=e.className,a=vu(r),(uu(o)?o:o.split(/\s+/g)).forEach(function(e){a.add(e)})),e.title&&fu(c,"title",e.title),e.imageUrl&&c.appendChild(gu('<img src="'+e.imageUrl+'">'))}),vu(i).add("open"),this._current={element:e,pad:n,entries:t},this._eventBus.fire("contextPad.open",{current:this._current})},bu.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=gu('<div class="djs-context-pad"></div>');du.bind(i,".entry","click",function(e){t.trigger("click",e)}),du.bind(i,".entry","dragstart",function(e){t.trigger("dragstart",e)}),mu.bind(i,"mousedown",function(e){e.stopPropagation()}),this._overlayId=n.add(e,"context-pad",{position:{right:-9,top:-6},html:i});var r=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{element:e,pad:r}),r},bu.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},bu.prototype.isOpen=function(e){return!(!this._current||e&&this._current.element!==e)};var Eu={__depends__:[jo,vo],contextPad:["type",xu]},_u=750,wu="drop-ok",Su="drop-not-ok",Tu="attach-ok",Cu="new-parent",Au=n.append,Ru=n.attr,Pu=n.classes,Mu=n.create,ku=n.remove,Bu=w.translate;function Nu(e,t,n,i,r,o,a){function s(e,t){[Tu,wu,Su,Cu].forEach(function(n){n===t?r.addMarker(e,n):r.removeMarker(e,n)})}e.on("create.move",function(e){var t,i=e.context,r=e.hover,o=i.shape,a=i.source,c={x:e.x,y:e.y};t=i.canExecute=r&&function(e,t,i,r){if(!t)return!1;var o,a,s,c={source:i,shape:e,target:t,position:r};return(a=n.allowed("shape.attach",c))||(o=n.allowed("shape.create",c)),(o||a)&&(s=i&&n.allowed("connection.create",{source:i,target:e,hints:{targetParent:t,targetAttach:a}})),!(!o&&!a)&&{attach:a,connect:s}}(o,r,a,c),r&&null!==t&&(i.target=r,t&&t.attach?s(r,Tu):s(r,t?Cu:Su))}),e.on("create.move",_u,function(e){var t=e.context,n=t.shape,i=t.visual;i||(i=t.visual=function(e){var t,n,i;t=Mu("g"),Ru(t,o.cls("djs-drag-group",["no-events"])),Au(r.getDefaultLayer(),t),n=Mu("g"),Pu(n).add("djs-dragger"),Au(t,n),Bu(n,e.width/-2,e.height/-2);var s=Mu("g");return Pu(s).add("djs-visual"),Au(n,s),i=s,a.drawShape(i,e),t}(n)),Bu(i,e.x,e.y)}),e.on(["create.end","create.out","create.cleanup"],function(e){var t=e.context.target;t&&s(t,null)}),e.on("create.end",function(e){var t=e.context,n=t.source,r=t.shape,o=t.target,a=t.canExecute,s=a&&a.attach,c=a&&a.connect,p={x:e.x,y:e.y};if(!a)return!1;r=c?i.appendShape(n,r,p,o,{attach:s,connection:!0===c?{}:c}):i.createShape(r,p,o,{attach:s}),t.shape=r}),e.on("create.cleanup",function(e){var t=e.context;t.visual&&ku(t.visual)}),this.start=function(e,n,i){t.init(e,"create",{cursor:"grabbing",autoActivate:!0,data:{shape:n,context:{shape:n,source:i}}})}}Nu.$inject=["eventBus","dragging","rules","modeling","canvas","styles","graphicsFactory"];var Du={__depends__:[ou,aa,cu],create:["type",Nu]},Ou={__depends__:[Il,Eu,aa,pu,Du,xl],__init__:["contextPadProvider"],contextPadProvider:["type",xp]},Lu=d.getBusinessObject,Iu=d.is,ju=Op.getProperties,zu=Op.IGNORED_PROPERTIES,Fu=s.filter,$u=s.forEach;function Gu(e,t,n){$u(n,function(n){void 0!==t[n]&&(e[n]=t[n])})}function Wu(e,t,n,i,r,o){var a=new Hp(t,e);n.registerDescriptor(function(e,t){var n=t.oldBusinessObject=Lu(e),i={};return t.type=e.type,Gu(t,n.di,["isExpanded"]),Gu(i,n.di,["fill","stroke"]),t.colors=i,"label"===e.type?t:(Gu(t,n,["processRef","triggeredByEvent"]),n.default&&(t.default=n.default.id),t)}),t.on("element.paste",function(t){var n,i,s,c,p=t.descriptor,l=t.createdElements,u=p.parent,h=r.getRootElement(),d=p.oldBusinessObject;n=e.create(d.$type);var m=ju(d.$descriptor);m=Fu(m,function(e){return-1===zu.indexOf(e.replace(/bpmn:/,""))}),p.businessObject=a.clone(d,n,m),"label"!==p.type&&(Iu(u,"bpmn:Process")&&(p.parent=Iu(h,"bpmn:Collaboration")?h:u),"bpmn:DataOutputAssociation"!==p.type&&"bpmn:DataInputAssociation"!==p.type&&"bpmn:MessageFlow"!==p.type||(p.parent=h),Iu(u,"bpmn:Lane")&&(p.parent=u.parent),p.waypoints&&(i=l[p.source],s=l[p.target],i&&s&&(i=i.element,s=s.element),(c=o.canConnect(i,s))&&(p.type=c.type)),delete n.id,e._ensureId(n),"bpmn:Participant"===p.type&&p.processRef&&(p.processRef=n.processRef=e.create("bpmn:Process")),Gu(n,p,["isExpanded","triggeredByEvent"]),function(e,t){$u(t,function(t){e[t]&&delete e[t]})}(p,["triggeredByEvent"]))})}Wu.$inject=["bpmnFactory","eventBus","copyPaste","clipboard","canvas","bpmnRules"];var Hu=Wu;function Vu(){}var qu=Vu;Vu.prototype.get=function(){return this._data},Vu.prototype.set=function(e){this._data=e},Vu.prototype.clear=function(){var e=this._data;return delete this._data,e},Vu.prototype.isEmpty=function(){return!this._data};var Uu={clipboard:["type",qu]},Yu={},Ku=s.forEach;Yu.getTopLevel=function(e){var t={},n=[],i=[],r=[];return Ku(e,function(e){var i=e.parent;t[i.id]||(t[i.id]=[]),-1===n.indexOf(i.id)&&n.push(i.id),t[i.id].push(e)}),Ku(n,function(e){Ku(t[e],function(e){t[e.id]&&r.push(e.id)})}),Ku(n,function(e){-1===r.indexOf(e)&&(i=i.concat(t[e]))}),i};var Xu={};Xu.center=function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}},Xu.delta=function(e,t){return{x:e.x-t.x,y:e.y-t.y}};var Zu=s.isArray,Qu=s.forEach,Ju=s.map,eh=s.matchPattern,th=s.find,nh=s.findIndex,ih=s.sortBy,rh=s.reduce,oh=ui.getBBox;function ah(e,t,n,i,r,o){this._eventBus=e,this._modeling=t,this._elementFactory=n,this._rules=i,this._canvas=o,this._clipboard=r,this._descriptors=[],this.registerDescriptor(function(e,t){return t.priority=1,t.id=e.id,e.parent&&(t.parent=e.parent.id),e.labelTarget&&(t.priority=4,t.labelTarget=e.labelTarget.id),e.host&&(t.priority=2,t.host=e.host.id),"number"==typeof e.x&&(t.x=e.x,t.y=e.y),e.width&&(t.width=e.width,t.height=e.height),e.waypoints&&(t.priority=3,t.waypoints=[],Qu(e.waypoints,function(e){var n={x:e.x,y:e.y};e.original&&(n.original={x:e.original.x,y:e.original.y}),t.waypoints.push(n)})),e.source&&e.target&&(t.source=e.source.id,t.target=e.target.id),t})}ah.$inject=["eventBus","modeling","elementFactory","rules","clipboard","canvas"];var sh=ah;ah.prototype.copy=function(e){var t,n,i=this._clipboard;if(Zu(e)||(e=e?[e]:[]),e.length)return t=this.createTree(e),n=this._bbox=Xu.center(oh(t.allShapes)),delete t.allShapes,Qu(t,function(e){Qu(e,function(t){var i,r;t.labelTarget?(r=th(e,eh({id:t.labelTarget})),i=r.waypoints?Xu.delta(t,r.waypoints[0]):Xu.delta(t,r)):3===t.priority?(i=[],Qu(t.waypoints,function(e){var t=Xu.delta(e,n);i.push(t)})):i=Xu.delta(t,n),t.delta=i})}),this._eventBus.fire("elements.copy",{context:{tree:t}}),0===Object.keys(t).length?i.clear():i.set(t),this._eventBus.fire("elements.copied",{context:{tree:t}}),t},ah.prototype.paste=function(e){var t,n=this._clipboard,i=this._modeling,r=this._eventBus,o=this._rules,a=n.get(),s=e.element,c=e.point;n.isEmpty()||(t=rh(a,function(e,t,n){var i=parseInt(n,10);return isNaN(i)?e:(e[i]=t,e)},{}),o.allowed("elements.paste",{tree:t,target:s})?i.pasteElements(t,s,c):r.fire("elements.paste.rejected",{context:{tree:t,position:c,target:s}}))},ah.prototype._computeDelta=function(e,t){var n=this._bbox,i={};return t.labelTarget?Xu.delta(t,t.labelTarget):(3===t.priority?(i=[],Qu(t.waypoints,function(e){var t=Xu.delta(e,n);i.push(t)})):i=Xu.delta(t,n),i)},ah.prototype.hasRelations=function(e,t){var n,i;return!(t.waypoints&&(n=th(e,eh({id:t.source.id})),i=th(e,eh({id:t.target.id})),!n||!i))&&!(t.labelTarget&&!th(e,eh({id:t.labelTarget.id})))},ah.prototype.registerDescriptor=function(e){if("function"!=typeof e)throw new Error("the descriptor must be a function");if(-1!==this._descriptors.indexOf(e))throw new Error("this descriptor is already registered");this._descriptors.push(e)},ah.prototype._executeDescriptors=function(e){return e.descriptor||(e.descriptor={}),Qu(this._descriptors,function(t){e.descriptor=t(e.element,e.descriptor)}),e},ah.prototype.createTree=function(e){var t,n=this._rules,i=this,r={},o=[],a=Yu.getTopLevel(e);function s(e){var t=nh(o,eh({element:e.element}));if(-1===t)return o.push(e);o[t].depth<e.depth&&(o.splice(t,1),o.push(e))}return r.allShapes=[],ui.eachElement(a,function(e,t,n){var i,r=e.children;if(!e.labelTarget)return e.label&&s({element:e.label,depth:n}),i=[e.attachers,e.incoming,e.outgoing],Qu(i,function(e){e&&e.length&&Qu(e,function(e){e.label&&s({element:e.label,depth:n}),s({element:e,depth:n})})}),s({element:e,depth:n}),r||void 0}),o=Ju(o,function(e){return i._executeDescriptors(e)}),o=ih(o,function(e){return e.descriptor.priority}),t=Ju(o,function(e){return e.element}),Qu(o,function(e){var o,a,s=e.depth;i.hasRelations(r.allShapes,e.element)&&(o=t,a=e.element,n.allowed("element.copy",{collection:o,element:a})&&(r.allShapes.push(e.element),r[s]||(r[s]=[]),r[s].push(e.descriptor)))}),r};var ch=s.bind;function ph(e,t){this._eventBus=e,this._canvas=t,this._init()}ph.$inject=["eventBus","canvas"];var lh=ph;ph.prototype.getHoverContext=function(){var e=this._canvas.viewbox();return{element:this._hoverElement,point:{x:e.x+Math.round(this._mouseX/e.scale),y:e.y+Math.round(this._mouseY/e.scale)}}},ph.prototype._init=function(){var e=this._eventBus,t=this._canvas.getContainer();this._setMousePosition=ch(this._setMousePosition,this),t.addEventListener("mousemove",this._setMousePosition),e.on("diagram.destroy",function(){t.removeEventListener("mousemove",this._setMousePosition)},this),e.on("element.hover",this._setHoverElement,this)},ph.prototype._setHoverElement=function(e){this._hoverElement=e.element},ph.prototype._setMousePosition=function(e){this._mouseX=e.layerX,this._mouseY=e.layerY};var uh={__init__:["mouseTracking"],mouseTracking:["type",lh]},hh={__depends__:[Uu,cu,uh],__init__:["copyPaste"],copyPaste:["type",sh]},dh={__depends__:[hh],__init__:["bpmnCopyPaste"],bpmnCopyPaste:["type",Hu]},mh=s.filter,fh=Js.isAny;function yh(e){e.registerFilter(function(e){return mh(e,function(e){var t=fh(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:Participant","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})})}yh.$inject=["distributeElements"];var vh=yh,gh=s.sortBy,bh=s.forEach,xh=s.filter,Eh={horizontal:["x","width"],vertical:["y","height"]};function _h(e){this._modeling=e,this._filters=[],this.registerFilter(function(e,t,n){var i,r=0,o=0;return bh(e,function(e){e.waypoints||e.labelTarget||(r+=e[n],o+=1)}),i=Math.round(r/o),xh(e,function(e){return e[n]<i+50})})}var wh=_h;_h.$inject=["modeling"],_h.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},_h.prototype.trigger=function(e,t){var n,i,r=this._modeling;if(!(e.length<3||(this._setOrientation(t),i=this._filterElements(e),(n=this._createGroups(i)).length<=2)))return r.distributeElements(n,this._axis,this._dimension),n},_h.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(bh(t,function(e){r=e(r,n,i)}),r):e},_h.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=gh(e,i);return bh(o,function(e,o){var a,s=n._findRange(e,i,r),c=t[t.length-1];c&&n._hasIntersection(c.range,s)?t[t.length-1].elements.push(e):(a={range:s,elements:[e]},t.push(a))}),t},_h.prototype._setOrientation=function(e){var t=Eh[e];this._axis=t[0],this._dimension=t[1]},_h.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},_h.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Sh={__depends__:[{__init__:["distributeElements"],distributeElements:["type",wh]}],__init__:["bpmnDistributeElements"],bpmnDistributeElements:["type",vh]},Th=s.forEach,Ch=s.isArray;function Ah(e,t,n,i,r,o,a,s,c){this._actions={undo:function(){t.undo()},redo:function(){t.redo()},copy:function(){var e=i.get();o.copy(e)},paste:function(){var e=c.getHoverContext();o.paste(e)},stepZoom:function(e){r.stepZoom(e.value)},zoom:function(e){a.zoom(e.value)},removeSelection:function(){var e=i.get();if(e.length){var t,r=s.allowed("elements.delete",{elements:e});if(!1===r)return;(t=Ch(r)?r:e).length&&n.removeElements(t.slice())}},moveCanvas:function(e){var t=0,n=0,i=e.invertY,r=e.speed/Math.min(Math.sqrt(a.viewbox().scale),1);switch(e.direction){case"left":t=r;break;case"up":n=r;break;case"right":t=-r;break;case"down":n=-r}n&&i&&(n=-n),a.scroll({dx:t,dy:n})}}}Ah.$inject=["eventBus","commandStack","modeling","selection","zoomScroll","copyPaste","canvas","rules","mouseTracking"];var Rh=Ah;function Ph(e,t){return new Error(e+" "+t)}Ah.prototype.trigger=function(e,t){if(!this._actions[e])throw Ph(e,"is not a registered action");return this._actions[e](t)},Ah.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);Th(e,function(e,t){n._registerAction(t,e)})},Ah.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Ph(e,"is already registered");this._actions[e]=t},Ah.prototype.unregister=function(e){if(!this.isRegistered(e))throw Ph(e,"is not a registered action");this._actions[e]=void 0},Ah.prototype.length=function(){return Object.keys(this._actions).length},Ah.prototype.isRegistered=function(e){return!!this._actions[e]};var Mh=s.filter,kh=d.is,Bh=ui.getBBox;function Nh(e,t,n,i,r,o,a,s,c,p,l,u,h){e.invoke(Rh,this),this.register({selectElements:function(){var e=t.getRootElement(),r=n.filter(function(t){return t!==e});return i.select(r),r},spaceTool:function(){r.toggle()},lassoTool:function(){o.toggle()},handTool:function(){a.toggle()},globalConnectTool:function(){s.toggle()},distributeElements:function(e){var t=i.get(),n=e.type;t.length&&c.trigger(t,n)},alignElements:function(e){var t=i.get(),n=[],r=e.type;t.length&&(n=Mh(t,function(e){return!kh(e,"bpmn:Lane")}),p.trigger(n,r))},setColor:function(e){var t=i.get();t.length&&h.setColor(t,e)},directEditing:function(){var e=i.get();e.length&&l.activate(e[0])},find:function(){u.toggle()},moveToOrigin:function(){var e,i,r=t.getRootElement();i=kh(r,"bpmn:Collaboration")?n.filter(function(e){return kh(e.parent,"bpmn:Collaboration")}):n.filter(function(e){return e!==r&&!kh(e.parent,"bpmn:SubProcess")}),e=Bh(i),h.moveElements(i,{x:-e.x,y:-e.y},r)}})}U(Nh,Rh),Nh.$inject=["injector","canvas","elementRegistry","selection","spaceTool","lassoTool","handTool","globalConnect","distributeElements","alignElements","directEditing","searchPad","modeling"];var Dh=Nh,Oh=Js.isAny;function Lh(e){e.registerProvider(this)}Lh.$inject=["globalConnect"];var Ih=Lh;Lh.prototype.canStartConnect=function(e){if(!(t=e)||function(e){return e.labelTarget}(t))return null;var t,n=e.businessObject;return Oh(n,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])};var jh="connect-ok",zh="connect-not-ok";function Fh(e,t,n,i,r){var o=this;this._dragging=t,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(e){var t=e.context,n=e.hover,r=t.canStartConnect=o.canStartConnect(n);null!==r&&(t.startTarget=n,i.addMarker(n,r?jh:zh))}),e.on(["global-connect.out","global-connect.cleanup"],function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&i.removeMarker(t,n?jh:zh)}),e.on(["global-connect.ended"],function(t){var i=t.context.startTarget,r={x:t.x,y:t.y};if(o.canStartConnect(i))return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,i,r)}),!1})}Fh.$inject=["eventBus","dragging","connect","canvas","toolManager"];var $h=Fh;Fh.prototype.start=function(e){this._dragging.init(e,"global-connect",{trapClick:!1,data:{context:{}}})},Fh.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.start()},Fh.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Fh.prototype.registerProvider=function(e){this._provider=e},Fh.prototype.canStartConnect=function(e){return this._provider.canStartConnect(e)};var Gh=s.forEach;function Wh(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}Wh.$inject=["eventBus","dragging"];var Hh=Wh;Wh.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error('A tool has to be registered with it\'s "events"');n.push(e),this.bindEvents(e,t)},Wh.prototype.isActive=function(e){return e&&this._active===e},Wh.prototype.length=function(e){return this._tools.length},Wh.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Wh.prototype.bindEvents=function(e,t){var n=this._eventBus,i=this._dragging,r=[];n.on(t.tool+".init",function(t){if(!t.context.reactivate&&this.isActive(e))return this.setActive(null),void i.cancel();this.setActive(e)},this),Gh(t,function(e){r.push(e+".ended"),r.push(e+".canceled")}),n.on(r,250,function(e){var t=e.originalEvent;!this._active||t&&"tools"===t.target.parentNode.getAttribute("data-group")||this.setActive(null)},this)};var Vh={__depends__:[ou],__init__:["toolManager"],toolManager:["type",Hh]},qh={__depends__:[{__depends__:[pu,cu,ou,Vh],globalConnect:["type",$h]}],__init__:["bpmnGlobalConnect"],bpmnGlobalConnect:["type",Ih]},Uh={},Yh=d.is;function Kh(e){return Yh(e,"bpmn:FlowElement")||Yh(e,"bpmn:Participant")||Yh(e,"bpmn:Lane")||Yh(e,"bpmn:SequenceFlow")||Yh(e,"bpmn:MessageFlow")?"name":Yh(e,"bpmn:TextAnnotation")?"text":void 0}Uh.getLabel=function(e){var t=e.businessObject,n=Kh(t);if(n)return t[n]||""},Uh.setLabel=function(e,t,n){var i=e.businessObject,r=Kh(i);return r&&(i[r]=t),n&&(e.hidden=!t),e};var Xh=s.map,Zh=s.filter,Qh=s.sortBy;function Jh(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}var ed=Jh;function td(e){return Zh(e,function(e){return!!e.matched}).length>0}function nd(e,t){var n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var r=e.indexOf(t);return r>-1?(0!==r&&n.push({normal:i.substr(0,r)}),n.push({matched:i.substr(r,t.length)}),t.length+r<e.length&&n.push({normal:i.substr(t.length+r,e.length)})):n.push({normal:i}),n}Jh.$inject=["elementRegistry","searchPad","canvas"],Jh.prototype.find=function(e){var t=this._canvas.getRootElement(),n=this._elementRegistry.filter(function(e){return!e.labelTarget});return n=Zh(n,function(e){return e!==t}),n=Xh(n,function(t){return{primaryTokens:nd(Uh.getLabel(t),e),secondaryTokens:nd(t.id,e),element:t}}),n=Zh(n,function(e){return td(e.primaryTokens)||td(e.secondaryTokens)}),n=Qh(n,function(e){return Uh.getLabel(e.element)+e.element.id})};var id=Y.clear,rd=Y.delegate,od=Y.query,ad=Y.classes,sd=Y.attr,cd=Y.domify,pd=ui.getBBox;function ld(e,t,n,i){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=i,this._container=cd(ld.BOX_HTML),this._searchInput=od(ld.INPUT_SELECTOR,this._container),this._resultsContainer=od(ld.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}ld.$inject=["canvas","eventBus","overlays","selection"],ld.prototype._bindEvents=function(){var e=this;function t(t,n,i,r){e._eventMaps.push({el:t,type:i,listener:rd.bind(t,n,i,r)})}t(document,"html","click",function(t){e.close()}),t(this._container,ld.INPUT_SELECTOR,"click",function(e){e.stopPropagation(),e.delegateTarget.focus()}),t(this._container,ld.RESULT_SELECTOR,"mouseover",function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)}),t(this._container,ld.RESULT_SELECTOR,"click",function(t){t.stopPropagation(),e._select(t.delegateTarget)}),t(this._container,ld.INPUT_SELECTOR,"keydown",function(e){38===e.keyCode&&e.preventDefault(),40===e.keyCode&&e.preventDefault()}),t(this._container,ld.INPUT_SELECTOR,"keyup",function(t){if(27===t.keyCode)return e.close();if(13===t.keyCode){var n=e._getCurrentResult();return n?e._select(n):e.close()}return 38===t.keyCode?e._scrollToDirection(!0):40===t.keyCode?e._scrollToDirection():void(37!==t.keyCode&&39!==t.keyCode&&e._search(t.delegateTarget.value))})},ld.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){rd.unbind(e.el,e.type,e.listener)})},ld.prototype._search=function(e){var t=this;if(this._clearResults(),e&&""!==e){var n=this._searchProvider.find(e);if(n.length){n.forEach(function(e){var n=e.element.id,i=t._createResultNode(e,n);t._results[n]={element:e.element,node:i}});var i=od(ld.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}}},ld.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},ld.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},ld.prototype._clearResults=function(){id(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},ld.prototype._getCurrentResult=function(){return od(ld.RESULT_SELECTED_SELECTOR,this._resultsContainer)},ld.prototype._createResultNode=function(e,t){var n=cd(ld.RESULT_HTML);return e.primaryTokens.length>0&&hd(n,e.primaryTokens,ld.RESULT_PRIMARY_HTML),hd(n,e.secondaryTokens,ld.RESULT_SECONDARY_HTML),sd(n,ld.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},ld.prototype.registerProvider=function(e){this._searchProvider=e},ld.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,ad(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},ld.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,ad(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},ld.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ld.prototype.isOpen=function(){return this._open},ld.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&ad(t).remove(ld.RESULT_SELECTED_CLASS);var n=sd(e,ld.RESULT_ID_ATTRIBUTE),i=this._results[n].element;ad(e).add(ld.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._centerViewbox(i),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},ld.prototype._select=function(e){var t=sd(e,ld.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this.close(),this._resetOverlay(),this._centerViewbox(n),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},ld.prototype._centerViewbox=function(e){var t=this._canvas.viewbox(),n=pd(e),i={x:n.x+n.width/2-t.outer.width/2,y:n.y+n.height/2-t.outer.height/2,width:t.outer.width,height:t.outer.height};this._canvas.viewbox(i),this._canvas.zoom(t.scale)},ld.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=function(e){var t=e.width+12,n=e.height+12,i=["width: "+t+"px","height: "+n+"px"].join("; ");return{position:{bottom:n-6,right:t-6},show:!0,html:'<div style="'+i+'" class="'+ld.OVERLAY_CLASS+'"></div>'}}(pd(e));this._overlayId=this._overlays.add(e,t)}};var ud=ld;function hd(e,t,n){var i=function(e){var t="";return e.forEach(function(e){e.matched?t+='<strong class="'+ld.RESULT_HIGHLIGHT_CLASS+'">'+e.matched+"</strong>":t+=e.normal}),""!==t?t:null}(t),r=cd(n);r.innerHTML=i,e.appendChild(r)}ld.CONTAINER_SELECTOR=".djs-search-container",ld.INPUT_SELECTOR=".djs-search-input input",ld.RESULTS_CONTAINER_SELECTOR=".djs-search-results",ld.RESULT_SELECTOR=".djs-search-result",ld.RESULT_SELECTED_CLASS="djs-search-result-selected",ld.RESULT_SELECTED_SELECTOR="."+ld.RESULT_SELECTED_CLASS,ld.RESULT_ID_ATTRIBUTE="data-result-id",ld.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",ld.OVERLAY_CLASS="djs-search-overlay",ld.BOX_HTML='<div class="djs-search-container djs-draggable djs-scrollable"><div class="djs-search-input"><input type="text"/></div><div class="djs-search-results"></div></div>',ld.RESULT_HTML='<div class="djs-search-result"></div>',ld.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',ld.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var dd={__depends__:[{__depends__:[vo,aa],searchPad:["type",ud]}],__init__:["bpmnSearch"],bpmnSearch:["type",ed]},md=s.filter,fd=s.forEach,yd=s.sortBy;function vd(e){return e&&e[e.length-1]}function gd(e){return e.y}function bd(e){return e.x}var xd={left:bd,center:bd,right:function(e){return e.x+e.width},top:gd,middle:gd,bottom:function(e){return e.y+e.height}};function Ed(e){this._modeling=e}var _d=Ed;Ed.$inject=["modeling"],Ed.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},Ed.prototype._isType=function(e,t){return-1!==t.indexOf(e)},Ed.prototype._alignmentPosition=function(e,t){var n,i,r,o=this._getOrientationDetails(e),a=o.axis,s=o.dimension,c={},p={},l=!1;if(this._isType(e,["left","top"]))c[e]=t[0][a];else if(this._isType(e,["right","bottom"]))r=vd(t),c[e]=r[a]+r[s];else if(this._isType(e,["center","middle"])){if(fd(t,function(e){var t=e[a]+Math.round(e[s]/2);p[t]?p[t].elements.push(e):p[t]={elements:[e],center:t}}),n=yd(p,function(e){return e.elements.length>1&&(l=!0),e.elements.length}),l)return c[e]=vd(n).center,c;i=t[0],r=vd(t=yd(t,function(e){return e[a]+e[s]})),c[e]=function(e,t){return Math.round((e[a]+t[a]+t[s])/2)}(i,r)}return c},Ed.prototype.trigger=function(e,t){var n=this._modeling,i=md(e,function(e){return!(e.waypoints||e.host||e.labelTarget)}),r=yd(i,xd[t]),o=this._alignmentPosition(t,r);n.alignElements(r,o)};var wd={__init__:["alignElements"],alignElements:["type",_d]},Sd={__depends__:[aa,hh,Va],__init__:["editorActions"],editorActions:["type",Rh]},Td=_o.hasPrimaryModifier,Cd=1500;function Ad(e,t,n,i){this._dragging=n,i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Cd,function(e){if(Td(e))return this.activateMove(e.originalEvent),!1},this),e.on("hand.end",function(t){var n=t.originalEvent.target;if(!(t.hover||n instanceof SVGElement))return!1;e.once("hand.ended",function(){this.activateMove(t.originalEvent,{reactivate:!0})},this)},this),e.on("hand.move.move",function(e){var n=t.viewbox().scale;t.scroll({dx:e.dx*n,dy:e.dy*n})}),e.on("hand.move.end",function(t){var n=t.context.reactivate;return!Td(t)&&n&&e.once("hand.move.ended",function(e){this.activateHand(e.originalEvent,!0,!0)},this),!1},this)}Ad.$inject=["eventBus","canvas","dragging","toolManager"];var Rd=Ad;Ad.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:"grab",data:{context:n||{}}})},Ad.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:"grab",data:{context:{reactivate:n}}})},Ad.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateHand()},Ad.prototype.isActive=function(){var e=this._dragging.context();return e&&/^hand/.test(e.prefix)};var Pd={__depends__:[Vh],__init__:["handTool"],handTool:["type",Rd]},Md=s.values,kd=ui.getEnclosedElements,Bd=_o.hasSecondaryModifier,Nd=n.append,Dd=n.attr,Od=n.create,Ld=n.remove;function Id(e,t,n,i,r,o){this._selection=r,this._dragging=n;var a=this,s=function(e){var n,i=t.getDefaultLayer();n=e.frame=Od("rect"),Dd(n,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Nd(i,n)},c=function(e){var t=e.frame,n=e.bbox;Dd(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Ld(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",function(){a.activateLasso(t.originalEvent,!0)})}),e.on("lasso.end",function(e){var t=zd(e),n=i.filter(function(e){return e});a.select(n,t)}),e.on("lasso.start",function(e){var t=e.context;t.bbox=zd(e),s(t)}),e.on("lasso.move",function(e){var t=e.context;t.bbox=zd(e),c(t)}),e.on("lasso.cleanup",function(e){var t=e.context;p(t)}),e.on("element.mousedown",1500,function(e){if(Bd(e))return a.activateLasso(e.originalEvent),!0})}Id.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager"];var jd=Id;function zd(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y};return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?{x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?{x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?{x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:{x:n.x,y:n.y,width:0,height:0}}Id.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:"crosshair",data:{context:{}}})},Id.prototype.activateSelection=function(e){this._dragging.init(e,"lasso.selection",{trapClick:!1,cursor:"crosshair",data:{context:{}}})},Id.prototype.select=function(e,t){var n=kd(e,t);this._selection.select(Md(n))},Id.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},Id.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Fd={__depends__:[Vh],__init__:["lassoTool"],lassoTool:["type",jd]},$d=s.forEach,Gd=n.append,Wd=n.attr,Hd=n.clone,Vd=n.create;function qd(e,t,n){this._elementRegistry=e,this._canvas=t,this._styles=n}var Ud=qd;qd.$inject=["elementRegistry","canvas","styles"],qd.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},qd.prototype.addDragger=function(e,t){var n=this.getGfx(e),i=Hd(n),r=n.getBoundingClientRect();return e.waypoints&&function e(t){t.children&&$d(t.children,function(t){e(t)});t.style.markerStart="";t.style.markerEnd=""}(i),Wd(i,this._styles.cls("djs-dragger",[],{x:r.top,y:r.left})),Gd(t,i),i},qd.prototype.addFrame=function(e,t){var n=Vd("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Gd(t,n),n};var Yd={__init__:["previewSupport"],previewSupport:["type",Ud]},Kd={};Kd.getDirection=function(e,t){if("x"===e){if(t>0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null},Kd.resizeBounds=function(e,t,n){var i=n.x,r=n.y;switch(t){case"n":return{x:e.x,y:e.y+r,width:e.width,height:e.height-r};case"s":return{x:e.x,y:e.y,width:e.width,height:e.height+r};case"w":return{x:e.x+i,y:e.y,width:e.width-i,height:e.height};case"e":return{x:e.x,y:e.y,width:e.width+i,height:e.height};default:throw new Error("unrecognized direction: "+t)}};var Xd=_o.hasPrimaryModifier,Zd=Math.abs,Qd=Math.round,Jd=1500,em={x:"width",y:"height"},tm={x:"y",y:"x"},nm=ui.selfAndAllChildren,im=s.assign,rm=s.forEach;function om(e,t,n,i,r,o){this._canvas=n,this._dragging=t,this._modeling=i,this._rules=r,this._toolManager=o;var a=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),e.on("spaceTool.selection.end",function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("spaceTool.selection.ended",function(){a.activateMakeSpace(t.originalEvent)})}),e.on("spaceTool.move",Jd,function(e){var t=e.context;t.initialized||(t.initialized=a.initializeMakeSpace(e,t))}),e.on("spaceTool.end",function(t){var n=t.context,i=n.axis,r=n.direction,o=n.movingShapes,s=n.resizingShapes;if(n.initialized){var c={x:Qd(t.dx),y:Qd(t.dy)};c[tm[i]]=0;var p=!0;rm(s,function(e){("w"===r&&t.x>e.x+e.width||"e"===r&&t.x<e.x||"n"===r&&t.y>e.y+e.height||"s"===r&&t.y<e.y)&&(p=!1)}),p&&a.makeSpace(o,s,c,r),e.once("spaceTool.ended",function(e){a.activateSelection(e.originalEvent,!0,!0)})}})}om.$inject=["eventBus","dragging","canvas","modeling","rules","toolManager"];var am=om;om.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{trapClick:!1,cursor:"crosshair",autoActivate:t,data:{context:{reactivate:n}}})},om.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:"crosshair",data:{context:{}}})},om.prototype.makeSpace=function(e,t,n,i){return this._modeling.createSpace(e,t,n,i)},om.prototype.initializeMakeSpace=function(e,t){var n=Zd(e.dx)>Zd(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Zd(i)<5)return!1;i<0&&(i*=-1),Xd(e)&&(i*=-1);var o=this._canvas.getRootElement(),a=nm(o,!0),s=this.calculateAdjustments(a,n,i,r);return im(t,s,{axis:n,direction:Kd.getDirection(n,i)}),_a.set("resize-"+("x"===n?"ew":"ns")),!0},om.prototype.calculateAdjustments=function(e,t,n,i){var r=[],o=[],a=this._rules;return e.forEach(function(e){var s=e[t],c=s+e[em[t]];if(e.parent&&!e.waypoints)return n>0&&s>i?r.push(e):n<0&&c<i?r.push(e):s<i&&c>i&&a.allowed("shape.resize",{shape:e})?o.push(e):void 0}),{movingShapes:r,resizingShapes:o}},om.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},om.prototype.isActive=function(){var e=this._dragging.context();return e&&/^spaceTool/.test(e.prefix)};var sm=s.forEach,cm="djs-dragging",pm="djs-resizing",lm=250,um=n.append,hm=n.attr,dm=n.classes,mm=n.create,fm=n.remove,ym=w.translate;function vm(e,t,n,i,r){function o(e,t){sm(e,function(e){r.addDragger(e,t),n.addMarker(e,cm)})}e.on("spaceTool.selection.start",function(e){var t=n.getLayer("space"),r=e.context,o="M 0,-10000 L 0,10000",a="M -10000,0 L 10000,0",s=mm("g");hm(s,i.cls("djs-crosshair-group",["no-events"])),um(t,s);var c=mm("path");hm(c,"d",o),dm(c).add("djs-crosshair"),um(s,c);var p=mm("path");hm(p,"d",a),dm(p).add("djs-crosshair"),um(s,p),r.crosshairGroup=s}),e.on("spaceTool.selection.move",function(e){var t=e.context.crosshairGroup;ym(t,e.x,e.y)}),e.on("spaceTool.selection.cleanup",function(e){var t=e.context.crosshairGroup;t&&fm(t)}),e.on("spaceTool.move",lm,function(e){var a=e.context,s=a.line,c=a.axis,p=a.movingShapes,l=a.resizingShapes;if(a.initialized){if(!a.dragGroup){var u=n.getLayer("space");s=mm("path"),hm(s,"d","M0,0 L0,0"),dm(s).add("djs-crosshair"),um(u,s),a.line=s;var h=mm("g");hm(h,i.cls("djs-drag-group",["no-events"])),um(n.getDefaultLayer(),h),o(p,h),o(a.movingConnections=t.filter(function(e){var t=!1;sm(p,function(n){sm(n.outgoing,function(n){e===n&&(t=!0)})});var n=!1;sm(p,function(t){sm(t.incoming,function(t){e===t&&(n=!0)})});var i=!1;sm(l,function(t){sm(t.outgoing,function(t){e===t&&(i=!0)})});var r=!1;return sm(l,function(t){sm(t.incoming,function(t){e===t&&(r=!0)})}),function(e){return e.waypoints}(e)&&(t||i)&&(n||r)}),h),a.dragGroup=h}if(!a.frameGroup){var d=mm("g");hm(d,i.cls("djs-frame-group",["no-events"])),um(n.getDefaultLayer(),d);var m=[];sm(l,function(e){var t=r.addFrame(e,d);m.push({element:t,initialWidth:t.getBBox().width,initialHeight:t.getBBox().height}),n.addMarker(e,pm)}),a.frameGroup=d,a.frames=m}var f={x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y};hm(s,{path:f[c],display:""});var y={x:e.dx,y:e.dy};y[{x:"y",y:"x"}[a.axis]]=0,ym(a.dragGroup,y.x,y.y),sm(a.frames,function(e){e.initialWidth+y.x>5&&hm(e.element,{width:e.initialWidth+y.x}),e.initialHeight+y.y>5&&hm(e.element,{height:e.initialHeight+y.y})})}}),e.on("spaceTool.cleanup",function(e){var t=e.context,i=t.movingShapes,r=t.movingConnections,o=t.resizingShapes,a=t.line,s=t.dragGroup,c=t.frameGroup;sm(i,function(e){n.removeMarker(e,cm)}),sm(r,function(e){n.removeMarker(e,cm)}),s&&(fm(a),fm(s)),sm(o,function(e){n.removeMarker(e,pm)}),c&&fm(c)})}vm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var gm={__init__:["spaceToolPreview"],__depends__:[ou,cu,Vh,Yd],spaceTool:["type",am],spaceToolPreview:["type",vm]},bm={__depends__:[wd,Sd,Pd,Fd,gm,Il,qh,dh,Sh,dd],editorActions:["type",Dh]};function xm(e,t){e.addListener(function(n,i){return 65===n&&e.isCmd(i)?(t.trigger("selectElements"),!0):70===n&&e.isCmd(i)?(t.trigger("find"),!0):e.hasModifier(i)?void 0:83===n?(t.trigger("spaceTool"),!0):76===n?(t.trigger("lassoTool"),!0):72===n?(t.trigger("handTool"),!0):67===n?(t.trigger("globalConnectTool"),!0):69===n?(t.trigger("directEditing"),!0):void 0})}xm.$inject=["keyboard","editorActions"];var Em=xm,_m=Y.event,wm=Y.matches;function Sm(e,t,n){var i=this;this._config=e||{},this._eventBus=t,this._editorActions=n,this._listeners=[],this._keyHandler=function(e){var t,n,r=e.target,o=i._listeners,a=e.keyCode||e.charCode||-1;if(!r||!wm(r,"input, textarea")&&"true"!==r.contentEditable)for(t=0;n=o[t];t++)n(a,e)&&(e.preventDefault(),e.stopPropagation())},t.on("diagram.destroy",function(){i._fire("destroy"),i.unbind(),i._listeners=null}),t.on("diagram.init",function(){i._fire("init")}),t.on("attach",function(){e&&e.bindTo&&i.bind(e.bindTo)}),t.on("detach",function(){i.unbind()}),this._init()}Sm.$inject=["config.keyboard","eventBus","editorActions"];var Tm=Sm;function Cm(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Am(e){return e.shiftKey}Sm.prototype.bind=function(e){this.unbind(),this._node=e,_m.bind(e,"keydown",this._keyHandler,!0),this._fire("bind")},Sm.prototype.getBinding=function(){return this._node},Sm.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),_m.unbind(e,"keydown",this._keyHandler,!0)),this._node=null},Sm.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node,listeners:this._listeners})},Sm.prototype._init=function(){var e=this._listeners,t=this._editorActions,n=this._config;e.push(function(e,n){if(Cm(n)&&!Am(n)&&90===e)return t.trigger("undo"),!0}),e.push(function(e,n){if(Cm(n)&&(89===e||90===e&&Am(n)))return t.trigger("redo"),!0}),e.push(function(e,n){if(Cm(n)&&67===e)return t.trigger("copy"),!0}),e.push(function(e,n){if(Cm(n)&&86===e)return t.trigger("paste"),!0}),e.push(function(e,n){if(46===e)return t.trigger("removeSelection"),!0}),e.push(function(e,n){if((107===e||187===e||171===e||61===e)&&Cm(n))return t.trigger("stepZoom",{value:1}),!0}),e.push(function(e,n){if((109===e||189===e||173===e)&&Cm(n))return t.trigger("stepZoom",{value:-1}),!0}),e.push(function(e,n){if((96===e||48===e)&&Cm(n))return t.trigger("zoom",{value:1}),!0}),e.push(function(e,i){if([37,38,39,40].indexOf(e)>=0){var r={invertY:n.invertY,speed:n.speed||50};switch(e){case 37:r.direction="left";break;case 38:r.direction="up";break;case 39:r.direction="right";break;case 40:r.direction="down"}return t.trigger("moveCanvas",r),!0}})},Sm.prototype.addListener=function(e){this._listeners.push(e)},Sm.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Sm.prototype.isCmd=Cm,Sm.prototype.isShift=Am;var Rm={__depends__:[{__init__:["keyboard"],keyboard:["type",Tm]}],__init__:["bpmnKeyBindings"],bpmnKeyBindings:["type",Em]},Pm=n.append,Mm=n.attr,km=n.create,Bm=n.remove,Nm=d.getBusinessObject,Dm=d.is,Om=w.translate,Lm="djs-element-hidden",Im="djs-label-hidden";function jm(e,t,n,i){var r,o,a,s=this,c=t.getDefaultLayer();e.on("directEditing.activate",function(e){var n=e.active;if(r=n.element.label||n.element,Dm(r,"bpmn:TextAnnotation")){o=t.getAbsoluteBBox(r),a=km("g");var p=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),l=s.path=km("path");Mm(l,{d:p,strokeWidth:2,stroke:function(e,t){return Nm(e).di.get("stroke")||t||"black"}(r)}),Pm(a,l),Pm(c,a),Om(a,r.x,r.y)}Dm(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,Lm):(Dm(r,"bpmn:Task")||Dm(r,"bpmn:CallActivity")||Dm(r,"bpmn:SubProcess")||Dm(r,"bpmn:Participant"))&&t.addMarker(r,Im)}),e.on("directEditing.resize",function(e){if(Dm(r,"bpmn:TextAnnotation")){var t=e.height,n=e.dy,a=Math.max(r.height/o.height*(t+n),0),c=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:a,position:{mx:0,my:0}});Mm(s.path,{d:c})}}),e.on(["directEditing.complete","directEditing.cancel"],function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,Lm),t.removeMarker(r,Im)),r=void 0,o=void 0,a&&(Bm(a),a=void 0)})}jm.$inject=["eventBus","canvas","elementRegistry","pathMap"];var zm=jm,Fm=s.assign,$m=d.is,Gm=Js.isAny,Wm=f.isExpanded;function Hm(e,t,n,i,r){function o(e,t){(t||Gm(e,["bpmn:Task","bpmn:TextAnnotation"])||qm(e))&&n.activate(e)}this._canvas=t,this._modeling=i,n.registerProvider(this),e.on("element.dblclick",function(e){o(e.element,!0)}),e.on(["element.mousedown","drag.init","canvas.viewbox.changing","autoPlace"],function(e){n.complete()}),e.on(["commandStack.changed"],function(e){n.cancel()}),e.on("directEditing.activate",function(e){r.removeResizers()}),e.on("create.end",500,function(e){var t=e.shape,n=e.context.canExecute;e.isTouch||n&&o(t)}),e.on("autoPlace.end",500,function(e){o(e.shape)})}Hm.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles"];var Vm=Hm;function qm(e){return $m(e,"bpmn:SubProcess")&&!Wm(e)}Hm.prototype.activate=function(e){var t=Uh.getLabel(e);if(void 0!==t){var n={text:t},i=this.getEditingBBox(e);Fm(n,i);var r=e.label||e,o={};return(Gm(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||qm(e))&&Fm(o,{centerVertically:!0}),r.labelTarget&&Fm(o,{autoResize:!0}),$m(e,"bpmn:TextAnnotation")&&Fm(o,{resizable:!0,autoResize:!0}),Fm(n,{options:o}),n}},Hm.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r=i.x+i.width/2,o=i.y+i.height/2,a={x:i.x,y:i.y},s=t.zoom(),c=11*s,p=13*s,l=12*s,u=14*s,h={};if(($m(e,"bpmn:Lane")||function(e){return $m(e,"bpmn:Participant")&&Wm(e)}(e))&&(Fm(a,{width:i.height,height:30*s,x:i.x-i.height/2+15*s,y:o-30*s/2}),Fm(h,{fontSize:l+"px",lineHeight:u+"px",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px",transform:"rotate(-90deg)"})),(Gm(e,["bpmn:Task","bpmn:CallActivity"])||function(e){return $m(e,"bpmn:Participant")&&!Wm(e)}(e)||qm(e))&&(Fm(a,{width:i.width,height:i.height}),Fm(h,{fontSize:l+"px",lineHeight:u+"px",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"})),function(e){return $m(e,"bpmn:SubProcess")&&Wm(e)}(e)&&(Fm(a,{width:i.width,x:i.x}),Fm(h,{fontSize:l+"px",lineHeight:u+"px",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"})),n.labelTarget){var d=90*s,m=7*s,f=4*s;Fm(a,{width:d,height:i.height+m+f,x:r-d/2,y:i.y-m}),Fm(h,{fontSize:c+"px",lineHeight:p+"px",paddingTop:m+"px",paddingBottom:f+"px"})}return $m(e,"bpmn:TextAnnotation")&&(Fm(a,{width:i.width,height:i.height,minWidth:30*s,minHeight:10*s}),Fm(h,{textAlign:"left",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px",fontSize:l+"px",lineHeight:u+"px"})),{bounds:a,style:h}},Hm.prototype.update=function(e,t,n,i){var r,o;$m(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),this._modeling.updateLabel(e,t,r)};var Um=ui.getType;function Ym(e,t,n,i){e.on("element.changed",function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=n.getGraphics(r)),i.gfx&&e.fire(Um(r)+".changed",i)}),e.on("elements.changed",function(t){var n=t.elements;n.forEach(function(t){e.fire("element.changed",{element:t})}),i.updateContainments(n)}),e.on("shape.changed",function(e){i.update("shape",e.element,e.gfx)}),e.on("connection.changed",function(e){i.update("connection",e.element,e.gfx)})}Ym.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var Km={__init__:["changeSupport"],changeSupport:["type",Ym]},Xm=s.pick,Zm=s.assign,Qm=Ps.asTRBL,Jm=Ps.roundBounds;function ef(e,t,n,i){this._dragging=i,this._rules=t;var r=this;e.on("resize.start",function(e){var t,n,i;t=e.context,n=t.resizeConstraints,i=t.minBounds,void 0===n&&(void 0===i&&(i=r.computeMinResizeBox(t)),t.resizeConstraints={min:Qm(i)})}),e.on("resize.move",function(e){var t={x:e.dx,y:e.dy};!function(e,t){var n,i=e.shape,o=e.direction,a=e.resizeConstraints;e.delta=t,n=$c.resizeBounds(i,o,t),e.newBounds=$c.ensureConstraints(n,a),e.canExecute=r.canResize(e)}(e.context,t)}),e.on("resize.end",function(e){var t,i,r,o;t=e.context,i=t.shape,r=t.canExecute,o=t.newBounds,r&&(o=Jm(o),n.resizeShape(i,o))})}ef.prototype.canResize=function(e){var t=this._rules,n=Xm(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},ef.prototype.activate=function(e,t,n){var i,r,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(r=(i=Zm({shape:t},n)).direction))throw new Error("must provide a direction (nw|se|ne|sw)");o.init(e,"resize",{autoActivate:!0,cursor:"resize-"+(/nw|se/.test(r)?"nwse":"nesw"),data:{shape:t,context:i}})},ef.prototype.computeMinResizeBox=function(e){var t,n,i=e.shape,r=e.direction;return t=e.minDimensions||{width:10,height:10},n=$c.computeChildrenBBox(i,e.childrenBoxPadding),$c.getMinResizeBounds(r,i,t,n)},ef.$inject=["eventBus","rules","modeling","dragging"];var tf=ef,nf=s.bind,rf=s.forEach,of=n.append,af=n.attr,sf=n.classes,cf=n.clear,pf=n.create,lf=Y.event,uf=_o.isPrimaryButton,hf=Ps.asTRBL,df=w.transform;function mf(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(e){var t=e.newSelection;r.removeResizers(),1===t.length&&rf(t,nf(r.addResizer,r))}),e.on("shape.changed",function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))})}mf.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(t){uf(t)&&i.activate(t,e,n)}lf.bind(t,"mousedown",r),lf.bind(t,"touchstart",r)},mf.prototype._createResizer=function(e,t,n,i,r){var o=this._getResizersParent(),a=pf("g");sf(a).add("djs-resizer"),sf(a).add("djs-resizer-"+e.id),sf(a).add("djs-resizer-"+r),of(o,a);var s=pf("rect");af(s,{x:-7,y:-7,width:5,height:5}),sf(s).add("djs-resizer-visual"),of(a,s);var c=pf("rect");return af(c,{x:-7,y:-7,width:20,height:20}),sf(c).add("djs-resizer-hit"),of(a,c),df(a,t,n,i),a},mf.prototype.createResizer=function(e,t){var n,i=hf(e);n="nw"===t?this._createResizer(e,i.left,i.top,0,t):"ne"===t?this._createResizer(e,i.right,i.top,90,t):"se"===t?this._createResizer(e,i.right,i.bottom,180,t):this._createResizer(e,i.left,i.bottom,270,t),this.makeDraggable(e,n,t)},mf.prototype.addResizer=function(e){this._resize.canResize({shape:e})&&(this.createResizer(e,"nw"),this.createResizer(e,"ne"),this.createResizer(e,"se"),this.createResizer(e,"sw"))},mf.prototype.removeResizers=function(){var e=this._getResizersParent();cf(e)},mf.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},mf.$inject=["eventBus","canvas","selection","resize"];var ff=mf,yf="djs-resizing",vf="resize-not-ok",gf=500,bf=n.attr,xf=n.remove,Ef=n.classes;function _f(e,t,n){e.on("resize.move",gf,function(e){var i,r,o,a;i=e.context,r=i.shape,o=i.newBounds,(a=i.frame)||(a=i.frame=n.addFrame(r,t.getDefaultLayer()),t.addMarker(r,yf)),o.width>5&&bf(a,{x:o.x,width:o.width}),o.height>5&&bf(a,{y:o.y,height:o.height}),i.canExecute?Ef(a).remove(vf):Ef(a).add(vf)}),e.on("resize.cleanup",function(e){var n,i;n=e.context,i=n.shape,n.frame&&xf(n.frame),t.removeMarker(i,yf)})}_f.$inject=["eventBus","canvas","previewSupport"];var wf={__depends__:[cu,ou,Yd],__init__:["resize","resizePreview","resizeHandles"],resize:["type",tf],resizePreview:["type",_f],resizeHandles:["type",ff]},Sf={__depends__:[Km,wf,Il],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Vm],labelEditingPreview:["type",zm]},Tf=s.map,Cf=s.assign,Af=s.pick;function Rf(e){this._model=e}Rf.$inject=["moddle"],Rf.prototype._needsId=function(e){return e.$instanceOf("bpmn:RootElement")||e.$instanceOf("bpmn:FlowElement")||e.$instanceOf("bpmn:MessageFlow")||e.$instanceOf("bpmn:DataAssociation")||e.$instanceOf("bpmn:Artifact")||e.$instanceOf("bpmn:Participant")||e.$instanceOf("bpmn:Lane")||e.$instanceOf("bpmn:Process")||e.$instanceOf("bpmn:Collaboration")||e.$instanceOf("bpmndi:BPMNShape")||e.$instanceOf("bpmndi:BPMNEdge")||e.$instanceOf("bpmndi:BPMNDiagram")||e.$instanceOf("bpmndi:BPMNPlane")||e.$instanceOf("bpmn:Property")},Rf.prototype._ensureId=function(e){var t=(e.$type||"").replace(/^[^:]*:/g,"")+"_";!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Rf.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Rf.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Rf.prototype.createDiShape=function(e,t,n){return this.create("bpmndi:BPMNShape",Cf({bpmnElement:e,bounds:this.createDiBounds(t)},n))},Rf.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Rf.prototype.createDiWaypoints=function(e){var t=this;return Tf(e,function(e){return t.createDiWaypoint(e)})},Rf.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Af(e,["x","y"]))},Rf.prototype.createDiEdge=function(e,t,n){return this.create("bpmndi:BPMNEdge",Cf({bpmnElement:e},n))},Rf.prototype.createDiPlane=function(e){return this.create("bpmndi:BPMNPlane",{bpmnElement:e})};var Pf=Rf,Mf=Ps.getMid;function kf(){}var Bf=kf;kf.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||Mf(e.source),t.connectionEnd||Mf(e.target)]};var Nf={},Df=s.isArray,Of=s.find,Lf=s.without,If=s.assign,jf=Ps.getOrientation,zf=Ps.getMid,Ff=Ya.pointsAligned,$f=Ya.pointInRect,Gf=Ya.pointDistance,Wf=20,Hf={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Vf(e,t,n){var i,r;if("h:v"===(n=n||"h:h"))return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:i=Math.round((t.x-e.x)/2+e.x),y:e.y},{x:i,y:t.y}];if("v:v"===n)return r=Math.round((t.y-e.y)/2+e.y),[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("unknown directions: <"+n+">: directions must be specified as {a direction}:{b direction} (direction in h|v)")}function qf(e,t,n){var i=[];return Ff(e,t)||(i=Vf(e,t,n)),i.unshift(e),i.push(t),i}function Uf(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Lf(o,"straight")[0]||"h:h",s=Hf[a]||0,c=jf(e,t,s),p=function(e,t){switch(e){case"intersect":return null;case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}(c,a);if(n=n||zf(e),i=i||zf(t),p){if("h:h"===p)switch(c){case"top-right":case"right":case"bottom-right":n={original:n,x:e.x,y:n.y},i={original:i,x:t.x+t.width,y:i.y};break;case"top-left":case"left":case"bottom-left":n={original:n,x:e.x+e.width,y:n.y},i={original:i,x:t.x,y:i.y}}if("v:v"===p)switch(c){case"top-left":case"top":case"top-right":n={original:n,x:n.x,y:e.y+e.height},i={original:i,x:i.x,y:t.y};break;case"bottom-left":case"bottom":case"bottom-right":n={original:n,x:n.x,y:e.y},i={original:i,x:i.x,y:t.y+t.height}}return qf(n,i,p)}}function Yf(e,t,n){return function(e,t,n){return e>=t&&e<=n}(t[e],n[e],n[e]+n[{x:"width",y:"height"}[e]])}function Kf(e,t,n,i,r){var o,a,s={};return a=jf(e,t),/^(top|bottom|left|right)$/.test(a)?(/top|bottom/.test(a)&&(o="x"),/left|right/.test(a)&&(o="y"),"target"===r.preserveDocking?Yf(o,i,e)?(s[o]=i[o],[{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y,original:{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y}},{x:i.x,y:i.y}]):null:Yf(o,n,t)?(s[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y,original:{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y}}]):null):null}function Xf(e,t,n,i){if(function(e,t,n){return n.length<3||!(n.length>4)&&!!Of(n,function(e,t){var i=n[t-1];return i&&Gf(e,i)<3})}(0,0,i))return null;var r,o=i[0],a=i.slice();return a[0]=n,a[1]=function(e,t,n){switch(Ff(t,e)){case"v":return{x:e.x,y:n.y};case"h":return{x:n.x,y:e.y}}return{x:e.x,y:e.y}}(a[1],o,n),(r=function(e,t,n){var i;for(i=e.length-2;0!==i;i--)if($f(e[i],t,Wf)||$f(e[i],n,Wf))return e.slice(i);return e}(a,e,t))!==a?Xf(e,t,n,r):a}Nf.repairConnection=function(e,t,n,i,r,o){var a;return Df(n)&&(r=n,o=i,n=zf(e),i=zf(t)),r=r||[],-1!==(o=If({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&(a=Kf(e,t,n,i,o)),a||(o.connectionEnd?a=(a=Xf(t,e,i,r.slice().reverse()))&&a.reverse():o.connectionStart?a=Xf(e,t,n,r):r&&r.length&&(a=r)),a||(a=Uf(e,t,n,i,o)),a};var Zf=s.assign,Qf=Ya.pointsOnLine,Jf=f.isExpanded,ey=Ps.getMid,ty=Ps.getOrientation,ny=d.is;function iy(){}U(iy,Bf);var ry=iy;function oy(e,t){return e?e.original||e:ey(t)}function ay(e){var t=e.source,n=e.target;return ny(n,"bpmn:Activity")&&ny(t,"bpmn:BoundaryEvent")&&n.businessObject.isForCompensation}function sy(e){return ny(e,"bpmn:SubProcess")&&Jf(e)}iy.prototype.layoutConnection=function(e,t){t=t||{};var n,i,r,o,a=e.source,s=e.target,c=e.waypoints,p=t.connectionStart,l=t.connectionEnd;if(p||(p=oy(c&&c[0],a)),l||(l=oy(c&&c[c.length-1],s)),(ny(e,"bpmn:Association")||ny(e,"bpmn:DataAssociation"))&&c&&!ay(e))return[].concat([p],c.slice(1,-1),[l]);if(ny(e,"bpmn:MessageFlow"))n={preferredLayouts:["v:v"]},ny(s,"bpmn:Participant")&&(n={preferredLayouts:["straight","v:v"]}),sy(s)&&(n={preferredLayouts:["straight","v:v"]}),sy(a)&&ny(s,"bpmn:FlowNode")&&(n={preferredLayouts:["straight","v:v"],preserveDocking:sy(s)?"source":"target"}),ny(a,"bpmn:Participant")&&ny(s,"bpmn:FlowNode")&&(n={preferredLayouts:["straight","v:v"],preserveDocking:"target"}),ny(s,"bpmn:Event")&&(n={preferredLayouts:["v:v"]});else if(ny(e,"bpmn:SequenceFlow")||ay(e))if(ny(a,"bpmn:BoundaryEvent")){var u=(o=(r=a).host,ty(ey(r),o,-10));/left|right/.test(u)?n={preferredLayouts:["h:v"]}:/top|bottom/.test(u)&&(n={preferredLayouts:["v:h"]})}else n=ny(a,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:ny(s,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]};return n&&(n=Zf(n,t),i=(i=Nf.repairConnection(a,s,p,l,c,n))&&i.reduce(function(e,t,n){var r=e[e.length-1],o=i[n+1];return Qf(r,o,t,0)||e.push(t),e},[])),i||[p,l]};var cy=s.assign,py=s.forEach,ly=d.getBusinessObject,uy=d.is;function hy(e,t,n,i){gc.call(this,e),this._bpmnFactory=t,this._translate=i;var r=this;function o(e){var t=e.context.oldRoot.children;py(t,function(e){uy(e,"bpmn:BaseElement")&&r.updateParent(e)})}function a(e){var t=e.context.shape;uy(t,"bpmn:BaseElement")&&r.updateBounds(t)}function s(e){r.updateConnection(e.context)}function c(e){r.updateConnectionWaypoints(e.context.connection)}function p(e){r.updateAttachment(e.context)}this.executed(["connection.layout","connection.create","connection.reconnectEnd","connection.reconnectStart"],function(e){var t,i=e.context;i.cropped||((t=i.connection).waypoints=n.getCroppedWaypoints(t),i.cropped=!0)}),this.reverted(["connection.layout"],function(e){delete e.context.cropped}),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],my(function(e){var t=e.context;r.updateParent(t.shape||t.connection,t.oldParent)})),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],my(function(e){var t=e.context,n=t.shape||t.connection,i=t.parent||t.newParent;r.updateParent(n,i)})),this.executed(["canvas.updateRoot"],o),this.reverted(["canvas.updateRoot"],o),this.executed(["shape.move","shape.create","shape.resize"],my(function(e){"label"!==e.context.shape.type&&a(e)})),this.reverted(["shape.move","shape.create","shape.resize"],my(function(e){"label"!==e.context.shape.type&&a(e)})),e.on("shape.changed",function(e){"label"===e.element.type&&a({context:{shape:e.element}})}),this.executed(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],my(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],my(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints","connection.reconnectEnd","connection.reconnectStart"],my(c)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints","connection.reconnectEnd","connection.reconnectStart"],my(c)),this.executed(["connection.reconnectEnd","connection.reconnectStart"],my(function(e){var t=e.context,n=t.connection,i=ly(n),r=ly(t.oldSource),o=ly(t.oldTarget),a=ly(n.source),s=ly(n.target);r!==a&&o!==s&&(r&&r.default===i&&(t.default=r.default,r.default=void 0),i.sourceRef&&i.sourceRef.default&&!(uy(s,"bpmn:Activity")||uy(s,"bpmn:EndEvent")||uy(s,"bpmn:Gateway")||uy(s,"bpmn:IntermediateThrowEvent"))&&(t.default=i.sourceRef.default,i.sourceRef.default=void 0),r&&i.conditionExpression&&!uy(a,"bpmn:Activity")&&!uy(a,"bpmn:Gateway")&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0),o&&i.conditionExpression&&!(uy(s,"bpmn:Activity")||uy(s,"bpmn:EndEvent")||uy(s,"bpmn:Gateway")||uy(s,"bpmn:IntermediateThrowEvent"))&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0))})),this.reverted(["connection.reconnectEnd","connection.reconnectStart"],my(function(e){var t=e.context,n=t.connection,i=ly(n),r=ly(n.source);t.default&&(uy(r,"bpmn:ExclusiveGateway")||uy(r,"bpmn:InclusiveGateway")||uy(r,"bpmn:Activity"))&&(r.default=t.default),t.conditionExpression&&uy(r,"bpmn:Activity")&&(i.conditionExpression=t.conditionExpression)})),this.executed(["element.updateAttachment"],my(p)),this.reverted(["element.updateAttachment"],my(p))}U(hy,gc);var dy=hy;function my(e){return function(t){var n=t.context,i=n.shape||n.connection;uy(i,"bpmn:BaseElement")&&e(t)}}hy.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],hy.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},hy.prototype.updateParent=function(e,t){if(!(e instanceof Fi.Label)){var n=e.parent,i=e.businessObject,r=n&&n.businessObject,o=r&&r.di;uy(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),uy(e,"bpmn:DataOutputAssociation")&&(r=e.source?e.source.businessObject:null),uy(e,"bpmn:DataInputAssociation")&&(r=e.target?e.target.businessObject:null),this.updateSemanticParent(i,r),uy(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(i.di,o)}},hy.prototype.updateBounds=function(e){var t=e.businessObject.di,n=e instanceof Fi.Label?this._getLabel(t).bounds:t.bounds;cy(n,{x:e.x,y:e.y,width:e.width,height:e.height})},hy.prototype.updateFlowNodeRefs=function(e,t,n){var i,r;n!==t&&(uy(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),li.remove(i,e)),uy(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),li.add(r,e)))},hy.prototype.updateDiConnection=function(e,t,n){e.sourceElement&&e.sourceElement.bpmnElement!==t&&(e.sourceElement=t&&t.di),e.targetElement&&e.targetElement.bpmnElement!==n&&(e.targetElement=n&&n.di)},hy.prototype.updateDiParent=function(e,t){if(t&&!uy(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(li.remove(n,e),e.$parent=null)}},hy.prototype.getLaneSet=function(e){var t,n;return uy(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(uy(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},hy.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t){if(uy(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(uy(e,"bpmn:FlowElement")){if(t)if(uy(t,"bpmn:Participant"))t=t.processRef;else if(uy(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(uy(t,"bpmn:Lane"));i="flowElements"}else if(uy(e,"bpmn:Artifact")){for(;t&&!uy(t,"bpmn:Process")&&!uy(t,"bpmn:SubProcess")&&!uy(t,"bpmn:Collaboration");){if(uy(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(uy(e,"bpmn:MessageFlow"))i="messageFlows";else if(uy(e,"bpmn:Participant")){i="participants";var o,a=e.processRef;a&&(o=function(e){for(;e&&!uy(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(li.remove(o.get("rootElements"),a),a.$parent=null),t&&(li.add(o.get("rootElements"),a),a.$parent=o))}else uy(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":uy(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(r("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var s;if(e.$parent&&(s=e.$parent.get(i),li.remove(s,e)),t?((s=t.get(i)).push(e),e.$parent=t):e.$parent=null,n){var c=n.get(i);li.remove(s,e),t&&(c||(c=[],t.set(i,c)),c.push(e))}}},hy.prototype.updateConnectionWaypoints=function(e){e.businessObject.di.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},hy.prototype.updateConnection=function(e){var t,n=e.connection,i=ly(n),r=ly(n.source),o=ly(n.target);if(uy(i,"bpmn:DataAssociation"))uy(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=r,t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,parent.businessObject)):uy(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||r,this.updateSemanticParent(i,r,t),i.targetRef=o);else{var a=uy(i,"bpmn:SequenceFlow");i.sourceRef!==r&&(a&&(li.remove(i.sourceRef&&i.sourceRef.get("outgoing"),i),r&&r.get("outgoing")&&r.get("outgoing").push(i)),i.sourceRef=r),i.targetRef!==o&&(a&&(li.remove(i.targetRef&&i.targetRef.get("incoming"),i),o&&o.get("incoming")&&o.get("incoming").push(i)),i.targetRef=o)}this.updateConnectionWaypoints(n),this.updateDiConnection(i.di,r,o)},hy.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};var fy=s.assign,yy=s.forEach,vy=d.is,gy=f.isExpanded;function by(e,t,n){tr.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}U(by,tr),by.$inject=["bpmnFactory","moddle","translate"];var xy=by;function Ey(e,t,n){e[n]=t[n],delete t[n]}by.prototype.baseCreate=tr.prototype.create,by.prototype.create=function(e,t){return"label"===e?this.baseCreate(e,fy({type:"label"},Be.DEFAULT_LABEL_SIZE,t)):this.createBpmnElement(e,t)},by.prototype.createBpmnElement=function(e,t){var n,i,r,o=this._translate,a=(t=t||{}).businessObject;if(!a){if(!t.type)throw new Error(o("no shape type specified"));a=this._bpmnFactory.create(t.type)}return a.di||(a.di="root"===e?this._bpmnFactory.createDiPlane(a,[],{id:a.id+"_di"}):"connection"===e?this._bpmnFactory.createDiEdge(a,[],{id:a.id+"_di"}):this._bpmnFactory.createDiShape(a,{},{id:a.id+"_di"})),t.colors&&(fy(a.di,t.colors),delete t.colors),function(e,t,n){yy(n,function(n){void 0!==t[n]&&Ey(e,t,n)})}(a,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&Ey(a.di,t,"isExpanded"),vy(a,"bpmn:ExclusiveGateway")&&(a.di.isMarkerVisible=!0),t.eventDefinitionType&&(i=a.get("eventDefinitions")||[],r=this._moddle.create(t.eventDefinitionType),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(r.condition=this._moddle.create("bpmn:FormalExpression")),i.push(r),r.$parent=a,a.eventDefinitions=i,delete t.eventDefinitionType),n=this._getDefaultSize(a),t=fy({businessObject:a,id:a.id},n,t),this.baseCreate(e,t)},by.prototype._getDefaultSize=function(e){return vy(e,"bpmn:SubProcess")?gy(e)?{width:350,height:200}:{width:100,height:80}:vy(e,"bpmn:Task")?{width:100,height:80}:vy(e,"bpmn:Gateway")?{width:50,height:50}:vy(e,"bpmn:Event")?{width:36,height:36}:vy(e,"bpmn:Participant")?gy(e)?{width:600,height:250}:{width:400,height:100}:vy(e,"bpmn:Lane")?{width:400,height:100}:vy(e,"bpmn:DataObjectReference")?{width:36,height:50}:vy(e,"bpmn:DataStoreReference")?{width:50,height:50}:vy(e,"bpmn:TextAnnotation")?{width:100,height:30}:{width:100,height:80}},by.prototype.createParticipantShape=function(e){var t={type:"bpmn:Participant"};return e||(t.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(t)};var _y=Be.hasExternalLabel,wy=d.getBusinessObject,Sy=d.is,Ty={width:0,height:0};function Cy(e){var t=new G;function n(e,t){var n=e.label||e,i=e.labelTarget||e;return Uh.setLabel(n,t,i!==n),[n,i]}this.execute=function(e){return e.oldLabel=Uh.getLabel(e.element),n(e.element,e.newLabel)},this.revert=function(e){return n(e.element,e.oldLabel)},this.postExecute=function(n){var i=n.element,r=i.label||i,o=n.newBounds;if(_y(i)||Sy(i,"bpmn:TextAnnotation")){var a=wy(r),s=a.name||a.text;s&&(void 0===o&&(o=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:Ry});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(r,s,t)),o&&e.resizeShape(r,o,Ty))}}}Cy.$inject=["modeling"];var Ay=Cy,Ry={fontFamily:"Arial, sans-serif",fontSize:"11px"};var Py=s.filter,My=ep.getLanesRoot,ky=ep.getChildLanes,By=ep.LANE_INDENTATION;function Ny(e,t){this._modeling=e,this._spaceTool=t}Ny.$inject=["modeling","spaceTool"];var Dy=Ny;function Oy(e){this._moddle=e}Ny.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=My(i),a=o===i,s=a?i:i.parent;ky(s).length||n.createShape({type:"bpmn:Lane"},{x:i.x+By,y:i.y,width:i.width-By,height:i.height},s);var c=[];ui.eachElement(o,function(e){return c.push(e),e===i?[]:Py(e.children,function(e){return e!==i})});var p="top"===r?-120:120,l="top"===r?i.y:i.y+i.height,u=l+("top"===r?10:-10),h="top"===r?"n":"s",d=t.calculateAdjustments(c,"y",p,u);t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:p},h),e.newLane=n.createShape({type:"bpmn:Lane"},{x:i.x+(a?By:0),y:l-("top"===r?120:0),width:i.width-(a?By:0),height:120},s)},Oy.$inject=["moddle"];var Ly=Oy;Oy.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.claim(n,i):t.unclaim(n)},Oy.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.unclaim(n):t.claim(n,i)};var Iy=d.is,jy=ep.getLanesRoot,zy=ep.computeLanesResize,Fy=ui.eachElement,$y=Ps.asTRBL,Gy=$c.substractTRBL;function Wy(e,t){this._modeling=e,this._spaceTool=t}Wy.$inject=["modeling","spaceTool"];var Hy=Wy;Wy.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Wy.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=zy(e,t);n.resizeShape(e,t),i.forEach(function(e){n.resizeShape(e.shape,e.newBounds)})},Wy.prototype.resizeSpace=function(e,t){var n,i,r,o,a,s=this._spaceTool,c=$y(e),p=$y(t),l=Gy(p,c),u=jy(e),h=[],d=[];Fy(u,function(e){return h.push(e),(Iy(e,"bpmn:Lane")||Iy(e,"bpmn:Participant"))&&d.push(e),e.children}),(l.bottom||l.top)&&(n=l.bottom||l.top,i=e.y+(l.bottom?e.height:0)+(l.bottom?-10:10),r=l.bottom?"s":"n",o=l.top>0||l.bottom<0?-n:n,a=s.calculateAdjustments(h,"y",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:0,y:n},r)),(l.left||l.right)&&(n=l.right||l.left,i=e.x+(l.right?e.width:0)+(l.right?-10:100),r=l.right?"e":"w",o=l.left>0||l.right<0?-n:n,a=s.calculateAdjustments(d,"x",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:n,y:0},r))};var Vy=s.assign,qy=s.forEach,Uy={fill:void 0,stroke:void 0};function Yy(e){this._commandStack=e}Yy.$inject=["commandStack"];var Ky=Yy;Yy.prototype.postExecute=function(e){var t=e.elements,n=e.colors||Uy,i=this,r={};"fill"in n&&Vy(r,{fill:n.fill}),"stroke"in n&&Vy(r,{stroke:n.stroke}),qy(t,function(e){i._commandStack.execute("element.updateProperties",{element:e,properties:{di:r}})})};var Xy=ep.getChildLanes,Zy=ep.LANE_INDENTATION;function Qy(e,t){this._modeling=e,this._translate=t}Qy.$inject=["modeling","translate"];var Jy=Qy;function ev(e,t){this._canvas=e,this._modeling=t}Qy.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=Xy(i),a=o.length;if(a>r)throw new Error(n("more than {count} child lanes",{count:r}));var s,c,p,l,u,h=Math.round(i.height/r);for(u=0;u<r;u++)s=i.y+u*h,c=u===r-1?i.height-h*u:h,p={x:i.x+Zy,y:s,width:i.width-Zy,height:c},u<a?t.resizeShape(o[u],p):(l={type:"bpmn:Lane"},t.createShape(l,p,i))},ev.$inject=["canvas","modeling"];var tv=ev;ev.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=o.di;t.setRootElement(n,!0),li.add(a.rootElements,i),i.$parent=a,li.remove(a.rootElements,o),o.$parent=null,o.di=null,s.bpmnElement=i,i.di=s,e.oldRoot=r},ev.prototype.revert=function(e){var t=this._canvas,n=e.newRoot.businessObject,i=e.oldRoot,r=i.businessObject,o=n.$parent,a=n.di;t.setRootElement(i,!0),li.remove(o.rootElements,n),n.$parent=null,li.add(o.rootElements,r),r.$parent=o,n.di=null,a.bpmnElement=r,r.di=a};var nv=ep.collectLanes,iv=ep.getLanesRoot,rv=d.is,ov=Ps.asTRBL;function av(e){this._elementRegistry=e}av.$inject=["elementRegistry"];var sv=av;av.prototype.computeUpdates=function(e,t){var n={},i=[],r={},o=[];function a(e){n[e.id]||(o.push(e),n[e.id]=e)}function s(e){return e.parent?function(e){var t=iv(e);return r[t.id]||(r[t.id]=nv(t)),r[t.id]}(e).filter(function(t){return n=e,i=ov(t),r=n.x+n.width/2,o=n.y+n.height/2,r>i.left&&r<i.right&&o>i.top&&o<i.bottom;var n,i,r,o}).map(function(e){return e.businessObject}):[]}return t.forEach(function(e){var t=iv(e);t&&!n[t.id]&&(t.children.filter(function(e){return rv(e,"bpmn:FlowNode")}).forEach(a),n[t.id]=t)}),e.forEach(a),o.forEach(function(e){var t=e.businessObject,n=t.get("lanes").slice(),r=s(e);i.push({flowNode:t,remove:n,add:r})}),t.forEach(function(e){var t=e.businessObject;e.parent||t.get("flowNodeRef").forEach(function(e){i.push({flowNode:e,remove:[t],add:[]})})}),i},av.prototype.execute=function(e){var t=e.updates;t||(t=e.updates=this.computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(e){var t=e.flowNode,n=t.get("lanes");e.remove.forEach(function(e){li.remove(n,e),li.remove(e.get("flowNodeRef"),t)}),e.add.forEach(function(e){li.add(n,e),li.add(e.get("flowNodeRef"),t)})})},av.prototype.revert=function(e){e.updates.forEach(function(e){var t=e.flowNode,n=t.get("lanes");e.add.forEach(function(e){li.remove(n,e),li.remove(e.get("flowNodeRef"),t)}),e.remove.forEach(function(e){li.add(n,e),li.add(e.get("flowNodeRef"),t)})})};var cv=s.reduce,pv=s.keys,lv=s.forEach,uv=s.assign,hv=d.getBusinessObject,dv="id",mv="di",fv={width:0,height:0};function yv(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textUtil=new G}yv.$inject=["elementRegistry","moddle","translate","modeling"];var vv=yv;function gv(e,t){return dv in e&&e[dv]!==t[dv]}function bv(e,t){lv(t,function(t,n){var i;n!==mv?e.set(n,t):e.di&&(i=e.di,lv(t,function(e,t){i.set(t,e)}))})}yv.prototype.execute=function(e){var t=e.element,n=[t],i=this._translate;if(!t)throw new Error(i("element required"));var r=this._elementRegistry,o=this._moddle.ids,a=t.businessObject,s=function(e){var t=uv({},e);return xv.forEach(function(n){n in e&&(t[n]=hv(t[n]))}),t}(e.properties),c=e.oldProperties||function(e,t){var n=pv(t);return cv(n,function(n,i){var r,o;return n[i]=i!==mv?e.get(i):(r=e.di,o=pv(t.di),cv(o,function(e,t){return e[t]=r.get(t),e},{})),n},{})}(a,s);return gv(s,a)&&(o.unclaim(a[dv]),r.updateId(t,s[dv]),o.claim(s[dv],a)),"default"in s&&(s.default&&n.push(r.get(s.default.id)),a.default&&n.push(r.get(a.default.id))),"name"in s&&t.label&&(n.push(t.label),t.label.hidden=!s.name),bv(a,s),e.oldProperties=c,e.changed=n,n},yv.prototype.postExecute=function(e){var t=e.element.label,n=t&&hv(t).name;if(n){var i=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:Ev});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(t,n,this._textUtil);this._modeling.resizeShape(t,i,fv)}},yv.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return bv(r,i),gv(n,r)&&(a.unclaim(n[dv]),o.updateId(t,i[dv]),a.claim(i[dv],r)),e.changed};var xv=["default"];var Ev={fontFamily:"Arial, sans-serif",fontSize:"11px"};var _v=s.forEach;function wv(e,t){this._modeling=e,this._canvas=t}wv.$inject=["modeling","canvas"];var Sv=wv;function Tv(){}wv.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;_v(n,function(e){var n={x:0,y:0};i.left?n.x=i.left-e.x:i.right?n.x=i.right-e.width-e.x:i.center?n.x=i.center-Math.round(e.width/2)-e.x:i.top?n.y=i.top-e.y:i.bottom?n.y=i.bottom-e.height-e.y:i.middle&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)})},wv.prototype.postExecute=function(e){};var Cv=Tv;Tv.prototype.execute=function(){},Tv.prototype.revert=function(){};var Av=s.some;function Rv(e){this._modeling=e}U(Rv,Cv),Rv.$inject=["modeling"];var Pv=Rv;function Mv(e,t){this._canvas=e,this._layouter=t}Rv.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape;i=e.shape=this._modeling.createShape(i,e.position,n,{attach:e.attach}),e.shape=i},Rv.prototype.postExecute=function(e){var t,n,i=e.connectionParent||e.shape.parent;t=e.source,n=e.shape,Av(t.outgoing,function(e){return e.target===n})||this._modeling.connect(e.source,e.shape,e.connection,i)},Mv.$inject=["canvas","layouter"];var kv=Mv;Mv.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},Mv.prototype.revert=function(e){var t=e.connection;this._canvas.removeConnection(t),t.source=null,t.target=null};var Bv=s.assign,Nv=Math.round;function Dv(e){this._canvas=e}Dv.$inject=["canvas"];var Ov=Dv;function Lv(e){Ov.call(this,e)}Dv.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?Bv(t,n):Bv(t,{x:n.x-Nv(t.width/2),y:n.y-Nv(t.height/2)}),this._canvas.addShape(t,i,r),t},Dv.prototype.revert=function(e){this._canvas.removeShape(e.shape)},U(Lv,Ov),Lv.$inject=["canvas"];var Iv=Lv,jv=Ov.prototype.execute;Lv.prototype.execute=function(e){var t=e.shape;return function(e){["width","height"].forEach(function(t){void 0===e[t]&&(e[t]=0)})}(t),t.labelTarget=e.labelTarget,jv.call(this,e)};var zv=Ov.prototype.revert;function Fv(e,t){this._canvas=e,this._modeling=t}Lv.prototype.revert=function(e){return e.shape.labelTarget=null,zv.call(this,e)},Fv.$inject=["canvas","modeling"];var $v=Fv;Fv.prototype.preExecute=function(e){var t=e.connection;t.label&&this._modeling.removeShape(t.label)},Fv.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=li.indexOf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t.label=null,t},Fv.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,li.add(n.children,t,i),this._canvas.addConnection(t,n),t};var Gv=s.forEach;function Wv(e,t){this._modeling=e,this._elementRegistry=t}U(Wv,Cv),Wv.$inject=["modeling","elementRegistry"];var Hv=Wv;Wv.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;Gv(i,function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))})};var Vv={saveClear:function(e,t){if("function"!=typeof t)throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}},qv=Vv.saveClear;function Uv(e,t){this._canvas=e,this._modeling=t}Uv.$inject=["canvas","modeling"];var Yv=Uv;Uv.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=n.label;n.labelTarget&&(e.labelTarget=n.labelTarget,n.labelTarget=null),i&&this._modeling.removeShape(i,{nested:!0}),qv(n.incoming,function(e){t.removeConnection(e,{nested:!0})}),qv(n.outgoing,function(e){t.removeConnection(e,{nested:!0})}),qv(n.children,function(e){e.waypoints?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})})},Uv.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=li.indexOf(i.children,n),n.label=null,t.removeShape(n),n},Uv.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex,o=e.labelTarget;return li.add(i.children,n,r),o&&(o.label=n),t.addShape(n,i),n};var Kv=s.forEach,Xv=s.sortBy;function Zv(e){this._modeling=e}Zv.$inject=["modeling"];var Qv=Zv,Jv={x:"y",y:"x"};Zv.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(e,t){e.range.min=Math.min(t[i],e.range.min),e.range.max=Math.max(t[i]+t[r],e.range.max)}function a(e){return e[i]+e[r]/2}function s(e){return e.length-1}function c(e){return e.max-e.min}var p,l,u=n[0],h=s(n),d=n[h],m=0;Kv(n,function(e,p){var l,u,d;e.elements.length<2?p&&p!==n.length-1&&(o(e,e.elements[0]),m+=c(e.range)):(u=(l=Xv(e.elements,i))[0],p===h&&(u=l[s(l)]),d=a(u),e.range=null,Kv(l,function(n){!function(e,n){var r={y:0};r[i]=e-a(n),r[i]&&(r[Jv[i]]=0,t.moveElements([n],r,n.parent))}(d,n),null!==e.range?o(e,n):e.range={min:n[i],max:n[i]+n[r]}}),p&&p!==n.length-1&&(m+=c(e.range)))}),l=Math.abs(d.range.min-u.range.max),(p=Math.round((l-m)/(n.length-1)))<n.length-1||Kv(n,function(e,o){var a,s={};e!==u&&e!==d&&(a=n[o-1],e.range.max=0,Kv(e.elements,function(n,o){s[Jv[i]]=0,s[i]=a.range.max-n[i]+p,e.range.min!==n[i]&&(s[i]+=n[i]-e.range.min),s[i]&&t.moveElements([n],s,n.parent),e.range.max=Math.max(n[i]+n[r],o?e.range.max:0)}))})},Zv.prototype.postExecute=function(e){};var eg=s.assign;function tg(e,t){this._layouter=e,this._canvas=t}tg.$inject=["layouter","canvas"];var ng=tg;tg.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return eg(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},tg.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};var ig=s.forEach;function rg(){}var og=rg;rg.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=li.remove(o.children,t),li.add(i.children,t,r),t.parent=i,ig(t.waypoints,function(e){e.x+=n.x,e.y+=n.y,e.original&&(e.original.x+=n.x,e.original.y+=n.y)}),t},rg.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return li.remove(n.children,t),li.add(i.children,t,r),t.parent=i,ig(t.waypoints,function(e){e.x-=o.x,e.y-=o.y,e.original&&(e.original.x-=o.x,e.original.y-=o.y)}),t};var ag={},sg=Ps.roundPoint,cg=Xu.center,pg=Xu.delta;ag.getNewAttachPoint=function(e,t,n){var i=cg(t),r=cg(n),o=pg(e,i),a=o.x*(n.width/t.width),s=o.y*(n.height/t.height);return sg({x:r.x+a,y:r.y+s})},ag.getNewAttachShapeDelta=function(e,t,n){var i=cg(e),r=cg(t),o=cg(n),a=pg(e,i),s=pg(i,r),c=s.x*(n.width/t.width),p=s.y*(n.height/t.height),l=o.x+c,u=o.y+p;return sg({x:l+a.x-e.x,y:u+a.y-e.y})};var lg={},ug=ag.getNewAttachPoint;function hg(e,t,n){var i=fg(e)[0];return ug(i.original||i,n,t)}function dg(e,t,n){var i=fg(e),r=i[i.length-1];return ug(r.original||r,n,t)}function mg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function fg(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}lg.getResizedSourceAnchor=hg,lg.getResizedTargetAnchor=dg,lg.getMovedSourceAnchor=function(e,t,n){return hg(e,t,mg(t,n))},lg.getMovedTargetAnchor=function(e,t,n){return dg(e,t,mg(t,n))};var yg=s.forEach,vg=lg.getMovedSourceAnchor,gg=lg.getMovedTargetAnchor;function bg(e){this._modeling=e}var xg=bg;function Eg(e){this._helper=new xg(e)}bg.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},bg.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,p=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),yg(a,function(e){o.moveShape(e,t,p[e.id]&&!l&&n,{recurse:!1,layout:!1})}),yg(s,function(e){var i=!!a[e.source.id],r=!!a[e.target.id];c[e.id]&&i&&r?o.moveConnection(e,t,p[e.id]&&!l&&n):o.layoutConnection(e,{connectionStart:i&&vg(e,e.source,t),connectionEnd:r&&gg(e,e.target,t)})})},bg.prototype.getClosure=function(e){return ui.getClosure(e)},Eg.$inject=["modeling"];var _g=Eg;Eg.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Eg.prototype.postExecute=function(e){var t,n=e.hints;n&&n.primaryShape&&(t=n.primaryShape,n.oldParent=t.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,t)},Eg.prototype.execute=function(e){},Eg.prototype.revert=function(e){};var wg=s.assign,Sg=s.forEach,Tg=s.pick,Cg=lg.getMovedSourceAnchor,Ag=lg.getMovedTargetAnchor;function Rg(e){this._modeling=e,this._helper=new xg(e)}Rg.$inject=["modeling"];var Pg=Rg;Rg.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=Tg(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=li.remove(o.children,t),li.add(i.children,t,r),wg(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Rg.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(Sg(t.incoming,function(e){r.layoutConnection(e,{connectionEnd:Ag(e,t,n)})}),Sg(t.outgoing,function(e){r.layoutConnection(e,{connectionStart:Cg(e,t,n)})})),!1!==i.recurse&&this.moveChildren(e)},Rg.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return li.add(n.children,t,i),wg(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Rg.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Rg.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};var Mg=s.forEach,kg=s.map,Bg=s.sortBy,Ng=s.assign;function Dg(e,t){Mg(t,function(t){e[t]&&delete e[t]})}function Og(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._selection=n,this._elementFactory=i,this._modeling=r,this._rules=o}U(Og,Cv),Og.$inject=["eventBus","canvas","selection","elementFactory","modeling","rules"];var Lg=Og;Og.prototype.preExecute=function(e){var t=this._eventBus,n=this,i=e.tree,r=e.topParent,o=e.position;i.createdElements={},i.labels=[],Mg(i,function(e,a){var s=parseInt(a,10);isNaN(s)||(s||(e=kg(e,function(e){return e.parent=r,e})),e=Bg(e,"priority"),Mg(e,function(e){var a,c=e.id,p=e.parent,l={},u=Ng({},e);if(s&&(u.parent=n._getCreatedElement(p,i)),p)if(t.fire("element.paste",{createdElements:i.createdElements,descriptor:u}),p=u.parent,u.waypoints)(u=n._createConnection(u,p,o,i))&&(i.createdElements[c]={element:u,descriptor:e});else{if(u.parent!==r&&(l.root=!1),u.host&&(l.attach=!0,p=n._getCreatedElement(u.host,i)),u.labelTarget)return i.labels.push(u);a={x:Math.round(o.x+u.delta.x+u.width/2),y:Math.round(o.y+u.delta.y+u.height/2)},Dg(u,["id","parent","delta","host","priority"]),(u=n._createShape(u,p,a,l))&&(i.createdElements[c]={element:u,descriptor:e})}}))})},Og.prototype.postExecute=function(e){var t=this._modeling,n=this._selection,i=this,r=e.tree,o=r.labels,a=[];Mg(o,function(e){var n,o,a,s=i._getCreatedElement(e.labelTarget,r);s&&(n=s.label)&&(o={x:s.x,y:s.y},s.waypoints&&(o=s.waypoints[0]),a={x:Math.round(o.x-n.x+e.delta.x),y:Math.round(o.y-n.y+e.delta.y)},t.moveShape(n,a,s.parent))}),Mg(r[0],function(e){var t=e.id,n=r.createdElements[t];n&&a.push(n.element)}),n.select(a)},Og.prototype._createConnection=function(e,t,n,i){var r,o,a=this._modeling,s=this._rules;return e.waypoints=kg(e.waypoints,function(t,i){return{x:Math.round(n.x+e.delta[i].x),y:Math.round(n.y+e.delta[i].y)}}),r=this._getCreatedElement(e.source,i),o=this._getCreatedElement(e.target,i),r&&o&&s.allowed("element.paste",{source:r,target:o})?(Dg(e,["id","parent","delta","source","target","width","height","priority"]),a.createConnection(r,o,e,t)):null},Og.prototype._createShape=function(e,t,n,i,r){var o=this._modeling,a=this._elementFactory;if(!this._rules.allowed("element.paste",{element:e,position:n,parent:t}))return null;var s=a.createShape(e);return o.createShape(s,n,t,i,r),s},Og.prototype._getCreatedElement=function(e,t){return t.createdElements[e]&&t.createdElements[e].element};var Ig=s.isArray;function jg(){}jg.$inject=[];var zg=jg;jg.prototype.execute=function(e){var t,n=e.newSource,i=e.newTarget,r=e.connection,o=e.dockingOrPoints,a=r.waypoints;if(!n&&!i)throw new Error("newSource or newTarget are required");if(n&&i)throw new Error("must specify either newSource or newTarget");return e.oldWaypoints=a,Ig(o)?t=o:(t=a.slice()).splice(n?0:-1,1,o),n&&(e.oldSource=r.source,r.source=n),i&&(e.oldTarget=r.target,r.target=i),r.waypoints=t,r},jg.prototype.revert=function(e){var t=e.newSource,n=e.newTarget,i=e.connection;return t&&(i.source=e.oldSource),n&&(i.target=e.oldTarget),i.waypoints=e.oldWaypoints,i};var Fg=s.forEach;function $g(e,t){this._modeling=e,this._rules=t}$g.$inject=["modeling","rules"];var Gg=$g;$g.prototype.preExecute=function(e){var t,n=this,i=this._modeling,r=this._rules,o=e.oldShape,a=e.newData,s=e.hints;function c(e,t,n,i){return r.allowed(e,{source:t,target:n,connection:i})}var p,l={x:a.x,y:a.y};t=e.newShape=e.newShape||n.createShape(a,l,o.parent),o.host&&i.updateAttachment(t,o.host),!1!==s.moveChildren&&(p=o.children.slice(),i.moveElements(p,{x:0,y:0},t));var u=o.incoming.slice(),h=o.outgoing.slice();Fg(u,function(e){var i=e.waypoints,r=i[i.length-1];c("connection.reconnectEnd",e.source,t,e)&&n.reconnectEnd(e,t,r)}),Fg(h,function(e){var i=e.waypoints[0],r=e.target;c("connection.reconnectStart",t,r,e)&&n.reconnectStart(e,t,i)})},$g.prototype.postExecute=function(e){var t=this._modeling,n=e.oldShape,i=e.newShape;Fg(i.incoming,function(e){t.layoutConnection(e,{endChanged:!0})}),Fg(i.outgoing,function(e){t.layoutConnection(e,{startChanged:!0})}),t.removeShape(n)},$g.prototype.execute=function(e){},$g.prototype.revert=function(e){},$g.prototype.createShape=function(e,t,n){return this._modeling.createShape(e,t,n)},$g.prototype.reconnectStart=function(e,t,n){this._modeling.reconnectStart(e,t,n)},$g.prototype.reconnectEnd=function(e,t,n){this._modeling.reconnectEnd(e,t,n)};var Wg=s.assign,Hg=s.forEach,Vg=lg.getResizedSourceAnchor,qg=lg.getResizedTargetAnchor;function Ug(e){this._modeling=e}Ug.$inject=["modeling"];var Yg=Ug;Ug.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},Wg(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ug.prototype.postExecute=function(e){var t=e.shape,n=e.oldBounds,i=this._modeling;Hg(t.incoming,function(e){i.layoutConnection(e,{connectionEnd:qg(e,t,n)})}),Hg(t.outgoing,function(e){i.layoutConnection(e,{connectionStart:Vg(e,t,n)})})},Ug.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return Wg(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};var Kg=s.forEach;function Xg(e){this._modeling=e}Xg.$inject=["modeling"];var Zg=Xg;function Qg(e){this._modeling=e}Xg.prototype.preExecute=function(e){var t=this._modeling,n=e.resizingShapes,i=e.delta,r=e.direction;Kg(n,function(e){var n=Kd.resizeBounds(e,r,i);t.resizeShape(e,n)})},Xg.prototype.postExecute=function(e){var t=this._modeling,n=e.movingShapes,i=e.delta;t.moveElements(n,i,void 0,{autoResize:!1,attach:!1})},Xg.prototype.execute=function(e){},Xg.prototype.revert=function(e){},Qg.$inject=["modeling"];var Jg=Qg;function eb(e){this._modeling=e}Qg.prototype.execute=function(e){var t,n=e.shape,i=n.children;return e.oldChildrenVisibility=(t={},i.forEach(function(e){t[e.id]=e.hidden}),t),n.collapsed=!n.collapsed,function(e,t){e.forEach(function(e){e.hidden=t})}(i,n.collapsed),[n].concat(i)},Qg.prototype.revert=function(e){var t,n=e.shape,i=e.oldChildrenVisibility,r=n.children;return t=i,r.forEach(function(e){e.hidden=t[e.id]}),n.collapsed=!n.collapsed,[n].concat(r)};var tb=eb;function nb(e,t){return li.remove(e&&e.attachers,t)}function ib(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),li.add(i,t,n)}}function rb(){}eb.$inject=["modeling"],eb.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=nb(i,t),ib(n,t),t.host=n,t},eb.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,nb(n,t),ib(i,t,r),t};var ob=rb;rb.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},rb.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};var ab=s.forEach;function sb(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}sb.$inject=["eventBus","elementFactory","commandStack"];var cb=sb;sb.prototype.getHandlers=function(){return{"shape.append":Pv,"shape.create":Ov,"shape.delete":Yv,"shape.move":Pg,"shape.resize":Yg,"shape.replace":Gg,"shape.toggleCollapse":Jg,spaceTool:Zg,"label.create":Iv,"connection.create":kv,"connection.delete":$v,"connection.move":og,"connection.layout":ng,"connection.updateWaypoints":ob,"connection.reconnectStart":zg,"connection.reconnectEnd":zg,"elements.move":_g,"elements.delete":Hv,"elements.distribute":Qv,"elements.align":Sv,"element.updateAttachment":tb,"elements.paste":Lg}},sb.prototype.registerHandlers=function(e){ab(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},sb.prototype.moveShape=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},sb.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},sb.prototype.moveElements=function(e,t,n,i){var r,o=(i=i||{}).attach,a=n;!0===o?(r=n,a=n.parent):!1===o&&(r=null);var s={shapes:e,delta:t,newParent:a,newHost:r,hints:i};this._commandStack.execute("elements.move",s)},sb.prototype.moveConnection=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},sb.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},sb.prototype.createConnection=function(e,t,n,i,r,o){"object"==typeof n&&(o=r,r=i,i=n,n=void 0);var a={source:e,target:t,parent:r,parentIndex:n,connection:i=this._create("connection",i),hints:o};return this._commandStack.execute("connection.create",a),a.connection},sb.prototype.createShape=function(e,t,n,i,r){"number"!=typeof i&&(r=i,i=void 0);var o,a,s=(r=r||{}).attach;e=this._create("shape",e),s?(o=n.parent,a=n):o=n;var c={position:t,shape:e,parent:o,parentIndex:i,host:a,hints:r};return this._commandStack.execute("shape.create",c),c.shape},sb.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},sb.prototype.appendShape=function(e,t,n,i,r){r=r||{};var o={source:e,position:n,target:i,shape:t=this._create("shape",t),connection:r.connection,connectionParent:r.connectionParent,attach:r.attach};return this._commandStack.execute("shape.append",o),o.shape},sb.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},sb.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},sb.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},sb.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},sb.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},sb.prototype.pasteElements=function(e,t,n){var i={tree:e,topParent:t,position:n};this._commandStack.execute("elements.paste",i)},sb.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},sb.prototype.resizeShape=function(e,t,n){var i={shape:e,newBounds:t,minBounds:n};this._commandStack.execute("shape.resize",i)},sb.prototype.createSpace=function(e,t,n,i){var r={movingShapes:e,resizingShapes:t,delta:n,direction:i};this._commandStack.execute("spaceTool",r)},sb.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},sb.prototype.reconnectStart=function(e,t,n){var i={connection:e,newSource:t,dockingOrPoints:n};this._commandStack.execute("connection.reconnectStart",i)},sb.prototype.reconnectEnd=function(e,t,n){var i={connection:e,newTarget:t,dockingOrPoints:n};this._commandStack.execute("connection.reconnectEnd",i)},sb.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},sb.prototype._create=function(e,t){return t instanceof Fi.Base?t:this._elementFactory.create(e,t)},sb.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function pb(e,t,n,i){cb.call(this,e,t,n),this._bpmnRules=i}U(pb,cb),pb.$inject=["eventBus","elementFactory","commandStack","bpmnRules"];var lb=pb;pb.prototype.getHandlers=function(){var e=cb.prototype.getHandlers.call(this);return e["element.updateProperties"]=vv,e["canvas.updateRoot"]=tv,e["lane.add"]=Dy,e["lane.resize"]=Hy,e["lane.split"]=Jy,e["lane.updateRefs"]=sv,e["id.updateClaim"]=Ly,e["element.setColor"]=Ky,e["element.updateLabel"]=Ay,e},pb.prototype.updateLabel=function(e,t,n){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n})},pb.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,i)},pb.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},pb.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},pb.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},pb.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},pb.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pb.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},pb.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},pb.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},pb.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},pb.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};var ub=Ps.getOrientation,hb=Ps.getMid,db=Ps.asTRBL,mb=Ta.substract,fb=Be.hasExternalLabel;function yb(e,t){function n(e){if(fb(e)){var n=function(e){var t=hb(e.label),n=hb(e),i=bb(n,t);if(r=i,-1===gb.indexOf(r))return;var r;var o=[].concat(e.incoming.map(function(e){return e.waypoints[e.waypoints.length-2]}),e.outgoing.map(function(e){return e.waypoints[1]})).map(function(e){return bb(n,e)}),a=gb.filter(function(e){return-1===o.indexOf(e)});if(-1!==a.indexOf(i))return;return a[0]}(e);n&&function(e,n){var r,o=hb(e),a=e.label,s=hb(a),c=db(e);switch(n){case"top":r={x:o.x,y:c.top-i-a.height/2};break;case"left":r={x:c.left-i-a.width/2,y:o.y};break;case"bottom":r={x:o.x,y:c.bottom+i+a.height/2};break;case"right":r={x:c.right+i+a.width/2,y:o.y}}var p=mb(r,s);t.moveShape(a,p)}(e,n)}}gc.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.reconnectEnd","connection.reconnectStart","connection.updateWaypoints"],function(e){var t=e.context.connection,i=t.source,r=t.target;n(i),n(r)});var i=10}U(yb,gc),yb.$inject=["eventBus","modeling"];var vb=yb;var gb=["top","bottom","left","right"];function bb(e,t){return ub(t,e,5)}var xb=d.is;function Eb(e,t,n){gc.call(this,e),this.preExecute("shape.append",function(e){var t=e.source,n=e.shape;e.position||(xb(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})},!0)}Eb.$inject=["eventBus","elementFactory","bpmnRules"],U(Eb,gc);var _b=Eb,wb=s.forEach,Sb=d.is;function Tb(e,t,n){gc.call(this,e),this.preExecute("elements.paste",1500,function(e){var t=e.topParent;if(t.parent||(e.topParent=n.getRootElement()),Sb(t,"bpmn:Lane"))do{t=e.topParent=t.parent}while(Sb(t,"bpmn:Lane")||!Sb(t,"bpmn:Participant"))},!0),this.postExecute("elements.paste",function(e){var n=e.tree.createdElements;wb(n,function(e){var i,r=e.element,o=r.businessObject,a=e.descriptor;(Sb(o,"bpmn:ExclusiveGateway")||Sb(o,"bpmn:InclusiveGateway")||Sb(o,"bpmn:Activity"))&&a.default&&(i=(i=n[a.default])?i.element:void 0,delete r.default,t.updateProperties(r,{default:i}))})},!0)}Tb.$inject=["eventBus","modeling","canvas"],U(Tb,gc);var Cb=Tb,Ab=d.is;function Rb(e,t,n,i){gc.call(this,e),this.preExecute("shape.create",function(e){var t,r=e.shape,o=e.host,a={cancelActivity:!0};o&&Ab(r,"bpmn:IntermediateThrowEvent")&&(a.attachedToRef=o.businessObject,t={type:"bpmn:BoundaryEvent",businessObject:i.create("bpmn:BoundaryEvent",a)},e.shape=n.createShape(t))},!0)}Rb.$inject=["eventBus","modeling","elementFactory","bpmnFactory"],U(Rb,gc);var Pb=Rb,Mb=d.is;function kb(e,t,n){gc.call(this,e),this.preExecute("shape.create",function(e){var n=e.context.shape;if(Mb(n,"bpmn:DataObjectReference")&&"label"!==n.type){var i=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=i}})}kb.$inject=["eventBus","bpmnFactory","moddle"],U(kb,gc);var Bb=kb,Nb=d.is;function Db(e,t,n,i,r){gc.call(this,e),this.preExecute("shape.create",function(e){var n=e.parent,i=e.shape,o=e.position,a=r.getRootElement();if(Nb(n,"bpmn:Process")&&Nb(i,"bpmn:Participant")&&!Nb(a,"bpmn:Collaboration")){var s=t.makeCollaboration();e.position=o,e.parent=s,e.processRoot=n}},!0),this.execute("shape.create",function(e){var t=e.processRoot,n=e.shape;t&&(e.oldProcessRef=n.businessObject.processRef,n.businessObject.processRef=t.businessObject)},!0),this.revert("shape.create",function(e){var t=e.processRoot,n=e.shape;t&&(n.businessObject.processRef=e.oldProcessRef)},!0),this.postExecute("shape.create",function(e){var n=e.processRoot,i=e.shape;if(n){var r=n.children.slice();t.moveElements(r,{x:0,y:0},i)}},!0)}Db.$inject=["eventBus","modeling","elementFactory","bpmnFactory","canvas"],U(Db,gc);var Ob=Db,Lb=s.find,Ib=d.is,jb="__targetRef_placeholder";function zb(e,t){function n(e,n){var i=e.get("properties"),r=Lb(i,function(e){return e.name===jb});return!r&&n&&(r=t.create("bpmn:Property",{name:jb}),li.add(i,r)),r}function i(e,t){var i=n(e);i&&(function(e,t,n){var i=e.get("dataInputAssociations");return Lb(i,function(e){return e!==n&&e.targetRef===t})}(e,i,t)||li.remove(e.get("properties"),i))}function r(e){var t,r=e.context,o=r.connection,a=o.businessObject,s=o.target,c=s&&s.businessObject,p=r.newTarget,l=p&&p.businessObject,u=r.oldTarget||r.target,h=u&&u.businessObject,d=o.businessObject;h&&h!==c&&i(h,a),l&&l!==c&&i(l,a),c?(t=n(c,!0),d.targetRef=t):d.targetRef=null}gc.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],$b(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],$b(r))}zb.$inject=["eventBus","bpmnFactory"],U(zb,gc);var Fb=zb;function $b(e){return function(t){var n=t.context.connection;if(Ib(n,"bpmn:DataInputAssociation"))return e(t)}}var Gb=d.is,Wb=ep.getChildLanes,Hb=ui.eachElement,Vb=500;function qb(e,t,n){gc.call(this,e),this.postExecuted("shape.delete",Vb,function(e){var t=e.context,i=t.hints,r=t.shape,o=t.oldParent;Gb(r,"bpmn:Lane")&&(i&&i.nested||function(e,t){var i,r,o,a=Wb(t),s=[],c=[];Hb(a,function(t){return t.y>e.y?c.push(t):s.push(t),t.children}),a.length&&(i=c.length&&s.length?e.height/2:e.height,s.length&&(r=n.calculateAdjustments(s,"y",i,e.y-10),n.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:i},"s")),c.length&&(o=n.calculateAdjustments(c,"y",-i,e.y+e.height+10),n.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-i},"n")))}(r,o))})}qb.$inject=["eventBus","modeling","spaceTool"],U(qb,gc);var Ub=qb,Yb={},Kb=Ya.pointDistance,Xb=Math.round,Zb=Math.max;var Qb=10;Yb.getApproxIntersection=function(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(Kb(i,t)<=Qb)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,r,o,a=Rs((r=Qb,[["M",(i=t).x,i.y],["m",0,-r],["a",r,r,0,1,1,0,2*r],["a",r,r,0,1,1,0,-2*r],["z"]]),(n=[],e.forEach(function(e,t){n.push([0===t?"M":"L",e.x,e.y])}),n)),s=a[0],c=a[a.length-1];return s?s!==c?s.segment2!==c.segment2?{point:e[o=Zb(s.segment2,c.segment2)-1],bendpoint:!0,index:o}:{point:{x:Xb(s.x+c.x)/2,y:Xb(s.y+c.y)/2},index:s.segment2}:{point:{x:Xb(s.x),y:Xb(s.y)},index:s.segment2}:null}(e,t)};var Jb=s.assign,ex=s.find,tx=Yb.getApproxIntersection;function nx(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function ix(e){return Jb({},e)}function rx(e,t,n){function i(e,i,r){var o,a,s,c,p,l,u=i.waypoints,h=tx(u,r);if(h){if(o=u.slice(0,h.index),a=u.slice(h.index+(h.bendpoint?1:0)),!o.length||!a.length)return;s=h.bendpoint?u[h.index]:r,nx(e,o[o.length-1])||o.push(ix(s)),nx(e,a[0])||a.unshift(ix(s))}c=i.source,p=i.target,t.canConnect(c,e,i)&&(n.reconnectEnd(i,e,o||r),l=!0),t.canConnect(e,p,i)&&(l?n.connect(e,p,{type:i.type,waypoints:a}):n.reconnectStart(i,e,a||r))}gc.call(this,e),this.preExecute("elements.move",function(e){var n=e.newParent,i=e.shapes,r=e.delta,o=i[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var a,s=(a=o,{x:Math.round(a.x+a.width/2),y:Math.round(a.y+a.height/2)}),c={x:s.x+r.x,y:s.y+r.y},p=ex(n.children,function(e){return t.canInsert(i,e)&&tx(e.waypoints,c)});p&&(e.targetFlow=p,e.position=c)}},!0),this.postExecuted("elements.move",function(e){var t=e.shapes,n=e.targetFlow,r=e.position;n&&i(t[0],n,r)},!0),this.preExecute("shape.create",function(e){var n=e.parent,i=e.shape;t.canInsert(i,n)&&(e.targetFlow=n,e.parent=n.parent)},!0),this.postExecuted("shape.create",function(e){var t=e.shape,n=e.targetFlow,r=e.position;n&&i(t,n,r)},!0)}U(rx,gc),rx.$inject=["eventBus","bpmnRules","modeling"];var ox=rx,ax=function(e,t,n,i){var r,o,a,s;return 0==(r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,a=e.x-n.x,s=((i.x-n.x)*o-(i.y-n.y)*a)/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})},sx=Ps.getMid;function cx(e){function t(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},a=ax(e,t,n,r),s=ax(e,t,n,o);i=a&&s?lx(a,n)>lx(s,n)?s:a:a||s,e.original=i}e.on("bpmnElement.added",function(e){var n,i,r=e.element;r.waypoints&&(t((i=(n=r).waypoints)[0],i[1],sx(n.source)),t(i[i.length-1],i[i.length-2],sx(n.target)))})}cx.$inject=["eventBus"];var px=cx;function lx(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}var ux={};function hx(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}ux.getAngle=function(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))},ux.rotateVector=function(e,t){return t?{x:Math.cos(t)*e.x-Math.sin(t)*e.y,y:Math.sin(t)*e.x+Math.cos(t)*e.y}:e},ux.getDistancePointPoint=function(e,t){return hx({x:e.x-t.x,y:e.y-t.y})};var dx={},mx=Math.sqrt,fx=Math.min,yx=Math.max,vx=Math.abs;function gx(e){return Math.pow(e,2)}function bx(e,t){return mx(gx(e.x-t.x)+gx(e.y-t.y))}function xx(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,p=(r*a+o*s)/c,l=p*p-(a*a+s*s-i*i)/c;if(l<0&&l>-1e-6&&(l=0),l<0)return[];var u=mx(l),h=-p+u,d=-p-u,m={x:e.x-r*h,y:e.y-o*h};return 0===l?[m]:[m,{x:e.x-r*d,y:e.y-o*d}].filter(function(n){return function(e,t,n){return Ex(e.x,t.x,n.x)&&Ex(e.y,t.y,n.y)}(n,e,t)})}function Ex(e,t,n){return e>=fx(t,n)-_x&&e<=yx(t,n)+_x}dx.getAttachment=function(e,t){var n,i,r,o,a,s,c,p,l,u,h,d,m=0;for(m=0;m<t.length-1;m++){if(wx(n=t[m],i=t[m+1])?s=[n]:(r=bx(e,n),o=bx(e,i),s=xx(n,i,e,fx(r,o))),s.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===s.length&&(c={type:"bendpoint",position:s[0],segmentIndex:m,bendpointIndex:wx(n,s[0])?m:m+1}),2===s.length&&(h=s[0],d=s[1],c={type:"segment",position:a={x:(h.x+d.x)/2,y:(h.y+d.y)/2},segmentIndex:m,relativeLocation:bx(n,a)/bx(n,i)}),p=bx(c.position,e),(!u||l>p)&&(u=c,l=p)}return u};var _x=.1;function wx(e,t){return vx(e.x-t.x)<=_x&&vx(e.y-t.y)<=_x}var Sx={},Tx=ux.getDistancePointPoint,Cx=ux.rotateVector,Ax=ux.getAngle,Rx=dx.getAttachment,Px=Ps.roundPoint;function Mx(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c,p=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex;if(0===o)return r;if(r>=l&&(c=p?r+1:r-1),r<l)if(c=r,p&&"bendpoint"!==n.type&&l-1===r)kx(t,l)<n.relativeLocation&&c++;return c}return 0===o?r:i.connectionStart?0===r?0:null:i.connectionEnd&&r===e.length-2?t.length-2:null}function kx(e,t){var n=Tx(e[t-1],e[t]);return n/(n+Tx(e[t],e[t+1]))}function Bx(e,t){return[e[t],e[t+1]]}Sx.getLabelAdjustment=function(e,t,n,i){var r=0,o=0,a=function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}(e),s=Rx(a,n),c=s.segmentIndex,p=Mx(n,t,s,i);if(null===p)return{x:r,y:o};if(p<0||p>t.length-2)return{x:r,y:o};var l,u,h,d,m,f,y=Bx(n,c),v=Bx(t,p),g=s.position,b=(d=g,m=Tx((h=y)[0],h[1]),f=Tx(h[0],d),0===m?0:f/m),x=(l=v,u=Ax(y),Ax(l)-u);if("bendpoint"===s.type){var E=t.length-n.length,_=s.bendpointIndex,w=n[_];if(-1!==t.indexOf(w))return{x:r,y:o};if(0===E){var S=t[_];return{x:S.x-s.position.x,y:S.y-s.position.y}}E<0&&0!==_&&_<n.length-1&&(b=kx(n,_))}var T=(v[1].x-v[0].x)*b+v[0].x,C=(v[1].y-v[0].y)*b+v[0].y,A=Cx({x:a.x-g.x,y:a.y-g.y},x);return r=T+A.x-a.x,o=C+A.y-a.y,Px({x:r,y:o})};var Nx=s.assign,Dx=d.is,Ox=d.getBusinessObject,Lx=Be.hasExternalLabel,Ix=Be.getExternalLabelMid,jx=Sx.getLabelAdjustment,zx={width:90,height:20};function Fx(e,t,n){gc.call(this,e);var i=new G;this.postExecute(["shape.create","connection.create"],function(e){var n=e.context,r=n.shape||n.connection,o=r.businessObject;if(Lx(r)){var a=Ix(r),s=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:Gx});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(zx,o.name||"",i);t.createLabel(r,a,{id:o.id+"_label",hidden:!o.name,businessObject:o,width:s.width,height:s.height})}}),this.executed(["label.create"],function(e){var t,i=e.context.shape;i.labelTarget&&Dx(i.labelTarget||i,"bpmn:BaseElement")&&((t=i.businessObject.di).label||(t.label=n.create("bpmndi:BPMNLabel",{bounds:n.create("dc:Bounds")})),Nx(t.label.bounds,{x:i.x,y:i.y,width:i.width,height:i.height}))}),this.postExecute(["connection.layout","connection.reconnectEnd","connection.reconnectStart","connection.updateWaypoints"],function(e){var n,i=e.context.connection.label;i&&(n=i.hidden?function(e){var t=e.context.connection,n=t.label,i=Ix(t);return{x:i.x-n.x-n.width/2,y:i.y-n.y-n.height/2}}(e):function(e){var t=e.command,n=e.context,i=n.connection,r=i.label,o=Nx({},n.hints),a=n.newWaypoints||i.waypoints,s=n.oldWaypoints;return void 0===o.startChanged&&(o.startChanged="connection.reconnectStart"===t),void 0===o.endChanged&&(o.endChanged="connection.reconnectEnd"===t),jx(r,a,s,o)}(e),t.moveShape(i,n))}),this.postExecute(["shape.replace"],function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=Ox(n);r&&Lx(r)&&(n.label.x=i.label.x,n.label.y=i.label.y)})}U(Fx,gc),Fx.$inject=["eventBus","modeling","bpmnFactory"];var $x=Fx,Gx={fontFamily:"Arial, sans-serif",fontSize:"11px"};var Wx=d.is,Hx="flow elements must be children of pools/participants",Vx="participants cannot be pasted onto a non-empty process diagram";function qx(e,t,n){function i(e,n,i){t.add({position:{x:e.x+5,y:e.y+5},type:"error",timeout:i||2e3,html:"<div>"+n+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(e){var t=e.context,r=t.shape,o=t.target;Wx(o,"bpmn:Collaboration")&&Wx(r,"bpmn:FlowNode")&&i(e,n(Hx))}),e.on(["elements.paste.rejected"],function(e){var t=e.context,r=t.position,o=t.target;Wx(o,"bpmn:Collaboration")&&i(r,n(Hx)),Wx(o,"bpmn:Process")&&i(r,n(Vx),3e3)})}qx.$inject=["eventBus","tooltips","translate"];var Ux=qx;function Yx(e,t,n){gc.call(this,e),this.preExecute("shape.delete",function(e){var i,r,o,a=e.context.shape;if(1==a.incoming.length&&1==a.outgoing.length){var s=a.incoming[0],c=a.outgoing[0];if(t.canConnect(s.source,c.target,s)){var p=(i=s.waypoints,r=c.waypoints,(o=ax(Xx(i[i.length-2]),Xx(i[i.length-1]),Xx(r[1]),Xx(r[0])))?[].concat(i.slice(0,i.length-1),[o],r.slice(1)):[Xx(i[0]),Xx(r[r.length-1])]);n.reconnectEnd(s,c.target,p)}}})}U(Yx,gc),Yx.$inject=["eventBus","bpmnRules","modeling"];var Kx=Yx;function Xx(e){return e.original||e}var Zx=d.is;function Qx(e,t){gc.call(this,e),this.preExecute("shape.delete",function(e){var t=e.shape,n=t.parent;Zx(t,"bpmn:Participant")&&(e.collaborationRoot=n)},!0),this.postExecute("shape.delete",function(e){var n=e.collaborationRoot;n&&!n.businessObject.participants.length&&t.makeProcess()},!0)}Qx.$inject=["eventBus","modeling"],U(Qx,gc);var Jx=Qx,eE=s.forEach,tE=s.find,nE=s.matchPattern,iE=d.is;function rE(e,t,n){function i(e){var i,r,o=e.source,a=e.target;e.parent&&(iE(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,a)||(r=!0),n.canConnectMessageFlow(o,a)&&(i="bpmn:MessageFlow")),iE(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,a)||(r=!0),n.canConnectSequenceFlow(o,a)&&(i="bpmn:SequenceFlow")),iE(e,"bpmn:Association")&&!n.canConnectAssociation(o,a)&&(r=!0),r&&t.removeConnection(e),i&&t.connect(o,a,{type:i,waypoints:e.waypoints.slice()}))}gc.call(this,e),this.postExecuted("elements.move",function(e){var t=e.closure.allConnections;eE(t,i)},!0),this.postExecuted(["connection.reconnectStart","connection.reconnectEnd"],function(e){i(e.context.connection)}),this.postExecuted("element.updateProperties",function(e){var n,i=e.context,r=i.properties,o=i.element,a=o.businessObject;r.default&&(n=tE(o.outgoing,nE({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),r.conditionExpression&&a.sourceRef.default===a&&t.updateProperties(o.source,{default:void 0})})}U(rE,gc),rE.$inject=["eventBus","modeling","bpmnRules"];var oE=rE,aE=s.forEach,sE=f.isEventSubProcess,cE=d.is;function pE(e,t,n,i,r,o){gc.call(this,e),this._bpmnReplace=t,this._elementRegistry=i,this._selection=r,this._modeling=o,this.postExecuted(["elements.move"],500,function(e){var t=e.context,i=t.newParent,r=t.newHost,o=[];aE(t.closure.topLevel,function(e){o=sE(e)?o.concat(e.children):o.concat(e)}),1===o.length&&r&&(i=r);var a=n.canReplace(o,i);a&&this.replaceElements(o,a.replacements,r)},this),this.postExecute(["shape.replace"],1500,function(e){var t,i=e.context,r=i.oldShape,o=i.newShape,a=r.attachers;a&&a.length&&(t=n.canReplace(a,o),this.replaceElements(a,t.replacements))},this),this.postExecuted(["shape.replace"],1500,function(e){var t=e.context,n=t.oldShape,i=t.newShape;o.unclaimId(n.businessObject.id,n.businessObject),o.updateProperties(i,{id:n.id})})}U(pE,gc),pE.prototype.replaceElements=function(e,t,n){var i=this._elementRegistry,r=this._bpmnReplace,o=this._selection,a=this._modeling;aE(t,function(t){var o={type:t.newElementType},s=i.get(t.oldElementId);n&&cE(s,"bpmn:BoundaryEvent")&&a.updateAttachment(s,null);var c=e.indexOf(s);e[c]=r.replaceElement(s,o,{select:!1}),n&&cE(e[c],"bpmn:BoundaryEvent")&&a.updateAttachment(e[c],n)}),t&&o.select(e)},pE.$inject=["eventBus","bpmnReplace","bpmnRules","elementRegistry","selection","modeling"];var lE=pE,uE=d.is,hE=Ps.roundBounds,dE=_o.hasPrimaryModifier,mE=1001;function fE(e,t){e.on("resize.start",mE+500,function(e){var t=e.context,n=t.shape;(uE(n,"bpmn:Lane")||uE(n,"bpmn:Participant"))&&(t.balanced=!dE(e))}),e.on("resize.end",mE,function(e){var n=e.context,i=n.shape,r=n.canExecute,o=n.newBounds;if(uE(i,"bpmn:Lane")||uE(i,"bpmn:Participant"))return r&&(o=hE(o),t.resizeLane(i,o,n.balanced)),!1})}fE.$inject=["eventBus","modeling"];var yE=fE,vE=d.getBusinessObject,gE=d.is,bE=$c.computeChildrenBBox,xE=500;function EE(e,t,n,i){gc.call(this,e),this.executed(["shape.toggleCollapse"],xE,function(e){var t,n=e.context.shape;gE(n,"bpmn:SubProcess")&&(n.collapsed?vE(n).di.isExpanded=!1:((t=n.children).length&&t.forEach(function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)}),vE(n).di.isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],xE,function(e){var t=e.context.shape;t.collapsed?vE(t).di.isExpanded=!1:vE(t).di.isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],xE,function(e){var i,r=e.context.shape,o=t._getDefaultSize(r);i=r.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(r,o):function(e,t){var n,i,r,o=e.children,a=t;return n=(r=o,r.filter(function(e){return!e.hidden})).concat([e]),(i=bE(n))?(a.width=Math.max(i.width,a.width),a.height=Math.max(i.height,a.height),a.x=i.x+(i.width-a.width)/2,a.y=i.y+(i.height-a.height)/2):(a.x=e.x+(e.width-a.width)/2,a.y=e.y+(e.height-a.height)/2),a}(r,o),n.resizeShape(r,i)})}U(EE,gc),EE.$inject=["eventBus","elementFactory","modeling"];var _E=EE;var wE=s.forEach;function SE(e,t){gc.call(this,e),this.preExecute("elements.delete",function(e){var n=e.context.elements;wE(n,function(e){t.unclaimId(e.businessObject.id,e.businessObject)})})}U(SE,gc),SE.$inject=["eventBus","modeling"];var TE=SE,CE=d.is,AE=d.getBusinessObject;function RE(e,t){gc.call(this,e),this.preExecute("connection.delete",function(e){var n=e.context.connection,i=n.source;(function(e,t){if(!CE(e,"bpmn:SequenceFlow"))return!1;var n=AE(t),i=AE(e);return n.get("default")===i})(n,i)&&t.updateProperties(i,{default:null})})}U(RE,gc),RE.$inject=["eventBus","modeling"];var PE=RE;var ME=d.is,kE=500,BE=5e3;function NE(e,t,n){var i;function r(){if(!i)throw new Error(n("out of bounds release"));return i}gc.call(this,e);var o=["spaceTool","lane.add","lane.resize","lane.split","elements.move","elements.delete","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(o,BE,function(e){(i=i||new function(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}).enter()}),this.postExecuted(o,kE,function(e){!function(){if(!i)throw new Error(n("out of bounds release"));var e=i.leave();e&&(t.updateLaneRefs(i.flowNodes,i.lanes),i=null)}()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(e){var t=e.context.shape,n=r();t.labelTarget||(ME(t,"bpmn:Lane")&&n.addLane(t),ME(t,"bpmn:FlowNode")&&n.addFlowNode(t))})}NE.$inject=["eventBus","modeling","translate"],U(NE,gc);var DE={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","copyPasteBehavior","createBoundaryEventBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","deleteLaneBehavior","dropOnFlowBehavior","importDockingFix","labelBehavior","modelingFeedback","removeElementBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeLaneBehavior","toggleElementCollapseBehaviour","unclaimIdBehavior","unsetDefaultFlowBehavior","updateFlowNodeRefsBehavior"],adaptiveLabelPositioningBehavior:["type",vb],appendBehavior:["type",_b],copyPasteBehavior:["type",Cb],createBoundaryEventBehavior:["type",Pb],createDataObjectBehavior:["type",Bb],createParticipantBehavior:["type",Ob],dataInputAssociationBehavior:["type",Fb],deleteLaneBehavior:["type",Ub],dropOnFlowBehavior:["type",ox],importDockingFix:["type",px],labelBehavior:["type",$x],modelingFeedback:["type",Ux],replaceConnectionBehavior:["type",oE],removeParticipantBehavior:["type",Jx],replaceElementBehaviour:["type",lE],resizeLaneBehavior:["type",yE],removeElementBehavior:["type",Kx],toggleElementCollapseBehaviour:["type",_E],unclaimIdBehavior:["type",TE],updateFlowNodeRefsBehavior:["type",NE],unsetDefaultFlowBehavior:["type",PE]};function OE(e){gc.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(e){var n=e.context,i=n.shape||n.connection,r=n.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)}),this.preExecute(["shape.move","connection.move"],function(e){var n=e.context,i=n.shape||n.connection,r=n.newParent||i.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)})}OE.prototype.getOrdering=function(e,t){return null},U(OE,gc);var LE=OE,IE=Js.isAny,jE=s.findIndex,zE=s.find;function FE(e,t){LE.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:3,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:Process"]}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(e){var t=e.order;return t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=zE(n,function(t){return IE(e,[t.type])});return t&&t.order||{level:1}}(e)),t}this.getOrdering=function(e,n){var r=i(e);r.containers&&(n=function(e,n,i){for(var r=n;r&&!IE(r,i);)r=r.parent;if(!r)throw new Error(t("no parent for {element} in {parent}",{element:e.id,parent:n.id}));return r}(e,n,r.containers));var o=n.children.indexOf(e),a=jE(n.children,function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level});return-1!==a&&-1!==o&&o<a&&(a-=1),{index:a,parent:n}}}FE.$inject=["eventBus","translate"],U(FE,LE);var $E={__init__:["bpmnOrderingProvider"],__depends__:[Qe],bpmnOrderingProvider:["type",FE]},GE={},WE=Ps.getOrientation;GE.getBoundaryAttachment=function(e,t){var n=WE(e,t,-15);return"intersect"!==n?n:null};var HE=d.is,VE=Ps.asTRBL,qE=ep.collectLanes,UE=ep.getLanesRoot,YE=Math.abs,KE=Math.min,XE=Math.max;function ZE(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function QE(e,t,n){return ZE(e,t,n,KE)}function JE(e,t,n){return ZE(e,t,n,XE)}var e_=60,t_=300,n_=20,i_=50,r_=20,o_=20;GE.getParticipantSizeConstraints=function(e,t,n){var i=UE(e),r=!0,o=!0,a=qE(i,[i]),s=VE(e),c={},p={};return/e/.test(t)?p.right=s.left+t_:/w/.test(t)&&(p.left=s.right-t_),a.forEach(function(e){var i=VE(e);/n/.test(t)&&(i.top<s.top-10&&(r=!1),n&&YE(s.top-i.bottom)<10&&JE(c,"top",i.top+e_),YE(s.top-i.top)<5&&QE(p,"top",i.bottom-e_)),/s/.test(t)&&(i.bottom>s.bottom+10&&(o=!1),n&&YE(s.bottom-i.top)<10&&QE(c,"bottom",i.bottom-e_),YE(s.bottom-i.bottom)<5&&JE(p,"bottom",i.top+e_))}),i.children.filter(function(e){return!e.hidden&&!e.waypoints&&(HE(e,"bpmn:FlowElement")||HE(e,"bpmn:Artifact"))}).forEach(function(e){var n=VE(e);r&&/n/.test(t)&&QE(p,"top",n.top-r_),/e/.test(t)&&JE(p,"right",n.right+n_),o&&/s/.test(t)&&JE(p,"bottom",n.bottom+o_),/w/.test(t)&&QE(p,"left",n.left-i_)}),{min:p,max:c}};var a_=s.find,s_=s.some,c_=s.every,p_=s.filter,l_=s.forEach,u_=d.is,h_=Js.isAny,d_=d.getBusinessObject,m_=f.isExpanded,f_=f.isEventSubProcess,y_=f.isInterrupting,v_=f.hasErrorEventDefinition,g_=f.hasEscalationEventDefinition,b_=f.hasCompensateEventDefinition,x_=GE.getBoundaryAttachment;function E_(e){Nc.call(this,e)}U(E_,Nc),E_.$inject=["eventBus"];var __=E_;function w_(e){return!e||B_(e)}function S_(e,t){return e===t}function T_(e){do{if(u_(e,"bpmn:Process"))return d_(e);if(u_(e,"bpmn:Participant"))return d_(e).processRef}while(e=e.parent)}function C_(e){return u_(e,"bpmn:TextAnnotation")}function A_(e){return u_(e,"bpmn:BoundaryEvent")&&M_(e,"bpmn:CompensateEventDefinition")}function R_(e){return d_(e).isForCompensation}function P_(e){for(var t=e;t=t.parent;){if(u_(t,"bpmn:FlowElementsContainer"))return d_(t);if(u_(t,"bpmn:Participant"))return d_(t).processRef}return null}function M_(e,t){var n=d_(e);return!!a_(n.eventDefinitions||[],function(e){return u_(e,t)})}function k_(e,t){return(d_(e).eventDefinitions||[]).every(function(e){return u_(e,t)})}function B_(e){return e.labelTarget}function N_(e){return e.waypoints}function D_(e,t){return-1!==function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t).indexOf(e)}function O_(e,t,n){if(w_(e)||w_(t))return null;if(S_(e,t))return!1;if(!u_(n,"bpmn:DataAssociation")){if(V_(e,t))return{type:"bpmn:MessageFlow"};if(q_(e,t))return{type:"bpmn:SequenceFlow"}}var i=U_(e,t);return i||(A_(e)&&R_(t)?{type:"bpmn:Association",associationDirection:"One"}:!!H_(e,t)&&{type:"bpmn:Association"})}function L_(e,t,n){return!(!B_(e)||N_(t))||!(u_(t,"bpmn:Participant")&&!m_(t))&&(u_(e,"bpmn:Participant")?u_(t,"bpmn:Process")||u_(t,"bpmn:Collaboration"):u_(e,"bpmn:Lane")?u_(t,"bpmn:Participant")||u_(t,"bpmn:Lane"):!u_(e,"bpmn:BoundaryEvent")&&(u_(e,"bpmn:FlowElement")?u_(t,"bpmn:FlowElementsContainer")?m_(t):h_(t,["bpmn:Participant","bpmn:Lane"]):h_(e,["bpmn:Artifact","bpmn:DataAssociation"])?h_(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!u_(e,"bpmn:MessageFlow")&&(u_(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function I_(e){return!B_(e)&&u_(e,"bpmn:BoundaryEvent")}function j_(e){return u_(e,"bpmn:Lane")}function z_(e,t,n,i){if(Array.isArray(e)||(e=[e]),n)return!1;if(1!==e.length)return!1;var r=e[0];return!B_(r)&&(!!function(e){return I_(e)||u_(e,"bpmn:IntermediateThrowEvent")&&!e.parent}(r)&&(!t||!f_(t)&&(!(!u_(t,"bpmn:Activity")||R_(t))&&(!(i&&!x_(i,t))&&"attach"))))}function F_(e,t,n){if(!t)return!1;var i={replacements:[]};return l_(e,function(e){f_(t)||u_(e,"bpmn:StartEvent")&&"label"!==e.type&&L_(e,t)&&(y_(e)||i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(v_(e)||g_(e)||b_(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),u_(t,"bpmn:Transaction")||M_(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(u_(e,"bpmn:EndEvent")&&L_(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),u_(e,"bpmn:BoundaryEvent")&&z_(e,t,null,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))}),!!i.replacements.length&&i}function $_(e,t){return!s_(e,I_)&&(!s_(e,j_)&&(!t||e.every(function(e){return L_(e,t)})))}function G_(e,t,n,i){return!!t&&(B_(t)?null:!S_(n,t)&&((!n||!D_(n,t))&&(L_(e,t)||Y_(e,t,i))))}function W_(e,t){return u_(e,"bpmn:SubProcess")?m_(e)&&(!t||t.width>=100&&t.height>=80):u_(e,"bpmn:Lane")?!t||t.width>=130&&t.height>=60:u_(e,"bpmn:Participant")?!t||t.width>=250&&t.height>=50:!!C_(e)}function H_(e,t){return!N_(e)&&!N_(t)&&(!(!A_(e)||!R_(t))||!D_(t,e)&&!D_(e,t)&&function(e,t){var n=C_(e),i=C_(t);return(n||i)&&n!==i}(e,t))}function V_(e,t){return u_(i=e,"bpmn:InteractionNode")&&(!u_(i,"bpmn:Event")||u_(i,"bpmn:ThrowEvent")&&k_(i,"bpmn:MessageEventDefinition"))&&function(e){return u_(e,"bpmn:InteractionNode")&&!R_(e)&&(!u_(e,"bpmn:Event")||u_(e,"bpmn:CatchEvent")&&k_(e,"bpmn:MessageEventDefinition"))}(t)&&(n=t,!(T_(e)===T_(n)));var n,i}function q_(e,t){return u_(o=e,"bpmn:FlowNode")&&!u_(o,"bpmn:EndEvent")&&!f_(o)&&!(u_(o,"bpmn:IntermediateThrowEvent")&&M_(o,"bpmn:LinkEventDefinition"))&&!A_(o)&&!R_(o)&&function(e){return u_(e,"bpmn:FlowNode")&&!u_(e,"bpmn:StartEvent")&&!u_(e,"bpmn:BoundaryEvent")&&!f_(e)&&!(u_(e,"bpmn:IntermediateCatchEvent")&&M_(e,"bpmn:LinkEventDefinition"))&&!R_(e)}(t)&&(n=t,i=P_(e),r=P_(n),i&&i===r)&&!(u_(e,"bpmn:EventBasedGateway")&&!function(e){return u_(e,"bpmn:ReceiveTask")||u_(e,"bpmn:IntermediateCatchEvent")&&(M_(e,"bpmn:MessageEventDefinition")||M_(e,"bpmn:TimerEventDefinition")||M_(e,"bpmn:ConditionalEventDefinition")||M_(e,"bpmn:SignalEventDefinition"))}(t));var n,i,r,o}function U_(e,t){return h_(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&h_(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!h_(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!h_(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function Y_(e,t,n){if(Array.isArray(e)){if(1!==e.length)return!1;e=e[0]}return h_(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!B_(t)&&u_(e,"bpmn:FlowNode")&&!u_(e,"bpmn:BoundaryEvent")&&L_(e,t.parent)}function K_(e,t){return e&&t&&-1!==e.indexOf(t)}function X_(e,t){return!(u_(t,"bpmn:Lane")&&!K_(e,t.parent))&&!(u_(t,"bpmn:BoundaryEvent")&&!K_(e,t.host))}E_.prototype.init=function(){this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent;if(i.targetAttach)return!1;r&&(n.parent=r);try{return O_(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnectStart",function(e){var t=e.connection;return O_(e.hover||e.source,t.target,t)}),this.addRule("connection.reconnectEnd",function(e){var t=e.connection;return O_(t.source,e.hover||e.target,t)}),this.addRule("connection.updateWaypoints",function(e){return null}),this.addRule("shape.resize",function(e){return W_(e.shape,e.newBounds)}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position;return z_(n,t,null,i)||F_(n,t,i)||$_(n,t)||Y_(n,t,i)}),this.addRule("shape.create",function(e){return G_(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return z_(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){return X_(e.collection,e.element)}),this.addRule("element.paste",function(e){var t=e.parent,n=e.element,i=e.position,r=e.source,o=e.target;return r||o?O_(r,o):z_([n],t,null,i)||G_(n,t,null,i)}),this.addRule("elements.paste",function(e){return function(e,t){var n=e[0];if(u_(t,"bpmn:Collaboration"))return c_(n,function(e){return"bpmn:Participant"===e.type});if(u_(t,"bpmn:Process"))return!(s_(n,function(e){return"bpmn:Participant"===e.type})&&t.children.length>0);if(u_(t,"bpmn:Participant")&&!m_(t))return!1;if(u_(t,"bpmn:FlowElementsContainer"))return m_(t);return h_(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"])}(e.tree,e.target)}),this.addRule(["elements.delete"],function(e){return p_(e.elements,function(e){return!B_(e)})})},E_.prototype.canConnectMessageFlow=V_,E_.prototype.canConnectSequenceFlow=q_,E_.prototype.canConnectDataAssociation=U_,E_.prototype.canConnectAssociation=H_,E_.prototype.canMove=$_,E_.prototype.canAttach=z_,E_.prototype.canReplace=F_,E_.prototype.canDrop=L_,E_.prototype.canInsert=Y_,E_.prototype.canCreate=G_,E_.prototype.canConnect=O_,E_.prototype.canResize=W_,E_.prototype.canCopy=X_;var Z_={__depends__:[cu],__init__:["bpmnRules"],bpmnRules:["type",__]},Q_=s.uniqueBy,J_=s.isArray;function ew(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[]},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}ew.$inject=["eventBus","injector"];var tw=ew;ew.prototype.execute=function(e,t){if(!e)throw new Error("command required");var n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction(n)},ew.prototype.canExecute=function(e,t){var n={command:e,context:t},i=this._getHandler(e),r=this._fire(e,"canExecute",n);if(void 0===r){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},ew.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed")},ew.prototype.undo=function(){var e,t=this._getUndoAction();if(t){for(this._pushAction(t);t&&(this._internalUndo(t),(e=this._getUndoAction())&&e.id===t.id);)t=e;this._popAction()}},ew.prototype.redo=function(){var e,t=this._getRedoAction();if(t){for(this._pushAction(t);t&&(this._internalExecute(t,!0),(e=this._getRedoAction())&&e.id===t.id);)t=e;this._popAction()}},ew.prototype.register=function(e,t){this._setHandler(e,t)},ew.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");var n=this._injector.instantiate(t);this.register(e,n)},ew.prototype.canUndo=function(){return!!this._getUndoAction()},ew.prototype.canRedo=function(){return!!this._getRedoAction()},ew.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},ew.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},ew.prototype._internalUndo=function(e){var t=this,n=e.command,i=e.context,r=this._getHandler(n);this._atomicDo(function(){t._fire(n,"revert",e),r.revert&&t._markDirty(r.revert(i)),t._revertedAction(e),t._fire(n,"reverted",e)})},ew.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);var i,r,o,a=t?[e+"."+t,t]:[e];for(n=this._eventBus.createEvent(n),i=0;(r=a[i])&&(o=this._eventBus.fire("commandStack."+r,n),!n.cancelBubble);i++);return o},ew.prototype._createId=function(){return this._uid++},ew.prototype._atomicDo=function(e){var t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},ew.prototype._internalExecute=function(e,t){var n=this,i=e.command,r=e.context,o=this._getHandler(i);if(!o)throw new Error("no command handler registered for <"+i+">");this._pushAction(e),t||(this._fire(i,"preExecute",e),o.preExecute&&o.preExecute(r),this._fire(i,"preExecuted",e)),this._atomicDo(function(){n._fire(i,"execute",e),o.execute&&n._markDirty(o.execute(r)),n._executedAction(e,t),n._fire(i,"executed",e)}),t||(this._fire(i,"postExecute",e),o.postExecute&&o.postExecute(r),this._fire(i,"postExecuted",e)),this._popAction(e)},ew.prototype._pushAction=function(e){var t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},ew.prototype._popAction=function(){var e=this._currentExecution,t=e.actions,n=e.dirty;t.pop(),t.length||(this._eventBus.fire("elements.changed",{elements:Q_("id",n)}),n.length=0,this._fire("changed"))},ew.prototype._markDirty=function(e){var t=this._currentExecution;e&&(e=J_(e)?e:[e],t.dirty=t.dirty.concat(e))},ew.prototype._executedAction=function(e,t){var n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},ew.prototype._revertedAction=function(e){this._stackIdx--},ew.prototype._getHandler=function(e){return this._handlerMap[e]},ew.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};var nw={commandStack:["type",tw]},iw=s.flatten,rw=s.filter,ow=s.forEach,aw=s.groupBy,sw=s.map,cw=s.unionBy,pw=Vv.saveClear,lw=ag.getNewAttachShapeDelta,uw=251,hw=1401;function dw(e,t,n,i){gc.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",hw,function(e){var t,n,i=e.context,r=i.shapes,o=i.validatedShapes;i.shapes=(n=mw(t=r),cw("id",t,n)),i.validatedShapes=function(e){var t=aw(e,"id");return rw(e,function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0})}(o)}),r&&t.on("shape.move.start",uw,function(e){var t=e.context,n=mw(t.shapes);ow(n,function(e){r.makeDraggable(t,e,!0),e.label&&r.makeDraggable(t,e.label,!0)})}),this.postExecuted("elements.move",function(e){var t=e.context,n=t.delta,r=t.newParent,o=t.closure.enclosedElements,a=mw(o);ow(a,function(e){o[e.id]||(i.moveShape(e,n,r),e.label&&i.moveShape(e.label,n,r))})}),this.postExecuted("elements.move",function(e){var t,n=e.context,r=n.shapes,o=n.newHost;r.length>1||(t=o?r:rw(r,function(e){return!!e.host}),ow(t,function(e){i.updateAttachment(e,o)}))}),this.postExecuted("elements.move",function(e){var t=e.context.shapes;ow(t,function(e){ow(e.attachers,function(e){ow(e.outgoing.slice(),function(e){n.allowed("connection.reconnectStart",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)}),ow(e.incoming.slice(),function(e){n.allowed("connection.reconnectEnd",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})})})}),this.postExecute("shape.create",function(e){var t=e.context,n=t.shape,r=t.host;r&&i.updateAttachment(n,r)}),this.postExecute("shape.replace",function(e){var t=e.context,r=t.oldShape,o=t.newShape;pw(r.attachers,function(e){"attach"===n.allowed("elements.move",{target:o,shapes:[e]})?i.updateAttachment(e,o):i.removeShape(e)}),o.attachers.length&&ow(o.attachers,function(e){var t=lw(e,r,o);i.moveShape(e,t,e.parent)})}),this.postExecute("shape.resize",function(e){var t=e.context,n=t.shape,r=t.oldBounds,o=t.newBounds,a=n.attachers;a.length&&ow(a,function(e){var t=lw(e,r,o);i.moveShape(e,t,e.parent),e.label&&i.moveShape(e.label,t,e.label.parent)})}),this.preExecute("shape.delete",function(e){var t=e.context.shape;pw(t.attachers,function(e){i.removeShape(e)}),t.host&&i.updateAttachment(t,null)}),t.on("spaceTool.move",function(e){var t=e.context,n=t.initialized,i=t.attachSupportInitialized;if(n&&!i){var r=t.movingShapes,o=rw(r,function(e){var t=e.host;return t&&-1===r.indexOf(t)});ow(o,function(e){li.remove(r,e),e.label&&li.remove(r,e.label)}),t.attachSupportInitialized=!0}})}function mw(e){return iw(sw(e,function(e){return e.attachers||[]}))}U(dw,gc),dw.$inject=["injector","eventBus","rules","modeling"];var fw={__depends__:[cu],__init__:["attachSupport"],attachSupport:["type",dw]},yw=s.forEach,vw=s.filter,gw=s.map,bw=250,xw=1400,Ew=Ps.getMid;function _w(e,t,n){gc.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",xw,function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=ww(n),t.validatedShapes=ww(i)}),i&&t.on("shape.move.start",bw,function(e){var t=e.context,n=t.shapes,r=[];yw(n,function(e){var n=e.label;n&&!n.hidden&&-1===t.shapes.indexOf(n)&&r.push(n),e.labelTarget&&r.push(e)}),yw(r,function(e){i.makeDraggable(t,e,!0)})}),this.postExecute("elements.move",xw,function(e){var t=e.context,n=t.closure.enclosedElements;t.enclosedLabels=gw(n,function(e){var t=e.label;return t&&!n[t.id]?[t,Ew(t)]:null}).filter(function(e){return e})}),this.postExecuted("elements.move",function(e){var t=e.context,i=t.enclosedLabels,r=t.delta;yw(i,function(e){var t=e[0],i=e[1],o=Ew(t);o.x===i.x&&o.y===i.y&&n.moveShape(t,r,t.labelTarget.parent)})})}function ww(e){return vw(e,function(t){return-1===e.indexOf(t.labelTarget)})}U(_w,gc),_w.$inject=["injector","eventBus","modeling"];var Sw={__init__:["labelSupport"],labelSupport:["type",_w]},Tw=s.isString,Cw=s.assign,Aw=s.forEach,Rw=Y.domify,Pw=Y.attr,Mw=Y.classes,kw=Y.remove,Bw=Y.delegate,Nw=new Yr("tt");function Dw(e,t){e.style.display=!1===t?"none":""}var Ow=".djs-tooltip";function Lw(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=Nw,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),i=Rw('<div class="djs-tooltip-container" style="position: absolute; width: 0; height: 0;" />'),n.insertBefore(i,n.firstChild),i);var r=this;Bw.bind(this._tooltipRoot,Ow,"mousedown",function(e){e.stopPropagation()}),Bw.bind(this._tooltipRoot,Ow,"mouseover",function(e){r.trigger("mouseover",e)}),Bw.bind(this._tooltipRoot,Ow,"mouseout",function(e){r.trigger("mouseout",e)}),this._init()}Lw.$inject=["eventBus","canvas"];var Iw=Lw;Lw.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=Cw({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Lw.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Pw(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Lw.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},Lw.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Lw.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},Lw.prototype.remove=function(e){var t=this.get(e);t&&(kw(t.html),kw(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Lw.prototype.show=function(){Dw(this._tooltipRoot)},Lw.prototype.hide=function(){Dw(this._tooltipRoot,!1)},Lw.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},Lw.prototype._addTooltip=function(e){var t,n=e.id,i=e.html,r=this._tooltipRoot;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),Tw(i)&&(i=Rw(i)),(t=Rw('<div data-tooltip-id="'+n+'" class="djs-tooltip" style="position: absolute">')).appendChild(i),e.type&&Mw(t).add("djs-tooltip-"+e.type),e.className&&Mw(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},Lw.prototype._updateTooltip=function(e){var t,n,i,r=e.position,o=e.htmlContainer;t=o,n=r.x,i=r.y,Cw(t.style,{left:n+"px",top:i+"px"})},Lw.prototype._updateTooltipVisibilty=function(e){Aw(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Dw(i,r))})},Lw.prototype._init=function(){var e=this;this._eventBus.on("canvas.viewbox.changing",function(t){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(t){var n;n=t.viewbox,e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()})};var jw={__init__:["tooltips"],tooltips:["type",Iw]},zw=s.assign,Fw=Ps.getElementLineIntersection;function $w(e){return zw({original:e.point.original||e.point},e.actual)}function Gw(e,t){this._elementRegistry=e,this._graphicsFactory=t}Gw.$inject=["elementRegistry","graphicsFactory"];var Ww=Gw;Gw.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift($w(i)),o.push($w(r)),o},Gw.prototype.getDockingPoint=function(e,t,n){var i,r,o=e.waypoints;return{point:r=o[i=n?0:o.length-1],actual:this._getIntersection(t,e,n)||r,idx:i}},Gw.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Fw(i,r,n)},Gw.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Gw.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Gw.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Hw={__init__:["modeling","bpmnUpdater"],__depends__:[DE,Z_,$E,pl,nw,jw,Sw,fw,aa,Km,gm],bpmnFactory:["type",Pf],bpmnUpdater:["type",dy],elementFactory:["type",xy],modeling:["type",lb],layouter:["type",ry],connectionDocking:["type",Ww]},Vw=s.assign;function qw(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}var Uw=qw;qw.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],qw.prototype.getPaletteEntries=function(e){var t={},n=this._create,i=this._elementFactory,r=this._spaceTool,o=this._lassoTool,a=this._handTool,s=this._globalConnect,c=this._translate;function p(e,t,r,o,a){function s(t){var r=i.createShape(Vw({type:e},a));a&&(r.businessObject.di.isExpanded=a.isExpanded),n.start(t,r)}var p=e.replace(/^bpmn:/,"");return{group:t,className:r,title:o||c("Create {type}",{type:p}),action:{dragstart:s,click:s}}}function l(e,t){n.start(e,i.createParticipantShape(t))}return Vw(t,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:c("Activate the hand tool"),action:{click:function(e){a.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:c("Activate the lasso tool"),action:{click:function(e){o.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:c("Activate the create/remove space tool"),action:{click:function(e){r.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:c("Activate the global connect tool"),action:{click:function(e){s.toggle(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":p("bpmn:StartEvent","event","bpmn-icon-start-event-none"),"create.intermediate-event":p("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",c("Create Intermediate/Boundary Event")),"create.end-event":p("bpmn:EndEvent","event","bpmn-icon-end-event-none"),"create.exclusive-gateway":p("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",c("Create Gateway")),"create.task":p("bpmn:Task","activity","bpmn-icon-task"),"create.data-object":p("bpmn:DataObjectReference","data-object","bpmn-icon-data-object"),"create.data-store":p("bpmn:DataStoreReference","data-store","bpmn-icon-data-store"),"create.subprocess-expanded":p("bpmn:SubProcess","activity","bpmn-icon-subprocess-expanded",c("Create expanded SubProcess"),{isExpanded:!0}),"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:c("Create Pool/Participant"),action:{dragstart:l,click:l}}}),t};var Yw=s.isFunction,Kw=s.isArray,Xw=s.forEach,Zw=Y.domify,Qw=Y.query,Jw=Y.attr,eS=Y.clear,tS=Y.classes,nS=Y.matches,iS=Y.delegate,rS=Y.event;function oS(e,t){this._eventBus=e,this._canvas=t,this._providers=[];var n=this;e.on("tool-manager.update",function(e){var t=e.tool;n.updateToolHighlight(t)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._providers.length&&(n._init(),n._update())})}oS.$inject=["eventBus","canvas"];var aS=oS;oS.prototype.registerProvider=function(e){this._providers.push(e),this._diagramInitialized&&(this._container||this._init(),this._update())},oS.prototype.getEntries=function(){var e={};return Xw(this._providers,function(t){var n=t.getPaletteEntries();Xw(n,function(t,n){e[n]=t})}),e},oS.prototype._init=function(){var e=this._canvas,t=this._eventBus,n=e.getContainer(),i=this._container=Zw(oS.HTML_MARKUP),r=this;n.appendChild(i),iS.bind(i,".djs-palette-toggle, .entry","click",function(e){var t=e.delegateTarget;if(nS(t,".djs-palette-toggle"))return r.toggle();r.trigger("click",e)}),rS.bind(i,"mousedown",function(e){e.stopPropagation()}),iS.bind(i,".entry","dragstart",function(e){r.trigger("dragstart",e)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},oS.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=tS(i);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle("two-column",t),"open"in e&&o.toggle("open",e.open),r.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},oS.prototype._update=function(){var e=Qw(".djs-palette-entries",this._container),t=this._entries=this.getEntries();eS(e),Xw(t,function(t,n){var i=t.group||"default",r=Qw("[data-group="+i+"]",e);r||(r=Zw('<div class="group" data-group="'+i+'"></div>'),e.appendChild(r));var o,a,s,c=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),p=Zw(c);r.appendChild(p),t.separator||(Jw(p,"data-action",n),t.title&&Jw(p,"title",t.title),t.className&&(o=p,a=t.className,s=tS(o),(Kw(a)?a:a.split(/\s+/g)).forEach(function(e){s.add(e)})),t.imageUrl&&p.appendChild(Zw('<img src="'+t.imageUrl+'">')))}),this.open()},oS.prototype.trigger=function(e,t,n){var i,r,o,a=this._entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();(i=a[Jw(s,"data-action")])&&(r=i.action,o=t.originalEvent||t,Yw(r)?"click"===e&&r(o,n):r[e]&&r[e](o,n),t.preventDefault())},oS.prototype._layoutChanged=function(){this._toggleState({})},oS.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},oS.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},oS.prototype.open=function(){this._toggleState({open:!0})},oS.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},oS.prototype.isActiveTool=function(e){return e&&this._activeTool===e},oS.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Qw(".djs-palette-entries",this._container),this._toolsContainer=Qw("[data-group=tools]",t)),n=this._toolsContainer,Xw(n.children,function(t){var n=t.getAttribute("data-action");if(n){var i=tS(t);n=n.replace("-tool",""),i.contains("entry")&&n===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}})},oS.prototype.isOpen=function(){return tS(this._container).has("open")},oS.prototype._getParentContainer=function(){return this._canvas.getContainer()},oS.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var sS={__depends__:[{__init__:["palette"],palette:["type",aS]},Du,gm,Fd,Pd,Qe,qh],__init__:["paletteProvider"],paletteProvider:["type",Uw]},cS=s.assign,pS=s.forEach,lS=Y.query,uS=n.attr,hS=250;function dS(e,t,n,i,r){gc.call(this,e),e.on("shape.move.move",hS,function(e){var o=e.context,a=o.canExecute;o.visualReplacements||(o.visualReplacements={}),a.replacements?function(e){var o=e.canExecute.replacements;pS(o,function(o){var a=o.oldElementId,s={type:o.newElementType};if(!e.visualReplacements[a]){var c=t.get(a);cS(s,{x:c.x,y:c.y});var p=n.createShape(s);i.addShape(p,c.parent);var l=lS("[data-element-id="+c.id+"]",e.dragGroup);l&&uS(l,{display:"none"});var u=r.addDragger(p,e.dragGroup);e.visualReplacements[a]=u,i.removeShape(p)}})}(o):function(e){var t=e.visualReplacements;pS(t,function(n,i){var r=lS("[data-element-id="+i+"]",e.dragGroup);r&&uS(r,{display:"inline"}),n.remove(),t[i]&&delete t[i]})}(o)})}dS.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],U(dS,gc);var mS={__depends__:[Yd],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",dS]},fS={},yS=Math.abs,vS=Math.round;fS.snapTo=function(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i<t.length;i++)if(r=t[i],yS(r-e)<=n)return r},fS.topLeft=function(e){return{x:e.x,y:e.y}},fS.mid=function(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:vS(e.x+e.width/2),y:vS(e.y+e.height/2)}},fS.bottomRight=function(e){return{x:e.x+e.width,y:e.y+e.height}},fS.isSnapped=function(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)},fS.setSnapped=function(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r};var gS=s.forEach,bS=fS.snapTo;function xS(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}xS.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},xS.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},xS.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},xS.prototype.getSnapLocations=function(){return this._snapLocations},xS.prototype.setSnapLocations=function(e){this._snapLocations=e},xS.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new _S).initDefaults(this._defaultSnaps),n};var ES=xS;function _S(e){this._snapValues={}}_S.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),-1===n.x.indexOf(t.x)&&n.x.push(t.x),-1===n.y.indexOf(t.y)&&n.y.push(t.y)},_S.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&bS(e[n],r[n],i)},_S.prototype.initDefaults=function(e){var t=this;gS(e||{},function(e,n){gS(e,function(e){t.add(n,e)})})};var wS=s.filter,SS=s.forEach,TS=s.debounce,CS=s.bind,AS=fS.mid,RS=1250,PS=fS.isSnapped,MS=fS.setSnapped,kS=n.append,BS=n.attr,NS=n.classes,DS=n.create;function OS(e,t){this._canvas=t;var n=this;e.on(["shape.move.start","create.start"],function(e){n.initSnap(e)}),e.on(["shape.move.move","shape.move.end","create.move","create.end"],RS,function(e){e.originalEvent&&e.originalEvent.ctrlKey||PS(e)||n.snap(e)}),e.on(["shape.move.cleanup","create.cleanup"],function(e){n.hide()}),this._asyncHide=TS(CS(this.hide,this),1e3)}OS.$inject=["eventBus","canvas"];var LS=OS;OS.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.snapContext;i||(i=t.snapContext=new ES);var r=AS(n,e);return i.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),i},OS.prototype.snap=function(e){var t=e.context,n=t.snapContext,i=t.shape,r=t.target,o=n.getSnapLocations();if(r){var a=n.pointsForTarget(r);a.initialized||(this.addTargetSnaps(a,i,r),a.initialized=!0);var s={x:PS(e,"x"),y:PS(e,"y")};SS(o,function(t){var i=n.getSnapOrigin(t),r={x:e.x+i.x,y:e.y+i.y};if(SS(["x","y"],function(e){var n;s[e]||void 0!==(n=a.snap(r,t,e,7))&&(s[e]={value:n,originValue:n-i[e]})}),s.x&&s.y)return!1}),this.showSnapLine("vertical",s.x&&s.x.value),this.showSnapLine("horizontal",s.y&&s.y.value),SS(["x","y"],function(t){var n=s[t];"object"==typeof n&&MS(e,t,n.originValue)})}},OS.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=DS("path");return BS(n,{d:"M0,0 L0,0"}),NS(n).add("djs-snap-line"),kS(t,n),{update:function(t){BS(n,"number"!=typeof t?{display:"none"}:"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""})}}},OS.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},OS.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},OS.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},OS.prototype.hide=function(){SS(this._snapLines,function(e){e.update()})},OS.prototype.addTargetSnaps=function(e,t,n){var i=this.getSiblings(t,n);SS(i,function(t){e.add("mid",AS(t))})},OS.prototype.getSiblings=function(e,t){return t&&wS(t.children,function(t){return!t.hidden&&!t.labelTarget&&t.host!==e&&t!==e})};var IS=s.forEach,jS=s.assign,zS=ui.getBBox,FS=d.is,$S=Js.isAny,GS=f.isExpanded,WS=Ps.asTRBL,HS=Math.round,VS=fS.mid,qS=fS.topLeft,US=fS.bottomRight,YS=fS.isSnapped,KS=fS.setSnapped,XS=GE.getBoundaryAttachment,ZS=GE.getParticipantSizeConstraints,QS=ep.getLanesRoot,JS=1500;function eT(e,t,n,i){LS.call(this,e,t),e.on("create.start",function(e){var n=e.context,i=n.shape,r=t.getRootElement();FS(i,"bpmn:Participant")&&FS(r,"bpmn:Process")&&nT(n,i,r.children)}),e.on(["create.move","create.end"],JS,function(e){var t=e.context,n=t.shape,i=t.participantSnapBox;!YS(e)&&i&&function(e,t,n,i){i=i||0;var r=t.width/2-i,o=t.height/2,a={x:n.x-r-i,y:n.y-o},s={x:n.x+r+i,y:n.y+o},c=e,p=US(e);a.x>=c.x?KS(n,"x",c.x+i+r):s.x<=p.x&&KS(n,"x",p.x-i-r);a.y>=c.y?KS(n,"y",c.y+o):s.y<=p.y&&KS(n,"y",p.y-o)}(i,n,e)}),e.on("shape.move.start",function(e){var n=e.context,i=n.shape,r=t.getRootElement();FS(i,"bpmn:Participant")&&FS(r,"bpmn:Process")&&nT(n,i,r.children)}),e.on(["create.move","create.end","shape.move.move","shape.move.end"],JS,function(e){var t=e.context,i=t.target,r=t.shape;i&&!YS(e)&&function(e,t,i){return"attach"===n.canAttach([e],t,null,i)}(r,i,e)&&function(e,t,n){var i=WS(n),r=XS(e,n);/top/.test(r)?KS(e,"y",i.top):/bottom/.test(r)&&KS(e,"y",i.bottom);/left/.test(r)?KS(e,"x",i.left):/right/.test(r)&&KS(e,"x",i.right)}(e,0,i)}),e.on(["shape.move.hover","shape.move.move","shape.move.end","create.hover","create.move","create.end"],JS,function(e){var t=e.context.shape,n=e.hover;FS(n,"bpmn:Lane")&&!$S(t,["bpmn:Lane","bpmn:Participant"])&&(e.hover=QS(n),e.hoverGfx=i.getGraphics(e.hover))}),e.on(["connect.move","connect.hover","connect.end"],JS,function(e){var t=e.context,i=t.source,r=t.target,o=function(e,t){return n.canConnect(e,t)}(i,r)||{};t.initialSourcePosition||(t.initialSourcePosition=t.sourcePosition),r&&"bpmn:SequenceFlow"===o.type?(t.sourcePosition=VS(i),jS(e,VS(r))):t.sourcePosition=t.initialSourcePosition}),e.on("resize.start",JS,function(e){var t=e.context,n=t.shape;FS(n,"bpmn:SubProcess")&&GS(n)&&(t.minDimensions={width:140,height:120}),FS(n,"bpmn:Participant")&&(t.minDimensions={width:300,height:150}),(FS(n,"bpmn:Lane")||FS(n,"bpmn:Participant"))&&(t.resizeConstraints=ZS(n,t.direction,t.balanced)),FS(n,"bpmn:TextAnnotation")&&(t.minDimensions={width:50,height:30})})}U(eT,LS),eT.$inject=["eventBus","canvas","bpmnRules","elementRegistry"];var tT=eT;function nT(e,t,n){if(n.length){var i=zS(n.filter(function(e){return!e.labelTarget&&!e.waypoints}));i.x-=50,i.y-=20,i.width+=70,i.height+=40,t.width=Math.max(t.width,i.width),t.height=Math.max(t.height,i.height),e.participantSnapBox=i}}eT.prototype.initSnap=function(e){var t,n,i,r,o,a=e.context,s=e.shape;o=LS.prototype.initSnap.call(this,e),FS(s,"bpmn:Participant")&&o.setSnapLocations(["top-left","bottom-right","mid"]),s&&(t=VS(s,e),n={width:s.width,height:s.height,x:isNaN(s.x)?HS(t.x-s.width/2):s.x,y:isNaN(s.y)?HS(t.y-s.height/2):s.y},i=qS(n),r=US(n),o.setSnapOrigin("top-left",{x:i.x-e.x,y:i.y-e.y}),o.setSnapOrigin("bottom-right",{x:r.x-e.x,y:r.y-e.y}),IS(s.outgoing,function(t){var n=t.waypoints[0];n=n.original||n,o.setSnapOrigin(t.id+"-docking",{x:n.x-e.x,y:n.y-e.y})}),IS(s.incoming,function(t){var n=t.waypoints[t.waypoints.length-1];n=n.original||n,o.setSnapOrigin(t.id+"-docking",{x:n.x-e.x,y:n.y-e.y})}));var c=a.source;c&&o.addDefaultSnap("mid",VS(c))},eT.prototype.addTargetSnaps=function(e,t,n){FS(t,"bpmn:BoundaryEvent")&&"label"!==t.type&&(n=n.parent),FS(n,"bpmn:SequenceFlow")&&this.addTargetSnaps(e,t,n.parent);var i=this.getSiblings(t,n)||[];IS(i,function(t){FS(t,"bpmn:Lane")||(t.waypoints?IS(t.waypoints.slice(1,-1),function(n,i){var r=t.waypoints[i+2],o=t.waypoints[i];if(!r||!o)throw new Error("waypoints must exist");r.x!==n.x&&r.y!==n.y&&o.x!==n.x&&o.y!==n.y||e.add("mid",n)}):(e.add("mid",VS(t)),FS(t,"bpmn:Participant")&&(e.add("top-left",qS(t)),e.add("bottom-right",US(t)))))}),IS(t.incoming,function(t){-1===i.indexOf(t.source)&&e.add("mid",VS(t.source));var n=t.waypoints[0];e.add(t.id+"-docking",n.original||n)}),IS(t.outgoing,function(t){-1===i.indexOf(t.target)&&e.add("mid",VS(t.target));var n=t.waypoints[t.waypoints.length-1];e.add(t.id+"-docking",n.original||n)})};var iT={__init__:["snapping"],snapping:["type",tT]},rT=s.assign;function oT(e,t,n,i){this._canvas=n,this._mouseTracking=i,this._opts=rT({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on("drag.move",function(e){var t=r._toBorderPoint(e);r.startScroll(t)}),t.on(["drag.cleanup"],function(){r.stopScroll()})}oT.$inject=["config.autoScroll","eventBus","canvas","mouseTracking"];var aT=oT;function sT(e,t,n){return t<e&&e<n}oT.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)sT(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(0===c?a=n.scrollStep:1==c?s=n.scrollStep:2==c?a=-n.scrollStep:3==c&&(s=-n.scrollStep));0===a&&0===s||(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))},oT.prototype.stopScroll=function(){clearTimeout(this._scrolling)},oT.prototype.setOptions=function(e){this._opts=rT({},this._opts,e)},oT.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=go.toPoint(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var cT={__depends__:[ou,uh],__init__:["autoScroll"],autoScroll:["type",aT]},pT={},lT=pT.BENDPOINT_CLS="djs-bendpoint",uT=pT.SEGMENT_DRAGGER_CLS="djs-segment-dragger",hT=n.append,dT=n.attr,mT=n.classes,fT=n.create,yT=w.rotate,vT=w.translate;pT.toCanvasCoordinates=function(e,t){var n,i=go.toPoint(t),r=e._container.getBoundingClientRect();n={x:r.left,y:r.top};var o=e.viewbox();return{x:o.x+(i.x-n.x)/o.scale,y:o.y+(i.y-n.y)/o.scale}},pT.addBendpoint=function(e,t){var n=fT("g");mT(n).add(lT),hT(e,n);var i=fT("circle");dT(i,{cx:0,cy:0,r:4}),mT(i).add("djs-visual"),hT(n,i);var r=fT("circle");return dT(r,{cx:0,cy:0,r:10}),mT(r).add("djs-hit"),hT(n,r),t&&mT(n).add(t),n},pT.addSegmentDragger=function(e,t,n){var i=fT("g"),r=Ya.getMidPoint(t,n),o=Ya.pointsAligned(t,n);return hT(e,i),function(e,t,n){var i=fT("g");hT(e,i);var r=fT("rect");dT(r,{x:-7,y:-1.5,width:14,height:3}),mT(r).add("djs-visual"),hT(i,r);var o=fT("rect");dT(o,{x:-10,y:-4.5,width:20,height:9}),mT(o).add("djs-hit"),hT(i,o),yT(i,"h"===n?90:0,0,0)}(i,0,o),mT(i).add(uT),mT(i).add("h"===o?"vertical":"horizontal"),vT(i,r.x,r.y),i};var gT="connect-ok",bT="connect-not-ok",xT="connect-hover",ET="djs-updating",_T="connection.updateWaypoints",wT="connection.reconnectStart",ST="connection.reconnectEnd",TT=Math.round,CT=n.classes,AT=n.remove,RT=w.translate;function PT(e,t,n,i,r,o,a){var s=e.get("connectionDocking",!1);function c(e){r.update("connection",e.connection,e.connectionGfx)}this.start=function(e,t,r,o){var a,s=t.waypoints,c=n.getGraphics(t);a={connection:t,bendpointIndex:r,insert:o,type:o||0!==r?o||r!==s.length-1?_T:ST:wT},i.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:c,context:a}})},t.on("bendpoint.move.start",function(e){var t=e.context,i=t.connection,r=i.waypoints,o=r.slice(),a=t.insert,s=t.bendpointIndex;t.originalWaypoints=r,a&&o.splice(s,0,null),i.waypoints=o,t.draggerGfx=pT.addBendpoint(n.getLayer("overlays")),CT(t.draggerGfx).add("djs-dragging"),n.addMarker(i,ET)}),t.on("bendpoint.move.hover",function(e){var t=e.context;if(t.hover=e.hover,e.hover){n.addMarker(e.hover,xT);var i=t.allowed=o.allowed(t.type,t);i?(n.removeMarker(t.hover,bT),n.addMarker(t.hover,gT),t.target=t.hover):!1===i&&(n.removeMarker(t.hover,gT),n.addMarker(t.hover,bT),t.target=null)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(e){var t=e.context.hover;t&&(n.removeMarker(t,xT),n.removeMarker(t,e.context.target?gT:bT))}),t.on("bendpoint.move.move",function(e){var t,n,i=e.context,r=i.type,o=e.connection;o.waypoints[i.bendpointIndex]={x:e.x,y:e.y},s&&(i.hover&&(r===wT&&(t=i.hover),r===ST&&(n=i.hover)),o.waypoints=s.getCroppedWaypoints(o,t,n)),RT(i.draggerGfx,e.x,e.y),c(e)}),t.on(["bendpoint.move.end","bendpoint.move.cancel"],function(e){var t=e.context,i=t.hover,r=t.connection;AT(t.draggerGfx),t.newWaypoints=r.waypoints.slice(),r.waypoints=t.originalWaypoints,n.removeMarker(r,ET),i&&(n.removeMarker(i,gT),n.removeMarker(i,bT))}),t.on("bendpoint.move.end",function(e){var t,n=e.context,i=n.newWaypoints,r=n.bendpointIndex,o=i[r],s=n.allowed;if(o.x=TT(o.x),o.y=TT(o.y),s&&n.type===wT)a.reconnectStart(n.connection,n.target,o);else if(s&&n.type===ST)a.reconnectEnd(n.connection,n.target,o);else{if(!1===s||n.type!==_T)return c(e),!1;t={bendpointMove:{insert:e.context.insert,bendpointIndex:r}},a.updateWaypoints(n.connection,function(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],i=e[r+1],0===Ya.pointDistance(t,i)||Ya.pointsOnLine(n,i,t)?e.splice(r,1):r++;return e}(i),t)}}),t.on("bendpoint.move.cancel",function(e){c(e)})}PT.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"];var MT=PT,kT=s.assign,BT=s.forEach,NT=s.isArray,DT=Math.abs,OT=Math.round,LT=10;function IT(e){function t(e,t){if(NT(e)){for(var n=e.length;n--;)if(DT(e[n]-t)<=LT)return e[n]}else{var i=t%(e=+e);if(i<LT)return t-i;if(i>e-LT)return t-i+e}return t}function n(e){if(e.width)return{x:OT(e.width/2+e.x),y:OT(e.height/2+e.y)}}e.on("connectionSegment.move.move",1500,function(e){var i,r,o=function(e){var t=e.snapPoints,i=e.connection,r=i.waypoints,o=e.segmentStart,a=e.segmentStartIndex,s=e.segmentEnd,c=e.segmentEndIndex,p=e.axis;if(t)return t;var l=[r[a-1],o,s,r[c+1]];return a<2&&l.unshift(n(i.source)),c>r.length-3&&l.unshift(n(i.target)),e.snapPoints=t={horizontal:[],vertical:[]},BT(l,function(e){e&&(e=e.original||e,"y"===p&&t.horizontal.push(e.y),"x"===p&&t.vertical.push(e.x))}),t}(e.context),a=e.x,s=e.y;if(o){var c=a-(i=t(o.vertical,a)),p=s-(r=t(o.horizontal,s));kT(e,{dx:e.dx-c,dy:e.dy-p,x:i,y:r})}}),e.on("bendpoint.move.move",1500,function(e){var i=e.context,r=function(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var r=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},BT(r,function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))}),t}(i),o=i.target,a=o&&n(o),s=e.x,c=e.y;if(r){var p=s-t(a?r.vertical.concat([a.x]):r.vertical,s),l=c-t(a?r.horizontal.concat([a.y]):r.horizontal,c);kT(e,{dx:e.dx-p,dy:e.dy-l,x:e.x-p,y:e.y-l})}})}IT.$inject=["eventBus"];var jT=IT,zT=s.forEach,FT=Y.event,$T=Y.query,GT=Y.queryAll,WT=Ya.pointsAligned,HT=Ya.getMidPoint,VT=pT.BENDPOINT_CLS,qT=pT.SEGMENT_DRAGGER_CLS,UT=Yb.getApproxIntersection,YT=n.append,KT=n.attr,XT=n.classes,ZT=n.create,QT=n.remove,JT=w.translate;function eC(e,t,n,i,r){function o(e,n){var i=pT.toCanvasCoordinates(t,n);return UT(e,i)}function a(e,t){var n=t.waypoints,a=o(n,e);if(a)return!function(e,t,n){var i,r,o,a,s,c,p=e.index,l=e.point;return!(p<=0||e.bendpoint)&&(i=t[p-1],r=t[p],o=HT(i,r),a=WT(i,r),s=Math.abs(l.x-o.x),c=Math.abs(l.y-o.y),a&&s<=n&&c<=n)}(a,n,10)?i.start(e,t,a.index,!a.bendpoint):r.start(e,t,a.index),!0}function s(e,t,i){FT.bind(e,t,function(e){n.triggerMouseEvent(t,e,i),e.stopPropagation()})}function c(e,n){var i=t.getLayer("overlays"),r=$T(".djs-bendpoints[data-element-id="+e.id+"]",i);return!r&&n&&(r=ZT("g"),KT(r,{"data-element-id":e.id}),XT(r).add("djs-bendpoints"),YT(i,r),s(r,"mousedown",e),s(r,"click",e),s(r,"dblclick",e)),r}function p(e,t){t.waypoints.forEach(function(t,n){var i=pT.addBendpoint(e);YT(e,i),JT(i,t.x,t.y)}),pT.addBendpoint(e,"floating")}function l(e,t){for(var n,i,r=t.waypoints,o=1;o<r.length;o++)n=r[o-1],i=r[o],WT(n,i)&&pT.addSegmentDragger(e,n,i)}function u(e){var t=c(e);return t||(p(t=c(e,!0),e),l(t,e)),t}function h(e){var t=c(e);t&&(!function(e){zT(GT("."+qT,e),function(e){QT(e)})}(t),function(e){zT(GT("."+VT,e),function(e){QT(e)})}(t),l(t,e),p(t,e))}e.on("connection.changed",function(e){h(e.element)}),e.on("connection.remove",function(e){var t=c(e.element);t&&QT(t)}),e.on("element.marker.update",function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?XT(t).add(e.marker):XT(t).remove(e.marker))}),e.on("element.mousemove",function(e){var t,n,i,r=e.element,a=r.waypoints;if(a){if(t=c(r,!0),!(n=$T(".floating",t)))return;(i=o(a,e.originalEvent))&&JT(n,i.point.x,i.point.y)}}),e.on("element.mousedown",function(e){var t=e.originalEvent,n=e.element,i=n.waypoints;if(i)return a(t,n)}),e.on("selection.changed",function(e){var t=e.newSelection[0];t&&t.waypoints&&u(t)}),e.on("element.hover",function(e){var t=e.element;t.waypoints&&(u(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(e){var t=e.element,n=e.newId;if(t.waypoints){var i=c(t);i&&KT(i,{"data-element-id":n})}}),this.addHandles=u,this.updateHandles=h,this.getBendpointsContainer=c}eC.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var tC=eC,nC="connect-hover",iC="djs-updating",rC=n.classes,oC=n.remove,aC=w.translate;function sC(e,t,n){return cC(e,t,e[t]+n)}function cC(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function pC(e){return"x"===e?"y":"x"}function lC(e,t,n){var i,r;return e.original?e.original:(i=Ps.getMid(t),cC(e,r=pC(n),i[r]))}function uC(e,t,n,i,r,o,a){var s=e.get("connectionDocking",!1);function c(e,t){if(!s)return t;var n,i=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=i,n}function p(e){r.update("connection",e.connection,e.connectionGfx)}function l(e,t,n){var i=e.newWaypoints,r=function(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]);return cC(t,i,Math.min(Math.max(o+20,e[i]),r-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],pC(e.axis));aC(e.draggerGfx,r.x,r.y)}this.start=function(e,t,r){var o,a,s,c=n.getGraphics(t),p=r-1,l=r,u=t.waypoints,h=u[p],d=u[l];(a=Ya.pointsAligned(h,d))&&(s="v"===a?"y":"x",0===p&&(h=lC(h,t.source,s)),l===u.length-1&&(d=lC(d,t.target,s)),o={connection:t,segmentStartIndex:p,segmentEndIndex:l,segmentStart:h,segmentEnd:d,axis:s},i.init(e,{x:(h.x+d.x)/2,y:(h.y+d.y)/2},"connectionSegment.move",{cursor:"x"===s?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:c,context:o}}))},t.on("connectionSegment.move.start",function(e){var t=e.context,i=e.connection,r=n.getLayer("overlays");t.originalWaypoints=i.waypoints.slice(),t.draggerGfx=pT.addSegmentDragger(r,t.segmentStart,t.segmentEnd),rC(t.draggerGfx).add("djs-dragging"),n.addMarker(i,iC)}),t.on("connectionSegment.move.move",function(e){var t,n,i=e.context,r=i.connection,o=i.segmentStartIndex,a=i.segmentEndIndex,s=i.segmentStart,u=i.segmentEnd,h=i.axis,d=i.originalWaypoints.slice(),m=sC(s,h,e["d"+h]),f=sC(u,h,e["d"+h]),y=d.length,v=0;d[o]=m,d[a]=f,o<2&&(t=Ps.getOrientation(r.source,m),1===o?"intersect"===t&&(d.shift(),d[0]=m,v--):"intersect"!==t&&(d.unshift(s),v++)),a>y-3&&(n=Ps.getOrientation(r.target,f),a===y-2?"intersect"===n&&(d.pop(),d[d.length-1]=f):"intersect"!==n&&d.push(u)),i.newWaypoints=r.waypoints=c(r,d),l(i,v,e),i.newSegmentStartIndex=o+v,p(e)}),t.on("connectionSegment.move.hover",function(e){e.context.hover=e.hover,n.addMarker(e.hover,nC)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(e){var t=e.context.hover;t&&n.removeMarker(t,nC)}),t.on("connectionSegment.move.cleanup",function(e){var t=e.context,i=t.connection;t.draggerGfx&&oC(t.draggerGfx),n.removeMarker(i,iC)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,p(e)}),t.on("connectionSegment.move.end",function(e){var t=e.context,n=t.connection,i=t.newWaypoints,r=t.newSegmentStartIndex,o=function(e,t){var n=0;return{waypoints:e.filter(function(i,r){return!Ya.pointsOnLine(e[r-1],e[r+1],i)||(n=r<=t?n-1:n,!1)}),segmentOffset:n}}(i=i.map(function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}),r),s=c(n,o.waypoints),p=o.segmentOffset,l={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+p}};a.updateWaypoints(n,s,l)})}uC.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"];var hC={__depends__:[ou,cu],__init__:["bendpoints","bendpointSnapping"],bendpoints:["type",tC],bendpointMove:["type",MT],connectionSegmentMove:["type",uC],bendpointSnapping:["type",jT]},dC=s.assign,mC=s.filter,fC=s.groupBy,yC=500,vC=1250,gC=1500,bC=go.getOriginal,xC=Math.round;function EC(e,t,n,i,r){function o(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function a(e,n,i){if(!n.waypoints&&n.parent){var r=function(e){return{x:e.x+xC(e.width/2),y:e.y+xC(e.height/2)}}(n);return t.init(e,r,"shape.move",{cursor:"grabbing",autoActivate:i,data:{shape:n,context:{}}}),!0}}e.on("shape.move.start",gC,function(e){var t,n,r=e.context,o=e.shape,a=i.get().slice();-1===a.indexOf(o)&&(a=[o]),n=fC(t=a,"id"),a=mC(t,function(e){for(;e=e.parent;)if(n[e.id])return!1;return!0}),dC(r,{shapes:a,validatedShapes:a,shape:o})}),e.on("shape.move.start",vC,function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=o(n)))return!1}),e.on("shape.move.move",yC,function(e){var t,n=e.context,i=n.validatedShapes,r=e.hover,a={x:e.dx,y:e.dy};t=o(i,a,{x:e.x,y:e.y},r),n.delta=a,n.canExecute=t,n.target=null!==t?r:null}),e.on("shape.move.end",function(e){var t=e.context,i=t.delta,r=t.canExecute,o="attach"===r,a=t.shapes;if(!r)return!1;i.x=xC(i.x),i.y=xC(i.y),n.moveElements(a,i,t.target,{primaryShape:t.shape,attach:o})}),e.on("element.mousedown",function(e){var t=bC(e);if(!t)throw new Error("must supply DOM mousedown event");return a(t,e.element)}),this.start=a}EC.$inject=["eventBus","dragging","modeling","selection","rules"];var _C=EC;var wC=s.flatten,SC=s.forEach,TC=s.filter,CC=s.find,AC=s.groupBy,RC=s.map,PC=s.matchPattern,MC=s.size,kC=n.append,BC=n.attr,NC=n.clear,DC=n.create,OC=w.translate,LC=499,IC="djs-dragging",jC="drop-ok",zC="drop-not-ok",FC="new-parent",$C="attach-ok";function GC(e,t,n,i,r){function o(e){return function(e){return TC(e,function(t){return!function(e){return e.waypoints}(t)||CC(e,PC({id:t.source.id}))&&CC(e,PC({id:t.target.id}))})}(a(e))}function a(e){var t=ui.selfAndAllChildren(e,!0),n=RC(t,function(e){return(e.incoming||[]).concat(e.outgoing||[])});return wC(t.concat(n),!0)}function s(e,t){[$C,jC,zC,FC].forEach(function(i){i===t?n.addMarker(e,i):n.removeMarker(e,i)})}e.on("shape.move.start",LC,function(e){var t=e.context,s=t.shapes,c=t.allDraggedElements,p=o(s);if(!t.dragGroup){var l=DC("g");BC(l,i.cls("djs-drag-group",["no-events"]));var u=n.getDefaultLayer();kC(u,l),t.dragGroup=l}p.forEach(function(e){r.addDragger(e,t.dragGroup)}),c=c?wC(c,a(s)):a(s),SC(c,function(e){n.addMarker(e,IC)}),t.allDraggedElements=c,t.differentParents=1!==MC(AC(s,function(e){return e.parent&&e.parent.id}))}),e.on("shape.move.move",LC,function(e){var t=e.context,n=t.dragGroup,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?s(i,$C):t.canExecute&&i&&i.id!==r.id?s(i,FC):s(i,t.canExecute?jC:zC)),OC(n,e.dx,e.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(e){var t=e.context.target;t&&s(t,null)}),e.on("shape.move.cleanup",function(e){var t=e.context,i=t.allDraggedElements,r=t.dragGroup;SC(i,function(e){n.removeMarker(e,IC)}),r&&NC(r)}),this.makeDraggable=function(e,t,i){r.addDragger(t,e.dragGroup),i&&n.addMarker(t,IC),e.allDraggedElements?e.allDraggedElements.push(t):e.allDraggedElements=[t]}}GC.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var WC={__depends__:[jo,aa,Uo,cu,ou,Yd],__init__:["move","movePreview"],move:["type",_C],movePreview:["type",GC]},HC=n.append,VC=n.attr,qC=n.create;function UC(e,t){var n=this;t.on("canvas.init",function(e){n.addBBoxMarker(e.svg)})}UC.$inject=["canvas","eventBus"];var YC=UC;UC.prototype.addBBoxMarker=function(e){var t={fill:"none",class:"outer-bound-marker"},n=qC("rect");VC(n,{x:-1e4,y:1e4,width:10,height:10}),VC(n,t),HC(e,n);var i=qC("rect");VC(i,{x:1e4,y:1e4,width:10,height:10}),VC(i,t),HC(e,i)};var KC={exports:{}};!function(e,t,n,i){"use strict";var r,o=["","webkit","Moz","MS","ms","o"],a=t.createElement("div"),s="function",c=Math.round,p=Math.abs,l=Date.now;function u(e,t,n){return setTimeout(g(e,n),t)}function h(e,t,n){return!!Array.isArray(e)&&(d(e,n[t],n),!0)}function d(e,t,n){var r;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==i)for(r=0;r<e.length;)t.call(n,e[r],r,e),r++;else for(r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r,e)}function m(t,n,i){var r="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){var n=new Error("get-stack-trace"),i=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=e.console&&(e.console.warn||e.console.log);return o&&o.call(e.console,r,i),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(e){if(e===i||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(r!==i&&null!==r)for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])}return t}:Object.assign;var f=m(function(e,t,n){for(var r=Object.keys(t),o=0;o<r.length;)(!n||n&&e[r[o]]===i)&&(e[r[o]]=t[r[o]]),o++;return e},"extend","Use `assign`."),y=m(function(e,t){return f(e,t,!0)},"merge","Use `assign`.");function v(e,t,n){var i,o=t.prototype;(i=e.prototype=Object.create(o)).constructor=e,i._super=o,n&&r(i,n)}function g(e,t){return function(){return e.apply(t,arguments)}}function b(e,t){return typeof e==s?e.apply(t&&t[0]||i,t):e}function x(e,t){return e===i?t:e}function E(e,t,n){d(T(t),function(t){e.addEventListener(t,n,!1)})}function _(e,t,n){d(T(t),function(t){e.removeEventListener(t,n,!1)})}function w(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function S(e,t){return e.indexOf(t)>-1}function T(e){return e.trim().split(/\s+/g)}function C(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var i=0;i<e.length;){if(n&&e[i][n]==t||!n&&e[i]===t)return i;i++}return-1}function A(e){return Array.prototype.slice.call(e,0)}function R(e,t,n){for(var i=[],r=[],o=0;o<e.length;){var a=t?e[o][t]:e[o];C(r,a)<0&&i.push(e[o]),r[o]=a,o++}return n&&(i=t?i.sort(function(e,n){return e[t]>n[t]}):i.sort()),i}function P(e,t){for(var n,r,a=t[0].toUpperCase()+t.slice(1),s=0;s<o.length;){if((r=(n=o[s])?n+a:t)in e)return r;s++}return i}var M=1;function k(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var B="ontouchstart"in e,N=P(e,"PointerEvent")!==i,D=B&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),O=25,L=1,I=2,j=4,z=8,F=1,$=2,G=4,W=8,H=16,V=$|G,q=W|H,U=V|q,Y=["x","y"],K=["clientX","clientY"];function X(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){b(e.options.enable,[e])&&n.handler(t)},this.init()}function Z(e,t,n){var r=n.pointers.length,o=n.changedPointers.length,a=t&L&&r-o==0,s=t&(j|z)&&r-o==0;n.isFirst=!!a,n.isFinal=!!s,a&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,r=t.pointers,o=r.length;n.firstInput||(n.firstInput=Q(t));o>1&&!n.firstMultiple?n.firstMultiple=Q(t):1===o&&(n.firstMultiple=!1);var a=n.firstInput,s=n.firstMultiple,c=s?s.center:a.center,u=t.center=J(r);t.timeStamp=l(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=ie(c,u),t.distance=ne(c,u),function(e,t){var n=t.center,i=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};t.eventType!==L&&o.eventType!==j||(r=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=e.offsetDelta={x:n.x,y:n.y});t.deltaX=r.x+(n.x-i.x),t.deltaY=r.y+(n.y-i.y)}(n,t),t.offsetDirection=te(t.deltaX,t.deltaY);var h=ee(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=h.x,t.overallVelocityY=h.y,t.overallVelocity=p(h.x)>p(h.y)?h.x:h.y,t.scale=s?(d=s.pointers,m=r,ne(m[0],m[1],K)/ne(d[0],d[1],K)):1,t.rotation=s?function(e,t){return ie(t[1],t[0],K)+ie(e[1],e[0],K)}(s.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,function(e,t){var n,r,o,a,s=e.lastInterval||t,c=t.timeStamp-s.timeStamp;if(t.eventType!=z&&(c>O||s.velocity===i)){var l=t.deltaX-s.deltaX,u=t.deltaY-s.deltaY,h=ee(c,l,u);r=h.x,o=h.y,n=p(h.x)>p(h.y)?h.x:h.y,a=te(l,u),e.lastInterval=t}else n=s.velocity,r=s.velocityX,o=s.velocityY,a=s.direction;t.velocity=n,t.velocityX=r,t.velocityY=o,t.direction=a}(n,t);var d,m;var f=e.element;w(t.srcEvent.target,f)&&(f=t.srcEvent.target);t.target=f}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function Q(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:c(e.pointers[n].clientX),clientY:c(e.pointers[n].clientY)},n++;return{timeStamp:l(),pointers:t,center:J(t),deltaX:e.deltaX,deltaY:e.deltaY}}function J(e){var t=e.length;if(1===t)return{x:c(e[0].clientX),y:c(e[0].clientY)};for(var n=0,i=0,r=0;r<t;)n+=e[r].clientX,i+=e[r].clientY,r++;return{x:c(n/t),y:c(i/t)}}function ee(e,t,n){return{x:t/e||0,y:n/e||0}}function te(e,t){return e===t?F:p(e)>=p(t)?e<0?$:G:t<0?W:H}function ne(e,t,n){n||(n=Y);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return Math.sqrt(i*i+r*r)}function ie(e,t,n){n||(n=Y);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return 180*Math.atan2(r,i)/Math.PI}X.prototype={handler:function(){},init:function(){this.evEl&&E(this.element,this.evEl,this.domHandler),this.evTarget&&E(this.target,this.evTarget,this.domHandler),this.evWin&&E(k(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(k(this.element),this.evWin,this.domHandler)}};var re={mousedown:L,mousemove:I,mouseup:j},oe="mousedown",ae="mousemove mouseup";function se(){this.evEl=oe,this.evWin=ae,this.pressed=!1,X.apply(this,arguments)}v(se,X,{handler:function(e){var t=re[e.type];t&L&&0===e.button&&(this.pressed=!0),t&I&&1!==e.which&&(t=j),this.pressed&&(t&j&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:"mouse",srcEvent:e}))}});var ce={pointerdown:L,pointermove:I,pointerup:j,pointercancel:z,pointerout:z},pe={2:"touch",3:"pen",4:"mouse",5:"kinect"},le="pointerdown",ue="pointermove pointerup pointercancel";function he(){this.evEl=le,this.evWin=ue,X.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&(le="MSPointerDown",ue="MSPointerMove MSPointerUp MSPointerCancel"),v(he,X,{handler:function(e){var t=this.store,n=!1,i=e.type.toLowerCase().replace("ms",""),r=ce[i],o=pe[e.pointerType]||e.pointerType,a="touch"==o,s=C(t,e.pointerId,"pointerId");r&L&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):r&(j|z)&&(n=!0),s<0||(t[s]=e,this.callback(this.manager,r,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),n&&t.splice(s,1))}});var de={touchstart:L,touchmove:I,touchend:j,touchcancel:z},me="touchstart",fe="touchstart touchmove touchend touchcancel";function ye(){this.evTarget=me,this.evWin=fe,this.started=!1,X.apply(this,arguments)}v(ye,X,{handler:function(e){var t=de[e.type];if(t===L&&(this.started=!0),this.started){var n=function(e,t){var n=A(e.touches),i=A(e.changedTouches);t&(j|z)&&(n=R(n.concat(i),"identifier",!0));return[n,i]}.call(this,e,t);t&(j|z)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:"touch",srcEvent:e})}}});var ve={touchstart:L,touchmove:I,touchend:j,touchcancel:z},ge="touchstart touchmove touchend touchcancel";function be(){this.evTarget=ge,this.targetIds={},X.apply(this,arguments)}v(be,X,{handler:function(e){var t=ve[e.type],n=function(e,t){var n=A(e.touches),i=this.targetIds;if(t&(L|I)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,a=A(e.changedTouches),s=[],c=this.target;if(o=n.filter(function(e){return w(e.target,c)}),t===L)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;r=0;for(;r<a.length;)i[a[r].identifier]&&s.push(a[r]),t&(j|z)&&delete i[a[r].identifier],r++;if(!s.length)return;return[R(o.concat(s),"identifier",!0),s]}.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:"touch",srcEvent:e})}});var xe=2500,Ee=25;function _e(){X.apply(this,arguments);var e=g(this.handler,this);this.touch=new be(this.manager,e),this.mouse=new se(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function we(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout(function(){var e=i.indexOf(n);e>-1&&i.splice(e,1)},xe)}}v(_e,X,{handler:function(e,t,n){var i="touch"==n.pointerType,r="mouse"==n.pointerType;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)(function(e,t){e&L?(this.primaryTouch=t.changedPointers[0].identifier,we.call(this,t)):e&(j|z)&&we.call(this,t)}).call(this,t,n);else if(r&&function(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(t-r.x),a=Math.abs(n-r.y);if(o<=Ee&&a<=Ee)return!0}return!1}.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Se=P(a.style,"touchAction"),Te=Se!==i,Ce="auto",Ae="manipulation",Re="none",Pe="pan-x",Me="pan-y",ke=function(){if(!Te)return!1;var t={},n=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(i){t[i]=!n||e.CSS.supports("touch-action",i)}),t}();function Be(e,t){this.manager=e,this.set(t)}Be.prototype={set:function(e){"compute"==e&&(e=this.compute()),Te&&this.manager.element.style&&ke[e]&&(this.manager.element.style[Se]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return d(this.manager.recognizers,function(t){b(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),function(e){if(S(e,Re))return Re;var t=S(e,Pe),n=S(e,Me);if(t&&n)return Re;if(t||n)return t?Pe:Me;if(S(e,Ae))return Ae;return Ce}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var i=this.actions,r=S(i,Re)&&!ke[Re],o=S(i,Me)&&!ke[Me],a=S(i,Pe)&&!ke[Pe];if(r){var s=1===e.pointers.length,c=e.distance<2,p=e.deltaTime<250;if(s&&c&&p)return}if(!a||!o)return r||o&&n&V||a&&n&q?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Ne=1,De=2,Oe=4,Le=8,Ie=Le,je=16;function ze(e){this.options=r({},this.defaults,e||{}),this.id=M++,this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=Ne,this.simultaneous={},this.requireFail=[]}function Fe(e){return e&je?"cancel":e&Le?"end":e&Oe?"move":e&De?"start":""}function $e(e){return e==H?"down":e==W?"up":e==$?"left":e==G?"right":""}function Ge(e,t){var n=t.manager;return n?n.get(e):e}function We(){ze.apply(this,arguments)}function He(){We.apply(this,arguments),this.pX=null,this.pY=null}function Ve(){We.apply(this,arguments)}function qe(){ze.apply(this,arguments),this._timer=null,this._input=null}function Ue(){We.apply(this,arguments)}function Ye(){We.apply(this,arguments)}function Ke(){ze.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Xe(e,t){return(t=t||{}).recognizers=x(t.recognizers,Xe.defaults.preset),new Ze(e,t)}ze.prototype={defaults:{},set:function(e){return r(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(h(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Ge(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return h(e,"dropRecognizeWith",this)?this:(e=Ge(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(h(e,"requireFailure",this))return this;var t=this.requireFail;return-1===C(t,e=Ge(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(h(e,"dropRequireFailure",this))return this;e=Ge(e,this);var t=C(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function i(n){t.manager.emit(n,e)}n<Le&&i(t.options.event+Fe(n)),i(t.options.event),e.additionalEvent&&i(e.additionalEvent),n>=Le&&i(t.options.event+Fe(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=32},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(32|Ne)))return!1;e++}return!0},recognize:function(e){var t=r({},e);if(!b(this.options.enable,[this,t]))return this.reset(),void(this.state=32);this.state&(Ie|je|32)&&(this.state=Ne),this.state=this.process(t),this.state&(De|Oe|Le|je)&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},v(We,ze,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,i=t&(De|Oe),r=this.attrTest(e);return i&&(n&z||!r)?t|je:i||r?n&j?t|Le:t&De?t|Oe:De:32}}),v(He,We,{defaults:{event:"pan",threshold:10,pointers:1,direction:U},getTouchAction:function(){var e=this.options.direction,t=[];return e&V&&t.push(Me),e&q&&t.push(Pe),t},directionTest:function(e){var t=this.options,n=!0,i=e.distance,r=e.direction,o=e.deltaX,a=e.deltaY;return r&t.direction||(t.direction&V?(r=0===o?F:o<0?$:G,n=o!=this.pX,i=Math.abs(e.deltaX)):(r=0===a?F:a<0?W:H,n=a!=this.pY,i=Math.abs(e.deltaY))),e.direction=r,n&&i>t.threshold&&r&t.direction},attrTest:function(e){return We.prototype.attrTest.call(this,e)&&(this.state&De||!(this.state&De)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=$e(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),v(Ve,We,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Re]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&De)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),v(qe,ze,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ce]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime>t.time;if(this._input=e,!i||!n||e.eventType&(j|z)&&!r)this.reset();else if(e.eventType&L)this.reset(),this._timer=u(function(){this.state=Ie,this.tryEmit()},t.time,this);else if(e.eventType&j)return Ie;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===Ie&&(e&&e.eventType&j?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}}),v(Ue,We,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Re]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&De)}}),v(Ye,We,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:V|q,pointers:1},getTouchAction:function(){return He.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(V|q)?t=e.overallVelocity:n&V?t=e.overallVelocityX:n&q&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&p(t)>this.options.velocity&&e.eventType&j},emit:function(e){var t=$e(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),v(Ke,ze,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Ae]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),e.eventType&L&&0===this.count)return this.failTimeout();if(i&&r&&n){if(e.eventType!=j)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||ne(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,a&&o?this.count+=1:this.count=1,this._input=e,0===this.count%t.taps)return this.hasRequireFailures()?(this._timer=u(function(){this.state=Ie,this.tryEmit()},t.interval,this),De):Ie}return 32},failTimeout:function(){return this._timer=u(function(){this.state=32},this.options.interval,this),32},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Ie&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Xe.VERSION="2.0.7",Xe.defaults={domEvents:!1,touchAction:"compute",enable:!0,inputTarget:null,inputClass:null,preset:[[Ue,{enable:!1}],[Ve,{enable:!1},["rotate"]],[Ye,{direction:V}],[He,{direction:V},["swipe"]],[Ke],[Ke,{event:"doubletap",taps:2},["tap"]],[qe]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Ze(e,t){var n;this.options=r({},Xe.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new((n=this).options.inputClass||(N?he:D?be:B?_e:se))(n,Z),this.touchAction=new Be(this,this.options.touchAction),Qe(this,!0),d(this.options.recognizers,function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}function Qe(e,t){var n,i=e.element;i.style&&(d(e.options.cssProps,function(r,o){n=P(i.style,o),t?(e.oldCssProps[n]=i.style[n],i.style[n]=r):i.style[n]=e.oldCssProps[n]||""}),t||(e.oldCssProps={}))}Ze.prototype={set:function(e){return r(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var n;this.touchAction.preventDefaults(e);var i=this.recognizers,r=t.curRecognizer;(!r||r&&r.state&Ie)&&(r=t.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===t.stopped||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(e),!r&&n.state&(De|Oe|Le)&&(r=t.curRecognizer=n),o++}},get:function(e){if(e instanceof ze)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(h(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(h(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=C(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==i&&t!==i){var n=this.handlers;return d(T(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==i){var n=this.handlers;return d(T(e),function(e){t?n[e]&&n[e].splice(C(n[e],t),1):delete n[e]}),this}},emit:function(e,n){this.options.domEvents&&function(e,n){var i=t.createEvent("Event");i.initEvent(e,!0,!0),i.gesture=n,n.target.dispatchEvent(i)}(e,n);var i=this.handlers[e]&&this.handlers[e].slice();if(i&&i.length){n.type=e,n.preventDefault=function(){n.srcEvent.preventDefault()};for(var r=0;r<i.length;)i[r](n),r++}},destroy:function(){this.element&&Qe(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},r(Xe,{INPUT_START:L,INPUT_MOVE:I,INPUT_END:j,INPUT_CANCEL:z,STATE_POSSIBLE:Ne,STATE_BEGAN:De,STATE_CHANGED:Oe,STATE_ENDED:Le,STATE_RECOGNIZED:Ie,STATE_CANCELLED:je,STATE_FAILED:32,DIRECTION_NONE:F,DIRECTION_LEFT:$,DIRECTION_RIGHT:G,DIRECTION_UP:W,DIRECTION_DOWN:H,DIRECTION_HORIZONTAL:V,DIRECTION_VERTICAL:q,DIRECTION_ALL:U,Manager:Ze,Input:X,TouchAction:Be,TouchInput:be,MouseInput:se,PointerEventInput:he,TouchMouseInput:_e,SingleTouchInput:ye,Recognizer:ze,AttrRecognizer:We,Tap:Ke,Pan:He,Swipe:Ye,Pinch:Ve,Rotate:Ue,Press:qe,on:E,off:_,each:d,merge:y,extend:f,assign:r,inherit:v,bindFn:g,prefixed:P}),(void 0!==e?e:"undefined"!=typeof self?self:{}).Hammer=Xe,KC.exports?KC.exports=Xe:e.Hammer=Xe}(window,document),KC=KC.exports;var XC=s.forEach,ZC=Y.event,QC=Y.closest,JC=.2,eA=4,tA=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function nA(e,t){return t.get(e,!1)}function iA(e){e.preventDefault(),e.stopPropagation(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()}function rA(e){function t(t){setTimeout(function(){XC(tA,function(t){ZC.unbind(e,t,iA,!0)})},500)}ZC.bind(e,"touchstart",function(t){XC(tA,function(t){ZC.bind(e,t,iA,!0)})},!0),ZC.bind(e,"touchend",t,!0),ZC.bind(e,"touchcancel",t,!0);var n=new KC.Manager(e,{inputClass:KC.TouchInput,recognizers:[]}),i=new KC.Tap,r=new KC.Pan({threshold:10}),o=new KC.Press,a=new KC.Pinch,s=new KC.Tap({event:"doubletap",taps:2});return a.requireFailure(r),a.requireFailure(o),n.add([r,o,a,s,i]),n.reset=function(e){var t=this.recognizers,i=this.session;i.stopped||(n.stop(e),setTimeout(function(){var e,n;for(e=0;n=t[e];e++)n.reset(),n.state=8;i.curRecognizer=null},0))},n.on("hammer.input",function(e){e.srcEvent.defaultPrevented&&n.reset(!0)}),n}function oA(e,t,n,i,r){var o,a=nA("dragging",e),s=nA("move",e),c=nA("contextPad",e),p=nA("palette",e);function l(e){return function(t){r.fire(e,t)}}function u(e){return QC(e,"svg, .djs-element",!0)}function h(e){function n(e){var n=u(e.target),r=n&&i.get(n);if(s&&t.getRootElement()!==r)return s.start(e,r,!0);!function(e){var n=0,i=0;function r(e){var r=e.deltaX-n,o=e.deltaY-i;t.scroll({dx:r,dy:o}),n=e.deltaX,i=e.deltaY}function a(e){o.off("panmove",r),o.off("panend",a),o.off("pancancel",a)}o.on("panmove",r),o.on("panend",a),o.on("pancancel",a)}()}(o=rA(e)).on("doubletap",l("element.dblclick")),o.on("tap",l("element.click")),o.on("panstart",n),o.on("press",n),o.on("pinchstart",function(e){var n=t.zoom(),i=e.center;function r(e){var r=1-(1-e.scale)/1.5,o=Math.max(JC,Math.min(eA,r*n));t.zoom(o,i),iA(e)}function a(e){o.off("pinchmove",r),o.off("pinchend",a),o.off("pinchcancel",a),o.reset(!0)}o.on("pinchmove",r),o.on("pinchend",a),o.on("pinchcancel",a)})}a&&n.on("drag.move",function(e){var t=e.originalEvent;if(t&&!(t instanceof MouseEvent)){var n=go.toPoint(t),r=u(document.elementFromPoint(n.x,n.y)),o=r&&i.get(r);o!==e.hover&&(e.hover&&a.out(e),o&&(a.hover({element:o,gfx:r}),e.hover=o,e.hoverGfx=r))}}),c&&n.on("contextPad.create",function(e){var t=rA(e.pad.html);t.on("panstart",function(e){c.trigger("dragstart",e,!0)}),t.on("press",function(e){c.trigger("dragstart",e,!0)}),t.on("tap",function(e){c.trigger("click",e)})}),p&&n.on("palette.create",function(e){var t=rA(e.container);t.on("panstart",function(e){p.trigger("dragstart",e,!0)}),t.on("press",function(e){p.trigger("dragstart",e,!0)}),t.on("tap",function(e){p.trigger("click",e)})}),n.on("canvas.init",function(e){h(e.svg)})}oA.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"];var aA={__depends__:[{__depends__:[jo],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",oA],touchFix:["type",YC]}]},sA={};function cA(e){ga.call(this,e),this.on("import.parse.complete",function(e){e.error||this._collectIds(e.definitions,e.context)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}return U(cA,ga),(sA=cA).Viewer=ga,sA.NavigatedViewer=Ua,cA.prototype.createDiagram=function(e){return this.importXML('<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>',e)},cA.prototype._createModdle=function(e){var t=ga.prototype._createModdle.call(this,e);return t.ids=new q([32,36,1]),t},cA.prototype._collectIds=function(e,t){var n,i=e.$model.ids;for(n in i.clear(),t.elementsById)i.claim(n,t.elementsById[n])},cA.prototype._interactionModules=[ka,aA,Va],cA.prototype._modelingModules=[cT,hC,WC,wf,Fc,hc,bm,Ou,Rm,Sf,Hw,sS,mS,iT],cA.prototype._modules=[].concat(cA.prototype._modules,cA.prototype._interactionModules,cA.prototype._modelingModules),sA});
|