@life-exe/wiki-engine 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +180 -0
  3. package/dist/analytics/index.d.ts +10 -0
  4. package/dist/chunks/abnfDiagram-VCTEODGH-DyAP6Aua.js +87 -0
  5. package/dist/chunks/arc-OroUeRL_.js +83 -0
  6. package/dist/chunks/architectureDiagram-5GKGNRK7-FjmrDCl4.js +4784 -0
  7. package/dist/chunks/blockDiagram-I7D4REHJ-BF3oIDlI.js +1416 -0
  8. package/dist/chunks/c4Diagram-7LVT6UL2-Cmdq0LZr.js +1511 -0
  9. package/dist/chunks/channel-Bdy1QZHo.js +5 -0
  10. package/dist/chunks/chunk-2Q5K7J3B-BwxRSEKd.js +15 -0
  11. package/dist/chunks/chunk-5VM5RSS4-BtHwUU4T.js +19 -0
  12. package/dist/chunks/chunk-F27PBJKO-DF4TGftR.js +68 -0
  13. package/dist/chunks/chunk-IMKFNOWR-DkBQ-1aV.js +1421 -0
  14. package/dist/chunks/chunk-JWPE2WC7-BIokdAUW.js +9 -0
  15. package/dist/chunks/chunk-POPQ4Y6H-CcjOsf9X.js +20 -0
  16. package/dist/chunks/chunk-SHT3W25Y-lYp5BdEg.js +1695 -0
  17. package/dist/chunks/chunk-SVP7TREG-DN-ravNt.js +664 -0
  18. package/dist/chunks/chunk-TICWLB2K-CtTJ0xaY.js +1534 -0
  19. package/dist/chunks/chunk-XXDRQBXY-BovkWFC0.js +8 -0
  20. package/dist/chunks/classDiagram-ZZMXUADV-CMYS0pHw.js +16 -0
  21. package/dist/chunks/classDiagram-v2-VYDZK3BY-CMYS0pHw.js +16 -0
  22. package/dist/chunks/common-BJ4q25wy.js +12633 -0
  23. package/dist/chunks/cose-bilkent-JH36ORCC-CaMqpJY7.js +2608 -0
  24. package/dist/chunks/cynefin-OW5HDTMX-Bzjecpt-.js +23853 -0
  25. package/dist/chunks/cynefinDiagram-5FMLGOSQ-C0NuKLt0.js +299 -0
  26. package/dist/chunks/cytoscape.esm-DmPrb1GM.js +18787 -0
  27. package/dist/chunks/dagre-GXQ25YYZ-Ds09_NdN.js +461 -0
  28. package/dist/chunks/defaultLocale-BgPVtth8.js +171 -0
  29. package/dist/chunks/diagram-S7CK7UJ4-IvSazk1O.js +349 -0
  30. package/dist/chunks/diagram-UQ7AKVKN-58epdx5V.js +223 -0
  31. package/dist/chunks/diagram-VSXAHHWV-BrzRGMeV.js +466 -0
  32. package/dist/chunks/diagram-VX7I27RA-DPL0Nw6d.js +530 -0
  33. package/dist/chunks/diagram-Z3DM3KII-8VWVu0I5.js +143 -0
  34. package/dist/chunks/ebnfDiagram-PWID7BFC-DeByR_ze.js +109 -0
  35. package/dist/chunks/erDiagram-RLTQ6QDP-C9uo9iE1.js +1060 -0
  36. package/dist/chunks/flowDiagram-HODETNUW-BpoY3OMp.js +7 -0
  37. package/dist/chunks/ganttDiagram-EL5Y4UJY-psdwnC-T.js +2711 -0
  38. package/dist/chunks/gitGraphDiagram-WWUBYQGX-vsDfkn_Q.js +828 -0
  39. package/dist/chunks/index-f7Uzykhj.js +38262 -0
  40. package/dist/chunks/infoDiagram-27XIBGKW-8K-eQZiU.js +24 -0
  41. package/dist/chunks/init-DjUOC4st.js +16 -0
  42. package/dist/chunks/ishikawaDiagram-5VMMS53U-CuqR1k5i.js +622 -0
  43. package/dist/chunks/journeyDiagram-3NMN7TZE-BPW1nmwZ.js +834 -0
  44. package/dist/chunks/kanban-definition-UXKFOSKX-iY6-d6jO.js +726 -0
  45. package/dist/chunks/katex-jHfnQmlp.js +11682 -0
  46. package/dist/chunks/layout-CgV9vOdp.js +1704 -0
  47. package/dist/chunks/linear-BzcaSMTS.js +259 -0
  48. package/dist/chunks/mindmap-definition-YA3MSWOX-CaLfHyv0.js +831 -0
  49. package/dist/chunks/ordinal-DfAQgscy.js +61 -0
  50. package/dist/chunks/pegDiagram-XKGWAZYB-6Y28VvVh.js +95 -0
  51. package/dist/chunks/pieDiagram-E7YTZNPT-OrjeRxhs.js +209 -0
  52. package/dist/chunks/quadrantDiagram-AXDQQJYC-rgw2lV2J.js +1025 -0
  53. package/dist/chunks/railroadDiagram-O6MQD6OU-D6QNO5r1.js +77 -0
  54. package/dist/chunks/requirementDiagram-BXWQKSXE-a8tNRSuE.js +884 -0
  55. package/dist/chunks/sankeyDiagram-P5KCCOFB-CdaC8rLw.js +847 -0
  56. package/dist/chunks/sequenceDiagram-WJ2MYXX4-CGLi38Hj.js +2898 -0
  57. package/dist/chunks/sizeCapture-INFHLROL-g5RJXnik.js +47 -0
  58. package/dist/chunks/stateDiagram-D77RDMKH-Cou0eVl1.js +262 -0
  59. package/dist/chunks/stateDiagram-v2-MP3YSRHH-BHQspnUg.js +16 -0
  60. package/dist/chunks/swimlanes-42K2YHIH-BU7S1WgJ.js +5239 -0
  61. package/dist/chunks/swimlanesDiagram-VR7AAH4N-BsEplbno.js +13 -0
  62. package/dist/chunks/timeline-definition-24CTP7MA-BB-IyxWL.js +1066 -0
  63. package/dist/chunks/vennDiagram-4TSXK5OY-BToYolPI.js +1585 -0
  64. package/dist/chunks/wardleyDiagram-VM6X3IG4-BgoueOw_.js +684 -0
  65. package/dist/chunks/xychartDiagram-S5SC5T6Z-CF0fWv-W.js +1492 -0
  66. package/dist/components/CodeBlock.d.ts +5 -0
  67. package/dist/components/CommunityLinks.d.ts +21 -0
  68. package/dist/components/CookieConsent.d.ts +2 -0
  69. package/dist/components/DocLinkCard.d.ts +6 -0
  70. package/dist/components/LecturePageView.d.ts +3 -0
  71. package/dist/components/MermaidDiagram.d.ts +3 -0
  72. package/dist/components/SearchPopup.d.ts +6 -0
  73. package/dist/components/WikiApp.d.ts +9 -0
  74. package/dist/components/WikiLayout.d.ts +2 -0
  75. package/dist/components/WikiPageView.d.ts +6 -0
  76. package/dist/components/ZoomableImage.d.ts +2 -0
  77. package/dist/context/LangContext.d.ts +2 -0
  78. package/dist/context/WikiContext.d.ts +18 -0
  79. package/dist/data.d.ts +8 -0
  80. package/dist/hooks/useLanguage.d.ts +4 -0
  81. package/dist/hooks/useTheme.d.ts +5 -0
  82. package/dist/hooks/useWiki.d.ts +2 -0
  83. package/dist/index.d.ts +24 -0
  84. package/dist/index.js +45 -0
  85. package/dist/languages/ue-cpp.d.ts +7 -0
  86. package/dist/languages/ue-cpp.js +21 -0
  87. package/dist/types.d.ts +119 -0
  88. package/dist/wiki-engine.css +1 -0
  89. package/package.json +76 -0
