@zettelgeist/cli 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 (189) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +64 -0
  3. package/dist/bin.js +2211 -0
  4. package/dist/bin.js.map +7 -0
  5. package/dist/templates/export.html +27 -0
  6. package/dist/templates/skill/SKILL.md +220 -0
  7. package/dist/viewer-bundle/architecture-YZFGNWBL-W2K3EQOM.js +14 -0
  8. package/dist/viewer-bundle/architecture-YZFGNWBL-W2K3EQOM.js.map +7 -0
  9. package/dist/viewer-bundle/architectureDiagram-Q4EWVU46-LCGRUEWT.js +8884 -0
  10. package/dist/viewer-bundle/architectureDiagram-Q4EWVU46-LCGRUEWT.js.map +7 -0
  11. package/dist/viewer-bundle/base.css +248 -0
  12. package/dist/viewer-bundle/blockDiagram-DXYQGD6D-KAM7BOAP.js +3777 -0
  13. package/dist/viewer-bundle/blockDiagram-DXYQGD6D-KAM7BOAP.js.map +7 -0
  14. package/dist/viewer-bundle/board.css +370 -0
  15. package/dist/viewer-bundle/c4Diagram-AHTNJAMY-C3FIQYXA.js +2596 -0
  16. package/dist/viewer-bundle/c4Diagram-AHTNJAMY-C3FIQYXA.js.map +7 -0
  17. package/dist/viewer-bundle/chunk-2QXGXAO5.js +68 -0
  18. package/dist/viewer-bundle/chunk-2QXGXAO5.js.map +7 -0
  19. package/dist/viewer-bundle/chunk-5PZT7VUU.js +67 -0
  20. package/dist/viewer-bundle/chunk-5PZT7VUU.js.map +7 -0
  21. package/dist/viewer-bundle/chunk-5YJCJF2C.js +112 -0
  22. package/dist/viewer-bundle/chunk-5YJCJF2C.js.map +7 -0
  23. package/dist/viewer-bundle/chunk-6LYV7PBV.js +1011 -0
  24. package/dist/viewer-bundle/chunk-6LYV7PBV.js.map +7 -0
  25. package/dist/viewer-bundle/chunk-6VW7D5WX.js +48 -0
  26. package/dist/viewer-bundle/chunk-6VW7D5WX.js.map +7 -0
  27. package/dist/viewer-bundle/chunk-76C5OSD4.js +2048 -0
  28. package/dist/viewer-bundle/chunk-76C5OSD4.js.map +7 -0
  29. package/dist/viewer-bundle/chunk-7NZMPQDX.js +6957 -0
  30. package/dist/viewer-bundle/chunk-7NZMPQDX.js.map +7 -0
  31. package/dist/viewer-bundle/chunk-A634GTZN.js +122 -0
  32. package/dist/viewer-bundle/chunk-A634GTZN.js.map +7 -0
  33. package/dist/viewer-bundle/chunk-AJQJUKMU.js +133 -0
  34. package/dist/viewer-bundle/chunk-AJQJUKMU.js.map +7 -0
  35. package/dist/viewer-bundle/chunk-BM2KPNFW.js +5556 -0
  36. package/dist/viewer-bundle/chunk-BM2KPNFW.js.map +7 -0
  37. package/dist/viewer-bundle/chunk-CIDUOCCG.js +25 -0
  38. package/dist/viewer-bundle/chunk-CIDUOCCG.js.map +7 -0
  39. package/dist/viewer-bundle/chunk-CZHJHAOR.js +6397 -0
  40. package/dist/viewer-bundle/chunk-CZHJHAOR.js.map +7 -0
  41. package/dist/viewer-bundle/chunk-D5RLIWY4.js +125 -0
  42. package/dist/viewer-bundle/chunk-D5RLIWY4.js.map +7 -0
  43. package/dist/viewer-bundle/chunk-DI52DQAC.js +44 -0
  44. package/dist/viewer-bundle/chunk-DI52DQAC.js.map +7 -0
  45. package/dist/viewer-bundle/chunk-EXJQLTIV.js +51 -0
  46. package/dist/viewer-bundle/chunk-EXJQLTIV.js.map +7 -0
  47. package/dist/viewer-bundle/chunk-G3PPZWPW.js +96 -0
  48. package/dist/viewer-bundle/chunk-G3PPZWPW.js.map +7 -0
  49. package/dist/viewer-bundle/chunk-GTW4IDD4.js +30297 -0
  50. package/dist/viewer-bundle/chunk-GTW4IDD4.js.map +7 -0
  51. package/dist/viewer-bundle/chunk-GVE7OA3Z.js +59 -0
  52. package/dist/viewer-bundle/chunk-GVE7OA3Z.js.map +7 -0
  53. package/dist/viewer-bundle/chunk-JBUVKVPY.js +2042 -0
  54. package/dist/viewer-bundle/chunk-JBUVKVPY.js.map +7 -0
  55. package/dist/viewer-bundle/chunk-JQLVOAQB.js +20 -0
  56. package/dist/viewer-bundle/chunk-JQLVOAQB.js.map +7 -0
  57. package/dist/viewer-bundle/chunk-LQMQSYLO.js +101 -0
  58. package/dist/viewer-bundle/chunk-LQMQSYLO.js.map +7 -0
  59. package/dist/viewer-bundle/chunk-MBFAQ3IK.js +34 -0
  60. package/dist/viewer-bundle/chunk-MBFAQ3IK.js.map +7 -0
  61. package/dist/viewer-bundle/chunk-N7G7IIKG.js +25 -0
  62. package/dist/viewer-bundle/chunk-N7G7IIKG.js.map +7 -0
  63. package/dist/viewer-bundle/chunk-NW4YG3NS.js +171 -0
  64. package/dist/viewer-bundle/chunk-NW4YG3NS.js.map +7 -0
  65. package/dist/viewer-bundle/chunk-ODEP5TKB.js +61 -0
  66. package/dist/viewer-bundle/chunk-ODEP5TKB.js.map +7 -0
  67. package/dist/viewer-bundle/chunk-OGKINV23.js +1050 -0
  68. package/dist/viewer-bundle/chunk-OGKINV23.js.map +7 -0
  69. package/dist/viewer-bundle/chunk-OGMSNDVH.js +1994 -0
  70. package/dist/viewer-bundle/chunk-OGMSNDVH.js.map +7 -0
  71. package/dist/viewer-bundle/chunk-QJVSDNAW.js +25 -0
  72. package/dist/viewer-bundle/chunk-QJVSDNAW.js.map +7 -0
  73. package/dist/viewer-bundle/chunk-RBTT26R4.js +2721 -0
  74. package/dist/viewer-bundle/chunk-RBTT26R4.js.map +7 -0
  75. package/dist/viewer-bundle/chunk-RQIPIIE2.js +48 -0
  76. package/dist/viewer-bundle/chunk-RQIPIIE2.js.map +7 -0
  77. package/dist/viewer-bundle/chunk-SRTYTXTX.js +22 -0
  78. package/dist/viewer-bundle/chunk-SRTYTXTX.js.map +7 -0
  79. package/dist/viewer-bundle/chunk-TRL7YIZG.js +1663 -0
  80. package/dist/viewer-bundle/chunk-TRL7YIZG.js.map +7 -0
  81. package/dist/viewer-bundle/chunk-U5T7X4BV.js +172 -0
  82. package/dist/viewer-bundle/chunk-U5T7X4BV.js.map +7 -0
  83. package/dist/viewer-bundle/chunk-UCAW6C6C.js +48 -0
  84. package/dist/viewer-bundle/chunk-UCAW6C6C.js.map +7 -0
  85. package/dist/viewer-bundle/chunk-UEAG4BJQ.js +93 -0
  86. package/dist/viewer-bundle/chunk-UEAG4BJQ.js.map +7 -0
  87. package/dist/viewer-bundle/chunk-UVRE3R6A.js +1039 -0
  88. package/dist/viewer-bundle/chunk-UVRE3R6A.js.map +7 -0
  89. package/dist/viewer-bundle/chunk-VODO7SV4.js +25029 -0
  90. package/dist/viewer-bundle/chunk-VODO7SV4.js.map +7 -0
  91. package/dist/viewer-bundle/chunk-YEU62MVS.js +682 -0
  92. package/dist/viewer-bundle/chunk-YEU62MVS.js.map +7 -0
  93. package/dist/viewer-bundle/chunk-YFQT7PPW.js +987 -0
  94. package/dist/viewer-bundle/chunk-YFQT7PPW.js.map +7 -0
  95. package/dist/viewer-bundle/chunk-Z4G7FG27.js +48 -0
  96. package/dist/viewer-bundle/chunk-Z4G7FG27.js.map +7 -0
  97. package/dist/viewer-bundle/chunk-ZW4Y7DIF.js +2044 -0
  98. package/dist/viewer-bundle/chunk-ZW4Y7DIF.js.map +7 -0
  99. package/dist/viewer-bundle/classDiagram-6PBFFD2Q-7VKYXLUX.js +46 -0
  100. package/dist/viewer-bundle/classDiagram-6PBFFD2Q-7VKYXLUX.js.map +7 -0
  101. package/dist/viewer-bundle/classDiagram-v2-HSJHXN6E-ACCNN7EN.js +46 -0
  102. package/dist/viewer-bundle/classDiagram-v2-HSJHXN6E-ACCNN7EN.js.map +7 -0
  103. package/dist/viewer-bundle/cose-bilkent-S5V4N54A-MUJHAA34.js +5009 -0
  104. package/dist/viewer-bundle/cose-bilkent-S5V4N54A-MUJHAA34.js.map +7 -0
  105. package/dist/viewer-bundle/dagre-KV5264BT-YC5VV3WF.js +739 -0
  106. package/dist/viewer-bundle/dagre-KV5264BT-YC5VV3WF.js.map +7 -0
  107. package/dist/viewer-bundle/dark.css +13 -0
  108. package/dist/viewer-bundle/detail.css +539 -0
  109. package/dist/viewer-bundle/diagram-5BDNPKRD-RXFPVFYK.js +214 -0
  110. package/dist/viewer-bundle/diagram-5BDNPKRD-RXFPVFYK.js.map +7 -0
  111. package/dist/viewer-bundle/diagram-G4DWMVQ6-KN7CBNBQ.js +578 -0
  112. package/dist/viewer-bundle/diagram-G4DWMVQ6-KN7CBNBQ.js.map +7 -0
  113. package/dist/viewer-bundle/diagram-MMDJMWI5-ZN6TQ7ZC.js +345 -0
  114. package/dist/viewer-bundle/diagram-MMDJMWI5-ZN6TQ7ZC.js.map +7 -0
  115. package/dist/viewer-bundle/diagram-TYMM5635-MMTUJ4KA.js +255 -0
  116. package/dist/viewer-bundle/diagram-TYMM5635-MMTUJ4KA.js.map +7 -0
  117. package/dist/viewer-bundle/docs.css +88 -0
  118. package/dist/viewer-bundle/edit-modal-BEGC2AO6.js +176 -0
  119. package/dist/viewer-bundle/edit-modal-BEGC2AO6.js.map +7 -0
  120. package/dist/viewer-bundle/erDiagram-SMLLAGMA-TBHMLD2E.js +1349 -0
  121. package/dist/viewer-bundle/erDiagram-SMLLAGMA-TBHMLD2E.js.map +7 -0
  122. package/dist/viewer-bundle/flowDiagram-DWJPFMVM-BZHLK6QB.js +2501 -0
  123. package/dist/viewer-bundle/flowDiagram-DWJPFMVM-BZHLK6QB.js.map +7 -0
  124. package/dist/viewer-bundle/ganttDiagram-T4ZO3ILL-YBARPTQR.js +2654 -0
  125. package/dist/viewer-bundle/ganttDiagram-T4ZO3ILL-YBARPTQR.js.map +7 -0
  126. package/dist/viewer-bundle/gitGraph-7Q5UKJZL-HENKIQDX.js +14 -0
  127. package/dist/viewer-bundle/gitGraph-7Q5UKJZL-HENKIQDX.js.map +7 -0
  128. package/dist/viewer-bundle/gitGraphDiagram-UUTBAWPF-M4VV3YVA.js +1946 -0
  129. package/dist/viewer-bundle/gitGraphDiagram-UUTBAWPF-M4VV3YVA.js.map +7 -0
  130. package/dist/viewer-bundle/index.html +28 -0
  131. package/dist/viewer-bundle/info-OMHHGYJF-E773USRS.js +14 -0
  132. package/dist/viewer-bundle/info-OMHHGYJF-E773USRS.js.map +7 -0
  133. package/dist/viewer-bundle/infoDiagram-42DDH7IO-C7JGUXKK.js +59 -0
  134. package/dist/viewer-bundle/infoDiagram-42DDH7IO-C7JGUXKK.js.map +7 -0
  135. package/dist/viewer-bundle/ishikawaDiagram-UXIWVN3A-YBC4X4VB.js +1012 -0
  136. package/dist/viewer-bundle/ishikawaDiagram-UXIWVN3A-YBC4X4VB.js.map +7 -0
  137. package/dist/viewer-bundle/journeyDiagram-VCZTEJTY-6WKVEOOO.js +1303 -0
  138. package/dist/viewer-bundle/journeyDiagram-VCZTEJTY-6WKVEOOO.js.map +7 -0
  139. package/dist/viewer-bundle/kanban-definition-6JOO6SKY-URTTHHO4.js +1131 -0
  140. package/dist/viewer-bundle/kanban-definition-6JOO6SKY-URTTHHO4.js.map +7 -0
  141. package/dist/viewer-bundle/katex-QN5266ZE.js +14318 -0
  142. package/dist/viewer-bundle/katex-QN5266ZE.js.map +7 -0
  143. package/dist/viewer-bundle/light.css +15 -0
  144. package/dist/viewer-bundle/main.js +4816 -0
  145. package/dist/viewer-bundle/main.js.map +7 -0
  146. package/dist/viewer-bundle/mermaid.core-AEBXU2JK.js +1708 -0
  147. package/dist/viewer-bundle/mermaid.core-AEBXU2JK.js.map +7 -0
  148. package/dist/viewer-bundle/mindmap-definition-QFDTVHPH-KUMAMRSF.js +1277 -0
  149. package/dist/viewer-bundle/mindmap-definition-QFDTVHPH-KUMAMRSF.js.map +7 -0
  150. package/dist/viewer-bundle/packet-4T2RLAQJ-IRYWWA66.js +14 -0
  151. package/dist/viewer-bundle/packet-4T2RLAQJ-IRYWWA66.js.map +7 -0
  152. package/dist/viewer-bundle/pico.classless.min.css +4 -0
  153. package/dist/viewer-bundle/pie-ZZUOXDRM-JYO4VL5N.js +14 -0
  154. package/dist/viewer-bundle/pie-ZZUOXDRM-JYO4VL5N.js.map +7 -0
  155. package/dist/viewer-bundle/pieDiagram-DEJITSTG-QOEHQN3N.js +238 -0
  156. package/dist/viewer-bundle/pieDiagram-DEJITSTG-QOEHQN3N.js.map +7 -0
  157. package/dist/viewer-bundle/prompt-modal-C4LHI7BS.js +12 -0
  158. package/dist/viewer-bundle/prompt-modal-C4LHI7BS.js.map +7 -0
  159. package/dist/viewer-bundle/quadrantDiagram-34T5L4WZ-SJNPUU5N.js +1409 -0
  160. package/dist/viewer-bundle/quadrantDiagram-34T5L4WZ-SJNPUU5N.js.map +7 -0
  161. package/dist/viewer-bundle/radar-PYXPWWZC-45BRYQSB.js +14 -0
  162. package/dist/viewer-bundle/radar-PYXPWWZC-45BRYQSB.js.map +7 -0
  163. package/dist/viewer-bundle/reason-modal-MK34MQ73.js +68 -0
  164. package/dist/viewer-bundle/reason-modal-MK34MQ73.js.map +7 -0
  165. package/dist/viewer-bundle/requirementDiagram-MS252O5E-UOMT3FCC.js +1311 -0
  166. package/dist/viewer-bundle/requirementDiagram-MS252O5E-UOMT3FCC.js.map +7 -0
  167. package/dist/viewer-bundle/sankeyDiagram-XADWPNL6-LAVJ5C6A.js +1263 -0
  168. package/dist/viewer-bundle/sankeyDiagram-XADWPNL6-LAVJ5C6A.js.map +7 -0
  169. package/dist/viewer-bundle/sequenceDiagram-FGHM5R23-3IWTOUNQ.js +4655 -0
  170. package/dist/viewer-bundle/sequenceDiagram-FGHM5R23-3IWTOUNQ.js.map +7 -0
  171. package/dist/viewer-bundle/stateDiagram-FHFEXIEX-S2OVQQON.js +495 -0
  172. package/dist/viewer-bundle/stateDiagram-FHFEXIEX-S2OVQQON.js.map +7 -0
  173. package/dist/viewer-bundle/stateDiagram-v2-QKLJ7IA2-XNZ3XXSV.js +44 -0
  174. package/dist/viewer-bundle/stateDiagram-v2-QKLJ7IA2-XNZ3XXSV.js.map +7 -0
  175. package/dist/viewer-bundle/timeline-definition-GMOUNBTQ-FHVZ7MHE.js +1646 -0
  176. package/dist/viewer-bundle/timeline-definition-GMOUNBTQ-FHVZ7MHE.js.map +7 -0
  177. package/dist/viewer-bundle/treeView-SZITEDCU-RXZXNYAM.js +14 -0
  178. package/dist/viewer-bundle/treeView-SZITEDCU-RXZXNYAM.js.map +7 -0
  179. package/dist/viewer-bundle/treemap-W4RFUUIX-2IGOFSJM.js +14 -0
  180. package/dist/viewer-bundle/treemap-W4RFUUIX-2IGOFSJM.js.map +7 -0
  181. package/dist/viewer-bundle/vennDiagram-DHZGUBPP-HEAOEXEZ.js +2544 -0
  182. package/dist/viewer-bundle/vennDiagram-DHZGUBPP-HEAOEXEZ.js.map +7 -0
  183. package/dist/viewer-bundle/wardley-RL74JXVD-VSPCLOX2.js +14 -0
  184. package/dist/viewer-bundle/wardley-RL74JXVD-VSPCLOX2.js.map +7 -0
  185. package/dist/viewer-bundle/wardleyDiagram-NUSXRM2D-EBY4FG3X.js +938 -0
  186. package/dist/viewer-bundle/wardleyDiagram-NUSXRM2D-EBY4FG3X.js.map +7 -0
  187. package/dist/viewer-bundle/xychartDiagram-5P7HB3ND-SSMUQEXK.js +1952 -0
  188. package/dist/viewer-bundle/xychartDiagram-5P7HB3ND-SSMUQEXK.js.map +7 -0
  189. package/package.json +51 -0
