hexagon-editor 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +24 -11
  2. package/dist/MarkdownEditor.vue.d.ts +28 -26
  3. package/dist/MarkdownEditor.vue.d.ts.map +1 -1
  4. package/dist/{MarkdownEditorLinkForm-C7CGgA83.js → MarkdownEditorLinkForm-B9dEX3WT.js} +1 -1
  5. package/dist/{base-Bnv2-Te4.js → base-BPdMUtQo.js} +141 -137
  6. package/dist/components/MarkdownEditorToolbar.vue.d.ts +4 -3
  7. package/dist/components/MarkdownEditorToolbar.vue.d.ts.map +1 -1
  8. package/dist/configure.d.ts +0 -2
  9. package/dist/configure.d.ts.map +1 -1
  10. package/dist/configure.js +11 -12
  11. package/dist/core/basic-editor-markdown.d.ts.map +1 -1
  12. package/dist/core/basic-editor-renderers.d.ts +6 -4
  13. package/dist/core/basic-editor-renderers.d.ts.map +1 -1
  14. package/dist/core/basic-editor-types.d.ts +2 -0
  15. package/dist/core/basic-editor-types.d.ts.map +1 -1
  16. package/dist/core/basic-editor.d.ts +1 -1
  17. package/dist/core/basic-editor.d.ts.map +1 -1
  18. package/dist/core/index.d.ts +0 -2
  19. package/dist/core/index.d.ts.map +1 -1
  20. package/dist/core.js +28 -31
  21. package/dist/extensions.js +1 -1
  22. package/dist/forms/MarkdownEditorImageForm.vue.d.ts +2 -2
  23. package/dist/forms/MarkdownEditorImageForm.vue.d.ts.map +1 -1
  24. package/dist/forms/MarkdownEditorLinkForm.vue.d.ts +2 -2
  25. package/dist/forms/MarkdownEditorTextInput.vue.d.ts +2 -2
  26. package/dist/forms/MarkdownEditorTextInput.vue.d.ts.map +1 -1
  27. package/dist/forms.js +1 -1
  28. package/dist/{full-C-o2lPBX.js → full-Da8esvj2.js} +1 -1
  29. package/dist/{full-specs-Cl-ODShc.js → full-specs-hXKoMF-0.js} +1 -1
  30. package/dist/index-D_CMntQU.js +3173 -0
  31. package/dist/index.css +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +3611 -1283
  35. package/dist/{markup-commands-B2NMfYHE.js → markup-commands-BYsx8ADT.js} +1989 -1963
  36. package/dist/presets.js +2 -2
  37. package/dist/public-types.d.ts +22 -0
  38. package/dist/public-types.d.ts.map +1 -1
  39. package/dist/renderer/MarkdownRenderer.vue.d.ts +2 -0
  40. package/dist/renderer/MarkdownRenderer.vue.d.ts.map +1 -1
  41. package/dist/renderer/markdown.d.ts +2 -1
  42. package/dist/renderer/markdown.d.ts.map +1 -1
  43. package/dist/renderer.css +1 -1
  44. package/dist/renderer.js +142 -146
  45. package/package.json +106 -108
  46. package/dist/MarkdownEditorLinkForm.css +0 -1
  47. package/dist/abnfDiagram-N423BO3Z-DCf6sPky.js +0 -87
  48. package/dist/arc-y6UeoJpJ.js +0 -83
  49. package/dist/architectureDiagram-T3A2C74G-Cc3_3-cI.js +0 -4778
  50. package/dist/base.css +0 -1
  51. package/dist/blockDiagram-VBNYF7ZC-DWVLZwXY.js +0 -2419
  52. package/dist/c4Diagram-5PPSVZJV-CaIN7qay.js +0 -1577
  53. package/dist/channel-BwXGcavV.js +0 -5
  54. package/dist/chunk-2GRJ4B5K-O75udjPr.js +0 -68
  55. package/dist/chunk-2Q5K7J3B-CySL0lOA.js +0 -15
  56. package/dist/chunk-5RXB4S5H-BKPnLCOJ.js +0 -1408
  57. package/dist/chunk-5VM5RSS4--it1VJIv.js +0 -19
  58. package/dist/chunk-6Q2QTUOP-DNiML-50.js +0 -664
  59. package/dist/chunk-GF5L2VYU-z7A-k0-V.js +0 -1533
  60. package/dist/chunk-JWPE2WC7-DAjx3Kjr.js +0 -8
  61. package/dist/chunk-KBJHAD2P-D4R1VW0r.js +0 -19
  62. package/dist/chunk-RYQCIY6F-DmJAYxq8.js +0 -313
  63. package/dist/chunk-XXDRQBXY-CK913N-t.js +0 -8
  64. package/dist/classDiagram-JCYQIIEL-Djipq_HJ.js +0 -16
  65. package/dist/classDiagram-v2-OCEON4UE-Djipq_HJ.js +0 -16
  66. package/dist/core/optional-renderers.d.ts +0 -9
  67. package/dist/core/optional-renderers.d.ts.map +0 -1
  68. package/dist/cose-bilkent-JH36ORCC-CXuKFbXy.js +0 -2608
  69. package/dist/cynefin-VYW2F7L2-Bkk-F_Js.js +0 -23766
  70. package/dist/cynefinDiagram-MW4NZA55-DwOK40hm.js +0 -299
  71. package/dist/cytoscape.esm-3W4EOjxC.js +0 -18756
  72. package/dist/dagre-VZM6K2ZE-0VsGm8Ag.js +0 -340
  73. package/dist/defaultLocale-BgPVtth8.js +0 -171
  74. package/dist/diagram-7IWD3JNH-BrApu1hz.js +0 -350
  75. package/dist/diagram-B4RE2ZJO-CVXoBg2r.js +0 -461
  76. package/dist/diagram-LBJQPF4R-Dp0eSz2L.js +0 -142
  77. package/dist/diagram-Q27KOJAE-DWIltqIH.js +0 -528
  78. package/dist/diagram-UB23O5K3-B7z2Lj3K.js +0 -219
  79. package/dist/ebnfDiagram-BXEA7PRR-CYgE6z_2.js +0 -109
  80. package/dist/erDiagram-JOGREHBK-D3QWrPo-.js +0 -910
  81. package/dist/flowDiagram-UKHOOZJN-CfjPcHNW.js +0 -1638
  82. package/dist/ganttDiagram-PKOTCBZU-ECmaWI-9.js +0 -2711
  83. package/dist/gitGraphDiagram-DS77QQ5N-DgG1RGJ8.js +0 -815
  84. package/dist/graph-DAHC4kPm.js +0 -1545
  85. package/dist/infoDiagram-6WML65LV-B1Yl3nZV.js +0 -24
  86. package/dist/init-DjUOC4st.js +0 -16
  87. package/dist/ishikawaDiagram-WSZJBQD7-4sngaB5o.js +0 -621
  88. package/dist/journeyDiagram-NVQOT4AX-B_6AmR_j.js +0 -834
  89. package/dist/kanban-definition-27J2QSJJ-B8BO9o8J.js +0 -724
  90. package/dist/katex-ByXcxnHy.js +0 -14436
  91. package/dist/katex-DoRnZ_sp.js +0 -11682
  92. package/dist/layout-DBbo_M5I.js +0 -1519
  93. package/dist/linear-BEdRfKba.js +0 -259
  94. package/dist/map-DRdzG8Ho.js +0 -224
  95. package/dist/markup-commands.css +0 -1
  96. package/dist/mermaid.core-CR0bA2Wa.js +0 -16496
  97. package/dist/mindmap-definition-FAOFIHXS-DnPz807N.js +0 -827
  98. package/dist/optional-renderers-BalvqqvY.js +0 -11
  99. package/dist/ordinal-B6-f3MAq.js +0 -61
  100. package/dist/pegDiagram-VL7TDLO6-csGWlzs8.js +0 -95
  101. package/dist/pieDiagram-7S7Q4E2Y-Bqs8j5FX.js +0 -207
  102. package/dist/quadrantDiagram-CIZ2JOQS-jzP4lRrY.js +0 -1023
  103. package/dist/railroadDiagram-AXF67PYL-BSCyR24u.js +0 -77
  104. package/dist/renderer/mermaid-runtime.d.ts +0 -4
  105. package/dist/renderer/mermaid-runtime.d.ts.map +0 -1
  106. package/dist/requirementDiagram-LRYGKXZP-DmEkLYqX.js +0 -882
  107. package/dist/sankeyDiagram-W5VNT64P-CYvRYMTh.js +0 -847
  108. package/dist/sequenceDiagram-SI44F4Z6-CyWbDtPA.js +0 -2888
  109. package/dist/sizeCapture-X5ZJPWSS-xKhYCY84.js +0 -46
  110. package/dist/stateDiagram-OKZ733FA-DP44R2Dd.js +0 -263
  111. package/dist/stateDiagram-v2-UEYNNEHI-BvlOisND.js +0 -16
  112. package/dist/swimlanes-SLNWSIFB-BKFp8twH.js +0 -5332
  113. package/dist/swimlanesDiagram-ULZ7WXOC-CTvIFuHq.js +0 -13
  114. package/dist/timeline-definition-Z64GVDOM-B4137uIl.js +0 -1055
  115. package/dist/vennDiagram-T6HMQDX7-CPs8gXjx.js +0 -1578
  116. package/dist/wardleyDiagram-T6FBY63Y-BYp13hbI.js +0 -675
  117. package/dist/xychartDiagram-ELKLHX3M-DTT37K2u.js +0 -1388
