@kabmo-labs/kabmo 0.34.0 → 0.35.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 (205) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +1 -1
  3. package/dist/client/static/js/{CsvGrid-vze4m5ag.js → CsvGrid-0amzgtd7.js} +2 -2
  4. package/dist/client/static/js/{DocxView-jbf21gmh.js → DocxView-bxjhzxe9.js} +3 -3
  5. package/dist/client/static/js/{DrawioView-b52qybx5.js → DrawioView-7s1yqsf4.js} +2 -2
  6. package/dist/client/static/js/{ImageView-mdgzj8px.js → ImageView-ycfbn66h.js} +1 -1
  7. package/dist/client/static/js/{LayoutWrapper-3c49dvtt.js → LayoutWrapper-tw1q1x0g.js} +2 -2
  8. package/dist/client/static/js/{Modal-sqp864vd.js → Modal-wqjactyd.js} +16 -16
  9. package/dist/client/static/js/{PdfView-g06rxqb1.js → PdfView-x6dmtwvr.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-521adxyr.js → SessionsView-t85wq0me.js} +1 -1
  11. package/dist/client/static/js/{SheetView-h8xmsz7q.js → SheetView-n52nvz8s.js} +13 -13
  12. package/dist/client/static/js/{SvgPreview-1j4jvcvz.js → SvgPreview-59z7syme.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-pasxh4b6.js → abnfDiagram-O67JEVCF-91gnt049.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-bajpnvy7.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-ms14g0bm.js → architectureDiagram-NJMV4G6O-5b9qtff2.js} +3 -3
  16. package/dist/client/static/js/{astro-80bs6hvg.js → astro-31cbyw7b.js} +1 -1
  17. package/dist/client/static/js/bash-0h36tk0k.js +1 -0
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-ycn78fcq.js → blockDiagram-BEXU5L5S-6f23fjkn.js} +3 -3
  19. package/dist/client/static/js/{c4Diagram-YGBWAQC7-vn2gpjfm.js → c4Diagram-YGBWAQC7-76t6d3am.js} +2 -2
  20. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-fyrm1pr5.js → classDiagram-v2-NBCMYWYE-f9tb19xm.js} +3 -3
  21. package/dist/client/static/js/{cose-bilkent-JH36ORCC-ea5nwvgq.js → cose-bilkent-JH36ORCC-t6nwrbwj.js} +1 -1
  22. package/dist/client/static/js/cpp-4wp9sy20.js +1 -0
  23. package/dist/client/static/js/css-c9nsbkh6.js +1 -0
  24. package/dist/client/static/js/cynefin-OW5HDTMX-8q9e90m8.js +1 -0
  25. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-j6bsjpre.js → cynefinDiagram-VND7K2PF-69gc244j.js} +1 -1
  26. package/dist/client/static/js/{dagre-6A5THRUB-4smdkwv8.js → dagre-6A5THRUB-54bry3ey.js} +2 -2
  27. package/dist/client/static/js/{diagram-22UHCM2B-9sm4kqwc.js → diagram-22UHCM2B-gfkebye6.js} +5 -5
  28. package/dist/client/static/js/{diagram-3UASUU5V-2h3qxaed.js → diagram-3UASUU5V-a1mr319f.js} +1 -1
  29. package/dist/client/static/js/{diagram-ATOU4E4O-1981bc94.js → diagram-ATOU4E4O-tkyk0qbe.js} +3 -3
  30. package/dist/client/static/js/{diagram-CDSNMT55-3vgsxavc.js → diagram-CDSNMT55-np0hc9m2.js} +2 -2
  31. package/dist/client/static/js/{diagram-MLGK6HIB-c9gf2r3f.js → diagram-MLGK6HIB-nh06fshp.js} +1 -1
  32. package/dist/client/static/js/{diagram-MPIPVDR6-gjqeq92d.js → diagram-MPIPVDR6-27q2veks.js} +1 -1
  33. package/dist/client/static/js/{dockerfile-8v935dkn.js → dockerfile-4rtt6c0f.js} +1 -1
  34. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-4vbsgh99.js → ebnfDiagram-ZINNZB2B-x9p9jqe8.js} +1 -1
  35. package/dist/client/static/js/{elixir-vcbg60wv.js → elixir-rpa1g4gy.js} +1 -1
  36. package/dist/client/static/js/{elk-276RUBZZ-nca3t891.js → elk-276RUBZZ-fw7waks3.js} +1 -1
  37. package/dist/client/static/js/{erDiagram-OPXOYQCR-5kfkev03.js → erDiagram-OPXOYQCR-fdfgzr5d.js} +5 -5
  38. package/dist/client/static/js/{erlang-qt876zrq.js → erlang-trjm07as.js} +1 -1
  39. package/dist/client/static/js/eventmodeling-NTZA5JFV-kn4hsm3p.js +1 -0
  40. package/dist/client/static/js/flowDiagram-KWPJA3E3-ah8cvps1.js +1 -0
  41. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-mxc73wmq.js → ganttDiagram-FUAMR5RP-2avbqgdr.js} +2 -2
  42. package/dist/client/static/js/gitGraph-4MIJSDKK-hvavh16n.js +1 -0
  43. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-7en3ag0e.js → gitGraphDiagram-X574FWY7-9jmc0a3g.js} +2 -2
  44. package/dist/client/static/js/graphql-hbkmxsty.js +1 -0
  45. package/dist/client/static/js/html-pv88ny12.js +1 -0
  46. package/dist/client/static/js/{index-4g46wbdw.js → index-0v34a7wf.js} +1 -1
  47. package/dist/client/static/js/{index-vtbbfwx0.js → index-1wjp16f0.js} +2 -2
  48. package/dist/client/static/js/{index-7a64yjrm.js → index-2v1nmxwr.js} +5 -5
  49. package/dist/client/static/js/{index-rs80cwsv.js → index-3ecsp1rx.js} +3 -3
  50. package/dist/client/static/js/{index-1y9r4frb.js → index-43qpbxjv.js} +2 -2
  51. package/dist/client/static/js/{index-ag2rmtas.js → index-4vybd9e7.js} +1 -1
  52. package/dist/client/static/js/{index-ahv9y42z.js → index-6f6cmcbq.js} +2 -2
  53. package/dist/client/static/js/{index-vy6termr.js → index-7ct7qrsp.js} +2 -2
  54. package/dist/client/static/js/{index-fvmfge3p.js → index-7q02xnvq.js} +1 -1
  55. package/dist/client/static/js/{index-rytaa8ca.js → index-7smwzkvq.js} +2 -2
  56. package/dist/client/static/js/{index-nccwxv0s.js → index-8f9x7ev8.js} +1 -1
  57. package/dist/client/static/js/{index-7y6rpsrp.js → index-8mwragbj.js} +2 -2
  58. package/dist/client/static/js/{index-52rqxgya.js → index-8x9ecxb0.js} +1 -1
  59. package/dist/client/static/js/{index-ptcrwswj.js → index-9ketbkh6.js} +1 -1
  60. package/dist/client/static/js/{index-s7gkkkyz.js → index-a293pdg7.js} +2 -2
  61. package/dist/client/static/js/{index-vhqe0y82.js → index-a628fg4m.js} +2 -2
  62. package/dist/client/static/js/{index-c3ek61zv.js → index-a8ffattk.js} +2 -2
  63. package/dist/client/static/js/{index-a0fmsv1d.js → index-b8s3xraa.js} +6 -6
  64. package/dist/client/static/js/index-btr2w8cq.js +12 -0
  65. package/dist/client/static/js/index-dfzrpy54.js +2 -0
  66. package/dist/client/static/js/{index-g2dyfze9.js → index-ee2p07eg.js} +1 -1
  67. package/dist/client/static/js/{index-ybm2x4vh.js → index-ek2e773p.js} +1 -1
  68. package/dist/client/static/js/{index-4qwzxj81.js → index-fvc0x6nx.js} +3 -3
  69. package/dist/client/static/js/{index-3zc1b0dv.js → index-jc1yagmk.js} +2 -2
  70. package/dist/client/static/js/{index-p0nz38bm.js → index-jmxqefe3.js} +1 -1
  71. package/dist/client/static/js/{index-1ksg88qf.js → index-k7q01ye4.js} +2 -2
  72. package/dist/client/static/js/{index-r014brzs.js → index-kdkfyrja.js} +2 -2
  73. package/dist/client/static/js/{index-0vm41je9.js → index-mc4nefs7.js} +1 -1
  74. package/dist/client/static/js/{index-j51d5a5m.js → index-nb8tp4mj.js} +30 -30
  75. package/dist/client/static/js/{index-cgzrpvzj.js → index-ncrenheb.js} +172 -172
  76. package/dist/client/static/js/{index-f7jhhqtk.js → index-p16scjt7.js} +2 -2
  77. package/dist/client/static/js/{index-pm6xxwz1.js → index-pc6eg8h2.js} +2 -2
  78. package/dist/client/static/js/{index-zvfvqvn9.js → index-pnt0vc59.js} +2 -2
  79. package/dist/client/static/js/{index-jsyekbx9.js → index-py2k8std.js} +2 -2
  80. package/dist/client/static/js/{index-dbe6afkf.js → index-pzbssnsc.js} +2 -2
  81. package/dist/client/static/js/{index-qckv9nte.js → index-qqz6bcdd.js} +2 -2
  82. package/dist/client/static/js/{index-xx6mqpxm.js → index-rbgemjsp.js} +3 -3
  83. package/dist/client/static/js/{index-rzxcj7cg.js → index-rkn0bxxt.js} +1 -1
  84. package/dist/client/static/js/{index-76zb4m0n.js → index-rv89xpaf.js} +2 -2
  85. package/dist/client/static/js/index-sbd5e816.js +1 -0
  86. package/dist/client/static/js/{index-1b0t1428.js → index-sdby39w4.js} +3 -3
  87. package/dist/client/static/js/{index-ev3yt353.js → index-t6c0pd43.js} +2 -2
  88. package/dist/client/static/js/{index-km2zb6wk.js → index-tp7yb3bv.js} +2 -2
  89. package/dist/client/static/js/{index-fta1y9pc.js → index-vnw3hbeg.js} +27 -27
  90. package/dist/client/static/js/{index-354mqqra.js → index-vq6wts05.js} +2 -2
  91. package/dist/client/static/js/{index-ptcwae2n.js → index-w5373tg1.js} +2 -2
  92. package/dist/client/static/js/{index-cd65zqba.js → index-w7tpgt46.js} +1 -1
  93. package/dist/client/static/js/{index-b29afsjh.js → index-whbtxmwh.js} +2 -2
  94. package/dist/client/static/js/{index-2svnq5gg.js → index-xs1m0bpt.js} +1 -1
  95. package/dist/client/static/js/{index-eyfcm0cy.js → index-xxtsm2rb.js} +2 -2
  96. package/dist/client/static/js/{index-hf52f59k.js → index-y3ms153k.js} +2 -2
  97. package/dist/client/static/js/{index-sd66wv26.js → index-yq39qbs1.js} +2 -2
  98. package/dist/client/static/js/{index-j0r5hj0j.js → index-zh2jj56s.js} +2 -2
  99. package/dist/client/static/js/info-A6RAGUB7-fmjz8qwg.js +1 -0
  100. package/dist/client/static/js/{infoDiagram-VRGFBTTK-sef80132.js → infoDiagram-VRGFBTTK-g2dky5xg.js} +1 -1
  101. package/dist/client/static/js/ini-72yrpvd4.js +1 -0
  102. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-yhvepp1q.js → ishikawaDiagram-OU5B5YK6-exrcjwp1.js} +2 -2
  103. package/dist/client/static/js/java-ab5tb2ra.js +1 -0
  104. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-5w77y95w.js → journeyDiagram-ZHPQQLJL-pn752qa5.js} +3 -3
  105. package/dist/client/static/js/jsx-25zj9j3k.js +1 -0
  106. package/dist/client/static/js/{julia-d4j6wgvf.js → julia-evn99h2m.js} +1 -1
  107. package/dist/client/static/js/{kanban-definition-PNTS6WVX-02znqtna.js → kanban-definition-PNTS6WVX-v8nvr373.js} +2 -2
  108. package/dist/client/static/js/lua-j5w0c9wm.js +1 -0
  109. package/dist/client/static/js/markdown-j6hn4377.js +1 -0
  110. package/dist/client/static/js/{mermaid.core-a6e6vck4.js → mermaid.core-egzv89zv.js} +6 -6
  111. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-y4n74q9x.js → mindmap-definition-NLK3R4M7-t9njmv2w.js} +2 -2
  112. package/dist/client/static/js/one-dark-pro-bm3r4js7.js +1 -0
  113. package/dist/client/static/js/one-light-e07dt7sy.js +1 -0
  114. package/dist/client/static/js/packet-AYTQ26CC-cwr6n1cm.js +1 -0
  115. package/dist/client/static/js/{pegDiagram-GJSIUBJH-pr7ehgzb.js → pegDiagram-GJSIUBJH-zhycy2b7.js} +1 -1
  116. package/dist/client/static/js/{perl-srptw5vm.js → perl-506fy8m8.js} +1 -1
  117. package/dist/client/static/js/{php-n89g3fk7.js → php-axtsvxck.js} +1 -1
  118. package/dist/client/static/js/pie-WAS4IAKB-h1ebfzgt.js +1 -0
  119. package/dist/client/static/js/{pieDiagram-5QR66LMP-39wpsk08.js → pieDiagram-5QR66LMP-sgctvma2.js} +2 -2
  120. package/dist/client/static/js/properties-q8njes42.js +1 -0
  121. package/dist/client/static/js/python-vqxc7181.js +1 -0
  122. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-esm913km.js → quadrantDiagram-O4NWA36T-kzzhdcph.js} +1 -1
  123. package/dist/client/static/js/r-0k5eej8m.js +1 -0
  124. package/dist/client/static/js/radar-RG4KPBEZ-k7p1m364.js +1 -0
  125. package/dist/client/static/js/railroad-74A4TZTK-d08dw3t0.js +1 -0
  126. package/dist/client/static/js/railroad-abnf-HS5TGJTU-txnjycgk.js +1 -0
  127. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-p0r3cv6w.js +1 -0
  128. package/dist/client/static/js/railroad-peg-WCYAUIDC-sryk900a.js +1 -0
  129. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-wy2mgya6.js → railroadDiagram-XR7U4H2S-nzjffwxm.js} +1 -1
  130. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-6z9xdgbq.js → requirementDiagram-PLB6GJNP-tz4xxn4d.js} +1 -1
  131. package/dist/client/static/js/{ruby-r81ytgcm.js → ruby-qp7zfk2m.js} +1 -1
  132. package/dist/client/static/js/{rust-frn3szvc.js → rust-fz913fvw.js} +1 -1
  133. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-rtmxk3ys.js → sankeyDiagram-IPEJSGJF-2wcb0xr6.js} +2 -2
  134. package/dist/client/static/js/{sass-9bxped7y.js → sass-gnk9vsyp.js} +1 -1
  135. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-awzcrafg.js → sequenceDiagram-PO4LG4MO-vqgebfns.js} +5 -5
  136. package/dist/client/static/js/{sizeCapture-INFHLROL-03gy196j.js → sizeCapture-INFHLROL-xc314tes.js} +1 -1
  137. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-an8v3q5n.js → stateDiagram-v2-GCMORJYK-8bd9b1h8.js} +2 -2
  138. package/dist/client/static/js/{svelte-mwtx07d9.js → svelte-brpgzrtv.js} +1 -1
  139. package/dist/client/static/js/{swimlanes-2SLR337P-n9yb4wcs.js → swimlanes-2SLR337P-t6hbdzcw.js} +1 -1
  140. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-c1czc7kv.js +8 -0
  141. package/dist/client/static/js/{timeline-definition-EJHVYXUP-jceb575g.js → timeline-definition-EJHVYXUP-2txxasx5.js} +2 -2
  142. package/dist/client/static/js/treeView-Q6P3EWNA-77kj68p1.js +1 -0
  143. package/dist/client/static/js/treemap-WGGIJYW6-rw94xc82.js +1 -0
  144. package/dist/client/static/js/tsx-yd5wt250.js +1 -0
  145. package/dist/client/static/js/typescript-v7z7crfe.js +1 -0
  146. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-888h3100.js → usecaseDiagram-POWQR4AR-3x353hn4.js} +5 -5
  147. package/dist/client/static/js/{vennDiagram-UO4OBE2U-wbfz0rzv.js → vennDiagram-UO4OBE2U-cerpss8e.js} +1 -1
  148. package/dist/client/static/js/{vue-c0rtg1wf.js → vue-apnkw9qy.js} +1 -1
  149. package/dist/client/static/js/wardley-WFR3VGLG-18xe4fhz.js +1 -0
  150. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-rn8c5qf9.js → wardleyDiagram-VNRHLVJA-cx6jfsbf.js} +1 -1
  151. package/dist/client/static/js/xml-94fhzrfs.js +1 -0
  152. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-8sn1apt6.js → xychartDiagram-PMCCYNJV-tgn23xj1.js} +2 -2
  153. package/dist/client/static/js/yaml-s8af9rnw.js +1 -0
  154. package/package.json +1 -1
  155. package/src/client/components/settings/categories/connect-settings/PairDialog.test.tsx +159 -0
  156. package/src/client/components/settings/categories/connect-settings/PairDialog.tsx +36 -7
  157. package/src/client/components/settings/categories/connect-settings/QrCode.tsx +2 -19
  158. package/src/client/components/settings/categories/connect-settings/qr-image.ts +76 -0
  159. package/src/client/components/workspace/git-panel/init-state.test.ts +5 -0
  160. package/src/client/hooks/chat/composer/speech-to-text.ts +24 -17
  161. package/src/client/hooks/editor/file-actions.ts +3 -11
  162. package/src/client/hooks/editor/font.test.ts +2 -1
  163. package/src/client/hooks/editor/use-file-transfer.ts +2 -1
  164. package/src/client/lib/browser/download.ts +22 -0
  165. package/src/shared/lib/dictation/capture-failure.test.ts +46 -0
  166. package/src/shared/lib/dictation/capture-failure.ts +36 -0
  167. package/dist/client/static/js/architecture-7GRP2DOG-fc9kmq1w.js +0 -1
  168. package/dist/client/static/js/bash-b3rwyg5p.js +0 -1
  169. package/dist/client/static/js/cpp-y0t6mynx.js +0 -1
  170. package/dist/client/static/js/css-6vj0d308.js +0 -1
  171. package/dist/client/static/js/cynefin-OW5HDTMX-a4t8992q.js +0 -1
  172. package/dist/client/static/js/eventmodeling-NTZA5JFV-18bdrkv5.js +0 -1
  173. package/dist/client/static/js/flowDiagram-KWPJA3E3-fg0yqx0h.js +0 -1
  174. package/dist/client/static/js/gitGraph-4MIJSDKK-8fa6y40p.js +0 -1
  175. package/dist/client/static/js/graphql-n43pd5fs.js +0 -1
  176. package/dist/client/static/js/html-dbrwss36.js +0 -1
  177. package/dist/client/static/js/index-231241f4.js +0 -12
  178. package/dist/client/static/js/index-6sf2vsp2.js +0 -1
  179. package/dist/client/static/js/index-h5bn97p6.js +0 -2
  180. package/dist/client/static/js/info-A6RAGUB7-3hk844f7.js +0 -1
  181. package/dist/client/static/js/ini-j5dyq6gm.js +0 -1
  182. package/dist/client/static/js/java-g4dgwbfd.js +0 -1
  183. package/dist/client/static/js/jsx-7t5ecz9s.js +0 -1
  184. package/dist/client/static/js/lua-1g6w30de.js +0 -1
  185. package/dist/client/static/js/markdown-afx21x8c.js +0 -1
  186. package/dist/client/static/js/one-dark-pro-vwhfpzr8.js +0 -1
  187. package/dist/client/static/js/one-light-y5t9x6zh.js +0 -1
  188. package/dist/client/static/js/packet-AYTQ26CC-4nj2yy10.js +0 -1
  189. package/dist/client/static/js/pie-WAS4IAKB-k7rde3f9.js +0 -1
  190. package/dist/client/static/js/properties-thd83wey.js +0 -1
  191. package/dist/client/static/js/python-264ns4xw.js +0 -1
  192. package/dist/client/static/js/r-qw82kkv9.js +0 -1
  193. package/dist/client/static/js/radar-RG4KPBEZ-513dpw4f.js +0 -1
  194. package/dist/client/static/js/railroad-74A4TZTK-9bqnst9c.js +0 -1
  195. package/dist/client/static/js/railroad-abnf-HS5TGJTU-7367d5bv.js +0 -1
  196. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-b806b1mj.js +0 -1
  197. package/dist/client/static/js/railroad-peg-WCYAUIDC-5a67rwf8.js +0 -1
  198. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-nx5nfnf0.js +0 -8
  199. package/dist/client/static/js/treeView-Q6P3EWNA-kcy40evb.js +0 -1
  200. package/dist/client/static/js/treemap-WGGIJYW6-fsrvqxf4.js +0 -1
  201. package/dist/client/static/js/tsx-nm94hed6.js +0 -1
  202. package/dist/client/static/js/typescript-0s2t05jj.js +0 -1
  203. package/dist/client/static/js/wardley-WFR3VGLG-36dmxww4.js +0 -1
  204. package/dist/client/static/js/xml-dz51p1m3.js +0 -1
  205. package/dist/client/static/js/yaml-2cfkd30t.js +0 -1
