@superlc/md-core 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/_baseUniq-BfzcfZ4T.cjs +1 -0
  2. package/dist/_baseUniq-Y3ulau-C.js +477 -0
  3. package/dist/arc-Be_AVKBg.cjs +1 -0
  4. package/dist/arc-Ca7Zrknn.js +83 -0
  5. package/dist/architectureDiagram-VXUJARFQ-4Jx44yBn.cjs +36 -0
  6. package/dist/architectureDiagram-VXUJARFQ-DJeUU_qv.js +4665 -0
  7. package/dist/blockDiagram-VD42YOAC-BimcGKKd.cjs +122 -0
  8. package/dist/blockDiagram-VD42YOAC-D-giXjw6.js +2265 -0
  9. package/dist/c4Diagram-YG6GDRKO-Bl9iUUVb.cjs +10 -0
  10. package/dist/c4Diagram-YG6GDRKO-YxTtvGWw.js +1581 -0
  11. package/dist/channel-DOU_t-A5.js +5 -0
  12. package/dist/channel-DzR_mTuG.cjs +1 -0
  13. package/dist/chunk-4BX2VUAB-BT8x_a4k.cjs +1 -0
  14. package/dist/chunk-4BX2VUAB-qWjx6fvp.js +9 -0
  15. package/dist/chunk-55IACEB6-DRmMNyi7.js +8 -0
  16. package/dist/chunk-55IACEB6-DfzR1I2i.cjs +1 -0
  17. package/dist/chunk-B4BG7PRW-B4vBwkd7.js +1376 -0
  18. package/dist/chunk-B4BG7PRW-k_Ki7ZYa.cjs +165 -0
  19. package/dist/chunk-DI55MBZ5-67zt7BEa.cjs +220 -0
  20. package/dist/chunk-DI55MBZ5-B-Akunv8.js +1382 -0
  21. package/dist/chunk-FMBD7UC4-D-gJ-PKq.cjs +15 -0
  22. package/dist/chunk-FMBD7UC4-D1foMA2H.js +19 -0
  23. package/dist/chunk-QN33PNHL-DBsOH5IO.cjs +1 -0
  24. package/dist/chunk-QN33PNHL-DpeYRHMx.js +20 -0
  25. package/dist/chunk-QZHKN3VN-CWmChvMD.cjs +1 -0
  26. package/dist/chunk-QZHKN3VN-CoINyXCe.js +15 -0
  27. package/dist/chunk-TZMSLE5B-CMo-Qyqp.js +64 -0
  28. package/dist/chunk-TZMSLE5B-Psc_3Gkx.cjs +1 -0
  29. package/dist/classDiagram-2ON5EDUG-BrNHAA-E.js +16 -0
  30. package/dist/classDiagram-2ON5EDUG-CA1gbIW7.cjs +1 -0
  31. package/dist/classDiagram-v2-WZHVMYZB-BrNHAA-E.js +16 -0
  32. package/dist/classDiagram-v2-WZHVMYZB-CA1gbIW7.cjs +1 -0
  33. package/dist/clone-BOyua0mT.js +8 -0
  34. package/dist/clone-D7Rx0g6P.cjs +1 -0
  35. package/dist/cose-bilkent-S5V4N54A-BBcnamAX.cjs +1 -0
  36. package/dist/cose-bilkent-S5V4N54A-xbHM31av.js +2605 -0
  37. package/dist/cytoscape.esm-DkGgpG6d.cjs +331 -0
  38. package/dist/cytoscape.esm-ZmItrg9y.js +18731 -0
  39. package/dist/dagre-6UL2VRFP-B5ZJ9Mmw.cjs +4 -0
  40. package/dist/dagre-6UL2VRFP-lY6fElcy.js +446 -0
  41. package/dist/defaultLocale-BgPVtth8.js +171 -0
  42. package/dist/defaultLocale-C4wbwF1n.cjs +1 -0
  43. package/dist/diagram-PSM6KHXK-DOgpThfE.js +534 -0
  44. package/dist/diagram-PSM6KHXK-NUCrGNCX.cjs +24 -0
  45. package/dist/diagram-QEK2KX5R-CKpcqpBk.js +221 -0
  46. package/dist/diagram-QEK2KX5R-P-pWAYvp.cjs +43 -0
  47. package/dist/diagram-S2PKOQOG-B4PYQerv.cjs +24 -0
  48. package/dist/diagram-S2PKOQOG-CZn9lft8.js +143 -0
  49. package/dist/erDiagram-Q2GNP2WA-D6UL-dgf.js +842 -0
  50. package/dist/erDiagram-Q2GNP2WA-DwYOfnOX.cjs +60 -0
  51. package/dist/flowDiagram-NV44I4VS-BvuqC7lR.cjs +162 -0
  52. package/dist/flowDiagram-NV44I4VS-YPdRK_ji.js +1627 -0
  53. package/dist/ganttDiagram-JELNMOA3-CGnvf7yj.js +2662 -0
  54. package/dist/ganttDiagram-JELNMOA3-wbYrtCNf.cjs +267 -0
  55. package/dist/gitGraphDiagram-NY62KEGX-BnpFLmUy.js +712 -0
  56. package/dist/gitGraphDiagram-NY62KEGX-BzlCJL63.cjs +65 -0
  57. package/dist/graph-Bv0JC_B1.cjs +1 -0
  58. package/dist/graph-DwDboYRQ.js +381 -0
  59. package/dist/index-A-U0gtM4.js +15167 -0
  60. package/dist/index-BC30feOR.cjs +300 -0
  61. package/dist/index.cjs +1 -300
  62. package/dist/index.d.ts +2 -0
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +27 -14816
  65. package/dist/infoDiagram-WHAUD3N6-CPFFyZEz.cjs +2 -0
  66. package/dist/infoDiagram-WHAUD3N6-DF-Kn4KW.js +24 -0
  67. package/dist/init-CHZsXQcr.cjs +1 -0
  68. package/dist/init-DjUOC4st.js +16 -0
  69. package/dist/journeyDiagram-XKPGCS4Q-Bc3YJVQN.cjs +139 -0
  70. package/dist/journeyDiagram-XKPGCS4Q-CqUVbDan.js +836 -0
  71. package/dist/kanban-definition-3W4ZIXB7-BKxpdlfe.cjs +89 -0
  72. package/dist/kanban-definition-3W4ZIXB7-Zx7cVnZF.js +720 -0
  73. package/dist/layout-CrdknE74.js +1441 -0
  74. package/dist/layout-y4Mby5BC.cjs +1 -0
  75. package/dist/linear-D_NLLphh.cjs +1 -0
  76. package/dist/linear-Fqu_aevY.js +259 -0
  77. package/dist/mermaid/darkMode.d.ts +54 -0
  78. package/dist/mermaid/darkMode.d.ts.map +1 -0
  79. package/dist/mermaid/download.d.ts +27 -0
  80. package/dist/mermaid/download.d.ts.map +1 -0
  81. package/dist/mermaid/index.d.ts +9 -0
  82. package/dist/mermaid/index.d.ts.map +1 -0
  83. package/dist/mermaid/renderer.d.ts +36 -0
  84. package/dist/mermaid/renderer.d.ts.map +1 -0
  85. package/dist/mermaid/themes.d.ts +17 -0
  86. package/dist/mermaid/themes.d.ts.map +1 -0
  87. package/dist/mermaid/types.d.ts +117 -0
  88. package/dist/mermaid/types.d.ts.map +1 -0
  89. package/dist/mermaid.core-Buzus1hw.js +15321 -0
  90. package/dist/mermaid.core-CCMj67LO.cjs +255 -0
  91. package/dist/min-BNEwgiip.js +38 -0
  92. package/dist/min-CxfddLJo.cjs +1 -0
  93. package/dist/mindmap-definition-VGOIOE7T-C3sZAv1n.js +786 -0
  94. package/dist/mindmap-definition-VGOIOE7T-Cq9KhFIU.cjs +68 -0
  95. package/dist/ordinal-CagbB1m8.cjs +1 -0
  96. package/dist/ordinal-DfAQgscy.js +61 -0
  97. package/dist/pieDiagram-ADFJNKIX-Bib4GVaz.js +161 -0
  98. package/dist/pieDiagram-ADFJNKIX-CPJ4LdHJ.cjs +30 -0
  99. package/dist/quadrantDiagram-AYHSOK5B-Bw4qbzaI.js +1024 -0
  100. package/dist/quadrantDiagram-AYHSOK5B-Dldq3aFV.cjs +7 -0
  101. package/dist/requirementDiagram-UZGBJVZJ-BiMT5LBm.cjs +64 -0
  102. package/dist/requirementDiagram-UZGBJVZJ-DKt5E9D5.js +852 -0
  103. package/dist/sankeyDiagram-TZEHDZUN-BvqABFTj.cjs +10 -0
  104. package/dist/sankeyDiagram-TZEHDZUN-DPexJVr0.js +810 -0
  105. package/dist/sequenceDiagram-WL72ISMW-JcPuIgsZ.cjs +145 -0
  106. package/dist/sequenceDiagram-WL72ISMW-rx65Aq7k.js +2518 -0
  107. package/dist/stateDiagram-FKZM4ZOC-5jwz-EhH.cjs +1 -0
  108. package/dist/stateDiagram-FKZM4ZOC-D95elPzf.js +263 -0
  109. package/dist/stateDiagram-v2-4FDKWEC3-DKxcP1od.cjs +1 -0
  110. package/dist/stateDiagram-v2-4FDKWEC3-U8OyZJcH.js +16 -0
  111. package/dist/styles.css +292 -0
  112. package/dist/timeline-definition-IT6M3QCI-C_aFXPzu.cjs +61 -0
  113. package/dist/timeline-definition-IT6M3QCI-DzBIcxIH.js +801 -0
  114. package/dist/treemap-KMMF4GRG-CqQBq3TE.js +14157 -0
  115. package/dist/treemap-KMMF4GRG-DJHv4WOZ.cjs +128 -0
  116. package/dist/xychartDiagram-PRI3JC2R-M2dUh85s.cjs +7 -0
  117. package/dist/xychartDiagram-PRI3JC2R-ZNBNeiJf.js +1340 -0
  118. package/package.json +6 -2