@@ -0,0 +1,1492 @@
1
+ import { s as pe, g as me, t as $t, q as ye, a as be, b as we, _ as a, l as Ut, K as Ae, d as Ce, A as Se, E as Dt, i as Re, G as Gt, H as _e, L as ke, aF as Te, U as Xt } from "./index-f7Uzykhj.js";
2
+ import { i as De } from "./init-DjUOC4st.js";
3
+ import { o as Pe } from "./ordinal-DfAQgscy.js";
4
+ import { l as Nt } from "./linear-BzcaSMTS.js";
5
+ function ve(i, t, e) {
6
+ i = +i, t = +t, e = (n = arguments.length) < 2 ? (t = i, i = 0, 1) : n < 3 ? 1 : +e;
7
+ for (var s = -1, n = Math.max(0, Math.ceil((t - i) / e)) | 0, o = new Array(n); ++s < n; )
8
+ o[s] = i + s * e;
9
+ return o;
10
+ }
11
+ function St() {
12
+ var i = Pe().unknown(void 0), t = i.domain, e = i.range, s = 0, n = 1, o, h, p = !1, u = 0, f = 0, R = 0.5;
13
+ delete i.unknown;
14
+ function C() {
15
+ var y = t().length, E = n < s, v = E ? n : s, L = E ? s : n;
16
+ o = (L - v) / Math.max(1, y - u + f * 2), p && (o = Math.floor(o)), v += (L - v - o * (y - u)) * R, h = o * (1 - u), p && (v = Math.round(v), h = Math.round(h));
17
+ var M = ve(y).map(function(b) {
18
+ return v + o * b;
19
+ });
20
+ return e(E ? M.reverse() : M);
21
+ }
22
+ return i.domain = function(y) {
23
+ return arguments.length ? (t(y), C()) : t();
24
+ }, i.range = function(y) {
25
+ return arguments.length ? ([s, n] = y, s = +s, n = +n, C()) : [s, n];
26
+ }, i.rangeRound = function(y) {
27
+ return [s, n] = y, s = +s, n = +n, p = !0, C();
28
+ }, i.bandwidth = function() {
29
+ return h;
30
+ }, i.step = function() {
31
+ return o;
32
+ }, i.round = function(y) {
33
+ return arguments.length ? (p = !!y, C()) : p;
34
+ }, i.padding = function(y) {
35
+ return arguments.length ? (u = Math.min(1, f = +y), C()) : u;
36
+ }, i.paddingInner = function(y) {
37
+ return arguments.length ? (u = Math.min(1, y), C()) : u;
38
+ }, i.paddingOuter = function(y) {
39
+ return arguments.length ? (f = +y, C()) : f;
40
+ }, i.align = function(y) {
41
+ return arguments.length ? (R = Math.max(0, Math.min(1, y)), C()) : R;
42
+ }, i.copy = function() {
43
+ return St(t(), [s, n]).round(p).paddingInner(u).paddingOuter(f).align(R);
44
+ }, De.apply(C(), arguments);
45
+ }
46
+ var Rt = (function() {
47
+ var i = /* @__PURE__ */ a(function(W, l, g, d) {
48
+ for (g = g || {}, d = W.length; d--; g[W[d]] = l) ;
49
+ return g;
50
+ }, "o"), t = [1, 10, 12, 14, 16, 18, 19, 21, 23], e = [2, 6], s = [1, 3], n = [1, 5], o = [1, 6], h = [1, 7], p = [1, 5, 10, 12, 14, 16, 18, 19, 21, 23, 36, 37, 38], u = [1, 25], f = [1, 26], R = [1, 28], C = [1, 29], y = [1, 30], E = [1, 31], v = [1, 32], L = [1, 33], M = [1, 34], b = [1, 35], D = [1, 36], c = [1, 37], B = [1, 43], F = [1, 42], X = [1, 47], N = [1, 50], k = [1, 10, 12, 14, 16, 18, 19, 21, 23, 36, 37, 38], H = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 28, 29, 36, 37, 38], A = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 28, 29, 36, 37, 38, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51], S = [1, 65], O = [26, 28], T = {
51
+ trace: /* @__PURE__ */ a(function() {
52
+ }, "trace"),
53
+ yy: {},
54
+ 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, dataPoints: 25, SQUARE_BRACES_END: 26, dataPoint: 27, COMMA: 28, NUMBER_WITH_DECIMAL: 29, STR: 30, xAxisData: 31, bandData: 32, ARROW_DELIMITER: 33, commaSeparatedTexts: 34, yAxisData: 35, NEWLINE: 36, SEMI: 37, EOF: 38, alphaNum: 39, MD_STR: 40, alphaNumToken: 41, AMP: 42, NUM: 43, ALPHA: 44, PLUS: 45, EQUALS: 46, MULT: 47, DOT: 48, BRKT: 49, MINUS: 50, UNDERSCORE: 51, $accept: 0, $end: 1 },
55
+ 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", 28: "COMMA", 29: "NUMBER_WITH_DECIMAL", 30: "STR", 33: "ARROW_DELIMITER", 36: "NEWLINE", 37: "SEMI", 38: "EOF", 40: "MD_STR", 42: "AMP", 43: "NUM", 44: "ALPHA", 45: "PLUS", 46: "EQUALS", 47: "MULT", 48: "DOT", 49: "BRKT", 50: "MINUS", 51: "UNDERSCORE" },
56
+ 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], [27, 2], [27, 1], [13, 1], [13, 2], [13, 1], [31, 1], [31, 3], [32, 3], [34, 3], [34, 1], [15, 1], [15, 2], [15, 1], [35, 3], [4, 1], [4, 1], [4, 1], [11, 1], [11, 1], [11, 1], [39, 1], [39, 2], [41, 1], [41, 1], [41, 1], [41, 1], [41, 1], [41, 1], [41, 1], [41, 1], [41, 1], [41, 1]],
57
+ performAction: /* @__PURE__ */ a(function(l, g, d, x, _, r, lt) {
58
+ var m = r.length - 1;
59
+ switch (_) {
60
+ case 5:
61
+ x.setOrientation(r[m]);
62
+ break;
63
+ case 9:
64
+ x.setDiagramTitle(r[m].text.trim());
65
+ break;
66
+ case 12:
67
+ x.setLineData({ text: "", type: "text" }, r[m]);
68
+ break;
69
+ case 13:
70
+ x.setLineData(r[m - 1], r[m]);
71
+ break;
72
+ case 14:
73
+ x.setBarData({ text: "", type: "text" }, r[m]);
74
+ break;
75
+ case 15:
76
+ x.setBarData(r[m - 1], r[m]);
77
+ break;
78
+ case 16:
79
+ this.$ = r[m].trim(), x.setAccTitle(this.$);
80
+ break;
81
+ case 17:
82
+ case 18:
83
+ this.$ = r[m].trim(), x.setAccDescription(this.$);
84
+ break;
85
+ case 19:
86
+ this.$ = r[m - 1];
87
+ break;
88
+ case 20:
89
+ case 30:
90
+ this.$ = [r[m - 2], ...r[m]];
91
+ break;
92
+ case 21:
93
+ case 31:
94
+ this.$ = [r[m]];
95
+ break;
96
+ case 22:
97
+ this.$ = { value: Number(r[m - 1]), label: r[m] };
98
+ break;
99
+ case 23:
100
+ this.$ = { value: Number(r[m]), label: "" };
101
+ break;
102
+ case 24:
103
+ x.setXAxisTitle(r[m]);
104
+ break;
105
+ case 25:
106
+ x.setXAxisTitle(r[m - 1]);
107
+ break;
108
+ case 26:
109
+ x.setXAxisTitle({ type: "text", text: "" });
110
+ break;
111
+ case 27:
112
+ x.setXAxisBand(r[m]);
113
+ break;
114
+ case 28:
115
+ x.setXAxisRangeData(Number(r[m - 2]), Number(r[m]));
116
+ break;
117
+ case 29:
118
+ this.$ = r[m - 1];
119
+ break;
120
+ case 32:
121
+ x.setYAxisTitle(r[m]);
122
+ break;
123
+ case 33:
124
+ x.setYAxisTitle(r[m - 1]);
125
+ break;
126
+ case 34:
127
+ x.setYAxisTitle({ type: "text", text: "" });
128
+ break;
129
+ case 35:
130
+ x.setYAxisRangeData(Number(r[m - 2]), Number(r[m]));
131
+ break;
132
+ case 39:
133
+ this.$ = { text: r[m], type: "text" };
134
+ break;
135
+ case 40:
136
+ this.$ = { text: r[m], type: "text" };
137
+ break;
138
+ case 41:
139
+ this.$ = { text: r[m], type: "markdown" };
140
+ break;
141
+ case 42:
142
+ this.$ = r[m];
143
+ break;
144
+ case 43:
145
+ this.$ = r[m - 1] + "" + r[m];
146
+ break;
147
+ }
148
+ }, "anonymous"),
149
+ table: [i(t, e, { 3: 1, 4: 2, 7: 4, 5: s, 36: n, 37: o, 38: h }), { 1: [3] }, i(t, e, { 4: 2, 7: 4, 3: 8, 5: s, 36: n, 37: o, 38: h }), i(t, e, { 4: 2, 7: 4, 6: 9, 3: 10, 5: s, 8: [1, 11], 36: n, 37: o, 38: h }), { 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] }, i(p, [2, 36]), i(p, [2, 37]), i(p, [2, 38]), { 1: [2, 1] }, i(t, e, { 4: 2, 7: 4, 3: 21, 5: s, 36: n, 37: o, 38: h }), { 1: [2, 3] }, i(p, [2, 5]), i(t, [2, 7], { 4: 22, 36: n, 37: o, 38: h }), { 11: 23, 30: u, 39: 24, 40: f, 41: 27, 42: R, 43: C, 44: y, 45: E, 46: v, 47: L, 48: M, 49: b, 50: D, 51: c }, { 11: 39, 13: 38, 24: B, 29: F, 30: u, 31: 40, 32: 41, 39: 24, 40: f, 41: 27, 42: R, 43: C, 44: y, 45: E, 46: v, 47: L, 48: M, 49: b, 50: D, 51: c }, { 11: 45, 15: 44, 29: X, 30: u, 35: 46, 39: 24, 40: f, 41: 27, 42: R, 43: C, 44: y, 45: E, 46: v, 47: L, 48: M, 49: b, 50: D, 51: c }, { 11: 49, 17: 48, 24: N, 30: u, 39: 24, 40: f, 41: 27, 42: R, 43: C, 44: y, 45: E, 46: v, 47: L, 48: M, 49: b, 50: D, 51: c }, { 11: 52, 17: 51, 24: N, 30: u, 39: 24, 40: f, 41: 27, 42: R, 43: C, 44: y, 45: E, 46: v, 47: L, 48: M, 49: b, 50: D, 51: c }, { 20: [1, 53] }, { 22: [1, 54] }, i(k, [2, 18]), { 1: [2, 2] }, i(k, [2, 8]), i(k, [2, 9]), i(H, [2, 39], { 41: 55, 42: R, 43: C, 44: y, 45: E, 46: v, 47: L, 48: M, 49: b, 50: D, 51: c }), i(H, [2, 40]), i(H, [2, 41]), i(A, [2, 42]), i(A, [2, 44]), i(A, [2, 45]), i(A, [2, 46]), i(A, [2, 47]), i(A, [2, 48]), i(A, [2, 49]), i(A, [2, 50]), i(A, [2, 51]), i(A, [2, 52]), i(A, [2, 53]), i(k, [2, 10]), i(k, [2, 24], { 32: 41, 31: 56, 24: B, 29: F }), i(k, [2, 26]), i(k, [2, 27]), { 33: [1, 57] }, { 11: 59, 30: u, 34: 58, 39: 24, 40: f, 41: 27, 42: R, 43: C, 44: y, 45: E, 46: v, 47: L, 48: M, 49: b, 50: D, 51: c }, i(k, [2, 11]), i(k, [2, 32], { 35: 60, 29: X }), i(k, [2, 34]), { 33: [1, 61] }, i(k, [2, 12]), { 17: 62, 24: N }, { 25: 63, 27: 64, 29: S }, i(k, [2, 14]), { 17: 66, 24: N }, i(k, [2, 16]), i(k, [2, 17]), i(A, [2, 43]), i(k, [2, 25]), { 29: [1, 67] }, { 26: [1, 68] }, { 26: [2, 31], 28: [1, 69] }, i(k, [2, 33]), { 29: [1, 70] }, i(k, [2, 13]), { 26: [1, 71] }, { 26: [2, 21], 28: [1, 72] }, i(O, [2, 23], { 30: [1, 73] }), i(k, [2, 15]), i(k, [2, 28]), i(k, [2, 29]), { 11: 59, 30: u, 34: 74, 39: 24, 40: f, 41: 27, 42: R, 43: C, 44: y, 45: E, 46: v, 47: L, 48: M, 49: b, 50: D, 51: c }, i(k, [2, 35]), i(k, [2, 19]), { 25: 75, 27: 64, 29: S }, i(O, [2, 22]), { 26: [2, 30] }, { 26: [2, 20] }],
150
+ defaultActions: { 8: [2, 1], 10: [2, 3], 21: [2, 2], 74: [2, 30], 75: [2, 20] },
151
+ parseError: /* @__PURE__ */ a(function(l, g) {
152
+ if (g.recoverable)
153
+ this.trace(l);
154
+ else {
155
+ var d = new Error(l);
156
+ throw d.hash = g, d;
157
+ }
158
+ }, "parseError"),
159
+ parse: /* @__PURE__ */ a(function(l) {
160
+ var g = this, d = [0], x = [], _ = [null], r = [], lt = this.table, m = "", dt = 0, Ot = 0, ue = 2, Vt = 1, de = r.slice.call(arguments, 1), P = Object.create(this.lexer), $ = { yy: {} };
161
+ for (var bt in this.yy)
162
+ Object.prototype.hasOwnProperty.call(this.yy, bt) && ($.yy[bt] = this.yy[bt]);
163
+ P.setInput(l, $.yy), $.yy.lexer = P, $.yy.parser = this, typeof P.yylloc > "u" && (P.yylloc = {});
164
+ var wt = P.yylloc;
165
+ r.push(wt);
166
+ var xe = P.options && P.options.ranges;
167
+ typeof $.yy.parseError == "function" ? this.parseError = $.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
168
+ function fe(z) {
169
+ d.length = d.length - 2 * z, _.length = _.length - z, r.length = r.length - z;
170
+ }
171
+ a(fe, "popStack");
172
+ function Ft() {
173
+ var z;
174
+ return z = x.pop() || P.lex() || Vt, typeof z != "number" && (z instanceof Array && (x = z, z = x.pop()), z = g.symbols_[z] || z), z;
175
+ }
176
+ a(Ft, "lex");
177
+ for (var I, U, V, At, j = {}, xt, Y, Wt, ft; ; ) {
178
+ if (U = d[d.length - 1], this.defaultActions[U] ? V = this.defaultActions[U] : ((I === null || typeof I > "u") && (I = Ft()), V = lt[U] && lt[U][I]), typeof V > "u" || !V.length || !V[0]) {
179
+ var Ct = "";
180
+ ft = [];
181
+ for (xt in lt[U])
182
+ this.terminals_[xt] && xt > ue && ft.push("'" + this.terminals_[xt] + "'");
183
+ P.showPosition ? Ct = "Parse error on line " + (dt + 1) + `:
184
+ ` + P.showPosition() + `
185
+ Expecting ` + ft.join(", ") + ", got '" + (this.terminals_[I] || I) + "'" : Ct = "Parse error on line " + (dt + 1) + ": Unexpected " + (I == Vt ? "end of input" : "'" + (this.terminals_[I] || I) + "'"), this.parseError(Ct, {
186
+ text: P.match,
187
+ token: this.terminals_[I] || I,
188
+ line: P.yylineno,
189
+ loc: wt,
190
+ expected: ft
191
+ });
192
+ }
193
+ if (V[0] instanceof Array && V.length > 1)
194
+ throw new Error("Parse Error: multiple actions possible at state: " + U + ", token: " + I);
195
+ switch (V[0]) {
196
+ case 1:
197
+ d.push(I), _.push(P.yytext), r.push(P.yylloc), d.push(V[1]), I = null, Ot = P.yyleng, m = P.yytext, dt = P.yylineno, wt = P.yylloc;
198
+ break;
199
+ case 2:
200
+ if (Y = this.productions_[V[1]][1], j.$ = _[_.length - Y], j._$ = {
201
+ first_line: r[r.length - (Y || 1)].first_line,
202
+ last_line: r[r.length - 1].last_line,
203
+ first_column: r[r.length - (Y || 1)].first_column,
204
+ last_column: r[r.length - 1].last_column
205
+ }, xe && (j._$.range = [
206
+ r[r.length - (Y || 1)].range[0],
207
+ r[r.length - 1].range[1]
208
+ ]), At = this.performAction.apply(j, [
209
+ m,
210
+ Ot,
211
+ dt,
212
+ $.yy,
213
+ V[1],
214
+ _,
215
+ r
216
+ ].concat(de)), typeof At < "u")
217
+ return At;
218
+ Y && (d = d.slice(0, -1 * Y * 2), _ = _.slice(0, -1 * Y), r = r.slice(0, -1 * Y)), d.push(this.productions_[V[1]][0]), _.push(j.$), r.push(j._$), Wt = lt[d[d.length - 2]][d[d.length - 1]], d.push(Wt);
219
+ break;
220
+ case 3:
221
+ return !0;
222
+ }
223
+ }
224
+ return !0;
225
+ }, "parse")
226
+ }, ht = /* @__PURE__ */ (function() {
227
+ var W = {
228
+ EOF: 1,
229
+ parseError: /* @__PURE__ */ a(function(g, d) {
230
+ if (this.yy.parser)
231
+ this.yy.parser.parseError(g, d);
232
+ else
233
+ throw new Error(g);
234
+ }, "parseError"),
235
+ // resets the lexer, sets new input
236
+ setInput: /* @__PURE__ */ a(function(l, g) {
237
+ return this.yy = g || this.yy || {}, this._input = l, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
238
+ first_line: 1,
239
+ first_column: 0,
240
+ last_line: 1,
241
+ last_column: 0
242
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
243
+ }, "setInput"),
244
+ // consumes and returns one char from the input
245
+ input: /* @__PURE__ */ a(function() {
246
+ var l = this._input[0];
247
+ this.yytext += l, this.yyleng++, this.offset++, this.match += l, this.matched += l;
248
+ var g = l.match(/(?:\r\n?|\n).*/g);
249
+ return g ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), l;
250
+ }, "input"),
251
+ // unshifts one char (or a string) into the input
252
+ unput: /* @__PURE__ */ a(function(l) {
253
+ var g = l.length, d = l.split(/(?:\r\n?|\n)/g);
254
+ this._input = l + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - g), this.offset -= g;
255
+ var x = this.match.split(/(?:\r\n?|\n)/g);
256
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), d.length - 1 && (this.yylineno -= d.length - 1);
257
+ var _ = this.yylloc.range;
258
+ return this.yylloc = {
259
+ first_line: this.yylloc.first_line,
260
+ last_line: this.yylineno + 1,
261
+ first_column: this.yylloc.first_column,
262
+ last_column: d ? (d.length === x.length ? this.yylloc.first_column : 0) + x[x.length - d.length].length - d[0].length : this.yylloc.first_column - g
263
+ }, this.options.ranges && (this.yylloc.range = [_[0], _[0] + this.yyleng - g]), this.yyleng = this.yytext.length, this;
264
+ }, "unput"),
265
+ // When called from action, caches matched text and appends it on next action
266
+ more: /* @__PURE__ */ a(function() {
267
+ return this._more = !0, this;
268
+ }, "more"),
269
+ // 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.
270
+ reject: /* @__PURE__ */ a(function() {
271
+ if (this.options.backtrack_lexer)
272
+ this._backtrack = !0;
273
+ else
274
+ 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).
275
+ ` + this.showPosition(), {
276
+ text: "",
277
+ token: null,
278
+ line: this.yylineno
279
+ });
280
+ return this;
281
+ }, "reject"),
282
+ // retain first n characters of the match
283
+ less: /* @__PURE__ */ a(function(l) {
284
+ this.unput(this.match.slice(l));
285
+ }, "less"),
286
+ // displays already matched input, i.e. for error messages
287
+ pastInput: /* @__PURE__ */ a(function() {
288
+ var l = this.matched.substr(0, this.matched.length - this.match.length);
289
+ return (l.length > 20 ? "..." : "") + l.substr(-20).replace(/\n/g, "");
290
+ }, "pastInput"),
291
+ // displays upcoming input, i.e. for error messages
292
+ upcomingInput: /* @__PURE__ */ a(function() {
293
+ var l = this.match;
294
+ return l.length < 20 && (l += this._input.substr(0, 20 - l.length)), (l.substr(0, 20) + (l.length > 20 ? "..." : "")).replace(/\n/g, "");
295
+ }, "upcomingInput"),
296
+ // displays the character position where the lexing error occurred, i.e. for error messages
297
+ showPosition: /* @__PURE__ */ a(function() {
298
+ var l = this.pastInput(), g = new Array(l.length + 1).join("-");
299
+ return l + this.upcomingInput() + `
300
+ ` + g + "^";
301
+ }, "showPosition"),
302
+ // test the lexed token: return FALSE when not a match, otherwise return token
303
+ test_match: /* @__PURE__ */ a(function(l, g) {
304
+ var d, x, _;
305
+ if (this.options.backtrack_lexer && (_ = {
306
+ yylineno: this.yylineno,
307
+ yylloc: {
308
+ first_line: this.yylloc.first_line,
309
+ last_line: this.last_line,
310
+ first_column: this.yylloc.first_column,
311
+ last_column: this.yylloc.last_column
312
+ },
313
+ yytext: this.yytext,
314
+ match: this.match,
315
+ matches: this.matches,
316
+ matched: this.matched,
317
+ yyleng: this.yyleng,
318
+ offset: this.offset,
319
+ _more: this._more,
320
+ _input: this._input,
321
+ yy: this.yy,
322
+ conditionStack: this.conditionStack.slice(0),
323
+ done: this.done
324
+ }, this.options.ranges && (_.yylloc.range = this.yylloc.range.slice(0))), x = l[0].match(/(?:\r\n?|\n).*/g), x && (this.yylineno += x.length), this.yylloc = {
325
+ first_line: this.yylloc.last_line,
326
+ last_line: this.yylineno + 1,
327
+ first_column: this.yylloc.last_column,
328
+ last_column: x ? x[x.length - 1].length - x[x.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + l[0].length
329
+ }, this.yytext += l[0], this.match += l[0], this.matches = l, 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(l[0].length), this.matched += l[0], d = this.performAction.call(this, this.yy, this, g, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), d)
330
+ return d;
331
+ if (this._backtrack) {
332
+ for (var r in _)
333
+ this[r] = _[r];
334
+ return !1;
335
+ }
336
+ return !1;
337
+ }, "test_match"),
338
+ // return next match in input
339
+ next: /* @__PURE__ */ a(function() {
340
+ if (this.done)
341
+ return this.EOF;
342
+ this._input || (this.done = !0);
343
+ var l, g, d, x;
344
+ this._more || (this.yytext = "", this.match = "");
345
+ for (var _ = this._currentRules(), r = 0; r < _.length; r++)
346
+ if (d = this._input.match(this.rules[_[r]]), d && (!g || d[0].length > g[0].length)) {
347
+ if (g = d, x = r, this.options.backtrack_lexer) {
348
+ if (l = this.test_match(d, _[r]), l !== !1)
349
+ return l;
350
+ if (this._backtrack) {
351
+ g = !1;
352
+ continue;
353
+ } else
354
+ return !1;
355
+ } else if (!this.options.flex)
356
+ break;
357
+ }
358
+ return g ? (l = this.test_match(g, _[x]), l !== !1 ? l : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
359
+ ` + this.showPosition(), {
360
+ text: "",
361
+ token: null,
362
+ line: this.yylineno
363
+ });
364
+ }, "next"),
365
+ // return next match that has a token
366
+ lex: /* @__PURE__ */ a(function() {
367
+ var g = this.next();
368
+ return g || this.lex();
369
+ }, "lex"),
370
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
371
+ begin: /* @__PURE__ */ a(function(g) {
372
+ this.conditionStack.push(g);
373
+ }, "begin"),
374
+ // pop the previously active lexer condition state off the condition stack
375
+ popState: /* @__PURE__ */ a(function() {
376
+ var g = this.conditionStack.length - 1;
377
+ return g > 0 ? this.conditionStack.pop() : this.conditionStack[0];
378
+ }, "popState"),
379
+ // produce the lexer rule set which is active for the currently active lexer condition state
380
+ _currentRules: /* @__PURE__ */ a(function() {
381
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
382
+ }, "_currentRules"),
383
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
384
+ topState: /* @__PURE__ */ a(function(g) {
385
+ return g = this.conditionStack.length - 1 - Math.abs(g || 0), g >= 0 ? this.conditionStack[g] : "INITIAL";
386
+ }, "topState"),
387
+ // alias for begin(condition)
388
+ pushState: /* @__PURE__ */ a(function(g) {
389
+ this.begin(g);
390
+ }, "pushState"),
391
+ // return the number of states currently on the stack
392
+ stateStackSize: /* @__PURE__ */ a(function() {
393
+ return this.conditionStack.length;
394
+ }, "stateStackSize"),
395
+ options: { "case-insensitive": !0 },
396
+ performAction: /* @__PURE__ */ a(function(g, d, x, _) {
397
+ switch (x) {
398
+ case 0:
399
+ break;
400
+ case 1:
401
+ break;
402
+ case 2:
403
+ return this.popState(), 36;
404
+ case 3:
405
+ return this.popState(), 36;
406
+ case 4:
407
+ return 36;
408
+ case 5:
409
+ break;
410
+ case 6:
411
+ return 10;
412
+ case 7:
413
+ return this.pushState("acc_title"), 19;
414
+ case 8:
415
+ return this.popState(), "acc_title_value";
416
+ case 9:
417
+ return this.pushState("acc_descr"), 21;
418
+ case 10:
419
+ return this.popState(), "acc_descr_value";
420
+ case 11:
421
+ this.pushState("acc_descr_multiline");
422
+ break;
423
+ case 12:
424
+ this.popState();
425
+ break;
426
+ case 13:
427
+ return "acc_descr_multiline_value";
428
+ case 14:
429
+ return 5;
430
+ case 15:
431
+ return 5;
432
+ case 16:
433
+ return 8;
434
+ case 17:
435
+ return this.pushState("axis_data"), "X_AXIS";
436
+ case 18:
437
+ return this.pushState("axis_data"), "Y_AXIS";
438
+ case 19:
439
+ return this.pushState("axis_band_data"), 24;
440
+ case 20:
441
+ return 33;
442
+ case 21:
443
+ return this.pushState("data"), 16;
444
+ case 22:
445
+ return this.pushState("data"), 18;
446
+ case 23:
447
+ return this.pushState("data_inner"), 24;
448
+ case 24:
449
+ return 29;
450
+ case 25:
451
+ return this.popState(), 26;
452
+ case 26:
453
+ this.popState();
454
+ break;
455
+ case 27:
456
+ this.pushState("string");
457
+ break;
458
+ case 28:
459
+ this.popState();
460
+ break;
461
+ case 29:
462
+ return "STR";
463
+ case 30:
464
+ return 24;
465
+ case 31:
466
+ return 26;
467
+ case 32:
468
+ return 44;
469
+ case 33:
470
+ return "COLON";
471
+ case 34:
472
+ return 45;
473
+ case 35:
474
+ return 28;
475
+ case 36:
476
+ return 46;
477
+ case 37:
478
+ return 47;
479
+ case 38:
480
+ return 49;
481
+ case 39:
482
+ return 51;
483
+ case 40:
484
+ return 48;
485
+ case 41:
486
+ return 42;
487
+ case 42:
488
+ return 50;
489
+ case 43:
490
+ return 43;
491
+ case 44:
492
+ break;
493
+ case 45:
494
+ return 37;
495
+ case 46:
496
+ return 38;
497
+ }
498
+ }, "anonymous"),
499
+ 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],
500
+ 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 } }
501
+ };
502
+ return W;
503
+ })();
504
+ T.lexer = ht;
505
+ function q() {
506
+ this.yy = {};
507
+ }
508
+ return a(q, "Parser"), q.prototype = T, T.Parser = q, new q();
509
+ })();
510
+ Rt.parser = Rt;
511
+ var Le = Rt;
512
+ function pt(i) {
513
+ return i.type === "bar";
514
+ }
515
+ a(pt, "isBarPlot");
516
+ function mt(i) {
517
+ return i.type === "band";
518
+ }
519
+ a(mt, "isBandAxisData");
520
+ function K(i) {
521
+ return i.type === "linear";
522
+ }
523
+ a(K, "isLinearAxisData");
524
+ var Q, Pt = (Q = class {
525
+ constructor(t) {
526
+ this.parentGroup = t;
527
+ }
528
+ getMaxDimension(t, e) {
529
+ if (!this.parentGroup)
530
+ return {
531
+ width: t.reduce((o, h) => Math.max(h.length, o), 0) * e,
532
+ height: e
533
+ };
534
+ const s = {
535
+ width: 0,
536
+ height: 0
537
+ }, n = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", e);
538
+ for (const o of t) {
539
+ const h = Te(n, 1, o), p = h ? h.width : o.length * e, u = h ? h.height : e;
540
+ s.width = Math.max(s.width, p), s.height = Math.max(s.height, u);
541
+ }
542
+ return n.remove(), s;
543
+ }
544
+ }, a(Q, "TextDimensionCalculatorWithFont"), Q), Yt = 0.7, Ht = 0.2, Z, qt = (Z = class {
545
+ constructor(t, e, s, n) {
546
+ this.axisConfig = t, this.title = e, 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.normalizedLabelRotationInRad = 0, this.range = [0, 10], this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }, this.axisPosition = "left", this.normalizedLabelRotationInRad = this.axisConfig.labelRotation >= -90 && this.axisConfig.labelRotation <= 90 ? this.axisConfig.labelRotation * Math.PI / 180 : 0;
547
+ }
548
+ setRange(t) {
549
+ 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();
550
+ }
551
+ getRange() {
552
+ return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding];
553
+ }
554
+ setAxisPosition(t) {
555
+ this.axisPosition = t, this.setRange(this.range);
556
+ }
557
+ getTickDistance() {
558
+ const t = this.getRange();
559
+ return Math.abs(t[0] - t[1]) / this.getTickValues().length;
560
+ }
561
+ getAxisOuterPadding() {
562
+ return this.outerPadding;
563
+ }
564
+ getLabelDimension() {
565
+ return this.textDimensionCalculator.getMaxDimension(
566
+ this.getTickValues().map((t) => t.toString()),
567
+ this.axisConfig.labelFontSize
568
+ );
569
+ }
570
+ recalculateOuterPaddingToDrawBar() {
571
+ Yt * this.getTickDistance() > this.outerPadding * 2 && (this.outerPadding = Math.floor(Yt * this.getTickDistance() / 2)), this.recalculateScale();
572
+ }
573
+ calculateSpaceIfDrawnHorizontally(t) {
574
+ let e = t.height;
575
+ if (this.axisConfig.showAxisLine && e > this.axisConfig.axisLineWidth && (e -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
576
+ const s = this.getLabelDimension(), n = Ht * t.width;
577
+ this.outerPadding = Math.min(s.width / 2, n);
578
+ let o = s.height;
579
+ this.axisPosition === "bottom" && this.normalizedLabelRotationInRad !== 0 && (o = Math.max(
580
+ o,
581
+ Math.abs(Math.sin(this.normalizedLabelRotationInRad) * s.width) + Math.abs(Math.cos(this.normalizedLabelRotationInRad) * s.height)
582
+ )), o += this.axisConfig.labelPadding * 2, this.labelTextHeight = s.height, o <= e && (e -= o, this.showLabel = !0);
583
+ }
584
+ if (this.axisConfig.showTick && e >= this.axisConfig.tickLength && (this.showTick = !0, e -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
585
+ const s = this.textDimensionCalculator.getMaxDimension(
586
+ [this.title],
587
+ this.axisConfig.titleFontSize
588
+ ), n = s.height + this.axisConfig.titlePadding * 2;
589
+ this.titleTextHeight = s.height, n <= e && (e -= n, this.showTitle = !0);
590
+ }
591
+ this.boundingRect.width = t.width, this.boundingRect.height = t.height - e;
592
+ }
593
+ calculateSpaceIfDrawnVertical(t) {
594
+ let e = t.width;
595
+ if (this.axisConfig.showAxisLine && e > this.axisConfig.axisLineWidth && (e -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
596
+ const s = this.getLabelDimension(), n = Ht * t.height;
597
+ this.outerPadding = Math.min(s.height / 2, n);
598
+ const o = s.width + this.axisConfig.labelPadding * 2;
599
+ o <= e && (e -= o, this.showLabel = !0);
600
+ }
601
+ if (this.axisConfig.showTick && e >= this.axisConfig.tickLength && (this.showTick = !0, e -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
602
+ const s = this.textDimensionCalculator.getMaxDimension(
603
+ [this.title],
604
+ this.axisConfig.titleFontSize
605
+ ), n = s.height + this.axisConfig.titlePadding * 2;
606
+ this.titleTextHeight = s.height, n <= e && (e -= n, this.showTitle = !0);
607
+ }
608
+ this.boundingRect.width = t.width - e, this.boundingRect.height = t.height;
609
+ }
610
+ calculateSpace(t) {
611
+ return this.axisPosition === "left" || this.axisPosition === "right" ? this.calculateSpaceIfDrawnVertical(t) : this.calculateSpaceIfDrawnHorizontally(t), this.recalculateScale(), {
612
+ width: this.boundingRect.width,
613
+ height: this.boundingRect.height
614
+ };
615
+ }
616
+ setBoundingBoxXY(t) {
617
+ this.boundingRect.x = t.x, this.boundingRect.y = t.y;
618
+ }
619
+ calculateOffsetByRotation(t) {
620
+ const e = this.normalizedLabelRotationInRad;
621
+ return e === 0 ? 0 : Math.sin(e) * this.getLabelDimension()[t] / 2;
622
+ }
623
+ getDrawableElementsForLeftAxis() {
624
+ const t = [];
625
+ if (this.showAxisLine) {
626
+ const e = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
627
+ t.push({
628
+ type: "path",
629
+ groupTexts: ["left-axis", "axisl-line"],
630
+ data: [
631
+ {
632
+ path: `M ${e},${this.boundingRect.y} L ${e},${this.boundingRect.y + this.boundingRect.height} `,
633
+ strokeFill: this.axisThemeConfig.axisLineColor,
634
+ strokeWidth: this.axisConfig.axisLineWidth
635
+ }
636
+ ]
637
+ });
638
+ }
639
+ if (this.showLabel && t.push({
640
+ type: "text",
641
+ groupTexts: ["left-axis", "label"],
642
+ data: this.getTickValues().map((e) => ({
643
+ text: e.toString(),
644
+ 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),
645
+ y: this.getScaleValue(e),
646
+ fill: this.axisThemeConfig.labelColor,
647
+ fontSize: this.axisConfig.labelFontSize,
648
+ rotation: 0,
649
+ verticalPos: "middle",
650
+ horizontalPos: "right"
651
+ }))
652
+ }), this.showTick) {
653
+ const e = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
654
+ t.push({
655
+ type: "path",
656
+ groupTexts: ["left-axis", "ticks"],
657
+ data: this.getTickValues().map((s) => ({
658
+ path: `M ${e},${this.getScaleValue(s)} L ${e - this.axisConfig.tickLength},${this.getScaleValue(s)}`,
659
+ strokeFill: this.axisThemeConfig.tickColor,
660
+ strokeWidth: this.axisConfig.tickWidth
661
+ }))
662
+ });
663
+ }
664
+ return this.showTitle && t.push({
665
+ type: "text",
666
+ groupTexts: ["left-axis", "title"],
667
+ data: [
668
+ {
669
+ text: this.title,
670
+ x: this.boundingRect.x + this.axisConfig.titlePadding,
671
+ y: this.boundingRect.y + this.boundingRect.height / 2,
672
+ fill: this.axisThemeConfig.titleColor,
673
+ fontSize: this.axisConfig.titleFontSize,
674
+ rotation: 270,
675
+ verticalPos: "top",
676
+ horizontalPos: "center"
677
+ }
678
+ ]
679
+ }), t;
680
+ }
681
+ getDrawableElementsForBottomAxis() {
682
+ const t = [];
683
+ if (this.showAxisLine) {
684
+ const e = this.boundingRect.y + this.axisConfig.axisLineWidth / 2;
685
+ t.push({
686
+ type: "path",
687
+ groupTexts: ["bottom-axis", "axis-line"],
688
+ data: [
689
+ {
690
+ path: `M ${this.boundingRect.x},${e} L ${this.boundingRect.x + this.boundingRect.width},${e}`,
691
+ strokeFill: this.axisThemeConfig.axisLineColor,
692
+ strokeWidth: this.axisConfig.axisLineWidth
693
+ }
694
+ ]
695
+ });
696
+ }
697
+ if (this.showLabel && t.push({
698
+ type: "text",
699
+ groupTexts: ["bottom-axis", "label"],
700
+ data: this.getTickValues().map((e) => ({
701
+ text: e.toString(),
702
+ x: this.getScaleValue(e) + this.calculateOffsetByRotation("height"),
703
+ y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0) + Math.abs(this.calculateOffsetByRotation("width")),
704
+ fill: this.axisThemeConfig.labelColor,
705
+ fontSize: this.axisConfig.labelFontSize,
706
+ rotation: this.normalizedLabelRotationInRad * 180 / Math.PI,
707
+ verticalPos: "top",
708
+ horizontalPos: "center"
709
+ }))
710
+ }), this.showTick) {
711
+ const e = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
712
+ t.push({
713
+ type: "path",
714
+ groupTexts: ["bottom-axis", "ticks"],
715
+ data: this.getTickValues().map((s) => ({
716
+ path: `M ${this.getScaleValue(s)},${e} L ${this.getScaleValue(s)},${e + this.axisConfig.tickLength}`,
717
+ strokeFill: this.axisThemeConfig.tickColor,
718
+ strokeWidth: this.axisConfig.tickWidth
719
+ }))
720
+ });
721
+ }
722
+ return this.showTitle && t.push({
723
+ type: "text",
724
+ groupTexts: ["bottom-axis", "title"],
725
+ data: [
726
+ {
727
+ text: this.title,
728
+ x: this.range[0] + (this.range[1] - this.range[0]) / 2,
729
+ y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight,
730
+ fill: this.axisThemeConfig.titleColor,
731
+ fontSize: this.axisConfig.titleFontSize,
732
+ rotation: 0,
733
+ verticalPos: "top",
734
+ horizontalPos: "center"
735
+ }
736
+ ]
737
+ }), t;
738
+ }
739
+ getDrawableElementsForTopAxis() {
740
+ const t = [];
741
+ if (this.showAxisLine) {
742
+ const e = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2;
743
+ t.push({
744
+ type: "path",
745
+ groupTexts: ["top-axis", "axis-line"],
746
+ data: [
747
+ {
748
+ path: `M ${this.boundingRect.x},${e} L ${this.boundingRect.x + this.boundingRect.width},${e}`,
749
+ strokeFill: this.axisThemeConfig.axisLineColor,
750
+ strokeWidth: this.axisConfig.axisLineWidth
751
+ }
752
+ ]
753
+ });
754
+ }
755
+ if (this.showLabel && t.push({
756
+ type: "text",
757
+ groupTexts: ["top-axis", "label"],
758
+ data: this.getTickValues().map((e) => ({
759
+ text: e.toString(),
760
+ x: this.getScaleValue(e),
761
+ y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding,
762
+ fill: this.axisThemeConfig.labelColor,
763
+ fontSize: this.axisConfig.labelFontSize,
764
+ rotation: 0,
765
+ verticalPos: "top",
766
+ horizontalPos: "center"
767
+ }))
768
+ }), this.showTick) {
769
+ const e = this.boundingRect.y;
770
+ t.push({
771
+ type: "path",
772
+ groupTexts: ["top-axis", "ticks"],
773
+ data: this.getTickValues().map((s) => ({
774
+ path: `M ${this.getScaleValue(s)},${e + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(s)},${e + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`,
775
+ strokeFill: this.axisThemeConfig.tickColor,
776
+ strokeWidth: this.axisConfig.tickWidth
777
+ }))
778
+ });
779
+ }
780
+ return this.showTitle && t.push({
781
+ type: "text",
782
+ groupTexts: ["top-axis", "title"],
783
+ data: [
784
+ {
785
+ text: this.title,
786
+ x: this.boundingRect.x + this.boundingRect.width / 2,
787
+ y: this.boundingRect.y + this.axisConfig.titlePadding,
788
+ fill: this.axisThemeConfig.titleColor,
789
+ fontSize: this.axisConfig.titleFontSize,
790
+ rotation: 0,
791
+ verticalPos: "top",
792
+ horizontalPos: "center"
793
+ }
794
+ ]
795
+ }), t;
796
+ }
797
+ getDrawableElements() {
798
+ if (this.axisPosition === "left")
799
+ return this.getDrawableElementsForLeftAxis();
800
+ if (this.axisPosition === "right")
801
+ throw Error("Drawing of right axis is not implemented");
802
+ return this.axisPosition === "bottom" ? this.getDrawableElementsForBottomAxis() : this.axisPosition === "top" ? this.getDrawableElementsForTopAxis() : [];
803
+ }
804
+ }, a(Z, "BaseAxis"), Z), J, Ee = (J = class extends qt {
805
+ constructor(t, e, s, n, o) {
806
+ super(t, n, o, e), this.categories = s, this.scale = St().domain(this.categories).range(this.getRange());
807
+ }
808
+ setRange(t) {
809
+ super.setRange(t);
810
+ }
811
+ recalculateScale() {
812
+ this.scale = St().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5), Ut.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
813
+ }
814
+ getTickValues() {
815
+ return this.categories;
816
+ }
817
+ getScaleValue(t) {
818
+ return this.scale(t) ?? this.getRange()[0];
819
+ }
820
+ }, a(J, "BandAxis"), J), tt, Me = (tt = class extends qt {
821
+ constructor(t, e, s, n, o) {
822
+ super(t, n, o, e), this.domain = s, this.scale = Nt().domain(this.domain).range(this.getRange());
823
+ }
824
+ getTickValues() {
825
+ return this.scale.ticks();
826
+ }
827
+ recalculateScale() {
828
+ const t = [...this.domain];
829
+ this.axisPosition === "left" && t.reverse(), this.scale = Nt().domain(t).range(this.getRange());
830
+ }
831
+ getScaleValue(t) {
832
+ return this.scale(t);
833
+ }
834
+ }, a(tt, "LinearAxis"), tt);
835
+ function _t(i, t, e, s) {
836
+ const n = new Pt(s);
837
+ return mt(i) ? new Ee(
838
+ t,
839
+ e,
840
+ i.categories,
841
+ i.title,
842
+ n
843
+ ) : new Me(
844
+ t,
845
+ e,
846
+ [i.min, i.max],
847
+ i.title,
848
+ n
849
+ );
850
+ }
851
+ a(_t, "getAxis");
852
+ var et, Ie = (et = class {
853
+ constructor(t, e, s, n) {
854
+ this.textDimensionCalculator = t, this.chartConfig = e, this.chartData = s, this.chartThemeConfig = n, this.boundingRect = {
855
+ x: 0,
856
+ y: 0,
857
+ width: 0,
858
+ height: 0
859
+ }, this.showChartTitle = !1;
860
+ }
861
+ setBoundingBoxXY(t) {
862
+ this.boundingRect.x = t.x, this.boundingRect.y = t.y;
863
+ }
864
+ calculateSpace(t) {
865
+ const e = this.textDimensionCalculator.getMaxDimension(
866
+ [this.chartData.title],
867
+ this.chartConfig.titleFontSize
868
+ ), s = Math.max(e.width, t.width), n = e.height + 2 * this.chartConfig.titlePadding;
869
+ return e.width <= s && e.height <= n && this.chartConfig.showTitle && this.chartData.title && (this.boundingRect.width = s, this.boundingRect.height = n, this.showChartTitle = !0), {
870
+ width: this.boundingRect.width,
871
+ height: this.boundingRect.height
872
+ };
873
+ }
874
+ getDrawableElements() {
875
+ const t = [];
876
+ return this.showChartTitle && t.push({
877
+ groupTexts: ["chart-title"],
878
+ type: "text",
879
+ data: [
880
+ {
881
+ fontSize: this.chartConfig.titleFontSize,
882
+ text: this.chartData.title,
883
+ verticalPos: "middle",
884
+ horizontalPos: "center",
885
+ x: this.boundingRect.x + this.boundingRect.width / 2,
886
+ y: this.boundingRect.y + this.boundingRect.height / 2,
887
+ fill: this.chartThemeConfig.titleColor,
888
+ rotation: 0
889
+ }
890
+ ]
891
+ }), t;
892
+ }
893
+ }, a(et, "ChartTitle"), et);
894
+ function jt(i, t, e, s) {
895
+ const n = new Pt(s);
896
+ return new Ie(n, i, t, e);
897
+ }
898
+ a(jt, "getChartTitleComponent");
899
+ var ze = 0.75, Be = 0.5, Oe = 0.35;
900
+ function kt(i) {
901
+ return {
902
+ fontSize: i,
903
+ markerSize: i * ze,
904
+ markerSpacing: i * Oe,
905
+ itemSpacing: i * Be
906
+ };
907
+ }
908
+ a(kt, "getLegendLayout");
909
+ var it, Ve = (it = class {
910
+ constructor(t, e, s, n) {
911
+ this.textDimensionCalculator = t, this.chartConfig = e, this.chartData = s, this.chartThemeConfig = n, this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }, this.visiblePlots = [];
912
+ }
913
+ setBoundingBoxXY(t) {
914
+ this.boundingRect.x = t.x, this.boundingRect.y = t.y;
915
+ }
916
+ calculateSpace(t) {
917
+ if (this.visiblePlots = this.chartConfig.showLegend ? this.chartData.plots.filter((f) => f.title) : [], this.visiblePlots.length === 0)
918
+ return this.boundingRect.width = 0, this.boundingRect.height = 0, { width: 0, height: 0 };
919
+ const { fontSize: e, markerSize: s, markerSpacing: n, itemSpacing: o } = kt(
920
+ this.chartConfig.legendFontSize
921
+ ), h = this.textDimensionCalculator.getMaxDimension(
922
+ this.visiblePlots.map((f) => f.title),
923
+ e
924
+ ), p = this.chartConfig.legendPadding * 2 + s + n + h.width, u = this.chartConfig.legendPadding * 2 + this.visiblePlots.length * e + (this.visiblePlots.length - 1) * o;
925
+ return p <= t.width && u <= t.height ? (this.boundingRect.width = p, this.boundingRect.height = u) : (this.visiblePlots = [], this.boundingRect.width = 0, this.boundingRect.height = 0), {
926
+ width: this.boundingRect.width,
927
+ height: this.boundingRect.height
928
+ };
929
+ }
930
+ getDrawableElements() {
931
+ if (this.visiblePlots.length === 0)
932
+ return [];
933
+ const { fontSize: t, markerSize: e, markerSpacing: s, itemSpacing: n } = kt(
934
+ this.chartConfig.legendFontSize
935
+ ), o = t + n, h = this.boundingRect.x + this.chartConfig.legendPadding, p = this.boundingRect.y + this.chartConfig.legendPadding, u = [], f = [];
936
+ for (const [R, C] of this.visiblePlots.entries())
937
+ if (pt(C))
938
+ u.push({
939
+ x: h,
940
+ y: p + R * o,
941
+ width: e,
942
+ height: e,
943
+ fill: C.fill,
944
+ strokeFill: C.fill,
945
+ strokeWidth: 0
946
+ });
947
+ else {
948
+ const y = p + R * o + e / 2;
949
+ f.push({
950
+ path: `M ${h},${y} L ${h + e},${y}`,
951
+ strokeFill: C.strokeFill,
952
+ strokeWidth: C.strokeWidth
953
+ });
954
+ }
955
+ return [
956
+ {
957
+ groupTexts: ["legend", "markers"],
958
+ type: "rect",
959
+ data: u
960
+ },
961
+ {
962
+ groupTexts: ["legend", "markers"],
963
+ type: "path",
964
+ data: f
965
+ },
966
+ {
967
+ groupTexts: ["legend", "label"],
968
+ type: "text",
969
+ data: this.visiblePlots.map((R, C) => ({
970
+ text: R.title,
971
+ x: h + e + s,
972
+ y: p + C * o + e / 2,
973
+ fill: this.chartThemeConfig.legendTextColor,
974
+ fontSize: t,
975
+ rotation: 0,
976
+ verticalPos: "middle",
977
+ horizontalPos: "left"
978
+ }))
979
+ }
980
+ ];
981
+ }
982
+ }, a(it, "ChartLegend"), it);
983
+ function Kt(i, t, e, s) {
984
+ const n = new Pt(s);
985
+ return new Ve(n, i, t, e);
986
+ }
987
+ a(Kt, "getChartLegendComponent");
988
+ var st, Fe = (st = class {
989
+ constructor(t, e, s, n, o) {
990
+ this.plotData = t, this.xAxis = e, this.yAxis = s, this.orientation = n, this.plotIndex = o;
991
+ }
992
+ getDrawableElement() {
993
+ const t = this.plotData.data.map((n) => [
994
+ this.xAxis.getScaleValue(n[0]),
995
+ this.yAxis.getScaleValue(n[1])
996
+ ]);
997
+ let e;
998
+ if (this.orientation === "horizontal" ? e = Xt().y((n) => n[0]).x((n) => n[1])(t) : e = Xt().x((n) => n[0]).y((n) => n[1])(t), !e)
999
+ return [];
1000
+ const s = [
1001
+ {
1002
+ groupTexts: ["plot", `line-plot-${this.plotIndex}`],
1003
+ type: "path",
1004
+ data: [
1005
+ {
1006
+ path: e,
1007
+ strokeFill: this.plotData.strokeFill,
1008
+ strokeWidth: this.plotData.strokeWidth
1009
+ }
1010
+ ]
1011
+ }
1012
+ ];
1013
+ if (this.plotData.pointLabels && this.plotData.pointLabels.length > 0) {
1014
+ const h = [];
1015
+ for (const [p, [u, f]] of t.entries()) {
1016
+ const R = this.plotData.pointLabels[p];
1017
+ R && (this.orientation === "horizontal" ? h.push({
1018
+ x: f + 10,
1019
+ y: u,
1020
+ text: R,
1021
+ fill: this.plotData.strokeFill,
1022
+ verticalPos: "middle",
1023
+ horizontalPos: "left",
1024
+ fontSize: 12,
1025
+ rotation: 0
1026
+ }) : h.push({
1027
+ x: u,
1028
+ y: f - 10,
1029
+ text: R,
1030
+ fill: this.plotData.strokeFill,
1031
+ verticalPos: "middle",
1032
+ horizontalPos: "center",
1033
+ fontSize: 12,
1034
+ rotation: 0
1035
+ }));
1036
+ }
1037
+ h.length > 0 && s.push({
1038
+ groupTexts: ["plot", `line-plot-${this.plotIndex}`, "labels"],
1039
+ type: "text",
1040
+ data: h
1041
+ });
1042
+ }
1043
+ return s;
1044
+ }
1045
+ }, a(st, "LinePlot"), st), nt, We = (nt = class {
1046
+ constructor(t, e, s, n, o, h) {
1047
+ this.barData = t, this.boundingRect = e, this.xAxis = s, this.yAxis = n, this.orientation = o, this.plotIndex = h;
1048
+ }
1049
+ getDrawableElement() {
1050
+ const t = this.barData.data.map((o) => [
1051
+ this.xAxis.getScaleValue(o[0]),
1052
+ this.yAxis.getScaleValue(o[1])
1053
+ ]), s = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - 0.05), n = s / 2;
1054
+ return this.orientation === "horizontal" ? [
1055
+ {
1056
+ groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
1057
+ type: "rect",
1058
+ data: t.map((o) => ({
1059
+ x: this.boundingRect.x,
1060
+ y: o[0] - n,
1061
+ height: s,
1062
+ width: o[1] - this.boundingRect.x,
1063
+ fill: this.barData.fill,
1064
+ strokeWidth: 0,
1065
+ strokeFill: this.barData.fill
1066
+ }))
1067
+ }
1068
+ ] : [
1069
+ {
1070
+ groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
1071
+ type: "rect",
1072
+ data: t.map((o) => ({
1073
+ x: o[0] - n,
1074
+ y: o[1],
1075
+ width: s,
1076
+ height: this.boundingRect.y + this.boundingRect.height - o[1],
1077
+ fill: this.barData.fill,
1078
+ strokeWidth: 0,
1079
+ strokeFill: this.barData.fill
1080
+ }))
1081
+ }
1082
+ ];
1083
+ }
1084
+ }, a(nt, "BarPlot"), nt), at, Xe = (at = class {
1085
+ constructor(t, e, s) {
1086
+ this.chartConfig = t, this.chartData = e, this.chartThemeConfig = s, this.boundingRect = {
1087
+ x: 0,
1088
+ y: 0,
1089
+ width: 0,
1090
+ height: 0
1091
+ };
1092
+ }
1093
+ setAxes(t, e) {
1094
+ this.xAxis = t, this.yAxis = e;
1095
+ }
1096
+ setBoundingBoxXY(t) {
1097
+ this.boundingRect.x = t.x, this.boundingRect.y = t.y;
1098
+ }
1099
+ calculateSpace(t) {
1100
+ return this.boundingRect.width = t.width, this.boundingRect.height = t.height, {
1101
+ width: this.boundingRect.width,
1102
+ height: this.boundingRect.height
1103
+ };
1104
+ }
1105
+ getDrawableElements() {
1106
+ if (!(this.xAxis && this.yAxis))
1107
+ throw Error("Axes must be passed to render Plots");
1108
+ const t = [];
1109
+ for (const [e, s] of this.chartData.plots.entries())
1110
+ switch (s.type) {
1111
+ case "line":
1112
+ {
1113
+ const n = new Fe(
1114
+ s,
1115
+ this.xAxis,
1116
+ this.yAxis,
1117
+ this.chartConfig.chartOrientation,
1118
+ e
1119
+ );
1120
+ t.push(...n.getDrawableElement());
1121
+ }
1122
+ break;
1123
+ case "bar":
1124
+ {
1125
+ const n = new We(
1126
+ s,
1127
+ this.boundingRect,
1128
+ this.xAxis,
1129
+ this.yAxis,
1130
+ this.chartConfig.chartOrientation,
1131
+ e
1132
+ );
1133
+ t.push(...n.getDrawableElement());
1134
+ }
1135
+ break;
1136
+ }
1137
+ return t;
1138
+ }
1139
+ }, a(at, "BasePlot"), at);
1140
+ function Qt(i, t, e) {
1141
+ return new Xe(i, t, e);
1142
+ }
1143
+ a(Qt, "getPlotComponent");
1144
+ var ot, Ne = (ot = class {
1145
+ constructor(t, e, s, n) {
1146
+ this.chartConfig = t, this.chartData = e, this.componentStore = {
1147
+ title: jt(t, e, s, n),
1148
+ plot: Qt(t, e, s),
1149
+ legend: Kt(t, e, s, n),
1150
+ xAxis: _t(
1151
+ e.xAxis,
1152
+ t.xAxis,
1153
+ {
1154
+ titleColor: s.xAxisTitleColor,
1155
+ labelColor: s.xAxisLabelColor,
1156
+ tickColor: s.xAxisTickColor,
1157
+ axisLineColor: s.xAxisLineColor
1158
+ },
1159
+ n
1160
+ ),
1161
+ yAxis: _t(
1162
+ e.yAxis,
1163
+ t.yAxis,
1164
+ {
1165
+ titleColor: s.yAxisTitleColor,
1166
+ labelColor: s.yAxisLabelColor,
1167
+ tickColor: s.yAxisTickColor,
1168
+ axisLineColor: s.yAxisLineColor
1169
+ },
1170
+ n
1171
+ )
1172
+ };
1173
+ }
1174
+ calculateVerticalSpace() {
1175
+ let t = this.chartConfig.width, e = this.chartConfig.height, s = 0, n = 0, o = { width: 0, height: 0 }, h = Math.floor(t * this.chartConfig.plotReservedSpacePercent / 100), p = Math.floor(
1176
+ e * this.chartConfig.plotReservedSpacePercent / 100
1177
+ ), u = this.componentStore.plot.calculateSpace({
1178
+ width: h,
1179
+ height: p
1180
+ });
1181
+ t -= u.width, e -= u.height, u = this.componentStore.title.calculateSpace({
1182
+ width: this.chartConfig.width,
1183
+ height: e
1184
+ }), n = u.height, e -= u.height, this.componentStore.xAxis.setAxisPosition("bottom"), u = this.componentStore.xAxis.calculateSpace({
1185
+ width: t,
1186
+ height: e
1187
+ }), e -= u.height, this.componentStore.yAxis.setAxisPosition("left"), u = this.componentStore.yAxis.calculateSpace({
1188
+ width: t,
1189
+ height: e
1190
+ }), s = u.width, t -= u.width, o = this.componentStore.legend.calculateSpace({
1191
+ width: t,
1192
+ height: p
1193
+ }), t -= o.width, t > 0 && (h += t, t = 0), e > 0 && (p += e, e = 0), this.componentStore.plot.calculateSpace({
1194
+ width: h,
1195
+ height: p
1196
+ }), this.componentStore.plot.setBoundingBoxXY({ x: s, y: n }), this.componentStore.legend.setBoundingBoxXY({
1197
+ x: s + h,
1198
+ y: n + Math.max((p - o.height) / 2, 0)
1199
+ }), this.componentStore.xAxis.setRange([s, s + h]), this.componentStore.xAxis.setBoundingBoxXY({ x: s, y: n + p }), this.componentStore.yAxis.setRange([n, n + p]), this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: n }), this.chartData.plots.some((f) => pt(f)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1200
+ }
1201
+ calculateHorizontalSpace() {
1202
+ let t = this.chartConfig.width, e = this.chartConfig.height, s = 0, n = 0, o = 0, h = { width: 0, height: 0 }, p = Math.floor(t * this.chartConfig.plotReservedSpacePercent / 100), u = Math.floor(
1203
+ e * this.chartConfig.plotReservedSpacePercent / 100
1204
+ ), f = this.componentStore.plot.calculateSpace({
1205
+ width: p,
1206
+ height: u
1207
+ });
1208
+ t -= f.width, e -= f.height, f = this.componentStore.title.calculateSpace({
1209
+ width: this.chartConfig.width,
1210
+ height: e
1211
+ }), s = f.height, e -= f.height, this.componentStore.xAxis.setAxisPosition("left"), f = this.componentStore.xAxis.calculateSpace({
1212
+ width: t,
1213
+ height: e
1214
+ }), t -= f.width, n = f.width, this.componentStore.yAxis.setAxisPosition("top"), f = this.componentStore.yAxis.calculateSpace({
1215
+ width: t,
1216
+ height: e
1217
+ }), e -= f.height, o = s + f.height, h = this.componentStore.legend.calculateSpace({
1218
+ width: t,
1219
+ height: u
1220
+ }), t -= h.width, t > 0 && (p += t, t = 0), e > 0 && (u += e, e = 0), this.componentStore.plot.calculateSpace({
1221
+ width: p,
1222
+ height: u
1223
+ }), this.componentStore.plot.setBoundingBoxXY({ x: n, y: o }), this.componentStore.legend.setBoundingBoxXY({
1224
+ x: n + p,
1225
+ y: o + Math.max((u - h.height) / 2, 0)
1226
+ }), this.componentStore.yAxis.setRange([n, n + p]), this.componentStore.yAxis.setBoundingBoxXY({ x: n, y: s }), this.componentStore.xAxis.setRange([o, o + u]), this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: o }), this.chartData.plots.some((R) => pt(R)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1227
+ }
1228
+ calculateSpace() {
1229
+ this.chartConfig.chartOrientation === "horizontal" ? this.calculateHorizontalSpace() : this.calculateVerticalSpace();
1230
+ }
1231
+ getDrawableElement() {
1232
+ this.calculateSpace();
1233
+ const t = [];
1234
+ this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis);
1235
+ for (const e of Object.values(this.componentStore))
1236
+ t.push(...e.getDrawableElements());
1237
+ return t;
1238
+ }
1239
+ }, a(ot, "Orchestrator"), ot), rt, Ye = (rt = class {
1240
+ static build(t, e, s, n) {
1241
+ return new Ne(t, e, s, n).getDrawableElement();
1242
+ }
1243
+ }, a(rt, "XYChartBuilder"), rt), ct = 0, Zt, gt = Et(), ut = Lt(), w = Mt(), Tt = ut.plotColorPalette.split(",").map((i) => i.trim()), yt = !1, vt = !1;
1244
+ function Lt() {
1245
+ const i = ke(), t = Dt();
1246
+ return Gt(i.xyChart, t.themeVariables.xyChart);
1247
+ }
1248
+ a(Lt, "getChartDefaultThemeConfig");
1249
+ function Et() {
1250
+ const i = Dt();
1251
+ return Gt(
1252
+ _e.xyChart,
1253
+ i.xyChart
1254
+ );
1255
+ }
1256
+ a(Et, "getChartDefaultConfig");
1257
+ function Mt() {
1258
+ return {
1259
+ yAxis: {
1260
+ type: "linear",
1261
+ title: "",
1262
+ min: 1 / 0,
1263
+ max: -1 / 0
1264
+ },
1265
+ xAxis: {
1266
+ type: "band",
1267
+ title: "",
1268
+ categories: []
1269
+ },
1270
+ title: "",
1271
+ plots: []
1272
+ };
1273
+ }
1274
+ a(Mt, "getChartDefaultData");
1275
+ function G(i) {
1276
+ const t = Dt();
1277
+ return Re(i.trim(), t);
1278
+ }
1279
+ a(G, "textSanitizer");
1280
+ function Jt(i) {
1281
+ Zt = i;
1282
+ }
1283
+ a(Jt, "setTmpSVGG");
1284
+ function te(i) {
1285
+ i === "horizontal" ? gt.chartOrientation = "horizontal" : gt.chartOrientation = "vertical";
1286
+ }
1287
+ a(te, "setOrientation");
1288
+ function ee(i) {
1289
+ w.xAxis.title = G(i.text);
1290
+ }
1291
+ a(ee, "setXAxisTitle");
1292
+ function It(i, t) {
1293
+ w.xAxis = { type: "linear", title: w.xAxis.title, min: i, max: t }, yt = !0;
1294
+ }
1295
+ a(It, "setXAxisRangeData");
1296
+ function ie(i) {
1297
+ w.xAxis = {
1298
+ type: "band",
1299
+ title: w.xAxis.title,
1300
+ categories: i.map((t) => G(t.text))
1301
+ }, yt = !0;
1302
+ }
1303
+ a(ie, "setXAxisBand");
1304
+ function se(i) {
1305
+ w.yAxis.title = G(i.text);
1306
+ }
1307
+ a(se, "setYAxisTitle");
1308
+ function ne(i, t) {
1309
+ w.yAxis = { type: "linear", title: w.yAxis.title, min: i, max: t }, vt = !0;
1310
+ }
1311
+ a(ne, "setYAxisRangeData");
1312
+ function ae(i) {
1313
+ const t = Math.min(...i), e = Math.max(...i), s = K(w.yAxis) ? w.yAxis.min : 1 / 0, n = K(w.yAxis) ? w.yAxis.max : -1 / 0;
1314
+ w.yAxis = {
1315
+ type: "linear",
1316
+ title: w.yAxis.title,
1317
+ min: Math.min(s, t),
1318
+ max: Math.max(n, e)
1319
+ };
1320
+ }
1321
+ a(ae, "setYAxisRangeFromPlotData");
1322
+ function zt(i) {
1323
+ let t = [];
1324
+ if (i.length === 0)
1325
+ return t;
1326
+ if (!yt) {
1327
+ const e = K(w.xAxis) ? w.xAxis.min : 1 / 0, s = K(w.xAxis) ? w.xAxis.max : -1 / 0;
1328
+ It(Math.min(e, 1), Math.max(s, i.length));
1329
+ }
1330
+ if (mt(w.xAxis) && i.length > w.xAxis.categories.length && (i = i.slice(0, w.xAxis.categories.length)), vt || ae(i), mt(w.xAxis) && (t = w.xAxis.categories.map((e, s) => [e, i[s]])), K(w.xAxis)) {
1331
+ const e = w.xAxis.min, s = w.xAxis.max;
1332
+ if (i.length === 1)
1333
+ t = [[`${e}`, i[0]]];
1334
+ else {
1335
+ const n = (s - e) / (i.length - 1);
1336
+ t = i.map((o, h) => [`${e + h * n}`, o]);
1337
+ }
1338
+ }
1339
+ return t;
1340
+ }
1341
+ a(zt, "transformDataWithoutCategory");
1342
+ function Bt(i) {
1343
+ return Tt[i === 0 ? 0 : i % Tt.length];
1344
+ }
1345
+ a(Bt, "getPlotColorFromPalette");
1346
+ function oe(i, t) {
1347
+ const e = t.map((h) => h.value), s = t.map((h) => h.label ? G(h.label) : ""), n = zt(e), o = s.some((h) => h !== "");
1348
+ w.plots.push({
1349
+ type: "line",
1350
+ title: G(i.text),
1351
+ strokeFill: Bt(ct),
1352
+ strokeWidth: 2,
1353
+ data: n,
1354
+ ...o ? { pointLabels: s } : {}
1355
+ }), ct++;
1356
+ }
1357
+ a(oe, "setLineData");
1358
+ function re(i, t) {
1359
+ const e = t.map((n) => n.value), s = zt(e);
1360
+ w.plots.push({
1361
+ type: "bar",
1362
+ title: G(i.text),
1363
+ fill: Bt(ct),
1364
+ data: s
1365
+ }), ct++;
1366
+ }
1367
+ a(re, "setBarData");
1368
+ function he() {
1369
+ if (w.plots.length === 0)
1370
+ throw Error("No Plot to render, please provide a plot with some data");
1371
+ return w.title = $t(), Ye.build(gt, w, ut, Zt);
1372
+ }
1373
+ a(he, "getDrawableElem");
1374
+ function le() {
1375
+ return ut;
1376
+ }
1377
+ a(le, "getChartThemeConfig");
1378
+ function ce() {
1379
+ return gt;
1380
+ }
1381
+ a(ce, "getChartConfig");
1382
+ function ge() {
1383
+ return w;
1384
+ }
1385
+ a(ge, "getXYChartData");
1386
+ var He = /* @__PURE__ */ a(function() {
1387
+ Se(), ct = 0, gt = Et(), w = Mt(), ut = Lt(), Tt = ut.plotColorPalette.split(",").map((i) => i.trim()), yt = !1, vt = !1;
1388
+ }, "clear"), $e = {
1389
+ getDrawableElem: he,
1390
+ clear: He,
1391
+ setAccTitle: we,
1392
+ getAccTitle: be,
1393
+ setDiagramTitle: ye,
1394
+ getDiagramTitle: $t,
1395
+ getAccDescription: me,
1396
+ setAccDescription: pe,
1397
+ setOrientation: te,
1398
+ setXAxisTitle: ee,
1399
+ setXAxisRangeData: It,
1400
+ setXAxisBand: ie,
1401
+ setYAxisTitle: se,
1402
+ setYAxisRangeData: ne,
1403
+ setLineData: oe,
1404
+ setBarData: re,
1405
+ setTmpSVGG: Jt,
1406
+ getChartThemeConfig: le,
1407
+ getChartConfig: ce,
1408
+ getXYChartData: ge
1409
+ }, Ue = /* @__PURE__ */ a((i, t, e, s) => {
1410
+ const n = s.db, o = n.getChartThemeConfig(), h = n.getChartConfig(), p = n.getXYChartData().plots[0].data.map((b) => b[1]);
1411
+ function u(b) {
1412
+ return b === "top" ? "text-before-edge" : "middle";
1413
+ }
1414
+ a(u, "getDominantBaseLine");
1415
+ function f(b) {
1416
+ return b === "left" ? "start" : b === "right" ? "end" : "middle";
1417
+ }
1418
+ a(f, "getTextAnchor");
1419
+ function R(b) {
1420
+ return `translate(${b.x}, ${b.y}) rotate(${b.rotation || 0})`;
1421
+ }
1422
+ a(R, "getTextTransformation"), Ut.debug(`Rendering xychart chart
1423
+ ` + i);
1424
+ const C = Ae(t), y = C.append("g").attr("class", "main"), E = y.append("rect").attr("width", h.width).attr("height", h.height).attr("class", "background");
1425
+ Ce(C, h.height, h.width, !0), C.attr("viewBox", `0 0 ${h.width} ${h.height}`), E.attr("fill", o.backgroundColor), n.setTmpSVGG(C.append("g").attr("class", "mermaid-tmp-group"));
1426
+ const v = n.getDrawableElem(), L = {};
1427
+ function M(b) {
1428
+ let D = y, c = "";
1429
+ for (const [B] of b.entries()) {
1430
+ let F = y;
1431
+ B > 0 && L[c] && (F = L[c]), c += b[B], D = L[c], D || (D = L[c] = F.append("g").attr("class", b[B]));
1432
+ }
1433
+ return D;
1434
+ }
1435
+ a(M, "getGroup");
1436
+ for (const b of v) {
1437
+ if (b.data.length === 0)
1438
+ continue;
1439
+ const D = M(b.groupTexts);
1440
+ switch (b.type) {
1441
+ case "rect":
1442
+ if (D.selectAll("rect").data(b.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), h.showDataLabel) {
1443
+ const c = h.showDataLabelOutsideBar;
1444
+ if (h.chartOrientation === "horizontal") {
1445
+ let B = function(S, O) {
1446
+ const { data: T, label: ht } = S;
1447
+ return O * ht.length * F <= T.width - X;
1448
+ };
1449
+ a(B, "fitsHorizontally");
1450
+ const F = 0.7, X = 10, N = b.data.map((S, O) => ({ data: S, label: p[O].toString() })).filter((S) => S.data.width > 0 && S.data.height > 0), k = N.map((S) => {
1451
+ const { data: O } = S;
1452
+ let T = O.height * 0.7;
1453
+ for (; !B(S, T) && T > 0; )
1454
+ T -= 1;
1455
+ return T;
1456
+ }), H = Math.floor(Math.min(...k)), A = /* @__PURE__ */ a((S) => c ? S.data.x + S.data.width + X : S.data.x + S.data.width - X, "determineLabelXPosition");
1457
+ D.selectAll("text").data(N).enter().append("text").attr("x", A).attr("y", (S) => S.data.y + S.data.height / 2).attr("text-anchor", c ? "start" : "end").attr("dominant-baseline", "middle").attr("fill", o.dataLabelColor).attr("font-size", `${H}px`).text((S) => S.label);
1458
+ } else {
1459
+ let B = function(A, S, O) {
1460
+ const { data: T, label: ht } = A, W = S * ht.length * 0.7, l = T.x + T.width / 2, g = l - W / 2, d = l + W / 2, x = g >= T.x && d <= T.x + T.width, _ = T.y + O + S <= T.y + T.height;
1461
+ return x && _;
1462
+ };
1463
+ a(B, "fitsInBar");
1464
+ const F = 10, X = b.data.map((A, S) => ({ data: A, label: p[S].toString() })).filter((A) => A.data.width > 0 && A.data.height > 0), N = X.map((A) => {
1465
+ const { data: S, label: O } = A;
1466
+ let T = S.width / (O.length * 0.7);
1467
+ for (; !B(A, T, F) && T > 0; )
1468
+ T -= 1;
1469
+ return T;
1470
+ }), k = Math.floor(Math.min(...N)), H = /* @__PURE__ */ a((A) => c ? A.data.y - F : A.data.y + F, "determineLabelYPosition");
1471
+ D.selectAll("text").data(X).enter().append("text").attr("x", (A) => A.data.x + A.data.width / 2).attr("y", H).attr("text-anchor", "middle").attr("dominant-baseline", c ? "auto" : "hanging").attr("fill", o.dataLabelColor).attr("font-size", `${k}px`).text((A) => A.label);
1472
+ }
1473
+ }
1474
+ break;
1475
+ case "text":
1476
+ D.selectAll("text").data(b.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) => u(c.verticalPos)).attr("text-anchor", (c) => f(c.horizontalPos)).attr("transform", (c) => R(c)).text((c) => c.text);
1477
+ break;
1478
+ case "path":
1479
+ D.selectAll("path").data(b.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);
1480
+ break;
1481
+ }
1482
+ }
1483
+ }, "draw"), Ge = {
1484
+ draw: Ue
1485
+ }, Ze = {
1486
+ parser: Le,
1487
+ db: $e,
1488
+ renderer: Ge
1489
+ };
1490
+ export {
1491
+ Ze as diagram
1492
+ };