@wandox/sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +59 -0
  2. package/dist/arc-BJMRTG9S.cjs +1 -0
  3. package/dist/arc-Vdco0qfw.js +83 -0
  4. package/dist/architectureDiagram-3BPJPVTR-BjEqcvey.js +4695 -0
  5. package/dist/architectureDiagram-3BPJPVTR-BvjJfAkh.cjs +36 -0
  6. package/dist/blockDiagram-GPEHLZMM-B1xf7RE9.js +2427 -0
  7. package/dist/blockDiagram-GPEHLZMM-B5VqovGY.cjs +132 -0
  8. package/dist/c4Diagram-AAUBKEIU-C4kjMRea.js +1578 -0
  9. package/dist/c4Diagram-AAUBKEIU-Ck5uEnJI.cjs +10 -0
  10. package/dist/channel-DlRtLuYv.js +5 -0
  11. package/dist/channel-Dm_yrRYJ.cjs +1 -0
  12. package/dist/chunk-2J33WTMH-CG2n_n4y.cjs +1 -0
  13. package/dist/chunk-2J33WTMH-CWvmGb4H.js +20 -0
  14. package/dist/chunk-4BX2VUAB-Bq3GzsD8.js +9 -0
  15. package/dist/chunk-4BX2VUAB-CdMctZeT.cjs +1 -0
  16. package/dist/chunk-55IACEB6-BdJhzL0d.js +8 -0
  17. package/dist/chunk-55IACEB6-sHyHtvg8.cjs +1 -0
  18. package/dist/chunk-727SXJPM-D-Vmam30.cjs +206 -0
  19. package/dist/chunk-727SXJPM-DmruCqjM.js +1529 -0
  20. package/dist/chunk-AQP2D5EJ-CWhKjcV3.cjs +231 -0
  21. package/dist/chunk-AQP2D5EJ-Ca0ak6w7.js +1399 -0
  22. package/dist/chunk-FMBD7UC4-CqV0NWQQ.js +19 -0
  23. package/dist/chunk-FMBD7UC4-DOxtd0OO.cjs +15 -0
  24. package/dist/chunk-ND2GUHAM-6EMX5Mu8.js +68 -0
  25. package/dist/chunk-ND2GUHAM-BXeDBtSC.cjs +1 -0
  26. package/dist/chunk-QZHKN3VN-B7FSI55w.js +15 -0
  27. package/dist/chunk-QZHKN3VN-CbbdNKnD.cjs +1 -0
  28. package/dist/classDiagram-4FO5ZUOK-0Kaf7WfA.js +16 -0
  29. package/dist/classDiagram-4FO5ZUOK-C4it2xBI.cjs +1 -0
  30. package/dist/classDiagram-v2-Q7XG4LA2-Byom5adL.js +16 -0
  31. package/dist/classDiagram-v2-Q7XG4LA2-C4it2xBI.cjs +1 -0
  32. package/dist/cose-bilkent-S5V4N54A-CuUv9oIm.js +2606 -0
  33. package/dist/cose-bilkent-S5V4N54A-Dh6nTopA.cjs +1 -0
  34. package/dist/cytoscape.esm-Cp8cXbK2.js +18729 -0
  35. package/dist/cytoscape.esm-fcqEUasK.cjs +331 -0
  36. package/dist/dagre-BM42HDAG-CwxJjZ2n.cjs +4 -0
  37. package/dist/dagre-BM42HDAG-DMBidMxP.js +448 -0
  38. package/dist/defaultLocale-BDVPUiG2.js +171 -0
  39. package/dist/defaultLocale-k2G_58r6.cjs +1 -0
  40. package/dist/diagram-2AECGRRQ-B2a4nXgJ.js +221 -0
  41. package/dist/diagram-2AECGRRQ-r7De7taS.cjs +43 -0
  42. package/dist/diagram-5GNKFQAL-CDiO79WC.cjs +10 -0
  43. package/dist/diagram-5GNKFQAL-DrHBNZzF.js +123 -0
  44. package/dist/diagram-KO2AKTUF-BcjWCXZr.js +466 -0
  45. package/dist/diagram-KO2AKTUF-CDlJCxVO.cjs +3 -0
  46. package/dist/diagram-LMA3HP47-BXFSAyNV.cjs +24 -0
  47. package/dist/diagram-LMA3HP47-DJxmyqn0.js +143 -0
  48. package/dist/diagram-OG6HWLK6-ATK__ca8.js +531 -0
  49. package/dist/diagram-OG6HWLK6-CgIyEO8_.cjs +24 -0
  50. package/dist/erDiagram-TEJ5UH35-D4baWNzQ.js +900 -0
  51. package/dist/erDiagram-TEJ5UH35-Dyuc5EB6.cjs +85 -0
  52. package/dist/flowDiagram-I6XJVG4X-BMZOncyU.js +1635 -0
  53. package/dist/flowDiagram-I6XJVG4X-C45fICr4.cjs +162 -0
  54. package/dist/ganttDiagram-6RSMTGT7-CiYZmmke.js +2526 -0
  55. package/dist/ganttDiagram-6RSMTGT7-Cxoj6IK8.cjs +292 -0
  56. package/dist/gitGraphDiagram-PVQCEYII-CQ9bNuwN.js +828 -0
  57. package/dist/gitGraphDiagram-PVQCEYII-rlaY9dfj.cjs +106 -0
  58. package/dist/graph-CBizzZ7K.js +1545 -0
  59. package/dist/graph-V5BNIbHU.cjs +1 -0
  60. package/dist/index-jBRold1l.js +173159 -0
  61. package/dist/index-sFrjovbM.cjs +804 -0
  62. package/dist/index.d.ts +54 -0
  63. package/dist/infoDiagram-5YYISTIA-CAzYIvUX.js +24 -0
  64. package/dist/infoDiagram-5YYISTIA-zX5rQglQ.cjs +2 -0
  65. package/dist/init-CHZsXQcr.cjs +1 -0
  66. package/dist/init-DjUOC4st.js +16 -0
  67. package/dist/ishikawaDiagram-YF4QCWOH-09prKBsn.cjs +70 -0
  68. package/dist/ishikawaDiagram-YF4QCWOH-Co8BnN24.js +622 -0
  69. package/dist/journeyDiagram-JHISSGLW-DkdWRF_-.cjs +139 -0
  70. package/dist/journeyDiagram-JHISSGLW-riCLiMCC.js +836 -0
  71. package/dist/kanban-definition-UN3LZRKU-DWipOCsx.cjs +89 -0
  72. package/dist/kanban-definition-UN3LZRKU-SRyCSn2H.js +725 -0
  73. package/dist/katex-Cf_UVKIT.cjs +257 -0
  74. package/dist/katex-RNjvZ8pg.js +11681 -0
  75. package/dist/layout-CbksXFOD.js +1728 -0
  76. package/dist/layout-Dh52gsIJ.cjs +1 -0
  77. package/dist/linear-C3xSMJV8.cjs +1 -0
  78. package/dist/linear-CmUCzX9U.js +259 -0
  79. package/dist/mermaid.core-BzNKr-OJ.cjs +308 -0
  80. package/dist/mermaid.core-CdBIz6FY.js +15475 -0
  81. package/dist/mindmap-definition-RKZ34NQL-Cs63oyIX.cjs +96 -0
  82. package/dist/mindmap-definition-RKZ34NQL-Gcma5iTd.js +830 -0
  83. package/dist/ordinal-CagbB1m8.cjs +1 -0
  84. package/dist/ordinal-DfAQgscy.js +61 -0
  85. package/dist/pieDiagram-4H26LBE5-CBGkD8dp.cjs +30 -0
  86. package/dist/pieDiagram-4H26LBE5-DSL8cVK1.js +164 -0
  87. package/dist/quadrantDiagram-W4KKPZXB-D3nCWRjF.cjs +7 -0
  88. package/dist/quadrantDiagram-W4KKPZXB-uod6bhUy.js +1026 -0
  89. package/dist/requirementDiagram-4Y6WPE33-Bc_6y7SM.js +884 -0
  90. package/dist/requirementDiagram-4Y6WPE33-D2mHlh5i.cjs +84 -0
  91. package/dist/sankeyDiagram-5OEKKPKP-DL_kXejW.cjs +40 -0
  92. package/dist/sankeyDiagram-5OEKKPKP-DMsjY4G4.js +847 -0
  93. package/dist/sequenceDiagram-3UESZ5HK-CBGalGOV.cjs +162 -0
  94. package/dist/sequenceDiagram-3UESZ5HK-CH2Z-Pis.js +2901 -0
  95. package/dist/stateDiagram-AJRCARHV-gEqlAI6t.js +263 -0
  96. package/dist/stateDiagram-AJRCARHV-rNMrAI-A.cjs +1 -0
  97. package/dist/stateDiagram-v2-BHNVJYJU-CDj7L1wi.js +16 -0
  98. package/dist/stateDiagram-v2-BHNVJYJU-LLlFJ1GM.cjs +1 -0
  99. package/dist/timeline-definition-PNZ67QCA-Bbuv3uu-.cjs +120 -0
  100. package/dist/timeline-definition-PNZ67QCA-DrGFbQdC.js +1068 -0
  101. package/dist/types.d.ts +295 -0
  102. package/dist/vennDiagram-CIIHVFJN-CGcAwVxU.js +1564 -0
  103. package/dist/vennDiagram-CIIHVFJN-DsSjXluJ.cjs +34 -0
  104. package/dist/wandox.cjs +1 -0
  105. package/dist/wandox.css +1 -0
  106. package/dist/wandox.js +6 -0
  107. package/dist/wandox.umd.js +4172 -0
  108. package/dist/wardley-L42UT6IY-DUnkyH_z.js +22539 -0
  109. package/dist/wardley-L42UT6IY-tDp0NbFW.cjs +165 -0
  110. package/dist/wardleyDiagram-YWT4CUSO-CB_Qa4lR.js +684 -0
  111. package/dist/wardleyDiagram-YWT4CUSO-D0BUmvVW.cjs +78 -0
  112. package/dist/xychartDiagram-2RQKCTM6-Bcq-ACuw.js +1342 -0
  113. package/dist/xychartDiagram-2RQKCTM6-BjeAPKLo.cjs +7 -0
  114. package/package.json +42 -0
