mermaid
Version:
Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.
2 lines (1 loc) • 1.36 kB
JavaScript
import{a as i}from"./chunk-V3YWWTDH.mjs";function u(n){return`edge-label-${n.start}-${n.end}-${n.id}`}i(u,"edgeLabelFixtureId");function s(n){return`group-title-${n.id}`}i(s,"groupTitleFixtureId");function p(){if(!(typeof globalThis>"u"))return globalThis}i(p,"getCaptureGlobal");function h(){return!!p()?.mermaidCaptureSizes}i(h,"shouldCaptureSizes");function c(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}i(c,"capturedFromLocation");function m(n,a){let t=p();if(!t)return;let r=a.node(),d=((r&&"ownerSVGElement"in r?r.ownerSVGElement:null)??r)?.id??"(unknown)";t.mermaidCapturedSizes??=[];let o={svgId:d,sizes:n};t.mermaidCapturedSizes.push(o),t.mermaidLastCapturedSizes=o}i(m,"emitCapturedSizes");function C(n,a){let t=[];for(let e of a.nodes)e.isGroup||t.push({id:e.id,width:e.width??0,height:e.height??0});let r=new Set(t.map(e=>e.id));for(let e of a.edges){let d=typeof e.label=="string"?e.label.trim():e.label,o=u(e);!d||r.has(o)||typeof e.width!="number"||(r.add(o),t.push({id:o,width:e.width,height:e.height??0}))}for(let e of a.nodes)e.isGroup&&e.labelBBox&&t.push({id:s(e),width:e.labelBBox.width,height:e.labelBBox.height});t.length!==0&&m({metadata:{captureVersion:1,capturedAt:new Date().toISOString(),capturedFrom:c()},nodes:t},n)}i(C,"captureNodeSizes");export{C as captureNodeSizes,h as shouldCaptureSizes};