import{_asu,sasMt,gasNt,tasLt,qaszt,aasTt,basAt,a1asXt,FasEt,HasJ,lasQ,LasYt,easIt,AasFt,casV}from"./mermaid.core.BrszyIat.js";import{pasBt}from"./chunk-4BX2VUAB.DCv7cNfo.js";import{pasRt}from"./wardley-L42UT6IY.C8rjnVeB.js";import"./framework.C2AwuPrQ.js";varG=u((o,r)=>{conste=o<=1?o*100:o;if(e<0||e>100)thrownewError(`${r} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${o}`);returne},"toPercent"),A=u((o,r,e)=>({x:G(r,`${e} evolution`),y:G(o,`${e} visibility`)}),"toCoordinates"),K=u(o=>{if(o){if(o==="+<>")return"bidirectional";if(o==="+<")return"backward";if(o==="+>")return"forward"}},"getFlowFromPort"),Ot=u(o=>{if(!o?.startsWith("+"))return{};conste=/^\+'([^']*)'/.exec(o)?.[1];returno.includes("<>")?{flow:"bidirectional",label:e}:o.includes("<")?{flow:"backward",label:e}:o.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Wt=u((o,r)=>{if(Bt(o,r),o.size&&r.setSize(o.size.width,o.size.height),o.evolution){conste=o.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),h=o.evolution.stages.filter(a=>a.boundary!==void0).map(a=>a.boundary);r.updateAxes({stages:e,stageBoundaries:h})}if(o.anchors.forEach(e=>{consth=A(e.visibility,e.evolution,`Anchor "${e.name}"`);r.addNode(e.name,e.name,h.x,h.y,"anchor")}),o.components.forEach(e=>{consth=A(e.visibility,e.evolution,`Component "${e.name}"`),a=e.label?(e.label.negX?-1:1)*e.label.offsetX:void0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void0,w=e.decorator?.strategy;r.addNode(e.name,e.name,h.x,h.y,"component",a,d,e.inertia,w)}),o.notes.forEach(e=>{consth=A(e.visibility,e.evolution,`Note "${e.text}"`);r.addNote(e.text,h.x,h.y)}),o.pipelines.forEach(e=>{consth=r.getNode(e.parent);if(!h||typeofh.y!="number")thrownewError(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);consta=h.y;r.startPipeline(e.parent),e.components.forEach(d=>{constw=`${e.parent}_${d.name}`,C=d.label?(d.label.negX?-1:1)*d.label.offsetX:void0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void0,R=G(d.evolution,`Pipeline component "${d.name}" evolution`);r.addNode(w,d.name,R,a,"pipeline-component",C,g),r.addPipelineComponent(e.parent,w)})}),o.links.forEach(e=>{consth=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));leta=K(e.fromPort)??K(e.toPort);const{flow:d,label:w}=Ot(e.arrow);!a&&d&&(a=d);constC=e.linkLabel,g=w??C;r.addLink(r.resolveNodeId(e.from),r.resolveNodeId(e.to),h,g,a)}),o.evolves.forEach(e=>{consth=r.getNode(e.component);if(h?.y!==void0){consta=G(e.target,`Evolve target for "${e.component}"`);r.addTrend(e.component,a,h.y)}}),o.annotations.length>0){conste=o.annotations[0],h=A(e.x,e.y,"Annotations box");r.setAnnotationsBox(h.x,h.y)}o.annotation.forEach(e=>{consth=A(e.x,e.y,`Annotation ${e.number}`);r.addAnnotation(e.number,[{x:h.x,y:h.y}],e.text)}),o.accelerators.forEach(e=>{consth=A(e.x,e.y,`Accelerator "${e.name}"`);r.addAccelerator(e.name,h.x,h.y)}),o.deaccelerators.forEach(e=>{consth=A(e.x,e.y,`Deaccelerator "${e.name}"`);r.addDeaccelerator(e.name,h.x,h.y)})},"populateDb"),tt={parser:{yy:void0},parse:u(asynco=>{constr=awaitRt("wardley",o);Q.debug(r);conste=tt.parser?.yy;if(!e||typeofe.addNode!="function")thrownewError("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Wt(r,e)},"parse")},E,Dt=(E=class{constructor(){this.nodes=newMap,this.links=[],this.trends=newMap,this.pipelines=newMap,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(r){conste=this.nodes.get(r.id)??{id:r.id,label:r.label},h={...e,...r,className:r.className??e.className,labelOffsetX:r.labelOffsetX??e.labelOffsetX,labelOffsetY:r.labelOffsetY??e.labelOffsetY};this.nodes.set(r.id,h)}addLink(r){this.links.push(r)}addTrend(r){this.trends.set(r.nodeId,r)}startPipeline(r){this.pipelines.set(r,{nodeId:r,componentIds:[]});conste=this.nodes.get(r);e&&(e.isPipelineParent=!0)}addPipelineCompon