@wandox/sdk 0.1.0

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 (114) hide show
  1. package/README.md +59 -0
  2. package/dist/arc-BJMRTG9S.cjs +1 -0
  3. package/dist/arc-Vdco0qfw.js +83 -0
  4. package/dist/architectureDiagram-3BPJPVTR-BjEqcvey.js +4695 -0
  5. package/dist/architectureDiagram-3BPJPVTR-BvjJfAkh.cjs +36 -0
  6. package/dist/blockDiagram-GPEHLZMM-B1xf7RE9.js +2427 -0
  7. package/dist/blockDiagram-GPEHLZMM-B5VqovGY.cjs +132 -0
  8. package/dist/c4Diagram-AAUBKEIU-C4kjMRea.js +1578 -0
  9. package/dist/c4Diagram-AAUBKEIU-Ck5uEnJI.cjs +10 -0
  10. package/dist/channel-DlRtLuYv.js +5 -0
  11. package/dist/channel-Dm_yrRYJ.cjs +1 -0
  12. package/dist/chunk-2J33WTMH-CG2n_n4y.cjs +1 -0
  13. package/dist/chunk-2J33WTMH-CWvmGb4H.js +20 -0
  14. package/dist/chunk-4BX2VUAB-Bq3GzsD8.js +9 -0
  15. package/dist/chunk-4BX2VUAB-CdMctZeT.cjs +1 -0
  16. package/dist/chunk-55IACEB6-BdJhzL0d.js +8 -0
  17. package/dist/chunk-55IACEB6-sHyHtvg8.cjs +1 -0
  18. package/dist/chunk-727SXJPM-D-Vmam30.cjs +206 -0
  19. package/dist/chunk-727SXJPM-DmruCqjM.js +1529 -0
  20. package/dist/chunk-AQP2D5EJ-CWhKjcV3.cjs +231 -0
  21. package/dist/chunk-AQP2D5EJ-Ca0ak6w7.js +1399 -0
  22. package/dist/chunk-FMBD7UC4-CqV0NWQQ.js +19 -0
  23. package/dist/chunk-FMBD7UC4-DOxtd0OO.cjs +15 -0
  24. package/dist/chunk-ND2GUHAM-6EMX5Mu8.js +68 -0
  25. package/dist/chunk-ND2GUHAM-BXeDBtSC.cjs +1 -0
  26. package/dist/chunk-QZHKN3VN-B7FSI55w.js +15 -0
  27. package/dist/chunk-QZHKN3VN-CbbdNKnD.cjs +1 -0
  28. package/dist/classDiagram-4FO5ZUOK-0Kaf7WfA.js +16 -0
  29. package/dist/classDiagram-4FO5ZUOK-C4it2xBI.cjs +1 -0
  30. package/dist/classDiagram-v2-Q7XG4LA2-Byom5adL.js +16 -0
  31. package/dist/classDiagram-v2-Q7XG4LA2-C4it2xBI.cjs +1 -0
  32. package/dist/cose-bilkent-S5V4N54A-CuUv9oIm.js +2606 -0
  33. package/dist/cose-bilkent-S5V4N54A-Dh6nTopA.cjs +1 -0
  34. package/dist/cytoscape.esm-Cp8cXbK2.js +18729 -0
  35. package/dist/cytoscape.esm-fcqEUasK.cjs +331 -0
  36. package/dist/dagre-BM42HDAG-CwxJjZ2n.cjs +4 -0
  37. package/dist/dagre-BM42HDAG-DMBidMxP.js +448 -0
  38. package/dist/defaultLocale-BDVPUiG2.js +171 -0
  39. package/dist/defaultLocale-k2G_58r6.cjs +1 -0
  40. package/dist/diagram-2AECGRRQ-B2a4nXgJ.js +221 -0
  41. package/dist/diagram-2AECGRRQ-r7De7taS.cjs +43 -0
  42. package/dist/diagram-5GNKFQAL-CDiO79WC.cjs +10 -0
  43. package/dist/diagram-5GNKFQAL-DrHBNZzF.js +123 -0
  44. package/dist/diagram-KO2AKTUF-BcjWCXZr.js +466 -0
  45. package/dist/diagram-KO2AKTUF-CDlJCxVO.cjs +3 -0
  46. package/dist/diagram-LMA3HP47-BXFSAyNV.cjs +24 -0
  47. package/dist/diagram-LMA3HP47-DJxmyqn0.js +143 -0
  48. package/dist/diagram-OG6HWLK6-ATK__ca8.js +531 -0
  49. package/dist/diagram-OG6HWLK6-CgIyEO8_.cjs +24 -0
  50. package/dist/erDiagram-TEJ5UH35-D4baWNzQ.js +900 -0
  51. package/dist/erDiagram-TEJ5UH35-Dyuc5EB6.cjs +85 -0
  52. package/dist/flowDiagram-I6XJVG4X-BMZOncyU.js +1635 -0
  53. package/dist/flowDiagram-I6XJVG4X-C45fICr4.cjs +162 -0
  54. package/dist/ganttDiagram-6RSMTGT7-CiYZmmke.js +2526 -0
  55. package/dist/ganttDiagram-6RSMTGT7-Cxoj6IK8.cjs +292 -0
  56. package/dist/gitGraphDiagram-PVQCEYII-CQ9bNuwN.js +828 -0
  57. package/dist/gitGraphDiagram-PVQCEYII-rlaY9dfj.cjs +106 -0
  58. package/dist/graph-CBizzZ7K.js +1545 -0
  59. package/dist/graph-V5BNIbHU.cjs +1 -0
  60. package/dist/index-jBRold1l.js +173159 -0
  61. package/dist/index-sFrjovbM.cjs +804 -0
  62. package/dist/index.d.ts +54 -0
  63. package/dist/infoDiagram-5YYISTIA-CAzYIvUX.js +24 -0
  64. package/dist/infoDiagram-5YYISTIA-zX5rQglQ.cjs +2 -0
  65. package/dist/init-CHZsXQcr.cjs +1 -0
  66. package/dist/init-DjUOC4st.js +16 -0
  67. package/dist/ishikawaDiagram-YF4QCWOH-09prKBsn.cjs +70 -0
  68. package/dist/ishikawaDiagram-YF4QCWOH-Co8BnN24.js +622 -0
  69. package/dist/journeyDiagram-JHISSGLW-DkdWRF_-.cjs +139 -0
  70. package/dist/journeyDiagram-JHISSGLW-riCLiMCC.js +836 -0
  71. package/dist/kanban-definition-UN3LZRKU-DWipOCsx.cjs +89 -0
  72. package/dist/kanban-definition-UN3LZRKU-SRyCSn2H.js +725 -0
  73. package/dist/katex-Cf_UVKIT.cjs +257 -0
  74. package/dist/katex-RNjvZ8pg.js +11681 -0
  75. package/dist/layout-CbksXFOD.js +1728 -0
  76. package/dist/layout-Dh52gsIJ.cjs +1 -0
  77. package/dist/linear-C3xSMJV8.cjs +1 -0
  78. package/dist/linear-CmUCzX9U.js +259 -0
  79. package/dist/mermaid.core-BzNKr-OJ.cjs +308 -0
  80. package/dist/mermaid.core-CdBIz6FY.js +15475 -0
  81. package/dist/mindmap-definition-RKZ34NQL-Cs63oyIX.cjs +96 -0
  82. package/dist/mindmap-definition-RKZ34NQL-Gcma5iTd.js +830 -0
  83. package/dist/ordinal-CagbB1m8.cjs +1 -0
  84. package/dist/ordinal-DfAQgscy.js +61 -0
  85. package/dist/pieDiagram-4H26LBE5-CBGkD8dp.cjs +30 -0
  86. package/dist/pieDiagram-4H26LBE5-DSL8cVK1.js +164 -0
  87. package/dist/quadrantDiagram-W4KKPZXB-D3nCWRjF.cjs +7 -0
  88. package/dist/quadrantDiagram-W4KKPZXB-uod6bhUy.js +1026 -0
  89. package/dist/requirementDiagram-4Y6WPE33-Bc_6y7SM.js +884 -0
  90. package/dist/requirementDiagram-4Y6WPE33-D2mHlh5i.cjs +84 -0
  91. package/dist/sankeyDiagram-5OEKKPKP-DL_kXejW.cjs +40 -0
  92. package/dist/sankeyDiagram-5OEKKPKP-DMsjY4G4.js +847 -0
  93. package/dist/sequenceDiagram-3UESZ5HK-CBGalGOV.cjs +162 -0
  94. package/dist/sequenceDiagram-3UESZ5HK-CH2Z-Pis.js +2901 -0
  95. package/dist/stateDiagram-AJRCARHV-gEqlAI6t.js +263 -0
  96. package/dist/stateDiagram-AJRCARHV-rNMrAI-A.cjs +1 -0
  97. package/dist/stateDiagram-v2-BHNVJYJU-CDj7L1wi.js +16 -0
  98. package/dist/stateDiagram-v2-BHNVJYJU-LLlFJ1GM.cjs +1 -0
  99. package/dist/timeline-definition-PNZ67QCA-Bbuv3uu-.cjs +120 -0
  100. package/dist/timeline-definition-PNZ67QCA-DrGFbQdC.js +1068 -0
  101. package/dist/types.d.ts +295 -0
  102. package/dist/vennDiagram-CIIHVFJN-CGcAwVxU.js +1564 -0
  103. package/dist/vennDiagram-CIIHVFJN-DsSjXluJ.cjs +34 -0
  104. package/dist/wandox.cjs +1 -0
  105. package/dist/wandox.css +1 -0
  106. package/dist/wandox.js +6 -0
  107. package/dist/wandox.umd.js +4172 -0
  108. package/dist/wardley-L42UT6IY-DUnkyH_z.js +22539 -0
  109. package/dist/wardley-L42UT6IY-tDp0NbFW.cjs +165 -0
  110. package/dist/wardleyDiagram-YWT4CUSO-CB_Qa4lR.js +684 -0
  111. package/dist/wardleyDiagram-YWT4CUSO-D0BUmvVW.cjs +78 -0
  112. package/dist/xychartDiagram-2RQKCTM6-Bcq-ACuw.js +1342 -0
  113. package/dist/xychartDiagram-2RQKCTM6-BjeAPKLo.cjs +7 -0
  114. package/package.json +42 -0
