ompchamber 1.2.1 → 2.0.1

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 (237) hide show
  1. package/README.md +143 -147
  2. package/dist/client/index.html +4 -2
  3. package/dist/client/static/css/index.5f630421b7.css +2 -0
  4. package/dist/client/static/js/77.0d81c74cf0.js +139 -0
  5. package/dist/client/static/js/async/1k.973e8e21fc.js +2 -0
  6. package/dist/client/static/js/async/{3y.3186ecdd63.js → 3y.3530b824ad.js} +6 -6
  7. package/dist/client/static/js/async/{q.b453193538.js → 4m.928a1dde85.js} +10 -10
  8. package/dist/client/static/js/async/66.5dfa29f957.js +93 -0
  9. package/dist/client/static/js/async/7g.a7814350c3.js +1 -0
  10. package/dist/client/static/js/async/ar.9303e5f2e8.js +2 -0
  11. package/dist/client/static/js/async/{cx.9c8268d542.js → cx.3cb0242a3a.js} +1 -1
  12. package/dist/client/static/js/async/e.93214d622b.js +79 -0
  13. package/dist/client/static/js/async/g.cb81980498.js +2 -0
  14. package/dist/client/static/js/async/h1.393f066d09.js +1 -0
  15. package/dist/client/static/js/async/jl.874d352278.js +1 -0
  16. package/dist/client/static/js/async/{k.d16cd09ae7.js → k.3210286401.js} +1 -1
  17. package/dist/client/static/js/async/{m.2e1ea3db9e.js → m.eb2e6752e2.js} +3 -3
  18. package/dist/client/static/js/async/m.eb2e6752e2.js.LICENSE.txt +11 -0
  19. package/dist/client/static/js/async/mt.0352e976d8.js +1 -0
  20. package/dist/client/static/js/async/{oc.eb22093f05.js → oc.b73042e8bd.js} +1 -1
  21. package/dist/client/static/js/async/{og.53f068804c.js → og.8eb577893a.js} +1 -1
  22. package/dist/client/static/js/async/px.fc6877924b.js +1 -0
  23. package/dist/client/static/js/async/q.22588845a9.js +21 -0
  24. package/dist/client/static/js/async/{q5.88b50ffa95.js → q5.97dc1481b6.js} +1 -1
  25. package/dist/client/static/js/async/s.0f395cdda5.js +94 -0
  26. package/dist/client/static/js/async/{tr.2a0d2b7600.js → tr.e878658140.js} +1 -1
  27. package/dist/client/static/js/async/vt.42416b707d.js +1 -0
  28. package/dist/client/static/js/async/x1.da8687159b.js +90 -0
  29. package/dist/client/static/js/async/xe.da8dcc2015.js +2 -0
  30. package/dist/client/static/js/async/xe.da8dcc2015.js.LICENSE.txt +11 -0
  31. package/dist/client/static/js/async/{xn.6360379f71.js → xn.6510c0abe2.js} +2 -2
  32. package/dist/client/static/js/async/{yx.af2936c368.js → xn1.83a7784fe1.js} +3 -3
  33. package/dist/client/static/js/async/xn1.83a7784fe1.js.LICENSE.txt +11 -0
  34. package/dist/client/static/js/async/yg.35bebd6d0c.js +149 -0
  35. package/dist/client/static/js/async/yv.d99d829136.js +1 -0
  36. package/dist/client/static/js/index.1fd9e1c543.js +38 -0
  37. package/package.json +3 -3
  38. package/src/client/components/common/ComposerTextarea.tsx +9 -1
  39. package/src/client/components/common/MarkdownRenderer.tsx +50 -12
  40. package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +9 -3
  41. package/src/client/components/settings/Modal.tsx +11 -2
  42. package/src/client/components/settings/categories/AppearanceSettings.tsx +7 -30
  43. package/src/client/components/settings/categories/ProviderSettings.tsx +2 -0
  44. package/src/client/components/settings/categories/appearance-settings/ThemeCard.tsx +61 -0
  45. package/src/client/components/settings/categories/appearance-settings/ThemeGrid.tsx +80 -0
  46. package/src/client/components/settings/categories/chat-settings/TitleSection.tsx +1 -1
  47. package/src/client/components/settings/categories/provider-settings/AddProviderModal.tsx +43 -6
  48. package/src/client/components/settings/categories/provider-settings/ModelConfigModal.tsx +54 -54
  49. package/src/client/components/workspace/SearchPanel.tsx +16 -3
  50. package/src/client/components/workspace/btw-panel/AskCard.tsx +11 -6
  51. package/src/client/components/workspace/btw-panel/Messages.tsx +105 -51
  52. package/src/client/components/workspace/btw-panel/index.tsx +124 -45
  53. package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +30 -14
  54. package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +10 -1
  55. package/src/client/components/workspace/chat-timeline/GeneratingIndicator.tsx +8 -2
  56. package/src/client/components/workspace/chat-timeline/MessageItem.tsx +27 -16
  57. package/src/client/components/workspace/chat-timeline/MessageList.tsx +11 -0
  58. package/src/client/components/workspace/chat-timeline/RunFooter.tsx +8 -0
  59. package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +12 -1
  60. package/src/client/components/workspace/chat-timeline/index.tsx +7 -2
  61. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +42 -15
  62. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +13 -1
  63. package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +13 -4
  64. package/src/client/components/workspace/diff-panel/SplitView.tsx +4 -1
  65. package/src/client/components/workspace/diff-panel/UnifiedView.tsx +70 -65
  66. package/src/client/components/workspace/diff-panel/index.tsx +8 -1
  67. package/src/client/components/workspace/editor/index.tsx +18 -2
  68. package/src/client/components/workspace/file-explorer/GitRepoDropdown.tsx +15 -41
  69. package/src/client/components/workspace/file-explorer/index.tsx +86 -16
  70. package/src/client/components/workspace/git-panel/index.tsx +60 -78
  71. package/src/client/components/workspace/terminal-panel/Header.tsx +16 -1
  72. package/src/client/components/workspace/terminal-panel/RealtimeXtermView.tsx +5 -5
  73. package/src/client/components/workspace/terminal-panel/index.tsx +6 -2
  74. package/src/client/components/workspace/terminal-panel/mount.ts +2 -2
  75. package/src/client/data/theme/terminal.ts +50 -52
  76. package/src/client/hooks/chat/btw/index.ts +139 -18
  77. package/src/client/hooks/chat/btw/intercept.ts +8 -8
  78. package/src/client/hooks/chat/btw/mode.ts +111 -16
  79. package/src/client/hooks/chat/composer/index.ts +10 -4
  80. package/src/client/hooks/chat/timeline/access-mode.ts +41 -0
  81. package/src/client/hooks/chat/timeline/ask-frames.test.ts +87 -0
  82. package/src/client/hooks/chat/timeline/ask-frames.ts +20 -1
  83. package/src/client/hooks/chat/timeline/auto-scroll.ts +13 -4
  84. package/src/client/hooks/chat/timeline/index.ts +8 -20
  85. package/src/client/hooks/chat/timeline/queue.ts +66 -9
  86. package/src/client/hooks/chat/timeline/scroll.test.ts +260 -0
  87. package/src/client/hooks/chat/timeline/scroll.ts +93 -20
  88. package/src/client/hooks/chat/timeline/session-load.ts +7 -1
  89. package/src/client/hooks/chat/timeline/session-pagination.test.ts +167 -0
  90. package/src/client/hooks/chat/timeline/session-pagination.ts +37 -11
  91. package/src/client/hooks/editor/save-file.ts +62 -0
  92. package/src/client/hooks/editor/use-file-editor.test.ts +61 -5
  93. package/src/client/hooks/editor/use-file-editor.ts +38 -29
  94. package/src/client/hooks/editor/use-file-transfer.ts +5 -2
  95. package/src/client/hooks/settings/providers.ts +34 -3
  96. package/src/client/hooks/ui/open-file.ts +7 -1
  97. package/src/client/hooks/ui/theme.ts +82 -57
  98. package/src/client/hooks/workspace/file-tabs.ts +5 -1
  99. package/src/client/hooks/workspace/repo-scope/index.ts +119 -0
  100. package/src/client/hooks/workspace/repo-scope/store.test.ts +161 -0
  101. package/src/client/hooks/workspace/repo-scope/store.ts +201 -0
  102. package/src/client/hooks/workspace/search-stream.ts +24 -5
  103. package/src/client/main.tsx +6 -0
  104. package/src/client/tailwind.css +19 -56
  105. package/src/server/lib/btw/child.server.ts +41 -0
  106. package/src/server/lib/btw/lifecycle.server.ts +254 -0
  107. package/src/server/lib/btw/prompt.ts +13 -5
  108. package/src/server/lib/btw/registry.server.ts +13 -4
  109. package/src/server/lib/btw/runtime.server.ts +149 -156
  110. package/src/server/lib/btw/schema.server.ts +27 -0
  111. package/src/server/lib/btw/service.server.ts +106 -5
  112. package/src/server/lib/btw/store.server.ts +57 -6
  113. package/src/server/lib/db/schema.ts +4 -0
  114. package/src/server/lib/db/settings-store.test.ts +65 -0
  115. package/src/server/lib/db/settings-store.ts +25 -0
  116. package/src/server/lib/fs/atomic-write.ts +42 -4
  117. package/src/server/lib/fs/config-lock.ts +74 -0
  118. package/src/server/lib/fs/git-ignore.ts +55 -5
  119. package/src/server/lib/fs/ripgrep.ts +119 -0
  120. package/src/server/lib/lifecycle/identity.ts +10 -64
  121. package/src/server/lib/lifecycle/proc/darwin.ts +238 -0
  122. package/src/server/lib/lifecycle/proc/index.ts +38 -0
  123. package/src/server/lib/lifecycle/proc/linux.ts +80 -0
  124. package/src/server/lib/lifecycle/proc/ps.ts +86 -0
  125. package/src/server/lib/lifecycle/proc/types.ts +33 -0
  126. package/src/server/lib/lifecycle/proc/win32.ts +53 -0
  127. package/src/server/lib/models/provider-registry.server.ts +2 -2
  128. package/src/server/lib/models/registry.server.ts +1 -1
  129. package/src/server/lib/omp/config/behavior.ts +17 -17
  130. package/src/server/lib/omp/config/disabled-providers.ts +84 -35
  131. package/src/server/lib/omp/config/document.ts +128 -0
  132. package/src/server/lib/omp/config/extensions.ts +11 -10
  133. package/src/server/lib/omp/config/mcp.ts +4 -57
  134. package/src/server/lib/omp/config/model-overrides.ts +123 -0
  135. package/src/server/lib/omp/config/models-config.ts +92 -0
  136. package/src/server/lib/omp/config/models-validation.ts +159 -0
  137. package/src/server/lib/omp/config/path-scoped.ts +74 -0
  138. package/src/server/lib/omp/config/providers.ts +241 -211
  139. package/src/server/lib/omp/config/roles.ts +6 -14
  140. package/src/server/lib/omp/core/auth-credentials.ts +1 -1
  141. package/src/server/lib/omp/rpc/frame-fold.test.ts +124 -0
  142. package/src/server/lib/omp/rpc/frame-fold.ts +43 -24
  143. package/src/server/lib/omp/rpc/lifecycle.test.ts +41 -0
  144. package/src/server/lib/omp/rpc/manager.ts +21 -21
  145. package/src/server/lib/omp/rpc/pending-ui-dialogs.ts +11 -7
  146. package/src/server/lib/omp/rpc/session-commands.ts +17 -29
  147. package/src/server/lib/omp/rpc/session-registry.ts +5 -66
  148. package/src/server/lib/omp/rpc/web-state.ts +0 -6
  149. package/src/server/lib/omp/session/auto-title.server.test.ts +109 -11
  150. package/src/server/lib/omp/session/auto-title.server.ts +95 -20
  151. package/src/server/lib/omp/session/sidebar-data.server.ts +11 -6
  152. package/src/server/lib/queue/delivery-dispatch.server.test.ts +162 -0
  153. package/src/server/lib/queue/delivery-harness.ts +88 -0
  154. package/src/server/lib/queue/delivery.server.test.ts +78 -149
  155. package/src/server/lib/queue/delivery.server.ts +105 -13
  156. package/src/server/lib/queue/store.server.ts +30 -5
  157. package/src/server/lib/terminal/foreground.test.ts +164 -0
  158. package/src/server/lib/terminal/foreground.ts +34 -6
  159. package/src/server/lib/terminal/history.ts +8 -7
  160. package/src/server/plugins/compress.ts +33 -5
  161. package/src/server/plugins/ssr.ts +14 -7
  162. package/src/server/routes/btw/topics.ts +89 -2
  163. package/src/server/routes/fs/action.test.ts +64 -0
  164. package/src/server/routes/fs/action.ts +10 -1
  165. package/src/server/routes/fs/git.ts +5 -6
  166. package/src/server/routes/fs/search.ts +17 -26
  167. package/src/server/routes/sessions/queue.ts +17 -4
  168. package/src/server/routes/settings/index.ts +2 -0
  169. package/src/server/routes/settings/model-override.ts +69 -0
  170. package/src/server/routes/settings/provider-models.ts +35 -12
  171. package/src/server/routes/settings/providers.ts +31 -1
  172. package/src/server/routes/settings/root.ts +8 -3
  173. package/src/shared/lib/chat/btw/client.ts +34 -0
  174. package/src/shared/lib/chat/timeline/tool-phrases.ts +7 -0
  175. package/src/shared/lib/code/line-endings.test.ts +38 -0
  176. package/src/shared/lib/code/line-endings.ts +56 -0
  177. package/src/shared/lib/code/shiki-themes.ts +9 -5
  178. package/src/shared/lib/fs/file-tree.ts +17 -12
  179. package/src/shared/lib/markdown/autolink.test.ts +32 -0
  180. package/src/shared/lib/markdown/autolink.ts +50 -0
  181. package/src/shared/lib/markdown/document-urls.test.ts +68 -0
  182. package/src/shared/lib/markdown/document-urls.ts +118 -0
  183. package/src/shared/lib/markdown/marked.ts +27 -15
  184. package/src/shared/lib/markdown/mermaid.ts +2 -2
  185. package/src/shared/lib/models/catalog.ts +1 -1
  186. package/src/shared/lib/omp/session/schema-migrations.ts +30 -0
  187. package/src/shared/lib/omp/session/stream-state.server.test.ts +54 -0
  188. package/src/shared/lib/omp/session/stream-state.server.ts +70 -21
  189. package/src/shared/lib/settings/client.ts +10 -4
  190. package/src/shared/lib/settings/diff.test.ts +31 -0
  191. package/src/shared/lib/settings/diff.ts +37 -0
  192. package/src/shared/lib/theme/catalog.test.ts +168 -0
  193. package/src/shared/lib/theme/catalog.ts +98 -0
  194. package/src/shared/lib/theme/color.ts +88 -0
  195. package/src/shared/lib/theme/css.ts +70 -0
  196. package/src/shared/lib/theme/palettes/chamber.ts +61 -0
  197. package/src/shared/lib/theme/palettes/dark.ts +313 -0
  198. package/src/shared/lib/theme/palettes/light.ts +313 -0
  199. package/src/shared/types/btw.ts +83 -4
  200. package/src/shared/types/index.ts +1 -0
  201. package/src/shared/types/settings/provider.ts +8 -1
  202. package/src/shared/types/settings/state.ts +10 -4
  203. package/src/shared/types/theme.ts +48 -0
  204. package/dist/client/static/css/index.b938f4a693.css +0 -2
  205. package/dist/client/static/js/77.8022a800b5.js +0 -139
  206. package/dist/client/static/js/async/1k.a411fe5b43.js +0 -2
  207. package/dist/client/static/js/async/66.86544ad741.js +0 -93
  208. package/dist/client/static/js/async/7g.db82aca7ba.js +0 -1
  209. package/dist/client/static/js/async/ar.ad5c8822a8.js +0 -2
  210. package/dist/client/static/js/async/e.6443e739a2.js +0 -79
  211. package/dist/client/static/js/async/g.ee41bfed7f.js +0 -2
  212. package/dist/client/static/js/async/h1.d7091cef78.js +0 -1
  213. package/dist/client/static/js/async/jl.4911fa3383.js +0 -1
  214. package/dist/client/static/js/async/m.2e1ea3db9e.js.LICENSE.txt +0 -6
  215. package/dist/client/static/js/async/mt.853be2b5aa.js +0 -1
  216. package/dist/client/static/js/async/ot.84c71b308f.js +0 -2
  217. package/dist/client/static/js/async/px.783b6f91f2.js +0 -1
  218. package/dist/client/static/js/async/q8.7f1b48e9cd.js +0 -21
  219. package/dist/client/static/js/async/q8.7f1b48e9cd.js.LICENSE.txt +0 -6
  220. package/dist/client/static/js/async/s.aad2ecebc6.js +0 -94
  221. package/dist/client/static/js/async/vt.20406a5604.js +0 -1
  222. package/dist/client/static/js/async/x1.fe8af17016.js +0 -90
  223. package/dist/client/static/js/async/xn.6360379f71.js.LICENSE.txt +0 -6
  224. package/dist/client/static/js/async/yg.5a94e1fc8a.js +0 -149
  225. package/dist/client/static/js/async/yv.2fa22f009a.js +0 -1
  226. package/dist/client/static/js/index.5fe7a2cb64.js +0 -34
  227. package/src/client/components/workspace/btw-panel/Composer.tsx +0 -183
  228. package/src/client/components/workspace/btw-panel/attachments.ts +0 -80
  229. /package/dist/client/static/js/{77.8022a800b5.js.LICENSE.txt → 77.0d81c74cf0.js.LICENSE.txt} +0 -0
  230. /package/dist/client/static/js/async/{g.ee41bfed7f.js.LICENSE.txt → 1k.973e8e21fc.js.LICENSE.txt} +0 -0
  231. /package/dist/client/static/js/async/{3y.3186ecdd63.js.LICENSE.txt → 3y.3530b824ad.js.LICENSE.txt} +0 -0
  232. /package/dist/client/static/js/async/{ot.84c71b308f.js.LICENSE.txt → 4m.928a1dde85.js.LICENSE.txt} +0 -0
  233. /package/dist/client/static/js/async/{q.b453193538.js.LICENSE.txt → ar.9303e5f2e8.js.LICENSE.txt} +0 -0
  234. /package/dist/client/static/js/async/{yx.af2936c368.js.LICENSE.txt → g.cb81980498.js.LICENSE.txt} +0 -0
  235. /package/dist/client/static/js/async/{1k.a411fe5b43.js.LICENSE.txt → q.22588845a9.js.LICENSE.txt} +0 -0
  236. /package/dist/client/static/js/async/{ar.ad5c8822a8.js.LICENSE.txt → xn.6510c0abe2.js.LICENSE.txt} +0 -0
  237. /package/dist/client/static/js/{index.5fe7a2cb64.js.LICENSE.txt → index.1fd9e1c543.js.LICENSE.txt} +0 -0
