@draftably/editor 0.1.0 → 0.3.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 (104) hide show
  1. package/README.md +4 -5
  2. package/dist/assets/engine.worker-BY9GKt7x.js +7505 -0
  3. package/dist/element.js +1 -1
  4. package/dist/index.js +20202 -2
  5. package/dist/types/src/cli/raster-fonts.d.ts +3 -0
  6. package/dist/types/src/components/controls.d.ts +8 -5
  7. package/dist/types/src/dsl/compile.d.ts +13 -0
  8. package/dist/types/src/dsl/corridors.d.ts +38 -0
  9. package/dist/types/src/model/types.d.ts +9 -0
  10. package/dist/types/src/state/canvas-commands.d.ts +169 -0
  11. package/dist/types/src/state/canvas-keyboard.d.ts +15 -0
  12. package/dist/types/src/state/links.d.ts +4 -1
  13. package/dist/types/src/state/workspace.d.ts +3 -0
  14. package/package.json +1 -1
  15. package/dist/assets/engine.worker-DmHew5f6.js +0 -6813
  16. package/dist/assets/import-d2.worker-CnXfFXoa.js +0 -5395
  17. package/dist/chunks/abnfDiagram-WEYOIA3C-llcpthp5.js +0 -87
  18. package/dist/chunks/arc-rJj0TtXf.js +0 -83
  19. package/dist/chunks/architectureDiagram-ZHVYKT53-CfiXg0Lk.js +0 -4781
  20. package/dist/chunks/blockDiagram-RJAE7QA3-CO-14jWz.js +0 -1440
  21. package/dist/chunks/browser-iNhbPsGc.js +0 -40
  22. package/dist/chunks/c4Diagram-XDPPPE54-DYKuxA4n.js +0 -1524
  23. package/dist/chunks/channel-qMvPU6eH.js +0 -5
  24. package/dist/chunks/chunk-2E7WHVMD-BEZwsFS3.js +0 -670
  25. package/dist/chunks/chunk-2Q5K7J3B-gqtzQ8ux.js +0 -18
  26. package/dist/chunks/chunk-4EMNKR2T-MC54CXVe.js +0 -262
  27. package/dist/chunks/chunk-55XCU76K-DkZUAaqC.js +0 -68
  28. package/dist/chunks/chunk-5VM5RSS4-CaKe4sjM.js +0 -19
  29. package/dist/chunks/chunk-JWPE2WC7-CnAFS2xF.js +0 -8
  30. package/dist/chunks/chunk-VQ5W62QI-CXRv7FiX.js +0 -19
  31. package/dist/chunks/chunk-XXDRQBXY-B-AMQgD2.js +0 -8
  32. package/dist/chunks/chunk-ZCHMQSOR-BALpdc3g.js +0 -451
  33. package/dist/chunks/classDiagram-v2-4MYWR3UA-wPjgJTg4.js +0 -1570
  34. package/dist/chunks/cose-bilkent-JH36ORCC-Bbh5ggBc.js +0 -2608
  35. package/dist/chunks/cynefin-EF2NZ3EQ-Bt6b88hY.js +0 -22361
  36. package/dist/chunks/cynefinDiagram-WF24UDRP-BHWZvxoF.js +0 -299
  37. package/dist/chunks/cytoscape.esm-CRsF_JA3.js +0 -18791
  38. package/dist/chunks/dagre-NK4GIZVX-Cz37yPrT.js +0 -2157
  39. package/dist/chunks/defaultLocale-BgPVtth8.js +0 -171
  40. package/dist/chunks/diagram-CBK3MWTC-Q2R6FJ0B.js +0 -531
  41. package/dist/chunks/diagram-I5XIIV2D-a2Kdu_wA.js +0 -153
  42. package/dist/chunks/diagram-ODIL2UCW-DTWXxcOn.js +0 -346
  43. package/dist/chunks/diagram-PFBEJUXE-DIAQQ5KX.js +0 -480
  44. package/dist/chunks/diagram-RJA3I4VV-BPD0GghS.js +0 -219
  45. package/dist/chunks/diagram-TYUNFSNR-BmdkONfG.js +0 -2586
  46. package/dist/chunks/dot-importer-B23jwEkx.js +0 -1547
  47. package/dist/chunks/ebnfDiagram-V4P3TTPT-C5IKvYlb.js +0 -109
  48. package/dist/chunks/elk-QONTBCTQ-CtdQFvh2.js +0 -49229
  49. package/dist/chunks/erDiagram-KYQIGQAA-5wguK9Dx.js +0 -1064
  50. package/dist/chunks/flowDiagram-IUGLLWBU-BijvFPku.js +0 -1771
  51. package/dist/chunks/ganttDiagram-R7GPNTJY-BaqGPz-O.js +0 -2729
  52. package/dist/chunks/gitGraphDiagram-PDYL7XHY-DZfMGyHE.js +0 -815
  53. package/dist/chunks/graph-CKJmgLki.js +0 -1541
  54. package/dist/chunks/import-core-C-I1wGfw.js +0 -145
  55. package/dist/chunks/infoDiagram-MVDRKAX5-C2vH_59e.js +0 -24
  56. package/dist/chunks/init-DjUOC4st.js +0 -16
  57. package/dist/chunks/ishikawaDiagram-HPEHV2GE-q149MFlV.js +0 -624
  58. package/dist/chunks/journeyDiagram-BOSHW7O7-D-2Z3VtR.js +0 -834
  59. package/dist/chunks/kanban-definition-FNSA4HC5-wvAjV5ub.js +0 -724
  60. package/dist/chunks/katex-BsrBVQKd.js +0 -11314
  61. package/dist/chunks/linear-4t7D_ros.js +0 -259
  62. package/dist/chunks/mermaid-facade-BoLWBerE.js +0 -289
  63. package/dist/chunks/mermaid-importer-Cgx1IhmR.js +0 -478
  64. package/dist/chunks/mermaid.core-DXv6D2Sm.js +0 -19244
  65. package/dist/chunks/mindmap-definition-6OY57UG3-r9wTKul_.js +0 -837
  66. package/dist/chunks/mount-C1Xk_GQz.js +0 -22131
  67. package/dist/chunks/ordinal-DfAQgscy.js +0 -61
  68. package/dist/chunks/pegDiagram-ECIUJNBX-CmKlFWiP.js +0 -95
  69. package/dist/chunks/pieDiagram-GNMPY74T-DNTw_qan.js +0 -208
  70. package/dist/chunks/quadrantDiagram-D57K4MC3-CT_tvVub.js +0 -1029
  71. package/dist/chunks/railroadDiagram-Y72NRBL7-C5TUvZBe.js +0 -77
  72. package/dist/chunks/requirementDiagram-EQYSW5RA-C_c65aCa.js +0 -889
  73. package/dist/chunks/sankeyDiagram-SY24JHO5-CKcbizM1.js +0 -859
  74. package/dist/chunks/sequenceDiagram-BLEHNHQU-GpVnHOjf.js +0 -2972
  75. package/dist/chunks/sizeCapture-INFHLROL-CToN3JSu.js +0 -46
  76. package/dist/chunks/stateDiagram-v2-A6IESKWZ-rJYd2FfM.js +0 -1520
  77. package/dist/chunks/swimlanes-B3ENRKFQ-C7w5pfxG.js +0 -4991
  78. package/dist/chunks/swimlanesDiagram-AYQRV4AK-BpGY_bvE.js +0 -13
  79. package/dist/chunks/timeline-definition-JXYKGLGB-ChKFPBKc.js +0 -1058
  80. package/dist/chunks/usecaseDiagram-WPOLBNNX-skXH8Dcu.js +0 -7945
  81. package/dist/chunks/vennDiagram-Q3Y3IDCW-C5KknmJf.js +0 -1578
  82. package/dist/chunks/wardleyDiagram-IVAIDKWA-DY4Lkfpu.js +0 -678
  83. package/dist/chunks/xychartDiagram-4URNHDU4-BHScsL7h.js +0 -1536
  84. package/dist/types/src/cli/png.d.ts +0 -23
  85. package/dist/types/src/import/browser.d.ts +0 -3
  86. package/dist/types/src/import/detect.d.ts +0 -31
  87. package/dist/types/src/import/dot-importer.d.ts +0 -3
  88. package/dist/types/src/import/import-core.d.ts +0 -105
  89. package/dist/types/src/import/mermaid-facade.d.ts +0 -120
  90. package/dist/types/src/import/mermaid-importer.d.ts +0 -4
  91. package/dist/types/src/import/mermaid-sequence.d.ts +0 -8
  92. package/dist/types/src/import/scratch.d.ts +0 -3
  93. package/dist/types/src/lib/source-hash.d.ts +0 -7
  94. package/dist/types/src/model/candidates.d.ts +0 -53
  95. package/dist/types/src/model/embed.d.ts +0 -17
  96. package/dist/types/src/model/examples.d.ts +0 -15
  97. package/dist/types/src/model/label-hits.d.ts +0 -27
  98. package/dist/types/src/model/static-scene.d.ts +0 -15
  99. package/dist/types/src/state/commands.d.ts +0 -529
  100. package/dist/types/src/state/comparison.d.ts +0 -151
  101. package/dist/types/src/state/files.d.ts +0 -61
  102. package/dist/types/src/state/keyboard.d.ts +0 -6
  103. package/dist/types/src/state/launch.d.ts +0 -61
  104. package/dist/types/src/state/ui.d.ts +0 -39