@@ -0,0 +1,4 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./mermaid.core-BzNKr-OJ.cjs"),p=require("./graph-V5BNIbHU.cjs"),D=require("./layout-Dh52gsIJ.cjs");var G=4;function J(e){return D.baseClone(e,G)}function X(e){var o={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:L(e),edges:M(e)};return p.isUndefined(e.graph())||(o.value=J(e.graph())),o}function L(e){return D.map(e.nodes(),function(o){var n=e.node(o),s=e.parent(o),a={v:o};return p.isUndefined(n)||(a.value=n),p.isUndefined(s)||(a.parent=s),a})}function M(e){return D.map(e.edges(),function(o){var n=e.edge(o),s={v:o.v,w:o.w};return p.isUndefined(o.name)||(s.name=o.name),p.isUndefined(n)||(s.value=n),s})}var f=new Map,N=new Map,P=new Map,j=t.__name(()=>{N.clear(),P.clear(),f.clear()},"clear"),x=t.__name((e,o)=>{const n=N.get(o)||[];return t.log.trace("In isDescendant",o," ",e," = ",n.includes(e)),n.includes(e)},"isDescendant"),F=t.__name((e,o)=>{const n=N.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 a=o.children(e)||[];e!==s&&a.push(e),t.log.warn("Copying (nodes) clusterId",e,"nodes",a),a.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 a of n)P.set(a,e),s=[...s,...B(a,o)];return s},"extractDescendants"),Y=t.__name((e,o,n)=>{const s=e.edges().filter(d=>d.v===o||d.w===o),a=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=a.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 a;for(const l of s){const r=_(l,o,n),g=Y(o,n,r);if(r)if(g.length>0)a=r;else return r}return a},"findNonClusterChild"),O=t.__name(e=>!f.has(e)||!f.get(e).externalConnections?e:f.has(e)?f.get(e).id:e,"getAnchorId"),U=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)),N.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),a=e.edges();s.length>0?(t.log.debug("Cluster identified",n,N),a.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,": ",N.get(n)),f.get(n).externalConnections=!0)})):t.log.debug("Not a cluster ",n,N)});for(let n of f.keys()){const s=f.get(n).id,a=e.parent(s);a!==n&&f.has(a)&&!f.get(a).externalConnections&&(f.get(n).id=a)}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 a=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),a=O(n.v),l=O(n.w),e.removeEdge(n.v,n.w,n.name),a!==n.v){const r=e.parent(a);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",a,l,n.name),e.setEdge(a,l,s,n.name)}}),t.log.warn("Adjusted Graph",X(e)),R(e,0),t.log.trace(f)},"adjustClustersAndEdges"),R=t.__name((e,o)=>{var a,l;if(t.log.warn("extractor - ",o,X(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=(a=f.get(r))==null?void 0:a.clusterData)!=null&&l.dir&&(d=f.get(r).clusterData.dir,t.log.warn("Fixing dir",f.get(r).clusterData.dir,d));const v=new p.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",X(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,")",X(v)),t.log.debug("Old graph after copy",X(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&&R(g.graph,o+1)}},"extractor"),A=t.__name((e,o)=>{if(o.length===0)return[];let n=Object.assign([],o);return o.forEach(s=>{const a=e.children(s),l=A(e,a);n=[...n,...l]}),n},"sorter"),H=t.__name(e=>A(e,e.children()),"sortNodesByHierarchy"),T=t.__name(async(e,o,n,s,a,l)=>{t.log.warn("Graph in recursive render:XAX",X(o),a);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"),w=g.insert("g").attr("class","nodes");await Promise.all(o.nodes().map(async function(c){const i=o.node(c);if(a!==void 0){const u=JSON.parse(JSON.stringify(a.clusterData));t.log.trace(`Setting data for parent cluster XXX
2
+ Node.id = `,c,`
3
+ data=`,u.height,`
4
+ Parent cluster`,a.height),o.setNode(a.id,u),o.parent(c)||(t.log.trace("Setting parent",c,a.id),o.setParent(c,a.id,u))}if(t.log.info("(Insert) Node XXX"+c+": "+JSON.stringify(o.node(c))),i!=null&&i.clusterNode){t.log.info("Cluster identified XBX",c,i.width,o.node(c));const{ranksep:u,nodesep:m}=o.graph();i.graph.setGraph({...i.graph.graph(),ranksep:u+25,nodesep:m});const E=await T(w,i.graph,n,s,o.node(c),l),S=E.elem;t.updateNodeBounds(i,S),i.diff=E.diff||0,t.log.info("New compound node after recursive render XAX",c,"width",i.width,"height",i.height),t.setNodeElem(S,i)}else o.children(c).length>0?(t.log.trace("Cluster - the non recursive path XBX",c,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",c,w,o.node(c),r),await t.insertNode(w,o.node(c),{config:l,dir:r}))})),await t.__name(async()=>{const c=o.edges().map(async function(i){const u=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,u)});await Promise.all(c)},"processEdges")(),t.log.info("Graph before layout:",JSON.stringify(X(o))),t.log.info("############################################# XXX"),t.log.info("### Layout ### XXX"),t.log.info("############################################# XXX"),D.layout(o),t.log.info("Graph after layout:",JSON.stringify(X(o)));let y=0,{subGraphTitleTotalMargin:b}=t.getSubGraphTitleMargins(l);return await Promise.all(H(o).map(async function(c){var u;const i=o.node(c);if(t.log.info("Position XBX => "+c+": ("+i.x,","+i.y,") width: ",i.width," height: ",i.height),i!=null&&i.clusterNode)i.y+=b,t.log.info("A tainted cluster node XBX1",c,i.id,i.width,i.height,i.x,i.y,o.parent(c)),f.get(i.id).node=i,t.positionNode(i);else if(o.children(c).length>0){t.log.info("A pure cluster node XBX1",c,i.id,i.x,i.y,i.width,i.height,o.parent(c)),i.height+=b,o.node(i.parentId);const m=(i==null?void 0:i.padding)/2||0,E=((u=i==null?void 0:i.labelBBox)==null?void 0:u.height)||0,S=E-m||0;t.log.debug("OffsetY",S,"labelHeight",E,"halfPadding",m),await t.insertCluster(d,i),f.get(i.id).node=i}else{const m=o.node(i.parentId);i.y+=b/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(c){const i=o.edge(c);t.log.info("Edge "+c.v+" -> "+c.w+": "+JSON.stringify(i),i),i.points.forEach(S=>S.y+=b/2);const u=o.node(c.v);var m=o.node(c.w);const E=t.insertEdge(v,i,f,n,u,m,s);t.positionEdgeLabel(i,E)}),o.nodes().forEach(function(c){const i=o.node(c);t.log.info(c,i.type,i.diff),i.isGroup&&(y=i.diff)}),t.log.warn("Returning from recursive render XAX",g,y),{elem:g,diff:y}},"recursiveRender"),q=t.__name(async(e,o)=>{var l,r,g,d,v,C;const n=new p.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(),j(),e.nodes.forEach(w=>{n.setNode(w.id,{...w}),w.parentId&&n.setParent(w.id,w.parentId)}),t.log.debug("Edges:",e.edges),e.edges.forEach(w=>{if(w.start===w.end){const h=w.start,y=h+"---"+h+"---1",b=h+"---"+h+"---2",c=n.node(h);n.setNode(y,{domId:y,id:y,parentId:c.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),n.setParent(y,c.parentId),n.setNode(b,{domId:b,id:b,parentId:c.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),n.setParent(b,c.parentId);const i=structuredClone(w),u=structuredClone(w),m=structuredClone(w);i.label="",i.arrowTypeEnd="none",i.endLabelLeft="",i.endLabelRight="",i.startLabelLeft="",i.id=h+"-cyclic-special-1",u.startLabelRight="",u.startLabelLeft="",u.endLabelLeft="",u.endLabelRight="",u.arrowTypeStart="none",u.arrowTypeEnd="none",u.id=h+"-cyclic-special-mid",m.label="",m.startLabelRight="",m.startLabelLeft="",m.arrowTypeStart="none",c.isGroup&&(i.fromCluster=h,m.toCluster=h),m.id=h+"-cyclic-special-2",m.arrowTypeStart="none",n.setEdge(h,y,i,h+"-cyclic-special-0"),n.setEdge(y,b,u,h+"-cyclic-special-1"),n.setEdge(b,h,m,h+"-cyc<lic-special-2")}else n.setEdge(w.start,w.end,{...w},w.id)}),t.log.warn("Graph at first:",JSON.stringify(X(n))),U(n),t.log.warn("Graph after XAX:",JSON.stringify(X(n)));const a=t.getConfig2();await T(s,n,e.type,e.diagramId,void 0,a)},"render");exports.render=q;
@@ -0,0 +1,448 @@
1
+ import { b, aD as j, w as F, u as Y, v as _, aB as r, a2 as $, bi as H, b3 as V, al as Q, aa as U, aO as P, ai as q, aj as z, aN as K, ak as W } from "./mermaid.core-CdBIz6FY.js";
2
+ import { Q as x, G as B } from "./graph-CBizzZ7K.js";
3
+ import { b as Z, m as R, l as I } from "./layout-CbksXFOD.js";
4
+ var ee = 4;
5
+ function ne(e) {
6
+ return Z(e, ee);
7
+ }
8
+ function E(e) {
9
+ var t = {
10
+ options: {
11
+ directed: e.isDirected(),
12
+ multigraph: e.isMultigraph(),
13
+ compound: e.isCompound()
14
+ },
15
+ nodes: te(e),
16
+ edges: se(e)
17
+ };
18
+ return x(e.graph()) || (t.value = ne(e.graph())), t;
19
+ }
20
+ function te(e) {
21
+ return R(e.nodes(), function(t) {
22
+ var n = e.node(t), o = e.parent(t), c = { v: t };
23
+ return x(n) || (c.value = n), x(o) || (c.parent = o), c;
24
+ });
25
+ }
26
+ function se(e) {
27
+ return R(e.edges(), function(t) {
28
+ var n = e.edge(t), o = { v: t.v, w: t.w };
29
+ return x(t.name) || (o.name = t.name), x(n) || (o.value = n), o;
30
+ });
31
+ }
32
+ var f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), re = /* @__PURE__ */ b(() => {
33
+ p.clear(), A.clear(), f.clear();
34
+ }, "clear"), O = /* @__PURE__ */ b((e, t) => {
35
+ const n = p.get(t) || [];
36
+ return r.trace("In isDescendant", t, " ", e, " = ", n.includes(e)), n.includes(e);
37
+ }, "isDescendant"), ie = /* @__PURE__ */ b((e, t) => {
38
+ const n = p.get(t) || [];
39
+ return r.info("Descendants of ", t, " is ", n), r.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) : (r.debug("Tilt, ", t, ",not in descendants"), !1);
40
+ }, "edgeInCluster"), G = /* @__PURE__ */ b((e, t, n, o) => {
41
+ r.warn(
42
+ "Copying children of ",
43
+ e,
44
+ "root",
45
+ o,
46
+ "data",
47
+ t.node(e),
48
+ o
49
+ );
50
+ const c = t.children(e) || [];
51
+ e !== o && c.push(e), r.warn("Copying (nodes) clusterId", e, "nodes", c), c.forEach((a) => {
52
+ if (t.children(a).length > 0)
53
+ G(a, t, n, o);
54
+ else {
55
+ const i = t.node(a);
56
+ r.info("cp ", a, " to ", o, " with parent ", e), n.setNode(a, i), o !== t.parent(a) && (r.warn("Setting parent", a, t.parent(a)), n.setParent(a, t.parent(a))), e !== o && a !== e ? (r.debug("Setting parent", a, e), n.setParent(a, e)) : (r.info("In copy ", e, "root", o, "data", t.node(e), o), r.debug(
57
+ "Not Setting parent for node=",
58
+ a,
59
+ "cluster!==rootId",
60
+ e !== o,
61
+ "node!==clusterId",
62
+ a !== e
63
+ ));
64
+ const u = t.edges(a);
65
+ r.debug("Copying Edges", u), u.forEach((l) => {
66
+ r.info("Edge", l);
67
+ const v = t.edge(l.v, l.w, l.name);
68
+ r.info("Edge data", v, o);
69
+ try {
70
+ ie(l, o) ? (r.info("Copying as ", l.v, l.w, v, l.name), n.setEdge(l.v, l.w, v, l.name), r.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : r.info(
71
+ "Skipping copy of edge ",
72
+ l.v,
73
+ "-->",
74
+ l.w,
75
+ " rootId: ",
76
+ o,
77
+ " clusterId:",
78
+ e
79
+ );
80
+ } catch (C) {
81
+ r.error(C);
82
+ }
83
+ });
84
+ }
85
+ r.debug("Removing node", a), t.removeNode(a);
86
+ });
87
+ }, "copy"), J = /* @__PURE__ */ b((e, t) => {
88
+ const n = t.children(e);
89
+ let o = [...n];
90
+ for (const c of n)
91
+ A.set(c, e), o = [...o, ...J(c, t)];
92
+ return o;
93
+ }, "extractDescendants"), oe = /* @__PURE__ */ b((e, t, n) => {
94
+ 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 })), i = c.map((l) => ({ v: l.v, w: l.w }));
95
+ return a.filter((l) => i.some((v) => l.v === v.v && l.w === v.w));
96
+ }, "findCommonEdges"), D = /* @__PURE__ */ b((e, t, n) => {
97
+ const o = t.children(e);
98
+ if (r.trace("Searching children of id ", e, o), o.length < 1)
99
+ return e;
100
+ let c;
101
+ for (const a of o) {
102
+ const i = D(a, t, n), u = oe(t, n, i);
103
+ if (i)
104
+ if (u.length > 0)
105
+ c = i;
106
+ else
107
+ return i;
108
+ }
109
+ return c;
110
+ }, "findNonClusterChild"), k = /* @__PURE__ */ b((e) => !f.has(e) || !f.get(e).externalConnections ? e : f.has(e) ? f.get(e).id : e, "getAnchorId"), ae = /* @__PURE__ */ b((e, t) => {
111
+ if (!e || t > 10) {
112
+ r.debug("Opting out, no graph ");
113
+ return;
114
+ } else
115
+ r.debug("Opting in, graph ");
116
+ e.nodes().forEach(function(n) {
117
+ e.children(n).length > 0 && (r.warn(
118
+ "Cluster identified",
119
+ n,
120
+ " Replacement id in edges: ",
121
+ D(n, e, n)
122
+ ), p.set(n, J(n, e)), f.set(n, { id: D(n, e, n), clusterData: e.node(n) }));
123
+ }), e.nodes().forEach(function(n) {
124
+ const o = e.children(n), c = e.edges();
125
+ o.length > 0 ? (r.debug("Cluster identified", n, p), c.forEach((a) => {
126
+ const i = O(a.v, n), u = O(a.w, n);
127
+ i ^ u && (r.warn("Edge: ", a, " leaves cluster ", n), r.warn("Descendants of XXX ", n, ": ", p.get(n)), f.get(n).externalConnections = !0);
128
+ })) : r.debug("Not a cluster ", n, p);
129
+ });
130
+ for (let n of f.keys()) {
131
+ const o = f.get(n).id, c = e.parent(o);
132
+ c !== n && f.has(c) && !f.get(c).externalConnections && (f.get(n).id = c);
133
+ }
134
+ e.edges().forEach(function(n) {
135
+ const o = e.edge(n);
136
+ r.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), r.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n)));
137
+ let c = n.v, a = n.w;
138
+ if (r.warn(
139
+ "Fix XXX",
140
+ f,
141
+ "ids:",
142
+ n.v,
143
+ n.w,
144
+ "Translating: ",
145
+ f.get(n.v),
146
+ " --- ",
147
+ f.get(n.w)
148
+ ), f.get(n.v) || f.get(n.w)) {
149
+ if (r.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) {
150
+ const i = e.parent(c);
151
+ f.get(i).externalConnections = !0, o.fromCluster = n.v;
152
+ }
153
+ if (a !== n.w) {
154
+ const i = e.parent(a);
155
+ f.get(i).externalConnections = !0, o.toCluster = n.w;
156
+ }
157
+ r.warn("Fix Replacing with XXX", c, a, n.name), e.setEdge(c, a, o, n.name);
158
+ }
159
+ }), r.warn("Adjusted Graph", E(e)), T(e, 0), r.trace(f);
160
+ }, "adjustClustersAndEdges"), T = /* @__PURE__ */ b((e, t) => {
161
+ var c, a;
162
+ if (r.warn("extractor - ", t, E(e), e.children("D")), t > 10) {
163
+ r.error("Bailing out");
164
+ return;
165
+ }
166
+ let n = e.nodes(), o = !1;
167
+ for (const i of n) {
168
+ const u = e.children(i);
169
+ o = o || u.length > 0;
170
+ }
171
+ if (!o) {
172
+ r.debug("Done, no node has children", e.nodes());
173
+ return;
174
+ }
175
+ r.debug("Nodes = ", n, t);
176
+ for (const i of n)
177
+ if (r.debug(
178
+ "Extracting node",
179
+ i,
180
+ f,
181
+ f.has(i) && !f.get(i).externalConnections,
182
+ !e.parent(i),
183
+ e.node(i),
184
+ e.children("D"),
185
+ " Depth ",
186
+ t
187
+ ), !f.has(i))
188
+ r.debug("Not a cluster", i, t);
189
+ else if (!f.get(i).externalConnections && e.children(i) && e.children(i).length > 0) {
190
+ r.warn(
191
+ "Cluster without external connections, without a parent and with children",
192
+ i,
193
+ t
194
+ );
195
+ let l = e.graph().rankdir === "TB" ? "LR" : "TB";
196
+ (a = (c = f.get(i)) == null ? void 0 : c.clusterData) != null && a.dir && (l = f.get(i).clusterData.dir, r.warn("Fixing dir", f.get(i).clusterData.dir, l));
197
+ const v = new B({
198
+ multigraph: !0,
199
+ compound: !0
200
+ }).setGraph({
201
+ rankdir: l,
202
+ nodesep: 50,
203
+ ranksep: 50,
204
+ marginx: 8,
205
+ marginy: 8
206
+ }).setDefaultEdgeLabel(function() {
207
+ return {};
208
+ });
209
+ r.warn("Old graph before copy", E(e)), G(i, e, v, i), e.setNode(i, {
210
+ clusterNode: !0,
211
+ id: i,
212
+ clusterData: f.get(i).clusterData,
213
+ label: f.get(i).label,
214
+ graph: v
215
+ }), r.warn("New graph after copy node: (", i, ")", E(v)), r.debug("Old graph after copy", E(e));
216
+ } else
217
+ r.warn(
218
+ "Cluster ** ",
219
+ i,
220
+ " **not meeting the criteria !externalConnections:",
221
+ !f.get(i).externalConnections,
222
+ " no parent: ",
223
+ !e.parent(i),
224
+ " children ",
225
+ e.children(i) && e.children(i).length > 0,
226
+ e.children("D"),
227
+ t
228
+ ), r.debug(f);
229
+ n = e.nodes(), r.warn("New list of nodes", n);
230
+ for (const i of n) {
231
+ const u = e.node(i);
232
+ r.warn(" Now next level", i, u), u != null && u.clusterNode && T(u.graph, t + 1);
233
+ }
234
+ }, "extractor"), L = /* @__PURE__ */ b((e, t) => {
235
+ if (t.length === 0)
236
+ return [];
237
+ let n = Object.assign([], t);
238
+ return t.forEach((o) => {
239
+ const c = e.children(o), a = L(e, c);
240
+ n = [...n, ...a];
241
+ }), n;
242
+ }, "sorter"), ce = /* @__PURE__ */ b((e) => L(e, e.children()), "sortNodesByHierarchy"), M = /* @__PURE__ */ b(async (e, t, n, o, c, a) => {
243
+ r.warn("Graph in recursive render:XAX", E(t), c);
244
+ const i = t.graph().rankdir;
245
+ r.trace("Dir in recursive render - dir:", i);
246
+ const u = e.insert("g").attr("class", "root");
247
+ t.nodes() ? r.info("Recursive render XXX", t.nodes()) : r.info("No nodes found for", t), t.edges().length > 0 && r.info("Recursive edges", t.edge(t.edges()[0]));
248
+ const l = u.insert("g").attr("class", "clusters"), v = u.insert("g").attr("class", "edgePaths"), C = u.insert("g").attr("class", "edgeLabels"), w = u.insert("g").attr("class", "nodes");
249
+ await Promise.all(
250
+ t.nodes().map(async function(d) {
251
+ const s = t.node(d);
252
+ if (c !== void 0) {
253
+ const g = JSON.parse(JSON.stringify(c.clusterData));
254
+ r.trace(
255
+ `Setting data for parent cluster XXX
256
+ Node.id = `,
257
+ d,
258
+ `
259
+ data=`,
260
+ g.height,
261
+ `
262
+ Parent cluster`,
263
+ c.height
264
+ ), t.setNode(c.id, g), t.parent(d) || (r.trace("Setting parent", d, c.id), t.setParent(d, c.id, g));
265
+ }
266
+ if (r.info("(Insert) Node XXX" + d + ": " + JSON.stringify(t.node(d))), s != null && s.clusterNode) {
267
+ r.info("Cluster identified XBX", d, s.width, t.node(d));
268
+ const { ranksep: g, nodesep: m } = t.graph();
269
+ s.graph.setGraph({
270
+ ...s.graph.graph(),
271
+ ranksep: g + 25,
272
+ nodesep: m
273
+ });
274
+ const N = await M(
275
+ w,
276
+ s.graph,
277
+ n,
278
+ o,
279
+ t.node(d),
280
+ a
281
+ ), S = N.elem;
282
+ H(s, S), s.diff = N.diff || 0, r.info(
283
+ "New compound node after recursive render XAX",
284
+ d,
285
+ "width",
286
+ // node,
287
+ s.width,
288
+ "height",
289
+ s.height
290
+ // node.x,
291
+ // node.y
292
+ ), V(S, s);
293
+ } else
294
+ t.children(d).length > 0 ? (r.trace(
295
+ "Cluster - the non recursive path XBX",
296
+ d,
297
+ s.id,
298
+ s,
299
+ s.width,
300
+ "Graph:",
301
+ t
302
+ ), r.trace(D(s.id, t)), f.set(s.id, { id: D(s.id, t), node: s })) : (r.trace("Node - the non recursive path XAX", d, w, t.node(d), i), await Q(w, t.node(d), { config: a, dir: i }));
303
+ })
304
+ ), await (/* @__PURE__ */ b(async () => {
305
+ const d = t.edges().map(async function(s) {
306
+ const g = t.edge(s.v, s.w, s.name);
307
+ r.info("Edge " + s.v + " -> " + s.w + ": " + JSON.stringify(s)), r.info("Edge " + s.v + " -> " + s.w + ": ", s, " ", JSON.stringify(t.edge(s))), r.info(
308
+ "Fix",
309
+ f,
310
+ "ids:",
311
+ s.v,
312
+ s.w,
313
+ "Translating: ",
314
+ f.get(s.v),
315
+ f.get(s.w)
316
+ ), await W(C, g);
317
+ });
318
+ await Promise.all(d);
319
+ }, "processEdges"))(), r.info("Graph before layout:", JSON.stringify(E(t))), r.info("############################################# XXX"), r.info("### Layout ### XXX"), r.info("############################################# XXX"), I(t), r.info("Graph after layout:", JSON.stringify(E(t)));
320
+ let y = 0, { subGraphTitleTotalMargin: X } = U(a);
321
+ return await Promise.all(
322
+ ce(t).map(async function(d) {
323
+ var g;
324
+ const s = t.node(d);
325
+ if (r.info(
326
+ "Position XBX => " + d + ": (" + s.x,
327
+ "," + s.y,
328
+ ") width: ",
329
+ s.width,
330
+ " height: ",
331
+ s.height
332
+ ), s != null && s.clusterNode)
333
+ s.y += X, r.info(
334
+ "A tainted cluster node XBX1",
335
+ d,
336
+ s.id,
337
+ s.width,
338
+ s.height,
339
+ s.x,
340
+ s.y,
341
+ t.parent(d)
342
+ ), f.get(s.id).node = s, P(s);
343
+ else if (t.children(d).length > 0) {
344
+ r.info(
345
+ "A pure cluster node XBX1",
346
+ d,
347
+ s.id,
348
+ s.x,
349
+ s.y,
350
+ s.width,
351
+ s.height,
352
+ t.parent(d)
353
+ ), s.height += X, t.node(s.parentId);
354
+ const m = (s == null ? void 0 : s.padding) / 2 || 0, N = ((g = s == null ? void 0 : s.labelBBox) == null ? void 0 : g.height) || 0, S = N - m || 0;
355
+ r.debug("OffsetY", S, "labelHeight", N, "halfPadding", m), await q(l, s), f.get(s.id).node = s;
356
+ } else {
357
+ const m = t.node(s.parentId);
358
+ s.y += X / 2, r.info(
359
+ "A regular node XBX1 - using the padding",
360
+ s.id,
361
+ "parent",
362
+ s.parentId,
363
+ s.width,
364
+ s.height,
365
+ s.x,
366
+ s.y,
367
+ "offsetY",
368
+ s.offsetY,
369
+ "parent",
370
+ m,
371
+ m == null ? void 0 : m.offsetY,
372
+ s
373
+ ), P(s);
374
+ }
375
+ })
376
+ ), t.edges().forEach(function(d) {
377
+ const s = t.edge(d);
378
+ r.info("Edge " + d.v + " -> " + d.w + ": " + JSON.stringify(s), s), s.points.forEach((S) => S.y += X / 2);
379
+ const g = t.node(d.v);
380
+ var m = t.node(d.w);
381
+ const N = z(v, s, f, n, g, m, o);
382
+ K(s, N);
383
+ }), t.nodes().forEach(function(d) {
384
+ const s = t.node(d);
385
+ r.info(d, s.type, s.diff), s.isGroup && (y = s.diff);
386
+ }), r.warn("Returning from recursive render XAX", u, y), { elem: u, diff: y };
387
+ }, "recursiveRender"), ue = /* @__PURE__ */ b(async (e, t) => {
388
+ var a, i, u, l, v, C;
389
+ const n = new B({
390
+ multigraph: !0,
391
+ compound: !0
392
+ }).setGraph({
393
+ rankdir: e.direction,
394
+ nodesep: ((a = e.config) == null ? void 0 : a.nodeSpacing) || ((u = (i = e.config) == null ? void 0 : i.flowchart) == null ? void 0 : u.nodeSpacing) || e.nodeSpacing,
395
+ 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,
396
+ marginx: 8,
397
+ marginy: 8
398
+ }).setDefaultEdgeLabel(function() {
399
+ return {};
400
+ }), o = t.select("g");
401
+ j(o, e.markers, e.type, e.diagramId), F(), Y(), _(), re(), e.nodes.forEach((w) => {
402
+ n.setNode(w.id, { ...w }), w.parentId && n.setParent(w.id, w.parentId);
403
+ }), r.debug("Edges:", e.edges), e.edges.forEach((w) => {
404
+ if (w.start === w.end) {
405
+ const h = w.start, y = h + "---" + h + "---1", X = h + "---" + h + "---2", d = n.node(h);
406
+ n.setNode(y, {
407
+ domId: y,
408
+ id: y,
409
+ parentId: d.parentId,
410
+ labelStyle: "",
411
+ label: "",
412
+ padding: 0,
413
+ shape: "labelRect",
414
+ // shape: 'rect',
415
+ style: "",
416
+ width: 10,
417
+ height: 10
418
+ }), n.setParent(y, d.parentId), n.setNode(X, {
419
+ domId: X,
420
+ id: X,
421
+ parentId: d.parentId,
422
+ labelStyle: "",
423
+ padding: 0,
424
+ // shape: 'rect',
425
+ shape: "labelRect",
426
+ label: "",
427
+ style: "",
428
+ width: 10,
429
+ height: 10
430
+ }), n.setParent(X, d.parentId);
431
+ const s = structuredClone(w), g = structuredClone(w), m = structuredClone(w);
432
+ s.label = "", s.arrowTypeEnd = "none", s.endLabelLeft = "", s.endLabelRight = "", s.startLabelLeft = "", s.id = h + "-cyclic-special-1", g.startLabelRight = "", g.startLabelLeft = "", g.endLabelLeft = "", g.endLabelRight = "", g.arrowTypeStart = "none", g.arrowTypeEnd = "none", g.id = h + "-cyclic-special-mid", m.label = "", m.startLabelRight = "", m.startLabelLeft = "", m.arrowTypeStart = "none", d.isGroup && (s.fromCluster = h, m.toCluster = h), m.id = h + "-cyclic-special-2", m.arrowTypeStart = "none", n.setEdge(h, y, s, h + "-cyclic-special-0"), n.setEdge(y, X, g, h + "-cyclic-special-1"), n.setEdge(X, h, m, h + "-cyc<lic-special-2");
433
+ } else
434
+ n.setEdge(w.start, w.end, { ...w }, w.id);
435
+ }), r.warn("Graph at first:", JSON.stringify(E(n))), ae(n), r.warn("Graph after XAX:", JSON.stringify(E(n)));
436
+ const c = $();
437
+ await M(
438
+ o,
439
+ n,
440
+ e.type,
441
+ e.diagramId,
442
+ void 0,
443
+ c
444
+ );
445
+ }, "render");
446
+ export {
447
+ ue as render
448
+ };
@@ -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 A(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 = A(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 F(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
+ F.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 j;
70
+ function v(n, t) {
71
+ var e = A(n, t);
72
+ if (!e) return j = void 0, n.toPrecision(t);
73
+ var i = e[0], o = e[1], a = o - (j = 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") + A(n, Math.max(0, t + a - 1))[0];
75
+ }
76
+ function X(n, t) {
77
+ var e = A(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(f);
105
+ var b = f.fill, p = f.align, m = f.sign, w = f.symbol, S = f.zero, N = f.width, E = f.comma, y = f.precision, C = f.trim, d = f.type;
106
+ d === "n" ? (E = !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) && j !== void 0 ? Y[8 + j / 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
+ E && !S && (r = t(r, 1 / 0));
125
+ var $ = l.length + r.length + u.length, s = $ < N ? new Array(N - $ + 1).join(b) : "";
126
+ switch (E && S && (r = t(s + r, s.length ? N - 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, $ = s.length >> 1) + l + r + u + s.slice($);
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), 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 z, tn, rn;
158
+ en({
159
+ thousands: ",",
160
+ grouping: [3],
161
+ currency: ["$", ""]
162
+ });
163
+ function en(n) {
164
+ return z = nn(n), tn = z.format, rn = z.formatPrefix, z;
165
+ }
166
+ export {
167
+ rn as a,
168
+ F as b,
169
+ K as e,
170
+ tn 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 A(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=A(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 j(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]})}j.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 N;function v(n,t){var e=A(n,t);if(!e)return N=void 0,n.toPrecision(t);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;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")+A(n,Math.max(0,t+a-1))[0]}function X(n,t){var e=A(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=j(f);var x=f.fill,p=f.align,h=f.sign,w=f.symbol,S=f.zero,E=f.width,F=f.comma,y=f.precision,C=f.trim,d=f.type;d==="n"?(F=!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)&&N!==void 0?Y[8+N/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}}}F&&!S&&(r=t(r,1/0));var $=l.length+r.length+u.length,s=$<E?new Array(E-$+1).join(x):"";switch(F&&S&&(r=t(s+r,s.length?E-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,$=s.length>>1)+l+r+u+s.slice($);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=j(f),f.type="f",f),{suffix:Y[8+x/3]});return function(w){return h(p*w)}}return{format:T,formatPrefix:q}}var z;exports.format=void 0;exports.formatPrefix=void 0;tn({thousands:",",grouping:[3],currency:["$",""]});function tn(n){return z=nn(n),exports.format=z.format,exports.formatPrefix=z.formatPrefix,z}exports.exponent=Z;exports.formatSpecifier=j;