@kabmo-labs/kabmo 0.32.0 → 0.33.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 (303) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +537 -530
  3. package/dist/client/static/js/{CsvGrid-amafmq3z.js → CsvGrid-fncjbg6j.js} +2 -2
  4. package/dist/client/static/js/{DocxView-851ps9t0.js → DocxView-c9v2vr3r.js} +5 -5
  5. package/dist/client/static/js/{DrawioView-kw1vy3r2.js → DrawioView-vxjksm12.js} +2 -2
  6. package/dist/client/static/js/ImageView-a3g5k226.js +1 -0
  7. package/dist/client/static/js/LayoutWrapper-hnjfwsjh.js +2 -0
  8. package/dist/client/static/js/Modal-qtftcp2t.js +38 -0
  9. package/dist/client/static/js/{PdfView-f5jkm0rs.js → PdfView-ksaes53y.js} +1 -1
  10. package/dist/client/static/js/SessionsView-30vcr95v.js +1 -0
  11. package/dist/client/static/js/{SheetView-23zxy30b.js → SheetView-vc484scg.js} +23 -23
  12. package/dist/client/static/js/{SvgPreview-c341y50e.js → SvgPreview-tph89jet.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-2dc3mpk6.js → abnfDiagram-O67JEVCF-xbar278c.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-tavtgb8a.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-7jmrr5ja.js → architectureDiagram-NJMV4G6O-s171n2z6.js} +3 -3
  16. package/dist/client/static/js/{astro-sjtf954j.js → astro-80bs6hvg.js} +1 -1
  17. package/dist/client/static/js/bash-b3rwyg5p.js +1 -0
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-jrk2m0ea.js → blockDiagram-BEXU5L5S-gzx6rv9n.js} +3 -3
  19. package/dist/client/static/js/c-wkgxb1t1.js +1 -0
  20. package/dist/client/static/js/{c4Diagram-YGBWAQC7-48cyncjd.js → c4Diagram-YGBWAQC7-7f00skch.js} +2 -2
  21. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-gm7jt1cd.js → classDiagram-v2-NBCMYWYE-j79v95nc.js} +4 -4
  22. package/dist/client/static/js/{cose-bilkent-JH36ORCC-g0g3z0xp.js → cose-bilkent-JH36ORCC-5fkn7ee5.js} +1 -1
  23. package/dist/client/static/js/cpp-y0t6mynx.js +1 -0
  24. package/dist/client/static/js/css-6vj0d308.js +1 -0
  25. package/dist/client/static/js/cynefin-OW5HDTMX-cdh3n2z2.js +1 -0
  26. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-6vjde6am.js → cynefinDiagram-VND7K2PF-cfs1yvrd.js} +1 -1
  27. package/dist/client/static/js/{dagre-6A5THRUB-q6k8bx1j.js → dagre-6A5THRUB-44bgc48p.js} +2 -2
  28. package/dist/client/static/js/{diagram-22UHCM2B-87cmze2n.js → diagram-22UHCM2B-a4g4x83k.js} +19 -19
  29. package/dist/client/static/js/{diagram-3UASUU5V-1ejbr2p4.js → diagram-3UASUU5V-gm4rg5na.js} +1 -1
  30. package/dist/client/static/js/{diagram-ATOU4E4O-vaw1r6k2.js → diagram-ATOU4E4O-a95y41vk.js} +3 -3
  31. package/dist/client/static/js/{diagram-CDSNMT55-gxm9zv7d.js → diagram-CDSNMT55-t3j93mmc.js} +5 -5
  32. package/dist/client/static/js/{diagram-MLGK6HIB-x010xswm.js → diagram-MLGK6HIB-c2wdez02.js} +1 -1
  33. package/dist/client/static/js/{diagram-MPIPVDR6-qtcq7e6c.js → diagram-MPIPVDR6-gya9jhs5.js} +2 -2
  34. package/dist/client/static/js/{dockerfile-k5xbramm.js → dockerfile-a7q6174s.js} +1 -1
  35. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-nwwbasfh.js → ebnfDiagram-ZINNZB2B-jjhkza6t.js} +1 -1
  36. package/dist/client/static/js/{elk-276RUBZZ-xcp7thax.js → elk-276RUBZZ-f7re45mw.js} +1 -1
  37. package/dist/client/static/js/{erDiagram-OPXOYQCR-xj1tp716.js → erDiagram-OPXOYQCR-tpm9g5te.js} +6 -6
  38. package/dist/client/static/js/{erlang-rz1g9mxy.js → erlang-qt876zrq.js} +1 -1
  39. package/dist/client/static/js/eventmodeling-NTZA5JFV-as97tpyp.js +1 -0
  40. package/dist/client/static/js/flowDiagram-KWPJA3E3-ggm06d12.js +1 -0
  41. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-f7q96bea.js → ganttDiagram-FUAMR5RP-fz43n12d.js} +4 -4
  42. package/dist/client/static/js/gitGraph-4MIJSDKK-eqz7p9ng.js +1 -0
  43. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-1rydkyq9.js → gitGraphDiagram-X574FWY7-f61hgbn6.js} +9 -9
  44. package/dist/client/static/js/graphql-n43pd5fs.js +1 -0
  45. package/dist/client/static/js/{index-0g25yrc0.js → index-03h3bkcf.js} +1 -1
  46. package/dist/client/static/js/{index-8m3q2zpb.js → index-0e40xskg.js} +1 -1
  47. package/dist/client/static/js/{index-w5131mtt.js → index-0n5wwe60.js} +2 -2
  48. package/dist/client/static/js/{index-ynqnbvn2.js → index-0tf0arsp.js} +3 -3
  49. package/dist/client/static/js/{index-0a1ekhqf.js → index-14vndmcr.js} +2 -2
  50. package/dist/client/static/js/index-1a0zkj8h.js +2 -0
  51. package/dist/client/static/js/{index-zca66d5d.js → index-1xqs14fr.js} +3 -3
  52. package/dist/client/static/js/{index-73xfkyea.js → index-1y9r4frb.js} +2 -2
  53. package/dist/client/static/js/{index-0n9c85ke.js → index-2svnq5gg.js} +2 -2
  54. package/dist/client/static/js/{index-pe9j88d4.js → index-2x5f66t6.js} +2 -2
  55. package/dist/client/static/js/{index-ggaqh9rt.js → index-354mqqra.js} +2 -2
  56. package/dist/client/static/js/{index-2t2tnc3x.js → index-3rcjx70v.js} +1 -1
  57. package/dist/client/static/js/{index-9nbxb421.js → index-3zc1b0dv.js} +2 -2
  58. package/dist/client/static/js/{index-14wppnkx.js → index-5tgq7aqx.js} +2 -2
  59. package/dist/client/static/js/{index-vrbcj11n.js → index-76zb4m0n.js} +2 -2
  60. package/dist/client/static/js/{index-x64kqgen.js → index-7y6rpsrp.js} +2 -2
  61. package/dist/client/static/js/{index-2n5wy1sh.js → index-8239j2v1.js} +1 -1
  62. package/dist/client/static/js/{index-pkyrkkbt.js → index-9fjt5anh.js} +2 -2
  63. package/dist/client/static/js/{index-m6wwc5h6.js → index-9t82sx0w.js} +2 -2
  64. package/dist/client/static/js/{index-hkq0y3pn.js → index-9y3gjdj7.js} +2 -2
  65. package/dist/client/static/js/{index-hyry1n8x.js → index-ahv9y42z.js} +2 -2
  66. package/dist/client/static/js/{index-f519m6s3.js → index-ajs3jj6j.js} +1 -1
  67. package/dist/client/static/js/index-apvkd37e.js +4 -0
  68. package/dist/client/static/js/index-at6bhjyf.js +1 -0
  69. package/dist/client/static/js/index-bkye8mz4.js +2 -0
  70. package/dist/client/static/js/{index-e7a3fkvv.js → index-d495kfm0.js} +1 -1
  71. package/dist/client/static/js/{index-hhm62nfj.js → index-dbe6afkf.js} +2 -2
  72. package/dist/client/static/js/{index-c20a46ww.js → index-djmg1d7h.js} +2 -2
  73. package/dist/client/static/js/{index-fc2j6bq2.js → index-e4p4cd3r.js} +2 -2
  74. package/dist/client/static/js/{index-f63y3mjj.js → index-eyzeya95.js} +5 -5
  75. package/dist/client/static/js/{index-123e8tqq.js → index-gcs49f3p.js} +1 -1
  76. package/dist/client/static/js/{index-c8jzx6b0.js → index-gs6f0qwa.js} +2 -2
  77. package/dist/client/static/js/{index-6sdctwv2.js → index-hf52f59k.js} +2 -2
  78. package/dist/client/static/js/{index-3anc30zh.js → index-j0r5hj0j.js} +2 -2
  79. package/dist/client/static/js/{index-31jrebvn.js → index-js7t1vb1.js} +18 -18
  80. package/dist/client/static/js/{index-xa7nrnda.js → index-km2zb6wk.js} +2 -2
  81. package/dist/client/static/js/{index-yvcpdk5f.js → index-m73za75e.js} +1 -1
  82. package/dist/client/static/js/{index-e6rar25v.js → index-pbe4yed4.js} +2 -2
  83. package/dist/client/static/js/{index-xpf2ra60.js → index-pxv2nw9w.js} +1 -1
  84. package/dist/client/static/js/{index-deex10rz.js → index-q2w6s8n7.js} +5 -5
  85. package/dist/client/static/js/{index-22jaxtz1.js → index-qckv9nte.js} +2 -2
  86. package/dist/client/static/js/{index-e26rd868.js → index-qsm2z36d.js} +2 -2
  87. package/dist/client/static/js/{index-5zd1jx9r.js → index-rg8jpbsw.js} +2 -2
  88. package/dist/client/static/js/{index-gvwqjpcr.js → index-rytaa8ca.js} +2 -2
  89. package/dist/client/static/js/{index-fmxn1rzs.js → index-sdtye3jy.js} +2 -2
  90. package/dist/client/static/js/index-sffjtm5w.js +12 -0
  91. package/dist/client/static/js/{index-tr8754r0.js → index-trm9x02n.js} +45 -45
  92. package/dist/client/static/js/{index-cwaz6geq.js → index-vtbbfwx0.js} +2 -2
  93. package/dist/client/static/js/{index-vmvcse63.js → index-vw4brsdx.js} +1 -1
  94. package/dist/client/static/js/{index-qmh0h87h.js → index-vw5k8csz.js} +55 -55
  95. package/dist/client/static/js/{index-52bgxh6f.js → index-w0fwb80e.js} +1 -1
  96. package/dist/client/static/js/{index-s9vp6p70.js → index-x07kp3jz.js} +2 -2
  97. package/dist/client/static/js/{index-8a3tmm1h.js → index-xj9649ac.js} +7 -7
  98. package/dist/client/static/js/{index-w4re5r8w.js → index-ypx3qmhq.js} +2 -2
  99. package/dist/client/static/js/{index-y139vc12.js → index-zt75xpq0.js} +193 -193
  100. package/dist/client/static/js/{index-nsrnyqcm.js → index-zvfvqvn9.js} +2 -2
  101. package/dist/client/static/js/info-A6RAGUB7-4pkzh1qx.js +1 -0
  102. package/dist/client/static/js/{infoDiagram-VRGFBTTK-ptg07tp2.js → infoDiagram-VRGFBTTK-1qj804sn.js} +1 -1
  103. package/dist/client/static/js/ini-j5dyq6gm.js +1 -0
  104. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-bdk2dkf5.js → ishikawaDiagram-OU5B5YK6-4j4qsnzw.js} +3 -3
  105. package/dist/client/static/js/java-g4dgwbfd.js +1 -0
  106. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-kez0ha4c.js → journeyDiagram-ZHPQQLJL-j0brnfft.js} +4 -4
  107. package/dist/client/static/js/json-j5q8nt57.js +1 -0
  108. package/dist/client/static/js/jsx-7t5ecz9s.js +1 -0
  109. package/dist/client/static/js/{julia-nmr85k8z.js → julia-4ghmfy3e.js} +1 -1
  110. package/dist/client/static/js/{kanban-definition-PNTS6WVX-dhzp3qg5.js → kanban-definition-PNTS6WVX-qqc22br0.js} +3 -3
  111. package/dist/client/static/js/lua-1g6w30de.js +1 -0
  112. package/dist/client/static/js/markdown-afx21x8c.js +1 -0
  113. package/dist/client/static/js/{mermaid.core-h7wttbss.js → mermaid.core-vv3wbe65.js} +7 -7
  114. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-tq5dd1em.js → mindmap-definition-NLK3R4M7-y5b2z8zp.js} +4 -4
  115. package/dist/client/static/js/one-dark-pro-hm3f56n1.js +1 -0
  116. package/dist/client/static/js/one-light-xrz49rct.js +1 -0
  117. package/dist/client/static/js/packet-AYTQ26CC-yg71sp88.js +1 -0
  118. package/dist/client/static/js/{pegDiagram-GJSIUBJH-e5hrdfzv.js → pegDiagram-GJSIUBJH-0be07mqs.js} +1 -1
  119. package/dist/client/static/js/{perl-prxcva8r.js → perl-sd00t4b4.js} +1 -1
  120. package/dist/client/static/js/{php-m9kcctzs.js → php-2zfyqa61.js} +1 -1
  121. package/dist/client/static/js/pie-WAS4IAKB-89wd6np0.js +1 -0
  122. package/dist/client/static/js/{pieDiagram-5QR66LMP-axvbvnz8.js → pieDiagram-5QR66LMP-544w86jk.js} +2 -2
  123. package/dist/client/static/js/properties-thd83wey.js +1 -0
  124. package/dist/client/static/js/python-264ns4xw.js +1 -0
  125. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-wtn28cfm.js → quadrantDiagram-O4NWA36T-p09e7z5s.js} +4 -4
  126. package/dist/client/static/js/r-qw82kkv9.js +1 -0
  127. package/dist/client/static/js/radar-RG4KPBEZ-avn0b8r9.js +1 -0
  128. package/dist/client/static/js/railroad-74A4TZTK-de27xv5w.js +1 -0
  129. package/dist/client/static/js/railroad-abnf-HS5TGJTU-rg4zzj7x.js +1 -0
  130. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-d84fhj8v.js +1 -0
  131. package/dist/client/static/js/railroad-peg-WCYAUIDC-dvf8xrmc.js +1 -0
  132. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-avjkq945.js → railroadDiagram-XR7U4H2S-de830ed2.js} +1 -1
  133. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-bntx7r6q.js → requirementDiagram-PLB6GJNP-b47d74p1.js} +4 -4
  134. package/dist/client/static/js/{ruby-t06c0e7g.js → ruby-v9qaqhby.js} +1 -1
  135. package/dist/client/static/js/{rust-6gqjxyf0.js → rust-fkt0qyrs.js} +1 -1
  136. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-ps8nkdm2.js → sankeyDiagram-IPEJSGJF-6ezc2fpj.js} +5 -5
  137. package/dist/client/static/js/{sass-gsbyn3wh.js → sass-9bxped7y.js} +1 -1
  138. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-3ckf1q6z.js → sequenceDiagram-PO4LG4MO-by5zqj6w.js} +18 -18
  139. package/dist/client/static/js/{sizeCapture-INFHLROL-akvcr1x7.js → sizeCapture-INFHLROL-q85r06j6.js} +1 -1
  140. package/dist/client/static/js/sql-g8wcshpc.js +1 -0
  141. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-c82914fz.js → stateDiagram-v2-GCMORJYK-ep5pyexs.js} +3 -3
  142. package/dist/client/static/js/{svelte-j54gfrvq.js → svelte-mwtx07d9.js} +1 -1
  143. package/dist/client/static/js/{swimlanes-2SLR337P-scgdefh4.js → swimlanes-2SLR337P-95fcqkh8.js} +1 -1
  144. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-xs2en5dv.js +8 -0
  145. package/dist/client/static/js/{timeline-definition-EJHVYXUP-z2ha1rhq.js → timeline-definition-EJHVYXUP-461e615g.js} +2 -2
  146. package/dist/client/static/js/treeView-Q6P3EWNA-mham0bh6.js +1 -0
  147. package/dist/client/static/js/treemap-WGGIJYW6-mxrxax86.js +1 -0
  148. package/dist/client/static/js/tsx-nm94hed6.js +1 -0
  149. package/dist/client/static/js/typescript-0s2t05jj.js +1 -0
  150. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-3wdmrfmk.js → usecaseDiagram-POWQR4AR-ftqfnvhg.js} +38 -38
  151. package/dist/client/static/js/{vennDiagram-UO4OBE2U-7m5tatzv.js → vennDiagram-UO4OBE2U-7t96h6ez.js} +7 -7
  152. package/dist/client/static/js/{vue-y8bb5f3h.js → vue-j8vb9d7r.js} +1 -1
  153. package/dist/client/static/js/wardley-WFR3VGLG-8vrvh9p3.js +1 -0
  154. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-55ps9s4z.js → wardleyDiagram-VNRHLVJA-0de8w8c6.js} +4 -4
  155. package/dist/client/static/js/xml-dz51p1m3.js +1 -0
  156. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-8bsjtm4t.js → xychartDiagram-PMCCYNJV-dez9phkf.js} +5 -5
  157. package/dist/client/static/js/yaml-2cfkd30t.js +1 -0
  158. package/package.json +1 -1
  159. package/src/client/components/common/context-usage-button/McpSection.test.tsx +98 -0
  160. package/src/client/components/common/context-usage-button/McpSection.tsx +12 -5
  161. package/src/client/components/common/context-usage-button/SessionStats.tsx +80 -0
  162. package/src/client/components/common/context-usage-button/index.test.tsx +26 -0
  163. package/src/client/components/common/context-usage-button/index.tsx +36 -28
  164. package/src/client/components/common/harness-glyph/brands.ts +8 -0
  165. package/src/client/components/common/session-actions-menu/index.tsx +6 -1
  166. package/src/client/components/layout/session-sidebar/SessionsView.tsx +20 -33
  167. package/src/client/components/mobile/LayoutWrapper.tsx +28 -29
  168. package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +9 -2
  169. package/src/client/components/mobile/worktree-session.ts +4 -1
  170. package/src/client/components/settings/apply-side-effects.test.ts +11 -0
  171. package/src/client/components/settings/apply-side-effects.ts +7 -0
  172. package/src/client/components/settings/categories/ChatSettings.test.tsx +1 -1
  173. package/src/client/components/settings/categories/ChatSettings.tsx +2 -0
  174. package/src/client/components/settings/categories/NotificationSettings.tsx +1 -1
  175. package/src/client/components/settings/categories/chat-settings/ChangedFilesSection.tsx +79 -0
  176. package/src/client/components/settings/categories/chat-settings/groups.ts +4 -3
  177. package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.tsx +101 -0
  178. package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +16 -15
  179. package/src/client/components/workspace/chat-timeline/MessageList.tsx +33 -1
  180. package/src/client/components/workspace/chat-timeline/RunFooter.tsx +21 -1
  181. package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +13 -0
  182. package/src/client/components/workspace/chat-timeline/fork-preview.test.tsx +11 -0
  183. package/src/client/components/workspace/chat-timeline/index.tsx +1 -1
  184. package/src/client/components/workspace/diff-panel/Toolbar.tsx +17 -51
  185. package/src/client/components/workspace/diff-panel/index.tsx +23 -4
  186. package/src/client/components/workspace/diff-panel/toolbar-git-actions.tsx +94 -0
  187. package/src/client/components/workspace/editor/Body.tsx +2 -0
  188. package/src/client/data/settings/omp-schema.json +73 -3
  189. package/src/client/hooks/chat/btw/mode.ts +5 -1
  190. package/src/client/hooks/chat/omp/session-sidebar-controller.ts +9 -3
  191. package/src/client/hooks/chat/timeline/changed-files-setting.test.ts +31 -0
  192. package/src/client/hooks/chat/timeline/changed-files-setting.ts +60 -0
  193. package/src/client/hooks/chat/timeline/new-chat.ts +4 -1
  194. package/src/client/hooks/chat/timeline/pending-dispatch.ts +6 -10
  195. package/src/client/hooks/chat/timeline/session-changes.ts +51 -0
  196. package/src/client/hooks/chat/waiting/dispatch.ts +4 -1
  197. package/src/client/hooks/ui/notification-events.test.ts +3 -0
  198. package/src/client/hooks/ui/notification-events.ts +3 -1
  199. package/src/client/hooks/ui/notification-sound.ts +13 -6
  200. package/src/client/hooks/ui/ui-sounds.test.ts +15 -0
  201. package/src/client/hooks/workspace/batch-delete-run.ts +5 -1
  202. package/src/client/hooks/workspace/diff-file.ts +11 -4
  203. package/src/client/hooks/workspace/file-tabs.ts +13 -4
  204. package/src/client/hooks/workspace/journal-diff.ts +97 -0
  205. package/src/client/hooks/workspace/session-delete.ts +5 -1
  206. package/src/client/lib/notifications/native-banner-sound.test.ts +93 -0
  207. package/src/client/lib/notifications/native-banner-sound.ts +46 -0
  208. package/src/client/lib/notifications/os.test.ts +14 -5
  209. package/src/client/lib/notifications/os.ts +8 -0
  210. package/src/client/lib/router/branch-params.test.ts +62 -0
  211. package/src/client/lib/router/branch-params.ts +48 -0
  212. package/src/server/lib/assets/shell-settings.server.test.ts +35 -0
  213. package/src/server/lib/assets/shell-settings.server.ts +33 -0
  214. package/src/server/lib/harness/launch-table.ts +10 -0
  215. package/src/server/lib/omp/session/changes.test.ts +138 -0
  216. package/src/server/lib/omp/session/changes.ts +220 -0
  217. package/src/server/lib/omp/session/session-discovery.test.ts +4 -4
  218. package/src/server/lib/omp/session/sidebar-activity.server.test.ts +6 -2
  219. package/src/server/lib/omp/session/subagent-presence-scan.ts +54 -0
  220. package/src/server/lib/omp/session/subagent-presence-store.test.ts +1 -1
  221. package/src/server/lib/omp/session/subagent-presence.test.ts +115 -0
  222. package/src/server/lib/omp/session/subagent-presence.ts +12 -3
  223. package/src/server/lib/omp/session/telemetry/compute.ts +68 -0
  224. package/src/server/lib/omp/session/telemetry.test.ts +81 -0
  225. package/src/server/lib/realtime/topics/peer-relay.server.test.ts +1 -11
  226. package/src/server/plugins/ssr.ts +20 -8
  227. package/src/server/routes/sessions/changes.test.ts +90 -0
  228. package/src/server/routes/sessions/changes.ts +55 -0
  229. package/src/server/routes/sessions/index.ts +6 -0
  230. package/src/shared/lib/chat/duration.ts +34 -0
  231. package/src/shared/lib/chat/timeline/changed-files.test.ts +121 -0
  232. package/src/shared/lib/chat/timeline/changed-files.ts +71 -0
  233. package/src/shared/lib/chat/timeline/fork-anchor.test.ts +3 -0
  234. package/src/shared/lib/format/duration.test.ts +31 -0
  235. package/src/shared/lib/format/duration.ts +27 -0
  236. package/src/shared/lib/fs/unified-diff.test.ts +53 -0
  237. package/src/shared/lib/fs/unified-diff.ts +127 -0
  238. package/src/shared/lib/harness/brand-color.ts +3 -0
  239. package/src/shared/lib/harness/catalog.test.ts +13 -0
  240. package/src/shared/lib/harness/catalog.ts +8 -1
  241. package/src/shared/lib/harness/fork.ts +4 -2
  242. package/src/shared/lib/harness/mcp-facts.ts +3 -0
  243. package/src/shared/lib/harness/provider-facts.ts +14 -0
  244. package/src/shared/lib/harness/updates.ts +5 -0
  245. package/src/shared/lib/icons/tint-hues.generated.ts +27 -27
  246. package/src/shared/lib/omp/config/schema.test.ts +4 -2
  247. package/src/shared/lib/settings/defaults.ts +1 -0
  248. package/src/shared/lib/workspace/file-tab-id.ts +9 -0
  249. package/src/shared/types/context.ts +18 -0
  250. package/src/shared/types/fs.ts +21 -0
  251. package/src/shared/types/index.ts +1 -0
  252. package/src/shared/types/omp/session.ts +6 -0
  253. package/src/shared/types/session-changes.ts +58 -0
  254. package/src/shared/types/settings/state.ts +8 -0
  255. package/src/test-support/peer-harness.ts +13 -5
  256. package/dist/client/static/js/ImageView-ksx9bbct.js +0 -1
  257. package/dist/client/static/js/LayoutWrapper-9ftz050x.js +0 -2
  258. package/dist/client/static/js/Modal-f8x3j3be.js +0 -38
  259. package/dist/client/static/js/SessionsView-wzdf1cp6.js +0 -1
  260. package/dist/client/static/js/architecture-7GRP2DOG-4wsd6vk0.js +0 -1
  261. package/dist/client/static/js/bash-h6pkqvth.js +0 -1
  262. package/dist/client/static/js/c-thbdzmwv.js +0 -1
  263. package/dist/client/static/js/cpp-r1za1kke.js +0 -1
  264. package/dist/client/static/js/css-qsv4vvke.js +0 -1
  265. package/dist/client/static/js/cynefin-OW5HDTMX-eycwde8c.js +0 -1
  266. package/dist/client/static/js/eventmodeling-NTZA5JFV-srqbnmey.js +0 -1
  267. package/dist/client/static/js/flowDiagram-KWPJA3E3-yj98317w.js +0 -1
  268. package/dist/client/static/js/gitGraph-4MIJSDKK-5jcrvn94.js +0 -1
  269. package/dist/client/static/js/graphql-275pg7ya.js +0 -1
  270. package/dist/client/static/js/index-b08zd4eq.js +0 -1
  271. package/dist/client/static/js/index-g0pkzanm.js +0 -2
  272. package/dist/client/static/js/index-ga2xdef3.js +0 -2
  273. package/dist/client/static/js/index-r416e9dt.js +0 -12
  274. package/dist/client/static/js/index-xzfsaqyz.js +0 -4
  275. package/dist/client/static/js/info-A6RAGUB7-mbt0ryx5.js +0 -1
  276. package/dist/client/static/js/ini-jqdrx98c.js +0 -1
  277. package/dist/client/static/js/java-70zqqrkr.js +0 -1
  278. package/dist/client/static/js/json-kxk8gfet.js +0 -1
  279. package/dist/client/static/js/jsx-h1035eqk.js +0 -1
  280. package/dist/client/static/js/lua-j2356waf.js +0 -1
  281. package/dist/client/static/js/markdown-ffw6rgk6.js +0 -1
  282. package/dist/client/static/js/one-dark-pro-8acf6cn2.js +0 -1
  283. package/dist/client/static/js/one-light-ysc1knem.js +0 -1
  284. package/dist/client/static/js/packet-AYTQ26CC-a5yw789s.js +0 -1
  285. package/dist/client/static/js/pie-WAS4IAKB-x0y4v4r2.js +0 -1
  286. package/dist/client/static/js/properties-55mrarxr.js +0 -1
  287. package/dist/client/static/js/python-dhypc3j4.js +0 -1
  288. package/dist/client/static/js/r-6b8dt1wp.js +0 -1
  289. package/dist/client/static/js/radar-RG4KPBEZ-trrc3ta1.js +0 -1
  290. package/dist/client/static/js/railroad-74A4TZTK-dxgvx21w.js +0 -1
  291. package/dist/client/static/js/railroad-abnf-HS5TGJTU-rbgkd8sk.js +0 -1
  292. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-exgw7j47.js +0 -1
  293. package/dist/client/static/js/railroad-peg-WCYAUIDC-28tpamzk.js +0 -1
  294. package/dist/client/static/js/sql-9dq913c8.js +0 -1
  295. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-0x2ashav.js +0 -8
  296. package/dist/client/static/js/treeView-Q6P3EWNA-1a00b6kc.js +0 -1
  297. package/dist/client/static/js/treemap-WGGIJYW6-2q4f2f7m.js +0 -1
  298. package/dist/client/static/js/tsx-wh5xgm7f.js +0 -1
  299. package/dist/client/static/js/typescript-ge85req5.js +0 -1
  300. package/dist/client/static/js/wardley-WFR3VGLG-x9v91the.js +0 -1
  301. package/dist/client/static/js/xml-7bgz40qa.js +0 -1
  302. package/dist/client/static/js/yaml-4ht9416k.js +0 -1
  303. package/src/client/components/layout/session-sidebar/new-session-context.test.ts +0 -55
