@ucap-llm/ai-ui 1.1.13 → 1.1.15

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 (111) hide show
  1. package/_basePickBy-DMehTBs0-8955b30b.mjs +151 -0
  2. package/_basePickBy-e7598e72.mjs +153 -0
  3. package/{_baseUniq-2bcae05e.mjs → _baseUniq-8cd7fbc4.mjs} +150 -150
  4. package/_baseUniq-DPnX6tpB-5eb6efbd.mjs +615 -0
  5. package/ai-ui.es.js +9 -8
  6. package/ai-ui.umd.js +3425 -923
  7. package/arc-8909f880.mjs +85 -0
  8. package/arc-qimaJRLH-591a6072.mjs +85 -0
  9. package/architecture-4AB2E3PP-DFmEpUnA-62fe65dd.mjs +10 -0
  10. package/architecture-4AB2E3PP-b04ae9dd.mjs +10 -0
  11. package/{architectureDiagram-IEHRJDOE-e4684ef3.mjs → architectureDiagram-IEHRJDOE-1ccc2c64.mjs} +123 -123
  12. package/architectureDiagram-IEHRJDOE-BRVAVUEE-c068faae.mjs +4641 -0
  13. package/{blockDiagram-JOT3LUYC-504ee31e.mjs → blockDiagram-JOT3LUYC-63569de5.mjs} +5 -5
  14. package/blockDiagram-JOT3LUYC-Cs4tSRey-54d8e29b.mjs +2251 -0
  15. package/{c4Diagram-VJAJSXHY-c5ba6af4.mjs → c4Diagram-VJAJSXHY-355a4170.mjs} +23 -23
  16. package/c4Diagram-VJAJSXHY-C3F9fO0L-0df97cd8.mjs +1583 -0
  17. package/channel-CuHzivgY-bb3d765a.mjs +5 -0
  18. package/channel-a1f4f18c.mjs +5 -0
  19. package/{chunk-4BMEZGHF-8d9a2e4f.mjs → chunk-4BMEZGHF-705995af.mjs} +1 -1
  20. package/chunk-4BMEZGHF-btTOjzEX-c9c5432c.mjs +9 -0
  21. package/{chunk-A2AXSNBT-41ae29f2.mjs → chunk-A2AXSNBT-3a857566.mjs} +10 -10
  22. package/chunk-A2AXSNBT-CPBZRsS7-a80df701.mjs +1373 -0
  23. package/{chunk-AEK57VVT-69e121d6.mjs → chunk-AEK57VVT-6c60e1ee.mjs} +45 -45
  24. package/chunk-AEK57VVT-D62Iwyam-238a3d85.mjs +1361 -0
  25. package/{chunk-D6G4REZN-472adc5b.mjs → chunk-D6G4REZN-11c52918.mjs} +5 -5
  26. package/chunk-D6G4REZN-HlFmQTJy-20704636.mjs +64 -0
  27. package/chunk-RZ5BOZE2-DIFgOqDt-495bec03.mjs +24 -0
  28. package/{chunk-RZ5BOZE2-b7d5d4f5.mjs → chunk-RZ5BOZE2-d6db8103.mjs} +9 -9
  29. package/chunk-XZIHB7SX-CCrbsG0u-f30e4124.mjs +15 -0
  30. package/{chunk-XZIHB7SX-56c08d07.mjs → chunk-XZIHB7SX-fafd3ca2.mjs} +1 -1
  31. package/classDiagram-GIVACNV2-Bv5U0XPL-622b22ed.mjs +18 -0
  32. package/{classDiagram-v2-COTLJTTW-1deea5cc.mjs → classDiagram-GIVACNV2-eca9aeb6.mjs} +5 -5
  33. package/classDiagram-v2-COTLJTTW-Bv5U0XPL-622b22ed.mjs +18 -0
  34. package/{classDiagram-GIVACNV2-1deea5cc.mjs → classDiagram-v2-COTLJTTW-eca9aeb6.mjs} +5 -5
  35. package/{clone-1f18a17f.mjs → clone-327a1426.mjs} +1 -1
  36. package/clone-Csc9uFbU-6c4f28bd.mjs +8 -0
  37. package/cytoscape.esm-Swd9B-1A-3101f241.mjs +18730 -0
  38. package/{dagre-OKDRZEBW-74e73dcf.mjs → dagre-OKDRZEBW-9059bb36.mjs} +81 -81
  39. package/dagre-OKDRZEBW-CoMQYlxF-96274fb0.mjs +448 -0
  40. package/{diagram-SSKATNLV-1a562cb0.mjs → diagram-SSKATNLV-70f68e72.mjs} +34 -34
  41. package/diagram-SSKATNLV-CPuZUaGP-50edcaa0.mjs +225 -0
  42. package/{diagram-VNBRO52H-b765e46f.mjs → diagram-VNBRO52H-39273710.mjs} +35 -35
  43. package/diagram-VNBRO52H-DIIZ-Sll-969266e6.mjs +130 -0
  44. package/{erDiagram-Q7BY3M3F-022c4343.mjs → erDiagram-Q7BY3M3F-96ba3906.mjs} +3 -3
  45. package/erDiagram-Q7BY3M3F-ZKWAM_uE-41c0350d.mjs +843 -0
  46. package/{flowDiagram-4HSFHLVR-6036e284.mjs → flowDiagram-4HSFHLVR-795e3830.mjs} +29 -29
  47. package/flowDiagram-4HSFHLVR-CUJXGEG3-801dde13.mjs +1624 -0
  48. package/{ganttDiagram-APWFNJXF-be871387.mjs → ganttDiagram-APWFNJXF-736e67b6.mjs} +398 -398
  49. package/ganttDiagram-APWFNJXF-C1pgubbs-20beffc3.mjs +2527 -0
  50. package/gitGraph-O2Q2CXLX-00465db9.mjs +10 -0
  51. package/gitGraph-O2Q2CXLX-BYavwGzs-e5f1990e.mjs +10 -0
  52. package/{gitGraphDiagram-7IBYFJ6S-da63c888.mjs → gitGraphDiagram-7IBYFJ6S-115329ab.mjs} +88 -88
  53. package/gitGraphDiagram-7IBYFJ6S-CndxirR4-b39d4089.mjs +716 -0
  54. package/{graph-e71f0e3e.mjs → graph-9e073c5f.mjs} +8 -8
  55. package/graph-DOmtxVvg-727f4e14.mjs +247 -0
  56. package/index-433e2395.mjs +168385 -0
  57. package/info-4N47QTOZ-688db415.mjs +10 -0
  58. package/info-4N47QTOZ-DPyDFN1Z-821cf2f7.mjs +10 -0
  59. package/{infoDiagram-PH2N3AL5-3e1c1c1f.mjs → infoDiagram-PH2N3AL5-29e9585a.mjs} +9 -9
  60. package/infoDiagram-PH2N3AL5-BkSS3vpU-ef4bf66d.mjs +26 -0
  61. package/init-DjUOC4st-87c930f1.mjs +16 -0
  62. package/{journeyDiagram-U35MCT3I-6d29748d.mjs → journeyDiagram-U35MCT3I-7c5644d1.mjs} +41 -41
  63. package/journeyDiagram-U35MCT3I-BN-kCDeJ-ac350902.mjs +811 -0
  64. package/{kanban-definition-NDS4AKOZ-c231ae4c.mjs → kanban-definition-NDS4AKOZ-eff441f9.mjs} +47 -47
  65. package/kanban-definition-NDS4AKOZ-gaDUOiKt-efdba942.mjs +720 -0
  66. package/{layout-b9b9e407.mjs → layout-501d22f0.mjs} +19 -19
  67. package/layout-8X5HiOVA-b6e13cf9.mjs +1323 -0
  68. package/linear-BgV5F0PU-8137edad.mjs +447 -0
  69. package/{linear-99040ddc.mjs → linear-fd3cd932.mjs} +56 -56
  70. package/{mermaid-parser.core-55f134dc.mjs → mermaid-parser.core-6eb44241.mjs} +160 -160
  71. package/mermaid-parser.core-BTS3sfcL-8c80284a.mjs +12810 -0
  72. package/{mindmap-definition-ALO5MXBD-938e2e65.mjs → mindmap-definition-ALO5MXBD-2fe3c748.mjs} +1 -1
  73. package/mindmap-definition-ALO5MXBD-B8q_1sIj-c3599d3c.mjs +3225 -0
  74. package/ordinal-DfAQgscy-1c8e46a9.mjs +65 -0
  75. package/package.json +2 -2
  76. package/packet-KVYON367-DcfdOX-U-afac932a.mjs +10 -0
  77. package/packet-KVYON367-c82af3fe.mjs +10 -0
  78. package/pie-R6RNRRYF-DKruFncB-d07f60c2.mjs +10 -0
  79. package/pie-R6RNRRYF-eb27797b.mjs +10 -0
  80. package/pieDiagram-IB7DONF6-Bijui6_Q-db9fdf3a.mjs +166 -0
  81. package/{pieDiagram-IB7DONF6-6a11673b.mjs → pieDiagram-IB7DONF6-e6863984.mjs} +36 -36
  82. package/{quadrantDiagram-7GDLP6J5-a4a4d9ac.mjs → quadrantDiagram-7GDLP6J5-88df12c2.mjs} +15 -15
  83. package/quadrantDiagram-7GDLP6J5-DzIzViUj-b13add98.mjs +1027 -0
  84. package/radar-MK3ICKWK-723229d0.mjs +10 -0
  85. package/radar-MK3ICKWK-D8wbkmr5-3165faf6.mjs +10 -0
  86. package/{requirementDiagram-KVF5MWMF-a7093c74.mjs → requirementDiagram-KVF5MWMF-7228051c.mjs} +50 -50
  87. package/requirementDiagram-KVF5MWMF-Hqsbdpfq-23374f24.mjs +853 -0
  88. package/{sankeyDiagram-QLVOVGJD-f4bcbb2d.mjs → sankeyDiagram-QLVOVGJD-00a31a99.mjs} +87 -87
  89. package/sankeyDiagram-QLVOVGJD-DGCeusqJ-8ca7e64d.mjs +826 -0
  90. package/{sequenceDiagram-X6HHIX6F-9071cfff.mjs → sequenceDiagram-X6HHIX6F-de203309.mjs} +3 -3
  91. package/sequenceDiagram-X6HHIX6F-kuEE9wSd-5f0ec5cd.mjs +2283 -0
  92. package/{stateDiagram-DGXRK772-fb22a7a5.mjs → stateDiagram-DGXRK772-2341237a.mjs} +48 -48
  93. package/stateDiagram-DGXRK772-Cq-Ce3WP-266efa7f.mjs +274 -0
  94. package/{stateDiagram-v2-YXO3MK2T-67326b76.mjs → stateDiagram-v2-YXO3MK2T-8c81deed.mjs} +5 -5
  95. package/stateDiagram-v2-YXO3MK2T-CplwFWn1-c0024e4e.mjs +18 -0
  96. package/style.css +10 -1
  97. package/timeline-definition-BDJGKUSR-USv5sZzx-22548912.mjs +806 -0
  98. package/{timeline-definition-BDJGKUSR-44f50d45.mjs → timeline-definition-BDJGKUSR-e615901b.mjs} +79 -79
  99. package/{xychartDiagram-VJFVF3MP-2df503f6.mjs → xychartDiagram-VJFVF3MP-9ad66a6b.mjs} +28 -28
  100. package/xychartDiagram-VJFVF3MP-CXCfFZBM-e5ca151e.mjs +1306 -0
  101. package/_basePickBy-12958109.mjs +0 -153
  102. package/arc-14f9a207.mjs +0 -85
  103. package/architecture-4AB2E3PP-bb512ddb.mjs +0 -10
  104. package/channel-7bd711b4.mjs +0 -5
  105. package/gitGraph-O2Q2CXLX-83cfcbef.mjs +0 -10
  106. package/index-f83d4b07.mjs +0 -97448
  107. package/info-4N47QTOZ-20cf90f5.mjs +0 -10
  108. package/katex-2e45926a.mjs +0 -11700
  109. package/packet-KVYON367-453a49e8.mjs +0 -10
  110. package/pie-R6RNRRYF-4d95c8dc.mjs +0 -10
  111. package/radar-MK3ICKWK-100e8fa4.mjs +0 -10
