(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2be5f084"],{"668d":function(e,t,n){"use strict";var i=n("7d7d");function r(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function o(e,t,n){var r=i.extend(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:r}),r.length&&r.forEach((function(i){e.set(i,t.inverse,n)}))}function a(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(t){if(t!==r){var o=r;r=null,o&&e.unset(o,i,n),r=t,e.set(r,i,n)}}})}function s(e,t){if(!(this instanceof s))return new s(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}s.prototype.bind=function(e,t){if("string"===typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?o(this,t,e):a(this,t,e)},s.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return i.isExtended(n)||o(this,t,e),n},s.prototype.ensureBound=function(e,t){r(e,t)||this.bind(e,t)},s.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},s.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)},e.exports=s},7024:function(e,t,n){"use strict";function i(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function r(e,t){return t={exports:{}},e(t,t.exports),t.exports}n.d(t,"a",(function(){return WR}));var o=r((function(e){var t=e.exports=function(e,n){if(n||(n=16),void 0===e&&(e=128),e<=0)return"0";for(var i=Math.log(Math.pow(2,e))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(n)*r;var o=i-Math.floor(i),a="";for(r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o);s=Math.floor(Math.random()*c).toString(n);a=s+a}var p=parseInt(a,n);return p!==1/0&&p>=Math.pow(2,e)?t(e,n):a};t.rack=function(e,n,i){var r=function(r){var a=0;do{if(a++>10){if(!i)throw new Error("too many ID collisions, use more bits");e+=i}var s=t(e,n)}while(Object.hasOwnProperty.call(o,s));return o[s]=r,s},o=r.hats={};return r.get=function(e){return r.hats[e]},r.set=function(e,t){return r.hats[e]=t,r},r.bits=e||128,r.base=n||16,r}}));function a(e){if(!(this instanceof a))return new a(e);e=e||[128,36,1],this._seed=e.length?o.rack(e[0],e[1],e[2]):e}a.prototype.next=function(e){return this._seed(e||!0)},a.prototype.nextPrefixed=function(e,t){var n;do{n=e+this.next(!0)}while(this.assigned(n));return this.claim(n,t),n},a.prototype.claim=function(e,t){this._seed.set(e,t||!0)},a.prototype.assigned=function(e){return this._seed.get(e)||!1},a.prototype.unclaim=function(e){delete this._seed.hats[e]},a.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};var s=a;function c(e){return Array.prototype.concat.apply([],e)}const p=Object.prototype.toString,l=Object.prototype.hasOwnProperty;function u(e){return void 0===e}function h(e){return void 0!==e}function d(e){return null==e}function f(e){return"[object Array]"===p.call(e)}function m(e){return"[object Object]"===p.call(e)}function v(e){return"[object Number]"===p.call(e)}function y(e){const t=p.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function g(e){return"[object String]"===p.call(e)}function b(e){if(!f(e))throw new Error("must supply array")}function x(e,t){return l.call(e,t)}function _(e,t){const n=F(t);let i;return S(e,(function(e,t){if(n(e,t))return i=e,!1})),i}function E(e,t){const n=F(t);let i=f(e)?-1:void 0;return S(e,(function(e,t){if(n(e,t))return i=t,!1})),i}function w(e,t){const n=F(t);let i=[];return S(e,(function(e,t){n(e,t)&&i.push(e)})),i}function S(e,t){let n,i;if(u(e))return;const r=f(e)?z:$;for(let o in e)if(x(e,o)&&(n=e[o],i=t(n,r(o)),!1===i))return n}function C(e,t){if(u(e))return[];b(e);const n=F(t);return e.filter((function(e,t){return!n(e,t)}))}function A(e,t,n){return S(e,(function(e,i){n=t(n,e,i)})),n}function k(e,t){return!!A(e,(function(e,n,i){return e&&t(n,i)}),!0)}function T(e,t){return!!_(e,t)}function R(e,t){let n=[];return S(e,(function(e,i){n.push(t(e,i))})),n}function D(e){return e&&Object.keys(e)||[]}function P(e){return D(e).length}function M(e){return R(e,e=>e)}function B(e,t,n={}){return t=I(t),S(e,(function(e){let i=t(e)||"_",r=n[i];r||(r=n[i]=[]),r.push(e)})),n}function N(e,...t){e=I(e);let n={};S(t,t=>B(t,e,n));let i=R(n,(function(e,t){return e[0]}));return i}const O=N;function j(e,t){t=I(t);let n=[];return S(e,(function(e,i){let r=t(e,i),o={d:r,v:e};for(var a=0;a<n.length;a++){let{d:e}=n[a];if(r<e)return void n.splice(a,0,o)}n.push(o)})),R(n,e=>e.v)}function L(e){return function(t){return k(e,(function(e,n){return t[n]===e}))}}function I(e){return y(e)?e:t=>t[e]}function F(e){return y(e)?e:t=>t===e}function $(e){return e}function z(e){return Number(e)}function H(e,t){let n,i,r,o;function a(n){let a=Date.now(),p=n?0:o+t-a;if(p>0)return s(p);e.apply(r,i),c()}function s(e){n=setTimeout(a,e)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function p(){n&&a(!0),c()}function l(...e){o=Date.now(),i=e,r=this,n||s(t)}return l.flush=p,l.cancel=c,l}function G(e,t){return e.bind(t)}function V(e,...t){return Object.assign(e,...t)}function W(e,t,n){let i=e;return S(t,(function(e,r){if("number"!==typeof e&&"string"!==typeof e)throw new Error("illegal key type: "+typeof e+". Key should be of type number or string.");if("constructor"===e)throw new Error("illegal key: constructor");if("__proto__"===e)throw new Error("illegal key: __proto__");let o=t[r+1],a=i[e];h(o)&&d(a)&&(a=i[e]=isNaN(+o)?{}:[]),u(o)?u(n)?delete i[e]:i[e]=n:i=a})),e}function U(e,t){let n={},i=Object(e);return S(t,(function(t){t in i&&(n[t]=e[t])})),n}function q(e,t){let n={},i=Object(e);return S(i,(function(e,i){-1===t.indexOf(i)&&(n[i]=e)})),n}function K(e,t){return t.forEach((function(t){t&&"string"!==typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}const Y=Object.prototype.toString,X=Object.prototype.hasOwnProperty;function Z(e){return void 0===e}function J(e){return"[object Array]"===Y.call(e)}function Q(e,t){return X.call(e,t)}function ee(e,t){let n,i;if(Z(e))return;const r=J(e)?ne:te;for(let o in e)if(Q(e,o)&&(n=e[o],i=t(n,r(o)),!1===i))return n}function te(e){return e}function ne(e){return Number(e)}function ie(e,...t){const n=e.style;return ee(t,(function(e){e&&ee(e,(function(e,t){n[t]=e}))})),e}function re(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}const oe=Object.prototype.toString;function ae(e){return new se(e)}function se(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function ce(e){var t;while(t=e.firstChild)e.removeChild(t);return e}function pe(e,t,n){var i=n?e:e.parentNode;return i&&"function"===typeof i.closest&&i.closest(t)||null}se.prototype.add=function(e){return this.list.add(e),this},se.prototype.remove=function(e){return"[object RegExp]"==oe.call(e)?this.removeMatching(e):(this.list.remove(e),this)},se.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},se.prototype.toggle=function(e,t){return"undefined"!==typeof t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},se.prototype.array=function(){return Array.from(this.list)},se.prototype.has=se.prototype.contains=function(e){return this.list.contains(e)};var le,ue,he,de={};function fe(){le=window.addEventListener?"addEventListener":"attachEvent",ue=window.removeEventListener?"removeEventListener":"detachEvent",he="addEventListener"!==le?"on":""}var me=de.bind=function(e,t,n,i){return le||fe(),e[le](he+t,n,i||!1),n},ve=de.unbind=function(e,t,n,i){return ue||fe(),e[ue](he+t,n,i||!1),n},ye=K({__proto__:null,bind:me,unbind:ve,default:de},[de]),ge=["focus","blur"];function be(e,t,n,i,r){return-1!==ge.indexOf(n)&&(r=!0),ye.bind(e,n,(function(n){var r=n.target||n.srcElement;n.delegateTarget=pe(r,t,!0),n.delegateTarget&&i.call(e,n)}),r)}function xe(e,t,n,i){return-1!==ge.indexOf(t)&&(i=!0),ye.unbind(e,t,n,i)}var _e,Ee={bind:be,unbind:xe},we=Ae,Se=!1;"undefined"!==typeof document&&(_e=document.createElement("div"),_e.innerHTML='  <link/><table></table><a href="/a">a</a><input type="checkbox"/>',Se=!_e.getElementsByTagName("link").length,_e=void 0);var Ce={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:Se?[1,"X<div>","</div>"]:[0,"",""]};function Ae(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var i=n[1];if("body"==i){var r=t.createElement("html");return r.innerHTML=e,r.removeChild(r.lastChild)}var o=Object.prototype.hasOwnProperty.call(Ce,i)?Ce[i]:Ce._default,a=o[0],s=o[1],c=o[2];r=t.createElement("div");r.innerHTML=s+e+c;while(a--)r=r.lastChild;if(r.firstChild==r.lastChild)return r.removeChild(r.firstChild);var p=t.createDocumentFragment();while(r.firstChild)p.appendChild(r.removeChild(r.firstChild));return p}Ce.td=Ce.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Ce.option=Ce.optgroup=[1,'<select multiple="multiple">',"</select>"],Ce.thead=Ce.tbody=Ce.colgroup=Ce.caption=Ce.tfoot=[1,"<table>","</table>"],Ce.polyline=Ce.ellipse=Ce.polygon=Ce.circle=Ce.text=Ce.line=Ce.path=Ce.rect=Ce.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var ke=we;function Te(e,t){return e&&"function"===typeof e.matches&&e.matches(t)||!1}function Re(e,t){return t=t||document,t.querySelector(e)}function De(e,t){return t=t||document,t.querySelectorAll(e)}function Pe(e){e.parentNode&&e.parentNode.removeChild(e)}function Me(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(n){}return e}function Be(e,t){return t.appendChild(Me(e,t))}function Ne(e,t){return Be(t,e),e}var Oe=2,je={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":Oe,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":Oe,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function Le(e,t){return je[t]?e.style[t]:e.getAttributeNS(null,t)}function Ie(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=je[i];r?(r===Oe&&"number"===typeof n&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function Fe(e,t){var n,i,r=Object.keys(t);for(n=0,i;i=r[n];n++)Ie(e,i,t[i])}function $e(e,t,n){if("string"===typeof t){if(void 0===n)return Le(e,t);Ie(e,t,n)}else Fe(e,t);return e}const ze=Object.prototype.toString;function He(e){return new Ge(e)}function Ge(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Ve(e){var t;while(t=e.firstChild)e.removeChild(t);return e}function We(e){return e.cloneNode(!0)}Ge.prototype.add=function(e){return this.list.add(e),this},Ge.prototype.remove=function(e){return"[object RegExp]"==ze.call(e)?this.removeMatching(e):(this.list.remove(e),this)},Ge.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Ge.prototype.toggle=function(e,t){return"undefined"!==typeof t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ge.prototype.array=function(){return Array.from(this.list)},Ge.prototype.has=Ge.prototype.contains=function(e){return this.list.contains(e)};var Ue={svg:"http://www.w3.org/2000/svg"},qe='<svg xmlns="'+Ue.svg+'"';function Ke(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(Ue.svg)&&(e=qe+e.substring(4)):(e=qe+">"+e+"</svg>",t=!0);var n=Ye(e);if(!t)return n;var i=document.createDocumentFragment(),r=n.firstChild;while(r.firstChild)i.appendChild(r.firstChild);return i}function Ye(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Xe(e,t){var n;return e=e.trim(),"<"===e.charAt(0)?(n=Ke(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Ue.svg,e),t&&$e(n,t),n}var Ze=null;function Je(){return null===Ze&&(Ze=Xe("svg")),Ze}function Qe(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function et(e,t,n,i,r,o){var a=Je().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Qe(a,e);case 6:return Qe(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function tt(e){return e?Je().createSVGTransformFromMatrix(e):Je().createSVGTransform()}var nt=/([&<>]{1})/g,it=/([\n\r"]{1})/g,rt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function ot(e,t){function n(e,t){return rt[t]||t}return e.replace(t,n)}function at(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(ot(e.textContent,nt));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',ot(o.value,it),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)at(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",ot(e.nodeValue,nt),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function st(e,t){var n=Ke(t);if(Ve(e),t){pt(n)||(n=n.documentElement);for(var i=ut(n.childNodes),r=0;r<i.length;r++)Be(i[r],e)}}function ct(e){var t=e.firstChild,n=[];while(t)at(t,n),t=t.nextSibling;return n.join("")}function pt(e){return"#document-fragment"===e.nodeName}function lt(e,t){if(void 0!==t){try{st(e,t)}catch(n){throw new Error("error parsing SVG: "+n.message)}return e}return ct(e)}function ut(e){return Array.prototype.slice.call(e)}function ht(e){var t=e.parentNode;return t&&t.removeChild(e),e}function dt(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function ft(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(dt(e,i))}function mt(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),ft(n,t)),n.consolidate()}const vt=/^class[ {]/;function yt(e){return vt.test(e.toString())}function gt(e){return Array.isArray(e)}function bt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function xt(...e){1===e.length&&gt(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const _t=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Et=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,wt=/\/\*([^*]*)\*\//m;function St(e){if("function"!==typeof e)throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(yt(e)?_t:Et);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(e=>{const t=e.match(wt);return(t&&t[1]||e).trim()})||[]}function Ct(e,t){t=t||{get:function(e,t){if(n.push(e),!1===t)return null;throw a(`No provider for "${e}"!`)}};const n=[],i=this._providers=Object.create(t._providers||null),r=this._instances=Object.create(null),o=r.injector=this,a=function(e){const t=n.join(" -> ");return n.length=0,new Error(t?`${e} (Resolving: ${t})`:e)};function s(e,o){if(!i[e]&&-1!==e.indexOf(".")){const t=e.split(".");let n=s(t.shift());while(t.length)n=n[t.shift()];return n}if(bt(r,e))return r[e];if(bt(i,e)){if(-1!==n.indexOf(e))throw n.push(e),a("Cannot resolve circular dependency!");return n.push(e),r[e]=i[e][0](i[e][1]),n.pop(),r[e]}return t.get(e,o)}function c(e,t){if("undefined"===typeof t&&(t={}),"function"!==typeof e){if(!gt(e))throw a(`Cannot invoke "${e}". Expected a function!`);e=xt(e.slice())}const n=e.$inject||St(e),i=n.map(e=>bt(t,e)?t[e]:s(e));return{fn:e,dependencies:i}}function p(e){const{fn:t,dependencies:n}=c(e),i=Function.prototype.bind.apply(t,[null].concat(n));return new i}function l(e,t,n){const{fn:i,dependencies:r}=c(e,n);return i.apply(t,r)}function u(e){return xt(t=>e.get(t))}function h(e,t){if(t&&t.length){const n=Object.create(null),r=Object.create(null),o=[],a=[],s=[];let c,p,l,h;for(let e in i)c=i[e],-1!==t.indexOf(e)&&("private"===c[2]?(p=o.indexOf(c[3]),-1===p?(l=c[3].createChild([],t),h=u(l),o.push(c[3]),a.push(l),s.push(h),n[e]=[h,e,"private",l]):n[e]=[s[p],e,"private",a[p]]):n[e]=[c[2],c[1]],r[e]=!0),"factory"!==c[2]&&"type"!==c[2]||!c[1].$scope||t.forEach(t=>{-1!==c[1].$scope.indexOf(t)&&(n[e]=[c[2],c[1]],r[t]=!0)});t.forEach(e=>{if(!r[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')}),e.unshift(n)}return new Ct(e,o)}const d={factory:l,type:p,value:function(e){return e}};function f(e,t){const n=e.__init__||[];return function(){n.forEach(e=>{"string"===typeof e?t.get(e):t.invoke(e)})}}function m(e){const t=e.__exports__;if(t){const n=e.__modules__,r=Object.keys(e).reduce((t,n)=>("__exports__"!==n&&"__modules__"!==n&&"__init__"!==n&&"__depends__"!==n&&(t[n]=e[n]),t),Object.create(null)),o=(n||[]).concat(r),a=h(o),s=xt((function(e){return a.get(e)}));t.forEach((function(e){i[e]=[s,e,"private",a]}));const c=(e.__init__||[]).slice();return c.unshift((function(){a.init()})),e=Object.assign({},e,{__init__:c}),f(e,a)}return Object.keys(e).forEach((function(t){if("__init__"===t||"__depends__"===t)return;if("private"===e[t][2])return void(i[t]=e[t]);const n=e[t][0],r=e[t][1];i[t]=[d[n],At(n,r),n]})),f(e,o)}function v(e,t){return-1!==e.indexOf(t)?e:(e=(t.__depends__||[]).reduce(v,e),-1!==e.indexOf(t)?e:e.concat(t))}function y(e){const t=e.reduce(v,[]).map(m);let n=!1;return function(){n||(n=!0,t.forEach(e=>e()))}}this.get=s,this.invoke=l,this.instantiate=p,this.createChild=h,this.init=y(e)}function At(e,t){return"value"!==e&&gt(t)&&(t=xt(t.slice())),t}var kt=1e3;function Tt(e,t){var n=this;t=t||kt,e.on(["render.shape","render.connection"],t,(function(e,t){var i=e.type,r=t.element,o=t.gfx,a=t.attrs;if(n.canRender(r))return"render.shape"===i?n.drawShape(o,r,a):n.drawConnection(o,r,a)})),e.on(["render.getShapePath","render.getConnectionPath"],t,(function(e,t){if(n.canRender(t))return"render.getShapePath"===e.type?n.getShapePath(t):n.getConnectionPath(t)}))}function Rt(e){return e.flat().join(",").replace(/,?([A-z]),?/g,"$1")}function Dt(e){return["M",e.x,e.y]}function Pt(e){return["L",e.x,e.y]}function Mt(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function Bt(e,t){const n=e.length,i=[Dt(e[0])];for(let r=1;r<n;r++){const n=e[r-1],o=e[r],a=e[r+1];if(!a||!t){i.push(Pt(o));continue}const s=Math.min(t,Ot(o.x-n.x,o.y-n.y),Ot(a.x-o.x,a.y-o.y));if(!s){i.push(Pt(o));continue}const c=Nt(o,n,s),p=Nt(o,n,.5*s),l=Nt(o,a,s),u=Nt(o,a,.5*s);i.push(Pt(c)),i.push(Mt(p,u,l))}return i}function Nt(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Ot(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Ot(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function jt(e,t,n){v(t)&&(n=t,t=null),t||(t={});const i=Xe("path",t);return v(n)&&(i.dataset.cornerRadius=String(n)),Lt(i,e)}function Lt(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return $e(e,{d:Rt(Bt(t,n))}),e}function It(e){return w(e,(function(t){return!_(e,(function(e){return e!==t&&Ft(t,e)}))}))}function Ft(e,t){if(t){if(e===t)return t;if(e.parent)return Ft(e.parent,t)}}function $t(e,t,n){var i=!n||-1===e.indexOf(t);return i&&e.push(t),i}function zt(e,t,n){n=n||0,f(e)||(e=[e]),S(e,(function(e,i){var r=t(e,i,n);f(r)&&r.length&&zt(r,t,n+1)}))}function Ht(e,t,n){var i=[],r=[];return zt(e,(function(e,o,a){$t(i,e,t);var s=e.children;if((-1===n||a<n)&&s&&$t(r,s,t))return s})),i}function Gt(e,t){return Ht(e,!t,-1)}function Vt(e,t,n){u(t)&&(t=!0),m(t)&&(n=t,t=!0),n=n||{};var i=Yt(n.allShapes),r=Yt(n.allConnections),o=Yt(n.enclosedElements),a=Yt(n.enclosedConnections),s=Yt(n.topLevel,t&&B(e,(function(e){return e.id})));function c(e){s[e.source.id]&&s[e.target.id]&&(s[e.id]=[e]),i[e.source.id]&&i[e.target.id]&&(a[e.id]=o[e.id]=e),r[e.id]=e}function p(e){if(o[e.id]=e,!e.waypoints)return i[e.id]=e,S(e.incoming,c),S(e.outgoing,c),e.children;a[e.id]=r[e.id]=e}return zt(e,p),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Wt(e,t){var n,i,r,o;return t=!!t,f(e)||(e=[e]),S(e,(function(e){var a=e;e.waypoints&&!t&&(a=Wt(e.waypoints,!0));var s=a.x,c=a.y,p=a.height||0,l=a.width||0;(s<n||void 0===n)&&(n=s),(c<i||void 0===i)&&(i=c),(s+l>r||void 0===r)&&(r=s+l),(c+p>o||void 0===o)&&(o=c+p)})),{x:n,y:i,height:o-i,width:r-n}}function Ut(e,t){var n={};return S(e,(function(e){var i=e;i.waypoints&&(i=Wt(i)),!v(t.y)&&i.x>t.x&&(n[e.id]=e),!v(t.x)&&i.y>t.y&&(n[e.id]=e),i.x>t.x&&i.y>t.y&&(v(t.width)&&v(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.y<t.height+t.y?n[e.id]=e:v(t.width)&&v(t.height)||(n[e.id]=e))})),n}function qt(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Kt(e){return!(!e||!e.isFrame)}function Yt(e,t){return V({},e||{},t||{})}Tt.prototype.canRender=function(e){},Tt.prototype.drawShape=function(e,t){},Tt.prototype.drawConnection=function(e,t){},Tt.prototype.getShapePath=function(e){},Tt.prototype.getConnectionPath=function(e){};var Xt=1;function Zt(e,t){Tt.call(this,e,Xt),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}function Jt(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(e,t,n){var i=this.style(t,n);return V(i,{class:e})},this.style=function(t,n){f(t)||n||(n=t,t=[]);var i=A(t,(function(t,n){return V(t,e[n]||{})}),{});return n?V(i,n):i},this.computeStyle=function(e,n,i){return f(n)||(i=n,n=[]),t.style(n||[],V({},i,e||{}))}}i(Zt,Tt),Zt.prototype.canRender=function(){return!0},Zt.prototype.drawShape=function(e,t,n){var i=Xe("rect");return $e(i,{x:0,y:0,width:t.width||0,height:t.height||0}),Kt(t)?$e(i,V({},this.FRAME_STYLE,n||{})):$e(i,V({},this.SHAPE_STYLE,n||{})),Ne(e,i),i},Zt.prototype.drawConnection=function(e,t,n){var i=jt(t.waypoints,V({},this.CONNECTION_STYLE,n||{}));return Ne(e,i),i},Zt.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return Rt(o)},Zt.prototype.getConnectionPath=function(e){var t,n,i=e.waypoints,r=[];for(t=0;n=i[t];t++)n=n.original||n,r.push([0===t?"M":"L",n.x,n.y]);return Rt(r)},Zt.$inject=["eventBus","styles"];var Qt={__init__:["defaultRenderer"],defaultRenderer:["type",Zt],styles:["type",Jt]};function en(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function tn(e,t,n){if(e&&t){"number"!==typeof n&&(n=-1);var i=e.indexOf(t);if(-1!==i){if(i===n)return;if(-1===n)return;e.splice(i,1)}-1!==n?e.splice(n,0,t):e.push(t)}}function nn(e,t){return e&&t?e.indexOf(t):-1}function rn(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function on(e,t,n,i){if("undefined"===typeof i&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=rn(e,t);return Math.abs(r/o)<=i}var an=2;function sn(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(cn(r,n))return o;return!1}function cn(e,t){const n=t[0];return k(t,(function(t){return Math.abs(n[e]-t[e])<=an}))}function pn(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function ln(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var un=n("e5ab"),hn=n.n(un);function dn(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function fn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function mn(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function vn(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function yn(e){return fn({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function gn(e){var t=e.waypoints,n=t.reduce((function(e,n,i){var r=t[i-1];if(r){var o=e[e.length-1],a=o&&o.endLength||0,s=Sn(r,n);e.push({start:r,end:n,startLength:a,endLength:a+s,length:s})}return e}),[]),i=n.reduce((function(e,t){return e+t.length}),0),r=i/2,o=0,a=n[o];while(a.endLength<r)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function bn(e){return Cn(e)?gn(e):yn(e)}function xn(e,t,n){n=n||0,m(n)||(n={x:n,y:n});var i=mn(e),r=mn(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,p=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&p?p+"-"+l:l||p||"intersect"}function _n(e,t,n){var i=En(e,t);return 1===i.length||2===i.length&&rn(i[0],i[1])<1?fn(i[0]):i.length>1?(i=j(i,(function(e){var t=Math.floor(100*e.t2)||1;return t=100-t,t=(t<10?"0":"")+t,e.segment2+"#"+t})),fn(i[n?0:i.length-1])):null}function En(e,t){return hn()(e,t)}function wn(e){e=e.slice();var t,n,i,r=0;while(e[r])t=e[r],n=e[r-1],i=e[r+1],0===rn(t,i)||on(n,i,t)?e.splice(r,1):r++;return e}function Sn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Cn(e){return!!e.waypoints}function An(e,t){return Math.round(e*t)/t}function kn(e){return v(e)?e+"px":e}function Tn(e){while(e.parent)e=e.parent;return e}function Rn(e){e=V({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),ie(n,{position:"relative",overflow:"hidden",width:kn(e.width),height:kn(e.height)}),t.appendChild(n),n}function Dn(e,t,n){const i=Xe("g");He(i).add(t);const r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const Pn="base",Mn=0,Bn=1,Nn={shape:["x","y","width","height"],connection:["waypoints"]};function On(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._init(e||{})}function jn(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}On.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],On.prototype._init=function(e){const t=this._eventBus,n=this._container=Rn(e),i=this._svg=Xe("svg");$e(i,{width:"100%",height:"100%"}),Ne(n,i);const r=this._viewport=Dn(i,"viewport");!1!==e.deferUpdate&&(this._viewboxChanged=H(G(this._viewboxChanged,this),300)),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),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)},On.prototype._destroy=function(){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const 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},On.prototype._clear=function(){const e=this._elementRegistry.getAll();e.forEach(e=>{const t=qt(e);"root"===t?this.removeRootElement(e):this._removeElement(e,t)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},On.prototype.getDefaultLayer=function(){return this.getLayer(Pn,Mn)},On.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)),"undefined"!==typeof t&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},On.prototype._getChildIndex=function(e){return A(this._layers,(function(t,n){return n.visible&&e>=n.index&&t++,t}),0)},On.prototype._createLayer=function(e,t){"undefined"===typeof t&&(t=Bn);const n=this._getChildIndex(t);return{group:Dn(this._viewport,"layer-"+e,n),index:t,visible:!0}},On.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},On.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible?(ht(n),t.visible=!1,n):n},On.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],ht(t.group))},On.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},On.prototype.findRoot=function(e){if("string"===typeof e&&(e=this._elementRegistry.get(e)),!e)return;const t=this._findPlaneForRoot(Tn(e))||{};return t.rootElement},On.prototype.getRootElements=function(){return this._planes.map((function(e){return e.rootElement}))},On.prototype._findPlaneForRoot=function(e){return _(this._planes,(function(t){return t.rootElement===e}))},On.prototype.getContainer=function(){return this._container},On.prototype._updateMarker=function(e,t,n){let i;e.id||(e=this._elementRegistry.get(e)),i=this._elementRegistry._elements[e.id],i&&(S([i.gfx,i.secondaryGfx],(function(e){e&&(n?He(e).add(t):He(e).remove(t))})),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},On.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},On.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},On.prototype.hasMarker=function(e,t){e.id||(e=this._elementRegistry.get(e));const n=this.getGraphics(e);return He(n).has(t)},On.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},On.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},On.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,Mn);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},On.prototype.removeRootElement=function(e){"string"===typeof e&&(e=this._elementRegistry.get(e));const t=this._findPlaneForRoot(e);if(t)return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter((function(t){return t.rootElement!==e})),this._rootElement===e&&(this._rootElement=null),e},On.prototype.setRootElement=function(e,t){if(h(t))throw new Error("override not supported");if(e===this._rootElement)return;let n;if(!e)throw new Error("rootElement required");return n=this._findPlaneForRoot(e),n||(e=this.addRootElement(e)),this._setRoot(e),e},On.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},On.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},On.prototype._setRoot=function(e,t){const 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})},On.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");const n=Nn[e],i=k(n,(function(e){return"undefined"!==typeof t[e]}));if(!i)throw new Error("must supply { "+n.join(", ")+" } with "+e)},On.prototype._setParent=function(e,t,n){tn(t.children,e,n),e.parent=t},On.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},On.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},On.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},On.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),e)return r.fire(t+".remove",{element:e}),i.remove(e),en(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},On.prototype.removeShape=function(e){return this._removeElement(e,"shape")},On.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},On.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},On.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},On.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},On.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,p;return e?(this._changeViewbox((function(){s=Math.min(n.width/e.width,n.height/e.height);const i=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);mt(t,i)})),e):(o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=mt(t),r=a?a.matrix:et(),s=An(r.a,1e3),c=An(-r.e||0,1e3),p=An(-r.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:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e)},On.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox((function(){e=V({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),jn(t,n)})),{x:n.e,y:n.f}},On.prototype.scrollToElement=function(e,t){let n=100;"string"===typeof e&&(e=this._elementRegistry.get(e));const i=this.findRoot(e);i!==this.getRootElement()&&this.setRootElement(i),t||(t={}),"number"===typeof t&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const r=Wt(e),o=mn(r),a=this.viewbox(),s=this.zoom();let 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;const l=mn(a),u=r.width<a.width&&r.height<a.height;if(u){const e=Math.max(0,o.right-l.right),t=Math.min(0,o.left-l.left),n=Math.max(0,o.bottom-l.bottom),i=Math.min(0,o.top-l.top);c=e||t,p=n||i}else c=r.x-a.x,p=r.y-a.y;this.scroll({dx:-c*s,dy:-p*s})},On.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if("fit-viewport"===e)return this._fitViewport(t);let n,i;return this._changeViewbox((function(){"object"!==typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)})),An(i.a,1e3)},On.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},On.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,p,l;c=i.getCTM();const u=c.a;return t?(a=V(o,t),s=a.matrixTransform(c.inverse()),p=r.translate(s.x,s.y).scale(1/u*e).translate(-s.x,-s.y),l=c.multiply(p)):l=r.scale(e),jn(this._viewport,l),l},On.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},On.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;if(e.waypoints){const t=this.getGraphics(e);n=t.getBBox()}else n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},On.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Ln="data-element-id";function In(e){this._elements={},this._eventBus=e}In.$inject=["eventBus"],In.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),$e(t,Ln,i),n&&$e(n,Ln,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},In.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&($e(i.gfx,Ln,""),i.secondaryGfx&&$e(i.secondaryGfx,Ln,""),delete t[n])},In.prototype.updateId=function(e,t){this._validateId(t),"string"===typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},In.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&$e(t,Ln,i),t},In.prototype.get=function(e){var t;t="string"===typeof e?e:e&&$e(e,Ln);var n=this._elements[t];return n&&n.element},In.prototype.filter=function(e){var t=[];return this.forEach((function(n,i){e(n,i)&&t.push(n)})),t},In.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=n[i],o=t[r],a=o.element,s=o.gfx;if(e(a,s))return a}},In.prototype.getAll=function(){return this.filter((function(e){return e}))},In.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach((function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)}))},In.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},In.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};var Fn=n("8fcf"),$n=n.n(Fn),zn=new $n.a({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Hn=new $n.a({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Gn=new $n.a({name:"attachers",collection:!0},{name:"host"}),Vn=new $n.a({name:"outgoing",collection:!0},{name:"source"}),Wn=new $n.a({name:"incoming",collection:!0},{name:"target"});function Un(){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)}}),zn.bind(this,"parent"),Hn.bind(this,"labels"),Vn.bind(this,"outgoing"),Wn.bind(this,"incoming")}function qn(){Un.call(this),zn.bind(this,"children"),Gn.bind(this,"host"),Gn.bind(this,"attachers")}function Kn(){qn.call(this)}function Yn(){qn.call(this),Hn.bind(this,"labelTarget")}function Xn(){Un.call(this),Vn.bind(this,"source"),Wn.bind(this,"target")}i(qn,Un),i(Kn,qn),i(Yn,qn),i(Xn,Un);var Zn={connection:Xn,shape:qn,label:Yn,root:Kn};function Jn(e,t){var n=Zn[e];if(!n)throw new Error("unknown type: <"+e+">");return V(new n,t)}function Qn(){this._uid=12}Qn.prototype.createRoot=function(e){return this.create("root",e)},Qn.prototype.createLabel=function(e){return this.create("label",e)},Qn.prototype.createShape=function(e){return this.create("shape",e)},Qn.prototype.createConnection=function(e){return this.create("connection",e)},Qn.prototype.create=function(e,t){return t=V({},t||{}),t.id||(t.id=e+"_"+this._uid++),Jn(e,t)};var ei="__fn",ti=1e3,ni=Array.prototype.slice;function ii(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function ri(){}function oi(e,t){return e.apply(null,t)}function ai(e){return e.childNodes[0]}function si(e){return e.parentNode.childNodes[1]}function ci(e,t,n,i,r){var o=tt();o.setTranslate(t,n);var a=tt();a.setRotate(i||0,0,0);var s=tt();s.setScale(r||1,r||1),mt(e,[o,a,s])}function pi(e,t,n){var i=tt();i.setTranslate(t,n),mt(e,i)}function li(e,t){var n=tt();n.setRotate(t,0,0),mt(e,n)}function ui(e,t){this._eventBus=e,this._elementRegistry=t}function hi(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}ii.prototype.on=function(e,t,n,i){if(e=f(e)?e:[e],y(t)&&(i=n,n=t,t=ti),!v(t))throw new Error("priority must be a number");var r=n;i&&(r=G(n,i),r[ei]=n[ei]||n);var o=this;e.forEach((function(e){o._addListener(e,{priority:t,callback:r,next:null})}))},ii.prototype.once=function(e,t,n,i){var r=this;if(y(t)&&(i=n,n=t,t=ti),!v(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var t=n.apply(i,arguments);return r.off(e,o),t}o[ei]=n,this.on(e,t,o)},ii.prototype.off=function(e,t){e=f(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},ii.prototype.createEvent=function(e){var t=new ri;return t.init(e),t},ii.prototype.fire=function(e,t){var n,i,r,o;if(o=ni.call(arguments),"object"===typeof e&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],i){n=t instanceof ri?t:this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return void 0===r&&n.defaultPrevented&&(r=!1),r}},ii.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},ii.prototype._destroy=function(){this._listeners={}},ii.prototype._invokeListeners=function(e,t,n){var i;while(n){if(e.cancelBubble)break;i=this._invokeListener(e,t,n),n=n.next}return i},ii.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=oi(n.callback,t),void 0!==i&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},ii.prototype._addListener=function(e,t){var n,i=this._getListeners(e);if(i){while(i){if(i.priority<t.priority)return t.next=i,void(n?n.next=t:this._setListeners(e,t));n=i,i=i.next}n.next=t}else this._setListeners(e,t)},ii.prototype._getListeners=function(e){return this._listeners[e]},ii.prototype._setListeners=function(e,t){this._listeners[e]=t},ii.prototype._removeListener=function(e,t){var n,i,r,o=this._getListeners(e);if(t)while(o)n=o.next,r=o.callback,r!==t&&r[ei]!==t||(i?i.next=n:this._setListeners(e,n)),i=o,o=n;else this._setListeners(e,null)},ri.prototype.stopPropagation=function(){this.cancelBubble=!0},ri.prototype.preventDefault=function(){this.defaultPrevented=!0},ri.prototype.init=function(e){V(this,e||{})},ui.$inject=["eventBus","elementRegistry"],ui.prototype._getChildrenContainer=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=si(n),t||(t=Xe("g"),He(t).add("djs-children"),Ne(n.parentNode,t))):t=n,t},ui.prototype._clear=function(e){var t=ai(e);return ce(t),t},ui.prototype._createContainer=function(e,t,n,i){var r=Xe("g");He(r).add("djs-group"),"undefined"!==typeof n?hi(r,t,t.childNodes[n]):Ne(t,r);var o=Xe("g");He(o).add("djs-element"),He(o).add("djs-"+e),i&&He(o).add("djs-frame"),Ne(r,o);var a=Xe("g");return He(a).add("djs-visual"),Ne(o,a),o},ui.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Kt(t))},ui.prototype.updateContainments=function(e){var t,n=this,i=this._elementRegistry;t=A(e,(function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e}),{}),S(t,(function(e){var t=e.children;if(t){var r=n._getChildrenContainer(e);S(t.slice().reverse(),(function(e){var t=i.getGraphics(e);hi(t.parentNode,r)}))}}))},ui.prototype.drawShape=function(e,t){var n=this._eventBus;return n.fire("render.shape",{gfx:e,element:t})},ui.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},ui.prototype.drawConnection=function(e,t){var n=this._eventBus;return n.fire("render.connection",{gfx:e,element:t})},ui.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},ui.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),pi(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(i,t)}t.hidden?$e(n,"display","none"):$e(n,"display","block")}},ui.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);ht(t.parentNode)};var di={__depends__:[Qt],__init__:["canvas"],canvas:["type",On],elementRegistry:["type",In],elementFactory:["type",Qn],eventBus:["type",ii],graphicsFactory:["type",ui]};function fi(e){var t=new Ct(e);return t.init(),t}function mi(e){e=e||{};var t={config:["value",e]},n=[t,di].concat(e.modules||[]);return fi(n)}function vi(e,t){this.injector=t=t||mi(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}function yi(){}function gi(e,t){this.model=e,this.properties=t}vi.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},vi.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},yi.prototype.get=function(e){return this.$model.properties.get(this,e)},yi.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},gi.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(yi.prototype);S(e.properties,(function(e){e.isMany||void 0===e.default||(i[e.name]=e.default)})),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(e){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),S(e,G((function(e,t){this.set(t,e)}),this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var bi={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},xi={String:function(e){return e},Boolean:function(e){return"true"===e},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}};function _i(e,t){var n=xi[e];return n?n(t):t}function Ei(e){return!!bi[e]}function wi(e){return!!xi[e]}function Si(e,t){var n,i,r=e.split(/:/);if(1===r.length)n=e,i=t;else{if(2!==r.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=r[1],i=r[0]}return e=(i?i+":":"")+n,{name:e,prefix:i,localName:n}}function Ci(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function Ai(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,S(e,G(this.registerPackage,this))}function ki(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Ti(e){this.model=e}function Ri(e){return"undefined"===typeof e}function Di(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Pi(e){return e.replace(/^:/,"")}function Mi(e,t={}){this.properties=new Ti(this),this.factory=new gi(this,this.properties),this.registry=new Ai(e,this.properties),this.typeCache={},this.config=t}Ci.prototype.build=function(){return U(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Ci.prototype.addProperty=function(e,t,n){"boolean"===typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var i=this.properties;void 0!==t?i.splice(t,0,e):i.push(e)},Ci.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(-1===s)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},Ci.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Si(r[0],i),a=Si(r[1],o.prefix).name,s=this.propertiesByName[a];if(!s)throw new Error("refined property <"+a+"> not found");this.replaceProperty(s,e,n),delete e.redefines},Ci.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},Ci.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Ci.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},Ci.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},Ci.prototype.assertNotTrait=function(e){const t=e.extends||[];if(t.length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Ci.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},Ci.prototype.hasProperty=function(e){return this.propertiesByName[e]},Ci.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(S(e.properties,G((function(n){n=V({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var i=n.replaces,r=n.redefines;i||r?this.redefineProperty(n,i||r,i):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))}),this)),i.push(e),n[r]=e)},Ai.prototype.getPackage=function(e){return this.packageMap[e]},Ai.prototype.getPackages=function(){return this.packages},Ai.prototype.registerPackage=function(e){e=V({},e);var t=this.packageMap;ki(t,e,"prefix"),ki(t,e,"uri"),S(e.types,G((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ai.prototype.registerType=function(e,t){e=V({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:V(e.meta||{})});var n=Si(e.name,t.prefix),i=n.name,r={};S(e.properties,G((function(e){var t=Si(e.name,n.prefix),i=t.name;Ei(e.type)||(e.type=Si(e.type,t.prefix).name),V(e,{ns:t,name:i}),r[i]=e}),this)),V(e,{ns:n,name:i,propertiesByName:r}),S(e.extends,G((function(e){var t=Si(e,n.prefix),r=this.typeMap[t.name];r.traits=r.traits||[],r.traits.push(i)}),this)),this.definePackage(e,t),this.typeMap[i]=e},Ai.prototype.mapTypes=function(e,t,n){var i=Ei(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(n,i){var o=Si(n,Ei(n)?"":e.prefix);r.mapTypes(o,t,i)}function a(e){return o(e,!0)}function s(e){return o(e,!1)}if(!i)throw new Error("unknown type <"+e.name+">");S(i.superClass,n?a:s),t(i,!n),S(i.traits,a)},Ai.prototype.getEffectiveDescriptor=function(e){var t=Si(e),n=new Ci(t);this.mapTypes(t,(function(e,t){n.addTrait(e,t)}));var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Ai.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},Ti.prototype.set=function(e,t,n){if(!g(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;Ri(n)?i?delete e[r]:delete e.$attrs[Pi(t)]:i?r in e?e[r]=n:Di(e,i,n):e.$attrs[Pi(t)]=n},Ti.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Pi(t)];var i=n.name;return!e[i]&&n.isMany&&Di(e,n,[]),e[i]},Ti.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=V({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Ti.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Ti.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Ti.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if("undefined"!==typeof r){const n=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw n;"undefined"!==typeof console&&console.warn(n)}return null},Mi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Mi.prototype.getType=function(e){var t=this.typeCache,n=g(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Mi.prototype.createAny=function(e,t,n){var i=Si(e),r={$type:e,$instanceOf:function(e){return e===this.$type},get:function(e){return this[e]},set:function(e,t){W(this,[e],t)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),S(n,(function(e,t){m(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e})),r},Mi.prototype.getPackage=function(e){return this.registry.getPackage(e)},Mi.prototype.getPackages=function(){return this.registry.getPackages()},Mi.prototype.getElementDescriptor=function(e){return e.$descriptor},Mi.prototype.hasType=function(e,t){void 0===t&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Mi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Mi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Bi=String.fromCharCode,Ni=Object.prototype.hasOwnProperty,Oi=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,ji={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function Li(e,t,n,i){return i?Ni.call(ji,i)?ji[i]:"&"+i+";":Bi(t||parseInt(n,16))}function Ii(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(Oi,Li):e}Object.keys(ji).forEach((function(e){ji[e.toUpperCase()]=ji[e]}));var Fi="http://www.w3.org/2001/XMLSchema-instance",$i="xsi",zi="xsi:type",Hi="non-whitespace outside of root node";function Gi(e){return new Error(e)}function Vi(e){return"missing namespace for prefix <"+e+">"}function Wi(e){return{get:e,enumerable:!0}}function Ui(e){var t,n={};for(t in e)n[t]=e[t];return n}function qi(e){return e+"$uri"}function Ki(e){var t,n,i={};for(t in e)n=e[t],i[n]=n,i[qi(n)]=t;return i}function Yi(){return{line:0,column:0}}function Xi(e){throw e}function Zi(e){if(!this)return new Zi(e);var t,n,i,r,o,a,s,c,p,l=e&&e["proxy"],u=Xi,h=Yi,d=!1,f=!1,m=null,v=!1;function y(e){e instanceof Error||(e=Gi(e)),m=e,u(e,h)}function g(e){o&&(e instanceof Error||(e=Gi(e)),o(e,h))}function b(e){var o,u,m,b,x,_,E,w,S,C,A,k=f?[]:null,T=f?Ki(p):null,R=[],D=0,P=!1,M=!1,B=0,N=0,O="",j=0;function L(){if(null!==A)return A;var e,t,n,i,r,o,a,s,c,l,u,h=f&&T["xmlns"],m=f&&d?[]:null,v=j,y=O,b=y.length,x={},_={};e:for(;v<b;v++)if(c=!1,l=y.charCodeAt(v),!(32===l||l<14&&l>8)){for((l<65||l>122||l>90&&l<97)&&95!==l&&58!==l&&(g("illegal first char attribute name"),c=!0),u=v+1;u<b;u++)if(l=y.charCodeAt(u),!(l>96&&l<123||l>64&&l<91||l>47&&l<59||46===l||45===l||95===l)){if(32===l||l<14&&l>8){g("missing attribute value"),v=u;continue e}if(61===l)break;g("illegal attribute name char"),c=!0}if(s=y.substring(v,u),"xmlns:xmlns"===s&&(g("illegal declaration of xmlns"),c=!0),l=y.charCodeAt(u+1),34===l)u=y.indexOf('"',v=u+2),-1===u&&(u=y.indexOf("'",v),-1!==u&&(g("attribute value quote missmatch"),c=!0));else if(39===l)u=y.indexOf("'",v=u+2),-1===u&&(u=y.indexOf('"',v),-1!==u&&(g("attribute value quote missmatch"),c=!0));else for(g("missing attribute value quotes"),c=!0,u+=1;u<b;u++)if(l=y.charCodeAt(u+1),32===l||l<14&&l>8)break;for(-1===u&&(g("missing closing quotes"),u=b,c=!0),c||(o=y.substring(v,u)),v=u;u+1<b;u++){if(l=y.charCodeAt(u+1),32===l||l<14&&l>8)break;v===u&&(g("illegal character after attribute end"),c=!0)}if(v=u+1,!c)if(s in _)g("attribute <"+s+"> already defined");else if(_[s]=!0,f)if(d){if(r="xmlns"===s?"xmlns":120===s.charCodeAt(0)&&"xmlns:"===s.substr(0,6)?s.substr(6):null,null!==r){if(e=Ii(o),t=qi(r),a=p[e],!a){if("xmlns"===r||t in T&&T[t]!==e)do{a="ns"+D++}while("undefined"!==typeof T[a]);else a=r;p[e]=a}T[r]!==a&&(i||(T=Ui(T),i=!0),T[r]=a,"xmlns"===r&&(T[qi(a)]=e,h=a),T[t]=e),x[s]=o;continue}m.push(s,o)}else l=s.indexOf(":"),-1!==l?(n=T[s.substring(0,l)])?(s=h===n?s.substr(l+1):n+s.substr(l),s===zi&&(l=o.indexOf(":"),-1!==l?(n=o.substring(0,l),n=T[n]||n,o=n+o.substring(l)):o=h+":"+o),x[s]=o):g(Vi(s.substring(0,l))):x[s]=o;else x[s]=o}if(d)for(v=0,b=m.length;v<b;v++){if(s=m[v++],o=m[v],l=s.indexOf(":"),-1!==l){if(!(n=T[s.substring(0,l)])){g(Vi(s.substring(0,l)));continue}s=h===n?s.substr(l+1):n+s.substr(l),s===zi&&(l=o.indexOf(":"),-1!==l?(n=o.substring(0,l),n=T[n]||n,o=n+o.substring(l)):o=h+":"+o)}x[s]=o}return A=x}function I(){var t,n,i=/(\r\n|\r|\n)/g,r=0,o=0,a=0,s=N;while(B>=a){if(t=i.exec(e),!t)break;if(s=t[0].length+t.index,s>B)break;r+=1,a=s}return-1==B?(o=s,n=e.substring(N)):0===N?n=e.substring(N,B):(o=B-a,n=-1==N?e.substring(B):e.substring(B,N+1)),{data:n,line:r,column:o}}h=I,l&&(C=Object.create({},{name:Wi((function(){return w})),originalName:Wi((function(){return S})),attrs:Wi(L),ns:Wi((function(){return T}))}));while(-1!==N){if(B=60===e.charCodeAt(N)?N:e.indexOf("<",N),-1===B)return R.length?y("unexpected end of file"):0===N?y("missing start tag"):void(N<e.length&&e.substring(N).trim()&&g(Hi));if(N!==B)if(R.length){if(t&&(t(e.substring(N,B),Ii,h),v))return}else if(e.substring(N,B).trim()&&(g(Hi),v))return;if(x=e.charCodeAt(B+1),33===x){if(b=e.charCodeAt(B+2),91===b&&"CDATA["===e.substr(B+3,6)){if(N=e.indexOf("]]>",B),-1===N)return y("unclosed cdata");if(r&&(r(e.substring(B+9,N),h),v))return;N+=3;continue}if(45===b&&45===e.charCodeAt(B+3)){if(N=e.indexOf("--\x3e",B),-1===N)return y("unclosed comment");if(a&&(a(e.substring(B+4,N),Ii,h),v))return;N+=3;continue}}if(63!==x){for(u=B+1;;u++){if(_=e.charCodeAt(u),isNaN(_))return N=-1,y("unclosed tag");if(34===_)b=e.indexOf('"',u+1),u=-1!==b?b:u;else if(39===_)b=e.indexOf("'",u+1),u=-1!==b?b:u;else if(62===_){N=u;break}}if(33!==x){if(A={},47===x){if(P=!1,M=!0,!R.length)return y("missing open tag");if(u=w=R.pop(),b=B+2+u.length,e.substring(B+2,b)!==u)return y("closing tag mismatch");for(;b<N;b++)if(x=e.charCodeAt(b),!(32===x||x>8&&x<14))return y("close tag")}else{if(47===e.charCodeAt(N-1)?(u=w=e.substring(B+1,N-1),P=!0,M=!0):(u=w=e.substring(B+1,N),P=!0,M=!1),!(x>96&&x<123||x>64&&x<91||95===x||58===x))return y("illegal first char nodeName");for(b=1,m=u.length;b<m;b++)if(x=u.charCodeAt(b),!(x>96&&x<123||x>64&&x<91||x>47&&x<59||45===x||95===x||46==x)){if(32===x||x<14&&x>8){w=u.substring(0,b),A=null;break}return y("invalid nodeName")}M||R.push(w)}if(f){if(o=T,P&&(M||k.push(o),null===A&&(d=-1!==u.indexOf("xmlns",b))&&(j=b,O=u,L(),d=!1)),S=w,x=w.indexOf(":"),-1!==x){if(E=T[w.substring(0,x)],!E)return y("missing namespace on <"+S+">");w=w.substr(x+1)}else E=T["xmlns"];E&&(w=E+":"+w)}if(P&&(j=b,O=u,n&&(l?n(C,Ii,M,h):n(w,L,Ii,M,h),v)))return;if(M){if(i&&(i(l?C:w,Ii,P,h),v))return;f&&(T=P?o:k.pop())}N+=1}else{if(c&&(c(e.substring(B,N+1),Ii,h),v))return;N+=1}}else{if(N=e.indexOf("?>",B),-1===N)return y("unclosed question");if(s&&(s(e.substring(B,N+2),h),v))return;N+=2}}}this["on"]=function(e,p){if("function"!==typeof p)throw Gi("required args <name, cb>");switch(e){case"openTag":n=p;break;case"text":t=p;break;case"closeTag":i=p;break;case"error":u=p;break;case"warn":o=p;break;case"cdata":r=p;break;case"attention":c=p;break;case"question":s=p;break;case"comment":a=p;break;default:throw Gi("unsupported event: "+e)}return this},this["ns"]=function(e){if("undefined"===typeof e&&(e={}),"object"!==typeof e)throw Gi("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n[Fi]=$i,f=!0,p=n,this},this["parse"]=function(e){if("string"!==typeof e)throw Gi("required args <xml=string>");return m=null,b(e),h=Yi,v=!1,m},this["stop"]=function(){v=!0}}function Ji(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var Qi={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},er="xsi:type";function tr(e){return e.xml&&e.xml.serialize}function nr(e){return tr(e)===er}function ir(e){return"property"===tr(e)}function rr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function or(e,t){return Ji(t)?e.prefix+":"+rr(e.localName):e.name}function ar(e,t){var n=e.name,i=e.localName,r=t.xml&&t.xml.typePrefix;return r&&0===i.indexOf(r)?e.prefix+":"+i.slice(r.length):n}function sr(e,t){var n=Si(e),i=t.getPackage(n.prefix);return ar(n,i)}function cr(e){return new Error(e)}function pr(e){return e.$descriptor}function lr(e){V(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw cr("expected element");var t,n=this.elementsById,i=pr(e),r=i.idProperty;if(r&&(t=e.get(r.name),t)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(t))throw new Error("illegal ID <"+t+">");if(n[t])throw cr("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function ur(){}function hr(){}function dr(){}function fr(e,t){this.property=e,this.context=t}function mr(e,t){this.element=t,this.propertyDesc=e}function vr(){}function yr(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function gr(e,t,n){yr.call(this,e,t,n)}function br(e,t,n){this.model=e,this.context=n}function xr(e){e instanceof Mi&&(e={model:e}),V(this,{lax:!1},e)}function _r(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}ur.prototype.handleEnd=function(){},ur.prototype.handleText=function(){},ur.prototype.handleNode=function(){},hr.prototype=Object.create(ur.prototype),hr.prototype.handleNode=function(){return this},dr.prototype=Object.create(ur.prototype),dr.prototype.handleText=function(e){this.body=(this.body||"")+e},fr.prototype=Object.create(dr.prototype),fr.prototype.handleNode=function(e){if(this.element)throw cr("expected no sub nodes");return this.element=this.createReference(e),this},fr.prototype.handleEnd=function(){this.element.id=this.body},fr.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},mr.prototype=Object.create(dr.prototype),mr.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=_i(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},vr.prototype=Object.create(dr.prototype),vr.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},yr.prototype=Object.create(vr.prototype),yr.prototype.addReference=function(e){this.context.addReference(e)},yr.prototype.handleText=function(e){var t=this.element,n=pr(t),i=n.bodyProperty;if(!i)throw cr("unexpected body text <"+e+">");dr.prototype.handleText.call(this,e)},yr.prototype.handleEnd=function(){var e=this.body,t=this.element,n=pr(t),i=n.bodyProperty;i&&void 0!==e&&(e=_i(i.type,e),t.set(i.name,e))},yr.prototype.createElement=function(e){var t,n=e.attributes,i=this.type,r=pr(i),o=this.context,a=new i({}),s=this.model;return S(n,(function(e,n){var i,c=r.propertiesByName[n];c&&c.isReference?c.isMany?(i=e.split(" "),S(i,(function(e){o.addReference({element:a,property:c.ns.name,id:e})}))):o.addReference({element:a,property:c.ns.name,id:e}):(c?e=_i(c.type,e):"xmlns"!==n&&(t=Si(n,r.ns.prefix),s.getPackage(t.prefix)&&o.addWarning({message:"unknown attribute <"+n+">",element:a,property:n,value:e})),a.set(n,e))})),a},yr.prototype.getPropertyForNode=function(e){var t,n,i=e.name,r=Si(i),o=this.type,a=this.model,s=pr(o),c=r.name,p=s.propertiesByName[c];if(p&&!p.isAttr)return nr(p)&&(t=e.attributes[er],t)?(t=sr(t,a),n=a.getType(t),V({},p,{effectiveType:pr(n).name})):p;var l=a.getPackage(r.prefix);if(l){if(t=or(r,l),n=a.getType(t),p=_(s.properties,(function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)})),p)return V({},p,{effectiveType:pr(n).name})}else if(p=_(s.properties,(function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type})),p)return p;throw cr("unrecognized element <"+r.name+">")},yr.prototype.toString=function(){return"ElementDescriptor["+pr(this.type).name+"]"},yr.prototype.valueHandler=function(e,t){return new mr(e,t)},yr.prototype.referenceHandler=function(e){return new fr(e,this.context)},yr.prototype.handler=function(e){return"Element"===e?new br(this.model,e,this.context):new yr(this.model,e,this.context)},yr.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,wi(n))return this.valueHandler(t,i);r=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e);var o=r.element;return void 0!==o&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(V(o,{element:i}),this.context.addReference(o)):o.$parent=i),r},gr.prototype=Object.create(yr.prototype),gr.prototype.createElement=function(e){var t=e.name,n=Si(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&or(n,o)||t;if(!r.hasType(a))throw cr("unexpected element <"+e.originalName+">");return yr.prototype.createElement.call(this,e)},br.prototype=Object.create(vr.prototype),br.prototype.createElement=function(e){var t=e.name,n=Si(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},br.prototype.handleChild=function(e){var t,n=new br(this.model,"Element",this.context).handleNode(e),i=this.element,r=n.element;return void 0!==r&&(t=i.$children=i.$children||[],t.push(r),r.$parent=i),n},br.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},xr.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof yr?(i=t,t={}):"string"===typeof t?(i=this.handler(t),t={}):"string"===typeof i&&(i=this.handler(i));var r=this.model,o=this.lax,a=new lr(V({},t,{rootHandler:i})),s=new Zi({proxy:!0}),c=_r();function p(e,t,n){var i=t(),r=i.line,o=i.column,s=i.data;"<"===s.charAt(0)&&-1!==s.indexOf(" ")&&(s=s.slice(0,s.indexOf(" "))+">");var c="unparsable content "+(s?s+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return a.addWarning({message:c,error:e}),!0;throw cr(c)}function l(e,t){return p(e,t,!0)}function u(){var e,t,n=a.elementsById,i=a.references;for(e=0;t=i[e];e++){var r=t.element,o=n[t.id],s=pr(r).propertiesByName[t.property];if(o||a.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),s.isMany){var c=r.get(s.name),p=c.indexOf(t);-1===p&&(p=c.length),o?c[p]=o:c.splice(p,1)}else r.set(s.name,o)}}function h(){c.pop().handleEnd()}i.context=a,c.push(i);var d=/^<\?xml /i,f=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function v(e){if(d.test(e)){var t=f.exec(e),n=t&&t[1];n&&!m.test(n)&&a.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}}function y(e,t){var n=c.peek();try{c.push(n.handleNode(e))}catch(i){p(i,t,o)&&c.push(new hr)}}function g(e,t){try{c.peek().handleText(e)}catch(n){l(n,t)}}function b(e,t){e.trim()&&g(e,t)}var x=r.getPackages().reduce((function(e,t){return e[t.uri]=t.prefix,e}),{"http://www.w3.org/XML/1998/namespace":"xml"});return s.ns(x).on("openTag",(function(e,t,n,i){var r=e.attrs||{},o=Object.keys(r).reduce((function(e,n){var i=t(r[n]);return e[n]=i,e}),{}),a={name:e.name,originalName:e.originalName,attributes:o,ns:e.ns};y(a,i)})).on("question",v).on("closeTag",h).on("cdata",g).on("text",(function(e,t,n){b(t(e),n)})).on("error",p).on("warn",l),new Promise((function(t,n){var r;try{s.parse(e),u()}catch(h){r=h}var o=i.element;r||o||(r=cr("failed to parse document as <"+i.type.$descriptor.name+">"));var c=a.warnings,p=a.references,l=a.elementsById;return r?(r.warnings=c,n(r)):t({rootElement:o,elementsById:l,references:p,warnings:c})}))},xr.prototype.handler=function(e){return new gr(this.model,e)};var Er='<?xml version="1.0" encoding="UTF-8"?>\n',wr=/<|>|'|"|&|\n\r|\n/g,Sr=/<|>|&/g;function Cr(e){var t={},n={},i={},r=[],o=[];this.byUri=function(t){return n[t]||e&&e.byUri(t)},this.add=function(e,t){n[e.uri]=e,t?r.push(e):o.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return t[e||"xmlns"]},this.mapPrefix=function(e,n){t[e||"xmlns"]=n},this.getNSKey=function(e){return void 0!==e.prefix?e.uri+"|"+e.prefix:e.uri},this.logUsed=function(t){var n=t.uri,r=this.getNSKey(t);i[r]=this.byUri(n),e&&e.logUsed(t)},this.getUsed=function(e){function t(e){var t=n.getNSKey(e);return i[t]}var n=this,a=[].concat(r,o);return a.filter(t)}}function Ar(e){return e.charAt(0).toLowerCase()+e.slice(1)}function kr(e,t){return Ji(t)?Ar(e):e}function Tr(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Rr(e){return g(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function Dr(e){return e.getUsed().filter((function(e){return"xml"!==e.prefix})).map((function(e){var t="xmlns"+(e.prefix?":"+e.prefix:"");return{name:t,value:e.uri}}))}function Pr(e,t){return t.isGeneric?V({localName:t.ns.localName},e):V({localName:kr(t.ns.localName,t.$pkg)},e)}function Mr(e,t){return V({localName:t.ns.localName},e)}function Br(e){var t=e.$descriptor;return w(t.properties,(function(t){var n=t.name;if(t.isVirtual)return!1;if(!x(e,n))return!1;var i=e[n];return i!==t.default&&(null!==i&&(!t.isMany||i.length))}))}var Nr={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},Or={"<":"lt",">":"gt","&":"amp"};function jr(e,t,n){return e=g(e)?e:""+e,e.replace(t,(function(e){return"&"+n[e]+";"}))}function Lr(e){return jr(e,wr,Nr)}function Ir(e){return jr(e,Sr,Or)}function Fr(e){return w(e,(function(e){return e.isAttr}))}function $r(e){return w(e,(function(e){return!e.isAttr}))}function zr(e){this.tagName=e}function Hr(){}function Gr(e){this.tagName=e}function Vr(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function Wr(e,t){Vr.call(this,e,t)}function Ur(){this.value="",this.write=function(e){this.value+=e}}function qr(e,t){var n=[""];this.append=function(t){return e.write(t),this},this.appendNewLine=function(){return t&&e.write("\n"),this},this.appendIndent=function(){return t&&e.write(n.join("  ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function Kr(e){function t(t,n){var i=n||new Ur,r=new qr(i,e.format);if(e.preamble&&r.append(Er),(new Vr).build(t).serializeTo(r),!n)return i.value}return e=V({format:!1,preamble:!0},e||{}),{toXML:t}}function Yr(e,t){Mi.call(this,e,t)}zr.prototype.build=function(e){return this.element=e,this},zr.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},Hr.prototype.serializeValue=Hr.prototype.serializeTo=function(e){e.append(this.escape?Ir(this.value):this.value)},Hr.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(Sr)&&(this.escape=!0),this},Tr(Gr,Hr),Gr.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},Vr.prototype.build=function(e){this.element=e;var t,n,i=e.$descriptor,r=this.propertyDescriptor,o=i.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=r?this.nsPropertyTagName(r):this.nsTagName(i),this.tagName=this.addTagName(this.ns),o||(n=Br(e),this.parseAttributes(Fr(n)),this.parseContainments($r(n))),this.parseGenericAttributes(e,t),this},Vr.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Pr(t,e)},Vr.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Mr(t,e)},Vr.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Vr.prototype.nsAttributeName=function(e){var t;if(t=g(e)?Si(e):e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:V({localName:t.localName},n)},Vr.prototype.parseGeneric=function(e){var t=this,n=this.body,i=[];return S(e,(function(r,o){var a;"$body"===o?n.push((new Hr).build({type:"String"},r)):"$children"===o?S(r,(function(e){n.push(new Vr(t).build(e))})):0!==o.indexOf("$")&&(a=t.parseNsAttribute(e,o,r),a&&i.push({name:o,value:r}))})),i},Vr.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,o=Si(t);if("xmlns"===o.prefix&&(i={prefix:o.localName,uri:n}),o.prefix||"xmlns"!==o.localName||(i={uri:n}),!i)return{name:t,value:n};if(r&&r.getPackage(n))this.logNamespace(i,!0,!0);else{var a=this.logNamespaceUsed(i,!0);this.getNamespaces().logUsed(a)}},Vr.prototype.parseNsAttributes=function(e,t){var n=this,i=e.$attrs,r=[];return S(i,(function(t,i){var o=n.parseNsAttribute(e,i,t);o&&r.push(o)})),r},Vr.prototype.parseGenericAttributes=function(e,t){var n=this;S(t,(function(t){if(t.name!==er)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(i){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,i)}}))},Vr.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;S(e,(function(e){var r=i.get(e.name),o=e.isReference,a=e.isMany;if(a||(r=[r]),e.isBody)n.push((new Hr).build(e,r[0]));else if(wi(e.type))S(r,(function(i){n.push(new Gr(t.addTagName(t.nsPropertyTagName(e))).build(e,i))}));else if(o)S(r,(function(i){n.push(new zr(t.addTagName(t.nsPropertyTagName(e))).build(i))}));else{var s=nr(e),c=ir(e);S(r,(function(i){var r;r=s?new Wr(t,e):c?new Vr(t,e):new Vr(t),n.push(r.build(i))}))}}))},Vr.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new Cr(t):n=t),n},Vr.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix,a=i.byUri(r);return a&&!n||i.add(e,t),i.mapPrefix(o,r),e},Vr.prototype.logNamespaceUsed=function(e,t){var n,i,r,o=this.element,a=o.$model,s=this.getNamespaces(t),c=e.prefix,p=e.uri;if(!c&&!p)return{localName:e.localName};if(r=Qi[c]||a&&(a.getPackage(c)||{}).uri,p=p||r||s.uriByPrefix(c),!p)throw new Error("no namespace uri given for prefix <"+c+">");if(e=s.byUri(p),!e){n=c,i=1;while(s.uriByPrefix(n))n=c+"_"+i++;e=this.logNamespace({prefix:n,uri:p},r===p)}return c&&s.mapPrefix(c,p),e},Vr.prototype.parseAttributes=function(e){var t=this,n=this.element;S(e,(function(e){var i=n.get(e.name);if(e.isReference)if(e.isMany){var r=[];S(i,(function(e){r.push(e.id)})),i=r.join(" ")}else i=i.id;t.addAttribute(t.nsAttributeName(e),i)}))},Vr.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Rr(e)},Vr.prototype.addAttribute=function(e,t){var n=this.attrs;g(t)&&(t=Lr(t));var i=E(n,(function(t){return t.name.localName===e.localName&&t.name.uri===e.uri&&t.name.prefix===e.prefix})),r={name:e,value:t};-1!==i?n.splice(i,1,r):n.push(r)},Vr.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=Dr(n).concat(t)),S(t,(function(t){e.append(" ").append(Rr(t.name)).append('="').append(t.value).append('"')}))},Vr.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Hr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),S(this.body,(function(t){t.serializeTo(e)})),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},Tr(Wr,Vr),Wr.prototype.parseNsAttributes=function(e){var t=Vr.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(er),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},Wr.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},Yr.prototype=Object.create(Mi.prototype),Yr.prototype.fromXML=function(e,t,n){g(t)||(n=t,t="bpmn:Definitions");var i=new xr(V({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Yr.prototype.toXML=function(e,t){var n=new Kr(t);return new Promise((function(t,i){try{var r=n.toXML(e);return t({xml:r})}catch(o){return i(o)}}))};var Xr="BPMN20",Zr="http://www.omg.org/spec/BPMN/20100524/MODEL",Jr="bpmn",Qr=[],eo=[{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",isAttr:!0,isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"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"}]}],to=[{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"}]}],no={tagAlias:"lowerCase",typePrefix:"t"},io={name:Xr,uri:Zr,prefix:Jr,associations:Qr,types:eo,enumerations:to,xml:no},ro="BPMNDI",oo="http://www.omg.org/spec/BPMN/20100524/DI",ao="bpmndi",so=[{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"]}],co=[{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"}]}],po=[],lo={name:ro,uri:oo,prefix:ao,types:so,enumerations:co,associations:po},uo="DC",ho="http://www.omg.org/spec/DD/20100524/DC",fo="dc",mo=[{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}]}],vo=[],yo={name:uo,uri:ho,prefix:fo,types:mo,associations:vo},go="DI",bo="http://www.omg.org/spec/DD/20100524/DI",xo="di",_o=[{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"}]}],Eo=[],wo={tagAlias:"lowerCase"},So={name:go,uri:bo,prefix:xo,types:_o,associations:Eo,xml:wo},Co="bpmn.io colors for BPMN",Ao="http://bpmn.io/schema/bpmn/biocolor/1.0",ko="bioc",To=[{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"}]}],Ro=[],Do=[],Po={name:Co,uri:Ao,prefix:ko,types:To,enumerations:Ro,associations:Do},Mo="BPMN in Color",Bo="http://www.omg.org/spec/BPMN/non-normative/color/1.0",No="color",Oo=[{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"}]}],jo=[],Lo=[],Io={name:Mo,uri:Bo,prefix:No,types:Oo,enumerations:jo,associations:Lo},Fo={bpmn:io,bpmndi:lo,dc:yo,di:So,bioc:Po,color:Io};function $o(e,t){var n=V({},Fo,e);return new Yr(n,t)}function zo(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Ho(e){return function(){if(!window.Promise)throw new Error("Promises is not supported in this environment. Please polyfill Promise.");var t=arguments.length;if(!(t>=1&&y(arguments[t-1])))return e.apply(this,arguments);var n=arguments[t-1];console.warn(new Error("Passing callbacks to "+e.name+" is deprecated and will be removed in a future major release. Please switch to promises: https://bpmn.io/l/moving-to-promises.html"));var i=Array.prototype.slice.call(arguments,0,-1);e.apply(this,i).then((function(e){var t=Object.keys(e)[0];return n(null,e[t])}),(function(e){return n(e,e.warnings)}))}}var Go="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 Vo(e){x(e,"di")||Object.defineProperty(e,"di",{enumerable:!1,get:function(){throw new Error(Go)}})}function Wo(e,t){return e.$instanceOf(t)}function Uo(e){return _(e.rootElements,(function(e){return Wo(e,"bpmn:Process")||Wo(e,"bpmn:Collaboration")}))}function qo(e,t){var n={},i=[],r={};function o(e,t){return function(n){e(n,t)}}function a(e){n[e.id]=e}function s(e){return n[e.id]}function c(n,i){var o=n.gfx;if(o)throw new Error(t("already rendered {element}",{element:zo(n)}));return e.element(n,r[n.id],i)}function p(t,n){return e.root(t,r[t.id],n)}function l(e,n){try{var i=r[e.id]&&c(e,n);return a(e),i}catch(o){u(o.message,{element:e,error:o}),console.error(t("failed to import {element}",{element:zo(e)})),console.error(o)}}function u(t,n){e.error(t,n)}function h(e){var n=e.bpmnElement;n?r[n.id]?u(t("multiple DI elements defined for {element}",{element:zo(n)}),{element:n}):(r[n.id]=e,Vo(n)):u(t("no bpmnElement referenced in {element}",{element:zo(e)}),{element:e})}function d(e){f(e.plane)}function f(e){h(e),S(e.planeElement,m)}function m(e){h(e)}function v(e,n){var o=e.diagrams;if(n&&-1===o.indexOf(n))throw new Error(t("diagram not part of bpmn:Definitions"));if(!n&&o&&o.length&&(n=o[0]),!n)throw new Error(t("no diagram to display"));r={},d(n);var a=n.plane;if(!a)throw new Error(t("no plane for {element}",{element:zo(n)}));var s=a.bpmnElement;if(!s){if(s=Uo(e),!s)throw new Error(t("no process or collaboration to display"));u(t("correcting missing bpmnElement on {plane} to {rootElement}",{plane:zo(a),rootElement:zo(s)})),a.bpmnElement=s,h(a)}var c=p(s,a);if(Wo(s,"bpmn:Process")||Wo(s,"bpmn:SubProcess"))g(s,c);else{if(!Wo(s,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:zo(a),rootElement:zo(s)}));$(s,c),b(e.rootElements,c)}y(i)}function y(){var e;while(i.length)e=i.shift(),e()}function g(e,t){L(e,t),R(e.ioSpecification,t),T(e.artifacts,t),a(e)}function b(e,t){var n=w(e,(function(e){return!s(e)&&Wo(e,"bpmn:Process")&&e.laneSets}));n.forEach(o(g,t))}function x(e,t){l(e,t)}function _(e,t){S(e,o(x,t))}function E(e,t){l(e,t)}function C(e,t){l(e,t)}function A(e,t){l(e,t)}function k(e,t){l(e,t)}function T(e,t){S(e,(function(e){Wo(e,"bpmn:Association")?i.push((function(){k(e,t)})):k(e,t)}))}function R(e,t){e&&(S(e.dataInputs,o(C,t)),S(e.dataOutputs,o(A,t)))}function D(e,t){L(e,t),T(e.artifacts,t)}function P(e,t){var n=l(e,t);Wo(e,"bpmn:SubProcess")&&D(e,n||t),Wo(e,"bpmn:Activity")&&R(e.ioSpecification,t),i.push((function(){S(e.dataInputAssociations,o(E,t)),S(e.dataOutputAssociations,o(E,t))}))}function M(e,t){l(e,t)}function B(e,t){l(e,t)}function N(e,t){i.push((function(){var n=l(e,t);e.childLaneSet&&O(e.childLaneSet,n||t),z(e)}))}function O(e,t){S(e.lanes,o(N,t))}function j(e,t){S(e,o(O,t))}function L(e,t){I(e.flowElements,t),e.laneSets&&j(e.laneSets,t)}function I(e,n){S(e,(function(e){Wo(e,"bpmn:SequenceFlow")?i.push((function(){M(e,n)})):Wo(e,"bpmn:BoundaryEvent")?i.unshift((function(){P(e,n)})):Wo(e,"bpmn:FlowNode")?P(e,n):Wo(e,"bpmn:DataObject")||(Wo(e,"bpmn:DataStoreReference")||Wo(e,"bpmn:DataObjectReference")?B(e,n):u(t("unrecognized flowElement {element} in context {context}",{element:zo(e),context:n?zo(n.businessObject):"null"}),{element:e,context:n}))}))}function F(e,t){var n=l(e,t),i=e.processRef;i&&g(i,n||t)}function $(e,t){S(e.participants,o(F,t)),T(e.artifacts,t),i.push((function(){_(e.messageFlows,t)}))}function z(e){S(e.flowNodeRef,(function(t){var n=t.get("lanes");n&&n.push(e)}))}return{handleDeferred:y,handleDefinitions:v,handleSubProcess:D,registerDi:h}}function Ko(e,t){var n=Xo(e);return n&&"function"===typeof n.$instanceOf&&n.$instanceOf(t)}function Yo(e,t){return T(t,(function(t){return Ko(e,t)}))}function Xo(e){return e&&e.businessObject||e}function Zo(e){return e&&e.di}function Jo(e,t,n){var i,r,o,a,s,c=[];function p(e,t){var n={root:function(e,t){return i.add(e,t)},element:function(e,t,n){return i.add(e,t,n)},error:function(e,t){c.push({message:e,context:t})}},r=new qo(n,o);t=t||e.diagrams&&e.diagrams[0];var s=Qo(e,t);if(!s)throw new Error(o("no diagram to display"));S(s,(function(t){r.handleDefinitions(e,t)}));var p=t.plane.bpmnElement.id;a.setRootElement(a.findRoot(p+"_plane")||a.findRoot(p))}return new Promise((function(l,u){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("translate"),a=e.get("canvas"),r.fire("import.render.start",{definitions:t}),p(t,n),r.fire("import.render.complete",{error:s,warnings:c}),l({warnings:c})}catch(h){return h.warnings=c,u(h)}}))}function Qo(e,t){if(t){var n,i=t.plane.bpmnElement,r=i;Ko(i,"bpmn:Process")||Ko(i,"bpmn:Collaboration")||(r=ta(i)),n=Ko(r,"bpmn:Collaboration")?r:_(e.rootElements,(function(e){if(Ko(e,"bpmn:Collaboration"))return _(e.participants,(function(e){return e.processRef===r}))}));var o=[r];n&&(o=R(n.participants,(function(e){return e.processRef})),o.push(n));var a=ea(o),s=[t],c=[i];return S(e.diagrams,(function(e){var t=e.plane.bpmnElement;-1!==a.indexOf(t)&&-1===c.indexOf(t)&&(s.push(e),c.push(t))})),s}}function ea(e){var t=[];return S(e,(function(e){e&&(t.push(e),t=t.concat(ea(e.flowElements)))})),t}function ta(e){var t=e;while(t){if(Ko(t,"bpmn:Process"))return t;t=t.$parent}}var na,ia='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>',ra=ia,oa={verticalAlign:"middle"},aa={color:"#404040"},sa={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},ca={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},pa={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"},la='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+ra+'</a><span>Web-based tooling for BPMN, DMN and CMMN diagrams powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>';function ua(){na=ke(la),ie(na,sa),ie(Re("svg",na),oa),ie(Re(".backdrop",na),ca),ie(Re(".notice",na),pa),ie(Re(".link",na),aa,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function ha(){na||(ua(),Ee.bind(na,".backdrop","click",(function(e){document.body.removeChild(na)}))),document.body.appendChild(na)}function da(e){e=V({},va,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),ba(this._container),this._init(this._container,this._moddle,e)}function fa(e,t){return e.warnings=t,e}function ma(e){const t=/unparsable content <([^>]+)> detected([\s\S]*)$/,n=t.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}i(da,vi),da.prototype.importXML=Ho((async function(e,t){const n=this;function i(e){const t=n.get("eventBus").createEvent(e);return Object.defineProperty(t,"context",{enumerable:!0,get:function(){return console.warn(new Error("import.parse.complete <context> is deprecated and will be removed in future library versions")),{warnings:e.warnings,references:e.references,elementsById:e.elementsById}}}),t}let r=[];try{let n;e=this._emit("import.parse.start",{xml:e})||e;try{n=await this._moddle.fromXML(e,"bpmn:Definitions")}catch(o){throw this._emit("import.parse.complete",{error:o}),o}let a=n.rootElement;const s=n.references,c=n.warnings,p=n.elementsById;r=r.concat(c),a=this._emit("import.parse.complete",i({error:null,definitions:a,elementsById:p,references:s,warnings:r}))||a;const l=await this.importDefinitions(a,t);return r=r.concat(l.warnings),this._emit("import.done",{error:null,warnings:r}),{warnings:r}}catch(a){let e=a;throw r=r.concat(e.warnings||[]),fa(e,r),e=ma(e),this._emit("import.done",{error:e,warnings:e.warnings}),e}})),da.prototype.importDefinitions=Ho((async function(e,t){this._setDefinitions(e);const n=await this.open(t);return{warnings:n.warnings}})),da.prototype.open=Ho((async function(e){const t=this._definitions;let n=e;if(!t){const e=new Error("no XML imported");throw fa(e,[]),e}if("string"===typeof e&&(n=ga(t,e),!n)){const t=new Error("BPMNDiagram <"+e+"> not found");throw fa(t,[]),t}try{this.clear()}catch(r){throw fa(r,[]),r}const{warnings:i}=await Jo(this,t,n);return{warnings:i}})),da.prototype.saveXML=Ho((async function(e){e=e||{};let t,n,i=this._definitions;try{if(!i)throw new Error("no definitions loaded");i=this._emit("saveXML.start",{definitions:i})||i;const t=await this._moddle.toXML(i,e);n=t.xml,n=this._emit("saveXML.serialized",{xml:n})||n}catch(o){t=o}const r=t?{error:t}:{xml:n};if(this._emit("saveXML.done",r),t)throw t;return r})),da.prototype.saveSVG=Ho((async function(e={}){let t,n;this._emit("saveSVG.start");try{const e=this.get("canvas"),n=e.getActiveLayer(),i=Re("defs",e._svg),r=lt(n),o=i?"<defs>"+lt(i)+"</defs>":"",a=n.getBBox();t='<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- created with bpmn-js / http://bpmn.io --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+a.width+'" height="'+a.height+'" viewBox="'+a.x+" "+a.y+" "+a.width+" "+a.height+'" version="1.1">'+o+r+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}})),da.prototype._setDefinitions=function(e){this._definitions=e},da.prototype.getModules=function(e){return this._modules},da.prototype.clear=function(){this.getDefinitions()&&vi.prototype.clear.call(this)},da.prototype.destroy=function(){vi.prototype.destroy.call(this),Pe(this._container)},da.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},da.prototype.off=function(e,t){this.get("eventBus").off(e,t)},da.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),"string"===typeof e&&(e=Re(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},da.prototype.getDefinitions=function(){return this._definitions},da.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},da.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=V(q(n,["additionalModules"]),{canvas:V({},n.canvas,{container:e}),modules:a});vi.call(this,s),n&&n.container&&this.attachTo(n.container)},da.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},da.prototype._createContainer=function(e){const t=ke('<div class="bjs-container"></div>');return ie(t,{width:ya(e.width),height:ya(e.height),position:e.position}),t},da.prototype._createModdle=function(e){const t=V({},this._moddleExtensions,e.moddleExtensions);return new $o(t)},da.prototype._modules=[];const va={width:"100%",height:"100%",position:"relative"};function ya(e){return e+(v(e)?"px":"")}function ga(e,t){return t&&_(e.diagrams,(function(e){return e.id===t}))||null}function ba(e){const t=ra,n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+t+"</a>",i=ke(n);ie(Re("svg",i),oa),ie(i,aa,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),ye.bind(i,"click",(function(e){ha(),e.preventDefault()}))}function xa(e){da.call(this,e),this.on("import.parse.complete",(function(e){e.error||this._collectIds(e.definitions,e.elementsById)}),this),this.on("diagram.destroy",(function(){this.get("moddle").ids.clear()}),this)}function _a(e,t){return!Ko(e,"bpmn:CallActivity")&&(Ko(e,"bpmn:SubProcess")?(t=t||Zo(e),!(!t||!Ko(t,"bpmndi:BPMNPlane"))||t&&!!t.isExpanded):!Ko(e,"bpmn:Participant")||!!Xo(e).processRef)}function Ea(e){return e&&!1!==Xo(e).isInterrupting}function wa(e){return e&&!!Xo(e).triggeredByEvent}function Sa(e,t){var n=Xo(e),i=!1;return n.eventDefinitions&&S(n.eventDefinitions,(function(e){Ko(e,t)&&(i=!0)})),i}function Ca(e){return Sa(e,"bpmn:ErrorEventDefinition")}function Aa(e){return Sa(e,"bpmn:EscalationEventDefinition")}function ka(e){return Sa(e,"bpmn:CompensateEventDefinition")}function Ta(e){return Ko(e,"bpmn:FlowElement")||Ko(e,"bpmn:Participant")||Ko(e,"bpmn:Lane")||Ko(e,"bpmn:SequenceFlow")||Ko(e,"bpmn:MessageFlow")||Ko(e,"bpmn:DataInput")||Ko(e,"bpmn:DataOutput")?"name":Ko(e,"bpmn:TextAnnotation")?"text":Ko(e,"bpmn:Group")?"categoryValueRef":void 0}function Ra(e){var t=e["categoryValueRef"];return t&&t.value||""}function Da(e){var t=e.businessObject,n=Ta(t);if(n)return"categoryValueRef"===n?Ra(t):t[n]||""}function Pa(e,t,n){var i=e.businessObject,r=Ta(i);return r&&("categoryValueRef"===r?i["categoryValueRef"].value=t:i[r]=t),e}i(xa,da),xa.prototype._createModdle=function(e){var t=da.prototype._createModdle.call(this,e);return t.ids=new s([32,36,1]),t},xa.prototype._collectIds=function(e,t){var n,i=e.$model,r=i.ids;for(n in r.clear(),t)r.claim(n,t[n])};var Ma="hsl(225, 10%, 15%)";function Ba(e,t,n){function i(e,t){return k(t,(function(t,n){return e[n]==t}))}return T(e.eventDefinitions,(function(r){return r.$type===t&&i(e,n)}))}function Na(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type}function Oa(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function ja(e){return e.businessObject}function La(e,t){var n=Zo(e);return n.get("color:background-color")||n.get("bioc:fill")||t||"white"}function Ia(e,t){var n=Zo(e);return n.get("color:border-color")||n.get("bioc:stroke")||t||Ma}function Fa(e,t,n){var i=Zo(e),r=i.get("label");return r&&r.get("color:color")||t||Ia(e,n)}function $a(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Rt(r)}function za(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-2*t,0],["a",t,t,0,0,1,t,t],["l",0,o-2*t],["a",t,t,0,0,1,-t,t],["l",2*t-r,0],["a",t,t,0,0,1,-t,-t],["l",0,2*t-o],["a",t,t,0,0,1,t,-t],["z"]];return Rt(a)}function Ha(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return Rt(s)}function Ga(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return Rt(o)}var Va=new s,Wa=10,Ua=3,qa=.95,Ka=.35,Ya=10;function Xa(e,t,n,i,r,o,a){Tt.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,p=e&&e.defaultLabelColor,l=Va.next(),u={};function h(e){return n.computeStyle(e,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Ma,strokeWidth:2,fill:"white"})}function d(e){return n.computeStyle(e,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Ma,strokeWidth:2})}function f(e,t){var{ref:n={x:0,y:0},scale:i=1,element:o}=t,a=Xe("marker",{id:e,viewBox:"0 0 20 20",refX:n.x,refY:n.y,markerWidth:20*i,markerHeight:20*i,orient:"auto"});Ne(a,o);var s=Re("defs",r._svg);s||(s=Xe("defs"),Ne(r._svg,s)),Ne(s,a),u[e]=a}function v(e){return e.replace(/[^0-9a-zA-z]+/g,"_")}function y(e,t,n){var i=e+"-"+v(t)+"-"+v(n)+"-"+l;return u[i]||g(i,e,t,n),"url(#"+i+")"}function g(e,t,n,i){if("sequenceflow-end"===t){var r=Xe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...h({fill:i,stroke:i,strokeWidth:1})});f(e,{element:r,ref:{x:11,y:10},scale:.5})}if("messageflow-start"===t){var o=Xe("circle",{cx:6,cy:6,r:3.5,...h({fill:n,stroke:i,strokeWidth:1,strokeDasharray:[1e4,1]})});f(e,{element:o,ref:{x:6,y:6}})}if("messageflow-end"===t){var a=Xe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...h({fill:n,stroke:i,strokeWidth:1,strokeDasharray:[1e4,1]})});f(e,{element:a,ref:{x:8.5,y:5}})}if("association-start"===t){var s=Xe("path",{d:"M 11 5 L 1 10 L 11 15",...d({fill:"none",stroke:i,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(e,{element:s,ref:{x:1,y:10},scale:.5})}if("association-end"===t){var c=Xe("path",{d:"M 1 5 L 11 10 L 1 15",...d({fill:"none",stroke:i,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(e,{element:c,ref:{x:11,y:10},scale:.5})}if("conditional-flow-marker"===t){var p=Xe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...h({fill:n,stroke:i})});f(e,{element:p,ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){var l=Xe("path",{d:"M 6 4 L 10 16",...h({stroke:i})});f(e,{element:l,ref:{x:0,y:10},scale:.5})}}function b(e,t,n,i,r){m(i)&&(r=i,i=0),i=i||0,r=h(r),"none"===r.fill&&delete r.fillOpacity;var o=t/2,a=n/2,s=Xe("circle",{cx:o,cy:a,r:Math.round((t+n)/4-i),...r});return Ne(e,s),s}function x(e,t,n,i,r,o){m(r)&&(o=r,r=0),r=r||0,o=h(o);var a=Xe("rect",{x:r,y:r,width:t-2*r,height:n-2*r,rx:i,ry:i,...o});return Ne(e,a),a}function _(e,t,n,i){var r=t/2,o=n/2,a=[{x:r,y:0},{x:t,y:o},{x:r,y:n},{x:0,y:o}],s=a.map((function(e){return e.x+","+e.y})).join(" ");i=h(i);var c=Xe("polygon",{...i,points:s});return Ne(e,c),c}function E(e,t,n,i){n=d(n);var r=jt(t,n,i);return Ne(e,r),r}function w(e,t,n){return E(e,t,n,5)}function C(e,t,n){n=d(n);var i=Xe("path",{...n,d:t});return Ne(e,i),i}function A(e,t,n,i){return C(t,n,V({"data-marker":e},i))}function k(e){return N[e]}function T(e){return function(t,n){return k(e)(t,n)}}function R(e,t){var n=ja(e),i=Na(n);return n.eventDefinitions&&n.eventDefinitions.length>1?n.parallelMultiple?k("bpmn:ParallelMultipleEventDefinition")(t,e,i):k("bpmn:MultipleEventDefinition")(t,e,i):Ba(n,"bpmn:MessageEventDefinition")?k("bpmn:MessageEventDefinition")(t,e,i):Ba(n,"bpmn:TimerEventDefinition")?k("bpmn:TimerEventDefinition")(t,e,i):Ba(n,"bpmn:ConditionalEventDefinition")?k("bpmn:ConditionalEventDefinition")(t,e):Ba(n,"bpmn:SignalEventDefinition")?k("bpmn:SignalEventDefinition")(t,e,i):Ba(n,"bpmn:EscalationEventDefinition")?k("bpmn:EscalationEventDefinition")(t,e,i):Ba(n,"bpmn:LinkEventDefinition")?k("bpmn:LinkEventDefinition")(t,e,i):Ba(n,"bpmn:ErrorEventDefinition")?k("bpmn:ErrorEventDefinition")(t,e,i):Ba(n,"bpmn:CancelEventDefinition")?k("bpmn:CancelEventDefinition")(t,e,i):Ba(n,"bpmn:CompensateEventDefinition")?k("bpmn:CompensateEventDefinition")(t,e,i):Ba(n,"bpmn:TerminateEventDefinition")?k("bpmn:TerminateEventDefinition")(t,e,i):null}function D(e,t,n){n=V({size:{width:100}},n);var i=o.createText(t||"",n);return He(i).add("djs-label"),Ne(e,i),i}function P(e,t,n){var i=ja(t);return D(e,i.name,{box:t,align:n,padding:7,style:{fill:Fa(t,p,c)}})}function M(e,t){var n={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return D(e,Da(t),{box:n,fitBox:!0,style:V({},o.getExternalStyle(),{fill:Fa(t,p,c)})})}function B(e,t,n){var i=D(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:Fa(n,p,c)}}),r=-1*n.height;ci(i,0,-r,270)}var N=this.handlers={"bpmn:Event":function(e,t,n){return"fillOpacity"in n||(n.fillOpacity=qa),b(e,t.width,t.height,n)},"bpmn:StartEvent":function(e,t){var n={fill:La(t,s),stroke:Ia(t,c)},i=ja(t);i.isInterrupting||(n={strokeDasharray:"6",fill:La(t,s),stroke:Ia(t,c)});var r=k("bpmn:Event")(e,t,n);return R(t,e),r},"bpmn:MessageEventDefinition":function(e,t,n){var r=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),o=n?Ia(t,c):La(t,s),a=n?La(t,s):Ia(t,c),p=C(e,r,{strokeWidth:1,fill:o,stroke:a});return p},"bpmn:TimerEventDefinition":function(e,t){var n=b(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:La(t,s),stroke:Ia(t,c)}),r=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}});C(e,r,{strokeWidth:2,stroke:Ia(t,c)});for(var o=0;o<12;o++){var a=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),p=t.width/2,l=t.height/2;C(e,a,{strokeWidth:1,transform:"rotate("+30*o+","+l+","+p+")",stroke:Ia(t,c)})}return n},"bpmn:EscalationEventDefinition":function(e,t,n){var r=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),o=n?Ia(t,c):"none";return C(e,r,{strokeWidth:1,fill:o,stroke:Ia(t,c)})},"bpmn:ConditionalEventDefinition":function(e,t){var n=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}});return C(e,n,{strokeWidth:1,stroke:Ia(t,c)})},"bpmn:LinkEventDefinition":function(e,t,n){var r=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),o=n?Ia(t,c):"none";return C(e,r,{strokeWidth:1,fill:o,stroke:Ia(t,c)})},"bpmn:ErrorEventDefinition":function(e,t,n){var r=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),o=n?Ia(t,c):"none";return C(e,r,{strokeWidth:1,fill:o,stroke:Ia(t,c)})},"bpmn:CancelEventDefinition":function(e,t,n){var r=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),o=n?Ia(t,c):"none",a=C(e,r,{strokeWidth:1,fill:o,stroke:Ia(t,c)});return li(a,45),a},"bpmn:CompensateEventDefinition":function(e,t,n){var r=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),o=n?Ia(t,c):"none";return C(e,r,{strokeWidth:1,fill:o,stroke:Ia(t,c)})},"bpmn:SignalEventDefinition":function(e,t,n){var r=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),o=n?Ia(t,c):"none";return C(e,r,{strokeWidth:1,fill:o,stroke:Ia(t,c)})},"bpmn:MultipleEventDefinition":function(e,t,n){var r=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),o=n?Ia(t,c):"none";return C(e,r,{strokeWidth:1,fill:o})},"bpmn:ParallelMultipleEventDefinition":function(e,t){var n=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}});return C(e,n,{strokeWidth:1,fill:Ia(t,c),stroke:Ia(t,c)})},"bpmn:EndEvent":function(e,t){var n=k("bpmn:Event")(e,t,{strokeWidth:4,fill:La(t,s),stroke:Ia(t,c)});return R(t,e,!0),n},"bpmn:TerminateEventDefinition":function(e,t){var n=b(e,t.width,t.height,8,{strokeWidth:4,fill:Ia(t,c),stroke:Ia(t,c)});return n},"bpmn:IntermediateEvent":function(e,t){var n=k("bpmn:Event")(e,t,{strokeWidth:1.5,fill:La(t,s),stroke:Ia(t,c)});return b(e,t.width,t.height,Ua,{strokeWidth:1.5,fill:La(t,"none"),stroke:Ia(t,c)}),R(t,e),n},"bpmn:IntermediateCatchEvent":T("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":T("bpmn:IntermediateEvent"),"bpmn:Activity":function(e,t,n){return n=n||{},"fillOpacity"in n||(n.fillOpacity=qa),x(e,t.width,t.height,Wa,n)},"bpmn:Task":function(e,t){var n={fill:La(t,s),stroke:Ia(t,c)},i=k("bpmn:Activity")(e,t,n);return P(e,t,"center-middle"),O(e,t),i},"bpmn:ServiceTask":function(e,t){var n=k("bpmn:Task")(e,t),r=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});C(e,r,{strokeWidth:1,fill:La(t,s),stroke:Ia(t,c)});var o=i.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}});C(e,o,{strokeWidth:0,fill:La(t,s)});var a=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return C(e,a,{strokeWidth:1,fill:La(t,s),stroke:Ia(t,c)}),n},"bpmn:UserTask":function(e,t){var n=k("bpmn:Task")(e,t),r=15,o=12,a=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:r,y:o}});C(e,a,{strokeWidth:.5,fill:La(t,s),stroke:Ia(t,c)});var p=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:r,y:o}});C(e,p,{strokeWidth:.5,fill:La(t,s),stroke:Ia(t,c)});var l=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:r,y:o}});return C(e,l,{strokeWidth:.5,fill:Ia(t,c),stroke:Ia(t,c)}),n},"bpmn:ManualTask":function(e,t){var n=k("bpmn:Task")(e,t),r=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return C(e,r,{strokeWidth:.5,fill:La(t,s),stroke:Ia(t,c)}),n},"bpmn:SendTask":function(e,t){var n=k("bpmn:Task")(e,t),r=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return C(e,r,{strokeWidth:1,fill:Ia(t,c),stroke:La(t,s)}),n},"bpmn:ReceiveTask":function(e,t){var n,r=ja(t),o=k("bpmn:Task")(e,t);return r.instantiate?(b(e,28,28,4.4,{strokeWidth:1}),n=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):n=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),C(e,n,{strokeWidth:1,fill:La(t,s),stroke:Ia(t,c)}),o},"bpmn:ScriptTask":function(e,t){var n=k("bpmn:Task")(e,t),r=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return C(e,r,{strokeWidth:1,stroke:Ia(t,c)}),n},"bpmn:BusinessRuleTask":function(e,t){var n=k("bpmn:Task")(e,t),r=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),o=C(e,r);$e(o,{strokeWidth:1,fill:La(t,"#aaaaaa"),stroke:Ia(t,c)});var a=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),s=C(e,a);return $e(s,{strokeWidth:1,stroke:Ia(t,c)}),n},"bpmn:SubProcess":function(e,t,n){n={fill:La(t,s),stroke:Ia(t,c),...n};var i=k("bpmn:Activity")(e,t,n),r=_a(t);return wa(t)&&$e(i,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),P(e,t,r?"center-top":"center-middle"),r?O(e,t):O(e,t,["SubProcessMarker"]),i},"bpmn:AdHocSubProcess":function(e,t){return k("bpmn:SubProcess")(e,t)},"bpmn:Transaction":function(e,t){var i=k("bpmn:SubProcess")(e,t,{strokeWidth:1.5}),r=n.style(["no-fill","no-events"],{stroke:Ia(t,c),strokeWidth:1.5});return x(e,t.width,t.height,Wa-3,Ua,r),i},"bpmn:CallActivity":function(e,t){return k("bpmn:SubProcess")(e,t,{strokeWidth:5})},"bpmn:Participant":function(e,t){var n=1.5,i={fillOpacity:qa,fill:La(t,s),stroke:Ia(t,c),strokeWidth:n},r=k("bpmn:Lane")(e,t,i),o=_a(t);if(o){E(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:Ia(t,c),strokeWidth:n});var a=ja(t).name;B(e,a,t)}else{var l=ja(t).name;D(e,l,{box:t,align:"center-middle",style:{fill:Fa(t,p,c)}})}var u=!!ja(t).participantMultiplicity;return u&&k("ParticipantMultiplicityMarker")(e,t),r},"bpmn:Lane":function(e,t,n){var i=x(e,t.width,t.height,0,{fill:La(t,s),fillOpacity:Ka,stroke:Ia(t,c),strokeWidth:1.5,...n}),r=ja(t);if("bpmn:Lane"===r.$type){var o=r.name;B(e,o,t)}return i},"bpmn:InclusiveGateway":function(e,t){var n=k("bpmn:Gateway")(e,t);return b(e,t.width,t.height,.24*t.height,{strokeWidth:2.5,fill:La(t,s),stroke:Ia(t,c)}),n},"bpmn:ExclusiveGateway":function(e,t){var n=k("bpmn:Gateway")(e,t),r=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return Zo(t).isMarkerVisible&&C(e,r,{strokeWidth:1,fill:Ia(t,c),stroke:Ia(t,c)}),n},"bpmn:ComplexGateway":function(e,t){var n=k("bpmn:Gateway")(e,t),r=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}});return C(e,r,{strokeWidth:1,fill:Ia(t,c),stroke:Ia(t,c)}),n},"bpmn:ParallelGateway":function(e,t){var n=k("bpmn:Gateway")(e,t),r=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}});return C(e,r,{strokeWidth:1,fill:Ia(t,c),stroke:Ia(t,c)}),n},"bpmn:EventBasedGateway":function(e,t){var n=ja(t),r=k("bpmn:Gateway")(e,t);b(e,t.width,t.height,.2*t.height,{strokeWidth:1,fill:"none",stroke:Ia(t,c)});var o=n.eventGatewayType,a=!!n.instantiate;function s(){var n=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}});C(e,n,{strokeWidth:2,fill:La(t,"none"),stroke:Ia(t,c)})}if("Parallel"===o){var p=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});C(e,p,{strokeWidth:1,fill:"none"})}else"Exclusive"===o&&(a||b(e,t.width,t.height,.26*t.height,{strokeWidth:1,fill:"none",stroke:Ia(t,c)}),s());return r},"bpmn:Gateway":function(e,t){return _(e,t.width,t.height,{fill:La(t,s),fillOpacity:qa,stroke:Ia(t,c)})},"bpmn:SequenceFlow":function(e,t){var n,i=La(t,s),r=Ia(t,c),o=w(e,t.waypoints,{markerEnd:y("sequenceflow-end",i,r),stroke:Ia(t,c)}),a=ja(t);return t.source&&(n=t.source.businessObject,a.conditionExpression&&n.$instanceOf("bpmn:Activity")&&$e(o,{markerStart:y("conditional-flow-marker",i,r)}),n.default&&(n.$instanceOf("bpmn:Gateway")||n.$instanceOf("bpmn:Activity"))&&n.default===a&&$e(o,{markerStart:y("conditional-default-flow-marker",i,r)})),o},"bpmn:Association":function(e,t,n){var i=ja(t),r=La(t,s),o=Ia(t,c);return n={strokeDasharray:"0, 5",stroke:Ia(t,c),...n},"One"!==i.associationDirection&&"Both"!==i.associationDirection||(n.markerEnd=y("association-end",r,o)),"Both"===i.associationDirection&&(n.markerStart=y("association-start",r,o)),w(e,t.waypoints,n)},"bpmn:DataInputAssociation":function(e,t){var n=La(t,s),i=Ia(t,c);return k("bpmn:Association")(e,t,{markerEnd:y("association-end",n,i)})},"bpmn:DataOutputAssociation":function(e,t){var n=La(t,s),i=Ia(t,c);return k("bpmn:Association")(e,t,{markerEnd:y("association-end",n,i)})},"bpmn:MessageFlow":function(e,t){var n=ja(t),r=Zo(t),o=La(t,s),a=Ia(t,c),l=w(e,t.waypoints,{markerEnd:y("messageflow-end",o,a),markerStart:y("messageflow-start",o,a),strokeDasharray:"10, 11",strokeWidth:1.5,stroke:Ia(t,c)});if(n.messageRef){var u=l.getPointAtLength(l.getTotalLength()/2),h=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:u.x,y:u.y}}),d={strokeWidth:1};"initiating"===r.messageVisibleKind?(d.fill="white",d.stroke=Ma):(d.fill="#888",d.stroke="white");var f=C(e,h,d),m=n.messageRef.name,v=D(e,m,{align:"center-top",fitBox:!0,style:{fill:Ia(t,p,c)}}),g=f.getBBox(),b=v.getBBox(),x=u.x-b.width/2,_=u.y+g.height/2+Ya;ci(v,x,_,0)}return l},"bpmn:DataObject":function(e,t){var n=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),r=C(e,n,{fill:La(t,s),fillOpacity:qa,stroke:Ia(t,c)}),o=ja(t);return Oa(o)&&j(e,t),r},"bpmn:DataObjectReference":T("bpmn:DataObject"),"bpmn:DataInput":function(e,t){var n=i.getRawPath("DATA_ARROW"),r=k("bpmn:DataObject")(e,t);return C(e,n,{strokeWidth:1}),r},"bpmn:DataOutput":function(e,t){var n=i.getRawPath("DATA_ARROW"),r=k("bpmn:DataObject")(e,t);return C(e,n,{strokeWidth:1,fill:Ma}),r},"bpmn:DataStoreReference":function(e,t){var n=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),r=C(e,n,{strokeWidth:2,fill:La(t,s),fillOpacity:qa,stroke:Ia(t,c)});return r},"bpmn:BoundaryEvent":function(e,t){var n=ja(t),i=n.cancelActivity,r={strokeWidth:1.5,fill:La(t,s),stroke:Ia(t,c)};i||(r.strokeDasharray="6");var o={...r,fillOpacity:1},a={...r,fill:"none"},p=k("bpmn:Event")(e,t,o);return b(e,t.width,t.height,Ua,a),R(t,e),p},"bpmn:Group":function(e,t){return x(e,t.width,t.height,Wa,{stroke:Ia(t,c),strokeWidth:1.5,strokeDasharray:"10,6,0,6",fill:"none",pointerEvents:"none"})},label:function(e,t){return M(e,t)},"bpmn:TextAnnotation":function(e,t){var n=x(e,t.width,t.height,0,0,{fill:"none",stroke:"none"}),r=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}});C(e,r,{stroke:Ia(t,c)});var o=ja(t).text||"";return D(e,o,{box:t,align:"left-top",padding:7,style:{fill:Fa(t,p,c)}}),n},ParticipantMultiplicityMarker:function(e,t){var n=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:t.width/2/t.width,my:(t.height-15)/t.height}});A("participant-multiplicity",e,n,{strokeWidth:2,fill:La(t,s),stroke:Ia(t,c)})},SubProcessMarker:function(e,t){var n=x(e,14,14,0,{strokeWidth:1,fill:La(t,s),stroke:Ia(t,c)});pi(n,t.width/2-7.5,t.height-20);var r=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2-7.5)/t.width,my:(t.height-20)/t.height}});A("sub-process",e,r,{fill:La(t,s),stroke:Ia(t,c)})},ParallelMarker:function(e,t,n){var r=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.parallel)/t.width,my:(t.height-20)/t.height}});A("parallel",e,r,{fill:La(t,s),stroke:Ia(t,c)})},SequentialMarker:function(e,t,n){var r=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.seq)/t.width,my:(t.height-19)/t.height}});A("sequential",e,r,{fill:La(t,s),stroke:Ia(t,c)})},CompensationMarker:function(e,t,n){var r=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.compensation)/t.width,my:(t.height-13)/t.height}});A("compensation",e,r,{strokeWidth:1,fill:La(t,s),stroke:Ia(t,c)})},LoopMarker:function(e,t,n){var r=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.loop)/t.width,my:(t.height-7)/t.height}});A("loop",e,r,{strokeWidth:1.5,fill:La(t,s),stroke:Ia(t,c),strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){var r=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.adhoc)/t.width,my:(t.height-15)/t.height}});A("adhoc",e,r,{strokeWidth:1,fill:Ia(t,c),stroke:Ia(t,c)})}};function O(e,t,n){var i,r=ja(t),o=n&&-1!==n.indexOf("SubProcessMarker");i=o?{seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},S(n,(function(n){k(n)(e,t,i)})),r.isForCompensation&&k("CompensationMarker")(e,t,i),"bpmn:AdHocSubProcess"===r.$type&&k("AdhocMarker")(e,t,i);var a=r.loopCharacteristics,s=a&&a.isSequential;a&&(void 0===s&&k("LoopMarker")(e,t,i),!1===s&&k("ParallelMarker")(e,t,i),!0===s&&k("SequentialMarker")(e,t,i))}function j(e,t){var n=(t.height-18)/t.height,r=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.33,my:n}});C(e,r,{strokeWidth:2})}this._drawPath=C,this._renderer=k}i(Xa,Tt),Xa.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Xa.prototype.canRender=function(e){return Ko(e,"bpmn:BaseElement")},Xa.prototype.drawShape=function(e,t){var n=t.type,i=this._renderer(n);return i(e,t)},Xa.prototype.drawConnection=function(e,t){var n=t.type,i=this._renderer(n);return i(e,t)},Xa.prototype.getShapePath=function(e){return Ko(e,"bpmn:Event")?$a(e):Ko(e,"bpmn:Activity")?za(e,Wa):Ko(e,"bpmn:Gateway")?Ha(e):Ga(e)};var Za=0,Ja={width:150,height:50};function Qa(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function es(e){return m(e)?V({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}function ts(e,t){var n;t.textContent=e;try{var i,r=""===e;return t.textContent=r?"dummy":e,n=t.getBBox(),i={width:n.width+2*n.x,height:n.height},r&&(i.width=0),i}catch(o){return{width:0,height:0}}}function ns(e,t,n){for(var i,r=e.shift(),o=r;;){if(i=ts(o,n),i.width=o?i.width:0," "===o||""===o||i.width<Math.round(t)||o.length<2)return is(e,o,r,i);o=as(o,i.width,t)}}function is(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var rs="­";function os(e,t){var n,i=e.split(/(\s|-|\u00AD)/g),r=[],o=0;if(i.length>1)while(n=i.shift()){if(!(n.length+o<t)){"-"!==n&&n!==rs||r.pop();break}r.push(n),o+=n.length}var a=r[r.length-1];return a&&a===rs&&(r[r.length-1]="-"),r.join("")}function as(e,t,n){var i=Math.max(e.length*(n/t),1),r=os(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function ss(){var e=document.getElementById("helper-svg");return e||(e=Xe("svg"),$e(e,{id:"helper-svg"}),ie(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}function cs(e){this._config=V({},{size:Ja,padding:Za,style:{},align:"center-top"},e||{})}function ps(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}cs.prototype.createText=function(e,t){return this.layoutText(e,t).element},cs.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},cs.prototype.layoutText=function(e,t){var n=V({},this._config.size,t.box),i=V({},this._config.style,t.style),r=Qa(t.align||this._config.align),o=es(void 0!==t.padding?t.padding:this._config.padding),a=t.fitBox||!1,s=ps(i),c=e.split(/\u00AD?\r?\n/),p=[],l=n.width-o.left-o.right,u=Xe("text");$e(u,{x:0,y:0}),$e(u,i);var h=ss();Ne(h,u);while(c.length)p.push(ns(c,l,u));"middle"===r.vertical&&(o.top=o.bottom=0);var d=A(p,(function(e,t,n){return e+(s||t.height)}),0)+o.top+o.bottom,f=A(p,(function(e,t,n){return t.width>e?t.width:e}),0),m=o.top;"middle"===r.vertical&&(m+=(n.height-d)/2),m-=(s||p[0].height)/4;var v=Xe("text");$e(v,i),S(p,(function(e){var t;switch(m+=s||e.height,r.horizontal){case"left":t=o.left;break;case"right":t=(a?f:l)-o.right-e.width;break;default:t=Math.max(((a?f:l)-e.width)/2+o.left,0)}var n=Xe("tspan");$e(n,{x:t,y:m}),n.textContent=e.text,Ne(v,n)})),ht(u);var y={width:f,height:d};return{dimensions:y,element:v}};var ls=12,us=1.2,hs=30;function ds(e){var t=V({fontFamily:"Arial, sans-serif",fontSize:ls,fontWeight:"normal",lineHeight:us},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=V({},t,{fontSize:n},e&&e.externalStyle||{}),r=new cs({style:t});this.getExternalLabelBounds=function(e,t){var n=r.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:i});return{x:Math.round(e.x+e.width/2-n.width/2),y:Math.round(e.y),width:Math.ceil(n.width),height:Math.ceil(n.height)}},this.getTextAnnotationBounds=function(e,n){var i=r.getDimensions(n,{box:e,style:t,align:"left-top",padding:5});return{x:e.x,y:e.y,width:e.width,height:Math.max(hs,Math.round(i.height))}},this.createText=function(e,t){return r.createText(e,t||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}function fs(){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(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,i,r=this.pathMap[e];t.abspos?(n=t.abspos.x,i=t.abspos.y):(n=t.containerWidth*t.position.mx,i=t.containerHeight*t.position.my);var o={};if(t.position){for(var a=t.containerHeight/r.height*t.yScaleFactor,s=t.containerWidth/r.width*t.xScaleFactor,c=0;c<r.heightElements.length;c++)o["y"+c]=r.heightElements[c]*a;for(var p=0;p<r.widthElements.length;p++)o["x"+p]=r.widthElements[p]*s}var l=gs(r.d,{mx:n,my:i,e:o});return l}}ds.$inject=["config.textRenderer"];var ms=/\{([^{}]+)\}/g,vs=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function ys(e,t,n){var i=n;return t.replace(vs,(function(e,t,n,r,o){t=t||r,i&&(t in i&&(i=i[t]),"function"==typeof i&&o&&(i=i()))})),i=(null==i||i==n?e:i)+"",i}function gs(e,t){return String(e).replace(ms,(function(e,n){return ys(e,n,t)}))}var bs={__init__:["bpmnRenderer"],bpmnRenderer:["type",Xa],textRenderer:["type",ds],pathMap:["type",fs]};function xs(e,t){return t=t||{},e.replace(/{([^}]+)}/g,(function(e,n){return t[n]||"{"+n+"}"}))}var _s={translate:["value",xs]},Es={width:90,height:20},ws=15;function Ss(e){return Ko(e,"bpmn:Event")||Ko(e,"bpmn:Gateway")||Ko(e,"bpmn:DataStoreReference")||Ko(e,"bpmn:DataObjectReference")||Ko(e,"bpmn:DataInput")||Ko(e,"bpmn:DataOutput")||Ko(e,"bpmn:SequenceFlow")||Ko(e,"bpmn:MessageFlow")||Ko(e,"bpmn:Group")}function Cs(e){return Ds(e.label)}function As(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=ks(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=ws:a+=ws,{x:a,y:s}}function ks(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function Ts(e){return e.waypoints?As(e.waypoints):Ko(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Es.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Es.height/2}}function Rs(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Es.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Ts(t),i=Es),V({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Ds(e){return e&&!!e.labelTarget}function Ps(e,t,n){return V({id:e.id,type:e.$type,businessObject:e,di:t},n)}function Ms(e,t,n){var i=e.waypoint;return!i||i.length<2?[bn(t),bn(n)]:i.map((function(e){return{x:e.x,y:e.y}}))}function Bs(e,t,n,i){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:zo(n),referenced:zo(t),property:i}))}function Ns(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._translate=r,this._textRenderer=o}function Os(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function js(e){return Ko(e,"bpmn:Group")}Ns.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],Ns.prototype.add=function(e,t,n){var i,r,o,a=this._translate;if(Ko(t,"bpmndi:BPMNPlane")){var s=Ko(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Ps(e,t,s)),this._canvas.addRootElement(i)}else if(Ko(t,"bpmndi:BPMNShape")){var c=!_a(e,t),p=js(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Ps(e,t,{collapsed:c,hidden:r,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:p})),Ko(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),Ko(e,"bpmn:Lane")&&(o=0),Ko(e,"bpmn:DataStoreReference")&&(Os(n,bn(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else{if(!Ko(t,"bpmndi:BPMNEdge"))throw new Error(a("unknown di {di} for element {semantic}",{di:zo(t),semantic:zo(e)}));var u=this._getSource(e),h=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Ps(e,t,{hidden:r,source:u,target:h,waypoints:Ms(t,u,h)})),Ko(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}return Ss(e)&&Da(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Ns.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:zo(e)}));var r=this._elementRegistry.get(i.id),o=r&&r.attachers;if(!r)throw Bs(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},Ns.prototype.addLabel=function(e,t,n){var i,r,o;return i=Rs(t,n),r=Da(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Ps(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Da(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},Ns.prototype._getEnd=function(e,t){var n,i,r=e.$type,o=this._translate;if(i=e[t+"Ref"],"source"===t&&"bpmn:DataInputAssociation"===r&&(i=i&&i[0]),("source"===t&&"bpmn:DataOutputAssociation"===r||"target"===t&&"bpmn:DataInputAssociation"===r)&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?Bs(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:zo(e),side:t}))},Ns.prototype._getSource=function(e){return this._getEnd(e,"source")},Ns.prototype._getTarget=function(e){return this._getEnd(e,"target")},Ns.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var Ls={__depends__:[_s],bpmnImporter:["type",Ns]},Is={__depends__:[bs,Ls]};function Fs(e){e&&"function"===typeof e.stopPropagation&&e.stopPropagation()}function $s(e){return e.originalEvent||e.srcEvent}function zs(e,t){Fs(e,t),Fs($s(e),t)}function Hs(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 Gs(){return/mac/i.test(navigator.platform)}function Vs(e,t){return($s(e)||e).button===t}function Ws(e){return Vs(e,0)}function Us(e){return Vs(e,1)}function qs(e){var t=$s(e)||e;return!!Ws(e)&&(Gs()?t.metaKey:t.ctrlKey)}function Ks(e){var t=$s(e)||e;return Ws(e)&&t.shiftKey}function Ys(e){return!0}function Xs(e){return Ws(e)||Us(e)}var Zs=500;function Js(e,t,n){var i=this;function r(n,i,r){var o,a,c;s(n,i)||(r?a=t.getGraphics(r):(o=i.delegateTarget||i.target,o&&(a=o,r=t.get(a))),a&&r&&(c=e.fire(n,{element:r,gfx:a,originalEvent:i}),!1===c&&(i.stopPropagation(),i.preventDefault())))}var o={};function a(e){return o[e]}function s(e,t){var n=p[e]||Ws;return!n(t)}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":Ys,"element.mousedown":Xs,"element.mouseup":Xs,"element.click":Xs,"element.dblclick":Xs};function l(e,t,n){var i=c[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return r(i,t,n)}var u="svg, .djs-element";function h(e,t,n,i){var a=o[n]=function(e){r(n,e)};i&&(p[n]=i),a.$delegate=Ee.bind(e,u,t,a)}function d(e,t,n){var i=a(n);i&&Ee.unbind(e,t,i.$delegate)}function f(e){S(c,(function(t,n){h(e,n,t)}))}function m(e){S(c,(function(t,n){d(e,n,t)}))}e.on("canvas.destroy",(function(e){m(e.svg)})),e.on("canvas.init",(function(e){f(e.svg)})),e.on(["shape.added","connection.added"],(function(t){var n=t.element,i=t.gfx;e.fire("interactionEvents.createHit",{element:n,gfx:i})})),e.on(["shape.changed","connection.changed"],Zs,(function(t){var n=t.element,i=t.gfx;e.fire("interactionEvents.updateHit",{element:n,gfx:i})})),e.on("interactionEvents.createHit",Zs,(function(e){var t=e.element,n=e.gfx;i.createDefaultHit(t,n)})),e.on("interactionEvents.updateHit",(function(e){var t=e.element,n=e.gfx;i.updateDefaultHit(t,n)}));var v=_("djs-hit djs-hit-stroke"),y=_("djs-hit djs-hit-click-stroke"),g=_("djs-hit djs-hit-all"),b=_("djs-hit djs-hit-no-move"),x={all:g,"click-stroke":y,stroke:v,"no-move":b};function _(e,t){return t=V({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function E(e,t){var n=x[t];if(!n)throw new Error("invalid hit type <"+t+">");return $e(e,n),e}function w(e,t){Ne(e,t)}this.removeHits=function(e){var t=De(".djs-hit",e);S(t,ht)},this.createDefaultHit=function(e,t){var n,i=e.waypoints,r=e.isFrame;return i?this.createWaypointsHit(t,i):(n=r?"stroke":"all",this.createBoxHit(t,n,{width:e.width,height:e.height}))},this.createWaypointsHit=function(e,t){var n=jt(t);return E(n,"stroke"),w(e,n),n},this.createBoxHit=function(e,t,n){n=V({x:0,y:0},n);var i=Xe("rect");return E(i,t),$e(i,n),w(e,i),i},this.updateDefaultHit=function(e,t){var n=Re(".djs-hit",t);if(n)return e.waypoints?Lt(n,e.waypoints):$e(n,{width:e.width,height:e.height}),n},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=h,this.unregisterEvent=d}Js.$inject=["eventBus","elementRegistry","styles"];var Qs={__init__:["interactionEvents"],interactionEvents:["type",Js]},ec=500;function tc(e,t){this.offset=6;var n=t.cls("djs-outline",["no-fill"]),i=this;function r(e,t){var i=Xe("rect");return $e(i,V({x:10,y:10,rx:4,width:100,height:100},n)),Ne(e,i),i}e.on(["shape.added","shape.changed"],ec,(function(e){var t=e.element,n=e.gfx,o=Re(".djs-outline",n);o||(o=r(n,t)),i.updateShapeOutline(o,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,o=Re(".djs-outline",n);o||(o=r(n,t)),i.updateConnectionOutline(o,t)}))}tc.prototype.updateShapeOutline=function(e,t){$e(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},tc.prototype.updateConnectionOutline=function(e,t){var n=Wt(t);$e(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},tc.$inject=["eventBus","styles","elementRegistry"];var nc={__init__:["outline"],outline:["type",tc]};function ic(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],(function(e){var t=e.element;n.deselect(t)})),e.on(["diagram.clear","root.set"],(function(e){n.select(null)}))}ic.$inject=["eventBus","canvas"],ic.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var i=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},ic.prototype.get=function(){return this._selectedElements},ic.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},ic.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();f(e)||(e=e?[e]:[]);var r=this._canvas,o=r.getRootElement();e=e.filter((function(e){var t=r.findRoot(e);return o===t})),t?S(e,(function(e){-1===n.indexOf(e)&&n.push(e)})):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:n})};var rc="hover",oc="selected",ac=6;function sc(e,t,n){this._canvas=e;var i=this;function r(t,n){e.addMarker(t,n)}function o(t,n){e.removeMarker(t,n)}this._multiSelectionBox=null,t.on("element.hover",(function(e){r(e.element,rc)})),t.on("element.out",(function(e){o(e.element,rc)})),t.on("selection.changed",(function(e){function t(e){o(e,oc)}function n(e){r(e,oc)}var a=e.oldSelection,s=e.newSelection;S(a,(function(e){-1===s.indexOf(e)&&t(e)})),S(s,(function(e){-1===a.indexOf(e)&&n(e)})),i._updateSelectionOutline(s)})),t.on("element.changed",(function(e){n.isSelected(e.element)&&i._updateSelectionOutline(n.get())}))}function cc(e){return{x:e.x-ac,y:e.y-ac,width:e.width+2*ac,height:e.height+2*ac}}function pc(e,t,n,i){e.on("create.end",500,(function(e){var n=e.context,i=n.canExecute,r=n.elements,o=n.hints||{},a=o.autoSelect;if(i){if(!1===a)return;f(a)?t.select(a):t.select(r.filter(lc))}})),e.on("connect.end",500,(function(e){var n=e.context,i=n.connection;i&&t.select(i)})),e.on("shape.move.end",500,(function(e){var n=e.previousSelection||[],r=i.get(e.context.shape.id),o=_(n,(function(e){return r.id===e.id}));o||t.select(r)})),e.on("element.click",(function(e){if(Ws(e)){var i=e.element;i===n.getRootElement()&&(i=null);var r=t.isSelected(i),o=t.get().length>1,a=qs(e)||Ks(e);if(r&&o)return a?t.deselect(i):t.select(i);r?t.deselect(i):t.select(i,a)}}))}function lc(e){return!e.hidden}sc.$inject=["canvas","eventBus","selection"],sc.prototype._updateSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ve(t);var n=e.length>1,i=this._canvas.getContainer();if(He(i)[n?"add":"remove"]("djs-multi-select"),n){var r=cc(Wt(e)),o=Xe("rect");$e(o,V({rx:3},r)),He(o).add("djs-selection-outline"),Ne(t,o)}},pc.$inject=["eventBus","selection","canvas","elementRegistry"];var uc={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Qs,nc],selection:["type",ic],selectionVisuals:["type",sc],selectionBehavior:["type",pc]};function hc(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}hc.prototype.next=function(){return this._prefix+ ++this._counter};var dc=new hc("ov"),fc=500;function mc(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=dc,this._overlayDefaults=V({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=vc(n.getContainer()),this._init()}function vc(e){var t=ke('<div class="djs-overlay-container" />');return ie(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function yc(e,t,n){ie(e,{left:t+"px",top:n+"px"})}function gc(e,t){e.style.display=!1===t?"none":""}function bc(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}mc.$inject=["config.overlays","eventBus","canvas","elementRegistry"],mc.prototype.get=function(e){if(g(e)&&(e={id:e}),g(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?w(t.overlays,L({type:e.type})):t.overlays.slice():[]}return e.type?w(this._overlays,L({type:e.type})):e.id?this._overlays[e.id]:null},mc.prototype.add=function(e,t,n){if(m(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=V({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},mc.prototype.remove=function(e){var t=this.get(e)||[];f(t)||(t=[t]);var n=this;S(t,(function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(Pe(e.html),Pe(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var i=t.overlays.indexOf(e);-1!==i&&t.overlays.splice(i,1)}}))},mc.prototype.isShown=function(){return"none"!==this._overlayRoot.style.display},mc.prototype.show=function(){gc(this._overlayRoot)},mc.prototype.hide=function(){gc(this._overlayRoot,!1)},mc.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ce(this._overlayRoot)},mc.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Wt(t);i=o.x,r=o.y}yc(n,i,r),re(e.html,"data-container-id",t.id)},mc.prototype._updateOverlay=function(e){var t,n,i=e.position,r=e.htmlContainer,o=e.element,a=i.left,s=i.top;void 0!==i.right&&(t=o.waypoints?Wt(o).width:o.width,a=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?Wt(o).height:o.height,s=-1*i.bottom+n);yc(r,a||0,s||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},mc.prototype._createOverlayContainer=function(e){var t=ke('<div class="djs-overlays" />');ie(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},mc.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";bc(this._overlayRoot,n)},mc.prototype._getOverlayContainer=function(e,t){var n=_(this._overlayContainers,(function(t){return t.element===e}));return n||t?n:this._createOverlayContainer(e)},mc.prototype._addOverlay=function(e){var t,n,i=e.id,r=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),g(o)&&(o=ke(o)),n=this._getOverlayContainer(r),t=ke('<div class="djs-overlay" data-overlay-id="'+i+'">'),ie(t,{position:"absolute"}),t.appendChild(o),e.type&&ae(t).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(r),s=this._canvas.getRootElement();gc(t,a===s),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[i]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},mc.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(h(r)&&r>t.scale||h(o)&&o<t.scale))&&(c=!1),gc(a,c),this._updateOverlayScale(e,t)},mc.prototype._updateOverlayScale=function(e,t){var n,i,r,o=e.scale,a=e.htmlContainer,s="";!0!==o&&(!1===o?(n=1,i=1):(n=o.min,i=o.max),h(n)&&t.scale<n&&(r=(1/t.scale||1)*n),h(i)&&t.scale>i&&(r=(1/t.scale||1)*i)),h(r)&&(s="scale("+r+","+r+")"),bc(a,s)},mc.prototype._updateOverlaysVisibilty=function(e){var t=this;S(this._overlays,(function(n){t._updateOverlayVisibilty(n,e)}))},mc.prototype._init=function(){var e=this._eventBus,t=this;function n(e){t._updateRoot(e),t._updateOverlaysVisibilty(e),t.show()}e.on("canvas.viewbox.changing",(function(e){t.hide()})),e.on("canvas.viewbox.changed",(function(e){n(e.viewbox)})),e.on(["shape.remove","connection.remove"],(function(e){var n=e.element,i=t.get({element:n});S(i,(function(e){t.remove(e.id)}));var r=t._getOverlayContainer(n);if(r){Pe(r.html);var o=t._overlayContainers.indexOf(r);-1!==o&&t._overlayContainers.splice(o,1)}})),e.on("element.changed",fc,(function(e){var n=e.element,i=t._getOverlayContainer(n,!0);i&&(S(i.overlays,(function(e){t._updateOverlay(e)})),t._updateOverlayContainer(i))})),e.on("element.marker.update",(function(e){var n=t._getOverlayContainer(e.element,!0);n&&ae(n.html)[e.add?"add":"remove"](e.marker)})),e.on("root.set",(function(){t._updateOverlaysVisibilty(t._canvas.viewbox())})),e.on("diagram.clear",this.clear,this)};var xc={__init__:["overlays"],overlays:["type",mc]};function _c(e,t,n,i){e.on("element.changed",(function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=n.getGraphics(r)),i.gfx&&e.fire(qt(r)+".changed",i)})),e.on("elements.changed",(function(t){var n=t.elements;n.forEach((function(t){e.fire("element.changed",{element:t})})),i.updateContainments(n)})),e.on("shape.changed",(function(e){i.update("shape",e.element,e.gfx)})),e.on("connection.changed",(function(e){i.update("connection",e.element,e.gfx)}))}_c.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var Ec={__init__:["changeSupport"],changeSupport:["type",_c]},wc=1e3;function Sc(e){this._eventBus=e}function Cc(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}Sc.$inject=["eventBus"],Sc.prototype.on=function(e,t,n,i,r,o){if((y(t)||v(t))&&(o=r,r=i,i=n,n=t,t=null),y(n)&&(o=r,r=i,i=n,n=wc),m(r)&&(o=r,r=!1),!y(i))throw new Error("handlerFn must be a function");f(e)||(e=[e]);var a=this._eventBus;S(e,(function(e){var s=["commandStack",e,t].filter((function(e){return e})).join(".");a.on(s,n,r?Cc(i,o):i,o)}))};var Ac=["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"];function kc(e,t){t.invoke(Sc,this),this.executed((function(t){var n=t.context;n.rootElement?e.setRootElement(n.rootElement):n.rootElement=e.getRootElement()})),this.revert((function(t){var n=t.context;n.rootElement&&e.setRootElement(n.rootElement)}))}S(Ac,(function(e){Sc.prototype[e]=function(t,n,i,r,o){(y(t)||v(t))&&(o=r,r=i,i=n,n=t,t=null),this.on(t,e,n,i,r,o)}})),i(kc,Sc),kc.$inject=["canvas","injector"];var Tc={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",kc]};function Rc(e){return CSS.escape(e)}var Dc={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Pc(e){return e=""+e,e&&e.replace(/[&<>"']/g,(function(e){return Dc[e]}))}var Mc="_plane";function Bc(e){var t=e.id;return Ic(t)}function Nc(e){var t=e.id;return Ko(e,"bpmn:SubProcess")?Lc(t):t}function Oc(e){return Lc(e)}function jc(e){var t=Zo(e);return Ko(t,"bpmndi:BPMNPlane")}function Lc(e){return e+Mc}function Ic(e){return e.replace(new RegExp(Mc+"$"),"")}var Fc="bjs-breadcrumbs-shown";function $c(e,t,n,i){var r=ke('<ul class="bjs-breadcrumbs"></ul>'),o=i.getContainer(),a=ae(o);o.appendChild(r);var s=[];function c(e){e&&(s=zc(e));var n=s.map((function(e){var n=Pc(e.name||e.id),r=ke('<li><span class="bjs-crumb"><a title="'+n+'">'+n+"</a></span></li>"),o=i.findRoot(Nc(e))||i.findRoot(e.id);if(!o&&Ko(e,"bpmn:Process")){var a=t.find((function(t){var n=Xo(t);return n&&n.processRef&&n.processRef===e}));o=i.findRoot(a.id)}return r.addEventListener("click",(function(){i.setRootElement(o)})),r}));r.innerHTML="";var o=n.length>1;a.toggle(Fc,o),n.forEach((function(e){r.appendChild(e)}))}e.on("element.changed",(function(e){var t=e.element,n=Xo(t),i=_(s,(function(e){return e===n}));i&&c()})),e.on("root.set",(function(e){c(e.element)}))}function zc(e){for(var t=Xo(e),n=[],i=t;i;i=i.$parent)(Ko(i,"bpmn:SubProcess")||Ko(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Hc(e,t){var n=null,i=new Gc;e.on("root.set",(function(e){var r=e.element,o=t.viewbox(),a=i.get(r);if(i.set(n,{x:o.x,y:o.y,zoom:o.scale}),n=r,!Ko(r,"bpmn:Collaboration")||a){a=a||{x:0,y:0,zoom:1};var s=(o.x-a.x)*o.scale,c=(o.y-a.y)*o.scale;0===s&&0===c||t.scroll({dx:s,dy:c}),a.zoom!==o.scale&&t.zoom(a.zoom,{x:0,y:0})}})),e.on("diagram.clear",(function(){i.clear(),n=null}))}function Gc(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][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}-1!==t&&this._entries.splice(t,1)}}$c.$inject=["eventBus","elementRegistry","overlays","canvas"],Hc.$inject=["eventBus","canvas"];var Vc={x:180,y:160};function Wc(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,(function(e,t){n.handleImport(t.definitions)}))}function Uc(e){return Ko(e,"bpmndi:BPMNDiagram")?e:Uc(e.$parent)}function qc(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach((function(e){if(e.bounds){var n=mn(e.bounds);t.top=Math.min(n.top,t.top),t.left=Math.min(n.left,t.left)}})),vn(t)}function Kc(e,t){var n=e.$parent;return!(!Ko(n,"bpmn:SubProcess")||n===t.bpmnElement)&&!Yo(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"])}Wc.prototype.handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach((function(e){e.plane&&e.plane.bpmnElement&&(t._processToDiagramMap[e.plane.bpmnElement.id]=e)}));var n=[];e.diagrams.forEach((function(e){var i=t.createNewDiagrams(e.plane);Array.prototype.push.apply(n,i)})),n.forEach((function(e){t.movePlaneElementsToOrigin(e.plane)}))}},Wc.prototype.createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach((function(t){var r=t.bpmnElement;if(r){var o=r.$parent;Ko(r,"bpmn:SubProcess")&&!t.isExpanded&&n.push(r),Kc(r,e)&&i.push({diElement:t,parent:o})}}));var r=[];return n.forEach((function(e){if(!t._processToDiagramMap[e.id]){var n=t.createDiagram(e);t._processToDiagramMap[e.id]=n,r.push(n)}})),i.forEach((function(e){var i=e.diElement,r=e.parent;while(r&&-1===n.indexOf(r))r=r.$parent;if(r){var o=t._processToDiagramMap[r.id];t.moveToDiPlane(i,o.plane)}})),r},Wc.prototype.movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=qc(e),i={x:n.x-Vc.x,y:n.y-Vc.y};t.forEach((function(e){e.waypoint?e.waypoint.forEach((function(e){e.x=e.x-i.x,e.y=e.y-i.y})):e.bounds&&(e.bounds.x=e.bounds.x-i.x,e.bounds.y=e.bounds.y-i.y)}))},Wc.prototype.moveToDiPlane=function(e,t){var n=Uc(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Wc.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},Wc.$inject=["eventBus","moddle"];var Yc=250,Xc='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>',Zc="bjs-drilldown-empty";function Jc(e,t,n,i){Sc.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i;var r=this;this.executed("shape.toggleCollapse",Yc,(function(e){var t=e.shape;r.canDrillDown(t)?r.addOverlay(t):r.removeOverlay(t)}),!0),this.reverted("shape.toggleCollapse",Yc,(function(e){var t=e.shape;r.canDrillDown(t)?r.addOverlay(t):r.removeOverlay(t)}),!0),this.executed(["shape.create","shape.move","shape.delete"],Yc,(function(e){var t=e.oldParent,n=e.newParent||e.parent,i=e.shape;r.canDrillDown(i)&&r.addOverlay(i),r.updateDrilldownOverlay(t),r.updateDrilldownOverlay(n),r.updateDrilldownOverlay(i)}),!0),this.reverted(["shape.create","shape.move","shape.delete"],Yc,(function(e){var t=e.oldParent,n=e.newParent||e.parent,i=e.shape;r.canDrillDown(i)&&r.addOverlay(i),r.updateDrilldownOverlay(t),r.updateDrilldownOverlay(n),r.updateDrilldownOverlay(i)}),!0),t.on("import.render.complete",(function(){n.filter((function(e){return r.canDrillDown(e)})).map((function(e){r.addOverlay(e)}))}))}i(Jc,Sc),Jc.prototype.updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this.updateOverlayVisibility(n)}},Jc.prototype.canDrillDown=function(e){var t=this._canvas;return Ko(e,"bpmn:SubProcess")&&t.findRoot(Nc(e))},Jc.prototype.updateOverlayVisibility=function(e){var t=this._overlays,n=e.businessObject,i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.flowElements&&n.flowElements.length;ae(i.html).toggle(Zc,!r)}},Jc.prototype.addOverlay=function(e){var t=this._canvas,n=this._overlays,i=n.get({element:e,type:"drilldown"});i.length&&this.removeOverlay(e);var r=ke('<button class="bjs-drilldown">'+Xc+"</button>");r.addEventListener("click",(function(){t.setRootElement(t.findRoot(Nc(e)))})),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this.updateOverlayVisibility(e)},Jc.prototype.removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Jc.$inject=["canvas","eventBus","elementRegistry","overlays"];var Qc={__depends__:[xc,Ec,Tc],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",$c],drilldownCentering:["type",Hc],drilldownOverlayBehavior:["type",Jc],subprocessCompatibility:["type",Wc]};function ep(e){da.call(this,e)}i(ep,da),ep.prototype._modules=[Is,_s,uc,xc,Qc],ep.prototype._moddleExtensions={};var tp=["c","C"],np=["v","V"],ip=["y","Y"],rp=["z","Z"];function op(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ap(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function sp(e,t){return e=f(e)?e:[e],-1!==e.indexOf(t.key)||-1!==e.indexOf(t.code)}function cp(e){return e.shiftKey}function pp(e){return ap(e)&&sp(tp,e)}function lp(e){return ap(e)&&sp(np,e)}function up(e){return ap(e)&&!cp(e)&&sp(rp,e)}function hp(e){return ap(e)&&(sp(ip,e)||sp(rp,e)&&cp(e))}var dp="keyboard.keydown",fp="keyboard.keyup",mp="input-handle-modified-keys",vp=1e3;function yp(e,t){var n=this;this._config=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()})),t.on("diagram.init",(function(){n._fire("init")})),t.on("attach",(function(){e&&e.bindTo&&n.bind(e.bindTo)})),t.on("detach",(function(){n.unbind()}))}function gp(e){return e&&(Te(e,"input, textarea")||"true"===e.contentEditable)}yp.$inject=["config.keyboard","eventBus"],yp.prototype._keydownHandler=function(e){this._keyHandler(e,dp)},yp.prototype._keyupHandler=function(e){this._keyHandler(e,fp)},yp.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||dp,i),n&&e.preventDefault()}},yp.prototype._isEventIgnored=function(e){return!!e.defaultPrevented||gp(e.target)&&this._isModifiedKeyIgnored(e)},yp.prototype._isModifiedKeyIgnored=function(e){if(!ap(e))return!0;var t=this._getAllowedModifiers(e.target);return-1===t.indexOf(e.key)},yp.prototype._getAllowedModifiers=function(e){var t=pe(e,"["+mp+"]",!0);return!t||this._node&&!this._node.contains(t)?[]:t.getAttribute(mp).split(",")},yp.prototype.bind=function(e){this.unbind(),this._node=e,ye.bind(e,"keydown",this._keydownHandler),ye.bind(e,"keyup",this._keyupHandler),this._fire("bind")},yp.prototype.getBinding=function(){return this._node},yp.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),ye.unbind(e,"keydown",this._keydownHandler),ye.unbind(e,"keyup",this._keyupHandler)),this._node=null},yp.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},yp.prototype.addListener=function(e,t,n){y(e)&&(n=t,t=e,e=vp),this._eventBus.on(n||dp,e,t)},yp.prototype.removeListener=function(e,t){this._eventBus.off(t||dp,e)},yp.prototype.hasModifier=op,yp.prototype.isCmd=ap,yp.prototype.isShift=cp,yp.prototype.isKey=sp;var bp=500;function xp(e,t){var n=this;e.on("editorActions.init",bp,(function(e){var i=e.editorActions;n.registerBindings(t,i)}))}xp.$inject=["eventBus","keyboard"],xp.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}n("undo",(function(e){var n=e.keyEvent;if(up(n))return t.trigger("undo"),!0})),n("redo",(function(e){var n=e.keyEvent;if(hp(n))return t.trigger("redo"),!0})),n("copy",(function(e){var n=e.keyEvent;if(pp(n))return t.trigger("copy"),!0})),n("paste",(function(e){var n=e.keyEvent;if(lp(n))return t.trigger("paste"),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(sp(["+","Add","="],n)&&ap(n))return t.trigger("stepZoom",{value:1}),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(sp(["-","Subtract"],n)&&ap(n))return t.trigger("stepZoom",{value:-1}),!0})),n("zoom",(function(e){var n=e.keyEvent;if(sp("0",n)&&ap(n))return t.trigger("zoom",{value:1}),!0})),n("removeSelection",(function(e){var n=e.keyEvent;if(sp(["Backspace","Delete","Del"],n))return t.trigger("removeSelection"),!0}))};var _p={__init__:["keyboard","keyboardBindings"],keyboard:["type",yp],keyboardBindings:["type",xp]},Ep={moveSpeed:50,moveSpeedAccelerated:200};function wp(e,t,n){var i=this;function r(e){var n=e.keyEvent,r=i._config;if(t.isCmd(n)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],n)){var o,a=t.isShift(n)?r.moveSpeedAccelerated:r.moveSpeed;switch(n.key){case"ArrowLeft":case"Left":o="left";break;case"ArrowUp":case"Up":o="up";break;case"ArrowRight":case"Right":o="right";break;case"ArrowDown":case"Down":o="down";break}return i.moveCanvas({speed:a,direction:o}),!0}}this._config=V({},Ep,e||{}),t.addListener(r),this.moveCanvas=function(e){var t=0,i=0,r=e.speed,o=r/Math.min(Math.sqrt(n.viewbox().scale),1);switch(e.direction){case"left":t=o;break;case"up":i=o;break;case"right":t=-o;break;case"down":i=-o;break}n.scroll({dx:t,dy:i})}}wp.$inject=["config.keyboardMove","keyboard","canvas"];var Sp={__depends__:[_p],__init__:["keyboardMove"],keyboardMove:["type",wp]},Cp=/^djs-cursor-.*$/;function Ap(e){var t=ae(document.body);t.removeMatching(Cp),e&&t.add("djs-cursor-"+e)}function kp(){Ap(null)}var Tp=5e3;function Rp(e,t){function n(){return!1}return t=t||"element.click",e.once(t,Tp,n),function(){e.off(t,n)}}function Dp(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Pp(e,t){return{x:e.x-t.x,y:e.y-t.y}}var Mp=15;function Bp(e,t){var n;function i(i){var r=n.start,o=n.button,a=Hs(i),s=Pp(a,r);if(!n.dragging&&Np(s)>Mp&&(n.dragging=!0,0===o&&Rp(e),Ap("grab")),n.dragging){var c=n.last||n.start;s=Pp(a,c),t.scroll({dx:s.x,dy:s.y}),n.last=a}i.preventDefault()}function r(e){ye.unbind(document,"mousemove",i),ye.unbind(document,"mouseup",r),n=null,kp()}function o(e){if(!pe(e.target,".djs-draggable")){var t=e.button;if(!(t>=2||e.ctrlKey||e.shiftKey||e.altKey))return n={button:t,start:Hs(e)},ye.bind(document,"mousemove",i),ye.bind(document,"mouseup",r),!0}}e.on("element.mousedown",500,(function(e){return o(e.originalEvent)})),this.isActive=function(){return!!n}}function Np(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}Bp.$inject=["eventBus","canvas"];var Op={__init__:["moveCanvas"],moveCanvas:["type",Bp]};function jp(e){return Math.log(e)/Math.log(10)}function Lp(e,t){var n=jp(e.min),i=jp(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function Ip(e,t){return Math.max(e.min,Math.min(e.max,t))}var Fp=Math.sign||function(e){return e>=0?1:-1},$p={min:.2,max:4},zp=10,Hp=.1,Gp=.75;function Vp(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=G(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Gp;var i=this;t.on("canvas.init",(function(t){i._init(!1!==e.enabled)}))}Vp.$inject=["config.zoomScroll","eventBus","canvas"],Vp.prototype.scroll=function(e){this._canvas.scroll(e)},Vp.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Vp.prototype.zoom=function(e,t){var n=Lp($p,2*zp);this._totalDelta+=e,Math.abs(this._totalDelta)>Hp&&(this._zoom(e,t,n),this._totalDelta=0)},Vp.prototype._handleWheel=function(e){if(!pe(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=e.ctrlKey,r=e.shiftKey,o=-1*this._scale;if(o*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){var a=t.getBoundingClientRect(),s={x:e.clientX-a.left,y:e.clientY-a.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Fp(e.deltaY)*o,this.zoom(n,s)}else n=r?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},Vp.prototype.stepZoom=function(e,t){var n=Lp($p,zp);this._zoom(e,t,n)},Vp.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=jp(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(Ip($p,s),t)},Vp.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return"undefined"===typeof e&&(e=!i),i!==e&&ye[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},Vp.prototype._init=function(e){this.toggle(e)};var Wp={__init__:["zoomScroll"],zoomScroll:["type",Vp]};function Up(e){ep.call(this,e)}i(Up,ep),Up.prototype._navigationModules=[Sp,Op,Wp],Up.prototype._modules=[].concat(ep.prototype._modules,Up.prototype._navigationModules);var qp=n("c8b5"),Kp=n.n(qp),Yp=.2,Xp=4,Zp=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function Jp(){}function Qp(e,t){return t.get(e,!1)}function el(e){e.preventDefault(),"function"===typeof e.stopPropagation?e.stopPropagation():e.srcEvent&&"function"===typeof e.srcEvent.stopPropagation&&e.srcEvent.stopPropagation(),"function"===typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()}function tl(e){function t(t){S(Zp,(function(t){ye.bind(e,t,el,!0)}))}function n(t){setTimeout((function(){S(Zp,(function(t){ye.unbind(e,t,el,!0)}))}),500)}ye.bind(e,"touchstart",t,!0),ye.bind(e,"touchend",n,!0),ye.bind(e,"touchcancel",n,!0);var i=new Kp.a.Manager(e,{inputClass:Kp.a.TouchInput,recognizers:[],domEvents:!0}),r=new Kp.a.Tap,o=new Kp.a.Pan({threshold:10}),a=new Kp.a.Press,s=new Kp.a.Pinch,c=new Kp.a.Tap({event:"doubletap",taps:2});return s.requireFailure(o),s.requireFailure(a),i.add([o,a,s,c,r]),i.reset=function(e){var t=this.recognizers,n=this.session;n.stopped||(Jp("recognizer","stop"),i.stop(e),setTimeout((function(){var e,i;for(Jp("recognizer","reset"),e=0;i=t[e];e++)i.reset(),i.state=8;n.curRecognizer=null}),0))},i.on("hammer.input",(function(e){e.srcEvent.defaultPrevented&&i.reset(!0)})),i}function nl(e,t,n,i,r){var o,a=Qp("dragging",e),s=Qp("move",e),c=Qp("contextPad",e),p=Qp("palette",e);function l(e,t){return function(n){Jp("element",e,n);var o=u(n.target),a=o&&i.get(o);return t&&(n.srcEvent.button=t),r.fire(e,n,a)}}function u(e){var t=pe(e,"svg, .djs-element",!0);return t}function h(e){function n(e){Jp("canvas","grab start");var n=0,i=0;function r(e){var r=e.deltaX-n,o=e.deltaY-i;t.scroll({dx:r,dy:o}),n=e.deltaX,i=e.deltaY}function a(e){o.off("panmove",r),o.off("panend",a),o.off("pancancel",a),Jp("canvas","grab end")}o.on("panmove",r),o.on("panend",a),o.on("pancancel",a)}function r(e){var r=u(e.target),o=r&&i.get(r);if(s&&t.getRootElement()!==o)return Jp("element","move start",o,e,!0),s.start(e,o,!0);n(e)}function a(e){Jp("canvas","zoom start");var n=t.zoom(),i=e.center;function r(e){var r=1-(1-e.scale)/1.5,o=Math.max(Yp,Math.min(Xp,r*n));t.zoom(o,i),el(e)}function a(e){o.off("pinchmove",r),o.off("pinchend",a),o.off("pinchcancel",a),o.reset(!0),Jp("canvas","zoom end")}o.on("pinchmove",r),o.on("pinchend",a),o.on("pinchcancel",a)}o=tl(e),o.on("tap",l("element.click")),o.on("doubletap",l("element.dblclick",1)),o.on("panstart",r),o.on("press",r),o.on("pinchstart",a)}a&&n.on("drag.move",(function(e){var t=e.originalEvent;if(t&&!(t instanceof MouseEvent)){var n=Hs(t),r=document.elementFromPoint(n.x,n.y),o=u(r),s=o&&i.get(o);s!==e.hover&&(e.hover&&a.out(e),s&&(a.hover({element:s,gfx:o}),e.hover=s,e.hoverGfx=o))}})),c&&n.on("contextPad.create",(function(e){var t=e.pad.html,n=tl(t);n.on("panstart",(function(e){Jp("context-pad","panstart",e),c.trigger("dragstart",e,!0)})),n.on("press",(function(e){Jp("context-pad","press",e),c.trigger("dragstart",e,!0)})),n.on("tap",(function(e){Jp("context-pad","tap",e),c.trigger("click",e)}))})),p&&n.on("palette.create",(function(e){var t=e.container,n=tl(t);n.on("panstart",(function(e){Jp("palette","panstart",e),p.trigger("dragstart",e,!0)})),n.on("press",(function(e){Jp("palette","press",e),p.trigger("dragstart",e,!0)})),n.on("tap",(function(e){Jp("palette","tap",e),p.trigger("click",e)}))})),n.on("canvas.init",(function(e){h(e.svg)}))}function il(e){var t=this;e.on("canvas.init",(function(e){t.addBBoxMarker(e.svg)}))}nl.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"],il.$inject=["eventBus"],il.prototype.addBBoxMarker=function(e){var t={fill:"none",class:"outer-bound-marker"},n=Xe("rect");$e(n,{x:-1e4,y:1e4,width:10,height:10}),$e(n,t),Ne(e,n);var i=Xe("rect");$e(i,{x:1e4,y:1e4,width:10,height:10}),$e(i,t),Ne(e,i)};var rl={__depends__:[Qs],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",nl],touchFix:["type",il]},ol={__depends__:[rl]};function al(e){return e&&e[e.length-1]}function sl(e){return e.y}function cl(e){return e.x}var pl={left:cl,center:cl,right:function(e){return e.x+e.width},top:sl,middle:sl,bottom:function(e){return e.y+e.height}};function ll(e,t){this._modeling=e,this._rules=t}ll.$inject=["modeling","rules"],ll.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return-1!==t.indexOf(e)&&(n="y",i="height"),{axis:n,dimension:i}},ll.prototype._isType=function(e,t){return-1!==t.indexOf(e)},ll.prototype._alignmentPosition=function(e,t){var n,i,r,o=this._getOrientationDetails(e),a=o.axis,s=o.dimension,c={},p={},l=!1;function u(e,t){return Math.round((e[a]+t[a]+t[s])/2)}if(this._isType(e,["left","top"]))c[e]=t[0][a];else if(this._isType(e,["right","bottom"]))r=al(t),c[e]=r[a]+r[s];else if(this._isType(e,["center","middle"])){if(S(t,(function(e){var t=e[a]+Math.round(e[s]/2);p[t]?p[t].elements.push(e):p[t]={elements:[e],center:t}})),n=j(p,(function(e){return e.elements.length>1&&(l=!0),e.elements.length})),l)return c[e]=al(n).center,c;i=t[0],t=j(t,(function(e){return e[a]+e[s]})),r=al(t),c[e]=u(i,r)}return c},ll.prototype.trigger=function(e,t){var n,i=this._modeling,r=w(e,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));if(n=this._rules.allowed("elements.align",{elements:r}),f(n)&&(r=n),!(r.length<2)&&n){var o=pl[t],a=j(r,o),s=this._alignmentPosition(t,a);i.alignElements(a,s)}};var ul={__init__:["alignElements"],alignElements:["type",ll]},hl=".entry",dl=1e3,fl=12;function ml(e,t,n,i){this._canvas=e,this._eventBus=n,this._overlays=i;var r=h(t&&t.scale)?t.scale:{min:1,max:1.5};this._overlaysConfig={scale:r},this._current=null,this._init()}function vl(e,t){var n=ae(e);t=f(t)?t:t.split(/\s+/g),t.forEach((function(e){n.add(e)}))}function yl(e,t){return-1!==e.indexOf(t)}ml.$inject=["canvas","config.contextPad","eventBus","overlays"],ml.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",(function(t){var n=t.newSelection,i=n.length?1===n.length?n[0]:n:null;i?e.open(i,!0):e.close()})),this._eventBus.on("elements.changed",(function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=T(f(r)?r:[r],(function(e){return yl(n,e)}));o&&e.open(r,!0)}}))},ml.prototype.registerProvider=function(e,t){t||(t=e,e=dl),this._eventBus.on("contextPad.getProviders",e,(function(e){e.providers.push(t)}))},ml.prototype.getEntries=function(e){var t=this._getProviders(),n=f(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return S(t,(function(t){if(y(t[n])){var r=t[n](e);y(r)?i=r(i):S(r,(function(e,t){i[t]=e}))}})),i},ml.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=re(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},ml.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(!1!==this._eventBus.fire("contextPad.trigger",{entry:a,event:n})){if(y(s)){if("click"===t)return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},ml.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},ml.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ml.prototype._updateAndOpen=function(e){var t,n=this.getEntries(e),i=this.getPad(e),r=i.html;S(n,(function(e,n){var i,o=e.group||"default",a=ke(e.html||'<div class="entry" draggable="true"></div>');re(a,"data-action",n),i=Re("[data-group="+Rc(o)+"]",r),i||(i=ke('<div class="group"></div>'),re(i,"data-group",o),r.appendChild(i)),i.appendChild(a),e.className&&vl(a,e.className),e.title&&re(a,"title",e.title),e.imageUrl&&(t=ke("<img>"),re(t,"src",e.imageUrl),t.style.width="100%",t.style.height="100%",a.appendChild(t))})),ae(r).add("open"),this._current={target:e,entries:n,pad:i},this._eventBus.fire("contextPad.open",{current:this._current})},ml.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=ke('<div class="djs-context-pad"></div>'),r=this._getPosition(e),o=V({html:i},this._overlaysConfig,r);Ee.bind(i,hl,"click",(function(e){t.trigger("click",e)})),Ee.bind(i,hl,"dragstart",(function(e){t.trigger("dragstart",e)})),ye.bind(i,"mousedown",(function(e){e.stopPropagation()}));var a=this._canvas.getRootElement();this._overlayId=n.add(a,"context-pad",o);var s=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{target:e,pad:s}),s},ml.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},ml.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return f(e)===f(n)&&(f(e)?e.length===n.length&&k(e,(function(e){return yl(n,e)})):n===e)},ml.prototype.isShown=function(){return this.isOpen()&&this._overlays.isShown()},ml.prototype._getPosition=function(e){var t=f(e)?e:[e],n=Wt(t);return{position:{left:n.x+n.width+fl,top:n.y-fl/2}}};var gl,bl,xl,_l,El,wl,Sl,Cl,Al,kl,Tl={__depends__:[Qs,xc],contextPad:["type",ml]},Rl={},Dl=[],Pl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ml=Array.isArray;function Bl(e,t){for(var n in t)e[n]=t[n];return e}function Nl(e){var t=e.parentNode;t&&t.removeChild(e)}function Ol(e,t,n){var i,r,o,a={};for(o in t)"key"==o?i=t[o]:"ref"==o?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?gl.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===a[o]&&(a[o]=e.defaultProps[o]);return jl(e,a,i,r,null)}function jl(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++xl:r,__i:-1,__u:0};return null==r&&null!=bl.vnode&&bl.vnode(o),o}function Ll(e){return e.children}function Il(e,t){this.props=e,this.context=t}function Fl(e,t){if(null==t)return e.__?Fl(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?Fl(e):null}function $l(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return $l(e)}}function zl(e){(!e.__d&&(e.__d=!0)&&_l.push(e)&&!Hl.__r++||El!==bl.debounceRendering)&&((El=bl.debounceRendering)||wl)(Hl)}function Hl(){var e,t,n,i,r,o,a,s;for(_l.sort(Sl);e=_l.shift();)e.__d&&(t=_l.length,i=void 0,o=(r=(n=e).__v).__e,a=[],s=[],n.__P&&((i=Bl({},r)).__v=r.__v+1,bl.vnode&&bl.vnode(i),Xl(n.__P,i,r,n.__n,n.__P.namespaceURI,32&r.__u?[o]:null,a,null==o?Fl(r):o,!!(32&r.__u),s),i.__v=r.__v,i.__.__k[i.__i]=i,Zl(a,i,s),i.__e!=o&&$l(i)),_l.length>t&&_l.sort(Sl));Hl.__r=0}function Gl(e,t,n,i,r,o,a,s,c,p,l){var u,h,d,f,m,v=i&&i.__k||Dl,y=t.length;for(n.__d=c,Vl(n,t,v),c=n.__d,u=0;u<y;u++)null!=(d=n.__k[u])&&"boolean"!=typeof d&&"function"!=typeof d&&(h=-1===d.__i?Rl:v[d.__i]||Rl,d.__i=u,Xl(e,d,h,r,o,a,s,c,p,l),f=d.__e,d.ref&&h.ref!=d.ref&&(h.ref&&Ql(h.ref,null,d),l.push(d.ref,d.__c||f,d)),null==m&&null!=f&&(m=f),65536&d.__u||h.__k===d.__k?(c&&!c.isConnected&&(c=Fl(h)),c=Wl(d,c,e)):"function"==typeof d.type&&void 0!==d.__d?c=d.__d:f&&(c=f.nextSibling),d.__d=void 0,d.__u&=-196609);n.__d=c,n.__e=m}function Vl(e,t,n){var i,r,o,a,s,c=t.length,p=n.length,l=p,u=0;for(e.__k=[],i=0;i<c;i++)a=i+u,null!=(r=e.__k[i]=null==(r=t[i])||"boolean"==typeof r||"function"==typeof r?null:"string"==typeof r||"number"==typeof r||"bigint"==typeof r||r.constructor==String?jl(null,r,null,null,null):Ml(r)?jl(Ll,{children:r},null,null,null):void 0===r.constructor&&r.__b>0?jl(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)?(r.__=e,r.__b=e.__b+1,s=Ul(r,n,a,l),r.__i=s,o=null,-1!==s&&(l--,(o=n[s])&&(o.__u|=131072)),null==o||null===o.__v?(-1==s&&u--,"function"!=typeof r.type&&(r.__u|=65536)):s!==a&&(s===a+1?u++:s>a?l>c-a?u+=s-a:u--:s<a?s==a-1&&(u=s-a):u=0,s!==i+u&&(r.__u|=65536))):(o=n[a])&&null==o.key&&o.__e&&0==(131072&o.__u)&&(o.__e==e.__d&&(e.__d=Fl(o)),eu(o,o,!1),n[a]=null,l--);if(l)for(i=0;i<p;i++)null!=(o=n[i])&&0==(131072&o.__u)&&(o.__e==e.__d&&(e.__d=Fl(o)),eu(o,o))}function Wl(e,t,n){var i,r;if("function"==typeof e.type){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=Wl(i[r],t,n));return t}e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8===t.nodeType);return t}function Ul(e,t,n,i){var r=e.key,o=e.type,a=n-1,s=n+1,c=t[n];if(null===c||c&&r==c.key&&o===c.type&&0==(131072&c.__u))return n;if(i>(null!=c&&0==(131072&c.__u)?1:0))for(;a>=0||s<t.length;){if(a>=0){if((c=t[a])&&0==(131072&c.__u)&&r==c.key&&o===c.type)return a;a--}if(s<t.length){if((c=t[s])&&0==(131072&c.__u)&&r==c.key&&o===c.type)return s;s++}}return-1}function ql(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||Pl.test(t)?n:n+"px"}function Kl(e,t,n,i,r){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||ql(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||ql(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||"onFocusOut"===t||"onFocusIn"===t?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n.u=i.u:(n.u=Cl,e.addEventListener(t,o?kl:Al,o)):e.removeEventListener(t,o?kl:Al,o);else{if("http://www.w3.org/2000/svg"==r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function Yl(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=Cl++;else if(t.t<n.u)return;return n(bl.event?bl.event(t):t)}}}function Xl(e,t,n,i,r,o,a,s,c,p){var l,u,h,d,f,m,v,y,g,b,x,_,E,w,S,C=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=bl.__b)&&l(t);e:if("function"==typeof C)try{if(y=t.props,g=(l=C.contextType)&&i[l.__c],b=l?g?g.props.value:l.__:i,n.__c?v=(u=t.__c=n.__c).__=u.__E:("prototype"in C&&C.prototype.render?t.__c=u=new C(y,b):(t.__c=u=new Il(y,b),u.constructor=C,u.render=tu),g&&g.sub(u),u.props=y,u.state||(u.state={}),u.context=b,u.__n=i,h=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=C.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=Bl({},u.__s)),Bl(u.__s,C.getDerivedStateFromProps(y,u.__s))),d=u.props,f=u.state,u.__v=t,h)null==C.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==C.getDerivedStateFromProps&&y!==d&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(y,b),!u.__e&&(null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(y,u.__s,b)||t.__v===n.__v)){for(t.__v!==n.__v&&(u.props=y,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),x=0;x<u._sb.length;x++)u.__h.push(u._sb[x]);u._sb=[],u.__h.length&&a.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(y,u.__s,b),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(d,f,m)}))}if(u.context=b,u.props=y,u.__P=e,u.__e=!1,_=bl.__r,E=0,"prototype"in C&&C.prototype.render){for(u.state=u.__s,u.__d=!1,_&&_(t),l=u.render(u.props,u.state,u.context),w=0;w<u._sb.length;w++)u.__h.push(u._sb[w]);u._sb=[]}else do{u.__d=!1,_&&_(t),l=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++E<25);u.state=u.__s,null!=u.getChildContext&&(i=Bl(Bl({},i),u.getChildContext())),h||null==u.getSnapshotBeforeUpdate||(m=u.getSnapshotBeforeUpdate(d,f)),Gl(e,Ml(S=null!=l&&l.type===Ll&&null==l.key?l.props.children:l)?S:[S],t,n,i,r,o,a,s,c,p),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),v&&(u.__E=u.__=null)}catch(e){t.__v=null,c||null!=o?(t.__e=s,t.__u|=c?160:32,o[o.indexOf(s)]=null):(t.__e=n.__e,t.__k=n.__k),bl.__e(e,t,n)}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Jl(n.__e,t,n,i,r,o,a,c,p);(l=bl.diffed)&&l(t)}function Zl(e,t,n){t.__d=void 0;for(var i=0;i<n.length;i++)Ql(n[i],n[++i],n[++i]);bl.__c&&bl.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){bl.__e(e,t.__v)}}))}function Jl(e,t,n,i,r,o,a,s,c){var p,l,u,h,d,f,m,v=n.props,y=t.props,g=t.type;if("svg"===g?r="http://www.w3.org/2000/svg":"math"===g?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),null!=o)for(p=0;p<o.length;p++)if((d=o[p])&&"setAttribute"in d==!!g&&(g?d.localName===g:3===d.nodeType)){e=d,o[p]=null;break}if(null==e){if(null===g)return document.createTextNode(y);e=document.createElementNS(r,g,y.is&&y),o=null,s=!1}if(null===g)v===y||s&&e.data===y||(e.data=y);else{if(o=o&&gl.call(e.childNodes),v=n.props||Rl,!s&&null!=o)for(v={},p=0;p<e.attributes.length;p++)v[(d=e.attributes[p]).name]=d.value;for(p in v)if(d=v[p],"children"==p);else if("dangerouslySetInnerHTML"==p)u=d;else if("key"!==p&&!(p in y)){if("value"==p&&"defaultValue"in y||"checked"==p&&"defaultChecked"in y)continue;Kl(e,p,null,d,r)}for(p in y)d=y[p],"children"==p?h=d:"dangerouslySetInnerHTML"==p?l=d:"value"==p?f=d:"checked"==p?m=d:"key"===p||s&&"function"!=typeof d||v[p]===d||Kl(e,p,d,v[p],r);if(l)s||u&&(l.__html===u.__html||l.__html===e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(u&&(e.innerHTML=""),Gl(e,Ml(h)?h:[h],t,n,i,"foreignObject"===g?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Fl(n,0),s,c),null!=o)for(p=o.length;p--;)null!=o[p]&&Nl(o[p]);s||(p="value",void 0!==f&&(f!==e[p]||"progress"===g&&!f||"option"===g&&f!==v[p])&&Kl(e,p,f,v[p],r),p="checked",void 0!==m&&m!==e[p]&&Kl(e,p,m,v[p],r))}return e}function Ql(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){bl.__e(e,n)}}function eu(e,t,n){var i,r;if(bl.unmount&&bl.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||Ql(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){bl.__e(e,t)}i.base=i.__P=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&eu(i[r],t,n||"function"!=typeof e.type);n||null==e.__e||Nl(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function tu(e,t,n){return this.constructor(e,n)}function nu(e,t,n){var i,r,o,a;bl.__&&bl.__(e,t),r=(i="function"==typeof n)?null:n&&n.__k||t.__k,o=[],a=[],Xl(t,e=(!i&&n||t).__k=Ol(Ll,null,[e]),r||Rl,Rl,t.namespaceURI,!i&&n?[n]:r?null:t.firstChild?gl.call(t.childNodes):null,o,!i&&n?n:r?r.__e:t.firstChild,i,a),Zl(o,e,a)}gl=Dl.slice,bl={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(t){e=t}throw e}},xl=0,Il.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Bl({},this.state),"function"==typeof e&&(e=e(Bl({},n),this.props)),e&&Bl(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),zl(this))},Il.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),zl(this))},Il.prototype.render=Ll,_l=[],wl="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Sl=function(e,t){return e.__v.__b-t.__v.__b},Hl.__r=0,Cl=0,Al=Yl(!1),kl=Yl(!0);var iu,ru,ou,au,su=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],s=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];3===a?i[0]=s:4===a?i[1]=Object.assign(i[1]||{},s):5===a?(i[1]=i[1]||{})[t[++o]]=s:6===a?i[1][t[++o]]+=s+"":a?(r=e.apply(s,su(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},cu=new Map,pu=function(e){var t=cu.get(this);return t||(t=new Map,cu.set(this,t)),(t=su(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,i=1,r="",o="",a=[0],s=function(e){1===i&&(e||(r=r.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?a.push(0,e,r):3===i&&(e||r)?(a.push(3,e,r),i=2):2===i&&"..."===r&&e?a.push(4,e,0):2===i&&r&&!e?a.push(5,0,!0,r):i>=5&&((r||!e&&5===i)&&(a.push(i,0,r,n),i=6),e&&(a.push(i,e,0,n),i=6)),r=""},c=0;c<e.length;c++){c&&(1===i&&s(),s(c));for(var p=0;p<e[c].length;p++)t=e[c][p],1===i?"<"===t?(s(),a=[a],i=3):r+=t:4===i?"--"===r&&">"===t?(i=1,r=""):r=t+r[0]:o?t===o?o="":r+=t:'"'===t||"'"===t?o=t:">"===t?(s(),i=1):i&&("="===t?(i=5,n=r,r=""):"/"===t&&(i<5||">"===e[c][p+1])?(s(),3===i&&(a=a[0]),i=a,(a=a[0]).push(2,0,i),i=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(s(),i=2):r+=t),3===i&&"!--"===r&&(i=4,a=a[0])}return s(),a}(e)),t),arguments,[])).length>1?t:t[0]},lu=pu.bind(Ol),uu=0,hu=[],du=[],fu=bl,mu=fu.__b,vu=fu.__r,yu=fu.diffed,gu=fu.__c,bu=fu.unmount,xu=fu.__;function _u(e,t){fu.__h&&fu.__h(ru,e,uu||t),uu=0;var n=ru.__H||(ru.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:du}),n.__[e]}function Eu(e){return uu=1,wu(Ou,e)}function wu(e,t,n){var i=_u(iu++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):Ou(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=ru,!ru.u)){var r=function(e,t,n){if(!i.__c.__H)return!0;var r=i.__c.__H.__.filter((function(e){return!!e.__c}));if(r.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var a=!1;return r.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}})),!(!a&&i.__c.props===e)&&(!o||o.call(this,e,t,n))};ru.u=!0;var o=ru.shouldComponentUpdate,a=ru.componentWillUpdate;ru.componentWillUpdate=function(e,t,n){if(this.__e){var i=o;o=void 0,r(e,t,n),o=i}a&&a.call(this,e,t,n)},ru.shouldComponentUpdate=r}return i.__N||i.__}function Su(e,t){var n=_u(iu++,3);!fu.__s&&Nu(n.__H,t)&&(n.__=e,n.i=t,ru.__H.__h.push(n))}function Cu(e,t){var n=_u(iu++,4);!fu.__s&&Nu(n.__H,t)&&(n.__=e,n.i=t,ru.__h.push(n))}function Au(e){return uu=5,ku((function(){return{current:e}}),[])}function ku(e,t){var n=_u(iu++,7);return Nu(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Tu(e,t){return uu=8,ku((function(){return e}),t)}function Ru(){for(var e;e=hu.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Mu),e.__H.__h.forEach(Bu),e.__H.__h=[]}catch(t){e.__H.__h=[],fu.__e(t,e.__v)}}fu.__b=function(e){ru=null,mu&&mu(e)},fu.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),xu&&xu(e,t)},fu.__r=function(e){vu&&vu(e),iu=0;var t=(ru=e.__c).__H;t&&(ou===ru?(t.__h=[],ru.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=du,e.__N=e.i=void 0}))):(t.__h.forEach(Mu),t.__h.forEach(Bu),t.__h=[],iu=0)),ou=ru},fu.diffed=function(e){yu&&yu(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==hu.push(t)&&au===fu.requestAnimationFrame||((au=fu.requestAnimationFrame)||Pu)(Ru)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==du&&(e.__=e.__V),e.i=void 0,e.__V=du}))),ou=ru=null},fu.__c=function(e,t){t.some((function(e){try{e.__h.forEach(Mu),e.__h=e.__h.filter((function(e){return!e.__||Bu(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],fu.__e(n,e.__v)}})),gu&&gu(e,t)},fu.unmount=function(e){bu&&bu(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{Mu(e)}catch(e){t=e}})),n.__H=void 0,t&&fu.__e(t,n.__v))};var Du="function"==typeof requestAnimationFrame;function Pu(e){var t,n=function(){clearTimeout(i),Du&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);Du&&(t=requestAnimationFrame(n))}function Mu(e){var t=ru,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),ru=t}function Bu(e){var t=ru;e.__c=e.__(),ru=t}function Nu(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Ou(e,t){return"function"==typeof t?t(e):t}function ju(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=ju(e[t]))&&(i&&(i+=" "),i+=n);else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function Lu(){for(var e,t,n=0,i="";n<arguments.length;)(e=arguments[n++])&&(t=ju(e))&&(i&&(i+=" "),i+=t);return i}var Iu=Lu;function Fu(e){const{entry:t,selected:n,onMouseEnter:i,onMouseLeave:r,onAction:o}=e;return lu`
    <li
      class=${Iu("entry",{selected:n})}
      data-id=${t.id}
      title=${t.title||t.label}
      onClick=${o}
      onMouseEnter=${i}
      onMouseLeave=${r}
      onDragStart=${e=>o(e,t,"dragstart")}
      draggable=${!0}
    >
      <div class="djs-popup-entry-content">
        <span
          class=${Iu("djs-popup-entry-name",t.className)}
        >
          ${t.imageUrl?lu`
            <img class="djs-popup-entry-icon" src=${t.imageUrl} alt="" />
          `:null}

          ${t.label?lu`
            <span class="djs-popup-label">
              ${t.label}
            </span>
          `:null}
        </span>
        ${t.description&&lu`
          <span
            class="djs-popup-entry-description"
            title=${t.description}
          >
            ${t.description}
          </span>
        `}
      </div>
      ${t.documentationRef&&lu`
        <div class="djs-popup-entry-docs">
          <a
            href="${t.documentationRef}"
            onClick=${e=>e.stopPropagation()}
            title="Open element documentation"
            target="_blank"
            rel="noopener"
          >
            <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
              <path fill-rule="evenodd" clip-rule="evenodd" d="M10.6368 10.6375V5.91761H11.9995V10.6382C11.9995 10.9973 11.8623 11.3141 11.5878 11.5885C11.3134 11.863 10.9966 12.0002 10.6375 12.0002H1.36266C0.982345 12.0002 0.660159 11.8681 0.396102 11.6041C0.132044 11.34 1.52588e-05 11.0178 1.52588e-05 10.6375V1.36267C1.52588e-05 0.98236 0.132044 0.660173 0.396102 0.396116C0.660159 0.132058 0.982345 2.95639e-05 1.36266 2.95639e-05H5.91624V1.36267H1.36266V10.6375H10.6368ZM12 0H7.2794L7.27873 1.36197H9.68701L3.06507 7.98391L4.01541 8.93425L10.6373 2.31231V4.72059H12V0Z" fill="#818798"/>
            </svg>
          </a>
        </div>
      `}
    </li>
  `}function $u(e){const{selectedEntry:t,setSelectedEntry:n,entries:i,...r}=e,o=Au(),a=ku(()=>zu(i),[i]);return Cu(()=>{const e=o.current;if(!e)return;const t=e.querySelector(".selected");t&&Hu(t)},[t]),lu`
    <div class="djs-popup-results" ref=${o}>
      ${a.map(e=>lu`
        ${e.name&&lu`
          <div key=${e.id} class="entry-header" title=${e.name}>
            ${e.name}
          </div>
        `}
        <ul class="djs-popup-group" data-group=${e.id}>
          ${e.entries.map(e=>lu`
            <${Fu}
              key=${e.id}
              entry=${e}
              selected=${e===t}
              onMouseEnter=${()=>n(e)}
              onMouseLeave=${()=>n(null)}
              ...${r}
            />
          `)}
        </ul>
      `)}
    </div>
  `}function zu(e){const t=[],n=e=>t.find(t=>e.id===t.id),i=e=>!!n(e),r=e=>"string"===typeof e?{id:e}:e;return e.forEach(e=>{const o=e.group?r(e.group):{id:"default"};i(o)?n(o).entries.push(e):t.push({...o,entries:[e]})}),t}function Hu(e){"function"===typeof e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}function Gu(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:p,entries:l,onOpened:u,onClosed:d}=e,f=ku(()=>!!h(p)&&l.length>5,[p,l]),m=Au(),[v,y]=Eu(""),g=Tu((e,t)=>{if(!f)return e;const n=e=>{if(!t)return(e.rank||0)>=0;const n=[e.description||"",e.label||"",e.search||""].join("---").toLowerCase();return t.toLowerCase().split(/\s/g).every(e=>n.includes(e))};return e.filter(n)},[f]),[b,x]=Eu(g(l,v)),[_,E]=Eu(b[0]),w=Tu(e=>{_&&e.includes(_)||E(e[0]),x(e)},[_,x,E]);Su(()=>{w(g(l,v))},[v,l]),Su(()=>{const e=e=>{if("Escape"===e.key)return e.preventDefault(),t()};return document.documentElement.addEventListener("keydown",e),()=>{document.documentElement.removeEventListener("keydown",e)}},[]),Cu(()=>{m.current&&m.current.focus()},[]);const S=Tu(e=>{const t=b.indexOf(_);let n=t+e;n<0&&(n=b.length-1),n>=b.length&&(n=0),E(b[n])},[b,_,E]),C=Tu(e=>"Enter"===e.key&&_?n(e,_):"ArrowUp"===e.key||"Tab"===e.key&&e.shiftKey?(S(-1),e.preventDefault()):"ArrowDown"===e.key||"Tab"===e.key?(S(1),e.preventDefault()):void 0,[n,t,_,S]),A=Tu(e=>{Te(e.target,"input")&&y(()=>e.target.value)},[y]);Su(()=>(u(),()=>{d()}),[]);const k=ku(()=>a||r.length>0,[a,r]);return lu`
    <${Vu}
      onClose=${t}
      onKeyup=${A}
      onKeydown=${C}
      className=${i}
      position=${o}
      width=${s}
      scale=${c}
    >
      ${k&&lu`
        <div class="djs-popup-header">
          <h3 class="djs-popup-title" title=${a}>${a}</h3>
          ${r.map(e=>lu`
            <span
              class=${Uu(e,e===_)}
              onClick=${t=>n(t,e)}
              title=${e.title||e.label}
              data-id=${e.id}
              onMouseEnter=${()=>E(e)}
              onMouseLeave=${()=>E(null)}
            >
              ${e.imageUrl?lu`
                <img class="djs-popup-entry-icon" src=${e.imageUrl} alt="" />
              `:null}

              ${e.label?lu`
                <span class="djs-popup-label">${e.label}</span>
              `:null}
            </span>
          `)}
        </div>
      `}
      ${l.length>0&&lu`
        <div class="djs-popup-body">

          ${f&&lu`
          <div class="djs-popup-search">
            <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
              <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
            </svg>
            <input
                ref=${m}
                type="text"
              />
          </div>
          `}

          <${$u}
            entries=${b}
            selectedEntry=${_}
            setSelectedEntry=${E}
            onAction=${n}
          />
        </div>
        ${0===b.length&&lu`
          <div class="djs-popup-no-results">No matching entries found.</div>
        `}
      `}
    </${Vu}>
  `}function Vu(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,position:a}=e,s=Au(),c=Tu(e=>{const n=pe(e.target,".djs-popup",!0);n||t()},[t]);return Cu(()=>{if("function"!==typeof a)return;const e=s.current,t=a(e);e.style.left=t.x+"px",e.style.top=t.y+"px"},[s.current,a]),Cu(()=>{s.current&&s.current.focus()},[]),lu`
    <div
      class="djs-popup-backdrop"
      onClick=${c}
    >
      <div
        class=${Iu("djs-popup",r)}
        style=${Wu(e)}
        onKeydown=${n}
        onKeyup=${i}
        ref=${s}
        tabIndex="-1"
      >
        ${o}
      </div>
    </div>
  `}function Wu(e){return{transform:`scale(${e.scale})`,width:e.width+"px"}}function Uu(e,t){return Iu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}var qu="data-id",Ku=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],Yu=1e3;function Xu(e,t,n){this._eventBus=t,this._canvas=n,this._current=null;var i=h(e&&e.scale)?e.scale:{min:1,max:1.5};this._config={scale:i},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",e=>{const t=this.isOpen()&&this._current.element;e.element===t&&this._render()})}Xu.$inject=["config.popupMenu","eventBus","canvas"],Xu.prototype._render=function(){const{position:e,className:t,entries:n,headerEntries:i,options:r}=this._current,o=Object.entries(n).map(([e,t])=>({id:e,...t})),a=Object.entries(i).map(([e,t])=>({id:e,...t})),s=e&&(t=>this._ensureVisible(t,e)),c=this._updateScale(this._current.container),p=e=>this.close(e),l=(e,t,n)=>this.trigger(e,t,n);nu(lu`
      <${Gu}
        onClose=${p}
        onSelect=${l}
        position=${s}
        className=${t}
        entries=${o}
        headerEntries=${a}
        scale=${c}
        onOpened=${this._onOpened.bind(this)}
        onClosed=${this._onClosed.bind(this)}
        ...${{...r}}
      />
    `,this._current.container)},Xu.prototype.open=function(e,t,n,i){if(!e)throw new Error("Element is missing");if(!t)throw new Error("No registered providers for: "+t);if(!n)throw new Error("the position argument is missing");this.isOpen()&&this.close();const{entries:r,headerEntries:o}=this._getContext(e,t);this._current={position:n,className:t,element:e,entries:r,headerEntries:o,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Xu.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("No registered providers for: "+t);const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n);return{entries:i,headerEntries:r,empty:!(Object.keys(i).length||Object.keys(r).length)}},Xu.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._current=null)},Xu.prototype.reset=function(){const e=this._current.container;nu(null,e),Pe(e)},Xu.prototype._emit=function(e,t){this._eventBus.fire("popupMenu."+e,t)},Xu.prototype._onOpened=function(){this._emit("opened")},Xu.prototype._onClosed=function(){this._emit("closed")},Xu.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=ke(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Xu.prototype._bindAutoClose=function(){this._eventBus.once(Ku,this.close,this)},Xu.prototype._unbindAutoClose=function(){this._eventBus.off(Ku,this.close,this)},Xu.prototype._updateScale=function(e){var t,n,i=this._canvas.zoom(),r=this._config.scale,o=i;return!0!==r&&(!1===r?(t=1,n=1):(t=r.min,n=r.max),h(t)&&i<t&&(o=t),h(n)&&i>n&&(o=n)),o},Xu.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,a=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,a=t.y-i.height):r.x?(o=t.x-i.width,a=t.y):r.y&&t.y<i.height?(o=t.x,a=10):r.y&&(o=t.x,a=t.y-i.height),{x:o,y:a}},Xu.prototype.isEmpty=function(e,t){if(!e)throw new Error("element parameter is missing");if(!t)throw new Error("providerId parameter is missing");const n=this._getProviders(t);return!n||!n.length||this._getContext(e,t).empty},Xu.prototype.registerProvider=function(e,t,n){n||(n=t,t=Yu),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},Xu.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Xu.prototype._getEntries=function(e,t){var n={};return S(t,(function(t){if(t.getPopupMenuEntries){var i=t.getPopupMenuEntries(e);y(i)?n=i(n):S(i,(function(e,t){n[t]=e}))}else S(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("every entry must have the id property set");n[t]=q(e,["id"])}))})),n},Xu.prototype._getHeaderEntries=function(e,t){var n={};return S(t,(function(t){if(t.getPopupMenuHeaderEntries){var i=t.getPopupMenuHeaderEntries(e);y(i)?n=i(n):S(i,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;S(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("every entry must have the id property set");n[t]=q(e,["id"])}))}})),n},Xu.prototype.isOpen=function(){return!!this._current},Xu.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=pe(e.delegateTarget||e.target,".entry",!0),i=re(n,qu);t=this._getEntry(i)}const i=t.action;if(!1!==this._emit("trigger",{entry:t,event:e}))if(y(i)){if("click"===n)return i(e,t)}else if(i[n])return i[n](e,t)},Xu.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};var Zu={__init__:["popupMenu"],popupMenu:["type",Xu]},Ju={align:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%202000%202000%22%3E%3Cpath%20style%3D%22stroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linecap%3Around%22%20d%3D%22M200%20150v1700%22%2F%3E%3Crect%20x%3D%22500%22%20y%3D%22150%22%20width%3D%221300%22%20height%3D%22700%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%22500%22%20y%3D%221150%22%20width%3D%22700%22%20height%3D%22700%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E",bottom:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201800%201800%22%3E%3Cpath%20style%3D%22stroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linecap%3Around%22%20d%3D%22M150%201650h1500%22%2F%3E%3Crect%20x%3D%22150%22%20y%3D%22350%22%20width%3D%22600%22%20height%3D%221300%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%221050%22%20y%3D%22850%22%20width%3D%22600%22%20height%3D%22800%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E",center:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201800%201800%22%3E%3Cpath%20style%3D%22stroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linecap%3Around%22%20d%3D%22M900%20150v1500%22%2F%3E%3Crect%20x%3D%22250%22%20y%3D%22150%22%20width%3D%221300%22%20height%3D%22600%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%22500%22%20y%3D%221050%22%20width%3D%22800%22%20height%3D%22600%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E",left:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201800%201800%22%3E%3Cpath%20style%3D%22stroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linecap%3Around%22%20d%3D%22M100%20150v1500%22%2F%3E%3Crect%20x%3D%22100%22%20y%3D%22150%22%20width%3D%221300%22%20height%3D%22600%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%22100%22%20y%3D%221050%22%20width%3D%22800%22%20height%3D%22600%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E",right:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201800%201800%22%3E%3Cpath%20style%3D%22stroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linecap%3Around%22%20d%3D%22M1650%20150v1500%22%2F%3E%3Crect%20x%3D%22350%22%20y%3D%22150%22%20width%3D%221300%22%20height%3D%22600%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%22850%22%20y%3D%221050%22%20width%3D%22800%22%20height%3D%22600%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E",top:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201800%201800%22%3E%3Cpath%20style%3D%22stroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linecap%3Around%22%20d%3D%22M150%20150h1500%22%2F%3E%3Crect%20x%3D%22150%22%20y%3D%22150%22%20width%3D%22600%22%20height%3D%221300%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%221050%22%20y%3D%22150%22%20width%3D%22600%22%20height%3D%22800%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E",middle:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201800%201800%22%3E%3Cpath%20style%3D%22stroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linecap%3Around%22%20d%3D%22M150%20900h1500%22%2F%3E%3Crect%20x%3D%22150%22%20y%3D%22250%22%20width%3D%22600%22%20height%3D%221300%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%221050%22%20y%3D%22500%22%20width%3D%22600%22%20height%3D%22800%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E"},Qu=Ju,eh=900;function th(e,t,n,i){e.registerProvider(eh,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}th.$inject=["contextPad","popupMenu","translate","canvas"],th.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},th.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},th.prototype._getEntries=function(e){var t=this;return{"align-elements":{group:"align-elements",title:t._translate("Align elements"),imageUrl:Qu["align"],action:{click:function(e,n){var i=t._getMenuPosition(n);V(i,{cursor:{x:e.x,y:e.y}}),t._popupMenu.open(n,"align-elements",i)}}}}},th.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var nh=["left","center","right","top","middle","bottom"];function ih(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}function rh(e){Sc.call(this,e),this.init()}function oh(e){rh.call(this,e)}ih.$inject=["popupMenu","alignElements","translate","rules"],ih.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},ih.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},ih.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return S(nh,(function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageUrl:Qu[o],action:function(n,r){t.trigger(e,o),i.close()}}})),r},rh.$inject=["eventBus"],i(rh,Sc),rh.prototype.addRule=function(e,t,n){var i=this;"string"===typeof e&&(e=[e]),e.forEach((function(e){i.canExecute(e,t,(function(e,t,i){return n(e)}),!0)}))},rh.prototype.init=function(){},oh.$inject=["eventBus"],i(oh,rh),oh.prototype.init=function(){this.addRule("elements.align",(function(e){var t=e.elements,n=w(t,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));return n=It(n),!(n.length<2)&&n}))};var ah={__depends__:[ul,Tl,Zu],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",th],alignElementsMenuProvider:["type",ih],bpmnAlignElements:["type",oh]},sh=10,ch=50,ph=250;function lh(e,t,n,i){var r;while(r=hh(e,n,t))n=i(t,n,r);return n}function uh(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach((function(o){var a=e[o];if(a){var s="x"===o?"width":"height",c=a.margin,p=a.minDistance;r[o]=c<0?Math.min(i[o]+c-t[s]/2,n[o]-p+c):Math.max(i[o]+i[s]+c+t[s]/2,n[o]+p+c)}})),r}}function hh(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=fh(e,n);return _(r,(function(e){if(e===n)return!1;var t=xn(e,i,sh);return"intersect"===t}))}function dh(e,t){function n(t){return t.source===e?1:-1}t||(t={});var i=t.defaultDistance||ch,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||ph,c=t.reference||"start";function p(e,t){return"n"===r?"start"===c?mn(e).top-mn(t).bottom:"center"===c?mn(e).top-bn(t).y:mn(e).top-mn(t).top:"w"===r?"start"===c?mn(e).left-mn(t).right:"center"===c?mn(e).left-bn(t).x:mn(e).left-mn(t).left:"s"===r?"start"===c?mn(t).top-mn(e).bottom:"center"===c?bn(t).y-mn(e).bottom:mn(t).bottom-mn(e).bottom:"start"===c?mn(t).left-mn(e).right:"center"===c?bn(t).x-mn(e).right:mn(t).right-mn(e).right}o||(o=gh);var l=e.incoming.filter(o).map((function(t){var n=a(t),i=n<0?p(t.source,e):p(e,t.source);return{id:t.source.id,distance:i,weight:n}})),u=e.outgoing.filter(o).map((function(t){var n=a(t),i=n>0?p(e,t.target):p(t.target,e);return{id:t.target.id,distance:i,weight:n}})),h=l.concat(u).reduce((function(e,t){return e[t.id+"__weight_"+t.weight]=t,e}),{}),d=A(h,(function(e,t){var n=t.distance,i=t.weight;return n<0||n>s||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*i,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{});return d.distance||i}function fh(e){var t=mh(e);return e.host&&(t=t.concat(mh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(mh(t))}),[]))),t}function mh(e){return yh(e).concat(vh(e))}function vh(e){return e.incoming.map((function(e){return e.source}))}function yh(e){return e.outgoing.map((function(e){return e.target}))}function gh(){return!0}var bh=100;function xh(e,t,n){e.on("autoPlace",bh,(function(e){var t=e.shape,n=e.source;return _h(n,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,i,r){e.fire("autoPlace.start",{source:n,shape:i});var o=e.fire("autoPlace",{source:n,shape:i}),a=t.appendShape(n,i,o,n.parent,r);return e.fire("autoPlace.end",{source:n,shape:a}),a}}function _h(e,t,n){n||(n={});var i=n.defaultDistance||ch,r=bn(e),o=mn(e);return{x:o.right+i+t.width/2,y:r.y}}function Eh(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}xh.$inject=["eventBus","modeling","canvas"],Eh.$inject=["eventBus","selection"];var wh={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",xh],autoPlaceSelectionBehavior:["type",Eh]};function Sh(e,t){return Ko(t,"bpmn:TextAnnotation")?kh(e,t):Yo(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?Th(e,t):Ko(t,"bpmn:FlowNode")?Ch(e,t):void 0}function Ch(e,t){var n=mn(e),i=bn(e),r=dh(e,{filter:function(e){return Ko(e,"bpmn:SequenceFlow")}}),o=30,a=80,s="left";Ko(e,"bpmn:BoundaryEvent")&&(s=xn(e,e.host,-25),-1!==s.indexOf("top")&&(o*=-1));var c={x:n.right+r+t.width/2,y:i.y+Ah(s,a)},p={y:{margin:o,minDistance:a}};return lh(e,t,c,uh(p))}function Ah(e,t){return-1!=e.indexOf("top")?-1*t:-1!=e.indexOf("bottom")?t:0}function kh(e,t){var n=mn(e),i={x:n.right+t.width/2,y:n.top-50-t.height/2};Rh(e)&&(i=bn(e),i.x+=100,i.y-=50);var r={y:{margin:-30,minDistance:20}};return lh(e,t,i,uh(r))}function Th(e,t){var n=mn(e),i={x:n.right-10+t.width/2,y:n.bottom+40+t.width/2},r={x:{margin:30,minDistance:30}};return lh(e,t,i,uh(r))}function Rh(e){return!!e.waypoints}function Dh(e){e.on("autoPlace",(function(e){var t=e.shape,n=e.source;return Sh(n,t)}))}Dh.$inject=["eventBus"];var Ph={__depends__:[wh],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Dh]};function Mh(e,t,n,i){Sc.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],(function(e){var t=e.context,n=t.hints||{},i=t.shape,o=t.parent||t.newParent;!1!==n.autoResize&&r._expand([i],o)})),this.postExecuted(["elements.move"],(function(e){var t=e.context,n=c(M(t.closure.topLevel)),i=t.hints,o=!i||i.autoResize;if(!1!==o){var a=B(n,(function(e){return e.parent.id}));S(a,(function(e,t){f(o)&&(e=e.filter((function(e){return _(o,L({id:e.id}))}))),r._expand(e,t)}))}})),this.postExecuted(["shape.toggleCollapse"],(function(e){var t=e.context,n=t.hints,i=t.shape;n&&!1===n.autoResize||i.collapsed||r._expand(i.children||[],i)})),this.postExecuted(["shape.resize"],(function(e){var t=e.context,n=t.hints,i=t.shape,o=i.parent;n&&!1===n.autoResize||o&&r._expand([i],o)}))}function Bh(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Nh(e,t){var n="";return e=mn(e),t=mn(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Oh(e){e.invoke(Mh,this)}function jh(e){rh.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function Lh(e,t){jh.call(this,e),this._modeling=t}Mh.$inject=["eventBus","elementRegistry","modeling","rules"],i(Mh,Sc),Mh.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=mn(Wt(e)),o=mn(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),vn(V({},o,a))},Mh.prototype._expand=function(e,t){"string"===typeof t&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(Bh(i,t)){var r=Nh(U(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Mh.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Mh.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Mh.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},Oh.$inject=["injector"],i(Oh,Mh),Oh.prototype.resize=function(e,t,n){Ko(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},jh.$inject=["eventBus"],i(jh,rh),jh.prototype.canResize=function(e,t){return!1},i(Lh,jh),Lh.$inject=["eventBus","modeling"],Lh.prototype.canResize=function(e,t){if(Ko(t.di,"bpmndi:BPMNPlane"))return!1;if(!Ko(t,"bpmn:Participant")&&!Ko(t,"bpmn:Lane")&&!Ko(t,"bpmn:SubProcess"))return!1;var n=!0;return S(e,(function(e){(Ko(e,"bpmn:Lane")||e.labelTarget)&&(n=!1)})),n};var Ih={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Oh],bpmnAutoResizeProvider:["type",Lh]},Fh=1500;function $h(e,t,n){var i=this,r=n.get("dragging",!1);function o(t){if(!t.hover){var n=t.originalEvent,o=i._findTargetGfx(n),a=o&&e.get(o);o&&a&&(t.stopPropagation(),r.hover({element:a,gfx:o}),r.move(n))}}r&&t.on("drag.start",(function(e){t.once("drag.move",Fh,(function(e){o(e)}))})),function(){var e,n;t.on("element.hover",(function(t){e=t.gfx,n=t.element})),t.on("element.hover",Fh,(function(i){n&&t.fire("element.out",{element:n,gfx:e})})),t.on("element.out",(function(){e=null,n=null}))}(),this._findTargetGfx=function(e){var t,n;if(e instanceof MouseEvent)return t=Hs(e),n=document.elementFromPoint(t.x,t.y),zh(n)}}function zh(e){return pe(e,"svg, .djs-element",!0)}$h.$inject=["elementRegistry","eventBus","injector"];var Hh={__init__:["hoverFix"],hoverFix:["type",$h]},Gh=Math.round,Vh="djs-drag-active";function Wh(e){e.preventDefault()}function Uh(e){return"undefined"!==typeof TouchEvent&&e instanceof TouchEvent}function qh(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Kh(e,t,n,i){var r,o={threshold:5,trapClick:!0};function a(e){var n=t.viewbox(),i=t._container.getBoundingClientRect();return{x:n.x+(e.x-i.left)/n.scale,y:n.y+(e.y-i.top)/n.scale}}function s(t,n){n=n||r;var i=e.createEvent(V({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,i)&&e.fire(n.prefix+"."+t,i)}function c(e){var t=e.filter((function(e){return i.get(e.id)}));t.length&&n.select(t)}function p(e,i){var o=r.payload,c=r.displacement,p=r.globalStart,l=Hs(e),u=Pp(l,p),h=r.localStart,d=a(l),f=Pp(d,h);if(!r.active&&(i||qh(u)>r.threshold)){if(V(o,{x:Gh(h.x+c.x),y:Gh(h.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===s("start"))return v();r.active=!0,r.keepSelection||(o.previousSelection=n.get(),n.select(null)),r.cursor&&Ap(r.cursor),t.addMarker(t.getRootElement(),Vh)}zs(e),r.active&&(V(o,{x:Gh(d.x+c.x),y:Gh(d.y+c.y),dx:Gh(f.x),dy:Gh(f.y)},{originalEvent:e}),s("move"))}function l(e){var t,n=!0;r.active&&(e&&(r.payload.originalEvent=e,zs(e)),n=s("end")),!1===n&&s("rejected"),t=y(!0!==n),s("ended",t)}function u(e){sp("Escape",e)&&(Wh(e),v())}function h(t){var n;r.active&&(n=Rp(e),setTimeout(n,400),Wh(t)),l(t)}function d(e){p(e)}function f(e){var t=r.payload;t.hoverGfx=e.gfx,t.hover=e.element,s("hover")}function m(e){s("out");var t=r.payload;t.hoverGfx=null,t.hover=null}function v(e){var t;if(r){var n=r.active;n&&s("cancel"),t=y(e),n&&s("canceled",t)}}function y(i){var o,a;s("cleanup"),kp(),a=r.trapClick?h:l,ye.unbind(document,"mousemove",p),ye.unbind(document,"dragstart",Wh),ye.unbind(document,"selectstart",Wh),ye.unbind(document,"mousedown",a,!0),ye.unbind(document,"mouseup",a,!0),ye.unbind(document,"keyup",u),ye.unbind(document,"touchstart",d,!0),ye.unbind(document,"touchcancel",v,!0),ye.unbind(document,"touchmove",p,!0),ye.unbind(document,"touchend",l,!0),e.off("element.hover",f),e.off("element.out",m),t.removeMarker(t.getRootElement(),Vh);var y=r.payload.previousSelection;return!1!==i&&y&&!n.get().length&&c(y),o=r,r=null,o}function g(t,n,i,c){r&&v(!1),"string"===typeof n&&(c=i,i=n,n=null),c=V({},o,c||{});var y,g,b,x,_,E=c.data||{};x=c.trapClick?h:l,t?(y=$s(t)||t,g=Hs(t),zs(t),"dragstart"===y.type&&Wh(y)):(y=null,g={x:0,y:0}),b=a(g),n||(n=b),_=Uh(y),r=V({prefix:i,data:E,payload:{},globalStart:g,displacement:Pp(n,b),localStart:b,isTouch:_},c),c.manual||(_?(ye.bind(document,"touchstart",d,!0),ye.bind(document,"touchcancel",v,!0),ye.bind(document,"touchmove",p,!0),ye.bind(document,"touchend",l,!0)):(ye.bind(document,"mousemove",p),ye.bind(document,"dragstart",Wh),ye.bind(document,"selectstart",Wh),ye.bind(document,"mousedown",x,!0),ye.bind(document,"mouseup",x,!0)),ye.bind(document,"keyup",u),e.on("element.hover",f),e.on("element.out",m)),s("init"),c.autoActivate&&p(t,!0)}e.on("diagram.destroy",v),this.init=g,this.move=p,this.hover=f,this.out=m,this.end=l,this.cancel=v,this.context=function(){return r},this.setOptions=function(e){V(o,e)}}Kh.$inject=["eventBus","canvas","selection","elementRegistry"];var Yh={__depends__:[Hh,uc],dragging:["type",Kh]};function Xh(e,t,n){this._canvas=n,this._opts=V({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",(function(e){var t=i._toBorderPoint(e);i.startScroll(t)})),t.on(["drag.cleanup"],(function(){i.stopScroll()}))}function Zh(e,t,n){return t<e&&e<n}Xh.$inject=["config.autoScroll","eventBus","canvas"],Xh.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)Zh(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(0===c?a=n.scrollStep:1==c?s=n.scrollStep:2==c?a=-n.scrollStep:3==c&&(s=-n.scrollStep));0===a&&0===s||(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout((function(){i.startScroll(e)}),n.scrollRepeatTimeout))},Xh.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Xh.prototype.setOptions=function(e){this._opts=V({},this._opts,e)},Xh.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Hs(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Jh={__depends__:[Yh],__init__:["autoScroll"],autoScroll:["type",Xh]};function Qh(e){this._commandStack=e.get("commandStack",!1)}Qh.$inject=["injector"],Qh.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var ed={__init__:["rules"],rules:["type",Qh]},td=Math.round,nd=Math.max;function id(e,t){var n=e.x,i=e.y;return[["M",n,i],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function rd(e){var t=[];return e.forEach((function(e,n){t.push([0===n?"M":"L",e.x,e.y])})),t}var od=10;function ad(e,t){var n,i;for(n=0;i=e[n];n++)if(rn(i,t)<=od)return{point:e[n],bendpoint:!0,index:n};return null}function sd(e,t){var n,i=hn()(id(t,od),rd(e)),r=i[0],o=i[i.length-1];return r?r!==o?r.segment2!==o.segment2?(n=nd(r.segment2,o.segment2)-1,{point:e[n],bendpoint:!0,index:n}):{point:{x:td(r.x+o.x)/2,y:td(r.y+o.y)/2},index:r.segment2}:{point:{x:td(r.x),y:td(r.y)},index:r.segment2}:null}function cd(e,t){return ad(e,t)||sd(e,t)}function pd(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ld(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function ud(e,t){return t?{x:Math.cos(t)*e.x-Math.sin(t)*e.y,y:Math.sin(t)*e.x+Math.cos(t)*e.y}:e}function hd(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],r=i[0].n*t[0]+i[1].n*t[1],o=i[0].lambda*t[0]+i[1].lambda*t[1];return-r/o}function dd(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=hd([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function fd(e,t){var n=dd(e,t),i={x:n.x-e.x,y:n.y-e.y};return pd(i)}function md(e,t){return pd({x:e.x-t.x,y:e.y-t.y})}var vd="djs-bendpoint",yd="djs-segment-dragger";function gd(e,t){var n,i=Hs(t),r=e._container.getBoundingClientRect();n={x:r.left,y:r.top};var o=e.viewbox();return{x:o.x+(i.x-n.x)/o.scale,y:o.y+(i.y-n.y)/o.scale}}function bd(e,t,n){var i=gd(e,n),r=cd(t,i);return r}function xd(e,t){var n=Xe("g");He(n).add(vd),Ne(e,n);var i=Xe("circle");$e(i,{cx:0,cy:0,r:4}),He(i).add("djs-visual"),Ne(n,i);var r=Xe("circle");return $e(r,{cx:0,cy:0,r:10}),He(r).add("djs-hit"),Ne(n,r),t&&He(n).add(t),n}function _d(e,t,n,i){var r=Xe("g");Ne(e,r);var o=18,a=6,s=11,c=Cd(t,n,i),p=a+s,l=Xe("rect");$e(l,{x:-o/2,y:-a/2,width:o,height:a}),He(l).add("djs-visual"),Ne(r,l);var u=Xe("rect");return $e(u,{x:-c/2,y:-p/2,width:c,height:p}),He(u).add("djs-hit"),Ne(r,u),li(r,"v"===i?90:0,0,0),r}function Ed(e,t,n){var i=Xe("g"),r=ln(t,n),o=sn(t,n);return Ne(e,i),_d(i,t,n,o),He(i).add(yd),He(i).add("h"===o?"horizontal":"vertical"),pi(i,r.x,r.y),i}function wd(e){return Math.abs(Math.round(2*e/3))}function Sd(e,t){var n=Ad(e,t);return dd(e,n)}function Cd(e,t,n){var i=t.x-e.x,r=t.y-e.y;return wd("h"===n?i:r)}function Ad(e,t){for(var n,i=t.waypoints,r=1/0,o=0;o<i.length-1;o++){var a=i[o],s=i[o+1],c=fd(e,[a,s]);c<r&&(r=c,n=o)}return[i[n],i[n+1]]}function kd(e,t,n,i,r){function o(e,t,n){var i,r,o,a,s,c,p=e.index,l=e.point;return!(p<=0||e.bendpoint)&&(i=t[p-1],r=t[p],o=ln(i,r),a=sn(i,r),s=Math.abs(l.x-o.x),c=Math.abs(l.y-o.y),a&&s<=n&&c<=n)}function a(e,t){var n,i,r,o,a=e.waypoints;return t.index<=0||t.bendpoint?null:(n={start:a[t.index-1],end:a[t.index]},i=sn(n.start,n.end),i?(r="h"===i?n.end.x-n.start.x:n.end.y-n.start.y,o=wd(r)/2,o):null)}function s(e,n){var s,c=n.waypoints,p=bd(t,c,e);if(p)return s=a(n,p),o(p,c,s)?r.start(e,n,p.index):i.start(e,n,p.index,!p.bendpoint),!0}function c(e,t,i){ye.bind(e,t,(function(e){n.triggerMouseEvent(t,e,i),e.stopPropagation()}))}function p(e,n){var i=t.getLayer("overlays"),r=Re('.djs-bendpoints[data-element-id="'+Rc(e.id)+'"]',i);return!r&&n&&(r=Xe("g"),$e(r,{"data-element-id":e.id}),He(r).add("djs-bendpoints"),Ne(i,r),c(r,"mousedown",e),c(r,"click",e),c(r,"dblclick",e)),r}function l(e,t){return Re('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function u(e,t){t.waypoints.forEach((function(t,n){var i=xd(e);Ne(e,i),pi(i,t.x,t.y)})),xd(e,"floating")}function h(e,t){for(var n,i,r,o=t.waypoints,a=1;a<o.length;a++)n=o[a-1],i=o[a],sn(n,i)&&(r=Ed(e,n,i),$e(r,{"data-segment-idx":a}),c(r,"mousemove",t))}function d(e){S(De("."+vd,e),(function(e){ht(e)}))}function f(e){S(De("."+yd,e),(function(e){ht(e)}))}function m(e){var t=p(e);return t||(t=p(e,!0),u(t,e),h(t,e)),t}function v(e){var t=p(e);t&&(f(t),d(t),h(t,e),u(t,e))}function y(e,t){var n=Re(".floating",e),i=t.point;n&&pi(n,i.x,i.y)}function g(e,t,n){var i,r,o=l(t.index,e),a=n[t.index-1],s=n[t.index],c=t.point,p=ln(a,s),u=sn(a,s);o&&(i=Td(o),r={x:c.x-p.x,y:c.y-p.y},"v"===u&&(r={x:r.y,y:r.x}),pi(i,r.x,r.y))}e.on("connection.changed",(function(e){v(e.element)})),e.on("connection.remove",(function(e){var t=p(e.element);t&&ht(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=m(n),e.add?He(t).add(e.marker):He(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,i,r=e.element,o=r.waypoints;if(o){if(n=p(r,!0),i=bd(t,o,e.originalEvent),!i)return;y(n,i),i.bendpoint||g(n,i,o)}})),e.on("element.mousedown",(function(e){if(Ws(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return s(t,n)}})),e.on("selection.changed",(function(e){var t=e.newSelection,n=t[0];n&&n.waypoints&&m(n)})),e.on("element.hover",(function(e){var t=e.element;t.waypoints&&(m(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))})),e.on("element.out",(function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")})),e.on("element.updateId",(function(e){var t=e.element,n=e.newId;if(t.waypoints){var i=p(t);i&&$e(i,{"data-element-id":n})}})),this.addHandles=m,this.updateHandles=v,this.getBendpointsContainer=p,this.getSegmentDragger=l}function Td(e){return Re(".djs-visual",e)}kd.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Rd=Math.round,Dd="reconnectStart",Pd="reconnectEnd",Md="updateWaypoints";function Bd(e,t,n,i,r,o){this._injector=e,this.start=function(e,t,o,a){var s,c=n.getGraphics(t),p=t.source,l=t.target,u=t.waypoints;s=a||0!==o?a||o!==u.length-1?Md:Pd:Dd;var h=s===Md?"connection.updateWaypoints":"connection.reconnect",d=r.allowed(h,{connection:t,source:p,target:l});!1===d&&(d=r.allowed(h,{connection:t,source:l,target:p})),!1!==d&&i.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:c,context:{allowed:d,bendpointIndex:o,connection:t,source:p,target:l,insert:a,type:s}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,i=n.connection,o=i.source,a=i.target,s=e.hover,c=n.type;if(n.hover=s,s){var p=c===Md?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=r.allowed(p,{connection:i,source:c===Dd?s:o,target:c===Pd?s:a}),t)return n.source=c===Dd?s:o,void(n.target=c===Pd?s:a);!1===t&&(t=n.allowed=r.allowed(p,{connection:i,source:c===Pd?s:a,target:c===Dd?s:o})),t&&(n.source=c===Pd?s:a,n.target=c===Dd?s:o)}})),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],(function(e){var t=e.context,n=t.type;t.hover=null,t.source=null,t.target=null,n!==Md&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,i=t.bendpointIndex,r=t.connection,a=t.insert,s=r.waypoints.slice(),c=t.source,p=t.target,l=t.type,u=t.hints||{},h={x:Rd(e.x),y:Rd(e.y)};if(!n)return!1;l===Md?(a?s.splice(i,0,h):s[i]=h,u.bendpointMove={insert:a,bendpointIndex:i},s=this.cropWaypoints(r,s),o.updateWaypoints(r,wn(s),u)):(l===Dd?(u.docking="source",Nd(t)&&(u.docking="target",u.newWaypoints=s.reverse())):l===Pd&&(u.docking="target",Nd(t)&&(u.docking="source",u.newWaypoints=s.reverse())),o.reconnect(r,c,p,h,u))}),this)}function Nd(e){var t=e.hover,n=e.source,i=e.target,r=e.type;return r===Dd?t&&i&&t===i&&n!==i:r===Pd?t&&n&&t===n&&n!==i:void 0}Bd.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Bd.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};var Od="reconnectStart",jd="reconnectEnd",Ld="updateWaypoints",Id="connect-ok",Fd="connect-not-ok",$d="connect-hover",zd="djs-updating",Hd="djs-element-hidden",Gd=1100;function Vd(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,r=t.connection,o=t.insert,a=r.waypoints,s=a.slice();t.waypoints=a,o&&s.splice(n,0,{x:e.x,y:e.y}),r.waypoints=s;var c=t.draggerGfx=xd(i.getLayer("overlays"));He(c).add("djs-dragging"),i.addMarker(r,Hd),i.addMarker(r,zd)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,r=t.hover,o=t.type;if(r){if(i.addMarker(r,$d),o===Ld)return;n?(i.removeMarker(r,Fd),i.addMarker(r,Id)):!1===n&&(i.removeMarker(r,Id),i.addMarker(r,Fd))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],Gd,(function(e){var t=e.context,n=t.hover,r=t.target;n&&(i.removeMarker(n,$d),i.removeMarker(n,r?Id:Fd))})),n.on("bendpoint.move.move",(function(t){var n=t.context,i=n.allowed,o=n.bendpointIndex,a=n.draggerGfx,s=n.hover,c=n.type,p=n.connection,l=p.source,u=p.target,h=p.waypoints.slice(),d={x:t.x,y:t.y},f=n.hints||{},m={};r&&(f.connectionStart&&(m.connectionStart=f.connectionStart),f.connectionEnd&&(m.connectionEnd=f.connectionEnd),c===Od?Nd(n)?(m.connectionEnd=m.connectionEnd||d,m.source=u,m.target=s||l,h=h.reverse()):(m.connectionStart=m.connectionStart||d,m.source=s||l,m.target=u):c===jd?Nd(n)?(m.connectionStart=m.connectionStart||d,m.source=s||u,m.target=l,h=h.reverse()):(m.connectionEnd=m.connectionEnd||d,m.source=l,m.target=s||u):(m.noCropping=!0,m.noLayout=!0,h[o]=d),c===Ld&&(h=e.cropWaypoints(p,h)),m.waypoints=h,r.drawPreview(n,i,m)),pi(a,t.x,t.y)}),this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],Gd,(function(e){var t=e.context,n=t.connection,o=t.draggerGfx,a=t.hover,s=t.target,c=t.waypoints;n.waypoints=c,ht(o),i.removeMarker(n,zd),i.removeMarker(n,Hd),a&&(i.removeMarker(a,Id),i.removeMarker(a,s?Id:Fd)),r&&r.cleanUp(t)}))}Vd.$inject=["bendpointMove","injector","eventBus","canvas"];var Wd="connect-hover",Ud="djs-updating";function qd(e,t,n){return Kd(e,t,e[t]+n)}function Kd(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function Yd(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(o+a,e[i]),r-a);return Kd(t,i,s)}function Xd(e){return"x"===e?"y":"x"}function Zd(e,t,n){var i,r;return e.original?e.original:(i=bn(t),r=Xd(n),Kd(e,r,i[r]))}function Jd(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);function s(e,t){if(!a)return t;var n,i=e.waypoints;return e.waypoints=t,n=a.getCroppedWaypoints(e),e.waypoints=i,n}function c(e){r.update("connection",e.connection,e.connectionGfx)}function p(e,t,n){var i=e.newWaypoints,r=e.segmentStartIndex+t,o=i[r],a=e.segmentEndIndex+t,s=i[a],c=Xd(e.axis),p=Yd(n,o,s,c);pi(e.draggerGfx,p.x,p.y)}function l(e,t){var n=0,i=e.filter((function(i,r){return!on(e[r-1],e[r+1],i)||(n=r<=t?n-1:n,!1)}));return{waypoints:i,segmentOffset:n}}this.start=function(e,t,r){var o,a,s,c,p=n.getGraphics(t),l=r-1,u=r,h=t.waypoints,d=h[l],f=h[u],m=bd(n,h,e);a=sn(d,f),a&&(s="v"===a?"x":"y",0===l&&(d=Zd(d,t.source,s)),u===h.length-1&&(f=Zd(f,t.target,s)),c=m?m.point:{x:(d.x+f.x)/2,y:(d.y+f.y)/2},o={connection:t,segmentStartIndex:l,segmentEndIndex:u,segmentStart:d,segmentEnd:f,axis:s,dragPosition:c},i.init(e,c,"connectionSegment.move",{cursor:"x"===s?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:p,context:o}}))},t.on("connectionSegment.move.start",(function(e){var t=e.context,i=e.connection,r=n.getLayer("overlays");t.originalWaypoints=i.waypoints.slice(),t.draggerGfx=Ed(r,t.segmentStart,t.segmentEnd),He(t.draggerGfx).add("djs-dragging"),n.addMarker(i,Ud)})),t.on("connectionSegment.move.move",(function(e){var t,n,i=e.context,r=i.connection,o=i.segmentStartIndex,a=i.segmentEndIndex,l=i.segmentStart,u=i.segmentEnd,h=i.axis,d=i.originalWaypoints.slice(),f=qd(l,h,e["d"+h]),m=qd(u,h,e["d"+h]),v=d.length,y=0;d[o]=f,d[a]=m,o<2&&(t=xn(r.source,f),1===o?"intersect"===t&&(d.shift(),d[0]=f,y--):"intersect"!==t&&(d.unshift(l),y++)),a>v-3&&(n=xn(r.target,m),a===v-2?"intersect"===n&&(d.pop(),d[d.length-1]=m):"intersect"!==n&&d.push(u)),i.newWaypoints=r.waypoints=s(r,d),p(i,y,e),i.newSegmentStartIndex=o+y,c(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,Wd)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,Wd)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,i=t.connection;t.draggerGfx&&ht(t.draggerGfx),n.removeMarker(i,Ud)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context,n=t.connection;n.waypoints=t.originalWaypoints,c(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,i=t.newWaypoints,r=t.newSegmentStartIndex;i=i.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var a=l(i,r),c=a.waypoints,p=s(n,c),u=a.segmentOffset,h={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+u}};o.updateWaypoints(n,p,h)}))}Jd.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Qd=Math.abs,ef=Math.round;function tf(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i<t.length;i++)if(r=t[i],Qd(r-e)<=n)return r}function nf(e){return{x:e.x,y:e.y}}function rf(e){return{x:e.x+e.width,y:e.y+e.height}}function of(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:ef(e.x+e.width/2),y:ef(e.y+e.height/2)}}function af(e,t){var n=e.snapped;return!!n&&("string"===typeof t?n[t]:n.x&&n.y)}function sf(e,t,n){if("string"!==typeof t)throw new Error("axis must be in [x, y]");if("number"!==typeof n&&!1!==n)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function cf(e){return e.children||[]}var pf=Math.abs,lf=Math.round,uf=10;function hf(e){function t(e,t){if(f(e)){var n=e.length;while(n--)if(pf(e[n]-t)<=uf)return e[n]}else{e=+e;var i=t%e;if(i<uf)return t-i;if(i>e-uf)return t-i+e}return t}function n(e,t){return e.waypoints?Sd(t,e):e.width?{x:lf(e.width/2+e.x),y:lf(e.height/2+e.y)}:void 0}function i(e){var t=e.context,i=t.snapPoints,r=t.connection,o=r.waypoints,a=t.segmentStart,s=t.segmentStartIndex,c=t.segmentEnd,p=t.segmentEndIndex,l=t.axis;if(i)return i;var u=[o[s-1],a,c,o[p+1]];return s<2&&u.unshift(n(r.source,e)),p>o.length-3&&u.unshift(n(r.target,e)),t.snapPoints=i={horizontal:[],vertical:[]},S(u,(function(e){e&&(e=e.original||e,"y"===l&&i.horizontal.push(e.y),"x"===l&&i.vertical.push(e.x))})),i}function r(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var r=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},S(r,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}e.on("connectionSegment.move.move",1500,(function(e){var n,r,o=i(e),a=e.x,s=e.y;if(o){n=t(o.vertical,a),r=t(o.horizontal,s);var c=a-n,p=s-r;V(e,{dx:e.dx-c,dy:e.dy-p,x:n,y:r}),(c||-1!==o.vertical.indexOf(a))&&sf(e,"x",n),(p||-1!==o.horizontal.indexOf(s))&&sf(e,"y",r)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context,i=t.hover,r=i&&n(i,e);df(i)&&r&&r.x&&r.y&&(sf(e,"x",r.x),sf(e,"y",r.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var i,o,a=e.context,s=r(a),c=a.hover,p=c&&n(c,e),l=e.x,u=e.y;if(s){i=t(p?s.vertical.concat([p.x]):s.vertical,l),o=t(p?s.horizontal.concat([p.y]):s.horizontal,u);var h=l-i,d=u-o;V(e,{dx:e.dx-h,dy:e.dy-d,x:e.x-h,y:e.y-d}),(h||-1!==s.vertical.indexOf(l))&&sf(e,"x",i),(d||-1!==s.horizontal.indexOf(u))&&sf(e,"y",o)}}))}function df(e){return e&&!!e.waypoints}hf.$inject=["eventBus"];var ff={__depends__:[Yh,ed],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",kd],bendpointMove:["type",Bd],bendpointMovePreview:["type",Vd],connectionSegmentMove:["type",Jd],bendpointSnapping:["type",hf]};function mf(e,t,n,i){function r(e,t){return i.allowed("connection.create",{source:e,target:t})}function o(e,t){return r(t,e)}e.on("connect.hover",(function(e){var t,n=e.context,i=n.start,a=e.hover;if(n.hover=a,t=n.canExecute=r(i,a),!d(t)){if(!1!==t)return n.source=i,void(n.target=a);t=n.canExecute=o(i,a),d(t)||!1!==t&&(n.source=a,n.target=i)}})),e.on(["connect.out","connect.cleanup"],(function(e){var t=e.context;t.hover=null,t.source=null,t.target=null,t.canExecute=!1})),e.on("connect.end",(function(e){var t=e.context,i=t.canExecute,r=t.connectionStart,o={x:e.x,y:e.y},a=t.source,s=t.target;if(!i)return!1;var c=null,p={connectionStart:vf(t)?o:r,connectionEnd:vf(t)?r:o};m(i)&&(c=i),t.connection=n.connect(a,s,c,p)})),this.start=function(e,n,i,r){m(i)||(r=i,i=bn(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{start:n,connectionStart:i}}})}}function vf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}mf.$inject=["eventBus","dragging","modeling","rules"];var yf=1100,gf=900,bf="connect-ok",xf="connect-not-ok";function _f(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,r=t.hover,o=t.source,a=t.start,s=t.startPosition,c=t.target,p=t.connectionStart||s,l=t.connectionEnd||{x:e.x,y:e.y},u=p,h=l;vf(t)&&(u=l,h=p),i.drawPreview(t,n,{source:o||a,target:c||r,connectionStart:u,connectionEnd:h})})),t.on("connect.hover",gf,(function(e){var t=e.context,i=e.hover,r=t.canExecute;null!==r&&n.addMarker(i,r?bf:xf)})),t.on(["connect.out","connect.cleanup"],yf,(function(e){var t=e.hover;t&&(n.removeMarker(t,bf),n.removeMarker(t,xf))})),i&&t.on("connect.cleanup",(function(e){i.cleanUp(e.context)}))}_f.$inject=["injector","eventBus","canvas"];var Ef={__depends__:[uc,ed,Yh],__init__:["connectPreview"],connect:["type",mf],connectPreview:["type",_f]},wf="djs-connection-preview";function Sf(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}function Cf(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}function Af(e){return m(e)?e:{}}Sf.$inject=["injector","canvas","graphicsFactory","elementFactory"],Sf.prototype.drawPreview=function(e,t,n){n=n||{};var i,r=e.connectionPreviewGfx,o=e.getConnection,a=n.source,s=n.target,c=n.waypoints,p=n.connectionStart,l=n.connectionEnd,u=n.noLayout,h=n.noCropping,d=n.noNoop,f=this;r||(r=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ve(r),o||(o=e.getConnection=Cf((function(e,t,n){return f.getConnection(e,t,n)}))),t&&(i=o(t,a,s)),i?(i.waypoints=c||[],this._layouter&&!u&&(i.waypoints=this._layouter.layoutConnection(i,{source:a,target:s,connectionStart:p,connectionEnd:l,waypoints:n.waypoints||i.waypoints})),i.waypoints&&i.waypoints.length||(i.waypoints=[a?bn(a):p,s?bn(s):l]),this._connectionDocking&&(a||s)&&!h&&(i.waypoints=this._connectionDocking.getCroppedWaypoints(i,a,s)),this._graphicsFactory.drawConnection(r,i)):!d&&this.drawNoopPreview(r,n)},Sf.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||bn(n),o=t.connectionEnd||bn(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Ne(e,s)},Sf.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&_n(o,s,!0)||e,t=i&&_n(a,s,!1)||t,[e,t]},Sf.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&ht(e.connectionPreviewGfx)},Sf.prototype.getConnection=function(e){var t=Af(e);return this._elementFactory.createConnection(t)},Sf.prototype.createConnectionPreviewGfx=function(){var e=Xe("g");return $e(e,{pointerEvents:"none"}),He(e).add(wf),Ne(this._canvas.getActiveLayer(),e),e},Sf.prototype.createNoopConnection=function(e,t){return jt([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var kf={__init__:["connectionPreview"],connectionPreview:["type",Sf]};var Tf=Object.prototype.toString,Rf=Object.prototype.hasOwnProperty;function Df(e){return void 0===e}function Pf(e){return"[object Array]"===Tf.call(e)}function Mf(e,t){return Rf.call(e,t)}function Bf(e,t){var n,i;if(!Df(e)){var r=Pf(e)?Of:Nf;for(var o in e)if(Mf(e,o)&&(n=e[o],i=t(n,r(o)),!1===i))return n}}function Nf(e){return e}function Of(e){return Number(e)}function jf(){return jf=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},jf.apply(this,arguments)}function Lf(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return jf.apply(void 0,[e].concat(n))}Object.prototype.toString,Object.prototype.hasOwnProperty;var If=[].indexOf,Ff=function(e,t){if(If)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},$f=/\s+/,zf=Object.prototype.toString;function Hf(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Hf.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array(),n=Ff(t,e);return~n||t.push(e),this.el.className=t.join(" "),this},Hf.prototype.remove=function(e){if("[object RegExp]"==zf.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=Ff(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},Hf.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Hf.prototype.toggle=function(e,t){return this.list?("undefined"!==typeof t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):("undefined"!==typeof t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},Hf.prototype.array=function(){var e=this.el.getAttribute("class")||"",t=e.replace(/^\s+|\s+$/g,""),n=t.split($f);return""===n[0]&&n.shift(),n},Hf.prototype.has=Hf.prototype.contains=function(e){return this.list?this.list.contains(e):!!~Ff(this.array(),e)};var Gf="undefined"!==typeof Element?Element.prototype:{},Vf=Gf.matches||Gf.matchesSelector||Gf.webkitMatchesSelector||Gf.mozMatchesSelector||Gf.msMatchesSelector||Gf.oMatchesSelector,Wf=Uf;function Uf(e,t){if(!e||1!==e.nodeType)return!1;if(Vf)return Vf.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;i++)if(n[i]==e)return!0;return!1}function qf(e,t,n){var i=n?e:e.parentNode;while(i&&i.nodeType!==document.DOCUMENT_NODE&&i.nodeType!==document.DOCUMENT_FRAGMENT_NODE){if(Wf(i,t))return i;i=i.parentNode}return Wf(i,t)?i:null}var Kf=window.addEventListener?"addEventListener":"attachEvent",Yf=window.removeEventListener?"removeEventListener":"detachEvent",Xf="addEventListener"!==Kf?"on":"",Zf=function(e,t,n,i){return e[Kf](Xf+t,n,i||!1),n},Jf=function(e,t,n,i){return e[Yf](Xf+t,n,i||!1),n},Qf={bind:Zf,unbind:Jf},em=["focus","blur"];function tm(e,t,n,i,r){return-1!==em.indexOf(n)&&(r=!0),Qf.bind(e,n,(function(n){var r=n.target||n.srcElement;n.delegateTarget=qf(r,t,!0,e),n.delegateTarget&&i.call(e,n)}),r)}function nm(e,t,n,i){return-1!==em.indexOf(t)&&(i=!0),Qf.unbind(e,t,n,i)}var im,rm={bind:tm,unbind:nm},om=!1;"undefined"!==typeof document&&(im=document.createElement("div"),im.innerHTML='  <link/><table></table><a href="/a">a</a><input type="checkbox"/>',om=!im.getElementsByTagName("link").length,im=void 0);var am={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:om?[1,"X<div>","</div>"]:[0,"",""]};function sm(e,t){return t=t||document,t.querySelector(e)}function cm(e,t){return t=t||document,t.querySelectorAll(e)}function pm(e){return e.originalEvent||e.srcEvent}function lm(e){return!(pm(e)||e).button}function um(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(n){}return e}function hm(e,t){return t.appendChild(um(e,t))}function dm(e,t){return hm(t,e),e}am.td=am.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],am.option=am.optgroup=[1,'<select multiple="multiple">',"</select>"],am.thead=am.tbody=am.colgroup=am.caption=am.tfoot=[1,"<table>","</table>"],am.polyline=am.ellipse=am.polygon=am.circle=am.text=am.line=am.path=am.rect=am.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var fm=2,mm={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":fm,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":fm,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function vm(e,t){return mm[t]?e.style[t]:e.getAttributeNS(null,t)}function ym(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=mm[i];r?(r===fm&&"number"===typeof n&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function gm(e,t){var n,i,r=Object.keys(t);for(n=0,i;i=r[n];n++)ym(e,i,t[i])}function bm(e,t,n){if("string"===typeof t){if(void 0===n)return vm(e,t);ym(e,t,n)}else gm(e,t);return e}function xm(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}var _m=/\s+/,Em=Object.prototype.toString;function wm(e){return"undefined"!==typeof e}function Sm(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Cm(e){var t=e.parentNode;return t&&t.removeChild(e),e}Sm.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array(),n=xm(t,e);return~n||t.push(e),wm(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},Sm.prototype.remove=function(e){if("[object RegExp]"===Em.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=xm(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},Sm.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Sm.prototype.toggle=function(e,t){return this.list?(wm(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(wm(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},Sm.prototype.array=function(){var e=this.el.getAttribute("class")||"",t=e.replace(/^\s+|\s+$/g,""),n=t.split(_m);return""===n[0]&&n.shift(),n},Sm.prototype.has=Sm.prototype.contains=function(e){return this.list?this.list.contains(e):!!~xm(this.array(),e)};var Am={svg:"http://www.w3.org/2000/svg"},km='<svg xmlns="'+Am.svg+'"';function Tm(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(Am.svg)&&(e=km+e.substring(4)):(e=km+">"+e+"</svg>",t=!0);var n=Rm(e);if(!t)return n;var i=document.createDocumentFragment(),r=n.firstChild;while(r.firstChild)i.appendChild(r.firstChild);return i}function Rm(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Dm(e,t){var n;return"<"===e.charAt(0)?(n=Tm(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Am.svg,e),t&&bm(n,t),n}function Pm(e){for(var t,n="",i=0;t=e[i];i++)n+=t.x+","+t.y+" ";return n}function Mm(e,t){var n=Dm("polyline");return bm(n,{points:Pm(e)}),t&&bm(n,t),n}function Bm(e,t){return bm(e,{points:Pm(t)}),e}function Nm(e){return!0}var Om=500;function jm(e,t,n){var i=this;function r(n,i,r){var o,a,c;s(n,i)||(r?a=t.getGraphics(r):(o=i.delegateTarget||i.target,o&&(a=o,r=t.get(a))),a&&r&&(c=e.fire(n,{element:r,gfx:a,originalEvent:i}),!1===c&&(i.stopPropagation(),i.preventDefault())))}var o={};function a(e){return o[e]}function s(e,t){var n=p[e]||lm;return!n(t)}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":Nm};function l(e,t,n){var i=c[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return r(i,t,n)}var u="svg, .djs-element";function h(e,t,n,i){var a=o[n]=function(e){r(n,e)};i&&(p[n]=i),a.$delegate=rm.bind(e,u,t,a)}function d(e,t,n){var i=a(n);i&&rm.unbind(e,t,i.$delegate)}function f(e){Bf(c,(function(t,n){h(e,n,t)}))}function m(e){Bf(c,(function(t,n){d(e,n,t)}))}e.on("canvas.destroy",(function(e){m(e.svg)})),e.on("canvas.init",(function(e){f(e.svg)})),e.on(["shape.added","connection.added"],(function(t){var n=t.element,i=t.gfx;e.fire("interactionEvents.createHit",{element:n,gfx:i})})),e.on(["shape.changed","connection.changed"],Om,(function(t){var n=t.element,i=t.gfx;e.fire("interactionEvents.updateHit",{element:n,gfx:i})})),e.on("interactionEvents.createHit",Om,(function(e){var t=e.element,n=e.gfx;i.createDefaultHit(t,n)})),e.on("interactionEvents.updateHit",(function(e){var t=e.element,n=e.gfx;i.updateDefaultHit(t,n)}));var v=x("djs-hit djs-hit-stroke"),y=x("djs-hit djs-hit-click-stroke"),g=x("djs-hit djs-hit-all"),b={all:g,"click-stroke":y,stroke:v};function x(e,t){return t=Lf({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function _(e,t){var n=b[t];if(!n)throw new Error("invalid hit type <"+t+">");return bm(e,n),e}function E(e,t){dm(e,t)}this.removeHits=function(e){var t=cm(".djs-hit",e);Bf(t,Cm)},this.createDefaultHit=function(e,t){var n,i=e.waypoints,r=e.isFrame;return i?this.createWaypointsHit(t,i):(n=r?"stroke":"all",this.createBoxHit(t,n,{width:e.width,height:e.height}))},this.createWaypointsHit=function(e,t){var n=Mm(t);return _(n,"stroke"),E(e,n),n},this.createBoxHit=function(e,t,n){n=Lf({x:0,y:0},n);var i=Dm("rect");return _(i,t),bm(i,n),E(e,i),i},this.updateDefaultHit=function(e,t){var n=sm(".djs-hit",t);if(n)return e.waypoints?Bm(n,e.waypoints):bm(n,{width:e.width,height:e.height}),n},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=h,this.unregisterEvent=d}jm.$inject=["eventBus","elementRegistry","styles"];var Lm={__init__:["interactionEvents"],interactionEvents:["type",jm]},Im=Math.min,Fm=Math.max;function $m(e){e.preventDefault()}function zm(e){e.stopPropagation()}function Hm(e){return e.nodeType===Node.TEXT_NODE}function Gm(e){return[].slice.call(e)}function Vm(e){this.container=e.container,this.parent=ke('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Re("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=G(this.autoResize,this),this.handlePaste=G(this.handlePaste,this)}function Wm(e){return e.replace(/\r\n|\r|\n/g,"\n")}function Um(e,t){this._eventBus=e,this._providers=[],this._textbox=new Vm({container:t.getContainer(),keyHandler:G(this._handleKey,this),resizeHandler:G(this._handleResize,this)})}Vm.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=U(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);V(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=U(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return V(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},p),i.centerVertically&&V(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},p),a.innerText=n,ye.bind(a,"keydown",this.keyHandler),ye.bind(a,"mousedown",zm),ye.bind(a,"paste",r.handlePaste),i.autoResize&&ye.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Vm.prototype.handlePaste=function(e){var t,n=this.options,i=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var r=this.autoResize(i);r&&this.resizeHandler(r)}},Vm.prototype.insertText=function(e){e=Wm(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Vm.prototype._insertTextIE=function(e){var t,n,i=this.getSelection(),r=i.startContainer,o=i.endContainer,a=i.startOffset,s=i.endOffset,c=i.commonAncestorContainer,p=Gm(c.childNodes);if(Hm(c)){var l=r.textContent;r.textContent=l.substring(0,a)+e+l.substring(s),t=r,n=a+e.length}else if(r===this.content&&o===this.content){var u=document.createTextNode(e);this.content.insertBefore(u,p[a]),t=u,n=u.textContent.length}else{var h=p.indexOf(r),d=p.indexOf(o);p.forEach((function(t,n){n===h?t.textContent=r.textContent.substring(0,a)+e+o.textContent.substring(s):n>h&&n<=d&&Pe(t)})),t=r,n=a+e.length}t&&void 0!==n&&setTimeout((function(){self.setSelection(t,n)}))},Vm.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},Vm.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){var s,c,p,l;n=this.resizeHandle=ke('<div class="djs-direct-editing-resize-handle"></div>');var u=function(e){$m(e),zm(e),s=e.clientX,c=e.clientY;var n=t.getBoundingClientRect();p=n.width,l=n.height,ye.bind(document,"mousemove",h),ye.bind(document,"mouseup",d)},h=function(n){$m(n),zm(n);var u=Im(Fm(p+n.clientX-s,i),o),h=Im(Fm(l+n.clientY-c,r),a);t.style.width=u+"px",t.style.height=h+"px",e.resizeHandler({width:p,height:l,dx:n.clientX-s,dy:n.clientY-c})},d=function(e){$m(e),zm(e),ye.unbind(document,"mousemove",h,!1),ye.unbind(document,"mouseup",d,!1)};ye.bind(n,"mousedown",u)}V(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)},Vm.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ye.unbind(t,"keydown",this.keyHandler),ye.unbind(t,"mousedown",zm),ye.unbind(t,"input",this.autoResize),ye.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),Pe(n)),Pe(e)},Vm.prototype.getValue=function(){return this.content.innerText.trim()},Vm.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Vm.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)},Um.$inject=["eventBus","canvas"],Um.prototype.registerProvider=function(e){this._providers.push(e)},Um.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},Um.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Um.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Um.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},Um.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;r===o&&i.height===n.height&&i.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},Um.prototype.getValue=function(){return this._textbox.getValue()},Um.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;return 27===t?(e.preventDefault(),this.cancel()):13!==t||e.shiftKey?void 0:(e.preventDefault(),this.complete())},Um.prototype._handleResize=function(e){this._fire("resize",e)},Um.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=_(this._providers,(function(n){return(t=n.activate(e))?n:null}));return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};var qm={__depends__:[Lm],__init__:["directEditing"],directEditing:["type",Um]},Km=["marker-start","marker-mid","marker-end"],Ym=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Xm(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i,this._clonedMarkers={};var r=this;t.on("drag.cleanup",(function(){S(r._clonedMarkers,(function(e){ht(e)})),r._clonedMarkers={}}))}function Zm(e,t,n){var i=Jm($e(e,t));return Re("marker#"+i,n||document)}function Jm(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Qm(e){return"url(#"+e+")"}function ev(e){return-1!==Ym.indexOf(e.nodeName)}Xm.$inject=["elementRegistry","eventBus","canvas","styles"],Xm.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Xm.prototype.addDragger=function(e,t,n){n=n||this.getGfx(e);var i=We(n),r=n.getBoundingClientRect();return this._cloneMarkers(ai(i)),$e(i,this._styles.cls("djs-dragger",[],{x:r.top,y:r.left})),Ne(t,i),i},Xm.prototype.addFrame=function(e,t){var n=Xe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ne(t,n),n},Xm.prototype._cloneMarkers=function(e){var t=this;if(e.childNodes)for(var n=0;n<e.childNodes.length;n++)t._cloneMarkers(e.childNodes[n]);ev(e)&&Km.forEach((function(n){if($e(e,n)){var i=Zm(e,n,t._canvas.getContainer());t._cloneMarker(e,i,n)}}))},Xm.prototype._cloneMarker=function(e,t,n){var i=t.id,r=this._clonedMarkers[i];if(!r){r=We(t);var o=i+"-clone";r.id=o,He(r).add("djs-dragger").add("djs-dragger-marker"),this._clonedMarkers[i]=r;var a=Re("defs",this._canvas._svg);a||(a=Xe("defs"),Ne(this._canvas._svg,a)),Ne(a,r)}var s=Qm(this._clonedMarkers[i].id);$e(e,n,s)};var tv={__init__:["previewSupport"],previewSupport:["type",Xm]},nv="drop-ok",iv="drop-not-ok",rv="attach-ok",ov="new-parent",av="create",sv=2e3;function cv(e,t,n,i,r){function o(e,t,n,i,o){if(!t)return!1;e=w(e,(function(t){var n=t.labelTarget;return!t.parent&&!(hv(t)&&-1!==e.indexOf(n))}));var a=_(e,(function(e){return!lv(e)})),s=!1,c=!1,p=!1;uv(e)&&(s=r.allowed("shape.attach",{position:n,shape:a,target:t})),s||(p=uv(e)?r.allowed("shape.create",{position:n,shape:a,source:i,target:t}):r.allowed("elements.create",{elements:e,position:n,target:t}));var l=o.connectionTarget;return p||s?(a&&i&&(c=r.allowed("connection.create",{source:l===i?a:i,target:l===i?i:a,hints:{targetParent:t,targetAttach:s}})),{attach:s,connect:c}):(null===p||null===s)&&null}function a(t,n){[rv,nv,iv,ov].forEach((function(i){i===n?e.addMarker(t,i):e.removeMarker(t,i)}))}function s(){var e=t.context();e&&e.prefix===av&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,i=e.hover,r=t.source,s=t.hints||{};if(!i)return t.canExecute=!1,void(t.target=null);pv(e);var c={x:e.x,y:e.y},p=t.canExecute=i&&o(n,i,c,r,s);i&&null!==p&&(t.target=i,p&&p.attach?a(i,rv):a(i,p?ov:iv))})),n.on(["create.end","create.out","create.cleanup"],(function(e){var t=e.hover;t&&a(t,null)})),n.on("create.end",(function(e){var t=e.context,n=t.source,r=t.shape,o=t.elements,a=t.target,s=t.canExecute,c=s&&s.attach,p=s&&s.connect,l=t.hints||{};if(!1===s||!a)return!1;pv(e);var u={x:e.x,y:e.y};p?r=i.appendShape(n,r,u,a,{attach:c,connection:!0===p?{}:p,connectionTarget:l.connectionTarget}):(o=i.createElements(o,u,a,V({},l,{attach:c})),r=_(o,(function(e){return!lv(e)}))),V(t,{elements:o,shape:r}),V(e,{elements:o,shape:r})})),n.on("create.init",(function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],sv,(function(){n.off("elements.changed",s)}))})),this.start=function(e,n,i){f(n)||(n=[n]);var r=_(n,(function(e){return!lv(e)}));if(r){i=V({elements:n,hints:{},shape:r},i||{}),S(n,(function(e){v(e.x)||(e.x=0),v(e.y)||(e.y=0)}));var o=w(n,(function(e){return!e.hidden})),a=Wt(o);S(n,(function(e){lv(e)&&(e.waypoints=R(e.waypoints,(function(e){return{x:e.x-a.x-a.width/2,y:e.y-a.y-a.height/2}}))),V(e,{x:e.x-a.x-a.width/2,y:e.y-a.y-a.height/2})})),t.init(e,av,{cursor:"grabbing",autoActivate:!0,data:{shape:r,elements:n,context:i}})}}}function pv(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function lv(e){return!!e.waypoints}function uv(e){return e&&1===e.length&&!lv(e[0])}function hv(e){return!!e.labelTarget}cv.$inject=["canvas","dragging","eventBus","modeling","rules"];var dv=750;function fv(e,t,n,i,r){function o(e){var t=Xe("g");$e(t,r.cls("djs-drag-group",["no-events"]));var o=Xe("g");return e.forEach((function(e){var r;e.hidden||(e.waypoints?(r=n._createContainer("connection",o),n.drawConnection(ai(r),e)):(r=n._createContainer("shape",o),n.drawShape(ai(r),e),pi(r,e.x,e.y)),i.addDragger(e,t,r))})),t}t.on("create.move",dv,(function(t){var n,i=t.hover,r=t.context,a=r.elements,s=r.dragGroup;s||(s=r.dragGroup=o(a)),i?(s.parentNode||(n=e.getActiveLayer(),Ne(n,s)),pi(s,t.x,t.y)):ht(s)})),t.on("create.cleanup",(function(e){var t=e.context,n=t.dragGroup;n&&ht(n)}))}fv.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var mv={__depends__:[Yh,tv,ed,uc],__init__:["create","createPreview"],create:["type",cv],createPreview:["type",fv]};function vv(){}vv.prototype.get=function(){return this._data},vv.prototype.set=function(e){this._data=e},vv.prototype.clear=function(){var e=this._data;return delete this._data,e},vv.prototype.isEmpty=function(){return!this._data};var yv={clipboard:["type",vv]};function gv(e){var t=this;function n(e){t._lastMoveEvent=e}this._lastMoveEvent=null,e.on("canvas.init",(function(e){var i=t._svg=e.svg;i.addEventListener("mousemove",n)})),e.on("canvas.destroy",(function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)}))}function bv(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}gv.$inject=["eventBus"],gv.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||bv(0,0)};var xv={__init__:["mouse"],mouse:["type",gv]};function _v(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,i=e.elements;t.priority=1,t.id=n.id;var r=_(i,(function(e){return e===n.parent}));r&&(t.parent=n.parent.id),Ev(n)&&(t.priority=2,t.host=n.host.id),wv(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=Cv(n)),Sv(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),S(["x","y","width","height"],(function(e){v(n[e])&&(t[e]=n[e])})),t.hidden=n.hidden,t.collapsed=n.collapsed})),r.on("copyPaste.pasteElements",(function(e){var t=e.hints;V(t,{createElementsBehavior:!1})}))}function Ev(e){return!!e.host}function wv(e){return!!e.waypoints}function Sv(e){return!!e.labelTarget}function Cv(e){return R(e.waypoints,(function(e){return e=Av(e),e.original&&(e.original=Av(e.original)),e}))}function Av(e){return V({},e)}function kv(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}_v.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],_v.prototype.copy=function(e){var t,n;return f(e)||(e=e?[e]:[]),t=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n=!1===t?{}:this.createTree(f(t)?t:e),this._clipboard.set(n),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:n}),n},_v.prototype.paste=function(e){var t=this._clipboard.get();if(!this._clipboard.isEmpty()){var n=e&&e.hints||{};this._eventBus.fire("copyPaste.pasteElements",{hints:n});var i=this._createElements(t);if(e&&e.element&&e.point)return this._paste(i,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),i,{hints:n||{}})}},_v.prototype._paste=function(e,t,n,i){S(e,(function(e){v(e.x)||(e.x=0),v(e.y)||(e.y=0)}));var r=Wt(e);return S(e,(function(e){wv(e)&&(e.waypoints=R(e.waypoints,(function(e){return{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2}}))),V(e,{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2})})),this._modeling.createElements(e,n,t,V({},i))},_v.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return S(e,(function(e,o){o=parseInt(o,10),e=j(e,"priority"),S(e,(function(e){var o,a=V({},q(e,["priority"]));return i[e.parent]?a.parent=i[e.parent]:delete a.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:a}),wv(a)?(a.source=i[e.source],a.target=i[e.target],o=i[e.id]=t.createConnection(a),void r.push(o)):Sv(a)?(a.labelTarget=i[a.labelTarget],o=i[e.id]=t.createLabel(a),void r.push(o)):(a.host&&(a.host=i[a.host]),o=i[e.id]=t.createShape(a),void r.push(o))}))})),r},_v.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(q(e,["id"]));return t},_v.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(q(e,["id"]));return t},_v.prototype.createShape=function(e){var t=this._elementFactory.createShape(q(e,["id"]));return t},_v.prototype.hasRelations=function(e,t){var n,i,r;return!(wv(e)&&(i=_(t,L({id:e.source.id})),r=_(t,L({id:e.target.id})),!i||!r))&&!(Sv(e)&&(n=_(t,L({id:e.labelTarget.id})),!n))},_v.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=It(e);function a(e,n){return t.allowed("element.copy",{element:e,elements:n})}function s(e,t){var n=_(r,(function(t){return e===t.element}));n?n.depth<t&&(r=c(n,r),r.push({element:n.element,depth:t})):r.push({element:e,depth:t})}function c(e,t){var n=t.indexOf(e);return-1!==n&&t.splice(n,1),t}return zt(o,(function(e,t,i){if(!Sv(e)){S(e.labels,(function(e){s(e,i)})),S([e.attachers,e.incoming,e.outgoing],o),s(e,i);var r=[];return e.children&&(r=e.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:e,children:r}),r}function o(e){e&&e.length&&S(e,(function(e){S(e.labels,(function(e){s(e,i)})),s(e,i)}))}})),e=R(r,(function(e){return e.element})),r=R(r,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),r=j(r,(function(e){return e.descriptor.priority})),e=R(r,(function(e){return e.element})),S(r,(function(t){var r=t.depth;n.hasRelations(t.element,e)&&a(t.element,e)?(i[r]||(i[r]=[]),i[r].push(t.descriptor)):kv(t.element,e)})),i};var Tv={__depends__:[yv,mv,xv,ed],__init__:["copyPaste"],copyPaste:["type",_v]};function Rv(e,t,n){f(n)||(n=[n]),S(n,(function(n){u(e[n])||(t[n]=e[n])}))}var Dv=750;function Pv(e,t,n){function i(t,i){var r=e.create(t.$type);return n.copyElement(t,r,null,i)}t.on("copyPaste.copyElement",Dv,(function(e){var t=e.descriptor,n=e.element,r=Xo(n);if(Mv(n))return t;var o=t.businessObject=i(r,!0),a=t.di=i(Zo(n),!0);a.bpmnElement=o,Rv(o,t,"name"),Rv(a,t,"isExpanded"),r.default&&(t.default=r.default.id)}));var r="-bpmn-js-refs";function o(e){return e[r]=e[r]||{}}function a(e,t){e[r]=t}function s(e,t,n){var i=Xo(e);return e.default&&(n[e.default]={element:i,property:"default"}),e.host&&(Xo(e).attachedToRef=Xo(t[e.host])),q(n,A(n,(function(t,n,r){var o=n.element,a=n.property;return r===e.id&&(o[a]=i,t.push(e.id)),t}),[]))}t.on("copyPaste.pasteElement",(function(e){var t=e.cache,n=e.descriptor,r=n.businessObject,o=n.di;if(Mv(n))return n.businessObject=Xo(t[n.labelTarget]),void(n.di=Zo(t[n.labelTarget]));r=n.businessObject=i(r),o=n.di=i(o),o.bpmnElement=r,Rv(n,r,["isExpanded","name"]),n.type=r.$type})),t.on("copyPaste.copyElement",Dv,(function(e){var t=e.descriptor,n=e.element;if(Ko(n,"bpmn:Participant")){var r=Xo(n);r.processRef&&(t.processRef=i(r.processRef,!0))}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor,n=t.processRef;n&&(t.processRef=i(n))})),t.on("copyPaste.pasteElement",Dv,(function(e){var t=e.cache,n=e.descriptor;a(t,s(n,t,o(t)))}))}function Mv(e){return!!e.labelTarget}Pv.$inject=["bpmnFactory","eventBus","moddleCopy"];var Bv=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function Nv(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",(function(e){var t=e.propertyNames;if(t&&t.length)return j(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=m(t)&&t.$descriptor,i=e.propertyName;return(!i||-1===Bv.indexOf(i))&&(!(i&&n&&!_(n.properties,L({name:i})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t=e.property;if(jv(t,"bpmn:ExtensionElements")&&(!t.values||!t.values.length))return!1}))}function Ov(e,t){return A(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}function jv(e,t){return e&&"function"===typeof e.$instanceOf&&e.$instanceOf(t)}Nv.$inject=["eventBus","bpmnFactory","moddle"],Nv.prototype.copyElement=function(e,t,n,i){var r=this;n&&!f(n)&&(n=[n]),n=n||Ov(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return!1===o||(f(o)&&(n=o),S(n,(function(n){var o;x(e,n)&&(o=e.get(n));var a=r.copyProperty(o,t,n,i);if(h(a)){var s=r._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:a,propertyName:n});!1!==s&&t.set(n,a)}}))),t},Nv.prototype.copyProperty=function(e,t,n,i){var r=this,o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(!1!==o){if(o)return m(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;var a=this._moddle.getPropertyDescriptor(t,n);if(!a.isReference){if(a.isId)return e&&this._copyId(e,t,i);if(f(e))return A(e,(function(e,a){return o=r.copyProperty(a,t,n,i),o?e.concat(o):e}),[]);if(m(e)&&e.$type){if(this._moddle.getElementDescriptor(e).isGeneric)return;return o=r._bpmnFactory.create(e.$type),o.$parent=t,o=r.copyElement(e,o,null,i),o}return e}}},Nv.prototype._copyId=function(e,t,n){return n?e:this._moddle.ids.assigned(e)?void 0:(this._moddle.ids.claim(e,t),e)};var Lv={__depends__:[Tv],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Pv],moddleCopy:["type",Nv]},Iv=Math.round;function Fv(e,t){this._modeling=e,this._eventBus=t}function $v(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:i={}}=t;!1!==i.select&&e.select(n)}))}Fv.$inject=["modeling","eventBus"],Fv.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.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=Iv(s+o/2),l=Iv(c+a/2),u=i.replaceShape(e,V({},t,{x:p,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:u,hints:n}),u},$v.$inject=["selection","eventBus"];var zv={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",$v],replace:["type",Fv]};function Hv(e,t,n){f(n)||(n=[n]),S(n,(function(n){u(e[n])||(t[n]=e[n])}))}var Gv=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function Vv(e,t){var n,i=e&&x(e,"collapsed")?e.collapsed:!_a(e);return n=t&&(x(t,"collapsed")||x(t,"isExpanded"))?x(t,"collapsed")?t.collapsed:!t.isExpanded:i,i!==n}function Wv(e,t,n,i,r,o,a){function s(s,c,p){p=p||{};var l=c.type,u=s.businessObject;if(Uv(u)&&"bpmn:SubProcess"===l&&Vv(s,c))return i.toggleCollapse(s),s;var h=e.create(l),d={type:l,businessObject:h,di:{}};Hv(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var f=Ov(u.$descriptor),m=Ov(h.$descriptor,!0),v=Kv(f,m);V(h,U(c,Gv));var y=w(v,(function(e){return"eventDefinitions"===e?qv(s,c.eventDefinitionType):"loopCharacteristics"===e?!wa(h):!x(h,e)&&(("processRef"!==e||!1!==c.isExpanded)&&"triggeredByEvent"!==e)}));if(h=n.copyElement(u,h,y),c.eventDefinitionType&&(qv(h,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),Ko(u,"bpmn:Activity")){if(Uv(u))d.isExpanded=_a(s);else if(c&&x(c,"isExpanded")){d.isExpanded=c.isExpanded;var g=t.getDefaultSize(h,{isExpanded:d.isExpanded});d.width=g.width,d.height=g.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}_a(s)&&!Ko(u,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}return Uv(u)&&!Uv(h)&&(p.moveChildren=!1),Ko(u,"bpmn:Participant")&&(!0===c.isExpanded?h.processRef=e.create("bpmn:Process"):p.moveChildren=!1,d.width=s.width,d.height=t.getDefaultSize(d).height),o.allowed("shape.resize",{shape:h})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),h.name=u.name,Yo(u,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Yo(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(h.default=u.default),c.host&&!Ko(u,"bpmn:BoundaryEvent")&&Ko(h,"bpmn:BoundaryEvent")&&(d.host=c.host),"bpmn:DataStoreReference"!==d.type&&"bpmn:DataObjectReference"!==d.type||(d.x=s.x+(s.width-d.width)/2),d=r.replaceElement(s,d,p),!1!==p.select&&a.select(d),d}this.replaceElement=s}function Uv(e){return Ko(e,"bpmn:SubProcess")}function qv(e,t){var n=Xo(e);return t&&n.get("eventDefinitions").some((function(e){return Ko(e,t)}))}function Kv(e,t){return e.filter((function(e){return-1!==t.indexOf(e)}))}Wv.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules","selection"];var Yv={__depends__:[Lv,zv,uc],bpmnReplace:["type",Wv]};function Xv(e){return function(t){var n=t.target,i=Xo(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent===!!i.triggeredByEvent,c=void 0===n.isExpanded||n.isExpanded===_a(e);return!o||!a||!s||!c}}var Zv=[{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"}}],Jv=[{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"}}],Qv=[{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"}}],ey=[{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"}}],ty=[{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"}}],ny=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event Sub Process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Sub Process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],iy=[{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:"Event Sub Process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}}],ry=iy,oy=[{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}}],ay=[{label:"Data Store Reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],sy=[{label:"Data Object Reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],cy=[{label:"Message Boundary Event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Boundary Event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Boundary Event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Boundary Event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Error Boundary Event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel Boundary Event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Signal Boundary Event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Compensation Boundary Event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-message-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},{label:"Timer Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},{label:"Escalation Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},{label:"Conditional Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},{label:"Signal Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}}],py=[{label:"Message Start Event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Start Event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional Start Event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal Start Event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Error Start Event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Escalation Start Event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Compensation Start Event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-message-start",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},{label:"Timer Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-start",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},{label:"Conditional Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-start",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},{label:"Signal Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-start",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},{label:"Escalation Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-start",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}}],ly=[{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"}],uy=[{label:"Expanded Pool",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:function(e){var t="Empty Pool";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}}];function hy(e,t,n,i,r,o,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this.register()}hy.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate"],hy.prototype.register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},hy.prototype.getEntries=function(e){var t,n=e.businessObject,i=this._rules;if(!i.allowed("shape.replace",{element:e}))return[];var r=Xv(e);return Ko(n,"bpmn:DataObjectReference")?this._createEntries(e,ay):Ko(n,"bpmn:DataStoreReference")&&!Ko(e.parent,"bpmn:Collaboration")?this._createEntries(e,sy):Ko(n,"bpmn:StartEvent")&&!Ko(n.$parent,"bpmn:SubProcess")?(t=w(Zv,r),this._createEntries(e,t)):Ko(n,"bpmn:Participant")?(t=w(uy,(function(t){return _a(e)!==t.target.isExpanded})),this._createEntries(e,t)):Ko(n,"bpmn:StartEvent")&&wa(n.$parent)?(t=w(py,(function(t){var n=t.target,i=!1!==n.isInterrupting,o=Xo(e).isInterrupting===i;return r(t)||!r(t)&&!o})),this._createEntries(e,t)):Ko(n,"bpmn:StartEvent")&&!wa(n.$parent)&&Ko(n.$parent,"bpmn:SubProcess")?(t=w(Jv,r),this._createEntries(e,t)):Ko(n,"bpmn:EndEvent")?(t=w(ey,(function(e){var t=e.target;return!("bpmn:CancelEventDefinition"==t.eventDefinitionType&&!Ko(n.$parent,"bpmn:Transaction"))&&r(e)})),this._createEntries(e,t)):Ko(n,"bpmn:BoundaryEvent")?(t=w(cy,(function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinitionType&&!Ko(n.attachedToRef,"bpmn:Transaction"))return!1;var i=!1!==t.cancelActivity,o=n.cancelActivity==i;return r(e)||!r(e)&&!o})),this._createEntries(e,t)):Ko(n,"bpmn:IntermediateCatchEvent")||Ko(n,"bpmn:IntermediateThrowEvent")?(t=w(Qv,r),this._createEntries(e,t)):Ko(n,"bpmn:Gateway")?(t=w(ty,r),this._createEntries(e,t)):Ko(n,"bpmn:Transaction")?(t=w(iy,r),this._createEntries(e,t)):wa(n)&&_a(e)?(t=w(ry,r),this._createEntries(e,t)):Ko(n,"bpmn:SubProcess")&&_a(e)?(t=w(ny,r),this._createEntries(e,t)):Ko(n,"bpmn:AdHocSubProcess")&&!_a(e)?(t=w(oy,(function(t){var n=t.target,i="bpmn:SubProcess"===n.type,r=!0===n.isExpanded;return Xv(e,n)&&(!i||r)})),this._createEntries(e,t)):Ko(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,ly):Ko(n,"bpmn:FlowNode")?(t=w(oy,r),Ko(n,"bpmn:SubProcess")&&!_a(e)&&(t=w(t,(function(e){return"Sub Process (collapsed)"!==e.label}))),this._createEntries(e,t)):[]},hy.prototype.getHeaderEntries=function(e){var t=[];return Ko(e,"bpmn:Activity")&&!wa(e)&&(t=t.concat(this._getLoopEntries(e))),Ko(e,"bpmn:DataObjectReference")&&(t=t.concat(this._getDataObjectIsCollection(e))),Ko(e,"bpmn:Participant")&&(t=t.concat(this._getParticipantMultiplicity(e))),!Ko(e,"bpmn:SubProcess")||Ko(e,"bpmn:Transaction")||wa(e)||t.push(this._getAdHocEntry(e)),t},hy.prototype._createEntries=function(e,t){var n=[],i=this;return S(t,(function(t){var r=i._createMenuEntry(t,e);n.push(r)})),n},hy.prototype._createSequenceFlowEntries=function(e,t){var n=Xo(e),i=[],r=this._modeling,o=this._moddle,a=this;return S(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(Ko(n.sourceRef,"bpmn:ExclusiveGateway")||Ko(n.sourceRef,"bpmn:InclusiveGateway")||Ko(n.sourceRef,"bpmn:ComplexGateway")||Ko(n.sourceRef,"bpmn:Activity"))&&i.push(a._createMenuEntry(t,e,(function(){r.updateProperties(e.source,{default:n})})));break;case"replace-with-conditional-flow":!n.conditionExpression&&Ko(n.sourceRef,"bpmn:Activity")&&i.push(a._createMenuEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:t})})));break;default:if(Ko(n.sourceRef,"bpmn:Activity")&&n.conditionExpression)return i.push(a._createMenuEntry(t,e,(function(){r.updateProperties(e,{conditionExpression:void 0})})));if((Ko(n.sourceRef,"bpmn:ExclusiveGateway")||Ko(n.sourceRef,"bpmn:InclusiveGateway")||Ko(n.sourceRef,"bpmn:ComplexGateway")||Ko(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n)return i.push(a._createMenuEntry(t,e,(function(){r.updateProperties(e.source,{default:void 0})})))}})),i},hy.prototype._createMenuEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=function(){return r(t,e.target)},a=e.label;a&&"function"===typeof a&&(a=a(t)),n=n||o;var s={label:i(a),className:e.className,id:e.actionName,action:n};return s},hy.prototype._getLoopEntries=function(e){var t=this,n=this._translate;function i(n,i){var r=Xo(e).loopCharacteristics;i.active?r=void 0:(!u(i.options.isSequential)&&r&&Ko(r,i.options.loopCharacteristics)||(r=t._moddle.create(i.options.loopCharacteristics)),r.isSequential=i.options.isSequential),t._modeling.updateProperties(e,{loopCharacteristics:r})}var r,o,a,s=Xo(e),c=s.loopCharacteristics;c&&(r=c.isSequential,o=void 0===c.isSequential,a=void 0!==c.isSequential&&!c.isSequential);var p=[{id:"toggle-parallel-mi",className:"bpmn-icon-parallel-mi-marker",title:n("Parallel Multi Instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},{id:"toggle-sequential-mi",className:"bpmn-icon-sequential-mi-marker",title:n("Sequential Multi Instance"),active:r,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},{id:"toggle-loop",className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}];return p},hy.prototype._getDataObjectIsCollection=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return[];function r(n,r){t._modeling.updateModdleProperties(e,i,{isCollection:!r.active})}var o=i.isCollection,a=[{id:"toggle-is-collection",className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}];return a},hy.prototype._getParticipantMultiplicity=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(i,r){var o,a=r.active;a||(o=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:o})}var o=e.businessObject.participantMultiplicity,a=[{id:"toggle-participant-multiplicity",className:"bpmn-icon-parallel-mi-marker",title:i("Participant Multiplicity"),active:!!o,action:r}];return a},hy.prototype._getAdHocEntry=function(e){var t=this._translate,n=Xo(e),i=Ko(n,"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement,o={id:"toggle-adhoc",className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:i,action:function(t,n){return r(e,i?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"},{autoResize:!1,layoutConnection:!1})}};return o};var dy={__depends__:[Zu,Yv,Ph],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",hy]};function fy(e,t){"string"===typeof t&&(t=[t]);while(e=e.parent)if(Yo(e,t))return e;return null}var my=Math.max,vy=Math.min,yy=20;function gy(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function by(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return-1!==t.indexOf("n")?(o.y=e.y+r,o.height=e.height-r):-1!==t.indexOf("s")&&(o.height=e.height+r),-1!==t.indexOf("e")?o.width=e.width+i:-1!==t.indexOf("w")&&(o.x=e.x+i,o.width=e.width-i),o}function xy(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 _y(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return v(r)&&(i=(/top|left/.test(e)?vy:my)(i,r)),v(o)&&(i=(/top|left/.test(e)?my:vy)(i,o)),i}function Ey(e,t){if(!t)return e;var n=mn(e);return vn({top:_y("top",n,t),right:_y("right",n,t),bottom:_y("bottom",n,t),left:_y("left",n,t)})}function wy(e,t,n,i){var r=mn(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?mn(i):o,s={top:vy(o.top,a.top),left:vy(o.left,a.left),bottom:my(o.bottom,a.bottom),right:my(o.right,a.right)};return vn(s)}function Sy(e,t){return"undefined"!==typeof e?e:yy}function Cy(e,t){var n,i,r,o;return"object"===typeof t?(n=Sy(t.left),i=Sy(t.right),r=Sy(t.top),o=Sy(t.bottom)):n=i=r=o=Sy(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function Ay(e){return!e.waypoints&&"label"!==e.type}function ky(e,t){var n;if(n=void 0===e.length?w(e.children,Ay):e,n.length)return Cy(Wt(n),t)}var Ty=Math.abs;function Ry(e,t){return gy(mn(t),mn(e))}var Dy=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Py=30;function My(e,t){return t=t||[],e.children.filter((function(e){Ko(e,"bpmn:Lane")&&(My(e,t),t.push(e))})),t}function By(e){return e.children.filter((function(e){return Ko(e,"bpmn:Lane")}))}function Ny(e){return fy(e,Dy)||e}function Oy(e,t){var n=Ny(e),i=Ko(n,"bpmn:Process")?[]:[n],r=My(n,i),o=mn(e),a=mn(t),s=Ry(e,t),c=[];return r.forEach((function(t){if(t!==e){var n=0,i=s.right,r=0,p=s.left,l=mn(t);s.top&&(Ty(l.bottom-o.top)<10&&(r=a.top-l.bottom),Ty(l.top-o.top)<5&&(n=a.top-l.top)),s.bottom&&(Ty(l.top-o.bottom)<10&&(n=a.bottom-l.top),Ty(l.bottom-o.bottom)<5&&(r=a.bottom-l.bottom)),(n||i||r||p)&&c.push({shape:t,newBounds:xy(t,{top:n,right:i,bottom:r,left:p})})}})),c}function jy(e,t,n,i,r,o,a,s,c,p,l,u){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=p,this._rules=l,this._translate=u,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context,n=t.shape;if(qs(e)&&i.isOpen(n)){var r=i.getEntries(n);r.replace&&r.replace.action.click(e,n)}}))}function Ly(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return S(o,(function(e){e.$type===n&&(r=!0)})),i&&r}function Iy(e,t){return-1!==e.indexOf(t)}jy.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate"],jy.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&V(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Remove"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},jy.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return f(t)?k(t,(function(e){return Iy(t,e)})):t},jy.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._rules,c=this._autoPlace,p=this._translate,l={};if("label"===e.type)return l;var u=e.businessObject;function h(e,t){r.start(e,t)}function d(e,t){n.removeElements([t])}function m(e){var n=5,i=t.getPad(e).html,r=i.getBoundingClientRect(),o={x:r.left,y:r.bottom+n};return o}function v(e,t,n,r){function a(t,n){var a=i.createShape(V({type:e},r));o.start(t,a,{source:n})}"string"!==typeof n&&(r=n,n=p("Append {type}",{type:e.replace(/^bpmn:/,"")}));var s=c?function(t,n){var o=i.createShape(V({type:e},r));c.append(n,o)}:a;return{group:"model",className:t,title:n,action:{dragstart:a,click:s}}}function y(e){return function(i,r){n.splitLane(r,e),t.open(r,!0)}}if(Yo(u,["bpmn:Lane","bpmn:Participant"])&&_a(e)){var g=By(e);V(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:p("Add Lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),g.length<2&&(e.height>=120&&V(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:p("Divide into two Lanes"),action:{click:y(2)}}}),e.height>=180&&V(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:p("Divide into three Lanes"),action:{click:y(3)}}})),V(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:p("Add Lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}Ko(u,"bpmn:FlowNode")&&(Ko(u,"bpmn:EventBasedGateway")?V(l,{"append.receive-task":v("bpmn:ReceiveTask","bpmn-icon-receive-task",p("Append ReceiveTask")),"append.message-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",p("Append MessageIntermediateCatchEvent"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",p("Append TimerIntermediateCatchEvent"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",p("Append ConditionIntermediateCatchEvent"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",p("Append SignalIntermediateCatchEvent"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Ly(u,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?V(l,{"append.compensation-activity":v("bpmn:Task","bpmn-icon-task",p("Append compensation activity"),{isForCompensation:!0})}):Ko(u,"bpmn:EndEvent")||u.isForCompensation||Ly(u,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||wa(u)||V(l,{"append.end-event":v("bpmn:EndEvent","bpmn-icon-end-event-none",p("Append EndEvent")),"append.gateway":v("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",p("Append Gateway")),"append.append-task":v("bpmn:Task","bpmn-icon-task",p("Append Task")),"append.intermediate-event":v("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",p("Append Intermediate/Boundary Event"))})),a.isEmpty(e,"bpmn-replace")||V(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:p("Change type"),action:{click:function(e,t){var n=V(m(t),{cursor:{x:e.x,y:e.y}});a.open(t,"bpmn-replace",n,{title:p("Change element"),width:300,search:!0})}}}}),Ko(u,"bpmn:SequenceFlow")&&V(l,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation")}),Yo(u,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation"),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using "+(u.isForCompensation?"":"Sequence/MessageFlow or ")+"Association"),action:{click:h,dragstart:h}}}),Ko(u,"bpmn:TextAnnotation")&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using Association"),action:{click:h,dragstart:h}}}),Yo(u,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using DataInputAssociation"),action:{click:h,dragstart:h}}}),Ko(u,"bpmn:Group")&&V(l,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation")});var b=s.allowed("elements.delete",{elements:[e]});return f(b)&&(b=b[0]===e),b&&V(l,{delete:{group:"edit",className:"bpmn-icon-trash",title:p("Remove"),action:{click:d}}}),l};var Fy={__depends__:[qm,Tl,uc,Ef,mv,dy],__init__:["contextPadProvider"],contextPadProvider:["type",jy]},$y=".djs-palette-toggle",zy=".entry",Hy=$y+", "+zy,Gy="djs-palette-",Vy="shown",Wy="open",Uy="two-column",qy=1e3;function Ky(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",(function(e){var t=e.tool;n.updateToolHighlight(t)})),e.on("i18n.changed",(function(){n._update()})),e.on("diagram.init",(function(){n._diagramInitialized=!0,n._rebuild()}))}function Yy(e,t){var n=ae(e),i=f(t)?t:t.split(/\s+/g);i.forEach((function(e){n.add(e)}))}function Xy(e,t){var n=t.getPaletteEntries();return y(n)?n(e):(S(n,(function(t,n){e[n]=t})),e)}Ky.$inject=["eventBus","canvas"],Ky.prototype.registerProvider=function(e,t){t||(t=e,e=qy),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},Ky.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(Xy,{})},Ky.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Ky.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ke(Ky.HTML_MARKUP);n.appendChild(i),ae(n).add(Gy+Vy),Ee.bind(i,Hy,"click",(function(t){var n=t.delegateTarget;if(Te(n,$y))return e.toggle();e.trigger("click",t)})),ye.bind(i,"mousedown",(function(e){e.stopPropagation()})),Ee.bind(i,zy,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Ky.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ky.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=ae(i),a=ae(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(Uy,t),a.toggle(Gy+Uy,t),"open"in e&&(o.toggle(Wy,e.open),a.toggle(Gy+Wy,e.open)),r.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},Ky.prototype._update=function(){var e=Re(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ce(e),S(t,(function(t,n){var i=t.group||"default",r=Re("[data-group="+Rc(i)+"]",e);r||(r=ke('<div class="group"></div>'),re(r,"data-group",i),e.appendChild(r));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),a=ke(o);if(r.appendChild(a),!t.separator&&(re(a,"data-action",n),t.title&&re(a,"title",t.title),t.className&&Yy(a,t.className),t.imageUrl)){var s=ke("<img>");re(s,"src",t.imageUrl),a.appendChild(s)}})),this.open()},Ky.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=re(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Ky.prototype.triggerEntry=function(e,t,n,i){var r,o,a=this._entries;if(r=a[e],r&&(o=r.action,!1!==this._eventBus.fire("palette.trigger",{entry:r,event:n}))){if(y(o)){if("click"===t)return o(n,i)}else if(o[t])return o[t](n,i);n.preventDefault()}},Ky.prototype._layoutChanged=function(){this._toggleState({})},Ky.prototype._needsCollapse=function(e,t){var n=50,i=46*Object.keys(t).length;return e<i+n},Ky.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ky.prototype.open=function(){this._toggleState({open:!0})},Ky.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},Ky.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ky.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Re(".djs-palette-entries",this._container),this._toolsContainer=Re("[data-group=tools]",t)),n=this._toolsContainer,S(n.children,(function(t){var n=t.getAttribute("data-action");if(n){var i=ae(t);n=n.replace("-tool",""),i.contains("entry")&&n===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}}))},Ky.prototype.isOpen=function(){return ae(this._container).has(Wy)},Ky.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ky.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var Zy={__init__:["palette"],palette:["type",Ky]},Jy={id:"events",name:"Events"},Qy={id:"tasks",name:"Tasks"},eg={id:"data",name:"Data"},tg={id:"participants",name:"Participants"},ng={id:"subprocess",name:"Sub Processes"},ig={id:"gateways",name:"Gateways"},rg=[{label:"Start Event",actionName:"none-start-event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"Boundary Event",actionName:"none-boundary-event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},{label:"End Event",actionName:"none-end-event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}}].map(e=>({...e,group:Jy})),og=[{label:"Message Start Event",actionName:"message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Start Event",actionName:"timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional Start Event",actionName:"conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal Start Event",actionName:"signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}].map(e=>({...e,group:Jy})),ag=[{label:"Message Intermediate Catch Event",actionName:"message-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message Intermediate Throw Event",actionName:"message-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Intermediate Catch Event",actionName:"timer-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Intermediate Throw Event",actionName:"escalation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Intermediate Catch Event",actionName:"conditional-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Link Intermediate Catch Event",actionName:"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:"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:"compensation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal Intermediate Catch Event",actionName:"signal-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal Intermediate Throw Event",actionName:"signal-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}].map(e=>({...e,group:Jy})),sg=[{label:"Message Boundary Event",actionName:"message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Boundary Event",actionName:"timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Boundary Event",actionName:"escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Boundary Event",actionName:"conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Error Boundary Event",actionName:"error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel Boundary Event",actionName:"cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Signal Boundary Event",actionName:"signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Compensation Boundary Event",actionName:"compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Boundary Event (non-interrupting)",actionName:"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:"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:"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:"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:"non-interrupting-signal-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}}].map(e=>({...e,group:Jy})),cg=[{label:"Message End Event",actionName:"message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Escalation End Event",actionName:"escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Error End Event",actionName:"error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel End Event",actionName:"cancel-end",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Compensation End Event",actionName:"compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal End Event",actionName:"signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Terminate End Event",actionName:"terminate-end",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}].map(e=>({...e,group:Jy})),pg=[{label:"Exclusive Gateway",actionName:"exclusive-gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},{label:"Parallel Gateway",actionName:"parallel-gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},{label:"Inclusive Gateway",search:"or",actionName:"inclusive-gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"},rank:-1},{label:"Complex Gateway",actionName:"complex-gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"},rank:-1},{label:"Event based Gateway",actionName:"event-based-gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}}].map(e=>({...e,group:ig})),lg=[{label:"Transaction",actionName:"transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event Sub Process",search:"subprocess",actionName:"event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Sub Process (collapsed)",search:"subprocess",actionName:"collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},{label:"Sub Process (expanded)",search:"subprocess",actionName:"expanded-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!0}}].map(e=>({...e,group:ng})),ug=[{label:"Task",actionName:"task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"User Task",actionName:"user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Service Task",actionName:"service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{label:"Send Task",actionName:"send-task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"},rank:-1},{label:"Receive Task",actionName:"receive-task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"},rank:-1},{label:"Manual Task",actionName:"manual-task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"},rank:-1},{label:"Business Rule Task",actionName:"rule-task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},{label:"Script Task",actionName:"script-task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},{label:"Call Activity",actionName:"call-activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}}].map(e=>({...e,group:Qy})),hg=[{label:"Data Store Reference",actionName:"data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},{label:"Data Object Reference",actionName:"data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}].map(e=>({...e,group:eg})),dg=[{label:"Expanded Pool",search:"Participant",actionName:"expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:"Empty Pool",search:"Collapsed Participant",actionName:"collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}].map(e=>({...e,group:tg})),fg=[...pg,...ug,...lg,...rg,...og,...ag,...cg,...sg,...hg,...dg];function mg(e,t,n,i,r,o){this._elementFactory=e,this._popupMenu=t,this._create=n,this._autoPlace=i,this._mouse=r,this._translate=o,this.register()}mg.$inject=["elementFactory","popupMenu","create","autoPlace","mouse","translate"],mg.prototype.register=function(){this._popupMenu.registerProvider("bpmn-create",this)},mg.prototype.getPopupMenuEntries=function(){const e={};return fg.forEach(t=>{const{actionName:n,className:i,label:r,target:o,description:a,group:s,search:c,rank:p}=t,l=this._createEntryAction(o);e["create-"+n]={label:r&&this._translate(r),className:i,description:a,group:s&&{...s,name:this._translate(s.name)},search:c,rank:p,action:{click:l,dragstart:l}}}),e},mg.prototype._createEntryAction=function(e){const t=this._create,n=this._mouse,i=this._popupMenu,r=this._elementFactory;let o;return a=>(i.close(),o="bpmn:Participant"===e.type?r.createParticipantShape(e):r.create("shape",e),a instanceof KeyboardEvent&&(a=n.getLastMoveEvent()),t.start(a,o))};const vg="data:image/svg+xml,%3Csvg%20width%3D%2222%22%20height%3D%2222%22%20viewBox%3D%220%200%205.82%205.82%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%3Cpath%20d%3D%22M1.3%203.4c.3%200%20.5-.2.5-.5s-.2-.4-.5-.4c-.2%200-.4.1-.4.4%200%20.3.2.5.4.5zM3%203.4c.2%200%20.4-.2.4-.5s-.2-.4-.4-.4c-.3%200-.5.1-.5.4%200%20.3.2.5.5.5zM4.6%203.4c.2%200%20.4-.2.4-.5s-.2-.4-.4-.4c-.3%200-.5.1-.5.4%200%20.3.2.5.5.5z%22%2F%3E%0A%3C%2Fsvg%3E",yg="data:image/svg+xml,%3Csvg%20width%3D%2246%22%20height%3D%2246%22%20viewBox%3D%22-2%20-2%209.82%209.82%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M1.3%203.4c.3%200%20.5-.2.5-.5s-.2-.4-.5-.4c-.2%200-.4.1-.4.4%200%20.3.2.5.4.5zM3%203.4c.2%200%20.4-.2.4-.5s-.2-.4-.4-.4c-.3%200-.5.1-.5.4%200%20.3.2.5.5.5zM4.6%203.4c.2%200%20.4-.2.4-.5s-.2-.4-.4-.4c-.3%200-.5.1-.5.4%200%20.3.2.5.5.5z%22%2F%3E%0A%3C%2Fsvg%3E";function gg(e,t,n,i,r){this._translate=t,this._popupMenu=n,this._canvas=i,this._mouse=r,e.registerProvider(800,this)}function bg(e){this._injector=e,this.registerActions()}function xg(e){this._injector=e,this._keyboard=this._injector.get("keyboard",!1),this._editorActions=this._injector.get("editorActions",!1),this._keyboard&&this._injector.invoke(xp,this)}function _g(e,t,n,i,r,o,a){this._elementFactory=e,this._popupMenu=t,this._create=n,this._autoPlace=i,this._rules=r,this._create=n,this._mouse=o,this._translate=a,this.register()}gg.$inject=["palette","translate","popupMenu","canvas","mouse"],gg.prototype.getPaletteEntries=function(e){const t=this._translate,n=this._popupMenu,i=this._canvas,r=this._mouse,o=e=>{const t=35,n=10;if(e instanceof KeyboardEvent)return e=r.getLastMoveEvent(),{x:e.x,y:e.y};const i=e&&e.target||Re('.djs-palette [data-action="create"]'),o=i.getBoundingClientRect();return i&&{x:o.left+o.width/2+t,y:o.top+o.height/2+n}};return{create:{group:"create",imageUrl:yg,title:t("Create element"),action:{click:function(e){const r=o(e),a=i.getRootElement();n.open(a,"bpmn-create",r,{title:t("Create element"),width:300,search:!0})}}}}},bg.$inject=["injector"],bg.prototype.registerActions=function(){var e=this._injector.get("editorActions",!1),t=this._injector.get("selection",!1),n=this._injector.get("contextPad",!1),i=this._injector.get("palette",!1),r=this._injector.get("popupMenu",!1);const o={};t&&n&&i&&r&&i&&V(o,{appendElement:function(e){const o=t&&t.get();1!=o.length||r.isEmpty(o[0],"bpmn-append")?i.triggerEntry("create","click",e):n.triggerEntry("append","click",e)}}),i&&V(o,{createElement:function(e){i.triggerEntry("create","click",e)}}),e&&e.register(o)},i(xg,xp),xg.$inject=["injector"],xg.prototype.registerBindings=function(){var e=this._keyboard,t=this._editorActions;function n(n,i){t&&t.isRegistered(n)&&e&&e.addListener(i)}xp.prototype.registerBindings.call(this,e,t),n("appendElement",(function(n){var i=n.keyEvent;if(!e||!e.hasModifier(i))return e&&e.isKey(["a","A"],i)?(t&&t.trigger("appendElement",i),!0):void 0})),n("createElement",(function(n){var i=n.keyEvent;if(!e||!e.hasModifier(i))return e&&e.isKey(["n","N"],i)?(t&&t.trigger("createElement",i),!0):void 0}))},_g.$inject=["elementFactory","popupMenu","create","autoPlace","rules","mouse","translate"],_g.prototype.register=function(){this._popupMenu.registerProvider("bpmn-append",this)},_g.prototype.getPopupMenuEntries=function(e){const t=this._rules,n=this._translate,i={};if(!t.allowed("shape.append",{element:e}))return[];const r=this._filterEntries(fg);return r.forEach(t=>{const{actionName:r,className:o,label:a,target:s,description:c,group:p,search:l,rank:u}=t;i["append-"+r]={label:a&&n(a),className:o,description:c,group:p&&{...p,name:n(p.name)},search:l,rank:u,action:this._createEntryAction(e,s)}}),i},_g.prototype._filterEntries=function(e){return e.filter(e=>{const t=e.target,{type:n,eventDefinitionType:i}=t;return!["bpmn:StartEvent","bpmn:Participant"].includes(n)&&("bpmn:BoundaryEvent"!==n||!u(i))})},_g.prototype._createEntryAction=function(e,t){const n=this._elementFactory,i=this._autoPlace,r=this._create,o=this._mouse,a=()=>{const r=n.create("shape",t);i.append(e,r)},s=i=>{const a=n.create("shape",t);return i instanceof KeyboardEvent&&(i=o.getLastMoveEvent()),r.start(i,a,{source:e})};return{click:this._canAutoPlaceElement(t)?a:s,dragstart:s}},_g.prototype._canAutoPlaceElement=e=>{const{type:t}=e;return"bpmn:BoundaryEvent"!==t&&(("bpmn:SubProcess"!==t||!e.triggeredByEvent)&&("bpmn:IntermediateCatchEvent"!==t||"bpmn:LinkEventDefinition"!==e.eventDefinitionType))};var Eg=900;function wg(e,t,n,i){e.registerProvider(Eg,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}function Sg(e){rh.call(this,e)}function Cg(e,t){var n=Xo(e);return!!_(n.eventDefinitions||[],(function(e){return Ko(e,t)}))}function Ag(e){return e.waypoints}wg.$inject=["contextPad","popupMenu","translate","canvas"],wg.prototype.getContextPadEntries=function(e){const t=this._popupMenu,n=this._translate,i=this._getAppendMenuPosition.bind(this);if(!t.isEmpty(e,"bpmn-append"))return{append:{group:"model",imageUrl:vg,title:n("Append element"),action:{click:function(e,r){var o=V(i(r),{cursor:{x:e.x,y:e.y}});t.open(r,"bpmn-append",o,{title:n("Append element"),width:300,search:!0})}}}}},wg.prototype._getAppendMenuPosition=function(e){const t=this._contextPad,n=5,i=t.getPad(e).html,r=i.getBoundingClientRect(),o={x:r.right+n,y:r.top};return o},i(Sg,rh),Sg.$inject=["eventBus"],Sg.prototype.init=function(){this.addRule("shape.append",(function(e){var t=e.element;const n=Xo(t);return!Ds(t)&&(!Yo(t,["bpmn:EndEvent","bpmn:Group","bpmn:TextAnnotation","bpmn:Lane","bpmn:Participant","bpmn:DataStoreReference","bpmn:DataObjectReference"])&&(!Ag(t)&&((!Ko(t,"bpmn:IntermediateThrowEvent")||!Cg(t,"bpmn:LinkEventDefinition"))&&((!Ko(t,"bpmn:SubProcess")||!n.triggeredByEvent)&&void 0))))}))};var kg={__depends__:[Zy,Zu,wh,Tl],__init__:["createMenuProvider","createPaletteProvider","createAppendEditorActions","createAppendKeyboardBindings","appendMenuProvider","appendContextPadProvider","appendRules"],createMenuProvider:["type",mg],createPaletteProvider:["type",gg],createAppendEditorActions:["type",bg],createAppendKeyboardBindings:["type",xg],appendMenuProvider:["type",_g],appendContextPadProvider:["type",wg],appendRules:["type",Sg]},Tg={horizontal:["x","width"],vertical:["y","height"]},Rg=5;function Dg(e,t){this._modeling=e,this._filters=[],this.registerFilter((function(e){var n=t.allowed("elements.distribute",{elements:e});return f(n)?n:n?e:[]}))}Dg.$inject=["modeling","rules"],Dg.prototype.registerFilter=function(e){if("function"!==typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Dg.prototype.trigger=function(e,t){var n,i,r=this._modeling;if(!(e.length<3)&&(this._setOrientation(t),i=this._filterElements(e),n=this._createGroups(i),!(n.length<=2)))return r.distributeElements(n,this._axis,this._dimension),n},Dg.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(S(t,(function(e){r=e(r,n,i)})),r):e},Dg.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=j(e,i);return S(o,(function(e,o){var a,s=n._findRange(e,i,r),c=t[t.length-1];c&&n._hasIntersection(c.range,s)?t[t.length-1].elements.push(e):(a={range:s,elements:[e]},t.push(a))})),t},Dg.prototype._setOrientation=function(e){var t=Tg[e];this._axis=t[0],this._dimension=t[1]},Dg.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)},Dg.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Rg,max:t+n-Rg}};var Pg={__init__:["distributeElements"],distributeElements:["type",Dg]};function Mg(e,t,n){rh.call(this,t)}Mg.$inject=["distributeElements","eventBus","rules"],i(Mg,rh),Mg.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return t=w(t,(function(e){var t=Yo(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})),t=It(t),!(t.length<3)&&t}))};var Bg={horizontal:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201800%201800%22%3E%3Cpath%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linejoin%3Around%22%20d%3D%22M450%20400V150h900v250%22%2F%3E%3Crect%20x%3D%22150%22%20y%3D%22450%22%20width%3D%22600%22%20height%3D%221200%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%221050%22%20y%3D%22450%22%20width%3D%22600%22%20height%3D%22800%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E",vertical:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201800%201800%22%3E%3Cpath%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linejoin%3Around%22%20d%3D%22M400%201350H150V450h250%22%2F%3E%3Crect%20x%3D%22450%22%20y%3D%22150%22%20width%3D%221200%22%20height%3D%22600%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%22450%22%20y%3D%221050%22%20width%3D%22800%22%20height%3D%22600%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E"},Ng=Bg,Og=900;function jg(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",Og,this)}jg.$inject=["popupMenu","distributeElements","translate","rules"],jg.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},jg.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},jg.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageUrl:Ng["horizontal"],action:function(n,r){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageUrl:Ng["vertical"],action:function(n,r){t.trigger(e,"vertical"),i.close()}}};return r};var Lg={__depends__:[Zu,Pg],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Mg],distributeElementsMenuProvider:["type",jg]},Ig="is not a registered action",Fg="is already registered";function $g(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function zg(e,t){return new Error(e+" "+t)}$g.$inject=["eventBus","injector"],$g.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=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&&i&&this.register("copy",(function(){var e=i.get();if(e.length)return o.copy(e)})),o&&this.register("paste",(function(){o.paste()})),r&&this.register("stepZoom",(function(e){r.stepZoom(e.value)})),a&&this.register("zoom",(function(e){a.zoom(e.value)})),n&&i&&s&&this.register("removeSelection",(function(){var e=i.get();if(e.length){var t,r=s.allowed("elements.delete",{elements:e});!1!==r&&(t=f(r)?r:e,t.length&&n.removeElements(t.slice()))}})),c&&this.register("moveCanvas",(function(e){c.moveCanvas(e)})),p&&this.register("moveSelection",(function(e){p.moveSelection(e.direction,e.accelerated)}))},$g.prototype.trigger=function(e,t){if(!this._actions[e])throw zg(e,Ig);return this._actions[e](t)},$g.prototype.register=function(e,t){var n=this;if("string"===typeof e)return this._registerAction(e,t);S(e,(function(e,t){n._registerAction(t,e)}))},$g.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw zg(e,Fg);this._actions[e]=t},$g.prototype.unregister=function(e){if(!this.isRegistered(e))throw zg(e,Ig);this._actions[e]=void 0},$g.prototype.getActions=function(){return Object.keys(this._actions)},$g.prototype.isRegistered=function(e){return!!this._actions[e]};var Hg={__init__:["editorActions"],editorActions:["type",$g]};function Gg(e){e.invoke($g,this)}i(Gg,$g),Gg.$inject=["injector"],Gg.prototype._registerDefaultActions=function(e){$g.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=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),l=e.get("directEditing",!1),u=e.get("searchPad",!1),h=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",(function(){var e=t.getRootElement(),r=n.filter((function(t){return t!==e}));return i.select(r),r})),r&&this._registerAction("spaceTool",(function(){r.toggle()})),o&&this._registerAction("lassoTool",(function(){o.toggle()})),a&&this._registerAction("handTool",(function(){a.toggle()})),s&&this._registerAction("globalConnectTool",(function(){s.toggle()})),i&&c&&this._registerAction("distributeElements",(function(e){var t=i.get(),n=e.type;t.length&&c.trigger(t,n)})),i&&p&&this._registerAction("alignElements",(function(e){var t=i.get(),n=[],r=e.type;t.length&&(n=w(t,(function(e){return!Ko(e,"bpmn:Lane")})),p.trigger(n,r))})),i&&h&&this._registerAction("setColor",(function(e){var t=i.get();t.length&&h.setColor(t,e)})),i&&l&&this._registerAction("directEditing",(function(){var e=i.get();e.length&&l.activate(e[0])})),u&&this._registerAction("find",(function(){u.toggle()})),t&&h&&this._registerAction("moveToOrigin",(function(){var e,i,r=t.getRootElement();i=Ko(r,"bpmn:Collaboration")?n.filter((function(e){return Ko(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==r&&!Ko(e.parent,"bpmn:SubProcess")})),e=Wt(i),h.moveElements(i,{x:-e.x,y:-e.y},r)})),i&&d&&this._registerAction("replaceElement",(function(e){d.triggerEntry("replace","click",e)}))};var Vg={__depends__:[Hg],editorActions:["type",Gg]};function Wg(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context,n=e.shape;Yo(n,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}Wg.$inject=["eventBus"];var Ug=10;function qg(e,t,n){return n||(n="round"),Math[n](e/t)*t}var Kg=1200,Yg=800;function Xg(e,t,n){var i=!n||!1!==n.active;this._eventBus=t;var r=this;t.on("diagram.init",Yg,(function(){r.setActive(i)})),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"],Kg,(function(t){var n=t.originalEvent;if(!(!r.active||n&&ap(n))){var i=t.context,o=i.gridSnappingContext;o||(o=i.gridSnappingContext={}),["x","y"].forEach((function(n){var i={},o=Jg(t,n,e);o&&(i.offset=o);var a=Zg(t,n);a&&V(i,a),af(t,n)||r.snapEvent(t,n,i)}))}}))}function Zg(e,t){var n=e.context,i=n.createConstraints,r=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;i&&(Qg(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,p=r.max;return c&&(Qg(t)?tb(s)?a.x.max=c.left:a.x.min=c.right:eb(s)?a.y.max=c.top:a.y.min=c.bottom),p&&(Qg(t)?tb(s)?a.x.min=p.left:a.x.max=p.right:eb(s)?a.y.min=p.top:a.y.max=p.bottom),a[t]}function Jg(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&v(s[t])?s[t]:(s||(s=o.snapOffset={}),v(s[t])||(s[t]=0),r?(n.get(r.id)||(Qg(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),a?("x"===t?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2),s[t]):s[t]):s[t])}function Qg(e){return"x"===e}function eb(e){return-1!==e.indexOf("n")}function tb(e){return-1!==e.indexOf("w")}function nb(e,t){Sc.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",(function(e){var t=e.context,i=t.hints||{},r=i.autoResize;if(r){var o=t.shape,a=t.newBounds;g(r)?t.newBounds=n.snapComplex(a,r):t.newBounds=n.snapSimple(o,a)}}))}Xg.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);sf(e,t,i)},Xg.prototype.getGridSpacing=function(){return Ug},Xg.prototype.snapValue=function(e,t){var n,i,r=0;return t&&t.offset&&(r=t.offset),e+=r,e=qg(e,Ug),t&&t.min&&(n=t.min,v(n)&&(n=qg(n+r,Ug,"ceil"),e=Math.max(e,n))),t&&t.max&&(i=t.max,v(i)&&(i=qg(i+r,Ug,"floor"),e=Math.min(e,i))),e-=r,e},Xg.prototype.isActive=function(){return this.active},Xg.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Xg.prototype.toggleActive=function(){this.setActive(!this.active)},Xg.$inject=["elementRegistry","eventBus","config.gridSnapping"],nb.$inject=["eventBus","gridSnapping","modeling"],i(nb,Sc),nb.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},nb.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},nb.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(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),V(e,o),e},nb.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(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),V(e,o),e};var ib=2e3;function rb(e,t){e.on(["spaceTool.move","spaceTool.end"],ib,(function(e){var n=e.context;if(n.initialized){var i,r=n.axis;"x"===r?(i=t.snapValue(e.dx),e.x=e.x+i-e.dx,e.dx=i):(i=t.snapValue(e.dy),e.y=e.y+i-e.dy,e.dy=i)}}))}rb.$inject=["eventBus","gridSnapping"];var ob={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",nb],gridSnappingSpaceToolBehavior:["type",rb]},ab={__depends__:[ob],__init__:["gridSnapping"],gridSnapping:["type",Xg]},sb=2e3;function cb(e,t){e.on("autoPlace",sb,(function(e){var n=e.source,i=bn(n),r=e.shape,o=Sh(n,r);return["x","y"].forEach((function(e){var n={};o[e]!==i[e]&&(o[e]>i[e]?n.min=o[e]:n.max=o[e],Ko(r,"bpmn:TextAnnotation")&&(pb(e)?n.offset=-r.width/2:n.offset=-r.height/2),o[e]=t.snapValue(o[e],n))})),o}))}function pb(e){return"x"===e}cb.$inject=["eventBus","gridSnapping"];var lb=1750;function ub(e,t,n){t.on(["create.start","shape.move.start"],lb,(function(t){var i=t.context,r=i.shape,o=e.getRootElement();if(Ko(r,"bpmn:Participant")&&Ko(o,"bpmn:Process")&&o.children.length){var a=i.createConstraints;a&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height}))}}))}ub.$inject=["canvas","eventBus","gridSnapping"];var hb=3e3;function db(e,t,n){Sc.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],hb,(function(e){var t=e.context,r=t.connection,o=t.hints||{},a=r.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||fb(a)&&n.updateWaypoints(r,i.snapMiddleSegments(a))}))}function fb(e){return e.length>3}function mb(e){return"h"===e}function vb(e){return"v"===e}function yb(e,t,n){var i=sn(t,n),r={};return mb(i)&&(r.y=e.snapValue(t.y)),vb(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=V({},t,r),n=V({},n,r)),[t,n]}db.$inject=["eventBus","gridSnapping","modeling"],i(db,Sc),db.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var i=1;i<e.length-2;i++)t=yb(n,e[i],e[i+1]),e[i]=t[0],e[i+1]=t[1];return e};var gb={__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",cb],gridSnappingParticipantBehavior:["type",ub],gridSnappingLayoutConnectionBehavior:["type",db]},bb={__depends__:[ab,gb],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Wg]},xb=30,_b=30;function Eb(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,i=e.gfx;return Ko(t,"bpmn:Lane")?n.createParticipantHit(t,i):Ko(t,"bpmn:Participant")?_a(t)?n.createParticipantHit(t,i):n.createDefaultHit(t,i):Ko(t,"bpmn:SubProcess")?_a(t)?n.createSubProcessHit(t,i):n.createDefaultHit(t,i):void 0}))}Eb.$inject=["eventBus","interactionEvents"],Eb.prototype.createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Eb.prototype.createParticipantHit=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:xb,height:e.height}),!0},Eb.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:_b}),!0};var wb={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Eb]};function Sb(e){e.invoke(xp,this)}i(Sb,xp),Sb.$inject=["injector"],Sb.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}xp.prototype.registerBindings.call(this,e,t),n("selectElements",(function(n){var i=n.keyEvent;if(e.isKey(["a","A"],i)&&e.isCmd(i))return t.trigger("selectElements"),!0})),n("find",(function(n){var i=n.keyEvent;if(e.isKey(["f","F"],i)&&e.isCmd(i))return t.trigger("find"),!0})),n("spaceTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["s","S"],i)?(t.trigger("spaceTool"),!0):void 0})),n("lassoTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["l","L"],i)?(t.trigger("lassoTool"),!0):void 0})),n("handTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["h","H"],i)?(t.trigger("handTool"),!0):void 0})),n("globalConnectTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["c","C"],i)?(t.trigger("globalConnectTool"),!0):void 0})),n("directEditing",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["e","E"],i)?(t.trigger("directEditing"),!0):void 0})),n("replaceElement",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["r","R"],i)?(t.trigger("replaceElement",i),!0):void 0}))};var Cb={__depends__:[_p],__init__:["keyboardBindings"],keyboardBindings:["type",Sb]},Ab={moveSpeed:1,moveSpeedAccelerated:10},kb=1500,Tb="left",Rb="up",Db="right",Pb="down",Mb={ArrowLeft:Tb,Left:Tb,ArrowUp:Rb,Up:Rb,ArrowRight:Db,Right:Db,ArrowDown:Pb,Down:Pb},Bb={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 Nb(e,t,n,i,r){var o=this;this._config=V({},Ab,e||{}),t.addListener(kb,(function(e){var n=e.keyEvent,i=Mb[n.key];if(i&&!t.isCmd(n)){var r=t.isShift(n);return o.moveSelection(i,r),!0}})),this.moveSelection=function(e,t){var o=r.get();if(o.length){var a=this._config[t?"moveSpeedAccelerated":"moveSpeed"],s=Bb[e](a),c=i.allowed("elements.move",{shapes:o});c&&n.moveElements(o,s)}}}Nb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var Ob={__depends__:[_p,uc],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Nb]},jb=10;function Lb(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(e,t){var n,i=e.shape,o=e.direction,a=e.resizeConstraints;e.delta=t,n=by(i,o,t),e.newBounds=Ey(n,a),e.canExecute=r.canResize(e)}function a(e){var t=e.resizeConstraints,n=e.minBounds;void 0===t&&(void 0===n&&(n=r.computeMinResizeBox(e)),e.resizeConstraints={min:mn(n)})}function s(e){var t=e.shape,i=e.canExecute,r=e.newBounds;if(i){if(r=dn(r),!Ib(t,r))return;n.resizeShape(t,r)}}e.on("resize.start",(function(e){a(e.context)})),e.on("resize.move",(function(e){var t={x:e.dx,y:e.dy};o(e.context,t)})),e.on("resize.end",(function(e){s(e.context)}))}function Ib(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Fb(e,t){var n=bn(e),i=mn(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=i.top:-1!==t.indexOf("s")&&(r.y=i.bottom),-1!==t.indexOf("e")?r.x=i.right:-1!==t.indexOf("w")&&(r.x=i.left),r}function $b(e){var t="resize-";return"n"===e||"s"===e?t+"ns":"e"===e||"w"===e?t+"ew":"nw"===e||"se"===e?t+"nwse":t+"nesw"}Lb.prototype.canResize=function(e){var t=this._rules,n=U(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Lb.prototype.activate=function(e,t,n){var i,r,o=this._dragging;if("string"===typeof n&&(n={direction:n}),i=V({shape:t},n),r=i.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,Fb(t,r),"resize",{autoActivate:!0,cursor:$b(r),data:{shape:t,context:i}})},Lb.prototype.computeMinResizeBox=function(e){var t,n,i=e.shape,r=e.direction;return t=e.minDimensions||{width:jb,height:jb},n=ky(i,e.childrenBoxPadding),wy(r,i,t,n)},Lb.$inject=["eventBus","rules","modeling","dragging"];var zb="djs-resizing",Hb="resize-not-ok",Gb=500;function Vb(e,t,n){function i(e){var i=e.shape,r=e.newBounds,o=e.frame;o||(o=e.frame=n.addFrame(i,t.getActiveLayer()),t.addMarker(i,zb)),r.width>5&&$e(o,{x:r.x,width:r.width}),r.height>5&&$e(o,{y:r.y,height:r.height}),e.canExecute?He(o).remove(Hb):He(o).add(Hb)}function r(e){var n=e.shape,i=e.frame;i&&ht(e.frame),t.removeMarker(n,zb)}e.on("resize.move",Gb,(function(e){i(e.context)})),e.on("resize.cleanup",(function(e){r(e.context)}))}Vb.$inject=["eventBus","canvas","previewSupport"];var Wb=-6,Ub=8,qb=20,Kb="djs-resizer",Yb=["n","w","s","e","nw","ne","se","sw"];function Xb(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",(function(e){var t=e.newSelection;r.removeResizers(),1===t.length&&S(t,G(r.addResizer,r))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))}))}function Zb(e){var t={x:0,y:0};return-1!==e.indexOf("e")?t.x=-Wb:-1!==e.indexOf("w")&&(t.x=Wb),-1!==e.indexOf("s")?t.y=-Wb:-1!==e.indexOf("n")&&(t.y=Wb),t}function Jb(e){return!!e.waypoints}Xb.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(t){Ws(t)&&i.activate(t,e,n)}ye.bind(t,"mousedown",r),ye.bind(t,"touchstart",r)},Xb.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=Zb(i),a=Xe("g");He(a).add(Kb),He(a).add(Kb+"-"+e.id),He(a).add(Kb+"-"+i),Ne(r,a);var s=Xe("rect");$e(s,{x:-Ub/2+o.x,y:-Ub/2+o.y,width:Ub,height:Ub}),He(s).add(Kb+"-visual"),Ne(a,s);var c=Xe("rect");return $e(c,{x:-qb/2+o.x,y:-qb/2+o.y,width:qb,height:qb}),He(c).add(Kb+"-hit"),Ne(a,c),ci(a,t,n),a},Xb.prototype.createResizer=function(e,t){var n=Fb(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Xb.prototype.addResizer=function(e){var t=this;!Jb(e)&&this._resize.canResize({shape:e})&&S(Yb,(function(n){t.createResizer(e,n)}))},Xb.prototype.removeResizers=function(){var e=this._getResizersParent();Ve(e)},Xb.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Xb.$inject=["eventBus","canvas","selection","resize"];var Qb={__depends__:[ed,Yh,tv],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Lb],resizePreview:["type",Vb],resizeHandles:["type",Xb]},ex=2e3;function tx(e,t,n,i,r,o,a){function s(e,t){(t||Yo(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||nx(e))&&i.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",(function(e){s(e.element,!0)})),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],(function(e){i.isActive()&&i.complete()})),e.on(["shape.remove","connection.remove"],ex,(function(e){i.isActive(e.element)&&i.cancel()})),e.on(["commandStack.changed"],(function(e){i.isActive()&&i.cancel()})),e.on("directEditing.activate",(function(e){o.removeResizers()})),e.on("create.end",500,(function(e){var t=e.context,n=t.shape,i=e.context.canExecute,r=e.isTouch;r||i&&(t.hints&&!1===t.hints.createElementsBehavior||s(n))})),e.on("autoPlace.end",500,(function(e){s(e.shape)}))}function nx(e){return Ko(e,"bpmn:SubProcess")&&!_a(e)}function ix(e){return Ko(e,"bpmn:SubProcess")&&_a(e)}function rx(e){return Ko(e,"bpmn:Participant")&&!_a(e)}function ox(e){return Ko(e,"bpmn:Participant")&&_a(e)}function ax(e){return!e||!e.trim()}tx.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],tx.prototype.activate=function(e){var t=Da(e);if(void 0!==t){var n={text:t},i=this.getEditingBBox(e);V(n,i);var r={};return(Yo(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||nx(e))&&V(r,{centerVertically:!0}),Ss(e)&&V(r,{autoResize:!0}),Ko(e,"bpmn:TextAnnotation")&&V(r,{resizable:!0,autoResize:!0}),V(n,{options:r}),n}},tx.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),p=c.fontSize*a,l=c.lineHeight,u=s.fontSize*a,h=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(Ko(e,"bpmn:Lane")||ox(e))&&(V(o,{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}),V(d,{fontSize:u+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:"rotate(-90deg)"})),(Yo(e,["bpmn:Task","bpmn:CallActivity"])||rx(e)||nx(e))&&(V(o,{width:i.width,height:i.height}),V(d,{fontSize:u+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),ix(e)&&(V(o,{width:i.width,x:i.x}),V(d,{fontSize:u+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var f=90*a,m=7*a,v=4*a;if(n.labelTarget&&(V(o,{width:f,height:i.height+m+v,x:r.x-f/2,y:i.y-m}),V(d,{fontSize:p+"px",lineHeight:l,paddingTop:m+"px",paddingBottom:v+"px"})),Ss(n)&&!Cs(n)&&!Ds(n)){var y=Ts(e),g=t.getAbsoluteBBox({x:y.x,y:y.y,width:0,height:0}),b=p+m+v;V(o,{width:f,height:b,x:g.x-f/2,y:g.y-b/2}),V(d,{fontSize:p+"px",lineHeight:l,paddingTop:m+"px",paddingBottom:v+"px"})}return Ko(e,"bpmn:TextAnnotation")&&(V(o,{width:i.width,height:i.height,minWidth:30*a,minHeight:10*a}),V(d,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:u+"px",lineHeight:h})),{bounds:o,style:d}},tx.prototype.update=function(e,t,n,i){var r,o;Ko(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),ax(t)&&(t=null),this._modeling.updateLabel(e,t,r)};var sx="djs-element-hidden",cx="djs-label-hidden";function px(e,t,n,i){var r,o,a,s=this,c=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var n=e.active;if(r=n.element.label||n.element,Ko(r,"bpmn:TextAnnotation")){o=t.getAbsoluteBBox(r),a=Xe("g");var p=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),l=s.path=Xe("path");$e(l,{d:p,strokeWidth:2,stroke:lx(r)}),Ne(a,l),Ne(c,a),pi(a,r.x,r.y)}Ko(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,sx):(Ko(r,"bpmn:Task")||Ko(r,"bpmn:CallActivity")||Ko(r,"bpmn:SubProcess")||Ko(r,"bpmn:Participant"))&&t.addMarker(r,cx)})),e.on("directEditing.resize",(function(e){if(Ko(r,"bpmn:TextAnnotation")){var t=e.height,n=e.dy,a=Math.max(r.height/o.height*(t+n),0),c=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:a,position:{mx:0,my:0}});$e(s.path,{d:c})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,sx),t.removeMarker(r,cx)),r=void 0,o=void 0,a&&(ht(a),a=void 0)}))}function lx(e,t){var n=Zo(e);return n.get("stroke")||t||"black"}px.$inject=["eventBus","canvas","elementRegistry","pathMap"];var ux={__depends__:[Ec,Qb,qm],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",tx],labelEditingPreview:["type",px]},hx=["top","bottom","left","right"],dx=10;function fx(e,t){function n(e){if(Cs(e)){var t=yx(e);t&&i(e,t)}}function i(e,n){var i=bn(e),r=e.label,o=bn(r);if(r.parent){var a,s=mn(e);switch(n){case"top":a={x:i.x,y:s.top-dx-r.height/2};break;case"left":a={x:s.left-dx-r.width/2,y:i.y};break;case"bottom":a={x:i.x,y:s.bottom+dx+r.height/2};break;case"right":a={x:s.right+dx+r.width/2,y:i.y};break}var c=Pp(a,o);t.moveShape(r,c)}}Sc.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],(function(e){var t=e.context,i=t.connection,r=i.source,o=i.target,a=t.hints||{};!1!==a.createElementsBehavior&&(n(r),n(o))})),this.postExecuted(["label.create"],(function(e){var t=e.context,i=t.shape,r=t.hints||{};!1!==r.createElementsBehavior&&n(i.labelTarget)})),this.postExecuted(["elements.create"],(function(e){var t=e.context,i=t.elements,r=t.hints||{};!1!==r.createElementsBehavior&&i.forEach((function(e){n(e)}))}))}function mx(e){var t,n=e.host,i=bn(e),r=xn(i,n);t=r.indexOf("-")>=0?r.split("-"):[r];var o=hx.filter((function(e){return-1===t.indexOf(e)}));return o}function vx(e){var t=bn(e),n=[].concat(e.incoming.map((function(e){return e.waypoints[e.waypoints.length-2]})),e.outgoing.map((function(e){return e.waypoints[1]}))).map((function(e){return gx(t,e)}));return n}function yx(e){var t=bn(e.label),n=bn(e),i=gx(n,t);if(bx(i)){var r=vx(e);if(e.host){var o=mx(e);r=r.concat(o)}var a=hx.filter((function(e){return-1===r.indexOf(e)}));if(-1===a.indexOf(i))return a[0]}}function gx(e,t){return xn(t,e,5)}function bx(e){return-1!==hx.indexOf(e)}function xx(e,t,n){Sc.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(Ko(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})}),!0)}function _x(e,t){e.invoke(Sc,this),this.postExecute("shape.move",(function(e){var n=e.newParent,i=e.shape,r=w(i.incoming.concat(i.outgoing),(function(e){return Ko(e,"bpmn:Association")}));S(r,(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}i(fx,Sc),fx.$inject=["eventBus","modeling"],i(xx,Sc),xx.$inject=["eventBus","elementFactory","bpmnRules"],i(_x,Sc),_x.$inject=["injector","modeling"];var Ex=500;function wx(e,t){t.invoke(Sc,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Ex,(function(e){var t=e.elements;t=t.filter((function(e){var t=e.host;return Cx(e,t)})),1===t.length&&t.map((function(e){return t.indexOf(e)})).forEach((function(i){var r=t[i];e.elements[i]=n.replaceShape(t[i],r)}))}),!0),this.preExecute("elements.move",Ex,(function(e){var t=e.shapes,i=e.newHost;if(1===t.length){var r=t[0];Cx(r,i)&&(e.shapes=[n.replaceShape(r,i)])}}),!0)}function Sx(e){var t=Xo(e),n=t.eventDefinitions;return n&&n[0]}function Cx(e,t){return!Ds(e)&&Yo(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Ax(e,t){function n(e){return w(e.attachers,(function(e){return Ko(e,"bpmn:BoundaryEvent")}))}Sc.call(this,e),this.postExecute("connection.create",(function(e){var i=e.context.source,r=e.context.target,o=n(r);Ko(i,"bpmn:EventBasedGateway")&&Ko(r,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var i=e.context.oldSource,r=e.context.newSource;Ko(i,"bpmn:Gateway")&&Ko(r,"bpmn:EventBasedGateway")&&S(r.outgoing,(function(e){var i=e.target,r=n(i);Ko(i,"bpmn:ReceiveTask")&&r.length>0&&t.removeElements(r)}))}))}function kx(e){e.invoke(Sc,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,i=t.shape;Ko(n,"bpmn:Lane")&&!Ko(i,"bpmn:Lane")&&(t.parent=fy(n,"bpmn:Participant"))}))}function Tx(e,t,n){Sc.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context,i=n.shape;if(Ko(i,"bpmn:DataObjectReference")&&"label"!==i.type){var r=t.create("bpmn:DataObject");i.businessObject.dataObjectRef=r}}))}wx.$inject=["bpmnReplace","injector"],i(wx,Sc),wx.prototype.replaceShape=function(e,t){var n=Sx(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})},Ax.$inject=["eventBus","modeling"],i(Ax,Sc),kx.$inject=["injector"],i(kx,Sc),Tx.$inject=["eventBus","bpmnFactory","moddle"],i(Tx,Sc);var Rx=20,Dx=20,Px=30,Mx=2e3;function Bx(e,t,n){function i(){var t=e.getRootElement();return Ko(t,"bpmn:Collaboration")?t:n.makeCollaboration()}Sc.call(this,t),t.on(["create.start","shape.move.start"],Mx,(function(t){var n=t.context,i=n.shape,r=e.getRootElement();if(Ko(i,"bpmn:Participant")&&Ko(r,"bpmn:Process")&&r.children.length){var o=r.children.filter((function(e){return!Ko(e,"bpmn:Group")&&!Ds(e)&&!jx(e)}));if(o.length){var a=Wt(o),s=Nx(i,a);V(i,s),n.createConstraints=Ox(i,a)}}})),t.on("create.start",Mx,(function(n){var i=n.context,r=i.shape,o=e.getRootElement(),a=e.getGraphics(o);function s(e){e.element=o,e.gfx=a}Ko(r,"bpmn:Participant")&&Ko(o,"bpmn:Process")&&(t.on("element.hover",Mx,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",Mx,(function(e){var t,n=e.elements,r=e.parent,o=Lx(n);o&&Ko(r,"bpmn:Process")&&(e.parent=i(),t=e.hints=e.hints||{},t.participant=o,t.process=r,t.processRef=Xo(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;Ko(n,"bpmn:Participant")&&Ko(t,"bpmn:Process")&&(e.parent=i(),e.process=t,e.processRef=Xo(n).get("processRef"))}),!0),this.execute("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,i=e.shape,r=t.participant;!n||r&&i!==r||Xo(i).set("processRef",Xo(n))}),!0),this.revert("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,i=e.processRef||t.processRef,r=e.shape,o=t.participant;!n||o&&r!==o||Xo(r).set("processRef",i)}),!0),this.postExecute("shape.create",(function(e){var t=e.hints||{},i=e.process||e.hints.process,r=e.shape,o=t.participant;if(i){var a=i.children.slice();o?r===o&&n.moveElements(a,{x:0,y:0},o):n.moveElements(a,{x:0,y:0},r)}}),!0)}function Nx(e,t){t={width:t.width+2*Rx+Px,height:t.height+2*Dx};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}function Ox(e,t){return t=mn(t),{bottom:t.top+e.height/2-Dx,left:t.right-e.width/2+Rx,top:t.bottom-e.height/2+Dx,right:t.left+e.width/2-Rx-Px}}function jx(e){return!!e.waypoints}function Lx(e){return _(e,(function(e){return Ko(e,"bpmn:Participant")}))}Bx.$inject=["canvas","eventBus","modeling"],i(Bx,Sc);var Ix="__targetRef_placeholder";function Fx(e,t){function n(e,t,n){var i=e.get("dataInputAssociations");return _(i,(function(e){return e!==n&&e.targetRef===t}))}function i(e,n){var i=e.get("properties"),r=_(i,(function(e){return e.name===Ix}));return!r&&n&&(r=t.create("bpmn:Property",{name:Ix}),tn(i,r)),r}function r(e,t){var r=i(e);r&&(n(e,r,t)||en(e.get("properties"),r))}function o(e){var t,n=e.context,o=n.connection,a=o.businessObject,s=o.target,c=s&&s.businessObject,p=n.newTarget,l=p&&p.businessObject,u=n.oldTarget||n.target,h=u&&u.businessObject,d=o.businessObject;h&&h!==c&&r(h,a),l&&l!==c&&r(l,a),c?(t=i(c,!0),d.targetRef=t):d.targetRef=null}Sc.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],$x(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],$x(o))}function $x(e){return function(t){var n=t.context,i=n.connection;if(Ko(i,"bpmn:DataInputAssociation"))return e(t)}}function zx(e){this._bpmnUpdater=e}function Hx(e,t,n,i){function r(){return n.filter((function(e){return Ko(e,"bpmn:Participant")&&Xo(e).processRef}))[0]}function o(e){return e.children.filter((function(e){return Ko(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function a(e,n){var i=e.businessObject||e;if(n=n||r(),n){var o=n.businessObject||n;t.execute("dataStore.updateContainment",{dataStoreBo:i,dataStoreDi:Zo(e),newSemanticParent:o.processRef||o,newDiParent:Zo(n)})}}Sc.call(this,i),t.registerHandler("dataStore.updateContainment",zx),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;Ko(n,"bpmn:DataStoreReference")&&"label"!==n.type&&(t.hints||(t.hints={}),t.hints.autoResize=!1)})),this.preExecute("elements.move",(function(e){var t=e.context,n=t.shapes,i=n.filter((function(e){return Ko(e,"bpmn:DataStoreReference")}));i.length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!Ko(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,i=n.parent;Ko(n,"bpmn:DataStoreReference")&&"label"!==n.type&&Ko(i,"bpmn:Collaboration")&&a(n)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,i=t.oldParent,r=n.parent;if(!Ko(i,"bpmn:Collaboration")&&Ko(n,"bpmn:DataStoreReference")&&"label"!==n.type&&Ko(r,"bpmn:Collaboration")){var o=Ko(i,"bpmn:Participant")?i:Vx(i,"bpmn:Participant");a(n,o)}})),this.postExecute("shape.delete",(function(t){var n=t.context,i=n.shape,r=e.getRootElement();Yo(i,["bpmn:Participant","bpmn:SubProcess"])&&Ko(r,"bpmn:Collaboration")&&o(r).filter((function(e){return Gx(e,i)})).forEach((function(e){a(e)}))})),this.postExecute("canvas.updateRoot",(function(e){var t=e.context,n=t.oldRoot,i=t.newRoot,r=o(n);r.forEach((function(e){Ko(i,"bpmn:Process")&&a(e,i)}))}))}function Gx(e,t){var n=e.businessObject||e,i=t.businessObject||t;while(n.$parent){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}function Vx(e,t){while(e.parent){if(Ko(e.parent,t))return e.parent;e=e.parent}}Fx.$inject=["eventBus","bpmnFactory"],i(Fx,Sc),zx.$inject=["bpmnUpdater"],zx.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r)},zx.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r)},Hx.$inject=["canvas","commandStack","elementRegistry","eventBus"],i(Hx,Sc);var Wx=500;function Ux(e,t,n){function i(e,t){var i,r,o,a=By(t),s=[],c=[];(zt(a,(function(t){return t.y>e.y?c.push(t):s.push(t),t.children})),a.length)&&(i=c.length&&s.length?e.height/2:e.height,s.length&&(r=n.calculateAdjustments(s,"y",i,e.y-10),n.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:i},"s")),c.length&&(o=n.calculateAdjustments(c,"y",-i,e.y+e.height+10),n.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-i},"n")))}Sc.call(this,e),this.postExecuted("shape.delete",Wx,(function(e){var t=e.context,n=t.hints,r=t.shape,o=t.oldParent;Ko(r,"bpmn:Lane")&&(n&&n.nested||i(r,o))}))}Ux.$inject=["eventBus","modeling","spaceTool"],i(Ux,Sc);var qx=500;function Kx(e,t){t.invoke(Sc,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",qx,(function(e){var t=e.elements;t.filter((function(e){var t=e.host;return Xx(e,t)})).map((function(e){return t.indexOf(e)})).forEach((function(i){e.elements[i]=n.replaceShape(t[i])}))}),!0),this.preExecute("elements.move",qx,(function(e){var t=e.shapes,i=e.newHost;t.forEach((function(e,r){var o=e.host;Xx(e,Zx(t,o)?o:i)&&(t[r]=n.replaceShape(e))}))}),!0)}function Yx(e){var t=Xo(e),n=t.eventDefinitions;return n&&n[0]}function Xx(e,t){return!Ds(e)&&Ko(e,"bpmn:BoundaryEvent")&&!t}function Zx(e,t){return-1!==e.indexOf(t)}function Jx(e,t,n){function i(e,i,r){var o,a,s,c,p,l,u,h,d=i.waypoints,f=e.outgoing.slice(),m=e.incoming.slice();h=v(r.width)?bn(r):r;var y=cd(d,h);if(y){if(o=d.slice(0,y.index),a=d.slice(y.index+(y.bendpoint?1:0)),!o.length||!a.length)return;s=y.bendpoint?d[y.index]:h,1!==o.length&&Qx(e,o[o.length-1])||o.push(e_(s)),1!==a.length&&Qx(e,a[0])||a.unshift(e_(s))}c=i.source,p=i.target,t.canConnect(c,e,i)&&(n.reconnectEnd(i,e,o||h),l=i),t.canConnect(e,p,i)&&(l?u=n.connect(e,p,{type:i.type,waypoints:a}):(n.reconnectStart(i,e,a||h),u=i));var g=[].concat(l&&w(m,(function(e){return e.source===l.source}))||[],u&&w(f,(function(e){return e.target===u.target}))||[]);g.length&&n.removeElements(g)}Sc.call(this,e),this.preExecute("elements.move",(function(e){var n=e.newParent,i=e.shapes,r=e.delta,o=i[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var a=bn(o),s={x:a.x+r.x,y:a.y+r.y},c=_(n.children,(function(e){var n=t.canInsert(i,e);return n&&cd(e.waypoints,s)}));c&&(e.targetFlow=c,e.position=s)}}),!0),this.postExecuted("elements.move",(function(e){var t=e.shapes,n=e.targetFlow,r=e.position;n&&i(t[0],n,r)}),!0),this.preExecute("shape.create",(function(e){var n=e.parent,i=e.shape;t.canInsert(i,n)&&(e.targetFlow=n,e.parent=n.parent)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.targetFlow,r=e.position;n&&i(t,n,r)}),!0)}function Qx(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function e_(e){return V({},e)}function t_(e,t){Sc.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,i=n.connection,r=n.source,o=n.target,a=n.hints;if((!a||!1!==a.createElementsBehavior)&&n_(i)){var s=[];s=Ko(r,"bpmn:EventBasedGateway")?o.incoming.filter(n_):o.incoming.filter((function(e){return n_(e)&&Ko(e.source,"bpmn:EventBasedGateway")})),s.forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context,i=n.newShape;if(Ko(i,"bpmn:EventBasedGateway")){var r=i.outgoing.filter(n_).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]);r.forEach((function(e){e.incoming.filter(n_).forEach((function(n){const r=e.incoming.filter(n_).filter((function(e){return e.source===i}));(n.source!==i||r.length>1)&&t.removeConnection(n)}))}))}}))}function n_(e){return Ko(e,"bpmn:SequenceFlow")}Kx.$inject=["bpmnReplace","injector"],i(Kx,Sc),Kx.prototype.replaceShape=function(e){var t,n=Yx(e);return t=n?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:n.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},i(Jx,Sc),Jx.$inject=["eventBus","bpmnRules","modeling"],t_.$inject=["eventBus","modeling"],i(t_,Sc);var i_=1500,r_=2e3;function o_(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"],i_,(function(t){var i=t.context,r=i.shape||t.shape,o=t.hover;Ko(o,"bpmn:Lane")&&!Yo(r,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Ny(o),t.hoverGfx=e.getGraphics(t.hover));var a=n.getRootElement();o!==a&&(r.labelTarget||Ko(r,"bpmn:Group"))&&(t.hover=a,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],i_,(function(t){var n=t.hover;Ko(n,"bpmn:Lane")&&(t.hover=Ny(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],i_,(function(t){var n=t.context,i=t.hover,r=n.type;Ko(i,"bpmn:Lane")&&/reconnect/.test(r)&&(t.hover=Ny(i)||i,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],i_,(function(e){var t=e.context,n=t.start;Ko(n,"bpmn:Lane")&&(t.start=Ny(n)||n)})),t.on("shape.move.start",r_,(function(e){var t=e.shape;Ko(t,"bpmn:Lane")&&(e.shape=Ny(t)||t)}))}function a_(e){return e.create("bpmn:Category")}function s_(e){return e.create("bpmn:CategoryValue")}function c_(e,t,n){return tn(t.get("categoryValue"),e),e.$parent=t,tn(n.get("rootElements"),t),t.$parent=n,e}function p_(e){var t=e.$parent;return t&&(en(t.get("categoryValue"),e),e.$parent=null),e}function l_(e){var t=e.$parent;return t&&(en(t.get("rootElements"),e),e.$parent=null),e}o_.$inject=["elementRegistry","eventBus","canvas"];var u_=770;function h_(e,t,n,i,r,o){function a(){return n.filter((function(e){return Ko(e,"bpmn:Group")}))}function s(e,t){return e.some((function(e){var n=Xo(e),i=n.categoryValueRef&&n.categoryValueRef.$parent;return i===t}))}function c(e,t){return e.some((function(e){var n=Xo(e);return n.categoryValueRef===t}))}function p(e,t,n){var i=a().filter((function(e){return e.businessObject!==n}));t&&!s(i,t)&&l_(t),e&&!c(i,e)&&p_(e)}function l(e,n){return c_(e,n,t.getDefinitions())}function u(n,i){var r=Xo(n),o=r.categoryValueRef;o||(o=r.categoryValueRef=i.categoryValue=i.categoryValue||s_(e));var a=o.$parent;a||(a=o.$parent=i.category=i.category||a_(e)),l(o,a,t.getDefinitions())}function h(e,t){var n=t.category,i=t.categoryValue,r=Xo(e);i?(r.categoryValueRef=null,p(i,n,r)):p(null,r.categoryValueRef.$parent,r)}function d(t,n){var i=e.create(t.$type);return o.copyElement(t,i,null,n)}r.invoke(Sc,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;Ko(n,"bpmn:Group")&&u(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;Ko(n,"bpmn:Group")&&h(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=Xo(n);if(Ko(n,"bpmn:Group")&&!n.labelTarget){var r,o=t.categoryValue=i.categoryValueRef;o&&(r=t.category=o.$parent,p(o,r,i),i.categoryValueRef=null)}})),this.reverted("shape.delete",(function(e){var t=e.context,n=t.shape;if(Ko(n,"bpmn:Group")&&!n.labelTarget){var i=t.category,r=t.categoryValue,o=Xo(n);r&&(o.categoryValueRef=r,l(r,i))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;Ko(n,"bpmn:Group")&&!n.labelTarget&&Xo(n).categoryValueRef&&u(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;Ko(n,"bpmn:Group")&&!n.labelTarget&&Xo(n).categoryValueRef&&h(n,t)})),i.on("copyPaste.copyElement",u_,(function(e){var t=e.descriptor,n=e.element;if(Ko(n,"bpmn:Group")&&!n.labelTarget){var i=Xo(n);if(i.categoryValueRef){var r=i.categoryValueRef;t.categoryValue=d(r,!0),r.$parent&&(t.category=d(r.$parent,!0))}}})),i.on("copyPaste.pasteElement",u_,(function(e){var t=e.descriptor,n=t.businessObject,i=t.categoryValue,r=t.category;i&&(i=n.categoryValueRef=d(i)),r&&(i.$parent=d(r)),delete t.category,delete t.categoryValue}))}function d_(e,t,n,i){var r,o,a,s,c;return r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),0==r?null:(o=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*o-(i.y-n.y)*a,s=c/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function f_(e){function t(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},a=d_(e,t,n,r),s=d_(e,t,n,o);i=a&&s?m_(a,n)>m_(s,n)?s:a:a||s,e.original=i}function n(e){var n=e.waypoints;t(n[0],n[1],bn(e.source)),t(n[n.length-1],n[n.length-2],bn(e.target))}e.on("bpmnElement.added",(function(e){var t=e.element;t.waypoints&&n(t)}))}function m_(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function v_(e){Sc.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],(function(e){var n=e.context.shape,i=Xo(n),r=Zo(n);Yo(i,t)&&!r.get("isHorizontal")&&r.set("isHorizontal",!0)}))}h_.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],i(h_,Sc),f_.$inject=["eventBus"],v_.$inject=["eventBus"],i(v_,Sc);var y_=Math.sqrt,g_=Math.min,b_=Math.max,x_=Math.abs;function __(e){return Math.pow(e,2)}function E_(e,t){return y_(__(e.x-t.x)+__(e.y-t.y))}function w_(e,t){var n,i,r,o,a,s,c,p,l,u,h,d=0;for(d=0;d<t.length-1;d++){if(n=t[d],i=t[d+1],R_(n,i)?c=[n]:(r=E_(e,n),o=E_(e,i),s=g_(r,o),c=S_(n,i,e,s)),c.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===c.length&&(p={type:"bendpoint",position:c[0],segmentIndex:d,bendpointIndex:R_(n,c[0])?d:d+1}),2===c.length&&(a=k_(c[0],c[1]),p={type:"segment",position:a,segmentIndex:d,relativeLocation:E_(n,a)/E_(n,i)}),l=E_(p.position,e),(!h||u>l)&&(h=p,u=l)}return h}function S_(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,p=r*a+o*s,l=a*a+s*s-i*i,u=p/c,h=l/c,d=u*u-h;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var f=y_(d),m=-u+f,v=-u-f,y={x:e.x-r*m,y:e.y-o*m};if(0===d)return[y];var g={x:e.x-r*v,y:e.y-o*v};return[y,g].filter((function(n){return C_(n,e,t)}))}function C_(e,t,n){return A_(e.x,t.x,n.x)&&A_(e.y,t.y,n.y)}function A_(e,t,n){return e>=g_(t,n)-T_&&e<=b_(t,n)+T_}function k_(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var T_=.1;function R_(e,t){return x_(e.x-t.x)<=T_&&x_(e.y-t.y)<=T_}function D_(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c,p=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex;if(0===o)return r;if(r>=l&&(c=p?r+1:r-1),r<l&&(c=r,p&&"bendpoint"!==n.type&&l-1===r)){var u=M_(t,l);u<n.relativeLocation&&c++}return c}return 0===o?r:i.connectionStart&&0===r?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function P_(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=w_(e,n),c=s.segmentIndex,p=D_(n,t,s,i);if(p<0||p>t.length-2||null===p)return a;var l=N_(n,c),u=N_(t,p),h=s.position,d=O_(l,h),f=B_(l,u);if("bendpoint"===s.type){var m=t.length-n.length,v=s.bendpointIndex,y=n[v];if(-1!==t.indexOf(y))return a;if(0===m){var g=t[v];return r=g.x-s.position.x,o=g.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}m<0&&0!==v&&v<n.length-1&&(d=M_(n,v))}var b={x:(u[1].x-u[0].x)*d+u[0].x,y:(u[1].y-u[0].y)*d+u[0].y},x=ud({x:e.x-h.x,y:e.y-h.y},f);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:fn(b),delta:fn({x:r,y:o})}}function M_(e,t){var n=md(e[t-1],e[t]),i=md(e[t],e[t+1]),r=n/(n+i);return r}function B_(e,t){var n=ld(e),i=ld(t);return i-n}function N_(e,t){return[e[t],e[t+1]]}function O_(e,t){var n=md(e[0],e[1]),i=md(e[0],t);return 0===n?0:i/n}function j_(e,t,n,i){var r=L_(e);return P_(r,t,n,i).delta}function L_(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function I_(e,t,n){var i=Dp(t),r=Dp(n),o=Pp(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return fn({x:r.x+a.x,y:r.y+a.y})}function F_(e,t,n){var i=Dp(e),r=Dp(t),o=Dp(n),a=Pp(e,i),s=Pp(i,r),c=$_(i,t,n);if(c)return c;var p={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+p.x,y:o.y+p.y};return fn({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function $_(e,t,n){var i=mn(t),r=mn(n);if(z_(i,r))return null;var o,a,s,c=xn(t,e);if("top"===c)o={x:0,y:r.bottom-i.bottom};else if("bottom"===c)o={x:0,y:r.top-i.top};else if("right"===c)o={x:r.left-i.left,y:0};else{if("left"!==c)return null;o={x:r.right-i.right,y:0}}return a={x:e.x+o.x,y:e.y+o.y},s=xn(n,a),s!==c?null:o}function z_(e,t){return H_(e,t)||G_(e,t)}function H_(e,t){return e.right!==t.right&&e.left!==t.left}function G_(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var V_={width:90,height:20},W_="name",U_="text";function q_(e,t,n,i){function r(e){var t=e.context,n=t.connection,i=n.label,r=V({},t.hints),o=t.newWaypoints||n.waypoints,a=t.oldWaypoints;return"undefined"===typeof r.startChanged&&(r.startChanged=!!r.connectionStart),"undefined"===typeof r.endChanged&&(r.endChanged=!!r.connectionEnd),j_(i,o,a,r)}Sc.call(this,e),this.postExecute("element.updateProperties",(function(e){var n=e.context,r=n.element,o=n.properties;if(W_ in o&&t.updateLabel(r,o[W_]),U_ in o&&Ko(r,"bpmn:TextAnnotation")){var a=i.getTextAnnotationBounds({x:r.x,y:r.y,width:r.width,height:r.height},o[U_]||"");t.updateLabel(r,o.text,a)}})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context,r=n.hints||{};if(!1!==r.createElementsBehavior){var o=n.shape||n.connection,a=o.businessObject;if(!Ds(o)&&Ss(o)&&Da(o)){var s=Ts(o),c=i.getExternalLabelBounds(V_,Da(o));t.createLabel(o,s,{id:a.id+"_label",businessObject:a,width:c.width,height:c.height})}}})),this.postExecute("shape.delete",(function(e){var n=e.context,i=n.labelTarget,r=n.hints||{};i&&!1!==r.unsetLabel&&t.updateLabel(i,null,null,{removeShape:!1})})),this.postExecute(["label.create"],(function(e){var t,i=e.context,r=i.shape,o=i.labelTarget;o&&Ko(o,"bpmn:BaseElement")&&(t=Zo(o),t.label||(t.label=n.create("bpmndi:BPMNLabel",{bounds:n.create("dc:Bounds")}),r.di=t),V(t.label.bounds,{x:r.x,y:r.y,width:r.width,height:r.height}))})),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var n=e.context,i=n.hints||{};if(!1!==i.labelBehavior){var o,a=n.connection,s=a.label;s&&s.parent&&(o=r(e),t.moveShape(s,o))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=Xo(n);r&&Ss(r)&&i.label&&n.label&&(n.label.x=i.label.x,n.label.y=i.label.y)})),this.postExecute("shape.resize",(function(e){var n=e.context,i=n.shape,r=n.newBounds,o=n.oldBounds;if(Cs(i)){var a=i.label,s=bn(a),c=X_(o),p=Y_(s,c),l=K_(p,o,r);t.moveShape(a,l)}}))}function K_(e,t,n){var i=I_(e,t,n);return fn(Pp(i,e))}function Y_(e,t){if(t.length){var n=Z_(e,t);return dd(e,n)}}function X_(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 Z_(e,t){var n=t.map((function(t){return{line:t,distance:fd(e,t)}})),i=j(n,"distance");return i[0].line}function J_(e,t,n,i){return P_(e,t,n,i).point}function Q_(e,t){function n(e,t){var n=e.context,i=n.connection,r=V({},n.hints),o=n.newWaypoints||i.waypoints,a=n.oldWaypoints;return"undefined"===typeof r.startChanged&&(r.startChanged=!!r.connectionStart),"undefined"===typeof r.endChanged&&(r.endChanged=!!r.connectionEnd),J_(t,o,a,r)}Sc.call(this,e),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var i=e.context,r=i.connection,o=r.outgoing,a=r.incoming;a.forEach((function(i){var r=i.waypoints[i.waypoints.length-1],o=n(e,r),a=[].concat(i.waypoints.slice(0,-1),[o]);t.updateWaypoints(i,a)})),o.forEach((function(i){var r=i.waypoints[0],o=n(e,r),a=[].concat([o],i.waypoints.slice(1));t.updateWaypoints(i,a)}))})),this.postExecute(["connection.move"],(function(e){var n=e.context,i=n.connection,r=i.outgoing,o=i.incoming,a=n.delta;o.forEach((function(e){var n=e.waypoints[e.waypoints.length-1],i={x:n.x+a.x,y:n.y+a.y},r=[].concat(e.waypoints.slice(0,-1),[i]);t.updateWaypoints(e,r)})),r.forEach((function(e){var n=e.waypoints[0],i={x:n.x+a.x,y:n.y+a.y},r=[].concat([i],e.waypoints.slice(1));t.updateWaypoints(e,r)}))}))}function eE(e,t,n){var i=oE(e),r=aE(i,t),o=i[0];return r.length?r[r.length-1]:I_(o.original||o,n,t)}function tE(e,t,n){var i=oE(e),r=aE(i,t),o=i[i.length-1];return r.length?r[0]:I_(o.original||o,n,t)}function nE(e,t,n){var i=oE(e),r=rE(t,n),o=i[0];return I_(o.original||o,r,t)}function iE(e,t,n){var i=oE(e),r=rE(t,n),o=i[i.length-1];return I_(o.original||o,r,t)}function rE(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function oE(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function aE(e,t){var n=R(e,cE);return w(n,(function(e){return sE(e,t)}))}function sE(e,t){return"intersect"===xn(t,e,1)}function cE(e){return e.original||e}function pE(e,t){Sc.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,i=e.newShape;if(lE(n,i)){var r=uE(n);r.incoming.forEach((function(e){var r=tE(e,i,n);t.reconnectEnd(e,i,r)})),r.outgoing.forEach((function(e){var r=eE(e,i,n);t.reconnectStart(e,i,r)}))}}),!0)}function lE(e,t){return Ko(e,"bpmn:Participant")&&_a(e)&&Ko(t,"bpmn:Participant")&&!_a(t)}function uE(e){var t=Gt([e],!1),n=[],i=[];return t.forEach((function(t){t!==e&&(t.incoming.forEach((function(e){Ko(e,"bpmn:MessageFlow")&&n.push(e)})),t.outgoing.forEach((function(e){Ko(e,"bpmn:MessageFlow")&&i.push(e)})))}),[]),{incoming:n,outgoing:i}}i(q_,Sc),q_.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],i(Q_,Sc),Q_.$inject=["eventBus","modeling"],pE.$inject=["eventBus","modeling"],i(pE,Sc);var hE="flow elements must be children of pools/participants";function dE(e,t,n){function i(e,n,i){t.add({position:{x:e.x+5,y:e.y+5},type:"error",timeout:i||2e3,html:"<div>"+n+"</div>"})}e.on(["shape.move.rejected","create.rejected"],(function(e){var t=e.context,r=t.shape,o=t.target;Ko(o,"bpmn:Collaboration")&&Ko(r,"bpmn:FlowNode")&&i(e,n(hE))}))}function fE(e,t){Sc.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,i=Zo(n),r=i&&i.get("label"),o=r&&r.get("bounds");o&&t.updateModdleProperties(n,r,{bounds:void 0})}),!0)}function mE(e,t,n){Sc.call(this,e),this.preExecute("shape.delete",(function(e){var i=e.context.shape;if(1===i.incoming.length&&1===i.outgoing.length){var r=i.incoming[0],o=i.outgoing[0];if(Ko(r,"bpmn:SequenceFlow")&&Ko(o,"bpmn:SequenceFlow")&&t.canConnect(r.source,o.target,r)){var a=yE(r.waypoints,o.waypoints);n.reconnectEnd(r,o.target,a)}}}))}function vE(e){return e.original||e}function yE(e,t){var n=d_(vE(e[e.length-2]),vE(e[e.length-1]),vE(t[1]),vE(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[vE(e[0]),vE(t[t.length-1])]}function gE(e,t){Sc.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;Ko(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;n&&!n.businessObject.participants.length&&t.makeProcess()}),!0)}function bE(e,t,n,i){Sc.call(this,e);var r=i.get("dragging",!1);function o(e){var i,r,o=e.source,a=e.target,s=e.parent;s&&(Ko(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,a)||(r=!0),n.canConnectMessageFlow(o,a)&&(i="bpmn:MessageFlow")),Ko(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,a)||(r=!0),n.canConnectSequenceFlow(o,a)&&(i="bpmn:SequenceFlow")),Ko(e,"bpmn:Association")&&!n.canConnectAssociation(o,a)&&(r=!0),r&&t.removeConnection(e),i&&t.connect(o,a,{type:i,waypoints:e.waypoints.slice()}))}function a(e){var i,o,a=e.context,c=a.connection,p=a.newSource||c.source,l=a.newTarget||c.target;i=n.canConnect(p,l),i&&i.type!==c.type&&(o=t.connect(p,l,{type:i.type,waypoints:c.waypoints.slice()}),t.removeConnection(c),a.connection=o,r&&s(c,o))}function s(e,t){var n,i=r.context(),o=i&&i.payload.previousSelection;o&&o.length&&(n=o.indexOf(e),-1!==n&&o.splice(n,1,t))}this.postExecuted("elements.move",(function(e){var t=e.closure,n=t.allConnections;S(n,o)}),!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",(function(e){var n,i=e.context,r=i.properties,o=i.element,a=o.businessObject;r.default&&(n=_(o.outgoing,L({id:o.businessObject.default.id})),n&&t.updateProperties(n,{conditionExpression:void 0})),r.conditionExpression&&a.sourceRef.default===a&&t.updateProperties(o.source,{default:void 0})}))}function xE(e,t,n,i,r,o){i.invoke(Sc,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,(function(e){var n=e.context,i=n.parent,r=n.elements,o=A(r,(function(e,n){var r=t.canReplace([n],n.host||n.parent||i);return r?e.concat(r.replacements):e}),[]);o.length&&this.replaceElements(r,o)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,i=n.newParent,r=n.newHost,o=[];S(n.closure.topLevel,(function(e){o=wa(e)?o.concat(e.children):o.concat(e)})),1===o.length&&r&&(i=r);var a=t.canReplace(o,i);a&&this.replaceElements(o,a.replacements,r)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,i=e.context,r=i.oldShape,o=i.newShape,a=r.attachers;a&&a.length&&(n=t.canReplace(a,o),this.replaceElements(a,n.replacements))}),this),this.postExecuted(["shape.replace"],1500,(function(e){var t=e.context,n=t.oldShape,i=t.newShape;r.unclaimId(n.businessObject.id,n.businessObject),r.updateProperties(i,{id:n.id})}))}dE.$inject=["eventBus","tooltips","translate"],i(fE,Sc),fE.$inject=["eventBus","modeling"],i(mE,Sc),mE.$inject=["eventBus","bpmnRules","modeling"],gE.$inject=["eventBus","modeling"],i(gE,Sc),i(bE,Sc),bE.$inject=["eventBus","modeling","bpmnRules","injector"],i(xE,Sc),xE.prototype.replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;S(t,(function(t){var r={type:t.newElementType},o=n.get(t.oldElementId),a=e.indexOf(o);e[a]=i.replaceElement(o,r,{select:!1})})),t&&r.select(e)},xE.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var _E=1500,EE={width:140,height:120},wE={width:300,height:60},SE={width:300,height:150},CE={width:140,height:120},AE={width:50,height:30};function kE(e){e.on("resize.start",_E,(function(e){var t=e.context,n=t.shape,i=t.direction,r=t.balanced;(Ko(n,"bpmn:Lane")||Ko(n,"bpmn:Participant"))&&(t.resizeConstraints=IE(n,i,r)),Ko(n,"bpmn:Participant")&&(t.minDimensions=SE),Ko(n,"bpmn:SubProcess")&&_a(n)&&(t.minDimensions=CE),Ko(n,"bpmn:TextAnnotation")&&(t.minDimensions=AE)}))}kE.$inject=["eventBus"];var TE=Math.abs,RE=Math.min,DE=Math.max;function PE(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function ME(e,t,n){return PE(e,t,n,RE)}function BE(e,t,n){return PE(e,t,n,DE)}var NE=20,OE=50,jE=20,LE=20;function IE(e,t,n){var i=Ny(e),r=!0,o=!0,a=My(i,[i]),s=mn(e),c={},p={};/e/.test(t)?p.right=s.left+wE.width:/w/.test(t)&&(p.left=s.right-wE.width),a.forEach((function(e){var i=mn(e);/n/.test(t)&&(i.top<s.top-10&&(r=!1),n&&TE(s.top-i.bottom)<10&&BE(c,"top",i.top+wE.height),TE(s.top-i.top)<5&&ME(p,"top",i.bottom-wE.height)),/s/.test(t)&&(i.bottom>s.bottom+10&&(o=!1),n&&TE(s.bottom-i.top)<10&&ME(c,"bottom",i.bottom-wE.height),TE(s.bottom-i.bottom)<5&&BE(p,"bottom",i.top+wE.height))}));var l=i.children.filter((function(e){return!e.hidden&&!e.waypoints&&(Ko(e,"bpmn:FlowElement")||Ko(e,"bpmn:Artifact"))}));return l.forEach((function(e){var n=mn(e);r&&/n/.test(t)&&ME(p,"top",n.top-jE),/e/.test(t)&&BE(p,"right",n.right+NE),o&&/s/.test(t)&&BE(p,"bottom",n.bottom+LE),/w/.test(t)&&ME(p,"left",n.left-OE)})),{min:p,max:c}}var FE=1001;function $E(e,t){e.on("resize.start",FE+500,(function(e){var t=e.context,n=t.shape;(Ko(n,"bpmn:Lane")||Ko(n,"bpmn:Participant"))&&(t.balanced=!qs(e))})),e.on("resize.end",FE,(function(e){var n=e.context,i=n.shape,r=n.canExecute,o=n.newBounds;if(Ko(i,"bpmn:Lane")||Ko(i,"bpmn:Participant"))return r&&(o=dn(o),t.resizeLane(i,o,n.balanced)),!1}))}$E.$inject=["eventBus","modeling"];var zE=500;function HE(e,t,n,i,r){function o(e){return Yo(e,["bpmn:ReceiveTask","bpmn:SendTask"])||GE(e,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(t){var n=e.getDefinitions(),i=n.get("rootElements");return!!_(i,L({id:t.id}))}function s(e){return Ko(e,"bpmn:ErrorEventDefinition")?"errorRef":Ko(e,"bpmn:EscalationEventDefinition")?"escalationRef":Ko(e,"bpmn:MessageEventDefinition")?"messageRef":Ko(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function c(e){if(Yo(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions"),n=t[0];return n.get(s(n))}function p(e,t){if(Yo(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.set("messageRef",t);var n=e.get("eventDefinitions"),i=n[0];return i.set(s(i),t)}n.invoke(Sc,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var i,r=Xo(n),s=c(r);s&&!a(s)&&(i=e.getDefinitions().get("rootElements"),tn(i,s),t.addedRootElement=s)}}),!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.addedRootElement;if(n){var i=e.getDefinitions().get("rootElements");en(i,n)}}),!0),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element;if(!n.labelTarget&&o(n)){var i=Xo(n),r=c(i);r&&(t.referencedRootElement=r)}})),t.on("copyPaste.pasteElement",zE,(function(e){var t=e.descriptor,n=t.businessObject,o=t.referencedRootElement;o&&(a(o)||(o=i.copyElement(o,r.create(o.$type))),p(n,o),delete t.referencedRootElement)}))}function GE(e,t){return f(t)||(t=[t]),T(t,(function(t){return Sa(e,t)}))}HE.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],i(HE,Sc);var VE=Math.max;function WE(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,i=e.start,r={};return S(t,(function(e){var t=e.id;Ko(e,"bpmn:Participant")&&(UE(n)?r[t]=SE:r[t]={width:SE.width,height:qE(e,i)}),Ko(e,"bpmn:SubProcess")&&_a(e)&&(r[t]=CE),Ko(e,"bpmn:TextAnnotation")&&(r[t]=AE),Ko(e,"bpmn:Group")&&(r[t]=EE)})),r}))}function UE(e){return"x"===e}function qE(e,t){var n;return KE(e)?(n=YE(e,t),VE(SE.height,n)):SE.height}function KE(e){return!!By(e).length}function YE(e,t){var n,i=By(e);return n=XE(i,t),e.height-n.height+wE.height}function XE(e,t){var n,i,r;for(n=0;n<e.length;n++)if(i=e[n],t>=i.y&&t<=i.y+i.height)return r=By(i),r.length?XE(r,t):i}WE.$inject=["eventBus"];var ZE=400,JE=600,QE={x:180,y:160};function ew(e,t,n,i,r,o,a){Sc.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(e){return Ko(e,"bpmn:SubProcess")&&!_a(e)}function p(t){var n=t.shape,i=t.newRootElement,r=Xo(n);i=s._addDiagram(i||r),t.newRootElement=e.addRootElement(i)}function l(t){var n=t.shape,i=Xo(n);s._removeDiagram(i);var r=t.newRootElement=a.get(Nc(i));e.removeRootElement(r)}this.executed("shape.create",(function(e){var t=e.shape;c(t)&&p(e)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.newRootElement;n&&t.children&&(s._showRecursively(t.children),s._moveChildrenToShape(t,n))}),!0),this.reverted("shape.create",(function(e){var t=e.shape;c(t)&&l(e)}),!0),this.preExecuted("shape.delete",(function(e){var t=e.shape;if(c(t)){var i=a.get(Nc(t));i&&n.removeElements(i.children.slice())}}),!0),this.executed("shape.delete",(function(e){var t=e.shape;c(t)&&l(e)}),!0),this.reverted("shape.delete",(function(e){var t=e.shape;c(t)&&p(e)}),!0),this.preExecuted("shape.replace",(function(t){var n=t.oldShape,i=t.newShape;c(n)&&c(i)&&(t.oldRoot=e.removeRootElement(Nc(n)))}),!0),this.postExecuted("shape.replace",(function(t){var i=t.newShape,r=t.oldRoot,o=e.findRoot(Nc(i));if(r&&o){var a=r.children;n.moveElements(a,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(Ko(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties,r=i.id,o=n.id;if(r!==o){if(jc(t))return a.updateId(t,Oc(o)),void a.updateId(r,o);var s=a.get(Oc(r));s&&a.updateId(Oc(r),Oc(o))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(Ko(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties,r=i.id,o=n.id;if(r!==o){if(jc(t))return a.updateId(t,Oc(r)),void a.updateId(o,r);var s=a.get(Oc(o));s&&a.updateId(s,Oc(r))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(jc(n)){var i=n,r=a.get(Bc(i));r&&r!==i&&t.fire("element.changed",{element:r})}})),this.executed("shape.toggleCollapse",ZE,(function(e){var t=e.shape;Ko(t,"bpmn:SubProcess")&&(_a(t)?l(e):(p(e),s._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",ZE,(function(e){var t=e.shape;Ko(t,"bpmn:SubProcess")&&(_a(t)?l(e):(p(e),s._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",JE,(function(e){var t=e.shape;if(Ko(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(_a(t)?s._moveChildrenToShape(n,t):s._moveChildrenToShape(t,n))}}),!0),t.on("copyPaste.createTree",(function(e){var t=e.element,n=e.children;if(c(t)){var i=Nc(t),r=a.get(i);r&&n.push.apply(n,r.children)}})),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,i=e.elements,r=n.parent,o=Ko(Zo(r),"bpmndi:BPMNPlane");if(o){var a=Bc(r),s=_(i,(function(e){return e.id===a}));s&&(t.parent=s.id)}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor;t.parent&&(c(t.parent)||t.parent.hidden)&&(t.hidden=!0)}))}function tw(e,t){e.invoke(Sc,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,i=e.context.newShape;if(Ko(i,"bpmn:SubProcess")&&(Ko(n,"bpmn:Task")||Ko(n,"bpmn:CallActivity"))&&_a(i)){var r=nw(i);t.createShape({type:"bpmn:StartEvent"},r,i)}}))}function nw(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function iw(e,t){Sc.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!_a(n)){var i=Gt(n);i.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();S(t,(function(e){r(e,!0)})),S(n,(function(e){r(e,!1)}))}))}function r(e,r){-1!==i.indexOf(e.source)&&-1!==i.indexOf(e.target)||(r?t.reconnectEnd(e,n,bn(n)):t.reconnectStart(e,n,bn(n)))}}),!0)}i(ew,Sc),ew.prototype._moveChildrenToShape=function(e,t){var n,i=this._modeling,r=e.children;if(r){r=r.concat(r.reduce((function(t,n){return n.label&&n.label.parent!==e?t.concat(n.label):t}),[]));var o=r.filter((function(e){return!e.hidden}));if(o.length){var a=Wt(o);if(t.x){var s=bn(t),c=bn(a);n={x:s.x-c.x,y:s.y-c.y}}else n={x:QE.x-a.x,y:QE.y-a.y};i.moveElements(r,n,t,{autoResize:!1})}else i.moveElements(r,{x:0,y:0},t,{autoResize:!1})}},ew.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach((function(e){e.hidden=!!t,i=i.concat(e),e.children&&(i=i.concat(n._showRecursively(e.children,e.collapsed||t)))})),i},ew.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},ew.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:Nc(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},ew.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=_(n,(function(t){return t.plane.bpmnElement.id===e.id}));return n.splice(n.indexOf(i),1),i},ew.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],tw.$inject=["injector","modeling"],i(tw,Sc),i(iw,Sc),iw.$inject=["eventBus","modeling"];var rw=500;function ow(e,t,n,i){function r(e){e.length&&e.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)}))}function o(e,t){var n,i,r=e.children,o=t;return n=aw(r).concat([e]),i=ky(n),i?(o.width=Math.max(i.width,o.width),o.height=Math.max(i.height,o.height),o.x=i.x+(i.width-o.width)/2,o.y=i.y+(i.height-o.height)/2):(o.x=e.x+(e.width-o.width)/2,o.y=e.y+(e.height-o.height)/2),o}function a(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}Sc.call(this,e),this.executed(["shape.toggleCollapse"],rw,(function(e){var t=e.context,n=t.shape;Ko(n,"bpmn:SubProcess")&&(n.collapsed?Zo(n).isExpanded=!1:(r(n.children),Zo(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],rw,(function(e){var t=e.context,n=t.shape;n.collapsed?Zo(n).isExpanded=!1:Zo(n).isExpanded=!0})),this.postExecuted(["shape.toggleCollapse"],rw,(function(e){var i,r=e.context.shape,s=t.getDefaultSize(r);i=r.collapsed?a(r,s):o(r,s),n.resizeShape(r,i,null,{autoResize:!r.collapsed&&"nwse"})}))}function aw(e){return e.filter((function(e){return!e.hidden}))}function sw(e,t,n,i){t.invoke(Sc,this),this.preExecute("shape.delete",(function(e){var t=e.context,r=t.shape,o=r.businessObject;Ds(r)||(Ko(r,"bpmn:Participant")&&_a(r)&&n.ids.unclaim(o.processRef.id),i.unclaimId(o.id,o))})),this.preExecute("connection.delete",(function(e){var t=e.context,n=t.connection,r=n.businessObject;i.unclaimId(r.id,r)})),this.preExecute("canvas.updateRoot",(function(){var t=e.getRootElement(),i=t.businessObject;Ko(t,"bpmn:Collaboration")&&n.ids.unclaim(i.id)}))}function cw(e,t){Sc.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context,i=n.connection,r=i.source;pw(i,r)&&t.updateProperties(r,{default:null})}))}function pw(e,t){if(!Ko(e,"bpmn:SequenceFlow"))return!1;var n=Xo(t),i=Xo(e);return n.get("default")===i}i(ow,Sc),ow.$inject=["eventBus","elementFactory","modeling"],i(sw,Sc),sw.$inject=["canvas","injector","moddle","modeling"],i(cw,Sc),cw.$inject=["eventBus","modeling"];var lw=500,uw=5e3;function hw(e,t,n){var i;function r(){return i=i||new dw,i.enter(),i}function o(){if(!i)throw new Error(n("out of bounds release"));return i}function a(){if(!i)throw new Error(n("out of bounds release"));var e=i.leave();return e&&(t.updateLaneRefs(i.flowNodes,i.lanes),i=null),e}Sc.call(this,e);var s=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(s,uw,(function(e){r()})),this.postExecuted(s,lw,(function(e){a()})),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],(function(e){var t=e.context,n=t.shape,i=o();n.labelTarget||(Ko(n,"bpmn:Lane")&&i.addLane(n),Ko(n,"bpmn:FlowNode")&&i.addFlowNode(n))}))}function dw(){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}}hw.$inject=["eventBus","modeling","translate"],i(hw,Sc);var fw={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","modelingFeedback","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior"],adaptiveLabelPositioningBehavior:["type",fx],appendBehavior:["type",xx],associationBehavior:["type",_x],attachEventBehavior:["type",wx],boundaryEventBehavior:["type",Ax],createBehavior:["type",kx],createDataObjectBehavior:["type",Tx],createParticipantBehavior:["type",Bx],dataInputAssociationBehavior:["type",Fx],dataStoreBehavior:["type",Hx],deleteLaneBehavior:["type",Ux],detachEventBehavior:["type",Kx],dropOnFlowBehavior:["type",Jx],eventBasedGatewayBehavior:["type",t_],fixHoverBehavior:["type",o_],groupBehavior:["type",h_],importDockingFix:["type",f_],isHorizontalFix:["type",v_],labelBehavior:["type",q_],layoutConnectionBehavior:["type",Q_],messageFlowBehavior:["type",pE],modelingFeedback:["type",dE],removeElementBehavior:["type",mE],removeEmbeddedLabelBoundsBehavior:["type",fE],removeParticipantBehavior:["type",gE],replaceConnectionBehavior:["type",bE],replaceElementBehaviour:["type",xE],resizeBehavior:["type",kE],resizeLaneBehavior:["type",$E],rootElementReferenceBehavior:["type",HE],spaceToolBehavior:["type",WE],subProcessPlaneBehavior:["type",ew],subProcessStartEventBehavior:["type",tw],toggleCollapseConnectionBehaviour:["type",iw],toggleElementCollapseBehaviour:["type",ow],unclaimIdBehavior:["type",sw],unsetDefaultFlowBehavior:["type",cw],updateFlowNodeRefsBehavior:["type",hw]};function mw(e,t){var n=xn(e,t,-15);return"intersect"!==n?n:null}function vw(e){rh.call(this,e)}function yw(e){return gw(e)?null:Yo(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function gw(e){return!e||Ds(e)}function bw(e,t){return e===t}function xw(e){do{if(Ko(e,"bpmn:Process"))return Xo(e);if(Ko(e,"bpmn:Participant"))return Xo(e).processRef||Xo(e)}while(e=e.parent)}function _w(e){return Ko(e,"bpmn:TextAnnotation")}function Ew(e){return Ko(e,"bpmn:Group")&&!e.labelTarget}function ww(e){return Ko(e,"bpmn:BoundaryEvent")&&Dw(e,"bpmn:CompensateEventDefinition")}function Sw(e){return Xo(e).isForCompensation}function Cw(e,t){var n=xw(e),i=xw(t);return n===i}function Aw(e){return Ko(e,"bpmn:InteractionNode")&&!Ko(e,"bpmn:BoundaryEvent")&&(!Ko(e,"bpmn:Event")||Ko(e,"bpmn:ThrowEvent")&&Pw(e,"bpmn:MessageEventDefinition"))}function kw(e){return Ko(e,"bpmn:InteractionNode")&&!Sw(e)&&(!Ko(e,"bpmn:Event")||Ko(e,"bpmn:CatchEvent")&&Pw(e,"bpmn:MessageEventDefinition"))&&!(Ko(e,"bpmn:BoundaryEvent")&&!Dw(e,"bpmn:MessageEventDefinition"))}function Tw(e){var t=e;while(t=t.parent){if(Ko(t,"bpmn:FlowElementsContainer"))return Xo(t);if(Ko(t,"bpmn:Participant"))return Xo(t).processRef}return null}function Rw(e,t){var n=Tw(e),i=Tw(t);return n===i}function Dw(e,t){var n=Xo(e);return!!_(n.eventDefinitions||[],(function(e){return Ko(e,t)}))}function Pw(e,t){var n=Xo(e);return(n.eventDefinitions||[]).every((function(e){return Ko(e,t)}))}function Mw(e){return Ko(e,"bpmn:FlowNode")&&!Ko(e,"bpmn:EndEvent")&&!wa(e)&&!(Ko(e,"bpmn:IntermediateThrowEvent")&&Dw(e,"bpmn:LinkEventDefinition"))&&!ww(e)&&!Sw(e)}function Bw(e){return Ko(e,"bpmn:FlowNode")&&!Ko(e,"bpmn:StartEvent")&&!Ko(e,"bpmn:BoundaryEvent")&&!wa(e)&&!(Ko(e,"bpmn:IntermediateCatchEvent")&&Dw(e,"bpmn:LinkEventDefinition"))&&!Sw(e)}function Nw(e){return Ko(e,"bpmn:ReceiveTask")||Ko(e,"bpmn:IntermediateCatchEvent")&&(Dw(e,"bpmn:MessageEventDefinition")||Dw(e,"bpmn:TimerEventDefinition")||Dw(e,"bpmn:ConditionalEventDefinition")||Dw(e,"bpmn:SignalEventDefinition"))}function Ow(e){return e.waypoints}function jw(e){var t=[];while(e)e=e.parent,e&&t.push(e);return t}function Lw(e,t){var n=jw(t);return-1!==n.indexOf(e)}function Iw(e,t,n){if(gw(e)||gw(t))return null;if(!Ko(n,"bpmn:DataAssociation")){if(tS(e,t))return{type:"bpmn:MessageFlow"};if(nS(e,t))return{type:"bpmn:SequenceFlow"}}var i=iS(e,t);return i||(ww(e)&&Sw(t)?{type:"bpmn:Association",associationDirection:"One"}:!!eS(e,t)&&{type:"bpmn:Association"})}function Fw(e,t,n){return!(!Ds(e)&&!Ew(e))||!(Ko(t,"bpmn:Participant")&&!_a(t))&&(Ko(e,"bpmn:Participant")?Ko(t,"bpmn:Process")||Ko(t,"bpmn:Collaboration"):Yo(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:Ko(e,"bpmn:Lane")?Ko(t,"bpmn:Participant")||Ko(t,"bpmn:Lane"):!(Ko(e,"bpmn:BoundaryEvent")&&!$w(e))&&(Ko(e,"bpmn:FlowElement")&&!Ko(e,"bpmn:DataStoreReference")?Ko(t,"bpmn:FlowElementsContainer")?_a(t):Yo(t,["bpmn:Participant","bpmn:Lane"]):Ko(e,"bpmn:DataStoreReference")&&Ko(t,"bpmn:Collaboration")?T(Xo(t).get("participants"),(function(e){return!!e.get("processRef")})):Yo(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Yo(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!Ko(e,"bpmn:MessageFlow")&&(Ko(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function $w(e){return Xo(e).cancelActivity&&(Vw(e)||Ww(e))}function zw(e){return!Ds(e)&&Ko(e,"bpmn:BoundaryEvent")}function Hw(e){return Ko(e,"bpmn:Lane")}function Gw(e){return!!zw(e)||(!(!Ko(e,"bpmn:IntermediateThrowEvent")||!Vw(e))||Ko(e,"bpmn:IntermediateCatchEvent")&&Ww(e))}function Vw(e){var t=Xo(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Ww(e){return Uw(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Uw(e,t){return t.some((function(t){return Dw(e,t)}))}function qw(e){return Ko(e,"bpmn:ReceiveTask")&&_(e.incoming,(function(e){return Ko(e.source,"bpmn:EventBasedGateway")}))}function Kw(e,t,n,i){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var r=e[0];return!Ds(r)&&(!!Gw(r)&&(!wa(t)&&(!(!Ko(t,"bpmn:Activity")||Sw(t))&&(!(i&&!mw(i,t))&&(!qw(t)&&"attach")))))}function Yw(e,t,n){if(!t)return!1;var i={replacements:[]};return S(e,(function(e){wa(t)||Ko(e,"bpmn:StartEvent")&&"label"!==e.type&&Fw(e,t)&&(Ea(e)||i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(Ca(e)||Aa(e)||ka(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),Uw(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&Ko(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),Ko(t,"bpmn:Transaction")||Dw(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(Ko(e,"bpmn:EndEvent")&&Fw(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),Ko(e,"bpmn:BoundaryEvent")&&Kw(e,t,null,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!i.replacements.length&&i}function Xw(e,t){return!T(e,Hw)&&(!t||e.every((function(e){return Fw(e,t)})))}function Zw(e,t,n,i){return!!t&&(!(!Ds(e)&&!Ew(e))||!bw(n,t)&&((!n||!Lw(n,t))&&(Fw(e,t,i)||rS(e,t,i))))}function Jw(e,t){return Ko(e,"bpmn:SubProcess")?_a(e)&&(!t||t.width>=100&&t.height>=80):Ko(e,"bpmn:Lane")?!t||t.width>=130&&t.height>=60:Ko(e,"bpmn:Participant")?!t||t.width>=250&&t.height>=50:!!_w(e)||!!Ew(e)}function Qw(e,t){var n=_w(e),i=_w(t);return(n||i)&&n!==i}function eS(e,t){return!(!ww(e)||!Sw(t))||!Lw(t,e)&&!Lw(e,t)&&(!!Qw(e,t)||!!iS(e,t))}function tS(e,t){return!(sS(e)&&!sS(t))&&(Aw(e)&&kw(t)&&!Cw(e,t))}function nS(e,t){return Mw(e)&&Bw(t)&&Rw(e,t)&&!(Ko(e,"bpmn:EventBasedGateway")&&!Nw(t))}function iS(e,t){return Yo(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Yo(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!Yo(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!Yo(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function rS(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(1!==e.length)return!1;e=e[0]}return t.source!==e&&t.target!==e&&(Yo(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ds(t)&&Ko(e,"bpmn:FlowNode")&&!Ko(e,"bpmn:BoundaryEvent")&&Fw(e,t.parent,n))}function oS(e,t){return e&&t&&-1!==e.indexOf(t)}function aS(e,t){return!!Ds(t)||!(Ko(t,"bpmn:Lane")&&!oS(e,t.parent))}function sS(e){return fy(e,"bpmn:Process")||fy(e,"bpmn:Collaboration")}i(vw,rh),vw.$inject=["eventBus"],vw.prototype.init=function(){this.addRule("connection.start",(function(e){var t=e.source;return yw(t)})),this.addRule("connection.create",(function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return Iw(t,n)}finally{r&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection,n=e.source,i=e.target;return Iw(n,i,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 Jw(t,n)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,i=e.target;return!(Ow(i)&&!rS(t,i,n))&&k(t,(function(e){return Ow(e)?Iw(e.source,e.target,e):e.host?Kw(e,e.host,null,n):Zw(e,i,null,n)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,i=e.position;return Kw(n,t,null,i)||Yw(n,t,i)||Xw(n,t,i)||rS(n,t,i)})),this.addRule("shape.create",(function(e){return Zw(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return Kw(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element,n=e.elements;return aS(n,t)}))},vw.prototype.canConnectMessageFlow=tS,vw.prototype.canConnectSequenceFlow=nS,vw.prototype.canConnectDataAssociation=iS,vw.prototype.canConnectAssociation=eS,vw.prototype.canMove=Xw,vw.prototype.canAttach=Kw,vw.prototype.canReplace=Yw,vw.prototype.canDrop=Fw,vw.prototype.canInsert=rS,vw.prototype.canCreate=Zw,vw.prototype.canConnect=Iw,vw.prototype.canResize=Jw,vw.prototype.canCopy=aS;var cS={__depends__:[ed],__init__:["bpmnRules"],bpmnRules:["type",vw]},pS=2e3;function lS(e,t){function n(){var e=t.getRootElements();S(e,(function(e){var t,n,i=Zo(e);t=Gt([e],!1),t=w(t,(function(t){return t!==e&&!t.labelTarget})),n=R(t,Zo),i.set("planeElement",n)}))}e.on("saveXML.start",pS,n)}lS.$inject=["eventBus","canvas"];var uS={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",lS]};function hS(e){Sc.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],(function(e){var n=e.context,i=n.shape||n.connection,r=n.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)})),this.preExecute(["shape.move","connection.move"],(function(e){var n=e.context,i=n.shape||n.connection,r=n.newParent||i.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)}))}function dS(e,t,n){hS.call(this,e);var i=[{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: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(e){if(e.labelTarget)return{level:10};var t=_(i,(function(t){return Yo(e,[t.type])}));return t&&t.order||{level:1}}function o(e){var t=e.order;if(t||(e.order=t=r(e)),!t)throw new Error("no order for <"+e.id+">");return t}function a(e,t,n){var i=t;while(i){if(Yo(i,n))break;i=i.parent}if(!i)throw new Error("no parent for <"+e.id+"> in <"+(t&&t.id)+">");return i}this.getOrdering=function(e,n){if(e.labelTarget)return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var i=o(e);i.containers&&(n=a(e,n,i.containers));var r=n.children.indexOf(e),s=E(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&i.level<o(t).level}));return-1!==s&&-1!==r&&r<s&&(s-=1),{index:s,parent:n}}}hS.prototype.getOrdering=function(e,t){return null},i(hS,Sc),dS.$inject=["eventBus","canvas","translate"],i(dS,hS);var fS={__depends__:[_s],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",dS]},mS=250;function vS(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}function yS(e){var t=e.originalEvent&&e.originalEvent.target;return t&&pe(t,'.group[data-group="tools"]')}vS.$inject=["eventBus","dragging"],vS.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)},vS.prototype.isActive=function(e){return e&&this._active===e},vS.prototype.length=function(e){return this._tools.length},vS.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},vS.prototype.bindEvents=function(e,t){var n=this._eventBus,i=this._dragging,r=[];n.on(t.tool+".init",(function(t){var n=t.context;if(!n.reactivate&&this.isActive(e))return this.setActive(null),void i.cancel();this.setActive(e)}),this),S(t,(function(e){r.push(e+".ended"),r.push(e+".canceled")})),n.on(r,mS,(function(e){this._active&&(yS(e)||this.setActive(null))}),this)};var gS={__depends__:[Yh],__init__:["toolManager"],toolManager:["type",vS]};function bS(e,t){if("x"===e){if(t>0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null}function xS(e,t){var n=[];return S(e.concat(t),(function(i){var r=i.incoming,o=i.outgoing;S(r.concat(o),(function(i){var r=i.source,o=i.target;(_S(e,r)||_S(e,o)||_S(t,r)||_S(t,o))&&(_S(n,i)||n.push(i))}))})),n}function _S(e,t){return-1!==e.indexOf(t)}function ES(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var wS=Math.abs,SS=Math.round,CS={x:"width",y:"height"},AS="crosshair",kS={n:"top",w:"left",s:"bottom",e:"right"},TS=1500,RS={n:"s",w:"e",s:"n",e:"w"},DS=20;function PS(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",(function(e){n.once("spaceTool.selection.ended",(function(){s.activateMakeSpace(e.originalEvent)}))})),n.on("spaceTool.move",TS,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=s.init(e,t)),n&&BS(e)})),n.on("spaceTool.end",(function(e){var t=e.context,i=t.axis,r=t.direction,o=t.movingShapes,a=t.resizingShapes,c=t.start;if(t.initialized){BS(e);var p={x:0,y:0};p[i]=SS(e["d"+i]),s.makeSpace(o,a,p,r,c),n.once("spaceTool.ended",(function(e){s.activateSelection(e.originalEvent,!0,!0)}))}}))}function MS(e){return{top:e.top-DS,right:e.right+DS,bottom:e.bottom+DS,left:e.left-DS}}function BS(e){var t,n,i=e.context,r=i.spaceToolConstraints;r&&(v(r.left)&&(t=Math.max(e.x,r.left),e.dx=e.dx+t-e.x,e.x=t),v(r.right)&&(t=Math.min(e.x,r.right),e.dx=e.dx+t-e.x,e.x=t),v(r.top)&&(n=Math.max(e.y,r.top),e.dy=e.dy+n-e.y,e.y=n),v(r.bottom)&&(n=Math.min(e.y,r.bottom),e.dy=e.dy+n-e.y,e.y=n))}function NS(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s,c,p={};return S(a,(function(e){var l,u,h,d,f,m,y,g=e.attachers,b=e.children,x=mn(e),_=w(b,(function(e){return!LS(e)&&!IS(e)&&!OS(o,e)&&!OS(a,e)})),E=w(b,(function(e){return!LS(e)&&!IS(e)&&OS(o,e)})),S=[],C=[];_.length&&(u=MS(mn(Wt(_))),l=i-x[kS[n]]+u[kS[n]],"n"===n?p.bottom=c=v(c)?Math.min(c,l):l:"w"===n?p.right=c=v(c)?Math.min(c,l):l:"s"===n?p.top=s=v(s)?Math.max(s,l):l:"e"===n&&(p.left=s=v(s)?Math.max(s,l):l)),E.length&&(h=MS(mn(Wt(E))),l=i-h[kS[RS[n]]]+x[kS[RS[n]]],"n"===n?p.bottom=c=v(c)?Math.min(c,l):l:"w"===n?p.right=c=v(c)?Math.min(c,l):l:"s"===n?p.top=s=v(s)?Math.max(s,l):l:"e"===n&&(p.left=s=v(s)?Math.max(s,l):l)),g&&g.length&&(g.forEach((function(e){OS(o,e)?S.push(e):C.push(e)})),S.length&&(d=mn(Wt(S.map(bn))),f=x[kS[RS[n]]]-(d[kS[RS[n]]]-i)),C.length&&(m=mn(Wt(C.map(bn))),y=m[kS[n]]-(x[kS[n]]-i)),"n"===n?(l=Math.min(f||1/0,y||1/0),p.bottom=c=v(c)?Math.min(c,l):l):"w"===n?(l=Math.min(f||1/0,y||1/0),p.right=c=v(c)?Math.min(c,l):l):"s"===n?(l=Math.max(f||-1/0,y||-1/0),p.top=s=v(s)?Math.max(s,l):l):"e"===n&&(l=Math.max(f||-1/0,y||-1/0),p.left=s=v(s)?Math.max(s,l):l));var A=r&&r[e.id];A&&("n"===n?(l=i+e[CS[t]]-A[CS[t]],p.bottom=c=v(c)?Math.min(c,l):l):"w"===n?(l=i+e[CS[t]]-A[CS[t]],p.right=c=v(c)?Math.min(c,l):l):"s"===n?(l=i-e[CS[t]]+A[CS[t]],p.top=s=v(s)?Math.max(s,l):l):"e"===n&&(l=i-e[CS[t]]+A[CS[t]],p.left=s=v(s)?Math.max(s,l):l))})),p}}function OS(e,t){return-1!==e.indexOf(t)}function jS(e){return!!e.host}function LS(e){return!!e.waypoints}function IS(e){return!!e.labelTarget}PS.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],PS.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:AS,data:{context:{reactivate:n}},trapClick:!1})},PS.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:AS,data:{context:{}}})},PS.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},PS.prototype.init=function(e,t){var n=wS(e.dx)>wS(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(wS(i)<5)return!1;i<0&&(i*=-1),qs(e)&&(i*=-1);var o=bS(n,i),a=this._canvas.getRootElement(),s=Gt(a,!0),c=this.calculateAdjustments(s,n,i,r),p=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=NS(c,n,o,r,p);return V(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),Ap("resize-"+("x"===n?"ew":"ns")),!0},PS.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=[],c=[];function p(e){o.includes(e)||o.push(e);var t=e.label;t&&!o.includes(t)&&o.push(t)}function l(e){a.includes(e)||a.push(e)}S(e,(function(e){if(e.parent&&!IS(e))if(LS(e))c.push(e);else{var o=e[t],a=o+e[CS[t]];jS(e)&&(n>0&&bn(e)[t]>i||n<0&&bn(e)[t]<i)?s.push(e):n>0&&o>i||n<0&&a<i?p(e):o<i&&a>i&&r.allowed("shape.resize",{shape:e})&&l(e)}})),S(o,(function(e){var t=e.attachers;t&&S(t,(function(e){p(e)}))}));var u=o.concat(a);return S(s,(function(e){var t=e.host;OS(u,t)&&p(e)})),u=o.concat(a),S(c,(function(e){var t=e.source,n=e.target,i=e.label;OS(u,t)&&OS(u,n)&&i&&p(i)})),{movingShapes:o,resizingShapes:a}},PS.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},PS.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var FS="djs-dragging",$S="djs-resizing",zS=250,HS=Math.max;function GS(e,t,n,i,r){function o(e,t){S(e,(function(e){r.addDragger(e,t),n.addMarker(e,FS)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),r=e.context,o={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},a=Xe("g");$e(a,i.cls("djs-crosshair-group",["no-events"])),Ne(t,a);var s=Xe("path");$e(s,"d",o.x),He(s).add("djs-crosshair"),Ne(a,s);var c=Xe("path");$e(c,"d",o.y),He(c).add("djs-crosshair"),Ne(a,c),r.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){var t=e.context.crosshairGroup;pi(t,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context,n=t.crosshairGroup;n&&ht(n)})),e.on("spaceTool.move",zS,(function(e){var a=e.context,s=a.line,c=a.axis,p=a.movingShapes,l=a.resizingShapes;if(a.initialized){if(!a.dragGroup){var u=n.getLayer("space");s=Xe("path"),$e(s,"d","M0,0 L0,0"),He(s).add("djs-crosshair"),Ne(u,s),a.line=s;var h=Xe("g");$e(h,i.cls("djs-drag-group",["no-events"])),Ne(n.getActiveLayer(),h),o(p,h);var d=a.movingConnections=t.filter((function(e){var t=!1;S(p,(function(n){S(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;S(p,(function(t){S(t.incoming,(function(t){e===t&&(n=!0)}))}));var i=!1;S(l,(function(t){S(t.outgoing,(function(t){e===t&&(i=!0)}))}));var r=!1;return S(l,(function(t){S(t.incoming,(function(t){e===t&&(r=!0)}))})),VS(e)&&(t||i)&&(n||r)}));o(d,h),a.dragGroup=h}if(!a.frameGroup){var f=Xe("g");$e(f,i.cls("djs-frame-group",["no-events"])),Ne(n.getActiveLayer(),f);var m=[];S(l,(function(e){var t=r.addFrame(e,f),i=t.getBBox();m.push({element:t,initialBounds:i}),n.addMarker(e,$S)})),a.frameGroup=f,a.frames=m}var v={x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y};$e(s,{d:v[c]});var y={x:"y",y:"x"},g={x:e.dx,y:e.dy};g[y[a.axis]]=0,pi(a.dragGroup,g.x,g.y),S(a.frames,(function(e){var t,n,i=e.element,r=e.initialBounds;"e"===a.direction?$e(i,{width:HS(r.width+g.x,5)}):(t=HS(r.width-g.x,5),$e(i,{width:t,x:r.x+r.width-t})),"s"===a.direction?$e(i,{height:HS(r.height+g.y,5)}):(n=HS(r.height-g.y,5),$e(i,{height:n,y:r.y+r.height-n}))}))}})),e.on("spaceTool.cleanup",(function(e){var t=e.context,i=t.movingShapes,r=t.movingConnections,o=t.resizingShapes,a=t.line,s=t.dragGroup,c=t.frameGroup;S(i,(function(e){n.removeMarker(e,FS)})),S(r,(function(e){n.removeMarker(e,FS)})),s&&(ht(a),ht(s)),S(o,(function(e){n.removeMarker(e,$S)})),c&&ht(c)}))}function VS(e){return e.waypoints}GS.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var WS={__init__:["spaceToolPreview"],__depends__:[Yh,ed,gS,tv,xv],spaceTool:["type",PS],spaceToolPreview:["type",GS]};function US(e){e.invoke(PS,this)}US.$inject=["injector"],i(US,PS),US.prototype.calculateAdjustments=function(e,t,n,i){var r=PS.prototype.calculateAdjustments.call(this,e,t,n,i);return r.resizingShapes=r.resizingShapes.filter((function(e){return!Ko(e,"bpmn:TextAnnotation")})),r};var qS={__depends__:[WS],spaceTool:["type",US]};function KS(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)}KS.$inject=["eventBus","injector"],KS.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction(n)},KS.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(void 0===r){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},KS.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},KS.prototype.undo=function(){let e,t=this._getUndoAction();if(t){this._currentExecution.trigger="undo",this._pushAction(t);while(t){if(this._internalUndo(t),e=this._getUndoAction(),!e||e.id!==t.id)break;t=e}this._popAction()}},KS.prototype.redo=function(){let e,t=this._getRedoAction();if(t){this._currentExecution.trigger="redo",this._pushAction(t);while(t){if(this._internalExecute(t,!0),e=this._getRedoAction(),!e||e.id!==t.id)break;t=e}this._popAction()}},KS.prototype.register=function(e,t){this._setHandler(e,t)},KS.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},KS.prototype.canUndo=function(){return!!this._getUndoAction()},KS.prototype.canRedo=function(){return!!this._getRedoAction()},KS.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},KS.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},KS.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},KS.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},KS.prototype._createId=function(){return this._uid++},KS.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},KS.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction(e)},KS.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},KS.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:N("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},KS.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=f(e)?e:[e],t.dirty=t.dirty.concat(e))},KS.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},KS.prototype._revertedAction=function(e){this._stackIdx--},KS.prototype._getHandler=function(e){return this._handlerMap[e]},KS.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 YS={commandStack:["type",KS]},XS=new hc("tt");function ZS(e){var t=ke('<div class="djs-tooltip-container" />');return ie(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function JS(e,t,n){ie(e,{left:t+"px",top:n+"px"})}function QS(e,t){e.style.display=!1===t?"none":""}var eC="djs-tooltip",tC="."+eC;function nC(e,t){this._eventBus=e,this._canvas=t,this._ids=XS,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=ZS(t.getContainer());var n=this;Ee.bind(this._tooltipRoot,tC,"mousedown",(function(e){e.stopPropagation()})),Ee.bind(this._tooltipRoot,tC,"mouseover",(function(e){n.trigger("mouseover",e)})),Ee.bind(this._tooltipRoot,tC,"mouseout",(function(e){n.trigger("mouseout",e)})),this._init()}nC.$inject=["eventBus","canvas"],nC.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=V({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},nC.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(re(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},nC.prototype.get=function(e){return"string"!==typeof e&&(e=e.id),this._tooltips[e]},nC.prototype.clearTimeout=function(e){if(e=this.get(e),e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},nC.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)}},nC.prototype.remove=function(e){var t=this.get(e);t&&(Pe(t.html),Pe(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},nC.prototype.show=function(){QS(this._tooltipRoot)},nC.prototype.hide=function(){QS(this._tooltipRoot,!1)},nC.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},nC.prototype._addTooltip=function(e){var t,n=e.id,i=e.html,r=this._tooltipRoot;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),g(i)&&(i=ke(i)),t=ke('<div data-tooltip-id="'+n+'" class="'+eC+'">'),ie(t,{position:"absolute"}),t.appendChild(i),e.type&&ae(t).add("djs-tooltip-"+e.type),e.className&&ae(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},nC.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;JS(n,t.x,t.y)},nC.prototype._updateTooltipVisibilty=function(e){S(this._tooltips,(function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),QS(i,r))}))},nC.prototype._init=function(){var e=this;function t(t){e._updateRoot(t),e._updateTooltipVisibilty(t),e.show()}this._eventBus.on("canvas.viewbox.changing",(function(t){e.hide()})),this._eventBus.on("canvas.viewbox.changed",(function(e){t(e.viewbox)}))};var iC={__init__:["tooltips"],tooltips:["type",nC]};function rC(e,t){if("function"!==typeof t)throw new Error("removeFn iterator must be a function");if(e){var n;while(n=e[0])t(n);return e}}var oC=250,aC=1400;function sC(e,t,n){Sc.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",aC,(function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=cC(n),t.validatedShapes=cC(i)})),i&&t.on("shape.move.start",oC,(function(e){var t=e.context,n=t.shapes,r=[];S(n,(function(e){S(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||r.push(n),e.labelTarget&&r.push(e)}))})),S(r,(function(e){i.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",aC,(function(e){var t=e.context,n=t.closure,i=n.enclosedElements,r=[];S(i,(function(e){S(e.labels,(function(e){i[e.id]||r.push(e)}))})),n.addAll(r)})),this.preExecute(["connection.delete","shape.delete"],(function(e){var t=e.context,i=t.connection||t.shape;rC(i.labels,(function(e){n.removeShape(e,{nested:!0})}))})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=n.labelTarget;i&&(t.labelTargetIndex=nn(i.labels,n),t.labelTarget=i,n.labelTarget=null)})),this.revert("shape.delete",(function(e){var t=e.context,n=t.shape,i=t.labelTarget,r=t.labelTargetIndex;i&&(tn(i.labels,n,r),n.labelTarget=i)}))}function cC(e){return w(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}i(sC,Sc),sC.$inject=["injector","eventBus","modeling"];var pC={__init__:["labelSupport"],labelSupport:["type",sC]},lC=251,uC=1401,hC="attach-ok";function dC(e,t,n,i,r){Sc.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",uC,(function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=mC(n),t.validatedShapes=vC(i)})),o&&t.on("shape.move.start",lC,(function(e){var t=e.context,n=t.shapes,i=fC(n);S(i,(function(e){o.makeDraggable(t,e,!0),S(e.labels,(function(e){o.makeDraggable(t,e,!0)}))}))})),o&&t.on("shape.move.start",(function(e){var i=e.context,r=i.shapes;if(1===r.length){var o=r[0],a=o.host;a&&(n.addMarker(a,hC),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(a,hC)})))}})),this.preExecuted("elements.move",uC,(function(e){var t=e.context,n=t.closure,i=t.shapes,r=fC(i);S(r,(function(e){n.add(e,n.topLevel[e.host.id])}))})),this.postExecuted("elements.move",(function(e){var t,n=e.context,i=n.shapes,o=n.newHost;o&&1!==i.length||(t=o?i:w(i,(function(e){var t=e.host;return yC(e)&&!gC(i,t)})),S(t,(function(e){r.updateAttachment(e,o)})))})),this.postExecuted("elements.move",(function(e){var t=e.context.shapes;S(t,(function(e){S(e.attachers,(function(e){S(e.outgoing.slice(),(function(e){var t=i.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target});t||r.removeConnection(e)})),S(e.incoming.slice(),(function(e){var t=i.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target});t||r.removeConnection(e)}))}))}))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,i=t.host;i&&r.updateAttachment(n,i)})),this.postExecute("shape.replace",(function(e){var t=e.context,n=t.oldShape,o=t.newShape;rC(n.attachers,(function(e){var t=i.allowed("elements.move",{target:o,shapes:[e]});"attach"===t?r.updateAttachment(e,o):r.removeShape(e)})),o.attachers.length&&S(o.attachers,(function(e){var t=F_(e,n,o);r.moveShape(e,t,e.parent)}))})),this.postExecute("shape.resize",(function(e){var t=e.context,n=t.shape,i=t.oldBounds,o=t.newBounds,a=n.attachers,s=t.hints||{};!1!==s.attachSupport&&S(a,(function(e){var t=F_(e,i,o);r.moveShape(e,t,e.parent),S(e.labels,(function(e){r.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;rC(t.attachers,(function(e){r.removeShape(e)})),t.host&&r.updateAttachment(t,null)}))}function fC(e){return c(R(e,(function(e){return e.attachers||[]})))}function mC(e){var t=fC(e);return O("id",e,t)}function vC(e){var t=B(e,"id");return w(e,(function(e){while(e){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0}))}function yC(e){return!!e.host}function gC(e,t){return-1!==e.indexOf(t)}i(dC,Sc),dC.$inject=["injector","eventBus","canvas","rules","modeling"];var bC={__depends__:[ed],__init__:["attachSupport"],attachSupport:["type",dC]};function xC(e){this._model=e}function _C(e,t,n,i){Sc.call(this,e),this._bpmnFactory=t,this._translate=i;var r=this;function o(e){var t,i=e.context,r=i.hints||{};i.cropped||!1===r.createElementsBehavior||(t=i.connection,t.waypoints=n.getCroppedWaypoints(t),i.cropped=!0)}function a(e){var t=e.context;r.updateParent(t.shape||t.connection,t.oldParent)}function s(e){var t=e.context,n=t.shape||t.connection,i=t.parent||t.newParent;r.updateParent(n,i)}function c(e){var t=e.context,n=t.oldRoot,i=n.children;S(i,(function(e){Ko(e,"bpmn:BaseElement")&&r.updateParent(e)}))}function p(e){var t=e.context.shape;Ko(t,"bpmn:BaseElement")&&r.updateBounds(t)}function l(e){r.updateConnection(e.context)}function u(e){r.updateConnectionWaypoints(e.context.connection)}function h(e){r.updateAttachment(e.context)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],(function(e){delete e.context.cropped})),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],wC(a)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],wC(s)),this.executed(["canvas.updateRoot"],c),this.reverted(["canvas.updateRoot"],c),this.executed(["shape.move","shape.create","shape.resize"],wC((function(e){"label"!==e.context.shape.type&&p(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],wC((function(e){"label"!==e.context.shape.type&&p(e)}))),e.on("shape.changed",(function(e){"label"===e.element.type&&p({context:{shape:e.element}})})),this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],wC(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],wC(l)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],wC(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],wC(u)),this.executed("connection.reconnect",wC((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Xo(n),a=Xo(i),s=Xo(r);o.conditionExpression&&!Yo(s,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),i!==r&&a.default===o&&(t.oldDefault=a.default,delete a.default)}))),this.reverted("connection.reconnect",wC((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Xo(n),a=Xo(i),s=Xo(r);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(a.default=t.oldDefault,delete s.default)}))),this.executed(["element.updateAttachment"],wC(h)),this.reverted(["element.updateAttachment"],wC(h))}function EC(e){while(e&&!Ko(e,"bpmn:Definitions"))e=e.$parent;return e}function wC(e){return function(t){var n=t.context,i=n.shape||n.connection;Ko(i,"bpmn:BaseElement")&&e(t)}}function SC(e){if(Ko(e,"bpmn:Activity")){var t=Zo(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function CC(e,t,n){Qn.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function AC(e,t,n){return S(n,(function(n){t=kC(e,t,n)})),t}function kC(e,t,n){return void 0===t[n]?t:(e[n]=t[n],q(t,[n]))}function TC(e){return Yo(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function RC(e,t){this._modeling=e,this._canvas=t}function DC(e){this._modeling=e}function PC(e,t){return T(e.outgoing,(function(e){return e.target===t}))}function MC(e,t){this._canvas=e,this._layouter=t}xC.$inject=["moddle"],xC.prototype._needsId=function(e){return Yo(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"])},xC.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=Ko(e,"bpmn:Activity")?"Activity":Ko(e,"bpmn:Event")?"Event":Ko(e,"bpmn:Gateway")?"Gateway":Yo(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},xC.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},xC.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},xC.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",V({bpmnElement:e,bounds:this.createDiBounds()},t))},xC.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},xC.prototype.createDiWaypoints=function(e){var t=this;return R(e,(function(e){return t.createDiWaypoint(e)}))},xC.prototype.createDiWaypoint=function(e){return this.create("dc:Point",U(e,["x","y"]))},xC.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",V({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},xC.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",V({bpmnElement:e},t))},i(_C,Sc),_C.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],_C.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},_C.prototype.updateParent=function(e,t){if(!(e instanceof Yn)&&!(Ko(e,"bpmn:DataStoreReference")&&e.parent&&Ko(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Zo(e),o=n&&n.businessObject,a=Zo(n);Ko(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),Ko(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),Ko(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(i,o),Ko(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},_C.prototype.updateBounds=function(e){var t=Zo(e),n=SC(e);if(n){var i=Pp(n,t.get("bounds"));V(n,{x:e.x+i.x,y:e.y+i.y})}var r=e instanceof Yn?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),V(o,{x:e.x,y:e.y,width:e.width,height:e.height})},_C.prototype.updateFlowNodeRefs=function(e,t,n){var i,r;n!==t&&(Ko(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),en(i,e)),Ko(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),tn(r,e)))},_C.prototype.updateDiConnection=function(e,t,n){var i=Zo(e),r=Zo(t),o=Zo(n);i.sourceElement&&i.sourceElement.bpmnElement!==Xo(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Xo(n)&&(i.targetElement=n&&o)},_C.prototype.updateDiParent=function(e,t){if(t&&!Ko(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(en(n,e),e.$parent=null)}},_C.prototype.getLaneSet=function(e){var t,n;return Ko(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(Ko(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)},_C.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t&&(!Ko(e,"bpmn:DataInput")&&!Ko(e,"bpmn:DataOutput")||(Ko(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(Ko(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(Ko(e,"bpmn:FlowElement")){if(t)if(Ko(t,"bpmn:Participant"))t=t.processRef;else if(Ko(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(Ko(t,"bpmn:Lane"));i="flowElements"}else if(Ko(e,"bpmn:Artifact")){while(t&&!Ko(t,"bpmn:Process")&&!Ko(t,"bpmn:SubProcess")&&!Ko(t,"bpmn:Collaboration")){if(Ko(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(Ko(e,"bpmn:MessageFlow"))i="messageFlows";else if(Ko(e,"bpmn:Participant")){i="participants";var o,a=e.processRef;a&&(o=EC(e.$parent||t),e.$parent&&(en(o.get("rootElements"),a),a.$parent=null),t&&(tn(o.get("rootElements"),a),a.$parent=o))}else Ko(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":Ko(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(r("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var s;if(e.$parent&&(s=e.$parent.get(i),en(s,e)),t?(s=t.get(i),s.push(e),e.$parent=t):e.$parent=null,n){var c=n.get(i);en(s,e),t&&(c||(c=[],t.set(i,c)),c.push(e))}}},_C.prototype.updateConnectionWaypoints=function(e){var t=Zo(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},_C.prototype.updateConnection=function(e){var t,n=e.connection,i=Xo(n),r=n.source,o=Xo(r),a=n.target,s=Xo(n.target);if(Ko(i,"bpmn:DataAssociation"))Ko(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=o,t=e.parent||e.newParent||s,this.updateSemanticParent(i,s,t)):Ko(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,t),i.targetRef=s);else{var c=Ko(i,"bpmn:SequenceFlow");i.sourceRef!==o&&(c&&(en(i.sourceRef&&i.sourceRef.get("outgoing"),i),o&&o.get("outgoing")&&o.get("outgoing").push(i)),i.sourceRef=o),i.targetRef!==s&&(c&&(en(i.targetRef&&i.targetRef.get("incoming"),i),s&&s.get("incoming")&&s.get("incoming").push(i)),i.targetRef=s)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,r,a)},_C.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},i(CC,Qn),CC.$inject=["bpmnFactory","moddle","translate"],CC.prototype.baseCreate=Qn.prototype.create,CC.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this.baseCreate(e,V({type:"label",di:n},Es,t))}return this.createBpmnElement(e,t)},CC.prototype.createBpmnElement=function(e,t){var n,i=this._translate;t=V({},t||{});var r,o,a=t.businessObject,s=t.di;if(!a){if(!t.type)throw new Error(i("no shape type specified"));a=this._bpmnFactory.create(t.type),Vo(a)}if(!TC(s)){var c=V({},s||{},{id:a.id+"_di"});s="root"===e?this._bpmnFactory.createDiPlane(a,c):"connection"===e?this._bpmnFactory.createDiEdge(a,c):this._bpmnFactory.createDiShape(a,c)}return Ko(a,"bpmn:Group")&&(t=V({isFrame:!0},t)),t=AC(a,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=kC(s,t,"isExpanded")),Ko(a,"bpmn:SubProcess")&&(t.collapsed=!_a(a,s)),Ko(a,"bpmn:ExclusiveGateway")&&(s.isMarkerVisible=!0),h(t.triggeredByEvent)&&(a.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),h(t.cancelActivity)&&(a.cancelActivity=t.cancelActivity,delete t.cancelActivity),t.eventDefinitionType&&(r=a.get("eventDefinitions")||[],o=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(o.condition=this._bpmnFactory.create("bpmn:FormalExpression")),r.push(o),o.$parent=a,a.eventDefinitions=r,delete t.eventDefinitionType),n=this.getDefaultSize(a,s),t=V({id:a.id},n,t,{businessObject:a,di:s}),this.baseCreate(e,t)},CC.prototype.getDefaultSize=function(e,t){var n=Xo(e);return t=t||Zo(e),Ko(n,"bpmn:SubProcess")?_a(n,t)?{width:350,height:200}:{width:100,height:80}:Ko(n,"bpmn:Task")?{width:100,height:80}:Ko(n,"bpmn:Gateway")?{width:50,height:50}:Ko(n,"bpmn:Event")?{width:36,height:36}:Ko(n,"bpmn:Participant")?_a(n,t)?{width:600,height:250}:{width:400,height:60}:Ko(n,"bpmn:Lane")?{width:400,height:100}:Ko(n,"bpmn:DataObjectReference")?{width:36,height:50}:Ko(n,"bpmn:DataStoreReference")?{width:50,height:50}:Ko(n,"bpmn:TextAnnotation")?{width:100,height:30}:Ko(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},CC.prototype.createParticipantShape=function(e){return m(e)||(e={isExpanded:e}),e=V({type:"bpmn:Participant"},e||{}),!1!==e.isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},RC.$inject=["modeling","canvas"],RC.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;S(n,(function(e){var n={x:0,y:0};h(i.left)?n.x=i.left-e.x:h(i.right)?n.x=i.right-e.width-e.x:h(i.center)?n.x=i.center-Math.round(e.width/2)-e.x:h(i.top)?n.y=i.top-e.y:h(i.bottom)?n.y=i.bottom-e.height-e.y:h(i.middle)&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},RC.prototype.postExecute=function(e){},DC.$inject=["modeling"],DC.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},DC.prototype.postExecute=function(e){var t=e.hints||{};PC(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))},MC.$inject=["canvas","layouter"],MC.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},MC.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var BC=Math.round;function NC(e){this._modeling=e}function OC(e){return!!e.waypoints}NC.$inject=["modeling"],NC.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;S(t,(function(e){v(e.x)||(e.x=0),v(e.y)||(e.y=0)}));var s=w(t,(function(e){return!e.hidden})),c=Wt(s);S(t,(function(e){OC(e)&&(e.waypoints=R(e.waypoints,(function(e){return{x:BC(e.x-c.x-c.width/2+r.x),y:BC(e.y-c.y-c.height/2+r.y)}}))),V(e,{x:BC(e.x-c.x-c.width/2+r.x),y:BC(e.y-c.y-c.height/2+r.y)})}));var p=It(t),l={};S(t,(function(e){if(OC(e))l[e.id]=v(i)?a.createConnection(l[e.source.id],l[e.target.id],i,e,e.parent||n,o):a.createConnection(l[e.source.id],l[e.target.id],e,e.parent||n,o);else{var t=V({},o);-1===p.indexOf(e)&&(t.autoResize=!1),l[e.id]=v(i)?a.createShape(e,U(e,["x","y","width","height"]),e.parent||n,i,t):a.createShape(e,U(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=M(l)};var jC=Math.round;function LC(e){this._canvas=e}function IC(e){LC.call(this,e)}LC.$inject=["canvas"],LC.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?V(t,n):V(t,{x:n.x-jC(t.width/2),y:n.y-jC(t.height/2)}),this._canvas.addShape(t,i,r),t},LC.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},i(IC,LC),IC.$inject=["canvas"];var FC=LC.prototype.execute;IC.prototype.execute=function(e){var t=e.shape;return zC(t),t.labelTarget=e.labelTarget,FC.call(this,e)};var $C=LC.prototype.revert;function zC(e){["width","height"].forEach((function(t){"undefined"===typeof e[t]&&(e[t]=0)}))}function HC(e,t){this._canvas=e,this._modeling=t}function GC(e,t){this._modeling=e,this._elementRegistry=t}function VC(e,t){this._canvas=e,this._modeling=t}function WC(e){return e.waypoints}function UC(e){this._modeling=e}IC.prototype.revert=function(e){return e.shape.labelTarget=null,$C.call(this,e)},HC.$inject=["canvas","modeling"],HC.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;rC(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),rC(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},HC.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=nn(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},HC.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,tn(n.children,t,i),this._canvas.addConnection(t,n),t},GC.$inject=["modeling","elementRegistry"],GC.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;S(i,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},VC.$inject=["canvas","modeling"],VC.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;rC(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),rC(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),rC(n.children,(function(e){WC(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},VC.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=nn(i.children,n),t.removeShape(n),n},VC.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return tn(i.children,n,r),t.addShape(n,i),n},UC.$inject=["modeling"];var qC={x:"y",y:"x"};function KC(e,t){this._layouter=e,this._canvas=t}function YC(){}function XC(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function ZC(e){this._modeling=e}function JC(e){this._helper=new ZC(e)}function QC(e){this._modeling=e,this._helper=new ZC(e)}function eA(e){this._modeling=e}function tA(e){return e.original||e}function nA(e,t){this._modeling=e,this._rules=t}function iA(e){this._modeling=e}function rA(e){this._modeling=e}function oA(e){return V({},e)}function aA(e){return R(e.waypoints,(function(e){return e=oA(e),e.original&&(e.original=oA(e.original)),e}))}function sA(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function cA(e,t,n){var i=sA(n);return/e|s/.test(n)?e[i]>t:/n|w/.test(n)?e[i]<t:void 0}function pA(e,t){return-1!==e.indexOf(t)}function lA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function uA(e){this._modeling=e}function hA(e){var t={};return S(e,(function(e){t[e.id]=e.hidden,e.children&&(t=V({},t,hA(e.children)))})),t}function dA(e,t){var n=[];return S(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(dA(e.children,e.collapsed||t)))})),n}function fA(e,t){var n=[];return S(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(fA(e.children,t)))})),n}function mA(e){this._modeling=e}function vA(e,t){return en(e&&e.attachers,t)}function yA(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),tn(i,t,n)}}function gA(){}function bA(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",(function(){i.registerHandlers(n)}))}function xA(e){this._elementRegistry=e}function _A(e,t){return A(t,(function(t,n){return t[n]=e.get(n),t}),{})}function EA(e,t){S(t,(function(t,n){e.set(n,t)}))}function wA(e,t){return t.filter((function(t){return Ko(t,"bpmn:DataObjectReference")&&Xo(t).dataObjectRef===e}))}UC.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(e,t){e.range.min=Math.min(t[i],e.range.min),e.range.max=Math.max(t[i]+t[r],e.range.max)}function a(e){return e[i]+e[r]/2}function s(e){return e.length-1}function c(e){return e.max-e.min}function p(e,n){var r={y:0};r[i]=e-a(n),r[i]&&(r[qC[i]]=0,t.moveElements([n],r,n.parent))}var l,u,h=n[0],d=s(n),f=n[d],m=0;S(n,(function(e,t){var l,u,h;e.elements.length<2?t&&t!==n.length-1&&(o(e,e.elements[0]),m+=c(e.range)):(l=j(e.elements,i),u=l[0],t===d&&(u=l[s(l)]),h=a(u),e.range=null,S(l,(function(t){p(h,t),null!==e.range?o(e,t):e.range={min:t[i],max:t[i]+t[r]}})),t&&t!==n.length-1&&(m+=c(e.range)))})),u=Math.abs(f.range.min-h.range.max),l=Math.round((u-m)/(n.length-1)),l<n.length-1||S(n,(function(e,o){var a,s={};e!==h&&e!==f&&(a=n[o-1],e.range.max=0,S(e.elements,(function(n,o){s[qC[i]]=0,s[i]=a.range.max-n[i]+l,e.range.min!==n[i]&&(s[i]+=n[i]-e.range.min),s[i]&&t.moveElements([n],s,n.parent),e.range.max=Math.max(n[i]+n[r],o?e.range.max:0)})))}))},UC.prototype.postExecute=function(e){},KC.$inject=["layouter","canvas"],KC.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return V(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},KC.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},YC.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=en(o.children,t),tn(i.children,t,r),t.parent=i,S(t.waypoints,(function(e){e.x+=n.x,e.y+=n.y,e.original&&(e.original.x+=n.x,e.original.y+=n.y)})),t},YC.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return en(n.children,t),tn(i.children,t,r),t.parent=i,S(t.waypoints,(function(e){e.x-=o.x,e.y-=o.y,e.original&&(e.original.x-=o.x,e.original.y-=o.y)})),t},XC.prototype.add=function(e,t){return this.addAll([e],t)},XC.prototype.addAll=function(e,t){var n=Vt(e,!!t,this);return V(this,n),this},ZC.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ZC.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,p=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),S(a,(function(e){o.moveShape(e,t,p[e.id]&&!l&&n,{recurse:!1,layout:!1})})),S(s,(function(e){var i=!!a[e.source.id],r=!!a[e.target.id];c[e.id]&&i&&r?o.moveConnection(e,t,p[e.id]&&!l&&n):o.layoutConnection(e,{connectionStart:i&&nE(e,e.source,t),connectionEnd:r&&iE(e,e.target,t)})}))},ZC.prototype.getClosure=function(e){return(new XC).addAll(e,!0)},JC.$inject=["modeling"],JC.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},JC.prototype.postExecute=function(e){var t,n=e.hints;n&&n.primaryShape&&(t=n.primaryShape,n.oldParent=t.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,t)},QC.$inject=["modeling"],QC.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=U(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=en(o.children,t),tn(i.children,t,r),V(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},QC.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(S(t.incoming,(function(e){r.layoutConnection(e,{connectionEnd:iE(e,t,n)})})),S(t.outgoing,(function(e){r.layoutConnection(e,{connectionStart:nE(e,t,n)})}))),!1!==i.recurse&&this.moveChildren(e)},QC.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return tn(n.children,t,i),V(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},QC.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},QC.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},eA.$inject=["modeling"],eA.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return f(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},eA.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||i&&"source"!==o.docking||(a.connectionStart=a.connectionStart||tA(f(r)?r[0]:r)),!i||n&&"target"!==o.docking||(a.connectionEnd=a.connectionEnd||tA(f(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},eA.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r},nA.$inject=["modeling","rules"],nA.prototype.preExecute=function(e){var t,n=this,i=this._modeling,r=this._rules,o=e.oldShape,a=e.newData,s=e.hints||{};function c(e,t,n){return r.allowed("connection.reconnect",{connection:n,source:e,target:t})}var p,l={x:a.x,y:a.y},u={x:o.x,y:o.y,width:o.width,height:o.height};t=e.newShape=e.newShape||n.createShape(a,l,o.parent,s),o.host&&i.updateAttachment(t,o.host),!1!==s.moveChildren&&(p=o.children.slice(),i.moveElements(p,{x:0,y:0},t,s));var h=o.incoming.slice(),d=o.outgoing.slice();S(h,(function(e){var i=e.source,r=c(i,t,e);r&&n.reconnectEnd(e,t,tE(e,t,u),s)})),S(d,(function(e){var i=e.target,r=c(t,i,e);r&&n.reconnectStart(e,t,eE(e,t,u),s)}))},nA.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},nA.prototype.execute=function(e){},nA.prototype.revert=function(e){},nA.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},nA.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},nA.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)},iA.$inject=["modeling"],iA.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},iA.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};!1!==r.layout&&(S(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:tE(e,n,i)})})),S(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:eE(e,n,i)})})))},iA.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},rA.$inject=["modeling"],rA.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),S(r,(function(e){a[e.id]=lA(e)})),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(xS(i,r),t,n,o,i,r,a)},rA.prototype.execute=function(){},rA.prototype.revert=function(){},rA.prototype.moveShapes=function(e,t){var n=this;S(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},rA.prototype.resizeShapes=function(e,t,n){var i=this;S(e,(function(e){var r=ES(e,n,t);i._modeling.resizeShape(e,r,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},rA.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=r.concat(o);S(e,(function(e){var p=e.source,l=e.target,u=aA(e),h=sA(n),d={};pA(c,p)&&pA(c,l)?(u=R(u,(function(e){return cA(e,i,n)&&(e[h]=e[h]+t[h]),e.original&&cA(e.original,i,n)&&(e.original[h]=e.original[h]+t[h]),e})),s._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(pA(c,p)||pA(c,l))&&(pA(r,p)?d.connectionStart=nE(e,p,t):pA(r,l)?d.connectionEnd=iE(e,l,t):pA(o,p)?d.connectionStart=eE(e,p,a[p.id]):pA(o,l)&&(d.connectionEnd=tE(e,l,a[l.id])),s._modeling.layoutConnection(e,d))}))},uA.$inject=["modeling"],uA.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=hA(n),t.collapsed=!t.collapsed;var i=dA(n,t.collapsed);return[t].concat(i)},uA.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=fA(i,n);return t.collapsed=!t.collapsed,[t].concat(r)},mA.$inject=["modeling"],mA.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=vA(i,t),yA(n,t),t.host=n,t},mA.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,vA(n,t),yA(i,t,r),t},gA.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},gA.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},bA.$inject=["eventBus","elementFactory","commandStack"],bA.prototype.getHandlers=function(){return{"shape.append":DC,"shape.create":LC,"shape.delete":VC,"shape.move":QC,"shape.resize":iA,"shape.replace":nA,"shape.toggleCollapse":uA,spaceTool:rA,"label.create":IC,"connection.create":MC,"connection.delete":HC,"connection.move":YC,"connection.layout":KC,"connection.updateWaypoints":gA,"connection.reconnect":eA,"elements.create":NC,"elements.move":JC,"elements.delete":GC,"elements.distribute":UC,"elements.align":RC,"element.updateAttachment":mA}},bA.prototype.registerHandlers=function(e){S(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},bA.prototype.moveShape=function(e,t,n,i,r){"object"===typeof i&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},bA.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},bA.prototype.moveElements=function(e,t,n,i){i=i||{};var r,o=i.attach,a=n;!0===o?(r=n,a=n.parent):!1===o&&(r=null);var s={shapes:e,delta:t,newParent:a,newHost:r,hints:i};this._commandStack.execute("elements.move",s)},bA.prototype.moveConnection=function(e,t,n,i,r){"object"===typeof i&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},bA.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},bA.prototype.createConnection=function(e,t,n,i,r,o){"object"===typeof n&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},bA.prototype.createShape=function(e,t,n,i,r){"number"!==typeof i&&(r=i,i=void 0),r=r||{};var o,a,s=r.attach;e=this._create("shape",e),s?(o=n.parent,a=n):o=n;var c={position:t,shape:e,parent:o,parentIndex:i,host:a,hints:r};return this._commandStack.execute("shape.create",c),c.shape},bA.prototype.createElements=function(e,t,n,i,r){f(e)||(e=[e]),"number"!==typeof i&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},bA.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},bA.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},bA.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},bA.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},bA.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},bA.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},bA.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},bA.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},bA.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},bA.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},bA.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},bA.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},bA.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,V(i,{docking:"source"}))},bA.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,V(i,{docking:"target"}))},bA.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},bA.prototype._create=function(e,t){return t instanceof Un?t:this._elementFactory.create(e,t)},bA.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},xA.$inject=["elementRegistry"],xA.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this.getVisualReferences(n).concat(t),o=e.oldProperties||_A(n,D(i));return EA(n,i),e.oldProperties=o,e.changed=r,r},xA.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return EA(n,t),i},xA.prototype.getVisualReferences=function(e){var t=this._elementRegistry;return Ko(e,"bpmn:DataObject")?wA(e,t):[]};var SA="default",CA="id",AA="di",kA={width:0,height:0};function TA(e,t,n,i,r){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textRenderer=r}function RA(e,t){return CA in e&&e[CA]!==t[CA]}function DA(e,t){var n=D(t),i=e.businessObject,r=Zo(e);return A(n,(function(e,n){return e[n]=n!==AA?i.get(n):PA(r,D(t.di)),e}),{})}function PA(e,t){return A(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}function MA(e,t){var n=e.businessObject,i=Zo(e);S(t,(function(e,t){t!==AA?n.set(t,e):i&&BA(i,e)}))}function BA(e,t){S(t,(function(t,n){e.set(n,t)}))}TA.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],TA.prototype.execute=function(e){var t=e.element,n=[t],i=this._translate;if(!t)throw new Error(i("element required"));var r=this._elementRegistry,o=this._moddle.ids,a=t.businessObject,s=OA(e.properties),c=e.oldProperties||DA(t,s);return RA(s,a)&&(o.unclaim(a[CA]),r.updateId(t,s[CA]),o.claim(s[CA],a)),SA in s&&(s[SA]&&n.push(r.get(s[SA].id)),a[SA]&&n.push(r.get(a[SA].id))),MA(t,s),e.oldProperties=c,e.changed=n,n},TA.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Xo(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,kA)}},TA.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return MA(t,i),RA(n,r)&&(a.unclaim(n[CA]),o.updateId(t,i[CA]),a.claim(i[CA],r)),e.changed};var NA=["default"];function OA(e){var t=V({},e);return NA.forEach((function(n){n in e&&(t[n]=Xo(t[n]))})),t}function jA(e,t){this._canvas=e,this._modeling=t}function LA(e,t){this._modeling=e,this._spaceTool=t}function IA(e,t){this._modeling=e,this._translate=t}function FA(e,t){this._modeling=e,this._spaceTool=t}jA.$inject=["canvas","modeling"],jA.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Zo(r);t.setRootElement(n),t.removeRootElement(r),tn(a.rootElements,i),i.$parent=a,en(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r},jA.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Zo(n);t.setRootElement(r),t.removeRootElement(n),en(a.rootElements,i),i.$parent=null,tn(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s},LA.$inject=["modeling","spaceTool"],LA.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Ny(i),a=o===i,s=a?i:i.parent,c=By(s);c.length||n.createShape({type:"bpmn:Lane"},{x:i.x+Py,y:i.y,width:i.width-Py,height:i.height},s);var p=[];zt(o,(function(e){return p.push(e),e.label&&p.push(e.label),e===i?[]:w(e.children,(function(e){return e!==i}))}));var l="top"===r?-120:120,u="top"===r?i.y:i.y+i.height,h=u+("top"===r?10:-10),d="top"===r?"n":"s",f=t.calculateAdjustments(p,"y",l,h);t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:l},d,h),e.newLane=n.createShape({type:"bpmn:Lane"},{x:i.x+(a?Py:0),y:u-("top"===r?120:0),width:i.width-(a?Py:0),height:120},s)},IA.$inject=["modeling","translate"],IA.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=By(i),a=o.length;if(a>r)throw new Error(n("more than {count} child lanes",{count:r}));var s,c,p,l,u,h=Math.round(i.height/r);for(u=0;u<r;u++)s=i.y+u*h,c=u===r-1?i.height-h*u:h,p={x:i.x+Py,y:s,width:i.width-Py,height:c},u<a?t.resizeShape(o[u],p):(l={type:"bpmn:Lane"},t.createShape(l,p,i))},FA.$inject=["modeling","spaceTool"],FA.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;!1!==i?this.resizeBalanced(t,n):this.resizeSpace(t,n)},FA.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Oy(e,t);n.resizeShape(e,t),i.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},FA.prototype.resizeSpace=function(e,t){var n,i,r,o,a,s=this._spaceTool,c=mn(e),p=mn(t),l=gy(p,c),u=Ny(e),h=[],d=[];zt(u,(function(e){return h.push(e),(Ko(e,"bpmn:Lane")||Ko(e,"bpmn:Participant"))&&d.push(e),e.children})),(l.bottom||l.top)&&(n=l.bottom||l.top,i=e.y+(l.bottom?e.height:0)+(l.bottom?-10:10),r=l.bottom?"s":"n",o=l.top>0||l.bottom<0?-n:n,a=s.calculateAdjustments(h,"y",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:0,y:n},r)),(l.left||l.right)&&(n=l.right||l.left,i=e.x+(l.right?e.width:0)+(l.right?-10:100),r=l.right?"e":"w",o=l.left>0||l.right<0?-n:n,a=s.calculateAdjustments(d,"x",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:n,y:0},r))};var $A="flowNodeRef",zA="lanes";function HA(e){this._elementRegistry=e}function GA(e){this._moddle=e}HA.$inject=["elementRegistry"],HA.prototype.computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(e,t){var n=mn(t),i={x:e.x+e.width/2,y:e.y+e.height/2};return i.x>n.left&&i.x<n.right&&i.y>n.top&&i.y<n.bottom}function s(e){-1===n.indexOf(e)&&(o.push(e),n.push(e))}function c(e){var t=Ny(e);return r[t.id]||(r[t.id]=My(t)),r[t.id]}function p(e){if(!e.parent)return[];var t=c(e);return t.filter((function(t){return a(e,t)})).map((function(e){return e.businessObject}))}return t.forEach((function(e){var t=Ny(e);if(t&&-1===n.indexOf(t)){var i=t.children.filter((function(e){return Ko(e,"bpmn:FlowNode")}));i.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(zA),r=n.slice(),o=p(e);i.push({flowNode:t,remove:r,add:o})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get($A).forEach((function(e){i.push({flowNode:e,remove:[t],add:[]})}))})),i},HA.prototype.execute=function(e){var t=e.updates;t||(t=e.updates=this.computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach((function(e){var t=e.flowNode,n=t.get(zA);e.remove.forEach((function(e){en(n,e),en(e.get($A),t)})),e.add.forEach((function(e){tn(n,e),tn(e.get($A),t)}))}))},HA.prototype.revert=function(e){var t=e.updates;t.forEach((function(e){var t=e.flowNode,n=t.get(zA);e.add.forEach((function(e){en(n,e),en(e.get($A),t)})),e.remove.forEach((function(e){tn(n,e),tn(e.get($A),t)}))}))},GA.$inject=["moddle"],GA.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;r?t.claim(n,i):t.unclaim(n)},GA.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;r?t.unclaim(n):t.claim(n,i)};var VA={fill:void 0,stroke:void 0};function WA(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(g(e)){var t=UA(e);if(t)return t}throw new Error("invalid color value: "+e)}}}function UA(e){var t=document.createElement("canvas").getContext("2d");return t.fillStyle="transparent",t.fillStyle=e,/^#[0-9a-fA-F]{6}$/.test(t.fillStyle)?t.fillStyle:null}function qA(e){return!!e.waypoints}function KA(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}WA.$inject=["commandStack"],WA.prototype.postExecute=function(e){var t=e.elements,n=e.colors||VA,i=this,r={};"fill"in n&&V(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&V(r,{"border-color":this._normalizeColor(n.stroke)}),S(t,(function(e){var t=qA(e)?U(r,["border-color"]):r,n=Zo(e);if(KA(t),Ds(e))i._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:r["border-color"]}});else{if(!Yo(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var YA={width:0,height:0};function XA(e,t,n){function i(e,t){if(!Ss(e)){var i=Zo(e);t&&!i.label&&(i.label=n.create("bpmndi:BPMNLabel")),!t&&i.label&&delete i.label}}function r(e,t){var n=e.label||e,r=e.labelTarget||e;return Pa(n,t,r!==n),i(e,t),[n,r]}function o(t){var n=t.element,i=n.businessObject,r=t.newLabel;if(!Ds(n)&&Ss(n)&&!Cs(n)&&!ZA(r)){var o=7,a=Ts(n);a={x:a.x,y:a.y+o},e.createLabel(n,a,{id:i.id+"_label",businessObject:i,di:n.di})}}function a(e){return e.oldLabel=Da(e.element),r(e.element,e.newLabel)}function s(e){return r(e.element,e.oldLabel)}function c(n){var i=n.element,r=i.label||i,o=n.newLabel,a=n.newBounds,s=n.hints||{};if(Ds(r)||Ko(r,"bpmn:TextAnnotation"))if(Ds(r)&&ZA(o))!1!==s.removeShape&&e.removeShape(r,{unsetLabel:!1});else{var c=Da(r);"undefined"===typeof a&&(a=t.getExternalLabelBounds(r,c)),a&&e.resizeShape(r,a,YA)}}this.preExecute=o,this.execute=a,this.revert=s,this.postExecute=c}function ZA(e){return!e||!e.trim()}function JA(e,t,n,i){bA.call(this,e,t,n),this._bpmnRules=i}function QA(){}XA.$inject=["modeling","textRenderer","bpmnFactory"],i(JA,bA),JA.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],JA.prototype.getHandlers=function(){var e=bA.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=xA,e["element.updateProperties"]=TA,e["canvas.updateRoot"]=jA,e["lane.add"]=LA,e["lane.resize"]=FA,e["lane.split"]=IA,e["lane.updateRefs"]=HA,e["id.updateClaim"]=GA,e["element.setColor"]=WA,e["element.updateLabel"]=XA,e},JA.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},JA.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,i)},JA.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},JA.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},JA.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},JA.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},JA.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},JA.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},JA.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},JA.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};this._commandStack.execute("canvas.updateRoot",t)},JA.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},JA.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},JA.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},QA.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||bn(t.source||e.source),t.connectionEnd||bn(t.target||e.target)]};var ek=20,tk=5,nk=Math.round,ik=20,rk={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function ok(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function ak(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function sk(e,t,n){var i,r,o=xn(t,e,tk),a=n.split(":")[0],s=nk((t.x-e.x)/2+e.x),c=nk((t.y-e.y)/2+e.y),p=ak(a,o),l=/h|r|l/.test(a),u=!1,h=!1;return p?(i=l?{x:s,y:e.y}:{x:e.x,y:c},r=l?"h:h":"v:v"):(u=ok(o,a),r=l?"h:v":"v:h",u?l?(h=c===e.y,i={x:e.x+ek*(/l/.test(a)?-1:1),y:h?c+ek:c}):(h=s===e.x,i={x:h?s+ek:s,y:e.y+ek*(/t/.test(a)?-1:1)}):i={x:s,y:c}),{waypoints:dk(e,i,r).concat(i),directions:r,turnNextDirections:h}}function ck(e,t,n){return sk(e,t,n)}function pk(e,t,n){var i=sk(t,e,uk(n));return{waypoints:i.waypoints.slice().reverse(),directions:uk(i.directions),turnNextDirections:i.turnNextDirections}}function lk(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(i="h"==i?"v":"h");var r=n+":"+i,o=dk(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function uk(e){return e.split(":").reverse().join(":")}function hk(e,t,n){var i=nk((t.x-e.x)/2+e.x),r=nk((t.y-e.y)/2+e.y);if("h:v"===n)return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:i,y:e.y},{x:i,y:t.y}];if("v:v"===n)return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function dk(e,t,n){if(n=n||"h:h",!Sk(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Ck(n)){var i=ck(e,t,n),r=pk(e,t,n),o=lk(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return hk(e,t,n)}function fk(e,t,n){var i=dk(e,t,n);return i.unshift(e),i.push(t),Tk(i)}function mk(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=C(o,"straight")[0]||"h:h",s=rk[a]||0,c=xn(e,t,s),p=wk(c,a);n=n||bn(e),i=i||bn(t);var l=p.split(":"),u=kk(n,e,l[0],Ak(c)),h=kk(i,t,l[1],c);return fk(u,h,p)}function vk(e,t,n,i,r,o){f(n)&&(r=n,o=i,n=bn(e),i=bn(t)),o=V({preferredLayouts:[]},o),r=r||[];var a,s=o.preferredLayouts,c=-1!==s.indexOf("straight");return a=c&&bk(e,t,n,i,o),a||(a=o.connectionEnd&&_k(t,e,i,r),a||(a=o.connectionStart&&xk(e,t,n,r),a||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:mk(e,t,n,i,o))))}function yk(e,t,n){return e>=t&&e<=n}function gk(e,t,n){var i={x:"width",y:"height"};return yk(t[e],n[e],n[e]+n[i[e]])}function bk(e,t,n,i,r){var o,a,s={};return a=xn(e,t),/^(top|bottom|left|right)$/.test(a)?(/top|bottom/.test(a)&&(o="x"),/left|right/.test(a)&&(o="y"),"target"===r.preserveDocking?gk(o,i,e)?(s[o]=i[o],[{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y,original:{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y}},{x:i.x,y:i.y}]):null:gk(o,n,t)?(s[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y,original:{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y}}]):null):null}function xk(e,t,n,i){return Ek(e,t,n,i)}function _k(e,t,n,i){var r=i.slice().reverse();return r=Ek(e,t,n,r),r?r.reverse():null}function Ek(e,t,n,i){function r(e){return e.length<3||!(e.length>4)&&!!_(e,(function(t,n){var i=e[n-1];return i&&rn(t,i)<3}))}function o(e,t,n){var i=sn(t,e);switch(i){case"v":return{x:n.x,y:e.y};case"h":return{x:e.x,y:n.y}}return{x:e.x,y:e.y}}function a(e,t,n){var i;for(i=e.length-2;0!==i;i--)if(pn(e[i],t,ik)||pn(e[i],n,ik))return e.slice(i);return e}if(r(i))return null;var s,c=i[0],p=i.slice();return p[0]=n,p[1]=o(p[1],c,n),s=a(p,e,t),s!==p&&(p=Ek(e,t,n,s)),p&&sn(p)?null:p}function wk(e,t){if(Ck(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 Sk(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Ck(e){return e&&/t|r|b|l/.test(e)}function Ak(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 kk(e,t,n,i){if("h"===n&&(n=/left/.test(i)?"l":"r"),"v"===n&&(n=/top/.test(i)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Tk(e){return e.reduce((function(t,n,i){var r=t[t.length-1],o=e[i+1];return on(r,o,n,0)||t.push(n),t}),[])}var Rk=-10,Dk=40,Pk={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Mk={top:"t",right:"r",bottom:"b",left:"l"};function Bk(){}function Nk(e){var t=e.host;return xn(bn(e),t,Rk)}function Ok(e,t){return{preferredLayouts:["straight","v:v"],preserveDocking:jk(e,t)}}function jk(e,t){return Ko(t,"bpmn:Participant")?"source":Ko(e,"bpmn:Participant")?"target":zk(t)?"source":zk(e)||Ko(t,"bpmn:Event")?"target":Ko(e,"bpmn:Event")?"source":null}function Lk(e){return{preferredLayouts:["straight","h:h"],preserveDocking:Ik(e)}}function Ik(e){return zk(e)?"target":"source"}function Fk(e,t){return e?e.original||e:bn(t)}function $k(e,t){return Ko(t,"bpmn:Activity")&&Ko(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function zk(e){return Ko(e,"bpmn:SubProcess")&&_a(e)}function Hk(e,t){return e===t}function Gk(e,t){return-1!==t.indexOf(e)}function Vk(e){var t=/right|left/.exec(e);return t&&t[0]}function Wk(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Uk(e,t){return Pk[e]===t}function qk(e,t){var n=Vk(e),i=Pk[n];return-1!==t.indexOf(i)}function Kk(e,t){var n=Wk(e),i=Pk[n];return-1!==t.indexOf(i)}function Yk(e){return"right"===e||"left"===e}function Xk(e,t){var n=t.waypoints,i=n&&n.length&&xn(n[0],e);return"top"===i?["t:r"]:"right"===i?["r:b"]:"left"===i?["l:t"]:["b:l"]}function Zk(e,t,n){var i,r,o=bn(e),a=bn(t),s=Nk(e),c=Hk(e.host,t),p=Gk(s,["top","right","bottom","left"]),l=xn(a,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return c?Jk(s,p,e,t,n):(i=tT(s,l,p),r=nT(s,l,p),[i+":"+r])}function Jk(e,t,n,i,r){var o,a=t?e:Wk(e),s=Mk[a];return o=t?Yk(e)?Qk("y",n,i,r)?"h":"b":Qk("x",n,i,r)?"v":"l":"v",[s+":"+o]}function Qk(e,t,n,i){var r=Dk;return!(eT(e,i,n,r)||eT(e,i,{x:n.x+n.width,y:n.y+n.height},r)||eT(e,i,bn(t),r))}function eT(e,t,n,i){return Math.abs(t[e]-n[e])<i}function tT(e,t,n){return n?Mk[e]:Hk(Wk(e),Wk(t))||Uk(Vk(e),Vk(t))?Mk[Wk(e)]:Mk[Vk(e)]}function nT(e,t,n){return n?Yk(e)?qk(e,t)||Hk(e,t)?"h":"v":Kk(e,t)||Hk(e,t)?"v":"h":Yk(t)||Hk(Wk(e),Wk(t))&&Vk(t)?"h":"v"}function iT(e){return V({original:e.point.original||e.point},e.actual)}function rT(e,t){this._elementRegistry=e,this._graphicsFactory=t}i(Bk,QA),Bk.prototype.layoutConnection=function(e,t){t||(t={});var n,i,r=t.source||e.source,o=t.target||e.target,a=t.waypoints||e.waypoints,s=t.connectionStart,c=t.connectionEnd;return s||(s=Fk(a&&a[0],r)),c||(c=Fk(a&&a[a.length-1],o)),(Ko(e,"bpmn:Association")||Ko(e,"bpmn:DataAssociation"))&&a&&!$k(r,o)?[].concat([s],a.slice(1,-1),[c]):(Ko(e,"bpmn:MessageFlow")?n=Ok(r,o):(Ko(e,"bpmn:SequenceFlow")||$k(r,o))&&(n=r===o?{preferredLayouts:Xk(r,e)}:Ko(r,"bpmn:BoundaryEvent")?{preferredLayouts:Zk(r,o,c)}:zk(r)||zk(o)?Lk(r):Ko(r,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:Ko(o,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(n=V(n,t),i=Tk(vk(r,o,s,c,a,n))),i||[s,c])},rT.$inject=["elementRegistry","graphicsFactory"],rT.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(iT(i)),o.push(iT(r)),o},rT.prototype.getDockingPoint=function(e,t,n){var i,r,o,a=e.waypoints;return i=n?0:a.length-1,r=a[i],o=this._getIntersection(t,e,n),{point:r,actual:o||r,idx:i}},rT.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return _n(i,r,n)},rT.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},rT.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},rT.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var oT={__init__:["modeling","bpmnUpdater"],__depends__:[fw,cS,uS,fS,Yv,YS,iC,pC,bC,uc,Ec,qS],bpmnFactory:["type",xC],bpmnUpdater:["type",_C],elementFactory:["type",CC],modeling:["type",JA],layouter:["type",Bk],connectionDocking:["type",rT]},aT=500,sT=1250,cT=1500,pT=Math.round;function lT(e){return{x:e.x+pT(e.width/2),y:e.y+pT(e.height/2)}}function uT(e,t,n,i,r){function o(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function a(e,n,i,r){if(m(i)&&(r=i,i=!1),!n.waypoints&&n.parent&&!He(e.target).has("djs-hit-no-move")){var o=lT(n);return t.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:i,data:{shape:n,context:r||{}}}),!0}}e.on("shape.move.start",cT,(function(e){var t=e.context,n=e.shape,r=i.get().slice();-1===r.indexOf(n)&&(r=[n]),r=hT(r),V(t,{shapes:r,validatedShapes:r,shape:n})})),e.on("shape.move.start",sT,(function(e){var t,n=e.context,i=n.validatedShapes;if(t=n.canExecute=o(i),!t)return!1})),e.on("shape.move.move",aT,(function(e){var t,n=e.context,i=n.validatedShapes,r=e.hover,a={x:e.dx,y:e.dy},s={x:e.x,y:e.y};t=o(i,a,s,r),n.delta=a,n.canExecute=t,n.target=null!==t?r:null})),e.on("shape.move.end",(function(e){var t=e.context,i=t.delta,r=t.canExecute,o="attach"===r,a=t.shapes;if(!1===r)return!1;i.x=pT(i.x),i.y=pT(i.y),0===i.x&&0===i.y||n.moveElements(a,i,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(Ws(e)){var t=$s(e);if(!t)throw new Error("must supply DOM mousedown event");return a(t,e.element)}})),this.start=a}function hT(e){var t=B(e,"id");return w(e,(function(e){while(e=e.parent)if(t[e.id])return!1;return!0}))}uT.$inject=["eventBus","dragging","modeling","selection","rules"];var dT=499,fT="djs-dragging",mT="drop-ok",vT="drop-not-ok",yT="new-parent",gT="attach-ok";function bT(e,t,n,i){function r(e){var t=o(e),n=xT(t);return n}function o(e){var t=Gt(e,!0),n=R(t,(function(e){return(e.incoming||[]).concat(e.outgoing||[])}));return c(t.concat(n))}function a(e,n){[gT,mT,vT,yT].forEach((function(i){i===n?t.addMarker(e,i):t.removeMarker(e,i)}))}function s(e,n,r){i.addDragger(n,e.dragGroup),r&&t.addMarker(n,fT),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}e.on("shape.move.start",dT,(function(e){var a=e.context,s=a.shapes,p=a.allDraggedElements,l=r(s);if(!a.dragGroup){var u=Xe("g");$e(u,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();Ne(h,u),a.dragGroup=u}l.forEach((function(e){i.addDragger(e,a.dragGroup)})),p=p?c([p,o(s)]):o(s),S(p,(function(e){t.addMarker(e,fT)})),a.allDraggedElements=p,a.differentParents=_T(s)})),e.on("shape.move.move",dT,(function(e){var t=e.context,n=t.dragGroup,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?a(i,gT):t.canExecute&&i&&i.id!==r.id?a(i,yT):a(i,t.canExecute?mT:vT)),pi(n,e.dx,e.dy)})),e.on(["shape.move.out","shape.move.cleanup"],(function(e){var t=e.context,n=t.target;n&&a(n,null)})),e.on("shape.move.cleanup",(function(e){var n=e.context,i=n.allDraggedElements,r=n.dragGroup;S(i,(function(e){t.removeMarker(e,fT)})),r&&ht(r)})),this.makeDraggable=s}function xT(e){var t=w(e,(function(t){return!ET(t)||_(e,L({id:t.source.id}))&&_(e,L({id:t.target.id}))}));return t}function _T(e){return 1!==P(B(e,(function(e){return e.parent&&e.parent.id})))}function ET(e){return e.waypoints}bT.$inject=["eventBus","canvas","styles","previewSupport"];var wT={__depends__:[Qs,uc,nc,ed,Yh,tv],__init__:["move","movePreview"],move:["type",uT],movePreview:["type",bT]},ST="crosshair";function CT(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(e){var n,i=t.getActiveLayer();n=e.frame=Xe("rect"),$e(n,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ne(i,n)},update:function(e){var t=e.frame,n=e.bbox;$e(t,{x:n.x,y:n.y,width:n.width,height:n.height})},remove:function(e){e.frame&&ht(e.frame)}};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",(function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",(function(){s.activateLasso(t.originalEvent,!0)}))})),e.on("lasso.end",(function(e){var t=AT(e),n=i.filter((function(e){return e}));s.select(n,t)})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=AT(e),c.create(t)})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=AT(e),c.update(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;c.remove(t)})),e.on("element.mousedown",1500,(function(e){if(Ks(e))return s.activateLasso(e.originalEvent),!0}))}function AT(e){var t,n={x:e.x-e.dx,y:e.y-e.dy},i={x:e.x,y:e.y};return t=n.x<=i.x&&n.y<i.y||n.x<i.x&&n.y<=i.y?{x:n.x,y:n.y,width:i.x-n.x,height:i.y-n.y}:n.x>=i.x&&n.y<i.y||n.x>i.x&&n.y<=i.y?{x:i.x,y:n.y,width:n.x-i.x,height:i.y-n.y}:n.x<=i.x&&n.y>i.y||n.x<i.x&&n.y>=i.y?{x:n.x,y:i.y,width:i.x-n.x,height:n.y-i.y}:n.x>=i.x&&n.y>i.y||n.x>i.x&&n.y>=i.y?{x:i.x,y:i.y,width:n.x-i.x,height:n.y-i.y}:{x:i.x,y:i.y,width:0,height:0},t}CT.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],CT.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:ST,data:{context:{}}})},CT.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:ST,data:{context:{}}})},CT.prototype.select=function(e,t){var n=Ut(e,t);this._selection.select(M(n))},CT.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},CT.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var kT={__depends__:[gS,xv],__init__:["lassoTool"],lassoTool:["type",CT]},TT=1500,RT="grab";function DT(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",TT,(function(e){if(qs(e))return a.activateMove(e.originalEvent,!0),!1})),s&&s.addListener(TT,(function(e){if(PT(e.keyEvent)&&!a.isActive()){var t=a._mouse.getLastMoveEvent();a.activateMove(t,!!t)}}),"keyboard.keydown"),s&&s.addListener(TT,(function(e){PT(e.keyEvent)&&a.isActive()&&a.toggle()}),"keyboard.keyup"),e.on("hand.end",(function(t){var n=t.originalEvent.target;if(!t.hover&&!(n instanceof SVGElement))return!1;e.once("hand.ended",(function(){a.activateMove(t.originalEvent,{reactivate:!0})}))})),e.on("hand.move.move",(function(e){var n=t.viewbox().scale;t.scroll({dx:e.dx*n,dy:e.dy*n})})),e.on("hand.move.end",(function(t){var n=t.context,i=n.reactivate;return!qs(t)&&i&&e.once("hand.move.ended",(function(e){a.activateHand(e.originalEvent,!0,!0)})),!1}))}function PT(e){return sp("Space",e)}DT.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],DT.prototype.activateMove=function(e,t,n){"object"===typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:RT,data:{context:n||{}}})},DT.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:RT,data:{context:{reactivate:n}}})},DT.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},DT.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var MT={__depends__:[gS,xv],__init__:["handTool"],handTool:["type",DT]},BT="connect-ok",NT="connect-not-ok";function OT(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",(function(e){var t=e.context,n=e.hover,r=t.canStartConnect=s.canStartConnect(n);null!==r&&(t.startTarget=n,i.addMarker(n,r?BT:NT))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&i.removeMarker(t,n?BT:NT)})),e.on(["global-connect.ended"],(function(t){var i=t.context,r=i.startTarget,o={x:t.x,y:t.y},a=s.canStartConnect(r);if(a)return e.once("element.out",(function(){e.once(["connect.ended","connect.canceled"],(function(){e.fire("global-connect.drag.ended")})),n.start(null,r,o)})),!1}))}OT.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],OT.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},OT.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},OT.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},OT.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var jT={__depends__:[Ef,ed,Yh,gS,xv],globalConnect:["type",OT]};function LT(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}LT.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],LT.prototype.getPaletteEntries=function(e){var t={},n=this._create,i=this._elementFactory,r=this._spaceTool,o=this._lassoTool,a=this._handTool,s=this._globalConnect,c=this._translate;function p(e,t,r,o,a){function s(t){var r=i.createShape(V({type:e},a));if(a){var o=Zo(r);o.isExpanded=a.isExpanded}n.start(t,r)}var p=e.replace(/^bpmn:/,"");return{group:t,className:r,title:o||c("Create {type}",{type:p}),action:{dragstart:s,click:s}}}function l(e){var t=i.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),r=i.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:t});n.start(e,[t,r],{hints:{autoSelect:[t]}})}function u(e){n.start(e,i.createParticipantShape())}return V(t,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:c("Activate the hand tool"),action:{click:function(e){a.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:c("Activate the lasso tool"),action:{click:function(e){o.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:c("Activate the create/remove space tool"),action:{click:function(e){r.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:c("Activate the global connect tool"),action:{click:function(e){s.start(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":p("bpmn:StartEvent","event","bpmn-icon-start-event-none",c("Create StartEvent")),"create.intermediate-event":p("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",c("Create Intermediate/Boundary Event")),"create.end-event":p("bpmn:EndEvent","event","bpmn-icon-end-event-none",c("Create EndEvent")),"create.exclusive-gateway":p("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",c("Create Gateway")),"create.task":p("bpmn:Task","activity","bpmn-icon-task",c("Create Task")),"create.data-object":p("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",c("Create DataObjectReference")),"create.data-store":p("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",c("Create DataStoreReference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:c("Create expanded SubProcess"),action:{dragstart:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:c("Create Pool/Participant"),action:{dragstart:u,click:u}},"create.group":p("bpmn:Group","artifact","bpmn-icon-group",c("Create Group"))}),t};var IT={__depends__:[Zy,mv,qS,kT,MT,jT,_s],__init__:["paletteProvider"],paletteProvider:["type",LT]},FT=250;function $T(e,t,n,i,r){function o(e){var o=e.canExecute.replacements;S(o,(function(o){var a=o.oldElementId,s={type:o.newElementType};if(!e.visualReplacements[a]){var c=t.get(a);V(s,{x:c.x,y:c.y});var p=n.createShape(s);i.addShape(p,c.parent);var l=Re('[data-element-id="'+Rc(c.id)+'"]',e.dragGroup);l&&$e(l,{display:"none"});var u=r.addDragger(p,e.dragGroup);e.visualReplacements[a]=u,i.removeShape(p)}}))}function a(e){var t=e.visualReplacements;S(t,(function(n,i){var r=Re('[data-element-id="'+Rc(i)+'"]',e.dragGroup);r&&$e(r,{display:"inline"}),n.remove(),t[i]&&delete t[i]}))}Sc.call(this,e),e.on("shape.move.move",FT,(function(e){var t=e.context,n=t.canExecute;t.visualReplacements||(t.visualReplacements={}),n&&n.replacements?o(t):a(t)}))}$T.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],i($T,Sc);var zT={__depends__:[tv],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",$T]},HT=1250,GT=40,VT=20,WT=10,UT=20,qT=["x","y"],KT=Math.abs;function YT(e){e.on(["connect.hover","connect.move","connect.end"],HT,(function(e){var t=e.context,n=t.canExecute,i=t.start,r=t.hover,o=t.source,a=t.target;e.originalEvent&&ap(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&r&&XT(e,r,iR(r)),r&&tR(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=of(i),Yo(r,["bpmn:Event","bpmn:Gateway"])&&QT(e,of(r)),Yo(r,["bpmn:Task","bpmn:SubProcess"])&&ZT(e,r),Ko(o,"bpmn:BoundaryEvent")&&a===o.host&&JT(e)):eR(n,"bpmn:MessageFlow")?(Ko(i,"bpmn:Event")&&(t.connectionStart=of(i)),Ko(r,"bpmn:Event")&&QT(e,of(r))):t.connectionStart=t.initialConnectionStart)}))}function XT(e,t,n){qT.forEach((function(i){var r=nR(i,t);e[i]<t[i]+n?sf(e,i,t[i]+n):e[i]>t[i]+r-n&&sf(e,i,t[i]+r-n)}))}function ZT(e,t){var n=of(t);qT.forEach((function(i){rR(e,t,i)&&sf(e,i,n[i])}))}function JT(e){var t=e.context,n=t.source,i=t.target;if(!oR(t)){var r=of(n),o=xn(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach((function(t){var n,i=e[t];KT(i-r[t])<GT&&(n=i>r[t]?r[t]+GT:r[t]-GT,sf(e,t,n))}))}}function QT(e,t){sf(e,"x",t.x),sf(e,"y",t.y)}function eR(e,t){return e&&e.type===t}function tR(e,t){return T(t,(function(t){return eR(e,t)}))}function nR(e,t){return"x"===e?t.width:t.height}function iR(e){return Ko(e,"bpmn:Task")?WT:VT}function rR(e,t,n){return e[n]>t[n]+UT&&e[n]<t[n]+nR(n,t)-UT}function oR(e){var t=e.hover,n=e.source;return t&&n&&t===n}function aR(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function sR(e){this._snapValues={}}YT.$inject=["eventBus"],aR.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},aR.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},aR.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},aR.prototype.getSnapLocations=function(){return this._snapLocations},aR.prototype.setSnapLocations=function(e){this._snapLocations=e},aR.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new sR,n.initDefaults(this._defaultSnaps)),n},sR.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),-1===n.x.indexOf(t.x)&&n.x.push(t.x),-1===n.y.indexOf(t.y)&&n.y.push(t.y)},sR.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&tf(e[n],r[n],i)},sR.prototype.initDefaults=function(e){var t=this;S(e||{},(function(e,n){S(e,(function(e){t.add(n,e)}))}))};var cR=1250;function pR(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],(function(e){i.initSnap(e)})),t.on(["create.move","create.end","shape.move.move","shape.move.end"],cR,(function(e){var t=e.context,r=t.shape,o=t.snapContext,a=t.target;if((!e.originalEvent||!ap(e.originalEvent))&&!af(e)&&a){var s=o.pointsForTarget(a);s.initialized||(s=i.addSnapTargetPoints(s,r,a),s.initialized=!0),n.snap(e,s)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}function lR(e){return!!e.waypoints}function uR(e){return!!e.hidden}function hR(e){return!!e.labelTarget}pR.$inject=["elementRegistry","eventBus","snapping"],pR.prototype.initSnap=function(e){var t,n=this._elementRegistry,i=e.context,r=i.shape,o=i.snapContext;o||(o=i.snapContext=new aR),t=n.get(r.id)?of(r,e):{x:e.x+of(r).x,y:e.y+of(r).y};var a={x:t.x-r.width/2,y:t.y-r.height/2},s={x:t.x+r.width/2,y:t.y+r.height/2};return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),hR(r)||(o.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),o.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),o},pR.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return S(i,(function(n){if(hR(n))hR(t)&&e.add("mid",of(n));else if(lR(n)){if(n.waypoints.length<3)return;var i=n.waypoints.slice(1,-1);S(i,(function(t){e.add("mid",t)}))}else e.add("mid",of(n))})),v(t.x)&&v(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",of(t)),e):e},pR.prototype.getSnapTargets=function(e,t){return cf(t).filter((function(e){return!uR(e)}))};var dR=1500;function fR(e,t){t.invoke(pR,this),e.on(["create.move","create.end"],dR,gR),e.on(["create.move","create.end","shape.move.move","shape.move.end"],dR,(function(e){var t=e.context,n=t.canExecute,i=t.target,r=n&&("attach"===n||n.attach);r&&!af(e)&&mR(e,i)}))}function mR(e,t){var n,i=mn(t),r=mw(e,t),o=e.context,a=o.shape;n=a.parent?{x:0,y:0}:bn(a),/top/.test(r)?sf(e,"y",i.top-n.y):/bottom/.test(r)&&sf(e,"y",i.bottom-n.y),/left/.test(r)?sf(e,"x",i.left-n.x):/right/.test(r)&&sf(e,"x",i.right-n.x)}function vR(e,t){return e.every((function(e){return Ko(e,t)}))}function yR(e){return!(!Ko(e,"bpmn:SubProcess")||!_a(e))||Ko(e,"bpmn:Participant")}function gR(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,r=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||r&&r<=e.x)&&sf(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&sf(e,"y",e.y)}}function bR(e,t){return-1!==e.indexOf(t)}function xR(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}i(fR,pR),fR.$inject=["eventBus","injector"],fR.prototype.initSnap=function(e){var t=pR.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return S(n.outgoing,(function(n){var r=n.waypoints[0];r=r.original||r,t.setSnapOrigin(n.id+"-docking",xR(r,i,e))})),S(n.incoming,(function(n){var r=n.waypoints[n.waypoints.length-1];r=r.original||r,t.setSnapOrigin(n.id+"-docking",xR(r,i,e))})),Ko(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},fR.prototype.addSnapTargetPoints=function(e,t,n){pR.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);S(i,(function(n){(yR(n)||vR([t,n],"bpmn:TextAnnotation"))&&(e.add("top-left",nf(n)),e.add("bottom-right",rf(n)))}));var r=this._elementRegistry;return S(t.incoming,(function(n){if(r.get(t.id)){bR(i,n.source)||e.add("mid",bn(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),S(t.outgoing,(function(n){if(r.get(t.id)){bR(i,n.target)||e.add("mid",bn(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),Ko(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},fR.prototype.getSnapTargets=function(e,t){return pR.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!Ko(e,"bpmn:Lane")}))};var _R=1250;function ER(e,t){var n=this;e.on(["resize.start"],(function(e){n.initSnap(e)})),e.on(["resize.move","resize.end"],_R,(function(e){var i=e.context,r=i.shape,o=r.parent,a=i.direction,s=i.snapContext;if((!e.originalEvent||!ap(e.originalEvent))&&!af(e)){var c=s.pointsForTarget(o);c.initialized||(c=n.addSnapTargetPoints(c,r,o,a),c.initialized=!0),TR(a)&&sf(e,"x",e.x),RR(a)&&sf(e,"y",e.y),t.snap(e,c)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function wR(e,t){var n=bn(e),i=mn(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=i.top:-1!==t.indexOf("s")&&(r.y=i.bottom),-1!==t.indexOf("e")?r.x=i.right:-1!==t.indexOf("w")&&(r.x=i.left),r}function SR(e,t){return e.host===t}function CR(e){return!!e.waypoints}function AR(e){return!!e.hidden}function kR(e){return!!e.labelTarget}function TR(e){return"n"===e||"s"===e}function RR(e){return"e"===e||"w"===e}ER.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new aR);var o=wR(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},ER.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return S(r,(function(t){e.add("corner",rf(t)),e.add("corner",nf(t))})),e.add("corner",wR(t,i)),e},ER.$inject=["eventBus","snapping"],ER.prototype.getSnapTargets=function(e,t){return cf(t).filter((function(t){return!SR(t,e)&&!CR(t)&&!AR(t)&&!kR(t)}))};var DR=7,PR=1e3;function MR(e){this._canvas=e,this._asyncHide=H(G(this.hide,this),PR)}MR.$inject=["canvas"],MR.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:af(e,"x"),y:af(e,"y")};S(r,(function(n){var r=i.getSnapOrigin(n),a={x:e.x+r.x,y:e.y+r.y};if(S(["x","y"],(function(e){var i;o[e]||(i=t.snap(a,n,e,DR),void 0!==i&&(o[e]={value:i,originValue:i-r[e]}))})),o.x&&o.y)return!1})),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),S(["x","y"],(function(t){var n=o[t];m(n)&&sf(e,t,n.originValue)}))},MR.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Xe("path");return $e(n,{d:"M0,0 L0,0"}),He(n).add("djs-snap-line"),Ne(t,n),{update:function(t){v(t)?$e(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):$e(n,{display:"none"})}}},MR.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},MR.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},MR.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},MR.prototype.hide=function(){S(this._snapLines,(function(e){e.update()}))};var BR={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",pR],resizeSnapping:["type",ER],snapping:["type",MR]},NR={__depends__:[BR],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",YT],createMoveSnapping:["type",fR]};function OR(e,t,n,i){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=i,this._container=ke(OR.BOX_HTML),this._searchInput=Re(OR.INPUT_SELECTOR,this._container),this._resultsContainer=Re(OR.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function jR(e){var t=6,n=e.width+2*t,i=e.height+2*t,r={width:n+"px",height:i+"px"},o=ke('<div class="'+OR.OVERLAY_CLASS+'"></div>');return ie(o,r),{position:{bottom:i-t,right:n-t},show:!0,html:o}}function LR(e,t,n){var i=IR(t),r=ke(n);r.innerHTML=i,e.appendChild(r)}function IR(e){var t="";return e.forEach((function(e){e.matched?t+='<strong class="'+OR.RESULT_HIGHLIGHT_CLASS+'">'+Pc(e.matched)+"</strong>":t+=Pc(e.normal)})),""!==t?t:null}OR.$inject=["canvas","eventBus","overlays","selection"],OR.prototype._bindEvents=function(){var e=this;function t(t,n,i,r){e._eventMaps.push({el:t,type:i,listener:Ee.bind(t,n,i,r)})}t(document,"html","click",(function(t){e.close()})),t(this._container,OR.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,OR.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,OR.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,OR.INPUT_SELECTOR,"keydown",(function(e){sp("ArrowUp",e)&&e.preventDefault(),sp("ArrowDown",e)&&e.preventDefault()})),t(this._container,OR.INPUT_SELECTOR,"keyup",(function(t){if(sp("Escape",t))return e.close();if(sp("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close()}return sp("ArrowUp",t)?e._scrollToDirection(!0):sp("ArrowDown",t)?e._scrollToDirection():void(sp(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},OR.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){Ee.unbind(e.el,e.type,e.listener)}))},OR.prototype._search=function(e){var t=this;if(this._clearResults(),e&&""!==e){var n=this._searchProvider.find(e);if(n.length){n.forEach((function(e){var n=e.element.id,i=t._createResultNode(e,n);t._results[n]={element:e.element,node:i}}));var i=Re(OR.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}}},OR.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},OR.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},OR.prototype._clearResults=function(){ce(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},OR.prototype._getCurrentResult=function(){return Re(OR.RESULT_SELECTED_SELECTOR,this._resultsContainer)},OR.prototype._createResultNode=function(e,t){var n=ke(OR.RESULT_HTML);return e.primaryTokens.length>0&&LR(n,e.primaryTokens,OR.RESULT_PRIMARY_HTML),LR(n,e.secondaryTokens,OR.RESULT_SECONDARY_HTML),re(n,OR.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},OR.prototype.registerProvider=function(e){this._searchProvider=e},OR.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,ae(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},OR.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,ae(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},OR.prototype.toggle=function(){this.isOpen()?this.close():this.open()},OR.prototype.isOpen=function(){return this._open},OR.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&ae(t).remove(OR.RESULT_SELECTED_CLASS);var n=re(e,OR.RESULT_ID_ATTRIBUTE),i=this._results[n].element;ae(e).add(OR.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._canvas.scrollToElement(i,{top:400}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},OR.prototype._select=function(e){var t=re(e,OR.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this.close(),this._resetOverlay(),this._canvas.scrollToElement(n,{top:400}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},OR.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=Wt(e),n=jR(t);this._overlayId=this._overlays.add(e,n)}},OR.CONTAINER_SELECTOR=".djs-search-container",OR.INPUT_SELECTOR=".djs-search-input input",OR.RESULTS_CONTAINER_SELECTOR=".djs-search-results",OR.RESULT_SELECTOR=".djs-search-result",OR.RESULT_SELECTED_CLASS="djs-search-result-selected",OR.RESULT_SELECTED_SELECTOR="."+OR.RESULT_SELECTED_CLASS,OR.RESULT_ID_ATTRIBUTE="data-result-id",OR.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",OR.OVERLAY_CLASS="djs-search-overlay",OR.BOX_HTML='<div class="djs-search-container djs-draggable djs-scrollable"><div class="djs-search-input"><input type="text"/></div><div class="djs-search-results"></div></div>',OR.RESULT_HTML='<div class="djs-search-result"></div>',OR.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',OR.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var FR={__depends__:[xc,uc],searchPad:["type",OR]};function $R(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function zR(e){var t=w(e,(function(e){return!!e.matched}));return t.length>0}function HR(e,t){var n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var r=e.indexOf(t);return r>-1?(0!==r&&n.push({normal:i.substr(0,r)}),n.push({matched:i.substr(r,t.length)}),t.length+r<e.length&&n.push({normal:i.substr(t.length+r,e.length)})):n.push({normal:i}),n}$R.$inject=["elementRegistry","searchPad","canvas"],$R.prototype.find=function(e){var t=this._canvas.getRootElement(),n=this._elementRegistry.filter((function(e){return!e.labelTarget}));return n=w(n,(function(e){return e!==t})),n=R(n,(function(t){return{primaryTokens:HR(Da(t),e),secondaryTokens:HR(t.id,e),element:t}})),n=w(n,(function(e){return zR(e.primaryTokens)||zR(e.secondaryTokens)})),n=j(n,(function(e){return Da(e.element)+e.element.id})),n};var GR={__depends__:[FR],__init__:["bpmnSearch"],bpmnSearch:["type",$R]},VR='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function WR(e){xa.call(this,e)}i(WR,xa),WR.Viewer=ep,WR.NavigatedViewer=Up,WR.prototype.createDiagram=Ho((function(){return this.importXML(VR)})),WR.prototype._interactionModules=[Sp,Op,ol,Wp],WR.prototype._modelingModules=[ah,Ph,Jh,Ih,ff,Ef,kf,Fy,Lv,mv,kg,Lg,Vg,bb,wb,Cb,Ob,ux,oT,wT,IT,zT,Qb,NR,GR],WR.prototype._modules=[].concat(ep.prototype._modules,WR.prototype._interactionModules,WR.prototype._modelingModules)},"7d7d":function(e,t,n){"use strict";function i(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(e){var n=this.indexOf(e);return-1!==n&&(this.splice(n,1),t.unset(e,r,i)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,n){var o=this.indexOf(e);if("undefined"===typeof n){if(-1!==o)return;n=this.length}-1!==o&&this.splice(o,1),this.splice(n,0,e),-1===o&&t.set(e,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function r(e){return!0===e.__refs_collection}e.exports.extend=i,e.exports.isExtended=r},"8fcf":function(e,t,n){e.exports=n("668d"),e.exports.Collection=n("7d7d")},c8b5:function(e,t,n){var i;
/*! Hammer.JS - v2.0.7 - 2016-04-22
 * http://hammerjs.github.io/
 *
 * Copyright (c) 2016 Jorik Tangelder;
 * Licensed under the MIT license */(function(r,o,a,s){"use strict";var c,p=["","webkit","Moz","MS","ms","o"],l=o.createElement("div"),u="function",h=Math.round,d=Math.abs,f=Date.now;function m(e,t,n){return setTimeout(E(e,n),t)}function v(e,t,n){return!!Array.isArray(e)&&(y(e,n[t],n),!0)}function y(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==s){i=0;while(i<e.length)t.call(n,e[i],i,e),i++}else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function g(e,t,n){var i="DEPRECATED METHOD: "+t+"\n"+n+" AT \n";return function(){var t=new Error("get-stack-trace"),n=t&&t.stack?t.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=r.console&&(r.console.warn||r.console.log);return o&&o.call(r.console,i,n),e.apply(this,arguments)}}c="function"!==typeof Object.assign?function(e){if(e===s||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==s&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}return t}:Object.assign;var b=g((function(e,t,n){var i=Object.keys(t),r=0;while(r<i.length)(!n||n&&e[i[r]]===s)&&(e[i[r]]=t[i[r]]),r++;return e}),"extend","Use `assign`."),x=g((function(e,t){return b(e,t,!0)}),"merge","Use `assign`.");function _(e,t,n){var i,r=t.prototype;i=e.prototype=Object.create(r),i.constructor=e,i._super=r,n&&c(i,n)}function E(e,t){return function(){return e.apply(t,arguments)}}function w(e,t){return typeof e==u?e.apply(t&&t[0]||s,t):e}function S(e,t){return e===s?t:e}function C(e,t,n){y(R(t),(function(t){e.addEventListener(t,n,!1)}))}function A(e,t,n){y(R(t),(function(t){e.removeEventListener(t,n,!1)}))}function k(e,t){while(e){if(e==t)return!0;e=e.parentNode}return!1}function T(e,t){return e.indexOf(t)>-1}function R(e){return e.trim().split(/\s+/g)}function D(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);var i=0;while(i<e.length){if(n&&e[i][n]==t||!n&&e[i]===t)return i;i++}return-1}function P(e){return Array.prototype.slice.call(e,0)}function M(e,t,n){var i=[],r=[],o=0;while(o<e.length){var a=t?e[o][t]:e[o];D(r,a)<0&&i.push(e[o]),r[o]=a,o++}return n&&(i=t?i.sort((function(e,n){return e[t]>n[t]})):i.sort()),i}function B(e,t){var n,i,r=t[0].toUpperCase()+t.slice(1),o=0;while(o<p.length){if(n=p[o],i=n?n+r:t,i in e)return i;o++}return s}var N=1;function O(){return N++}function j(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow||r}var L=/mobile|tablet|ip(ad|hone|od)|android/i,I="ontouchstart"in r,F=B(r,"PointerEvent")!==s,$=I&&L.test(navigator.userAgent),z="touch",H="pen",G="mouse",V="kinect",W=25,U=1,q=2,K=4,Y=8,X=1,Z=2,J=4,Q=8,ee=16,te=Z|J,ne=Q|ee,ie=te|ne,re=["x","y"],oe=["clientX","clientY"];function ae(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){w(e.options.enable,[e])&&n.handler(t)},this.init()}function se(e){var t,n=e.options.inputClass;return t=n||(F?Te:$?je:I?$e:we),new t(e,ce)}function ce(e,t,n){var i=n.pointers.length,r=n.changedPointers.length,o=t&U&&i-r===0,a=t&(K|Y)&&i-r===0;n.isFirst=!!o,n.isFinal=!!a,o&&(e.session={}),n.eventType=t,pe(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function pe(e,t){var n=e.session,i=t.pointers,r=i.length;n.firstInput||(n.firstInput=he(t)),r>1&&!n.firstMultiple?n.firstMultiple=he(t):1===r&&(n.firstMultiple=!1);var o=n.firstInput,a=n.firstMultiple,s=a?a.center:o.center,c=t.center=de(i);t.timeStamp=f(),t.deltaTime=t.timeStamp-o.timeStamp,t.angle=ye(s,c),t.distance=ve(s,c),le(n,t),t.offsetDirection=me(t.deltaX,t.deltaY);var p=fe(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=p.x,t.overallVelocityY=p.y,t.overallVelocity=d(p.x)>d(p.y)?p.x:p.y,t.scale=a?be(a.pointers,i):1,t.rotation=a?ge(a.pointers,i):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,ue(n,t);var l=e.element;k(t.srcEvent.target,l)&&(l=t.srcEvent.target),t.target=l}function le(e,t){var n=t.center,i=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};t.eventType!==U&&o.eventType!==K||(r=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=r.x+(n.x-i.x),t.deltaY=r.y+(n.y-i.y)}function ue(e,t){var n,i,r,o,a=e.lastInterval||t,c=t.timeStamp-a.timeStamp;if(t.eventType!=Y&&(c>W||a.velocity===s)){var p=t.deltaX-a.deltaX,l=t.deltaY-a.deltaY,u=fe(c,p,l);i=u.x,r=u.y,n=d(u.x)>d(u.y)?u.x:u.y,o=me(p,l),e.lastInterval=t}else n=a.velocity,i=a.velocityX,r=a.velocityY,o=a.direction;t.velocity=n,t.velocityX=i,t.velocityY=r,t.direction=o}function he(e){var t=[],n=0;while(n<e.pointers.length)t[n]={clientX:h(e.pointers[n].clientX),clientY:h(e.pointers[n].clientY)},n++;return{timeStamp:f(),pointers:t,center:de(t),deltaX:e.deltaX,deltaY:e.deltaY}}function de(e){var t=e.length;if(1===t)return{x:h(e[0].clientX),y:h(e[0].clientY)};var n=0,i=0,r=0;while(r<t)n+=e[r].clientX,i+=e[r].clientY,r++;return{x:h(n/t),y:h(i/t)}}function fe(e,t,n){return{x:t/e||0,y:n/e||0}}function me(e,t){return e===t?X:d(e)>=d(t)?e<0?Z:J:t<0?Q:ee}function ve(e,t,n){n||(n=re);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return Math.sqrt(i*i+r*r)}function ye(e,t,n){n||(n=re);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return 180*Math.atan2(r,i)/Math.PI}function ge(e,t){return ye(t[1],t[0],oe)+ye(e[1],e[0],oe)}function be(e,t){return ve(t[0],t[1],oe)/ve(e[0],e[1],oe)}ae.prototype={handler:function(){},init:function(){this.evEl&&C(this.element,this.evEl,this.domHandler),this.evTarget&&C(this.target,this.evTarget,this.domHandler),this.evWin&&C(j(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&A(this.element,this.evEl,this.domHandler),this.evTarget&&A(this.target,this.evTarget,this.domHandler),this.evWin&&A(j(this.element),this.evWin,this.domHandler)}};var xe={mousedown:U,mousemove:q,mouseup:K},_e="mousedown",Ee="mousemove mouseup";function we(){this.evEl=_e,this.evWin=Ee,this.pressed=!1,ae.apply(this,arguments)}_(we,ae,{handler:function(e){var t=xe[e.type];t&U&&0===e.button&&(this.pressed=!0),t&q&&1!==e.which&&(t=K),this.pressed&&(t&K&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:G,srcEvent:e}))}});var Se={pointerdown:U,pointermove:q,pointerup:K,pointercancel:Y,pointerout:Y},Ce={2:z,3:H,4:G,5:V},Ae="pointerdown",ke="pointermove pointerup pointercancel";function Te(){this.evEl=Ae,this.evWin=ke,ae.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}r.MSPointerEvent&&!r.PointerEvent&&(Ae="MSPointerDown",ke="MSPointerMove MSPointerUp MSPointerCancel"),_(Te,ae,{handler:function(e){var t=this.store,n=!1,i=e.type.toLowerCase().replace("ms",""),r=Se[i],o=Ce[e.pointerType]||e.pointerType,a=o==z,s=D(t,e.pointerId,"pointerId");r&U&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):r&(K|Y)&&(n=!0),s<0||(t[s]=e,this.callback(this.manager,r,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),n&&t.splice(s,1))}});var Re={touchstart:U,touchmove:q,touchend:K,touchcancel:Y},De="touchstart",Pe="touchstart touchmove touchend touchcancel";function Me(){this.evTarget=De,this.evWin=Pe,this.started=!1,ae.apply(this,arguments)}function Be(e,t){var n=P(e.touches),i=P(e.changedTouches);return t&(K|Y)&&(n=M(n.concat(i),"identifier",!0)),[n,i]}_(Me,ae,{handler:function(e){var t=Re[e.type];if(t===U&&(this.started=!0),this.started){var n=Be.call(this,e,t);t&(K|Y)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:z,srcEvent:e})}}});var Ne={touchstart:U,touchmove:q,touchend:K,touchcancel:Y},Oe="touchstart touchmove touchend touchcancel";function je(){this.evTarget=Oe,this.targetIds={},ae.apply(this,arguments)}function Le(e,t){var n=P(e.touches),i=this.targetIds;if(t&(U|q)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,a=P(e.changedTouches),s=[],c=this.target;if(o=n.filter((function(e){return k(e.target,c)})),t===U){r=0;while(r<o.length)i[o[r].identifier]=!0,r++}r=0;while(r<a.length)i[a[r].identifier]&&s.push(a[r]),t&(K|Y)&&delete i[a[r].identifier],r++;return s.length?[M(o.concat(s),"identifier",!0),s]:void 0}_(je,ae,{handler:function(e){var t=Ne[e.type],n=Le.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:z,srcEvent:e})}});var Ie=2500,Fe=25;function $e(){ae.apply(this,arguments);var e=E(this.handler,this);this.touch=new je(this.manager,e),this.mouse=new we(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function ze(e,t){e&U?(this.primaryTouch=t.changedPointers[0].identifier,He.call(this,t)):e&(K|Y)&&He.call(this,t)}function He(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var i=this.lastTouches,r=function(){var e=i.indexOf(n);e>-1&&i.splice(e,1)};setTimeout(r,Ie)}}function Ge(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(t-r.x),a=Math.abs(n-r.y);if(o<=Fe&&a<=Fe)return!0}return!1}_($e,ae,{handler:function(e,t,n){var i=n.pointerType==z,r=n.pointerType==G;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)ze.call(this,t,n);else if(r&&Ge.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Ve=B(l.style,"touchAction"),We=Ve!==s,Ue="compute",qe="auto",Ke="manipulation",Ye="none",Xe="pan-x",Ze="pan-y",Je=tt();function Qe(e,t){this.manager=e,this.set(t)}function et(e){if(T(e,Ye))return Ye;var t=T(e,Xe),n=T(e,Ze);return t&&n?Ye:t||n?t?Xe:Ze:T(e,Ke)?Ke:qe}function tt(){if(!We)return!1;var e={},t=r.CSS&&r.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(n){e[n]=!t||r.CSS.supports("touch-action",n)})),e}Qe.prototype={set:function(e){e==Ue&&(e=this.compute()),We&&this.manager.element.style&&Je[e]&&(this.manager.element.style[Ve]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return y(this.manager.recognizers,(function(t){w(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),et(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var i=this.actions,r=T(i,Ye)&&!Je[Ye],o=T(i,Ze)&&!Je[Ze],a=T(i,Xe)&&!Je[Xe];if(r){var s=1===e.pointers.length,c=e.distance<2,p=e.deltaTime<250;if(s&&c&&p)return}if(!a||!o)return r||o&&n&te||a&&n&ne?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var nt=1,it=2,rt=4,ot=8,at=ot,st=16,ct=32;function pt(e){this.options=c({},this.defaults,e||{}),this.id=O(),this.manager=null,this.options.enable=S(this.options.enable,!0),this.state=nt,this.simultaneous={},this.requireFail=[]}function lt(e){return e&st?"cancel":e&ot?"end":e&rt?"move":e&it?"start":""}function ut(e){return e==ee?"down":e==Q?"up":e==Z?"left":e==J?"right":""}function ht(e,t){var n=t.manager;return n?n.get(e):e}function dt(){pt.apply(this,arguments)}function ft(){dt.apply(this,arguments),this.pX=null,this.pY=null}function mt(){dt.apply(this,arguments)}function vt(){pt.apply(this,arguments),this._timer=null,this._input=null}function yt(){dt.apply(this,arguments)}function gt(){dt.apply(this,arguments)}function bt(){pt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function xt(e,t){return t=t||{},t.recognizers=S(t.recognizers,xt.defaults.preset),new wt(e,t)}pt.prototype={defaults:{},set:function(e){return c(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(v(e,"recognizeWith",this))return this;var t=this.simultaneous;return e=ht(e,this),t[e.id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return v(e,"dropRecognizeWith",this)||(e=ht(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(v(e,"requireFailure",this))return this;var t=this.requireFail;return e=ht(e,this),-1===D(t,e)&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(v(e,"dropRequireFailure",this))return this;e=ht(e,this);var t=D(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function i(n){t.manager.emit(n,e)}n<ot&&i(t.options.event+lt(n)),i(t.options.event),e.additionalEvent&&i(e.additionalEvent),n>=ot&&i(t.options.event+lt(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=ct},canEmit:function(){var e=0;while(e<this.requireFail.length){if(!(this.requireFail[e].state&(ct|nt)))return!1;e++}return!0},recognize:function(e){var t=c({},e);if(!w(this.options.enable,[this,t]))return this.reset(),void(this.state=ct);this.state&(at|st|ct)&&(this.state=nt),this.state=this.process(t),this.state&(it|rt|ot|st)&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},_(dt,pt,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,i=t&(it|rt),r=this.attrTest(e);return i&&(n&Y||!r)?t|st:i||r?n&K?t|ot:t&it?t|rt:it:ct}}),_(ft,dt,{defaults:{event:"pan",threshold:10,pointers:1,direction:ie},getTouchAction:function(){var e=this.options.direction,t=[];return e&te&&t.push(Ze),e&ne&&t.push(Xe),t},directionTest:function(e){var t=this.options,n=!0,i=e.distance,r=e.direction,o=e.deltaX,a=e.deltaY;return r&t.direction||(t.direction&te?(r=0===o?X:o<0?Z:J,n=o!=this.pX,i=Math.abs(e.deltaX)):(r=0===a?X:a<0?Q:ee,n=a!=this.pY,i=Math.abs(e.deltaY))),e.direction=r,n&&i>t.threshold&&r&t.direction},attrTest:function(e){return dt.prototype.attrTest.call(this,e)&&(this.state&it||!(this.state&it)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=ut(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),_(mt,dt,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Ye]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&it)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),_(vt,pt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[qe]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime>t.time;if(this._input=e,!i||!n||e.eventType&(K|Y)&&!r)this.reset();else if(e.eventType&U)this.reset(),this._timer=m((function(){this.state=at,this.tryEmit()}),t.time,this);else if(e.eventType&K)return at;return ct},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===at&&(e&&e.eventType&K?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}}),_(yt,dt,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Ye]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&it)}}),_(gt,dt,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:te|ne,pointers:1},getTouchAction:function(){return ft.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(te|ne)?t=e.overallVelocity:n&te?t=e.overallVelocityX:n&ne&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&d(t)>this.options.velocity&&e.eventType&K},emit:function(e){var t=ut(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),_(bt,pt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Ke]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),e.eventType&U&&0===this.count)return this.failTimeout();if(i&&r&&n){if(e.eventType!=K)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||ve(this.pCenter,e.center)<t.posThreshold;this.pTime=e.timeStamp,this.pCenter=e.center,a&&o?this.count+=1:this.count=1,this._input=e;var s=this.count%t.taps;if(0===s)return this.hasRequireFailures()?(this._timer=m((function(){this.state=at,this.tryEmit()}),t.interval,this),it):at}return ct},failTimeout:function(){return this._timer=m((function(){this.state=ct}),this.options.interval,this),ct},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==at&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),xt.VERSION="2.0.7",xt.defaults={domEvents:!1,touchAction:Ue,enable:!0,inputTarget:null,inputClass:null,preset:[[yt,{enable:!1}],[mt,{enable:!1},["rotate"]],[gt,{direction:te}],[ft,{direction:te},["swipe"]],[bt],[bt,{event:"doubletap",taps:2},["tap"]],[vt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var _t=1,Et=2;function wt(e,t){this.options=c({},xt.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=se(this),this.touchAction=new Qe(this,this.options.touchAction),St(this,!0),y(this.options.recognizers,(function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])}),this)}function St(e,t){var n,i=e.element;i.style&&(y(e.options.cssProps,(function(r,o){n=B(i.style,o),t?(e.oldCssProps[n]=i.style[n],i.style[n]=r):i.style[n]=e.oldCssProps[n]||""})),t||(e.oldCssProps={}))}function Ct(e,t){var n=o.createEvent("Event");n.initEvent(e,!0,!0),n.gesture=t,t.target.dispatchEvent(n)}wt.prototype={set:function(e){return c(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?Et:_t},recognize:function(e){var t=this.session;if(!t.stopped){var n;this.touchAction.preventDefaults(e);var i=this.recognizers,r=t.curRecognizer;(!r||r&&r.state&at)&&(r=t.curRecognizer=null);var o=0;while(o<i.length)n=i[o],t.stopped===Et||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(e),!r&&n.state&(it|rt|ot)&&(r=t.curRecognizer=n),o++}},get:function(e){if(e instanceof pt)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(v(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(v(e,"remove",this))return this;if(e=this.get(e),e){var t=this.recognizers,n=D(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==s&&t!==s){var n=this.handlers;return y(R(e),(function(e){n[e]=n[e]||[],n[e].push(t)})),this}},off:function(e,t){if(e!==s){var n=this.handlers;return y(R(e),(function(e){t?n[e]&&n[e].splice(D(n[e],t),1):delete n[e]})),this}},emit:function(e,t){this.options.domEvents&&Ct(e,t);var n=this.handlers[e]&&this.handlers[e].slice();if(n&&n.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};var i=0;while(i<n.length)n[i](t),i++}},destroy:function(){this.element&&St(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},c(xt,{INPUT_START:U,INPUT_MOVE:q,INPUT_END:K,INPUT_CANCEL:Y,STATE_POSSIBLE:nt,STATE_BEGAN:it,STATE_CHANGED:rt,STATE_ENDED:ot,STATE_RECOGNIZED:at,STATE_CANCELLED:st,STATE_FAILED:ct,DIRECTION_NONE:X,DIRECTION_LEFT:Z,DIRECTION_RIGHT:J,DIRECTION_UP:Q,DIRECTION_DOWN:ee,DIRECTION_HORIZONTAL:te,DIRECTION_VERTICAL:ne,DIRECTION_ALL:ie,Manager:wt,Input:ae,TouchAction:Qe,TouchInput:je,MouseInput:we,PointerEventInput:Te,TouchMouseInput:$e,SingleTouchInput:Me,Recognizer:pt,AttrRecognizer:dt,Tap:bt,Pan:ft,Swipe:gt,Pinch:mt,Rotate:yt,Press:vt,on:C,off:A,each:y,merge:x,extend:b,assign:c,inherit:_,bindFn:E,prefixed:B});var At="undefined"!==typeof r?r:"undefined"!==typeof self?self:{};At.Hammer=xt,i=function(){return xt}.call(t,n,t,e),i===s||(e.exports=i)})(window,document)},e5ab:function(e,t,n){"use strict";var i=/,?([a-z]),?/gi,r=parseFloat,o=Math,a=o.PI,s=o.min,c=o.max,p=o.pow,l=o.abs,u=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,h=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,d=Array.isArray||function(e){return e instanceof Array};function f(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function m(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)f(e,n)&&(t[n]=m(e[n]));return t}function v(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function y(e){function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("␀"),r=t.cache=t.cache||{},o=t.count=t.count||[];return f(r,i)?(v(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e.apply(0,n),r[i])}return t}function g(e){if(!e)return null;var t=b(e);if(t.arr)return m(t.arr);var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=[];return d(e)&&d(e[0])&&(i=m(e)),i.length||String(e).replace(u,(function(e,t,r){var o=[],a=t.toLowerCase();r.replace(h,(function(e,t){t&&o.push(+t)})),"m"==a&&o.length>2&&(i.push([t].concat(o.splice(0,2))),a="l",t="m"==t?"l":"L");while(o.length>=n[a])if(i.push([t].concat(o.splice(0,n[a]))),!n[a])break})),i.toString=b.toString,t.arr=m(i),i}function b(e){var t=b.ps=b.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout((function(){for(var n in t)f(t,n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])})),t[e]}function x(e,t,n,i){return 1===arguments.length&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function _(){return this.join(",").replace(i,"$1")}function E(e){var t=m(e);return t.toString=_,t}function w(e,t,n,i,r,o,a,s,c){var l=1-c,u=p(l,3),h=p(l,2),d=c*c,f=d*c,m=u*e+3*h*c*n+3*l*c*c*r+f*a,v=u*t+3*h*c*i+3*l*c*c*o+f*s;return{x:D(m),y:D(v)}}function S(e){var t=I.apply(null,e);return x(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function C(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function A(e,t){return e=x(e),t=x(t),C(t,e.x,e.y)||C(t,e.x2,e.y)||C(t,e.x,e.y2)||C(t,e.x2,e.y2)||C(e,t.x,t.y)||C(e,t.x2,t.y)||C(e,t.x,t.y2)||C(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function k(e,t,n,i,r){var o=-3*t+9*n-9*i+3*r,a=e*o+6*t-12*n+6*i;return e*a-3*t+3*n}function T(e,t,n,i,r,a,s,c,p){null==p&&(p=1),p=p>1?1:p<0?0:p;for(var l=p/2,u=12,h=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],d=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,m=0;m<u;m++){var v=l*h[m]+l,y=k(v,e,n,r,s),g=k(v,t,i,a,c),b=y*y+g*g;f+=d[m]*o.sqrt(b)}return l*f}function R(e,t,n,i,r,o,a,p){if(!(c(e,n)<s(r,a)||s(e,n)>c(r,a)||c(t,i)<s(o,p)||s(t,i)>c(o,p))){var l=(e*i-t*n)*(r-a)-(e-n)*(r*p-o*a),u=(e*i-t*n)*(o-p)-(t-i)*(r*p-o*a),h=(e-n)*(o-p)-(t-i)*(r-a);if(h){var d=D(l/h),f=D(u/h),m=+d.toFixed(2),v=+f.toFixed(2);if(!(m<+s(e,n).toFixed(2)||m>+c(e,n).toFixed(2)||m<+s(r,a).toFixed(2)||m>+c(r,a).toFixed(2)||v<+s(t,i).toFixed(2)||v>+c(t,i).toFixed(2)||v<+s(o,p).toFixed(2)||v>+c(o,p).toFixed(2)))return{x:d,y:f}}}}function D(e){return Math.round(1e11*e)/1e11}function P(e,t,n){var i=S(e),r=S(t);if(!A(i,r))return n?0:[];for(var o=T.apply(0,e),a=T.apply(0,t),s=N(e)?1:~~(o/5)||1,c=N(t)?1:~~(a/5)||1,p=[],u=[],h={},d=n?0:[],f=0;f<s+1;f++){var m=w.apply(0,e.concat(f/s));p.push({x:m.x,y:m.y,t:f/s})}for(f=0;f<c+1;f++)m=w.apply(0,t.concat(f/c)),u.push({x:m.x,y:m.y,t:f/c});for(f=0;f<s;f++)for(var v=0;v<c;v++){var y,g=p[f],b=p[f+1],x=u[v],_=u[v+1],E=l(b.x-g.x)<.01?"y":"x",C=l(_.x-x.x)<.01?"y":"x",k=R(g.x,g.y,b.x,b.y,x.x,x.y,_.x,_.y);if(k){if(y=k.x.toFixed(9)+"#"+k.y.toFixed(9),h[y])continue;h[y]=!0;var D=g.t+l((k[E]-g[E])/(b[E]-g[E]))*(b.t-g.t),P=x.t+l((k[C]-x[C])/(_[C]-x[C]))*(_.t-x.t);D>=0&&D<=1&&P>=0&&P<=1&&(n?d++:d.push({x:k.x,y:k.y,t1:D,t2:P}))}}return d}function M(e,t,n){e=F(e),t=F(t);for(var i,r,o,a,s,c,p,l,u,h,d=n?0:[],f=0,m=e.length;f<m;f++){var v=e[f];if("M"==v[0])i=s=v[1],r=c=v[2];else{"C"==v[0]?(u=[i,r].concat(v.slice(1)),i=u[6],r=u[7]):(u=[i,r,i,r,s,c,s,c],i=s,r=c);for(var y=0,g=t.length;y<g;y++){var b=t[y];if("M"==b[0])o=p=b[1],a=l=b[2];else{"C"==b[0]?(h=[o,a].concat(b.slice(1)),o=h[6],a=h[7]):(h=[o,a,o,a,p,l,p,l],o=p,a=l);var x=P(u,h,n);if(n)d+=x;else{for(var _=0,E=x.length;_<E;_++)x[_].segment1=f,x[_].segment2=y,x[_].bez1=u,x[_].bez2=h;d=d.concat(x)}}}}}return d}function B(e){var t=b(e);if(t.abs)return E(t.abs);if(d(e)&&d(e&&e[0])||(e=g(e)),!e||!e.length)return[["M",0,0]];var n,i=[],r=0,o=0,a=0,s=0,c=0;"M"==e[0][0]&&(r=+e[0][1],o=+e[0][2],a=r,s=o,c++,i[0]=["M",r,o]);for(var p,l,u=c,h=e.length;u<h;u++){if(i.push(p=[]),l=e[u],n=l[0],n!=n.toUpperCase())switch(p[0]=n.toUpperCase(),p[0]){case"A":p[1]=l[1],p[2]=l[2],p[3]=l[3],p[4]=l[4],p[5]=l[5],p[6]=+l[6]+r,p[7]=+l[7]+o;break;case"V":p[1]=+l[1]+o;break;case"H":p[1]=+l[1]+r;break;case"M":a=+l[1]+r,s=+l[2]+o;default:for(var f=1,m=l.length;f<m;f++)p[f]=+l[f]+(f%2?r:o)}else for(var v=0,y=l.length;v<y;v++)p[v]=l[v];switch(n=n.toUpperCase(),p[0]){case"Z":r=+a,o=+s;break;case"H":r=p[1];break;case"V":o=p[1];break;case"M":a=p[p.length-2],s=p[p.length-1];default:r=p[p.length-2],o=p[p.length-1]}}return i.toString=_,t.abs=E(i),i}function N(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function O(e,t,n,i){return[e,t,n,i,n,i]}function j(e,t,n,i,r,o){var a=1/3,s=2/3;return[a*e+s*n,a*t+s*i,a*r+s*n,a*o+s*i,r,o]}function L(e,t,n,i,r,s,c,p,u,h){var d,f=120*a/180,m=a/180*(+r||0),v=[],g=y((function(e,t,n){var i=e*o.cos(n)-t*o.sin(n),r=e*o.sin(n)+t*o.cos(n);return{x:i,y:r}}));if(h)k=h[0],T=h[1],C=h[2],A=h[3];else{d=g(e,t,-m),e=d.x,t=d.y,d=g(p,u,-m),p=d.x,u=d.y;var b=(e-p)/2,x=(t-u)/2,_=b*b/(n*n)+x*x/(i*i);_>1&&(_=o.sqrt(_),n*=_,i*=_);var E=n*n,w=i*i,S=(s==c?-1:1)*o.sqrt(l((E*w-E*x*x-w*b*b)/(E*x*x+w*b*b))),C=S*n*x/i+(e+p)/2,A=S*-i*b/n+(t+u)/2,k=o.asin(((t-A)/i).toFixed(9)),T=o.asin(((u-A)/i).toFixed(9));k=e<C?a-k:k,T=p<C?a-T:T,k<0&&(k=2*a+k),T<0&&(T=2*a+T),c&&k>T&&(k-=2*a),!c&&T>k&&(T-=2*a)}var R=T-k;if(l(R)>f){var D=T,P=p,M=u;T=k+f*(c&&T>k?1:-1),p=C+n*o.cos(T),u=A+i*o.sin(T),v=L(p,u,n,i,r,0,c,P,M,[T,D,C,A])}R=T-k;var B=o.cos(k),N=o.sin(k),O=o.cos(T),j=o.sin(T),I=o.tan(R/4),F=4/3*n*I,$=4/3*i*I,z=[e,t],H=[e+F*N,t-$*B],G=[p+F*j,u-$*O],V=[p,u];if(H[0]=2*z[0]-H[0],H[1]=2*z[1]-H[1],h)return[H,G,V].concat(v);v=[H,G,V].concat(v).join().split(",");for(var W=[],U=0,q=v.length;U<q;U++)W[U]=U%2?g(v[U-1],v[U],m).y:g(v[U],v[U+1],m).x;return W}function I(e,t,n,i,r,a,p,u){for(var h,d,f,m,v,y,g,b,x=[],_=[[],[]],E=0;E<2;++E)if(0==E?(d=6*e-12*n+6*r,h=-3*e+9*n-9*r+3*p,f=3*n-3*e):(d=6*t-12*i+6*a,h=-3*t+9*i-9*a+3*u,f=3*i-3*t),l(h)<1e-12){if(l(d)<1e-12)continue;m=-f/d,0<m&&m<1&&x.push(m)}else g=d*d-4*f*h,b=o.sqrt(g),g<0||(v=(-d+b)/(2*h),0<v&&v<1&&x.push(v),y=(-d-b)/(2*h),0<y&&y<1&&x.push(y));var w,S=x.length,C=S;while(S--)m=x[S],w=1-m,_[0][S]=w*w*w*e+3*w*w*m*n+3*w*m*m*r+m*m*m*p,_[1][S]=w*w*w*t+3*w*w*m*i+3*w*m*m*a+m*m*m*u;return _[0][C]=e,_[1][C]=t,_[0][C+1]=p,_[1][C+1]=u,_[0].length=_[1].length=C+2,{x0:s.apply(0,_[0]),y0:s.apply(0,_[1]),x1:c.apply(0,_[0]),y1:c.apply(0,_[1])}}function F(e){var t=b(e);if(t.curve)return E(t.curve);for(var n=B(e),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o=function(e,t,n){var i,r;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"].concat(L.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":"C"==n||"S"==n?(i=2*t.x-t.bx,r=2*t.y-t.by):(i=t.x,r=t.y),e=["C",i,r].concat(e.slice(1));break;case"T":"Q"==n||"T"==n?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),e=["C"].concat(j(t.x,t.y,t.qx,t.qy,e[1],e[2]));break;case"Q":t.qx=e[1],t.qy=e[2],e=["C"].concat(j(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(O(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(O(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(O(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(O(t.x,t.y,t.X,t.Y));break}return e},a=function(e,t){if(e[t].length>7){e[t].shift();var i=e[t];while(i.length)s[t]="A",e.splice(t++,0,["C"].concat(i.splice(0,6)));e.splice(t,1),u=n.length}},s=[],c="",p="",l=0,u=n.length;l<u;l++){n[l]&&(c=n[l][0]),"C"!=c&&(s[l]=c,l&&(p=s[l-1])),n[l]=o(n[l],i,p),"A"!=s[l]&&"C"==c&&(s[l]="C"),a(n,l);var h=n[l],d=h.length;i.x=h[d-2],i.y=h[d-1],i.bx=r(h[d-4])||i.x,i.by=r(h[d-3])||i.y}return t.curve=E(n),n}e.exports=M}}]);