@@ -1,5 +1,5 @@
1
- import{be}from"./index-123e8tqq.js";import{t,l,Mt,E,te,R,M,O,P,z,j,G,p,ue,ae}from"./index-qmh0h87h.js";import{Te}from"./index-tr8754r0.js";var Q=t((a,s)=>{let o=a<=1?a*100:a;if(o<0||o>100)throw Error(`${s} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return o},"toPercent"),B=t((a,s,o)=>({x:Q(s,`${o} evolution`),y:Q(a,`${o} visibility`)}),"toCoordinates"),st=t((a)=>{if(!a)return;if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward";return},"getFlowFromPort"),Et=t((a)=>{if(!a?.startsWith("+"))return{};let o=/^\+'([^']*)'/.exec(a)?.[1];if(a.includes("<>"))return{flow:"bidirectional",label:o};if(a.includes("<"))return{flow:"backward",label:o};if(a.includes(">"))return{flow:"forward",label:o};return{label:o}},"extractFlowFromArrow"),Ht=t((a,s)=>{if(be(a,s),a.size)s.setSize(a.size.width,a.size.height);if(a.evolution){let o=a.evolution.stages.map((r)=>{if(r.secondName)return`${r.name.trim()} / ${r.secondName.trim()}`;return r.name.trim()}),y=a.evolution.stages.filter((r)=>r.boundary!==void 0).map((r)=>r.boundary);s.updateAxes({stages:o,stageBoundaries:y})}if(a.anchors.forEach((o)=>{let y=B(o.visibility,o.evolution,`Anchor "${o.name}"`);s.addNode(o.name,o.name,y.x,y.y,"anchor")}),a.components.forEach((o)=>{let y=B(o.visibility,o.evolution,`Component "${o.name}"`),r=o.label?(o.label.negX?-1:1)*o.label.offsetX:void 0,c=o.label?(o.label.negY?-1:1)*o.label.offsetY:void 0,k=o.decorator?.strategy;s.addNode(o.name,o.name,y.x,y.y,"component",r,c,o.inertia,k)}),a.notes.forEach((o)=>{let y=B(o.visibility,o.evolution,`Note "${o.text}"`);s.addNote(o.text,y.x,y.y)}),a.pipelines.forEach((o)=>{let y=s.getNode(o.parent);if(!y||typeof y.y!=="number")throw Error(`Pipeline "${o.parent}" must reference an existing component with coordinates.`);let r=y.y;s.startPipeline(o.parent),o.components.forEach((c)=>{let k=`${o.parent}_${c.name}`,T=c.label?(c.label.negX?-1:1)*c.label.offsetX:void 0,w=c.label?(c.label.negY?-1:1)*c.label.offsetY:void 0,Z=Q(c.evolution,`Pipeline component "${c.name}" evolution`);s.addNode(k,c.name,Z,r,"pipeline-component",T,w),s.addPipelineComponent(o.parent,k)})}),a.links.forEach((o)=>{let y=!!o.arrow&&(o.arrow.includes("-.->")||o.arrow.includes(".-.")),r=st(o.fromPort)??st(o.toPort),{flow:c,label:k}=Et(o.arrow);if(!r&&c)r=c;let T=o.linkLabel,w=k??T;s.addLink(s.resolveNodeId(o.from),s.resolveNodeId(o.to),y,w,r)}),a.evolves.forEach((o)=>{let y=s.getNode(o.component);if(y?.y!==void 0){let r=Q(o.target,`Evolve target for "${o.component}"`);s.addTrend(o.component,r,y.y)}}),a.annotations.length>0){let o=a.annotations[0],y=B(o.x,o.y,"Annotations box");s.setAnnotationsBox(y.x,y.y)}a.annotation.forEach((o)=>{let y=B(o.x,o.y,`Annotation ${o.number}`);s.addAnnotation(o.number,[{x:y.x,y:y.y}],o.text)}),a.accelerators.forEach((o)=>{let y=B(o.x,o.y,`Accelerator "${o.name}"`);s.addAccelerator(o.name,y.x,y.y)}),a.deaccelerators.forEach((o)=>{let y=B(o.x,o.y,`Deaccelerator "${o.name}"`);s.addDeaccelerator(o.name,y.x,y.y)})},"populateDb"),it={parser:{yy:void 0},parse:t(async(a)=>{let s=await Te("wardley",a);l.debug(s);let o=it.parser?.yy;if(!o||typeof o.addNode!=="function")throw Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Ht(s,o)},"parse")},Yt=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{t(this,"WardleyBuilder")}addNode(a){let s=this.nodes.get(a.id)??{id:a.id,label:a.label},o={...s,...a,className:a.className??s.className,labelOffsetX:a.labelOffsetX??s.labelOffsetX,labelOffsetY:a.labelOffsetY??s.labelOffsetY};this.nodes.set(a.id,o)}addLink(a){this.links.push(a)}addTrend(a){this.trends.set(a.nodeId,a)}startPipeline(a){this.pipelines.set(a,{nodeId:a,componentIds:[]});let s=this.nodes.get(a);if(s)s.isPipelineParent=!0}addPipelineComponent(a,s){let o=this.pipelines.get(a);if(o)o.componentIds.push(s);let y=this.nodes.get(s);if(y)y.inPipeline=!0}addAnnotation(a){this.annotations.push(a)}addNote(a){this.notes.push(a)}addAccelerator(a){this.accelerators.push(a)}addDeaccelerator(a){this.deaccelerators.push(a)}setAnnotationsBox(a,s){this.annotationsBox={x:a,y:s}}setAxes(a){this.axes={...this.axes,...a}}setSize(a,s){this.size={width:a,height:s}}getNode(a){return this.nodes.get(a)}resolveNodeId(a){if(this.nodes.has(a))return a;for(let[s,o]of this.nodes)if(o.label===a)return s;return a}build(){let a=[];for(let s of this.nodes.values()){if(typeof s.x!=="number"||typeof s.y!=="number")throw Error(`Node "${s.label}" is missing coordinates`);a.push(s)}return{nodes:a,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},v=new Yt;function dt(){return p()["wardley-beta"]}t(dt,"getConfig");function lt(a,s,o,y,r,c,k,T,w){v.addNode({id:a,label:s,x:o,y,className:r,labelOffsetX:c,labelOffsetY:k,inertia:T,sourceStrategy:w})}t(lt,"addNode");function ct(a,s,o=!1,y,r){v.addLink({source:a,target:s,dashed:o,label:y,flow:r})}t(ct,"addLink");function pt(a,s,o){v.addTrend({nodeId:a,targetX:s,targetY:o})}t(pt,"addTrend");function ht(a,s,o){v.addAnnotation({number:a,coordinates:s,text:o})}t(ht,"addAnnotation");function ft(a,s,o){v.addNote({text:a,x:s,y:o})}t(ft,"addNote");function xt(a,s,o){v.addAccelerator({name:a,x:s,y:o})}t(xt,"addAccelerator");function gt(a,s,o){v.addDeaccelerator({name:a,x:s,y:o})}t(gt,"addDeaccelerator");function yt(a,s){v.setAnnotationsBox(a,s)}t(yt,"setAnnotationsBox");function ut(a,s){v.setSize(a,s)}t(ut,"setSize");function wt(a){v.startPipeline(a)}t(wt,"startPipeline");function mt(a,s){v.addPipelineComponent(a,s)}t(mt,"addPipelineComponent");function kt(a){v.setAxes(a)}t(kt,"updateAxes");function bt(a){return v.getNode(a)}t(bt,"getNode");function $t(a){return v.resolveNodeId(a)}t($t,"resolveNodeId");function vt(){return v.build()}t(vt,"getWardleyData");function Pt(){v.clear(),R()}t(Pt,"clear");var It={getConfig:dt,addNode:lt,addLink:ct,addTrend:pt,addAnnotation:ht,addNote:ft,addAccelerator:xt,addDeaccelerator:gt,setAnnotationsBox:yt,setSize:ut,startPipeline:wt,addPipelineComponent:mt,updateAxes:kt,getNode:bt,resolveNodeId:$t,getWardleyData:vt,clear:Pt,setAccTitle:M,getAccTitle:O,setDiagramTitle:j,getDiagramTitle:G,getAccDescription:z,setAccDescription:P},Bt=["Genesis","Custom Built","Product","Commodity"],Ft=t(()=>{let{themeVariables:a}=p();return{backgroundColor:a.wardley?.backgroundColor??a.background??"#fff",axisColor:a.wardley?.axisColor??"#000",axisTextColor:a.wardley?.axisTextColor??a.primaryTextColor??"#222",gridColor:a.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:a.wardley?.componentFill??"#fff",componentStroke:a.wardley?.componentStroke??"#000",componentLabelColor:a.wardley?.componentLabelColor??a.primaryTextColor??"#222",linkStroke:a.wardley?.linkStroke??"#000",evolutionStroke:a.wardley?.evolutionStroke??"#dc3545",annotationStroke:a.wardley?.annotationStroke??"#000",annotationTextColor:a.wardley?.annotationTextColor??a.primaryTextColor??"#222",annotationFill:a.wardley?.annotationFill??a.background??"#fff"}},"getTheme"),Rt=t(()=>{let a=p()["wardley-beta"];return{width:a?.width??900,height:a?.height??600,padding:a?.padding??48,nodeRadius:a?.nodeRadius??6,nodeLabelOffset:a?.nodeLabelOffset??8,axisFontSize:a?.axisFontSize??12,labelFontSize:a?.labelFontSize??10,showGrid:a?.showGrid??!1,useMaxWidth:a?.useMaxWidth??!0}},"getConfigValues"),Ot=t((a,s,o,y)=>{l.debug(`Rendering Wardley map
2
- `+a);let r=Rt(),c=Ft(),k=r.nodeRadius*1.6,T=y.db,w=T.getWardleyData(),Z=T.getDiagramTitle(),W=w.size?.width??r.width,C=w.size?.height??r.height,D=ue(s);D.selectAll("*").remove(),te(D,C,W,r.useMaxWidth),D.attr("viewBox",`0 0 ${W} ${C}`);let N=D.append("g").attr("class","wardley-map"),tt=D.append("defs");tt.append("marker").attr("id",`arrow-${s}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",c.evolutionStroke).attr("stroke","none"),tt.append("marker").attr("id",`link-arrow-end-${s}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",c.linkStroke).attr("stroke","none"),tt.append("marker").attr("id",`link-arrow-start-${s}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",c.linkStroke).attr("stroke","none"),N.append("rect").attr("class","wardley-background").attr("width",W).attr("height",C).attr("fill",c.backgroundColor);let q=W-r.padding*2,V=C-r.padding*2;if(Z)N.append("text").attr("class","wardley-title").attr("x",W/2).attr("y",r.padding/2).attr("fill",c.axisTextColor).attr("font-size",r.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(Z);let H=t((e)=>r.padding+e/100*q,"projectX"),Y=t((e)=>C-r.padding-e/100*V,"projectY"),U=N.append("g").attr("class","wardley-axes");U.append("line").attr("x1",r.padding).attr("x2",W-r.padding).attr("y1",C-r.padding).attr("y2",C-r.padding).attr("stroke",c.axisColor).attr("stroke-width",1),U.append("line").attr("x1",r.padding).attr("x2",r.padding).attr("y1",r.padding).attr("y2",C-r.padding).attr("stroke",c.axisColor).attr("stroke-width",1);let Ct=w.axes.xLabel??"Evolution",St=w.axes.yLabel??"Visibility";U.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",r.padding+q/2).attr("y",C-r.padding/4).attr("fill",c.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(Ct),U.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",r.padding/3).attr("y",r.padding+V/2).attr("fill",c.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${r.padding/3} ${r.padding+V/2})`).text(St);let _=w.axes.stages&&w.axes.stages.length>0?w.axes.stages:Bt;if(_.length>0){let e=N.append("g").attr("class","wardley-stages"),i=w.axes.stageBoundaries,n=[];if(i&&i.length===_.length){let d=0;i.forEach((f)=>{n.push({start:d,end:f}),d=f})}else{let d=1/_.length;_.forEach((f,x)=>{n.push({start:x*d,end:(x+1)*d})})}_.forEach((d,f)=>{let x=n[f],u=r.padding+x.start*q,g=r.padding+x.end*q,m=(u+g)/2;if(f>0)e.append("line").attr("x1",u).attr("x2",u).attr("y1",r.padding).attr("y2",C-r.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",0.8);e.append("text").attr("class","wardley-stage-label").attr("x",m).attr("y",C-r.padding/1.5).attr("fill",c.axisTextColor).attr("font-size",r.axisFontSize-2).attr("text-anchor","middle").text(d)})}if(r.showGrid){let e=N.append("g").attr("class","wardley-grid");for(let i=1;i<4;i++){let n=i/4,d=r.padding+q*n;e.append("line").attr("x1",d).attr("x2",d).attr("y1",r.padding).attr("y2",C-r.padding).attr("stroke",c.gridColor).attr("stroke-dasharray","2 6"),e.append("line").attr("x1",r.padding).attr("x2",W-r.padding).attr("y1",C-r.padding-V*n).attr("y2",C-r.padding-V*n).attr("stroke",c.gridColor).attr("stroke-dasharray","2 6")}}let h=new Map;if(w.nodes.forEach((e)=>{h.set(e.id,{x:H(e.x),y:Y(e.y),node:e})}),w.pipelines.length>0){let e=N.append("g").attr("class","wardley-pipelines"),i=N.append("g").attr("class","wardley-pipeline-links");w.pipelines.forEach((n)=>{if(n.componentIds.length===0)return;let d=n.componentIds.map((g)=>({id:g,pos:h.get(g),node:w.nodes.find((m)=>m.id===g)})).filter((g)=>g.pos&&g.node).sort((g,m)=>g.node.x-m.node.x);for(let g=0;g<d.length-1;g++){let m=d[g],b=d[g+1];i.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",m.pos.x).attr("y1",m.pos.y).attr("x2",b.pos.x).attr("y2",b.pos.y).attr("stroke",c.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let f=1/0,x=-1/0,u=0;if(n.componentIds.forEach((g)=>{let m=h.get(g);if(m)f=Math.min(f,m.x),x=Math.max(x,m.x),u=m.y}),f!==1/0&&x!==-1/0){let m=r.nodeRadius*4,b=u-m/2,L=h.get(n.nodeId);if(L){let X=(f+x)/2;L.x=X,L.y=b-k/6}e.append("rect").attr("class","wardley-pipeline-box").attr("x",f-15).attr("y",b).attr("width",x-f+30).attr("height",m).attr("fill","none").attr("stroke",c.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}let rt=N.append("g").attr("class","wardley-links"),ot=new Map;w.pipelines.forEach((e)=>{ot.set(e.nodeId,new Set(e.componentIds))});let nt=w.links.filter((e)=>{if(!h.has(e.source)||!h.has(e.target))return!1;if(ot.get(e.target)?.has(e.source))return!1;return!0});rt.selectAll("line").data(nt).enter().append("line").attr("class",(e)=>`wardley-link${e.dashed?" wardley-link--dashed":""}`).attr("x1",(e)=>{let i=h.get(e.source),n=h.get(e.target),f=w.nodes.find((m)=>m.id===e.source).isPipelineParent?k/Math.sqrt(2):r.nodeRadius,x=n.x-i.x,u=n.y-i.y,g=Math.sqrt(x*x+u*u);return i.x+x/g*f}).attr("y1",(e)=>{let i=h.get(e.source),n=h.get(e.target),f=w.nodes.find((m)=>m.id===e.source).isPipelineParent?k/Math.sqrt(2):r.nodeRadius,x=n.x-i.x,u=n.y-i.y,g=Math.sqrt(x*x+u*u);return i.y+u/g*f}).attr("x2",(e)=>{let i=h.get(e.source),n=h.get(e.target),f=w.nodes.find((m)=>m.id===e.target).isPipelineParent?k/Math.sqrt(2):r.nodeRadius,x=i.x-n.x,u=i.y-n.y,g=Math.sqrt(x*x+u*u);return n.x+x/g*f}).attr("y2",(e)=>{let i=h.get(e.source),n=h.get(e.target),f=w.nodes.find((m)=>m.id===e.target).isPipelineParent?k/Math.sqrt(2):r.nodeRadius,x=i.x-n.x,u=i.y-n.y,g=Math.sqrt(x*x+u*u);return n.y+u/g*f}).attr("stroke",c.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",(e)=>e.dashed?"6 6":null).attr("marker-end",(e)=>{if(e.flow==="forward"||e.flow==="bidirectional")return`url(#link-arrow-end-${s})`;return null}).attr("marker-start",(e)=>{if(e.flow==="backward"||e.flow==="bidirectional")return`url(#link-arrow-start-${s})`;return null}),rt.selectAll("text").data(nt.filter((e)=>e.label)).enter().append("text").attr("class","wardley-link-label").attr("x",(e)=>{let i=h.get(e.source),n=h.get(e.target),d=(i.x+n.x)/2,f=n.y-i.y,x=n.x-i.x,u=Math.sqrt(x*x+f*f),g=8,m=f/u;return d+m*8}).attr("y",(e)=>{let i=h.get(e.source),n=h.get(e.target),d=(i.y+n.y)/2,f=n.x-i.x,x=n.y-i.y,u=Math.sqrt(f*f+x*x),g=8,m=-f/u;return d+m*8}).attr("fill",c.axisTextColor).attr("font-size",r.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",(e)=>{let i=h.get(e.source),n=h.get(e.target),d=(i.x+n.x)/2,f=(i.y+n.y)/2,x=n.x-i.x,u=n.y-i.y,g=Math.sqrt(x*x+u*u),m=8,b=u/g,L=-x/g,X=d+b*8,J=f+L*8,F=Math.atan2(u,x)*180/Math.PI;if(F>90||F<-90)F+=180;return`rotate(${F} ${X} ${J})`}).text((e)=>e.label);let Nt=N.append("g").attr("class","wardley-trends"),zt=w.trends.map((e)=>{let i=h.get(e.nodeId);if(!i)return null;let n=H(e.targetX),d=Y(e.targetY),f=n-i.x,x=d-i.y,u=Math.sqrt(f*f+x*x),g=r.nodeRadius+2,m=u>g?n-f/u*g:n,b=u>g?d-x/u*g:d;return{origin:i,targetX:n,targetY:d,adjustedX2:m,adjustedY2:b}}).filter((e)=>e!==null);Nt.selectAll("line").data(zt).enter().append("line").attr("class","wardley-trend").attr("x1",(e)=>e.origin.x).attr("y1",(e)=>e.origin.y).attr("x2",(e)=>e.adjustedX2).attr("y2",(e)=>e.adjustedY2).attr("stroke",c.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${s})`);let A=N.append("g").attr("class","wardley-nodes").selectAll("g").data(w.nodes).enter().append("g").attr("class",(e)=>["wardley-node",e.className?`wardley-node--${e.className}`:""].filter(Boolean).join(" "));A.filter((e)=>e.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",r.nodeRadius*2).attr("fill","#666").attr("stroke",c.componentStroke).attr("stroke-width",1),A.filter((e)=>e.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",r.nodeRadius*2).attr("fill","#ccc").attr("stroke",c.componentStroke).attr("stroke-width",1),A.filter((e)=>e.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",r.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);let I=A.filter((e)=>e.sourceStrategy==="market");I.append("circle").attr("class","wardley-market-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",r.nodeRadius*2).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",1),A.filter((e)=>!e.isPipelineParent&&e.sourceStrategy!=="market"&&e.className!=="anchor").append("circle").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",r.nodeRadius).attr("fill",c.componentFill).attr("stroke",c.componentStroke).attr("stroke-width",1);let et=r.nodeRadius*0.7,S=r.nodeRadius*1.2;if(I.append("line").attr("class","wardley-market-line").attr("x1",(e)=>h.get(e.id).x).attr("y1",(e)=>h.get(e.id).y-S).attr("x2",(e)=>h.get(e.id).x-S*Math.cos(Math.PI/6)).attr("y2",(e)=>h.get(e.id).y+S*Math.sin(Math.PI/6)).attr("stroke",c.componentStroke).attr("stroke-width",1),I.append("line").attr("class","wardley-market-line").attr("x1",(e)=>h.get(e.id).x-S*Math.cos(Math.PI/6)).attr("y1",(e)=>h.get(e.id).y+S*Math.sin(Math.PI/6)).attr("x2",(e)=>h.get(e.id).x+S*Math.cos(Math.PI/6)).attr("y2",(e)=>h.get(e.id).y+S*Math.sin(Math.PI/6)).attr("stroke",c.componentStroke).attr("stroke-width",1),I.append("line").attr("class","wardley-market-line").attr("x1",(e)=>h.get(e.id).x+S*Math.cos(Math.PI/6)).attr("y1",(e)=>h.get(e.id).y+S*Math.sin(Math.PI/6)).attr("x2",(e)=>h.get(e.id).x).attr("y2",(e)=>h.get(e.id).y-S).attr("stroke",c.componentStroke).attr("stroke-width",1),I.append("circle").attr("class","wardley-market-dot").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y-S).attr("r",et).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",2),I.append("circle").attr("class","wardley-market-dot").attr("cx",(e)=>h.get(e.id).x-S*Math.cos(Math.PI/6)).attr("cy",(e)=>h.get(e.id).y+S*Math.sin(Math.PI/6)).attr("r",et).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",2),I.append("circle").attr("class","wardley-market-dot").attr("cx",(e)=>h.get(e.id).x+S*Math.cos(Math.PI/6)).attr("cy",(e)=>h.get(e.id).y+S*Math.sin(Math.PI/6)).attr("r",et).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",2),A.filter((e)=>e.isPipelineParent===!0).append("rect").attr("x",(e)=>h.get(e.id).x-k/2).attr("y",(e)=>h.get(e.id).y-k/2).attr("width",k).attr("height",k).attr("fill",c.componentFill).attr("stroke",c.componentStroke).attr("stroke-width",1),A.filter((e)=>e.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",(e)=>{let i=h.get(e.id),n=e.isPipelineParent?k/2+15:r.nodeRadius+15;if(e.sourceStrategy)n+=r.nodeRadius+10;return i.x+n}).attr("y1",(e)=>{let i=h.get(e.id),n=e.isPipelineParent?k:r.nodeRadius*2;return i.y-n/2}).attr("x2",(e)=>{let i=h.get(e.id),n=e.isPipelineParent?k/2+15:r.nodeRadius+15;if(e.sourceStrategy)n+=r.nodeRadius+10;return i.x+n}).attr("y2",(e)=>{let i=h.get(e.id),n=e.isPipelineParent?k:r.nodeRadius*2;return i.y+n/2}).attr("stroke",c.componentStroke).attr("stroke-width",6),A.append("text").attr("x",(e)=>{let i=h.get(e.id);if(e.className==="anchor")return e.labelOffsetX!==void 0?i.x+e.labelOffsetX:i.x;let n=r.nodeLabelOffset;if(e.sourceStrategy&&e.labelOffsetX===void 0)n+=10;let d=e.labelOffsetX??n;return i.x+d}).attr("y",(e)=>{let i=h.get(e.id);if(e.className==="anchor")return e.labelOffsetY!==void 0?i.y+e.labelOffsetY:i.y-3;let n=-r.nodeLabelOffset;if(e.sourceStrategy&&e.labelOffsetY===void 0)n-=10;let d=e.labelOffsetY??n;return i.y+d}).attr("class","wardley-node-label").attr("fill",(e)=>{if(e.className==="evolved")return c.evolutionStroke;if(e.className==="anchor")return"#000";return c.componentLabelColor}).attr("font-size",r.labelFontSize).attr("font-weight",(e)=>e.className==="anchor"?"bold":"normal").attr("text-anchor",(e)=>e.className==="anchor"?"middle":"start").attr("dominant-baseline",(e)=>e.className==="anchor"?"middle":"auto").text((e)=>e.label),w.annotations.length>0){let e=N.append("g").attr("class","wardley-annotations");if(w.annotations.forEach((i)=>{let n=i.coordinates.map((d)=>({x:H(d.x),y:Y(d.y)}));if(n.length>1)for(let d=0;d<n.length-1;d++)e.append("line").attr("class","wardley-annotation-line").attr("x1",n[d].x).attr("y1",n[d].y).attr("x2",n[d+1].x).attr("y2",n[d+1].y).attr("stroke",c.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");n.forEach((d)=>{let f=e.append("g").attr("class","wardley-annotation");f.append("circle").attr("cx",d.x).attr("cy",d.y).attr("r",10).attr("fill","white").attr("stroke",c.axisColor).attr("stroke-width",1.5),f.append("text").attr("x",d.x).attr("y",d.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",c.axisTextColor).attr("font-weight","bold").text(i.number)})}),w.annotationsBox){let i=H(w.annotationsBox.x),n=Y(w.annotationsBox.y),d=10,f=16,x=11,u=e.append("g").attr("class","wardley-annotations-box"),g=[...w.annotations].filter((b)=>b.text).sort((b,L)=>b.number-L.number),m=[];if(g.forEach((b,L)=>{let X=u.append("text").attr("x",i+d).attr("y",n+d+(L+1)*f).attr("font-size",x).attr("fill",c.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${b.number}. ${b.text}`);m.push(X)}),m.length>0){let b=0,L=0;m.forEach((at)=>{let K=at.node(),At=K.getComputedTextLength();b=Math.max(b,At);let Xt=K.getBBox();L=Math.max(L,Xt.height)});let X=b+d*2+105,J=g.length*f+d*2+L/2,F=r.padding,Lt=W-r.padding-X,Tt=r.padding,Wt=C-r.padding-J;i=Math.max(F,Math.min(i,Lt)),n=Math.max(Tt,Math.min(n,Wt)),m.forEach((at,K)=>{at.attr("x",i+d).attr("y",n+d+(K+1)*f)}),u.insert("rect","text").attr("x",i).attr("y",n).attr("width",X).attr("height",J).attr("fill","white").attr("stroke",c.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(w.notes.length>0){let e=N.append("g").attr("class","wardley-notes");w.notes.forEach((i)=>{let n=H(i.x),d=Y(i.y);e.append("text").attr("x",n).attr("y",d).attr("text-anchor","start").attr("font-size",11).attr("fill",c.axisTextColor).attr("font-weight","bold").text(i.text)})}if(w.accelerators.length>0){let e=N.append("g").attr("class","wardley-accelerators");w.accelerators.forEach((i)=>{let n=H(i.x),d=Y(i.y),f=60,x=30,u=20,g=`
1
+ import{be}from"./index-gcs49f3p.js";import{t,l,Mt,E,te,R,L,O,P,z,j,G,p,ue,ie}from"./index-vw5k8csz.js";import{Te}from"./index-trm9x02n.js";var Q=t((a,s)=>{let o=a<=1?a*100:a;if(o<0||o>100)throw Error(`${s} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return o},"toPercent"),B=t((a,s,o)=>({x:Q(s,`${o} evolution`),y:Q(a,`${o} visibility`)}),"toCoordinates"),st=t((a)=>{if(!a)return;if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward";return},"getFlowFromPort"),Et=t((a)=>{if(!a?.startsWith("+"))return{};let o=/^\+'([^']*)'/.exec(a)?.[1];if(a.includes("<>"))return{flow:"bidirectional",label:o};if(a.includes("<"))return{flow:"backward",label:o};if(a.includes(">"))return{flow:"forward",label:o};return{label:o}},"extractFlowFromArrow"),Ht=t((a,s)=>{if(be(a,s),a.size)s.setSize(a.size.width,a.size.height);if(a.evolution){let o=a.evolution.stages.map((r)=>{if(r.secondName)return`${r.name.trim()} / ${r.secondName.trim()}`;return r.name.trim()}),y=a.evolution.stages.filter((r)=>r.boundary!==void 0).map((r)=>r.boundary);s.updateAxes({stages:o,stageBoundaries:y})}if(a.anchors.forEach((o)=>{let y=B(o.visibility,o.evolution,`Anchor "${o.name}"`);s.addNode(o.name,o.name,y.x,y.y,"anchor")}),a.components.forEach((o)=>{let y=B(o.visibility,o.evolution,`Component "${o.name}"`),r=o.label?(o.label.negX?-1:1)*o.label.offsetX:void 0,c=o.label?(o.label.negY?-1:1)*o.label.offsetY:void 0,k=o.decorator?.strategy;s.addNode(o.name,o.name,y.x,y.y,"component",r,c,o.inertia,k)}),a.notes.forEach((o)=>{let y=B(o.visibility,o.evolution,`Note "${o.text}"`);s.addNote(o.text,y.x,y.y)}),a.pipelines.forEach((o)=>{let y=s.getNode(o.parent);if(!y||typeof y.y!=="number")throw Error(`Pipeline "${o.parent}" must reference an existing component with coordinates.`);let r=y.y;s.startPipeline(o.parent),o.components.forEach((c)=>{let k=`${o.parent}_${c.name}`,T=c.label?(c.label.negX?-1:1)*c.label.offsetX:void 0,w=c.label?(c.label.negY?-1:1)*c.label.offsetY:void 0,Z=Q(c.evolution,`Pipeline component "${c.name}" evolution`);s.addNode(k,c.name,Z,r,"pipeline-component",T,w),s.addPipelineComponent(o.parent,k)})}),a.links.forEach((o)=>{let y=!!o.arrow&&(o.arrow.includes("-.->")||o.arrow.includes(".-.")),r=st(o.fromPort)??st(o.toPort),{flow:c,label:k}=Et(o.arrow);if(!r&&c)r=c;let T=o.linkLabel,w=k??T;s.addLink(s.resolveNodeId(o.from),s.resolveNodeId(o.to),y,w,r)}),a.evolves.forEach((o)=>{let y=s.getNode(o.component);if(y?.y!==void 0){let r=Q(o.target,`Evolve target for "${o.component}"`);s.addTrend(o.component,r,y.y)}}),a.annotations.length>0){let o=a.annotations[0],y=B(o.x,o.y,"Annotations box");s.setAnnotationsBox(y.x,y.y)}a.annotation.forEach((o)=>{let y=B(o.x,o.y,`Annotation ${o.number}`);s.addAnnotation(o.number,[{x:y.x,y:y.y}],o.text)}),a.accelerators.forEach((o)=>{let y=B(o.x,o.y,`Accelerator "${o.name}"`);s.addAccelerator(o.name,y.x,y.y)}),a.deaccelerators.forEach((o)=>{let y=B(o.x,o.y,`Deaccelerator "${o.name}"`);s.addDeaccelerator(o.name,y.x,y.y)})},"populateDb"),it={parser:{yy:void 0},parse:t(async(a)=>{let s=await Te("wardley",a);l.debug(s);let o=it.parser?.yy;if(!o||typeof o.addNode!=="function")throw Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Ht(s,o)},"parse")},Yt=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{t(this,"WardleyBuilder")}addNode(a){let s=this.nodes.get(a.id)??{id:a.id,label:a.label},o={...s,...a,className:a.className??s.className,labelOffsetX:a.labelOffsetX??s.labelOffsetX,labelOffsetY:a.labelOffsetY??s.labelOffsetY};this.nodes.set(a.id,o)}addLink(a){this.links.push(a)}addTrend(a){this.trends.set(a.nodeId,a)}startPipeline(a){this.pipelines.set(a,{nodeId:a,componentIds:[]});let s=this.nodes.get(a);if(s)s.isPipelineParent=!0}addPipelineComponent(a,s){let o=this.pipelines.get(a);if(o)o.componentIds.push(s);let y=this.nodes.get(s);if(y)y.inPipeline=!0}addAnnotation(a){this.annotations.push(a)}addNote(a){this.notes.push(a)}addAccelerator(a){this.accelerators.push(a)}addDeaccelerator(a){this.deaccelerators.push(a)}setAnnotationsBox(a,s){this.annotationsBox={x:a,y:s}}setAxes(a){this.axes={...this.axes,...a}}setSize(a,s){this.size={width:a,height:s}}getNode(a){return this.nodes.get(a)}resolveNodeId(a){if(this.nodes.has(a))return a;for(let[s,o]of this.nodes)if(o.label===a)return s;return a}build(){let a=[];for(let s of this.nodes.values()){if(typeof s.x!=="number"||typeof s.y!=="number")throw Error(`Node "${s.label}" is missing coordinates`);a.push(s)}return{nodes:a,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},v=new Yt;function dt(){return p()["wardley-beta"]}t(dt,"getConfig");function lt(a,s,o,y,r,c,k,T,w){v.addNode({id:a,label:s,x:o,y,className:r,labelOffsetX:c,labelOffsetY:k,inertia:T,sourceStrategy:w})}t(lt,"addNode");function ct(a,s,o=!1,y,r){v.addLink({source:a,target:s,dashed:o,label:y,flow:r})}t(ct,"addLink");function pt(a,s,o){v.addTrend({nodeId:a,targetX:s,targetY:o})}t(pt,"addTrend");function ht(a,s,o){v.addAnnotation({number:a,coordinates:s,text:o})}t(ht,"addAnnotation");function ft(a,s,o){v.addNote({text:a,x:s,y:o})}t(ft,"addNote");function xt(a,s,o){v.addAccelerator({name:a,x:s,y:o})}t(xt,"addAccelerator");function gt(a,s,o){v.addDeaccelerator({name:a,x:s,y:o})}t(gt,"addDeaccelerator");function yt(a,s){v.setAnnotationsBox(a,s)}t(yt,"setAnnotationsBox");function ut(a,s){v.setSize(a,s)}t(ut,"setSize");function wt(a){v.startPipeline(a)}t(wt,"startPipeline");function mt(a,s){v.addPipelineComponent(a,s)}t(mt,"addPipelineComponent");function kt(a){v.setAxes(a)}t(kt,"updateAxes");function bt(a){return v.getNode(a)}t(bt,"getNode");function $t(a){return v.resolveNodeId(a)}t($t,"resolveNodeId");function vt(){return v.build()}t(vt,"getWardleyData");function Pt(){v.clear(),R()}t(Pt,"clear");var It={getConfig:dt,addNode:lt,addLink:ct,addTrend:pt,addAnnotation:ht,addNote:ft,addAccelerator:xt,addDeaccelerator:gt,setAnnotationsBox:yt,setSize:ut,startPipeline:wt,addPipelineComponent:mt,updateAxes:kt,getNode:bt,resolveNodeId:$t,getWardleyData:vt,clear:Pt,setAccTitle:L,getAccTitle:O,setDiagramTitle:j,getDiagramTitle:G,getAccDescription:z,setAccDescription:P},Bt=["Genesis","Custom Built","Product","Commodity"],Ft=t(()=>{let{themeVariables:a}=p();return{backgroundColor:a.wardley?.backgroundColor??a.background??"#fff",axisColor:a.wardley?.axisColor??"#000",axisTextColor:a.wardley?.axisTextColor??a.primaryTextColor??"#222",gridColor:a.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:a.wardley?.componentFill??"#fff",componentStroke:a.wardley?.componentStroke??"#000",componentLabelColor:a.wardley?.componentLabelColor??a.primaryTextColor??"#222",linkStroke:a.wardley?.linkStroke??"#000",evolutionStroke:a.wardley?.evolutionStroke??"#dc3545",annotationStroke:a.wardley?.annotationStroke??"#000",annotationTextColor:a.wardley?.annotationTextColor??a.primaryTextColor??"#222",annotationFill:a.wardley?.annotationFill??a.background??"#fff"}},"getTheme"),Rt=t(()=>{let a=p()["wardley-beta"];return{width:a?.width??900,height:a?.height??600,padding:a?.padding??48,nodeRadius:a?.nodeRadius??6,nodeLabelOffset:a?.nodeLabelOffset??8,axisFontSize:a?.axisFontSize??12,labelFontSize:a?.labelFontSize??10,showGrid:a?.showGrid??!1,useMaxWidth:a?.useMaxWidth??!0}},"getConfigValues"),Ot=t((a,s,o,y)=>{l.debug(`Rendering Wardley map
2
+ `+a);let r=Rt(),c=Ft(),k=r.nodeRadius*1.6,T=y.db,w=T.getWardleyData(),Z=T.getDiagramTitle(),W=w.size?.width??r.width,C=w.size?.height??r.height,D=ue(s);D.selectAll("*").remove(),te(D,C,W,r.useMaxWidth),D.attr("viewBox",`0 0 ${W} ${C}`);let M=D.append("g").attr("class","wardley-map"),tt=D.append("defs");tt.append("marker").attr("id",`arrow-${s}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",c.evolutionStroke).attr("stroke","none"),tt.append("marker").attr("id",`link-arrow-end-${s}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",c.linkStroke).attr("stroke","none"),tt.append("marker").attr("id",`link-arrow-start-${s}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",c.linkStroke).attr("stroke","none"),M.append("rect").attr("class","wardley-background").attr("width",W).attr("height",C).attr("fill",c.backgroundColor);let q=W-r.padding*2,V=C-r.padding*2;if(Z)M.append("text").attr("class","wardley-title").attr("x",W/2).attr("y",r.padding/2).attr("fill",c.axisTextColor).attr("font-size",r.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(Z);let H=t((e)=>r.padding+e/100*q,"projectX"),Y=t((e)=>C-r.padding-e/100*V,"projectY"),U=M.append("g").attr("class","wardley-axes");U.append("line").attr("x1",r.padding).attr("x2",W-r.padding).attr("y1",C-r.padding).attr("y2",C-r.padding).attr("stroke",c.axisColor).attr("stroke-width",1),U.append("line").attr("x1",r.padding).attr("x2",r.padding).attr("y1",r.padding).attr("y2",C-r.padding).attr("stroke",c.axisColor).attr("stroke-width",1);let Ct=w.axes.xLabel??"Evolution",St=w.axes.yLabel??"Visibility";U.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",r.padding+q/2).attr("y",C-r.padding/4).attr("fill",c.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(Ct),U.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",r.padding/3).attr("y",r.padding+V/2).attr("fill",c.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${r.padding/3} ${r.padding+V/2})`).text(St);let _=w.axes.stages&&w.axes.stages.length>0?w.axes.stages:Bt;if(_.length>0){let e=M.append("g").attr("class","wardley-stages"),i=w.axes.stageBoundaries,n=[];if(i&&i.length===_.length){let d=0;i.forEach((f)=>{n.push({start:d,end:f}),d=f})}else{let d=1/_.length;_.forEach((f,x)=>{n.push({start:x*d,end:(x+1)*d})})}_.forEach((d,f)=>{let x=n[f],u=r.padding+x.start*q,g=r.padding+x.end*q,m=(u+g)/2;if(f>0)e.append("line").attr("x1",u).attr("x2",u).attr("y1",r.padding).attr("y2",C-r.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",0.8);e.append("text").attr("class","wardley-stage-label").attr("x",m).attr("y",C-r.padding/1.5).attr("fill",c.axisTextColor).attr("font-size",r.axisFontSize-2).attr("text-anchor","middle").text(d)})}if(r.showGrid){let e=M.append("g").attr("class","wardley-grid");for(let i=1;i<4;i++){let n=i/4,d=r.padding+q*n;e.append("line").attr("x1",d).attr("x2",d).attr("y1",r.padding).attr("y2",C-r.padding).attr("stroke",c.gridColor).attr("stroke-dasharray","2 6"),e.append("line").attr("x1",r.padding).attr("x2",W-r.padding).attr("y1",C-r.padding-V*n).attr("y2",C-r.padding-V*n).attr("stroke",c.gridColor).attr("stroke-dasharray","2 6")}}let h=new Map;if(w.nodes.forEach((e)=>{h.set(e.id,{x:H(e.x),y:Y(e.y),node:e})}),w.pipelines.length>0){let e=M.append("g").attr("class","wardley-pipelines"),i=M.append("g").attr("class","wardley-pipeline-links");w.pipelines.forEach((n)=>{if(n.componentIds.length===0)return;let d=n.componentIds.map((g)=>({id:g,pos:h.get(g),node:w.nodes.find((m)=>m.id===g)})).filter((g)=>g.pos&&g.node).sort((g,m)=>g.node.x-m.node.x);for(let g=0;g<d.length-1;g++){let m=d[g],b=d[g+1];i.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",m.pos.x).attr("y1",m.pos.y).attr("x2",b.pos.x).attr("y2",b.pos.y).attr("stroke",c.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let f=1/0,x=-1/0,u=0;if(n.componentIds.forEach((g)=>{let m=h.get(g);if(m)f=Math.min(f,m.x),x=Math.max(x,m.x),u=m.y}),f!==1/0&&x!==-1/0){let m=r.nodeRadius*4,b=u-m/2,N=h.get(n.nodeId);if(N){let X=(f+x)/2;N.x=X,N.y=b-k/6}e.append("rect").attr("class","wardley-pipeline-box").attr("x",f-15).attr("y",b).attr("width",x-f+30).attr("height",m).attr("fill","none").attr("stroke",c.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}let rt=M.append("g").attr("class","wardley-links"),ot=new Map;w.pipelines.forEach((e)=>{ot.set(e.nodeId,new Set(e.componentIds))});let nt=w.links.filter((e)=>{if(!h.has(e.source)||!h.has(e.target))return!1;if(ot.get(e.target)?.has(e.source))return!1;return!0});rt.selectAll("line").data(nt).enter().append("line").attr("class",(e)=>`wardley-link${e.dashed?" wardley-link--dashed":""}`).attr("x1",(e)=>{let i=h.get(e.source),n=h.get(e.target),f=w.nodes.find((m)=>m.id===e.source).isPipelineParent?k/Math.sqrt(2):r.nodeRadius,x=n.x-i.x,u=n.y-i.y,g=Math.sqrt(x*x+u*u);return i.x+x/g*f}).attr("y1",(e)=>{let i=h.get(e.source),n=h.get(e.target),f=w.nodes.find((m)=>m.id===e.source).isPipelineParent?k/Math.sqrt(2):r.nodeRadius,x=n.x-i.x,u=n.y-i.y,g=Math.sqrt(x*x+u*u);return i.y+u/g*f}).attr("x2",(e)=>{let i=h.get(e.source),n=h.get(e.target),f=w.nodes.find((m)=>m.id===e.target).isPipelineParent?k/Math.sqrt(2):r.nodeRadius,x=i.x-n.x,u=i.y-n.y,g=Math.sqrt(x*x+u*u);return n.x+x/g*f}).attr("y2",(e)=>{let i=h.get(e.source),n=h.get(e.target),f=w.nodes.find((m)=>m.id===e.target).isPipelineParent?k/Math.sqrt(2):r.nodeRadius,x=i.x-n.x,u=i.y-n.y,g=Math.sqrt(x*x+u*u);return n.y+u/g*f}).attr("stroke",c.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",(e)=>e.dashed?"6 6":null).attr("marker-end",(e)=>{if(e.flow==="forward"||e.flow==="bidirectional")return`url(#link-arrow-end-${s})`;return null}).attr("marker-start",(e)=>{if(e.flow==="backward"||e.flow==="bidirectional")return`url(#link-arrow-start-${s})`;return null}),rt.selectAll("text").data(nt.filter((e)=>e.label)).enter().append("text").attr("class","wardley-link-label").attr("x",(e)=>{let i=h.get(e.source),n=h.get(e.target),d=(i.x+n.x)/2,f=n.y-i.y,x=n.x-i.x,u=Math.sqrt(x*x+f*f),g=8,m=f/u;return d+m*8}).attr("y",(e)=>{let i=h.get(e.source),n=h.get(e.target),d=(i.y+n.y)/2,f=n.x-i.x,x=n.y-i.y,u=Math.sqrt(f*f+x*x),g=8,m=-f/u;return d+m*8}).attr("fill",c.axisTextColor).attr("font-size",r.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",(e)=>{let i=h.get(e.source),n=h.get(e.target),d=(i.x+n.x)/2,f=(i.y+n.y)/2,x=n.x-i.x,u=n.y-i.y,g=Math.sqrt(x*x+u*u),m=8,b=u/g,N=-x/g,X=d+b*8,J=f+N*8,F=Math.atan2(u,x)*180/Math.PI;if(F>90||F<-90)F+=180;return`rotate(${F} ${X} ${J})`}).text((e)=>e.label);let Nt=M.append("g").attr("class","wardley-trends"),zt=w.trends.map((e)=>{let i=h.get(e.nodeId);if(!i)return null;let n=H(e.targetX),d=Y(e.targetY),f=n-i.x,x=d-i.y,u=Math.sqrt(f*f+x*x),g=r.nodeRadius+2,m=u>g?n-f/u*g:n,b=u>g?d-x/u*g:d;return{origin:i,targetX:n,targetY:d,adjustedX2:m,adjustedY2:b}}).filter((e)=>e!==null);Nt.selectAll("line").data(zt).enter().append("line").attr("class","wardley-trend").attr("x1",(e)=>e.origin.x).attr("y1",(e)=>e.origin.y).attr("x2",(e)=>e.adjustedX2).attr("y2",(e)=>e.adjustedY2).attr("stroke",c.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${s})`);let A=M.append("g").attr("class","wardley-nodes").selectAll("g").data(w.nodes).enter().append("g").attr("class",(e)=>["wardley-node",e.className?`wardley-node--${e.className}`:""].filter(Boolean).join(" "));A.filter((e)=>e.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",r.nodeRadius*2).attr("fill","#666").attr("stroke",c.componentStroke).attr("stroke-width",1),A.filter((e)=>e.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",r.nodeRadius*2).attr("fill","#ccc").attr("stroke",c.componentStroke).attr("stroke-width",1),A.filter((e)=>e.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",r.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);let I=A.filter((e)=>e.sourceStrategy==="market");I.append("circle").attr("class","wardley-market-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",r.nodeRadius*2).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",1),A.filter((e)=>!e.isPipelineParent&&e.sourceStrategy!=="market"&&e.className!=="anchor").append("circle").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",r.nodeRadius).attr("fill",c.componentFill).attr("stroke",c.componentStroke).attr("stroke-width",1);let et=r.nodeRadius*0.7,S=r.nodeRadius*1.2;if(I.append("line").attr("class","wardley-market-line").attr("x1",(e)=>h.get(e.id).x).attr("y1",(e)=>h.get(e.id).y-S).attr("x2",(e)=>h.get(e.id).x-S*Math.cos(Math.PI/6)).attr("y2",(e)=>h.get(e.id).y+S*Math.sin(Math.PI/6)).attr("stroke",c.componentStroke).attr("stroke-width",1),I.append("line").attr("class","wardley-market-line").attr("x1",(e)=>h.get(e.id).x-S*Math.cos(Math.PI/6)).attr("y1",(e)=>h.get(e.id).y+S*Math.sin(Math.PI/6)).attr("x2",(e)=>h.get(e.id).x+S*Math.cos(Math.PI/6)).attr("y2",(e)=>h.get(e.id).y+S*Math.sin(Math.PI/6)).attr("stroke",c.componentStroke).attr("stroke-width",1),I.append("line").attr("class","wardley-market-line").attr("x1",(e)=>h.get(e.id).x+S*Math.cos(Math.PI/6)).attr("y1",(e)=>h.get(e.id).y+S*Math.sin(Math.PI/6)).attr("x2",(e)=>h.get(e.id).x).attr("y2",(e)=>h.get(e.id).y-S).attr("stroke",c.componentStroke).attr("stroke-width",1),I.append("circle").attr("class","wardley-market-dot").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y-S).attr("r",et).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",2),I.append("circle").attr("class","wardley-market-dot").attr("cx",(e)=>h.get(e.id).x-S*Math.cos(Math.PI/6)).attr("cy",(e)=>h.get(e.id).y+S*Math.sin(Math.PI/6)).attr("r",et).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",2),I.append("circle").attr("class","wardley-market-dot").attr("cx",(e)=>h.get(e.id).x+S*Math.cos(Math.PI/6)).attr("cy",(e)=>h.get(e.id).y+S*Math.sin(Math.PI/6)).attr("r",et).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",2),A.filter((e)=>e.isPipelineParent===!0).append("rect").attr("x",(e)=>h.get(e.id).x-k/2).attr("y",(e)=>h.get(e.id).y-k/2).attr("width",k).attr("height",k).attr("fill",c.componentFill).attr("stroke",c.componentStroke).attr("stroke-width",1),A.filter((e)=>e.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",(e)=>{let i=h.get(e.id),n=e.isPipelineParent?k/2+15:r.nodeRadius+15;if(e.sourceStrategy)n+=r.nodeRadius+10;return i.x+n}).attr("y1",(e)=>{let i=h.get(e.id),n=e.isPipelineParent?k:r.nodeRadius*2;return i.y-n/2}).attr("x2",(e)=>{let i=h.get(e.id),n=e.isPipelineParent?k/2+15:r.nodeRadius+15;if(e.sourceStrategy)n+=r.nodeRadius+10;return i.x+n}).attr("y2",(e)=>{let i=h.get(e.id),n=e.isPipelineParent?k:r.nodeRadius*2;return i.y+n/2}).attr("stroke",c.componentStroke).attr("stroke-width",6),A.append("text").attr("x",(e)=>{let i=h.get(e.id);if(e.className==="anchor")return e.labelOffsetX!==void 0?i.x+e.labelOffsetX:i.x;let n=r.nodeLabelOffset;if(e.sourceStrategy&&e.labelOffsetX===void 0)n+=10;let d=e.labelOffsetX??n;return i.x+d}).attr("y",(e)=>{let i=h.get(e.id);if(e.className==="anchor")return e.labelOffsetY!==void 0?i.y+e.labelOffsetY:i.y-3;let n=-r.nodeLabelOffset;if(e.sourceStrategy&&e.labelOffsetY===void 0)n-=10;let d=e.labelOffsetY??n;return i.y+d}).attr("class","wardley-node-label").attr("fill",(e)=>{if(e.className==="evolved")return c.evolutionStroke;if(e.className==="anchor")return"#000";return c.componentLabelColor}).attr("font-size",r.labelFontSize).attr("font-weight",(e)=>e.className==="anchor"?"bold":"normal").attr("text-anchor",(e)=>e.className==="anchor"?"middle":"start").attr("dominant-baseline",(e)=>e.className==="anchor"?"middle":"auto").text((e)=>e.label),w.annotations.length>0){let e=M.append("g").attr("class","wardley-annotations");if(w.annotations.forEach((i)=>{let n=i.coordinates.map((d)=>({x:H(d.x),y:Y(d.y)}));if(n.length>1)for(let d=0;d<n.length-1;d++)e.append("line").attr("class","wardley-annotation-line").attr("x1",n[d].x).attr("y1",n[d].y).attr("x2",n[d+1].x).attr("y2",n[d+1].y).attr("stroke",c.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");n.forEach((d)=>{let f=e.append("g").attr("class","wardley-annotation");f.append("circle").attr("cx",d.x).attr("cy",d.y).attr("r",10).attr("fill","white").attr("stroke",c.axisColor).attr("stroke-width",1.5),f.append("text").attr("x",d.x).attr("y",d.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",c.axisTextColor).attr("font-weight","bold").text(i.number)})}),w.annotationsBox){let i=H(w.annotationsBox.x),n=Y(w.annotationsBox.y),d=10,f=16,x=11,u=e.append("g").attr("class","wardley-annotations-box"),g=[...w.annotations].filter((b)=>b.text).sort((b,N)=>b.number-N.number),m=[];if(g.forEach((b,N)=>{let X=u.append("text").attr("x",i+d).attr("y",n+d+(N+1)*f).attr("font-size",x).attr("fill",c.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${b.number}. ${b.text}`);m.push(X)}),m.length>0){let b=0,N=0;m.forEach((at)=>{let K=at.node(),At=K.getComputedTextLength();b=Math.max(b,At);let Xt=K.getBBox();N=Math.max(N,Xt.height)});let X=b+d*2+105,J=g.length*f+d*2+N/2,F=r.padding,Lt=W-r.padding-X,Tt=r.padding,Wt=C-r.padding-J;i=Math.max(F,Math.min(i,Lt)),n=Math.max(Tt,Math.min(n,Wt)),m.forEach((at,K)=>{at.attr("x",i+d).attr("y",n+d+(K+1)*f)}),u.insert("rect","text").attr("x",i).attr("y",n).attr("width",X).attr("height",J).attr("fill","white").attr("stroke",c.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(w.notes.length>0){let e=M.append("g").attr("class","wardley-notes");w.notes.forEach((i)=>{let n=H(i.x),d=Y(i.y);e.append("text").attr("x",n).attr("y",d).attr("text-anchor","start").attr("font-size",11).attr("fill",c.axisTextColor).attr("font-weight","bold").text(i.text)})}if(w.accelerators.length>0){let e=M.append("g").attr("class","wardley-accelerators");w.accelerators.forEach((i)=>{let n=H(i.x),d=Y(i.y),f=60,x=30,u=20,g=`
3
3
  M ${n} ${d-15}
4
4
  L ${n+60-20} ${d-15}
5
5
  L ${n+60-20} ${d-15-8}
@@ -8,7 +8,7 @@ import{be}from"./index-123e8tqq.js";import{t,l,Mt,E,te,R,M,O,P,z,j,G,p,ue,ae}fro
8
8
  L ${n+60-20} ${d+15}
9
9
  L ${n} ${d+15}
10
10
  Z
11
- `;e.append("path").attr("d",g).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",1),e.append("text").attr("x",n+30).attr("y",d+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",c.axisTextColor).attr("font-weight","bold").text(i.name)})}if(w.deaccelerators.length>0){let e=N.append("g").attr("class","wardley-deaccelerators");w.deaccelerators.forEach((i)=>{let n=H(i.x),d=Y(i.y),f=60,x=30,u=20,g=`
11
+ `;e.append("path").attr("d",g).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",1),e.append("text").attr("x",n+30).attr("y",d+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",c.axisTextColor).attr("font-weight","bold").text(i.name)})}if(w.deaccelerators.length>0){let e=M.append("g").attr("class","wardley-deaccelerators");w.deaccelerators.forEach((i)=>{let n=H(i.x),d=Y(i.y),f=60,x=30,u=20,g=`
12
12
  M ${n+60} ${d-15}
13
13
  L ${n+20} ${d-15}
14
14
  L ${n+20} ${d-15-8}
@@ -17,7 +17,7 @@ import{be}from"./index-123e8tqq.js";import{t,l,Mt,E,te,R,M,O,P,z,j,G,p,ue,ae}fro
17
17
  L ${n+20} ${d+15}
18
18
  L ${n+60} ${d+15}
19
19
  Z
20
- `;e.append("path").attr("d",g).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",1),e.append("text").attr("x",n+30).attr("y",d+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",c.axisTextColor).attr("font-weight","bold").text(i.name)})}},"draw"),Dt={draw:Ot},Gt=t(({wardley:a}={})=>{let s=Mt(),o=E(),y=ae(s,o.themeVariables),r=ae(y.wardley,a);return`
20
+ `;e.append("path").attr("d",g).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",1),e.append("text").attr("x",n+30).attr("y",d+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",c.axisTextColor).attr("font-weight","bold").text(i.name)})}},"draw"),Dt={draw:Ot},Gt=t(({wardley:a}={})=>{let s=Mt(),o=E(),y=ie(s,o.themeVariables),r=ie(y.wardley,a);return`
21
21
  .wardley-background {
22
22
  fill: ${r.backgroundColor};
23
23
  }
@@ -0,0 +1 @@
1
+ import{Hi}from"./index-2svnq5gg.js";import"./index-hf52f59k.js";export{Hi as default};
@@ -1,7 +1,7 @@
1
- import{t,l,Mt,K,E,X,te,R,M,O,P,z,j,G,ri,On,Cs,ue,ae,kf}from"./index-qmh0h87h.js";import{ea}from"./index-e6rar25v.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,W=a<n,I=W?a:n,B=W?n:a;if(h=(B-I)/Math.max(1,y-f+S*2),x)h=Math.floor(h);if(I+=(B-I-h*(y-f))*D,c=h*(1-f),x)I=Math.round(I),c=Math.round(c);var N=_t(y).map(function(J){return I+h*J});return s(W?N.reverse():N)}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)},ri.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],W=[1,31],I=[1,32],B=[1,33],N=[1,34],J=[1,35],et=[1,36],w=[1,37],H=[1,43],u=[1,42],Y=[1,47],U=[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],V=[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:W,46:I,47:B,48:N,49:J,50:et,51:w},{11:39,13:38,24:H,29:u,30:f,31:40,32:41,39:24,40:S,41:27,42:D,43:_,44:y,45:W,46:I,47:B,48:N,49:J,50:et,51:w},{11:45,15:44,29:Y,30:f,35:46,39:24,40:S,41:27,42:D,43:_,44:y,45:W,46:I,47:B,48:N,49:J,50:et,51:w},{11:49,17:48,24:U,30:f,39:24,40:S,41:27,42:D,43:_,44:y,45:W,46:I,47:B,48:N,49:J,50:et,51:w},{11:52,17:51,24:U,30:f,39:24,40:S,41:27,42:D,43:_,44:y,45:W,46:I,47:B,48:N,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:W,46:I,47:B,48:N,49:J,50:et,51:w}),e(st,[2,40]),e(st,[2,41]),e(V,[2,42]),e(V,[2,44]),e(V,[2,45]),e(V,[2,46]),e(V,[2,47]),e(V,[2,48]),e(V,[2,49]),e(V,[2,50]),e(V,[2,51]),e(V,[2,52]),e(V,[2,53]),e(A,[2,10]),e(A,[2,24],{32:41,31:56,24:H,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:W,46:I,47:B,48:N,49:J,50:et,51:w},e(A,[2,11]),e(A,[2,32],{35:60,29:Y}),e(A,[2,34]),{33:[1,61]},e(A,[2,12]),{17:62,24:U},{25:63,27:64,29:ht},e(A,[2,14]),{17:66,24:U},e(A,[2,16]),e(A,[2,17]),e(V,[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:W,46:I,47:B,48:N,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),L=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(L.setInput(r,at.yy),at.yy.lexer=L,at.yy.parser=this,typeof L.yylloc>"u")L.yylloc={};var At=L.yylloc;o.push(At);var pe=L.options&&L.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()||L.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 F,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(F===null||typeof F>"u")F=Yt();Q=nt[ot]&&nt[ot][F]}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(L.showPosition)Rt="Parse error on line "+(ft+1)+`:
2
- `+L.showPosition()+`
3
- Expecting `+mt.join(", ")+", got '"+(this.terminals_[F]||F)+"'";else Rt="Parse error on line "+(ft+1)+": Unexpected "+(F==Nt?"end of input":"'"+(this.terminals_[F]||F)+"'");this.parseError(Rt,{text:L.match,token:this.terminals_[F]||F,line:L.yylineno,loc:At,expected:mt})}if(Q[0]instanceof Array&&Q.length>1)throw Error("Parse Error: multiple actions possible at state: "+ot+", token: "+F);switch(Q[0]){case 1:if(d.push(F),C.push(L.yytext),o.push(L.yylloc),d.push(Q[1]),F=null,!Ct){if(Wt=L.yyleng,m=L.yytext,ft=L.yylineno,At=L.yylloc,Xt>0)Xt--}else F=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).
1
+ import{t,l,Mt,K,E,X,te,R,L,O,P,z,j,G,ai,On,Cs,ue,ie,Cf}from"./index-vw5k8csz.js";import{ta}from"./index-pbe4yed4.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,W=a<n,M=W?a:n,B=W?n:a;if(h=(B-M)/Math.max(1,y-f+S*2),x)h=Math.floor(h);if(M+=(B-M-h*(y-f))*D,c=h*(1-f),x)M=Math.round(M),c=Math.round(c);var N=_t(y).map(function(J){return M+h*J});return s(W?N.reverse():N)}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],W=[1,31],M=[1,32],B=[1,33],N=[1,34],J=[1,35],et=[1,36],w=[1,37],H=[1,43],u=[1,42],Y=[1,47],U=[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],V=[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:W,46:M,47:B,48:N,49:J,50:et,51:w},{11:39,13:38,24:H,29:u,30:f,31:40,32:41,39:24,40:S,41:27,42:D,43:_,44:y,45:W,46:M,47:B,48:N,49:J,50:et,51:w},{11:45,15:44,29:Y,30:f,35:46,39:24,40:S,41:27,42:D,43:_,44:y,45:W,46:M,47:B,48:N,49:J,50:et,51:w},{11:49,17:48,24:U,30:f,39:24,40:S,41:27,42:D,43:_,44:y,45:W,46:M,47:B,48:N,49:J,50:et,51:w},{11:52,17:51,24:U,30:f,39:24,40:S,41:27,42:D,43:_,44:y,45:W,46:M,47:B,48:N,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:W,46:M,47:B,48:N,49:J,50:et,51:w}),e(st,[2,40]),e(st,[2,41]),e(V,[2,42]),e(V,[2,44]),e(V,[2,45]),e(V,[2,46]),e(V,[2,47]),e(V,[2,48]),e(V,[2,49]),e(V,[2,50]),e(V,[2,51]),e(V,[2,52]),e(V,[2,53]),e(A,[2,10]),e(A,[2,24],{32:41,31:56,24:H,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:W,46:M,47:B,48:N,49:J,50:et,51:w},e(A,[2,11]),e(A,[2,32],{35:60,29:Y}),e(A,[2,34]),{33:[1,61]},e(A,[2,12]),{17:62,24:U},{25:63,27:64,29:ht},e(A,[2,14]),{17:66,24:U},e(A,[2,16]),e(A,[2,17]),e(V,[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:W,46:M,47:B,48:N,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),I=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(I.setInput(r,at.yy),at.yy.lexer=I,at.yy.parser=this,typeof I.yylloc>"u")I.yylloc={};var At=I.yylloc;o.push(At);var pe=I.options&&I.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()||I.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 F,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(F===null||typeof F>"u")F=Yt();Q=nt[ot]&&nt[ot][F]}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(I.showPosition)Rt="Parse error on line "+(ft+1)+`:
2
+ `+I.showPosition()+`
3
+ Expecting `+mt.join(", ")+", got '"+(this.terminals_[F]||F)+"'";else Rt="Parse error on line "+(ft+1)+": Unexpected "+(F==Nt?"end of input":"'"+(this.terminals_[F]||F)+"'");this.parseError(Rt,{text:I.match,token:this.terminals_[F]||F,line:I.yylineno,loc:At,expected:mt})}if(Q[0]instanceof Array&&Q.length>1)throw Error("Parse Error: multiple actions possible at state: "+ot+", token: "+F);switch(Q[0]){case 1:if(d.push(F),C.push(I.yytext),o.push(I.yylloc),d.push(Q[1]),F=null,!Ct){if(Wt=I.yyleng,m=I.yytext,ft=I.yylineno,At=I.yylloc,Xt>0)Xt--}else F=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=kf(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=ea().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let e=[...this.domain];if(this.axisPosition==="left")e.reverse();this.scale=ea().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 ae(e.xyChart,i.themeVariables.xyChart)}t(It,"getChartDefaultThemeConfig");function Bt(){let e=E();return ae(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 oe(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(oe,"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)oe(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 de(){return b}t(de,"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:M,getAccTitle:O,setDiagramTitle:j,getDiagramTitle:G,getAccDescription:z,setAccDescription:P,setOrientation:Jt,setXAxisTitle:ee,setXAxisRangeData:Ot,setXAxisBand:ie,setYAxisTitle:se,setYAxisRangeData:ne,setLineData:re,setBarData:he,setTmpSVGG:Zt,getChartThemeConfig:ce,getChartConfig:ge,getXYChartData:de},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
- `+e);let _=ue(i),y=_.append("g").attr("class","main"),W=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}`),W.attr("fill",h.backgroundColor),a.setTmpSVGG(_.append("g").attr("class","mermaid-tmp-group"));let I=a.getDrawableElem(),B={};function N(w){let H=y,u="";for(let[Y]of w.entries()){let U=y;if(Y>0&&B[u])U=B[u];if(u+=w[Y],H=B[u],!H)H=B[u]=U.append("g").attr("class",w[Y])}return H}t(N,"getGroup");for(let w of I){if(w.data.length===0)continue;let H=N(w.groupTexts);switch(w.type){case"rect":if(H.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 Y=function(k,tt){let{data:T,label:q}=k;return tt*q.length*U<=T.width-A};var J=Y;t(Y,"fitsHorizontally");let U=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),V=st.map((k)=>{let{data:tt}=k,T=tt.height*0.7;while(!Y(k,T)&&T>0)T-=1;return T}),ht=Math.floor(Math.min(...V)),v=t((k)=>{if(u)return k.data.x+k.data.width+A;else return k.data.x+k.data.width-A},"determineLabelXPosition");H.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 Y=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=Y;t(Y,"fitsInBar");let U=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(!Y(v,T,U)&&T>0)T-=1;return T}),V=Math.floor(Math.min(...st)),ht=t((v)=>{if(u)return v.data.y-U;else return v.data.y+U},"determineLabelYPosition");H.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",`${V}px`).text((v)=>v.label)}}break;case"text":H.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":H.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};
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=ta().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let e=[...this.domain];if(this.axisPosition==="left")e.reverse();this.scale=ta().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 ie(e.xyChart,i.themeVariables.xyChart)}t(It,"getChartDefaultThemeConfig");function Bt(){let e=E();return ie(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 se(e){b.xAxis={type:"band",title:b.xAxis.title,categories:e.map((i)=>rt(i.text))},wt=!0}t(se,"setXAxisBand");function ne(e){b.yAxis.title=rt(e.text)}t(ne,"setYAxisTitle");function ae(e,i){b.yAxis={type:"linear",title:b.yAxis.title,min:e,max:i},Et=!0}t(ae,"setYAxisRangeData");function oe(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(oe,"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)oe(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 de(){return b}t(de,"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:O,setDiagramTitle:j,getDiagramTitle:G,getAccDescription:z,setAccDescription:P,setOrientation:Jt,setXAxisTitle:ee,setXAxisRangeData:Ot,setXAxisBand:se,setYAxisTitle:ne,setYAxisRangeData:ae,setLineData:re,setBarData:he,setTmpSVGG:Zt,getChartThemeConfig:ce,getChartConfig:ge,getXYChartData:de},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
+ `+e);let _=ue(i),y=_.append("g").attr("class","main"),W=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}`),W.attr("fill",h.backgroundColor),a.setTmpSVGG(_.append("g").attr("class","mermaid-tmp-group"));let M=a.getDrawableElem(),B={};function N(w){let H=y,u="";for(let[Y]of w.entries()){let U=y;if(Y>0&&B[u])U=B[u];if(u+=w[Y],H=B[u],!H)H=B[u]=U.append("g").attr("class",w[Y])}return H}t(N,"getGroup");for(let w of M){if(w.data.length===0)continue;let H=N(w.groupTexts);switch(w.type){case"rect":if(H.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 Y=function(k,tt){let{data:T,label:q}=k;return tt*q.length*U<=T.width-A};var J=Y;t(Y,"fitsHorizontally");let U=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),V=st.map((k)=>{let{data:tt}=k,T=tt.height*0.7;while(!Y(k,T)&&T>0)T-=1;return T}),ht=Math.floor(Math.min(...V)),v=t((k)=>{if(u)return k.data.x+k.data.width+A;else return k.data.x+k.data.width-A},"determineLabelXPosition");H.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 Y=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=Y;t(Y,"fitsInBar");let U=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(!Y(v,T,U)&&T>0)T-=1;return T}),V=Math.floor(Math.min(...st)),ht=t((v)=>{if(u)return v.data.y-U;else return v.data.y+U},"determineLabelYPosition");H.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",`${V}px`).text((v)=>v.label)}}break;case"text":H.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":H.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{Qf}from"./index-354mqqra.js";export{Qf as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kabmo-labs/kabmo",
3
- "version": "0.32.0",
3
+ "version": "0.33.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,98 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The MCP rows' status glyph.
8
+ *
9
+ * The colour is the only signal a user gets from the collapsed row, and the
10
+ * fill token is not it: `text-error` is the palette's own `#E06C75` on
11
+ * `onedarkpro-light`, 2.91:1 on the popover's paper — a pale pink that reads as
12
+ * "nothing happened". The solved `-text` token is the red the failure state is
13
+ * supposed to show (4.51:1). A markup check that only looks for `text-error`
14
+ * passes on both, so each case asserts the exact token.
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 { McpSection } from '@/client/components/common/context-usage-button/McpSection';
22
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
23
+ import type { McpProbeResult, SessionMcpPayload } from '@/shared/types';
24
+
25
+ const nativeFetch = Bun.fetch;
26
+ let container: HTMLElement;
27
+
28
+ function payload(probe: McpProbeResult | null): SessionMcpPayload {
29
+ return {
30
+ sessionId: 'session-mcp',
31
+ harness: 'omp-rpc',
32
+ delivery: 'omp-config',
33
+ live: false,
34
+ servers: [{ name: 'obsidian', transport: 'http', source: 'user', enabled: true, probe }],
35
+ overrides: {},
36
+ };
37
+ }
38
+
39
+ async function mount(probe: McpProbeResult | null): Promise<void> {
40
+ (globalThis as unknown as Record<string, unknown>).fetch = async () =>
41
+ new Response(JSON.stringify(payload(probe)), {
42
+ status: 200,
43
+ headers: { 'content-type': 'application/json' },
44
+ });
45
+ container = document.createElement('div');
46
+ document.body.appendChild(container);
47
+ await act(async () => {
48
+ render(h(McpSection, { sessionId: 'session-mcp' }), container);
49
+ });
50
+ for (let i = 0; i < 5; i += 1) await act(async () => {});
51
+ }
52
+
53
+ function infoButton(): HTMLElement {
54
+ return container.querySelector('button[aria-label^="obsidian status"]') as HTMLElement;
55
+ }
56
+
57
+ beforeAll(() => {
58
+ installDomGlobals(new Window({ url: 'http://localhost' }));
59
+ });
60
+
61
+ afterEach(() => {
62
+ if (container) {
63
+ render(null, container);
64
+ container.remove();
65
+ }
66
+ (globalThis as unknown as Record<string, unknown>).fetch = nativeFetch;
67
+ });
68
+
69
+ afterAll(() => {
70
+ restoreDomGlobals();
71
+ });
72
+
73
+ describe('McpSection status glyph', () => {
74
+ test('a failed handshake paints the info control with the readable red', async () => {
75
+ await mount({ ok: false, error: 'ECONNREFUSED', toolCount: 0, durationMs: 0, checkedAt: 1 });
76
+
77
+ const button = infoButton();
78
+ expect(button.getAttribute('aria-label')).toBe('obsidian status: error');
79
+ expect(button.classList.contains('text-error-text')).toBe(true);
80
+ expect(button.classList.contains('text-error')).toBe(false);
81
+ });
82
+
83
+ test('a handshake that answered paints it green', async () => {
84
+ await mount({ ok: true, toolCount: 8, durationMs: 152, checkedAt: 1 });
85
+
86
+ const button = infoButton();
87
+ expect(button.getAttribute('aria-label')).toBe('obsidian status: active');
88
+ expect(button.classList.contains('text-success-text')).toBe(true);
89
+ });
90
+
91
+ test('a server that was never probed stays amber', async () => {
92
+ await mount(null);
93
+
94
+ const button = infoButton();
95
+ expect(button.getAttribute('aria-label')).toBe('obsidian status: unknown');
96
+ expect(button.classList.contains('text-warning-text')).toBe(true);
97
+ });
98
+ });
@@ -25,12 +25,19 @@ interface McpSectionProps {
25
25
  sessionId: string | null;
26
26
  }