@@ -1,7 +1,7 @@
1
- import{t,l,Mt,K,E,X,te,R,L,z,O,U,j,G,ai,On,Cs,de,oe,Cf}from"./index-fta1y9pc.js";import{na}from"./index-jsyekbx9.js";function _t(e,i,s){e=+e,i=+i,s=(a=arguments.length)<2?(i=e,e=0,1):a<3?1:+s;var n=-1,a=Math.max(0,Math.ceil((i-e)/s))|0,h=Array(a);while(++n<a)h[n]=e+n*s;return h}function gt(){var e=On().unknown(void 0),{domain:i,range:s}=e,n=0,a=1,h,c,x=!1,f=0,S=0,D=0.5;delete e.unknown;function _(){var y=i().length,F=a<n,I=F?a:n,M=F?n:a;if(h=(M-I)/Math.max(1,y-f+S*2),x)h=Math.floor(h);if(I+=(M-I-h*(y-f))*D,c=h*(1-f),x)I=Math.round(I),c=Math.round(c);var W=_t(y).map(function(J){return I+h*J});return s(F?W.reverse():W)}return e.domain=function(y){return arguments.length?(i(y),_()):i()},e.range=function(y){return arguments.length?([n,a]=y,n=+n,a=+a,_()):[n,a]},e.rangeRound=function(y){return[n,a]=y,n=+n,a=+a,x=!0,_()},e.bandwidth=function(){return c},e.step=function(){return h},e.round=function(y){return arguments.length?(x=!!y,_()):x},e.padding=function(y){return arguments.length?(f=Math.min(1,S=+y),_()):f},e.paddingInner=function(y){return arguments.length?(f=Math.min(1,y),_()):f},e.paddingOuter=function(y){return arguments.length?(S=+y,_()):S},e.align=function(y){return arguments.length?(D=Math.max(0,Math.min(1,y)),_()):D},e.copy=function(){return gt(i(),[n,a]).round(x).paddingInner(f).paddingOuter(S).align(D)},ai.apply(_(),arguments)}var Tt=function(){var e=t(function(q,r,g,d){for(g=g||{},d=q.length;d--;g[q[d]]=r);return g},"o"),i=[1,10,12,14,16,18,19,21,23],s=[2,6],n=[1,3],a=[1,5],h=[1,6],c=[1,7],x=[1,5,10,12,14,16,18,19,21,23,36,37,38],f=[1,25],S=[1,26],D=[1,28],_=[1,29],y=[1,30],F=[1,31],I=[1,32],M=[1,33],W=[1,34],J=[1,35],et=[1,36],w=[1,37],Y=[1,43],u=[1,42],N=[1,47],H=[1,50],A=[1,10,12,14,16,18,19,21,23,36,37,38],st=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],B=[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],ht=[1,65],v=[26,28],k={trace:t(function(){},"trace"),yy:{},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},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"},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]],performAction:t(function(r,g,d,p,C,o,nt){var m=o.length-1;switch(C){case 5:p.setOrientation(o[m]);break;case 9:p.setDiagramTitle(o[m].text.trim());break;case 12:p.setLineData({text:"",type:"text"},o[m]);break;case 13:p.setLineData(o[m-1],o[m]);break;case 14:p.setBarData({text:"",type:"text"},o[m]);break;case 15:p.setBarData(o[m-1],o[m]);break;case 16:this.$=o[m].trim(),p.setAccTitle(this.$);break;case 17:case 18:this.$=o[m].trim(),p.setAccDescription(this.$);break;case 19:this.$=o[m-1];break;case 20:case 30:this.$=[o[m-2],...o[m]];break;case 21:case 31:this.$=[o[m]];break;case 22:this.$={value:Number(o[m-1]),label:o[m]};break;case 23:this.$={value:Number(o[m]),label:""};break;case 24:p.setXAxisTitle(o[m]);break;case 25:p.setXAxisTitle(o[m-1]);break;case 26:p.setXAxisTitle({type:"text",text:""});break;case 27:p.setXAxisBand(o[m]);break;case 28:p.setXAxisRangeData(Number(o[m-2]),Number(o[m]));break;case 29:this.$=o[m-1];break;case 32:p.setYAxisTitle(o[m]);break;case 33:p.setYAxisTitle(o[m-1]);break;case 34:p.setYAxisTitle({type:"text",text:""});break;case 35:p.setYAxisRangeData(Number(o[m-2]),Number(o[m]));break;case 39:this.$={text:o[m],type:"text"};break;case 40:this.$={text:o[m],type:"text"};break;case 41:this.$={text:o[m],type:"markdown"};break;case 42:this.$=o[m];break;case 43:this.$=o[m-1]+""+o[m];break}},"anonymous"),table:[e(i,s,{3:1,4:2,7:4,5:n,36:a,37:h,38:c}),{1:[3]},e(i,s,{4:2,7:4,3:8,5:n,36:a,37:h,38:c}),e(i,s,{4:2,7:4,6:9,3:10,5:n,8:[1,11],36:a,37:h,38:c}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(x,[2,36]),e(x,[2,37]),e(x,[2,38]),{1:[2,1]},e(i,s,{4:2,7:4,3:21,5:n,36:a,37:h,38:c}),{1:[2,3]},e(x,[2,5]),e(i,[2,7],{4:22,36:a,37:h,38:c}),{11:23,30:f,39:24,40:S,41:27,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w},{11:39,13:38,24:Y,29:u,30:f,31:40,32:41,39:24,40:S,41:27,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w},{11:45,15:44,29:N,30:f,35:46,39:24,40:S,41:27,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w},{11:49,17:48,24:H,30:f,39:24,40:S,41:27,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w},{11:52,17:51,24:H,30:f,39:24,40:S,41:27,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w},{20:[1,53]},{22:[1,54]},e(A,[2,18]),{1:[2,2]},e(A,[2,8]),e(A,[2,9]),e(st,[2,39],{41:55,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w}),e(st,[2,40]),e(st,[2,41]),e(B,[2,42]),e(B,[2,44]),e(B,[2,45]),e(B,[2,46]),e(B,[2,47]),e(B,[2,48]),e(B,[2,49]),e(B,[2,50]),e(B,[2,51]),e(B,[2,52]),e(B,[2,53]),e(A,[2,10]),e(A,[2,24],{32:41,31:56,24:Y,29:u}),e(A,[2,26]),e(A,[2,27]),{33:[1,57]},{11:59,30:f,34:58,39:24,40:S,41:27,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w},e(A,[2,11]),e(A,[2,32],{35:60,29:N}),e(A,[2,34]),{33:[1,61]},e(A,[2,12]),{17:62,24:H},{25:63,27:64,29:ht},e(A,[2,14]),{17:66,24:H},e(A,[2,16]),e(A,[2,17]),e(B,[2,43]),e(A,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},e(A,[2,33]),{29:[1,70]},e(A,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},e(v,[2,23],{30:[1,73]}),e(A,[2,15]),e(A,[2,28]),e(A,[2,29]),{11:59,30:f,34:74,39:24,40:S,41:27,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w},e(A,[2,35]),e(A,[2,19]),{25:75,27:64,29:ht},e(v,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:t(function(r,g){if(g.recoverable)this.trace(r);else{var d=Error(r);throw d.hash=g,d}},"parseError"),parse:t(function(r){var g=this,d=[0],p=[],C=[null],o=[],nt=this.table,m="",ft=0,Wt=0,Xt=0,xe=2,Nt=1,fe=o.slice.call(arguments,1),P=Object.create(this.lexer),at={yy:{}};for(var kt in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,kt))at.yy[kt]=this.yy[kt];if(P.setInput(r,at.yy),at.yy.lexer=P,at.yy.parser=this,typeof P.yylloc>"u")P.yylloc={};var At=P.yylloc;o.push(At);var pe=P.options&&P.options.ranges;if(typeof at.yy.parseError==="function")this.parseError=at.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function me(Z){d.length=d.length-2*Z,C.length=C.length-Z,o.length=o.length-Z}t(me,"popStack");function Yt(){var Z=p.pop()||P.lex()||Nt;if(typeof Z!=="number"){if(Z instanceof Array)p=Z,Z=p.pop();Z=g.symbols_[Z]||Z}return Z}t(Yt,"lex");var V,Ct,ot,Q,Be,St,lt={},pt,it,Ht,mt;while(!0){if(ot=d[d.length-1],this.defaultActions[ot])Q=this.defaultActions[ot];else{if(V===null||typeof V>"u")V=Yt();Q=nt[ot]&&nt[ot][V]}if(typeof Q>"u"||!Q.length||!Q[0]){var Rt="";mt=[];for(pt in nt[ot])if(this.terminals_[pt]&&pt>xe)mt.push("'"+this.terminals_[pt]+"'");if(P.showPosition)Rt="Parse error on line "+(ft+1)+`:
1
+ import{t,l,Mt,K,E,X,te,R,L,z,O,U,j,G,ai,On,Es,de,oe,Bf}from"./index-vnw3hbeg.js";import{na}from"./index-py2k8std.js";function _t(e,i,s){e=+e,i=+i,s=(a=arguments.length)<2?(i=e,e=0,1):a<3?1:+s;var n=-1,a=Math.max(0,Math.ceil((i-e)/s))|0,h=Array(a);while(++n<a)h[n]=e+n*s;return h}function gt(){var e=On().unknown(void 0),{domain:i,range:s}=e,n=0,a=1,h,c,x=!1,f=0,S=0,D=0.5;delete e.unknown;function _(){var y=i().length,F=a<n,I=F?a:n,M=F?n:a;if(h=(M-I)/Math.max(1,y-f+S*2),x)h=Math.floor(h);if(I+=(M-I-h*(y-f))*D,c=h*(1-f),x)I=Math.round(I),c=Math.round(c);var W=_t(y).map(function(J){return I+h*J});return s(F?W.reverse():W)}return e.domain=function(y){return arguments.length?(i(y),_()):i()},e.range=function(y){return arguments.length?([n,a]=y,n=+n,a=+a,_()):[n,a]},e.rangeRound=function(y){return[n,a]=y,n=+n,a=+a,x=!0,_()},e.bandwidth=function(){return c},e.step=function(){return h},e.round=function(y){return arguments.length?(x=!!y,_()):x},e.padding=function(y){return arguments.length?(f=Math.min(1,S=+y),_()):f},e.paddingInner=function(y){return arguments.length?(f=Math.min(1,y),_()):f},e.paddingOuter=function(y){return arguments.length?(S=+y,_()):S},e.align=function(y){return arguments.length?(D=Math.max(0,Math.min(1,y)),_()):D},e.copy=function(){return gt(i(),[n,a]).round(x).paddingInner(f).paddingOuter(S).align(D)},ai.apply(_(),arguments)}var Tt=function(){var e=t(function(q,r,g,d){for(g=g||{},d=q.length;d--;g[q[d]]=r);return g},"o"),i=[1,10,12,14,16,18,19,21,23],s=[2,6],n=[1,3],a=[1,5],h=[1,6],c=[1,7],x=[1,5,10,12,14,16,18,19,21,23,36,37,38],f=[1,25],S=[1,26],D=[1,28],_=[1,29],y=[1,30],F=[1,31],I=[1,32],M=[1,33],W=[1,34],J=[1,35],et=[1,36],w=[1,37],Y=[1,43],u=[1,42],N=[1,47],H=[1,50],A=[1,10,12,14,16,18,19,21,23,36,37,38],st=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],B=[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],ht=[1,65],v=[26,28],k={trace:t(function(){},"trace"),yy:{},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},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"},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]],performAction:t(function(r,g,d,p,C,o,nt){var m=o.length-1;switch(C){case 5:p.setOrientation(o[m]);break;case 9:p.setDiagramTitle(o[m].text.trim());break;case 12:p.setLineData({text:"",type:"text"},o[m]);break;case 13:p.setLineData(o[m-1],o[m]);break;case 14:p.setBarData({text:"",type:"text"},o[m]);break;case 15:p.setBarData(o[m-1],o[m]);break;case 16:this.$=o[m].trim(),p.setAccTitle(this.$);break;case 17:case 18:this.$=o[m].trim(),p.setAccDescription(this.$);break;case 19:this.$=o[m-1];break;case 20:case 30:this.$=[o[m-2],...o[m]];break;case 21:case 31:this.$=[o[m]];break;case 22:this.$={value:Number(o[m-1]),label:o[m]};break;case 23:this.$={value:Number(o[m]),label:""};break;case 24:p.setXAxisTitle(o[m]);break;case 25:p.setXAxisTitle(o[m-1]);break;case 26:p.setXAxisTitle({type:"text",text:""});break;case 27:p.setXAxisBand(o[m]);break;case 28:p.setXAxisRangeData(Number(o[m-2]),Number(o[m]));break;case 29:this.$=o[m-1];break;case 32:p.setYAxisTitle(o[m]);break;case 33:p.setYAxisTitle(o[m-1]);break;case 34:p.setYAxisTitle({type:"text",text:""});break;case 35:p.setYAxisRangeData(Number(o[m-2]),Number(o[m]));break;case 39:this.$={text:o[m],type:"text"};break;case 40:this.$={text:o[m],type:"text"};break;case 41:this.$={text:o[m],type:"markdown"};break;case 42:this.$=o[m];break;case 43:this.$=o[m-1]+""+o[m];break}},"anonymous"),table:[e(i,s,{3:1,4:2,7:4,5:n,36:a,37:h,38:c}),{1:[3]},e(i,s,{4:2,7:4,3:8,5:n,36:a,37:h,38:c}),e(i,s,{4:2,7:4,6:9,3:10,5:n,8:[1,11],36:a,37:h,38:c}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(x,[2,36]),e(x,[2,37]),e(x,[2,38]),{1:[2,1]},e(i,s,{4:2,7:4,3:21,5:n,36:a,37:h,38:c}),{1:[2,3]},e(x,[2,5]),e(i,[2,7],{4:22,36:a,37:h,38:c}),{11:23,30:f,39:24,40:S,41:27,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w},{11:39,13:38,24:Y,29:u,30:f,31:40,32:41,39:24,40:S,41:27,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w},{11:45,15:44,29:N,30:f,35:46,39:24,40:S,41:27,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w},{11:49,17:48,24:H,30:f,39:24,40:S,41:27,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w},{11:52,17:51,24:H,30:f,39:24,40:S,41:27,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w},{20:[1,53]},{22:[1,54]},e(A,[2,18]),{1:[2,2]},e(A,[2,8]),e(A,[2,9]),e(st,[2,39],{41:55,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w}),e(st,[2,40]),e(st,[2,41]),e(B,[2,42]),e(B,[2,44]),e(B,[2,45]),e(B,[2,46]),e(B,[2,47]),e(B,[2,48]),e(B,[2,49]),e(B,[2,50]),e(B,[2,51]),e(B,[2,52]),e(B,[2,53]),e(A,[2,10]),e(A,[2,24],{32:41,31:56,24:Y,29:u}),e(A,[2,26]),e(A,[2,27]),{33:[1,57]},{11:59,30:f,34:58,39:24,40:S,41:27,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w},e(A,[2,11]),e(A,[2,32],{35:60,29:N}),e(A,[2,34]),{33:[1,61]},e(A,[2,12]),{17:62,24:H},{25:63,27:64,29:ht},e(A,[2,14]),{17:66,24:H},e(A,[2,16]),e(A,[2,17]),e(B,[2,43]),e(A,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},e(A,[2,33]),{29:[1,70]},e(A,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},e(v,[2,23],{30:[1,73]}),e(A,[2,15]),e(A,[2,28]),e(A,[2,29]),{11:59,30:f,34:74,39:24,40:S,41:27,42:D,43:_,44:y,45:F,46:I,47:M,48:W,49:J,50:et,51:w},e(A,[2,35]),e(A,[2,19]),{25:75,27:64,29:ht},e(v,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:t(function(r,g){if(g.recoverable)this.trace(r);else{var d=Error(r);throw d.hash=g,d}},"parseError"),parse:t(function(r){var g=this,d=[0],p=[],C=[null],o=[],nt=this.table,m="",ft=0,Wt=0,Xt=0,xe=2,Nt=1,fe=o.slice.call(arguments,1),P=Object.create(this.lexer),at={yy:{}};for(var kt in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,kt))at.yy[kt]=this.yy[kt];if(P.setInput(r,at.yy),at.yy.lexer=P,at.yy.parser=this,typeof P.yylloc>"u")P.yylloc={};var At=P.yylloc;o.push(At);var pe=P.options&&P.options.ranges;if(typeof at.yy.parseError==="function")this.parseError=at.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function me(Z){d.length=d.length-2*Z,C.length=C.length-Z,o.length=o.length-Z}t(me,"popStack");function Yt(){var Z=p.pop()||P.lex()||Nt;if(typeof Z!=="number"){if(Z instanceof Array)p=Z,Z=p.pop();Z=g.symbols_[Z]||Z}return Z}t(Yt,"lex");var V,Ct,ot,Q,Be,St,lt={},pt,it,Ht,mt;while(!0){if(ot=d[d.length-1],this.defaultActions[ot])Q=this.defaultActions[ot];else{if(V===null||typeof V>"u")V=Yt();Q=nt[ot]&&nt[ot][V]}if(typeof Q>"u"||!Q.length||!Q[0]){var Rt="";mt=[];for(pt in nt[ot])if(this.terminals_[pt]&&pt>xe)mt.push("'"+this.terminals_[pt]+"'");if(P.showPosition)Rt="Parse error on line "+(ft+1)+`:
2
2
  `+P.showPosition()+`
