@ootc/markdown 0.0.9 → 0.2.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 (160) hide show
  1. package/README.md +96 -4
  2. package/dist/CodeBlock-BquZ4WRk.cjs +2 -0
  3. package/dist/CodeBlock-DSwq2gw5.js +74 -0
  4. package/dist/MarkdownPreview-CMvzqhTd.js +7592 -0
  5. package/dist/MarkdownPreview-DfDx-wep.cjs +29 -0
  6. package/dist/code.cjs +1 -1
  7. package/dist/code.css +1 -0
  8. package/dist/code.d.ts +3 -1
  9. package/dist/code.js +3 -2
  10. package/dist/components/code-block/CodeBlock.d.ts +7 -1
  11. package/dist/components/markdown/MarkdownPreview.d.ts +8 -2
  12. package/dist/components/markdown-editor/MarkdownEditor.d.ts +4 -1
  13. package/dist/css/CodeBlock.css +1 -0
  14. package/dist/css/MarkdownPreview.css +1 -0
  15. package/dist/css/editor.css +1 -0
  16. package/dist/css/plugin-mermaid.css +1 -0
  17. package/dist/editor.cjs +1 -1
  18. package/dist/editor.css +3 -0
  19. package/dist/editor.d.ts +3 -1
  20. package/dist/editor.js +28 -25
  21. package/dist/index-BJZhyxD_.cjs +9 -0
  22. package/dist/index-DWVMYNE4.js +800 -0
  23. package/dist/index-HmBYTPyZ.js +1179 -0
  24. package/dist/index-jsnhzgIQ.cjs +1 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.css +1 -0
  27. package/dist/index.d.ts +3 -1
  28. package/dist/index.js +3 -2
  29. package/dist/jsx-runtime-DXgJBoQh.js +264 -0
  30. package/dist/jsx-runtime-nZSsnGb7.cjs +6 -0
  31. package/dist/plugin-highlight.cjs +1 -0
  32. package/dist/plugin-highlight.js +20 -0
  33. package/dist/plugin-katex.cjs +1 -0
  34. package/dist/plugin-katex.js +12 -0
  35. package/dist/plugin-mermaid.cjs +1 -0
  36. package/dist/plugin-mermaid.css +1 -0
  37. package/dist/plugin-mermaid.js +266 -0
  38. package/dist/plugins/types.d.ts +38 -0
  39. package/dist/preview.cjs +1 -1
  40. package/dist/preview.css +2 -0
  41. package/dist/preview.d.ts +3 -1
  42. package/dist/preview.js +4 -3
  43. package/dist/style.css +4 -1
  44. package/package.json +76 -21
  45. package/dist/CodeBlock-BYxQBfWO.js +0 -40827
  46. package/dist/CodeBlock-CJ6j8Wkl.cjs +0 -3934
  47. package/dist/MarkdownPreview-DcWMewhy.cjs +0 -295
  48. package/dist/MarkdownPreview-lqJAnu4B.js +0 -20424
  49. package/dist/_baseUniq-BfVwFITD.js +0 -477
  50. package/dist/_baseUniq-D-3LoSZp.cjs +0 -1
  51. package/dist/arc-CyzqoBTV.js +0 -83
  52. package/dist/arc-DrpGAtaq.cjs +0 -1
  53. package/dist/architecture-U656AL7Q-C8Bj_Ouy.cjs +0 -1
  54. package/dist/architecture-U656AL7Q-DTKdLHLe.js +0 -5
  55. package/dist/architectureDiagram-VXUJARFQ-B8EG6DIA.js +0 -4662
  56. package/dist/architectureDiagram-VXUJARFQ-DJ1ub7X0.cjs +0 -36
  57. package/dist/blockDiagram-VD42YOAC-CKNTgeZ8.js +0 -2256
  58. package/dist/blockDiagram-VD42YOAC-G-1iOwuq.cjs +0 -122
  59. package/dist/c4Diagram-YG6GDRKO-BJ1Ka924.cjs +0 -10
  60. package/dist/c4Diagram-YG6GDRKO-Bokkq4pO.js +0 -1580
  61. package/dist/channel-C4noxv-h.js +0 -5
  62. package/dist/channel-DvIIEA3u.cjs +0 -1
  63. package/dist/chunk-4BX2VUAB-B5M-5e_l.cjs +0 -1
  64. package/dist/chunk-4BX2VUAB-ByoAwp1j.js +0 -8
  65. package/dist/chunk-55IACEB6-BpG-_f0h.cjs +0 -1
  66. package/dist/chunk-55IACEB6-DRnx6y7F.js +0 -8
  67. package/dist/chunk-B4BG7PRW-0toVGVN-.js +0 -1375
  68. package/dist/chunk-B4BG7PRW-evUM3dip.cjs +0 -165
  69. package/dist/chunk-DI55MBZ5-CyInK_-M.js +0 -1370
  70. package/dist/chunk-DI55MBZ5-DKs4p2E0.cjs +0 -220
  71. package/dist/chunk-FMBD7UC4-BwUpmqhP.js +0 -19
  72. package/dist/chunk-FMBD7UC4-cpOVGF_2.cjs +0 -15
  73. package/dist/chunk-QN33PNHL-C7XXEbKU.js +0 -19
  74. package/dist/chunk-QN33PNHL-CEdYSNej.cjs +0 -1
  75. package/dist/chunk-QZHKN3VN-hppYv0Iu.cjs +0 -1
  76. package/dist/chunk-QZHKN3VN-qqHBDA_I.js +0 -15
  77. package/dist/chunk-TZMSLE5B-B9QqMSFM.js +0 -64
  78. package/dist/chunk-TZMSLE5B-Bklau4qu.cjs +0 -1
  79. package/dist/classDiagram-2ON5EDUG-CYKX_y1c.js +0 -16
  80. package/dist/classDiagram-2ON5EDUG-TgiEUsUn.cjs +0 -1
  81. package/dist/classDiagram-v2-WZHVMYZB-CYKX_y1c.js +0 -16
  82. package/dist/classDiagram-v2-WZHVMYZB-TgiEUsUn.cjs +0 -1
  83. package/dist/clone-CE64n2kf.js +0 -8
  84. package/dist/clone-jaW02xOC.cjs +0 -1
  85. package/dist/cose-bilkent-S5V4N54A-B_XAF1ZT.js +0 -2609
  86. package/dist/cose-bilkent-S5V4N54A-DSZx3rxe.cjs +0 -1
  87. package/dist/cytoscape.esm-CNUX3VTg.cjs +0 -321
  88. package/dist/cytoscape.esm-Cvf3sx9F.js +0 -18704
  89. package/dist/dagre-6UL2VRFP-Biy3Qm3K.js +0 -443
  90. package/dist/dagre-6UL2VRFP-C8MiPDEQ.cjs +0 -4
  91. package/dist/defaultLocale-D7EN2tov.js +0 -171
  92. package/dist/defaultLocale-DIVzfLaQ.cjs +0 -1
  93. package/dist/diagram-PSM6KHXK-B1y0Lt7Z.cjs +0 -24
  94. package/dist/diagram-PSM6KHXK-CIfbagcO.js +0 -531
  95. package/dist/diagram-QEK2KX5R-BJNTbg0b.cjs +0 -43
  96. package/dist/diagram-QEK2KX5R-BQz0yqem.js +0 -217
  97. package/dist/diagram-S2PKOQOG-BGsratMZ.js +0 -142
  98. package/dist/diagram-S2PKOQOG-BK_tj5Pz.cjs +0 -24
  99. package/dist/erDiagram-Q2GNP2WA-CJbuwIgY.cjs +0 -60
  100. package/dist/erDiagram-Q2GNP2WA-CurkAz8N.js +0 -841
  101. package/dist/flowDiagram-NV44I4VS-DAMyok8X.js +0 -1620
  102. package/dist/flowDiagram-NV44I4VS-DnmHUmh1.cjs +0 -162
  103. package/dist/ganttDiagram-JELNMOA3-DxXvW49B.cjs +0 -267
  104. package/dist/ganttDiagram-JELNMOA3-oVlSmAjl.js +0 -2671
  105. package/dist/gitGraph-F6HP7TQM-DUSMetNW.js +0 -5
  106. package/dist/gitGraph-F6HP7TQM-DveZcMpA.cjs +0 -1
  107. package/dist/gitGraphDiagram-NY62KEGX-CFdtd4Gb.js +0 -699
  108. package/dist/gitGraphDiagram-NY62KEGX-CspGhCdP.cjs +0 -65
  109. package/dist/graph-Bza-HyX6.js +0 -381
  110. package/dist/graph-CE_Z8OkL.cjs +0 -1
  111. package/dist/info-NVLQJR56-3ayytpiF.js +0 -5
  112. package/dist/info-NVLQJR56-D-IKjb_E.cjs +0 -1
  113. package/dist/infoDiagram-WHAUD3N6--LngDYSE.cjs +0 -2
  114. package/dist/infoDiagram-WHAUD3N6-BtO0qT6g.js +0 -24
  115. package/dist/init-CHZsXQcr.cjs +0 -1
  116. package/dist/init-DjUOC4st.js +0 -16
  117. package/dist/journeyDiagram-XKPGCS4Q-DCvKw6yJ.cjs +0 -139
  118. package/dist/journeyDiagram-XKPGCS4Q-Unrh_bjo.js +0 -834
  119. package/dist/kanban-definition-3W4ZIXB7-CRa6bR24.cjs +0 -89
  120. package/dist/kanban-definition-3W4ZIXB7-Vpm6gG9R.js +0 -719
  121. package/dist/layout-BJzrWbaG.cjs +0 -1
  122. package/dist/layout-D6Pf3Nys.js +0 -1441
  123. package/dist/linear-C0E_OSxf.js +0 -259
  124. package/dist/linear-TSwNFrBs.cjs +0 -1
  125. package/dist/mermaid-parser.core-B9wV8XMP.js +0 -14177
  126. package/dist/mermaid-parser.core-Ba9EAFlD.cjs +0 -128
  127. package/dist/mermaid.core-B1lFjYb9.js +0 -15269
  128. package/dist/mermaid.core-C8vi9eg6.cjs +0 -249
  129. package/dist/min-BC6TlZcq.cjs +0 -1
  130. package/dist/min-DT5Wu4V1.js +0 -38
  131. package/dist/mindmap-definition-VGOIOE7T-COA86V4i.js +0 -784
  132. package/dist/mindmap-definition-VGOIOE7T-D9oMyZ2M.cjs +0 -68
  133. package/dist/ordinal-B6-f3MAq.js +0 -61
  134. package/dist/ordinal-CagbB1m8.cjs +0 -1
  135. package/dist/packet-BFZMPI3H-BZI0_bZt.js +0 -5
  136. package/dist/packet-BFZMPI3H-D4pnK0Ol.cjs +0 -1
  137. package/dist/pie-7BOR55EZ-DS6huTOL.cjs +0 -1
  138. package/dist/pie-7BOR55EZ-DgzTX76e.js +0 -5
  139. package/dist/pieDiagram-ADFJNKIX-CYW3Diea.js +0 -161
  140. package/dist/pieDiagram-ADFJNKIX-CxPAjreR.cjs +0 -30
  141. package/dist/quadrantDiagram-AYHSOK5B-BT94kssD.js +0 -1022
  142. package/dist/quadrantDiagram-AYHSOK5B-ehLphI_D.cjs +0 -7
  143. package/dist/radar-NHE76QYJ-CKcVnf1I.cjs +0 -1
  144. package/dist/radar-NHE76QYJ-D8cZitaQ.js +0 -5
  145. package/dist/requirementDiagram-UZGBJVZJ-B4UYGl6e.js +0 -850
  146. package/dist/requirementDiagram-UZGBJVZJ-BDLj6-Do.cjs +0 -64
  147. package/dist/sankeyDiagram-TZEHDZUN-CAWsWdn8.js +0 -810
  148. package/dist/sankeyDiagram-TZEHDZUN-DUb360Ep.cjs +0 -10
  149. package/dist/sequenceDiagram-WL72ISMW-Bb4Tkhf2.cjs +0 -145
  150. package/dist/sequenceDiagram-WL72ISMW-DsmW0gAI.js +0 -2511
  151. package/dist/stateDiagram-FKZM4ZOC-Da-8DKdP.js +0 -263
  152. package/dist/stateDiagram-FKZM4ZOC-jOvG1Jmy.cjs +0 -1
  153. package/dist/stateDiagram-v2-4FDKWEC3-GMZ8nH4e.js +0 -16
  154. package/dist/stateDiagram-v2-4FDKWEC3-mWKIMY-b.cjs +0 -1
  155. package/dist/timeline-definition-IT6M3QCI-BdnDlTsf.cjs +0 -61
  156. package/dist/timeline-definition-IT6M3QCI-CvJDgHLW.js +0 -795
  157. package/dist/treemap-KMMF4GRG-BVy_kMp3.js +0 -5
  158. package/dist/treemap-KMMF4GRG-BsA9nu7r.cjs +0 -1
  159. package/dist/xychartDiagram-PRI3JC2R-CYXNZ7B0.cjs +0 -7
  160. package/dist/xychartDiagram-PRI3JC2R-wG1xpI1S.js +0 -1340