@@ -1,1536 +0,0 @@
1
- import { s as ai, g as oi, t as It, q as hi, a as ri, b as li, _ as a, l as zt, Q as ci, d as gi, A as ui, L as mt, j as di, N as Bt, O as xi, R as fi, aH as pi, aI as vt } from "./mermaid.core-DXv6D2Sm.js";
2
- import { i as mi } from "./init-DjUOC4st.js";
3
- import { o as yi } from "./ordinal-DfAQgscy.js";
4
- import { l as Lt } from "./linear-4t7D_ros.js";
5
- function bi(t, i, e) {
6
- t = +t, i = +i, e = (n = arguments.length) < 2 ? (i = t, t = 0, 1) : n < 3 ? 1 : +e;
7
- for (var s = -1, n = Math.max(0, Math.ceil((i - t) / e)) | 0, c = new Array(n); ++s < n; )
8
- c[s] = t + s * e;
9
- return c;
10
- }
11
- function ut() {
12
- var t = yi().unknown(void 0), i = t.domain, e = t.range, s = 0, n = 1, c, r, x = !1, g = 0, m = 0, _ = 0.5;
13
- delete t.unknown;
14
- function S() {
15
- var w = i().length, E = n < s, v = E ? n : s, L = E ? s : n;
16
- c = (L - v) / Math.max(1, w - g + m * 2), x && (c = Math.floor(c)), v += (L - v - c * (w - g)) * _, r = c * (1 - g), x && (v = Math.round(v), r = Math.round(r));
17
- var M = bi(w).map(function(y) {
18
- return v + c * y;
19
- });
20
- return e(E ? M.reverse() : M);
21
- }
22
- return t.domain = function(w) {
23
- return arguments.length ? (i(w), S()) : i();
24
- }, t.range = function(w) {
25
- return arguments.length ? ([s, n] = w, s = +s, n = +n, S()) : [s, n];
26
- }, t.rangeRound = function(w) {
27
- return [s, n] = w, s = +s, n = +n, x = !0, S();
28
- }, t.bandwidth = function() {
29
- return r;
30
- }, t.step = function() {
31
- return c;
32
- }, t.round = function(w) {
33
- return arguments.length ? (x = !!w, S()) : x;
34
- }, t.padding = function(w) {
35
- return arguments.length ? (g = Math.min(1, m = +w), S()) : g;
36
- }, t.paddingInner = function(w) {
37
- return arguments.length ? (g = Math.min(1, w), S()) : g;
38
- }, t.paddingOuter = function(w) {
39
- return arguments.length ? (m = +w, S()) : m;
40
- }, t.align = function(w) {
41
- return arguments.length ? (_ = Math.max(0, Math.min(1, w)), S()) : _;
42
- }, t.copy = function() {
43
- return ut(i(), [s, n]).round(x).paddingInner(g).paddingOuter(m).align(_);
44
- }, mi.apply(S(), arguments);
45
- }
46
- var dt = (function() {
47
- var t = /* @__PURE__ */ a(function(F, h, u, d) {
48
- for (u = u || {}, d = F.length; d--; u[F[d]] = h) ;
49
- return u;
50
- }, "o"), i = [1, 10, 12, 14, 16, 18, 19, 21, 23], e = [2, 6], s = [1, 3], n = [1, 5], c = [1, 6], r = [1, 7], x = [1, 5, 10, 12, 14, 16, 18, 19, 21, 23, 36, 37, 38], g = [1, 25], m = [1, 26], _ = [1, 28], S = [1, 29], w = [1, 30], E = [1, 31], v = [1, 32], L = [1, 33], M = [1, 34], y = [1, 35], D = [1, 36], l = [1, 37], B = [1, 43], W = [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], C = [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(h, u, d, f, R, o, Z) {
58
- var p = o.length - 1;
59
- switch (R) {
60
- case 5:
61
- f.setOrientation(o[p]);
62
- break;
63
- case 9:
64
- f.setDiagramTitle(o[p].text.trim());
65
- break;
66
- case 12:
67
- f.setLineData({ text: "", type: "text" }, o[p]);
68
- break;
69
- case 13:
70
- f.setLineData(o[p - 1], o[p]);
71
- break;
72
- case 14:
73
- f.setBarData({ text: "", type: "text" }, o[p]);
74
- break;
75
- case 15:
76
- f.setBarData(o[p - 1], o[p]);
77
- break;
78
- case 16:
79
- this.$ = o[p].trim(), f.setAccTitle(this.$);
80
- break;
81
- case 17:
82
- case 18:
83
- this.$ = o[p].trim(), f.setAccDescription(this.$);
84
- break;
85
- case 19:
86
- this.$ = o[p - 1];
87
- break;
88
- case 20:
89
- case 30:
90
- this.$ = [o[p - 2], ...o[p]];
91
- break;
92
- case 21:
93
- case 31:
94
- this.$ = [o[p]];
95
- break;
96
- case 22:
97
- this.$ = { value: Number(o[p - 1]), label: o[p] };
98
- break;
99
- case 23:
100
- this.$ = { value: Number(o[p]), label: "" };
101
- break;
102
- case 24:
103
- f.setXAxisTitle(o[p]);
104
- break;
105
- case 25:
106
- f.setXAxisTitle(o[p - 1]);
107
- break;
108
- case 26:
109
- f.setXAxisTitle({ type: "text", text: "" });
110
- break;
111
- case 27:
112
- f.setXAxisBand(o[p]);
113
- break;
114
- case 28:
115
- f.setXAxisRangeData(Number(o[p - 2]), Number(o[p]));
116
- break;
117
- case 29:
118
- this.$ = o[p - 1];
119
- break;
120
- case 32:
121
- f.setYAxisTitle(o[p]);
122
- break;
123
- case 33:
124
- f.setYAxisTitle(o[p - 1]);
125
- break;
126
- case 34:
127
- f.setYAxisTitle({ type: "text", text: "" });
128
- break;
129
- case 35:
130
- f.setYAxisRangeData(Number(o[p - 2]), Number(o[p]));
131
- break;
132
- case 39:
133
- this.$ = { text: o[p], type: "text" };
134
- break;
135
- case 40:
136
- this.$ = { text: o[p], type: "text" };
137
- break;
138
- case 41:
139
- this.$ = { text: o[p], type: "markdown" };
140
- break;
141
- case 42:
142
- this.$ = o[p];
143
- break;
144
- case 43:
145
- this.$ = o[p - 1] + "" + o[p];
146
- break;
147
- }
148
- }, "anonymous"),
149
- table: [t(i, e, { 3: 1, 4: 2, 7: 4, 5: s, 36: n, 37: c, 38: r }), { 1: [3] }, t(i, e, { 4: 2, 7: 4, 3: 8, 5: s, 36: n, 37: c, 38: r }), t(i, e, { 4: 2, 7: 4, 6: 9, 3: 10, 5: s, 8: [1, 11], 36: n, 37: c, 38: r }), { 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] }, t(x, [2, 36]), t(x, [2, 37]), t(x, [2, 38]), { 1: [2, 1] }, t(i, e, { 4: 2, 7: 4, 3: 21, 5: s, 36: n, 37: c, 38: r }), { 1: [2, 3] }, t(x, [2, 5]), t(i, [2, 7], { 4: 22, 36: n, 37: c, 38: r }), { 11: 23, 30: g, 39: 24, 40: m, 41: 27, 42: _, 43: S, 44: w, 45: E, 46: v, 47: L, 48: M, 49: y, 50: D, 51: l }, { 11: 39, 13: 38, 24: B, 29: W, 30: g, 31: 40, 32: 41, 39: 24, 40: m, 41: 27, 42: _, 43: S, 44: w, 45: E, 46: v, 47: L, 48: M, 49: y, 50: D, 51: l }, { 11: 45, 15: 44, 29: X, 30: g, 35: 46, 39: 24, 40: m, 41: 27, 42: _, 43: S, 44: w, 45: E, 46: v, 47: L, 48: M, 49: y, 50: D, 51: l }, { 11: 49, 17: 48, 24: N, 30: g, 39: 24, 40: m, 41: 27, 42: _, 43: S, 44: w, 45: E, 46: v, 47: L, 48: M, 49: y, 50: D, 51: l }, { 11: 52, 17: 51, 24: N, 30: g, 39: 24, 40: m, 41: 27, 42: _, 43: S, 44: w, 45: E, 46: v, 47: L, 48: M, 49: y, 50: D, 51: l }, { 20: [1, 53] }, { 22: [1, 54] }, t(k, [2, 18]), { 1: [2, 2] }, t(k, [2, 8]), t(k, [2, 9]), t(H, [2, 39], { 41: 55, 42: _, 43: S, 44: w, 45: E, 46: v, 47: L, 48: M, 49: y, 50: D, 51: l }), t(H, [2, 40]), t(H, [2, 41]), t(A, [2, 42]), t(A, [2, 44]), t(A, [2, 45]), t(A, [2, 46]), t(A, [2, 47]), t(A, [2, 48]), t(A, [2, 49]), t(A, [2, 50]), t(A, [2, 51]), t(A, [2, 52]), t(A, [2, 53]), t(k, [2, 10]), t(k, [2, 24], { 32: 41, 31: 56, 24: B, 29: W }), t(k, [2, 26]), t(k, [2, 27]), { 33: [1, 57] }, { 11: 59, 30: g, 34: 58, 39: 24, 40: m, 41: 27, 42: _, 43: S, 44: w, 45: E, 46: v, 47: L, 48: M, 49: y, 50: D, 51: l }, t(k, [2, 11]), t(k, [2, 32], { 35: 60, 29: X }), t(k, [2, 34]), { 33: [1, 61] }, t(k, [2, 12]), { 17: 62, 24: N }, { 25: 63, 27: 64, 29: C }, t(k, [2, 14]), { 17: 66, 24: N }, t(k, [2, 16]), t(k, [2, 17]), t(A, [2, 43]), t(k, [2, 25]), { 29: [1, 67] }, { 26: [1, 68] }, { 26: [2, 31], 28: [1, 69] }, t(k, [2, 33]), { 29: [1, 70] }, t(k, [2, 13]), { 26: [1, 71] }, { 26: [2, 21], 28: [1, 72] }, t(O, [2, 23], { 30: [1, 73] }), t(k, [2, 15]), t(k, [2, 28]), t(k, [2, 29]), { 11: 59, 30: g, 34: 74, 39: 24, 40: m, 41: 27, 42: _, 43: S, 44: w, 45: E, 46: v, 47: L, 48: M, 49: y, 50: D, 51: l }, t(k, [2, 35]), t(k, [2, 19]), { 25: 75, 27: 64, 29: C }, t(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(h, u) {
152
- if (u.recoverable)
153
- this.trace(h);
154
- else {
155
- var d = new Error(h);
156
- throw d.hash = u, d;
157
- }
158
- }, "parseError"),
159
- parse: /* @__PURE__ */ a(function(h) {
160
- var u = this, d = [0], f = [], R = [null], o = [], Z = this.table, p = "", et = 0, kt = 0, ii = 2, Tt = 1, ei = o.slice.call(arguments, 1), P = Object.create(this.lexer), $ = { yy: {} };
161
- for (var rt in this.yy)
162
- Object.prototype.hasOwnProperty.call(this.yy, rt) && ($.yy[rt] = this.yy[rt]);
163
- P.setInput(h, $.yy), $.yy.lexer = P, $.yy.parser = this, typeof P.yylloc > "u" && (P.yylloc = {});
164
- var lt = P.yylloc;
165
- o.push(lt);
166
- var si = P.options && P.options.ranges;
167
- typeof $.yy.parseError == "function" ? this.parseError = $.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
168
- function ni(z) {
169
- d.length = d.length - 2 * z, R.length = R.length - z, o.length = o.length - z;
170
- }
171
- a(ni, "popStack");
172
- function Dt() {
173
- var z;
174
- return z = f.pop() || P.lex() || Tt, typeof z != "number" && (z instanceof Array && (f = z, z = f.pop()), z = u.symbols_[z] || z), z;
175
- }
176
- a(Dt, "lex");
177
- for (var I, U, V, ct, j = {}, st, Y, Pt, nt; ; ) {
178
- if (U = d[d.length - 1], this.defaultActions[U] ? V = this.defaultActions[U] : ((I === null || typeof I > "u") && (I = Dt()), V = Z[U] && Z[U][I]), typeof V > "u" || !V.length || !V[0]) {
179
- var gt = "";
180
- nt = [];
181
- for (st in Z[U])
182
- this.terminals_[st] && st > ii && nt.push("'" + this.terminals_[st] + "'");
183
- P.showPosition ? gt = "Parse error on line " + (et + 1) + `:
184
- ` + P.showPosition() + `
185
- Expecting ` + nt.join(", ") + ", got '" + (this.terminals_[I] || I) + "'" : gt = "Parse error on line " + (et + 1) + ": Unexpected " + (I == Tt ? "end of input" : "'" + (this.terminals_[I] || I) + "'"), this.parseError(gt, {
186
- text: P.match,
187
- token: this.terminals_[I] || I,
188
- line: P.yylineno,
189
- loc: lt,
190
- expected: nt
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), R.push(P.yytext), o.push(P.yylloc), d.push(V[1]), I = null, kt = P.yyleng, p = P.yytext, et = P.yylineno, lt = P.yylloc;
198
- break;
199
- case 2:
200
- if (Y = this.productions_[V[1]][1], j.$ = R[R.length - Y], j._$ = {
201
- first_line: o[o.length - (Y || 1)].first_line,
202
- last_line: o[o.length - 1].last_line,
203
- first_column: o[o.length - (Y || 1)].first_column,
204
- last_column: o[o.length - 1].last_column
205
- }, si && (j._$.range = [
206
- o[o.length - (Y || 1)].range[0],
207
- o[o.length - 1].range[1]
208
- ]), ct = this.performAction.apply(j, [
209
- p,
210
- kt,
211
- et,
212
- $.yy,
213
- V[1],
214
- R,
215
- o
216
- ].concat(ei)), typeof ct < "u")
217
- return ct;
218
- Y && (d = d.slice(0, -1 * Y * 2), R = R.slice(0, -1 * Y), o = o.slice(0, -1 * Y)), d.push(this.productions_[V[1]][0]), R.push(j.$), o.push(j._$), Pt = Z[d[d.length - 2]][d[d.length - 1]], d.push(Pt);
219
- break;
220
- case 3:
221
- return !0;
222
- }
223
- }
224
- return !0;
225
- }, "parse")
226
- }, K = /* @__PURE__ */ (function() {
227
- var F = {
228
- EOF: 1,
229
- parseError: /* @__PURE__ */ a(function(u, d) {
230
- if (this.yy.parser)
231
- this.yy.parser.parseError(u, d);
232
- else
233
- throw new Error(u);
234
- }, "parseError"),
235
- // resets the lexer, sets new input
236
- setInput: /* @__PURE__ */ a(function(h, u) {
237
- 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 = {
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 h = this._input[0];
247
- this.yytext += h, this.yyleng++, this.offset++, this.match += h, this.matched += h;
248
- var u = h.match(/(?:\r\n?|\n).*/g);
249
- 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;
250
- }, "input"),
251
- // unshifts one char (or a string) into the input
252
- unput: /* @__PURE__ */ a(function(h) {
253
- var u = h.length, d = h.split(/(?:\r\n?|\n)/g);
254
- this._input = h + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - u), this.offset -= u;
255
- var f = 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 R = 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 === f.length ? this.yylloc.first_column : 0) + f[f.length - d.length].length - d[0].length : this.yylloc.first_column - u
263
- }, this.options.ranges && (this.yylloc.range = [R[0], R[0] + this.yyleng - u]), 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(h) {
284
- this.unput(this.match.slice(h));
285
- }, "less"),
286
- // displays already matched input, i.e. for error messages
287
- pastInput: /* @__PURE__ */ a(function() {
288
- var h = this.matched.substr(0, this.matched.length - this.match.length);
289
- return (h.length > 20 ? "..." : "") + h.substr(-20).replace(/\n/g, "");
290
- }, "pastInput"),
291
- // displays upcoming input, i.e. for error messages
292
- upcomingInput: /* @__PURE__ */ a(function() {
293
- var h = this.match;
294
- return h.length < 20 && (h += this._input.substr(0, 20 - h.length)), (h.substr(0, 20) + (h.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 h = this.pastInput(), u = new Array(h.length + 1).join("-");
299
- return h + this.upcomingInput() + `
300
- ` + u + "^";
301
- }, "showPosition"),
302
- // test the lexed token: return FALSE when not a match, otherwise return token
303
- test_match: /* @__PURE__ */ a(function(h, u) {
304
- var d, f, R;
305
- if (this.options.backtrack_lexer && (R = {
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 && (R.yylloc.range = this.yylloc.range.slice(0))), f = h[0].match(/(?:\r\n?|\n).*/g), f && (this.yylineno += f.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: f ? f[f.length - 1].length - f[f.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + h[0].length
329
- }, 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], d = this.performAction.call(this, this.yy, this, u, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), d)
330
- return d;
331
- if (this._backtrack) {
332
- for (var o in R)
333
- this[o] = R[o];
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 h, u, d, f;
344
- this._more || (this.yytext = "", this.match = "");
345
- for (var R = this._currentRules(), o = 0; o < R.length; o++)
346
- if (d = this._input.match(this.rules[R[o]]), d && (!u || d[0].length > u[0].length)) {
347
- if (u = d, f = o, this.options.backtrack_lexer) {
348
- if (h = this.test_match(d, R[o]), h !== !1)
349
- return h;
350
- if (this._backtrack) {
351
- u = !1;
352
- continue;
353
- } else
354
- return !1;
355
- } else if (!this.options.flex)
356
- break;
357
- }
358
- return u ? (h = this.test_match(u, R[f]), h !== !1 ? h : !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 u = this.next();
368
- return u || 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(u) {
372
- this.conditionStack.push(u);
373
- }, "begin"),
374
- // pop the previously active lexer condition state off the condition stack
375
- popState: /* @__PURE__ */ a(function() {
376
- var u = this.conditionStack.length - 1;
377
- return u > 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(u) {
385
- return u = this.conditionStack.length - 1 - Math.abs(u || 0), u >= 0 ? this.conditionStack[u] : "INITIAL";
386
- }, "topState"),
387
- // alias for begin(condition)
388
- pushState: /* @__PURE__ */ a(function(u) {
389
- this.begin(u);
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(u, d, f, R) {
397
- switch (f) {
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 F;
503
- })();
504
- T.lexer = K;
505
- function G() {
506
- this.yy = {};
507
- }
508
- return a(G, "Parser"), G.prototype = T, T.Parser = G, new G();
509
- })();
510
- dt.parser = dt;
511
- var wi = dt;
512
- function at(t) {
513
- return t.type === "bar";
514
- }
515
- a(at, "isBarPlot");
516
- function ot(t) {
517
- return t.type === "band";
518
- }
519
- a(ot, "isBandAxisData");
520
- function Q(t) {
521
- return t.type === "linear";
522
- }
523
- a(Q, "isLinearAxisData");
524
- var yt = class {
525
- constructor(t) {
526
- this.parentGroup = t;
527
- }
528
- static {
529
- a(this, "TextDimensionCalculatorWithFont");
530
- }
531
- getMaxDimension(t, i) {
532
- if (!this.parentGroup)
533
- return {
534
- width: t.reduce((g, m) => Math.max(m.length, g), 0) * i,
535
- height: i
536
- };
537
- const e = {
538
- width: 0,
539
- height: 0
540
- }, s = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", i), n = s.node()?.getScreenCTM?.(), c = /* @__PURE__ */ a((g) => g && g > 0 ? g : 1, "toScale"), r = c(n?.a), x = c(n?.d);
541
- for (const g of t) {
542
- const m = pi(s, 1, g), _ = m ? m.width / r : g.length * i, S = m ? m.height / x : i;
543
- e.width = Math.max(e.width, _), e.height = Math.max(e.height, S);
544
- }
545
- return s.remove(), e;
546
- }
547
- }, Et = 0.7, Mt = 0.2, Ot = class {
548
- constructor(t, i, e, s) {
549
- this.axisConfig = t, this.title = i, this.textDimensionCalculator = e, this.axisThemeConfig = s, 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;
550
- }
551
- static {
552
- a(this, "BaseAxis");
553
- }
554
- setRange(t) {
555
- 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();
556
- }
557
- getRange() {
558
- return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding];
559
- }
560
- setAxisPosition(t) {
561
- this.axisPosition = t, this.setRange(this.range);
562
- }
563
- getTickDistance() {
564
- const t = this.getRange();
565
- return Math.abs(t[0] - t[1]) / this.getTickValues().length;
566
- }
567
- getAxisOuterPadding() {
568
- return this.outerPadding;
569
- }
570
- getLabelDimension() {
571
- return this.textDimensionCalculator.getMaxDimension(
572
- this.getTickValues().map((t) => t.toString()),
573
- this.axisConfig.labelFontSize
574
- );
575
- }
576
- recalculateOuterPaddingToDrawBar() {
577
- Et * this.getTickDistance() > this.outerPadding * 2 && (this.outerPadding = Math.floor(Et * this.getTickDistance() / 2)), this.recalculateScale();
578
- }
579
- calculateSpaceIfDrawnHorizontally(t) {
580
- let i = t.height;
581
- if (this.axisConfig.showAxisLine && i > this.axisConfig.axisLineWidth && (i -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
582
- const e = this.getLabelDimension(), s = Mt * t.width;
583
- this.outerPadding = Math.min(e.width / 2, s);
584
- let n = e.height;
585
- this.axisPosition === "bottom" && this.normalizedLabelRotationInRad !== 0 && (n = Math.max(
586
- n,
587
- Math.abs(Math.sin(this.normalizedLabelRotationInRad) * e.width) + Math.abs(Math.cos(this.normalizedLabelRotationInRad) * e.height)
588
- )), n += this.axisConfig.labelPadding * 2, this.labelTextHeight = e.height, n <= i && (i -= n, this.showLabel = !0);
589
- }
590
- if (this.axisConfig.showTick && i >= this.axisConfig.tickLength && (this.showTick = !0, i -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
591
- const e = this.textDimensionCalculator.getMaxDimension(
592
- [this.title],
593
- this.axisConfig.titleFontSize
594
- ), s = e.height + this.axisConfig.titlePadding * 2;
595
- this.titleTextHeight = e.height, s <= i && (i -= s, this.showTitle = !0);
596
- }
597
- this.boundingRect.width = t.width, this.boundingRect.height = t.height - i;
598
- }
599
- calculateSpaceIfDrawnVertical(t) {
600
- let i = t.width;
601
- if (this.axisConfig.showAxisLine && i > this.axisConfig.axisLineWidth && (i -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
602
- const e = this.getLabelDimension(), s = Mt * t.height;
603
- this.outerPadding = Math.min(e.height / 2, s);
604
- const n = e.width + this.axisConfig.labelPadding * 2;
605
- n <= i && (i -= n, this.showLabel = !0);
606
- }
607
- if (this.axisConfig.showTick && i >= this.axisConfig.tickLength && (this.showTick = !0, i -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
608
- const e = this.textDimensionCalculator.getMaxDimension(
609
- [this.title],
610
- this.axisConfig.titleFontSize
611
- ), s = e.height + this.axisConfig.titlePadding * 2;
612
- this.titleTextHeight = e.height, s <= i && (i -= s, this.showTitle = !0);
613
- }
614
- this.boundingRect.width = t.width - i, this.boundingRect.height = t.height;
615
- }
616
- calculateSpace(t) {
617
- return this.axisPosition === "left" || this.axisPosition === "right" ? this.calculateSpaceIfDrawnVertical(t) : this.calculateSpaceIfDrawnHorizontally(t), this.recalculateScale(), {
618
- width: this.boundingRect.width,
619
- height: this.boundingRect.height
620
- };
621
- }
622
- setBoundingBoxXY(t) {
623
- this.boundingRect.x = t.x, this.boundingRect.y = t.y;
624
- }
625
- calculateOffsetByRotation(t) {
626
- const i = this.normalizedLabelRotationInRad;
627
- return i === 0 ? 0 : Math.sin(i) * this.getLabelDimension()[t] / 2;
628
- }
629
- getDrawableElementsForLeftAxis() {
630
- const t = [];
631
- if (this.showAxisLine) {
632
- const i = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
633
- t.push({
634
- type: "path",
635
- groupTexts: ["left-axis", "axisl-line"],
636
- data: [
637
- {
638
- path: `M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y + this.boundingRect.height} `,
639
- strokeFill: this.axisThemeConfig.axisLineColor,
640
- strokeWidth: this.axisConfig.axisLineWidth
641
- }
642
- ]
643
- });
644
- }
645
- if (this.showLabel && t.push({
646
- type: "text",
647
- groupTexts: ["left-axis", "label"],
648
- data: this.getTickValues().map((i) => ({
649
- text: i.toString(),
650
- 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),
651
- y: this.getScaleValue(i),
652
- fill: this.axisThemeConfig.labelColor,
653
- fontSize: this.axisConfig.labelFontSize,
654
- rotation: 0,
655
- verticalPos: "middle",
656
- horizontalPos: "right"
657
- }))
658
- }), this.showTick) {
659
- const i = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
660
- t.push({
661
- type: "path",
662
- groupTexts: ["left-axis", "ticks"],
663
- data: this.getTickValues().map((e) => ({
664
- path: `M ${i},${this.getScaleValue(e)} L ${i - this.axisConfig.tickLength},${this.getScaleValue(e)}`,
665
- strokeFill: this.axisThemeConfig.tickColor,
666
- strokeWidth: this.axisConfig.tickWidth
667
- }))
668
- });
669
- }
670
- return this.showTitle && t.push({
671
- type: "text",
672
- groupTexts: ["left-axis", "title"],
673
- data: [
674
- {
675
- text: this.title,
676
- x: this.boundingRect.x + this.axisConfig.titlePadding,
677
- y: this.boundingRect.y + this.boundingRect.height / 2,
678
- fill: this.axisThemeConfig.titleColor,
679
- fontSize: this.axisConfig.titleFontSize,
680
- rotation: 270,
681
- verticalPos: "top",
682
- horizontalPos: "center"
683
- }
684
- ]
685
- }), t;
686
- }
687
- getDrawableElementsForBottomAxis() {
688
- const t = [];
689
- if (this.showAxisLine) {
690
- const i = this.boundingRect.y + this.axisConfig.axisLineWidth / 2;
691
- t.push({
692
- type: "path",
693
- groupTexts: ["bottom-axis", "axis-line"],
694
- data: [
695
- {
696
- path: `M ${this.boundingRect.x},${i} L ${this.boundingRect.x + this.boundingRect.width},${i}`,
697
- strokeFill: this.axisThemeConfig.axisLineColor,
698
- strokeWidth: this.axisConfig.axisLineWidth
699
- }
700
- ]
701
- });
702
- }
703
- if (this.showLabel && t.push({
704
- type: "text",
705
- groupTexts: ["bottom-axis", "label"],
706
- data: this.getTickValues().map((i) => ({
707
- text: i.toString(),
708
- x: this.getScaleValue(i) + this.calculateOffsetByRotation("height"),
709
- y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0) + Math.abs(this.calculateOffsetByRotation("width")),
710
- fill: this.axisThemeConfig.labelColor,
711
- fontSize: this.axisConfig.labelFontSize,
712
- rotation: this.normalizedLabelRotationInRad * 180 / Math.PI,
713
- verticalPos: "top",
714
- horizontalPos: "center"
715
- }))
716
- }), this.showTick) {
717
- const i = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
718
- t.push({
719
- type: "path",
720
- groupTexts: ["bottom-axis", "ticks"],
721
- data: this.getTickValues().map((e) => ({
722
- path: `M ${this.getScaleValue(e)},${i} L ${this.getScaleValue(e)},${i + this.axisConfig.tickLength}`,
723
- strokeFill: this.axisThemeConfig.tickColor,
724
- strokeWidth: this.axisConfig.tickWidth
725
- }))
726
- });
727
- }
728
- return this.showTitle && t.push({
729
- type: "text",
730
- groupTexts: ["bottom-axis", "title"],
731
- data: [
732
- {
733
- text: this.title,
734
- x: this.range[0] + (this.range[1] - this.range[0]) / 2,
735
- y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight,
736
- fill: this.axisThemeConfig.titleColor,
737
- fontSize: this.axisConfig.titleFontSize,
738
- rotation: 0,
739
- verticalPos: "top",
740
- horizontalPos: "center"
741
- }
742
- ]
743
- }), t;
744
- }
745
- getDrawableElementsForTopAxis() {
746
- const t = [];
747
- if (this.showAxisLine) {
748
- const i = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2;
749
- t.push({
750
- type: "path",
751
- groupTexts: ["top-axis", "axis-line"],
752
- data: [
753
- {
754
- path: `M ${this.boundingRect.x},${i} L ${this.boundingRect.x + this.boundingRect.width},${i}`,
755
- strokeFill: this.axisThemeConfig.axisLineColor,
756
- strokeWidth: this.axisConfig.axisLineWidth
757
- }
758
- ]
759
- });
760
- }
761
- if (this.showLabel && t.push({
762
- type: "text",
763
- groupTexts: ["top-axis", "label"],
764
- data: this.getTickValues().map((i) => ({
765
- text: i.toString(),
766
- x: this.getScaleValue(i),
767
- y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding,
768
- fill: this.axisThemeConfig.labelColor,
769
- fontSize: this.axisConfig.labelFontSize,
770
- rotation: 0,
771
- verticalPos: "top",
772
- horizontalPos: "center"
773
- }))
774
- }), this.showTick) {
775
- const i = this.boundingRect.y;
776
- t.push({
777
- type: "path",
778
- groupTexts: ["top-axis", "ticks"],
779
- data: this.getTickValues().map((e) => ({
780
- path: `M ${this.getScaleValue(e)},${i + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(e)},${i + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`,
781
- strokeFill: this.axisThemeConfig.tickColor,
782
- strokeWidth: this.axisConfig.tickWidth
783
- }))
784
- });
785
- }
786
- return this.showTitle && t.push({
787
- type: "text",
788
- groupTexts: ["top-axis", "title"],
789
- data: [
790
- {
791
- text: this.title,
792
- x: this.boundingRect.x + this.boundingRect.width / 2,
793
- y: this.boundingRect.y + this.axisConfig.titlePadding,
794
- fill: this.axisThemeConfig.titleColor,
795
- fontSize: this.axisConfig.titleFontSize,
796
- rotation: 0,
797
- verticalPos: "top",
798
- horizontalPos: "center"
799
- }
800
- ]
801
- }), t;
802
- }
803
- getDrawableElements() {
804
- if (this.axisPosition === "left")
805
- return this.getDrawableElementsForLeftAxis();
806
- if (this.axisPosition === "right")
807
- throw Error("Drawing of right axis is not implemented");
808
- return this.axisPosition === "bottom" ? this.getDrawableElementsForBottomAxis() : this.axisPosition === "top" ? this.getDrawableElementsForTopAxis() : [];
809
- }
810
- }, Ai = class extends Ot {
811
- static {
812
- a(this, "BandAxis");
813
- }
814
- constructor(t, i, e, s, n) {
815
- super(t, s, n, i), this.categories = e, this.scale = ut().domain(this.categories).range(this.getRange());
816
- }
817
- setRange(t) {
818
- super.setRange(t);
819
- }
820
- recalculateScale() {
821
- this.scale = ut().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5), zt.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
822
- }
823
- getTickValues() {
824
- return this.categories;
825
- }
826
- getScaleValue(t) {
827
- return this.scale(t) ?? this.getRange()[0];
828
- }
829
- }, Ci = class extends Ot {
830
- static {
831
- a(this, "LinearAxis");
832
- }
833
- constructor(t, i, e, s, n) {
834
- super(t, s, n, i), this.domain = e, this.scale = Lt().domain(this.domain).range(this.getRange());
835
- }
836
- getTickValues() {
837
- return this.scale.ticks();
838
- }
839
- recalculateScale() {
840
- const t = [...this.domain];
841
- this.axisPosition === "left" && t.reverse(), this.scale = Lt().domain(t).range(this.getRange());
842
- }
843
- getScaleValue(t) {
844
- return this.scale(t);
845
- }
846
- };
847
- function xt(t, i, e, s) {
848
- const n = new yt(s);
849
- return ot(t) ? new Ai(
850
- i,
851
- e,
852
- t.categories,
853
- t.title,
854
- n
855
- ) : new Ci(
856
- i,
857
- e,
858
- [t.min, t.max],
859
- t.title,
860
- n
861
- );
862
- }
863
- a(xt, "getAxis");
864
- var Si = class {
865
- constructor(t, i, e, s) {
866
- this.textDimensionCalculator = t, this.chartConfig = i, this.chartData = e, this.chartThemeConfig = s, this.titleWidth = 0, this.boundingRect = {
867
- x: 0,
868
- y: 0,
869
- width: 0,
870
- height: 0
871
- }, this.showChartTitle = !1;
872
- }
873
- static {
874
- a(this, "ChartTitle");
875
- }
876
- setBoundingBoxXY(t) {
877
- this.boundingRect.x = t.x, this.boundingRect.y = t.y;
878
- }
879
- calculateSpace(t) {
880
- const i = this.textDimensionCalculator.getMaxDimension(
881
- [this.chartData.title],
882
- this.chartConfig.titleFontSize
883
- ), e = Math.max(i.width, t.width), s = i.height + 2 * this.chartConfig.titlePadding;
884
- return s <= t.height && this.chartConfig.showTitle && this.chartData.title && (this.boundingRect.width = e, this.boundingRect.height = s, this.titleWidth = i.width, this.showChartTitle = !0), {
885
- width: this.boundingRect.width,
886
- height: this.boundingRect.height
887
- };
888
- }
889
- /**
890
- * Centre the title over [start, end], shifted as needed to keep it inside the chart.
891
- * The title has its own row above the plot and legend, so it may use the full chart width.
892
- */
893
- alignTo(t, i) {
894
- const e = Math.min(this.titleWidth, this.chartConfig.width) / 2, s = Math.min(
895
- Math.max((t + i) / 2, e),
896
- this.chartConfig.width - e
897
- );
898
- this.boundingRect.x = s - e, this.boundingRect.width = e * 2;
899
- }
900
- getDrawableElements() {
901
- const t = [];
902
- return this.showChartTitle && t.push({
903
- groupTexts: ["chart-title"],
904
- type: "text",
905
- data: [
906
- {
907
- fontSize: this.chartConfig.titleFontSize,
908
- text: this.chartData.title,
909
- verticalPos: "middle",
910
- horizontalPos: "center",
911
- x: this.boundingRect.x + this.boundingRect.width / 2,
912
- y: this.boundingRect.y + this.boundingRect.height / 2,
913
- fill: this.chartThemeConfig.titleColor,
914
- rotation: 0
915
- }
916
- ]
917
- }), t;
918
- }
919
- };
920
- function Vt(t, i, e, s) {
921
- const n = new yt(s);
922
- return new Si(n, t, i, e);
923
- }
924
- a(Vt, "getChartTitleComponent");
925
- var Ri = 0.75, _i = 0.5, ki = 0.35;
926
- function ft(t) {
927
- return {
928
- fontSize: t,
929
- markerSize: t * Ri,
930
- markerSpacing: t * ki,
931
- itemSpacing: t * _i
932
- };
933
- }
934
- a(ft, "getLegendLayout");
935
- var Ti = class {
936
- constructor(t, i, e, s) {
937
- this.textDimensionCalculator = t, this.chartConfig = i, this.chartData = e, this.chartThemeConfig = s, this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }, this.visiblePlots = [];
938
- }
939
- static {
940
- a(this, "ChartLegend");
941
- }
942
- setBoundingBoxXY(t) {
943
- this.boundingRect.x = t.x, this.boundingRect.y = t.y;
944
- }
945
- calculateSpace(t) {
946
- if (this.visiblePlots = this.chartConfig.showLegend ? this.chartData.plots.filter((g) => g.title) : [], this.visiblePlots.length === 0)
947
- return this.boundingRect.width = 0, this.boundingRect.height = 0, { width: 0, height: 0 };
948
- const { fontSize: i, markerSize: e, markerSpacing: s, itemSpacing: n } = ft(
949
- this.chartConfig.legendFontSize
950
- ), c = this.textDimensionCalculator.getMaxDimension(
951
- this.visiblePlots.map((g) => g.title),
952
- i
953
- ), r = this.chartConfig.legendPadding * 2 + e + s + c.width, x = this.chartConfig.legendPadding * 2 + this.visiblePlots.length * i + (this.visiblePlots.length - 1) * n;
954
- return r <= t.width && x <= t.height ? (this.boundingRect.width = r, this.boundingRect.height = x) : (this.visiblePlots = [], this.boundingRect.width = 0, this.boundingRect.height = 0), {
955
- width: this.boundingRect.width,
956
- height: this.boundingRect.height
957
- };
958
- }
959
- getDrawableElements() {
960
- if (this.visiblePlots.length === 0)
961
- return [];
962
- const { fontSize: t, markerSize: i, markerSpacing: e, itemSpacing: s } = ft(
963
- this.chartConfig.legendFontSize
964
- ), n = t + s, c = this.boundingRect.x + this.chartConfig.legendPadding, r = this.boundingRect.y + this.chartConfig.legendPadding, x = [], g = [];
965
- for (const [m, _] of this.visiblePlots.entries())
966
- if (at(_))
967
- x.push({
968
- x: c,
969
- y: r + m * n,
970
- width: i,
971
- height: i,
972
- fill: _.fill,
973
- strokeFill: _.fill,
974
- strokeWidth: 0
975
- });
976
- else {
977
- const S = r + m * n + i / 2;
978
- g.push({
979
- path: `M ${c},${S} L ${c + i},${S}`,
980
- strokeFill: _.strokeFill,
981
- strokeWidth: _.strokeWidth
982
- });
983
- }
984
- return [
985
- {
986
- groupTexts: ["legend", "markers"],
987
- type: "rect",
988
- data: x
989
- },
990
- {
991
- groupTexts: ["legend", "markers"],
992
- type: "path",
993
- data: g
994
- },
995
- {
996
- groupTexts: ["legend", "label"],
997
- type: "text",
998
- data: this.visiblePlots.map((m, _) => ({
999
- text: m.title,
1000
- x: c + i + e,
1001
- y: r + _ * n + i / 2,
1002
- fill: this.chartThemeConfig.legendTextColor,
1003
- fontSize: t,
1004
- rotation: 0,
1005
- verticalPos: "middle",
1006
- horizontalPos: "left"
1007
- }))
1008
- }
1009
- ];
1010
- }
1011
- };
1012
- function Wt(t, i, e, s) {
1013
- const n = new yt(s);
1014
- return new Ti(n, t, i, e);
1015
- }
1016
- a(Wt, "getChartLegendComponent");
1017
- var Di = class {
1018
- constructor(t, i, e, s, n) {
1019
- this.plotData = t, this.xAxis = i, this.yAxis = e, this.orientation = s, this.plotIndex = n;
1020
- }
1021
- static {
1022
- a(this, "LinePlot");
1023
- }
1024
- getDrawableElement() {
1025
- const t = this.plotData.data.map((s) => [
1026
- this.xAxis.getScaleValue(s[0]),
1027
- this.yAxis.getScaleValue(s[1])
1028
- ]);
1029
- let i;
1030
- if (this.orientation === "horizontal" ? i = vt().y((s) => s[0]).x((s) => s[1])(t) : i = vt().x((s) => s[0]).y((s) => s[1])(t), !i)
1031
- return [];
1032
- const e = [
1033
- {
1034
- groupTexts: ["plot", `line-plot-${this.plotIndex}`],
1035
- type: "path",
1036
- data: [
1037
- {
1038
- path: i,
1039
- strokeFill: this.plotData.strokeFill,
1040
- strokeWidth: this.plotData.strokeWidth
1041
- }
1042
- ]
1043
- }
1044
- ];
1045
- if (this.plotData.pointLabels && this.plotData.pointLabels.length > 0) {
1046
- const c = [];
1047
- for (const [r, [x, g]] of t.entries()) {
1048
- const m = this.plotData.pointLabels[r];
1049
- m && (this.orientation === "horizontal" ? c.push({
1050
- x: g + 10,
1051
- y: x,
1052
- text: m,
1053
- fill: this.plotData.strokeFill,
1054
- verticalPos: "middle",
1055
- horizontalPos: "left",
1056
- fontSize: 12,
1057
- rotation: 0
1058
- }) : c.push({
1059
- x,
1060
- y: g - 10,
1061
- text: m,
1062
- fill: this.plotData.strokeFill,
1063
- verticalPos: "middle",
1064
- horizontalPos: "center",
1065
- fontSize: 12,
1066
- rotation: 0
1067
- }));
1068
- }
1069
- c.length > 0 && e.push({
1070
- groupTexts: ["plot", `line-plot-${this.plotIndex}`, "labels"],
1071
- type: "text",
1072
- data: c
1073
- });
1074
- }
1075
- return e;
1076
- }
1077
- }, Pi = class {
1078
- constructor(t, i, e, s, n, c) {
1079
- this.barData = t, this.boundingRect = i, this.xAxis = e, this.yAxis = s, this.orientation = n, this.plotIndex = c;
1080
- }
1081
- static {
1082
- a(this, "BarPlot");
1083
- }
1084
- getDrawableElement() {
1085
- const t = this.barData.data.map((n) => [
1086
- this.xAxis.getScaleValue(n[0]),
1087
- this.yAxis.getScaleValue(n[1])
1088
- ]), e = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - 0.05), s = e / 2;
1089
- return this.orientation === "horizontal" ? [
1090
- {
1091
- groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
1092
- type: "rect",
1093
- data: t.map((n) => ({
1094
- x: this.boundingRect.x,
1095
- y: n[0] - s,
1096
- height: e,
1097
- width: n[1] - this.boundingRect.x,
1098
- fill: this.barData.fill,
1099
- strokeWidth: 0,
1100
- strokeFill: this.barData.fill
1101
- }))
1102
- }
1103
- ] : [
1104
- {
1105
- groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
1106
- type: "rect",
1107
- data: t.map((n) => ({
1108
- x: n[0] - s,
1109
- y: n[1],
1110
- width: e,
1111
- height: this.boundingRect.y + this.boundingRect.height - n[1],
1112
- fill: this.barData.fill,
1113
- strokeWidth: 0,
1114
- strokeFill: this.barData.fill
1115
- }))
1116
- }
1117
- ];
1118
- }
1119
- }, vi = class {
1120
- constructor(t, i, e) {
1121
- this.chartConfig = t, this.chartData = i, this.chartThemeConfig = e, this.boundingRect = {
1122
- x: 0,
1123
- y: 0,
1124
- width: 0,
1125
- height: 0
1126
- };
1127
- }
1128
- static {
1129
- a(this, "BasePlot");
1130
- }
1131
- setAxes(t, i) {
1132
- this.xAxis = t, this.yAxis = i;
1133
- }
1134
- setBoundingBoxXY(t) {
1135
- this.boundingRect.x = t.x, this.boundingRect.y = t.y;
1136
- }
1137
- calculateSpace(t) {
1138
- return this.boundingRect.width = t.width, this.boundingRect.height = t.height, {
1139
- width: this.boundingRect.width,
1140
- height: this.boundingRect.height
1141
- };
1142
- }
1143
- getDrawableElements() {
1144
- if (!(this.xAxis && this.yAxis))
1145
- throw Error("Axes must be passed to render Plots");
1146
- const t = [];
1147
- for (const [i, e] of this.chartData.plots.entries())
1148
- switch (e.type) {
1149
- case "line":
1150
- {
1151
- const s = new Di(
1152
- e,
1153
- this.xAxis,
1154
- this.yAxis,
1155
- this.chartConfig.chartOrientation,
1156
- i
1157
- );
1158
- t.push(...s.getDrawableElement());
1159
- }
1160
- break;
1161
- case "bar":
1162
- {
1163
- const s = new Pi(
1164
- e,
1165
- this.boundingRect,
1166
- this.xAxis,
1167
- this.yAxis,
1168
- this.chartConfig.chartOrientation,
1169
- i
1170
- );
1171
- t.push(...s.getDrawableElement());
1172
- }
1173
- break;
1174
- }
1175
- return t;
1176
- }
1177
- };
1178
- function Ft(t, i, e) {
1179
- return new vi(t, i, e);
1180
- }
1181
- a(Ft, "getPlotComponent");
1182
- var Li = class {
1183
- constructor(t, i, e, s) {
1184
- this.chartConfig = t, this.chartData = i, this.componentStore = {
1185
- title: Vt(t, i, e, s),
1186
- plot: Ft(t, i, e),
1187
- legend: Wt(t, i, e, s),
1188
- xAxis: xt(
1189
- i.xAxis,
1190
- t.xAxis,
1191
- {
1192
- titleColor: e.xAxisTitleColor,
1193
- labelColor: e.xAxisLabelColor,
1194
- tickColor: e.xAxisTickColor,
1195
- axisLineColor: e.xAxisLineColor
1196
- },
1197
- s
1198
- ),
1199
- yAxis: xt(
1200
- i.yAxis,
1201
- t.yAxis,
1202
- {
1203
- titleColor: e.yAxisTitleColor,
1204
- labelColor: e.yAxisLabelColor,
1205
- tickColor: e.yAxisTickColor,
1206
- axisLineColor: e.yAxisLineColor
1207
- },
1208
- s
1209
- )
1210
- };
1211
- }
1212
- static {
1213
- a(this, "Orchestrator");
1214
- }
1215
- calculateVerticalSpace() {
1216
- let t = this.chartConfig.width, i = this.chartConfig.height, e = 0, s = 0, n = { width: 0, height: 0 }, c = Math.floor(t * this.chartConfig.plotReservedSpacePercent / 100), r = Math.floor(
1217
- i * this.chartConfig.plotReservedSpacePercent / 100
1218
- ), x = this.componentStore.plot.calculateSpace({
1219
- width: c,
1220
- height: r
1221
- });
1222
- t -= x.width, i -= x.height, x = this.componentStore.title.calculateSpace({
1223
- width: this.chartConfig.width,
1224
- height: i
1225
- }), s = x.height, i -= x.height, this.componentStore.xAxis.setAxisPosition("bottom"), x = this.componentStore.xAxis.calculateSpace({
1226
- width: t,
1227
- height: i
1228
- }), i -= x.height, this.componentStore.yAxis.setAxisPosition("left"), x = this.componentStore.yAxis.calculateSpace({
1229
- width: t,
1230
- height: i
1231
- }), e = x.width, t -= x.width, n = this.componentStore.legend.calculateSpace({
1232
- width: t,
1233
- height: r
1234
- }), t -= n.width, t > 0 && (c += t, t = 0), i > 0 && (r += i, i = 0), this.componentStore.plot.calculateSpace({
1235
- width: c,
1236
- height: r
1237
- }), this.componentStore.plot.setBoundingBoxXY({ x: e, y: s }), this.componentStore.title.alignTo(e, e + c), this.componentStore.legend.setBoundingBoxXY({
1238
- x: e + c,
1239
- y: s + Math.max((r - n.height) / 2, 0)
1240
- }), this.componentStore.xAxis.setRange([e, e + c]), this.componentStore.xAxis.setBoundingBoxXY({ x: e, y: s + r }), this.componentStore.yAxis.setRange([s, s + r]), this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: s }), this.chartData.plots.some((g) => at(g)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1241
- }
1242
- calculateHorizontalSpace() {
1243
- let t = this.chartConfig.width, i = this.chartConfig.height, e = 0, s = 0, n = 0, c = { width: 0, height: 0 }, r = Math.floor(t * this.chartConfig.plotReservedSpacePercent / 100), x = Math.floor(
1244
- i * this.chartConfig.plotReservedSpacePercent / 100
1245
- ), g = this.componentStore.plot.calculateSpace({
1246
- width: r,
1247
- height: x
1248
- });
1249
- t -= g.width, i -= g.height, g = this.componentStore.title.calculateSpace({
1250
- width: this.chartConfig.width,
1251
- height: i
1252
- }), e = g.height, i -= g.height, this.componentStore.xAxis.setAxisPosition("left"), g = this.componentStore.xAxis.calculateSpace({
1253
- width: t,
1254
- height: i
1255
- }), t -= g.width, s = g.width, this.componentStore.yAxis.setAxisPosition("top"), g = this.componentStore.yAxis.calculateSpace({
1256
- width: t,
1257
- height: i
1258
- }), i -= g.height, n = e + g.height, c = this.componentStore.legend.calculateSpace({
1259
- width: t,
1260
- height: x
1261
- }), t -= c.width, t > 0 && (r += t, t = 0), i > 0 && (x += i, i = 0), this.componentStore.plot.calculateSpace({
1262
- width: r,
1263
- height: x
1264
- }), this.componentStore.plot.setBoundingBoxXY({ x: s, y: n }), this.componentStore.title.alignTo(s, s + r), this.componentStore.legend.setBoundingBoxXY({
1265
- x: s + r,
1266
- y: n + Math.max((x - c.height) / 2, 0)
1267
- }), this.componentStore.yAxis.setRange([s, s + r]), this.componentStore.yAxis.setBoundingBoxXY({ x: s, y: e }), this.componentStore.xAxis.setRange([n, n + x]), this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: n }), this.chartData.plots.some((m) => at(m)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1268
- }
1269
- calculateSpace() {
1270
- this.chartConfig.chartOrientation === "horizontal" ? this.calculateHorizontalSpace() : this.calculateVerticalSpace();
1271
- }
1272
- getDrawableElement() {
1273
- this.calculateSpace();
1274
- const t = [];
1275
- this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis);
1276
- for (const i of Object.values(this.componentStore))
1277
- t.push(...i.getDrawableElements());
1278
- return t;
1279
- }
1280
- }, Ei = class {
1281
- static {
1282
- a(this, "XYChartBuilder");
1283
- }
1284
- static build(t, i, e, s) {
1285
- return new Li(t, i, e, s).getDrawableElement();
1286
- }
1287
- }, J = 0, Xt, tt = At(), it = wt(), b = Ct(), pt = it.plotColorPalette.split(",").map((t) => t.trim()), ht = !1, bt = !1;
1288
- function wt() {
1289
- const t = fi(), i = mt();
1290
- return Bt(t.xyChart, i.themeVariables.xyChart);
1291
- }
1292
- a(wt, "getChartDefaultThemeConfig");
1293
- function At() {
1294
- const t = mt();
1295
- return Bt(
1296
- xi.xyChart,
1297
- t.xyChart
1298
- );
1299
- }
1300
- a(At, "getChartDefaultConfig");
1301
- function Ct() {
1302
- return {
1303
- yAxis: {
1304
- type: "linear",
1305
- title: "",
1306
- min: 1 / 0,
1307
- max: -1 / 0
1308
- },
1309
- xAxis: {
1310
- type: "band",
1311
- title: "",
1312
- categories: []
1313
- },
1314
- title: "",
1315
- plots: []
1316
- };
1317
- }
1318
- a(Ct, "getChartDefaultData");
1319
- function q(t) {
1320
- const i = mt();
1321
- return di(t.trim(), i);
1322
- }
1323
- a(q, "textSanitizer");
1324
- function Nt(t) {
1325
- Xt = t;
1326
- }
1327
- a(Nt, "setTmpSVGG");
1328
- function Yt(t) {
1329
- t === "horizontal" ? tt.chartOrientation = "horizontal" : tt.chartOrientation = "vertical";
1330
- }
1331
- a(Yt, "setOrientation");
1332
- function Ht(t) {
1333
- b.xAxis.title = q(t.text);
1334
- }
1335
- a(Ht, "setXAxisTitle");
1336
- function St(t, i) {
1337
- b.xAxis = { type: "linear", title: b.xAxis.title, min: t, max: i }, ht = !0;
1338
- }
1339
- a(St, "setXAxisRangeData");
1340
- function $t(t) {
1341
- b.xAxis = {
1342
- type: "band",
1343
- title: b.xAxis.title,
1344
- categories: t.map((i) => q(i.text))
1345
- }, ht = !0;
1346
- }
1347
- a($t, "setXAxisBand");
1348
- function Ut(t) {
1349
- b.yAxis.title = q(t.text);
1350
- }
1351
- a(Ut, "setYAxisTitle");
1352
- function qt(t, i) {
1353
- b.yAxis = { type: "linear", title: b.yAxis.title, min: t, max: i }, bt = !0;
1354
- }
1355
- a(qt, "setYAxisRangeData");
1356
- function Gt(t) {
1357
- const i = Math.min(...t), e = Math.max(...t), s = Q(b.yAxis) ? b.yAxis.min : 1 / 0, n = Q(b.yAxis) ? b.yAxis.max : -1 / 0;
1358
- b.yAxis = {
1359
- type: "linear",
1360
- title: b.yAxis.title,
1361
- min: Math.min(s, i),
1362
- max: Math.max(n, e)
1363
- };
1364
- }
1365
- a(Gt, "setYAxisRangeFromPlotData");
1366
- function Rt(t) {
1367
- let i = [];
1368
- if (t.length === 0)
1369
- return i;
1370
- if (!ht) {
1371
- const e = Q(b.xAxis) ? b.xAxis.min : 1 / 0, s = Q(b.xAxis) ? b.xAxis.max : -1 / 0;
1372
- St(Math.min(e, 1), Math.max(s, t.length));
1373
- }
1374
- if (ot(b.xAxis) && t.length > b.xAxis.categories.length && (t = t.slice(0, b.xAxis.categories.length)), bt || Gt(t), ot(b.xAxis) && (i = b.xAxis.categories.map((e, s) => [e, t[s]])), Q(b.xAxis)) {
1375
- const e = b.xAxis.min, s = b.xAxis.max;
1376
- if (t.length === 1)
1377
- i = [[`${e}`, t[0]]];
1378
- else {
1379
- const n = (s - e) / (t.length - 1);
1380
- i = t.map((c, r) => [`${e + r * n}`, c]);
1381
- }
1382
- }
1383
- return i;
1384
- }
1385
- a(Rt, "transformDataWithoutCategory");
1386
- function _t(t) {
1387
- return pt[t === 0 ? 0 : t % pt.length];
1388
- }
1389
- a(_t, "getPlotColorFromPalette");
1390
- function jt(t, i) {
1391
- const e = i.map((r) => r.value), s = i.map((r) => r.label ? q(r.label) : ""), n = Rt(e), c = s.some((r) => r !== "");
1392
- b.plots.push({
1393
- type: "line",
1394
- title: q(t.text),
1395
- strokeFill: _t(J),
1396
- strokeWidth: 2,
1397
- data: n,
1398
- ...c ? { pointLabels: s } : {}
1399
- }), J++;
1400
- }
1401
- a(jt, "setLineData");
1402
- function Qt(t, i) {
1403
- const e = i.map((n) => n.value), s = Rt(e);
1404
- b.plots.push({
1405
- type: "bar",
1406
- title: q(t.text),
1407
- fill: _t(J),
1408
- data: s
1409
- }), J++;
1410
- }
1411
- a(Qt, "setBarData");
1412
- function Kt() {
1413
- if (b.plots.length === 0)
1414
- throw Error("No Plot to render, please provide a plot with some data");
1415
- return b.title = It(), Ei.build(tt, b, it, Xt);
1416
- }
1417
- a(Kt, "getDrawableElem");
1418
- function Zt() {
1419
- return it;
1420
- }
1421
- a(Zt, "getChartThemeConfig");
1422
- function Jt() {
1423
- return tt;
1424
- }
1425
- a(Jt, "getChartConfig");
1426
- function ti() {
1427
- return b;
1428
- }
1429
- a(ti, "getXYChartData");
1430
- var Mi = /* @__PURE__ */ a(function() {
1431
- ui(), J = 0, tt = At(), b = Ct(), it = wt(), pt = it.plotColorPalette.split(",").map((t) => t.trim()), ht = !1, bt = !1;
1432
- }, "clear"), Ii = {
1433
- getDrawableElem: Kt,
1434
- clear: Mi,
1435
- setAccTitle: li,
1436
- getAccTitle: ri,
1437
- setDiagramTitle: hi,
1438
- getDiagramTitle: It,
1439
- getAccDescription: oi,
1440
- setAccDescription: ai,
1441
- setOrientation: Yt,
1442
- setXAxisTitle: Ht,
1443
- setXAxisRangeData: St,
1444
- setXAxisBand: $t,
1445
- setYAxisTitle: Ut,
1446
- setYAxisRangeData: qt,
1447
- setLineData: jt,
1448
- setBarData: Qt,
1449
- setTmpSVGG: Nt,
1450
- getChartThemeConfig: Zt,
1451
- getChartConfig: Jt,
1452
- getXYChartData: ti
1453
- }, zi = /* @__PURE__ */ a((t, i, e, s) => {
1454
- const n = s.db, c = n.getChartThemeConfig(), r = n.getChartConfig(), x = n.getXYChartData().plots[0].data.map((y) => y[1]);
1455
- function g(y) {
1456
- return y === "top" ? "text-before-edge" : "middle";
1457
- }
1458
- a(g, "getDominantBaseLine");
1459
- function m(y) {
1460
- return y === "left" ? "start" : y === "right" ? "end" : "middle";
1461
- }
1462
- a(m, "getTextAnchor");
1463
- function _(y) {
1464
- return `translate(${y.x}, ${y.y}) rotate(${y.rotation || 0})`;
1465
- }
1466
- a(_, "getTextTransformation"), zt.debug(`Rendering xychart chart
1467
- ` + t);
1468
- const S = ci(i), w = S.append("g").attr("class", "main"), E = w.append("rect").attr("width", r.width).attr("height", r.height).attr("class", "background");
1469
- gi(S, r.height, r.width, !0), S.attr("viewBox", `0 0 ${r.width} ${r.height}`), E.attr("fill", c.backgroundColor), n.setTmpSVGG(S.append("g").attr("class", "mermaid-tmp-group"));
1470
- const v = n.getDrawableElem(), L = {};
1471
- function M(y) {
1472
- let D = w, l = "";
1473
- for (const [B] of y.entries()) {
1474
- let W = w;
1475
- B > 0 && L[l] && (W = L[l]), l += y[B], D = L[l], D || (D = L[l] = W.append("g").attr("class", y[B]));
1476
- }
1477
- return D;
1478
- }
1479
- a(M, "getGroup");
1480
- for (const y of v) {
1481
- if (y.data.length === 0)
1482
- continue;
1483
- const D = M(y.groupTexts);
1484
- switch (y.type) {
1485
- case "rect":
1486
- if (D.selectAll("rect").data(y.data).enter().append("rect").attr("x", (l) => l.x).attr("y", (l) => l.y).attr("width", (l) => l.width).attr("height", (l) => l.height).attr("fill", (l) => l.fill).attr("stroke", (l) => l.strokeFill).attr("stroke-width", (l) => l.strokeWidth), r.showDataLabel) {
1487
- const l = r.showDataLabelOutsideBar;
1488
- if (r.chartOrientation === "horizontal") {
1489
- let B = function(C, O) {
1490
- const { data: T, label: K } = C;
1491
- return O * K.length * W <= T.width - X;
1492
- };
1493
- a(B, "fitsHorizontally");
1494
- const W = 0.7, X = 10, N = y.data.map((C, O) => ({ data: C, label: x[O].toString() })).filter((C) => C.data.width > 0 && C.data.height > 0), k = N.map((C) => {
1495
- const { data: O } = C;
1496
- let T = O.height * 0.7;
1497
- for (; !B(C, T) && T > 0; )
1498
- T -= 1;
1499
- return T;
1500
- }), H = Math.floor(Math.min(...k)), A = /* @__PURE__ */ a((C) => l ? C.data.x + C.data.width + X : C.data.x + C.data.width - X, "determineLabelXPosition");
1501
- D.selectAll("text").data(N).enter().append("text").attr("x", A).attr("y", (C) => C.data.y + C.data.height / 2).attr("text-anchor", l ? "start" : "end").attr("dominant-baseline", "middle").attr("fill", c.dataLabelColor).attr("font-size", `${H}px`).text((C) => C.label);
1502
- } else {
1503
- let B = function(A, C, O) {
1504
- const { data: T, label: K } = A, F = C * K.length * 0.7, h = T.x + T.width / 2, u = h - F / 2, d = h + F / 2, f = u >= T.x && d <= T.x + T.width, R = T.y + O + C <= T.y + T.height;
1505
- return f && R;
1506
- };
1507
- a(B, "fitsInBar");
1508
- const W = 10, X = y.data.map((A, C) => ({ data: A, label: x[C].toString() })).filter((A) => A.data.width > 0 && A.data.height > 0), N = X.map((A) => {
1509
- const { data: C, label: O } = A;
1510
- let T = C.width / (O.length * 0.7);
1511
- for (; !B(A, T, W) && T > 0; )
1512
- T -= 1;
1513
- return T;
1514
- }), k = Math.floor(Math.min(...N)), H = /* @__PURE__ */ a((A) => l ? A.data.y - W : A.data.y + W, "determineLabelYPosition");
1515
- 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", l ? "auto" : "hanging").attr("fill", c.dataLabelColor).attr("font-size", `${k}px`).text((A) => A.label);
1516
- }
1517
- }
1518
- break;
1519
- case "text":
1520
- D.selectAll("text").data(y.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (l) => l.fill).attr("font-size", (l) => l.fontSize).attr("dominant-baseline", (l) => g(l.verticalPos)).attr("text-anchor", (l) => m(l.horizontalPos)).attr("transform", (l) => _(l)).text((l) => l.text);
1521
- break;
1522
- case "path":
1523
- D.selectAll("path").data(y.data).enter().append("path").attr("d", (l) => l.path).attr("fill", (l) => l.fill ? l.fill : "none").attr("stroke", (l) => l.strokeFill).attr("stroke-width", (l) => l.strokeWidth);
1524
- break;
1525
- }
1526
- }
1527
- }, "draw"), Bi = {
1528
- draw: zi
1529
- }, Xi = {
1530
- parser: wi,
1531
- db: Ii,
1532
- renderer: Bi
1533
- };
1534
- export {
1535
- Xi as diagram
1536
- };