@@ -0,0 +1,4 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./mermaid.core-CCMj67LO.cjs"),b=require("./graph-Bv0JC_B1.cjs"),G=require("./layout-y4Mby5BC.cjs"),R=require("./clone-D7Rx0g6P.cjs"),O=require("./min-CxfddLJo.cjs");function E(e){var o={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:M(e),edges:j(e)};return b.isUndefined(e.graph())||(o.value=R.clone(e.graph())),o}function M(e){return O.map(e.nodes(),function(o){var n=e.node(o),s=e.parent(o),c={v:o};return b.isUndefined(n)||(c.value=n),b.isUndefined(s)||(c.parent=s),c})}function j(e){return O.map(e.edges(),function(o){var n=e.edge(o),s={v:o.v,w:o.w};return b.isUndefined(o.name)||(s.name=o.name),b.isUndefined(n)||(s.value=n),s})}var f=new Map,p=new Map,P=new Map,q=t.__name(()=>{p.clear(),P.clear(),f.clear()},"clear"),x=t.__name((e,o)=>{const n=p.get(o)||[];return t.log.trace("In isDescendant",o," ",e," = ",n.includes(e)),n.includes(e)},"isDescendant"),F=t.__name((e,o)=>{const n=p.get(o)||[];return t.log.info("Descendants of ",o," is ",n),t.log.info("Edge is ",e),e.v===o||e.w===o?!1:n?n.includes(e.v)||x(e.v,o)||x(e.w,o)||n.includes(e.w):(t.log.debug("Tilt, ",o,",not in descendants"),!1)},"edgeInCluster"),k=t.__name((e,o,n,s)=>{t.log.warn("Copying children of ",e,"root",s,"data",o.node(e),s);const c=o.children(e)||[];e!==s&&c.push(e),t.log.warn("Copying (nodes) clusterId",e,"nodes",c),c.forEach(l=>{if(o.children(l).length>0)k(l,o,n,s);else{const r=o.node(l);t.log.info("cp ",l," to ",s," with parent ",e),n.setNode(l,r),s!==o.parent(l)&&(t.log.warn("Setting parent",l,o.parent(l)),n.setParent(l,o.parent(l))),e!==s&&l!==e?(t.log.debug("Setting parent",l,e),n.setParent(l,e)):(t.log.info("In copy ",e,"root",s,"data",o.node(e),s),t.log.debug("Not Setting parent for node=",l,"cluster!==rootId",e!==s,"node!==clusterId",l!==e));const g=o.edges(l);t.log.debug("Copying Edges",g),g.forEach(d=>{t.log.info("Edge",d);const v=o.edge(d.v,d.w,d.name);t.log.info("Edge data",v,s);try{F(d,s)?(t.log.info("Copying as ",d.v,d.w,v,d.name),n.setEdge(d.v,d.w,v,d.name),t.log.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):t.log.info("Skipping copy of edge ",d.v,"-->",d.w," rootId: ",s," clusterId:",e)}catch(C){t.log.error(C)}})}t.log.debug("Removing node",l),o.removeNode(l)})},"copy"),B=t.__name((e,o)=>{const n=o.children(e);let s=[...n];for(const c of n)P.set(c,e),s=[...s,...B(c,o)];return s},"extractDescendants"),U=t.__name((e,o,n)=>{const s=e.edges().filter(d=>d.v===o||d.w===o),c=e.edges().filter(d=>d.v===n||d.w===n),l=s.map(d=>({v:d.v===o?n:d.v,w:d.w===o?o:d.w})),r=c.map(d=>({v:d.v,w:d.w}));return l.filter(d=>r.some(v=>d.v===v.v&&d.w===v.w))},"findCommonEdges"),_=t.__name((e,o,n)=>{const s=o.children(e);if(t.log.trace("Searching children of id ",e,s),s.length<1)return e;let c;for(const l of s){const r=_(l,o,n),g=U(o,n,r);if(r)if(g.length>0)c=r;else return r}return c},"findNonClusterChild"),D=t.__name(e=>!f.has(e)||!f.get(e).externalConnections?e:f.has(e)?f.get(e).id:e,"getAnchorId"),Y=t.__name((e,o)=>{if(!e||o>10){t.log.debug("Opting out, no graph ");return}else t.log.debug("Opting in, graph ");e.nodes().forEach(function(n){e.children(n).length>0&&(t.log.warn("Cluster identified",n," Replacement id in edges: ",_(n,e,n)),p.set(n,B(n,e)),f.set(n,{id:_(n,e,n),clusterData:e.node(n)}))}),e.nodes().forEach(function(n){const s=e.children(n),c=e.edges();s.length>0?(t.log.debug("Cluster identified",n,p),c.forEach(l=>{const r=x(l.v,n),g=x(l.w,n);r^g&&(t.log.warn("Edge: ",l," leaves cluster ",n),t.log.warn("Descendants of XXX ",n,": ",p.get(n)),f.get(n).externalConnections=!0)})):t.log.debug("Not a cluster ",n,p)});for(let n of f.keys()){const s=f.get(n).id,c=e.parent(s);c!==n&&f.has(c)&&!f.get(c).externalConnections&&(f.get(n).id=c)}e.edges().forEach(function(n){const s=e.edge(n);t.log.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),t.log.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(e.edge(n)));let c=n.v,l=n.w;if(t.log.warn("Fix XXX",f,"ids:",n.v,n.w,"Translating: ",f.get(n.v)," --- ",f.get(n.w)),f.get(n.v)||f.get(n.w)){if(t.log.warn("Fixing and trying - removing XXX",n.v,n.w,n.name),c=D(n.v),l=D(n.w),e.removeEdge(n.v,n.w,n.name),c!==n.v){const r=e.parent(c);f.get(r).externalConnections=!0,s.fromCluster=n.v}if(l!==n.w){const r=e.parent(l);f.get(r).externalConnections=!0,s.toCluster=n.w}t.log.warn("Fix Replacing with XXX",c,l,n.name),e.setEdge(c,l,s,n.name)}}),t.log.warn("Adjusted Graph",E(e)),A(e,0),t.log.trace(f)},"adjustClustersAndEdges"),A=t.__name((e,o)=>{var c,l;if(t.log.warn("extractor - ",o,E(e),e.children("D")),o>10){t.log.error("Bailing out");return}let n=e.nodes(),s=!1;for(const r of n){const g=e.children(r);s=s||g.length>0}if(!s){t.log.debug("Done, no node has children",e.nodes());return}t.log.debug("Nodes = ",n,o);for(const r of n)if(t.log.debug("Extracting node",r,f,f.has(r)&&!f.get(r).externalConnections,!e.parent(r),e.node(r),e.children("D")," Depth ",o),!f.has(r))t.log.debug("Not a cluster",r,o);else if(!f.get(r).externalConnections&&e.children(r)&&e.children(r).length>0){t.log.warn("Cluster without external connections, without a parent and with children",r,o);let d=e.graph().rankdir==="TB"?"LR":"TB";(l=(c=f.get(r))==null?void 0:c.clusterData)!=null&&l.dir&&(d=f.get(r).clusterData.dir,t.log.warn("Fixing dir",f.get(r).clusterData.dir,d));const v=new b.Graph({multigraph:!0,compound:!0}).setGraph({rankdir:d,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});t.log.warn("Old graph before copy",E(e)),k(r,e,v,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:f.get(r).clusterData,label:f.get(r).label,graph:v}),t.log.warn("New graph after copy node: (",r,")",E(v)),t.log.debug("Old graph after copy",E(e))}else t.log.warn("Cluster ** ",r," **not meeting the criteria !externalConnections:",!f.get(r).externalConnections," no parent: ",!e.parent(r)," children ",e.children(r)&&e.children(r).length>0,e.children("D"),o),t.log.debug(f);n=e.nodes(),t.log.warn("New list of nodes",n);for(const r of n){const g=e.node(r);t.log.warn(" Now next level",r,g),g!=null&&g.clusterNode&&A(g.graph,o+1)}},"extractor"),J=t.__name((e,o)=>{if(o.length===0)return[];let n=Object.assign([],o);return o.forEach(s=>{const c=e.children(s),l=J(e,c);n=[...n,...l]}),n},"sorter"),H=t.__name(e=>J(e,e.children()),"sortNodesByHierarchy"),T=t.__name(async(e,o,n,s,c,l)=>{t.log.warn("Graph in recursive render:XAX",E(o),c);const r=o.graph().rankdir;t.log.trace("Dir in recursive render - dir:",r);const g=e.insert("g").attr("class","root");o.nodes()?t.log.info("Recursive render XXX",o.nodes()):t.log.info("No nodes found for",o),o.edges().length>0&&t.log.info("Recursive edges",o.edge(o.edges()[0]));const d=g.insert("g").attr("class","clusters"),v=g.insert("g").attr("class","edgePaths"),C=g.insert("g").attr("class","edgeLabels"),u=g.insert("g").attr("class","nodes");await Promise.all(o.nodes().map(async function(a){const i=o.node(a);if(c!==void 0){const w=JSON.parse(JSON.stringify(c.clusterData));t.log.trace(`Setting data for parent cluster XXX
2
+ Node.id = `,a,`
3
+ data=`,w.height,`
4
+ Parent cluster`,c.height),o.setNode(c.id,w),o.parent(a)||(t.log.trace("Setting parent",a,c.id),o.setParent(a,c.id,w))}if(t.log.info("(Insert) Node XXX"+a+": "+JSON.stringify(o.node(a))),i!=null&&i.clusterNode){t.log.info("Cluster identified XBX",a,i.width,o.node(a));const{ranksep:w,nodesep:m}=o.graph();i.graph.setGraph({...i.graph.graph(),ranksep:w+25,nodesep:m});const N=await T(u,i.graph,n,s,o.node(a),l),S=N.elem;t.updateNodeBounds(i,S),i.diff=N.diff||0,t.log.info("New compound node after recursive render XAX",a,"width",i.width,"height",i.height),t.setNodeElem(S,i)}else o.children(a).length>0?(t.log.trace("Cluster - the non recursive path XBX",a,i.id,i,i.width,"Graph:",o),t.log.trace(_(i.id,o)),f.set(i.id,{id:_(i.id,o),node:i})):(t.log.trace("Node - the non recursive path XAX",a,u,o.node(a),r),await t.insertNode(u,o.node(a),{config:l,dir:r}))})),await t.__name(async()=>{const a=o.edges().map(async function(i){const w=o.edge(i.v,i.w,i.name);t.log.info("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(i)),t.log.info("Edge "+i.v+" -> "+i.w+": ",i," ",JSON.stringify(o.edge(i))),t.log.info("Fix",f,"ids:",i.v,i.w,"Translating: ",f.get(i.v),f.get(i.w)),await t.insertEdgeLabel(C,w)});await Promise.all(a)},"processEdges")(),t.log.info("Graph before layout:",JSON.stringify(E(o))),t.log.info("############################################# XXX"),t.log.info("### Layout ### XXX"),t.log.info("############################################# XXX"),G.layout(o),t.log.info("Graph after layout:",JSON.stringify(E(o)));let X=0,{subGraphTitleTotalMargin:y}=t.getSubGraphTitleMargins(l);return await Promise.all(H(o).map(async function(a){var w;const i=o.node(a);if(t.log.info("Position XBX => "+a+": ("+i.x,","+i.y,") width: ",i.width," height: ",i.height),i!=null&&i.clusterNode)i.y+=y,t.log.info("A tainted cluster node XBX1",a,i.id,i.width,i.height,i.x,i.y,o.parent(a)),f.get(i.id).node=i,t.positionNode(i);else if(o.children(a).length>0){t.log.info("A pure cluster node XBX1",a,i.id,i.x,i.y,i.width,i.height,o.parent(a)),i.height+=y,o.node(i.parentId);const m=(i==null?void 0:i.padding)/2||0,N=((w=i==null?void 0:i.labelBBox)==null?void 0:w.height)||0,S=N-m||0;t.log.debug("OffsetY",S,"labelHeight",N,"halfPadding",m),await t.insertCluster(d,i),f.get(i.id).node=i}else{const m=o.node(i.parentId);i.y+=y/2,t.log.info("A regular node XBX1 - using the padding",i.id,"parent",i.parentId,i.width,i.height,i.x,i.y,"offsetY",i.offsetY,"parent",m,m==null?void 0:m.offsetY,i),t.positionNode(i)}})),o.edges().forEach(function(a){const i=o.edge(a);t.log.info("Edge "+a.v+" -> "+a.w+": "+JSON.stringify(i),i),i.points.forEach(S=>S.y+=y/2);const w=o.node(a.v);var m=o.node(a.w);const N=t.insertEdge(v,i,f,n,w,m,s);t.positionEdgeLabel(i,N)}),o.nodes().forEach(function(a){const i=o.node(a);t.log.info(a,i.type,i.diff),i.isGroup&&(X=i.diff)}),t.log.warn("Returning from recursive render XAX",g,X),{elem:g,diff:X}},"recursiveRender"),V=t.__name(async(e,o)=>{var l,r,g,d,v,C;const n=new b.Graph({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:((l=e.config)==null?void 0:l.nodeSpacing)||((g=(r=e.config)==null?void 0:r.flowchart)==null?void 0:g.nodeSpacing)||e.nodeSpacing,ranksep:((d=e.config)==null?void 0:d.rankSpacing)||((C=(v=e.config)==null?void 0:v.flowchart)==null?void 0:C.rankSpacing)||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),s=o.select("g");t.markers_default(s,e.markers,e.type,e.diagramId),t.clear2(),t.clear$1(),t.clear$2(),q(),e.nodes.forEach(u=>{n.setNode(u.id,{...u}),u.parentId&&n.setParent(u.id,u.parentId)}),t.log.debug("Edges:",e.edges),e.edges.forEach(u=>{if(u.start===u.end){const h=u.start,X=h+"---"+h+"---1",y=h+"---"+h+"---2",a=n.node(h);n.setNode(X,{domId:X,id:X,parentId:a.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),n.setParent(X,a.parentId),n.setNode(y,{domId:y,id:y,parentId:a.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),n.setParent(y,a.parentId);const i=structuredClone(u),w=structuredClone(u),m=structuredClone(u);i.label="",i.arrowTypeEnd="none",i.id=h+"-cyclic-special-1",w.arrowTypeStart="none",w.arrowTypeEnd="none",w.id=h+"-cyclic-special-mid",m.label="",a.isGroup&&(i.fromCluster=h,m.toCluster=h),m.id=h+"-cyclic-special-2",m.arrowTypeStart="none",n.setEdge(h,X,i,h+"-cyclic-special-0"),n.setEdge(X,y,w,h+"-cyclic-special-1"),n.setEdge(y,h,m,h+"-cyc<lic-special-2")}else n.setEdge(u.start,u.end,{...u},u.id)}),t.log.warn("Graph at first:",JSON.stringify(E(n))),Y(n),t.log.warn("Graph after XAX:",JSON.stringify(E(n)));const c=t.getConfig2();await T(s,n,e.type,e.diagramId,void 0,c)},"render");exports.render=V;
@@ -0,0 +1,446 @@
1
+ import { _ as X, ar as F, as as Y, at as _, au as H, l as i, c as V, av as z, aw as U, ag as $, al as q, ah as P, af as K, ax as Q, ay as W, az as Z } from "./mermaid.core-Buzus1hw.js";
2
+ import { i as x, G as B } from "./graph-DwDboYRQ.js";
3
+ import { l as I } from "./layout-CrdknE74.js";
4
+ import { c as L } from "./clone-BOyua0mT.js";
5
+ import { m as A } from "./min-BNEwgiip.js";
6
+ function p(e) {
7
+ var t = {
8
+ options: {
9
+ directed: e.isDirected(),
10
+ multigraph: e.isMultigraph(),
11
+ compound: e.isCompound()
12
+ },
13
+ nodes: ee(e),
14
+ edges: ne(e)
15
+ };
16
+ return x(e.graph()) || (t.value = L(e.graph())), t;
17
+ }
18
+ function ee(e) {
19
+ return A(e.nodes(), function(t) {
20
+ var n = e.node(t), o = e.parent(t), c = { v: t };
21
+ return x(n) || (c.value = n), x(o) || (c.parent = o), c;
22
+ });
23
+ }
24
+ function ne(e) {
25
+ return A(e.edges(), function(t) {
26
+ var n = e.edge(t), o = { v: t.v, w: t.w };
27
+ return x(t.name) || (o.name = t.name), x(n) || (o.value = n), o;
28
+ });
29
+ }
30
+ var f = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ X(() => {
31
+ b.clear(), J.clear(), f.clear();
32
+ }, "clear"), O = /* @__PURE__ */ X((e, t) => {
33
+ const n = b.get(t) || [];
34
+ return i.trace("In isDescendant", t, " ", e, " = ", n.includes(e)), n.includes(e);
35
+ }, "isDescendant"), se = /* @__PURE__ */ X((e, t) => {
36
+ const n = b.get(t) || [];
37
+ return i.info("Descendants of ", t, " is ", n), i.info("Edge is ", e), e.v === t || e.w === t ? !1 : n ? n.includes(e.v) || O(e.v, t) || O(e.w, t) || n.includes(e.w) : (i.debug("Tilt, ", t, ",not in descendants"), !1);
38
+ }, "edgeInCluster"), G = /* @__PURE__ */ X((e, t, n, o) => {
39
+ i.warn(
40
+ "Copying children of ",
41
+ e,
42
+ "root",
43
+ o,
44
+ "data",
45
+ t.node(e),
46
+ o
47
+ );
48
+ const c = t.children(e) || [];
49
+ e !== o && c.push(e), i.warn("Copying (nodes) clusterId", e, "nodes", c), c.forEach((a) => {
50
+ if (t.children(a).length > 0)
51
+ G(a, t, n, o);
52
+ else {
53
+ const r = t.node(a);
54
+ i.info("cp ", a, " to ", o, " with parent ", e), n.setNode(a, r), o !== t.parent(a) && (i.warn("Setting parent", a, t.parent(a)), n.setParent(a, t.parent(a))), e !== o && a !== e ? (i.debug("Setting parent", a, e), n.setParent(a, e)) : (i.info("In copy ", e, "root", o, "data", t.node(e), o), i.debug(
55
+ "Not Setting parent for node=",
56
+ a,
57
+ "cluster!==rootId",
58
+ e !== o,
59
+ "node!==clusterId",
60
+ a !== e
61
+ ));
62
+ const u = t.edges(a);
63
+ i.debug("Copying Edges", u), u.forEach((l) => {
64
+ i.info("Edge", l);
65
+ const v = t.edge(l.v, l.w, l.name);
66
+ i.info("Edge data", v, o);
67
+ try {
68
+ se(l, o) ? (i.info("Copying as ", l.v, l.w, v, l.name), n.setEdge(l.v, l.w, v, l.name), i.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : i.info(
69
+ "Skipping copy of edge ",
70
+ l.v,
71
+ "-->",
72
+ l.w,
73
+ " rootId: ",
74
+ o,
75
+ " clusterId:",
76
+ e
77
+ );
78
+ } catch (C) {
79
+ i.error(C);
80
+ }
81
+ });
82
+ }
83
+ i.debug("Removing node", a), t.removeNode(a);
84
+ });
85
+ }, "copy"), R = /* @__PURE__ */ X((e, t) => {
86
+ const n = t.children(e);
87
+ let o = [...n];
88
+ for (const c of n)
89
+ J.set(c, e), o = [...o, ...R(c, t)];
90
+ return o;
91
+ }, "extractDescendants"), ie = /* @__PURE__ */ X((e, t, n) => {
92
+ const o = e.edges().filter((l) => l.v === t || l.w === t), c = e.edges().filter((l) => l.v === n || l.w === n), a = o.map((l) => ({ v: l.v === t ? n : l.v, w: l.w === t ? t : l.w })), r = c.map((l) => ({ v: l.v, w: l.w }));
93
+ return a.filter((l) => r.some((v) => l.v === v.v && l.w === v.w));
94
+ }, "findCommonEdges"), D = /* @__PURE__ */ X((e, t, n) => {
95
+ const o = t.children(e);
96
+ if (i.trace("Searching children of id ", e, o), o.length < 1)
97
+ return e;
98
+ let c;
99
+ for (const a of o) {
100
+ const r = D(a, t, n), u = ie(t, n, r);
101
+ if (r)
102
+ if (u.length > 0)
103
+ c = r;
104
+ else
105
+ return r;
106
+ }
107
+ return c;
108
+ }, "findNonClusterChild"), k = /* @__PURE__ */ X((e) => !f.has(e) || !f.get(e).externalConnections ? e : f.has(e) ? f.get(e).id : e, "getAnchorId"), re = /* @__PURE__ */ X((e, t) => {
109
+ if (!e || t > 10) {
110
+ i.debug("Opting out, no graph ");
111
+ return;
112
+ } else
113
+ i.debug("Opting in, graph ");
114
+ e.nodes().forEach(function(n) {
115
+ e.children(n).length > 0 && (i.warn(
116
+ "Cluster identified",
117
+ n,
118
+ " Replacement id in edges: ",
119
+ D(n, e, n)
120
+ ), b.set(n, R(n, e)), f.set(n, { id: D(n, e, n), clusterData: e.node(n) }));
121
+ }), e.nodes().forEach(function(n) {
122
+ const o = e.children(n), c = e.edges();
123
+ o.length > 0 ? (i.debug("Cluster identified", n, b), c.forEach((a) => {
124
+ const r = O(a.v, n), u = O(a.w, n);
125
+ r ^ u && (i.warn("Edge: ", a, " leaves cluster ", n), i.warn("Descendants of XXX ", n, ": ", b.get(n)), f.get(n).externalConnections = !0);
126
+ })) : i.debug("Not a cluster ", n, b);
127
+ });
128
+ for (let n of f.keys()) {
129
+ const o = f.get(n).id, c = e.parent(o);
130
+ c !== n && f.has(c) && !f.get(c).externalConnections && (f.get(n).id = c);
131
+ }
132
+ e.edges().forEach(function(n) {
133
+ const o = e.edge(n);
134
+ i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n)));
135
+ let c = n.v, a = n.w;
136
+ if (i.warn(
137
+ "Fix XXX",
138
+ f,
139
+ "ids:",
140
+ n.v,
141
+ n.w,
142
+ "Translating: ",
143
+ f.get(n.v),
144
+ " --- ",
145
+ f.get(n.w)
146
+ ), f.get(n.v) || f.get(n.w)) {
147
+ if (i.warn("Fixing and trying - removing XXX", n.v, n.w, n.name), c = k(n.v), a = k(n.w), e.removeEdge(n.v, n.w, n.name), c !== n.v) {
148
+ const r = e.parent(c);
149
+ f.get(r).externalConnections = !0, o.fromCluster = n.v;
150
+ }
151
+ if (a !== n.w) {
152
+ const r = e.parent(a);
153
+ f.get(r).externalConnections = !0, o.toCluster = n.w;
154
+ }
155
+ i.warn("Fix Replacing with XXX", c, a, n.name), e.setEdge(c, a, o, n.name);
156
+ }
157
+ }), i.warn("Adjusted Graph", p(e)), T(e, 0), i.trace(f);
158
+ }, "adjustClustersAndEdges"), T = /* @__PURE__ */ X((e, t) => {
159
+ var c, a;
160
+ if (i.warn("extractor - ", t, p(e), e.children("D")), t > 10) {
161
+ i.error("Bailing out");
162
+ return;
163
+ }
164
+ let n = e.nodes(), o = !1;
165
+ for (const r of n) {
166
+ const u = e.children(r);
167
+ o = o || u.length > 0;
168
+ }
169
+ if (!o) {
170
+ i.debug("Done, no node has children", e.nodes());
171
+ return;
172
+ }
173
+ i.debug("Nodes = ", n, t);
174
+ for (const r of n)
175
+ if (i.debug(
176
+ "Extracting node",
177
+ r,
178
+ f,
179
+ f.has(r) && !f.get(r).externalConnections,
180
+ !e.parent(r),
181
+ e.node(r),
182
+ e.children("D"),
183
+ " Depth ",
184
+ t
185
+ ), !f.has(r))
186
+ i.debug("Not a cluster", r, t);
187
+ else if (!f.get(r).externalConnections && e.children(r) && e.children(r).length > 0) {
188
+ i.warn(
189
+ "Cluster without external connections, without a parent and with children",
190
+ r,
191
+ t
192
+ );
193
+ let l = e.graph().rankdir === "TB" ? "LR" : "TB";
194
+ (a = (c = f.get(r)) == null ? void 0 : c.clusterData) != null && a.dir && (l = f.get(r).clusterData.dir, i.warn("Fixing dir", f.get(r).clusterData.dir, l));
195
+ const v = new B({
196
+ multigraph: !0,
197
+ compound: !0
198
+ }).setGraph({
199
+ rankdir: l,
200
+ nodesep: 50,
201
+ ranksep: 50,
202
+ marginx: 8,
203
+ marginy: 8
204
+ }).setDefaultEdgeLabel(function() {
205
+ return {};
206
+ });
207
+ i.warn("Old graph before copy", p(e)), G(r, e, v, r), e.setNode(r, {
208
+ clusterNode: !0,
209
+ id: r,
210
+ clusterData: f.get(r).clusterData,
211
+ label: f.get(r).label,
212
+ graph: v
213
+ }), i.warn("New graph after copy node: (", r, ")", p(v)), i.debug("Old graph after copy", p(e));
214
+ } else
215
+ i.warn(
216
+ "Cluster ** ",
217
+ r,
218
+ " **not meeting the criteria !externalConnections:",
219
+ !f.get(r).externalConnections,
220
+ " no parent: ",
221
+ !e.parent(r),
222
+ " children ",
223
+ e.children(r) && e.children(r).length > 0,
224
+ e.children("D"),
225
+ t
226
+ ), i.debug(f);
227
+ n = e.nodes(), i.warn("New list of nodes", n);
228
+ for (const r of n) {
229
+ const u = e.node(r);
230
+ i.warn(" Now next level", r, u), u != null && u.clusterNode && T(u.graph, t + 1);
231
+ }
232
+ }, "extractor"), M = /* @__PURE__ */ X((e, t) => {
233
+ if (t.length === 0)
234
+ return [];
235
+ let n = Object.assign([], t);
236
+ return t.forEach((o) => {
237
+ const c = e.children(o), a = M(e, c);
238
+ n = [...n, ...a];
239
+ }), n;
240
+ }, "sorter"), oe = /* @__PURE__ */ X((e) => M(e, e.children()), "sortNodesByHierarchy"), j = /* @__PURE__ */ X(async (e, t, n, o, c, a) => {
241
+ i.warn("Graph in recursive render:XAX", p(t), c);
242
+ const r = t.graph().rankdir;
243
+ i.trace("Dir in recursive render - dir:", r);
244
+ const u = e.insert("g").attr("class", "root");
245
+ t.nodes() ? i.info("Recursive render XXX", t.nodes()) : i.info("No nodes found for", t), t.edges().length > 0 && i.info("Recursive edges", t.edge(t.edges()[0]));
246
+ const l = u.insert("g").attr("class", "clusters"), v = u.insert("g").attr("class", "edgePaths"), C = u.insert("g").attr("class", "edgeLabels"), g = u.insert("g").attr("class", "nodes");
247
+ await Promise.all(
248
+ t.nodes().map(async function(d) {
249
+ const s = t.node(d);
250
+ if (c !== void 0) {
251
+ const w = JSON.parse(JSON.stringify(c.clusterData));
252
+ i.trace(
253
+ `Setting data for parent cluster XXX
254
+ Node.id = `,
255
+ d,
256
+ `
257
+ data=`,
258
+ w.height,
259
+ `
260
+ Parent cluster`,
261
+ c.height
262
+ ), t.setNode(c.id, w), t.parent(d) || (i.trace("Setting parent", d, c.id), t.setParent(d, c.id, w));
263
+ }
264
+ if (i.info("(Insert) Node XXX" + d + ": " + JSON.stringify(t.node(d))), s != null && s.clusterNode) {
265
+ i.info("Cluster identified XBX", d, s.width, t.node(d));
266
+ const { ranksep: w, nodesep: m } = t.graph();
267
+ s.graph.setGraph({
268
+ ...s.graph.graph(),
269
+ ranksep: w + 25,
270
+ nodesep: m
271
+ });
272
+ const N = await j(
273
+ g,
274
+ s.graph,
275
+ n,
276
+ o,
277
+ t.node(d),
278
+ a
279
+ ), S = N.elem;
280
+ z(s, S), s.diff = N.diff || 0, i.info(
281
+ "New compound node after recursive render XAX",
282
+ d,
283
+ "width",
284
+ // node,
285
+ s.width,
286
+ "height",
287
+ s.height
288
+ // node.x,
289
+ // node.y
290
+ ), U(S, s);
291
+ } else
292
+ t.children(d).length > 0 ? (i.trace(
293
+ "Cluster - the non recursive path XBX",
294
+ d,
295
+ s.id,
296
+ s,
297
+ s.width,
298
+ "Graph:",
299
+ t
300
+ ), i.trace(D(s.id, t)), f.set(s.id, { id: D(s.id, t), node: s })) : (i.trace("Node - the non recursive path XAX", d, g, t.node(d), r), await $(g, t.node(d), { config: a, dir: r }));
301
+ })
302
+ ), await (/* @__PURE__ */ X(async () => {
303
+ const d = t.edges().map(async function(s) {
304
+ const w = t.edge(s.v, s.w, s.name);
305
+ i.info("Edge " + s.v + " -> " + s.w + ": " + JSON.stringify(s)), i.info("Edge " + s.v + " -> " + s.w + ": ", s, " ", JSON.stringify(t.edge(s))), i.info(
306
+ "Fix",
307
+ f,
308
+ "ids:",
309
+ s.v,
310
+ s.w,
311
+ "Translating: ",
312
+ f.get(s.v),
313
+ f.get(s.w)
314
+ ), await Z(C, w);
315
+ });
316
+ await Promise.all(d);
317
+ }, "processEdges"))(), i.info("Graph before layout:", JSON.stringify(p(t))), i.info("############################################# XXX"), i.info("### Layout ### XXX"), i.info("############################################# XXX"), I(t), i.info("Graph after layout:", JSON.stringify(p(t)));
318
+ let E = 0, { subGraphTitleTotalMargin: y } = q(a);
319
+ return await Promise.all(
320
+ oe(t).map(async function(d) {
321
+ var w;
322
+ const s = t.node(d);
323
+ if (i.info(
324
+ "Position XBX => " + d + ": (" + s.x,
325
+ "," + s.y,
326
+ ") width: ",
327
+ s.width,
328
+ " height: ",
329
+ s.height
330
+ ), s != null && s.clusterNode)
331
+ s.y += y, i.info(
332
+ "A tainted cluster node XBX1",
333
+ d,
334
+ s.id,
335
+ s.width,
336
+ s.height,
337
+ s.x,
338
+ s.y,
339
+ t.parent(d)
340
+ ), f.get(s.id).node = s, P(s);
341
+ else if (t.children(d).length > 0) {
342
+ i.info(
343
+ "A pure cluster node XBX1",
344
+ d,
345
+ s.id,
346
+ s.x,
347
+ s.y,
348
+ s.width,
349
+ s.height,
350
+ t.parent(d)
351
+ ), s.height += y, t.node(s.parentId);
352
+ const m = (s == null ? void 0 : s.padding) / 2 || 0, N = ((w = s == null ? void 0 : s.labelBBox) == null ? void 0 : w.height) || 0, S = N - m || 0;
353
+ i.debug("OffsetY", S, "labelHeight", N, "halfPadding", m), await K(l, s), f.get(s.id).node = s;
354
+ } else {
355
+ const m = t.node(s.parentId);
356
+ s.y += y / 2, i.info(
357
+ "A regular node XBX1 - using the padding",
358
+ s.id,
359
+ "parent",
360
+ s.parentId,
361
+ s.width,
362
+ s.height,
363
+ s.x,
364
+ s.y,
365
+ "offsetY",
366
+ s.offsetY,
367
+ "parent",
368
+ m,
369
+ m == null ? void 0 : m.offsetY,
370
+ s
371
+ ), P(s);
372
+ }
373
+ })
374
+ ), t.edges().forEach(function(d) {
375
+ const s = t.edge(d);
376
+ i.info("Edge " + d.v + " -> " + d.w + ": " + JSON.stringify(s), s), s.points.forEach((S) => S.y += y / 2);
377
+ const w = t.node(d.v);
378
+ var m = t.node(d.w);
379
+ const N = Q(v, s, f, n, w, m, o);
380
+ W(s, N);
381
+ }), t.nodes().forEach(function(d) {
382
+ const s = t.node(d);
383
+ i.info(d, s.type, s.diff), s.isGroup && (E = s.diff);
384
+ }), i.warn("Returning from recursive render XAX", u, E), { elem: u, diff: E };
385
+ }, "recursiveRender"), ue = /* @__PURE__ */ X(async (e, t) => {
386
+ var a, r, u, l, v, C;
387
+ const n = new B({
388
+ multigraph: !0,
389
+ compound: !0
390
+ }).setGraph({
391
+ rankdir: e.direction,
392
+ nodesep: ((a = e.config) == null ? void 0 : a.nodeSpacing) || ((u = (r = e.config) == null ? void 0 : r.flowchart) == null ? void 0 : u.nodeSpacing) || e.nodeSpacing,
393
+ ranksep: ((l = e.config) == null ? void 0 : l.rankSpacing) || ((C = (v = e.config) == null ? void 0 : v.flowchart) == null ? void 0 : C.rankSpacing) || e.rankSpacing,
394
+ marginx: 8,
395
+ marginy: 8
396
+ }).setDefaultEdgeLabel(function() {
397
+ return {};
398
+ }), o = t.select("g");
399
+ F(o, e.markers, e.type, e.diagramId), Y(), _(), H(), te(), e.nodes.forEach((g) => {
400
+ n.setNode(g.id, { ...g }), g.parentId && n.setParent(g.id, g.parentId);
401
+ }), i.debug("Edges:", e.edges), e.edges.forEach((g) => {
402
+ if (g.start === g.end) {
403
+ const h = g.start, E = h + "---" + h + "---1", y = h + "---" + h + "---2", d = n.node(h);
404
+ n.setNode(E, {
405
+ domId: E,
406
+ id: E,
407
+ parentId: d.parentId,
408
+ labelStyle: "",
409
+ label: "",
410
+ padding: 0,
411
+ shape: "labelRect",
412
+ // shape: 'rect',
413
+ style: "",
414
+ width: 10,
415
+ height: 10
416
+ }), n.setParent(E, d.parentId), n.setNode(y, {
417
+ domId: y,
418
+ id: y,
419
+ parentId: d.parentId,
420
+ labelStyle: "",
421
+ padding: 0,
422
+ // shape: 'rect',
423
+ shape: "labelRect",
424
+ label: "",
425
+ style: "",
426
+ width: 10,
427
+ height: 10
428
+ }), n.setParent(y, d.parentId);
429
+ const s = structuredClone(g), w = structuredClone(g), m = structuredClone(g);
430
+ s.label = "", s.arrowTypeEnd = "none", s.id = h + "-cyclic-special-1", w.arrowTypeStart = "none", w.arrowTypeEnd = "none", w.id = h + "-cyclic-special-mid", m.label = "", d.isGroup && (s.fromCluster = h, m.toCluster = h), m.id = h + "-cyclic-special-2", m.arrowTypeStart = "none", n.setEdge(h, E, s, h + "-cyclic-special-0"), n.setEdge(E, y, w, h + "-cyclic-special-1"), n.setEdge(y, h, m, h + "-cyc<lic-special-2");
431
+ } else
432
+ n.setEdge(g.start, g.end, { ...g }, g.id);
433
+ }), i.warn("Graph at first:", JSON.stringify(p(n))), re(n), i.warn("Graph after XAX:", JSON.stringify(p(n)));
434
+ const c = V();
435
+ await j(
436
+ o,
437
+ n,
438
+ e.type,
439
+ e.diagramId,
440
+ void 0,
441
+ c
442
+ );
443
+ }, "render");
444
+ export {
445
+ ue as render
446
+ };
@@ -0,0 +1,171 @@
1
+ function J(n) {
2
+ return Math.abs(n = Math.round(n)) >= 1e21 ? n.toLocaleString("en").replace(/,/g, "") : n.toString(10);
3
+ }
4
+ function j(n, t) {
5
+ if (!isFinite(n) || n === 0) return null;
6
+ var e = (n = t ? n.toExponential(t - 1) : n.toExponential()).indexOf("e"), i = n.slice(0, e);
7
+ return [
8
+ i.length > 1 ? i[0] + i.slice(2) : i,
9
+ +n.slice(e + 1)
10
+ ];
11
+ }
12
+ function K(n) {
13
+ return n = j(Math.abs(n)), n ? n[1] : NaN;
14
+ }
15
+ function Q(n, t) {
16
+ return function(e, i) {
17
+ for (var o = e.length, a = [], c = 0, h = n[0], M = 0; o > 0 && h > 0 && (M + h + 1 > i && (h = Math.max(1, i - M)), a.push(e.substring(o -= h, o + h)), !((M += h + 1) > i)); )
18
+ h = n[c = (c + 1) % n.length];
19
+ return a.reverse().join(t);
20
+ };
21
+ }
22
+ function V(n) {
23
+ return function(t) {
24
+ return t.replace(/[0-9]/g, function(e) {
25
+ return n[+e];
26
+ });
27
+ };
28
+ }
29
+ var W = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
30
+ function $(n) {
31
+ if (!(t = W.exec(n))) throw new Error("invalid format: " + n);
32
+ var t;
33
+ return new L({
34
+ fill: t[1],
35
+ align: t[2],
36
+ sign: t[3],
37
+ symbol: t[4],
38
+ zero: t[5],
39
+ width: t[6],
40
+ comma: t[7],
41
+ precision: t[8] && t[8].slice(1),
42
+ trim: t[9],
43
+ type: t[10]
44
+ });
45
+ }
46
+ $.prototype = L.prototype;
47
+ function L(n) {
48
+ this.fill = n.fill === void 0 ? " " : n.fill + "", this.align = n.align === void 0 ? ">" : n.align + "", this.sign = n.sign === void 0 ? "-" : n.sign + "", this.symbol = n.symbol === void 0 ? "" : n.symbol + "", this.zero = !!n.zero, this.width = n.width === void 0 ? void 0 : +n.width, this.comma = !!n.comma, this.precision = n.precision === void 0 ? void 0 : +n.precision, this.trim = !!n.trim, this.type = n.type === void 0 ? "" : n.type + "";
49
+ }
50
+ L.prototype.toString = function() {
51
+ return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
52
+ };
53
+ function _(n) {
54
+ n: for (var t = n.length, e = 1, i = -1, o; e < t; ++e)
55
+ switch (n[e]) {
56
+ case ".":
57
+ i = o = e;
58
+ break;
59
+ case "0":
60
+ i === 0 && (i = e), o = e;
61
+ break;
62
+ default:
63
+ if (!+n[e]) break n;
64
+ i > 0 && (i = 0);
65
+ break;
66
+ }
67
+ return i > 0 ? n.slice(0, i) + n.slice(o + 1) : n;
68
+ }
69
+ var N;
70
+ function v(n, t) {
71
+ var e = j(n, t);
72
+ if (!e) return N = void 0, n.toPrecision(t);
73
+ var i = e[0], o = e[1], a = o - (N = Math.max(-8, Math.min(8, Math.floor(o / 3))) * 3) + 1, c = i.length;
74
+ return a === c ? i : a > c ? i + new Array(a - c + 1).join("0") : a > 0 ? i.slice(0, a) + "." + i.slice(a) : "0." + new Array(1 - a).join("0") + j(n, Math.max(0, t + a - 1))[0];
75
+ }
76
+ function X(n, t) {
77
+ var e = j(n, t);
78
+ if (!e) return n + "";
79
+ var i = e[0], o = e[1];
80
+ return o < 0 ? "0." + new Array(-o).join("0") + i : i.length > o + 1 ? i.slice(0, o + 1) + "." + i.slice(o + 1) : i + new Array(o - i.length + 2).join("0");
81
+ }
82
+ const O = {
83
+ "%": (n, t) => (n * 100).toFixed(t),
84
+ b: (n) => Math.round(n).toString(2),
85
+ c: (n) => n + "",
86
+ d: J,
87
+ e: (n, t) => n.toExponential(t),
88
+ f: (n, t) => n.toFixed(t),
89
+ g: (n, t) => n.toPrecision(t),
90
+ o: (n) => Math.round(n).toString(8),
91
+ p: (n, t) => X(n * 100, t),
92
+ r: X,
93
+ s: v,
94
+ X: (n) => Math.round(n).toString(16).toUpperCase(),
95
+ x: (n) => Math.round(n).toString(16)
96
+ };
97
+ function R(n) {
98
+ return n;
99
+ }
100
+ var U = Array.prototype.map, Y = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
101
+ function nn(n) {
102
+ var t = n.grouping === void 0 || n.thousands === void 0 ? R : Q(U.call(n.grouping, Number), n.thousands + ""), e = n.currency === void 0 ? "" : n.currency[0] + "", i = n.currency === void 0 ? "" : n.currency[1] + "", o = n.decimal === void 0 ? "." : n.decimal + "", a = n.numerals === void 0 ? R : V(U.call(n.numerals, String)), c = n.percent === void 0 ? "%" : n.percent + "", h = n.minus === void 0 ? "−" : n.minus + "", M = n.nan === void 0 ? "NaN" : n.nan + "";
103
+ function T(f, g) {
104
+ f = $(f);
105
+ var b = f.fill, p = f.align, m = f.sign, w = f.symbol, S = f.zero, E = f.width, F = f.comma, y = f.precision, C = f.trim, d = f.type;
106
+ d === "n" ? (F = !0, d = "g") : O[d] || (y === void 0 && (y = 12), C = !0, d = "g"), (S || b === "0" && p === "=") && (S = !0, b = "0", p = "=");
107
+ var q = (g && g.prefix !== void 0 ? g.prefix : "") + (w === "$" ? e : w === "#" && /[boxX]/.test(d) ? "0" + d.toLowerCase() : ""), B = (w === "$" ? i : /[%p]/.test(d) ? c : "") + (g && g.suffix !== void 0 ? g.suffix : ""), D = O[d], H = /[defgprs%]/.test(d);
108
+ y = y === void 0 ? 6 : /[gprs]/.test(d) ? Math.max(1, Math.min(21, y)) : Math.max(0, Math.min(20, y));
109
+ function G(r) {
110
+ var l = q, u = B, x, I, k;
111
+ if (d === "c")
112
+ u = D(r) + u, r = "";
113
+ else {
114
+ r = +r;
115
+ var P = r < 0 || 1 / r < 0;
116
+ if (r = isNaN(r) ? M : D(Math.abs(r), y), C && (r = _(r)), P && +r == 0 && m !== "+" && (P = !1), l = (P ? m === "(" ? m : h : m === "-" || m === "(" ? "" : m) + l, u = (d === "s" && !isNaN(r) && N !== void 0 ? Y[8 + N / 3] : "") + u + (P && m === "(" ? ")" : ""), H) {
117
+ for (x = -1, I = r.length; ++x < I; )
118
+ if (k = r.charCodeAt(x), 48 > k || k > 57) {
119
+ u = (k === 46 ? o + r.slice(x + 1) : r.slice(x)) + u, r = r.slice(0, x);
120
+ break;
121
+ }
122
+ }
123
+ }
124
+ F && !S && (r = t(r, 1 / 0));
125
+ var z = l.length + r.length + u.length, s = z < E ? new Array(E - z + 1).join(b) : "";
126
+ switch (F && S && (r = t(s + r, s.length ? E - u.length : 1 / 0), s = ""), p) {
127
+ case "<":
128
+ r = l + r + u + s;
129
+ break;
130
+ case "=":
131
+ r = l + s + r + u;
132
+ break;
133
+ case "^":
134
+ r = s.slice(0, z = s.length >> 1) + l + r + u + s.slice(z);
135
+ break;
136
+ default:
137
+ r = s + l + r + u;
138
+ break;
139
+ }
140
+ return a(r);
141
+ }
142
+ return G.toString = function() {
143
+ return f + "";
144
+ }, G;
145
+ }
146
+ function Z(f, g) {
147
+ var b = Math.max(-8, Math.min(8, Math.floor(K(g) / 3))) * 3, p = Math.pow(10, -b), m = T((f = $(f), f.type = "f", f), { suffix: Y[8 + b / 3] });
148
+ return function(w) {
149
+ return m(p * w);
150
+ };
151
+ }
152
+ return {
153
+ format: T,
154
+ formatPrefix: Z
155
+ };
156
+ }
157
+ var A, tn, rn;
158
+ en({
159
+ thousands: ",",
160
+ grouping: [3],
161
+ currency: ["$", ""]
162
+ });
163
+ function en(n) {
164
+ return A = nn(n), tn = A.format, rn = A.formatPrefix, A;
165
+ }
166
+ export {
167
+ rn as a,
168
+ tn as b,
169
+ K as e,
170
+ $ as f
171
+ };
@@ -0,0 +1 @@
1
+ "use strict";function K(n){return Math.abs(n=Math.round(n))>=1e21?n.toLocaleString("en").replace(/,/g,""):n.toString(10)}function j(n,t){if(!isFinite(n)||n===0)return null;var e=(n=t?n.toExponential(t-1):n.toExponential()).indexOf("e"),i=n.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+n.slice(e+1)]}function Z(n){return n=j(Math.abs(n)),n?n[1]:NaN}function Q(n,t){return function(e,i){for(var o=e.length,a=[],c=0,m=n[0],M=0;o>0&&m>0&&(M+m+1>i&&(m=Math.max(1,i-M)),a.push(e.substring(o-=m,o+m)),!((M+=m+1)>i));)m=n[c=(c+1)%n.length];return a.reverse().join(t)}}function V(n){return function(t){return t.replace(/[0-9]/g,function(e){return n[+e]})}}var W=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function N(n){if(!(t=W.exec(n)))throw new Error("invalid format: "+n);var t;return new L({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}N.prototype=L.prototype;function L(n){this.fill=n.fill===void 0?" ":n.fill+"",this.align=n.align===void 0?">":n.align+"",this.sign=n.sign===void 0?"-":n.sign+"",this.symbol=n.symbol===void 0?"":n.symbol+"",this.zero=!!n.zero,this.width=n.width===void 0?void 0:+n.width,this.comma=!!n.comma,this.precision=n.precision===void 0?void 0:+n.precision,this.trim=!!n.trim,this.type=n.type===void 0?"":n.type+""}L.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function _(n){n:for(var t=n.length,e=1,i=-1,o;e<t;++e)switch(n[e]){case".":i=o=e;break;case"0":i===0&&(i=e),o=e;break;default:if(!+n[e])break n;i>0&&(i=0);break}return i>0?n.slice(0,i)+n.slice(o+1):n}var E;function v(n,t){var e=j(n,t);if(!e)return E=void 0,n.toPrecision(t);var i=e[0],o=e[1],a=o-(E=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,c=i.length;return a===c?i:a>c?i+new Array(a-c+1).join("0"):a>0?i.slice(0,a)+"."+i.slice(a):"0."+new Array(1-a).join("0")+j(n,Math.max(0,t+a-1))[0]}function X(n,t){var e=j(n,t);if(!e)return n+"";var i=e[0],o=e[1];return o<0?"0."+new Array(-o).join("0")+i:i.length>o+1?i.slice(0,o+1)+"."+i.slice(o+1):i+new Array(o-i.length+2).join("0")}const O={"%":(n,t)=>(n*100).toFixed(t),b:n=>Math.round(n).toString(2),c:n=>n+"",d:K,e:(n,t)=>n.toExponential(t),f:(n,t)=>n.toFixed(t),g:(n,t)=>n.toPrecision(t),o:n=>Math.round(n).toString(8),p:(n,t)=>X(n*100,t),r:X,s:v,X:n=>Math.round(n).toString(16).toUpperCase(),x:n=>Math.round(n).toString(16)};function R(n){return n}var U=Array.prototype.map,Y=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function nn(n){var t=n.grouping===void 0||n.thousands===void 0?R:Q(U.call(n.grouping,Number),n.thousands+""),e=n.currency===void 0?"":n.currency[0]+"",i=n.currency===void 0?"":n.currency[1]+"",o=n.decimal===void 0?".":n.decimal+"",a=n.numerals===void 0?R:V(U.call(n.numerals,String)),c=n.percent===void 0?"%":n.percent+"",m=n.minus===void 0?"−":n.minus+"",M=n.nan===void 0?"NaN":n.nan+"";function T(f,g){f=N(f);var x=f.fill,p=f.align,h=f.sign,w=f.symbol,S=f.zero,F=f.width,$=f.comma,y=f.precision,C=f.trim,d=f.type;d==="n"?($=!0,d="g"):O[d]||(y===void 0&&(y=12),C=!0,d="g"),(S||x==="0"&&p==="=")&&(S=!0,x="0",p="=");var B=(g&&g.prefix!==void 0?g.prefix:"")+(w==="$"?e:w==="#"&&/[boxX]/.test(d)?"0"+d.toLowerCase():""),H=(w==="$"?i:/[%p]/.test(d)?c:"")+(g&&g.suffix!==void 0?g.suffix:""),D=O[d],J=/[defgprs%]/.test(d);y=y===void 0?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y));function G(r){var l=B,u=H,b,I,k;if(d==="c")u=D(r)+u,r="";else{r=+r;var P=r<0||1/r<0;if(r=isNaN(r)?M:D(Math.abs(r),y),C&&(r=_(r)),P&&+r==0&&h!=="+"&&(P=!1),l=(P?h==="("?h:m:h==="-"||h==="("?"":h)+l,u=(d==="s"&&!isNaN(r)&&E!==void 0?Y[8+E/3]:"")+u+(P&&h==="("?")":""),J){for(b=-1,I=r.length;++b<I;)if(k=r.charCodeAt(b),48>k||k>57){u=(k===46?o+r.slice(b+1):r.slice(b))+u,r=r.slice(0,b);break}}}$&&!S&&(r=t(r,1/0));var z=l.length+r.length+u.length,s=z<F?new Array(F-z+1).join(x):"";switch($&&S&&(r=t(s+r,s.length?F-u.length:1/0),s=""),p){case"<":r=l+r+u+s;break;case"=":r=l+s+r+u;break;case"^":r=s.slice(0,z=s.length>>1)+l+r+u+s.slice(z);break;default:r=s+l+r+u;break}return a(r)}return G.toString=function(){return f+""},G}function q(f,g){var x=Math.max(-8,Math.min(8,Math.floor(Z(g)/3)))*3,p=Math.pow(10,-x),h=T((f=N(f),f.type="f",f),{suffix:Y[8+x/3]});return function(w){return h(p*w)}}return{format:T,formatPrefix:q}}var A;exports.format=void 0;exports.formatPrefix=void 0;tn({thousands:",",grouping:[3],currency:["$",""]});function tn(n){return A=nn(n),exports.format=A.format,exports.formatPrefix=A.formatPrefix,A}exports.exponent=Z;exports.formatSpecifier=N;