@altimateai/ui-components 0.0.77-beta.4 → 0.0.77-beta.6

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 (405) hide show
  1. package/dist/CoachForm.css +1 -1
  2. package/dist/CoachForm.js +62488 -24049
  3. package/dist/DbtDocsRenderer.js +1 -1
  4. package/dist/Stack.js +2826 -2276
  5. package/dist/Switch.js +128 -87
  6. package/dist/ToggleGroup.js +5956 -4781
  7. package/dist/_basePickBy.js +60 -60
  8. package/dist/_baseUniq.js +152 -152
  9. package/dist/abap.js +6 -0
  10. package/dist/actionscript-3.js +6 -0
  11. package/dist/ada.js +6 -0
  12. package/dist/andromeeda.js +4 -0
  13. package/dist/angular-html.js +32 -0
  14. package/dist/angular-ts.js +21 -0
  15. package/dist/apache.js +6 -0
  16. package/dist/apex.js +6 -0
  17. package/dist/apl.js +16 -0
  18. package/dist/applescript.js +6 -0
  19. package/dist/ara.js +6 -0
  20. package/dist/arc.js +53 -53
  21. package/dist/architectureDiagram-VXUJARFQ.js +480 -4315
  22. package/dist/architectureDiagram-VXUJARFQ2.js +831 -0
  23. package/dist/asciidoc.js +6 -0
  24. package/dist/asm.js +6 -0
  25. package/dist/assets/icons/index.js +1 -1
  26. package/dist/astro.js +18 -0
  27. package/dist/aurora-x.js +4 -0
  28. package/dist/awk.js +6 -0
  29. package/dist/ayu-dark.js +4 -0
  30. package/dist/ballerina.js +6 -0
  31. package/dist/band.js +46 -0
  32. package/dist/bat.js +6 -0
  33. package/dist/beancount.js +6 -0
  34. package/dist/berry.js +6 -0
  35. package/dist/bibtex.js +6 -0
  36. package/dist/bicep.js +6 -0
  37. package/dist/blade.js +20 -0
  38. package/dist/blockDiagram-VD42YOAC.js +1 -1
  39. package/dist/blockDiagram-VD42YOAC2.js +2266 -0
  40. package/dist/bsl.js +8 -0
  41. package/dist/c.js +6 -0
  42. package/dist/c3.js +6 -0
  43. package/dist/c4Diagram-YG6GDRKO.js +22 -22
  44. package/dist/c4Diagram-YG6GDRKO2.js +1582 -0
  45. package/dist/cadence.js +6 -0
  46. package/dist/cairo.js +8 -0
  47. package/dist/catppuccin-frappe.js +4 -0
  48. package/dist/catppuccin-latte.js +4 -0
  49. package/dist/catppuccin-macchiato.js +4 -0
  50. package/dist/catppuccin-mocha.js +4 -0
  51. package/dist/channel.js +2 -2
  52. package/dist/chatbotV2/index.d.ts +57 -19
  53. package/dist/chatbotV2/index.js +120 -56
  54. package/dist/chunk-4BX2VUAB.js +1 -1
  55. package/dist/chunk-4BX2VUAB2.js +9 -0
  56. package/dist/chunk-55IACEB6.js +2 -2
  57. package/dist/chunk-55IACEB62.js +9 -0
  58. package/dist/chunk-B4BG7PRW.js +1 -1
  59. package/dist/chunk-B4BG7PRW2.js +1377 -0
  60. package/dist/chunk-DI55MBZ5.js +14 -14
  61. package/dist/chunk-DI55MBZ52.js +1382 -0
  62. package/dist/chunk-FMBD7UC4.js +1 -1
  63. package/dist/chunk-FMBD7UC42.js +19 -0
  64. package/dist/chunk-QN33PNHL.js +5 -5
  65. package/dist/chunk-QN33PNHL2.js +20 -0
  66. package/dist/chunk-QZHKN3VN.js +1 -1
  67. package/dist/chunk-QZHKN3VN2.js +15 -0
  68. package/dist/chunk-TZMSLE5B.js +1 -1
  69. package/dist/chunk-TZMSLE5B2.js +64 -0
  70. package/dist/clarity.js +6 -0
  71. package/dist/classDiagram-2ON5EDUG.js +1 -1
  72. package/dist/classDiagram-2ON5EDUG2.js +17 -0
  73. package/dist/classDiagram-v2-WZHVMYZB.js +1 -1
  74. package/dist/classDiagram-v2-WZHVMYZB2.js +17 -0
  75. package/dist/clojure.js +6 -0
  76. package/dist/cmake.js +6 -0
  77. package/dist/cobol.js +10 -0
  78. package/dist/code-block-37QAKDTI.js +27 -0
  79. package/dist/codeowners.js +6 -0
  80. package/dist/codeql.js +6 -0
  81. package/dist/coffee.js +8 -0
  82. package/dist/common-lisp.js +6 -0
  83. package/dist/coq.js +6 -0
  84. package/dist/cose-bilkent-S5V4N54A.js +160 -2535
  85. package/dist/cose-bilkent-S5V4N54A2.js +231 -0
  86. package/dist/cpp.js +18 -0
  87. package/dist/crystal.js +18 -0
  88. package/dist/csharp.js +6 -0
  89. package/dist/css.js +6 -0
  90. package/dist/csv.js +6 -0
  91. package/dist/cue.js +6 -0
  92. package/dist/cypher.js +6 -0
  93. package/dist/cytoscape-cose-bilkent.js +2380 -0
  94. package/dist/cytoscape-fcose.js +3840 -0
  95. package/dist/d.js +6 -0
  96. package/dist/dagre-6UL2VRFP.js +44 -44
  97. package/dist/dagre-6UL2VRFP2.js +447 -0
  98. package/dist/dark-plus.js +4 -0
  99. package/dist/dart.js +6 -0
  100. package/dist/dax.js +6 -0
  101. package/dist/dayjs.min.js +2 -2
  102. package/dist/defaultLocale.js +3 -3
  103. package/dist/desktop.js +6 -0
  104. package/dist/diagram-PSM6KHXK.js +198 -414
  105. package/dist/diagram-PSM6KHXK2.js +319 -0
  106. package/dist/diagram-QEK2KX5R.js +26 -26
  107. package/dist/diagram-QEK2KX5R2.js +221 -0
  108. package/dist/diagram-S2PKOQOG.js +12 -12
  109. package/dist/diagram-S2PKOQOG2.js +143 -0
  110. package/dist/diff.js +6 -0
  111. package/dist/docker.js +6 -0
  112. package/dist/dotenv.js +6 -0
  113. package/dist/dracula-soft.js +4 -0
  114. package/dist/dracula.js +4 -0
  115. package/dist/dream-maker.js +6 -0
  116. package/dist/edge.js +12 -0
  117. package/dist/elixir.js +8 -0
  118. package/dist/elm.js +8 -0
  119. package/dist/emacs-lisp.js +6 -0
  120. package/dist/erDiagram-Q2GNP2WA.js +1 -1
  121. package/dist/erDiagram-Q2GNP2WA2.js +843 -0
  122. package/dist/erb.js +10 -0
  123. package/dist/erlang.js +8 -0
  124. package/dist/everforest-dark.js +4 -0
  125. package/dist/everforest-light.js +4 -0
  126. package/dist/fennel.js +6 -0
  127. package/dist/fish.js +6 -0
  128. package/dist/flowDiagram-NV44I4VS.js +6 -6
  129. package/dist/flowDiagram-NV44I4VS2.js +1628 -0
  130. package/dist/fluent.js +6 -0
  131. package/dist/fortran-fixed-form.js +8 -0
  132. package/dist/fortran-free-form.js +6 -0
  133. package/dist/fsharp.js +8 -0
  134. package/dist/ganttDiagram-JELNMOA3.js +1788 -0
  135. package/dist/ganttDiagram-LVOFAZNH.js +843 -1718
  136. package/dist/gdresource.js +10 -0
  137. package/dist/gdscript.js +6 -0
  138. package/dist/gdshader.js +6 -0
  139. package/dist/genie.js +6 -0
  140. package/dist/gherkin.js +6 -0
  141. package/dist/git-commit.js +8 -0
  142. package/dist/git-rebase.js +8 -0
  143. package/dist/gitGraphDiagram-NY62KEGX.js +13 -13
  144. package/dist/gitGraphDiagram-NY62KEGX2.js +713 -0
  145. package/dist/github-dark-default.js +4 -0
  146. package/dist/github-dark-dimmed.js +4 -0
  147. package/dist/github-dark-high-contrast.js +4 -0
  148. package/dist/github-dark.js +4 -0
  149. package/dist/github-light-default.js +4 -0
  150. package/dist/github-light-high-contrast.js +4 -0
  151. package/dist/github-light.js +4 -0
  152. package/dist/gleam.js +6 -0
  153. package/dist/glimmer-js.js +14 -0
  154. package/dist/glimmer-ts.js +14 -0
  155. package/dist/glsl.js +8 -0
  156. package/dist/gn.js +6 -0
  157. package/dist/gnuplot.js +6 -0
  158. package/dist/go.js +6 -0
  159. package/dist/graph.js +17 -18
  160. package/dist/graph2.js +246 -0
  161. package/dist/graphql.js +14 -0
  162. package/dist/groovy.js +6 -0
  163. package/dist/gruvbox-dark-hard.js +4 -0
  164. package/dist/gruvbox-dark-medium.js +4 -0
  165. package/dist/gruvbox-dark-soft.js +4 -0
  166. package/dist/gruvbox-light-hard.js +4 -0
  167. package/dist/gruvbox-light-medium.js +4 -0
  168. package/dist/gruvbox-light-soft.js +4 -0
  169. package/dist/hack.js +10 -0
  170. package/dist/haml.js +10 -0
  171. package/dist/handlebars.js +14 -0
  172. package/dist/haskell.js +6 -0
  173. package/dist/haxe.js +6 -0
  174. package/dist/hcl.js +6 -0
  175. package/dist/hjson.js +6 -0
  176. package/dist/hlsl.js +6 -0
  177. package/dist/houston.js +4 -0
  178. package/dist/html-derivative.js +8 -0
  179. package/dist/html.js +10 -0
  180. package/dist/http.js +14 -0
  181. package/dist/hurl.js +12 -0
  182. package/dist/hxml.js +8 -0
  183. package/dist/hy.js +6 -0
  184. package/dist/imba.js +6 -0
  185. package/dist/index.d.ts +2 -2
  186. package/dist/index.js +37 -37
  187. package/dist/index2.js +216 -684
  188. package/dist/index3.js +689 -0
  189. package/dist/infoDiagram-F6ZHWCRC.js +14 -14
  190. package/dist/infoDiagram-WHAUD3N6.js +24 -0
  191. package/dist/ini.js +6 -0
  192. package/dist/java.js +6 -0
  193. package/dist/javascript.js +6 -0
  194. package/dist/jinja.js +11 -0
  195. package/dist/jison.js +8 -0
  196. package/dist/journeyDiagram-XKPGCS4Q.js +1 -1
  197. package/dist/journeyDiagram-XKPGCS4Q2.js +837 -0
  198. package/dist/json.js +6 -0
  199. package/dist/json5.js +6 -0
  200. package/dist/jsonc.js +6 -0
  201. package/dist/jsonl.js +6 -0
  202. package/dist/jsonnet.js +6 -0
  203. package/dist/jssm.js +6 -0
  204. package/dist/jsx.js +6 -0
  205. package/dist/julia.js +16 -0
  206. package/dist/kanagawa-dragon.js +4 -0
  207. package/dist/kanagawa-lotus.js +4 -0
  208. package/dist/kanagawa-wave.js +4 -0
  209. package/dist/kanban-definition-3W4ZIXB7.js +42 -42
  210. package/dist/kanban-definition-3W4ZIXB72.js +720 -0
  211. package/dist/katex2.js +11691 -0
  212. package/dist/kdl.js +6 -0
  213. package/dist/kotlin.js +6 -0
  214. package/dist/kusto.js +6 -0
  215. package/dist/laserwave.js +4 -0
  216. package/dist/latex.js +8 -0
  217. package/dist/layout.js +567 -678
  218. package/dist/layout2.js +1224 -0
  219. package/dist/lean.js +6 -0
  220. package/dist/less.js +6 -0
  221. package/dist/light-plus.js +4 -0
  222. package/dist/lineage/index.js +1234 -1241
  223. package/dist/linear.js +1 -1
  224. package/dist/liquid.js +14 -0
  225. package/dist/llvm.js +6 -0
  226. package/dist/log.js +6 -0
  227. package/dist/logo.js +6 -0
  228. package/dist/lua.js +8 -0
  229. package/dist/luau.js +6 -0
  230. package/dist/main.css +1 -1
  231. package/dist/main.js +82 -82
  232. package/dist/make.js +6 -0
  233. package/dist/markdown.js +6 -0
  234. package/dist/marko.js +14 -0
  235. package/dist/material-theme-darker.js +4 -0
  236. package/dist/material-theme-lighter.js +4 -0
  237. package/dist/material-theme-ocean.js +4 -0
  238. package/dist/material-theme-palenight.js +4 -0
  239. package/dist/material-theme.js +4 -0
  240. package/dist/matlab.js +6 -0
  241. package/dist/mdc.js +12 -0
  242. package/dist/mdx.js +6 -0
  243. package/dist/mermaid-4DMBBIKO.js +4 -0
  244. package/dist/mermaid-parser.core.js +155 -155
  245. package/dist/mermaid.js +6 -0
  246. package/dist/min-dark.js +4 -0
  247. package/dist/min-light.js +4 -0
  248. package/dist/mindmap-definition-VGOIOE7T.js +28 -28
  249. package/dist/mindmap-definition-VGOIOE7T2.js +786 -0
  250. package/dist/mipsasm.js +6 -0
  251. package/dist/mojo.js +6 -0
  252. package/dist/monokai.js +4 -0
  253. package/dist/moonbit.js +6 -0
  254. package/dist/move.js +6 -0
  255. package/dist/narrat.js +6 -0
  256. package/dist/nextflow.js +6 -0
  257. package/dist/nginx.js +8 -0
  258. package/dist/night-owl.js +4 -0
  259. package/dist/nim.js +20 -0
  260. package/dist/nix.js +9 -0
  261. package/dist/nord.js +4 -0
  262. package/dist/nushell.js +6 -0
  263. package/dist/objective-c.js +6 -0
  264. package/dist/objective-cpp.js +6 -0
  265. package/dist/ocaml.js +6 -0
  266. package/dist/one-dark-pro.js +4 -0
  267. package/dist/one-light.js +4 -0
  268. package/dist/openscad.js +6 -0
  269. package/dist/pascal.js +6 -0
  270. package/dist/perl.js +16 -0
  271. package/dist/php.js +18 -0
  272. package/dist/pie.js +45 -0
  273. package/dist/pieDiagram-ADFJNKIX.js +68 -108
  274. package/dist/pieDiagram-ADFJNKIX2.js +123 -0
  275. package/dist/pkl.js +6 -0
  276. package/dist/plastic.js +4 -0
  277. package/dist/plsql.js +6 -0
  278. package/dist/po.js +6 -0
  279. package/dist/poimandres.js +4 -0
  280. package/dist/polar.js +6 -0
  281. package/dist/postcss.js +6 -0
  282. package/dist/powerquery.js +6 -0
  283. package/dist/powershell.js +6 -0
  284. package/dist/prisma.js +6 -0
  285. package/dist/prolog.js +6 -0
  286. package/dist/proto.js +6 -0
  287. package/dist/pug.js +12 -0
  288. package/dist/puppet.js +6 -0
  289. package/dist/purescript.js +6 -0
  290. package/dist/python.js +6 -0
  291. package/dist/qml.js +8 -0
  292. package/dist/qmldir.js +6 -0
  293. package/dist/qss.js +6 -0
  294. package/dist/quadrantDiagram-AYHSOK5B.js +1 -1
  295. package/dist/quadrantDiagram-AYHSOK5B2.js +1025 -0
  296. package/dist/r.js +6 -0
  297. package/dist/racket.js +6 -0
  298. package/dist/raku.js +6 -0
  299. package/dist/razor.js +10 -0
  300. package/dist/red.js +4 -0
  301. package/dist/redux-toolkit.modern.js +563 -555
  302. package/dist/reg.js +6 -0
  303. package/dist/regexp.js +6 -0
  304. package/dist/rel.js +6 -0
  305. package/dist/requirementDiagram-UZGBJVZJ.js +14 -14
  306. package/dist/requirementDiagram-UZGBJVZJ2.js +852 -0
  307. package/dist/riscv.js +6 -0
  308. package/dist/rose-pine-dawn.js +4 -0
  309. package/dist/rose-pine-moon.js +4 -0
  310. package/dist/rose-pine.js +4 -0
  311. package/dist/rosmsg.js +6 -0
  312. package/dist/rst.js +22 -0
  313. package/dist/ruby.js +30 -0
  314. package/dist/rust.js +6 -0
  315. package/dist/sankeyDiagram-TZEHDZUN.js +229 -622
  316. package/dist/sankeyDiagram-TZEHDZUN2.js +418 -0
  317. package/dist/sankeyLinkHorizontal.js +403 -0
  318. package/dist/sas.js +8 -0
  319. package/dist/sass.js +6 -0
  320. package/dist/scala.js +6 -0
  321. package/dist/scheme.js +6 -0
  322. package/dist/scss.js +8 -0
  323. package/dist/sdbl.js +6 -0
  324. package/dist/sequenceDiagram-WL72ISMW.js +1 -1
  325. package/dist/sequenceDiagram-WL72ISMW2.js +2523 -0
  326. package/dist/shadcn/index.d.ts +24 -40
  327. package/dist/shadcn/index.js +7330 -5516
  328. package/dist/shaderlab.js +8 -0
  329. package/dist/shellscript.js +6 -0
  330. package/dist/shellsession.js +8 -0
  331. package/dist/slack-dark.js +4 -0
  332. package/dist/slack-ochin.js +4 -0
  333. package/dist/smalltalk.js +6 -0
  334. package/dist/snazzy-light.js +4 -0
  335. package/dist/solarized-dark.js +4 -0
  336. package/dist/solarized-light.js +4 -0
  337. package/dist/solidity.js +6 -0
  338. package/dist/soy.js +8 -0
  339. package/dist/sparql.js +8 -0
  340. package/dist/splunk.js +6 -0
  341. package/dist/sql.js +6 -0
  342. package/dist/ssh-config.js +6 -0
  343. package/dist/stata.js +8 -0
  344. package/dist/stateDiagram-FKZM4ZOC.js +33 -33
  345. package/dist/stateDiagram-FKZM4ZOC2.js +264 -0
  346. package/dist/stateDiagram-v2-4FDKWEC3.js +6 -6
  347. package/dist/stateDiagram-v2-4FDKWEC32.js +17 -0
  348. package/dist/storybook/Typography.stories.tsx +93 -120
  349. package/dist/stylus.js +6 -0
  350. package/dist/svelte.js +14 -0
  351. package/dist/swift.js +6 -0
  352. package/dist/synthwave-84.js +4 -0
  353. package/dist/system-verilog.js +6 -0
  354. package/dist/systemd.js +6 -0
  355. package/dist/talonscript.js +6 -0
  356. package/dist/tasl.js +6 -0
  357. package/dist/tcl.js +6 -0
  358. package/dist/templ.js +12 -0
  359. package/dist/terraform.js +6 -0
  360. package/dist/tex.js +8 -0
  361. package/dist/time.js +900 -0
  362. package/dist/timeline-definition-IT6M3QCI.js +63 -63
  363. package/dist/timeline-definition-IT6M3QCI2.js +802 -0
  364. package/dist/tokyo-night.js +4 -0
  365. package/dist/toml.js +6 -0
  366. package/dist/ts-tags.js +41 -0
  367. package/dist/tsv.js +6 -0
  368. package/dist/tsx.js +6 -0
  369. package/dist/turtle.js +6 -0
  370. package/dist/twig.js +18 -0
  371. package/dist/{types-ByRPUpXR.d.ts → types-BZH4Xw79.d.ts} +1 -1
  372. package/dist/typescript.js +6 -0
  373. package/dist/typespec.js +6 -0
  374. package/dist/typst.js +6 -0
  375. package/dist/union.js +8 -0
  376. package/dist/v.js +6 -0
  377. package/dist/vala.js +6 -0
  378. package/dist/vb.js +6 -0
  379. package/dist/verilog.js +6 -0
  380. package/dist/vesper.js +4 -0
  381. package/dist/vhdl.js +6 -0
  382. package/dist/viml.js +6 -0
  383. package/dist/vitesse-black.js +4 -0
  384. package/dist/vitesse-dark.js +4 -0
  385. package/dist/vitesse-light.js +4 -0
  386. package/dist/vue-html.js +8 -0
  387. package/dist/vue-vine.js +18 -0
  388. package/dist/vue.js +31 -0
  389. package/dist/vyper.js +6 -0
  390. package/dist/wasm.js +6 -0
  391. package/dist/wasm2.js +7 -0
  392. package/dist/wenyan.js +6 -0
  393. package/dist/wgsl.js +6 -0
  394. package/dist/wikitext.js +6 -0
  395. package/dist/wit.js +6 -0
  396. package/dist/wolfram.js +6 -0
  397. package/dist/xml.js +8 -0
  398. package/dist/xsl.js +8 -0
  399. package/dist/xychartDiagram-PRI3JC2R.js +449 -491
  400. package/dist/xychartDiagram-PRI3JC2R2.js +1299 -0
  401. package/dist/yaml.js +6 -0
  402. package/dist/zenscript.js +6 -0
  403. package/dist/zig.js +6 -0
  404. package/dist/zipObject.js +128 -0
  405. package/package.json +1 -1
