bg-editor 0.0.1

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 (67) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +51 -0
  3. package/README.zh-CN.md +51 -0
  4. package/dist/_basePickBy-4kmg42pS.js +158 -0
  5. package/dist/_baseUniq-WOvvCHTI.js +621 -0
  6. package/dist/arc-wItjmL5I.js +90 -0
  7. package/dist/architecture-U656AL7Q-FYDwFSxk.js +12 -0
  8. package/dist/architectureDiagram-VXUJARFQ-iG5MkBjx.js +4666 -0
  9. package/dist/blockDiagram-VD42YOAC-i2GlXmWy.js +2268 -0
  10. package/dist/c4Diagram-YG6GDRKO-IufO7T1R.js +1587 -0
  11. package/dist/channel-Dah4F59k.js +12 -0
  12. package/dist/chunk-4BX2VUAB-5_v9rnje.js +15 -0
  13. package/dist/chunk-55IACEB6-BDNtSypP.js +15 -0
  14. package/dist/chunk-B4BG7PRW-DzaYPsfW.js +1382 -0
  15. package/dist/chunk-DI55MBZ5-Buwrprkw.js +1377 -0
  16. package/dist/chunk-FMBD7UC4-BaEPEIWb.js +26 -0
  17. package/dist/chunk-QN33PNHL-DhbA7i5G.js +26 -0
  18. package/dist/chunk-QZHKN3VN-BAb_D1oz.js +22 -0
  19. package/dist/chunk-TZMSLE5B-OU1MJ2do.js +71 -0
  20. package/dist/classDiagram-2ON5EDUG-KStC8v09.js +23 -0
  21. package/dist/classDiagram-v2-WZHVMYZB-KStC8v09.js +23 -0
  22. package/dist/clone-C74UiRbr.js +15 -0
  23. package/dist/cose-bilkent-S5V4N54A-eRXCoix2.js +2612 -0
  24. package/dist/cytoscape.esm-BG3R4uVs.js +18738 -0
  25. package/dist/dagre-6UL2VRFP-Bi83jPQf.js +451 -0
  26. package/dist/defaultLocale-DgmhL6Re.js +178 -0
  27. package/dist/diagram-PSM6KHXK-aW98k2-4.js +539 -0
  28. package/dist/diagram-QEK2KX5R-BR--iNM5.js +224 -0
  29. package/dist/diagram-S2PKOQOG-NTnEy5_O.js +149 -0
  30. package/dist/erDiagram-Q2GNP2WA-C8oZ5c-S.js +848 -0
  31. package/dist/flowDiagram-NV44I4VS-DiKad3Bb.js +1627 -0
  32. package/dist/ganttDiagram-LVOFAZNH-CthzjjJq.js +2506 -0
  33. package/dist/gitGraph-F6HP7TQM-CuXAC0XT.js +12 -0
  34. package/dist/gitGraphDiagram-NY62KEGX-d4KszKqi.js +706 -0
  35. package/dist/graph-CnOTx4E0.js +254 -0
  36. package/dist/index-D6-Wf75-.js +122127 -0
  37. package/dist/info-NVLQJR56-Dhmtdc7O.js +12 -0
  38. package/dist/infoDiagram-ER5ION4S-DedidjTu.js +31 -0
  39. package/dist/init-d639unba.js +23 -0
  40. package/dist/journeyDiagram-XKPGCS4Q-BylvmUWL.js +843 -0
  41. package/dist/kanban-definition-3W4ZIXB7-DGV_aVgU.js +725 -0
  42. package/dist/layout-OXk4OSoz.js +1342 -0
  43. package/dist/linear-CO_vz87n.js +266 -0
  44. package/dist/mermaid-parser.core-CYtF6phW.js +12928 -0
  45. package/dist/mindmap-definition-VGOIOE7T-BU05Y6Vz.js +790 -0
  46. package/dist/ordinal-CofNqUw2.js +68 -0
  47. package/dist/packet-BFZMPI3H-D7H_8Q-U.js +12 -0
  48. package/dist/pie-7BOR55EZ-BNWNcO5Z.js +12 -0
  49. package/dist/pieDiagram-ADFJNKIX-reGTUsiW.js +168 -0
  50. package/dist/quadrantDiagram-AYHSOK5B-NeHOJ0lX.js +1029 -0
  51. package/dist/radar-NHE76QYJ-DrVEcvh1.js +12 -0
  52. package/dist/requirementDiagram-UZGBJVZJ-BE76XNaT.js +857 -0
  53. package/dist/sankeyDiagram-TZEHDZUN-UHfMLEKl.js +817 -0
  54. package/dist/sequenceDiagram-WL72ISMW-62KWnVbh.js +2518 -0
  55. package/dist/stateDiagram-FKZM4ZOC--_CkWvu6.js +270 -0
  56. package/dist/stateDiagram-v2-4FDKWEC3-Dj7ZjAmI.js +23 -0
  57. package/dist/style.css +1 -0
  58. package/dist/timeline-definition-IT6M3QCI-C3Wb0xMN.js +804 -0
  59. package/dist/treemap-KMMF4GRG-Bc8F2dFd.js +12 -0
  60. package/dist/umo-editor.js +16 -0
  61. package/dist/xychartDiagram-PRI3JC2R-D2J307cO.js +1347 -0
  62. package/package.json +200 -0
  63. package/types/index.d.ts +277 -0
  64. package/types/src/components/index.d.ts +9 -0
  65. package/types/src/components/menus/button.vue.d.ts +583 -0
  66. package/types/src/components/modal.vue.d.ts +2 -0
  67. package/types/src/components/tooltip.vue.d.ts +27 -0