@@ -0,0 +1,79 @@
1
+ "use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["e"],{WJ(e,t,s){var i=s("Yr"),r=s("M4"),n=s("Gt"),a=(0,n.K)((e,t,s,n)=>{e.attr("class",s);let{width:a,height:c,x:h,y:u}=l(e,t);(0,i.a$)(e,c,a,n);let y=o(h,u,a,c,t);e.attr("viewBox",y),r.R.debug(`viewBox configured: ${y} with padding: ${t}`)},"setupViewPortForSVG"),l=(0,n.K)((e,t)=>{let s=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:s.width+2*t,height:s.height+2*t,x:s.x,y:s.y}},"calculateDimensionsWithPadding"),o=(0,n.K)((e,t,s,i,r)=>`${e-r} ${t-r} ${s} ${i}`,"createViewBox");s.d(t,{P:()=>a})},OT(e,t,s){var i=s("Gt"),r=s("El"),n=(0,i.K)((e,t)=>{let s;return"sandbox"===t&&(s=(0,r.Ltv)("#i"+e)),("sandbox"===t?(0,r.Ltv)(s.nodes()[0].contentDocument.body):(0,r.Ltv)("body")).select(`[id="${e}"]`)},"getDiagramElement");s.d(t,{A:()=>n})},cw(e,t,s){var i=s("OT"),r=s("WJ"),n=s("mW");s("Q"),s("ix"),s("LC"),s("bQ"),s("Ut"),s("PF"),s("iV"),s("h5");var a=s("pK"),l=s("NH"),o=s("Yr"),c=s("M4"),h=s("Gt"),u=function(){var e=(0,h.K)(function(e,t,s,i){for(s=s||{},i=e.length;i--;s[e[i]]=t);return s},"o"),t=[1,3],s=[1,4],i=[1,5],r=[1,6],n=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],a=[1,22],l=[2,7],o=[1,26],c=[1,27],u=[1,28],y=[1,29],m=[1,33],d=[1,34],E=[1,35],p=[1,36],R=[1,37],g=[1,38],f=[1,24],_=[1,31],S=[1,32],I=[1,30],b=[1,39],T=[1,40],k=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],N=[1,61],q=[89,90],C=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],A=[27,29],L=[1,70],$=[1,71],v=[1,72],x=[1,73],w=[1,74],O=[1,75],D=[1,76],M=[1,83],F=[1,80],K=[1,84],P=[1,85],V=[1,86],U=[1,87],Y=[1,88],B=[1,89],Q=[1,90],H=[1,91],W=[1,92],j=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],G=[63,64],z=[1,101],X=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],J=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Z=[1,110],ee=[1,106],et=[1,107],es=[1,108],ei=[1,109],er=[1,111],en=[1,116],ea=[1,117],el=[1,114],eo=[1,115],ec={trace:(0,h.K)(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:(0,h.K)(function(e,t,s,i,r,n,a){var l=n.length-1;switch(r){case 4:this.$=n[l].trim(),i.setAccTitle(this.$);break;case 5:case 6:this.$=n[l].trim(),i.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:i.setDirection("TB");break;case 18:i.setDirection("BT");break;case 19:i.setDirection("RL");break;case 20:i.setDirection("LR");break;case 21:i.addRequirement(n[l-3],n[l-4]);break;case 22:i.addRequirement(n[l-5],n[l-6]),i.setClass([n[l-5]],n[l-3]);break;case 23:i.setNewReqId(n[l-2]);break;case 24:i.setNewReqText(n[l-2]);break;case 25:i.setNewReqRisk(n[l-2]);break;case 26:i.setNewReqVerifyMethod(n[l-2]);break;case 29:this.$=i.RequirementType.REQUIREMENT;break;case 30:this.$=i.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=i.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=i.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=i.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=i.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=i.RiskLevel.LOW_RISK;break;case 36:this.$=i.RiskLevel.MED_RISK;break;case 37:this.$=i.RiskLevel.HIGH_RISK;break;case 38:this.$=i.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=i.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=i.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=i.VerifyType.VERIFY_TEST;break;case 42:i.addElement(n[l-3]);break;case 43:i.addElement(n[l-5]),i.setClass([n[l-5]],n[l-3]);break;case 44:i.setNewElementType(n[l-2]);break;case 45:i.setNewElementDocRef(n[l-2]);break;case 48:i.addRelationship(n[l-2],n[l],n[l-4]);break;case 49:i.addRelationship(n[l-2],n[l-4],n[l]);break;case 50:this.$=i.Relationships.CONTAINS;break;case 51:this.$=i.Relationships.COPIES;break;case 52:this.$=i.Relationships.DERIVES;break;case 53:this.$=i.Relationships.SATISFIES;break;case 54:this.$=i.Relationships.VERIFIES;break;case 55:this.$=i.Relationships.REFINES;break;case 56:this.$=i.Relationships.TRACES;break;case 57:this.$=n[l-2],i.defineClass(n[l-1],n[l]);break;case 58:i.setClass(n[l-1],n[l]);break;case 59:i.setClass([n[l-2]],n[l]);break;case 60:case 62:case 65:this.$=[n[l]];break;case 61:case 63:this.$=n[l-2].concat([n[l]]);break;case 64:this.$=n[l-2],i.setCssStyle(n[l-1],n[l]);break;case 66:n[l-2].push(n[l]),this.$=n[l-2];break;case 68:this.$=n[l-1]+n[l]}},"anonymous"),table:[{3:1,4:2,6:t,9:s,11:i,13:r},{1:[3]},{3:8,4:2,5:[1,7],6:t,9:s,11:i,13:r},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(n,[2,6]),{3:12,4:2,6:t,9:s,11:i,13:r},{1:[2,2]},{4:17,5:a,7:13,8:l,9:s,11:i,13:r,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:c,23:u,24:y,25:23,33:25,41:m,42:d,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},e(n,[2,4]),e(n,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:a,7:42,8:l,9:s,11:i,13:r,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:c,23:u,24:y,25:23,33:25,41:m,42:d,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:43,8:l,9:s,11:i,13:r,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:c,23:u,24:y,25:23,33:25,41:m,42:d,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:44,8:l,9:s,11:i,13:r,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:c,23:u,24:y,25:23,33:25,41:m,42:d,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:45,8:l,9:s,11:i,13:r,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:c,23:u,24:y,25:23,33:25,41:m,42:d,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:46,8:l,9:s,11:i,13:r,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:c,23:u,24:y,25:23,33:25,41:m,42:d,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:47,8:l,9:s,11:i,13:r,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:c,23:u,24:y,25:23,33:25,41:m,42:d,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:48,8:l,9:s,11:i,13:r,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:c,23:u,24:y,25:23,33:25,41:m,42:d,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:49,8:l,9:s,11:i,13:r,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:c,23:u,24:y,25:23,33:25,41:m,42:d,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:50,8:l,9:s,11:i,13:r,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:c,23:u,24:y,25:23,33:25,41:m,42:d,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(k,[2,17]),e(k,[2,18]),e(k,[2,19]),e(k,[2,20]),{30:60,33:62,75:N,89:b,90:T},{30:63,33:62,75:N,89:b,90:T},{30:64,33:62,75:N,89:b,90:T},e(q,[2,29]),e(q,[2,30]),e(q,[2,31]),e(q,[2,32]),e(q,[2,33]),e(q,[2,34]),e(C,[2,81]),e(C,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(A,[2,79]),e(A,[2,80]),{27:[1,67],29:[1,68]},e(A,[2,85]),e(A,[2,86]),{62:69,65:L,66:$,67:v,68:x,69:w,70:O,71:D},{62:77,65:L,66:$,67:v,68:x,69:w,70:O,71:D},{30:78,33:62,75:N,89:b,90:T},{73:79,75:M,76:F,78:81,79:82,80:K,81:P,82:V,83:U,84:Y,85:B,86:Q,87:H,88:W},e(j,[2,60]),e(j,[2,62]),{73:93,75:M,76:F,78:81,79:82,80:K,81:P,82:V,83:U,84:Y,85:B,86:Q,87:H,88:W},{30:94,33:62,75:N,76:F,89:b,90:T},{5:[1,95]},{30:96,33:62,75:N,89:b,90:T},{5:[1,97]},{30:98,33:62,75:N,89:b,90:T},{63:[1,99]},e(G,[2,50]),e(G,[2,51]),e(G,[2,52]),e(G,[2,53]),e(G,[2,54]),e(G,[2,55]),e(G,[2,56]),{64:[1,100]},e(k,[2,59],{76:F}),e(k,[2,64],{76:z}),{33:103,75:[1,102],89:b,90:T},e(X,[2,65],{79:104,75:M,80:K,81:P,82:V,83:U,84:Y,85:B,86:Q,87:H,88:W}),e(J,[2,67]),e(J,[2,69]),e(J,[2,70]),e(J,[2,71]),e(J,[2,72]),e(J,[2,73]),e(J,[2,74]),e(J,[2,75]),e(J,[2,76]),e(J,[2,77]),e(J,[2,78]),e(k,[2,57],{76:z}),e(k,[2,58],{76:F}),{5:Z,28:105,31:ee,34:et,36:es,38:ei,40:er},{27:[1,112],76:F},{5:en,40:ea,56:113,57:el,59:eo},{27:[1,118],76:F},{33:119,89:b,90:T},{33:120,89:b,90:T},{75:M,78:121,79:82,80:K,81:P,82:V,83:U,84:Y,85:B,86:Q,87:H,88:W},e(j,[2,61]),e(j,[2,63]),e(J,[2,68]),e(k,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:Z,28:126,31:ee,34:et,36:es,38:ei,40:er},e(k,[2,28]),{5:[1,127]},e(k,[2,42]),{32:[1,128]},{32:[1,129]},{5:en,40:ea,56:130,57:el,59:eo},e(k,[2,47]),{5:[1,131]},e(k,[2,48]),e(k,[2,49]),e(X,[2,66],{79:104,75:M,80:K,81:P,82:V,83:U,84:Y,85:B,86:Q,87:H,88:W}),{33:132,89:b,90:T},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(k,[2,27]),{5:Z,28:145,31:ee,34:et,36:es,38:ei,40:er},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(k,[2,46]),{5:en,40:ea,56:152,57:el,59:eo},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(k,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(k,[2,43]),{5:Z,28:159,31:ee,34:et,36:es,38:ei,40:er},{5:Z,28:160,31:ee,34:et,36:es,38:ei,40:er},{5:Z,28:161,31:ee,34:et,36:es,38:ei,40:er},{5:Z,28:162,31:ee,34:et,36:es,38:ei,40:er},{5:en,40:ea,56:163,57:el,59:eo},{5:en,40:ea,56:164,57:el,59:eo},e(k,[2,23]),e(k,[2,24]),e(k,[2,25]),e(k,[2,26]),e(k,[2,44]),e(k,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:(0,h.K)(function(e,t){if(t.recoverable)this.trace(e);else{var s=Error(e);throw s.hash=t,s}},"parseError"),parse:(0,h.K)(function(e){var t=this,s=[0],i=[],r=[null],n=[],a=this.table,l="",o=0,c=0,u=0,y=n.slice.call(arguments,1),m=Object.create(this.lexer),d={};for(var E in this.yy)Object.prototype.hasOwnProperty.call(this.yy,E)&&(d[E]=this.yy[E]);m.setInput(e,d),d.lexer=m,d.parser=this,void 0===m.yylloc&&(m.yylloc={});var p=m.yylloc;n.push(p);var R=m.options&&m.options.ranges;function g(){var e;return"number"!=typeof(e=i.pop()||m.lex()||1)&&(e instanceof Array&&(e=(i=e).pop()),e=t.symbols_[e]||e),e}"function"==typeof d.parseError?this.parseError=d.parseError:this.parseError=Object.getPrototypeOf(this).parseError,(0,h.K)(function(e){s.length=s.length-2*e,r.length=r.length-e,n.length=n.length-e},"popStack"),(0,h.K)(g,"lex");for(var f,_,S,I,b,T,k,N,q,C={};;){if(S=s[s.length-1],this.defaultActions[S]?I=this.defaultActions[S]:(null==f&&(f=g()),I=a[S]&&a[S][f]),void 0===I||!I.length||!I[0]){var A="";for(T in q=[],a[S])this.terminals_[T]&&T>2&&q.push("'"+this.terminals_[T]+"'");A=m.showPosition?"Parse error on line "+(o+1)+":\n"+m.showPosition()+"\nExpecting "+q.join(", ")+", got '"+(this.terminals_[f]||f)+"'":"Parse error on line "+(o+1)+": Unexpected "+(1==f?"end of input":"'"+(this.terminals_[f]||f)+"'"),this.parseError(A,{text:m.match,token:this.terminals_[f]||f,line:m.yylineno,loc:p,expected:q})}if(I[0]instanceof Array&&I.length>1)throw Error("Parse Error: multiple actions possible at state: "+S+", token: "+f);switch(I[0]){case 1:s.push(f),r.push(m.yytext),n.push(m.yylloc),s.push(I[1]),f=null,_?(f=_,_=null):(c=m.yyleng,l=m.yytext,o=m.yylineno,p=m.yylloc,u>0&&u--);break;case 2:if(k=this.productions_[I[1]][1],C.$=r[r.length-k],C._$={first_line:n[n.length-(k||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(k||1)].first_column,last_column:n[n.length-1].last_column},R&&(C._$.range=[n[n.length-(k||1)].range[0],n[n.length-1].range[1]]),void 0!==(b=this.performAction.apply(C,[l,c,o,d,I[1],r,n].concat(y))))return b;k&&(s=s.slice(0,-1*k*2),r=r.slice(0,-1*k),n=n.slice(0,-1*k)),s.push(this.productions_[I[1]][0]),r.push(C.$),n.push(C._$),N=a[s[s.length-2]][s[s.length-1]],s.push(N);break;case 3:return!0}}return!0},"parse")};function eh(){this.yy={}}return ec.lexer={EOF:1,parseError:(0,h.K)(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},"parseError"),setInput:(0,h.K)(function(e,t){return this.yy=t||this.yy||{},this._input=e,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]),this.offset=0,this},"setInput"),input:(0,h.K)(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},"input"),unput:(0,h.K)(function(e){var t=e.length,s=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),s.length-1&&(this.yylineno-=s.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:s?(s.length===i.length?this.yylloc.first_column:0)+i[i.length-s.length].length-s[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},"unput"),more:(0,h.K)(function(){return this._more=!0,this},"more"),reject:(0,h.K)(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:(0,h.K)(function(e){this.unput(this.match.slice(e))},"less"),pastInput:(0,h.K)(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:(0,h.K)(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:(0,h.K)(function(){var e=this.pastInput(),t=Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},"showPosition"),test_match:(0,h.K)(function(e,t){var s,i,r;if(this.options.backtrack_lexer&&(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))),(i=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],s=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),s)return s;if(this._backtrack)for(var n in r)this[n]=r[n];return!1},"test_match"),next:(0,h.K)(function(){if(this.done)return this.EOF;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var e,t,s,i,r=this._currentRules(),n=0;n<r.length;n++)if((s=this._input.match(this.rules[r[n]]))&&(!t||s[0].length>t[0].length)){if(t=s,i=n,this.options.backtrack_lexer){if(!1!==(e=this.test_match(s,r[n])))return e;if(!this._backtrack)return!1;t=!1;continue}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,r[i]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:(0,h.K)(function(){var e=this.next();return e||this.lex()},"lex"),begin:(0,h.K)(function(e){this.conditionStack.push(e)},"begin"),popState:(0,h.K)(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:(0,h.K)(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:(0,h.K)(function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"},"topState"),pushState:(0,h.K)(function(e){this.begin(e)},"pushState"),stateStackSize:(0,h.K)(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:(0,h.K)(function(e,t,s,i){switch(s){case 0:return"title";case 1:return this.begin("acc_title"),9;case 2:return this.popState(),"acc_title_value";case 3:return this.begin("acc_descr"),11;case 4:return this.popState(),"acc_descr_value";case 5:this.begin("acc_descr_multiline");break;case 6:case 58:case 65:this.popState();break;case 7:return"acc_descr_multiline_value";case 8:return 21;case 9:return 22;case 10:return 23;case 11:return 24;case 12:return 5;case 13:case 14:case 15:case 56:break;case 16:return 8;case 17:return 6;case 18:return 27;case 19:return 40;case 20:return 29;case 21:return 32;case 22:return 31;case 23:return 34;case 24:return 36;case 25:return 38;case 26:return 41;case 27:return 42;case 28:return 43;case 29:return 44;case 30:return 45;case 31:return 46;case 32:return 47;case 33:return 48;case 34:return 49;case 35:return 50;case 36:return 51;case 37:return 52;case 38:return 53;case 39:return 54;case 40:return 65;case 41:return 66;case 42:return 67;case 43:return 68;case 44:return 69;case 45:return 70;case 46:return 71;case 47:return 57;case 48:return 59;case 49:return this.begin("style"),77;case 50:case 68:return 75;case 51:return 81;case 52:return 88;case 53:return"PERCENT";case 54:return 86;case 55:return 84;case 57:case 64:this.begin("string");break;case 59:return this.begin("style"),72;case 60:return this.begin("style"),74;case 61:return 61;case 62:return 64;case 63:return 63;case 66:return"qString";case 67:return t.yytext=t.yytext.trim(),89;case 69:return 80;case 70:return 76}},"anonymous"),rules:[/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\b)/i,/^(?:\{)/i,/^(?:\})/i,/^(?::{3})/i,/^(?::)/i,/^(?:id\b)/i,/^(?:text\b)/i,/^(?:risk\b)/i,/^(?:verifyMethod\b)/i,/^(?:requirement\b)/i,/^(?:functionalRequirement\b)/i,/^(?:interfaceRequirement\b)/i,/^(?:performanceRequirement\b)/i,/^(?:physicalRequirement\b)/i,/^(?:designConstraint\b)/i,/^(?:low\b)/i,/^(?:medium\b)/i,/^(?:high\b)/i,/^(?:analysis\b)/i,/^(?:demonstration\b)/i,/^(?:inspection\b)/i,/^(?:test\b)/i,/^(?:element\b)/i,/^(?:contains\b)/i,/^(?:copies\b)/i,/^(?:derives\b)/i,/^(?:satisfies\b)/i,/^(?:verifies\b)/i,/^(?:refines\b)/i,/^(?:traces\b)/i,/^(?:type\b)/i,/^(?:docref\b)/i,/^(?:style\b)/i,/^(?:\w+)/i,/^(?::)/i,/^(?:;)/i,/^(?:%)/i,/^(?:-)/i,/^(?:#)/i,/^(?: )/i,/^(?:["])/i,/^(?:\n)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[\w][^:,\r\n\{\<\>\-\=]*)/i,/^(?:\w+)/i,/^(?:[0-9]+)/i,/^(?:,)/i],conditions:{acc_descr_multiline:{rules:[6,7,68,69,70],inclusive:!1},acc_descr:{rules:[4,68,69,70],inclusive:!1},acc_title:{rules:[2,68,69,70],inclusive:!1},style:{rules:[50,51,52,53,54,55,56,57,58,68,69,70],inclusive:!1},unqString:{rules:[68,69,70],inclusive:!1},token:{rules:[68,69,70],inclusive:!1},string:{rules:[65,66,68,69,70],inclusive:!1},INITIAL:{rules:[0,1,3,5,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,59,60,61,62,63,64,67,68,69,70],inclusive:!0}}},(0,h.K)(eh,"Parser"),eh.prototype=ec,ec.Parser=eh,new eh}();u.parser=u;var y=class{constructor(){this.relations=[],this.latestRequirement=this.getInitialRequirement(),this.requirements=new Map,this.latestElement=this.getInitialElement(),this.elements=new Map,this.classes=new Map,this.direction="TB",this.RequirementType={REQUIREMENT:"Requirement",FUNCTIONAL_REQUIREMENT:"Functional Requirement",INTERFACE_REQUIREMENT:"Interface Requirement",PERFORMANCE_REQUIREMENT:"Performance Requirement",PHYSICAL_REQUIREMENT:"Physical Requirement",DESIGN_CONSTRAINT:"Design Constraint"},this.RiskLevel={LOW_RISK:"Low",MED_RISK:"Medium",HIGH_RISK:"High"},this.VerifyType={VERIFY_ANALYSIS:"Analysis",VERIFY_DEMONSTRATION:"Demonstration",VERIFY_INSPECTION:"Inspection",VERIFY_TEST:"Test"},this.Relationships={CONTAINS:"contains",COPIES:"copies",DERIVES:"derives",SATISFIES:"satisfies",VERIFIES:"verifies",REFINES:"refines",TRACES:"traces"},this.setAccTitle=o.SV,this.getAccTitle=o.iN,this.setAccDescription=o.EI,this.getAccDescription=o.m7,this.setDiagramTitle=o.ke,this.getDiagramTitle=o.ab,this.getConfig=(0,h.K)(()=>(0,o.D7)().requirement,"getConfig"),this.clear(),this.setDirection=this.setDirection.bind(this),this.addRequirement=this.addRequirement.bind(this),this.setNewReqId=this.setNewReqId.bind(this),this.setNewReqRisk=this.setNewReqRisk.bind(this),this.setNewReqText=this.setNewReqText.bind(this),this.setNewReqVerifyMethod=this.setNewReqVerifyMethod.bind(this),this.addElement=this.addElement.bind(this),this.setNewElementType=this.setNewElementType.bind(this),this.setNewElementDocRef=this.setNewElementDocRef.bind(this),this.addRelationship=this.addRelationship.bind(this),this.setCssStyle=this.setCssStyle.bind(this),this.setClass=this.setClass.bind(this),this.defineClass=this.defineClass.bind(this),this.setAccTitle=this.setAccTitle.bind(this),this.setAccDescription=this.setAccDescription.bind(this)}static{(0,h.K)(this,"RequirementDB")}getDirection(){return this.direction}setDirection(e){this.direction=e}resetLatestRequirement(){this.latestRequirement=this.getInitialRequirement()}resetLatestElement(){this.latestElement=this.getInitialElement()}getInitialRequirement(){return{requirementId:"",text:"",risk:"",verifyMethod:"",name:"",type:"",cssStyles:[],classes:["default"]}}getInitialElement(){return{name:"",type:"",docRef:"",cssStyles:[],classes:["default"]}}addRequirement(e,t){return this.requirements.has(e)||this.requirements.set(e,{name:e,type:t,requirementId:this.latestRequirement.requirementId,text:this.latestRequirement.text,risk:this.latestRequirement.risk,verifyMethod:this.latestRequirement.verifyMethod,cssStyles:[],classes:["default"]}),this.resetLatestRequirement(),this.requirements.get(e)}getRequirements(){return this.requirements}setNewReqId(e){void 0!==this.latestRequirement&&(this.latestRequirement.requirementId=e)}setNewReqText(e){void 0!==this.latestRequirement&&(this.latestRequirement.text=e)}setNewReqRisk(e){void 0!==this.latestRequirement&&(this.latestRequirement.risk=e)}setNewReqVerifyMethod(e){void 0!==this.latestRequirement&&(this.latestRequirement.verifyMethod=e)}addElement(e){return this.elements.has(e)||(this.elements.set(e,{name:e,type:this.latestElement.type,docRef:this.latestElement.docRef,cssStyles:[],classes:["default"]}),c.R.info("Added new element: ",e)),this.resetLatestElement(),this.elements.get(e)}getElements(){return this.elements}setNewElementType(e){void 0!==this.latestElement&&(this.latestElement.type=e)}setNewElementDocRef(e){void 0!==this.latestElement&&(this.latestElement.docRef=e)}addRelationship(e,t,s){this.relations.push({type:e,src:t,dst:s})}getRelationships(){return this.relations}clear(){this.relations=[],this.resetLatestRequirement(),this.requirements=new Map,this.resetLatestElement(),this.elements=new Map,this.classes=new Map,(0,o.IU)()}setCssStyle(e,t){for(let s of e){let e=this.requirements.get(s)??this.elements.get(s);if(!t||!e)return;for(let s of t)s.includes(",")?e.cssStyles.push(...s.split(",")):e.cssStyles.push(s)}}setClass(e,t){for(let s of e){let e=this.requirements.get(s)??this.elements.get(s);if(e)for(let s of t){e.classes.push(s);let t=this.classes.get(s)?.styles;t&&e.cssStyles.push(...t)}}}defineClass(e,t){for(let s of e){let e=this.classes.get(s);void 0===e&&(e={id:s,styles:[],textStyles:[]},this.classes.set(s,e)),t&&t.forEach(function(t){if(/color/.exec(t)){let s=t.replace("fill","bgFill");e.textStyles.push(s)}e.styles.push(t)}),this.requirements.forEach(e=>{e.classes.includes(s)&&e.cssStyles.push(...t.flatMap(e=>e.split(",")))}),this.elements.forEach(e=>{e.classes.includes(s)&&e.cssStyles.push(...t.flatMap(e=>e.split(",")))})}}getClasses(){return this.classes}getData(){let e=(0,o.D7)(),t=[],s=[];for(let s of this.requirements.values())s.id=s.name,s.cssStyles=s.cssStyles,s.cssClasses=s.classes.join(" "),s.shape="requirementBox",s.look=e.look,s.colorIndex=t.length,t.push(s);for(let s of this.elements.values())s.shape="requirementBox",s.look=e.look,s.id=s.name,s.cssStyles=s.cssStyles,s.cssClasses=s.classes.join(" "),s.colorIndex=t.length,t.push(s);let i=0;for(let t of this.relations){let r=t.type===this.Relationships.CONTAINS,n={id:`${t.src}-${t.dst}-${i++}`,start:this.requirements.get(t.src)?.name??this.elements.get(t.src)?.name,end:this.requirements.get(t.dst)?.name??this.elements.get(t.dst)?.name,label:`&lt;&lt;${t.type}&gt;&gt;`,classes:"relationshipLine",style:["fill:none",r?"":"stroke-dasharray: 10,7"],labelpos:"c",thickness:"normal",type:"normal",pattern:r?"normal":"dashed",arrowTypeStart:r?"requirement_contains":"",arrowTypeEnd:r?"":"requirement_arrow",look:e.look,labelType:"markdown"};s.push(n)}return{nodes:t,edges:s,other:{},config:e,direction:this.getDirection()}}},m=(0,h.K)(()=>{let e=(0,o.zj)(),{theme:t,themeVariables:s}=e,{bkgColorArray:i,borderColorArray:r}=s;if(!(0,a.P1)(t,r))return"";let n=(0,a.rq)(e.look),l="",c=(0,a.Ic)(i);for(let e=0;e<(0,a.Hu)(r);e++){let t=r[e],s=c?`fill: ${i[e%i.length]};`:"";l+=`
2
+
3
+ [data-look="${n}"][data-color-id="color-${e}"].node path {
4
+ stroke: ${t};
5
+ ${s}
6
+ }
7
+
8
+ [data-look="${n}"][data-color-id="color-${e}"].node rect {
9
+ stroke: ${t};
10
+ ${s}
11
+ }
12
+ `}return l},"genColor"),d=(0,h.K)(e=>{let{look:t,themeVariables:s}=(0,o.zj)(),{requirementEdgeLabelBackground:i}=s;return`
13
+ ${m()}
14
+ marker {
15
+ fill: ${e.relationColor};
16
+ stroke: ${e.relationColor};
17
+ }
18
+
19
+ marker.cross {
20
+ stroke: ${e.lineColor};
21
+ }
22
+
23
+ svg {
24
+ font-family: ${e.fontFamily};
25
+ font-size: ${e.fontSize};
26
+ }
27
+
28
+ .reqBox {
29
+ fill: ${e.requirementBackground};
30
+ fill-opacity: 1.0;
31
+ stroke: ${e.requirementBorderColor};
32
+ stroke-width: ${e.requirementBorderSize};
33
+ }
34
+
35
+ .reqTitle, .reqLabel{
36
+ fill: ${e.requirementTextColor};
37
+ }
38
+ .reqLabelBox {
39
+ fill: ${e.relationLabelBackground};
40
+ fill-opacity: 1.0;
41
+ }
42
+
43
+ .req-title-line {
44
+ stroke: ${e.requirementBorderColor};
45
+ stroke-width: ${e.requirementBorderSize};
46
+ }
47
+ .relationshipLine {
48
+ stroke: ${e.relationColor};
49
+ stroke-width: ${"neo"===t?e.strokeWidth:"1px"};
50
+ }
51
+ .relationshipLabel {
52
+ fill: ${e.relationLabelColor};
53
+ }
54
+ .edgeLabel {
55
+ background-color: ${e.edgeLabelBackground};
56
+ }
57
+ .edgeLabel .label rect {
58
+ fill: ${e.edgeLabelBackground};
59
+ }
60
+ .edgeLabel .label text {
61
+ fill: ${e.relationLabelColor};
62
+ }
63
+ .divider {
64
+ stroke: ${e.nodeBorder};
65
+ stroke-width: 1;
66
+ }
67
+ .label {
68
+ font-family: ${e.fontFamily};
69
+ color: ${e.nodeTextColor||e.textColor};
70
+ }
71
+ .label text,span {
72
+ fill: ${e.nodeTextColor||e.textColor};
73
+ color: ${e.nodeTextColor||e.textColor};
74
+ }
75
+ .labelBkg {
76
+ background-color: ${i??e.edgeLabelBackground};
77
+ }
78
+
79
+ `},"getStyles"),E={};(0,h.V)(E,{draw:()=>p});var p=(0,h.K)(async function(e,t,s,a){c.R.info("REF0:"),c.R.info("Drawing requirement diagram (unified)",t);let{securityLevel:h,state:u,layout:y,look:m}=(0,o.D7)(),d=a.db.getData(),E=(0,i.A)(t,h);d.type=a.type,d.layoutAlgorithm=(0,n.q7)(y),d.nodeSpacing=u?.nodeSpacing??50,d.rankSpacing=u?.rankSpacing??50,d.markers="neo"===m?["requirement_contains_neo","requirement_arrow_neo"]:["requirement_contains","requirement_arrow"],d.diagramId=t,await (0,n.XX)(d,E),l._K.insertTitle(E,"requirementDiagramTitleText",u?.titleTopMargin??25,a.db.getDiagramTitle()),(0,r.P)(E,8,"requirementDiagram",u?.useMaxWidth??!0)},"draw"),R={parser:u,get db(){return new y},renderer:E,styles:d};s.d(t,{diagram:()=>R})}}]);
@@ -0,0 +1,2 @@
1
+ /*! LICENSE: g.cb81980498.js.LICENSE.txt */
2
+ "use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["g"],{Wh(e,t,n){n.d(t,{MobileLayoutWrapper:()=>eJ});var i=n("j"),s=n("H"),a=n("s"),l=n("NO"),r=n("y");let o=(0,r.A)({name:"menu",size:24,node:[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]});var c=n("Go"),d=n("r"),p=n("z"),h=n("se"),m=n("oj"),x=n("SS"),f=n("A9"),u=n("FE"),b=n("R2"),g=n("U8");function k(e){let{activeSessionTitle:t,activeSessionId:n,onOpenSessionSidebar:a,onOpenRightSidebar:l,onNewSession:r,onSelectSession:k}=e,{folders:v}=(0,f.k)(),N=(0,u.H)(),[Y,w]=(0,s.J0)(!1),[y,F]=(0,s.J0)(!1),[S,D]=(0,s.J0)(null),C=(0,s.li)(null);(0,m.W)(C,()=>w(!1));let A=(0,s.li)(null);(0,m.W)(A,()=>F(!1)),(0,s.vJ)(()=>{if(!n)return void D(null);let e=!1;return fetch(`/api/telemetry/context?sessionId=${encodeURIComponent(String(n))}`).then(e=>e.ok?e.json():null).then(t=>{e||D(t?.telemetry??null)}).catch(()=>{e||D(null)}),()=>{e=!0}},[n]);let z=(0,s.Kr)(()=>{let e=Date.now(),t=[];for(let n of v)for(let i of n.sessions??[]){if(1===i.is_archived)continue;let s=(0,x.R7)(String(i.id)),a=i.updated_at?Date.parse(i.updated_at):0,l=void 0!==s&&e-s<=6e5?s:a;void 0!==s&&e-s>6e5||t.push({id:i.id,title:i.title,folderName:n.name,modified:l})}return t.sort((e,t)=>t.modified-e.modified).slice(0,10)},[v]),j=t?t.charAt(0).toUpperCase()+t.slice(1):"New session";return(0,i.FD)("header",{className:"flex-shrink-0 bg-canvas border-b border-ink/10 flex items-center justify-between px-3 z-20 titlebar-drag-region select-none",style:{height:"calc(3.5rem + env(safe-area-inset-top, 0px))",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px), env(titlebar-area-x, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px), calc(100vw - env(titlebar-area-width, 100vw)))",paddingTop:"env(safe-area-inset-top, 0px)"},children:[(0,i.FD)("div",{className:"flex items-center space-x-2 min-w-0 titlebar-no-drag",children:[(0,i.Y)("button",{type:"button",onClick:a,className:"p-1.5 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0",title:"Open Sessions","aria-label":"Open Sessions",children:(0,i.Y)(o,{size:20,strokeWidth:2})}),(0,i.FD)("span",{className:"relative font-bold text-sm tracking-tight flex items-center flex-shrink-0",children:[(0,i.Y)("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-orange-600 to-amber-500 font-extrabold text-[15px] tracking-tighter",children:"OMP"}),(0,i.Y)("span",{className:"ml-[1px] text-ink",children:"Chamber"}),(0,i.Y)("span",{className:"absolute -top-0.5 -right-1.5 flex",children:(0,i.Y)(b.c,{status:N})})]}),(0,i.Y)("span",{className:"text-ink/25 font-light text-xs flex-shrink-0 select-none",children:"/"}),(0,i.FD)("div",{className:"relative min-w-0",ref:C,children:[(0,i.FD)("button",{type:"button",onClick:()=>w(!Y),className:"flex items-center space-x-1 text-xs font-semibold text-ink hover:text-ink/80 transition-colors py-1 max-w-[150px] min-w-0",title:j,children:[(0,i.Y)("span",{className:"truncate",children:j}),(0,i.Y)(c.A,{size:13,className:"text-ink/50 flex-shrink-0"})]}),Y&&(0,i.FD)("div",{className:"fixed z-50 bg-paper border border-ink/15 rounded-xl shadow-lg p-2 text-xs",style:{top:"calc(3.5rem + env(safe-area-inset-top, 0px) + 0.375rem)",left:"max(0.75rem, env(safe-area-inset-left, 0px))",right:"max(0.75rem, env(safe-area-inset-right, 0px))",maxWidth:"18rem",maxHeight:"calc(100dvh - 3.5rem - env(safe-area-inset-top, 0px) - 1.125rem)",overflowY:"auto"},children:[(0,i.FD)("button",{type:"button",onClick:()=>{r(),w(!1)},className:"w-full text-left px-3 py-2 rounded-lg bg-ink text-canvas flex items-center space-x-2 font-medium mb-1.5 active:scale-98",children:[(0,i.Y)(d.A,{size:14}),(0,i.Y)("span",{children:"Start New Session"})]}),(0,i.Y)("div",{className:"px-2 py-1 text-[10px] uppercase font-bold text-ink/40",children:"Recent Sessions"}),(0,i.Y)("div",{className:"max-h-64 scrollbar-overlay-container scrollbar-overlay-static space-y-0.5",children:0===z.length?(0,i.Y)("div",{className:"px-2.5 py-2 text-ink/40 italic",children:"No sessions yet"}):z.map(e=>(0,i.FD)("button",{type:"button",onClick:()=>{k(e.id),w(!1)},className:`w-full text-left px-2.5 py-1.5 rounded-lg flex items-center justify-between space-x-2 transition-colors ${String(n)===String(e.id)?"bg-ink/10 font-semibold text-ink":"hover:bg-ink/5 text-ink/80"}`,children:[(0,i.FD)("span",{className:"min-w-0 flex flex-col",children:[(0,i.Y)("span",{className:"truncate",children:e.title?e.title.charAt(0).toUpperCase()+e.title.slice(1):"Untitled"}),(0,i.Y)("span",{className:"truncate text-[10px] text-ink/40 font-mono",children:e.folderName})]}),String(n)===String(e.id)&&(0,i.Y)(p.A,{size:12,className:"flex-shrink-0"})]},e.id))})]})]})]}),(0,i.FD)("div",{className:"flex items-center space-x-1 text-ink",children:[(0,i.FD)("div",{className:"relative flex items-center",ref:A,children:[(0,i.Y)("button",{type:"button",onClick:()=>F(!y),className:"w-8 h-8 rounded-lg hover:bg-ink/5 active:bg-ink/10 flex items-center justify-center text-ink transition-colors cursor-pointer",title:"Context usage","aria-label":"Context usage",children:(0,i.Y)("span",{className:"w-4 h-4 rounded-full border-[1.5px] border-ink/60 hover:border-ink transition-colors"})}),y&&(0,i.FD)("div",{className:"absolute top-full right-0 mt-2 w-56 bg-paper border border-ink/20 rounded-xl shadow-xl z-50 p-3 text-xs font-mono",children:[(0,i.FD)("div",{className:"font-semibold text-ink font-sans pb-1.5 border-b border-ink/10 flex items-center justify-between",children:[(0,i.Y)("span",{children:"Context"}),S&&S.messagesCount>0&&(0,i.Y)("span",{className:"w-1.5 h-1.5 rounded-full bg-success"})]}),S&&0!==S.messagesCount?(0,i.FD)("div",{className:"pt-2 space-y-1.5 text-[11px] text-ink/80",children:[(0,i.FD)("div",{className:"flex justify-between gap-2",children:[(0,i.Y)("span",{className:"text-ink/50",children:"Model:"}),(0,i.Y)("span",{className:"truncate",children:S.modelName||"—"})]}),(0,i.FD)("div",{className:"flex justify-between",children:[(0,i.Y)("span",{className:"text-ink/50",children:"Context:"}),(0,i.FD)("span",{children:[(0,g.Rk)(S.contextUsed)??"0"," / ",(0,g.Rk)(S.contextLimit)??"0"," (",S.contextPercent,"%)"]})]}),(0,i.FD)("div",{className:"flex justify-between",children:[(0,i.Y)("span",{className:"text-ink/50",children:"Messages:"}),(0,i.Y)("span",{children:S.messagesCount})]}),(0,i.FD)("div",{className:"flex justify-between",children:[(0,i.Y)("span",{className:"text-ink/50",children:"Cost:"}),(0,i.Y)("span",{children:S.costFormatted})]}),"number"==typeof S.cacheHitAverage&&(0,i.FD)("div",{className:"flex justify-between",children:[(0,i.Y)("span",{className:"text-ink/50",children:"Cache hit:"}),(0,i.FD)("span",{children:[S.cacheHitAverage.toFixed(1),"%"]})]})]}):(0,i.Y)("div",{className:"pt-2 text-[11px] text-ink/50 italic font-sans",children:"Session not started"})]})]}),(0,i.Y)("button",{type:"button",onClick:l,className:"w-8 h-8 rounded-lg hover:bg-ink/5 active:bg-ink/10 flex items-center justify-center text-ink transition-colors cursor-pointer",title:"Right Panel","aria-label":"Open Right Panel",children:(0,i.Y)(h.A,{size:18,strokeWidth:1.8})})]})]})}var v=n("L");function N(e){let{activeSessionId:t,onSelectSession:n,onNewSession:a,onOpenSessionSidebar:l,onOpenRightSidebar:r,appSettings:o={}}=e,{folders:c}=(0,f.k)(),[d,p]=(0,s.J0)(null),h=(0,s.Kr)(()=>{if(!t)return"New session";for(let e of c){let n=e.sessions?.find(e=>String(e.id)===String(t));if(n)return n.title}return null},[t,c]);return(0,i.FD)("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative",children:[(0,i.Y)(k,{activeSessionTitle:d||h||"New session",activeSessionId:t,onOpenSessionSidebar:l,onOpenRightSidebar:r,onNewSession:a,onSelectSession:n}),(0,i.Y)("div",{className:"flex-1 min-h-0",children:(0,i.Y)(v.E,{appSettings:o,onSessionTitle:p,variant:"mobile"})})]})}var Y=n("S");function w(e){let{onClose:t}=e;return(0,i.FD)("div",{className:"border-b border-ink/10 flex items-center justify-between px-3.5 flex-shrink-0 bg-canvas titlebar-drag-region select-none",style:{height:"calc(3.5rem + env(safe-area-inset-top, 0px))",paddingLeft:"max(0.875rem, env(safe-area-inset-left, 0px), env(titlebar-area-x, 0px))",paddingRight:"max(0.875rem, env(safe-area-inset-right, 0px))",paddingTop:"env(safe-area-inset-top, 0px)"},children:[(0,i.FD)("div",{className:"flex items-center space-x-2.5 titlebar-no-drag",children:[(0,i.FD)("span",{className:"font-bold text-sm tracking-tight flex items-center",children:[(0,i.Y)("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-orange-600 to-amber-500 font-extrabold text-[16px] tracking-tighter",children:"OMP"}),(0,i.Y)("span",{className:"ml-[1px] text-ink font-bold text-sm",children:"Chamber"})]}),(0,i.Y)("span",{className:"text-ink/25 text-xs select-none",children:"/"}),(0,i.Y)("span",{className:"text-[11px] font-semibold text-ink/60 uppercase tracking-wider font-mono",children:"Sessions"})]}),(0,i.Y)("button",{type:"button",onClick:t,className:"w-9 h-9 rounded-xl hover:bg-ink/5 active:bg-ink/10 text-ink flex items-center justify-center transition-colors cursor-pointer titlebar-no-drag",title:"Close sidebar","aria-label":"Close sidebar",children:(0,i.Y)(Y.A,{size:19,strokeWidth:2})})]})}var y=n("D"),F=n("O");let S=(0,r.A)({name:"arrow-up-down",size:24,node:[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]});var D=n("p7"),C=n("t3"),A=n("E");function z(e){let{searchQuery:t,sortOption:n,optionsOpen:s,showArchived:a,optionsRef:l,onNewSession:r,onNewWorkspace:o,onScheduler:c,onToggleOptions:h,onSortChange:m,onResetSort:x,onToggleArchived:f,onHideArchived:u,onSearchChange:b,onClearSearch:g}=e;return(0,i.FD)("div",{className:"p-3 border-b border-ink/10 flex flex-col space-y-2.5 flex-shrink-0 bg-canvas",children:[(0,i.FD)("div",{className:"flex items-center space-x-2",children:[(0,i.FD)("button",{type:"button",onClick:r,className:"flex-1 h-9.5 flex items-center justify-center space-x-2 px-3.5 rounded-xl bg-ink text-canvas hover:bg-ink/90 active:scale-[0.98] text-xs font-semibold transition-all shadow-xs",children:[(0,i.Y)(d.A,{size:15,strokeWidth:2.4}),(0,i.Y)("span",{children:"New Session"})]}),(0,i.Y)("button",{type:"button",onClick:o,className:"w-9.5 h-9.5 rounded-xl border border-ink/15 bg-paper hover:bg-ink/5 active:scale-95 text-ink/80 hover:text-ink flex items-center justify-center transition-all flex-shrink-0 cursor-pointer shadow-xs",title:"New Workspace","aria-label":"New Workspace",children:(0,i.Y)(y.A,{size:16,strokeWidth:1.8})}),(0,i.Y)("button",{type:"button",onClick:c,className:"w-9.5 h-9.5 rounded-xl border border-ink/15 bg-paper hover:bg-ink/5 active:scale-95 text-ink/80 hover:text-ink flex items-center justify-center transition-all flex-shrink-0 cursor-pointer shadow-xs",title:"Schedule Task","aria-label":"Schedule Task",children:(0,i.Y)(F.A,{size:16,strokeWidth:1.8})}),(0,i.FD)("div",{className:"relative flex-shrink-0",ref:l,children:[(0,i.Y)("button",{type:"button",onClick:h,className:`w-9.5 h-9.5 rounded-xl border active:scale-95 flex items-center justify-center transition-all cursor-pointer shadow-xs ${s||"A-Z"!==n||a?"bg-ink/10 text-ink border-ink/30":"border-ink/15 bg-paper hover:bg-ink/5 text-ink/80 hover:text-ink"}`,title:"Sort & Filter","aria-label":"Sort & Filter",children:(0,i.Y)(S,{size:15,strokeWidth:1.8})}),s&&(0,i.FD)("div",{className:"absolute right-0 top-full mt-2 w-52 bg-paper border border-ink/15 rounded-xl shadow-xl z-50 p-2 text-xs",children:[(0,i.Y)(A.i,{variant:"mobile",sortOption:n,onSortChange:m}),(0,i.Y)("div",{className:"border-t border-ink/10 my-1.5"}),(0,i.Y)("div",{className:"px-2 py-1 text-[10px] uppercase font-bold text-ink/40 font-mono",children:"Filter"}),(0,i.FD)("button",{type:"button",onClick:f,className:`w-full text-left px-2.5 py-1.5 rounded-lg flex items-center justify-between transition-colors ${a?"bg-amber-500/15 text-amber-950 font-semibold":"hover:bg-ink/5 text-ink/80"}`,children:[(0,i.FD)("span",{className:"flex items-center space-x-1.5",children:[(0,i.Y)(D.A,{size:13}),(0,i.Y)("span",{children:"Show Archived"})]}),a&&(0,i.Y)(p.A,{size:13})]})]})]})]}),(0,i.FD)("div",{className:"relative flex items-center",children:[(0,i.Y)(C.A,{size:14,className:"absolute left-3 text-ink/40"}),(0,i.Y)("input",{type:"text",value:t,onChange:e=>b(e.currentTarget.value),placeholder:"Search workspaces & sessions...",className:"w-full bg-paper border border-ink/15 rounded-xl pl-8 pr-8 py-2 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),t&&(0,i.Y)("button",{type:"button",onClick:g,className:"absolute right-2.5 text-ink/40 hover:text-ink p-1","aria-label":"Clear search",children:(0,i.Y)(Y.A,{size:13})})]}),(a||"A-Z"!==n)&&(0,i.FD)("div",{className:"flex items-center space-x-1.5 flex-wrap gap-y-1 pt-0.5",children:["A-Z"!==n&&(0,i.FD)("span",{className:"inline-flex items-center space-x-1 bg-ink/5 border border-ink/10 text-ink/80 rounded-lg px-2 py-0.5 text-[10px] font-mono",children:[(0,i.FD)("span",{children:["Sort: ",n.replace("_"," ")]}),(0,i.Y)("button",{type:"button",onClick:x,className:"hover:text-ink ml-0.5",title:"Reset sort",children:(0,i.Y)(Y.A,{size:10})})]}),a&&(0,i.FD)("span",{className:"inline-flex items-center space-x-1 bg-amber-500/15 border border-amber-500/25 text-amber-900 rounded-lg px-2 py-0.5 text-[10px] font-mono",children:[(0,i.Y)(D.A,{size:10}),(0,i.Y)("span",{children:"Archived"}),(0,i.Y)("button",{type:"button",onClick:u,className:"hover:text-amber-950 ml-0.5",title:"Hide archived",children:(0,i.Y)(Y.A,{size:10})})]})]})]})}var j=n("qn"),T=n("vZ"),O=n("Sj"),W=n("Nf"),P=n("t"),R=n("b"),$=n("HZ"),E=n("P6");function I(e){let{session:t,isActive:n,status:s,timeAgo:a,showTreeGlyph:l=!1,onSelect:r,onArchive:o,onRename:c}=e,{isEditing:d,draft:h,setDraft:m,inputRef:x,startRename:f,handleKeyDown:u,handleBlur:b}=(0,E.B)(t.title,c);return d?(0,i.Y)("div",{className:"w-full rounded-lg flex items-center bg-ink/10",children:(0,i.Y)("input",{ref:x,autoFocus:!0,value:h,onChange:e=>m(e.currentTarget.value),onKeyDown:u,onBlur:b,className:"flex-1 min-w-0 mx-2 my-1.5 bg-paper border border-ink/25 rounded px-2 py-1 text-xs text-ink outline-none focus:border-ink/50"})}):(0,i.FD)("div",{className:`w-full rounded-lg flex items-center transition-colors ${n?"bg-ink/10 font-medium text-ink":"hover:bg-ink/5 text-ink/85"}`,children:[(0,i.FD)("button",{type:"button",onClick:r,className:"flex-1 text-left px-3 py-2 flex items-center justify-between min-w-0",children:[(0,i.FD)("div",{className:"flex items-center space-x-1.5 min-w-0 pr-2",children:[(0,i.FD)("span",{className:"w-4 flex-shrink-0 flex items-center justify-center",children:["stream"===s&&(0,i.Y)(P.A,{size:13,className:"text-ink/50 animate-spin"}),("finish"===s||"abort"===s)&&(0,i.Y)(p.A,{size:13,className:"text-ink/50"})]}),l&&(0,i.Y)("span",{className:"text-ink/40 text-xs flex-shrink-0 font-mono",children:">"}),(0,i.Y)("span",{className:"text-xs truncate leading-snug",children:t.title.charAt(0).toUpperCase()+t.title.slice(1)})]}),(0,i.Y)("span",{className:"text-[11px] text-ink/45 font-mono flex-shrink-0 ml-2",children:a??""})]}),c&&(0,i.Y)("button",{type:"button",onClick:f,title:"Rename session",className:"flex-shrink-0 p-2 text-ink/35 hover:text-ink rounded-lg cursor-pointer",children:(0,i.Y)(R.A,{size:14})}),(0,i.Y)("button",{type:"button",onClick:o,title:1===t.is_archived?"Unarchive session":"Archive session",className:"flex-shrink-0 p-2 mr-1 text-ink/35 hover:text-ink rounded-lg cursor-pointer",children:1===t.is_archived?(0,i.Y)($.A,{size:14}):(0,i.Y)(D.A,{size:14})})]})}var J=n("C4"),M=n("NR"),U=n("U"),L=n("A");function K(e){let{folder:t,activeSessionId:n,onSelectSession:a,isExpanded:l,onToggleExpand:r,showArchived:o=!1,sessionStatus:d={}}=e,{visibleCount:p,showMore:h}=(0,M.y)(),{refresh:x}=(0,f.k)(),[u,b]=(0,s.J0)(!1),g=(0,s.li)(null),{confirmDelete:k,requestDelete:v,cancelDelete:N,handlePin:Y,handleDelete:w,handleArchive:y,handleRename:F}=(0,U.C)(t,x);(0,m.W)(g,()=>{b(!1),N()});let S=(t.sessions||[]).filter(e=>o?1===e.is_archived:1!==e.is_archived),D=S.slice(0,p),C=(0,L.x)(t.icon);return(0,i.FD)("div",{className:"mb-4",children:[(0,i.FD)("div",{onClick:r,className:"flex items-center justify-between px-3 py-2 cursor-pointer hover:bg-ink/5 rounded-lg select-none transition-colors",children:[(0,i.FD)("div",{className:"flex items-center space-x-2 min-w-0",children:[t.customIconUrl?(0,i.Y)("img",{src:t.customIconUrl,alt:"",className:"w-[15px] h-[15px] rounded-xs object-contain flex-shrink-0",referrerPolicy:"no-referrer"}):"chat"===t.iconType?(0,i.Y)(j.A,{size:15,className:"text-ink/80 flex-shrink-0"}):(0,i.Y)(C,{size:15,className:"text-ink/80 flex-shrink-0",style:{color:t.accentColor||void 0}}),(0,i.Y)("span",{className:"text-sm font-semibold text-ink truncate",children:t.name})]}),(0,i.FD)("div",{className:"flex items-center space-x-2 text-xs text-ink/60",children:[(0,i.Y)("span",{className:"font-mono text-[11px] text-ink/70",children:S.length}),t.project_path&&(0,i.Y)(T.A,{size:13,className:"text-ink/50 ml-1"}),(0,i.FD)("div",{className:"relative flex items-center",ref:g,onClick:e=>e.stopPropagation(),children:[(0,i.Y)("button",{type:"button",onClick:e=>{e.stopPropagation(),b(e=>!e)},className:"p-1.5 rounded-lg hover:bg-ink/10 active:bg-ink/15 text-ink/60 hover:text-ink",title:"Workspace options","aria-label":`Options for ${t.name}`,children:(0,i.Y)(O.A,{size:15})}),u&&(0,i.Y)("div",{className:"absolute right-0 top-full mt-1 w-48 bg-paper border border-ink/15 rounded-lg shadow-lg z-50 py-1 text-xs",children:(0,i.Y)(J.t,{variant:"mobile",isPinned:t.isPinned,confirmDelete:k,onPin:()=>{Y(),b(!1)},onDelete:()=>{w(),b(!1)},onRequestDelete:v,onCancelDelete:N})})]}),l?(0,i.Y)(c.A,{size:14}):(0,i.Y)(W.A,{size:14})]})]}),l&&(0,i.FD)("div",{className:"mt-0.5 space-y-0.5 pl-2",children:[D.map(e=>(0,i.Y)(I,{session:e,isActive:String(n)===String(e.id),status:d[String(e.id)],timeAgo:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();if(null==e||""===e)return null;let n="number"==typeof e?e:Date.parse(e);if(Number.isNaN(n))return null;let i=Math.round((t-n)/1e3);if(i<45)return"now";let s=Math.round(i/60);if(s<60)return`${s}m`;let a=Math.round(s/60);if(a<24)return`${a}h`;let l=Math.round(a/24);if(l<7)return`${l}d`;let r=Math.round(l/7);if(r<5)return`${r}w`;let o=new Date(n),c=o.getFullYear()===new Date(t).getFullYear(),d=o.getDate(),p=o.toLocaleString("en-US",{month:"short"});return c?`${d} ${p}`:`${d} ${p} ${o.getFullYear()}`}(e.updated_at??e.created_at),onSelect:()=>a(e.id),onArchive:()=>y(e),onRename:String(e.id).startsWith("new-")?void 0:t=>void F(e,t)},e.id)),S.length>p&&(0,i.FD)("button",{type:"button",onClick:h,className:"w-full text-left px-3 py-2 text-xs text-ink/60 hover:text-ink flex items-center space-x-1.5",children:[(0,i.Y)(c.A,{size:12,className:"w-4 flex-shrink-0"}),(0,i.FD)("span",{children:["Show more sessions (",S.length-p,")"]})]})]})]})}var H=n("jo");function B(e){let{folders:t,activeSessionId:n,expandedFolders:s,showArchived:a,sessionStatus:l,isScrolling:r,onScroll:o,onSelectSession:c,onToggleFolder:d}=e;return(0,i.Y)("div",{onScroll:o,className:`flex-1 scrollbar-overlay-container p-3 ${(0,H.p)(r)}`,children:0===t.length?(0,i.Y)("div",{className:"text-center py-12 text-xs text-ink/50 italic",children:"No matching sessions found"}):t.map(e=>(0,i.Y)(K,{folder:e,activeSessionId:n,onSelectSession:c,isExpanded:s[e.id]??!0,onToggleExpand:()=>d(e.id),showArchived:a,sessionStatus:l},e.id))})}var _=n("vB"),Z=n("wU"),G=n("mX"),q=n("P");function V(e){let{onSettings:t,onAbout:n,updateAvailable:s,onUpdateClick:a,onDesktopToggle:l}=e;return(0,i.FD)("div",{className:"px-3 pt-3 border-t border-ink/10 flex items-center justify-between flex-shrink-0 bg-canvas text-xs text-ink/60",style:{paddingBottom:"max(0.75rem, env(safe-area-inset-bottom, 0px))"},children:[(0,i.FD)("div",{className:"flex items-center space-x-3",children:[(0,i.FD)("button",{type:"button",onClick:t,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[(0,i.Y)(_.A,{size:14}),(0,i.Y)("span",{children:"Settings"})]}),(0,i.FD)("button",{type:"button",onClick:n,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[(0,i.Y)(Z.A,{size:14}),(0,i.Y)("span",{children:"About"})]}),l&&(0,i.FD)("button",{type:"button",onClick:l,className:"flex items-center space-x-1 hover:text-ink transition-colors",title:"Switch to desktop view",children:[(0,i.Y)(G.A,{size:14}),(0,i.Y)("span",{children:"Desktop"})]})]}),(0,i.FD)("div",{className:"flex items-center gap-2",children:[(0,i.FD)("span",{className:"font-mono text-[10px] text-ink/40",children:["v",q.rE]}),s&&(0,i.Y)("button",{type:"button",onClick:a,className:"px-2 py-0.5 rounded-full border border-ink/20 text-[10px] font-semibold text-ink hover:border-ink/40",children:"update"})]})]})}var X=n("wu"),Q=n("g"),ee=n("oZ"),et=n("DO"),en=n("z4");let ei=[3,2];function es(){return(0,i.Y)("div",{className:"flex-1 p-3 space-y-4","aria-hidden":"true",children:ei.map((e,t)=>(0,i.FD)("div",{className:"space-y-2",children:[(0,i.FD)("div",{className:"flex items-center gap-2 px-1 py-2",children:[(0,i.Y)("span",{className:"w-4 h-4 rounded-sm animate-pulse bg-ink/10"}),(0,i.Y)("span",{className:"h-3 w-24 rounded animate-pulse bg-ink/10"})]}),Array.from({length:e},(e,t)=>(0,i.FD)("div",{className:"flex items-center gap-2 rounded px-2 py-2",children:[(0,i.Y)("span",{className:"w-4 h-4 rounded-full animate-pulse bg-ink/10"}),(0,i.Y)("span",{className:"h-3 rounded animate-pulse bg-ink/10",style:{width:`${58-t%3*12}%`}})]},t))]},t))})}function ea(e){let{activeSessionId:t,onSelectSession:n,onNewSession:a,onCreateFolder:l,onClose:r,onDesktopToggle:o,appSettings:c={}}=e,{folders:d,initializing:p,searchQuery:h,setSearchQuery:x,showArchived:f,setShowArchived:u,optionsOpen:b,setOptionsOpen:g,sortOption:k,handleSortChange:v,processedFolders:N,sessionStatus:Y,handleSelectSession:y}=(0,en.K)(c,{onSelectSession:n,onAfterSelect:r}),[F,S]=(0,s.J0)({1:!0,2:!0,3:!0}),[D,C]=(0,s.J0)(!1),[A,j]=(0,s.J0)(!1),[T,O]=(0,s.J0)(!1),W=(0,et.M)(),{toasts:P,pushToast:R,dismissToast:$}=(0,ee.Y)(),E=(0,s.li)(null);(0,m.W)(E,()=>g(!1));let{isScrolling:I,handleScroll:J}=(0,H.K)();return(0,s.vJ)(()=>{S(Object.fromEntries(d.map(e=>[e.id,e.isExpanded])))},[d]),(0,i.FD)("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative select-none",children:[(0,i.Y)(w,{onClose:r}),(0,i.Y)(z,{searchQuery:h,sortOption:k,optionsOpen:b,showArchived:f,optionsRef:E,onNewSession:()=>{a(),r()},onNewWorkspace:()=>C(!0),onScheduler:()=>j(!0),onToggleOptions:()=>g(!b),onSortChange:v,onResetSort:()=>v("A-Z"),onToggleArchived:()=>{u(!f),g(!1)},onHideArchived:()=>u(!1),onSearchChange:x,onClearSearch:()=>x("")}),p?(0,i.Y)(es,{}):(0,i.Y)(B,{folders:N,activeSessionId:t,expandedFolders:F,showArchived:f,sessionStatus:Y,isScrolling:I,onScroll:J,onSelectSession:y,onToggleFolder:e=>{S(t=>({...t,[e]:!t[e]}));let t=d.find(t=>t.id===e),n=!(F[e]??t?.isExpanded??!0);fetch(`/api/folders/${e}/toggle`,{method:"POST",body:new URLSearchParams({isExpanded:String(n)})}).then(t=>{if(!t.ok)throw Error(`HTTP ${t.status}`);window.dispatchEvent(new CustomEvent("omp:workspace-updated",{detail:{folderId:e}}))}).catch(e=>{console.error("Failed to save mobile workspace state:",e)})}}),(0,i.Y)(V,{onSettings:()=>window.dispatchEvent(new CustomEvent("omp:open-settings",{detail:{}})),onAbout:()=>O(!0),onDesktopToggle:o,updateAvailable:W.hasUpdate,onUpdateClick:()=>{O(!0),W.check()}}),(0,i.Y)(Q.xV,{isOpen:D,onClose:()=>C(!1),onCreate:l}),(0,i.Y)(Q.Lo,{isOpen:A,onClose:()=>j(!1)}),(0,i.Y)(Q.VT,{isOpen:T,onClose:()=>O(!1),updates:W,onToast:R}),(0,i.Y)(X.y,{toasts:P,onDismiss:$})]})}var el=n("G"),er=n("oE"),eo=n("Asb"),ec=n("N"),ed=n("Oj"),ep=n("lW"),eh=n("SJ"),em=n("nG"),ex=n("so"),ef=n("ET");let eu={context:{title:"Context & Telemetry",label:"Context",icon:(0,i.Y)(er.A,{size:14,className:"flex-shrink-0"})},files:{title:"Files Explorer",label:"Files",icon:(0,i.Y)(eo.A,{size:14,className:"flex-shrink-0"})},search:{title:"Search Workspace",label:"Search",icon:(0,i.Y)(C.A,{size:14,className:"flex-shrink-0"})},git:{title:"GIT",label:"GIT",icon:(0,i.Y)(T.A,{size:14,className:"flex-shrink-0"})},terminal:{title:"Bun Terminal",label:"Terminal",icon:(0,i.Y)(ec.A,{size:14,className:"flex-shrink-0"})},"user-browser":{title:"Browser (Anda)",label:"Browser",icon:(0,i.Y)(ed.A,{size:14,className:"flex-shrink-0"})},browser:{title:"Browser Agent",label:"Agent",icon:(0,i.Y)(ep.A,{size:14,className:"flex-shrink-0"})},usage:{title:"Usage",label:"Usage",icon:(0,i.Y)(eh.A,{size:14,className:"flex-shrink-0"})}};function eb(e){let{enabled:t=!0,rootPath:n,refreshKey:a=0,onRefresh:l,onOpenFile:r,onClose:o}=e,[c,d]=(0,s.J0)("files"),{changes:p}=(0,ex.e)(n,".",a,t,15e3),h=p.length>0;return(0,i.FD)("div",{className:"flex flex-col h-full w-full bg-paper text-ink relative select-none",children:[(0,i.FD)("div",{className:"border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0 bg-canvas",style:{height:"calc(3.5rem + env(safe-area-inset-top, 0px))",paddingTop:"env(safe-area-inset-top, 0px)",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px))"},children:[(0,i.Y)("div",{className:"flex items-center space-x-1.5 overflow-x-auto no-scrollbar py-1",children:ef.G7.map(e=>(0,i.FD)("button",{type:"button",onClick:()=>d(e),className:`relative flex items-center transition-all cursor-pointer ${c===e?"space-x-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold bg-ink text-canvas shadow-sm":"p-2 rounded-lg text-ink/70 hover:bg-ink/5"}`,title:eu[e].title,children:[eu[e].icon,c===e&&(0,i.Y)("span",{className:"git"===e?"tracking-wide":void 0,children:eu[e].label}),"git"===e&&h&&(0,i.Y)("span",{className:"absolute top-1 right-1 w-1.5 h-1.5 rounded-full bg-info",title:"Uncommitted changes"})]},e))}),(0,i.Y)("button",{type:"button",onClick:o,className:"p-1.5 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0 ml-2",title:"Close right sidebar","aria-label":"Close right sidebar",children:(0,i.Y)(Y.A,{size:20,strokeWidth:1.8})})]}),(0,i.Y)("div",{className:"flex-1 min-h-0 overflow-hidden relative",style:{paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:t?(0,i.Y)(i.FK,{children:(0,i.FD)(el.tY,{fallback:(0,i.Y)("div",{className:"h-full flex items-center justify-center text-ink/40",children:(0,i.Y)("span",{className:"text-xs font-mono",children:"Loading…"})}),children:["files"===c&&(0,i.Y)(em.gI,{className:"h-full w-full",enabled:t,rootPath:n,refreshKey:a,onRefresh:l,onOpenFile:r}),"search"===c&&(0,i.Y)(em.N1,{className:"h-full w-full",enabled:t,rootPath:n}),"git"===c&&(0,i.Y)(em.nR,{className:"h-full w-full",enabled:t,rootPath:n,refreshKey:a}),"context"===c&&(0,i.Y)(em.ov,{className:"h-full w-full",enabled:t,refreshKey:a,onClose:o}),"terminal"===c&&(0,i.Y)(em.Bz,{className:"h-full w-full",enabled:t,rootPath:n,showHeader:!1}),"user-browser"===c&&(0,i.Y)(em.M,{className:"h-full w-full"}),"browser"===c&&(0,i.Y)(em.XL,{className:"h-full w-full",active:!0}),"usage"===c&&(0,i.Y)(em.WE,{className:"h-full w-full"})]})}):(0,i.Y)("div",{className:"h-full flex items-center justify-center text-ink/40",children:(0,i.Y)("span",{className:"text-xs font-mono",children:"No session selected"})})})]})}var eg=n("E6"),ek=n("rz"),ev=n("uf"),eN=n("hR"),eY=n("Kv"),ew=n("Soe"),ey=n("bH"),eF=n("yh"),eS=n("hj"),eD=n("na"),eC=n("b0"),eA=n("tC"),ez=n("pX");function ej(e){let{fileName:t,isMarkdown:n,isPreview:s,wordWrap:a,copied:l,isImage:r=!1,onClose:o,onTogglePreview:c,onToggleWrap:d,onZoomOut:h,onZoomIn:m,onCopy:x,onDownload:f}=e;return(0,i.FD)("header",{className:"bg-canvas border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0",style:{height:"calc(3rem + env(safe-area-inset-top, 0px))",paddingTop:"env(safe-area-inset-top, 0px)",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px))"},children:[(0,i.FD)("div",{className:"flex items-center space-x-2 min-w-0 pr-2",children:[(0,i.Y)("button",{type:"button",onClick:o,className:"p-1.5 rounded-lg hover:bg-ink/10 text-ink transition-colors active:scale-90 flex-shrink-0 cursor-pointer",title:"Close editor","aria-label":"Close editor",children:(0,i.Y)(eY.A,{size:18,strokeWidth:2})}),(0,i.FD)("div",{className:"flex items-center space-x-1.5 truncate",children:[(0,i.Y)(ez.o,{name:t,size:15,className:"flex-shrink-0"}),(0,i.Y)("span",{className:"font-semibold text-xs text-ink truncate",children:t})]})]}),(0,i.FD)("div",{className:"flex items-center space-x-1 text-ink/70 flex-shrink-0",children:[n&&(0,i.Y)("button",{type:"button",onClick:c,className:`p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer ${s?"bg-ink text-canvas":""}`,title:s?"View code":"Preview markdown",children:s?(0,i.Y)(ew.A,{size:15}):(0,i.Y)(ey.A,{size:15})}),!r&&(0,i.FD)(i.FK,{children:[(0,i.Y)("button",{type:"button",onClick:d,className:`p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer ${a?"text-ink":""}`,title:"Toggle word wrap",children:(0,i.Y)(eF.A,{size:15})}),(0,i.Y)("button",{type:"button",onClick:h,className:"p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer",title:"Decrease font size",children:(0,i.Y)(eS.A,{size:15})}),(0,i.Y)("button",{type:"button",onClick:m,className:"p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer",title:"Increase font size",children:(0,i.Y)(eD.A,{size:15})})]}),(0,i.Y)("button",{type:"button",onClick:x,className:"p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer",title:"Copy content",children:l?(0,i.Y)(p.A,{size:15,className:"text-success"}):(0,i.Y)(eC.A,{size:15})}),(0,i.Y)("button",{type:"button",onClick:f,className:"p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer",title:"Download file",children:(0,i.Y)(eA.A,{size:15})})]})]})}var eT=n("HQ");function eO(e){let{file:t,onClose:n,onFileSaved:a}=e,[l,r]=(0,s.J0)(t.name.endsWith(".md")),[o,c]=(0,s.J0)(12),[d,p]=(0,s.J0)(!0),{isScrolling:h,handleScroll:m}=(0,H.K)(),x=t.name.endsWith(".md"),f=(0,eT.n)(t,{reportLoadError:!0,flushOnUnmount:!0,reportSaveError:!0,downloadMimeType:"text/plain;charset=utf-8",onFileSaved:a}),u=f.content,b=f.language,g=u.split("\n").length;return(0,i.FD)("div",{className:"fixed inset-x-0 top-0 h-dvh z-[60] bg-paper flex flex-col font-mono text-xs select-none",children:[(0,i.Y)(ej,{fileName:t.name,isMarkdown:x,isPreview:l,wordWrap:d,copied:f.copied,isImage:f.isImage,onClose:n,onTogglePreview:()=>r(!l),onToggleWrap:()=>p(!d),onZoomOut:()=>c(e=>Math.max(10,e-1)),onZoomIn:()=>c(e=>Math.min(18,e+1)),onCopy:f.copy,onDownload:f.download}),f.isImage&&f.imageUrl?(0,i.Y)(eN.a,{src:f.imageUrl,name:t.name,className:"flex-1 min-h-0"}):(0,i.Y)("div",{onScroll:m,className:`flex-1 min-h-0 overflow-auto relative bg-paper text-ink select-text ${(0,H.p)(h)}`,children:f.isLoading?(0,i.FD)("div",{className:"flex items-center justify-center h-full text-ink/40 text-xs gap-2",children:[(0,i.Y)(P.A,{size:14,className:"animate-spin"}),(0,i.Y)("span",{children:"Loading file content..."})]}):f.loadError?(0,i.FD)("div",{className:"flex flex-col items-center justify-center h-full gap-2 px-6 text-center",children:[(0,i.Y)(eg.A,{size:20,className:"text-error"}),(0,i.FD)("span",{className:"text-xs text-error font-sans",children:["Could not read ",t.name]}),(0,i.Y)("span",{className:"text-[11px] text-ink/50 font-mono break-all",children:f.loadError})]}):x&&l?(0,i.Y)("div",{className:"p-4 bg-paper text-ink min-h-full font-sans",children:(0,i.Y)(ek.T,{content:u,document:!0,scope:{path:t.path??t.name,root:t.root,repo:t.repo}})}):(0,i.Y)(ev.P,{value:u,onValueChange:f.onChange,language:b,wordWrap:d,rootClassName:"flex min-h-full bg-paper",gutterClassName:"w-10 py-3 pr-2 select-none text-right text-[10px] text-ink/30 bg-canvas border-r border-ink/10 font-mono leading-[20px] flex-shrink-0",editorWrapperClassName:"flex-1 p-3 overflow-x-auto min-w-0 bg-paper text-ink code-surface",editorClassName:"focus:outline-none",editorStyle:{fontFamily:"monospace",fontSize:`${o}px`,lineHeight:"20px",backgroundColor:"transparent",minHeight:"100%",color:"var(--theme-ink)"}})}),(0,i.FD)("footer",{className:"bg-canvas border-t border-ink/10 px-3 flex items-center justify-between text-[10px] text-ink/60 flex-shrink-0 font-mono",style:{height:"calc(1.75rem + env(safe-area-inset-bottom, 0px))",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px))"},children:[(0,i.Y)("div",{className:"flex items-center space-x-3",children:f.isImage?(0,i.Y)("span",{className:"uppercase",children:"Image"}):(0,i.FD)(i.FK,{children:[(0,i.FD)("span",{children:[g," lines"]}),(0,i.FD)("span",{children:[u.length," chars"]}),(0,i.Y)("span",{className:"uppercase",children:b})]})}),(0,i.FD)("div",{className:"flex items-center space-x-2",children:["saving"===f.saveStatus&&(0,i.FD)(i.FK,{children:[(0,i.Y)(P.A,{size:10,className:"animate-spin"}),(0,i.Y)("span",{children:"Saving…"})]}),"saved"===f.saveStatus&&(0,i.FD)(i.FK,{children:[(0,i.Y)("span",{className:"w-1.5 h-1.5 rounded-full bg-success"}),(0,i.Y)("span",{children:"Saved"})]}),"error"===f.saveStatus&&(0,i.FD)(i.FK,{children:[(0,i.Y)("span",{className:"w-1.5 h-1.5 rounded-full bg-error"}),(0,i.Y)("span",{className:"text-error",children:"Save failed"})]}),"idle"===f.saveStatus&&t.path&&(0,i.Y)("span",{className:"truncate max-w-[140px]",children:t.path})]})]})]})}var eW=n("Xg"),eP=n("LQ");function eR(e){let{diff:t,onClose:n,onFileSaved:s}=e,a=t.path.split("/").pop()||t.path,l=!!t.staged,r=t.status||"M",o=(0,eP.R)(r,l);return(0,i.FD)("div",{className:"fixed inset-x-0 top-0 h-dvh z-[60] bg-paper flex flex-col",children:[(0,i.FD)("header",{className:"bg-canvas border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0",style:{height:"calc(3rem + env(safe-area-inset-top, 0px))",paddingTop:"env(safe-area-inset-top, 0px)",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px))"},children:[(0,i.FD)("div",{className:"flex items-center space-x-2 min-w-0 pr-2",children:[(0,i.Y)("button",{type:"button",onClick:n,className:"p-1.5 -ml-1 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0",title:"Back","aria-label":"Close diff",children:(0,i.Y)(eY.A,{size:18,strokeWidth:1.9})}),(0,i.Y)(ez.o,{name:a,size:14,className:"flex-shrink-0"}),(0,i.Y)("span",{className:"font-mono text-xs text-ink font-medium truncate",title:t.path,children:a})]}),(0,i.FD)("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold rounded border flex-shrink-0 ${o.badgeBgClass}`,children:[o.charStatus," ",o.label]})]}),(0,i.Y)("div",{className:"flex-1 min-h-0",children:(0,i.Y)(eW.M,{className:"h-full",filePath:t.path,status:r,isStaged:l,root:t.root,repo:t.repo||".",onFileSaved:s})})]})}var e$=n("u"),eE=n("Gb"),eI=n("wm");function eJ(e){let{onDesktopToggle:t,appSettings:n={}}=e,{folders:r}=(0,f.k)(),[o,c]=(0,a.o)(),d=o.get("sessionId"),p=d?Number.isNaN(Number(d))?d:Number(d):null,h=o.get("folderId"),m=h?Number.isNaN(Number(h))?h:Number(h):null,[x,u]=(0,s.J0)("main"),[b,g]=(0,s.J0)(null),[k,v]=(0,s.J0)(null),[Y,w]=(0,s.J0)(0),[y,F]=(0,s.J0)(!1),[S,D]=(0,s.J0)("appearance"),[C,A]=(0,s.J0)(!1),z=(0,s.hb)(()=>w(e=>e+1),[]),{folder:j}=(0,eE.t)(r,p),T=j??(m?r.find(e=>String(e.id)===String(m))??null:null),O=T?.project_path??null,W=!!T;(0,l.sY)("omp:open-file",e=>{if(!e.detail||!e.detail.path)return;let t=e.detail.path.replace(/^\/+/,"");g({name:e.detail.name||t.split("/").pop()||"file",path:t,content:e.detail.content,root:e.detail.root})}),(0,l.sY)("omp:open-diff",e=>{let t=e.detail;t?.file&&v({path:t.file.replace(/^\/+/,""),status:t.status,staged:t.staged,repo:t.repo,root:t.root??O??void 0})}),(0,l.sY)("omp:open-settings",e=>{let t=e.detail;D(t?.category??"appearance"),A(!!t?.autoOpenAdd),F(!0)});let P=e=>{c(t=>(t.set("sessionId",e.toString()),t.has("subagent")&&t.delete("subagent"),t),{replace:!0}),u("main")},R=()=>{let e=(0,eI.l)(r,d,m??void 0);e&&(0,eI.r)(e),c(e=>{let t=e.get("sessionId"),n=new URLSearchParams(e);if(n.set("sessionId",`new-${Date.now()}`),t){let e=r.find(e=>e.sessions?.some(e=>String(e.id)===String(t)));e&&n.set("folderId",e.id.toString())}return n},{replace:!0}),u("main")},$=async e=>{let t=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>({}));if(!t.ok||!n.success)throw Error(n.error||`HTTP ${t.status}`);window.location.reload()},E=(0,s.hb)(e=>{let t=(e?.path||"").replace(/^\/+/,"");g({name:e?.name||t.split("/").pop()||"file",path:t,content:e?.content,root:e?.root??O??void 0})},[O]);return(0,i.FD)("div",{className:"flex flex-col h-dvh w-screen overflow-hidden bg-canvas text-ink font-sans selection:bg-ink selection:text-canvas relative",children:[(0,i.Y)("div",{className:`flex-1 min-h-0 w-full ${"main"===x?"block":"hidden"}`,children:(0,i.Y)(N,{activeSessionId:p,onSelectSession:P,onNewSession:R,onOpenSessionSidebar:()=>u("session"),onOpenRightSidebar:()=>u("right"),appSettings:n})}),(0,i.Y)("div",{className:`flex-1 min-h-0 w-full ${"session"===x?"block":"hidden"}`,children:(0,i.Y)(ea,{activeSessionId:p,onSelectSession:P,onNewSession:R,onCreateFolder:$,onClose:()=>u("main"),onDesktopToggle:t,appSettings:n})}),"right"===x&&(0,i.Y)("div",{className:"flex-1 min-h-0 w-full",children:(0,i.Y)(eb,{enabled:W,rootPath:O??void 0,refreshKey:Y,onRefresh:z,onOpenFile:E,onClose:()=>u("main")})}),b&&(0,i.Y)(eO,{file:b,onClose:()=>g(null),onFileSaved:z}),k&&(0,i.Y)(eR,{diff:k,onClose:()=>v(null),onFileSaved:z}),(0,i.Y)(e$.b,{isOpen:y,onClose:()=>{F(!1),A(!1)},initialCategory:S,autoOpenAddProvider:C,appSettings:n})]})}},qn(e,t,n){let i=(0,n("y").A)({name:"message-square",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]});n.d(t,{},{A:i})},mX(e,t,n){let i=(0,n("y").A)({name:"monitor",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]});n.d(t,{},{A:i})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["h1"],{PZ(a,r,h){var s=h("a6");h("VV8"),h("OT"),h("WJ"),h("Wf"),h("mW"),h("Q"),h("v0"),h("ix"),h("LC"),h("bQ"),h("Ut"),h("PF"),h("iV"),h("h5"),h("pK"),h("NH"),h("Yr"),h("M4"),h("Gt"),h.d(r,{diagram:()=>s.AC})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["jl"],{qL(e,t,n){var r=n("LC"),o=n("Gt");function l(e){let t=[];for(let n=0;n<e.length-1;n++)t.push({a:e[n],b:e[n+1]});return t}function i(e,t,n,r){let o=t.x-e.x,l=t.y-e.y,i=r.x-n.x,a=r.y-n.y,s=o*a-l*i;if(0===s)return null;let f=n.x-e.x,d=n.y-e.y,u=(f*a-d*i)/s,h=(f*l-d*o)/s;return u<=1e-6||u>=1-1e-6||h<=1e-6||h>=1-1e-6?null:{point:{x:e.x+u*o,y:e.y+u*l},tA:u,tB:h}}function a(e){return Math.abs(e.b.x-e.a.x)>=Math.abs(e.b.y-e.a.y)}function s(e,t,n){if("rounded"!==e.curve)return!1;let r=e.points,o=r[t],l=r[t+1];if(!o||!l)return!1;let i=Math.hypot(l.x-o.x,l.y-o.y),a=n*i,s=t>0?p(r[t-1],o,l,5):null;if(s&&a<s.cutLen)return!0;let f=t+2<r.length?p(o,l,r[t+2],5):null;return null!==f&&i-a<f.cutLen}function f(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],o=l(r.points);for(let f=n+1;f<e.length;f++){let n=e[f],d=l(n.points);for(let[e,l]of o.entries())for(let[o,f]of d.entries()){let d=i(l.a,l.b,f.a,f.b);if(!d||s(r,e,d.tA)||s(n,o,d.tB))continue;let u=a(l);u!==a(f)&&u?t.push({jumpEdgeId:r.id,otherEdgeId:n.id,segIndex:e,t:d.tA,point:d.point}):t.push({jumpEdgeId:n.id,otherEdgeId:r.id,segIndex:o,t:d.tB,point:d.point})}}}return t}function d(e){let t=Math.round(1e3*e)/1e3;return Number.isInteger(t),`${t}`}function u(e){return`${d(e.x)},${d(e.y)}`}function h(e){let t=e.b.x-e.a.x,n=e.b.y-e.a.y;return Math.abs(t)>=Math.abs(n)?+(t>=0):+(n>=0)}function g(e,t){if(e.length<2)return e.map(e=>({...e}));let n=e.map(e=>({...e})),o=t.arrowTypeStart&&r.hq[t.arrowTypeStart];if(o){let t=e[0],r=e[1],l=Math.atan2(r.y-t.y,r.x-t.x);n[0].x=t.x+o*Math.cos(l),n[0].y=t.y+o*Math.sin(l)}let l=t.arrowTypeEnd&&r.hq[t.arrowTypeEnd];if(l){let t=e.length,r=e[t-2],o=e[t-1],i=Math.atan2(o.y-r.y,o.x-r.x);n[t-1].x=o.x-l*Math.cos(i),n[t-1].y=o.y-l*Math.sin(i)}return n}function c(e,t,n,r,o){let l=e.point.x,i=e.point.y,a={x:l-t*e.r,y:i-n*e.r},s={x:l+t*e.r,y:i+n*e.r},f=[`L${u(a)}`];return"arc"===o?f.push(`A${d(e.r)},${d(e.r)} 0 0 ${r} ${u(s)}`):f.push(`M${u(s)}`),f}function p(e,t,n,r){let o=t.x-e.x,l=t.y-e.y,i=n.x-t.x,a=n.y-t.y,s=Math.hypot(o,l),f=Math.hypot(i,a);if(s<1e-5||f<1e-5)return null;let d=o/s,u=l/s,h=i/f,g=a/f,c=Math.acos(Math.max(-1,Math.min(1,d*h+u*g)));if(c<1e-5||1e-5>Math.abs(Math.PI-c))return null;let p=Math.min(r/Math.sin(c/2),s/2,f/2);return{startX:t.x-d*p,startY:t.y-u*p,endX:t.x+h*p,endY:t.y+g*p,ctrlX:t.x,ctrlY:t.y,cutLen:p}}function x(e,t,n){let r=e.points;if(r.length<2)return"";let o=g(r,e),i="rounded"===e.curve,a=l(o),s=new Map;for(let e of t){let t=a[e.segIndex];if(!t)continue;let r=Math.hypot(t.b.x-t.a.x,t.b.y-t.a.y),o=s.get(e.segIndex)??[];o.push({t:e.t,point:e.point,d:e.t*r,r:n.jumpRadius}),s.set(e.segIndex,o)}let f=[`M${u(o[0])}`];for(let e=0;e<a.length;e++){let t=a[e],r=Math.hypot(t.b.x-t.a.x,t.b.y-t.a.y),l=0===r?0:(t.b.x-t.a.x)/r,g=0===r?0:(t.b.y-t.a.y)/r,x=h(t),m=0;if(i&&e>0){let t=p(o[e-1],o[e],o[e+1]??o[e],5);t&&(m=t.cutLen)}let y=r,b=null;i&&e<a.length-1&&(b=p(o[e],o[e+1],o[e+2]??o[e+1],5))&&(y=r-b.cutLen);let M=.6*n.jumpRadius,K=[...s.get(e)??[]].sort((e,t)=>e.t-t.t).filter(e=>{let t=Math.min(e.d-m,y-e.d)-2;return e.r=Math.min(e.r,t),e.r>=M});for(let e=0;e<K.length-1;e++){let t=K[e+1].d-K[e].d;if(K[e].r+K[e+1].r>t){let n=t/2;K[e].r=Math.min(K[e].r,n),K[e+1].r=Math.min(K[e+1].r,n)}}for(let e of K)e.r<M||f.push(...c(e,l,g,x,n.jumpStyle));i&&b?(f.push(`L${d(b.startX)},${d(b.startY)}`),f.push(`Q${d(b.ctrlX)},${d(b.ctrlY)} ${d(b.endX)},${d(b.endY)}`)):f.push(`L${u(t.b)}`)}return f.join(" ")}function m(e){return/^[\d\s+,.LMelm-]*$/.test(e)}function y(e){return!e||"linear"===e||"rounded"===e||"step"===e||"stepBefore"===e||"stepAfter"===e}function b(e){if(!e)return null;try{let t="function"==typeof atob?atob(e):Buffer.from(e,"base64").toString(),n=JSON.parse(t);if(!Array.isArray(n))return null;let r=[];for(let e of n)e&&"number"==typeof e.x&&"number"==typeof e.y&&r.push({x:e.x,y:e.y});return r.length>=2?r:null}catch{return null}}function M(e,t,n){if(!n.enabled)return;let r=e.node();if(!r)return;let o=new Map;for(let e of t)o.set(e.id,e);let l=new Map;for(let e of r.querySelectorAll("path[data-id]")){let t=e.getAttribute("data-id");null===t||l.has(t)||l.set(t,e)}let i=[];for(let e of t){let t=l.get(e.id);if(!t)continue;let n=b(t.getAttribute("data-points"))??e.points;i.push({...e,points:n})}let a=f(i);if(0===a.length)return;let s=new Map;for(let e of a){let t=s.get(e.jumpEdgeId)??[];t.push(e),s.set(e.jumpEdgeId,t)}for(let e of i){let t=s.get(e.id);if(!t||0===t.length)continue;let r=o.get(e.id),i=r?.curve;if(void 0!==i&&!y(i))continue;let a=l.get(e.id);if(!a||void 0===i&&!m(a.getAttribute("d")??""))continue;let f=a.getAttribute("style")??"",d=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(f),u=d?Number.parseFloat(d[1]):null,h=d?Number.parseFloat(d[2]):null,g=x(e,t,n);if(a.setAttribute("d",g),null!==u&&null!==h&&"function"==typeof a.getTotalLength){let e=Math.max(0,a.getTotalLength()-u-h),t=`0 ${u} ${e} ${h}`,n=f.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${t};`).replace(/;\s*;+/g,";");a.setAttribute("style",n)}}}(0,o.K)(l,"buildSegmentList"),(0,o.K)(i,"segmentIntersection"),(0,o.K)(a,"isHorizontalSeg"),(0,o.K)(s,"crossingSitsInRoundedCorner"),(0,o.K)(f,"findEdgeIntersections"),(0,o.K)(d,"fmt"),(0,o.K)(u,"pointToString"),(0,o.K)(h,"getArcSweepFlag"),(0,o.K)(g,"applyMarkerOffsets"),(0,o.K)(c,"emitJump"),(0,o.K)(p,"computeRoundedCorner"),(0,o.K)(x,"rewriteEdgePath"),(0,o.K)(m,"isStraightPath"),(0,o.K)(y,"curveSupportsLineHops"),(0,o.K)(b,"decodeDataPoints"),(0,o.K)(M,"applyLineJumpsToSvg"),n.d(t,{Z:()=>M})},th(e,t,n){n.r(t);var r=n("qL"),o=n("Ag");n("ix"),n("LC"),n("bQ"),n("Ut"),n("PF"),n("iV"),n("h5"),n("pK"),n("NH"),n("Yr");var l=n("M4"),i=n("Gt");function a(e,{measure:t}){let n=e.config?.swimlane?.lineHops;if(!1===n)return;let o=e.edges.filter(e=>Array.isArray(e.points)&&e.points.length>=2).map(e=>({id:e.id,points:e.points,curve:e.curve,arrowTypeStart:e.arrowTypeStart,arrowTypeEnd:e.arrowTypeEnd}));(0,r.Z)(t.groups.edgePaths,o,{enabled:!0,jumpRadius:6,jumpStyle:"gap"===n?"gap":"arc"})}(0,i.K)(a,"applySwimlaneLineJumps");var s="__swimlane_default__";function f(e){return Math.max(e.padding??20,20)}function d(e){let{x:t,y:n,width:r,height:o}=e,l=e.swimlaneContentTop;if("number"!=typeof t||"number"!=typeof n||"number"!=typeof r||"number"!=typeof o||"number"!=typeof l||!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(l)||r<=0||o<=0)return void delete e.groupTitleRect;let i=n-o/2,a=Math.min(21,Math.max(0,Math.min(l,n+o/2)-i)),s=i+a;s<=i?delete e.groupTitleRect:e.groupTitleRect={left:t-r/2,right:t+r/2,top:i,bottom:s}}function u(e){let t=e.direction,n=e.nodes??=[];for(let n of e.nodes??[])n.isGroup&&!n.parentId&&(n.shape="swimlane",t&&(n.direction=t));let r=n.filter(e=>!e.isGroup&&!e.parentId);if(0===r.length)return;let o=n.find(e=>e.id===s);for(let l of(o?o.isGroup&&(o.shape="swimlane",t&&(o.direction=t)):(o={id:s,label:"",isGroup:!0,shape:"swimlane",padding:20,look:e.config?.look,colorIndex:n.reduce((e,t)=>Math.max(e,t.colorIndex??-1),-1)+1,...t?{direction:t}:{}},n.push(o)),r))l.parentId=s}function h(e){let t=new Map;for(let n of e.nodes??[])t.set(n.id,n);let n=[];for(let t of e.edges??[]){let e="string"==typeof t.start?t.start:void 0,r="string"==typeof t.end?t.end:void 0;e&&r&&(t.labelNodeId||n.push({id:t.id,src:e,dst:r,ref:t}))}let r=e.nodes??[],o=r.filter(e=>e.isGroup),l=r.filter(e=>!e.isGroup);return{nodes:[...[...o].reverse(),...l].map(e=>e.id),edges:n,layout:e,nodeById:t}}function g(e,t,n,r){let{layout:o}=e,l=e.nodeById,i=r?.layerGap??100,a=r?.nodeGap??40,s=0;for(let e of t.layers){let t=0;for(let r of e){let e=l.get(r);if(!e){t++;continue}e.layer=s,e.order=t;let o=n.x[r]??t*a,f=n.y[r]??s*i;e.x=o,e.y=f,t++}s++}let u=o.nodes??[],h=new Map,g=[];for(let e of u){if(!e?.isGroup)continue;e.parentId||g.push(e);let t=u.filter(t=>t.parentId===e.id),r=1/0,o=-1/0,l=1/0,i=-1/0;for(let e of t){let t=e.x??n.x[e.id],a=e.y??n.y[e.id],s=e.width??0,f=e.height??0;null!=t&&null!=a&&(r=Math.min(r,t-s/2),o=Math.max(o,t+s/2),l=Math.min(l,a-f/2),i=Math.max(i,a+f/2))}if(1/0===r||1/0===l)e.x=e.x??0,e.y=e.y??0,e.width=e.width??0,e.height=e.height??0;else{let t=e.padding??20,n=Math.max(0,o-r)+(e.parentId?t:2*f(e)),a=Math.max(0,i-l)+t,s=(l+i)/2;e.x=(r+o)/2,e.y=s,e.width=n,e.height=a,h.set(e.id,{minX:r,maxX:o,minY:l,maxY:i})}}if(g.length>0&&h.size>0){let e=1/0,t=-1/0,n=0;for(let r of g){let o=r.padding??20;o>n&&(n=o);let l=h.get(r.id);l&&(e=Math.min(e,l.minY),t=Math.max(t,l.maxY))}if(1/0!==e&&-1/0!==t){let r=Math.max(0,t-e)+2*Math.max(n,36),o=(e+t)/2;for(let t of g)t.y=o,t.height=r,t.swimlaneContentTop=e;let l=[...g].sort((e,t)=>(e.x??0)-(t.x??0)),i=[],a=[],s=[];for(let e of l){let t=h.get(e.id);if(!t)continue;let n=Math.max(0,t.maxX-t.minX)+2*f(e),r=(t.minX+t.maxX)/2;i.push(e.id),a.push(r),s.push(n)}let u=i.length;if(u>0){let e=new Map;if(1===u)e.set(i[0],s[0]);else{let t=[];for(let e=0;e<u-1;e++)t.push(a[e+1]-a[e]);let n=Array(u);n[0]=0;for(let e=0;e<u-1;e++)n[e+1]=2*t[e]-n[e];let r=0,o=1/0;for(let e=0;e<u;e++){let t=s[e];e%2==0?r=Math.max(r,t-n[e]):o=Math.min(o,n[e]-t)}let l=r;l=r<=o?(r+o)/2:r;for(let t=0;t<u;t++){let r=n[t]+(t%2==0?l:-l),o=Math.max(s[t],r);e.set(i[t],o)}}for(let t of g){let n=e.get(t.id);null!=n&&(t.width=n),d(t)}}}}}function c(e){let t=[],n=[],r=new Map;for(let t of e.nodes)r.set(t.id,t);for(let o of e.edges){if(!o.label||0===o.label.length||o.isLayoutOnly||o.labelNodeId)continue;let e=o.start?r.get(o.start):void 0,i=o.end?r.get(o.end):void 0;if(!e||!i){l.R.warn("[EdgeLabelNodes]",`Edge ${o.id} has missing source or target node`);continue}let a=`edge-label-${o.start}-${o.end}-${o.id}`,s=e.parentId!==i.parentId?i.parentId:e.parentId,f={id:a,label:o.label,edgeStart:o.start??"",edgeEnd:o.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:s,isGroup:!1,labelStyle:Array.isArray(o.labelStyle)?o.labelStyle[0]:o.labelStyle??"",...e.dir?{dir:e.dir}:{}};t.push(f),o.labelNodeId=a,o.label=void 0,o.text=void 0;let d={id:`${o.id}-to-label`,start:o.start,end:a,type:"normal",isLayoutOnly:!0},u={id:`${o.id}-from-label`,start:a,end:o.end,type:"normal",isLayoutOnly:!0};n.push(d,u)}let o=[...e.nodes,...t],i=[...e.edges,...n];return{...e,nodes:o,edges:i}}function p(e){let t=e.x??0,n=e.y??0,r=e.width??0,o=e.height??0;return r>0&&o>0?{cx:t,cy:n,rect:F(t,n,r,o)}:void 0}function x(e){if(e.isGroup)return;let t=p(e);if(t)return{id:String(e.id??""),cx:t.cx,cy:t.cy,rect:t.rect}}function m(e,t,n=.001){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}function y(e,t,n=.001){return Math.abs(e.x-t.x)<n}function b(e,t,n=.001){return Math.abs(e.y-t.y)<n}function M(e,t,n=.001){return b(e,t,n)&&Math.abs(e.x-t.x)>n}function K(e,t,n=.001){return y(e,t,n)&&Math.abs(e.y-t.y)>n}function I(e,t,n,r){return Math.max(0,Math.min(Math.max(e,t),Math.max(n,r))-Math.max(Math.min(e,t),Math.min(n,r)))}function w(e,t,n=.001){return e.horizontal&&t.horizontal&&b(e.a,t.a,n)?I(e.a.x,e.b.x,t.a.x,t.b.x):e.vertical&&t.vertical&&y(e.a,t.a,n)?I(e.a.y,e.b.y,t.a.y,t.b.y):0}function S(e,t=.001){let n=[];for(let r=0;r<e.length-1;r++){let o=e[r],l=e[r+1],i=M(o,l,t),a=K(o,l,t);(i||a)&&n.push({index:r,a:o,b:l,horizontal:i,vertical:a})}return n}function v(e,t=.001){let n=S(e,t),r=0;for(let e=1;e<n.length;e++)n[e-1].horizontal!==n[e].horizontal&&r++;return r}function C(e,t=.001){let n=[];for(let r of e){let e=n.length>0?n[n.length-1]:void 0;e&&m(e,r,t)||n.push({x:r.x,y:r.y})}return n}function L(e,t=.001){if(!e||4!==e.length)return;let[n,r,o,l]=e;return M(n,r,t)&&K(r,o,t)&&M(o,l,t)?{kind:"HVH",p0:n,p1:r,p2:o,p3:l}:K(n,r,t)&&M(r,o,t)&&K(o,l,t)?{kind:"VHV",p0:n,p1:r,p2:o,p3:l}:void 0}function k(e,t,n,r=0){let o=Math.min(e.x,t.x),l=Math.max(e.x,t.x),i=Math.min(e.y,t.y),a=Math.max(e.y,t.y);return l>n.left-r&&o<n.right+r&&a>n.top-r&&i<n.bottom+r}function $(e,t,n=0){return e.x>t.left+n&&e.x<t.right-n&&e.y>t.top+n&&e.y<t.bottom-n}function R(e,t){return e.left<=t.left&&e.right>=t.right&&e.top<=t.top&&e.bottom>=t.bottom}function O(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function T(e,t){return{left:e.left-t,right:e.right+t,top:e.top-t,bottom:e.bottom+t}}function F(e,t,n,r){return{left:e-n/2,right:e+n/2,top:t-r/2,bottom:t+r/2}}function E(e){return p(e)?.rect}function B(e,t){switch(t){case"top":return{x:e.cx,y:e.rect.top};case"bottom":return{x:e.cx,y:e.rect.bottom};case"left":return{x:e.rect.left,y:e.cy};case"right":return{x:e.rect.right,y:e.cy}}}function N(e,t,n,r,o,l=.001){let i="left"===t||"right"===t,a="left"===r||"right"===r;if(i&&a){if("right"===t&&"left"===r&&e.x<n.x||"left"===t&&"right"===r&&e.x>n.x){if(b(e,n,l))return[e,n];let t=(e.x+n.x)/2;return[e,{x:t,y:e.y},{x:t,y:n.y},n]}if(t===r){if(b(e,n,l))return;let r="left"===t?Math.min(e.x,n.x)-o:Math.max(e.x,n.x)+o;return[e,{x:r,y:e.y},{x:r,y:n.y},n]}return}if(!i&&!a){if(t===r){if(y(e,n,l))return;let r="top"===t?Math.min(e.y,n.y)-o:Math.max(e.y,n.y)+o;return[e,{x:e.x,y:r},{x:n.x,y:r},n]}if(!("bottom"===t&&"top"===r&&e.y<n.y||"top"===t&&"bottom"===r&&e.y>n.y))return;if(y(e,n,l))return[e,n];let i=(e.y+n.y)/2;return[e,{x:e.x,y:i},{x:n.x,y:i},n]}if(i&&!a){let o="right"===t&&n.x>e.x||"left"===t&&n.x<e.x,l="top"===r&&e.y<n.y||"bottom"===r&&e.y>n.y;return o&&l?[e,{x:n.x,y:e.y},n]:void 0}let s="bottom"===t&&n.y>e.y||"top"===t&&n.y<e.y,f="left"===r&&e.x<n.x||"right"===r&&e.x>n.x;return s&&f?[e,{x:e.x,y:n.y},n]:void 0}function X(e,t,n,r){return"left"===t||"right"===t?[e,{x:r,y:e.y},{x:r,y:n.y},n]:[e,{x:e.x,y:r},{x:n.x,y:r},n]}function Y(e){let t=new Map,n=[];for(let r of e){if(r.isEdgeLabel)continue;let e=x(r);e&&(t.set(e.id,e),n.push({id:e.id,rect:e.rect}))}return{nodeInfoById:t,realNodeRects:n}}function z(e){let t=[],n=[];for(let r of e){let e=x(r);if(!e)continue;let o={id:e.id,rect:e.rect};r.isEdgeLabel?n.push(o):t.push(o)}return{realNodeRects:t,labelNodeRects:n}}function A(e,{includeEdgeLabels:t=!0}={}){let n=[];for(let r of e){if(r.isGroup||!t&&r.isEdgeLabel)continue;let e=r.x??0,o=r.y??0,l=r.width??0,i=r.height??0;n.push({nodeId:r.id,...F(e,o,l,i)})}return n}function G(e,t,n=.001){let r=e.start,o=e.end;if(!r||!o)return;let l=t.get(r),i=t.get(o);if(l&&i)return{srcId:r,dstId:o,srcInfo:l,dstInfo:i,collinearX:Math.abs(l.cx-i.cx)<n,collinearY:Math.abs(l.cy-i.cy)<n}}function P(e,t,n,r=[],o=0){for(let l of n)if(!r.includes(l.id)&&k(e,t,l.rect,-o))return!0;return!1}function D(e,t,n,r,o=.001,l=1e-6){let i=b(e,t,o),a=y(e,t,o),s=b(n,r,o),f=y(n,r,o);if(i&&s||a&&f||!(i||a)||!(s||f))return!1;let d=i?{a:e,b:t}:{a:n,b:r},u=a?{a:e,b:t}:{a:n,b:r},h=d.a.y,g=Math.min(d.a.x,d.b.x),c=Math.max(d.a.x,d.b.x),p=u.a.x,x=Math.min(u.a.y,u.b.y),m=Math.max(u.a.y,u.b.y);if(p<g||p>c||h<x||h>m)return!1;let M=Math.abs(p-d.a.x)<l&&Math.abs(h-d.a.y)<l||Math.abs(p-d.b.x)<l&&Math.abs(h-d.b.y)<l,K=Math.abs(p-u.a.x)<l&&Math.abs(h-u.a.y)<l||Math.abs(p-u.b.x)<l&&Math.abs(h-u.b.y)<l;return!(M&&K)}function H(e,t,n,r,o=.001){let l=b(e,t,o),i=y(e,t,o),a=b(n,r,o),s=y(n,r,o);return i&&s&&y(e,n,o)?I(e.y,t.y,n.y,r.y)>o:!!(l&&a&&b(e,n,o))&&I(e.x,t.x,n.x,r.x)>o}function j(e,t,n,r,{epsilon:o=.001,skipDegenerateOther:l=!1}={}){for(let i of n){if(i===r||i.isLayoutOnly)continue;let n=i.points;if(n&&!(n.length<2))for(let r=0;r<n.length-1;r++){let i=n[r],a=n[r+1];if(!(l&&m(i,a,o))&&(D(e,t,i,a,o)||H(e,t,i,a,o)))return!0}}return!1}function V(e,t,n,r,o=.001){let l=b(e,t,o),i=y(e,t,o),a=b(n,r,o),s=y(n,r,o);if(!(l&&s||i&&a))return!1;let f=l?{a:e,b:t}:{a:n,b:r},d=l?{a:n,b:r}:{a:e,b:t},u=f.a.y,h=Math.min(f.a.x,f.b.x),g=Math.max(f.a.x,f.b.x),c=d.a.x,p=Math.min(d.a.y,d.b.y),x=Math.max(d.a.y,d.b.y);return c>h+o&&c<g-o&&u>p+o&&u<x-o}function _(e,t,n){let r=Math.min(t,n),o=Math.max(t,n);return e>r+.001&&e<o-.001}function W(e,t,n){return y(e,t)&&y(t,n)?_(t.y,e.y,n.y):!!(b(e,t)&&b(t,n))&&_(t.x,e.x,n.x)}function q(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let o=n[n.length-1],l=e[r],i=r+1<e.length?e[r+1]:void 0;if(o&&i){if(m(o,i)){r++,t=!0;continue}if(W(o,l,i)){t=!0;continue}}n.push(l)}return{points:n,changed:t}}function J(e){let t=[e[0]];for(let n=1;n<e.length;n++){let r=t[t.length-1],o=e[n];if(!y(r,o)&&!b(r,o)){let e=t.length>=2?t[t.length-2]:void 0,n=e&&y(e,r)?{x:r.x,y:o.y}:{x:o.x,y:r.y};t.push(n)}t.push(o)}let n=[];for(let e of t){let t=n[n.length-1];t&&m(t,e)||n.push(e)}return n}function Z(e){if(e.length<3)return e;let t=[...e];for(let e=0;e<32;e++){let e=q(t);if(t=e.points,!e.changed)break}return t}function Q(e,t,n){if(e.isLayoutOnly||!e.points||e.points.length<n)return;let r=e.start?t.get(e.start):void 0,o=e.end?t.get(e.end):void 0;return{edge:e,points:e.points,srcRect:r?E(r):void 0,dstRect:o?E(o):void 0}}function U(e,t,n){if(b(e,t,.001))return{x:e.x<n.left?n.left:n.right,y:e.y};if(y(e,t,.001)){let t=e.y<n.top?n.top:n.bottom;return{x:e.x,y:t}}return{x:Math.min(n.right,Math.max(n.left,e.x)),y:Math.min(n.bottom,Math.max(n.top,e.y))}}function ee(e,t,n){let r=n?1:-1,o=n?0:e.length-1;for(;o>=0&&o<e.length&&$(e[o],t,.5);)o+=r;if(o<0||o>=e.length)return e;let l=o-r;if(l<0||l>=e.length)return e;let i=U(e[o],e[l],t);return n?[i,...e.slice(o)]:[...e.slice(0,o+1),i]}function et(e,t){for(let n of e){let e=Q(n,t,2);if(!e)continue;let r=[...e.points];e.srcRect&&(r=ee(r,e.srcRect,!0)),e.dstRect&&(r=ee(r,e.dstRect,!1)),r=eh(r=Z(J(r)),e.srcRect,e.dstRect),e.edge.points=Z(J(r))}}function en(e,t,n,r=!1){if(b(e,t,.001)){if(t.y<n.top-.001||t.y>n.bottom+.001)return t;if(r){if(e.x<n.left-.001)return{x:n.left,y:e.y};if(e.x>n.right+.001)return{x:n.right,y:e.y}}return{x:Math.abs(t.x-n.left)<=Math.abs(t.x-n.right)?n.left:n.right,y:e.y}}if(y(e,t,.001)){if(t.x<n.left-.001||t.x>n.right+.001)return t;if(r){if(e.y<n.top-.001)return{x:e.x,y:n.top};if(e.y>n.bottom+.001)return{x:e.x,y:n.bottom}}let o=Math.abs(t.y-n.top)<=Math.abs(t.y-n.bottom);return{x:e.x,y:o?n.top:n.bottom}}return t}function er(e,t,n){let r=e[t];for(let o=t+n;o>=0&&o<e.length;o+=n){let t=e[o];if(!m(t,r,.001))return t}return e[t+n]}function eo(e,t){let n=e+4,r=t-4;return n<=r?{lo:n,hi:r}:{lo:(e+t)/2,hi:(e+t)/2}}function el(e,t,n){let{lo:r,hi:o}=eo(t,n);return Math.min(o,Math.max(r,e))}function ei(e){let t=Math.max(...e.map(e=>e.lo)),n=Math.min(...e.map(e=>e.hi));if(!(t>n))return{lo:t,hi:n}}function ea(e,t){return"left"===t||"right"===t?eo(e.top,e.bottom):eo(e.left,e.right)}function es(e,t,n){let r=e.y>=n.top-.001&&e.y<=n.bottom+.001,o=e.x>=n.left-.001&&e.x<=n.right+.001;if(b(e,t,.001)&&r){if(.001>Math.abs(e.x-n.left))return"left";if(.001>Math.abs(e.x-n.right))return"right"}if(y(e,t,.001)&&o){if(.001>Math.abs(e.y-n.top))return"top";if(.001>Math.abs(e.y-n.bottom))return"bottom"}}function ef(e){return"left"===e||"right"===e}function ed(e,t,n,r,o){let l=[],i=n?es(e,t,n):void 0,a=r?es(t,e,r):void 0;return n&&i&&ef(i)===o&&l.push(ea(n,i)),r&&a&&ef(a)===o&&l.push(ea(r,a)),l.length>0?ei(l):void 0}function eu(e,t,n,r,o){let l=ed(e,t,n,r,o);if(!l)return;let i=o?e.y:e.x,a=Math.min(l.hi,Math.max(l.lo,i));if(!(.001>Math.abs(a-i)))return o?[{x:e.x,y:a},{x:t.x,y:a}]:[{x:a,y:e.y},{x:a,y:t.y}]}function eh(e,t,n){if(2!==e.length)return e;let[r,o]=e;return b(r,o,.001)?eu(r,o,t,n,!0)??e:y(r,o,.001)?eu(r,o,t,n,!1)??e:e}function eg(e,t,n){return ef(n)?{x:e.x,y:el(e.y,t.top,t.bottom)}:{x:el(e.x,t.left,t.right),y:e.y}}function ec(e,t,n,r,o,l){let i=e.map(e=>({...e}));for(let a=t;a>=0&&a<e.length;a+=n){let t=e[a];if(l&&!b(t,r,.001)||!l&&!y(t,r,.001))break;l?i[a].y=o.y:i[a].x=o.x}return i}function ep(e,t,n){if(e.length<2)return e;let r=n?0:e.length-1,o=n?1:-1,l=e[r],i=er(e,r,o);if(!i)return e;let a=es(l,i,t);if(!a)return e;let s=ef(a),f=eg(l,t,a);return m(l,f,.001)?e:ec(e,r,o,l,f,s)}function ex(e,t,n){let r=Math.min(e.x,t.x)>=n.left-.001&&Math.max(e.x,t.x)<=n.right+.001,o=Math.min(e.y,t.y)>=n.top-.001&&Math.max(e.y,t.y)<=n.bottom+.001;return .001>Math.abs(e.y-n.top)&&.001>Math.abs(t.y-n.top)&&r?"top":.001>Math.abs(e.y-n.bottom)&&.001>Math.abs(t.y-n.bottom)&&r?"bottom":.001>Math.abs(e.x-n.left)&&.001>Math.abs(t.x-n.left)&&o?"left":.001>Math.abs(e.x-n.right)&&.001>Math.abs(t.x-n.right)&&o?"right":void 0}function em(e,t,n,r){switch(e){case"top":return y(t,n,.001)&&n.y<r.top-.001;case"bottom":return y(t,n,.001)&&n.y>r.bottom+.001;case"left":return b(t,n,.001)&&n.x<r.left-.001;case"right":return b(t,n,.001)&&n.x>r.right+.001}}function ey(e,t,n){if(e.length<3)return e;if(n){let n=ex(e[0],e[1],t);return n&&em(n,e[1],e[2],t)?e.slice(1):e}let r=e.length-1,o=ex(e[r-1],e[r],t);return o&&em(o,e[r-1],e[r-2],t)?e.slice(0,r):e}function eb(e,t,n){let r=e;if(t){let e=er(r,0,1);if(e){let n=en(e,r[0],t);n!==r[0]&&(r=[n,...r.slice(1)])}r=ey(r,t,!0)}if(n){let e=r.length-1,t=er(r,e,-1);if(t){let o=en(t,r[e],n,!0);o!==r[e]&&(r=[...r.slice(0,e),o])}r=ey(r,n,!1)}let o=eh(r,t,n);return o!==r||2===r.length?o:(t&&(r=ep(r,t,!0)),n&&(r=ep(r,n,!1)),r)}function eM(e,t){for(let n of e){let e=Q(n,t,2);if(!e)continue;let r=eb(C(e.points,.001),e.srcRect,e.dstRect);if(r.length<3){e.edge.points=r;continue}let o=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];e.edge.points=o}}function eK(e){return new Map(e.map(e=>[e.id,e]))}function eI(e,t){let n=e.parentId,r=null;for(;n;){let e=t.get(n);if(!e?.isGroup)break;r=e.id,n=e.parentId}return r}function ew(e,t){let n=0,r=e.parentId;for(;r;){let e=t.get(r);if(!e?.isGroup)break;n++,r=e.parentId}return n}function eS(e){let t=1/0,n=-1/0,r=1/0,o=-1/0;for(let l of e){let e=l.x,i=l.y;if("number"!=typeof e||"number"!=typeof i)continue;let a=l.width??0,s=l.height??0;t=Math.min(t,e-a/2),n=Math.max(n,e+a/2),r=Math.min(r,i-s/2),o=Math.max(o,i+s/2)}return 1/0===t||1/0===r?null:{minX:t,maxX:n,minY:r,maxY:o}}function ev(e,t){let n=e.padding??20;e.x=(t.minX+t.maxX)/2,e.y=(t.minY+t.maxY)/2,e.width=Math.max(0,t.maxX-t.minX)+n,e.height=Math.max(0,t.maxY-t.minY)+n}function eC(e){let t=eK(e);for(let n of e.filter(e=>e.isGroup&&e.parentId).sort((e,n)=>ew(n,t)-ew(e,t))){let t=eS(e.filter(e=>e.parentId===n.id));t&&ev(n,t)}}function eL(e,t){let n=e.nodes??[],r=e.edges??[],o=n.filter(e=>!e.isGroup),l=1/0,a=-1/0;for(let e of o){let n=e[t];"number"==typeof n&&(l=Math.min(l,n),a=Math.max(a,n))}if(!Number.isFinite(l)||!Number.isFinite(a))return!1;let s=(0,i.K)(e=>l+a-e,"mirror");for(let e of n){let n=e[t];"number"==typeof n&&(e[t]=s(n));let r=e.groupTitleRect;r&&(e.groupTitleRect="x"===t?{...r,left:s(r.right),right:s(r.left)}:{...r,top:s(r.bottom),bottom:s(r.top)})}for(let e of r)for(let n of e.points??[])n[t]=s(n[t]);return!0}function ek(e){return!(e.nodes??[]).some(e=>!e.isGroup)||eL(e,"y")}function e$(e,t="LR"){let n=e.nodes??[],r=e.edges??[],o=n.filter(e=>!e.isGroup),l=1/0,i=1/0;for(let e of o){let t=e.x??0,n=e.y??0;t<l&&(l=t),n<i&&(i=n)}if(!Number.isFinite(l)||!Number.isFinite(i))return!1;let a=0,s=0;for(let e of o)a+=e.width??0,s+=e.height??0;let f=a/o.length,d=s/o.length,u=d>0?Math.max(1,f/d):1;for(let e of o){let t=e.x??0,n=((e.y??0)-i)*u+36,r=t-l;e.x=n,e.y=r}for(let e of r)if(e.points)for(let t of e.points){let e=t.x,n=(t.y-i)*u+36,r=e-l;t.x=n,t.y=r}eC(n);let h=n.filter(e=>e.isGroup&&!e.parentId);if(0===h.length)return"RL"===t&&eL(e,"x"),!0;let g=eK(n),c=new Map;for(let e of n){if(e.isGroup)continue;let t=eI(e,g);if(!t)continue;let n=c.get(t)??[];n.push(e),c.set(t,n)}let p=0;for(let e of h){let t=e.padding??0;t>p&&(p=t)}let x=[],m=1/0,y=-1/0;for(let e of h){let t=eS(c.get(e.id)??[]);t&&(m=Math.min(m,t.minX),y=Math.max(y,t.maxX),x.push({lane:e,contentTop:t.minY,contentBottom:t.maxY,centerY:(t.minY+t.maxY)/2}))}if(1/0===m||-1/0===y)return!0;let b=Math.max(0,y-m)+2*Math.max(p,10),M=36+b,K=(m+y)/2-b/2-36,I=K+M/2,w=Math.max(p,36);x.sort((e,t)=>e.centerY-t.centerY);for(let e=0;e<x.length;e++){let t,n,r=x[e];if(t=0===e?r.contentTop-w:(x[e-1].contentBottom+r.contentTop)/2,e===x.length-1)n=r.contentBottom+w;else{let t=x[e+1];n=(r.contentBottom+t.contentTop)/2}let o=Math.max(0,n-t),l=(t+n)/2;r.lane.x=I,r.lane.y=l,r.lane.width=M,r.lane.height=o,r.lane.swimlaneContentTop=r.contentTop,r.lane.groupTitleRect={left:K,right:K+36,top:t,bottom:n}}return"RL"===t&&eL(e,"x"),!0}(0,i.K)(f,"topLaneHorizontalPadding"),(0,i.K)(d,"assignTopLaneTitleRect"),(0,i.K)(u,"prepareLayoutForSwimlanes"),(0,i.K)(h,"toGraphView"),(0,i.K)(g,"writeBackToLayoutData"),(0,i.K)(c,"createEdgeLabelNodes"),(0,i.K)(p,"measuredNodeRect"),(0,i.K)(x,"nodeBoundsInfoFor"),(0,i.K)(m,"samePoint"),(0,i.K)(y,"sameX"),(0,i.K)(b,"sameY"),(0,i.K)(M,"isHorizontalSegment"),(0,i.K)(K,"isVerticalSegment"),(0,i.K)(I,"overlapLength"),(0,i.K)(w,"sameAxisSegmentOverlapLength"),(0,i.K)(S,"orthogonalSegmentsForPoints"),(0,i.K)(v,"countOrthogonalBends"),(0,i.K)(C,"dedupeConsecutivePoints"),(0,i.K)(L,"classifyThreeSegmentRoute"),(0,i.K)(k,"segmentBoundsOverlapRect"),(0,i.K)($,"pointInsideRect"),(0,i.K)(R,"rectContainsRect"),(0,i.K)(O,"rectsOverlap"),(0,i.K)(T,"inflateRect"),(0,i.K)(F,"rectFromCenterSize"),(0,i.K)(E,"rectOfNodeBounds"),(0,i.K)(B,"portForRectSide"),(0,i.K)(N,"buildOrthogonalPortPath"),(0,i.K)(X,"buildSameSideTrackPath"),(0,i.K)(Y,"collectRealNodeBounds"),(0,i.K)(z,"collectNodeRectEntries"),(0,i.K)(A,"collectLayoutNodeRects"),(0,i.K)(G,"getNodePairGeometry"),(0,i.K)(P,"segmentHitsAnyRect"),(0,i.K)(D,"orthogonalSegmentsCross"),(0,i.K)(H,"sameAxisSegmentsOverlap"),(0,i.K)(j,"segmentConflictsWithAnyEdge"),(0,i.K)(V,"orthogonalSegmentsStrictlyCross"),(0,i.K)(_,"strictlyBetween"),(0,i.K)(W,"isCollinearIntermediate"),(0,i.K)(q,"simplifyPolylineOnce"),(0,i.K)(J,"orthogonalizePolyline"),(0,i.K)(Z,"simplifyPolyline"),(0,i.K)(Q,"endpointContextFor"),(0,i.K)(U,"segmentEnterPoint"),(0,i.K)(ee,"clipEndpoint"),(0,i.K)(et,"clipEdgeEndpointsToNodeBoundaries"),(0,i.K)(en,"snapEndpointToBoundary"),(0,i.K)(er,"firstDistinctAdjacent"),(0,i.K)(eo,"cornerClearanceRange"),(0,i.K)(el,"clampToCornerClearance"),(0,i.K)(ei,"intersectRanges"),(0,i.K)(ea,"clearanceRangeForSide"),(0,i.K)(es,"terminalSideForSegment"),(0,i.K)(ef,"isHorizontalSide"),(0,i.K)(ed,"straightClearanceRange"),(0,i.K)(eu,"clearStraightEndpointCornerAxis"),(0,i.K)(eh,"clearStraightEndpointCornerConnections"),(0,i.K)(eg,"cornerClearedEndpoint"),(0,i.K)(ec,"moveCollinearEndpointRun"),(0,i.K)(ep,"clearEndpointCornerConnection"),(0,i.K)(ex,"borderSideForSegment"),(0,i.K)(em,"leavesOutward"),(0,i.K)(ey,"collapseOwnBorderStub"),(0,i.K)(eb,"snapAndCollapseEndpoints"),(0,i.K)(eM,"prepareEdgeEndpointsForRenderer"),(0,i.K)(eK,"buildNodeMap"),(0,i.K)(eI,"resolveTopLevelGroupId"),(0,i.K)(ew,"groupDepth"),(0,i.K)(eS,"boundsForChildren"),(0,i.K)(ev,"applyGroupBounds"),(0,i.K)(eC,"recomputeNestedGroupBounds"),(0,i.K)(eL,"mirrorAxis"),(0,i.K)(ek,"applyBtDirectionTransform"),(0,i.K)(e$,"applyLrDirectionTransform");var eR=[0,8,-8,16,-16];function eO(e,t){let{nodeInfoById:n,realNodeRects:r}=Y(t);for(let t of e){let o;if(t.isLayoutOnly)continue;let l=t.points;if(!l||l.length<4)continue;let i=L(C(l,1e-6),1e-6);if(!i)continue;let{p3:a}=i,s="HVH"===i.kind,f=G(t,n,1e-6);if(!f)continue;let{srcId:d,dstId:u,srcInfo:h,dstInfo:g,collinearX:c,collinearY:p}=f;if(c||p)continue;let x=h.rect;for(let n of eR){let l,i,f;if(s){let e=g.cy>h.cy?x.bottom:x.top,t=h.cx+n;if(t<=x.left+1e-6||t>=x.right-1e-6)continue;l={x:t,y:e},i={x:t,y:a.y},f={x:a.x,y:a.y}}else{let e=g.cx>h.cx?x.right:x.left,t=h.cy+n;if(t<=x.top+1e-6||t>=x.bottom-1e-6)continue;l={x:e,y:t},i={x:a.x,y:t},f={x:a.x,y:a.y}}let c=m(l,i,1e-6),p=m(i,f,1e-6);if(c&&p||!c&&P(l,i,r,[d],1)||!p&&P(i,f,r,[u],1))continue;let y=!c&&j(l,i,e,t,{epsilon:1e-6,skipDegenerateOther:!0}),b=!p&&j(i,f,e,t,{epsilon:1e-6,skipDegenerateOther:!0});if(!y&&!b){o=c?[i,f]:p?[l,i]:[l,i,f];break}}o&&(t.points=o)}}function eT(e,t){let{realNodeRects:n,labelNodeRects:r}=z(t.values());for(let o of e){let l,a;if(o.isLayoutOnly)continue;let s=o.points;if(!s||s.length<4)continue;let f=C(s,.001);if(f.length<4)continue;let d=f.length-1,u=f[d],h=f[d-1],g=f[d-2],c=Math.hypot(u.x-h.x,u.y-h.y);if(c>=10||c<.001)continue;let p=h.x-g.x,x=h.y-g.y;if(.001>Math.hypot(p,x))continue;let m=M(h,u,.001),I=K(h,u,.001),w=M(g,h,.001),S=K(g,h,.001);if(!(m&&S||I&&w))continue;let v=o.end,L=o.start,k=v?t.get(v):void 0;if(!k)continue;let R=k.x??0,O=k.y??0,T=E(k);if(!T)continue;if(S){let e=x<0;l={x:R,y:g.y},a={x:R,y:e?T.bottom:T.top}}else{let e=p>0;l={x:g.x,y:O},a={x:e?T.right:T.left,y:O}}if(P(l,a,n,v?[v]:[],-2)||P(l,a,r,[],-2))continue;if(L){let e=t.get(L),n=e?E(e):void 0;if(n&&$(l,n,2))continue}let F=(0,i.K)((e,t)=>`${e.x.toFixed(3)},${e.y.toFixed(3)}|${t.x.toFixed(3)},${t.y.toFixed(3)}`,"ownSegmentKey"),B=new Set;for(let e=0;e<f.length-1;e++)B.add(F(f[e],f[e+1]));let N=(0,i.K)((t,n)=>{for(let r of e){if(r===o||r.isLayoutOnly)continue;let e=r.points;if(e&&!(e.length<2))for(let r=0;r<e.length-1;r++){let o=e[r],l=e[r+1];if(!B.has(F(o,l))&&V(t,n,o,l,.001))return!0}}return!1},"segmentCrossesOtherEdge");if(N(l,a))continue;if(d-3>=0){let e=f[d-3];if(P(e,l,n,[L,v].filter(e=>!!e),-2)||N(e,l))continue}let X=[...f.slice(0,d-2),l,a];o.points=X;let Y=o.labelNodeId;if(Y){let e=t.get(Y);if(e){let t=e.width??0,n=e.height??0;if(t>0&&n>0){let r,o,l=-1;for(let e=0;e<X.length-1;e++){let i=X[e],a=X[e+1],s=Math.hypot(a.x-i.x,a.y-i.y),f=b(i,a,.001),d=y(i,a,.001);(f&&s>=t+2||d&&s>=n+2)&&s>l&&(l=s,r=(i.x+a.x)/2,o=(i.y+a.y)/2)}void 0!==r&&void 0!==o&&(e.x=r,e.y=o)}}}}}(0,i.K)(eO,"portSwapToLShape"),(0,i.K)(eT,"collapseShortTerminalStub");var eF=(0,i.K)((e,t)=>y(e,t,.001)||b(e,t,.001),"orthogonallyAligned");function eE(e,t){let n=(0,i.K)((e,t)=>{let n=e.x??0,r=e.y??0,o=t.x-n,l=t.y-r,i=(e.width??0)/2,a=(e.height??0)/2;return Math.abs(l)*i>Math.abs(o)*a?(l<0&&(a=-a),{x:n+(0===l?0:a*o/l),y:r+a}):(o<0&&(i=-i),{x:n+i,y:r+(0===o?0:i*l/o)})},"rectIntersect"),r=(0,i.K)((e,r)=>{let o=C(e.points??[]);if(o.length<2)return;let l=r?e.start:e.end,i=l?t.get(l):void 0,a=i?E(i):void 0;if(!i||!l||!a)return;let s=r?o[0]:o[o.length-1],f=r?o[1]:o[o.length-2],d=n(i,s),u=s;return(eF(f,d)&&(u=f),y(d,u,.001))?{edge:e,edgeId:String(e.id??""),nodeId:l,atStart:r,orientation:"V",coord:d.x,min:Math.min(d.y,u.y),max:Math.max(d.y,u.y),boundary:d,railEnd:u,rect:a}:b(d,u,.001)?{edge:e,edgeId:String(e.id??""),nodeId:l,atStart:r,orientation:"H",coord:d.y,min:Math.min(d.x,u.x),max:Math.max(d.x,u.x),boundary:d,railEnd:u,rect:a}:void 0},"terminalLaneFor"),o=(0,i.K)((e,t)=>Math.max(0,Math.min(e.max,t.max)-Math.max(e.min,t.min)),"projectedOverlapLength"),l=(0,i.K)((e,t)=>e.nodeId===t.nodeId&&e.orientation===t.orientation&&("H"===e.orientation?(1>Math.abs(e.boundary.x-e.rect.left)||1>Math.abs(e.boundary.x-e.rect.right))&&y(e.boundary,t.boundary,1):(1>Math.abs(e.boundary.y-e.rect.top)||1>Math.abs(e.boundary.y-e.rect.bottom))&&b(e.boundary,t.boundary,1)),"sameTerminalFace"),a=(0,i.K)((e,t)=>e.nodeId===t.nodeId&&e.orientation===t.orientation&&o(e,t)>=8&&.5>Math.abs(e.coord-t.coord),"exactTerminalLaneConflict"),s=(0,i.K)((e,t)=>{if(e.nodeId!==t.nodeId||e.orientation!==t.orientation||"H"!==e.orientation||e.atStart===t.atStart)return!1;let n=o(e,t);if(n<8)return!1;let r=e.rect.bottom-e.rect.top;return!(n<r)&&!(n>2*r)&&l(e,t)&&16>Math.abs(e.coord-t.coord)},"nearTerminalLaneConflict"),f=(0,i.K)((e,t)=>{let n=C(e.edge.points??[]);if(n.length<2)return;let r="V"===e.orientation?{x:e.boundary.x+t,y:e.boundary.y}:{x:e.boundary.x,y:e.boundary.y+t},o="V"===e.orientation?{x:e.railEnd.x+t,y:e.railEnd.y}:{x:e.railEnd.x,y:e.railEnd.y+t};if(!(0,i.K)(()=>1>Math.abs(e.boundary.y-e.rect.top)||1>Math.abs(e.boundary.y-e.rect.bottom)?b(r,e.boundary,.001)&&r.x>=e.rect.left+1&&r.x<=e.rect.right-1:!!(1>Math.abs(e.boundary.x-e.rect.left)||1>Math.abs(e.boundary.x-e.rect.right))&&y(r,e.boundary,.001)&&r.y>=e.rect.top+1&&r.y<=e.rect.bottom-1,"boundaryStaysOnSameFace")())return;if(e.atStart){let t=n.length>1&&m(n[1],e.railEnd,.001),l=n.slice(t?2:1),i=l[0];if(i&&!eF(i,o))return;return[r,o,...l]}let l=n.length>1&&m(n[n.length-2],e.railEnd,.001),a=n.slice(0,l?-2:-1),s=a[a.length-1];if(!s||eF(s,o))return[...a,o,r]},"shiftedCandidate"),d=(0,i.K)(e=>{let n=e.edge,r=C(n.points??[]);if(2!==r.length)return!1;let o=n.start,l=n.end,i=o?t.get(o):void 0,a=l?t.get(l):void 0;if(!i||!a)return!1;let s=i.x??0,f=i.y??0,d=a.x??0,u=a.y??0,[h,g]=r;return b(h,g,.001)&&1>Math.abs(f-u)&&Math.abs(s-d)>1||y(h,g,.001)&&1>Math.abs(s-d)&&Math.abs(f-u)>1},"laneIsStraightCollinearConnector"),u=[-7,7,-14,14,-21,21];for(let t=0;t<8;t++){let t=e.filter(e=>!e.isLayoutOnly).flatMap(e=>[r(e,!0),r(e,!1)]).filter(e=>!!e),n=!1;for(let e=0;e<t.length&&!n;e++)for(let o=e+1;o<t.length&&!n;o++){let l=t[e],i=t[o];if(l.edge===i.edge||!(a(l,i)||s(l,i)))continue;let h=!a(l,i);for(let e of[l,i].sort((e,t)=>{let n=d(e),r=d(t);return n!==r?Number(n)-Number(r):Number(!t.atStart)-Number(!e.atStart)})){for(let o of u){let l=f(e,o);if(!l)continue;let i=r({...e.edge,points:l},e.atStart);if(!(!i||t.some(t=>t.edge!==e.edge&&(a(i,t)||h&&s(i,t))))){e.edge.points=l,n=!0;break}}if(n)break}}if(!n)return}}function eB(e,t){let{realNodeRects:n,labelNodeRects:r}=z(t.values()),o=(0,i.K)((t,o)=>{let l=t.start,i=t.end,a=S(o);if(a.length!==o.length-1)return!1;let s=[l,i].filter(e=>!!e);for(let e of a)if(P(e.a,e.b,n,s,-2)||P(e.a,e.b,r,[],-2))return!1;for(let n of e){if(n===t||n.isLayoutOnly)continue;let e=n.points;if(e&&!(e.length<2)){for(let t of a)for(let n of S(C(e)))if(w(t,n,.5)>=8||V(t.a,t.b,n.a,n.b,.001))return!1}}return!0},"candidateIsSafe"),l=(0,i.K)((e,t)=>{if(t+4>=e.length)return;let n=e[t],r=e[t+1],o=e[t+2],l=e[t+3],i=e[t+4],a=M(n,r)&&K(r,o)&&M(o,l)&&K(l,i)&&y(n,l,.001)&&y(n,i,.001)&&y(r,o,.001)&&(r.x-n.x)*(l.x-o.x)<0,s=K(n,r)&&M(r,o)&&K(o,l)&&M(l,i)&&b(n,l,.001)&&b(n,i,.001)&&b(r,o,.001)&&(r.y-n.y)*(l.y-o.y)<0;if(a||s)return C([...e.slice(0,t+1),i,...e.slice(t+5)]);if(t+5>=e.length)return;let f=e[t+5],d=K(n,r)&&M(r,o)&&K(o,l)&&M(l,i)&&K(i,f)&&y(n,i,.001)&&y(n,f,.001)&&y(o,l,.001)&&(o.x-r.x)*(i.x-l.x)<0,u=M(n,r)&&K(r,o)&&M(o,l)&&K(l,i)&&M(i,f)&&b(n,i,.001)&&b(n,f,.001)&&b(o,l,.001)&&(o.y-r.y)*(i.y-l.y)<0;if(d||u)return C([...e.slice(0,t+1),f,...e.slice(t+6)])},"withoutDogleg");for(let t=0;t<8;t++){let t=!1;for(let n of e){if(n.isLayoutOnly)continue;let e=C(n.points??[]);for(let r=0;r<=e.length-5;r++){let i=l(e,r);if(i&&o(n,i)){n.points=i,t=!0;break}}if(t)break}if(!t)return}}function eN(e,t){let{realNodeRects:n,labelNodeRects:r}=z(t.values()),o=e.filter(e=>!e.isLayoutOnly),l=(0,i.K)((e,t,n)=>C(e===t?n??[]:e.points??[]),"pointsFor"),a=(0,i.K)((e,t)=>{let n=0;for(let r=0;r<o.length;r++){let i=S(l(o[r],e,t));for(let a=r+1;a<o.length;a++){let r=S(l(o[a],e,t));for(let e of i)for(let t of r)V(e.a,e.b,t.a,t.b,.001)&&n++}}return n},"strictCrossingCount"),s=(0,i.K)(e=>{let t=S(e);if(3!==t.length)return;let n=t[1];if(t[0].horizontal!==n.horizontal&&t[2].horizontal!==n.horizontal)return{index:n.index,horizontal:n.horizontal,vertical:n.vertical,segment:n}},"middleRail"),f=(0,i.K)((e,t)=>{let r=[e.start,e.end].filter(e=>!!e);return n.filter(e=>{if(r.includes(e.id))return!1;let n=e.rect;return t.horizontal?I(t.a.x,t.b.x,n.left,n.right)>=8&&t.a.y>=n.top-2&&t.a.y<=n.bottom+2:I(t.a.y,t.b.y,n.top,n.bottom)>=8&&t.a.x>=n.left-2&&t.a.x<=n.right+2})},"blockingRectsFor"),d=(0,i.K)((e,t,n)=>{let r=e.map(e=>({...e}));if(t.horizontal)r[t.index].y=n,r[t.index+1].y=n;else{if(!t.vertical)return;r[t.index].x=n,r[t.index+1].x=n}let o=Z(C(r));return S(o).length===o.length-1?o:void 0},"candidateByMovingRail"),u=(0,i.K)((e,t,i)=>{let s=[e.start,e.end].filter(e=>!!e),f=S(t);if(f.length!==t.length-1)return!1;for(let e of f)if(P(e.a,e.b,n,s,-2)||P(e.a,e.b,r,[],-2))return!1;for(let t of o)if(t!==e){for(let e of f)for(let n of S(l(t)))if(w(e,n,.5)>=8)return!1}return a(e,t)<=i},"candidateIsSafe");for(let e=0;e<8;e++){let e=a(),t=!1;for(let n of o){let r=l(n),o=s(r);if(!o)continue;let i=f(n,o.segment);if(0!==i.length){for(let l of o.horizontal?[Math.min(...i.map(e=>e.rect.top))-20,Math.max(...i.map(e=>e.rect.bottom))+20]:[Math.min(...i.map(e=>e.rect.left))-20,Math.max(...i.map(e=>e.rect.right))+20]){let i=d(r,o.segment,l);if(i&&u(n,i,e)){n.points=i,t=!0;break}}if(t)break}}if(!t)return}}function eX(e,t){let n=(0,i.K)(e=>{let t=e.groupTitleRect;if(t&&"number"==typeof t.left&&"number"==typeof t.right&&"number"==typeof t.top&&"number"==typeof t.bottom&&Number.isFinite(t.left)&&Number.isFinite(t.right)&&Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&!(t.right<=t.left)&&!(t.bottom<=t.top))return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},"validTitleRect"),r=(0,i.K)(e=>{if(!e.isGroup||e.parentId)return;let t=e.direction,r="string"==typeof t?t.toUpperCase():"";if("LR"===r||"RL"===r||"BT"===r)return;let o=n(e),l=e.y,i=e.height;if(!o||"number"!=typeof l||"number"!=typeof i||!Number.isFinite(l)||!Number.isFinite(i)||i<=0)return;let a=o.right-o.left,s=o.bottom-o.top;if(!(s<=0)&&!(a<s))return{node:e,rect:o}},"topLaneTitleFor"),o=(0,i.K)((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return!(n<=t.top+.001)&&!(n>=t.bottom-.001)&&I(e.a.x,e.b.x,t.left,t.right)>=8},"horizontalSegmentIntersectsTitle"),l=[...t.values()].map(r).filter(e=>!!e);if(0===l.length)return;let a=0;for(let t of e)if(!t.isLayoutOnly)for(let e of S(C(t.points??[])))for(let t of l)o(e,t.rect)&&(a=Math.max(a,t.rect.bottom-e.a.y+4));if(!(a<=.001))for(let e of l){let t=e.node.y,n=e.node.height;"number"==typeof t&&"number"==typeof n&&Number.isFinite(t)&&Number.isFinite(n)&&!(n<=0)&&(e.node.y=t-a/2,e.node.height=n+a,e.node.groupTitleRect={...e.rect,top:e.rect.top-a,bottom:e.rect.bottom-a})}}function eY(e,t){let n=(0,i.K)(e=>{let t=e.groupTitleRect;if(t&&"number"==typeof t.left&&"number"==typeof t.right&&"number"==typeof t.top&&"number"==typeof t.bottom&&Number.isFinite(t.left)&&Number.isFinite(t.right)&&Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&!(t.right<=t.left)&&!(t.bottom<=t.top))return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},"validTitleRect"),r=(0,i.K)(e=>{if(!e.isGroup||e.parentId||"LR"!==e.direction)return;let t=n(e),r=e.x,o=e.width;if(!t||"number"!=typeof r||"number"!=typeof o||!Number.isFinite(r)||!Number.isFinite(o)||o<=0)return;let l=t.right-t.left,i=t.bottom-t.top;if(!(l<=0)&&!(i<l))return{node:e,rect:t}},"leftLaneTitleFor"),o=(0,i.K)((e,t)=>{if(!e.vertical)return!1;let n=e.a.x;return!(n<=t.left+.001)&&!(n>=t.right-.001)&&I(e.a.y,e.b.y,t.top,t.bottom)>=8},"verticalSegmentIntersectsTitle"),l=(0,i.K)((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return!(n<=t.top+.001)&&!(n>=t.bottom-.001)&&I(e.a.x,e.b.x,t.left,t.right)>=8},"horizontalSegmentIntersectsTitle"),a=[...t.values()].map(r).filter(e=>!!e);if(0===a.length)return;let s=0;for(let t of e)if(!t.isLayoutOnly){for(let e of S(C(t.points??[])))for(let t of a)if(o(e,t.rect))s=Math.max(s,t.rect.right-e.a.x+4);else if(l(e,t.rect)){let n=Math.min(e.a.x,e.b.x);s=Math.max(s,t.rect.right-n+4)}}if(!(s<=.001))for(let e of a){let t=e.node.x,n=e.node.width;"number"==typeof t&&"number"==typeof n&&Number.isFinite(t)&&Number.isFinite(n)&&!(n<=0)&&(e.node.x=t-s/2,e.node.width=n+s,e.node.groupTitleRect={...e.rect,left:e.rect.left-s,right:e.rect.right-s})}}function ez(e,t){let{realNodeRects:n}=z(t.values()),r=e.filter(e=>!e.isLayoutOnly),o=(0,i.K)((e,t=new Map)=>C(t.get(e)??e.points??[]),"replacementPointsFor"),l=(0,i.K)((e=new Map)=>{let t=0;for(let n=0;n<r.length;n++){let l=S(o(r[n],e));for(let i=n+1;i<r.length;i++){let n=S(o(r[i],e));for(let e of l)for(let r of n)V(e.a,e.b,r.a,r.b,.001)&&t++}}return t},"crossingCount"),a=(0,i.K)((e=new Map)=>r.reduce((t,n)=>t+v(o(n,e)),0),"totalBends"),s=(0,i.K)(e=>{let t=o(e);if(t.length<4)return;let n=t[t.length-2],r=t[t.length-1];if(M(n,r,.001)||K(n,r,.001))return{tailStart:n,terminal:r}},"terminalTailFor"),f=(0,i.K)((e,t)=>{let n,r=o(e);if(r.length<3)return;let l=r[0],i=r[1];if(M(l,i,.001))n={x:i.x,y:t.tailStart.y};else{if(!K(l,i,.001))return;n={x:t.tailStart.x,y:i.y}}let a=Z(C([l,i,n,t.tailStart,t.terminal]));return S(a).length===a.length-1?a:void 0},"candidateWithDestinationTail"),d=(0,i.K)((e,t)=>{let r=[e.start,e.end].filter(e=>!!e);for(let e of S(t))if(P(e.a,e.b,n,r,-2))return!0;return!1},"pathHasNodeHit"),u=(0,i.K)((e,t,n)=>{for(let l of r)if(l!==e){for(let e of S(t))for(let t of S(o(l,n)))if(w(e,t,.5)>=8)return!0}return!1},"pathHasSharedTrack"),h=(0,i.K)((e,t,n)=>!d(e,t)&&!u(e,t,n),"candidateIsSafe"),g=(0,i.K)(()=>{let e=new Map;for(let n of r){let r=n.end;if(!r||!t.has(r)||o(n).length<4)continue;let l=e.get(r)??[];l.push(n),e.set(r,l)}return e},"edgesByDestination");for(let e=0;e<4;e++){let e,t=l();if(0===t)return;let n=a(),r=t,o=n;for(let n of g().values())for(let i=0;i<n.length;i++)for(let d=i+1;d<n.length;d++){let u=n[i],g=n[d],c=s(u),p=s(g);if(!c||!p)continue;let x=f(u,p),m=f(g,c);if(!x||!m)continue;let y=new Map([[u,x],[g,m]]);if(!h(u,x,y)||!h(g,m,y))continue;let b=l(y),M=a(y);!(b>=t)&&(b>r||b===r&&M>=o||(e=y,r=b,o=M))}if(!e)return;for(let[t,n]of e)t.points=n}}function eA(e,t){let{realNodeRects:n,labelNodeRects:r}=z(t.values()),o=e.filter(e=>!e.isLayoutOnly),l=(0,i.K)((e,t=new Map)=>C(t.get(e)??e.points??[]),"replacementPointsFor"),a=(0,i.K)((e=new Map)=>{let t=0;for(let n=0;n<o.length;n++){let r=S(l(o[n],e));for(let i=n+1;i<o.length;i++){let n=S(l(o[i],e));for(let e of r)for(let r of n)V(e.a,e.b,r.a,r.b,.001)&&t++}}return t},"strictCrossingCount"),s=(0,i.K)((e=new Map)=>o.reduce((t,n)=>t+v(l(n,e)),0),"totalBends"),f=(0,i.K)(e=>{let n=e.start,r=e.end,o=n?t.get(n):void 0,l=r?t.get(r):void 0,i=o?E(o):void 0,a=l?E(l):void 0;return i&&a?{src:i,dst:a}:void 0},"endpointRectsFor"),d=(0,i.K)((e,t,n)=>{if(n.index<=0||n.index+1>=t.length-1)return;let r=f(e);if(r){if(n.vertical){let o=n.a.x,l=Math.min(r.src.left,r.dst.left),i=Math.max(r.src.right,r.dst.right),a=o<l-.001?"left":o>i+.001?"right":void 0;if(!a)return;return{edge:e,points:t,segmentIndex:n.index,axis:"vertical",side:a,coord:o,min:Math.min(n.a.y,n.b.y),max:Math.max(n.a.y,n.b.y)}}if(n.horizontal){let o=n.a.y,l=Math.min(r.src.top,r.dst.top),i=Math.max(r.src.bottom,r.dst.bottom),a=o<l-.001?"top":o>i+.001?"bottom":void 0;if(!a)return;return{edge:e,points:t,segmentIndex:n.index,axis:"horizontal",side:a,coord:o,min:Math.min(n.a.x,n.b.x),max:Math.max(n.a.x,n.b.x)}}}},"externalRailForSegment"),u=(0,i.K)(()=>{let e=[];for(let t of o){let n=l(t);for(let r of S(n)){let o=d(t,n,r);o&&e.push(o)}}return e},"collectExternalRails"),h=(0,i.K)((e,t)=>e.edge!==t.edge&&e.axis===t.axis&&e.side===t.side&&I(e.min,e.max,t.min,t.max)>=8,"railsInteract"),g=(0,i.K)(e=>{let t=[],n=new Set;for(let r of e){if(n.has(r))continue;let o=[r],l=[];for(n.add(r);o.length>0;){let t=o.pop();for(let r of(l.push(t),e))!n.has(r)&&h(t,r)&&(n.add(r),o.push(r))}l.length>1&&t.push(l)}return t},"connectedComponents"),c=(0,i.K)(e=>{let t=[];for(let n of e)t.some(e=>.001>Math.abs(e-n.coord))||t.push(n.coord);for(;t.length<e.length;){let n=Math.min(...t),r=Math.max(...t),o=e[0].side;t.push("left"===o||"top"===o?n-12*(e.length-t.length):r+12*(e.length-t.length))}return t},"uniqueCoordsFor"),p=(0,i.K)(e=>{let t=e.map(e=>e.coord),n=c(e),r=[];if(e.length<=6){let o=Array(n.length).fill(!1),l=[],a=(0,i.K)(()=>{if(l.length===e.length){l.some((e,n)=>Math.abs(e-t[n])>=.001)&&r.push([...l]);return}for(let[e,t]of n.entries())o[e]||(o[e]=!0,l.push(t),a(),l.pop(),o[e]=!1)},"visit");return a(),r}for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let o=[...t];[o[e],o[n]]=[o[n],o[e]],r.push(o)}return r},"coordinateAssignmentsFor"),x=(0,i.K)((e,t)=>{let n=new Map;for(let[r,o]of e.entries()){let e=t[r],l=n.get(o.edge)??o.points.map(e=>({x:e.x,y:e.y}));"vertical"===o.axis?(l[o.segmentIndex].x=e,l[o.segmentIndex+1].x=e):(l[o.segmentIndex].y=e,l[o.segmentIndex+1].y=e),n.set(o.edge,l)}let r=new Map;for(let[e,t]of n){let n=Z(C(t));if(S(n).length!==n.length-1)return;r.set(e,n)}return r},"replacementsForAssignment"),m=(0,i.K)(e=>{for(let[t,o]of e){let e=[t.start,t.end].filter(e=>!!e);for(let t of S(o))if(P(t.a,t.b,n,e,-2)||P(t.a,t.b,r,[],-2))return!1}for(let t=0;t<o.length;t++){let n=o[t],r=e.has(n),i=S(l(n,e));for(let n=t+1;n<o.length;n++){let t=o[n];if(!r&&!e.has(t))continue;let a=S(l(t,e));for(let e of i)for(let t of a)if(w(e,t,.5)>=8)return!1}}return!0},"candidateIsSafe");for(let e=0;e<4;e++){let e,t=a();if(0===t)return;let n=t,r=s(),o=1/0;for(let l of g(u()))for(let i of p(l)){let f=x(l,i);if(!f||!m(f))continue;let d=a(f);if(d>=t)continue;let u=s(f),h=l.reduce((e,t,n)=>e+Math.abs(i[n]-t.coord),0);d>n||d===n&&(u>r||u===r&&h>=o)||(e=f,n=d,r=u,o=h)}if(!e)return;for(let[t,n]of e)t.points=n}}function eG(e,t){let{realNodeRects:n,labelNodeRects:r}=z(t.values()),o=e.filter(e=>!e.isLayoutOnly),l=(0,i.K)((e,t,n)=>C(e===t?n??[]:e.points??[]),"pointsFor"),a=(0,i.K)(e=>S(e).reduce((e,t)=>e+Math.hypot(t.a.x-t.b.x,t.a.y-t.b.y),0),"pathLength"),s=(0,i.K)((e,t)=>{let n=0;for(let r=0;r<o.length;r++){let i=S(l(o[r],e,t));for(let a=r+1;a<o.length;a++){let r=S(l(o[a],e,t));for(let e of i)for(let t of r)V(e.a,e.b,t.a,t.b,.001)&&n++}}return n},"strictCrossingCount"),f=(0,i.K)((e,t)=>{if(e.horizontal){let n=e.a.y;return(1>Math.abs(n-t.top)||1>Math.abs(n-t.bottom))&&I(e.a.x,e.b.x,t.left,t.right)>=8}if(e.vertical){let n=e.a.x;return(1>Math.abs(n-t.left)||1>Math.abs(n-t.right))&&I(e.a.y,e.b.y,t.top,t.bottom)>=8}return!1},"segmentRunsAlongRectBorder"),d=(0,i.K)(e=>{let n=[e.start,e.end].filter(e=>!!e),r=[];for(let e of n){let n=t.get(e),o=n?E(n):void 0;o&&r.push(o)}return r},"endpointRectsFor"),u=(0,i.K)((e,t)=>{if(t+3>=e.length)return[];let n=e[t],r=e[t+1],o=e[t+2],l=e[t+3],i=M(n,r,.001)&&K(r,o,.001)&&M(o,l,.001),a=K(n,r,.001)&&M(r,o,.001)&&K(o,l,.001);if(!i&&!a||!(i?Math.sign(r.x-n.x)!==Math.sign(l.x-o.x):Math.sign(r.y-n.y)!==Math.sign(l.y-o.y)))return[];let s=y(n,l,.001)||b(n,l,.001)?[]:[{x:n.x,y:l.y},{x:l.x,y:n.y}],f=0===s.length?[[...e.slice(0,t+1),...e.slice(t+3)]]:s.map(n=>[...e.slice(0,t+1),n,...e.slice(t+3)]),d=new Set;return f.map(e=>Z(C(e))).filter(e=>{if(S(e).length!==e.length-1||!e.some(e=>m(e,l,.001)))return!1;let t=e.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join("|");return!d.has(t)&&(d.add(t),!0)})},"shortcutCandidatesAt"),h=(0,i.K)((e,t,i)=>{let a=[e.start,e.end].filter(e=>!!e),u=d(e);for(let e of S(t))if(P(e.a,e.b,n,a,-2)||P(e.a,e.b,r,[],-2)||u.some(t=>f(e,t)))return!1;for(let n of o)if(n!==e){for(let e of S(t))for(let t of S(l(n)))if(w(e,t,.5)>=8)return!1}return s(e,t)<=i},"candidateIsSafe");for(let e=0;e<8;e++){let e,t,n=s(),r=n,i=1/0,f=1/0;for(let d of o){let o=l(d),g=v(o,.001),c=a(o);for(let l=0;l<=o.length-4;l++)for(let p of u(o,l)){let o=v(p,.001),l=a(p);if(!(o<g||o===g&&l<c-.001)||!h(d,p,n))continue;let u=s(d,p);u>r||u===r&&(o>i||o===i&&l>=f)||(e=d,t=p,r=u,i=o,f=l)}}if(!e||!t)return;e.points=t}}function eP(e,t){let n=[];for(let e of t.values()){if(e.isGroup||e.isEdgeLabel)continue;let t=e.x??0,r=e.y??0,o=E(e);o&&n.push({id:String(e.id??""),cx:t,cy:r,rect:o})}if(0===n.length)return;let r=new Map(n.map(e=>[e.id,e])),o=n.map(e=>({id:e.id,rect:e.rect})),l=["top","bottom","left","right"],a={top:Math.min(...n.map(e=>e.rect.top))-20,bottom:Math.max(...n.map(e=>e.rect.bottom))+20,left:Math.min(...n.map(e=>e.rect.left))-20,right:Math.max(...n.map(e=>e.rect.right))+20},s=e.filter(e=>!e.isLayoutOnly),f=new Map(s.map((e,t)=>[e,t])),d=(0,i.K)(e=>{let t="left"===e||"top"===e?-1:1,n=[];for(let r=0;r<=2;r++)n.push(a[e]+20*t*r);return n},"outwardTracksForSide"),u=(0,i.K)((e,t=new Map)=>C(t.get(e)??e.points??[]),"replacementPointsFor"),h=(0,i.K)((e,t)=>{let n=0;for(let r of e)for(let e of t)V(r.a,r.b,e.a,e.b,.001)&&n++;return n},"crossingCountBetweenSegments"),g=(0,i.K)((e,t)=>h(S(e),S(t)),"crossingCountBetweenPaths"),c=(0,i.K)((e=new Map)=>{let t=0,n=[],r=new Set,o=[],l=(0,i.K)(e=>{r.has(e)||(r.add(e),o.push(e))},"addEdge");for(let r=0;r<s.length;r++){let o=s[r],i=u(o,e);for(let a=r+1;a<s.length;a++){let r=s[a],f=g(i,u(r,e));f>0&&(t+=f,n.push({first:o,second:r,count:f}),l(o),l(r))}}return o.sort((e,t)=>(f.get(e)??0)-(f.get(t)??0)),{count:t,pairs:n,edgeSet:r,edges:o}},"crossingSnapshot"),p=(0,i.K)((e,t)=>{let n=new Set(t.keys());if(0===n.size)return e.count;let r=0;for(let t of e.pairs)(n.has(t.first)||n.has(t.second))&&(r+=t.count);let o=0;for(let e=0;e<s.length;e++){let r=s[e],l=n.has(r),i=u(r,t);for(let r=e+1;r<s.length;r++){let e=s[r];(l||n.has(e))&&(o+=g(i,u(e,t)))}}return e.count-r+o},"crossingCountWithReplacements"),x=(0,i.K)(e=>{let t=new Map;for(let n of e.pairs){let e=t.get(n.first)??new Set;e.add(n.second),t.set(n.first,e);let r=t.get(n.second)??new Set;r.add(n.first),t.set(n.second,r)}let n=[],r=new Set;for(let o of e.edges){if(r.has(o))continue;let e=[o],l=[];for(r.add(o);e.length>0;){let n=e.pop();for(let o of(l.push(n),t.get(n)??[]))r.has(o)||(r.add(o),e.push(o))}l.sort((e,t)=>(f.get(e)??0)-(f.get(t)??0)),l.length>1&&n.push(l)}return n},"crossingComponents"),m=(0,i.K)(e=>[e.start,e.end].filter(e=>!!e),"endpointIdsFor"),y=(0,i.K)(e=>{let t=[];for(let n of x(e)){let e=new Set(n),r=new Set(n.flatMap(e=>m(e))),o=[...n];for(let t of s)!e.has(t)&&m(t).some(e=>r.has(e))&&o.push(t);o.sort((e,t)=>(f.get(e)??0)-(f.get(t)??0)),t.push(o)}return t},"pairSearchGroups"),b=(0,i.K)((e,t,n)=>p(e,new Map([[t,n]])),"crossingCountWithSingleReplacement"),I=(0,i.K)(e=>{let t=new Map;for(let n of e.pairs)t.set(n.first,(t.get(n.first)??0)+n.count),t.set(n.second,(t.get(n.second)??0)+n.count);return t},"currentCrossingsByEdge"),L=(0,i.K)(e=>e.slice(1).reduce((t,n,r)=>{let o=e[r];return t+Math.abs(n.x-o.x)+Math.abs(n.y-o.y)},0),"pathLength"),k=(0,i.K)((e=new Map)=>s.reduce((t,n)=>t+v(u(n,e)),0),"totalBends"),$=(0,i.K)((e=new Map)=>s.reduce((t,n)=>t+L(u(n,e)),0),"totalLength"),R=(0,i.K)((e,t,n=new Map)=>{let r=S(t);for(let t of s)if(t!==e){for(let e of r)for(let r of S(u(t,n)))if(w(e,r,.5)>=8)return!0}return!1},"pathHasSegmentConflict"),O=(0,i.K)((e,t)=>{let n=[e.start,e.end].filter(e=>!!e);for(let e of S(t))if(P(e.a,e.b,o,n,-2))return!0;return!1},"pathHitsNode"),T=(0,i.K)((e,t)=>{let n=Z(C(t));S(n).length===n.length-1&&e.push(n)},"pushOrthogonalCandidate"),F=(0,i.K)(e=>"left"===e||"right"===e,"sideIsHorizontal"),Y=(0,i.K)((e,t,n)=>{switch(t){case"left":return Math.min(e.x,n.x)-20;case"right":return Math.max(e.x,n.x)+20;case"top":return Math.min(e.y,n.y)-20;case"bottom":return Math.max(e.y,n.y)+20}},"localTrackForSameSide"),z=(0,i.K)((e,t,n,r)=>{let o="left"===n||"top"===n?-1:1;for(let l of[Y(t,n,r),a[n]])for(let i=0;i<=2;i++)T(e,X(t,n,r,l+20*o*i))},"addSameSideCandidates"),A=(0,i.K)((e,t,n,r,o)=>{for(let l of d(n))for(let n of d(o))T(e,[t,{x:l,y:t.y},{x:l,y:n},{x:r.x,y:n},r])},"addHorizontalToVerticalCandidates"),G=(0,i.K)((e,t,n,r,o)=>{for(let l of d(n))for(let n of d(o))T(e,[t,{x:t.x,y:l},{x:n,y:l},{x:n,y:r.y},r])},"addVerticalToHorizontalCandidates"),D=(0,i.K)((e,t,n,r,o)=>{let l=[...d("top"),...d("bottom")];for(let i of d(n))for(let n of d(o))for(let o of l)T(e,[t,{x:i,y:t.y},{x:i,y:o},{x:n,y:o},{x:n,y:r.y},r])},"addHorizontalPairCandidates"),H=(0,i.K)((e,t,n,r,o)=>{let l=[...d("left"),...d("right")];for(let i of d(n))for(let n of d(o))for(let o of l)T(e,[t,{x:t.x,y:i},{x:o,y:i},{x:o,y:n},{x:r.x,y:n},r])},"addVerticalPairCandidates"),j=(0,i.K)(e=>{let t=new Set;return e.map(e=>C(e)).filter(e=>{let n=e.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join("|");return!t.has(n)&&!(e.length<2)&&(t.add(n),!0)})},"dedupeCandidatePaths"),_=(0,i.K)((e,t,n,r)=>{let o=[],l=N(e,t,n,r,20,.001);l&&T(o,l),t===r&&z(o,e,t,n);let i=F(t),a=F(r);return i&&!a?A(o,e,t,n,r):!i&&a?G(o,e,t,n,r):i?D(o,e,t,n,r):H(o,e,t,n,r),j(o)},"buildCandidatesForSides"),W=(0,i.K)((e,t,n,r)=>{let o=[...d("left"),...d("right")],i=[...d("top"),...d("bottom")];for(let a of l){let l=B(r,a),s="top"===a||"bottom"===a?d(a):i;for(let r of o)for(let o of(T(e,[t,n,{x:r,y:n.y},{x:r,y:l.y},l]),s))T(e,[t,n,{x:r,y:n.y},{x:r,y:o},{x:l.x,y:o},l])}},"addVerticalDepartureOuterTrackCandidates"),q=(0,i.K)((e,t,n,r)=>{let o=[...d("left"),...d("right")],i=[...d("top"),...d("bottom")];for(let a of l){let l=B(r,a),s="left"===a||"right"===a?d(a):o;for(let r of i)for(let o of(T(e,[t,n,{x:n.x,y:r},{x:l.x,y:r},l]),s))T(e,[t,n,{x:n.x,y:r},{x:o,y:r},{x:o,y:l.y},l])}},"addHorizontalDepartureOuterTrackCandidates"),J=(0,i.K)(e=>{let t=e.start,n=e.end,o=n?r.get(n):void 0;if(!t||!o)return[];let l=C(e.points??[]);if(l.length<4)return[];let i=l[0],a=l[1],s=[];return K(i,a,.001)?W(s,i,a,o):M(i,a,.001)&&q(s,i,a,o),s},"terminalPreservingOuterTrackCandidates"),Q=(0,i.K)(e=>{let t=e.start,n=e.end,o=t?r.get(t):void 0,i=n?r.get(n):void 0;if(!o||!i)return[];let a=[];for(let e of l){let t=B(o,e);for(let n of l)a.push(..._(t,e,B(i,n),n))}return a.push(...J(e)),a},"candidatePathsFor"),U=(0,i.K)(()=>new Map(s.map(e=>[e,S(u(e))])),"currentSegmentsByEdge"),ee=(0,i.K)((e,t,n)=>{let r=new Set;for(let o of s){if(o===e)continue;let l=n.get(o)??S(u(o));t.some(e=>l.some(t=>w(e,t,.5)>=8))&&r.add(o)}return r},"sharedTrackConflictsFor"),et=(0,i.K)((e,t,n,r)=>{let o=new Set;return Q(e).map(e=>Z(C(e))).filter(t=>{if(O(e,t))return!1;let n=t.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join("|");return!o.has(n)&&!(t.length<2)&&(o.add(n),!0)}).map(o=>{let l=S(o),i=0;for(let t of s)t!==e&&(i+=h(l,n.get(t)??S(u(t))));return{candidate:o,candidateSegments:l,crossings:t.count-(r.get(e)??0)+i,bends:v(o,.001),totalBends:v(o),length:L(o)}}).filter(({crossings:e})=>e<=t.count).sort((e,t)=>e.crossings-t.crossings||e.bends-t.bends||e.length-t.length).slice(0,48).map(t=>({path:t.candidate,segments:t.candidateSegments,sharedTrackConflicts:ee(e,t.candidateSegments,n),totalBends:t.totalBends,length:t.length}))},"pairCandidatesFor"),en=(0,i.K)((e,t,n,r,o,l)=>{let i=0;for(let n of e.pairs)(n.first===t||n.second===t||n.first===r||n.second===r)&&(i+=n.count);let a=h(n.segments,o.segments);for(let e of s){if(e===t||e===r)continue;let i=l.get(e)??S(u(e));a+=h(n.segments,i)+h(o.segments,i)}return e.count-i+a},"pairCrossingCount"),er=(0,i.K)((e,t)=>{for(let n of e.sharedTrackConflicts)if(n!==t)return!1;return!0},"conflictsOnlyWith"),eo=(0,i.K)((e,t)=>e.segments.some(e=>t.segments.some(t=>w(e,t,.5)>=8)),"candidatesShareTrack"),el=(0,i.K)((e,t,n,r)=>er(t,n.edge)&&er(r,e.edge)&&!eo(t,r),"pairCandidatesAreCompatible"),ei=(0,i.K)((e,t,n,r,o)=>{let l=en(e.current,t.edge,n,r.edge,o,e.baseSegments);if(!(l>=e.current.count))return{replacements:new Map([[t.edge,n.path],[r.edge,o.path]]),crossings:l,bends:e.currentBends-(e.baseBendsByEdge.get(t.edge)??0)-(e.baseBendsByEdge.get(r.edge)??0)+n.totalBends+o.totalBends,length:e.currentLength-(e.baseLengthByEdge.get(t.edge)??0)-(e.baseLengthByEdge.get(r.edge)??0)+n.length+o.length}},"scorePairReplacement"),ea=(0,i.K)((e,t)=>e.crossings<t.crossings||e.crossings===t.crossings&&(e.bends<t.bends||e.bends===t.bends&&e.length<t.length),"pairScoreIsBetter"),es=(0,i.K)((e,t,n,r)=>{let o=r;for(let r of t.candidates)for(let l of n.candidates){if(!el(t,r,n,l))continue;let i=ei(e,t,r,n,l);i&&ea(i,o)&&(o=i)}return o},"bestScoreForOptionPair"),ef=(0,i.K)(e=>{let t=k(),n=$(),r=U(),o=I(e),l=new Map(s.map(e=>[e,v(u(e))])),i=new Map(s.map(e=>[e,L(u(e))])),a=new Map,f=y(e);for(let t of f)for(let n of t){if(a.has(n))continue;let t=et(n,e,r,o);t.length>0&&a.set(n,{edge:n,candidates:t})}let d={replacements:new Map,crossings:e.count,bends:t,length:n},h={current:e,currentBends:t,currentLength:n,baseBendsByEdge:l,baseLengthByEdge:i,baseSegments:r};for(let t of f){let n=new Set(t.filter(t=>e.edgeSet.has(t))),r=t.map(e=>a.get(e)).filter(e=>!!e);for(let e=0;e<r.length;e++){let t=r[e];for(let o=e+1;o<r.length;o++){let e=r[o];(n.has(t.edge)||n.has(e.edge))&&(d=es(h,t,e,d))}}}return d.replacements.size>0?d.replacements:void 0},"bestPairedReplacement");for(let e=0;e<4;e++){let e,t,n=c(),r=n.count;if(0===r)return;let o=r,l=1/0;for(let i of n.edges){let a=v(u(i),.001);for(let s of Q(i)){let f=O(i,s),d=!f&&R(i,s),u=b(n,i,s),h=v(s,.001);!f&&!d&&(u<r||u===r&&h<a)&&(u>o||u===o&&h>=l||(e=i,t=s,o=u,l=h))}}if(e&&t){e.points=t;continue}let i=ef(n);if(!i)return;for(let[e,t]of i)e.points=t}}function eD(e,t){let{nodeInfoById:n,realNodeRects:r}=Y(t),o=["top","bottom","left","right"],l={top:Math.min(...r.map(e=>e.rect.top))-20,bottom:Math.max(...r.map(e=>e.rect.bottom))+20,left:Math.min(...r.map(e=>e.rect.left))-20,right:Math.max(...r.map(e=>e.rect.right))+20},a=(0,i.K)((e,t,n,r)=>{let o=[],i=N(e,t,n,r,20,.001);return i&&o.push(i),t===r&&o.push(X(e,t,n,l[t])),o},"buildOrthogonalPathCandidates"),s=(0,i.K)((e,t)=>{for(let n=0;n<e.length-1;n++)if(P(e[n],e[n+1],r,t,1))return!0;return!1},"pathHitsNode"),f=(0,i.K)((t,n,r=!1)=>{let o=0,l=S(t,.001),i=n.start,a=n.end;for(let t of e){if(t===n||t.isLayoutOnly)continue;let e=t.start,s=t.end;if(!r&&i&&a&&(e===i||e===a||s===i||s===a))continue;let f=t.points;if(f&&!(f.length<2))for(let e of l)for(let t of S(f,.001)){if(D(e.a,e.b,t.a,t.b,.001,.001)){o++;continue}w(e,t,.001)>=8&&o++}}return o},"pathConflictCount"),d=(0,i.K)((e,t)=>{let n=Math.abs(e.y-t.rect.top),r=Math.abs(e.y-t.rect.bottom),o=Math.abs(e.x-t.rect.left),l=Math.abs(e.x-t.rect.right),i="top",a=n;return r<a&&(i="bottom",a=r),o<a&&(i="left",a=o),l<a&&(i="right",a=l),i},"nearestSideOfRect"),u=new Map,h=(0,i.K)((e,t,n)=>{let r=u.get(e)??[];r.push({side:t,edgeId:n}),u.set(e,r)},"addFaceClaim");for(let t of e){if(t.isLayoutOnly)continue;let e=t.points??[];if(e.length<1)continue;let r=t.id??"",o=t.start,l=t.end;if(o){let t=n.get(o);t&&h(o,d(e[0],t),r)}if(l){let t=n.get(l);t&&h(l,d(e[e.length-1],t),r)}}let g=(0,i.K)((e,t,n)=>u.get(e)?.some(e=>e.edgeId!==n&&e.side===t)??!1,"faceIsClaimed");for(let t of e){let e;if(t.isLayoutOnly)continue;let r=t.points;if(!r||r.length<2)continue;let l=v(r,.001);if(l<4)continue;let i=t.start,c=t.end;if(!i||!c)continue;let p=n.get(i),x=n.get(c);if(!p||!x)continue;let m=t.id??"",y=f(r,t,!0),b=f(r,t),M=y,K=l;for(let n of o){if(g(i,n,m))continue;let r=B(p,n);for(let l of o)if(!g(c,l,m))for(let o of a(r,n,B(x,l),l)){if(s(o,[i,c]))continue;let n=v(o,.001);if(y>0){let r=f(o,t,!0);if(r>M||r===M&&n>=K)continue;M=r,K=n,e=o;continue}!(f(o,t)>b)&&n<K&&(K=n,e=o)}}if(e){t.points=e;let n=u.get(i);n&&u.set(i,n.filter(e=>e.edgeId!==m));let r=u.get(c);r&&u.set(c,r.filter(e=>e.edgeId!==m)),h(i,d(e[0],p),m),h(c,d(e[e.length-1],x),m)}}}function eH(e,t){let n=t?0:e.length-1,r=e[n],o=e[n+(t?1:-1)];if(!r||!o)return;let l=o.x-r.x,i=o.y-r.y;if(!(Math.abs(l)+Math.abs(i)<.001)){if(.001>=Math.abs(i)){let e=r.x+10*Math.sign(l);return{left:Math.min(r.x,e),right:Math.max(r.x,e),top:r.y-7,bottom:r.y+7}}if(.001>=Math.abs(l)){let e=r.y+10*Math.sign(i);return{left:r.x-7,right:r.x+7,top:Math.min(r.y,e),bottom:Math.max(r.y,e)}}return{left:Math.min(r.x,o.x),right:Math.max(r.x,o.x),top:Math.min(r.y,o.y),bottom:Math.max(r.y,o.y)}}}function ej(e){return{left:Math.min(e.left,e.right),right:Math.max(e.left,e.right),top:Math.min(e.top,e.bottom),bottom:Math.max(e.top,e.bottom)}}function eV(e,t){let n=C(t);return[eH(n,!0),eH(n,!1)].some(t=>t&&O(e,ej(t)))}function e_(e,t){let n=[];for(let t of e){if(t.isLayoutOnly)continue;let e=t.points;if(e&&!(e.length<2))for(let r=0;r<e.length-1;r++)n.push({edgeId:t.id,p1:e[r],p2:e[r+1]})}let r=[],o=[];for(let e of t.values()){let t=e.isGroup,n=e.parentId;if(t&&!n){let t=E(e);t&&o.push({id:e.id,rect:t});continue}if(t||e.isEdgeLabel)continue;let l=E(e);l&&r.push({nodeId:e.id,rect:l})}let l=(0,i.K)((e,t)=>{let n=T(t,3);for(let{nodeId:t,rect:o}of r)if(t!==e&&O(n,o))return!0;return!1},"labelOverlapsForeignNode"),a=(0,i.K)((e,t)=>{let r=T(t,3);for(let t of n)if(t.edgeId!==e&&k(t.p1,t.p2,r))return!0;return!1},"labelOverlapsForeignEdge"),s=(0,i.K)((e,t,n)=>l(e,n)||a(t,n),"labelOverlapsAnything"),f=[],d=(0,i.K)(e=>{for(let{id:t,rect:n}of o)if(R(n,e))return t},"findContainingLane"),u=(0,i.K)((e,t)=>f.some(n=>n.labelId!==e&&O(t,n.rect)),"overlapsPlacedLabel");for(let n of e){if(n.isLayoutOnly)continue;let e=n.labelNodeId;if(!e)continue;let r=t.get(e);if(!r)continue;let h=n.points;if(!h||h.length<2)continue;let g=r.width??0,c=r.height??0;if(g<=0||c<=0)continue;let p=[];for(let e=0;e<h.length-1;e++){let t=h[e],n=h[e+1],r=Math.abs(t.x-n.x),o=Math.abs(t.y-n.y);(!(r<.001)||!(o<.001))&&(r>=.001&&o>=.001||p.push({idx:e,length:r+o,orientation:r>=.001?"horizontal":"vertical",midX:(t.x+n.x)/2,midY:(t.y+n.y)/2}))}if(0===p.length)continue;let x=p.length>=3?p.filter(e=>e.idx>0&&e.idx<p.length-1):p,m=x.length>0?x:p,y=g>=c?"horizontal":"vertical",b=(0,i.K)(e=>[...e].sort((e,t)=>{let n=e.orientation===y;if(n!==(t.orientation===y))return n?-1:1;let r=e.length>=("horizontal"===e.orientation?g:c)+2;return r!==t.length>=("horizontal"===t.orientation?g:c)+2?r?-1:1:t.length-e.length}),"rankSegments"),M=p[0],K=p[p.length-1],I=[.5,.25,.75,.05,.95,.15,.85,.1,.9],w=(0,i.K)((e,t)=>{let n=h[e.idx],r=h[e.idx+1];return{midX:n.x+(r.x-n.x)*t,midY:n.y+(r.y-n.y)*t}},"anchorAtT"),S=(0,i.K)((e,t,n)=>Math.min(n,Math.max(t,e)),"clamp"),v=(0,i.K)((e,t)=>e.midX>=t.left-.001&&e.midX<=t.right+.001&&e.midY>=t.top-.001&&e.midY<=t.bottom+.001,"pointInsideRectInclusive"),C=(0,i.K)(e=>{let t=F(e.midX,e.midY,g,c),n=d(t);if(n)return{laneId:n,anchor:e,rect:t};let r=o.find(({rect:t})=>v(e,t));if(!r)return;let l=r.rect.left+g/2+1,i=r.rect.right-g/2-1,a=r.rect.top+c/2+1,s=r.rect.bottom-c/2-1;if(l>i||a>s)return;let f={midX:S(e.midX,l,i),midY:S(e.midY,a,s)},u=F(f.midX,f.midY,g,c);return v(e,u)?{laneId:r.id,anchor:f,rect:u}:void 0},"placementForAnchor"),L=(0,i.K)((e,t,n)=>"horizontal"===e.orientation?Math.abs(t.midX-n.x):Math.abs(t.midY-n.y),"distanceAlongSegment"),k=(0,i.K)((e,t)=>{let n=("horizontal"===e.orientation?g/2:c/2)+12;if(e===M){let r=h[e.idx];if(L(e,t,r)+.001<n)return!1}if(e===K){let r=h[e.idx+1];if(L(e,t,r)+.001<n)return!1}return!0},"labelClearsTerminalEndpoints"),$=(0,i.K)(t=>{for(let r of b(t))for(let t of I){let o=w(r,t);if(!k(r,o))continue;let l=C(o);if(!(!l||eV(l.rect,h))&&!u(e,l.rect)&&!s(e,n.id,l.rect))return{laneId:l.laneId,anchor:l.anchor}}},"tryPool"),R=(0,i.K)((t,r,o=!1)=>{for(let i of b(t)){let t={midX:i.midX,midY:i.midY};if(r&&!k(i,t))continue;let s=C(t);if(s&&!eV(s.rect,h)&&!u(e,s.rect)&&!l(e,s.rect)&&(o||!a(n.id,s.rect)))return{laneId:s.laneId,anchor:s.anchor}}},"findLaneContainingFallback"),O=$(m)??(m.length<p.length?$(p):void 0)??R(p,!0)??R(p,!1)??R(p,!1,!0);if(O){r.x=O.anchor.midX,r.y=O.anchor.midY,r.parentId=O.laneId;let t=F(O.anchor.midX,O.anchor.midY,g,c),n=f.findIndex(t=>t.labelId===e);n>=0?f[n]={labelId:e,rect:t}:f.push({labelId:e,rect:t})}}}(0,i.K)(eE,"separateSharedRenderedTerminalLanes"),(0,i.K)(eB,"collapseRedundantRectangularDoglegs"),(0,i.K)(eN,"liftObstacleHuggingSameSideRails"),(0,i.K)(eX,"liftTopLaneTitleBandsAboveRails"),(0,i.K)(eY,"shiftLeftLaneTitleBandsLeftOfRails"),(0,i.K)(ez,"swapDestinationTerminalTailsToReduceCrossings"),(0,i.K)(eA,"reassignCrossingExternalRailChannels"),(0,i.K)(eG,"shortcutRedundantOrthogonalJogs"),(0,i.K)(eP,"resolveRenderedOrthogonalCrossings"),(0,i.K)(eD,"simplifyDetouredEdges"),(0,i.K)(eH,"markerClearanceRectFor"),(0,i.K)(ej,"normalizeRect"),(0,i.K)(eV,"labelOverlapsOwnMarker"),(0,i.K)(e_,"anchorLabelsToPolyline");function eW(e,t){return e<t?`${e}::${t}`:`${t}::${e}`}function eq(e,t){let{nodeInfoById:n,realNodeRects:r}=Y(t),o=new Map;for(let e of t){let t=e.id;if(!e.isGroup&&e.isEdgeLabel){o.set(t,{w:e.width??0,h:e.height??0});continue}}let l=(0,i.K)((t,n,r,l)=>{let a=eW(n,r),s=0,f=(0,i.K)(e=>{if(!e)return;let t=o.get(e);if(!t)return;let n="x"===l?t.w/2:t.h/2;n>s&&(s=n)},"consider");for(let n of(f(t.labelNodeId),e)){if(n===t||n.isLayoutOnly)continue;let e=n.start,r=n.end;e&&r&&eW(e,r)===a&&f(n.labelNodeId)}return s>0?s+3:0},"labelClearanceFor");for(let t of e){let o,i;if(t.isLayoutOnly||!L(t.points,1e-6))continue;let a=G(t,n,1e-6);if(!a)continue;let{srcId:s,dstId:f,srcInfo:d,dstInfo:u,collinearX:h,collinearY:g}=a;if(h===g)continue;if(h){let e=u.cy>d.cy;o={x:d.cx,y:e?d.rect.bottom:d.rect.top},i={x:u.cx,y:e?u.rect.top:u.rect.bottom}}else{let e=u.cx>d.cx;o={x:e?d.rect.right:d.rect.left,y:d.cy},i={x:e?u.rect.left:u.rect.right,y:u.cy}}if(P(o,i,r,[s,f],1))continue;let c=l(t,s,f,h?"x":"y"),p=c>4?c:4;for(let n of[0,p,-p]){let l={...o},a={...i};if(h){if(l.x+=n,a.x+=n,l.x<=d.rect.left||l.x>=d.rect.right||a.x<=u.rect.left||a.x>=u.rect.right)continue}else if(l.y+=n,a.y+=n,l.y<=d.rect.top||l.y>=d.rect.bottom||a.y<=u.rect.top||a.y>=u.rect.bottom)continue;if(!P(l,a,r,[s,f],1)&&!j(l,a,e,t,{epsilon:1e-6})){t.points=[l,a];break}}}}function eJ(e,t){let{realNodeRects:n,labelNodeRects:r}=z(t.values()),o=(0,i.K)((e,t)=>S(t,.001).map(n=>({...n,edge:e,interior:n.index>=1&&n.index<=t.length-3})),"segmentsFor"),l=(0,i.K)(()=>{let t=[];for(let n of e){if(n.isLayoutOnly)continue;let e=n.points;e&&!(e.length<2)&&t.push(...o(n,C(e)))}return t},"allSegments"),a=(0,i.K)((e,t)=>e.horizontal&&t.horizontal?I(e.a.x,e.b.x,t.a.x,t.b.x)>=8&&7>Math.abs(e.a.y-t.a.y):!!e.vertical&&!!t.vertical&&I(e.a.y,e.b.y,t.a.y,t.b.y)>=8&&7>Math.abs(e.a.x-t.a.x),"hasCrowdedParallelTrack"),s=(0,i.K)((t,l)=>{let i=t.start,s=t.end,f=o(t,l);if(f.length!==l.length-1)return!1;let d=[i,s].filter(e=>!!e),u=t.labelNodeId?[t.labelNodeId]:[];for(let e of f)if(P(e.a,e.b,n,d,-2)||P(e.a,e.b,r,u,-2))return!1;for(let n of e){if(n===t||n.isLayoutOnly)continue;let e=n.points;if(e&&!(e.length<2)){for(let t of f)for(let r of o(n,C(e)))if(a(t,r)||V(t.a,t.b,r.a,r.b,.001))return!1}}return!0},"candidateIsSafe"),f=(0,i.K)((e,t)=>{let n=C(e.edge.points??[]);if(n.length<4||e.index>=n.length-1)return;let r=n.map(e=>({...e}));if(e.horizontal)r[e.index].y+=t,r[e.index+1].y+=t;else{if(!e.vertical)return;r[e.index].x+=t,r[e.index+1].x+=t}return o(e.edge,r).length===r.length-1?r:void 0},"shiftedCandidate"),d=(0,i.K)((e,t)=>({x:e.x??(t.left+t.right)/2,y:e.y??(t.top+t.bottom)/2}),"nodeCenter"),u=(0,i.K)(e=>{let n=e.edge,r=C(n.points??[]);if(4!==r.length||1!==e.index)return;let o=n.start?t.get(n.start):void 0,l=n.end?t.get(n.end):void 0,i=o?E(o):void 0,a=l?E(l):void 0,s=r.slice(e.index+2);if(o&&l&&i&&a&&0!==s.length)return{sourceCenter:d(o,i),targetCenter:d(l,a),sourceRect:i,tail:s}},"sourceDetourContextFor"),h=(0,i.K)((e,t,n,r,o,l)=>{let i=r.y>=n.y,a=i?o.bottom:o.top,s=a+(i?20:-20);if(i&&e.b.y<=s+.001||!i&&e.b.y>=s-.001)return;let f=e.a.x+t;return C([{x:n.x,y:a},{x:n.x,y:s},{x:f,y:s},{x:f,y:e.b.y},...l],.001)},"verticalSourceDetour"),g=(0,i.K)((e,t,n,r,o,l)=>{let i=r.x>=n.x,a=i?o.right:o.left,s=a+(i?20:-20);if(i&&e.b.x<=s+.001||!i&&e.b.x>=s-.001)return;let f=e.a.y+t;return C([{x:a,y:n.y},{x:s,y:n.y},{x:s,y:f},{x:e.b.x,y:f},...l],.001)},"horizontalSourceDetour"),c=(0,i.K)((e,t)=>{let n=u(e);if(n){if(e.vertical)return h(e,t,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail);if(e.horizontal)return g(e,t,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail)}},"sourceDetourCandidate"),p=[-7,7,-14,14,-21,21];for(let e=0;e<12;e++){let e=l(),t=!1;for(let n=0;n<e.length&&!t;n++)for(let r=n+1;r<e.length&&!t;r++){let o=e[n],l=e[r];if(o.edge!==l.edge&&a(o,l))for(let e of[o,l].filter(e=>e.interior)){for(let n of p){let r=f(e,n);if(r&&s(e.edge,r)){e.edge.points=r,t=!0;break}let o=c(e,n);if(o&&s(e.edge,o)){e.edge.points=o,t=!0;break}}if(t)break}}if(!t)return}}function eZ(e,t,n,r){let o=t.x-e.x,l=t.y-e.y,i=r.x-n.x,a=r.y-n.y,s=o*a-l*i;if(1e-10>Math.abs(s))return!1;let f=n.x-e.x,d=n.y-e.y,u=(f*a-d*i)/s,h=(f*l-d*o)/s;return u>.01&&u<.99&&h>.01&&h<.99}function eQ(e){let t=e.nodes??[],n=e.edges??[],r=[];if(!n.length||!t.length)return r;let o=A(t),i=[];for(let e of n){if(e.isLayoutOnly)continue;let t=e.points;if(!t||t.length<2)continue;let n=e.start,l=e.end,a=e.labelNodeId,s=e.id??`${n}->${l}`;for(let e of o)if(e.nodeId!==n&&e.nodeId!==l&&(!a||e.nodeId!==a)){for(let n=0;n<t.length-1;n++)if(k(t[n],t[n+1],e,-1)){r.push({type:"edge-node-overlap",edgeId:s,targetId:e.nodeId,detail:`segment ${n} passes through node "${e.nodeId}"`});break}}for(let e=0;e<t.length-1;e++)i.push({edgeId:s,start:n,end:l,p1:t[e],p2:t[e+1]})}let a=new Set;for(let e=0;e<i.length;e++)for(let t=e+1;t<i.length;t++){let n=i[e],o=i[t];if(n.edgeId!==o.edgeId&&n.start!==o.start&&n.start!==o.end&&n.end!==o.start&&n.end!==o.end&&eZ(n.p1,n.p2,o.p1,o.p2)){let e=n.edgeId<o.edgeId?`${n.edgeId}|${o.edgeId}`:`${o.edgeId}|${n.edgeId}`;a.has(e)||(a.add(e),r.push({type:"edge-edge-crossing",edgeId:n.edgeId,targetId:o.edgeId,detail:`edges "${n.edgeId}" and "${o.edgeId}" cross`}))}}if(r.length>0){let e=r.filter(e=>"edge-node-overlap"===e.type).length,t=r.filter(e=>"edge-edge-crossing"===e.type).length;for(let n of(l.R.warn(`[SWIMLANE_VALIDATE] ${r.length} issue(s) detected: ${e} edge-node overlap(s), ${t} edge crossing(s)`),r))l.R.warn(`[SWIMLANE_VALIDATE] ${n.type}: ${n.detail}`)}return r}function eU(e,t){let n=e.nodes??[],r=e.edges??[],o=n.filter(e=>!e.isGroup);if(("LR"===t||"RL"===t)&&o.length>0&&!e$(e,t)||"BT"===t&&o.length>0&&!ek(e))return;for(let e of r){if(e.isLayoutOnly)continue;let t=e.points;t&&!(t.length<2)&&(e.points=Z(J(t)))}eD(r,n),eq(r,n),eO(r,n);let l=new Map;for(let e of n)l.set(String(e.id),e);e_(r,l),et(r,l),eT(r,l),eJ(r,l),eE(r,l),eB(r,l),eN(r,l),ez(r,l);let a=(0,i.K)(()=>{eP(r,l),eA(r,l),eG(r,l),e_(r,l),eM(r,l),eN(r,l),e_(r,l),eM(r,l)},"finalizeRenderedEdges");a(),eJ(r,l),a(),eX(r,l),eY(r,l),eX(r,l),eY(r,l)}function e0(e){let t=new Map(e.nodeById),n=new Set,r=[];for(let o of e.edges){if(!t.has(o.src)||!t.has(o.dst))continue;let e=`${o.id}:${o.src}->${o.dst}`;n.has(e)||(n.add(e),r.push(o))}return{nodes:[...t.keys()],edges:r,layout:e.layout,nodeById:t}}function e1(e,t){return e.edges.filter(e=>e.dst===t)}function e2(e){let t=new Map;for(let n of e.nodes)t.set(n,[]);for(let n of e.edges)t.get(n.src).push(n.dst);return t}function e6(e){let t=e2(e);for(let e of t.values())e.sort((e,t)=>e.localeCompare(t));return t}function e5(e){let t=new Map;for(let n of e.nodes)t.set(n,0);for(let n of e.edges)t.set(n.dst,(t.get(n.dst)??0)+1);return t}function e3(e){return[...e.entries()].filter(([,e])=>0===e).map(([e])=>e).sort((e,t)=>e.localeCompare(t))}function e8(e,t=()=>!0){let n=new Map,r=new Map;for(let t of e.nodes)n.set(t,[]),r.set(t,[]);for(let o of e.edges)t(o)&&(r.get(o.src).push(o.dst),n.get(o.dst).push(o.src));return{preds:n,succs:r}}function e4(e,t,n,r){let o=0;for(let t of e.nodes)r?.skipGroups&&e.nodeById.get(t)?.isGroup||(o=Math.max(o,n[t]??0));let l=Array.from({length:o+1},()=>[]);for(let o of t)r?.skipGroups&&e.nodeById.get(o)?.isGroup||l[Math.max(0,n[o]??0)].push(o);return l}function e7(e){let t=e5(e),n=e3(t),r=[],o=e6(e);for(;n.length;){let e=n.shift();for(let l of(r.push(e),o.get(e)??[]))if(t.set(l,(t.get(l)??0)-1),(t.get(l)??0)===0){let e=0;for(;e<n.length&&n[e]<l;)e++;n.splice(e,0,l)}}return r.length===e.nodes.length?r:null}function e9(e){let t=new Map,n=0;for(let r of e)t.set(r,n),n++;return t}function te(e){let t=Array(e.length),n=(0,i.K)((r,o)=>{if(o-r<=1)return 0;let l=r+o>>1,i=n(r,l)+n(l,o),a=r,s=l,f=r;for(;a<l||s<o;)s>=o||a<l&&e[a]<=e[s]?t[f++]=e[a++]:(t[f++]=e[s++],i+=l-a);for(let n=r;n<o;n++)e[n]=t[n];return i},"count");return n(0,e.length)}function tt(e){let t=e0(e),n=new Map;for(let e of t.nodes)n.set(e,[]);for(let e of t.edges)n.get(e.src).push(e);for(let e of n.values())e.sort((e,t)=>e.dst===t.dst?e.id.localeCompare(t.id):e.dst.localeCompare(t.dst));let r=Object.create(null);for(let e of t.nodes)r[e]=0;let o=[],l=(0,i.K)(e=>{for(let t of(r[e]=1,n.get(e)??[])){let e=t.dst;0===r[e]?l(e):1===r[e]&&o.push(t)}r[e]=2},"dfs"),a=e5(t);for(let e of[...t.nodes.filter(e=>(a.get(e)??0)===0),...t.nodes.filter(e=>(a.get(e)??0)!==0)])0===r[e]&&l(e);let s=new Set(o.map(e=>`${e.id}:${e.src}->${e.dst}`)),f=t.edges.map(e=>s.has(`${e.id}:${e.src}->${e.dst}`)?{id:e.id,src:e.dst,dst:e.src,weight:e.weight,ref:e.ref}:e);return{acyclic:{nodes:[...t.nodes],edges:f,layout:t.layout,nodeById:new Map(t.nodeById)},reversed:o}}function tn(e){let t=new Map,n=(0,i.K)(r=>{if(t.has(r))return t.get(r);let o=e.nodeById.get(r);if(!o)return t.set(r,null),null;let l=o.parentId;if(!l)return t.set(r,null),null;let i=n(l)??l;return t.set(r,i),i},"resolve");for(let t of e.nodes)n(t);return t}function tr(e){let t=tn(e);return e=>t.get(e)??null}function to(e){let t=[];for(let n of e.layout.nodes??[])n.isGroup&&!n.parentId&&t.push(n.id);return[...new Set(t)].reverse()}function tl(e,t){let n=to(e);if(!t||0===t.length)return n;let r=new Set(n),o=new Set,l=[];for(let e of t)!r.has(e)||o.has(e)||(o.add(e),l.push(e));for(let e of n)o.has(e)||l.push(e);return l}(0,i.K)(eW,"pairKey"),(0,i.K)(eq,"straightenCollinearSiblingDetours"),(0,i.K)(eJ,"nudgeSharedInteriorSubpaths"),(0,i.K)(eZ,"segmentsIntersect"),(0,i.K)(eQ,"validateSwimlanesLayout"),(0,i.K)(eU,"postProcessSwimlaneLayout"),(0,i.K)(e0,"normalizeGraph"),(0,i.K)(e1,"incoming"),(0,i.K)(e2,"buildSuccessorMap"),(0,i.K)(e6,"buildSortedSuccessorMap"),(0,i.K)(e5,"buildInDegreeMap"),(0,i.K)(e3,"sortedZeroInDegreeNodes"),(0,i.K)(e8,"buildPredecessorSuccessorMaps"),(0,i.K)(e4,"buildLayersFromRanks"),(0,i.K)(e7,"topoSortIfAcyclic"),(0,i.K)(e9,"buildLayerIndex"),(0,i.K)(te,"countInversions"),(0,i.K)(tt,"removeCycles_DFS"),(0,i.K)(tn,"buildTopLaneMap"),(0,i.K)(tr,"createTopLaneResolver"),(0,i.K)(to,"buildTopLaneOrder"),(0,i.K)(tl,"resolveTopLaneOrder");function ti(e,t){let n=e0(e),r=t?.laneOf??(()=>null),o=t?.rankHint,{preds:l}=e8(n);for(let e of l.values())e.sort((e,t)=>e.localeCompare(t));let a=e7(n)??[...n.nodes].sort((e,t)=>e.localeCompare(t)),s=new Map;for(let[e,t]of a.entries())s.set(t,e);let f=new Map,d=new Map;for(let e of n.nodes)d.set(e,[]);for(let e of a){let t=(l.get(e)??[]).filter(e=>f.has(e));if(t.length>0){let n=ta(e,t,{laneOf:r,rankHint:o,topoIndex:s});f.set(e,n),d.get(n).push(e)}else f.has(e)||f.set(e,null)}for(let e of n.nodes)f.has(e)||f.set(e,null);let u=new Set;for(let e of n.nodes)(f.get(e)??null)===null&&u.add(e);let h=[...u].sort((e,t)=>{let n=s.get(e)??0,r=s.get(t)??0;return n===r?e.localeCompare(t):n-r}),g=ts(n),c=new Map;for(let[e,t]of g.entries())c.set(e,[...t].sort((e,t)=>e.localeCompare(t)));let p=tf(c),x=td(c),m=new Map;for(let e of n.nodes)m.set(e,[]);for(let e of x)for(let t of e.nodes){let n=m.get(t);n?n.push(e.id):m.set(t,[e.id])}let y=[],b=[],M=new Set,K=(0,i.K)(e=>{if(!M.has(e)){for(let t of(M.add(e),y.push(e),d.get(e)??[]))K(t);b.push(e)}},"walk");for(let e of h)K(e);for(let e of a)K(e);return{parent:f,children:d,roots:h,componentOf:p,blocks:x,nodeBlocks:m,adjacency:c,preorder:y,postorder:b,topologicalOrder:a}}function ta(e,t,n){let r=n.laneOf(e);return[...t].sort((e,t)=>{let o=n.laneOf(e),l=n.laneOf(t),i=null!=o&&o===r;if(i!==(null!=l&&l===r))return i?-1:1;let a=n.rankHint?.[e],s=n.rankHint?.[t];if(null!=a&&null!=s&&a!==s)return s-a;let f=n.topoIndex.get(e)??0,d=n.topoIndex.get(t)??0;return f!==d?f-d:e.localeCompare(t)})[0]}function ts(e){let t=new Map;for(let n of e.nodes)t.set(n,new Set);for(let n of e.edges)t.get(n.src).add(n.dst),t.get(n.dst).add(n.src);return t}function tf(e){let t=new Map,n=0;for(let r of e.keys()){if(t.has(r))continue;let o=[r];for(;o.length>0;){let r=o.pop();if(!t.has(r))for(let l of(t.set(r,n),e.get(r)??[]))t.has(l)||o.push(l)}n++}return t}function td(e){let t=new Map,n=new Map,r=[],o=[],l=0,a=(0,i.K)((i,s)=>{for(let f of(t.set(i,++l),n.set(i,l),e.get(i)??[]))f!==s&&(t.has(f)?(t.get(f)??0)<(t.get(i)??0)&&(r.push([i,f]),n.set(i,Math.min(n.get(i)??l,t.get(f)??l))):(r.push([i,f]),a(f,i),n.set(i,Math.min(n.get(i)??l,n.get(f)??l)),(n.get(f)??0)>=(t.get(i)??0)&&o.push(tu(i,f,r,o.length))))},"visit");for(let n of e.keys())t.has(n)||a(n,null);return o}function tu(e,t,n,r){let o=[],l=new Set;for(;n.length>0;){let r=n.pop();if(o.push(r),l.add(r[0]),l.add(r[1]),r[0]===e&&r[1]===t||r[0]===t&&r[1]===e)break}return{id:r,edges:o,nodes:[...l]}}function th(e,t,n){let r=[...e.nodes],o=new Map;for(let[e,t]of r.entries())o.set(t,e);let l=r.length,a=Array(l).fill(-1),s=Array(l).fill(0),f=[],d=new Set;for(let e of r){let t=n.parent.get(e)??null,r=o.get(e);null!=r&&null==t&&(a[r]=-1,s[r]=0,d.has(e)||(d.add(e),f.push(e)))}for(;f.length>0;){let e=f.shift(),t=o.get(e);if(null!=t)for(let r of n.children.get(e)??[]){if(d.has(r))continue;let e=o.get(r);null!=e&&(a[e]=t,s[e]=s[t]+1,d.add(r),f.push(r))}}for(let e of r){if(d.has(e))continue;let t=o.get(e);null!=t&&(a[t]=-1,s[t]=0,d.add(e))}let u=Math.max(1,Math.ceil(Math.log2(Math.max(1,l)))+1),h=Array.from({length:u},()=>Array(l).fill(-1));for(let e=0;e<l;e++)h[0][e]=a[e];for(let e=1;e<u;e++)for(let t=0;t<l;t++){let n=h[e-1][t];h[e][t]=-1===n?-1:h[e-1][n]}let g=(0,i.K)((e,t)=>{if(-1===e||-1===t)return -1;s[e]<s[t]&&([e,t]=[t,e]);let n=s[e]-s[t];for(let t=0;t<u;t++)if(n>>t&1&&-1===(e=h[t][e]))return -1;if(e===t)return e;for(let n=u-1;n>=0;n--){let r=h[n][e],o=h[n][t];-1!==r&&-1!==o&&r!==o&&(e=r,t=o)}return h[0][e]},"lcaIndex"),c=Array.from({length:l},()=>new Map);for(let n of e.edges){let e=n.src,r=n.dst,l=t[e],i=t[r];if(null==l||null==i||(l>i&&([e,r]=[r,e],[l,i]=[i,l]),null==l||null==i||l===i))continue;let a=o.get(e),s=o.get(r);if(null==a||null==s)continue;let f=g(a,s);if(-1===f)continue;let d=c[f];for(let e=l;e<i;e++)d.set(e,(d.get(e)??0)+1)}let p=new Map,x=(0,i.K)((e,t)=>{if(0!==t.size)for(let[n,r]of t)e.set(n,(e.get(n)??0)+r)},"mergeInto"),m=new Set,y=(0,i.K)(e=>{let r=o.get(e);m.add(e);let l=null==r?void 0:c[r],i=l?new Map(l):new Map;for(let r of n.children.get(e)??[]){let n=y(r),o=t[e];if(null!=o){let l=p.get(e);l||(l=new Map,p.set(e,l));let i=n.get(o)??0,a=t[r];null!=a&&a>o&&(i+=1),l.set(r,i)}x(i,n)}return i},"dfs");for(let e of n.roots)m.has(e)||y(e);for(let e of r)m.has(e)||y(e);return p}function tg(e,t,n){let r=new Map,o=(0,i.K)(e=>{let l=n[e]??0,i=[...t.get(e)??[]];for(let e of(i.sort(tc(n)),i)){o(e);let t=r.get(e);null!=t&&(l=Math.min(l,t))}r.set(e,l)},"annotate");for(let t of e)o(t);return r}function tc(e){return(t,n)=>{let r=e[t]??0,o=e[n]??0;return r===o?t.localeCompare(n):r-o}}function tp(e,t,n,r){let o=0;for(let e of t){let t=n[e]??0;t>o&&(o=t)}let l=Array.from({length:o+1},()=>[]),a=new Set,s=(0,i.K)(e=>{if(a.has(e))return;a.add(e);let t=n[e]??0;for(let n of(l[t]||(l[t]=[]),l[t].push(e),r(e)))s(n)},"emit");for(let t of e)s(t);for(let e of t)if(!a.has(e)){let t=n[e]??0;l[t]||(l[t]=[]),l[t].push(e),a.add(e)}return l}function tx(e){let t=[];for(let n of e){let e=new Set,r=[];for(let t of n)e.has(t)||(e.add(t),r.push(t));t.push(r)}return t}function tm(e,t,n,r){return o=>{let l=e.get(o)??[];if(0===l.length)return[];let i=t[o]??0,a=[],s=[],f=n.get(o);for(let e of l){let t=r.get(e)??i;t>i?a.push({child:e,min:t}):s.push(e)}return a.sort((e,t)=>e.min===t.min?e.child.localeCompare(t.child):e.min-t.min),s.sort((e,t)=>{let n=f?.get(e)??0,o=f?.get(t)??0;if(n!==o)return n-o;let l=r.get(e)??i,a=r.get(t)??i;return l!==a?l-a:e.localeCompare(t)}),[...a.map(e=>e.child),...s]}}function ty(e,t,n){let r=ti(e,{rankHint:t,laneOf:n}),{children:o,roots:l}=r;for(let t of e.nodes)o.has(t)||o.set(t,[]);let i=th(e,t,r),a=[...l].sort(tc(t)),s=tg(a,o,t),f=tm(o,t,i,s),d=tp(a,e.nodes,t,f);return tx(d)}function tb(e,t,n){let r=new Set(e),o=new Set(t),l=e9(t),i=[];for(let e of n)r.has(e.src)&&o.has(e.dst)&&i.push(l.get(e.dst));return te(i)}function tM(e,t,n){let r=[];for(let e of t){let t=n[e.src],o=n[e.dst];if(null==t||null==o||t===o)continue;let l=e.src,i=e.dst,a=t,s=o;t>o&&(l=e.dst,i=e.src,a=o,s=t);for(let t=a;t<s;t++)r.push({id:`${e.id}@${t}`,src:l,dst:i,ref:e.ref})}let o=0;for(let t=0;t+1<e.length;t++)o+=tb(e[t],e[t+1],r);return o}function tK(e,t){let n={...t},{preds:r}=e8(e),o=tr(e),l=tM(ty(e,n,o),e.edges,n);for(let t=0;t<4;t++){let t=!1;for(let i of[...e.nodes].sort((e,t)=>(n[t]??0)-(n[e]??0))){let a=n[i]??0;if(0===a)continue;let s=0;for(let e of r.get(i)??[])s=Math.max(s,(n[e]??0)+1);if(s>=a)continue;n[i]=s;let f=tM(ty(e,n,o),e.edges,n);f<l?(l=f,t=!0):n[i]=a}if(!t)break}return n}function tI(e,t){let n=tr(e);for(let r of[...e.nodes].sort((e,n)=>(t[e]??0)-(t[n]??0)||e.localeCompare(n))){let o=n(r);if(!o)continue;let l=e.edges.filter(e=>e.src===r);if(0===l.length)continue;let i=!1,a=0;for(let e of l){let t=n(e.dst);null==t||t===o?i=!0:a++}if(0===a||i)continue;let s=0,f=!1;for(let t of e.edges){if(t.dst!==r)continue;let e=n(t.src);e&&(e===o?f=!0:s++)}if(s>0||!f)continue;let d=t[r]??0,u=d+a,h=0;for(let n of e.edges)n.dst===r&&(h=Math.max(h,(t[n.src]??0)+1));let g=Math.max(d,h,u);g!==d&&(t[r]=g)}}function tw(e,t){let n=e0(e),r=e7(n)??[...n.nodes].sort(),o=t?.compactSingleInput??!1,l=tr(n),i=Object.create(null);for(let e of r){let r=e1(n,e),a=t?.ignoreCrossLaneEdges?r.filter(t=>{let n=l(t.src),r=l(e);return!n||!r||n===r}):r;if(0===a.length)i[e]=0;else if(o&&1===a.length){let t=a[0].src;l(t)!==l(e)?i[e]=i[t]??0:i[e]=(i[t]??0)+1}else{let t=-1/0;for(let e of a)t=Math.max(t,(i[e.src]??0)+1);i[e]=-1/0===t?0:t}}return t?.optimizeRanksByCrossings&&(i=tK(n,i)),t?.ignoreCrossLaneEdges&&tI(n,i),{layers:ty(n,i,l),rankOf:i,dummy:new Set}}function tS(e,t){let n=e0(e),r={...tw(n,{compactSingleInput:t?.compactSingleInput,ignoreCrossLaneEdges:t?.ignoreCrossLaneEdges,optimizeRanksByCrossings:t?.optimizeRanksByCrossings}).rankOf},o=tr(n),{preds:l,succs:a}=e8(n,e=>{if(t?.ignoreCrossLaneEdges){let t=o(e.src),n=o(e.dst);if(t&&n&&t!==n)return!1}return!0}),s=e7(n)??[...n.nodes],f=[...s].reverse(),d=(0,i.K)((e,t)=>{let n=0;for(let t of l.get(e)??[])n=Math.max(n,(r[t]??0)+1);let o=1/0,i=a.get(e)??[];return i.length>0&&(o=Math.min(...i.map(e=>(r[e]??0)-1))),Number.isFinite(o)||(o=Math.max(n,t)),Math.min(Math.max(t,n),o)},"clampFeasible"),u=(0,i.K)(e=>{let t=!1;for(let n of e){let e=l.get(n)??[],o=a.get(n)??[];if(0===e.length&&0===o.length)continue;let i=Math.round(((e.length>0?e.reduce((e,t)=>e+(r[t]??0)+1,0)/e.length:r[n]??0)+(o.length>0?o.reduce((e,t)=>e+(r[t]??0)-1,0)/o.length:r[n]??0))/2),s=d(n,i);s!==r[n]&&(r[n]=s,t=!0)}return t},"relaxOrder");for(let e=0;e<8;e++){let e=u(s),t=u(f);if(!e&&!t)break}for(let e of s){let t=0;for(let n of l.get(e)??[])t=Math.max(t,(r[n]??0)+1);(r[e]??0)<t&&(r[e]=t)}for(let e of f){let t=a.get(e)??[];if(t.length>0){let n=Math.min(...t.map(e=>(r[e]??0)-1));(r[e]??0)>n&&(r[e]=n)}}return{layers:e4(n,s,r),rankOf:r,dummy:new Set}}function tv(e){let t=e5(e),n=e6(e),r=e3(t),o=[];for(;r.length>0;){let e=[];for(let l of r)for(let r of(o.push(l),n.get(l)??[]))t.set(r,(t.get(r)??0)-1),(t.get(r)??0)===0&&e.push(r);r=e.sort((e,t)=>e.localeCompare(t))}return o.length===e.nodes.length?o:null}function tC(e,t){let n=e0(e),r=t?.direction==="LR"?tv(n)??[...n.nodes].sort():e7(n)??[...n.nodes].sort(),o=tr(n),l=(0,i.K)(e=>o(e)??e,"laneOf"),a=Object.create(null),s=new Map,f=(0,i.K)((e,n)=>t?.ignoreCrossLaneEdges??!0?+(l(e)===l(n)):1,"edgeWeight");for(let e of r){let t=n.nodeById.get(e);if(t?.isGroup)continue;let r=e1(n,e),o=0;if(r.length>0)for(let t of r){let n=t.src;o=Math.max(o,(a[n]??0)+f(n,e))}let i=l(e),d=Math.max(o,s.get(i)??0);a[e]=d,s.set(i,d+1)}return{layers:e4(n,r,a,{skipGroups:!0}),rankOf:a,dummy:new Set}}function tL(e,t){let n=e0(t),{rankOf:r}=e,o=e.layers.map(e=>[...e]),l=new Set(e.dummy?[...e.dummy]:[]),a=0,s=new Map(n.nodeById),f=(0,i.K)(e=>{let t=`placeholder-${a++}`;for(s.set(t,{id:t,isGroup:!1,isDummy:!0,width:0,height:0}),l.add(t);o.length<=e;)o.push([]);return o[e].push(t),r[t]=e,t},"addDummyAt"),d=[...n.edges].sort((e,t)=>e.id===t.id?e.src===t.src?e.dst.localeCompare(t.dst):e.src.localeCompare(t.src):e.id.localeCompare(t.id)),u=[];for(let e of d){let t=r[e.src]??0,n=r[e.dst]??0;if(n-t<=1){u.push(e);continue}let o=e.src;for(let r=t+1,l=0;r<n;r++,l++){let t=f(r);u.push({id:`${e.id}#${l}`,src:o,dst:t,weight:e.weight,ref:e.ref}),o=t}let l=n-t-2;u.push({id:`${e.id}#${Math.max(l+1,0)}`,src:o,dst:e.dst,weight:e.weight,ref:e.ref})}let h={nodes:[...n.nodes,...[...l].filter(e=>!n.nodes.includes(e))],edges:u,layout:n.layout,nodeById:s};return{layering:{layers:o,rankOf:r,dummy:l},graphWithDummies:h}}function tk(e){let t=e.length;if(0===t)return 1/0;let n=[...e].sort((e,t)=>e-t);return t%2==1?n[(t-1)/2]:.5*(n[t/2-1]+n[t/2])}function t$(e){return 0===e.length?1/0:e.reduce((e,t)=>e+t,0)/e.length}function tR(e,t,n,r){let o=new Map;for(let t of e)o.set(t,[]);for(let e of n)"down"===r?t.has(e.src)&&o.has(e.dst)&&o.get(e.dst).push(t.get(e.src)):t.has(e.dst)&&o.has(e.src)&&o.get(e.src).push(t.get(e.dst));return o}function tO(e,t,n){let r=n.get(e)??0,o=n.get(t)??0;return r!==o?r-o:e.localeCompare(t)}function tT(e,t,n){let r=new Set(e),o=new Set(t),l=e9(e),i=e9(t),a=[];for(let e of n)r.has(e.src)&&o.has(e.dst)&&a.push({u:l.get(e.src),v:i.get(e.dst)});return a.sort((e,t)=>e.u===t.u?e.v-t.v:e.u-t.u),te(a.map(e=>e.v))}function tF(e,t,n){return[...e].sort((e,r)=>{let o=tk(t.get(e)??[]),l=tk(t.get(r)??[]);return o===l?tO(e,r,n):isFinite(o)?isFinite(l)?o-l:-1:1})}function tE(e,t,n,r,o,l){let i=e9(e),a=e9(t),s=tR(t,i,n,r);if(!o||!l||0===l.length)return tF(t,s,a);let f=new Map;for(let e of t){let t=o(e),n=f.get(t)??[];n.push(e),f.set(t,n)}let d=[];for(let e of l){let t=f.get(e);if(!t||0===t.length)continue;let n=tF(t,s,a);d.push(...n)}let u=f.get(null);if(u&&u.length>0)for(let e of tF(u,s,a)){let t=t$(s.get(e)??[]),n=d.length;if(isFinite(t)){for(let[e,r]of d.entries())if(t<t$(s.get(r)??[])){n=e;break}}d.splice(n,0,e)}return d}function tB(e,t,n,r,o){let l=[...t],a=new Set(e),s=new Set(t),f=r?new Set(r):null,d=n.filter(e=>a.has(e.src)&&s.has(e.dst)),u=f?n.filter(e=>s.has(e.src)&&f.has(e.dst)):void 0,h=(0,i.K)(t=>{let n=tT(e,t,d);return u&&r&&(n+=tT(t,r,u)),n},"crossingScore"),g=o?new Map:null;if(o&&g)for(let e of t)g.set(e,o(e));let c=!0,p=h(l);for(;c;){c=!1;for(let e=0;e+1<l.length;e++){if(g&&g.get(l[e])!==g.get(l[e+1]))continue;let t=p;[l[e],l[e+1]]=[l[e+1],l[e]];let n=h(l);n<t?(p=n,c=!0):[l[e],l[e+1]]=[l[e+1],l[e]]}}return l}function tN(e,t,n){let r=e.layers.map(e=>[...e]),o=t.edges,l=tr(t),i=tl(t,n?.laneOrder);for(let e=0;e<3;e++){for(let e=1;e<r.length;e++)r[e]=tE(r[e-1],r[e],o,"down",l,i),r[e]=tB(r[e-1],r[e],o,r[e+1],l);for(let e=r.length-2;e>=0;e--)r[e]=tE(r[e+1],r[e],o,"up",l,i),r[e]=tB(r[e+1],r[e],o,r[e-1],l)}return{layers:r}}function tX(e,t,n){let r=n?.layerGap??100,o=n?.nodeGap??40,l=n?.laneGap??2*o,a=n?.direction??"TB",s=e.layers,f=Object.create(null),d=Object.create(null),u=(0,i.K)(e=>t.nodeById.get(e),"getNode"),h=(0,i.K)(e=>u(e)?.width??0,"getWidth"),g=(0,i.K)(e=>u(e)?.height??0,"getHeight"),c=tr(t),p=tl(t,n?.laneOrder),x=s.map(e=>e.reduce((e,t)=>Math.max(e,g(t)),0)),m=[];if("LR"===a||"RL"===a)for(let e=0;e+1<s.length;e++){let t=Math.max(0,(s[e].reduce((e,t)=>Math.max(e,h(t)),0)+s[e+1].reduce((e,t)=>Math.max(e,h(t)),0))/2-(x[e]/2+x[e+1]/2)-r);m.push(t)}let y=new Set;for(let e of s)for(let t of e)y.add(c(t));let b=y.has(null),M=p.filter(e=>y.has(e)),K=[...b?[null]:[],...M],I=Object.create(null);for(let e of M)I[e]=0;for(let e of(b&&(I.null=0),s)){let t=Object.create(null),n=[];for(let r of e){let e=c(r);null===e?n.push(r):(t[e]||=[]).push(r)}for(let[e,n]of Object.entries(t)){let t=n.reduce((e,t)=>e+h(t),0)+o*Math.max(0,n.length-1);I[e]=Math.max(I[e]??0,t)}if(b&&n.length){let e=n.reduce((e,t)=>e+h(t),0)+o*Math.max(0,n.length-1);I.null=Math.max(I.null??0,e)}}let w=new Map;{let e=K.map(e=>(null===e?I.null:I[e])??0),t=-(e.reduce((e,t)=>e+t,0)+l*Math.max(0,K.length-1))/2;for(let n=0;n<K.length;n++){let r=K[n],o=e[n]??0,i=t+o/2;w.set(r,i),t+=o,n<K.length-1&&(t+=l)}}let S=0;for(let[e,t]of s.entries()){let n=x[e]??0,l=new Map;for(let e of t){let t=c(e),n=l.get(t)??[];n.push(e),l.set(t,n)}for(let e of K){let t=l.get(e)??[];if(0===t.length)continue;let r=w.get(e);if(1===t.length){let e=t[0];f[e]=r,d[e]=S+n/2}else{let e=t.map(e=>h(e)),l=r-(e.reduce((e,t)=>e+t,0)+o*(t.length-1))/2;for(let[r,i]of t.entries()){let t=e[r];f[i]=l+t/2,d[i]=S+n/2,l+=t+o}}}S+=n+r+(m[e]??0)}let v=new Map;for(let e of t.edges){let t=e.ref.id;v.has(t)||v.set(t,[]),v.get(t).push(e)}for(let[,e]of v){if(0===e.length)continue;let n=e[0].ref,r=n.start,o=n.end;if(null==r||null==o)continue;let l=Math.round(((f[r]??0)+(f[o]??0))/2),i=new Set;for(let t of e)i.add(t.src),i.add(t.dst);for(let e of i){if(e===r||e===o)continue;let n=t.nodeById.get(e);n?.isDummy&&(f[e]=l)}}return{x:f,y:d}}function tY(e){let t=0x811c9dc5;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,0x1000193);return t>>>0}function tz(e){let t=e>>>0;return()=>{let e=t+=0x6d2b79f5;return e=Math.imul(e^e>>>15,1|e),(((e^=e+Math.imul(e^e>>>7,61|e))^e>>>14)>>>0)/0x100000000}}function tA(e,t){let n=[...e],r=tz(t);for(let e=n.length-1;e>0;e--){let t=Math.floor(r()*(e+1));[n[e],n[t]]=[n[t],n[e]]}return n}function tG(e,t){let n=0;for(let[r,o]of e.entries())n+=Math.abs(r-(t.get(o)??r));return n}function tP(e,t){let n=new Map;for(let[t,r]of e.entries())n.set(r,t);let r=0;for(let{a:e,b:o,weight:l}of t){let t=n.get(e),i=n.get(o);null!=t&&null!=i&&(r+=l*Math.abs(t-i))}return r}function tD(e){let t=to(e);if(t.length<2)return[];let n=new Map(t.map((e,t)=>[e,t])),r=tr(e),o=new Map;for(let t of e.layout.edges??[]){if(t.isLayoutOnly)continue;let l="string"==typeof t.start?t.start:void 0,i="string"==typeof t.end?t.end:void 0;if(!l||!i||!e.nodeById.has(l)||!e.nodeById.has(i))continue;let a=r(l),s=r(i);if(!a||!s||a===s)continue;let f=n.get(a),d=n.get(s);if(null==f||null==d)continue;let[u,h]=f<=d?[a,s]:[s,a],g=`${u}\0${h}`,c=o.get(g);c?c.weight++:o.set(g,{a:u,b:h,weight:1})}return[...o.values()]}function tH(e,t,n){let r=[...e],o=tP(r,t),l=!0,i=0,a=Math.max(1,r.length);for(;l&&i<a;){l=!1,i++;for(let e=0;e+1<r.length;e++){[r[e],r[e+1]]=[r[e+1],r[e]];let n=tP(r,t);n<o?(o=n,l=!0):[r[e],r[e+1]]=[r[e+1],r[e]]}}return{order:r,cost:o,sourceDistance:tG(r,n)}}function tj(e,t){return e.cost!==t.cost?e.cost<t.cost:e.sourceDistance<t.sourceDistance}function tV(e,t,n){let r=[...t].sort((e,t)=>e.a===t.a?e.b.localeCompare(t.b):e.a.localeCompare(t.a)).map(({a:e,b:t,weight:n})=>`${e}:${t}:${n}`).join("|");return tY(`${e.join("|")}#${r}#${n}`)}function t_(e,t={}){let n=to(e);if(n.length<2)return n;let r=tD(e);if(0===r.length)return n;let o=new Map(n.map((e,t)=>[e,t])),l=tH(n,r,o),i=Math.max(0,t.restarts??8);for(let e=0;e<i;e++){let t=tV(n,r,e),i=tH(tA(n,t),r,o);tj(i,l)&&(l=i)}return l.order}function tW(e,t){let n=t?.ignoreCrossLaneEdges??!0,r=t?.optimizeRanksByCrossings??!0,o=e0(e),l=t?.automaticLaneOrdering?t_(o,{restarts:8}):void 0,i=tt(o),a=i.acyclic,{layering:s,graphWithDummies:f}=tL(n?tC(a,{compactSingleInput:t?.compactSingleInput??!0,ignoreCrossLaneEdges:!0,direction:t?.direction}):tS(a,{compactSingleInput:t?.compactSingleInput??!0,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:r}),a),d=tN(s,f,{laneOrder:l}),u=tX(d,f,{layerGap:t?.layerGap,nodeGap:t?.nodeGap,direction:t?.direction,laneOrder:l});return{acyclic:a,reversed:i.reversed,layering:s,ordered:d,coordinates:u}}function tq(e,t,n){let r=e.x??0,o=e.y??0,l=t.x-r,i=t.y-o,a=Math.abs(l),s=Math.abs(i);return a<1e-6&&s<1e-6?n:s>1e-6&&3*s>=a?i>0?"bottom":"top":a>1e-6?l>0?"right":"left":n}function tJ(e,t){return 1e-6>Math.abs(e.to-t.from)||1e-6>Math.abs(e.to-t.to)?e.to:e.from}function tZ(e,t){return"vertical"===e.orient?{x:e.coord,y:t}:{x:t,y:e.coord}}function tQ(e,t){let n=e.nodes??[],r=e.edges??[],o=[];for(let e of r)e.isLayoutOnly||o.push({...e,__originalEdge:e});let l=new Map,a=new Map,s=[],f="LR"===t;for(let e of n)l.set(e.id,e);for(let e of n.filter(e=>e.isGroup&&!e.parentId)){let t={id:e.id},r=(0,i.K)(e=>{a.set(e.id,t),n.filter(t=>t.parentId===e.id).forEach(r)},"assignLane");r(e)}let d=n.filter(e=>!e.isGroup&&!e.isEdgeLabel).map(e=>{let t=e.width??10,n=e.height??10,r=e.x??0,o=e.y??0;return{nodeId:e.id,minX:r-t/2-8,maxX:r+t/2+8,minY:o-n/2-8,maxY:o+n/2+8,visualXHalfExtent:f?n/2+8:t/2+8}}),u=(0,i.K)((e,t,n,r)=>{let o=s.find(n=>n.orientation===e&&1>Math.abs(n.coord-t));return o||(o={id:`pipe-${e}-${t.toFixed(0)}`,orientation:e,coord:t,spanMin:n,spanMax:r,tracks:[]},s.push(o)),o.spanMin=Math.min(o.spanMin,n),o.spanMax=Math.max(o.spanMax,r),o},"getOrAddPipe"),h=(0,i.K)((e,t)=>{let n=e.width??10,r=e.height??10,o=e.x??0,l=e.y??0;switch(t){case"top":return{x:o,y:l-r/2};case"bottom":return{x:o,y:l+r/2};case"left":return{x:o-n/2,y:l};case"right":return{x:o+n/2,y:l}}},"portForSide"),g=(0,i.K)((e,t,n)=>h(e,tq(e,t,n?"bottom":"top")),"getOrthogonalPort"),c=[],p=[],x=new Set,m=(0,i.K)((e,t,n)=>{if(0===c.length)return 0;let r=1e-6>Math.abs(t.y-n.y),o=1e-6>Math.abs(t.x-n.x);if(!r&&!o)return 0;let l=0;if(r){let r=t.y,o=Math.min(t.x,n.x)-1e-6,i=Math.max(t.x,n.x)+1e-6;if(i<=o)return 0;for(let t of c)t.edgeIndex!==e&&"vertical"===t.orientation&&!(t.pipe.coord<o)&&!(t.pipe.coord>i)&&t.from-1e-6<=r&&t.to+1e-6>=r&&(l+=1e3)}else if(o){let r=t.x,o=Math.min(t.y,n.y)-1e-6,i=Math.max(t.y,n.y)+1e-6;if(i<=o)return 0;for(let t of c)t.edgeIndex!==e&&"horizontal"===t.orientation&&!(t.pipe.coord<o)&&!(t.pipe.coord>i)&&t.from-1e-6<=r&&t.to+1e-6>=r&&(l+=1e3)}return l},"crossingPenalty"),y=o.map((e,t)=>{if(!e.start||!e.end)return{idx:t,crossLane:0,dx:0,dy:0};let n=l.get(e.start),r=l.get(e.end),o=a.get(e.start),i=a.get(e.end),s=o&&i&&o.id!==i.id?1:0;return{idx:t,crossLane:s,dx:n&&r?Math.abs((r.x??0)-(n.x??0)):0,dy:n&&r?Math.abs((r.y??0)-(n.y??0)):0}}).sort((e,t)=>{if(e.crossLane!==t.crossLane)return t.crossLane-e.crossLane;let n=e.dx+e.dy,r=t.dx+t.dy;return Math.abs(n-r)>1?n-r:e.idx-t.idx}).map(e=>e.idx),b=(0,i.K)((e,t,n,r)=>{let o=Math.min(e.x,t.x),l=Math.max(e.x,t.x),i=Math.min(e.y,t.y),a=Math.max(e.y,t.y);return!!d.find(s=>(!n||s.nodeId!==n)&&(!r||s.nodeId!==r)&&(Math.abs(e.x-t.x)>1e-6?s.minY<e.y&&s.maxY>e.y&&s.maxX>o&&s.minX<l:s.minX<e.x&&s.maxX>e.x&&s.maxY>i&&s.minY<a))},"isSegmentBlocked"),M=new Map,K=new Map;for(let e of o)e.start&&e.end&&e.start!==e.end&&(K.set(e.start,(K.get(e.start)??0)+1),K.set(e.end,(K.get(e.end)??0)+1));let I=(0,i.K)((e,t)=>tq(e,t,"bottom"),"determineSide"),w=new Map;for(let[e,t]of o.entries()){if(!t.start||!t.end||t.start===t.end||t.points&&t.points.length>0)continue;let n=l.get(t.start),r=l.get(t.end);if(!n||!r)continue;let o=(r.x??0)-(n.x??0),i=(r.y??0)-(n.y??0);w.set(e,{edgeIdx:e,srcId:t.start,dstId:t.end,srcSide:I(n,{x:r.x??0,y:r.y??0}),dstSide:I(r,{x:n.x??0,y:n.y??0}),absDx:Math.abs(o),absDy:Math.abs(i),dxSign:Math.sign(o),dySign:Math.sign(i)})}let S=(0,i.K)(e=>"top"===e.srcSide||"bottom"===e.srcSide?0===e.absDx?1/0:e.absDy/e.absDx:0===e.absDy?1/0:e.absDx/e.absDy,"preferenceStrength"),v=(0,i.K)(e=>"top"===e.srcSide||"bottom"===e.srcSide?e.dxSign>=0?"right":"left":e.dySign>=0?"bottom":"top","secondarySide"),C=new Map;for(let e of w.values()){let t=`${e.srcId}:${e.srcSide}`;C.has(t)||C.set(t,[]),C.get(t).push(e)}let L=new Map,k=(0,i.K)((e,t)=>`${e}:${t}`,"loadKey");for(let e of w.values())L.set(k(e.srcId,e.srcSide),(L.get(k(e.srcId,e.srcSide))??0)+1),L.set(k(e.dstId,e.dstSide),(L.get(k(e.dstId,e.dstSide))??0)+1);for(let e of C.values())if(!(e.length<2)){e.sort((e,t)=>{let n=S(e),r=S(t);return Math.abs(n-r)>1e-9?r-n:e.edgeIdx-t.edgeIdx});for(let t=1;t<e.length;t++){let n=e[t],r=v(n),o=L.get(k(n.srcId,n.srcSide))??0,l=L.get(k(n.srcId,r))??0;l>=o||(L.set(k(n.srcId,n.srcSide),o-1),L.set(k(n.srcId,r),l+1),n.srcSide=r)}}let $=(0,i.K)(e=>{let t=e?.shape;return"question"===t||"diamond"===t},"isDiamondNode"),R=new Map;for(let e of w.values())R.has(e.dstId)||R.set(e.dstId,new Set),R.get(e.dstId).add(e.dstSide);for(let e of w.values()){if(!$(l.get(e.srcId)))continue;let t=R.get(e.srcId);if(!t?.has(e.srcSide))continue;let n=v(e);if(t.has(n)||(L.get(k(e.srcId,n))??0)>0)continue;let r=L.get(k(e.srcId,e.srcSide))??0;L.set(k(e.srcId,e.srcSide),Math.max(0,r-1)),L.set(k(e.srcId,n),1),e.srcSide=n}for(let e of w.values()){let{edgeIdx:t,srcId:n,dstId:r,srcSide:o,dstSide:i}=e,a=l.get(n),s=l.get(r),f=`${n}:${o}:src`,d="top"===o||"bottom"===o?s.x??0:s.y??0;M.has(f)||M.set(f,[]),M.get(f).push({edgeIdx:t,oppositeCoord:d});let u=`${r}:${i}:dst`,h="top"===i||"bottom"===i?a.x??0:a.y??0;M.has(u)||M.set(u,[]),M.get(u).push({edgeIdx:t,oppositeCoord:h})}let O=new Map;for(let[e,t]of M){if(t.length<2)continue;t.sort((e,t)=>e.oppositeCoord-t.oppositeCoord);let n=e.split(":"),r=n.slice(0,-2).join(":"),o=n[n.length-2],i=n[n.length-1],a=l.get(r);if(!a)continue;let s="left"===o||"right"===o?a.height??10:a.width??10,f=a.shape,d=Math.min(20,Math.max(8,("question"===f||"diamond"===f?.3*s:s)/(t.length+1))),u=-(d*(t.length-1))/2;for(let[e,n]of t.entries()){let t=u+e*d,r=`${n.edgeIdx}:${i}`;O.set(r,t)}}let T=(0,i.K)(e=>!!o[e]?.labelNodeId,"edgeHasLabelNode"),F=(0,i.K)((e,t)=>!!e&&((M.get(`${e}:${t}:src`)??[]).some(({edgeIdx:e})=>T(e))||(M.get(`${e}:${t}:dst`)??[]).some(({edgeIdx:e})=>T(e))),"faceHasLabelNode"),E=(0,i.K)((e,t,n)=>"top"===t||"bottom"===t?{x:e.x+n,y:e.y}:{x:e.x,y:e.y+n},"applyPortOffset"),B=(0,i.K)((e,t,n)=>{let r=w.get(e),o={x:n.x??0,y:n.y??0},l={x:t.x??0,y:t.y??0},i=r?.srcSide??I(t,o),a=r?.dstSide??I(n,l),s=r?h(t,r.srcSide):g(t,o,!0),f=r?h(n,r.dstSide):g(n,l,!1),d=O.get(`${e}:src`),u=O.get(`${e}:dst`);return void 0!==d&&(s=E(s,i,d)),void 0!==u&&(f=E(f,a,u)),{pSrcPort:s,pDstPort:f,srcSide:i,dstSide:a}},"portsForEdge");for(let e of y){let t=o[e];if(p[e]=[],!t.start||!t.end||t.points&&t.points.length>0||t.start===t.end)continue;let n=l.get(t.start),r=l.get(t.end);if(!n||!r)continue;let{pSrcPort:a,pDstPort:h,srcSide:g,dstSide:y}=B(e,n,r),I={...a},w={...h},S="top"===g||"bottom"===g,v="top"===y||"bottom"===y;S?I.y=a.y>(n.y??0)?a.y+20:a.y-20:I.x=a.x>(n.x??0)?a.x+20:a.x-20,v?w.y=h.y>(r.y??0)?h.y+20:h.y-20:w.x=h.x>(r.x??0)?h.x+20:h.x-20;let C=(0,i.K)((e,t)=>{for(let n of d)if(!t.includes(n.nodeId)&&e.x>n.minX&&e.x<n.maxX&&e.y>n.minY&&e.y<n.maxY)return{inside:!0,obstacle:n};return{inside:!1}},"isPointInObstacle"),L=(0,i.K)((e,t,n,r,o)=>{if(o){let o=e.y>(t.y??0);return{x:(n.x??0)>=e.x?r.maxX+15:r.minX-15,y:o?r.maxY+15:r.minY-15,leavesPositiveSide:o}}let l=e.x>(t.x??0),i=(n.y??0)>=e.y;return{x:l?r.maxX+15:r.minX-15,y:i?r.maxY+15:r.minY-15,leavesPositiveSide:l}},"obstacleDetour"),k=[],$=[t.start,t.end],R=C(I,$);if(R.inside&&R.obstacle){let e=R.obstacle;if(S){let t=L(a,n,r,e,!0);I.x=t.x,I.y=t.y;let o=t.leavesPositiveSide?Math.min(e.minY-2,a.y+20):Math.max(e.maxY+2,a.y-20);k=[{x:a.x,y:o},{x:t.x,y:o},{x:t.x,y:t.y}]}else{let t=L(a,n,r,e,!1),o=t.leavesPositiveSide?Math.min(e.minX-2,a.x+20):Math.max(e.maxX+2,a.x-20);I.x=t.x,I.y=t.y,k=[{x:o,y:a.y},{x:o,y:t.y},{x:t.x,y:t.y}]}}let T=[],E=C(w,$);if(E.inside&&E.obstacle){let e=E.obstacle;if(v){let t=L(h,r,n,e,!0);w.x=t.x,w.y=t.y,T=[{x:t.x,y:t.y},{x:h.x,y:t.y}]}else{let t=L(h,r,n,e,!1);w.x=t.x,w.y=t.y,T=[{x:t.x,y:t.y},{x:t.x,y:h.y}]}}if(0===k.length&&0===T.length){let n=15>Math.abs(I.x-w.x),r=15>Math.abs(I.y-w.y),o=void 0!==O.get(`${e}:src`)||void 0!==O.get(`${e}:dst`),l=(M.get(`${t.start??""}:${g}:src`)?.length??0)+(M.get(`${t.start??""}:${g}:dst`)?.length??0),i=(M.get(`${t.end??""}:${y}:src`)?.length??0)+(M.get(`${t.end??""}:${y}:dst`)?.length??0),s=l>1||i>1,f=K.get(t.start??"")??0,d=K.get(t.end??"")??0,u=l>1&&F(t.start,g)||i>1&&F(t.end,y),p=l<=1||f<=2,m=i<=1||d<=2,S=s&&!u&&p&&m;if((n||r)&&!o&&(!s||S)&&!b(a,h,t.start,t.end)){t.points=[{...a},{...I},{...w},{...h}],x.add(e);let n=r?"horizontal":"vertical",o=r?a.y:a.x,l=r?Math.min(a.x,h.x):Math.min(a.y,h.y),i=r?Math.max(a.x,h.x):Math.max(a.y,h.y),s={id:`fast-path-${n}-${o.toFixed(0)}-${e}`,orientation:n,coord:o,spanMin:l,spanMax:i,tracks:[]};c.push({edgeIndex:e,segmentIndex:0,orientation:n,pipe:s,trackIndex:0,from:l,to:i});continue}}let N=u("vertical",I.x,I.y,I.y);I.x=N.coord;let X=u("vertical",w.x,w.y,w.y);w.x=X.coord;let Y=Math.min(I.x,w.x)-50,z=Math.max(I.x,w.x)+50,A=Math.min(I.y,w.y)-50,G=Math.max(I.y,w.y)+50;for(let e of d){let t=Math.min(I.x,w.x),n=Math.max(I.x,w.x),r=Math.min(I.y,w.y),o=Math.max(I.y,w.y);e.minX<n&&e.maxX>t&&e.minY<o&&e.maxY>r&&(Y=Math.min(Y,e.minX-25),z=Math.max(z,e.maxX+25),A=Math.min(A,e.minY-25),G=Math.max(G,e.maxY+25))}for(let e of d)e.maxX<Y||e.minX>z||e.maxY<A||e.minY>G||(u("horizontal",e.minY-15,Y,z),u("horizontal",e.maxY+15,Y,z),u("vertical",e.minX-15,A,G),u("vertical",e.maxX+15,A,G));u("horizontal",I.y,Y,z),u("horizontal",w.y,Y,z);let P=s.filter(e=>"horizontal"===e.orientation&&e.coord>=A&&e.coord<=G),D=s.filter(e=>"vertical"===e.orientation&&e.coord>=Y&&e.coord<=z),H=(0,i.K)((e,t)=>`${e.toFixed(1)},${t.toFixed(1)}`,"getKey"),j=H(I.x,I.y),V=H(w.x,w.y),_=new Map,W=new Map,q=new Map,J=new Set,Z=[];_.set(j,0),q.set(j,"n"),Z.push({key:j,f:Math.hypot(w.x-I.x,w.y-I.y),pt:I}),J.add(j);let Q=[],U=(0,i.K)((e,n)=>b(e,n,t.start,t.end),"checkSegmentBlocked"),ee={x:w.x,y:I.y},et=U(I,ee),en=U(ee,w),er=et||en,eo={x:I.x,y:w.y},el=U(I,eo),ei=U(eo,w),ea=el||ei;if(er?ea||(Q=1e-6>Math.abs(I.x-w.x)?[I,w]:[I,eo,w]):Q=1e-6>Math.abs(I.y-w.y)||1e-6>Math.abs(I.x-w.x)?[I,w]:[I,ee,w],0===Q.length)for(;Z.length>0;){Z.sort((e,t)=>e.f-t.f);let n=Z.shift();if(J.delete(n.key),n.key===V){let e=V,t=w;for(Q=[t];W.has(e);){let n=W.get(e);Q.unshift(n),t=n,e=H(n.x,n.y)}break}let r=n.pt.x,o=n.pt.y,l=D.sort((e,t)=>e.coord-t.coord),i=l.findIndex(e=>1>Math.abs(e.coord-r)),a=P.sort((e,t)=>e.coord-t.coord),s=a.findIndex(e=>1>Math.abs(e.coord-o)),f=[];for(let u of(i>0&&f.push({x:l[i-1].coord,y:o}),i>=0&&i<l.length-1&&f.push({x:l[i+1].coord,y:o}),s>0&&f.push({x:r,y:a[s-1].coord}),s>=0&&s<a.length-1&&f.push({x:r,y:a[s+1].coord}),f)){let l=Math.min(r,u.x),i=Math.max(r,u.x),a=Math.min(o,u.y),s=Math.max(o,u.y);if(d.some(e=>e.nodeId!==t.start&&e.nodeId!==t.end&&(l!==i?e.minY<o&&e.maxY>o&&e.maxX>l&&e.minX<i:e.minX<r&&e.maxX>r&&e.maxY>a&&e.minY<s)))continue;let f=H(u.x,u.y),h=Math.abs(u.x-r)+Math.abs(u.y-o),g=m(e,n.pt,u),c=0,p=w.x-I.x,x=w.y-I.y,y=u.x-r,b=u.y-o;(x>10&&b<-5||x<-10&&b>5)&&(c=100*Math.abs(b)),(p>10&&y<-5||p<-10&&y>5)&&(c+=50*Math.abs(y));let M=0,K=q.get(n.key)??"n",S=Math.abs(y)>1e-6?"h":"v";"n"!==K&&K!==S&&(M=50);let v=h+g+c+M,C=(_.get(n.key)??1/0)+v,L=Math.abs(w.x-u.x)+Math.abs(w.y-u.y);if(C<(_.get(f)??1/0))if(W.set(f,n.pt),_.set(f,C),q.set(f,S),J.has(f)){let e=Z.findIndex(e=>e.key===f);-1!==e&&(Z[e].f=C+L)}else Z.push({key:f,f:C+L,pt:u}),J.add(f)}}if(0===Q.length&&(Q=[I,{x:I.x,y:w.y},w]),Q.length>4){let e=Q[0],t=Q[Q.length-1],n=Math.min(e.x,t.x),r=Math.max(e.x,t.x),o=Math.min(e.y,t.y),l=Math.max(e.y,t.y);for(let e of Q)n=Math.min(n,e.x),r=Math.max(r,e.x),o=Math.min(o,e.y),l=Math.max(l,e.y);let a=r>Math.max(e.x,t.x),s=n<Math.min(e.x,t.x);if(f){if(a){let n=Math.max(e.x,t.x),o=Math.min(e.y,t.y),l=Math.max(e.y,t.y),i=d.filter(e=>e.minX<n&&e.maxX>n&&e.minY<l&&e.maxY>o);if(i.length>0){let n=Math.max(e.x,t.x);for(let e of i){let t=(e.minX+e.maxX)/2;void 0===e.visualXHalfExtent||isNaN(e.visualXHalfExtent)||(n=Math.max(n,t+e.visualXHalfExtent+15))}isNaN(n)||(r=n)}}if(s){let r=d.filter(n=>n.minX<Math.min(e.x,t.x)+15&&n.minY<Math.max(e.y,t.y)&&n.maxY>Math.min(e.y,t.y));if(r.length>0){let o=Math.min(e.x,t.x);for(let e of r)o=Math.min(o,(e.minX+e.maxX)/2-e.visualXHalfExtent-15);n=o}}}let u=(0,i.K)(n=>{let r=t.y>e.y,o=d.filter(n=>{let r=Math.min(e.x,t.x)<n.maxX&&Math.max(e.x,t.x)>n.minX,o=Math.min(e.y,t.y)<n.maxY&&Math.max(e.y,t.y)>n.minY;return r&&o}),l=o;if(f&&o.length>0){let e=o.filter(e=>e.minX<n&&e.maxX>n);e.length>0&&(l=e)}if(0===l.length)return t.y;if(r){let e=Math.max(...l.map(e=>e.maxY))+15;if(e<t.y-1e-6)return e}else{let e=Math.min(...l.map(e=>e.minY))-15;if(e>t.y+1e-6)return e}return t.y},"findBestReturnY"),h=(0,i.K)(n=>{let r=u(n),o={x:n,y:e.y},l={x:n,y:r},i={x:t.x,y:r},a=U(e,o),s=U(o,l),f=U(l,i),d=r!==t.y&&U(i,t);return a||s||f||d?null:1e-6>Math.abs(r-t.y)?[e,o,l,t]:[e,o,l,i,t]},"trySimplifyWithDetourX"),g=a&&!s?h(r):s&&!a?h(n):null;g&&(Q=g)}let es=[a,...k,...Q,...T.reverse(),h];if(es.length>=3){let e=es[es.length-1],t=es[es.length-2],n=es[es.length-3],r=1e-6>Math.abs(n.y-t.y)&&1e-6>Math.abs(t.y-e.y),o=1e-6>Math.abs(n.x-t.x)&&1e-6>Math.abs(t.x-e.x);if(r){let r=Math.sign(t.x-n.x),o=Math.sign(e.x-n.x);0!==r&&r===o&&Math.abs(t.x-n.x)>Math.abs(e.x-n.x)&&es.splice(-2,1)}else if(o){let r=Math.sign(t.y-n.y),o=Math.sign(e.y-n.y);0!==r&&r===o&&Math.abs(t.y-n.y)>Math.abs(e.y-n.y)&&es.splice(-2,1)}}let ef=[es[0]];for(let e=1;e<es.length-1;e++){if(1===e){ef.push(es[e]);continue}let t=ef[ef.length-1],n=es[e],r=es[e+1];if(1e-6>Math.abs(t.y-n.y)&&1e-6>Math.abs(n.y-r.y)){n.x>t.x!=r.x>n.x&&ef.push(n);continue}if(1e-6>Math.abs(t.x-n.x)&&1e-6>Math.abs(n.x-r.x)){n.y>t.y!=r.y>n.y&&ef.push(n);continue}ef.push(n)}ef.push(es[es.length-1]);for(let t=0;t<ef.length-1;t++){let n=ef[t],r=ef[t+1],o=1e-6>Math.abs(n.x-r.x)?"vertical":"horizontal",l="vertical"===o?n.x:n.y,i="vertical"===o?Math.min(n.y,r.y):Math.min(n.x,r.x),a="vertical"===o?Math.max(n.y,r.y):Math.max(n.x,r.x),s=u(o,l,i,a),f={edgeIndex:e,segmentIndex:t,orientation:o,pipe:s,trackIndex:0,from:i,to:a};c.push(f),p[e].push(c.length-1),s.tracks[0]||(s.tracks[0]={index:0,coord:s.coord,segments:[]}),s.tracks[0].segments.push({edgeIndex:e,segmentIndex:t,from:i,to:a})}}let N=(0,i.K)((e,t)=>e.from<t.to&&t.from<e.to,"segmentsOverlap"),X=(0,i.K)((e,t,n,r)=>{let o=!r.segments.some(n=>(n.edgeIndex!==t.edgeIndex||n.segmentIndex!==t.segmentIndex)&&N(n,e)),l=!n.segments.some(n=>(n.edgeIndex!==e.edgeIndex||n.segmentIndex!==e.segmentIndex)&&N(n,t));return!!o&&!!l&&(e.trackIndex=r.index,t.trackIndex=n.index,n.segments=[...n.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),{edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to}],r.segments=[...r.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),{edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to}],!0)},"trySwapSegmentsAcrossTracks"),Y=(0,i.K)(e=>{let t=e.tracks.length;return e.tracks[t]={index:t,coord:e.coord,segments:[]},t},"createNewTrack"),z=(0,i.K)((e,t)=>{let n=e.pipe.tracks[e.trackIndex];n.segments=n.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),e.trackIndex=t,e.pipe.tracks[t].segments.push({edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to})},"moveSegmentToTrack"),A=(0,i.K)((e,t)=>{for(let n of p[e.edgeIndex]){let r=c[n];r.pipe===e.pipe&&z(r,t)}},"moveSegmentChainToTrack"),G=(0,i.K)(e=>{let t=p[e.edgeIndex],n=t.indexOf(c.indexOf(e)),r=[];return n>0&&r.push(c[t[n-1]]),n<t.length-1&&r.push(c[t[n+1]]),r},"getAdjacentSegmentsAlongEdge"),P=(0,i.K)((e,t)=>{if(e.orientation===t.orientation)return!1;let n="horizontal"===e.orientation?e:t,r="horizontal"===e.orientation?t:e;return r.pipe.coord>n.from&&r.pipe.coord<n.to&&n.pipe.coord>r.from&&n.pipe.coord<r.to},"haveAnyCrossing"),D=(0,i.K)((e,t)=>{for(let n of e.tracks)if(!n.segments.some(e=>(e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex)&&N(e,t)))return n.index;return -1},"findAvailableTrack"),H=(0,i.K)((e,t)=>{if(e.trackIndex===t.trackIndex)return N(e,t);let n=G(e),r=G(t);return n.some(e=>r.some(t=>P(e,t)))},"segmentsConflict"),j=(0,i.K)((e,t,n)=>{if(X(e,t,e.pipe.tracks[e.trackIndex],t.pipe.tracks[t.trackIndex]))return;let r=D(e.pipe,t);n(t,-1!==r?r:Y(e.pipe))},"resolveTrackConflict"),V=(0,i.K)(e=>{let t=0;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){let o=e[n],l=e[r];o.pipe===l.pipe&&H(o,l)&&(t++,j(o,l,A))}return t},"resolveHandleConflicts"),_=new Map,W=(0,i.K)(e=>{if(_.has(e))return _.get(e);let t=p[e];if(0===t.length){let t={dest:0,deviation:0,base:0,delta:0};return _.set(e,t),t}let n=c[t[0]].pipe.coord,r=n;for(let e=1;e<t.length;e++){let o=c[t[e]];if("horizontal"===o.orientation){let e=o.from,t=o.to;r=Math.abs(e-n)>Math.abs(t-n)?e:t;break}}let o=Math.abs(r-n),l={dest:r,deviation:o,base:n,delta:r-n};return _.set(e,l),l},"getDestInfo"),q=(0,i.K)(()=>{let e=0,t=new Map;for(let[e,n]of o.entries())0!==p[e].length&&n.start&&(t.has(n.start)||t.set(n.start,[]),t.get(n.start).push(e));let n=(0,i.K)(e=>{let t=o[e];if(!t.start||!t.end)return 0;let n=l.get(t.start),r=l.get(t.end);return n&&r?Math.abs((r.x??0)-(n.x??0))+Math.abs((r.y??0)-(n.y??0)):0},"getEdgeDistance");for(let r of t.values())r.sort((e,t)=>{let r=W(e),o=W(t);if(Math.abs(r.deviation-o.deviation)>1)return r.deviation-o.deviation;if(Math.abs(r.dest-o.dest)>1)return r.dest-o.dest;let l=n(e),i=n(t);if(Math.abs(l-i)>1)return i-l;let a=p[e].length,s=p[t].length;if(a!==s)return a-s;if(1===a){let n=p[e][0],r=p[t][0];if(c[n]&&c[r]){let e=c[n],t=c[r],o=Math.abs(e.to-e.from),l=Math.abs(t.to-t.from);if(Math.abs(o-l)>1)return o-l}}return 0}),e+=V(r.map(e=>c[p[e][0]]));return e},"fixSourceHandleCrossings"),J=(0,i.K)(()=>{let e=0,t=new Map;for(let[e,n]of o.entries())0!==p[e].length&&n.end&&(t.has(n.end)||t.set(n.end,[]),t.get(n.end).push(e));for(let n of t.values())n.sort((e,t)=>{let n=(0,i.K)(e=>{let t=p[e];if(t.length<2)return 0;let n=c[t[t.length-2]];return Math.abs(n.to-n.from)},"getDist"),r=n(e),o=n(t);return Math.abs(r-o)>.1?r-o:e-t}),e+=V(n.map(e=>c[p[e][p[e].length-1]]));return e},"fixTargetHandleCrossings"),Z=(0,i.K)(()=>{let e=0;for(let t of s){let n=[];for(let e of t.tracks)for(let t of e.segments){let e=p[t.edgeIndex].find(e=>c[e].segmentIndex===t.segmentIndex);void 0!==e&&n.push(c[e])}n.sort((e,t)=>e.edgeIndex-t.edgeIndex||e.segmentIndex-t.segmentIndex);for(let t=0;t<n.length;t++)for(let r=t+1;r<n.length;r++){let o=n[t],l=n[r];H(o,l)&&(e++,j(o,l,z))}}return e},"fixPipeCrossings"),Q=0;for(;Q<10&&0!==0+q()+J()+Z();){;Q++}let U=new Map;for(let e of s){let t=[];e.tracks.forEach(e=>{e.segments.forEach(n=>{t.push({edgeIndex:n.edgeIndex,segmentIndex:n.segmentIndex,trackIndex:e.index,from:n.from,to:n.to})})}),t.sort((e,t)=>e.from-t.from);let n=[];if(t.length>0){let e=[t[0]],r=t[0].to;for(let o=1;o<t.length;o++){let l=t[o];l.from<r?(e.push(l),r=Math.max(r,l.to)):(n.push(e),e=[l],r=l.to)}n.push(e)}for(let t of n){let n=new Set;t.forEach(e=>n.add(e.trackIndex));let r=new Map;t.forEach(e=>{let t=W(e.edgeIndex);r.set(e.trackIndex,(r.get(e.trackIndex)??0)+t.delta)});let o=[...n].filter(e=>(r.get(e)??0)<-1),l=[...n].filter(e=>(r.get(e)??0)>1),a=[...n].filter(e=>1>=Math.abs(r.get(e)??0));o.sort((e,t)=>(r.get(t)??0)-(r.get(e)??0)),l.sort((e,t)=>(r.get(e)??0)-(r.get(t)??0));let s=(0,i.K)((n,r)=>{t.filter(e=>e.trackIndex===n).forEach(t=>{let n=x.has(t.edgeIndex)?e.coord:r;U.set(`${t.edgeIndex}-${t.segmentIndex}`,n)})},"assignCoord"),f=0;for(let t of o)f++,s(t,e.coord-10*f);if(0===a.length&&n.size>0){let e=[...n].sort((e,t)=>Math.abs(r.get(e)??0)-Math.abs(r.get(t)??0))[0],t=o.indexOf(e);-1!==t&&o.splice(t,1);let i=l.indexOf(e);-1!==i&&l.splice(i,1),a.push(e)}let d=0;for(let t of a){if(0===d)s(t,e.coord);else{let n=d%2==1?1:-1,r=Math.ceil(d/2);s(t,e.coord+n*r*5)}d++}let u=0;for(let t of l)u++,s(t,e.coord+10*u)}}for(let[e,t]of o.entries()){let n=p[e]??[];if(0===n.length)continue;let r=[],{pSrcPort:o,pDstPort:i}=B(e,l.get(t.start),l.get(t.end)),a=n.map(e=>{let t=c[e],n=U.get(`${t.edgeIndex}-${t.segmentIndex}`)??t.pipe.coord;return{orient:t.orientation,coord:n,from:t.from,to:t.to}});r.push(o);for(let e=0;e<a.length;e++){let t=a[e],n=r[r.length-1],o="vertical"===t.orient?n.y:n.x,l="vertical"===t.orient?n.x:n.y,i=a[e+1],s=e<a.length-1;if(Math.abs(l-t.coord)>1e-6&&r.push(tZ(t,o)),s&&i.orient===t.orient)if(Math.abs(t.coord-i.coord)>1e-6){let e="vertical"===t.orient?(o+i.from)/2:tJ(t,i);r.push(tZ(t,e),tZ(i,e))}else(0===e||e===a.length-2)&&r.push(tZ(t,tJ(t,i)));else if(s)r.push(tZ(t,i.coord));else{let e=Math.abs(t.from-o)<Math.abs(t.to-o)?t.to:t.from;r.push(tZ(t,e))}}let s=r[r.length-1];(Math.abs(s.x-i.x)>1e-6||Math.abs(s.y-i.y)>1e-6)&&r.push(i);let f=[];r.length>0&&f.push(r[0]);for(let e=1;e<r.length;e++){let t=r[e],n=f[f.length-1];(Math.abs(t.x-n.x)>1e-6||Math.abs(t.y-n.y)>1e-6)&&f.push(t)}t.points=f}for(let e of o){let t=e.__originalEdge;t&&e.points&&(t.points=e.points)}e.edges=(e.edges??[]).filter(e=>!e.isLayoutOnly);let ee=(0,i.K)((e,t)=>{let n=t.x??0,r=t.y??0,o=t.width??0,l=t.height??0;if(o<=0||l<=0)return e;let i=n-o/2,a=n+o/2,s=r-l/2,f=r+l/2;if(e.x<i||e.x>a||e.y<s||e.y>f)return e;let d=e.x-i,u=a-e.x,h=e.y-s,g=Math.min(d,u,h,f-e.y);return g===d?{x:i,y:e.y}:g===u?{x:a,y:e.y}:g===h?{x:e.x,y:s}:{x:e.x,y:f}},"nodeBoundaryClamp");for(let t of e.edges){let e=t.points;if(!e||e.length<2)continue;let n=t.start,r=t.end,o=n?l.get(n):void 0,i=r?l.get(r):void 0;o&&(e[0]=ee(e[0],o)),i&&(e[e.length-1]=ee(e[e.length-1],i))}return e}function tU(e){return e.direction??"TB"}function t0(e){let t=h(e),n=e.config.flowchart?.nodeSpacing??40,r=e.config.flowchart?.rankSpacing??100,o=e.config.swimlane?.ignoreCrossLaneEdges??!0,l=e.config.swimlane?.optimizeRanksByCrossings??!0,i=e.config.swimlane?.automaticLaneOrdering??!1,a=tU(e),{ordered:s,coordinates:f}=tW(t,{nodeGap:n,layerGap:r,ignoreCrossLaneEdges:o,optimizeRanksByCrossings:l,automaticLaneOrdering:i,direction:a});for(let o of(g(t,s,f,{nodeGap:n,layerGap:r}),e.edges??[]))delete o.points;for(let t of(tQ(e,a),e.edges??[]))t.curve&&"basis"!==t.curve||(t.curve="rounded");return eU(e,a),eQ(e),a}function t1(e){u(e);let t=c(e);e.nodes=t.nodes,e.edges=t.edges}(0,i.K)(ti,"buildDrivingTree"),(0,i.K)(ta,"chooseParent"),(0,i.K)(ts,"buildAdjacency"),(0,i.K)(tf,"assignComponents"),(0,i.K)(td,"computeBlocks"),(0,i.K)(tu,"popBlock"),(0,i.K)(th,"computeSubtreeCrossCounts"),(0,i.K)(tg,"annotateMinimumLayers"),(0,i.K)(tc,"compareByRankThenId"),(0,i.K)(tp,"emitNodesInTreeOrder"),(0,i.K)(tx,"deduplicateLayers"),(0,i.K)(tm,"createChildOrderer"),(0,i.K)(ty,"buildMultitreeLayerOrder"),(0,i.K)(tb,"countCrossingsBetweenAdjacent"),(0,i.K)(tM,"totalCrossings"),(0,i.K)(tK,"optimizeRanksByCrossings"),(0,i.K)(tI,"adjustCrossLaneSources"),(0,i.K)(tw,"assignLayers_LongestPath"),(0,i.K)(tS,"assignLayers_Gravity"),(0,i.K)(tv,"topoSortByGenerationIfAcyclic"),(0,i.K)(tC,"assignLayers_LaneAwareCompact"),(0,i.K)(tL,"makeProperLayering"),(0,i.K)(tk,"median"),(0,i.K)(t$,"barycenter"),(0,i.K)(tR,"neighborPositionsFor"),(0,i.K)(tO,"currentOrderTieBreak"),(0,i.K)(tT,"countCrossingsBetweenAdjacent"),(0,i.K)(tF,"sortByHeuristic"),(0,i.K)(tE,"reorderLayer"),(0,i.K)(tB,"transposeImprove"),(0,i.K)(tN,"orderLayers"),(0,i.K)(tX,"assignCoordinates"),(0,i.K)(tY,"hashString"),(0,i.K)(tz,"mulberry32"),(0,i.K)(tA,"deterministicShuffle"),(0,i.K)(tG,"sourceDistance"),(0,i.K)(tP,"laneArrangementCost"),(0,i.K)(tD,"buildWeightedLaneEdges"),(0,i.K)(tH,"greedySwitch"),(0,i.K)(tj,"isBetterCandidate"),(0,i.K)(tV,"seedForRestart"),(0,i.K)(t_,"optimizeTopLaneOrder"),(0,i.K)(tW,"sugiyamaLayout"),(0,i.K)(tq,"chooseOrthogonalSide"),(0,i.K)(tJ,"sharedLineEndpointCoord"),(0,i.K)(tZ,"pointOnLine"),(0,i.K)(tQ,"routeEdgesOrthogonal"),(0,i.K)(tU,"getSwimlaneDirection"),(0,i.K)(t0,"runSwimlaneLayoutCore"),(0,i.K)(t1,"prepareSwimlaneLayout");var t2=(0,o.xY)({prepareLayout:t1,runLayoutCore:t0,afterPaint:a});n.d(t,{render:()=>t2})}}]);
@@ -12,7 +12,7 @@
12
12
  stroke: revert;
13
13
  stroke-width: revert;
14
14
  }
15
- `,"getIconStyles");s.d(e,{o:()=>i})},a6(t,e,s){var i=s("VV8"),r=s("OT"),a=s("WJ"),n=s("Wf"),u=s("mW"),l=s("v0"),o=s("Ut"),c=s("pK"),h=s("NH"),d=s("Yr"),p=s("M4"),g=s("Gt"),A=s("El"),b=s("L"),y=s("gj"),k=s("Cv"),f=class{constructor(){this.vertexCounter=0,this.config=(0,d.D7)(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=d.SV,this.setAccDescription=d.EI,this.setDiagramTitle=d.ke,this.getAccTitle=d.iN,this.getAccDescription=d.m7,this.getDiagramTitle=d.ab,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}static{(0,g.K)(this,"FlowDB")}sanitizeText(t){return d.Y2.sanitizeText(t,this.config)}sanitizeNodeLabelType(t){switch(t){case"markdown":case"string":case"text":return t;default:return"markdown"}}setDiagramId(t){this.diagramId=t}lookUpDomId(t){for(let e of this.vertices.values())if(e.id===t)return this.diagramId?`${this.diagramId}-${e.domId}`:e.domId;return this.diagramId?`${this.diagramId}-${t}`:t}addVertex(t,e,s,i,r,a,u={},l){let c,h;if(!t||0===t.trim().length)return;if(void 0!==l){let t;t=l.includes("\n")?l+"\n":"{\n"+l+"\n}",c=(0,n.H)(t,{schema:n.r})}let g=this.subGraphLookup.get(t);if(g&&c){g.metadata={...g.metadata,...c};return}let A=this.edges.find(e=>e.id===t);if(A){let t=c;t?.animate!==void 0&&(A.animate=t.animate),t?.animation!==void 0&&(A.animation=t.animation),t?.curve!==void 0&&(A.interpolate=t.curve);return}let b=this.vertices.get(t);if(void 0===b&&(void 0===e&&void 0===s&&null!=i&&p.R.warn(`Style applied to unknown node "${t}". This may indicate a typo. The node will be created automatically.`),b={id:t,labelType:"text",domId:"flowchart-"+t+"-"+this.vertexCounter,styles:[],classes:[]},this.vertices.set(t,b)),this.vertexCounter++,void 0!==e?(this.config=(0,d.D7)(),h=this.sanitizeText(e.text.trim()),b.labelType=e.type,h.startsWith('"')&&h.endsWith('"')&&(h=h.substring(1,h.length-1)),b.text=h):void 0===b.text&&(b.text=t),void 0!==s&&(b.type=s),null!=i&&i.forEach(t=>{b.styles.push(t)}),null!=r&&r.forEach(t=>{b.classes.push(t)}),void 0!==a&&(b.dir=a),void 0===b.props?b.props=u:void 0!==u&&Object.assign(b.props,u),void 0!==c){if(c.shape){if(c.shape!==c.shape.toLowerCase()||c.shape.includes("_"))throw Error(`No such shape: ${c.shape}. Shape names should be lowercase.`);if(!(0,o.aP)(c.shape))throw Error(`No such shape: ${c.shape}.`);b.type=c?.shape}c?.label&&(b.text=c?.label,b.labelType=this.sanitizeNodeLabelType(c?.labelType)),c?.icon&&(b.icon=c?.icon,c.label?.trim()||b.text!==t||(b.text="")),c?.form&&(b.form=c?.form),c?.pos&&(b.pos=c?.pos),c?.img&&(b.img=c?.img,c.label?.trim()||b.text!==t||(b.text="")),c?.constraint&&(b.constraint=c.constraint),c.w&&(b.assetWidth=Number(c.w)),c.h&&(b.assetHeight=Number(c.h))}}addSingleLink(t,e,s,i){let r={start:t,end:e,type:void 0,text:"",labelType:"text",classes:[],isUserDefinedId:!1,interpolate:this.edges.defaultInterpolate};p.R.info("abc78 Got edge...",r);let a=s.text;if(void 0!==a&&(r.text=this.sanitizeText(a.text.trim()),r.text.startsWith('"')&&r.text.endsWith('"')&&(r.text=r.text.substring(1,r.text.length-1)),r.labelType=this.sanitizeNodeLabelType(a.type)),void 0!==s&&(r.type=s.type,r.stroke=s.stroke,r.length=s.length>10?10:s.length),i&&!this.edges.some(t=>t.id===i))r.id=i,r.isUserDefinedId=!0;else{let t=this.edges.filter(t=>t.start===r.start&&t.end===r.end);0===t.length?r.id=(0,h.rY)(r.start,r.end,{counter:0,prefix:"L"}):r.id=(0,h.rY)(r.start,r.end,{counter:t.length+1,prefix:"L"})}if(this.edges.length<(this.config.maxEdges??500))p.R.info("Pushing edge..."),this.edges.push(r);else throw Error(`Edge limit exceeded. ${this.edges.length} edges found, but the limit is ${this.config.maxEdges}.
15
+ `,"getIconStyles");s.d(e,{o:()=>i})},a6(t,e,s){var i=s("VV8"),r=s("OT"),a=s("WJ"),n=s("Wf"),u=s("mW"),l=s("v0"),o=s("Ut"),c=s("pK"),h=s("NH"),d=s("Yr"),p=s("M4"),g=s("Gt"),A=s("El"),b=s("Lu"),y=s("gj"),k=s("Cv"),f=class{constructor(){this.vertexCounter=0,this.config=(0,d.D7)(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=d.SV,this.setAccDescription=d.EI,this.setDiagramTitle=d.ke,this.getAccTitle=d.iN,this.getAccDescription=d.m7,this.getDiagramTitle=d.ab,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}static{(0,g.K)(this,"FlowDB")}sanitizeText(t){return d.Y2.sanitizeText(t,this.config)}sanitizeNodeLabelType(t){switch(t){case"markdown":case"string":case"text":return t;default:return"markdown"}}setDiagramId(t){this.diagramId=t}lookUpDomId(t){for(let e of this.vertices.values())if(e.id===t)return this.diagramId?`${this.diagramId}-${e.domId}`:e.domId;return this.diagramId?`${this.diagramId}-${t}`:t}addVertex(t,e,s,i,r,a,u={},l){let c,h;if(!t||0===t.trim().length)return;if(void 0!==l){let t;t=l.includes("\n")?l+"\n":"{\n"+l+"\n}",c=(0,n.H)(t,{schema:n.r})}let g=this.subGraphLookup.get(t);if(g&&c){g.metadata={...g.metadata,...c};return}let A=this.edges.find(e=>e.id===t);if(A){let t=c;t?.animate!==void 0&&(A.animate=t.animate),t?.animation!==void 0&&(A.animation=t.animation),t?.curve!==void 0&&(A.interpolate=t.curve);return}let b=this.vertices.get(t);if(void 0===b&&(void 0===e&&void 0===s&&null!=i&&p.R.warn(`Style applied to unknown node "${t}". This may indicate a typo. The node will be created automatically.`),b={id:t,labelType:"text",domId:"flowchart-"+t+"-"+this.vertexCounter,styles:[],classes:[]},this.vertices.set(t,b)),this.vertexCounter++,void 0!==e?(this.config=(0,d.D7)(),h=this.sanitizeText(e.text.trim()),b.labelType=e.type,h.startsWith('"')&&h.endsWith('"')&&(h=h.substring(1,h.length-1)),b.text=h):void 0===b.text&&(b.text=t),void 0!==s&&(b.type=s),null!=i&&i.forEach(t=>{b.styles.push(t)}),null!=r&&r.forEach(t=>{b.classes.push(t)}),void 0!==a&&(b.dir=a),void 0===b.props?b.props=u:void 0!==u&&Object.assign(b.props,u),void 0!==c){if(c.shape){if(c.shape!==c.shape.toLowerCase()||c.shape.includes("_"))throw Error(`No such shape: ${c.shape}. Shape names should be lowercase.`);if(!(0,o.aP)(c.shape))throw Error(`No such shape: ${c.shape}.`);b.type=c?.shape}c?.label&&(b.text=c?.label,b.labelType=this.sanitizeNodeLabelType(c?.labelType)),c?.icon&&(b.icon=c?.icon,c.label?.trim()||b.text!==t||(b.text="")),c?.form&&(b.form=c?.form),c?.pos&&(b.pos=c?.pos),c?.img&&(b.img=c?.img,c.label?.trim()||b.text!==t||(b.text="")),c?.constraint&&(b.constraint=c.constraint),c.w&&(b.assetWidth=Number(c.w)),c.h&&(b.assetHeight=Number(c.h))}}addSingleLink(t,e,s,i){let r={start:t,end:e,type:void 0,text:"",labelType:"text",classes:[],isUserDefinedId:!1,interpolate:this.edges.defaultInterpolate};p.R.info("abc78 Got edge...",r);let a=s.text;if(void 0!==a&&(r.text=this.sanitizeText(a.text.trim()),r.text.startsWith('"')&&r.text.endsWith('"')&&(r.text=r.text.substring(1,r.text.length-1)),r.labelType=this.sanitizeNodeLabelType(a.type)),void 0!==s&&(r.type=s.type,r.stroke=s.stroke,r.length=s.length>10?10:s.length),i&&!this.edges.some(t=>t.id===i))r.id=i,r.isUserDefinedId=!0;else{let t=this.edges.filter(t=>t.start===r.start&&t.end===r.end);0===t.length?r.id=(0,h.rY)(r.start,r.end,{counter:0,prefix:"L"}):r.id=(0,h.rY)(r.start,r.end,{counter:t.length+1,prefix:"L"})}if(this.edges.length<(this.config.maxEdges??500))p.R.info("Pushing edge..."),this.edges.push(r);else throw Error(`Edge limit exceeded. ${this.edges.length} edges found, but the limit is ${this.config.maxEdges}.
16
16
 
17
17
  Initialize mermaid with maxEdges set to a higher number to allow more edges.
18
18
  You cannot set this config via configuration inside the diagram as it is a secure config.