pmx-canvas 0.10.0 → 0.12.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 (343) hide show
  1. package/.github/extensions/pmx-canvas/extension.mjs +3 -1
  2. package/.github/extensions/pmx-canvas/runtime.json +1 -1
  3. package/.github/extensions/pmx-canvas/tools.json +688 -128
  4. package/CHANGELOG.md +69 -0
  5. package/dist/amp-plugin/pmx-canvas/LICENSE +21 -0
  6. package/dist/amp-plugin/pmx-canvas/THIRD_PARTY_LICENSES.txt +331 -0
  7. package/dist/amp-plugin/pmx-canvas/index.js +5445 -0
  8. package/dist/amp-plugin/pmx-canvas/runtime.json +3 -0
  9. package/dist/amp-plugin/pmx-canvas/shared-runtime.mjs +194 -0
  10. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/SKILL.md +251 -0
  11. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/evals/evals.json +1086 -0
  12. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/evals/fixtures/code-exploration/src/auth/jwt.ts +17 -0
  13. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/evals/fixtures/code-exploration/src/auth/login.ts +12 -0
  14. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/evals/fixtures/code-exploration/src/auth/middleware.ts +13 -0
  15. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/evals/fixtures/code-exploration/src/routes/auth.ts +13 -0
  16. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/evals/fixtures/investigation-board/src/handlers/users.ts +27 -0
  17. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/mcp.json +36 -0
  18. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/ax-html-control-surface.md +101 -0
  19. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/codex-app-adapter.md +151 -0
  20. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/excalidraw-diagram-authoring.md +150 -0
  21. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/full-reference.md +1785 -0
  22. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/github-copilot-app-adapter.md +223 -0
  23. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/html-primitives.md +139 -0
  24. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/importing-context.md +132 -0
  25. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/installing-pmx-canvas.md +251 -0
  26. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/tours-and-recording.md +111 -0
  27. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/workbench-workflows.md +900 -0
  28. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas-orchestration/SKILL.md +141 -0
  29. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas-testing/SKILL.md +266 -0
  30. package/dist/amp-plugin/pmx-canvas/start-mcp.mjs +14857 -0
  31. package/dist/amp-plugin/pmx-canvas/tools.json +10963 -0
  32. package/dist/canvas/chunks/abnfDiagram-N423BO3Z-cwtsds5d.js +1 -0
  33. package/dist/canvas/chunks/architecture-TIHT7OUA-x63cwejs.js +1 -0
  34. package/dist/canvas/chunks/architectureDiagram-T3A2C74G-b4xc9tpz.js +36 -0
  35. package/dist/canvas/chunks/blockDiagram-VBNYF7ZC-ahp3yxxs.js +132 -0
  36. package/dist/canvas/chunks/c4Diagram-5PPSVZJV-nappnay7.js +10 -0
  37. package/dist/canvas/chunks/classDiagram-JCYQIIEL-k1j2xc1t.js +1 -0
  38. package/dist/canvas/chunks/classDiagram-v2-OCEON4UE-33x08xf2.js +1 -0
  39. package/dist/canvas/chunks/cose-bilkent-JH36ORCC-a428syda.js +1 -0
  40. package/dist/canvas/chunks/cynefin-VYW2F7L2-8v6jxfz8.js +1 -0
  41. package/dist/canvas/chunks/cynefinDiagram-MW4NZA55-nspsqebj.js +62 -0
  42. package/dist/canvas/chunks/dagre-VZM6K2ZE-8y6177fh.js +4 -0
  43. package/dist/canvas/chunks/diagram-7IWD3JNH-vym028wn.js +30 -0
  44. package/dist/canvas/chunks/diagram-B4RE2ZJO-jddqb8sy.js +3 -0
  45. package/dist/canvas/chunks/diagram-LBJQPF4R-bjwbpkrn.js +24 -0
  46. package/dist/canvas/chunks/diagram-Q27KOJAE-j6ph6hcx.js +24 -0
  47. package/dist/canvas/chunks/diagram-UB23O5K3-p09w8jej.js +41 -0
  48. package/dist/canvas/chunks/ebnfDiagram-BXEA7PRR-j975ycq5.js +1 -0
  49. package/dist/canvas/chunks/erDiagram-JOGREHBK-sxp6hjn8.js +85 -0
  50. package/dist/canvas/chunks/eventmodeling-45OFAUF4-xzfgn6xg.js +1 -0
  51. package/dist/canvas/chunks/flowDiagram-UKHOOZJN-2nsmkskb.js +1 -0
  52. package/dist/canvas/chunks/ganttDiagram-PKOTCBZU-4tv230y2.js +292 -0
  53. package/dist/canvas/chunks/gitGraph-TEB2WS4Q-macbhand.js +1 -0
  54. package/dist/canvas/chunks/gitGraphDiagram-DS77QQ5N-mqgmnw9g.js +106 -0
  55. package/dist/canvas/chunks/index-037z5dz2.js +232 -0
  56. package/dist/canvas/chunks/index-081n3har.js +207 -0
  57. package/dist/canvas/chunks/index-5n03dmb9.js +2 -0
  58. package/dist/canvas/chunks/index-5tv8v1hk.js +1 -0
  59. package/dist/canvas/chunks/index-60pgzdqe.js +157 -0
  60. package/dist/canvas/chunks/index-6ceya556.js +332 -0
  61. package/dist/canvas/chunks/index-8g1vb57n.js +2 -0
  62. package/dist/canvas/chunks/index-8rjes9r6.js +2 -0
  63. package/dist/canvas/chunks/index-9022d1n9.js +16 -0
  64. package/dist/canvas/chunks/index-9b02042t.js +2 -0
  65. package/dist/canvas/chunks/index-ap4q4vez.js +2 -0
  66. package/dist/canvas/chunks/index-dyp2nhd3.js +2 -0
  67. package/dist/canvas/chunks/index-frvta4tm.js +2 -0
  68. package/dist/canvas/chunks/index-gf4e0et4.js +2 -0
  69. package/dist/canvas/chunks/index-h9ycj8n2.js +2 -0
  70. package/dist/canvas/chunks/index-hj99nz1f.js +1 -0
  71. package/dist/canvas/chunks/index-mergmj97.js +2 -0
  72. package/dist/canvas/chunks/index-nwsya6dj.js +301 -0
  73. package/dist/canvas/chunks/index-nz8qbd1p.js +2 -0
  74. package/dist/canvas/chunks/index-qhfrazv3.js +2 -0
  75. package/dist/canvas/chunks/index-v119nznk.js +4 -0
  76. package/dist/canvas/chunks/index-vpt37m3d.js +89 -0
  77. package/dist/canvas/chunks/index-y9ma6azy.js +2 -0
  78. package/dist/canvas/chunks/index-zx0j3a2z.js +179 -0
  79. package/dist/canvas/chunks/info-DKCQHKI2-a0ykzs9z.js +1 -0
  80. package/dist/canvas/chunks/infoDiagram-6WML65LV-qv97qq6a.js +2 -0
  81. package/dist/canvas/chunks/ishikawaDiagram-WSZJBQD7-p9306gh0.js +70 -0
  82. package/dist/canvas/chunks/journeyDiagram-NVQOT4AX-sv67zats.js +139 -0
  83. package/dist/canvas/chunks/kanban-definition-27J2QSJJ-k2pfam6p.js +89 -0
  84. package/dist/canvas/chunks/katex-dmg8k4zm.js +257 -0
  85. package/dist/canvas/chunks/mermaid.core-83r0fdce.js +12 -0
  86. package/dist/canvas/chunks/mindmap-definition-FAOFIHXS-vg2newm1.js +96 -0
  87. package/dist/canvas/chunks/packet-7NZHBO7P-tqnabcdv.js +1 -0
  88. package/dist/canvas/chunks/pegDiagram-VL7TDLO6-k2h7zc5n.js +1 -0
  89. package/dist/canvas/chunks/pie-RZYD4A2V-wke6gyhe.js +1 -0
  90. package/dist/canvas/chunks/pieDiagram-7S7Q4E2Y-hg169p1v.js +39 -0
  91. package/dist/canvas/chunks/quadrantDiagram-CIZ2JOQS-bxtvsq0b.js +7 -0
  92. package/dist/canvas/chunks/radar-I7S5WNFK-w7ka0drw.js +1 -0
  93. package/dist/canvas/chunks/railroad-3IZDKUUU-y3vg318x.js +1 -0
  94. package/dist/canvas/chunks/railroad-abnf-AHOZXSZD-6hqvcz3c.js +1 -0
  95. package/dist/canvas/chunks/railroad-ebnf-EBAXGLYW-vcae260m.js +1 -0
  96. package/dist/canvas/chunks/railroad-peg-LSFZ7HO6-0dbyme23.js +1 -0
  97. package/dist/canvas/chunks/railroadDiagram-AXF67PYL-njyhcp4p.js +1 -0
  98. package/dist/canvas/chunks/requirementDiagram-LRYGKXZP-2z6v09gm.js +84 -0
  99. package/dist/canvas/chunks/sankeyDiagram-W5VNT64P-15mzam0e.js +40 -0
  100. package/dist/canvas/chunks/sequenceDiagram-SI44F4Z6-rbshyd2c.js +162 -0
  101. package/dist/canvas/chunks/sizeCapture-X5ZJPWSS-sg26xwts.js +1 -0
  102. package/dist/canvas/chunks/stateDiagram-OKZ733FA-6eahp98e.js +1 -0
  103. package/dist/canvas/chunks/stateDiagram-v2-UEYNNEHI-tty0ggn5.js +1 -0
  104. package/dist/canvas/chunks/swimlanes-SLNWSIFB-ze5db10t.js +1 -0
  105. package/dist/canvas/chunks/swimlanesDiagram-ULZ7WXOC-thze75gq.js +8 -0
  106. package/dist/canvas/chunks/timeline-definition-Z64GVDOM-vnp7jyy8.js +120 -0
  107. package/dist/canvas/chunks/treeView-QDETBFTQ-6ysffnm6.js +1 -0
  108. package/dist/canvas/chunks/treemap-6X3UGDF4-m3h9p066.js +1 -0
  109. package/dist/canvas/chunks/vennDiagram-T6HMQDX7-0qrnb7mj.js +34 -0
  110. package/dist/canvas/chunks/wardley-OPB4EBWU-dp37drwx.js +1 -0
  111. package/dist/canvas/chunks/wardleyDiagram-T6FBY63Y-8nxg8wqt.js +78 -0
  112. package/dist/canvas/chunks/xychartDiagram-ELKLHX3M-nj921e7s.js +7 -0
  113. package/dist/canvas/global.css +483 -230
  114. package/dist/canvas/index.js +158 -219
  115. package/dist/canvas/mcp-app.html +4301 -548
  116. package/dist/canvas/mermaid-entry.js +338 -338
  117. package/dist/canvas/surface-theme.css +6 -6
  118. package/dist/json-render/index.css +1 -1
  119. package/dist/json-render/index.js +49 -49
  120. package/dist/types/client/canvas/BarHint.d.ts +5 -3
  121. package/dist/types/client/canvas/BoardMoveDialog.d.ts +2 -0
  122. package/dist/types/client/canvas/CanvasNode.d.ts +0 -11
  123. package/dist/types/client/canvas/EdgeEditor.d.ts +19 -0
  124. package/dist/types/client/canvas/EdgeLayer.d.ts +1 -2
  125. package/dist/types/client/canvas/GroupNavigation.d.ts +2 -0
  126. package/dist/types/client/canvas/TextPrompt.d.ts +4 -0
  127. package/dist/types/client/canvas/auto-fit.d.ts +4 -5
  128. package/dist/types/client/mermaid-entry.d.ts +1 -2
  129. package/dist/types/client/mermaid-render.d.ts +1 -0
  130. package/dist/types/client/nodes/BoardNode.d.ts +1 -1
  131. package/dist/types/client/nodes/ExtAppFrame.d.ts +7 -90
  132. package/dist/types/client/nodes/McpAppNode.d.ts +1 -25
  133. package/dist/types/client/nodes/MermaidNode.d.ts +1 -8
  134. package/dist/types/client/nodes/PromptNode.d.ts +1 -0
  135. package/dist/types/client/nodes/ViewerFrame.d.ts +29 -0
  136. package/dist/types/client/nodes/ViewerHost.d.ts +6 -0
  137. package/dist/types/client/nodes/WorkCard.d.ts +7 -0
  138. package/dist/types/client/nodes/iframe-document-url.d.ts +3 -9
  139. package/dist/types/client/nodes/primitive-copy.d.ts +5 -0
  140. package/dist/types/client/nodes/use-ax-surface-bridge.d.ts +1 -0
  141. package/dist/types/client/nodes/use-iframe-content-height.d.ts +1 -1
  142. package/dist/types/client/nodes/use-surface-frame.d.ts +4 -6
  143. package/dist/types/client/nodes/viewer-runtime-state.d.ts +2 -1
  144. package/dist/types/client/state/canvas-store.d.ts +18 -1
  145. package/dist/types/client/state/human-store.d.ts +2 -0
  146. package/dist/types/client/state/intent-bridge.d.ts +5 -2
  147. package/dist/types/client/state/presentation.d.ts +17 -6
  148. package/dist/types/client/state/relation-store.d.ts +11 -0
  149. package/dist/types/client/types.d.ts +1 -1
  150. package/dist/types/json-render/catalog.d.ts +2 -2
  151. package/dist/types/json-render/server.d.ts +2 -1
  152. package/dist/types/server/agent-presence.d.ts +1 -0
  153. package/dist/types/server/ax-interaction.d.ts +1 -0
  154. package/dist/types/server/ax-state-manager.d.ts +10 -2
  155. package/dist/types/server/board-local.d.ts +4 -0
  156. package/dist/types/server/board-move.d.ts +38 -0
  157. package/dist/types/server/canvas-db.d.ts +12 -2
  158. package/dist/types/server/canvas-operations.d.ts +5 -6
  159. package/dist/types/server/canvas-provenance.d.ts +1 -1
  160. package/dist/types/server/canvas-serialization.d.ts +1 -0
  161. package/dist/types/server/canvas-state.d.ts +86 -20
  162. package/dist/types/server/card-relocation.d.ts +6 -0
  163. package/dist/types/server/context-reads.d.ts +3 -1
  164. package/dist/types/server/human-presence.d.ts +1 -1
  165. package/dist/types/server/index.d.ts +26 -10
  166. package/dist/types/server/intent-registry.d.ts +8 -4
  167. package/dist/types/server/knowledge-lifecycle.d.ts +4 -2
  168. package/dist/types/server/mutation-history.d.ts +7 -5
  169. package/dist/types/server/operations/ops/boards.d.ts +0 -1
  170. package/dist/types/server/operations/registry.d.ts +2 -0
  171. package/dist/types/server/tour-control.d.ts +13 -3
  172. package/dist/types/server/trace-manager.d.ts +1 -0
  173. package/dist/types/shared/ax-kinds.d.ts +6 -0
  174. package/dist/types/shared/ax-surface-protocol.d.ts +8 -9
  175. package/dist/types/shared/human-presence.d.ts +1 -0
  176. package/dist/types/shared/lifecycle-status.d.ts +2 -0
  177. package/dist/types/shared/tour.d.ts +8 -0
  178. package/docs/RELEASE.md +21 -14
  179. package/docs/agent-plugin.md +16 -2
  180. package/docs/amp-plugin.md +271 -0
  181. package/docs/cli.md +42 -3
  182. package/docs/design/Chrome.dc.html +32 -6
  183. package/docs/design/GuestName.dc.html +50 -0
  184. package/docs/design/PluginLogo.svg +7 -0
  185. package/docs/design/Types1.dc.html +3 -2
  186. package/docs/design/Types2.dc.html +1 -1
  187. package/docs/design/Types3.dc.html +1 -1
  188. package/docs/design/WorkCards.dc.html +39 -0
  189. package/docs/design/Zoom.dc.html +37 -60
  190. package/docs/design/canvas.json +17 -1
  191. package/docs/design/plugin-logo.png +0 -0
  192. package/docs/design.md +280 -12
  193. package/docs/evals/agents-md-sections.md +38 -0
  194. package/docs/http-api.md +179 -11
  195. package/docs/mcp.md +69 -9
  196. package/docs/node-types.md +109 -4
  197. package/docs/plans/plan-009-tech-debt-backlog.md +3 -3
  198. package/docs/plans/plan-019-post-0.9-roadmap.md +327 -31
  199. package/docs/plans/plan-020-wave-5-work-planning.md +553 -0
  200. package/docs/product-vision-2026-09.md +42 -17
  201. package/docs/sdk.md +18 -0
  202. package/package.json +7 -4
  203. package/plugins/pmx-canvas/assets/preview.png +0 -0
  204. package/plugins/pmx-canvas/com.github.copilot/extensions/pmx-canvas/extension.mjs +3 -1
  205. package/plugins/pmx-canvas/com.github.copilot/extensions/pmx-canvas/runtime.json +1 -1
  206. package/plugins/pmx-canvas/plugin.json +2 -2
  207. package/plugins/pmx-canvas/runtime.json +1 -1
  208. package/plugins/pmx-canvas/tools.json +688 -128
  209. package/skills/data-analysis/SKILL.md +13 -26
  210. package/skills/frontend-design/LICENSE.txt +177 -0
  211. package/skills/frontend-design/SKILL.md +3 -0
  212. package/skills/pmx-canvas/SKILL.md +232 -849
  213. package/skills/pmx-canvas/evals/evals.json +26 -3
  214. package/skills/pmx-canvas/references/full-reference.md +89 -24
  215. package/skills/pmx-canvas/references/html-primitives.md +7 -0
  216. package/skills/pmx-canvas/references/installing-pmx-canvas.md +6 -6
  217. package/skills/pmx-canvas/references/tours-and-recording.md +29 -2
  218. package/skills/pmx-canvas/references/workbench-workflows.md +900 -0
  219. package/skills/pmx-canvas-testing/SKILL.md +7 -5
  220. package/skills/published-consumer-e2e/SKILL.md +25 -8
  221. package/skills/published-consumer-e2e/scripts/run-published-consumer-e2e.sh +51 -77
  222. package/skills/web-artifacts-builder/LICENSE.txt +202 -0
  223. package/skills/web-artifacts-builder/SKILL.md +6 -0
  224. package/skills/web-artifacts-builder/scripts/init-artifact.sh +2 -2
  225. package/src/cli/commands/apps.ts +1 -0
  226. package/src/cli/commands/boards.ts +30 -0
  227. package/src/client/App.tsx +20 -4
  228. package/src/client/canvas/AttentionHistory.tsx +10 -2
  229. package/src/client/canvas/BarHint.tsx +6 -3
  230. package/src/client/canvas/BoardMoveDialog.tsx +225 -0
  231. package/src/client/canvas/CanvasNode.tsx +79 -49
  232. package/src/client/canvas/CanvasViewport.tsx +42 -14
  233. package/src/client/canvas/ContextMenu.tsx +97 -15
  234. package/src/client/canvas/EdgeEditor.tsx +149 -0
  235. package/src/client/canvas/EdgeLayer.tsx +441 -174
  236. package/src/client/canvas/ExpandedNodeOverlay.tsx +5 -2
  237. package/src/client/canvas/GroupNavigation.tsx +85 -0
  238. package/src/client/canvas/Presentation.tsx +53 -3
  239. package/src/client/canvas/RelationsPanel.tsx +9 -0
  240. package/src/client/canvas/SelectionBar.tsx +21 -0
  241. package/src/client/canvas/SessionPanel.tsx +35 -1
  242. package/src/client/canvas/TextPrompt.tsx +18 -1
  243. package/src/client/canvas/TopBar.tsx +54 -9
  244. package/src/client/canvas/auto-fit.ts +9 -11
  245. package/src/client/canvas/canvas-area.ts +2 -2
  246. package/src/client/canvas/use-focus-trap.ts +6 -1
  247. package/src/client/mermaid-entry.ts +6 -20
  248. package/src/client/mermaid-render.ts +39 -0
  249. package/src/client/nodes/AxStepControls.tsx +45 -69
  250. package/src/client/nodes/BoardNode.tsx +65 -9
  251. package/src/client/nodes/ContextNode.tsx +88 -396
  252. package/src/client/nodes/ExtAppFrame.tsx +302 -1465
  253. package/src/client/nodes/FileNode.tsx +92 -81
  254. package/src/client/nodes/HtmlNode.tsx +8 -36
  255. package/src/client/nodes/LedgerNode.tsx +31 -17
  256. package/src/client/nodes/MarkdownNode.tsx +14 -24
  257. package/src/client/nodes/McpAppNode.tsx +48 -154
  258. package/src/client/nodes/MermaidNode.tsx +80 -69
  259. package/src/client/nodes/PromptNode.tsx +44 -17
  260. package/src/client/nodes/ResponseNode.tsx +8 -6
  261. package/src/client/nodes/StatusNode.tsx +34 -7
  262. package/src/client/nodes/StatusSummary.tsx +16 -3
  263. package/src/client/nodes/TraceNode.tsx +8 -8
  264. package/src/client/nodes/ViewerFrame.tsx +273 -0
  265. package/src/client/nodes/ViewerHost.tsx +41 -0
  266. package/src/client/nodes/WebpageNode.tsx +22 -24
  267. package/src/client/nodes/WorkCard.tsx +175 -0
  268. package/src/client/nodes/iframe-document-url.ts +20 -27
  269. package/src/client/nodes/primitive-copy.ts +97 -0
  270. package/src/client/nodes/use-ax-surface-bridge.ts +18 -14
  271. package/src/client/nodes/use-iframe-content-height.ts +34 -10
  272. package/src/client/nodes/use-surface-frame.ts +22 -11
  273. package/src/client/nodes/viewer-runtime-state.ts +41 -35
  274. package/src/client/state/attention-bridge.ts +5 -0
  275. package/src/client/state/attention-store.ts +1 -0
  276. package/src/client/state/canvas-store.ts +202 -26
  277. package/src/client/state/human-store.ts +22 -2
  278. package/src/client/state/intent-bridge.ts +20 -5
  279. package/src/client/state/presentation.ts +135 -15
  280. package/src/client/state/relation-store.ts +127 -1
  281. package/src/client/state/sse-bridge.ts +18 -19
  282. package/src/client/theme/global.css +483 -230
  283. package/src/client/theme/surface-theme.css +6 -6
  284. package/src/client/types.ts +1 -0
  285. package/src/json-render/charts/tufte-components.tsx +44 -2
  286. package/src/json-render/renderer/index.css +62 -2
  287. package/src/json-render/renderer/index.tsx +31 -7
  288. package/src/json-render/server.ts +3 -2
  289. package/src/mcp/server.ts +13 -3
  290. package/src/server/agent-presence.ts +43 -23
  291. package/src/server/ax-flow-loop.ts +6 -0
  292. package/src/server/ax-gate-ttl.ts +8 -1
  293. package/src/server/ax-interaction.ts +16 -10
  294. package/src/server/ax-state-manager.ts +17 -4
  295. package/src/server/ax-wait.ts +20 -6
  296. package/src/server/board-export.ts +54 -30
  297. package/src/server/board-local.ts +20 -0
  298. package/src/server/board-move.ts +297 -0
  299. package/src/server/canvas-db.ts +249 -158
  300. package/src/server/canvas-geometry.ts +1 -0
  301. package/src/server/canvas-operations.ts +139 -109
  302. package/src/server/canvas-schema.ts +21 -0
  303. package/src/server/canvas-serialization.ts +2 -0
  304. package/src/server/canvas-state.ts +797 -159
  305. package/src/server/card-relocation.ts +53 -0
  306. package/src/server/code-graph.ts +4 -3
  307. package/src/server/context-reads.ts +83 -55
  308. package/src/server/demo-state.json +140 -114
  309. package/src/server/file-watcher.ts +30 -10
  310. package/src/server/html-primitives.ts +3 -9
  311. package/src/server/html-surface.ts +8 -0
  312. package/src/server/human-presence.ts +18 -5
  313. package/src/server/index.ts +54 -24
  314. package/src/server/intent-registry.ts +43 -5
  315. package/src/server/knowledge-lifecycle.ts +32 -9
  316. package/src/server/lifecycle-status.ts +29 -1
  317. package/src/server/mcp-app-runtime.ts +26 -7
  318. package/src/server/mutation-history.ts +37 -8
  319. package/src/server/operations/composites.ts +6 -3
  320. package/src/server/operations/mcp-contracts.ts +32 -2
  321. package/src/server/operations/mcp.ts +36 -9
  322. package/src/server/operations/ops/annotation.ts +22 -1
  323. package/src/server/operations/ops/ax-await.ts +1 -0
  324. package/src/server/operations/ops/ax-timeline.ts +28 -2
  325. package/src/server/operations/ops/batch.ts +25 -11
  326. package/src/server/operations/ops/boards.ts +45 -6
  327. package/src/server/operations/ops/nodes.ts +70 -0
  328. package/src/server/operations/ops/query.ts +32 -3
  329. package/src/server/operations/ops/snapshots.ts +1 -0
  330. package/src/server/operations/ops/viewport.ts +11 -9
  331. package/src/server/operations/registry.ts +49 -4
  332. package/src/server/server.ts +69 -75
  333. package/src/server/tour-control.ts +97 -12
  334. package/src/server/trace-manager.ts +4 -0
  335. package/src/server/web-artifacts/scripts/init-artifact.sh +2 -2
  336. package/src/shared/agent-context.ts +7 -1
  337. package/src/shared/auto-arrange.ts +5 -4
  338. package/src/shared/ax-kinds.ts +13 -0
  339. package/src/shared/ax-surface-protocol.ts +20 -9
  340. package/src/shared/content-height-reporter.ts +4 -3
  341. package/src/shared/human-presence.ts +1 -0
  342. package/src/shared/lifecycle-status.ts +2 -0
  343. package/src/shared/tour.ts +8 -0
