/*! bpmn-js - 18.14.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 Nx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yu={exports:{}},Zf;function Bx(){if(Zf)return Yu.exports;Zf=1;var e=Yu.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},Yu.exports}var Ix=Bx(),Lx=Nx(Ix);function dn(e){if(!(this instanceof dn))return new dn(e);e=e||[128,36,1],this._seed=e.length?Lx.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 Ui(e){return Array.prototype.concat.apply([],e)}var ca=Object.prototype.toString,jx=Object.prototype.hasOwnProperty;function Ln(e){return e===void 0}function Ge(e){return e!==void 0}function Rr(e){return e==null}function U(e){return ca.call(e)==="[object Array]"}function Ce(e){return ca.call(e)==="[object Object]"}function ee(e){return ca.call(e)==="[object Number]"}function Ne(e){let t=ca.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function et(e){return ca.call(e)==="[object String]"}function Fx(e){if(!U(e))throw new Error("must supply array")}function tt(e,t){return!Rr(e)&&jx.call(e,t)}function ne(e,t){let n=Ys(t),r;return E(e,function(i,o){if(n(i,o))return r=i,!1}),r}function Ks(e,t){let n=Ys(t),r=U(e)?-1:void 0;return E(e,function(i,o){if(n(i,o))return r=o,!1}),r}function J(e,t){let n=Ys(t),r=[];return E(e,function(i,o){n(i,o)&&r.push(i)}),r}function E(e,t){let n,r;if(Ln(e))return;let i=U(e)?$x:Hx;for(let o in e)if(tt(e,o)&&(n=e[o],r=t(n,i(o)),r===!1))return n}function Qf(e,t){if(Ln(e))return[];Fx(e);let n=Ys(t);return e.filter(function(r,i){return!n(r,i)})}function Ke(e,t,n){return E(e,function(r,i){n=t(n,r,i)}),n}function hn(e,t){return!!Ke(e,function(n,r,i){return n&&t(r,i)},!0)}function Nt(e,t){return!!ne(e,t)}function He(e,t){let n=[];return E(e,function(r,i){n.push(t(r,i))}),n}function Ki(e){return e&&Object.keys(e)||[]}function Jf(e){return Ki(e).length}function Pr(e){return He(e,t=>t)}function wn(e,t,n={}){return t=Xu(t),E(e,function(r){let i=t(r)||"_",o=n[i];o||(o=n[i]=[]),o.push(r)}),n}function qu(e,...t){e=Xu(e);let n={};return E(t,i=>wn(i,e,n)),He(n,function(i,o){return i[0]})}var ed=qu;function St(e,t){t=Xu(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 yt(e){return function(t){return hn(e,function(n,r){return t[r]===n})}}function Xu(e){return Ne(e)?e:t=>t[e]}function Ys(e){return Ne(e)?e:t=>t===e}function Hx(e){return e}function $x(e){return Number(e)}function qs(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 Je(e,t){return e.bind(t)}function C(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];Ge(a)&&Rr(s)&&(s=r[i]=isNaN(+a)?{}:[]),Ln(a)?Ln(n)?delete r[i]:r[i]=n:r=s}),e}function pt(e,t){let n={},r=Object(e);return E(t,function(i){i in r&&(n[i]=e[i])}),n}function At(e,t){let n={},r=Object(e);return E(r,function(i,o){t.indexOf(o)===-1&&(n[o]=i)}),n}var ot={legend:[1,"
","
"],tr:[2,"","
"],col:[2,"","
"],_default:[0,"",""]};ot.td=ot.th=[3,"","
"];ot.option=ot.optgroup=[1,'"];ot.thead=ot.tbody=ot.colgroup=ot.caption=ot.tfoot=[1,"","
"];ot.polyline=ot.ellipse=ot.polygon=ot.circle=ot.text=ot.line=ot.path=ot.rect=ot.g=[1,'',""];function ye(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(ot,r)?ot[r]:ot._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 zx(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 at(e,...t){let n=e.style;return E(t,function(r){r&&E(r,function(i,o){n[o]=i})}),e}function Ye(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}var Vx=Object.prototype.toString;function Ae(e){return new Ar(e)}function Ar(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ar.prototype.add=function(e){return this.list.add(e),this};Ar.prototype.remove=function(e){return Vx.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)};Ar.prototype.removeMatching=function(e){let t=this.array();for(let n=0;n"+e+"",t=!0);var n=Jx(e);if(!t)return n;for(var r=document.createDocumentFragment(),i=n.firstChild;i.firstChild;)r.appendChild(i.firstChild);return r}function Jx(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(nl.svg,e),t&&$(n,t),n}var Zu=null;function el(){return Zu===null&&(Zu=G("svg")),Zu}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=el().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 Yi(e){return e?el().createSVGTransformFromMatrix(e):el().createSVGTransform()}var sd=/([&<>]{1})/g,eb=/([&<>\n\r"]{1})/g,tb={"&":"&","<":"<",">":">",'"':"'"};function Qu(e,t){function n(r,i){return tb[i]||i}return e.replace(t,n)}function dd(e,t){var n,r,i,o,a;switch(e.nodeType){case 3:t.push(Qu(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 nb(e,t){var n=ld(t);if(or(e),!!t){ib(n)||(n=n.documentElement);for(var r=ob(n.childNodes),i=0;i{let i=r.match(fb);return(i&&i[1]||r).trim()})||[]}function al(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 S=b.split("."),A=c(S.shift());for(;S.length;)A=A[S.shift()];return A}if(il(o,b))return o[b];if(il(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(ol(b))b=Qs(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);let A=(b.$inject||db(b)).map(O=>il(x,O)?x[O]:c(O));return{fn:b,dependencies:A}}function u(b){let{fn:x,dependencies:S}=p(b),A=Function.prototype.bind.call(x,null,...S);return new A}function l(b,x,S){let{fn:A,dependencies:O}=p(b,S);return A.apply(x,O)}function f(b){return Qs(x=>b.get(x))}function d(b,x){if(x&&x.length){let S=Object.create(null),A=Object.create(null),O=[],M=[],B=[],I,H,z,K;for(let ce in i)I=i[ce],x.indexOf(ce)!==-1&&(I[2]==="private"?(H=O.indexOf(I[3]),H===-1?(z=I[3].createChild([],x),K=f(z),O.push(I[3]),M.push(z),B.push(K),S[ce]=[K,ce,"private",z]):S[ce]=[B[H],ce,"private",M[H]]):S[ce]=[I[2],I[1]],A[ce]=!0),(I[2]==="factory"||I[2]==="type")&&I[1].$scope&&x.forEach(ln=>{I[1].$scope.indexOf(ln)!==-1&&(S[ce]=[I[2],I[1]],A[ln]=!0)});x.forEach(ce=>{if(!A[ce])throw new Error('No provider for "'+ce+'". Cannot use provider from the parent!')}),b.unshift(S)}return new al(b,a)}let h={factory:l,type:u,value:function(b){return b}};function _(b,x){let S=b.__init__||[];return function(){S.forEach(A=>{typeof A=="string"?x.get(A):x.invoke(A)})}}function v(b){let x=b.__exports__;if(x){let S=b.__modules__,A=Object.keys(b).reduce((H,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(H[z]=b[z]),H),Object.create(null)),O=(S||[]).concat(A),M=d(O),B=Qs(function(H){return M.get(H)});x.forEach(function(H){i[H]=[B,H,"private",M]});let I=(b.__init__||[]).slice();return I.unshift(function(){M.init()}),b=Object.assign({},b,{__init__:I}),_(b,M)}return Object.keys(b).forEach(function(S){if(S==="__init__"||S==="__depends__")return;let A=b[S];if(A[2]==="private"){i[S]=A;return}let O=A[0],M=A[1];i[S]=[h[O],hb(O,M),O]}),_(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 P(b){let x=b.reduce(w,[]).map(v),S=!1;return function(){S||(S=!0,x.forEach(A=>A()))}}this.get=c,this.invoke=l,this.instantiate=u,this.createChild=d,this.init=P(e)}function hb(e,t){return e!=="value"&&ol(t)&&(t=Qs(t.slice())),t}var mb=1e3;function mn(e,t){var n=this;t=t||mb,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 ar(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function gb(e){return["M",e.x,e.y]}function sl(e){return["L",e.x,e.y]}function vb(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function yb(e,t){let n=e.length,r=[gb(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 ec(e,t){var n={};return E(e,function(r){var i=r;i.waypoints&&(i=Ee(i)),!ee(t.y)&&i.x>t.x&&(n[r.id]=r),!ee(t.x)&&i.y>t.y&&(n[r.id]=r),i.x>t.x&&i.y>t.y&&(ee(t.width)&&ee(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 Ab(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(wb,function(r,i,o){var a=[],s=i.toLowerCase();for(o.replace(Sb,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=fl,n}function Tb(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 kb(e,t){return e=ll(e),t=ll(t),Nr(t,e.x,e.y)||Nr(t,e.x2,e.y)||Nr(t,e.x,e.y2)||Nr(t,e.x2,e.y2)||Nr(e,t.x,t.y)||Nr(e,t.x2,t.y)||Nr(e,t.x,t.y2)||Nr(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;hzn(i,a)||zn(t,r)<$n(o,s)||$n(t,r)>zn(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=ic(c/u),f=ic(p/u),d=+l.toFixed(2),h=+f.toFixed(2);if(!(d<+$n(e,n).toFixed(2)||d>+zn(e,n).toFixed(2)||d<+$n(i,a).toFixed(2)||d>+zn(i,a).toFixed(2)||h<+$n(t,r).toFixed(2)||h>+zn(t,r).toFixed(2)||h<+$n(o,s).toFixed(2)||h>+zn(o,s).toFixed(2)))return{x:l,y:f}}}}function ic(e){return Math.round(e*1e11)/1e11}function Nb(e,t,n){var r=Ed(e),i=Ed(t);if(!kb(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&&M<=1&&B>=0&&B<=1&&(n?f++:f.push({x:A.x,y:A.y,t1:M,t2:B}))}}return f}function da(e,t,n){e=Pd(e),t=Pd(t);for(var r,i,o,a,s,c,p,u,l,f,d=n?0:[],h=0,_=e.length;h<_;h++){var v=e[h];if(v[0]=="M")r=s=v[1],i=c=v[2];else{v[0]=="C"?(l=[r,i,...v.slice(1)],r=l[6],i=l[7]):(l=[r,i,r,i,s,c,s,c],r=s,i=c);for(var w=0,P=t.length;w1&&(w=nt.sqrt(w),n=w*n,r=w*r);var P=n*n,b=r*r,x=(o==a?-1:1)*nt.sqrt(Br((P*b-P*v*v-b*_*_)/(P*v*v+b*_*_))),S=x*n*v/r+(e+s)/2,A=x*-r*_/n+(t+c)/2,O=nt.asin(((t-A)/r).toFixed(9)),M=nt.asin(((c-A)/r).toFixed(9));O=eM&&(O=O-Or*2),!a&&M>O&&(M=M-Or*2)}var B=M-O;if(Br(B)>u){var I=M,H=s,z=c;M=O+u*(a&&M>O?1:-1),s=S+n*nt.cos(M),c=A+r*nt.sin(M),f=Ad(s,c,n,r,i,0,a,H,z,[M,I,S,A])}B=M-O;var K=nt.cos(O),ce=nt.sin(O),ln=nt.cos(M),De=nt.sin(M),ge=nt.tan(B/4),Vt=4/3*n*ge,Wt=4/3*r*ge,We=[e,t],ht=[e+Vt*ce,t-Wt*K],F=[s+Vt*De,c-Wt*ln],V=[s,c];if(ht[0]=2*We[0]-ht[0],ht[1]=2*We[1]-ht[1],p)return[ht,F,V].concat(f);f=[ht,F,V].concat(f).join().split(",");for(var re=[],_e=0,Ot=f.length;_e7){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 Ir(e,t,n){var r=Hb(e,t);return r.length===1||r.length===2&&kr(r[0],r[1])<1?gn(r[0]):r.length>1?(r=St(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 Hb(e,t){return da(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],kr(n,i)===0||Xi(r,i,n)?e.splice(t,1):t++;return e}function $b(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ac(e,t){return Math.round(e*t)/t}function Md(e){return ee(e)?e+"px":e}function zb(e){for(;e.parent;)e=e.parent;return e}function Vb(e){e=C({},{width:"100%",height:"100%"},e);let t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),at(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");ue(r).add(t);let i=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(r,e.childNodes[i]||null),r}var Wb="base",kd=0,Gb=1,Ub={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=Vb(e),r=this._svg=G("svg");$(r,{width:"100%",height:"100%"}),Ye(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=qs(Je(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=tc(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(Wb,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 Ke(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)};pe.prototype._createLayer=function(e,t){typeof t=="undefined"&&(t=Gb);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&&(be(n),t.visible=!1),n};pe.prototype._removeLayer=function(e){let t=this._layers[e];t&&(delete this._layers[e],be(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(zb(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),ue(i).add(t)):(e.markers.delete(t),ue(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=Ub[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){we(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),Te(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);pi(t,u)});else return o=this._rootElement?this.getActiveLayer():null,r=o&&o.getBBox()||{},a=pi(t),i=a?a.matrix:fd(),s=ac(i.a,1e3),c=ac(-i.e||0,1e3),p=ac(-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=C({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Od(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=Ee(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=C(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),Od(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 Zi="data-element-id";function It(e){this._elements={},this._eventBus=e}It.$inject=["eventBus"];It.prototype.add=function(e,t,n){var r=e.id;this._validateId(r),$(t,Zi,r),n&&$(n,Zi,r),this._elements[r]={element:e,gfx:t,secondaryGfx:n}};It.prototype.remove=function(e){var t=this._elements,n=e.id||e,r=n&&t[n];r&&($(r.gfx,Zi,""),r.secondaryGfx&&$(r.secondaryGfx,Zi,""),delete t[n])};It.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)};It.prototype.updateGraphics=function(e,t,n){var r=e.id||e,i=this._elements[r];return n?i.secondaryGfx=t:i.gfx=t,t&&$(t,Zi,r),t};It.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&$(e,Zi);var n=this._elements[t];return n&&n.element};It.prototype.filter=function(e){var t=[];return this.forEach(function(n,r){e(n,r)&&t.push(n)}),t};It.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),r=0;r in ref");t=this.props[t]}t.collection?Nd(this,t,e):Xb(this,t,e)};en.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return Yb(n)||Nd(this,t,e),n};en.prototype.ensureBound=function(e,t){qb(e,t)||this.bind(e,t)};en.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)};en.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var dl=new en({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Id=new en({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Bd=new en({name:"attachers",collection:!0},{name:"host"}),Ld=new en({name:"outgoing",collection:!0},{name:"source"}),jd=new en({name:"incoming",collection:!0},{name:"target"});function Qi(){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)}}),dl.bind(this,"parent"),Id.bind(this,"labels"),Ld.bind(this,"outgoing"),jd.bind(this,"incoming")}function ha(){Qi.call(this),dl.bind(this,"children"),Bd.bind(this,"host"),Bd.bind(this,"attachers")}N(ha,Qi);function Fd(){Qi.call(this),dl.bind(this,"children")}N(Fd,ha);function Hd(){ha.call(this),Id.bind(this,"labelTarget")}N(Hd,ha);function $d(){Qi.call(this),Ld.bind(this,"source"),jd.bind(this,"target")}N($d,Qi);var Zb={connection:$d,shape:ha,label:Hd,root:Fd};function zd(e,t){var n=Zb[e];if(!n)throw new Error("unknown type: <"+e+">");return C(new n,t)}function Vd(e){return e instanceof Qi}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=C({},t||{}),t.id||(t.id=e+"_"+this._uid++),zd(e,t)};var sc="__fn",Wd=1e3,Qb=Array.prototype.slice;function Tt(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Tt.prototype.on=function(e,t,n,r){if(e=U(e)?e:[e],Ne(t)&&(r=n,n=t,t=Wd),!ee(t))throw new Error("priority must be a number");var i=n;r&&(i=Je(n,r),i[sc]=n[sc]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:i,next:null})})};Tt.prototype.once=function(e,t,n,r){var i=this;if(Ne(t)&&(r=n,n=t,t=Wd),!ee(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[sc]=n,this.on(e,t,o)};Tt.prototype.off=function(e,t){e=U(e)?e:[e];var n=this;e.forEach(function(r){n._removeListener(r,t)})};Tt.prototype.createEvent=function(e){var t=new ma;return t.init(e),t};Tt.prototype.fire=function(e,t){var n,r,i,o;if(o=Qb.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 ma?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}};Tt.prototype.handleError=function(e){return this.fire("error",{error:e})===!1};Tt.prototype._destroy=function(){this._listeners={}};Tt.prototype._invokeListeners=function(e,t,n){for(var r;n&&!e.cancelBubble;)r=this._invokeListener(e,t,n),n=n.next;return r};Tt.prototype._invokeListener=function(e,t,n){var r;if(n.callback.__isTomb)return r;try{r=Jb(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};Tt.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 tn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}tn.prototype.build=function(){return pt(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])};tn.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)};tn.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};tn.prototype.redefineProperty=function(e,t,n){var r=e.ns.prefix,i=t.split("#"),o=_t(i[0],r),a=_t(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};tn.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};tn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]};tn.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};tn.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};tn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)};tn.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")};tn.prototype.hasProperty=function(e){return this.propertiesByName[e]};tn.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,Je(function(o){o=C({},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 Lr(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,E(e,Je(this.registerPackage,this))}Lr.prototype.getPackage=function(e){return this.packageMap[e]};Lr.prototype.getPackages=function(){return this.packages};Lr.prototype.registerPackage=function(e){e=C({},e);var t=this.packageMap;Yd(t,e,"prefix"),Yd(t,e,"uri"),E(e.types,Je(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)};Lr.prototype.registerType=function(e,t){e=C({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:C(e.meta||{})});var n=_t(e.name,t.prefix),r=n.name,i={};E(e.properties,Je(function(o){var a=_t(o.name,n.prefix),s=a.name;hl(o.type)||(o.type=_t(o.type,a.prefix).name),C(o,{ns:a,name:s}),i[s]=o},this)),C(e,{ns:n,name:r,propertiesByName:i}),E(e.extends,Je(function(o){var a=_t(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};Lr.prototype.mapTypes=function(e,t,n){var r=hl(e.name)?{name:e.name}:this.typeMap[e.name],i=this;function o(c,p){var u=_t(c,hl(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)};Lr.prototype.getEffectiveDescriptor=function(e){var t=_t(e),n=new tn(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};Lr.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 li(e){this.model=e}li.prototype.set=function(e,t,n){if(!et(t)||!t.length)throw new TypeError("property name must be a non-empty string");var r=this.getProperty(e,t),i=r&&r.name;rE(n)?r?delete e[i]:delete e.$attrs[ml(t)]:r?i in e?e[i]=n:Zd(e,r,n):e.$attrs[ml(t)]=n};li.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[ml(t)];var r=n.name;return!e[r]&&n.isMany&&Zd(e,n,[]),e[r]};li.prototype.define=function(e,t,n){if(!n.writable){var r=n.value;n=C({},n,{get:function(){return r}}),delete n.value}Object.defineProperty(e,t,n)};li.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})};li.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})};li.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 rE(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 ml(e){return e.replace(/^:/,"")}function Ut(e,t={}){this.properties=new li(this),this.factory=new qd(this,this.properties),this.registry=new Lr(e,this.properties),this.typeCache={},this.config=t}Ut.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)};Ut.prototype.getType=function(e){var t=this.typeCache,n=et(e)?e:e.ns.name,r=t[n];return r||(e=this.registry.getEffectiveDescriptor(n),r=t[n]=this.factory.createType(e)),r};Ut.prototype.createAny=function(e,t,n){var r=_t(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){Ce(a)&&a.value!==void 0?i[a.name]=a.value:i[s]=a}),i};Ut.prototype.getPackage=function(e){return this.registry.getPackage(e)};Ut.prototype.getPackages=function(){return this.registry.getPackages()};Ut.prototype.getElementDescriptor=function(e){return e.$descriptor};Ut.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName};Ut.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]};Ut.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Qd=String.fromCharCode,iE=Object.prototype.hasOwnProperty,oE=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ga={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ga).forEach(function(e){ga[e.toUpperCase()]=ga[e]});function aE(e,t,n,r){return r?iE.call(ga,r)?ga[r]:"&"+r+";":Qd(t||parseInt(n,16))}function fi(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(oE,aE):e}var Jd="non-whitespace outside of root node";function eo(e){return new Error(e)}function eh(e){return"missing namespace for prefix <"+e+">"}function uc(e){return{get:e,enumerable:!0}}function sE(e){var t={},n;for(n in e)t[n]=e[n];return t}function yl(e){return e+"$uri"}function cE(e){var t={},n,r;for(n in e)r=e[n],t[r]=r,t[yl(r)]=n;return t}function th(){return{line:0,column:0}}function pE(e){throw e}function _l(e){if(!this)return new _l(e);var t=e&&e.proxy,n,r,i,o,a=pE,s,c,p,u,l=th,f=!1,d=!1,h=null,_=!1,v;function w(x){x instanceof Error||(x=eo(x)),h=x,a(x,l)}function P(x){s&&(x instanceof Error||(x=eo(x)),s(x,l))}this.on=function(x,S){if(typeof S!="function")throw eo("required args ");switch(x){case"openTag":r=S;break;case"text":n=S;break;case"closeTag":i=S;break;case"error":a=S;break;case"warn":s=S;break;case"cdata":o=S;break;case"attention":u=S;break;case"question":p=S;break;case"comment":c=S;break;default:throw eo("unsupported event: "+x)}return this},this.ns=function(x){if(typeof x=="undefined"&&(x={}),typeof x!="object")throw eo("required args ");var S={},A;for(A in x)S[A]=x[A];return d=!0,v=S,this},this.parse=function(x){if(typeof x!="string")throw eo("required args ");return h=null,b(x),l=th,_=!1,h},this.stop=function(){_=!0};function b(x){var S=d?[]:null,A=d?cE(v):null,O,M=[],B=0,I=!1,H=!1,z=0,K=0,ce,ln,De,ge,Vt,Wt,We,ht,F,V="",re=0,_e;function Ot(){if(_e!==null)return _e;var y,g,T,D=d&&A.xmlns,j=d&&f?[]:null,W=re,oe=V,ve=oe.length,it,Qe,mt,fn,Me,ir={},Us={},Jt,de,Se;e:for(;W8)){for((de<65||de>122||de>90&&de<97)&&de!==95&&de!==58&&(P("illegal first char attribute name"),Jt=!0),Se=W+1;Se96&&de<123||de>64&&de<91||de>47&&de<59||de===46||de===45||de===95)){if(de===32||de<14&&de>8){P("missing attribute value"),W=Se;continue e}if(de===61)break;P("illegal attribute name char"),Jt=!0}if(Me=oe.substring(W,Se),Me==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),Jt=!0),de=oe.charCodeAt(Se+1),de===34)Se=oe.indexOf('"',W=Se+2),Se===-1&&(Se=oe.indexOf("'",W),Se!==-1&&(P("attribute value quote missmatch"),Jt=!0));else if(de===39)Se=oe.indexOf("'",W=Se+2),Se===-1&&(Se=oe.indexOf('"',W),Se!==-1&&(P("attribute value quote missmatch"),Jt=!0));else for(P("missing attribute value quotes"),Jt=!0,Se=Se+1;Se8));Se++);for(Se===-1&&(P("missing closing quotes"),Se=ve,Jt=!0),Jt||(mt=oe.substring(W,Se)),W=Se;Se+18));Se++)W===Se&&(P("illegal character after attribute end"),Jt=!0);if(W=Se+1,Jt)continue e;if(Me in Us){P("attribute <"+Me+"> already defined");continue}if(Us[Me]=!0,!d){ir[Me]=mt;continue}if(f){if(Qe=Me==="xmlns"?"xmlns":Me.charCodeAt(0)===120&&Me.substr(0,6)==="xmlns:"?Me.substr(6):null,Qe!==null){if(y=fi(mt),g=yl(Qe),fn=v[y],!fn){if(Qe==="xmlns"||g in A&&A[g]!==y)do fn="ns"+B++;while(typeof A[fn]!="undefined");else fn=Qe;v[y]=fn}A[Qe]!==fn&&(it||(A=sE(A),it=!0),A[Qe]=fn,Qe==="xmlns"&&(A[yl(fn)]=y,D=fn),A[g]=y),ir[Me]=mt;continue}j.push(Me,mt);continue}if(de=Me.indexOf(":"),de===-1){ir[Me]=mt;continue}if(!(T=A[Me.substring(0,de)])){P(eh(Me.substring(0,de)));continue}Me=D===T?Me.substr(de+1):T+Me.substr(de),ir[Me]=mt}if(f)for(W=0,ve=j.length;W=D&&(W=y.exec(x),!(!W||(j=W[0].length+W.index,j>z)));)g+=1,D=j;return z==-1?(T=j,oe=x.substring(K)):K===0?oe=x.substring(K,z):(T=z-D,oe=K==-1?x.substring(z):x.substring(z,K+1)),{data:oe,line:g,column:T}}for(l=R,t&&(F=Object.create({},{name:uc(function(){return We}),originalName:uc(function(){return ht}),attrs:uc(Ot),ns:uc(function(){return A})}));K!==-1;){if(x.charCodeAt(K)===60?z=K:z=x.indexOf("<",K),z===-1){if(M.length)return w("unexpected end of file");if(K===0)return w("missing start tag");K",z),K===-1)return w("unclosed cdata");if(o&&(o(x.substring(z+9,K),l),_))return;K+=3;continue}if(De===45&&x.charCodeAt(z+3)===45){if(K=x.indexOf("-->",z),K===-1)return w("unclosed comment");if(c&&(c(x.substring(z+4,K),fi,l),_))return;K+=3;continue}}if(ge===63){if(K=x.indexOf("?>",z),K===-1)return w("unclosed question");if(p&&(p(x.substring(z,K+2),l),_))return;K+=2;continue}for(ce=z+1;;ce++){if(Vt=x.charCodeAt(ce),isNaN(Vt))return K=-1,w("unclosed tag");if(Vt===34)De=x.indexOf('"',ce+1),ce=De!==-1?De:ce;else if(Vt===39)De=x.indexOf("'",ce+1),ce=De!==-1?De:ce;else if(Vt===62){K=ce;break}}if(ge===33){if(u&&(u(x.substring(z,K+1),fi,l),_))return;K+=1;continue}if(_e={},ge===47){if(I=!1,H=!0,!M.length)return w("missing open tag");if(ce=We=M.pop(),De=z+2+ce.length,x.substring(z+2,De)!==ce)return w("closing tag mismatch");for(;De8&&ge<14))return w("close tag")}else{if(x.charCodeAt(K-1)===47?(ce=We=x.substring(z+1,K-1),I=!0,H=!0):(ce=We=x.substring(z+1,K),I=!0,H=!1),!(ge>96&&ge<123||ge>64&&ge<91||ge===95||ge===58))return w("illegal first char nodeName");for(De=1,ln=ce.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){We=ce.substring(0,De),_e=null;break}return w("invalid nodeName")}H||M.push(We)}if(d){if(O=A,I&&(H||S.push(O),_e===null&&(f=ce.indexOf("xmlns",De)!==-1)&&(re=De,V=ce,Ot(),f=!1)),ht=We,ge=We.indexOf(":"),ge!==-1){if(Wt=A[We.substring(0,ge)],!Wt)return w("missing namespace on <"+ht+">");We=We.substr(ge+1)}else Wt=A.xmlns;Wt&&(We=Wt+":"+We)}if(I&&(re=De,V=ce,r&&(t?r(F,fi,H,l):r(We,Ot,fi,H,l),_)))return;if(H){if(i&&(i(t?F:We,fi,I,l),_))return;d&&(I?A=O:A=S.pop())}K+=1}}}function nh(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var xl={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 uE(e){let t=ih(e);return t!==rh&&(t||null)}function lE(e){return e.charAt(0).toUpperCase()+e.slice(1)}function oh(e,t){return nh(t)?e.prefix+":"+lE(e.localName):e.name}function fE(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 dE(e,t,n){let r=_t(e,t.xmlns),i=`${t[r.prefix]||r.prefix}:${r.localName}`,o=_t(i);var a=n.getPackage(o.prefix);return fE(o,a)}function jr(e){return new Error(e)}function sr(e){return e.$descriptor}function hE(e){C(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw jr("expected element");var n=this.elementsById,r=sr(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 jr("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function va(){}va.prototype.handleEnd=function(){};va.prototype.handleText=function(){};va.prototype.handleNode=function(){};function bl(){}bl.prototype=Object.create(va.prototype);bl.prototype.handleNode=function(){return this};function no(){}no.prototype=Object.create(va.prototype);no.prototype.handleText=function(e){this.body=(this.body||"")+e};function ya(e,t){this.property=e,this.context=t}ya.prototype=Object.create(no.prototype);ya.prototype.handleNode=function(e){if(this.element)throw jr("expected no sub nodes");return this.element=this.createReference(e),this};ya.prototype.handleEnd=function(){this.element.id=this.body};ya.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function El(e,t){this.element=t,this.propertyDesc=e}El.prototype=Object.create(no.prototype);El.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=pc(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function lc(){}lc.prototype=Object.create(no.prototype);lc.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 Mt(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Mt.prototype=Object.create(lc.prototype);Mt.prototype.addReference=function(e){this.context.addReference(e)};Mt.prototype.handleText=function(e){var t=this.element,n=sr(t),r=n.bodyProperty;if(!r)throw jr("unexpected body text <"+e+">");no.prototype.handleText.call(this,e)};Mt.prototype.handleEnd=function(){var e=this.body,t=this.element,n=sr(t),r=n.bodyProperty;r&&e!==void 0&&(e=pc(r.type,e),t.set(r.name,e))};Mt.prototype.createElement=function(e){var t=e.attributes,n=this.type,r=sr(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=pc(u.type,c):p==="xmlns"?p=":"+p:(s=_t(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};Mt.prototype.getPropertyForNode=function(e){var t=e.name,n=_t(t),r=this.type,i=this.model,o=sr(r),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){let p=uE(s);if(p){let u=e.attributes[p];if(u){let l=dE(u,e.ns,i),f=i.getType(l);return C({},s,{effectiveType:sr(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 C({},s,{effectiveType:sr(u).name})}else if(s=ne(o.properties,function(p){return!p.isReference&&!p.isAttribute&&p.type==="Element"}),s)return s;throw jr("unrecognized element <"+n.name+">")};Mt.prototype.toString=function(){return"ElementDescriptor["+sr(this.type).name+"]"};Mt.prototype.valueHandler=function(e,t){return new El(e,t)};Mt.prototype.referenceHandler=function(e){return new ya(e,this.context)};Mt.prototype.handler=function(e){return e==="Element"?new to(this.model,e,this.context):new Mt(this.model,e,this.context)};Mt.prototype.handleChild=function(e){var t,n,r,i;if(t=this.getPropertyForNode(e),r=this.element,n=t.effectiveType||t.type,vl(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?(C(o,{element:r}),this.context.addReference(o)):o.$parent=r),i};function wl(e,t,n){Mt.call(this,e,t,n)}wl.prototype=Object.create(Mt.prototype);wl.prototype.createElement=function(e){var t=e.name,n=_t(t),r=this.model,i=this.type,o=r.getPackage(n.prefix),a=o&&oh(n,o)||t;if(!i.hasType(a))throw jr("unexpected element <"+e.originalName+">");return Mt.prototype.createElement.call(this,e)};function to(e,t,n){this.model=e,this.context=n}to.prototype=Object.create(lc.prototype);to.prototype.createElement=function(e){var t=e.name,n=_t(t),r=n.prefix,i=e.ns[r+"$uri"],o=e.attributes;return this.model.createAny(t,i,o)};to.prototype.handleChild=function(e){var t=new to(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};to.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function fc(e){e instanceof Ut&&(e={model:e}),C(this,{lax:!1},e)}fc.prototype.fromXML=function(e,t,n){var r=t.rootHandler;t instanceof Mt?(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 hE(C({},t,{rootHandler:r})),s=new _l({proxy:!0}),c=mE();r.context=a,c.push(r);function p(S,A,O){var M=A(),B=M.line,I=M.column,H=M.data;H.charAt(0)==="<"&&H.indexOf(" ")!==-1&&(H=H.slice(0,H.indexOf(" "))+">");var z="unparsable content "+(H?H+" ":"")+`detected line: `+B+` column: `+I+` nested error: `+S.message;if(O)return a.addWarning({message:z,error:S}),!0;throw jr(z)}function u(S,A){return p(S,A,!0)}function l(){var S=a.elementsById,A=a.references,O,M;for(O=0;M=A[O];O++){var B=M.element,I=S[M.id],H=sr(B).propertiesByName[M.property];if(I||a.addWarning({message:"unresolved reference <"+M.id+">",element:M.element,property:M.property,value:M.id}),H.isMany){var z=B.get(H.name),K=z.indexOf(M);K===-1&&(K=z.length),I?z[K]=I:z.splice(K,1)}else B.set(H.name,I)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,_=/^utf-8$/i;function v(S){if(d.test(S)){var A=h.exec(S),O=A&&A[1];!O||_.test(O)||a.addWarning({message:"unsupported document encoding <"+O+">, falling back to UTF-8"})}}function w(S,A){var O=c.peek();try{c.push(O.handleNode(S))}catch(M){p(M,A,o)&&c.push(new bl)}}function P(S,A){try{c.peek().handleText(S)}catch(O){u(O,A)}}function b(S,A){S.trim()&&P(S,A)}var x=i.getPackages().reduce(function(S,A){return S[A.uri]=A.prefix,S},Object.entries(xl).reduce(function(S,[A,O]){return S[O]=A,S},i.config&&i.config.nsMap||{}));return s.ns(x).on("openTag",function(S,A,O,M){var B=S.attrs||{},I=Object.keys(B).reduce(function(z,K){var ce=A(B[K]);return z[K]=ce,z},{}),H={name:S.name,originalName:S.originalName,attributes:I,ns:S.ns};w(H,M)}).on("question",v).on("closeTag",f).on("cdata",P).on("text",function(S,A,O){b(A(S),O)}).on("error",p).on("warn",u),new Promise(function(S,A){var O;try{s.parse(e),l()}catch(z){O=z}var M=r.element;!O&&!M&&(O=jr("failed to parse document as <"+r.type.$descriptor.name+">"));var B=a.warnings,I=a.references,H=a.elementsById;return O?(O.warnings=B,A(O)):S({rootElement:M,elementsById:H,references:I,warnings:B})})};fc.prototype.handler=function(e){return new wl(this.model,e)};function mE(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var gE=` `,vE=/<|>|'|"|&|\n\r|\n/g,ah=/<|>|&/g;function Wn(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Wn.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e};Wn.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]};Wn.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)};Wn.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)};Wn.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)};Wn.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t};Wn.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri};Wn.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)};Wn.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 yE(e){return e.charAt(0).toLowerCase()+e.slice(1)}function _E(e,t){return nh(t)?yE(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 et(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function xE(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 bE(e,t){return t.isGeneric?C({localName:t.ns.localName},e):C({localName:_E(t.ns.localName,t.$pkg)},e)}function EE(e,t){return C({localName:t.ns.localName},e)}function wE(e){var t=e.$descriptor;return J(t.properties,function(n){var r=n.name;if(n.isVirtual||!tt(e,r))return!1;var i=e[r];return i===n.default||i===null?!1:n.isMany?i.length:!0})}var SE={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},CE={"<":"lt",">":"gt","&":"amp"};function ph(e,t,n){return e=et(e)?e:""+e,e.replace(t,function(r){return"&"+n[r]+";"})}function RE(e){return ph(e,vE,SE)}function PE(e){return ph(e,ah,CE)}function AE(e){return J(e,function(t){return t.isAttr})}function TE(e){return J(e,function(t){return!t.isAttr})}function Sl(e){this.tagName=e}Sl.prototype.build=function(e){return this.element=e,this};Sl.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"").appendNewLine()};function di(){}di.prototype.serializeValue=di.prototype.serializeTo=function(e){e.append(this.escape?PE(this.value):this.value)};di.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(ah)!==-1&&(this.escape=!0),this};function Cl(e){this.tagName=e}sh(Cl,di);Cl.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("").appendNewLine()};function $e(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}$e.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=wE(e),this.parseAttributes(AE(i)),this.parseContainments(TE(i))),this.parseGenericAttributes(e,r),this};$e.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return bE(t,e)};$e.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return EE(t,e)};$e.prototype.isLocalNs=function(e){return e.uri===this.ns.uri};$e.prototype.nsAttributeName=function(e){var t;if(et(e)?t=_t(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}:C({localName:t.localName},n)};$e.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}))};$e.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new di().build({type:"String"},t));var n=e.$children;n&&E(n,r=>{this.body.push(new $e(this).build(r))})};$e.prototype.parseNsAttribute=function(e,t,n){var r=e.$model,i=_t(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)}};$e.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};$e.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)}})};$e.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 di().build(i,o[0]));else if(vl(i.type))E(o,function(p){n.push(new Cl(t.addTagName(t.nsPropertyTagName(i))).build(i,p))});else if(a)E(o,function(p){n.push(new Sl(t.addTagName(t.nsPropertyTagName(i))).build(p))});else{var c=ih(i);E(o,function(p){var u;c?c===rh?u=new $e(t,i):u=new dc(t,i,c):u=new $e(t),n.push(u.build(p))})}})};$e.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,r;return t||(r=n&&n.getNamespaces(),e||!r?this.namespaces=t=new Wn(r):t=r),t};$e.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};$e.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};$e.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)})};$e.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ch(e)};$e.prototype.addAttribute=function(e,t){var n=this.attrs;et(t)&&(t=RE(t));var r=Ks(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)};$e.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=xE(n).concat(t)),E(t,function(r){e.append(" ").append(ch(r.name)).append('="').append(r.value).append('"')})};$e.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==di;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 dc(e,t,n){$e.call(this,e,t),this.serialization=n}sh(dc,$e);dc.prototype.parseNsAttributes=function(e){var t=$e.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};dc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function ME(){this.value="",this.write=function(e){this.value+=e}}function DE(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=C({format:!1,preamble:!0},e||{});function t(n,r){var i=r||new ME,o=new DE(i,e.format);e.preamble&&o.append(gE);var a=new $e,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(kE(s)),a.build(n).serializeTo(o),!r)return i.value}return{toXML:t}}function kE(e){let t=e.config&&e.config.nsMap||{},n={};for(let r in xl)n[r]=xl[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 hc(e,t){Ut.call(this,e,t)}hc.prototype=Object.create(Ut.prototype);hc.prototype.fromXML=function(e,t,n){et(t)||(n=t,t="bpmn:Definitions");var r=new fc(C({model:this,lax:!0},n)),i=r.handler(t);return r.fromXML(e,i)};hc.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 OE="BPMN20",NE="http://www.omg.org/spec/BPMN/20100524/MODEL",BE="bpmn",IE=[],LE=[{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"}]}],jE=[{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"}]}],FE={tagAlias:"lowerCase",typePrefix:"t"},HE={name:OE,uri:NE,prefix:BE,associations:IE,types:LE,enumerations:jE,xml:FE},$E="BPMNDI",zE="http://www.omg.org/spec/BPMN/20100524/DI",VE="bpmndi",WE=[{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"]}],GE=[{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"}]}],UE=[],KE={name:$E,uri:zE,prefix:VE,types:WE,enumerations:GE,associations:UE},YE="DC",qE="http://www.omg.org/spec/DD/20100524/DC",XE="dc",ZE=[{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}]}],QE=[],JE={name:YE,uri:qE,prefix:XE,types:ZE,associations:QE},e0="DI",t0="http://www.omg.org/spec/DD/20100524/DI",n0="di",r0=[{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"}]}],i0=[],o0={tagAlias:"lowerCase"},a0={name:e0,uri:t0,prefix:n0,types:r0,associations:i0,xml:o0},s0="bpmn.io colors for BPMN",c0="http://bpmn.io/schema/bpmn/biocolor/1.0",p0="bioc",u0=[{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"}]}],l0=[],f0=[],d0={name:s0,uri:c0,prefix:p0,types:u0,enumerations:l0,associations:f0},h0="BPMN in Color",m0="http://www.omg.org/spec/BPMN/non-normative/color/1.0",g0="color",v0=[{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"}]}],y0=[],_0=[],x0={name:h0,uri:m0,prefix:g0,types:v0,enumerations:y0,associations:_0},b0={bpmn:HE,bpmndi:KE,dc:JE,di:a0,bioc:d0,color:x0};function lh(e,t){let n=C({},b0,e);return new hc(n,t)}function gt(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':""}var E0="Tried to access di from the businessObject. The di is available through the diagram element only. For more information, see https://github.com/bpmn-io/bpmn-js/issues/1472";function mc(e){tt(e,"di")||Object.defineProperty(e,"di",{enumerable:!1,get:function(){throw new Error(E0)}})}function jt(e,t){return e.$instanceOf(t)}function w0(e){return ne(e.rootElements,function(t){return jt(t,"bpmn:Process")||jt(t,"bpmn:Collaboration")})}function Rl(e){var t={},n=[],r={};function i(F,V){return function(re){F(re,V)}}function o(F){t[F.id]=F}function a(F){return t[F.id]}function s(F,V){var re=F.gfx;if(re)throw new Error(`already rendered ${gt(F)}`);return e.element(F,r[F.id],V)}function c(F,V){return e.root(F,r[F.id],V)}function p(F,V){try{var re=r[F.id]&&s(F,V);return o(F),re}catch(_e){u(_e.message,{element:F,error:_e}),console.error(`failed to import ${gt(F)}`,_e)}}function u(F,V){e.error(F,V)}var l=this.registerDi=function(V){var re=V.bpmnElement;re?r[re.id]?u(`multiple DI elements defined for ${gt(re)}`,{element:re}):(r[re.id]=V,mc(re)):u(`no bpmnElement referenced in ${gt(V)}`,{element:V})};function f(F){d(F.plane)}function d(F){l(F),E(F.planeElement,h)}function h(F){l(F)}this.handleDefinitions=function(V,re){var _e=V.diagrams;if(re&&_e.indexOf(re)===-1)throw new Error("diagram not part of ");if(!re&&_e&&_e.length&&(re=_e[0]),!re)throw new Error("no diagram to display");r={},f(re);var Ot=re.plane;if(!Ot)throw new Error(`no plane for ${gt(re)}`);var R=Ot.bpmnElement;if(!R)if(R=w0(V),R)u(`correcting missing bpmnElement on ${gt(Ot)} to ${gt(R)}`),Ot.bpmnElement=R,l(Ot);else throw new Error("no process or collaboration to display");var y=c(R,Ot);if(jt(R,"bpmn:Process")||jt(R,"bpmn:SubProcess"))v(R,y);else if(jt(R,"bpmn:Collaboration"))We(R,y),w(V.rootElements,y);else throw new Error(`unsupported bpmnElement for ${gt(Ot)}: ${gt(R)}`);_(n)};var _=this.handleDeferred=function(){for(var V;n.length;)V=n.shift(),V()};function v(F,V){ge(F,V),B(F.ioSpecification,V),M(F.artifacts,V),o(F)}function w(F,V){var re=J(F,function(_e){return!a(_e)&&jt(_e,"bpmn:Process")&&_e.laneSets});re.forEach(i(v,V))}function P(F,V){p(F,V)}function b(F,V){E(F,i(P,V))}function x(F,V){p(F,V)}function S(F,V){p(F,V)}function A(F,V){p(F,V)}function O(F,V){p(F,V)}function M(F,V){E(F,function(re){jt(re,"bpmn:Association")?n.push(function(){O(re,V)}):O(re,V)})}function B(F,V){F&&(E(F.dataInputs,i(S,V)),E(F.dataOutputs,i(A,V)))}var I=this.handleSubProcess=function(V,re){ge(V,re),M(V.artifacts,re)};function H(F,V){var re=p(F,V);jt(F,"bpmn:SubProcess")&&I(F,re||V),jt(F,"bpmn:Activity")&&B(F.ioSpecification,V),n.push(function(){E(F.dataInputAssociations,i(x,V)),E(F.dataOutputAssociations,i(x,V))})}function z(F,V){p(F,V)}function K(F,V){p(F,V)}function ce(F,V){n.push(function(){var re=p(F,V);F.childLaneSet&&ln(F.childLaneSet,re||V),ht(F)})}function ln(F,V){E(F.lanes,i(ce,V))}function De(F,V){E(F,i(ln,V))}function ge(F,V){Vt(F.flowElements,V),F.laneSets&&De(F.laneSets,V)}function Vt(F,V){E(F,function(re){jt(re,"bpmn:SequenceFlow")?n.push(function(){z(re,V)}):jt(re,"bpmn:BoundaryEvent")?n.unshift(function(){H(re,V)}):jt(re,"bpmn:FlowNode")?H(re,V):jt(re,"bpmn:DataObject")||(jt(re,"bpmn:DataStoreReference")||jt(re,"bpmn:DataObjectReference")?K(re,V):u(`unrecognized flowElement ${gt(re)} in context ${gt(V&&V.businessObject)}`,{element:re,context:V}))})}function Wt(F,V){var re=p(F,V),_e=F.processRef;_e&&v(_e,re||V)}function We(F,V){E(F.participants,i(Wt,V)),n.push(function(){b(F.messageFlows,V)}),M(F.artifacts,V)}function ht(F){E(F.flowNodeRef,function(V){var re=V.get("lanes");re&&re.push(F)})}}function m(e,t){var n=L(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Q(e,t){return Nt(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(_,v){return r.add(_,v)},element:function(_,v,w){return r.add(_,v,w)},error:function(_,v){s.push({message:_,context:v})}},f=new Rl(l);u=u||p.diagrams&&p.diagrams[0];var d=S0(p,u);if(!d)throw new Error("no diagram to display");E(d,function(_){f.handleDefinitions(p,_)});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 S0(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,r=n;!m(n,"bpmn:Process")&&!m(n,"bpmn:Collaboration")&&(r=C0(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=He(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 C0(e){for(var t=e;t;){if(m(t,"bpmn:Process"))return t;t=t.$parent}}var R0='',Pl=R0,Al={verticalAlign:"middle"},Tl={color:"#404040"},P0={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},A0={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},T0={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"},M0='
'+Pl+'Web-based tooling for BPMN, DMN and forms powered by bpmn.io.
',Gn;function D0(){Gn=ye(M0),at(Gn,P0),at(me("svg",Gn),Al),at(me(".backdrop",Gn),A0),at(me(".notice",Gn),T0),at(me(".link",Gn),Tl,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function hh(){Gn||(D0(),ut.bind(Gn,".backdrop","click",function(e){document.body.removeChild(Gn)})),document.body.appendChild(Gn)}function Be(e){e=C({},O0,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),B0(this._container)}N(Be,Vn);Be.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||[]),gc(s,o),s=k0(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}};Be.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}};Be.prototype.open=async function(t){let n=this._definitions,r=t;if(!n){let o=new Error("no XML imported");throw gc(o,[]),o}if(typeof t=="string"&&(r=N0(n,t),!r)){let o=new Error("BPMNDiagram <"+t+"> not found");throw gc(o,[]),o}try{this.clear()}catch(o){throw gc(o,[]),o}let{warnings:i}=await fh(this,n,r);return{warnings:i}};Be.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};Be.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{let r=this.get("canvas"),i=r.getActiveLayer(),o=me(":scope > defs",r._svg),a=rl(i),s=o?""+rl(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}};Be.prototype._setDefinitions=function(e){this._definitions=e};Be.prototype.getModules=function(){return this._modules};Be.prototype.clear=function(){this.getDefinitions()&&Vn.prototype.clear.call(this)};Be.prototype.destroy=function(){Vn.prototype.destroy.call(this),Bt(this._container)};Be.prototype.on=function(e,t,n,r){return this.get("eventBus").on(e,t,n,r)};Be.prototype.off=function(e,t){this.get("eventBus").off(e,t)};Be.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=me(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()};Be.prototype.getDefinitions=function(){return this._definitions};Be.prototype.detach=function(){let e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))};Be.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=C(At(n,["additionalModules"]),{canvas:C({},n.canvas,{container:e}),modules:a});Vn.call(this,s),n&&n.container&&this.attachTo(n.container)};Be.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)};Be.prototype._createContainer=function(e){let t=ye('
');return at(t,{width:mh(e.width),height:mh(e.height),position:e.position}),t};Be.prototype._createModdle=function(e){let t=C({},this._moddleExtensions,e.moddleExtensions);return new lh(t)};Be.prototype._modules=[];function gc(e,t){return e.warnings=t,e}function k0(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 O0={width:"100%",height:"100%",position:"relative"};function mh(e){return e+(ee(e)?"px":"")}function N0(e,t){return t&&ne(e.diagrams,function(n){return n.id===t})||null}function B0(e){let n=''+Pl+"",r=ye(n);at(me("svg",r),Al),at(r,Tl,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(r),ae.bind(r,"click",function(i){hh(),i.preventDefault()})}function hi(e){Be.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(hi,Be);hi.prototype._createModdle=function(e){var t=Be.prototype._createModdle.call(this,e);return t.ids=new dn([32,36,1]),t};hi.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 ie(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 Re(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 Ue(e){return e&&!!L(e).triggeredByEvent}function cr(e,t){var n=L(e).eventDefinitions;return Nt(n,function(r){return m(r,t)})}function vh(e){return cr(e,"bpmn:ErrorEventDefinition")}function yh(e){return cr(e,"bpmn:EscalationEventDefinition")}function _h(e){return cr(e,"bpmn:CompensateEventDefinition")}var ro={width:90,height:20},xh=15;function nn(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 Fr(e){return te(e.label)}function I0(e){var t=e.length/2-1,n=e[Math.floor(t)],r=e[Math.ceil(t+.01)],i=L0(e),o=Math.atan((r.y-n.y)/(r.x-n.x)),a=i.x,s=i.y;return Math.abs(o) defs",j);oe||(oe=G("defs"),Z(j,oe)),Z(oe,W)}function d(R,y,g,T){var D=H0.nextPrefixed("marker-");return h(R,D,y,g,T),"url(#"+D+")"}function h(R,y,g,T,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(y,{element:j,ref:{x:11,y:10},scale:.5,parentGfx:R})}if(g==="messageflow-start"){var W=G("circle",{cx:6,cy:6,r:3.5,...u({fill:T,stroke:D,strokeWidth:1,strokeDasharray:[1e4,1]})});f(y,{element:W,ref:{x:6,y:6},parentGfx:R})}if(g==="messageflow-end"){var oe=G("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:T,stroke:D,strokeWidth:1,strokeDasharray:[1e4,1]})});f(y,{element:oe,ref:{x:8.5,y:5},parentGfx:R})}if(g==="association-start"){var ve=G("path",{d:"M 11 5 L 1 10 L 11 15",...l({fill:"none",stroke:D,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(y,{element:ve,ref:{x:1,y:10},scale:.5,parentGfx:R})}if(g==="association-end"){var it=G("path",{d:"M 1 5 L 11 10 L 1 15",...l({fill:"none",stroke:D,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(y,{element:it,ref:{x:11,y:10},scale:.5,parentGfx:R})}if(g==="conditional-flow-marker"){var Qe=G("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:T,stroke:D})});f(y,{element:Qe,ref:{x:-1,y:10},scale:.5,parentGfx:R})}if(g==="conditional-default-flow-marker"){var mt=G("path",{d:"M 6 4 L 10 16",...u({stroke:D,fill:"none"})});f(y,{element:mt,ref:{x:0,y:10},scale:.5,parentGfx:R})}}function _(R,y,g,T,D={}){Ce(T)&&(D=T,T=0),T=T||0,D=u(D);var j=y/2,W=g/2,oe=G("circle",{cx:j,cy:W,r:Math.round((y+g)/4-T),...D});return Z(R,oe),oe}function v(R,y,g,T,D,j){Ce(D)&&(j=D,D=0),D=D||0,j=u(j);var W=G("rect",{x:D,y:D,width:y-D*2,height:g-D*2,rx:T,ry:T,...j});return Z(R,W),W}function w(R,y,g,T){var D=y/2,j=g/2,W=[{x:D,y:0},{x:y,y:j},{x:D,y:g},{x:0,y:j}],oe=W.map(function(it){return it.x+","+it.y}).join(" ");T=u(T);var ve=G("polygon",{...T,points:oe});return Z(R,ve),ve}function P(R,y,g,T){g=l(g);var D=jn(y,g,T);return Z(R,D),D}function b(R,y,g){return P(R,y,g,5)}function x(R,y,g){g=l(g);var T=G("path",{...g,d:y});return Z(R,T),T}function S(R,y,g,T){return x(y,g,C({"data-marker":R},T))}function A(R){return Ot[R]}function O(R){return function(y,g,T){return A(R)(y,g,T)}}var M={"bpmn:MessageEventDefinition":function(R,y,g={},T){var D=r.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:g.width||y.width,containerHeight:g.height||y.height,position:{mx:.235,my:.315}}),j=T?q(y,c,g.stroke):he(y,s,g.fill),W=T?he(y,s,g.fill):q(y,c,g.stroke),oe=x(R,D,{fill:j,stroke:W,strokeWidth:1});return oe},"bpmn:TimerEventDefinition":function(R,y,g={}){var T=g.width||y.width,D=g.height||y.height,j=g.width?1:2,W=_(R,T,D,.2*D,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke),strokeWidth:j}),oe=r.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:T,containerHeight:D,position:{mx:.5,my:.5}});x(R,oe,{stroke:q(y,c,g.stroke),strokeWidth:j});for(var ve=0;ve<12;ve++){var it=r.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:T,containerHeight:D,position:{mx:.5,my:.5}}),Qe=T/2,mt=D/2;x(R,it,{strokeWidth:1,stroke:q(y,c,g.stroke),transform:"rotate("+ve*30+","+mt+","+Qe+")"})}return W},"bpmn:EscalationEventDefinition":function(R,y,g={},T){var D=r.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:g.width||y.width,containerHeight:g.height||y.height,position:{mx:.5,my:.2}}),j=T?q(y,c,g.stroke):he(y,s,g.fill);return x(R,D,{fill:j,stroke:q(y,c,g.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(R,y,g={}){var T=r.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:g.width||y.width,containerHeight:g.height||y.height,position:{mx:.5,my:.222}});return x(R,T,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(R,y,g={},T){var D=r.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width,containerHeight:y.height,position:{mx:.57,my:.263}}),j=T?q(y,c,g.stroke):he(y,s,g.fill);return x(R,D,{fill:j,stroke:q(y,c,g.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(R,y,g={},T){var D=r.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:g.width||y.width,containerHeight:g.height||y.height,position:{mx:.2,my:.722}}),j=T?q(y,c,g.stroke):he(y,s,g.fill);return x(R,D,{fill:j,stroke:q(y,c,g.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(R,y,g={},T){var D=r.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width,containerHeight:y.height,position:{mx:.638,my:-.055}}),j=T?q(y,c,g.stroke):"none",W=x(R,D,{fill:j,stroke:q(y,c,g.stroke),strokeWidth:1});return cc(W,45),W},"bpmn:CompensateEventDefinition":function(R,y,g={},T){var D=r.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:g.width||y.width,containerHeight:g.height||y.height,position:{mx:.22,my:.5}}),j=T?q(y,c,g.stroke):he(y,s,g.fill);return x(R,D,{fill:j,stroke:q(y,c,g.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(R,y,g={},T){var D=r.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:g.width||y.width,containerHeight:g.height||y.height,position:{mx:.5,my:.2}}),j=T?q(y,c,g.stroke):he(y,s,g.fill);return x(R,D,{strokeWidth:1,fill:j,stroke:q(y,c,g.stroke)})},"bpmn:MultipleEventDefinition":function(R,y,g={},T){var D=r.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:g.width||y.width,containerHeight:g.height||y.height,position:{mx:.211,my:.36}}),j=T?q(y,c,g.stroke):he(y,s,g.fill);return x(R,D,{fill:j,stroke:q(y,c,g.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(R,y,g={}){var T=r.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:g.width||y.width,containerHeight:g.height||y.height,position:{mx:.458,my:.194}});return x(R,T,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(R,y,g={}){var T=_(R,y.width,y.height,8,{fill:q(y,c,g.stroke),stroke:q(y,c,g.stroke),strokeWidth:4});return T}};function B(R,y,g={},T){var D=L(R),j=Ch(D),W=T||R;return D.get("eventDefinitions")&&D.get("eventDefinitions").length>1?D.get("parallelMultiple")?M["bpmn:ParallelMultipleEventDefinition"](y,W,g,j):M["bpmn:MultipleEventDefinition"](y,W,g,j):Pn(D,"bpmn:MessageEventDefinition")?M["bpmn:MessageEventDefinition"](y,W,g,j):Pn(D,"bpmn:TimerEventDefinition")?M["bpmn:TimerEventDefinition"](y,W,g,j):Pn(D,"bpmn:ConditionalEventDefinition")?M["bpmn:ConditionalEventDefinition"](y,W,g,j):Pn(D,"bpmn:SignalEventDefinition")?M["bpmn:SignalEventDefinition"](y,W,g,j):Pn(D,"bpmn:EscalationEventDefinition")?M["bpmn:EscalationEventDefinition"](y,W,g,j):Pn(D,"bpmn:LinkEventDefinition")?M["bpmn:LinkEventDefinition"](y,W,g,j):Pn(D,"bpmn:ErrorEventDefinition")?M["bpmn:ErrorEventDefinition"](y,W,g,j):Pn(D,"bpmn:CancelEventDefinition")?M["bpmn:CancelEventDefinition"](y,W,g,j):Pn(D,"bpmn:CompensateEventDefinition")?M["bpmn:CompensateEventDefinition"](y,W,g,j):Pn(D,"bpmn:TerminateEventDefinition")?M["bpmn:TerminateEventDefinition"](y,W,g,j):null}var I={ParticipantMultiplicityMarker:function(R,y,g={}){var T=rn(y,g),D=Ft(y,g),j=r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:T,containerHeight:D,position:{mx:(T/2-6)/T,my:(D-15)/D}});S("participant-multiplicity",R,j,{strokeWidth:2,fill:he(y,s,g.fill),stroke:q(y,c,g.stroke)})},SubProcessMarker:function(R,y,g={}){var T=v(R,14,14,0,{strokeWidth:1,fill:he(y,s,g.fill),stroke:q(y,c,g.stroke)});ke(T,y.width/2-7.5,y.height-20);var D=r.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:y.width,containerHeight:y.height,position:{mx:(y.width/2-7.5)/y.width,my:(y.height-20)/y.height}});S("sub-process",R,D,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke)})},ParallelMarker:function(R,y,g){var T=rn(y,g),D=Ft(y,g),j=r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:T,containerHeight:D,position:{mx:(T/2+g.parallel)/T,my:(D-20)/D}});S("parallel",R,j,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke)})},SequentialMarker:function(R,y,g){var T=r.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width,containerHeight:y.height,position:{mx:(y.width/2+g.seq)/y.width,my:(y.height-19)/y.height}});S("sequential",R,T,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke)})},CompensationMarker:function(R,y,g){var T=r.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width,containerHeight:y.height,position:{mx:(y.width/2+g.compensation)/y.width,my:(y.height-13)/y.height}});S("compensation",R,T,{strokeWidth:1,fill:he(y,s,g.fill),stroke:q(y,c,g.stroke)})},LoopMarker:function(R,y,g){var T=rn(y,g),D=Ft(y,g),j=r.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:T,containerHeight:D,position:{mx:(T/2+g.loop)/T,my:(D-7)/D}});S("loop",R,j,{strokeWidth:1.5,fill:"none",stroke:q(y,c,g.stroke),strokeMiterlimit:.5})},AdhocMarker:function(R,y,g){var T=rn(y,g),D=Ft(y,g),j=r.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:T,containerHeight:D,position:{mx:(T/2+g.adhoc)/T,my:(D-15)/D}});S("adhoc",R,j,{strokeWidth:1,fill:q(y,c,g.stroke),stroke:q(y,c,g.stroke)})}};function H(R,y,g,T){I[R](y,g,T)}function z(R,y,g=[],T={}){T={fill:T.fill,stroke:T.stroke,width:rn(y,T),height:Ft(y,T)};var D=L(y),j=g.includes("SubProcessMarker");j?T={...T,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:T={...T,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},D.get("isForCompensation")&&g.push("CompensationMarker"),m(D,"bpmn:AdHocSubProcess")&&(g.push("AdhocMarker"),j||C(T,{compensation:T.compensation-18}));var W=D.get("loopCharacteristics"),oe=W&&W.get("isSequential");W&&(C(T,{compensation:T.compensation-18}),g.includes("AdhocMarker")&&C(T,{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&&C(T,{compensation:-8}),E(g,function(ve){H(ve,R,y,T)})}function K(R,y,g={}){g=C({size:{width:100}},g);var T=o.createText(y||"",g);return ue(T).add("djs-label"),Z(R,T),T}function ce(R,y,g,T={}){var D=L(y),j=oo({x:y.x,y:y.y,width:y.width,height:y.height},T);return K(R,D.name,{align:g,box:j,padding:7,style:{fill:io(y,p,c,T.stroke)}})}function ln(R,y,g={}){var T={width:90,height:30,x:y.width/2+y.x,y:y.height/2+y.y};return K(R,xt(y),{box:T,fitBox:!0,style:C({},o.getExternalStyle(),{fill:io(y,p,c,g.stroke)})})}function De(R,y,g,T={}){var D=Re(g),j=K(R,y,{box:{height:30,width:D?Ft(g,T):rn(g,T)},align:"center-middle",style:{fill:io(g,p,c,T.stroke)}});if(D){var W=-1*Ft(g,T);Ji(j,0,-W,270)}}function ge(R,y,g={}){var{width:T,height:D}=oo(y,g);return v(R,T,D,xc,{...g,fill:he(y,s,g.fill),fillOpacity:ao,stroke:q(y,c,g.stroke)})}function Vt(R,y,g={}){var T=L(y),D=he(y,s,g.fill),j=q(y,c,g.stroke);return(T.get("associationDirection")==="One"||T.get("associationDirection")==="Both")&&(g.markerEnd=d(R,"association-end",D,j)),T.get("associationDirection")==="Both"&&(g.markerStart=d(R,"association-start",D,j)),g=xe(g,["markerStart","markerEnd"]),b(R,y.waypoints,{...g,stroke:j,strokeDasharray:"0, 5"})}function Wt(R,y,g={}){var T=he(y,s,g.fill),D=q(y,c,g.stroke),j=r.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width,containerHeight:y.height,position:{mx:.474,my:.296}}),W=x(R,j,{fill:T,fillOpacity:ao,stroke:D}),oe=L(y);if(Rh(oe)){var ve=r.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width,containerHeight:y.height,position:{mx:.33,my:(y.height-18)/y.height}});x(R,ve,{strokeWidth:2,fill:T,stroke:D})}return W}function We(R,y,g={}){return _(R,y.width,y.height,{fillOpacity:ao,...g,fill:he(y,s,g.fill),stroke:q(y,c,g.stroke)})}function ht(R,y,g={}){return w(R,y.width,y.height,{fill:he(y,s,g.fill),fillOpacity:ao,stroke:q(y,c,g.stroke)})}function F(R,y,g={}){var T=v(R,rn(y,g),Ft(y,g),0,{fill:he(y,s,g.fill),fillOpacity:g.fillOpacity||ao,stroke:q(y,c,g.stroke),strokeWidth:1.5}),D=L(y);if(m(D,"bpmn:Lane")){var j=D.get("name");De(R,j,y,g)}return T}function V(R,y,g={}){var T=ge(R,y,g),D=ie(y);if(Ue(y)&&($(T,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!D)){var j=L(y).flowElements||[],W=j.filter(oe=>m(oe,"bpmn:StartEvent"));W.length===1&&re(W[0],R,g,y)}return ce(R,y,D?"center-top":"center-middle",g),D?z(R,y,void 0,g):z(R,y,["SubProcessMarker"],g),T}function re(R,y,g,T){var D=22,j={fill:he(T,s,g.fill),stroke:q(T,c,g.stroke),width:D,height:D},W=L(R).isInterrupting,oe=W?0:3,ve=W?1:1.2,it=20,Qe=(D-it)/2,mt="translate("+Qe+","+Qe+")";_(y,it,it,{fill:j.fill,stroke:j.stroke,strokeWidth:ve,strokeDasharray:oe,transform:mt}),B(R,y,j,T)}function _e(R,y,g={}){var T=ge(R,y,g);return ce(R,y,"center-middle",g),z(R,y,void 0,g),T}var Ot=this.handlers={"bpmn:AdHocSubProcess":function(R,y,g={}){return ie(y)?g=xe(g,["fill","stroke","width","height"]):g=xe(g,["fill","stroke"]),V(R,y,g)},"bpmn:Association":function(R,y,g={}){return g=xe(g,["fill","stroke"]),Vt(R,y,g)},"bpmn:BoundaryEvent":function(R,y,g={}){var{renderIcon:T=!0}=g;g=xe(g,["fill","stroke"]);var D=L(y),j=D.get("cancelActivity");g={strokeWidth:1.5,fill:he(y,s,g.fill),fillOpacity:W0,stroke:q(y,c,g.stroke)},j||(g.strokeDasharray="6");var W=We(R,y,g);return _(R,y.width,y.height,_c,{...g,fill:"none"}),T&&B(y,R,g),W},"bpmn:BusinessRuleTask":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=_e(R,y,g),D=r.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),j=x(R,D);$(j,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke),strokeWidth:1});var W=r.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),oe=x(R,W);return $(oe,{fill:q(y,c,g.stroke),stroke:q(y,c,g.stroke),strokeWidth:1}),T},"bpmn:CallActivity":function(R,y,g={}){return g=xe(g,["fill","stroke"]),V(R,y,{strokeWidth:5,...g})},"bpmn:ComplexGateway":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=ht(R,y,g),D=r.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:y.width,containerHeight:y.height,position:{mx:.46,my:.26}});return x(R,D,{fill:q(y,c,g.stroke),stroke:q(y,c,g.stroke),strokeWidth:1}),T},"bpmn:DataInput":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=r.getRawPath("DATA_ARROW"),D=Wt(R,y,g);return x(R,T,{fill:"none",stroke:q(y,c,g.stroke),strokeWidth:1}),D},"bpmn:DataInputAssociation":function(R,y,g={}){return g=xe(g,["fill","stroke"]),Vt(R,y,{...g,markerEnd:d(R,"association-end",he(y,s,g.fill),q(y,c,g.stroke))})},"bpmn:DataObject":function(R,y,g={}){return g=xe(g,["fill","stroke"]),Wt(R,y,g)},"bpmn:DataObjectReference":O("bpmn:DataObject"),"bpmn:DataOutput":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=r.getRawPath("DATA_ARROW"),D=Wt(R,y,g);return x(R,T,{strokeWidth:1,fill:he(y,s,g.fill),stroke:q(y,c,g.stroke)}),D},"bpmn:DataOutputAssociation":function(R,y,g={}){return g=xe(g,["fill","stroke"]),Vt(R,y,{...g,markerEnd:d(R,"association-end",he(y,s,g.fill),q(y,c,g.stroke))})},"bpmn:DataStoreReference":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=r.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width,containerHeight:y.height,position:{mx:0,my:.133}});return x(R,T,{fill:he(y,s,g.fill),fillOpacity:ao,stroke:q(y,c,g.stroke),strokeWidth:2})},"bpmn:EndEvent":function(R,y,g={}){var{renderIcon:T=!0}=g;g=xe(g,["fill","stroke"]);var D=We(R,y,{...g,strokeWidth:4});return T&&B(y,R,g),D},"bpmn:EventBasedGateway":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=L(y),D=ht(R,y,g);_(R,y.width,y.height,y.height*.2,{fill:he(y,"none",g.fill),stroke:q(y,c,g.stroke),strokeWidth:1});var j=T.get("eventGatewayType"),W=!!T.get("instantiate");function oe(){var it=r.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:y.width,containerHeight:y.height,position:{mx:.36,my:.44}});x(R,it,{fill:"none",stroke:q(y,c,g.stroke),strokeWidth:2})}if(j==="Parallel"){var ve=r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:y.width,containerHeight:y.height,position:{mx:.474,my:.296}});x(R,ve,{fill:"none",stroke:q(y,c,g.stroke),strokeWidth:1})}else j==="Exclusive"&&(W||_(R,y.width,y.height,y.height*.26,{fill:"none",stroke:q(y,c,g.stroke),strokeWidth:1}),oe());return D},"bpmn:ExclusiveGateway":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=ht(R,y,g),D=r.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:y.width,containerHeight:y.height,position:{mx:.32,my:.3}}),j=se(y);return j.get("isMarkerVisible")&&x(R,D,{fill:q(y,c,g.stroke),stroke:q(y,c,g.stroke),strokeWidth:1}),T},"bpmn:Gateway":function(R,y,g={}){return g=xe(g,["fill","stroke"]),ht(R,y,g)},"bpmn:Group":function(R,y,g={}){return g=xe(g,["fill","stroke","width","height"]),v(R,y.width,y.height,xc,{stroke:q(y,c,g.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:rn(y,g),height:Ft(y,g)})},"bpmn:InclusiveGateway":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=ht(R,y,g);return _(R,y.width,y.height,y.height*.24,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke),strokeWidth:2.5}),T},"bpmn:IntermediateEvent":function(R,y,g={}){var{renderIcon:T=!0}=g;g=xe(g,["fill","stroke"]);var D=We(R,y,{...g,strokeWidth:1.5});return _(R,y.width,y.height,_c,{fill:"none",stroke:q(y,c,g.stroke),strokeWidth:1.5}),T&&B(y,R,g),D},"bpmn:IntermediateCatchEvent":O("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":O("bpmn:IntermediateEvent"),"bpmn:Lane":function(R,y,g={}){return g=xe(g,["fill","stroke","width","height"]),F(R,y,{...g,fillOpacity:G0})},"bpmn:ManualTask":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=_e(R,y,g),D=r.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(R,D,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke),strokeWidth:.5}),T},"bpmn:MessageFlow":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=L(y),D=se(y),j=he(y,s,g.fill),W=q(y,c,g.stroke),oe=b(R,y.waypoints,{markerEnd:d(R,"messageflow-end",j,W),markerStart:d(R,"messageflow-start",j,W),stroke:W,strokeDasharray:"10, 11",strokeWidth:1.5});if(T.get("messageRef")){var ve=oe.getPointAtLength(oe.getTotalLength()/2),it=r.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ve.x,y:ve.y}}),Qe={strokeWidth:1};D.get("messageVisibleKind")==="initiating"?(Qe.fill=j,Qe.stroke=W):(Qe.fill=W,Qe.stroke=j);var mt=x(R,it,Qe),fn=T.get("messageRef"),Me=fn.get("name"),ir=K(R,Me,{align:"center-top",fitBox:!0,style:{fill:W}}),Us=mt.getBBox(),Jt=ir.getBBox(),de=ve.x-Jt.width/2,Se=ve.y+Us.height/2+$0;Ji(ir,de,Se,0)}return oe},"bpmn:ParallelGateway":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=ht(R,y,g),D=r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:y.width,containerHeight:y.height,position:{mx:.46,my:.2}});return x(R,D,{fill:q(y,c,g.stroke),stroke:q(y,c,g.stroke),strokeWidth:1}),T},"bpmn:Participant":function(R,y,g={}){g=xe(g,["fill","stroke","width","height"]);var T=F(R,y,g),D=ie(y),j=Re(y),W=L(y),oe=W.get("name");if(D){var ve=j?[{x:30,y:0},{x:30,y:Ft(y,g)}]:[{x:0,y:30},{x:rn(y,g),y:30}];P(R,ve,{stroke:q(y,c,g.stroke),strokeWidth:z0}),De(R,oe,y,g)}else{var it=oo(y,g);j||(it.height=rn(y,g),it.width=Ft(y,g));var Qe=K(R,oe,{box:it,align:"center-middle",style:{fill:io(y,p,c,g.stroke)}});if(!j){var mt=-1*Ft(y,g);Ji(Qe,0,-mt,270)}}return W.get("participantMultiplicity")&&H("ParticipantMultiplicityMarker",R,y,g),T},"bpmn:ReceiveTask":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=L(y),D=_e(R,y,g),j;return T.get("instantiate")?(_(R,28,28,20*.22,{fill:he(y,s,g.fill),stroke:q(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(R,j,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke),strokeWidth:1}),D},"bpmn:ScriptTask":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=_e(R,y,g),D=r.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(R,D,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke),strokeWidth:1}),T},"bpmn:SendTask":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=_e(R,y,g),D=r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(R,D,{fill:q(y,c,g.stroke),stroke:he(y,s,g.fill),strokeWidth:1}),T},"bpmn:SequenceFlow":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=he(y,s,g.fill),D=q(y,c,g.stroke),j=b(R,y.waypoints,{markerEnd:d(R,"sequenceflow-end",T,D),stroke:D}),W=L(y),{source:oe}=y;if(oe){var ve=L(oe);W.get("conditionExpression")&&m(ve,"bpmn:Activity")&&$(j,{markerStart:d(R,"conditional-flow-marker",T,D)}),ve.get("default")&&(m(ve,"bpmn:Gateway")||m(ve,"bpmn:Activity"))&&ve.get("default")===W&&$(j,{markerStart:d(R,"conditional-default-flow-marker",T,D)})}return j},"bpmn:ServiceTask":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=_e(R,y,g);_(R,10,10,{fill:he(y,s,g.fill),stroke:"none",transform:"translate(6, 6)"});var D=r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(R,D,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke),strokeWidth:1}),_(R,10,10,{fill:he(y,s,g.fill),stroke:"none",transform:"translate(11, 10)"});var j=r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(R,j,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke),strokeWidth:1}),T},"bpmn:StartEvent":function(R,y,g={}){var{renderIcon:T=!0}=g;g=xe(g,["fill","stroke"]);var D=L(y);D.get("isInterrupting")||(g={...g,strokeDasharray:"6"});var j=We(R,y,g);return T&&B(y,R,g),j},"bpmn:SubProcess":function(R,y,g={}){return ie(y)?g=xe(g,["fill","stroke","width","height"]):g=xe(g,["fill","stroke"]),V(R,y,g)},"bpmn:Task":function(R,y,g={}){return g=xe(g,["fill","stroke"]),_e(R,y,g)},"bpmn:TextAnnotation":function(R,y,g={}){g=xe(g,["fill","stroke","width","height"]);var{width:T,height:D}=oo(y,g),j=v(R,T,D,0,0,{fill:"none",stroke:"none"}),W=r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:T,containerHeight:D,position:{mx:0,my:0}});x(R,W,{stroke:q(y,c,g.stroke)});var oe=L(y),ve=oe.get("text")||"";return K(R,ve,{align:"left-top",box:oo(y,g),padding:7,style:{fill:io(y,p,c,g.stroke)}}),j},"bpmn:Transaction":function(R,y,g={}){ie(y)?g=xe(g,["fill","stroke","width","height"]):g=xe(g,["fill","stroke"]);var T=V(R,y,{strokeWidth:1.5,...g}),D=n.style(["no-fill","no-events"],{stroke:q(y,c,g.stroke),strokeWidth:1.5}),j=ie(y);return j||(g={}),v(R,rn(y,g),Ft(y,g),xc-_c,_c,D),T},"bpmn:UserTask":function(R,y,g={}){g=xe(g,["fill","stroke"]);var T=_e(R,y,g),D=15,j=12,W=r.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:D,y:j}});x(R,W,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke),strokeWidth:.5});var oe=r.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:D,y:j}});x(R,oe,{fill:he(y,s,g.fill),stroke:q(y,c,g.stroke),strokeWidth:.5});var ve=r.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:D,y:j}});return x(R,ve,{fill:q(y,c,g.stroke),stroke:q(y,c,g.stroke),strokeWidth:.5}),T},label:function(R,y,g={}){return ln(R,y,g)}};this._drawPath=x,this._renderer=A}N(pr,mn);pr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"];pr.prototype.canRender=function(e){return m(e,"bpmn:BaseElement")};pr.prototype.drawShape=function(e,t,n={}){var{type:r}=t,i=this._renderer(r);return i(e,t,n)};pr.prototype.drawConnection=function(e,t,n={}){var{type:r}=t,i=this._renderer(r);return i(e,t,n)};pr.prototype.getShapePath=function(e){return te(e)?xa(e,V0):m(e,"bpmn:Event")?yc(e):m(e,"bpmn:Activity")?xa(e,xc):m(e,"bpmn:Gateway")?Ph(e):Ah(e)};function xe(e,t=[]){return t.reduce((n,r)=>(e[r]&&(n[r]=e[r]),n),{})}var U0=0,K0={width:150,height:50};function Y0(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function q0(e){return Ce(e)?C({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Ml=null;function X0(){return Ml||(Ml=document.createElement("canvas").getContext("2d")),Ml}function Z0(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 Q0(e,t){var n=X0();if(!n)return{width:0,height:0};n.font=Z0(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 J0(e,t,n){for(var r=e.shift(),i=r,o;;){if(o=Q0(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,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 P=G("tspan");$(P,{x:w,y:d}),P.textContent=v.text,Z(h,P)});var _={width:f,height:l};return{dimensions:_,element:h}};function rw(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var iw=12,ow=1.2,aw=30;function bc(e){var t=C({fontFamily:"Arial, sans-serif",fontSize:iw,fontWeight:"normal",lineHeight:ow},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,r=C({},t,{fontSize:n},e&&e.externalStyle||{}),i=new so({style:t});this.getExternalLabelBounds=function(o,a){var s=i.getDimensions(a,{box:{width:90,height:30},style:r});return{x:Math.round(o.x+o.width/2-s.width/2),y:Math.round(o.y),width:Math.ceil(s.width),height:Math.ceil(s.height)}},this.getTextAnnotationBounds=function(o,a){var s=i.getDimensions(a,{box:o,style:t,align:"left-top",padding:5});return{x:o.x,y:o.y,width:o.width,height:Math.max(aw,Math.round(s.height))}},this.createText=function(o,a){return i.createText(o,a||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return r}}bc.$inject=["config.textRenderer"];function Dl(){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 dw(e){return m(e,"bpmn:Group")}var Oh={__depends__:[Hr],bpmnImporter:["type",An]};var Nh={__depends__:[Dh,Oh]};function Un(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Un.prototype.next=function(){return this._prefix+ ++this._counter};var hw=new Un("ov"),mw=500;function st(e,t,n,r){this._eventBus=t,this._canvas=n,this._elementRegistry=r,this._ids=hw,this._overlayDefaults=C({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=gw(n.getContainer()),this._init()}st.$inject=["config.overlays","eventBus","canvas","elementRegistry"];st.prototype.get=function(e){if(et(e)&&(e={id:e}),et(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?J(t.overlays,yt({type:e.type})):t.overlays.slice():[]}else return e.type?J(this._overlays,yt({type:e.type})):e.id?this._overlays[e.id]:null};st.prototype.add=function(e,t,n){if(Ce(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=C({},this._overlayDefaults,n,{id:r,type:t,element:e,html:n.html}),this._addOverlay(n),r};st.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&&(Bt(r.html),Bt(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)}})};st.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"};st.prototype.show=function(){wc(this._overlayRoot)};st.prototype.hide=function(){wc(this._overlayRoot,!1)};st.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Tr(this._overlayRoot)};st.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,r=t.x,i=t.y;if(t.waypoints){var o=Ee(t);r=o.x,i=o.y}Bh(n,r,i),Ye(e.html,"data-container-id",t.id)};st.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=Ee(r).width:a=r.width,i=t.right*-1+a}if(t.bottom!==void 0){var s;r.waypoints?s=Ee(r).height:s=r.height,o=t.bottom*-1+s}Bh(n,i||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())};st.prototype._createOverlayContainer=function(e){var t=ye('
');at(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n};st.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)};st.prototype._getOverlayContainer=function(e,t){var n=ne(this._overlayContainers,function(r){return r.element===e});return!n&&!t?this._createOverlayContainer(e):n};st.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)),et(r)&&(r=ye(r)),o=this._getOverlayContainer(n),i=ye('
'),at(i,{position:"absolute"}),i.appendChild(r),e.type&&Ae(i).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();wc(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())};st.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&&(Ge(i)&&i>t.scale||Ge(o)&&oi&&(a=(1/t.scale||1)*i)),Ge(a)&&(s="scale("+a+","+a+")"),Ih(o,s)};st.prototype._updateOverlaysVisibilty=function(e){var t=this;E(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})};st.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){Bt(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",mw,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&&Ae(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 gw(e){var t=ye('
');return at(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Bh(e,t,n){at(e,{left:t+"px",top:n+"px"})}function wc(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 $r={__init__:["overlays"],overlays:["type",st]};function Sc(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(tc(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)})}Sc.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var co={__init__:["changeSupport"],changeSupport:["type",Sc]};var vw=1e3;function k(e){this._eventBus=e}k.$inject=["eventBus"];function yw(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((Ne(t)||ee(t))&&(o=i,i=r,r=n,n=t,t=null),Ne(n)&&(o=i,i=r,r=n,n=vw),Ce(i)&&(o=i,i=!1),!Ne(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?yw(r,o):r,o)})};k.prototype.canExecute=ur("canExecute");k.prototype.preExecute=ur("preExecute");k.prototype.preExecuted=ur("preExecuted");k.prototype.execute=ur("execute");k.prototype.executed=ur("executed");k.prototype.postExecute=ur("postExecute");k.prototype.postExecuted=ur("postExecuted");k.prototype.revert=ur("revert");k.prototype.reverted=ur("reverted");function ur(e){return function(n,r,i,o,a){(Ne(n)||ee(n))&&(a=o,o=i,i=r,r=n,n=null),this.on(n,e,r,i,o,a)}}function ba(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(ba,k);ba.$inject=["canvas","injector"];var Lh={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",ba]};function lr(e){return CSS.escape(e)}var _w={"&":"&","<":"<",">":">",'"':""","'":"'"};function Cc(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return _w[t]})}var jh="_plane";function Ol(e){var t=e.id;return xw(t)}function on(e){var t=e.id;return m(e,"bpmn:SubProcess")?Fh(t):t}function zr(e){return Fh(e)}function po(e){var t=se(e);return m(t,"bpmndi:BPMNPlane")}function Fh(e){return e+jh}function xw(e){return e.replace(new RegExp(jh+"$"),"")}var bw="bjs-breadcrumbs-shown";function Rc(e,t,n){var r=ye('
    '),i=n.getContainer(),o=Ae(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=Ew(c));var p=a.flatMap(function(l){var f=n.findRoot(on(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=Cc(l.name||l.id),_=ye('
  • '+h+"
  • ");return _.addEventListener("click",function(){n.setRootElement(f)}),_});r.innerHTML="";var u=p.length>1;o.toggle(bw,u),p.forEach(function(l){r.appendChild(l)})}e.on("root.set",function(c){s(c.element)})}Rc.$inject=["eventBus","elementRegistry","canvas"];function Ew(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 Pc(e,t){var n=null,r=new ww;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})}Pc.$inject=["eventBus","canvas"];function ww(){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 fr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(r,i){n._handleImport(i.definitions)})}fr.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)})}};fr.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),Cw(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};fr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=Sw(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)})};fr.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)};fr.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};fr.$inject=["eventBus","moddle"];function $h(e){return m(e,"bpmndi:BPMNDiagram")?e:$h(e.$parent)}function Sw(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)}}),ui(t)}function Cw(e,t){var n=e.$parent;return!(!m(n,"bpmn:SubProcess")||n===t.bpmnElement||Q(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Ac=250,Rw='',Pw="bjs-drilldown-empty";function Kn(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",Ac,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Ac,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Ac,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"],Ac,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(Kn,k);Kn.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}};Kn.prototype._canDrillDown=function(e){var t=this._canvas;return m(e,"bpmn:SubProcess")&&t.findRoot(on(e))};Kn.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;Ae(r.html).toggle(Pw,!i)}};Kn.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=ye('"),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(on(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)};Kn.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})};Kn.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];var zh={__depends__:[$r,co,Lh],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Rc],drilldownCentering:["type",Pc],drilldownOverlayBehavior:["type",Kn],subprocessCompatibility:["type",fr]};function Vh(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function dr(e){return e.originalEvent||e.srcEvent}function Tc(e){Vh(e),Vh(dr(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 Mc(){return/mac/i.test(navigator.platform)}function Wh(e,t){return(dr(e)||e).button===t}function an(e){return Wh(e,0)}function Gh(e){return Wh(e,1)}function hr(e){var t=dr(e)||e;return an(e)?Mc()?t.metaKey:t.ctrlKey:!1}function mi(e){var t=dr(e)||e;return an(e)&&t.shiftKey}function Aw(e){return!0}function Dc(e){return an(e)||Gh(e)}var Uh=500;function kc(e,t,n){var r=this;function i(M,B,I){if(!s(M,B)){var H,z,K;I?z=t.getGraphics(I):(H=B.delegateTarget||B.target,H&&(z=H,I=t.get(z))),!(!z||!I)&&(K=e.fire(M,{element:I,gfx:z,originalEvent:B}),K===!1&&(B.stopPropagation(),B.preventDefault()))}}var o={};function a(M){return o[M]}function s(M,B){var I=p[M]||an;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":Aw,"element.mousedown":Dc,"element.mouseup":Dc,"element.click":Dc,"element.dblclick":Dc};function u(M,B,I){var H=c[M];if(!H)throw new Error("unmapped DOM event name <"+M+">");return i(H,B,I)}var l="svg, .djs-element";function f(M,B,I,H){var z=o[I]=function(K){i(I,K)};H&&(p[I]=H),z.$delegate=ut.bind(M,l,B,z)}function d(M,B,I){var H=a(I);H&&ut.unbind(M,B,H.$delegate)}function h(M){E(c,function(B,I){f(M,I,B)})}function _(M){E(c,function(B,I){d(M,I,B)})}e.on("canvas.destroy",function(M){_(M.svg)}),e.on("canvas.init",function(M){h(M.svg)}),e.on(["shape.added","connection.added"],function(M){var B=M.element,I=M.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:I})}),e.on(["shape.changed","connection.changed"],Uh,function(M){var B=M.element,I=M.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:I})}),e.on("interactionEvents.createHit",Uh,function(M){var B=M.element,I=M.gfx;r.createDefaultHit(B,I)}),e.on("interactionEvents.updateHit",function(M){var B=M.element,I=M.gfx;r.updateDefaultHit(B,I)});var v=S("djs-hit djs-hit-stroke"),w=S("djs-hit djs-hit-click-stroke"),P=S("djs-hit djs-hit-all"),b=S("djs-hit djs-hit-no-move"),x={all:P,"click-stroke":w,stroke:v,"no-move":b};function S(M,B){return B=C({stroke:"white",strokeWidth:15},B||{}),n.cls(M,["no-fill","no-border"],B)}function A(M,B){var I=x[B];if(!I)throw new Error("invalid hit type <"+B+">");return $(M,I),M}function O(M,B){Z(M,B)}this.removeHits=function(M){var B=ci(".djs-hit",M);E(B,be)},this.createDefaultHit=function(M,B){var I=M.waypoints,H=M.isFrame,z;return I?this.createWaypointsHit(B,I):(z=H?"stroke":"all",this.createBoxHit(B,z,{width:M.width,height:M.height}))},this.createWaypointsHit=function(M,B){var I=jn(B);return A(I,"stroke"),O(M,I),I},this.createBoxHit=function(M,B,I){I=C({x:0,y:0},I);var H=G("rect");return A(H,B),$(H,I),O(M,H),H},this.updateDefaultHit=function(M,B){var I=me(".djs-hit",B);if(I)return M.waypoints?pa(I,M.waypoints):$(I,{width:M.width,height:M.height}),I},this.fire=i,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}kc.$inject=["eventBus","elementRegistry","styles"];var Vr={__init__:["interactionEvents"],interactionEvents:["type",kc]};function Wr(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)})}Wr.$inject=["eventBus","canvas"];Wr.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})}};Wr.prototype.get=function(){return this._selectedElements};Wr.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1};Wr.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 Oc(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)})})}Oc.$inject=["canvas","eventBus"];function Nc(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(Tw))}}),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(an(i)){var o=i.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=mi(i);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Nc.$inject=["eventBus","selection","canvas","elementRegistry"];function Tw(e){return!e.hidden}var qe={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Vr],selection:["type",Wr],selectionVisuals:["type",Oc],selectionBehavior:["type",Nc]};function sn(e){Be.call(this,e)}N(sn,Be);sn.prototype._modules=[Nh,zh,$r,qe,Hr];sn.prototype._moddleExtensions={};var qh=["c","C"],Xh=["v","V"],Mw=["d","D"],Dw=["x","X"],Zh=["y","Y"],Nl=["z","Z"];function Qh(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function lt(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function ze(e,t){return e=U(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Bc(e){return e.shiftKey}function Jh(e){return lt(e)&&ze(qh,e)}function em(e){return lt(e)&&ze(Xh,e)}function tm(e){return lt(e)&&ze(Mw,e)}function nm(e){return lt(e)&&ze(Dw,e)}function rm(e){return lt(e)&&!Bc(e)&&ze(Nl,e)}function im(e){return lt(e)&&(ze(Zh,e)||ze(Nl,e)&&Bc(e))}var Ic="keyboard.keydown",kw="keyboard.keyup",Ow=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 bt(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")})}bt.$inject=["config.keyboard","eventBus"];bt.prototype._keydownHandler=function(e){this._keyHandler(e,Ic)};bt.prototype._keyupHandler=function(e){this._keyHandler(e,kw)};bt.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var r={keyEvent:e};n=this._eventBus.fire(t||Ic,r),n&&e.preventDefault()}};bt.prototype._isEventIgnored=function(e){return!1};bt.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")};bt.prototype.getBinding=function(){return this._node};bt.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};bt.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})};bt.prototype.addListener=function(e,t,n){Ne(e)&&(n=t,t=e,e=Ow),this._eventBus.on(n||Ic,e,t)};bt.prototype.removeListener=function(e,t){this._eventBus.off(t||Ic,e)};bt.prototype.hasModifier=Qh;bt.prototype.isCmd=lt;bt.prototype.isShift=Bc;bt.prototype.isKey=ze;var Nw=500;function mr(e,t){var n=this;e.on("editorActions.init",Nw,function(r){var i=r.editorActions;n.registerBindings(t,i)})}mr.$inject=["eventBus","keyboard"];mr.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(ze(["+","Add","="],i)&<(i))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(r){var i=r.keyEvent;if(ze(["-","Subtract"],i)&<(i))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(r){var i=r.keyEvent;if(ze("0",i)&<(i))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(r){var i=r.keyEvent;if(ze(["Backspace","Delete","Del"],i))return t.trigger("removeSelection"),!0})};var uo={__init__:["keyboard","keyboardBindings"],keyboard:["type",bt],keyboardBindings:["type",mr]};var Bw={moveSpeed:50,moveSpeedAccelerated:200};function Lc(e,t,n){var r=this;this._config=C({},Bw,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})}}Lc.$inject=["config.keyboardMove","keyboard","canvas"];var jc={__depends__:[uo],__init__:["keyboardMove"],keyboardMove:["type",Lc]};var Iw=/^djs-cursor-.*$/;function gi(e){var t=Ae(document.body);t.removeMatching(Iw),e&&t.add("djs-cursor-"+e)}function Fc(){gi(null)}var Lw=5e3;function Hc(e,t){t=t||"element.click";function n(){return!1}return e.once(t,Lw,n),function(){e.off(t,n)}}function lo(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Et(e,t){return{x:e.x-t.x,y:e.y-t.y}}var jw=15;function $c(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=Et(u,c);if(!n.dragging&&Fw(l)>jw&&(n.dragging=!0,p===0&&Hc(e),gi("grab")),n.dragging){var f=n.last||n.start;l=Et(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,Fc()}function a(s){if(!Sn(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}}$c.$inject=["eventBus","canvas"];function Fw(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}var zc={__init__:["moveCanvas"],moveCanvas:["type",$c]};function Ea(e){return Math.log(e)/Math.log(10)}function Bl(e,t){var n=Ea(e.min),r=Ea(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 Hw=Math.sign||function(e){return e>=0?1:-1},Il={min:.2,max:4},sm=10,$w=.1,zw=.75;function _n(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Je(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||zw;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=Bl(Il,sm*2);this._totalDelta+=t,Math.abs(this._totalDelta)>$w&&(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||Mc()&&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))*Hw(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=Bl(Il,sm);this._zoom(t,n,r)};_n.prototype._zoom=function(e,t,n){var r=this._canvas,i=e>0?1:-1,o=Ea(r.zoom()),a=Math.round(o/n)*n;a+=n*i;var s=Math.pow(10,a);r.zoom(am(Il,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 Vc={__init__:["zoomScroll"],zoomScroll:["type",_n]};function gr(e){sn.call(this,e)}N(gr,sn);gr.prototype._navigationModules=[jc,zc,Vc];gr.prototype._modules=[].concat(sn.prototype._modules,gr.prototype._navigationModules);function Ll(e){return e&&e[e.length-1]}function cm(e){return e.y}function pm(e){return e.x}var Vw={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 Gr(e,t){this._modeling=e,this._rules=t}Gr.$inject=["modeling","rules"];Gr.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}};Gr.prototype._isType=function(e,t){return t.indexOf(e)!==-1};Gr.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=Ll(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=St(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Ll(c).center,o;p=t[0],t=St(t,function(f){return f[r]+f[i]}),u=Ll(t),o[e]=l(p,u)}return o};Gr.prototype.trigger=function(e,t){var n=this._modeling,r,i=J(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=Vw[t],a=St(i,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};var um={__init__:["alignElements"],alignElements:["type",Gr]};var Ww=new Un;function Ur(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Ur.$inject=["eventBus"];Ur.prototype.schedule=function(e,t=Ww.next()){this.cancel(t);let n=this._schedule(e,t);return this._scheduled[t]=n,n.promise};Ur.prototype._schedule=function(e,t){let n=Gw();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}};Ur.prototype.cancel=function(e){let t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)};Ur.prototype._cancel=function(e){clearTimeout(e.executionId)};function Gw(){let e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}var lm={scheduler:["type",Ur]};var Uw="djs-element-hidden",Wc=".entry",Kw=1e3,fm=8,Yw=300;function Xe(e,t,n,r){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=r,this._current=null,this._init()}Xe.$inject=["canvas","elementRegistry","eventBus","scheduler"];Xe.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()};Xe.prototype._createContainer=function(){var e=ye('
    ');return this._canvas.getContainer().appendChild(e),e};Xe.prototype.registerProvider=function(e,t){t||(t=e,e=Kw),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})};Xe.prototype.getEntries=function(e){var t=this._getProviders(),n=U(e)?"getMultiElementContextPadEntries":"getContextPadEntries",r={};return E(t,function(i){if(Ne(i[n])){var o=i[n](e);Ne(o)?r=o(r):E(o,function(a,s){r[s]=a})}}),r};Xe.prototype.trigger=function(e,t,n){var r=this,i,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(i=Ye(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){r._mouseout=r.triggerEntry(i,"hover",o,n)},Yw);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(i,e,o,n)};Xe.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(Ne(s)){if(t==="click")return s(n,i,r)}else if(s[t])return s[t](n,i,r);n.preventDefault()}}}};Xe.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))};Xe.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers};Xe.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=ye(i.html||'
    '),c;Ye(s,"data-action",o),c=me("[data-group="+lr(a)+"]",n),c||(c=ye('
    '),Ye(c,"data-group",a),n.appendChild(c)),c.appendChild(s),i.className&&qw(s,i.className),i.title&&Ye(s,"title",i.title),i.imageUrl&&(r=ye(""),Ye(r,"src",i.imageUrl),r.style.width="100%",r.style.height="100%",s.appendChild(r))}),Ae(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})};Xe.prototype._createHtml=function(e){var t=this,n=ye('
    ');return ut.bind(n,Wc,"click",function(r){t.trigger("click",r)}),ut.bind(n,Wc,"dragstart",function(r){t.trigger("dragstart",r)}),ut.bind(n,Wc,"mouseover",function(r){t.trigger("mouseover",r)}),ut.bind(n,Wc,"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};Xe.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()&&Zw(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}};Xe.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)};Xe.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};Xe.prototype.isShown=function(){return this.isOpen()&&Ae(this._current.html).has("open")};Xe.prototype.show=function(){this.isOpen()&&(Ae(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))};Xe.prototype.hide=function(){this.isOpen()&&(Ae(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))};Xe.prototype._getPosition=function(e){if(!U(e)&&fe(e)){var t=this._canvas.viewbox(),n=Xw(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}};Xe.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")};Xe.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,Uw)});i?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")};Xe.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=Ae(e);t=U(t)?t:t.split(/\s+/g),t.forEach(function(r){n.add(r)})}function Xw(e){return e.waypoints[e.waypoints.length-1]}function Zw(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 Gc={__depends__:[Vr,lm,$r],contextPad:["type",Xe]};var Qc,Ve,vm,Qw,Kr,dm,ym,_m,jl,Kc,wa,xm,zl,Fl,Hl,Jw,qc={},Xc=[],eS=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Jc=Array.isArray;function vr(e,t){for(var n in t)e[n]=t[n];return e}function Vl(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ep(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?Qc.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 Yc(e,a,r,i,null)}function Yc(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&&Ve.vnode!=null&&Ve.vnode(o),o}function tp(e){return e.children}function Sa(e,t){this.props=e,this.context=t}function fo(e,t){if(t==null)return e.__?fo(e.__,e.__i+1):null;for(var n;tt&&Kr.sort(_m),e=Kr.shift(),t=Kr.length,tS(e)}finally{Kr.length=Zc.__r=0}}function Em(e,t,n,r,i,o,a,s,c,p,u){var l,f,d,h,_,v,w,P=r&&r.__k||Xc,b=t.length;for(c=nS(n,t,P,c,b),l=0;l0?a=e.__k[o]=Yc(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=rS(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"||eS.test(t)?n:n+"px"}function Uc(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[wa]=r[wa]:(n[wa]=zl,e.addEventListener(t,o?Hl:Fl,o)):e.removeEventListener(t,o?Hl:Fl,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[Kc]==null)t[Kc]=zl++;else if(t[Kc]0?e:Jc(e)?e.map(Cm):vr({},e)}function iS(e,t,n,r,i,o,a,s,c){var p,u,l,f,d,h,_,v=n.props||qc,w=t.props,P=t.type;if(P=="svg"?i="http://www.w3.org/2000/svg":P=="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 Oe=Tm.bind(ep);var ho,rt,Ul,Mm,Ca=0,jm=[],ct=Ve,Dm=ct.__b,km=ct.__r,Om=ct.diffed,Nm=ct.__c,Bm=ct.unmount,Im=ct.__;function ip(e,t){ct.__h&&ct.__h(rt,e,Ca||t),Ca=0;var n=rt.__H||(rt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function op(e){return Ca=1,Fm(Hm,e)}function Fm(e,t,n){var r=ip(ho++,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=rt,!rt.__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};rt.__f=!0;var o=rt.shouldComponentUpdate,a=rt.componentWillUpdate;rt.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)},rt.shouldComponentUpdate=i}return r.__N||r.__}function Ra(e,t){var n=ip(ho++,3);!ct.__s&&Yl(n.__H,t)&&(n.__=e,n.u=t,rt.__H.__h.push(n))}function mo(e,t){var n=ip(ho++,4);!ct.__s&&Yl(n.__H,t)&&(n.__=e,n.u=t,rt.__h.push(n))}function Pa(e){return Ca=5,Yn(function(){return{current:e}},[])}function Yn(e,t){var n=ip(ho++,7);return Yl(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function go(e,t){return Ca=8,Yn(function(){return e},t)}function aS(){for(var e;e=jm.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(rp),t.__h.some(Kl),t.__h=[]}catch(n){t.__h=[],ct.__e(n,e.__v)}}}ct.__b=function(e){rt=null,Dm&&Dm(e)},ct.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Im&&Im(e,t)},ct.__r=function(e){km&&km(e),ho=0;var t=(rt=e.__c).__H;t&&(Ul===rt?(t.__h=[],rt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(rp),t.__h.some(Kl),t.__h=[],ho=0)),Ul=rt},ct.diffed=function(e){Om&&Om(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(jm.push(t)!==1&&Mm===ct.requestAnimationFrame||((Mm=ct.requestAnimationFrame)||sS)(aS)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Ul=rt=null},ct.__c=function(e,t){t.some(function(n){try{n.__h.some(rp),n.__h=n.__h.filter(function(r){return!r.__||Kl(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],ct.__e(r,n.__v)}}),Nm&&Nm(e,t)},ct.unmount=function(e){Bm&&Bm(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{rp(r)}catch(i){t=i}}),n.__H=void 0,t&&ct.__e(t,n.__v))};var Lm=typeof requestAnimationFrame=="function";function sS(e){var t,n=function(){clearTimeout(r),Lm&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Lm&&(t=requestAnimationFrame(n))}function rp(e){var t=rt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),rt=t}function Kl(e){var t=rt;e.__c=e.__(),rt=t}function Yl(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 $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;tpS(t),[t]),s=p=>p.action&&!p.disabled,c=(p,u)=>{if(s(u))return n(p,u)};return Oe`

    ${o}

    ${a.map(p=>Oe`
      ${p.entries.map(u=>Oe`
    • <${s(u)?"button":"span"} class=${uS(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&&Oe``||u.imageHtml&&Oe`
      `} ${u.label?Oe` ${u.label} `:null}
    • `)}
    `)}
    `}function pS(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 uS(e,t){return vi("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Xl(e){let{entry:t,selected:n,onMouseEnter:r,onMouseLeave:i,onAction:o}=e,a=(s,c)=>{if(!t.disabled)return o(s,t,c)};return Oe`
  • a(s,"dragstart")} draggable=${!0} >
    ${t.imageUrl&&Oe``||t.imageHtml&&Oe`
    `} ${t.label?Oe` ${t.label} `:null} ${t.description&&Oe` ${t.description} `}
    ${t.documentationRef&&Oe`
    s.stopPropagation()} title="Open element documentation" target="_blank" rel="noopener" >
    `}
  • `}function Zl(e){let{selectedEntry:t,setSelectedEntry:n,groupedEntries:r,...i}=e,o=Pa();return mo(()=>{let a=o.current;if(!a)return;let s=a.querySelector(".selected");s&&lS(s)},[t]),Oe`
    ${r.map(a=>Oe` ${a.name&&Oe`
    ${a.name}
    `}
      ${a.entries.map(s=>Oe` <${Xl} key=${s.id} entry=${s} selected=${s===t} onMouseEnter=${()=>n(s)} onMouseLeave=${()=>n(null)} ...${i} /> `)}
    `)}
    `}function lS(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}function Ql(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,_=Yn(()=>Ge(p)?f.length>5:!1,[p,f]),[v,w]=op(""),P=go((H,z)=>{if(!_)return H;if(!z.trim())return H.filter(({rank:ce=0})=>ce>=0);let K=H.filter(({searchable:ce})=>ce!==!1);return l(K,z,{keys:["label","search","description"]}).map(({item:ce})=>ce)},[_]),b=Yn(()=>P(f,v),[f,v,P]),[x,S]=op(b[0]),A=Yn(()=>v.trim()?b.length?[{id:"default",entries:b}]:[]:hS(b),[b,v]);Ra(()=>{S(b[0])},[b]);let O=go(H=>{let z=dS(A),ce=z.indexOf(x)+H;ce<0&&(ce=z.length-1),ce>=z.length&&(ce=0),S(z[ce])},[A,x,S]),M=go(H=>{if(H.key==="Enter"&&x)return x.disabled?void 0:n(H,x);if(H.key==="ArrowUp")return O(-1),H.preventDefault();if(H.key==="ArrowDown")return O(1),H.preventDefault()},[n,x,O]),B=go(H=>{Zs(H.target,"input")&&w(()=>H.target.value)},[w]);Ra(()=>(d(),()=>{h()}),[]);let I=Yn(()=>a||i.length>0,[a,i]);return Oe` <${zm} onClose=${t} onKeyup=${B} onKeydown=${M} className=${r} position=${o} width=${s} scale=${c} > ${I&&Oe` <${ql} headerEntries=${i} onSelect=${n} selectedEntry=${x} setSelectedEntry=${S} title=${a} /> `} ${f.length>0&&Oe`
    ${_&&Oe` `} <${Zl} groupedEntries=${A} selectedEntry=${x} setSelectedEntry=${S} onAction=${n} />
    `} ${u&&b.length===0&&Oe`
    ${Ne(u)?u(v):u}
    `} `}function zm(e){let{onClose:t,onKeydown:n,onKeyup:r,className:i,children:o,position:a}=e,s=Pa();return mo(()=>{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]),mo(()=>{let c=s.current;if(!c)return;(c.querySelector("input")||c).focus()},[]),Ra(()=>{let c=u=>{if(u.key==="Escape")return u.preventDefault(),t()},p=u=>{if(!Sn(u.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",c),document.body.addEventListener("click",p),()=>{document.documentElement.removeEventListener("keydown",c),document.body.removeEventListener("click",p)}},[]),Oe`
    ${o}
    `}function fS(e){return{transform:`scale(${e.scale})`,width:`${e.width}px`,"transform-origin":"top left"}}function dS(e){let t=[];return e.forEach(n=>{n.entries.forEach(r=>{t.push(r)})}),t}function hS(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 mS="data-id",Vm=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],gS=1e3;function je(e,t,n,r){this._eventBus=t,this._canvas=n,this._search=r,this._current=null;var i=Ge(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()})}je.$inject=["config.popupMenu","eventBus","canvas","search"];je.prototype._render=function(){let{position:e,providerId:t,entries:n,headerEntries:r,emptyPlaceholder:i,options:o}=this._current,a=Object.entries(n).map(([f,d])=>({id:f,...d})),s=Object.entries(r).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),p=this._updateScale(this._current.container);np(Oe` <${Ql} 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)};je.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");this.isOpen()&&this.close();let{entries:i,headerEntries:o,emptyPlaceholder:a}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:i,headerEntries:o,emptyPlaceholder:a,container:this._createContainer({provider:t}),options:r},this._emit("open"),this._bindAutoClose(),this._render()};je.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()};je.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)}};je.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)};je.prototype.reset=function(){let e=this._current.container;np(null,e),Bt(e)};je.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)};je.prototype._onOpened=function(){this._emit("opened")};je.prototype._onClosed=function(){this._emit("closed")};je.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();let r=ye(`
    `);return n.appendChild(r),r};je.prototype._bindAutoClose=function(){this._eventBus.once(Vm,this.close,this)};je.prototype._unbindAutoClose=function(){this._eventBus.off(Vm,this.close,this)};je.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),Ge(n)&&er&&(i=r)),i};je.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.yNe(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()};je.prototype.isOpen=function(){return!!this._current};je.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let i=Sn(e.delegateTarget||e.target,".entry",!0),o=Ye(i,mS);t={id:o,...this._getEntry(o)}}let r=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Ne(r)){if(n==="click")return r(e,t)}else if(r[n])return r[n](e,t)}};je.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 Jl(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=vS(o,i,r);return a?{item:o,tokens:a}:[]}).sort(yS(r))}function vS(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}=Km(l,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Km(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...p}}},{matchedWords:{},tokens:{}});return Object.keys(r).length!==t.length?null:i}function yS(e){return(t,n)=>{let r=0,i=1;for(let o of e){let a=_S(t.tokens[o],n.tokens[o]);if(a!==0){r+=a*i,i*=Wm;continue}let s=xS(t.item[o],n.item[o]);if(s!==0){r+=s*i,i*=Wm;continue}}return r}}function _S(e,t){return Gm(t)-Gm(e)}var Wm=.5,vo={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Gm(e){let t=e.reduce((s,c)=>s+Ym(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 Ym(e){if(U(e))return Math.max(...e.map(Ym));let t=Math.log(e.value.length);return e.match?(e.start?e.end?vo.FULL:e.wordEnd?vo.START_FULL_WORD:vo.START_WORD_PART:e.wordStart?vo.WORD_START:vo.WORD_PART)*t:vo.NO_MATCH*t}function Um(e=""){return U(e)?e.join(", "):e}function xS(e,t){return Um(e).localeCompare(Um(t))}function Km(e,t){var p;if(!e)return{tokens:[],matchedWords:{}};let n=[],r={},i=t.map(bS),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,_=!!((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:_});let P=_?t:[u];for(let b of P)r[b.toLowerCase()]=!0;c=s.index+u.length}return c `,bottom:` `,center:` `,left:` `,right:` `,top:` `,middle:` `},sp=ES;var wS=900;function Yr(e,t,n,r){e.registerProvider(wS,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}Yr.$inject=["contextPad","popupMenu","translate","canvas"];Yr.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&C(t,this._getEntries(e)),t};Yr.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")};Yr.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`
    ${sp.align}
    `,action:{click:function(t,n){var r=e._getMenuPosition(n);C(r,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",r)}}}}};Yr.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 SS=["left","center","right","top","middle","bottom"];function yi(e,t,n,r){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",this)}yi.$inject=["popupMenu","alignElements","translate","rules"];yi.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&C(t,this._getEntries(e)),t};yi.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})};yi.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,r=this._popupMenu,i={};return E(SS,function(o){i["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:sp[o],action:function(){t.trigger(e,o),r.close()}}}),i};function Ct(e){k.call(this,e),this.init()}Ct.$inject=["eventBus"];N(Ct,k);Ct.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)})};Ct.prototype.init=function(){};function _o(e){Ct.call(this,e)}_o.$inject=["eventBus"];N(_o,Ct);_o.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=J(t,function(r){return!(r.waypoints||r.host||r.labelTarget)});return n=Dr(n),n.length<2?!1:n})};var qm={__depends__:[um,Gc,yo],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Yr],alignElementsMenuProvider:["type",yi],bpmnAlignElements:["type",_o]};var CS=10,tf=50,RS=250;function cp(e,t,n,r){for(var i;i=PS(e,n,t);)n=r(t,n,i);return n}function pp(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 PS(e,t,n){var r={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},i=AS(e);return ne(i,function(o){if(o===n)return!1;var a=Le(o,r,CS);return a==="intersect"})}function Xm(e,t){t||(t={});function n(h){return h.source===e?1:-1}var r=t.defaultDistance||tf,i=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||RS,c=t.reference||"start";o||(o=DS);function p(h,_){return i==="n"?c==="start"?X(h).top-X(_).bottom:c==="center"?X(h).top-Y(_).y:X(h).top-X(_).top:i==="w"?c==="start"?X(h).left-X(_).right:c==="center"?X(h).left-Y(_).x:X(h).left-X(_).left:i==="s"?c==="start"?X(_).top-X(h).bottom:c==="center"?Y(_).y-X(h).bottom:X(_).bottom-X(h).bottom:c==="start"?X(_).left-X(h).right:c==="center"?Y(_).x-X(h).right:X(_).right-X(h).right}var u=e.incoming.filter(o).map(function(h){var _=a(h),v=_<0?p(h.source,e):p(e,h.source);return{id:h.source.id,distance:v,weight:_}}),l=e.outgoing.filter(o).map(function(h){var _=a(h),v=_>0?p(e,h.target):p(h.target,e);return{id:h.target.id,distance:v,weight:_}}),f=u.concat(l).reduce(function(h,_){return h[_.id+"__weight_"+_.weight]=_,h},{}),d=Ke(f,function(h,_){var v=_.distance,w=_.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 bo(e){e.invoke(Tn,this)}bo.$inject=["injector"];N(bo,Tn);bo.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 _i(e){Ct.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}_i.$inject=["eventBus"];N(_i,Ct);_i.prototype.canResize=function(e,t){return!1};function Eo(e,t){_i.call(this,e),this._modeling=t}N(Eo,_i);Eo.$inject=["eventBus","modeling"];Eo.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")||te(r)){n=!1;return}}),n};var Jm={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",bo],bpmnAutoResizeProvider:["type",Eo]};var eg=1500;function mp(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",eg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",eg,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),FS(c)}}mp.$inject=["elementRegistry","eventBus","injector"];function FS(e){return Sn(e,"svg, .djs-element",!0)}var tg={__init__:["hoverFix"],hoverFix:["type",mp]};var wo=Math.round,ng="djs-drag-active";function xi(e){e.preventDefault()}function HS(e){return typeof TouchEvent!="undefined"&&e instanceof TouchEvent}function $S(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function gp(e,t,n,r){var i={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),S=t._container.getBoundingClientRect();return{x:x.x+(b.x-S.left)/x.scale,y:x.y+(b.y-S.top)/x.scale}}function s(b,x){x=x||o;var S=e.createEvent(C({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,S)===!1?!1:e.fire(x.prefix+"."+b,S)}function c(b){var x=b.filter(function(S){return r.get(S.id)});x.length&&n.select(x)}function p(b,x){var S=o.payload,A=o.displacement,O=o.globalStart,M=yn(b),B=Et(M,O),I=o.localStart,H=a(M),z=Et(H,I);if(!o.active&&(x||$S(B)>o.threshold)){if(C(S,{x:wo(I.x+A.x),y:wo(I.y+A.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return v();o.active=!0,o.keepSelection||(S.previousSelection=n.get(),n.select(null)),o.cursor&&gi(o.cursor),t.addMarker(t.getRootElement(),ng)}Tc(b),o.active&&(C(S,{x:wo(H.x+A.x),y:wo(H.y+A.y),dx:wo(z.x),dy:wo(z.y)},{originalEvent:b}),s("move"))}function u(b){var x,S=!0;o.active&&(b&&(o.payload.originalEvent=b,Tc(b)),S=s("end")),S===!1&&s("rejected"),x=w(S!==!0),s("ended",x)}function l(b){ze("Escape",b)&&(xi(b),v())}function f(b){var x;o.active&&(x=Hc(e),setTimeout(x,400),xi(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 _(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function v(b){var x;if(o){var S=o.active;S&&s("cancel"),x=w(b),S&&s("canceled",x)}}function w(b){var x,S;s("cleanup"),Fc(),o.trapClick?S=f:S=u,ae.unbind(document,"mousemove",p),ae.unbind(document,"dragstart",xi),ae.unbind(document,"selectstart",xi),ae.unbind(document,"mousedown",S,!0),ae.unbind(document,"mouseup",S,!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",_),t.removeMarker(t.getRootElement(),ng);var A=o.payload.previousSelection;return b!==!1&&A&&!n.get().length&&c(A),x=o,o=null,x}function P(b,x,S,A){o&&v(!1),typeof x=="string"&&(A=S,S=x,x=null),A=C({},i,A||{});var O=A.data||{},M,B,I,H,z;A.trapClick?H=f:H=u,b?(M=dr(b)||b,B=yn(b),Tc(b),M.type==="dragstart"&&xi(M)):(M=null,B={x:0,y:0}),I=a(B),x||(x=I),z=HS(M),o=C({prefix:S,data:O,payload:{},globalStart:B,displacement:Et(x,I),localStart:I,isTouch:z},A),A.manual||(z?(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",xi),ae.bind(document,"selectstart",xi),ae.bind(document,"mousedown",H,!0),ae.bind(document,"mouseup",H,!0)),ae.bind(document,"keyup",l),e.on("element.hover",h),e.on("element.out",_)),s("init"),A.autoActivate&&p(b,!0)}e.on("diagram.destroy",v),this.init=P,this.move=p,this.hover=h,this.out=_,this.end=u,this.cancel=v,this.context=function(){return o},this.setOptions=function(b){C(i,b)}}gp.$inject=["eventBus","canvas","selection","elementRegistry"];var wt={__depends__:[tg,qe],dragging:["type",gp]};function qr(e,t,n){this._canvas=n,this._opts=C({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()})}qr.$inject=["config.autoScroll","eventBus","canvas"];qr.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++)zS(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 zS(e,t,n){return tA-3&&(B=Le(d.target,S),_===A-2?B==="intersect"&&(b.pop(),b[b.length-1]=S):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,hg)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(l){var f=l.context.hover;f&&n.removeMarker(f,hg)}),t.on("connectionSegment.move.cleanup",function(l){var f=l.context,d=f.connection;f.draggerGfx&&be(f.draggerGfx),n.removeMarker(d,mg)}),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,_=f.newSegmentStartIndex;h=h.map(function(S){return{original:S.original,x:Math.round(S.x),y:Math.round(S.y)}});var v=u(h,_),w=v.waypoints,P=s(d,w),b=v.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:_+b}};o.updateWaypoints(d,P,x)})}Sp.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var r1=Math.abs,_g=Math.round;function xg(e,t,n){n=n===void 0?10:n;var r,i;for(r=0;ro-sf)return a-c+o}return a}function n(o,a){if(o.waypoints)return sg(a,o);if(o.width)return{x:bg(o.width/2+o.x),y:bg(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 _=[p[l-1],u,f,p[d+1]];return l<2&&_.unshift(n(c.source,o)),d>p.length-3&&_.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},E(_,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;C(o,{dx:o.dx-l,dy:o.dy-f,x:p,y:u}),(l||a.vertical.indexOf(s)!==-1)&&Ie(o,"x",p),(f||a.horizontal.indexOf(c)!==-1)&&Ie(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);!fe(s)||!c||!c.x||!c.y||(Ie(o,"x",c.x),Ie(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,_=l-d;C(o,{dx:o.dx-h,dy:o.dy-_,x:o.x-h,y:o.y-_}),(h||s.vertical.indexOf(u)!==-1)&&Ie(o,"x",f),(_||s.horizontal.indexOf(l)!==-1)&&Ie(o,"y",d)}})}Ap.$inject=["eventBus"];var Eg={__depends__:[wt,ft],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",bp],bendpointMove:["type",Ba],bendpointMovePreview:["type",wp],connectionSegmentMove:["type",Sp],bendpointSnapping:["type",Ap]};function Mp(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),!Rr(u)){if(u!==!1){s.source=c,s.target=p;return}u=s.canExecute=o(c,p),!Rr(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:Tp(s)?u:p,connectionEnd:Tp(s)?p:u};Ce(c)&&(d=c),s.connection=n.connect(l,f,d,h)}),this.start=function(a,s,c,p){Ce(c)||(p=c,c=Y(s)),t.init(a,"connect",{autoActivate:p,data:{shape:s,context:{start:s,connectionStart:c}}})}}Mp.$inject=["eventBus","dragging","modeling","rules"];function Tp(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}var o1=1100,a1=900,wg="connect-ok",Sg="connect-not-ok";function Dp(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,_=d;Tp(o)&&(h=d,_=f),r.drawPreview(o,a,{source:c||p,target:l||s,connectionStart:h,connectionEnd:_})}),t.on("connect.hover",a1,function(i){var o=i.context,a=i.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?wg:Sg)}),t.on(["connect.out","connect.cleanup"],o1,function(i){var o=i.hover;o&&(n.removeMarker(o,wg),n.removeMarker(o,Sg))}),r&&t.on("connect.cleanup",function(i){r.cleanUp(i.context)})}Dp.$inject=["injector","eventBus","canvas"];var So={__depends__:[qe,ft,wt],__init__:["connectPreview"],connect:["type",Mp],connectPreview:["type",Dp]};var s1="djs-dragger";function Dn(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)}Dn.$inject=["injector","canvas","graphicsFactory","elementFactory"];Dn.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()),or(r),i||(i=e.getConnection=c1(function(_,v,w){return h.getConnection(_,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?Y(o):c,a?Y(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)"})};Dn.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||Y(n),o=t.connectionEnd||Y(r),a=this.cropWaypoints(i,o,n,r),s=this.createNoopConnection(a[0],a[1]);Z(e,s)};Dn.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&&Ir(o,s,!0)||e,t=r&&Ir(a,s,!1)||t,[e,t]};Dn.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&be(e.connectionPreviewGfx)};Dn.prototype.getConnection=function(e){var t=p1(e);return this._elementFactory.createConnection(t)};Dn.prototype.createConnectionPreviewGfx=function(){var e=G("g");return $(e,{pointerEvents:"none"}),ue(e).add(s1),Z(this._canvas.getActiveLayer(),e),e};Dn.prototype.createNoopConnection=function(e,t){return jn([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function c1(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 p1(e){return Ce(e)?e:{}}var Cg={__init__:["connectionPreview"],connectionPreview:["type",Dn]};var u1=new Un("ps"),l1=["marker-start","marker-mid","marker-end"],f1=["circle","ellipse","line","path","polygon","polyline","path","rect"];function qn(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r}qn.$inject=["elementRegistry","eventBus","canvas","styles"];qn.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")};qn.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)};qn.prototype.addDragger=function(e,t,n,r="djs-dragger"){n=n||this.getGfx(e);var i=tl(n),o=n.getBoundingClientRect();return this._cloneMarkers(Rn(i),r),$(i,this._styles.cls(r,[],{x:o.top,y:o.left})),Z(t,i),$(i,"data-preview-support-element-id",e.id),i};qn.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),$(n,"data-preview-support-element-id",e.id),n};qn.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var r=this;e.childNodes&&e.childNodes.forEach(i=>{r._cloneMarkers(i,t,n)}),g1(e)&&l1.forEach(function(i){if($(e,i)){var o=d1(e,i,r._canvas.getContainer());o&&r._cloneMarker(n,e,o,i,t)}})};qn.prototype._cloneMarker=function(e,t,n,r,i="djs-dragger"){var o=[n.id,i,u1.next()].join("-"),a=me("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||tl(n);s.id=o,ue(s).add(i);var c=me(":scope > defs",e);c||(c=G("defs"),Z(e,c)),Z(c,s);var p=m1(s.id);$(t,r,p)};function d1(e,t,n){var r=h1($(e,t));return me("marker#"+r,n||document)}function h1(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function m1(e){return"url(#"+e+")"}function g1(e){return f1.indexOf(e.nodeName)!==-1}var xn={__init__:["previewSupport"],previewSupport:["type",qn]};var kp="complex-preview",Co=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(kp);n.filter(s=>!v1(s)).forEach(s=>{let c;fe(s)?(c=this._graphicsFactory._createContainer("connection",G("g")),this._graphicsFactory.drawConnection(Rn(c),s)):(c=this._graphicsFactory._createContainer("shape",G("g")),this._graphicsFactory.drawShape(Rn(c),s),ke(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);fe(s)?ke(p,c.x,c.y):ke(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(Rn(p),s,{width:c.width,height:c.height}),ke(p,c.x,c.y),this._previewSupport.addDragger(s,a,p)})}cleanUp(){or(this._canvas.getLayer(kp)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(kp)}hide(){this._canvas.hideLayer(kp)}};Co.$inject=["canvas","graphicsFactory","previewSupport"];function v1(e){return e.hidden}var Rg={__depends__:[xn],__init__:["complexPreview"],complexPreview:["type",Co]};var cf=["top","bottom","left","right"],Op=10;function La(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(Fr(i)&&!fe(i)){var o=x1(i);o&&r(i,o)}}function r(i,o){var a=Y(i),s=i.label,c=Y(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=Et(u,c);t.moveShape(s,l)}}}N(La,k);La.$inject=["eventBus","modeling"];function y1(e){var t=e.host,n=Y(e),r=Le(n,t),i;r.indexOf("-")>=0?i=r.split("-"):i=[r];var o=cf.filter(function(a){return i.indexOf(a)===-1});return o}function _1(e){var t=Y(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 x1(e){var t=Y(e.label),n=Y(e),r=Pg(n,t);if(b1(r)){var i=_1(e);if(e.host){var o=y1(e);i=i.concat(o)}var a=cf.filter(function(s){return i.indexOf(s)===-1});if(a.indexOf(r)===-1)return a[0]}}function Pg(e,t){return Le(t,e,5)}function b1(e){return cf.indexOf(e)!==-1}function ja(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(ja,k);ja.$inject=["eventBus"];function Fa(e,t){e.invoke(k,this),this.postExecute("shape.move",function(n){var r=n.newParent,i=n.shape,o=J(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(Fa,k);Fa.$inject=["injector","modeling"];var Ag=500;function Ro(e,t){t.invoke(k,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Ag,function(r){var i=r.elements;i=i.filter(function(o){var a=o.host;return Tg(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",Ag,function(r){var i=r.shapes,o=r.newHost;if(i.length===1){var a=i[0];Tg(a,o)&&(r.shapes=[n._replaceShape(a,o)])}},!0)}Ro.$inject=["bpmnReplace","injector"];N(Ro,k);Ro.prototype._replaceShape=function(e,t){var n=E1(e),r={type:"bpmn:BoundaryEvent",host:t};return n&&(r.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,r,{layoutConnection:!1})};function E1(e){var t=L(e),n=t.eventDefinitions;return n&&n[0]}function Tg(e,t){return!te(e)&&Q(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Ha(e,t){k.call(this,e);function n(r){return J(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)})})}Ha.$inject=["eventBus","modeling"];N(Ha,k);function za(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,P=v.target;Po(w)&&$a(P)&&u(P)}function i(v){let w=v.connection,P=v.source,b=v.target;Po(P)&&Np(b)&&(p(b),f(P,[w]))}function o(v){let w=v.newTarget,P=v.oldSource,b=v.oldTarget;if(b!==w){let x=P;$a(b)&&u(b),Po(x)&&Np(w)&&p(w)}}function a(v){let{element:w}=v;$a(w)?(l(w),d(w)):Np(w)&&h(w)}function s(v){let{newData:w,oldShape:P}=v;if(Po(v.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){let b=P.outgoing.find(({target:x})=>$a(x));b&&b.target&&(v._connectionTarget=b.target)}else if(!Po(v.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){let b=P.outgoing.find(({target:x})=>Np(x));b&&b.target&&(v._connectionTarget=b.target),_(P)}}function c(v){let{_connectionTarget:w,newShape:P}=v;w&&t.connect(P,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=>$a(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(P=>Po(P.source));t.removeElements(w)}function _(v){let w=v.outgoing.filter(P=>m(P,"bpmn:SequenceFlow"));t.removeElements(w)}}N(za,k);za.$inject=["eventBus","modeling","bpmnRules"];function $a(e){let t=L(e);return t&&t.get("isForCompensation")}function Po(e){return e&&m(e,"bpmn:BoundaryEvent")&&cr(e,"bpmn:CompensateEventDefinition")}function Np(e){return e&&m(e,"bpmn:Activity")&&!Ue(e)}function Va(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=yr(r,"bpmn:Participant"))})}Va.$inject=["injector"];N(Va,k);function Wa(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}})}Wa.$inject=["eventBus","bpmnFactory"];N(Wa,k);var pf=20,uf=20,Mg=30,Bp=2e3;function Ga(e,t,n){k.call(this,t),t.on(["create.start","shape.move.start"],Bp,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")&&!te(l)&&!fe(l)});if(c.length){var p=Ee(c),u=w1(a,p);C(a,u),o.createConstraints=S1(a,p)}}}),t.on("create.start",Bp,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",Bp,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",Bp,function(i){var o=i.elements,a=i.parent,s=C1(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)}Ga.$inject=["canvas","eventBus","modeling"];N(Ga,k);function w1(e,t){t={width:t.width+pf*2+Mg,height:t.height+uf*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 S1(e,t){return t=X(t),{bottom:t.top+e.height/2-uf,left:t.right-e.width/2+pf,top:t.bottom-e.height/2+uf,right:t.left+e.width/2-pf-Mg}}function C1(e){return ne(e,function(t){return m(t,"bpmn:Participant")})}var Dg="__targetRef_placeholder";function Ua(e,t){k.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],kg(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],kg(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===Dg});return!p&&s&&(p=t.create("bpmn:Property",{name:Dg}),we(c,p)),p}function i(a,s){var c=r(a);c&&(n(a,c,s)||Te(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,_=h&&h.businessObject,v=c.businessObject,w;_&&_!==l&&i(_,p),d&&d!==l&&i(d,p),l?(w=r(l,!0),v.targetRef=w):v.targetRef=null}}Ua.$inject=["eventBus","bpmnFactory"];N(Ua,k);function kg(e){return function(t){var n=t.context,r=n.connection;if(m(r,"bpmn:DataInputAssociation"))return e(t)}}function Ao(e){this._bpmnUpdater=e}Ao.$inject=["bpmnUpdater"];Ao.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),[]};Ao.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 Ka(e,t,n,r){k.call(this,r),t.registerHandler("dataStore.updateContainment",Ao);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:P1(u,"bpmn:Participant");a(p,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,p=c.shape,u=e.getRootElement();Q(p,["bpmn:Participant","bpmn:SubProcess"])&&m(u,"bpmn:Collaboration")&&o(u).filter(function(l){return R1(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)})})}Ka.$inject=["canvas","commandStack","elementRegistry","eventBus"];N(Ka,k);function R1(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 P1(e,t){for(;e.parent;){if(m(e.parent,t))return e.parent;e=e.parent}}var Lp=Math.max,jp=Math.min,A1=20;function Fp(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 Ng(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 Ip(e,t,n){var r=t[e],i=n.min&&n.min[e],o=n.max&&n.max[e];return ee(i)&&(r=(/top|left/.test(e)?jp:Lp)(r,i)),ee(o)&&(r=(/top|left/.test(e)?Lp:jp)(r,o)),r}function Bg(e,t){if(!t)return e;var n=X(e);return ui({top:Ip("top",n,t),right:Ip("right",n,t),bottom:Ip("bottom",n,t),left:Ip("left",n,t)})}function Ig(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:jp(o.top,a.top),left:jp(o.left,a.left),bottom:Lp(o.bottom,a.bottom),right:Lp(o.right,a.right)};return ui(s)}function Ya(e,t){return typeof e!="undefined"?e:A1}function T1(e,t){var n,r,i,o;return typeof t=="object"?(n=Ya(t.left),r=Ya(t.right),i=Ya(t.top),o=Ya(t.bottom)):n=r=i=o=Ya(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+o}}function M1(e){return!(e.waypoints||e.type==="label")}function Hp(e,t){var n;if(e.length===void 0?n=J(e.children,M1):n=e,n.length)return T1(Ee(n),t)}var Xr=Math.abs;function D1(e,t){return Fp(X(t),X(e))}var k1=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Yt=30;function To(e,t){return t=t||[],e.children.filter(function(n){m(n,"bpmn:Lane")&&(To(n,t),t.push(n))}),t}function cn(e){return e.children.filter(function(t){return m(t,"bpmn:Lane")})}function Rt(e){return yr(e,k1)||e}function Lg(e,t){var n=Rt(e),r=m(n,"bpmn:Process")?[]:[n],i=To(n,r),o=X(e),a=X(t),s=D1(e,t),c=[],p=Re(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,_=X(u);s.top&&(Xr(_.bottom-o.top)<10&&(d=a.top-_.bottom),Xr(_.top-o.top)<5&&(l=a.top-_.top)),s.left&&(Xr(_.right-o.left)<10&&(f=a.left-_.right),Xr(_.left-o.left)<5&&(h=a.left-_.left)),s.bottom&&(Xr(_.top-o.bottom)<10&&(l=a.bottom-_.top),Xr(_.bottom-o.bottom)<5&&(d=a.bottom-_.bottom)),s.right&&(Xr(_.left-o.right)<10&&(h=a.right-_.left),Xr(_.right-o.right)<5&&(f=a.right-_.right)),(l||f||d||h)&&c.push({shape:u,newBounds:Ng(u,{top:l,right:f,bottom:d,left:h})})}}),c}var O1=500;function qa(e,t){k.call(this,e);function n(r,i){var o=Re(r),a=cn(i),s=[],c=[],p=[],u=[];if(Cn(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,_;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&&(_=t.calculateAdjustments(u,"x",-l,r.x+r.width+10),t.makeSpace(_.movingShapes,_.resizingShapes,{x:-l,y:0},"w"))}}this.postExecuted("shape.delete",O1,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))})}qa.$inject=["eventBus","spaceTool"];N(qa,k);var jg=500;function Mo(e,t){t.invoke(k,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",jg,function(r){var i=r.elements;i.filter(function(o){var a=o.host;return Fg(o,a)}).map(function(o){return i.indexOf(o)}).forEach(function(o){r.elements[o]=n._replaceShape(i[o])})},!0),this.preExecute("elements.move",jg,function(r){var i=r.shapes,o=r.newHost;i.forEach(function(a,s){var c=a.host;Fg(a,B1(i,c)?c:o)&&(i[s]=n._replaceShape(a))})},!0)}Mo.$inject=["bpmnReplace","injector"];N(Mo,k);Mo.prototype._replaceShape=function(e){var t=N1(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function N1(e){var t=L(e),n=t.eventDefinitions;return n&&n[0]}function Fg(e,t){return!te(e)&&m(e,"bpmn:BoundaryEvent")&&!t}function B1(e,t){return e.indexOf(t)!==-1}function Xa(e,t,n){k.call(this,e);function r(i,o,a){var s=o.waypoints,c,p,u,l,f,d,h,_=i.outgoing.slice(),v=i.incoming.slice(),w;ee(a.width)?w=Y(a):w=a;var P=Ta(s,w);if(P){if(c=s.slice(0,P.index),p=s.slice(P.index+(P.bendpoint?1:0)),!c.length||!p.length)return;u=P.bendpoint?s[P.index]:w,(c.length===1||!Hg(i,c[c.length-1]))&&c.push($g(u)),(p.length===1||!Hg(i,p[0]))&&p.unshift($g(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&&J(v,function(x){return x.source===d.source})||[],h&&J(_,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=Y(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&&Ta(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(Xa,k);Xa.$inject=["eventBus","bpmnRules","modeling"];function Hg(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 $g(e){return C({},e)}function Za(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)&&Do(i)){var c=[];m(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(p=>p!==i&&Do(p)):c=a.incoming.filter(p=>p!==i&&Do(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(Do).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Do).forEach(function(s){let c=a.incoming.filter(Do).filter(function(p){return p.source===i});(s.source!==i||c.length>1)&&t.removeConnection(s)})})}})}Za.$inject=["eventBus","modeling"];N(Za,k);function Do(e){return m(e,"bpmn:SequenceFlow")}var $p=1500,zg=2e3;function zp(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"],$p,function(r){var i=r.context,o=i.shape||r.shape,a=r.hover;m(a,"bpmn:Lane")&&!Q(o,["bpmn:Lane","bpmn:Participant"])&&(r.hover=Rt(a),r.hoverGfx=e.getGraphics(r.hover));var s=n.getRootElement();a!==s&&(o.labelTarget||Q(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"],$p,function(r){var i=r.hover;m(i,"bpmn:Lane")&&(r.hover=Rt(i)||i,r.hoverGfx=e.getGraphics(r.hover))}),t.on(["bendpoint.move.hover"],$p,function(r){var i=r.context,o=r.hover,a=i.type;m(o,"bpmn:Lane")&&/reconnect/.test(a)&&(r.hover=Rt(o)||o,r.hoverGfx=e.getGraphics(r.hover))}),t.on(["connect.start"],$p,function(r){var i=r.context,o=i.start;m(o,"bpmn:Lane")&&(i.start=Rt(o)||o)}),t.on("shape.move.start",zg,function(r){var i=r.shape;m(i,"bpmn:Lane")&&(r.shape=Rt(i)||i)}),t.on("spaceTool.move",zg,function(r){var i=r.hover;i&&m(i,"bpmn:Lane")&&(r.hover=Rt(i))})}zp.$inject=["elementRegistry","eventBus","canvas"];function Vg(e){return e.create("bpmn:Category")}function Wg(e){return e.create("bpmn:CategoryValue")}function Gg(e,t,n){return we(t.get("categoryValue"),e),e.$parent=t,we(n.get("rootElements"),t),t.$parent=n,e}function Ug(e){var t=e.$parent;return t&&(Te(t.get("categoryValue"),e),e.$parent=null),e}function Kg(e){var t=e.$parent;return t&&(Te(t.get("rootElements"),e),e.$parent=null),e}var Yg=770;function Qa(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,_){return h.some(function(v){var w=L(v),P=w.categoryValueRef&&w.categoryValueRef.$parent;return P===_})}function c(h,_){return h.some(function(v){var w=L(v);return w.categoryValueRef===_})}function p(h,_,v){var w=a().filter(function(P){return P.businessObject!==v});_&&!s(w,_)&&Kg(_),h&&!c(w,h)&&Ug(h)}function u(h,_){return Gg(h,_,t.getDefinitions())}function l(h,_){var v=L(h),w=v.categoryValueRef;w||(w=v.categoryValueRef=_.categoryValue=_.categoryValue||Wg(e));var P=w.$parent;P||(P=w.$parent=_.category=_.category||Vg(e)),u(w,P,t.getDefinitions())}function f(h,_){var v=_.category,w=_.categoryValue,P=L(h);w?(P.categoryValueRef=null,p(w,v,P)):p(null,P.categoryValueRef.$parent,P)}this.execute("label.create",function(h){var _=h.context,v=_.labelTarget;m(v,"bpmn:Group")&&l(v,_)}),this.revert("label.create",function(h){var _=h.context,v=_.labelTarget;m(v,"bpmn:Group")&&f(v,_)}),this.execute("shape.delete",function(h){var _=h.context,v=_.shape,w=L(v);if(!(!m(v,"bpmn:Group")||v.labelTarget)){var P=_.categoryValue=w.categoryValueRef,b;P&&(b=_.category=P.$parent,p(P,b,w),w.categoryValueRef=null)}}),this.reverted("shape.delete",function(h){var _=h.context,v=_.shape;if(!(!m(v,"bpmn:Group")||v.labelTarget)){var w=_.category,P=_.categoryValue,b=L(v);P&&(b.categoryValueRef=P,u(P,w))}}),this.execute("shape.create",function(h){var _=h.context,v=_.shape;!m(v,"bpmn:Group")||v.labelTarget||L(v).categoryValueRef&&l(v,_)}),this.reverted("shape.create",function(h){var _=h.context,v=_.shape;!m(v,"bpmn:Group")||v.labelTarget||L(v).categoryValueRef&&f(v,_)});function d(h,_){var v=e.create(h.$type);return o.copyElement(h,v,null,_)}r.on("copyPaste.copyElement",Yg,function(h){var _=h.descriptor,v=h.element;if(!(!m(v,"bpmn:Group")||v.labelTarget)){var w=L(v);if(w.categoryValueRef){var P=w.categoryValueRef;_.categoryValue=d(P,!0),P.$parent&&(_.category=d(P.$parent,!0))}}}),r.on("copyPaste.pasteElement",Yg,function(h){var _=h.descriptor,v=_.businessObject,w=_.categoryValue,P=_.category;w&&(w=v.categoryValueRef=d(w)),P&&(w.$parent=d(P)),delete _.category,delete _.categoryValue})}Qa.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"];N(Qa,k);function ko(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 Vp(e){function t(r,i,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=ko(r,i,o,a),p=ko(r,i,o,s),u;c&&p?qg(c,o)>qg(p,o)?u=p:u=c:u=c||p,r.original=u}function n(r){var i=r.waypoints;t(i[0],i[1],Y(r.source)),t(i[i.length-1],i[i.length-2],Y(r.target))}e.on("bpmnElement.added",function(r){var i=r.element;i.waypoints&&n(i)})}Vp.$inject=["eventBus"];function qg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ja(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(Q(i,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Ja.$inject=["eventBus"];N(Ja,k);var ev=Math.sqrt,tv=Math.min,I1=Math.max,Xg=Math.abs;function Zg(e){return Math.pow(e,2)}function es(e,t){return ev(Zg(e.x-t.x)+Zg(e.y-t.y))}function nv(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:Jg(r,p[0])?n:n+1}),p.length===2&&(s=F1(p[0],p[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:es(r,s)/es(r,i)}),l=es(u.position,e),(!d||f>l)&&(d=u,f=l)}return d}function L1(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=ev(d),_=-l+h,v=-l-h,w={x:e.x-i*_,y:e.y-o*_};if(d===0)return[w];var P={x:e.x-i*v,y:e.y-o*v};return[w,P].filter(function(b){return j1(b,e,t)})}function j1(e,t,n){return Qg(e.x,t.x,n.x)&&Qg(e.y,t.y,n.y)}function Qg(e,t,n){return e>=tv(t,n)-Wp&&e<=I1(t,n)+Wp}function F1(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Wp=.1;function Jg(e,t){return Xg(e.x-t.x)<=Wp&&Xg(e.y-t.y)<=Wp}function iv(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=rv(n,c),l=rv(t,p),f=s.position,d=$1(u,f),h=H1(u,l);if(s.type==="bendpoint"){var _=t.length-n.length,v=s.bendpointIndex,w=n[v];if(t.indexOf(w)!==-1)return a;if(_===0){var P=t[v];return i=P.x-s.position.x,o=P.y-s.position.y,{delta:{x:i,y:o},point:{x:e.x+i,y:e.y+o}}}_<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(sv in p&&t.updateLabel(c,p[sv]),cv in p&&m(c,"bpmn:TextAnnotation")){var u=r.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},p[cv]||"");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;te(p)||!nn(p)||xt(p)&&t.updateLabel(p,xt(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=C({},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),av(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&&nn(u)&&p.label&&c.label&&(c.label.x=p.label.x,c.label.y=p.label.y)}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,p=s.newBounds,u=s.oldBounds;if(Fr(c)){var l=c.label,f=Y(l),d=Y1(u),h=K1(f,d),_=U1(h,u,p);t.moveShape(l,_)}})}N(ts,k);ts.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function U1(e,t,n){var r=Si(e,t,n);return gn(Et(r,e))}function K1(e,t){if(t.length){var n=q1(e,t);return Ma(e,n)}}function Y1(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 q1(e,t){var n=t.map(function(i){return{line:i,distance:yp(e,i)}}),r=St(n,"distance");return r[0].line}function pv(e,t,n,r){return Gp(e,t,n,r).point}function ns(e,t){k.call(this,e);function n(r,i){var o=r.context,a=o.connection,s=C({},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),pv(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(ns,k);ns.$inject=["eventBus","modeling"];function Zr(e,t,n){var r=Up(e),i=lv(r,t),o=r[0];return i.length?i[i.length-1]:Si(o.original||o,n,t)}function Qr(e,t,n){var r=Up(e),i=lv(r,t),o=r[r.length-1];return i.length?i[0]:Si(o.original||o,n,t)}function Oo(e,t,n){var r=Up(e),i=uv(t,n),o=r[0];return Si(o.original||o,i,t)}function No(e,t,n){var r=Up(e),i=uv(t,n),o=r[r.length-1];return Si(o.original||o,i,t)}function uv(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Up(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function lv(e,t){var n=He(e,Z1);return J(n,function(r){return X1(r,t)})}function X1(e,t){return Le(t,e,1)==="intersect"}function Z1(e){return e.original||e}function rs(e,t){k.call(this,e),this.postExecute("shape.replace",function(n){var r=n.oldShape,i=n.newShape;if(Q1(r,i)){var o=J1(r);o.incoming.forEach(function(a){var s=Qr(a,i,r);t.reconnectEnd(a,i,s)}),o.outgoing.forEach(function(a){var s=Zr(a,i,r);t.reconnectStart(a,i,s)})}},!0)}rs.$inject=["eventBus","modeling"];N(rs,k);function Q1(e,t){return m(e,"bpmn:Participant")&&ie(e)&&m(t,"bpmn:Participant")&&!ie(t)}function J1(e){var t=Fn([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 eC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Kp(e){let t=L(e);if(!m(t,"bpmn:BoundaryEvent")&&!(m(t,"bpmn:StartEvent")&&Ue(t.$parent)))return!1;let n=t.get("eventDefinitions");return!n||!n.length?!1:eC.some(r=>m(n[0],r))}function Yp(e){return m(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function is(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(!Kp(i))return;let a=Yp(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})})}is.$inject=["injector","modeling"];N(is,k);function os(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(os,k);os.$inject=["eventBus","modeling"];function as(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=tC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}N(as,k);as.$inject=["eventBus","bpmnRules","modeling"];function Bo(e){return e.original||e}function tC(e,t){var n=ko(Bo(e[e.length-2]),Bo(e[e.length-1]),Bo(t[1]),Bo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Bo(e[0]),Bo(t[t.length-1])]}function ss(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)}ss.$inject=["eventBus","modeling"];N(ss,k);function cs(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,yt({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(cs,k);cs.$inject=["eventBus","modeling","bpmnRules","injector"];function Io(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=Ke(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){Ue(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(Io,k);Io.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)};Io.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var nC=1500,fv={width:140,height:120},qp={width:300,height:60},Xp={width:60,height:300},ps={width:300,height:150},us={width:150,height:300},ff={width:140,height:120},df={width:50,height:30};function Zp(e){e.on("resize.start",nC,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=sC(r,i,o)),m(r,"bpmn:SubProcess")&&ie(r)&&(n.minDimensions=ff),m(r,"bpmn:TextAnnotation")&&(n.minDimensions=df)})}Zp.$inject=["eventBus"];var Jr=Math.abs,rC=Math.min,iC=Math.max;function dv(e,t,n,r){var i=e[t];e[t]=i===void 0?n:r(n,i)}function Lo(e,t,n){return dv(e,t,n,rC)}function jo(e,t,n){return dv(e,t,n,iC)}var oC={top:20,left:50,right:20,bottom:20},aC={top:50,left:20,right:20,bottom:20};function sC(e,t,n){var r=Rt(e),i=!0,o=!0,a=To(r,[r]),s=X(e),c={},p={},u=Re(e),l=u?qp:Xp;/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 _=X(h);u?(_.tops.bottom+10&&(o=!1)):(_.lefts.right+10&&(o=!1)),/n/.test(t)&&(n&&Jr(s.top-_.bottom)<10&&jo(c,"top",_.top+l.height),Jr(s.top-_.top)<5&&Lo(p,"top",_.bottom-l.height)),/e/.test(t)&&(n&&Jr(s.right-_.left)<10&&Lo(c,"right",_.right-l.width),Jr(s.right-_.right)<5&&jo(p,"right",_.left+l.width)),/s/.test(t)&&(n&&Jr(s.bottom-_.top)<10&&Lo(c,"bottom",_.bottom-l.height),Jr(s.bottom-_.bottom)<5&&jo(p,"bottom",_.top+l.height)),/w/.test(t)&&(n&&Jr(s.left-_.right)<10&&jo(c,"left",_.left+l.width),Jr(s.left-_.left)<5&&Lo(p,"left",_.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?oC:aC;return f.forEach(function(h){var _=X(h);/n/.test(t)&&(!u||i)&&Lo(p,"top",_.top-d.top),/e/.test(t)&&(u||o)&&jo(p,"right",_.right+d.right),/s/.test(t)&&(!u||o)&&jo(p,"bottom",_.bottom+d.bottom),/w/.test(t)&&(u||i)&&Lo(p,"left",_.left-d.left)}),{min:p,max:c}}var hv=1001;function Qp(e,t){e.on("resize.start",hv+500,function(n){var r=n.context,i=r.shape;(m(i,"bpmn:Lane")||m(i,"bpmn:Participant"))&&(r.balanced=!hr(n))}),e.on("resize.end",hv,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=oc(a),t.resizeLane(i,a,r.balanced)),!1})}Qp.$inject=["eventBus","modeling"];var cC=500;function ls(e,t,n,r,i){n.invoke(k,this);function o(u){return Q(u,["bpmn:ReceiveTask","bpmn:SendTask"])||pC(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var l=e.getDefinitions(),f=l.get("rootElements");return!!ne(f,yt({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(Q(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(Q(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"),we(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");Te(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",cC,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)})}ls.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"];N(ls,k);function pC(e,t){return U(t)||(t=[t]),Nt(t,function(n){return cr(e,n)})}var mv=Math.max;function Jp(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]=lC(a,r,i)),m(a,"bpmn:Lane")&&(o[s]=Re(a)?qp:Xp),m(a,"bpmn:SubProcess")&&ie(a)&&(o[s]=ff),m(a,"bpmn:TextAnnotation")&&(o[s]=df),m(a,"bpmn:Group")&&(o[s]=fv)}),o})}Jp.$inject=["eventBus"];function uC(e){return e==="x"}function lC(e,t,n){var r=Re(e);if(!hC(e))return r?ps:us;var i=uC(t),o={};return i?r?o=ps:o={width:dC(e,n,i),height:us.height}:r?o={width:ps.width,height:fC(e,n,i)}:o=us,o}function fC(e,t,n){var r;return r=mC(e,t,n),mv(ps.height,r)}function dC(e,t,n){var r;return r=gC(e,t,n),mv(us.width,r)}function hC(e){return!!cn(e).length}function mC(e,t,n){var r=cn(e),i;return i=hf(r,t,n),e.height-i.height+qp.height}function gC(e,t,n){var r=cn(e),i;return i=hf(r,t,n),e.width-i.width+Xp.width}function hf(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=cn(i),o.length?hf(o,t,n):i}function mf(e){let t=[];return E(e.incoming,n=>{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 Ci(e){let t=new Map;return E(la(e,!0,-1),n=>{E(mf(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 gv=400,vC=600,vv={x:180,y:160};function kn(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")&&!ie(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(on(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(on(d));if(!(!h||!d.children||!d.children.length)){var _=yv(d);s._showRecursively(_),s._moveChildrenToShape(_,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")||!ie(f)||E(Ci([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(l){var f=l.shape;if(c(f)){var d=a.get(on(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(on(f)))},!0),this.postExecuted("shape.replace",function(l){var f=l.newShape,d=l.oldRoot,h=e.findRoot(on(f));if(!(!d||!h)){var _=d.children;n.moveElements(_,{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,_=h.id,v=d.id;if(_!==v){if(po(f)){a.updateId(f,zr(v)),a.updateId(_,v);return}var w=a.get(zr(_));w&&a.updateId(zr(_),zr(v))}}},!0),this.reverted("element.updateProperties",function(l){var f=l.element;if(m(f,"bpmn:SubProcess")){var d=l.properties,h=l.oldProperties,_=h.id,v=d.id;if(_!==v){if(po(f)){a.updateId(f,zr(_)),a.updateId(v,_);return}var w=a.get(zr(v));w&&a.updateId(w,zr(_))}}},!0),t.on("element.changed",function(l){var f=l.element;if(po(f)){var d=f,h=a.get(Ol(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",gv,function(l){var f=l.shape;m(f,"bpmn:SubProcess")&&(ie(f)?u(l):(p(l),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",gv,function(l){var f=l.shape;m(f,"bpmn:SubProcess")&&(ie(f)?u(l):(p(l),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",vC,function(l){var f=l.shape;if(m(f,"bpmn:SubProcess")){var d=l.newRootElement;if(d)if(ie(f))s._moveChildrenToShape(d.children.slice(),f),E(Ci(f.children),_=>{n.moveShape(_.annotation,{x:0,y:0},f.parent),E(_.associations,v=>{n.moveConnection(v,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=yv(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(l){var f=l.element,d=l.children;if(c(f)){var h=on(f),_=a.get(h);_&&d.push.apply(d,_.children)}}),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,d=l.element,h=l.elements,_=d.parent,v=m(se(_),"bpmndi:BPMNPlane");if(v){var w=Ol(_),P=ne(h,function(b){return b.id===w});P&&(f.parent=P.id)}}),t.on("copyPaste.pasteElement",function(l){var f=l.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}N(kn,k);kn.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=Ee(r),o;if(!t.x)o={x:vv.x-i.x,y:vv.y-i.y};else{var a=Y(t),s=Y(i);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}};kn.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(mf(e).map(r=>r.annotation));n.size&&E(Ci(e.children),r=>{n.has(r.annotation)&&E(r.associations,i=>{t.removeConnection(i)})})};kn.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};kn.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};kn.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:on(e),type:e.$type,di:r,businessObject:e,collapsed:!0});return o};kn.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};kn.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function yC(e){var t=[];return E(Ci(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function yv(e){return e.children.slice().concat(yC(e.children)).concat(_C(e))}function _C(e){return la(e.children||[],!0,-1).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function fs(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"))||!ie(i))){var o=xC(i);t.createShape({type:"bpmn:StartEvent"},o,i)}})}fs.$inject=["injector","modeling"];N(fs,k);function xC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function ds(e){k.call(this,e),this.preExecute("connection.create",function(t){let{target:n}=t;m(n,"bpmn:TextAnnotation")&&(t.parent=n.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(t){let n=t.shapes||[t.shape];n.length===1&&m(n[0],"bpmn:TextAnnotation")&&(t.hints=t.hints||{},t.hints.autoResize=!1)},!0)}N(ds,k);ds.$inject=["eventBus"];function hs(e,t){k.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var r=n.shape;if(ie(r))return;var i=Fn(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,Y(r)):t.reconnectStart(a,r,Y(r)))}},!0)}N(hs,k);hs.$inject=["eventBus","modeling"];var gf=500;function ms(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=bC(c).concat([a]),l=Hp(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"],gf,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"],gf,function(a){var s=a.context,c=s.shape;c.collapsed?se(c).isExpanded=!1:se(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],gf,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(ms,k);ms.$inject=["eventBus","elementFactory","modeling"];function bC(e){return e.filter(function(t){return!t.hidden})}function gs(e,t,n,r){t.invoke(k,this),this.preExecute("shape.delete",function(i){var o=i.context,a=o.shape,s=a.businessObject;te(a)||(m(a,"bpmn:Participant")&&ie(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(gs,k);gs.$inject=["canvas","injector","moddle","modeling"];function vs(e,t){k.call(this,e),this.preExecute("connection.delete",function(n){var r=n.context,i=r.connection,o=i.source;EC(i,o)&&t.updateProperties(o,{default:null})})}N(vs,k);vs.$inject=["eventBus","modeling"];function EC(e,t){if(!m(e,"bpmn:SequenceFlow"))return!1;var n=L(t),r=L(e);return n.get("default")===r}var wC=500,SC=5e3;function ys(e,t){k.call(this,e);var n;function r(){return n=n||new CC,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,SC,function(s){r()}),this.postExecuted(a,wC,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))})}ys.$inject=["eventBus","modeling"];N(ys,k);function CC(){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 _s(e,t){k.call(this,e),this.postExecuted("elements.create",function(n){let r=n.context,i=r.elements;for(let o of i)RC(o)&&!AC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}N(_s,k);_s.$inject=["eventBus","modeling"];function RC(e){let t=L(e);return t&&t.isForCompensation}function PC(e){return e&&m(e,"bpmn:BoundaryEvent")&&cr(e,"bpmn:CompensateEventDefinition")}function AC(e){return e.incoming.filter(n=>PC(n.source)).length>0}var _v={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","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",La],appendBehavior:["type",ja],associationBehavior:["type",Fa],attachEventBehavior:["type",Ro],boundaryEventBehavior:["type",Ha],compensateBoundaryEventBehaviour:["type",za],createBehavior:["type",Va],createDataObjectBehavior:["type",Wa],createParticipantBehavior:["type",Ga],dataInputAssociationBehavior:["type",Ua],dataStoreBehavior:["type",Ka],deleteLaneBehavior:["type",qa],detachEventBehavior:["type",Mo],dropOnFlowBehavior:["type",Xa],eventBasedGatewayBehavior:["type",Za],fixHoverBehavior:["type",zp],groupBehavior:["type",Qa],importDockingFix:["type",Vp],isHorizontalFix:["type",Ja],labelBehavior:["type",ts],layoutConnectionBehavior:["type",ns],messageFlowBehavior:["type",rs],nonInterruptingBehavior:["type",is],removeElementBehavior:["type",as],removeEmbeddedLabelBoundsBehavior:["type",os],removeParticipantBehavior:["type",ss],replaceConnectionBehavior:["type",cs],replaceElementBehaviour:["type",Io],resizeBehavior:["type",Zp],resizeLaneBehavior:["type",Qp],rootElementReferenceBehavior:["type",ls],spaceToolBehavior:["type",Jp],subProcessPlaneBehavior:["type",kn],subProcessStartEventBehavior:["type",fs],textAnnotationBehavior:["type",ds],toggleCollapseConnectionBehaviour:["type",hs],toggleElementCollapseBehaviour:["type",ms],unclaimIdBehavior:["type",gs],unsetDefaultFlowBehavior:["type",vs],updateFlowNodeRefsBehavior:["type",ys],setCompensationActivityAfterPasteBehavior:["type",_s]};function eu(e,t){var n=Le(e,t,-15);return n!=="intersect"?n:null}function dt(e){Ct.call(this,e)}N(dt,Ct);dt.$inject=["eventBus"];dt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return TC(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 tu(t,n)}finally{i&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,r=e.target;return tu(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;return Ov(t,n)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,r=e.target;return fe(r)&&!nu(t,r,n)?!1:hn(t,function(i){return fe(i)?tu(i.source,i.target,i):i.host?xs(i,i.host,null,n):_f(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:xs(n,t,null,r)||Dv(n,t,r)||kv(n,t,r)||nu(n,t,r)}),this.addRule("shape.create",function(e){return _f(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return xs(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return jv(n,t)})};dt.prototype.canConnectMessageFlow=Iv;dt.prototype.canConnectSequenceFlow=Lv;dt.prototype.canConnectDataAssociation=bf;dt.prototype.canConnectAssociation=Nv;dt.prototype.canConnectCompensationAssociation=Bv;dt.prototype.canMove=kv;dt.prototype.canAttach=xs;dt.prototype.canReplace=Dv;dt.prototype.canDrop=Fo;dt.prototype.canInsert=nu;dt.prototype.canCreate=_f;dt.prototype.canConnect=tu;dt.prototype.canResize=Ov;dt.prototype.canCopy=jv;function TC(e){return vf(e)?null:Q(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function vf(e){return!e||te(e)}function xv(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 yf(e){return m(e,"bpmn:TextAnnotation")}function xf(e){return m(e,"bpmn:Group")&&!e.labelTarget}function Sv(e){return m(e,"bpmn:BoundaryEvent")&&Xn(e,"bpmn:CompensateEventDefinition")}function ru(e){return L(e).isForCompensation}function MC(e,t){var n=xv(e),r=xv(t);return n===r}function DC(e){return m(e,"bpmn:InteractionNode")&&!m(e,"bpmn:BoundaryEvent")&&(!m(e,"bpmn:Event")||m(e,"bpmn:ThrowEvent")&&Rv(e,"bpmn:MessageEventDefinition"))}function kC(e){return m(e,"bpmn:InteractionNode")&&!ru(e)&&(!m(e,"bpmn:Event")||m(e,"bpmn:CatchEvent")&&Rv(e,"bpmn:MessageEventDefinition"))&&!(m(e,"bpmn:BoundaryEvent")&&!Xn(e,"bpmn:MessageEventDefinition"))}function bv(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 Cv(e,t){var n=bv(e),r=bv(t);return n===r}function Xn(e,t){var n=L(e);return!!ne(n.eventDefinitions||[],function(r){return m(r,t)})}function Rv(e,t){var n=L(e);return(n.eventDefinitions||[]).every(function(r){return m(r,t)})}function OC(e){return m(e,"bpmn:FlowNode")&&!m(e,"bpmn:EndEvent")&&!Ue(e)&&!(m(e,"bpmn:IntermediateThrowEvent")&&Xn(e,"bpmn:LinkEventDefinition"))&&!Sv(e)&&!ru(e)}function NC(e){return m(e,"bpmn:FlowNode")&&!m(e,"bpmn:StartEvent")&&!m(e,"bpmn:BoundaryEvent")&&!Ue(e)&&!(m(e,"bpmn:IntermediateCatchEvent")&&Xn(e,"bpmn:LinkEventDefinition"))&&!ru(e)}function BC(e){return m(e,"bpmn:ReceiveTask")||m(e,"bpmn:IntermediateCatchEvent")&&(Xn(e,"bpmn:MessageEventDefinition")||Xn(e,"bpmn:TimerEventDefinition")||Xn(e,"bpmn:ConditionalEventDefinition")||Xn(e,"bpmn:SignalEventDefinition"))}function IC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Ev(e,t){var n=IC(t);return n.indexOf(e)!==-1}function tu(e,t,n){if(vf(e)||vf(t))return null;if(!m(n,"bpmn:DataAssociation")){if(Iv(e,t))return{type:"bpmn:MessageFlow"};if(Lv(e,t))return{type:"bpmn:SequenceFlow"}}var r=bf(e,t);return r||(Bv(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Nv(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Fo(e,t){return te(e)||xf(e)?!0:m(t,"bpmn:Participant")&&!ie(t)?!1:m(e,"bpmn:Participant")?m(t,"bpmn:Process")||m(t,"bpmn:Collaboration"):Q(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")&&!LC(e)?!1:m(e,"bpmn:FlowElement")&&!m(e,"bpmn:DataStoreReference")?m(t,"bpmn:FlowElementsContainer")?ie(t):Q(t,["bpmn:Participant","bpmn:Lane"]):m(e,"bpmn:DataStoreReference")&&m(t,"bpmn:Collaboration")?Nt(L(t).get("participants"),function(n){return!!n.get("processRef")}):Q(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Q(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 LC(e){return L(e).cancelActivity&&(Av(e)||Tv(e))}function Pv(e){return!te(e)&&m(e,"bpmn:BoundaryEvent")}function jC(e){return m(e,"bpmn:Lane")}function FC(e){return Pv(e)||m(e,"bpmn:IntermediateThrowEvent")&&Av(e)?!0:m(e,"bpmn:IntermediateCatchEvent")&&Tv(e)}function Av(e){var t=L(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Tv(e){return Mv(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Mv(e,t){return t.some(function(n){return Xn(e,n)})}function HC(e){return m(e,"bpmn:ReceiveTask")&&ne(e.incoming,function(t){return m(t.source,"bpmn:EventBasedGateway")})}function xs(e,t,n,r){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var i=e[0];return te(i)||!FC(i)||Ue(t)||!m(t,"bpmn:Activity")||ru(t)||r&&!eu(r,t)||HC(t)?!1:"attach"}function Dv(e,t,n){if(!t)return!1;var r={replacements:[]};return E(e,function(i){Ue(t)||m(i,"bpmn:StartEvent")&&i.type!=="label"&&Fo(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"}),Mv(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")||Xn(i,"bpmn:CancelEventDefinition")&&i.type!=="label"&&(m(i,"bpmn:EndEvent")&&Fo(i,t)&&r.replacements.push({oldElementId:i.id,newElementType:"bpmn:EndEvent"}),m(i,"bpmn:BoundaryEvent")&&xs(i,t,null,n)&&r.replacements.push({oldElementId:i.id,newElementType:"bpmn:BoundaryEvent"}))}),r.replacements.length?r:!1}function kv(e,t){return Nt(e,jC)?!1:t?e.every(function(n){return Fo(n,t)}):!0}function _f(e,t,n,r){return t?te(e)||xf(e)?!0:Fo(e,t,r)||nu(e,t,r):!1}function Ov(e,t){return m(e,"bpmn:SubProcess")?ie(e)&&(!t||t.width>=100&&t.height>=80):!!(m(e,"bpmn:Lane")||m(e,"bpmn:Participant")||yf(e)||xf(e))}function $C(e,t){var n=yf(e),r=yf(t);return(n||r)&&n!==r}function Nv(e,t){return Ev(t,e)||Ev(e,t)?!1:$C(e,t)?!0:!!bf(e,t)}function Bv(e,t){return Cv(e,t)&&Sv(e)&&m(t,"bpmn:Activity")&&!VC(t,e)&&!Ue(t)}function Iv(e,t){return wv(e)&&!wv(t)?!1:DC(e)&&kC(t)&&!MC(e,t)}function Lv(e,t){return OC(e)&&NC(t)&&Cv(e,t)&&!(m(e,"bpmn:EventBasedGateway")&&!BC(t))}function bf(e,t){return Q(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Q(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Q(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Q(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function nu(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:Q(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!te(t)&&m(e,"bpmn:FlowNode")&&!m(e,"bpmn:BoundaryEvent")&&Fo(e,t.parent,n)}function zC(e,t){return e&&t&&e.indexOf(t)!==-1}function jv(e,t){return te(t)?!0:!(m(t,"bpmn:Lane")&&!zC(e,t.parent))}function wv(e){return yr(e,"bpmn:Process")||yr(e,"bpmn:Collaboration")}function VC(e,t){return e.attachers.includes(t)}var Fv={__depends__:[ft],__init__:["bpmnRules"],bpmnRules:["type",dt]};var WC=2e3;function iu(e,t){e.on("saveXML.start",WC,n);function n(){var r=t.getRootElements();E(r,function(i){var o=se(i),a,s;a=Fn([i],!1),a=J(a,function(c){return c!==i&&!c.labelTarget}),s=He(a,se),o.set("planeElement",s)})}}iu.$inject=["eventBus","canvas"];var Hv={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",iu]};function Ho(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)})}Ho.prototype.getOrdering=function(e,t){return null};N(Ho,k);function bs(e,t){Ho.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 Q(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&&!Q(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=Ks(s.children,function(l){return!a.labelTarget&&l.labelTarget?!1:c.level0&&this._modeling.removeElements(r),t};Dt.prototype._getElementIdsFromTree=function(e){var t={};return E(e,function(n){E(n,function(r){r.id&&(t[r.id]=!0)})}),t};Dt.prototype._paste=function(e,t,n,r){E(e,function(o){ee(o.x)||(o.x=0),ee(o.y)||(o.y=0)});var i=Ee(e);return E(e,function(o){fe(o)&&(o.waypoints=He(o.waypoints,function(a){return{x:a.x-i.x-i.width/2,y:a.y-i.y-i.height/2}})),C(o,{x:o.x-i.x-i.width/2,y:o.y-i.y-i.height/2})}),this._modeling.createElements(e,n,t,C({},r))};Dt.prototype._createElements=function(e){var t=this,n=this._eventBus,r={},i=[];return E(e,function(o,a){a=parseInt(a,10),o=St(o,"priority"),E(o,function(s){var c=C({},At(s,["priority"]));r[s.parent]?c.parent=r[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:r,descriptor:c});var p;if(fe(c)){c.source=r[s.source],c.target=r[s.target],p=r[s.id]=t.createConnection(c),i.push(p);return}if(te(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};Dt.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(At(e,["id"]));return t};Dt.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(At(e,["id"]));return t};Dt.prototype.createShape=function(e){var t=this._elementFactory.createShape(At(e,["id"]));return t};Dt.prototype.hasRelations=function(e,t){var n,r,i;return!(fe(e)&&(r=ne(t,yt({id:e.source.id})),i=ne(t,yt({id:e.target.id})),!r||!i)||te(e)&&(n=ne(t,yt({id:e.labelTarget.id})),!n))};Dt.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[],o=Dr(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",wf,function(c){var p=c.cache,u=c.descriptor;a(p,s(u,p,o(p)))})}su.$inject=["bpmnFactory","eventBus","moddleCopy"];var ZC=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],QC=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Pi(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 St(i,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",r=>{let{parent:i,property:o,propertyName:a}=r,s=Ce(i)&&i.$descriptor;if(a&&QC.includes(a))return o;if(a&&ZC.includes(a)||a&&s&&!ne(s.properties,yt({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})}Pi.$inject=["eventBus","bpmnFactory","moddle"];Pi.prototype.copyElement=function(e,t,n,r=!1){n&&!U(n)&&(n=[n]),n=n||cu(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;tt(e,o)&&(a=e.get(o));let s=this.copyProperty(a,t,o,r);!Ge(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t};Pi.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 Ce(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)?Ke(e,(a,s)=>{let c=this.copyProperty(s,t,n,r);return c?a.concat(c):a},[]):Ce(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};Pi.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 cu(e,t){return Ke(e.properties,(n,r)=>t&&r.default?n:n.concat(r.name),[])}var pu={__depends__:[Qv],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",su],moddleCopy:["type",Pi]};var Jv=Math.round;function ws(e,t){this._modeling=e,this._eventBus=t}ws.$inject=["modeling","eventBus"];ws.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=Jv(s+o/2),u=Jv(c+a/2),l=r.replaceShape(e,C({},t,{x:p,y:u,width:o,height:a}),n);return i.fire("replace.end",{element:e,newElement:l,hints:n}),l};function uu(e,t){t.on("replace.end",500,function(n){let{newElement:r,hints:i={}}=n;i.select!==!1&&e.select(r)})}uu.$inject=["selection","eventBus"];var ey={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",uu],replace:["type",ws]};function JC(e,t,n){U(n)||(n=[n]),E(n,function(r){Ln(e[r])||(t[r]=e[r])})}var eR=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function tR(e,t){var n=e&&tt(e,"collapsed")?e.collapsed:!ie(e),r;return t&&(tt(t,"collapsed")||tt(t,"isExpanded"))?r=tt(t,"collapsed")?t.collapsed:!t.isExpanded:r=n,n!==r}function fu(e,t,n,r,i,o){function a(s,c,p){p=p||{};var u=c.type,l=s.businessObject;if(lu(l)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&tR(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),JC(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=cu(l.$descriptor),_=cu(f.$descriptor,!0),v=nR(h,_);C(f,pt(c,eR));var w=J(v,function(x){return x==="eventDefinitions"?ty(s,c.eventDefinitionType):x==="loopCharacteristics"?!Ue(f):tt(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!Ue(f):!0});if(f=n.copyElement(l,f,w),c.eventDefinitionType&&(ty(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),m(l,"bpmn:Activity")){if(lu(l))d.isExpanded=ie(s);else if(c&&tt(c,"isExpanded")){d.isExpanded=c.isExpanded;var P=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=P.width,d.height=P.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}ie(s)&&!m(l,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(lu(l)&&!lu(f)&&(p.moveChildren=!1),m(l,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):p.moveChildren=!1;var b=Re(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,Q(l,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Q(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}fu.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function lu(e){return m(e,"bpmn:SubProcess")}function ty(e,t){var n=L(e);return t&&n.get("eventDefinitions").some(function(r){return m(r,t)})}function nR(e,t){return e.filter(function(n){return t.includes(n)})}var du={__depends__:[pu,ey,qe],bpmnReplace:["type",fu]};var rR=250;function _r(e){this._eventBus=e,this._tools=[],this._active=null}_r.$inject=["eventBus"];_r.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)};_r.prototype.isActive=function(e){return e&&this._active===e};_r.prototype.length=function(e){return this._tools.length};_r.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))};_r.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,rR,function(i){this._active&&(iR(i)||this.setActive(null))},this)};function iR(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Sn(t,'.group[data-group="tools"]')}var ti={__depends__:[wt],__init__:["toolManager"],toolManager:["type",_r]};function ny(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 ry(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;(Ss(e,s)||Ss(e,c)||Ss(t,s)||Ss(t,c))&&(Ss(n,a)||n.push(a))})}),n}function Ss(e,t){return e.indexOf(t)!==-1}function iy(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 Sf=Math.abs,oR=Math.round,xr={x:"width",y:"height"},sy="crosshair",ni={n:"top",w:"left",s:"bottom",e:"right"},aR=1500,hu={n:"s",w:"e",s:"n",e:"w"},mu=20;function Ht(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",aR,function(c){var p=c.context,u=p.initialized;u||(u=p.initialized=s.init(c,p)),u&&ay(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){ay(c);var _={x:0,y:0};_[u]=oR(c["d"+u]),s.makeSpace(f,d,_,l,h),n.once("spaceTool.ended",function(v){s.activateSelection(v.originalEvent,!0,!0)})}})}Ht.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"];Ht.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:sy,data:{context:{reactivate:n}},trapClick:!1})};Ht.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:sy,data:{context:{}}})};Ht.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)};Ht.prototype.init=function(e,t){var n=Sf(e.dx)>Sf(e.dy)?"x":"y",r=e["d"+n],i=e[n]-r;if(Sf(r)<5)return!1;r<0&&(r*=-1),hr(e)&&(r*=-1);var o=ny(n,r),a=this._canvas.getRootElement();!mi(e)&&e.hover&&(a=e.hover);var s=[...Fn(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=sR(c,n,o,i,p);return C(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:i}),gi("resize-"+(n==="x"?"ew":"ns")),!0};Ht.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||te(f))){if(fe(f)){c.push(f);return}var d=f[t],h=d+f[xr[t]];if(cR(f)&&(n>0&&Y(f)[t]>r||n<0&&Y(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;Ai(l,d)&&p(f)}),l=o.concat(a),E(c,function(f){var d=f.source,h=f.target,_=f.label;Ai(l,d)&&Ai(l,h)&&_&&p(_)}),{movingShapes:o,resizingShapes:a}};Ht.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)};Ht.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function oy(e){return{top:e.top-mu,right:e.right+mu,bottom:e.bottom+mu,left:e.left-mu}}function ay(e){var t=e.context,n=t.spaceToolConstraints;if(n){var r,i;ee(n.left)&&(r=Math.max(e.x,n.left),e.dx=e.dx+r-e.x,e.x=r),ee(n.right)&&(r=Math.min(e.x,n.right),e.dx=e.dx+r-e.x,e.x=r),ee(n.top)&&(i=Math.max(e.y,n.top),e.dy=e.dy+i-e.y,e.y=i),ee(n.bottom)&&(i=Math.min(e.y,n.bottom),e.dy=e.dy+i-e.y,e.y=i)}}function sR(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=J(f,function(I){return!fe(I)&&!te(I)&&!Ai(o,I)&&!Ai(a,I)}),_=J(f,function(I){return!fe(I)&&!te(I)&&Ai(o,I)}),v,w,P,b=[],x=[],S,A,O,M;h.length&&(w=oy(X(Ee(h))),v=r-d[ni[n]]+w[ni[n]],n==="n"?s.bottom=p=ee(p)?Math.min(p,v):v:n==="w"?s.right=p=ee(p)?Math.min(p,v):v:n==="s"?s.top=c=ee(c)?Math.max(c,v):v:n==="e"&&(s.left=c=ee(c)?Math.max(c,v):v)),_.length&&(P=oy(X(Ee(_))),v=r-P[ni[hu[n]]]+d[ni[hu[n]]],n==="n"?s.bottom=p=ee(p)?Math.min(p,v):v:n==="w"?s.right=p=ee(p)?Math.min(p,v):v:n==="s"?s.top=c=ee(c)?Math.max(c,v):v:n==="e"&&(s.left=c=ee(c)?Math.max(c,v):v)),l&&l.length&&(l.forEach(function(I){Ai(o,I)?b.push(I):x.push(I)}),b.length&&(S=X(Ee(b.map(Y))),A=d[ni[hu[n]]]-(S[ni[hu[n]]]-r)),x.length&&(O=X(Ee(x.map(Y))),M=O[ni[n]]-(d[ni[n]]-r)),n==="n"?(v=Math.min(A||1/0,M||1/0),s.bottom=p=ee(p)?Math.min(p,v):v):n==="w"?(v=Math.min(A||1/0,M||1/0),s.right=p=ee(p)?Math.min(p,v):v):n==="s"?(v=Math.max(A||-1/0,M||-1/0),s.top=c=ee(c)?Math.max(c,v):v):n==="e"&&(v=Math.max(A||-1/0,M||-1/0),s.left=c=ee(c)?Math.max(c,v):v));var B=i&&i[u.id];B&&(n==="n"?(v=r+u[xr[t]]-B[xr[t]],s.bottom=p=ee(p)?Math.min(p,v):v):n==="w"?(v=r+u[xr[t]]-B[xr[t]],s.right=p=ee(p)?Math.min(p,v):v):n==="s"?(v=r-u[xr[t]]+B[xr[t]],s.top=c=ee(c)?Math.max(c,v):v):n==="e"&&(v=r-u[xr[t]]+B[xr[t]],s.left=c=ee(c)?Math.max(c,v):v))}),s}}function Ai(e,t){return e.indexOf(t)!==-1}function cR(e){return!!e.host}var Cf="djs-dragging",cy="djs-resizing",pR=250,gu=Math.max;function vu(e,t,n,r,i){function o(a,s){E(a,function(c){i.addDragger(c,s),n.addMarker(c,Cf)})}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");$(u,r.cls("djs-crosshair-group",["no-events"])),Z(s,u);var l=G("path");$(l,"d",p.x),ue(l).add("djs-crosshair"),Z(u,l);var f=G("path");$(f,"d",p.y),ue(f).add("djs-crosshair"),Z(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;ke(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&be(c)}),e.on("spaceTool.move",pR,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"),$(c,"d","M0,0 L0,0"),ue(c).add("djs-crosshair"),Z(f,c),s.line=c;var d=G("g");$(d,r.cls("djs-drag-group",["no-events"])),Z(n.getActiveLayer(),d),o(u,d);var h=s.movingConnections=t.filter(function(x){var S=!1;E(u,function(B){E(B.outgoing,function(I){x===I&&(S=!0)})});var A=!1;E(u,function(B){E(B.incoming,function(I){x===I&&(A=!0)})});var O=!1;E(l,function(B){E(B.outgoing,function(I){x===I&&(O=!0)})});var M=!1;return E(l,function(B){E(B.incoming,function(I){x===I&&(M=!0)})}),fe(x)&&(S||O)&&(A||M)});o(h,d),s.dragGroup=d}if(!s.frameGroup){var _=G("g");$(_,r.cls("djs-frame-group",["no-events"])),Z(n.getActiveLayer(),_);var v=[];E(l,function(x){var S=i.addFrame(x,_),A=S.getBBox();v.push({element:S,initialBounds:A}),n.addMarker(x,cy)}),s.frameGroup=_,s.frames=v}var w={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};$(c,{d:w[p]});var P={x:"y",y:"x"},b={x:a.dx,y:a.dy};b[P[s.axis]]=0,ke(s.dragGroup,b.x,b.y),E(s.frames,function(x){var S=x.element,A=x.initialBounds,O,M;s.direction==="e"?$(S,{width:gu(A.width+b.x,5)}):(O=gu(A.width-b.x,5),$(S,{width:O,x:A.x+A.width-O})),s.direction==="s"?$(S,{height:gu(A.height+b.y,5)}):(M=gu(A.height-b.y,5),$(S,{height:M,y:A.y+A.height-M}))})}}),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,Cf)}),E(p,function(h){n.removeMarker(h,Cf)}),f&&(be(l),be(f)),E(u,function(h){n.removeMarker(h,cy)}),d&&be(d)})}vu.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var py={__init__:["spaceToolPreview"],__depends__:[wt,ft,ti,xn,Zn],spaceTool:["type",Ht],spaceToolPreview:["type",vu]};function $o(e,t){e.invoke(Ht,this),this._canvas=t}$o.$inject=["injector","canvas"];N($o,Ht);$o.prototype.calculateAdjustments=function(e,t,n,r){var i=this._canvas.getRootElement(),o=e[0]===i?null:e[0],a=[];o&&(a=Pr(ec(i.children.filter(p=>m(p,"bpmn:Artifact")),Ee(o))));let s=[...e,...a];var c=Ht.prototype.calculateAdjustments.call(this,s,t,n,r);return c.resizingShapes=c.resizingShapes.filter(function(p){return!(m(p,"bpmn:TextAnnotation")||uR(p)&&(t==="y"&&Re(p)||t==="x"&&!Re(p)))}),c};function uR(e){return m(e,"bpmn:Participant")&&!L(e).processRef}var yu={__depends__:[py],spaceTool:["type",$o]};function Fe(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)}Fe.$inject=["eventBus","injector"];Fe.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()};Fe.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};Fe.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})};Fe.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()}};Fe.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()}};Fe.prototype.register=function(e,t){this._setHandler(e,t)};Fe.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)};Fe.prototype.canUndo=function(){return!!this._getUndoAction()};Fe.prototype.canRedo=function(){return!!this._getRedoAction()};Fe.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]};Fe.prototype._getUndoAction=function(){return this._stack[this._stackIdx]};Fe.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)})};Fe.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};Fe.prototype._createId=function(){return this._uid++};Fe.prototype._atomicDo=function(e){let t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}};Fe.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()};Fe.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)};Fe.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:qu("id",r.reverse())}),r.length=0,this._fire("changed",{trigger:t}),e.trigger=null)};Fe.prototype._markDirty=function(e){let t=this._currentExecution;e&&(e=U(e)?e:[e],t.dirty=t.dirty.concat(e))};Fe.prototype._executedAction=function(e,t){let n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)};Fe.prototype._revertedAction=function(e){this._stackIdx--};Fe.prototype._getHandler=function(e){return this._handlerMap[e]};Fe.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 uy={commandStack:["type",Fe]};function bn(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}var lR=250,ly=1400;function Cs(e,t,n){k.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",ly,function(i){var o=i.context,a=o.shapes,s=o.validatedShapes;o.shapes=fy(a),o.validatedShapes=fy(s)}),r&&t.on("shape.move.start",lR,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",ly,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;bn(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=qi(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&&(we(s.labels,a,c),a.labelTarget=s)})}N(Cs,k);Cs.$inject=["injector","eventBus","modeling"];function fy(e){return J(e,function(t){return e.indexOf(t.labelTarget)===-1})}var dy={__init__:["labelSupport"],labelSupport:["type",Cs]};var fR=251,hy=1401,my="attach-ok";function Rs(e,t,n,r,i){k.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",hy,function(a){var s=a.context,c=s.shapes,p=s.validatedShapes;s.shapes=dR(c),s.validatedShapes=hR(p)}),o&&t.on("shape.move.start",fR,function(a){var s=a.context,c=s.shapes,p=Rf(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,my),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,my)}))}}),this.preExecuted("elements.move",hy,function(a){var s=a.context,c=s.closure,p=s.shapes,u=Rf(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=J(c,function(l){var f=l.host;return mR(l)&&!gR(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;bn(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=lf(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=lf(d,p,u);i.moveShape(d,h,d.parent),E(d.labels,function(_){i.moveShape(_,h,_.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;bn(s.attachers,function(c){i.removeShape(c)}),s.host&&i.updateAttachment(s,null)})}N(Rs,k);Rs.$inject=["injector","eventBus","canvas","rules","modeling"];function Rf(e){return Ui(He(e,function(t){return t.attachers||[]}))}function dR(e){var t=Rf(e);return ed("id",e,t)}function hR(e){var t=wn(e,"id");return J(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function mR(e){return!!e.host}function gR(e,t){return e.indexOf(t)!==-1}var gy={__depends__:[ft],__init__:["attachSupport"],attachSupport:["type",Rs]};function qt(e){this._model=e}qt.$inject=["moddle"];qt.prototype._needsId=function(e){return Q(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"])};qt.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":Q(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))};qt.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n};qt.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})};qt.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",C({bpmnElement:e,bounds:this.createDiBounds()},t))};qt.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)};qt.prototype.createDiWaypoints=function(e){var t=this;return He(e,function(n){return t.createDiWaypoint(n)})};qt.prototype.createDiWaypoint=function(e){return this.create("dc:Point",pt(e,["x","y"]))};qt.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",C({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))};qt.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",C({bpmnElement:e},t))};function kt(e,t,n){k.call(this,e),this._bpmnFactory=t;var r=this;function i(d){var h=d.context,_=h.hints||{},v;!h.cropped&&_.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,_=h.shape||h.connection,v=h.parent||h.newParent;r.updateParent(_,v)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Xt(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Xt(a));function s(d){var h=d.context,_=h.oldRoot,v=_.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"],Xt(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Xt(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"],Xt(p)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Xt(p));function u(d){r.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Xt(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Xt(u)),this.executed("connection.reconnect",Xt(function(d){var h=d.context,_=h.connection,v=h.oldSource,w=h.newSource,P=L(_),b=L(v),x=L(w);P.conditionExpression&&!Q(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=P.conditionExpression,delete P.conditionExpression),v!==w&&b.default===P&&(h.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",Xt(function(d){var h=d.context,_=h.connection,v=h.oldSource,w=h.newSource,P=L(_),b=L(v),x=L(w);h.oldConditionExpression&&(P.conditionExpression=h.oldConditionExpression),h.oldDefault&&(b.default=h.oldDefault,delete x.default)}));function l(d){r.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Xt(l)),this.reverted(["element.updateAttachment"],Xt(l)),this.executed("element.updateLabel",Xt(f)),this.reverted("element.updateLabel",Xt(f));function f(d){let{element:h}=d.context,_=xt(h),v=se(h),w=v&&v.get("label");nn(h)||po(h)||(_&&!w?v.set("label",t.create("bpmndi:BPMNLabel")):!_&&w&&v.set("label",void 0))}}N(kt,k);kt.$inject=["eventBus","bpmnFactory","connectionDocking"];kt.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,r=t.host;n.attachedToRef=r&&r.businessObject};kt.prototype.updateParent=function(e,t){if(!te(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)}};kt.prototype.updateBounds=function(e){var t=se(e),n=yR(e);if(n){var r=Et(n,t.get("bounds"));C(n,{x:e.x+r.x,y:e.y+r.y})}var i=te(e)?this._getLabel(t):t,o=i.bounds;o||(o=this._bpmnFactory.createDiBounds(),i.set("bounds",o)),C(o,{x:e.x,y:e.y,width:e.width,height:e.height})};kt.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var r,i;m(n,"bpmn:Lane")&&(r=n.get("flowNodeRef"),Te(r,e)),m(t,"bpmn:Lane")&&(i=t.get("flowNodeRef"),we(i,e))}};kt.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)};kt.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):(Te(n,e),e.$parent=null)}};function vR(e){for(;e&&!m(e,"bpmn:Definitions");)e=e.$parent;return e}kt.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)};kt.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=vR(e.$parent||t),e.$parent&&(Te(o.get("rootElements"),i),i.$parent=null),t&&(we(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),Te(a,e)),t?(a=t.get(r),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(r);Te(a,e),t&&(s||(s=[],t.set(r,s)),s.push(e))}}};kt.prototype.updateConnectionWaypoints=function(e){var t=se(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))};kt.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&&(Te(n.sourceRef&&n.sourceRef.get("outgoing"),n),i&&i.get("outgoing")&&i.get("outgoing").push(n)),n.sourceRef=i),n.targetRef!==a&&(c&&(Te(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)};kt.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Xt(e){return function(t){var n=t.context,r=n.shape||n.connection||n.element;m(r,"bpmn:BaseElement")&&e(t)}}function yR(e){if(m(e,"bpmn:Activity")){var t=se(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Qn(e,t){vn.call(this),this._bpmnFactory=e,this._moddle=t}N(Qn,vn);Qn.$inject=["bpmnFactory","moddle"];Qn.prototype._baseCreate=vn.prototype.create;Qn.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,C({type:"label",di:n},ro,t))}return this.createElement(e,t)};Qn.prototype.createElement=function(e,t){t=C({},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),mc(r)}if(!xR(i)){var o=C({},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=C({isFrame:!0},t)),t=_R(r,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Pf(i,t,"isExpanded")),Q(r,["bpmn:Lane","bpmn:Participant"])&&(t=Pf(i,t,"isHorizontal")),m(r,"bpmn:SubProcess")&&(t.collapsed=!ie(r,i)),m(r,"bpmn:ExclusiveGateway")&&(tt(i,"isMarkerVisible")?i.isMarkerVisible===void 0&&(i.isMarkerVisible=!1):i.isMarkerVisible=!0),Ge(t.triggeredByEvent)&&(r.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Ge(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=C({id:r.id},n,t,{businessObject:r,di:i}),this._baseCreate(e,t)};Qn.prototype.getDefaultSize=function(e,t){var n=L(e);if(t=t||se(e),m(n,"bpmn:SubProcess"))return ie(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 ie(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:30}:m(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}};Qn.prototype.createParticipantShape=function(e){return Ce(e)||(e={isExpanded:e}),e=C({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function _R(e,t,n){return E(n,function(r){t=Pf(e,t,r)}),t}function Pf(e,t,n){return t[n]===void 0?t:(e[n]=t[n],At(t,[n]))}function xR(e){return Q(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function zo(e,t){this._modeling=e,this._canvas=t}zo.$inject=["modeling","canvas"];zo.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;E(n,function(i){var o={x:0,y:0};Ge(r.left)?o.x=r.left-i.x:Ge(r.right)?o.x=r.right-i.width-i.x:Ge(r.center)?o.x=r.center-Math.round(i.width/2)-i.x:Ge(r.top)?o.y=r.top-i.y:Ge(r.bottom)?o.y=r.bottom-i.height-i.y:Ge(r.middle)&&(o.y=r.middle-Math.round(i.height/2)-i.y),t.moveElements([i],o,i.parent)})};zo.prototype.postExecute=function(e){};function Vo(e){this._modeling=e}Vo.$inject=["modeling"];Vo.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};Vo.prototype.postExecute=function(e){var t=e.hints||{};bR(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 bR(e,t){return Nt(e.outgoing,function(n){return n.target===t})}function Wo(e,t){this._canvas=e,this._layouter=t}Wo.$inject=["canvas","layouter"];Wo.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};Wo.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var _u=Math.round;function Ps(e){this._modeling=e}Ps.$inject=["modeling"];Ps.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){ee(l.x)||(l.x=0),ee(l.y)||(l.y=0)});var s=J(t,function(l){return!l.hidden}),c=Ee(s);E(t,function(l){fe(l)&&(l.waypoints=He(l.waypoints,function(f){return{x:_u(f.x-c.x-c.width/2+i.x),y:_u(f.y-c.y-c.height/2+i.y)}})),C(l,{x:_u(l.x-c.x-c.width/2+i.x),y:_u(l.y-c.y-c.height/2+i.y)})});var p=Dr(t),u={};E(t,function(l){if(fe(l)){u[l.id]=ee(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=C({},o);p.indexOf(l)===-1&&(f.autoResize=!1),te(l)&&(f=At(f,["attach"])),u[l.id]=ee(r)?a.createShape(l,pt(l,["x","y","width","height"]),l.parent||n,r,f):a.createShape(l,pt(l,["x","y","width","height"]),l.parent||n,f)}),e.elements=Pr(u)};var vy=Math.round;function On(e){this._canvas=e}On.$inject=["canvas"];On.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?C(t,n):C(t,{x:n.x-vy(t.width/2),y:n.y-vy(t.height/2)}),this._canvas.addShape(t,r,i),t};On.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Ti(e){On.call(this,e)}N(Ti,On);Ti.$inject=["canvas"];var ER=On.prototype.execute;Ti.prototype.execute=function(e){var t=e.shape;return SR(t),t.labelTarget=e.labelTarget,ER.call(this,e)};var wR=On.prototype.revert;Ti.prototype.revert=function(e){return e.shape.labelTarget=null,wR.call(this,e)};function SR(e){["width","height"].forEach(function(t){typeof e[t]=="undefined"&&(e[t]=0)})}function Mi(e,t){this._canvas=e,this._modeling=t}Mi.$inject=["canvas","modeling"];Mi.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;bn(n.incoming,function(r){t.removeConnection(r,{nested:!0})}),bn(n.outgoing,function(r){t.removeConnection(r,{nested:!0})})};Mi.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=qi(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t};Mi.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,we(n.children,t,r),this._canvas.addConnection(t,n),t};function As(e,t){this._modeling=e,this._elementRegistry=t}As.$inject=["modeling","elementRegistry"];As.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 Di(e,t){this._canvas=e,this._modeling=t}Di.$inject=["canvas","modeling"];Di.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;bn(n.incoming,function(r){t.removeConnection(r,{nested:!0})}),bn(n.outgoing,function(r){t.removeConnection(r,{nested:!0})}),bn(n.children,function(r){fe(r)?t.removeConnection(r,{nested:!0}):t.removeShape(r,{nested:!0})})};Di.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=qi(r.children,n),t.removeShape(n),n};Di.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return we(r.children,n,i),t.addShape(n,r),n};function Go(e){this._modeling=e}Go.$inject=["modeling"];var yy={x:"y",y:"x"};Go.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 P={y:0};P[r]=v-a(w),P[r]&&(P[yy[r]]=0,t.moveElements([w],P,w.parent))}var u=n[0],l=s(n),f=n[l],d,h,_=0;E(n,function(v,w){var P,b,x;if(v.elements.length<2){w&&w!==n.length-1&&(o(v,v.elements[0]),_+=c(v.range));return}P=St(v.elements,r),b=P[0],w===l&&(b=P[s(P)]),x=a(b),v.range=null,E(P,function(S){if(p(x,S),v.range===null){v.range={min:S[r],max:S[r]+S[i]};return}o(v,S)}),w&&w!==n.length-1&&(_+=c(v.range))}),h=Math.abs(f.range.min-u.range.max),d=Math.round((h-_)/(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||PR(n,Ki(r));return Ay(n,r),e.oldProperties=o,e.changed=i,i};Ni.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return Ay(n,t),r};Ni.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return m(e,"bpmn:DataObject")?AR(e,t):[]};function PR(e,t){return Ke(t,function(n,r){return n[r]=e.get(r),n},{})}function Ay(e,t){E(t,function(n,r){e.set(r,n)})}function AR(e,t){return t.filter(function(n){return m(n,"bpmn:DataObjectReference")&&L(n).dataObjectRef===e})}var ks="default",Er="id",Ty="di",TR={width:0,height:0};function Bi(e,t,n,r){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=r}Bi.$inject=["elementRegistry","moddle","modeling","textRenderer"];Bi.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=NR(e.properties),s=e.oldProperties||MR(t,a);return My(a,o)&&(i.unclaim(o[Er]),r.updateId(t,a[Er]),i.claim(a[Er],o)),ks in a&&(a[ks]&&n.push(r.get(a[ks].id)),o[ks]&&n.push(r.get(o[ks].id))),Dy(t,a),e.oldProperties=s,e.changed=n,n};Bi.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,TR)}};Bi.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 Dy(t,r),My(n,i)&&(a.unclaim(n[Er]),o.updateId(t,r[Er]),a.claim(r[Er],i)),e.changed};function My(e,t){return Er in e&&e[Er]!==t[Er]}function MR(e,t){var n=Ki(t),r=e.businessObject,i=se(e);return Ke(n,function(o,a){return a!==Ty?o[a]=r.get(a):o[a]=DR(i,Ki(t.di)),o},{})}function DR(e,t){return Ke(t,function(n,r){return n[r]=e&&e.get(r),n},{})}function Dy(e,t){var n=e.businessObject,r=se(e);E(t,function(i,o){o!==Ty?n.set(o,i):r&&kR(r,i)})}function kR(e,t){E(t,function(n,r){e.set(r,n)})}var OR=["default"];function NR(e){var t=C({},e);return OR.forEach(function(n){n in e&&(t[n]=L(t[n]))}),t}function Xo(e,t){this._canvas=e,this._modeling=t}Xo.$inject=["canvas","modeling"];Xo.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),we(a.rootElements,r),r.$parent=a,Te(a.rootElements,o),o.$parent=null,i.di=null,s.bpmnElement=r,n.di=s,e.oldRoot=i,[]};Xo.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),Te(a.rootElements,r),r.$parent=null,we(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,i.di=s,[]};function Os(e,t){this._modeling=e,this._spaceTool=t}Os.$inject=["modeling","spaceTool"];Os.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,o=Rt(r),a=o===r,s=a?r:r.parent,c=cn(s),p=Re(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+Yt,y:r.y,width:r.width-Yt,height:r.height}:{x:r.x,y:r.y+Yt,width:r.width,height:r.height-Yt};n.createShape({type:"bpmn:Lane",isHorizontal:p},u,s)}var l=[];Cn(o,function(x){return l.push(x),x.label&&l.push(x.label),x===r?[]:J(x.children,function(S){return S!==r})});var f,d,h,_,v;i==="top"?(f=-120,d=r.y,h=d+10,_="n",v="y"):i==="left"?(f=-120,d=r.x,h=d+10,_="w",v="x"):i==="bottom"?(f=120,d=r.y+r.height,h=d-10,_="s",v="y"):i==="right"&&(f=120,d=r.x+r.width,h=d-10,_="e",v="x");var w=t.calculateAdjustments(l,v,f,h),P=p?{x:0,y:f}:{x:f,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,P,_,h);var b=p?{x:r.x+(a?Yt:0),y:d-(i==="top"?120:0),width:r.width-(a?Yt:0),height:120}:{x:d-(i==="left"?120:0),y:r.y+(a?Yt:0),width:120,height:r.height-(a?Yt:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:p},b,s)};function Ns(e){this._modeling=e}Ns.$inject=["modeling"];Ns.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,r=e.count,i=cn(n),o=i.length;if(o>r)throw new Error(`more than <${r}> child lanes`);var a=Re(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 Bs="flowNodeRef",Af="lanes";function Li(e){this._elementRegistry=e}Li.$inject=["elementRegistry"];Li.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(Fy(n)){var r=VR(e,t,n),i=WR(e,t,n),o=GR(r,i);return[].concat(r.waypoints,o.waypoints,i.waypoints)}return UR(e,t,n)}function KR(e,t,n){var r=Tf(e,t,n);return r.unshift(e),r.push(t),Df(r)}function YR(e,t,n,r,i){var o=i&&i.preferredLayouts||[],a=Qf(o,"straight")[0]||"h:h",s=HR[a]||0,c=Le(e,t,s),p=JR(c,a);n=n||Y(e),r=r||Y(t);var u=p.split(":"),l=Iy(n,e,u[0],tP(c)),f=Iy(r,t,u[1],c);return KR(l,f,p)}function jy(e,t,n,r,i,o){U(n)&&(i=n,o=r,n=Y(e),r=Y(t)),o=C({preferredLayouts:[]},o),i=i||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&XR(e,t,n,r,o),c||(c=o.connectionEnd&&QR(t,e,r,i),c)||(c=o.connectionStart&&ZR(e,t,n,i),c)?c:!o.connectionStart&&!o.connectionEnd&&i&&i.length?i:YR(e,t,n,r,o)}function qR(e,t,n){return e>=t&&e<=n}function By(e,t,n){var r={x:"width",y:"height"};return qR(t[e],n[e],n[e]+n[r[e]])}function XR(e,t,n,r,i){var o={},a,s;return s=Le(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),i.preserveDocking==="target"?By(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:By(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 ZR(e,t,n,r){return Mf(e,t,n,r)}function QR(e,t,n,r){var i=r.slice().reverse();return i=Mf(e,t,n,i),i?i.reverse():null}function Mf(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&&kr(l,d)<3})}function o(u,l,f){var d=Gt(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(ul(u[d],l,Oy)||ul(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=Mf(e,t,n,p)),c&&Gt(c)?null:c}function JR(e,t){if(Fy(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 eP(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Fy(e){return e&&/t|r|b|l/.test(e)}function tP(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 Iy(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 Df(e){return e.reduce(function(t,n,r){var i=t[t.length-1],o=e[r+1];return Xi(i,o,n,0)||t.push(n),t},[])}var nP=-10,rP=40,iP={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},oP={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},Of={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ls={top:"t",right:"r",bottom:"b",left:"l"};function ea(e){this._elementRegistry=e}N(ea,bu);ea.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=Hy(i&&i[0],n)),a||(a=Hy(i&&i[i.length-1],r)),(m(e,"bpmn:Association")||m(e,"bpmn:DataAssociation"))&&i&&!$y(n,r))return[].concat([o],i.slice(1,-1),[a]);var u=fp(n,s)?iP:oP;return m(e,"bpmn:MessageFlow")?c=sP(n,r,u):(m(e,"bpmn:SequenceFlow")||$y(n,r))&&(n===r?c={preferredLayouts:dP(n,e,u)}:m(n,"bpmn:BoundaryEvent")?c={preferredLayouts:hP(n,r,a,u)}:js(n)||js(r)?c={preferredLayouts:u.subProcess,preserveDocking:pP(n)}:m(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:m(r,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=C(c,t),p=Df(jy(n,r,o,a,i,c))),p||[o,a]};function aP(e){var t=e.host;return Le(Y(e),t,nP)}function sP(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:cP(e,t)}}function cP(e,t){return m(t,"bpmn:Participant")?"source":m(e,"bpmn:Participant")?"target":js(t)?"source":js(e)||m(t,"bpmn:Event")?"target":m(e,"bpmn:Event")?"source":null}function pP(e){return js(e)?"target":"source"}function Hy(e,t){return e?e.original||e:Y(t)}function $y(e,t){return m(t,"bpmn:Activity")&&m(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function js(e){return m(e,"bpmn:SubProcess")&&ie(e)}function ji(e,t){return e===t}function uP(e,t){return t.indexOf(e)!==-1}function Qo(e){var t=/right|left/.exec(e);return t&&t[0]}function Jo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function zy(e,t){return Of[e]===t}function lP(e,t){var n=Qo(e),r=Of[n];return t.indexOf(r)!==-1}function fP(e,t){var n=Jo(e),r=Of[n];return t.indexOf(r)!==-1}function Wy(e){return e==="right"||e==="left"}function dP(e,t,n){var r=t.waypoints,i=r&&r.length&&Le(r[0],e);return i==="top"?n.loop.fromTop:i==="right"?n.loop.fromRight:i==="left"?n.loop.fromLeft:n.loop.fromBottom}function hP(e,t,n,r){var i=Y(e),o=Y(t),a=aP(e),s,c,p=ji(e.host,t),u=uP(a,["top","right","bottom","left"]),l=Le(o,i,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return p?mP(a,u,e,t,n,r):(s=gP(a,l,u,r.isHorizontal),c=vP(a,l,u,r.isHorizontal),[s+":"+c])}function mP(e,t,n,r,i,o){var a=t?e:o.isHorizontal?Jo(e):Qo(e),s=Ls[a],c;return t?Wy(e)?c=Vy("y",n,r,i)?"h":o.boundaryLoop.alternateHorizontalSide:c=Vy("x",n,r,i)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Vy(e,t,n,r){var i=rP;return!(kf(e,r,n,i)||kf(e,r,{x:n.x+n.width,y:n.y+n.height},i)||kf(e,r,Y(t),i))}function kf(e,t,n,r){return Math.abs(t[e]-n[e])!Rr(d))})};ta.prototype.cleanUp=function(){this._complexPreview.cleanUp()};ta.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var Ky={__depends__:[xo,Rg,Su],__init__:["appendPreview"],appendPreview:["type",ta]};var Yy=Math.min,qy=Math.max;function Nf(e){e.preventDefault()}function Fs(e){e.stopPropagation()}function yP(e){return e.nodeType===Node.TEXT_NODE}function _P(e){return[].slice.call(e)}function pn(e){this.container=e.container,this.parent=ye('
    '),this.content=me("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=Je(this.autoResize,this),this.handlePaste=Je(this.handlePaste,this)}pn.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=pt(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);C(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=pt(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return C(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},p),r.centerVertically&&C(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},p),a.innerText=n,ae.bind(a,"keydown",this.keyHandler),ae.bind(a,"mousedown",Fs),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};pn.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)}};pn.prototype.insertText=function(e){e=xP(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)};pn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,r=t.endContainer,i=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=_P(a.childNodes),c,p;if(yP(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,_){_===f?h.textContent=n.textContent.substring(0,i)+e+r.textContent.substring(o):_>f&&_<=d&&Bt(h)}),c=n,p=i+e.length}c&&p!==void 0&&setTimeout(function(){self.setSelection(c,p)})};pn.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){Nf(h),Fs(h),s=h.clientX,c=h.clientY;var _=t.getBoundingClientRect();p=_.width,u=_.height,ae.bind(document,"mousemove",f),ae.bind(document,"mouseup",d)},f=function(h){Nf(h),Fs(h);var _=Yy(qy(p+h.clientX-s,r),o),v=Yy(qy(u+h.clientY-c,i),a);t.style.width=_+"px",t.style.height=v+"px",e.resizeHandler({width:p,height:u,dx:h.clientX-s,dy:h.clientY-c})},d=function(h){Nf(h),Fs(h),ae.unbind(document,"mousemove",f,!1),ae.unbind(document,"mouseup",d,!1)};ae.bind(n,"mousedown",l)}C(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)};pn.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",Fs),ae.unbind(t,"input",this.autoResize),ae.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),Bt(n)),Bt(e)};pn.prototype.getValue=function(){return this.content.innerText.trim()};pn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t};pn.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 xP(e){return e.replace(/\r\n|\r|\n/g,` `)}function Zt(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new pn({container:t.getContainer(),keyHandler:Je(this._handleKey,this),resizeHandler:Je(this._handleResize,this)})}Zt.$inject=["eventBus","canvas"];Zt.prototype.registerProvider=function(e){this._providers.push(e)};Zt.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))};Zt.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())};Zt.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})};Zt.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0,this._canvas.restoreFocus&&this._canvas.restoreFocus()};Zt.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()}};Zt.prototype.getValue=function(){return this._textbox.getValue()};Zt.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()};Zt.prototype._handleResize=function(e){this._fire("resize",e)};Zt.prototype.activate=function(e){this.isActive()&&this.cancel();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 Cu={__depends__:[Vr],__init__:["directEditing"],directEditing:["type",Zt]};function Xy(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===ie(e);return!o||!a||!s||!c}}var Zy=[{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"}}],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"}}],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-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"}}],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 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"}}],t_=[{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"}}],n_=[{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}}],r_=[{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}}],Bf=[{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}}],i_=Bf,If=[{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}}],o_=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],a_=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],s_=[{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}}],c_=[{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}}],p_=[{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"}],u_=[{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}}],l_={"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 Lf={"start-event-non-interrupting":` `,"intermediate-event-non-interrupting":` `};function Qt(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()}Qt.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"];Qt.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)};Qt.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=Xy(e);return m(t,"bpmn:DataObjectReference")?this._createEntries(e,o_):m(t,"bpmn:DataStoreReference")&&!m(e.parent,"bpmn:Collaboration")?this._createEntries(e,a_):(m(t,"bpmn:Event")&&!m(t,"bpmn:BoundaryEvent")&&(i=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,r=l_[i]||[],!Ue(t.$parent)&&m(t.$parent,"bpmn:SubProcess")&&(r=J(r,function(c){return c.target.type!=="bpmn:StartEvent"}))),m(t,"bpmn:StartEvent")&&!m(t.$parent,"bpmn:SubProcess")?(o=J(Zy.concat(r),a),this._createEntries(e,o)):m(t,"bpmn:Participant")?(o=J(u_,function(c){return ie(e)!==c.target.isExpanded}),this._createEntries(e,o)):m(t,"bpmn:StartEvent")&&Ue(t.$parent)?(o=J(c_.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")&&!Ue(t.$parent)&&m(t.$parent,"bpmn:SubProcess")?(o=J(Qy.concat(r),a),this._createEntries(e,o)):m(t,"bpmn:EndEvent")?(o=J(e_.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=J(s_,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=J(Jy.concat(r),a),this._createEntries(e,o)):m(t,"bpmn:Gateway")?(o=J(t_,a),this._createEntries(e,o)):m(t,"bpmn:Transaction")?(o=J(Bf,a),this._createEntries(e,o)):Ue(t)&&ie(e)?(o=J(i_,a),this._createEntries(e,o)):m(t,"bpmn:AdHocSubProcess")&&ie(e)?(o=J(r_,a),this._createEntries(e,o)):m(t,"bpmn:SubProcess")&&ie(e)?(o=J(n_,a),this._createEntries(e,o)):m(t,"bpmn:SubProcess")&&!ie(e)?(o=J(If,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,p_):m(t,"bpmn:FlowNode")?(o=J(If,a),this._createEntries(e,o)):{})};Qt.prototype.getPopupMenuHeaderEntries=function(e){var t={};return m(e,"bpmn:Activity")&&!Ue(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),m(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),m(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Kp(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t};Qt.prototype._createEntries=function(e,t){var n={},r=this;return E(t,function(i){n[i.actionName]=r._createEntry(i,e)}),n};Qt.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};Qt.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}};Qt.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"}}}};Qt.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}}};Qt.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}}};Qt.prototype._getNonInterruptingHeaderEntries=function(e){let t=this._translate,n=L(e),r=this,i=Yp(e),o=m(e,"bpmn:BoundaryEvent")?Lf["intermediate-event-non-interrupting"]:Lf["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 f_={__depends__:[yo,du,xo],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Qt]};function Fi(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,_=h.shape;if(!(!hr(d)||!r.isOpen(_))){var v=r.getEntries(_);v.replace&&v.replace.action.click(d,_)}}),n.on("contextPad.close",function(){f.cleanUp()})}Fi.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"];Fi.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&C(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(r,i){t.removeElements(i.slice())}}}}),n};Fi.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return U(t)?hn(e,n=>t.includes(n)):t};Fi.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])&&C(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 _(b){var x=5,S=t.getPad(b).html,A=S.getBoundingClientRect(),O={x:A.left,y:A.bottom+x};return O}function v(b,x,S,A){function O(I,H){var z=r.createShape(C({type:b},A));o.start(I,z,{source:H})}var M=s?function(I,H){var z=r.createShape(C({type:b},A));s.append(H,z)}:O,B=s?function(I,H){return p.create(H,b,A),()=>{p.cleanUp()}}:null;return{group:"model",className:x,title:S,action:{dragstart:O,click:M,hover:B}}}function w(b){return function(x,S){n.splitLane(S,b),t.open(S,!0)}}if(Q(l,["bpmn:Lane","bpmn:Participant"])&&ie(e)){var P=cn(e);C(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")}}}}),P.length<2&&((Re(e)?e.height>=120:e.width>=120)&&C(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(Re(e)?e.height>=180:e.width>=180)&&C(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),C(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")?C(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"})}):d_(l,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?C(u,{"append.compensation-activity":v("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!m(l,"bpmn:EndEvent")&&!l.isForCompensation&&!d_(l,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Ue(l)&&C(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")||C(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var S=C(_(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",S,{title:c("Change element"),width:300,search:!0})}}}}),m(l,"bpmn:SequenceFlow")&&C(u,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),m(l,"bpmn:MessageFlow")&&C(u,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Q(l,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&C(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")&&C(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),Q(l,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&C(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")&&C(u,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&C(u,h()),u};function d_(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 h_={__depends__:[Ky,Cu,Gc,qe,So,ei,f_],__init__:["contextPadProvider"],contextPadProvider:["type",Fi]};var EP={horizontal:["x","width"],vertical:["y","height"]},m_=5;function Bn(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:[]})}Bn.$inject=["modeling","rules"];Bn.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)};Bn.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};Bn.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};Bn.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=St(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};Bn.prototype._setOrientation=function(e){var t=EP[e];this._axis=t[0],this._dimension=t[1]};Bn.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)};Bn.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+m_,max:t+n-m_}};var g_={__init__:["distributeElements"],distributeElements:["type",Bn]};function na(e){Ct.call(this,e)}na.$inject=["eventBus"];N(na,Ct);na.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=J(t,function(n){var r=Q(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||r)}),t=Dr(t),t.length<3?!1:t})};var wP={horizontal:` `,vertical:` `},jf=wP;var SP=900;function Hi(e,t,n,r){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",SP,this)}Hi.$inject=["popupMenu","distributeElements","translate","rules"];Hi.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&C(t,this._getEntries(e)),t};Hi.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})};Hi.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:jf.horizontal,action:function(o,a){t.trigger(e,"horizontal"),r.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:jf.vertical,action:function(o,a){t.trigger(e,"vertical"),r.close()}}};return i};var v_={__depends__:[yo,g_],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",na],distributeElementsMenuProvider:["type",Hi]};var y_="is not a registered action",CP="is already registered";function $t(e,t){this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}$t.$inject=["eventBus","injector"];$t.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)})};$t.prototype.trigger=function(e,t){if(!this._actions[e])throw Ff(e,y_);return this._actions[e](t)};$t.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)})};$t.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Ff(e,CP);this._actions[e]=t};$t.prototype.unregister=function(e){if(!this.isRegistered(e))throw Ff(e,y_);this._actions[e]=void 0};$t.prototype.getActions=function(){return Object.keys(this._actions)};$t.prototype.isRegistered=function(e){return!!this._actions[e]};function Ff(e,t){return new Error(e+" "+t)}var __={__init__:["editorActions"],editorActions:["type",$t]};function ra(e){e.invoke($t,this)}N(ra,$t);ra.$inject=["injector"];ra.prototype._registerDefaultActions=function(e){$t.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(),_=n.filter(function(v){return v!==h});return r.select(_),_}),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 _=r.get(),v=h.type;_.length&&c.trigger(_,v)}),r&&p&&this._registerAction("alignElements",function(h){var _=r.get(),v=[],w=h.type;_.length&&(v=J(_,function(P){return!m(P,"bpmn:Lane")}),p.trigger(v,w))}),r&&f&&this._registerAction("setColor",function(h){var _=r.get();_.length&&f.setColor(_,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(),_,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")}),_=Ee(v),f.moveElements(v,{x:-_.x,y:-_.y},h)}),r&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};var x_={__depends__:[__],editorActions:["type",ra]};function Ru(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,r=t.shape;Q(r,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}Ru.$inject=["eventBus"];var Hs=10;function Pu(e,t,n){return n||(n="round"),Math[n](e/t)*t}var RP=1200,PP=800;function tr(e,t,n){var r=!n||n.active!==!1;this._eventBus=t;var i=this;t.on("diagram.init",PP,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"],RP,function(o){var a=o.originalEvent;if(!(!i.active||a&<(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(p){var u={},l=TP(o,p,e);l&&(u.offset=l);var f=AP(o,p);f&&C(u,f),Mn(o,p)||i.snapEvent(o,p,u)})}})}tr.prototype.snapEvent=function(e,t,n){var r=this.snapValue(e[t],n);Ie(e,t,r)};tr.prototype.getGridSpacing=function(){return Hs};tr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Pu(e,Hs);var r,i;return t&&t.min&&(r=t.min,ee(r)&&(r=Pu(r+n,Hs,"ceil"),e=Math.max(e,r))),t&&t.max&&(i=t.max,ee(i)&&(i=Pu(i+n,Hs,"floor"),e=Math.min(e,i))),e-=n,e};tr.prototype.isActive=function(){return this.active};tr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})};tr.prototype.toggleActive=function(){this.setActive(!this.active)};tr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function AP(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&&(Au(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&&(Au(t)?E_(s)?a.x.max=c.left:a.x.min=c.right:b_(s)?a.y.max=c.top:a.y.min=c.bottom),p&&(Au(t)?E_(s)?a.x.min=p.left:a.x.max=p.right:b_(s)?a.y.min=p.top:a.y.max=p.bottom),a[t]}function TP(e,t,n){var r=e.context,i=e.shape,o=r.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&ee(s[t])||(s||(s=o.snapOffset={}),ee(s[t])||(s[t]=0),!i)||(n.get(i.id)||(Au(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 Au(e){return e==="x"}function b_(e){return e.indexOf("n")!==-1}function E_(e){return e.indexOf("w")!==-1}function wr(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;et(a)?i.newBounds=n.snapComplex(c,a):i.newBounds=n.snapSimple(s,c)}})}wr.$inject=["eventBus","gridSnapping","modeling"];N(wr,k);wr.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};wr.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};wr.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),C(e,o),e};wr.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),C(e,o),e};var MP=2e3;function Tu(e,t){e.on(["spaceTool.move","spaceTool.end"],MP,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)}})}Tu.$inject=["eventBus","gridSnapping"];var w_={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",wr],gridSnappingSpaceToolBehavior:["type",Tu]};var S_={__depends__:[w_],__init__:["gridSnapping"],gridSnapping:["type",tr]};var DP=2e3;function Mu(e,t,n){e.on("autoPlace",DP,function(r){var i=r.source,o=Y(i),a=r.shape,s=dp(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")&&(kP(c)?p.offset=-a.width/2:p.offset=-a.height/2),s[c]=t.snapValue(s[c],p))}),s})}Mu.$inject=["eventBus","gridSnapping","elementRegistry"];function kP(e){return e==="x"}var OP=1750;function Du(e,t,n){t.on(["create.start","shape.move.start"],OP,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}))}})}Du.$inject=["canvas","eventBus","gridSnapping"];var NP=3e3;function ia(e,t,n){k.call(this,e),this._gridSnapping=t;var r=this;this.postExecuted(["connection.create","connection.layout"],NP,function(i){var o=i.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||BP(c)&&n.updateWaypoints(a,r.snapMiddleSegments(c))})}ia.$inject=["eventBus","gridSnapping","modeling"];N(ia,k);ia.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var r=1;r3}function IP(e){return e==="h"}function LP(e){return e==="v"}function jP(e,t,n){var r=Gt(t,n),i={};return IP(r)&&(i.y=e.snapValue(t.y)),LP(r)&&(i.x=e.snapValue(t.x)),("x"in i||"y"in i)&&(t=C({},t,i),n=C({},n,i)),[t,n]}var C_={__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Mu],gridSnappingParticipantBehavior:["type",Du],gridSnappingLayoutConnectionBehavior:["type",ia]};var R_={__depends__:[S_,C_],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Ru]};var FP=30,P_=30;function $i(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 ie(i)?n._createParticipantHit(i,o):n._createDefaultHit(i,o);if(m(i,"bpmn:SubProcess"))return ie(i)?n._createSubProcessHit(i,o):n._createDefaultHit(i,o)})}$i.$inject=["eventBus","interactionEvents"];$i.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0};$i.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=Re(e)?{width:FP,height:e.height}:{width:e.width,height:P_};return this._interactionEvents.createBoxHit(t,"all",n),!0};$i.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 A_={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",$i]};function oa(e){e.invoke(mr,this)}N(oa,mr);oa.$inject=["injector"];oa.prototype.registerBindings=function(e,t){mr.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 T_={__depends__:[uo],__init__:["keyboardBindings"],keyboardBindings:["type",oa]};var HP={moveSpeed:1,moveSpeedAccelerated:10},$P=1500,M_="left",D_="up",k_="right",O_="down",zP={ArrowLeft:M_,Left:M_,ArrowUp:D_,Up:D_,ArrowRight:k_,Right:k_,ArrowDown:O_,Down:O_},VP={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 ku(e,t,n,r,i){var o=this;this._config=C({},HP,e||{}),t.addListener($P,function(a){var s=a.keyEvent,c=zP[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=VP[a](p),l=r.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});l&&n.moveElements(c,u)}}}ku.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var N_={__depends__:[uo,qe],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",ku]};var B_=10;function zi(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=Bg(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=oc(l),!WP(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)})}zi.prototype.canResize=function(e){var t=this._rules,n=pt(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)};zi.prototype.activate=function(e,t,n){var r=this._dragging,i,o;if(typeof n=="string"&&(n={direction:n}),i=C({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,Hf(t,o),"resize",{autoActivate:!0,cursor:GP(o),data:{shape:t,context:i}})};zi.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,r,i;return r=e.minDimensions||{width:B_,height:B_},i=Hp(t,e.childrenBoxPadding),Ig(n,t,r,i)};zi.$inject=["eventBus","rules","modeling","dragging"];function WP(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Hf(e,t){var n=Y(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 GP(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 I_="djs-resizing",L_="resize-not-ok",UP=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,I_)),s.width>5&&$(c,{x:s.x,width:s.width}),s.height>5&&$(c,{y:s.y,height:s.height}),o.canExecute?ue(c).remove(L_):ue(c).add(L_)}function i(o){var a=o.shape,s=o.frame;s&&be(o.frame),t.removeMarker(a,I_)}e.on("resize.move",UP,function(o){r(o.context)}),e.on("resize.cleanup",function(o){i(o.context)})}Ou.$inject=["eventBus","canvas","previewSupport"];var Nu=-6,Bu=8,Iu=20,$s="djs-resizer",KP=["n","w","s","e","nw","ne","se","sw"];function nr(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,Je(i.addResizer,i))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(i.removeResizers(),i.addResizer(a))})}nr.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(o){an(o)&&r.activate(o,e,n)}ae.bind(t,"mousedown",i),ae.bind(t,"touchstart",i)};nr.prototype._createResizer=function(e,t,n,r){var i=this._getResizersParent(),o=YP(r),a=G("g");ue(a).add($s),ue(a).add($s+"-"+e.id),ue(a).add($s+"-"+r),Z(i,a);var s=G("rect");$(s,{x:-Bu/2+o.x,y:-Bu/2+o.y,width:Bu,height:Bu}),ue(s).add($s+"-visual"),Z(a,s);var c=G("rect");return $(c,{x:-Iu/2+o.x,y:-Iu/2+o.y,width:Iu,height:Iu}),ue(c).add($s+"-hit"),Z(a,c),Ji(a,t,n),a};nr.prototype.createResizer=function(e,t){var n=Hf(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)};nr.prototype.addResizer=function(e){var t=this;fe(e)||!this._resize.canResize({shape:e})||E(KP,function(n){t.createResizer(e,n)})};nr.prototype.removeResizers=function(){var e=this._getResizersParent();or(e)};nr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")};nr.$inject=["eventBus","canvas","selection","resize"];function YP(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Nu:e.indexOf("w")!==-1&&(t.x=Nu),e.indexOf("s")!==-1?t.y=-Nu:e.indexOf("n")!==-1&&(t.y=Nu),t}var Lu={__depends__:[ft,wt,xn],__init__:["resize","resizePreview","resizeHandles"],resize:["type",zi],resizePreview:["type",Ou],resizeHandles:["type",nr]};var qP=2e3;function Vi(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"],qP,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||Q(c,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||$f(c))&&r.activate(c)}}Vi.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"];Vi.prototype.activate=function(e){var t=xt(e);if(t!==void 0){var n={text:t},r=this.getEditingBBox(e);C(n,r);var i={},o=n.style||{};return C(o,{backgroundColor:null,border:null}),(Q(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||$f(e))&&C(i,{centerVertically:!0}),nn(e)&&(C(i,{autoResize:!0}),C(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),m(e,"bpmn:TextAnnotation")&&(C(i,{resizable:!0,autoResize:!0}),C(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),C(n,{options:i,style:o}),n}};Vi.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")||QP(e)){var h=Re(e),_=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};C(o,_),C(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(ZP(e)){var v=Re(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};C(o,w),C(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)"})}(Q(e,["bpmn:Task","bpmn:CallActivity"])||$f(e))&&(C(o,{width:r.width,height:r.height}),C(d,{fontSize:l+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),XP(e)&&(C(o,{width:r.width,x:r.x}),C(d,{fontSize:l+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var P=90*a,b=7*a,x=4*a;if(n.labelTarget&&(C(o,{width:P,height:r.height+b+x,x:i.x-P/2,y:r.y-b}),C(d,{fontSize:p+"px",lineHeight:u,paddingTop:b+"px",paddingBottom:x+"px"})),nn(n)&&!Fr(n)&&!te(n)){var S=_a(e),A=t.getAbsoluteBBox({x:S.x,y:S.y,width:0,height:0}),O=p+b+x;C(o,{width:P,height:O,x:A.x-P/2,y:A.y-O/2}),C(d,{fontSize:p+"px",lineHeight:u,paddingTop:b+"px",paddingBottom:x+"px"})}return m(e,"bpmn:TextAnnotation")&&(C(o,{width:r.width,height:r.height,minWidth:30*a,minHeight:10*a}),C(d,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:l+"px",lineHeight:f})),{bounds:o,style:d}};Vi.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}),JP(t)&&(t=null),this._modeling.updateLabel(e,t,i)};function $f(e){return m(e,"bpmn:SubProcess")&&!ie(e)}function XP(e){return m(e,"bpmn:SubProcess")&&ie(e)}function ZP(e){return m(e,"bpmn:Participant")&&!ie(e)}function QP(e){return m(e,"bpmn:Participant")&&ie(e)}function JP(e){return!e||!e.trim()}var j_="djs-element-hidden",F_="djs-label-hidden";function ju(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");$(l,{d:u,strokeWidth:2,stroke:eA(o)}),Z(s,l),Z(i,s),ke(s,o.x,o.y)}m(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,j_):(m(o,"bpmn:Task")||m(o,"bpmn:CallActivity")||m(o,"bpmn:SubProcess")||m(o,"bpmn:Participant")||m(o,"bpmn:Lane"))&&t.addMarker(o,F_)}),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}});$(r.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var p=c.active;p&&(t.removeMarker(p.element.label||p.element,j_),t.removeMarker(o,F_)),o=void 0,a=void 0,s&&(be(s),s=void 0)})}ju.$inject=["eventBus","canvas","pathMap"];function eA(e,t){var n=se(e);return n.get("stroke")||t||"black"}var H_={__depends__:[co,Lu,Cu],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Vi],labelEditingPreview:["type",ju]};var tA=500,nA=1e3;function Sr(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 $(a,C({x:0,y:0,rx:4,width:100,height:100},n)),a}e.on(["shape.added","shape.changed"],tA,function(o){var a=o.element,s=o.gfx,c=me(".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=me(".djs-outline",s);c||(c=i(s),Z(s,c)),r.updateConnectionOutline(c,a)})}Sr.prototype.updateShapeOutline=function(e,t){var n=!1,r=this._getProviders();r.length&&E(r,function(i){n=n||i.updateOutline(t,e)}),n||$(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})};Sr.prototype.updateConnectionOutline=function(e,t){var n=Ee(t);$(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+this.offset*2,height:n.height+this.offset*2})};Sr.prototype.registerProvider=function(e,t){t||(t=e,e=nA),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})};Sr.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers};Sr.prototype.getOutline=function(e){var t,n=this._getProviders();return E(n,function(r){Ne(r.getOutline)&&(t=t||r.getOutline(e))}),t};Sr.$inject=["eventBus","styles","elementRegistry"];var Fu=6;function zs(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)})}zs.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");or(t);var n=e.length>1,r=this._canvas.getContainer();if(ue(r)[n?"add":"remove"]("djs-multi-select"),!!n){var i=rA(Ee(e)),o=G("rect");$(o,C({rx:3},i)),ue(o).add("djs-selection-outline"),Z(t,o)}};zs.$inject=["eventBus","canvas","selection"];function rA(e){return{x:e.x-Fu,y:e.y-Fu,width:e.width+Fu*2,height:e.height+Fu*2}}var aa={__depends__:[qe],__init__:["outline","multiSelectionOutline"],outline:["type",Sr],multiSelectionOutline:["type",zs]};var $_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],z_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},iA=15,Hu=2;function $u(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=>Q(h,$_));if(f.length===1){let h=f[0];te(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(te),_=f.find(v=>{var w;return(w=v.labels)==null?void 0:w.includes(h)});h&&_&&a(h,_,l)}}),e.on("shape.changed",function({element:l}){var f;!Q(l,$_)||!u(l)||(te(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=jn([Y(f),Y(l)],z_),_=h.getAttribute("d"),w=d.includes(l)?c(l):p(l),P=Ir(w,_);if(!P)return;let x=d.includes(f)?c(f):p(f),S=Ir(x,_)||Y(f);bi(S,P)');return at(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function sA(e,t,n){at(e,{left:t+"px",top:n+"px"})}function Vf(e,t){e.style.display=t===!1?"none":""}var W_="djs-tooltip",zf="."+W_;function Pt(e,t){this._eventBus=e,this._canvas=t,this._ids=oA,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=aA(t.getContainer());var n=this;ut.bind(this._tooltipRoot,zf,"mousedown",function(r){r.stopPropagation()}),ut.bind(this._tooltipRoot,zf,"mouseover",function(r){n.trigger("mouseover",r)}),ut.bind(this._tooltipRoot,zf,"mouseout",function(r){n.trigger("mouseout",r)}),this._init()}Pt.$inject=["eventBus","canvas"];Pt.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=C({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t};Pt.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(Ye(n,"data-tooltip-id"));r&&(e==="mouseover"&&r.timeout&&this.clearTimeout(r),e==="mouseout"&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))};Pt.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]};Pt.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}};Pt.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)}};Pt.prototype.remove=function(e){var t=this.get(e);t&&(Bt(t.html),Bt(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])};Pt.prototype.show=function(){Vf(this._tooltipRoot)};Pt.prototype.hide=function(){Vf(this._tooltipRoot,!1)};Pt.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};Pt.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)),et(n)&&(n=ye(n)),r=ye('
    '),at(r,{position:"absolute"}),r.appendChild(n),e.type&&Ae(r).add("djs-tooltip-"+e.type),e.className&&Ae(r).add(e.className),e.htmlContainer=r,i.appendChild(r),this._tooltips[t]=e,this._updateTooltip(e)};Pt.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;sA(n,t.x,t.y)};Pt.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(cA)):m(a,"bpmn:DataObjectReference")&&r(i,n(pA)))})}zu.$inject=["eventBus","tooltips","translate"];var U_={__depends__:[G_],__init__:["modelingFeedback"],modelingFeedback:["type",zu]};var uA=500,lA=1250,fA=1500,Vu=Math.round;function dA(e){return{x:e.x+Vu(e.width/2),y:e.y+Vu(e.height/2)}}function Wu(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",fA,function(s){var c=s.context,p=s.shape,u=r.get().slice();u.indexOf(p)===-1&&(u=[p]),u=hA(u),C(c,{shapes:u,validatedShapes:u,shape:p})}),e.on("shape.move.start",lA,function(s){var c=s.context,p=c.validatedShapes,u;if(u=c.canExecute=o(p),!u)return!1}),e.on("shape.move.move",uA,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=Vu(p.x),p.y=Vu(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(an(s)){var c=dr(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,p,u){if(Ce(p)&&(u=p,p=!1),!(c.waypoints||!c.parent)&&!ue(s.target).has("djs-hit-no-move")){var l=dA(c);return t.init(s,l,"shape.move",{cursor:"grabbing",autoActivate:p,data:{shape:c,context:u||{}}}),!0}}this.start=a}Wu.$inject=["eventBus","dragging","modeling","selection","rules"];function hA(e){var t=wn(e,"id");return J(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var K_=499,Wf="djs-dragging",Y_="drop-ok",q_="drop-not-ok",X_="new-parent",Z_="attach-ok";function Gu(e,t,n,r){function i(c){var p=o(c),u=mA(p);return u}function o(c){var p=Fn(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){[Z_,Y_,q_,X_].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,Wf),c.allDraggedElements?c.allDraggedElements.push(p):c.allDraggedElements=[p]}e.on("shape.move.start",K_,function(c){var p=c.context,u=p.shapes,l=p.allDraggedElements,f=i(u);if(!p.dragGroup){var d=G("g");$(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();Z(h,d),p.dragGroup=d}f.forEach(function(_){r.addDragger(_,p.dragGroup)}),l?l=Ui([l,o(u)]):l=o(u),E(l,function(_){t.addMarker(_,Wf)}),p.allDraggedElements=l,p.differentParents=gA(u)}),e.on("shape.move.move",K_,function(c){var p=c.context,u=p.dragGroup,l=p.target,f=p.shape.parent,d=p.canExecute;l&&(d==="attach"?a(l,Z_):p.canExecute&&f&&l.id!==f.id?a(l,X_):a(l,p.canExecute?Y_:q_)),ke(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,Wf)}),l&&be(l)}),this.makeDraggable=s}Gu.$inject=["eventBus","canvas","styles","previewSupport"];function mA(e){var t=J(e,function(n){return fe(n)?ne(e,yt({id:n.source.id}))&&ne(e,yt({id:n.target.id})):!0});return t}function gA(e){return Jf(wn(e,function(t){return t.parent&&t.parent.id}))!==1}var Q_={__depends__:[Vr,qe,aa,ft,wt,xn],__init__:["move","movePreview"],move:["type",Wu],movePreview:["type",Gu]};var ex=".djs-palette-toggle",tx=".entry",vA=ex+", "+tx,Gf="djs-palette-",yA="shown",Uf="open",J_="two-column",_A=1e3;function Ze(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()})}Ze.$inject=["eventBus","canvas"];Ze.prototype.registerProvider=function(e,t){t||(t=e,e=_A),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()};Ze.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(bA,{})};Ze.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}};Ze.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),r=this._container=ye(Ze.HTML_MARKUP);n.appendChild(r),Ae(n).add(Gf+yA),ut.bind(r,vA,"click",function(i){var o=i.delegateTarget;if(Zs(o,ex))return e.toggle();e.trigger("click",i)}),ae.bind(r,"mousedown",function(i){i.stopPropagation()}),ut.bind(r,tx,"dragstart",function(i){e.trigger("dragstart",i)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:r})};Ze.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers};Ze.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,r=this._eventBus,i,o=Ae(n),a=Ae(t);"twoColumn"in e?i=e.twoColumn:i=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(J_,i),a.toggle(Gf+J_,i),"open"in e&&(o.toggle(Uf,e.open),a.toggle(Gf+Uf,e.open)),r.fire("palette.changed",{twoColumn:i,open:this.isOpen()})};Ze.prototype._update=function(){var e=me(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Tr(e),E(t,function(n,r){var i=n.group||"default",o=me("[data-group="+lr(i)+"]",e);o||(o=ye('
    '),Ye(o,"data-group",i),e.appendChild(o));var a=n.html||(n.separator?'
    ':'
    '),s=ye(a);if(o.appendChild(s),!n.separator&&(Ye(s,"data-action",r),n.title&&Ye(s,"title",n.title),n.className&&xA(s,n.className),n.imageUrl)){var c=ye("");Ye(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()};Ze.prototype.trigger=function(e,t,n){var r,i,o=t.delegateTarget||t.target;return o?(r=Ye(o,"data-action"),i=t.originalEvent||t,this.triggerEntry(r,e,i,n)):t.preventDefault()};Ze.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(Ne(a)){if(t==="click")return a(n,r)}else if(a[t])return a[t](n,r);n.preventDefault()}};Ze.prototype._layoutChanged=function(){this._toggleState({})};Ze.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 ix={__depends__:[ti,Zn],__init__:["lassoTool"],lassoTool:["type",Cr]};var Yf=1500,ax="grab";function oi(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(hr(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Yf,function(c){if(!(!ox(c.keyEvent)||a.isActive())){var p=a._mouse.getLastMoveEvent();a.activateMove(p,!!p)}},"keyboard.keydown"),s&&s.addListener(Yf,function(c){!ox(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!hr(c)&&u&&e.once("hand.move.ended",function(l){a.activateHand(l.originalEvent,!0,!0)}),!1})}oi.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"];oi.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:ax,data:{context:n||{}}})};oi.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:ax,data:{context:{reactivate:n}}})};oi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)};oi.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function ox(e){return ze("Space",e)}var sx={__depends__:[ti,Zn],__init__:["handTool"],handTool:["type",oi]};var cx="connect-ok",px="connect-not-ok";function ai(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?cx:px))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var p=c.context.startTarget,u=c.context.canStartConnect;p&&r.removeMarker(p,u?cx:px)}),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})}ai.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"];ai.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})};ai.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)};ai.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)};ai.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var ux={__depends__:[So,ft,wt,ti,Zn],globalConnect:["type",ai]};function Vs(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)}Vs.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"];Vs.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,_){function v(w){var P=n.createShape(C({type:l},_));t.start(w,P)}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 C(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 lx={__depends__:[nx,ei,yu,ix,sx,ux,Hr],__init__:["paletteProvider"],paletteProvider:["type",Vs]};var EA=250;function Ws(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);C(l,{x:f.x,y:f.y});var d=n.createShape(l);r.addShape(d,f.parent);var h=me('[data-element-id="'+lr(f.id)+'"]',s.dragGroup);h&&$(h,{display:"none"});var _=i.addDragger(d,s.dragGroup);s.visualReplacements[u]=_,r.removeShape(d)}})}function a(s){var c=s.visualReplacements;E(c,function(p,u){var l=me('[data-element-id="'+lr(u)+'"]',s.dragGroup);l&&$(l,{display:"inline"}),p.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",EA,function(s){var c=s.context,p=c.canExecute;c.visualReplacements||(c.visualReplacements={}),p&&p.replacements?o(c):a(c)})}Ws.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"];N(Ws,k);var fx={__depends__:[xn],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Ws]};var wA=1250,qf=40,SA=20,CA=10,dx=20,mx=["x","y"],RA=Math.abs;function Uu(e){e.on(["connect.hover","connect.move","connect.end"],wA,function(t){var n=t.context,r=n.canExecute,i=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&<(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),r&&o&&PA(t,o,DA(o)),o&&MA(r,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Kt(i),Q(o,["bpmn:Event","bpmn:Gateway"])&&hx(t,Kt(o)),Q(o,["bpmn:Task","bpmn:SubProcess"])&&AA(t,o),m(a,"bpmn:BoundaryEvent")&&s===a.host&&TA(t)):gx(r,"bpmn:MessageFlow")?(m(i,"bpmn:Event")&&(n.connectionStart=Kt(i)),m(o,"bpmn:Event")&&hx(t,Kt(o))):n.connectionStart=n.initialConnectionStart)})}Uu.$inject=["eventBus"];function PA(e,t,n){mx.forEach(function(r){var i=vx(r,t);e[r]t[r]+i-n&&Ie(e,r,t[r]+i-n)})}function AA(e,t){var n=Kt(t);mx.forEach(function(r){kA(e,t,r)&&Ie(e,r,n[r])})}function TA(e){var t=e.context,n=t.source,r=t.target;if(!OA(t)){var i=Kt(n),o=Le(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;RA(c-i[s])i[s]?p=i[s]+qf:p=i[s]-qf,Ie(e,s,p))})}}function hx(e,t){Ie(e,"x",t.x),Ie(e,"y",t.y)}function gx(e,t){return e&&e.type===t}function MA(e,t){return Nt(t,function(n){return gx(e,n)})}function vx(e,t){return e==="x"?t.width:t.height}function DA(e){return m(e,"bpmn:Task")?CA:SA}function kA(e,t,n){return e[n]>t[n]+dx&&e[n]=e.x||i&&i<=e.x)&&Ie(e,"x",e.x),(r&&r>=e.y||o&&o<=e.y)&&Ie(e,"y",e.y)}}function _x(e,t){return e.indexOf(t)!==-1}function xx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var HA=1250;function Gi(e,t){var n=this;e.on(["resize.start"],function(r){n.initSnap(r)}),e.on(["resize.move","resize.end"],HA,function(r){var i=r.context,o=i.shape,a=o.parent,s=i.direction,c=i.snapContext;if(!(r.originalEvent&<(r.originalEvent))&&!Mn(r)){var p=c.pointsForTarget(a);p.initialized||(p=n.addSnapTargetPoints(p,o,a,s),p.initialized=!0),VA(s)&&Ie(r,"x",r.x),WA(s)&&Ie(r,"y",r.y),t.snap(r,p)}}),e.on(["resize.cleanup"],function(){t.hide()})}Gi.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||(i=t.snapContext=new In);var o=bx(n,r);return i.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),i};Gi.prototype.addSnapTargetPoints=function(e,t,n,r){var i=this.getSnapTargets(t,n);return E(i,function(o){e.add("corner",Rp(o)),e.add("corner",Cp(o))}),e.add("corner",bx(t,r)),e};Gi.$inject=["eventBus","snapping"];Gi.prototype.getSnapTargets=function(e,t){return Pp(t).filter(function(n){return!$A(n,e)&&!fe(n)&&!zA(n)&&!te(n)})};function bx(e,t){var n=Y(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 $A(e,t){return e.host===t}function zA(e){return!!e.hidden}function VA(e){return e==="n"||e==="s"}function WA(e){return e==="e"||e==="w"}var GA=7,UA=1e3;function rr(e){this._canvas=e,this._asyncHide=qs(Je(this.hide,this),UA)}rr.$inject=["canvas"];rr.prototype.snap=function(e,t){var n=e.context,r=n.snapContext,i=r.getSnapLocations(),o={x:Mn(e,"x"),y:Mn(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,GA),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];Ce(s)&&Ie(e,a,s.originValue)})};rr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=G("path");return $(n,{d:"M0,0 L0,0"}),ue(n).add("djs-snap-line"),Z(t,n),{update:function(r){ee(r)?e==="horizontal"?$(n,{d:"M-100000,"+r+" L+100000,"+r,display:""}):$(n,{d:"M "+r+",-100000 L "+r+", +100000",display:""}):$(n,{display:"none"})}}};rr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}};rr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()};rr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]};rr.prototype.hide=function(){E(this._snapLines,function(e){e.update()})};var Ex={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",un],resizeSnapping:["type",Gi],snapping:["type",rr]};var wx={__depends__:[Ex],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Uu],createMoveSnapping:["type",si]};var Cx=300;function le(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=me(le.INPUT_SELECTOR,this._container),this._resultsContainer=me(le.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}le.$inject=["canvas","eventBus","selection","translate"];le.prototype._bindEvents=function(){var e=this;function t(n,r,i,o){e._eventMaps.push({el:n,type:i,listener:ut.bind(n,r,i,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,le.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,le.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,le.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,le.INPUT_SELECTOR,"keydown",function(n){ze("ArrowUp",n)&&n.preventDefault(),ze("ArrowDown",n)&&n.preventDefault()}),t(this._container,le.INPUT_SELECTOR,"keyup",function(n){if(ze("Escape",n))return e.close();if(ze("Enter",n)){var r=e._getCurrentResult();return r?e._select(r):e.close(!1)}if(ze("ArrowUp",n))return e._scrollToDirection(!0);if(ze("ArrowDown",n))return e._scrollToDirection();ze(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})};le.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ut.unbind(e.el,e.type,e.listener)})};le.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=me(le.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}};le.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}};le.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&&Sx(n,e.primaryTokens,le.RESULT_PRIMARY_HTML),Sx(n,e.secondaryTokens,le.RESULT_SECONDARY_HTML),Ye(n,le.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n};le.prototype.registerProvider=function(e){this._searchProvider=e};le.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,Ae(this._canvas.getContainer()).add("djs-search-open"),Ae(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))};le.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,Ae(this._canvas.getContainer()).remove("djs-search-open"),Ae(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())};le.prototype.toggle=function(){this.isOpen()?this.close():this.open()};le.prototype.isOpen=function(){return this._open};le.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Ae(t).remove(le.RESULT_SELECTED_CLASS);var n=Ye(e,le.RESULT_ID_ATTRIBUTE),r=this._results[n].element;Ae(e).add(le.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(r,{top:Cx}),this._selection.select(r),this._eventBus.fire("searchPad.preselected",r)}};le.prototype._select=function(e){var t=Ye(e,le.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Cx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)};le.prototype._getBoxHtml=function(){let e=ye(le.BOX_HTML),t=me(le.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Sx(e,t,n){var r=KA(t),i=ye(n);i.innerHTML=r,e.appendChild(i)}function KA(e){var t="";return e.forEach(function(n){var r=Cc(n.value||n.matched||n.normal),i=n.match||n.matched;i?t+=''+r+"":t+=r}),t!==""?t:null}le.CONTAINER_SELECTOR=".djs-search-container";le.INPUT_SELECTOR=".djs-search-input input";le.RESULTS_CONTAINER_SELECTOR=".djs-search-results";le.RESULT_SELECTOR=".djs-search-result";le.RESULT_SELECTED_CLASS="djs-search-result-selected";le.RESULT_SELECTED_SELECTOR="."+le.RESULT_SELECTED_CLASS;le.RESULT_ID_ATTRIBUTE="data-result-id";le.RESULT_HIGHLIGHT_CLASS="djs-search-highlight";le.BOX_HTML=`
    `;le.RESULT_HTML='
    ';le.RESULT_PRIMARY_HTML='
    ';le.RESULT_SECONDARY_HTML='

    ';var Rx={__depends__:[Hr,$r,qe],searchPad:["type",le]};function Gs(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._search=r,t.registerProvider(this)}Gs.$inject=["elementRegistry","searchPad","canvas","search"];Gs.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(r){return!te(r)&&!t.includes(r)});return this._search(n.map(r=>({element:r,label:xt(r),id:r.id})),e,{keys:["label","id"]}).map(YA)};function YA(e){let{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}var Px={__depends__:[Rx,ap],__init__:["bpmnSearch"],bpmnSearch:["type",Gs]};var Ax="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",Tx="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",Mx={width:36,height:50},Dx={width:50,height:50};function Xf(e,t,n){return G("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}var En=5;function sa(e,t){this._styles=t,e.registerProvider(this)}sa.$inject=["outline","styles"];sa.prototype.getOutline=function(e){let t=this._styles.cls("djs-outline",["no-fill"]);var n;if(Sh(e))return n=G("rect"),$(n,C({x:-En,y:-En,rx:4,width:e.width+En*2,height:e.height+En*2},t)),n;if(!te(e))return m(e,"bpmn:Gateway")?(n=G("rect"),C(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),$(n,C({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Q(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=G("rect"),$(n,C({x:-En,y:-En,rx:14,width:e.width+En*2,height:e.height+En*2},t))):m(e,"bpmn:EndEvent")?(n=G("circle"),$(n,C({cx:e.width/2,cy:e.height/2,r:e.width/2+En+1},t))):m(e,"bpmn:Event")?(n=G("circle"),$(n,C({cx:e.width/2,cy:e.height/2,r:e.width/2+En},t))):m(e,"bpmn:DataObjectReference")&&kx(e,"bpmn:DataObjectReference")?n=Xf(Ax,{x:-6,y:-6},t):m(e,"bpmn:DataStoreReference")&&kx(e,"bpmn:DataStoreReference")&&(n=Xf(Tx,{x:-6,y:-6},t)),n};sa.prototype.updateOutline=function(e,t){if(!te(e))return Q(e,["bpmn:SubProcess","bpmn:Group"])?($(t,{width:e.width+En*2,height:e.height+En*2}),!0):!!Q(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function kx(e,t){var n;return t==="bpmn:DataObjectReference"?n=Mx:t==="bpmn:DataStoreReference"&&(n=Dx),e.width===n.width&&e.height===n.height}var Ox={__depends__:[aa],__init__:["outlineProvider"],outlineProvider:["type",sa]};var qA='';function zt(e){hi.call(this,e)}N(zt,hi);zt.Viewer=sn;zt.NavigatedViewer=gr;zt.prototype.createDiagram=function(){return this.importXML(qA)};zt.prototype._interactionModules=[jc,zc,Vc];zt.prototype._modelingModules=[qm,xo,rg,Jm,Eg,So,Cg,h_,pu,ei,v_,x_,R_,A_,T_,N_,H_,V_,Su,U_,Q_,lx,fx,Lu,wx,Px,Ox];zt.prototype._modules=[].concat(sn.prototype._modules,zt.prototype._interactionModules,zt.prototype._modelingModules);var XA=globalThis;Object.assign(zt,{Modeler:zt,NavigatedViewer:gr,Viewer:sn});XA.BpmnJS=zt;var mX=zt;})();