@schmitech/chatbot-widget 0.5.3 → 0.6.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/_basePickBy-C3-QE0dl-5eQ6L29l.js +152 -0
- package/dist/_baseUniq-CstiM9Lp-AFR_Ns0a.js +615 -0
- package/dist/arc-W3NKKXLI-DHbDwLx0.js +84 -0
- package/dist/architecture-U656AL7Q-fn9wJZsH-BLoGjtkP.js +6 -0
- package/dist/architectureDiagram-VXUJARFQ-zzJsgPC6-C4OfUE0m.js +4667 -0
- package/dist/blockDiagram-VD42YOAC-D-In4h7h-BYXdRmeG.js +2266 -0
- package/dist/c4Diagram-YG6GDRKO-DBs8r9gh-BdLuHgPT.js +1582 -0
- package/dist/channel-RBWQyMSg-Cx0HUumY.js +6 -0
- package/dist/chatbot-widget.bundle.js +4473 -1556
- package/dist/chatbot-widget.css +1 -1
- package/dist/chatbot-widget.es.js +12 -63659
- package/dist/chatbot-widget.umd.js +4472 -1555
- package/dist/chunk-4BX2VUAB-BqD7w0AR-CbA2613c.js +10 -0
- package/dist/chunk-55IACEB6-D8pvDVEJ-DrL4SJSR.js +9 -0
- package/dist/chunk-B4BG7PRW-Dwma1pSy-BWjG5dc6.js +1375 -0
- package/dist/chunk-DI55MBZ5-BY2XXvZz-DbAvz3Pq.js +1383 -0
- package/dist/chunk-FMBD7UC4-BeiLbQ8U-BNaZTCv4.js +20 -0
- package/dist/chunk-QN33PNHL-BkO3hOeq-DkU1EzGA.js +21 -0
- package/dist/chunk-QZHKN3VN-Cwlo2qTG-DMmeZmp5.js +16 -0
- package/dist/chunk-TZMSLE5B-BnXK-OiF-RfzVsOBe.js +65 -0
- package/dist/classDiagram-2ON5EDUG-Crd6O69V-kCZrFOLN.js +17 -0
- package/dist/classDiagram-v2-WZHVMYZB-Crd6O69V-kCZrFOLN.js +17 -0
- package/dist/clone-CfLgyC8S-DsDOh4B4.js +9 -0
- package/dist/config/index.d.ts +4 -2
- package/dist/cose-bilkent-S5V4N54A-DKeVcPDK-de_7nZTY.js +2609 -0
- package/dist/cytoscape.esm-CjI2IsL8-Be2K4mI6.js +18723 -0
- package/dist/dagre-6UL2VRFP-BPf604Df-BhZs6zCq.js +448 -0
- package/dist/diagram-PSM6KHXK-DeLcpEV3-qb4rujeN.js +532 -0
- package/dist/diagram-QEK2KX5R-C_5RR1NJ-C5kZWmRl.js +222 -0
- package/dist/diagram-S2PKOQOG-DVx43aon-4nlw6iDz.js +144 -0
- package/dist/erDiagram-Q2GNP2WA-DgUeO5_h-DHc9Yphl.js +841 -0
- package/dist/flowDiagram-NV44I4VS-C5HQUzU9-DHjbmAtJ.js +1628 -0
- package/dist/ganttDiagram-JELNMOA3-DgSZ1ixF-C3hJs_k9.js +1936 -0
- package/dist/gitGraph-F6HP7TQM-UL7-Bx1s-Cog5rj3j.js +6 -0
- package/dist/gitGraphDiagram-NY62KEGX-DY5loT9K-CEcKQNrM.js +713 -0
- package/dist/graph-BfwqPHx6-DErF9dBN.js +248 -0
- package/dist/index-B5s_uaP2.js +124168 -0
- package/dist/index-BAOVR-xx-thst7Pu6.js +13251 -0
- package/dist/info-NVLQJR56-BsqQ0RXQ-BcYgZCCY.js +6 -0
- package/dist/infoDiagram-WHAUD3N6-DIqQ6vCk-BuiAAMSH.js +25 -0
- package/dist/journeyDiagram-XKPGCS4Q-DXjg3S3r-Byi_TGXs.js +835 -0
- package/dist/kanban-definition-3W4ZIXB7-Uxt7Am6n-jy96nA-g.js +721 -0
- package/dist/layout-CSfkE668-BjigbqJL.js +1333 -0
- package/dist/mermaid-parser.core-LjuO4CL3-BLqmPe8-.js +12891 -0
- package/dist/mindmap-definition-VGOIOE7T-DXwVuAPE-SK4e1Sse.js +787 -0
- package/dist/packet-BFZMPI3H-DJWkrKrV-BamBev9S.js +6 -0
- package/dist/pie-7BOR55EZ-DC8hTFwn-D1bcIQbR.js +6 -0
- package/dist/pieDiagram-ADFJNKIX-Cj0EHHtj-Dbr09c-S.js +161 -0
- package/dist/quadrantDiagram-AYHSOK5B-CnLDz007-Ci0DQl2T.js +1024 -0
- package/dist/radar-NHE76QYJ-Bijk-Fk9-9nAmDCMr.js +6 -0
- package/dist/requirementDiagram-UZGBJVZJ-rDaI-8Be-CSEc4S33.js +851 -0
- package/dist/sankeyDiagram-TZEHDZUN-A0YO8ixs-Zj8Z0j0n.js +810 -0
- package/dist/sequenceDiagram-WL72ISMW-BFF7TtP7-Dcofckjv.js +2519 -0
- package/dist/shared/styles.d.ts +1 -1
- package/dist/stateDiagram-FKZM4ZOC-ofFsB7HJ-BJBX12rE.js +264 -0
- package/dist/stateDiagram-v2-4FDKWEC3-CEZFbksU-BywmU88h.js +17 -0
- package/dist/timeline-definition-IT6M3QCI-5W361ZNm-MP_ufVe7.js +800 -0
- package/dist/treemap-KMMF4GRG-pGRoYcSn-BeZ7sXgP.js +6 -0
- package/dist/ui/Message.d.ts +1 -5
- package/dist/ui/MessagesList.d.ts +1 -5
- package/dist/utils/contentFiltering.d.ts +12 -0
- package/dist/xychartDiagram-PRI3JC2R-CSr0GxaP-DBgCtplP.js +1297 -0
- package/package.json +3 -3
- package/dist/ui/TypingEffect.d.ts +0 -18
|
@@ -0,0 +1,713 @@
|
|
|
1
|
+
import { m as J } from "./chunk-4BX2VUAB-BqD7w0AR-CbA2613c.js";
|
|
2
|
+
import { e as X } from "./chunk-QZHKN3VN-Cwlo2qTG-DMmeZmp5.js";
|
|
3
|
+
import { x as m, z as Z, w as rr, h as tr, B as er, g as or, u as nr, a as w, p as ar, f as cr, v as ir, P as sr, L as dr, n as k, Q as hr, S as $r, T as mr, U as lr } from "./index-B5s_uaP2.js";
|
|
4
|
+
import { N as yr } from "./mermaid-parser.core-LjuO4CL3-BLqmPe8-.js";
|
|
5
|
+
typeof window < "u" && (window.global = window);
|
|
6
|
+
var u = {
|
|
7
|
+
NORMAL: 0,
|
|
8
|
+
REVERSE: 1,
|
|
9
|
+
HIGHLIGHT: 2,
|
|
10
|
+
MERGE: 3,
|
|
11
|
+
CHERRY_PICK: 4
|
|
12
|
+
}, gr = mr.gitGraph, O = /* @__PURE__ */ m(() => hr({
|
|
13
|
+
...gr,
|
|
14
|
+
...$r().gitGraph
|
|
15
|
+
}), "getConfig"), s = new X(() => {
|
|
16
|
+
const t = O(), r = t.mainBranchName, e = t.mainBranchOrder;
|
|
17
|
+
return {
|
|
18
|
+
mainBranchName: r,
|
|
19
|
+
commits: /* @__PURE__ */ new Map(),
|
|
20
|
+
head: null,
|
|
21
|
+
branchConfig: /* @__PURE__ */ new Map([[r, { name: r, order: e }]]),
|
|
22
|
+
branches: /* @__PURE__ */ new Map([[r, null]]),
|
|
23
|
+
currBranch: r,
|
|
24
|
+
direction: "LR",
|
|
25
|
+
seq: 0,
|
|
26
|
+
options: {}
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
function S() {
|
|
30
|
+
return lr({ length: 7 });
|
|
31
|
+
}
|
|
32
|
+
m(S, "getID");
|
|
33
|
+
function K(t, r) {
|
|
34
|
+
const e = /* @__PURE__ */ Object.create(null);
|
|
35
|
+
return t.reduce((a, c) => {
|
|
36
|
+
const i = r(c);
|
|
37
|
+
return e[i] || (e[i] = !0, a.push(c)), a;
|
|
38
|
+
}, []);
|
|
39
|
+
}
|
|
40
|
+
m(K, "uniqBy");
|
|
41
|
+
var pr = /* @__PURE__ */ m(function(t) {
|
|
42
|
+
s.records.direction = t;
|
|
43
|
+
}, "setDirection"), fr = /* @__PURE__ */ m(function(t) {
|
|
44
|
+
w.debug("options str", t), t = t == null ? void 0 : t.trim(), t = t || "{}";
|
|
45
|
+
try {
|
|
46
|
+
s.records.options = JSON.parse(t);
|
|
47
|
+
} catch (r) {
|
|
48
|
+
w.error("error while parsing gitGraph options", r.message);
|
|
49
|
+
}
|
|
50
|
+
}, "setOptions"), xr = /* @__PURE__ */ m(function() {
|
|
51
|
+
return s.records.options;
|
|
52
|
+
}, "getOptions"), ur = /* @__PURE__ */ m(function(t) {
|
|
53
|
+
let r = t.msg, e = t.id;
|
|
54
|
+
const a = t.type;
|
|
55
|
+
let c = t.tags;
|
|
56
|
+
w.info("commit", r, e, a, c), w.debug("Entering commit:", r, e, a, c);
|
|
57
|
+
const i = O();
|
|
58
|
+
e = k.sanitizeText(e, i), r = k.sanitizeText(r, i), c = c == null ? void 0 : c.map((h) => k.sanitizeText(h, i));
|
|
59
|
+
const d = {
|
|
60
|
+
id: e || s.records.seq + "-" + S(),
|
|
61
|
+
message: r,
|
|
62
|
+
seq: s.records.seq++,
|
|
63
|
+
type: a ?? u.NORMAL,
|
|
64
|
+
tags: c ?? [],
|
|
65
|
+
parents: s.records.head == null ? [] : [s.records.head.id],
|
|
66
|
+
branch: s.records.currBranch
|
|
67
|
+
};
|
|
68
|
+
s.records.head = d, w.info("main branch", i.mainBranchName), s.records.commits.has(d.id) && w.warn(`Commit ID ${d.id} already exists`), s.records.commits.set(d.id, d), s.records.branches.set(s.records.currBranch, d.id), w.debug("in pushCommit " + d.id);
|
|
69
|
+
}, "commit"), br = /* @__PURE__ */ m(function(t) {
|
|
70
|
+
let r = t.name;
|
|
71
|
+
const e = t.order;
|
|
72
|
+
if (r = k.sanitizeText(r, O()), s.records.branches.has(r))
|
|
73
|
+
throw new Error(
|
|
74
|
+
`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`
|
|
75
|
+
);
|
|
76
|
+
s.records.branches.set(r, s.records.head != null ? s.records.head.id : null), s.records.branchConfig.set(r, { name: r, order: e }), _(r), w.debug("in createBranch");
|
|
77
|
+
}, "branch"), wr = /* @__PURE__ */ m((t) => {
|
|
78
|
+
let r = t.branch, e = t.id;
|
|
79
|
+
const a = t.type, c = t.tags, i = O();
|
|
80
|
+
r = k.sanitizeText(r, i), e && (e = k.sanitizeText(e, i));
|
|
81
|
+
const d = s.records.branches.get(s.records.currBranch), h = s.records.branches.get(r), l = d ? s.records.commits.get(d) : void 0, o = h ? s.records.commits.get(h) : void 0;
|
|
82
|
+
if (l && o && l.branch === r)
|
|
83
|
+
throw new Error(`Cannot merge branch '${r}' into itself.`);
|
|
84
|
+
if (s.records.currBranch === r) {
|
|
85
|
+
const $ = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
|
|
86
|
+
throw $.hash = {
|
|
87
|
+
text: `merge ${r}`,
|
|
88
|
+
token: `merge ${r}`,
|
|
89
|
+
expected: ["branch abc"]
|
|
90
|
+
}, $;
|
|
91
|
+
}
|
|
92
|
+
if (l === void 0 || !l) {
|
|
93
|
+
const $ = new Error(
|
|
94
|
+
`Incorrect usage of "merge". Current branch (${s.records.currBranch})has no commits`
|
|
95
|
+
);
|
|
96
|
+
throw $.hash = {
|
|
97
|
+
text: `merge ${r}`,
|
|
98
|
+
token: `merge ${r}`,
|
|
99
|
+
expected: ["commit"]
|
|
100
|
+
}, $;
|
|
101
|
+
}
|
|
102
|
+
if (!s.records.branches.has(r)) {
|
|
103
|
+
const $ = new Error(
|
|
104
|
+
'Incorrect usage of "merge". Branch to be merged (' + r + ") does not exist"
|
|
105
|
+
);
|
|
106
|
+
throw $.hash = {
|
|
107
|
+
text: `merge ${r}`,
|
|
108
|
+
token: `merge ${r}`,
|
|
109
|
+
expected: [`branch ${r}`]
|
|
110
|
+
}, $;
|
|
111
|
+
}
|
|
112
|
+
if (o === void 0 || !o) {
|
|
113
|
+
const $ = new Error(
|
|
114
|
+
'Incorrect usage of "merge". Branch to be merged (' + r + ") has no commits"
|
|
115
|
+
);
|
|
116
|
+
throw $.hash = {
|
|
117
|
+
text: `merge ${r}`,
|
|
118
|
+
token: `merge ${r}`,
|
|
119
|
+
expected: ['"commit"']
|
|
120
|
+
}, $;
|
|
121
|
+
}
|
|
122
|
+
if (l === o) {
|
|
123
|
+
const $ = new Error('Incorrect usage of "merge". Both branches have same head');
|
|
124
|
+
throw $.hash = {
|
|
125
|
+
text: `merge ${r}`,
|
|
126
|
+
token: `merge ${r}`,
|
|
127
|
+
expected: ["branch abc"]
|
|
128
|
+
}, $;
|
|
129
|
+
}
|
|
130
|
+
if (e && s.records.commits.has(e)) {
|
|
131
|
+
const $ = new Error(
|
|
132
|
+
'Incorrect usage of "merge". Commit with id:' + e + " already exists, use different custom id"
|
|
133
|
+
);
|
|
134
|
+
throw $.hash = {
|
|
135
|
+
text: `merge ${r} ${e} ${a} ${c == null ? void 0 : c.join(" ")}`,
|
|
136
|
+
token: `merge ${r} ${e} ${a} ${c == null ? void 0 : c.join(" ")}`,
|
|
137
|
+
expected: [
|
|
138
|
+
`merge ${r} ${e}_UNIQUE ${a} ${c == null ? void 0 : c.join(" ")}`
|
|
139
|
+
]
|
|
140
|
+
}, $;
|
|
141
|
+
}
|
|
142
|
+
const n = h || "", x = {
|
|
143
|
+
id: e || `${s.records.seq}-${S()}`,
|
|
144
|
+
message: `merged branch ${r} into ${s.records.currBranch}`,
|
|
145
|
+
seq: s.records.seq++,
|
|
146
|
+
parents: s.records.head == null ? [] : [s.records.head.id, n],
|
|
147
|
+
branch: s.records.currBranch,
|
|
148
|
+
type: u.MERGE,
|
|
149
|
+
customType: a,
|
|
150
|
+
customId: !!e,
|
|
151
|
+
tags: c ?? []
|
|
152
|
+
};
|
|
153
|
+
s.records.head = x, s.records.commits.set(x.id, x), s.records.branches.set(s.records.currBranch, x.id), w.debug(s.records.branches), w.debug("in mergeBranch");
|
|
154
|
+
}, "merge"), Br = /* @__PURE__ */ m(function(t) {
|
|
155
|
+
let r = t.id, e = t.targetId, a = t.tags, c = t.parent;
|
|
156
|
+
w.debug("Entering cherryPick:", r, e, a);
|
|
157
|
+
const i = O();
|
|
158
|
+
if (r = k.sanitizeText(r, i), e = k.sanitizeText(e, i), a = a == null ? void 0 : a.map((l) => k.sanitizeText(l, i)), c = k.sanitizeText(c, i), !r || !s.records.commits.has(r)) {
|
|
159
|
+
const l = new Error(
|
|
160
|
+
'Incorrect usage of "cherryPick". Source commit id should exist and provided'
|
|
161
|
+
);
|
|
162
|
+
throw l.hash = {
|
|
163
|
+
text: `cherryPick ${r} ${e}`,
|
|
164
|
+
token: `cherryPick ${r} ${e}`,
|
|
165
|
+
expected: ["cherry-pick abc"]
|
|
166
|
+
}, l;
|
|
167
|
+
}
|
|
168
|
+
const d = s.records.commits.get(r);
|
|
169
|
+
if (d === void 0 || !d)
|
|
170
|
+
throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
|
|
171
|
+
if (c && !(Array.isArray(d.parents) && d.parents.includes(c)))
|
|
172
|
+
throw new Error(
|
|
173
|
+
"Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit."
|
|
174
|
+
);
|
|
175
|
+
const h = d.branch;
|
|
176
|
+
if (d.type === u.MERGE && !c)
|
|
177
|
+
throw new Error(
|
|
178
|
+
"Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified."
|
|
179
|
+
);
|
|
180
|
+
if (!e || !s.records.commits.has(e)) {
|
|
181
|
+
if (h === s.records.currBranch) {
|
|
182
|
+
const x = new Error(
|
|
183
|
+
'Incorrect usage of "cherryPick". Source commit is already on current branch'
|
|
184
|
+
);
|
|
185
|
+
throw x.hash = {
|
|
186
|
+
text: `cherryPick ${r} ${e}`,
|
|
187
|
+
token: `cherryPick ${r} ${e}`,
|
|
188
|
+
expected: ["cherry-pick abc"]
|
|
189
|
+
}, x;
|
|
190
|
+
}
|
|
191
|
+
const l = s.records.branches.get(s.records.currBranch);
|
|
192
|
+
if (l === void 0 || !l) {
|
|
193
|
+
const x = new Error(
|
|
194
|
+
`Incorrect usage of "cherry-pick". Current branch (${s.records.currBranch})has no commits`
|
|
195
|
+
);
|
|
196
|
+
throw x.hash = {
|
|
197
|
+
text: `cherryPick ${r} ${e}`,
|
|
198
|
+
token: `cherryPick ${r} ${e}`,
|
|
199
|
+
expected: ["cherry-pick abc"]
|
|
200
|
+
}, x;
|
|
201
|
+
}
|
|
202
|
+
const o = s.records.commits.get(l);
|
|
203
|
+
if (o === void 0 || !o) {
|
|
204
|
+
const x = new Error(
|
|
205
|
+
`Incorrect usage of "cherry-pick". Current branch (${s.records.currBranch})has no commits`
|
|
206
|
+
);
|
|
207
|
+
throw x.hash = {
|
|
208
|
+
text: `cherryPick ${r} ${e}`,
|
|
209
|
+
token: `cherryPick ${r} ${e}`,
|
|
210
|
+
expected: ["cherry-pick abc"]
|
|
211
|
+
}, x;
|
|
212
|
+
}
|
|
213
|
+
const n = {
|
|
214
|
+
id: s.records.seq + "-" + S(),
|
|
215
|
+
message: `cherry-picked ${d == null ? void 0 : d.message} into ${s.records.currBranch}`,
|
|
216
|
+
seq: s.records.seq++,
|
|
217
|
+
parents: s.records.head == null ? [] : [s.records.head.id, d.id],
|
|
218
|
+
branch: s.records.currBranch,
|
|
219
|
+
type: u.CHERRY_PICK,
|
|
220
|
+
tags: a ? a.filter(Boolean) : [
|
|
221
|
+
`cherry-pick:${d.id}${d.type === u.MERGE ? `|parent:${c}` : ""}`
|
|
222
|
+
]
|
|
223
|
+
};
|
|
224
|
+
s.records.head = n, s.records.commits.set(n.id, n), s.records.branches.set(s.records.currBranch, n.id), w.debug(s.records.branches), w.debug("in cherryPick");
|
|
225
|
+
}
|
|
226
|
+
}, "cherryPick"), _ = /* @__PURE__ */ m(function(t) {
|
|
227
|
+
if (t = k.sanitizeText(t, O()), s.records.branches.has(t)) {
|
|
228
|
+
s.records.currBranch = t;
|
|
229
|
+
const r = s.records.branches.get(s.records.currBranch);
|
|
230
|
+
r === void 0 || !r ? s.records.head = null : s.records.head = s.records.commits.get(r) ?? null;
|
|
231
|
+
} else {
|
|
232
|
+
const r = new Error(
|
|
233
|
+
`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`
|
|
234
|
+
);
|
|
235
|
+
throw r.hash = {
|
|
236
|
+
text: `checkout ${t}`,
|
|
237
|
+
token: `checkout ${t}`,
|
|
238
|
+
expected: [`branch ${t}`]
|
|
239
|
+
}, r;
|
|
240
|
+
}
|
|
241
|
+
}, "checkout");
|
|
242
|
+
function D(t, r, e) {
|
|
243
|
+
const a = t.indexOf(r);
|
|
244
|
+
a === -1 ? t.push(e) : t.splice(a, 1, e);
|
|
245
|
+
}
|
|
246
|
+
m(D, "upsert");
|
|
247
|
+
function W(t) {
|
|
248
|
+
const r = t.reduce((c, i) => c.seq > i.seq ? c : i, t[0]);
|
|
249
|
+
let e = "";
|
|
250
|
+
t.forEach(function(c) {
|
|
251
|
+
c === r ? e += " *" : e += " |";
|
|
252
|
+
});
|
|
253
|
+
const a = [e, r.id, r.seq];
|
|
254
|
+
for (const c in s.records.branches)
|
|
255
|
+
s.records.branches.get(c) === r.id && a.push(c);
|
|
256
|
+
if (w.debug(a.join(" ")), r.parents && r.parents.length == 2 && r.parents[0] && r.parents[1]) {
|
|
257
|
+
const c = s.records.commits.get(r.parents[0]);
|
|
258
|
+
D(t, r, c), r.parents[1] && t.push(s.records.commits.get(r.parents[1]));
|
|
259
|
+
} else {
|
|
260
|
+
if (r.parents.length == 0)
|
|
261
|
+
return;
|
|
262
|
+
if (r.parents[0]) {
|
|
263
|
+
const c = s.records.commits.get(r.parents[0]);
|
|
264
|
+
D(t, r, c);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
t = K(t, (c) => c.id), W(t);
|
|
268
|
+
}
|
|
269
|
+
m(W, "prettyPrintCommitHistory");
|
|
270
|
+
var Er = /* @__PURE__ */ m(function() {
|
|
271
|
+
w.debug(s.records.commits);
|
|
272
|
+
const t = Y()[0];
|
|
273
|
+
W([t]);
|
|
274
|
+
}, "prettyPrint"), vr = /* @__PURE__ */ m(function() {
|
|
275
|
+
s.reset(), dr();
|
|
276
|
+
}, "clear"), Cr = /* @__PURE__ */ m(function() {
|
|
277
|
+
return [...s.records.branchConfig.values()].map((t, r) => t.order !== null && t.order !== void 0 ? t : {
|
|
278
|
+
...t,
|
|
279
|
+
order: parseFloat(`0.${r}`)
|
|
280
|
+
}).sort((t, r) => (t.order ?? 0) - (r.order ?? 0)).map(({ name: t }) => ({ name: t }));
|
|
281
|
+
}, "getBranchesAsObjArray"), kr = /* @__PURE__ */ m(function() {
|
|
282
|
+
return s.records.branches;
|
|
283
|
+
}, "getBranches"), Lr = /* @__PURE__ */ m(function() {
|
|
284
|
+
return s.records.commits;
|
|
285
|
+
}, "getCommits"), Y = /* @__PURE__ */ m(function() {
|
|
286
|
+
const t = [...s.records.commits.values()];
|
|
287
|
+
return t.forEach(function(r) {
|
|
288
|
+
w.debug(r.id);
|
|
289
|
+
}), t.sort((r, e) => r.seq - e.seq), t;
|
|
290
|
+
}, "getCommitsArray"), Tr = /* @__PURE__ */ m(function() {
|
|
291
|
+
return s.records.currBranch;
|
|
292
|
+
}, "getCurrentBranch"), Mr = /* @__PURE__ */ m(function() {
|
|
293
|
+
return s.records.direction;
|
|
294
|
+
}, "getDirection"), Pr = /* @__PURE__ */ m(function() {
|
|
295
|
+
return s.records.head;
|
|
296
|
+
}, "getHead"), U = {
|
|
297
|
+
commitType: u,
|
|
298
|
+
getConfig: O,
|
|
299
|
+
setDirection: pr,
|
|
300
|
+
setOptions: fr,
|
|
301
|
+
getOptions: xr,
|
|
302
|
+
commit: ur,
|
|
303
|
+
branch: br,
|
|
304
|
+
merge: wr,
|
|
305
|
+
cherryPick: Br,
|
|
306
|
+
checkout: _,
|
|
307
|
+
//reset,
|
|
308
|
+
prettyPrint: Er,
|
|
309
|
+
clear: vr,
|
|
310
|
+
getBranchesAsObjArray: Cr,
|
|
311
|
+
getBranches: kr,
|
|
312
|
+
getCommits: Lr,
|
|
313
|
+
getCommitsArray: Y,
|
|
314
|
+
getCurrentBranch: Tr,
|
|
315
|
+
getDirection: Mr,
|
|
316
|
+
getHead: Pr,
|
|
317
|
+
setAccTitle: nr,
|
|
318
|
+
getAccTitle: or,
|
|
319
|
+
getAccDescription: er,
|
|
320
|
+
setAccDescription: tr,
|
|
321
|
+
setDiagramTitle: rr,
|
|
322
|
+
getDiagramTitle: Z
|
|
323
|
+
}, Rr = /* @__PURE__ */ m((t, r) => {
|
|
324
|
+
J(t, r), t.dir && r.setDirection(t.dir);
|
|
325
|
+
for (const e of t.statements)
|
|
326
|
+
Ar(e, r);
|
|
327
|
+
}, "populate"), Ar = /* @__PURE__ */ m((t, r) => {
|
|
328
|
+
const e = {
|
|
329
|
+
Commit: /* @__PURE__ */ m((a) => r.commit(Ir(a)), "Commit"),
|
|
330
|
+
Branch: /* @__PURE__ */ m((a) => r.branch(Gr(a)), "Branch"),
|
|
331
|
+
Merge: /* @__PURE__ */ m((a) => r.merge(Or(a)), "Merge"),
|
|
332
|
+
Checkout: /* @__PURE__ */ m((a) => r.checkout(qr(a)), "Checkout"),
|
|
333
|
+
CherryPicking: /* @__PURE__ */ m((a) => r.cherryPick(zr(a)), "CherryPicking")
|
|
334
|
+
}[t.$type];
|
|
335
|
+
e ? e(t) : w.error(`Unknown statement type: ${t.$type}`);
|
|
336
|
+
}, "parseStatement"), Ir = /* @__PURE__ */ m((t) => ({
|
|
337
|
+
id: t.id,
|
|
338
|
+
msg: t.message ?? "",
|
|
339
|
+
type: t.type !== void 0 ? u[t.type] : u.NORMAL,
|
|
340
|
+
tags: t.tags ?? void 0
|
|
341
|
+
}), "parseCommit"), Gr = /* @__PURE__ */ m((t) => ({
|
|
342
|
+
name: t.name,
|
|
343
|
+
order: t.order ?? 0
|
|
344
|
+
}), "parseBranch"), Or = /* @__PURE__ */ m((t) => ({
|
|
345
|
+
branch: t.branch,
|
|
346
|
+
id: t.id ?? "",
|
|
347
|
+
type: t.type !== void 0 ? u[t.type] : void 0,
|
|
348
|
+
tags: t.tags ?? void 0
|
|
349
|
+
}), "parseMerge"), qr = /* @__PURE__ */ m((t) => t.branch, "parseCheckout"), zr = /* @__PURE__ */ m((t) => {
|
|
350
|
+
var r;
|
|
351
|
+
return {
|
|
352
|
+
id: t.id,
|
|
353
|
+
targetId: "",
|
|
354
|
+
tags: ((r = t.tags) == null ? void 0 : r.length) === 0 ? void 0 : t.tags,
|
|
355
|
+
parent: t.parent
|
|
356
|
+
};
|
|
357
|
+
}, "parseCherryPicking"), Hr = {
|
|
358
|
+
parse: /* @__PURE__ */ m(async (t) => {
|
|
359
|
+
const r = await yr("gitGraph", t);
|
|
360
|
+
w.debug(r), Rr(r, U);
|
|
361
|
+
}, "parse")
|
|
362
|
+
}, j = ar(), E = j == null ? void 0 : j.gitGraph, A = 10, I = 40, L = 4, M = 2, G = 8, v = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), H = 30, q = /* @__PURE__ */ new Map(), N = [], R = 0, f = "LR", Nr = /* @__PURE__ */ m(() => {
|
|
363
|
+
v.clear(), C.clear(), q.clear(), R = 0, N = [], f = "LR";
|
|
364
|
+
}, "clear"), V = /* @__PURE__ */ m((t) => {
|
|
365
|
+
const r = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
366
|
+
return (typeof t == "string" ? t.split(/\\n|\n|<br\s*\/?>/gi) : t).forEach((e) => {
|
|
367
|
+
const a = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
368
|
+
a.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), a.setAttribute("dy", "1em"), a.setAttribute("x", "0"), a.setAttribute("class", "row"), a.textContent = e.trim(), r.appendChild(a);
|
|
369
|
+
}), r;
|
|
370
|
+
}, "drawText"), Q = /* @__PURE__ */ m((t) => {
|
|
371
|
+
let r, e, a;
|
|
372
|
+
return f === "BT" ? (e = /* @__PURE__ */ m((c, i) => c <= i, "comparisonFunc"), a = 1 / 0) : (e = /* @__PURE__ */ m((c, i) => c >= i, "comparisonFunc"), a = 0), t.forEach((c) => {
|
|
373
|
+
var i, d;
|
|
374
|
+
const h = f === "TB" || f == "BT" ? (i = C.get(c)) == null ? void 0 : i.y : (d = C.get(c)) == null ? void 0 : d.x;
|
|
375
|
+
h !== void 0 && e(h, a) && (r = c, a = h);
|
|
376
|
+
}), r;
|
|
377
|
+
}, "findClosestParent"), Sr = /* @__PURE__ */ m((t) => {
|
|
378
|
+
let r = "", e = 1 / 0;
|
|
379
|
+
return t.forEach((a) => {
|
|
380
|
+
const c = C.get(a).y;
|
|
381
|
+
c <= e && (r = a, e = c);
|
|
382
|
+
}), r || void 0;
|
|
383
|
+
}, "findClosestParentBT"), Dr = /* @__PURE__ */ m((t, r, e) => {
|
|
384
|
+
let a = e, c = e;
|
|
385
|
+
const i = [];
|
|
386
|
+
t.forEach((d) => {
|
|
387
|
+
const h = r.get(d);
|
|
388
|
+
if (!h)
|
|
389
|
+
throw new Error(`Commit not found for key ${d}`);
|
|
390
|
+
h.parents.length ? (a = jr(h), c = Math.max(a, c)) : i.push(h), Fr(h, a);
|
|
391
|
+
}), a = c, i.forEach((d) => {
|
|
392
|
+
Kr(d, a, e);
|
|
393
|
+
}), t.forEach((d) => {
|
|
394
|
+
const h = r.get(d);
|
|
395
|
+
if (h != null && h.parents.length) {
|
|
396
|
+
const l = Sr(h.parents);
|
|
397
|
+
a = C.get(l).y - I, a <= c && (c = a);
|
|
398
|
+
const o = v.get(h.branch).pos, n = a - A;
|
|
399
|
+
C.set(h.id, { x: o, y: n });
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
}, "setParallelBTPos"), Wr = /* @__PURE__ */ m((t) => {
|
|
403
|
+
var r;
|
|
404
|
+
const e = Q(t.parents.filter((c) => c !== null));
|
|
405
|
+
if (!e)
|
|
406
|
+
throw new Error(`Closest parent not found for commit ${t.id}`);
|
|
407
|
+
const a = (r = C.get(e)) == null ? void 0 : r.y;
|
|
408
|
+
if (a === void 0)
|
|
409
|
+
throw new Error(`Closest parent position not found for commit ${t.id}`);
|
|
410
|
+
return a;
|
|
411
|
+
}, "findClosestParentPos"), jr = /* @__PURE__ */ m((t) => Wr(t) + I, "calculateCommitPosition"), Fr = /* @__PURE__ */ m((t, r) => {
|
|
412
|
+
const e = v.get(t.branch);
|
|
413
|
+
if (!e)
|
|
414
|
+
throw new Error(`Branch not found for commit ${t.id}`);
|
|
415
|
+
const a = e.pos, c = r + A;
|
|
416
|
+
return C.set(t.id, { x: a, y: c }), { x: a, y: c };
|
|
417
|
+
}, "setCommitPosition"), Kr = /* @__PURE__ */ m((t, r, e) => {
|
|
418
|
+
const a = v.get(t.branch);
|
|
419
|
+
if (!a)
|
|
420
|
+
throw new Error(`Branch not found for commit ${t.id}`);
|
|
421
|
+
const c = r + e, i = a.pos;
|
|
422
|
+
C.set(t.id, { x: i, y: c });
|
|
423
|
+
}, "setRootPosition"), _r = /* @__PURE__ */ m((t, r, e, a, c, i) => {
|
|
424
|
+
if (i === u.HIGHLIGHT)
|
|
425
|
+
t.append("rect").attr("x", e.x - 10).attr("y", e.y - 10).attr("width", 20).attr("height", 20).attr(
|
|
426
|
+
"class",
|
|
427
|
+
`commit ${r.id} commit-highlight${c % G} ${a}-outer`
|
|
428
|
+
), t.append("rect").attr("x", e.x - 6).attr("y", e.y - 6).attr("width", 12).attr("height", 12).attr(
|
|
429
|
+
"class",
|
|
430
|
+
`commit ${r.id} commit${c % G} ${a}-inner`
|
|
431
|
+
);
|
|
432
|
+
else if (i === u.CHERRY_PICK)
|
|
433
|
+
t.append("circle").attr("cx", e.x).attr("cy", e.y).attr("r", 10).attr("class", `commit ${r.id} ${a}`), t.append("circle").attr("cx", e.x - 3).attr("cy", e.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${r.id} ${a}`), t.append("circle").attr("cx", e.x + 3).attr("cy", e.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${r.id} ${a}`), t.append("line").attr("x1", e.x + 3).attr("y1", e.y + 1).attr("x2", e.x).attr("y2", e.y - 5).attr("stroke", "#fff").attr("class", `commit ${r.id} ${a}`), t.append("line").attr("x1", e.x - 3).attr("y1", e.y + 1).attr("x2", e.x).attr("y2", e.y - 5).attr("stroke", "#fff").attr("class", `commit ${r.id} ${a}`);
|
|
434
|
+
else {
|
|
435
|
+
const d = t.append("circle");
|
|
436
|
+
if (d.attr("cx", e.x), d.attr("cy", e.y), d.attr("r", r.type === u.MERGE ? 9 : 10), d.attr("class", `commit ${r.id} commit${c % G}`), i === u.MERGE) {
|
|
437
|
+
const h = t.append("circle");
|
|
438
|
+
h.attr("cx", e.x), h.attr("cy", e.y), h.attr("r", 6), h.attr(
|
|
439
|
+
"class",
|
|
440
|
+
`commit ${a} ${r.id} commit${c % G}`
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
i === u.REVERSE && t.append("path").attr(
|
|
444
|
+
"d",
|
|
445
|
+
`M ${e.x - 5},${e.y - 5}L${e.x + 5},${e.y + 5}M${e.x - 5},${e.y + 5}L${e.x + 5},${e.y - 5}`
|
|
446
|
+
).attr("class", `commit ${a} ${r.id} commit${c % G}`);
|
|
447
|
+
}
|
|
448
|
+
}, "drawCommitBullet"), Yr = /* @__PURE__ */ m((t, r, e, a) => {
|
|
449
|
+
var c;
|
|
450
|
+
if (r.type !== u.CHERRY_PICK && (r.customId && r.type === u.MERGE || r.type !== u.MERGE) && E != null && E.showCommitLabel) {
|
|
451
|
+
const i = t.append("g"), d = i.insert("rect").attr("class", "commit-label-bkg"), h = i.append("text").attr("x", a).attr("y", e.y + 25).attr("class", "commit-label").text(r.id), l = (c = h.node()) == null ? void 0 : c.getBBox();
|
|
452
|
+
if (l && (d.attr("x", e.posWithOffset - l.width / 2 - M).attr("y", e.y + 13.5).attr("width", l.width + 2 * M).attr("height", l.height + 2 * M), f === "TB" || f === "BT" ? (d.attr("x", e.x - (l.width + 4 * L + 5)).attr("y", e.y - 12), h.attr("x", e.x - (l.width + 4 * L)).attr("y", e.y + l.height - 12)) : h.attr("x", e.posWithOffset - l.width / 2), E.rotateCommitLabel))
|
|
453
|
+
if (f === "TB" || f === "BT")
|
|
454
|
+
h.attr(
|
|
455
|
+
"transform",
|
|
456
|
+
"rotate(-45, " + e.x + ", " + e.y + ")"
|
|
457
|
+
), d.attr(
|
|
458
|
+
"transform",
|
|
459
|
+
"rotate(-45, " + e.x + ", " + e.y + ")"
|
|
460
|
+
);
|
|
461
|
+
else {
|
|
462
|
+
const o = -7.5 - (l.width + 10) / 25 * 9.5, n = 10 + l.width / 25 * 8.5;
|
|
463
|
+
i.attr(
|
|
464
|
+
"transform",
|
|
465
|
+
"translate(" + o + ", " + n + ") rotate(-45, " + a + ", " + e.y + ")"
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}, "drawCommitLabel"), Ur = /* @__PURE__ */ m((t, r, e, a) => {
|
|
470
|
+
var c;
|
|
471
|
+
if (r.tags.length > 0) {
|
|
472
|
+
let i = 0, d = 0, h = 0;
|
|
473
|
+
const l = [];
|
|
474
|
+
for (const o of r.tags.reverse()) {
|
|
475
|
+
const n = t.insert("polygon"), x = t.append("circle"), $ = t.append("text").attr("y", e.y - 16 - i).attr("class", "tag-label").text(o), y = (c = $.node()) == null ? void 0 : c.getBBox();
|
|
476
|
+
if (!y)
|
|
477
|
+
throw new Error("Tag bbox not found");
|
|
478
|
+
d = Math.max(d, y.width), h = Math.max(h, y.height), $.attr("x", e.posWithOffset - y.width / 2), l.push({
|
|
479
|
+
tag: $,
|
|
480
|
+
hole: x,
|
|
481
|
+
rect: n,
|
|
482
|
+
yOffset: i
|
|
483
|
+
}), i += 20;
|
|
484
|
+
}
|
|
485
|
+
for (const { tag: o, hole: n, rect: x, yOffset: $ } of l) {
|
|
486
|
+
const y = h / 2, p = e.y - 19.2 - $;
|
|
487
|
+
if (x.attr("class", "tag-label-bkg").attr(
|
|
488
|
+
"points",
|
|
489
|
+
`
|
|
490
|
+
${a - d / 2 - L / 2},${p + M}
|
|
491
|
+
${a - d / 2 - L / 2},${p - M}
|
|
492
|
+
${e.posWithOffset - d / 2 - L},${p - y - M}
|
|
493
|
+
${e.posWithOffset + d / 2 + L},${p - y - M}
|
|
494
|
+
${e.posWithOffset + d / 2 + L},${p + y + M}
|
|
495
|
+
${e.posWithOffset - d / 2 - L},${p + y + M}`
|
|
496
|
+
), n.attr("cy", p).attr("cx", a - d / 2 + L / 2).attr("r", 1.5).attr("class", "tag-hole"), f === "TB" || f === "BT") {
|
|
497
|
+
const g = a + $;
|
|
498
|
+
x.attr("class", "tag-label-bkg").attr(
|
|
499
|
+
"points",
|
|
500
|
+
`
|
|
501
|
+
${e.x},${g + 2}
|
|
502
|
+
${e.x},${g - 2}
|
|
503
|
+
${e.x + A},${g - y - 2}
|
|
504
|
+
${e.x + A + d + 4},${g - y - 2}
|
|
505
|
+
${e.x + A + d + 4},${g + y + 2}
|
|
506
|
+
${e.x + A},${g + y + 2}`
|
|
507
|
+
).attr("transform", "translate(12,12) rotate(45, " + e.x + "," + a + ")"), n.attr("cx", e.x + L / 2).attr("cy", g).attr("transform", "translate(12,12) rotate(45, " + e.x + "," + a + ")"), o.attr("x", e.x + 5).attr("y", g + 3).attr("transform", "translate(14,14) rotate(45, " + e.x + "," + a + ")");
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}, "drawCommitTags"), Vr = /* @__PURE__ */ m((t) => {
|
|
512
|
+
switch (t.customType ?? t.type) {
|
|
513
|
+
case u.NORMAL:
|
|
514
|
+
return "commit-normal";
|
|
515
|
+
case u.REVERSE:
|
|
516
|
+
return "commit-reverse";
|
|
517
|
+
case u.HIGHLIGHT:
|
|
518
|
+
return "commit-highlight";
|
|
519
|
+
case u.MERGE:
|
|
520
|
+
return "commit-merge";
|
|
521
|
+
case u.CHERRY_PICK:
|
|
522
|
+
return "commit-cherry-pick";
|
|
523
|
+
default:
|
|
524
|
+
return "commit-normal";
|
|
525
|
+
}
|
|
526
|
+
}, "getCommitClassType"), Qr = /* @__PURE__ */ m((t, r, e, a) => {
|
|
527
|
+
const c = { x: 0, y: 0 };
|
|
528
|
+
if (t.parents.length > 0) {
|
|
529
|
+
const i = Q(t.parents);
|
|
530
|
+
if (i) {
|
|
531
|
+
const d = a.get(i) ?? c;
|
|
532
|
+
return r === "TB" ? d.y + I : r === "BT" ? (a.get(t.id) ?? c).y - I : d.x + I;
|
|
533
|
+
}
|
|
534
|
+
} else
|
|
535
|
+
return r === "TB" ? H : r === "BT" ? (a.get(t.id) ?? c).y - I : 0;
|
|
536
|
+
return 0;
|
|
537
|
+
}, "calculatePosition"), Jr = /* @__PURE__ */ m((t, r, e) => {
|
|
538
|
+
var a, c;
|
|
539
|
+
const i = f === "BT" && e ? r : r + A, d = f === "TB" || f === "BT" ? i : (a = v.get(t.branch)) == null ? void 0 : a.pos, h = f === "TB" || f === "BT" ? (c = v.get(t.branch)) == null ? void 0 : c.pos : i;
|
|
540
|
+
if (h === void 0 || d === void 0)
|
|
541
|
+
throw new Error(`Position were undefined for commit ${t.id}`);
|
|
542
|
+
return { x: h, y: d, posWithOffset: i };
|
|
543
|
+
}, "getCommitPosition"), F = /* @__PURE__ */ m((t, r, e) => {
|
|
544
|
+
if (!E)
|
|
545
|
+
throw new Error("GitGraph config not found");
|
|
546
|
+
const a = t.append("g").attr("class", "commit-bullets"), c = t.append("g").attr("class", "commit-labels");
|
|
547
|
+
let i = f === "TB" || f === "BT" ? H : 0;
|
|
548
|
+
const d = [...r.keys()], h = (E == null ? void 0 : E.parallelCommits) ?? !1, l = /* @__PURE__ */ m((n, x) => {
|
|
549
|
+
var $, y;
|
|
550
|
+
const p = ($ = r.get(n)) == null ? void 0 : $.seq, g = (y = r.get(x)) == null ? void 0 : y.seq;
|
|
551
|
+
return p !== void 0 && g !== void 0 ? p - g : 0;
|
|
552
|
+
}, "sortKeys");
|
|
553
|
+
let o = d.sort(l);
|
|
554
|
+
f === "BT" && (h && Dr(o, r, i), o = o.reverse()), o.forEach((n) => {
|
|
555
|
+
var x;
|
|
556
|
+
const $ = r.get(n);
|
|
557
|
+
if (!$)
|
|
558
|
+
throw new Error(`Commit not found for key ${n}`);
|
|
559
|
+
h && (i = Qr($, f, i, C));
|
|
560
|
+
const y = Jr($, i, h);
|
|
561
|
+
if (e) {
|
|
562
|
+
const p = Vr($), g = $.customType ?? $.type, T = ((x = v.get($.branch)) == null ? void 0 : x.index) ?? 0;
|
|
563
|
+
_r(a, $, y, p, T, g), Yr(c, $, y, i), Ur(c, $, y, i);
|
|
564
|
+
}
|
|
565
|
+
f === "TB" || f === "BT" ? C.set($.id, { x: y.x, y: y.posWithOffset }) : C.set($.id, { x: y.posWithOffset, y: y.y }), i = f === "BT" && h ? i + I : i + I + A, i > R && (R = i);
|
|
566
|
+
});
|
|
567
|
+
}, "drawCommits"), Xr = /* @__PURE__ */ m((t, r, e, a, c) => {
|
|
568
|
+
const i = (f === "TB" || f === "BT" ? e.x < a.x : e.y < a.y) ? r.branch : t.branch, d = /* @__PURE__ */ m((l) => l.branch === i, "isOnBranchToGetCurve"), h = /* @__PURE__ */ m((l) => l.seq > t.seq && l.seq < r.seq, "isBetweenCommits");
|
|
569
|
+
return [...c.values()].some((l) => h(l) && d(l));
|
|
570
|
+
}, "shouldRerouteArrow"), z = /* @__PURE__ */ m((t, r, e = 0) => {
|
|
571
|
+
const a = t + Math.abs(t - r) / 2;
|
|
572
|
+
if (e > 5)
|
|
573
|
+
return a;
|
|
574
|
+
if (N.every((i) => Math.abs(i - a) >= 10))
|
|
575
|
+
return N.push(a), a;
|
|
576
|
+
const c = Math.abs(t - r);
|
|
577
|
+
return z(t, r - c / 5, e + 1);
|
|
578
|
+
}, "findLane"), Zr = /* @__PURE__ */ m((t, r, e, a) => {
|
|
579
|
+
var c, i, d, h, l;
|
|
580
|
+
const o = C.get(r.id), n = C.get(e.id);
|
|
581
|
+
if (o === void 0 || n === void 0)
|
|
582
|
+
throw new Error(`Commit positions not found for commits ${r.id} and ${e.id}`);
|
|
583
|
+
const x = Xr(r, e, o, n, a);
|
|
584
|
+
let $ = "", y = "", p = 0, g = 0, T = (c = v.get(e.branch)) == null ? void 0 : c.index;
|
|
585
|
+
e.type === u.MERGE && r.id !== e.parents[0] && (T = (i = v.get(r.branch)) == null ? void 0 : i.index);
|
|
586
|
+
let b;
|
|
587
|
+
if (x) {
|
|
588
|
+
$ = "A 10 10, 0, 0, 0,", y = "A 10 10, 0, 0, 1,", p = 10, g = 10;
|
|
589
|
+
const P = o.y < n.y ? z(o.y, n.y) : z(n.y, o.y), B = o.x < n.x ? z(o.x, n.x) : z(n.x, o.x);
|
|
590
|
+
f === "TB" ? o.x < n.x ? b = `M ${o.x} ${o.y} L ${B - p} ${o.y} ${y} ${B} ${o.y + g} L ${B} ${n.y - p} ${$} ${B + g} ${n.y} L ${n.x} ${n.y}` : (T = (d = v.get(r.branch)) == null ? void 0 : d.index, b = `M ${o.x} ${o.y} L ${B + p} ${o.y} ${$} ${B} ${o.y + g} L ${B} ${n.y - p} ${y} ${B - g} ${n.y} L ${n.x} ${n.y}`) : f === "BT" ? o.x < n.x ? b = `M ${o.x} ${o.y} L ${B - p} ${o.y} ${$} ${B} ${o.y - g} L ${B} ${n.y + p} ${y} ${B + g} ${n.y} L ${n.x} ${n.y}` : (T = (h = v.get(r.branch)) == null ? void 0 : h.index, b = `M ${o.x} ${o.y} L ${B + p} ${o.y} ${y} ${B} ${o.y - g} L ${B} ${n.y + p} ${$} ${B - g} ${n.y} L ${n.x} ${n.y}`) : o.y < n.y ? b = `M ${o.x} ${o.y} L ${o.x} ${P - p} ${$} ${o.x + g} ${P} L ${n.x - p} ${P} ${y} ${n.x} ${P + g} L ${n.x} ${n.y}` : (T = (l = v.get(r.branch)) == null ? void 0 : l.index, b = `M ${o.x} ${o.y} L ${o.x} ${P + p} ${y} ${o.x + g} ${P} L ${n.x - p} ${P} ${$} ${n.x} ${P - g} L ${n.x} ${n.y}`);
|
|
591
|
+
} else
|
|
592
|
+
$ = "A 20 20, 0, 0, 0,", y = "A 20 20, 0, 0, 1,", p = 20, g = 20, f === "TB" ? (o.x < n.x && (e.type === u.MERGE && r.id !== e.parents[0] ? b = `M ${o.x} ${o.y} L ${o.x} ${n.y - p} ${$} ${o.x + g} ${n.y} L ${n.x} ${n.y}` : b = `M ${o.x} ${o.y} L ${n.x - p} ${o.y} ${y} ${n.x} ${o.y + g} L ${n.x} ${n.y}`), o.x > n.x && ($ = "A 20 20, 0, 0, 0,", y = "A 20 20, 0, 0, 1,", p = 20, g = 20, e.type === u.MERGE && r.id !== e.parents[0] ? b = `M ${o.x} ${o.y} L ${o.x} ${n.y - p} ${y} ${o.x - g} ${n.y} L ${n.x} ${n.y}` : b = `M ${o.x} ${o.y} L ${n.x + p} ${o.y} ${$} ${n.x} ${o.y + g} L ${n.x} ${n.y}`), o.x === n.x && (b = `M ${o.x} ${o.y} L ${n.x} ${n.y}`)) : f === "BT" ? (o.x < n.x && (e.type === u.MERGE && r.id !== e.parents[0] ? b = `M ${o.x} ${o.y} L ${o.x} ${n.y + p} ${y} ${o.x + g} ${n.y} L ${n.x} ${n.y}` : b = `M ${o.x} ${o.y} L ${n.x - p} ${o.y} ${$} ${n.x} ${o.y - g} L ${n.x} ${n.y}`), o.x > n.x && ($ = "A 20 20, 0, 0, 0,", y = "A 20 20, 0, 0, 1,", p = 20, g = 20, e.type === u.MERGE && r.id !== e.parents[0] ? b = `M ${o.x} ${o.y} L ${o.x} ${n.y + p} ${$} ${o.x - g} ${n.y} L ${n.x} ${n.y}` : b = `M ${o.x} ${o.y} L ${n.x - p} ${o.y} ${$} ${n.x} ${o.y - g} L ${n.x} ${n.y}`), o.x === n.x && (b = `M ${o.x} ${o.y} L ${n.x} ${n.y}`)) : (o.y < n.y && (e.type === u.MERGE && r.id !== e.parents[0] ? b = `M ${o.x} ${o.y} L ${n.x - p} ${o.y} ${y} ${n.x} ${o.y + g} L ${n.x} ${n.y}` : b = `M ${o.x} ${o.y} L ${o.x} ${n.y - p} ${$} ${o.x + g} ${n.y} L ${n.x} ${n.y}`), o.y > n.y && (e.type === u.MERGE && r.id !== e.parents[0] ? b = `M ${o.x} ${o.y} L ${n.x - p} ${o.y} ${$} ${n.x} ${o.y - g} L ${n.x} ${n.y}` : b = `M ${o.x} ${o.y} L ${o.x} ${n.y + p} ${y} ${o.x + g} ${n.y} L ${n.x} ${n.y}`), o.y === n.y && (b = `M ${o.x} ${o.y} L ${n.x} ${n.y}`));
|
|
593
|
+
if (b === void 0)
|
|
594
|
+
throw new Error("Line definition not found");
|
|
595
|
+
t.append("path").attr("d", b).attr("class", "arrow arrow" + T % G);
|
|
596
|
+
}, "drawArrow"), rt = /* @__PURE__ */ m((t, r) => {
|
|
597
|
+
const e = t.append("g").attr("class", "commit-arrows");
|
|
598
|
+
[...r.keys()].forEach((a) => {
|
|
599
|
+
const c = r.get(a);
|
|
600
|
+
c.parents && c.parents.length > 0 && c.parents.forEach((i) => {
|
|
601
|
+
Zr(e, r.get(i), c, r);
|
|
602
|
+
});
|
|
603
|
+
});
|
|
604
|
+
}, "drawArrows"), tt = /* @__PURE__ */ m((t, r) => {
|
|
605
|
+
const e = t.append("g");
|
|
606
|
+
r.forEach((a, c) => {
|
|
607
|
+
var i;
|
|
608
|
+
const d = c % G, h = (i = v.get(a.name)) == null ? void 0 : i.pos;
|
|
609
|
+
if (h === void 0)
|
|
610
|
+
throw new Error(`Position not found for branch ${a.name}`);
|
|
611
|
+
const l = e.append("line");
|
|
612
|
+
l.attr("x1", 0), l.attr("y1", h), l.attr("x2", R), l.attr("y2", h), l.attr("class", "branch branch" + d), f === "TB" ? (l.attr("y1", H), l.attr("x1", h), l.attr("y2", R), l.attr("x2", h)) : f === "BT" && (l.attr("y1", R), l.attr("x1", h), l.attr("y2", H), l.attr("x2", h)), N.push(h);
|
|
613
|
+
const o = a.name, n = V(o), x = e.insert("rect"), $ = e.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + d);
|
|
614
|
+
$.node().appendChild(n);
|
|
615
|
+
const y = n.getBBox();
|
|
616
|
+
x.attr("class", "branchLabelBkg label" + d).attr("rx", 4).attr("ry", 4).attr("x", -y.width - 4 - ((E == null ? void 0 : E.rotateCommitLabel) === !0 ? 30 : 0)).attr("y", -y.height / 2 + 8).attr("width", y.width + 18).attr("height", y.height + 4), $.attr(
|
|
617
|
+
"transform",
|
|
618
|
+
"translate(" + (-y.width - 14 - ((E == null ? void 0 : E.rotateCommitLabel) === !0 ? 30 : 0)) + ", " + (h - y.height / 2 - 1) + ")"
|
|
619
|
+
), f === "TB" ? (x.attr("x", h - y.width / 2 - 10).attr("y", 0), $.attr("transform", "translate(" + (h - y.width / 2 - 5) + ", 0)")) : f === "BT" ? (x.attr("x", h - y.width / 2 - 10).attr("y", R), $.attr("transform", "translate(" + (h - y.width / 2 - 5) + ", " + R + ")")) : x.attr("transform", "translate(-19, " + (h - y.height / 2) + ")");
|
|
620
|
+
});
|
|
621
|
+
}, "drawBranches"), et = /* @__PURE__ */ m(function(t, r, e, a, c) {
|
|
622
|
+
return v.set(t, { pos: r, index: e }), r += 50 + (c ? 40 : 0) + (f === "TB" || f === "BT" ? a.width / 2 : 0), r;
|
|
623
|
+
}, "setBranchPosition"), ot = /* @__PURE__ */ m(function(t, r, e, a) {
|
|
624
|
+
if (Nr(), w.debug("in gitgraph renderer", t + `
|
|
625
|
+
`, "id:", r, e), !E)
|
|
626
|
+
throw new Error("GitGraph config not found");
|
|
627
|
+
const c = E.rotateCommitLabel ?? !1, i = a.db;
|
|
628
|
+
q = i.getCommits();
|
|
629
|
+
const d = i.getBranchesAsObjArray();
|
|
630
|
+
f = i.getDirection();
|
|
631
|
+
const h = cr(`[id="${r}"]`);
|
|
632
|
+
let l = 0;
|
|
633
|
+
d.forEach((o, n) => {
|
|
634
|
+
var x;
|
|
635
|
+
const $ = V(o.name), y = h.append("g"), p = y.insert("g").attr("class", "branchLabel"), g = p.insert("g").attr("class", "label branch-label");
|
|
636
|
+
(x = g.node()) == null || x.appendChild($);
|
|
637
|
+
const T = $.getBBox();
|
|
638
|
+
l = et(o.name, l, n, T, c), g.remove(), p.remove(), y.remove();
|
|
639
|
+
}), F(h, q, !1), E.showBranches && tt(h, d), rt(h, q), F(h, q, !0), ir.insertTitle(
|
|
640
|
+
h,
|
|
641
|
+
"gitTitleText",
|
|
642
|
+
E.titleTopMargin ?? 0,
|
|
643
|
+
i.getDiagramTitle()
|
|
644
|
+
), sr(
|
|
645
|
+
void 0,
|
|
646
|
+
h,
|
|
647
|
+
E.diagramPadding,
|
|
648
|
+
E.useMaxWidth
|
|
649
|
+
);
|
|
650
|
+
}, "draw"), nt = {
|
|
651
|
+
draw: ot
|
|
652
|
+
}, at = /* @__PURE__ */ m((t) => `
|
|
653
|
+
.commit-id,
|
|
654
|
+
.commit-msg,
|
|
655
|
+
.branch-label {
|
|
656
|
+
fill: lightgrey;
|
|
657
|
+
color: lightgrey;
|
|
658
|
+
font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
|
659
|
+
font-family: var(--mermaid-font-family);
|
|
660
|
+
}
|
|
661
|
+
${[0, 1, 2, 3, 4, 5, 6, 7].map(
|
|
662
|
+
(r) => `
|
|
663
|
+
.branch-label${r} { fill: ${t["gitBranchLabel" + r]}; }
|
|
664
|
+
.commit${r} { stroke: ${t["git" + r]}; fill: ${t["git" + r]}; }
|
|
665
|
+
.commit-highlight${r} { stroke: ${t["gitInv" + r]}; fill: ${t["gitInv" + r]}; }
|
|
666
|
+
.label${r} { fill: ${t["git" + r]}; }
|
|
667
|
+
.arrow${r} { stroke: ${t["git" + r]}; }
|
|
668
|
+
`
|
|
669
|
+
).join(`
|
|
670
|
+
`)}
|
|
671
|
+
|
|
672
|
+
.branch {
|
|
673
|
+
stroke-width: 1;
|
|
674
|
+
stroke: ${t.lineColor};
|
|
675
|
+
stroke-dasharray: 2;
|
|
676
|
+
}
|
|
677
|
+
.commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};}
|
|
678
|
+
.commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; }
|
|
679
|
+
.tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}
|
|
680
|
+
.tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; }
|
|
681
|
+
.tag-hole { fill: ${t.textColor}; }
|
|
682
|
+
|
|
683
|
+
.commit-merge {
|
|
684
|
+
stroke: ${t.primaryColor};
|
|
685
|
+
fill: ${t.primaryColor};
|
|
686
|
+
}
|
|
687
|
+
.commit-reverse {
|
|
688
|
+
stroke: ${t.primaryColor};
|
|
689
|
+
fill: ${t.primaryColor};
|
|
690
|
+
stroke-width: 3;
|
|
691
|
+
}
|
|
692
|
+
.commit-highlight-outer {
|
|
693
|
+
}
|
|
694
|
+
.commit-highlight-inner {
|
|
695
|
+
stroke: ${t.primaryColor};
|
|
696
|
+
fill: ${t.primaryColor};
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
.arrow { stroke-width: 8; stroke-linecap: round; fill: none}
|
|
700
|
+
.gitTitleText {
|
|
701
|
+
text-anchor: middle;
|
|
702
|
+
font-size: 18px;
|
|
703
|
+
fill: ${t.textColor};
|
|
704
|
+
}
|
|
705
|
+
`, "getStyles"), ct = at, $t = {
|
|
706
|
+
parser: Hr,
|
|
707
|
+
db: U,
|
|
708
|
+
renderer: nt,
|
|
709
|
+
styles: ct
|
|
710
|
+
};
|
|
711
|
+
export {
|
|
712
|
+
$t as diagram
|
|
713
|
+
};
|