@@ -0,0 +1,1347 @@
1
+ import "./style.css";
2
+ import { _ as a, s as gi, g as xi, q as Xt, p as di, a as fi, b as pi, l as Nt, H as mi, e as yi, y as bi, E as St, D as Yt, F as Ai, K as wi, i as Ci, aF as Si, R as Wt } from "./index-D6-Wf75-.js";
3
+ import { i as _i } from "./init-d639unba.js";
4
+ import { o as ki } from "./ordinal-CofNqUw2.js";
5
+ import { l as zt } from "./linear-CO_vz87n.js";
6
+ /**
7
+ * @umoteam/editor 9.0.1
8
+ * @license MIT
9
+ * @author umodoc https://www.umodoc.com
10
+ * @see https://www.umodoc.com
11
+ **/
12
+ function Ri(e, t, i) {
13
+ e = +e, t = +t, i = (n = arguments.length) < 2 ? (t = e, e = 0, 1) : n < 3 ? 1 : +i;
14
+ for (var s = -1, n = Math.max(0, Math.ceil((t - e) / i)) | 0, o = new Array(n); ++s < n; )
15
+ o[s] = e + s * i;
16
+ return o;
17
+ }
18
+ function yt() {
19
+ var e = ki().unknown(void 0), t = e.domain, i = e.range, s = 0, n = 1, o, g, m = !1, p = 0, k = 0, v = 0.5;
20
+ delete e.unknown;
21
+ function C() {
22
+ var b = t().length, E = n < s, D = E ? n : s, P = E ? s : n;
23
+ o = (P - D) / Math.max(1, b - p + k * 2), m && (o = Math.floor(o)), D += (P - D - o * (b - p)) * v, g = o * (1 - p), m && (D = Math.round(D), g = Math.round(g));
24
+ var I = Ri(b).map(function(y) {
25
+ return D + o * y;
26
+ });
27
+ return i(E ? I.reverse() : I);
28
+ }
29
+ return e.domain = function(b) {
30
+ return arguments.length ? (t(b), C()) : t();
31
+ }, e.range = function(b) {
32
+ return arguments.length ? ([s, n] = b, s = +s, n = +n, C()) : [s, n];
33
+ }, e.rangeRound = function(b) {
34
+ return [s, n] = b, s = +s, n = +n, m = !0, C();
35
+ }, e.bandwidth = function() {
36
+ return g;
37
+ }, e.step = function() {
38
+ return o;
39
+ }, e.round = function(b) {
40
+ return arguments.length ? (m = !!b, C()) : m;
41
+ }, e.padding = function(b) {
42
+ return arguments.length ? (p = Math.min(1, k = +b), C()) : p;
43
+ }, e.paddingInner = function(b) {
44
+ return arguments.length ? (p = Math.min(1, b), C()) : p;
45
+ }, e.paddingOuter = function(b) {
46
+ return arguments.length ? (k = +b, C()) : k;
47
+ }, e.align = function(b) {
48
+ return arguments.length ? (v = Math.max(0, Math.min(1, b)), C()) : v;
49
+ }, e.copy = function() {
50
+ return yt(t(), [s, n]).round(m).paddingInner(p).paddingOuter(k).align(v);
51
+ }, _i.apply(C(), arguments);
52
+ }
53
+ var bt = function() {
54
+ var e = /* @__PURE__ */ a(function(F, h, u, x) {
55
+ for (u = u || {}, x = F.length; x--; u[F[x]] = h) ;
56
+ return u;
57
+ }, "o"), t = [1, 10, 12, 14, 16, 18, 19, 21, 23], i = [2, 6], s = [1, 3], n = [1, 5], o = [1, 6], g = [1, 7], m = [1, 5, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], p = [1, 25], k = [1, 26], v = [1, 28], C = [1, 29], b = [1, 30], E = [1, 31], D = [1, 32], P = [1, 33], I = [1, 34], y = [1, 35], _ = [1, 36], c = [1, 37], W = [1, 43], z = [1, 42], U = [1, 47], X = [1, 50], l = [1, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], L = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36], S = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], R = [1, 64], $ = {
58
+ trace: /* @__PURE__ */ a(function() {
59
+ }, "trace"),
60
+ yy: {},
61
+ symbols_: { error: 2, start: 3, eol: 4, XYCHART: 5, chartConfig: 6, document: 7, CHART_ORIENTATION: 8, statement: 9, title: 10, text: 11, X_AXIS: 12, parseXAxis: 13, Y_AXIS: 14, parseYAxis: 15, LINE: 16, plotData: 17, BAR: 18, acc_title: 19, acc_title_value: 20, acc_descr: 21, acc_descr_value: 22, acc_descr_multiline_value: 23, SQUARE_BRACES_START: 24, commaSeparatedNumbers: 25, SQUARE_BRACES_END: 26, NUMBER_WITH_DECIMAL: 27, COMMA: 28, xAxisData: 29, bandData: 30, ARROW_DELIMITER: 31, commaSeparatedTexts: 32, yAxisData: 33, NEWLINE: 34, SEMI: 35, EOF: 36, alphaNum: 37, STR: 38, MD_STR: 39, alphaNumToken: 40, AMP: 41, NUM: 42, ALPHA: 43, PLUS: 44, EQUALS: 45, MULT: 46, DOT: 47, BRKT: 48, MINUS: 49, UNDERSCORE: 50, $accept: 0, $end: 1 },
62
+ terminals_: { 2: "error", 5: "XYCHART", 8: "CHART_ORIENTATION", 10: "title", 12: "X_AXIS", 14: "Y_AXIS", 16: "LINE", 18: "BAR", 19: "acc_title", 20: "acc_title_value", 21: "acc_descr", 22: "acc_descr_value", 23: "acc_descr_multiline_value", 24: "SQUARE_BRACES_START", 26: "SQUARE_BRACES_END", 27: "NUMBER_WITH_DECIMAL", 28: "COMMA", 31: "ARROW_DELIMITER", 34: "NEWLINE", 35: "SEMI", 36: "EOF", 38: "STR", 39: "MD_STR", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "PLUS", 45: "EQUALS", 46: "MULT", 47: "DOT", 48: "BRKT", 49: "MINUS", 50: "UNDERSCORE" },
63
+ productions_: [0, [3, 2], [3, 3], [3, 2], [3, 1], [6, 1], [7, 0], [7, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 3], [9, 2], [9, 3], [9, 2], [9, 2], [9, 1], [17, 3], [25, 3], [25, 1], [13, 1], [13, 2], [13, 1], [29, 1], [29, 3], [30, 3], [32, 3], [32, 1], [15, 1], [15, 2], [15, 1], [33, 3], [4, 1], [4, 1], [4, 1], [11, 1], [11, 1], [11, 1], [37, 1], [37, 2], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1]],
64
+ performAction: /* @__PURE__ */ a(function(h, u, x, d, w, r, at) {
65
+ var f = r.length - 1;
66
+ switch (w) {
67
+ case 5:
68
+ d.setOrientation(r[f]);
69
+ break;
70
+ case 9:
71
+ d.setDiagramTitle(r[f].text.trim());
72
+ break;
73
+ case 12:
74
+ d.setLineData({ text: "", type: "text" }, r[f]);
75
+ break;
76
+ case 13:
77
+ d.setLineData(r[f - 1], r[f]);
78
+ break;
79
+ case 14:
80
+ d.setBarData({ text: "", type: "text" }, r[f]);
81
+ break;
82
+ case 15:
83
+ d.setBarData(r[f - 1], r[f]);
84
+ break;
85
+ case 16:
86
+ this.$ = r[f].trim(), d.setAccTitle(this.$);
87
+ break;
88
+ case 17:
89
+ case 18:
90
+ this.$ = r[f].trim(), d.setAccDescription(this.$);
91
+ break;
92
+ case 19:
93
+ this.$ = r[f - 1];
94
+ break;
95
+ case 20:
96
+ this.$ = [Number(r[f - 2]), ...r[f]];
97
+ break;
98
+ case 21:
99
+ this.$ = [Number(r[f])];
100
+ break;
101
+ case 22:
102
+ d.setXAxisTitle(r[f]);
103
+ break;
104
+ case 23:
105
+ d.setXAxisTitle(r[f - 1]);
106
+ break;
107
+ case 24:
108
+ d.setXAxisTitle({ type: "text", text: "" });
109
+ break;
110
+ case 25:
111
+ d.setXAxisBand(r[f]);
112
+ break;
113
+ case 26:
114
+ d.setXAxisRangeData(Number(r[f - 2]), Number(r[f]));
115
+ break;
116
+ case 27:
117
+ this.$ = r[f - 1];
118
+ break;
119
+ case 28:
120
+ this.$ = [r[f - 2], ...r[f]];
121
+ break;
122
+ case 29:
123
+ this.$ = [r[f]];
124
+ break;
125
+ case 30:
126
+ d.setYAxisTitle(r[f]);
127
+ break;
128
+ case 31:
129
+ d.setYAxisTitle(r[f - 1]);
130
+ break;
131
+ case 32:
132
+ d.setYAxisTitle({ type: "text", text: "" });
133
+ break;
134
+ case 33:
135
+ d.setYAxisRangeData(Number(r[f - 2]), Number(r[f]));
136
+ break;
137
+ case 37:
138
+ this.$ = { text: r[f], type: "text" };
139
+ break;
140
+ case 38:
141
+ this.$ = { text: r[f], type: "text" };
142
+ break;
143
+ case 39:
144
+ this.$ = { text: r[f], type: "markdown" };
145
+ break;
146
+ case 40:
147
+ this.$ = r[f];
148
+ break;
149
+ case 41:
150
+ this.$ = r[f - 1] + "" + r[f];
151
+ break;
152
+ }
153
+ }, "anonymous"),
154
+ table: [e(t, i, { 3: 1, 4: 2, 7: 4, 5: s, 34: n, 35: o, 36: g }), { 1: [3] }, e(t, i, { 4: 2, 7: 4, 3: 8, 5: s, 34: n, 35: o, 36: g }), e(t, i, { 4: 2, 7: 4, 6: 9, 3: 10, 5: s, 8: [1, 11], 34: n, 35: o, 36: g }), { 1: [2, 4], 9: 12, 10: [1, 13], 12: [1, 14], 14: [1, 15], 16: [1, 16], 18: [1, 17], 19: [1, 18], 21: [1, 19], 23: [1, 20] }, e(m, [2, 34]), e(m, [2, 35]), e(m, [2, 36]), { 1: [2, 1] }, e(t, i, { 4: 2, 7: 4, 3: 21, 5: s, 34: n, 35: o, 36: g }), { 1: [2, 3] }, e(m, [2, 5]), e(t, [2, 7], { 4: 22, 34: n, 35: o, 36: g }), { 11: 23, 37: 24, 38: p, 39: k, 40: 27, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }, { 11: 39, 13: 38, 24: W, 27: z, 29: 40, 30: 41, 37: 24, 38: p, 39: k, 40: 27, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }, { 11: 45, 15: 44, 27: U, 33: 46, 37: 24, 38: p, 39: k, 40: 27, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }, { 11: 49, 17: 48, 24: X, 37: 24, 38: p, 39: k, 40: 27, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }, { 11: 52, 17: 51, 24: X, 37: 24, 38: p, 39: k, 40: 27, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }, { 20: [1, 53] }, { 22: [1, 54] }, e(l, [2, 18]), { 1: [2, 2] }, e(l, [2, 8]), e(l, [2, 9]), e(L, [2, 37], { 40: 55, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }), e(L, [2, 38]), e(L, [2, 39]), e(S, [2, 40]), e(S, [2, 42]), e(S, [2, 43]), e(S, [2, 44]), e(S, [2, 45]), e(S, [2, 46]), e(S, [2, 47]), e(S, [2, 48]), e(S, [2, 49]), e(S, [2, 50]), e(S, [2, 51]), e(l, [2, 10]), e(l, [2, 22], { 30: 41, 29: 56, 24: W, 27: z }), e(l, [2, 24]), e(l, [2, 25]), { 31: [1, 57] }, { 11: 59, 32: 58, 37: 24, 38: p, 39: k, 40: 27, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }, e(l, [2, 11]), e(l, [2, 30], { 33: 60, 27: U }), e(l, [2, 32]), { 31: [1, 61] }, e(l, [2, 12]), { 17: 62, 24: X }, { 25: 63, 27: R }, e(l, [2, 14]), { 17: 65, 24: X }, e(l, [2, 16]), e(l, [2, 17]), e(S, [2, 41]), e(l, [2, 23]), { 27: [1, 66] }, { 26: [1, 67] }, { 26: [2, 29], 28: [1, 68] }, e(l, [2, 31]), { 27: [1, 69] }, e(l, [2, 13]), { 26: [1, 70] }, { 26: [2, 21], 28: [1, 71] }, e(l, [2, 15]), e(l, [2, 26]), e(l, [2, 27]), { 11: 59, 32: 72, 37: 24, 38: p, 39: k, 40: 27, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }, e(l, [2, 33]), e(l, [2, 19]), { 25: 73, 27: R }, { 26: [2, 28] }, { 26: [2, 20] }],
155
+ defaultActions: { 8: [2, 1], 10: [2, 3], 21: [2, 2], 72: [2, 28], 73: [2, 20] },
156
+ parseError: /* @__PURE__ */ a(function(h, u) {
157
+ if (u.recoverable)
158
+ this.trace(h);
159
+ else {
160
+ var x = new Error(h);
161
+ throw x.hash = u, x;
162
+ }
163
+ }, "parseError"),
164
+ parse: /* @__PURE__ */ a(function(h) {
165
+ var u = this, x = [0], d = [], w = [null], r = [], at = this.table, f = "", lt = 0, It = 0, hi = 2, Mt = 1, li = r.slice.call(arguments, 1), T = Object.create(this.lexer), Y = { yy: {} };
166
+ for (var dt in this.yy)
167
+ Object.prototype.hasOwnProperty.call(this.yy, dt) && (Y.yy[dt] = this.yy[dt]);
168
+ T.setInput(h, Y.yy), Y.yy.lexer = T, Y.yy.parser = this, typeof T.yylloc > "u" && (T.yylloc = {});
169
+ var ft = T.yylloc;
170
+ r.push(ft);
171
+ var ci = T.options && T.options.ranges;
172
+ typeof Y.yy.parseError == "function" ? this.parseError = Y.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
173
+ function ui(V) {
174
+ x.length = x.length - 2 * V, w.length = w.length - V, r.length = r.length - V;
175
+ }
176
+ a(ui, "popStack");
177
+ function Vt() {
178
+ var V;
179
+ return V = d.pop() || T.lex() || Mt, typeof V != "number" && (V instanceof Array && (d = V, V = d.pop()), V = u.symbols_[V] || V), V;
180
+ }
181
+ a(Vt, "lex");
182
+ for (var M, H, B, pt, q = {}, ct, O, Bt, ut; ; ) {
183
+ if (H = x[x.length - 1], this.defaultActions[H] ? B = this.defaultActions[H] : ((M === null || typeof M > "u") && (M = Vt()), B = at[H] && at[H][M]), typeof B > "u" || !B.length || !B[0]) {
184
+ var mt = "";
185
+ ut = [];
186
+ for (ct in at[H])
187
+ this.terminals_[ct] && ct > hi && ut.push("'" + this.terminals_[ct] + "'");
188
+ T.showPosition ? mt = "Parse error on line " + (lt + 1) + `:
189
+ ` + T.showPosition() + `
190
+ Expecting ` + ut.join(", ") + ", got '" + (this.terminals_[M] || M) + "'" : mt = "Parse error on line " + (lt + 1) + ": Unexpected " + (M == Mt ? "end of input" : "'" + (this.terminals_[M] || M) + "'"), this.parseError(mt, {
191
+ text: T.match,
192
+ token: this.terminals_[M] || M,
193
+ line: T.yylineno,
194
+ loc: ft,
195
+ expected: ut
196
+ });
197
+ }
198
+ if (B[0] instanceof Array && B.length > 1)
199
+ throw new Error("Parse Error: multiple actions possible at state: " + H + ", token: " + M);
200
+ switch (B[0]) {
201
+ case 1:
202
+ x.push(M), w.push(T.yytext), r.push(T.yylloc), x.push(B[1]), M = null, It = T.yyleng, f = T.yytext, lt = T.yylineno, ft = T.yylloc;
203
+ break;
204
+ case 2:
205
+ if (O = this.productions_[B[1]][1], q.$ = w[w.length - O], q._$ = {
206
+ first_line: r[r.length - (O || 1)].first_line,
207
+ last_line: r[r.length - 1].last_line,
208
+ first_column: r[r.length - (O || 1)].first_column,
209
+ last_column: r[r.length - 1].last_column
210
+ }, ci && (q._$.range = [
211
+ r[r.length - (O || 1)].range[0],
212
+ r[r.length - 1].range[1]
213
+ ]), pt = this.performAction.apply(q, [
214
+ f,
215
+ It,
216
+ lt,
217
+ Y.yy,
218
+ B[1],
219
+ w,
220
+ r
221
+ ].concat(li)), typeof pt < "u")
222
+ return pt;
223
+ O && (x = x.slice(0, -1 * O * 2), w = w.slice(0, -1 * O), r = r.slice(0, -1 * O)), x.push(this.productions_[B[1]][0]), w.push(q.$), r.push(q._$), Bt = at[x[x.length - 2]][x[x.length - 1]], x.push(Bt);
224
+ break;
225
+ case 3:
226
+ return !0;
227
+ }
228
+ }
229
+ return !0;
230
+ }, "parse")
231
+ }, Et = /* @__PURE__ */ function() {
232
+ var F = {
233
+ EOF: 1,
234
+ parseError: /* @__PURE__ */ a(function(u, x) {
235
+ if (this.yy.parser)
236
+ this.yy.parser.parseError(u, x);
237
+ else
238
+ throw new Error(u);
239
+ }, "parseError"),
240
+ // resets the lexer, sets new input
241
+ setInput: /* @__PURE__ */ a(function(h, u) {
242
+ return this.yy = u || this.yy || {}, this._input = h, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
243
+ first_line: 1,
244
+ first_column: 0,
245
+ last_line: 1,
246
+ last_column: 0
247
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
248
+ }, "setInput"),
249
+ // consumes and returns one char from the input
250
+ input: /* @__PURE__ */ a(function() {
251
+ var h = this._input[0];
252
+ this.yytext += h, this.yyleng++, this.offset++, this.match += h, this.matched += h;
253
+ var u = h.match(/(?:\r\n?|\n).*/g);
254
+ return u ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), h;
255
+ }, "input"),
256
+ // unshifts one char (or a string) into the input
257
+ unput: /* @__PURE__ */ a(function(h) {
258
+ var u = h.length, x = h.split(/(?:\r\n?|\n)/g);
259
+ this._input = h + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - u), this.offset -= u;
260
+ var d = this.match.split(/(?:\r\n?|\n)/g);
261
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), x.length - 1 && (this.yylineno -= x.length - 1);
262
+ var w = this.yylloc.range;
263
+ return this.yylloc = {
264
+ first_line: this.yylloc.first_line,
265
+ last_line: this.yylineno + 1,
266
+ first_column: this.yylloc.first_column,
267
+ last_column: x ? (x.length === d.length ? this.yylloc.first_column : 0) + d[d.length - x.length].length - x[0].length : this.yylloc.first_column - u
268
+ }, this.options.ranges && (this.yylloc.range = [w[0], w[0] + this.yyleng - u]), this.yyleng = this.yytext.length, this;
269
+ }, "unput"),
270
+ // When called from action, caches matched text and appends it on next action
271
+ more: /* @__PURE__ */ a(function() {
272
+ return this._more = !0, this;
273
+ }, "more"),
274
+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
275
+ reject: /* @__PURE__ */ a(function() {
276
+ if (this.options.backtrack_lexer)
277
+ this._backtrack = !0;
278
+ else
279
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
280
+ ` + this.showPosition(), {
281
+ text: "",
282
+ token: null,
283
+ line: this.yylineno
284
+ });
285
+ return this;
286
+ }, "reject"),
287
+ // retain first n characters of the match
288
+ less: /* @__PURE__ */ a(function(h) {
289
+ this.unput(this.match.slice(h));
290
+ }, "less"),
291
+ // displays already matched input, i.e. for error messages
292
+ pastInput: /* @__PURE__ */ a(function() {
293
+ var h = this.matched.substr(0, this.matched.length - this.match.length);
294
+ return (h.length > 20 ? "..." : "") + h.substr(-20).replace(/\n/g, "");
295
+ }, "pastInput"),
296
+ // displays upcoming input, i.e. for error messages
297
+ upcomingInput: /* @__PURE__ */ a(function() {
298
+ var h = this.match;
299
+ return h.length < 20 && (h += this._input.substr(0, 20 - h.length)), (h.substr(0, 20) + (h.length > 20 ? "..." : "")).replace(/\n/g, "");
300
+ }, "upcomingInput"),
301
+ // displays the character position where the lexing error occurred, i.e. for error messages
302
+ showPosition: /* @__PURE__ */ a(function() {
303
+ var h = this.pastInput(), u = new Array(h.length + 1).join("-");
304
+ return h + this.upcomingInput() + `
305
+ ` + u + "^";
306
+ }, "showPosition"),
307
+ // test the lexed token: return FALSE when not a match, otherwise return token
308
+ test_match: /* @__PURE__ */ a(function(h, u) {
309
+ var x, d, w;
310
+ if (this.options.backtrack_lexer && (w = {
311
+ yylineno: this.yylineno,
312
+ yylloc: {
313
+ first_line: this.yylloc.first_line,
314
+ last_line: this.last_line,
315
+ first_column: this.yylloc.first_column,
316
+ last_column: this.yylloc.last_column
317
+ },
318
+ yytext: this.yytext,
319
+ match: this.match,
320
+ matches: this.matches,
321
+ matched: this.matched,
322
+ yyleng: this.yyleng,
323
+ offset: this.offset,
324
+ _more: this._more,
325
+ _input: this._input,
326
+ yy: this.yy,
327
+ conditionStack: this.conditionStack.slice(0),
328
+ done: this.done
329
+ }, this.options.ranges && (w.yylloc.range = this.yylloc.range.slice(0))), d = h[0].match(/(?:\r\n?|\n).*/g), d && (this.yylineno += d.length), this.yylloc = {
330
+ first_line: this.yylloc.last_line,
331
+ last_line: this.yylineno + 1,
332
+ first_column: this.yylloc.last_column,
333
+ last_column: d ? d[d.length - 1].length - d[d.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + h[0].length
334
+ }, this.yytext += h[0], this.match += h[0], this.matches = h, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(h[0].length), this.matched += h[0], x = this.performAction.call(this, this.yy, this, u, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), x)
335
+ return x;
336
+ if (this._backtrack) {
337
+ for (var r in w)
338
+ this[r] = w[r];
339
+ return !1;
340
+ }
341
+ return !1;
342
+ }, "test_match"),
343
+ // return next match in input
344
+ next: /* @__PURE__ */ a(function() {
345
+ if (this.done)
346
+ return this.EOF;
347
+ this._input || (this.done = !0);
348
+ var h, u, x, d;
349
+ this._more || (this.yytext = "", this.match = "");
350
+ for (var w = this._currentRules(), r = 0; r < w.length; r++)
351
+ if (x = this._input.match(this.rules[w[r]]), x && (!u || x[0].length > u[0].length)) {
352
+ if (u = x, d = r, this.options.backtrack_lexer) {
353
+ if (h = this.test_match(x, w[r]), h !== !1)
354
+ return h;
355
+ if (this._backtrack) {
356
+ u = !1;
357
+ continue;
358
+ } else
359
+ return !1;
360
+ } else if (!this.options.flex)
361
+ break;
362
+ }
363
+ return u ? (h = this.test_match(u, w[d]), h !== !1 ? h : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
364
+ ` + this.showPosition(), {
365
+ text: "",
366
+ token: null,
367
+ line: this.yylineno
368
+ });
369
+ }, "next"),
370
+ // return next match that has a token
371
+ lex: /* @__PURE__ */ a(function() {
372
+ var u = this.next();
373
+ return u || this.lex();
374
+ }, "lex"),
375
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
376
+ begin: /* @__PURE__ */ a(function(u) {
377
+ this.conditionStack.push(u);
378
+ }, "begin"),
379
+ // pop the previously active lexer condition state off the condition stack
380
+ popState: /* @__PURE__ */ a(function() {
381
+ var u = this.conditionStack.length - 1;
382
+ return u > 0 ? this.conditionStack.pop() : this.conditionStack[0];
383
+ }, "popState"),
384
+ // produce the lexer rule set which is active for the currently active lexer condition state
385
+ _currentRules: /* @__PURE__ */ a(function() {
386
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
387
+ }, "_currentRules"),
388
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
389
+ topState: /* @__PURE__ */ a(function(u) {
390
+ return u = this.conditionStack.length - 1 - Math.abs(u || 0), u >= 0 ? this.conditionStack[u] : "INITIAL";
391
+ }, "topState"),
392
+ // alias for begin(condition)
393
+ pushState: /* @__PURE__ */ a(function(u) {
394
+ this.begin(u);
395
+ }, "pushState"),
396
+ // return the number of states currently on the stack
397
+ stateStackSize: /* @__PURE__ */ a(function() {
398
+ return this.conditionStack.length;
399
+ }, "stateStackSize"),
400
+ options: { "case-insensitive": !0 },
401
+ performAction: /* @__PURE__ */ a(function(u, x, d, w) {
402
+ switch (d) {
403
+ case 0:
404
+ break;
405
+ case 1:
406
+ break;
407
+ case 2:
408
+ return this.popState(), 34;
409
+ case 3:
410
+ return this.popState(), 34;
411
+ case 4:
412
+ return 34;
413
+ case 5:
414
+ break;
415
+ case 6:
416
+ return 10;
417
+ case 7:
418
+ return this.pushState("acc_title"), 19;
419
+ case 8:
420
+ return this.popState(), "acc_title_value";
421
+ case 9:
422
+ return this.pushState("acc_descr"), 21;
423
+ case 10:
424
+ return this.popState(), "acc_descr_value";
425
+ case 11:
426
+ this.pushState("acc_descr_multiline");
427
+ break;
428
+ case 12:
429
+ this.popState();
430
+ break;
431
+ case 13:
432
+ return "acc_descr_multiline_value";
433
+ case 14:
434
+ return 5;
435
+ case 15:
436
+ return 5;
437
+ case 16:
438
+ return 8;
439
+ case 17:
440
+ return this.pushState("axis_data"), "X_AXIS";
441
+ case 18:
442
+ return this.pushState("axis_data"), "Y_AXIS";
443
+ case 19:
444
+ return this.pushState("axis_band_data"), 24;
445
+ case 20:
446
+ return 31;
447
+ case 21:
448
+ return this.pushState("data"), 16;
449
+ case 22:
450
+ return this.pushState("data"), 18;
451
+ case 23:
452
+ return this.pushState("data_inner"), 24;
453
+ case 24:
454
+ return 27;
455
+ case 25:
456
+ return this.popState(), 26;
457
+ case 26:
458
+ this.popState();
459
+ break;
460
+ case 27:
461
+ this.pushState("string");
462
+ break;
463
+ case 28:
464
+ this.popState();
465
+ break;
466
+ case 29:
467
+ return "STR";
468
+ case 30:
469
+ return 24;
470
+ case 31:
471
+ return 26;
472
+ case 32:
473
+ return 43;
474
+ case 33:
475
+ return "COLON";
476
+ case 34:
477
+ return 44;
478
+ case 35:
479
+ return 28;
480
+ case 36:
481
+ return 45;
482
+ case 37:
483
+ return 46;
484
+ case 38:
485
+ return 48;
486
+ case 39:
487
+ return 50;
488
+ case 40:
489
+ return 47;
490
+ case 41:
491
+ return 41;
492
+ case 42:
493
+ return 49;
494
+ case 43:
495
+ return 42;
496
+ case 44:
497
+ break;
498
+ case 45:
499
+ return 35;
500
+ case 46:
501
+ return 36;
502
+ }
503
+ }, "anonymous"),
504
+ rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:(\r?\n))/i, /^(?:(\r?\n))/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:\{)/i, /^(?:[^\}]*)/i, /^(?:xychart-beta\b)/i, /^(?:xychart\b)/i, /^(?:(?:vertical|horizontal))/i, /^(?:x-axis\b)/i, /^(?:y-axis\b)/i, /^(?:\[)/i, /^(?:-->)/i, /^(?:line\b)/i, /^(?:bar\b)/i, /^(?:\[)/i, /^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i, /^(?:\])/i, /^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s+)/i, /^(?:;)/i, /^(?:$)/i],
505
+ conditions: { data_inner: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], inclusive: !0 }, data: { rules: [0, 1, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 23, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], inclusive: !0 }, axis_band_data: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], inclusive: !0 }, axis_data: { rules: [0, 1, 2, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], inclusive: !0 }, acc_descr_multiline: { rules: [12, 13], inclusive: !1 }, acc_descr: { rules: [10], inclusive: !1 }, acc_title: { rules: [8], inclusive: !1 }, title: { rules: [], inclusive: !1 }, md_string: { rules: [], inclusive: !1 }, string: { rules: [28, 29], inclusive: !1 }, INITIAL: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], inclusive: !0 } }
506
+ };
507
+ return F;
508
+ }();
509
+ $.lexer = Et;
510
+ function N() {
511
+ this.yy = {};
512
+ }
513
+ return a(N, "Parser"), N.prototype = $, $.Parser = N, new N();
514
+ }();
515
+ bt.parser = bt;
516
+ var Ti = bt;
517
+ function At(e) {
518
+ return e.type === "bar";
519
+ }
520
+ a(At, "isBarPlot");
521
+ function _t(e) {
522
+ return e.type === "band";
523
+ }
524
+ a(_t, "isBandAxisData");
525
+ function G(e) {
526
+ return e.type === "linear";
527
+ }
528
+ a(G, "isLinearAxisData");
529
+ var j, Ht = (j = class {
530
+ constructor(t) {
531
+ this.parentGroup = t;
532
+ }
533
+ getMaxDimension(t, i) {
534
+ if (!this.parentGroup)
535
+ return {
536
+ width: t.reduce((o, g) => Math.max(g.length, o), 0) * i,
537
+ height: i
538
+ };
539
+ const s = {
540
+ width: 0,
541
+ height: 0
542
+ }, n = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", i);
543
+ for (const o of t) {
544
+ const g = Si(n, 1, o), m = g ? g.width : o.length * i, p = g ? g.height : i;
545
+ s.width = Math.max(s.width, m), s.height = Math.max(s.height, p);
546
+ }
547
+ return n.remove(), s;
548
+ }
549
+ }, a(j, "TextDimensionCalculatorWithFont"), j), Ft = 0.7, Ot = 0.2, Q, Ut = (Q = class {
550
+ constructor(t, i, s, n) {
551
+ this.axisConfig = t, this.title = i, this.textDimensionCalculator = s, this.axisThemeConfig = n, this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }, this.axisPosition = "left", this.showTitle = !1, this.showLabel = !1, this.showTick = !1, this.showAxisLine = !1, this.outerPadding = 0, this.titleTextHeight = 0, this.labelTextHeight = 0, this.range = [0, 10], this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }, this.axisPosition = "left";
552
+ }
553
+ setRange(t) {
554
+ this.range = t, this.axisPosition === "left" || this.axisPosition === "right" ? this.boundingRect.height = t[1] - t[0] : this.boundingRect.width = t[1] - t[0], this.recalculateScale();
555
+ }
556
+ getRange() {
557
+ return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding];
558
+ }
559
+ setAxisPosition(t) {
560
+ this.axisPosition = t, this.setRange(this.range);
561
+ }
562
+ getTickDistance() {
563
+ const t = this.getRange();
564
+ return Math.abs(t[0] - t[1]) / this.getTickValues().length;
565
+ }
566
+ getAxisOuterPadding() {
567
+ return this.outerPadding;
568
+ }
569
+ getLabelDimension() {
570
+ return this.textDimensionCalculator.getMaxDimension(
571
+ this.getTickValues().map((t) => t.toString()),
572
+ this.axisConfig.labelFontSize
573
+ );
574
+ }
575
+ recalculateOuterPaddingToDrawBar() {
576
+ Ft * this.getTickDistance() > this.outerPadding * 2 && (this.outerPadding = Math.floor(Ft * this.getTickDistance() / 2)), this.recalculateScale();
577
+ }
578
+ calculateSpaceIfDrawnHorizontally(t) {
579
+ let i = t.height;
580
+ if (this.axisConfig.showAxisLine && i > this.axisConfig.axisLineWidth && (i -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
581
+ const s = this.getLabelDimension(), n = Ot * t.width;
582
+ this.outerPadding = Math.min(s.width / 2, n);
583
+ const o = s.height + this.axisConfig.labelPadding * 2;
584
+ this.labelTextHeight = s.height, o <= i && (i -= o, this.showLabel = !0);
585
+ }
586
+ if (this.axisConfig.showTick && i >= this.axisConfig.tickLength && (this.showTick = !0, i -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
587
+ const s = this.textDimensionCalculator.getMaxDimension(
588
+ [this.title],
589
+ this.axisConfig.titleFontSize
590
+ ), n = s.height + this.axisConfig.titlePadding * 2;
591
+ this.titleTextHeight = s.height, n <= i && (i -= n, this.showTitle = !0);
592
+ }
593
+ this.boundingRect.width = t.width, this.boundingRect.height = t.height - i;
594
+ }
595
+ calculateSpaceIfDrawnVertical(t) {
596
+ let i = t.width;
597
+ if (this.axisConfig.showAxisLine && i > this.axisConfig.axisLineWidth && (i -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
598
+ const s = this.getLabelDimension(), n = Ot * t.height;
599
+ this.outerPadding = Math.min(s.height / 2, n);
600
+ const o = s.width + this.axisConfig.labelPadding * 2;
601
+ o <= i && (i -= o, this.showLabel = !0);
602
+ }
603
+ if (this.axisConfig.showTick && i >= this.axisConfig.tickLength && (this.showTick = !0, i -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
604
+ const s = this.textDimensionCalculator.getMaxDimension(
605
+ [this.title],
606
+ this.axisConfig.titleFontSize
607
+ ), n = s.height + this.axisConfig.titlePadding * 2;
608
+ this.titleTextHeight = s.height, n <= i && (i -= n, this.showTitle = !0);
609
+ }
610
+ this.boundingRect.width = t.width - i, this.boundingRect.height = t.height;
611
+ }
612
+ calculateSpace(t) {
613
+ return this.axisPosition === "left" || this.axisPosition === "right" ? this.calculateSpaceIfDrawnVertical(t) : this.calculateSpaceIfDrawnHorizontally(t), this.recalculateScale(), {
614
+ width: this.boundingRect.width,
615
+ height: this.boundingRect.height
616
+ };
617
+ }
618
+ setBoundingBoxXY(t) {
619
+ this.boundingRect.x = t.x, this.boundingRect.y = t.y;
620
+ }
621
+ getDrawableElementsForLeftAxis() {
622
+ const t = [];
623
+ if (this.showAxisLine) {
624
+ const i = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
625
+ t.push({
626
+ type: "path",
627
+ groupTexts: ["left-axis", "axisl-line"],
628
+ data: [
629
+ {
630
+ path: `M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y + this.boundingRect.height} `,
631
+ strokeFill: this.axisThemeConfig.axisLineColor,
632
+ strokeWidth: this.axisConfig.axisLineWidth
633
+ }
634
+ ]
635
+ });
636
+ }
637
+ if (this.showLabel && t.push({
638
+ type: "text",
639
+ groupTexts: ["left-axis", "label"],
640
+ data: this.getTickValues().map((i) => ({
641
+ text: i.toString(),
642
+ x: this.boundingRect.x + this.boundingRect.width - (this.showLabel ? this.axisConfig.labelPadding : 0) - (this.showTick ? this.axisConfig.tickLength : 0) - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
643
+ y: this.getScaleValue(i),
644
+ fill: this.axisThemeConfig.labelColor,
645
+ fontSize: this.axisConfig.labelFontSize,
646
+ rotation: 0,
647
+ verticalPos: "middle",
648
+ horizontalPos: "right"
649
+ }))
650
+ }), this.showTick) {
651
+ const i = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
652
+ t.push({
653
+ type: "path",
654
+ groupTexts: ["left-axis", "ticks"],
655
+ data: this.getTickValues().map((s) => ({
656
+ path: `M ${i},${this.getScaleValue(s)} L ${i - this.axisConfig.tickLength},${this.getScaleValue(s)}`,
657
+ strokeFill: this.axisThemeConfig.tickColor,
658
+ strokeWidth: this.axisConfig.tickWidth
659
+ }))
660
+ });
661
+ }
662
+ return this.showTitle && t.push({
663
+ type: "text",
664
+ groupTexts: ["left-axis", "title"],
665
+ data: [
666
+ {
667
+ text: this.title,
668
+ x: this.boundingRect.x + this.axisConfig.titlePadding,
669
+ y: this.boundingRect.y + this.boundingRect.height / 2,
670
+ fill: this.axisThemeConfig.titleColor,
671
+ fontSize: this.axisConfig.titleFontSize,
672
+ rotation: 270,
673
+ verticalPos: "top",
674
+ horizontalPos: "center"
675
+ }
676
+ ]
677
+ }), t;
678
+ }
679
+ getDrawableElementsForBottomAxis() {
680
+ const t = [];
681
+ if (this.showAxisLine) {
682
+ const i = this.boundingRect.y + this.axisConfig.axisLineWidth / 2;
683
+ t.push({
684
+ type: "path",
685
+ groupTexts: ["bottom-axis", "axis-line"],
686
+ data: [
687
+ {
688
+ path: `M ${this.boundingRect.x},${i} L ${this.boundingRect.x + this.boundingRect.width},${i}`,
689
+ strokeFill: this.axisThemeConfig.axisLineColor,
690
+ strokeWidth: this.axisConfig.axisLineWidth
691
+ }
692
+ ]
693
+ });
694
+ }
695
+ if (this.showLabel && t.push({
696
+ type: "text",
697
+ groupTexts: ["bottom-axis", "label"],
698
+ data: this.getTickValues().map((i) => ({
699
+ text: i.toString(),
700
+ x: this.getScaleValue(i),
701
+ y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
702
+ fill: this.axisThemeConfig.labelColor,
703
+ fontSize: this.axisConfig.labelFontSize,
704
+ rotation: 0,
705
+ verticalPos: "top",
706
+ horizontalPos: "center"
707
+ }))
708
+ }), this.showTick) {
709
+ const i = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
710
+ t.push({
711
+ type: "path",
712
+ groupTexts: ["bottom-axis", "ticks"],
713
+ data: this.getTickValues().map((s) => ({
714
+ path: `M ${this.getScaleValue(s)},${i} L ${this.getScaleValue(s)},${i + this.axisConfig.tickLength}`,
715
+ strokeFill: this.axisThemeConfig.tickColor,
716
+ strokeWidth: this.axisConfig.tickWidth
717
+ }))
718
+ });
719
+ }
720
+ return this.showTitle && t.push({
721
+ type: "text",
722
+ groupTexts: ["bottom-axis", "title"],
723
+ data: [
724
+ {
725
+ text: this.title,
726
+ x: this.range[0] + (this.range[1] - this.range[0]) / 2,
727
+ y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight,
728
+ fill: this.axisThemeConfig.titleColor,
729
+ fontSize: this.axisConfig.titleFontSize,
730
+ rotation: 0,
731
+ verticalPos: "top",
732
+ horizontalPos: "center"
733
+ }
734
+ ]
735
+ }), t;
736
+ }
737
+ getDrawableElementsForTopAxis() {
738
+ const t = [];
739
+ if (this.showAxisLine) {
740
+ const i = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2;
741
+ t.push({
742
+ type: "path",
743
+ groupTexts: ["top-axis", "axis-line"],
744
+ data: [
745
+ {
746
+ path: `M ${this.boundingRect.x},${i} L ${this.boundingRect.x + this.boundingRect.width},${i}`,
747
+ strokeFill: this.axisThemeConfig.axisLineColor,
748
+ strokeWidth: this.axisConfig.axisLineWidth
749
+ }
750
+ ]
751
+ });
752
+ }
753
+ if (this.showLabel && t.push({
754
+ type: "text",
755
+ groupTexts: ["top-axis", "label"],
756
+ data: this.getTickValues().map((i) => ({
757
+ text: i.toString(),
758
+ x: this.getScaleValue(i),
759
+ y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding,
760
+ fill: this.axisThemeConfig.labelColor,
761
+ fontSize: this.axisConfig.labelFontSize,
762
+ rotation: 0,
763
+ verticalPos: "top",
764
+ horizontalPos: "center"
765
+ }))
766
+ }), this.showTick) {
767
+ const i = this.boundingRect.y;
768
+ t.push({
769
+ type: "path",
770
+ groupTexts: ["top-axis", "ticks"],
771
+ data: this.getTickValues().map((s) => ({
772
+ path: `M ${this.getScaleValue(s)},${i + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(s)},${i + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`,
773
+ strokeFill: this.axisThemeConfig.tickColor,
774
+ strokeWidth: this.axisConfig.tickWidth
775
+ }))
776
+ });
777
+ }
778
+ return this.showTitle && t.push({
779
+ type: "text",
780
+ groupTexts: ["top-axis", "title"],
781
+ data: [
782
+ {
783
+ text: this.title,
784
+ x: this.boundingRect.x + this.boundingRect.width / 2,
785
+ y: this.boundingRect.y + this.axisConfig.titlePadding,
786
+ fill: this.axisThemeConfig.titleColor,
787
+ fontSize: this.axisConfig.titleFontSize,
788
+ rotation: 0,
789
+ verticalPos: "top",
790
+ horizontalPos: "center"
791
+ }
792
+ ]
793
+ }), t;
794
+ }
795
+ getDrawableElements() {
796
+ if (this.axisPosition === "left")
797
+ return this.getDrawableElementsForLeftAxis();
798
+ if (this.axisPosition === "right")
799
+ throw Error("Drawing of right axis is not implemented");
800
+ return this.axisPosition === "bottom" ? this.getDrawableElementsForBottomAxis() : this.axisPosition === "top" ? this.getDrawableElementsForTopAxis() : [];
801
+ }
802
+ }, a(Q, "BaseAxis"), Q), K, Di = (K = class extends Ut {
803
+ constructor(t, i, s, n, o) {
804
+ super(t, n, o, i), this.categories = s, this.scale = yt().domain(this.categories).range(this.getRange());
805
+ }
806
+ setRange(t) {
807
+ super.setRange(t);
808
+ }
809
+ recalculateScale() {
810
+ this.scale = yt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5), Nt.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
811
+ }
812
+ getTickValues() {
813
+ return this.categories;
814
+ }
815
+ getScaleValue(t) {
816
+ return this.scale(t) ?? this.getRange()[0];
817
+ }
818
+ }, a(K, "BandAxis"), K), Z, vi = (Z = class extends Ut {
819
+ constructor(t, i, s, n, o) {
820
+ super(t, n, o, i), this.domain = s, this.scale = zt().domain(this.domain).range(this.getRange());
821
+ }
822
+ getTickValues() {
823
+ return this.scale.ticks();
824
+ }
825
+ recalculateScale() {
826
+ const t = [...this.domain];
827
+ this.axisPosition === "left" && t.reverse(), this.scale = zt().domain(t).range(this.getRange());
828
+ }
829
+ getScaleValue(t) {
830
+ return this.scale(t);
831
+ }
832
+ }, a(Z, "LinearAxis"), Z);
833
+ function wt(e, t, i, s) {
834
+ const n = new Ht(s);
835
+ return _t(e) ? new Di(
836
+ t,
837
+ i,
838
+ e.categories,
839
+ e.title,
840
+ n
841
+ ) : new vi(
842
+ t,
843
+ i,
844
+ [e.min, e.max],
845
+ e.title,
846
+ n
847
+ );
848
+ }
849
+ a(wt, "getAxis");
850
+ var J, Pi = (J = class {
851
+ constructor(t, i, s, n) {
852
+ this.textDimensionCalculator = t, this.chartConfig = i, this.chartData = s, this.chartThemeConfig = n, this.boundingRect = {
853
+ x: 0,
854
+ y: 0,
855
+ width: 0,
856
+ height: 0
857
+ }, this.showChartTitle = !1;
858
+ }
859
+ setBoundingBoxXY(t) {
860
+ this.boundingRect.x = t.x, this.boundingRect.y = t.y;
861
+ }
862
+ calculateSpace(t) {
863
+ const i = this.textDimensionCalculator.getMaxDimension(
864
+ [this.chartData.title],
865
+ this.chartConfig.titleFontSize
866
+ ), s = Math.max(i.width, t.width), n = i.height + 2 * this.chartConfig.titlePadding;
867
+ return i.width <= s && i.height <= n && this.chartConfig.showTitle && this.chartData.title && (this.boundingRect.width = s, this.boundingRect.height = n, this.showChartTitle = !0), {
868
+ width: this.boundingRect.width,
869
+ height: this.boundingRect.height
870
+ };
871
+ }
872
+ getDrawableElements() {
873
+ const t = [];
874
+ return this.showChartTitle && t.push({
875
+ groupTexts: ["chart-title"],
876
+ type: "text",
877
+ data: [
878
+ {
879
+ fontSize: this.chartConfig.titleFontSize,
880
+ text: this.chartData.title,
881
+ verticalPos: "middle",
882
+ horizontalPos: "center",
883
+ x: this.boundingRect.x + this.boundingRect.width / 2,
884
+ y: this.boundingRect.y + this.boundingRect.height / 2,
885
+ fill: this.chartThemeConfig.titleColor,
886
+ rotation: 0
887
+ }
888
+ ]
889
+ }), t;
890
+ }
891
+ }, a(J, "ChartTitle"), J);
892
+ function $t(e, t, i, s) {
893
+ const n = new Ht(s);
894
+ return new Pi(n, e, t, i);
895
+ }
896
+ a($t, "getChartTitleComponent");
897
+ var tt, Li = (tt = class {
898
+ constructor(t, i, s, n, o) {
899
+ this.plotData = t, this.xAxis = i, this.yAxis = s, this.orientation = n, this.plotIndex = o;
900
+ }
901
+ getDrawableElement() {
902
+ const t = this.plotData.data.map((s) => [
903
+ this.xAxis.getScaleValue(s[0]),
904
+ this.yAxis.getScaleValue(s[1])
905
+ ]);
906
+ let i;
907
+ return this.orientation === "horizontal" ? i = Wt().y((s) => s[0]).x((s) => s[1])(t) : i = Wt().x((s) => s[0]).y((s) => s[1])(t), i ? [
908
+ {
909
+ groupTexts: ["plot", `line-plot-${this.plotIndex}`],
910
+ type: "path",
911
+ data: [
912
+ {
913
+ path: i,
914
+ strokeFill: this.plotData.strokeFill,
915
+ strokeWidth: this.plotData.strokeWidth
916
+ }
917
+ ]
918
+ }
919
+ ] : [];
920
+ }
921
+ }, a(tt, "LinePlot"), tt), it, Ei = (it = class {
922
+ constructor(t, i, s, n, o, g) {
923
+ this.barData = t, this.boundingRect = i, this.xAxis = s, this.yAxis = n, this.orientation = o, this.plotIndex = g;
924
+ }
925
+ getDrawableElement() {
926
+ const t = this.barData.data.map((o) => [
927
+ this.xAxis.getScaleValue(o[0]),
928
+ this.yAxis.getScaleValue(o[1])
929
+ ]), s = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - 0.05), n = s / 2;
930
+ return this.orientation === "horizontal" ? [
931
+ {
932
+ groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
933
+ type: "rect",
934
+ data: t.map((o) => ({
935
+ x: this.boundingRect.x,
936
+ y: o[0] - n,
937
+ height: s,
938
+ width: o[1] - this.boundingRect.x,
939
+ fill: this.barData.fill,
940
+ strokeWidth: 0,
941
+ strokeFill: this.barData.fill
942
+ }))
943
+ }
944
+ ] : [
945
+ {
946
+ groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
947
+ type: "rect",
948
+ data: t.map((o) => ({
949
+ x: o[0] - n,
950
+ y: o[1],
951
+ width: s,
952
+ height: this.boundingRect.y + this.boundingRect.height - o[1],
953
+ fill: this.barData.fill,
954
+ strokeWidth: 0,
955
+ strokeFill: this.barData.fill
956
+ }))
957
+ }
958
+ ];
959
+ }
960
+ }, a(it, "BarPlot"), it), et, Ii = (et = class {
961
+ constructor(t, i, s) {
962
+ this.chartConfig = t, this.chartData = i, this.chartThemeConfig = s, this.boundingRect = {
963
+ x: 0,
964
+ y: 0,
965
+ width: 0,
966
+ height: 0
967
+ };
968
+ }
969
+ setAxes(t, i) {
970
+ this.xAxis = t, this.yAxis = i;
971
+ }
972
+ setBoundingBoxXY(t) {
973
+ this.boundingRect.x = t.x, this.boundingRect.y = t.y;
974
+ }
975
+ calculateSpace(t) {
976
+ return this.boundingRect.width = t.width, this.boundingRect.height = t.height, {
977
+ width: this.boundingRect.width,
978
+ height: this.boundingRect.height
979
+ };
980
+ }
981
+ getDrawableElements() {
982
+ if (!(this.xAxis && this.yAxis))
983
+ throw Error("Axes must be passed to render Plots");
984
+ const t = [];
985
+ for (const [i, s] of this.chartData.plots.entries())
986
+ switch (s.type) {
987
+ case "line":
988
+ {
989
+ const n = new Li(
990
+ s,
991
+ this.xAxis,
992
+ this.yAxis,
993
+ this.chartConfig.chartOrientation,
994
+ i
995
+ );
996
+ t.push(...n.getDrawableElement());
997
+ }
998
+ break;
999
+ case "bar":
1000
+ {
1001
+ const n = new Ei(
1002
+ s,
1003
+ this.boundingRect,
1004
+ this.xAxis,
1005
+ this.yAxis,
1006
+ this.chartConfig.chartOrientation,
1007
+ i
1008
+ );
1009
+ t.push(...n.getDrawableElement());
1010
+ }
1011
+ break;
1012
+ }
1013
+ return t;
1014
+ }
1015
+ }, a(et, "BasePlot"), et);
1016
+ function qt(e, t, i) {
1017
+ return new Ii(e, t, i);
1018
+ }
1019
+ a(qt, "getPlotComponent");
1020
+ var st, Mi = (st = class {
1021
+ constructor(t, i, s, n) {
1022
+ this.chartConfig = t, this.chartData = i, this.componentStore = {
1023
+ title: $t(t, i, s, n),
1024
+ plot: qt(t, i, s),
1025
+ xAxis: wt(
1026
+ i.xAxis,
1027
+ t.xAxis,
1028
+ {
1029
+ titleColor: s.xAxisTitleColor,
1030
+ labelColor: s.xAxisLabelColor,
1031
+ tickColor: s.xAxisTickColor,
1032
+ axisLineColor: s.xAxisLineColor
1033
+ },
1034
+ n
1035
+ ),
1036
+ yAxis: wt(
1037
+ i.yAxis,
1038
+ t.yAxis,
1039
+ {
1040
+ titleColor: s.yAxisTitleColor,
1041
+ labelColor: s.yAxisLabelColor,
1042
+ tickColor: s.yAxisTickColor,
1043
+ axisLineColor: s.yAxisLineColor
1044
+ },
1045
+ n
1046
+ )
1047
+ };
1048
+ }
1049
+ calculateVerticalSpace() {
1050
+ let t = this.chartConfig.width, i = this.chartConfig.height, s = 0, n = 0, o = Math.floor(t * this.chartConfig.plotReservedSpacePercent / 100), g = Math.floor(
1051
+ i * this.chartConfig.plotReservedSpacePercent / 100
1052
+ ), m = this.componentStore.plot.calculateSpace({
1053
+ width: o,
1054
+ height: g
1055
+ });
1056
+ t -= m.width, i -= m.height, m = this.componentStore.title.calculateSpace({
1057
+ width: this.chartConfig.width,
1058
+ height: i
1059
+ }), n = m.height, i -= m.height, this.componentStore.xAxis.setAxisPosition("bottom"), m = this.componentStore.xAxis.calculateSpace({
1060
+ width: t,
1061
+ height: i
1062
+ }), i -= m.height, this.componentStore.yAxis.setAxisPosition("left"), m = this.componentStore.yAxis.calculateSpace({
1063
+ width: t,
1064
+ height: i
1065
+ }), s = m.width, t -= m.width, t > 0 && (o += t, t = 0), i > 0 && (g += i, i = 0), this.componentStore.plot.calculateSpace({
1066
+ width: o,
1067
+ height: g
1068
+ }), this.componentStore.plot.setBoundingBoxXY({ x: s, y: n }), this.componentStore.xAxis.setRange([s, s + o]), this.componentStore.xAxis.setBoundingBoxXY({ x: s, y: n + g }), this.componentStore.yAxis.setRange([n, n + g]), this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: n }), this.chartData.plots.some((p) => At(p)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1069
+ }
1070
+ calculateHorizontalSpace() {
1071
+ let t = this.chartConfig.width, i = this.chartConfig.height, s = 0, n = 0, o = 0, g = Math.floor(t * this.chartConfig.plotReservedSpacePercent / 100), m = Math.floor(
1072
+ i * this.chartConfig.plotReservedSpacePercent / 100
1073
+ ), p = this.componentStore.plot.calculateSpace({
1074
+ width: g,
1075
+ height: m
1076
+ });
1077
+ t -= p.width, i -= p.height, p = this.componentStore.title.calculateSpace({
1078
+ width: this.chartConfig.width,
1079
+ height: i
1080
+ }), s = p.height, i -= p.height, this.componentStore.xAxis.setAxisPosition("left"), p = this.componentStore.xAxis.calculateSpace({
1081
+ width: t,
1082
+ height: i
1083
+ }), t -= p.width, n = p.width, this.componentStore.yAxis.setAxisPosition("top"), p = this.componentStore.yAxis.calculateSpace({
1084
+ width: t,
1085
+ height: i
1086
+ }), i -= p.height, o = s + p.height, t > 0 && (g += t, t = 0), i > 0 && (m += i, i = 0), this.componentStore.plot.calculateSpace({
1087
+ width: g,
1088
+ height: m
1089
+ }), this.componentStore.plot.setBoundingBoxXY({ x: n, y: o }), this.componentStore.yAxis.setRange([n, n + g]), this.componentStore.yAxis.setBoundingBoxXY({ x: n, y: s }), this.componentStore.xAxis.setRange([o, o + m]), this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: o }), this.chartData.plots.some((k) => At(k)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1090
+ }
1091
+ calculateSpace() {
1092
+ this.chartConfig.chartOrientation === "horizontal" ? this.calculateHorizontalSpace() : this.calculateVerticalSpace();
1093
+ }
1094
+ getDrawableElement() {
1095
+ this.calculateSpace();
1096
+ const t = [];
1097
+ this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis);
1098
+ for (const i of Object.values(this.componentStore))
1099
+ t.push(...i.getDrawableElements());
1100
+ return t;
1101
+ }
1102
+ }, a(st, "Orchestrator"), st), nt, Vi = (nt = class {
1103
+ static build(t, i, s, n) {
1104
+ return new Mi(t, i, s, n).getDrawableElement();
1105
+ }
1106
+ }, a(nt, "XYChartBuilder"), nt), rt = 0, Gt, ot = Tt(), ht = Rt(), A = Dt(), Ct = ht.plotColorPalette.split(",").map((e) => e.trim()), gt = !1, kt = !1;
1107
+ function Rt() {
1108
+ const e = wi(), t = St();
1109
+ return Yt(e.xyChart, t.themeVariables.xyChart);
1110
+ }
1111
+ a(Rt, "getChartDefaultThemeConfig");
1112
+ function Tt() {
1113
+ const e = St();
1114
+ return Yt(
1115
+ Ai.xyChart,
1116
+ e.xyChart
1117
+ );
1118
+ }
1119
+ a(Tt, "getChartDefaultConfig");
1120
+ function Dt() {
1121
+ return {
1122
+ yAxis: {
1123
+ type: "linear",
1124
+ title: "",
1125
+ min: 1 / 0,
1126
+ max: -1 / 0
1127
+ },
1128
+ xAxis: {
1129
+ type: "band",
1130
+ title: "",
1131
+ categories: []
1132
+ },
1133
+ title: "",
1134
+ plots: []
1135
+ };
1136
+ }
1137
+ a(Dt, "getChartDefaultData");
1138
+ function xt(e) {
1139
+ const t = St();
1140
+ return Ci(e.trim(), t);
1141
+ }
1142
+ a(xt, "textSanitizer");
1143
+ function jt(e) {
1144
+ Gt = e;
1145
+ }
1146
+ a(jt, "setTmpSVGG");
1147
+ function Qt(e) {
1148
+ e === "horizontal" ? ot.chartOrientation = "horizontal" : ot.chartOrientation = "vertical";
1149
+ }
1150
+ a(Qt, "setOrientation");
1151
+ function Kt(e) {
1152
+ A.xAxis.title = xt(e.text);
1153
+ }
1154
+ a(Kt, "setXAxisTitle");
1155
+ function vt(e, t) {
1156
+ A.xAxis = { type: "linear", title: A.xAxis.title, min: e, max: t }, gt = !0;
1157
+ }
1158
+ a(vt, "setXAxisRangeData");
1159
+ function Zt(e) {
1160
+ A.xAxis = {
1161
+ type: "band",
1162
+ title: A.xAxis.title,
1163
+ categories: e.map((t) => xt(t.text))
1164
+ }, gt = !0;
1165
+ }
1166
+ a(Zt, "setXAxisBand");
1167
+ function Jt(e) {
1168
+ A.yAxis.title = xt(e.text);
1169
+ }
1170
+ a(Jt, "setYAxisTitle");
1171
+ function ti(e, t) {
1172
+ A.yAxis = { type: "linear", title: A.yAxis.title, min: e, max: t }, kt = !0;
1173
+ }
1174
+ a(ti, "setYAxisRangeData");
1175
+ function ii(e) {
1176
+ const t = Math.min(...e), i = Math.max(...e), s = G(A.yAxis) ? A.yAxis.min : 1 / 0, n = G(A.yAxis) ? A.yAxis.max : -1 / 0;
1177
+ A.yAxis = {
1178
+ type: "linear",
1179
+ title: A.yAxis.title,
1180
+ min: Math.min(s, t),
1181
+ max: Math.max(n, i)
1182
+ };
1183
+ }
1184
+ a(ii, "setYAxisRangeFromPlotData");
1185
+ function Pt(e) {
1186
+ let t = [];
1187
+ if (e.length === 0)
1188
+ return t;
1189
+ if (!gt) {
1190
+ const i = G(A.xAxis) ? A.xAxis.min : 1 / 0, s = G(A.xAxis) ? A.xAxis.max : -1 / 0;
1191
+ vt(Math.min(i, 1), Math.max(s, e.length));
1192
+ }
1193
+ if (kt || ii(e), _t(A.xAxis) && (t = A.xAxis.categories.map((i, s) => [i, e[s]])), G(A.xAxis)) {
1194
+ const i = A.xAxis.min, s = A.xAxis.max, n = (s - i) / (e.length - 1), o = [];
1195
+ for (let g = i; g <= s; g += n)
1196
+ o.push(`${g}`);
1197
+ t = o.map((g, m) => [g, e[m]]);
1198
+ }
1199
+ return t;
1200
+ }
1201
+ a(Pt, "transformDataWithoutCategory");
1202
+ function Lt(e) {
1203
+ return Ct[e === 0 ? 0 : e % Ct.length];
1204
+ }
1205
+ a(Lt, "getPlotColorFromPalette");
1206
+ function ei(e, t) {
1207
+ const i = Pt(t);
1208
+ A.plots.push({
1209
+ type: "line",
1210
+ strokeFill: Lt(rt),
1211
+ strokeWidth: 2,
1212
+ data: i
1213
+ }), rt++;
1214
+ }
1215
+ a(ei, "setLineData");
1216
+ function si(e, t) {
1217
+ const i = Pt(t);
1218
+ A.plots.push({
1219
+ type: "bar",
1220
+ fill: Lt(rt),
1221
+ data: i
1222
+ }), rt++;
1223
+ }
1224
+ a(si, "setBarData");
1225
+ function ni() {
1226
+ if (A.plots.length === 0)
1227
+ throw Error("No Plot to render, please provide a plot with some data");
1228
+ return A.title = Xt(), Vi.build(ot, A, ht, Gt);
1229
+ }
1230
+ a(ni, "getDrawableElem");
1231
+ function ai() {
1232
+ return ht;
1233
+ }
1234
+ a(ai, "getChartThemeConfig");
1235
+ function ri() {
1236
+ return ot;
1237
+ }
1238
+ a(ri, "getChartConfig");
1239
+ function oi() {
1240
+ return A;
1241
+ }
1242
+ a(oi, "getXYChartData");
1243
+ var Bi = /* @__PURE__ */ a(function() {
1244
+ bi(), rt = 0, ot = Tt(), A = Dt(), ht = Rt(), Ct = ht.plotColorPalette.split(",").map((e) => e.trim()), gt = !1, kt = !1;
1245
+ }, "clear"), Wi = {
1246
+ getDrawableElem: ni,
1247
+ clear: Bi,
1248
+ setAccTitle: pi,
1249
+ getAccTitle: fi,
1250
+ setDiagramTitle: di,
1251
+ getDiagramTitle: Xt,
1252
+ getAccDescription: xi,
1253
+ setAccDescription: gi,
1254
+ setOrientation: Qt,
1255
+ setXAxisTitle: Kt,
1256
+ setXAxisRangeData: vt,
1257
+ setXAxisBand: Zt,
1258
+ setYAxisTitle: Jt,
1259
+ setYAxisRangeData: ti,
1260
+ setLineData: ei,
1261
+ setBarData: si,
1262
+ setTmpSVGG: jt,
1263
+ getChartThemeConfig: ai,
1264
+ getChartConfig: ri,
1265
+ getXYChartData: oi
1266
+ }, zi = /* @__PURE__ */ a((e, t, i, s) => {
1267
+ const n = s.db, o = n.getChartThemeConfig(), g = n.getChartConfig(), m = n.getXYChartData().plots[0].data.map((y) => y[1]);
1268
+ function p(y) {
1269
+ return y === "top" ? "text-before-edge" : "middle";
1270
+ }
1271
+ a(p, "getDominantBaseLine");
1272
+ function k(y) {
1273
+ return y === "left" ? "start" : y === "right" ? "end" : "middle";
1274
+ }
1275
+ a(k, "getTextAnchor");
1276
+ function v(y) {
1277
+ return `translate(${y.x}, ${y.y}) rotate(${y.rotation || 0})`;
1278
+ }
1279
+ a(v, "getTextTransformation"), Nt.debug(`Rendering xychart chart
1280
+ ` + e);
1281
+ const C = mi(t), b = C.append("g").attr("class", "main"), E = b.append("rect").attr("width", g.width).attr("height", g.height).attr("class", "background");
1282
+ yi(C, g.height, g.width, !0), C.attr("viewBox", `0 0 ${g.width} ${g.height}`), E.attr("fill", o.backgroundColor), n.setTmpSVGG(C.append("g").attr("class", "mermaid-tmp-group"));
1283
+ const D = n.getDrawableElem(), P = {};
1284
+ function I(y) {
1285
+ let _ = b, c = "";
1286
+ for (const [W] of y.entries()) {
1287
+ let z = b;
1288
+ W > 0 && P[c] && (z = P[c]), c += y[W], _ = P[c], _ || (_ = P[c] = z.append("g").attr("class", y[W]));
1289
+ }
1290
+ return _;
1291
+ }
1292
+ a(I, "getGroup");
1293
+ for (const y of D) {
1294
+ if (y.data.length === 0)
1295
+ continue;
1296
+ const _ = I(y.groupTexts);
1297
+ switch (y.type) {
1298
+ case "rect":
1299
+ if (_.selectAll("rect").data(y.data).enter().append("rect").attr("x", (c) => c.x).attr("y", (c) => c.y).attr("width", (c) => c.width).attr("height", (c) => c.height).attr("fill", (c) => c.fill).attr("stroke", (c) => c.strokeFill).attr("stroke-width", (c) => c.strokeWidth), g.showDataLabel)
1300
+ if (g.chartOrientation === "horizontal") {
1301
+ let c = function(l, L) {
1302
+ const { data: S, label: R } = l;
1303
+ return L * R.length * W <= S.width - 10;
1304
+ };
1305
+ a(c, "fitsHorizontally");
1306
+ const W = 0.7, z = y.data.map((l, L) => ({ data: l, label: m[L].toString() })).filter((l) => l.data.width > 0 && l.data.height > 0), U = z.map((l) => {
1307
+ const { data: L } = l;
1308
+ let S = L.height * 0.7;
1309
+ for (; !c(l, S) && S > 0; )
1310
+ S -= 1;
1311
+ return S;
1312
+ }), X = Math.floor(Math.min(...U));
1313
+ _.selectAll("text").data(z).enter().append("text").attr("x", (l) => l.data.x + l.data.width - 10).attr("y", (l) => l.data.y + l.data.height / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").attr("fill", "black").attr("font-size", `${X}px`).text((l) => l.label);
1314
+ } else {
1315
+ let c = function(l, L, S) {
1316
+ const { data: R, label: $ } = l, N = L * $.length * 0.7, F = R.x + R.width / 2, h = F - N / 2, u = F + N / 2, x = h >= R.x && u <= R.x + R.width, d = R.y + S + L <= R.y + R.height;
1317
+ return x && d;
1318
+ };
1319
+ a(c, "fitsInBar");
1320
+ const W = 10, z = y.data.map((l, L) => ({ data: l, label: m[L].toString() })).filter((l) => l.data.width > 0 && l.data.height > 0), U = z.map((l) => {
1321
+ const { data: L, label: S } = l;
1322
+ let R = L.width / (S.length * 0.7);
1323
+ for (; !c(l, R, W) && R > 0; )
1324
+ R -= 1;
1325
+ return R;
1326
+ }), X = Math.floor(Math.min(...U));
1327
+ _.selectAll("text").data(z).enter().append("text").attr("x", (l) => l.data.x + l.data.width / 2).attr("y", (l) => l.data.y + W).attr("text-anchor", "middle").attr("dominant-baseline", "hanging").attr("fill", "black").attr("font-size", `${X}px`).text((l) => l.label);
1328
+ }
1329
+ break;
1330
+ case "text":
1331
+ _.selectAll("text").data(y.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (c) => c.fill).attr("font-size", (c) => c.fontSize).attr("dominant-baseline", (c) => p(c.verticalPos)).attr("text-anchor", (c) => k(c.horizontalPos)).attr("transform", (c) => v(c)).text((c) => c.text);
1332
+ break;
1333
+ case "path":
1334
+ _.selectAll("path").data(y.data).enter().append("path").attr("d", (c) => c.path).attr("fill", (c) => c.fill ? c.fill : "none").attr("stroke", (c) => c.strokeFill).attr("stroke-width", (c) => c.strokeWidth);
1335
+ break;
1336
+ }
1337
+ }
1338
+ }, "draw"), Fi = {
1339
+ draw: zi
1340
+ }, Ui = {
1341
+ parser: Ti,
1342
+ db: Wi,
1343
+ renderer: Fi
1344
+ };
1345
+ export {
1346
+ Ui as diagram
1347
+ };