27
27
 
28
+ /**
29
+ * The `-text` tokens, not the fill ones: the icon is a 12px glyph on the
30
+ * popover's paper, and the fill hex is the palette's own signal colour, which
31
+ * is not solved for reading. Measured on `onedarkpro-light`: `--theme-error`
32
+ * `#E06C75` is 2.91:1 on the paper (a pale pink), while `--theme-error-text`
33
+ * `#af545b` is 4.51:1 — the red the failure state is supposed to show.
34
+ */
28
35
  const STATUS_ICON_CLASS: Record<McpServerStatus, string> = {
29
- active: 'text-success',
30
- error: 'text-error',
31
- checking: 'text-warning',
32
- disabled: 'text-error',
33
- unknown: 'text-warning',
36
+ active: 'text-success-text',
37
+ error: 'text-error-text',
38
+ checking: 'text-warning-text',
39
+ disabled: 'text-error-text',
40
+ unknown: 'text-warning-text',
34
41
  };
35
42
 
36
43
  function statusDetail(server: SessionMcpServer, status: McpServerStatus): string {
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The timing half of the context popover: turns/steps, how long the model and
8
+ * the tools spent, and the rates behind them.
9
+ *
10
+ * EVERY row is conditional on its measurement existing. An ACP chat reports no
11
+ * per-call timing and an older transcript has no `ttft`; printing `0s` there
12
+ * would state a measurement the source never made — the same defect
13
+ * `cacheHitAverage` already avoids by hiding its row.
14
+ *
15
+ * `turns` is the count of user prompts and `steps` the count of assistant
16
+ * calls (one LLM request each). They are read straight off the telemetry the
17
+ * popover already receives, so a second counter cannot drift from them.
18
+ */
19
+
20
+ import type { SessionTimingStats } from '@/shared/types';
21
+ import { formatSpan } from '@/shared/lib/format/duration';
22
+
23
+ interface SessionStatsProps {
24
+ /** User prompts; a run may contain several LLM/tool turns. */
25
+ turns: number;
26
+ /** Assistant messages, i.e. one LLM request each. */
27
+ steps: number;
28
+ timing?: SessionTimingStats;
29
+ }
30
+
31
+ const ROW = 'flex justify-between gap-2';
32
+ const LABEL = 'text-ink/50 flex-shrink-0';
33
+
34
+ export function SessionStats({ turns, steps, timing }: SessionStatsProps) {
35
+ const llm = formatSpan(timing?.llmMs);
36
+ const tool = formatSpan(timing?.toolMs);
37
+ const ttft = formatSpan(timing?.ttftAvgMs);
38
+ const lastRate = timing?.lastTps === undefined ? undefined : timing.lastTps.toFixed(1);
39
+ const avgRate = timing?.avgTps === undefined ? undefined : timing.avgTps.toFixed(1);
40
+ const rateLabel = lastRate && avgRate
41
+ ? `${lastRate} / ${avgRate}`
42
+ : lastRate
43
+ ? `${lastRate} last`
44
+ : avgRate
45
+ ? `${avgRate} avg`
46
+ : undefined;
47
+
48
+ return (
49
+ <div className="pt-2 mt-2 border-t border-ink/10 space-y-1.5">
50
+ <div className={ROW}>
51
+ <span className={LABEL}>Turns / steps:</span>
52
+ <span>{turns} / {steps}</span>
53
+ </div>
54
+ {llm && (
55
+ <div className={ROW}>
56
+ <span className={LABEL}>LLM time:</span>
57
+ <span>{llm}</span>
58
+ </div>
59
+ )}
60
+ {tool && (
61
+ <div className={ROW}>
62
+ <span className={LABEL}>Tool time:</span>
63
+ <span>{tool}</span>
64
+ </div>
65
+ )}
66
+ {ttft && (
67
+ <div className={ROW}>
68
+ <span className={LABEL}>TTFT avg:</span>
69
+ <span>{ttft}</span>
70
+ </div>
71
+ )}
72
+ {rateLabel && (
73
+ <div className={ROW}>
74
+ <span className={LABEL}>Tok/s:</span>
75
+ <span>{rateLabel}</span>
76
+ </div>
77
+ )}
78
+ </div>
79
+ );
80
+ }