@@ -0,0 +1,34 @@
1
+ import{e,N,fr,i,a,x,u,T,d,f,p,m,g,b,v,n,A,E,s}from"./index-nwsya6dj.js";import"./index-v119nznk.js";var fe=(t,o)=>fr(t,"a",-o),wt=fe;function It(t,o){let l=de(t),r=l.filter((I)=>he(I,t)),c=0,h=0,y=[];if(r.length>1){let I=Kt(r);for(let S=0;S<r.length;++S){let k=r[S];k.angle=Math.atan2(k.x-I.x,k.y-I.y)}r.sort((S,k)=>k.angle-S.angle);let w=r[r.length-1];for(let S=0;S<r.length;++S){let k=r[S];h+=(w.x+k.x)*(k.y-w.y);let C={x:(k.x+w.x)/2,y:(k.y+w.y)/2},z=null;for(let j=0;j<k.parentIndex.length;++j)if(w.parentIndex.includes(k.parentIndex[j])){let O=t[k.parentIndex[j]],B=Math.atan2(k.x-O.x,k.y-O.y),W=Math.atan2(w.x-O.x,w.y-O.y),U=W-B;if(U<0)U+=2*Math.PI;let q=W-U/2,D=at(C,{x:O.x+O.radius*Math.sin(q),y:O.y+O.radius*Math.cos(q)});if(D>O.radius*2)D=O.radius*2;if(z==null||z.width>D)z={circle:O,width:D,p1:k,p2:w,large:D>O.radius,sweep:!0}}if(z!=null)y.push(z),c+=Tt(z.circle.radius,z.width),w=k}}else{let I=t[0];for(let S=1;S<t.length;++S)if(t[S].radius<I.radius)I=t[S];let w=!1;for(let S=0;S<t.length;++S)if(at(t[S],I)>Math.abs(I.radius-t[S].radius)){w=!0;break}if(w)c=h=0;else c=I.radius*I.radius*Math.PI,y.push({circle:I,p1:{x:I.x,y:I.y+I.radius},p2:{x:I.x-0.0000000001,y:I.y+I.radius},width:I.radius*2,large:!0,sweep:!0})}if(h/=2,o)o.area=c+h,o.arcArea=c,o.polygonArea=h,o.arcs=y,o.innerPoints=r,o.intersectionPoints=l;return c+h}function he(t,o){return o.every((l)=>at(t,l)<l.radius+0.0000000001)}function de(t){let o=[];for(let l=0;l<t.length;++l)for(let r=l+1;r<t.length;++r){let c=Wt(t[l],t[r]);for(let h of c)h.parentIndex=[l,r],o.push(h)}return o}function Tt(t,o){return t*t*Math.acos(1-o/t)-(t-o)*Math.sqrt(o*(2*t-o))}function at(t,o){return Math.sqrt((t.x-o.x)*(t.x-o.x)+(t.y-o.y)*(t.y-o.y))}function Nt(t,o,l){if(l>=t+o)return 0;if(l<=Math.abs(t-o))return Math.PI*Math.min(t,o)*Math.min(t,o);let r=t-(l*l-o*o+t*t)/(2*l),c=o-(l*l-t*t+o*o)/(2*l);return Tt(t,r)+Tt(o,c)}function Wt(t,o){let l=at(t,o),r=t.radius,c=o.radius;if(l>=r+c||l<=Math.abs(r-c))return[];let h=(r*r-c*c+l*l)/(2*l),y=Math.sqrt(r*r-h*h),I=t.x+h*(o.x-t.x)/l,w=t.y+h*(o.y-t.y)/l,S=-(o.y-t.y)*(y/l),k=-(o.x-t.x)*(y/l);return[{x:I+S,y:w-k},{x:I-S,y:w+k}]}function Kt(t){let o={x:0,y:0};for(let l of t)o.x+=l.x,o.y+=l.y;return o.x/=t.length,o.y/=t.length,o}function ge(t,o,l,r){r=r||{};let c=r.maxIterations||100,h=r.tolerance||0.0000000001,y=t(o),I=t(l),w=l-o;if(y*I>0)throw"Initial bisect points must have opposite signs";if(y===0)return o;if(I===0)return l;for(let S=0;S<c;++S){w/=2;let k=o+w,C=t(k);if(C*y>=0)o=k;if(Math.abs(w)<h||C===0)return k}return o+w}function zt(t){let o=Array(t);for(let l=0;l<t;++l)o[l]=0;return o}function Ut(t,o){return zt(t).map(()=>zt(o))}function pt(t,o){let l=0;for(let r=0;r<t.length;++r)l+=t[r]*o[r];return l}function At(t){return Math.sqrt(pt(t,t))}function Dt(t,o,l){for(let r=0;r<o.length;++r)t[r]=o[r]*l}function xt(t,o,l,r,c){for(let h=0;h<t.length;++h)t[h]=o*l[h]+r*c[h]}function Ht(t,o,l){l=l||{};let r=l.maxIterations||o.length*200,c=l.nonZeroDelta||1.05,h=l.zeroDelta||0.001,y=l.minErrorDelta||0.000001,I=l.minErrorDelta||0.00001,w=l.rho!==void 0?l.rho:1,S=l.chi!==void 0?l.chi:2,k=l.psi!==void 0?l.psi:-0.5,C=l.sigma!==void 0?l.sigma:0.5,z,j=o.length,O=Array(j+1);O[0]=o,O[0].fx=t(o),O[0].id=0;for(let F=0;F<j;++F){let M=o.slice();M[F]=M[F]?M[F]*c:h,O[F+1]=M,O[F+1].fx=t(M),O[F+1].id=F+1}function B(F){for(let M=0;M<F.length;M++)O[j][M]=F[M];O[j].fx=F.fx}let W=(F,M)=>F.fx-M.fx,U=o.slice(),q=o.slice(),D=o.slice(),L=o.slice();for(let F=0;F<r;++F){if(O.sort(W),l.history){let R=O.map((_)=>{let Y=_.slice();return Y.fx=_.fx,Y.id=_.id,Y});R.sort((_,Y)=>_.id-Y.id),l.history.push({x:O[0].slice(),fx:O[0].fx,simplex:R})}z=0;for(let R=0;R<j;++R)z=Math.max(z,Math.abs(O[0][R]-O[1][R]));if(Math.abs(O[0].fx-O[j].fx)<y&&z<I)break;for(let R=0;R<j;++R){U[R]=0;for(let _=0;_<j;++_)U[R]+=O[_][R];U[R]/=j}let M=O[j];if(xt(q,1+w,U,-w,M),q.fx=t(q),q.fx<O[0].fx)if(xt(L,1+S,U,-S,M),L.fx=t(L),L.fx<q.fx)B(L);else B(q);else if(q.fx>=O[j-1].fx){let R=!1;if(q.fx>M.fx)if(xt(D,1+k,U,-k,M),D.fx=t(D),D.fx<M.fx)B(D);else R=!0;else if(xt(D,1-k*w,U,k*w,M),D.fx=t(D),D.fx<q.fx)B(D);else R=!0;if(R){if(C>=1)break;for(let _=1;_<O.length;++_)xt(O[_],1-C,O[0],C,O[_]),O[_].fx=t(O[_])}}else B(q)}return O.sort(W),{fx:O[0].fx,x:O[0]}}function xe(t,o,l,r,c,h,y){let I=l.fx,w=pt(l.fxprime,o),S=I,k=I,C=w,z=0;c=c||1,h=h||0.000001,y=y||0.1;function j(O,B,W){for(let U=0;U<16;++U)if(c=(O+B)/2,xt(r.x,1,l.x,c,o),S=r.fx=t(r.x,r.fxprime),C=pt(r.fxprime,o),S>I+h*c*w||S>=W)B=c;else{if(Math.abs(C)<=-y*w)return c;if(C*(B-O)>=0)B=O;O=c,W=S}return 0}for(let O=0;O<10;++O){if(xt(r.x,1,l.x,c,o),S=r.fx=t(r.x,r.fxprime),C=pt(r.fxprime,o),S>I+h*c*w||O&&S>=k)return j(z,c,k);if(Math.abs(C)<=-y*w)return c;if(C>=0)return j(c,z,S);k=S,z=c,c*=2}return c}function ye(t,o,l){let r={x:o.slice(),fx:0,fxprime:o.slice()},c={x:o.slice(),fx:0,fxprime:o.slice()},h=o.slice(),y,I,w=1,S;l=l||{},S=l.maxIterations||o.length*20,r.fx=t(r.x,r.fxprime),y=r.fxprime.slice(),Dt(y,r.fxprime,-1);for(let k=0;k<S;++k){if(w=xe(t,y,r,c,w),l.history)l.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:w});if(!w)Dt(y,r.fxprime,-1);else{xt(h,1,c.fxprime,-1,r.fxprime);let C=pt(r.fxprime,r.fxprime),z=Math.max(0,pt(h,c.fxprime)/C);xt(y,z,y,-1,c.fxprime),I=r,r=c,c=I}if(At(r.fxprime)<=0.00001)break}if(l.history)l.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:w});return r}function Yt(t,o={}){o.maxIterations=o.maxIterations||500;let l=o.initialLayout||ve,r=o.lossFunction||mt,c=pe(t,o),h=l(c,o),y=Object.keys(h),I=[];for(let k of y)I.push(h[k].x),I.push(h[k].y);let S=Ht((k)=>{let C={};for(let z=0;z<y.length;++z){let j=y[z];C[j]={x:k[2*z],y:k[2*z+1],radius:h[j].radius}}return r(C,c)},I,o).x;for(let k=0;k<y.length;++k){let C=y[k];h[C].x=S[2*k],h[C].y=S[2*k+1]}return h}var Xt=0.0000000001;function Rt(t,o,l){if(Math.min(t,o)*Math.min(t,o)*Math.PI<=l+Xt)return Math.abs(t-o);return ge((r)=>Nt(t,o,r)-l,0,t+o)}function pe(t,o={}){let l=o.distinct,r=t.map((I)=>Object.assign({},I));function c(I){return I.join(";")}if(l){let I=new Map;for(let w of r)for(let S=0;S<w.sets.length;S++){let k=String(w.sets[S]);I.set(k,w.size+(I.get(k)||0));for(let C=S+1;C<w.sets.length;C++){let z=String(w.sets[C]),j=`${k};${z}`,O=`${z};${k}`;I.set(j,w.size+(I.get(j)||0)),I.set(O,w.size+(I.get(O)||0))}}for(let w of r)if(w.sets.length<3)w.size=I.get(c(w.sets))}let h=[],y=new Set;for(let I of r)if(I.sets.length===1)h.push(I.sets[0]);else if(I.sets.length===2){let w=I.sets[0],S=I.sets[1];y.add(c(I.sets)),y.add(c([S,w]))}h.sort((I,w)=>I===w?0:I<w?-1:1);for(let I=0;I<h.length;++I){let w=h[I];for(let S=I+1;S<h.length;++S){let k=h[S];if(!y.has(c([w,k])))r.push({sets:[w,k],size:0})}}return r}function me(t,o,l){let r=Ut(o.length,o.length),c=Ut(o.length,o.length);return t.filter((h)=>h.sets.length===2).forEach((h)=>{let y=l[h.sets[0]],I=l[h.sets[1]],w=Math.sqrt(o[y].size/Math.PI),S=Math.sqrt(o[I].size/Math.PI),k=Rt(w,S,h.size);r[y][I]=r[I][y]=k;let C=0;if(h.size+0.0000000001>=Math.min(o[y].size,o[I].size))C=1;else if(h.size<=0.0000000001)C=-1;c[y][I]=c[I][y]=C}),{distances:r,constraints:c}}function be(t,o,l,r){for(let h=0;h<o.length;++h)o[h]=0;let c=0;for(let h=0;h<l.length;++h){let y=t[2*h],I=t[2*h+1];for(let w=h+1;w<l.length;++w){let S=t[2*w],k=t[2*w+1],C=l[h][w],z=r[h][w],j=(S-y)*(S-y)+(k-I)*(k-I),O=Math.sqrt(j),B=j-C*C;if(z>0&&O<=C||z<0&&O>=C)continue;c+=2*B*B,o[2*h]+=4*B*(y-S),o[2*h+1]+=4*B*(I-k),o[2*w]+=4*B*(S-y),o[2*w+1]+=4*B*(k-I)}}return c}function ve(t,o={}){let l=Ie(t,o),r=o.lossFunction||mt;if(t.length>=8){let c=ke(t,o),h=r(c,t),y=r(l,t);if(h+0.00000001<y)l=c}return l}function ke(t,o={}){let l=o.restarts||10,r=[],c={};for(let z of t)if(z.sets.length===1)c[z.sets[0]]=r.length,r.push(z);let{distances:h,constraints:y}=me(t,r,c),I=At(h.map(At))/h.length;h=h.map((z)=>z.map((j)=>j/I));let w=(z,j)=>be(z,j,h,y),S=null;for(let z=0;z<l;++z){let j=zt(h.length*2).map(Math.random),O=ye(w,j,o);if(!S||O.fx<S.fx)S=O}let k=S.x,C={};for(let z=0;z<r.length;++z){let j=r[z];C[j.sets[0]]={x:k[2*z]*I,y:k[2*z+1]*I,radius:Math.sqrt(j.size/Math.PI)}}if(o.history)for(let z of o.history)Dt(z.x,I);return C}function Ie(t,o){let l=o&&o.lossFunction?o.lossFunction:mt,r={},c={};for(let C of t)if(C.sets.length===1){let z=C.sets[0];r[z]={x:10000000000,y:10000000000,rowid:r.length,size:C.size,radius:Math.sqrt(C.size/Math.PI)},c[z]=[]}t=t.filter((C)=>C.sets.length===2);for(let C of t){let z=C.weight!=null?C.weight:1,j=C.sets[0],O=C.sets[1];if(C.size+Xt>=Math.min(r[j].size,r[O].size))z=0;c[j].push({set:O,size:C.size,weight:z}),c[O].push({set:j,size:C.size,weight:z})}let h=[];Object.keys(c).forEach((C)=>{let z=0;for(let j=0;j<c[C].length;++j)z+=c[C][j].size*c[C][j].weight;h.push({set:C,size:z})});function y(C,z){return z.size-C.size}h.sort(y);let I={};function w(C){return C.set in I}function S(C,z){r[z].x=C.x,r[z].y=C.y,I[z]=!0}S({x:0,y:0},h[0].set);for(let C=1;C<h.length;++C){let z=h[C].set,j=c[z].filter(w),O=r[z];if(j.sort(y),j.length===0)throw"ERROR: missing pairwise overlap information";let B=[];for(var k=0;k<j.length;++k){let q=r[j[k].set],D=Rt(O.radius,q.radius,j[k].size);B.push({x:q.x+D,y:q.y}),B.push({x:q.x-D,y:q.y}),B.push({y:q.y+D,x:q.x}),B.push({y:q.y-D,x:q.x});for(let L=k+1;L<j.length;++L){let F=r[j[L].set],M=Rt(O.radius,F.radius,j[L].size),R=Wt({x:q.x,y:q.y,radius:D},{x:F.x,y:F.y,radius:M});B.push(...R)}}let W=100000000000000000000000000000000000000000000000000,U=B[0];for(let q of B){r[z].x=q.x,r[z].y=q.y;let D=l(r,t);if(D<W)W=D,U=q}S(U,z)}return r}function mt(t,o){let l=0;for(let r of o){if(r.sets.length===1)continue;let c;if(r.sets.length===2){let y=t[r.sets[0]],I=t[r.sets[1]];c=Nt(y.radius,I.radius,at(y,I))}else c=It(r.sets.map((y)=>t[y]));let h=r.weight!=null?r.weight:1;l+=h*(c-r.size)*(c-r.size)}return l}function Zt(t,o){let l=0;for(let r of o){if(r.sets.length===1)continue;let c;if(r.sets.length===2){let I=t[r.sets[0]],w=t[r.sets[1]];c=Nt(I.radius,w.radius,at(I,w))}else c=It(r.sets.map((I)=>t[I]));let h=r.weight!=null?r.weight:1,y=Math.log((c+1)/(r.size+1));l+=h*y*y}return l}function Me(t,o,l){if(l==null)t.sort((c,h)=>h.radius-c.radius);else t.sort(l);if(t.length>0){let c=t[0].x,h=t[0].y;for(let y of t)y.x-=c,y.y-=h}if(t.length===2){if(at(t[0],t[1])<Math.abs(t[1].radius-t[0].radius))t[1].x=t[0].x+t[0].radius-t[1].radius-0.0000000001,t[1].y=t[0].y}if(t.length>1){let c=Math.atan2(t[1].x,t[1].y)-o,h=Math.cos(c),y=Math.sin(c);for(let I of t){let{x:w,y:S}=I;I.x=h*w-y*S,I.y=y*w+h*S}}if(t.length>2){let c=Math.atan2(t[2].x,t[2].y)-o;while(c<0)c+=2*Math.PI;while(c>2*Math.PI)c-=2*Math.PI;if(c>Math.PI){let h=t[1].y/(0.0000000001+t[1].x);for(let y of t){var r=(y.x+h*y.y)/(1+h*h);y.x=2*r-y.x,y.y=2*r*h-y.y}}}}function Se(t){t.forEach((c)=>{c.parent=c});function o(c){if(c.parent!==c)c.parent=o(c.parent);return c.parent}function l(c,h){let y=o(c),I=o(h);y.parent=I}for(let c=0;c<t.length;++c)for(let h=c+1;h<t.length;++h){let y=t[c].radius+t[h].radius;if(at(t[c],t[h])+0.0000000001<y)l(t[h],t[c])}let r=new Map;for(let c=0;c<t.length;++c){let h=o(t[c]).parent.setid;if(!r.has(h))r.set(h,[]);r.get(h).push(t[c])}return t.forEach((c)=>{delete c.parent}),Array.from(r.values())}function Ct(t){let o=(l)=>{let r=t.reduce((h,y)=>Math.max(h,y[l]+y.radius),Number.NEGATIVE_INFINITY),c=t.reduce((h,y)=>Math.min(h,y[l]-y.radius),Number.POSITIVE_INFINITY);return{max:r,min:c}};return{xRange:o("x"),yRange:o("y")}}function Jt(t,o,l){if(o==null)o=Math.PI/2;let r=te(t).map((S)=>Object.assign({},S)),c=Se(r);for(let S of c){Me(S,o,l);let k=Ct(S);S.size=(k.xRange.max-k.xRange.min)*(k.yRange.max-k.yRange.min),S.bounds=k}c.sort((S,k)=>k.size-S.size),r=c[0];let h=r.bounds,y=(h.xRange.max-h.xRange.min)/50;function I(S,k,C){if(!S)return;let z=S.bounds,j,O;if(k)j=h.xRange.max-z.xRange.min+y;else{j=h.xRange.max-z.xRange.max;let B=(z.xRange.max-z.xRange.min)/2-(h.xRange.max-h.xRange.min)/2;if(B<0)j+=B}if(C)O=h.yRange.max-z.yRange.min+y;else{O=h.yRange.max-z.yRange.max;let B=(z.yRange.max-z.yRange.min)/2-(h.yRange.max-h.yRange.min)/2;if(B<0)O+=B}for(let B of S)B.x+=j,B.y+=O,r.push(B)}let w=1;while(w<c.length)I(c[w],!0,!1),I(c[w+1],!1,!0),I(c[w+2],!0,!0),w+=3,h=Ct(r);return $t(r)}function Qt(t,o,l,r,c){let h=te(t);o-=2*r,l-=2*r;let{xRange:y,yRange:I}=Ct(h);if(y.max===y.min||I.max===I.min)return console.log("not scaling solution: zero size detected"),t;let w,S;if(c){let j=Math.sqrt(c/Math.PI)*2;w=o/j,S=l/j}else w=o/(y.max-y.min),S=l/(I.max-I.min);let k=Math.min(S,w),C=(o-(y.max-y.min)*k)/2,z=(l-(I.max-I.min)*k)/2;return $t(h.map((j)=>({radius:k*j.radius,x:r+C+(j.x-y.min)*k,y:r+z+(j.y-I.min)*k,setid:j.setid})))}function $t(t){let o={};for(let l of t)o[l.setid]=l;return o}function te(t){return Object.keys(t).map((l)=>Object.assign(t[l],{setid:l}))}function ee(t={}){let o=!1,l=600,r=350,c=15,h=1000,y=Math.PI/2,I=!0,w=null,S=!0,k=!0,C=null,z=null,j=!1,O=null,B=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,W={},U=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],q=0,D=function(R){if(R in W)return W[R];var _=W[R]=U[q];if(q+=1,q>=U.length)q=0;return _},L=Yt,F=mt;function M(R){let _=R.datum(),Y=new Set;_.forEach((P)=>{if(P.size==0&&P.sets.length==1)Y.add(P.sets[0])}),_=_.filter((P)=>!P.sets.some((st)=>Y.has(st)));let V={},X={};if(_.length>0){let P=L(_,{lossFunction:F,distinct:j});if(I)P=Jt(P,y,z);V=Qt(P,l,r,c,w),X=se(V,_,B)}let lt={};_.forEach((P)=>{if(P.label)lt[P.sets]=P.label});function it(P){if(P.sets in lt)return lt[P.sets];if(P.sets.length==1)return""+P.sets[0]}R.selectAll("svg").data([V]).enter().append("svg");let J=R.select("svg");if(o)J.attr("viewBox",`0 0 ${l} ${r}`);else J.attr("width",l).attr("height",r);let H={},Z=!1;J.selectAll(".venn-area path").each(function(P){let st=this.getAttribute("d");if(P.sets.length==1&&st&&!j)Z=!0,H[P.sets[0]]=Ee(st)});function G(P){return(st)=>{let bt=P.sets.map((gt)=>{let ht=H[gt],ot=V[gt];if(!ht)ht={x:l/2,y:r/2,radius:1};if(!ot)ot={x:l/2,y:r/2,radius:1};return{x:ht.x*(1-st)+ot.x*st,y:ht.y*(1-st)+ot.y*st,radius:ht.radius*(1-st)+ot.radius*st}});return Gt(bt,O)}}let Q=J.selectAll(".venn-area").data(_,(P)=>P.sets),rt=Q.enter().append("g").attr("class",(P)=>`venn-area venn-${P.sets.length==1?"circle":"intersection"}${P.colour||P.color?" venn-coloured":""}`).attr("data-venn-sets",(P)=>P.sets.join("_")),tt=rt.append("path"),et=rt.append("text").attr("class","label").text((P)=>it(P)).attr("text-anchor","middle").attr("dy",".35em").attr("x",l/2).attr("y",r/2);if(k)tt.style("fill-opacity","0").filter((P)=>P.sets.length==1).style("fill",(P)=>P.colour?P.colour:P.color?P.color:D(P.sets)).style("fill-opacity",".25"),et.style("fill",(P)=>{if(P.colour||P.color)return"#FFF";if(t.textFill)return t.textFill;return P.sets.length==1?D(P.sets):"#444"});function ft(P){if(typeof P.transition==="function")return P.transition("venn").duration(h);return P}let nt=R;if(Z&&typeof nt.transition==="function")nt=ft(R),nt.selectAll("path").attrTween("d",G);else nt.selectAll("path").attr("d",(P)=>Gt(P.sets.map((st)=>V[st])),O);let K=nt.selectAll("text").filter((P)=>(P.sets in X)).text((P)=>it(P)).attr("x",(P)=>Math.floor(X[P.sets].x)).attr("y",(P)=>Math.floor(X[P.sets].y));if(S)if(Z)if("on"in K)K.on("end",_t(V,it));else K.each("end",_t(V,it));else K.each(_t(V,it));let dt=ft(Q.exit()).remove();if(typeof Q.transition==="function")dt.selectAll("path").attrTween("d",G);let ct=dt.selectAll("text").attr("x",l/2).attr("y",r/2);if(C!==null)et.style("font-size","0px"),K.style("font-size",C),ct.style("font-size","0px");return{circles:V,textCentres:X,nodes:Q,enter:rt,update:nt,exit:dt}}return M.wrap=function(R){if(!arguments.length)return S;return S=R,M},M.useViewBox=function(){return o=!0,M},M.width=function(R){if(!arguments.length)return l;return l=R,M},M.height=function(R){if(!arguments.length)return r;return r=R,M},M.padding=function(R){if(!arguments.length)return c;return c=R,M},M.distinct=function(R){if(!arguments.length)return j;return j=R,M},M.colours=function(R){if(!arguments.length)return D;return D=R,M},M.colors=function(R){if(!arguments.length)return D;return D=R,M},M.fontSize=function(R){if(!arguments.length)return C;return C=R,M},M.round=function(R){if(!arguments.length)return O;return O=R,M},M.duration=function(R){if(!arguments.length)return h;return h=R,M},M.layoutFunction=function(R){if(!arguments.length)return L;return L=R,M},M.normalize=function(R){if(!arguments.length)return I;return I=R,M},M.scaleToFit=function(R){if(!arguments.length)return w;return w=R,M},M.styled=function(R){if(!arguments.length)return k;return k=R,M},M.orientation=function(R){if(!arguments.length)return y;return y=R,M},M.orientationOrder=function(R){if(!arguments.length)return z;return z=R,M},M.lossFunction=function(R){if(!arguments.length)return F;return F=R==="default"?mt:R==="logRatio"?Zt:R,M},M}function _t(t,o){return function(l){let r=this,c=t[l.sets[0]].radius||50,h=o(l)||"",y=h.split(/\s+/).reverse(),I=3,w=(h.length+y.length)/3,S=y.pop(),k=[S],C=0,z=1.1;r.textContent=null;let j=[];function O(D){let L=r.ownerDocument.createElementNS(r.namespaceURI,"tspan");return L.textContent=D,j.push(L),r.append(L),L}let B=O(S);while(!0){if(S=y.pop(),!S)break;k.push(S);let D=k.join(" ");if(B.textContent=D,D.length>w&&B.getComputedTextLength()>c)k.pop(),B.textContent=k.join(" "),k=[S],B=O(S),C++}let W=0.35-C*z/2,U=r.getAttribute("x"),q=r.getAttribute("y");j.forEach((D,L)=>{D.setAttribute("x",U),D.setAttribute("y",q),D.setAttribute("dy",`${W+L*z}em`)})}}function Et(t,o,l){let r=o[0].radius-at(o[0],t);for(let c=1;c<o.length;++c){let h=o[c].radius-at(o[c],t);if(h<=r)r=h}for(let c=0;c<l.length;++c){let h=at(l[c],t)-l[c].radius;if(h<=r)r=h}return r}function ne(t,o,l){let r=[];for(let k of t)r.push({x:k.x,y:k.y}),r.push({x:k.x+k.radius/2,y:k.y}),r.push({x:k.x-k.radius/2,y:k.y}),r.push({x:k.x,y:k.y+k.radius/2}),r.push({x:k.x,y:k.y-k.radius/2});let c=r[0],h=Et(r[0],t,o);for(let k=1;k<r.length;++k){let C=Et(r[k],t,o);if(C>=h)c=r[k],h=C}let y=Ht((k)=>-1*Et({x:k[0],y:k[1]},t,o),[c.x,c.y],{maxIterations:500,minErrorDelta:0.0000000001}).x,I={x:l?0:y[0],y:y[1]},w=!0;for(let k of t)if(at(I,k)>k.radius){w=!1;break}for(let k of o)if(at(I,k)<k.radius){w=!1;break}if(w)return I;if(t.length==1)return{x:t[0].x,y:t[0].y};let S={};if(It(t,S),S.arcs.length===0)return{x:0,y:-1000,disjoint:!0};if(S.arcs.length==1)return{x:S.arcs[0].circle.x,y:S.arcs[0].circle.y};if(o.length)return ne(t,[]);return Kt(S.arcs.map((k)=>k.p1))}function we(t){let o={},l=Object.keys(t);for(let r of l)o[r]=[];for(let r=0;r<l.length;r++){let c=l[r],h=t[c];for(let y=r+1;y<l.length;++y){let I=l[y],w=t[I],S=at(h,w);if(S+w.radius<=h.radius+0.0000000001)o[I].push(c);else if(S+h.radius<=w.radius+0.0000000001)o[c].push(I)}}return o}function se(t,o,l){let r={},c=we(t);for(let h=0;h<o.length;++h){let y=o[h].sets,I={},w={};for(let z=0;z<y.length;++z){I[y[z]]=!0;let j=c[y[z]];for(let O=0;O<j.length;++O)w[j[O]]=!0}let S=[],k=[];for(let z in t)if(z in I)S.push(t[z]);else if(!(z in w))k.push(t[z]);let C=ne(S,k,l);if(r[y]=C,C.disjoint&&o[h].size>0)console.log("WARNING: area "+y+" not represented on screen")}return r}function _e(t,o,l){let r=[];return r.push(`
2
+ M`,t,o),r.push(`
3
+ m`,-l,0),r.push(`
4
+ a`,l,l,0,1,0,l*2,0),r.push(`
5
+ a`,l,l,0,1,0,-l*2,0),r.join(" ")}function Ee(t){let o=t.split(" ");return{x:Number.parseFloat(o[1]),y:Number.parseFloat(o[2]),radius:-Number.parseFloat(o[4])}}function ie(t){if(t.length===0)return[];let o={};return It(t,o),o.arcs}function re(t,o){if(t.length===0)return"M 0 0";let l=Math.pow(10,o||0),r=o!=null?(h)=>Math.round(h*l)/l:(h)=>h;if(t.length==1){let h=t[0].circle;return _e(r(h.x),r(h.y),r(h.radius))}let c=[`
6
+ M`,r(t[0].p2.x),r(t[0].p2.y)];for(let h of t){let y=r(h.circle.radius);c.push(`
7
+ A`,y,y,0,h.large?1:0,h.sweep?1:0,r(h.p1.x),r(h.p1.y))}return c.join(" ")}function Gt(t,o){return re(ie(t),o)}function oe(t,o={}){let{lossFunction:l,layoutFunction:r=Yt,normalize:c=!0,orientation:h=Math.PI/2,orientationOrder:y,width:I=600,height:w=350,padding:S=15,scaleToFit:k=!1,symmetricalTextCentre:C=!1,distinct:z,round:j=2}=o,O=r(t,{lossFunction:l==="default"||!l?mt:l==="logRatio"?Zt:l,distinct:z});if(c)O=Jt(O,h,y);let B=Qt(O,I,w,S,k),W=se(B,t,C),U=new Map(Object.keys(B).map((L)=>[L,{set:L,x:B[L].x,y:B[L].y,radius:B[L].radius}])),q=t.map((L)=>{let F=L.sets.map((_)=>U.get(_)),M=ie(F),R=re(M,j);return{circles:F,arcs:M,path:R,area:L,has:new Set(L.sets)}});function D(L){let F="";for(let M of q)if(M.has.size>L.length&&L.every((R)=>M.has.has(R)))F+=" "+M.path;return F}return q.map(({circles:L,arcs:F,path:M,area:R})=>({data:R,text:W[R.sets],circles:L,arcs:F,path:M,distinctPath:M+D(R.sets)}))}var Ot=function(){var t=e(function(q,D,L,F){for(L=L||{},F=q.length;F--;L[q[F]]=D);return L},"o"),o=[5,8],l=[7,8,11,12,17,19,22,24],r=[1,17],c=[1,18],h=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],y=[1,31],I=[1,39],w=[7,8,11,12,17,19,22,24,27],S=[1,57],k=[1,56],C=[1,58],z=[1,59],j=[1,60],O=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],B={trace:e(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:e(function(D,L,F,M,R,_,Y){var V=_.length-1;switch(R){case 1:return _[V-1];case 2:case 3:case 4:this.$=[];break;case 5:_[V-1].push(_[V]),this.$=_[V-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=_[V];break;case 8:M.setDiagramTitle(_[V].substr(6)),this.$=_[V].substr(6);break;case 9:if(M.addSubsetData([_[V]],void 0,void 0),M.setIndentMode)M.setIndentMode(!0);break;case 10:if(M.addSubsetData([_[V-1]],_[V],void 0),M.setIndentMode)M.setIndentMode(!0);break;case 11:if(M.addSubsetData([_[V-2]],void 0,parseFloat(_[V])),M.setIndentMode)M.setIndentMode(!0);break;case 12:if(M.addSubsetData([_[V-3]],_[V-2],parseFloat(_[V])),M.setIndentMode)M.setIndentMode(!0);break;case 13:if(_[V].length<2)throw Error("union requires multiple identifiers");if(M.validateUnionIdentifiers)M.validateUnionIdentifiers(_[V]);if(M.addSubsetData(_[V],void 0,void 0),M.setIndentMode)M.setIndentMode(!0);break;case 14:if(_[V-1].length<2)throw Error("union requires multiple identifiers");if(M.validateUnionIdentifiers)M.validateUnionIdentifiers(_[V-1]);if(M.addSubsetData(_[V-1],_[V],void 0),M.setIndentMode)M.setIndentMode(!0);break;case 15:if(_[V-2].length<2)throw Error("union requires multiple identifiers");if(M.validateUnionIdentifiers)M.validateUnionIdentifiers(_[V-2]);if(M.addSubsetData(_[V-2],void 0,parseFloat(_[V])),M.setIndentMode)M.setIndentMode(!0);break;case 16:if(_[V-3].length<2)throw Error("union requires multiple identifiers");if(M.validateUnionIdentifiers)M.validateUnionIdentifiers(_[V-3]);if(M.addSubsetData(_[V-3],_[V-2],parseFloat(_[V])),M.setIndentMode)M.setIndentMode(!0);break;case 17:case 18:case 19:M.addTextData(_[V-1],_[V],void 0);break;case 20:case 21:M.addTextData(_[V-2],_[V-1],_[V]);break;case 23:M.addStyleData(_[V-1],_[V]);break;case 24:case 25:case 26:var X=M.getCurrentSets();if(!X)throw Error("text requires set");M.addTextData(X,_[V],void 0);break;case 27:case 28:var X=M.getCurrentSets();if(!X)throw Error("text requires set");M.addTextData(X,_[V-1],_[V]);break;case 29:case 41:this.$=[_[V]];break;case 30:case 42:this.$=[..._[V-2],_[V]];break;case 31:this.$=[_[V-2],_[V]];break;case 33:this.$=_[V].join(" ");break;case 34:this.$=[_[V]];break;case 35:_[V-1].push(_[V]),this.$=_[V-1];break;case 43:case 44:this.$=_[V];break}},"anonymous"),table:[t(o,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(l,[2,4],{6:5}),t(o,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},t(l,[2,5]),t(l,[2,6]),t(l,[2,7]),t(l,[2,8]),{13:16,20:r,21:c},{13:20,18:19,20:r,21:c},{13:20,18:21,20:r,21:c},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:r,21:c},t(l,[2,9],{14:[1,27],15:[1,28]}),t(h,[2,43]),t(h,[2,44]),t(l,[2,13],{14:[1,29],15:[1,30],27:y}),t(h,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:y},t(l,[2,22]),t(l,[2,24],{14:[1,35]}),t(l,[2,25],{14:[1,36]}),t(l,[2,26]),{20:I,25:37,26:38,27:y},t(l,[2,10],{15:[1,40]}),{16:[1,41]},t(l,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:r,21:c},t(l,[2,17],{14:[1,45]}),t(l,[2,18],{14:[1,46]}),t(l,[2,19]),t(l,[2,27]),t(l,[2,28]),t(l,[2,23],{27:[1,47]}),t(w,[2,29]),{15:[1,48]},{16:[1,49]},t(l,[2,11]),{16:[1,50]},t(l,[2,15]),t(h,[2,42]),t(l,[2,20]),t(l,[2,21]),{20:I,26:51},{16:S,20:k,21:[1,53],28:52,29:54,30:55,31:C,32:z,33:j},t(l,[2,12]),t(l,[2,16]),t(w,[2,30]),t(w,[2,31]),t(w,[2,32]),t(w,[2,33],{30:61,16:S,20:k,31:C,32:z,33:j}),t(O,[2,34]),t(O,[2,36]),t(O,[2,37]),t(O,[2,38]),t(O,[2,39]),t(O,[2,40]),t(O,[2,35])],defaultActions:{6:[2,1]},parseError:e(function(D,L){if(L.recoverable)this.trace(D);else{var F=Error(D);throw F.hash=L,F}},"parseError"),parse:e(function(D){var L=this,F=[0],M=[],R=[null],_=[],Y=this.table,V="",X=0,lt=0,it=0,J=2,H=1,Z=_.slice.call(arguments,1),G=Object.create(this.lexer),Q={yy:{}};for(var rt in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,rt))Q.yy[rt]=this.yy[rt];if(G.setInput(D,Q.yy),Q.yy.lexer=G,Q.yy.parser=this,typeof G.yylloc>"u")G.yylloc={};var tt=G.yylloc;_.push(tt);var et=G.options&&G.options.ranges;if(typeof Q.yy.parseError==="function")this.parseError=Q.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function ft(ut){F.length=F.length-2*ut,R.length=R.length-ut,_.length=_.length-ut}e(ft,"popStack");function nt(){var ut=M.pop()||G.lex()||H;if(typeof ut!=="number"){if(ut instanceof Array)M=ut,ut=M.pop();ut=L.symbols_[ut]||ut}return ut}e(nt,"lex");var K,dt,ct,P,st,bt,gt={},ht,ot,qt,kt;while(!0){if(ct=F[F.length-1],this.defaultActions[ct])P=this.defaultActions[ct];else{if(K===null||typeof K>"u")K=nt();P=Y[ct]&&Y[ct][K]}if(typeof P>"u"||!P.length||!P[0]){var St="";kt=[];for(ht in Y[ct])if(this.terminals_[ht]&&ht>J)kt.push("'"+this.terminals_[ht]+"'");if(G.showPosition)St="Parse error on line "+(X+1)+`:
8
+ `+G.showPosition()+`
9
+ Expecting `+kt.join(", ")+", got '"+(this.terminals_[K]||K)+"'";else St="Parse error on line "+(X+1)+": Unexpected "+(K==H?"end of input":"'"+(this.terminals_[K]||K)+"'");this.parseError(St,{text:G.match,token:this.terminals_[K]||K,line:G.yylineno,loc:tt,expected:kt})}if(P[0]instanceof Array&&P.length>1)throw Error("Parse Error: multiple actions possible at state: "+ct+", token: "+K);switch(P[0]){case 1:if(F.push(K),R.push(G.yytext),_.push(G.yylloc),F.push(P[1]),K=null,!dt){if(lt=G.yyleng,V=G.yytext,X=G.yylineno,tt=G.yylloc,it>0)it--}else K=dt,dt=null;break;case 2:if(ot=this.productions_[P[1]][1],gt.$=R[R.length-ot],gt._$={first_line:_[_.length-(ot||1)].first_line,last_line:_[_.length-1].last_line,first_column:_[_.length-(ot||1)].first_column,last_column:_[_.length-1].last_column},et)gt._$.range=[_[_.length-(ot||1)].range[0],_[_.length-1].range[1]];if(bt=this.performAction.apply(gt,[V,lt,X,Q.yy,P[1],R,_].concat(Z)),typeof bt<"u")return bt;if(ot)F=F.slice(0,-1*ot*2),R=R.slice(0,-1*ot),_=_.slice(0,-1*ot);F.push(this.productions_[P[1]][0]),R.push(gt.$),_.push(gt._$),qt=Y[F[F.length-2]][F[F.length-1]],F.push(qt);break;case 3:return!0}}return!0},"parse")},W=function(){var q={EOF:1,parseError:e(function(L,F){if(this.yy.parser)this.yy.parser.parseError(L,F);else throw Error(L)},"parseError"),setInput:e(function(D,L){if(this.yy=L||this.yy||{},this._input=D,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:e(function(){var D=this._input[0];this.yytext+=D,this.yyleng++,this.offset++,this.match+=D,this.matched+=D;var L=D.match(/(?:\r\n?|\n).*/g);if(L)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),D},"input"),unput:e(function(D){var L=D.length,F=D.split(/(?:\r\n?|\n)/g);this._input=D+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-L),this.offset-=L;var M=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),F.length-1)this.yylineno-=F.length-1;var R=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:F?(F.length===M.length?this.yylloc.first_column:0)+M[M.length-F.length].length-F[0].length:this.yylloc.first_column-L},this.options.ranges)this.yylloc.range=[R[0],R[0]+this.yyleng-L];return this.yyleng=this.yytext.length,this},"unput"),more:e(function(){return this._more=!0,this},"more"),reject:e(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).
10
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:e(function(D){this.unput(this.match.slice(D))},"less"),pastInput:e(function(){var D=this.matched.substr(0,this.matched.length-this.match.length);return(D.length>20?"...":"")+D.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:e(function(){var D=this.match;if(D.length<20)D+=this._input.substr(0,20-D.length);return(D.substr(0,20)+(D.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:e(function(){var D=this.pastInput(),L=Array(D.length+1).join("-");return D+this.upcomingInput()+`
11
+ `+L+"^"},"showPosition"),test_match:e(function(D,L){var F,M,R;if(this.options.backtrack_lexer){if(R={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)R.yylloc.range=this.yylloc.range.slice(0)}if(M=D[0].match(/(?:\r\n?|\n).*/g),M)this.yylineno+=M.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:M?M[M.length-1].length-M[M.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+D[0].length},this.yytext+=D[0],this.match+=D[0],this.matches=D,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(D[0].length),this.matched+=D[0],F=this.performAction.call(this,this.yy,this,L,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(F)return F;else if(this._backtrack){for(var _ in R)this[_]=R[_];return!1}return!1},"test_match"),next:e(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var D,L,F,M;if(!this._more)this.yytext="",this.match="";var R=this._currentRules();for(var _=0;_<R.length;_++)if(F=this._input.match(this.rules[R[_]]),F&&(!L||F[0].length>L[0].length)){if(L=F,M=_,this.options.backtrack_lexer)if(D=this.test_match(F,R[_]),D!==!1)return D;else if(this._backtrack){L=!1;continue}else return!1;else if(!this.options.flex)break}if(L){if(D=this.test_match(L,R[M]),D!==!1)return D;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
12
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:e(function(){var L=this.next();if(L)return L;else return this.lex()},"lex"),begin:e(function(L){this.conditionStack.push(L)},"begin"),popState:e(function(){var L=this.conditionStack.length-1;if(L>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:e(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:e(function(L){if(L=this.conditionStack.length-1-Math.abs(L||0),L>=0)return this.conditionStack[L];else return"INITIAL"},"topState"),pushState:e(function(L){this.begin(L)},"pushState"),stateStackSize:e(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:e(function(L,F,M,R){var _=R;switch(M){case 0:break;case 1:break;case 2:break;case 3:if(L.getIndentMode&&L.getIndentMode())return L.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:if(L.setIndentMode)L.setIndentMode(!1);this.begin("INITIAL"),this.unput(F.yytext);break;case 6:return this.begin("bol"),8;break;case 7:break;case 8:break;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(L.consumeIndentText)L.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return F.yytext=F.yytext.slice(2,-2),14;break;case 17:return F.yytext=F.yytext.slice(1,-1).trim(),14;break;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};return q}();B.lexer=W;function U(){this.yy={}}return e(U,"Parser"),U.prototype=B,B.Parser=U,new U}();Ot.parser=Ot;var ze=Ot,Lt=[],jt=[],Ft=[],Pt=new Set,Vt,Bt=!1,Ae=e((t,o,l)=>{let r=Mt(t).sort(),c=l??10/Math.pow(t.length,2);if(Vt=r,r.length===1)Pt.add(r[0]);Lt.push({sets:r,size:c,label:o?vt(o):void 0})},"addSubsetData"),De=e(()=>Lt,"getSubsetData"),vt=e((t)=>{let o=t.trim();if(o.length>=2&&o.startsWith('"')&&o.endsWith('"'))return o.slice(1,-1);return o},"normalizeText"),Re=e((t)=>t?vt(t):t,"normalizeStyleValue"),Ce=e((t,o,l)=>{let r=vt(o);jt.push({sets:Mt(t).sort(),id:r,label:l?vt(l):void 0})},"addTextData"),Ne=e((t,o)=>{let l=Mt(t).sort(),r={};for(let[c,h]of o)r[c]=Re(h)??h;Ft.push({targets:l,styles:r})},"addStyleData"),Oe=e(()=>Ft,"getStyleData"),Mt=e((t)=>t.map((o)=>vt(o)),"normalizeIdentifierList"),Le=e((t)=>{let l=Mt(t).filter((r)=>!Pt.has(r));if(l.length>0)throw Error(`unknown set identifier: ${l.join(", ")}`)},"validateUnionIdentifiers"),je=e(()=>jt,"getTextData"),Fe=e(()=>Vt,"getCurrentSets"),Pe=e(()=>Bt,"getIndentMode"),Ve=e((t)=>{Bt=t},"setIndentMode"),Be=x.venn;function ae(){return E(Be,u().venn)}e(ae,"getConfig");var qe=e(()=>{d(),Lt.length=0,jt.length=0,Ft.length=0,Pt.clear(),Vt=void 0,Bt=!1},"customClear"),Ue={getConfig:ae,clear:qe,setAccTitle:f,getAccTitle:p,setDiagramTitle:b,getDiagramTitle:v,getAccDescription:g,setAccDescription:m,addSubsetData:Ae,getSubsetData:De,addTextData:Ce,addStyleData:Ne,validateUnionIdentifiers:Le,getTextData:je,getStyleData:Oe,getCurrentSets:Fe,getIndentMode:Pe,setIndentMode:Ve},Ge=e((t)=>`
13
+ .venn-title {
14
+ font-size: 32px;
15
+ fill: ${t.vennTitleTextColor};
16
+ font-family: ${t.fontFamily};
17
+ }
18
+
19
+ .venn-circle text {
20
+ font-size: 48px;
21
+ font-family: ${t.fontFamily};
22
+ }
23
+
24
+ .venn-intersection text {
25
+ font-size: 48px;
26
+ fill: ${t.vennSetTextColor};
27
+ font-family: ${t.fontFamily};
28
+ }
29
+
30
+ .venn-text-node {
31
+ font-family: ${t.fontFamily};
32
+ color: ${t.vennSetTextColor};
33
+ }
34
+ `,"getStyles"),We=Ge;function le(t){let o=new Map;for(let l of t){let r=l.targets.join("|"),c=o.get(r);if(c)Object.assign(c,l.styles);else o.set(r,{...l.styles})}return o}e(le,"buildStyleByKey");var Ke=e((t,o,l,r)=>{let c=r.db,h=c.getConfig?.(),{themeVariables:y,look:I,handDrawnSeed:w}=u(),S=I==="handDrawn",k=[y.venn1,y.venn2,y.venn3,y.venn4,y.venn5,y.venn6,y.venn7,y.venn8].filter(Boolean),C=c.getDiagramTitle?.(),z=c.getSubsetData(),j=c.getTextData(),O=le(c.getStyleData()),B=ue(z),W=h?.width??800,U=h?.height??450,q=1600,D=W/1600,L=C?48*D:0,F=y.primaryTextColor??y.textColor,M=A(o);if(M.attr("viewBox",`0 0 ${W} ${U}`),C)M.append("text").text(C).attr("class","venn-title").attr("font-size",`${32*D}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*D).style("fill",y.vennTitleTextColor||y.titleColor);let R=n(document.createElement("div")),_=ee().width(W).height(U-L);R.datum(B).call(_);let Y=S?s.svg(R.select("svg").node()):void 0,V=oe(B,{width:W,height:U-L,padding:h?.padding??15}),X=new Map;for(let H of V){let Z=yt([...H.data.sets].sort());X.set(Z,H)}if(j.length>0)ce(h,X,R,j,D,O);let lt=N(y.background||"#f4f4f4");if(R.selectAll(".venn-circle").each(function(H,Z){let G=n(this),rt=yt([...H.sets].sort()),tt=O.get(rt),et=tt?.fill||k[Z%k.length]||y.primaryColor;G.classed(`venn-set-${Z%8}`,!0);let ft=tt?.["fill-opacity"]??0.1,nt=tt?.stroke||et,K=tt?.["stroke-width"]||`${5*D}`;if(S&&Y){let ct=X.get(rt);if(ct&&ct.circles.length>0){let P=ct.circles[0],st=Y.circle(P.x,P.y,P.radius*2,{roughness:0.7,seed:w,fill:wt(et,0.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+Z*60,stroke:nt,strokeWidth:parseFloat(String(K))});G.select("path").remove(),G.node()?.insertBefore(st,G.select("text").node())}}else G.select("path").style("fill",et).style("fill-opacity",ft).style("stroke",nt).style("stroke-width",K).style("stroke-opacity",0.95);let dt=tt?.color||(lt?i(et,30):a(et,30));G.select("text").style("font-size",`${48*D}px`).style("fill",dt)}),S&&Y)R.selectAll(".venn-intersection").each(function(H){let Z=n(this),Q=yt([...H.sets].sort()),rt=O.get(Q),tt=rt?.fill;if(tt){let et=Z.select("path"),ft=et.attr("d");if(ft){let nt=Y.path(ft,{roughness:0.7,seed:w,fill:wt(tt,0.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),K=et.node();K?.parentNode?.insertBefore(nt,K),et.remove()}}else Z.select("path").style("fill-opacity",0);Z.select("text").style("font-size",`${48*D}px`).style("fill",rt?.color??y.vennSetTextColor??F)});else R.selectAll(".venn-intersection text").style("font-size",`${48*D}px`).style("fill",(H)=>{let G=yt([...H.sets].sort());return O.get(G)?.color??y.vennSetTextColor??F}),R.selectAll(".venn-intersection path").style("fill-opacity",(H)=>{let G=yt([...H.sets].sort());return O.get(G)?.fill?1:0}).style("fill",(H)=>{let G=yt([...H.sets].sort());return O.get(G)?.fill??"transparent"});let it=M.append("g").attr("transform",`translate(0, ${L})`),J=R.select("svg").node();if(J&&"childNodes"in J)for(let H of[...J.childNodes])it.node()?.appendChild(H);T(M,U,W,h?.useMaxWidth??!0)},"draw");function yt(t){return t.join("|")}e(yt,"stableSetsKey");function ce(t,o,l,r,c,h){let y=t?.useDebugLayout??!1,w=l.select("svg").append("g").attr("class","venn-text-nodes"),S=new Map;for(let k of r){let C=yt(k.sets),z=S.get(C);if(z)z.push(k);else S.set(C,[k])}for(let[k,C]of S.entries()){let z=o.get(k);if(!z?.text)continue;let j=z.text.x,O=z.text.y,B=Math.min(...z.circles.map((J)=>J.radius)),W=Math.min(...z.circles.map((J)=>J.radius-Math.hypot(j-J.x,O-J.y))),U=Number.isFinite(W)?Math.max(0,W):0;if(U===0&&Number.isFinite(B))U=B*0.6;let q=w.append("g").attr("class","venn-text-area").attr("font-size",`${40*c}px`);if(y)q.append("circle").attr("class","venn-text-debug-circle").attr("cx",j).attr("cy",O).attr("r",U).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*c).attr("stroke-dasharray",`${6*c} ${4*c}`);let D=Math.max(80*c,U*2*0.95),L=Math.max(60*c,U*2*0.95),R=(z.data.label&&z.data.label.length>0?Math.min(32*c,U*0.25):0)+(C.length<=2?30*c:0),_=j-D/2,Y=O-L/2+R,V=Math.max(1,Math.ceil(Math.sqrt(C.length))),X=Math.max(1,Math.ceil(C.length/V)),lt=D/V,it=L/X;for(let[J,H]of C.entries()){let Z=J%V,G=Math.floor(J/V),Q=_+lt*(Z+0.5),rt=Y+it*(G+0.5);if(y)q.append("rect").attr("class","venn-text-debug-cell").attr("x",_+lt*Z).attr("y",Y+it*G).attr("width",lt).attr("height",it).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*c).attr("stroke-dasharray",`${4*c} ${3*c}`);let tt=lt*0.9,et=it*0.9,ft=q.append("foreignObject").attr("class","venn-text-node-fo").attr("width",tt).attr("height",et).attr("x",Q-tt/2).attr("y",rt-et/2).attr("overflow","visible"),nt=h.get(H.id)?.color,K=ft.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(H.label??H.id);if(nt)K.style("color",nt)}}}e(ce,"renderTextNodes");function ue(t){let o=new Set(t.map((c)=>[...c.sets].sort().join("|"))),l=new Map(t.filter((c)=>c.sets.length===1&&c.size!==void 0).map((c)=>[c.sets[0],c.size])),r=[];for(let c of t){if(c.sets.length<3)continue;let h=[...c.sets].sort();for(let y=0;y<h.length-1;y++)for(let I=y+1;I<h.length;I++){let w=[h[y],h[I]],S=w.join("|");if(!o.has(S)){o.add(S);let k=l.get(w[0]),C=l.get(w[1]),z=k!==void 0&&C!==void 0?Math.min(k,C)/4:2.5;r.push({sets:w,size:z,label:""})}}}return r.length>0?[...t,...r]:t}e(ue,"ensurePairwiseSubsets");var He={draw:Ke},rn={parser:ze,db:Ue,renderer:He,styles:We};export{rn as diagram};
@@ -0,0 +1 @@
1
+ import{ri}from"./index-zx0j3a2z.js";export{ri as createWardleyServices};
@@ -0,0 +1,78 @@
1
+ import{R}from"./index-5n03dmb9.js";import{e,t,j,u,T,d,f,p,m,g,b,v,r,A,E}from"./index-nwsya6dj.js";import"./index-v119nznk.js";import{D}from"./index-zx0j3a2z.js";var nt=e((o,l)=>{let s=o<=1?o*100:o;if(s<0||s>100)throw Error(`${l} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${o}`);return s},"toPercent"),Z=e((o,l,s)=>({x:nt(l,`${s} evolution`),y:nt(o,`${s} visibility`)}),"toCoordinates"),ht=e((o)=>{if(!o)return;if(o==="+<>")return"bidirectional";if(o==="+<")return"backward";if(o==="+>")return"forward";return},"getFlowFromPort"),Ft=e((o)=>{if(!o?.startsWith("+"))return{};let s=/^\+'([^']*)'/.exec(o)?.[1];if(o.includes("<>"))return{flow:"bidirectional",label:s};if(o.includes("<"))return{flow:"backward",label:s};if(o.includes(">"))return{flow:"forward",label:s};return{label:s}},"extractFlowFromArrow"),Rt=e((o,l)=>{if(R(o,l),o.size)l.setSize(o.size.width,o.size.height);if(o.evolution){let s=o.evolution.stages.map((n)=>{if(n.secondName)return`${n.name.trim()} / ${n.secondName.trim()}`;return n.name.trim()}),C=o.evolution.stages.filter((n)=>n.boundary!==void 0).map((n)=>n.boundary);l.updateAxes({stages:s,stageBoundaries:C})}if(o.anchors.forEach((s)=>{let C=Z(s.visibility,s.evolution,`Anchor "${s.name}"`);l.addNode(s.name,s.name,C.x,C.y,"anchor")}),o.components.forEach((s)=>{let C=Z(s.visibility,s.evolution,`Component "${s.name}"`),n=s.label?(s.label.negX?-1:1)*s.label.offsetX:void 0,x=s.label?(s.label.negY?-1:1)*s.label.offsetY:void 0,z=s.decorator?.strategy;l.addNode(s.name,s.name,C.x,C.y,"component",n,x,s.inertia,z)}),o.notes.forEach((s)=>{let C=Z(s.visibility,s.evolution,`Note "${s.text}"`);l.addNote(s.text,C.x,C.y)}),o.pipelines.forEach((s)=>{let C=l.getNode(s.parent);if(!C||typeof C.y!=="number")throw Error(`Pipeline "${s.parent}" must reference an existing component with coordinates.`);let n=C.y;l.startPipeline(s.parent),s.components.forEach((x)=>{let z=`${s.parent}_${x.name}`,B=x.label?(x.label.negX?-1:1)*x.label.offsetX:void 0,M=x.label?(x.label.negY?-1:1)*x.label.offsetY:void 0,et=nt(x.evolution,`Pipeline component "${x.name}" evolution`);l.addNode(z,x.name,et,n,"pipeline-component",B,M),l.addPipelineComponent(s.parent,z)})}),o.links.forEach((s)=>{let C=!!s.arrow&&(s.arrow.includes("-.->")||s.arrow.includes(".-.")),n=ht(s.fromPort)??ht(s.toPort),{flow:x,label:z}=Ft(s.arrow);if(!n&&x)n=x;let B=s.linkLabel,M=z??B;l.addLink(l.resolveNodeId(s.from),l.resolveNodeId(s.to),C,M,n)}),o.evolves.forEach((s)=>{let C=l.getNode(s.component);if(C?.y!==void 0){let n=nt(s.target,`Evolve target for "${s.component}"`);l.addTrend(s.component,n,C.y)}}),o.annotations.length>0){let s=o.annotations[0],C=Z(s.x,s.y,"Annotations box");l.setAnnotationsBox(C.x,C.y)}o.annotation.forEach((s)=>{let C=Z(s.x,s.y,`Annotation ${s.number}`);l.addAnnotation(s.number,[{x:C.x,y:C.y}],s.text)}),o.accelerators.forEach((s)=>{let C=Z(s.x,s.y,`Accelerator "${s.name}"`);l.addAccelerator(s.name,C.x,C.y)}),o.deaccelerators.forEach((s)=>{let C=Z(s.x,s.y,`Deaccelerator "${s.name}"`);l.addDeaccelerator(s.name,C.x,C.y)})},"populateDb"),ft={parser:{yy:void 0},parse:e(async(o)=>{let l=await D("wardley",o);t.debug(l);let s=ft.parser?.yy;if(!s||typeof s.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.");Rt(l,s)},"parse")},Ot=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{e(this,"WardleyBuilder")}addNode(o){let l=this.nodes.get(o.id)??{id:o.id,label:o.label},s={...l,...o,className:o.className??l.className,labelOffsetX:o.labelOffsetX??l.labelOffsetX,labelOffsetY:o.labelOffsetY??l.labelOffsetY};this.nodes.set(o.id,s)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});let l=this.nodes.get(o);if(l)l.isPipelineParent=!0}addPipelineComponent(o,l){let s=this.pipelines.get(o);if(s)s.componentIds.push(l);let C=this.nodes.get(l);if(C)C.inPipeline=!0}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,l){this.annotationsBox={x:o,y:l}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,l){this.size={width:o,height:l}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(let[l,s]of this.nodes)if(s.label===o)return l;return o}build(){let o=[];for(let l of this.nodes.values()){if(typeof l.x!=="number"||typeof l.y!=="number")throw Error(`Node "${l.label}" is missing coordinates`);o.push(l)}return{nodes:o,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}},W=new Ot;function xt(){return r()["wardley-beta"]}e(xt,"getConfig");function gt(o,l,s,C,n,x,z,B,M){W.addNode({id:o,label:l,x:s,y:C,className:n,labelOffsetX:x,labelOffsetY:z,inertia:B,sourceStrategy:M})}e(gt,"addNode");function yt(o,l,s=!1,C,n){W.addLink({source:o,target:l,dashed:s,label:C,flow:n})}e(yt,"addLink");function ut(o,l,s){W.addTrend({nodeId:o,targetX:l,targetY:s})}e(ut,"addTrend");function wt(o,l,s){W.addAnnotation({number:o,coordinates:l,text:s})}e(wt,"addAnnotation");function mt(o,l,s){W.addNote({text:o,x:l,y:s})}e(mt,"addNote");function kt(o,l,s){W.addAccelerator({name:o,x:l,y:s})}e(kt,"addAccelerator");function bt(o,l,s){W.addDeaccelerator({name:o,x:l,y:s})}e(bt,"addDeaccelerator");function $t(o,l){W.setAnnotationsBox(o,l)}e($t,"setAnnotationsBox");function vt(o,l){W.setSize(o,l)}e(vt,"setSize");function Pt(o){W.startPipeline(o)}e(Pt,"startPipeline");function Ct(o,l){W.addPipelineComponent(o,l)}e(Ct,"addPipelineComponent");function St(o){W.setAxes(o)}e(St,"updateAxes");function Mt(o){return W.getNode(o)}e(Mt,"getNode");function Nt(o){return W.resolveNodeId(o)}e(Nt,"resolveNodeId");function zt(){return W.build()}e(zt,"getWardleyData");function Lt(){W.clear(),d()}e(Lt,"clear");var Dt={getConfig:xt,addNode:gt,addLink:yt,addTrend:ut,addAnnotation:wt,addNote:mt,addAccelerator:kt,addDeaccelerator:bt,setAnnotationsBox:$t,setSize:vt,startPipeline:Pt,addPipelineComponent:Ct,updateAxes:St,getNode:Mt,resolveNodeId:Nt,getWardleyData:zt,clear:Lt,setAccTitle:f,getAccTitle:p,setDiagramTitle:b,getDiagramTitle:v,getAccDescription:g,setAccDescription:m},Gt=["Genesis","Custom Built","Product","Commodity"],qt=e(()=>{let{themeVariables:o}=r();return{backgroundColor:o.wardley?.backgroundColor??o.background??"#fff",axisColor:o.wardley?.axisColor??"#000",axisTextColor:o.wardley?.axisTextColor??o.primaryTextColor??"#222",gridColor:o.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:o.wardley?.componentFill??"#fff",componentStroke:o.wardley?.componentStroke??"#000",componentLabelColor:o.wardley?.componentLabelColor??o.primaryTextColor??"#222",linkStroke:o.wardley?.linkStroke??"#000",evolutionStroke:o.wardley?.evolutionStroke??"#dc3545",annotationStroke:o.wardley?.annotationStroke??"#000",annotationTextColor:o.wardley?.annotationTextColor??o.primaryTextColor??"#222",annotationFill:o.wardley?.annotationFill??o.background??"#fff"}},"getTheme"),jt=e(()=>{let o=r()["wardley-beta"];return{width:o?.width??900,height:o?.height??600,padding:o?.padding??48,nodeRadius:o?.nodeRadius??6,nodeLabelOffset:o?.nodeLabelOffset??8,axisFontSize:o?.axisFontSize??12,labelFontSize:o?.labelFontSize??10,showGrid:o?.showGrid??!1,useMaxWidth:o?.useMaxWidth??!0}},"getConfigValues"),Vt=e((o,l,s,C)=>{t.debug(`Rendering Wardley map
2
+ `+o);let n=jt(),x=qt(),z=n.nodeRadius*1.6,B=C.db,M=B.getWardleyData(),et=B.getDiagramTitle(),F=M.size?.width??n.width,X=M.size?.height??n.height,J=A(l);J.selectAll("*").remove(),T(J,X,F,n.useMaxWidth),J.attr("viewBox",`0 0 ${F} ${X}`);let Y=J.append("g").attr("class","wardley-map"),st=J.append("defs");st.append("marker").attr("id",`arrow-${l}`).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",x.evolutionStroke).attr("stroke","none"),st.append("marker").attr("id",`link-arrow-end-${l}`).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",x.linkStroke).attr("stroke","none"),st.append("marker").attr("id",`link-arrow-start-${l}`).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",x.linkStroke).attr("stroke","none"),Y.append("rect").attr("class","wardley-background").attr("width",F).attr("height",X).attr("fill",x.backgroundColor);let K=F-n.padding*2,Q=X-n.padding*2;if(et)Y.append("text").attr("class","wardley-title").attr("x",F/2).attr("y",n.padding/2).attr("fill",x.axisTextColor).attr("font-size",n.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(et);let q=e((a)=>n.padding+a/100*K,"projectX"),V=e((a)=>X-n.padding-a/100*Q,"projectY"),at=Y.append("g").attr("class","wardley-axes");at.append("line").attr("x1",n.padding).attr("x2",F-n.padding).attr("y1",X-n.padding).attr("y2",X-n.padding).attr("stroke",x.axisColor).attr("stroke-width",1),at.append("line").attr("x1",n.padding).attr("x2",n.padding).attr("y1",n.padding).attr("y2",X-n.padding).attr("stroke",x.axisColor).attr("stroke-width",1);let Tt=M.axes.xLabel??"Evolution",Wt=M.axes.yLabel??"Visibility";at.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",n.padding+K/2).attr("y",X-n.padding/4).attr("fill",x.axisTextColor).attr("font-size",n.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(Tt),at.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",n.padding/3).attr("y",n.padding+Q/2).attr("fill",x.axisTextColor).attr("font-size",n.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${n.padding/3} ${n.padding+Q/2})`).text(Wt);let tt=M.axes.stages&&M.axes.stages.length>0?M.axes.stages:Gt;if(tt.length>0){let a=Y.append("g").attr("class","wardley-stages"),c=M.axes.stageBoundaries,i=[];if(c&&c.length===tt.length){let h=0;c.forEach((w)=>{i.push({start:h,end:w}),h=w})}else{let h=1/tt.length;tt.forEach((w,k)=>{i.push({start:k*h,end:(k+1)*h})})}tt.forEach((h,w)=>{let k=i[w],S=n.padding+k.start*K,P=n.padding+k.end*K,N=(S+P)/2;if(w>0)a.append("line").attr("x1",S).attr("x2",S).attr("y1",n.padding).attr("y2",X-n.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",0.8);a.append("text").attr("class","wardley-stage-label").attr("x",N).attr("y",X-n.padding/1.5).attr("fill",x.axisTextColor).attr("font-size",n.axisFontSize-2).attr("text-anchor","middle").text(h)})}if(n.showGrid){let a=Y.append("g").attr("class","wardley-grid");for(let c=1;c<4;c++){let i=c/4,h=n.padding+K*i;a.append("line").attr("x1",h).attr("x2",h).attr("y1",n.padding).attr("y2",X-n.padding).attr("stroke",x.gridColor).attr("stroke-dasharray","2 6"),a.append("line").attr("x1",n.padding).attr("x2",F-n.padding).attr("y1",X-n.padding-Q*i).attr("y2",X-n.padding-Q*i).attr("stroke",x.gridColor).attr("stroke-dasharray","2 6")}}let y=new Map;if(M.nodes.forEach((a)=>{y.set(a.id,{x:q(a.x),y:V(a.y),node:a})}),M.pipelines.length>0){let a=Y.append("g").attr("class","wardley-pipelines"),c=Y.append("g").attr("class","wardley-pipeline-links");M.pipelines.forEach((i)=>{if(i.componentIds.length===0)return;let h=i.componentIds.map((P)=>({id:P,pos:y.get(P),node:M.nodes.find((N)=>N.id===P)})).filter((P)=>P.pos&&P.node).sort((P,N)=>P.node.x-N.node.x);for(let P=0;P<h.length-1;P++){let N=h[P],L=h[P+1];c.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",N.pos.x).attr("y1",N.pos.y).attr("x2",L.pos.x).attr("y2",L.pos.y).attr("stroke",x.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let w=1/0,k=-1/0,S=0;if(i.componentIds.forEach((P)=>{let N=y.get(P);if(N)w=Math.min(w,N.x),k=Math.max(k,N.x),S=N.y}),w!==1/0&&k!==-1/0){let N=n.nodeRadius*4,L=S-N/2,I=y.get(i.nodeId);if(I){let G=(w+k)/2;I.x=G,I.y=L-z/6}a.append("rect").attr("class","wardley-pipeline-box").attr("x",w-15).attr("y",L).attr("width",k-w+30).attr("height",N).attr("fill","none").attr("stroke",x.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}let lt=Y.append("g").attr("class","wardley-links"),ct=new Map;M.pipelines.forEach((a)=>{ct.set(a.nodeId,new Set(a.componentIds))});let pt=M.links.filter((a)=>{if(!y.has(a.source)||!y.has(a.target))return!1;if(ct.get(a.target)?.has(a.source))return!1;return!0});lt.selectAll("line").data(pt).enter().append("line").attr("class",(a)=>`wardley-link${a.dashed?" wardley-link--dashed":""}`).attr("x1",(a)=>{let c=y.get(a.source),i=y.get(a.target),w=M.nodes.find((N)=>N.id===a.source).isPipelineParent?z/Math.sqrt(2):n.nodeRadius,k=i.x-c.x,S=i.y-c.y,P=Math.sqrt(k*k+S*S);return c.x+k/P*w}).attr("y1",(a)=>{let c=y.get(a.source),i=y.get(a.target),w=M.nodes.find((N)=>N.id===a.source).isPipelineParent?z/Math.sqrt(2):n.nodeRadius,k=i.x-c.x,S=i.y-c.y,P=Math.sqrt(k*k+S*S);return c.y+S/P*w}).attr("x2",(a)=>{let c=y.get(a.source),i=y.get(a.target),w=M.nodes.find((N)=>N.id===a.target).isPipelineParent?z/Math.sqrt(2):n.nodeRadius,k=c.x-i.x,S=c.y-i.y,P=Math.sqrt(k*k+S*S);return i.x+k/P*w}).attr("y2",(a)=>{let c=y.get(a.source),i=y.get(a.target),w=M.nodes.find((N)=>N.id===a.target).isPipelineParent?z/Math.sqrt(2):n.nodeRadius,k=c.x-i.x,S=c.y-i.y,P=Math.sqrt(k*k+S*S);return i.y+S/P*w}).attr("stroke",x.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",(a)=>a.dashed?"6 6":null).attr("marker-end",(a)=>{if(a.flow==="forward"||a.flow==="bidirectional")return`url(#link-arrow-end-${l})`;return null}).attr("marker-start",(a)=>{if(a.flow==="backward"||a.flow==="bidirectional")return`url(#link-arrow-start-${l})`;return null}),lt.selectAll("text").data(pt.filter((a)=>a.label)).enter().append("text").attr("class","wardley-link-label").attr("x",(a)=>{let c=y.get(a.source),i=y.get(a.target),h=(c.x+i.x)/2,w=i.y-c.y,k=i.x-c.x,S=Math.sqrt(k*k+w*w),P=8,N=w/S;return h+N*8}).attr("y",(a)=>{let c=y.get(a.source),i=y.get(a.target),h=(c.y+i.y)/2,w=i.x-c.x,k=i.y-c.y,S=Math.sqrt(w*w+k*k),P=8,N=-w/S;return h+N*8}).attr("fill",x.axisTextColor).attr("font-size",n.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",(a)=>{let c=y.get(a.source),i=y.get(a.target),h=(c.x+i.x)/2,w=(c.y+i.y)/2,k=i.x-c.x,S=i.y-c.y,P=Math.sqrt(k*k+S*S),N=8,L=S/P,I=-k/P,G=h+L*8,rt=w+I*8,U=Math.atan2(S,k)*180/Math.PI;if(U>90||U<-90)U+=180;return`rotate(${U} ${G} ${rt})`}).text((a)=>a.label);let At=Y.append("g").attr("class","wardley-trends"),Xt=M.trends.map((a)=>{let c=y.get(a.nodeId);if(!c)return null;let i=q(a.targetX),h=V(a.targetY),w=i-c.x,k=h-c.y,S=Math.sqrt(w*w+k*k),P=n.nodeRadius+2,N=S>P?i-w/S*P:i,L=S>P?h-k/S*P:h;return{origin:c,targetX:i,targetY:h,adjustedX2:N,adjustedY2:L}}).filter((a)=>a!==null);At.selectAll("line").data(Xt).enter().append("line").attr("class","wardley-trend").attr("x1",(a)=>a.origin.x).attr("y1",(a)=>a.origin.y).attr("x2",(a)=>a.adjustedX2).attr("y2",(a)=>a.adjustedY2).attr("stroke",x.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${l})`);let O=Y.append("g").attr("class","wardley-nodes").selectAll("g").data(M.nodes).enter().append("g").attr("class",(a)=>["wardley-node",a.className?`wardley-node--${a.className}`:""].filter(Boolean).join(" "));O.filter((a)=>a.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",(a)=>y.get(a.id).x).attr("cy",(a)=>y.get(a.id).y).attr("r",n.nodeRadius*2).attr("fill","#666").attr("stroke",x.componentStroke).attr("stroke-width",1),O.filter((a)=>a.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",(a)=>y.get(a.id).x).attr("cy",(a)=>y.get(a.id).y).attr("r",n.nodeRadius*2).attr("fill","#ccc").attr("stroke",x.componentStroke).attr("stroke-width",1),O.filter((a)=>a.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",(a)=>y.get(a.id).x).attr("cy",(a)=>y.get(a.id).y).attr("r",n.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);let _=O.filter((a)=>a.sourceStrategy==="market");_.append("circle").attr("class","wardley-market-overlay").attr("cx",(a)=>y.get(a.id).x).attr("cy",(a)=>y.get(a.id).y).attr("r",n.nodeRadius*2).attr("fill","white").attr("stroke",x.componentStroke).attr("stroke-width",1),O.filter((a)=>!a.isPipelineParent&&a.sourceStrategy!=="market"&&a.className!=="anchor").append("circle").attr("cx",(a)=>y.get(a.id).x).attr("cy",(a)=>y.get(a.id).y).attr("r",n.nodeRadius).attr("fill",x.componentFill).attr("stroke",x.componentStroke).attr("stroke-width",1);let it=n.nodeRadius*0.7,H=n.nodeRadius*1.2;if(_.append("line").attr("class","wardley-market-line").attr("x1",(a)=>y.get(a.id).x).attr("y1",(a)=>y.get(a.id).y-H).attr("x2",(a)=>y.get(a.id).x-H*Math.cos(Math.PI/6)).attr("y2",(a)=>y.get(a.id).y+H*Math.sin(Math.PI/6)).attr("stroke",x.componentStroke).attr("stroke-width",1),_.append("line").attr("class","wardley-market-line").attr("x1",(a)=>y.get(a.id).x-H*Math.cos(Math.PI/6)).attr("y1",(a)=>y.get(a.id).y+H*Math.sin(Math.PI/6)).attr("x2",(a)=>y.get(a.id).x+H*Math.cos(Math.PI/6)).attr("y2",(a)=>y.get(a.id).y+H*Math.sin(Math.PI/6)).attr("stroke",x.componentStroke).attr("stroke-width",1),_.append("line").attr("class","wardley-market-line").attr("x1",(a)=>y.get(a.id).x+H*Math.cos(Math.PI/6)).attr("y1",(a)=>y.get(a.id).y+H*Math.sin(Math.PI/6)).attr("x2",(a)=>y.get(a.id).x).attr("y2",(a)=>y.get(a.id).y-H).attr("stroke",x.componentStroke).attr("stroke-width",1),_.append("circle").attr("class","wardley-market-dot").attr("cx",(a)=>y.get(a.id).x).attr("cy",(a)=>y.get(a.id).y-H).attr("r",it).attr("fill","white").attr("stroke",x.componentStroke).attr("stroke-width",2),_.append("circle").attr("class","wardley-market-dot").attr("cx",(a)=>y.get(a.id).x-H*Math.cos(Math.PI/6)).attr("cy",(a)=>y.get(a.id).y+H*Math.sin(Math.PI/6)).attr("r",it).attr("fill","white").attr("stroke",x.componentStroke).attr("stroke-width",2),_.append("circle").attr("class","wardley-market-dot").attr("cx",(a)=>y.get(a.id).x+H*Math.cos(Math.PI/6)).attr("cy",(a)=>y.get(a.id).y+H*Math.sin(Math.PI/6)).attr("r",it).attr("fill","white").attr("stroke",x.componentStroke).attr("stroke-width",2),O.filter((a)=>a.isPipelineParent===!0).append("rect").attr("x",(a)=>y.get(a.id).x-z/2).attr("y",(a)=>y.get(a.id).y-z/2).attr("width",z).attr("height",z).attr("fill",x.componentFill).attr("stroke",x.componentStroke).attr("stroke-width",1),O.filter((a)=>a.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",(a)=>{let c=y.get(a.id),i=a.isPipelineParent?z/2+15:n.nodeRadius+15;if(a.sourceStrategy)i+=n.nodeRadius+10;return c.x+i}).attr("y1",(a)=>{let c=y.get(a.id),i=a.isPipelineParent?z:n.nodeRadius*2;return c.y-i/2}).attr("x2",(a)=>{let c=y.get(a.id),i=a.isPipelineParent?z/2+15:n.nodeRadius+15;if(a.sourceStrategy)i+=n.nodeRadius+10;return c.x+i}).attr("y2",(a)=>{let c=y.get(a.id),i=a.isPipelineParent?z:n.nodeRadius*2;return c.y+i/2}).attr("stroke",x.componentStroke).attr("stroke-width",6),O.append("text").attr("x",(a)=>{let c=y.get(a.id);if(a.className==="anchor")return a.labelOffsetX!==void 0?c.x+a.labelOffsetX:c.x;let i=n.nodeLabelOffset;if(a.sourceStrategy&&a.labelOffsetX===void 0)i+=10;let h=a.labelOffsetX??i;return c.x+h}).attr("y",(a)=>{let c=y.get(a.id);if(a.className==="anchor")return a.labelOffsetY!==void 0?c.y+a.labelOffsetY:c.y-3;let i=-n.nodeLabelOffset;if(a.sourceStrategy&&a.labelOffsetY===void 0)i-=10;let h=a.labelOffsetY??i;return c.y+h}).attr("class","wardley-node-label").attr("fill",(a)=>{if(a.className==="evolved")return x.evolutionStroke;if(a.className==="anchor")return"#000";return x.componentLabelColor}).attr("font-size",n.labelFontSize).attr("font-weight",(a)=>a.className==="anchor"?"bold":"normal").attr("text-anchor",(a)=>a.className==="anchor"?"middle":"start").attr("dominant-baseline",(a)=>a.className==="anchor"?"middle":"auto").text((a)=>a.label),M.annotations.length>0){let a=Y.append("g").attr("class","wardley-annotations");if(M.annotations.forEach((c)=>{let i=c.coordinates.map((h)=>({x:q(h.x),y:V(h.y)}));if(i.length>1)for(let h=0;h<i.length-1;h++)a.append("line").attr("class","wardley-annotation-line").attr("x1",i[h].x).attr("y1",i[h].y).attr("x2",i[h+1].x).attr("y2",i[h+1].y).attr("stroke",x.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");i.forEach((h)=>{let w=a.append("g").attr("class","wardley-annotation");w.append("circle").attr("cx",h.x).attr("cy",h.y).attr("r",10).attr("fill","white").attr("stroke",x.axisColor).attr("stroke-width",1.5),w.append("text").attr("x",h.x).attr("y",h.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",x.axisTextColor).attr("font-weight","bold").text(c.number)})}),M.annotationsBox){let c=q(M.annotationsBox.x),i=V(M.annotationsBox.y),h=10,w=16,k=11,S=a.append("g").attr("class","wardley-annotations-box"),P=[...M.annotations].filter((L)=>L.text).sort((L,I)=>L.number-I.number),N=[];if(P.forEach((L,I)=>{let G=S.append("text").attr("x",c+h).attr("y",i+h+(I+1)*w).attr("font-size",k).attr("fill",x.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${L.number}. ${L.text}`);N.push(G)}),N.length>0){let L=0,I=0;N.forEach((dt)=>{let ot=dt.node(),It=ot.getComputedTextLength();L=Math.max(L,It);let Bt=ot.getBBox();I=Math.max(I,Bt.height)});let G=L+h*2+105,rt=P.length*w+h*2+I/2,U=n.padding,Et=F-n.padding-G,Ht=n.padding,Yt=X-n.padding-rt;c=Math.max(U,Math.min(c,Et)),i=Math.max(Ht,Math.min(i,Yt)),N.forEach((dt,ot)=>{dt.attr("x",c+h).attr("y",i+h+(ot+1)*w)}),S.insert("rect","text").attr("x",c).attr("y",i).attr("width",G).attr("height",rt).attr("fill","white").attr("stroke",x.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(M.notes.length>0){let a=Y.append("g").attr("class","wardley-notes");M.notes.forEach((c)=>{let i=q(c.x),h=V(c.y);a.append("text").attr("x",i).attr("y",h).attr("text-anchor","start").attr("font-size",11).attr("fill",x.axisTextColor).attr("font-weight","bold").text(c.text)})}if(M.accelerators.length>0){let a=Y.append("g").attr("class","wardley-accelerators");M.accelerators.forEach((c)=>{let i=q(c.x),h=V(c.y),w=60,k=30,S=20,P=`
3
+ M ${i} ${h-15}
4
+ L ${i+60-20} ${h-15}
5
+ L ${i+60-20} ${h-15-8}
6
+ L ${i+60} ${h}
7
+ L ${i+60-20} ${h+15+8}
8
+ L ${i+60-20} ${h+15}
9
+ L ${i} ${h+15}
10
+ Z
11
+ `;a.append("path").attr("d",P).attr("fill","white").attr("stroke",x.componentStroke).attr("stroke-width",1),a.append("text").attr("x",i+30).attr("y",h+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",x.axisTextColor).attr("font-weight","bold").text(c.name)})}if(M.deaccelerators.length>0){let a=Y.append("g").attr("class","wardley-deaccelerators");M.deaccelerators.forEach((c)=>{let i=q(c.x),h=V(c.y),w=60,k=30,S=20,P=`
12
+ M ${i+60} ${h-15}
13
+ L ${i+20} ${h-15}
14
+ L ${i+20} ${h-15-8}
15
+ L ${i} ${h}
16
+ L ${i+20} ${h+15+8}
17
+ L ${i+20} ${h+15}
18
+ L ${i+60} ${h+15}
19
+ Z
20
+ `;a.append("path").attr("d",P).attr("fill","white").attr("stroke",x.componentStroke).attr("stroke-width",1),a.append("text").attr("x",i+30).attr("y",h+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",x.axisTextColor).attr("font-weight","bold").text(c.name)})}},"draw"),_t={draw:Vt},Zt=e(({wardley:o}={})=>{let l=j(),s=u(),C=E(l,s.themeVariables),n=E(C.wardley,o);return`
21
+ .wardley-background {
22
+ fill: ${n.backgroundColor};
23
+ }
24
+ .wardley-axes line, .wardley-axes path {
25
+ stroke: ${n.axisColor};
26
+ }
27
+ .wardley-axis-label {
28
+ fill: ${n.axisTextColor};
29
+ }
30
+ .wardley-stage-label {
31
+ fill: ${n.axisTextColor};
32
+ }
33
+ .wardley-grid line {
34
+ stroke: ${n.gridColor};
35
+ }
36
+ .wardley-node circle {
37
+ fill: ${n.componentFill};
38
+ stroke: ${n.componentStroke};
39
+ }
40
+ .wardley-node-label {
41
+ fill: ${n.componentLabelColor};
42
+ }
43
+ .wardley-link {
44
+ stroke: ${n.linkStroke};
45
+ }
46
+ .wardley-link--dashed {
47
+ stroke-dasharray: 4 4;
48
+ }
49
+ .wardley-link-label {
50
+ fill: ${n.axisTextColor};
51
+ }
52
+ .wardley-trend line {
53
+ stroke: ${n.evolutionStroke};
54
+ }
55
+ .wardley-annotation-line {
56
+ stroke: ${n.annotationStroke};
57
+ }
58
+ .wardley-annotation circle {
59
+ fill: ${n.annotationFill};
60
+ stroke: ${n.annotationStroke};
61
+ }
62
+ .wardley-annotation text {
63
+ fill: ${n.annotationTextColor};
64
+ }
65
+ .wardley-annotations-box rect {
66
+ fill: ${n.annotationFill};
67
+ stroke: ${n.annotationStroke};
68
+ }
69
+ .wardley-annotations-box text {
70
+ fill: ${n.annotationTextColor};
71
+ }
72
+ .wardley-pipeline-box {
73
+ stroke: ${n.componentStroke};
74
+ }
75
+ .wardley-notes text {
76
+ fill: ${n.axisTextColor};
77
+ }
78
+ `},"styles"),oe={parser:ft,db:Dt,renderer:_t,styles:Zt};export{oe as diagram};
@@ -0,0 +1,7 @@
1
+ import{e,t,j,x,u,w,T,d,f,p,m,g,b,v,Le,A,E,Ei}from"./index-nwsya6dj.js";import"./index-v119nznk.js";import"./index-5tv8v1hk.js";import{pe}from"./index-gf4e0et4.js";import{Oe}from"./index-9b02042t.js";import{Ue}from"./index-hj99nz1f.js";function vt(i,s,a){i=+i,s=+s,a=(o=arguments.length)<2?(s=i,i=0,1):o<3?1:+a;var n=-1,o=Math.max(0,Math.ceil((s-i)/a))|0,c=Array(o);while(++n<o)c[n]=i+n*a;return c}function dt(){var i=pe().unknown(void 0),{domain:s,range:a}=i,n=0,o=1,c,y,_=!1,V=0,F=0,N=0.5;delete i.unknown;function O(){var L=s().length,G=o<n,Y=G?o:n,H=G?n:o;if(c=(H-Y)/Math.max(1,L-V+F*2),_)c=Math.floor(c);if(Y+=(H-Y-c*(L-V))*N,y=c*(1-V),_)Y=Math.round(Y),y=Math.round(y);var Q=vt(L).map(function(st){return Y+c*st});return a(G?Q.reverse():Q)}return i.domain=function(L){return arguments.length?(s(L),O()):s()},i.range=function(L){return arguments.length?([n,o]=L,n=+n,o=+o,O()):[n,o]},i.rangeRound=function(L){return[n,o]=L,n=+n,o=+o,_=!0,O()},i.bandwidth=function(){return y},i.step=function(){return c},i.round=function(L){return arguments.length?(_=!!L,O()):_},i.padding=function(L){return arguments.length?(V=Math.min(1,F=+L),O()):V},i.paddingInner=function(L){return arguments.length?(V=Math.min(1,L),O()):V},i.paddingOuter=function(L){return arguments.length?(F=+L,O()):F},i.align=function(L){return arguments.length?(N=Math.max(0,Math.min(1,L)),O()):N},i.copy=function(){return dt(s(),[n,o]).round(_).paddingInner(V).paddingOuter(F).align(N)},Ue.apply(O(),arguments)}var Lt=function(){var i=e(function(tt,h,l,C){for(l=l||{},C=tt.length;C--;l[tt[C]]=h);return l},"o"),s=[1,10,12,14,16,18,19,21,23],a=[2,6],n=[1,3],o=[1,5],c=[1,6],y=[1,7],_=[1,5,10,12,14,16,18,19,21,23,36,37,38],V=[1,25],F=[1,26],N=[1,28],O=[1,29],L=[1,30],G=[1,31],Y=[1,32],H=[1,33],Q=[1,34],st=[1,35],nt=[1,36],P=[1,37],Z=[1,43],k=[1,42],K=[1,47],J=[1,50],M=[1,10,12,14,16,18,19,21,23,36,37,38],rt=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],U=[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],ut=[1,65],W=[26,28],I={trace:e(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:e(function(h,l,C,S,z,r,ht){var R=r.length-1;switch(z){case 5:S.setOrientation(r[R]);break;case 9:S.setDiagramTitle(r[R].text.trim());break;case 12:S.setLineData({text:"",type:"text"},r[R]);break;case 13:S.setLineData(r[R-1],r[R]);break;case 14:S.setBarData({text:"",type:"text"},r[R]);break;case 15:S.setBarData(r[R-1],r[R]);break;case 16:this.$=r[R].trim(),S.setAccTitle(this.$);break;case 17:case 18:this.$=r[R].trim(),S.setAccDescription(this.$);break;case 19:this.$=r[R-1];break;case 20:case 30:this.$=[r[R-2],...r[R]];break;case 21:case 31:this.$=[r[R]];break;case 22:this.$={value:Number(r[R-1]),label:r[R]};break;case 23:this.$={value:Number(r[R]),label:""};break;case 24:S.setXAxisTitle(r[R]);break;case 25:S.setXAxisTitle(r[R-1]);break;case 26:S.setXAxisTitle({type:"text",text:""});break;case 27:S.setXAxisBand(r[R]);break;case 28:S.setXAxisRangeData(Number(r[R-2]),Number(r[R]));break;case 29:this.$=r[R-1];break;case 32:S.setYAxisTitle(r[R]);break;case 33:S.setYAxisTitle(r[R-1]);break;case 34:S.setYAxisTitle({type:"text",text:""});break;case 35:S.setYAxisRangeData(Number(r[R-2]),Number(r[R]));break;case 39:this.$={text:r[R],type:"text"};break;case 40:this.$={text:r[R],type:"text"};break;case 41:this.$={text:r[R],type:"markdown"};break;case 42:this.$=r[R];break;case 43:this.$=r[R-1]+""+r[R];break}},"anonymous"),table:[i(s,a,{3:1,4:2,7:4,5:n,36:o,37:c,38:y}),{1:[3]},i(s,a,{4:2,7:4,3:8,5:n,36:o,37:c,38:y}),i(s,a,{4:2,7:4,6:9,3:10,5:n,8:[1,11],36:o,37:c,38:y}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},i(_,[2,36]),i(_,[2,37]),i(_,[2,38]),{1:[2,1]},i(s,a,{4:2,7:4,3:21,5:n,36:o,37:c,38:y}),{1:[2,3]},i(_,[2,5]),i(s,[2,7],{4:22,36:o,37:c,38:y}),{11:23,30:V,39:24,40:F,41:27,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P},{11:39,13:38,24:Z,29:k,30:V,31:40,32:41,39:24,40:F,41:27,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P},{11:45,15:44,29:K,30:V,35:46,39:24,40:F,41:27,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P},{11:49,17:48,24:J,30:V,39:24,40:F,41:27,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P},{11:52,17:51,24:J,30:V,39:24,40:F,41:27,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P},{20:[1,53]},{22:[1,54]},i(M,[2,18]),{1:[2,2]},i(M,[2,8]),i(M,[2,9]),i(rt,[2,39],{41:55,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P}),i(rt,[2,40]),i(rt,[2,41]),i(U,[2,42]),i(U,[2,44]),i(U,[2,45]),i(U,[2,46]),i(U,[2,47]),i(U,[2,48]),i(U,[2,49]),i(U,[2,50]),i(U,[2,51]),i(U,[2,52]),i(U,[2,53]),i(M,[2,10]),i(M,[2,24],{32:41,31:56,24:Z,29:k}),i(M,[2,26]),i(M,[2,27]),{33:[1,57]},{11:59,30:V,34:58,39:24,40:F,41:27,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P},i(M,[2,11]),i(M,[2,32],{35:60,29:K}),i(M,[2,34]),{33:[1,61]},i(M,[2,12]),{17:62,24:J},{25:63,27:64,29:ut},i(M,[2,14]),{17:66,24:J},i(M,[2,16]),i(M,[2,17]),i(U,[2,43]),i(M,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},i(M,[2,33]),{29:[1,70]},i(M,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},i(W,[2,23],{30:[1,73]}),i(M,[2,15]),i(M,[2,28]),i(M,[2,29]),{11:59,30:V,34:74,39:24,40:F,41:27,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P},i(M,[2,35]),i(M,[2,19]),{25:75,27:64,29:ut},i(W,[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:e(function(h,l){if(l.recoverable)this.trace(h);else{var C=Error(h);throw C.hash=l,C}},"parseError"),parse:e(function(h){var l=this,C=[0],S=[],z=[null],r=[],ht=this.table,R="",yt=0,Xt=0,Yt=0,ge=2,Nt=1,xe=r.slice.call(arguments,1),X=Object.create(this.lexer),lt={yy:{}};for(var St in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,St))lt.yy[St]=this.yy[St];if(X.setInput(h,lt.yy),lt.yy.lexer=X,lt.yy.parser=this,typeof X.yylloc>"u")X.yylloc={};var Rt=X.yylloc;r.push(Rt);var de=X.options&&X.options.ranges;if(typeof lt.yy.parseError==="function")this.parseError=lt.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function fe(it){C.length=C.length-2*it,z.length=z.length-it,r.length=r.length-it}e(fe,"popStack");function Ht(){var it=S.pop()||X.lex()||Nt;if(typeof it!=="number"){if(it instanceof Array)S=it,it=S.pop();it=l.symbols_[it]||it}return it}e(Ht,"lex");var q,_t,ct,et,Pe,Tt,gt={},At,ot,$t,kt;while(!0){if(ct=C[C.length-1],this.defaultActions[ct])et=this.defaultActions[ct];else{if(q===null||typeof q>"u")q=Ht();et=ht[ct]&&ht[ct][q]}if(typeof et>"u"||!et.length||!et[0]){var Dt="";kt=[];for(At in ht[ct])if(this.terminals_[At]&&At>ge)kt.push("'"+this.terminals_[At]+"'");if(X.showPosition)Dt="Parse error on line "+(yt+1)+`:
2
+ `+X.showPosition()+`
3
+ Expecting `+kt.join(", ")+", got '"+(this.terminals_[q]||q)+"'";else Dt="Parse error on line "+(yt+1)+": Unexpected "+(q==Nt?"end of input":"'"+(this.terminals_[q]||q)+"'");this.parseError(Dt,{text:X.match,token:this.terminals_[q]||q,line:X.yylineno,loc:Rt,expected:kt})}if(et[0]instanceof Array&&et.length>1)throw Error("Parse Error: multiple actions possible at state: "+ct+", token: "+q);switch(et[0]){case 1:if(C.push(q),z.push(X.yytext),r.push(X.yylloc),C.push(et[1]),q=null,!_t){if(Xt=X.yyleng,R=X.yytext,yt=X.yylineno,Rt=X.yylloc,Yt>0)Yt--}else q=_t,_t=null;break;case 2:if(ot=this.productions_[et[1]][1],gt.$=z[z.length-ot],gt._$={first_line:r[r.length-(ot||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(ot||1)].first_column,last_column:r[r.length-1].last_column},de)gt._$.range=[r[r.length-(ot||1)].range[0],r[r.length-1].range[1]];if(Tt=this.performAction.apply(gt,[R,Xt,yt,lt.yy,et[1],z,r].concat(xe)),typeof Tt<"u")return Tt;if(ot)C=C.slice(0,-1*ot*2),z=z.slice(0,-1*ot),r=r.slice(0,-1*ot);C.push(this.productions_[et[1]][0]),z.push(gt.$),r.push(gt._$),$t=ht[C[C.length-2]][C[C.length-1]],C.push($t);break;case 3:return!0}}return!0},"parse")},at=function(){var tt={EOF:1,parseError:e(function(l,C){if(this.yy.parser)this.yy.parser.parseError(l,C);else throw Error(l)},"parseError"),setInput:e(function(h,l){if(this.yy=l||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={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:e(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var l=h.match(/(?:\r\n?|\n).*/g);if(l)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),h},"input"),unput:e(function(h){var l=h.length,C=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var S=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),C.length-1)this.yylineno-=C.length-1;var z=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:C?(C.length===S.length?this.yylloc.first_column:0)+S[S.length-C.length].length-C[0].length:this.yylloc.first_column-l},this.options.ranges)this.yylloc.range=[z[0],z[0]+this.yyleng-l];return this.yyleng=this.yytext.length,this},"unput"),more:e(function(){return this._more=!0,this},"more"),reject:e(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
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:e(function(h){this.unput(this.match.slice(h))},"less"),pastInput:e(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:e(function(){var h=this.match;if(h.length<20)h+=this._input.substr(0,20-h.length);return(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:e(function(){var h=this.pastInput(),l=Array(h.length+1).join("-");return h+this.upcomingInput()+`
5
+ `+l+"^"},"showPosition"),test_match:e(function(h,l){var C,S,z;if(this.options.backtrack_lexer){if(z={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)z.yylloc.range=this.yylloc.range.slice(0)}if(S=h[0].match(/(?:\r\n?|\n).*/g),S)this.yylineno+=S.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:S?S[S.length-1].length-S[S.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+h[0].length},this.yytext+=h[0],this.match+=h[0],this.matches=h,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._backtrack=!1,this._input=this._input.slice(h[0].length),this.matched+=h[0],C=this.performAction.call(this,this.yy,this,l,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(C)return C;else if(this._backtrack){for(var r in z)this[r]=z[r];return!1}return!1},"test_match"),next:e(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var h,l,C,S;if(!this._more)this.yytext="",this.match="";var z=this._currentRules();for(var r=0;r<z.length;r++)if(C=this._input.match(this.rules[z[r]]),C&&(!l||C[0].length>l[0].length)){if(l=C,S=r,this.options.backtrack_lexer)if(h=this.test_match(C,z[r]),h!==!1)return h;else if(this._backtrack){l=!1;continue}else return!1;else if(!this.options.flex)break}if(l){if(h=this.test_match(l,z[S]),h!==!1)return h;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:e(function(){var l=this.next();if(l)return l;else return this.lex()},"lex"),begin:e(function(l){this.conditionStack.push(l)},"begin"),popState:e(function(){var l=this.conditionStack.length-1;if(l>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:e(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:e(function(l){if(l=this.conditionStack.length-1-Math.abs(l||0),l>=0)return this.conditionStack[l];else return"INITIAL"},"topState"),pushState:e(function(l){this.begin(l)},"pushState"),stateStackSize:e(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:e(function(l,C,S,z){var r=z;switch(S){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 tt}();I.lexer=at;function B(){this.yy={}}return e(B,"Parser"),B.prototype=I,I.Parser=B,new B}();Lt.parser=Lt;var me=Lt;function Pt(i){return i.type==="bar"}e(Pt,"isBarPlot");function wt(i){return i.type==="band"}e(wt,"isBandAxisData");function xt(i){return i.type==="linear"}e(xt,"isLinearAxisData");var Gt=class{constructor(i){this.parentGroup=i}static{e(this,"TextDimensionCalculatorWithFont")}getMaxDimension(i,s){if(!this.parentGroup)return{width:i.reduce((o,c)=>Math.max(c.length,o),0)*s,height:s};let a={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",s);for(let o of i){let c=Ei(n,1,o),y=c?c.width:o.length*s,_=c?c.height:s;a.width=Math.max(a.width,y),a.height=Math.max(a.height,_)}return n.remove(),a}},Ut=0.7,qt=0.2,jt=class{constructor(i,s,a,n){this.axisConfig=i,this.title=s,this.textDimensionCalculator=a,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{e(this,"BaseAxis")}setRange(i){if(this.range=i,this.axisPosition==="left"||this.axisPosition==="right")this.boundingRect.height=i[1]-i[0];else this.boundingRect.width=i[1]-i[0];this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(i){this.axisPosition=i,this.setRange(this.range)}getTickDistance(){let i=this.getRange();return Math.abs(i[0]-i[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map((i)=>i.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){if(Ut*this.getTickDistance()>this.outerPadding*2)this.outerPadding=Math.floor(Ut*this.getTickDistance()/2);this.recalculateScale()}calculateSpaceIfDrawnHorizontally(i){let s=i.height;if(this.axisConfig.showAxisLine&&s>this.axisConfig.axisLineWidth)s-=this.axisConfig.axisLineWidth,this.showAxisLine=!0;if(this.axisConfig.showLabel){let a=this.getLabelDimension(),n=qt*i.width;this.outerPadding=Math.min(a.width/2,n);let o=a.height;if(this.axisPosition==="bottom"&&this.normalizedLabelRotationInRad!==0)o=Math.max(o,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*a.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*a.height));if(o+=this.axisConfig.labelPadding*2,this.labelTextHeight=a.height,o<=s)s-=o,this.showLabel=!0}if(this.axisConfig.showTick&&s>=this.axisConfig.tickLength)this.showTick=!0,s-=this.axisConfig.tickLength;if(this.axisConfig.showTitle&&this.title){let a=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=a.height+this.axisConfig.titlePadding*2;if(this.titleTextHeight=a.height,n<=s)s-=n,this.showTitle=!0}this.boundingRect.width=i.width,this.boundingRect.height=i.height-s}calculateSpaceIfDrawnVertical(i){let s=i.width;if(this.axisConfig.showAxisLine&&s>this.axisConfig.axisLineWidth)s-=this.axisConfig.axisLineWidth,this.showAxisLine=!0;if(this.axisConfig.showLabel){let a=this.getLabelDimension(),n=qt*i.height;this.outerPadding=Math.min(a.height/2,n);let o=a.width+this.axisConfig.labelPadding*2;if(o<=s)s-=o,this.showLabel=!0}if(this.axisConfig.showTick&&s>=this.axisConfig.tickLength)this.showTick=!0,s-=this.axisConfig.tickLength;if(this.axisConfig.showTitle&&this.title){let a=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=a.height+this.axisConfig.titlePadding*2;if(this.titleTextHeight=a.height,n<=s)s-=n,this.showTitle=!0}this.boundingRect.width=i.width-s,this.boundingRect.height=i.height}calculateSpace(i){if(this.axisPosition==="left"||this.axisPosition==="right")this.calculateSpaceIfDrawnVertical(i);else this.calculateSpaceIfDrawnHorizontally(i);return this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(i){this.boundingRect.x=i.x,this.boundingRect.y=i.y}calculateOffsetByRotation(i){let s=this.normalizedLabelRotationInRad;if(s===0)return 0;return Math.sin(s)*this.getLabelDimension()[i]/2}getDrawableElementsForLeftAxis(){let i=[];if(this.showAxisLine){let s=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;i.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${s},${this.boundingRect.y} L ${s},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)i.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map((s)=>({text:s.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(s),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))});if(this.showTick){let s=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);i.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map((a)=>({path:`M ${s},${this.getScaleValue(a)} L ${s-this.axisConfig.tickLength},${this.getScaleValue(a)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)i.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 i}getDrawableElementsForBottomAxis(){let i=[];if(this.showAxisLine){let s=this.boundingRect.y+this.axisConfig.axisLineWidth/2;i.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${s} L ${this.boundingRect.x+this.boundingRect.width},${s}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)i.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map((s)=>({text:s.toString(),x:this.getScaleValue(s)+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 s=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);i.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map((a)=>({path:`M ${this.getScaleValue(a)},${s} L ${this.getScaleValue(a)},${s+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)i.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 i}getDrawableElementsForTopAxis(){let i=[];if(this.showAxisLine){let s=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;i.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${s} L ${this.boundingRect.x+this.boundingRect.width},${s}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)i.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map((s)=>({text:s.toString(),x:this.getScaleValue(s),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 s=this.boundingRect.y;i.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map((a)=>({path:`M ${this.getScaleValue(a)},${s+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(a)},${s+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)i.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 i}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[]}},be=class extends jt{static{e(this,"BandAxis")}constructor(i,s,a,n,o){super(i,n,o,s);this.categories=a,this.scale=dt().domain(this.categories).range(this.getRange())}setRange(i){super.setRange(i)}recalculateScale(){this.scale=dt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5),t.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(i){return this.scale(i)??this.getRange()[0]}},ye=class extends jt{static{e(this,"LinearAxis")}constructor(i,s,a,n,o){super(i,n,o,s);this.domain=a,this.scale=Oe().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let i=[...this.domain];if(this.axisPosition==="left")i.reverse();this.scale=Oe().domain(i).range(this.getRange())}getScaleValue(i){return this.scale(i)}};function Et(i,s,a,n){let o=new Gt(n);if(wt(i))return new be(s,a,i.categories,i.title,o);return new ye(s,a,[i.min,i.max],i.title,o)}e(Et,"getAxis");var Ae=class{constructor(i,s,a,n){this.textDimensionCalculator=i,this.chartConfig=s,this.chartData=a,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{e(this,"ChartTitle")}setBoundingBoxXY(i){this.boundingRect.x=i.x,this.boundingRect.y=i.y}calculateSpace(i){let s=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),a=Math.max(s.width,i.width),n=s.height+2*this.chartConfig.titlePadding;if(s.width<=a&&s.height<=n&&this.chartConfig.showTitle&&this.chartData.title)this.boundingRect.width=a,this.boundingRect.height=n,this.showChartTitle=!0;return{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let i=[];if(this.showChartTitle)i.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 i}};function Qt(i,s,a,n){let o=new Gt(n);return new Ae(o,i,s,a)}e(Qt,"getChartTitleComponent");var ke=class{constructor(i,s,a,n,o){this.plotData=i,this.xAxis=s,this.yAxis=a,this.orientation=n,this.plotIndex=o}static{e(this,"LinePlot")}getDrawableElement(){let i=this.plotData.data.map((n)=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]),s;if(this.orientation==="horizontal")s=Le().y((n)=>n[0]).x((n)=>n[1])(i);else s=Le().x((n)=>n[0]).y((n)=>n[1])(i);if(!s)return[];let a=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:s,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){let c=[];for(let[y,[_,V]]of i.entries()){let F=this.plotData.pointLabels[y];if(!F)continue;if(this.orientation==="horizontal")c.push({x:V+10,y:_,text:F,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:12,rotation:0});else c.push({x:_,y:V-10,text:F,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:12,rotation:0})}if(c.length>0)a.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:c})}return a}},we=class{constructor(i,s,a,n,o,c){this.barData=i,this.boundingRect=s,this.xAxis=a,this.yAxis=n,this.orientation=o,this.plotIndex=c}static{e(this,"BarPlot")}getDrawableElement(){let i=this.barData.data.map((o)=>[this.xAxis.getScaleValue(o[0]),this.yAxis.getScaleValue(o[1])]),s=0.05,a=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*0.95,n=a/2;if(this.orientation==="horizontal")return[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:i.map((o)=>({x:this.boundingRect.x,y:o[0]-n,height:a,width:o[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}];return[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:i.map((o)=>({x:o[0]-n,y:o[1],width:a,height:this.boundingRect.y+this.boundingRect.height-o[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},Ce=class{constructor(i,s,a){this.chartConfig=i,this.chartData=s,this.chartThemeConfig=a,this.boundingRect={x:0,y:0,width:0,height:0}}static{e(this,"BasePlot")}setAxes(i,s){this.xAxis=i,this.yAxis=s}setBoundingBoxXY(i){this.boundingRect.x=i.x,this.boundingRect.y=i.y}calculateSpace(i){return this.boundingRect.width=i.width,this.boundingRect.height=i.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 i=[];for(let[s,a]of this.chartData.plots.entries())switch(a.type){case"line":{let n=new ke(a,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,s);i.push(...n.getDrawableElement())}break;case"bar":{let n=new we(a,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,s);i.push(...n.getDrawableElement())}break}return i}};function Kt(i,s,a){return new Ce(i,s,a)}e(Kt,"getPlotComponent");var Se=class{constructor(i,s,a,n){this.chartConfig=i,this.chartData=s,this.componentStore={title:Qt(i,s,a,n),plot:Kt(i,s,a),xAxis:Et(s.xAxis,i.xAxis,{titleColor:a.xAxisTitleColor,labelColor:a.xAxisLabelColor,tickColor:a.xAxisTickColor,axisLineColor:a.xAxisLineColor},n),yAxis:Et(s.yAxis,i.yAxis,{titleColor:a.yAxisTitleColor,labelColor:a.yAxisLabelColor,tickColor:a.yAxisTickColor,axisLineColor:a.yAxisLineColor},n)}}static{e(this,"Orchestrator")}calculateVerticalSpace(){let i=this.chartConfig.width,s=this.chartConfig.height,a=0,n=0,o=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),c=Math.floor(s*this.chartConfig.plotReservedSpacePercent/100),y=this.componentStore.plot.calculateSpace({width:o,height:c});if(i-=y.width,s-=y.height,y=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:s}),n=y.height,s-=y.height,this.componentStore.xAxis.setAxisPosition("bottom"),y=this.componentStore.xAxis.calculateSpace({width:i,height:s}),s-=y.height,this.componentStore.yAxis.setAxisPosition("left"),y=this.componentStore.yAxis.calculateSpace({width:i,height:s}),a=y.width,i-=y.width,i>0)o+=i,i=0;if(s>0)c+=s,s=0;if(this.componentStore.plot.calculateSpace({width:o,height:c}),this.componentStore.plot.setBoundingBoxXY({x:a,y:n}),this.componentStore.xAxis.setRange([a,a+o]),this.componentStore.xAxis.setBoundingBoxXY({x:a,y:n+c}),this.componentStore.yAxis.setRange([n,n+c]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some((_)=>Pt(_)))this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let i=this.chartConfig.width,s=this.chartConfig.height,a=0,n=0,o=0,c=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),y=Math.floor(s*this.chartConfig.plotReservedSpacePercent/100),_=this.componentStore.plot.calculateSpace({width:c,height:y});if(i-=_.width,s-=_.height,_=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:s}),a=_.height,s-=_.height,this.componentStore.xAxis.setAxisPosition("left"),_=this.componentStore.xAxis.calculateSpace({width:i,height:s}),i-=_.width,n=_.width,this.componentStore.yAxis.setAxisPosition("top"),_=this.componentStore.yAxis.calculateSpace({width:i,height:s}),s-=_.height,o=a+_.height,i>0)c+=i,i=0;if(s>0)y+=s,s=0;if(this.componentStore.plot.calculateSpace({width:c,height:y}),this.componentStore.plot.setBoundingBoxXY({x:n,y:o}),this.componentStore.yAxis.setRange([n,n+c]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:a}),this.componentStore.xAxis.setRange([o,o+y]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:o}),this.chartData.plots.some((V)=>Pt(V)))this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){if(this.chartConfig.chartOrientation==="horizontal")this.calculateHorizontalSpace();else this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let i=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let s of Object.values(this.componentStore))i.push(...s.getDrawableElements());return i}},Re=class{static{e(this,"XYChartBuilder")}static build(i,s,a,n){return new Se(i,s,a,n).getDrawableElement()}},ft=0,Zt,pt=Bt(),mt=zt(),D=Vt(),It=mt.plotColorPalette.split(",").map((i)=>i.trim()),Ct=!1,Mt=!1;function zt(){let i=j(),s=u();return E(i.xyChart,s.themeVariables.xyChart)}e(zt,"getChartDefaultThemeConfig");function Bt(){let i=u();return E(x.xyChart,i.xyChart)}e(Bt,"getChartDefaultConfig");function Vt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}e(Vt,"getChartDefaultData");function bt(i){let s=u();return w(i.trim(),s)}e(bt,"textSanitizer");function Jt(i){Zt=i}e(Jt,"setTmpSVGG");function te(i){if(i==="horizontal")pt.chartOrientation="horizontal";else pt.chartOrientation="vertical"}e(te,"setOrientation");function ee(i){D.xAxis.title=bt(i.text)}e(ee,"setXAxisTitle");function Ot(i,s){D.xAxis={type:"linear",title:D.xAxis.title,min:i,max:s},Ct=!0}e(Ot,"setXAxisRangeData");function ie(i){D.xAxis={type:"band",title:D.xAxis.title,categories:i.map((s)=>bt(s.text))},Ct=!0}e(ie,"setXAxisBand");function se(i){D.yAxis.title=bt(i.text)}e(se,"setYAxisTitle");function ae(i,s){D.yAxis={type:"linear",title:D.yAxis.title,min:i,max:s},Mt=!0}e(ae,"setYAxisRangeData");function ne(i){let s=Math.min(...i),a=Math.max(...i),n=xt(D.yAxis)?D.yAxis.min:1/0,o=xt(D.yAxis)?D.yAxis.max:-1/0;D.yAxis={type:"linear",title:D.yAxis.title,min:Math.min(n,s),max:Math.max(o,a)}}e(ne,"setYAxisRangeFromPlotData");function Wt(i){let s=[];if(i.length===0)return s;if(!Ct){let a=xt(D.xAxis)?D.xAxis.min:1/0,n=xt(D.xAxis)?D.xAxis.max:-1/0;Ot(Math.min(a,1),Math.max(n,i.length))}if(wt(D.xAxis)&&i.length>D.xAxis.categories.length)i=i.slice(0,D.xAxis.categories.length);if(!Mt)ne(i);if(wt(D.xAxis))s=D.xAxis.categories.map((a,n)=>[a,i[n]]);if(xt(D.xAxis)){let a=D.xAxis.min,n=D.xAxis.max;if(i.length===1)s=[[`${a}`,i[0]]];else{let o=(n-a)/(i.length-1);s=i.map((c,y)=>[`${a+y*o}`,c])}}return s}e(Wt,"transformDataWithoutCategory");function Ft(i){return It[i===0?0:i%It.length]}e(Ft,"getPlotColorFromPalette");function oe(i,s){let a=s.map((y)=>y.value),n=s.map((y)=>y.label?bt(y.label):""),o=Wt(a),c=n.some((y)=>y!=="");D.plots.push({type:"line",strokeFill:Ft(ft),strokeWidth:2,data:o,...c?{pointLabels:n}:{}}),ft++}e(oe,"setLineData");function re(i,s){let a=s.map((o)=>o.value),n=Wt(a);D.plots.push({type:"bar",fill:Ft(ft),data:n}),ft++}e(re,"setBarData");function he(){if(D.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return D.title=v(),Re.build(pt,D,mt,Zt)}e(he,"getDrawableElem");function le(){return mt}e(le,"getChartThemeConfig");function ce(){return pt}e(ce,"getChartConfig");function ue(){return D}e(ue,"getXYChartData");var _e=e(function(){d(),ft=0,pt=Bt(),D=Vt(),mt=zt(),It=mt.plotColorPalette.split(",").map((i)=>i.trim()),Ct=!1,Mt=!1},"clear"),Te={getDrawableElem:he,clear:_e,setAccTitle:f,getAccTitle:p,setDiagramTitle:b,getDiagramTitle:v,getAccDescription:g,setAccDescription:m,setOrientation:te,setXAxisTitle:ee,setXAxisRangeData:Ot,setXAxisBand:ie,setYAxisTitle:se,setYAxisRangeData:ae,setLineData:oe,setBarData:re,setTmpSVGG:Jt,getChartThemeConfig:le,getChartConfig:ce,getXYChartData:ue},De=e((i,s,a,n)=>{let o=n.db,c=o.getChartThemeConfig(),y=o.getChartConfig(),_=o.getXYChartData().plots[0].data.map((P)=>P[1]);function V(P){return P==="top"?"text-before-edge":"middle"}e(V,"getDominantBaseLine");function F(P){return P==="left"?"start":P==="right"?"end":"middle"}e(F,"getTextAnchor");function N(P){return`translate(${P.x}, ${P.y}) rotate(${P.rotation||0})`}e(N,"getTextTransformation"),t.debug(`Rendering xychart chart
7
+ `+i);let O=A(s),L=O.append("g").attr("class","main"),G=L.append("rect").attr("width",y.width).attr("height",y.height).attr("class","background");T(O,y.height,y.width,!0),O.attr("viewBox",`0 0 ${y.width} ${y.height}`),G.attr("fill",c.backgroundColor),o.setTmpSVGG(O.append("g").attr("class","mermaid-tmp-group"));let Y=o.getDrawableElem(),H={};function Q(P){let Z=L,k="";for(let[K]of P.entries()){let J=L;if(K>0&&H[k])J=H[k];if(k+=P[K],Z=H[k],!Z)Z=H[k]=J.append("g").attr("class",P[K])}return Z}e(Q,"getGroup");for(let P of Y){if(P.data.length===0)continue;let Z=Q(P.groupTexts);switch(P.type){case"rect":if(Z.selectAll("rect").data(P.data).enter().append("rect").attr("x",(k)=>k.x).attr("y",(k)=>k.y).attr("width",(k)=>k.width).attr("height",(k)=>k.height).attr("fill",(k)=>k.fill).attr("stroke",(k)=>k.strokeFill).attr("stroke-width",(k)=>k.strokeWidth),y.showDataLabel){let k=y.showDataLabelOutsideBar;if(y.chartOrientation==="horizontal"){let K=function(I,at){let{data:B,label:tt}=I;return at*tt.length*J<=B.width-M};var st=K;e(K,"fitsHorizontally");let J=0.7,M=10,rt=P.data.map((I,at)=>({data:I,label:_[at].toString()})).filter((I)=>I.data.width>0&&I.data.height>0),U=rt.map((I)=>{let{data:at}=I,B=at.height*0.7;while(!K(I,B)&&B>0)B-=1;return B}),ut=Math.floor(Math.min(...U)),W=e((I)=>{if(k)return I.data.x+I.data.width+M;else return I.data.x+I.data.width-M},"determineLabelXPosition");Z.selectAll("text").data(rt).enter().append("text").attr("x",W).attr("y",(I)=>I.data.y+I.data.height/2).attr("text-anchor",k?"start":"end").attr("dominant-baseline","middle").attr("fill",c.dataLabelColor).attr("font-size",`${ut}px`).text((I)=>I.label)}else{let K=function(W,I,at){let{data:B,label:tt}=W,h=0.7,l=I*tt.length*0.7,C=B.x+B.width/2,S=C-l/2,z=C+l/2,r=S>=B.x&&z<=B.x+B.width,ht=B.y+at+I<=B.y+B.height;return r&&ht};var nt=K;e(K,"fitsInBar");let J=10,M=P.data.map((W,I)=>({data:W,label:_[I].toString()})).filter((W)=>W.data.width>0&&W.data.height>0),rt=M.map((W)=>{let{data:I,label:at}=W,B=I.width/(at.length*0.7);while(!K(W,B,J)&&B>0)B-=1;return B}),U=Math.floor(Math.min(...rt)),ut=e((W)=>{if(k)return W.data.y-J;else return W.data.y+J},"determineLabelYPosition");Z.selectAll("text").data(M).enter().append("text").attr("x",(W)=>W.data.x+W.data.width/2).attr("y",ut).attr("text-anchor","middle").attr("dominant-baseline",k?"auto":"hanging").attr("fill",c.dataLabelColor).attr("font-size",`${U}px`).text((W)=>W.label)}}break;case"text":Z.selectAll("text").data(P.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",(k)=>k.fill).attr("font-size",(k)=>k.fontSize).attr("dominant-baseline",(k)=>V(k.verticalPos)).attr("text-anchor",(k)=>F(k.horizontalPos)).attr("transform",(k)=>N(k)).text((k)=>k.text);break;case"path":Z.selectAll("path").data(P.data).enter().append("path").attr("d",(k)=>k.path).attr("fill",(k)=>k.fill?k.fill:"none").attr("stroke",(k)=>k.strokeFill).attr("stroke-width",(k)=>k.strokeWidth);break}}},"draw"),ve={draw:De},je={parser:me,db:Te,renderer:ve};export{je as diagram};