3
3
  Expecting `+mt.join(", ")+", got '"+(this.terminals_[V]||V)+"'";else Rt="Parse error on line "+(ft+1)+": Unexpected "+(V==Nt?"end of input":"'"+(this.terminals_[V]||V)+"'");this.parseError(Rt,{text:P.match,token:this.terminals_[V]||V,line:P.yylineno,loc:At,expected:mt})}if(Q[0]instanceof Array&&Q.length>1)throw Error("Parse Error: multiple actions possible at state: "+ot+", token: "+V);switch(Q[0]){case 1:if(d.push(V),C.push(P.yytext),o.push(P.yylloc),d.push(Q[1]),V=null,!Ct){if(Wt=P.yyleng,m=P.yytext,ft=P.yylineno,At=P.yylloc,Xt>0)Xt--}else V=Ct,Ct=null;break;case 2:if(it=this.productions_[Q[1]][1],lt.$=C[C.length-it],lt._$={first_line:o[o.length-(it||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(it||1)].first_column,last_column:o[o.length-1].last_column},pe)lt._$.range=[o[o.length-(it||1)].range[0],o[o.length-1].range[1]];if(St=this.performAction.apply(lt,[m,Wt,ft,at.yy,Q[1],C,o].concat(fe)),typeof St<"u")return St;if(it)d=d.slice(0,-1*it*2),C=C.slice(0,-1*it),o=o.slice(0,-1*it);d.push(this.productions_[Q[1]][0]),C.push(lt.$),o.push(lt._$),Ht=nt[d[d.length-2]][d[d.length-1]],d.push(Ht);break;case 3:return!0}}return!0},"parse")},tt=function(){var q={EOF:1,parseError:t(function(g,d){if(this.yy.parser)this.yy.parser.parseError(g,d);else throw Error(g)},"parseError"),setInput:t(function(r,g){if(this.yy=g||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges)this.yylloc.range=[0,0];return this.offset=0,this},"setInput"),input:t(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var g=r.match(/(?:\r\n?|\n).*/g);if(g)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),r},"input"),unput:t(function(r){var g=r.length,d=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var p=this.match.split(/(?:\r\n?|\n)/g);if(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;var C=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:d?(d.length===p.length?this.yylloc.first_column:0)+p[p.length-d.length].length-d[0].length:this.yylloc.first_column-g},this.options.ranges)this.yylloc.range=[C[0],C[0]+this.yyleng-g];return this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else 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).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:t(function(r){this.unput(this.match.slice(r))},"less"),pastInput:t(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var r=this.match;if(r.length<20)r+=this._input.substr(0,20-r.length);return(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var r=this.pastInput(),g=Array(r.length+1).join("-");return r+this.upcomingInput()+`