@@ -0,0 +1,716 @@
1
+ import { m as U } from "./chunk-4BMEZGHF-btTOjzEX-c9c5432c.mjs";
2
+ import { e as X } from "./chunk-XZIHB7SX-CCrbsG0u-f30e4124.mjs";
3
+ import { A as Z, v as m, l as rr, S as tr, C as er, D as or, J as w, j as nr, G as cr, K as ir, Y as ar, i as sr, k as dr, T as C, r as hr, e as $r, q as mr, Q as lr } from "./index-433e2395.mjs";
4
+ import { u as yr } from "./mermaid-parser.core-BTS3sfcL-8c80284a.mjs";
5
+ import "vue";
6
+ import "./_baseUniq-DPnX6tpB-5eb6efbd.mjs";
7
+ import "./_basePickBy-DMehTBs0-8955b30b.mjs";
8
+ import "./clone-Csc9uFbU-6c4f28bd.mjs";
9
+ var u = {
10
+ NORMAL: 0,
11
+ REVERSE: 1,
12
+ HIGHLIGHT: 2,
13
+ MERGE: 3,
14
+ CHERRY_PICK: 4
15
+ }, gr = Z.gitGraph, O = /* @__PURE__ */ m(() => tr({
16
+ ...gr,
17
+ ...er().gitGraph
18
+ }), "getConfig"), s = new X(() => {
19
+ const t = O(), r = t.mainBranchName, e = t.mainBranchOrder;
20
+ return {
21
+ mainBranchName: r,
22
+ commits: /* @__PURE__ */ new Map(),
23
+ head: null,
24
+ branchConfig: /* @__PURE__ */ new Map([[r, { name: r, order: e }]]),
25
+ branches: /* @__PURE__ */ new Map([[r, null]]),
26
+ currBranch: r,
27
+ direction: "LR",
28
+ seq: 0,
29
+ options: {}
30
+ };
31
+ });
32
+ function D() {
33
+ return or({ length: 7 });
34
+ }
35
+ m(D, "getID");
36
+ function Y(t, r) {
37
+ const e = /* @__PURE__ */ Object.create(null);
38
+ return t.reduce((c, i) => {
39
+ const a = r(i);
40
+ return e[a] || (e[a] = !0, c.push(i)), c;
41
+ }, []);
42
+ }
43
+ m(Y, "uniqBy");
44
+ var pr = /* @__PURE__ */ m(function(t) {
45
+ s.records.direction = t;
46
+ }, "setDirection"), xr = /* @__PURE__ */ m(function(t) {
47
+ w.debug("options str", t), t = t == null ? void 0 : t.trim(), t = t || "{}";
48
+ try {
49
+ s.records.options = JSON.parse(t);
50
+ } catch (r) {
51
+ w.error("error while parsing gitGraph options", r.message);
52
+ }
53
+ }, "setOptions"), fr = /* @__PURE__ */ m(function() {
54
+ return s.records.options;
55
+ }, "getOptions"), ur = /* @__PURE__ */ m(function(t) {
56
+ let r = t.msg, e = t.id;
57
+ const c = t.type;
58
+ let i = t.tags;
59
+ w.info("commit", r, e, c, i), w.debug("Entering commit:", r, e, c, i);
60
+ const a = O();
61
+ e = C.sanitizeText(e, a), r = C.sanitizeText(r, a), i = i == null ? void 0 : i.map((d) => C.sanitizeText(d, a));
62
+ const h = {
63
+ id: e || s.records.seq + "-" + D(),
64
+ message: r,
65
+ seq: s.records.seq++,
66
+ type: c ?? u.NORMAL,
67
+ tags: i ?? [],
68
+ parents: s.records.head == null ? [] : [s.records.head.id],
69
+ branch: s.records.currBranch
70
+ };
71
+ s.records.head = h, w.info("main branch", a.mainBranchName), s.records.commits.set(h.id, h), s.records.branches.set(s.records.currBranch, h.id), w.debug("in pushCommit " + h.id);
72
+ }, "commit"), br = /* @__PURE__ */ m(function(t) {
73
+ let r = t.name;
74
+ const e = t.order;
75
+ if (r = C.sanitizeText(r, O()), s.records.branches.has(r))
76
+ throw new Error(
77
+ `Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`
78
+ );
79
+ s.records.branches.set(r, s.records.head != null ? s.records.head.id : null), s.records.branchConfig.set(r, { name: r, order: e }), F(r), w.debug("in createBranch");
80
+ }, "branch"), wr = /* @__PURE__ */ m((t) => {
81
+ let r = t.branch, e = t.id;
82
+ const c = t.type, i = t.tags, a = O();
83
+ r = C.sanitizeText(r, a), e && (e = C.sanitizeText(e, a));
84
+ const h = s.records.branches.get(s.records.currBranch), d = s.records.branches.get(r), l = h ? s.records.commits.get(h) : void 0, o = d ? s.records.commits.get(d) : void 0;
85
+ if (l && o && l.branch === r)
86
+ throw new Error(`Cannot merge branch '${r}' into itself.`);
87
+ if (s.records.currBranch === r) {
88
+ const $ = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
89
+ throw $.hash = {
90
+ text: `merge ${r}`,
91
+ token: `merge ${r}`,
92
+ expected: ["branch abc"]
93
+ }, $;
94
+ }
95
+ if (l === void 0 || !l) {
96
+ const $ = new Error(
97
+ `Incorrect usage of "merge". Current branch (${s.records.currBranch})has no commits`
98
+ );
99
+ throw $.hash = {
100
+ text: `merge ${r}`,
101
+ token: `merge ${r}`,
102
+ expected: ["commit"]
103
+ }, $;
104
+ }
105
+ if (!s.records.branches.has(r)) {
106
+ const $ = new Error(
107
+ 'Incorrect usage of "merge". Branch to be merged (' + r + ") does not exist"
108
+ );
109
+ throw $.hash = {
110
+ text: `merge ${r}`,
111
+ token: `merge ${r}`,
112
+ expected: [`branch ${r}`]
113
+ }, $;
114
+ }
115
+ if (o === void 0 || !o) {
116
+ const $ = new Error(
117
+ 'Incorrect usage of "merge". Branch to be merged (' + r + ") has no commits"
118
+ );
119
+ throw $.hash = {
120
+ text: `merge ${r}`,
121
+ token: `merge ${r}`,
122
+ expected: ['"commit"']
123
+ }, $;
124
+ }
125
+ if (l === o) {
126
+ const $ = new Error('Incorrect usage of "merge". Both branches have same head');
127
+ throw $.hash = {
128
+ text: `merge ${r}`,
129
+ token: `merge ${r}`,
130
+ expected: ["branch abc"]
131
+ }, $;
132
+ }
133
+ if (e && s.records.commits.has(e)) {
134
+ const $ = new Error(
135
+ 'Incorrect usage of "merge". Commit with id:' + e + " already exists, use different custom Id"
136
+ );
137
+ throw $.hash = {
138
+ text: `merge ${r} ${e} ${c} ${i == null ? void 0 : i.join(" ")}`,
139
+ token: `merge ${r} ${e} ${c} ${i == null ? void 0 : i.join(" ")}`,
140
+ expected: [
141
+ `merge ${r} ${e}_UNIQUE ${c} ${i == null ? void 0 : i.join(" ")}`
142
+ ]
143
+ }, $;
144
+ }
145
+ const n = d || "", f = {
146
+ id: e || `${s.records.seq}-${D()}`,
147
+ message: `merged branch ${r} into ${s.records.currBranch}`,
148
+ seq: s.records.seq++,
149
+ parents: s.records.head == null ? [] : [s.records.head.id, n],
150
+ branch: s.records.currBranch,
151
+ type: u.MERGE,
152
+ customType: c,
153
+ customId: !!e,
154
+ tags: i ?? []
155
+ };
156
+ s.records.head = f, s.records.commits.set(f.id, f), s.records.branches.set(s.records.currBranch, f.id), w.debug(s.records.branches), w.debug("in mergeBranch");
157
+ }, "merge"), Br = /* @__PURE__ */ m(function(t) {
158
+ let r = t.id, e = t.targetId, c = t.tags, i = t.parent;
159
+ w.debug("Entering cherryPick:", r, e, c);
160
+ const a = O();
161
+ if (r = C.sanitizeText(r, a), e = C.sanitizeText(e, a), c = c == null ? void 0 : c.map((l) => C.sanitizeText(l, a)), i = C.sanitizeText(i, a), !r || !s.records.commits.has(r)) {
162
+ const l = new Error(
163
+ 'Incorrect usage of "cherryPick". Source commit id should exist and provided'
164
+ );
165
+ throw l.hash = {
166
+ text: `cherryPick ${r} ${e}`,
167
+ token: `cherryPick ${r} ${e}`,
168
+ expected: ["cherry-pick abc"]
169
+ }, l;
170
+ }
171
+ const h = s.records.commits.get(r);
172
+ if (h === void 0 || !h)
173
+ throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
174
+ if (i && !(Array.isArray(h.parents) && h.parents.includes(i)))
175
+ throw new Error(
176
+ "Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit."
177
+ );
178
+ const d = h.branch;
179
+ if (h.type === u.MERGE && !i)
180
+ throw new Error(
181
+ "Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified."
182
+ );
183
+ if (!e || !s.records.commits.has(e)) {
184
+ if (d === s.records.currBranch) {
185
+ const f = new Error(
186
+ 'Incorrect usage of "cherryPick". Source commit is already on current branch'
187
+ );
188
+ throw f.hash = {
189
+ text: `cherryPick ${r} ${e}`,
190
+ token: `cherryPick ${r} ${e}`,
191
+ expected: ["cherry-pick abc"]
192
+ }, f;
193
+ }
194
+ const l = s.records.branches.get(s.records.currBranch);
195
+ if (l === void 0 || !l) {
196
+ const f = new Error(
197
+ `Incorrect usage of "cherry-pick". Current branch (${s.records.currBranch})has no commits`
198
+ );
199
+ throw f.hash = {
200
+ text: `cherryPick ${r} ${e}`,
201
+ token: `cherryPick ${r} ${e}`,
202
+ expected: ["cherry-pick abc"]
203
+ }, f;
204
+ }
205
+ const o = s.records.commits.get(l);
206
+ if (o === void 0 || !o) {
207
+ const f = new Error(
208
+ `Incorrect usage of "cherry-pick". Current branch (${s.records.currBranch})has no commits`
209
+ );
210
+ throw f.hash = {
211
+ text: `cherryPick ${r} ${e}`,
212
+ token: `cherryPick ${r} ${e}`,
213
+ expected: ["cherry-pick abc"]
214
+ }, f;
215
+ }
216
+ const n = {
217
+ id: s.records.seq + "-" + D(),
218
+ message: `cherry-picked ${h == null ? void 0 : h.message} into ${s.records.currBranch}`,
219
+ seq: s.records.seq++,
220
+ parents: s.records.head == null ? [] : [s.records.head.id, h.id],
221
+ branch: s.records.currBranch,
222
+ type: u.CHERRY_PICK,
223
+ tags: c ? c.filter(Boolean) : [
224
+ `cherry-pick:${h.id}${h.type === u.MERGE ? `|parent:${i}` : ""}`
225
+ ]
226
+ };
227
+ s.records.head = n, s.records.commits.set(n.id, n), s.records.branches.set(s.records.currBranch, n.id), w.debug(s.records.branches), w.debug("in cherryPick");
228
+ }
229
+ }, "cherryPick"), F = /* @__PURE__ */ m(function(t) {
230
+ if (t = C.sanitizeText(t, O()), s.records.branches.has(t)) {
231
+ s.records.currBranch = t;
232
+ const r = s.records.branches.get(s.records.currBranch);
233
+ r === void 0 || !r ? s.records.head = null : s.records.head = s.records.commits.get(r) ?? null;
234
+ } else {
235
+ const r = new Error(
236
+ `Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`
237
+ );
238
+ throw r.hash = {
239
+ text: `checkout ${t}`,
240
+ token: `checkout ${t}`,
241
+ expected: [`branch ${t}`]
242
+ }, r;
243
+ }
244
+ }, "checkout");
245
+ function N(t, r, e) {
246
+ const c = t.indexOf(r);
247
+ c === -1 ? t.push(e) : t.splice(c, 1, e);
248
+ }
249
+ m(N, "upsert");
250
+ function j(t) {
251
+ const r = t.reduce((i, a) => i.seq > a.seq ? i : a, t[0]);
252
+ let e = "";
253
+ t.forEach(function(i) {
254
+ i === r ? e += " *" : e += " |";
255
+ });
256
+ const c = [e, r.id, r.seq];
257
+ for (const i in s.records.branches)
258
+ s.records.branches.get(i) === r.id && c.push(i);
259
+ if (w.debug(c.join(" ")), r.parents && r.parents.length == 2 && r.parents[0] && r.parents[1]) {
260
+ const i = s.records.commits.get(r.parents[0]);
261
+ N(t, r, i), r.parents[1] && t.push(s.records.commits.get(r.parents[1]));
262
+ } else {
263
+ if (r.parents.length == 0)
264
+ return;
265
+ if (r.parents[0]) {
266
+ const i = s.records.commits.get(r.parents[0]);
267
+ N(t, r, i);
268
+ }
269
+ }
270
+ t = Y(t, (i) => i.id), j(t);
271
+ }
272
+ m(j, "prettyPrintCommitHistory");
273
+ var Er = /* @__PURE__ */ m(function() {
274
+ w.debug(s.records.commits);
275
+ const t = _()[0];
276
+ j([t]);
277
+ }, "prettyPrint"), vr = /* @__PURE__ */ m(function() {
278
+ s.reset(), hr();
279
+ }, "clear"), kr = /* @__PURE__ */ m(function() {
280
+ return [...s.records.branchConfig.values()].map((t, r) => t.order !== null && t.order !== void 0 ? t : {
281
+ ...t,
282
+ order: parseFloat(`0.${r}`)
283
+ }).sort((t, r) => (t.order ?? 0) - (r.order ?? 0)).map(({ name: t }) => ({ name: t }));
284
+ }, "getBranchesAsObjArray"), Cr = /* @__PURE__ */ m(function() {
285
+ return s.records.branches;
286
+ }, "getBranches"), Lr = /* @__PURE__ */ m(function() {
287
+ return s.records.commits;
288
+ }, "getCommits"), _ = /* @__PURE__ */ m(function() {
289
+ const t = [...s.records.commits.values()];
290
+ return t.forEach(function(r) {
291
+ w.debug(r.id);
292
+ }), t.sort((r, e) => r.seq - e.seq), t;
293
+ }, "getCommitsArray"), Tr = /* @__PURE__ */ m(function() {
294
+ return s.records.currBranch;
295
+ }, "getCurrentBranch"), Mr = /* @__PURE__ */ m(function() {
296
+ return s.records.direction;
297
+ }, "getDirection"), Ar = /* @__PURE__ */ m(function() {
298
+ return s.records.head;
299
+ }, "getHead"), V = {
300
+ commitType: u,
301
+ getConfig: O,
302
+ setDirection: pr,
303
+ setOptions: xr,
304
+ getOptions: fr,
305
+ commit: ur,
306
+ branch: br,
307
+ merge: wr,
308
+ cherryPick: Br,
309
+ checkout: F,
310
+ //reset,
311
+ prettyPrint: Er,
312
+ clear: vr,
313
+ getBranchesAsObjArray: kr,
314
+ getBranches: Cr,
315
+ getCommits: Lr,
316
+ getCommitsArray: _,
317
+ getCurrentBranch: Tr,
318
+ getDirection: Mr,
319
+ getHead: Ar,
320
+ setAccTitle: nr,
321
+ getAccTitle: cr,
322
+ getAccDescription: ir,
323
+ setAccDescription: ar,
324
+ setDiagramTitle: sr,
325
+ getDiagramTitle: dr
326
+ }, Pr = /* @__PURE__ */ m((t, r) => {
327
+ U(t, r), t.dir && r.setDirection(t.dir);
328
+ for (const e of t.statements)
329
+ Rr(e, r);
330
+ }, "populate"), Rr = /* @__PURE__ */ m((t, r) => {
331
+ const e = {
332
+ Commit: /* @__PURE__ */ m((c) => r.commit(Gr(c)), "Commit"),
333
+ Branch: /* @__PURE__ */ m((c) => r.branch(Ir(c)), "Branch"),
334
+ Merge: /* @__PURE__ */ m((c) => r.merge(Or(c)), "Merge"),
335
+ Checkout: /* @__PURE__ */ m((c) => r.checkout(qr(c)), "Checkout"),
336
+ CherryPicking: /* @__PURE__ */ m((c) => r.cherryPick(Hr(c)), "CherryPicking")
337
+ }[t.$type];
338
+ e ? e(t) : w.error(`Unknown statement type: ${t.$type}`);
339
+ }, "parseStatement"), Gr = /* @__PURE__ */ m((t) => ({
340
+ id: t.id,
341
+ msg: t.message ?? "",
342
+ type: t.type !== void 0 ? u[t.type] : u.NORMAL,
343
+ tags: t.tags ?? void 0
344
+ }), "parseCommit"), Ir = /* @__PURE__ */ m((t) => ({
345
+ name: t.name,
346
+ order: t.order ?? 0
347
+ }), "parseBranch"), Or = /* @__PURE__ */ m((t) => ({
348
+ branch: t.branch,
349
+ id: t.id ?? "",
350
+ type: t.type !== void 0 ? u[t.type] : void 0,
351
+ tags: t.tags ?? void 0
352
+ }), "parseMerge"), qr = /* @__PURE__ */ m((t) => t.branch, "parseCheckout"), Hr = /* @__PURE__ */ m((t) => {
353
+ var r;
354
+ return {
355
+ id: t.id,
356
+ targetId: "",
357
+ tags: ((r = t.tags) == null ? void 0 : r.length) === 0 ? void 0 : t.tags,
358
+ parent: t.parent
359
+ };
360
+ }, "parseCherryPicking"), zr = {
361
+ parse: /* @__PURE__ */ m(async (t) => {
362
+ const r = await yr("gitGraph", t);
363
+ w.debug(r), Pr(r, V);
364
+ }, "parse")
365
+ }, W = rr(), E = W == null ? void 0 : W.gitGraph, R = 10, G = 40, L = 4, M = 2, I = 8, v = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map(), z = 30, q = /* @__PURE__ */ new Map(), S = [], P = 0, x = "LR", Sr = /* @__PURE__ */ m(() => {
366
+ v.clear(), k.clear(), q.clear(), P = 0, S = [], x = "LR";
367
+ }, "clear"), J = /* @__PURE__ */ m((t) => {
368
+ const r = document.createElementNS("http://www.w3.org/2000/svg", "text");
369
+ return (typeof t == "string" ? t.split(/\\n|\n|<br\s*\/?>/gi) : t).forEach((e) => {
370
+ const c = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
371
+ c.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), c.setAttribute("dy", "1em"), c.setAttribute("x", "0"), c.setAttribute("class", "row"), c.textContent = e.trim(), r.appendChild(c);
372
+ }), r;
373
+ }, "drawText"), Q = /* @__PURE__ */ m((t) => {
374
+ let r, e, c;
375
+ return x === "BT" ? (e = /* @__PURE__ */ m((i, a) => i <= a, "comparisonFunc"), c = 1 / 0) : (e = /* @__PURE__ */ m((i, a) => i >= a, "comparisonFunc"), c = 0), t.forEach((i) => {
376
+ var a, h;
377
+ const d = x === "TB" || x == "BT" ? (a = k.get(i)) == null ? void 0 : a.y : (h = k.get(i)) == null ? void 0 : h.x;
378
+ d !== void 0 && e(d, c) && (r = i, c = d);
379
+ }), r;
380
+ }, "findClosestParent"), Dr = /* @__PURE__ */ m((t) => {
381
+ let r = "", e = 1 / 0;
382
+ return t.forEach((c) => {
383
+ const i = k.get(c).y;
384
+ i <= e && (r = c, e = i);
385
+ }), r || void 0;
386
+ }, "findClosestParentBT"), Nr = /* @__PURE__ */ m((t, r, e) => {
387
+ let c = e, i = e;
388
+ const a = [];
389
+ t.forEach((h) => {
390
+ const d = r.get(h);
391
+ if (!d)
392
+ throw new Error(`Commit not found for key ${h}`);
393
+ d.parents.length ? (c = Wr(d), i = Math.max(c, i)) : a.push(d), Kr(d, c);
394
+ }), c = i, a.forEach((h) => {
395
+ Yr(h, c, e);
396
+ }), t.forEach((h) => {
397
+ const d = r.get(h);
398
+ if (d != null && d.parents.length) {
399
+ const l = Dr(d.parents);
400
+ c = k.get(l).y - G, c <= i && (i = c);
401
+ const o = v.get(d.branch).pos, n = c - R;
402
+ k.set(d.id, { x: o, y: n });
403
+ }
404
+ });
405
+ }, "setParallelBTPos"), jr = /* @__PURE__ */ m((t) => {
406
+ var r;
407
+ const e = Q(t.parents.filter((i) => i !== null));
408
+ if (!e)
409
+ throw new Error(`Closest parent not found for commit ${t.id}`);
410
+ const c = (r = k.get(e)) == null ? void 0 : r.y;
411
+ if (c === void 0)
412
+ throw new Error(`Closest parent position not found for commit ${t.id}`);
413
+ return c;
414
+ }, "findClosestParentPos"), Wr = /* @__PURE__ */ m((t) => jr(t) + G, "calculateCommitPosition"), Kr = /* @__PURE__ */ m((t, r) => {
415
+ const e = v.get(t.branch);
416
+ if (!e)
417
+ throw new Error(`Branch not found for commit ${t.id}`);
418
+ const c = e.pos, i = r + R;
419
+ return k.set(t.id, { x: c, y: i }), { x: c, y: i };
420
+ }, "setCommitPosition"), Yr = /* @__PURE__ */ m((t, r, e) => {
421
+ const c = v.get(t.branch);
422
+ if (!c)
423
+ throw new Error(`Branch not found for commit ${t.id}`);
424
+ const i = r + e, a = c.pos;
425
+ k.set(t.id, { x: a, y: i });
426
+ }, "setRootPosition"), Fr = /* @__PURE__ */ m((t, r, e, c, i, a) => {
427
+ if (a === u.HIGHLIGHT)
428
+ t.append("rect").attr("x", e.x - 10).attr("y", e.y - 10).attr("width", 20).attr("height", 20).attr(
429
+ "class",
430
+ `commit ${r.id} commit-highlight${i % I} ${c}-outer`
431
+ ), t.append("rect").attr("x", e.x - 6).attr("y", e.y - 6).attr("width", 12).attr("height", 12).attr(
432
+ "class",
433
+ `commit ${r.id} commit${i % I} ${c}-inner`
434
+ );
435
+ else if (a === u.CHERRY_PICK)
436
+ t.append("circle").attr("cx", e.x).attr("cy", e.y).attr("r", 10).attr("class", `commit ${r.id} ${c}`), t.append("circle").attr("cx", e.x - 3).attr("cy", e.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${r.id} ${c}`), t.append("circle").attr("cx", e.x + 3).attr("cy", e.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${r.id} ${c}`), t.append("line").attr("x1", e.x + 3).attr("y1", e.y + 1).attr("x2", e.x).attr("y2", e.y - 5).attr("stroke", "#fff").attr("class", `commit ${r.id} ${c}`), t.append("line").attr("x1", e.x - 3).attr("y1", e.y + 1).attr("x2", e.x).attr("y2", e.y - 5).attr("stroke", "#fff").attr("class", `commit ${r.id} ${c}`);
437
+ else {
438
+ const h = t.append("circle");
439
+ if (h.attr("cx", e.x), h.attr("cy", e.y), h.attr("r", r.type === u.MERGE ? 9 : 10), h.attr("class", `commit ${r.id} commit${i % I}`), a === u.MERGE) {
440
+ const d = t.append("circle");
441
+ d.attr("cx", e.x), d.attr("cy", e.y), d.attr("r", 6), d.attr(
442
+ "class",
443
+ `commit ${c} ${r.id} commit${i % I}`
444
+ );
445
+ }
446
+ a === u.REVERSE && t.append("path").attr(
447
+ "d",
448
+ `M ${e.x - 5},${e.y - 5}L${e.x + 5},${e.y + 5}M${e.x - 5},${e.y + 5}L${e.x + 5},${e.y - 5}`
449
+ ).attr("class", `commit ${c} ${r.id} commit${i % I}`);
450
+ }
451
+ }, "drawCommitBullet"), _r = /* @__PURE__ */ m((t, r, e, c) => {
452
+ var i;
453
+ if (r.type !== u.CHERRY_PICK && (r.customId && r.type === u.MERGE || r.type !== u.MERGE) && E != null && E.showCommitLabel) {
454
+ const a = t.append("g"), h = a.insert("rect").attr("class", "commit-label-bkg"), d = a.append("text").attr("x", c).attr("y", e.y + 25).attr("class", "commit-label").text(r.id), l = (i = d.node()) == null ? void 0 : i.getBBox();
455
+ if (l && (h.attr("x", e.posWithOffset - l.width / 2 - M).attr("y", e.y + 13.5).attr("width", l.width + 2 * M).attr("height", l.height + 2 * M), x === "TB" || x === "BT" ? (h.attr("x", e.x - (l.width + 4 * L + 5)).attr("y", e.y - 12), d.attr("x", e.x - (l.width + 4 * L)).attr("y", e.y + l.height - 12)) : d.attr("x", e.posWithOffset - l.width / 2), E.rotateCommitLabel))
456
+ if (x === "TB" || x === "BT")
457
+ d.attr(
458
+ "transform",
459
+ "rotate(-45, " + e.x + ", " + e.y + ")"
460
+ ), h.attr(
461
+ "transform",
462
+ "rotate(-45, " + e.x + ", " + e.y + ")"
463
+ );
464
+ else {
465
+ const o = -7.5 - (l.width + 10) / 25 * 9.5, n = 10 + l.width / 25 * 8.5;
466
+ a.attr(
467
+ "transform",
468
+ "translate(" + o + ", " + n + ") rotate(-45, " + c + ", " + e.y + ")"
469
+ );
470
+ }
471
+ }
472
+ }, "drawCommitLabel"), Vr = /* @__PURE__ */ m((t, r, e, c) => {
473
+ var i;
474
+ if (r.tags.length > 0) {
475
+ let a = 0, h = 0, d = 0;
476
+ const l = [];
477
+ for (const o of r.tags.reverse()) {
478
+ const n = t.insert("polygon"), f = t.append("circle"), $ = t.append("text").attr("y", e.y - 16 - a).attr("class", "tag-label").text(o), y = (i = $.node()) == null ? void 0 : i.getBBox();
479
+ if (!y)
480
+ throw new Error("Tag bbox not found");
481
+ h = Math.max(h, y.width), d = Math.max(d, y.height), $.attr("x", e.posWithOffset - y.width / 2), l.push({
482
+ tag: $,
483
+ hole: f,
484
+ rect: n,
485
+ yOffset: a
486
+ }), a += 20;
487
+ }
488
+ for (const { tag: o, hole: n, rect: f, yOffset: $ } of l) {
489
+ const y = d / 2, p = e.y - 19.2 - $;
490
+ if (f.attr("class", "tag-label-bkg").attr(
491
+ "points",
492
+ `
493
+ ${c - h / 2 - L / 2},${p + M}
494
+ ${c - h / 2 - L / 2},${p - M}
495
+ ${e.posWithOffset - h / 2 - L},${p - y - M}
496
+ ${e.posWithOffset + h / 2 + L},${p - y - M}
497
+ ${e.posWithOffset + h / 2 + L},${p + y + M}
498
+ ${e.posWithOffset - h / 2 - L},${p + y + M}`
499
+ ), n.attr("cy", p).attr("cx", c - h / 2 + L / 2).attr("r", 1.5).attr("class", "tag-hole"), x === "TB" || x === "BT") {
500
+ const g = c + $;
501
+ f.attr("class", "tag-label-bkg").attr(
502
+ "points",
503
+ `
504
+ ${e.x},${g + 2}
505
+ ${e.x},${g - 2}
506
+ ${e.x + R},${g - y - 2}
507
+ ${e.x + R + h + 4},${g - y - 2}
508
+ ${e.x + R + h + 4},${g + y + 2}
509
+ ${e.x + R},${g + y + 2}`
510
+ ).attr("transform", "translate(12,12) rotate(45, " + e.x + "," + c + ")"), n.attr("cx", e.x + L / 2).attr("cy", g).attr("transform", "translate(12,12) rotate(45, " + e.x + "," + c + ")"), o.attr("x", e.x + 5).attr("y", g + 3).attr("transform", "translate(14,14) rotate(45, " + e.x + "," + c + ")");
511
+ }
512
+ }
513
+ }
514
+ }, "drawCommitTags"), Jr = /* @__PURE__ */ m((t) => {
515
+ switch (t.customType ?? t.type) {
516
+ case u.NORMAL:
517
+ return "commit-normal";
518
+ case u.REVERSE:
519
+ return "commit-reverse";
520
+ case u.HIGHLIGHT:
521
+ return "commit-highlight";
522
+ case u.MERGE:
523
+ return "commit-merge";
524
+ case u.CHERRY_PICK:
525
+ return "commit-cherry-pick";
526
+ default:
527
+ return "commit-normal";
528
+ }
529
+ }, "getCommitClassType"), Qr = /* @__PURE__ */ m((t, r, e, c) => {
530
+ const i = { x: 0, y: 0 };
531
+ if (t.parents.length > 0) {
532
+ const a = Q(t.parents);
533
+ if (a) {
534
+ const h = c.get(a) ?? i;
535
+ return r === "TB" ? h.y + G : r === "BT" ? (c.get(t.id) ?? i).y - G : h.x + G;
536
+ }
537
+ } else
538
+ return r === "TB" ? z : r === "BT" ? (c.get(t.id) ?? i).y - G : 0;
539
+ return 0;
540
+ }, "calculatePosition"), Ur = /* @__PURE__ */ m((t, r, e) => {
541
+ var c, i;
542
+ const a = x === "BT" && e ? r : r + R, h = x === "TB" || x === "BT" ? a : (c = v.get(t.branch)) == null ? void 0 : c.pos, d = x === "TB" || x === "BT" ? (i = v.get(t.branch)) == null ? void 0 : i.pos : a;
543
+ if (d === void 0 || h === void 0)
544
+ throw new Error(`Position were undefined for commit ${t.id}`);
545
+ return { x: d, y: h, posWithOffset: a };
546
+ }, "getCommitPosition"), K = /* @__PURE__ */ m((t, r, e) => {
547
+ if (!E)
548
+ throw new Error("GitGraph config not found");
549
+ const c = t.append("g").attr("class", "commit-bullets"), i = t.append("g").attr("class", "commit-labels");
550
+ let a = x === "TB" || x === "BT" ? z : 0;
551
+ const h = [...r.keys()], d = (E == null ? void 0 : E.parallelCommits) ?? !1, l = /* @__PURE__ */ m((n, f) => {
552
+ var $, y;
553
+ const p = ($ = r.get(n)) == null ? void 0 : $.seq, g = (y = r.get(f)) == null ? void 0 : y.seq;
554
+ return p !== void 0 && g !== void 0 ? p - g : 0;
555
+ }, "sortKeys");
556
+ let o = h.sort(l);
557
+ x === "BT" && (d && Nr(o, r, a), o = o.reverse()), o.forEach((n) => {
558
+ var f;
559
+ const $ = r.get(n);
560
+ if (!$)
561
+ throw new Error(`Commit not found for key ${n}`);
562
+ d && (a = Qr($, x, a, k));
563
+ const y = Ur($, a, d);
564
+ if (e) {
565
+ const p = Jr($), g = $.customType ?? $.type, T = ((f = v.get($.branch)) == null ? void 0 : f.index) ?? 0;
566
+ Fr(c, $, y, p, T, g), _r(i, $, y, a), Vr(i, $, y, a);
567
+ }
568
+ x === "TB" || x === "BT" ? k.set($.id, { x: y.x, y: y.posWithOffset }) : k.set($.id, { x: y.posWithOffset, y: y.y }), a = x === "BT" && d ? a + G : a + G + R, a > P && (P = a);
569
+ });
570
+ }, "drawCommits"), Xr = /* @__PURE__ */ m((t, r, e, c, i) => {
571
+ const a = (x === "TB" || x === "BT" ? e.x < c.x : e.y < c.y) ? r.branch : t.branch, h = /* @__PURE__ */ m((l) => l.branch === a, "isOnBranchToGetCurve"), d = /* @__PURE__ */ m((l) => l.seq > t.seq && l.seq < r.seq, "isBetweenCommits");
572
+ return [...i.values()].some((l) => d(l) && h(l));
573
+ }, "shouldRerouteArrow"), H = /* @__PURE__ */ m((t, r, e = 0) => {
574
+ const c = t + Math.abs(t - r) / 2;
575
+ if (e > 5)
576
+ return c;
577
+ if (S.every((a) => Math.abs(a - c) >= 10))
578
+ return S.push(c), c;
579
+ const i = Math.abs(t - r);
580
+ return H(t, r - i / 5, e + 1);
581
+ }, "findLane"), Zr = /* @__PURE__ */ m((t, r, e, c) => {
582
+ var i, a, h, d, l;
583
+ const o = k.get(r.id), n = k.get(e.id);
584
+ if (o === void 0 || n === void 0)
585
+ throw new Error(`Commit positions not found for commits ${r.id} and ${e.id}`);
586
+ const f = Xr(r, e, o, n, c);
587
+ let $ = "", y = "", p = 0, g = 0, T = (i = v.get(e.branch)) == null ? void 0 : i.index;
588
+ e.type === u.MERGE && r.id !== e.parents[0] && (T = (a = v.get(r.branch)) == null ? void 0 : a.index);
589
+ let b;
590
+ if (f) {
591
+ $ = "A 10 10, 0, 0, 0,", y = "A 10 10, 0, 0, 1,", p = 10, g = 10;
592
+ const A = o.y < n.y ? H(o.y, n.y) : H(n.y, o.y), B = o.x < n.x ? H(o.x, n.x) : H(n.x, o.x);
593
+ x === "TB" ? o.x < n.x ? b = `M ${o.x} ${o.y} L ${B - p} ${o.y} ${y} ${B} ${o.y + g} L ${B} ${n.y - p} ${$} ${B + g} ${n.y} L ${n.x} ${n.y}` : (T = (h = v.get(r.branch)) == null ? void 0 : h.index, b = `M ${o.x} ${o.y} L ${B + p} ${o.y} ${$} ${B} ${o.y + g} L ${B} ${n.y - p} ${y} ${B - g} ${n.y} L ${n.x} ${n.y}`) : x === "BT" ? o.x < n.x ? b = `M ${o.x} ${o.y} L ${B - p} ${o.y} ${$} ${B} ${o.y - g} L ${B} ${n.y + p} ${y} ${B + g} ${n.y} L ${n.x} ${n.y}` : (T = (d = v.get(r.branch)) == null ? void 0 : d.index, b = `M ${o.x} ${o.y} L ${B + p} ${o.y} ${y} ${B} ${o.y - g} L ${B} ${n.y + p} ${$} ${B - g} ${n.y} L ${n.x} ${n.y}`) : o.y < n.y ? b = `M ${o.x} ${o.y} L ${o.x} ${A - p} ${$} ${o.x + g} ${A} L ${n.x - p} ${A} ${y} ${n.x} ${A + g} L ${n.x} ${n.y}` : (T = (l = v.get(r.branch)) == null ? void 0 : l.index, b = `M ${o.x} ${o.y} L ${o.x} ${A + p} ${y} ${o.x + g} ${A} L ${n.x - p} ${A} ${$} ${n.x} ${A - g} L ${n.x} ${n.y}`);
594
+ } else
595
+ $ = "A 20 20, 0, 0, 0,", y = "A 20 20, 0, 0, 1,", p = 20, g = 20, x === "TB" ? (o.x < n.x && (e.type === u.MERGE && r.id !== e.parents[0] ? b = `M ${o.x} ${o.y} L ${o.x} ${n.y - p} ${$} ${o.x + g} ${n.y} L ${n.x} ${n.y}` : b = `M ${o.x} ${o.y} L ${n.x - p} ${o.y} ${y} ${n.x} ${o.y + g} L ${n.x} ${n.y}`), o.x > n.x && ($ = "A 20 20, 0, 0, 0,", y = "A 20 20, 0, 0, 1,", p = 20, g = 20, e.type === u.MERGE && r.id !== e.parents[0] ? b = `M ${o.x} ${o.y} L ${o.x} ${n.y - p} ${y} ${o.x - g} ${n.y} L ${n.x} ${n.y}` : b = `M ${o.x} ${o.y} L ${n.x + p} ${o.y} ${$} ${n.x} ${o.y + g} L ${n.x} ${n.y}`), o.x === n.x && (b = `M ${o.x} ${o.y} L ${n.x} ${n.y}`)) : x === "BT" ? (o.x < n.x && (e.type === u.MERGE && r.id !== e.parents[0] ? b = `M ${o.x} ${o.y} L ${o.x} ${n.y + p} ${y} ${o.x + g} ${n.y} L ${n.x} ${n.y}` : b = `M ${o.x} ${o.y} L ${n.x - p} ${o.y} ${$} ${n.x} ${o.y - g} L ${n.x} ${n.y}`), o.x > n.x && ($ = "A 20 20, 0, 0, 0,", y = "A 20 20, 0, 0, 1,", p = 20, g = 20, e.type === u.MERGE && r.id !== e.parents[0] ? b = `M ${o.x} ${o.y} L ${o.x} ${n.y + p} ${$} ${o.x - g} ${n.y} L ${n.x} ${n.y}` : b = `M ${o.x} ${o.y} L ${n.x - p} ${o.y} ${$} ${n.x} ${o.y - g} L ${n.x} ${n.y}`), o.x === n.x && (b = `M ${o.x} ${o.y} L ${n.x} ${n.y}`)) : (o.y < n.y && (e.type === u.MERGE && r.id !== e.parents[0] ? b = `M ${o.x} ${o.y} L ${n.x - p} ${o.y} ${y} ${n.x} ${o.y + g} L ${n.x} ${n.y}` : b = `M ${o.x} ${o.y} L ${o.x} ${n.y - p} ${$} ${o.x + g} ${n.y} L ${n.x} ${n.y}`), o.y > n.y && (e.type === u.MERGE && r.id !== e.parents[0] ? b = `M ${o.x} ${o.y} L ${n.x - p} ${o.y} ${$} ${n.x} ${o.y - g} L ${n.x} ${n.y}` : b = `M ${o.x} ${o.y} L ${o.x} ${n.y + p} ${y} ${o.x + g} ${n.y} L ${n.x} ${n.y}`), o.y === n.y && (b = `M ${o.x} ${o.y} L ${n.x} ${n.y}`));
596
+ if (b === void 0)
597
+ throw new Error("Line definition not found");
598
+ t.append("path").attr("d", b).attr("class", "arrow arrow" + T % I);
599
+ }, "drawArrow"), rt = /* @__PURE__ */ m((t, r) => {
600
+ const e = t.append("g").attr("class", "commit-arrows");
601
+ [...r.keys()].forEach((c) => {
602
+ const i = r.get(c);
603
+ i.parents && i.parents.length > 0 && i.parents.forEach((a) => {
604
+ Zr(e, r.get(a), i, r);
605
+ });
606
+ });
607
+ }, "drawArrows"), tt = /* @__PURE__ */ m((t, r) => {
608
+ const e = t.append("g");
609
+ r.forEach((c, i) => {
610
+ var a;
611
+ const h = i % I, d = (a = v.get(c.name)) == null ? void 0 : a.pos;
612
+ if (d === void 0)
613
+ throw new Error(`Position not found for branch ${c.name}`);
614
+ const l = e.append("line");
615
+ l.attr("x1", 0), l.attr("y1", d), l.attr("x2", P), l.attr("y2", d), l.attr("class", "branch branch" + h), x === "TB" ? (l.attr("y1", z), l.attr("x1", d), l.attr("y2", P), l.attr("x2", d)) : x === "BT" && (l.attr("y1", P), l.attr("x1", d), l.attr("y2", z), l.attr("x2", d)), S.push(d);
616
+ const o = c.name, n = J(o), f = e.insert("rect"), $ = e.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + h);
617
+ $.node().appendChild(n);
618
+ const y = n.getBBox();
619
+ f.attr("class", "branchLabelBkg label" + h).attr("rx", 4).attr("ry", 4).attr("x", -y.width - 4 - ((E == null ? void 0 : E.rotateCommitLabel) === !0 ? 30 : 0)).attr("y", -y.height / 2 + 8).attr("width", y.width + 18).attr("height", y.height + 4), $.attr(
620
+ "transform",
621
+ "translate(" + (-y.width - 14 - ((E == null ? void 0 : E.rotateCommitLabel) === !0 ? 30 : 0)) + ", " + (d - y.height / 2 - 1) + ")"
622
+ ), x === "TB" ? (f.attr("x", d - y.width / 2 - 10).attr("y", 0), $.attr("transform", "translate(" + (d - y.width / 2 - 5) + ", 0)")) : x === "BT" ? (f.attr("x", d - y.width / 2 - 10).attr("y", P), $.attr("transform", "translate(" + (d - y.width / 2 - 5) + ", " + P + ")")) : f.attr("transform", "translate(-19, " + (d - y.height / 2) + ")");
623
+ });
624
+ }, "drawBranches"), et = /* @__PURE__ */ m(function(t, r, e, c, i) {
625
+ return v.set(t, { pos: r, index: e }), r += 50 + (i ? 40 : 0) + (x === "TB" || x === "BT" ? c.width / 2 : 0), r;
626
+ }, "setBranchPosition"), ot = /* @__PURE__ */ m(function(t, r, e, c) {
627
+ if (Sr(), w.debug("in gitgraph renderer", t + `
628
+ `, "id:", r, e), !E)
629
+ throw new Error("GitGraph config not found");
630
+ const i = E.rotateCommitLabel ?? !1, a = c.db;
631
+ q = a.getCommits();
632
+ const h = a.getBranchesAsObjArray();
633
+ x = a.getDirection();
634
+ const d = $r(`[id="${r}"]`);
635
+ let l = 0;
636
+ h.forEach((o, n) => {
637
+ var f;
638
+ const $ = J(o.name), y = d.append("g"), p = y.insert("g").attr("class", "branchLabel"), g = p.insert("g").attr("class", "label branch-label");
639
+ (f = g.node()) == null || f.appendChild($);
640
+ const T = $.getBBox();
641
+ l = et(o.name, l, n, T, i), g.remove(), p.remove(), y.remove();
642
+ }), K(d, q, !1), E.showBranches && tt(d, h), rt(d, q), K(d, q, !0), mr.insertTitle(
643
+ d,
644
+ "gitTitleText",
645
+ E.titleTopMargin ?? 0,
646
+ a.getDiagramTitle()
647
+ ), lr(
648
+ void 0,
649
+ d,
650
+ E.diagramPadding,
651
+ E.useMaxWidth
652
+ );
653
+ }, "draw"), nt = {
654
+ draw: ot
655
+ }, ct = /* @__PURE__ */ m((t) => `
656
+ .commit-id,
657
+ .commit-msg,
658
+ .branch-label {
659
+ fill: lightgrey;
660
+ color: lightgrey;
661
+ font-family: 'trebuchet ms', verdana, arial, sans-serif;
662
+ font-family: var(--mermaid-font-family);
663
+ }
664
+ ${[0, 1, 2, 3, 4, 5, 6, 7].map(
665
+ (r) => `
666
+ .branch-label${r} { fill: ${t["gitBranchLabel" + r]}; }
667
+ .commit${r} { stroke: ${t["git" + r]}; fill: ${t["git" + r]}; }
668
+ .commit-highlight${r} { stroke: ${t["gitInv" + r]}; fill: ${t["gitInv" + r]}; }
669
+ .label${r} { fill: ${t["git" + r]}; }
670
+ .arrow${r} { stroke: ${t["git" + r]}; }
671
+ `
672
+ ).join(`
673
+ `)}
674
+
675
+ .branch {
676
+ stroke-width: 1;
677
+ stroke: ${t.lineColor};
678
+ stroke-dasharray: 2;
679
+ }
680
+ .commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};}
681
+ .commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; }
682
+ .tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}
683
+ .tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; }
684
+ .tag-hole { fill: ${t.textColor}; }
685
+
686
+ .commit-merge {
687
+ stroke: ${t.primaryColor};
688
+ fill: ${t.primaryColor};
689
+ }
690
+ .commit-reverse {
691
+ stroke: ${t.primaryColor};
692
+ fill: ${t.primaryColor};
693
+ stroke-width: 3;
694
+ }
695
+ .commit-highlight-outer {
696
+ }
697
+ .commit-highlight-inner {
698
+ stroke: ${t.primaryColor};
699
+ fill: ${t.primaryColor};
700
+ }
701
+
702
+ .arrow { stroke-width: 8; stroke-linecap: round; fill: none}
703
+ .gitTitleText {
704
+ text-anchor: middle;
705
+ font-size: 18px;
706
+ fill: ${t.textColor};
707
+ }
708
+ `, "getStyles"), it = ct, gt = {
709
+ parser: zr,
710
+ db: V,
711
+ renderer: nt,
712
+ styles: it
713
+ };
714
+ export {
715
+ gt as diagram
716
+ };