1import{_ as g,l as m,k as q}from"./BO0NaqTq.js";import{c as D}from"./CUqq0XTU.js";import{c as O}from"./BT8pASxY.js";D.use(O);function I(t,o){t.forEach(e=>{const n={id:e.id,labelText:e.label,height:e.height,width:e.width,padding:e.padding??0};Object.keys(e).forEach(r=>{["id","label","height","width","padding","x","y"].includes(r)||(n[r]=e[r])}),o.add({group:"nodes",data:n,position:{x:e.x??0,y:e.y??0}})})}g(I,"addNodes");function $(t,o){t.forEach(e=>{const n={id:e.id,source:e.start,target:e.end};Object.keys(e).forEach(r=>{["id","start","end"].includes(r)||(n[r]=e[r])}),o.add({group:"edges",data:n})})}g($,"addEdges");function X(t){return new Promise(o=>{const e=q("body").append("div").attr("id","cy").attr("style","display:none"),n=D({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});e.remove(),I(t.nodes,n),$(t.edges,n),n.nodes().forEach(function(a){a.layoutDimensions=()=>{const y=a.data();return{w:y.width,h:y.height}}});const r={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};n.layout(r).run(),n.ready(a=>{m.info("Cytoscape ready",a),o(n)})})}g(X,"createCytoscapeInstance");function Y(t){return t.nodes().map(o=>{const e=o.data(),n=o.position(),r={id:e.id,x:n.x,y:n.y};return Object.keys(e).forEach(a=>{a!=="id"&&(r[a]=e[a])}),r})}g(Y,"extractPositionedNodes");function v(t){return t.edges().map(o=>{const e=o.data(),n=o._private.rscratch,r={id:e.id,source:e.source,target:e.target,startX:n.startX,startY:n.startY,midX:n.midX,midY:n.midY,endX:n.endX,endY:n.endY};return Object.keys(e).forEach(a=>{["id","source","target"].includes(a)||(r[a]=e[a])}),r})}g(v,"extractPositionedEdges");async function B(t,o){m.debug("Starting cose-bilkent layout algorithm");try{C(t);const e=await X(t),n=Y(e),r=v(e);return m.debug(`Layout completed: ${n.length} nodes, ${r.length} edges`),{nodes:n,edges:r}}catch(e){throw m.error("Error in cose-bilkent layout algorithm:",e),e}}g(B,"executeCoseBilkentLayout");function C(t){if(!t)throw new Error("Layout data is required");if(!t.config)throw new Error("Configuration is required in layout data");if(!t.rootNode)throw new Error("Root node is required");if(!t.nodes||!Array.isArray(t.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(t.edges))throw new Error("Edges array is required in layout data");return!0}g(C,"validateLayoutData");var j=g(async(t,o,{insertCluster:e,insertEdge:n,insertEdgeLabel:r,insertMarkers:a,insertNode:y,log:l,positionEdgeLabel:x},{algorithm:W})=>{const u={},b={},f=o.select("g");a(f,t.markers,t.type,t.diagramId);const _=f.insert("g").attr("class","subgraphs"),E=f.insert("g").attr("class","edgePaths"),k=f.insert("g").attr("class","edgeLabels"),A=f.insert("g").attr("class","nodes");l.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(t.nodes.map(async s=>{if(s.isGroup){const i={...s};b[s.id]=i,u[s.id]=i,await e(_,s)}else{const i={...s};u[s.id]=i;const d=await y(A,s,{config:t.config,dir:t.direction||"TB"}),c=d.node().getBBox();i.width=c.width,i.height=c.height,i.domId=d,l.debug(`Node ${s.id} dimensions: ${c.width}x${c.height}`)}})),l.debug("Running cose-bilkent layout algorithm");const N={...t,nodes:t.nodes.map(s=>{const i=u[s.id];return{...s,width:i.width,height:i.height}})},p=await B(N,t.config);l.debug("Positioning nodes based on layout results"),p.nodes.forEach(s=>{const i=u[s.id];i!=null&&i.domId&&(i.domId.attr("transform",`translate(${s.x}, ${s.y})`),i.x=s.x,i.y=s.y,l.debug(`Positioned node ${i.id} at center (${s.x}, ${s.y})`))}
1),p.edges.forEach(s=>{const i=t.edges.find(d=>d.id===s.id);i&&(i.points=[{x:s.startX,y:s.startY},{x:s.midX,y:s.midY},{x:s.endX,y:s.endY}])}),l.debug("Inserting and positioning edges"),await Promise.all(t.edges.map(async s=>{const i=await r(k,s);l.info("_edgeLabel",i);const d=u[s.start??""],c=u[s.end??""];if(d&&c){const P=p.edges.find(h=>h.id===s.id);if(P){l.debug("APA01 positionedEdge",P);const h={...s},w=n(E,h,b,t.type,d,c,t.diagramId);x(h,w)}else{const h={...s,points:[{x:d.x||0,y:d.y||0},{x:c.x||0,y:c.y||0}]},w=n(E,h,b,t.type,d,c,t.diagramId);x(h,w)}}})),l.debug("Cose-bilkent rendering completed")},"render"),z=j;export{z as render};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.