5
5
  `+g+"^"},"showPosition"),test_match:t(function(r,g){var d,p,C;if(this.options.backtrack_lexer){if(C={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges)C.yylloc.range=this.yylloc.range.slice(0)}if(p=r[0].match(/(?:\r\n?|\n).*/g),p)this.yylineno+=p.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:p?p[p.length-1].length-p[p.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._backtrack=!1,this._input=this._input.slice(r[0].length),this.matched+=r[0],d=this.performAction.call(this,this.yy,this,g,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(d)return d;else if(this._backtrack){for(var o in C)this[o]=C[o];return!1}return!1},"test_match"),next:t(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var r,g,d,p;if(!this._more)this.yytext="",this.match="";var C=this._currentRules();for(var o=0;o<C.length;o++)if(d=this._input.match(this.rules[C[o]]),d&&(!g||d[0].length>g[0].length)){if(g=d,p=o,this.options.backtrack_lexer)if(r=this.test_match(d,C[o]),r!==!1)return r;else if(this._backtrack){g=!1;continue}else return!1;else if(!this.options.flex)break}if(g){if(r=this.test_match(g,C[p]),r!==!1)return r;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
6
- `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var g=this.next();if(g)return g;else return this.lex()},"lex"),begin:t(function(g){this.conditionStack.push(g)},"begin"),popState:t(function(){var g=this.conditionStack.length-1;if(g>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(g){if(g=this.conditionStack.length-1-Math.abs(g||0),g>=0)return this.conditionStack[g];else return"INITIAL"},"topState"),pushState:t(function(g){this.begin(g)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(g,d,p,C){var o=C;switch(p){case 0:break;case 1:break;case 2:return this.popState(),36;break;case 3:return this.popState(),36;break;case 4:return 36;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.pushState("acc_descr"),21;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";break;case 18:return this.pushState("axis_data"),"Y_AXIS";break;case 19:return this.pushState("axis_band_data"),24;break;case 20:return 33;case 21:return this.pushState("data"),16;break;case 22:return this.pushState("data"),18;break;case 23:return this.pushState("data_inner"),24;break;case 24:return 29;case 25:return this.popState(),26;break;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 44;case 33:return"COLON";case 34:return 45;case 35:return 28;case 36:return 46;case 37:return 47;case 38:return 49;case 39:return 51;case 40:return 48;case 41:return 42;case 42:return 50;case 43:return 43;case 44:break;case 45:return 37;case 46:return 38}},"anonymous"),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],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}}};return q}();k.lexer=tt;function T(){this.yy={}}return t(T,"Parser"),T.prototype=k,k.Parser=T,new T}();Tt.parser=Tt;var be=Tt;function bt(e){return e.type==="bar"}t(bt,"isBarPlot");function yt(e){return e.type==="band"}t(yt,"isBandAxisData");function ct(e){return e.type==="linear"}t(ct,"isLinearAxisData");var Lt=class{constructor(e){this.parentGroup=e}static{t(this,"TextDimensionCalculatorWithFont")}getMaxDimension(e,i){if(!this.parentGroup)return{width:e.reduce((a,h)=>Math.max(h.length,a),0)*i,height:i};let s={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(let a of e){let h=Cf(n,1,a),c=h?h.width:a.length*i,x=h?h.height:i;s.width=Math.max(s.width,c),s.height=Math.max(s.height,x)}return n.remove(),s}},$t=0.7,Ut=0.2,qt=class{constructor(e,i,s,n){this.axisConfig=e,this.title=i,this.textDimensionCalculator=s,this.axisThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.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}static{t(this,"BaseAxis")}setRange(e){if(this.range=e,this.axisPosition==="left"||this.axisPosition==="right")this.boundingRect.height=e[1]-e[0];else this.boundingRect.width=e[1]-e[0];this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(e){this.axisPosition=e,this.setRange(this.range)}getTickDistance(){let e=this.getRange();return Math.abs(e[0]-e[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map((e)=>e.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){if($t*this.getTickDistance()>this.outerPadding*2)this.outerPadding=Math.floor($t*this.getTickDistance()/2);this.recalculateScale()}calculateSpaceIfDrawnHorizontally(e){let i=e.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth)i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0;if(this.axisConfig.showLabel){let s=this.getLabelDimension(),n=Ut*e.width;this.outerPadding=Math.min(s.width/2,n);let a=s.height;if(this.axisPosition==="bottom"&&this.normalizedLabelRotationInRad!==0)a=Math.max(a,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*s.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*s.height));if(a+=this.axisConfig.labelPadding*2,this.labelTextHeight=s.height,a<=i)i-=a,this.showLabel=!0}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength)this.showTick=!0,i-=this.axisConfig.tickLength;if(this.axisConfig.showTitle&&this.title){let s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;if(this.titleTextHeight=s.height,n<=i)i-=n,this.showTitle=!0}this.boundingRect.width=e.width,this.boundingRect.height=e.height-i}calculateSpaceIfDrawnVertical(e){let i=e.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth)i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0;if(this.axisConfig.showLabel){let s=this.getLabelDimension(),n=Ut*e.height;this.outerPadding=Math.min(s.height/2,n);let a=s.width+this.axisConfig.labelPadding*2;if(a<=i)i-=a,this.showLabel=!0}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength)this.showTick=!0,i-=this.axisConfig.tickLength;if(this.axisConfig.showTitle&&this.title){let s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;if(this.titleTextHeight=s.height,n<=i)i-=n,this.showTitle=!0}this.boundingRect.width=e.width-i,this.boundingRect.height=e.height}calculateSpace(e){if(this.axisPosition==="left"||this.axisPosition==="right")this.calculateSpaceIfDrawnVertical(e);else this.calculateSpaceIfDrawnHorizontally(e);return this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateOffsetByRotation(e){let i=this.normalizedLabelRotationInRad;if(i===0)return 0;return Math.sin(i)*this.getLabelDimension()[e]/2}getDrawableElementsForLeftAxis(){let e=[];if(this.showAxisLine){let i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)e.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),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),y:this.getScaleValue(i),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))});if(this.showTick){let i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${i},${this.getScaleValue(s)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(s)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)e.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]});return e}getDrawableElementsForBottomAxis(){let e=[];if(this.showAxisLine){let i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)e.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),x:this.getScaleValue(i)+this.calculateOffsetByRotation("height"),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0)+Math.abs(this.calculateOffsetByRotation("width")),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:this.normalizedLabelRotationInRad*180/Math.PI,verticalPos:"top",horizontalPos:"center"}))});if(this.showTick){let i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${this.getScaleValue(s)},${i} L ${this.getScaleValue(s)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)e.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]});return e}getDrawableElementsForTopAxis(){let e=[];if(this.showAxisLine){let i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)e.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))});if(this.showTick){let i=this.boundingRect.y;e.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${this.getScaleValue(s)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(s)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)e.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]});return e}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");if(this.axisPosition==="bottom")return this.getDrawableElementsForBottomAxis();if(this.axisPosition==="top")return this.getDrawableElementsForTopAxis();return[]}},ye=class extends qt{static{t(this,"BandAxis")}constructor(e,i,s,n,a){super(e,n,a,i);this.categories=s,this.scale=gt().domain(this.categories).range(this.getRange())}setRange(e){super.setRange(e)}recalculateScale(){this.scale=gt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5),l.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(e){return this.scale(e)??this.getRange()[0]}},we=class extends qt{static{t(this,"LinearAxis")}constructor(e,i,s,n,a){super(e,n,a,i);this.domain=s,this.scale=na().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let e=[...this.domain];if(this.axisPosition==="left")e.reverse();this.scale=na().domain(e).range(this.getRange())}getScaleValue(e){return this.scale(e)}};function Dt(e,i,s,n){let a=new Lt(n);if(yt(e))return new ye(i,s,e.categories,e.title,a);return new we(i,s,[e.min,e.max],e.title,a)}t(Dt,"getAxis");var ke=class{constructor(e,i,s,n){this.textDimensionCalculator=e,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{t(this,"ChartTitle")}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){let i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),s=Math.max(i.width,e.width),n=i.height+2*this.chartConfig.titlePadding;if(i.width<=s&&i.height<=n&&this.chartConfig.showTitle&&this.chartData.title)this.boundingRect.width=s,this.boundingRect.height=n,this.showChartTitle=!0;return{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let e=[];if(this.showChartTitle)e.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]});return e}};function Gt(e,i,s,n){let a=new Lt(n);return new ke(a,e,i,s)}t(Gt,"getChartTitleComponent");var Ae=0.75,Ce=0.5,Se=0.35;function vt(e){return{fontSize:e,markerSize:e*Ae,markerSpacing:e*Se,itemSpacing:e*Ce}}t(vt,"getLegendLayout");var Re=class{constructor(e,i,s,n){this.textDimensionCalculator=e,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.visiblePlots=[]}static{t(this,"ChartLegend")}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){if(this.visiblePlots=this.chartConfig.showLegend?this.chartData.plots.filter((f)=>f.title):[],this.visiblePlots.length===0)return this.boundingRect.width=0,this.boundingRect.height=0,{width:0,height:0};let{fontSize:i,markerSize:s,markerSpacing:n,itemSpacing:a}=vt(this.chartConfig.legendFontSize),h=this.textDimensionCalculator.getMaxDimension(this.visiblePlots.map((f)=>f.title),i),c=this.chartConfig.legendPadding*2+s+n+h.width,x=this.chartConfig.legendPadding*2+this.visiblePlots.length*i+(this.visiblePlots.length-1)*a;if(c<=e.width&&x<=e.height)this.boundingRect.width=c,this.boundingRect.height=x;else this.visiblePlots=[],this.boundingRect.width=0,this.boundingRect.height=0;return{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(this.visiblePlots.length===0)return[];let{fontSize:e,markerSize:i,markerSpacing:s,itemSpacing:n}=vt(this.chartConfig.legendFontSize),a=e+n,h=this.boundingRect.x+this.chartConfig.legendPadding,c=this.boundingRect.y+this.chartConfig.legendPadding,x=[],f=[];for(let[S,D]of this.visiblePlots.entries())if(bt(D))x.push({x:h,y:c+S*a,width:i,height:i,fill:D.fill,strokeFill:D.fill,strokeWidth:0});else{let _=c+S*a+i/2;f.push({path:`M ${h},${_} L ${h+i},${_}`,strokeFill:D.strokeFill,strokeWidth:D.strokeWidth})}return[{groupTexts:["legend","markers"],type:"rect",data:x},{groupTexts:["legend","markers"],type:"path",data:f},{groupTexts:["legend","label"],type:"text",data:this.visiblePlots.map((S,D)=>({text:S.title,x:h+i+s,y:c+D*a+i/2,fill:this.chartThemeConfig.legendTextColor,fontSize:e,rotation:0,verticalPos:"middle",horizontalPos:"left"}))}]}};function jt(e,i,s,n){let a=new Lt(n);return new Re(a,e,i,s)}t(jt,"getChartLegendComponent");var _e=class{constructor(e,i,s,n,a){this.plotData=e,this.xAxis=i,this.yAxis=s,this.orientation=n,this.plotIndex=a}static{t(this,"LinePlot")}getDrawableElement(){let e=this.plotData.data.map((n)=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]),i;if(this.orientation==="horizontal")i=Cs().y((n)=>n[0]).x((n)=>n[1])(e);else i=Cs().x((n)=>n[0]).y((n)=>n[1])(e);if(!i)return[];let s=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){let h=[];for(let[c,[x,f]]of e.entries()){let S=this.plotData.pointLabels[c];if(!S)continue;if(this.orientation==="horizontal")h.push({x:f+10,y:x,text:S,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:12,rotation:0});else h.push({x,y:f-10,text:S,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:12,rotation:0})}if(h.length>0)s.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:h})}return s}},Te=class{constructor(e,i,s,n,a,h){this.barData=e,this.boundingRect=i,this.xAxis=s,this.yAxis=n,this.orientation=a,this.plotIndex=h}static{t(this,"BarPlot")}getDrawableElement(){let e=this.barData.data.map((a)=>[this.xAxis.getScaleValue(a[0]),this.yAxis.getScaleValue(a[1])]),i=0.05,s=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*0.95,n=s/2;if(this.orientation==="horizontal")return[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:e.map((a)=>({x:this.boundingRect.x,y:a[0]-n,height:s,width:a[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}];return[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:e.map((a)=>({x:a[0]-n,y:a[1],width:s,height:this.boundingRect.y+this.boundingRect.height-a[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},De=class{constructor(e,i,s){this.chartConfig=e,this.chartData=i,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0}}static{t(this,"BasePlot")}setAxes(e,i){this.xAxis=e,this.yAxis=i}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){return this.boundingRect.width=e.width,this.boundingRect.height=e.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");let e=[];for(let[i,s]of this.chartData.plots.entries())switch(s.type){case"line":{let n=new _e(s,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);e.push(...n.getDrawableElement())}break;case"bar":{let n=new Te(s,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);e.push(...n.getDrawableElement())}break}return e}};function Qt(e,i,s){return new De(e,i,s)}t(Qt,"getPlotComponent");var ve=class{constructor(e,i,s,n){this.chartConfig=e,this.chartData=i,this.componentStore={title:Gt(e,i,s,n),plot:Qt(e,i,s),legend:jt(e,i,s,n),xAxis:Dt(i.xAxis,e.xAxis,{titleColor:s.xAxisTitleColor,labelColor:s.xAxisLabelColor,tickColor:s.xAxisTickColor,axisLineColor:s.xAxisLineColor},n),yAxis:Dt(i.yAxis,e.yAxis,{titleColor:s.yAxisTitleColor,labelColor:s.yAxisLabelColor,tickColor:s.yAxisTickColor,axisLineColor:s.yAxisLineColor},n)}}static{t(this,"Orchestrator")}calculateVerticalSpace(){let e=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,a={width:0,height:0},h=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),c=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),x=this.componentStore.plot.calculateSpace({width:h,height:c});if(e-=x.width,i-=x.height,x=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),n=x.height,i-=x.height,this.componentStore.xAxis.setAxisPosition("bottom"),x=this.componentStore.xAxis.calculateSpace({width:e,height:i}),i-=x.height,this.componentStore.yAxis.setAxisPosition("left"),x=this.componentStore.yAxis.calculateSpace({width:e,height:i}),s=x.width,e-=x.width,a=this.componentStore.legend.calculateSpace({width:e,height:c}),e-=a.width,e>0)h+=e,e=0;if(i>0)c+=i,i=0;if(this.componentStore.plot.calculateSpace({width:h,height:c}),this.componentStore.plot.setBoundingBoxXY({x:s,y:n}),this.componentStore.legend.setBoundingBoxXY({x:s+h,y:n+Math.max((c-a.height)/2,0)}),this.componentStore.xAxis.setRange([s,s+h]),this.componentStore.xAxis.setBoundingBoxXY({x:s,y:n+c}),this.componentStore.yAxis.setRange([n,n+c]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some((f)=>bt(f)))this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let e=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,a=0,h={width:0,height:0},c=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),x=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),f=this.componentStore.plot.calculateSpace({width:c,height:x});if(e-=f.width,i-=f.height,f=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=f.height,i-=f.height,this.componentStore.xAxis.setAxisPosition("left"),f=this.componentStore.xAxis.calculateSpace({width:e,height:i}),e-=f.width,n=f.width,this.componentStore.yAxis.setAxisPosition("top"),f=this.componentStore.yAxis.calculateSpace({width:e,height:i}),i-=f.height,a=s+f.height,h=this.componentStore.legend.calculateSpace({width:e,height:x}),e-=h.width,e>0)c+=e,e=0;if(i>0)x+=i,i=0;if(this.componentStore.plot.calculateSpace({width:c,height:x}),this.componentStore.plot.setBoundingBoxXY({x:n,y:a}),this.componentStore.legend.setBoundingBoxXY({x:n+c,y:a+Math.max((x-h.height)/2,0)}),this.componentStore.yAxis.setRange([n,n+c]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:s}),this.componentStore.xAxis.setRange([a,a+x]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:a}),this.chartData.plots.some((S)=>bt(S)))this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){if(this.chartConfig.chartOrientation==="horizontal")this.calculateHorizontalSpace();else this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let e=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let i of Object.values(this.componentStore))e.push(...i.getDrawableElements());return e}},Pe=class{static{t(this,"XYChartBuilder")}static build(e,i,s,n){return new ve(e,i,s,n).getDrawableElement()}},ut=0,Kt,dt=Bt(),xt=It(),b=zt(),Pt=xt.plotColorPalette.split(",").map((e)=>e.trim()),wt=!1,Et=!1;function It(){let e=Mt(),i=E();return oe(e.xyChart,i.themeVariables.xyChart)}t(It,"getChartDefaultThemeConfig");function Bt(){let e=E();return oe(K.xyChart,e.xyChart)}t(Bt,"getChartDefaultConfig");function zt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}t(zt,"getChartDefaultData");function rt(e){let i=E();return X(e.trim(),i)}t(rt,"textSanitizer");function Zt(e){Kt=e}t(Zt,"setTmpSVGG");function Jt(e){if(e==="horizontal")dt.chartOrientation="horizontal";else dt.chartOrientation="vertical"}t(Jt,"setOrientation");function ee(e){b.xAxis.title=rt(e.text)}t(ee,"setXAxisTitle");function Ot(e,i){b.xAxis={type:"linear",title:b.xAxis.title,min:e,max:i},wt=!0}t(Ot,"setXAxisRangeData");function ie(e){b.xAxis={type:"band",title:b.xAxis.title,categories:e.map((i)=>rt(i.text))},wt=!0}t(ie,"setXAxisBand");function se(e){b.yAxis.title=rt(e.text)}t(se,"setYAxisTitle");function ne(e,i){b.yAxis={type:"linear",title:b.yAxis.title,min:e,max:i},Et=!0}t(ne,"setYAxisRangeData");function ae(e){let i=Math.min(...e),s=Math.max(...e),n=ct(b.yAxis)?b.yAxis.min:1/0,a=ct(b.yAxis)?b.yAxis.max:-1/0;b.yAxis={type:"linear",title:b.yAxis.title,min:Math.min(n,i),max:Math.max(a,s)}}t(ae,"setYAxisRangeFromPlotData");function Vt(e){let i=[];if(e.length===0)return i;if(!wt){let s=ct(b.xAxis)?b.xAxis.min:1/0,n=ct(b.xAxis)?b.xAxis.max:-1/0;Ot(Math.min(s,1),Math.max(n,e.length))}if(yt(b.xAxis)&&e.length>b.xAxis.categories.length)e=e.slice(0,b.xAxis.categories.length);if(!Et)ae(e);if(yt(b.xAxis))i=b.xAxis.categories.map((s,n)=>[s,e[n]]);if(ct(b.xAxis)){let s=b.xAxis.min,n=b.xAxis.max;if(e.length===1)i=[[`${s}`,e[0]]];else{let a=(n-s)/(e.length-1);i=e.map((h,c)=>[`${s+c*a}`,h])}}return i}t(Vt,"transformDataWithoutCategory");function Ft(e){return Pt[e===0?0:e%Pt.length]}t(Ft,"getPlotColorFromPalette");function re(e,i){let s=i.map((c)=>c.value),n=i.map((c)=>c.label?rt(c.label):""),a=Vt(s),h=n.some((c)=>c!=="");b.plots.push({type:"line",title:rt(e.text),strokeFill:Ft(ut),strokeWidth:2,data:a,...h?{pointLabels:n}:{}}),ut++}t(re,"setLineData");function he(e,i){let s=i.map((a)=>a.value),n=Vt(s);b.plots.push({type:"bar",title:rt(e.text),fill:Ft(ut),data:n}),ut++}t(he,"setBarData");function le(){if(b.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return b.title=G(),Pe.build(dt,b,xt,Kt)}t(le,"getDrawableElem");function ce(){return xt}t(ce,"getChartThemeConfig");function ge(){return dt}t(ge,"getChartConfig");function ue(){return b}t(ue,"getXYChartData");var Le=t(function(){R(),ut=0,dt=Bt(),b=zt(),xt=It(),Pt=xt.plotColorPalette.split(",").map((e)=>e.trim()),wt=!1,Et=!1},"clear"),Ee={getDrawableElem:le,clear:Le,setAccTitle:L,getAccTitle:z,setDiagramTitle:j,getDiagramTitle:G,getAccDescription:U,setAccDescription:O,setOrientation:Jt,setXAxisTitle:ee,setXAxisRangeData:Ot,setXAxisBand:ie,setYAxisTitle:se,setYAxisRangeData:ne,setLineData:re,setBarData:he,setTmpSVGG:Zt,getChartThemeConfig:ce,getChartConfig:ge,getXYChartData:ue},Ie=t((e,i,s,n)=>{let a=n.db,h=a.getChartThemeConfig(),c=a.getChartConfig(),x=a.getXYChartData().plots[0].data.map((w)=>w[1]);function f(w){return w==="top"?"text-before-edge":"middle"}t(f,"getDominantBaseLine");function S(w){return w==="left"?"start":w==="right"?"end":"middle"}t(S,"getTextAnchor");function D(w){return`translate(${w.x}, ${w.y}) rotate(${w.rotation||0})`}t(D,"getTextTransformation"),l.debug(`Rendering xychart chart
6
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var g=this.next();if(g)return g;else return this.lex()},"lex"),begin:t(function(g){this.conditionStack.push(g)},"begin"),popState:t(function(){var g=this.conditionStack.length-1;if(g>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(g){if(g=this.conditionStack.length-1-Math.abs(g||0),g>=0)return this.conditionStack[g];else return"INITIAL"},"topState"),pushState:t(function(g){this.begin(g)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(g,d,p,C){var o=C;switch(p){case 0:break;case 1:break;case 2:return this.popState(),36;break;case 3:return this.popState(),36;break;case 4:return 36;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.pushState("acc_descr"),21;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";break;case 18:return this.pushState("axis_data"),"Y_AXIS";break;case 19:return this.pushState("axis_band_data"),24;break;case 20:return 33;case 21:return this.pushState("data"),16;break;case 22:return this.pushState("data"),18;break;case 23:return this.pushState("data_inner"),24;break;case 24:return 29;case 25:return this.popState(),26;break;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 44;case 33:return"COLON";case 34:return 45;case 35:return 28;case 36:return 46;case 37:return 47;case 38:return 49;case 39:return 51;case 40:return 48;case 41:return 42;case 42:return 50;case 43:return 43;case 44:break;case 45:return 37;case 46:return 38}},"anonymous"),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],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}}};return q}();k.lexer=tt;function T(){this.yy={}}return t(T,"Parser"),T.prototype=k,k.Parser=T,new T}();Tt.parser=Tt;var be=Tt;function bt(e){return e.type==="bar"}t(bt,"isBarPlot");function yt(e){return e.type==="band"}t(yt,"isBandAxisData");function ct(e){return e.type==="linear"}t(ct,"isLinearAxisData");var Lt=class{constructor(e){this.parentGroup=e}static{t(this,"TextDimensionCalculatorWithFont")}getMaxDimension(e,i){if(!this.parentGroup)return{width:e.reduce((a,h)=>Math.max(h.length,a),0)*i,height:i};let s={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(let a of e){let h=Bf(n,1,a),c=h?h.width:a.length*i,x=h?h.height:i;s.width=Math.max(s.width,c),s.height=Math.max(s.height,x)}return n.remove(),s}},$t=0.7,Ut=0.2,qt=class{constructor(e,i,s,n){this.axisConfig=e,this.title=i,this.textDimensionCalculator=s,this.axisThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.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}static{t(this,"BaseAxis")}setRange(e){if(this.range=e,this.axisPosition==="left"||this.axisPosition==="right")this.boundingRect.height=e[1]-e[0];else this.boundingRect.width=e[1]-e[0];this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(e){this.axisPosition=e,this.setRange(this.range)}getTickDistance(){let e=this.getRange();return Math.abs(e[0]-e[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map((e)=>e.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){if($t*this.getTickDistance()>this.outerPadding*2)this.outerPadding=Math.floor($t*this.getTickDistance()/2);this.recalculateScale()}calculateSpaceIfDrawnHorizontally(e){let i=e.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth)i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0;if(this.axisConfig.showLabel){let s=this.getLabelDimension(),n=Ut*e.width;this.outerPadding=Math.min(s.width/2,n);let a=s.height;if(this.axisPosition==="bottom"&&this.normalizedLabelRotationInRad!==0)a=Math.max(a,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*s.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*s.height));if(a+=this.axisConfig.labelPadding*2,this.labelTextHeight=s.height,a<=i)i-=a,this.showLabel=!0}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength)this.showTick=!0,i-=this.axisConfig.tickLength;if(this.axisConfig.showTitle&&this.title){let s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;if(this.titleTextHeight=s.height,n<=i)i-=n,this.showTitle=!0}this.boundingRect.width=e.width,this.boundingRect.height=e.height-i}calculateSpaceIfDrawnVertical(e){let i=e.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth)i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0;if(this.axisConfig.showLabel){let s=this.getLabelDimension(),n=Ut*e.height;this.outerPadding=Math.min(s.height/2,n);let a=s.width+this.axisConfig.labelPadding*2;if(a<=i)i-=a,this.showLabel=!0}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength)this.showTick=!0,i-=this.axisConfig.tickLength;if(this.axisConfig.showTitle&&this.title){let s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;if(this.titleTextHeight=s.height,n<=i)i-=n,this.showTitle=!0}this.boundingRect.width=e.width-i,this.boundingRect.height=e.height}calculateSpace(e){if(this.axisPosition==="left"||this.axisPosition==="right")this.calculateSpaceIfDrawnVertical(e);else this.calculateSpaceIfDrawnHorizontally(e);return this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateOffsetByRotation(e){let i=this.normalizedLabelRotationInRad;if(i===0)return 0;return Math.sin(i)*this.getLabelDimension()[e]/2}getDrawableElementsForLeftAxis(){let e=[];if(this.showAxisLine){let i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)e.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),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),y:this.getScaleValue(i),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))});if(this.showTick){let i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${i},${this.getScaleValue(s)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(s)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)e.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]});return e}getDrawableElementsForBottomAxis(){let e=[];if(this.showAxisLine){let i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)e.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),x:this.getScaleValue(i)+this.calculateOffsetByRotation("height"),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0)+Math.abs(this.calculateOffsetByRotation("width")),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:this.normalizedLabelRotationInRad*180/Math.PI,verticalPos:"top",horizontalPos:"center"}))});if(this.showTick){let i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${this.getScaleValue(s)},${i} L ${this.getScaleValue(s)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)e.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]});return e}getDrawableElementsForTopAxis(){let e=[];if(this.showAxisLine){let i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)e.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))});if(this.showTick){let i=this.boundingRect.y;e.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${this.getScaleValue(s)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(s)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)e.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]});return e}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");if(this.axisPosition==="bottom")return this.getDrawableElementsForBottomAxis();if(this.axisPosition==="top")return this.getDrawableElementsForTopAxis();return[]}},ye=class extends qt{static{t(this,"BandAxis")}constructor(e,i,s,n,a){super(e,n,a,i);this.categories=s,this.scale=gt().domain(this.categories).range(this.getRange())}setRange(e){super.setRange(e)}recalculateScale(){this.scale=gt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5),l.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(e){return this.scale(e)??this.getRange()[0]}},we=class extends qt{static{t(this,"LinearAxis")}constructor(e,i,s,n,a){super(e,n,a,i);this.domain=s,this.scale=na().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let e=[...this.domain];if(this.axisPosition==="left")e.reverse();this.scale=na().domain(e).range(this.getRange())}getScaleValue(e){return this.scale(e)}};function Dt(e,i,s,n){let a=new Lt(n);if(yt(e))return new ye(i,s,e.categories,e.title,a);return new we(i,s,[e.min,e.max],e.title,a)}t(Dt,"getAxis");var ke=class{constructor(e,i,s,n){this.textDimensionCalculator=e,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{t(this,"ChartTitle")}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){let i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),s=Math.max(i.width,e.width),n=i.height+2*this.chartConfig.titlePadding;if(i.width<=s&&i.height<=n&&this.chartConfig.showTitle&&this.chartData.title)this.boundingRect.width=s,this.boundingRect.height=n,this.showChartTitle=!0;return{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let e=[];if(this.showChartTitle)e.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]});return e}};function Gt(e,i,s,n){let a=new Lt(n);return new ke(a,e,i,s)}t(Gt,"getChartTitleComponent");var Ae=0.75,Ce=0.5,Se=0.35;function vt(e){return{fontSize:e,markerSize:e*Ae,markerSpacing:e*Se,itemSpacing:e*Ce}}t(vt,"getLegendLayout");var Re=class{constructor(e,i,s,n){this.textDimensionCalculator=e,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.visiblePlots=[]}static{t(this,"ChartLegend")}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){if(this.visiblePlots=this.chartConfig.showLegend?this.chartData.plots.filter((f)=>f.title):[],this.visiblePlots.length===0)return this.boundingRect.width=0,this.boundingRect.height=0,{width:0,height:0};let{fontSize:i,markerSize:s,markerSpacing:n,itemSpacing:a}=vt(this.chartConfig.legendFontSize),h=this.textDimensionCalculator.getMaxDimension(this.visiblePlots.map((f)=>f.title),i),c=this.chartConfig.legendPadding*2+s+n+h.width,x=this.chartConfig.legendPadding*2+this.visiblePlots.length*i+(this.visiblePlots.length-1)*a;if(c<=e.width&&x<=e.height)this.boundingRect.width=c,this.boundingRect.height=x;else this.visiblePlots=[],this.boundingRect.width=0,this.boundingRect.height=0;return{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(this.visiblePlots.length===0)return[];let{fontSize:e,markerSize:i,markerSpacing:s,itemSpacing:n}=vt(this.chartConfig.legendFontSize),a=e+n,h=this.boundingRect.x+this.chartConfig.legendPadding,c=this.boundingRect.y+this.chartConfig.legendPadding,x=[],f=[];for(let[S,D]of this.visiblePlots.entries())if(bt(D))x.push({x:h,y:c+S*a,width:i,height:i,fill:D.fill,strokeFill:D.fill,strokeWidth:0});else{let _=c+S*a+i/2;f.push({path:`M ${h},${_} L ${h+i},${_}`,strokeFill:D.strokeFill,strokeWidth:D.strokeWidth})}return[{groupTexts:["legend","markers"],type:"rect",data:x},{groupTexts:["legend","markers"],type:"path",data:f},{groupTexts:["legend","label"],type:"text",data:this.visiblePlots.map((S,D)=>({text:S.title,x:h+i+s,y:c+D*a+i/2,fill:this.chartThemeConfig.legendTextColor,fontSize:e,rotation:0,verticalPos:"middle",horizontalPos:"left"}))}]}};function jt(e,i,s,n){let a=new Lt(n);return new Re(a,e,i,s)}t(jt,"getChartLegendComponent");var _e=class{constructor(e,i,s,n,a){this.plotData=e,this.xAxis=i,this.yAxis=s,this.orientation=n,this.plotIndex=a}static{t(this,"LinePlot")}getDrawableElement(){let e=this.plotData.data.map((n)=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]),i;if(this.orientation==="horizontal")i=Es().y((n)=>n[0]).x((n)=>n[1])(e);else i=Es().x((n)=>n[0]).y((n)=>n[1])(e);if(!i)return[];let s=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){let h=[];for(let[c,[x,f]]of e.entries()){let S=this.plotData.pointLabels[c];if(!S)continue;if(this.orientation==="horizontal")h.push({x:f+10,y:x,text:S,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:12,rotation:0});else h.push({x,y:f-10,text:S,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:12,rotation:0})}if(h.length>0)s.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:h})}return s}},Te=class{constructor(e,i,s,n,a,h){this.barData=e,this.boundingRect=i,this.xAxis=s,this.yAxis=n,this.orientation=a,this.plotIndex=h}static{t(this,"BarPlot")}getDrawableElement(){let e=this.barData.data.map((a)=>[this.xAxis.getScaleValue(a[0]),this.yAxis.getScaleValue(a[1])]),i=0.05,s=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*0.95,n=s/2;if(this.orientation==="horizontal")return[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:e.map((a)=>({x:this.boundingRect.x,y:a[0]-n,height:s,width:a[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}];return[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:e.map((a)=>({x:a[0]-n,y:a[1],width:s,height:this.boundingRect.y+this.boundingRect.height-a[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},De=class{constructor(e,i,s){this.chartConfig=e,this.chartData=i,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0}}static{t(this,"BasePlot")}setAxes(e,i){this.xAxis=e,this.yAxis=i}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){return this.boundingRect.width=e.width,this.boundingRect.height=e.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");let e=[];for(let[i,s]of this.chartData.plots.entries())switch(s.type){case"line":{let n=new _e(s,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);e.push(...n.getDrawableElement())}break;case"bar":{let n=new Te(s,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);e.push(...n.getDrawableElement())}break}return e}};function Qt(e,i,s){return new De(e,i,s)}t(Qt,"getPlotComponent");var ve=class{constructor(e,i,s,n){this.chartConfig=e,this.chartData=i,this.componentStore={title:Gt(e,i,s,n),plot:Qt(e,i,s),legend:jt(e,i,s,n),xAxis:Dt(i.xAxis,e.xAxis,{titleColor:s.xAxisTitleColor,labelColor:s.xAxisLabelColor,tickColor:s.xAxisTickColor,axisLineColor:s.xAxisLineColor},n),yAxis:Dt(i.yAxis,e.yAxis,{titleColor:s.yAxisTitleColor,labelColor:s.yAxisLabelColor,tickColor:s.yAxisTickColor,axisLineColor:s.yAxisLineColor},n)}}static{t(this,"Orchestrator")}calculateVerticalSpace(){let e=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,a={width:0,height:0},h=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),c=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),x=this.componentStore.plot.calculateSpace({width:h,height:c});if(e-=x.width,i-=x.height,x=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),n=x.height,i-=x.height,this.componentStore.xAxis.setAxisPosition("bottom"),x=this.componentStore.xAxis.calculateSpace({width:e,height:i}),i-=x.height,this.componentStore.yAxis.setAxisPosition("left"),x=this.componentStore.yAxis.calculateSpace({width:e,height:i}),s=x.width,e-=x.width,a=this.componentStore.legend.calculateSpace({width:e,height:c}),e-=a.width,e>0)h+=e,e=0;if(i>0)c+=i,i=0;if(this.componentStore.plot.calculateSpace({width:h,height:c}),this.componentStore.plot.setBoundingBoxXY({x:s,y:n}),this.componentStore.legend.setBoundingBoxXY({x:s+h,y:n+Math.max((c-a.height)/2,0)}),this.componentStore.xAxis.setRange([s,s+h]),this.componentStore.xAxis.setBoundingBoxXY({x:s,y:n+c}),this.componentStore.yAxis.setRange([n,n+c]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some((f)=>bt(f)))this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let e=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,a=0,h={width:0,height:0},c=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),x=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),f=this.componentStore.plot.calculateSpace({width:c,height:x});if(e-=f.width,i-=f.height,f=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=f.height,i-=f.height,this.componentStore.xAxis.setAxisPosition("left"),f=this.componentStore.xAxis.calculateSpace({width:e,height:i}),e-=f.width,n=f.width,this.componentStore.yAxis.setAxisPosition("top"),f=this.componentStore.yAxis.calculateSpace({width:e,height:i}),i-=f.height,a=s+f.height,h=this.componentStore.legend.calculateSpace({width:e,height:x}),e-=h.width,e>0)c+=e,e=0;if(i>0)x+=i,i=0;if(this.componentStore.plot.calculateSpace({width:c,height:x}),this.componentStore.plot.setBoundingBoxXY({x:n,y:a}),this.componentStore.legend.setBoundingBoxXY({x:n+c,y:a+Math.max((x-h.height)/2,0)}),this.componentStore.yAxis.setRange([n,n+c]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:s}),this.componentStore.xAxis.setRange([a,a+x]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:a}),this.chartData.plots.some((S)=>bt(S)))this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){if(this.chartConfig.chartOrientation==="horizontal")this.calculateHorizontalSpace();else this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let e=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let i of Object.values(this.componentStore))e.push(...i.getDrawableElements());return e}},Pe=class{static{t(this,"XYChartBuilder")}static build(e,i,s,n){return new ve(e,i,s,n).getDrawableElement()}},ut=0,Kt,dt=Bt(),xt=It(),b=zt(),Pt=xt.plotColorPalette.split(",").map((e)=>e.trim()),wt=!1,Et=!1;function It(){let e=Mt(),i=E();return oe(e.xyChart,i.themeVariables.xyChart)}t(It,"getChartDefaultThemeConfig");function Bt(){let e=E();return oe(K.xyChart,e.xyChart)}t(Bt,"getChartDefaultConfig");function zt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}t(zt,"getChartDefaultData");function rt(e){let i=E();return X(e.trim(),i)}t(rt,"textSanitizer");function Zt(e){Kt=e}t(Zt,"setTmpSVGG");function Jt(e){if(e==="horizontal")dt.chartOrientation="horizontal";else dt.chartOrientation="vertical"}t(Jt,"setOrientation");function ee(e){b.xAxis.title=rt(e.text)}t(ee,"setXAxisTitle");function Ot(e,i){b.xAxis={type:"linear",title:b.xAxis.title,min:e,max:i},wt=!0}t(Ot,"setXAxisRangeData");function ie(e){b.xAxis={type:"band",title:b.xAxis.title,categories:e.map((i)=>rt(i.text))},wt=!0}t(ie,"setXAxisBand");function se(e){b.yAxis.title=rt(e.text)}t(se,"setYAxisTitle");function ne(e,i){b.yAxis={type:"linear",title:b.yAxis.title,min:e,max:i},Et=!0}t(ne,"setYAxisRangeData");function ae(e){let i=Math.min(...e),s=Math.max(...e),n=ct(b.yAxis)?b.yAxis.min:1/0,a=ct(b.yAxis)?b.yAxis.max:-1/0;b.yAxis={type:"linear",title:b.yAxis.title,min:Math.min(n,i),max:Math.max(a,s)}}t(ae,"setYAxisRangeFromPlotData");function Vt(e){let i=[];if(e.length===0)return i;if(!wt){let s=ct(b.xAxis)?b.xAxis.min:1/0,n=ct(b.xAxis)?b.xAxis.max:-1/0;Ot(Math.min(s,1),Math.max(n,e.length))}if(yt(b.xAxis)&&e.length>b.xAxis.categories.length)e=e.slice(0,b.xAxis.categories.length);if(!Et)ae(e);if(yt(b.xAxis))i=b.xAxis.categories.map((s,n)=>[s,e[n]]);if(ct(b.xAxis)){let s=b.xAxis.min,n=b.xAxis.max;if(e.length===1)i=[[`${s}`,e[0]]];else{let a=(n-s)/(e.length-1);i=e.map((h,c)=>[`${s+c*a}`,h])}}return i}t(Vt,"transformDataWithoutCategory");function Ft(e){return Pt[e===0?0:e%Pt.length]}t(Ft,"getPlotColorFromPalette");function re(e,i){let s=i.map((c)=>c.value),n=i.map((c)=>c.label?rt(c.label):""),a=Vt(s),h=n.some((c)=>c!=="");b.plots.push({type:"line",title:rt(e.text),strokeFill:Ft(ut),strokeWidth:2,data:a,...h?{pointLabels:n}:{}}),ut++}t(re,"setLineData");function he(e,i){let s=i.map((a)=>a.value),n=Vt(s);b.plots.push({type:"bar",title:rt(e.text),fill:Ft(ut),data:n}),ut++}t(he,"setBarData");function le(){if(b.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return b.title=G(),Pe.build(dt,b,xt,Kt)}t(le,"getDrawableElem");function ce(){return xt}t(ce,"getChartThemeConfig");function ge(){return dt}t(ge,"getChartConfig");function ue(){return b}t(ue,"getXYChartData");var Le=t(function(){R(),ut=0,dt=Bt(),b=zt(),xt=It(),Pt=xt.plotColorPalette.split(",").map((e)=>e.trim()),wt=!1,Et=!1},"clear"),Ee={getDrawableElem:le,clear:Le,setAccTitle:L,getAccTitle:z,setDiagramTitle:j,getDiagramTitle:G,getAccDescription:U,setAccDescription:O,setOrientation:Jt,setXAxisTitle:ee,setXAxisRangeData:Ot,setXAxisBand:ie,setYAxisTitle:se,setYAxisRangeData:ne,setLineData:re,setBarData:he,setTmpSVGG:Zt,getChartThemeConfig:ce,getChartConfig:ge,getXYChartData:ue},Ie=t((e,i,s,n)=>{let a=n.db,h=a.getChartThemeConfig(),c=a.getChartConfig(),x=a.getXYChartData().plots[0].data.map((w)=>w[1]);function f(w){return w==="top"?"text-before-edge":"middle"}t(f,"getDominantBaseLine");function S(w){return w==="left"?"start":w==="right"?"end":"middle"}t(S,"getTextAnchor");function D(w){return`translate(${w.x}, ${w.y}) rotate(${w.rotation||0})`}t(D,"getTextTransformation"),l.debug(`Rendering xychart chart
7
7
  `+e);let _=de(i),y=_.append("g").attr("class","main"),F=y.append("rect").attr("width",c.width).attr("height",c.height).attr("class","background");te(_,c.height,c.width,!0),_.attr("viewBox",`0 0 ${c.width} ${c.height}`),F.attr("fill",h.backgroundColor),a.setTmpSVGG(_.append("g").attr("class","mermaid-tmp-group"));let I=a.getDrawableElem(),M={};function W(w){let Y=y,u="";for(let[N]of w.entries()){let H=y;if(N>0&&M[u])H=M[u];if(u+=w[N],Y=M[u],!Y)Y=M[u]=H.append("g").attr("class",w[N])}return Y}t(W,"getGroup");for(let w of I){if(w.data.length===0)continue;let Y=W(w.groupTexts);switch(w.type){case"rect":if(Y.selectAll("rect").data(w.data).enter().append("rect").attr("x",(u)=>u.x).attr("y",(u)=>u.y).attr("width",(u)=>u.width).attr("height",(u)=>u.height).attr("fill",(u)=>u.fill).attr("stroke",(u)=>u.strokeFill).attr("stroke-width",(u)=>u.strokeWidth),c.showDataLabel){let u=c.showDataLabelOutsideBar;if(c.chartOrientation==="horizontal"){let N=function(k,tt){let{data:T,label:q}=k;return tt*q.length*H<=T.width-A};var J=N;t(N,"fitsHorizontally");let H=0.7,A=10,st=w.data.map((k,tt)=>({data:k,label:x[tt].toString()})).filter((k)=>k.data.width>0&&k.data.height>0),B=st.map((k)=>{let{data:tt}=k,T=tt.height*0.7;while(!N(k,T)&&T>0)T-=1;return T}),ht=Math.floor(Math.min(...B)),v=t((k)=>{if(u)return k.data.x+k.data.width+A;else return k.data.x+k.data.width-A},"determineLabelXPosition");Y.selectAll("text").data(st).enter().append("text").attr("x",v).attr("y",(k)=>k.data.y+k.data.height/2).attr("text-anchor",u?"start":"end").attr("dominant-baseline","middle").attr("fill",h.dataLabelColor).attr("font-size",`${ht}px`).text((k)=>k.label)}else{let N=function(v,k,tt){let{data:T,label:q}=v,r=0.7,g=k*q.length*0.7,d=T.x+T.width/2,p=d-g/2,C=d+g/2,o=p>=T.x&&C<=T.x+T.width,nt=T.y+tt+k<=T.y+T.height;return o&&nt};var et=N;t(N,"fitsInBar");let H=10,A=w.data.map((v,k)=>({data:v,label:x[k].toString()})).filter((v)=>v.data.width>0&&v.data.height>0),st=A.map((v)=>{let{data:k,label:tt}=v,T=k.width/(tt.length*0.7);while(!N(v,T,H)&&T>0)T-=1;return T}),B=Math.floor(Math.min(...st)),ht=t((v)=>{if(u)return v.data.y-H;else return v.data.y+H},"determineLabelYPosition");Y.selectAll("text").data(A).enter().append("text").attr("x",(v)=>v.data.x+v.data.width/2).attr("y",ht).attr("text-anchor","middle").attr("dominant-baseline",u?"auto":"hanging").attr("fill",h.dataLabelColor).attr("font-size",`${B}px`).text((v)=>v.label)}}break;case"text":Y.selectAll("text").data(w.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",(u)=>u.fill).attr("font-size",(u)=>u.fontSize).attr("dominant-baseline",(u)=>f(u.verticalPos)).attr("text-anchor",(u)=>S(u.horizontalPos)).attr("transform",(u)=>D(u)).text((u)=>u.text);break;case"path":Y.selectAll("path").data(w.data).enter().append("path").attr("d",(u)=>u.path).attr("fill",(u)=>u.fill?u.fill:"none").attr("stroke",(u)=>u.strokeFill).attr("stroke-width",(u)=>u.strokeWidth);break}}},"draw"),Me={draw:Ie},Ke={parser:be,db:Ee,renderer:Me};export{Ke as diagram};
@@ -0,0 +1 @@
1
+ import{Rf}from"./index-vq6wts05.js";export{Rf as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kabmo-labs/kabmo",
3
- "version": "0.34.0",
3
+ "version": "0.35.0",
4
4
  "description": "Web console and diagnostic workbench for AI coding agents: Elysia + Preact on Bun.",
5
5
  "license": "MIT",
6
6
  "author": "Wijanarko Putra Rajeb <wijanarko.rajeb@gmail.com>",
@@ -0,0 +1,159 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The pairing dialog's Copy link button.
8
+ *
9
+ * The bug this pins: the button called `navigator.clipboard?.writeText(...)`.
10
+ * Kabmo is routinely opened over plain HTTP on a LAN or Tailscale address — the
11
+ * exact setup the dialog exists for — and `navigator.clipboard` is undefined
12
+ * outside a secure context, so the optional chain swallowed the click with no
13
+ * copy and no feedback. The button now goes through `copyToClipboard` (which
14
+ * falls back to `execCommand`) and reports the outcome as a toast.
15
+ */
16
+
17
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
18
+ import { Window } from 'happy-dom';
19
+ import { h, render } from 'preact';
20
+ import { act } from 'preact/test-utils';
21
+ import { PairDialog } from '@/client/components/settings/categories/connect-settings/PairDialog';
22
+ import { getToastsSnapshot, resetToasts } from '@/client/hooks/ui/toasts';
23
+ import type { PairingCode } from '@/client/hooks/connect/use-pairing';
24
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
25
+
26
+ let win: Window;
27
+ let container: HTMLElement | null = null;
28
+
29
+ const CODE: PairingCode = {
30
+ pairingId: 'pair-1',
31
+ expiresAt: new Date(Date.now() + 120_000).toISOString(),
32
+ link: 'kabmo://pair#abc',
33
+ webLink: 'https://kabmo.example/pair#abc',
34
+ candidates: [{ kind: 'lan', url: 'http://192.168.1.5:3000' }],
35
+ qr: { size: 1, rows: ['1'] },
36
+ };
37
+
38
+ beforeAll(() => {
39
+ win = new Window({ url: 'http://192.168.1.5:3000' });
40
+ installDomGlobals(win);
41
+ });
42
+
43
+ afterEach(() => {
44
+ if (container) {
45
+ render(null, container);
46
+ container.remove();
47
+ }
48
+ container = null;
49
+ document.body.replaceChildren();
50
+ resetToasts();
51
+ // The dialog portals to `<body>`; unmounting the host does not remove it.
52
+ for (const node of document.querySelectorAll('[role="dialog"]')) node.remove();
53
+ });
54
+
55
+ afterAll(() => {
56
+ restoreDomGlobals();
57
+ });
58
+
59
+ /** Mount the dialog and return the button whose label is `label`. */
60
+ async function mountButton(label: string): Promise<HTMLButtonElement> {
61
+ const host = document.createElement('div');
62
+ document.body.appendChild(host);
63
+ container = host;
64
+ await act(async () => {
65
+ render(
66
+ h(PairDialog, {
67
+ code: CODE,
68
+ error: null,
69
+ busy: false,
70
+ secondsLeft: 90,
71
+ onClose: () => {},
72
+ onRetry: () => {},
73
+ }),
74
+ host,
75
+ );
76
+ });
77
+ const button = [...document.querySelectorAll('button')].find((node) => node.textContent === label);
78
+ if (!button) throw new Error(`${label} button not found`);
79
+ return button;
80
+ }
81
+
82
+ /** Make the page look like an insecure LAN origin: no async clipboard API. */
83
+ function removeClipboardApi(): void {
84
+ Object.defineProperty(win, 'isSecureContext', { value: false, configurable: true });
85
+ Object.defineProperty(win.navigator, 'clipboard', { value: undefined, configurable: true });
86
+ }
87
+
88
+ describe('PairDialog copy link', () => {
89
+ test('copies through the execCommand fallback when the clipboard API is unavailable', async () => {
90
+ removeClipboardApi();
91
+ let copied = '';
92
+ document.execCommand = ((command: string) => {
93
+ if (command !== 'copy') return false;
94
+ copied = document.querySelector('textarea')?.value ?? '';
95
+ return true;
96
+ }) as typeof document.execCommand;
97
+
98
+ const button = await mountButton('Copy link');
99
+ await act(async () => {
100
+ button.click();
101
+ });
102
+
103
+ expect(copied).toBe(CODE.webLink);
104
+ expect(getToastsSnapshot().map((toast) => [toast.message, toast.type])).toEqual([
105
+ ['Pairing link copied', 'success'],
106
+ ]);
107
+ });
108
+
109
+ test('reports a failure instead of silently doing nothing', async () => {
110
+ removeClipboardApi();
111
+ document.execCommand = (() => false) as typeof document.execCommand;
112
+
113
+ const button = await mountButton('Copy link');
114
+ await act(async () => {
115
+ button.click();
116
+ });
117
+
118
+ const toasts = getToastsSnapshot();
119
+ expect(toasts).toHaveLength(1);
120
+ expect(toasts[0]?.type).toBe('error');
121
+ expect(toasts[0]?.message).toContain('Could not copy the pairing link');
122
+ });
123
+ });
124
+
125
+ describe('PairDialog download QR', () => {
126
+ test('saves the code as an SVG file with the quiet zone included', async () => {
127
+ const blobs: Blob[] = [];
128
+ const clicked: { href: string; download: string }[] = [];
129
+ const nativeCreate = URL.createObjectURL;
130
+ const nativeRevoke = URL.revokeObjectURL;
131
+ const nativeClick = win.HTMLAnchorElement.prototype.click;
132
+ URL.createObjectURL = (blob: Blob | MediaSource) => {
133
+ blobs.push(blob as Blob);
134
+ return 'blob:qr';
135
+ };
136
+ URL.revokeObjectURL = () => {};
137
+ win.HTMLAnchorElement.prototype.click = function click(this: HTMLAnchorElement) {
138
+ clicked.push({ href: this.href, download: this.download });
139
+ };
140
+
141
+ try {
142
+ const button = await mountButton('Download QR');
143
+ await act(async () => {
144
+ button.click();
145
+ });
146
+
147
+ expect(clicked).toEqual([{ href: 'blob:qr', download: 'kabmo-pairing-qr.svg' }]);
148
+ expect(blobs[0]?.type).toBe('image/svg+xml');
149
+ const markup = await blobs[0]!.text();
150
+ // size 1 + four modules of quiet zone on each side.
151
+ expect(markup).toContain('viewBox="0 0 9 9"');
152
+ expect(markup).toContain('<rect x="4" y="4" width="1" height="1"/>');
153
+ } finally {
154
+ URL.createObjectURL = nativeCreate;
155
+ URL.revokeObjectURL = nativeRevoke;
156
+ win.HTMLAnchorElement.prototype.click = nativeClick;
157
+ }
158
+ });
159
+ });
@@ -22,6 +22,9 @@ import { useEffect } from 'preact/hooks';
22
22
  import { createPortal } from 'preact/compat';
23
23
  import { X } from 'lucide-preact';
24
24
  import { QrCode } from '@/client/components/settings/categories/connect-settings/QrCode';
25
+ import { downloadQrSvg } from '@/client/components/settings/categories/connect-settings/qr-image';
26
+ import { copyToClipboard } from '@/client/hooks/ui/clipboard';
27
+ import { pushToast } from '@/client/hooks/ui/toasts';
25
28
  import type { PairingCode } from '@/client/hooks/connect/use-pairing';
26
29
 
27
30
  const ROUTE_LABEL: Record<string, string> = {
@@ -45,6 +48,23 @@ function clock(seconds: number): string {
45
48
  return `${minutes}:${String(rest).padStart(2, '0')}`;
46
49
  }
47
50
 
51
+ /**
52
+ * Copy the pairing link and say what happened.
53
+ *
54
+ * `navigator.clipboard` is undefined outside a secure context, and Kabmo is
55
+ * routinely opened over plain HTTP on a LAN or Tailscale address — the exact
56
+ * setup this dialog exists for. The old `navigator.clipboard?.writeText(...)`
57
+ * therefore did nothing at all there, with no feedback. `copyToClipboard` falls
58
+ * back to `execCommand`, and the toast reports the outcome either way.
59
+ */
60
+ async function copyPairingLink(link: string): Promise<void> {
61
+ const ok = await copyToClipboard(link);
62
+ pushToast(
63
+ ok ? 'Pairing link copied' : 'Could not copy the pairing link — select it from the routes list instead.',
64
+ ok ? 'success' : 'error',
65
+ );
66
+ }
67
+
48
68
  export function PairDialog({ code, error, busy, secondsLeft, onClose, onRetry }: PairDialogProps) {
49
69
  useEffect(() => {
50
70
  const onKey = (event: KeyboardEvent) => {
@@ -125,13 +145,22 @@ export function PairDialog({ code, error, busy, secondsLeft, onClose, onRetry }:
125
145
  </div>
126
146
 
127
147
  <div className="mt-4 flex items-center justify-between gap-2">
128
- <button
129
- type="button"
130
- onClick={() => void navigator.clipboard?.writeText(code.webLink).catch(() => {})}
131
- className="rounded-lg border border-ink/15 px-2.5 py-1.5 text-[11px] font-semibold text-ink transition-colors hover:bg-ink/5"
132
- >
133
- Copy link
134
- </button>
148
+ <div className="flex items-center gap-2">
149
+ <button
150
+ type="button"
151
+ onClick={() => void copyPairingLink(code.webLink)}
152
+ className="rounded-lg border border-ink/15 px-2.5 py-1.5 text-[11px] font-semibold text-ink transition-colors hover:bg-ink/5"
153
+ >
154
+ Copy link
155
+ </button>
156
+ <button
157
+ type="button"
158
+ onClick={() => downloadQrSvg(code.qr, 'kabmo-pairing-qr.svg', 'Pairing QR code')}
159
+ className="rounded-lg border border-ink/15 px-2.5 py-1.5 text-[11px] font-semibold text-ink transition-colors hover:bg-ink/5"
160
+ >
161
+ Download QR
162
+ </button>
163
+ </div>
135
164
  <div className="flex items-center gap-2">
136
165
  {expired && (
137
166
  <button
@@ -17,28 +17,11 @@
17
17
  */
18
18
 
19
19
  import type { JSX } from 'preact';
20
+ import { QUIET_ZONE, qrGeometry } from '@/client/components/settings/categories/connect-settings/qr-image';
20
21
  import type { QrMatrix } from '@/shared/lib/connect/types';
21
22
 
22
- const QUIET_ZONE = 4;
23
-
24
- /**
25
- * The widest the code is drawn, in CSS pixels.
26
- *
27
- * A screenshot of this dialog is what a camera-less device uploads, so the size
28
- * is a functional choice, not a layout one: at 260 px a ~100-module code is under
29
- * 3 px per module, and `jsQR` failed to read a real capture of it ("no QR code
30
- * found") while the same code at 4 px per module decoded every time.
31
- */
32
- const TARGET_EDGE = 340;
33
-
34
23
  export function QrCode({ matrix, label }: { matrix: QrMatrix; label: string }) {
35
- const span = matrix.size + QUIET_ZONE * 2;
36
- // An INTEGER number of pixels per module. A fractional size makes the browser
37
- // antialias every module edge, which is exactly what a binarizer cannot read —
38
- // and it is why the same code scanned from a phone camera but not from a
39
- // screenshot.
40
- const modulePx = Math.max(3, Math.floor(TARGET_EDGE / span));
41
- const edge = span * modulePx;
24
+ const { span, edge } = qrGeometry(matrix);
42
25
  const rects: JSX.Element[] = [];
43
26
  for (let row = 0; row < matrix.size; row += 1) {
44
27
  const line = matrix.rows[row] ?? '';
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The pairing QR as a file.
8
+ *
9
+ * The download hands the user the same drawing the dialog shows, not a
10
+ * screenshot of it: the geometry (quiet zone, integer pixels per module) is
11
+ * shared with `QrCode`, so a saved code scans exactly like the one on screen.
12
+ * A PNG re-encode would resample module edges — the failure the on-screen
13
+ * renderer already avoids by drawing whole pixels.
14
+ */
15
+
16
+ import { saveBlob } from '@/client/lib/browser/download';
17
+ import type { QrMatrix } from '@/shared/lib/connect/types';
18
+
19
+ export const QUIET_ZONE = 4;
20
+
21
+ /**
22
+ * The widest the code is drawn, in CSS pixels.
23
+ *
24
+ * A screenshot of this dialog is what a camera-less device uploads, so the size
25
+ * is a functional choice, not a layout one: at 260 px a ~100-module code is under
26
+ * 3 px per module, and `jsQR` failed to read a real capture of it ("no QR code
27
+ * found") while the same code at 4 px per module decoded every time.
28
+ */
29
+ export const TARGET_EDGE = 340;
30
+
31
+ export interface QrGeometry {
32
+ span: number;
33
+ modulePx: number;
34
+ edge: number;
35
+ }
36
+
37
+ /**
38
+ * The drawing's dimensions. `modulePx` is an INTEGER: a fractional size makes
39
+ * the browser antialias every module edge, which is exactly what a binarizer
40
+ * cannot read — and it is why the same code scanned from a phone camera but not
41
+ * from a screenshot.
42
+ */
43
+ export function qrGeometry(matrix: QrMatrix): QrGeometry {
44
+ const span = matrix.size + QUIET_ZONE * 2;
45
+ const modulePx = Math.max(3, Math.floor(TARGET_EDGE / span));
46
+ return { span, modulePx, edge: span * modulePx };
47
+ }
48
+
49
+ function escapeXml(value: string): string {
50
+ return value.replace(/[&<>"']/g, (char) => `&#${char.charCodeAt(0)};`);
51
+ }
52
+
53
+ /** The QR as a standalone SVG document, quiet zone included. */
54
+ export function qrSvgMarkup(matrix: QrMatrix, label: string): string {
55
+ const { span, edge } = qrGeometry(matrix);
56
+ const rects: string[] = [];
57
+ for (let row = 0; row < matrix.size; row += 1) {
58
+ const line = matrix.rows[row] ?? '';
59
+ for (let column = 0; column < matrix.size; column += 1) {
60
+ if (line[column] !== '1') continue;
61
+ rects.push(`<rect x="${column + QUIET_ZONE}" y="${row + QUIET_ZONE}" width="1" height="1"/>`);
62
+ }
63
+ }
64
+ return [
65
+ `<svg xmlns="http://www.w3.org/2000/svg" role="img" aria-label="${escapeXml(label)}"`,
66
+ ` viewBox="0 0 ${span} ${span}" width="${edge}" height="${edge}" shape-rendering="crispEdges">`,
67
+ `<rect width="${span}" height="${span}" fill="#ffffff"/>`,
68
+ `<g fill="#141310">${rects.join('')}</g>`,
69
+ '</svg>',
70
+ ].join('');
71
+ }
72
+
73
+ /** Hand the QR to the browser as a downloadable SVG named `name`. */
74
+ export function downloadQrSvg(matrix: QrMatrix, name: string, label: string): void {
75
+ saveBlob(new Blob([qrSvgMarkup(matrix, label)], { type: 'image/svg+xml' }), name);
76
+ }
@@ -23,6 +23,7 @@ import { h, render } from 'preact';
23
23
  import { act } from 'preact/test-utils';
24
24
  import { GitPanel } from '@/client/components/workspace/git-panel';
25
25
  import { SessionStateProvider } from '@/client/components/common/session-state-provider/index';
26
+ import { resetToasts } from '@/client/hooks/ui/toasts';
26
27
  import { resetRealtimeClient } from '@/shared/lib/realtime/client';
27
28
  import { gitTopic, reposTopic } from '@/shared/lib/realtime/protocol';
28
29
  import { startRealtimeTestServer, type RealtimeTestServer } from '@/test-support/realtime-server';
@@ -65,6 +66,10 @@ afterEach(() => {
65
66
  container.remove();
66
67
  }
67
68
  resetRealtimeClient();
69
+ // The Initialize click pushes a real toast into the module-level queue, which
70
+ // outlives this file: without this, the next file that asserts the queue sees
71
+ // "Initialized the repository" (measured: PairDialog.test.tsx failed on Windows).
72
+ resetToasts();
68
73
  server?.stop();
69
74
  });
70
75
 
@@ -21,6 +21,7 @@
21
21
 
22
22
  import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
23
23
  import { concatSamples, float32ToPcm16 } from '@/shared/lib/dictation/audio';
24
+ import { describeCaptureFailure } from '@/shared/lib/dictation/capture-failure';
24
25
  import { DICTATION_SAMPLE_RATE } from '@/shared/lib/dictation/protocol';
25
26
  import type { DictationServerFrame } from '@/shared/lib/dictation/protocol';
26
27
 
@@ -117,26 +118,32 @@ export function useSpeechToText({ onResult, modelKey, language }: UseSpeechToTex
117
118
  .getUserMedia({ audio: true })
118
119
  .then((stream) => {
119
120
  streamRef.current = stream;
120
- const context = new AudioContext({ sampleRate: DICTATION_SAMPLE_RATE });
121
- contextRef.current = context;
122
- inputRateRef.current = context.sampleRate;
123
-
124
- const source = context.createMediaStreamSource(stream);
125
- sourceRef.current = source;
126
- const processor = context.createScriptProcessor(4096, 1, 1);
127
- processorRef.current = processor;
128
- processor.onaudioprocess = (event) => {
129
- chunksRef.current.push(new Float32Array(event.inputBuffer.getChannelData(0)));
130
- };
131
- source.connect(processor);
132
- processor.connect(context.destination);
133
- setIsListening(true);
121
+ try {
122
+ const context = new AudioContext({ sampleRate: DICTATION_SAMPLE_RATE });
123
+ contextRef.current = context;
124
+ inputRateRef.current = context.sampleRate;
125
+
126
+ const source = context.createMediaStreamSource(stream);
127
+ sourceRef.current = source;
128
+ const processor = context.createScriptProcessor(4096, 1, 1);
129
+ processorRef.current = processor;
130
+ processor.onaudioprocess = (event) => {
131
+ chunksRef.current.push(new Float32Array(event.inputBuffer.getChannelData(0)));
132
+ };
133
+ source.connect(processor);
134
+ processor.connect(context.destination);
135
+ setIsListening(true);
136
+ } catch {
137
+ // The microphone IS open at this point, so the failure is the audio
138
+ // graph, not the permission — and the stream has to be released or
139
+ // the OS keeps showing the microphone in use.
140
+ fail('Could not start audio capture.');
141
+ }
134
142
  })
135
143
  .catch((cause: unknown) => {
136
- const name = cause instanceof DOMException ? cause.name : '';
137
- setError(name === 'NotAllowedError' ? 'Microphone permission denied.' : 'Could not open the microphone.');
144
+ setError(describeCaptureFailure(cause));
138
145
  });
139
- }, [isSupported]);
146
+ }, [fail, isSupported]);
140
147
 
141
148
  const stopListening = useCallback(() => {
142
149
  setIsListening(false);