@@ -1,443 +0,0 @@
1
- import { _ as w, 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-B1lFjYb9.js";
2
- import { i as b, G as B } from "./graph-Bza-HyX6.js";
3
- import { l as I } from "./layout-D6Pf3Nys.js";
4
- import { c as L } from "./clone-CE64n2kf.js";
5
- import { m as A } from "./min-DT5Wu4V1.js";
6
- function h(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 b(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), a = e.parent(t), r = { v: t };
21
- return b(n) || (r.value = n), b(a) || (r.parent = a), r;
22
- });
23
- }
24
- function ne(e) {
25
- return A(e.edges(), function(t) {
26
- var n = e.edge(t), a = { v: t.v, w: t.w };
27
- return b(t.name) || (a.name = t.name), b(n) || (a.value = n), a;
28
- });
29
- }
30
- var d = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ w(() => {
31
- y.clear(), J.clear(), d.clear();
32
- }, "clear"), D = /* @__PURE__ */ w((e, t) => {
33
- const n = y.get(t) || [];
34
- return i.trace("In isDescendant", t, " ", e, " = ", n.includes(e)), n.includes(e);
35
- }, "isDescendant"), se = /* @__PURE__ */ w((e, t) => {
36
- const n = y.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) || D(e.v, t) || D(e.w, t) || n.includes(e.w) : (i.debug("Tilt, ", t, ",not in descendants"), !1);
38
- }, "edgeInCluster"), G = /* @__PURE__ */ w((e, t, n, a) => {
39
- i.warn(
40
- "Copying children of ",
41
- e,
42
- "root",
43
- a,
44
- "data",
45
- t.node(e),
46
- a
47
- );
48
- const r = t.children(e) || [];
49
- e !== a && r.push(e), i.warn("Copying (nodes) clusterId", e, "nodes", r), r.forEach((o) => {
50
- if (t.children(o).length > 0)
51
- G(o, t, n, a);
52
- else {
53
- const l = t.node(o);
54
- i.info("cp ", o, " to ", a, " with parent ", e), n.setNode(o, l), a !== t.parent(o) && (i.warn("Setting parent", o, t.parent(o)), n.setParent(o, t.parent(o))), e !== a && o !== e ? (i.debug("Setting parent", o, e), n.setParent(o, e)) : (i.info("In copy ", e, "root", a, "data", t.node(e), a), i.debug(
55
- "Not Setting parent for node=",
56
- o,
57
- "cluster!==rootId",
58
- e !== a,
59
- "node!==clusterId",
60
- o !== e
61
- ));
62
- const u = t.edges(o);
63
- i.debug("Copying Edges", u), u.forEach((c) => {
64
- i.info("Edge", c);
65
- const m = t.edge(c.v, c.w, c.name);
66
- i.info("Edge data", m, a);
67
- try {
68
- se(c, a) ? (i.info("Copying as ", c.v, c.w, m, c.name), n.setEdge(c.v, c.w, m, c.name), i.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : i.info(
69
- "Skipping copy of edge ",
70
- c.v,
71
- "-->",
72
- c.w,
73
- " rootId: ",
74
- a,
75
- " clusterId:",
76
- e
77
- );
78
- } catch (v) {
79
- i.error(v);
80
- }
81
- });
82
- }
83
- i.debug("Removing node", o), t.removeNode(o);
84
- });
85
- }, "copy"), R = /* @__PURE__ */ w((e, t) => {
86
- const n = t.children(e);
87
- let a = [...n];
88
- for (const r of n)
89
- J.set(r, e), a = [...a, ...R(r, t)];
90
- return a;
91
- }, "extractDescendants"), ie = /* @__PURE__ */ w((e, t, n) => {
92
- const a = e.edges().filter((c) => c.v === t || c.w === t), r = e.edges().filter((c) => c.v === n || c.w === n), o = a.map((c) => ({ v: c.v === t ? n : c.v, w: c.w === t ? t : c.w })), l = r.map((c) => ({ v: c.v, w: c.w }));
93
- return o.filter((c) => l.some((m) => c.v === m.v && c.w === m.w));
94
- }, "findCommonEdges"), C = /* @__PURE__ */ w((e, t, n) => {
95
- const a = t.children(e);
96
- if (i.trace("Searching children of id ", e, a), a.length < 1)
97
- return e;
98
- let r;
99
- for (const o of a) {
100
- const l = C(o, t, n), u = ie(t, n, l);
101
- if (l)
102
- if (u.length > 0)
103
- r = l;
104
- else
105
- return l;
106
- }
107
- return r;
108
- }, "findNonClusterChild"), k = /* @__PURE__ */ w((e) => !d.has(e) || !d.get(e).externalConnections ? e : d.has(e) ? d.get(e).id : e, "getAnchorId"), re = /* @__PURE__ */ w((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
- C(n, e, n)
120
- ), y.set(n, R(n, e)), d.set(n, { id: C(n, e, n), clusterData: e.node(n) }));
121
- }), e.nodes().forEach(function(n) {
122
- const a = e.children(n), r = e.edges();
123
- a.length > 0 ? (i.debug("Cluster identified", n, y), r.forEach((o) => {
124
- const l = D(o.v, n), u = D(o.w, n);
125
- l ^ u && (i.warn("Edge: ", o, " leaves cluster ", n), i.warn("Descendants of XXX ", n, ": ", y.get(n)), d.get(n).externalConnections = !0);
126
- })) : i.debug("Not a cluster ", n, y);
127
- });
128
- for (let n of d.keys()) {
129
- const a = d.get(n).id, r = e.parent(a);
130
- r !== n && d.has(r) && !d.get(r).externalConnections && (d.get(n).id = r);
131
- }
132
- e.edges().forEach(function(n) {
133
- const a = 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 r = n.v, o = n.w;
136
- if (i.warn(
137
- "Fix XXX",
138
- d,
139
- "ids:",
140
- n.v,
141
- n.w,
142
- "Translating: ",
143
- d.get(n.v),
144
- " --- ",
145
- d.get(n.w)
146
- ), d.get(n.v) || d.get(n.w)) {
147
- if (i.warn("Fixing and trying - removing XXX", n.v, n.w, n.name), r = k(n.v), o = k(n.w), e.removeEdge(n.v, n.w, n.name), r !== n.v) {
148
- const l = e.parent(r);
149
- d.get(l).externalConnections = !0, a.fromCluster = n.v;
150
- }
151
- if (o !== n.w) {
152
- const l = e.parent(o);
153
- d.get(l).externalConnections = !0, a.toCluster = n.w;
154
- }
155
- i.warn("Fix Replacing with XXX", r, o, n.name), e.setEdge(r, o, a, n.name);
156
- }
157
- }), i.warn("Adjusted Graph", h(e)), T(e, 0), i.trace(d);
158
- }, "adjustClustersAndEdges"), T = /* @__PURE__ */ w((e, t) => {
159
- if (i.warn("extractor - ", t, h(e), e.children("D")), t > 10) {
160
- i.error("Bailing out");
161
- return;
162
- }
163
- let n = e.nodes(), a = !1;
164
- for (const r of n) {
165
- const o = e.children(r);
166
- a = a || o.length > 0;
167
- }
168
- if (!a) {
169
- i.debug("Done, no node has children", e.nodes());
170
- return;
171
- }
172
- i.debug("Nodes = ", n, t);
173
- for (const r of n)
174
- if (i.debug(
175
- "Extracting node",
176
- r,
177
- d,
178
- d.has(r) && !d.get(r).externalConnections,
179
- !e.parent(r),
180
- e.node(r),
181
- e.children("D"),
182
- " Depth ",
183
- t
184
- ), !d.has(r))
185
- i.debug("Not a cluster", r, t);
186
- else if (!d.get(r).externalConnections && e.children(r) && e.children(r).length > 0) {
187
- i.warn(
188
- "Cluster without external connections, without a parent and with children",
189
- r,
190
- t
191
- );
192
- let l = e.graph().rankdir === "TB" ? "LR" : "TB";
193
- d.get(r)?.clusterData?.dir && (l = d.get(r).clusterData.dir, i.warn("Fixing dir", d.get(r).clusterData.dir, l));
194
- const u = new B({
195
- multigraph: !0,
196
- compound: !0
197
- }).setGraph({
198
- rankdir: l,
199
- nodesep: 50,
200
- ranksep: 50,
201
- marginx: 8,
202
- marginy: 8
203
- }).setDefaultEdgeLabel(function() {
204
- return {};
205
- });
206
- i.warn("Old graph before copy", h(e)), G(r, e, u, r), e.setNode(r, {
207
- clusterNode: !0,
208
- id: r,
209
- clusterData: d.get(r).clusterData,
210
- label: d.get(r).label,
211
- graph: u
212
- }), i.warn("New graph after copy node: (", r, ")", h(u)), i.debug("Old graph after copy", h(e));
213
- } else
214
- i.warn(
215
- "Cluster ** ",
216
- r,
217
- " **not meeting the criteria !externalConnections:",
218
- !d.get(r).externalConnections,
219
- " no parent: ",
220
- !e.parent(r),
221
- " children ",
222
- e.children(r) && e.children(r).length > 0,
223
- e.children("D"),
224
- t
225
- ), i.debug(d);
226
- n = e.nodes(), i.warn("New list of nodes", n);
227
- for (const r of n) {
228
- const o = e.node(r);
229
- i.warn(" Now next level", r, o), o?.clusterNode && T(o.graph, t + 1);
230
- }
231
- }, "extractor"), M = /* @__PURE__ */ w((e, t) => {
232
- if (t.length === 0)
233
- return [];
234
- let n = Object.assign([], t);
235
- return t.forEach((a) => {
236
- const r = e.children(a), o = M(e, r);
237
- n = [...n, ...o];
238
- }), n;
239
- }, "sorter"), oe = /* @__PURE__ */ w((e) => M(e, e.children()), "sortNodesByHierarchy"), j = /* @__PURE__ */ w(async (e, t, n, a, r, o) => {
240
- i.warn("Graph in recursive render:XAX", h(t), r);
241
- const l = t.graph().rankdir;
242
- i.trace("Dir in recursive render - dir:", l);
243
- const u = e.insert("g").attr("class", "root");
244
- 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]));
245
- const c = u.insert("g").attr("class", "clusters"), m = u.insert("g").attr("class", "edgePaths"), v = u.insert("g").attr("class", "edgeLabels"), X = u.insert("g").attr("class", "nodes");
246
- await Promise.all(
247
- t.nodes().map(async function(f) {
248
- const s = t.node(f);
249
- if (r !== void 0) {
250
- const g = JSON.parse(JSON.stringify(r.clusterData));
251
- i.trace(
252
- `Setting data for parent cluster XXX
253
- Node.id = `,
254
- f,
255
- `
256
- data=`,
257
- g.height,
258
- `
259
- Parent cluster`,
260
- r.height
261
- ), t.setNode(r.id, g), t.parent(f) || (i.trace("Setting parent", f, r.id), t.setParent(f, r.id, g));
262
- }
263
- if (i.info("(Insert) Node XXX" + f + ": " + JSON.stringify(t.node(f))), s?.clusterNode) {
264
- i.info("Cluster identified XBX", f, s.width, t.node(f));
265
- const { ranksep: g, nodesep: E } = t.graph();
266
- s.graph.setGraph({
267
- ...s.graph.graph(),
268
- ranksep: g + 25,
269
- nodesep: E
270
- });
271
- const N = await j(
272
- X,
273
- s.graph,
274
- n,
275
- a,
276
- t.node(f),
277
- o
278
- ), x = N.elem;
279
- z(s, x), s.diff = N.diff || 0, i.info(
280
- "New compound node after recursive render XAX",
281
- f,
282
- "width",
283
- // node,
284
- s.width,
285
- "height",
286
- s.height
287
- // node.x,
288
- // node.y
289
- ), U(x, s);
290
- } else
291
- t.children(f).length > 0 ? (i.trace(
292
- "Cluster - the non recursive path XBX",
293
- f,
294
- s.id,
295
- s,
296
- s.width,
297
- "Graph:",
298
- t
299
- ), i.trace(C(s.id, t)), d.set(s.id, { id: C(s.id, t), node: s })) : (i.trace("Node - the non recursive path XAX", f, X, t.node(f), l), await $(X, t.node(f), { config: o, dir: l }));
300
- })
301
- ), await (/* @__PURE__ */ w(async () => {
302
- const f = t.edges().map(async function(s) {
303
- const g = t.edge(s.v, s.w, s.name);
304
- 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(
305
- "Fix",
306
- d,
307
- "ids:",
308
- s.v,
309
- s.w,
310
- "Translating: ",
311
- d.get(s.v),
312
- d.get(s.w)
313
- ), await Z(v, g);
314
- });
315
- await Promise.all(f);
316
- }, "processEdges"))(), i.info("Graph before layout:", JSON.stringify(h(t))), i.info("############################################# XXX"), i.info("### Layout ### XXX"), i.info("############################################# XXX"), I(t), i.info("Graph after layout:", JSON.stringify(h(t)));
317
- let O = 0, { subGraphTitleTotalMargin: S } = q(o);
318
- return await Promise.all(
319
- oe(t).map(async function(f) {
320
- const s = t.node(f);
321
- if (i.info(
322
- "Position XBX => " + f + ": (" + s.x,
323
- "," + s.y,
324
- ") width: ",
325
- s.width,
326
- " height: ",
327
- s.height
328
- ), s?.clusterNode)
329
- s.y += S, i.info(
330
- "A tainted cluster node XBX1",
331
- f,
332
- s.id,
333
- s.width,
334
- s.height,
335
- s.x,
336
- s.y,
337
- t.parent(f)
338
- ), d.get(s.id).node = s, P(s);
339
- else if (t.children(f).length > 0) {
340
- i.info(
341
- "A pure cluster node XBX1",
342
- f,
343
- s.id,
344
- s.x,
345
- s.y,
346
- s.width,
347
- s.height,
348
- t.parent(f)
349
- ), s.height += S, t.node(s.parentId);
350
- const g = s?.padding / 2 || 0, E = s?.labelBBox?.height || 0, N = E - g || 0;
351
- i.debug("OffsetY", N, "labelHeight", E, "halfPadding", g), await K(c, s), d.get(s.id).node = s;
352
- } else {
353
- const g = t.node(s.parentId);
354
- s.y += S / 2, i.info(
355
- "A regular node XBX1 - using the padding",
356
- s.id,
357
- "parent",
358
- s.parentId,
359
- s.width,
360
- s.height,
361
- s.x,
362
- s.y,
363
- "offsetY",
364
- s.offsetY,
365
- "parent",
366
- g,
367
- g?.offsetY,
368
- s
369
- ), P(s);
370
- }
371
- })
372
- ), t.edges().forEach(function(f) {
373
- const s = t.edge(f);
374
- i.info("Edge " + f.v + " -> " + f.w + ": " + JSON.stringify(s), s), s.points.forEach((x) => x.y += S / 2);
375
- const g = t.node(f.v);
376
- var E = t.node(f.w);
377
- const N = Q(m, s, d, n, g, E, a);
378
- W(s, N);
379
- }), t.nodes().forEach(function(f) {
380
- const s = t.node(f);
381
- i.info(f, s.type, s.diff), s.isGroup && (O = s.diff);
382
- }), i.warn("Returning from recursive render XAX", u, O), { elem: u, diff: O };
383
- }, "recursiveRender"), ue = /* @__PURE__ */ w(async (e, t) => {
384
- const n = new B({
385
- multigraph: !0,
386
- compound: !0
387
- }).setGraph({
388
- rankdir: e.direction,
389
- nodesep: e.config?.nodeSpacing || e.config?.flowchart?.nodeSpacing || e.nodeSpacing,
390
- ranksep: e.config?.rankSpacing || e.config?.flowchart?.rankSpacing || e.rankSpacing,
391
- marginx: 8,
392
- marginy: 8
393
- }).setDefaultEdgeLabel(function() {
394
- return {};
395
- }), a = t.select("g");
396
- F(a, e.markers, e.type, e.diagramId), Y(), _(), H(), te(), e.nodes.forEach((o) => {
397
- n.setNode(o.id, { ...o }), o.parentId && n.setParent(o.id, o.parentId);
398
- }), i.debug("Edges:", e.edges), e.edges.forEach((o) => {
399
- if (o.start === o.end) {
400
- const l = o.start, u = l + "---" + l + "---1", c = l + "---" + l + "---2", m = n.node(l);
401
- n.setNode(u, {
402
- domId: u,
403
- id: u,
404
- parentId: m.parentId,
405
- labelStyle: "",
406
- label: "",
407
- padding: 0,
408
- shape: "labelRect",
409
- // shape: 'rect',
410
- style: "",
411
- width: 10,
412
- height: 10
413
- }), n.setParent(u, m.parentId), n.setNode(c, {
414
- domId: c,
415
- id: c,
416
- parentId: m.parentId,
417
- labelStyle: "",
418
- padding: 0,
419
- // shape: 'rect',
420
- shape: "labelRect",
421
- label: "",
422
- style: "",
423
- width: 10,
424
- height: 10
425
- }), n.setParent(c, m.parentId);
426
- const v = structuredClone(o), X = structuredClone(o), p = structuredClone(o);
427
- v.label = "", v.arrowTypeEnd = "none", v.id = l + "-cyclic-special-1", X.arrowTypeStart = "none", X.arrowTypeEnd = "none", X.id = l + "-cyclic-special-mid", p.label = "", m.isGroup && (v.fromCluster = l, p.toCluster = l), p.id = l + "-cyclic-special-2", p.arrowTypeStart = "none", n.setEdge(l, u, v, l + "-cyclic-special-0"), n.setEdge(u, c, X, l + "-cyclic-special-1"), n.setEdge(c, l, p, l + "-cyc<lic-special-2");
428
- } else
429
- n.setEdge(o.start, o.end, { ...o }, o.id);
430
- }), i.warn("Graph at first:", JSON.stringify(h(n))), re(n), i.warn("Graph after XAX:", JSON.stringify(h(n)));
431
- const r = V();
432
- await j(
433
- a,
434
- n,
435
- e.type,
436
- e.diagramId,
437
- void 0,
438
- r
439
- );
440
- }, "render");
441
- export {
442
- ue as render
443
- };
@@ -1,4 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./mermaid.core-C8vi9eg6.cjs"),X=require("./graph-CE_Z8OkL.cjs"),G=require("./layout-BJzrWbaG.cjs"),R=require("./clone-jaW02xOC.cjs"),O=require("./min-BC6TlZcq.cjs");function m(e){var o={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:M(e),edges:j(e)};return X.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),l=e.parent(o),r={v:o};return X.isUndefined(n)||(r.value=n),X.isUndefined(l)||(r.parent=l),r})}function j(e){return O.map(e.edges(),function(o){var n=e.edge(o),l={v:o.v,w:o.w};return X.isUndefined(o.name)||(l.name=o.name),X.isUndefined(n)||(l.value=n),l})}var a=new Map,y=new Map,P=new Map,q=t.__name(()=>{y.clear(),P.clear(),a.clear()},"clear"),_=t.__name((e,o)=>{const n=y.get(o)||[];return t.log.trace("In isDescendant",o," ",e," = ",n.includes(e)),n.includes(e)},"isDescendant"),F=t.__name((e,o)=>{const n=y.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)||_(e.v,o)||_(e.w,o)||n.includes(e.w):(t.log.debug("Tilt, ",o,",not in descendants"),!1)},"edgeInCluster"),k=t.__name((e,o,n,l)=>{t.log.warn("Copying children of ",e,"root",l,"data",o.node(e),l);const r=o.children(e)||[];e!==l&&r.push(e),t.log.warn("Copying (nodes) clusterId",e,"nodes",r),r.forEach(s=>{if(o.children(s).length>0)k(s,o,n,l);else{const d=o.node(s);t.log.info("cp ",s," to ",l," with parent ",e),n.setNode(s,d),l!==o.parent(s)&&(t.log.warn("Setting parent",s,o.parent(s)),n.setParent(s,o.parent(s))),e!==l&&s!==e?(t.log.debug("Setting parent",s,e),n.setParent(s,e)):(t.log.info("In copy ",e,"root",l,"data",o.node(e),l),t.log.debug("Not Setting parent for node=",s,"cluster!==rootId",e!==l,"node!==clusterId",s!==e));const g=o.edges(s);t.log.debug("Copying Edges",g),g.forEach(c=>{t.log.info("Edge",c);const w=o.edge(c.v,c.w,c.name);t.log.info("Edge data",w,l);try{F(c,l)?(t.log.info("Copying as ",c.v,c.w,w,c.name),n.setEdge(c.v,c.w,w,c.name),t.log.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):t.log.info("Skipping copy of edge ",c.v,"-->",c.w," rootId: ",l," clusterId:",e)}catch(h){t.log.error(h)}})}t.log.debug("Removing node",s),o.removeNode(s)})},"copy"),B=t.__name((e,o)=>{const n=o.children(e);let l=[...n];for(const r of n)P.set(r,e),l=[...l,...B(r,o)];return l},"extractDescendants"),U=t.__name((e,o,n)=>{const l=e.edges().filter(c=>c.v===o||c.w===o),r=e.edges().filter(c=>c.v===n||c.w===n),s=l.map(c=>({v:c.v===o?n:c.v,w:c.w===o?o:c.w})),d=r.map(c=>({v:c.v,w:c.w}));return s.filter(c=>d.some(w=>c.v===w.v&&c.w===w.w))},"findCommonEdges"),b=t.__name((e,o,n)=>{const l=o.children(e);if(t.log.trace("Searching children of id ",e,l),l.length<1)return e;let r;for(const s of l){const d=b(s,o,n),g=U(o,n,d);if(d)if(g.length>0)r=d;else return d}return r},"findNonClusterChild"),D=t.__name(e=>!a.has(e)||!a.get(e).externalConnections?e:a.has(e)?a.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: ",b(n,e,n)),y.set(n,B(n,e)),a.set(n,{id:b(n,e,n),clusterData:e.node(n)}))}),e.nodes().forEach(function(n){const l=e.children(n),r=e.edges();l.length>0?(t.log.debug("Cluster identified",n,y),r.forEach(s=>{const d=_(s.v,n),g=_(s.w,n);d^g&&(t.log.warn("Edge: ",s," leaves cluster ",n),t.log.warn("Descendants of XXX ",n,": ",y.get(n)),a.get(n).externalConnections=!0)})):t.log.debug("Not a cluster ",n,y)});for(let n of a.keys()){const l=a.get(n).id,r=e.parent(l);r!==n&&a.has(r)&&!a.get(r).externalConnections&&(a.get(n).id=r)}e.edges().forEach(function(n){const l=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 r=n.v,s=n.w;if(t.log.warn("Fix XXX",a,"ids:",n.v,n.w,"Translating: ",a.get(n.v)," --- ",a.get(n.w)),a.get(n.v)||a.get(n.w)){if(t.log.warn("Fixing and trying - removing XXX",n.v,n.w,n.name),r=D(n.v),s=D(n.w),e.removeEdge(n.v,n.w,n.name),r!==n.v){const d=e.parent(r);a.get(d).externalConnections=!0,l.fromCluster=n.v}if(s!==n.w){const d=e.parent(s);a.get(d).externalConnections=!0,l.toCluster=n.w}t.log.warn("Fix Replacing with XXX",r,s,n.name),e.setEdge(r,s,l,n.name)}}),t.log.warn("Adjusted Graph",m(e)),A(e,0),t.log.trace(a)},"adjustClustersAndEdges"),A=t.__name((e,o)=>{if(t.log.warn("extractor - ",o,m(e),e.children("D")),o>10){t.log.error("Bailing out");return}let n=e.nodes(),l=!1;for(const r of n){const s=e.children(r);l=l||s.length>0}if(!l){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,a,a.has(r)&&!a.get(r).externalConnections,!e.parent(r),e.node(r),e.children("D")," Depth ",o),!a.has(r))t.log.debug("Not a cluster",r,o);else if(!a.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";a.get(r)?.clusterData?.dir&&(d=a.get(r).clusterData.dir,t.log.warn("Fixing dir",a.get(r).clusterData.dir,d));const g=new X.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",m(e)),k(r,e,g,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:a.get(r).clusterData,label:a.get(r).label,graph:g}),t.log.warn("New graph after copy node: (",r,")",m(g)),t.log.debug("Old graph after copy",m(e))}else t.log.warn("Cluster ** ",r," **not meeting the criteria !externalConnections:",!a.get(r).externalConnections," no parent: ",!e.parent(r)," children ",e.children(r)&&e.children(r).length>0,e.children("D"),o),t.log.debug(a);n=e.nodes(),t.log.warn("New list of nodes",n);for(const r of n){const s=e.node(r);t.log.warn(" Now next level",r,s),s?.clusterNode&&A(s.graph,o+1)}},"extractor"),J=t.__name((e,o)=>{if(o.length===0)return[];let n=Object.assign([],o);return o.forEach(l=>{const r=e.children(l),s=J(e,r);n=[...n,...s]}),n},"sorter"),H=t.__name(e=>J(e,e.children()),"sortNodesByHierarchy"),T=t.__name(async(e,o,n,l,r,s)=>{t.log.warn("Graph in recursive render:XAX",m(o),r);const d=o.graph().rankdir;t.log.trace("Dir in recursive render - dir:",d);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 c=g.insert("g").attr("class","clusters"),w=g.insert("g").attr("class","edgePaths"),h=g.insert("g").attr("class","edgeLabels"),v=g.insert("g").attr("class","nodes");await Promise.all(o.nodes().map(async function(f){const i=o.node(f);if(r!==void 0){const u=JSON.parse(JSON.stringify(r.clusterData));t.log.trace(`Setting data for parent cluster XXX
2
- Node.id = `,f,`
3
- data=`,u.height,`
4
- Parent cluster`,r.height),o.setNode(r.id,u),o.parent(f)||(t.log.trace("Setting parent",f,r.id),o.setParent(f,r.id,u))}if(t.log.info("(Insert) Node XXX"+f+": "+JSON.stringify(o.node(f))),i?.clusterNode){t.log.info("Cluster identified XBX",f,i.width,o.node(f));const{ranksep:u,nodesep:p}=o.graph();i.graph.setGraph({...i.graph.graph(),ranksep:u+25,nodesep:p});const N=await T(v,i.graph,n,l,o.node(f),s),S=N.elem;t.updateNodeBounds(i,S),i.diff=N.diff||0,t.log.info("New compound node after recursive render XAX",f,"width",i.width,"height",i.height),t.setNodeElem(S,i)}else o.children(f).length>0?(t.log.trace("Cluster - the non recursive path XBX",f,i.id,i,i.width,"Graph:",o),t.log.trace(b(i.id,o)),a.set(i.id,{id:b(i.id,o),node:i})):(t.log.trace("Node - the non recursive path XAX",f,v,o.node(f),d),await t.insertNode(v,o.node(f),{config:s,dir:d}))})),await t.__name(async()=>{const f=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",a,"ids:",i.v,i.w,"Translating: ",a.get(i.v),a.get(i.w)),await t.insertEdgeLabel(h,u)});await Promise.all(f)},"processEdges")(),t.log.info("Graph before layout:",JSON.stringify(m(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(m(o)));let x=0,{subGraphTitleTotalMargin:C}=t.getSubGraphTitleMargins(s);return await Promise.all(H(o).map(async function(f){const i=o.node(f);if(t.log.info("Position XBX => "+f+": ("+i.x,","+i.y,") width: ",i.width," height: ",i.height),i?.clusterNode)i.y+=C,t.log.info("A tainted cluster node XBX1",f,i.id,i.width,i.height,i.x,i.y,o.parent(f)),a.get(i.id).node=i,t.positionNode(i);else if(o.children(f).length>0){t.log.info("A pure cluster node XBX1",f,i.id,i.x,i.y,i.width,i.height,o.parent(f)),i.height+=C,o.node(i.parentId);const u=i?.padding/2||0,p=i?.labelBBox?.height||0,N=p-u||0;t.log.debug("OffsetY",N,"labelHeight",p,"halfPadding",u),await t.insertCluster(c,i),a.get(i.id).node=i}else{const u=o.node(i.parentId);i.y+=C/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",u,u?.offsetY,i),t.positionNode(i)}})),o.edges().forEach(function(f){const i=o.edge(f);t.log.info("Edge "+f.v+" -> "+f.w+": "+JSON.stringify(i),i),i.points.forEach(S=>S.y+=C/2);const u=o.node(f.v);var p=o.node(f.w);const N=t.insertEdge(w,i,a,n,u,p,l);t.positionEdgeLabel(i,N)}),o.nodes().forEach(function(f){const i=o.node(f);t.log.info(f,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)=>{const n=new X.Graph({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.config?.flowchart?.nodeSpacing||e.nodeSpacing,ranksep:e.config?.rankSpacing||e.config?.flowchart?.rankSpacing||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),l=o.select("g");t.markers_default(l,e.markers,e.type,e.diagramId),t.clear2(),t.clear$1(),t.clear$2(),q(),e.nodes.forEach(s=>{n.setNode(s.id,{...s}),s.parentId&&n.setParent(s.id,s.parentId)}),t.log.debug("Edges:",e.edges),e.edges.forEach(s=>{if(s.start===s.end){const d=s.start,g=d+"---"+d+"---1",c=d+"---"+d+"---2",w=n.node(d);n.setNode(g,{domId:g,id:g,parentId:w.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),n.setParent(g,w.parentId),n.setNode(c,{domId:c,id:c,parentId:w.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),n.setParent(c,w.parentId);const h=structuredClone(s),v=structuredClone(s),E=structuredClone(s);h.label="",h.arrowTypeEnd="none",h.id=d+"-cyclic-special-1",v.arrowTypeStart="none",v.arrowTypeEnd="none",v.id=d+"-cyclic-special-mid",E.label="",w.isGroup&&(h.fromCluster=d,E.toCluster=d),E.id=d+"-cyclic-special-2",E.arrowTypeStart="none",n.setEdge(d,g,h,d+"-cyclic-special-0"),n.setEdge(g,c,v,d+"-cyclic-special-1"),n.setEdge(c,d,E,d+"-cyc<lic-special-2")}else n.setEdge(s.start,s.end,{...s},s.id)}),t.log.warn("Graph at first:",JSON.stringify(m(n))),Y(n),t.log.warn("Graph after XAX:",JSON.stringify(m(n)));const r=t.getConfig2();await T(l,n,e.type,e.diagramId,void 0,r)},"render");exports.render=V;
@@ -1,171 +0,0 @@
1
- function H(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 ((e = (n = t ? n.toExponential(t - 1) : n.toExponential()).indexOf("e")) < 0) return null;
6
- var 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 J(n) {
13
- return n = j(Math.abs(n)), n ? n[1] : NaN;
14
- }
15
- function K(n, t) {
16
- return function(e, i) {
17
- for (var o = e.length, f = [], c = 0, u = n[0], p = 0; o > 0 && u > 0 && (p + u + 1 > i && (u = Math.max(1, i - p)), f.push(e.substring(o -= u, o + u)), !((p += u + 1) > i)); )
18
- u = n[c = (c + 1) % n.length];
19
- return f.reverse().join(t);
20
- };
21
- }
22
- function Q(n) {
23
- return function(t) {
24
- return t.replace(/[0-9]/g, function(e) {
25
- return n[+e];
26
- });
27
- };
28
- }
29
- var V = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
30
- function N(n) {
31
- if (!(t = V.exec(n))) throw new Error("invalid format: " + n);
32
- var t;
33
- return new $({
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
- N.prototype = $.prototype;
47
- function $(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
- $.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 W(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 U;
70
- function _(n, t) {
71
- var e = j(n, t);
72
- if (!e) return n + "";
73
- var i = e[0], o = e[1], f = o - (U = Math.max(-8, Math.min(8, Math.floor(o / 3))) * 3) + 1, c = i.length;
74
- return f === c ? i : f > c ? i + new Array(f - c + 1).join("0") : f > 0 ? i.slice(0, f) + "." + i.slice(f) : "0." + new Array(1 - f).join("0") + j(n, Math.max(0, t + f - 1))[0];
75
- }
76
- function G(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 I = {
83
- "%": (n, t) => (n * 100).toFixed(t),
84
- b: (n) => Math.round(n).toString(2),
85
- c: (n) => n + "",
86
- d: H,
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) => G(n * 100, t),
92
- r: G,
93
- s: _,
94
- X: (n) => Math.round(n).toString(16).toUpperCase(),
95
- x: (n) => Math.round(n).toString(16)
96
- };
97
- function X(n) {
98
- return n;
99
- }
100
- var O = Array.prototype.map, R = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
101
- function v(n) {
102
- var t = n.grouping === void 0 || n.thousands === void 0 ? X : K(O.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 + "", f = n.numerals === void 0 ? X : Q(O.call(n.numerals, String)), c = n.percent === void 0 ? "%" : n.percent + "", u = n.minus === void 0 ? "−" : n.minus + "", p = n.nan === void 0 ? "NaN" : n.nan + "";
103
- function F(a) {
104
- a = N(a);
105
- var x = a.fill, M = a.align, m = a.sign, w = a.symbol, l = a.zero, S = a.width, E = a.comma, g = a.precision, L = a.trim, d = a.type;
106
- d === "n" ? (E = !0, d = "g") : I[d] || (g === void 0 && (g = 12), L = !0, d = "g"), (l || x === "0" && M === "=") && (l = !0, x = "0", M = "=");
107
- var Z = w === "$" ? e : w === "#" && /[boxX]/.test(d) ? "0" + d.toLowerCase() : "", q = w === "$" ? i : /[%p]/.test(d) ? c : "", T = I[d], B = /[defgprs%]/.test(d);
108
- g = g === void 0 ? 6 : /[gprs]/.test(d) ? Math.max(1, Math.min(21, g)) : Math.max(0, Math.min(20, g));
109
- function C(r) {
110
- var y = Z, h = q, b, D, k;
111
- if (d === "c")
112
- h = T(r) + h, r = "";
113
- else {
114
- r = +r;
115
- var P = r < 0 || 1 / r < 0;
116
- if (r = isNaN(r) ? p : T(Math.abs(r), g), L && (r = W(r)), P && +r == 0 && m !== "+" && (P = !1), y = (P ? m === "(" ? m : u : m === "-" || m === "(" ? "" : m) + y, h = (d === "s" ? R[8 + U / 3] : "") + h + (P && m === "(" ? ")" : ""), B) {
117
- for (b = -1, D = r.length; ++b < D; )
118
- if (k = r.charCodeAt(b), 48 > k || k > 57) {
119
- h = (k === 46 ? o + r.slice(b + 1) : r.slice(b)) + h, r = r.slice(0, b);
120
- break;
121
- }
122
- }
123
- }
124
- E && !l && (r = t(r, 1 / 0));
125
- var z = y.length + r.length + h.length, s = z < S ? new Array(S - z + 1).join(x) : "";
126
- switch (E && l && (r = t(s + r, s.length ? S - h.length : 1 / 0), s = ""), M) {
127
- case "<":
128
- r = y + r + h + s;
129
- break;
130
- case "=":
131
- r = y + s + r + h;
132
- break;
133
- case "^":
134
- r = s.slice(0, z = s.length >> 1) + y + r + h + s.slice(z);
135
- break;
136
- default:
137
- r = s + y + r + h;
138
- break;
139
- }
140
- return f(r);
141
- }
142
- return C.toString = function() {
143
- return a + "";
144
- }, C;
145
- }
146
- function Y(a, x) {
147
- var M = F((a = N(a), a.type = "f", a)), m = Math.max(-8, Math.min(8, Math.floor(J(x) / 3))) * 3, w = Math.pow(10, -m), l = R[8 + m / 3];
148
- return function(S) {
149
- return M(w * S) + l;
150
- };
151
- }
152
- return {
153
- format: F,
154
- formatPrefix: Y
155
- };
156
- }
157
- var A, nn, tn;
158
- rn({
159
- thousands: ",",
160
- grouping: [3],
161
- currency: ["$", ""]
162
- });
163
- function rn(n) {
164
- return A = v(n), nn = A.format, tn = A.formatPrefix, A;
165
- }
166
- export {
167
- tn as a,
168
- nn as b,
169
- J as e,
170
- N as f
171
- };
@@ -1 +0,0 @@
1
- "use strict";function J(n){return Math.abs(n=Math.round(n))>=1e21?n.toLocaleString("en").replace(/,/g,""):n.toString(10)}function j(n,t){if((e=(n=t?n.toExponential(t-1):n.toExponential()).indexOf("e"))<0)return null;var e,i=n.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+n.slice(e+1)]}function U(n){return n=j(Math.abs(n)),n?n[1]:NaN}function K(n,t){return function(e,i){for(var o=e.length,f=[],c=0,u=n[0],b=0;o>0&&u>0&&(b+u+1>i&&(u=Math.max(1,i-b)),f.push(e.substring(o-=u,o+u)),!((b+=u+1)>i));)u=n[c=(c+1)%n.length];return f.reverse().join(t)}}function Q(n){return function(t){return t.replace(/[0-9]/g,function(e){return n[+e]})}}var V=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function E(n){if(!(t=V.exec(n)))throw new Error("invalid format: "+n);var t;return new $({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]})}E.prototype=$.prototype;function $(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+""}$.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 W(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 Y;function _(n,t){var e=j(n,t);if(!e)return n+"";var i=e[0],o=e[1],f=o-(Y=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,c=i.length;return f===c?i:f>c?i+new Array(f-c+1).join("0"):f>0?i.slice(0,f)+"."+i.slice(f):"0."+new Array(1-f).join("0")+j(n,Math.max(0,t+f-1))[0]}function G(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 I={"%":(n,t)=>(n*100).toFixed(t),b:n=>Math.round(n).toString(2),c:n=>n+"",d:J,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)=>G(n*100,t),r:G,s:_,X:n=>Math.round(n).toString(16).toUpperCase(),x:n=>Math.round(n).toString(16)};function X(n){return n}var O=Array.prototype.map,R=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function v(n){var t=n.grouping===void 0||n.thousands===void 0?X:K(O.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+"",f=n.numerals===void 0?X:Q(O.call(n.numerals,String)),c=n.percent===void 0?"%":n.percent+"",u=n.minus===void 0?"−":n.minus+"",b=n.nan===void 0?"NaN":n.nan+"";function F(a){a=E(a);var x=a.fill,M=a.align,h=a.sign,w=a.symbol,l=a.zero,S=a.width,N=a.comma,g=a.precision,L=a.trim,d=a.type;d==="n"?(N=!0,d="g"):I[d]||(g===void 0&&(g=12),L=!0,d="g"),(l||x==="0"&&M==="=")&&(l=!0,x="0",M="=");var q=w==="$"?e:w==="#"&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",B=w==="$"?i:/[%p]/.test(d)?c:"",T=I[d],H=/[defgprs%]/.test(d);g=g===void 0?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g));function C(r){var y=q,m=B,p,D,k;if(d==="c")m=T(r)+m,r="";else{r=+r;var P=r<0||1/r<0;if(r=isNaN(r)?b:T(Math.abs(r),g),L&&(r=W(r)),P&&+r==0&&h!=="+"&&(P=!1),y=(P?h==="("?h:u:h==="-"||h==="("?"":h)+y,m=(d==="s"?R[8+Y/3]:"")+m+(P&&h==="("?")":""),H){for(p=-1,D=r.length;++p<D;)if(k=r.charCodeAt(p),48>k||k>57){m=(k===46?o+r.slice(p+1):r.slice(p))+m,r=r.slice(0,p);break}}}N&&!l&&(r=t(r,1/0));var z=y.length+r.length+m.length,s=z<S?new Array(S-z+1).join(x):"";switch(N&&l&&(r=t(s+r,s.length?S-m.length:1/0),s=""),M){case"<":r=y+r+m+s;break;case"=":r=y+s+r+m;break;case"^":r=s.slice(0,z=s.length>>1)+y+r+m+s.slice(z);break;default:r=s+y+r+m;break}return f(r)}return C.toString=function(){return a+""},C}function Z(a,x){var M=F((a=E(a),a.type="f",a)),h=Math.max(-8,Math.min(8,Math.floor(U(x)/3)))*3,w=Math.pow(10,-h),l=R[8+h/3];return function(S){return M(w*S)+l}}return{format:F,formatPrefix:Z}}var A;exports.format=void 0;exports.formatPrefix=void 0;nn({thousands:",",grouping:[3],currency:["$",""]});function nn(n){return A=v(n),exports.format=A.format,exports.formatPrefix=A.formatPrefix,A}exports.exponent=U;exports.formatSpecifier=E;