sparkdesign 0.4.6 → 0.4.7
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.
- package/AI_README.md +60 -0
- package/README.md +1 -1
- package/cli/dist/commands/add.js +1 -1
- package/cli/dist/commands/init.js +1 -1
- package/cli/registry/AGENTS.md +9 -2
- package/cli/registry/agent-manifest.json +794 -0
- package/cli/registry/basic/alert.tsx +76 -0
- package/cli/registry/basic/aspect-ratio.tsx +8 -0
- package/cli/registry/basic/breadcrumb.tsx +117 -0
- package/cli/registry/basic/button-group.tsx +79 -0
- package/cli/registry/basic/button.tsx +1 -1
- package/cli/registry/basic/calendar.tsx +221 -0
- package/cli/registry/basic/card.tsx +103 -0
- package/cli/registry/basic/carousel.tsx +241 -0
- package/cli/registry/basic/chart.tsx +372 -0
- package/cli/registry/basic/checkbox.tsx +42 -0
- package/cli/registry/basic/collapsible-card.tsx +2 -2
- package/cli/registry/basic/combobox.tsx +75 -0
- package/cli/registry/basic/command.tsx +184 -0
- package/cli/registry/basic/context-menu.tsx +239 -0
- package/cli/registry/basic/data-table.tsx +73 -0
- package/cli/registry/basic/date-picker.tsx +13 -0
- package/cli/registry/basic/dialog.tsx +169 -0
- package/cli/registry/basic/direction.tsx +25 -0
- package/cli/registry/basic/drawer.tsx +164 -0
- package/cli/registry/basic/dropdown-menu.tsx +0 -4
- package/cli/registry/basic/empty.tsx +104 -0
- package/cli/registry/basic/field.tsx +248 -0
- package/cli/registry/basic/hover-card.tsx +58 -0
- package/cli/registry/basic/input-group.tsx +168 -0
- package/cli/registry/basic/input-otp.tsx +75 -0
- package/cli/registry/basic/input.tsx +27 -0
- package/cli/registry/basic/item.tsx +204 -0
- package/cli/registry/basic/label.tsx +24 -0
- package/cli/registry/basic/menubar.tsx +274 -0
- package/cli/registry/basic/native-select.tsx +62 -0
- package/cli/registry/basic/navigation-menu.tsx +168 -0
- package/cli/registry/basic/popover.tsx +59 -0
- package/cli/registry/basic/scroll-area.tsx +58 -0
- package/cli/registry/basic/select.tsx +2 -1
- package/cli/registry/basic/separator.tsx +26 -0
- package/cli/registry/basic/sheet.tsx +18 -0
- package/cli/registry/basic/textarea.tsx +25 -0
- package/cli/registry/basic/toggle.tsx +1 -1
- package/cli/registry/basic/typography.tsx +1 -1
- package/cli/registry/chat/chat-input/chat-input-textarea.tsx +1 -1
- package/cli/registry/chat/chat-input/compound.tsx +4 -3
- package/cli/registry/chat/chat-input/context.tsx +4 -1
- package/cli/registry/chat/code-block-part.tsx +1 -1
- package/cli/registry/chat/conversation-anchor-nav.tsx +349 -0
- package/cli/registry/chat/file-attachment.tsx +2 -1
- package/cli/registry/chat/file-review-part.tsx +21 -21
- package/cli/registry/chat/markdown.tsx +2 -2
- package/cli/registry/chat/queue-indicator.tsx +1 -0
- package/cli/registry/chat/streaming-markdown-block.tsx +12 -8
- package/cli/registry/chat/tool-invocation-card.tsx +4 -1
- package/cli/registry/lib/file-icon-maps.ts +22 -22
- package/cli/registry/meta.json +518 -0
- package/cli/registry/tokens/ontology.json +404 -0
- package/cli/registry/tokens/scale/presets/compact.css +16 -5
- package/cli/registry/tokens/scale/presets/dense.css +13 -2
- package/cli/registry/tokens/scale/presets/sharp.css +18 -6
- package/cli/registry/tokens/scale/presets/soft.css +23 -1
- package/dist/registry/basic/alert.d.ts +24 -0
- package/dist/registry/basic/aspect-ratio.d.ts +16 -0
- package/dist/registry/basic/breadcrumb.d.ts +24 -0
- package/dist/registry/basic/button-group.d.ts +26 -0
- package/dist/registry/basic/button.d.ts +1 -1
- package/dist/registry/basic/calendar.d.ts +22 -0
- package/dist/registry/basic/card.d.ts +27 -0
- package/dist/registry/basic/carousel.d.ts +19 -0
- package/dist/registry/basic/chart.d.ts +55 -0
- package/dist/registry/basic/checkbox.d.ts +21 -0
- package/dist/registry/basic/combobox.d.ts +26 -0
- package/dist/registry/basic/command.d.ts +18 -0
- package/dist/registry/basic/context-menu.d.ts +44 -0
- package/dist/registry/basic/data-table.d.ts +26 -0
- package/dist/registry/basic/date-picker.d.ts +18 -0
- package/dist/registry/basic/dialog.d.ts +39 -0
- package/dist/registry/basic/direction.d.ts +19 -0
- package/dist/registry/basic/drawer.d.ts +37 -0
- package/dist/registry/basic/empty.d.ts +22 -0
- package/dist/registry/basic/field.d.ts +24 -0
- package/dist/registry/basic/hover-card.d.ts +22 -0
- package/dist/registry/basic/input-group.d.ts +27 -0
- package/dist/registry/basic/input-otp.d.ts +22 -0
- package/dist/registry/basic/input.d.ts +15 -0
- package/dist/registry/basic/item.d.ts +34 -0
- package/dist/registry/basic/label.d.ts +16 -0
- package/dist/registry/basic/menubar.d.ts +37 -0
- package/dist/registry/basic/native-select.d.ts +18 -0
- package/dist/registry/basic/navigation-menu.d.ts +25 -0
- package/dist/registry/basic/popover.d.ts +23 -0
- package/dist/registry/basic/scroll-area.d.ts +5 -0
- package/dist/registry/basic/separator.d.ts +16 -0
- package/dist/registry/basic/sheet.d.ts +13 -0
- package/dist/registry/basic/textarea.d.ts +15 -0
- package/dist/registry/basic/toggle.d.ts +1 -1
- package/dist/registry/chat/chat-input/context.d.ts +3 -1
- package/dist/registry/chat/conversation-anchor-nav.d.ts +72 -0
- package/dist/registry/chat/tool-invocation-card.d.ts +2 -0
- package/dist/scale/presets/compact.css +16 -5
- package/dist/scale/presets/dense.css +13 -2
- package/dist/scale/presets/sharp.css +18 -6
- package/dist/scale/presets/soft.css +23 -1
- package/dist/spark-design.cjs.js +40 -36
- package/dist/spark-design.es.js +8647 -8657
- package/dist/sparkdesign.css +1 -1
- package/dist/src/components/basic/Alert/index.d.ts +13 -0
- package/dist/src/components/basic/AspectRatio/index.d.ts +13 -0
- package/dist/src/components/basic/Breadcrumb/index.d.ts +12 -0
- package/dist/src/components/basic/ButtonGroup/index.d.ts +13 -0
- package/dist/src/components/basic/Calendar/index.d.ts +13 -0
- package/dist/src/components/basic/Card/index.d.ts +13 -0
- package/dist/src/components/basic/Carousel/index.d.ts +12 -0
- package/dist/src/components/basic/Chart/index.d.ts +13 -0
- package/dist/src/components/basic/Checkbox/index.d.ts +13 -0
- package/dist/src/components/basic/Combobox/index.d.ts +13 -0
- package/dist/src/components/basic/Command/index.d.ts +12 -0
- package/dist/src/components/basic/ContextMenu/index.d.ts +19 -0
- package/dist/src/components/basic/DataTable/index.d.ts +13 -0
- package/dist/src/components/basic/DatePicker/index.d.ts +13 -0
- package/dist/src/components/basic/Dialog/index.d.ts +16 -0
- package/dist/src/components/basic/Direction/index.d.ts +13 -0
- package/dist/src/components/basic/Drawer/index.d.ts +16 -0
- package/dist/src/components/basic/Empty/index.d.ts +12 -0
- package/dist/src/components/basic/Field/index.d.ts +12 -0
- package/dist/src/components/basic/HoverCard/index.d.ts +16 -0
- package/dist/src/components/basic/Input/index.d.ts +13 -0
- package/dist/src/components/basic/InputGroup/index.d.ts +12 -0
- package/dist/src/components/basic/InputOTP/index.d.ts +12 -0
- package/dist/src/components/basic/Item/index.d.ts +12 -0
- package/dist/src/components/basic/Label/index.d.ts +13 -0
- package/dist/src/components/basic/Menubar/index.d.ts +12 -0
- package/dist/src/components/basic/NativeSelect/index.d.ts +12 -0
- package/dist/src/components/basic/NavigationMenu/index.d.ts +12 -0
- package/dist/src/components/basic/Popover/index.d.ts +16 -0
- package/dist/src/components/basic/ScrollArea/index.d.ts +12 -0
- package/dist/src/components/basic/Separator/index.d.ts +13 -0
- package/dist/src/components/basic/Sheet/index.d.ts +13 -0
- package/dist/src/components/basic/Textarea/index.d.ts +13 -0
- package/dist/src/components/chat/ConversationAnchorNav/index.d.ts +13 -0
- package/dist/src/components/chat/StreamingMarkdownBlock/index.d.ts +13 -0
- package/dist/src/components/index.d.ts +57 -0
- package/dist/tokens/AGENTS.md +1 -0
- package/dist/tokens/scale/presets/compact.css +16 -5
- package/dist/tokens/scale/presets/dense.css +13 -2
- package/dist/tokens/scale/presets/sharp.css +18 -6
- package/dist/tokens/scale/presets/soft.css +23 -1
- package/docs/agent/component-selection.md +60 -0
- package/docs/agent/token-ontology.md +37 -0
- package/package.json +31 -5
- package/registry/agent-manifest.json +794 -0
- package/registry/tokens/ontology.json +404 -0
- package/dist/_basePickBy-DnQN8w3y.js +0 -151
- package/dist/_basePickBy-a-kPMlkg.cjs +0 -1
- package/dist/_baseUniq-B-N2NQ50.js +0 -614
- package/dist/_baseUniq-Cc_zbSif.cjs +0 -1
- package/dist/arc-BQBhijZ6.js +0 -83
- package/dist/arc-mWQt0Yph.cjs +0 -1
- package/dist/architectureDiagram-VXUJARFQ-BMZEucno.cjs +0 -36
- package/dist/architectureDiagram-VXUJARFQ-DTdjD3Bp.js +0 -4661
- package/dist/blockDiagram-VD42YOAC-CzHn0yob.js +0 -2256
- package/dist/blockDiagram-VD42YOAC-DDxdHAlz.cjs +0 -122
- package/dist/c4Diagram-YG6GDRKO-4Gz0I4gj.cjs +0 -10
- package/dist/c4Diagram-YG6GDRKO-BIy--yVN.js +0 -1580
- package/dist/channel-BQn0o8bs.js +0 -5
- package/dist/channel-DaN7XniJ.cjs +0 -1
- package/dist/chunk-4BX2VUAB-BlQFTQqz.cjs +0 -1
- package/dist/chunk-4BX2VUAB-Czitj3Kc.js +0 -8
- package/dist/chunk-55IACEB6-DXacNZbO.js +0 -8
- package/dist/chunk-55IACEB6-DnDxpye9.cjs +0 -1
- package/dist/chunk-B4BG7PRW-CBdN0q_V.js +0 -1375
- package/dist/chunk-B4BG7PRW-DbGvUkGO.cjs +0 -165
- package/dist/chunk-DI55MBZ5-D1YJMs6x.cjs +0 -220
- package/dist/chunk-DI55MBZ5-NCQTvayw.js +0 -1370
- package/dist/chunk-FMBD7UC4-CsGMbrtr.js +0 -19
- package/dist/chunk-FMBD7UC4-Di7cUUh5.cjs +0 -15
- package/dist/chunk-QN33PNHL-0j5LC8Lm.cjs +0 -1
- package/dist/chunk-QN33PNHL-3GERZBRm.js +0 -19
- package/dist/chunk-QZHKN3VN-AVEY9ImQ.js +0 -15
- package/dist/chunk-QZHKN3VN-s8Z0a8mc.cjs +0 -1
- package/dist/chunk-TZMSLE5B-CAf87HPt.cjs +0 -1
- package/dist/chunk-TZMSLE5B-sbiflal0.js +0 -64
- package/dist/classDiagram-2ON5EDUG-Ct9JLIN2.cjs +0 -1
- package/dist/classDiagram-2ON5EDUG-Dzfrft3a.js +0 -16
- package/dist/classDiagram-v2-WZHVMYZB-Ct9JLIN2.cjs +0 -1
- package/dist/classDiagram-v2-WZHVMYZB-Dzfrft3a.js +0 -16
- package/dist/clone-Cde_NQ8V.js +0 -8
- package/dist/clone-DCNjWuM2.cjs +0 -1
- package/dist/cose-bilkent-S5V4N54A-0uLijMro.cjs +0 -1
- package/dist/cose-bilkent-S5V4N54A-Bb08N431.js +0 -2608
- package/dist/cytoscape.esm-CNUX3VTg.cjs +0 -321
- package/dist/cytoscape.esm-Cvf3sx9F.js +0 -18704
- package/dist/dagre-6UL2VRFP-CY_Wz5Zd.js +0 -444
- package/dist/dagre-6UL2VRFP-Dxe7_qZc.cjs +0 -4
- package/dist/defaultLocale-BgPVtth8.js +0 -171
- package/dist/defaultLocale-C4wbwF1n.cjs +0 -1
- package/dist/diagram-PSM6KHXK-D2bdb7MT.js +0 -531
- package/dist/diagram-PSM6KHXK-YF69SUjY.cjs +0 -24
- package/dist/diagram-QEK2KX5R-BpUSoh0-.js +0 -217
- package/dist/diagram-QEK2KX5R-DZPGteon.cjs +0 -43
- package/dist/diagram-S2PKOQOG-ht-zdvFG.cjs +0 -24
- package/dist/diagram-S2PKOQOG-zFeLJ50Z.js +0 -142
- package/dist/erDiagram-Q2GNP2WA-B38iJ6ts.js +0 -841
- package/dist/erDiagram-Q2GNP2WA-RgS80DDU.cjs +0 -60
- package/dist/flowDiagram-NV44I4VS-BHilOs2p.cjs +0 -162
- package/dist/flowDiagram-NV44I4VS-BrBJcoce.js +0 -1620
- package/dist/ganttDiagram-JELNMOA3-pZiJeFio.cjs +0 -267
- package/dist/ganttDiagram-JELNMOA3-tw6FhkWJ.js +0 -2670
- package/dist/gitGraphDiagram-V2S2FVAM-BWn5uIK5.js +0 -699
- package/dist/gitGraphDiagram-V2S2FVAM-DKKeG-9R.cjs +0 -65
- package/dist/graph-DIbblrZP.cjs +0 -1
- package/dist/graph-DPcK91G3.js +0 -247
- package/dist/infoDiagram-HS3SLOUP-B8gwwhct.cjs +0 -2
- package/dist/infoDiagram-HS3SLOUP-D47PNcP_.js +0 -24
- package/dist/init-CHZsXQcr.cjs +0 -1
- package/dist/init-DjUOC4st.js +0 -16
- package/dist/journeyDiagram-XKPGCS4Q-BG3cfhyU.js +0 -834
- package/dist/journeyDiagram-XKPGCS4Q-D8DVLJof.cjs +0 -139
- package/dist/kanban-definition-3W4ZIXB7-4OCnEouP.cjs +0 -89
- package/dist/kanban-definition-3W4ZIXB7-CWi_ssF9.js +0 -719
- package/dist/layout-Byuh8f-J.cjs +0 -1
- package/dist/layout-CdLdvj1j.js +0 -1335
- package/dist/linear-C2Q_PI9B.js +0 -259
- package/dist/linear-C69aPBW1.cjs +0 -1
- package/dist/mermaid.core-DBwAx_jp.cjs +0 -249
- package/dist/mermaid.core-gFR0XUlD.js +0 -15300
- package/dist/mindmap-definition-VGOIOE7T-8P7obVV4.cjs +0 -68
- package/dist/mindmap-definition-VGOIOE7T-DnOa7WJ9.js +0 -784
- package/dist/ordinal-B6-f3MAq.js +0 -61
- package/dist/ordinal-CagbB1m8.cjs +0 -1
- package/dist/pieDiagram-ADFJNKIX-5NAlvhMo.js +0 -161
- package/dist/pieDiagram-ADFJNKIX-CQBG4yR9.cjs +0 -30
- package/dist/quadrantDiagram-AYHSOK5B-Oe4y7RZ0.cjs +0 -7
- package/dist/quadrantDiagram-AYHSOK5B-rh2DPEP1.js +0 -1022
- package/dist/requirementDiagram-UZGBJVZJ-DcWaCuXr.js +0 -850
- package/dist/requirementDiagram-UZGBJVZJ-gfdlrFiq.cjs +0 -64
- package/dist/sankeyDiagram-TZEHDZUN-CQIKFwD0.js +0 -810
- package/dist/sankeyDiagram-TZEHDZUN-DvPtzQvC.cjs +0 -10
- package/dist/sequenceDiagram-WL72ISMW-BNrsMagL.cjs +0 -145
- package/dist/sequenceDiagram-WL72ISMW-iCX3ckKx.js +0 -2511
- package/dist/stateDiagram-FKZM4ZOC-DBvJ_eeL.cjs +0 -1
- package/dist/stateDiagram-FKZM4ZOC-ZVsJlaHJ.js +0 -263
- package/dist/stateDiagram-v2-4FDKWEC3-CB_nTHcE.js +0 -16
- package/dist/stateDiagram-v2-4FDKWEC3-Xkx17v6T.cjs +0 -1
- package/dist/timeline-definition-IT6M3QCI-BmGkYQiz.cjs +0 -61
- package/dist/timeline-definition-IT6M3QCI-Ck8zTt6w.js +0 -795
- package/dist/treemap-GDKQZRPO-B9sfERx8.js +0 -17922
- package/dist/treemap-GDKQZRPO-BVfJRs0Z.cjs +0 -160
- package/dist/xychartDiagram-PRI3JC2R-By_S8NzN.js +0 -1340
- package/dist/xychartDiagram-PRI3JC2R-CNfDrGxM.cjs +0 -7
|
@@ -1,444 +0,0 @@
|
|
|
1
|
-
import { _ as w, ar as F, as as Y, at as _, au as H, l as r, 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-gFR0XUlD.js";
|
|
2
|
-
import { G as B } from "./graph-DPcK91G3.js";
|
|
3
|
-
import { l as I } from "./layout-CdLdvj1j.js";
|
|
4
|
-
import { i as b } from "./_baseUniq-B-N2NQ50.js";
|
|
5
|
-
import { c as L } from "./clone-Cde_NQ8V.js";
|
|
6
|
-
import { m as A } from "./_basePickBy-DnQN8w3y.js";
|
|
7
|
-
function h(e) {
|
|
8
|
-
var t = {
|
|
9
|
-
options: {
|
|
10
|
-
directed: e.isDirected(),
|
|
11
|
-
multigraph: e.isMultigraph(),
|
|
12
|
-
compound: e.isCompound()
|
|
13
|
-
},
|
|
14
|
-
nodes: ee(e),
|
|
15
|
-
edges: ne(e)
|
|
16
|
-
};
|
|
17
|
-
return b(e.graph()) || (t.value = L(e.graph())), t;
|
|
18
|
-
}
|
|
19
|
-
function ee(e) {
|
|
20
|
-
return A(e.nodes(), function(t) {
|
|
21
|
-
var n = e.node(t), a = e.parent(t), i = { v: t };
|
|
22
|
-
return b(n) || (i.value = n), b(a) || (i.parent = a), i;
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
function ne(e) {
|
|
26
|
-
return A(e.edges(), function(t) {
|
|
27
|
-
var n = e.edge(t), a = { v: t.v, w: t.w };
|
|
28
|
-
return b(t.name) || (a.name = t.name), b(n) || (a.value = n), a;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
var d = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ w(() => {
|
|
32
|
-
y.clear(), J.clear(), d.clear();
|
|
33
|
-
}, "clear"), D = /* @__PURE__ */ w((e, t) => {
|
|
34
|
-
const n = y.get(t) || [];
|
|
35
|
-
return r.trace("In isDescendant", t, " ", e, " = ", n.includes(e)), n.includes(e);
|
|
36
|
-
}, "isDescendant"), se = /* @__PURE__ */ w((e, t) => {
|
|
37
|
-
const n = y.get(t) || [];
|
|
38
|
-
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) || D(e.v, t) || D(e.w, t) || n.includes(e.w) : (r.debug("Tilt, ", t, ",not in descendants"), !1);
|
|
39
|
-
}, "edgeInCluster"), G = /* @__PURE__ */ w((e, t, n, a) => {
|
|
40
|
-
r.warn(
|
|
41
|
-
"Copying children of ",
|
|
42
|
-
e,
|
|
43
|
-
"root",
|
|
44
|
-
a,
|
|
45
|
-
"data",
|
|
46
|
-
t.node(e),
|
|
47
|
-
a
|
|
48
|
-
);
|
|
49
|
-
const i = t.children(e) || [];
|
|
50
|
-
e !== a && i.push(e), r.warn("Copying (nodes) clusterId", e, "nodes", i), i.forEach((o) => {
|
|
51
|
-
if (t.children(o).length > 0)
|
|
52
|
-
G(o, t, n, a);
|
|
53
|
-
else {
|
|
54
|
-
const l = t.node(o);
|
|
55
|
-
r.info("cp ", o, " to ", a, " with parent ", e), n.setNode(o, l), a !== t.parent(o) && (r.warn("Setting parent", o, t.parent(o)), n.setParent(o, t.parent(o))), e !== a && o !== e ? (r.debug("Setting parent", o, e), n.setParent(o, e)) : (r.info("In copy ", e, "root", a, "data", t.node(e), a), r.debug(
|
|
56
|
-
"Not Setting parent for node=",
|
|
57
|
-
o,
|
|
58
|
-
"cluster!==rootId",
|
|
59
|
-
e !== a,
|
|
60
|
-
"node!==clusterId",
|
|
61
|
-
o !== e
|
|
62
|
-
));
|
|
63
|
-
const u = t.edges(o);
|
|
64
|
-
r.debug("Copying Edges", u), u.forEach((c) => {
|
|
65
|
-
r.info("Edge", c);
|
|
66
|
-
const m = t.edge(c.v, c.w, c.name);
|
|
67
|
-
r.info("Edge data", m, a);
|
|
68
|
-
try {
|
|
69
|
-
se(c, a) ? (r.info("Copying as ", c.v, c.w, m, c.name), n.setEdge(c.v, c.w, m, c.name), r.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : r.info(
|
|
70
|
-
"Skipping copy of edge ",
|
|
71
|
-
c.v,
|
|
72
|
-
"-->",
|
|
73
|
-
c.w,
|
|
74
|
-
" rootId: ",
|
|
75
|
-
a,
|
|
76
|
-
" clusterId:",
|
|
77
|
-
e
|
|
78
|
-
);
|
|
79
|
-
} catch (v) {
|
|
80
|
-
r.error(v);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
r.debug("Removing node", o), t.removeNode(o);
|
|
85
|
-
});
|
|
86
|
-
}, "copy"), R = /* @__PURE__ */ w((e, t) => {
|
|
87
|
-
const n = t.children(e);
|
|
88
|
-
let a = [...n];
|
|
89
|
-
for (const i of n)
|
|
90
|
-
J.set(i, e), a = [...a, ...R(i, t)];
|
|
91
|
-
return a;
|
|
92
|
-
}, "extractDescendants"), re = /* @__PURE__ */ w((e, t, n) => {
|
|
93
|
-
const a = e.edges().filter((c) => c.v === t || c.w === t), i = 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 = i.map((c) => ({ v: c.v, w: c.w }));
|
|
94
|
-
return o.filter((c) => l.some((m) => c.v === m.v && c.w === m.w));
|
|
95
|
-
}, "findCommonEdges"), C = /* @__PURE__ */ w((e, t, n) => {
|
|
96
|
-
const a = t.children(e);
|
|
97
|
-
if (r.trace("Searching children of id ", e, a), a.length < 1)
|
|
98
|
-
return e;
|
|
99
|
-
let i;
|
|
100
|
-
for (const o of a) {
|
|
101
|
-
const l = C(o, t, n), u = re(t, n, l);
|
|
102
|
-
if (l)
|
|
103
|
-
if (u.length > 0)
|
|
104
|
-
i = l;
|
|
105
|
-
else
|
|
106
|
-
return l;
|
|
107
|
-
}
|
|
108
|
-
return i;
|
|
109
|
-
}, "findNonClusterChild"), k = /* @__PURE__ */ w((e) => !d.has(e) || !d.get(e).externalConnections ? e : d.has(e) ? d.get(e).id : e, "getAnchorId"), ie = /* @__PURE__ */ w((e, t) => {
|
|
110
|
-
if (!e || t > 10) {
|
|
111
|
-
r.debug("Opting out, no graph ");
|
|
112
|
-
return;
|
|
113
|
-
} else
|
|
114
|
-
r.debug("Opting in, graph ");
|
|
115
|
-
e.nodes().forEach(function(n) {
|
|
116
|
-
e.children(n).length > 0 && (r.warn(
|
|
117
|
-
"Cluster identified",
|
|
118
|
-
n,
|
|
119
|
-
" Replacement id in edges: ",
|
|
120
|
-
C(n, e, n)
|
|
121
|
-
), y.set(n, R(n, e)), d.set(n, { id: C(n, e, n), clusterData: e.node(n) }));
|
|
122
|
-
}), e.nodes().forEach(function(n) {
|
|
123
|
-
const a = e.children(n), i = e.edges();
|
|
124
|
-
a.length > 0 ? (r.debug("Cluster identified", n, y), i.forEach((o) => {
|
|
125
|
-
const l = D(o.v, n), u = D(o.w, n);
|
|
126
|
-
l ^ u && (r.warn("Edge: ", o, " leaves cluster ", n), r.warn("Descendants of XXX ", n, ": ", y.get(n)), d.get(n).externalConnections = !0);
|
|
127
|
-
})) : r.debug("Not a cluster ", n, y);
|
|
128
|
-
});
|
|
129
|
-
for (let n of d.keys()) {
|
|
130
|
-
const a = d.get(n).id, i = e.parent(a);
|
|
131
|
-
i !== n && d.has(i) && !d.get(i).externalConnections && (d.get(n).id = i);
|
|
132
|
-
}
|
|
133
|
-
e.edges().forEach(function(n) {
|
|
134
|
-
const a = e.edge(n);
|
|
135
|
-
r.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), r.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n)));
|
|
136
|
-
let i = n.v, o = n.w;
|
|
137
|
-
if (r.warn(
|
|
138
|
-
"Fix XXX",
|
|
139
|
-
d,
|
|
140
|
-
"ids:",
|
|
141
|
-
n.v,
|
|
142
|
-
n.w,
|
|
143
|
-
"Translating: ",
|
|
144
|
-
d.get(n.v),
|
|
145
|
-
" --- ",
|
|
146
|
-
d.get(n.w)
|
|
147
|
-
), d.get(n.v) || d.get(n.w)) {
|
|
148
|
-
if (r.warn("Fixing and trying - removing XXX", n.v, n.w, n.name), i = k(n.v), o = k(n.w), e.removeEdge(n.v, n.w, n.name), i !== n.v) {
|
|
149
|
-
const l = e.parent(i);
|
|
150
|
-
d.get(l).externalConnections = !0, a.fromCluster = n.v;
|
|
151
|
-
}
|
|
152
|
-
if (o !== n.w) {
|
|
153
|
-
const l = e.parent(o);
|
|
154
|
-
d.get(l).externalConnections = !0, a.toCluster = n.w;
|
|
155
|
-
}
|
|
156
|
-
r.warn("Fix Replacing with XXX", i, o, n.name), e.setEdge(i, o, a, n.name);
|
|
157
|
-
}
|
|
158
|
-
}), r.warn("Adjusted Graph", h(e)), T(e, 0), r.trace(d);
|
|
159
|
-
}, "adjustClustersAndEdges"), T = /* @__PURE__ */ w((e, t) => {
|
|
160
|
-
if (r.warn("extractor - ", t, h(e), e.children("D")), t > 10) {
|
|
161
|
-
r.error("Bailing out");
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
let n = e.nodes(), a = !1;
|
|
165
|
-
for (const i of n) {
|
|
166
|
-
const o = e.children(i);
|
|
167
|
-
a = a || o.length > 0;
|
|
168
|
-
}
|
|
169
|
-
if (!a) {
|
|
170
|
-
r.debug("Done, no node has children", e.nodes());
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
r.debug("Nodes = ", n, t);
|
|
174
|
-
for (const i of n)
|
|
175
|
-
if (r.debug(
|
|
176
|
-
"Extracting node",
|
|
177
|
-
i,
|
|
178
|
-
d,
|
|
179
|
-
d.has(i) && !d.get(i).externalConnections,
|
|
180
|
-
!e.parent(i),
|
|
181
|
-
e.node(i),
|
|
182
|
-
e.children("D"),
|
|
183
|
-
" Depth ",
|
|
184
|
-
t
|
|
185
|
-
), !d.has(i))
|
|
186
|
-
r.debug("Not a cluster", i, t);
|
|
187
|
-
else if (!d.get(i).externalConnections && e.children(i) && e.children(i).length > 0) {
|
|
188
|
-
r.warn(
|
|
189
|
-
"Cluster without external connections, without a parent and with children",
|
|
190
|
-
i,
|
|
191
|
-
t
|
|
192
|
-
);
|
|
193
|
-
let l = e.graph().rankdir === "TB" ? "LR" : "TB";
|
|
194
|
-
d.get(i)?.clusterData?.dir && (l = d.get(i).clusterData.dir, r.warn("Fixing dir", d.get(i).clusterData.dir, l));
|
|
195
|
-
const u = new B({
|
|
196
|
-
multigraph: !0,
|
|
197
|
-
compound: !0
|
|
198
|
-
}).setGraph({
|
|
199
|
-
rankdir: l,
|
|
200
|
-
nodesep: 50,
|
|
201
|
-
ranksep: 50,
|
|
202
|
-
marginx: 8,
|
|
203
|
-
marginy: 8
|
|
204
|
-
}).setDefaultEdgeLabel(function() {
|
|
205
|
-
return {};
|
|
206
|
-
});
|
|
207
|
-
r.warn("Old graph before copy", h(e)), G(i, e, u, i), e.setNode(i, {
|
|
208
|
-
clusterNode: !0,
|
|
209
|
-
id: i,
|
|
210
|
-
clusterData: d.get(i).clusterData,
|
|
211
|
-
label: d.get(i).label,
|
|
212
|
-
graph: u
|
|
213
|
-
}), r.warn("New graph after copy node: (", i, ")", h(u)), r.debug("Old graph after copy", h(e));
|
|
214
|
-
} else
|
|
215
|
-
r.warn(
|
|
216
|
-
"Cluster ** ",
|
|
217
|
-
i,
|
|
218
|
-
" **not meeting the criteria !externalConnections:",
|
|
219
|
-
!d.get(i).externalConnections,
|
|
220
|
-
" no parent: ",
|
|
221
|
-
!e.parent(i),
|
|
222
|
-
" children ",
|
|
223
|
-
e.children(i) && e.children(i).length > 0,
|
|
224
|
-
e.children("D"),
|
|
225
|
-
t
|
|
226
|
-
), r.debug(d);
|
|
227
|
-
n = e.nodes(), r.warn("New list of nodes", n);
|
|
228
|
-
for (const i of n) {
|
|
229
|
-
const o = e.node(i);
|
|
230
|
-
r.warn(" Now next level", i, o), o?.clusterNode && T(o.graph, t + 1);
|
|
231
|
-
}
|
|
232
|
-
}, "extractor"), M = /* @__PURE__ */ w((e, t) => {
|
|
233
|
-
if (t.length === 0)
|
|
234
|
-
return [];
|
|
235
|
-
let n = Object.assign([], t);
|
|
236
|
-
return t.forEach((a) => {
|
|
237
|
-
const i = e.children(a), o = M(e, i);
|
|
238
|
-
n = [...n, ...o];
|
|
239
|
-
}), n;
|
|
240
|
-
}, "sorter"), oe = /* @__PURE__ */ w((e) => M(e, e.children()), "sortNodesByHierarchy"), j = /* @__PURE__ */ w(async (e, t, n, a, i, o) => {
|
|
241
|
-
r.warn("Graph in recursive render:XAX", h(t), i);
|
|
242
|
-
const l = t.graph().rankdir;
|
|
243
|
-
r.trace("Dir in recursive render - dir:", l);
|
|
244
|
-
const u = e.insert("g").attr("class", "root");
|
|
245
|
-
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]));
|
|
246
|
-
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");
|
|
247
|
-
await Promise.all(
|
|
248
|
-
t.nodes().map(async function(f) {
|
|
249
|
-
const s = t.node(f);
|
|
250
|
-
if (i !== void 0) {
|
|
251
|
-
const g = JSON.parse(JSON.stringify(i.clusterData));
|
|
252
|
-
r.trace(
|
|
253
|
-
`Setting data for parent cluster XXX
|
|
254
|
-
Node.id = `,
|
|
255
|
-
f,
|
|
256
|
-
`
|
|
257
|
-
data=`,
|
|
258
|
-
g.height,
|
|
259
|
-
`
|
|
260
|
-
Parent cluster`,
|
|
261
|
-
i.height
|
|
262
|
-
), t.setNode(i.id, g), t.parent(f) || (r.trace("Setting parent", f, i.id), t.setParent(f, i.id, g));
|
|
263
|
-
}
|
|
264
|
-
if (r.info("(Insert) Node XXX" + f + ": " + JSON.stringify(t.node(f))), s?.clusterNode) {
|
|
265
|
-
r.info("Cluster identified XBX", f, s.width, t.node(f));
|
|
266
|
-
const { ranksep: g, nodesep: E } = t.graph();
|
|
267
|
-
s.graph.setGraph({
|
|
268
|
-
...s.graph.graph(),
|
|
269
|
-
ranksep: g + 25,
|
|
270
|
-
nodesep: E
|
|
271
|
-
});
|
|
272
|
-
const N = await j(
|
|
273
|
-
X,
|
|
274
|
-
s.graph,
|
|
275
|
-
n,
|
|
276
|
-
a,
|
|
277
|
-
t.node(f),
|
|
278
|
-
o
|
|
279
|
-
), x = N.elem;
|
|
280
|
-
z(s, x), s.diff = N.diff || 0, r.info(
|
|
281
|
-
"New compound node after recursive render XAX",
|
|
282
|
-
f,
|
|
283
|
-
"width",
|
|
284
|
-
// node,
|
|
285
|
-
s.width,
|
|
286
|
-
"height",
|
|
287
|
-
s.height
|
|
288
|
-
// node.x,
|
|
289
|
-
// node.y
|
|
290
|
-
), U(x, s);
|
|
291
|
-
} else
|
|
292
|
-
t.children(f).length > 0 ? (r.trace(
|
|
293
|
-
"Cluster - the non recursive path XBX",
|
|
294
|
-
f,
|
|
295
|
-
s.id,
|
|
296
|
-
s,
|
|
297
|
-
s.width,
|
|
298
|
-
"Graph:",
|
|
299
|
-
t
|
|
300
|
-
), r.trace(C(s.id, t)), d.set(s.id, { id: C(s.id, t), node: s })) : (r.trace("Node - the non recursive path XAX", f, X, t.node(f), l), await $(X, t.node(f), { config: o, dir: l }));
|
|
301
|
-
})
|
|
302
|
-
), await (/* @__PURE__ */ w(async () => {
|
|
303
|
-
const f = t.edges().map(async function(s) {
|
|
304
|
-
const g = t.edge(s.v, s.w, s.name);
|
|
305
|
-
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(
|
|
306
|
-
"Fix",
|
|
307
|
-
d,
|
|
308
|
-
"ids:",
|
|
309
|
-
s.v,
|
|
310
|
-
s.w,
|
|
311
|
-
"Translating: ",
|
|
312
|
-
d.get(s.v),
|
|
313
|
-
d.get(s.w)
|
|
314
|
-
), await Z(v, g);
|
|
315
|
-
});
|
|
316
|
-
await Promise.all(f);
|
|
317
|
-
}, "processEdges"))(), r.info("Graph before layout:", JSON.stringify(h(t))), r.info("############################################# XXX"), r.info("### Layout ### XXX"), r.info("############################################# XXX"), I(t), r.info("Graph after layout:", JSON.stringify(h(t)));
|
|
318
|
-
let O = 0, { subGraphTitleTotalMargin: S } = q(o);
|
|
319
|
-
return await Promise.all(
|
|
320
|
-
oe(t).map(async function(f) {
|
|
321
|
-
const s = t.node(f);
|
|
322
|
-
if (r.info(
|
|
323
|
-
"Position XBX => " + f + ": (" + s.x,
|
|
324
|
-
"," + s.y,
|
|
325
|
-
") width: ",
|
|
326
|
-
s.width,
|
|
327
|
-
" height: ",
|
|
328
|
-
s.height
|
|
329
|
-
), s?.clusterNode)
|
|
330
|
-
s.y += S, r.info(
|
|
331
|
-
"A tainted cluster node XBX1",
|
|
332
|
-
f,
|
|
333
|
-
s.id,
|
|
334
|
-
s.width,
|
|
335
|
-
s.height,
|
|
336
|
-
s.x,
|
|
337
|
-
s.y,
|
|
338
|
-
t.parent(f)
|
|
339
|
-
), d.get(s.id).node = s, P(s);
|
|
340
|
-
else if (t.children(f).length > 0) {
|
|
341
|
-
r.info(
|
|
342
|
-
"A pure cluster node XBX1",
|
|
343
|
-
f,
|
|
344
|
-
s.id,
|
|
345
|
-
s.x,
|
|
346
|
-
s.y,
|
|
347
|
-
s.width,
|
|
348
|
-
s.height,
|
|
349
|
-
t.parent(f)
|
|
350
|
-
), s.height += S, t.node(s.parentId);
|
|
351
|
-
const g = s?.padding / 2 || 0, E = s?.labelBBox?.height || 0, N = E - g || 0;
|
|
352
|
-
r.debug("OffsetY", N, "labelHeight", E, "halfPadding", g), await K(c, s), d.get(s.id).node = s;
|
|
353
|
-
} else {
|
|
354
|
-
const g = t.node(s.parentId);
|
|
355
|
-
s.y += S / 2, r.info(
|
|
356
|
-
"A regular node XBX1 - using the padding",
|
|
357
|
-
s.id,
|
|
358
|
-
"parent",
|
|
359
|
-
s.parentId,
|
|
360
|
-
s.width,
|
|
361
|
-
s.height,
|
|
362
|
-
s.x,
|
|
363
|
-
s.y,
|
|
364
|
-
"offsetY",
|
|
365
|
-
s.offsetY,
|
|
366
|
-
"parent",
|
|
367
|
-
g,
|
|
368
|
-
g?.offsetY,
|
|
369
|
-
s
|
|
370
|
-
), P(s);
|
|
371
|
-
}
|
|
372
|
-
})
|
|
373
|
-
), t.edges().forEach(function(f) {
|
|
374
|
-
const s = t.edge(f);
|
|
375
|
-
r.info("Edge " + f.v + " -> " + f.w + ": " + JSON.stringify(s), s), s.points.forEach((x) => x.y += S / 2);
|
|
376
|
-
const g = t.node(f.v);
|
|
377
|
-
var E = t.node(f.w);
|
|
378
|
-
const N = Q(m, s, d, n, g, E, a);
|
|
379
|
-
W(s, N);
|
|
380
|
-
}), t.nodes().forEach(function(f) {
|
|
381
|
-
const s = t.node(f);
|
|
382
|
-
r.info(f, s.type, s.diff), s.isGroup && (O = s.diff);
|
|
383
|
-
}), r.warn("Returning from recursive render XAX", u, O), { elem: u, diff: O };
|
|
384
|
-
}, "recursiveRender"), ge = /* @__PURE__ */ w(async (e, t) => {
|
|
385
|
-
const n = new B({
|
|
386
|
-
multigraph: !0,
|
|
387
|
-
compound: !0
|
|
388
|
-
}).setGraph({
|
|
389
|
-
rankdir: e.direction,
|
|
390
|
-
nodesep: e.config?.nodeSpacing || e.config?.flowchart?.nodeSpacing || e.nodeSpacing,
|
|
391
|
-
ranksep: e.config?.rankSpacing || e.config?.flowchart?.rankSpacing || e.rankSpacing,
|
|
392
|
-
marginx: 8,
|
|
393
|
-
marginy: 8
|
|
394
|
-
}).setDefaultEdgeLabel(function() {
|
|
395
|
-
return {};
|
|
396
|
-
}), a = t.select("g");
|
|
397
|
-
F(a, e.markers, e.type, e.diagramId), Y(), _(), H(), te(), e.nodes.forEach((o) => {
|
|
398
|
-
n.setNode(o.id, { ...o }), o.parentId && n.setParent(o.id, o.parentId);
|
|
399
|
-
}), r.debug("Edges:", e.edges), e.edges.forEach((o) => {
|
|
400
|
-
if (o.start === o.end) {
|
|
401
|
-
const l = o.start, u = l + "---" + l + "---1", c = l + "---" + l + "---2", m = n.node(l);
|
|
402
|
-
n.setNode(u, {
|
|
403
|
-
domId: u,
|
|
404
|
-
id: u,
|
|
405
|
-
parentId: m.parentId,
|
|
406
|
-
labelStyle: "",
|
|
407
|
-
label: "",
|
|
408
|
-
padding: 0,
|
|
409
|
-
shape: "labelRect",
|
|
410
|
-
// shape: 'rect',
|
|
411
|
-
style: "",
|
|
412
|
-
width: 10,
|
|
413
|
-
height: 10
|
|
414
|
-
}), n.setParent(u, m.parentId), n.setNode(c, {
|
|
415
|
-
domId: c,
|
|
416
|
-
id: c,
|
|
417
|
-
parentId: m.parentId,
|
|
418
|
-
labelStyle: "",
|
|
419
|
-
padding: 0,
|
|
420
|
-
// shape: 'rect',
|
|
421
|
-
shape: "labelRect",
|
|
422
|
-
label: "",
|
|
423
|
-
style: "",
|
|
424
|
-
width: 10,
|
|
425
|
-
height: 10
|
|
426
|
-
}), n.setParent(c, m.parentId);
|
|
427
|
-
const v = structuredClone(o), X = structuredClone(o), p = structuredClone(o);
|
|
428
|
-
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");
|
|
429
|
-
} else
|
|
430
|
-
n.setEdge(o.start, o.end, { ...o }, o.id);
|
|
431
|
-
}), r.warn("Graph at first:", JSON.stringify(h(n))), ie(n), r.warn("Graph after XAX:", JSON.stringify(h(n)));
|
|
432
|
-
const i = V();
|
|
433
|
-
await j(
|
|
434
|
-
a,
|
|
435
|
-
n,
|
|
436
|
-
e.type,
|
|
437
|
-
e.diagramId,
|
|
438
|
-
void 0,
|
|
439
|
-
i
|
|
440
|
-
);
|
|
441
|
-
}, "render");
|
|
442
|
-
export {
|
|
443
|
-
ge as render
|
|
444
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./mermaid.core-DBwAx_jp.cjs"),P=require("./graph-DIbblrZP.cjs"),R=require("./layout-Byuh8f-J.cjs"),N=require("./_baseUniq-Cc_zbSif.cjs"),M=require("./clone-DCNjWuM2.cjs"),O=require("./_basePickBy-a-kPMlkg.cjs");function m(e){var o={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:q(e),edges:j(e)};return N.isUndefined(e.graph())||(o.value=M.clone(e.graph())),o}function q(e){return O.map(e.nodes(),function(o){var n=e.node(o),l=e.parent(o),r={v:o};return N.isUndefined(n)||(r.value=n),N.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 N.isUndefined(o.name)||(l.name=o.name),N.isUndefined(n)||(l.value=n),l})}var a=new Map,y=new Map,k=new Map,U=t.__name(()=>{y.clear(),k.clear(),a.clear()},"clear"),S=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)||S(e.v,o)||S(e.w,o)||n.includes(e.w):(t.log.debug("Tilt, ",o,",not in descendants"),!1)},"edgeInCluster"),B=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)B(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"),A=t.__name((e,o)=>{const n=o.children(e);let l=[...n];for(const r of n)k.set(r,e),l=[...l,...A(r,o)];return l},"extractDescendants"),Y=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=Y(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"),H=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,A(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(s.v,n),g=S(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)),J(e,0),t.log.trace(a)},"adjustClustersAndEdges"),J=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 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",m(e)),B(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&&J(s.graph,o+1)}},"extractor"),T=t.__name((e,o)=>{if(o.length===0)return[];let n=Object.assign([],o);return o.forEach(l=>{const r=e.children(l),s=T(e,r);n=[...n,...s]}),n},"sorter"),V=t.__name(e=>T(e,e.children()),"sortNodesByHierarchy"),G=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:E}=o.graph();i.graph.setGraph({...i.graph.graph(),ranksep:u+25,nodesep:E});const p=await G(v,i.graph,n,l,o.node(f),s),_=p.elem;t.updateNodeBounds(i,_),i.diff=p.diff||0,t.log.info("New compound node after recursive render XAX",f,"width",i.width,"height",i.height),t.setNodeElem(_,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"),R.layout(o),t.log.info("Graph after layout:",JSON.stringify(m(o)));let x=0,{subGraphTitleTotalMargin:C}=t.getSubGraphTitleMargins(s);return await Promise.all(V(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,E=i?.labelBBox?.height||0,p=E-u||0;t.log.debug("OffsetY",p,"labelHeight",E,"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(_=>_.y+=C/2);const u=o.node(f.v);var E=o.node(f.w);const p=t.insertEdge(w,i,a,n,u,E,l);t.positionEdgeLabel(i,p)}),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"),z=t.__name(async(e,o)=>{const n=new P.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(),U(),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),X=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",X.label="",w.isGroup&&(h.fromCluster=d,X.toCluster=d),X.id=d+"-cyclic-special-2",X.arrowTypeStart="none",n.setEdge(d,g,h,d+"-cyclic-special-0"),n.setEdge(g,c,v,d+"-cyclic-special-1"),n.setEdge(c,d,X,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))),H(n),t.log.warn("Graph after XAX:",JSON.stringify(m(n)));const r=t.getConfig2();await G(l,n,e.type,e.diagramId,void 0,r)},"render");exports.render=z;
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
function J(n) {
|
|
2
|
-
return Math.abs(n = Math.round(n)) >= 1e21 ? n.toLocaleString("en").replace(/,/g, "") : n.toString(10);
|
|
3
|
-
}
|
|
4
|
-
function j(n, t) {
|
|
5
|
-
if (!isFinite(n) || n === 0) return null;
|
|
6
|
-
var e = (n = t ? n.toExponential(t - 1) : n.toExponential()).indexOf("e"), i = n.slice(0, e);
|
|
7
|
-
return [
|
|
8
|
-
i.length > 1 ? i[0] + i.slice(2) : i,
|
|
9
|
-
+n.slice(e + 1)
|
|
10
|
-
];
|
|
11
|
-
}
|
|
12
|
-
function K(n) {
|
|
13
|
-
return n = j(Math.abs(n)), n ? n[1] : NaN;
|
|
14
|
-
}
|
|
15
|
-
function Q(n, t) {
|
|
16
|
-
return function(e, i) {
|
|
17
|
-
for (var o = e.length, a = [], c = 0, h = n[0], M = 0; o > 0 && h > 0 && (M + h + 1 > i && (h = Math.max(1, i - M)), a.push(e.substring(o -= h, o + h)), !((M += h + 1) > i)); )
|
|
18
|
-
h = n[c = (c + 1) % n.length];
|
|
19
|
-
return a.reverse().join(t);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function V(n) {
|
|
23
|
-
return function(t) {
|
|
24
|
-
return t.replace(/[0-9]/g, function(e) {
|
|
25
|
-
return n[+e];
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
var W = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
|
|
30
|
-
function $(n) {
|
|
31
|
-
if (!(t = W.exec(n))) throw new Error("invalid format: " + n);
|
|
32
|
-
var t;
|
|
33
|
-
return new L({
|
|
34
|
-
fill: t[1],
|
|
35
|
-
align: t[2],
|
|
36
|
-
sign: t[3],
|
|
37
|
-
symbol: t[4],
|
|
38
|
-
zero: t[5],
|
|
39
|
-
width: t[6],
|
|
40
|
-
comma: t[7],
|
|
41
|
-
precision: t[8] && t[8].slice(1),
|
|
42
|
-
trim: t[9],
|
|
43
|
-
type: t[10]
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
$.prototype = L.prototype;
|
|
47
|
-
function L(n) {
|
|
48
|
-
this.fill = n.fill === void 0 ? " " : n.fill + "", this.align = n.align === void 0 ? ">" : n.align + "", this.sign = n.sign === void 0 ? "-" : n.sign + "", this.symbol = n.symbol === void 0 ? "" : n.symbol + "", this.zero = !!n.zero, this.width = n.width === void 0 ? void 0 : +n.width, this.comma = !!n.comma, this.precision = n.precision === void 0 ? void 0 : +n.precision, this.trim = !!n.trim, this.type = n.type === void 0 ? "" : n.type + "";
|
|
49
|
-
}
|
|
50
|
-
L.prototype.toString = function() {
|
|
51
|
-
return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
|
|
52
|
-
};
|
|
53
|
-
function _(n) {
|
|
54
|
-
n: for (var t = n.length, e = 1, i = -1, o; e < t; ++e)
|
|
55
|
-
switch (n[e]) {
|
|
56
|
-
case ".":
|
|
57
|
-
i = o = e;
|
|
58
|
-
break;
|
|
59
|
-
case "0":
|
|
60
|
-
i === 0 && (i = e), o = e;
|
|
61
|
-
break;
|
|
62
|
-
default:
|
|
63
|
-
if (!+n[e]) break n;
|
|
64
|
-
i > 0 && (i = 0);
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
return i > 0 ? n.slice(0, i) + n.slice(o + 1) : n;
|
|
68
|
-
}
|
|
69
|
-
var N;
|
|
70
|
-
function v(n, t) {
|
|
71
|
-
var e = j(n, t);
|
|
72
|
-
if (!e) return N = void 0, n.toPrecision(t);
|
|
73
|
-
var i = e[0], o = e[1], a = o - (N = Math.max(-8, Math.min(8, Math.floor(o / 3))) * 3) + 1, c = i.length;
|
|
74
|
-
return a === c ? i : a > c ? i + new Array(a - c + 1).join("0") : a > 0 ? i.slice(0, a) + "." + i.slice(a) : "0." + new Array(1 - a).join("0") + j(n, Math.max(0, t + a - 1))[0];
|
|
75
|
-
}
|
|
76
|
-
function X(n, t) {
|
|
77
|
-
var e = j(n, t);
|
|
78
|
-
if (!e) return n + "";
|
|
79
|
-
var i = e[0], o = e[1];
|
|
80
|
-
return o < 0 ? "0." + new Array(-o).join("0") + i : i.length > o + 1 ? i.slice(0, o + 1) + "." + i.slice(o + 1) : i + new Array(o - i.length + 2).join("0");
|
|
81
|
-
}
|
|
82
|
-
const O = {
|
|
83
|
-
"%": (n, t) => (n * 100).toFixed(t),
|
|
84
|
-
b: (n) => Math.round(n).toString(2),
|
|
85
|
-
c: (n) => n + "",
|
|
86
|
-
d: J,
|
|
87
|
-
e: (n, t) => n.toExponential(t),
|
|
88
|
-
f: (n, t) => n.toFixed(t),
|
|
89
|
-
g: (n, t) => n.toPrecision(t),
|
|
90
|
-
o: (n) => Math.round(n).toString(8),
|
|
91
|
-
p: (n, t) => X(n * 100, t),
|
|
92
|
-
r: X,
|
|
93
|
-
s: v,
|
|
94
|
-
X: (n) => Math.round(n).toString(16).toUpperCase(),
|
|
95
|
-
x: (n) => Math.round(n).toString(16)
|
|
96
|
-
};
|
|
97
|
-
function R(n) {
|
|
98
|
-
return n;
|
|
99
|
-
}
|
|
100
|
-
var U = Array.prototype.map, Y = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
|
|
101
|
-
function nn(n) {
|
|
102
|
-
var t = n.grouping === void 0 || n.thousands === void 0 ? R : Q(U.call(n.grouping, Number), n.thousands + ""), e = n.currency === void 0 ? "" : n.currency[0] + "", i = n.currency === void 0 ? "" : n.currency[1] + "", o = n.decimal === void 0 ? "." : n.decimal + "", a = n.numerals === void 0 ? R : V(U.call(n.numerals, String)), c = n.percent === void 0 ? "%" : n.percent + "", h = n.minus === void 0 ? "−" : n.minus + "", M = n.nan === void 0 ? "NaN" : n.nan + "";
|
|
103
|
-
function T(f, g) {
|
|
104
|
-
f = $(f);
|
|
105
|
-
var b = f.fill, p = f.align, m = f.sign, w = f.symbol, S = f.zero, E = f.width, F = f.comma, y = f.precision, C = f.trim, d = f.type;
|
|
106
|
-
d === "n" ? (F = !0, d = "g") : O[d] || (y === void 0 && (y = 12), C = !0, d = "g"), (S || b === "0" && p === "=") && (S = !0, b = "0", p = "=");
|
|
107
|
-
var q = (g && g.prefix !== void 0 ? g.prefix : "") + (w === "$" ? e : w === "#" && /[boxX]/.test(d) ? "0" + d.toLowerCase() : ""), B = (w === "$" ? i : /[%p]/.test(d) ? c : "") + (g && g.suffix !== void 0 ? g.suffix : ""), D = O[d], H = /[defgprs%]/.test(d);
|
|
108
|
-
y = y === void 0 ? 6 : /[gprs]/.test(d) ? Math.max(1, Math.min(21, y)) : Math.max(0, Math.min(20, y));
|
|
109
|
-
function G(r) {
|
|
110
|
-
var l = q, u = B, x, I, k;
|
|
111
|
-
if (d === "c")
|
|
112
|
-
u = D(r) + u, r = "";
|
|
113
|
-
else {
|
|
114
|
-
r = +r;
|
|
115
|
-
var P = r < 0 || 1 / r < 0;
|
|
116
|
-
if (r = isNaN(r) ? M : D(Math.abs(r), y), C && (r = _(r)), P && +r == 0 && m !== "+" && (P = !1), l = (P ? m === "(" ? m : h : m === "-" || m === "(" ? "" : m) + l, u = (d === "s" && !isNaN(r) && N !== void 0 ? Y[8 + N / 3] : "") + u + (P && m === "(" ? ")" : ""), H) {
|
|
117
|
-
for (x = -1, I = r.length; ++x < I; )
|
|
118
|
-
if (k = r.charCodeAt(x), 48 > k || k > 57) {
|
|
119
|
-
u = (k === 46 ? o + r.slice(x + 1) : r.slice(x)) + u, r = r.slice(0, x);
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
F && !S && (r = t(r, 1 / 0));
|
|
125
|
-
var z = l.length + r.length + u.length, s = z < E ? new Array(E - z + 1).join(b) : "";
|
|
126
|
-
switch (F && S && (r = t(s + r, s.length ? E - u.length : 1 / 0), s = ""), p) {
|
|
127
|
-
case "<":
|
|
128
|
-
r = l + r + u + s;
|
|
129
|
-
break;
|
|
130
|
-
case "=":
|
|
131
|
-
r = l + s + r + u;
|
|
132
|
-
break;
|
|
133
|
-
case "^":
|
|
134
|
-
r = s.slice(0, z = s.length >> 1) + l + r + u + s.slice(z);
|
|
135
|
-
break;
|
|
136
|
-
default:
|
|
137
|
-
r = s + l + r + u;
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
return a(r);
|
|
141
|
-
}
|
|
142
|
-
return G.toString = function() {
|
|
143
|
-
return f + "";
|
|
144
|
-
}, G;
|
|
145
|
-
}
|
|
146
|
-
function Z(f, g) {
|
|
147
|
-
var b = Math.max(-8, Math.min(8, Math.floor(K(g) / 3))) * 3, p = Math.pow(10, -b), m = T((f = $(f), f.type = "f", f), { suffix: Y[8 + b / 3] });
|
|
148
|
-
return function(w) {
|
|
149
|
-
return m(p * w);
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
return {
|
|
153
|
-
format: T,
|
|
154
|
-
formatPrefix: Z
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
var A, tn, rn;
|
|
158
|
-
en({
|
|
159
|
-
thousands: ",",
|
|
160
|
-
grouping: [3],
|
|
161
|
-
currency: ["$", ""]
|
|
162
|
-
});
|
|
163
|
-
function en(n) {
|
|
164
|
-
return A = nn(n), tn = A.format, rn = A.formatPrefix, A;
|
|
165
|
-
}
|
|
166
|
-
export {
|
|
167
|
-
rn as a,
|
|
168
|
-
tn as b,
|
|
169
|
-
K as e,
|
|
170
|
-
$ as f
|
|
171
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function K(n){return Math.abs(n=Math.round(n))>=1e21?n.toLocaleString("en").replace(/,/g,""):n.toString(10)}function j(n,t){if(!isFinite(n)||n===0)return null;var e=(n=t?n.toExponential(t-1):n.toExponential()).indexOf("e"),i=n.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+n.slice(e+1)]}function Z(n){return n=j(Math.abs(n)),n?n[1]:NaN}function Q(n,t){return function(e,i){for(var o=e.length,a=[],c=0,m=n[0],M=0;o>0&&m>0&&(M+m+1>i&&(m=Math.max(1,i-M)),a.push(e.substring(o-=m,o+m)),!((M+=m+1)>i));)m=n[c=(c+1)%n.length];return a.reverse().join(t)}}function V(n){return function(t){return t.replace(/[0-9]/g,function(e){return n[+e]})}}var W=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function N(n){if(!(t=W.exec(n)))throw new Error("invalid format: "+n);var t;return new L({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}N.prototype=L.prototype;function L(n){this.fill=n.fill===void 0?" ":n.fill+"",this.align=n.align===void 0?">":n.align+"",this.sign=n.sign===void 0?"-":n.sign+"",this.symbol=n.symbol===void 0?"":n.symbol+"",this.zero=!!n.zero,this.width=n.width===void 0?void 0:+n.width,this.comma=!!n.comma,this.precision=n.precision===void 0?void 0:+n.precision,this.trim=!!n.trim,this.type=n.type===void 0?"":n.type+""}L.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function _(n){n:for(var t=n.length,e=1,i=-1,o;e<t;++e)switch(n[e]){case".":i=o=e;break;case"0":i===0&&(i=e),o=e;break;default:if(!+n[e])break n;i>0&&(i=0);break}return i>0?n.slice(0,i)+n.slice(o+1):n}var E;function v(n,t){var e=j(n,t);if(!e)return E=void 0,n.toPrecision(t);var i=e[0],o=e[1],a=o-(E=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,c=i.length;return a===c?i:a>c?i+new Array(a-c+1).join("0"):a>0?i.slice(0,a)+"."+i.slice(a):"0."+new Array(1-a).join("0")+j(n,Math.max(0,t+a-1))[0]}function X(n,t){var e=j(n,t);if(!e)return n+"";var i=e[0],o=e[1];return o<0?"0."+new Array(-o).join("0")+i:i.length>o+1?i.slice(0,o+1)+"."+i.slice(o+1):i+new Array(o-i.length+2).join("0")}const O={"%":(n,t)=>(n*100).toFixed(t),b:n=>Math.round(n).toString(2),c:n=>n+"",d:K,e:(n,t)=>n.toExponential(t),f:(n,t)=>n.toFixed(t),g:(n,t)=>n.toPrecision(t),o:n=>Math.round(n).toString(8),p:(n,t)=>X(n*100,t),r:X,s:v,X:n=>Math.round(n).toString(16).toUpperCase(),x:n=>Math.round(n).toString(16)};function R(n){return n}var U=Array.prototype.map,Y=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function nn(n){var t=n.grouping===void 0||n.thousands===void 0?R:Q(U.call(n.grouping,Number),n.thousands+""),e=n.currency===void 0?"":n.currency[0]+"",i=n.currency===void 0?"":n.currency[1]+"",o=n.decimal===void 0?".":n.decimal+"",a=n.numerals===void 0?R:V(U.call(n.numerals,String)),c=n.percent===void 0?"%":n.percent+"",m=n.minus===void 0?"−":n.minus+"",M=n.nan===void 0?"NaN":n.nan+"";function T(f,g){f=N(f);var x=f.fill,p=f.align,h=f.sign,w=f.symbol,S=f.zero,F=f.width,$=f.comma,y=f.precision,C=f.trim,d=f.type;d==="n"?($=!0,d="g"):O[d]||(y===void 0&&(y=12),C=!0,d="g"),(S||x==="0"&&p==="=")&&(S=!0,x="0",p="=");var B=(g&&g.prefix!==void 0?g.prefix:"")+(w==="$"?e:w==="#"&&/[boxX]/.test(d)?"0"+d.toLowerCase():""),H=(w==="$"?i:/[%p]/.test(d)?c:"")+(g&&g.suffix!==void 0?g.suffix:""),D=O[d],J=/[defgprs%]/.test(d);y=y===void 0?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y));function G(r){var l=B,u=H,b,I,k;if(d==="c")u=D(r)+u,r="";else{r=+r;var P=r<0||1/r<0;if(r=isNaN(r)?M:D(Math.abs(r),y),C&&(r=_(r)),P&&+r==0&&h!=="+"&&(P=!1),l=(P?h==="("?h:m:h==="-"||h==="("?"":h)+l,u=(d==="s"&&!isNaN(r)&&E!==void 0?Y[8+E/3]:"")+u+(P&&h==="("?")":""),J){for(b=-1,I=r.length;++b<I;)if(k=r.charCodeAt(b),48>k||k>57){u=(k===46?o+r.slice(b+1):r.slice(b))+u,r=r.slice(0,b);break}}}$&&!S&&(r=t(r,1/0));var z=l.length+r.length+u.length,s=z<F?new Array(F-z+1).join(x):"";switch($&&S&&(r=t(s+r,s.length?F-u.length:1/0),s=""),p){case"<":r=l+r+u+s;break;case"=":r=l+s+r+u;break;case"^":r=s.slice(0,z=s.length>>1)+l+r+u+s.slice(z);break;default:r=s+l+r+u;break}return a(r)}return G.toString=function(){return f+""},G}function q(f,g){var x=Math.max(-8,Math.min(8,Math.floor(Z(g)/3)))*3,p=Math.pow(10,-x),h=T((f=N(f),f.type="f",f),{suffix:Y[8+x/3]});return function(w){return h(p*w)}}return{format:T,formatPrefix:q}}var A;exports.format=void 0;exports.formatPrefix=void 0;tn({thousands:",",grouping:[3],currency:["$",""]});function tn(n){return A=nn(n),exports.format=A.format,exports.formatPrefix=A.formatPrefix,A}exports.exponent=Z;exports.formatSpecifier=N;
|