@@ -0,0 +1,831 @@
1
+ import { b6 as ft, aI as ht, aJ as gt, aV as ut, aW as pt, aK as mt, aL as yt, aG as g, b0 as wt, b7 as kt, b8 as xt, bz as bt, bA as vt, aS as K, bb as Et, bo as $t, a_ as St, bu as _, aM as J, bB as G, aR as At } from "./CoachForm.js";
2
+ import { p as Dt } from "./chunk-4BX2VUAB2.js";
3
+ import { p as Tt } from "./mermaid-parser.core.js";
4
+ import { c as Q } from "./cytoscape.esm.js";
5
+ import { f as Bt } from "./cytoscape-fcose.js";
6
+ import { s as Ct } from "./redux-toolkit.modern.js";
7
+ var W = {
8
+ L: "left",
9
+ R: "right",
10
+ T: "top",
11
+ B: "bottom"
12
+ }, H = {
13
+ L: /* @__PURE__ */ g((e) => `${e},${e / 2} 0,${e} 0,0`, "L"),
14
+ R: /* @__PURE__ */ g((e) => `0,${e / 2} ${e},0 ${e},${e}`, "R"),
15
+ T: /* @__PURE__ */ g((e) => `0,0 ${e},0 ${e / 2},${e}`, "T"),
16
+ B: /* @__PURE__ */ g((e) => `${e / 2},0 ${e},${e} 0,${e}`, "B")
17
+ }, X = {
18
+ L: /* @__PURE__ */ g((e, t) => e - t + 2, "L"),
19
+ R: /* @__PURE__ */ g((e, t) => e - 2, "R"),
20
+ T: /* @__PURE__ */ g((e, t) => e - t + 2, "T"),
21
+ B: /* @__PURE__ */ g((e, t) => e - 2, "B")
22
+ }, Lt = /* @__PURE__ */ g(function(e) {
23
+ return A(e) ? e === "L" ? "R" : "L" : e === "T" ? "B" : "T";
24
+ }, "getOppositeArchitectureDirection"), U = /* @__PURE__ */ g(function(e) {
25
+ const t = e;
26
+ return t === "L" || t === "R" || t === "T" || t === "B";
27
+ }, "isArchitectureDirection"), A = /* @__PURE__ */ g(function(e) {
28
+ const t = e;
29
+ return t === "L" || t === "R";
30
+ }, "isArchitectureDirectionX"), z = /* @__PURE__ */ g(function(e) {
31
+ const t = e;
32
+ return t === "T" || t === "B";
33
+ }, "isArchitectureDirectionY"), Z = /* @__PURE__ */ g(function(e, t) {
34
+ const i = A(e) && z(t), o = z(e) && A(t);
35
+ return i || o;
36
+ }, "isArchitectureDirectionXY"), zt = /* @__PURE__ */ g(function(e) {
37
+ const t = e[0], i = e[1], o = A(t) && z(i), r = z(t) && A(i);
38
+ return o || r;
39
+ }, "isArchitecturePairXY"), jt = /* @__PURE__ */ g(function(e) {
40
+ return e !== "LL" && e !== "RR" && e !== "TT" && e !== "BB";
41
+ }, "isValidArchitectureDirectionPair"), N = /* @__PURE__ */ g(function(e, t) {
42
+ const i = `${e}${t}`;
43
+ return jt(i) ? i : void 0;
44
+ }, "getArchitectureDirectionPair"), It = /* @__PURE__ */ g(function([e, t], i) {
45
+ const o = i[0], r = i[1];
46
+ return A(o) ? z(r) ? [e + (o === "L" ? -1 : 1), t + (r === "T" ? 1 : -1)] : [e + (o === "L" ? -1 : 1), t] : A(r) ? [e + (r === "L" ? 1 : -1), t + (o === "T" ? 1 : -1)] : [e, t + (o === "T" ? 1 : -1)];
47
+ }, "shiftPositionByArchitectureDirectionPair"), Ft = /* @__PURE__ */ g(function(e) {
48
+ return e === "LT" || e === "TL" ? [1, 1] : e === "BL" || e === "LB" ? [1, -1] : e === "BR" || e === "RB" ? [-1, -1] : [-1, 1];
49
+ }, "getArchitectureDirectionXYFactors"), Pt = /* @__PURE__ */ g(function(e, t) {
50
+ return Z(e, t) ? "bend" : A(e) ? "horizontal" : "vertical";
51
+ }, "getArchitectureDirectionAlignment"), Rt = /* @__PURE__ */ g(function(e) {
52
+ return e.type === "service";
53
+ }, "isArchitectureService"), Xt = /* @__PURE__ */ g(function(e) {
54
+ return e.type === "junction";
55
+ }, "isArchitectureJunction"), tt = /* @__PURE__ */ g((e) => e.data(), "edgeData"), F = /* @__PURE__ */ g((e) => e.data(), "nodeData"), Yt = ft.architecture, P, et = (P = class {
56
+ constructor() {
57
+ this.nodes = {}, this.groups = {}, this.edges = [], this.registeredIds = {}, this.elements = {}, this.setAccTitle = ht, this.getAccTitle = gt, this.setDiagramTitle = ut, this.getDiagramTitle = pt, this.getAccDescription = mt, this.setAccDescription = yt, this.clear();
58
+ }
59
+ clear() {
60
+ this.nodes = {}, this.groups = {}, this.edges = [], this.registeredIds = {}, this.dataStructures = void 0, this.elements = {}, wt();
61
+ }
62
+ addService({
63
+ id: t,
64
+ icon: i,
65
+ in: o,
66
+ title: r,
67
+ iconText: c
68
+ }) {
69
+ if (this.registeredIds[t] !== void 0)
70
+ throw new Error(
71
+ `The service id [${t}] is already in use by another ${this.registeredIds[t]}`
72
+ );
73
+ if (o !== void 0) {
74
+ if (t === o)
75
+ throw new Error(`The service [${t}] cannot be placed within itself`);
76
+ if (this.registeredIds[o] === void 0)
77
+ throw new Error(
78
+ `The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`
79
+ );
80
+ if (this.registeredIds[o] === "node")
81
+ throw new Error(`The service [${t}]'s parent is not a group`);
82
+ }
83
+ this.registeredIds[t] = "node", this.nodes[t] = {
84
+ id: t,
85
+ type: "service",
86
+ icon: i,
87
+ iconText: c,
88
+ title: r,
89
+ edges: [],
90
+ in: o
91
+ };
92
+ }
93
+ getServices() {
94
+ return Object.values(this.nodes).filter(Rt);
95
+ }
96
+ addJunction({ id: t, in: i }) {
97
+ this.registeredIds[t] = "node", this.nodes[t] = {
98
+ id: t,
99
+ type: "junction",
100
+ edges: [],
101
+ in: i
102
+ };
103
+ }
104
+ getJunctions() {
105
+ return Object.values(this.nodes).filter(Xt);
106
+ }
107
+ getNodes() {
108
+ return Object.values(this.nodes);
109
+ }
110
+ getNode(t) {
111
+ return this.nodes[t] ?? null;
112
+ }
113
+ addGroup({ id: t, icon: i, in: o, title: r }) {
114
+ var c, l, u;
115
+ if (((c = this.registeredIds) == null ? void 0 : c[t]) !== void 0)
116
+ throw new Error(
117
+ `The group id [${t}] is already in use by another ${this.registeredIds[t]}`
118
+ );
119
+ if (o !== void 0) {
120
+ if (t === o)
121
+ throw new Error(`The group [${t}] cannot be placed within itself`);
122
+ if (((l = this.registeredIds) == null ? void 0 : l[o]) === void 0)
123
+ throw new Error(
124
+ `The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`
125
+ );
126
+ if (((u = this.registeredIds) == null ? void 0 : u[o]) === "node")
127
+ throw new Error(`The group [${t}]'s parent is not a group`);
128
+ }
129
+ this.registeredIds[t] = "group", this.groups[t] = {
130
+ id: t,
131
+ icon: i,
132
+ title: r,
133
+ in: o
134
+ };
135
+ }
136
+ getGroups() {
137
+ return Object.values(this.groups);
138
+ }
139
+ addEdge({
140
+ lhsId: t,
141
+ rhsId: i,
142
+ lhsDir: o,
143
+ rhsDir: r,
144
+ lhsInto: c,
145
+ rhsInto: l,
146
+ lhsGroup: u,
147
+ rhsGroup: d,
148
+ title: n
149
+ }) {
150
+ if (!U(o))
151
+ throw new Error(
152
+ `Invalid direction given for left hand side of edge ${t}--${i}. Expected (L,R,T,B) got ${String(o)}`
153
+ );
154
+ if (!U(r))
155
+ throw new Error(
156
+ `Invalid direction given for right hand side of edge ${t}--${i}. Expected (L,R,T,B) got ${String(r)}`
157
+ );
158
+ if (this.nodes[t] === void 0 && this.groups[t] === void 0)
159
+ throw new Error(
160
+ `The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`
161
+ );
162
+ if (this.nodes[i] === void 0 && this.groups[i] === void 0)
163
+ throw new Error(
164
+ `The right-hand id [${i}] does not yet exist. Please create the service/group before declaring an edge to it.`
165
+ );
166
+ const s = this.nodes[t].in, p = this.nodes[i].in;
167
+ if (u && s && p && s == p)
168
+ throw new Error(
169
+ `The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`
170
+ );
171
+ if (d && s && p && s == p)
172
+ throw new Error(
173
+ `The right-hand id [${i}] is modified to traverse the group boundary, but the edge does not pass through two groups.`
174
+ );
175
+ const f = {
176
+ lhsId: t,
177
+ lhsDir: o,
178
+ lhsInto: c,
179
+ lhsGroup: u,
180
+ rhsId: i,
181
+ rhsDir: r,
182
+ rhsInto: l,
183
+ rhsGroup: d,
184
+ title: n
185
+ };
186
+ this.edges.push(f), this.nodes[t] && this.nodes[i] && (this.nodes[t].edges.push(this.edges[this.edges.length - 1]), this.nodes[i].edges.push(this.edges[this.edges.length - 1]));
187
+ }
188
+ getEdges() {
189
+ return this.edges;
190
+ }
191
+ /**
192
+ * Returns the current diagram's adjacency list, spatial map, & group alignments.
193
+ * If they have not been created, run the algorithms to generate them.
194
+ * @returns
195
+ */
196
+ getDataStructures() {
197
+ if (this.dataStructures === void 0) {
198
+ const t = {}, i = Object.entries(this.nodes).reduce((d, [n, s]) => (d[n] = s.edges.reduce((p, f) => {
199
+ var m, y;
200
+ const a = (m = this.getNode(f.lhsId)) == null ? void 0 : m.in, h = (y = this.getNode(f.rhsId)) == null ? void 0 : y.in;
201
+ if (a && h && a !== h) {
202
+ const w = Pt(f.lhsDir, f.rhsDir);
203
+ w !== "bend" && (t[a] ?? (t[a] = {}), t[a][h] = w, t[h] ?? (t[h] = {}), t[h][a] = w);
204
+ }
205
+ if (f.lhsId === n) {
206
+ const w = N(f.lhsDir, f.rhsDir);
207
+ w && (p[w] = f.rhsId);
208
+ } else {
209
+ const w = N(f.rhsDir, f.lhsDir);
210
+ w && (p[w] = f.lhsId);
211
+ }
212
+ return p;
213
+ }, {}), d), {}), o = Object.keys(i)[0], r = { [o]: 1 }, c = Object.keys(i).reduce(
214
+ (d, n) => n === o ? d : { ...d, [n]: 1 },
215
+ {}
216
+ ), l = /* @__PURE__ */ g((d) => {
217
+ const n = { [d]: [0, 0] }, s = [d];
218
+ for (; s.length > 0; ) {
219
+ const p = s.shift();
220
+ if (p) {
221
+ r[p] = 1, delete c[p];
222
+ const f = i[p], [a, h] = n[p];
223
+ Object.entries(f).forEach(([m, y]) => {
224
+ r[y] || (n[y] = It(
225
+ [a, h],
226
+ m
227
+ ), s.push(y));
228
+ });
229
+ }
230
+ }
231
+ return n;
232
+ }, "BFS"), u = [l(o)];
233
+ for (; Object.keys(c).length > 0; )
234
+ u.push(l(Object.keys(c)[0]));
235
+ this.dataStructures = {
236
+ adjList: i,
237
+ spatialMaps: u,
238
+ groupAlignments: t
239
+ };
240
+ }
241
+ return this.dataStructures;
242
+ }
243
+ setElementForId(t, i) {
244
+ this.elements[t] = i;
245
+ }
246
+ getElementById(t) {
247
+ return this.elements[t];
248
+ }
249
+ getConfig() {
250
+ return kt({
251
+ ...Yt,
252
+ ...xt().architecture
253
+ });
254
+ }
255
+ getConfigField(t) {
256
+ return this.getConfig()[t];
257
+ }
258
+ }, g(P, "ArchitectureDB"), P), Ot = /* @__PURE__ */ g((e, t) => {
259
+ Dt(e, t), e.groups.map((i) => t.addGroup(i)), e.services.map((i) => t.addService({ ...i, type: "service" })), e.junctions.map((i) => t.addJunction({ ...i, type: "junction" })), e.edges.map((i) => t.addEdge(i));
260
+ }, "populateDb"), it = {
261
+ parser: {
262
+ // @ts-expect-error - ArchitectureDB is not assignable to DiagramDB
263
+ yy: void 0
264
+ },
265
+ parse: /* @__PURE__ */ g(async (e) => {
266
+ var o;
267
+ const t = await Tt("architecture", e);
268
+ K.debug(t);
269
+ const i = (o = it.parser) == null ? void 0 : o.yy;
270
+ if (!(i instanceof et))
271
+ throw new Error(
272
+ "parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
273
+ );
274
+ Ot(t, i);
275
+ }, "parse")
276
+ }, Mt = /* @__PURE__ */ g((e) => `
277
+ .edge {
278
+ stroke-width: ${e.archEdgeWidth};
279
+ stroke: ${e.archEdgeColor};
280
+ fill: none;
281
+ }
282
+
283
+ .arrow {
284
+ fill: ${e.archEdgeArrowColor};
285
+ }
286
+
287
+ .node-bkg {
288
+ fill: none;
289
+ stroke: ${e.archGroupBorderColor};
290
+ stroke-width: ${e.archGroupBorderWidth};
291
+ stroke-dasharray: 8;
292
+ }
293
+ .node-icon-text {
294
+ display: flex;
295
+ align-items: center;
296
+ }
297
+
298
+ .node-icon-text > div {
299
+ color: #fff;
300
+ margin: 1px;
301
+ height: fit-content;
302
+ text-align: center;
303
+ overflow: hidden;
304
+ display: -webkit-box;
305
+ -webkit-box-orient: vertical;
306
+ }
307
+ `, "getStyles"), Gt = Mt, I = /* @__PURE__ */ g((e) => `<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${e}</g>`, "wrapIcon"), R = {
308
+ prefix: "mermaid-architecture",
309
+ height: 80,
310
+ width: 80,
311
+ icons: {
312
+ database: {
313
+ body: I(
314
+ '<path id="b" data-name="4" d="m20,57.86c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="c" data-name="3" d="m20,45.95c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="d" data-name="2" d="m20,34.05c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse id="e" data-name="1" cx="40" cy="22.14" rx="20" ry="7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="20" y1="57.86" x2="20" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="60" y1="57.86" x2="60" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>'
315
+ )
316
+ },
317
+ server: {
318
+ body: I(
319
+ '<rect x="17.5" y="17.5" width="45" height="45" rx="2" ry="2" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="32.5" x2="62.5" y2="32.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="47.5" x2="62.5" y2="47.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><g><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g>'
320
+ )
321
+ },
322
+ disk: {
323
+ body: I(
324
+ '<rect x="20" y="15" width="40" height="50" rx="1" ry="1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="14" ry="14.58" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="4" ry="4.17" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m37.51,42.52l-4.83,13.22c-.26.71-1.1,1.02-1.76.64l-4.18-2.42c-.66-.38-.81-1.26-.33-1.84l9.01-10.8c.88-1.05,2.56-.08,2.09,1.2Z" style="fill: #fff; stroke-width: 0px;"/>'
325
+ )
326
+ },
327
+ internet: {
328
+ body: I(
329
+ '<circle cx="40" cy="40" r="22.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="40" y1="17.5" x2="40" y2="62.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="40" x2="62.5" y2="40" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m39.99,17.51c-15.28,11.1-15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m40.01,17.51c15.28,11.1,15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="30.1" x2="60.25" y2="30.1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="49.9" x2="60.25" y2="49.9" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>'
330
+ )
331
+ },
332
+ cloud: {
333
+ body: I(
334
+ '<path d="m65,47.5c0,2.76-2.24,5-5,5H20c-2.76,0-5-2.24-5-5,0-1.87,1.03-3.51,2.56-4.36-.04-.21-.06-.42-.06-.64,0-2.6,2.48-4.74,5.65-4.97,1.65-4.51,6.34-7.76,11.85-7.76.86,0,1.69.08,2.5.23,2.09-1.57,4.69-2.5,7.5-2.5,6.1,0,11.19,4.38,12.28,10.17,2.14.56,3.72,2.51,3.72,4.83,0,.03,0,.07-.01.1,2.29.46,4.01,2.48,4.01,4.9Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>'
335
+ )
336
+ },
337
+ unknown: bt,
338
+ blank: {
339
+ body: I("")
340
+ }
341
+ }
342
+ }, Nt = /* @__PURE__ */ g(async function(e, t, i) {
343
+ const o = i.getConfigField("padding"), r = i.getConfigField("iconSize"), c = r / 2, l = r / 6, u = l / 2;
344
+ await Promise.all(
345
+ t.edges().map(async (d) => {
346
+ var j, D;
347
+ const {
348
+ source: n,
349
+ sourceDir: s,
350
+ sourceArrow: p,
351
+ sourceGroup: f,
352
+ target: a,
353
+ targetDir: h,
354
+ targetArrow: m,
355
+ targetGroup: y,
356
+ label: w
357
+ } = tt(d);
358
+ let { x: k, y: v } = d[0].sourceEndpoint();
359
+ const { x: E, y: b } = d[0].midpoint();
360
+ let { x, y: $ } = d[0].targetEndpoint();
361
+ const S = o + 4;
362
+ if (f && (A(s) ? k += s === "L" ? -S : S : v += s === "T" ? -S : S + 18), y && (A(h) ? x += h === "L" ? -S : S : $ += h === "T" ? -S : S + 18), !f && ((j = i.getNode(n)) == null ? void 0 : j.type) === "junction" && (A(s) ? k += s === "L" ? c : -c : v += s === "T" ? c : -c), !y && ((D = i.getNode(a)) == null ? void 0 : D.type) === "junction" && (A(h) ? x += h === "L" ? c : -c : $ += h === "T" ? c : -c), d[0]._private.rscratch) {
363
+ const T = e.insert("g");
364
+ if (T.insert("path").attr("d", `M ${k},${v} L ${E},${b} L${x},${$} `).attr("class", "edge").attr("id", St(n, a, { prefix: "L" })), p) {
365
+ const B = A(s) ? X[s](k, l) : k - u, C = z(s) ? X[s](v, l) : v - u;
366
+ T.insert("polygon").attr("points", H[s](l)).attr("transform", `translate(${B},${C})`).attr("class", "arrow");
367
+ }
368
+ if (m) {
369
+ const B = A(h) ? X[h](x, l) : x - u, C = z(h) ? X[h]($, l) : $ - u;
370
+ T.insert("polygon").attr("points", H[h](l)).attr("transform", `translate(${B},${C})`).attr("class", "arrow");
371
+ }
372
+ if (w) {
373
+ const B = Z(s, h) ? "XY" : A(s) ? "X" : "Y";
374
+ let C = 0;
375
+ B === "X" ? C = Math.abs(k - x) : B === "Y" ? C = Math.abs(v - $) / 1.5 : C = Math.abs(k - x) / 2;
376
+ const L = T.append("g");
377
+ if (await _(
378
+ L,
379
+ w,
380
+ {
381
+ useHtmlLabels: !1,
382
+ width: C,
383
+ classes: "architecture-service-label"
384
+ },
385
+ J()
386
+ ), L.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"), B === "X")
387
+ L.attr("transform", "translate(" + E + ", " + b + ")");
388
+ else if (B === "Y")
389
+ L.attr("transform", "translate(" + E + ", " + b + ") rotate(-90)");
390
+ else if (B === "XY") {
391
+ const Y = N(s, h);
392
+ if (Y && zt(Y)) {
393
+ const q = L.node().getBoundingClientRect(), [O, M] = Ft(Y);
394
+ L.attr("dominant-baseline", "auto").attr("transform", `rotate(${-1 * O * M * 45})`);
395
+ const V = L.node().getBoundingClientRect();
396
+ L.attr(
397
+ "transform",
398
+ `
399
+ translate(${E}, ${b - q.height / 2})
400
+ translate(${O * V.width / 2}, ${M * V.height / 2})
401
+ rotate(${-1 * O * M * 45}, 0, ${q.height / 2})
402
+ `
403
+ );
404
+ }
405
+ }
406
+ }
407
+ }
408
+ })
409
+ );
410
+ }, "drawEdges"), _t = /* @__PURE__ */ g(async function(e, t, i) {
411
+ const r = i.getConfigField("padding") * 0.75, c = i.getConfigField("fontSize"), u = i.getConfigField("iconSize") / 2;
412
+ await Promise.all(
413
+ t.nodes().map(async (d) => {
414
+ const n = F(d);
415
+ if (n.type === "group") {
416
+ const { h: s, w: p, x1: f, y1: a } = d.boundingBox(), h = e.append("rect");
417
+ h.attr("id", `group-${n.id}`).attr("x", f + u).attr("y", a + u).attr("width", p).attr("height", s).attr("class", "node-bkg");
418
+ const m = e.append("g");
419
+ let y = f, w = a;
420
+ if (n.icon) {
421
+ const k = m.append("g");
422
+ k.html(
423
+ `<g>${await G(n.icon, { height: r, width: r, fallbackPrefix: R.prefix })}</g>`
424
+ ), k.attr(
425
+ "transform",
426
+ "translate(" + (y + u + 1) + ", " + (w + u + 1) + ")"
427
+ ), y += r, w += c / 2 - 1 - 2;
428
+ }
429
+ if (n.label) {
430
+ const k = m.append("g");
431
+ await _(
432
+ k,
433
+ n.label,
434
+ {
435
+ useHtmlLabels: !1,
436
+ width: p,
437
+ classes: "architecture-service-label"
438
+ },
439
+ J()
440
+ ), k.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "start").attr("text-anchor", "start"), k.attr(
441
+ "transform",
442
+ "translate(" + (y + u + 4) + ", " + (w + u + 2) + ")"
443
+ );
444
+ }
445
+ i.setElementForId(n.id, h);
446
+ }
447
+ })
448
+ );
449
+ }, "drawGroups"), Jt = /* @__PURE__ */ g(async function(e, t, i) {
450
+ const o = J();
451
+ for (const r of i) {
452
+ const c = t.append("g"), l = e.getConfigField("iconSize");
453
+ if (r.title) {
454
+ const s = c.append("g");
455
+ await _(
456
+ s,
457
+ r.title,
458
+ {
459
+ useHtmlLabels: !1,
460
+ width: l * 1.5,
461
+ classes: "architecture-service-label"
462
+ },
463
+ o
464
+ ), s.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"), s.attr("transform", "translate(" + l / 2 + ", " + l + ")");
465
+ }
466
+ const u = c.append("g");
467
+ if (r.icon)
468
+ u.html(
469
+ `<g>${await G(r.icon, { height: l, width: l, fallbackPrefix: R.prefix })}</g>`
470
+ );
471
+ else if (r.iconText) {
472
+ u.html(
473
+ `<g>${await G("blank", { height: l, width: l, fallbackPrefix: R.prefix })}</g>`
474
+ );
475
+ const f = u.append("g").append("foreignObject").attr("width", l).attr("height", l).append("div").attr("class", "node-icon-text").attr("style", `height: ${l}px;`).append("div").html(At(r.iconText, o)), a = parseInt(
476
+ window.getComputedStyle(f.node(), null).getPropertyValue("font-size").replace(/\D/g, "")
477
+ ) ?? 16;
478
+ f.attr("style", `-webkit-line-clamp: ${Math.floor((l - 2) / a)};`);
479
+ } else
480
+ u.append("path").attr("class", "node-bkg").attr("id", "node-" + r.id).attr(
481
+ "d",
482
+ `M0 ${l} v${-l} q0,-5 5,-5 h${l} q5,0 5,5 v${l} H0 Z`
483
+ );
484
+ c.attr("id", `service-${r.id}`).attr("class", "architecture-service");
485
+ const { width: d, height: n } = c.node().getBBox();
486
+ r.width = d, r.height = n, e.setElementForId(r.id, c);
487
+ }
488
+ return 0;
489
+ }, "drawServices"), Zt = /* @__PURE__ */ g(function(e, t, i) {
490
+ i.forEach((o) => {
491
+ const r = t.append("g"), c = e.getConfigField("iconSize");
492
+ r.append("g").append("rect").attr("id", "node-" + o.id).attr("fill-opacity", "0").attr("width", c).attr("height", c), r.attr("class", "architecture-junction");
493
+ const { width: u, height: d } = r._groups[0][0].getBBox();
494
+ r.width = u, r.height = d, e.setElementForId(o.id, r);
495
+ });
496
+ }, "drawJunctions");
497
+ vt([
498
+ {
499
+ name: R.prefix,
500
+ icons: R
501
+ }
502
+ ]);
503
+ Q.use(Bt);
504
+ function rt(e, t, i) {
505
+ e.forEach((o) => {
506
+ t.add({
507
+ group: "nodes",
508
+ data: {
509
+ type: "service",
510
+ id: o.id,
511
+ icon: o.icon,
512
+ label: o.title,
513
+ parent: o.in,
514
+ width: i.getConfigField("iconSize"),
515
+ height: i.getConfigField("iconSize")
516
+ },
517
+ classes: "node-service"
518
+ });
519
+ });
520
+ }
521
+ g(rt, "addServices");
522
+ function st(e, t, i) {
523
+ e.forEach((o) => {
524
+ t.add({
525
+ group: "nodes",
526
+ data: {
527
+ type: "junction",
528
+ id: o.id,
529
+ parent: o.in,
530
+ width: i.getConfigField("iconSize"),
531
+ height: i.getConfigField("iconSize")
532
+ },
533
+ classes: "node-junction"
534
+ });
535
+ });
536
+ }
537
+ g(st, "addJunctions");
538
+ function ot(e, t) {
539
+ t.nodes().map((i) => {
540
+ const o = F(i);
541
+ if (o.type === "group")
542
+ return;
543
+ o.x = i.position().x, o.y = i.position().y, e.getElementById(o.id).attr("transform", "translate(" + (o.x || 0) + "," + (o.y || 0) + ")");
544
+ });
545
+ }
546
+ g(ot, "positionNodes");
547
+ function nt(e, t) {
548
+ e.forEach((i) => {
549
+ t.add({
550
+ group: "nodes",
551
+ data: {
552
+ type: "group",
553
+ id: i.id,
554
+ icon: i.icon,
555
+ label: i.title,
556
+ parent: i.in
557
+ },
558
+ classes: "node-group"
559
+ });
560
+ });
561
+ }
562
+ g(nt, "addGroups");
563
+ function at(e, t) {
564
+ e.forEach((i) => {
565
+ const { lhsId: o, rhsId: r, lhsInto: c, lhsGroup: l, rhsInto: u, lhsDir: d, rhsDir: n, rhsGroup: s, title: p } = i, f = Z(i.lhsDir, i.rhsDir) ? "segments" : "straight", a = {
566
+ id: `${o}-${r}`,
567
+ label: p,
568
+ source: o,
569
+ sourceDir: d,
570
+ sourceArrow: c,
571
+ sourceGroup: l,
572
+ sourceEndpoint: d === "L" ? "0 50%" : d === "R" ? "100% 50%" : d === "T" ? "50% 0" : "50% 100%",
573
+ target: r,
574
+ targetDir: n,
575
+ targetArrow: u,
576
+ targetGroup: s,
577
+ targetEndpoint: n === "L" ? "0 50%" : n === "R" ? "100% 50%" : n === "T" ? "50% 0" : "50% 100%"
578
+ };
579
+ t.add({
580
+ group: "edges",
581
+ data: a,
582
+ classes: f
583
+ });
584
+ });
585
+ }
586
+ g(at, "addEdges");
587
+ function ct(e, t, i) {
588
+ const o = /* @__PURE__ */ g((u, d) => Object.entries(u).reduce(
589
+ (n, [s, p]) => {
590
+ var h;
591
+ let f = 0;
592
+ const a = Object.entries(p);
593
+ if (a.length === 1)
594
+ return n[s] = a[0][1], n;
595
+ for (let m = 0; m < a.length - 1; m++)
596
+ for (let y = m + 1; y < a.length; y++) {
597
+ const [w, k] = a[m], [v, E] = a[y];
598
+ if (((h = i[w]) == null ? void 0 : h[v]) === d)
599
+ n[s] ?? (n[s] = []), n[s] = [...n[s], ...k, ...E];
600
+ else if (w === "default" || v === "default")
601
+ n[s] ?? (n[s] = []), n[s] = [...n[s], ...k, ...E];
602
+ else {
603
+ const x = `${s}-${f++}`;
604
+ n[x] = k;
605
+ const $ = `${s}-${f++}`;
606
+ n[$] = E;
607
+ }
608
+ }
609
+ return n;
610
+ },
611
+ {}
612
+ ), "flattenAlignments"), r = t.map((u) => {
613
+ const d = {}, n = {};
614
+ return Object.entries(u).forEach(([s, [p, f]]) => {
615
+ var h, m, y;
616
+ const a = ((h = e.getNode(s)) == null ? void 0 : h.in) ?? "default";
617
+ d[f] ?? (d[f] = {}), (m = d[f])[a] ?? (m[a] = []), d[f][a].push(s), n[p] ?? (n[p] = {}), (y = n[p])[a] ?? (y[a] = []), n[p][a].push(s);
618
+ }), {
619
+ horiz: Object.values(o(d, "horizontal")).filter(
620
+ (s) => s.length > 1
621
+ ),
622
+ vert: Object.values(o(n, "vertical")).filter(
623
+ (s) => s.length > 1
624
+ )
625
+ };
626
+ }), [c, l] = r.reduce(
627
+ ([u, d], { horiz: n, vert: s }) => [
628
+ [...u, ...n],
629
+ [...d, ...s]
630
+ ],
631
+ [[], []]
632
+ );
633
+ return {
634
+ horizontal: c,
635
+ vertical: l
636
+ };
637
+ }
638
+ g(ct, "getAlignments");
639
+ function lt(e, t) {
640
+ const i = [], o = /* @__PURE__ */ g((c) => `${c[0]},${c[1]}`, "posToStr"), r = /* @__PURE__ */ g((c) => c.split(",").map((l) => parseInt(l)), "strToPos");
641
+ return e.forEach((c) => {
642
+ const l = Object.fromEntries(
643
+ Object.entries(c).map(([s, p]) => [o(p), s])
644
+ ), u = [o([0, 0])], d = {}, n = {
645
+ L: [-1, 0],
646
+ R: [1, 0],
647
+ T: [0, 1],
648
+ B: [0, -1]
649
+ };
650
+ for (; u.length > 0; ) {
651
+ const s = u.shift();
652
+ if (s) {
653
+ d[s] = 1;
654
+ const p = l[s];
655
+ if (p) {
656
+ const f = r(s);
657
+ Object.entries(n).forEach(([a, h]) => {
658
+ const m = o([f[0] + h[0], f[1] + h[1]]), y = l[m];
659
+ y && !d[m] && (u.push(m), i.push({
660
+ [W[a]]: y,
661
+ [W[Lt(a)]]: p,
662
+ gap: 1.5 * t.getConfigField("iconSize")
663
+ }));
664
+ });
665
+ }
666
+ }
667
+ }
668
+ }), i;
669
+ }
670
+ g(lt, "getRelativeConstraints");
671
+ function dt(e, t, i, o, r, { spatialMaps: c, groupAlignments: l }) {
672
+ return new Promise((u) => {
673
+ const d = Ct("body").append("div").attr("id", "cy").attr("style", "display:none"), n = Q({
674
+ container: document.getElementById("cy"),
675
+ style: [
676
+ {
677
+ selector: "edge",
678
+ style: {
679
+ "curve-style": "straight",
680
+ label: "data(label)",
681
+ "source-endpoint": "data(sourceEndpoint)",
682
+ "target-endpoint": "data(targetEndpoint)"
683
+ }
684
+ },
685
+ {
686
+ selector: "edge.segments",
687
+ style: {
688
+ "curve-style": "segments",
689
+ "segment-weights": "0",
690
+ "segment-distances": [0.5],
691
+ // @ts-ignore Incorrect library types
692
+ "edge-distances": "endpoints",
693
+ "source-endpoint": "data(sourceEndpoint)",
694
+ "target-endpoint": "data(targetEndpoint)"
695
+ }
696
+ },
697
+ {
698
+ selector: "node",
699
+ style: {
700
+ // @ts-ignore Incorrect library types
701
+ "compound-sizing-wrt-labels": "include"
702
+ }
703
+ },
704
+ {
705
+ selector: "node[label]",
706
+ style: {
707
+ "text-valign": "bottom",
708
+ "text-halign": "center",
709
+ "font-size": `${r.getConfigField("fontSize")}px`
710
+ }
711
+ },
712
+ {
713
+ selector: ".node-service",
714
+ style: {
715
+ label: "data(label)",
716
+ width: "data(width)",
717
+ height: "data(height)"
718
+ }
719
+ },
720
+ {
721
+ selector: ".node-junction",
722
+ style: {
723
+ width: "data(width)",
724
+ height: "data(height)"
725
+ }
726
+ },
727
+ {
728
+ selector: ".node-group",
729
+ style: {
730
+ // @ts-ignore Incorrect library types
731
+ padding: `${r.getConfigField("padding")}px`
732
+ }
733
+ }
734
+ ],
735
+ layout: {
736
+ name: "grid",
737
+ boundingBox: {
738
+ x1: 0,
739
+ x2: 100,
740
+ y1: 0,
741
+ y2: 100
742
+ }
743
+ }
744
+ });
745
+ d.remove(), nt(i, n), rt(e, n, r), st(t, n, r), at(o, n);
746
+ const s = ct(r, c, l), p = lt(c, r), f = n.layout({
747
+ name: "fcose",
748
+ quality: "proof",
749
+ styleEnabled: !1,
750
+ animate: !1,
751
+ nodeDimensionsIncludeLabels: !1,
752
+ // Adjust the edge parameters if it passes through the border of a group
753
+ // Hacky fix for: https://github.com/iVis-at-Bilkent/cytoscape.js-fcose/issues/67
754
+ idealEdgeLength(a) {
755
+ const [h, m] = a.connectedNodes(), { parent: y } = F(h), { parent: w } = F(m);
756
+ return y === w ? 1.5 * r.getConfigField("iconSize") : 0.5 * r.getConfigField("iconSize");
757
+ },
758
+ edgeElasticity(a) {
759
+ const [h, m] = a.connectedNodes(), { parent: y } = F(h), { parent: w } = F(m);
760
+ return y === w ? 0.45 : 1e-3;
761
+ },
762
+ alignmentConstraint: s,
763
+ relativePlacementConstraint: p
764
+ });
765
+ f.one("layoutstop", () => {
766
+ var h;
767
+ function a(m, y, w, k) {
768
+ let v, E;
769
+ const { x: b, y: x } = m, { x: $, y: S } = y;
770
+ E = (k - x + (b - w) * (x - S) / (b - $)) / Math.sqrt(1 + Math.pow((x - S) / (b - $), 2)), v = Math.sqrt(Math.pow(k - x, 2) + Math.pow(w - b, 2) - Math.pow(E, 2));
771
+ const j = Math.sqrt(Math.pow($ - b, 2) + Math.pow(S - x, 2));
772
+ v = v / j;
773
+ let D = ($ - b) * (k - x) - (S - x) * (w - b);
774
+ switch (!0) {
775
+ case D >= 0:
776
+ D = 1;
777
+ break;
778
+ case D < 0:
779
+ D = -1;
780
+ break;
781
+ }
782
+ let T = ($ - b) * (w - b) + (S - x) * (k - x);
783
+ switch (!0) {
784
+ case T >= 0:
785
+ T = 1;
786
+ break;
787
+ case T < 0:
788
+ T = -1;
789
+ break;
790
+ }
791
+ return E = Math.abs(E) * D, v = v * T, {
792
+ distances: E,
793
+ weights: v
794
+ };
795
+ }
796
+ g(a, "getSegmentWeights"), n.startBatch();
797
+ for (const m of Object.values(n.edges()))
798
+ if ((h = m.data) != null && h.call(m)) {
799
+ const { x: y, y: w } = m.source().position(), { x: k, y: v } = m.target().position();
800
+ if (y !== k && w !== v) {
801
+ const E = m.sourceEndpoint(), b = m.targetEndpoint(), { sourceDir: x } = tt(m), [$, S] = z(x) ? [E.x, b.y] : [b.x, E.y], { weights: j, distances: D } = a(E, b, $, S);
802
+ m.style("segment-distances", D), m.style("segment-weights", j);
803
+ }
804
+ }
805
+ n.endBatch(), f.run();
806
+ }), f.run(), n.ready((a) => {
807
+ K.info("Ready", a), u(n);
808
+ });
809
+ });
810
+ }
811
+ g(dt, "layoutArchitecture");
812
+ var qt = /* @__PURE__ */ g(async (e, t, i, o) => {
813
+ const r = o.db, c = r.getServices(), l = r.getJunctions(), u = r.getGroups(), d = r.getEdges(), n = r.getDataStructures(), s = Et(t), p = s.append("g");
814
+ p.attr("class", "architecture-edges");
815
+ const f = s.append("g");
816
+ f.attr("class", "architecture-services");
817
+ const a = s.append("g");
818
+ a.attr("class", "architecture-groups"), await Jt(r, f, c), Zt(r, f, l);
819
+ const h = await dt(c, l, u, d, r, n);
820
+ await Nt(p, h, r), await _t(a, h, r), ot(r, h), $t(void 0, s, r.getConfigField("padding"), r.getConfigField("useMaxWidth"));
821
+ }, "draw"), Vt = { draw: qt }, ee = {
822
+ parser: it,
823
+ get db() {
824
+ return new et();
825
+ },
826
+ renderer: Vt,
827
+ styles: Gt
828
+ };
829
+ export {
830
+ ee as diagram
831
+ };