@@ -0,0 +1,1952 @@
1
+ import {
2
+ selectSvgElement
3
+ } from "./chunk-N7G7IIKG.js";
4
+ import {
5
+ computeDimensionOfText
6
+ } from "./chunk-OGMSNDVH.js";
7
+ import {
8
+ cleanAndMerge
9
+ } from "./chunk-UVRE3R6A.js";
10
+ import "./chunk-G3PPZWPW.js";
11
+ import {
12
+ clear,
13
+ configureSvgSize,
14
+ defaultConfig_default,
15
+ getAccDescription,
16
+ getAccTitle,
17
+ getConfig,
18
+ getDiagramTitle,
19
+ getThemeVariables3,
20
+ sanitizeText,
21
+ setAccDescription,
22
+ setAccTitle,
23
+ setDiagramTitle
24
+ } from "./chunk-7NZMPQDX.js";
25
+ import "./chunk-YEU62MVS.js";
26
+ import {
27
+ __name,
28
+ band,
29
+ line_default,
30
+ linear,
31
+ log
32
+ } from "./chunk-CZHJHAOR.js";
33
+ import "./chunk-DI52DQAC.js";
34
+
35
+ // ../../node_modules/.pnpm/mermaid@11.14.0/node_modules/mermaid/dist/chunks/mermaid.core/xychartDiagram-5P7HB3ND.mjs
36
+ var parser = function() {
37
+ var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
38
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
39
+ return o2;
40
+ }, "o"), $V0 = [1, 10, 12, 14, 16, 18, 19, 21, 23], $V1 = [2, 6], $V2 = [1, 3], $V3 = [1, 5], $V4 = [1, 6], $V5 = [1, 7], $V6 = [1, 5, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], $V7 = [1, 25], $V8 = [1, 26], $V9 = [1, 28], $Va = [1, 29], $Vb = [1, 30], $Vc = [1, 31], $Vd = [1, 32], $Ve = [1, 33], $Vf = [1, 34], $Vg = [1, 35], $Vh = [1, 36], $Vi = [1, 37], $Vj = [1, 43], $Vk = [1, 42], $Vl = [1, 47], $Vm = [1, 50], $Vn = [1, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], $Vo = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36], $Vp = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], $Vq = [1, 64];
41
+ var parser2 = {
42
+ trace: /* @__PURE__ */ __name(function trace() {
43
+ }, "trace"),
44
+ yy: {},
45
+ symbols_: { "error": 2, "start": 3, "eol": 4, "XYCHART": 5, "chartConfig": 6, "document": 7, "CHART_ORIENTATION": 8, "statement": 9, "title": 10, "text": 11, "X_AXIS": 12, "parseXAxis": 13, "Y_AXIS": 14, "parseYAxis": 15, "LINE": 16, "plotData": 17, "BAR": 18, "acc_title": 19, "acc_title_value": 20, "acc_descr": 21, "acc_descr_value": 22, "acc_descr_multiline_value": 23, "SQUARE_BRACES_START": 24, "commaSeparatedNumbers": 25, "SQUARE_BRACES_END": 26, "NUMBER_WITH_DECIMAL": 27, "COMMA": 28, "xAxisData": 29, "bandData": 30, "ARROW_DELIMITER": 31, "commaSeparatedTexts": 32, "yAxisData": 33, "NEWLINE": 34, "SEMI": 35, "EOF": 36, "alphaNum": 37, "STR": 38, "MD_STR": 39, "alphaNumToken": 40, "AMP": 41, "NUM": 42, "ALPHA": 43, "PLUS": 44, "EQUALS": 45, "MULT": 46, "DOT": 47, "BRKT": 48, "MINUS": 49, "UNDERSCORE": 50, "$accept": 0, "$end": 1 },
46
+ terminals_: { 2: "error", 5: "XYCHART", 8: "CHART_ORIENTATION", 10: "title", 12: "X_AXIS", 14: "Y_AXIS", 16: "LINE", 18: "BAR", 19: "acc_title", 20: "acc_title_value", 21: "acc_descr", 22: "acc_descr_value", 23: "acc_descr_multiline_value", 24: "SQUARE_BRACES_START", 26: "SQUARE_BRACES_END", 27: "NUMBER_WITH_DECIMAL", 28: "COMMA", 31: "ARROW_DELIMITER", 34: "NEWLINE", 35: "SEMI", 36: "EOF", 38: "STR", 39: "MD_STR", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "PLUS", 45: "EQUALS", 46: "MULT", 47: "DOT", 48: "BRKT", 49: "MINUS", 50: "UNDERSCORE" },
47
+ productions_: [0, [3, 2], [3, 3], [3, 2], [3, 1], [6, 1], [7, 0], [7, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 3], [9, 2], [9, 3], [9, 2], [9, 2], [9, 1], [17, 3], [25, 3], [25, 1], [13, 1], [13, 2], [13, 1], [29, 1], [29, 3], [30, 3], [32, 3], [32, 1], [15, 1], [15, 2], [15, 1], [33, 3], [4, 1], [4, 1], [4, 1], [11, 1], [11, 1], [11, 1], [37, 1], [37, 2], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1]],
48
+ performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
49
+ var $0 = $$.length - 1;
50
+ switch (yystate) {
51
+ case 5:
52
+ yy.setOrientation($$[$0]);
53
+ break;
54
+ case 9:
55
+ yy.setDiagramTitle($$[$0].text.trim());
56
+ break;
57
+ case 12:
58
+ yy.setLineData({ text: "", type: "text" }, $$[$0]);
59
+ break;
60
+ case 13:
61
+ yy.setLineData($$[$0 - 1], $$[$0]);
62
+ break;
63
+ case 14:
64
+ yy.setBarData({ text: "", type: "text" }, $$[$0]);
65
+ break;
66
+ case 15:
67
+ yy.setBarData($$[$0 - 1], $$[$0]);
68
+ break;
69
+ case 16:
70
+ this.$ = $$[$0].trim();
71
+ yy.setAccTitle(this.$);
72
+ break;
73
+ case 17:
74
+ case 18:
75
+ this.$ = $$[$0].trim();
76
+ yy.setAccDescription(this.$);
77
+ break;
78
+ case 19:
79
+ this.$ = $$[$0 - 1];
80
+ break;
81
+ case 20:
82
+ this.$ = [Number($$[$0 - 2]), ...$$[$0]];
83
+ break;
84
+ case 21:
85
+ this.$ = [Number($$[$0])];
86
+ break;
87
+ case 22:
88
+ yy.setXAxisTitle($$[$0]);
89
+ break;
90
+ case 23:
91
+ yy.setXAxisTitle($$[$0 - 1]);
92
+ break;
93
+ case 24:
94
+ yy.setXAxisTitle({ type: "text", text: "" });
95
+ break;
96
+ case 25:
97
+ yy.setXAxisBand($$[$0]);
98
+ break;
99
+ case 26:
100
+ yy.setXAxisRangeData(Number($$[$0 - 2]), Number($$[$0]));
101
+ break;
102
+ case 27:
103
+ this.$ = $$[$0 - 1];
104
+ break;
105
+ case 28:
106
+ this.$ = [$$[$0 - 2], ...$$[$0]];
107
+ break;
108
+ case 29:
109
+ this.$ = [$$[$0]];
110
+ break;
111
+ case 30:
112
+ yy.setYAxisTitle($$[$0]);
113
+ break;
114
+ case 31:
115
+ yy.setYAxisTitle($$[$0 - 1]);
116
+ break;
117
+ case 32:
118
+ yy.setYAxisTitle({ type: "text", text: "" });
119
+ break;
120
+ case 33:
121
+ yy.setYAxisRangeData(Number($$[$0 - 2]), Number($$[$0]));
122
+ break;
123
+ case 37:
124
+ this.$ = { text: $$[$0], type: "text" };
125
+ break;
126
+ case 38:
127
+ this.$ = { text: $$[$0], type: "text" };
128
+ break;
129
+ case 39:
130
+ this.$ = { text: $$[$0], type: "markdown" };
131
+ break;
132
+ case 40:
133
+ this.$ = $$[$0];
134
+ break;
135
+ case 41:
136
+ this.$ = $$[$0 - 1] + "" + $$[$0];
137
+ break;
138
+ }
139
+ }, "anonymous"),
140
+ table: [o($V0, $V1, { 3: 1, 4: 2, 7: 4, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), { 1: [3] }, o($V0, $V1, { 4: 2, 7: 4, 3: 8, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), o($V0, $V1, { 4: 2, 7: 4, 6: 9, 3: 10, 5: $V2, 8: [1, 11], 34: $V3, 35: $V4, 36: $V5 }), { 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] }, o($V6, [2, 34]), o($V6, [2, 35]), o($V6, [2, 36]), { 1: [2, 1] }, o($V0, $V1, { 4: 2, 7: 4, 3: 21, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), { 1: [2, 3] }, o($V6, [2, 5]), o($V0, [2, 7], { 4: 22, 34: $V3, 35: $V4, 36: $V5 }), { 11: 23, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 39, 13: 38, 24: $Vj, 27: $Vk, 29: 40, 30: 41, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 45, 15: 44, 27: $Vl, 33: 46, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 49, 17: 48, 24: $Vm, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 52, 17: 51, 24: $Vm, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 20: [1, 53] }, { 22: [1, 54] }, o($Vn, [2, 18]), { 1: [2, 2] }, o($Vn, [2, 8]), o($Vn, [2, 9]), o($Vo, [2, 37], { 40: 55, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }), o($Vo, [2, 38]), o($Vo, [2, 39]), o($Vp, [2, 40]), o($Vp, [2, 42]), o($Vp, [2, 43]), o($Vp, [2, 44]), o($Vp, [2, 45]), o($Vp, [2, 46]), o($Vp, [2, 47]), o($Vp, [2, 48]), o($Vp, [2, 49]), o($Vp, [2, 50]), o($Vp, [2, 51]), o($Vn, [2, 10]), o($Vn, [2, 22], { 30: 41, 29: 56, 24: $Vj, 27: $Vk }), o($Vn, [2, 24]), o($Vn, [2, 25]), { 31: [1, 57] }, { 11: 59, 32: 58, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, o($Vn, [2, 11]), o($Vn, [2, 30], { 33: 60, 27: $Vl }), o($Vn, [2, 32]), { 31: [1, 61] }, o($Vn, [2, 12]), { 17: 62, 24: $Vm }, { 25: 63, 27: $Vq }, o($Vn, [2, 14]), { 17: 65, 24: $Vm }, o($Vn, [2, 16]), o($Vn, [2, 17]), o($Vp, [2, 41]), o($Vn, [2, 23]), { 27: [1, 66] }, { 26: [1, 67] }, { 26: [2, 29], 28: [1, 68] }, o($Vn, [2, 31]), { 27: [1, 69] }, o($Vn, [2, 13]), { 26: [1, 70] }, { 26: [2, 21], 28: [1, 71] }, o($Vn, [2, 15]), o($Vn, [2, 26]), o($Vn, [2, 27]), { 11: 59, 32: 72, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, o($Vn, [2, 33]), o($Vn, [2, 19]), { 25: 73, 27: $Vq }, { 26: [2, 28] }, { 26: [2, 20] }],
141
+ defaultActions: { 8: [2, 1], 10: [2, 3], 21: [2, 2], 72: [2, 28], 73: [2, 20] },
142
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
143
+ if (hash.recoverable) {
144
+ this.trace(str);
145
+ } else {
146
+ var error = new Error(str);
147
+ error.hash = hash;
148
+ throw error;
149
+ }
150
+ }, "parseError"),
151
+ parse: /* @__PURE__ */ __name(function parse(input) {
152
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
153
+ var args = lstack.slice.call(arguments, 1);
154
+ var lexer2 = Object.create(this.lexer);
155
+ var sharedState = { yy: {} };
156
+ for (var k in this.yy) {
157
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
158
+ sharedState.yy[k] = this.yy[k];
159
+ }
160
+ }
161
+ lexer2.setInput(input, sharedState.yy);
162
+ sharedState.yy.lexer = lexer2;
163
+ sharedState.yy.parser = this;
164
+ if (typeof lexer2.yylloc == "undefined") {
165
+ lexer2.yylloc = {};
166
+ }
167
+ var yyloc = lexer2.yylloc;
168
+ lstack.push(yyloc);
169
+ var ranges = lexer2.options && lexer2.options.ranges;
170
+ if (typeof sharedState.yy.parseError === "function") {
171
+ this.parseError = sharedState.yy.parseError;
172
+ } else {
173
+ this.parseError = Object.getPrototypeOf(this).parseError;
174
+ }
175
+ function popStack(n) {
176
+ stack.length = stack.length - 2 * n;
177
+ vstack.length = vstack.length - n;
178
+ lstack.length = lstack.length - n;
179
+ }
180
+ __name(popStack, "popStack");
181
+ function lex() {
182
+ var token;
183
+ token = tstack.pop() || lexer2.lex() || EOF;
184
+ if (typeof token !== "number") {
185
+ if (token instanceof Array) {
186
+ tstack = token;
187
+ token = tstack.pop();
188
+ }
189
+ token = self.symbols_[token] || token;
190
+ }
191
+ return token;
192
+ }
193
+ __name(lex, "lex");
194
+ var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
195
+ while (true) {
196
+ state = stack[stack.length - 1];
197
+ if (this.defaultActions[state]) {
198
+ action = this.defaultActions[state];
199
+ } else {
200
+ if (symbol === null || typeof symbol == "undefined") {
201
+ symbol = lex();
202
+ }
203
+ action = table[state] && table[state][symbol];
204
+ }
205
+ if (typeof action === "undefined" || !action.length || !action[0]) {
206
+ var errStr = "";
207
+ expected = [];
208
+ for (p in table[state]) {
209
+ if (this.terminals_[p] && p > TERROR) {
210
+ expected.push("'" + this.terminals_[p] + "'");
211
+ }
212
+ }
213
+ if (lexer2.showPosition) {
214
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
215
+ } else {
216
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
217
+ }
218
+ this.parseError(errStr, {
219
+ text: lexer2.match,
220
+ token: this.terminals_[symbol] || symbol,
221
+ line: lexer2.yylineno,
222
+ loc: yyloc,
223
+ expected
224
+ });
225
+ }
226
+ if (action[0] instanceof Array && action.length > 1) {
227
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
228
+ }
229
+ switch (action[0]) {
230
+ case 1:
231
+ stack.push(symbol);
232
+ vstack.push(lexer2.yytext);
233
+ lstack.push(lexer2.yylloc);
234
+ stack.push(action[1]);
235
+ symbol = null;
236
+ if (!preErrorSymbol) {
237
+ yyleng = lexer2.yyleng;
238
+ yytext = lexer2.yytext;
239
+ yylineno = lexer2.yylineno;
240
+ yyloc = lexer2.yylloc;
241
+ if (recovering > 0) {
242
+ recovering--;
243
+ }
244
+ } else {
245
+ symbol = preErrorSymbol;
246
+ preErrorSymbol = null;
247
+ }
248
+ break;
249
+ case 2:
250
+ len = this.productions_[action[1]][1];
251
+ yyval.$ = vstack[vstack.length - len];
252
+ yyval._$ = {
253
+ first_line: lstack[lstack.length - (len || 1)].first_line,
254
+ last_line: lstack[lstack.length - 1].last_line,
255
+ first_column: lstack[lstack.length - (len || 1)].first_column,
256
+ last_column: lstack[lstack.length - 1].last_column
257
+ };
258
+ if (ranges) {
259
+ yyval._$.range = [
260
+ lstack[lstack.length - (len || 1)].range[0],
261
+ lstack[lstack.length - 1].range[1]
262
+ ];
263
+ }
264
+ r = this.performAction.apply(yyval, [
265
+ yytext,
266
+ yyleng,
267
+ yylineno,
268
+ sharedState.yy,
269
+ action[1],
270
+ vstack,
271
+ lstack
272
+ ].concat(args));
273
+ if (typeof r !== "undefined") {
274
+ return r;
275
+ }
276
+ if (len) {
277
+ stack = stack.slice(0, -1 * len * 2);
278
+ vstack = vstack.slice(0, -1 * len);
279
+ lstack = lstack.slice(0, -1 * len);
280
+ }
281
+ stack.push(this.productions_[action[1]][0]);
282
+ vstack.push(yyval.$);
283
+ lstack.push(yyval._$);
284
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
285
+ stack.push(newState);
286
+ break;
287
+ case 3:
288
+ return true;
289
+ }
290
+ }
291
+ return true;
292
+ }, "parse")
293
+ };
294
+ var lexer = /* @__PURE__ */ function() {
295
+ var lexer2 = {
296
+ EOF: 1,
297
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
298
+ if (this.yy.parser) {
299
+ this.yy.parser.parseError(str, hash);
300
+ } else {
301
+ throw new Error(str);
302
+ }
303
+ }, "parseError"),
304
+ // resets the lexer, sets new input
305
+ setInput: /* @__PURE__ */ __name(function(input, yy) {
306
+ this.yy = yy || this.yy || {};
307
+ this._input = input;
308
+ this._more = this._backtrack = this.done = false;
309
+ this.yylineno = this.yyleng = 0;
310
+ this.yytext = this.matched = this.match = "";
311
+ this.conditionStack = ["INITIAL"];
312
+ this.yylloc = {
313
+ first_line: 1,
314
+ first_column: 0,
315
+ last_line: 1,
316
+ last_column: 0
317
+ };
318
+ if (this.options.ranges) {
319
+ this.yylloc.range = [0, 0];
320
+ }
321
+ this.offset = 0;
322
+ return this;
323
+ }, "setInput"),
324
+ // consumes and returns one char from the input
325
+ input: /* @__PURE__ */ __name(function() {
326
+ var ch = this._input[0];
327
+ this.yytext += ch;
328
+ this.yyleng++;
329
+ this.offset++;
330
+ this.match += ch;
331
+ this.matched += ch;
332
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
333
+ if (lines) {
334
+ this.yylineno++;
335
+ this.yylloc.last_line++;
336
+ } else {
337
+ this.yylloc.last_column++;
338
+ }
339
+ if (this.options.ranges) {
340
+ this.yylloc.range[1]++;
341
+ }
342
+ this._input = this._input.slice(1);
343
+ return ch;
344
+ }, "input"),
345
+ // unshifts one char (or a string) into the input
346
+ unput: /* @__PURE__ */ __name(function(ch) {
347
+ var len = ch.length;
348
+ var lines = ch.split(/(?:\r\n?|\n)/g);
349
+ this._input = ch + this._input;
350
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
351
+ this.offset -= len;
352
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
353
+ this.match = this.match.substr(0, this.match.length - 1);
354
+ this.matched = this.matched.substr(0, this.matched.length - 1);
355
+ if (lines.length - 1) {
356
+ this.yylineno -= lines.length - 1;
357
+ }
358
+ var r = this.yylloc.range;
359
+ this.yylloc = {
360
+ first_line: this.yylloc.first_line,
361
+ last_line: this.yylineno + 1,
362
+ first_column: this.yylloc.first_column,
363
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
364
+ };
365
+ if (this.options.ranges) {
366
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
367
+ }
368
+ this.yyleng = this.yytext.length;
369
+ return this;
370
+ }, "unput"),
371
+ // When called from action, caches matched text and appends it on next action
372
+ more: /* @__PURE__ */ __name(function() {
373
+ this._more = true;
374
+ return this;
375
+ }, "more"),
376
+ // 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.
377
+ reject: /* @__PURE__ */ __name(function() {
378
+ if (this.options.backtrack_lexer) {
379
+ this._backtrack = true;
380
+ } else {
381
+ 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).\n" + this.showPosition(), {
382
+ text: "",
383
+ token: null,
384
+ line: this.yylineno
385
+ });
386
+ }
387
+ return this;
388
+ }, "reject"),
389
+ // retain first n characters of the match
390
+ less: /* @__PURE__ */ __name(function(n) {
391
+ this.unput(this.match.slice(n));
392
+ }, "less"),
393
+ // displays already matched input, i.e. for error messages
394
+ pastInput: /* @__PURE__ */ __name(function() {
395
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
396
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
397
+ }, "pastInput"),
398
+ // displays upcoming input, i.e. for error messages
399
+ upcomingInput: /* @__PURE__ */ __name(function() {
400
+ var next = this.match;
401
+ if (next.length < 20) {
402
+ next += this._input.substr(0, 20 - next.length);
403
+ }
404
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
405
+ }, "upcomingInput"),
406
+ // displays the character position where the lexing error occurred, i.e. for error messages
407
+ showPosition: /* @__PURE__ */ __name(function() {
408
+ var pre = this.pastInput();
409
+ var c = new Array(pre.length + 1).join("-");
410
+ return pre + this.upcomingInput() + "\n" + c + "^";
411
+ }, "showPosition"),
412
+ // test the lexed token: return FALSE when not a match, otherwise return token
413
+ test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
414
+ var token, lines, backup;
415
+ if (this.options.backtrack_lexer) {
416
+ backup = {
417
+ yylineno: this.yylineno,
418
+ yylloc: {
419
+ first_line: this.yylloc.first_line,
420
+ last_line: this.last_line,
421
+ first_column: this.yylloc.first_column,
422
+ last_column: this.yylloc.last_column
423
+ },
424
+ yytext: this.yytext,
425
+ match: this.match,
426
+ matches: this.matches,
427
+ matched: this.matched,
428
+ yyleng: this.yyleng,
429
+ offset: this.offset,
430
+ _more: this._more,
431
+ _input: this._input,
432
+ yy: this.yy,
433
+ conditionStack: this.conditionStack.slice(0),
434
+ done: this.done
435
+ };
436
+ if (this.options.ranges) {
437
+ backup.yylloc.range = this.yylloc.range.slice(0);
438
+ }
439
+ }
440
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
441
+ if (lines) {
442
+ this.yylineno += lines.length;
443
+ }
444
+ this.yylloc = {
445
+ first_line: this.yylloc.last_line,
446
+ last_line: this.yylineno + 1,
447
+ first_column: this.yylloc.last_column,
448
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
449
+ };
450
+ this.yytext += match[0];
451
+ this.match += match[0];
452
+ this.matches = match;
453
+ this.yyleng = this.yytext.length;
454
+ if (this.options.ranges) {
455
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
456
+ }
457
+ this._more = false;
458
+ this._backtrack = false;
459
+ this._input = this._input.slice(match[0].length);
460
+ this.matched += match[0];
461
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
462
+ if (this.done && this._input) {
463
+ this.done = false;
464
+ }
465
+ if (token) {
466
+ return token;
467
+ } else if (this._backtrack) {
468
+ for (var k in backup) {
469
+ this[k] = backup[k];
470
+ }
471
+ return false;
472
+ }
473
+ return false;
474
+ }, "test_match"),
475
+ // return next match in input
476
+ next: /* @__PURE__ */ __name(function() {
477
+ if (this.done) {
478
+ return this.EOF;
479
+ }
480
+ if (!this._input) {
481
+ this.done = true;
482
+ }
483
+ var token, match, tempMatch, index;
484
+ if (!this._more) {
485
+ this.yytext = "";
486
+ this.match = "";
487
+ }
488
+ var rules = this._currentRules();
489
+ for (var i = 0; i < rules.length; i++) {
490
+ tempMatch = this._input.match(this.rules[rules[i]]);
491
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
492
+ match = tempMatch;
493
+ index = i;
494
+ if (this.options.backtrack_lexer) {
495
+ token = this.test_match(tempMatch, rules[i]);
496
+ if (token !== false) {
497
+ return token;
498
+ } else if (this._backtrack) {
499
+ match = false;
500
+ continue;
501
+ } else {
502
+ return false;
503
+ }
504
+ } else if (!this.options.flex) {
505
+ break;
506
+ }
507
+ }
508
+ }
509
+ if (match) {
510
+ token = this.test_match(match, rules[index]);
511
+ if (token !== false) {
512
+ return token;
513
+ }
514
+ return false;
515
+ }
516
+ if (this._input === "") {
517
+ return this.EOF;
518
+ } else {
519
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
520
+ text: "",
521
+ token: null,
522
+ line: this.yylineno
523
+ });
524
+ }
525
+ }, "next"),
526
+ // return next match that has a token
527
+ lex: /* @__PURE__ */ __name(function lex() {
528
+ var r = this.next();
529
+ if (r) {
530
+ return r;
531
+ } else {
532
+ return this.lex();
533
+ }
534
+ }, "lex"),
535
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
536
+ begin: /* @__PURE__ */ __name(function begin(condition) {
537
+ this.conditionStack.push(condition);
538
+ }, "begin"),
539
+ // pop the previously active lexer condition state off the condition stack
540
+ popState: /* @__PURE__ */ __name(function popState() {
541
+ var n = this.conditionStack.length - 1;
542
+ if (n > 0) {
543
+ return this.conditionStack.pop();
544
+ } else {
545
+ return this.conditionStack[0];
546
+ }
547
+ }, "popState"),
548
+ // produce the lexer rule set which is active for the currently active lexer condition state
549
+ _currentRules: /* @__PURE__ */ __name(function _currentRules() {
550
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
551
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
552
+ } else {
553
+ return this.conditions["INITIAL"].rules;
554
+ }
555
+ }, "_currentRules"),
556
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
557
+ topState: /* @__PURE__ */ __name(function topState(n) {
558
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
559
+ if (n >= 0) {
560
+ return this.conditionStack[n];
561
+ } else {
562
+ return "INITIAL";
563
+ }
564
+ }, "topState"),
565
+ // alias for begin(condition)
566
+ pushState: /* @__PURE__ */ __name(function pushState(condition) {
567
+ this.begin(condition);
568
+ }, "pushState"),
569
+ // return the number of states currently on the stack
570
+ stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
571
+ return this.conditionStack.length;
572
+ }, "stateStackSize"),
573
+ options: { "case-insensitive": true },
574
+ performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
575
+ var YYSTATE = YY_START;
576
+ switch ($avoiding_name_collisions) {
577
+ case 0:
578
+ break;
579
+ case 1:
580
+ break;
581
+ case 2:
582
+ this.popState();
583
+ return 34;
584
+ break;
585
+ case 3:
586
+ this.popState();
587
+ return 34;
588
+ break;
589
+ case 4:
590
+ return 34;
591
+ break;
592
+ case 5:
593
+ break;
594
+ case 6:
595
+ return 10;
596
+ break;
597
+ case 7:
598
+ this.pushState("acc_title");
599
+ return 19;
600
+ break;
601
+ case 8:
602
+ this.popState();
603
+ return "acc_title_value";
604
+ break;
605
+ case 9:
606
+ this.pushState("acc_descr");
607
+ return 21;
608
+ break;
609
+ case 10:
610
+ this.popState();
611
+ return "acc_descr_value";
612
+ break;
613
+ case 11:
614
+ this.pushState("acc_descr_multiline");
615
+ break;
616
+ case 12:
617
+ this.popState();
618
+ break;
619
+ case 13:
620
+ return "acc_descr_multiline_value";
621
+ break;
622
+ case 14:
623
+ return 5;
624
+ break;
625
+ case 15:
626
+ return 5;
627
+ break;
628
+ case 16:
629
+ return 8;
630
+ break;
631
+ case 17:
632
+ this.pushState("axis_data");
633
+ return "X_AXIS";
634
+ break;
635
+ case 18:
636
+ this.pushState("axis_data");
637
+ return "Y_AXIS";
638
+ break;
639
+ case 19:
640
+ this.pushState("axis_band_data");
641
+ return 24;
642
+ break;
643
+ case 20:
644
+ return 31;
645
+ break;
646
+ case 21:
647
+ this.pushState("data");
648
+ return 16;
649
+ break;
650
+ case 22:
651
+ this.pushState("data");
652
+ return 18;
653
+ break;
654
+ case 23:
655
+ this.pushState("data_inner");
656
+ return 24;
657
+ break;
658
+ case 24:
659
+ return 27;
660
+ break;
661
+ case 25:
662
+ this.popState();
663
+ return 26;
664
+ break;
665
+ case 26:
666
+ this.popState();
667
+ break;
668
+ case 27:
669
+ this.pushState("string");
670
+ break;
671
+ case 28:
672
+ this.popState();
673
+ break;
674
+ case 29:
675
+ return "STR";
676
+ break;
677
+ case 30:
678
+ return 24;
679
+ break;
680
+ case 31:
681
+ return 26;
682
+ break;
683
+ case 32:
684
+ return 43;
685
+ break;
686
+ case 33:
687
+ return "COLON";
688
+ break;
689
+ case 34:
690
+ return 44;
691
+ break;
692
+ case 35:
693
+ return 28;
694
+ break;
695
+ case 36:
696
+ return 45;
697
+ break;
698
+ case 37:
699
+ return 46;
700
+ break;
701
+ case 38:
702
+ return 48;
703
+ break;
704
+ case 39:
705
+ return 50;
706
+ break;
707
+ case 40:
708
+ return 47;
709
+ break;
710
+ case 41:
711
+ return 41;
712
+ break;
713
+ case 42:
714
+ return 49;
715
+ break;
716
+ case 43:
717
+ return 42;
718
+ break;
719
+ case 44:
720
+ break;
721
+ case 45:
722
+ return 35;
723
+ break;
724
+ case 46:
725
+ return 36;
726
+ break;
727
+ }
728
+ }, "anonymous"),
729
+ 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],
730
+ 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": true }, "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": true }, "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": true }, "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": true }, "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "title": { "rules": [], "inclusive": false }, "md_string": { "rules": [], "inclusive": false }, "string": { "rules": [28, 29], "inclusive": false }, "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": true } }
731
+ };
732
+ return lexer2;
733
+ }();
734
+ parser2.lexer = lexer;
735
+ function Parser() {
736
+ this.yy = {};
737
+ }
738
+ __name(Parser, "Parser");
739
+ Parser.prototype = parser2;
740
+ parser2.Parser = Parser;
741
+ return new Parser();
742
+ }();
743
+ parser.parser = parser;
744
+ var xychart_default = parser;
745
+ function isBarPlot(data) {
746
+ return data.type === "bar";
747
+ }
748
+ __name(isBarPlot, "isBarPlot");
749
+ function isBandAxisData(data) {
750
+ return data.type === "band";
751
+ }
752
+ __name(isBandAxisData, "isBandAxisData");
753
+ function isLinearAxisData(data) {
754
+ return data.type === "linear";
755
+ }
756
+ __name(isLinearAxisData, "isLinearAxisData");
757
+ var TextDimensionCalculatorWithFont = class {
758
+ constructor(parentGroup) {
759
+ this.parentGroup = parentGroup;
760
+ }
761
+ static {
762
+ __name(this, "TextDimensionCalculatorWithFont");
763
+ }
764
+ getMaxDimension(texts, fontSize) {
765
+ if (!this.parentGroup) {
766
+ return {
767
+ width: texts.reduce((acc, cur) => Math.max(cur.length, acc), 0) * fontSize,
768
+ height: fontSize
769
+ };
770
+ }
771
+ const dimension = {
772
+ width: 0,
773
+ height: 0
774
+ };
775
+ const elem = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", fontSize);
776
+ for (const t of texts) {
777
+ const bbox = computeDimensionOfText(elem, 1, t);
778
+ const width = bbox ? bbox.width : t.length * fontSize;
779
+ const height = bbox ? bbox.height : fontSize;
780
+ dimension.width = Math.max(dimension.width, width);
781
+ dimension.height = Math.max(dimension.height, height);
782
+ }
783
+ elem.remove();
784
+ return dimension;
785
+ }
786
+ };
787
+ var BAR_WIDTH_TO_TICK_WIDTH_RATIO = 0.7;
788
+ var MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL = 0.2;
789
+ var BaseAxis = class {
790
+ constructor(axisConfig, title, textDimensionCalculator, axisThemeConfig) {
791
+ this.axisConfig = axisConfig;
792
+ this.title = title;
793
+ this.textDimensionCalculator = textDimensionCalculator;
794
+ this.axisThemeConfig = axisThemeConfig;
795
+ this.boundingRect = { x: 0, y: 0, width: 0, height: 0 };
796
+ this.axisPosition = "left";
797
+ this.showTitle = false;
798
+ this.showLabel = false;
799
+ this.showTick = false;
800
+ this.showAxisLine = false;
801
+ this.outerPadding = 0;
802
+ this.titleTextHeight = 0;
803
+ this.labelTextHeight = 0;
804
+ this.range = [0, 10];
805
+ this.boundingRect = { x: 0, y: 0, width: 0, height: 0 };
806
+ this.axisPosition = "left";
807
+ }
808
+ static {
809
+ __name(this, "BaseAxis");
810
+ }
811
+ setRange(range) {
812
+ this.range = range;
813
+ if (this.axisPosition === "left" || this.axisPosition === "right") {
814
+ this.boundingRect.height = range[1] - range[0];
815
+ } else {
816
+ this.boundingRect.width = range[1] - range[0];
817
+ }
818
+ this.recalculateScale();
819
+ }
820
+ getRange() {
821
+ return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding];
822
+ }
823
+ setAxisPosition(axisPosition) {
824
+ this.axisPosition = axisPosition;
825
+ this.setRange(this.range);
826
+ }
827
+ getTickDistance() {
828
+ const range = this.getRange();
829
+ return Math.abs(range[0] - range[1]) / this.getTickValues().length;
830
+ }
831
+ getAxisOuterPadding() {
832
+ return this.outerPadding;
833
+ }
834
+ getLabelDimension() {
835
+ return this.textDimensionCalculator.getMaxDimension(
836
+ this.getTickValues().map((tick) => tick.toString()),
837
+ this.axisConfig.labelFontSize
838
+ );
839
+ }
840
+ recalculateOuterPaddingToDrawBar() {
841
+ if (BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() > this.outerPadding * 2) {
842
+ this.outerPadding = Math.floor(BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() / 2);
843
+ }
844
+ this.recalculateScale();
845
+ }
846
+ calculateSpaceIfDrawnHorizontally(availableSpace) {
847
+ let availableHeight = availableSpace.height;
848
+ if (this.axisConfig.showAxisLine && availableHeight > this.axisConfig.axisLineWidth) {
849
+ availableHeight -= this.axisConfig.axisLineWidth;
850
+ this.showAxisLine = true;
851
+ }
852
+ if (this.axisConfig.showLabel) {
853
+ const spaceRequired = this.getLabelDimension();
854
+ const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.width;
855
+ this.outerPadding = Math.min(spaceRequired.width / 2, maxPadding);
856
+ const heightRequired = spaceRequired.height + this.axisConfig.labelPadding * 2;
857
+ this.labelTextHeight = spaceRequired.height;
858
+ if (heightRequired <= availableHeight) {
859
+ availableHeight -= heightRequired;
860
+ this.showLabel = true;
861
+ }
862
+ }
863
+ if (this.axisConfig.showTick && availableHeight >= this.axisConfig.tickLength) {
864
+ this.showTick = true;
865
+ availableHeight -= this.axisConfig.tickLength;
866
+ }
867
+ if (this.axisConfig.showTitle && this.title) {
868
+ const spaceRequired = this.textDimensionCalculator.getMaxDimension(
869
+ [this.title],
870
+ this.axisConfig.titleFontSize
871
+ );
872
+ const heightRequired = spaceRequired.height + this.axisConfig.titlePadding * 2;
873
+ this.titleTextHeight = spaceRequired.height;
874
+ if (heightRequired <= availableHeight) {
875
+ availableHeight -= heightRequired;
876
+ this.showTitle = true;
877
+ }
878
+ }
879
+ this.boundingRect.width = availableSpace.width;
880
+ this.boundingRect.height = availableSpace.height - availableHeight;
881
+ }
882
+ calculateSpaceIfDrawnVertical(availableSpace) {
883
+ let availableWidth = availableSpace.width;
884
+ if (this.axisConfig.showAxisLine && availableWidth > this.axisConfig.axisLineWidth) {
885
+ availableWidth -= this.axisConfig.axisLineWidth;
886
+ this.showAxisLine = true;
887
+ }
888
+ if (this.axisConfig.showLabel) {
889
+ const spaceRequired = this.getLabelDimension();
890
+ const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.height;
891
+ this.outerPadding = Math.min(spaceRequired.height / 2, maxPadding);
892
+ const widthRequired = spaceRequired.width + this.axisConfig.labelPadding * 2;
893
+ if (widthRequired <= availableWidth) {
894
+ availableWidth -= widthRequired;
895
+ this.showLabel = true;
896
+ }
897
+ }
898
+ if (this.axisConfig.showTick && availableWidth >= this.axisConfig.tickLength) {
899
+ this.showTick = true;
900
+ availableWidth -= this.axisConfig.tickLength;
901
+ }
902
+ if (this.axisConfig.showTitle && this.title) {
903
+ const spaceRequired = this.textDimensionCalculator.getMaxDimension(
904
+ [this.title],
905
+ this.axisConfig.titleFontSize
906
+ );
907
+ const widthRequired = spaceRequired.height + this.axisConfig.titlePadding * 2;
908
+ this.titleTextHeight = spaceRequired.height;
909
+ if (widthRequired <= availableWidth) {
910
+ availableWidth -= widthRequired;
911
+ this.showTitle = true;
912
+ }
913
+ }
914
+ this.boundingRect.width = availableSpace.width - availableWidth;
915
+ this.boundingRect.height = availableSpace.height;
916
+ }
917
+ calculateSpace(availableSpace) {
918
+ if (this.axisPosition === "left" || this.axisPosition === "right") {
919
+ this.calculateSpaceIfDrawnVertical(availableSpace);
920
+ } else {
921
+ this.calculateSpaceIfDrawnHorizontally(availableSpace);
922
+ }
923
+ this.recalculateScale();
924
+ return {
925
+ width: this.boundingRect.width,
926
+ height: this.boundingRect.height
927
+ };
928
+ }
929
+ setBoundingBoxXY(point) {
930
+ this.boundingRect.x = point.x;
931
+ this.boundingRect.y = point.y;
932
+ }
933
+ getDrawableElementsForLeftAxis() {
934
+ const drawableElement = [];
935
+ if (this.showAxisLine) {
936
+ const x = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
937
+ drawableElement.push({
938
+ type: "path",
939
+ groupTexts: ["left-axis", "axisl-line"],
940
+ data: [
941
+ {
942
+ path: `M ${x},${this.boundingRect.y} L ${x},${this.boundingRect.y + this.boundingRect.height} `,
943
+ strokeFill: this.axisThemeConfig.axisLineColor,
944
+ strokeWidth: this.axisConfig.axisLineWidth
945
+ }
946
+ ]
947
+ });
948
+ }
949
+ if (this.showLabel) {
950
+ drawableElement.push({
951
+ type: "text",
952
+ groupTexts: ["left-axis", "label"],
953
+ data: this.getTickValues().map((tick) => ({
954
+ text: tick.toString(),
955
+ 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),
956
+ y: this.getScaleValue(tick),
957
+ fill: this.axisThemeConfig.labelColor,
958
+ fontSize: this.axisConfig.labelFontSize,
959
+ rotation: 0,
960
+ verticalPos: "middle",
961
+ horizontalPos: "right"
962
+ }))
963
+ });
964
+ }
965
+ if (this.showTick) {
966
+ const x = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
967
+ drawableElement.push({
968
+ type: "path",
969
+ groupTexts: ["left-axis", "ticks"],
970
+ data: this.getTickValues().map((tick) => ({
971
+ path: `M ${x},${this.getScaleValue(tick)} L ${x - this.axisConfig.tickLength},${this.getScaleValue(tick)}`,
972
+ strokeFill: this.axisThemeConfig.tickColor,
973
+ strokeWidth: this.axisConfig.tickWidth
974
+ }))
975
+ });
976
+ }
977
+ if (this.showTitle) {
978
+ drawableElement.push({
979
+ type: "text",
980
+ groupTexts: ["left-axis", "title"],
981
+ data: [
982
+ {
983
+ text: this.title,
984
+ x: this.boundingRect.x + this.axisConfig.titlePadding,
985
+ y: this.boundingRect.y + this.boundingRect.height / 2,
986
+ fill: this.axisThemeConfig.titleColor,
987
+ fontSize: this.axisConfig.titleFontSize,
988
+ rotation: 270,
989
+ verticalPos: "top",
990
+ horizontalPos: "center"
991
+ }
992
+ ]
993
+ });
994
+ }
995
+ return drawableElement;
996
+ }
997
+ getDrawableElementsForBottomAxis() {
998
+ const drawableElement = [];
999
+ if (this.showAxisLine) {
1000
+ const y = this.boundingRect.y + this.axisConfig.axisLineWidth / 2;
1001
+ drawableElement.push({
1002
+ type: "path",
1003
+ groupTexts: ["bottom-axis", "axis-line"],
1004
+ data: [
1005
+ {
1006
+ path: `M ${this.boundingRect.x},${y} L ${this.boundingRect.x + this.boundingRect.width},${y}`,
1007
+ strokeFill: this.axisThemeConfig.axisLineColor,
1008
+ strokeWidth: this.axisConfig.axisLineWidth
1009
+ }
1010
+ ]
1011
+ });
1012
+ }
1013
+ if (this.showLabel) {
1014
+ drawableElement.push({
1015
+ type: "text",
1016
+ groupTexts: ["bottom-axis", "label"],
1017
+ data: this.getTickValues().map((tick) => ({
1018
+ text: tick.toString(),
1019
+ x: this.getScaleValue(tick),
1020
+ y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
1021
+ fill: this.axisThemeConfig.labelColor,
1022
+ fontSize: this.axisConfig.labelFontSize,
1023
+ rotation: 0,
1024
+ verticalPos: "top",
1025
+ horizontalPos: "center"
1026
+ }))
1027
+ });
1028
+ }
1029
+ if (this.showTick) {
1030
+ const y = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
1031
+ drawableElement.push({
1032
+ type: "path",
1033
+ groupTexts: ["bottom-axis", "ticks"],
1034
+ data: this.getTickValues().map((tick) => ({
1035
+ path: `M ${this.getScaleValue(tick)},${y} L ${this.getScaleValue(tick)},${y + this.axisConfig.tickLength}`,
1036
+ strokeFill: this.axisThemeConfig.tickColor,
1037
+ strokeWidth: this.axisConfig.tickWidth
1038
+ }))
1039
+ });
1040
+ }
1041
+ if (this.showTitle) {
1042
+ drawableElement.push({
1043
+ type: "text",
1044
+ groupTexts: ["bottom-axis", "title"],
1045
+ data: [
1046
+ {
1047
+ text: this.title,
1048
+ x: this.range[0] + (this.range[1] - this.range[0]) / 2,
1049
+ y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight,
1050
+ fill: this.axisThemeConfig.titleColor,
1051
+ fontSize: this.axisConfig.titleFontSize,
1052
+ rotation: 0,
1053
+ verticalPos: "top",
1054
+ horizontalPos: "center"
1055
+ }
1056
+ ]
1057
+ });
1058
+ }
1059
+ return drawableElement;
1060
+ }
1061
+ getDrawableElementsForTopAxis() {
1062
+ const drawableElement = [];
1063
+ if (this.showAxisLine) {
1064
+ const y = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2;
1065
+ drawableElement.push({
1066
+ type: "path",
1067
+ groupTexts: ["top-axis", "axis-line"],
1068
+ data: [
1069
+ {
1070
+ path: `M ${this.boundingRect.x},${y} L ${this.boundingRect.x + this.boundingRect.width},${y}`,
1071
+ strokeFill: this.axisThemeConfig.axisLineColor,
1072
+ strokeWidth: this.axisConfig.axisLineWidth
1073
+ }
1074
+ ]
1075
+ });
1076
+ }
1077
+ if (this.showLabel) {
1078
+ drawableElement.push({
1079
+ type: "text",
1080
+ groupTexts: ["top-axis", "label"],
1081
+ data: this.getTickValues().map((tick) => ({
1082
+ text: tick.toString(),
1083
+ x: this.getScaleValue(tick),
1084
+ y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding,
1085
+ fill: this.axisThemeConfig.labelColor,
1086
+ fontSize: this.axisConfig.labelFontSize,
1087
+ rotation: 0,
1088
+ verticalPos: "top",
1089
+ horizontalPos: "center"
1090
+ }))
1091
+ });
1092
+ }
1093
+ if (this.showTick) {
1094
+ const y = this.boundingRect.y;
1095
+ drawableElement.push({
1096
+ type: "path",
1097
+ groupTexts: ["top-axis", "ticks"],
1098
+ data: this.getTickValues().map((tick) => ({
1099
+ path: `M ${this.getScaleValue(tick)},${y + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(tick)},${y + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`,
1100
+ strokeFill: this.axisThemeConfig.tickColor,
1101
+ strokeWidth: this.axisConfig.tickWidth
1102
+ }))
1103
+ });
1104
+ }
1105
+ if (this.showTitle) {
1106
+ drawableElement.push({
1107
+ type: "text",
1108
+ groupTexts: ["top-axis", "title"],
1109
+ data: [
1110
+ {
1111
+ text: this.title,
1112
+ x: this.boundingRect.x + this.boundingRect.width / 2,
1113
+ y: this.boundingRect.y + this.axisConfig.titlePadding,
1114
+ fill: this.axisThemeConfig.titleColor,
1115
+ fontSize: this.axisConfig.titleFontSize,
1116
+ rotation: 0,
1117
+ verticalPos: "top",
1118
+ horizontalPos: "center"
1119
+ }
1120
+ ]
1121
+ });
1122
+ }
1123
+ return drawableElement;
1124
+ }
1125
+ getDrawableElements() {
1126
+ if (this.axisPosition === "left") {
1127
+ return this.getDrawableElementsForLeftAxis();
1128
+ }
1129
+ if (this.axisPosition === "right") {
1130
+ throw Error("Drawing of right axis is not implemented");
1131
+ }
1132
+ if (this.axisPosition === "bottom") {
1133
+ return this.getDrawableElementsForBottomAxis();
1134
+ }
1135
+ if (this.axisPosition === "top") {
1136
+ return this.getDrawableElementsForTopAxis();
1137
+ }
1138
+ return [];
1139
+ }
1140
+ };
1141
+ var BandAxis = class extends BaseAxis {
1142
+ static {
1143
+ __name(this, "BandAxis");
1144
+ }
1145
+ constructor(axisConfig, axisThemeConfig, categories, title, textDimensionCalculator) {
1146
+ super(axisConfig, title, textDimensionCalculator, axisThemeConfig);
1147
+ this.categories = categories;
1148
+ this.scale = band().domain(this.categories).range(this.getRange());
1149
+ }
1150
+ setRange(range) {
1151
+ super.setRange(range);
1152
+ }
1153
+ recalculateScale() {
1154
+ this.scale = band().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5);
1155
+ log.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
1156
+ }
1157
+ getTickValues() {
1158
+ return this.categories;
1159
+ }
1160
+ getScaleValue(value) {
1161
+ return this.scale(value) ?? this.getRange()[0];
1162
+ }
1163
+ };
1164
+ var LinearAxis = class extends BaseAxis {
1165
+ static {
1166
+ __name(this, "LinearAxis");
1167
+ }
1168
+ constructor(axisConfig, axisThemeConfig, domain, title, textDimensionCalculator) {
1169
+ super(axisConfig, title, textDimensionCalculator, axisThemeConfig);
1170
+ this.domain = domain;
1171
+ this.scale = linear().domain(this.domain).range(this.getRange());
1172
+ }
1173
+ getTickValues() {
1174
+ return this.scale.ticks();
1175
+ }
1176
+ recalculateScale() {
1177
+ const domain = [...this.domain];
1178
+ if (this.axisPosition === "left") {
1179
+ domain.reverse();
1180
+ }
1181
+ this.scale = linear().domain(domain).range(this.getRange());
1182
+ }
1183
+ getScaleValue(value) {
1184
+ return this.scale(value);
1185
+ }
1186
+ };
1187
+ function getAxis(data, axisConfig, axisThemeConfig, tmpSVGGroup2) {
1188
+ const textDimensionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2);
1189
+ if (isBandAxisData(data)) {
1190
+ return new BandAxis(
1191
+ axisConfig,
1192
+ axisThemeConfig,
1193
+ data.categories,
1194
+ data.title,
1195
+ textDimensionCalculator
1196
+ );
1197
+ }
1198
+ return new LinearAxis(
1199
+ axisConfig,
1200
+ axisThemeConfig,
1201
+ [data.min, data.max],
1202
+ data.title,
1203
+ textDimensionCalculator
1204
+ );
1205
+ }
1206
+ __name(getAxis, "getAxis");
1207
+ var ChartTitle = class {
1208
+ constructor(textDimensionCalculator, chartConfig, chartData, chartThemeConfig) {
1209
+ this.textDimensionCalculator = textDimensionCalculator;
1210
+ this.chartConfig = chartConfig;
1211
+ this.chartData = chartData;
1212
+ this.chartThemeConfig = chartThemeConfig;
1213
+ this.boundingRect = {
1214
+ x: 0,
1215
+ y: 0,
1216
+ width: 0,
1217
+ height: 0
1218
+ };
1219
+ this.showChartTitle = false;
1220
+ }
1221
+ static {
1222
+ __name(this, "ChartTitle");
1223
+ }
1224
+ setBoundingBoxXY(point) {
1225
+ this.boundingRect.x = point.x;
1226
+ this.boundingRect.y = point.y;
1227
+ }
1228
+ calculateSpace(availableSpace) {
1229
+ const titleDimension = this.textDimensionCalculator.getMaxDimension(
1230
+ [this.chartData.title],
1231
+ this.chartConfig.titleFontSize
1232
+ );
1233
+ const widthRequired = Math.max(titleDimension.width, availableSpace.width);
1234
+ const heightRequired = titleDimension.height + 2 * this.chartConfig.titlePadding;
1235
+ if (titleDimension.width <= widthRequired && titleDimension.height <= heightRequired && this.chartConfig.showTitle && this.chartData.title) {
1236
+ this.boundingRect.width = widthRequired;
1237
+ this.boundingRect.height = heightRequired;
1238
+ this.showChartTitle = true;
1239
+ }
1240
+ return {
1241
+ width: this.boundingRect.width,
1242
+ height: this.boundingRect.height
1243
+ };
1244
+ }
1245
+ getDrawableElements() {
1246
+ const drawableElem = [];
1247
+ if (this.showChartTitle) {
1248
+ drawableElem.push({
1249
+ groupTexts: ["chart-title"],
1250
+ type: "text",
1251
+ data: [
1252
+ {
1253
+ fontSize: this.chartConfig.titleFontSize,
1254
+ text: this.chartData.title,
1255
+ verticalPos: "middle",
1256
+ horizontalPos: "center",
1257
+ x: this.boundingRect.x + this.boundingRect.width / 2,
1258
+ y: this.boundingRect.y + this.boundingRect.height / 2,
1259
+ fill: this.chartThemeConfig.titleColor,
1260
+ rotation: 0
1261
+ }
1262
+ ]
1263
+ });
1264
+ }
1265
+ return drawableElem;
1266
+ }
1267
+ };
1268
+ function getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) {
1269
+ const textDimensionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2);
1270
+ return new ChartTitle(textDimensionCalculator, chartConfig, chartData, chartThemeConfig);
1271
+ }
1272
+ __name(getChartTitleComponent, "getChartTitleComponent");
1273
+ var LinePlot = class {
1274
+ constructor(plotData, xAxis, yAxis, orientation, plotIndex2) {
1275
+ this.plotData = plotData;
1276
+ this.xAxis = xAxis;
1277
+ this.yAxis = yAxis;
1278
+ this.orientation = orientation;
1279
+ this.plotIndex = plotIndex2;
1280
+ }
1281
+ static {
1282
+ __name(this, "LinePlot");
1283
+ }
1284
+ getDrawableElement() {
1285
+ const finalData = this.plotData.data.map((d) => [
1286
+ this.xAxis.getScaleValue(d[0]),
1287
+ this.yAxis.getScaleValue(d[1])
1288
+ ]);
1289
+ let path;
1290
+ if (this.orientation === "horizontal") {
1291
+ path = line_default().y((d) => d[0]).x((d) => d[1])(finalData);
1292
+ } else {
1293
+ path = line_default().x((d) => d[0]).y((d) => d[1])(finalData);
1294
+ }
1295
+ if (!path) {
1296
+ return [];
1297
+ }
1298
+ return [
1299
+ {
1300
+ groupTexts: ["plot", `line-plot-${this.plotIndex}`],
1301
+ type: "path",
1302
+ data: [
1303
+ {
1304
+ path,
1305
+ strokeFill: this.plotData.strokeFill,
1306
+ strokeWidth: this.plotData.strokeWidth
1307
+ }
1308
+ ]
1309
+ }
1310
+ ];
1311
+ }
1312
+ };
1313
+ var BarPlot = class {
1314
+ constructor(barData, boundingRect, xAxis, yAxis, orientation, plotIndex2) {
1315
+ this.barData = barData;
1316
+ this.boundingRect = boundingRect;
1317
+ this.xAxis = xAxis;
1318
+ this.yAxis = yAxis;
1319
+ this.orientation = orientation;
1320
+ this.plotIndex = plotIndex2;
1321
+ }
1322
+ static {
1323
+ __name(this, "BarPlot");
1324
+ }
1325
+ getDrawableElement() {
1326
+ const finalData = this.barData.data.map((d) => [
1327
+ this.xAxis.getScaleValue(d[0]),
1328
+ this.yAxis.getScaleValue(d[1])
1329
+ ]);
1330
+ const barPaddingPercent = 0.05;
1331
+ const barWidth = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - barPaddingPercent);
1332
+ const barWidthHalf = barWidth / 2;
1333
+ if (this.orientation === "horizontal") {
1334
+ return [
1335
+ {
1336
+ groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
1337
+ type: "rect",
1338
+ data: finalData.map((data) => ({
1339
+ x: this.boundingRect.x,
1340
+ y: data[0] - barWidthHalf,
1341
+ height: barWidth,
1342
+ width: data[1] - this.boundingRect.x,
1343
+ fill: this.barData.fill,
1344
+ strokeWidth: 0,
1345
+ strokeFill: this.barData.fill
1346
+ }))
1347
+ }
1348
+ ];
1349
+ }
1350
+ return [
1351
+ {
1352
+ groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
1353
+ type: "rect",
1354
+ data: finalData.map((data) => ({
1355
+ x: data[0] - barWidthHalf,
1356
+ y: data[1],
1357
+ width: barWidth,
1358
+ height: this.boundingRect.y + this.boundingRect.height - data[1],
1359
+ fill: this.barData.fill,
1360
+ strokeWidth: 0,
1361
+ strokeFill: this.barData.fill
1362
+ }))
1363
+ }
1364
+ ];
1365
+ }
1366
+ };
1367
+ var BasePlot = class {
1368
+ constructor(chartConfig, chartData, chartThemeConfig) {
1369
+ this.chartConfig = chartConfig;
1370
+ this.chartData = chartData;
1371
+ this.chartThemeConfig = chartThemeConfig;
1372
+ this.boundingRect = {
1373
+ x: 0,
1374
+ y: 0,
1375
+ width: 0,
1376
+ height: 0
1377
+ };
1378
+ }
1379
+ static {
1380
+ __name(this, "BasePlot");
1381
+ }
1382
+ setAxes(xAxis, yAxis) {
1383
+ this.xAxis = xAxis;
1384
+ this.yAxis = yAxis;
1385
+ }
1386
+ setBoundingBoxXY(point) {
1387
+ this.boundingRect.x = point.x;
1388
+ this.boundingRect.y = point.y;
1389
+ }
1390
+ calculateSpace(availableSpace) {
1391
+ this.boundingRect.width = availableSpace.width;
1392
+ this.boundingRect.height = availableSpace.height;
1393
+ return {
1394
+ width: this.boundingRect.width,
1395
+ height: this.boundingRect.height
1396
+ };
1397
+ }
1398
+ getDrawableElements() {
1399
+ if (!(this.xAxis && this.yAxis)) {
1400
+ throw Error("Axes must be passed to render Plots");
1401
+ }
1402
+ const drawableElem = [];
1403
+ for (const [i, plot] of this.chartData.plots.entries()) {
1404
+ switch (plot.type) {
1405
+ case "line":
1406
+ {
1407
+ const linePlot = new LinePlot(
1408
+ plot,
1409
+ this.xAxis,
1410
+ this.yAxis,
1411
+ this.chartConfig.chartOrientation,
1412
+ i
1413
+ );
1414
+ drawableElem.push(...linePlot.getDrawableElement());
1415
+ }
1416
+ break;
1417
+ case "bar":
1418
+ {
1419
+ const barPlot = new BarPlot(
1420
+ plot,
1421
+ this.boundingRect,
1422
+ this.xAxis,
1423
+ this.yAxis,
1424
+ this.chartConfig.chartOrientation,
1425
+ i
1426
+ );
1427
+ drawableElem.push(...barPlot.getDrawableElement());
1428
+ }
1429
+ break;
1430
+ }
1431
+ }
1432
+ return drawableElem;
1433
+ }
1434
+ };
1435
+ function getPlotComponent(chartConfig, chartData, chartThemeConfig) {
1436
+ return new BasePlot(chartConfig, chartData, chartThemeConfig);
1437
+ }
1438
+ __name(getPlotComponent, "getPlotComponent");
1439
+ var Orchestrator = class {
1440
+ constructor(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) {
1441
+ this.chartConfig = chartConfig;
1442
+ this.chartData = chartData;
1443
+ this.componentStore = {
1444
+ title: getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2),
1445
+ plot: getPlotComponent(chartConfig, chartData, chartThemeConfig),
1446
+ xAxis: getAxis(
1447
+ chartData.xAxis,
1448
+ chartConfig.xAxis,
1449
+ {
1450
+ titleColor: chartThemeConfig.xAxisTitleColor,
1451
+ labelColor: chartThemeConfig.xAxisLabelColor,
1452
+ tickColor: chartThemeConfig.xAxisTickColor,
1453
+ axisLineColor: chartThemeConfig.xAxisLineColor
1454
+ },
1455
+ tmpSVGGroup2
1456
+ ),
1457
+ yAxis: getAxis(
1458
+ chartData.yAxis,
1459
+ chartConfig.yAxis,
1460
+ {
1461
+ titleColor: chartThemeConfig.yAxisTitleColor,
1462
+ labelColor: chartThemeConfig.yAxisLabelColor,
1463
+ tickColor: chartThemeConfig.yAxisTickColor,
1464
+ axisLineColor: chartThemeConfig.yAxisLineColor
1465
+ },
1466
+ tmpSVGGroup2
1467
+ )
1468
+ };
1469
+ }
1470
+ static {
1471
+ __name(this, "Orchestrator");
1472
+ }
1473
+ calculateVerticalSpace() {
1474
+ let availableWidth = this.chartConfig.width;
1475
+ let availableHeight = this.chartConfig.height;
1476
+ let plotX = 0;
1477
+ let plotY = 0;
1478
+ let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100);
1479
+ let chartHeight = Math.floor(
1480
+ availableHeight * this.chartConfig.plotReservedSpacePercent / 100
1481
+ );
1482
+ let spaceUsed = this.componentStore.plot.calculateSpace({
1483
+ width: chartWidth,
1484
+ height: chartHeight
1485
+ });
1486
+ availableWidth -= spaceUsed.width;
1487
+ availableHeight -= spaceUsed.height;
1488
+ spaceUsed = this.componentStore.title.calculateSpace({
1489
+ width: this.chartConfig.width,
1490
+ height: availableHeight
1491
+ });
1492
+ plotY = spaceUsed.height;
1493
+ availableHeight -= spaceUsed.height;
1494
+ this.componentStore.xAxis.setAxisPosition("bottom");
1495
+ spaceUsed = this.componentStore.xAxis.calculateSpace({
1496
+ width: availableWidth,
1497
+ height: availableHeight
1498
+ });
1499
+ availableHeight -= spaceUsed.height;
1500
+ this.componentStore.yAxis.setAxisPosition("left");
1501
+ spaceUsed = this.componentStore.yAxis.calculateSpace({
1502
+ width: availableWidth,
1503
+ height: availableHeight
1504
+ });
1505
+ plotX = spaceUsed.width;
1506
+ availableWidth -= spaceUsed.width;
1507
+ if (availableWidth > 0) {
1508
+ chartWidth += availableWidth;
1509
+ availableWidth = 0;
1510
+ }
1511
+ if (availableHeight > 0) {
1512
+ chartHeight += availableHeight;
1513
+ availableHeight = 0;
1514
+ }
1515
+ this.componentStore.plot.calculateSpace({
1516
+ width: chartWidth,
1517
+ height: chartHeight
1518
+ });
1519
+ this.componentStore.plot.setBoundingBoxXY({ x: plotX, y: plotY });
1520
+ this.componentStore.xAxis.setRange([plotX, plotX + chartWidth]);
1521
+ this.componentStore.xAxis.setBoundingBoxXY({ x: plotX, y: plotY + chartHeight });
1522
+ this.componentStore.yAxis.setRange([plotY, plotY + chartHeight]);
1523
+ this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: plotY });
1524
+ if (this.chartData.plots.some((p) => isBarPlot(p))) {
1525
+ this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1526
+ }
1527
+ }
1528
+ calculateHorizontalSpace() {
1529
+ let availableWidth = this.chartConfig.width;
1530
+ let availableHeight = this.chartConfig.height;
1531
+ let titleYEnd = 0;
1532
+ let plotX = 0;
1533
+ let plotY = 0;
1534
+ let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100);
1535
+ let chartHeight = Math.floor(
1536
+ availableHeight * this.chartConfig.plotReservedSpacePercent / 100
1537
+ );
1538
+ let spaceUsed = this.componentStore.plot.calculateSpace({
1539
+ width: chartWidth,
1540
+ height: chartHeight
1541
+ });
1542
+ availableWidth -= spaceUsed.width;
1543
+ availableHeight -= spaceUsed.height;
1544
+ spaceUsed = this.componentStore.title.calculateSpace({
1545
+ width: this.chartConfig.width,
1546
+ height: availableHeight
1547
+ });
1548
+ titleYEnd = spaceUsed.height;
1549
+ availableHeight -= spaceUsed.height;
1550
+ this.componentStore.xAxis.setAxisPosition("left");
1551
+ spaceUsed = this.componentStore.xAxis.calculateSpace({
1552
+ width: availableWidth,
1553
+ height: availableHeight
1554
+ });
1555
+ availableWidth -= spaceUsed.width;
1556
+ plotX = spaceUsed.width;
1557
+ this.componentStore.yAxis.setAxisPosition("top");
1558
+ spaceUsed = this.componentStore.yAxis.calculateSpace({
1559
+ width: availableWidth,
1560
+ height: availableHeight
1561
+ });
1562
+ availableHeight -= spaceUsed.height;
1563
+ plotY = titleYEnd + spaceUsed.height;
1564
+ if (availableWidth > 0) {
1565
+ chartWidth += availableWidth;
1566
+ availableWidth = 0;
1567
+ }
1568
+ if (availableHeight > 0) {
1569
+ chartHeight += availableHeight;
1570
+ availableHeight = 0;
1571
+ }
1572
+ this.componentStore.plot.calculateSpace({
1573
+ width: chartWidth,
1574
+ height: chartHeight
1575
+ });
1576
+ this.componentStore.plot.setBoundingBoxXY({ x: plotX, y: plotY });
1577
+ this.componentStore.yAxis.setRange([plotX, plotX + chartWidth]);
1578
+ this.componentStore.yAxis.setBoundingBoxXY({ x: plotX, y: titleYEnd });
1579
+ this.componentStore.xAxis.setRange([plotY, plotY + chartHeight]);
1580
+ this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: plotY });
1581
+ if (this.chartData.plots.some((p) => isBarPlot(p))) {
1582
+ this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1583
+ }
1584
+ }
1585
+ calculateSpace() {
1586
+ if (this.chartConfig.chartOrientation === "horizontal") {
1587
+ this.calculateHorizontalSpace();
1588
+ } else {
1589
+ this.calculateVerticalSpace();
1590
+ }
1591
+ }
1592
+ getDrawableElement() {
1593
+ this.calculateSpace();
1594
+ const drawableElem = [];
1595
+ this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis);
1596
+ for (const component of Object.values(this.componentStore)) {
1597
+ drawableElem.push(...component.getDrawableElements());
1598
+ }
1599
+ return drawableElem;
1600
+ }
1601
+ };
1602
+ var XYChartBuilder = class {
1603
+ static {
1604
+ __name(this, "XYChartBuilder");
1605
+ }
1606
+ static build(config, chartData, chartThemeConfig, tmpSVGGroup2) {
1607
+ const orchestrator = new Orchestrator(config, chartData, chartThemeConfig, tmpSVGGroup2);
1608
+ return orchestrator.getDrawableElement();
1609
+ }
1610
+ };
1611
+ var plotIndex = 0;
1612
+ var tmpSVGGroup;
1613
+ var xyChartConfig = getChartDefaultConfig();
1614
+ var xyChartThemeConfig = getChartDefaultThemeConfig();
1615
+ var xyChartData = getChartDefaultData();
1616
+ var plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color) => color.trim());
1617
+ var hasSetXAxis = false;
1618
+ var hasSetYAxis = false;
1619
+ function getChartDefaultThemeConfig() {
1620
+ const defaultThemeVariables = getThemeVariables3();
1621
+ const config = getConfig();
1622
+ return cleanAndMerge(defaultThemeVariables.xyChart, config.themeVariables.xyChart);
1623
+ }
1624
+ __name(getChartDefaultThemeConfig, "getChartDefaultThemeConfig");
1625
+ function getChartDefaultConfig() {
1626
+ const config = getConfig();
1627
+ return cleanAndMerge(
1628
+ defaultConfig_default.xyChart,
1629
+ config.xyChart
1630
+ );
1631
+ }
1632
+ __name(getChartDefaultConfig, "getChartDefaultConfig");
1633
+ function getChartDefaultData() {
1634
+ return {
1635
+ yAxis: {
1636
+ type: "linear",
1637
+ title: "",
1638
+ min: Infinity,
1639
+ max: -Infinity
1640
+ },
1641
+ xAxis: {
1642
+ type: "band",
1643
+ title: "",
1644
+ categories: []
1645
+ },
1646
+ title: "",
1647
+ plots: []
1648
+ };
1649
+ }
1650
+ __name(getChartDefaultData, "getChartDefaultData");
1651
+ function textSanitizer(text) {
1652
+ const config = getConfig();
1653
+ return sanitizeText(text.trim(), config);
1654
+ }
1655
+ __name(textSanitizer, "textSanitizer");
1656
+ function setTmpSVGG(SVGG) {
1657
+ tmpSVGGroup = SVGG;
1658
+ }
1659
+ __name(setTmpSVGG, "setTmpSVGG");
1660
+ function setOrientation(orientation) {
1661
+ if (orientation === "horizontal") {
1662
+ xyChartConfig.chartOrientation = "horizontal";
1663
+ } else {
1664
+ xyChartConfig.chartOrientation = "vertical";
1665
+ }
1666
+ }
1667
+ __name(setOrientation, "setOrientation");
1668
+ function setXAxisTitle(title) {
1669
+ xyChartData.xAxis.title = textSanitizer(title.text);
1670
+ }
1671
+ __name(setXAxisTitle, "setXAxisTitle");
1672
+ function setXAxisRangeData(min, max) {
1673
+ xyChartData.xAxis = { type: "linear", title: xyChartData.xAxis.title, min, max };
1674
+ hasSetXAxis = true;
1675
+ }
1676
+ __name(setXAxisRangeData, "setXAxisRangeData");
1677
+ function setXAxisBand(categories) {
1678
+ xyChartData.xAxis = {
1679
+ type: "band",
1680
+ title: xyChartData.xAxis.title,
1681
+ categories: categories.map((c) => textSanitizer(c.text))
1682
+ };
1683
+ hasSetXAxis = true;
1684
+ }
1685
+ __name(setXAxisBand, "setXAxisBand");
1686
+ function setYAxisTitle(title) {
1687
+ xyChartData.yAxis.title = textSanitizer(title.text);
1688
+ }
1689
+ __name(setYAxisTitle, "setYAxisTitle");
1690
+ function setYAxisRangeData(min, max) {
1691
+ xyChartData.yAxis = { type: "linear", title: xyChartData.yAxis.title, min, max };
1692
+ hasSetYAxis = true;
1693
+ }
1694
+ __name(setYAxisRangeData, "setYAxisRangeData");
1695
+ function setYAxisRangeFromPlotData(data) {
1696
+ const minValue = Math.min(...data);
1697
+ const maxValue = Math.max(...data);
1698
+ const prevMinValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.min : Infinity;
1699
+ const prevMaxValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.max : -Infinity;
1700
+ xyChartData.yAxis = {
1701
+ type: "linear",
1702
+ title: xyChartData.yAxis.title,
1703
+ min: Math.min(prevMinValue, minValue),
1704
+ max: Math.max(prevMaxValue, maxValue)
1705
+ };
1706
+ }
1707
+ __name(setYAxisRangeFromPlotData, "setYAxisRangeFromPlotData");
1708
+ function transformDataWithoutCategory(data) {
1709
+ let retData = [];
1710
+ if (data.length === 0) {
1711
+ return retData;
1712
+ }
1713
+ if (!hasSetXAxis) {
1714
+ const prevMinValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.min : Infinity;
1715
+ const prevMaxValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.max : -Infinity;
1716
+ setXAxisRangeData(Math.min(prevMinValue, 1), Math.max(prevMaxValue, data.length));
1717
+ }
1718
+ if (!hasSetYAxis) {
1719
+ setYAxisRangeFromPlotData(data);
1720
+ }
1721
+ if (isBandAxisData(xyChartData.xAxis)) {
1722
+ retData = xyChartData.xAxis.categories.map((c, i) => [c, data[i]]);
1723
+ }
1724
+ if (isLinearAxisData(xyChartData.xAxis)) {
1725
+ const min = xyChartData.xAxis.min;
1726
+ const max = xyChartData.xAxis.max;
1727
+ const step = (max - min) / (data.length - 1);
1728
+ const categories = [];
1729
+ for (let i = min; i <= max; i += step) {
1730
+ categories.push(`${i}`);
1731
+ }
1732
+ retData = categories.map((c, i) => [c, data[i]]);
1733
+ }
1734
+ return retData;
1735
+ }
1736
+ __name(transformDataWithoutCategory, "transformDataWithoutCategory");
1737
+ function getPlotColorFromPalette(plotIndex2) {
1738
+ return plotColorPalette[plotIndex2 === 0 ? 0 : plotIndex2 % plotColorPalette.length];
1739
+ }
1740
+ __name(getPlotColorFromPalette, "getPlotColorFromPalette");
1741
+ function setLineData(title, data) {
1742
+ const plotData = transformDataWithoutCategory(data);
1743
+ xyChartData.plots.push({
1744
+ type: "line",
1745
+ strokeFill: getPlotColorFromPalette(plotIndex),
1746
+ strokeWidth: 2,
1747
+ data: plotData
1748
+ });
1749
+ plotIndex++;
1750
+ }
1751
+ __name(setLineData, "setLineData");
1752
+ function setBarData(title, data) {
1753
+ const plotData = transformDataWithoutCategory(data);
1754
+ xyChartData.plots.push({
1755
+ type: "bar",
1756
+ fill: getPlotColorFromPalette(plotIndex),
1757
+ data: plotData
1758
+ });
1759
+ plotIndex++;
1760
+ }
1761
+ __name(setBarData, "setBarData");
1762
+ function getDrawableElem() {
1763
+ if (xyChartData.plots.length === 0) {
1764
+ throw Error("No Plot to render, please provide a plot with some data");
1765
+ }
1766
+ xyChartData.title = getDiagramTitle();
1767
+ return XYChartBuilder.build(xyChartConfig, xyChartData, xyChartThemeConfig, tmpSVGGroup);
1768
+ }
1769
+ __name(getDrawableElem, "getDrawableElem");
1770
+ function getChartThemeConfig() {
1771
+ return xyChartThemeConfig;
1772
+ }
1773
+ __name(getChartThemeConfig, "getChartThemeConfig");
1774
+ function getChartConfig() {
1775
+ return xyChartConfig;
1776
+ }
1777
+ __name(getChartConfig, "getChartConfig");
1778
+ function getXYChartData() {
1779
+ return xyChartData;
1780
+ }
1781
+ __name(getXYChartData, "getXYChartData");
1782
+ var clear2 = /* @__PURE__ */ __name(function() {
1783
+ clear();
1784
+ plotIndex = 0;
1785
+ xyChartConfig = getChartDefaultConfig();
1786
+ xyChartData = getChartDefaultData();
1787
+ xyChartThemeConfig = getChartDefaultThemeConfig();
1788
+ plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color) => color.trim());
1789
+ hasSetXAxis = false;
1790
+ hasSetYAxis = false;
1791
+ }, "clear");
1792
+ var xychartDb_default = {
1793
+ getDrawableElem,
1794
+ clear: clear2,
1795
+ setAccTitle,
1796
+ getAccTitle,
1797
+ setDiagramTitle,
1798
+ getDiagramTitle,
1799
+ getAccDescription,
1800
+ setAccDescription,
1801
+ setOrientation,
1802
+ setXAxisTitle,
1803
+ setXAxisRangeData,
1804
+ setXAxisBand,
1805
+ setYAxisTitle,
1806
+ setYAxisRangeData,
1807
+ setLineData,
1808
+ setBarData,
1809
+ setTmpSVGG,
1810
+ getChartThemeConfig,
1811
+ getChartConfig,
1812
+ getXYChartData
1813
+ };
1814
+ var draw = /* @__PURE__ */ __name((txt, id, _version, diagObj) => {
1815
+ const db = diagObj.db;
1816
+ const themeConfig = db.getChartThemeConfig();
1817
+ const chartConfig = db.getChartConfig();
1818
+ const labelData = db.getXYChartData().plots[0].data.map((data) => data[1]);
1819
+ function getDominantBaseLine(horizontalPos) {
1820
+ return horizontalPos === "top" ? "text-before-edge" : "middle";
1821
+ }
1822
+ __name(getDominantBaseLine, "getDominantBaseLine");
1823
+ function getTextAnchor(verticalPos) {
1824
+ return verticalPos === "left" ? "start" : verticalPos === "right" ? "end" : "middle";
1825
+ }
1826
+ __name(getTextAnchor, "getTextAnchor");
1827
+ function getTextTransformation(data) {
1828
+ return `translate(${data.x}, ${data.y}) rotate(${data.rotation || 0})`;
1829
+ }
1830
+ __name(getTextTransformation, "getTextTransformation");
1831
+ log.debug("Rendering xychart chart\n" + txt);
1832
+ const svg = selectSvgElement(id);
1833
+ const group = svg.append("g").attr("class", "main");
1834
+ const background = group.append("rect").attr("width", chartConfig.width).attr("height", chartConfig.height).attr("class", "background");
1835
+ configureSvgSize(svg, chartConfig.height, chartConfig.width, true);
1836
+ svg.attr("viewBox", `0 0 ${chartConfig.width} ${chartConfig.height}`);
1837
+ background.attr("fill", themeConfig.backgroundColor);
1838
+ db.setTmpSVGG(svg.append("g").attr("class", "mermaid-tmp-group"));
1839
+ const shapes = db.getDrawableElem();
1840
+ const groups = {};
1841
+ function getGroup(gList) {
1842
+ let elem = group;
1843
+ let prefix = "";
1844
+ for (const [i] of gList.entries()) {
1845
+ let parent = group;
1846
+ if (i > 0 && groups[prefix]) {
1847
+ parent = groups[prefix];
1848
+ }
1849
+ prefix += gList[i];
1850
+ elem = groups[prefix];
1851
+ if (!elem) {
1852
+ elem = groups[prefix] = parent.append("g").attr("class", gList[i]);
1853
+ }
1854
+ }
1855
+ return elem;
1856
+ }
1857
+ __name(getGroup, "getGroup");
1858
+ for (const shape of shapes) {
1859
+ if (shape.data.length === 0) {
1860
+ continue;
1861
+ }
1862
+ const shapeGroup = getGroup(shape.groupTexts);
1863
+ switch (shape.type) {
1864
+ case "rect":
1865
+ shapeGroup.selectAll("rect").data(shape.data).enter().append("rect").attr("x", (data) => data.x).attr("y", (data) => data.y).attr("width", (data) => data.width).attr("height", (data) => data.height).attr("fill", (data) => data.fill).attr("stroke", (data) => data.strokeFill).attr("stroke-width", (data) => data.strokeWidth);
1866
+ if (chartConfig.showDataLabel) {
1867
+ const showDataLabelOutsideBar = chartConfig.showDataLabelOutsideBar;
1868
+ if (chartConfig.chartOrientation === "horizontal") {
1869
+ let fitsHorizontally2 = function(item, fontSize) {
1870
+ const { data, label } = item;
1871
+ const textWidth = fontSize * label.length * charWidthFactor;
1872
+ return textWidth <= data.width - rightMargin;
1873
+ };
1874
+ var fitsHorizontally = fitsHorizontally2;
1875
+ __name(fitsHorizontally2, "fitsHorizontally");
1876
+ const charWidthFactor = 0.7;
1877
+ const rightMargin = 10;
1878
+ const validItems = shape.data.map((d, i) => ({ data: d, label: labelData[i].toString() })).filter((item) => item.data.width > 0 && item.data.height > 0);
1879
+ const candidateFontSizes = validItems.map((item) => {
1880
+ const { data } = item;
1881
+ let fontSize = data.height * 0.7;
1882
+ while (!fitsHorizontally2(item, fontSize) && fontSize > 0) {
1883
+ fontSize -= 1;
1884
+ }
1885
+ return fontSize;
1886
+ });
1887
+ const uniformFontSize = Math.floor(Math.min(...candidateFontSizes));
1888
+ const determineLabelXPosition = /* @__PURE__ */ __name((item) => {
1889
+ if (showDataLabelOutsideBar) {
1890
+ return item.data.x + item.data.width + rightMargin;
1891
+ } else {
1892
+ return item.data.x + item.data.width - rightMargin;
1893
+ }
1894
+ }, "determineLabelXPosition");
1895
+ shapeGroup.selectAll("text").data(validItems).enter().append("text").attr("x", determineLabelXPosition).attr("y", (item) => item.data.y + item.data.height / 2).attr("text-anchor", showDataLabelOutsideBar ? "start" : "end").attr("dominant-baseline", "middle").attr("fill", themeConfig.dataLabelColor).attr("font-size", `${uniformFontSize}px`).text((item) => item.label);
1896
+ } else {
1897
+ let fitsInBar2 = function(item, fontSize, yOffset2) {
1898
+ const { data, label } = item;
1899
+ const charWidthFactor = 0.7;
1900
+ const textWidth = fontSize * label.length * charWidthFactor;
1901
+ const centerX = data.x + data.width / 2;
1902
+ const leftEdge = centerX - textWidth / 2;
1903
+ const rightEdge = centerX + textWidth / 2;
1904
+ const horizontalFits = leftEdge >= data.x && rightEdge <= data.x + data.width;
1905
+ const verticalFits = data.y + yOffset2 + fontSize <= data.y + data.height;
1906
+ return horizontalFits && verticalFits;
1907
+ };
1908
+ var fitsInBar = fitsInBar2;
1909
+ __name(fitsInBar2, "fitsInBar");
1910
+ const yOffset = 10;
1911
+ const validItems = shape.data.map((d, i) => ({ data: d, label: labelData[i].toString() })).filter((item) => item.data.width > 0 && item.data.height > 0);
1912
+ const candidateFontSizes = validItems.map((item) => {
1913
+ const { data, label } = item;
1914
+ let fontSize = data.width / (label.length * 0.7);
1915
+ while (!fitsInBar2(item, fontSize, yOffset) && fontSize > 0) {
1916
+ fontSize -= 1;
1917
+ }
1918
+ return fontSize;
1919
+ });
1920
+ const uniformFontSize = Math.floor(Math.min(...candidateFontSizes));
1921
+ const determineLabelYPosition = /* @__PURE__ */ __name((item) => {
1922
+ if (showDataLabelOutsideBar) {
1923
+ return item.data.y - yOffset;
1924
+ } else {
1925
+ return item.data.y + yOffset;
1926
+ }
1927
+ }, "determineLabelYPosition");
1928
+ shapeGroup.selectAll("text").data(validItems).enter().append("text").attr("x", (item) => item.data.x + item.data.width / 2).attr("y", determineLabelYPosition).attr("text-anchor", "middle").attr("dominant-baseline", showDataLabelOutsideBar ? "auto" : "hanging").attr("fill", themeConfig.dataLabelColor).attr("font-size", `${uniformFontSize}px`).text((item) => item.label);
1929
+ }
1930
+ }
1931
+ break;
1932
+ case "text":
1933
+ shapeGroup.selectAll("text").data(shape.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (data) => data.fill).attr("font-size", (data) => data.fontSize).attr("dominant-baseline", (data) => getDominantBaseLine(data.verticalPos)).attr("text-anchor", (data) => getTextAnchor(data.horizontalPos)).attr("transform", (data) => getTextTransformation(data)).text((data) => data.text);
1934
+ break;
1935
+ case "path":
1936
+ shapeGroup.selectAll("path").data(shape.data).enter().append("path").attr("d", (data) => data.path).attr("fill", (data) => data.fill ? data.fill : "none").attr("stroke", (data) => data.strokeFill).attr("stroke-width", (data) => data.strokeWidth);
1937
+ break;
1938
+ }
1939
+ }
1940
+ }, "draw");
1941
+ var xychartRenderer_default = {
1942
+ draw
1943
+ };
1944
+ var diagram = {
1945
+ parser: xychart_default,
1946
+ db: xychartDb_default,
1947
+ renderer: xychartRenderer_default
1948
+ };
1949
+ export {
1950
+ diagram
1951
+ };
1952
+ //# sourceMappingURL=xychartDiagram-5P7HB3ND-SSMUQEXK.js.map