@@ -1,815 +0,0 @@
1
- import { I as le } from "./chunk-2Q5K7J3B-CySL0lOA.js";
2
- import { p as he } from "./chunk-JWPE2WC7-DAjx3Kjr.js";
3
- import { o as $e, n as fe, s as ge, g as ue, a as ye, b as xe, _ as h, y as J, l as w, d as me, c as q, x as pe, z as be, p as we, k as B, A as ke, B as ve, C as Ce } from "./mermaid.core-CR0bA2Wa.js";
4
- import { p as Ee } from "./cynefin-VYW2F7L2-Bkk-F_Js.js";
5
- var m = {
6
- NORMAL: 0,
7
- REVERSE: 1,
8
- HIGHLIGHT: 2,
9
- MERGE: 3,
10
- CHERRY_PICK: 4
11
- }, Be = ve.gitGraph, S = /* @__PURE__ */ h(() => ke({
12
- ...Be,
13
- ...J().gitGraph
14
- }), "getConfig"), d = new le(() => {
15
- const e = S(), r = e.mainBranchName, t = e.mainBranchOrder;
16
- return {
17
- mainBranchName: r,
18
- commits: /* @__PURE__ */ new Map(),
19
- head: null,
20
- branchConfig: /* @__PURE__ */ new Map([[r, { name: r, order: t }]]),
21
- branches: /* @__PURE__ */ new Map([[r, null]]),
22
- currBranch: r,
23
- direction: "LR",
24
- seq: 0,
25
- options: {}
26
- };
27
- });
28
- function Y() {
29
- return Ce({ length: 7 });
30
- }
31
- h(Y, "getID");
32
- function te(e, r) {
33
- const t = /* @__PURE__ */ Object.create(null);
34
- return e.reduce((s, o) => {
35
- const i = r(o);
36
- return t[i] || (t[i] = !0, s.push(o)), s;
37
- }, []);
38
- }
39
- h(te, "uniqBy");
40
- var Te = /* @__PURE__ */ h(function(e) {
41
- d.records.direction = e;
42
- }, "setDirection"), Le = /* @__PURE__ */ h(function(e) {
43
- w.debug("options str", e), e = e?.trim(), e = e || "{}";
44
- try {
45
- d.records.options = JSON.parse(e);
46
- } catch (r) {
47
- w.error("error while parsing gitGraph options", r.message);
48
- }
49
- }, "setOptions"), Me = /* @__PURE__ */ h(function() {
50
- return d.records.options;
51
- }, "getOptions"), Re = /* @__PURE__ */ h(function(e) {
52
- let r = e.msg, t = e.id;
53
- const s = e.type;
54
- let o = e.tags;
55
- w.info("commit", r, t, s, o), w.debug("Entering commit:", r, t, s, o);
56
- const i = S();
57
- t = B.sanitizeText(t, i), r = B.sanitizeText(r, i), o = o?.map((a) => B.sanitizeText(a, i));
58
- const n = {
59
- id: t || d.records.seq + "-" + Y(),
60
- message: r,
61
- seq: d.records.seq++,
62
- type: s ?? m.NORMAL,
63
- tags: o ?? [],
64
- parents: d.records.head == null ? [] : [d.records.head.id],
65
- branch: d.records.currBranch
66
- };
67
- d.records.head = n, w.info("main branch", i.mainBranchName), d.records.commits.has(n.id) && w.warn(`Commit ID ${n.id} already exists`), d.records.commits.set(n.id, n), d.records.branches.set(d.records.currBranch, n.id), w.debug("in pushCommit " + n.id);
68
- }, "commit"), Ie = /* @__PURE__ */ h(function(e) {
69
- let r = e.name;
70
- const t = e.order;
71
- if (r = B.sanitizeText(r, S()), d.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
- d.records.branches.set(r, d.records.head != null ? d.records.head.id : null), d.records.branchConfig.set(r, { name: r, order: t }), ae(r), w.debug("in createBranch");
76
- }, "branch"), Oe = /* @__PURE__ */ h((e) => {
77
- let r = e.branch, t = e.id;
78
- const s = e.type, o = e.tags, i = S();
79
- r = B.sanitizeText(r, i), t && (t = B.sanitizeText(t, i));
80
- const n = d.records.branches.get(d.records.currBranch), a = d.records.branches.get(r), l = n ? d.records.commits.get(n) : void 0, f = a ? d.records.commits.get(a) : void 0;
81
- if (l && f && l.branch === r)
82
- throw new Error(`Cannot merge branch '${r}' into itself.`);
83
- if (d.records.currBranch === r) {
84
- const c = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
85
- throw c.hash = {
86
- text: `merge ${r}`,
87
- token: `merge ${r}`,
88
- expected: ["branch abc"]
89
- }, c;
90
- }
91
- if (l === void 0 || !l) {
92
- const c = new Error(
93
- `Incorrect usage of "merge". Current branch (${d.records.currBranch})has no commits`
94
- );
95
- throw c.hash = {
96
- text: `merge ${r}`,
97
- token: `merge ${r}`,
98
- expected: ["commit"]
99
- }, c;
100
- }
101
- if (!d.records.branches.has(r)) {
102
- const c = new Error(
103
- 'Incorrect usage of "merge". Branch to be merged (' + r + ") does not exist"
104
- );
105
- throw c.hash = {
106
- text: `merge ${r}`,
107
- token: `merge ${r}`,
108
- expected: [`branch ${r}`]
109
- }, c;
110
- }
111
- if (f === void 0 || !f) {
112
- const c = new Error(
113
- 'Incorrect usage of "merge". Branch to be merged (' + r + ") has no commits"
114
- );
115
- throw c.hash = {
116
- text: `merge ${r}`,
117
- token: `merge ${r}`,
118
- expected: ['"commit"']
119
- }, c;
120
- }
121
- if (l === f) {
122
- const c = new Error('Incorrect usage of "merge". Both branches have same head');
123
- throw c.hash = {
124
- text: `merge ${r}`,
125
- token: `merge ${r}`,
126
- expected: ["branch abc"]
127
- }, c;
128
- }
129
- if (t && d.records.commits.has(t)) {
130
- const c = new Error(
131
- 'Incorrect usage of "merge". Commit with id:' + t + " already exists, use different custom id"
132
- );
133
- throw c.hash = {
134
- text: `merge ${r} ${t} ${s} ${o?.join(" ")}`,
135
- token: `merge ${r} ${t} ${s} ${o?.join(" ")}`,
136
- expected: [
137
- `merge ${r} ${t}_UNIQUE ${s} ${o?.join(" ")}`
138
- ]
139
- }, c;
140
- }
141
- const g = a || "", $ = {
142
- id: t || `${d.records.seq}-${Y()}`,
143
- message: `merged branch ${r} into ${d.records.currBranch}`,
144
- seq: d.records.seq++,
145
- parents: d.records.head == null ? [] : [d.records.head.id, g],
146
- branch: d.records.currBranch,
147
- type: m.MERGE,
148
- customType: s,
149
- customId: !!t,
150
- tags: o ?? []
151
- };
152
- d.records.head = $, d.records.commits.set($.id, $), d.records.branches.set(d.records.currBranch, $.id), w.debug(d.records.branches), w.debug("in mergeBranch");
153
- }, "merge"), _e = /* @__PURE__ */ h(function(e) {
154
- let r = e.id, t = e.targetId, s = e.tags, o = e.parent;
155
- w.debug("Entering cherryPick:", r, t, s);
156
- const i = S();
157
- if (r = B.sanitizeText(r, i), t = B.sanitizeText(t, i), s = s?.map((l) => B.sanitizeText(l, i)), o = B.sanitizeText(o, i), !r || !d.records.commits.has(r)) {
158
- const l = new Error(
159
- 'Incorrect usage of "cherryPick". Source commit id should exist and provided'
160
- );
161
- throw l.hash = {
162
- text: `cherryPick ${r} ${t}`,
163
- token: `cherryPick ${r} ${t}`,
164
- expected: ["cherry-pick abc"]
165
- }, l;
166
- }
167
- const n = d.records.commits.get(r);
168
- if (n === void 0 || !n)
169
- throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
170
- if (o && !(Array.isArray(n.parents) && n.parents.includes(o)))
171
- throw new Error(
172
- "Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit."
173
- );
174
- const a = n.branch;
175
- if (n.type === m.MERGE && !o)
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 (!t || !d.records.commits.has(t)) {
180
- if (a === d.records.currBranch) {
181
- const $ = new Error(
182
- 'Incorrect usage of "cherryPick". Source commit is already on current branch'
183
- );
184
- throw $.hash = {
185
- text: `cherryPick ${r} ${t}`,
186
- token: `cherryPick ${r} ${t}`,
187
- expected: ["cherry-pick abc"]
188
- }, $;
189
- }
190
- const l = d.records.branches.get(d.records.currBranch);
191
- if (l === void 0 || !l) {
192
- const $ = new Error(
193
- `Incorrect usage of "cherry-pick". Current branch (${d.records.currBranch})has no commits`
194
- );
195
- throw $.hash = {
196
- text: `cherryPick ${r} ${t}`,
197
- token: `cherryPick ${r} ${t}`,
198
- expected: ["cherry-pick abc"]
199
- }, $;
200
- }
201
- const f = d.records.commits.get(l);
202
- if (f === void 0 || !f) {
203
- const $ = new Error(
204
- `Incorrect usage of "cherry-pick". Current branch (${d.records.currBranch})has no commits`
205
- );
206
- throw $.hash = {
207
- text: `cherryPick ${r} ${t}`,
208
- token: `cherryPick ${r} ${t}`,
209
- expected: ["cherry-pick abc"]
210
- }, $;
211
- }
212
- const g = {
213
- id: d.records.seq + "-" + Y(),
214
- message: `cherry-picked ${n?.message} into ${d.records.currBranch}`,
215
- seq: d.records.seq++,
216
- parents: d.records.head == null ? [] : [d.records.head.id, n.id],
217
- branch: d.records.currBranch,
218
- type: m.CHERRY_PICK,
219
- tags: s ? s.filter(Boolean) : [
220
- `cherry-pick:${n.id}${n.type === m.MERGE ? `|parent:${o}` : ""}`
221
- ]
222
- };
223
- d.records.head = g, d.records.commits.set(g.id, g), d.records.branches.set(d.records.currBranch, g.id), w.debug(d.records.branches), w.debug("in cherryPick");
224
- }
225
- }, "cherryPick"), ae = /* @__PURE__ */ h(function(e) {
226
- if (e = B.sanitizeText(e, S()), d.records.branches.has(e)) {
227
- d.records.currBranch = e;
228
- const r = d.records.branches.get(d.records.currBranch);
229
- r === void 0 || !r ? d.records.head = null : d.records.head = d.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 ${e}")`
233
- );
234
- throw r.hash = {
235
- text: `checkout ${e}`,
236
- token: `checkout ${e}`,
237
- expected: [`branch ${e}`]
238
- }, r;
239
- }
240
- }, "checkout");
241
- function V(e, r, t) {
242
- const s = e.indexOf(r);
243
- s === -1 ? e.push(t) : e.splice(s, 1, t);
244
- }
245
- h(V, "upsert");
246
- function Q(e) {
247
- const r = e.reduce((o, i) => o.seq > i.seq ? o : i, e[0]);
248
- let t = "";
249
- e.forEach(function(o) {
250
- o === r ? t += " *" : t += " |";
251
- });
252
- const s = [t, r.id, r.seq];
253
- for (const o in d.records.branches)
254
- d.records.branches.get(o) === r.id && s.push(o);
255
- if (w.debug(s.join(" ")), r.parents && r.parents.length == 2 && r.parents[0] && r.parents[1]) {
256
- const o = d.records.commits.get(r.parents[0]);
257
- V(e, r, o), r.parents[1] && e.push(d.records.commits.get(r.parents[1]));
258
- } else {
259
- if (r.parents.length == 0)
260
- return;
261
- if (r.parents[0]) {
262
- const o = d.records.commits.get(r.parents[0]);
263
- V(e, r, o);
264
- }
265
- }
266
- e = te(e, (o) => o.id), Q(e);
267
- }
268
- h(Q, "prettyPrintCommitHistory");
269
- var Ge = /* @__PURE__ */ h(function() {
270
- w.debug(d.records.commits);
271
- const e = ne()[0];
272
- Q([e]);
273
- }, "prettyPrint"), He = /* @__PURE__ */ h(function() {
274
- d.reset(), we();
275
- }, "clear"), Se = /* @__PURE__ */ h(function() {
276
- return [...d.records.branchConfig.values()].map((r, t) => r.order !== null && r.order !== void 0 ? r : {
277
- ...r,
278
- order: parseFloat(`0.${t}`)
279
- }).sort((r, t) => (r.order ?? 0) - (t.order ?? 0)).map(({ name: r }) => ({ name: r }));
280
- }, "getBranchesAsObjArray"), Ae = /* @__PURE__ */ h(function() {
281
- return d.records.branches;
282
- }, "getBranches"), De = /* @__PURE__ */ h(function() {
283
- return d.records.commits;
284
- }, "getCommits"), ne = /* @__PURE__ */ h(function() {
285
- const e = [...d.records.commits.values()];
286
- return e.forEach(function(r) {
287
- w.debug(r.id);
288
- }), e.sort((r, t) => r.seq - t.seq), e;
289
- }, "getCommitsArray"), Pe = /* @__PURE__ */ h(function() {
290
- return d.records.currBranch;
291
- }, "getCurrentBranch"), We = /* @__PURE__ */ h(function() {
292
- return d.records.direction;
293
- }, "getDirection"), qe = /* @__PURE__ */ h(function() {
294
- return d.records.head;
295
- }, "getHead"), se = {
296
- commitType: m,
297
- getConfig: S,
298
- setDirection: Te,
299
- setOptions: Le,
300
- getOptions: Me,
301
- commit: Re,
302
- branch: Ie,
303
- merge: Oe,
304
- cherryPick: _e,
305
- checkout: ae,
306
- //reset,
307
- prettyPrint: Ge,
308
- clear: He,
309
- getBranchesAsObjArray: Se,
310
- getBranches: Ae,
311
- getCommits: De,
312
- getCommitsArray: ne,
313
- getCurrentBranch: Pe,
314
- getDirection: We,
315
- getHead: qe,
316
- setAccTitle: xe,
317
- getAccTitle: ye,
318
- getAccDescription: ue,
319
- setAccDescription: ge,
320
- setDiagramTitle: fe,
321
- getDiagramTitle: $e
322
- }, Ne = /* @__PURE__ */ h((e, r) => {
323
- he(e, r), e.dir && r.setDirection(e.dir);
324
- for (const t of e.statements)
325
- Fe(t, r);
326
- }, "populate"), Fe = /* @__PURE__ */ h((e, r) => {
327
- const s = {
328
- Commit: /* @__PURE__ */ h((o) => r.commit(ze(o)), "Commit"),
329
- Branch: /* @__PURE__ */ h((o) => r.branch(Ye(o)), "Branch"),
330
- Merge: /* @__PURE__ */ h((o) => r.merge(je(o)), "Merge"),
331
- Checkout: /* @__PURE__ */ h((o) => r.checkout(Ue(o)), "Checkout"),
332
- CherryPicking: /* @__PURE__ */ h((o) => r.cherryPick(Ke(o)), "CherryPicking")
333
- }[e.$type];
334
- s ? s(e) : w.error(`Unknown statement type: ${e.$type}`);
335
- }, "parseStatement"), ze = /* @__PURE__ */ h((e) => ({
336
- id: e.id,
337
- msg: e.message ?? "",
338
- type: e.type !== void 0 ? m[e.type] : m.NORMAL,
339
- tags: e.tags ?? void 0
340
- }), "parseCommit"), Ye = /* @__PURE__ */ h((e) => ({
341
- name: e.name,
342
- order: e.order ?? 0
343
- }), "parseBranch"), je = /* @__PURE__ */ h((e) => ({
344
- branch: e.branch,
345
- id: e.id ?? "",
346
- type: e.type !== void 0 ? m[e.type] : void 0,
347
- tags: e.tags ?? void 0
348
- }), "parseMerge"), Ue = /* @__PURE__ */ h((e) => e.branch, "parseCheckout"), Ke = /* @__PURE__ */ h((e) => ({
349
- id: e.id,
350
- targetId: "",
351
- tags: e.tags?.length === 0 ? void 0 : e.tags,
352
- parent: e.parent
353
- }), "parseCherryPicking"), Ve = {
354
- parse: /* @__PURE__ */ h(async (e) => {
355
- const r = await Ee("gitGraph", e);
356
- w.debug(r), Ne(r, se);
357
- }, "parse")
358
- }, O = 10, _ = 40, L = 4, R = 2, G = 8, j = /* @__PURE__ */ new Set(["redux", "redux-dark", "redux-color", "redux-dark-color"]), X = 12, Z = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]), Xe = /* @__PURE__ */ new Set(["dark", "redux-dark", "redux-dark-color", "neo-dark"]), H = /* @__PURE__ */ h((e, r, t = !1) => t && e > 0 ? (e - 1) % (r - 1) + 1 : e % r, "calcColorIndex"), C = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), F = 30, P = /* @__PURE__ */ new Map(), z = [], I = 0, y = "LR", Je = /* @__PURE__ */ h(() => {
359
- C.clear(), E.clear(), P.clear(), I = 0, z = [], y = "LR";
360
- }, "clear"), oe = /* @__PURE__ */ h((e) => {
361
- const r = document.createElementNS("http://www.w3.org/2000/svg", "text");
362
- return (typeof e == "string" ? e.split(/\\n|\n|<br\s*\/?>/gi) : e).forEach((s) => {
363
- const o = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
364
- o.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), o.setAttribute("dy", "1em"), o.setAttribute("x", "0"), o.setAttribute("class", "row"), o.textContent = s.trim(), r.appendChild(o);
365
- }), r;
366
- }, "drawText"), ce = /* @__PURE__ */ h((e) => {
367
- let r, t, s;
368
- return y === "BT" ? (t = /* @__PURE__ */ h((o, i) => o <= i, "comparisonFunc"), s = 1 / 0) : (t = /* @__PURE__ */ h((o, i) => o >= i, "comparisonFunc"), s = 0), e.forEach((o) => {
369
- const i = y === "TB" || y == "BT" ? E.get(o)?.y : E.get(o)?.x;
370
- i !== void 0 && t(i, s) && (r = o, s = i);
371
- }), r;
372
- }, "findClosestParent"), Qe = /* @__PURE__ */ h((e) => {
373
- let r = "", t = 1 / 0;
374
- return e.forEach((s) => {
375
- const o = E.get(s).y;
376
- o <= t && (r = s, t = o);
377
- }), r || void 0;
378
- }, "findClosestParentBT"), Ze = /* @__PURE__ */ h((e, r, t) => {
379
- let s = t, o = t;
380
- const i = [];
381
- e.forEach((n) => {
382
- const a = r.get(n);
383
- if (!a)
384
- throw new Error(`Commit not found for key ${n}`);
385
- a.parents.length ? (s = rr(a), o = Math.max(s, o)) : i.push(a), tr(a, s);
386
- }), s = o, i.forEach((n) => {
387
- ar(n, s, t);
388
- }), e.forEach((n) => {
389
- const a = r.get(n);
390
- if (a?.parents.length) {
391
- const l = Qe(a.parents);
392
- s = E.get(l).y - _, s <= o && (o = s);
393
- const f = C.get(a.branch).pos, g = s - O;
394
- E.set(a.id, { x: f, y: g });
395
- }
396
- });
397
- }, "setParallelBTPos"), er = /* @__PURE__ */ h((e) => {
398
- const r = ce(e.parents.filter((s) => s !== null));
399
- if (!r)
400
- throw new Error(`Closest parent not found for commit ${e.id}`);
401
- const t = E.get(r)?.y;
402
- if (t === void 0)
403
- throw new Error(`Closest parent position not found for commit ${e.id}`);
404
- return t;
405
- }, "findClosestParentPos"), rr = /* @__PURE__ */ h((e) => er(e) + _, "calculateCommitPosition"), tr = /* @__PURE__ */ h((e, r) => {
406
- const t = C.get(e.branch);
407
- if (!t)
408
- throw new Error(`Branch not found for commit ${e.id}`);
409
- const s = t.pos, o = r + O;
410
- return E.set(e.id, { x: s, y: o }), { x: s, y: o };
411
- }, "setCommitPosition"), ar = /* @__PURE__ */ h((e, r, t) => {
412
- const s = C.get(e.branch);
413
- if (!s)
414
- throw new Error(`Branch not found for commit ${e.id}`);
415
- const o = r + t, i = s.pos;
416
- E.set(e.id, { x: i, y: o });
417
- }, "setRootPosition"), nr = /* @__PURE__ */ h((e, r, t, s, o, i) => {
418
- const { theme: n } = q(), a = j.has(n ?? ""), l = Z.has(n ?? ""), f = Xe.has(n ?? "");
419
- if (i === m.HIGHLIGHT)
420
- e.append("rect").attr("x", t.x - 10 + (a ? 3 : 0)).attr("y", t.y - 10 + (a ? 3 : 0)).attr("width", a ? 14 : 20).attr("height", a ? 14 : 20).attr(
421
- "class",
422
- `commit ${r.id} commit-highlight${H(o, G, l)} ${s}-outer`
423
- ), e.append("rect").attr("x", t.x - 6 + (a ? 2 : 0)).attr("y", t.y - 6 + (a ? 2 : 0)).attr("width", a ? 8 : 12).attr("height", a ? 8 : 12).attr(
424
- "class",
425
- `commit ${r.id} commit${H(o, G, l)} ${s}-inner`
426
- );
427
- else if (i === m.CHERRY_PICK)
428
- e.append("circle").attr("cx", t.x).attr("cy", t.y).attr("r", a ? 7 : 10).attr("class", `commit ${r.id} ${s}`), e.append("circle").attr("cx", t.x - 3).attr("cy", t.y + 2).attr("r", a ? 2.5 : 2.75).attr("fill", f ? "#000000" : "#fff").attr("class", `commit ${r.id} ${s}`), e.append("circle").attr("cx", t.x + 3).attr("cy", t.y + 2).attr("r", a ? 2.5 : 2.75).attr("fill", f ? "#000000" : "#fff").attr("class", `commit ${r.id} ${s}`), e.append("line").attr("x1", t.x + 3).attr("y1", t.y + 1).attr("x2", t.x).attr("y2", t.y - 5).attr("stroke", f ? "#000000" : "#fff").attr("class", `commit ${r.id} ${s}`), e.append("line").attr("x1", t.x - 3).attr("y1", t.y + 1).attr("x2", t.x).attr("y2", t.y - 5).attr("stroke", f ? "#000000" : "#fff").attr("class", `commit ${r.id} ${s}`);
429
- else {
430
- const g = e.append("circle");
431
- if (g.attr("cx", t.x), g.attr("cy", t.y), g.attr("r", a ? 7 : 10), g.attr(
432
- "class",
433
- `commit ${r.id} commit${H(o, G, l)}`
434
- ), i === m.MERGE) {
435
- const $ = e.append("circle");
436
- $.attr("cx", t.x), $.attr("cy", t.y), $.attr("r", a ? 5 : 6), $.attr(
437
- "class",
438
- `commit ${s} ${r.id} commit${H(o, G, l)}`
439
- );
440
- }
441
- if (i === m.REVERSE) {
442
- const $ = e.append("path"), c = a ? 4 : 5;
443
- $.attr(
444
- "d",
445
- `M ${t.x - c},${t.y - c}L${t.x + c},${t.y + c}M${t.x - c},${t.y + c}L${t.x + c},${t.y - c}`
446
- ).attr(
447
- "class",
448
- `commit ${s} ${r.id} commit${H(o, G, l)}`
449
- );
450
- }
451
- }
452
- }, "drawCommitBullet"), sr = /* @__PURE__ */ h((e, r, t, s, o) => {
453
- if (r.type !== m.CHERRY_PICK && (r.customId && r.type === m.MERGE || r.type !== m.MERGE) && o.showCommitLabel) {
454
- const i = e.append("g"), n = i.insert("rect").attr("class", "commit-label-bkg"), a = i.append("text").attr("x", s).attr("y", t.y + 25).attr("class", "commit-label").text(r.id), l = a.node()?.getBBox();
455
- if (l && (n.attr("x", t.posWithOffset - l.width / 2 - R).attr("y", t.y + 13.5).attr("width", l.width + 2 * R).attr("height", l.height + 2 * R), y === "TB" || y === "BT" ? (n.attr("x", t.x - (l.width + 4 * L + 5)).attr("y", t.y - 12), a.attr("x", t.x - (l.width + 4 * L)).attr("y", t.y + l.height - 12)) : a.attr("x", t.posWithOffset - l.width / 2), o.rotateCommitLabel))
456
- if (y === "TB" || y === "BT")
457
- a.attr(
458
- "transform",
459
- "rotate(-45, " + t.x + ", " + t.y + ")"
460
- ), n.attr(
461
- "transform",
462
- "rotate(-45, " + t.x + ", " + t.y + ")"
463
- );
464
- else {
465
- const f = -7.5 - (l.width + 10) / 25 * 9.5, g = 10 + l.width / 25 * 8.5;
466
- i.attr(
467
- "transform",
468
- "translate(" + f + ", " + g + ") rotate(-45, " + s + ", " + t.y + ")"
469
- );
470
- }
471
- }
472
- }, "drawCommitLabel"), or = /* @__PURE__ */ h((e, r, t, s) => {
473
- if (r.tags.length > 0) {
474
- let o = 0, i = 0, n = 0;
475
- const a = [];
476
- for (const l of r.tags.reverse()) {
477
- const f = e.insert("polygon"), g = e.append("circle"), $ = e.append("text").attr("y", t.y - 16 - o).attr("class", "tag-label").text(l), c = $.node()?.getBBox();
478
- if (!c)
479
- throw new Error("Tag bbox not found");
480
- i = Math.max(i, c.width), n = Math.max(n, c.height), $.attr("x", t.posWithOffset - c.width / 2), a.push({
481
- tag: $,
482
- hole: g,
483
- rect: f,
484
- yOffset: o
485
- }), o += 20;
486
- }
487
- for (const { tag: l, hole: f, rect: g, yOffset: $ } of a) {
488
- const c = n / 2, x = t.y - 19.2 - $;
489
- if (g.attr("class", "tag-label-bkg").attr(
490
- "points",
491
- `
492
- ${s - i / 2 - L / 2},${x + R}
493
- ${s - i / 2 - L / 2},${x - R}
494
- ${t.posWithOffset - i / 2 - L},${x - c - R}
495
- ${t.posWithOffset + i / 2 + L},${x - c - R}
496
- ${t.posWithOffset + i / 2 + L},${x + c + R}
497
- ${t.posWithOffset - i / 2 - L},${x + c + R}`
498
- ), f.attr("cy", x).attr("cx", s - i / 2 + L / 2).attr("r", 1.5).attr("class", "tag-hole"), y === "TB" || y === "BT") {
499
- const u = s + $;
500
- g.attr("class", "tag-label-bkg").attr(
501
- "points",
502
- `
503
- ${t.x},${u + 2}
504
- ${t.x},${u - 2}
505
- ${t.x + O},${u - c - 2}
506
- ${t.x + O + i + 4},${u - c - 2}
507
- ${t.x + O + i + 4},${u + c + 2}
508
- ${t.x + O},${u + c + 2}`
509
- ).attr("transform", "translate(12,12) rotate(45, " + t.x + "," + s + ")"), f.attr("cx", t.x + L / 2).attr("cy", u).attr("transform", "translate(12,12) rotate(45, " + t.x + "," + s + ")"), l.attr("x", t.x + 5).attr("y", u + 3).attr("transform", "translate(14,14) rotate(45, " + t.x + "," + s + ")");
510
- }
511
- }
512
- }
513
- }, "drawCommitTags"), cr = /* @__PURE__ */ h((e) => {
514
- switch (e.customType ?? e.type) {
515
- case m.NORMAL:
516
- return "commit-normal";
517
- case m.REVERSE:
518
- return "commit-reverse";
519
- case m.HIGHLIGHT:
520
- return "commit-highlight";
521
- case m.MERGE:
522
- return "commit-merge";
523
- case m.CHERRY_PICK:
524
- return "commit-cherry-pick";
525
- default:
526
- return "commit-normal";
527
- }
528
- }, "getCommitClassType"), ir = /* @__PURE__ */ h((e, r, t, s) => {
529
- const o = { x: 0, y: 0 };
530
- if (e.parents.length > 0) {
531
- const i = ce(e.parents);
532
- if (i) {
533
- const n = s.get(i) ?? o;
534
- return r === "TB" ? n.y + _ : r === "BT" ? (s.get(e.id) ?? o).y - _ : n.x + _;
535
- }
536
- } else
537
- return r === "TB" ? F : r === "BT" ? (s.get(e.id) ?? o).y - _ : 0;
538
- return 0;
539
- }, "calculatePosition"), dr = /* @__PURE__ */ h((e, r, t) => {
540
- const s = y === "BT" && t ? r : r + O, o = C.get(e.branch)?.pos, i = y === "TB" || y === "BT" ? C.get(e.branch)?.pos : s;
541
- if (i === void 0 || o === void 0)
542
- throw new Error(`Position were undefined for commit ${e.id}`);
543
- const n = j.has(q().theme ?? ""), a = y === "TB" || y === "BT" ? s : o + (n ? X / 2 + 1 : -2);
544
- return { x: i, y: a, posWithOffset: s };
545
- }, "getCommitPosition"), re = /* @__PURE__ */ h((e, r, t, s) => {
546
- const o = e.append("g").attr("class", "commit-bullets"), i = e.append("g").attr("class", "commit-labels");
547
- let n = y === "TB" || y === "BT" ? F : 0;
548
- const a = [...r.keys()], l = s.parallelCommits ?? !1, f = /* @__PURE__ */ h(($, c) => {
549
- const x = r.get($)?.seq, u = r.get(c)?.seq;
550
- return x !== void 0 && u !== void 0 ? x - u : 0;
551
- }, "sortKeys");
552
- let g = a.sort(f);
553
- y === "BT" && (l && Ze(g, r, n), g = g.reverse()), g.forEach(($) => {
554
- const c = r.get($);
555
- if (!c)
556
- throw new Error(`Commit not found for key ${$}`);
557
- l && (n = ir(c, y, n, E));
558
- const x = dr(c, n, l);
559
- if (t) {
560
- const u = cr(c), p = c.customType ?? c.type, b = C.get(c.branch)?.index ?? 0;
561
- nr(o, c, x, u, b, p), sr(i, c, x, n, s), or(i, c, x, n);
562
- }
563
- y === "TB" || y === "BT" ? E.set(c.id, { x: x.x, y: x.posWithOffset }) : E.set(c.id, { x: x.posWithOffset, y: x.y }), n = y === "BT" && l ? n + _ : n + _ + O, n > I && (I = n);
564
- });
565
- }, "drawCommits"), lr = /* @__PURE__ */ h((e, r, t, s, o) => {
566
- const n = (y === "TB" || y === "BT" ? t.x < s.x : t.y < s.y) ? r.branch : e.branch, a = /* @__PURE__ */ h((f) => f.branch === n, "isOnBranchToGetCurve"), l = /* @__PURE__ */ h((f) => f.seq > e.seq && f.seq < r.seq, "isBetweenCommits");
567
- return [...o.values()].some((f) => l(f) && a(f));
568
- }, "shouldRerouteArrow"), W = /* @__PURE__ */ h((e, r, t = 0) => {
569
- const s = e + Math.abs(e - r) / 2;
570
- if (t > 5)
571
- return s;
572
- if (z.every((n) => Math.abs(n - s) >= 10))
573
- return z.push(s), s;
574
- const i = Math.abs(e - r);
575
- return W(e, r - i / 5, t + 1);
576
- }, "findLane"), hr = /* @__PURE__ */ h((e, r, t, s) => {
577
- const { theme: o } = q(), i = Z.has(o ?? ""), n = E.get(r.id), a = E.get(t.id);
578
- if (n === void 0 || a === void 0)
579
- throw new Error(`Commit positions not found for commits ${r.id} and ${t.id}`);
580
- const l = lr(r, t, n, a, s);
581
- let f = "", g = "", $ = 0, c = 0, x = C.get(t.branch)?.index;
582
- t.type === m.MERGE && r.id !== t.parents[0] && (x = C.get(r.branch)?.index);
583
- let u;
584
- if (l) {
585
- f = "A 10 10, 0, 0, 0,", g = "A 10 10, 0, 0, 1,", $ = 10, c = 10;
586
- const p = n.y < a.y ? W(n.y, a.y) : W(a.y, n.y), b = n.x < a.x ? W(n.x, a.x) : W(a.x, n.x);
587
- y === "TB" ? n.x < a.x ? u = `M ${n.x} ${n.y} L ${b - $} ${n.y} ${g} ${b} ${n.y + c} L ${b} ${a.y - $} ${f} ${b + c} ${a.y} L ${a.x} ${a.y}` : (x = C.get(r.branch)?.index, u = `M ${n.x} ${n.y} L ${b + $} ${n.y} ${f} ${b} ${n.y + c} L ${b} ${a.y - $} ${g} ${b - c} ${a.y} L ${a.x} ${a.y}`) : y === "BT" ? n.x < a.x ? u = `M ${n.x} ${n.y} L ${b - $} ${n.y} ${f} ${b} ${n.y - c} L ${b} ${a.y + $} ${g} ${b + c} ${a.y} L ${a.x} ${a.y}` : (x = C.get(r.branch)?.index, u = `M ${n.x} ${n.y} L ${b + $} ${n.y} ${g} ${b} ${n.y - c} L ${b} ${a.y + $} ${f} ${b - c} ${a.y} L ${a.x} ${a.y}`) : n.y < a.y ? u = `M ${n.x} ${n.y} L ${n.x} ${p - $} ${f} ${n.x + c} ${p} L ${a.x - $} ${p} ${g} ${a.x} ${p + c} L ${a.x} ${a.y}` : (x = C.get(r.branch)?.index, u = `M ${n.x} ${n.y} L ${n.x} ${p + $} ${g} ${n.x + c} ${p} L ${a.x - $} ${p} ${f} ${a.x} ${p - c} L ${a.x} ${a.y}`);
588
- } else
589
- f = "A 20 20, 0, 0, 0,", g = "A 20 20, 0, 0, 1,", $ = 20, c = 20, y === "TB" ? (n.x < a.x && (t.type === m.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${n.x} ${a.y - $} ${f} ${n.x + c} ${a.y} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${a.x - $} ${n.y} ${g} ${a.x} ${n.y + c} L ${a.x} ${a.y}`), n.x > a.x && (f = "A 20 20, 0, 0, 0,", g = "A 20 20, 0, 0, 1,", $ = 20, c = 20, t.type === m.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${n.x} ${a.y - $} ${g} ${n.x - c} ${a.y} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${a.x + $} ${n.y} ${f} ${a.x} ${n.y + c} L ${a.x} ${a.y}`), n.x === a.x && (u = `M ${n.x} ${n.y} L ${a.x} ${a.y}`)) : y === "BT" ? (n.x < a.x && (t.type === m.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${n.x} ${a.y + $} ${g} ${n.x + c} ${a.y} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${a.x - $} ${n.y} ${f} ${a.x} ${n.y - c} L ${a.x} ${a.y}`), n.x > a.x && (f = "A 20 20, 0, 0, 0,", g = "A 20 20, 0, 0, 1,", $ = 20, c = 20, t.type === m.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${n.x} ${a.y + $} ${f} ${n.x - c} ${a.y} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${a.x + $} ${n.y} ${g} ${a.x} ${n.y - c} L ${a.x} ${a.y}`), n.x === a.x && (u = `M ${n.x} ${n.y} L ${a.x} ${a.y}`)) : (n.y < a.y && (t.type === m.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${a.x - $} ${n.y} ${g} ${a.x} ${n.y + c} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${n.x} ${a.y - $} ${f} ${n.x + c} ${a.y} L ${a.x} ${a.y}`), n.y > a.y && (t.type === m.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${a.x - $} ${n.y} ${f} ${a.x} ${n.y - c} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${n.x} ${a.y + $} ${g} ${n.x + c} ${a.y} L ${a.x} ${a.y}`), n.y === a.y && (u = `M ${n.x} ${n.y} L ${a.x} ${a.y}`));
590
- if (u === void 0)
591
- throw new Error("Line definition not found");
592
- e.append("path").attr("d", u).attr(
593
- "class",
594
- "arrow arrow" + H(x, G, i)
595
- );
596
- }, "drawArrow"), $r = /* @__PURE__ */ h((e, r) => {
597
- const t = e.append("g").attr("class", "commit-arrows");
598
- [...r.keys()].forEach((s) => {
599
- const o = r.get(s);
600
- o.parents && o.parents.length > 0 && o.parents.forEach((i) => {
601
- hr(t, r.get(i), o, r);
602
- });
603
- });
604
- }, "drawArrows"), fr = /* @__PURE__ */ h((e, r, t, s) => {
605
- const { look: o, theme: i, themeVariables: n } = q(), { dropShadow: a, THEME_COLOR_LIMIT: l } = n, f = j.has(i ?? ""), g = Z.has(i ?? ""), $ = e.append("g");
606
- r.forEach((c, x) => {
607
- const u = H(
608
- x,
609
- f ? l : G,
610
- g
611
- ), p = C.get(c.name)?.pos;
612
- if (p === void 0)
613
- throw new Error(`Position not found for branch ${c.name}`);
614
- const b = y === "TB" || y === "BT" ? p : f ? p + X / 2 + 1 : p - 2, k = $.append("line");
615
- k.attr("x1", 0), k.attr("y1", b), k.attr("x2", I), k.attr("y2", b), k.attr("class", "branch branch" + u), y === "TB" ? (k.attr("y1", F), k.attr("x1", p), k.attr("y2", I), k.attr("x2", p)) : y === "BT" && (k.attr("y1", I), k.attr("x1", p), k.attr("y2", F), k.attr("x2", p)), z.push(b);
616
- const U = c.name, D = oe(U), T = $.insert("rect"), M = $.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + u);
617
- M.node().appendChild(D);
618
- const v = D.getBBox(), ee = f ? 0 : 4, N = f ? 16 : 0, A = f ? X : 0;
619
- o === "neo" && T.attr("data-look", "neo"), T.attr("class", "branchLabelBkg label" + u).attr(
620
- "style",
621
- o === "neo" ? `filter:${f ? `url(#${s}-drop-shadow)` : a}` : ""
622
- ).attr("rx", ee).attr("ry", ee).attr("x", -v.width - 4 - (t.rotateCommitLabel === !0 ? 30 : 0)).attr("y", -v.height / 2 + 10).attr("width", v.width + 18 + N).attr("height", v.height + 4 + A), M.attr(
623
- "transform",
624
- "translate(" + (-v.width - 14 - (t.rotateCommitLabel === !0 ? 30 : 0) + N / 2) + ", " + (b - v.height / 2 - 2) + ")"
625
- ), y === "TB" ? (T.attr("x", p - v.width / 2 - 10).attr("y", 0), M.attr("transform", "translate(" + (p - v.width / 2 - 5) + ", 0)"), f && (T.attr("transform", `translate(${-N / 2 - 3}, ${-A - 10})`), M.attr(
626
- "transform",
627
- "translate(" + (p - v.width / 2 - 5) + ", " + (-A * 2 + 7) + ")"
628
- ))) : y === "BT" ? (T.attr("x", p - v.width / 2 - 10).attr("y", I), M.attr("transform", "translate(" + (p - v.width / 2 - 5) + ", " + I + ")"), f && (T.attr("transform", `translate(${-N / 2 - 3}, ${A + 10})`), M.attr(
629
- "transform",
630
- "translate(" + (p - v.width / 2 - 5) + ", " + (I + A * 2 + 4) + ")"
631
- ))) : T.attr("transform", "translate(-19, " + (b - 12 - A / 2) + ")");
632
- });
633
- }, "drawBranches"), gr = /* @__PURE__ */ h(function(e, r, t, s, o) {
634
- return C.set(e, { pos: r, index: t }), r += 50 + (o ? 40 : 0) + (y === "TB" || y === "BT" ? s.width / 2 : 0), r;
635
- }, "setBranchPosition"), ur = /* @__PURE__ */ h(function(e, r, t, s) {
636
- Je(), w.debug("in gitgraph renderer", e + `
637
- `, "id:", r, t);
638
- const o = s.db;
639
- if (!o.getConfig) {
640
- w.error("getConfig method is not available on db");
641
- return;
642
- }
643
- const i = o.getConfig(), n = i.rotateCommitLabel ?? !1;
644
- P = o.getCommits();
645
- const a = o.getBranchesAsObjArray();
646
- y = o.getDirection();
647
- const l = me(`[id="${r}"]`), { look: f, theme: g, themeVariables: $ } = q(), { useGradient: c, gradientStart: x, gradientStop: u, filterColor: p } = $;
648
- if (c) {
649
- const k = l.append("defs").append("linearGradient").attr("id", r + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
650
- k.append("stop").attr("offset", "0%").attr("stop-color", x).attr("stop-opacity", 1), k.append("stop").attr("offset", "100%").attr("stop-color", u).attr("stop-opacity", 1);
651
- }
652
- f === "neo" && j.has(g ?? "") && l.append("defs").append("filter").attr("id", r + "-drop-shadow").attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", p);
653
- let b = 0;
654
- a.forEach((k, U) => {
655
- const D = oe(k.name), T = l.append("g"), K = T.insert("g").attr("class", "branchLabel"), M = K.insert("g").attr("class", "label branch-label");
656
- M.node()?.appendChild(D);
657
- const v = D.getBBox();
658
- b = gr(k.name, b, U, v, n), M.remove(), K.remove(), T.remove();
659
- }), re(l, P, !1, i), i.showBranches && fr(l, a, i, r), $r(l, P), re(l, P, !0, i), pe.insertTitle(
660
- l,
661
- "gitTitleText",
662
- i.titleTopMargin ?? 0,
663
- o.getDiagramTitle()
664
- ), be(void 0, l, i.diagramPadding, i.useMaxWidth);
665
- }, "draw"), yr = {
666
- draw: ur
667
- }, ie = 8, de = /* @__PURE__ */ new Set(["redux", "redux-dark", "redux-color", "redux-dark-color"]), xr = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]), mr = /* @__PURE__ */ new Set(["neo", "neo-dark"]), pr = /* @__PURE__ */ new Set(["dark", "redux-dark", "redux-dark-color", "neo-dark"]), br = /* @__PURE__ */ new Set([
668
- "redux",
669
- "redux-dark",
670
- "redux-color",
671
- "redux-dark-color",
672
- "neo",
673
- "neo-dark"
674
- ]), wr = /* @__PURE__ */ h((e) => {
675
- const { svgId: r } = e;
676
- let t = "";
677
- if (e.useGradient && r)
678
- for (let s = 0; s < e.THEME_COLOR_LIMIT; s++)
679
- t += `
680
- .label${s} { fill: ${e.mainBkg}; stroke: url(${r}-gradient); stroke-width: ${e.strokeWidth};}
681
- `;
682
- return t;
683
- }, "genGitGraphGradient"), kr = /* @__PURE__ */ h((e) => {
684
- const r = J(), { theme: t, themeVariables: s } = r, { borderColorArray: o } = s, i = de.has(t);
685
- if (mr.has(t)) {
686
- let n = "";
687
- for (let a = 0; a < e.THEME_COLOR_LIMIT; a++)
688
- if (a === 0)
689
- n += `
690
- .branch-label${a} { fill: ${e.nodeBorder};}
691
- .commit${a} { stroke: ${e.nodeBorder}; }
692
- .commit-highlight${a} { stroke: ${e.nodeBorder}; fill: ${e.nodeBorder}; }
693
- .arrow${a} { stroke: ${e.nodeBorder}; }
694
- .commit-bullets { fill: ${e.nodeBorder}; }
695
- .commit-cherry-pick${a} { stroke: ${e.nodeBorder}; }
696
- ${wr(e)}`;
697
- else {
698
- const l = a % ie;
699
- n += `
700
- .branch-label${a} { fill: ${e["gitBranchLabel" + l]}; }
701
- .commit${a} { stroke: ${e["git" + l]}; fill: ${e["git" + l]}; }
702
- .commit-highlight${a} { stroke: ${e["gitInv" + l]}; fill: ${e["gitInv" + l]}; }
703
- .arrow${a} { stroke: ${e["git" + l]}; }
704
- `;
705
- }
706
- return n;
707
- } else if (xr.has(t)) {
708
- let n = "";
709
- for (let a = 0; a < e.THEME_COLOR_LIMIT; a++)
710
- if (a === 0)
711
- n += `
712
- .branch-label${a} { fill: ${e.nodeBorder}; ${i ? `font-weight:${e.noteFontWeight}` : ""} }
713
- .commit${a} { stroke: ${e.nodeBorder}; }
714
- .commit-highlight${a} { stroke: ${e.nodeBorder}; fill: ${e.mainBkg}; }
715
- .label${a} { fill: ${e.mainBkg}; stroke: ${e.nodeBorder}; stroke-width: ${e.strokeWidth}; ${i ? `font-weight:${e.noteFontWeight}` : ""} }
716
- .arrow${a} { stroke: ${e.nodeBorder}; }
717
- .commit-bullets { fill: ${e.nodeBorder}; }
718
- `;
719
- else {
720
- const l = a % o.length;
721
- n += `
722
- .branch-label${a} { fill: ${e.nodeBorder}; ${i ? `font-weight:${e.noteFontWeight}` : ""} }
723
- .commit${a} { stroke: ${o[l]}; fill: ${o[l]}; }
724
- .commit-highlight${a} { stroke: ${o[l]}; fill: ${o[l]}; }
725
- .label${a} { fill: ${pr.has(t) ? e.mainBkg : o[l]}; stroke: ${o[l]}; stroke-width: ${e.strokeWidth}; }
726
- .arrow${a} { stroke: ${o[l]}; }
727
- `;
728
- }
729
- return n;
730
- } else {
731
- let n = "";
732
- for (let a = 0; a < e.THEME_COLOR_LIMIT; a++)
733
- n += `
734
- .branch-label${a} { fill: ${e.nodeBorder}; ${i ? `font-weight:${e.noteFontWeight}` : ""} }
735
- .commit${a} { stroke: ${e.nodeBorder}; }
736
- .commit-highlight${a} { stroke: ${e.nodeBorder}; fill: ${e.nodeBorder}; }
737
- .label${a} { fill: ${e.mainBkg}; stroke: ${e.nodeBorder}; stroke-width: ${e.strokeWidth}; ${i ? `font-weight:${e.noteFontWeight}` : ""}}
738
- .arrow${a} { stroke: ${e.nodeBorder}; }
739
- .commit-bullets { fill: ${e.nodeBorder}; }
740
- .commit-cherry-pick${a} { stroke: ${e.nodeBorder}; }
741
- `;
742
- return n;
743
- }
744
- }, "genColor"), vr = /* @__PURE__ */ h((e) => `${Array.from({ length: e.THEME_COLOR_LIMIT }, (r, t) => t).map((r) => {
745
- const t = r % ie;
746
- return `
747
- .branch-label${r} { fill: ${e["gitBranchLabel" + t]}; }
748
- .commit${r} { stroke: ${e["git" + t]}; fill: ${e["git" + t]}; }
749
- .commit-highlight${r} { stroke: ${e["gitInv" + t]}; fill: ${e["gitInv" + t]}; }
750
- .label${r} { fill: ${e["git" + t]}; }
751
- .arrow${r} { stroke: ${e["git" + t]}; }
752
- `;
753
- }).join(`
754
- `)}`, "normalTheme"), Cr = /* @__PURE__ */ h((e) => {
755
- const r = J(), { theme: t } = r, s = br.has(t);
756
- return `
757
- .commit-id,
758
- .commit-msg,
759
- .branch-label {
760
- fill: lightgrey;
761
- color: lightgrey;
762
- font-family: 'trebuchet ms', verdana, arial, sans-serif;
763
- font-family: var(--mermaid-font-family);
764
- }
765
-
766
- ${s ? kr(e) : vr(e)}
767
-
768
- .branch {
769
- stroke-width: ${e.strokeWidth};
770
- stroke: ${e.commitLineColor ?? e.lineColor};
771
- stroke-dasharray: ${s ? "4 2" : "2"};
772
- }
773
- .commit-label { font-size: ${e.commitLabelFontSize}; fill: ${s ? e.nodeBorder : e.commitLabelColor}; ${s ? `font-weight:${e.noteFontWeight};` : ""}}
774
- .commit-label-bkg { font-size: ${e.commitLabelFontSize}; fill: ${s ? "transparent" : e.commitLabelBackground}; opacity: ${s ? "" : 0.5}; }
775
- .tag-label { font-size: ${e.tagLabelFontSize}; fill: ${e.tagLabelColor};}
776
- .tag-label-bkg { fill: ${s ? e.mainBkg : e.tagLabelBackground}; stroke: ${s ? e.nodeBorder : e.tagLabelBorder}; ${s ? `filter:${e.dropShadow}` : ""} }
777
- .tag-hole { fill: ${e.textColor}; }
778
-
779
- .commit-merge {
780
- stroke: ${s ? e.mainBkg : e.primaryColor};
781
- fill: ${s ? e.mainBkg : e.primaryColor};
782
- }
783
- .commit-reverse {
784
- stroke: ${s ? e.mainBkg : e.primaryColor};
785
- fill: ${s ? e.mainBkg : e.primaryColor};
786
- stroke-width: ${s ? e.strokeWidth : 3};
787
- }
788
- .commit-highlight-outer {
789
- }
790
- .commit-highlight-inner {
791
- stroke: ${s ? e.mainBkg : e.primaryColor};
792
- fill: ${s ? e.mainBkg : e.primaryColor};
793
- }
794
-
795
- .arrow {
796
- /* Intentional: neo themes keep the bold 8px arrow (like classic themes); only redux-geometry themes use the thinner options.strokeWidth. */
797
- stroke-width: ${de.has(t) ? e.strokeWidth : 8};
798
- stroke-linecap: round;
799
- fill: none
800
- }
801
- .gitTitleText {
802
- text-anchor: middle;
803
- font-size: 18px;
804
- fill: ${e.textColor};
805
- }
806
- `;
807
- }, "getStyles"), Er = Cr, Rr = {
808
- parser: Ve,
809
- db: se,
810
- renderer: yr,
811
- styles: Er
812
- };
813
- export {
814
- Rr as diagram
815
- };