@@ -0,0 +1,828 @@
1
+ import { p as he } from "./chunk-4BX2VUAB-Bq3GzsD8.js";
2
+ import { I as $e } from "./chunk-QZHKN3VN-B7FSI55w.js";
3
+ import { a3 as fe, b2 as ge, a$ as ue, $ as ye, a0 as xe, b0 as me, b as $, a1 as J, aB as k, aZ as pe, a2 as z, bj as be, b6 as we, t as ke, z as L, s as ve, Q as Ee, aQ as Be } from "./mermaid.core-CdBIz6FY.js";
4
+ import { p as Ce } from "./wardley-L42UT6IY-DUnkyH_z.js";
5
+ var p = {
6
+ NORMAL: 0,
7
+ REVERSE: 1,
8
+ HIGHLIGHT: 2,
9
+ MERGE: 3,
10
+ CHERRY_PICK: 4
11
+ }, Te = Ee.gitGraph, D = /* @__PURE__ */ $(() => ve({
12
+ ...Te,
13
+ ...J().gitGraph
14
+ }), "getConfig"), i = new $e(() => {
15
+ const e = D(), 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 K() {
29
+ return Be({ length: 7 });
30
+ }
31
+ $(K, "getID");
32
+ function ae(e, r) {
33
+ const t = /* @__PURE__ */ Object.create(null);
34
+ return e.reduce((o, s) => {
35
+ const d = r(s);
36
+ return t[d] || (t[d] = !0, o.push(s)), o;
37
+ }, []);
38
+ }
39
+ $(ae, "uniqBy");
40
+ var Le = /* @__PURE__ */ $(function(e) {
41
+ i.records.direction = e;
42
+ }, "setDirection"), Me = /* @__PURE__ */ $(function(e) {
43
+ k.debug("options str", e), e = e == null ? void 0 : e.trim(), e = e || "{}";
44
+ try {
45
+ i.records.options = JSON.parse(e);
46
+ } catch (r) {
47
+ k.error("error while parsing gitGraph options", r.message);
48
+ }
49
+ }, "setOptions"), Re = /* @__PURE__ */ $(function() {
50
+ return i.records.options;
51
+ }, "getOptions"), Ie = /* @__PURE__ */ $(function(e) {
52
+ let r = e.msg, t = e.id;
53
+ const o = e.type;
54
+ let s = e.tags;
55
+ k.info("commit", r, t, o, s), k.debug("Entering commit:", r, t, o, s);
56
+ const d = D();
57
+ t = L.sanitizeText(t, d), r = L.sanitizeText(r, d), s = s == null ? void 0 : s.map((a) => L.sanitizeText(a, d));
58
+ const n = {
59
+ id: t || i.records.seq + "-" + K(),
60
+ message: r,
61
+ seq: i.records.seq++,
62
+ type: o ?? p.NORMAL,
63
+ tags: s ?? [],
64
+ parents: i.records.head == null ? [] : [i.records.head.id],
65
+ branch: i.records.currBranch
66
+ };
67
+ i.records.head = n, k.info("main branch", d.mainBranchName), i.records.commits.has(n.id) && k.warn(`Commit ID ${n.id} already exists`), i.records.commits.set(n.id, n), i.records.branches.set(i.records.currBranch, n.id), k.debug("in pushCommit " + n.id);
68
+ }, "commit"), Oe = /* @__PURE__ */ $(function(e) {
69
+ let r = e.name;
70
+ const t = e.order;
71
+ if (r = L.sanitizeText(r, D()), i.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
+ i.records.branches.set(r, i.records.head != null ? i.records.head.id : null), i.records.branchConfig.set(r, { name: r, order: t }), ne(r), k.debug("in createBranch");
76
+ }, "branch"), _e = /* @__PURE__ */ $((e) => {
77
+ let r = e.branch, t = e.id;
78
+ const o = e.type, s = e.tags, d = D();
79
+ r = L.sanitizeText(r, d), t && (t = L.sanitizeText(t, d));
80
+ const n = i.records.branches.get(i.records.currBranch), a = i.records.branches.get(r), l = n ? i.records.commits.get(n) : void 0, h = a ? i.records.commits.get(a) : void 0;
81
+ if (l && h && l.branch === r)
82
+ throw new Error(`Cannot merge branch '${r}' into itself.`);
83
+ if (i.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 (${i.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 (!i.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 (h === void 0 || !h) {
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 === h) {
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 && i.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} ${o} ${s == null ? void 0 : s.join(" ")}`,
135
+ token: `merge ${r} ${t} ${o} ${s == null ? void 0 : s.join(" ")}`,
136
+ expected: [
137
+ `merge ${r} ${t}_UNIQUE ${o} ${s == null ? void 0 : s.join(" ")}`
138
+ ]
139
+ }, c;
140
+ }
141
+ const g = a || "", f = {
142
+ id: t || `${i.records.seq}-${K()}`,
143
+ message: `merged branch ${r} into ${i.records.currBranch}`,
144
+ seq: i.records.seq++,
145
+ parents: i.records.head == null ? [] : [i.records.head.id, g],
146
+ branch: i.records.currBranch,
147
+ type: p.MERGE,
148
+ customType: o,
149
+ customId: !!t,
150
+ tags: s ?? []
151
+ };
152
+ i.records.head = f, i.records.commits.set(f.id, f), i.records.branches.set(i.records.currBranch, f.id), k.debug(i.records.branches), k.debug("in mergeBranch");
153
+ }, "merge"), Ge = /* @__PURE__ */ $(function(e) {
154
+ let r = e.id, t = e.targetId, o = e.tags, s = e.parent;
155
+ k.debug("Entering cherryPick:", r, t, o);
156
+ const d = D();
157
+ if (r = L.sanitizeText(r, d), t = L.sanitizeText(t, d), o = o == null ? void 0 : o.map((l) => L.sanitizeText(l, d)), s = L.sanitizeText(s, d), !r || !i.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 = i.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 (s && !(Array.isArray(n.parents) && n.parents.includes(s)))
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 === p.MERGE && !s)
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 || !i.records.commits.has(t)) {
180
+ if (a === i.records.currBranch) {
181
+ const f = new Error(
182
+ 'Incorrect usage of "cherryPick". Source commit is already on current branch'
183
+ );
184
+ throw f.hash = {
185
+ text: `cherryPick ${r} ${t}`,
186
+ token: `cherryPick ${r} ${t}`,
187
+ expected: ["cherry-pick abc"]
188
+ }, f;
189
+ }
190
+ const l = i.records.branches.get(i.records.currBranch);
191
+ if (l === void 0 || !l) {
192
+ const f = new Error(
193
+ `Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`
194
+ );
195
+ throw f.hash = {
196
+ text: `cherryPick ${r} ${t}`,
197
+ token: `cherryPick ${r} ${t}`,
198
+ expected: ["cherry-pick abc"]
199
+ }, f;
200
+ }
201
+ const h = i.records.commits.get(l);
202
+ if (h === void 0 || !h) {
203
+ const f = new Error(
204
+ `Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`
205
+ );
206
+ throw f.hash = {
207
+ text: `cherryPick ${r} ${t}`,
208
+ token: `cherryPick ${r} ${t}`,
209
+ expected: ["cherry-pick abc"]
210
+ }, f;
211
+ }
212
+ const g = {
213
+ id: i.records.seq + "-" + K(),
214
+ message: `cherry-picked ${n == null ? void 0 : n.message} into ${i.records.currBranch}`,
215
+ seq: i.records.seq++,
216
+ parents: i.records.head == null ? [] : [i.records.head.id, n.id],
217
+ branch: i.records.currBranch,
218
+ type: p.CHERRY_PICK,
219
+ tags: o ? o.filter(Boolean) : [
220
+ `cherry-pick:${n.id}${n.type === p.MERGE ? `|parent:${s}` : ""}`
221
+ ]
222
+ };
223
+ i.records.head = g, i.records.commits.set(g.id, g), i.records.branches.set(i.records.currBranch, g.id), k.debug(i.records.branches), k.debug("in cherryPick");
224
+ }
225
+ }, "cherryPick"), ne = /* @__PURE__ */ $(function(e) {
226
+ if (e = L.sanitizeText(e, D()), i.records.branches.has(e)) {
227
+ i.records.currBranch = e;
228
+ const r = i.records.branches.get(i.records.currBranch);
229
+ r === void 0 || !r ? i.records.head = null : i.records.head = i.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 X(e, r, t) {
242
+ const o = e.indexOf(r);
243
+ o === -1 ? e.push(t) : e.splice(o, 1, t);
244
+ }
245
+ $(X, "upsert");
246
+ function Z(e) {
247
+ const r = e.reduce((s, d) => s.seq > d.seq ? s : d, e[0]);
248
+ let t = "";
249
+ e.forEach(function(s) {
250
+ s === r ? t += " *" : t += " |";
251
+ });
252
+ const o = [t, r.id, r.seq];
253
+ for (const s in i.records.branches)
254
+ i.records.branches.get(s) === r.id && o.push(s);
255
+ if (k.debug(o.join(" ")), r.parents && r.parents.length == 2 && r.parents[0] && r.parents[1]) {
256
+ const s = i.records.commits.get(r.parents[0]);
257
+ X(e, r, s), r.parents[1] && e.push(i.records.commits.get(r.parents[1]));
258
+ } else {
259
+ if (r.parents.length == 0)
260
+ return;
261
+ if (r.parents[0]) {
262
+ const s = i.records.commits.get(r.parents[0]);
263
+ X(e, r, s);
264
+ }
265
+ }
266
+ e = ae(e, (s) => s.id), Z(e);
267
+ }
268
+ $(Z, "prettyPrintCommitHistory");
269
+ var He = /* @__PURE__ */ $(function() {
270
+ k.debug(i.records.commits);
271
+ const e = se()[0];
272
+ Z([e]);
273
+ }, "prettyPrint"), Se = /* @__PURE__ */ $(function() {
274
+ i.reset(), ke();
275
+ }, "clear"), Ae = /* @__PURE__ */ $(function() {
276
+ return [...i.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"), De = /* @__PURE__ */ $(function() {
281
+ return i.records.branches;
282
+ }, "getBranches"), qe = /* @__PURE__ */ $(function() {
283
+ return i.records.commits;
284
+ }, "getCommits"), se = /* @__PURE__ */ $(function() {
285
+ const e = [...i.records.commits.values()];
286
+ return e.forEach(function(r) {
287
+ k.debug(r.id);
288
+ }), e.sort((r, t) => r.seq - t.seq), e;
289
+ }, "getCommitsArray"), Pe = /* @__PURE__ */ $(function() {
290
+ return i.records.currBranch;
291
+ }, "getCurrentBranch"), We = /* @__PURE__ */ $(function() {
292
+ return i.records.direction;
293
+ }, "getDirection"), Ne = /* @__PURE__ */ $(function() {
294
+ return i.records.head;
295
+ }, "getHead"), oe = {
296
+ commitType: p,
297
+ getConfig: D,
298
+ setDirection: Le,
299
+ setOptions: Me,
300
+ getOptions: Re,
301
+ commit: Ie,
302
+ branch: Oe,
303
+ merge: _e,
304
+ cherryPick: Ge,
305
+ checkout: ne,
306
+ //reset,
307
+ prettyPrint: He,
308
+ clear: Se,
309
+ getBranchesAsObjArray: Ae,
310
+ getBranches: De,
311
+ getCommits: qe,
312
+ getCommitsArray: se,
313
+ getCurrentBranch: Pe,
314
+ getDirection: We,
315
+ getHead: Ne,
316
+ setAccTitle: me,
317
+ getAccTitle: xe,
318
+ getAccDescription: ye,
319
+ setAccDescription: ue,
320
+ setDiagramTitle: ge,
321
+ getDiagramTitle: fe
322
+ }, Fe = /* @__PURE__ */ $((e, r) => {
323
+ he(e, r), e.dir && r.setDirection(e.dir);
324
+ for (const t of e.statements)
325
+ ze(t, r);
326
+ }, "populate"), ze = /* @__PURE__ */ $((e, r) => {
327
+ const o = {
328
+ Commit: /* @__PURE__ */ $((s) => r.commit(Ye(s)), "Commit"),
329
+ Branch: /* @__PURE__ */ $((s) => r.branch(je(s)), "Branch"),
330
+ Merge: /* @__PURE__ */ $((s) => r.merge(Ue(s)), "Merge"),
331
+ Checkout: /* @__PURE__ */ $((s) => r.checkout(Ke(s)), "Checkout"),
332
+ CherryPicking: /* @__PURE__ */ $((s) => r.cherryPick(Ve(s)), "CherryPicking")
333
+ }[e.$type];
334
+ o ? o(e) : k.error(`Unknown statement type: ${e.$type}`);
335
+ }, "parseStatement"), Ye = /* @__PURE__ */ $((e) => ({
336
+ id: e.id,
337
+ msg: e.message ?? "",
338
+ type: e.type !== void 0 ? p[e.type] : p.NORMAL,
339
+ tags: e.tags ?? void 0
340
+ }), "parseCommit"), je = /* @__PURE__ */ $((e) => ({
341
+ name: e.name,
342
+ order: e.order ?? 0
343
+ }), "parseBranch"), Ue = /* @__PURE__ */ $((e) => ({
344
+ branch: e.branch,
345
+ id: e.id ?? "",
346
+ type: e.type !== void 0 ? p[e.type] : void 0,
347
+ tags: e.tags ?? void 0
348
+ }), "parseMerge"), Ke = /* @__PURE__ */ $((e) => e.branch, "parseCheckout"), Ve = /* @__PURE__ */ $((e) => {
349
+ var t;
350
+ return {
351
+ id: e.id,
352
+ targetId: "",
353
+ tags: ((t = e.tags) == null ? void 0 : t.length) === 0 ? void 0 : e.tags,
354
+ parent: e.parent
355
+ };
356
+ }, "parseCherryPicking"), Xe = {
357
+ parse: /* @__PURE__ */ $(async (e) => {
358
+ const r = await Ce("gitGraph", e);
359
+ k.debug(r), Fe(r, oe);
360
+ }, "parse")
361
+ }, G = 10, H = 40, M = 4, I = 2, S = 8, V = /* @__PURE__ */ new Set(["redux", "redux-dark", "redux-color", "redux-dark-color"]), Q = 12, ee = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]), Qe = /* @__PURE__ */ new Set(["dark", "redux-dark", "redux-dark-color", "neo-dark"]), A = /* @__PURE__ */ $((e, r, t = !1) => t && e > 0 ? (e - 1) % (r - 1) + 1 : e % r, "calcColorIndex"), C = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map(), j = 30, N = /* @__PURE__ */ new Map(), U = [], O = 0, y = "LR", Je = /* @__PURE__ */ $(() => {
362
+ C.clear(), T.clear(), N.clear(), O = 0, U = [], y = "LR";
363
+ }, "clear"), ce = /* @__PURE__ */ $((e) => {
364
+ const r = document.createElementNS("http://www.w3.org/2000/svg", "text");
365
+ return (typeof e == "string" ? e.split(/\\n|\n|<br\s*\/?>/gi) : e).forEach((o) => {
366
+ const s = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
367
+ s.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), s.setAttribute("dy", "1em"), s.setAttribute("x", "0"), s.setAttribute("class", "row"), s.textContent = o.trim(), r.appendChild(s);
368
+ }), r;
369
+ }, "drawText"), ie = /* @__PURE__ */ $((e) => {
370
+ let r, t, o;
371
+ return y === "BT" ? (t = /* @__PURE__ */ $((s, d) => s <= d, "comparisonFunc"), o = 1 / 0) : (t = /* @__PURE__ */ $((s, d) => s >= d, "comparisonFunc"), o = 0), e.forEach((s) => {
372
+ var n, a;
373
+ const d = y === "TB" || y == "BT" ? (n = T.get(s)) == null ? void 0 : n.y : (a = T.get(s)) == null ? void 0 : a.x;
374
+ d !== void 0 && t(d, o) && (r = s, o = d);
375
+ }), r;
376
+ }, "findClosestParent"), Ze = /* @__PURE__ */ $((e) => {
377
+ let r = "", t = 1 / 0;
378
+ return e.forEach((o) => {
379
+ const s = T.get(o).y;
380
+ s <= t && (r = o, t = s);
381
+ }), r || void 0;
382
+ }, "findClosestParentBT"), er = /* @__PURE__ */ $((e, r, t) => {
383
+ let o = t, s = t;
384
+ const d = [];
385
+ e.forEach((n) => {
386
+ const a = r.get(n);
387
+ if (!a)
388
+ throw new Error(`Commit not found for key ${n}`);
389
+ a.parents.length ? (o = tr(a), s = Math.max(o, s)) : d.push(a), ar(a, o);
390
+ }), o = s, d.forEach((n) => {
391
+ nr(n, o, t);
392
+ }), e.forEach((n) => {
393
+ const a = r.get(n);
394
+ if (a != null && a.parents.length) {
395
+ const l = Ze(a.parents);
396
+ o = T.get(l).y - H, o <= s && (s = o);
397
+ const h = C.get(a.branch).pos, g = o - G;
398
+ T.set(a.id, { x: h, y: g });
399
+ }
400
+ });
401
+ }, "setParallelBTPos"), rr = /* @__PURE__ */ $((e) => {
402
+ var o;
403
+ const r = ie(e.parents.filter((s) => s !== null));
404
+ if (!r)
405
+ throw new Error(`Closest parent not found for commit ${e.id}`);
406
+ const t = (o = T.get(r)) == null ? void 0 : o.y;
407
+ if (t === void 0)
408
+ throw new Error(`Closest parent position not found for commit ${e.id}`);
409
+ return t;
410
+ }, "findClosestParentPos"), tr = /* @__PURE__ */ $((e) => rr(e) + H, "calculateCommitPosition"), ar = /* @__PURE__ */ $((e, r) => {
411
+ const t = C.get(e.branch);
412
+ if (!t)
413
+ throw new Error(`Branch not found for commit ${e.id}`);
414
+ const o = t.pos, s = r + G;
415
+ return T.set(e.id, { x: o, y: s }), { x: o, y: s };
416
+ }, "setCommitPosition"), nr = /* @__PURE__ */ $((e, r, t) => {
417
+ const o = C.get(e.branch);
418
+ if (!o)
419
+ throw new Error(`Branch not found for commit ${e.id}`);
420
+ const s = r + t, d = o.pos;
421
+ T.set(e.id, { x: d, y: s });
422
+ }, "setRootPosition"), sr = /* @__PURE__ */ $((e, r, t, o, s, d) => {
423
+ const { theme: n } = z(), a = V.has(n ?? ""), l = ee.has(n ?? ""), h = Qe.has(n ?? "");
424
+ if (d === p.HIGHLIGHT)
425
+ 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(
426
+ "class",
427
+ `commit ${r.id} commit-highlight${A(s, S, l)} ${o}-outer`
428
+ ), 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(
429
+ "class",
430
+ `commit ${r.id} commit${A(s, S, l)} ${o}-inner`
431
+ );
432
+ else if (d === p.CHERRY_PICK)
433
+ e.append("circle").attr("cx", t.x).attr("cy", t.y).attr("r", a ? 7 : 10).attr("class", `commit ${r.id} ${o}`), e.append("circle").attr("cx", t.x - 3).attr("cy", t.y + 2).attr("r", a ? 2.5 : 2.75).attr("fill", h ? "#000000" : "#fff").attr("class", `commit ${r.id} ${o}`), e.append("circle").attr("cx", t.x + 3).attr("cy", t.y + 2).attr("r", a ? 2.5 : 2.75).attr("fill", h ? "#000000" : "#fff").attr("class", `commit ${r.id} ${o}`), e.append("line").attr("x1", t.x + 3).attr("y1", t.y + 1).attr("x2", t.x).attr("y2", t.y - 5).attr("stroke", h ? "#000000" : "#fff").attr("class", `commit ${r.id} ${o}`), e.append("line").attr("x1", t.x - 3).attr("y1", t.y + 1).attr("x2", t.x).attr("y2", t.y - 5).attr("stroke", h ? "#000000" : "#fff").attr("class", `commit ${r.id} ${o}`);
434
+ else {
435
+ const g = e.append("circle");
436
+ if (g.attr("cx", t.x), g.attr("cy", t.y), g.attr("r", a ? 7 : 10), g.attr(
437
+ "class",
438
+ `commit ${r.id} commit${A(s, S, l)}`
439
+ ), d === p.MERGE) {
440
+ const f = e.append("circle");
441
+ f.attr("cx", t.x), f.attr("cy", t.y), f.attr("r", a ? 5 : 6), f.attr(
442
+ "class",
443
+ `commit ${o} ${r.id} commit${A(s, S, l)}`
444
+ );
445
+ }
446
+ if (d === p.REVERSE) {
447
+ const f = e.append("path"), c = a ? 4 : 5;
448
+ f.attr(
449
+ "d",
450
+ `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}`
451
+ ).attr(
452
+ "class",
453
+ `commit ${o} ${r.id} commit${A(s, S, l)}`
454
+ );
455
+ }
456
+ }
457
+ }, "drawCommitBullet"), or = /* @__PURE__ */ $((e, r, t, o, s) => {
458
+ var d;
459
+ if (r.type !== p.CHERRY_PICK && (r.customId && r.type === p.MERGE || r.type !== p.MERGE) && s.showCommitLabel) {
460
+ const n = e.append("g"), a = n.insert("rect").attr("class", "commit-label-bkg"), l = n.append("text").attr("x", o).attr("y", t.y + 25).attr("class", "commit-label").text(r.id), h = (d = l.node()) == null ? void 0 : d.getBBox();
461
+ if (h && (a.attr("x", t.posWithOffset - h.width / 2 - I).attr("y", t.y + 13.5).attr("width", h.width + 2 * I).attr("height", h.height + 2 * I), y === "TB" || y === "BT" ? (a.attr("x", t.x - (h.width + 4 * M + 5)).attr("y", t.y - 12), l.attr("x", t.x - (h.width + 4 * M)).attr("y", t.y + h.height - 12)) : l.attr("x", t.posWithOffset - h.width / 2), s.rotateCommitLabel))
462
+ if (y === "TB" || y === "BT")
463
+ l.attr(
464
+ "transform",
465
+ "rotate(-45, " + t.x + ", " + t.y + ")"
466
+ ), a.attr(
467
+ "transform",
468
+ "rotate(-45, " + t.x + ", " + t.y + ")"
469
+ );
470
+ else {
471
+ const g = -7.5 - (h.width + 10) / 25 * 9.5, f = 10 + h.width / 25 * 8.5;
472
+ n.attr(
473
+ "transform",
474
+ "translate(" + g + ", " + f + ") rotate(-45, " + o + ", " + t.y + ")"
475
+ );
476
+ }
477
+ }
478
+ }, "drawCommitLabel"), cr = /* @__PURE__ */ $((e, r, t, o) => {
479
+ var s;
480
+ if (r.tags.length > 0) {
481
+ let d = 0, n = 0, a = 0;
482
+ const l = [];
483
+ for (const h of r.tags.reverse()) {
484
+ const g = e.insert("polygon"), f = e.append("circle"), c = e.append("text").attr("y", t.y - 16 - d).attr("class", "tag-label").text(h), x = (s = c.node()) == null ? void 0 : s.getBBox();
485
+ if (!x)
486
+ throw new Error("Tag bbox not found");
487
+ n = Math.max(n, x.width), a = Math.max(a, x.height), c.attr("x", t.posWithOffset - x.width / 2), l.push({
488
+ tag: c,
489
+ hole: f,
490
+ rect: g,
491
+ yOffset: d
492
+ }), d += 20;
493
+ }
494
+ for (const { tag: h, hole: g, rect: f, yOffset: c } of l) {
495
+ const x = a / 2, u = t.y - 19.2 - c;
496
+ if (f.attr("class", "tag-label-bkg").attr(
497
+ "points",
498
+ `
499
+ ${o - n / 2 - M / 2},${u + I}
500
+ ${o - n / 2 - M / 2},${u - I}
501
+ ${t.posWithOffset - n / 2 - M},${u - x - I}
502
+ ${t.posWithOffset + n / 2 + M},${u - x - I}
503
+ ${t.posWithOffset + n / 2 + M},${u + x + I}
504
+ ${t.posWithOffset - n / 2 - M},${u + x + I}`
505
+ ), g.attr("cy", u).attr("cx", o - n / 2 + M / 2).attr("r", 1.5).attr("class", "tag-hole"), y === "TB" || y === "BT") {
506
+ const m = o + c;
507
+ f.attr("class", "tag-label-bkg").attr(
508
+ "points",
509
+ `
510
+ ${t.x},${m + 2}
511
+ ${t.x},${m - 2}
512
+ ${t.x + G},${m - x - 2}
513
+ ${t.x + G + n + 4},${m - x - 2}
514
+ ${t.x + G + n + 4},${m + x + 2}
515
+ ${t.x + G},${m + x + 2}`
516
+ ).attr("transform", "translate(12,12) rotate(45, " + t.x + "," + o + ")"), g.attr("cx", t.x + M / 2).attr("cy", m).attr("transform", "translate(12,12) rotate(45, " + t.x + "," + o + ")"), h.attr("x", t.x + 5).attr("y", m + 3).attr("transform", "translate(14,14) rotate(45, " + t.x + "," + o + ")");
517
+ }
518
+ }
519
+ }
520
+ }, "drawCommitTags"), ir = /* @__PURE__ */ $((e) => {
521
+ switch (e.customType ?? e.type) {
522
+ case p.NORMAL:
523
+ return "commit-normal";
524
+ case p.REVERSE:
525
+ return "commit-reverse";
526
+ case p.HIGHLIGHT:
527
+ return "commit-highlight";
528
+ case p.MERGE:
529
+ return "commit-merge";
530
+ case p.CHERRY_PICK:
531
+ return "commit-cherry-pick";
532
+ default:
533
+ return "commit-normal";
534
+ }
535
+ }, "getCommitClassType"), dr = /* @__PURE__ */ $((e, r, t, o) => {
536
+ const s = { x: 0, y: 0 };
537
+ if (e.parents.length > 0) {
538
+ const d = ie(e.parents);
539
+ if (d) {
540
+ const n = o.get(d) ?? s;
541
+ return r === "TB" ? n.y + H : r === "BT" ? (o.get(e.id) ?? s).y - H : n.x + H;
542
+ }
543
+ } else
544
+ return r === "TB" ? j : r === "BT" ? (o.get(e.id) ?? s).y - H : 0;
545
+ return 0;
546
+ }, "calculatePosition"), lr = /* @__PURE__ */ $((e, r, t) => {
547
+ var l, h;
548
+ const o = y === "BT" && t ? r : r + G, s = (l = C.get(e.branch)) == null ? void 0 : l.pos, d = y === "TB" || y === "BT" ? (h = C.get(e.branch)) == null ? void 0 : h.pos : o;
549
+ if (d === void 0 || s === void 0)
550
+ throw new Error(`Position were undefined for commit ${e.id}`);
551
+ const n = V.has(z().theme ?? ""), a = y === "TB" || y === "BT" ? o : s + (n ? Q / 2 + 1 : -2);
552
+ return { x: d, y: a, posWithOffset: o };
553
+ }, "getCommitPosition"), te = /* @__PURE__ */ $((e, r, t, o) => {
554
+ const s = e.append("g").attr("class", "commit-bullets"), d = e.append("g").attr("class", "commit-labels");
555
+ let n = y === "TB" || y === "BT" ? j : 0;
556
+ const a = [...r.keys()], l = o.parallelCommits ?? !1, h = /* @__PURE__ */ $((f, c) => {
557
+ var m, E;
558
+ const x = (m = r.get(f)) == null ? void 0 : m.seq, u = (E = r.get(c)) == null ? void 0 : E.seq;
559
+ return x !== void 0 && u !== void 0 ? x - u : 0;
560
+ }, "sortKeys");
561
+ let g = a.sort(h);
562
+ y === "BT" && (l && er(g, r, n), g = g.reverse()), g.forEach((f) => {
563
+ var u;
564
+ const c = r.get(f);
565
+ if (!c)
566
+ throw new Error(`Commit not found for key ${f}`);
567
+ l && (n = dr(c, y, n, T));
568
+ const x = lr(c, n, l);
569
+ if (t) {
570
+ const m = ir(c), E = c.customType ?? c.type, b = ((u = C.get(c.branch)) == null ? void 0 : u.index) ?? 0;
571
+ sr(s, c, x, m, b, E), or(d, c, x, n, o), cr(d, c, x, n);
572
+ }
573
+ y === "TB" || y === "BT" ? T.set(c.id, { x: x.x, y: x.posWithOffset }) : T.set(c.id, { x: x.posWithOffset, y: x.y }), n = y === "BT" && l ? n + H : n + H + G, n > O && (O = n);
574
+ });
575
+ }, "drawCommits"), hr = /* @__PURE__ */ $((e, r, t, o, s) => {
576
+ const n = (y === "TB" || y === "BT" ? t.x < o.x : t.y < o.y) ? r.branch : e.branch, a = /* @__PURE__ */ $((h) => h.branch === n, "isOnBranchToGetCurve"), l = /* @__PURE__ */ $((h) => h.seq > e.seq && h.seq < r.seq, "isBetweenCommits");
577
+ return [...s.values()].some((h) => l(h) && a(h));
578
+ }, "shouldRerouteArrow"), F = /* @__PURE__ */ $((e, r, t = 0) => {
579
+ const o = e + Math.abs(e - r) / 2;
580
+ if (t > 5)
581
+ return o;
582
+ if (U.every((n) => Math.abs(n - o) >= 10))
583
+ return U.push(o), o;
584
+ const d = Math.abs(e - r);
585
+ return F(e, r - d / 5, t + 1);
586
+ }, "findLane"), $r = /* @__PURE__ */ $((e, r, t, o) => {
587
+ var m, E, b, q, _;
588
+ const { theme: s } = z(), d = ee.has(s ?? ""), n = T.get(r.id), a = T.get(t.id);
589
+ if (n === void 0 || a === void 0)
590
+ throw new Error(`Commit positions not found for commits ${r.id} and ${t.id}`);
591
+ const l = hr(r, t, n, a, o);
592
+ let h = "", g = "", f = 0, c = 0, x = (m = C.get(t.branch)) == null ? void 0 : m.index;
593
+ t.type === p.MERGE && r.id !== t.parents[0] && (x = (E = C.get(r.branch)) == null ? void 0 : E.index);
594
+ let u;
595
+ if (l) {
596
+ h = "A 10 10, 0, 0, 0,", g = "A 10 10, 0, 0, 1,", f = 10, c = 10;
597
+ const v = n.y < a.y ? F(n.y, a.y) : F(a.y, n.y), w = n.x < a.x ? F(n.x, a.x) : F(a.x, n.x);
598
+ y === "TB" ? n.x < a.x ? u = `M ${n.x} ${n.y} L ${w - f} ${n.y} ${g} ${w} ${n.y + c} L ${w} ${a.y - f} ${h} ${w + c} ${a.y} L ${a.x} ${a.y}` : (x = (b = C.get(r.branch)) == null ? void 0 : b.index, u = `M ${n.x} ${n.y} L ${w + f} ${n.y} ${h} ${w} ${n.y + c} L ${w} ${a.y - f} ${g} ${w - c} ${a.y} L ${a.x} ${a.y}`) : y === "BT" ? n.x < a.x ? u = `M ${n.x} ${n.y} L ${w - f} ${n.y} ${h} ${w} ${n.y - c} L ${w} ${a.y + f} ${g} ${w + c} ${a.y} L ${a.x} ${a.y}` : (x = (q = C.get(r.branch)) == null ? void 0 : q.index, u = `M ${n.x} ${n.y} L ${w + f} ${n.y} ${g} ${w} ${n.y - c} L ${w} ${a.y + f} ${h} ${w - c} ${a.y} L ${a.x} ${a.y}`) : n.y < a.y ? u = `M ${n.x} ${n.y} L ${n.x} ${v - f} ${h} ${n.x + c} ${v} L ${a.x - f} ${v} ${g} ${a.x} ${v + c} L ${a.x} ${a.y}` : (x = (_ = C.get(r.branch)) == null ? void 0 : _.index, u = `M ${n.x} ${n.y} L ${n.x} ${v + f} ${g} ${n.x + c} ${v} L ${a.x - f} ${v} ${h} ${a.x} ${v - c} L ${a.x} ${a.y}`);
599
+ } else
600
+ h = "A 20 20, 0, 0, 0,", g = "A 20 20, 0, 0, 1,", f = 20, c = 20, y === "TB" ? (n.x < a.x && (t.type === p.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${n.x} ${a.y - f} ${h} ${n.x + c} ${a.y} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${a.x - f} ${n.y} ${g} ${a.x} ${n.y + c} L ${a.x} ${a.y}`), n.x > a.x && (h = "A 20 20, 0, 0, 0,", g = "A 20 20, 0, 0, 1,", f = 20, c = 20, t.type === p.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${n.x} ${a.y - f} ${g} ${n.x - c} ${a.y} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${a.x + f} ${n.y} ${h} ${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 === p.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${n.x} ${a.y + f} ${g} ${n.x + c} ${a.y} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${a.x - f} ${n.y} ${h} ${a.x} ${n.y - c} L ${a.x} ${a.y}`), n.x > a.x && (h = "A 20 20, 0, 0, 0,", g = "A 20 20, 0, 0, 1,", f = 20, c = 20, t.type === p.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${n.x} ${a.y + f} ${h} ${n.x - c} ${a.y} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${a.x + f} ${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 === p.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${a.x - f} ${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} ${h} ${n.x + c} ${a.y} L ${a.x} ${a.y}`), n.y > a.y && (t.type === p.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${a.x - f} ${n.y} ${h} ${a.x} ${n.y - c} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${n.x} ${a.y + f} ${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}`));
601
+ if (u === void 0)
602
+ throw new Error("Line definition not found");
603
+ e.append("path").attr("d", u).attr(
604
+ "class",
605
+ "arrow arrow" + A(x, S, d)
606
+ );
607
+ }, "drawArrow"), fr = /* @__PURE__ */ $((e, r) => {
608
+ const t = e.append("g").attr("class", "commit-arrows");
609
+ [...r.keys()].forEach((o) => {
610
+ const s = r.get(o);
611
+ s.parents && s.parents.length > 0 && s.parents.forEach((d) => {
612
+ $r(t, r.get(d), s, r);
613
+ });
614
+ });
615
+ }, "drawArrows"), gr = /* @__PURE__ */ $((e, r, t, o) => {
616
+ const { look: s, theme: d, themeVariables: n } = z(), { dropShadow: a, THEME_COLOR_LIMIT: l } = n, h = V.has(d ?? ""), g = ee.has(d ?? ""), f = e.append("g");
617
+ r.forEach((c, x) => {
618
+ var re;
619
+ const u = A(
620
+ x,
621
+ h ? l : S,
622
+ g
623
+ ), m = (re = C.get(c.name)) == null ? void 0 : re.pos;
624
+ if (m === void 0)
625
+ throw new Error(`Position not found for branch ${c.name}`);
626
+ const E = y === "TB" || y === "BT" ? m : h ? m + Q / 2 + 1 : m - 2, b = f.append("line");
627
+ b.attr("x1", 0), b.attr("y1", E), b.attr("x2", O), b.attr("y2", E), b.attr("class", "branch branch" + u), y === "TB" ? (b.attr("y1", j), b.attr("x1", m), b.attr("y2", O), b.attr("x2", m)) : y === "BT" && (b.attr("y1", O), b.attr("x1", m), b.attr("y2", j), b.attr("x2", m)), U.push(E);
628
+ const q = c.name, _ = ce(q), v = f.insert("rect"), R = f.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + u);
629
+ R.node().appendChild(_);
630
+ const B = _.getBBox(), W = h ? 0 : 4, Y = h ? 16 : 0, P = h ? Q : 0;
631
+ s === "neo" && v.attr("data-look", "neo"), v.attr("class", "branchLabelBkg label" + u).attr(
632
+ "style",
633
+ s === "neo" ? `filter:${h ? `url(#${o}-drop-shadow)` : a}` : ""
634
+ ).attr("rx", W).attr("ry", W).attr("x", -B.width - 4 - (t.rotateCommitLabel === !0 ? 30 : 0)).attr("y", -B.height / 2 + 10).attr("width", B.width + 18 + Y).attr("height", B.height + 4 + P), R.attr(
635
+ "transform",
636
+ "translate(" + (-B.width - 14 - (t.rotateCommitLabel === !0 ? 30 : 0) + Y / 2) + ", " + (E - B.height / 2 - 2) + ")"
637
+ ), y === "TB" ? (v.attr("x", m - B.width / 2 - 10).attr("y", 0), R.attr("transform", "translate(" + (m - B.width / 2 - 5) + ", 0)"), h && (v.attr("transform", `translate(${-Y / 2 - 3}, ${-P - 10})`), R.attr(
638
+ "transform",
639
+ "translate(" + (m - B.width / 2 - 5) + ", " + (-P * 2 + 7) + ")"
640
+ ))) : y === "BT" ? (v.attr("x", m - B.width / 2 - 10).attr("y", O), R.attr("transform", "translate(" + (m - B.width / 2 - 5) + ", " + O + ")"), h && (v.attr("transform", `translate(${-Y / 2 - 3}, ${P + 10})`), R.attr(
641
+ "transform",
642
+ "translate(" + (m - B.width / 2 - 5) + ", " + (O + P * 2 + 4) + ")"
643
+ ))) : v.attr("transform", "translate(-19, " + (E - 12 - P / 2) + ")");
644
+ });
645
+ }, "drawBranches"), ur = /* @__PURE__ */ $(function(e, r, t, o, s) {
646
+ return C.set(e, { pos: r, index: t }), r += 50 + (s ? 40 : 0) + (y === "TB" || y === "BT" ? o.width / 2 : 0), r;
647
+ }, "setBranchPosition"), yr = /* @__PURE__ */ $(function(e, r, t, o) {
648
+ Je(), k.debug("in gitgraph renderer", e + `
649
+ `, "id:", r, t);
650
+ const s = o.db;
651
+ if (!s.getConfig) {
652
+ k.error("getConfig method is not available on db");
653
+ return;
654
+ }
655
+ const d = s.getConfig(), n = d.rotateCommitLabel ?? !1;
656
+ N = s.getCommits();
657
+ const a = s.getBranchesAsObjArray();
658
+ y = s.getDirection();
659
+ const l = pe(`[id="${r}"]`), { look: h, theme: g, themeVariables: f } = z(), { useGradient: c, gradientStart: x, gradientStop: u, filterColor: m } = f;
660
+ if (c) {
661
+ const b = l.append("defs").append("linearGradient").attr("id", r + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
662
+ b.append("stop").attr("offset", "0%").attr("stop-color", x).attr("stop-opacity", 1), b.append("stop").attr("offset", "100%").attr("stop-color", u).attr("stop-opacity", 1);
663
+ }
664
+ h === "neo" && V.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", m);
665
+ let E = 0;
666
+ a.forEach((b, q) => {
667
+ var W;
668
+ const _ = ce(b.name), v = l.append("g"), w = v.insert("g").attr("class", "branchLabel"), R = w.insert("g").attr("class", "label branch-label");
669
+ (W = R.node()) == null || W.appendChild(_);
670
+ const B = _.getBBox();
671
+ E = ur(b.name, E, q, B, n), R.remove(), w.remove(), v.remove();
672
+ }), te(l, N, !1, d), d.showBranches && gr(l, a, d, r), fr(l, N), te(l, N, !0, d), be.insertTitle(
673
+ l,
674
+ "gitTitleText",
675
+ d.titleTopMargin ?? 0,
676
+ s.getDiagramTitle()
677
+ ), we(void 0, l, d.diagramPadding, d.useMaxWidth);
678
+ }, "draw"), xr = {
679
+ draw: yr
680
+ }, de = 8, le = /* @__PURE__ */ new Set(["redux", "redux-dark", "redux-color", "redux-dark-color"]), mr = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]), pr = /* @__PURE__ */ new Set(["neo", "neo-dark"]), br = /* @__PURE__ */ new Set(["dark", "redux-dark", "redux-dark-color", "neo-dark"]), wr = /* @__PURE__ */ new Set([
681
+ "redux",
682
+ "redux-dark",
683
+ "redux-color",
684
+ "redux-dark-color",
685
+ "neo",
686
+ "neo-dark"
687
+ ]), kr = /* @__PURE__ */ $((e) => {
688
+ const { svgId: r } = e;
689
+ let t = "";
690
+ if (e.useGradient && r)
691
+ for (let o = 0; o < e.THEME_COLOR_LIMIT; o++)
692
+ t += `
693
+ .label${o} { fill: ${e.mainBkg}; stroke: url(${r}-gradient); stroke-width: ${e.strokeWidth};}
694
+ `;
695
+ return t;
696
+ }, "genGitGraphGradient"), vr = /* @__PURE__ */ $((e) => {
697
+ const r = J(), { theme: t, themeVariables: o } = r, { borderColorArray: s } = o, d = le.has(t);
698
+ if (pr.has(t)) {
699
+ let n = "";
700
+ for (let a = 0; a < e.THEME_COLOR_LIMIT; a++)
701
+ if (a === 0)
702
+ n += `
703
+ .branch-label${a} { fill: ${e.nodeBorder};}
704
+ .commit${a} { stroke: ${e.nodeBorder}; }
705
+ .commit-highlight${a} { stroke: ${e.nodeBorder}; fill: ${e.nodeBorder}; }
706
+ .arrow${a} { stroke: ${e.nodeBorder}; }
707
+ .commit-bullets { fill: ${e.nodeBorder}; }
708
+ .commit-cherry-pick${a} { stroke: ${e.nodeBorder}; }
709
+ ${kr(e)}`;
710
+ else {
711
+ const l = a % de;
712
+ n += `
713
+ .branch-label${a} { fill: ${e["gitBranchLabel" + l]}; }
714
+ .commit${a} { stroke: ${e["git" + l]}; fill: ${e["git" + l]}; }
715
+ .commit-highlight${a} { stroke: ${e["gitInv" + l]}; fill: ${e["gitInv" + l]}; }
716
+ .arrow${a} { stroke: ${e["git" + l]}; }
717
+ `;
718
+ }
719
+ return n;
720
+ } else if (mr.has(t)) {
721
+ let n = "";
722
+ for (let a = 0; a < e.THEME_COLOR_LIMIT; a++)
723
+ if (a === 0)
724
+ n += `
725
+ .branch-label${a} { fill: ${e.nodeBorder}; ${d ? `font-weight:${e.noteFontWeight}` : ""} }
726
+ .commit${a} { stroke: ${e.nodeBorder}; }
727
+ .commit-highlight${a} { stroke: ${e.nodeBorder}; fill: ${e.mainBkg}; }
728
+ .label${a} { fill: ${e.mainBkg}; stroke: ${e.nodeBorder}; stroke-width: ${e.strokeWidth}; ${d ? `font-weight:${e.noteFontWeight}` : ""} }
729
+ .arrow${a} { stroke: ${e.nodeBorder}; }
730
+ .commit-bullets { fill: ${e.nodeBorder}; }
731
+ `;
732
+ else {
733
+ const l = a % s.length;
734
+ n += `
735
+ .branch-label${a} { fill: ${e.nodeBorder}; ${d ? `font-weight:${e.noteFontWeight}` : ""} }
736
+ .commit${a} { stroke: ${s[l]}; fill: ${s[l]}; }
737
+ .commit-highlight${a} { stroke: ${s[l]}; fill: ${s[l]}; }
738
+ .label${a} { fill: ${br.has(t) ? e.mainBkg : s[l]}; stroke: ${s[l]}; stroke-width: ${e.strokeWidth}; }
739
+ .arrow${a} { stroke: ${s[l]}; }
740
+ `;
741
+ }
742
+ return n;
743
+ } else {
744
+ let n = "";
745
+ for (let a = 0; a < e.THEME_COLOR_LIMIT; a++)
746
+ n += `
747
+ .branch-label${a} { fill: ${e.nodeBorder}; ${d ? `font-weight:${e.noteFontWeight}` : ""} }
748
+ .commit${a} { stroke: ${e.nodeBorder}; }
749
+ .commit-highlight${a} { stroke: ${e.nodeBorder}; fill: ${e.nodeBorder}; }
750
+ .label${a} { fill: ${e.mainBkg}; stroke: ${e.nodeBorder}; stroke-width: ${e.strokeWidth}; ${d ? `font-weight:${e.noteFontWeight}` : ""}}
751
+ .arrow${a} { stroke: ${e.nodeBorder}; }
752
+ .commit-bullets { fill: ${e.nodeBorder}; }
753
+ .commit-cherry-pick${a} { stroke: ${e.nodeBorder}; }
754
+ `;
755
+ return n;
756
+ }
757
+ }, "genColor"), Er = /* @__PURE__ */ $((e) => `${Array.from({ length: e.THEME_COLOR_LIMIT }, (r, t) => t).map((r) => {
758
+ const t = r % de;
759
+ return `
760
+ .branch-label${r} { fill: ${e["gitBranchLabel" + t]}; }
761
+ .commit${r} { stroke: ${e["git" + t]}; fill: ${e["git" + t]}; }
762
+ .commit-highlight${r} { stroke: ${e["gitInv" + t]}; fill: ${e["gitInv" + t]}; }
763
+ .label${r} { fill: ${e["git" + t]}; }
764
+ .arrow${r} { stroke: ${e["git" + t]}; }
765
+ `;
766
+ }).join(`
767
+ `)}`, "normalTheme"), Br = /* @__PURE__ */ $((e) => {
768
+ const r = J(), { theme: t } = r, o = wr.has(t);
769
+ return `
770
+ .commit-id,
771
+ .commit-msg,
772
+ .branch-label {
773
+ fill: lightgrey;
774
+ color: lightgrey;
775
+ font-family: 'trebuchet ms', verdana, arial, sans-serif;
776
+ font-family: var(--mermaid-font-family);
777
+ }
778
+
779
+ ${o ? vr(e) : Er(e)}
780
+
781
+ .branch {
782
+ stroke-width: ${e.strokeWidth};
783
+ stroke: ${e.commitLineColor ?? e.lineColor};
784
+ stroke-dasharray: ${o ? "4 2" : "2"};
785
+ }
786
+ .commit-label { font-size: ${e.commitLabelFontSize}; fill: ${o ? e.nodeBorder : e.commitLabelColor}; ${o ? `font-weight:${e.noteFontWeight};` : ""}}
787
+ .commit-label-bkg { font-size: ${e.commitLabelFontSize}; fill: ${o ? "transparent" : e.commitLabelBackground}; opacity: ${o ? "" : 0.5}; }
788
+ .tag-label { font-size: ${e.tagLabelFontSize}; fill: ${e.tagLabelColor};}
789
+ .tag-label-bkg { fill: ${o ? e.mainBkg : e.tagLabelBackground}; stroke: ${o ? e.nodeBorder : e.tagLabelBorder}; ${o ? `filter:${e.dropShadow}` : ""} }
790
+ .tag-hole { fill: ${e.textColor}; }
791
+
792
+ .commit-merge {
793
+ stroke: ${o ? e.mainBkg : e.primaryColor};
794
+ fill: ${o ? e.mainBkg : e.primaryColor};
795
+ }
796
+ .commit-reverse {
797
+ stroke: ${o ? e.mainBkg : e.primaryColor};
798
+ fill: ${o ? e.mainBkg : e.primaryColor};
799
+ stroke-width: ${o ? e.strokeWidth : 3};
800
+ }
801
+ .commit-highlight-outer {
802
+ }
803
+ .commit-highlight-inner {
804
+ stroke: ${o ? e.mainBkg : e.primaryColor};
805
+ fill: ${o ? e.mainBkg : e.primaryColor};
806
+ }
807
+
808
+ .arrow {
809
+ /* Intentional: neo themes keep the bold 8px arrow (like classic themes); only redux-geometry themes use the thinner options.strokeWidth. */
810
+ stroke-width: ${le.has(t) ? e.strokeWidth : 8};
811
+ stroke-linecap: round;
812
+ fill: none
813
+ }
814
+ .gitTitleText {
815
+ text-anchor: middle;
816
+ font-size: 18px;
817
+ fill: ${e.textColor};
818
+ }
819
+ `;
820
+ }, "getStyles"), Cr = Br, Ir = {
821
+ parser: Xe,
822
+ db: oe,
823
+ renderer: xr,
824
+ styles: Cr
825
+ };
826
+ export {
827
+ Ir as diagram
828
+ };