/*! bpmn-js - 18.18.0 | generated for dokuwiki-plugin-bpmnio | SEE LICENSE IN LICENSE */ (()=>{function N(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function jx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qu={exports:{}},Zf;function Fx(){if(Zf)return qu.exports;Zf=1;var e=qu.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var r=Math.log(Math.pow(2,t))/Math.log(n),i=2;r===1/0;i*=2)r=Math.log(Math.pow(2,t/i))/Math.log(n)*i;for(var o=r-Math.floor(r),a="",i=0;i=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,r){var i=function(a){var s=0;do{if(s++>10)if(r)t+=r;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=i.hats={};return i.get=function(a){return i.hats[a]},i.set=function(a,s){return i.hats[a]=s,i},i.bits=t||128,i.base=n||16,i},qu.exports}var Hx=Fx(),$x=jx(Hx);function dn(e){if(!(this instanceof dn))return new dn(e);e=e||[128,36,1],this._seed=e.length?$x.rack(e[0],e[1],e[2]):e}dn.prototype.next=function(e){return this._seed(e||!0)};dn.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n};dn.prototype.claim=function(e,t){this._seed.set(e,t||!0)};dn.prototype.assigned=function(e){return this._seed.get(e)||!1};dn.prototype.unclaim=function(e){delete this._seed.hats[e]};dn.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};function Xi(e){return Array.prototype.concat.apply([],e)}var fa=Object.prototype.toString,zx=Object.prototype.hasOwnProperty;function Fn(e){return e===void 0}function Ye(e){return e!==void 0}function Tr(e){return e==null}function U(e){return fa.call(e)==="[object Array]"}function Pe(e){return fa.call(e)==="[object Object]"}function te(e){return fa.call(e)==="[object Number]"}function Le(e){let t=fa.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function rt(e){return fa.call(e)==="[object String]"}function Vx(e){if(!U(e))throw new Error("must supply array")}function ft(e,t){return!Tr(e)&&zx.call(e,t)}function ne(e,t){let n=Js(t),r;return E(e,function(i,o){if(n(i,o))return r=i,!1}),r}function Qs(e,t){let n=Js(t),r=U(e)?-1:void 0;return E(e,function(i,o){if(n(i,o))return r=o,!1}),r}function Q(e,t){let n=Js(t),r=[];return E(e,function(i,o){n(i,o)&&r.push(i)}),r}function E(e,t){let n,r;if(Fn(e))return;let i=U(e)?Gx:Wx;for(let o in e)if(ft(e,o)&&(n=e[o],r=t(n,i(o)),r===!1))return n}function Qf(e,t){if(Fn(e))return[];Vx(e);let n=Js(t);return e.filter(function(r,i){return!n(r,i)})}function Xe(e,t,n){return E(e,function(r,i){n=t(n,r,i)}),n}function hn(e,t){return!!Xe(e,function(n,r,i){return n&&t(r,i)},!0)}function It(e,t){return!!ne(e,t)}function Ve(e,t){let n=[];return E(e,function(r,i){n.push(t(r,i))}),n}function Zi(e){return e&&Object.keys(e)||[]}function Jf(e){return Zi(e).length}function Sn(e){return Ve(e,t=>t)}function Cn(e,t,n={}){return t=Zu(t),E(e,function(r){let i=t(r)||"_",o=n[i];o||(o=n[i]=[]),o.push(r)}),n}function Xu(e,...t){e=Zu(e);let n={};return E(t,i=>Cn(i,e,n)),Ve(n,function(i,o){return i[0]})}var ed=Xu;function Rt(e,t){t=Zu(t);let n=[];return E(e,function(r,i){let o=t(r,i),a={d:o,v:r};for(var s=0;sr.v)}function bt(e){return function(t){return hn(e,function(n,r){return t[r]===n})}}function Zu(e){return Le(e)?e:t=>t[e]}function Js(e){return Le(e)?e:t=>t===e}function Wx(e){return e}function Gx(e){return Number(e)}function ec(e,t){let n,r,i,o;function a(l){let f=Date.now(),d=l?0:o+t-f;if(d>0)return s(d);e.apply(i,r),c()}function s(l){n=setTimeout(a,l)}function c(){n&&clearTimeout(n),n=o=r=i=void 0}function p(){n&&a(!0),c()}function u(...l){o=Date.now(),r=l,i=this,n||s(t)}return u.flush=p,u.cancel=c,u}function nt(e,t){return e.bind(t)}function S(e,...t){return Object.assign(e,...t)}function td(e,t,n){let r=e;return E(t,function(i,o){if(typeof i!="number"&&typeof i!="string")throw new Error("illegal key type: "+typeof i+". Key should be of type number or string.");if(i==="constructor")throw new Error("illegal key: constructor");if(i==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=r[i];Ye(a)&&Tr(s)&&(s=r[i]=isNaN(+a)?{}:[]),Fn(a)?Fn(n)?delete r[i]:r[i]=n:r=s}),e}function dt(e,t){let n={},r=Object(e);return E(t,function(i){i in r&&(n[i]=e[i])}),n}function Mt(e,t){let n={},r=Object(e);return E(r,function(i,o){t.indexOf(o)===-1&&(n[o]=i)}),n}var st={legend:[1,"
","
"],tr:[2,"","
"],col:[2,"","
"],_default:[0,"",""]};st.td=st.th=[3,"","
"];st.option=st.optgroup=[1,'"];st.thead=st.tbody=st.colgroup=st.caption=st.tfoot=[1,"","
"];st.polyline=st.ellipse=st.polygon=st.circle=st.text=st.line=st.path=st.rect=st.g=[1,'',""];function _e(e,t=globalThis.document){var p;if(typeof e!="string")throw new TypeError("String expected");let n=/^$/s.exec(e);if(n)return t.createComment(n[1]);let r=(p=/<([\w:]+)/.exec(e))==null?void 0:p[1];if(!r)return t.createTextNode(e);if(e=e.trim(),r==="body"){let u=t.createElement("html");u.innerHTML=e;let{lastChild:l}=u;return l.remove(),l}let[i,o,a]=Object.hasOwn(st,r)?st[r]:st._default,s=t.createElement("div");for(s.innerHTML=o+e+a;i--;)s=s.lastChild;if(s.firstChild===s.lastChild){let{firstChild:u}=s;return u.remove(),u}let c=t.createDocumentFragment();return c.append(...s.childNodes),c}function Ux(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(r){if(r!=="default"&&!(r in e)){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}})}),Object.freeze(e)}function ct(e,...t){let n=e.style;return E(t,function(r){r&&E(r,function(i,o){n[o]=i})}),e}function Ze(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}var Kx=Object.prototype.toString;function ke(e){return new Mr(e)}function Mr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Mr.prototype.add=function(e){return this.list.add(e),this};Mr.prototype.remove=function(e){return Kx.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)};Mr.prototype.removeMatching=function(e){let t=this.array();for(let n=0;n"+e+"",t=!0);var n=rb(e);if(!t)return n;for(var r=document.createDocumentFragment(),i=n.firstChild;i.firstChild;)r.appendChild(i.firstChild);return r}function rb(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function G(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=ld(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(rl.svg,e),t&&H(n,t),n}var Qu=null;function tl(){return Qu===null&&(Qu=G("svg")),Qu}function ad(e,t){var n,r,i=Object.keys(t);for(n=0;r=i[n];n++)e[r]=t[r];return e}function fd(e,t,n,r,i,o){var a=tl().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return ad(a,e);case 6:return ad(a,{a:e,b:t,c:n,d:r,e:i,f:o})}}function Qi(e){return e?tl().createSVGTransformFromMatrix(e):tl().createSVGTransform()}var sd=/([&<>]{1})/g,ib=/([&<>\n\r"]{1})/g,ob={"&":"&","<":"<",">":">",'"':"'"};function Ju(e,t){function n(r,i){return ob[i]||i}return e.replace(t,n)}function dd(e,t){var n,r,i,o,a;switch(e.nodeType){case 3:t.push(Ju(e.textContent,sd));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(i=e.attributes,n=0,r=i.length;n"),a=e.childNodes,n=0,r=a.length;n")}else t.push("/>");break;case 8:t.push("");break;case 4:t.push("");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function ab(e,t){var n=ld(t);if(cr(e),!!t){cb(n)||(n=n.documentElement);for(var r=pb(n.childNodes),i=0;i{let i=r.match(gb);return(i&&i[1]||r).trim()})||[]}function sl(e,t){let n=t||{get:function(b,x){if(r.push(b),x===!1)return null;throw s(`No provider for "${b}"!`)}},r=[],i=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(b){let x=r.join(" -> ");return r.length=0,new Error(x?`${b} (Resolving: ${x})`:b)};function c(b,x){if(!i[b]&&b.includes(".")){let C=b.split("."),P=c(C.shift());for(;C.length;)P=P[C.shift()];return P}if(ol(o,b))return o[b];if(ol(i,b)){if(r.indexOf(b)!==-1)throw r.push(b),s("Cannot resolve circular dependency!");return r.push(b),o[b]=i[b][0](i[b][1]),r.pop(),o[b]}return n.get(b,x)}function p(b,x){if(typeof x=="undefined"&&(x={}),typeof b!="function")if(al(b))b=nc(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);let P=(b.$inject||vb(b)).map(O=>ol(x,O)?x[O]:c(O));return{fn:b,dependencies:P}}function u(b){let{fn:x,dependencies:C}=p(b),P=Function.prototype.bind.call(x,null,...C);return new P}function l(b,x,C){let{fn:P,dependencies:O}=p(b,C);return P.apply(x,O)}function f(b){return nc(x=>b.get(x))}function d(b,x){if(x&&x.length){let C=Object.create(null),P=Object.create(null),O=[],T=[],B=[],I,W,$,K;for(let he in i)I=i[he],x.indexOf(he)!==-1&&(I[2]==="private"?(W=O.indexOf(I[3]),W===-1?($=I[3].createChild([],x),K=f($),O.push(I[3]),T.push($),B.push(K),C[he]=[K,he,"private",$]):C[he]=[B[W],he,"private",T[W]]):C[he]=[I[2],I[1]],P[he]=!0),(I[2]==="factory"||I[2]==="type")&&I[1].$scope&&x.forEach(Gt=>{I[1].$scope.indexOf(Gt)!==-1&&(C[he]=[I[2],I[1]],P[Gt]=!0)});x.forEach(he=>{if(!P[he])throw new Error('No provider for "'+he+'". Cannot use provider from the parent!')}),b.unshift(C)}return new sl(b,a)}let h={factory:l,type:u,value:function(b){return b}};function y(b,x){let C=b.__init__||[];return function(){C.forEach(P=>{typeof P=="string"?x.get(P):x.invoke(P)})}}function v(b){let x=b.__exports__;if(x){let C=b.__modules__,P=Object.keys(b).reduce((W,$)=>($!=="__exports__"&&$!=="__modules__"&&$!=="__init__"&&$!=="__depends__"&&(W[$]=b[$]),W),Object.create(null)),O=(C||[]).concat(P),T=d(O),B=nc(function(W){return T.get(W)});x.forEach(function(W){i[W]=[B,W,"private",T]});let I=(b.__init__||[]).slice();return I.unshift(function(){T.init()}),b=Object.assign({},b,{__init__:I}),y(b,T)}return Object.keys(b).forEach(function(C){if(C==="__init__"||C==="__depends__")return;let P=b[C];if(P[2]==="private"){i[C]=P;return}let O=P[0],T=P[1];i[C]=[h[O],yb(O,T),O]}),y(b,a)}function w(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(w,b),b.indexOf(x)!==-1)?b:b.concat(x)}function R(b){let x=b.reduce(w,[]).map(v),C=!1;return function(){C||(C=!0,x.forEach(P=>P()))}}this.get=c,this.invoke=l,this.instantiate=u,this.createChild=d,this.init=R(e)}function yb(e,t){return e!=="value"&&al(t)&&(t=nc(t.slice())),t}var _b=1e3;function mn(e,t){var n=this;t=t||_b,e.on(["render.shape","render.connection"],t,function(r,i){var o=r.type,a=i.element,s=i.gfx,c=i.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(r,i){if(n.canRender(i))return r.type==="render.getShapePath"?n.getShapePath(i):n.getConnectionPath(i)})}mn.prototype.canRender=function(e){};mn.prototype.drawShape=function(e,t){};mn.prototype.drawConnection=function(e,t){};mn.prototype.getShapePath=function(e){};mn.prototype.getConnectionPath=function(e){};function pr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function xb(e){return["M",e.x,e.y]}function cl(e){return["L",e.x,e.y]}function bb(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function Eb(e,t){let n=e.length,r=[xb(e[0])];for(let i=1;ii||i===void 0)&&(i=c+l),(p+u>o||o===void 0)&&(o=p+u)}),{x:n,y:r,height:o-r,width:i-n}}function fi(e,t){var n={};return E(e,function(r){var i=r;i.waypoints&&(i=we(i)),!te(t.y)&&i.x>t.x&&(n[r.id]=r),!te(t.x)&&i.y>t.y&&(n[r.id]=r),i.x>t.x&&i.y>t.y&&(te(t.width)&&te(t.height)&&i.width+i.xt.x-n&&e.y>t.y-n&&e.x=1e3&&delete i[o.shift()],o.push(r),i[r]=e(...arguments),i[r])}return t}function kb(e){if(!e)return null;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=[];return String(e).replace(Ab,function(r,i,o){var a=[],s=i.toLowerCase();for(o.replace(Pb,function(c,p){p&&a.push(+p)}),s=="m"&&a.length>2&&(n.push([i,...a.splice(0,2)]),s="l",i=i=="m"?"l":"L");a.length>=t[s]&&(n.push([i,...a.splice(0,t[s])]),!!t[s]););}),n.toString=dl,n}function Nb(e){for(var t=0,n=e.length;t=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Ib(e,t){return e=fl(e),t=fl(t),Ir(t,e.x,e.y)||Ir(t,e.x2,e.y)||Ir(t,e.x,e.y2)||Ir(t,e.x2,e.y2)||Ir(e,t.x,t.y)||Ir(e,t.x2,t.y)||Ir(e,t.x,t.y2)||Ir(e,t.x2,t.y2)||(e.xt.x||t.xe.x)&&(e.yt.y||t.ye.y)}function wd(e,t,n,r,i){var o=-3*t+9*n-9*r+3*i,a=e*o+6*t-12*n+6*r;return e*a-3*t+3*n}function Sd(e,t,n,r,i,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var p=c/2,u=12,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;hWn(i,a)||Wn(t,r)Wn(o,s))){var c=(e*r-t*n)*(i-a)-(e-n)*(i*s-o*a),p=(e*r-t*n)*(o-s)-(t-r)*(i*s-o*a),u=(e-n)*(o-s)-(t-r)*(i-a);if(u){var l=sc(c/u),f=sc(p/u),d=+l.toFixed(2),h=+f.toFixed(2);if(!(d<+Vn(e,n).toFixed(2)||d>+Wn(e,n).toFixed(2)||d<+Vn(i,a).toFixed(2)||d>+Wn(i,a).toFixed(2)||h<+Vn(t,r).toFixed(2)||h>+Wn(t,r).toFixed(2)||h<+Vn(o,s).toFixed(2)||h>+Wn(o,s).toFixed(2)))return{x:l,y:f}}}}function sc(e){return Math.round(e*1e11)/1e11}function jb(e,t,n){var r=Ed(e),i=Ed(t);if(!Ib(r,i))return n?0:[];var o=Sd(...e),a=Sd(...t),s=Cd(e)?1:~~(o/5)||1,c=Cd(t)?1:~~(a/5)||1,p=new Array(s+1),u=new Array(c+1),l={},f=n?0:[],d,h;for(d=0;d=0&&T<=1&&B>=0&&B<=1&&(n?f++:f.push({x:P.x,y:P.y,t1:T,t2:B}))}}return f}function ya(e,t,n){e=Ad(e),t=Ad(t);for(var r,i,o,a,s,c,p,u,l,f,d=n?0:[],h=0,y=e.length;h1&&(w=it.sqrt(w),n=w*n,r=w*r);var R=n*n,b=r*r,x=(o==a?-1:1)*it.sqrt(Lr((R*b-R*v*v-b*y*y)/(R*v*v+b*y*y))),C=x*n*v/r+(e+s)/2,P=x*-r*y/n+(t+c)/2,O=it.asin(((t-P)/r).toFixed(9)),T=it.asin(((c-P)/r).toFixed(9));O=eT&&(O=O-Br*2),!a&&T>O&&(T=T-Br*2)}var B=T-O;if(Lr(B)>u){var I=T,W=s,$=c;T=O+u*(a&&T>O?1:-1),s=C+n*it.cos(T),c=P+r*it.sin(T),f=Pd(s,c,n,r,i,0,a,W,$,[T,I,C,P])}B=T-O;var K=it.cos(O),he=it.sin(O),Gt=it.cos(T),De=it.sin(T),ge=it.tan(B/4),de=4/3*n*ge,Ee=4/3*r*ge,Be=[e,t],Ke=[e+de*he,t-Ee*K],F=[s+de*De,c-Ee*Gt],z=[s,c];if(Ke[0]=2*Be[0]-Ke[0],Ke[1]=2*Be[1]-Ke[1],p)return[Ke,F,z].concat(f);f=[Ke,F,z].concat(f).join().split(",");for(var ie=[],xe=0,Bt=f.length;xe7){f[d].shift();for(var h=f[d];h.length;)o[d]="A",f.splice(d++,0,["C",...h.splice(0,6)]);f.splice(d,1),p=t.length}},o=[],a="",s="",c=0,p=t.length;c=i.right,s=r.top-n.y>=i.bottom,c=r.right+n.x<=i.left,p=o?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&p?p+"-"+u:u||p||"intersect"}function jr(e,t,n){var r=Wb(e,t);return r.length===1||r.length===2&&Or(r[0],r[1])<1?gn(r[0]):r.length>1?(r=Rt(r,function(i){var o=Math.floor(i.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,i.segment2+"#"+o}),gn(r[n?0:r.length-1])):null}function Wb(e,t){return ya(e,t)}function Td(e){e=e.slice();for(var t=0,n,r,i;e[t];)n=e[t],r=e[t-1],i=e[t+1],Or(n,i)===0||eo(r,i,n)?e.splice(t,1):t++;return e}function Gb(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function pc(e,t){return Math.round(e*t)/t}function Md(e){return te(e)?e+"px":e}function Ub(e){for(;e.parent;)e=e.parent;return e}function Kb(e){e=S({},{width:"100%",height:"100%"},e);let t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),ct(n,{position:"relative",overflow:"hidden",width:Md(e.width),height:Md(e.height)}),t.appendChild(n),n}function Dd(e,t,n){let r=G("g");ce(r).add(t);let i=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(r,e.childNodes[i]||null),r}var Yb="base",kd=0,qb=1,Xb={shape:["x","y","width","height"],connection:["waypoints"]};function pe(e,t,n,r){this._eventBus=t,this._elementRegistry=r,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}pe.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"];pe.prototype._init=function(e){let t=this._eventBus,n=this._container=Kb(e),r=this._svg=G("svg");H(r,{width:"100%",height:"100%"}),Ze(r,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),r.addEventListener("focusin",()=>{this._setFocused(!0)}),r.addEventListener("focusout",()=>{this._setFocused(!1)}),r.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),r.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Z(n,r);let i=this._viewport=Dd(r,"viewport");e.deferUpdate&&(this._viewboxChanged=ec(nt(this._viewboxChanged,this),300)),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:r,viewport:i})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)};pe.prototype._destroy=function(){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});let e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport};pe.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))};pe.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{let n=ic(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox};pe.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)};pe.prototype.restoreFocus=function(){document.activeElement===document.body&&this.focus()};pe.prototype.isFocused=function(){return this._focused};pe.prototype.getDefaultLayer=function(){return this.getLayer(Yb,kd)};pe.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t!="undefined"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group};pe.prototype._getChildIndex=function(e){return Xe(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)};pe.prototype._createLayer=function(e,t){typeof t=="undefined"&&(t=qb);let n=this._getChildIndex(t);return{group:Dd(this._viewport,"layer-"+e,n),index:t,visible:!0}};pe.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");let t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");let n=this._viewport,r=t.group,i=t.index;if(t.visible)return r;let o=this._getChildIndex(i);return n.insertBefore(r,n.childNodes[o]||null),t.visible=!0,r};pe.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");let t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");let n=t.group;return t.visible&&(Ce(n),t.visible=!1),n};pe.prototype._removeLayer=function(e){let t=this._layers[e];t&&(delete this._layers[e],Ce(t.group))};pe.prototype.getActiveLayer=function(){let e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null};pe.prototype.findRoot=function(e){return typeof e=="string"&&(e=this._elementRegistry.get(e)),e?(this._findPlaneForRoot(Ub(e))||{}).rootElement:void 0};pe.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})};pe.prototype._findPlaneForRoot=function(e){return ne(this._planes,function(t){return t.rootElement===e})};pe.prototype.getContainer=function(){return this._container};pe.prototype._updateMarker=function(e,t,n){let r;e.id||(e=this._elementRegistry.get(e)),e.markers=e.markers||new Set,r=this._elementRegistry._elements[e.id],r&&(E([r.gfx,r.secondaryGfx],function(i){i&&(n?(e.markers.add(t),ce(i).add(t)):(e.markers.delete(t),ce(i).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:r.gfx,marker:t,add:!!n}))};pe.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)};pe.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)};pe.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),e.markers?e.markers.has(t):!1};pe.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)};pe.prototype.getRootElement=function(){let e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))};pe.prototype.addRootElement=function(e){let t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});let n=e.layer="root-"+t;this._ensureValid("root",e);let r=this.getLayer(n,kd);return this.hideLayer(n),this._addRoot(e,r),this._planes.push({rootElement:e,layer:r}),e};pe.prototype.removeRootElement=function(e){if(typeof e=="string"&&(e=this._elementRegistry.get(e)),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e};pe.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e};pe.prototype._removeRoot=function(e){let t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)};pe.prototype._addRoot=function(e,t){let n=this._elementRegistry,r=this._eventBus;r.fire("root.add",{element:e}),n.add(e,t),r.fire("root.added",{element:e,gfx:t})};pe.prototype._setRoot=function(e,t){let n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})};pe.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 <"+t.id+"> already exists");let n=Xb[e];if(!hn(n,function(i){return typeof t[i]!="undefined"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)};pe.prototype._setParent=function(e,t,n){Re(t.children,e,n),e.parent=t};pe.prototype._addElement=function(e,t,n,r){n=n||this.getRootElement();let i=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),i.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,r);let a=o.create(e,t,r);return this._elementRegistry.add(t,a),o.update(e,t,a),i.fire(e+".added",{element:t,gfx:a}),t};pe.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)};pe.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)};pe.prototype._removeElement=function(e,t){let n=this._elementRegistry,r=this._graphicsFactory,i=this._eventBus;if(e=n.get(e.id||e),!!e)return i.fire(t+".remove",{element:e}),r.remove(e),Ne(e.parent&&e.parent.children,e),e.parent=null,i.fire(t+".removed",{element:e}),n.remove(e),e};pe.prototype.removeShape=function(e){return this._removeElement(e,"shape")};pe.prototype.removeConnection=function(e){return this._removeElement(e,"connection")};pe.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)};pe.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()};pe.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})};pe.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);let t=this._viewport,n=this.getSize(),r,i,o,a,s,c,p;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);let u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);li(t,u)});else return o=this._rootElement?this.getActiveLayer():null,r=o&&o.getBBox()||{},a=li(t),i=a?a.matrix:fd(),s=pc(i.a,1e3),c=pc(-i.e||0,1e3),p=pc(-i.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:p?p/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:r.width||0,height:r.height||0,x:r.x||0,y:r.y||0},outer:n},e;return e};pe.prototype.scroll=function(e){let t=this._viewport,n=t.getCTM();return e&&this._changeViewbox(function(){e=S({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Nd(t,n)}),{x:n.e,y:n.f}};pe.prototype.scrollToElement=function(e,t){let n=100;typeof e=="string"&&(e=this._elementRegistry.get(e));let r=this.findRoot(e);if(r!==this.getRootElement()&&this.setRootElement(r),r===e)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};let i=we(e),o=X(i),a=this.viewbox(),s=this.zoom(),c,p;a.y+=t.top/s,a.x+=t.left/s,a.width-=(t.right+t.left)/s,a.height-=(t.bottom+t.top)/s;let u=X(a);if(!(i.width=0&&r.y>=0&&r.x+r.width<=n.width&&r.y+r.height<=n.height&&!e?o={x:0,y:0,width:Math.max(r.width+r.x,n.width),height:Math.max(r.height+r.y,n.height)}:(i=Math.min(1,n.width/r.width,n.height/r.height),o={x:r.x+(e?r.width/2-n.width/i/2:0),y:r.y+(e?r.height/2-n.height/i/2:0),width:n.width/i,height:n.height/i}),this.viewbox(o),this.viewbox(!1).scale};pe.prototype._setZoom=function(e,t){let n=this._svg,r=this._viewport,i=n.createSVGMatrix(),o=n.createSVGPoint(),a,s,c,p,u;c=r.getCTM();let l=c.a;return t?(a=S(o,t),s=a.matrixTransform(c.inverse()),p=i.translate(s.x,s.y).scale(1/l*e).translate(-s.x,-s.y),u=c.multiply(p)):u=i.scale(e),Nd(this._viewport,u),u};pe.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}};pe.prototype.getAbsoluteBBox=function(e){let t=this.viewbox(),n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;let r=n.x*t.scale-t.x*t.scale,i=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:r,y:i,width:o,height:a}};pe.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var to="data-element-id";function jt(e){this._elements={},this._eventBus=e}jt.$inject=["eventBus"];jt.prototype.add=function(e,t,n){var r=e.id;this._validateId(r),H(t,to,r),n&&H(n,to,r),this._elements[r]={element:e,gfx:t,secondaryGfx:n}};jt.prototype.remove=function(e){var t=this._elements,n=e.id||e,r=n&&t[n];r&&(H(r.gfx,to,""),r.secondaryGfx&&H(r.secondaryGfx,to,""),delete t[n])};jt.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),r=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,r)};jt.prototype.updateGraphics=function(e,t,n){var r=e.id||e,i=this._elements[r];return n?i.secondaryGfx=t:i.gfx=t,t&&H(t,to,r),t};jt.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&H(e,to);var n=this._elements[t];return n&&n.element};jt.prototype.filter=function(e){var t=[];return this.forEach(function(n,r){e(n,r)&&t.push(n)}),t};jt.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),r=0;r in ref");t=this.props[t]}t.collection?Od(this,t,e):eE(this,t,e)};tn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return Qb(n)||Od(this,t,e),n};tn.prototype.ensureBound=function(e,t){Jb(e,t)||this.bind(e,t)};tn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)};tn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var hl=new tn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Id=new tn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Bd=new tn({name:"attachers",collection:!0},{name:"host"}),Ld=new tn({name:"outgoing",collection:!0},{name:"source"}),jd=new tn({name:"incoming",collection:!0},{name:"target"});function no(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),hl.bind(this,"parent"),Id.bind(this,"labels"),Ld.bind(this,"outgoing"),jd.bind(this,"incoming")}function _a(){no.call(this),hl.bind(this,"children"),Bd.bind(this,"host"),Bd.bind(this,"attachers")}N(_a,no);function Fd(){no.call(this),hl.bind(this,"children")}N(Fd,_a);function Hd(){_a.call(this),Id.bind(this,"labelTarget")}N(Hd,_a);function $d(){no.call(this),Ld.bind(this,"source"),jd.bind(this,"target")}N($d,no);var tE={connection:$d,shape:_a,label:Hd,root:Fd};function zd(e,t){var n=tE[e];if(!n)throw new Error("unknown type: <"+e+">");return S(new n,t)}function Vd(e){return e instanceof no}function vn(){this._uid=12}vn.prototype.createRoot=function(e){return this.create("root",e)};vn.prototype.createLabel=function(e){return this.create("label",e)};vn.prototype.createShape=function(e){return this.create("shape",e)};vn.prototype.createConnection=function(e){return this.create("connection",e)};vn.prototype.create=function(e,t){return t=S({},t||{}),t.id||(t.id=e+"_"+this._uid++),zd(e,t)};var uc="__fn",Wd=1e3,nE=Array.prototype.slice;function Dt(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Dt.prototype.on=function(e,t,n,r){if(e=U(e)?e:[e],Le(t)&&(r=n,n=t,t=Wd),!te(t))throw new Error("priority must be a number");var i=n;r&&(i=nt(n,r),i[uc]=n[uc]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:i,next:null})})};Dt.prototype.once=function(e,t,n,r){var i=this;if(Le(t)&&(r=n,n=t,t=Wd),!te(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(r,arguments);return i.off(e,o),a}o[uc]=n,this.on(e,t,o)};Dt.prototype.off=function(e,t){e=U(e)?e:[e];var n=this;e.forEach(function(r){n._removeListener(r,t)})};Dt.prototype.createEvent=function(e){var t=new xa;return t.init(e),t};Dt.prototype.fire=function(e,t){var n,r,i,o;if(o=nE.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(r=this._listeners[e],!!r){t instanceof xa?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{i=this._invokeListeners(n,o,r)}finally{e!==a&&(n.type=a)}return i===void 0&&n.defaultPrevented&&(i=!1),i}};Dt.prototype.handleError=function(e){return this.fire("error",{error:e})===!1};Dt.prototype._destroy=function(){this._listeners={}};Dt.prototype._invokeListeners=function(e,t,n){for(var r;n&&!e.cancelBubble;)r=this._invokeListener(e,t,n),n=n.next;return r};Dt.prototype._invokeListener=function(e,t,n){var r;if(n.callback.__isTomb)return r;try{r=rE(n.callback,t),r!==void 0&&(e.returnValue=r,e.stopPropagation()),r===!1&&e.preventDefault()}catch(i){if(!this.handleError(i))throw console.error("unhandled error in event listener",i),i}return r};Dt.prototype._addListener=function(e,t){var n=this._getListeners(e),r;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority or , got "+e);return e=(i?i+":":"")+r,{name:e,prefix:i,localName:r}}function nn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}nn.prototype.build=function(){return dt(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])};nn.prototype.addProperty=function(e,t,n){typeof t=="boolean"&&(n=t,t=void 0),this.addNamedProperty(e,n!==!1);var r=this.properties;t!==void 0?r.splice(t,0,e):r.push(e)};nn.prototype.replaceProperty=function(e,t,n){var r=e.ns,i=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=i.indexOf(e);if(s===-1)throw new Error("property <"+r.name+"> not found in property list");i.splice(s,1),this.addProperty(t,n?void 0:s,a),o[r.name]=o[r.localName]=t};nn.prototype.redefineProperty=function(e,t,n){var r=e.ns.prefix,i=t.split("#"),o=Et(i[0],r),a=Et(i[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines};nn.prototype.addNamedProperty=function(e,t){var n=e.ns,r=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),r[n.name]=r[n.localName]=e};nn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]};nn.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};nn.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};nn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)};nn.prototype.assertNotDefined=function(e,t){var n=e.name,r=this.propertiesByName[n];if(r)throw new Error("property <"+n+"> already defined; override of <"+r.definedBy.ns.name+"#"+r.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")};nn.prototype.hasProperty=function(e){return this.propertiesByName[e]};nn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,r=this.allTypes,i=e.name;i in n||(E(e.properties,nt(function(o){o=S({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),r.push(e),n[i]=e)};function Fr(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,E(e,nt(this.registerPackage,this))}Fr.prototype.getPackage=function(e){return this.packageMap[e]};Fr.prototype.getPackages=function(){return this.packages};Fr.prototype.registerPackage=function(e){e=S({},e);var t=this.packageMap;Yd(t,e,"prefix"),Yd(t,e,"uri"),E(e.types,nt(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)};Fr.prototype.registerType=function(e,t){e=S({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:S(e.meta||{})});var n=Et(e.name,t.prefix),r=n.name,i={};E(e.properties,nt(function(o){var a=Et(o.name,n.prefix),s=a.name;ml(o.type)||(o.type=Et(o.type,a.prefix).name),S(o,{ns:a,name:s}),i[s]=o},this)),S(e,{ns:n,name:r,propertiesByName:i}),E(e.extends,nt(function(o){var a=Et(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(r)},this)),this.definePackage(e,t),this.typeMap[r]=e};Fr.prototype.mapTypes=function(e,t,n){var r=ml(e.name)?{name:e.name}:this.typeMap[e.name],i=this;function o(c,p){var u=Et(c,ml(c)?"":e.prefix);i.mapTypes(u,t,p)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!r)throw new Error("unknown type <"+e.name+">");E(r.superClass,n?a:s),t(r,!n),E(r.traits,a)};Fr.prototype.getEffectiveDescriptor=function(e){var t=Et(e),n=new nn(t);this.mapTypes(t,function(i,o){n.addTrait(i,o)});var r=n.build();return this.definePackage(r,r.allTypes[r.allTypes.length-1].$pkg),r};Fr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Yd(e,t,n){var r=t[n];if(r in e)throw new Error("package with "+n+" <"+r+"> already defined")}function hi(e){this.model=e}hi.prototype.set=function(e,t,n){if(!rt(t)||!t.length)throw new TypeError("property name must be a non-empty string");var r=this.getProperty(e,t),i=r&&r.name;sE(n)?r?delete e[i]:delete e.$attrs[gl(t)]:r?i in e?e[i]=n:Zd(e,r,n):e.$attrs[gl(t)]=n};hi.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[gl(t)];var r=n.name;return!e[r]&&n.isMany&&Zd(e,n,[]),e[r]};hi.prototype.define=function(e,t,n){if(!n.writable){var r=n.value;n=S({},n,{get:function(){return r}}),delete n.value}Object.defineProperty(e,t,n)};hi.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})};hi.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})};hi.prototype.getProperty=function(e,t){var n=this.model,r=n.getPropertyDescriptor(e,t);if(r)return r;if(t.includes(":"))return null;let i=n.config.strict;if(typeof i!="undefined"){let o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(i)throw o;typeof console!="undefined"&&console.warn(o)}return null};function sE(e){return typeof e=="undefined"}function Zd(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function gl(e){return e.replace(/^:/,"")}function Kt(e,t={}){this.properties=new hi(this),this.factory=new qd(this,this.properties),this.registry=new Fr(e,this.properties),this.typeCache={},this.config=t}Kt.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)};Kt.prototype.getType=function(e){var t=this.typeCache,n=rt(e)?e:e.ns.name,r=t[n];return r||(e=this.registry.getEffectiveDescriptor(n),r=t[n]=this.factory.createType(e)),r};Kt.prototype.createAny=function(e,t,n){var r=Et(e),i={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){td(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:r.prefix,localName:r.localName,uri:t}};return this.properties.defineDescriptor(i,o),this.properties.defineModel(i,this),this.properties.define(i,"get",{enumerable:!1,writable:!0}),this.properties.define(i,"set",{enumerable:!1,writable:!0}),this.properties.define(i,"$parent",{enumerable:!1,writable:!0}),this.properties.define(i,"$instanceOf",{enumerable:!1,writable:!0}),E(n,function(a,s){Pe(a)&&a.value!==void 0?i[a.name]=a.value:i[s]=a}),i};Kt.prototype.getPackage=function(e){return this.registry.getPackage(e)};Kt.prototype.getPackages=function(){return this.registry.getPackages()};Kt.prototype.getElementDescriptor=function(e){return e.$descriptor};Kt.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName};Kt.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]};Kt.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Qd=String.fromCharCode,cE=Object.prototype.hasOwnProperty,pE=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ba={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ba).forEach(function(e){ba[e.toUpperCase()]=ba[e]});function uE(e,t,n,r){return r?cE.call(ba,r)?ba[r]:"&"+r+";":Qd(t||parseInt(n,16))}function mi(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(pE,uE):e}var Jd="non-whitespace outside of root node";function io(e){return new Error(e)}function eh(e){return"missing namespace for prefix <"+e+">"}function dc(e){return{get:e,enumerable:!0}}function lE(e){var t={},n;for(n in e)t[n]=e[n];return t}function _l(e){return e+"$uri"}function fE(e){var t={},n,r;for(n in e)r=e[n],t[r]=r,t[_l(r)]=n;return t}function th(){return{line:0,column:0}}function dE(e){throw e}function xl(e){if(!this)return new xl(e);var t=e&&e.proxy,n,r,i,o,a=dE,s,c,p,u,l=th,f=!1,d=!1,h=null,y=!1,v;function w(x){x instanceof Error||(x=io(x)),h=x,a(x,l)}function R(x){s&&(x instanceof Error||(x=io(x)),s(x,l))}this.on=function(x,C){if(typeof C!="function")throw io("required args ");switch(x){case"openTag":r=C;break;case"text":n=C;break;case"closeTag":i=C;break;case"error":a=C;break;case"warn":s=C;break;case"cdata":o=C;break;case"attention":u=C;break;case"question":p=C;break;case"comment":c=C;break;default:throw io("unsupported event: "+x)}return this},this.ns=function(x){if(typeof x=="undefined"&&(x={}),typeof x!="object")throw io("required args ");var C={},P;for(P in x)C[P]=x[P];return d=!0,v=C,this},this.parse=function(x){if(typeof x!="string")throw io("required args ");return h=null,b(x),l=th,y=!1,h},this.stop=function(){y=!0};function b(x){var C=d?[]:null,P=d?fE(v):null,O,T=[],B=0,I=!1,W=!1,$=0,K=0,he,Gt,De,ge,de,Ee,Be,Ke,F,z="",ie=0,xe;function Bt(){if(xe!==null)return xe;var _,g,M,D=d&&P.xmlns,j=d&&f?[]:null,V=ie,oe=z,ye=oe.length,at,tt,yt,fn,Oe,sr={},Zs={},en,fe,Ae;e:for(;V8)){for((fe<65||fe>122||fe>90&&fe<97)&&fe!==95&&fe!==58&&(R("illegal first char attribute name"),en=!0),Ae=V+1;Ae96&&fe<123||fe>64&&fe<91||fe>47&&fe<59||fe===46||fe===45||fe===95)){if(fe===32||fe<14&&fe>8){R("missing attribute value"),V=Ae;continue e}if(fe===61)break;R("illegal attribute name char"),en=!0}if(Oe=oe.substring(V,Ae),Oe==="xmlns:xmlns"&&(R("illegal declaration of xmlns"),en=!0),fe=oe.charCodeAt(Ae+1),fe===34)Ae=oe.indexOf('"',V=Ae+2),Ae===-1&&(Ae=oe.indexOf("'",V),Ae!==-1&&(R("attribute value quote missmatch"),en=!0));else if(fe===39)Ae=oe.indexOf("'",V=Ae+2),Ae===-1&&(Ae=oe.indexOf('"',V),Ae!==-1&&(R("attribute value quote missmatch"),en=!0));else for(R("missing attribute value quotes"),en=!0,Ae=Ae+1;Ae8));Ae++);for(Ae===-1&&(R("missing closing quotes"),Ae=ye,en=!0),en||(yt=oe.substring(V,Ae)),V=Ae;Ae+18));Ae++)V===Ae&&(R("illegal character after attribute end"),en=!0);if(V=Ae+1,en)continue e;if(Oe in Zs){R("attribute <"+Oe+"> already defined");continue}if(Zs[Oe]=!0,!d){sr[Oe]=yt;continue}if(f){if(tt=Oe==="xmlns"?"xmlns":Oe.charCodeAt(0)===120&&Oe.substr(0,6)==="xmlns:"?Oe.substr(6):null,tt!==null){if(_=mi(yt),g=_l(tt),fn=v[_],!fn){if(tt==="xmlns"||g in P&&P[g]!==_)do fn="ns"+B++;while(typeof P[fn]!="undefined");else fn=tt;v[_]=fn}P[tt]!==fn&&(at||(P=lE(P),at=!0),P[tt]=fn,tt==="xmlns"&&(P[_l(fn)]=_,D=fn),P[g]=_),sr[Oe]=yt;continue}j.push(Oe,yt);continue}if(fe=Oe.indexOf(":"),fe===-1){sr[Oe]=yt;continue}if(!(M=P[Oe.substring(0,fe)])){R(eh(Oe.substring(0,fe)));continue}Oe=D===M?Oe.substr(fe+1):M+Oe.substr(fe),sr[Oe]=yt}if(f)for(V=0,ye=j.length;V=D&&(V=_.exec(x),!(!V||(j=V[0].length+V.index,j>$)));)g+=1,D=j;return $==-1?(M=j,oe=x.substring(K)):K===0?oe=x.substring(K,$):(M=$-D,oe=K==-1?x.substring($):x.substring($,K+1)),{data:oe,line:g,column:M}}for(l=A,t&&(F=Object.create({},{name:dc(function(){return Be}),originalName:dc(function(){return Ke}),attrs:dc(Bt),ns:dc(function(){return P})}));K!==-1;){if(x.charCodeAt(K)===60?$=K:$=x.indexOf("<",K),$===-1){if(T.length)return w("unexpected end of file");if(K===0)return w("missing start tag");K",$),K===-1)return w("unclosed cdata");if(o&&(o(x.substring($+9,K),l),y))return;K+=3;continue}if(De===45&&x.charCodeAt($+3)===45){if(K=x.indexOf("-->",$),K===-1)return w("unclosed comment");if(c&&(c(x.substring($+4,K),mi,l),y))return;K+=3;continue}}if(ge===63){if(K=x.indexOf("?>",$),K===-1)return w("unclosed question");if(p&&(p(x.substring($,K+2),l),y))return;K+=2;continue}for(he=$+1;;he++){if(de=x.charCodeAt(he),isNaN(de))return K=-1,w("unclosed tag");if(de===34)De=x.indexOf('"',he+1),he=De!==-1?De:he;else if(de===39)De=x.indexOf("'",he+1),he=De!==-1?De:he;else if(de===62){K=he;break}}if(ge===33){if(u&&(u(x.substring($,K+1),mi,l),y))return;K+=1;continue}if(xe={},ge===47){if(I=!1,W=!0,!T.length)return w("missing open tag");if(he=Be=T.pop(),De=$+2+he.length,x.substring($+2,De)!==he)return w("closing tag mismatch");for(;De8&&ge<14))return w("close tag")}else{if(x.charCodeAt(K-1)===47?(he=Be=x.substring($+1,K-1),I=!0,W=!0):(he=Be=x.substring($+1,K),I=!0,W=!1),!(ge>96&&ge<123||ge>64&&ge<91||ge===95||ge===58))return w("illegal first char nodeName");for(De=1,Gt=he.length;De96&&ge<123||ge>64&&ge<91||ge>47&&ge<59||ge===45||ge===95||ge==46)){if(ge===32||ge<14&&ge>8){Be=he.substring(0,De),xe=null;break}return w("invalid nodeName")}W||T.push(Be)}if(d){if(O=P,I&&(W||C.push(O),xe===null&&(f=he.indexOf("xmlns",De)!==-1)&&(ie=De,z=he,Bt(),f=!1)),Ke=Be,ge=Be.indexOf(":"),ge!==-1){if(Ee=P[Be.substring(0,ge)],!Ee)return w("missing namespace on <"+Ke+">");Be=Be.substr(ge+1)}else Ee=P.xmlns;Ee&&(Be=Ee+":"+Be)}if(I&&(ie=De,z=he,r&&(t?r(F,mi,W,l):r(Be,Bt,mi,W,l),y)))return;if(W){if(i&&(i(t?F:Be,mi,I,l),y))return;d&&(I?P=O:P=C.pop())}K+=1}}}function nh(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var bl={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},rh="property";function ih(e){return e.xml&&e.xml.serialize}function hE(e){let t=ih(e);return t!==rh&&(t||null)}function mE(e){return e.charAt(0).toUpperCase()+e.slice(1)}function oh(e,t){return nh(t)?e.prefix+":"+mE(e.localName):e.name}function gE(e,t){var n=e.name,r=e.localName,i=t&&t.xml&&t.xml.typePrefix;return i&&r.indexOf(i)===0?e.prefix+":"+r.slice(i.length):n}function vE(e,t,n){let r=Et(e,t.xmlns),i=`${t[r.prefix]||r.prefix}:${r.localName}`,o=Et(i);var a=n.getPackage(o.prefix);return gE(o,a)}function Hr(e){return new Error(e)}function ur(e){return e.$descriptor}function yE(e){S(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Hr("expected element");var n=this.elementsById,r=ur(t),i=r.idProperty,o;if(i&&(o=t.get(i.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Hr("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Ea(){}Ea.prototype.handleEnd=function(){};Ea.prototype.handleText=function(){};Ea.prototype.handleNode=function(){};function El(){}El.prototype=Object.create(Ea.prototype);El.prototype.handleNode=function(){return this};function ao(){}ao.prototype=Object.create(Ea.prototype);ao.prototype.handleText=function(e){this.body=(this.body||"")+e};function wa(e,t){this.property=e,this.context=t}wa.prototype=Object.create(ao.prototype);wa.prototype.handleNode=function(e){if(this.element)throw Hr("expected no sub nodes");return this.element=this.createReference(e),this};wa.prototype.handleEnd=function(){this.element.id=this.body};wa.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function wl(e,t){this.element=t,this.propertyDesc=e}wl.prototype=Object.create(ao.prototype);wl.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=fc(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function hc(){}hc.prototype=Object.create(ao.prototype);hc.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};function kt(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}kt.prototype=Object.create(hc.prototype);kt.prototype.addReference=function(e){this.context.addReference(e)};kt.prototype.handleText=function(e){var t=this.element,n=ur(t),r=n.bodyProperty;if(!r)throw Hr("unexpected body text <"+e+">");ao.prototype.handleText.call(this,e)};kt.prototype.handleEnd=function(){var e=this.body,t=this.element,n=ur(t),r=n.bodyProperty;r&&e!==void 0&&(e=fc(r.type,e),t.set(r.name,e))};kt.prototype.createElement=function(e){var t=e.attributes,n=this.type,r=ur(n),i=this.context,o=new n({}),a=this.model,s;return E(t,function(c,p){var u=r.propertiesByName[p],l;u&&u.isReference?u.isMany?(l=c.split(" "),E(l,function(f){i.addReference({element:o,property:u.ns.name,id:f})})):i.addReference({element:o,property:u.ns.name,id:c}):(u?c=fc(u.type,c):p==="xmlns"?p=":"+p:(s=Et(p,r.ns.prefix),a.getPackage(s.prefix)&&i.addWarning({message:"unknown attribute <"+p+">",element:o,property:p,value:c})),o.set(p,c))}),o};kt.prototype.getPropertyForNode=function(e){var t=e.name,n=Et(t),r=this.type,i=this.model,o=ur(r),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){let p=hE(s);if(p){let u=e.attributes[p];if(u){let l=vE(u,e.ns,i),f=i.getType(l);return S({},s,{effectiveType:ur(f).name})}}return s}var c=i.getPackage(n.prefix);if(c){let p=oh(n,c),u=i.getType(p);if(s=ne(o.properties,function(l){return!l.isVirtual&&!l.isReference&&!l.isAttribute&&u.hasType(l.type)}),s)return S({},s,{effectiveType:ur(u).name})}else if(s=ne(o.properties,function(p){return!p.isReference&&!p.isAttribute&&p.type==="Element"}),s)return s;throw Hr("unrecognized element <"+n.name+">")};kt.prototype.toString=function(){return"ElementDescriptor["+ur(this.type).name+"]"};kt.prototype.valueHandler=function(e,t){return new wl(e,t)};kt.prototype.referenceHandler=function(e){return new wa(e,this.context)};kt.prototype.handler=function(e){return e==="Element"?new oo(this.model,e,this.context):new kt(this.model,e,this.context)};kt.prototype.handleChild=function(e){var t,n,r,i;if(t=this.getPropertyForNode(e),r=this.element,n=t.effectiveType||t.type,yl(n))return this.valueHandler(t,r);t.isReference?i=this.referenceHandler(t).handleNode(e):i=this.handler(n).handleNode(e);var o=i.element;return o!==void 0&&(t.isMany?r.get(t.name).push(o):r.set(t.name,o),t.isReference?(S(o,{element:r}),this.context.addReference(o)):o.$parent=r),i};function Sl(e,t,n){kt.call(this,e,t,n)}Sl.prototype=Object.create(kt.prototype);Sl.prototype.createElement=function(e){var t=e.name,n=Et(t),r=this.model,i=this.type,o=r.getPackage(n.prefix),a=o&&oh(n,o)||t;if(!i.hasType(a))throw Hr("unexpected element <"+e.originalName+">");return kt.prototype.createElement.call(this,e)};function oo(e,t,n){this.model=e,this.context=n}oo.prototype=Object.create(hc.prototype);oo.prototype.createElement=function(e){var t=e.name,n=Et(t),r=n.prefix,i=e.ns[r+"$uri"],o=e.attributes;return this.model.createAny(t,i,o)};oo.prototype.handleChild=function(e){var t=new oo(this.model,"Element",this.context).handleNode(e),n=this.element,r=t.element,i;return r!==void 0&&(i=n.$children=n.$children||[],i.push(r),r.$parent=n),t};oo.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function mc(e){e instanceof Kt&&(e={model:e}),S(this,{lax:!1},e)}mc.prototype.fromXML=function(e,t,n){var r=t.rootHandler;t instanceof kt?(r=t,t={}):typeof t=="string"?(r=this.handler(t),t={}):typeof r=="string"&&(r=this.handler(r));var i=this.model,o=this.lax,a=new yE(S({},t,{rootHandler:r})),s=new xl({proxy:!0}),c=_E();r.context=a,c.push(r);function p(C,P,O){var T=P(),B=T.line,I=T.column,W=T.data;W.charAt(0)==="<"&&W.indexOf(" ")!==-1&&(W=W.slice(0,W.indexOf(" "))+">");var $="unparsable content "+(W?W+" ":"")+`detected line: `+B+` column: `+I+` nested error: `+C.message;if(O)return a.addWarning({message:$,error:C}),!0;throw Hr($)}function u(C,P){return p(C,P,!0)}function l(){var C=a.elementsById,P=a.references,O,T;for(O=0;T=P[O];O++){var B=T.element,I=C[T.id],W=ur(B).propertiesByName[T.property];if(I||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),W.isMany){var $=B.get(W.name),K=$.indexOf(T);K===-1&&(K=$.length),I?$[K]=I:$.splice(K,1)}else B.set(W.name,I)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,y=/^utf-8$/i;function v(C){if(d.test(C)){var P=h.exec(C),O=P&&P[1];!O||y.test(O)||a.addWarning({message:"unsupported document encoding <"+O+">, falling back to UTF-8"})}}function w(C,P){var O=c.peek();try{c.push(O.handleNode(C))}catch(T){p(T,P,o)&&c.push(new El)}}function R(C,P){try{c.peek().handleText(C)}catch(O){u(O,P)}}function b(C,P){C.trim()&&R(C,P)}var x=i.getPackages().reduce(function(C,P){return C[P.uri]=P.prefix,C},Object.entries(bl).reduce(function(C,[P,O]){return C[O]=P,C},i.config&&i.config.nsMap||{}));return s.ns(x).on("openTag",function(C,P,O,T){var B=C.attrs||{},I=Object.keys(B).reduce(function($,K){var he=P(B[K]);return $[K]=he,$},{}),W={name:C.name,originalName:C.originalName,attributes:I,ns:C.ns};w(W,T)}).on("question",v).on("closeTag",f).on("cdata",R).on("text",function(C,P,O){b(P(C),O)}).on("error",p).on("warn",u),new Promise(function(C,P){var O;try{s.parse(e),l()}catch($){O=$}var T=r.element;!O&&!T&&(O=Hr("failed to parse document as <"+r.type.$descriptor.name+">"));var B=a.warnings,I=a.references,W=a.elementsById;return O?(O.warnings=B,P(O)):C({rootElement:T,elementsById:W,references:I,warnings:B})})};mc.prototype.handler=function(e){return new Sl(this.model,e)};function _E(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var xE=` `,bE=/<|>|'|"|&|\n\r|\n/g,ah=/<|>|&/g;function Un(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Un.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e};Un.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]};Un.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)};Un.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)};Un.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)};Un.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t};Un.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri};Un.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)};Un.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var r=this.getNSKey(n);return this.used[r]})};function EE(e){return e.charAt(0).toLowerCase()+e.slice(1)}function wE(e,t){return nh(t)?EE(e):e}function sh(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ch(e){return rt(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function SE(e){return e.getUsed().filter(function(t){return t.prefix!=="xml"}).map(function(t){var n="xmlns"+(t.prefix?":"+t.prefix:"");return{name:n,value:t.uri}})}function CE(e,t){return t.isGeneric?S({localName:t.ns.localName},e):S({localName:wE(t.ns.localName,t.$pkg)},e)}function RE(e,t){return S({localName:t.ns.localName},e)}function AE(e){var t=e.$descriptor;return Q(t.properties,function(n){var r=n.name;if(n.isVirtual||!ft(e,r))return!1;var i=e[r];return i===n.default||i===null?!1:n.isMany?i.length:!0})}var PE={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},TE={"<":"lt",">":"gt","&":"amp"};function ph(e,t,n){return e=rt(e)?e:""+e,e.replace(t,function(r){return"&"+n[r]+";"})}function ME(e){return ph(e,bE,PE)}function DE(e){return ph(e,ah,TE)}function kE(e){return Q(e,function(t){return t.isAttr})}function NE(e){return Q(e,function(t){return!t.isAttr})}function Cl(e){this.tagName=e}Cl.prototype.build=function(e){return this.element=e,this};Cl.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"").appendNewLine()};function gi(){}gi.prototype.serializeValue=gi.prototype.serializeTo=function(e){e.append(this.escape?DE(this.value):this.value)};gi.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(ah)!==-1&&(this.escape=!0),this};function Rl(e){this.tagName=e}sh(Rl,gi);Rl.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("").appendNewLine()};function We(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}We.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,r,i,o=t.isGeneric;return o?r=this.parseGenericNsAttributes(e):r=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),o?this.parseGenericContainments(e):(i=AE(e),this.parseAttributes(kE(i)),this.parseContainments(NE(i))),this.parseGenericAttributes(e,r),this};We.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return CE(t,e)};We.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return RE(t,e)};We.prototype.isLocalNs=function(e){return e.uri===this.ns.uri};We.prototype.nsAttributeName=function(e){var t;if(rt(e)?t=Et(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:S({localName:t.localName},n)};We.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))};We.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new gi().build({type:"String"},t));var n=e.$children;n&&E(n,r=>{this.body.push(new We(this).build(r))})};We.prototype.parseNsAttribute=function(e,t,n){var r=e.$model,i=Et(t),o;if(i.prefix==="xmlns"&&(o={prefix:i.localName,uri:n}),!i.prefix&&i.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(r&&r.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}};We.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,r=[];return E(n,function(i,o){var a=t.parseNsAttribute(e,o,i);a&&r.push(a)}),r};We.prototype.parseGenericAttributes=function(e,t){var n=this;E(t,function(r){try{n.addAttribute(n.nsAttributeName(r.name),r.value)}catch(i){typeof console!="undefined"&&console.warn(`missing namespace information for <${r.name}=${r.value}> on`,e,i)}})};We.prototype.parseContainments=function(e){var t=this,n=this.body,r=this.element;E(e,function(i){var o=r.get(i.name),a=i.isReference,s=i.isMany;if(s||(o=[o]),i.isBody)n.push(new gi().build(i,o[0]));else if(yl(i.type))E(o,function(p){n.push(new Rl(t.addTagName(t.nsPropertyTagName(i))).build(i,p))});else if(a)E(o,function(p){n.push(new Cl(t.addTagName(t.nsPropertyTagName(i))).build(p))});else{var c=ih(i);E(o,function(p){var u;c?c===rh?u=new We(t,i):u=new gc(t,i,c):u=new We(t),n.push(u.build(p))})}})};We.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,r;return t||(r=n&&n.getNamespaces(),e||!r?this.namespaces=t=new Un(r):t=r),t};We.prototype.logNamespace=function(e,t,n){var r=this.getNamespaces(n),i=e.uri,o=e.prefix,a=r.byUri(i);return(!a||n)&&r.add(e,t),r.mapPrefix(o,i),e};We.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),r=e.prefix,i=e.uri,o,a,s;if(!r&&!i)return{localName:e.localName};if(s=n.defaultUriByPrefix(r),i=i||s||n.uriByPrefix(r),!i)throw new Error("no namespace uri given for prefix <"+r+">");if(e=n.byUri(i),!e&&!r&&(e=this.logNamespace({uri:i},s===i,!0)),!e){for(o=r,a=1;n.uriByPrefix(o);)o=r+"_"+a++;e=this.logNamespace({prefix:o,uri:i},s===i)}return r&&n.mapPrefix(r,i),e};We.prototype.parseAttributes=function(e){var t=this,n=this.element;E(e,function(r){var i=n.get(r.name);if(r.isReference)if(!r.isMany)i=i.id;else{var o=[];E(i,function(a){o.push(a.id)}),i=o.join(" ")}t.addAttribute(t.nsAttributeName(r),i)})};We.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ch(e)};We.prototype.addAttribute=function(e,t){var n=this.attrs;rt(t)&&(t=ME(t));var r=Qs(n,function(o){return o.name.localName===e.localName&&o.name.uri===e.uri&&o.name.prefix===e.prefix}),i={name:e,value:t};r!==-1?n.splice(r,1,i):n.push(i)};We.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=SE(n).concat(t)),E(t,function(r){e.append(" ").append(ch(r.name)).append('="').append(r.value).append('"')})};We.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==gi;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),E(this.body,function(r){r.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("")),e.appendNewLine()};function gc(e,t,n){We.call(this,e,t),this.serialization=n}sh(gc,We);gc.prototype.parseNsAttributes=function(e){var t=We.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var r=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var i=e.$model.getPackage(r.uri),o=i.xml&&i.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(r.prefix?r.prefix+":":"")+o+n.ns.localName),t};gc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function OE(){this.value="",this.write=function(e){this.value+=e}}function BE(e,t){var n=[""];this.append=function(r){return e.write(r),this},this.appendNewLine=function(){return t&&e.write(` `),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}}function uh(e){e=S({format:!1,preamble:!0},e||{});function t(n,r){var i=r||new OE,o=new BE(i,e.format);e.preamble&&o.append(xE);var a=new We,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(IE(s)),a.build(n).serializeTo(o),!r)return i.value}return{toXML:t}}function IE(e){let t=e.config&&e.config.nsMap||{},n={};for(let r in bl)n[r]=bl[r];for(let r in t){let i=t[r];n[i]=r}for(let r of e.getPackages())n[r.prefix]=r.uri;return n}function vc(e,t){Kt.call(this,e,t)}vc.prototype=Object.create(Kt.prototype);vc.prototype.fromXML=function(e,t,n){rt(t)||(n=t,t="bpmn:Definitions");var r=new mc(S({model:this,lax:!0},n)),i=r.handler(t);return r.fromXML(e,i)};vc.prototype.toXML=function(e,t){var n=new uh(t);return new Promise(function(r,i){try{var o=n.toXML(e);return r({xml:o})}catch(a){return i(a)}})};var LE="BPMN20",jE="http://www.omg.org/spec/BPMN/20100524/MODEL",FE="bpmn",HE=[],$E=[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{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",isAttr:!0,type:"String"}]},{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",isMany:!0,replaces:"FlowElementsContainer#laneSets",type:"LaneSet"},{name:"flowElements",isMany:!0,replaces:"FlowElementsContainer#flowElements",type:"FlowElement"},{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",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",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:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}},{name:"assignment",type:"Assignment",isMany:!0}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isMany:!0,isVirtual:!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",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isMany:!0,isVirtual:!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:"participantRef",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",isBody:!0,type:"String"}]},{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",isAttr:!0,type:"String"},{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",isMany:!0,isVirtual:!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",isMany:!0,isVirtual:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!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"}],superClass:["BaseElement"]},{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:"participantRef",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:["Collaboration","FlowElementsContainer"]},{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",isMany:!0,isVirtual:!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:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity","InteractionNode"],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}],superClass:["BaseElement"]},{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"}]}],zE=[{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"}]}],VE={tagAlias:"lowerCase",typePrefix:"t"},WE={name:LE,uri:jE,prefix:FE,associations:HE,types:$E,enumerations:zE,xml:VE},GE="BPMNDI",UE="http://www.omg.org/spec/BPMN/20100524/DI",KE="bpmndi",YE=[{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"]}],qE=[{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"}]}],XE=[],ZE={name:GE,uri:UE,prefix:KE,types:YE,enumerations:qE,associations:XE},QE="DC",JE="http://www.omg.org/spec/DD/20100524/DC",e0="dc",t0=[{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}]}],n0=[],r0={name:QE,uri:JE,prefix:e0,types:t0,associations:n0},i0="DI",o0="http://www.omg.org/spec/DD/20100524/DI",a0="di",s0=[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{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,isMany:!0,isVirtual:!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",isAttr:!0,isId:!0,type:"String"},{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,isMany:!0,isVirtual:!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",isMany:!0,isVirtual:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],c0=[],p0={tagAlias:"lowerCase"},u0={name:i0,uri:o0,prefix:a0,types:s0,associations:c0,xml:p0},l0="bpmn.io colors for BPMN",f0="http://bpmn.io/schema/bpmn/biocolor/1.0",d0="bioc",h0=[{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"}]}],m0=[],g0=[],v0={name:l0,uri:f0,prefix:d0,types:h0,enumerations:m0,associations:g0},y0="BPMN in Color",_0="http://www.omg.org/spec/BPMN/non-normative/color/1.0",x0="color",b0=[{name:"ColoredLabel",extends:["bpmndi:BPMNLabel"],properties:[{name:"color",isAttr:!0,type:"String"}]},{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"background-color",isAttr:!0,type:"String"},{name:"border-color",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"border-color",isAttr:!0,type:"String"}]}],E0=[],w0=[],S0={name:y0,uri:_0,prefix:x0,types:b0,enumerations:E0,associations:w0},C0={bpmn:WE,bpmndi:ZE,dc:r0,di:u0,bioc:v0,color:S0};function lh(e,t){let n=S({},C0,e);return new vc(n,t)}function _t(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':""}function Ht(e,t){return e.$instanceOf(t)}function R0(e){return ne(e.rootElements,function(t){return Ht(t,"bpmn:Process")||Ht(t,"bpmn:Collaboration")})}function Al(e){var t={},n=[],r={};function i(F,z){return function(ie){F(ie,z)}}function o(F){t[F.id]=F}function a(F){return t[F.id]}function s(F,z){var ie=F.gfx;if(ie)throw new Error(`already rendered ${_t(F)}`);return e.element(F,r[F.id],z)}function c(F,z){return e.root(F,r[F.id],z)}function p(F,z){try{var ie=r[F.id]&&s(F,z);return o(F),ie}catch(xe){u(xe.message,{element:F,error:xe}),console.error(`failed to import ${_t(F)}`,xe)}}function u(F,z){e.error(F,z)}var l=this.registerDi=function(z){var ie=z.bpmnElement;ie?r[ie.id]?u(`multiple DI elements defined for ${_t(ie)}`,{element:ie}):r[ie.id]=z:u(`no bpmnElement referenced in ${_t(z)}`,{element:z})};function f(F){d(F.plane)}function d(F){l(F),E(F.planeElement,h)}function h(F){l(F)}this.handleDefinitions=function(z,ie){var xe=z.diagrams;if(ie&&xe.indexOf(ie)===-1)throw new Error("diagram not part of ");if(!ie&&xe&&xe.length&&(ie=xe[0]),!ie)throw new Error("no diagram to display");r={},f(ie);var Bt=ie.plane;if(!Bt)throw new Error(`no plane for ${_t(ie)}`);var A=Bt.bpmnElement;if(!A)if(A=R0(z),A)u(`correcting missing bpmnElement on ${_t(Bt)} to ${_t(A)}`),Bt.bpmnElement=A,l(Bt);else throw new Error("no process or collaboration to display");var _=c(A,Bt);if(Ht(A,"bpmn:Process")||Ht(A,"bpmn:SubProcess"))v(A,_);else if(Ht(A,"bpmn:Collaboration"))Be(A,_),w(z.rootElements,_);else throw new Error(`unsupported bpmnElement for ${_t(Bt)}: ${_t(A)}`);y(n)};var y=this.handleDeferred=function(){for(var z;n.length;)z=n.shift(),z()};function v(F,z){ge(F,z),B(F.ioSpecification,z),T(F.artifacts,z),o(F)}function w(F,z){var ie=Q(F,function(xe){return!a(xe)&&Ht(xe,"bpmn:Process")&&xe.laneSets});ie.forEach(i(v,z))}function R(F,z){p(F,z)}function b(F,z){E(F,i(R,z))}function x(F,z){p(F,z)}function C(F,z){p(F,z)}function P(F,z){p(F,z)}function O(F,z){p(F,z)}function T(F,z){E(F,function(ie){Ht(ie,"bpmn:Association")?n.push(function(){O(ie,z)}):O(ie,z)})}function B(F,z){F&&(E(F.dataInputs,i(C,z)),E(F.dataOutputs,i(P,z)))}var I=this.handleSubProcess=function(z,ie){ge(z,ie),T(z.artifacts,ie)};function W(F,z){var ie=p(F,z);Ht(F,"bpmn:SubProcess")&&I(F,ie||z),Ht(F,"bpmn:Activity")&&B(F.ioSpecification,z),n.push(function(){E(F.dataInputAssociations,i(x,z)),E(F.dataOutputAssociations,i(x,z))})}function $(F,z){p(F,z)}function K(F,z){p(F,z)}function he(F,z){n.push(function(){var ie=p(F,z);F.childLaneSet&&Gt(F.childLaneSet,ie||z),Ke(F)})}function Gt(F,z){E(F.lanes,i(he,z))}function De(F,z){E(F,i(Gt,z))}function ge(F,z){de(F.flowElements,z),F.laneSets&&De(F.laneSets,z)}function de(F,z){E(F,function(ie){Ht(ie,"bpmn:SequenceFlow")?n.push(function(){$(ie,z)}):Ht(ie,"bpmn:BoundaryEvent")?n.unshift(function(){W(ie,z)}):Ht(ie,"bpmn:FlowNode")?W(ie,z):Ht(ie,"bpmn:DataObject")||(Ht(ie,"bpmn:DataStoreReference")||Ht(ie,"bpmn:DataObjectReference")?K(ie,z):u(`unrecognized flowElement ${_t(ie)} in context ${_t(z&&z.businessObject)}`,{element:ie,context:z}))})}function Ee(F,z){var ie=p(F,z),xe=F.processRef;xe&&v(xe,ie||z)}function Be(F,z){E(F.participants,i(Ee,z)),n.push(function(){b(F.messageFlows,z)}),T(F.artifacts,z)}function Ke(F){E(F.flowNodeRef,function(z){var ie=z.get("lanes");ie&&ie.push(F)})}}function m(e,t){var n=L(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ee(e,t){return It(t,function(n){return m(e,n)})}function L(e){return e&&e.businessObject||e}function se(e){return e&&e.di}function fh(e,t,n){var r,i,o,a,s=[];function c(p,u){var l={root:function(y,v){return r.add(y,v)},element:function(y,v,w){return r.add(y,v,w)},error:function(y,v){s.push({message:y,context:v})}},f=new Al(l);u=u||p.diagrams&&p.diagrams[0];var d=A0(p,u);if(!d)throw new Error("no diagram to display");E(d,function(y){f.handleDefinitions(p,y)});var h=u.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(p,u){try{return r=e.get("bpmnImporter"),i=e.get("eventBus"),o=e.get("canvas"),i.fire("import.render.start",{definitions:t}),c(t,n),i.fire("import.render.complete",{error:a,warnings:s}),p({warnings:s})}catch(l){return l.warnings=s,u(l)}})}function A0(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,r=n;!m(n,"bpmn:Process")&&!m(n,"bpmn:Collaboration")&&(r=P0(n));var i;m(r,"bpmn:Collaboration")?i=r:i=ne(e.rootElements,function(p){if(m(p,"bpmn:Collaboration"))return ne(p.participants,function(u){return u.processRef===r})});var o=[r];i&&(o=Ve(i.participants,function(p){return p.processRef}),o.push(i));var a=dh(o),s=[t],c=[n];return E(e.diagrams,function(p){if(p.plane){var u=p.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(p),c.push(u))}}),s}}function dh(e){var t=[];return E(e,function(n){n&&(t.push(n),t=t.concat(dh(n.flowElements)))}),t}function P0(e){for(var t=e;t;){if(m(t,"bpmn:Process"))return t;t=t.$parent}}var T0='',Pl=T0,Tl={verticalAlign:"middle"},Ml={color:"#404040"},M0={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},D0={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},k0={position:"absolute",left:"50%",top:"40%",transform:"translate(-50%)",width:"260px",padding:"10px",background:"white",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"14px",display:"flex",lineHeight:"1.3"},N0='
'+Pl+'Web-based tooling for BPMN, DMN and forms powered by bpmn.io.
',Kn;function O0(){Kn=_e(N0),ct(Kn,M0),ct(ve("svg",Kn),Tl),ct(ve(".backdrop",Kn),D0),ct(ve(".notice",Kn),k0),ct(ve(".link",Kn),Ml,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function hh(){Kn||(O0(),ht.bind(Kn,".backdrop","click",function(e){document.body.removeChild(Kn)})),document.body.appendChild(Kn)}function Fe(e){e=S({},I0,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),j0(this._container)}N(Fe,Gn);Fe.prototype.importXML=async function(t,n){let r=this;function i(a){return r.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement,c=a.references,p=a.warnings,u=a.elementsById;o=o.concat(p),s=this._emit("import.parse.complete",i({error:null,definitions:s,elementsById:u,references:c,warnings:o}))||s;let l=await this.importDefinitions(s,n);return o=o.concat(l.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),yc(s,o),s=B0(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}};Fe.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}};Fe.prototype.open=async function(t){let n=this._definitions,r=t;if(!n){let o=new Error("no XML imported");throw yc(o,[]),o}if(typeof t=="string"&&(r=L0(n,t),!r)){let o=new Error("BPMNDiagram <"+t+"> not found");throw yc(o,[]),o}try{this.clear()}catch(o){throw yc(o,[]),o}let{warnings:i}=await fh(this,n,r);return{warnings:i}};Fe.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,r,i;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,i=(await this._moddle.toXML(n,t)).xml,i=this._emit("saveXML.serialized",{xml:i})||i}catch(a){r=a}let o=r?{error:r}:{xml:i};if(this._emit("saveXML.done",o),r)throw r;return o};Fe.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{let r=this.get("canvas"),i=r.getActiveLayer(),o=ve(":scope > defs",r._svg),a=il(i),s=o?""+il(o)+"":"",c=i.getBBox();t=` '+s+a+""}catch(r){n=r}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}};Fe.prototype._setDefinitions=function(e){this._definitions=e};Fe.prototype.getModules=function(){return this._modules};Fe.prototype.clear=function(){this.getDefinitions()&&Gn.prototype.clear.call(this)};Fe.prototype.destroy=function(){Gn.prototype.destroy.call(this),Lt(this._container)};Fe.prototype.on=function(e,t,n,r){return this.get("eventBus").on(e,t,n,r)};Fe.prototype.off=function(e,t){this.get("eventBus").off(e,t)};Fe.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=ve(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()};Fe.prototype.getDefinitions=function(){return this._definitions};Fe.prototype.detach=function(){let e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))};Fe.prototype._init=function(e,t,n){let r=n.modules||this.getModules(n),i=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,r,i),s=S(Mt(n,["additionalModules"]),{canvas:S({},n.canvas,{container:e}),modules:a});Gn.call(this,s),n&&n.container&&this.attachTo(n.container)};Fe.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)};Fe.prototype._createContainer=function(e){let t=_e('
');return ct(t,{width:mh(e.width),height:mh(e.height),position:e.position}),t};Fe.prototype._createModdle=function(e){let t=S({},this._moddleExtensions,e.moddleExtensions);return new lh(t)};Fe.prototype._modules=[];function yc(e,t){return e.warnings=t,e}function B0(e){let n=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return n&&(e.message="unparsable content <"+n[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+n[2]),e}var I0={width:"100%",height:"100%",position:"relative"};function mh(e){return e+(te(e)?"px":"")}function L0(e,t){return t&&ne(e.diagrams,function(n){return n.id===t})||null}function j0(e){let n=''+Pl+"",r=_e(n);ct(ve("svg",r),Tl),ct(r,Ml,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(r),ae.bind(r,"click",function(i){hh(),i.preventDefault()})}function vi(e){Fe.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}N(vi,Fe);vi.prototype._createModdle=function(e){var t=Fe.prototype._createModdle.call(this,e);return t.ids=new dn([32,36,1]),t};vi.prototype._collectIds=function(e,t){var n=e.$model,r=n.ids,i;r.clear();for(i in t)r.claim(i,t[i])};function re(e,t){return m(e,"bpmn:CallActivity")?!1:m(e,"bpmn:SubProcess")?(t=t||se(e),t&&m(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):m(e,"bpmn:Participant")?!!L(e).processRef:!0}function Te(e){if(!(!m(e,"bpmn:Participant")&&!m(e,"bpmn:Lane"))){var t=se(e).isHorizontal;return t===void 0?!0:t}}function gh(e){return e&&L(e).isInterrupting!==!1}function qe(e){return e&&!!L(e).triggeredByEvent}function lr(e,t){var n=L(e).eventDefinitions;return It(n,function(r){return m(r,t)})}function vh(e){return lr(e,"bpmn:ErrorEventDefinition")}function yh(e){return lr(e,"bpmn:EscalationEventDefinition")}function _h(e){return lr(e,"bpmn:CompensateEventDefinition")}var Yn={width:90,height:20},xh=15;function rn(e){return m(e,"bpmn:Event")||m(e,"bpmn:Gateway")||m(e,"bpmn:DataStoreReference")||m(e,"bpmn:DataObjectReference")||m(e,"bpmn:DataInput")||m(e,"bpmn:DataOutput")||m(e,"bpmn:SequenceFlow")||m(e,"bpmn:MessageFlow")||m(e,"bpmn:Group")}function $r(e){return J(e.label)}function F0(e){var t=e.length/2-1,n=e[Math.floor(t)],r=e[Math.ceil(t+.01)],i=H0(e),o=Math.atan((r.y-n.y)/(r.x-n.x)),a=i.x,s=i.y;return Math.abs(o){m(n,"bpmn:Association")&&m(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),E(e.outgoing,n=>{m(n,"bpmn:Association")&&m(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function yi(e){let t=new Map;return E(ga(e,!0,-1),n=>{E(Dl(n),r=>{t.has(r.annotation)||t.set(r.annotation,{annotation:r.annotation,associations:[]}),t.get(r.annotation).associations.push(r.association)})}),[...t.values()]}var _c="hsl(225, 10%, 15%)",z0="white";function Tn(e,t){return It(e.eventDefinitions,function(n){return n.$type===t})}function Ch(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function Rh(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function me(e,t,n){var r=se(e);return n||r.get("color:background-color")||r.get("bioc:fill")||t||z0}function Y(e,t,n){var r=se(e);return n||r.get("color:border-color")||r.get("bioc:stroke")||t||_c}function so(e,t,n,r){var i=se(e),o=i.get("label");return r||o&&o.get("color:color")||t||Y(e,n)}function xc(e){var t=e.x+e.width/2,n=e.y+e.height/2,r=e.width/2,i=[["M",t,n],["m",0,-r],["a",r,r,0,1,1,0,2*r],["a",r,r,0,1,1,0,-2*r],["z"]];return pr(i)}function Ca(e,t){var n=e.x,r=e.y,i=e.width,o=e.height,a=[["M",n+t,r],["l",i-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-i,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return pr(a)}function Ah(e){var t=e.width,n=e.height,r=e.x,i=e.y,o=t/2,a=n/2,s=[["M",r+o,i],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return pr(s)}function Ph(e){var t=e.x,n=e.y,r=e.width,i=e.height,o=[["M",t,n],["l",r,0],["l",0,i],["l",-r,0],["z"]];return pr(o)}function co(e,t={}){return{width:on(e,t),height:$t(e,t)}}function on(e,t={}){return ft(t,"width")?t.width:e.width}function $t(e,t={}){return ft(t,"height")?t.height:e.height}var V0=new dn,W0=10,bc=3,G0=1.5,Ec=10,U0=4,po=.95,K0=1,Y0=.25;function dr(e,t,n,r,i,o,a){mn.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,p=e&&e.defaultLabelColor;function u(A){return n.computeStyle(A,{strokeLinecap:"round",strokeLinejoin:"round",stroke:_c,strokeWidth:2,fill:"white"})}function l(A){return n.computeStyle(A,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:_c,strokeWidth:2})}function f(A,_){var{ref:g={x:0,y:0},scale:M=1,element:D,parentGfx:j=i._svg}=_,V=G("marker",{id:A,viewBox:"0 0 20 20",refX:g.x,refY:g.y,markerWidth:20*M,markerHeight:20*M,orient:"auto"});Z(V,D);var oe=ve(":scope > defs",j);oe||(oe=G("defs"),Z(j,oe)),Z(oe,V)}function d(A,_,g,M){var D=V0.nextPrefixed("marker-");return h(A,D,_,g,M),"url(#"+D+")"}function h(A,_,g,M,D){if(g==="sequenceflow-end"){var j=G("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:D,stroke:D,strokeWidth:1})});f(_,{element:j,ref:{x:11,y:10},scale:.5,parentGfx:A})}if(g==="messageflow-start"){var V=G("circle",{cx:6,cy:6,r:3.5,...u({fill:M,stroke:D,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:V,ref:{x:6,y:6},parentGfx:A})}if(g==="messageflow-end"){var oe=G("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:M,stroke:D,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:oe,ref:{x:8.5,y:5},parentGfx:A})}if(g==="association-start"){var ye=G("path",{d:"M 11 5 L 1 10 L 11 15",...l({fill:"none",stroke:D,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:ye,ref:{x:1,y:10},scale:.5,parentGfx:A})}if(g==="association-end"){var at=G("path",{d:"M 1 5 L 11 10 L 1 15",...l({fill:"none",stroke:D,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:at,ref:{x:11,y:10},scale:.5,parentGfx:A})}if(g==="conditional-flow-marker"){var tt=G("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:M,stroke:D})});f(_,{element:tt,ref:{x:-1,y:10},scale:.5,parentGfx:A})}if(g==="conditional-default-flow-marker"){var yt=G("path",{d:"M 6 4 L 10 16",...u({stroke:D,fill:"none"})});f(_,{element:yt,ref:{x:0,y:10},scale:.5,parentGfx:A})}}function y(A,_,g,M,D={}){Pe(M)&&(D=M,M=0),M=M||0,D=u(D);var j=_/2,V=g/2,oe=G("circle",{cx:j,cy:V,r:Math.round((_+g)/4-M),...D});return Z(A,oe),oe}function v(A,_,g,M,D,j){Pe(D)&&(j=D,D=0),D=D||0,j=u(j);var V=G("rect",{x:D,y:D,width:_-D*2,height:g-D*2,rx:M,ry:M,...j});return Z(A,V),V}function w(A,_,g,M){var D=_/2,j=g/2,V=[{x:D,y:0},{x:_,y:j},{x:D,y:g},{x:0,y:j}],oe=V.map(function(at){return at.x+","+at.y}).join(" ");M=u(M);var ye=G("polygon",{...M,points:oe});return Z(A,ye),ye}function R(A,_,g,M){g=l(g);var D=Hn(_,g,M);return Z(A,D),D}function b(A,_,g){return R(A,_,g,5)}function x(A,_,g){g=l(g);var M=G("path",{...g,d:_});return Z(A,M),M}function C(A,_,g,M){return x(_,g,S({"data-marker":A},M))}function P(A){return Bt[A]}function O(A){return function(_,g,M){return P(A)(_,g,M)}}var T={"bpmn:MessageEventDefinition":function(A,_,g={},M){var D=r.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:g.width||_.width,containerHeight:g.height||_.height,position:{mx:.235,my:.315}}),j=M?Y(_,c,g.stroke):me(_,s,g.fill),V=M?me(_,s,g.fill):Y(_,c,g.stroke),oe=x(A,D,{fill:j,stroke:V,strokeWidth:1});return oe},"bpmn:TimerEventDefinition":function(A,_,g={}){var M=g.width||_.width,D=g.height||_.height,j=g.width?1:2,V=y(A,M,D,.2*D,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke),strokeWidth:j}),oe=r.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:M,containerHeight:D,position:{mx:.5,my:.5}});x(A,oe,{stroke:Y(_,c,g.stroke),strokeWidth:j});for(var ye=0;ye<12;ye++){var at=r.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:M,containerHeight:D,position:{mx:.5,my:.5}}),tt=M/2,yt=D/2;x(A,at,{strokeWidth:1,stroke:Y(_,c,g.stroke),transform:"rotate("+ye*30+","+yt+","+tt+")"})}return V},"bpmn:EscalationEventDefinition":function(A,_,g={},M){var D=r.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:g.width||_.width,containerHeight:g.height||_.height,position:{mx:.5,my:.2}}),j=M?Y(_,c,g.stroke):me(_,s,g.fill);return x(A,D,{fill:j,stroke:Y(_,c,g.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(A,_,g={}){var M=r.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:g.width||_.width,containerHeight:g.height||_.height,position:{mx:.5,my:.222}});return x(A,M,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(A,_,g={},M){var D=r.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),j=M?Y(_,c,g.stroke):me(_,s,g.fill);return x(A,D,{fill:j,stroke:Y(_,c,g.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(A,_,g={},M){var D=r.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:g.width||_.width,containerHeight:g.height||_.height,position:{mx:.2,my:.722}}),j=M?Y(_,c,g.stroke):me(_,s,g.fill);return x(A,D,{fill:j,stroke:Y(_,c,g.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(A,_,g={},M){var D=r.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),j=M?Y(_,c,g.stroke):"none",V=x(A,D,{fill:j,stroke:Y(_,c,g.stroke),strokeWidth:1});return lc(V,45),V},"bpmn:CompensateEventDefinition":function(A,_,g={},M){var D=r.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:g.width||_.width,containerHeight:g.height||_.height,position:{mx:.22,my:.5}}),j=M?Y(_,c,g.stroke):me(_,s,g.fill);return x(A,D,{fill:j,stroke:Y(_,c,g.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(A,_,g={},M){var D=r.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:g.width||_.width,containerHeight:g.height||_.height,position:{mx:.5,my:.2}}),j=M?Y(_,c,g.stroke):me(_,s,g.fill);return x(A,D,{strokeWidth:1,fill:j,stroke:Y(_,c,g.stroke)})},"bpmn:MultipleEventDefinition":function(A,_,g={},M){var D=r.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:g.width||_.width,containerHeight:g.height||_.height,position:{mx:.211,my:.36}}),j=M?Y(_,c,g.stroke):me(_,s,g.fill);return x(A,D,{fill:j,stroke:Y(_,c,g.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(A,_,g={}){var M=r.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:g.width||_.width,containerHeight:g.height||_.height,position:{mx:.458,my:.194}});return x(A,M,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(A,_,g={}){var M=y(A,_.width,_.height,8,{fill:Y(_,c,g.stroke),stroke:Y(_,c,g.stroke),strokeWidth:4});return M}};function B(A,_,g={},M){var D=L(A),j=Ch(D),V=M||A;return D.get("eventDefinitions")&&D.get("eventDefinitions").length>1?D.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](_,V,g,j):T["bpmn:MultipleEventDefinition"](_,V,g,j):Tn(D,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](_,V,g,j):Tn(D,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](_,V,g,j):Tn(D,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](_,V,g,j):Tn(D,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](_,V,g,j):Tn(D,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](_,V,g,j):Tn(D,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](_,V,g,j):Tn(D,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](_,V,g,j):Tn(D,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](_,V,g,j):Tn(D,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](_,V,g,j):Tn(D,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](_,V,g,j):null}var I={ParticipantMultiplicityMarker:function(A,_,g={}){var M=on(_,g),D=$t(_,g),j=r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:D,position:{mx:(M/2-6)/M,my:(D-15)/D}});C("participant-multiplicity",A,j,{strokeWidth:2,fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke)})},SubProcessMarker:function(A,_,g={}){var M=v(A,14,14,0,{strokeWidth:1,fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke)});Ie(M,_.width/2-7.5,_.height-20);var D=r.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2-7.5)/_.width,my:(_.height-20)/_.height}});C("sub-process",A,D,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke)})},ParallelMarker:function(A,_,g){var M=on(_,g),D=$t(_,g),j=r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:D,position:{mx:(M/2+g.parallel)/M,my:(D-20)/D}});C("parallel",A,j,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke)})},SequentialMarker:function(A,_,g){var M=r.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+g.seq)/_.width,my:(_.height-19)/_.height}});C("sequential",A,M,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke)})},CompensationMarker:function(A,_,g){var M=r.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+g.compensation)/_.width,my:(_.height-13)/_.height}});C("compensation",A,M,{strokeWidth:1,fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke)})},LoopMarker:function(A,_,g){var M=on(_,g),D=$t(_,g),j=r.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:D,position:{mx:(M/2+g.loop)/M,my:(D-7)/D}});C("loop",A,j,{strokeWidth:1.5,fill:"none",stroke:Y(_,c,g.stroke),strokeMiterlimit:.5})},AdhocMarker:function(A,_,g){var M=on(_,g),D=$t(_,g),j=r.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:D,position:{mx:(M/2+g.adhoc)/M,my:(D-15)/D}});C("adhoc",A,j,{strokeWidth:1,fill:Y(_,c,g.stroke),stroke:Y(_,c,g.stroke)})}};function W(A,_,g,M){I[A](_,g,M)}function $(A,_,g=[],M={}){M={fill:M.fill,stroke:M.stroke,width:on(_,M),height:$t(_,M)};var D=L(_),j=g.includes("SubProcessMarker");j?M={...M,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:M={...M,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},D.get("isForCompensation")&&g.push("CompensationMarker"),m(D,"bpmn:AdHocSubProcess")&&(g.push("AdhocMarker"),j||S(M,{compensation:M.compensation-18}));var V=D.get("loopCharacteristics"),oe=V&&V.get("isSequential");V&&(S(M,{compensation:M.compensation-18}),g.includes("AdhocMarker")&&S(M,{seq:-23,loop:-18,parallel:-24}),oe===void 0&&g.push("LoopMarker"),oe===!1&&g.push("ParallelMarker"),oe===!0&&g.push("SequentialMarker")),g.includes("CompensationMarker")&&g.length===1&&S(M,{compensation:-8}),E(g,function(ye){W(ye,A,_,M)})}function K(A,_,g={}){g=S({size:{width:100}},g);var M=o.createText(_||"",g);return ce(M).add("djs-label"),Z(A,M),M}function he(A,_,g,M={}){var D=L(_),j=co({x:_.x,y:_.y,width:_.width,height:_.height},M);return K(A,D.name,{align:g,box:j,padding:7,style:{fill:so(_,p,c,M.stroke)}})}function Gt(A,_,g={}){var M={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return K(A,pt(_),{box:M,style:S({},o.getExternalStyle(),{fill:so(_,p,c,g.stroke)})})}function De(A,_,g,M={}){var D=Te(g),j=K(A,_,{box:{height:30,width:D?$t(g,M):on(g,M)},align:"center-middle",style:{fill:so(g,p,c,M.stroke)}});if(D){var V=-1*$t(g,M);ro(j,0,-V,270)}}function ge(A,_,g={}){var{width:M,height:D}=co(_,g);return v(A,M,D,Ec,{...g,fill:me(_,s,g.fill),fillOpacity:po,stroke:Y(_,c,g.stroke)})}function de(A,_,g={}){var M=L(_),D=me(_,s,g.fill),j=Y(_,c,g.stroke);return(M.get("associationDirection")==="One"||M.get("associationDirection")==="Both")&&(g.markerEnd=d(A,"association-end",D,j)),M.get("associationDirection")==="Both"&&(g.markerStart=d(A,"association-start",D,j)),g=be(g,["markerStart","markerEnd"]),b(A,_.waypoints,{...g,stroke:j,strokeDasharray:"0, 5"})}function Ee(A,_,g={}){var M=me(_,s,g.fill),D=Y(_,c,g.stroke),j=r.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),V=x(A,j,{fill:M,fillOpacity:po,stroke:D}),oe=L(_);if(Rh(oe)){var ye=r.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});x(A,ye,{strokeWidth:2,fill:M,stroke:D})}return V}function Be(A,_,g={}){return y(A,_.width,_.height,{fillOpacity:po,...g,fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke)})}function Ke(A,_,g={}){return w(A,_.width,_.height,{fill:me(_,s,g.fill),fillOpacity:po,stroke:Y(_,c,g.stroke)})}function F(A,_,g={}){var M=v(A,on(_,g),$t(_,g),0,{fill:me(_,s,g.fill),fillOpacity:g.fillOpacity||po,stroke:Y(_,c,g.stroke),strokeWidth:1.5}),D=L(_);if(m(D,"bpmn:Lane")){var j=D.get("name");De(A,j,_,g)}return M}function z(A,_,g={}){var M=ge(A,_,g),D=re(_);if(qe(_)&&(H(M,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!D)){var j=L(_).flowElements||[],V=j.filter(oe=>m(oe,"bpmn:StartEvent"));V.length===1&&ie(V[0],A,g,_)}return he(A,_,D?"center-top":"center-middle",g),D?$(A,_,void 0,g):$(A,_,["SubProcessMarker"],g),M}function ie(A,_,g,M){var D=22,j={fill:me(M,s,g.fill),stroke:Y(M,c,g.stroke),width:D,height:D},V=L(A).isInterrupting,oe=V?0:3,ye=V?1:1.2,at=20,tt=(D-at)/2,yt="translate("+tt+","+tt+")";y(_,at,at,{fill:j.fill,stroke:j.stroke,strokeWidth:ye,strokeDasharray:oe,transform:yt}),B(A,_,j,M)}function xe(A,_,g={}){var M=ge(A,_,g);return he(A,_,"center-middle",g),$(A,_,void 0,g),M}var Bt=this.handlers={"bpmn:AdHocSubProcess":function(A,_,g={}){return re(_)?g=be(g,["fill","stroke","width","height"]):g=be(g,["fill","stroke"]),z(A,_,g)},"bpmn:Association":function(A,_,g={}){return g=be(g,["fill","stroke"]),de(A,_,g)},"bpmn:BoundaryEvent":function(A,_,g={}){var{renderIcon:M=!0}=g;g=be(g,["fill","stroke"]);var D=L(_),j=D.get("cancelActivity");g={strokeWidth:1.5,fill:me(_,s,g.fill),fillOpacity:K0,stroke:Y(_,c,g.stroke)},j||(g.strokeDasharray="6");var V=Be(A,_,g);return y(A,_.width,_.height,bc,{...g,fill:"none"}),M&&B(_,A,g),V},"bpmn:BusinessRuleTask":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=xe(A,_,g),D=r.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),j=x(A,D);H(j,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke),strokeWidth:1});var V=r.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),oe=x(A,V);return H(oe,{fill:Y(_,c,g.stroke),stroke:Y(_,c,g.stroke),strokeWidth:1}),M},"bpmn:CallActivity":function(A,_,g={}){return g=be(g,["fill","stroke"]),z(A,_,{strokeWidth:5,...g})},"bpmn:ComplexGateway":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=Ke(A,_,g),D=r.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return x(A,D,{fill:Y(_,c,g.stroke),stroke:Y(_,c,g.stroke),strokeWidth:1}),M},"bpmn:DataInput":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=r.getRawPath("DATA_ARROW"),D=Ee(A,_,g);return x(A,M,{fill:"none",stroke:Y(_,c,g.stroke),strokeWidth:1}),D},"bpmn:DataInputAssociation":function(A,_,g={}){return g=be(g,["fill","stroke"]),de(A,_,{...g,markerEnd:d(A,"association-end",me(_,s,g.fill),Y(_,c,g.stroke))})},"bpmn:DataObject":function(A,_,g={}){return g=be(g,["fill","stroke"]),Ee(A,_,g)},"bpmn:DataObjectReference":O("bpmn:DataObject"),"bpmn:DataOutput":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=r.getRawPath("DATA_ARROW"),D=Ee(A,_,g);return x(A,M,{strokeWidth:1,fill:Y(_,c,g.stroke),stroke:Y(_,c,g.stroke)}),D},"bpmn:DataOutputAssociation":function(A,_,g={}){return g=be(g,["fill","stroke"]),de(A,_,{...g,markerEnd:d(A,"association-end",me(_,s,g.fill),Y(_,c,g.stroke))})},"bpmn:DataStoreReference":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=r.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return x(A,M,{fill:me(_,s,g.fill),fillOpacity:po,stroke:Y(_,c,g.stroke),strokeWidth:2})},"bpmn:EndEvent":function(A,_,g={}){var{renderIcon:M=!0}=g;g=be(g,["fill","stroke"]);var D=Be(A,_,{...g,strokeWidth:4});return M&&B(_,A,g),D},"bpmn:EventBasedGateway":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=L(_),D=Ke(A,_,g);y(A,_.width,_.height,_.height*.2,{fill:me(_,"none",g.fill),stroke:Y(_,c,g.stroke),strokeWidth:1});var j=M.get("eventGatewayType"),V=!!M.get("instantiate");function oe(){var at=r.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});x(A,at,{fill:"none",stroke:Y(_,c,g.stroke),strokeWidth:2})}if(j==="Parallel"){var ye=r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});x(A,ye,{fill:"none",stroke:Y(_,c,g.stroke),strokeWidth:1})}else j==="Exclusive"&&(V||y(A,_.width,_.height,_.height*.26,{fill:"none",stroke:Y(_,c,g.stroke),strokeWidth:1}),oe());return D},"bpmn:ExclusiveGateway":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=Ke(A,_,g),D=r.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),j=se(_);return j.get("isMarkerVisible")&&x(A,D,{fill:Y(_,c,g.stroke),stroke:Y(_,c,g.stroke),strokeWidth:1}),M},"bpmn:Gateway":function(A,_,g={}){return g=be(g,["fill","stroke"]),Ke(A,_,g)},"bpmn:Group":function(A,_,g={}){return g=be(g,["fill","stroke","width","height"]),v(A,_.width,_.height,Ec,{stroke:Y(_,c,g.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:on(_,g),height:$t(_,g)})},"bpmn:InclusiveGateway":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=Ke(A,_,g);return y(A,_.width,_.height,_.height*.24,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke),strokeWidth:2.5}),M},"bpmn:IntermediateEvent":function(A,_,g={}){var{renderIcon:M=!0}=g;g=be(g,["fill","stroke"]);var D=Be(A,_,{...g,strokeWidth:1.5});return y(A,_.width,_.height,bc,{fill:"none",stroke:Y(_,c,g.stroke),strokeWidth:1.5}),M&&B(_,A,g),D},"bpmn:IntermediateCatchEvent":O("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":O("bpmn:IntermediateEvent"),"bpmn:Lane":function(A,_,g={}){return g=be(g,["fill","stroke","width","height"]),F(A,_,{...g,fillOpacity:Y0})},"bpmn:ManualTask":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=xe(A,_,g),D=r.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(A,D,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke),strokeWidth:.5}),M},"bpmn:MessageFlow":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=L(_),D=se(_),j=me(_,s,g.fill),V=Y(_,c,g.stroke),oe=b(A,_.waypoints,{markerEnd:d(A,"messageflow-end",j,V),markerStart:d(A,"messageflow-start",j,V),stroke:V,strokeDasharray:"10, 11",strokeWidth:1.5});if(M.get("messageRef")){var ye=oe.getPointAtLength(oe.getTotalLength()/2),at=r.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ye.x,y:ye.y}}),tt={strokeWidth:1};D.get("messageVisibleKind")==="initiating"?(tt.fill=j,tt.stroke=V):(tt.fill=V,tt.stroke=j);var yt=x(A,at,tt),fn=M.get("messageRef"),Oe=fn.get("name"),sr=K(A,Oe,{align:"center-top",fitBox:!0,style:{fill:V}}),Zs=yt.getBBox(),en=sr.getBBox(),fe=ye.x-en.width/2,Ae=ye.y+Zs.height/2+W0;ro(sr,fe,Ae,0)}return oe},"bpmn:ParallelGateway":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=Ke(A,_,g),D=r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return x(A,D,{fill:Y(_,c,g.stroke),stroke:Y(_,c,g.stroke),strokeWidth:1}),M},"bpmn:Participant":function(A,_,g={}){g=be(g,["fill","stroke","width","height"]);var M=F(A,_,g),D=re(_),j=Te(_),V=L(_),oe=V.get("name");if(D){var ye=j?[{x:30,y:0},{x:30,y:$t(_,g)}]:[{x:0,y:30},{x:on(_,g),y:30}];R(A,ye,{stroke:Y(_,c,g.stroke),strokeWidth:G0}),De(A,oe,_,g)}else{var at=co(_,g);j||(at.height=on(_,g),at.width=$t(_,g));var tt=K(A,oe,{box:at,align:"center-middle",style:{fill:so(_,p,c,g.stroke)}});if(!j){var yt=-1*$t(_,g);ro(tt,0,-yt,270)}}return V.get("participantMultiplicity")&&W("ParticipantMultiplicityMarker",A,_,g),M},"bpmn:ReceiveTask":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=L(_),D=xe(A,_,g),j;return M.get("instantiate")?(y(A,28,28,20*.22,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke),strokeWidth:1}),j=r.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):j=r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(A,j,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke),strokeWidth:1}),D},"bpmn:ScriptTask":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=xe(A,_,g),D=r.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(A,D,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke),strokeWidth:1}),M},"bpmn:SendTask":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=xe(A,_,g),D=r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(A,D,{fill:Y(_,c,g.stroke),stroke:me(_,s,g.fill),strokeWidth:1}),M},"bpmn:SequenceFlow":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=me(_,s,g.fill),D=Y(_,c,g.stroke),j=b(A,_.waypoints,{markerEnd:d(A,"sequenceflow-end",M,D),stroke:D}),V=L(_),{source:oe}=_;if(oe){var ye=L(oe);V.get("conditionExpression")&&m(ye,"bpmn:Activity")&&H(j,{markerStart:d(A,"conditional-flow-marker",M,D)}),ye.get("default")&&(m(ye,"bpmn:Gateway")||m(ye,"bpmn:Activity"))&&ye.get("default")===V&&H(j,{markerStart:d(A,"conditional-default-flow-marker",M,D)})}return j},"bpmn:ServiceTask":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=xe(A,_,g);y(A,10,10,{fill:me(_,s,g.fill),stroke:"none",transform:"translate(6, 6)"});var D=r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(A,D,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke),strokeWidth:1}),y(A,10,10,{fill:me(_,s,g.fill),stroke:"none",transform:"translate(11, 10)"});var j=r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(A,j,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke),strokeWidth:1}),M},"bpmn:StartEvent":function(A,_,g={}){var{renderIcon:M=!0}=g;g=be(g,["fill","stroke"]);var D=L(_);D.get("isInterrupting")||(g={...g,strokeDasharray:"6"});var j=Be(A,_,g);return M&&B(_,A,g),j},"bpmn:SubProcess":function(A,_,g={}){return re(_)?g=be(g,["fill","stroke","width","height"]):g=be(g,["fill","stroke"]),z(A,_,g)},"bpmn:Task":function(A,_,g={}){return g=be(g,["fill","stroke"]),xe(A,_,g)},"bpmn:TextAnnotation":function(A,_,g={}){g=be(g,["fill","stroke"]);var{width:M,height:D}=co(_,g),j=v(A,M,D,0,0,{fill:"none",stroke:"none"}),V=r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:D,position:{mx:0,my:0}});x(A,V,{stroke:Y(_,c,g.stroke)});var oe=L(_),ye=oe.get("text")||"";return K(A,ye,{align:"left-top",box:co(_,g),padding:fr,style:{fill:so(_,p,c,g.stroke)}}),j},"bpmn:Transaction":function(A,_,g={}){re(_)?g=be(g,["fill","stroke","width","height"]):g=be(g,["fill","stroke"]);var M=z(A,_,{strokeWidth:1.5,...g}),D=n.style(["no-fill","no-events"],{stroke:Y(_,c,g.stroke),strokeWidth:1.5}),j=re(_);return j||(g={}),v(A,on(_,g),$t(_,g),Ec-bc,bc,D),M},"bpmn:UserTask":function(A,_,g={}){g=be(g,["fill","stroke"]);var M=xe(A,_,g),D=15,j=12,V=r.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:D,y:j}});x(A,V,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke),strokeWidth:.5});var oe=r.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:D,y:j}});x(A,oe,{fill:me(_,s,g.fill),stroke:Y(_,c,g.stroke),strokeWidth:.5});var ye=r.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:D,y:j}});return x(A,ye,{fill:Y(_,c,g.stroke),stroke:Y(_,c,g.stroke),strokeWidth:.5}),M},label:function(A,_,g={}){return Gt(A,_,g)}};this._drawPath=x,this._renderer=P}N(dr,mn);dr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"];dr.prototype.canRender=function(e){return m(e,"bpmn:BaseElement")};dr.prototype.drawShape=function(e,t,n={}){var{type:r}=t,i=this._renderer(r);return i(e,t,n)};dr.prototype.drawConnection=function(e,t,n={}){var{type:r}=t,i=this._renderer(r);return i(e,t,n)};dr.prototype.getShapePath=function(e){return J(e)?Ca(e,U0):m(e,"bpmn:Event")?xc(e):m(e,"bpmn:Activity")?Ca(e,Ec):m(e,"bpmn:Gateway")?Ah(e):Ph(e)};function be(e,t=[]){return t.reduce((n,r)=>(e[r]&&(n[r]=e[r]),n),{})}var q0=0,X0={width:150,height:50};function Z0(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Q0(e){return Pe(e)?S({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var kl=null;function J0(){return kl||(kl=document.createElement("canvas").getContext("2d")),kl}function ew(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(Mh(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Mh(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function tw(e,t){var n=J0();if(!n)return{width:0,height:0};n.font=ew(t),"letterSpacing"in n&&(n.letterSpacing=Mh(t.letterSpacing)||"0px");var r=e==="",i=r?"dummy":e.replace(/\s+$/,""),o=n.measureText(i);return{width:r?0:o.width,height:"fontBoundingBoxAscent"in o?o.fontBoundingBoxAscent+o.fontBoundingBoxDescent:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}function nw(e,t,n){for(var r=e.shift(),i=r,o;;){if(o=tw(i,n),o.width=i?o.width:0,i===" "||i===""||o.width1)for(;r=n.shift();)if(r.length+ov?w.width:v},0),d=o.top;i.vertical==="middle"&&(d+=(n.height-l)/2),d-=(s||p[0].height)/4;var h=G("text");H(h,r),E(p,function(v){var w;switch(d+=s||v.height,i.horizontal){case"left":w=o.left;break;case"right":w=(a?f:u)-o.right-v.width;break;default:w=Math.max(((a?f:u)-v.width)/2+o.left,0)}var R=G("tspan");H(R,{x:w,y:d}),R.textContent=v.text,Z(h,R)});var y={width:f,height:l};return{dimensions:y,element:h}};function aw(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var sw=12,cw=1.2,pw=40;function wc(e){var t=S({fontFamily:"Arial, sans-serif",fontSize:sw,fontWeight:"normal",lineHeight:cw},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,r=S({},t,{fontSize:n},e&&e.externalStyle||{}),i=new uo({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Yn.width),height:30},p=o(s,c,{style:r});return{x:Math.round(a.x+a.width/2-p.width/2),y:a.y,width:Math.ceil(p.width),height:Math.ceil(p.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:fr});return{x:a.x,y:a.y,width:a.width,height:Math.max(pw,Math.round(c.height))}},this.getDimensions=function(a,s){return i.getDimensions(a,s||{})};function o(a,s,c){return i.getDimensions(a,S({box:s},c))}this.createText=function(a,s){return i.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return r}}wc.$inject=["config.textRenderer"];function Nl(){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 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},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(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var r=this.pathMap[t],i,o;n.abspos?(i=n.abspos.x,o=n.abspos.y):(i=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/r.height*n.yScaleFactor,c=n.containerWidth/r.width*n.xScaleFactor,p=0;p=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}function gw(e){return m(e,"bpmn:Group")}var Nh={__depends__:[zr],bpmnImporter:["type",Mn]};var Oh={__depends__:[Dh,Nh]};function qn(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}qn.prototype.next=function(){return this._prefix+ ++this._counter};var vw=new qn("ov"),yw=500;function ut(e,t,n,r){this._eventBus=t,this._canvas=n,this._elementRegistry=r,this._ids=vw,this._overlayDefaults=S({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=_w(n.getContainer()),this._init()}ut.$inject=["config.overlays","eventBus","canvas","elementRegistry"];ut.prototype.get=function(e){if(rt(e)&&(e={id:e}),rt(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Q(t.overlays,bt({type:e.type})):t.overlays.slice():[]}else return e.type?Q(this._overlays,bt({type:e.type})):e.id?this._overlays[e.id]:null};ut.prototype.add=function(e,t,n){if(Pe(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 r=this._ids.next();return n=S({},this._overlayDefaults,n,{id:r,type:t,element:e,html:n.html}),this._addOverlay(n),r};ut.prototype.remove=function(e){var t=this.get(e)||[];U(t)||(t=[t]);var n=this;E(t,function(r){var i=n._getOverlayContainer(r.element,!0);if(r&&(Lt(r.html),Lt(r.htmlContainer),delete r.htmlContainer,delete r.element,delete n._overlays[r.id]),i){var o=i.overlays.indexOf(r);o!==-1&&i.overlays.splice(o,1)}})};ut.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"};ut.prototype.show=function(){Cc(this._overlayRoot)};ut.prototype.hide=function(){Cc(this._overlayRoot,!1)};ut.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Dr(this._overlayRoot)};ut.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,r=t.x,i=t.y;if(t.waypoints){var o=we(t);r=o.x,i=o.y}Bh(n,r,i),Ze(e.html,"data-container-id",t.id)};ut.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,r=e.element,i=t.left,o=t.top;if(t.right!==void 0){var a;r.waypoints?a=we(r).width:a=r.width,i=t.right*-1+a}if(t.bottom!==void 0){var s;r.waypoints?s=we(r).height:s=r.height,o=t.bottom*-1+s}Bh(n,i||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())};ut.prototype._createOverlayContainer=function(e){var t=_e('
');ct(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n};ut.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Ih(this._overlayRoot,n)};ut.prototype._getOverlayContainer=function(e,t){var n=ne(this._overlayContainers,function(r){return r.element===e});return!n&&!t?this._createOverlayContainer(e):n};ut.prototype._addOverlay=function(e){var t=e.id,n=e.element,r=e.html,i,o;r.get&&r.constructor.prototype.jquery&&(r=r.get(0)),rt(r)&&(r=_e(r)),o=this._getOverlayContainer(n),i=_e('
'),ct(i,{position:"absolute"}),i.appendChild(r),e.type&&ke(i).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Cc(i,a===s),e.htmlContainer=i,o.overlays.push(e),o.html.appendChild(i),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())};ut.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,r=this._canvas.findRoot(e.element),i=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(r!==s||n&&(Ye(i)&&i>t.scale||Ye(o)&&oi&&(a=(1/t.scale||1)*i)),Ye(a)&&(s="scale("+a+","+a+")"),Ih(o,s)};ut.prototype._updateOverlaysVisibilty=function(e){var t=this;E(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})};ut.prototype._init=function(){var e=this._eventBus,t=this;function n(r){t._updateRoot(r),t._updateOverlaysVisibilty(r),t.show()}e.on("canvas.viewbox.changing",function(r){t.hide()}),e.on("canvas.viewbox.changed",function(r){n(r.viewbox)}),e.on(["shape.remove","connection.remove"],function(r){var i=r.element,o=t.get({element:i});E(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(i);if(a){Lt(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",yw,function(r){var i=r.element,o=t._getOverlayContainer(i,!0);o&&(E(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(r){var i=t._getOverlayContainer(r.element,!0);i&&ke(i.html)[r.add?"add":"remove"](r.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function _w(e){var t=_e('
');return ct(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Bh(e,t,n){ct(e,{left:t+"px",top:n+"px"})}function Cc(e,t){e.style.display=t===!1?"none":""}function Ih(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}var Vr={__init__:["overlays"],overlays:["type",ut]};function Rc(e,t,n,r){e.on("element.changed",function(i){var o=i.element;(o.parent||o===t.getRootElement())&&(i.gfx=n.getGraphics(o)),i.gfx&&e.fire(ic(o)+".changed",i)}),e.on("elements.changed",function(i){var o=i.elements;o.forEach(function(a){e.fire("element.changed",{element:a})}),r.updateContainments(o)}),e.on("shape.changed",function(i){r.update("shape",i.element,i.gfx)}),e.on("connection.changed",function(i){r.update("connection",i.element,i.gfx)})}Rc.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var lo={__init__:["changeSupport"],changeSupport:["type",Rc]};var xw=1e3;function k(e){this._eventBus=e}k.$inject=["eventBus"];function bw(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}k.prototype.on=function(e,t,n,r,i,o){if((Le(t)||te(t))&&(o=i,i=r,r=n,n=t,t=null),Le(n)&&(o=i,i=r,r=n,n=xw),Pe(i)&&(o=i,i=!1),!Le(r))throw new Error("handlerFn must be a function");U(e)||(e=[e]);var a=this._eventBus;E(e,function(s){var c=["commandStack",s,t].filter(function(p){return p}).join(".");a.on(c,n,i?bw(r,o):r,o)})};k.prototype.canExecute=hr("canExecute");k.prototype.preExecute=hr("preExecute");k.prototype.preExecuted=hr("preExecuted");k.prototype.execute=hr("execute");k.prototype.executed=hr("executed");k.prototype.postExecute=hr("postExecute");k.prototype.postExecuted=hr("postExecuted");k.prototype.revert=hr("revert");k.prototype.reverted=hr("reverted");function hr(e){return function(n,r,i,o,a){(Le(n)||te(n))&&(a=o,o=i,i=r,r=n,n=null),this.on(n,e,r,i,o,a)}}function Ra(e,t){t.invoke(k,this),this.executed(function(n){var r=n.context;r.rootElement?e.setRootElement(r.rootElement):r.rootElement=e.getRootElement()}),this.revert(function(n){var r=n.context;r.rootElement&&e.setRootElement(r.rootElement)})}N(Ra,k);Ra.$inject=["canvas","injector"];var Lh={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Ra]};function mr(e){return CSS.escape(e)}var Ew={"&":"&","<":"<",">":">",'"':""","'":"'"};function Ac(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return Ew[t]})}var jh="_plane";function Bl(e){var t=e.id;return ww(t)}function an(e){var t=e.id;return m(e,"bpmn:SubProcess")?Fh(t):t}function Wr(e){return Fh(e)}function fo(e){var t=se(e);return m(t,"bpmndi:BPMNPlane")}function Fh(e){return e+jh}function ww(e){return e.replace(new RegExp(jh+"$"),"")}var Sw="bjs-breadcrumbs-shown";function Pc(e,t,n){var r=_e('
    '),i=n.getContainer(),o=ke(i);i.appendChild(r);var a=[];e.on("element.changed",function(c){var p=c.element,u=L(p),l=ne(a,function(f){return f===u});l&&s()});function s(c){c&&(a=Cw(c));var p=a.flatMap(function(l){var f=n.findRoot(an(l))||n.findRoot(l.id);if(!f&&m(l,"bpmn:Process")){var d=t.find(function(v){var w=L(v);return w&&w.get("processRef")===l});f=d&&n.findRoot(d.id)}if(!f)return[];var h=Ac(l.name||l.id),y=_e('
  • '+h+"
  • ");return y.addEventListener("click",function(){n.setRootElement(f)}),y});r.innerHTML="";var u=p.length>1;o.toggle(Sw,u),p.forEach(function(l){r.appendChild(l)})}e.on("root.set",function(c){s(c.element)})}Pc.$inject=["eventBus","elementRegistry","canvas"];function Cw(e){for(var t=L(e),n=[],r=t;r;r=r.$parent)(m(r,"bpmn:SubProcess")||m(r,"bpmn:Process"))&&n.push(r);return n.reverse()}function Tc(e,t){var n=null,r=new Rw;e.on("root.set",function(i){var o=i.element,a=t.viewbox(),s=r.get(o);if(r.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!m(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,p=(a.y-s.y)*a.scale;(c!==0||p!==0)&&t.scroll({dx:c,dy:p}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){r.clear(),n=null})}Tc.$inject=["eventBus","canvas"];function Rw(){this._entries=[],this.set=function(e,t){var n=!1;for(var r in this._entries)if(this._entries[r][0]===e){this._entries[r][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}t!==-1&&this._entries.splice(t,1)}}var Hh={x:180,y:160};function gr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(r,i){n._handleImport(i.definitions)})}gr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(r){!r.plane||!r.plane.bpmnElement||(t._processToDiagramMap[r.plane.bpmnElement.id]=r)});var n=e.diagrams.filter(r=>r.plane).flatMap(r=>t._createNewDiagrams(r.plane));n.forEach(function(r){t._movePlaneElementsToOrigin(r.plane)})}};gr.prototype._createNewDiagrams=function(e){var t=this,n=[],r=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;m(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),Pw(a,e)&&r.push({diElement:o,parent:s})}});var i=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,i.push(a)}}),r.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),i};gr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=Aw(e),r={x:n.x-Hh.x,y:n.y-Hh.y};t.forEach(function(i){i.waypoint?i.waypoint.forEach(function(o){o.x=o.x-r.x,o.y=o.y-r.y}):i.bounds&&(i.bounds.x=i.bounds.x-r.x,i.bounds.y=i.bounds.y-r.y)})};gr.prototype._moveToDiPlane=function(e,t){var n=$h(e),r=n.plane.get("planeElement");r.splice(r.indexOf(e),1),t.get("planeElement").push(e)};gr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n};gr.$inject=["eventBus","moddle"];function $h(e){return m(e,"bpmndi:BPMNDiagram")?e:$h(e.$parent)}function Aw(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var r=X(n.bounds);t.top=Math.min(r.top,t.top),t.left=Math.min(r.left,t.left)}}),di(t)}function Pw(e,t){var n=e.$parent;return!(!m(n,"bpmn:SubProcess")||n===t.bpmnElement||ee(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Mc=250,Tw='',Mw="bjs-drilldown-empty";function Xn(e,t,n,r,i){k.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=r,this._translate=i;var o=this;this.executed("shape.toggleCollapse",Mc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Mc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Mc,function(a){var s=a.oldParent,c=a.newParent||a.parent,p=a.shape;o._canDrillDown(p)&&o._addOverlay(p),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(p)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Mc,function(a){var s=a.oldParent,c=a.newParent||a.parent,p=a.shape;o._canDrillDown(p)&&o._addOverlay(p),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(p)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}N(Xn,k);Xn.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}};Xn.prototype._canDrillDown=function(e){var t=this._canvas;return m(e,"bpmn:SubProcess")&&t.findRoot(an(e))};Xn.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=L(e),r=t.get({element:n.id,type:"drilldown"})[0];if(r){var i=n&&n.get("flowElements")&&n.get("flowElements").length;ke(r.html).toggle(Mw,!i)}};Xn.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,r=L(e),i=n.get({element:e,type:"drilldown"});i.length&&this._removeOverlay(e);var o=_e('"),a=r.get("name")||r.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(an(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)};Xn.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})};Xn.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];var zh={__depends__:[Vr,lo,Lh],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Pc],drilldownCentering:["type",Tc],drilldownOverlayBehavior:["type",Xn],subprocessCompatibility:["type",gr]};function Vh(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function vr(e){return e.originalEvent||e.srcEvent}function Dc(e){Vh(e),Vh(vr(e))}function yn(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}function kc(){return/mac/i.test(navigator.platform)}function Wh(e,t){return(vr(e)||e).button===t}function sn(e){return Wh(e,0)}function Gh(e){return Wh(e,1)}function yr(e){var t=vr(e)||e;return sn(e)?kc()?t.metaKey:t.ctrlKey:!1}function _i(e){var t=vr(e)||e;return sn(e)&&t.shiftKey}function Dw(e){return!0}function Nc(e){return sn(e)||Gh(e)}var Uh=500;function Oc(e,t,n){var r=this;function i(T,B,I){if(!s(T,B)){var W,$,K;I?$=t.getGraphics(I):(W=B.delegateTarget||B.target,W&&($=W,I=t.get($))),!(!$||!I)&&(K=e.fire(T,{element:I,gfx:$,originalEvent:B}),K===!1&&(B.stopPropagation(),B.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,B){var I=p[T]||sn;return!I(B)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},p={"element.contextmenu":Dw,"element.mousedown":Nc,"element.mouseup":Nc,"element.click":Nc,"element.dblclick":Nc};function u(T,B,I){var W=c[T];if(!W)throw new Error("unmapped DOM event name <"+T+">");return i(W,B,I)}var l="svg, .djs-element";function f(T,B,I,W){var $=o[I]=function(K){i(I,K)};W&&(p[I]=W),$.$delegate=ht.bind(T,l,B,$)}function d(T,B,I){var W=a(I);W&&ht.unbind(T,B,W.$delegate)}function h(T){E(c,function(B,I){f(T,I,B)})}function y(T){E(c,function(B,I){d(T,I,B)})}e.on("canvas.destroy",function(T){y(T.svg)}),e.on("canvas.init",function(T){h(T.svg)}),e.on(["shape.added","connection.added"],function(T){var B=T.element,I=T.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:I})}),e.on(["shape.changed","connection.changed"],Uh,function(T){var B=T.element,I=T.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:I})}),e.on("interactionEvents.createHit",Uh,function(T){var B=T.element,I=T.gfx;r.createDefaultHit(B,I)}),e.on("interactionEvents.updateHit",function(T){var B=T.element,I=T.gfx;r.updateDefaultHit(B,I)});var v=C("djs-hit djs-hit-stroke"),w=C("djs-hit djs-hit-click-stroke"),R=C("djs-hit djs-hit-all"),b=C("djs-hit djs-hit-no-move"),x={all:R,"click-stroke":w,stroke:v,"no-move":b};function C(T,B){return B=S({stroke:"white",strokeWidth:15},B||{}),n.cls(T,["no-fill","no-border"],B)}function P(T,B){var I=x[B];if(!I)throw new Error("invalid hit type <"+B+">");return H(T,I),T}function O(T,B){Z(T,B)}this.removeHits=function(T){var B=ui(".djs-hit",T);E(B,Ce)},this.createDefaultHit=function(T,B){var I=T.waypoints,W=T.isFrame,$;return I?this.createWaypointsHit(B,I):($=W?"stroke":"all",this.createBoxHit(B,$,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,B){var I=Hn(B);return P(I,"stroke"),O(T,I),I},this.createBoxHit=function(T,B,I){I=S({x:0,y:0},I);var W=G("rect");return P(W,B),H(W,I),O(T,W),W},this.updateDefaultHit=function(T,B){var I=ve(".djs-hit",B);if(I)return T.waypoints?ha(I,T.waypoints):H(I,{width:T.width,height:T.height}),I},this.fire=i,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Oc.$inject=["eventBus","elementRegistry","styles"];var Gr={__init__:["interactionEvents"],interactionEvents:["type",Oc]};function Ur(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],function(r){var i=r.element;n.deselect(i)}),e.on(["diagram.clear","root.set"],function(r){n.select(null)})}Ur.$inject=["eventBus","canvas"];Ur.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(n!==-1){var r=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:r,newSelection:t})}};Ur.prototype.get=function(){return this._selectedElements};Ur.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1};Ur.prototype.select=function(e,t){var n=this._selectedElements,r=n.slice();U(e)||(e=e?[e]:[]);var i=this._canvas,o=i.getRootElement();e=e.filter(function(a){var s=i.findRoot(a);return o===s}),t?E(e,function(a){n.indexOf(a)===-1&&n.push(a)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:r,newSelection:n})};var Kh="hover",Yh="selected";function Bc(e,t){this._canvas=e;function n(i,o){e.addMarker(i,o)}function r(i,o){e.removeMarker(i,o)}t.on("element.hover",function(i){n(i.element,Kh)}),t.on("element.out",function(i){r(i.element,Kh)}),t.on("selection.changed",function(i){function o(p){r(p,Yh)}function a(p){n(p,Yh)}var s=i.oldSelection,c=i.newSelection;E(s,function(p){c.indexOf(p)===-1&&o(p)}),E(c,function(p){s.indexOf(p)===-1&&a(p)})})}Bc.$inject=["canvas","eventBus"];function Ic(e,t,n,r){e.on("create.end",500,function(i){var o=i.context,a=o.canExecute,s=o.elements,c=o.hints||{},p=c.autoSelect;if(a){if(p===!1)return;U(p)?t.select(p):t.select(s.filter(kw))}}),e.on("connect.end",500,function(i){var o=i.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(i){var o=i.previousSelection||[],a=r.get(i.context.shape.id),s=ne(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(i){if(sn(i)){var o=i.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=_i(i);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Ic.$inject=["eventBus","selection","canvas","elementRegistry"];function kw(e){return!e.hidden}var Qe={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Gr],selection:["type",Ur],selectionVisuals:["type",Bc],selectionBehavior:["type",Ic]};function cn(e){Fe.call(this,e)}N(cn,Fe);cn.prototype._modules=[Oh,zh,Vr,Qe,zr];cn.prototype._moddleExtensions={};var qh=["c","C"],Xh=["v","V"],Nw=["d","D"],Ow=["x","X"],Zh=["y","Y"],Il=["z","Z"];function Qh(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function mt(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Ge(e,t){return e=U(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Lc(e){return e.shiftKey}function Jh(e){return mt(e)&&Ge(qh,e)}function em(e){return mt(e)&&Ge(Xh,e)}function tm(e){return mt(e)&&Ge(Nw,e)}function nm(e){return mt(e)&&Ge(Ow,e)}function rm(e){return mt(e)&&!Lc(e)&&Ge(Il,e)}function im(e){return mt(e)&&(Ge(Zh,e)||Ge(Il,e)&&Lc(e))}var jc="keyboard.keydown",Bw="keyboard.keyup",Iw=1e3,om="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function wt(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration ",new Error(om));var r=e&&e.bind!==!1;t.on("canvas.init",function(i){n._target=i.svg,r&&n.bind(),n._fire("init")})}wt.$inject=["config.keyboard","eventBus"];wt.prototype._keydownHandler=function(e){this._keyHandler(e,jc)};wt.prototype._keyupHandler=function(e){this._keyHandler(e,Bw)};wt.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var r={keyEvent:e};n=this._eventBus.fire(t||jc,r),n&&e.preventDefault()}};wt.prototype._isEventIgnored=function(e){return!1};wt.prototype.bind=function(e){e&&console.error("unsupported argument ",new Error(om)),this.unbind(),e=this._node=this._target,ae.bind(e,"keydown",this._keydownHandler),ae.bind(e,"keyup",this._keyupHandler),this._fire("bind")};wt.prototype.getBinding=function(){return this._node};wt.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),ae.unbind(e,"keydown",this._keydownHandler),ae.unbind(e,"keyup",this._keyupHandler)),this._node=null};wt.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})};wt.prototype.addListener=function(e,t,n){Le(e)&&(n=t,t=e,e=Iw),this._eventBus.on(n||jc,e,t)};wt.prototype.removeListener=function(e,t){this._eventBus.off(t||jc,e)};wt.prototype.hasModifier=Qh;wt.prototype.isCmd=mt;wt.prototype.isShift=Lc;wt.prototype.isKey=Ge;var Lw=500;function _r(e,t){var n=this;e.on("editorActions.init",Lw,function(r){var i=r.editorActions;n.registerBindings(t,i)})}_r.$inject=["eventBus","keyboard"];_r.prototype.registerBindings=function(e,t){function n(r,i){t.isRegistered(r)&&e.addListener(i)}n("undo",function(r){var i=r.keyEvent;if(rm(i))return t.trigger("undo"),!0}),n("redo",function(r){var i=r.keyEvent;if(im(i))return t.trigger("redo"),!0}),n("copy",function(r){var i=r.keyEvent;if(Jh(i))return t.trigger("copy"),!0}),n("paste",function(r){var i=r.keyEvent;if(em(i))return t.trigger("paste"),!0}),n("duplicate",function(r){var i=r.keyEvent;if(tm(i))return t.trigger("duplicate"),!0}),n("cut",function(r){var i=r.keyEvent;if(nm(i))return t.trigger("cut"),!0}),n("stepZoom",function(r){var i=r.keyEvent;if(Ge(["+","Add","="],i)&&mt(i))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(r){var i=r.keyEvent;if(Ge(["-","Subtract"],i)&&mt(i))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(r){var i=r.keyEvent;if(Ge("0",i)&&mt(i))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(r){var i=r.keyEvent;if(Ge(["Backspace","Delete","Del"],i))return t.trigger("removeSelection"),!0})};var ho={__init__:["keyboard","keyboardBindings"],keyboard:["type",wt],keyboardBindings:["type",_r]};var jw={moveSpeed:50,moveSpeedAccelerated:200};function Fc(e,t,n){var r=this;this._config=S({},jw,e||{}),t.addListener(i);function i(o){var a=o.keyEvent,s=r._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,p;switch(a.key){case"ArrowLeft":case"Left":p="left";break;case"ArrowUp":case"Up":p="up";break;case"ArrowRight":case"Right":p="right";break;case"ArrowDown":case"Down":p="down";break}return r.moveCanvas({speed:c,direction:p}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,p=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=p;break;case"up":s=p;break;case"right":a=-p;break;case"down":s=-p;break}n.scroll({dx:a,dy:s})}}Fc.$inject=["config.keyboardMove","keyboard","canvas"];var Hc={__depends__:[ho],__init__:["keyboardMove"],keyboardMove:["type",Fc]};var Fw=/^djs-cursor-.*$/;function xi(e){var t=ke(document.body);t.removeMatching(Fw),e&&t.add("djs-cursor-"+e)}function $c(){xi(null)}var Hw=5e3;function zc(e,t){t=t||"element.click";function n(){return!1}return e.once(t,Hw,n),function(){e.off(t,n)}}function mo(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function St(e,t){return{x:e.x-t.x,y:e.y-t.y}}var $w=15;function Vc(e,t){var n;function r(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,r):e.off("element.mousedown",r)});function i(s){var c=n.start,p=n.button,u=yn(s),l=St(u,c);if(!n.dragging&&zw(l)>$w&&(n.dragging=!0,p===0&&zc(e),xi("grab")),n.dragging){var f=n.last||n.start;l=St(u,f),t.scroll({dx:l.x,dy:l.y}),n.last=u}s.preventDefault()}function o(s){ae.unbind(document,"mousemove",i),ae.unbind(document,"mouseup",o),n=null,$c()}function a(s){if(!Rn(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:yn(s)},ae.bind(document,"mousemove",i),ae.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Vc.$inject=["eventBus","canvas"];function zw(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}var Wc={__init__:["moveCanvas"],moveCanvas:["type",Vc]};function Aa(e){return Math.log(e)/Math.log(10)}function Ll(e,t){var n=Aa(e.min),r=Aa(e.max),i=Math.abs(n)+Math.abs(r);return i/t}function am(e,t){return Math.max(e.min,Math.min(e.max,t))}var Vw=Math.sign||function(e){return e>=0?1:-1},jl={min:.2,max:4},sm=10,Ww=.1,Gw=.75;function _n(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=nt(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Gw;var r=this;t.on("canvas.mouseover",function(){r._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){r._init(!1)})}_n.$inject=["config.zoomScroll","eventBus","canvas"];_n.prototype.scroll=function(t){this._canvas.scroll(t)};_n.prototype.reset=function(){this._canvas.zoom("fit-viewport")};_n.prototype.zoom=function(t,n){var r=Ll(jl,sm*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Ww&&(this._zoom(t,n,r),this._totalDelta=0)};_n.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var r=t.ctrlKey||kc()&&t.metaKey,i=t.shiftKey,o=-1*this._scale,a;if(r?o*=t.deltaMode===0?.02:.32:o*=t.deltaMode===0?1:16,r){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*Vw(t.deltaY)*o,this.zoom(a,c)}else i?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}};_n.prototype.stepZoom=function(t,n){var r=Ll(jl,sm);this._zoom(t,n,r)};_n.prototype._zoom=function(e,t,n){var r=this._canvas,i=e>0?1:-1,o=Aa(r.zoom()),a=Math.round(o/n)*n;a+=n*i;var s=Math.pow(10,a);r.zoom(am(jl,s),t)};_n.prototype.toggle=function(t){var n=this._container,r=this._handleWheel,i=this._enabled;return typeof t=="undefined"&&(t=!i),i!==t&&ae[t?"bind":"unbind"](n,"wheel",r,!1),this._enabled=t,t};_n.prototype._init=function(e){this.toggle(e)};var Gc={__init__:["zoomScroll"],zoomScroll:["type",_n]};function xr(e){cn.call(this,e)}N(xr,cn);xr.prototype._navigationModules=[Hc,Wc,Gc];xr.prototype._modules=[].concat(cn.prototype._modules,xr.prototype._navigationModules);function Fl(e){return e&&e[e.length-1]}function cm(e){return e.y}function pm(e){return e.x}var Uw={left:pm,center:pm,right:function(e){return e.x+e.width},top:cm,middle:cm,bottom:function(e){return e.y+e.height}};function Kr(e,t){this._modeling=e,this._rules=t}Kr.$inject=["modeling","rules"];Kr.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",r="width";return t.indexOf(e)!==-1&&(n="y",r="height"),{axis:n,dimension:r}};Kr.prototype._isType=function(e,t){return t.indexOf(e)!==-1};Kr.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),r=n.axis,i=n.dimension,o={},a={},s=!1,c,p,u;function l(f,d){return Math.round((f[r]+d[r]+d[i])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][r];else if(this._isType(e,["right","bottom"]))u=Fl(t),o[e]=u[r]+u[i];else if(this._isType(e,["center","middle"])){if(E(t,function(f){var d=f[r]+Math.round(f[i]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=Rt(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Fl(c).center,o;p=t[0],t=Rt(t,function(f){return f[r]+f[i]}),u=Fl(t),o[e]=l(p,u)}return o};Kr.prototype.trigger=function(e,t){var n=this._modeling,r,i=Q(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(r=this._rules.allowed("elements.align",{elements:i}),U(r)&&(i=r),!(i.length<2||!r)){var o=Uw[t],a=Rt(i,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};var um={__init__:["alignElements"],alignElements:["type",Kr]};var Kw=new qn;function Yr(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Yr.$inject=["eventBus"];Yr.prototype.schedule=function(e,t=Kw.next()){this.cancel(t);let n=this._schedule(e,t);return this._scheduled[t]=n,n.promise};Yr.prototype._schedule=function(e,t){let n=Yw();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(i){n.reject(i)}}catch(i){console.error("Scheduler#_schedule execution failed",i)}}),promise:n.promise}};Yr.prototype.cancel=function(e){let t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)};Yr.prototype._cancel=function(e){clearTimeout(e.executionId)};function Yw(){let e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}var lm={scheduler:["type",Yr]};var qw="djs-element-hidden",Uc=".entry",Xw=1e3,fm=8,Zw=300;function Je(e,t,n,r){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=r,this._current=null,this._init()}Je.$inject=["canvas","elementRegistry","eventBus","scheduler"];Je.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,r=n.length?n.length===1?n[0]:n:null;r?e.open(r,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,r=e._current;if(r){var i=r.target,o=U(i)?i:[i],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,r=e._current,i=U(r.target)?r.target:[r.target];i.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()};Je.prototype._createContainer=function(){var e=_e('
    ');return this._canvas.getContainer().appendChild(e),e};Je.prototype.registerProvider=function(e,t){t||(t=e,e=Xw),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})};Je.prototype.getEntries=function(e){var t=this._getProviders(),n=U(e)?"getMultiElementContextPadEntries":"getContextPadEntries",r={};return E(t,function(i){if(Le(i[n])){var o=i[n](e);Le(o)?r=o(r):E(o,function(a,s){r[s]=a})}}),r};Je.prototype.trigger=function(e,t,n){var r=this,i,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(i=Ze(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){r._mouseout=r.triggerEntry(i,"hover",o,n)},Zw);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(i,e,o,n)};Je.prototype.triggerEntry=function(e,t,n,r){if(this.isShown()){var i=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(Le(s)){if(t==="click")return s(n,i,r)}else if(s[t])return s[t](n,i,r);n.preventDefault()}}}};Je.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}};Je.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers};Je.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),r;E(t,function(i,o){var a=i.group||"default",s=_e(i.html||'
    '),c;Ze(s,"data-action",o),c=ve("[data-group="+mr(a)+"]",n),c||(c=_e('
    '),Ze(c,"data-group",a),n.appendChild(c)),c.appendChild(s),i.className&&Qw(s,i.className),i.title&&Ze(s,"title",i.title),i.imageUrl&&(r=_e(""),Ze(r,"src",i.imageUrl),r.style.width="100%",r.style.height="100%",s.appendChild(r))}),ke(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})};Je.prototype._createHtml=function(e){var t=this,n=_e('
    ');return ht.bind(n,Uc,"click",function(r){t.trigger("click",r)}),ht.bind(n,Uc,"dragstart",function(r){t.trigger("dragstart",r)}),ht.bind(n,Uc,"mouseover",function(r){t.trigger("mouseover",r)}),ht.bind(n,Uc,"mouseout",function(r){t.trigger("mouseout",r)}),ae.bind(n,"mousedown",function(r){r.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n};Je.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&eS(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}};Je.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)};Je.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return U(e)!==U(n)?!1:U(e)?e.length===n.length&&hn(e,function(r){return n.includes(r)}):n===e};Je.prototype.isShown=function(){return this.isOpen()&&ke(this._current.html).has("open")};Je.prototype.show=function(){this.isOpen()&&(ke(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))};Je.prototype.hide=function(){this.isOpen()&&(ke(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))};Je.prototype._getPosition=function(e){if(!U(e)&&le(e)){var t=this._canvas.viewbox(),n=Jw(e),r=n.x*t.scale-t.x*t.scale,i=n.y*t.scale-t.y*t.scale;return{left:r+fm*this._canvas.zoom(),top:i}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+fm*this._canvas.zoom(),top:s.top-a.top}};Je.prototype._updatePosition=function(){let e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(r){r in n&&(t.style[r]=n[r]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")};Je.prototype._updateVisibility=function(){let e=()=>{if(this.isOpen()){var t=this,n=this._current.target,r=U(n)?n:[n],i=r.some(function(o){return t._canvas.hasMarker(o,qw)});i?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")};Je.prototype._getTargetBounds=function(e){var t=this,n=U(e)?e:[e],r=n.map(function(i){return t._canvas.getGraphics(i)});return r.reduce(function(i,o){let a=o.getBoundingClientRect();return i.top=Math.min(i.top,a.top),i.right=Math.max(i.right,a.right),i.bottom=Math.max(i.bottom,a.bottom),i.left=Math.min(i.left,a.left),i.x=i.left,i.y=i.top,i.width=i.right-i.left,i.height=i.bottom-i.top,i},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function Qw(e,t){var n=ke(e);t=U(t)?t:t.split(/\s+/g),t.forEach(function(r){n.add(r)})}function Jw(e){return e.waypoints[e.waypoints.length-1]}function eS(e,t){return e=U(e)?e:[e],t=U(t)?t:[t],e.length===t.length&&hn(e,function(n){return t.includes(n)})}var Kc={__depends__:[Gr,lm,Vr],contextPad:["type",Je]};var ep,Ue,vm,tS,qr,dm,ym,_m,Hl,qc,Pa,xm,Wl,$l,zl,nS,Zc={},Qc=[],rS=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,tp=Array.isArray;function br(e,t){for(var n in t)e[n]=t[n];return e}function Gl(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function np(e,t,n){var r,i,o,a={};for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?ep.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return Xc(e,a,r,i,null)}function Xc(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i==null?++vm:i,__i:-1,__u:0};return i==null&&Ue.vnode!=null&&Ue.vnode(o),o}function rp(e){return e.children}function Ta(e,t){this.props=e,this.context=t}function go(e,t){if(t==null)return e.__?go(e.__,e.__i+1):null;for(var n;tt&&qr.sort(_m),e=qr.shift(),t=qr.length,iS(e)}finally{qr.length=Jc.__r=0}}function Em(e,t,n,r,i,o,a,s,c,p,u){var l,f,d,h,y,v,w,R=r&&r.__k||Qc,b=t.length;for(c=oS(n,t,R,c,b),l=0;l0?a=e.__k[o]=Xc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(p=a.__i=aS(a,n,c,l))!=-1&&(l--,(s=n[p])&&(s.__u|=2)),s==null||s.__v==null?(p==-1&&(i>u?f--:ic?f--:f++,a.__u|=4))):e.__k[o]=null;if(l)for(o=0;o(u?1:0)){for(i=n-1,o=n+1;i>=0||o=0?i--:o++])!=null&&(2&p.__u)==0&&s==p.key&&c==p.type)return a}return-1}function mm(e,t,n){t[0]=="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||rS.test(t)?n:n+"px"}function Yc(e,t,n,r,i){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||mm(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||mm(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(xm,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[Pa]=r[Pa]:(n[Pa]=Wl,e.addEventListener(t,o?zl:$l,o)):e.removeEventListener(t,o?zl:$l,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n==null?"":n;break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function gm(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[qc]==null)t[qc]=Wl++;else if(t[qc]0?e:tp(e)?e.map(Cm):e.constructor!==void 0?null:br({},e)}function sS(e,t,n,r,i,o,a,s,c){var p,u,l,f,d,h,y,v=n.props||Zc,w=t.props,R=t.type;if(R=="svg"?i="http://www.w3.org/2000/svg":R=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(p=0;p=5&&((a||!f&&o===5)&&(c.push(o,0,a,i),o=6),f&&(c.push(o,f,0,i),o=6)),a=""},u=0;u"?(o=1,a=""):a=r+a[0]:s?r===s?s="":a+=r:r==='"'||r==="'"?s=r:r===">"?(p(),o=1):o&&(r==="="?(o=5,i=a,a=""):r==="/"&&(o<5||n[u][l+1]===">")?(p(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):r===" "||r===" "||r===` `||r==="\r"?(p(),o=2):a+=r),o===3&&a==="!--"&&(o=4,c=c[0])}return p(),c})(e)),t),arguments,[])).length>1?t:t[0]}var Se=Tm.bind(np);var vo,ot,Yl,Mm,Ma=0,jm=[],lt=Ue,Dm=lt.__b,km=lt.__r,Nm=lt.diffed,Om=lt.__c,Bm=lt.unmount,Im=lt.__;function ap(e,t){lt.__h&<.__h(ot,e,Ma||t),Ma=0;var n=ot.__H||(ot.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Da(e){return Ma=1,Fm(Hm,e)}function Fm(e,t,n){var r=ap(vo++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Hm(void 0,t),function(s){var c=r.__N?r.__N[0]:r.__[0],p=r.t(c,s);c!==p&&(r.__N=[p,r.__[1]],r.__c.setState({}))}],r.__c=ot,!ot.__f)){var i=function(s,c,p){if(!r.__c.__H)return!0;var u=r.__c.__H.__.filter(function(f){return f.__c});if(u.every(function(f){return!f.__N}))return!o||o.call(this,s,c,p);var l=r.__c.props!==s;return u.some(function(f){if(f.__N){var d=f.__[0];f.__=f.__N,f.__N=void 0,d!==f.__[0]&&(l=!0)}}),o&&o.call(this,s,c,p)||l};ot.__f=!0;var o=ot.shouldComponentUpdate,a=ot.componentWillUpdate;ot.componentWillUpdate=function(s,c,p){if(this.__e){var u=o;o=void 0,i(s,c,p),o=u}a&&a.call(this,s,c,p)},ot.shouldComponentUpdate=i}return r.__N||r.__}function yo(e,t){var n=ap(vo++,3);!lt.__s&&Xl(n.__H,t)&&(n.__=e,n.u=t,ot.__H.__h.push(n))}function _o(e,t){var n=ap(vo++,4);!lt.__s&&Xl(n.__H,t)&&(n.__=e,n.u=t,ot.__h.push(n))}function xo(e){return Ma=5,xn(function(){return{current:e}},[])}function xn(e,t){var n=ap(vo++,7);return Xl(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function bi(e,t){return Ma=8,xn(function(){return e},t)}function pS(){for(var e;e=jm.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(op),t.__h.some(ql),t.__h=[]}catch(n){t.__h=[],lt.__e(n,e.__v)}}}lt.__b=function(e){ot=null,Dm&&Dm(e)},lt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Im&&Im(e,t)},lt.__r=function(e){km&&km(e),vo=0;var t=(ot=e.__c).__H;t&&(Yl===ot?(t.__h=[],ot.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(op),t.__h.some(ql),t.__h=[],vo=0)),Yl=ot},lt.diffed=function(e){Nm&&Nm(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(jm.push(t)!==1&&Mm===lt.requestAnimationFrame||((Mm=lt.requestAnimationFrame)||uS)(pS)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Yl=ot=null},lt.__c=function(e,t){t.some(function(n){try{n.__h.some(op),n.__h=n.__h.filter(function(r){return!r.__||ql(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],lt.__e(r,n.__v)}}),Om&&Om(e,t)},lt.unmount=function(e){Bm&&Bm(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{op(r)}catch(i){t=i}}),n.__H=void 0,t&<.__e(t,n.__v))};var Lm=typeof requestAnimationFrame=="function";function uS(e){var t,n=function(){clearTimeout(r),Lm&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Lm&&(t=requestAnimationFrame(n))}function op(e){var t=ot,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ot=t}function ql(e){var t=ot;e.__c=e.__(),ot=t}function Xl(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Hm(e,t){return typeof t=="function"?t(e):t}function Zl(e){let{navigationStack:t,setNavigationStack:n}=e,r=xn(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),i=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return Se`
    ${i&&Se` `} ${r.map((a,s)=>Se` `)} ${o&&Se` ${o} `}
    `}function $m(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;tfS(t),[t]),s=p=>p.action&&!p.disabled,c=(p,u)=>{if(s(u))return n(p,u)};return Se`

    ${o}

    ${a.map(p=>Se`
      ${p.entries.map(u=>Se`
    • <${s(u)?"button":"span"} class=${dS(u,u===r)} onClick=${l=>c(l,u)} title=${u.title||u.label} data-id=${u.id} aria-disabled=${u.disabled||void 0} onMouseEnter=${()=>s(u)&&i(u)} onMouseLeave=${()=>s(u)&&i(null)} onFocus=${()=>s(u)&&i(u)} onBlur=${()=>s(u)&&i(null)} > ${u.imageUrl&&Se``||u.imageHtml&&Se`
      `} ${u.label?Se` ${u.label} `:null}
    • `)}
    `)}
    `}function fS(e){return e.reduce((t,n)=>{let r=n.group||"default",i=t.find(o=>o.id===r);return i?i.entries.push(n):t.push({id:r,entries:[n]}),t},[])}function dS(e,t){return Ei("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Jl(e){let{entry:t,selected:n,onMouseEnter:r,onMouseLeave:i,onAction:o}=e,a=(c,p)=>{if(!t.disabled)return o(c,t,p)},s=!t.entries;return Se`
  • s&&a(c,"dragstart")} draggable=${s} >
    ${t.imageUrl&&Se``||t.imageHtml&&Se`
    `} ${t.label?Se` ${t.label} `:null} ${t.documentationRef&&Se` c.stopPropagation()} title="Open element documentation" aria-label="Open element documentation" target="_blank" rel="noopener" > `} ${t.description&&Se` ${t.description} `}
    ${t.entries&&Se` `}
  • `}function ef(e){let{selectedEntry:t,setSelectedEntry:n,groupedEntries:r,...i}=e,o=xo();return _o(()=>{let a=o.current;if(!a)return;let s=a.querySelector(".selected");s&&hS(s)},[t]),Se`
    ${r.map(a=>Se` ${a.name&&Se`
    ${a.name}
    `}
      ${a.entries.map(s=>Se` <${Jl} key=${s.id} entry=${s} selected=${s===t} onMouseEnter=${()=>n(s)} onMouseLeave=${()=>n(null)} ...${i} /> `)}
    `)}
    `}function hS(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}function tf(e){let{onClose:t,onSelect:n,className:r,headerEntries:i,position:o,title:a,width:s,scale:c,search:p,emptyPlaceholder:u,searchFn:l,entries:f,onOpened:d,onClosed:h}=e,[y,v]=Da([]);yo(()=>{v([])},[f]);let[w,R]=Da(""),b=w.trim().length>0,x=xn(()=>vS(f),[f]),C=xn(()=>Ye(p)?x.length>5:!1,[p,x]),P=xn(()=>{let de=y.length?y[y.length-1].entries:f;return C?b?l(x.filter(({searchable:Ee})=>Ee!==!1),w,{keys:["label","search","description"]}).map(({item:Ee})=>Ee):de.filter(({rank:Ee=0})=>Ee>=0):de},[C,b,x,w,l,y,f]),O=xn(()=>b?P.length?[{id:"default",entries:P}]:[]:yS(P),[P,b]),[T,B]=Da(P[0]),I=xo(null);yo(()=>{let de=I.current;de&&P.includes(de)?B(de):B(P[0]),I.current=null},[P]);let W=bi(de=>{let Ee=gS(O),Ke=Ee.indexOf(T)+de;Ke<0&&(Ke=Ee.length-1),Ke>=Ee.length&&(Ke=0),B(Ee[Ke])},[O,T]),$=bi(de=>{de>0&&T&&T.entries&&v(Ee=>[...Ee,T]),de<0&&y.length>0&&(I.current=y[y.length+de],v(Ee=>Ee.slice(0,de)))},[T,y]),K=bi((de,Ee,Be)=>{if(!(!Ee||Ee.disabled))return Ee.entries?(de.preventDefault(),$(1)):n(de,Ee,Be)},[n,$]),he=bi(de=>{if(de.key==="Enter"&&T)return T.disabled?void 0:K(de,T);if(de.key==="Backspace"){let Ee=de.target;if(!(da(Ee,"input")&&Ee.value!==""))return $(-1),de.preventDefault()}if(de.key==="ArrowUp")return W(-1),de.preventDefault();if(de.key==="ArrowDown")return W(1),de.preventDefault();if(de.key==="ArrowRight")return $(1),de.preventDefault();if(de.key==="ArrowLeft")return $(-1),de.preventDefault()},[T,W,$,K]),Gt=bi(de=>{da(de.target,"input")&&R(()=>de.target.value)},[R]);yo(()=>(d(),()=>{h()}),[]);let De=!b&&y.length>0,ge=(a||i.length>0)&&!De;return Se` <${zm} onClose=${t} onKeyup=${Gt} onKeydown=${he} className=${r} position=${o} width=${s} scale=${c} > ${ge&&Se` <${Ql} headerEntries=${i} onSelect=${n} selectedEntry=${T} setSelectedEntry=${B} title=${a} /> `} ${De&&Se` <${Zl} navigationStack=${y} setNavigationStack=${v} /> `} ${f.length>0&&Se`
    ${C&&Se` `} ${b&&Se`
    ${P.length} ${P.length===1?"result":"results"} found
    `} <${ef} groupedEntries=${O} selectedEntry=${T} setSelectedEntry=${B} onAction=${K} />
    `} ${u&&P.length===0&&Se`
    ${Le(u)?u(w):u}
    `} `}function zm(e){let{onClose:t,onKeydown:n,onKeyup:r,className:i,children:o,position:a}=e,s=xo();return _o(()=>{if(typeof a!="function")return;let c=s.current,p=a(c);c.style.left=`${p.x}px`,c.style.top=`${p.y}px`},[s.current,a]),_o(()=>{let c=s.current;if(!c)return;(c.querySelector("input")||c).focus()},[]),yo(()=>{let c=u=>{if(u.key==="Escape")return u.preventDefault(),t()},p=u=>{if(!Rn(u.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",c),document.body.addEventListener("click",p,!0),()=>{document.documentElement.removeEventListener("keydown",c),document.body.removeEventListener("click",p,!0)}},[]),Se`
    ${o}
    `}function mS(e){return{transform:`scale(${e.scale})`,width:`${e.width}px`,"transform-origin":"top left"}}function gS(e){let t=[];return e.forEach(n=>{n.entries.forEach(r=>{t.push(r)})}),t}function vS(e){let t=[];function n(r){r.forEach(i=>{if(i.entries){n(i.entries);return}t.push(i)})}return n(e),t}function yS(e){let t=[],n=o=>t.find(a=>o.id===a.id),r=o=>!!n(o),i=o=>typeof o=="string"?{id:o}:o;return e.forEach(o=>{let a=o.group?i(o.group):{id:"default"};r(a)?n(a).entries.push(o):t.push({...a,entries:[o]})}),t}var _S="data-id",Vm=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],xS=1e3;function $e(e,t,n,r){this._eventBus=t,this._canvas=n,this._search=r,this._current=null;var i=Ye(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:i},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{let a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}$e.$inject=["config.popupMenu","eventBus","canvas","search"];$e.prototype._render=function(){let{position:e,providerId:t,entries:n,headerEntries:r,emptyPlaceholder:i,options:o}=this._current,a=Wm(n),s=Object.entries(r).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),p=this._updateScale(this._current.container);ip(Se` <${tf} onClose=${f=>this.close(f)} onSelect=${(f,d,h)=>this.trigger(f,d,h)} position=${c} className=${t} entries=${a} headerEntries=${s} emptyPlaceholder=${i} scale=${p} onOpened=${this._onOpened.bind(this)} onClosed=${this._onClosed.bind(this)} searchFn=${this._search} ...${{...o}} /> `,this._current.container)};$e.prototype.open=function(e,t,n,r){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var i=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(i===!1)return;this.isOpen()&&this.close();let{entries:o,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:o,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:r},this._emit("open"),this._bindAutoClose(),this._render()};$e.prototype.refresh=function(){if(!this.isOpen())return;let{target:e,providerId:t}=this._current,{entries:n,headerEntries:r,emptyPlaceholder:i}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:r,emptyPlaceholder:i},this._emit("refresh"),this._render()};$e.prototype._getContext=function(e,t){let n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");let r=this._getEntries(e,n),i=this._getHeaderEntries(e,n),o=this._getEmptyPlaceholder(n);return{entries:r,headerEntries:i,emptyPlaceholder:o,empty:!(Object.keys(r).length||Object.keys(i).length)}};$e.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)};$e.prototype.reset=function(){let e=this._current.container;ip(null,e),Lt(e)};$e.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)};$e.prototype._onOpened=function(){this._emit("opened")};$e.prototype._onClosed=function(){this._emit("closed")};$e.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();let r=_e(`
    `);return n.appendChild(r),r};$e.prototype._bindAutoClose=function(){this._eventBus.once(Vm,this.close,this)};$e.prototype._unbindAutoClose=function(){this._eventBus.off(Vm,this.close,this)};$e.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,r,i=e;return t!==!0&&(t===!1?(n=1,r=1):(n=t.min,r=t.max),Ye(n)&&er&&(i=r)),i};$e.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect(),i={},o=t.x,a=t.y;return t.x+r.width>n.width&&(i.x=!0),t.y+r.height>n.height&&(i.y=!0),i.x&&i.y?(o=t.x-r.width,a=t.y-r.height):i.x?(o=t.x-r.width,a=t.y):i.y&&t.yLe(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()};$e.prototype.isOpen=function(){return!!this._current};$e.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let i=Rn(e.delegateTarget||e.target,".entry",!0),o=Ze(i,_S);t={id:o,...this._getEntry(o)}}let r=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Le(r)){if(n==="click")return r(e,t)}else if(r[n])return r[n](e,t)}};$e.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function Wm(e){return Object.entries(e).map(([t,n])=>{let r={id:t,...n};return r.entries&&(r.entries=Wm(r.entries)),r})}function nf(e,t,n){let{keys:r}=n;if(t=t.trim().toLowerCase(),!t)throw new Error(" must not be empty");let i=t.trim().toLowerCase().split(/\s+/);return e.flatMap(o=>{let a=bS(o,i,r);return a?{item:o,tokens:a}:[]}).sort(ES(r))}function bS(e,t,n){let{matchedWords:r,tokens:i}=n.reduce((o,a)=>{let s=e[a],{tokens:c,matchedWords:p}=U(s)?s.reduce((u,l)=>{let{tokens:f,matchedWords:d}=Ym(l,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Ym(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...p}}},{matchedWords:{},tokens:{}});return Object.keys(r).length!==t.length?null:i}function ES(e){return(t,n)=>{let r=0,i=1;for(let o of e){let a=wS(t.tokens[o],n.tokens[o]);if(a!==0){r+=a*i,i*=Gm;continue}let s=SS(t.item[o],n.item[o]);if(s!==0){r+=s*i,i*=Gm;continue}}return r}}function wS(e,t){return Um(t)-Um(e)}var Gm=.5,bo={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Um(e){let t=e.reduce((s,c)=>s+qm(c),0),n=e.flat(),r=n.reduce((s,c)=>s+c.value.length,0),i=n.reduce((s,c)=>s+(c.match?c.value.length:0),0),o=r?i/r:0;return t*(1+o)}function qm(e){if(U(e))return Math.max(...e.map(qm));let t=Math.log(e.value.length);return e.match?(e.start?e.end?bo.FULL:e.wordEnd?bo.START_FULL_WORD:bo.START_WORD_PART:e.wordStart?bo.WORD_START:bo.WORD_PART)*t:bo.NO_MATCH*t}function Km(e=""){return U(e)?e.join(", "):e}function SS(e,t){return Km(e).localeCompare(Km(t))}function Ym(e,t){var p;if(!e)return{tokens:[],matchedWords:{}};let n=[],r={},i=t.map(CS),o=[`(?${i.join("\\s+")})`,...i].join("|"),a=new RegExp(o,"ig"),s,c=0;for(;s=a.exec(e);){let[u]=s,l=s.index,f=s.index+u.length,d=l===0,h=f===e.length,y=!!((p=s.groups)!=null&&p.all),v=d||/\s/.test(e.charAt(l-1)),w=h||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:v,wordEnd:w,start:d,end:h,all:y});let R=y?t:[u];for(let b of R)r[b.toLowerCase()]=!0;c=s.index+u.length}return c `,bottom:` `,center:` `,left:` `,right:` `,top:` `,middle:` `},cp=RS;var AS=900;function Xr(e,t,n,r){e.registerProvider(AS,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}Xr.$inject=["contextPad","popupMenu","translate","canvas"];Xr.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&S(t,this._getEntries(e)),t};Xr.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")};Xr.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`
    ${cp.align}
    `,action:{click:function(t,n){var r=e._getMenuPosition(n);S(r,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",r)}}}}};Xr.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,r=n.getBoundingClientRect(),i={x:r.left,y:r.bottom+t};return i};var PS=["left","center","right","top","middle","bottom"];function wi(e,t,n,r){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",this)}wi.$inject=["popupMenu","alignElements","translate","rules"];wi.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&S(t,this._getEntries(e)),t};wi.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})};wi.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,r=this._popupMenu,i={};return E(PS,function(o){i["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:cp[o],action:function(){t.trigger(e,o),r.close()}}}),i};function At(e){k.call(this,e),this.init()}At.$inject=["eventBus"];N(At,k);At.prototype.addRule=function(e,t,n){var r=this;typeof e=="string"&&(e=[e]),e.forEach(function(i){r.canExecute(i,t,function(o,a,s){return n(o)},!0)})};At.prototype.init=function(){};function wo(e){At.call(this,e)}wo.$inject=["eventBus"];N(wo,At);wo.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Q(t,function(r){return!(r.waypoints||r.host||r.labelTarget)});return n=Nr(n),n.length<2?!1:n})};var Xm={__depends__:[um,Kc,Eo],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Xr],alignElementsMenuProvider:["type",wi],bpmnAlignElements:["type",wo]};var TS=10,of=50,MS=250;function pp(e,t,n,r){for(var i;i=DS(e,n,t);)n=r(t,n,i);return n}function up(e){return function(t,n,r){var i={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,p=a.minDistance;c<0?i[o]=Math.min(r[o]+c-t[s]/2,n[o]-p+c):i[o]=Math.max(r[o]+r[s]+c+t[s]/2,n[o]+p+c)}}),i}}function DS(e,t,n){var r={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},i=kS(e);return ne(i,function(o){if(o===n)return!1;var a=je(o,r,TS);return a==="intersect"})}function Zm(e,t){t||(t={});function n(h){return h.source===e?1:-1}var r=t.defaultDistance||of,i=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||MS,c=t.reference||"start";o||(o=BS);function p(h,y){return i==="n"?c==="start"?X(h).top-X(y).bottom:c==="center"?X(h).top-q(y).y:X(h).top-X(y).top:i==="w"?c==="start"?X(h).left-X(y).right:c==="center"?X(h).left-q(y).x:X(h).left-X(y).left:i==="s"?c==="start"?X(y).top-X(h).bottom:c==="center"?q(y).y-X(h).bottom:X(y).bottom-X(h).bottom:c==="start"?X(y).left-X(h).right:c==="center"?q(y).x-X(h).right:X(y).right-X(h).right}var u=e.incoming.filter(o).map(function(h){var y=a(h),v=y<0?p(h.source,e):p(e,h.source);return{id:h.source.id,distance:v,weight:y}}),l=e.outgoing.filter(o).map(function(h){var y=a(h),v=y>0?p(e,h.target):p(h.target,e);return{id:h.target.id,distance:v,weight:y}}),f=u.concat(l).reduce(function(h,y){return h[y.id+"__weight_"+y.weight]=y,h},{}),d=Xe(f,function(h,y){var v=y.distance,w=y.weight;return v<0||v>s||(h[String(v)]||(h[String(v)]=0),h[String(v)]+=1*w,(!h.distance||h[h.distance]t.top&&(n=n.concat("n")),e.rightt.left&&(n=n.concat("e")),n}function Co(e){e.invoke(Dn,this)}Co.$inject=["injector"];N(Co,Dn);Co.prototype.resize=function(e,t,n){m(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Si(e){At.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Si.$inject=["eventBus"];N(Si,At);Si.prototype.canResize=function(e,t){return!1};function Ro(e,t){Si.call(this,e),this._modeling=t}N(Ro,Si);Ro.$inject=["eventBus","modeling"];Ro.prototype.canResize=function(e,t){if(m(t.di,"bpmndi:BPMNPlane")||!m(t,"bpmn:Participant")&&!m(t,"bpmn:Lane")&&!m(t,"bpmn:SubProcess"))return!1;var n=!0;return E(e,function(r){if(m(r,"bpmn:Lane")||J(r)){n=!1;return}}),n};var eg={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Co],bpmnAutoResizeProvider:["type",Ro]};var tg=1500;function gp(e,t,n){var r=this,i=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=r._findTargetGfx(s),p=c&&e.get(c);c&&p&&(a.stopPropagation(),i.hover({element:p,gfx:c}),i.move(s))}}i&&t.on("drag.start",function(a){t.once("drag.move",tg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",tg,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=yn(a),c=document.elementFromPoint(s.x,s.y),VS(c)}}gp.$inject=["elementRegistry","eventBus","injector"];function VS(e){return Rn(e,"svg, .djs-element",!0)}var ng={__init__:["hoverFix"],hoverFix:["type",gp]};var Ao=Math.round,rg="djs-drag-active";function Ci(e){e.preventDefault()}function WS(e){return typeof TouchEvent!="undefined"&&e instanceof TouchEvent}function GS(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function vp(e,t,n,r){var i={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),C=t._container.getBoundingClientRect();return{x:x.x+(b.x-C.left)/x.scale,y:x.y+(b.y-C.top)/x.scale}}function s(b,x){x=x||o;var C=e.createEvent(S({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,C)===!1?!1:e.fire(x.prefix+"."+b,C)}function c(b){var x=b.filter(function(C){return r.get(C.id)});x.length&&n.select(x)}function p(b,x){var C=o.payload,P=o.displacement,O=o.globalStart,T=yn(b),B=St(T,O),I=o.localStart,W=a(T),$=St(W,I);if(!o.active&&(x||GS(B)>o.threshold)){if(S(C,{x:Ao(I.x+P.x),y:Ao(I.y+P.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return v();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&xi(o.cursor),t.addMarker(t.getRootElement(),rg)}Dc(b),o.active&&(S(C,{x:Ao(W.x+P.x),y:Ao(W.y+P.y),dx:Ao($.x),dy:Ao($.y)},{originalEvent:b}),s("move"))}function u(b){var x,C=!0;o.active&&(b&&(o.payload.originalEvent=b,Dc(b)),C=s("end")),C===!1&&s("rejected"),x=w(C!==!0),s("ended",x)}function l(b){Ge("Escape",b)&&(Ci(b),v())}function f(b){var x;o.active&&(x=zc(e),setTimeout(x,400),Ci(b)),u(b)}function d(b){p(b)}function h(b){var x=o.payload;x.hoverGfx=b.gfx,x.hover=b.element,s("hover")}function y(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function v(b){var x;if(o){var C=o.active;C&&s("cancel"),x=w(b),C&&s("canceled",x)}}function w(b){var x,C;s("cleanup"),$c(),o.trapClick?C=f:C=u,ae.unbind(document,"mousemove",p),ae.unbind(document,"dragstart",Ci),ae.unbind(document,"selectstart",Ci),ae.unbind(document,"mousedown",C,!0),ae.unbind(document,"mouseup",C,!0),ae.unbind(document,"keyup",l),ae.unbind(document,"touchstart",d,!0),ae.unbind(document,"touchcancel",v,!0),ae.unbind(document,"touchmove",p,!0),ae.unbind(document,"touchend",u,!0),e.off("element.hover",h),e.off("element.out",y),t.removeMarker(t.getRootElement(),rg);var P=o.payload.previousSelection;return b!==!1&&P&&!n.get().length&&c(P),x=o,o=null,x}function R(b,x,C,P){o&&v(!1),typeof x=="string"&&(P=C,C=x,x=null),P=S({},i,P||{});var O=P.data||{},T,B,I,W,$;if(P.trapClick?W=f:W=u,b?(T=vr(b)||b,B=yn(b),Dc(b),T.type==="dragstart"&&Ci(T)):(T=null,B={x:0,y:0}),I=a(B),x||(x=I),$=WS(T),o=S({prefix:C,data:O,payload:{},globalStart:B,displacement:St(x,I),localStart:I,isTouch:$},P),P.manual||($?(ae.bind(document,"touchstart",d,!0),ae.bind(document,"touchcancel",v,!0),ae.bind(document,"touchmove",p,!0),ae.bind(document,"touchend",u,!0)):(ae.bind(document,"mousemove",p),ae.bind(document,"dragstart",Ci),ae.bind(document,"selectstart",Ci),ae.bind(document,"mousedown",W,!0),ae.bind(document,"mouseup",W,!0)),ae.bind(document,"keyup",l),e.on("element.hover",h),e.on("element.out",y)),s("init")===!1)return v(),!1;P.autoActivate&&p(b,!0)}e.on("diagram.destroy",v),this.init=R,this.move=p,this.hover=h,this.out=y,this.end=u,this.cancel=v,this.context=function(){return o},this.setOptions=function(b){S(i,b)}}vp.$inject=["eventBus","canvas","selection","elementRegistry"];var Ct={__depends__:[ng,Qe],dragging:["type",vp]};function Zr(e,t,n){this._canvas=n,this._opts=S({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on("drag.move",function(i){var o=r._toBorderPoint(i);r.startScroll(o)}),t.on(["drag.cleanup"],function(){r.stopScroll()})}Zr.$inject=["config.autoScroll","eventBus","canvas"];Zr.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,r=this,i=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,i.width-e.x,i.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)US(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?a=n.scrollStep:c==1?s=n.scrollStep:c==2?a=-n.scrollStep:c==3&&(s=-n.scrollStep));(a!==0||s!==0)&&(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){r.startScroll(e)},n.scrollRepeatTimeout))};function US(e,t,n){return tP-3&&(B=je(d.target,C),y===P-2?B==="intersect"&&(b.pop(),b[b.length-1]=C):B!=="intersect"&&b.push(w)),f.newWaypoints=d.waypoints=s(d,b),p(f,O,l),f.newSegmentStartIndex=h+O,c(l)}),t.on("connectionSegment.move.hover",function(l){l.context.hover=l.hover,n.addMarker(l.hover,mg)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(l){var f=l.context.hover;f&&n.removeMarker(f,mg)}),t.on("connectionSegment.move.cleanup",function(l){var f=l.context,d=f.connection;f.draggerGfx&&Ce(f.draggerGfx),n.removeMarker(d,gg)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(l){var f=l.context,d=f.connection;d.waypoints=f.originalWaypoints,c(l)}),t.on("connectionSegment.move.end",function(l){var f=l.context,d=f.connection,h=f.newWaypoints,y=f.newSegmentStartIndex;h=h.map(function(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var v=u(h,y),w=v.waypoints,R=s(d,w),b=v.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:y+b}};o.updateWaypoints(d,R,x)})}Cp.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var s1=Math.abs,xg=Math.round;function bg(e,t,n){n=n===void 0?10:n;var r,i;for(r=0;ro-uf)return a-c+o}return a}function n(o,a){if(o.waypoints)return cg(a,o);if(o.width)return{x:Eg(o.width/2+o.x),y:Eg(o.height/2+o.y)}}function r(o){var a=o.context,s=a.snapPoints,c=a.connection,p=c.waypoints,u=a.segmentStart,l=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var y=[p[l-1],u,f,p[d+1]];return l<2&&y.unshift(n(c.source,o)),d>p.length-3&&y.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},E(y,function(v){v&&(v=v.original||v,h==="y"&&s.horizontal.push(v.y),h==="x"&&s.vertical.push(v.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=r(o),s=o.x,c=o.y,p,u;if(a){p=t(a.vertical,s),u=t(a.horizontal,c);var l=s-p,f=c-u;S(o,{dx:o.dx-l,dy:o.dy-f,x:p,y:u}),(l||a.vertical.indexOf(s)!==-1)&&He(o,"x",p),(f||a.horizontal.indexOf(c)!==-1)&&He(o,"y",u)}});function i(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var p=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},E(p,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!le(s)||!c||!c.x||!c.y||(He(o,"x",c.x),He(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=i(a),c=a.hover,p=c&&n(c,o),u=o.x,l=o.y,f,d;if(s){f=t(p?s.vertical.concat([p.x]):s.vertical,u),d=t(p?s.horizontal.concat([p.y]):s.horizontal,l);var h=u-f,y=l-d;S(o,{dx:o.dx-h,dy:o.dy-y,x:o.x-h,y:o.y-y}),(h||s.vertical.indexOf(u)!==-1)&&He(o,"x",f),(y||s.horizontal.indexOf(l)!==-1)&&He(o,"y",d)}})}Tp.$inject=["eventBus"];var wg={__depends__:[Ct,gt],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Ep],bendpointMove:["type",Fa],bendpointMovePreview:["type",Sp],connectionSegmentMove:["type",Cp],bendpointSnapping:["type",Tp]};function Dp(e,t,n,r){function i(a,s){return r.allowed("connection.create",{source:a,target:s})}function o(a,s){return i(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,p=a.hover,u;if(s.hover=p,u=s.canExecute=i(c,p),!Tr(u)){if(u!==!1){s.source=c,s.target=p;return}u=s.canExecute=o(c,p),!Tr(u)&&u!==!1&&(s.source=p,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,p=s.connectionStart,u={x:a.x,y:a.y},l=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:Mp(s)?u:p,connectionEnd:Mp(s)?p:u};Pe(c)&&(d=c),s.connection=n.connect(l,f,d,h)}),this.start=function(a,s,c,p){Pe(c)||(p=c,c=q(s)),t.init(a,"connect",{autoActivate:p,data:{shape:s,context:{start:s,connectionStart:c}}})}}Dp.$inject=["eventBus","dragging","modeling","rules"];function Mp(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}var p1=1100,u1=900,Sg="connect-ok",Cg="connect-not-ok";function kp(e,t,n){var r=e.get("connectionPreview",!1);r&&t.on("connect.move",function(i){var o=i.context,a=o.canExecute,s=o.hover,c=o.source,p=o.start,u=o.startPosition,l=o.target,f=o.connectionStart||u,d=o.connectionEnd||{x:i.x,y:i.y},h=f,y=d;Mp(o)&&(h=d,y=f),r.drawPreview(o,a,{source:c||p,target:l||s,connectionStart:h,connectionEnd:y})}),t.on("connect.hover",u1,function(i){var o=i.context,a=i.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Sg:Cg)}),t.on(["connect.out","connect.cleanup"],p1,function(i){var o=i.hover;o&&(n.removeMarker(o,Sg),n.removeMarker(o,Cg))}),r&&t.on("connect.cleanup",function(i){r.cleanUp(i.context)})}kp.$inject=["injector","eventBus","canvas"];var Po={__depends__:[Qe,gt,Ct],__init__:["connectPreview"],connect:["type",Dp],connectPreview:["type",kp]};var l1="djs-dragger";function Nn(e,t,n,r){this._canvas=t,this._graphicsFactory=n,this._elementFactory=r,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Nn.$inject=["injector","canvas","graphicsFactory","elementFactory"];Nn.prototype.drawPreview=function(e,t,n){n=n||{};var r=e.connectionPreviewGfx,i=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,p=n.connectionEnd,u=n.noLayout,l=n.noCropping,f=n.noNoop,d,h=this;if(r||(r=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),cr(r),i||(i=e.getConnection=f1(function(y,v,w){return h.getConnection(y,v,w)})),t&&(d=i(t,o,a)),!d){!f&&this.drawNoopPreview(r,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:p,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?q(o):c,a?q(a):p]),this._connectionDocking&&(o||a)&&!l&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(r,d,{stroke:"var(--element-dragger-color)"})};Nn.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||q(n),o=t.connectionEnd||q(r),a=this.cropWaypoints(i,o,n,r),s=this.createNoopConnection(a[0],a[1]);Z(e,s)};Nn.prototype.cropWaypoints=function(e,t,n,r){var i=this._graphicsFactory,o=n&&i.getShapePath(n),a=r&&i.getShapePath(r),s=i.getConnectionPath({waypoints:[e,t]});return e=n&&jr(o,s,!0)||e,t=r&&jr(a,s,!1)||t,[e,t]};Nn.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ce(e.connectionPreviewGfx)};Nn.prototype.getConnection=function(e){var t=d1(e);return this._elementFactory.createConnection(t)};Nn.prototype.createConnectionPreviewGfx=function(){var e=G("g");return H(e,{pointerEvents:"none"}),ce(e).add(l1),Z(this._canvas.getActiveLayer(),e),e};Nn.prototype.createNoopConnection=function(e,t){return Hn([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function f1(e){var t={};return function(n){var r=JSON.stringify(n),i=t[r];return i||(i=t[r]=e.apply(null,arguments)),i}}function d1(e){return Pe(e)?e:{}}var Rg={__init__:["connectionPreview"],connectionPreview:["type",Nn]};var h1=new qn("ps"),m1=["marker-start","marker-mid","marker-end"],g1=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Zn(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r}Zn.$inject=["elementRegistry","eventBus","canvas","styles"];Zn.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")};Zn.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)};Zn.prototype.addDragger=function(e,t,n,r="djs-dragger"){n=n||this.getGfx(e);var i=nl(n),o=n.getBoundingClientRect();return this._cloneMarkers(Pn(i),r),H(i,this._styles.cls(r,[],{x:o.top,y:o.left})),Z(t,i),H(i,"data-preview-support-element-id",e.id),i};Zn.prototype.addFrame=function(e,t){var n=G("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Z(t,n),H(n,"data-preview-support-element-id",e.id),n};Zn.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var r=this;e.childNodes&&e.childNodes.forEach(i=>{r._cloneMarkers(i,t,n)}),x1(e)&&m1.forEach(function(i){if(H(e,i)){var o=v1(e,i,r._canvas.getContainer());o&&r._cloneMarker(n,e,o,i,t)}})};Zn.prototype._cloneMarker=function(e,t,n,r,i="djs-dragger"){var o=[n.id,i,h1.next()].join("-"),a=ve("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||nl(n);s.id=o,ce(s).add(i);var c=ve(":scope > defs",e);c||(c=G("defs"),Z(e,c)),Z(c,s);var p=_1(s.id);H(t,r,p)};function v1(e,t,n){var r=y1(H(e,t));return ve("marker#"+r,n||document)}function y1(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function _1(e){return"url(#"+e+")"}function x1(e){return g1.indexOf(e.nodeName)!==-1}var bn={__init__:["previewSupport"],previewSupport:["type",Zn]};var Np="complex-preview",To=class{constructor(t,n,r){this._canvas=t,this._graphicsFactory=n,this._previewSupport=r,this._markers=[]}create(t){this.cleanUp();let{created:n=[],moved:r=[],removed:i=[],resized:o=[]}=t,a=this._canvas.getLayer(Np);n.filter(s=>!b1(s)).forEach(s=>{let c;le(s)?(c=this._graphicsFactory._createContainer("connection",G("g")),this._graphicsFactory.drawConnection(Pn(c),s)):(c=this._graphicsFactory._createContainer("shape",G("g")),this._graphicsFactory.drawShape(Pn(c),s),Ie(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),r.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);let p=this._previewSupport.addDragger(s,a);le(s)?Ie(p,c.x,c.y):Ie(p,s.x+c.x,s.y+c.y)}),i.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");let p=this._graphicsFactory._createContainer("shape",G("g"));this._graphicsFactory.drawShape(Pn(p),s,{width:c.width,height:c.height}),Ie(p,c.x,c.y),this._previewSupport.addDragger(s,a,p)})}cleanUp(){cr(this._canvas.getLayer(Np)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Np)}hide(){this._canvas.hideLayer(Np)}};To.$inject=["canvas","graphicsFactory","previewSupport"];function b1(e){return e.hidden}var Ag={__depends__:[bn],__init__:["complexPreview"],complexPreview:["type",To]};var lf=["top","bottom","left","right"],Op=10;function $a(e,t){k.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(i){var o=i.context,a=o.connection,s=a.source,c=a.target,p=o.hints||{};p.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(i){var o=i.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(i){var o=i.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(i){if($r(i)&&!le(i)){var o=S1(i);o&&r(i,o)}}function r(i,o){var a=q(i),s=i.label,c=q(s);if(s.parent){var p=X(i),u;switch(o){case"top":u={x:a.x,y:p.top-Op-s.height/2};break;case"left":u={x:p.left-Op-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:p.bottom+Op+s.height/2};break;case"right":u={x:p.right+Op+s.width/2,y:a.y};break}var l=St(u,c);t.moveShape(s,l)}}}N($a,k);$a.$inject=["eventBus","modeling"];function E1(e){var t=e.host,n=q(e),r=je(n,t),i;r.indexOf("-")>=0?i=r.split("-"):i=[r];var o=lf.filter(function(a){return i.indexOf(a)===-1});return o}function w1(e){var t=q(e),n=[].concat(e.incoming.map(function(r){return r.waypoints[r.waypoints.length-2]}),e.outgoing.map(function(r){return r.waypoints[1]})).map(function(r){return Pg(t,r)});return n}function S1(e){var t=q(e.label),n=q(e),r=Pg(n,t);if(C1(r)){var i=w1(e);if(e.host){var o=E1(e);i=i.concat(o)}var a=lf.filter(function(s){return i.indexOf(s)===-1});return a.indexOf(r)!==-1?je(e.label,e)!=="intersect"?void 0:r:a[0]}}function Pg(e,t){return je(t,e,5)}function C1(e){return lf.indexOf(e)!==-1}function za(e){k.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,r=t.shape;t.position||(m(r,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-r.height/2}:t.position={x:n.x+n.width+80+r.width/2,y:n.y+n.height/2})},!0)}N(za,k);za.$inject=["eventBus"];var R1=1500;function Va(e,t,n){e.invoke(k,this),this.preExecute("elements.delete",R1,function(i){var o=i.context,a=o.elements,s=r(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(i){var o=i.context.shapes,a=r(o);a.length&&(i.context.shapes=o.concat(a))});function r(i){var o=Q(i,p=>m(p,"bpmn:Participant")||m(p,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(p=>m(p,"bpmn:Artifact"))),c=new Set;return E(o,p=>{let u=new Set(Sn(fi(Array.from(s),we(p))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}N(Va,k);Va.$inject=["injector","eventBus","canvas"];function Wa(e,t){e.invoke(k,this),this.postExecute("shape.move",function(n){var r=n.newParent,i=n.shape,o=Q(i.incoming.concat(i.outgoing),function(a){return m(a,"bpmn:Association")});E(o,function(a){t.moveConnection(a,{x:0,y:0},r)})},!0)}N(Wa,k);Wa.$inject=["injector","modeling"];var Tg=500;function Mo(e,t){t.invoke(k,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Tg,function(r){var i=r.elements;i=i.filter(function(o){var a=o.host;return Mg(o,a)}),i.length===1&&i.map(function(o){return i.indexOf(o)}).forEach(function(o){var a=i[o];r.elements[o]=n._replaceShape(i[o],a)})},!0),this.preExecute("elements.move",Tg,function(r){var i=r.shapes,o=r.newHost;if(i.length===1){var a=i[0];Mg(a,o)&&(r.shapes=[n._replaceShape(a,o)])}},!0)}Mo.$inject=["bpmnReplace","injector"];N(Mo,k);Mo.prototype._replaceShape=function(e,t){var n=A1(e),r={type:"bpmn:BoundaryEvent",host:t};return n&&(r.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,r,{layoutConnection:!1})};function A1(e){var t=L(e),n=t.eventDefinitions;return n&&n[0]}function Mg(e,t){return!J(e)&&ee(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Ga(e,t){k.call(this,e);function n(r){return Q(r.attachers,function(i){return m(i,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(r){var i=r.context.source,o=r.context.target,a=n(o);m(i,"bpmn:EventBasedGateway")&&m(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(r){var i=r.context.oldSource,o=r.context.newSource;m(i,"bpmn:Gateway")&&m(o,"bpmn:EventBasedGateway")&&E(o.outgoing,function(a){var s=a.target,c=n(s);m(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Ga.$inject=["eventBus","modeling"];N(Ga,k);function Ka(e,t,n){k.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",i,!0),this.postExecuted("connection.delete",r,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function r(v){let w=v.source,R=v.target;Do(w)&&Ua(R)&&u(R)}function i(v){let w=v.connection,R=v.source,b=v.target;Do(R)&&Bp(b)&&(p(b),f(R,[w]))}function o(v){let w=v.newTarget,R=v.oldSource,b=v.oldTarget;if(b!==w){let x=R;Ua(b)&&u(b),Do(x)&&Bp(w)&&p(w)}}function a(v){let{element:w}=v;Ua(w)?(l(w),d(w)):Bp(w)&&h(w)}function s(v){let{newData:w,oldShape:R}=v;if(Do(v.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){let b=R.outgoing.find(({target:x})=>Ua(x));b&&b.target&&(v._connectionTarget=b.target)}else if(!Do(v.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){let b=R.outgoing.find(({target:x})=>Bp(x));b&&b.target&&(v._connectionTarget=b.target),y(R)}}function c(v){let{_connectionTarget:w,newShape:R}=v;w&&t.connect(R,w)}function p(v){t.updateProperties(v,{isForCompensation:!0})}function u(v){t.updateProperties(v,{isForCompensation:void 0})}function l(v){for(let w of v.incoming)n.canConnect(w.source,v)||t.removeConnection(w);for(let w of v.outgoing)n.canConnect(v,w.target)||t.removeConnection(w)}function f(v,w){v.outgoing.filter(x=>m(x,"bpmn:Association")).filter(x=>Ua(x.target)&&!w.includes(x)).forEach(x=>t.removeConnection(x))}function d(v){let w=v.attachers.slice();w.length&&t.removeElements(w)}function h(v){let w=v.incoming.filter(R=>Do(R.source));t.removeElements(w)}function y(v){let w=v.outgoing.filter(R=>m(R,"bpmn:SequenceFlow"));t.removeElements(w)}}N(Ka,k);Ka.$inject=["eventBus","modeling","bpmnRules"];function Ua(e){let t=L(e);return t&&t.get("isForCompensation")}function Do(e){return e&&m(e,"bpmn:BoundaryEvent")&&lr(e,"bpmn:CompensateEventDefinition")}function Bp(e){return e&&m(e,"bpmn:Activity")&&!qe(e)}function Ya(e){e.invoke(k,this),this.preExecute("shape.create",1500,function(t){var n=t.context,r=n.parent,i=n.shape;m(r,"bpmn:Lane")&&!m(i,"bpmn:Lane")&&(n.parent=Er(r,"bpmn:Participant"))})}Ya.$inject=["injector"];N(Ya,k);function qa(e,t){k.call(this,e),this.preExecute("shape.create",function(n){var a;var r=n.context,i=r.shape;if(m(i,"bpmn:DataObjectReference")&&i.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=i.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,i.businessObject.dataObjectRef=o}})}qa.$inject=["eventBus","bpmnFactory"];N(qa,k);var ff=20,df=20,Dg=30,Ip=2e3;function Xa(e,t,n){k.call(this,t),t.on(["create.start","shape.move.start"],Ip,function(i){var o=i.context,a=o.shape,s=e.getRootElement();if(!(!m(a,"bpmn:Participant")||!m(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(l){return!m(l,"bpmn:Group")&&!J(l)&&!le(l)});if(c.length){var p=we(c),u=P1(a,p);S(a,u),o.createConstraints=T1(a,p)}}}),t.on("create.start",Ip,function(i){var o=i.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function p(u){u.element=s,u.gfx=c}m(a,"bpmn:Participant")&&m(s,"bpmn:Process")&&(t.on("element.hover",Ip,p),t.once("create.cleanup",function(){t.off("element.hover",p)}))});function r(){var i=e.getRootElement();return m(i,"bpmn:Collaboration")?i:n.makeCollaboration()}this.preExecute("elements.create",Ip,function(i){var o=i.elements,a=i.parent,s=M1(o),c;s&&m(a,"bpmn:Process")&&(i.parent=r(),c=i.hints=i.hints||{},c.participant=s,c.process=a,c.processRef=L(s).get("processRef"))},!0),this.preExecute("shape.create",function(i){var o=i.parent,a=i.shape;m(a,"bpmn:Participant")&&m(o,"bpmn:Process")&&(i.parent=r(),i.process=o,i.processRef=L(a).get("processRef"))},!0),this.execute("shape.create",function(i){var o=i.hints||{},a=i.process||o.process,s=i.shape,c=o.participant;a&&(!c||s===c)&&L(s).set("processRef",L(a))},!0),this.revert("shape.create",function(i){var o=i.hints||{},a=i.process||o.process,s=i.processRef||o.processRef,c=i.shape,p=o.participant;a&&(!p||c===p)&&L(c).set("processRef",s)},!0),this.postExecute("shape.create",function(i){var o=i.hints||{},a=i.process||i.hints.process,s=i.shape,c=o.participant;if(a){var p=a.children.slice();c?s===c&&n.moveElements(p,{x:0,y:0},c):n.moveElements(p,{x:0,y:0},s)}},!0)}Xa.$inject=["canvas","eventBus","modeling"];N(Xa,k);function P1(e,t){t={width:t.width+ff*2+Dg,height:t.height+df*2};var n=Math.max(e.width,t.width),r=Math.max(e.height,t.height);return{x:-n/2,y:-r/2,width:n,height:r}}function T1(e,t){return t=X(t),{bottom:t.top+e.height/2-df,left:t.right-e.width/2+ff,top:t.bottom-e.height/2+df,right:t.left+e.width/2-ff-Dg}}function M1(e){return ne(e,function(t){return m(t,"bpmn:Participant")})}var kg="__targetRef_placeholder";function Za(e,t){k.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Ng(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Ng(o));function n(a,s,c){var p=a.get("dataInputAssociations");return ne(p,function(u){return u!==c&&u.targetRef===s})}function r(a,s){var c=a.get("properties"),p=ne(c,function(u){return u.name===kg});return!p&&s&&(p=t.create("bpmn:Property",{name:kg}),Re(c,p)),p}function i(a,s){var c=r(a);c&&(n(a,c,s)||Ne(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,p=c.businessObject,u=c.target,l=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,h=s.oldTarget||s.target,y=h&&h.businessObject,v=c.businessObject,w;y&&y!==l&&i(y,p),d&&d!==l&&i(d,p),l?(w=r(l,!0),v.targetRef=w):v.targetRef=null}}Za.$inject=["eventBus","bpmnFactory"];N(Za,k);function Ng(e){return function(t){var n=t.context,r=n.connection;if(m(r,"bpmn:DataInputAssociation"))return e(t)}}function ko(e){this._bpmnUpdater=e}ko.$inject=["bpmnUpdater"];ko.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.newSemanticParent,i=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]};ko.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.oldSemanticParent,i=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]};function Qa(e,t,n,r){k.call(this,r),t.registerHandler("dataStore.updateContainment",ko);function i(){return n.filter(function(s){return m(s,"bpmn:Participant")&&L(s).processRef})[0]}function o(s){return s.children.filter(function(c){return m(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var p=s.businessObject||s;if(c=c||i(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:p,dataStoreDi:se(s),newSemanticParent:u.processRef||u,newDiParent:se(c)})}}this.preExecute("shape.create",function(s){var c=s.context,p=c.shape;m(p,"bpmn:DataStoreReference")&&p.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,p=c.shapes,u=p.filter(function(l){return m(l,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=p.filter(function(l){return!m(l,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,p=c.shape,u=p.parent;m(p,"bpmn:DataStoreReference")&&p.type!=="label"&&m(u,"bpmn:Collaboration")&&a(p)}),this.postExecute("shape.move",function(s){var c=s.context,p=c.shape,u=c.oldParent,l=p.parent;if(!m(u,"bpmn:Collaboration")&&m(p,"bpmn:DataStoreReference")&&p.type!=="label"&&m(l,"bpmn:Collaboration")){var f=m(u,"bpmn:Participant")?u:k1(u,"bpmn:Participant");a(p,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,p=c.shape,u=e.getRootElement();ee(p,["bpmn:Participant","bpmn:SubProcess"])&&m(u,"bpmn:Collaboration")&&o(u).filter(function(l){return D1(l,p)}).forEach(function(l){a(l)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,p=c.oldRoot,u=c.newRoot,l=o(p);l.forEach(function(f){m(u,"bpmn:Process")&&a(f,u)})})}Qa.$inject=["canvas","commandStack","elementRegistry","eventBus"];N(Qa,k);function D1(e,t){for(var n=e.businessObject||e,r=t.businessObject||t;n.$parent;){if(n.$parent===r.processRef||r)return!0;n=n.$parent}return!1}function k1(e,t){for(;e.parent;){if(m(e.parent,t))return e.parent;e=e.parent}}var jp=Math.max,Fp=Math.min,N1=20;function Hp(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Og(e,t,n){var r=n.x,i=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(o.y=e.y+i,o.height=e.height-i):t.indexOf("s")!==-1&&(o.height=e.height+i),t.indexOf("e")!==-1?o.width=e.width+r:t.indexOf("w")!==-1&&(o.x=e.x+r,o.width=e.width-r),o}function Bg(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)}}function Lp(e,t,n){var r=t[e],i=n.min&&n.min[e],o=n.max&&n.max[e];return te(i)&&(r=(/top|left/.test(e)?Fp:jp)(r,i)),te(o)&&(r=(/top|left/.test(e)?jp:Fp)(r,o)),r}function Ig(e,t){if(!t)return e;var n=X(e);return di({top:Lp("top",n,t),right:Lp("right",n,t),bottom:Lp("bottom",n,t),left:Lp("left",n,t)})}function Lg(e,t,n,r){var i=X(t),o={top:/n/.test(e)?i.bottom-n.height:i.top,left:/w/.test(e)?i.right-n.width:i.left,bottom:/s/.test(e)?i.top+n.height:i.bottom,right:/e/.test(e)?i.left+n.width:i.right},a=r?X(r):o,s={top:Fp(o.top,a.top),left:Fp(o.left,a.left),bottom:jp(o.bottom,a.bottom),right:jp(o.right,a.right)};return di(s)}function Ja(e,t){return typeof e!="undefined"?e:N1}function O1(e,t){var n,r,i,o;return typeof t=="object"?(n=Ja(t.left),r=Ja(t.right),i=Ja(t.top),o=Ja(t.bottom)):n=r=i=o=Ja(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+o}}function B1(e){return!(e.waypoints||e.type==="label")}function $p(e,t){var n;if(e.length===void 0?n=Q(e.children,B1):n=e,n.length)return O1(we(n),t)}var Qr=Math.abs;function I1(e,t){return Hp(X(t),X(e))}var L1=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],qt=30;function No(e,t){return t=t||[],e.children.filter(function(n){m(n,"bpmn:Lane")&&(No(n,t),t.push(n))}),t}function pn(e){return e.children.filter(function(t){return m(t,"bpmn:Lane")})}function Pt(e){return Er(e,L1)||e}function jg(e,t){var n=Pt(e),r=m(n,"bpmn:Process")?[]:[n],i=No(n,r),o=X(e),a=X(t),s=I1(e,t),c=[],p=Te(e);return i.forEach(function(u){if(u!==e){var l=p?0:s.top,f=p?s.right:0,d=p?0:s.bottom,h=p?s.left:0,y=X(u);s.top&&(Qr(y.bottom-o.top)<10&&(d=a.top-y.bottom),Qr(y.top-o.top)<5&&(l=a.top-y.top)),s.left&&(Qr(y.right-o.left)<10&&(f=a.left-y.right),Qr(y.left-o.left)<5&&(h=a.left-y.left)),s.bottom&&(Qr(y.top-o.bottom)<10&&(l=a.bottom-y.top),Qr(y.bottom-o.bottom)<5&&(d=a.bottom-y.bottom)),s.right&&(Qr(y.left-o.right)<10&&(h=a.right-y.left),Qr(y.right-o.right)<5&&(f=a.right-y.right)),(l||f||d||h)&&c.push({shape:u,newBounds:Bg(u,{top:l,right:f,bottom:d,left:h})})}}),c}var j1=500;function es(e,t){k.call(this,e);function n(r,i){var o=Te(r),a=pn(i),s=[],c=[],p=[],u=[];if(An(a,function(v){return o?v.y>r.y?c.push(v):s.push(v):v.x>r.x?u.push(v):p.push(v),v.children}),!!a.length){var l;o?c.length&&s.length?l=r.height/2:l=r.height:u.length&&p.length?l=r.width/2:l=r.width;var f,d,h,y;s.length&&(f=t.calculateAdjustments(s,"y",l,r.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:l},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-l,r.y+r.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-l},"n")),p.length&&(h=t.calculateAdjustments(p,"x",l,r.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:l,y:0},"e")),u.length&&(y=t.calculateAdjustments(u,"x",-l,r.x+r.width+10),t.makeSpace(y.movingShapes,y.resizingShapes,{x:-l,y:0},"w"))}}this.postExecuted("shape.delete",j1,function(r){var i=r.context,o=i.hints,a=i.shape,s=i.oldParent;m(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}es.$inject=["eventBus","spaceTool"];N(es,k);var Fg=500;function Oo(e,t){t.invoke(k,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Fg,function(r){var i=r.elements;i.filter(function(o){var a=o.host;return Hg(o,a)}).map(function(o){return i.indexOf(o)}).forEach(function(o){r.elements[o]=n._replaceShape(i[o])})},!0),this.preExecute("elements.move",Fg,function(r){var i=r.shapes,o=r.newHost;i.forEach(function(a,s){var c=a.host;Hg(a,H1(i,c)?c:o)&&(i[s]=n._replaceShape(a))})},!0)}Oo.$inject=["bpmnReplace","injector"];N(Oo,k);Oo.prototype._replaceShape=function(e){var t=F1(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function F1(e){var t=L(e),n=t.eventDefinitions;return n&&n[0]}function Hg(e,t){return!J(e)&&m(e,"bpmn:BoundaryEvent")&&!t}function H1(e,t){return e.indexOf(t)!==-1}function ts(e,t,n){k.call(this,e);function r(i,o,a){var s=o.waypoints,c,p,u,l,f,d,h,y=i.outgoing.slice(),v=i.incoming.slice(),w;te(a.width)?w=q(a):w=a;var R=Na(s,w);if(R){if(c=s.slice(0,R.index),p=s.slice(R.index+(R.bendpoint?1:0)),!c.length||!p.length)return;u=R.bendpoint?s[R.index]:w,(c.length===1||!$g(i,c[c.length-1]))&&c.push(zg(u)),(p.length===1||!$g(i,p[0]))&&p.unshift(zg(u))}l=o.source,f=o.target,t.canConnect(l,i,o)&&(n.reconnectEnd(o,i,c||w),d=o),t.canConnect(i,f,o)&&(d?h=n.connect(i,f,{type:o.type,waypoints:p}):(n.reconnectStart(o,i,p||w),h=o));var b=[].concat(d&&Q(v,function(x){return x.source===d.source})||[],h&&Q(y,function(x){return x.target===h.target})||[]);b.length&&n.removeElements(b)}this.preExecute("elements.move",function(i){var o=i.newParent,a=i.shapes,s=i.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(i.newParent=o=o.parent);var p=q(c),u={x:p.x+s.x,y:p.y+s.y},l=ne(o.children,function(f){var d=t.canInsert(a,f);return d&&Na(f.waypoints,u)});l&&(i.targetFlow=l,i.position=u)}},!0),this.postExecuted("elements.move",function(i){var o=i.shapes,a=i.targetFlow,s=i.position;a&&r(o[0],a,s)},!0),this.preExecute("shape.create",function(i){var o=i.parent,a=i.shape;t.canInsert(a,o)&&(i.targetFlow=o,i.parent=o.parent)},!0),this.postExecuted("shape.create",function(i){var o=i.shape,a=i.targetFlow,s=i.position;a&&r(o,a,s)},!0)}N(ts,k);ts.$inject=["eventBus","bpmnRules","modeling"];function $g(e,t){var n=t.x,r=t.y;return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}function zg(e){return S({},e)}function ns(e,t){k.call(this,e),this.preExecuted("connection.create",function(n){var r=n.context,i=r.connection,o=r.source,a=r.target,s=r.hints;if(!(s&&s.createElementsBehavior===!1)&&Bo(i)){var c=[];m(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(p=>p!==i&&Bo(p)):c=a.incoming.filter(p=>p!==i&&Bo(p)&&m(p.source,"bpmn:EventBasedGateway")),c.forEach(function(p){t.removeConnection(p)})}}),this.preExecuted("shape.replace",function(n){var r=n.context,i=r.newShape;if(m(i,"bpmn:EventBasedGateway")){var o=i.outgoing.filter(Bo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Bo).forEach(function(s){let c=a.incoming.filter(Bo).filter(function(p){return p.source===i});(s.source!==i||c.length>1)&&t.removeConnection(s)})})}})}ns.$inject=["eventBus","modeling"];N(ns,k);function Bo(e){return m(e,"bpmn:SequenceFlow")}var zp=1500,Vg=2e3;function Vp(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],zp,function(r){var i=r.context,o=i.shape||r.shape,a=r.hover;m(a,"bpmn:Lane")&&!ee(o,["bpmn:Lane","bpmn:Participant"])&&(r.hover=Pt(a),r.hoverGfx=e.getGraphics(r.hover));var s=n.getRootElement();a!==s&&(o.labelTarget||ee(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(r.hover=s,r.hoverGfx=e.getGraphics(r.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],zp,function(r){var i=r.hover;m(i,"bpmn:Lane")&&(r.hover=Pt(i)||i,r.hoverGfx=e.getGraphics(r.hover))}),t.on(["bendpoint.move.hover"],zp,function(r){var i=r.context,o=r.hover,a=i.type;m(o,"bpmn:Lane")&&/reconnect/.test(a)&&(r.hover=Pt(o)||o,r.hoverGfx=e.getGraphics(r.hover))}),t.on(["connect.start"],zp,function(r){var i=r.context,o=i.start;m(o,"bpmn:Lane")&&(i.start=Pt(o)||o)}),t.on("shape.move.start",Vg,function(r){var i=r.shape;m(i,"bpmn:Lane")&&(r.shape=Pt(i)||i)}),t.on("spaceTool.move",Vg,function(r){var i=r.hover;i&&m(i,"bpmn:Lane")&&(r.hover=Pt(i))})}Vp.$inject=["elementRegistry","eventBus","canvas"];function Wg(e){return e.create("bpmn:Category")}function Gg(e){return e.create("bpmn:CategoryValue")}function Ug(e,t,n){return Re(t.get("categoryValue"),e),e.$parent=t,Re(n.get("rootElements"),t),t.$parent=n,e}function Kg(e){var t=e.$parent;return t&&(Ne(t.get("categoryValue"),e),e.$parent=null),e}function Yg(e){var t=e.$parent;return t&&(Ne(t.get("rootElements"),e),e.$parent=null),e}var qg=770;function rs(e,t,n,r,i,o){i.invoke(k,this);function a(){return n.filter(function(h){return m(h,"bpmn:Group")})}function s(h,y){return h.some(function(v){var w=L(v),R=w.categoryValueRef&&w.categoryValueRef.$parent;return R===y})}function c(h,y){return h.some(function(v){var w=L(v);return w.categoryValueRef===y})}function p(h,y,v){var w=a().filter(function(R){return R.businessObject!==v});y&&!s(w,y)&&Yg(y),h&&!c(w,h)&&Kg(h)}function u(h,y){return Ug(h,y,t.getDefinitions())}function l(h,y){var v=L(h),w=v.categoryValueRef;w||(w=v.categoryValueRef=y.categoryValue=y.categoryValue||Gg(e));var R=w.$parent;R||(R=w.$parent=y.category=y.category||Wg(e)),u(w,R,t.getDefinitions())}function f(h,y){var v=y.category,w=y.categoryValue,R=L(h);w?(R.categoryValueRef=null,p(w,v,R)):p(null,R.categoryValueRef.$parent,R)}this.execute("label.create",function(h){var y=h.context,v=y.labelTarget;m(v,"bpmn:Group")&&l(v,y)}),this.revert("label.create",function(h){var y=h.context,v=y.labelTarget;m(v,"bpmn:Group")&&f(v,y)}),this.execute("shape.delete",function(h){var y=h.context,v=y.shape,w=L(v);if(!(!m(v,"bpmn:Group")||v.labelTarget)){var R=y.categoryValue=w.categoryValueRef,b;R&&(b=y.category=R.$parent,p(R,b,w),w.categoryValueRef=null)}}),this.reverted("shape.delete",function(h){var y=h.context,v=y.shape;if(!(!m(v,"bpmn:Group")||v.labelTarget)){var w=y.category,R=y.categoryValue,b=L(v);R&&(b.categoryValueRef=R,u(R,w))}}),this.execute("shape.create",function(h){var y=h.context,v=y.shape;!m(v,"bpmn:Group")||v.labelTarget||L(v).categoryValueRef&&l(v,y)}),this.reverted("shape.create",function(h){var y=h.context,v=y.shape;!m(v,"bpmn:Group")||v.labelTarget||L(v).categoryValueRef&&f(v,y)});function d(h,y){var v=e.create(h.$type);return o.copyElement(h,v,null,y)}r.on("copyPaste.copyElement",qg,function(h){var y=h.descriptor,v=h.element;if(!(!m(v,"bpmn:Group")||v.labelTarget)){var w=L(v);if(w.categoryValueRef){var R=w.categoryValueRef;y.categoryValue=d(R,!0),R.$parent&&(y.category=d(R.$parent,!0))}}}),r.on("copyPaste.pasteElement",qg,function(h){var y=h.descriptor,v=y.businessObject,w=y.categoryValue,R=y.category;w&&(w=v.categoryValueRef=d(w)),R&&(w.$parent=d(R)),delete y.category,delete y.categoryValue})}rs.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"];N(rs,k);function Io(e,t,n,r){var i,o,a,s,c;return i=(r.y-n.y)*(t.x-e.x)-(r.x-n.x)*(t.y-e.y),i==0?null:(o=e.y-n.y,a=e.x-n.x,c=(r.x-n.x)*o-(r.y-n.y)*a,s=c/i,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Wp(e){function t(r,i,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Io(r,i,o,a),p=Io(r,i,o,s),u;c&&p?Xg(c,o)>Xg(p,o)?u=p:u=c:u=c||p,r.original=u}function n(r){var i=r.waypoints;t(i[0],i[1],q(r.source)),t(i[i.length-1],i[i.length-2],q(r.target))}e.on("bpmnElement.added",function(r){var i=r.element;i.waypoints&&n(i)})}Wp.$inject=["eventBus"];function Xg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function is(e){k.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var r=n.context.shape,i=L(r),o=se(r);if(ee(i,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}is.$inject=["eventBus"];N(is,k);var tv=Math.sqrt,nv=Math.min,$1=Math.max,Zg=Math.abs;function Qg(e){return Math.pow(e,2)}function os(e,t){return tv(Qg(e.x-t.x)+Qg(e.y-t.y))}function rv(e,t){var n=0,r,i,o,a,s,c,p,u,l,f,d;for(n=0;n line intersections");p.length===1&&(u={type:"bendpoint",position:p[0],segmentIndex:n,bendpointIndex:ev(r,p[0])?n:n+1}),p.length===2&&(s=W1(p[0],p[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:os(r,s)/os(r,i)}),l=os(u.position,e),(!d||f>l)&&(d=u,f=l)}return d}function z1(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=i*i+o*o,p=i*a+o*s,u=a*a+s*s-r*r,l=p/c,f=u/c,d=l*l-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=tv(d),y=-l+h,v=-l-h,w={x:e.x-i*y,y:e.y-o*y};if(d===0)return[w];var R={x:e.x-i*v,y:e.y-o*v};return[w,R].filter(function(b){return V1(b,e,t)})}function V1(e,t,n){return Jg(e.x,t.x,n.x)&&Jg(e.y,t.y,n.y)}function Jg(e,t,n){return e>=nv(t,n)-Gp&&e<=$1(t,n)+Gp}function W1(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Gp=.1;function ev(e,t){return Zg(e.x-t.x)<=Gp&&Zg(e.y-t.y)<=Gp}function ov(e,t,n,r){var i=n.segmentIndex,o=t.length-e.length;if(r.segmentMove){var a=r.segmentMove.segmentStartIndex,s=r.segmentMove.newSegmentStartIndex;return i===a?s:i>=s?i+o=p&&(u=c?i+1:i-1),it.length-2||p===null)return a;var u=iv(n,c),l=iv(t,p),f=s.position,d=U1(u,f),h=G1(u,l);if(s.type==="bendpoint"){var y=t.length-n.length,v=s.bendpointIndex,w=n[v];if(t.indexOf(w)!==-1)return a;if(y===0){var R=t[v];return i=R.x-s.position.x,o=R.y-s.position.y,{delta:{x:i,y:o},point:{x:e.x+i,y:e.y+o}}}y<0&&v!==0&&v{L(a.context.element)===a.context.moddleElement&&i(a)});function i(a){var s=a.context,c=s.element,p=s.properties;if(cv in p&&t.updateLabel(c,p[cv]),pv in p&&m(c,"bpmn:TextAnnotation")){var u=r.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},p[pv]||"");t.updateLabel(c,p.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var p=s.shape||s.connection;J(p)||!rn(p)||pt(p)&&t.updateLabel(p,pt(p))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,p=s.hints||{};c&&p.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,p=c.label,u=S({},s.hints),l=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged=="undefined"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged=="undefined"&&(u.endChanged=!!u.connectionEnd),sv(p,l,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var p=s.connection,u=p.label,l;!u||!u.parent||(l=o(a),t.moveShape(u,l))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,p=s.oldShape,u=L(c);u&&rn(u)&&p.label&&c.label&&(c.label.x=p.label.x,c.label.y=p.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,p=s.hints||{};if(!(!J(c)||p.autoResize)){var u=s.newBounds,l=r.getDimensions(pt(c)||"",{box:u,style:r.getExternalStyle()}),f=Math.ceil(l.height),d=u.y!==c.y,h=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?h-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,p=s.newBounds,u=s.oldBounds;if($r(c)){var l=c.label,f=q(l),d=J1(u),h=Q1(f,d),y=Z1(h,u,p);t.moveShape(l,y)}})}N(as,k);as.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function Z1(e,t,n){var r=Ti(e,t,n);return gn(St(r,e))}function Q1(e,t){if(t.length){var n=eC(e,t);return Oa(e,n)}}function J1(e){return[[{x:e.x,y:e.y},{x:e.x+(e.width||0),y:e.y}],[{x:e.x+(e.width||0),y:e.y},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y+(e.height||0)},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y},{x:e.x,y:e.y+(e.height||0)}]]}function eC(e,t){var n=t.map(function(i){return{line:i,distance:_p(e,i)}}),r=Rt(n,"distance");return r[0].line}function uv(e,t,n,r){return Up(e,t,n,r).point}function ss(e,t){k.call(this,e);function n(r,i){var o=r.context,a=o.connection,s=S({},o.hints),c=o.newWaypoints||a.waypoints,p=o.oldWaypoints;return typeof s.startChanged=="undefined"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged=="undefined"&&(s.endChanged=!!s.connectionEnd),uv(i,c,p,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(r){var i=r.context,o=i.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var p=c.waypoints[c.waypoints.length-1],u=n(r,p),l=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,l)}),a.forEach(function(c){var p=c.waypoints[0],u=n(r,p),l=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,l)})}),this.postExecute(["connection.move"],function(r){var i=r.context,o=i.connection,a=o.outgoing,s=o.incoming,c=i.delta;s.forEach(function(p){var u=p.waypoints[p.waypoints.length-1],l={x:u.x+c.x,y:u.y+c.y},f=[].concat(p.waypoints.slice(0,-1),[l]);t.updateWaypoints(p,f)}),a.forEach(function(p){var u=p.waypoints[0],l={x:u.x+c.x,y:u.y+c.y},f=[].concat([l],p.waypoints.slice(1));t.updateWaypoints(p,f)})})}N(ss,k);ss.$inject=["eventBus","modeling"];function Jr(e,t,n){var r=Kp(e),i=fv(r,t),o=r[0];return i.length?i[i.length-1]:Ti(o.original||o,n,t)}function ei(e,t,n){var r=Kp(e),i=fv(r,t),o=r[r.length-1];return i.length?i[0]:Ti(o.original||o,n,t)}function Lo(e,t,n){var r=Kp(e),i=lv(t,n),o=r[0];return Ti(o.original||o,i,t)}function jo(e,t,n){var r=Kp(e),i=lv(t,n),o=r[r.length-1];return Ti(o.original||o,i,t)}function lv(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Kp(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function fv(e,t){var n=Ve(e,nC);return Q(n,function(r){return tC(r,t)})}function tC(e,t){return je(t,e,1)==="intersect"}function nC(e){return e.original||e}function cs(e,t){k.call(this,e),this.postExecute("shape.replace",function(n){var r=n.oldShape,i=n.newShape;if(rC(r,i)){var o=iC(r);o.incoming.forEach(function(a){var s=ei(a,i,r);t.reconnectEnd(a,i,s)}),o.outgoing.forEach(function(a){var s=Jr(a,i,r);t.reconnectStart(a,i,s)})}},!0)}cs.$inject=["eventBus","modeling"];N(cs,k);function rC(e,t){return m(e,"bpmn:Participant")&&re(e)&&m(t,"bpmn:Participant")&&!re(t)}function iC(e){var t=$n([e],!1),n=[],r=[];return t.forEach(function(i){i!==e&&(i.incoming.forEach(function(o){m(o,"bpmn:MessageFlow")&&n.push(o)}),i.outgoing.forEach(function(o){m(o,"bpmn:MessageFlow")&&r.push(o)}))},[]),{incoming:n,outgoing:r}}var oC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Yp(e){let t=L(e);if(!m(t,"bpmn:BoundaryEvent")&&!(m(t,"bpmn:StartEvent")&&qe(t.$parent)))return!1;let n=t.get("eventDefinitions");return!n||!n.length?!1:oC.some(r=>m(n[0],r))}function qp(e){return m(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function ps(e,t){e.invoke(k,this),this.postExecuted("shape.replace",function(n){let r=n.context.oldShape,i=n.context.newShape,o=n.context.hints;if(!Yp(i))return;let a=qp(i);if(o.targetElement&&o.targetElement[a]!==void 0)return;let c=L(r).get(a),p=L(i).get(a);c!==p&&t.updateProperties(i,{[a]:c})})}ps.$inject=["injector","modeling"];N(ps,k);function us(e,t){k.call(this,e),this.preExecute("shape.resize",function(n){var r=n.shape,i=se(r),o=i&&i.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(r,o,{bounds:void 0})},!0)}N(us,k);us.$inject=["eventBus","modeling"];function ls(e,t,n){k.call(this,e),this.preExecute("shape.delete",function(r){var i=r.context.shape;if(!(i.incoming.length!==1||i.outgoing.length!==1)){var o=i.incoming[0],a=i.outgoing[0];if(!(!m(o,"bpmn:SequenceFlow")||!m(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=aC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}N(ls,k);ls.$inject=["eventBus","bpmnRules","modeling"];function Fo(e){return e.original||e}function aC(e,t){var n=Io(Fo(e[e.length-2]),Fo(e[e.length-1]),Fo(t[1]),Fo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Fo(e[0]),Fo(t[t.length-1])]}function fs(e,t){k.call(this,e),this.preExecute("shape.delete",function(n){var r=n.shape,i=r.parent;m(r,"bpmn:Participant")&&(n.collaborationRoot=i)},!0),this.postExecute("shape.delete",function(n){var r=n.collaborationRoot;if(r&&!r.businessObject.participants.length){var i=t.makeProcess(),o=r.children.slice();t.moveElements(o,{x:0,y:0},i)}},!0)}fs.$inject=["eventBus","modeling"];N(fs,k);function ds(e,t,n,r){k.call(this,e);var i=r.get("dragging",!1);function o(c){var p=c.source,u=c.target,l=c.parent;if(l){var f,d;m(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(p,u)||(d=!0),n.canConnectMessageFlow(p,u)&&(f="bpmn:MessageFlow")),m(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(p,u)||(d=!0),n.canConnectSequenceFlow(p,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(p,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var p=c.context,u=p.connection,l=p.newSource||u.source,f=p.newTarget||u.target,d,h;d=n.canConnect(l,f),!(!d||d.type===u.type)&&(h=t.connect(l,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),p.connection=h,i&&s(u,h))}function s(c,p){var u=i.context(),l=u&&u.payload.previousSelection,f;!l||!l.length||(f=l.indexOf(c),f!==-1&&l.splice(f,1,p))}this.postExecuted("elements.move",function(c){var p=c.closure,u=p.allConnections;E(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var p=c.context,u=p.properties,l=p.element,f=l.businessObject,d;u.default&&(d=ne(l.outgoing,bt({id:l.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(l.source,{default:void 0})})}N(ds,k);ds.$inject=["eventBus","modeling","bpmnRules","injector"];function Ho(e,t,n,r,i,o){r.invoke(k,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,p=s.elements,u=Xe(p,function(l,f){var d=t.canReplace([f],f.host||f.parent||c);return d?l.concat(d.replacements):l},[]);u.length&&this._replaceElements(p,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,p=s.newHost,u=[];E(s.closure.topLevel,function(f){qe(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&p&&(c=p);var l=t.canReplace(u,c);l&&this._replaceElements(u,l.replacements,p)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,p=s.newShape,u=c.attachers,l;u&&u.length&&(l=t.canReplace(u,p),this._replaceElements(u,l.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,p=s.newShape;i.unclaimId(c.businessObject.id,c.businessObject),i.updateProperties(p,{id:c.id})})}N(Ho,k);Ho.prototype._replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;E(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=r.replaceElement(s,a,{select:!1})}),t&&i.select(e)};Ho.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var sC=1500,dv={width:140,height:120},Xp={width:300,height:60},Zp={width:60,height:300},hs={width:300,height:150},ms={width:150,height:300},mf={width:140,height:120},gf={width:100,height:40};function Qp(e){e.on("resize.start",sC,function(t){var n=t.context,r=n.shape,i=n.direction,o=n.balanced;(m(r,"bpmn:Lane")||m(r,"bpmn:Participant"))&&(n.resizeConstraints=fC(r,i,o)),m(r,"bpmn:SubProcess")&&re(r)&&(n.minDimensions=mf),m(r,"bpmn:TextAnnotation")&&(n.minDimensions=gf)})}Qp.$inject=["eventBus"];var ti=Math.abs,cC=Math.min,pC=Math.max;function hv(e,t,n,r){var i=e[t];e[t]=i===void 0?n:r(n,i)}function $o(e,t,n){return hv(e,t,n,cC)}function zo(e,t,n){return hv(e,t,n,pC)}var uC={top:20,left:50,right:20,bottom:20},lC={top:50,left:20,right:20,bottom:20};function fC(e,t,n){var r=Pt(e),i=!0,o=!0,a=No(r,[r]),s=X(e),c={},p={},u=Te(e),l=u?Xp:Zp;/n/.test(t)?p.top=s.bottom-l.height:/e/.test(t)?p.right=s.left+l.width:/s/.test(t)?p.bottom=s.top+l.height:/w/.test(t)&&(p.left=s.right-l.width),a.forEach(function(h){var y=X(h);u?(y.tops.bottom+10&&(o=!1)):(y.lefts.right+10&&(o=!1)),/n/.test(t)&&(n&&ti(s.top-y.bottom)<10&&zo(c,"top",y.top+l.height),ti(s.top-y.top)<5&&$o(p,"top",y.bottom-l.height)),/e/.test(t)&&(n&&ti(s.right-y.left)<10&&$o(c,"right",y.right-l.width),ti(s.right-y.right)<5&&zo(p,"right",y.left+l.width)),/s/.test(t)&&(n&&ti(s.bottom-y.top)<10&&$o(c,"bottom",y.bottom-l.height),ti(s.bottom-y.bottom)<5&&zo(p,"bottom",y.top+l.height)),/w/.test(t)&&(n&&ti(s.left-y.right)<10&&zo(c,"left",y.left+l.width),ti(s.left-y.left)<5&&$o(p,"left",y.right-l.width))});var f=r.children.filter(function(h){return!h.hidden&&!h.waypoints&&(m(h,"bpmn:FlowElement")||m(h,"bpmn:Artifact"))}),d=u?uC:lC;return f.forEach(function(h){var y=X(h);/n/.test(t)&&(!u||i)&&$o(p,"top",y.top-d.top),/e/.test(t)&&(u||o)&&zo(p,"right",y.right+d.right),/s/.test(t)&&(!u||o)&&zo(p,"bottom",y.bottom+d.bottom),/w/.test(t)&&(u||i)&&$o(p,"left",y.left-d.left)}),{min:p,max:c}}var mv=1001;function Jp(e,t){e.on("resize.start",mv+500,function(n){var r=n.context,i=r.shape;(m(i,"bpmn:Lane")||m(i,"bpmn:Participant"))&&(r.balanced=!yr(n))}),e.on("resize.end",mv,function(n){var r=n.context,i=r.shape,o=r.canExecute,a=r.newBounds;if(m(i,"bpmn:Lane")||m(i,"bpmn:Participant"))return o&&(a=cc(a),t.resizeLane(i,a,r.balanced)),!1})}Jp.$inject=["eventBus","modeling"];var dC=500;function gs(e,t,n,r,i){n.invoke(k,this);function o(u){return ee(u,["bpmn:ReceiveTask","bpmn:SendTask"])||hC(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var l=e.getDefinitions(),f=l.get("rootElements");return!!ne(f,bt({id:u.id}))}function s(u){if(m(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(m(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(m(u,"bpmn:MessageEventDefinition"))return"messageRef";if(m(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(ee(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var l=u.get("eventDefinitions"),f=l[0];return f.get(s(f))}function p(u,l){if(ee(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",l);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),l)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var l=u.shape||u.element;if(o(l)){var f=L(l),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),Re(h,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var l=u.addedRootElement;if(l){var f=e.getDefinitions().get("rootElements");Ne(f,l)}},!0),t.on("copyPaste.copyElement",function(u){var l=u.descriptor,f=u.element;if(!(f.labelTarget||!o(f))){var d=L(f),h=c(d);h&&(l.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",dC,function(u){var l=u.descriptor,f=l.businessObject,d=l.referencedRootElement;d&&(a(d)||(d=r.copyElement(d,i.create(d.$type))),p(f,d),delete l.referencedRootElement)})}gs.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"];N(gs,k);function hC(e,t){return U(t)||(t=[t]),It(t,function(n){return lr(e,n)})}var gv=Math.max;function eu(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,r=t.axis,i=t.start,o={};return E(n,function(a){var s=a.id;m(a,"bpmn:Participant")&&(o[s]=gC(a,r,i)),m(a,"bpmn:Lane")&&(o[s]=Te(a)?Xp:Zp),m(a,"bpmn:SubProcess")&&re(a)&&(o[s]=mf),m(a,"bpmn:TextAnnotation")&&(o[s]=gf),m(a,"bpmn:Group")&&(o[s]=dv)}),o})}eu.$inject=["eventBus"];function mC(e){return e==="x"}function gC(e,t,n){var r=Te(e);if(!_C(e))return r?hs:ms;var i=mC(t),o={};return i?r?o=hs:o={width:yC(e,n,i),height:ms.height}:r?o={width:hs.width,height:vC(e,n,i)}:o=ms,o}function vC(e,t,n){var r;return r=xC(e,t,n),gv(hs.height,r)}function yC(e,t,n){var r;return r=bC(e,t,n),gv(ms.width,r)}function _C(e){return!!pn(e).length}function xC(e,t,n){var r=pn(e),i;return i=vf(r,t,n),e.height-i.height+Xp.height}function bC(e,t,n){var r=pn(e),i;return i=vf(r,t,n),e.width-i.width+Zp.width}function vf(e,t,n){var r,i,o;for(r=0;r=i.y&&t<=i.y+i.height||n&&t>=i.x&&t<=i.x+i.width)return o=pn(i),o.length?vf(o,t,n):i}var vv=400,EC=600,yv={x:180,y:160};function On(e,t,n,r,i,o,a){k.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=r,this._bpmnFactory=i,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(l){return m(l,"bpmn:SubProcess")&&!re(l)}function p(l){var f=l.shape,d=l.newRootElement,h=L(f);d=s._addDiagram(d||h),l.newRootElement=e.addRootElement(d)}function u(l){var f=l.shape,d=L(f);s._removeDiagram(d);var h=l.newRootElement=a.get(an(d));e.removeRootElement(h)}this.executed("shape.create",function(l){var f=l.shape;c(f)&&p(l)},!0),this.postExecuted("elements.create",function(l){var f=l.elements;E(f,function(d){if(c(d)){var h=a.get(an(d));if(!(!h||!d.children||!d.children.length)){var y=_v(d);s._showRecursively(y),s._moveChildrenToShape(y,h)}}})},!0),this.reverted("shape.create",function(l){var f=l.shape;c(f)&&u(l)},!0),this.preExecute("shape.delete",function(l){var f=l.shape;!m(f,"bpmn:SubProcess")||!re(f)||E(yi([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(l){var f=l.shape;if(c(f)){var d=a.get(an(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(l){var f=l.shape;c(f)&&u(l)},!0),this.reverted("shape.delete",function(l){var f=l.shape;c(f)&&p(l)},!0),this.preExecuted("shape.replace",function(l){var f=l.oldShape,d=l.newShape;!c(f)||!c(d)||(l.oldRoot=e.removeRootElement(an(f)))},!0),this.postExecuted("shape.replace",function(l){var f=l.newShape,d=l.oldRoot,h=e.findRoot(an(f));if(!(!d||!h)){var y=d.children;n.moveElements(y,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(l){var f=l.element;if(m(f,"bpmn:SubProcess")){var d=l.properties,h=l.oldProperties,y=h.id,v=d.id;if(y!==v){if(fo(f)){a.updateId(f,Wr(v)),a.updateId(y,v);return}var w=a.get(Wr(y));w&&a.updateId(Wr(y),Wr(v))}}},!0),this.reverted("element.updateProperties",function(l){var f=l.element;if(m(f,"bpmn:SubProcess")){var d=l.properties,h=l.oldProperties,y=h.id,v=d.id;if(y!==v){if(fo(f)){a.updateId(f,Wr(y)),a.updateId(v,y);return}var w=a.get(Wr(v));w&&a.updateId(w,Wr(y))}}},!0),t.on("element.changed",function(l){var f=l.element;if(fo(f)){var d=f,h=a.get(Bl(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",vv,function(l){var f=l.shape;m(f,"bpmn:SubProcess")&&(re(f)?u(l):(p(l),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",vv,function(l){var f=l.shape;m(f,"bpmn:SubProcess")&&(re(f)?u(l):(p(l),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",EC,function(l){var f=l.shape;if(m(f,"bpmn:SubProcess")){var d=l.newRootElement;if(d)if(re(f))s._moveChildrenToShape(d.children.slice(),f),E(yi(f.children),y=>{n.moveShape(y.annotation,{x:0,y:0},f.parent),E(y.associations,v=>{n.moveConnection(v,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=_v(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(l){var f=l.element,d=l.children;if(c(f)){var h=an(f),y=a.get(h);y&&d.push.apply(d,y.children)}}),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,d=l.element,h=l.elements,y=d.parent,v=m(se(y),"bpmndi:BPMNPlane");if(v){var w=Bl(y),R=ne(h,function(b){return b.id===w});R&&(f.parent=R.id)}}),t.on("copyPaste.pasteElement",function(l){var f=l.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}N(On,k);On.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var r=e.filter(function(c){return!c.hidden});if(!r.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var i=we(r),o;if(!t.x)o={x:yv.x-i.x,y:yv.y-i.y};else{var a=q(t),s=q(i);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}};On.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Dl(e).map(r=>r.annotation));n.size&&E(yi(e.children),r=>{n.has(r.annotation)&&E(r.associations,i=>{t.removeConnection(i)})})};On.prototype._showRecursively=function(e,t){var n=this,r=[];return e.forEach(function(i){i.hidden=!!t,r=r.concat(i),i.children&&(r=r.concat(n._showRecursively(i.children,i.collapsed||t)))}),r};On.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e};On.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,r=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),i=t.create("bpmndi:BPMNDiagram",{plane:r});r.$parent=i;var o=n.createRoot({id:an(e),type:e.$type,di:r,businessObject:e,collapsed:!0});return o};On.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,r=ne(n,function(i){return i.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(r),1),r};On.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function wC(e){var t=[];return E(yi(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function _v(e){return e.children.slice().concat(wC(e.children)).concat(SC(e))}function SC(e){return ga(e.children||[],!0,-1).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function vs(e,t){e.invoke(k,this),this.postExecuted("shape.replace",function(n){var r=n.context.oldShape,i=n.context.newShape;if(!(!m(i,"bpmn:SubProcess")||m(i,"bpmn:AdHocSubProcess")||!(m(r,"bpmn:Task")||m(r,"bpmn:CallActivity"))||!re(i))){var o=CC(i);t.createShape({type:"bpmn:StartEvent"},o,i)}})}vs.$inject=["injector","modeling"];N(vs,k);function CC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function ys(e,t){k.call(this,e),this.preExecute("connection.create",function(n){let{target:r}=n;m(r,"bpmn:TextAnnotation")&&(n.parent=r.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){let r=n.shapes||[n.shape];r.length===1&&m(r[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var r=n.context,i=r.shape,o=r.hints||{};if(!(!m(i,"bpmn:TextAnnotation")||o.autoResize)){var a=r.newBounds,s=t.getTextAnnotationBounds(a,pt(i)||""),c=a.y!==i.y&&Math.abs(a.y+a.height-(i.y+i.height))<=1,p=i.y+i.height;r.newBounds={width:a.width,height:s.height,x:a.x,y:c?p-s.height:a.y}}})}N(ys,k);ys.$inject=["eventBus","textRenderer"];function _s(e,t){k.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var r=n.shape;if(re(r))return;var i=$n(r);i.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();E(s,function(p){o(p,!0)}),E(c,function(p){o(p,!1)})});function o(a,s){i.indexOf(a.source)!==-1&&i.indexOf(a.target)!==-1||m(a,"bpmn:Association")&&(m(a.source,"bpmn:TextAnnotation")||m(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,r,q(r)):t.reconnectStart(a,r,q(r)))}},!0)}N(_s,k);_s.$inject=["eventBus","modeling"];var yf=500;function xs(e,t,n){k.call(this,e);function r(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function i(a,s){var c=a.children,p=s,u,l;return u=RC(c).concat([a]),l=$p(u),l?(p.width=Math.max(l.width,p.width),p.height=Math.max(l.height,p.height),p.x=l.x+(l.width-p.width)/2,p.y=l.y+(l.height-p.height)/2):(p.x=a.x+(a.width-p.width)/2,p.y=a.y+(a.height-p.height)/2),p}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],yf,function(a){var s=a.context,c=s.shape;m(c,"bpmn:SubProcess")&&(c.collapsed?se(c).isExpanded=!1:(r(c.children),se(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],yf,function(a){var s=a.context,c=s.shape;c.collapsed?se(c).isExpanded=!1:se(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],yf,function(a){var s=a.context.shape,c=t.getDefaultSize(s),p;s.collapsed?p=o(s,c):p=i(s,c),n.resizeShape(s,p,null,{autoResize:s.collapsed?!1:"nwse"})})}N(xs,k);xs.$inject=["eventBus","elementFactory","modeling"];function RC(e){return e.filter(function(t){return!t.hidden})}function bs(e,t,n,r){t.invoke(k,this),this.preExecute("shape.delete",function(i){var o=i.context,a=o.shape,s=a.businessObject;J(a)||(m(a,"bpmn:Participant")&&re(a)&&n.ids.unclaim(s.processRef.id),r.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(i){var o=i.context,a=o.connection,s=a.businessObject;r.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var i=e.getRootElement(),o=i.businessObject;m(i,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}N(bs,k);bs.$inject=["canvas","injector","moddle","modeling"];function Es(e,t){k.call(this,e),this.preExecute("connection.delete",function(n){var r=n.context,i=r.connection,o=i.source;AC(i,o)&&t.updateProperties(o,{default:null})})}N(Es,k);Es.$inject=["eventBus","modeling"];function AC(e,t){if(!m(e,"bpmn:SequenceFlow"))return!1;var n=L(t),r=L(e);return n.get("default")===r}var PC=500,TC=5e3;function ws(e,t){k.call(this,e);var n;function r(){return n=n||new MC,n.enter(),n}function i(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var s=n.leave();return s&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),s}var a=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(a,TC,function(s){r()}),this.postExecuted(a,PC,function(s){o()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(s){var c=s.context,p=c.shape,u=i();p.labelTarget||(m(p,"bpmn:Lane")&&u.addLane(p),m(p,"bpmn:FlowNode")&&u.addFlowNode(p))})}ws.$inject=["eventBus","modeling"];N(ws,k);function MC(){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}}function Ss(e,t){k.call(this,e),this.postExecuted("elements.create",function(n){let r=n.context,i=r.elements;for(let o of i)DC(o)&&!NC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}N(Ss,k);Ss.$inject=["eventBus","modeling"];function DC(e){let t=L(e);return t&&t.isForCompensation}function kC(e){return e&&m(e,"bpmn:BoundaryEvent")&&lr(e,"bpmn:CompensateEventDefinition")}function NC(e){return e.incoming.filter(n=>kC(n.source)).length>0}var xv={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","artifactBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",$a],appendBehavior:["type",za],associationBehavior:["type",Wa],attachEventBehavior:["type",Mo],artifactBehavior:["type",Va],boundaryEventBehavior:["type",Ga],compensateBoundaryEventBehaviour:["type",Ka],createBehavior:["type",Ya],createDataObjectBehavior:["type",qa],createParticipantBehavior:["type",Xa],dataInputAssociationBehavior:["type",Za],dataStoreBehavior:["type",Qa],deleteLaneBehavior:["type",es],detachEventBehavior:["type",Oo],dropOnFlowBehavior:["type",ts],eventBasedGatewayBehavior:["type",ns],fixHoverBehavior:["type",Vp],groupBehavior:["type",rs],importDockingFix:["type",Wp],isHorizontalFix:["type",is],labelBehavior:["type",as],layoutConnectionBehavior:["type",ss],messageFlowBehavior:["type",cs],nonInterruptingBehavior:["type",ps],removeElementBehavior:["type",ls],removeEmbeddedLabelBoundsBehavior:["type",us],removeParticipantBehavior:["type",fs],replaceConnectionBehavior:["type",ds],replaceElementBehaviour:["type",Ho],resizeBehavior:["type",Qp],resizeLaneBehavior:["type",Jp],rootElementReferenceBehavior:["type",gs],spaceToolBehavior:["type",eu],subProcessPlaneBehavior:["type",On],subProcessStartEventBehavior:["type",vs],textAnnotationBehavior:["type",ys],toggleCollapseConnectionBehaviour:["type",_s],toggleElementCollapseBehaviour:["type",xs],unclaimIdBehavior:["type",bs],unsetDefaultFlowBehavior:["type",Es],updateFlowNodeRefsBehavior:["type",ws],setCompensationActivityAfterPasteBehavior:["type",Ss]};function tu(e,t){var n=je(e,t,-15);return n!=="intersect"?n:null}function vt(e){At.call(this,e)}N(vt,At);vt.$inject=["eventBus"];vt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return OC(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,r=e.hints||{},i=r.targetParent,o=r.targetAttach;if(o)return!1;i&&(n.parent=i);try{return nu(t,n)}finally{i&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,r=e.target;return nu(n,r,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,r=e.direction;return Ov(t,n,r)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,r=e.target;return le(r)&&!ru(t,r,n)?!1:hn(t,function(i){return le(i)?nu(i.source,i.target,i):i.host?Cs(i,i.host,null,n):bf(i,r,null,n)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,r=e.position,i=e.hints;return i!=null&&i.keyboardMove&&n.some(function(a){return Pv(a)&&!n.includes(a.host)})?!1:Cs(n,t,null,r)||kv(n,t,r)||Nv(n,t,r)||ru(n,t,r)}),this.addRule("shape.create",function(e){return bf(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Cs(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Fv(n,t)})};vt.prototype.canConnectMessageFlow=Lv;vt.prototype.canConnectSequenceFlow=jv;vt.prototype.canConnectDataAssociation=wf;vt.prototype.canConnectAssociation=Bv;vt.prototype.canConnectCompensationAssociation=Iv;vt.prototype.canMove=Nv;vt.prototype.canAttach=Cs;vt.prototype.canReplace=kv;vt.prototype.canDrop=Vo;vt.prototype.canInsert=ru;vt.prototype.canCreate=bf;vt.prototype.canConnect=nu;vt.prototype.canResize=Ov;vt.prototype.canCopy=Fv;function OC(e){return _f(e)?null:ee(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function _f(e){return!e||J(e)}function bv(e){do{if(m(e,"bpmn:Process"))return L(e);if(m(e,"bpmn:Participant"))return L(e).processRef||L(e)}while(e=e.parent)}function xf(e){return m(e,"bpmn:TextAnnotation")}function Ef(e){return m(e,"bpmn:Group")&&!e.labelTarget}function Cv(e){return m(e,"bpmn:BoundaryEvent")&&Qn(e,"bpmn:CompensateEventDefinition")}function iu(e){return L(e).isForCompensation}function BC(e,t){var n=bv(e),r=bv(t);return n===r}function IC(e){return m(e,"bpmn:InteractionNode")&&!m(e,"bpmn:BoundaryEvent")&&(!m(e,"bpmn:Event")||m(e,"bpmn:ThrowEvent")&&Av(e,"bpmn:MessageEventDefinition"))}function LC(e){return m(e,"bpmn:InteractionNode")&&!iu(e)&&(!m(e,"bpmn:Event")||m(e,"bpmn:CatchEvent")&&Av(e,"bpmn:MessageEventDefinition"))&&!(m(e,"bpmn:BoundaryEvent")&&!Qn(e,"bpmn:MessageEventDefinition"))}function Ev(e){for(var t=e;t=t.parent;){if(m(t,"bpmn:FlowElementsContainer"))return L(t);if(m(t,"bpmn:Participant"))return L(t).processRef}return null}function Rv(e,t){var n=Ev(e),r=Ev(t);return n===r}function Qn(e,t){var n=L(e);return!!ne(n.eventDefinitions||[],function(r){return m(r,t)})}function Av(e,t){var n=L(e);return(n.eventDefinitions||[]).every(function(r){return m(r,t)})}function jC(e){return m(e,"bpmn:FlowNode")&&!m(e,"bpmn:EndEvent")&&!qe(e)&&!(m(e,"bpmn:IntermediateThrowEvent")&&Qn(e,"bpmn:LinkEventDefinition"))&&!Cv(e)&&!iu(e)}function FC(e){return m(e,"bpmn:FlowNode")&&!m(e,"bpmn:StartEvent")&&!m(e,"bpmn:BoundaryEvent")&&!qe(e)&&!(m(e,"bpmn:IntermediateCatchEvent")&&Qn(e,"bpmn:LinkEventDefinition"))&&!iu(e)}function HC(e){return m(e,"bpmn:ReceiveTask")||m(e,"bpmn:IntermediateCatchEvent")&&(Qn(e,"bpmn:MessageEventDefinition")||Qn(e,"bpmn:TimerEventDefinition")||Qn(e,"bpmn:ConditionalEventDefinition")||Qn(e,"bpmn:SignalEventDefinition"))}function $C(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function wv(e,t){var n=$C(t);return n.indexOf(e)!==-1}function nu(e,t,n){if(_f(e)||_f(t))return null;if(!m(n,"bpmn:DataAssociation")){if(Lv(e,t))return{type:"bpmn:MessageFlow"};if(jv(e,t))return{type:"bpmn:SequenceFlow"}}var r=wf(e,t);return r||(Iv(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Bv(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Vo(e,t){return J(e)||Ef(e)?!0:m(t,"bpmn:Participant")&&!re(t)?!1:m(e,"bpmn:Participant")?m(t,"bpmn:Process")||m(t,"bpmn:Collaboration"):ee(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:m(e,"bpmn:Lane")?m(t,"bpmn:Participant")||m(t,"bpmn:Lane"):m(e,"bpmn:BoundaryEvent")&&!zC(e)?!1:m(e,"bpmn:FlowElement")&&!m(e,"bpmn:DataStoreReference")?m(t,"bpmn:FlowElementsContainer")?re(t):ee(t,["bpmn:Participant","bpmn:Lane"]):m(e,"bpmn:DataStoreReference")&&m(t,"bpmn:Collaboration")?It(L(t).get("participants"),function(n){return!!n.get("processRef")}):ee(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ee(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):m(e,"bpmn:MessageFlow")?m(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function zC(e){return L(e).cancelActivity&&(Tv(e)||Mv(e))}function Pv(e){return!J(e)&&m(e,"bpmn:BoundaryEvent")}function VC(e){return m(e,"bpmn:Lane")}function WC(e){return Pv(e)||m(e,"bpmn:IntermediateThrowEvent")&&Tv(e)?!0:m(e,"bpmn:IntermediateCatchEvent")&&Mv(e)}function Tv(e){var t=L(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Mv(e){return Dv(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Dv(e,t){return t.some(function(n){return Qn(e,n)})}function GC(e){return m(e,"bpmn:ReceiveTask")&&ne(e.incoming,function(t){return m(t.source,"bpmn:EventBasedGateway")})}function Cs(e,t,n,r){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var i=e[0];return J(i)||!WC(i)||qe(t)||!m(t,"bpmn:Activity")||iu(t)||r&&!tu(r,t)||GC(t)?!1:"attach"}function kv(e,t,n){if(!t)return!1;var r={replacements:[]};return E(e,function(i){qe(t)||m(i,"bpmn:StartEvent")&&i.type!=="label"&&Vo(i,t)&&(gh(i)||r.replacements.push({oldElementId:i.id,newElementType:"bpmn:StartEvent"}),(vh(i)||yh(i)||_h(i))&&r.replacements.push({oldElementId:i.id,newElementType:"bpmn:StartEvent"}),Dv(i,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&m(t,"bpmn:SubProcess")&&r.replacements.push({oldElementId:i.id,newElementType:"bpmn:StartEvent"})),m(t,"bpmn:Transaction")||Qn(i,"bpmn:CancelEventDefinition")&&i.type!=="label"&&(m(i,"bpmn:EndEvent")&&Vo(i,t)&&r.replacements.push({oldElementId:i.id,newElementType:"bpmn:EndEvent"}),m(i,"bpmn:BoundaryEvent")&&Cs(i,t,null,n)&&r.replacements.push({oldElementId:i.id,newElementType:"bpmn:BoundaryEvent"}))}),r.replacements.length?r:!1}function Nv(e,t){return It(e,VC)?!1:t?e.every(function(n){return Vo(n,t)}):!0}function bf(e,t,n,r){return t?J(e)||Ef(e)?!0:Vo(e,t,r)||ru(e,t,r):!1}function Ov(e,t,n){return m(e,"bpmn:SubProcess")?re(e)&&(!t||t.width>=100&&t.height>=80):m(e,"bpmn:Lane")||m(e,"bpmn:Participant")?!0:xf(e)?n?n==="e"||n==="w":!0:Ef(e)?!0:J(e)?n?n==="e"||n==="w":!0:!1}function UC(e,t){var n=xf(e),r=xf(t);return(n||r)&&n!==r}function Bv(e,t){return wv(t,e)||wv(e,t)?!1:UC(e,t)?!0:!!wf(e,t)}function Iv(e,t){return Rv(e,t)&&Cv(e)&&m(t,"bpmn:Activity")&&!YC(t,e)&&!qe(t)}function Lv(e,t){return Sv(e)&&!Sv(t)?!1:IC(e)&&LC(t)&&!BC(e,t)}function jv(e,t){return jC(e)&&FC(t)&&Rv(e,t)&&!(m(e,"bpmn:EventBasedGateway")&&!HC(t))}function wf(e,t){return ee(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ee(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ee(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ee(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function ru(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:ee(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!J(t)&&m(e,"bpmn:FlowNode")&&!m(e,"bpmn:BoundaryEvent")&&Vo(e,t.parent,n)}function KC(e,t){return e&&t&&e.indexOf(t)!==-1}function Fv(e,t){return J(t)?!0:!(m(t,"bpmn:Lane")&&!KC(e,t.parent))}function Sv(e){return Er(e,"bpmn:Process")||Er(e,"bpmn:Collaboration")}function YC(e,t){return e.attachers.includes(t)}var Hv={__depends__:[gt],__init__:["bpmnRules"],bpmnRules:["type",vt]};var qC=2e3;function ou(e,t){e.on("saveXML.start",qC,n);function n(){var r=t.getRootElements();E(r,function(i){var o=se(i),a,s;a=$n([i],!1),a=Q(a,function(c){return c!==i&&!c.labelTarget}),s=Ve(a,se),o.set("planeElement",s)})}}ou.$inject=["eventBus","canvas"];var $v={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",ou]};function Wo(e){k.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var r=n.context,i=r.shape||r.connection,o=r.parent,a=t.getOrdering(i,o);a&&(a.parent!==void 0&&(r.parent=a.parent),r.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var r=n.context,i=r.shape||r.connection,o=r.newParent||i.parent,a=t.getOrdering(i,o);a&&(a.parent!==void 0&&(r.newParent=a.parent),r.newParentIndex=a.index)})}Wo.prototype.getOrdering=function(e,t){return null};N(Wo,k);function Rs(e,t){Wo.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{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:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function r(a){if(a.labelTarget)return{level:10};var s=ne(n,function(c){return ee(a,[c.type])});return s&&s.order||{level:1}}function i(a){var s=a.order;if(s||(a.order=s=r(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var p=s;p&&!ee(p,c);)p=p.parent;if(!p)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return p}this.getOrdering=function(a,s){if(a.labelTarget||m(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=i(a);c.containers&&(s=o(a,s,c.containers));var p=s.children.indexOf(a),u=Qs(s.children,function(l){return!a.labelTarget&&l.labelTarget?!1:c.level0&&this._modeling.removeElements(r),t};Nt.prototype._getElementIdsFromTree=function(e){var t={};return E(e,function(n){E(n,function(r){r.id&&(t[r.id]=!0)})}),t};Nt.prototype._paste=function(e,t,n,r){E(e,function(o){te(o.x)||(o.x=0),te(o.y)||(o.y=0)});var i=we(e);return E(e,function(o){le(o)&&(o.waypoints=Ve(o.waypoints,function(a){return{x:a.x-i.x-i.width/2,y:a.y-i.y-i.height/2}})),S(o,{x:o.x-i.x-i.width/2,y:o.y-i.y-i.height/2})}),this._modeling.createElements(e,n,t,S({},r))};Nt.prototype._createElements=function(e){var t=this,n=this._eventBus,r={},i=[];return E(e,function(o,a){a=parseInt(a,10),o=Rt(o,"priority"),E(o,function(s){var c=S({},Mt(s,["priority"]));r[s.parent]?c.parent=r[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:r,descriptor:c});var p;if(le(c)){c.source=r[s.source],c.target=r[s.target],p=r[s.id]=t.createConnection(c),i.push(p);return}if(J(c)){c.labelTarget=r[c.labelTarget],p=r[s.id]=t.createLabel(c),i.push(p);return}c.host&&(c.host=r[c.host]),p=r[s.id]=t.createShape(c),i.push(p)})}),i};Nt.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Mt(e,["id"]));return t};Nt.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Mt(e,["id"]));return t};Nt.prototype.createShape=function(e){var t=this._elementFactory.createShape(Mt(e,["id"]));return t};Nt.prototype.hasRelations=function(e,t){var n,r,i;return!(le(e)&&(r=ne(t,bt({id:e.source.id})),i=ne(t,bt({id:e.target.id})),!r||!i)||J(e)&&(n=ne(t,bt({id:e.labelTarget.id})),!n))};Nt.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[],o=Nr(e);function a(p,u){return t.allowed("element.copy",{element:p,elements:u})}function s(p,u){var l=ne(i,function(f){return p===f.element});if(!l){i.push({element:p,depth:u});return}l.depth{u.push(l.annotation)})}),t.on("copyPaste.pasteElement",Cf,function(c){var p=c.cache,u=c.descriptor;a(p,s(u,p,o(p)))})}cu.$inject=["bpmnFactory","eventBus","moddleCopy"];var nR=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],rR=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Di(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",r=>{let{propertyNames:i}=r;if(!(!i||!i.length))return Rt(i,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",r=>{let{parent:i,property:o,propertyName:a}=r,s=Pe(i)&&i.$descriptor;if(a&&rR.includes(a))return o;if(a&&nR.includes(a)||a&&s&&!ne(s.properties,bt({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",r=>{let{property:i}=r;if(m(i,"bpmn:ExtensionElements")&&(!i.values||!i.values.length))return!1})}Di.$inject=["eventBus","bpmnFactory","moddle"];Di.prototype.copyElement=function(e,t,n,r=!1){n&&!U(n)&&(n=[n]),n=n||pu(e.$descriptor);let i=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:r});return i===!1||(U(i)&&(n=i),E(n,o=>{let a;ft(e,o)&&(a=e.get(o));let s=this.copyProperty(a,t,o,r);!Ye(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t};Di.prototype.copyProperty=function(e,t,n,r=!1){let i=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:r});if(i===!1)return;if(i)return Pe(i)&&i.$type&&!i.$parent&&(i.$parent=t),i;let o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,r):U(e)?Xe(e,(a,s)=>{let c=this.copyProperty(s,t,n,r);return c?a.concat(c):a},[]):Pe(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(i=this._bpmnFactory.create(e.$type),i.$parent=t,i=this.copyElement(e,i,null,r),i):e};Di.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function pu(e,t){return Xe(e.properties,(n,r)=>t&&r.default?n:n.concat(r.name),[])}var uu={__depends__:[Jv],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",cu],moddleCopy:["type",Di]};var ey=Math.round;function Ps(e,t){this._modeling=e,this._eventBus=t}Ps.$inject=["modeling","eventBus"];Ps.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var r=this._modeling,i=this._eventBus;i.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,p=ey(s+o/2),u=ey(c+a/2),l=r.replaceShape(e,S({},t,{x:p,y:u,width:o,height:a}),n);return i.fire("replace.end",{element:e,newElement:l,hints:n}),l};function lu(e,t){t.on("replace.end",500,function(n){let{newElement:r,hints:i={}}=n;i.select!==!1&&e.select(r)})}lu.$inject=["selection","eventBus"];var ty={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",lu],replace:["type",Ps]};function iR(e,t,n){U(n)||(n=[n]),E(n,function(r){Fn(e[r])||(t[r]=e[r])})}var oR=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function aR(e,t){var n=e&&ft(e,"collapsed")?e.collapsed:!re(e),r;return t&&(ft(t,"collapsed")||ft(t,"isExpanded"))?r=ft(t,"collapsed")?t.collapsed:!t.isExpanded:r=n,n!==r}function du(e,t,n,r,i,o){function a(s,c,p){p=p||{};var u=c.type,l=s.businessObject;if(fu(l)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&aR(s,c))return r.toggleCollapse(s),s;var f=e.create(u),d={type:u,businessObject:f};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),iR(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=pu(l.$descriptor),y=pu(f.$descriptor,!0),v=sR(h,y);S(f,dt(c,oR));var w=Q(v,function(x){return x==="eventDefinitions"?ny(s,c.eventDefinitionType):x==="loopCharacteristics"?!qe(f):ft(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!qe(f):!0});if(f=n.copyElement(l,f,w),c.eventDefinitionType&&(ny(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),m(l,"bpmn:Activity")){if(fu(l))d.isExpanded=re(s);else if(c&&ft(c,"isExpanded")){d.isExpanded=c.isExpanded;var R=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=R.width,d.height=R.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}re(s)&&!m(l,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(fu(l)&&!fu(f)&&(p.moveChildren=!1),m(l,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):p.moveChildren=!1;var b=Te(s);se(s).isHorizontal||(se(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=l.name,ee(l,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ee(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=l.default),c.host&&!m(l,"bpmn:BoundaryEvent")&&m(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),i.replaceElement(s,d,{...p,targetElement:c})}this.replaceElement=a}du.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function fu(e){return m(e,"bpmn:SubProcess")}function ny(e,t){var n=L(e);return t&&n.get("eventDefinitions").some(function(r){return m(r,t)})}function sR(e,t){return e.filter(function(n){return t.includes(n)})}var hu={__depends__:[uu,ty,Qe],bpmnReplace:["type",du]};var cR=250;function wr(e){this._eventBus=e,this._tools=[],this._active=null}wr.$inject=["eventBus"];wr.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)};wr.prototype.isActive=function(e){return e&&this._active===e};wr.prototype.length=function(e){return this._tools.length};wr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))};wr.prototype.bindEvents=function(e,t){var n=this._eventBus,r=[];n.on(t.tool+".init",function(i){var o=i.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),E(t,function(i){r.push(i+".ended"),r.push(i+".canceled")}),n.on(r,cR,function(i){this._active&&(pR(i)||this.setActive(null))},this)};function pR(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Rn(t,'.group[data-group="tools"]')}var ri={__depends__:[Ct],__init__:["toolManager"],toolManager:["type",wr]};function ry(e,t){if(e==="x"){if(t>0)return"e";if(t<0)return"w"}if(e==="y"){if(t>0)return"s";if(t<0)return"n"}return null}function iy(e,t){var n=[];return E(e.concat(t),function(r){var i=r.incoming,o=r.outgoing;E(i.concat(o),function(a){var s=a.source,c=a.target;(Ts(e,s)||Ts(e,c)||Ts(t,s)||Ts(t,c))&&(Ts(n,a)||n.push(a))})}),n}function Ts(e,t){return e.indexOf(t)!==-1}function oy(e,t,n){var r=e.x,i=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:r,y:i+c,width:o,height:a-c};case"s":return{x:r,y:i,width:o,height:a+c};case"w":return{x:r+s,y:i,width:o-s,height:a};case"e":return{x:r,y:i,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var Rf=Math.abs,uR=Math.round,Sr={x:"width",y:"height"},cy="crosshair",ii={n:"top",w:"left",s:"bottom",e:"right"},lR=1500,mu={n:"s",w:"e",s:"n",e:"w"},gu=20;function zt(e,t,n,r,i,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=r,this._rules=i,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",lR,function(c){var p=c.context,u=p.initialized;u||(u=p.initialized=s.init(c,p)),u&&sy(c)}),n.on("spaceTool.end",function(c){var p=c.context,u=p.axis,l=p.direction,f=p.movingShapes,d=p.resizingShapes,h=p.start;if(p.initialized){sy(c);var y={x:0,y:0};y[u]=uR(c["d"+u]),s.makeSpace(f,d,y,l,h),n.once("spaceTool.ended",function(v){s.activateSelection(v.originalEvent,!0,!0)})}})}zt.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"];zt.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:cy,data:{context:{reactivate:n}},trapClick:!1})};zt.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:cy,data:{context:{}}})};zt.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)};zt.prototype.init=function(e,t){var n=Rf(e.dx)>Rf(e.dy)?"x":"y",r=e["d"+n],i=e[n]-r;if(Rf(r)<5)return!1;r<0&&(r*=-1),yr(e)&&(r*=-1);var o=ry(n,r),a=this._canvas.getRootElement();!_i(e)&&e.hover&&(a=e.hover);var s=[...$n(a,!0),...a.attachers||[]],c=this.calculateAdjustments(s,n,r,i),p=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:i}),u=fR(c,n,o,i,p);return S(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:i}),xi("resize-"+(n==="x"?"ew":"ns")),!0};zt.prototype.calculateAdjustments=function(e,t,n,r){var i=this._rules,o=[],a=[],s=[],c=[];function p(f){o.includes(f)||o.push(f);var d=f.label;d&&!o.includes(d)&&o.push(d)}function u(f){a.includes(f)||a.push(f)}E(e,function(f){if(!(!f.parent||J(f))){if(le(f)){c.push(f);return}var d=f[t],h=d+f[Sr[t]];if(dR(f)&&(n>0&&q(f)[t]>r||n<0&&q(f)[t]0&&d>r||n<0&&hr&&i.allowed("shape.resize",{shape:f})){u(f);return}}}),E(o,function(f){var d=f.attachers;d&&E(d,function(h){p(h)})});var l=o.concat(a);return E(s,function(f){var d=f.host;ki(l,d)&&p(f)}),l=o.concat(a),E(c,function(f){var d=f.source,h=f.target,y=f.label;ki(l,d)&&ki(l,h)&&y&&p(y)}),{movingShapes:o,resizingShapes:a}};zt.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)};zt.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function ay(e){return{top:e.top-gu,right:e.right+gu,bottom:e.bottom+gu,left:e.left-gu}}function sy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var r,i;te(n.left)&&(r=Math.max(e.x,n.left),e.dx=e.dx+r-e.x,e.x=r),te(n.right)&&(r=Math.min(e.x,n.right),e.dx=e.dx+r-e.x,e.x=r),te(n.top)&&(i=Math.max(e.y,n.top),e.dy=e.dy+i-e.y,e.y=i),te(n.bottom)&&(i=Math.min(e.y,n.bottom),e.dy=e.dy+i-e.y,e.y=i)}}function fR(e,t,n,r,i){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,p;return E(a,function(u){var l=u.attachers,f=u.children,d=X(u),h=Q(f,function(I){return!le(I)&&!J(I)&&!ki(o,I)&&!ki(a,I)}),y=Q(f,function(I){return!le(I)&&!J(I)&&ki(o,I)}),v,w,R,b=[],x=[],C,P,O,T;h.length&&(w=ay(X(we(h))),v=r-d[ii[n]]+w[ii[n]],n==="n"?s.bottom=p=te(p)?Math.min(p,v):v:n==="w"?s.right=p=te(p)?Math.min(p,v):v:n==="s"?s.top=c=te(c)?Math.max(c,v):v:n==="e"&&(s.left=c=te(c)?Math.max(c,v):v)),y.length&&(R=ay(X(we(y))),v=r-R[ii[mu[n]]]+d[ii[mu[n]]],n==="n"?s.bottom=p=te(p)?Math.min(p,v):v:n==="w"?s.right=p=te(p)?Math.min(p,v):v:n==="s"?s.top=c=te(c)?Math.max(c,v):v:n==="e"&&(s.left=c=te(c)?Math.max(c,v):v)),l&&l.length&&(l.forEach(function(I){ki(o,I)?b.push(I):x.push(I)}),b.length&&(C=X(we(b.map(q))),P=d[ii[mu[n]]]-(C[ii[mu[n]]]-r)),x.length&&(O=X(we(x.map(q))),T=O[ii[n]]-(d[ii[n]]-r)),n==="n"?(v=Math.min(P||1/0,T||1/0),s.bottom=p=te(p)?Math.min(p,v):v):n==="w"?(v=Math.min(P||1/0,T||1/0),s.right=p=te(p)?Math.min(p,v):v):n==="s"?(v=Math.max(P||-1/0,T||-1/0),s.top=c=te(c)?Math.max(c,v):v):n==="e"&&(v=Math.max(P||-1/0,T||-1/0),s.left=c=te(c)?Math.max(c,v):v));var B=i&&i[u.id];B&&(n==="n"?(v=r+u[Sr[t]]-B[Sr[t]],s.bottom=p=te(p)?Math.min(p,v):v):n==="w"?(v=r+u[Sr[t]]-B[Sr[t]],s.right=p=te(p)?Math.min(p,v):v):n==="s"?(v=r-u[Sr[t]]+B[Sr[t]],s.top=c=te(c)?Math.max(c,v):v):n==="e"&&(v=r-u[Sr[t]]+B[Sr[t]],s.left=c=te(c)?Math.max(c,v):v))}),s}}function ki(e,t){return e.indexOf(t)!==-1}function dR(e){return!!e.host}var Af="djs-dragging",py="djs-resizing",hR=250,vu=Math.max;function yu(e,t,n,r,i){function o(a,s){E(a,function(c){i.addDragger(c,s),n.addMarker(c,Af)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,p={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=G("g");H(u,r.cls("djs-crosshair-group",["no-events"])),Z(s,u);var l=G("path");H(l,"d",p.x),ce(l).add("djs-crosshair"),Z(u,l);var f=G("path");H(f,"d",p.y),ce(f).add("djs-crosshair"),Z(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Ie(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Ce(c)}),e.on("spaceTool.move",hR,function(a){var s=a.context,c=s.line,p=s.axis,u=s.movingShapes,l=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=G("path"),H(c,"d","M0,0 L0,0"),ce(c).add("djs-crosshair"),Z(f,c),s.line=c;var d=G("g");H(d,r.cls("djs-drag-group",["no-events"])),Z(n.getActiveLayer(),d),o(u,d);var h=s.movingConnections=t.filter(function(x){var C=!1;E(u,function(B){E(B.outgoing,function(I){x===I&&(C=!0)})});var P=!1;E(u,function(B){E(B.incoming,function(I){x===I&&(P=!0)})});var O=!1;E(l,function(B){E(B.outgoing,function(I){x===I&&(O=!0)})});var T=!1;return E(l,function(B){E(B.incoming,function(I){x===I&&(T=!0)})}),le(x)&&(C||O)&&(P||T)});o(h,d),s.dragGroup=d}if(!s.frameGroup){var y=G("g");H(y,r.cls("djs-frame-group",["no-events"])),Z(n.getActiveLayer(),y);var v=[];E(l,function(x){var C=i.addFrame(x,y),P=C.getBBox();v.push({element:C,initialBounds:P}),n.addMarker(x,py)}),s.frameGroup=y,s.frames=v}var w={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};H(c,{d:w[p]});var R={x:"y",y:"x"},b={x:a.dx,y:a.dy};b[R[s.axis]]=0,Ie(s.dragGroup,b.x,b.y),E(s.frames,function(x){var C=x.element,P=x.initialBounds,O,T;s.direction==="e"?H(C,{width:vu(P.width+b.x,5)}):(O=vu(P.width-b.x,5),H(C,{width:O,x:P.x+P.width-O})),s.direction==="s"?H(C,{height:vu(P.height+b.y,5)}):(T=vu(P.height-b.y,5),H(C,{height:T,y:P.y+P.height-T}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,p=s.movingConnections,u=s.resizingShapes,l=s.line,f=s.dragGroup,d=s.frameGroup;E(c,function(h){n.removeMarker(h,Af)}),E(p,function(h){n.removeMarker(h,Af)}),f&&(Ce(l),Ce(f)),E(u,function(h){n.removeMarker(h,py)}),d&&Ce(d)})}yu.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var uy={__init__:["spaceToolPreview"],__depends__:[Ct,gt,ri,bn,Jn],spaceTool:["type",zt],spaceToolPreview:["type",yu]};function Go(e,t){e.invoke(zt,this),this._canvas=t}Go.$inject=["injector","canvas"];N(Go,zt);Go.prototype.calculateAdjustments=function(e,t,n,r){var i=this._canvas.getRootElement(),o=e[0]===i?null:e[0],a=[];o&&(a=Sn(fi(i.children.filter(p=>m(p,"bpmn:Artifact")),we(o))));let s=[...e,...a];var c=zt.prototype.calculateAdjustments.call(this,s,t,n,r);return c.resizingShapes=c.resizingShapes.filter(function(p){return!(m(p,"bpmn:TextAnnotation")||mR(p)&&(t==="y"&&Te(p)||t==="x"&&!Te(p)))}),c};function mR(e){return m(e,"bpmn:Participant")&&!L(e).processRef}var _u={__depends__:[uy],spaceTool:["type",Go]};function ze(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}ze.$inject=["eventBus","injector"];ze.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";let n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()};ze.prototype.canExecute=function(e,t){let n={command:e,context:t},r=this._getHandler(e),i=this._fire(e,"canExecute",n);if(i===void 0){if(!r)return!1;r.canExecute&&(i=r.canExecute(t))}return i};ze.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})};ze.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}};ze.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}};ze.prototype.register=function(e,t){this._setHandler(e,t)};ze.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");let n=this._injector.instantiate(t);this.register(e,n)};ze.prototype.canUndo=function(){return!!this._getUndoAction()};ze.prototype.canRedo=function(){return!!this._getRedoAction()};ze.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]};ze.prototype._getUndoAction=function(){return this._stack[this._stackIdx]};ze.prototype._internalUndo=function(e){let t=e.command,n=e.context,r=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),r.revert&&this._markDirty(r.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})};ze.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);let r=t?[e+"."+t,t]:[e],i;n=this._eventBus.createEvent(n);for(let o of r)if(i=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return i};ze.prototype._createId=function(){return this._uid++};ze.prototype._atomicDo=function(e){let t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}};ze.prototype._internalExecute=function(e,t){let n=e.command,r=e.context,i=this._getHandler(n);if(!i)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),i.preExecute&&i.preExecute(r),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),i.execute&&this._markDirty(i.execute(r)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),i.postExecute&&i.postExecute(r),this._fire(n,"postExecuted",e)),this._popAction()};ze.prototype._pushAction=function(e){let t=this._currentExecution,n=t.actions,r=n[0];if(t.atomic)throw new Error("illegal invocation in or phase (action: "+e.command+")");e.id||(e.id=r&&r.id||this._createId()),n.push(e)};ze.prototype._popAction=function(){let e=this._currentExecution,t=e.trigger,n=e.actions,r=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Xu("id",r.reverse())}),r.length=0,this._fire("changed",{trigger:t}),e.trigger=null)};ze.prototype._markDirty=function(e){let t=this._currentExecution;e&&(e=U(e)?e:[e],t.dirty=t.dirty.concat(e))};ze.prototype._executedAction=function(e,t){let n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)};ze.prototype._revertedAction=function(e){this._stackIdx--};ze.prototype._getHandler=function(e){return this._handlerMap[e]};ze.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 ly={commandStack:["type",ze]};function En(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var gR=250,fy=1400;function Ms(e,t,n){k.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",fy,function(i){var o=i.context,a=o.shapes,s=o.validatedShapes;o.shapes=dy(a),o.validatedShapes=dy(s)}),r&&t.on("shape.move.start",gR,function(i){var o=i.context,a=o.shapes,s=[];E(a,function(c){E(c.labels,function(p){!p.hidden&&o.shapes.indexOf(p)===-1&&s.push(p),c.labelTarget&&s.push(c)})}),E(s,function(c){r.makeDraggable(o,c,!0)})}),this.preExecuted("elements.move",fy,function(i){var o=i.context,a=o.closure,s=a.enclosedElements,c=[];E(s,function(p){E(p.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(i){var o=i.context,a=o.connection||o.shape;En(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(i){var o=i.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=Ji(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(i){var o=i.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Re(s.labels,a,c),a.labelTarget=s)})}N(Ms,k);Ms.$inject=["injector","eventBus","modeling"];function dy(e){return Q(e,function(t){return e.indexOf(t.labelTarget)===-1})}var hy={__init__:["labelSupport"],labelSupport:["type",Ms]};var vR=251,my=1401,gy="attach-ok";function Ds(e,t,n,r,i){k.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",my,function(a){var s=a.context,c=s.shapes,p=s.validatedShapes;s.shapes=yR(c),s.validatedShapes=_R(p)}),o&&t.on("shape.move.start",vR,function(a){var s=a.context,c=s.shapes,p=Pf(c);E(p,function(u){o.makeDraggable(s,u,!0),E(u.labels,function(l){o.makeDraggable(s,l,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var p=c[0],u=p.host;u&&(n.addMarker(u,gy),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,gy)}))}}),this.preExecuted("elements.move",my,function(a){var s=a.context,c=s.closure,p=s.shapes,u=Pf(p);E(u,function(l){c.add(l,c.topLevel[l.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,p=s.newHost,u;p&&c.length!==1||(p?u=c:u=Q(c,function(l){var f=l.host;return xR(l)&&!bR(c,f)}),E(u,function(l){i.updateAttachment(l,p)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;E(s,function(c){E(c.attachers,function(p){E(p.outgoing.slice(),function(u){var l=r.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});l||i.removeConnection(u)}),E(p.incoming.slice(),function(u){var l=r.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});l||i.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,p=s.host;p&&i.updateAttachment(c,p)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,p=s.newShape;En(c.attachers,function(u){var l=r.allowed("elements.move",{target:p,shapes:[u]});l==="attach"?i.updateAttachment(u,p):i.removeShape(u)}),p.attachers.length&&E(p.attachers,function(u){var l=hf(u,c,p);i.moveShape(u,l,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,p=s.oldBounds,u=s.newBounds,l=c.attachers,f=s.hints||{};f.attachSupport!==!1&&E(l,function(d){var h=hf(d,p,u);i.moveShape(d,h,d.parent),E(d.labels,function(y){i.moveShape(y,h,y.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;En(s.attachers,function(c){i.removeShape(c)}),s.host&&i.updateAttachment(s,null)})}N(Ds,k);Ds.$inject=["injector","eventBus","canvas","rules","modeling"];function Pf(e){return Xi(Ve(e,function(t){return t.attachers||[]}))}function yR(e){var t=Pf(e);return ed("id",e,t)}function _R(e){var t=Cn(e,"id");return Q(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function xR(e){return!!e.host}function bR(e,t){return e.indexOf(t)!==-1}var vy={__depends__:[gt],__init__:["attachSupport"],attachSupport:["type",Ds]};function Xt(e){this._model=e}Xt.$inject=["moddle"];Xt.prototype._needsId=function(e){return ee(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])};Xt.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;m(e,"bpmn:Activity")?t="Activity":m(e,"bpmn:Event")?t="Event":m(e,"bpmn:Gateway")?t="Gateway":ee(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))};Xt.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n};Xt.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})};Xt.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",S({bpmnElement:e,bounds:this.createDiBounds()},t))};Xt.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)};Xt.prototype.createDiWaypoints=function(e){var t=this;return Ve(e,function(n){return t.createDiWaypoint(n)})};Xt.prototype.createDiWaypoint=function(e){return this.create("dc:Point",dt(e,["x","y"]))};Xt.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",S({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))};Xt.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",S({bpmnElement:e},t))};function Ot(e,t,n){k.call(this,e),this._bpmnFactory=t;var r=this;function i(d){var h=d.context,y=h.hints||{},v;!h.cropped&&y.createElementsBehavior!==!1&&(v=h.connection,v.waypoints=n.getCroppedWaypoints(v),h.cropped=!0)}this.executed(["connection.layout","connection.create"],i),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;r.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,y=h.shape||h.connection,v=h.parent||h.newParent;r.updateParent(y,v)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Zt(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Zt(a));function s(d){var h=d.context,y=h.oldRoot,v=y.children;E(v,function(w){m(w,"bpmn:BaseElement")&&r.updateParent(w)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;m(h,"bpmn:BaseElement")&&r.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],Zt(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Zt(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function p(d){r.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Zt(p)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Zt(p));function u(d){r.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Zt(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Zt(u)),this.executed("connection.reconnect",Zt(function(d){var h=d.context,y=h.connection,v=h.oldSource,w=h.newSource,R=L(y),b=L(v),x=L(w);R.conditionExpression&&!ee(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=R.conditionExpression,delete R.conditionExpression),v!==w&&b.default===R&&(h.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",Zt(function(d){var h=d.context,y=h.connection,v=h.oldSource,w=h.newSource,R=L(y),b=L(v),x=L(w);h.oldConditionExpression&&(R.conditionExpression=h.oldConditionExpression),h.oldDefault&&(b.default=h.oldDefault,delete x.default)}));function l(d){r.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Zt(l)),this.reverted(["element.updateAttachment"],Zt(l)),this.executed("element.updateLabel",Zt(f)),this.reverted("element.updateLabel",Zt(f));function f(d){let{element:h}=d.context,y=pt(h),v=se(h),w=v&&v.get("label");rn(h)||fo(h)||(y&&!w?v.set("label",t.create("bpmndi:BPMNLabel")):!y&&w&&v.set("label",void 0))}}N(Ot,k);Ot.$inject=["eventBus","bpmnFactory","connectionDocking"];Ot.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,r=t.host;n.attachedToRef=r&&r.businessObject};Ot.prototype.updateParent=function(e,t){if(!J(e)&&!(m(e,"bpmn:DataStoreReference")&&e.parent&&m(e.parent,"bpmn:Collaboration"))){var n=e.parent,r=e.businessObject,i=se(e),o=n&&n.businessObject,a=se(n);m(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(r,o,t&&t.businessObject),m(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),m(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(r,o),m(e,"bpmn:DataObjectReference")&&r.dataObjectRef&&this.updateSemanticParent(r.dataObjectRef,o),this.updateDiParent(i,a)}};Ot.prototype.updateBounds=function(e){var t=se(e),n=wR(e);if(n){var r=St(n,t.get("bounds"));S(n,{x:e.x+r.x,y:e.y+r.y})}var i=J(e)?this._getLabel(t):t,o=i.bounds;o||(o=this._bpmnFactory.createDiBounds(),i.set("bounds",o)),S(o,{x:e.x,y:e.y,width:e.width,height:e.height})};Ot.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var r,i;m(n,"bpmn:Lane")&&(r=n.get("flowNodeRef"),Ne(r,e)),m(t,"bpmn:Lane")&&(i=t.get("flowNodeRef"),Re(i,e))}};Ot.prototype.updateDiConnection=function(e,t,n){var r=se(e),i=se(t),o=se(n);r.sourceElement&&r.sourceElement.bpmnElement!==L(t)&&(r.sourceElement=t&&i),r.targetElement&&r.targetElement.bpmnElement!==L(n)&&(r.targetElement=n&&o)};Ot.prototype.updateDiParent=function(e,t){if(t&&!m(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Ne(n,e),e.$parent=null)}};function ER(e){for(;e&&!m(e,"bpmn:Definitions");)e=e.$parent;return e}Ot.prototype.getLaneSet=function(e){var t,n;return m(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(m(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)};Ot.prototype.updateSemanticParent=function(e,t,n){var r;if(e.$parent!==t&&!((m(e,"bpmn:DataInput")||m(e,"bpmn:DataOutput"))&&(m(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(m(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),r="lanes";else if(m(e,"bpmn:FlowElement")){if(t){if(m(t,"bpmn:Participant"))t=t.processRef;else if(m(t,"bpmn:Lane"))do t=t.$parent.$parent;while(m(t,"bpmn:Lane"))}r="flowElements"}else if(m(e,"bpmn:Artifact")){for(;t&&!m(t,"bpmn:Process")&&!m(t,"bpmn:SubProcess")&&!m(t,"bpmn:Collaboration");)if(m(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;r="artifacts"}else if(m(e,"bpmn:MessageFlow"))r="messageFlows";else if(m(e,"bpmn:Participant")){r="participants";var i=e.processRef,o;i&&(o=ER(e.$parent||t),e.$parent&&(Ne(o.get("rootElements"),i),i.$parent=null),t&&(Re(o.get("rootElements"),i),i.$parent=o))}else m(e,"bpmn:DataOutputAssociation")?r="dataOutputAssociations":m(e,"bpmn:DataInputAssociation")&&(r="dataInputAssociations");if(!r)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(r),Ne(a,e)),t?(a=t.get(r),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(r);Ne(a,e),t&&(s||(s=[],t.set(r,s)),s.push(e))}}};Ot.prototype.updateConnectionWaypoints=function(e){var t=se(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))};Ot.prototype.updateConnection=function(e){var t=e.connection,n=L(t),r=t.source,i=L(r),o=t.target,a=L(t.target),s;if(m(n,"bpmn:DataAssociation"))m(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=i,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):m(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||i,this.updateSemanticParent(n,i,s),n.targetRef=a);else{var c=m(n,"bpmn:SequenceFlow");n.sourceRef!==i&&(c&&(Ne(n.sourceRef&&n.sourceRef.get("outgoing"),n),i&&i.get("outgoing")&&i.get("outgoing").push(n)),n.sourceRef=i),n.targetRef!==a&&(c&&(Ne(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,r,o)};Ot.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Zt(e){return function(t){var n=t.context,r=n.shape||n.connection||n.element;m(r,"bpmn:BaseElement")&&e(t)}}function wR(e){if(m(e,"bpmn:Activity")){var t=se(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function er(e,t){vn.call(this),this._bpmnFactory=e,this._moddle=t}N(er,vn);er.$inject=["bpmnFactory","moddle"];er.prototype._baseCreate=vn.prototype.create;er.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,S({type:"label",di:n},Yn,t))}return this.createElement(e,t)};er.prototype.createElement=function(e,t){t=S({},t||{});var n,r=t.businessObject,i=t.di;if(!r){if(!t.type)throw new Error("no shape type specified");r=this._bpmnFactory.create(t.type)}if(!CR(i)){var o=S({},i||{},{id:r.id+"_di"});e==="root"?i=this._bpmnFactory.createDiPlane(r,o):e==="connection"?i=this._bpmnFactory.createDiEdge(r,o):i=this._bpmnFactory.createDiShape(r,o)}m(r,"bpmn:Group")&&(t=S({isFrame:!0},t)),t=SR(r,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Tf(i,t,"isExpanded")),ee(r,["bpmn:Lane","bpmn:Participant"])&&(t=Tf(i,t,"isHorizontal")),m(r,"bpmn:SubProcess")&&(t.collapsed=!re(r,i)),m(r,"bpmn:ExclusiveGateway")&&(ft(i,"isMarkerVisible")?i.isMarkerVisible===void 0&&(i.isMarkerVisible=!1):i.isMarkerVisible=!0),Ye(t.triggeredByEvent)&&(r.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Ye(t.cancelActivity)&&(r.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=r.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=r,r.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(r,i),t=S({id:r.id},n,t,{businessObject:r,di:i}),this._baseCreate(e,t)};er.prototype.getDefaultSize=function(e,t){var n=L(e);if(t=t||se(e),m(n,"bpmn:SubProcess"))return re(n,t)?{width:350,height:200}:{width:100,height:80};if(m(n,"bpmn:Task"))return{width:100,height:80};if(m(n,"bpmn:Gateway"))return{width:50,height:50};if(m(n,"bpmn:Event"))return{width:36,height:36};if(m(n,"bpmn:Participant")){var r=t.isHorizontal===void 0||t.isHorizontal===!0;return re(n,t)?r?{width:600,height:250}:{width:250,height:600}:r?{width:400,height:60}:{width:60,height:400}}return m(n,"bpmn:Lane")?{width:400,height:100}:m(n,"bpmn:DataObjectReference")?{width:36,height:50}:m(n,"bpmn:DataStoreReference")?{width:50,height:50}:m(n,"bpmn:TextAnnotation")?{width:100,height:40}:m(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}};er.prototype.createParticipantShape=function(e){return Pe(e)||(e={isExpanded:e}),e=S({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function SR(e,t,n){return E(n,function(r){t=Tf(e,t,r)}),t}function Tf(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Mt(t,[n]))}function CR(e){return ee(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Uo(e,t){this._modeling=e,this._canvas=t}Uo.$inject=["modeling","canvas"];Uo.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;E(n,function(i){var o={x:0,y:0};Ye(r.left)?o.x=r.left-i.x:Ye(r.right)?o.x=r.right-i.width-i.x:Ye(r.center)?o.x=r.center-Math.round(i.width/2)-i.x:Ye(r.top)?o.y=r.top-i.y:Ye(r.bottom)?o.y=r.bottom-i.height-i.y:Ye(r.middle)&&(o.y=r.middle-Math.round(i.height/2)-i.y),t.moveElements([i],o,i.parent)})};Uo.prototype.postExecute=function(e){};function Ko(e){this._modeling=e}Ko.$inject=["modeling"];Ko.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,r=e.shape,i=e.hints||{};r=e.shape=this._modeling.createShape(r,e.position,n,{attach:i.attach}),e.shape=r};Ko.prototype.postExecute=function(e){var t=e.hints||{};RR(e.source,e.shape)||(t.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))};function RR(e,t){return It(e.outgoing,function(n){return n.target===t})}function Yo(e,t){this._canvas=e,this._layouter=t}Yo.$inject=["canvas","layouter"];Yo.prototype.execute=function(e){var t=e.connection,n=e.source,r=e.target,i=e.parent,o=e.parentIndex,a=e.hints;if(!n||!r)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=n,t.target=r,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,i,o),t};Yo.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var xu=Math.round;function ks(e){this._modeling=e}ks.$inject=["modeling"];ks.prototype.preExecute=function(e){var t=e.elements,n=e.parent,r=e.parentIndex,i=e.position,o=e.hints,a=this._modeling;E(t,function(l){te(l.x)||(l.x=0),te(l.y)||(l.y=0)});var s=Q(t,function(l){return!l.hidden}),c=we(s);E(t,function(l){le(l)&&(l.waypoints=Ve(l.waypoints,function(f){return{x:xu(f.x-c.x-c.width/2+i.x),y:xu(f.y-c.y-c.height/2+i.y)}})),S(l,{x:xu(l.x-c.x-c.width/2+i.x),y:xu(l.y-c.y-c.height/2+i.y)})});var p=Nr(t),u={};E(t,function(l){if(le(l)){u[l.id]=te(r)?a.createConnection(u[l.source.id],u[l.target.id],r,l,l.parent||n,o):a.createConnection(u[l.source.id],u[l.target.id],l,l.parent||n,o);return}var f=S({},o);p.indexOf(l)===-1&&(f.autoResize=!1),J(l)&&(f=Mt(f,["attach"])),u[l.id]=te(r)?a.createShape(l,dt(l,["x","y","width","height"]),l.parent||n,r,f):a.createShape(l,dt(l,["x","y","width","height"]),l.parent||n,f)}),e.elements=Sn(u)};var yy=Math.round;function Bn(e){this._canvas=e}Bn.$inject=["canvas"];Bn.prototype.execute=function(e){var t=e.shape,n=e.position,r=e.parent,i=e.parentIndex;if(!r)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?S(t,n):S(t,{x:n.x-yy(t.width/2),y:n.y-yy(t.height/2)}),this._canvas.addShape(t,r,i),t};Bn.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Ni(e){Bn.call(this,e)}N(Ni,Bn);Ni.$inject=["canvas"];var AR=Bn.prototype.execute;Ni.prototype.execute=function(e){var t=e.shape;return TR(t),t.labelTarget=e.labelTarget,AR.call(this,e)};var PR=Bn.prototype.revert;Ni.prototype.revert=function(e){return e.shape.labelTarget=null,PR.call(this,e)};function TR(e){["width","height"].forEach(function(t){typeof e[t]=="undefined"&&(e[t]=0)})}function Oi(e,t){this._canvas=e,this._modeling=t}Oi.$inject=["canvas","modeling"];Oi.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;En(n.incoming,function(r){t.removeConnection(r,{nested:!0})}),En(n.outgoing,function(r){t.removeConnection(r,{nested:!0})})};Oi.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Ji(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t};Oi.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,Re(n.children,t,r),this._canvas.addConnection(t,n),t};function Ns(e,t){this._modeling=e,this._elementRegistry=t}Ns.$inject=["modeling","elementRegistry"];Ns.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,r=e.elements;E(r,function(i){n.get(i.id)&&(i.waypoints?t.removeConnection(i):t.removeShape(i))})};function Bi(e,t){this._canvas=e,this._modeling=t}Bi.$inject=["canvas","modeling"];Bi.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;En(n.incoming,function(r){t.removeConnection(r,{nested:!0})}),En(n.outgoing,function(r){t.removeConnection(r,{nested:!0})}),En(n.children,function(r){le(r)?t.removeConnection(r,{nested:!0}):t.removeShape(r,{nested:!0})})};Bi.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=Ji(r.children,n),t.removeShape(n),n};Bi.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return Re(r.children,n,i),t.addShape(n,r),n};function qo(e){this._modeling=e}qo.$inject=["modeling"];var _y={x:"y",y:"x"};qo.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,r=e.axis,i=e.dimension;function o(v,w){v.range.min=Math.min(w[r],v.range.min),v.range.max=Math.max(w[r]+w[i],v.range.max)}function a(v){return v[r]+v[i]/2}function s(v){return v.length-1}function c(v){return v.max-v.min}function p(v,w){var R={y:0};R[r]=v-a(w),R[r]&&(R[_y[r]]=0,t.moveElements([w],R,w.parent))}var u=n[0],l=s(n),f=n[l],d,h,y=0;E(n,function(v,w){var R,b,x;if(v.elements.length<2){w&&w!==n.length-1&&(o(v,v.elements[0]),y+=c(v.range));return}R=Rt(v.elements,r),b=R[0],w===l&&(b=R[s(R)]),x=a(b),v.range=null,E(R,function(C){if(p(x,C),v.range===null){v.range={min:C[r],max:C[r]+C[i]};return}o(v,C)}),w&&w!==n.length-1&&(y+=c(v.range))}),h=Math.abs(f.range.min-u.range.max),d=Math.round((h-y)/(n.length-1)),!(dt;if(/n|w/.test(n))return e[r] required");var i=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||kR(n,Zi(r));return Ty(n,r),e.oldProperties=o,e.changed=i,i};ji.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return Ty(n,t),r};ji.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return m(e,"bpmn:DataObject")?NR(e,t):[]};function kR(e,t){return Xe(t,function(n,r){return n[r]=e.get(r),n},{})}function Ty(e,t){E(t,function(n,r){e.set(r,n)})}function NR(e,t){return t.filter(function(n){return m(n,"bpmn:DataObjectReference")&&L(n).dataObjectRef===e})}var Ls="default",Rr="id",My="di",OR={width:0,height:0};function Fi(e,t,n,r){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=r}Fi.$inject=["elementRegistry","moddle","modeling","textRenderer"];Fi.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var r=this._elementRegistry,i=this._moddle.ids,o=t.businessObject,a=FR(e.properties),s=e.oldProperties||BR(t,a);return Dy(a,o)&&(i.unclaim(o[Rr]),r.updateId(t,a[Rr]),i.claim(a[Rr],o)),Ls in a&&(a[Ls]&&n.push(r.get(a[Ls].id)),o[Ls]&&n.push(r.get(o[Ls].id))),ky(t,a),e.oldProperties=s,e.changed=n,n};Fi.prototype.postExecute=function(e){var t=e.element,n=t.label,r=n&&L(n).name;if(r){var i=this._textRenderer.getExternalLabelBounds(n,r);this._modeling.resizeShape(n,i,OR)}};Fi.prototype.revert=function(e){var t=e.element,n=e.properties,r=e.oldProperties,i=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return ky(t,r),Dy(n,i)&&(a.unclaim(n[Rr]),o.updateId(t,r[Rr]),a.claim(r[Rr],i)),e.changed};function Dy(e,t){return Rr in e&&e[Rr]!==t[Rr]}function BR(e,t){var n=Zi(t),r=e.businessObject,i=se(e);return Xe(n,function(o,a){return a!==My?o[a]=r.get(a):o[a]=IR(i,Zi(t.di)),o},{})}function IR(e,t){return Xe(t,function(n,r){return n[r]=e&&e.get(r),n},{})}function ky(e,t){var n=e.businessObject,r=se(e);E(t,function(i,o){o!==My?n.set(o,i):r&&LR(r,i)})}function LR(e,t){E(t,function(n,r){e.set(r,n)})}var jR=["default"];function FR(e){var t=S({},e);return jR.forEach(function(n){n in e&&(t[n]=L(t[n]))}),t}function ea(e,t){this._canvas=e,this._modeling=t}ea.$inject=["canvas","modeling"];ea.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),o=i.businessObject,a=o.$parent,s=se(i);return t.setRootElement(n),t.removeRootElement(i),Re(a.rootElements,r),r.$parent=a,Ne(a.rootElements,o),o.$parent=null,i.di=null,s.bpmnElement=r,n.di=s,e.oldRoot=i,[]};ea.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,o=i.businessObject,a=r.$parent,s=se(n);return t.setRootElement(i),t.removeRootElement(n),Ne(a.rootElements,r),r.$parent=null,Re(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,i.di=s,[]};function js(e,t){this._modeling=e,this._spaceTool=t}js.$inject=["modeling","spaceTool"];js.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,o=Pt(r),a=o===r,s=a?r:r.parent,c=pn(s),p=Te(r);if(p?i==="left"?i="top":i==="right"&&(i="bottom"):i==="top"?i="left":i==="bottom"&&(i="right"),!c.length){var u=p?{x:r.x+qt,y:r.y,width:r.width-qt,height:r.height}:{x:r.x,y:r.y+qt,width:r.width,height:r.height-qt};n.createShape({type:"bpmn:Lane",isHorizontal:p},u,s)}var l=[];An(o,function(x){return l.push(x),x.label&&l.push(x.label),x===r?[]:Q(x.children,function(C){return C!==r})});var f,d,h,y,v;i==="top"?(f=-120,d=r.y,h=d+10,y="n",v="y"):i==="left"?(f=-120,d=r.x,h=d+10,y="w",v="x"):i==="bottom"?(f=120,d=r.y+r.height,h=d-10,y="s",v="y"):i==="right"&&(f=120,d=r.x+r.width,h=d-10,y="e",v="x");var w=t.calculateAdjustments(l,v,f,h),R=p?{x:0,y:f}:{x:f,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,R,y,h);var b=p?{x:r.x+(a?qt:0),y:d-(i==="top"?120:0),width:r.width-(a?qt:0),height:120}:{x:d-(i==="left"?120:0),y:r.y+(a?qt:0),width:120,height:r.height-(a?qt:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:p},b,s)};function Fs(e){this._modeling=e}Fs.$inject=["modeling"];Fs.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,r=e.count,i=pn(n),o=i.length;if(o>r)throw new Error(`more than <${r}> child lanes`);var a=Te(n),s=a?n.height:n.width,c=Math.round(s/r),p,u,l,f;for(f=0;f0||o.bottom<0?-p:p,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:p},l)),(o.left||o.right)&&(p=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),l=o.right?"e":"w",f=o.left>0||o.right<0?-p:p,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:p,y:0},l))};var Hs="flowNodeRef",Mf="lanes";function $i(e){this._elementRegistry=e}$i.$inject=["elementRegistry"];$i.prototype._computeUpdates=function(e,t){var n=[],r=[],i={},o=[];function a(u,l){var f=X(l),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.xf.top&&d.y: must be specified as : with start/end in { h,v,t,r,b,l }");if(Hy(n)){var r=YR(e,t,n),i=qR(e,t,n),o=XR(r,i);return[].concat(r.waypoints,o.waypoints,i.waypoints)}return ZR(e,t,n)}function QR(e,t,n){var r=Df(e,t,n);return r.unshift(e),r.push(t),Nf(r)}function JR(e,t,n,r,i){var o=i&&i.preferredLayouts||[],a=Qf(o,"straight")[0]||"h:h",s=GR[a]||0,c=je(e,t,s),p=iA(c,a);n=n||q(e),r=r||q(t);var u=p.split(":"),l=Ly(n,e,u[0],aA(c)),f=Ly(r,t,u[1],c);return QR(l,f,p)}function Fy(e,t,n,r,i,o){U(n)&&(i=n,o=r,n=q(e),r=q(t)),o=S({preferredLayouts:[]},o),i=i||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&tA(e,t,n,r,o),c||(c=o.connectionEnd&&rA(t,e,r,i),c)||(c=o.connectionStart&&nA(e,t,n,i),c)?c:!o.connectionStart&&!o.connectionEnd&&i&&i.length?i:JR(e,t,n,r,o)}function eA(e,t,n){return e>=t&&e<=n}function Iy(e,t,n){var r={x:"width",y:"height"};return eA(t[e],n[e],n[e]+n[r[e]])}function tA(e,t,n,r,i){var o={},a,s;return s=je(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),i.preserveDocking==="target"?Iy(a,r,e)?(o[a]=r[a],[{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y,original:{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y}},{x:r.x,y:r.y}]):null:Iy(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:r.x,y:o.y!==void 0?o.y:r.y,original:{x:o.x!==void 0?o.x:r.x,y:o.y!==void 0?o.y:r.y}}]):null):null}function nA(e,t,n,r){return kf(e,t,n,r)}function rA(e,t,n,r){var i=r.slice().reverse();return i=kf(e,t,n,i),i?i.reverse():null}function kf(e,t,n,r){function i(u){return u.length<3?!0:u.length>4?!1:!!ne(u,function(l,f){var d=u[f-1];return d&&Or(l,d)<3})}function o(u,l,f){var d=Ut(l,u);switch(d){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function a(u,l,f){var d;for(d=u.length-2;d!==0;d--)if(ll(u[d],l,Oy)||ll(u[d],f,Oy))return u.slice(d);return u}if(i(r))return null;var s=r[0],c=r.slice(),p;return c[0]=n,c[1]=o(c[1],s,n),p=a(c,e,t),p!==c&&(c=kf(e,t,n,p)),c&&Ut(c)?null:c}function iA(e,t){if(Hy(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function oA(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Hy(e){return e&&/t|r|b|l/.test(e)}function aA(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function Ly(e,t,n,r){if(n==="h"&&(n=/left/.test(r)?"l":"r"),n==="v"&&(n=/top/.test(r)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Nf(e){return e.reduce(function(t,n,r){var i=t[t.length-1],o=e[r+1];return eo(i,o,n,0)||t.push(n),t},[])}var sA=-10,cA=40,pA={default:["h:h"],fromGateway:["v:h"],toGateway:["h:v"],loop:{fromTop:["t:r"],fromRight:["r:b"],fromLeft:["l:t"],fromBottom:["b:l"]},boundaryLoop:{alternateHorizontalSide:"b",alternateVerticalSide:"l",default:"v"},messageFlow:["straight","v:v"],subProcess:["straight","h:h"],isHorizontal:!0},uA={default:["v:v"],fromGateway:["h:v"],toGateway:["v:h"],loop:{fromTop:["t:l"],fromRight:["r:t"],fromLeft:["l:b"],fromBottom:["b:r"]},boundaryLoop:{alternateHorizontalSide:"t",alternateVerticalSide:"r",default:"h"},messageFlow:["straight","h:h"],subProcess:["straight","v:v"],isHorizontal:!1},Bf={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},zs={top:"t",right:"r",bottom:"b",left:"l"};function ia(e){this._elementRegistry=e}N(ia,Eu);ia.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,r=t.target||e.target,i=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,p;if(o||(o=$y(i&&i[0],n)),a||(a=$y(i&&i[i.length-1],r)),(m(e,"bpmn:Association")||m(e,"bpmn:DataAssociation"))&&i&&!zy(n,r))return[].concat([o],i.slice(1,-1),[a]);var u=dp(n,s)?pA:uA;return m(e,"bpmn:MessageFlow")?c=fA(n,r,u):(m(e,"bpmn:SequenceFlow")||zy(n,r))&&(n===r?c={preferredLayouts:yA(n,e,u)}:m(n,"bpmn:BoundaryEvent")?c={preferredLayouts:_A(n,r,a,u)}:Vs(n)||Vs(r)?c={preferredLayouts:u.subProcess,preserveDocking:hA(n)}:m(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:m(r,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=S(c,t),p=Nf(Fy(n,r,o,a,i,c))),p||[o,a]};function lA(e){var t=e.host;return je(q(e),t,sA)}function fA(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:dA(e,t)}}function dA(e,t){return m(t,"bpmn:Participant")?"source":m(e,"bpmn:Participant")?"target":Vs(t)?"source":Vs(e)||m(t,"bpmn:Event")?"target":m(e,"bpmn:Event")?"source":null}function hA(e){return Vs(e)?"target":"source"}function $y(e,t){return e?e.original||e:q(t)}function zy(e,t){return m(t,"bpmn:Activity")&&m(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Vs(e){return m(e,"bpmn:SubProcess")&&re(e)}function zi(e,t){return e===t}function mA(e,t){return t.indexOf(e)!==-1}function na(e){var t=/right|left/.exec(e);return t&&t[0]}function ra(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Vy(e,t){return Bf[e]===t}function gA(e,t){var n=na(e),r=Bf[n];return t.indexOf(r)!==-1}function vA(e,t){var n=ra(e),r=Bf[n];return t.indexOf(r)!==-1}function Gy(e){return e==="right"||e==="left"}function yA(e,t,n){var r=t.waypoints,i=r&&r.length&&je(r[0],e);return i==="top"?n.loop.fromTop:i==="right"?n.loop.fromRight:i==="left"?n.loop.fromLeft:n.loop.fromBottom}function _A(e,t,n,r){var i=q(e),o=q(t),a=lA(e),s,c,p=zi(e.host,t),u=mA(a,["top","right","bottom","left"]),l=je(o,i,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return p?xA(a,u,e,t,n,r):(s=bA(a,l,u,r.isHorizontal),c=EA(a,l,u,r.isHorizontal),[s+":"+c])}function xA(e,t,n,r,i,o){var a=t?e:o.isHorizontal?ra(e):na(e),s=zs[a],c;return t?Gy(e)?c=Wy("y",n,r,i)?"h":o.boundaryLoop.alternateHorizontalSide:c=Wy("x",n,r,i)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Wy(e,t,n,r){var i=cA;return!(Of(e,r,n,i)||Of(e,r,{x:n.x+n.width,y:n.y+n.height},i)||Of(e,r,q(t),i))}function Of(e,t,n,r){return Math.abs(t[e]-n[e])!Tr(d))})};oa.prototype.cleanUp=function(){this._complexPreview.cleanUp()};oa.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var Yy={__depends__:[So,Ag,Cu],__init__:["appendPreview"],appendPreview:["type",oa]};var qy=Math.min,Xy=Math.max;function If(e){e.preventDefault()}function Ws(e){e.stopPropagation()}function wA(e){return e.nodeType===Node.TEXT_NODE}function SA(e){return[].slice.call(e)}function un(e){this.container=e.container,this.parent=_e('
    '),this.content=ve("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=nt(this.autoResize,this),this.handlePaste=nt(this.handlePaste,this)}un.prototype.create=function(e,t,n,r){var i=this,o=this.parent,a=this.content,s=this.container;r=this.options=r||{},t=this.style=t||{};var c=dt(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);S(o.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",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var p=dt(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return S(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},p),r.centerVertically&&S(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},p),a.innerText=n,ae.bind(a,"keydown",this.keyHandler),ae.bind(a,"mousedown",Ws),ae.bind(a,"paste",i.handlePaste),r.autoResize&&ae.bind(a,"input",this.autoResize),r.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o};un.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var r;if(e.clipboardData?r=e.clipboardData.getData("text/plain"):r=window.clipboardData.getData("Text"),this.insertText(r),t.autoResize){var i=this.autoResize(n);i&&this.resizeHandler(i)}};un.prototype.insertText=function(e){e=CA(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)};un.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,r=t.endContainer,i=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=SA(a.childNodes),c,p;if(wA(a)){var u=n.textContent;n.textContent=u.substring(0,i)+e+u.substring(o),c=n,p=i+e.length}else if(n===this.content&&r===this.content){var l=document.createTextNode(e);this.content.insertBefore(l,s[i]),c=l,p=l.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(r);s.forEach(function(h,y){y===f?h.textContent=n.textContent.substring(0,i)+e+r.textContent.substring(o):y>f&&y<=d&&Lt(h)}),c=n,p=i+e.length}c&&p!==void 0&&setTimeout(function(){self.setSelection(c,p)})};un.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight
    ');var s,c,p,u,l=function(h){If(h),Ws(h),s=h.clientX,c=h.clientY;var y=t.getBoundingClientRect();p=y.width,u=y.height,ae.bind(document,"mousemove",f),ae.bind(document,"mouseup",d)},f=function(h){If(h),Ws(h);var y=qy(Xy(p+h.clientX-s,r),o),v=qy(Xy(u+h.clientY-c,i),a);t.style.width=y+"px",t.style.height=v+"px",e.resizeHandler({width:p,height:u,dx:h.clientX-s,dy:h.clientY-c})},d=function(h){If(h),Ws(h),ae.unbind(document,"mousemove",f,!1),ae.unbind(document,"mouseup",d,!1)};ae.bind(n,"mousedown",l)}S(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)};un.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ae.unbind(t,"keydown",this.keyHandler),ae.unbind(t,"mousedown",Ws),ae.unbind(t,"input",this.autoResize),ae.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),Lt(n)),Lt(e)};un.prototype.getValue=function(){return this.content.innerText.trim()};un.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t};un.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var r=window.getSelection();r.removeAllRanges(),r.addRange(n)};function CA(e){return e.replace(/\r\n|\r|\n/g,` `)}function Qt(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new un({container:t.getContainer(),keyHandler:nt(this._handleKey,this),resizeHandler:nt(this._handleResize,this)})}Qt.$inject=["eventBus","canvas"];Qt.prototype.registerProvider=function(e){this._providers.push(e)};Qt.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))};Qt.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())};Qt.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})};Qt.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0,this._canvas.restoreFocus&&this._canvas.restoreFocus()};Qt.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,r=this.$textbox.getBoundingClientRect(),i=this.getValue(),o=e.context.text;(i!==o||r.height!==n.height||r.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,i,e.context.text,{x:r.left-t.left,y:r.top-t.top,width:r.width,height:r.height})),this._fire("complete"),this.close()}};Qt.prototype.getValue=function(){return this._textbox.getValue()};Qt.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()};Qt.prototype._handleResize=function(e){this._fire("resize",e)};Qt.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=ne(this._providers,function(r){return(t=r.activate(e))?r: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 Ru={__depends__:[Gr],__init__:["directEditing"],directEditing:["type",Qt]};function Zy(e){return function(t){var n=t.target,r=L(e),i=r.eventDefinitions&&r.eventDefinitions[0],o=r.$type===n.type,a=(i&&i.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!r.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===re(e);return!o||!a||!s||!c}}var Qy=[{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"}}],Jy=[{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"}}],e_=[{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",eventDefinitionAttrs:{name:""}}},{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",eventDefinitionAttrs:{name:""}}},{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"}}],t_=[{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"}}],n_=[{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"}}],r_=[{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:"Ad-hoc sub-process",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],i_=[{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}},{label:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Ad-hoc sub-process (collapsed)",actionName:"replace-with-collapsed-ad-hoc-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}}],Lf=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Sub-process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Ad-hoc sub-process",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",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}}],o_=Lf,jf=[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"User task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Service task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{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:"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:"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}},{label:"Ad-hoc sub-process (collapsed)",actionName:"replace-with-collapsed-ad-hoc-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},{label:"Ad-hoc sub-process (expanded)",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}}],a_=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],s_=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],c_=[{label:"Message boundary event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},{label:"Timer boundary event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},{label:"Escalation boundary event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},{label:"Conditional boundary event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},{label:"Error boundary event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},{label:"Cancel boundary event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},{label:"Signal boundary event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},{label:"Compensation boundary event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},{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}}],p_=[{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},{label:"Error start event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},{label:"Escalation start event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},{label:"Compensation start event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},{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}}],u_=[{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"}],l_=[{label:"Expanded pool/participant",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t},actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}],f_={"bpmn:MessageEventDefinition":[{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},{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:"Message end event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}}],"bpmn:TimerEventDefinition":[{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},{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"}}],"bpmn:ConditionalEventDefinition":[{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},{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"}}],"bpmn:SignalEventDefinition":[{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},{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"}},{label:"Signal end event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],"bpmn:ErrorEventDefinition":[{label:"Error start event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},{label:"Error end event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}}],"bpmn:EscalationEventDefinition":[{label:"Escalation start event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},{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:"Escalation end event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}}],"bpmn:CompensateEventDefinition":[{label:"Compensation start event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},{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:"Compensation end event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}}]};var Ff={"start-event-non-interrupting":` `,"intermediate-event-non-interrupting":` `};function Jt(e,t,n,r,i,o,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=r,this._bpmnReplace=i,this._rules=o,this._translate=a,this._moddleCopy=s,this._register()}Jt.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"];Jt.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)};Jt.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,r=[],i,o=[];if(U(e)||!n.allowed("shape.replace",{element:e}))return{};var a=Zy(e);return m(t,"bpmn:DataObjectReference")?this._createEntries(e,a_):m(t,"bpmn:DataStoreReference")&&!m(e.parent,"bpmn:Collaboration")?this._createEntries(e,s_):(m(t,"bpmn:Event")&&!m(t,"bpmn:BoundaryEvent")&&(i=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,r=f_[i]||[],!qe(t.$parent)&&m(t.$parent,"bpmn:SubProcess")&&(r=Q(r,function(c){return c.target.type!=="bpmn:StartEvent"}))),m(t,"bpmn:StartEvent")&&!m(t.$parent,"bpmn:SubProcess")?(o=Q(Qy.concat(r),a),this._createEntries(e,o)):m(t,"bpmn:Participant")?(o=Q(l_,function(c){return re(e)!==c.target.isExpanded}),this._createEntries(e,o)):m(t,"bpmn:StartEvent")&&qe(t.$parent)?(o=Q(p_.concat(r),function(c){var p=c.target,u=p.isInterrupting!==!1,l=t.isInterrupting===u;return a(c)||!a(c)&&!l}),this._createEntries(e,o)):m(t,"bpmn:StartEvent")&&!qe(t.$parent)&&m(t.$parent,"bpmn:SubProcess")?(o=Q(Jy.concat(r),a),this._createEntries(e,o)):m(t,"bpmn:EndEvent")?(o=Q(t_.concat(r),function(c){var p=c.target;return p.eventDefinitionType=="bpmn:CancelEventDefinition"&&!m(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):m(t,"bpmn:BoundaryEvent")?(o=Q(c_,function(c){var p=c.target;if(p.eventDefinitionType=="bpmn:CancelEventDefinition"&&!m(t.attachedToRef,"bpmn:Transaction"))return!1;var u=p.cancelActivity!==!1,l=t.cancelActivity==u;return a(c)||!a(c)&&!l}),this._createEntries(e,o)):m(t,"bpmn:IntermediateCatchEvent")||m(t,"bpmn:IntermediateThrowEvent")?(o=Q(e_.concat(r),a),this._createEntries(e,o)):m(t,"bpmn:Gateway")?(o=Q(n_,a),this._createEntries(e,o)):m(t,"bpmn:Transaction")?(o=Q(Lf,a),this._createEntries(e,o)):qe(t)&&re(e)?(o=Q(o_,a),this._createEntries(e,o)):m(t,"bpmn:AdHocSubProcess")&&re(e)?(o=Q(i_,a),this._createEntries(e,o)):m(t,"bpmn:SubProcess")&&re(e)?(o=Q(r_,a),this._createEntries(e,o)):m(t,"bpmn:SubProcess")&&!re(e)?(o=Q(jf,function(c){var p=c.target.type===e.type,u=c.target.isExpanded===!0;return p===u}),this._createEntries(e,o)):m(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,u_):m(t,"bpmn:FlowNode")?(o=Q(jf,a),this._createEntries(e,o)):{})};Jt.prototype.getPopupMenuHeaderEntries=function(e){var t={};return m(e,"bpmn:Activity")&&!qe(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),m(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),m(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Yp(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t};Jt.prototype._createEntries=function(e,t){var n={},r=this;return E(t,function(i){n[i.actionName]=r._createEntry(i,e)}),n};Jt.prototype._createSequenceFlowEntries=function(e,t){var n=L(e),r={},i=this._modeling,o=this._moddle,a=this;return E(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(m(n.sourceRef,"bpmn:ExclusiveGateway")||m(n.sourceRef,"bpmn:InclusiveGateway")||m(n.sourceRef,"bpmn:ComplexGateway")||m(n.sourceRef,"bpmn:Activity"))&&(r={...r,[s.actionName]:a._createEntry(s,e,function(){i.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&m(n.sourceRef,"bpmn:Activity")&&(r={...r,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});i.updateProperties(e,{conditionExpression:c})})});break;default:m(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(r={...r,[s.actionName]:a._createEntry(s,e,function(){i.updateProperties(e,{conditionExpression:void 0})})}),(m(n.sourceRef,"bpmn:ExclusiveGateway")||m(n.sourceRef,"bpmn:InclusiveGateway")||m(n.sourceRef,"bpmn:ComplexGateway")||m(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(r={...r,[s.actionName]:a._createEntry(s,e,function(){i.updateProperties(e.source,{default:void 0})})})}}),r};Jt.prototype._createEntry=function(e,t,n){var r=this._translate,i=this._bpmnReplace.replaceElement,o=function(){return i(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||o,{label:r(a),className:e.className,action:n}};Jt.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function r(p,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var l=e.businessObject.get("loopCharacteristics");l&&m(l,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,l,{isSequential:u.options.isSequential}):(l=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:l}))}var i=L(e),o=i.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:r,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}};Jt.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,r=e.businessObject.dataObjectRef;if(!r)return{};function i(a,s){t._modeling.updateModdleProperties(e,r,{isCollection:!s.active})}var o=r.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:i}}};Jt.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,r=this._translate;function i(a,s){var c=s.active,p;c||(p=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:p})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:r("Participant multiplicity"),active:!!o,action:i}}};Jt.prototype._getNonInterruptingHeaderEntries=function(e){let t=this._translate,n=L(e),r=this,i=qp(e),o=m(e,"bpmn:BoundaryEvent")?Ff["intermediate-event-non-interrupting"]:Ff["start-event-non-interrupting"],a=!n[i];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){r._modeling.updateProperties(e,{[i]:!!a})}}}};var d_={__depends__:[Eo,hu,So],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Jt]};function Vi(e,t,n,r,i,o,a,s,c,p,u,l,f){e=e||{},r.registerProvider(this),this._contextPad=r,this._modeling=i,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=p,this._rules=u,this._translate=l,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,y=h.shape;if(!(!yr(d)||!r.isOpen(y))){var v=r.getEntries(y);v.replace&&v.replace.action.click(d,y)}}),n.on("contextPad.close",function(){f.cleanUp()})}Vi.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"];Vi.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&S(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(r,i){t.removeElements(i.slice())}}}}),n};Vi.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return U(t)?hn(e,n=>t.includes(n)):t};Vi.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,r=this._elementFactory,i=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,p=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&S(u,h()),u;var l=e.businessObject;function f(b,x){i.start(b,x)}function d(b,x){n.removeElements([x])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function y(b){var x=5,C=t.getPad(b).html,P=C.getBoundingClientRect(),O={x:P.left,y:P.bottom+x};return O}function v(b,x,C,P){function O(I,W){var $=r.createShape(S({type:b},P));o.start(I,$,{source:W})}var T=s?function(I,W){var $=r.createShape(S({type:b},P));s.append(W,$)}:O,B=s?function(I,W){return p.create(W,b,P),()=>{p.cleanUp()}}:null;return{group:"model",className:x,title:C,action:{dragstart:O,click:T,hover:B}}}function w(b){return function(x,C){n.splitLane(C,b),t.open(C,!0)}}if(ee(l,["bpmn:Lane","bpmn:Participant"])&&re(e)){var R=pn(e);S(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(b,x){n.addLane(x,"top")}}}}),R.length<2&&((Te(e)?e.height>=120:e.width>=120)&&S(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(Te(e)?e.height>=180:e.width>=180)&&S(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),S(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(b,x){n.addLane(x,"bottom")}}}})}return m(l,"bpmn:FlowNode")&&(m(l,"bpmn:EventBasedGateway")?S(u,{"append.receive-task":v("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):h_(l,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?S(u,{"append.compensation-activity":v("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!m(l,"bpmn:EndEvent")&&!l.isForCompensation&&!h_(l,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!qe(l)&&S(u,{"append.end-event":v("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":v("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":v("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":v("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||S(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var C=S(y(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",C,{title:c("Change element"),width:300,search:!0})}}}}),m(l,"bpmn:SequenceFlow")&&S(u,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),m(l,"bpmn:MessageFlow")&&S(u,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ee(l,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&S(u,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),m(l,"bpmn:TextAnnotation")&&S(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),ee(l,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&S(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),m(l,"bpmn:Group")&&S(u,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&S(u,h()),u};function h_(e,t,n){var r=e.$instanceOf(t),i=!1,o=e.eventDefinitions||[];return E(o,function(a){a.$type===n&&(i=!0)}),r&&i}var m_={__depends__:[Yy,Ru,Kc,Qe,Po,ni,d_],__init__:["contextPadProvider"],contextPadProvider:["type",Vi]};var AA={horizontal:["x","width"],vertical:["y","height"]},g_=5;function Ln(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var r=t.allowed("elements.distribute",{elements:n});return U(r)?r:r?n:[]})}Ln.$inject=["modeling","rules"];Ln.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)};Ln.prototype.trigger=function(e,t){var n=this._modeling,r,i;if(!(e.length<3)&&(this._setOrientation(t),i=this._filterElements(e),r=this._createGroups(i),!(r.length<=2)))return n.distributeElements(r,this._axis,this._dimension),r};Ln.prototype._filterElements=function(e){var t=this._filters,n=this._axis,r=this._dimension,i=[].concat(e);return t.length?(E(t,function(o){i=o(i,n,r)}),i):e};Ln.prototype._createGroups=function(e){var t=[],n=this,r=this._axis,i=this._dimension;if(!r)throw new Error('must have a defined "axis" and "dimension"');var o=Rt(e,r);return E(o,function(a,s){var c=n._findRange(a,r,i),p,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(p={range:c,elements:[a]},t.push(p))}),t};Ln.prototype._setOrientation=function(e){var t=AA[e];this._axis=t[0],this._dimension=t[1]};Ln.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)};Ln.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+g_,max:t+n-g_}};var v_={__init__:["distributeElements"],distributeElements:["type",Ln]};function aa(e){At.call(this,e)}aa.$inject=["eventBus"];N(aa,At);aa.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Q(t,function(n){var r=ee(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||r)}),t=Nr(t),t.length<3?!1:t})};var PA={horizontal:` `,vertical:` `},Hf=PA;var TA=900;function Wi(e,t,n,r){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",TA,this)}Wi.$inject=["popupMenu","distributeElements","translate","rules"];Wi.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&S(t,this._getEntries(e)),t};Wi.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})};Wi.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,r=this._popupMenu,i={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:Hf.horizontal,action:function(o,a){t.trigger(e,"horizontal"),r.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Hf.vertical,action:function(o,a){t.trigger(e,"vertical"),r.close()}}};return i};var y_={__depends__:[Eo,v_],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",aa],distributeElementsMenuProvider:["type",Wi]};var __="is not a registered action",MA="is already registered";function Vt(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Vt.$inject=["eventBus","injector"];Vt.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),r=e.get("selection",!1),i=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),p=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&r&&this.register("copy",function(){var u=r.get();if(u.length)return o.copy(u)}),o&&r&&this.register("duplicate",function(){var u=r.get();if(u.length)return o.duplicate(u)}),o&&this.register("paste",function(){o.paste()}),o&&r&&s&&this.register("cut",function(){var u=r.get();if(u.length){var l=s.allowed("elements.delete",{elements:u});if(l!==!1){var f=U(l)?l:u;return o.cut(f.slice())}}}),i&&this.register("stepZoom",function(u){i.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&r&&s&&this.register("removeSelection",function(){var u=r.get();if(u.length){var l=s.allowed("elements.delete",{elements:u}),f;l!==!1&&(U(l)?f=l:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),p&&this.register("moveSelection",function(u){p.moveSelection(u.direction,u.accelerated)})};Vt.prototype.trigger=function(e,t){if(!this._actions[e])throw $f(e,__);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)};Vt.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);E(e,function(r,i){n._registerAction(i,r)})};Vt.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw $f(e,MA);this._actions[e]=t};Vt.prototype.unregister=function(e){if(!this.isRegistered(e))throw $f(e,__);this._actions[e]=void 0};Vt.prototype.getActions=function(){return Object.keys(this._actions)};Vt.prototype.isRegistered=function(e){return!!this._actions[e]};function $f(e,t){return new Error(e+" "+t)}var x_={__init__:["editorActions"],editorActions:["type",Vt]};function sa(e){e.invoke(Vt,this)}N(sa,Vt);sa.$inject=["injector"];sa.prototype._registerDefaultActions=function(e){Vt.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),r=e.get("selection",!1),i=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),p=e.get("alignElements",!1),u=e.get("directEditing",!1),l=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&r&&this._registerAction("selectElements",function(){var h=t.getRootElement(),y=n.filter(function(v){return v!==h});return r.select(y),y}),i&&this._registerAction("spaceTool",function(){i.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),r&&c&&this._registerAction("distributeElements",function(h){var y=r.get(),v=h.type;y.length&&c.trigger(y,v)}),r&&p&&this._registerAction("alignElements",function(h){var y=r.get(),v=[],w=h.type;y.length&&(v=Q(y,function(R){return!m(R,"bpmn:Lane")}),p.trigger(v,w))}),r&&f&&this._registerAction("setColor",function(h){var y=r.get();y.length&&f.setColor(y,h)}),r&&u&&this._registerAction("directEditing",function(){var h=r.get();h.length&&u.activate(h[0])}),l&&this._registerAction("find",function(){l.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),y,v;m(h,"bpmn:Collaboration")?v=n.filter(function(w){return m(w.parent,"bpmn:Collaboration")}):v=n.filter(function(w){return w!==h&&!m(w.parent,"bpmn:SubProcess")}),y=we(v),f.moveElements(v,{x:-y.x,y:-y.y},h)}),r&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};var b_={__depends__:[x_],editorActions:["type",sa]};function Au(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,r=t.shape;ee(r,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}Au.$inject=["eventBus"];function Ar(e,t){k.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(r){var i=r.context,o=i.hints||{},a=o.autoResize;if(a){var s=i.shape,c=i.newBounds;rt(a)?i.newBounds=n.snapComplex(c,a):i.newBounds=n.snapSimple(s,c)}})}Ar.$inject=["eventBus","gridSnapping","modeling"];N(Ar,k);Ar.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t};Ar.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e};Ar.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,r=/w/.test(t),i=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),i&&(r?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),S(e,o),e};Ar.prototype.snapVertically=function(e,t){var n=this._gridSnapping,r=/n/.test(t),i=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),r&&(i?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),S(e,o),e};var DA=2e3;function Pu(e,t){e.on(["spaceTool.move","spaceTool.end"],DA,function(n){var r=n.context;if(r.initialized){var i=r.axis,o;i==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}Pu.$inject=["eventBus","gridSnapping"];var E_={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Ar],gridSnappingSpaceToolBehavior:["type",Pu]};var Gs=10;function Tu(e,t,n){return n||(n="round"),Math[n](e/t)*t}var kA=1200,NA=800;function rr(e,t,n){var r=!n||n.active!==!1;this._eventBus=t;var i=this;t.on("diagram.init",NA,function(){i.setActive(r)}),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],kA,function(o){var a=o.originalEvent;if(!(!i.active||a&&mt(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(p){var u={},l=BA(o,p,e);l&&(u.offset=l);var f=OA(o,p);f&&S(u,f),kn(o,p)||i.snapEvent(o,p,u)})}})}rr.prototype.snapEvent=function(e,t,n){var r=this.snapValue(e[t],n);He(e,t,r)};rr.prototype.getGridSpacing=function(){return Gs};rr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Tu(e,Gs);var r,i;return t&&t.min&&(r=t.min,te(r)&&(r=Tu(r+n,Gs,"ceil"),e=Math.max(e,r))),t&&t.max&&(i=t.max,te(i)&&(i=Tu(i+n,Gs,"floor"),e=Math.min(e,i))),e-=n,e};rr.prototype.isActive=function(){return this.active};rr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})};rr.prototype.toggleActive=function(){this.setActive(!this.active)};rr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function OA(e,t){var n=e.context,r=n.createConstraints,i=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;r&&(Mu(t)?(a.x.min=r.left,a.x.max=r.right):(a.y.min=r.top,a.y.max=r.bottom));var c=i.min,p=i.max;return c&&(Mu(t)?S_(s)?a.x.max=c.left:a.x.min=c.right:w_(s)?a.y.max=c.top:a.y.min=c.bottom),p&&(Mu(t)?S_(s)?a.x.min=p.left:a.x.max=p.right:w_(s)?a.y.min=p.top:a.y.max=p.bottom),a[t]}function BA(e,t,n){var r=e.context,i=e.shape,o=r.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&te(s[t])||(s||(s=o.snapOffset={}),te(s[t])||(s[t]=0),!i)||(n.get(i.id)||(Mu(t)?s[t]+=i[t]+i.width/2:s[t]+=i[t]+i.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=i.width/2:/right/.test(a)&&(s[t]+=i.width/2):/top/.test(a)?s[t]-=i.height/2:/bottom/.test(a)&&(s[t]+=i.height/2)),s[t]}function Mu(e){return e==="x"}function w_(e){return e.indexOf("n")!==-1}function S_(e){return e.indexOf("w")!==-1}var C_={__depends__:[E_],__init__:["gridSnapping"],gridSnapping:["type",rr]};var IA=2e3;function Du(e,t,n){e.on("autoPlace",IA,function(r){var i=r.source,o=q(i),a=r.shape,s=hp(i,a,n);return["x","y"].forEach(function(c){var p={};s[c]!==o[c]&&(s[c]>o[c]?p.min=s[c]:p.max=s[c],m(a,"bpmn:TextAnnotation")&&(LA(c)?p.offset=-a.width/2:p.offset=-a.height/2),s[c]=t.snapValue(s[c],p))}),s})}Du.$inject=["eventBus","gridSnapping","elementRegistry"];function LA(e){return e==="x"}var jA=1750;function ku(e,t,n){t.on(["create.start","shape.move.start"],jA,function(r){var i=r.context,o=i.shape,a=e.getRootElement();if(!(!m(o,"bpmn:Participant")||!m(a,"bpmn:Process")||!a.children.length)){var s=i.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}ku.$inject=["canvas","eventBus","gridSnapping"];var FA=3e3;function ca(e,t,n){k.call(this,e),this._gridSnapping=t;var r=this;this.postExecuted(["connection.create","connection.layout"],FA,function(i){var o=i.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||HA(c)&&n.updateWaypoints(a,r.snapMiddleSegments(c))})}ca.$inject=["eventBus","gridSnapping","modeling"];N(ca,k);ca.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var r=1;r3}function $A(e){return e==="h"}function zA(e){return e==="v"}function VA(e,t,n){var r=Ut(t,n),i={};return $A(r)&&(i.y=e.snapValue(t.y)),zA(r)&&(i.x=e.snapValue(t.x)),("x"in i||"y"in i)&&(t=S({},t,i),n=S({},n,i)),[t,n]}var R_={__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Du],gridSnappingParticipantBehavior:["type",ku],gridSnappingLayoutConnectionBehavior:["type",ca]};var A_={__depends__:[C_,R_],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Au]};var WA=30,P_=30;function Gi(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(r){var i=r.element,o=r.gfx;if(m(i,"bpmn:Lane"))return n._createParticipantHit(i,o);if(m(i,"bpmn:Participant"))return re(i)?n._createParticipantHit(i,o):n._createDefaultHit(i,o);if(m(i,"bpmn:SubProcess"))return re(i)?n._createSubProcessHit(i,o):n._createDefaultHit(i,o)})}Gi.$inject=["eventBus","interactionEvents"];Gi.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0};Gi.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=Te(e)?{width:WA,height:e.height}:{width:e.width,height:P_};return this._interactionEvents.createBoxHit(t,"all",n),!0};Gi.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:P_}),!0};var T_={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Gi]};function pa(e){e.invoke(_r,this)}N(pa,_r);pa.$inject=["injector"];pa.prototype.registerBindings=function(e,t){_r.prototype.registerBindings.call(this,e,t);function n(r,i){t.isRegistered(r)&&e.addListener(i)}n("selectElements",function(r){var i=r.keyEvent;if(e.isKey(["a","A"],i)&&e.isCmd(i))return t.trigger("selectElements"),!0}),n("find",function(r){var i=r.keyEvent;if(e.isKey(["f","F"],i)&&e.isCmd(i))return t.trigger("find"),!0}),n("spaceTool",function(r){var i=r.keyEvent;if(!e.hasModifier(i)&&e.isKey(["s","S"],i))return t.trigger("spaceTool"),!0}),n("lassoTool",function(r){var i=r.keyEvent;if(!e.hasModifier(i)&&e.isKey(["l","L"],i))return t.trigger("lassoTool"),!0}),n("handTool",function(r){var i=r.keyEvent;if(!e.hasModifier(i)&&e.isKey(["h","H"],i))return t.trigger("handTool"),!0}),n("globalConnectTool",function(r){var i=r.keyEvent;if(!e.hasModifier(i)&&e.isKey(["c","C"],i))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(r){var i=r.keyEvent;if(!e.hasModifier(i)&&e.isKey(["e","E"],i))return t.trigger("directEditing"),!0}),n("replaceElement",function(r){var i=r.keyEvent;if(!e.hasModifier(i)&&e.isKey(["r","R"],i))return t.trigger("replaceElement",i),!0})};var M_={__depends__:[ho],__init__:["keyboardBindings"],keyboardBindings:["type",pa]};var GA={moveSpeed:1,moveSpeedAccelerated:10},UA=1500,D_="left",k_="up",N_="right",O_="down",KA={ArrowLeft:D_,Left:D_,ArrowUp:k_,Up:k_,ArrowRight:N_,Right:N_,ArrowDown:O_,Down:O_},YA={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function Nu(e,t,n,r,i){var o=this;this._config=S({},GA,e||{}),t.addListener(UA,function(a){var s=a.keyEvent,c=KA[s.key];if(c&&!t.isCmd(s)){var p=t.isShift(s);return o.moveSelection(c,p),!0}}),this.moveSelection=function(a,s){var c=i.get();if(c.length){var p=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=YA[a](p),l=r.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});l&&n.moveElements(c,u)}}}Nu.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var B_={__depends__:[ho,Qe],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Nu]};var I_=10;function Ui(e,t,n,r){this._dragging=r,this._rules=t;var i=this;function o(c,p){var u=c.shape,l=c.direction,f=c.resizeConstraints,d;c.delta=p,d=Og(u,l,p),c.newBounds=Ig(d,f),c.canExecute=i.canResize(c)}function a(c){var p=c.resizeConstraints,u=c.minBounds;p===void 0&&(u===void 0&&(u=i.computeMinResizeBox(c)),c.resizeConstraints={min:X(u)})}function s(c){var p=c.shape,u=c.canExecute,l=c.newBounds;if(u){if(l=cc(l),!qA(p,l))return;n.resizeShape(p,l)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var p={x:c.dx,y:c.dy};o(c.context,p)}),e.on("resize.end",function(c){s(c.context)})}Ui.prototype.canResize=function(e){var t=this._rules,n=dt(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)};Ui.prototype.activate=function(e,t,n){var r=this._dragging,i,o;if(typeof n=="string"&&(n={direction:n}),i=S({shape:t},n),o=i.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");r.init(e,zf(t,o),"resize",{autoActivate:!0,cursor:XA(o),data:{shape:t,context:i}})};Ui.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,r,i;return r=e.minDimensions||{width:I_,height:I_},i=$p(t,e.childrenBoxPadding),Lg(n,t,r,i)};Ui.$inject=["eventBus","rules","modeling","dragging"];function qA(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function zf(e,t){var n=q(e),r=X(e),i={x:n.x,y:n.y};return t.indexOf("n")!==-1?i.y=r.top:t.indexOf("s")!==-1&&(i.y=r.bottom),t.indexOf("e")!==-1?i.x=r.right:t.indexOf("w")!==-1&&(i.x=r.left),i}function XA(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var L_="djs-resizing",j_="resize-not-ok",ZA=500;function Ou(e,t,n){function r(o){var a=o.shape,s=o.newBounds,c=o.frame;c||(c=o.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,L_)),s.width>5&&H(c,{x:s.x,width:s.width}),s.height>5&&H(c,{y:s.y,height:s.height}),o.canExecute?ce(c).remove(j_):ce(c).add(j_)}function i(o){var a=o.shape,s=o.frame;s&&Ce(o.frame),t.removeMarker(a,L_)}e.on("resize.move",ZA,function(o){r(o.context)}),e.on("resize.cleanup",function(o){i(o.context)})}Ou.$inject=["eventBus","canvas","previewSupport"];var Bu=-6,Iu=8,Lu=20,Us="djs-resizer",QA=["n","w","s","e","nw","ne","se","sw"];function ir(e,t,n,r){this._resize=r,this._canvas=t;var i=this;e.on("selection.changed",function(o){var a=o.newSelection;i.removeResizers(),a.length===1&&E(a,nt(i.addResizer,i))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(i.removeResizers(),i.addResizer(a))})}ir.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(o){sn(o)&&r.activate(o,e,n)}ae.bind(t,"mousedown",i),ae.bind(t,"touchstart",i)};ir.prototype._createResizer=function(e,t,n,r){var i=this._getResizersParent(),o=JA(r),a=G("g");ce(a).add(Us),ce(a).add(Us+"-"+e.id),ce(a).add(Us+"-"+r),Z(i,a);var s=G("rect");H(s,{x:-Iu/2+o.x,y:-Iu/2+o.y,width:Iu,height:Iu}),ce(s).add(Us+"-visual"),Z(a,s);var c=G("rect");return H(c,{x:-Lu/2+o.x,y:-Lu/2+o.y,width:Lu,height:Lu}),ce(c).add(Us+"-hit"),Z(a,c),ro(a,t,n),a};ir.prototype.createResizer=function(e,t){var n=zf(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)};ir.prototype.addResizer=function(e){var t=this;le(e)||E(QA,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})};ir.prototype.removeResizers=function(){var e=this._getResizersParent();cr(e)};ir.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")};ir.$inject=["eventBus","canvas","selection","resize"];function JA(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Bu:e.indexOf("w")!==-1&&(t.x=Bu),e.indexOf("s")!==-1?t.y=-Bu:e.indexOf("n")!==-1&&(t.y=Bu),t}var ju={__depends__:[gt,Ct,bn],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ui],resizePreview:["type",Ou],resizeHandles:["type",ir]};var eP=2e3;function Ki(e,t,n,r,i,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=i,this._textRenderer=a,r.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){r.isActive()&&r.complete()}),e.on(["shape.remove","connection.remove"],eP,function(c){r.isActive(c.element)&&r.cancel()}),e.on(["commandStack.changed"],function(c){r.isActive()&&r.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var p=c.context,u=p.shape,l=c.context.canExecute,f=c.isTouch;f||l&&(p.hints&&p.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,p){(p||ee(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&r.activate(c)}}Ki.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"];Ki.prototype.activate=function(e){var t=pt(e);if(t!==void 0){var n={text:t},r=this.getEditingBBox(e);S(n,r);var i={},o=n.style||{};return S(o,{backgroundColor:null,border:null}),(ee(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||F_(e))&&S(i,{centerVertically:!0}),rn(e)&&(S(i,{resizable:!0,autoResize:!0}),S(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),m(e,"bpmn:TextAnnotation")&&(S(i,{resizable:!0,autoResize:!0}),S(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),S(n,{options:i,style:o}),n}};Ki.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,r=t.getAbsoluteBBox(n),i={x:r.x+r.width/2,y:r.y+r.height/2},o={x:r.x,y:r.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),p=c.fontSize*a,u=c.lineHeight,l=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(m(e,"bpmn:Lane")||rP(e)){var h=Te(e),y=h?{width:r.height,height:30*a,x:r.x-r.height/2+15*a,y:i.y-30*a/2}:{width:r.width,height:30*a};S(o,y),S(d,{fontSize:l+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(nP(e)){var v=Te(e),w=v?{width:r.width,height:r.height}:{width:r.height,height:r.width,x:i.x-r.height/2,y:i.y-r.width/2};S(o,w),S(d,{fontSize:l+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:v?null:"rotate(-90deg)"})}(ee(e,["bpmn:Task","bpmn:CallActivity"])||F_(e))&&(S(o,{width:r.width,height:r.height}),S(d,{fontSize:l+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),tP(e)&&(S(o,{width:r.width,x:r.x}),S(d,{fontSize:l+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var R=1,b=r.width+2*R;if(n.labelTarget&&(S(o,{width:b,height:r.height+2*R,x:r.x-R,y:r.y-R}),S(d,{fontSize:p+"px",lineHeight:u})),rn(n)&&!$r(n)&&!J(n)){var x=Sa(e),C=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),P=p,O=Yn.width*a+2*R;S(o,{width:O,height:P+2*R,x:C.x-O/2,y:C.y-P/2-R}),S(d,{fontSize:p+"px",lineHeight:u})}return m(e,"bpmn:TextAnnotation")&&(S(o,{width:r.width+2*R,height:r.height+2*R,x:r.x-R,y:r.y-R,minWidth:30*a,minHeight:10*a}),S(d,{textAlign:"left",paddingTop:fr*a+"px",paddingBottom:fr*a+"px",paddingLeft:fr*a+"px",paddingRight:fr*a+"px",fontSize:l+"px",lineHeight:f})),{bounds:o,style:d}};Ki.prototype.update=function(e,t,n,r){var i,o;m(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),i={x:e.x,y:e.y,width:e.width/o.width*r.width,height:e.height/o.height*r.height}),iP(t)&&(t=null),this._modeling.updateLabel(e,t,i)};function F_(e){return m(e,"bpmn:SubProcess")&&!re(e)}function tP(e){return m(e,"bpmn:SubProcess")&&re(e)}function nP(e){return m(e,"bpmn:Participant")&&!re(e)}function rP(e){return m(e,"bpmn:Participant")&&re(e)}function iP(e){return!e||!e.trim()}var H_="djs-element-hidden",$_="djs-label-hidden";function Fu(e,t,n){var r=this,i=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var p=c.active;if(o=p.element.label||p.element,m(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=G("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),l=r.path=G("path");H(l,{d:u,strokeWidth:2,stroke:oP(o)}),Z(s,l),Z(i,s),Ie(s,o.x,o.y)}m(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,H_):(m(o,"bpmn:Task")||m(o,"bpmn:CallActivity")||m(o,"bpmn:SubProcess")||m(o,"bpmn:Participant")||m(o,"bpmn:Lane"))&&t.addMarker(o,$_)}),e.on("directEditing.resize",function(c){if(m(o,"bpmn:TextAnnotation")){var p=c.height,u=c.dy,l=Math.max(o.height/a.height*(p+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:l,position:{mx:0,my:0}});H(r.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var p=c.active;p&&(t.removeMarker(p.element.label||p.element,H_),t.removeMarker(o,$_)),o=void 0,a=void 0,s&&(Ce(s),s=void 0)})}Fu.$inject=["eventBus","canvas","pathMap"];function oP(e,t){var n=se(e);return n.get("stroke")||t||"black"}var z_={__depends__:[lo,ju,Ru],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ki],labelEditingPreview:["type",Fu]};var aP=500,sP=1e3;function Pr(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),r=this;function i(o){var a=G("rect");return H(a,S({x:0,y:0,rx:4,width:100,height:100},n)),a}e.on(["shape.added","shape.changed"],aP,function(o){var a=o.element,s=o.gfx,c=ve(".djs-outline",s);c||(c=r.getOutline(a)||i(s),Z(s,c)),r.updateShapeOutline(c,a)}),e.on(["connection.added","connection.changed"],function(o){var a=o.element,s=o.gfx,c=ve(".djs-outline",s);c||(c=i(s),Z(s,c)),r.updateConnectionOutline(c,a)})}Pr.prototype.updateShapeOutline=function(e,t){var n=!1,r=this._getProviders();r.length&&E(r,function(i){n=n||i.updateOutline(t,e)}),n||H(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})};Pr.prototype.updateConnectionOutline=function(e,t){var n=we(t);H(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+this.offset*2,height:n.height+this.offset*2})};Pr.prototype.registerProvider=function(e,t){t||(t=e,e=sP),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})};Pr.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers};Pr.prototype.getOutline=function(e){var t,n=this._getProviders();return E(n,function(r){Le(r.getOutline)&&(t=t||r.getOutline(e))}),t};Pr.$inject=["eventBus","styles","elementRegistry"];var Hu=6;function Ks(e,t,n){this._canvas=t;var r=this;e.on("element.changed",function(i){n.isSelected(i.element)&&r._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(i){var o=i.newSelection;r._updateMultiSelectionOutline(o)})}Ks.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");cr(t);var n=e.length>1,r=this._canvas.getContainer();if(ce(r)[n?"add":"remove"]("djs-multi-select"),!!n){var i=cP(we(e)),o=G("rect");H(o,S({rx:3},i)),ce(o).add("djs-selection-outline"),Z(t,o)}};Ks.$inject=["eventBus","canvas","selection"];function cP(e){return{x:e.x-Hu,y:e.y-Hu,width:e.width+Hu*2,height:e.height+Hu*2}}var ua={__depends__:[Qe],__init__:["outline","multiSelectionOutline"],outline:["type",Pr],multiSelectionOutline:["type",Ks]};var V_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],W_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},pP=15,$u=2;function zu(e,t,n,r,i){let o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:l}){var d;let f=l.filter(h=>ee(h,V_));if(f.length===1){let h=f[0];J(h)?a(h,h.labelTarget,l):(d=h.labels)!=null&&d.length&&a(h.labels[0],h,l)}if(f.length===2){let h=f.find(J),y=f.find(v=>{var w;return(w=v.labels)==null?void 0:w.includes(h)});h&&y&&a(h,y,l)}}),e.on("shape.changed",function({element:l}){var f;!ee(l,V_)||!u(l)||(J(l)?a(l,l.labelTarget,i.get()):(f=l.labels)!=null&&f.length&&a(l.labels[0],l,i.get()))});function a(l,f,d=[]){let h=Hn([q(f),q(l)],W_),y=h.getAttribute("d"),w=d.includes(l)?c(l):p(l),R=jr(w,y);if(!R)return;let x=d.includes(f)?c(f):p(f),C=jr(x,y)||q(f);Ri(C,R)');return ct(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function fP(e,t,n){ct(e,{left:t+"px",top:n+"px"})}function Wf(e,t){e.style.display=t===!1?"none":""}var U_="djs-tooltip",Vf="."+U_;function Tt(e,t){this._eventBus=e,this._canvas=t,this._ids=uP,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=lP(t.getContainer());var n=this;ht.bind(this._tooltipRoot,Vf,"mousedown",function(r){r.stopPropagation()}),ht.bind(this._tooltipRoot,Vf,"mouseover",function(r){n.trigger("mouseover",r)}),ht.bind(this._tooltipRoot,Vf,"mouseout",function(r){n.trigger("mouseout",r)}),this._init()}Tt.$inject=["eventBus","canvas"];Tt.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=S({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t};Tt.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(Ze(n,"data-tooltip-id"));r&&(e==="mouseover"&&r.timeout&&this.clearTimeout(r),e==="mouseout"&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))};Tt.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]};Tt.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}};Tt.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}};Tt.prototype.remove=function(e){var t=this.get(e);t&&(Lt(t.html),Lt(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])};Tt.prototype.show=function(){Wf(this._tooltipRoot)};Tt.prototype.hide=function(){Wf(this._tooltipRoot,!1)};Tt.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,r="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=r,this._tooltipRoot.style["-ms-transform"]=r};Tt.prototype._addTooltip=function(e){var t=e.id,n=e.html,r,i=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),rt(n)&&(n=_e(n)),r=_e('
    '),ct(r,{position:"absolute"}),r.appendChild(n),e.type&&ke(r).add("djs-tooltip-"+e.type),e.className&&ke(r).add(e.className),e.htmlContainer=r,i.appendChild(r),this._tooltips[t]=e,this._updateTooltip(e)};Tt.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;fP(n,t.x,t.y)};Tt.prototype._updateTooltipVisibilty=function(e){E(this._tooltips,function(t){var n=t.show,r=t.htmlContainer,i=!0;n&&((n.minZoom>e.scale||n.maxZoom"+o+"
    "})}e.on(["shape.move.rejected","create.rejected"],function(i){var o=i.context,a=o.shape,s=o.target;m(s,"bpmn:Collaboration")&&(m(a,"bpmn:FlowNode")?r(i,n(dP)):m(a,"bpmn:DataObjectReference")&&r(i,n(hP)))})}Vu.$inject=["eventBus","tooltips","translate"];var Y_={__depends__:[K_],__init__:["modelingFeedback"],modelingFeedback:["type",Vu]};var mP=500,gP=1250,vP=1500,Wu=Math.round;function yP(e){return{x:e.x+Wu(e.width/2),y:e.y+Wu(e.height/2)}}function Gu(e,t,n,r,i){function o(s,c,p,u){return i.allowed("elements.move",{shapes:s,delta:c,position:p,target:u})}e.on("shape.move.start",vP,function(s){var c=s.context,p=s.shape,u=r.get().slice();u.indexOf(p)===-1&&(u=[p]),u=_P(u),S(c,{shapes:u,validatedShapes:u,shape:p})}),e.on("shape.move.start",gP,function(s){var c=s.context,p=c.validatedShapes,u;if(u=c.canExecute=o(p),!u)return!1}),e.on("shape.move.move",mP,function(s){var c=s.context,p=c.validatedShapes,u=s.hover,l={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(p,l,f,u),c.delta=l,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,p=c.delta,u=c.canExecute,l=u==="attach",f=c.shapes;if(u===!1)return!1;p.x=Wu(p.x),p.y=Wu(p.y),!(p.x===0&&p.y===0)&&n.moveElements(f,p,c.target,{primaryShape:c.shape,attach:l})}),e.on("element.mousedown",function(s){if(sn(s)){var c=vr(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,p,u){if(Pe(p)&&(u=p,p=!1),!(c.waypoints||!c.parent)&&!ce(s.target).has("djs-hit-no-move")){var l=yP(c),f=t.init(s,l,"shape.move",{cursor:"grabbing",autoActivate:p,data:{shape:c,context:u||{}}});if(f!==!1)return!0}}this.start=a}Gu.$inject=["eventBus","dragging","modeling","selection","rules"];function _P(e){var t=Cn(e,"id");return Q(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var q_=499,Gf="djs-dragging",X_="drop-ok",Z_="drop-not-ok",Q_="new-parent",J_="attach-ok";function Uu(e,t,n,r){function i(c){var p=o(c),u=xP(p);return u}function o(c){var p=$n(c,!0),u=p.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),l=p.concat(u),f=[...new Set(l)];return f}function a(c,p){[J_,X_,Z_,Q_].forEach(function(u){u===p?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,p,u){r.addDragger(p,c.dragGroup),u&&t.addMarker(p,Gf),c.allDraggedElements?c.allDraggedElements.push(p):c.allDraggedElements=[p]}e.on("shape.move.start",q_,function(c){var p=c.context,u=p.shapes,l=p.allDraggedElements,f=i(u);if(!p.dragGroup){var d=G("g");H(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();Z(h,d),p.dragGroup=d}f.forEach(function(y){r.addDragger(y,p.dragGroup)}),l?l=Xi([l,o(u)]):l=o(u),E(l,function(y){t.addMarker(y,Gf)}),p.allDraggedElements=l,p.differentParents=bP(u)}),e.on("shape.move.move",q_,function(c){var p=c.context,u=p.dragGroup,l=p.target,f=p.shape.parent,d=p.canExecute;l&&(d==="attach"?a(l,J_):p.canExecute&&f&&l.id!==f.id?a(l,Q_):a(l,p.canExecute?X_:Z_)),Ie(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var p=c.context,u=p.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var p=c.context,u=p.allDraggedElements,l=p.dragGroup;E(u,function(f){t.removeMarker(f,Gf)}),l&&Ce(l)}),this.makeDraggable=s}Uu.$inject=["eventBus","canvas","styles","previewSupport"];function xP(e){var t=Q(e,function(n){return le(n)?ne(e,bt({id:n.source.id}))&&ne(e,bt({id:n.target.id})):!0});return t}function bP(e){return Jf(Cn(e,function(t){return t.parent&&t.parent.id}))!==1}var ex={__depends__:[Gr,Qe,ua,gt,Ct,bn],__init__:["move","movePreview"],move:["type",Gu],movePreview:["type",Uu]};var nx=".djs-palette-toggle",rx=".entry",EP=nx+", "+rx,Uf="djs-palette-",wP="shown",Kf="open",tx="two-column",SP=1e3;function et(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(r){var i=r.tool;n.updateToolHighlight(i)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}et.$inject=["eventBus","canvas"];et.prototype.registerProvider=function(e,t){t||(t=e,e=SP),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()};et.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(RP,{})};et.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}};et.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),r=this._container=_e(et.HTML_MARKUP);n.appendChild(r),ke(n).add(Uf+wP),ht.bind(r,EP,"click",function(i){var o=i.delegateTarget;if(da(o,nx))return e.toggle();e.trigger("click",i)}),ae.bind(r,"mousedown",function(i){i.stopPropagation()}),ht.bind(r,rx,"dragstart",function(i){e.trigger("dragstart",i)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:r})};et.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers};et.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,r=this._eventBus,i,o=ke(n),a=ke(t);"twoColumn"in e?i=e.twoColumn:i=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(tx,i),a.toggle(Uf+tx,i),"open"in e&&(o.toggle(Kf,e.open),a.toggle(Uf+Kf,e.open)),r.fire("palette.changed",{twoColumn:i,open:this.isOpen()})};et.prototype._update=function(){var e=ve(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Dr(e),E(t,function(n,r){var i=n.group||"default",o=ve("[data-group="+mr(i)+"]",e);o||(o=_e('
    '),Ze(o,"data-group",i),e.appendChild(o));var a=n.html||(n.separator?'
    ':'
    '),s=_e(a);if(o.appendChild(s),!n.separator&&(Ze(s,"data-action",r),n.title&&Ze(s,"title",n.title),n.className&&CP(s,n.className),n.imageUrl)){var c=_e("");Ze(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()};et.prototype.trigger=function(e,t,n){var r,i,o=t.delegateTarget||t.target;return o?(r=Ze(o,"data-action"),i=t.originalEvent||t,this.triggerEntry(r,e,i,n)):t.preventDefault()};et.prototype.triggerEntry=function(e,t,n,r){var i=this._entries,o,a;if(o=i[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(Le(a)){if(t==="click")return a(n,r)}else if(a[t])return a[t](n,r);n.preventDefault()}};et.prototype._layoutChanged=function(){this._toggleState({})};et.prototype._needsCollapse=function(e,t){var n=50,r=Object.keys(t).length*46;return e=n.x&&t.yn.x&&t.y<=n.y?r={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.y?r={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?r={x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:r={x:n.x,y:n.y,width:0,height:0},r}var cx={__depends__:[ri,Jn],__init__:["lassoTool"],lassoTool:["type",or]};var Yf=1500,ux="grab";function si(e,t,n,r,i,o){this._dragging=n,this._mouse=o;var a=this,s=r.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Yf,function(c){if(yr(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Yf,function(c){if(!(!px(c.keyEvent)||a.isActive())){var p=a._mouse.getLastMoveEvent();a.activateMove(p,!!p)}},"keyboard.keydown"),s&&s.addListener(Yf,function(c){!px(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var p=c.originalEvent.target;if(!c.hover&&!(p instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var p=t.viewbox().scale;t.scroll({dx:c.dx*p,dy:c.dy*p})}),e.on("hand.move.end",function(c){var p=c.context,u=p.reactivate;return!yr(c)&&u&&e.once("hand.move.ended",function(l){a.activateHand(l.originalEvent,!0,!0)}),!1})}si.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"];si.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:ux,data:{context:n||{}}})};si.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:ux,data:{context:{reactivate:n}}})};si.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)};si.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function px(e){return Ge("Space",e)}var lx={__depends__:[ri,Jn],__init__:["handTool"],handTool:["type",si]};var fx="connect-ok",dx="connect-not-ok";function ci(e,t,n,r,i,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,i.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var p=c.context,u=c.hover,l=p.canStartConnect=s.canStartConnect(u);l!==null&&(p.startTarget=u,r.addMarker(u,l?fx:dx))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var p=c.context.startTarget,u=c.context.canStartConnect;p&&r.removeMarker(p,u?fx:dx)}),e.on(["global-connect.ended"],function(c){var p=c.context,u=p.startTarget,l={x:c.x,y:c.y},f=s.canStartConnect(u);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,l)}),!1})}ci.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"];ci.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})};ci.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)};ci.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)};ci.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var hx={__depends__:[Po,gt,Ct,ri,Jn],globalConnect:["type",ci]};function Ys(e,t,n,r,i,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=r,this._lassoTool=i,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}Ys.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"];Ys.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,r=this._spaceTool,i=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(l,f,d,h,y){function v(w){var R=n.createShape(S({type:l},y));t.start(w,R)}return{group:f,className:d,title:h,action:{dragstart:v,click:v}}}function p(l){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(l,[f,d],{hints:{autoSelect:[f]}})}function u(l){t.start(l,n.createParticipantShape())}return S(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(l){o.activateHand(l)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(l){i.activateSelection(l)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(l){r.activateSelection(l)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(l){a.start(l)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:p,click:p}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};var mx={__depends__:[ix,ni,_u,cx,lx,hx,zr],__init__:["paletteProvider"],paletteProvider:["type",Ys]};var PP=250;function qs(e,t,n,r,i){k.call(this,e);function o(s){var c=s.canExecute.replacements;E(c,function(p){var u=p.oldElementId,l={type:p.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);S(l,{x:f.x,y:f.y});var d=n.createShape(l);r.addShape(d,f.parent);var h=ve('[data-element-id="'+mr(f.id)+'"]',s.dragGroup);h&&H(h,{display:"none"});var y=i.addDragger(d,s.dragGroup);s.visualReplacements[u]=y,r.removeShape(d)}})}function a(s){var c=s.visualReplacements;E(c,function(p,u){var l=ve('[data-element-id="'+mr(u)+'"]',s.dragGroup);l&&H(l,{display:"inline"}),p.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",PP,function(s){var c=s.context,p=c.canExecute;c.visualReplacements||(c.visualReplacements={}),p&&p.replacements?o(c):a(c)})}qs.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"];N(qs,k);var gx={__depends__:[bn],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",qs]};var TP=1250,qf=40,MP=20,DP=10,vx=20,_x=["x","y"],kP=Math.abs;function Ku(e){e.on(["connect.hover","connect.move","connect.end"],TP,function(t){var n=t.context,r=n.canExecute,i=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&mt(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),r&&o&&NP(t,o,LP(o)),o&&IP(r,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Yt(i),ee(o,["bpmn:Event","bpmn:Gateway"])&&yx(t,Yt(o)),ee(o,["bpmn:Task","bpmn:SubProcess"])&&OP(t,o),m(a,"bpmn:BoundaryEvent")&&s===a.host&&BP(t)):xx(r,"bpmn:MessageFlow")?(m(i,"bpmn:Event")&&(n.connectionStart=Yt(i)),m(o,"bpmn:Event")&&yx(t,Yt(o))):n.connectionStart=n.initialConnectionStart)})}Ku.$inject=["eventBus"];function NP(e,t,n){_x.forEach(function(r){var i=bx(r,t);e[r]t[r]+i-n&&He(e,r,t[r]+i-n)})}function OP(e,t){var n=Yt(t);_x.forEach(function(r){jP(e,t,r)&&He(e,r,n[r])})}function BP(e){var t=e.context,n=t.source,r=t.target;if(!FP(t)){var i=Yt(n),o=je(i,r,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],p;kP(c-i[s])i[s]?p=i[s]+qf:p=i[s]-qf,He(e,s,p))})}}function yx(e,t){He(e,"x",t.x),He(e,"y",t.y)}function xx(e,t){return e&&e.type===t}function IP(e,t){return It(t,function(n){return xx(e,n)})}function bx(e,t){return e==="x"?t.width:t.height}function LP(e){return m(e,"bpmn:Task")?DP:MP}function jP(e,t,n){return e[n]>t[n]+vx&&e[n]=e.x||i&&i<=e.x)&&He(e,"x",e.x),(r&&r>=e.y||o&&o<=e.y)&&He(e,"y",e.y)}}function wx(e,t){return e.indexOf(t)!==-1}function Sx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var UP=1250;function qi(e,t){var n=this;e.on(["resize.start"],function(r){n.initSnap(r)}),e.on(["resize.move","resize.end"],UP,function(r){var i=r.context,o=i.shape,a=o.parent,s=i.direction,c=i.snapContext;if(!(r.originalEvent&&mt(r.originalEvent))&&!kn(r)){var p=c.pointsForTarget(a);p.initialized||(p=n.addSnapTargetPoints(p,o,a,s),p.initialized=!0),qP(s)&&He(r,"x",r.x),XP(s)&&He(r,"y",r.y),t.snap(r,p)}}),e.on(["resize.cleanup"],function(){t.hide()})}qi.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||(i=t.snapContext=new jn);var o=Cx(n,r);return i.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),i};qi.prototype.addSnapTargetPoints=function(e,t,n,r){var i=this.getSnapTargets(t,n);return E(i,function(o){e.add("corner",Ap(o)),e.add("corner",Rp(o))}),e.add("corner",Cx(t,r)),e};qi.$inject=["eventBus","snapping"];qi.prototype.getSnapTargets=function(e,t){return Pp(t).filter(function(n){return!KP(n,e)&&!le(n)&&!YP(n)&&!J(n)})};function Cx(e,t){var n=q(e),r=X(e),i={x:n.x,y:n.y};return t.indexOf("n")!==-1?i.y=r.top:t.indexOf("s")!==-1&&(i.y=r.bottom),t.indexOf("e")!==-1?i.x=r.right:t.indexOf("w")!==-1&&(i.x=r.left),i}function KP(e,t){return e.host===t}function YP(e){return!!e.hidden}function qP(e){return e==="n"||e==="s"}function XP(e){return e==="e"||e==="w"}var ZP=7,QP=1e3;function ar(e){this._canvas=e,this._asyncHide=ec(nt(this.hide,this),QP)}ar.$inject=["canvas"];ar.prototype.snap=function(e,t){var n=e.context,r=n.snapContext,i=r.getSnapLocations(),o={x:kn(e,"x"),y:kn(e,"y")};E(i,function(a){var s=r.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(E(["x","y"],function(p){var u;o[p]||(u=t.snap(c,a,p,ZP),u!==void 0&&(o[p]={value:u,originValue:u-s[p]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),E(["x","y"],function(a){var s=o[a];Pe(s)&&He(e,a,s.originValue)})};ar.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=G("path");return H(n,{d:"M0,0 L0,0"}),ce(n).add("djs-snap-line"),Z(t,n),{update:function(r){te(r)?e==="horizontal"?H(n,{d:"M-100000,"+r+" L+100000,"+r,display:""}):H(n,{d:"M "+r+",-100000 L "+r+", +100000",display:""}):H(n,{display:"none"})}}};ar.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}};ar.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()};ar.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]};ar.prototype.hide=function(){E(this._snapLines,function(e){e.update()})};var Rx={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ln],resizeSnapping:["type",qi],snapping:["type",ar]};var Ax={__depends__:[Rx],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Ku],createMoveSnapping:["type",pi]};var Tx=300;function ue(e,t,n,r){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=r,this._container=this._getBoxHtml(),this._searchInput=ve(ue.INPUT_SELECTOR,this._container),this._resultsContainer=ve(ue.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}ue.$inject=["canvas","eventBus","selection","translate"];ue.prototype._bindEvents=function(){var e=this;function t(n,r,i,o){e._eventMaps.push({el:n,type:i,listener:ht.bind(n,r,i,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,ue.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,ue.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,ue.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,ue.INPUT_SELECTOR,"keydown",function(n){Ge("ArrowUp",n)&&n.preventDefault(),Ge("ArrowDown",n)&&n.preventDefault()}),t(this._container,ue.INPUT_SELECTOR,"keyup",function(n){if(Ge("Escape",n))return e.close();if(Ge("Enter",n)){var r=e._getCurrentResult();return r?e._select(r):e.close(!1)}if(Ge("ArrowUp",n))return e._scrollToDirection(!0);if(Ge("ArrowDown",n))return e._scrollToDirection();Ge(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})};ue.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ht.unbind(e.el,e.type,e.listener)})};ue.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(i){return!t._canvas.getRootElements().includes(i.element)}),!n.length){this._selection.select(null);return}n.forEach(function(i){var o=i.element.id,a=t._createResultNode(i,o);t._results[o]={element:i.element,node:a}});var r=ve(ue.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}};ue.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}};ue.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,r=t-this._resultsContainer.clientHeight+e.clientHeight;t0&&Px(n,e.primaryTokens,ue.RESULT_PRIMARY_HTML),Px(n,e.secondaryTokens,ue.RESULT_SECONDARY_HTML),Ze(n,ue.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n};ue.prototype.registerProvider=function(e){this._searchProvider=e};ue.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,ke(this._canvas.getContainer()).add("djs-search-open"),ke(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))};ue.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,ke(this._canvas.getContainer()).remove("djs-search-open"),ke(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())};ue.prototype.toggle=function(){this.isOpen()?this.close():this.open()};ue.prototype.isOpen=function(){return this._open};ue.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&ke(t).remove(ue.RESULT_SELECTED_CLASS);var n=Ze(e,ue.RESULT_ID_ATTRIBUTE),r=this._results[n].element;ke(e).add(ue.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(r,{top:Tx}),this._selection.select(r),this._eventBus.fire("searchPad.preselected",r)}};ue.prototype._select=function(e){var t=Ze(e,ue.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Tx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)};ue.prototype._getBoxHtml=function(){let e=_e(ue.BOX_HTML),t=ve(ue.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Px(e,t,n){var r=JP(t),i=_e(n);i.innerHTML=r,e.appendChild(i)}function JP(e){var t="";return e.forEach(function(n){var r=Ac(n.value||n.matched||n.normal),i=n.match||n.matched;i?t+=''+r+"":t+=r}),t!==""?t:null}ue.CONTAINER_SELECTOR=".djs-search-container";ue.INPUT_SELECTOR=".djs-search-input input";ue.RESULTS_CONTAINER_SELECTOR=".djs-search-results";ue.RESULT_SELECTOR=".djs-search-result";ue.RESULT_SELECTED_CLASS="djs-search-result-selected";ue.RESULT_SELECTED_SELECTOR="."+ue.RESULT_SELECTED_CLASS;ue.RESULT_ID_ATTRIBUTE="data-result-id";ue.RESULT_HIGHLIGHT_CLASS="djs-search-highlight";ue.BOX_HTML=`
    `;ue.RESULT_HTML='
    ';ue.RESULT_PRIMARY_HTML='
    ';ue.RESULT_SECONDARY_HTML='

    ';var Mx={__depends__:[zr,Vr,Qe],searchPad:["type",ue]};function Xs(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._search=r,t.registerProvider(this)}Xs.$inject=["elementRegistry","searchPad","canvas","search"];Xs.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(r){return!J(r)&&!t.includes(r)});return this._search(n.map(r=>({element:r,label:pt(r),id:r.id})),e,{keys:["label","id"]}).map(eT)};function eT(e){let{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}var Dx={__depends__:[Mx,sp],__init__:["bpmnSearch"],bpmnSearch:["type",Xs]};var kx="M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z",Nx="M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",Ox={width:36,height:50},Bx={width:50,height:50};function Xf(e,t,n){return G("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}var wn=5;function la(e,t){this._styles=t,e.registerProvider(this)}la.$inject=["outline","styles"];la.prototype.getOutline=function(e){let t=this._styles.cls("djs-outline",["no-fill"]);var n;if(Sh(e))return n=G("rect"),H(n,S({x:-wn,y:-wn,rx:4,width:e.width+wn*2,height:e.height+wn*2},t)),n;if(!J(e))return m(e,"bpmn:Gateway")?(n=G("rect"),S(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),H(n,S({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):ee(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=G("rect"),H(n,S({x:-wn,y:-wn,rx:14,width:e.width+wn*2,height:e.height+wn*2},t))):m(e,"bpmn:EndEvent")?(n=G("circle"),H(n,S({cx:e.width/2,cy:e.height/2,r:e.width/2+wn+1},t))):m(e,"bpmn:Event")?(n=G("circle"),H(n,S({cx:e.width/2,cy:e.height/2,r:e.width/2+wn},t))):m(e,"bpmn:DataObjectReference")&&Ix(e,"bpmn:DataObjectReference")?n=Xf(kx,{x:-6,y:-6},t):m(e,"bpmn:DataStoreReference")&&Ix(e,"bpmn:DataStoreReference")&&(n=Xf(Nx,{x:-6,y:-6},t)),n};la.prototype.updateOutline=function(e,t){if(!J(e))return ee(e,["bpmn:SubProcess","bpmn:Group"])?(H(t,{width:e.width+wn*2,height:e.height+wn*2}),!0):!!ee(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Ix(e,t){var n;return t==="bpmn:DataObjectReference"?n=Ox:t==="bpmn:DataStoreReference"&&(n=Bx),e.width===n.width&&e.height===n.height}var Lx={__depends__:[ua],__init__:["outlineProvider"],outlineProvider:["type",la]};var tT='';function Wt(e){vi.call(this,e)}N(Wt,vi);Wt.Viewer=cn;Wt.NavigatedViewer=xr;Wt.prototype.createDiagram=function(){return this.importXML(tT)};Wt.prototype._interactionModules=[Hc,Wc,Gc];Wt.prototype._modelingModules=[Xm,So,ig,eg,wg,Po,Rg,m_,uu,ni,y_,b_,A_,T_,M_,B_,z_,G_,Cu,Y_,ex,mx,gx,ju,Ax,Dx,Lx];Wt.prototype._modules=[].concat(cn.prototype._modules,Wt.prototype._interactionModules,Wt.prototype._modelingModules);var nT=globalThis;Object.assign(Wt,{Modeler:Wt,NavigatedViewer:xr,Viewer:cn});nT.BpmnJS=Wt;var TX=Wt;})();