var kt=Object.defineProperty;var Mt=(n,e,t)=>e in n?kt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var f=(n,e,t)=>Mt(n,typeof e!="symbol"?e+"":e,t);import{g as Bt,r as xt}from"./mxgraph.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function t(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(o){if(o.ep)return;o.ep=!0;const i=t(o);fetch(o.href,i)}})();var te=(n=>(n.None="None",n.HorizontalVertical="HorizontalVertical",n.Horizontal="Horizontal",n.Vertical="Vertical",n.Center="Center",n))(te||{}),Yt=(n=>(n.In="in",n.Out="out",n))(Yt||{});function Vt(n){return n instanceof HTMLElement?n:document.querySelector(`#${n}`)}var h=(n=>(n.LANE="lane",n.POOL="pool",n.CALL_ACTIVITY="callActivity",n.SUB_PROCESS="subProcess",n.TASK="task",n.TASK_USER="userTask",n.TASK_SERVICE="serviceTask",n.TASK_RECEIVE="receiveTask",n.TASK_SEND="sendTask",n.TASK_MANUAL="manualTask",n.TASK_SCRIPT="scriptTask",n.TASK_BUSINESS_RULE="businessRuleTask",n.GLOBAL_TASK="globalTask",n.GLOBAL_TASK_USER="globalUserTask",n.GLOBAL_TASK_MANUAL="globalManualTask",n.GLOBAL_TASK_SCRIPT="globalScriptTask",n.GLOBAL_TASK_BUSINESS_RULE="globalBusinessRuleTask",n.GROUP="group",n.TEXT_ANNOTATION="textAnnotation",n.GATEWAY_PARALLEL="parallelGateway",n.GATEWAY_EXCLUSIVE="exclusiveGateway",n.GATEWAY_INCLUSIVE="inclusiveGateway",n.GATEWAY_EVENT_BASED="eventBasedGateway",n.GATEWAY_COMPLEX="complexGateway",n.EVENT_START="startEvent",n.EVENT_END="endEvent",n.EVENT_INTERMEDIATE_CATCH="intermediateCatchEvent",n.EVENT_INTERMEDIATE_THROW="intermediateThrowEvent",n.EVENT_BOUNDARY="boundaryEvent",n))(h||{}),ne=(n=>(n.CALLING_PROCESS="process",n.CALLING_GLOBAL_TASK="global task",n))(ne||{}),se=(n=>(n.Exclusive="Exclusive",n.None="None",n.Parallel="Parallel",n))(se||{}),w=(n=>(n.NONE="none",n.TERMINATE="terminate",n.CANCEL="cancel",n.COMPENSATION="compensate",n.CONDITIONAL="conditional",n.ERROR="error",n.ESCALATION="escalation",n.LINK="link",n.MESSAGE="message",n.SIGNAL="signal",n.TIMER="timer",n))(w||{}),y=(n=>(n.ADHOC="adhoc",n.COMPENSATION="compensation",n.EXPAND="expand",n.LOOP="loop",n.MULTI_INSTANCE_PARALLEL="multi-parallel",n.MULTI_INSTANCE_SEQUENTIAL="multi-sequential",n))(y||{}),Y=(n=>(n.AD_HOC="adhoc",n.EMBEDDED="embedded",n.EVENT="event",n.TRANSACTION="transaction",n))(Y||{});function Gt(n,e){return n===""?e?{}:void 0:n}function E(n,e=!1){return n==null?[]:(Array.isArray(n)?n:[n]).map(t=>Gt(t,e)).filter(Boolean)}function Dt(n,e,t){const s=[];t!=null&&t.startingWith?s.push(`^(${t.startingWith}).*`):t!=null&&t.notStartingWith&&s.push(`^(?!(${t.notStartingWith})).*`),s.push(`${e}$`);const o=s.join("");return n.filter(i=>t!=null&&t.ignoreCase?new RegExp(o,"i").test(i):new RegExp(o).test(i))}class p{static isEvent(e){return le(He,e)}static eventKinds(){return[...He]}static isBoundaryEvent(e){return h.EVENT_BOUNDARY===e}static isStartEvent(e){return h.EVENT_START===e}static isCatchEvent(e){return h.EVENT_INTERMEDIATE_CATCH===e||h.EVENT_BOUNDARY===e||h.EVENT_START===e}static isIntermediateCatchEvent(e){return h.EVENT_INTERMEDIATE_CATCH===e}static isIntermediateThrowEvent(e){return h.EVENT_INTERMEDIATE_THROW===e}static isCallActivity(e){return h.CALL_ACTIVITY===e}static isSubProcess(e){return h.SUB_PROCESS===e}static canHaveNoneEvent(e){return h.EVENT_INTERMEDIATE_THROW===e||h.EVENT_END===e||h.EVENT_START===e}static isActivity(e){return le(Ae,e)}static activityKinds(){return[...Ae]}static isWithDefaultSequenceFlow(e){return Ut.has(e)}static isTask(e){return le(me,e)}static taskKinds(){return[...me]}static gatewayKinds(){return[...Ke]}static isGateway(e){return le(Ke,e)}static flowNodeKinds(){return Object.values(h).filter(e=>!p.isPoolOrLane(e))}static isPoolOrLane(e){return e==h.POOL||e==h.LANE}}function Fe(n,e){return Dt(Object.values(h),n,e)}function le(n,e){return Object.values(n).map(t=>t).includes(e)}const He=Fe("Event"),Ke=Fe("Gateway"),me=Fe("Task",{ignoreCase:!0,notStartingWith:"global"}),Ae=[...me,h.CALL_ACTIVITY,h.SUB_PROCESS],Ut=new Set([...Ae,h.GATEWAY_EXCLUSIVE,h.GATEWAY_INCLUSIVE,h.GATEWAY_COMPLEX]),rt=Object.values(w).filter(n=>n!=w.NONE);var $=(n=>(n.NONE="None",n.ONE="One",n.BOTH="Both",n))($||{}),k=(n=>(n.SEQUENCE_FLOW="sequenceFlow",n.MESSAGE_FLOW="messageFlow",n.ASSOCIATION_FLOW="association",n))(k||{}),oe=(n=>(n.NONE="none",n.INITIATING="initiating",n.NON_INITIATING="non_initiating",n))(oe||{}),x=(n=>(n.NORMAL="normal",n.DEFAULT="default",n.CONDITIONAL_FROM_ACTIVITY="conditional_from_activity",n.CONDITIONAL_FROM_GATEWAY="conditional_from_gateway",n))(x||{});class Te{constructor(e,t,s,o,i){this.id=e,this.name=t,this.kind=s,this.sourceReferenceId=o,this.targetReferenceId=i}}class lt extends Te{constructor(e,t,s,o,i=x.NORMAL){super(e,t,k.SEQUENCE_FLOW,s,o),this.sequenceFlowKind=i}}class at extends Te{constructor(e,t,s,o){super(e,t,k.MESSAGE_FLOW,s,o)}}class ct extends Te{constructor(e,t,s,o,i=$.NONE){super(e,t,k.ASSOCIATION_FLOW,s,o),this.associationDirectionKind=i}}var Wt=xt();const Ht=Bt(Wt),O=Xt(),Kt=O.mxCellRenderer,zt=O.mxClient,c=O.mxConstants,V=O.mxEvent,ze=O.mxPerimeter,P=O.mxPoint,ve=O.mxRectangle,Pe=O.mxRectangleShape,ke=O.mxSvgCanvas2D,A=O.mxUtils;function Xt(){return window.mxForceIncludes=!1,window.mxLoadResources=!1,window.mxLoadStylesheets=!1,window.mxResourceExtension=".txt",Ht({})}class $t{constructor(e){this.graph=e}computeRelativeCoordinates(e,t){const s=this.getTranslateForRoot(e),o=t.x+s.x,i=t.y+s.y;return new P(o,i)}getTranslateForRoot(e){const t=this.graph.getModel(),s=new P(0,0);for(;e!=null;){const o=t.getGeometry(e);o!=null&&(s.x-=o.x,s.y-=o.y),e=t.getParent(e)}return s}computeEdgeCenter(e){const t=e.geometry.points,s=t[0],o=t.at(-1),i=o.x-s.x,r=o.y-s.y;return new P(s.x+i/2,s.y+r/2)}}class ue{constructor(e,t,s,o,i){f(this,"extensions",{});this.id=e,this.bpmnElement=t,this.bounds=s,this.label=o,this.isHorizontal=i}}class B{constructor(e,t,s,o,i=!1){f(this,"incomingIds",[]);f(this,"outgoingIds",[]);this.id=e,this.name=t,this.kind=s,this.parentId=o,this.instantiate=i}}class pe extends B{constructor(e,t,s,o,i,r=[]){super(e,t,s,o,i),this.markers=r}}class X extends pe{constructor(e,t,s,o,i,r){super(e,t,h.CALL_ACTIVITY,o,void 0,i),this.callActivityKind=s,this.globalTaskKind=r}}class ie extends pe{constructor(e,t,s,o,i){s==Y.AD_HOC&&!i.includes(y.ADHOC)&&i.push(y.ADHOC),super(e,t,h.SUB_PROCESS,o,void 0,i),this.subProcessKind=s}}class U extends B{constructor(e,t,s,o,i){super(e,t,s,i),this.eventDefinitionKind=o}}class Oe extends U{constructor(t,s,o,i){super(t,s,h.EVENT_INTERMEDIATE_CATCH,o,i);f(this,"sourceIds",[])}}class Le extends U{constructor(t,s,o,i){super(t,s,h.EVENT_INTERMEDIATE_THROW,o,i);f(this,"targetId")}}class ut extends U{constructor(e,t,s,o,i){super(e,t,h.EVENT_START,s,o),this.isInterrupting=i}}class dt extends U{constructor(e,t,s,o,i=!0){super(e,t,h.EVENT_BOUNDARY,s,o),this.isInterrupting=i}}class ht extends B{constructor(e,t,s,o,i=se.None){super(e,t,h.GATEWAY_EVENT_BASED,s,o),this.gatewayKind=i}}function de(n,e,t,s){return Math.min(Math.max(n??s,e),t)}function Zt(n){return Math.max(n??0,0)}function jt(n){const e=n??{};return e.debounceDelay=de(e.debounceDelay,0,100,50),e.throttleDelay=de(e.throttleDelay,0,100,50),e}function Ee(n){return n=="default"?void 0:de(n,0,100,100)}function qt(n){return n=="default"?void 0:de(n,1,50,1)}const S={EDGE:"bpmn.edge",EDGE_START_FILL_COLOR:"bpmn.edge.startFillColor",EDGE_END_FILL_COLOR:"bpmn.edge.endFillColor",EVENT_BASED_GATEWAY_KIND:"bpmn.gatewayKind",EVENT_DEFINITION_KIND:"bpmn.eventDefinitionKind",GLOBAL_TASK_KIND:"bpmn.globalTaskKind",SUB_PROCESS_KIND:"bpmn.subProcessKind",IS_INITIATING:"bpmn.isInitiating",IS_INSTANTIATING:"bpmn.isInstantiating",IS_INTERRUPTING:"bpmn.isInterrupting",EXTRA_CSS_CLASSES:"bpmn.extra.css.classes",MARKERS:"bpmn.markers",MESSAGE_FLOW_ICON:"bpmn.messageFlowIcon"},ft={ARROW_DASH:"bpmn.dash"},T={STROKE_WIDTH_THIN:2,STROKE_WIDTH_THICK:5,SHAPE_ACTIVITY_BOTTOM_MARGIN:7,SHAPE_ACTIVITY_TOP_MARGIN:7,SHAPE_ACTIVITY_LEFT_MARGIN:7,SHAPE_ACTIVITY_MARKER_ICON_MARGIN:5,SHAPE_ACTIVITY_MARKER_ICON_SIZE:20,POOL_LABEL_SIZE:30,POOL_LABEL_FILL_COLOR:"none",LANE_LABEL_SIZE:30,LANE_LABEL_FILL_COLOR:"none",SUB_PROCESS_TRANSACTION_INNER_RECT_OFFSET:4,SUB_PROCESS_TRANSACTION_INNER_RECT_ARC_SIZE:6,TEXT_ANNOTATION_BORDER_LENGTH:10,TEXT_ANNOTATION_FILL_COLOR:"none",GROUP_FILL_COLOR:"none",DEFAULT_FILL_COLOR:"White",DEFAULT_STROKE_COLOR:"Black",DEFAULT_FONT_FAMILY:"Arial, Helvetica, sans-serif",DEFAULT_FONT_SIZE:11,DEFAULT_FONT_COLOR:"Black",DEFAULT_MARGIN:0,SHAPE_ARC_SIZE:20,DEFAULT_OVERLAY_FILL_COLOR:"White",DEFAULT_OVERLAY_FILL_OPACITY:100,DEFAULT_OVERLAY_STROKE_COLOR:"Black",DEFAULT_OVERLAY_STROKE_WIDTH:1,DEFAULT_OVERLAY_FONT_SIZE:11,DEFAULT_OVERLAY_FONT_COLOR:"Black",SEQUENCE_FLOW_CONDITIONAL_FROM_ACTIVITY_MARKER_FILL_COLOR:"White",MESSAGE_FLOW_MARKER_START_FILL_COLOR:"White",MESSAGE_FLOW_MARKER_END_FILL_COLOR:"White"},gt=n=>A.getValue(n,S.IS_INSTANTIATING,"false")=="true",he=n=>n=="default"?void 0:n,Qt=(n,e)=>(e&&(n=b(n,c.STYLE_STROKECOLOR,e.color,he),n=b(n,c.STYLE_STROKE_OPACITY,e.opacity,Ee),n=b(n,c.STYLE_STROKEWIDTH,e.width,qt)),n),b=(n,e,t,s=o=>o)=>t==null?n:A.setStyle(n,e,s(t)),ae=(n,e,t,s)=>s==null?n:A.setStyleFlag(n,e,t,s),Jt=(n,e)=>(e&&(n=b(n,c.STYLE_FONTCOLOR,e.color,he),n=b(n,c.STYLE_FONTSIZE,e.size),n=b(n,c.STYLE_FONTFAMILY,e.family),n=ae(n,c.STYLE_FONTSTYLE,c.FONT_BOLD,e.isBold),n=ae(n,c.STYLE_FONTSTYLE,c.FONT_ITALIC,e.isItalic),n=ae(n,c.STYLE_FONTSTYLE,c.FONT_UNDERLINE,e.isUnderline),n=ae(n,c.STYLE_FONTSTYLE,c.FONT_STRIKETHROUGH,e.isStrikeThrough),n=b(n,c.STYLE_TEXT_OPACITY,e.opacity,Ee)),n),en=(n,e,t)=>(n==null?void 0:n.split(";").map(s=>s.split("=")).filter(([s])=>s===e).map(([,s])=>s)[0])??t,tn=n=>{switch(n){case"right-to-left":return c.DIRECTION_WEST;case"bottom-to-top":return c.DIRECTION_NORTH;case"top-to-bottom":return c.DIRECTION_SOUTH;default:return c.DIRECTION_EAST}},nn=(n,e)=>{const t=e.color;if(t){const s=on(t),o=s?t.startColor:t;n=b(n,c.STYLE_FILLCOLOR,o,he),s?(n=A.setStyle(n,c.STYLE_GRADIENTCOLOR,t.endColor),n=A.setStyle(n,c.STYLE_GRADIENT_DIRECTION,tn(t.direction))):t==="default"&&(n=A.setStyle(n,c.STYLE_GRADIENTCOLOR,void 0),n=A.setStyle(n,c.STYLE_GRADIENT_DIRECTION,void 0)),(n.includes(h.POOL)||n.includes(h.LANE))&&(n=b(n,c.STYLE_SWIMLANE_FILLCOLOR,o,he))}return n=b(n,c.STYLE_FILL_OPACITY,e.opacity,Ee),n},sn=n=>n&&typeof n=="object"&&"fill"in n,on=n=>n&&typeof n=="object";class rn{constructor(e){f(this,"ignoreBpmnColors");this.ignoreBpmnColors=(e==null?void 0:e.ignoreBpmnColors)??!0}computeStyle(e,t){const s=[e.bpmnElement.kind];let o;e instanceof ue?o=this.computeShapeStyleValues(e):(s.push(...cn(e)),o=this.computeEdgeStyleValues(e));const i=this.computeFontStyleValues(e),r=un(e,t);return s.push(...Xe([...o,...i,...r])),s.join(";")}computeShapeStyleValues(e){const t=new Map,s=e.bpmnElement;if(s instanceof U?ln(s,t):s instanceof pe?an(s,t):p.isPoolOrLane(s.kind)?t.set(c.STYLE_HORIZONTAL,e.isHorizontal?"0":"1"):s instanceof ht&&(t.set(S.IS_INSTANTIATING,String(s.instantiate)),t.set(S.EVENT_BASED_GATEWAY_KIND,String(s.gatewayKind))),!this.ignoreBpmnColors){const o=e.extensions,i=o.fillColor;i&&(t.set(c.STYLE_FILLCOLOR,i),p.isPoolOrLane(s.kind)&&t.set(c.STYLE_SWIMLANE_FILLCOLOR,i)),o.strokeColor&&t.set(c.STYLE_STROKECOLOR,o.strokeColor)}return t}computeEdgeStyleValues(e){const t=new Map;if(!this.ignoreBpmnColors){const s=e.extensions;s.strokeColor&&t.set(c.STYLE_STROKECOLOR,s.strokeColor)}return t}computeFontStyleValues(e){var o,i;const t=new Map,s=(o=e.label)==null?void 0:o.font;if(s&&(t.set(c.STYLE_FONTFAMILY,s.name),t.set(c.STYLE_FONTSIZE,s.size),t.set(c.STYLE_FONTSTYLE,dn(s))),!this.ignoreBpmnColors){const r=(i=e.label)==null?void 0:i.extensions;r!=null&&r.color&&t.set(c.STYLE_FONTCOLOR,r.color)}return t}computeMessageFlowIconStyle(e){const t=[];return t.push(["shape",S.MESSAGE_FLOW_ICON],[S.IS_INITIATING,String(e.messageVisibleKind===oe.INITIATING)]),this.ignoreBpmnColors||e.extensions.strokeColor&&t.push([c.STYLE_STROKECOLOR,e.extensions.strokeColor]),Xe(t).join(";")}}function ln(n,e){e.set(S.EVENT_DEFINITION_KIND,n.eventDefinitionKind),(n instanceof dt||n instanceof ut&&n.isInterrupting!==void 0)&&e.set(S.IS_INTERRUPTING,String(n.isInterrupting))}function an(n,e){n instanceof ie?e.set(S.SUB_PROCESS_KIND,n.subProcessKind):n.kind===h.TASK_RECEIVE?e.set(S.IS_INSTANTIATING,String(n.instantiate)):n instanceof X&&e.set(S.GLOBAL_TASK_KIND,n.globalTaskKind);const t=n.markers;t.length>0&&e.set(S.MARKERS,t.join(","))}function cn(n){const e=[],t=n.bpmnElement;return t instanceof lt&&e.push(t.sequenceFlowKind),t instanceof ct&&e.push(t.associationDirectionKind),e}function un(n,e){const t=new Map,s=n.bpmnElement;return e?(t.set(c.STYLE_VERTICAL_ALIGN,c.ALIGN_TOP),n.bpmnElement.kind!=h.TEXT_ANNOTATION&&t.set(c.STYLE_ALIGN,c.ALIGN_CENTER),n instanceof ue&&(t.set(c.STYLE_LABEL_WIDTH,e.width+1),t.set(c.STYLE_LABEL_POSITION,"ignore"),t.set(c.STYLE_VERTICAL_LABEL_POSITION,c.ALIGN_MIDDLE))):n instanceof ue&&(s instanceof ie||s instanceof X&&s.callActivityKind===ne.CALLING_PROCESS)&&!s.markers.includes(y.EXPAND)&&t.set(c.STYLE_VERTICAL_ALIGN,c.ALIGN_TOP),t}function dn(n){let e=0;return n.isBold&&(e+=c.FONT_BOLD),n.isItalic&&(e+=c.FONT_ITALIC),n.isStrikeThrough&&(e+=c.FONT_STRIKETHROUGH),n.isUnderline&&(e+=c.FONT_UNDERLINE),e}function Xe(n){return n.filter(([,e])=>e&&e!="undefined").map(([e,t])=>`${e}=${t}`)}class hn{constructor(e,t,s){this.graph=e,this.coordinatesTranslator=t,this.styleComputer=s}render(e){this.insertShapesAndEdges(e)}insertShapesAndEdges({pools:e,lanes:t,subprocesses:s,otherFlowNodes:o,boundaryEvents:i,edges:r}){this.graph.batchUpdate(()=>{this.graph.getModel().clear(),this.insertShapes(e),this.insertShapes(t),this.insertShapes(s),this.insertShapes(o),this.insertShapes(i),this.insertEdges(r)})}insertShapes(e){for(const t of e)this.insertShape(t)}getParent(e){return this.getCell(e.parentId)??this.graph.getDefaultParent()}insertShape(e){var l;const t=e.bpmnElement,s=this.getParent(t),o=e.bounds;let i=(l=e.label)==null?void 0:l.bounds;i=p.isPoolOrLane(t.kind)?void 0:i;const r=this.styleComputer.computeStyle(e,i);this.insertVertex(s,t.id,t.name,o,i,r)}insertEdges(e){var t;for(const s of e){const o=s.bpmnElement,i=this.graph.getDefaultParent(),r=this.getCell(o.sourceReferenceId),l=this.getCell(o.targetReferenceId),a=(t=s.label)==null?void 0:t.bounds,d=this.styleComputer.computeStyle(s,a),u=this.graph.insertEdge(i,o.id,o.name,r,l,d);if(this.insertWaypoints(s.waypoints,u),a){u.geometry.width=a.width,u.geometry.height=a.height;const g=this.coordinatesTranslator.computeEdgeCenter(u);u.geometry.relative=!1;const I=this.coordinatesTranslator.computeRelativeCoordinates(u.parent,new P(a.x,a.y)),C=I.x+a.width/2-g.x,L=I.y-g.y;u.geometry.offset=new P(C,L)}this.insertMessageFlowIconIfNeeded(s,u)}}insertMessageFlowIconIfNeeded(e,t){if(e.bpmnElement instanceof at&&e.messageVisibleKind!==oe.NONE){const s=this.graph.insertVertex(t,Me(t.id),void 0,0,0,20,14,this.styleComputer.computeMessageFlowIconStyle(e));s.geometry.relative=!0,s.geometry.offset=new P(-10,-7)}}insertWaypoints(e,t){e&&(t.geometry.points=e.map(s=>this.coordinatesTranslator.computeRelativeCoordinates(t.parent,new P(s.x,s.y))))}getCell(e){return this.graph.getModel().getCell(e)}insertVertex(e,t,s,o,i,r){const l=this.coordinatesTranslator.computeRelativeCoordinates(e,new P(o.x,o.y)),a=this.graph.insertVertex(e,t,s,l.x,l.y,o.width,o.height,r);if(i){const d=i.x-o.x,u=i.y-o.y;a.geometry.offset=new P(d,u)}return a}}function fn(n,e){return new hn(n,new $t(n),new rn(e))}function Me(n){return`messageFlowIcon_of_${n}`}class Tt extends O.mxCellOverlay{constructor(t,s){super(null,"",s.position.horizontalAlign,s.position.verticalAlign,null,"default");f(this,"style");this.label=t,this.style=s.style}getBounds(t){const s=t.view.graph.getModel().isEdge(t.cell),o=t.view.scale;let i;const r=0,l=0;return s?i=this.computeEdgeBounds(t):(i=new P,this.align==c.ALIGN_LEFT?i.x=t.x:this.align==c.ALIGN_CENTER?i.x=t.x+t.width/2:i.x=t.x+t.width,this.verticalAlign==c.ALIGN_TOP?i.y=t.y:this.verticalAlign==c.ALIGN_MIDDLE?i.y=t.y+t.height/2:i.y=t.y+t.height),new ve(Math.round(i.x-(r*this.defaultOverlap-this.offset.x)*o),Math.round(i.y-(l*this.defaultOverlap-this.offset.y)*o),r*o,l*o)}computeEdgeBounds(t){const s=t.absolutePoints;if(this.align==c.ALIGN_LEFT)return s[0];if(this.align==c.ALIGN_CENTER){if(s.length%2==1)return s[Math.floor(s.length/2)];{const o=s.length/2,i=s[o-1],r=s[o];return new P(i.x+(r.x-i.x)/2,i.y+(r.y-i.y)/2)}}else return s.at(-1)}}class $e extends O.mxText{constructor(e,t,s){super(e,t,void 0,void 0,s.font.color,void 0,s.font.size,void 0,void 0,void 0,void 0,void 0,void 0,void 0,s.fill.color,s.stroke.color),this.fillOpacity=s.fill.opacity,this.strokewidth=s.stroke.width}}function gn(n){return Object.values(k).map(e=>e).includes(n)}function Tn(n,e){return pn(n.style,e)}function pn(n,e){const t=[],s=n.split(";"),i=s[0].replace(/shape=bpmn./g,""),r=new Map;r.set("bpmn-type-activity",p.isActivity(i)),r.set("bpmn-type-container",p.isPoolOrLane(i)),r.set("bpmn-type-event",p.isEvent(i)),r.set("bpmn-type-flow",gn(i)),r.set("bpmn-type-gateway",p.isGateway(i)),r.set("bpmn-type-task",p.isTask(i));for(const[l]of[...r].filter(([,a])=>a))t.push(l);t.push(Ne(i));for(const[l,a]of s.map(d=>{const u=d.split("=");return[u[0],u[1]]}))switch(l){case S.EVENT_DEFINITION_KIND:{t.push(`bpmn-event-def-${a}`);break}case S.EVENT_BASED_GATEWAY_KIND:{t.push(`bpmn-gateway-kind-${a.toLowerCase()}`);break}case S.IS_INITIATING:{t.push(a=="true"?"bpmn-icon-initiating":"bpmn-icon-non-initiating");break}case S.SUB_PROCESS_KIND:{t.push(`bpmn-sub-process-${a.toLowerCase()}`);break}case S.GLOBAL_TASK_KIND:{t.push(Ne(a));break}}return e&&t.push("bpmn-label"),t}function Ne(n){return n?"bpmn-"+n.replace(/([A-Z])/g,e=>"-"+e[0].toLowerCase()):""}const Ze=function(n){const e=n.createSvgCanvas;n.createSvgCanvas=function(){var o;const t=e.bind(this)(),s=t.getTextCss;if(t.getTextCss=function(){const i=this.pointerEvents;this.pointerEvents=!1;const r=s.bind(this)();return this.pointerEvents=i,r},(o=this.state)!=null&&o.cell){const i=this.state.cell,r=Tn(i,this.dialect===c.DIALECT_STRICTHTML),l=this.state.style[S.EXTRA_CSS_CLASSES];typeof l=="string"&&r.push(...l.split(",")),this.node.setAttribute("class",r.join(" ")),this.node.dataset.bpmnId=this.state.cell.id}return t}};class En extends O.mxCellRenderer{constructor(e){super(),this.iconPainter=e}createCellOverlays(e){const s=e.view.graph.getCellOverlays(e.cell);let o=null;if(s!=null){o=new O.mxDictionary;for(const i of s){const r=e.overlays==null?null:e.overlays.remove(i);if(r!=null){o.put(i,r);continue}let l;i instanceof Tt?l=new $e(i.label,new ve(0,0,0,0),i.style):(l=new O.mxImageShape(new ve(0,0,0,0),i.image.src),l.preserveImageAspect=!1),l.dialect=e.view.graph.dialect,l.overlay=i,this.initializeOverlay(e,l),this.installCellOverlayListeners(e,i,l),i.cursor!=null&&(l.node.style.cursor=i.cursor),l instanceof $e&&(l.node.classList.add("overlay-badge"),l.node.dataset.bpmnId=e.cell.id),o.put(i,l)}}e.overlays!=null&&e.overlays.visit(function(i,r){r.destroy()}),e.overlays=o}createShape(e){const t=super.createShape(e);return"iconPainter"in t&&(t.iconPainter=this.iconPainter),Ze(t),t}createLabel(e,t){super.createLabel(e,t),Ze(e.text)}}function Sn(n,e,t,s){let o,i;n.heightC.setIconOriginForIconCentered(),shapeConfig:{x:e,y:t,width:s,height:o,strokeWidth:d},iconStyleConfig:{isFilled:l,fillColor:u,strokeColor:g,strokeWidth:a,margin:I}}}class Cn{newBpmnCanvas({canvas:e,ratioFromParent:t,setIconOriginFunct:s,shapeConfig:o,iconStyleConfig:i},r){return new In({canvas:e,shapeConfig:o,iconConfig:{originalSize:r,styleConfig:i,ratioFromParent:t,setIconOriginFunct:s}})}paintEnvelopeIcon(e){const t={width:485.41,height:321.76},s=this.newBpmnCanvas(e,t),o=t.width,i=t.height;s.rect(0,0,o,i),s.fillAndStroke();const{iconStyleConfig:r}=e;r.isFilled&&s.setStrokeColor(r.fillColor),s.begin(),s.moveTo(0,0),s.lineTo(o*.5,i*.6),s.lineTo(o,0),s.moveTo(0,i),s.lineTo(o/3,i*.45),s.moveTo(o,i),s.lineTo(o*2/3,i*.45),s.stroke()}paintCircleIcon(e){const t={width:e.shapeConfig.width,height:e.shapeConfig.height},s=this.newBpmnCanvas(e,t),o=t.width,i=t.height;o>0&&i>0&&s.ellipse(0,0,o,i),e.iconStyleConfig.isFilled?s.fillAndStroke():s.stroke()}paintClockIcon(e){const t=this.newBpmnCanvas(e,{height:152,width:152});t.begin(),t.moveTo(184,60),t.curveTo(188.4,60,192,56.4,192,52),t.lineTo(192,48),t.curveTo(192,40,188.4,40,184,40),t.curveTo(179.6,40,176,43.6,176,48),t.lineTo(176,52),t.curveTo(176,56.4,179.6,60,184,60),t.close(),t.moveTo(184,308),t.curveTo(179.6,308,176,311.6,176,316),t.lineTo(176,320),t.curveTo(176,324.4,179.6,328,184,328),t.curveTo(188.4,328,192,324.4,192,320),t.lineTo(192,316),t.curveTo(192,311.6,188.4,308,184,308),t.close(),t.moveTo(52,176),t.lineTo(48,176),t.curveTo(43.6,176,40,179.6,40,184),t.curveTo(40,188.4,43.6,192,48,192),t.lineTo(52,192),t.curveTo(56.4,192,69,188.4,60,184),t.curveTo(60,179.6,56.4,176,52,176),t.close(),t.moveTo(320,176),t.lineTo(316,176),t.curveTo(311.6,176,308,179.6,308,184),t.curveTo(308,188.4,311.6,192,316,192),t.lineTo(320,192),t.curveTo(324.4,192,328,188.4,328,184),t.curveTo(328,179.6,324.4,176,320,176),t.moveTo(93.6,82.4),t.curveTo(90.4,79.2,85.6,79.2,82.4,82.4),t.curveTo(79.2,85.6,79.2,90.4,82.4,93.6),t.lineTo(85.2,96.4),t.curveTo(86.8,98,88.8,98.8,90.8,98.8),t.curveTo(92.8,98.8,94.4,98,96.4,96.4),t.curveTo(99.6,93.2,99.6,88.4,96.4,85.2),t.lineTo(93.6,82.4),t.moveTo(85.2,271.6),t.lineTo(82.4,274.4),t.curveTo(79.2,277.6,79.2,282.4,82.4,285.6),t.curveTo(84,287.2,86,288,88,288),t.curveTo(90,288,92,287.2,93.6,285.6),t.lineTo(96.4,282.8),t.curveTo(99.6,279.6,99.6,274.8,96.4,271.6),t.curveTo(93.2,268.4,88.4,268.4,85.2,271.6),t.moveTo(274.4,82.4),t.lineTo(271.6,85.2),t.curveTo(268.4,88.4,268.4,93.2,271.6,96.4),t.curveTo(273.298,98,275.2,98.8,277.2,98.8),t.curveTo(279.2,98.8,281.2,98,282.8,96.4),t.lineTo(285.6,93.6),t.curveTo(288.8,90.4,288.8,85.6,285.6,82.4),t.curveTo(282.4,79.2,277.6,79.2,274.4,82.4),t.moveTo(192,180.8),t.lineTo(192,108),t.curveTo(192,103.6,188.4,100,184,100),t.curveTo(179.6,100,176,103.6,176,108),t.lineTo(176,184),t.curveTo(176,186,176.8,188,178.4,189.6),t.lineTo(266,277.2),t.curveTo(267.6,278.8,269.6,279.6,271.6,279.6),t.curveTo(273.6,279.6,275.6,278.8,277.2,277.2),t.curveTo(280.4,274,280.4,269.2,277.2,266),t.lineTo(192,180.8),t.moveTo(184,0),t.curveTo(82.4,0,0,82.4,0,184),t.curveTo(0,285.6,82.4,368,184,368),t.curveTo(285.6,368,368,285.6,368,184),t.curveTo(368,82.4,285.6,0,184,0),t.moveTo(184,352),t.curveTo(91.2,352,16,276.8,16,184),t.curveTo(16,91.2,91.2,16,184,16),t.curveTo(276.8,16,352,91.2,352,184),t.curveTo(352,276.8,276.8,352,184,352),t.fillAndStroke()}paintTriangleIcon(e){const t=this.newBpmnCanvas(e,{height:735,width:849});t.begin(),t.moveTo(497,55),t.lineTo(817,609),t.curveTo(849,665,808,735,744,735),t.lineTo(105,735),t.curveTo(40,735,0,665,32,609),t.lineTo(352,55),t.curveTo(384,0,465,0,497,55),t.close(),t.fillAndStroke()}paintUpArrowheadIcon(e){const t=this.newBpmnCanvas(e,{height:50,width:40});t.begin(),t.moveTo(0,49.5),t.lineTo(19.5,1),t.curveTo(19.75,.25,20,0,20.25,.25),t.lineTo(40,49.5),t.curveTo(40,49.5,39.75,50,39.6,49.75),t.lineTo(20,30),t.lineTo(.4,49.75),t.curveTo(.4,49.75,.25,50,0,49.5),t.close(),t.fillAndStroke()}paintDoubleLeftArrowheadsIcon(e){const t=this.newBpmnCanvas(e,{height:53.5,width:105});t.begin(),t.moveTo(91.4,0),t.curveTo(91.4,0,91.2,0,91,.2),t.lineTo(50,25),t.curveTo(47.9,25.8,46.7,26.6,46.4,27.3),t.lineTo(46.4,0),t.curveTo(46.4,0,46.2,0,46,.2),t.lineTo(4.9,25),t.curveTo(2,26.2,0,27.3,4.9,28.5),t.lineTo(45.8,53),t.curveTo(46,53.3,46.2,53.5,46.4,53.5),t.lineTo(46.4,27),t.curveTo(46.6,27.3,47.8,28.1,49.9,29.9),t.lineTo(90.8,53.3),t.curveTo(91,53.3,91.2,53.5,91.4,53.5),t.lineTo(91.4,0),t.close(),t.fillAndStroke()}drawCrossIcon(e){const t=this.newBpmnCanvas(e,{height:1,width:1});return t.begin(),t.moveTo(.38,0),t.lineTo(.62,0),t.lineTo(.62,.38),t.lineTo(1,.38),t.lineTo(1,.62),t.lineTo(.62,.62),t.lineTo(.62,1),t.lineTo(.38,1),t.lineTo(.38,.62),t.lineTo(0,.62),t.lineTo(0,.38),t.lineTo(.38,.38),t.close(),t}paintListIcon(e){const t=this.newBpmnCanvas(e,{height:60,width:60});t.begin(),t.moveTo(0,0),t.lineTo(60,0),t.lineTo(60,60),t.lineTo(0,60),t.lineTo(0,0),t.close(),t.moveTo(5,5),t.lineTo(55,5),t.close(),t.moveTo(5,21.6),t.lineTo(55,21.6),t.close(),t.moveTo(5,38.3),t.lineTo(55,38.3),t.close(),t.moveTo(5,55),t.lineTo(55,55),t.close(),t.fillAndStroke()}paintXCrossIcon(e){const t=this.drawCrossIcon(e);t.rotateOnIconCenter(45),t.fillAndStroke()}paintPlusCrossIcon(e){this.drawCrossIcon(e).fillAndStroke()}paintAsteriskIcon(e){const t=this.newBpmnCanvas(e,{height:1,width:1});Se(t),t.fillAndStroke(),Se(t),t.rotateOnIconCenter(60),t.fillAndStroke(),Se(t),t.rotateOnIconCenter(240),t.fillAndStroke()}paintPersonIcon(e){const t=this.newBpmnCanvas({...e,iconStyleConfig:{...e.iconStyleConfig,isFilled:!0}},{height:239.68,width:143.61});t.begin(),t.moveTo(124.31,150.29),t.lineTo(99.66,141.03),t.arcTo(6.43,6.43,0,0,1,95.51,135.03),t.lineTo(95.51,130.66),t.arcTo(47.75,47.75,0,0,0,119.51,89.25),t.lineTo(119.51,71.25),t.arcTo(47.62,47.62,0,0,0,101.18,33.64),t.arcTo(29.35,29.35,0,0,0,101.52,29.14),t.arcTo(29.68,29.68,0,0,0,42.17,29.14),t.arcTo(29.24,29.24,0,0,0,42.53,33.63),t.arcTo(47.65,47.65,0,0,0,24.14,71.23),t.lineTo(24.14,89.23),t.arcTo(47.7,47.7,0,0,0,48.19,130.63),t.lineTo(48.19,135.03),t.arcTo(6.43,6.43,0,0,1,44.03,141.03),t.lineTo(19.31,150.29),t.arcTo(29.81,29.81,0,0,0,.09,178.03),t.lineTo(.09,233.51),t.arcTo(5.63,5.63,0,1,0,11.34,233.51),t.lineTo(11.34,178.03),t.arcTo(18.19,18.19,0,0,1,11.57,175.17),t.lineTo(20.5,184.11),t.arcTo(12.32,12.32,0,0,1,24.14,192.89),t.lineTo(24.14,233.51),t.arcTo(5.63,5.63,0,1,0,35.39,233.51),t.lineTo(35.39,192.93),t.arcTo(23.5,23.5,0,0,0,28.46,176.2),t.lineTo(17.04,164.78),t.arcTo(18.34,18.34,0,0,1,23.29,160.78),t.lineTo(43.65,153.15),t.lineTo(66.22,175.72),t.lineTo(66.22,233.51),t.arcTo(5.63,5.63,0,1,0,77.47,233.51),t.lineTo(77.47,175.76),t.lineTo(100.04,153.19),t.lineTo(120.4,160.82),t.arcTo(18.39,18.39,0,0,1,126.65,164.82),t.lineTo(115.24,176.24),t.arcTo(23.5,23.5,0,0,0,108.31,192.93),t.lineTo(108.31,233.55),t.arcTo(5.63,5.63,0,1,0,119.56,233.55),t.lineTo(119.56,192.93),t.arcTo(12.35,12.35,0,0,1,123.19,184.15),t.lineTo(132.13,175.22),t.arcTo(18,18,0,0,1,132.36,178.08),t.lineTo(132.36,233.56),t.arcTo(5.63,5.63,0,0,0,143.61,233.56),t.lineTo(143.61,178.03),t.arcTo(29.81,29.81,0,0,0,124.31,150.29),t.close(),t.moveTo(71.85,10.72),t.arcTo(18.46,18.46,0,0,1,90.17,27.18),t.arcTo(47.68,47.68,0,0,0,53.53,27.18),t.arcTo(18.44,18.44,0,0,1,71.85,10.72),t.close(),t.moveTo(35.39,71.23),t.arcTo(36.46,36.46,0,0,1,108.31,71.23),t.lineTo(108.31,77.4),t.curveTo(82.12,75.4,56.97,60.55,56.71,60.4),t.arcTo(5.62,5.62,0,0,0,48.78,62.71),t.curveTo(46.24,67.79,40.45,71.89,35.39,74.62),t.close(),t.moveTo(35.39,89.23),t.lineTo(35.39,87.08),t.curveTo(40.55,84.85,49.73,80.08,55.67,72.66),t.curveTo(64.83,77.46,85.92,87.21,108.31,88.66),t.lineTo(108.31,89.24),t.arcTo(36.46,36.46,0,1,1,35.39,89.24),t.close(),t.moveTo(71.85,165.45),t.lineTo(54.06,147.69),t.arcTo(17.7,17.7,0,0,0,59.43,135.32),t.arcTo(47.57,47.57,0,0,0,84.27,135.32),t.arcTo(17.7,17.7,0,0,0,89.64,147.69),t.close(),t.fill()}paintGearIcon(e){const t=this.newBpmnCanvas(e,{height:100,width:100});mn(t),t.translateIconOrigin(14,14),An(t)}paintExpandIcon(e){const t={width:16,height:16},s=this.newBpmnCanvas(e,t),o=t.width,i=t.height;s.roundrect(0,0,o,i,2,2),s.stroke(),s.begin(),s.moveTo(o/2,i/4),s.lineTo(o/2,i*3/4),s.close(),s.moveTo(o/4,i/2),s.lineTo(o*3/4,i/2),s.close(),s.fillAndStroke()}paintLoopIcon(e){const{iconStyleConfig:t}=e;t.fillColor=t.strokeColor;const s=this.newBpmnCanvas(e,{width:22.49,height:21.62});s.begin(),s.moveTo(5.5,19.08),s.arcTo(8,8,0,1,1,10.5,21.08),s.stroke(),s.begin(),s.moveTo(7.5,14.08),s.lineTo(5.75,19.08),s.lineTo(0,17.08),s.close(),s.fillAndStroke()}paintSequentialMultiInstanceIcon(e){const t={width:16,height:16},s=this.newBpmnCanvas(e,t),{canvas:o,iconStyleConfig:i}=e;o.setFillColor(i.strokeColor);const r=t.width,l=t.height/5;s.rect(0,0,r,l),s.fill(),s.rect(0,2*l,r,l),s.fill(),s.rect(0,4*l,r,l),s.fill()}paintParallelMultiInstanceIcon(e){const t={width:16,height:16},s=this.newBpmnCanvas(e,t),{canvas:o,iconStyleConfig:i}=e;o.setFillColor(i.strokeColor);const r=t.width/5,l=t.height;s.begin(),s.rect(0,0,r,l),s.fill(),s.rect(2*r,0,r,l),s.fill(),s.rect(4*r,0,r,l),s.fill()}paintRightArrowIcon(e){const t=this.newBpmnCanvas(e,{width:512,height:415.23});t.setRoundLineJoin(),t.begin(),t.moveTo(512,207.61),t.lineTo(304.38,0),t.lineTo(304.38,135.39),t.lineTo(0,135.39),t.lineTo(0,279.84),t.lineTo(304.38,279.84),t.lineTo(304.38,415.23),t.lineTo(512,207.61),t.close(),t.fillAndStroke()}paintErrorIcon(e){const t=this.newBpmnCanvas(e,{width:72.44,height:71.82});t.begin(),t.moveTo(0,53.32),t.lineTo(19.48,0),t.lineTo(19.48,0),t.lineTo(50.85,40.07),t.lineTo(72.44,18.21),t.lineTo(53.12,71.82),t.lineTo(22.5,31.37),t.close(),t.fillAndStroke()}paintHandIcon(e){const t=this.newBpmnCanvas(e,{width:343.65,height:354.12});t.begin(),t.moveTo(231.66,336.39),t.curveTo(240.84,316.9,220.53,306.92,220.53,306.92),t.curveTo(215.2,303.67,188.58,287.43,140.67,258.19),t.lineTo(146.33,248.39),t.curveTo(223.98,269.38,267.12,281.04,275.75,283.38),t.curveTo(275.75,283.38,297.25,288,301.42,267.77),t.curveTo(306.34,245.29,288.32,238.63,288.32,238.63),t.curveTo(279.91,236.44,237.86,225.48,162.18,205.75),t.lineTo(165.2,194.8),t.curveTo(255.88,204.4,306.27,209.73,316.34,210.8),t.curveTo(316.34,210.8,339.89,212.16,341.76,189.55),t.curveTo(343.65,166.93,320.5,164.13,320.5,164.13),t.curveTo(310.43,163.1,260.04,157.99,169.35,148.77),t.lineTo(169.35,138.97),t.curveTo(253.41,132.12,300.11,128.32,309.45,127.56),t.curveTo(309.45,127.56,332.27,122.38,332.27,102.61),t.curveTo(332.27,82.85,305.48,81.87,305.48,81.87),t.curveTo(293.99,82.2,236.54,83.88,133.13,86.9),t.lineTo(127.61,81.87),t.curveTo(145.3,59.39,155.12,46.9,157.09,44.41),t.curveTo(157.09,44.41,171.12,26.8,156.78,12.72),t.curveTo(143.83,0,124.08,14.49,124.08,14.49),t.curveTo(116.45,19.41,78.35,44.06,9.77,88.43),t.lineTo(0,251.94),t.curveTo(122.84,308.79,191.09,340.37,204.74,346.69),t.curveTo(204.74,346.69,222.91,354.12,231.66,336.39),t.fillAndStroke()}paintScriptIcon(e){e.iconStyleConfig.fillColor=e.iconStyleConfig.strokeColor;const t=this.newBpmnCanvas(e,{width:458.75,height:461.64});t.begin(),t.moveTo(67.85,.57),t.curveTo(50.73,0,33.26,8.86,22.35,18.84),t.curveTo(8.11,32.15,0,50.77,0,70.26),t.curveTo(0,73.15,0,87.59,0,113.6),t.curveTo(55.4,113.6,86.18,113.6,92.33,113.6),t.curveTo(94.92,150.46,85.64,180.4,74.22,211.27),t.curveTo(40.16,298.07,30.77,339.83,55.56,410.87),t.curveTo(63.72,438.26,87.59,457.85,114.91,461.09),t.curveTo(216.96,460.85,294.9,461.64,388.41,461.2),t.curveTo(407.2,461.09,425.14,453.55,438.3,440.13),t.curveTo(451.46,426.71,458.75,403.06,458.46,384.26),t.curveTo(458.43,382.23,458.18,365.93,458.15,363.89),t.curveTo(432.12,364.24,406.09,364.04,380.06,364.04),t.curveTo(377.61,347.52,377.24,337.58,378.28,324.48),t.curveTo(380.5,296.47,389.08,273.36,398.59,247.1),t.curveTo(408.11,220.83,418.41,191.47,420.86,154.24),t.curveTo(422.11,135.34,421.4,110.24,417.77,86.75),t.curveTo(417.76,86.71,417.73,86.54,417.69,86.22),t.curveTo(417.64,85.95,417.61,85.79,417.6,85.76),t.curveTo(414.03,68.13,410.49,48.84,399.79,31.47),t.curveTo(389.09,14.11,366.95,.59,341.75,.59),t.curveTo(286.97,.59,122.63,.57,67.85,.57),t.close(),t.moveTo(85.04,72.68),t.curveTo(80.63,72.68,45.33,72.68,40.92,72.68),t.curveTo(40.46,58.4,47.15,51.87,50.27,48.75),t.curveTo(55.8,44.28,59.84,41,73.82,41),t.curveTo(78.45,52.13,82.23,62.71,85.04,72.68),t.close(),t.moveTo(364.94,52.9),t.curveTo(370,61.11,373.9,76.44,377.38,93.51),t.curveTo(380.35,113.1,381.01,136.42,380.02,151.57),t.curveTo(377.97,182.76,369.51,207.12,360.1,233.1),t.curveTo(350.69,259.09,340.27,286.77,337.53,321.27),t.curveTo(336.38,335.86,336.72,346.69,338.87,364.01),t.curveTo(326.35,364.01,263.75,364.01,151.06,364.01),t.curveTo(151.06,382.2,151.06,392.31,151.06,394.33),t.curveTo(147.77,404.8,138.9,418.2,127.43,419.94),t.curveTo(111.49,422.35,97.86,411.8,94.75,399.19),t.curveTo(65.14,321.99,94.93,275.54,112.57,225.47),t.curveTo(130.14,177.95,137.92,117.41,112.71,42.09),t.curveTo(192.88,41.9,274.33,42.21,342.89,41.98),t.curveTo(357.15,42.03,359.83,44.61,364.94,52.9),t.close(),t.moveTo(409.96,399.48),t.curveTo(409.96,408.42,398.54,425.67,392.02,425.67),t.curveTo(325.19,425.79,252.29,425.67,185.23,425.67),t.curveTo(189.88,424.43,194.66,405.64,194.66,399.48),t.curveTo(237.72,399.48,388.43,399.48,409.96,399.48),t.close(),t.fill(),t.begin(),t.moveTo(182.1,131.2),t.lineTo(182.1,151.68),t.lineTo(321.89,151.68),t.lineTo(321.89,131.2),t.lineTo(182.1,131.2),t.close(),t.moveTo(162.25,251.09),t.lineTo(162.25,271.49),t.lineTo(301.96,271.49),t.lineTo(301.96,251.09),t.lineTo(162.25,251.09),t.close(),t.fill()}paintTableIcon(e){const t=this.newBpmnCanvas(e,{width:640,height:640});t.begin(),t.moveTo(.19,.1),t.lineTo(298.78,.1),t.lineTo(298.78,198.88),t.lineTo(.19,198.88),t.lineTo(.19,.1),t.close(),t.fillAndStroke(),t.begin(),t.moveTo(0,0),t.lineTo(298.78,0),t.lineTo(298.78,48.88),t.lineTo(0,48.88),t.lineTo(0,0),t.close(),t.fillAndStroke(),t.begin(),t.moveTo(0,48.88),t.lineTo(98.78,48.88),t.lineTo(98.78,198.88),t.lineTo(0,198.88),t.lineTo(0,48.88),t.close(),t.fillAndStroke(),t.begin(),t.moveTo(1.09,122.69),t.lineTo(298.78,122.69),t.close(),t.fillAndStroke(),t.setFillColor(e.iconStyleConfig.strokeColor),t.begin(),t.moveTo(0,0),t.lineTo(298.78,0),t.lineTo(298.78,48.88),t.lineTo(0,48.88),t.lineTo(0,0),t.close(),t.fillAndStroke()}paintPentagon(e){const t=this.newBpmnCanvas(e,{width:16,height:16});t.begin(),t.moveTo(16,6.5),t.lineTo(8,0),t.lineTo(0,6.5),t.lineTo(3,16),t.lineTo(13,16),t.lineTo(16,6.5),t.lineTo(8,0),t.stroke()}}function Se(n){n.begin(),n.moveTo(.38,0),n.lineTo(.62,0),n.lineTo(.62,1),n.lineTo(.38,1),n.close()}function mn(n){n.begin(),n.moveTo(2.06,24.62),n.lineTo(10.17,30.95),n.lineTo(9.29,37.73),n.lineTo(0,41.42),n.lineTo(2.95,54.24),n.lineTo(13.41,52.92),n.lineTo(17.39,58.52),n.lineTo(13.56,67.66),n.lineTo(24.47,74.44),n.lineTo(30.81,66.33),n.lineTo(37.88,67.21),n.lineTo(41.57,76.5),n.lineTo(54.24,73.55),n.lineTo(53.06,62.94),n.lineTo(58.52,58.52),n.lineTo(67.21,63.09),n.lineTo(74.58,51.88),n.lineTo(66.03,45.25),n.lineTo(66.92,38.62),n.lineTo(76.5,34.93),n.lineTo(73.7,22.26),n.lineTo(62.64,23.44),n.lineTo(58.81,18.42),n.lineTo(62.79,8.7),n.lineTo(51.74,2.21),n.lineTo(44.81,10.47),n.lineTo(38.03,9.43),n.lineTo(33.75,0),n.lineTo(21.52,3.24),n.lineTo(22.7,13.56),n.lineTo(18.13,17.54),n.lineTo(8.7,13.56),n.close(),_e(n,24.8,39)}function An(n){n.begin(),n.moveTo(16.46,41.42),n.lineTo(24.57,47.75),n.lineTo(23.69,54.53),n.lineTo(14.4,58.22),n.lineTo(17.35,71.04),n.lineTo(27.81,69.72),n.lineTo(31.79,75.32),n.lineTo(27.96,84.46),n.lineTo(38.87,91.24),n.lineTo(45.21,83.13),n.lineTo(52.28,84.01),n.lineTo(55.97,93.3),n.lineTo(68.64,90.35),n.lineTo(67.46,79.74),n.lineTo(72.92,75.32),n.lineTo(81.61,79.89),n.lineTo(88.98,68.68),n.lineTo(80.43,62.05),n.lineTo(81.32,55.42),n.lineTo(90.9,51.73),n.lineTo(88.1,39.06),n.lineTo(77.04,40.24),n.lineTo(73.21,35.22),n.lineTo(77.19,25.5),n.lineTo(66.14,19.01),n.lineTo(59.21,27.27),n.lineTo(52.43,26.23),n.lineTo(48.15,16.8),n.lineTo(35.92,20.04),n.lineTo(37.1,30.36),n.lineTo(32.53,34.34),n.lineTo(23.1,30.36),n.close();const e=39.2,t=55.8;_e(n,e,t),n.begin(),_e(n,e,t)}function _e(n,e,t){n.moveTo(e,t),n.arcTo(13.5,13.5,0,1,1,e+2*13.5,t),n.arcTo(13.5,13.5,0,0,1,e,t),n.close(),n.fillAndStroke()}class pt{static get(){return this.instance}static set(e){this.instance=e}}f(pt,"instance",new Cn);class vn extends O.mxGraph{constructor(e){super(e),this.container&&(this.container.style.cursor="default")}createGraphView(){return new On(this)}createCellRenderer(){return new En(pt.get())}batchUpdate(e){this.model.beginUpdate();try{e()}finally{this.model.endUpdate()}}}class On extends O.mxGraphView{getFloatingTerminalPoint(e,t,s,o){if(e.absolutePoints.filter(Boolean).length<2)return super.getFloatingTerminalPoint(e,t,s,o);const l=e.absolutePoints;return o?l[1]:l.at(-2)}}const Ln=[y.LOOP,y.MULTI_INSTANCE_PARALLEL,y.MULTI_INSTANCE_SEQUENTIAL,y.COMPENSATION,y.EXPAND,y.ADHOC];function Nn(n){const e=Ln.filter(t=>n.includes(t));for(const t of n.filter(s=>!e.includes(s)))e.push(t);return e}function _n(n,e){return n===1?t=>t.setIconOriginForIconBottomCentered():t=>{t.setIconOriginForIconBottomCentered();const s=Math.pow(-1,e)*(T.SHAPE_ACTIVITY_MARKER_ICON_SIZE+T.SHAPE_ACTIVITY_MARKER_ICON_MARGIN)/2;t.translateIconOrigin(s,0)}}class Be extends Pe{constructor(){super(void 0,void 0,void 0);f(this,"iconPainter");f(this,"markerPainterFunctions",new Map([[y.EXPAND,t=>this.iconPainter.paintExpandIcon(t)],[y.LOOP,t=>this.iconPainter.paintLoopIcon(t)],[y.MULTI_INSTANCE_PARALLEL,t=>this.iconPainter.paintParallelMultiInstanceIcon(t)],[y.MULTI_INSTANCE_SEQUENTIAL,t=>this.iconPainter.paintSequentialMultiInstanceIcon(t)]]))}paintForeground(t,s,o,i,r){super.paintForeground(t,s,o,i,r),this.paintMarkerIcons(j({canvas:t,x:s,y:o,width:i,height:r,shape:this,ratioFromParent:0,iconStrokeWidth:1.5}))}paintMarkerIcons(t){var o;const s=A.getValue(this.style,S.MARKERS,void 0);if(s){const i=Nn(s.split(","));for(const[r,l]of i.entries())t={...t,setIconOriginFunct:_n(i.length,r+1)},t.canvas.save(),(o=this.markerPainterFunctions.get(l))==null||o(t),t.canvas.restore()}}paintEnvelopeIcon(t,s){this.iconPainter.paintEnvelopeIcon({...t,setIconOriginFunct:o=>o.setIconOriginToShapeTopLeft(),ratioFromParent:.2,iconStyleConfig:{...t.iconStyleConfig,isFilled:s}})}}class W extends Be{paintForeground(e,t,s,o,i){super.paintForeground(e,t,s,o,i),this.paintTaskIcon(j({canvas:e,x:t,y:s,width:o,height:i,shape:this}))}}class yn extends W{paintTaskIcon(e){}}class wn extends W{paintTaskIcon(e){this.iconPainter.paintGearIcon({...e,setIconOriginFunct:t=>t.setIconOriginToShapeTopLeftProportionally(20)})}}class Rn extends W{paintTaskIcon(e){this.iconPainter.paintPersonIcon({...e,setIconOriginFunct:t=>t.setIconOriginToShapeTopLeftProportionally(20)})}}class bn extends W{paintTaskIcon(e){if(!gt(this.style)){this.paintEnvelopeIcon(e,!1);return}const t=4,s=4,o={...e.shapeConfig,width:20,height:20};this.iconPainter.paintCircleIcon({canvas:e.canvas,shapeConfig:o,iconStyleConfig:{...e.iconStyleConfig,isFilled:!1},ratioFromParent:void 0,setIconOriginFunct:i=>i.setIconOriginToShapeTopLeft(s,t)}),o.x+=t,o.y+=s,this.iconPainter.paintEnvelopeIcon({...e,shapeConfig:o,ratioFromParent:.65,setIconOriginFunct:i=>i.setIconOriginForIconCentered()})}}class Fn extends W{paintTaskIcon(e){this.paintEnvelopeIcon(e,!0)}}class Pn extends W{paintTaskIcon(e){this.iconPainter.paintHandIcon({...e,ratioFromParent:.18,setIconOriginFunct:t=>t.setIconOriginToShapeTopLeftProportionally(20)})}}class kn extends W{paintTaskIcon(e){this.iconPainter.paintScriptIcon({...e,ratioFromParent:.22,setIconOriginFunct:t=>t.setIconOriginToShapeTopLeftProportionally(20)})}}class Mn extends Be{paintForeground(e,t,s,o,i){super.paintForeground(e,t,s,o,i);const r=j({canvas:e,x:t,y:s,width:o,height:i,shape:this});switch(A.getValue(this.style,S.GLOBAL_TASK_KIND,void 0)){case h.GLOBAL_TASK_MANUAL:{this.iconPainter.paintHandIcon({...r,ratioFromParent:.18,setIconOriginFunct:l=>l.setIconOriginToShapeTopLeftProportionally(20)});break}case h.GLOBAL_TASK_SCRIPT:{this.iconPainter.paintScriptIcon({...r,ratioFromParent:.22,setIconOriginFunct:l=>l.setIconOriginToShapeTopLeftProportionally(20)});break}case h.GLOBAL_TASK_USER:{this.iconPainter.paintPersonIcon({...r,setIconOriginFunct:l=>l.setIconOriginToShapeTopLeftProportionally(20)});break}case h.GLOBAL_TASK_BUSINESS_RULE:{this.iconPainter.paintTableIcon({...r,ratioFromParent:.6,setIconOriginFunct:l=>l.setIconOriginToShapeTopLeftProportionally(15)});break}}}}class Bn extends Be{paintBackground(e,t,s,o,i){const r=A.getValue(this.style,S.SUB_PROCESS_KIND,void 0);if(e.save(),r===Y.EVENT&&(e.setDashed(!0,!1),e.setDashPattern("1 2")),super.paintBackground(e,t,s,o,i),r===Y.TRANSACTION){const l=T.SUB_PROCESS_TRANSACTION_INNER_RECT_OFFSET,a=T.SUB_PROCESS_TRANSACTION_INNER_RECT_ARC_SIZE;e.roundrect(t+l,s+l,o-2*l,i-2*l,a,a),e.stroke()}e.restore()}}class xn extends W{paintTaskIcon(e){this.iconPainter.paintTableIcon({...e,ratioFromParent:.6,setIconOriginFunct:t=>t.setIconOriginToShapeTopLeftProportionally(15)})}}class Yn extends O.mxConnector{paintEdgeShape(e,t){const s=this.createMarker(e,t,!0),o=this.createMarker(e,t,!1);this.paintEdgeLine(e,t),e.setShadow(!1),e.setDashed(!1,!1),s!=null&&(e.setFillColor(A.getValue(this.style,S.EDGE_START_FILL_COLOR,this.stroke)),s()),o!=null&&(e.setFillColor(A.getValue(this.style,S.EDGE_END_FILL_COLOR,this.stroke)),o())}paintEdgeLine(e,t){const s=Vn(e);je(e,"stroke"),this.paintLine(e,t,this.isRounded),je(e,s)}}function Vn(n){return n instanceof ke?n.pointerEventsValue:null}function je(n,e){n instanceof ke&&(n.pointerEventsValue=e)}class xe extends O.mxEllipse{constructor(){super(void 0,void 0,void 0);f(this,"iconPainter");f(this,"iconPainters",new Map([[w.MESSAGE,t=>this.iconPainter.paintEnvelopeIcon({...t,ratioFromParent:.5})],[w.TERMINATE,t=>this.iconPainter.paintCircleIcon({...t,ratioFromParent:.6})],[w.TIMER,t=>this.iconPainter.paintClockIcon({...t,setIconOriginFunct:s=>s.setIconOriginToShapeTopLeftProportionally(5)})],[w.SIGNAL,t=>this.iconPainter.paintTriangleIcon({...t,ratioFromParent:.55,iconStyleConfig:{...t.iconStyleConfig,strokeWidth:T.STROKE_WIDTH_THIN.valueOf()},setIconOriginFunct:s=>s.setIconOriginToShapeTopLeftProportionally(4)})],[w.LINK,t=>this.iconPainter.paintRightArrowIcon({...t,ratioFromParent:.55,iconStyleConfig:{...t.iconStyleConfig,strokeWidth:1.5}})],[w.ERROR,t=>this.iconPainter.paintErrorIcon({...t,ratioFromParent:.55,iconStyleConfig:{...t.iconStyleConfig,strokeWidth:1.5}})],[w.COMPENSATION,t=>this.iconPainter.paintDoubleLeftArrowheadsIcon({...t,ratioFromParent:.7,iconStyleConfig:{...t.iconStyleConfig,strokeWidth:1.5}})],[w.CANCEL,t=>this.iconPainter.paintXCrossIcon({...t,ratioFromParent:.78})],[w.ESCALATION,t=>this.iconPainter.paintUpArrowheadIcon({...t,ratioFromParent:.55,iconStyleConfig:{...t.iconStyleConfig,strokeWidth:T.STROKE_WIDTH_THIN.valueOf()}})],[w.CONDITIONAL,t=>this.iconPainter.paintListIcon({...t,ratioFromParent:.6,iconStyleConfig:{...t.iconStyleConfig,strokeWidth:1.5}})]]));f(this,"withFilledIcon",!1)}paintVertexShape(t,s,o,i,r){const l=j({canvas:t,x:s,y:o,width:i,height:r,shape:this,isFilled:this.withFilledIcon});Gn(l,A.getValue(this.style,S.IS_INTERRUPTING,void 0)),this.paintOuterShape(l),Dn(l),this.paintInnerShape(l)}paintOuterShape({canvas:t,shapeConfig:{x:s,y:o,width:i,height:r}}){super.paintVertexShape(t,s,o,i,r)}paintInnerShape(t){const s=this.iconPainters.get(A.getValue(this.style,S.EVENT_DEFINITION_KIND,w.NONE));s==null||s(t)}}function Gn(n,e){n.canvas.save(),e==="false"&&(n.canvas.setDashed(!0,!1),n.canvas.setDashPattern("3 2"))}function Dn(n){n.canvas.restore()}class Un extends xe{constructor(){super(),this.withFilledIcon=!0}}class ye extends xe{paintOuterShape({canvas:e,shapeConfig:{x:t,y:s,width:o,height:i,strokeWidth:r}}){e.ellipse(t,s,o,i),e.fillAndStroke();const l=r*1.5;e.ellipse(o*.02+l+t,i*.02+l+s,o*.96-2*l,i*.96-2*l),e.stroke()}}class Wn extends ye{constructor(){super(),this.withFilledIcon=!0}}class Hn extends Pe{constructor(){super(...arguments);f(this,"iconPainter")}paintVertexShape(t,s,o,i,r){const l=j({canvas:t,x:s,y:o,width:i,height:r,shape:this,ratioFromParent:1,isFilled:A.getValue(this.style,S.IS_INITIATING,"true")=="false"});this.iconPainter.paintEnvelopeIcon(l)}}class re extends O.mxRhombus{constructor(){super(...arguments);f(this,"iconPainter")}paintVertexShape(t,s,o,i,r){const l=j({canvas:t,x:s,y:o,width:i,height:r,shape:this});this.paintOuterShape(l),this.paintInnerShape(l)}paintOuterShape({canvas:t,shapeConfig:{x:s,y:o,width:i,height:r}}){super.paintVertexShape(t,s,o,i,r)}}class Kn extends re{paintInnerShape(e){this.iconPainter.paintXCrossIcon({...e,iconStyleConfig:{...e.iconStyleConfig,isFilled:!0},ratioFromParent:.5})}}class zn extends re{paintInnerShape(e){this.iconPainter.paintPlusCrossIcon({...e,iconStyleConfig:{...e.iconStyleConfig,isFilled:!0},ratioFromParent:.5})}}class Xn extends re{paintInnerShape(e){this.iconPainter.paintCircleIcon({...e,ratioFromParent:.62,iconStyleConfig:{...e.iconStyleConfig,isFilled:!1,strokeWidth:T.STROKE_WIDTH_THICK.valueOf()}})}}class $n extends re{paintInnerShape(e){this.iconPainter.paintAsteriskIcon({...e,iconStyleConfig:{...e.iconStyleConfig,isFilled:!0},ratioFromParent:.5})}}class Zn extends re{paintInnerShape(e){e={...e,iconStyleConfig:{...e.iconStyleConfig,strokeWidth:1}},this.iconPainter.paintCircleIcon({...e,ratioFromParent:.55}),gt(this.style)||this.iconPainter.paintCircleIcon({...e,ratioFromParent:.45});const t={...e,ratioFromParent:.3};A.getValue(this.style,S.EVENT_BASED_GATEWAY_KIND,se.Exclusive)==se.Parallel?this.iconPainter.paintPlusCrossIcon(t):this.iconPainter.paintPentagon(t)}}class jn extends Pe{paintForeground(e,t,s,o,i){e.begin(),e.moveTo(t+T.TEXT_ANNOTATION_BORDER_LENGTH,s),e.lineTo(t,s),e.lineTo(t,s+i),e.lineTo(t+T.TEXT_ANNOTATION_BORDER_LENGTH,s+i),e.stroke()}paintBackground(e,t,s,o,i){e.save(),e.setStrokeColor("none"),super.paintBackground(e,t,s,o,i),e.restore()}}const qn=()=>{const n=[[h.EVENT_END,Un],[h.EVENT_START,xe],[h.EVENT_INTERMEDIATE_THROW,Wn],[h.EVENT_INTERMEDIATE_CATCH,ye],[h.EVENT_BOUNDARY,ye],[h.GATEWAY_COMPLEX,$n],[h.GATEWAY_EVENT_BASED,Zn],[h.GATEWAY_EXCLUSIVE,Kn],[h.GATEWAY_INCLUSIVE,Xn],[h.GATEWAY_PARALLEL,zn],[h.SUB_PROCESS,Bn],[h.CALL_ACTIVITY,Mn],[h.TASK,yn],[h.TASK_SERVICE,wn],[h.TASK_USER,Rn],[h.TASK_RECEIVE,bn],[h.TASK_SEND,Fn],[h.TASK_MANUAL,Pn],[h.TASK_SCRIPT,kn],[h.TASK_BUSINESS_RULE,xn],[h.TEXT_ANNOTATION,jn],[S.EDGE,Yn],[S.MESSAGE_FLOW_ICON,Hn]];for(const[e,t]of n)Kt.registerShape(e,t)},Qn=(n,e,t,s,o,i,r,l,a)=>{const d=o*(r+a+4),u=i*(r+a+4);return function(){n.begin(),n.moveTo(s.x-d/2-u/2,s.y-u/2+d/2),n.lineTo(s.x+u/2-3*d/2,s.y-3*u/2-d/2),n.stroke()}},Jn=()=>{O.mxMarker.addMarker(ft.ARROW_DASH,Qn)},Et=12;class Ye extends Map{get(e){return super.get(e)??(()=>{})}}const es=new Ye([[k.SEQUENCE_FLOW,n=>{n[c.STYLE_ENDARROW]=c.ARROW_BLOCK_THIN}],[k.MESSAGE_FLOW,n=>{n[c.STYLE_DASHED]=!0,n[c.STYLE_DASH_PATTERN]="8 5",n[c.STYLE_STARTARROW]=c.ARROW_OVAL,n[c.STYLE_STARTSIZE]=8,n[c.STYLE_STARTFILL]=!0,n[S.EDGE_START_FILL_COLOR]=T.MESSAGE_FLOW_MARKER_START_FILL_COLOR,n[c.STYLE_ENDARROW]=c.ARROW_BLOCK_THIN,n[c.STYLE_ENDFILL]=!0,n[S.EDGE_END_FILL_COLOR]=T.MESSAGE_FLOW_MARKER_END_FILL_COLOR}],[k.ASSOCIATION_FLOW,n=>{n[c.STYLE_DASHED]=!0,n[c.STYLE_DASH_PATTERN]="1 2",n[c.STYLE_STARTSIZE]=Et}]]),ts=new Ye([[x.DEFAULT,n=>{n[c.STYLE_STARTARROW]=ft.ARROW_DASH}],[x.CONDITIONAL_FROM_ACTIVITY,n=>{n[c.STYLE_STARTARROW]=c.ARROW_DIAMOND_THIN,n[c.STYLE_STARTSIZE]=18,n[c.STYLE_STARTFILL]=!0,n[S.EDGE_START_FILL_COLOR]=T.SEQUENCE_FLOW_CONDITIONAL_FROM_ACTIVITY_MARKER_FILL_COLOR}]]),ns=new Ye([[$.NONE,n=>{}],[$.ONE,n=>{n[c.STYLE_ENDARROW]=c.ARROW_OPEN_THIN}],[$.BOTH,n=>{n[c.STYLE_STARTARROW]=c.ARROW_OPEN_THIN,n[c.STYLE_ENDARROW]=c.ARROW_OPEN_THIN}]]);class St{constructor(e){this.graph=e}configureStyles(){this.configureDefaultVertexStyle(),this.configurePoolStyle(),this.configureLaneStyle(),this.configureTextAnnotationStyle(),this.configureGroupStyle(),this.configureActivityStyles(),this.configureEventStyles(),this.configureGatewayStyles(),this.configureDefaultEdgeStyle(),this.configureFlowStyles()}getStylesheet(){return this.graph.getStylesheet()}putCellStyle(e,t){this.getStylesheet().putCellStyle(e,t)}configureDefaultVertexStyle(){const e=this.getStylesheet().getDefaultVertexStyle();qe(e),e[c.STYLE_ABSOLUTE_ARCSIZE]=!0,e[c.STYLE_ARCSIZE]=T.SHAPE_ARC_SIZE}configurePoolStyle(){const e={};e[c.STYLE_SHAPE]=c.SHAPE_SWIMLANE,e[c.STYLE_VERTICAL_ALIGN]=c.ALIGN_MIDDLE,e[c.STYLE_ALIGN]=c.ALIGN_CENTER,e[c.STYLE_STARTSIZE]=T.POOL_LABEL_SIZE,e[c.STYLE_FILLCOLOR]=T.POOL_LABEL_FILL_COLOR,this.graph.getStylesheet().putCellStyle(h.POOL,e)}configureLaneStyle(){const e={};e[c.STYLE_SHAPE]=c.SHAPE_SWIMLANE,e[c.STYLE_VERTICAL_ALIGN]=c.ALIGN_MIDDLE,e[c.STYLE_ALIGN]=c.ALIGN_CENTER,e[c.STYLE_SWIMLANE_LINE]=0,e[c.STYLE_STARTSIZE]=T.LANE_LABEL_SIZE,e[c.STYLE_FILLCOLOR]=T.LANE_LABEL_FILL_COLOR,this.graph.getStylesheet().putCellStyle(h.LANE,e)}configureEventStyles(){for(const e of p.eventKinds()){const t={};t[c.STYLE_SHAPE]=e,t[c.STYLE_PERIMETER]=ze.EllipsePerimeter,t[c.STYLE_STROKEWIDTH]=e==h.EVENT_END?T.STROKE_WIDTH_THICK:T.STROKE_WIDTH_THIN,t[c.STYLE_VERTICAL_LABEL_POSITION]=c.ALIGN_BOTTOM,this.putCellStyle(e,t)}}configureTextAnnotationStyle(){const e={};e[c.STYLE_SHAPE]=h.TEXT_ANNOTATION,e[c.STYLE_VERTICAL_ALIGN]=c.ALIGN_MIDDLE,e[c.STYLE_ALIGN]=c.ALIGN_LEFT,e[c.STYLE_SPACING_LEFT]=5,e[c.STYLE_FILLCOLOR]=T.TEXT_ANNOTATION_FILL_COLOR,e[c.STYLE_STROKEWIDTH]=T.STROKE_WIDTH_THIN,this.putCellStyle(h.TEXT_ANNOTATION,e)}configureGroupStyle(){const e={};e[c.STYLE_ROUNDED]=!0,e[c.STYLE_DASHED]=!0,e[c.STYLE_DASH_PATTERN]="7 4 1 4",e[c.STYLE_STROKEWIDTH]=T.STROKE_WIDTH_THIN,e[c.STYLE_FILLCOLOR]=T.GROUP_FILL_COLOR,e[c.STYLE_ALIGN]=c.ALIGN_CENTER,e[c.STYLE_VERTICAL_ALIGN]=c.ALIGN_TOP,this.putCellStyle(h.GROUP,e)}configureActivityStyles(){for(const e of p.activityKinds()){const t={};t[c.STYLE_SHAPE]=e,t[c.STYLE_ROUNDED]=!0,t[c.STYLE_VERTICAL_ALIGN]=c.ALIGN_MIDDLE,t[c.STYLE_STROKEWIDTH]=e==h.CALL_ACTIVITY?T.STROKE_WIDTH_THICK:T.STROKE_WIDTH_THIN,this.putCellStyle(e,t)}}configureGatewayStyles(){for(const e of p.gatewayKinds()){const t={};t[c.STYLE_SHAPE]=e,t[c.STYLE_PERIMETER]=ze.RhombusPerimeter,t[c.STYLE_STROKEWIDTH]=T.STROKE_WIDTH_THIN,t[c.STYLE_VERTICAL_ALIGN]=c.ALIGN_TOP,t[c.STYLE_LABEL_POSITION]=c.ALIGN_LEFT,t[c.STYLE_VERTICAL_LABEL_POSITION]=c.ALIGN_TOP,this.putCellStyle(e,t)}}configureDefaultEdgeStyle(){const e=this.getStylesheet().getDefaultEdgeStyle();qe(e),e[c.STYLE_SHAPE]=S.EDGE,e[c.STYLE_ENDSIZE]=Et,e[c.STYLE_STROKEWIDTH]=1.5,e[c.STYLE_ROUNDED]=!0,e[c.STYLE_ARCSIZE]=5,e[c.STYLE_VERTICAL_ALIGN]=c.ALIGN_BOTTOM,delete e[c.STYLE_ENDARROW]}configureEdgeStyles(e,t){for(const s of e){const o={};t.get(s)(o),this.graph.getStylesheet().putCellStyle(s.toString(),o)}}configureFlowStyles(){this.configureEdgeStyles(Object.values(k),es),this.configureEdgeStyles(Object.values(x),ts),this.configureEdgeStyles(Object.values($),ns)}}function qe(n){n[c.STYLE_FONTFAMILY]=T.DEFAULT_FONT_FAMILY,n[c.STYLE_FONTSIZE]=T.DEFAULT_FONT_SIZE,n[c.STYLE_FONTCOLOR]=T.DEFAULT_FONT_COLOR,n[c.STYLE_FILLCOLOR]=T.DEFAULT_FILL_COLOR,n[c.STYLE_STROKECOLOR]=T.DEFAULT_STROKE_COLOR,n[c.STYLE_LABEL_BACKGROUNDCOLOR]=c.NONE,n[c.STYLE_WHITE_SPACE]="wrap"}class ss{constructor(e){f(this,"graph");this.graph=new vn(e)}configure(){return this.configureGraph(),new St(this.graph).configureStyles(),qn(),Jn(),this.graph}configureGraph(){this.graph.setCellsLocked(!0),this.graph.setCellsSelectable(!1),this.graph.setEdgeLabelsMovable(!1),this.graph.setHtmlLabels(!0),this.graph.setConstrainChildren(!1),this.graph.setExtendParents(!1),this.graph.foldingEnabled=!1}}function It(n,e,{signal:t,edges:s}={}){let o,i=null;const r=s!=null&&s.includes("leading"),l=s==null||s.includes("trailing"),a=()=>{i!==null&&(n.apply(o,i),o=void 0,i=null)},d=()=>{l&&a(),C()};let u=null;const g=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,d()},e)},I=()=>{u!==null&&(clearTimeout(u),u=null)},C=()=>{I(),o=void 0,i=null},L=()=>{I(),a()},_=function(...Q){if(t!=null&&t.aborted)return;o=this,i=Q;const J=u==null;g(),r&&J&&a()};return _.schedule=g,_.cancel=C,_.flush=L,t==null||t.addEventListener("abort",C,{once:!0}),_}function os(n,e,{signal:t,edges:s=["leading","trailing"]}={}){let o=null;const i=It(n,e,{signal:t,edges:s}),r=function(...l){o==null?o=Date.now():Date.now()-o>=e&&(o=Date.now(),i.cancel()),i(...l)};return r.cancel=i.cancel,r.flush=i.flush,r}class is{constructor(e,t){this.graph=e,this.zoomSupport=t}fit(e){this.zoomSupport.fit(e)}zoom(e){e=="in"?this.zoomSupport.zoomIn():this.zoomSupport.zoomOut()}configure(e){const t=this.graph.panningHandler;e!=null&&e.enabled?(t.addListener(V.PAN_START,Qe(this.graph,"grab")),t.addListener(V.PAN_END,Qe(this.graph,"default")),t.usePopupTrigger=!1,t.isForcePanningEvent=s=>V.isLeftMouseButton(s.getEvent())||V.isMultiTouchEvent(s.getEvent()),this.graph.setPanning(!0),this.zoomSupport.registerMouseWheelZoomListeners(e==null?void 0:e.zoom)):(this.graph.setPanning(!1),t.setPinchEnabled(!1),t.isForcePanningEvent=s=>!1)}}function Qe(n,e){return()=>{n.container.style.cursor=e}}function rs(n,e){const t=new is(n,new as(n));return t.configure(e),t}const we=1.25,ls=1/we;class as{constructor(e){f(this,"currentZoomLevel",1);this.graph=e,this.graph.zoomFactor=we}graphFit(e,t,s,o,i,r,l){const a=this.graph.fit(e,t,s,o,i,r,l);return this.setCurrentZoomLevel(a),a}setCurrentZoomLevel(e){this.currentZoomLevel=e??this.graph.view.scale}zoomActual(){this.graph.zoomActual(),this.setCurrentZoomLevel()}zoomIn(){this.graph.zoomIn(),this.setCurrentZoomLevel()}zoomOut(){this.graph.zoomOut(),this.setCurrentZoomLevel()}fit(e){this.zoomActual();const t=e==null?void 0:e.type;if(t==null||t==te.None)return;const s=Zt(e==null?void 0:e.margin);if(t==te.Center){const i=this.graph.getGraphBounds(),r=this.graph.container.clientWidth-s,l=this.graph.container.clientHeight-s,a=i.width/this.graph.view.scale,d=i.height/this.graph.view.scale,u=Math.min(3,Math.min(r/a,l/d));this.setCurrentZoomLevel(u),this.graph.view.scaleAndTranslate(u,(s+r-a*u)/(2*u)-i.x/this.graph.view.scale,(s+l-d*u)/(2*u)-i.y/this.graph.view.scale)}else{let o=!1,i=!1;switch(t){case te.Horizontal:{i=!0;break}case te.Vertical:{o=!0;break}}this.graphFit(this.graph.border,!1,s,!0,o,i)}}registerMouseWheelZoomListeners(e){e=jt(e),V.addMouseWheelListener(It(this.createMouseWheelZoomListener(!0),e.debounceDelay),this.graph.container),V.addMouseWheelListener(os(this.createMouseWheelZoomListener(!1),e.throttleDelay),this.graph.container)}createMouseWheelZoomListener(e){return(t,s)=>{if(V.isConsumed(t)||!(t instanceof MouseEvent))return;if(t.ctrlKey&&!t.altKey&&!t.shiftKey&&!t.metaKey)if(e){const[i,r]=this.getEventRelativeCoordinates(t),[l,a,d]=this.getScaleAndTranslationDeltas(i,r);this.graph.view.scaleAndTranslate(l,this.graph.view.translate.x+a,this.graph.view.translate.y+d),V.consume(t)}else this.currentZoomLevel*=s?we:ls}}getEventRelativeCoordinates(e){const t=this.graph.container.getBoundingClientRect(),s=e.clientX-t.left,o=e.clientY-t.top;return[s,o]}getScaleAndTranslationDeltas(e,t){const[s,o]=this.calculateFactorAndScale(),[i,r]=this.calculateTranslationDeltas(s,o,e*2,t*2);return[o,i,r]}calculateTranslationDeltas(e,t,s,o){if(e>1){const i=(e-1)/(t*2);s*=-i,o*=-i}else{const i=(1/e-1)/(this.graph.view.scale*2);s*=i,o*=i}return[s,o]}calculateFactorAndScale(){const e=Math.round(this.currentZoomLevel*100)/100;return[e/this.graph.view.scale,e]}}class cs{constructor(e){this.convertedElements=e}deserialize(e){const t=E(e.category).flatMap(s=>E(s.categoryValue));for(const s of t)this.convertedElements.registerCategoryValue(s.id,s.value)}}class q{}class us{constructor(e){this.options=e}warning(e){var s;if((s=this.options)!=null&&s.disableConsoleLog)return;const t=e.getMessage();console.warn(`[bv-parser] ${t.template}`,...t.arguments)}}class ds extends q{constructor(e,t){super(),this.groupBpmnElementId=e,this.categoryValueReference=t}getMessage(){return{arguments:[this.categoryValueReference,this.groupBpmnElementId],template:"Group json deserialization: unable to find category value ref %s for bpmn element %s"}}}class hs extends q{constructor(e){super(),this.bpmnElementId=e}getMessage(){return{arguments:[this.bpmnElementId],template:"Shape json deserialization: unable to find bpmn element with id %s"}}}class fs extends q{constructor(e){super(),this.bpmnElementId=e}getMessage(){return{arguments:[this.bpmnElementId],template:"Edge json deserialization: unable to find bpmn element with id %s"}}}class gs extends q{constructor(e,t){super(),this.shapeOrEdgeId=e,this.labelStyleId=t}getMessage(){return{arguments:[this.labelStyleId,this.shapeOrEdgeId],template:"Unable to assign font from style %s to shape/edge %s"}}}class Ts extends q{constructor(e,t){super(),this.laneId=e,this.flowNodeReference=t}getMessage(){return{arguments:[this.flowNodeReference,this.laneId],template:"Unable to assign lane %s as parent: flow node %s is not found"}}}class ps extends q{constructor(e,t,s){super(),this.bpmnElementId=e,this.attachedToReference=t,this.attachedToKind=s}getMessage(){return{arguments:[this.bpmnElementId,this.attachedToReference,this.attachedToKind],template:"The boundary event %s must be attached to an activity, and not to %s of kind %s"}}}class Es{constructor(){f(this,"poolsById",new Map);f(this,"poolsByProcessRef",new Map);f(this,"messageFlows",new Map);f(this,"flowNodes",new Map);f(this,"lanes",new Map);f(this,"sequenceFlows",new Map);f(this,"associationFlows",new Map);f(this,"eventDefinitionsOfDefinitions",new Map);f(this,"globalTasks",new Map);f(this,"categoryValues",new Map)}getFlows(){return[...this.messageFlows.values(),...this.sequenceFlows.values(),...this.associationFlows.values()]}findPoolById(e){return this.poolsById.get(e)}findPoolByProcessRef(e){return this.poolsByProcessRef.get(e)}registerPool(e,t){this.poolsById.set(e.id,e),t&&this.poolsByProcessRef.set(t,e)}findMessageFlow(e){return this.messageFlows.get(e)}registerMessageFlow(e){this.messageFlows.set(e.id,e)}findFlowNode(e){return this.flowNodes.get(e)}registerFlowNode(e){this.flowNodes.set(e.id,e)}findLane(e){return this.lanes.get(e)}registerLane(e){this.lanes.set(e.id,e)}findSequenceFlow(e){return this.sequenceFlows.get(e)}registerSequenceFlow(e){this.sequenceFlows.set(e.id,e)}findAssociationFlow(e){return this.associationFlows.get(e)}registerAssociationFlow(e){this.associationFlows.set(e.id,e)}findEventDefinitionOfDefinition(e){return this.eventDefinitionsOfDefinitions.get(e)}registerEventDefinitionsOfDefinition(e,t){this.eventDefinitionsOfDefinitions.set(e,t)}findGlobalTask(e){return this.globalTasks.get(e)}registerGlobalTask(e,t){this.globalTasks.set(e,t)}findCategoryValue(e){return this.categoryValues.get(e)}registerCategoryValue(e,t){this.categoryValues.set(e,{value:t})}}const Ct=(n,e,t,s)=>{const o=n.findCategoryValue(t.categoryValueRef);if(o)return new B(t.id,o.value,h.GROUP,s);e.warning(new ds(t.id,t.categoryValueRef))},mt=(n,e)=>{for(const t of E(e)){const s=t.associationDirection;n.registerAssociationFlow(new ct(t.id,void 0,t.sourceRef,t.targetRef,s))}};class Ss{constructor(e,t){this.convertedElements=e,this.parsingMessageCollector=t}deserialize(e){for(const t of E(e))this.parseCollaboration(t)}parseCollaboration(e){this.buildParticipant(e.participant),this.buildMessageFlows(e.messageFlow),mt(this.convertedElements,e.association),this.buildGroups(e.group),this.buildTextAnnotation(e.textAnnotation)}buildParticipant(e){for(const t of E(e))this.convertedElements.registerPool(new B(t.id,t.name,h.POOL),t.processRef)}buildMessageFlows(e){for(const t of E(e))this.convertedElements.registerMessageFlow(new at(t.id,t.name,t.sourceRef,t.targetRef))}buildGroups(e){for(const t of E(e)){const s=Ct(this.convertedElements,this.parsingMessageCollector,t);s&&this.convertedElements.registerFlowNode(s)}}buildTextAnnotation(e){for(const t of E(e))this.convertedElements.registerFlowNode(new B(t.id,t.text,h.TEXT_ANNOTATION))}}class Is{constructor(e,t,s,o){this.x=e,this.y=t,this.width=s,this.height=o}}class Cs{constructor(e,t,s,o,i=oe.NONE){f(this,"extensions",{});this.id=e,this.bpmnElement=t,this.waypoints=s,this.label=o,this.messageVisibleKind=i}}class ms{constructor(e,t){this.x=e,this.y=t}}class As{constructor(e,t){f(this,"extensions",{});this.font=e,this.bounds=t}}class vs{constructor(e,t,s,o,i,r){this.name=e,this.size=t,this.isBold=s,this.isItalic=o,this.isUnderline=i,this.isStrikeThrough=r}}class Os{constructor(e,t){f(this,"convertedFonts",new Map);this.convertedElements=e,this.parsingMessageCollector=t}deserialize(e){const t=[],s=[],o=[],i=[],r=E(e)[0];if(r){this.deserializeFonts(r.BPMNLabelStyle);const l=r.BPMNPlane,a=this.deserializeEdges(l.BPMNEdge),d=this.deserializeShapes(l.BPMNShape);t.push(...d.flowNodes),s.push(...d.lanes),o.push(...d.pools),i.push(...a)}return{flowNodes:t,lanes:s,pools:o,edges:i}}deserializeFonts(e){for(const t of E(e))for(const s of E(t.Font))this.convertedFonts.set(t.id,new vs(s.name,s.size,s.isBold,s.isItalic,s.isUnderline,s.isStrikeThrough))}deserializeShapes(e){const t={flowNodes:[],lanes:[],pools:[]};for(const s of E(e))this.deserializeShapeAndStoreIfFound(s,t.flowNodes,o=>this.convertedElements.findFlowNode(o))||this.deserializeShapeAndStoreIfFound(s,t.lanes,o=>this.convertedElements.findLane(o))||this.deserializeShapeAndStoreIfFound(s,t.pools,o=>this.convertedElements.findPoolById(o))||this.parsingMessageCollector.warning(new hs(s.bpmnElement));return t}deserializeShapeAndStoreIfFound(e,t,s){const o=this.deserializeShape(e,s);return o?(t.push(o),!0):!1}deserializeShape(e,t){const s=t(e.bpmnElement);if(s){const o=Je(e);(s instanceof ie||s instanceof X&&s.callActivityKind===ne.CALLING_PROCESS)&&!e.isExpanded&&s.markers.push(y.EXPAND);let i;p.isPoolOrLane(s.kind)&&(i=e.isHorizontal??!0);const r=e.BPMNLabel,l=this.deserializeLabel(r,e.id),a=new ue(e.id,s,o,l,i);return Ls(a,e),a}}deserializeEdges(e){return E(e).map(t=>{const s=this.convertedElements.findSequenceFlow(t.bpmnElement)||this.convertedElements.findMessageFlow(t.bpmnElement)||this.convertedElements.findAssociationFlow(t.bpmnElement);if(!s){this.parsingMessageCollector.warning(new fs(t.bpmnElement));return}const o=this.deserializeWaypoints(t.waypoint),i=this.deserializeLabel(t.BPMNLabel,t.id),r=t.messageVisibleKind?t.messageVisibleKind:oe.NONE,l=new Cs(t.id,s,o,i,r);return Ns(l,t),l}).filter(Boolean)}deserializeWaypoints(e){return E(e).map(t=>new ms(t.x,t.y))}deserializeLabel(e,t){if(e&&typeof e=="object"){const s=this.findFont(e.labelStyle,t),o=Je(e),i=new As(s,o);if("color"in e)return i.extensions.color=e.color,i;if(s||o)return i}}findFont(e,t){let s;return e&&(s=this.convertedFonts.get(e),s||this.parsingMessageCollector.warning(new gs(t,e))),s}}function Ls(n,e){"background-color"in e?n.extensions.fillColor=e["background-color"]:"fill"in e&&(n.extensions.fillColor=e.fill),"border-color"in e?n.extensions.strokeColor=e["border-color"]:"stroke"in e&&(n.extensions.strokeColor=e.stroke)}function Je(n){const e=n.Bounds;if(e)return new Is(e.x,e.y,e.width,e.height)}function Ns(n,e){"border-color"in e?n.extensions.strokeColor=e["border-color"]:"stroke"in e&&(n.extensions.strokeColor=e.stroke)}const _s=n=>"source"in n||"target"in n;class ys{constructor(e){this.convertedElements=e}deserialize(e){for(const t of rt){const s=e[t+"EventDefinition"];for(const o of E(s,!0))this.convertedElements.registerEventDefinitionsOfDefinition(o.id,{id:o.id,kind:t,..._s(o)?{source:o.source,target:o.target}:{}})}}}class ws{constructor(e){this.convertedElements=e}deserialize(e){this.parseGlobalTasks(e.globalTask,h.GLOBAL_TASK),this.parseGlobalTasks(e.globalBusinessRuleTask,h.GLOBAL_TASK_BUSINESS_RULE),this.parseGlobalTasks(e.globalManualTask,h.GLOBAL_TASK_MANUAL),this.parseGlobalTasks(e.globalScriptTask,h.GLOBAL_TASK_SCRIPT),this.parseGlobalTasks(e.globalUserTask,h.GLOBAL_TASK_USER)}parseGlobalTasks(e,t){for(const s of E(e))this.convertedElements.registerGlobalTask(s.id,t)}}const Rs=(n,e)=>{switch(n){case"adHocSubProcess":return Y.AD_HOC;case"transaction":return Y.TRANSACTION;default:return e.triggeredByEvent?Y.EVENT:Y.EMBEDDED}},bs=["adHocSubProcess","transaction",...p.flowNodeKinds().filter(n=>n!==h.EVENT_BOUNDARY),h.EVENT_BOUNDARY];function Fs(n){return["adHocSubProcess","transaction"].includes(n)?h.SUB_PROCESS:n}class Ps{constructor(e,t){f(this,"defaultSequenceFlowIds",[]);f(this,"elementsWithoutParentByProcessId",new Map);f(this,"callActivitiesCallingProcess",new Map);f(this,"eventsByLinkEventDefinition",new Map);this.convertedElements=e,this.parsingMessageCollector=t}deserialize(e){for(const t of E(e))this.parseProcess(t);for(const t of E(e))this.assignParentOfProcessElementsCalledByCallActivity(t.id);this.assignIncomingAndOutgoingIdsFromFlows(),this.assignSourceAndTargetIdsToLinkEvents()}assignParentOfProcessElementsCalledByCallActivity(e){const t=this.callActivitiesCallingProcess.get(e);if(t){const s=this.convertedElements.findPoolByProcessRef(e);s&&(s.parentId=t.id);for(const o of this.elementsWithoutParentByProcessId.get(e))o.parentId=t.id}}assignIncomingAndOutgoingIdsFromFlows(){const e=(t,s,o)=>{const i=this.convertedElements.findFlowNode(t)??this.convertedElements.findLane(t)??this.convertedElements.findPoolById(t);i&&!i[s].includes(o)&&i[s].push(o)};for(const t of this.convertedElements.getFlows())e(t.sourceReferenceId,"outgoingIds",t.id),e(t.targetReferenceId,"incomingIds",t.id)}assignSourceAndTargetIdsToLinkEvents(){var t;const e=[...this.eventsByLinkEventDefinition.entries()].filter(([s])=>s.id);for(const[s,o]of this.eventsByLinkEventDefinition)if(o instanceof Le){const i=e.find(([r])=>s.target===r.id);o.targetId=(t=i==null?void 0:i[1])==null?void 0:t.id}else o instanceof Oe&&(o.sourceIds=e.filter(([i])=>Array.isArray(s.source)?s.source.includes(i.id):s.source===i.id).map(([,i])=>i.id))}parseProcess(e){const t=e.id,s=this.convertedElements.findPoolByProcessRef(t);s&&!s.name&&this.convertedElements.registerPool(new B(s.id,e.name,h.POOL),t),this.buildProcessInnerElements(e,s==null?void 0:s.id)}buildProcessInnerElements(e,t){this.elementsWithoutParentByProcessId.set(e.id,[]);for(const s of bs)this.buildFlowNodeBpmnElements(e[s],Fs(s),t,e.id,s);this.buildLaneSetBpmnElements(e.laneSet,t,e.id),this.buildSequenceFlows(e.sequenceFlow),mt(this.convertedElements,e.association)}buildFlowNodeBpmnElements(e,t,s,o,i){for(const r of E(e)){const l=this.buildFlowNodeBpmnElement(t,r,s,i);"default"in r&&p.isWithDefaultSequenceFlow(t)&&this.defaultSequenceFlowIds.push(r.default),l&&(this.convertedElements.registerFlowNode(l),s||this.elementsWithoutParentByProcessId.get(o).push(l))}}buildFlowNodeBpmnElement(e,t,s,o){if(p.isEvent(e))return this.buildShapeBpmnEvent(t,e,s);if(p.isActivity(e))return this.buildShapeBpmnActivity(t,e,s,o);if(e==h.GATEWAY_EVENT_BASED){const i=t;return new ht(i.id,i.name,s,i.instantiate,se[i.eventGatewayType])}else{if(e==h.GROUP)return Ct(this.convertedElements,this.parsingMessageCollector,t,s);{const i=e===h.TEXT_ANNOTATION?t.text:t.name;return new B(t.id,i,e,s,t.instantiate)}}}buildShapeBpmnActivity(e,t,s,o){const i=ks(e);return p.isSubProcess(t)?this.buildShapeBpmnSubProcess(e,s,Rs(o,e),i):p.isCallActivity(t)?this.buildShapeBpmnCallActivity(e,s,i):new pe(e.id,e.name,t,s,e.instantiate,i)}buildShapeBpmnCallActivity(e,t,s){const o=this.convertedElements.findGlobalTask(e.calledElement);if(!o){const i=new X(e.id,e.name,ne.CALLING_PROCESS,t,s);return this.callActivitiesCallingProcess.set(e.calledElement,i),i}return new X(e.id,e.name,ne.CALLING_GLOBAL_TASK,t,s,o)}buildShapeBpmnEvent(e,t,s){const o=this.getEventDefinitions(e),i=[...o.entries()].map(([,r])=>r.length).reduce((r,l)=>r+l,0);if(i==0&&p.canHaveNoneEvent(t))return new U(e.id,e.name,t,w.NONE,s);if(i==1){const[r,l]=[...o.entries()][0],a=p.isCatchEvent(t)?this.buildShapeBpmnCatchEvent(e,t,r,s):this.buildShapeBpmnThrowEvent(e,t,r,s);return r===w.LINK&&(l[0].id||l[0].target||l[0].source)&&this.eventsByLinkEventDefinition.set(l[0],a),a}}buildShapeBpmnCatchEvent(e,t,s,o){return p.isBoundaryEvent(t)?this.buildShapeBpmnBoundaryEvent(e,s):p.isStartEvent(t)?new ut(e.id,e.name,s,o,e.isInterrupting):new Oe(e.id,e.name,s,o)}buildShapeBpmnThrowEvent(e,t,s,o){return p.isIntermediateThrowEvent(t)?new Le(e.id,e.name,s,o):new U(e.id,e.name,t,s,o)}buildShapeBpmnBoundaryEvent(e,t){const s=this.convertedElements.findFlowNode(e.attachedToRef);if(p.isActivity(s==null?void 0:s.kind))return new dt(e.id,e.name,t,e.attachedToRef,e.cancelActivity);this.parsingMessageCollector.warning(new ps(e.id,e.attachedToRef,s==null?void 0:s.kind))}getEventDefinitions(e){const t=new Map;for(const s of rt){const o=e[`${s}EventDefinition`];t.set(s,E(o,!0))}for(const s of E(e.eventDefinitionRef)){const o=this.convertedElements.findEventDefinitionOfDefinition(s);o&&t.get(o.kind).push(o)}for(const[s]of[...t.entries()].filter(([,o])=>o.length===0))t.delete(s);return t}buildShapeBpmnSubProcess(e,t,s,o){const i=new ie(e.id,e.name,s,t,o);return this.buildProcessInnerElements(e,e.id),i}buildLaneSetBpmnElements(e,t,s){for(const o of E(e))this.buildLaneBpmnElements(o.lane,t,s)}buildLaneBpmnElements(e,t,s){var o;for(const i of E(e)){const r=new B(i.id,i.name,h.LANE,t);this.convertedElements.registerLane(r),t||this.elementsWithoutParentByProcessId.get(s).push(r),this.assignParentOfLaneFlowNodes(i),(o=i.childLaneSet)!=null&&o.lane&&this.buildLaneBpmnElements(i.childLaneSet.lane,i.id,s)}}assignParentOfLaneFlowNodes(e){for(const t of E(e.flowNodeRef)){const s=this.convertedElements.findFlowNode(t),o=e.id;s?p.isBoundaryEvent(s.kind)||(s.parentId=o):this.parsingMessageCollector.warning(new Ts(o,t))}}buildSequenceFlows(e){for(const t of E(e)){const s=this.getSequenceFlowKind(t);this.convertedElements.registerSequenceFlow(new lt(t.id,t.name,t.sourceRef,t.targetRef,s))}}getSequenceFlowKind(e){if(this.defaultSequenceFlowIds.includes(e.id))return x.DEFAULT;{const t=this.convertedElements.findFlowNode(e.sourceRef);if(t&&p.isWithDefaultSequenceFlow(t.kind)&&e.conditionExpression)return p.isActivity(t.kind)?x.CONDITIONAL_FROM_ACTIVITY:x.CONDITIONAL_FROM_GATEWAY}return x.NORMAL}}const ks=n=>{const e=[],t=n.standardLoopCharacteristics,s=E(n.multiInstanceLoopCharacteristics,!0)[0];return t!==void 0?e.push(y.LOOP):s&&e.push(s.isSequential?y.MULTI_INSTANCE_SEQUENTIAL:y.MULTI_INSTANCE_PARALLEL),e};class Ms{constructor(e,t,s,o,i,r){this.categoryConverter=e,this.collaborationConverter=t,this.eventDefinitionConverter=s,this.globalTaskConverter=o,this.processConverter=i,this.diagramConverter=r}parse(e){const t=e.definitions;return this.categoryConverter.deserialize(t),this.collaborationConverter.deserialize(t.collaboration),this.eventDefinitionConverter.deserialize(t),this.globalTaskConverter.deserialize(t),this.processConverter.deserialize(t.process),this.diagramConverter.deserialize(t.BPMNDiagram)}}function Bs(n){const e=new Es;return new Ms(new cs(e),new Ss(e,n),new ys(e),new ws(e),new Ps(e,n),new Os(e,n))}const At=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",xs=At+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Ys="["+At+"]["+xs+"]*",Vs=new RegExp("^"+Ys+"$");function vt(n,e){const t=[];let s=e.exec(n);for(;s;){const o=[];o.startIndex=e.lastIndex-s[0].length;const i=s.length;for(let r=0;r"u")};function Gs(n){return typeof n<"u"}const Ds={allowBooleanAttributes:!1,unpairedTags:[]};function Us(n,e){e=Object.assign({},Ds,e);const t=[];let s=!1,o=!1;n[0]==="\uFEFF"&&(n=n.substr(1));for(let i=0;i"&&n[i]!==" "&&n[i]!==" "&&n[i]!==` `&&n[i]!=="\r";i++)a+=n[i];if(a=a.trim(),a[a.length-1]==="/"&&(a=a.substring(0,a.length-1),i--),!js(a)){let g;return a.trim().length===0?g="Invalid space after '<'.":g="Tag '"+a+"' is an invalid name.",N("InvalidTag",g,R(n,i))}const d=Ks(n,i);if(d===!1)return N("InvalidAttr","Attributes for '"+a+"' have open quote.",R(n,i));let u=d.value;if(i=d.index,u[u.length-1]==="/"){const g=i-u.length;u=u.substring(0,u.length-1);const I=st(u,e);if(I===!0)s=!0;else return N(I.err.code,I.err.msg,R(n,g+I.err.line))}else if(l)if(d.tagClosed){if(u.trim().length>0)return N("InvalidTag","Closing tag '"+a+"' can't have attributes or invalid starting.",R(n,r));if(t.length===0)return N("InvalidTag","Closing tag '"+a+"' has not been opened.",R(n,r));{const g=t.pop();if(a!==g.tagName){let I=R(n,g.tagStartPos);return N("InvalidTag","Expected closing tag '"+g.tagName+"' (opened in line "+I.line+", col "+I.col+") instead of closing tag '"+a+"'.",R(n,r))}t.length==0&&(o=!0)}}else return N("InvalidTag","Closing tag '"+a+"' doesn't have proper closing.",R(n,i));else{const g=st(u,e);if(g!==!0)return N(g.err.code,g.err.msg,R(n,i-u.length+g.err.line));if(o===!0)return N("InvalidXml","Multiple possible root nodes found.",R(n,i));e.unpairedTags.indexOf(a)!==-1||t.push({tagName:a,tagStartPos:r}),s=!0}for(i++;i0)return N("InvalidXml","Invalid '"+JSON.stringify(t.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return N("InvalidXml","Start tag expected.",1);return!0}function et(n){return n===" "||n===" "||n===` `||n==="\r"}function tt(n,e){const t=e;for(;e5&&s==="xml")return N("InvalidXml","XML declaration allowed only at the start of the document.",R(n,e));if(n[e]=="?"&&n[e+1]==">"){e++;break}else continue}return e}function nt(n,e){if(n.length>e+5&&n[e+1]==="-"&&n[e+2]==="-"){for(e+=3;e"){e+=2;break}}else if(n.length>e+8&&n[e+1]==="D"&&n[e+2]==="O"&&n[e+3]==="C"&&n[e+4]==="T"&&n[e+5]==="Y"&&n[e+6]==="P"&&n[e+7]==="E"){let t=1;for(e+=8;e"&&(t--,t===0))break}else if(n.length>e+9&&n[e+1]==="["&&n[e+2]==="C"&&n[e+3]==="D"&&n[e+4]==="A"&&n[e+5]==="T"&&n[e+6]==="A"&&n[e+7]==="["){for(e+=8;e"){e+=2;break}}return e}const Ws='"',Hs="'";function Ks(n,e){let t="",s="",o=!1;for(;e"&&s===""){o=!0;break}t+=n[e]}return s!==""?!1:{value:t,index:e,tagClosed:o}}const zs=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function st(n,e){const t=vt(n,zs),s={};for(let o=0;o!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(n,e,t){return n},captureMetaData:!1},Qs=function(n){return Object.assign({},qs,n)};let fe;typeof Symbol!="function"?fe="@@xmlMetadata":fe=Symbol("XML Node Metadata");class H{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e,t){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),t!==void 0&&(this.child[this.child.length-1][fe]={startIndex:t})}static getMetaDataSymbol(){return fe}}function Js(n,e){const t={};if(n[e+3]==="O"&&n[e+4]==="C"&&n[e+5]==="T"&&n[e+6]==="Y"&&n[e+7]==="P"&&n[e+8]==="E"){e=e+9;let s=1,o=!1,i=!1,r="";for(;e"){if(i?n[e-1]==="-"&&n[e-2]==="-"&&(i=!1,s--):s--,s===0)break}else n[e]==="["?o=!0:r+=n[e];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:t,i:e}}const G=(n,e)=>{for(;e1||i.length===1&&!l))return n;{const a=Number(t),d=String(a);if(a===0)return a;if(d.search(/[eE]/)!==-1)return e.eNotation?a:n;if(t.indexOf(".")!==-1)return d==="0"||d===r||d===`${o}${r}`?a:n;let u=i?r:t;return i?u===d||o+u===d?a:n:u===d||u===o+d?a:n}}else return n}}const lo=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function ao(n,e,t){if(!t.eNotation)return n;const s=e.match(lo);if(s){let o=s[1]||"";const i=s[3].indexOf("e")===-1?"E":"e",r=s[2],l=o?n[r.length+1]===i:n[r.length]===i;return r.length>1&&l?n:r.length===1&&(s[3].startsWith(`.${i}`)||s[3][0]===i)?Number(e):t.leadingZeros&&!l?(e=(s[1]||"")+s[3],Number(e)):n}else return n}function co(n){return n&&n.indexOf(".")!==-1&&(n=n.replace(/0+$/,""),n==="."?n="0":n[0]==="."?n="0"+n:n[n.length-1]==="."&&(n=n.substring(0,n.length-1))),n}function uo(n,e){if(parseInt)return parseInt(n,e);if(Number.parseInt)return Number.parseInt(n,e);if(window&&window.parseInt)return window.parseInt(n,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function ho(n){return typeof n=="function"?n:Array.isArray(n)?e=>{for(const t of n)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}class fo{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,s)=>String.fromCodePoint(Number.parseInt(s,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,s)=>String.fromCodePoint(Number.parseInt(s,16))}},this.addExternalEntities=go,this.parseXml=Io,this.parseTextData=To,this.resolveNameSpace=po,this.buildAttributesMap=So,this.isItStopNode=vo,this.replaceEntitiesValue=mo,this.readStopNodeData=Lo,this.saveTextToParentTag=Ao,this.addChild=Co,this.ignoreAttributesFn=ho(this.options.ignoreAttributes)}}function go(n){const e=Object.keys(n);for(let t=0;t0)){r||(n=this.replaceEntitiesValue(n));const l=this.options.tagValueProcessor(e,n,t,o,i);return l==null?n:typeof l!=typeof n||l!==n?l:this.options.trimValues?be(n,this.options.parseTagValue,this.options.numberParseOptions):n.trim()===n?be(n,this.options.parseTagValue,this.options.numberParseOptions):n}}function po(n){if(this.options.removeNSPrefix){const e=n.split(":"),t=n.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(n=t+e[1])}return n}const Eo=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function So(n,e,t){if(this.options.ignoreAttributes!==!0&&typeof n=="string"){const s=vt(n,Eo),o=s.length,i={};for(let r=0;r",i,"Closing Tag is not closed.");let a=n.substring(i+2,l).trim();if(this.options.removeNSPrefix){const g=a.indexOf(":");g!==-1&&(a=a.substr(g+1))}this.options.transformTagName&&(a=this.options.transformTagName(a)),t&&(s=this.saveTextToParentTag(s,t,o));const d=o.substring(o.lastIndexOf(".")+1);if(a&&this.options.unpairedTags.indexOf(a)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: `);let u=0;d&&this.options.unpairedTags.indexOf(d)!==-1?(u=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):u=o.lastIndexOf("."),o=o.substring(0,u),t=this.tagsNodeStack.pop(),s="",i=l}else if(n[i+1]==="?"){let l=Re(n,i,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,t,o),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const a=new H(l.tagName);a.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(a[":@"]=this.buildAttributesMap(l.tagExp,o,l.tagName)),this.addChild(t,a,o,i)}i=l.closeIndex+1}else if(n.substr(i+1,3)==="!--"){const l=z(n,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){const a=n.substring(i+4,l-2);s=this.saveTextToParentTag(s,t,o),t.add(this.options.commentPropName,[{[this.options.textNodeName]:a}])}i=l}else if(n.substr(i+1,2)==="!D"){const l=Js(n,i);this.docTypeEntities=l.entities,i=l.i}else if(n.substr(i+1,2)==="!["){const l=z(n,"]]>",i,"CDATA is not closed.")-2,a=n.substring(i+9,l);s=this.saveTextToParentTag(s,t,o);let d=this.parseTextData(a,t.tagname,o,!0,!1,!0,!0);d==null&&(d=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:a}]):t.add(this.options.textNodeName,d),i=l+2}else{let l=Re(n,i,this.options.removeNSPrefix),a=l.tagName;const d=l.rawTagName;let u=l.tagExp,g=l.attrExpPresent,I=l.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),t&&s&&t.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,t,o,!1));const C=t;C&&this.options.unpairedTags.indexOf(C.tagname)!==-1&&(t=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),a!==e.tagname&&(o+=o?"."+a:a);const L=i;if(this.isItStopNode(this.options.stopNodes,o,a)){let _="";if(u.length>0&&u.lastIndexOf("/")===u.length-1)a[a.length-1]==="/"?(a=a.substr(0,a.length-1),o=o.substr(0,o.length-1),u=a):u=u.substr(0,u.length-1),i=l.closeIndex;else if(this.options.unpairedTags.indexOf(a)!==-1)i=l.closeIndex;else{const J=this.readStopNodeData(n,d,I+1);if(!J)throw new Error(`Unexpected end of ${d}`);i=J.i,_=J.tagContent}const Q=new H(a);a!==u&&g&&(Q[":@"]=this.buildAttributesMap(u,o,a)),_&&(_=this.parseTextData(_,a,o,!0,g,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),Q.add(this.options.textNodeName,_),this.addChild(t,Q,o,L)}else{if(u.length>0&&u.lastIndexOf("/")===u.length-1){a[a.length-1]==="/"?(a=a.substr(0,a.length-1),o=o.substr(0,o.length-1),u=a):u=u.substr(0,u.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const _=new H(a);a!==u&&g&&(_[":@"]=this.buildAttributesMap(u,o,a)),this.addChild(t,_,o,L),o=o.substr(0,o.lastIndexOf("."))}else{const _=new H(a);this.tagsNodeStack.push(t),a!==u&&g&&(_[":@"]=this.buildAttributesMap(u,o,a)),this.addChild(t,_,o,L),t=_}s="",i=I}}else s+=n[i];return e.child};function Co(n,e,t,s){this.options.captureMetaData||(s=void 0);const o=this.options.updateTag(e.tagname,t,e[":@"]);o===!1||(typeof o=="string"&&(e.tagname=o),n.addChild(e,s))}const mo=function(n){if(this.options.processEntities){for(let e in this.docTypeEntities){const t=this.docTypeEntities[e];n=n.replace(t.regx,t.val)}for(let e in this.lastEntities){const t=this.lastEntities[e];n=n.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const t=this.htmlEntities[e];n=n.replace(t.regex,t.val)}n=n.replace(this.ampEntity.regex,this.ampEntity.val)}return n};function Ao(n,e,t,s){return n&&(s===void 0&&(s=e.child.length===0),n=this.parseTextData(n,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,s),n!==void 0&&n!==""&&e.add(this.options.textNodeName,n),n=""),n}function vo(n,e,t){const s="*."+t;for(const o in n){const i=n[o];if(s===i||e===i)return!0}return!1}function Oo(n,e,t=">"){let s,o="";for(let i=e;i",t,`${e} is not closed`);if(n.substring(t+2,i).trim()===e&&(o--,o===0))return{tagContent:n.substring(s,t),i};t=i}else if(n[t+1]==="?")t=z(n,"?>",t+1,"StopNode is not closed.");else if(n.substr(t+1,3)==="!--")t=z(n,"-->",t+3,"StopNode is not closed.");else if(n.substr(t+1,2)==="![")t=z(n,"]]>",t,"StopNode is not closed.")-2;else{const i=Re(n,t,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,t=i.closeIndex)}}function be(n,e,t){if(e&&typeof n=="string"){const s=n.trim();return s==="true"?!0:s==="false"?!1:ro(n,t)}else return Gs(n)?n:""}const Ie=H.getMetaDataSymbol();function No(n,e){return Ot(n,e)}function Ot(n,e,t){let s;const o={};for(let i=0;i0&&(o[e.textNodeName]=s):s!==void 0&&(o[e.textNodeName]=s),o}function _o(n){const e=Object.keys(n);for(let t=0;t"},{regex:/&(lt|#60|#x3c|#x3C);/g,val:"<"},{regex:/&(quot|#34|#x22);/g,val:'"'}],Fo=new Set(["BPMNShape.Bounds","BPMNShape.BPMNLabel.Bounds","BPMNEdge.BPMNLabel.Bounds","BPMNEdge.waypoint"].map(n=>`definitions.BPMNDiagram.BPMNPlane.${n}`)),Po=new Set(["x","y","width","height"]),ko=(n,e)=>Fo.has(e)&&Po.has(n);class Mo{constructor(e){f(this,"x2jOptions",{attributeNamePrefix:"",removeNSPrefix:!0,ignoreAttributes:!1,parseAttributeValue:!0,processEntities:!1,attributeValueProcessor:(e,t,s)=>ko(e,s)?Number(t):this.processAttribute(t)});f(this,"xmlParser",new Ro(this.x2jOptions));this.options=e}parse(e){let t;try{t=this.xmlParser.parse(e)}catch{throw new Error("XML parsing failed. Invalid BPMN source.")}if(!t.definitions)throw new Error("XML parsing failed. Unable to retrieve 'definitions' from the BPMN source.");return t}processAttribute(e){var t;for(const s of bo)e=e.replace(s.regex,s.val);return(t=this.options)!=null&&t.additionalXmlAttributeProcessor&&(e=this.options.additionalXmlAttributeProcessor(e)),e}}class Bo{constructor(e,t){this.jsonParser=e,this.xmlParser=t}parse(e){const t=this.xmlParser.parse(e);return this.jsonParser.parse(t)}}function xo(n){return new Bo(Bs(new us(n)),new Mo(n))}function Yo(n){return new Vo(n)}class Vo{constructor(e){this.graph=e}updateAndRefreshCssClassesOfCell(e,t){this.updateAndRefreshCssClassesOfElement(e,t),this.updateAndRefreshCssClassesOfElement(Me(e),t)}updateAndRefreshCssClassesOfElement(e,t){const s=this.graph.getModel(),o=s.getCell(e);if(!o)return;let i=o.getStyle();i=b(i,S.EXTRA_CSS_CLASSES,t.join(",")),s.setStyle(o,i)}}function Go(n){return new Do(Yo(n),new Uo)}class Do{constructor(e,t){this.cssClassesUpdater=e,this.cssClassesCache=t}clearCache(){this.cssClassesCache.clear()}addCssClasses(e,t){this.updateCssClasses(e,t,this.cssClassesCache.addClassNames)}removeCssClasses(e,t){this.updateCssClasses(e,t,this.cssClassesCache.removeClassNames)}removeAllCssClasses(e){if(e||e=="")for(const t of E(e)){const s=this.cssClassesCache.removeAllClassNames(t);this.updateCellIfChanged(s,t)}else{const t=this.cssClassesCache.getBpmnIds();this.cssClassesCache.clear();for(const s of t)this.updateCellIfChanged(!0,s)}}toggleCssClasses(e,t){this.updateCssClasses(e,t,this.cssClassesCache.toggleClassNames)}updateCssClasses(e,t,s){const o=E(t);for(const i of E(e))this.updateCellIfChanged(s(i,o),i)}updateCellIfChanged(e,t){if(e){const s=this.cssClassesCache.getClassNames(t);this.cssClassesUpdater.updateAndRefreshCssClassesOfCell(t,s)}}}class Uo{constructor(){f(this,"classNamesByBpmnId",new Map);f(this,"clear",()=>{this.classNamesByBpmnId.clear()});f(this,"addClassNames",(e,t)=>this.updateClassNames(e,t,(s,o)=>s.add(o)));f(this,"removeClassNames",(e,t)=>this.updateClassNames(e,t,(s,o)=>s.delete(o)));f(this,"toggleClassNames",(e,t)=>(this.updateClassNames(e,t,(s,o)=>s.has(o)?s.delete(o):s.add(o)),t&&t.length>0))}getClassNames(e){return this.classNamesByBpmnId.has(e)?[...this.classNamesByBpmnId.get(e)]:[]}getBpmnIds(){return[...this.classNamesByBpmnId.keys()]}removeAllClassNames(e){const t=this.getOrInitializeClassNames(e),s=t.size;return t.clear(),t.sizeWo.get(n.position),Ko=(n,e)=>{e&&(n.fill.color=e.color??n.fill.color,n.fill.opacity=e.opacity??n.fill.opacity)},zo=(n,e)=>{e&&(n.stroke.color=e.color??n.stroke.color,n.stroke.width=e.width??n.stroke.width)},Xo=(n,e)=>{e&&(n.font.color=e.color??n.font.color,n.font.size=e.size??n.font.size)},$o=n=>{const e={fill:{color:T.DEFAULT_OVERLAY_FILL_COLOR.valueOf(),opacity:T.DEFAULT_OVERLAY_FILL_OPACITY.valueOf()},stroke:{color:T.DEFAULT_OVERLAY_STROKE_COLOR.valueOf(),width:T.DEFAULT_OVERLAY_STROKE_WIDTH.valueOf()},font:{color:T.DEFAULT_OVERLAY_FONT_COLOR.valueOf(),size:T.DEFAULT_OVERLAY_FONT_SIZE.valueOf()}},t=n.style,s={...e};return t&&(Ko(s,t.fill),zo(s,t.stroke),Xo(s,t.font)),s};class Zo{convert(e){const t=Ho(e),s=$o(e);return{position:t,style:s}}}function jo(n){return new qo(n,new Zo)}class qo{constructor(e,t){this.graph=e,this.overlayConverter=t}addOverlays(e,t){const s=this.graph.getModel().getCell(e);if(s)for(const o of E(t)){const i=new Tt(o.label,this.overlayConverter.convert(o));this.graph.addCellOverlay(s,i)}}removeAllOverlays(e){const t=this.graph.getModel().getCell(e);t&&this.graph.removeCellOverlays(t)}}function Qo(n){return new Jo(jo(n))}class Jo{constructor(e){this.overlaysUpdater=e}addOverlays(e,t){this.overlaysUpdater.addOverlays(e,t)}removeAllOverlays(e){this.overlaysUpdater.removeAllOverlays(e)}}class ei{element(e){return`svg > g > g > g[data-bpmn-id="${e}"]`}elementsOfKind(e){return`svg > g > g > g.${e}:not(.bpmn-label)`}}function ti(n){return new ni(n,new si(n.getModel()))}const ot=n=>{const e=E(n);return e.push(...e.map(t=>Me(t))),e};class ni{constructor(e,t){this.graph=e,this.styleManager=t}clear(){this.styleManager.clear()}updateStyle(e,t){if(!t)return;const s=this.graph.getModel(),o=ot(e).map(i=>s.getCell(i)).filter(Boolean);o.length!==0&&this.graph.batchUpdate(()=>{for(const i of o){this.styleManager.ensureStyleIsStored(i);let r=i.getStyle();r=b(r,c.STYLE_OPACITY,t.opacity,Ee),r=Qt(r,t.stroke),r=Jt(r,t.font),sn(t)&&(r=nn(r,t.fill)),s.setStyle(i,r)}})}resetStyle(e){this.graph.batchUpdate(()=>{if(e||e=="")for(const t of ot(e))this.styleManager.resetStyleIfIsStored(t);else this.styleManager.resetAllStyles()})}}const it=S.EXTRA_CSS_CLASSES;class si{constructor(e){f(this,"stylesCache",new Map);this.model=e}clear(){this.stylesCache.clear()}resetAllStyles(){for(const e of this.stylesCache.keys())this.resetStyle(e,this.stylesCache.get(e))}resetStyleIfIsStored(e){const t=this.stylesCache.get(e);t&&this.resetStyle(e,t)}resetStyle(e,t){const s=this.model.getCell(e),o=en(s.getStyle(),it,""),i=b(t,it,o);this.model.setStyle(s,i),this.stylesCache.delete(e)}ensureStyleIsStored(e){const t=e.getId();this.stylesCache.has(t)||this.stylesCache.set(t,e.getStyle())}}function oi(n){return new ii(ti(n))}class ii{constructor(e){this.styleUpdater=e}clearCache(){this.styleUpdater.clear()}updateStyle(e,t){this.styleUpdater.updateStyle(e,t)}resetStyle(e){this.styleUpdater.resetStyle(e)}}function ri(n,e){return new li(n,new ai(e.container,new ei),Go(e),Qo(e),oi(e))}class li{constructor(e,t,s,o,i){this.bpmnModelRegistry=e,this.htmlElementRegistry=t,this.cssClassesRegistry=s,this.overlaysRegistry=o,this.styleRegistry=i,this.bpmnModelRegistry.registerOnLoadCallback(()=>{this.cssClassesRegistry.clearCache(),this.styleRegistry.clearCache()})}getModelElementsByIds(e){return Ce(e).map(t=>this.bpmnModelRegistry.getBpmnSemantic(t)).filter(Boolean)}getElementsByIds(e){return this.getModelElementsByIds(e).map(t=>({bpmnSemantic:t,htmlElement:this.htmlElementRegistry.getBpmnHtmlElement(t.id)}))}getModelElementsByKinds(e){return Ce(e).flatMap(t=>this.htmlElementRegistry.getBpmnHtmlElements(t)).map(t=>this.getRelatedBpmnSemantic(t))}getElementsByKinds(e){return Ce(e).flatMap(t=>this.htmlElementRegistry.getBpmnHtmlElements(t)).map(t=>({htmlElement:t,bpmnSemantic:this.getRelatedBpmnSemantic(t)}))}getRelatedBpmnSemantic(e){return this.bpmnModelRegistry.getBpmnSemantic(e.dataset.bpmnId)}addCssClasses(e,t){this.cssClassesRegistry.addCssClasses(e,t)}removeCssClasses(e,t){this.cssClassesRegistry.removeCssClasses(e,t)}removeAllCssClasses(e){this.cssClassesRegistry.removeAllCssClasses(e)}toggleCssClasses(e,t){this.cssClassesRegistry.toggleCssClasses(e,t)}addOverlays(e,t){this.overlaysRegistry.addOverlays(e,t)}removeAllOverlays(e){this.overlaysRegistry.removeAllOverlays(e)}updateStyle(e,t){this.styleRegistry.updateStyle(e,t)}resetStyle(e){this.styleRegistry.resetStyle(e)}}class ai{constructor(e,t){this.container=e,this.querySelectors=t}getBpmnHtmlElement(e){return this.container.querySelector(this.querySelectors.element(e))}getBpmnHtmlElements(e){const t=this.querySelectors.elementsOfKind(Ne(e));return[...this.container.querySelectorAll(t)]}}const Ce=n=>[...new Set(E(n))];class ci{filter(e,t){const s=[],o=[];for(const C of E(t==null?void 0:t.pools).filter(L=>L&&Object.keys(L).length>0))C.id?s.push(C.id):C.name&&o.push(C.name);if(s.length===0&&o.length===0)return e;const{filteredPools:i,filteredPoolIds:r}=ui(e,s,o),l=[...s,...r],{filteredLanes:a,filteredLaneIds:d,filteredFlowNodes:u,filteredFlowNodeIds:g}=Lt(e.lanes,e.flowNodes,l),I=hi(e.edges,[...l,...d,...g]);if(i.length===0&&a.length===0&&u.length===0&&I.length===0){let C=s.length>0?` for ids [${s}]`:"";const L=C?" and":"";throw C+=o.length>0?`${L} for names [${o}]`:"",new Error("No matching pools"+C)}return{lanes:a,flowNodes:u,pools:i,edges:I}}}function ui(n,e,t){const s=n.pools.filter(i=>e.includes(i.bpmnElement.id)||t.includes(i.bpmnElement.name)),o=s.map(i=>i.bpmnElement.id);return{filteredPools:s,filteredPoolIds:o}}function Lt(n,e,t){const{filteredLanes:s,filteredLaneIds:o}=Nt(n,t),{filteredLanes:i,filteredLaneIds:r,filteredFlowNodes:l,filteredFlowNodeIds:a}=di(e,[...t,...o],n);return s.push(...i),o.push(...r),{filteredLanes:s,filteredLaneIds:o,filteredFlowNodes:l,filteredFlowNodeIds:a}}function Nt(n,e){const t=n.filter(o=>e.includes(o.bpmnElement.parentId)),s=t.map(o=>o.bpmnElement.id);if(t.length>0){const{filteredLanes:o,filteredLaneIds:i}=Nt(n,s);t.push(...o),s.push(...i)}return{filteredLanes:t,filteredLaneIds:s}}function di(n,e,t){const s=n.filter(d=>e.includes(d.bpmnElement.parentId));if(s.length===0)return{filteredLanes:[],filteredLaneIds:[],filteredFlowNodes:[],filteredFlowNodeIds:[]};const o=s.map(d=>d.bpmnElement.id),{filteredLanes:i,filteredLaneIds:r,filteredFlowNodes:l,filteredFlowNodeIds:a}=Lt(t,n,o);return s.push(...l),o.push(...a),{filteredLanes:i,filteredLaneIds:r,filteredFlowNodes:s,filteredFlowNodeIds:o}}function hi(n,e){return n.filter(t=>e.includes(t.bpmnElement.sourceReferenceId)&&e.includes(t.bpmnElement.targetReferenceId))}class fi{constructor(){f(this,"searchableModel");f(this,"onLoadCallback")}load(e,t){var o;const s=new ci().filter(e,t);return this.searchableModel=new Ti(s),(o=this.onLoadCallback)==null||o.call(this),gi(s)}registerOnLoadCallback(e){this.onLoadCallback=e}getBpmnSemantic(e){var i;const t=(i=this.searchableModel)==null?void 0:i.elementById(e);if(!t)return;const s=t.bpmnElement,o=s instanceof B;return{id:e,isShape:o,kind:s.kind,name:s.name,...s instanceof Te?{sourceRefId:s.sourceReferenceId,targetRefId:s.targetReferenceId}:{callActivityGlobalTaskKind:s instanceof X?s.globalTaskKind:void 0,callActivityKind:s instanceof X?s.callActivityKind:void 0,eventDefinitionKind:s instanceof U?s.eventDefinitionKind:void 0,linkEventSourceIds:s instanceof Oe&&s.eventDefinitionKind==w.LINK?s.sourceIds:void 0,linkEventTargetId:s instanceof Le?s.targetId:void 0,incomingIds:s.incomingIds,outgoingIds:s.outgoingIds,parentId:s.parentId,subProcessKind:s instanceof ie?s.subProcessKind:void 0}}}}function gi(n){const e=new Set(n.flowNodes.filter(i=>{const r=i.bpmnElement;return p.isSubProcess(r.kind)&&r.markers.includes(y.EXPAND)}).map(i=>i.bpmnElement.id)),t=[],s=[],o=[];for(const i of n.flowNodes){const r=i.bpmnElement.kind;p.isSubProcess(r)?t.push(i):p.isBoundaryEvent(r)?s.push(i):e.has(i.bpmnElement.parentId)||o.push(i)}return{boundaryEvents:s,edges:n.edges,lanes:n.lanes,otherFlowNodes:o,pools:n.pools,subprocesses:t}}class Ti{constructor(e){f(this,"elements",new Map);for(const t of[...e.pools,...e.lanes,...e.flowNodes,...e.edges])this.elements.set(t.bpmnElement.id,t)}elementById(e){return this.elements.get(e)}}class pi{constructor(e){f(this,"graph");f(this,"navigation");f(this,"bpmnElementsRegistry");f(this,"bpmnModelRegistry");f(this,"parserOptions");f(this,"rendererOptions");this.rendererOptions=e==null?void 0:e.renderer;const t=new ss(Vt(e==null?void 0:e.container));this.graph=t.configure(),this.navigation=rs(this.graph,e==null?void 0:e.navigation),this.bpmnModelRegistry=new fi,this.bpmnElementsRegistry=ri(this.bpmnModelRegistry,this.graph),this.parserOptions=e==null?void 0:e.parser}load(e,t){const s=xo(this.parserOptions).parse(e),o=this.bpmnModelRegistry.load(s,t==null?void 0:t.modelFilter);fn(this.graph,this.rendererOptions).render(o),this.navigation.fit(t==null?void 0:t.fit)}}function xi(n){document.readyState==="complete"||document.readyState==="interactive"?setTimeout(n,1):document.addEventListener("DOMContentLoaded",n)}function m(n,...e){De("[DEMO]",n,...e)}function De(n,e,...t){console.info(`${n} ${e}`,...t)}function F(n,...e){De("[DEMO STARTUP]",n,...e)}function _t(n,e){yt(n),window.alert(n)}function yt(n){console.error("[DEMO]",n)}function Z(n,...e){De("[DEMO DOWNLOAD]",n,...e)}async function Ei(n){m(`Fetching BPMN content from url ${n}`);const e=await fetch(n);if(!e.ok)throw new Error(`HTTP status ${e.status}`);return await e.text()}function wt(n,e,t){const s=document.createElement("a");e.startsWith("data:image/svg+xml")&&(t=encodeURIComponent(t),e+=","),s.setAttribute("href",e+t),s.setAttribute("download",n),s.style.display="none",document.body.append(s),s.click(),s.remove()}function Si(n){Z("Start SVG download"),wt("diagram.svg","data:image/svg+xml",n),Z("Download completed")}function Ii(n){Z("Start PNG download");const e=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),t=URL.createObjectURL(e),s=document.createElement("img");s.setAttribute("style","position: absolute; top: -9999px"),s.crossOrigin="anonymous",document.body.append(s);const o=document.createElement("canvas"),i=o.getContext("2d");s.addEventListener("load",function(){const r=new Image;o.width=s.naturalWidth,o.height=s.naturalHeight,r.crossOrigin="Anonymous",r.addEventListener("load",function(){i.drawImage(r,0,0),URL.revokeObjectURL(t);const l=o.toDataURL("image/png");s.remove(),wt("diagram.png","",l),Z("Download completed")}),r.src=s.src}),s.src=t}class Ci{constructor(e,t,s,o){f(this,"document");f(this,"head");this.window=e,this.outerContainerId=t,this.containerToFade=s,this.dropCallback=o,this.document=e.document,this.head=document.head,this.initializeDragAndDrop()}initializeDragAndDrop(){this.containerToFade.classList.add("faded-container"),this.addDomElements(this.containerToFade),this.addStyle();const e=document.querySelector(`#${this.outerContainerId}`);this.preventDefaultsOnEvents(["dragover","drop"],this.window),this.preventDefaultsOnEvents(["dragover","dragleave","drop"],e),this.addEventsOnDropContainer(e,this.containerToFade),this.addEventsOnDocument(this.outerContainerId,this.containerToFade)}preventDefaults(e){e.preventDefault(),e.stopPropagation()}preventDefaultsOnEvents(e,t){for(const s of e)t.addEventListener(s,this.preventDefaults.bind(this),!1)}addDomElements(e){const t=this.document.createElement("p");t.textContent="open BPMN diagram";const s=this.document.createElement("div");s.classList.add("drop-here-text"),s.append(t);const o=this.document.createElement("div");o.id=this.outerContainerId,o.append(s),e.parentNode.prepend(o)}addStyle(){const e=` .faded-container { opacity: 1; } .faded-container.faded { opacity: 0.1; } #${this.outerContainerId} { display: none; overflow: hidden; position: absolute; top: 10px; right: 10px; bottom: 10px; left: 10px; font-weight: bold; text-align: center; color: #555; padding: 10px; } #${this.outerContainerId}.dragging { display: block; } #${this.outerContainerId} .drop-here-text { border: 2px solid transparent; width: 100%; height: 100%; overflow: hidden; } #${this.outerContainerId} .drop-here-text p { font-style: normal; font-family: monospace; font-size: 40px; color: rgba(1,1,1,.2); } #${this.outerContainerId}.dragging .drop-here-text { cursor: default; display: flex; justify-content: center; align-items: center; border: 2px dashed rgba(0,0,0,.2); border-radius: 7px; }`,t=document.createElement("style");t.append(document.createTextNode(e)),this.head.append(t)}addEventsOnDropContainer(e,t){e.addEventListener("dragover",this.getAddClassCallback(t,!1),!1),e.addEventListener("mousedown",this.getRemoveClassCallback(t,!1),!1),e.addEventListener("drop",this.getDropCallbackForElement(t,!1,this.dropCallback),!1)}addEventsOnDocument(e,t){this.document.addEventListener("dragover",this.getAddClassCallback(t,!0,e),!1),this.document.addEventListener("dragleave",this.getRemoveClassCallback(t,!0,e),!1),this.document.addEventListener("drop",this.getDropCallbackForElement(t,!0,this.dropCallback,e),!1)}getAddClassCallback(e,t,s){return function(){t?this.querySelector("#"+s).classList.add("dragging"):this.classList.add("dragging"),e.classList.add("faded")}}getRemoveClassCallback(e,t,s){return function(){t?this.querySelector("#"+s).classList.remove("dragging"):this.classList.remove("dragging"),e.classList.remove("faded")}}getDropCallbackForElement(e,t,s,o){return function(i){try{const l=i.dataTransfer.files;s(l[0])}catch(r){const l=r instanceof Error?r.message:String(r);_t(l)}finally{t?this.querySelector("#"+o).classList.remove("dragging"):this.classList.remove("dragging"),e.classList.remove("faded")}}}}class Rt{constructor(e){this.graph=e}exportSvg(){return this.doSvgExport(!0)}exportSvgForPng(){const e=zt.IS_FF;return this.doSvgExport(e)}doSvgExport(e){const t=this.computeSvg({scale:1,border:25,enableForeignObjectForLabel:e});return` ${A.getXml(t)} `}computeSvg(e){const t=e.scale??1,s=e.border??0,o=e.crisp??!0,i=e.enableForeignObjectForLabel??!0,r=this.graph.getGraphBounds(),l=this.graph.view.scale,a=A.createXmlDocument(),d=a.createElementNS(c.NS_SVG,"svg"),u=t/l,g=Math.max(1,Math.ceil(r.width*u)+2*s),I=Math.max(1,Math.ceil(r.height*u)+2*s);d.setAttribute("version","1.1"),d.setAttribute("width",g+"px"),d.setAttribute("height",I+"px"),d.setAttribute("viewBox",(o?"-0.5 -0.5":"0 0")+" "+g+" "+I),a.append(d);const C=a.createElementNS(c.NS_SVG,"g");d.append(C);const L=this.createSvgCanvas(C);L.foEnabled=i,L.foOffset=o?-.5:0,L.textOffset=o?-.5:0,L.imageOffset=o?-.5:0,L.translate(Math.floor((s/t-r.x)/l),Math.floor((s/t-r.y)/l)),L.scale(u);const _=new O.mxImageExport;return _.includeOverlays=!0,_.drawState(this.graph.getView().getState(this.graph.model.root),L),a}createSvgCanvas(e){const t=new mi(e);return t.pointerEvents=!0,t}}class mi extends ke{constructor(t){super(t);f(this,"htmlConverter",document.createElement("div"))}getAlternateText(t,s,o,i,r,l,a,d,u,g,I,C,L){return this.computeTruncatedText(l,i)}plainText(t,s,o,i,r,l,a,d,u,g,I,C){r=this.computeTruncatedText(r,o),super.plainText(t,s,o,i,r,l,a,d,u,g,I,C)}computeTruncatedText(t,s){if(t==null||this.state.fontSize<=0)return"";try{this.htmlConverter.innerHTML=t,t=A.extractTextWithWhitespace(this.htmlConverter.childNodes);const o=Math.ceil(2*s/this.state.fontSize),i=[];let r=0,l=0;for(;(o==0||r0)break}else i.push(t.charAt(l)),a<255&&r++;l++}i.length1&&(t=A.trim(i.join(""))+"...")}catch(o){console.warn("Error while computing txt label",o)}return t}}const Ai=new Map([["dark",{defaultFillColor:"#334352",defaultFontColor:"white",defaultStrokeColor:"#c0ddeb",endEventFillColor:"pink",endEventStrokeColor:"FireBrick",startEventFillColor:"DarkSeaGreen",startEventStrokeColor:"DarkGreen",taskAndCallActivityFillColor:"#5c8599",laneFillColor:"#2b3742",poolFillColor:"#232b33"}],["brown",{defaultFillColor:"#ede7e1",defaultFontColor:"#414666",defaultStrokeColor:"#414666",flowColor:"#666666",catchAndThrowEventStrokeColor:"#377f87",endEventFillColor:"pink",endEventStrokeColor:"FireBrick",startEventFillColor:"DarkSeaGreen",startEventStrokeColor:"DarkGreen",taskAndCallActivityFillColor:"#dadce8",laneFillColor:"#d4c3b2",poolFillColor:"#d1b9a1"}],["light-blue",{defaultFillColor:"#ffffff",defaultFontColor:"#002395",defaultStrokeColor:"#002395",endEventFillColor:"#f9dadc",endEventStrokeColor:"#e20613",startEventFillColor:"#ffffff",startEventStrokeColor:"#05d99e",taskAndCallActivityFillColor:"rgba(132,158,253,0.1)",textAnnotationFillColor:"rgba(237,237,245,0.5)",laneFillColor:"#edeef5",poolFillColor:"#dbefff"}]]);class vi extends pi{configureTheme(e){if(e=="default")return new St(this.graph).configureStyles(),!0;const t=Ai.get(e);if(!t)return!1;const s=this.graph.getStylesheet();for(const u of p.eventKinds()){let g,I;switch(u){case"endEvent":{g=t.endEventFillColor,I=t.endEventStrokeColor;break}case"startEvent":{g=t.startEventFillColor,I=t.startEventStrokeColor;break}case"intermediateCatchEvent":case"intermediateThrowEvent":case"boundaryEvent":{g=t.defaultFillColor,I=t.catchAndThrowEventStrokeColor??t.defaultStrokeColor;break}default:{g=t.defaultFillColor,I=t.defaultStrokeColor;break}}const C=s.styles[u];C.fillColor=g,C.strokeColor=I}for(const u of p.taskKinds()){const g=s.styles[u];g.fillColor=t.taskAndCallActivityFillColor}const o=s.styles[h.CALL_ACTIVITY];o.fillColor=t.taskAndCallActivityFillColor;const i=s.styles[h.TEXT_ANNOTATION];i.fillColor=t.textAnnotationFillColor??T.TEXT_ANNOTATION_FILL_COLOR;const r=s.styles[h.POOL];r.fillColor=t.poolFillColor,r.swimlaneFillColor=t.defaultFillColor;const l=s.styles[h.LANE];l.fillColor=t.laneFillColor;const a=s.getDefaultVertexStyle();a.fontColor=t.defaultFontColor,a.fillColor=t.defaultFillColor,a.strokeColor=t.defaultStrokeColor;const d=s.getDefaultEdgeStyle();return d.fontColor=t.defaultFontColor,d.fillColor=t.defaultFillColor,d.strokeColor=t.flowColor??t.defaultStrokeColor,!0}configureSequenceFlowColor(e){F(`Use dedicated ${e} color for sequence flows`);const s=this.graph.getStylesheet().styles[k.SEQUENCE_FLOW];s[c.STYLE_STROKECOLOR]=e,s[c.STYLE_FILLCOLOR]=e,F("Sequence flows style updated")}}let v,D={},Ue,We,ge,M;function Yi(n){m("Updating load options"),D.fit=n,m("Load options updated",D)}function Vi(){return{...D}}function Gi(){return ge}function Di(n){m("Switching theme from %s to %s",ge,n),v.configureTheme(n)?(v.graph.refresh(),m("Theme switch done"),ge=n):m("Unknown theme, do nothing")}function bt(n,e=!0){m("Loading bpmn...");try{v.load(n,D),m("BPMN loaded with configuration",D),Li(We),document.dispatchEvent(new CustomEvent("diagramLoaded"))}catch(t){if(e)Ue(`Cannot load the BPMN diagram: ${t instanceof Error?t.message:String(t)}`);else throw t}}function Ui(n){m("Fitting..."),v.navigation.fit(n),m("Fit done with configuration",n)}function Wi(n){m(`Zooming '${n}'...`),v.navigation.zoom(n),m("Zoom done")}function Hi(n){return v.bpmnElementsRegistry.getModelElementsByKinds(n)}function Oi(n){return v.bpmnElementsRegistry.getModelElementsByIds(n)}function Ft(n){const e=v.graph.model,t=e.getCell(n);return e.getParent(t)}function Ki(n){return n.map(e=>Ft(e).getId()).filter((e,t,s)=>s.indexOf(e)===t)}function zi(n){var s;const e=Ft(n),t=Oi(e.getId());return t&&((s=t[0])==null?void 0:s.kind)===h.SUB_PROCESS}function Xi(n,e){return v.bpmnElementsRegistry.addCssClasses(n,e)}function $i(n,e){return v.bpmnElementsRegistry.removeCssClasses(n,e)}function Zi(n,e){return v.bpmnElementsRegistry.addOverlays(n,[e])}function ji(n){return v.bpmnElementsRegistry.removeAllOverlays(n)}function Li(n){if(!We)return;m("Updating model, bpmnElement to collapse:",n);const e=v.graph.getModel(),t=e.getCell(n);if(t){e.beginUpdate();try{e.setCollapsed(t,!0)}finally{e.endUpdate()}m("Model updated")}else m("Element not found in the model, do nothing")}function Pt(n){n.text().then(e=>{bt(e)}).catch(e=>{throw e})}function qi(n){const e=n.target.files;if(e&&e.length>0){const t=e[0];Pt(t)}}function Ni(n){Ei(n).catch(e=>{throw new Error(`Unable to fetch ${n}. ${e}`)}).then(e=>(m("BPMN content fetched"),e)).then(e=>{bt(e,!1),m(`BPMN content loaded from url ${n}`)}).then(()=>{Pi()}).catch(e=>{Ue(e.message)})}function Qi(n){_t(n)}function _i(n){yt(n)}function yi(n,e){var i;const t=((i=n.loadOptions)==null?void 0:i.fit)??{},s=e.get("fitTypeOnLoad");s&&(t.type=s);const o=e.get("fitMargin");return o&&(t.margin=Number(o)),t}function wi(n){if(n.get("style.container.alternative.background.color")=="true"){const i="yellow";F("Use alternative color for the bpmn container background, color",i);const r=v.graph.container;r.style.backgroundColor=i,F("Bpmn container style updated")}const t=n.get("style.theme");F(`Configuring the '${t}' BPMN theme`),v.configureTheme(t)?(ge=t,F(`'${t}' BPMN theme configured`)):F(`Unknown '${t}' BPMN theme, skipping configuration`),n.get("style.seqFlow.light.colors")=="true"&&v.configureSequenceFlowColor("#E9E9E9"),F('Configuring the "Update Style" API from query parameters'),[...n.keys()].some(i=>i.startsWith("style.api."))?(M={stroke:{},font:{},fill:{}},n.get("style.api.stroke.color")&&(M.stroke.color=n.get("style.api.stroke.color")),n.get("style.api.font.color")&&(M.font.color=n.get("style.api.font.color")),n.get("style.api.font.opacity")&&(M.font.opacity=Number(n.get("style.api.font.opacity"))),n.get("style.api.fill.color")?M.fill.color=n.get("style.api.fill.color"):n.get("style.api.fill.color.startColor")&&n.get("style.api.fill.color.endColor")&&n.get("style.api.fill.color.direction")&&(M.fill.color={startColor:n.get("style.api.fill.color.startColor"),endColor:n.get("style.api.fill.color.endColor"),direction:n.get("style.api.fill.color.direction")}),n.get("style.api.fill.opacity")&&(M.fill.opacity=Number(n.get("style.api.fill.opacity"))),F('Prepared "Update Style" API object',M)):F('No query parameters, do not set the "Update Style" API object')}function Ri(n){We=n.get("bpmn.element.id.collapsed")}function bi(n){const e=n.get("bpmn.filter.pool.ids");if(!e)return;const t=e.split(",");return m("Configuring load options to only include pool id: ",t),{pools:t.map(s=>({id:s}))}}function Ji(n){const e=F;e("Initializing BpmnVisualization with container:",n.globalOptions.container);const t=new URLSearchParams(window.location.search),s=t.get("renderer.ignore.bpmn.colors");if(s){const i=s==="true";e('Ignore support for "BPMN in Color"?',i),!n.globalOptions.renderer&&(n.globalOptions.renderer={}),n.globalOptions.renderer.ignoreBpmnColors=i}v=new vi(n.globalOptions),e("Initialization completed"),new Ci(window,"drop-container",v.graph.container,Pt),e("Drag&Drop support initialized"),Ue=n.statusKoNotifier??_i,e("Configuring Load Options"),D=n.loadOptions??{},D.fit=yi(n,t),D.modelFilter=bi(t),wi(t),Ri(t),e("Checking if an 'url to fetch BPMN content' is provided as query parameter");const o=t.get("url");if(o){const i=decodeURIComponent(o);Ni(i);return}e("No 'url to fetch BPMN content' provided")}function er(){Z("Trigger SVG Download"),Si(new Rt(v.graph).exportSvg())}function tr(){Z("Trigger PNG Download"),Ii(new Rt(v.graph).exportSvgForPng())}function Fi(n,e){m("Applying style using the style API: %O",e),v.bpmnElementsRegistry.updateStyle(n,e),m("New style applied on: %O",n)}function nr(n){m("Resetting styles using the style API!"),v.bpmnElementsRegistry.resetStyle(n),m("Styles reset")}function Pi(){if(M){const n=ki();m("Number of elements whose style is to be updated",n.length),Fi(n,M)}}function ki(){m("Retrieving ids of all BPMN elements");const n=[...Object.values(h),...Object.values(k)],e=v.bpmnElementsRegistry.getModelElementsByKinds(n).map(t=>t.id);return m("All BPMN elements ids retrieved:",e.length),e}export{te as F,p as S,Yt as Z,Di as a,Gi as b,ji as c,xi as d,Xi as e,Ui as f,Vi as g,qi as h,er as i,tr as j,Hi as k,m as l,zt as m,nr as n,zi as o,Fi as p,Ki as q,$i as r,Ji as s,Zi as t,Yi as u,gn as v,Qi as w,h as x,Wi as z};