@versini/sassysaint 8.107.3 → 8.108.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.
- package/dist/chunks/{AboutChangelog.BmMVyf-Q.js → AboutChangelog.55tIwnGe.js} +2 -2
- package/dist/chunks/{AboutEntry.wD5hG0ON.js → AboutEntry.D1zAHjel.js} +7 -7
- package/dist/chunks/{App.FyINLNSp.js → App.Br7HE-y0.js} +1746 -1908
- package/dist/chunks/{Bubble.Ci-pu6NI.js → Bubble.Ic_8FEhH.js} +47 -74
- package/dist/chunks/{Table.Dzy9ts3i.js → ButtonIconDelete.DRBd_G40.js} +125 -104
- package/dist/chunks/{Chart.DYVf2gst.js → Chart.CwIVbBYb.js} +2 -2
- package/dist/chunks/{ChatBubbleAssistant.CD6bVvcQ.js → ChatBubbleAssistant.DHlLzqdc.js} +199 -208
- package/dist/chunks/{ChatBubbleUser.Cre3cX04.js → ChatBubbleUser.D7ksCr76.js} +27 -36
- package/dist/chunks/{ChatHistoryTable.D_kOkWN9.js → ChatHistoryTable.DhUDW7QO.js} +108 -121
- package/dist/chunks/{HistoryEntry.BFNME4Z8.js → HistoryEntry.BxnMfiXN.js} +6 -6
- package/dist/chunks/{LoginEntry.SW7wyEpU.js → LoginEntry.XF9rPWdB.js} +4 -4
- package/dist/chunks/{LogoEntry.BAKpdJEy.js → LogoEntry.CnTI8jpv.js} +304 -385
- package/dist/chunks/{MemoriesEntry.Ztyx_8Wm.js → MemoriesEntry.BjNXrPW2.js} +164 -169
- package/dist/chunks/{ProfileEntry.CjzAusYw.js → ProfileEntry.S6XO2uMT.js} +4 -4
- package/dist/chunks/{SettingsEntry.D4IKmfYP.js → SettingsEntry.C5jHUJzu.js} +5 -5
- package/dist/chunks/{UsageEntry.D7sTPflE.js → UsageEntry.CQTLPweE.js} +5 -5
- package/dist/chunks/_basePickBy.Dj6LWOd3.js +151 -0
- package/dist/chunks/_baseUniq.DfiF6jap.js +614 -0
- package/dist/chunks/arc.CLrqhM1J.js +83 -0
- package/dist/chunks/architecture-U656AL7Q.CuF-GD1P.js +36 -0
- package/dist/chunks/architectureDiagram-VXUJARFQ.BGPIWweD.js +4653 -0
- package/dist/chunks/blockDiagram-VD42YOAC.cLfUaXxm.js +2254 -0
- package/dist/chunks/browser.B8WuOmYx.js +260 -0
- package/dist/chunks/c4Diagram-YG6GDRKO.Cc4f8G62.js +1579 -0
- package/dist/chunks/channel.D7pUQPat.js +5 -0
- package/dist/chunks/chunk-4BX2VUAB.C5gP6CzO.js +8 -0
- package/dist/chunks/chunk-55IACEB6.CMTOMhuf.js +8 -0
- package/dist/chunks/chunk-B4BG7PRW.CQz5CpXp.js +1375 -0
- package/dist/chunks/chunk-DI55MBZ5.C4SOgQau.js +1370 -0
- package/dist/chunks/chunk-FMBD7UC4.5tYrPDWZ.js +19 -0
- package/dist/chunks/chunk-QN33PNHL.P3o9PZBW.js +19 -0
- package/dist/chunks/chunk-QZHKN3VN.COvsjomn.js +15 -0
- package/dist/chunks/chunk-TZMSLE5B.C5QPHQlj.js +64 -0
- package/dist/chunks/classDiagram-2ON5EDUG.DrIfmpHo.js +16 -0
- package/dist/chunks/classDiagram-v2-WZHVMYZB.DrIfmpHo.js +16 -0
- package/dist/chunks/clone.47X4nGV4.js +8 -0
- package/dist/chunks/cose-bilkent-S5V4N54A.B1umrZne.js +2600 -0
- package/dist/chunks/cytoscape.esm.DmRZGnqW.js +18700 -0
- package/dist/chunks/dagre-6UL2VRFP.Ce4VSTky.js +444 -0
- package/dist/chunks/defaultLocale.CPJLP5jg.js +171 -0
- package/dist/chunks/diagram-PSM6KHXK.B1yvSG9p.js +531 -0
- package/dist/chunks/diagram-QEK2KX5R.CYDnnLB3.js +217 -0
- package/dist/chunks/diagram-S2PKOQOG.BI6w7TZJ.js +142 -0
- package/dist/chunks/erDiagram-Q2GNP2WA.D7mTQJ6P.js +841 -0
- package/dist/chunks/flowDiagram-NV44I4VS.Col8_E_0.js +1620 -0
- package/dist/chunks/ganttDiagram-JELNMOA3.GAUSoSKL.js +2647 -0
- package/dist/chunks/gitGraph-F6HP7TQM.3I_jmRrt.js +27 -0
- package/dist/chunks/gitGraphDiagram-NY62KEGX.DZQ_LVDe.js +699 -0
- package/dist/chunks/graph.BmJVbvPo.js +247 -0
- package/dist/chunks/index.Bi0z4EE1.js +90 -0
- package/dist/chunks/{index.QiLu2wkI.js → index.C0El17wt.js} +2 -2
- package/dist/chunks/{index.DBovegdE.js → index.CUn5zNJg.js} +1 -1
- package/dist/chunks/index.CbEVdl_N.js +279 -0
- package/dist/chunks/{index.BT3Do9Po.js → index.CoZgV6rn.js} +34 -43
- package/dist/chunks/{index.16gcBvke.js → index.DCqTKdor.js} +60 -69
- package/dist/chunks/index.DctDXsYU.js +67 -0
- package/dist/chunks/{index.BfTDtoYy.js → index.Df-tNwfZ.js} +1 -1
- package/dist/chunks/{index.BI1_ccPN.js → index.DxGkXGdu.js} +3 -3
- package/dist/chunks/{index.uILjvEfo.js → index.z2e7pMwp.js} +1 -1
- package/dist/chunks/info-NVLQJR56.D9ao7_Su.js +27 -0
- package/dist/chunks/infoDiagram-WHAUD3N6.DmFB-CXk.js +24 -0
- package/dist/chunks/init.DAGnb5BH.js +16 -0
- package/dist/chunks/journeyDiagram-XKPGCS4Q.C9FISQxf.js +834 -0
- package/dist/chunks/kanban-definition-3W4ZIXB7.ChmJnTyd.js +719 -0
- package/dist/chunks/{index.DJlv39cv.js → katex.D0sQThIv.js} +1638 -1943
- package/dist/chunks/layout.DtZQLIyC.js +1332 -0
- package/dist/chunks/linear.CIDfImUo.js +625 -0
- package/dist/chunks/mermaid-parser.core.CO83pegl.js +12724 -0
- package/dist/chunks/mindmap-definition-VGOIOE7T.B3dfWebK.js +759 -0
- package/dist/chunks/ordinal.EWT-qnu7.js +61 -0
- package/dist/chunks/packet-BFZMPI3H.q9qJMgm9.js +27 -0
- package/dist/chunks/pie-7BOR55EZ.BTnKDmrp.js +32 -0
- package/dist/chunks/pieDiagram-ADFJNKIX.B23eDSnQ.js +161 -0
- package/dist/chunks/quadrantDiagram-AYHSOK5B.B3ZIlLhO.js +1022 -0
- package/dist/chunks/radar-NHE76QYJ.BeKykujs.js +27 -0
- package/dist/chunks/rehype-mermaid.DkS2NcIa.js +14283 -0
- package/dist/chunks/requirementDiagram-UZGBJVZJ.0vOl9IL2.js +850 -0
- package/dist/chunks/sankeyDiagram-TZEHDZUN.DxwTK65F.js +810 -0
- package/dist/chunks/sequenceDiagram-WL72ISMW.BmOg83Gx.js +2511 -0
- package/dist/chunks/stateDiagram-FKZM4ZOC.DBiU28Wu.js +263 -0
- package/dist/chunks/stateDiagram-v2-4FDKWEC3.B6t8_4cH.js +16 -0
- package/dist/chunks/timeline-definition-IT6M3QCI.DpWxwytE.js +795 -0
- package/dist/chunks/treemap-KMMF4GRG.KqgFrxbV.js +81 -0
- package/dist/chunks/{useMarkdown.BberHabr.js → useMarkdown.CxuK_DLo.js} +2078 -2072
- package/dist/chunks/xychartDiagram-PRI3JC2R.CBaIBQ89.js +1340 -0
- package/dist/components/SassySaint/SassySaint.js +1 -1
- package/dist/index.js +3 -3
- package/dist/style.css +1 -1
- package/package.json +5 -5
- package/dist/chunks/index.BjnVQ4X3.js +0 -99
- package/dist/chunks/index.uVDYkuxz.js +0 -297
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
import { populateCommonDb as Y } from "./chunk-4BX2VUAB.C5gP6CzO.js";
|
|
2
|
+
import { ImperativeState as K } from "./chunk-QZHKN3VN.COvsjomn.js";
|
|
3
|
+
import { __name as l, getDiagramTitle as U, setDiagramTitle as V, setAccDescription as X, getAccDescription as J, getAccTitle as Q, setAccTitle as Z, log as m, select as rr, getConfig2 as er, utils_default as tr, setupGraphViewbox2 as ar, clear as nr, common_default as C, cleanAndMerge as sr, getConfig as or, defaultConfig_default as cr, random as ir } from "./rehype-mermaid.DkS2NcIa.js";
|
|
4
|
+
import { parse as dr } from "./mermaid-parser.core.CO83pegl.js";
|
|
5
|
+
var p = {
|
|
6
|
+
NORMAL: 0,
|
|
7
|
+
REVERSE: 1,
|
|
8
|
+
HIGHLIGHT: 2,
|
|
9
|
+
MERGE: 3,
|
|
10
|
+
CHERRY_PICK: 4
|
|
11
|
+
}, hr = cr.gitGraph, I = /* @__PURE__ */ l(() => sr({
|
|
12
|
+
...hr,
|
|
13
|
+
...or().gitGraph
|
|
14
|
+
}), "getConfig"), c = new K(() => {
|
|
15
|
+
const t = I(), r = t.mainBranchName, n = t.mainBranchOrder;
|
|
16
|
+
return {
|
|
17
|
+
mainBranchName: r,
|
|
18
|
+
commits: /* @__PURE__ */ new Map(),
|
|
19
|
+
head: null,
|
|
20
|
+
branchConfig: /* @__PURE__ */ new Map([[r, { name: r, order: n }]]),
|
|
21
|
+
branches: /* @__PURE__ */ new Map([[r, null]]),
|
|
22
|
+
currBranch: r,
|
|
23
|
+
direction: "LR",
|
|
24
|
+
seq: 0,
|
|
25
|
+
options: {}
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
function q() {
|
|
29
|
+
return ir({ length: 7 });
|
|
30
|
+
}
|
|
31
|
+
l(q, "getID");
|
|
32
|
+
function D(t, r) {
|
|
33
|
+
const n = /* @__PURE__ */ Object.create(null);
|
|
34
|
+
return t.reduce((s, e) => {
|
|
35
|
+
const a = r(e);
|
|
36
|
+
return n[a] || (n[a] = !0, s.push(e)), s;
|
|
37
|
+
}, []);
|
|
38
|
+
}
|
|
39
|
+
l(D, "uniqBy");
|
|
40
|
+
var lr = /* @__PURE__ */ l(function(t) {
|
|
41
|
+
c.records.direction = t;
|
|
42
|
+
}, "setDirection"), $r = /* @__PURE__ */ l(function(t) {
|
|
43
|
+
m.debug("options str", t), t = t?.trim(), t = t || "{}";
|
|
44
|
+
try {
|
|
45
|
+
c.records.options = JSON.parse(t);
|
|
46
|
+
} catch (r) {
|
|
47
|
+
m.error("error while parsing gitGraph options", r.message);
|
|
48
|
+
}
|
|
49
|
+
}, "setOptions"), fr = /* @__PURE__ */ l(function() {
|
|
50
|
+
return c.records.options;
|
|
51
|
+
}, "getOptions"), gr = /* @__PURE__ */ l(function(t) {
|
|
52
|
+
let r = t.msg, n = t.id;
|
|
53
|
+
const s = t.type;
|
|
54
|
+
let e = t.tags;
|
|
55
|
+
m.info("commit", r, n, s, e), m.debug("Entering commit:", r, n, s, e);
|
|
56
|
+
const a = I();
|
|
57
|
+
n = C.sanitizeText(n, a), r = C.sanitizeText(r, a), e = e?.map((o) => C.sanitizeText(o, a));
|
|
58
|
+
const d = {
|
|
59
|
+
id: n || c.records.seq + "-" + q(),
|
|
60
|
+
message: r,
|
|
61
|
+
seq: c.records.seq++,
|
|
62
|
+
type: s ?? p.NORMAL,
|
|
63
|
+
tags: e ?? [],
|
|
64
|
+
parents: c.records.head == null ? [] : [c.records.head.id],
|
|
65
|
+
branch: c.records.currBranch
|
|
66
|
+
};
|
|
67
|
+
c.records.head = d, m.info("main branch", a.mainBranchName), c.records.commits.has(d.id) && m.warn(`Commit ID ${d.id} already exists`), c.records.commits.set(d.id, d), c.records.branches.set(c.records.currBranch, d.id), m.debug("in pushCommit " + d.id);
|
|
68
|
+
}, "commit"), yr = /* @__PURE__ */ l(function(t) {
|
|
69
|
+
let r = t.name;
|
|
70
|
+
const n = t.order;
|
|
71
|
+
if (r = C.sanitizeText(r, I()), c.records.branches.has(r))
|
|
72
|
+
throw new Error(
|
|
73
|
+
`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`
|
|
74
|
+
);
|
|
75
|
+
c.records.branches.set(r, c.records.head != null ? c.records.head.id : null), c.records.branchConfig.set(r, { name: r, order: n }), F(r), m.debug("in createBranch");
|
|
76
|
+
}, "branch"), ur = /* @__PURE__ */ l((t) => {
|
|
77
|
+
let r = t.branch, n = t.id;
|
|
78
|
+
const s = t.type, e = t.tags, a = I();
|
|
79
|
+
r = C.sanitizeText(r, a), n && (n = C.sanitizeText(n, a));
|
|
80
|
+
const d = c.records.branches.get(c.records.currBranch), o = c.records.branches.get(r), f = d ? c.records.commits.get(d) : void 0, h = o ? c.records.commits.get(o) : void 0;
|
|
81
|
+
if (f && h && f.branch === r)
|
|
82
|
+
throw new Error(`Cannot merge branch '${r}' into itself.`);
|
|
83
|
+
if (c.records.currBranch === r) {
|
|
84
|
+
const i = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
|
|
85
|
+
throw i.hash = {
|
|
86
|
+
text: `merge ${r}`,
|
|
87
|
+
token: `merge ${r}`,
|
|
88
|
+
expected: ["branch abc"]
|
|
89
|
+
}, i;
|
|
90
|
+
}
|
|
91
|
+
if (f === void 0 || !f) {
|
|
92
|
+
const i = new Error(
|
|
93
|
+
`Incorrect usage of "merge". Current branch (${c.records.currBranch})has no commits`
|
|
94
|
+
);
|
|
95
|
+
throw i.hash = {
|
|
96
|
+
text: `merge ${r}`,
|
|
97
|
+
token: `merge ${r}`,
|
|
98
|
+
expected: ["commit"]
|
|
99
|
+
}, i;
|
|
100
|
+
}
|
|
101
|
+
if (!c.records.branches.has(r)) {
|
|
102
|
+
const i = new Error(
|
|
103
|
+
'Incorrect usage of "merge". Branch to be merged (' + r + ") does not exist"
|
|
104
|
+
);
|
|
105
|
+
throw i.hash = {
|
|
106
|
+
text: `merge ${r}`,
|
|
107
|
+
token: `merge ${r}`,
|
|
108
|
+
expected: [`branch ${r}`]
|
|
109
|
+
}, i;
|
|
110
|
+
}
|
|
111
|
+
if (h === void 0 || !h) {
|
|
112
|
+
const i = new Error(
|
|
113
|
+
'Incorrect usage of "merge". Branch to be merged (' + r + ") has no commits"
|
|
114
|
+
);
|
|
115
|
+
throw i.hash = {
|
|
116
|
+
text: `merge ${r}`,
|
|
117
|
+
token: `merge ${r}`,
|
|
118
|
+
expected: ['"commit"']
|
|
119
|
+
}, i;
|
|
120
|
+
}
|
|
121
|
+
if (f === h) {
|
|
122
|
+
const i = new Error('Incorrect usage of "merge". Both branches have same head');
|
|
123
|
+
throw i.hash = {
|
|
124
|
+
text: `merge ${r}`,
|
|
125
|
+
token: `merge ${r}`,
|
|
126
|
+
expected: ["branch abc"]
|
|
127
|
+
}, i;
|
|
128
|
+
}
|
|
129
|
+
if (n && c.records.commits.has(n)) {
|
|
130
|
+
const i = new Error(
|
|
131
|
+
'Incorrect usage of "merge". Commit with id:' + n + " already exists, use different custom id"
|
|
132
|
+
);
|
|
133
|
+
throw i.hash = {
|
|
134
|
+
text: `merge ${r} ${n} ${s} ${e?.join(" ")}`,
|
|
135
|
+
token: `merge ${r} ${n} ${s} ${e?.join(" ")}`,
|
|
136
|
+
expected: [
|
|
137
|
+
`merge ${r} ${n}_UNIQUE ${s} ${e?.join(" ")}`
|
|
138
|
+
]
|
|
139
|
+
}, i;
|
|
140
|
+
}
|
|
141
|
+
const $ = o || "", g = {
|
|
142
|
+
id: n || `${c.records.seq}-${q()}`,
|
|
143
|
+
message: `merged branch ${r} into ${c.records.currBranch}`,
|
|
144
|
+
seq: c.records.seq++,
|
|
145
|
+
parents: c.records.head == null ? [] : [c.records.head.id, $],
|
|
146
|
+
branch: c.records.currBranch,
|
|
147
|
+
type: p.MERGE,
|
|
148
|
+
customType: s,
|
|
149
|
+
customId: !!n,
|
|
150
|
+
tags: e ?? []
|
|
151
|
+
};
|
|
152
|
+
c.records.head = g, c.records.commits.set(g.id, g), c.records.branches.set(c.records.currBranch, g.id), m.debug(c.records.branches), m.debug("in mergeBranch");
|
|
153
|
+
}, "merge"), xr = /* @__PURE__ */ l(function(t) {
|
|
154
|
+
let r = t.id, n = t.targetId, s = t.tags, e = t.parent;
|
|
155
|
+
m.debug("Entering cherryPick:", r, n, s);
|
|
156
|
+
const a = I();
|
|
157
|
+
if (r = C.sanitizeText(r, a), n = C.sanitizeText(n, a), s = s?.map((f) => C.sanitizeText(f, a)), e = C.sanitizeText(e, a), !r || !c.records.commits.has(r)) {
|
|
158
|
+
const f = new Error(
|
|
159
|
+
'Incorrect usage of "cherryPick". Source commit id should exist and provided'
|
|
160
|
+
);
|
|
161
|
+
throw f.hash = {
|
|
162
|
+
text: `cherryPick ${r} ${n}`,
|
|
163
|
+
token: `cherryPick ${r} ${n}`,
|
|
164
|
+
expected: ["cherry-pick abc"]
|
|
165
|
+
}, f;
|
|
166
|
+
}
|
|
167
|
+
const d = c.records.commits.get(r);
|
|
168
|
+
if (d === void 0 || !d)
|
|
169
|
+
throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
|
|
170
|
+
if (e && !(Array.isArray(d.parents) && d.parents.includes(e)))
|
|
171
|
+
throw new Error(
|
|
172
|
+
"Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit."
|
|
173
|
+
);
|
|
174
|
+
const o = d.branch;
|
|
175
|
+
if (d.type === p.MERGE && !e)
|
|
176
|
+
throw new Error(
|
|
177
|
+
"Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified."
|
|
178
|
+
);
|
|
179
|
+
if (!n || !c.records.commits.has(n)) {
|
|
180
|
+
if (o === c.records.currBranch) {
|
|
181
|
+
const g = new Error(
|
|
182
|
+
'Incorrect usage of "cherryPick". Source commit is already on current branch'
|
|
183
|
+
);
|
|
184
|
+
throw g.hash = {
|
|
185
|
+
text: `cherryPick ${r} ${n}`,
|
|
186
|
+
token: `cherryPick ${r} ${n}`,
|
|
187
|
+
expected: ["cherry-pick abc"]
|
|
188
|
+
}, g;
|
|
189
|
+
}
|
|
190
|
+
const f = c.records.branches.get(c.records.currBranch);
|
|
191
|
+
if (f === void 0 || !f) {
|
|
192
|
+
const g = new Error(
|
|
193
|
+
`Incorrect usage of "cherry-pick". Current branch (${c.records.currBranch})has no commits`
|
|
194
|
+
);
|
|
195
|
+
throw g.hash = {
|
|
196
|
+
text: `cherryPick ${r} ${n}`,
|
|
197
|
+
token: `cherryPick ${r} ${n}`,
|
|
198
|
+
expected: ["cherry-pick abc"]
|
|
199
|
+
}, g;
|
|
200
|
+
}
|
|
201
|
+
const h = c.records.commits.get(f);
|
|
202
|
+
if (h === void 0 || !h) {
|
|
203
|
+
const g = new Error(
|
|
204
|
+
`Incorrect usage of "cherry-pick". Current branch (${c.records.currBranch})has no commits`
|
|
205
|
+
);
|
|
206
|
+
throw g.hash = {
|
|
207
|
+
text: `cherryPick ${r} ${n}`,
|
|
208
|
+
token: `cherryPick ${r} ${n}`,
|
|
209
|
+
expected: ["cherry-pick abc"]
|
|
210
|
+
}, g;
|
|
211
|
+
}
|
|
212
|
+
const $ = {
|
|
213
|
+
id: c.records.seq + "-" + q(),
|
|
214
|
+
message: `cherry-picked ${d?.message} into ${c.records.currBranch}`,
|
|
215
|
+
seq: c.records.seq++,
|
|
216
|
+
parents: c.records.head == null ? [] : [c.records.head.id, d.id],
|
|
217
|
+
branch: c.records.currBranch,
|
|
218
|
+
type: p.CHERRY_PICK,
|
|
219
|
+
tags: s ? s.filter(Boolean) : [
|
|
220
|
+
`cherry-pick:${d.id}${d.type === p.MERGE ? `|parent:${e}` : ""}`
|
|
221
|
+
]
|
|
222
|
+
};
|
|
223
|
+
c.records.head = $, c.records.commits.set($.id, $), c.records.branches.set(c.records.currBranch, $.id), m.debug(c.records.branches), m.debug("in cherryPick");
|
|
224
|
+
}
|
|
225
|
+
}, "cherryPick"), F = /* @__PURE__ */ l(function(t) {
|
|
226
|
+
if (t = C.sanitizeText(t, I()), c.records.branches.has(t)) {
|
|
227
|
+
c.records.currBranch = t;
|
|
228
|
+
const r = c.records.branches.get(c.records.currBranch);
|
|
229
|
+
r === void 0 || !r ? c.records.head = null : c.records.head = c.records.commits.get(r) ?? null;
|
|
230
|
+
} else {
|
|
231
|
+
const r = new Error(
|
|
232
|
+
`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`
|
|
233
|
+
);
|
|
234
|
+
throw r.hash = {
|
|
235
|
+
text: `checkout ${t}`,
|
|
236
|
+
token: `checkout ${t}`,
|
|
237
|
+
expected: [`branch ${t}`]
|
|
238
|
+
}, r;
|
|
239
|
+
}
|
|
240
|
+
}, "checkout");
|
|
241
|
+
function P(t, r, n) {
|
|
242
|
+
const s = t.indexOf(r);
|
|
243
|
+
s === -1 ? t.push(n) : t.splice(s, 1, n);
|
|
244
|
+
}
|
|
245
|
+
l(P, "upsert");
|
|
246
|
+
function _(t) {
|
|
247
|
+
const r = t.reduce((e, a) => e.seq > a.seq ? e : a, t[0]);
|
|
248
|
+
let n = "";
|
|
249
|
+
t.forEach(function(e) {
|
|
250
|
+
e === r ? n += " *" : n += " |";
|
|
251
|
+
});
|
|
252
|
+
const s = [n, r.id, r.seq];
|
|
253
|
+
for (const e in c.records.branches)
|
|
254
|
+
c.records.branches.get(e) === r.id && s.push(e);
|
|
255
|
+
if (m.debug(s.join(" ")), r.parents && r.parents.length == 2 && r.parents[0] && r.parents[1]) {
|
|
256
|
+
const e = c.records.commits.get(r.parents[0]);
|
|
257
|
+
P(t, r, e), r.parents[1] && t.push(c.records.commits.get(r.parents[1]));
|
|
258
|
+
} else {
|
|
259
|
+
if (r.parents.length == 0)
|
|
260
|
+
return;
|
|
261
|
+
if (r.parents[0]) {
|
|
262
|
+
const e = c.records.commits.get(r.parents[0]);
|
|
263
|
+
P(t, r, e);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
t = D(t, (e) => e.id), _(t);
|
|
267
|
+
}
|
|
268
|
+
l(_, "prettyPrintCommitHistory");
|
|
269
|
+
var pr = /* @__PURE__ */ l(function() {
|
|
270
|
+
m.debug(c.records.commits);
|
|
271
|
+
const t = N()[0];
|
|
272
|
+
_([t]);
|
|
273
|
+
}, "prettyPrint"), mr = /* @__PURE__ */ l(function() {
|
|
274
|
+
c.reset(), nr();
|
|
275
|
+
}, "clear"), br = /* @__PURE__ */ l(function() {
|
|
276
|
+
return [...c.records.branchConfig.values()].map((r, n) => r.order !== null && r.order !== void 0 ? r : {
|
|
277
|
+
...r,
|
|
278
|
+
order: parseFloat(`0.${n}`)
|
|
279
|
+
}).sort((r, n) => (r.order ?? 0) - (n.order ?? 0)).map(({ name: r }) => ({ name: r }));
|
|
280
|
+
}, "getBranchesAsObjArray"), wr = /* @__PURE__ */ l(function() {
|
|
281
|
+
return c.records.branches;
|
|
282
|
+
}, "getBranches"), vr = /* @__PURE__ */ l(function() {
|
|
283
|
+
return c.records.commits;
|
|
284
|
+
}, "getCommits"), N = /* @__PURE__ */ l(function() {
|
|
285
|
+
const t = [...c.records.commits.values()];
|
|
286
|
+
return t.forEach(function(r) {
|
|
287
|
+
m.debug(r.id);
|
|
288
|
+
}), t.sort((r, n) => r.seq - n.seq), t;
|
|
289
|
+
}, "getCommitsArray"), Cr = /* @__PURE__ */ l(function() {
|
|
290
|
+
return c.records.currBranch;
|
|
291
|
+
}, "getCurrentBranch"), Er = /* @__PURE__ */ l(function() {
|
|
292
|
+
return c.records.direction;
|
|
293
|
+
}, "getDirection"), Tr = /* @__PURE__ */ l(function() {
|
|
294
|
+
return c.records.head;
|
|
295
|
+
}, "getHead"), S = {
|
|
296
|
+
commitType: p,
|
|
297
|
+
getConfig: I,
|
|
298
|
+
setDirection: lr,
|
|
299
|
+
setOptions: $r,
|
|
300
|
+
getOptions: fr,
|
|
301
|
+
commit: gr,
|
|
302
|
+
branch: yr,
|
|
303
|
+
merge: ur,
|
|
304
|
+
cherryPick: xr,
|
|
305
|
+
checkout: F,
|
|
306
|
+
//reset,
|
|
307
|
+
prettyPrint: pr,
|
|
308
|
+
clear: mr,
|
|
309
|
+
getBranchesAsObjArray: br,
|
|
310
|
+
getBranches: wr,
|
|
311
|
+
getCommits: vr,
|
|
312
|
+
getCommitsArray: N,
|
|
313
|
+
getCurrentBranch: Cr,
|
|
314
|
+
getDirection: Er,
|
|
315
|
+
getHead: Tr,
|
|
316
|
+
setAccTitle: Z,
|
|
317
|
+
getAccTitle: Q,
|
|
318
|
+
getAccDescription: J,
|
|
319
|
+
setAccDescription: X,
|
|
320
|
+
setDiagramTitle: V,
|
|
321
|
+
getDiagramTitle: U
|
|
322
|
+
}, Br = /* @__PURE__ */ l((t, r) => {
|
|
323
|
+
Y(t, r), t.dir && r.setDirection(t.dir);
|
|
324
|
+
for (const n of t.statements)
|
|
325
|
+
Lr(n, r);
|
|
326
|
+
}, "populate"), Lr = /* @__PURE__ */ l((t, r) => {
|
|
327
|
+
const s = {
|
|
328
|
+
Commit: /* @__PURE__ */ l((e) => r.commit(kr(e)), "Commit"),
|
|
329
|
+
Branch: /* @__PURE__ */ l((e) => r.branch(Mr(e)), "Branch"),
|
|
330
|
+
Merge: /* @__PURE__ */ l((e) => r.merge(Ir(e)), "Merge"),
|
|
331
|
+
Checkout: /* @__PURE__ */ l((e) => r.checkout(Rr(e)), "Checkout"),
|
|
332
|
+
CherryPicking: /* @__PURE__ */ l((e) => r.cherryPick(Gr(e)), "CherryPicking")
|
|
333
|
+
}[t.$type];
|
|
334
|
+
s ? s(t) : m.error(`Unknown statement type: ${t.$type}`);
|
|
335
|
+
}, "parseStatement"), kr = /* @__PURE__ */ l((t) => ({
|
|
336
|
+
id: t.id,
|
|
337
|
+
msg: t.message ?? "",
|
|
338
|
+
type: t.type !== void 0 ? p[t.type] : p.NORMAL,
|
|
339
|
+
tags: t.tags ?? void 0
|
|
340
|
+
}), "parseCommit"), Mr = /* @__PURE__ */ l((t) => ({
|
|
341
|
+
name: t.name,
|
|
342
|
+
order: t.order ?? 0
|
|
343
|
+
}), "parseBranch"), Ir = /* @__PURE__ */ l((t) => ({
|
|
344
|
+
branch: t.branch,
|
|
345
|
+
id: t.id ?? "",
|
|
346
|
+
type: t.type !== void 0 ? p[t.type] : void 0,
|
|
347
|
+
tags: t.tags ?? void 0
|
|
348
|
+
}), "parseMerge"), Rr = /* @__PURE__ */ l((t) => t.branch, "parseCheckout"), Gr = /* @__PURE__ */ l((t) => ({
|
|
349
|
+
id: t.id,
|
|
350
|
+
targetId: "",
|
|
351
|
+
tags: t.tags?.length === 0 ? void 0 : t.tags,
|
|
352
|
+
parent: t.parent
|
|
353
|
+
}), "parseCherryPicking"), Or = {
|
|
354
|
+
parse: /* @__PURE__ */ l(async (t) => {
|
|
355
|
+
const r = await dr("gitGraph", t);
|
|
356
|
+
m.debug(r), Br(r, S);
|
|
357
|
+
}, "parse")
|
|
358
|
+
}, Ar = er(), v = Ar?.gitGraph, L = 10, k = 40, E = 4, T = 2, M = 8, b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = 30, R = /* @__PURE__ */ new Map(), A = [], B = 0, u = "LR", qr = /* @__PURE__ */ l(() => {
|
|
359
|
+
b.clear(), w.clear(), R.clear(), B = 0, A = [], u = "LR";
|
|
360
|
+
}, "clear"), W = /* @__PURE__ */ l((t) => {
|
|
361
|
+
const r = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
362
|
+
return (typeof t == "string" ? t.split(/\\n|\n|<br\s*\/?>/gi) : t).forEach((s) => {
|
|
363
|
+
const e = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
364
|
+
e.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), e.setAttribute("dy", "1em"), e.setAttribute("x", "0"), e.setAttribute("class", "row"), e.textContent = s.trim(), r.appendChild(e);
|
|
365
|
+
}), r;
|
|
366
|
+
}, "drawText"), j = /* @__PURE__ */ l((t) => {
|
|
367
|
+
let r, n, s;
|
|
368
|
+
return u === "BT" ? (n = /* @__PURE__ */ l((e, a) => e <= a, "comparisonFunc"), s = 1 / 0) : (n = /* @__PURE__ */ l((e, a) => e >= a, "comparisonFunc"), s = 0), t.forEach((e) => {
|
|
369
|
+
const a = u === "TB" || u == "BT" ? w.get(e)?.y : w.get(e)?.x;
|
|
370
|
+
a !== void 0 && n(a, s) && (r = e, s = a);
|
|
371
|
+
}), r;
|
|
372
|
+
}, "findClosestParent"), Hr = /* @__PURE__ */ l((t) => {
|
|
373
|
+
let r = "", n = 1 / 0;
|
|
374
|
+
return t.forEach((s) => {
|
|
375
|
+
const e = w.get(s).y;
|
|
376
|
+
e <= n && (r = s, n = e);
|
|
377
|
+
}), r || void 0;
|
|
378
|
+
}, "findClosestParentBT"), Pr = /* @__PURE__ */ l((t, r, n) => {
|
|
379
|
+
let s = n, e = n;
|
|
380
|
+
const a = [];
|
|
381
|
+
t.forEach((d) => {
|
|
382
|
+
const o = r.get(d);
|
|
383
|
+
if (!o)
|
|
384
|
+
throw new Error(`Commit not found for key ${d}`);
|
|
385
|
+
o.parents.length ? (s = zr(o), e = Math.max(s, e)) : a.push(o), Dr(o, s);
|
|
386
|
+
}), s = e, a.forEach((d) => {
|
|
387
|
+
Fr(d, s, n);
|
|
388
|
+
}), t.forEach((d) => {
|
|
389
|
+
const o = r.get(d);
|
|
390
|
+
if (o?.parents.length) {
|
|
391
|
+
const f = Hr(o.parents);
|
|
392
|
+
s = w.get(f).y - k, s <= e && (e = s);
|
|
393
|
+
const h = b.get(o.branch).pos, $ = s - L;
|
|
394
|
+
w.set(o.id, { x: h, y: $ });
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
}, "setParallelBTPos"), _r = /* @__PURE__ */ l((t) => {
|
|
398
|
+
const r = j(t.parents.filter((s) => s !== null));
|
|
399
|
+
if (!r)
|
|
400
|
+
throw new Error(`Closest parent not found for commit ${t.id}`);
|
|
401
|
+
const n = w.get(r)?.y;
|
|
402
|
+
if (n === void 0)
|
|
403
|
+
throw new Error(`Closest parent position not found for commit ${t.id}`);
|
|
404
|
+
return n;
|
|
405
|
+
}, "findClosestParentPos"), zr = /* @__PURE__ */ l((t) => _r(t) + k, "calculateCommitPosition"), Dr = /* @__PURE__ */ l((t, r) => {
|
|
406
|
+
const n = b.get(t.branch);
|
|
407
|
+
if (!n)
|
|
408
|
+
throw new Error(`Branch not found for commit ${t.id}`);
|
|
409
|
+
const s = n.pos, e = r + L;
|
|
410
|
+
return w.set(t.id, { x: s, y: e }), { x: s, y: e };
|
|
411
|
+
}, "setCommitPosition"), Fr = /* @__PURE__ */ l((t, r, n) => {
|
|
412
|
+
const s = b.get(t.branch);
|
|
413
|
+
if (!s)
|
|
414
|
+
throw new Error(`Branch not found for commit ${t.id}`);
|
|
415
|
+
const e = r + n, a = s.pos;
|
|
416
|
+
w.set(t.id, { x: a, y: e });
|
|
417
|
+
}, "setRootPosition"), Nr = /* @__PURE__ */ l((t, r, n, s, e, a) => {
|
|
418
|
+
if (a === p.HIGHLIGHT)
|
|
419
|
+
t.append("rect").attr("x", n.x - 10).attr("y", n.y - 10).attr("width", 20).attr("height", 20).attr(
|
|
420
|
+
"class",
|
|
421
|
+
`commit ${r.id} commit-highlight${e % M} ${s}-outer`
|
|
422
|
+
), t.append("rect").attr("x", n.x - 6).attr("y", n.y - 6).attr("width", 12).attr("height", 12).attr(
|
|
423
|
+
"class",
|
|
424
|
+
`commit ${r.id} commit${e % M} ${s}-inner`
|
|
425
|
+
);
|
|
426
|
+
else if (a === p.CHERRY_PICK)
|
|
427
|
+
t.append("circle").attr("cx", n.x).attr("cy", n.y).attr("r", 10).attr("class", `commit ${r.id} ${s}`), t.append("circle").attr("cx", n.x - 3).attr("cy", n.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${r.id} ${s}`), t.append("circle").attr("cx", n.x + 3).attr("cy", n.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${r.id} ${s}`), t.append("line").attr("x1", n.x + 3).attr("y1", n.y + 1).attr("x2", n.x).attr("y2", n.y - 5).attr("stroke", "#fff").attr("class", `commit ${r.id} ${s}`), t.append("line").attr("x1", n.x - 3).attr("y1", n.y + 1).attr("x2", n.x).attr("y2", n.y - 5).attr("stroke", "#fff").attr("class", `commit ${r.id} ${s}`);
|
|
428
|
+
else {
|
|
429
|
+
const d = t.append("circle");
|
|
430
|
+
if (d.attr("cx", n.x), d.attr("cy", n.y), d.attr("r", r.type === p.MERGE ? 9 : 10), d.attr("class", `commit ${r.id} commit${e % M}`), a === p.MERGE) {
|
|
431
|
+
const o = t.append("circle");
|
|
432
|
+
o.attr("cx", n.x), o.attr("cy", n.y), o.attr("r", 6), o.attr(
|
|
433
|
+
"class",
|
|
434
|
+
`commit ${s} ${r.id} commit${e % M}`
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
a === p.REVERSE && t.append("path").attr(
|
|
438
|
+
"d",
|
|
439
|
+
`M ${n.x - 5},${n.y - 5}L${n.x + 5},${n.y + 5}M${n.x - 5},${n.y + 5}L${n.x + 5},${n.y - 5}`
|
|
440
|
+
).attr("class", `commit ${s} ${r.id} commit${e % M}`);
|
|
441
|
+
}
|
|
442
|
+
}, "drawCommitBullet"), Sr = /* @__PURE__ */ l((t, r, n, s) => {
|
|
443
|
+
if (r.type !== p.CHERRY_PICK && (r.customId && r.type === p.MERGE || r.type !== p.MERGE) && v?.showCommitLabel) {
|
|
444
|
+
const e = t.append("g"), a = e.insert("rect").attr("class", "commit-label-bkg"), d = e.append("text").attr("x", s).attr("y", n.y + 25).attr("class", "commit-label").text(r.id), o = d.node()?.getBBox();
|
|
445
|
+
if (o && (a.attr("x", n.posWithOffset - o.width / 2 - T).attr("y", n.y + 13.5).attr("width", o.width + 2 * T).attr("height", o.height + 2 * T), u === "TB" || u === "BT" ? (a.attr("x", n.x - (o.width + 4 * E + 5)).attr("y", n.y - 12), d.attr("x", n.x - (o.width + 4 * E)).attr("y", n.y + o.height - 12)) : d.attr("x", n.posWithOffset - o.width / 2), v.rotateCommitLabel))
|
|
446
|
+
if (u === "TB" || u === "BT")
|
|
447
|
+
d.attr(
|
|
448
|
+
"transform",
|
|
449
|
+
"rotate(-45, " + n.x + ", " + n.y + ")"
|
|
450
|
+
), a.attr(
|
|
451
|
+
"transform",
|
|
452
|
+
"rotate(-45, " + n.x + ", " + n.y + ")"
|
|
453
|
+
);
|
|
454
|
+
else {
|
|
455
|
+
const f = -7.5 - (o.width + 10) / 25 * 9.5, h = 10 + o.width / 25 * 8.5;
|
|
456
|
+
e.attr(
|
|
457
|
+
"transform",
|
|
458
|
+
"translate(" + f + ", " + h + ") rotate(-45, " + s + ", " + n.y + ")"
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}, "drawCommitLabel"), Wr = /* @__PURE__ */ l((t, r, n, s) => {
|
|
463
|
+
if (r.tags.length > 0) {
|
|
464
|
+
let e = 0, a = 0, d = 0;
|
|
465
|
+
const o = [];
|
|
466
|
+
for (const f of r.tags.reverse()) {
|
|
467
|
+
const h = t.insert("polygon"), $ = t.append("circle"), g = t.append("text").attr("y", n.y - 16 - e).attr("class", "tag-label").text(f), i = g.node()?.getBBox();
|
|
468
|
+
if (!i)
|
|
469
|
+
throw new Error("Tag bbox not found");
|
|
470
|
+
a = Math.max(a, i.width), d = Math.max(d, i.height), g.attr("x", n.posWithOffset - i.width / 2), o.push({
|
|
471
|
+
tag: g,
|
|
472
|
+
hole: $,
|
|
473
|
+
rect: h,
|
|
474
|
+
yOffset: e
|
|
475
|
+
}), e += 20;
|
|
476
|
+
}
|
|
477
|
+
for (const { tag: f, hole: h, rect: $, yOffset: g } of o) {
|
|
478
|
+
const i = d / 2, y = n.y - 19.2 - g;
|
|
479
|
+
if ($.attr("class", "tag-label-bkg").attr(
|
|
480
|
+
"points",
|
|
481
|
+
`
|
|
482
|
+
${s - a / 2 - E / 2},${y + T}
|
|
483
|
+
${s - a / 2 - E / 2},${y - T}
|
|
484
|
+
${n.posWithOffset - a / 2 - E},${y - i - T}
|
|
485
|
+
${n.posWithOffset + a / 2 + E},${y - i - T}
|
|
486
|
+
${n.posWithOffset + a / 2 + E},${y + i + T}
|
|
487
|
+
${n.posWithOffset - a / 2 - E},${y + i + T}`
|
|
488
|
+
), h.attr("cy", y).attr("cx", s - a / 2 + E / 2).attr("r", 1.5).attr("class", "tag-hole"), u === "TB" || u === "BT") {
|
|
489
|
+
const x = s + g;
|
|
490
|
+
$.attr("class", "tag-label-bkg").attr(
|
|
491
|
+
"points",
|
|
492
|
+
`
|
|
493
|
+
${n.x},${x + 2}
|
|
494
|
+
${n.x},${x - 2}
|
|
495
|
+
${n.x + L},${x - i - 2}
|
|
496
|
+
${n.x + L + a + 4},${x - i - 2}
|
|
497
|
+
${n.x + L + a + 4},${x + i + 2}
|
|
498
|
+
${n.x + L},${x + i + 2}`
|
|
499
|
+
).attr("transform", "translate(12,12) rotate(45, " + n.x + "," + s + ")"), h.attr("cx", n.x + E / 2).attr("cy", x).attr("transform", "translate(12,12) rotate(45, " + n.x + "," + s + ")"), f.attr("x", n.x + 5).attr("y", x + 3).attr("transform", "translate(14,14) rotate(45, " + n.x + "," + s + ")");
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}, "drawCommitTags"), jr = /* @__PURE__ */ l((t) => {
|
|
504
|
+
switch (t.customType ?? t.type) {
|
|
505
|
+
case p.NORMAL:
|
|
506
|
+
return "commit-normal";
|
|
507
|
+
case p.REVERSE:
|
|
508
|
+
return "commit-reverse";
|
|
509
|
+
case p.HIGHLIGHT:
|
|
510
|
+
return "commit-highlight";
|
|
511
|
+
case p.MERGE:
|
|
512
|
+
return "commit-merge";
|
|
513
|
+
case p.CHERRY_PICK:
|
|
514
|
+
return "commit-cherry-pick";
|
|
515
|
+
default:
|
|
516
|
+
return "commit-normal";
|
|
517
|
+
}
|
|
518
|
+
}, "getCommitClassType"), Yr = /* @__PURE__ */ l((t, r, n, s) => {
|
|
519
|
+
const e = { x: 0, y: 0 };
|
|
520
|
+
if (t.parents.length > 0) {
|
|
521
|
+
const a = j(t.parents);
|
|
522
|
+
if (a) {
|
|
523
|
+
const d = s.get(a) ?? e;
|
|
524
|
+
return r === "TB" ? d.y + k : r === "BT" ? (s.get(t.id) ?? e).y - k : d.x + k;
|
|
525
|
+
}
|
|
526
|
+
} else
|
|
527
|
+
return r === "TB" ? O : r === "BT" ? (s.get(t.id) ?? e).y - k : 0;
|
|
528
|
+
return 0;
|
|
529
|
+
}, "calculatePosition"), Kr = /* @__PURE__ */ l((t, r, n) => {
|
|
530
|
+
const s = u === "BT" && n ? r : r + L, e = u === "TB" || u === "BT" ? s : b.get(t.branch)?.pos, a = u === "TB" || u === "BT" ? b.get(t.branch)?.pos : s;
|
|
531
|
+
if (a === void 0 || e === void 0)
|
|
532
|
+
throw new Error(`Position were undefined for commit ${t.id}`);
|
|
533
|
+
return { x: a, y: e, posWithOffset: s };
|
|
534
|
+
}, "getCommitPosition"), z = /* @__PURE__ */ l((t, r, n) => {
|
|
535
|
+
if (!v)
|
|
536
|
+
throw new Error("GitGraph config not found");
|
|
537
|
+
const s = t.append("g").attr("class", "commit-bullets"), e = t.append("g").attr("class", "commit-labels");
|
|
538
|
+
let a = u === "TB" || u === "BT" ? O : 0;
|
|
539
|
+
const d = [...r.keys()], o = v?.parallelCommits ?? !1, f = /* @__PURE__ */ l(($, g) => {
|
|
540
|
+
const i = r.get($)?.seq, y = r.get(g)?.seq;
|
|
541
|
+
return i !== void 0 && y !== void 0 ? i - y : 0;
|
|
542
|
+
}, "sortKeys");
|
|
543
|
+
let h = d.sort(f);
|
|
544
|
+
u === "BT" && (o && Pr(h, r, a), h = h.reverse()), h.forEach(($) => {
|
|
545
|
+
const g = r.get($);
|
|
546
|
+
if (!g)
|
|
547
|
+
throw new Error(`Commit not found for key ${$}`);
|
|
548
|
+
o && (a = Yr(g, u, a, w));
|
|
549
|
+
const i = Kr(g, a, o);
|
|
550
|
+
if (n) {
|
|
551
|
+
const y = jr(g), x = g.customType ?? g.type, H = b.get(g.branch)?.index ?? 0;
|
|
552
|
+
Nr(s, g, i, y, H, x), Sr(e, g, i, a), Wr(e, g, i, a);
|
|
553
|
+
}
|
|
554
|
+
u === "TB" || u === "BT" ? w.set(g.id, { x: i.x, y: i.posWithOffset }) : w.set(g.id, { x: i.posWithOffset, y: i.y }), a = u === "BT" && o ? a + k : a + k + L, a > B && (B = a);
|
|
555
|
+
});
|
|
556
|
+
}, "drawCommits"), Ur = /* @__PURE__ */ l((t, r, n, s, e) => {
|
|
557
|
+
const d = (u === "TB" || u === "BT" ? n.x < s.x : n.y < s.y) ? r.branch : t.branch, o = /* @__PURE__ */ l((h) => h.branch === d, "isOnBranchToGetCurve"), f = /* @__PURE__ */ l((h) => h.seq > t.seq && h.seq < r.seq, "isBetweenCommits");
|
|
558
|
+
return [...e.values()].some((h) => f(h) && o(h));
|
|
559
|
+
}, "shouldRerouteArrow"), G = /* @__PURE__ */ l((t, r, n = 0) => {
|
|
560
|
+
const s = t + Math.abs(t - r) / 2;
|
|
561
|
+
if (n > 5)
|
|
562
|
+
return s;
|
|
563
|
+
if (A.every((d) => Math.abs(d - s) >= 10))
|
|
564
|
+
return A.push(s), s;
|
|
565
|
+
const a = Math.abs(t - r);
|
|
566
|
+
return G(t, r - a / 5, n + 1);
|
|
567
|
+
}, "findLane"), Vr = /* @__PURE__ */ l((t, r, n, s) => {
|
|
568
|
+
const e = w.get(r.id), a = w.get(n.id);
|
|
569
|
+
if (e === void 0 || a === void 0)
|
|
570
|
+
throw new Error(`Commit positions not found for commits ${r.id} and ${n.id}`);
|
|
571
|
+
const d = Ur(r, n, e, a, s);
|
|
572
|
+
let o = "", f = "", h = 0, $ = 0, g = b.get(n.branch)?.index;
|
|
573
|
+
n.type === p.MERGE && r.id !== n.parents[0] && (g = b.get(r.branch)?.index);
|
|
574
|
+
let i;
|
|
575
|
+
if (d) {
|
|
576
|
+
o = "A 10 10, 0, 0, 0,", f = "A 10 10, 0, 0, 1,", h = 10, $ = 10;
|
|
577
|
+
const y = e.y < a.y ? G(e.y, a.y) : G(a.y, e.y), x = e.x < a.x ? G(e.x, a.x) : G(a.x, e.x);
|
|
578
|
+
u === "TB" ? e.x < a.x ? i = `M ${e.x} ${e.y} L ${x - h} ${e.y} ${f} ${x} ${e.y + $} L ${x} ${a.y - h} ${o} ${x + $} ${a.y} L ${a.x} ${a.y}` : (g = b.get(r.branch)?.index, i = `M ${e.x} ${e.y} L ${x + h} ${e.y} ${o} ${x} ${e.y + $} L ${x} ${a.y - h} ${f} ${x - $} ${a.y} L ${a.x} ${a.y}`) : u === "BT" ? e.x < a.x ? i = `M ${e.x} ${e.y} L ${x - h} ${e.y} ${o} ${x} ${e.y - $} L ${x} ${a.y + h} ${f} ${x + $} ${a.y} L ${a.x} ${a.y}` : (g = b.get(r.branch)?.index, i = `M ${e.x} ${e.y} L ${x + h} ${e.y} ${f} ${x} ${e.y - $} L ${x} ${a.y + h} ${o} ${x - $} ${a.y} L ${a.x} ${a.y}`) : e.y < a.y ? i = `M ${e.x} ${e.y} L ${e.x} ${y - h} ${o} ${e.x + $} ${y} L ${a.x - h} ${y} ${f} ${a.x} ${y + $} L ${a.x} ${a.y}` : (g = b.get(r.branch)?.index, i = `M ${e.x} ${e.y} L ${e.x} ${y + h} ${f} ${e.x + $} ${y} L ${a.x - h} ${y} ${o} ${a.x} ${y - $} L ${a.x} ${a.y}`);
|
|
579
|
+
} else
|
|
580
|
+
o = "A 20 20, 0, 0, 0,", f = "A 20 20, 0, 0, 1,", h = 20, $ = 20, u === "TB" ? (e.x < a.x && (n.type === p.MERGE && r.id !== n.parents[0] ? i = `M ${e.x} ${e.y} L ${e.x} ${a.y - h} ${o} ${e.x + $} ${a.y} L ${a.x} ${a.y}` : i = `M ${e.x} ${e.y} L ${a.x - h} ${e.y} ${f} ${a.x} ${e.y + $} L ${a.x} ${a.y}`), e.x > a.x && (o = "A 20 20, 0, 0, 0,", f = "A 20 20, 0, 0, 1,", h = 20, $ = 20, n.type === p.MERGE && r.id !== n.parents[0] ? i = `M ${e.x} ${e.y} L ${e.x} ${a.y - h} ${f} ${e.x - $} ${a.y} L ${a.x} ${a.y}` : i = `M ${e.x} ${e.y} L ${a.x + h} ${e.y} ${o} ${a.x} ${e.y + $} L ${a.x} ${a.y}`), e.x === a.x && (i = `M ${e.x} ${e.y} L ${a.x} ${a.y}`)) : u === "BT" ? (e.x < a.x && (n.type === p.MERGE && r.id !== n.parents[0] ? i = `M ${e.x} ${e.y} L ${e.x} ${a.y + h} ${f} ${e.x + $} ${a.y} L ${a.x} ${a.y}` : i = `M ${e.x} ${e.y} L ${a.x - h} ${e.y} ${o} ${a.x} ${e.y - $} L ${a.x} ${a.y}`), e.x > a.x && (o = "A 20 20, 0, 0, 0,", f = "A 20 20, 0, 0, 1,", h = 20, $ = 20, n.type === p.MERGE && r.id !== n.parents[0] ? i = `M ${e.x} ${e.y} L ${e.x} ${a.y + h} ${o} ${e.x - $} ${a.y} L ${a.x} ${a.y}` : i = `M ${e.x} ${e.y} L ${a.x - h} ${e.y} ${o} ${a.x} ${e.y - $} L ${a.x} ${a.y}`), e.x === a.x && (i = `M ${e.x} ${e.y} L ${a.x} ${a.y}`)) : (e.y < a.y && (n.type === p.MERGE && r.id !== n.parents[0] ? i = `M ${e.x} ${e.y} L ${a.x - h} ${e.y} ${f} ${a.x} ${e.y + $} L ${a.x} ${a.y}` : i = `M ${e.x} ${e.y} L ${e.x} ${a.y - h} ${o} ${e.x + $} ${a.y} L ${a.x} ${a.y}`), e.y > a.y && (n.type === p.MERGE && r.id !== n.parents[0] ? i = `M ${e.x} ${e.y} L ${a.x - h} ${e.y} ${o} ${a.x} ${e.y - $} L ${a.x} ${a.y}` : i = `M ${e.x} ${e.y} L ${e.x} ${a.y + h} ${f} ${e.x + $} ${a.y} L ${a.x} ${a.y}`), e.y === a.y && (i = `M ${e.x} ${e.y} L ${a.x} ${a.y}`));
|
|
581
|
+
if (i === void 0)
|
|
582
|
+
throw new Error("Line definition not found");
|
|
583
|
+
t.append("path").attr("d", i).attr("class", "arrow arrow" + g % M);
|
|
584
|
+
}, "drawArrow"), Xr = /* @__PURE__ */ l((t, r) => {
|
|
585
|
+
const n = t.append("g").attr("class", "commit-arrows");
|
|
586
|
+
[...r.keys()].forEach((s) => {
|
|
587
|
+
const e = r.get(s);
|
|
588
|
+
e.parents && e.parents.length > 0 && e.parents.forEach((a) => {
|
|
589
|
+
Vr(n, r.get(a), e, r);
|
|
590
|
+
});
|
|
591
|
+
});
|
|
592
|
+
}, "drawArrows"), Jr = /* @__PURE__ */ l((t, r) => {
|
|
593
|
+
const n = t.append("g");
|
|
594
|
+
r.forEach((s, e) => {
|
|
595
|
+
const a = e % M, d = b.get(s.name)?.pos;
|
|
596
|
+
if (d === void 0)
|
|
597
|
+
throw new Error(`Position not found for branch ${s.name}`);
|
|
598
|
+
const o = n.append("line");
|
|
599
|
+
o.attr("x1", 0), o.attr("y1", d), o.attr("x2", B), o.attr("y2", d), o.attr("class", "branch branch" + a), u === "TB" ? (o.attr("y1", O), o.attr("x1", d), o.attr("y2", B), o.attr("x2", d)) : u === "BT" && (o.attr("y1", B), o.attr("x1", d), o.attr("y2", O), o.attr("x2", d)), A.push(d);
|
|
600
|
+
const f = s.name, h = W(f), $ = n.insert("rect"), i = n.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + a);
|
|
601
|
+
i.node().appendChild(h);
|
|
602
|
+
const y = h.getBBox();
|
|
603
|
+
$.attr("class", "branchLabelBkg label" + a).attr("rx", 4).attr("ry", 4).attr("x", -y.width - 4 - (v?.rotateCommitLabel === !0 ? 30 : 0)).attr("y", -y.height / 2 + 8).attr("width", y.width + 18).attr("height", y.height + 4), i.attr(
|
|
604
|
+
"transform",
|
|
605
|
+
"translate(" + (-y.width - 14 - (v?.rotateCommitLabel === !0 ? 30 : 0)) + ", " + (d - y.height / 2 - 1) + ")"
|
|
606
|
+
), u === "TB" ? ($.attr("x", d - y.width / 2 - 10).attr("y", 0), i.attr("transform", "translate(" + (d - y.width / 2 - 5) + ", 0)")) : u === "BT" ? ($.attr("x", d - y.width / 2 - 10).attr("y", B), i.attr("transform", "translate(" + (d - y.width / 2 - 5) + ", " + B + ")")) : $.attr("transform", "translate(-19, " + (d - y.height / 2) + ")");
|
|
607
|
+
});
|
|
608
|
+
}, "drawBranches"), Qr = /* @__PURE__ */ l(function(t, r, n, s, e) {
|
|
609
|
+
return b.set(t, { pos: r, index: n }), r += 50 + (e ? 40 : 0) + (u === "TB" || u === "BT" ? s.width / 2 : 0), r;
|
|
610
|
+
}, "setBranchPosition"), Zr = /* @__PURE__ */ l(function(t, r, n, s) {
|
|
611
|
+
if (qr(), m.debug("in gitgraph renderer", t + `
|
|
612
|
+
`, "id:", r, n), !v)
|
|
613
|
+
throw new Error("GitGraph config not found");
|
|
614
|
+
const e = v.rotateCommitLabel ?? !1, a = s.db;
|
|
615
|
+
R = a.getCommits();
|
|
616
|
+
const d = a.getBranchesAsObjArray();
|
|
617
|
+
u = a.getDirection();
|
|
618
|
+
const o = rr(`[id="${r}"]`);
|
|
619
|
+
let f = 0;
|
|
620
|
+
d.forEach((h, $) => {
|
|
621
|
+
const g = W(h.name), i = o.append("g"), y = i.insert("g").attr("class", "branchLabel"), x = y.insert("g").attr("class", "label branch-label");
|
|
622
|
+
x.node()?.appendChild(g);
|
|
623
|
+
const H = g.getBBox();
|
|
624
|
+
f = Qr(h.name, f, $, H, e), x.remove(), y.remove(), i.remove();
|
|
625
|
+
}), z(o, R, !1), v.showBranches && Jr(o, d), Xr(o, R), z(o, R, !0), tr.insertTitle(
|
|
626
|
+
o,
|
|
627
|
+
"gitTitleText",
|
|
628
|
+
v.titleTopMargin ?? 0,
|
|
629
|
+
a.getDiagramTitle()
|
|
630
|
+
), ar(
|
|
631
|
+
void 0,
|
|
632
|
+
o,
|
|
633
|
+
v.diagramPadding,
|
|
634
|
+
v.useMaxWidth
|
|
635
|
+
);
|
|
636
|
+
}, "draw"), re = {
|
|
637
|
+
draw: Zr
|
|
638
|
+
}, ee = /* @__PURE__ */ l((t) => `
|
|
639
|
+
.commit-id,
|
|
640
|
+
.commit-msg,
|
|
641
|
+
.branch-label {
|
|
642
|
+
fill: lightgrey;
|
|
643
|
+
color: lightgrey;
|
|
644
|
+
font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
|
645
|
+
font-family: var(--mermaid-font-family);
|
|
646
|
+
}
|
|
647
|
+
${[0, 1, 2, 3, 4, 5, 6, 7].map(
|
|
648
|
+
(r) => `
|
|
649
|
+
.branch-label${r} { fill: ${t["gitBranchLabel" + r]}; }
|
|
650
|
+
.commit${r} { stroke: ${t["git" + r]}; fill: ${t["git" + r]}; }
|
|
651
|
+
.commit-highlight${r} { stroke: ${t["gitInv" + r]}; fill: ${t["gitInv" + r]}; }
|
|
652
|
+
.label${r} { fill: ${t["git" + r]}; }
|
|
653
|
+
.arrow${r} { stroke: ${t["git" + r]}; }
|
|
654
|
+
`
|
|
655
|
+
).join(`
|
|
656
|
+
`)}
|
|
657
|
+
|
|
658
|
+
.branch {
|
|
659
|
+
stroke-width: 1;
|
|
660
|
+
stroke: ${t.lineColor};
|
|
661
|
+
stroke-dasharray: 2;
|
|
662
|
+
}
|
|
663
|
+
.commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};}
|
|
664
|
+
.commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; }
|
|
665
|
+
.tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}
|
|
666
|
+
.tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; }
|
|
667
|
+
.tag-hole { fill: ${t.textColor}; }
|
|
668
|
+
|
|
669
|
+
.commit-merge {
|
|
670
|
+
stroke: ${t.primaryColor};
|
|
671
|
+
fill: ${t.primaryColor};
|
|
672
|
+
}
|
|
673
|
+
.commit-reverse {
|
|
674
|
+
stroke: ${t.primaryColor};
|
|
675
|
+
fill: ${t.primaryColor};
|
|
676
|
+
stroke-width: 3;
|
|
677
|
+
}
|
|
678
|
+
.commit-highlight-outer {
|
|
679
|
+
}
|
|
680
|
+
.commit-highlight-inner {
|
|
681
|
+
stroke: ${t.primaryColor};
|
|
682
|
+
fill: ${t.primaryColor};
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
.arrow { stroke-width: 8; stroke-linecap: round; fill: none}
|
|
686
|
+
.gitTitleText {
|
|
687
|
+
text-anchor: middle;
|
|
688
|
+
font-size: 18px;
|
|
689
|
+
fill: ${t.textColor};
|
|
690
|
+
}
|
|
691
|
+
`, "getStyles"), te = ee, ce = {
|
|
692
|
+
parser: Or,
|
|
693
|
+
db: S,
|
|
694
|
+
renderer: re,
|
|
695
|
+
styles: te
|
|
696
|
+
};
|
|
697
|
+
export {
|
|
698
|
+
ce as diagram
|
|
699
|
+
};
|