flujo-ai 3.40.0 → 3.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +400 -384
  3. package/.next/app-path-routes-manifest.json +53 -53
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +33 -33
  6. package/.next/react-loadable-manifest.json +9 -9
  7. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/_not-found.html +1 -1
  9. package/.next/server/app/_not-found.rsc +3 -3
  10. package/.next/server/app/api/approvals/[id]/route_client-reference-manifest.js +1 -1
  11. package/.next/server/app/api/approvals/route_client-reference-manifest.js +1 -1
  12. package/.next/server/app/api/backup/route_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/browse/route_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/bugs/enhance/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/cwd/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/encryption/secure/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/env/route_client-reference-manifest.js +1 -1
  18. package/.next/server/app/api/flow/[id]/convert-process-to-subflow/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/flow/[id]/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/flow/[id]/versions/[versionId]/route_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/flow/[id]/versions/route_client-reference-manifest.js +1 -1
  22. package/.next/server/app/api/flow/assist/route_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/flow/compile/route_client-reference-manifest.js +1 -1
  24. package/.next/server/app/api/flow/generate/route_client-reference-manifest.js +1 -1
  25. package/.next/server/app/api/flow/generator/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/flow/improve/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/flow/prompt-renderer/route_client-reference-manifest.js +1 -1
  28. package/.next/server/app/api/flow/quick-chat/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/flow/repair/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/flow/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/local-models/capability/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/local-models/pull/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/local-models/suggest/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/mcp/app-sandbox/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/mcp/cancel/route_client-reference-manifest.js +1 -1
  38. package/.next/server/app/api/mcp/flujo/authoring/route_client-reference-manifest.js +1 -1
  39. package/.next/server/app/api/mcp/flujo/automation/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/mcp/flujo/flows/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/mcp/flujo/resources/read/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/mcp/flujo/resources/route_client-reference-manifest.js +1 -1
  43. package/.next/server/app/api/mcp/flujo/servers/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/mcp/flujo/state/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/api/mcp/flujo/tools/route_client-reference-manifest.js +1 -1
  46. package/.next/server/app/api/mcp/oauth-capability/route_client-reference-manifest.js +1 -1
  47. package/.next/server/app/api/mcp/servers/[name]/prompts/get/route_client-reference-manifest.js +1 -1
  48. package/.next/server/app/api/mcp/servers/[name]/prompts/route_client-reference-manifest.js +1 -1
  49. package/.next/server/app/api/mcp/servers/[name]/resources/read/route_client-reference-manifest.js +1 -1
  50. package/.next/server/app/api/mcp/servers/[name]/resources/route_client-reference-manifest.js +1 -1
  51. package/.next/server/app/api/mcp/servers/[name]/route_client-reference-manifest.js +1 -1
  52. package/.next/server/app/api/mcp/servers/[name]/status/route_client-reference-manifest.js +1 -1
  53. package/.next/server/app/api/mcp/servers/[name]/tools/[toolName]/route_client-reference-manifest.js +1 -1
  54. package/.next/server/app/api/mcp/servers/[name]/tools/route_client-reference-manifest.js +1 -1
  55. package/.next/server/app/api/mcp/servers/route_client-reference-manifest.js +1 -1
  56. package/.next/server/app/api/mcp/test-connection/route_client-reference-manifest.js +1 -1
  57. package/.next/server/app/api/mcp/test-connection/stream/route_client-reference-manifest.js +1 -1
  58. package/.next/server/app/api/mcp-registry/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/api/mcp-registry/spotlight/route_client-reference-manifest.js +1 -1
  60. package/.next/server/app/api/model/[id]/route_client-reference-manifest.js +1 -1
  61. package/.next/server/app/api/model/provider/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/model/route_client-reference-manifest.js +1 -1
  63. package/.next/server/app/api/model/test/route_client-reference-manifest.js +1 -1
  64. package/.next/server/app/api/oauth/callback/route_client-reference-manifest.js +1 -1
  65. package/.next/server/app/api/oauth/initiate/route_client-reference-manifest.js +1 -1
  66. package/.next/server/app/api/oauth/reset/route_client-reference-manifest.js +1 -1
  67. package/.next/server/app/api/packages/build/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/packages/derive-secrets/route_client-reference-manifest.js +1 -1
  69. package/.next/server/app/api/packages/install/route_client-reference-manifest.js +1 -1
  70. package/.next/server/app/api/packages/install/status/route_client-reference-manifest.js +1 -1
  71. package/.next/server/app/api/packages/installed/route_client-reference-manifest.js +1 -1
  72. package/.next/server/app/api/packages/resolve/route_client-reference-manifest.js +1 -1
  73. package/.next/server/app/api/packages/scan-targets/route_client-reference-manifest.js +1 -1
  74. package/.next/server/app/api/packages/search/route_client-reference-manifest.js +1 -1
  75. package/.next/server/app/api/packages/uninstall/route_client-reference-manifest.js +1 -1
  76. package/.next/server/app/api/planned-executions/[id]/route_client-reference-manifest.js +1 -1
  77. package/.next/server/app/api/planned-executions/[id]/run/route_client-reference-manifest.js +1 -1
  78. package/.next/server/app/api/planned-executions/[id]/runs/route_client-reference-manifest.js +1 -1
  79. package/.next/server/app/api/planned-executions/preview-schedule/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/planned-executions/reconcile/route_client-reference-manifest.js +1 -1
  81. package/.next/server/app/api/planned-executions/route_client-reference-manifest.js +1 -1
  82. package/.next/server/app/api/registry/auth/resend/route_client-reference-manifest.js +1 -1
  83. package/.next/server/app/api/registry/auth/reset/route_client-reference-manifest.js +1 -1
  84. package/.next/server/app/api/registry/auth/route_client-reference-manifest.js +1 -1
  85. package/.next/server/app/api/registry/feedback/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/api/registry/oauth/callback/route_client-reference-manifest.js +1 -1
  87. package/.next/server/app/api/registry/oauth/initiate/route_client-reference-manifest.js +1 -1
  88. package/.next/server/app/api/registry/packages/route_client-reference-manifest.js +1 -1
  89. package/.next/server/app/api/registry/publish/route_client-reference-manifest.js +1 -1
  90. package/.next/server/app/api/registry/settings/route_client-reference-manifest.js +1 -1
  91. package/.next/server/app/api/restore/route_client-reference-manifest.js +1 -1
  92. package/.next/server/app/api/runs/active/route_client-reference-manifest.js +1 -1
  93. package/.next/server/app/api/setup/ai-cli/route_client-reference-manifest.js +1 -1
  94. package/.next/server/app/api/statistics/route_client-reference-manifest.js +1 -1
  95. package/.next/server/app/api/storage/route_client-reference-manifest.js +1 -1
  96. package/.next/server/app/api/telemetry/daily-active/route.js +1 -1
  97. package/.next/server/app/api/telemetry/daily-active/route_client-reference-manifest.js +1 -1
  98. package/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  99. package/.next/server/app/api/waves/route_client-reference-manifest.js +1 -1
  100. package/.next/server/app/api/webhooks/[id]/route_client-reference-manifest.js +1 -1
  101. package/.next/server/app/automation/triggers/page.js +1 -1
  102. package/.next/server/app/automation/triggers/page.js.nft.json +1 -1
  103. package/.next/server/app/automation/triggers/page_client-reference-manifest.js +1 -1
  104. package/.next/server/app/automation/triggers.html +1 -1
  105. package/.next/server/app/automation/triggers.rsc +4 -4
  106. package/.next/server/app/automation/waves/page_client-reference-manifest.js +1 -1
  107. package/.next/server/app/automation/waves.html +1 -1
  108. package/.next/server/app/automation/waves.rsc +4 -4
  109. package/.next/server/app/chat/page.js +2 -2
  110. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  111. package/.next/server/app/chat.html +1 -1
  112. package/.next/server/app/chat.rsc +4 -4
  113. package/.next/server/app/docs/page.js +3 -3
  114. package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  115. package/.next/server/app/docs.html +1 -1
  116. package/.next/server/app/docs.rsc +4 -4
  117. package/.next/server/app/executions/page.js +1 -1
  118. package/.next/server/app/executions/page.js.nft.json +1 -1
  119. package/.next/server/app/executions/page_client-reference-manifest.js +1 -1
  120. package/.next/server/app/executions.html +1 -1
  121. package/.next/server/app/executions.rsc +4 -4
  122. package/.next/server/app/flows/page.js +5 -3
  123. package/.next/server/app/flows/page.js.nft.json +1 -1
  124. package/.next/server/app/flows/page_client-reference-manifest.js +1 -1
  125. package/.next/server/app/flows.html +1 -1
  126. package/.next/server/app/flows.rsc +4 -4
  127. package/.next/server/app/index.html +1 -1
  128. package/.next/server/app/index.rsc +4 -4
  129. package/.next/server/app/mcp/page.js +73 -44
  130. package/.next/server/app/mcp/page.js.nft.json +1 -1
  131. package/.next/server/app/mcp/page_client-reference-manifest.js +1 -1
  132. package/.next/server/app/mcp-flows/route.js +1 -1
  133. package/.next/server/app/mcp-flows/route_client-reference-manifest.js +1 -1
  134. package/.next/server/app/mcp-proxy/[server]/route.js +1 -1
  135. package/.next/server/app/mcp-proxy/[server]/route_client-reference-manifest.js +1 -1
  136. package/.next/server/app/mcp.html +1 -1
  137. package/.next/server/app/mcp.rsc +4 -4
  138. package/.next/server/app/models/page.js +7 -7
  139. package/.next/server/app/models/page_client-reference-manifest.js +1 -1
  140. package/.next/server/app/packages/page.js +1 -1
  141. package/.next/server/app/packages/page_client-reference-manifest.js +1 -1
  142. package/.next/server/app/packages.html +1 -1
  143. package/.next/server/app/packages.rsc +4 -4
  144. package/.next/server/app/page.js +2 -2
  145. package/.next/server/app/page_client-reference-manifest.js +1 -1
  146. package/.next/server/app/settings/page.js +2 -2
  147. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  148. package/.next/server/app/settings.html +1 -1
  149. package/.next/server/app/settings.rsc +4 -4
  150. package/.next/server/app/statistics/page.js +2 -2
  151. package/.next/server/app/statistics/page_client-reference-manifest.js +1 -1
  152. package/.next/server/app/statistics.html +1 -1
  153. package/.next/server/app/statistics.rsc +4 -4
  154. package/.next/server/app/v1/chat/completions/route_client-reference-manifest.js +1 -1
  155. package/.next/server/app/v1/chat/conversations/[conversationId]/breakpoints/route_client-reference-manifest.js +1 -1
  156. package/.next/server/app/v1/chat/conversations/[conversationId]/cancel/route_client-reference-manifest.js +1 -1
  157. package/.next/server/app/v1/chat/conversations/[conversationId]/debug/continue/route_client-reference-manifest.js +1 -1
  158. package/.next/server/app/v1/chat/conversations/[conversationId]/debug/step/route_client-reference-manifest.js +1 -1
  159. package/.next/server/app/v1/chat/conversations/[conversationId]/edit-state/route_client-reference-manifest.js +1 -1
  160. package/.next/server/app/v1/chat/conversations/[conversationId]/events/route_client-reference-manifest.js +1 -1
  161. package/.next/server/app/v1/chat/conversations/[conversationId]/inject/route_client-reference-manifest.js +1 -1
  162. package/.next/server/app/v1/chat/conversations/[conversationId]/resources/[resourceId]/content/route_client-reference-manifest.js +1 -1
  163. package/.next/server/app/v1/chat/conversations/[conversationId]/resources/route_client-reference-manifest.js +1 -1
  164. package/.next/server/app/v1/chat/conversations/[conversationId]/respond/route_client-reference-manifest.js +1 -1
  165. package/.next/server/app/v1/chat/conversations/[conversationId]/revert/route_client-reference-manifest.js +1 -1
  166. package/.next/server/app/v1/chat/conversations/[conversationId]/route_client-reference-manifest.js +1 -1
  167. package/.next/server/app/v1/chat/conversations/route_client-reference-manifest.js +1 -1
  168. package/.next/server/app/v1/chat/events/route_client-reference-manifest.js +1 -1
  169. package/.next/server/app/v1/models/route_client-reference-manifest.js +1 -1
  170. package/.next/server/app/waves/page_client-reference-manifest.js +1 -1
  171. package/.next/server/app/waves.html +1 -1
  172. package/.next/server/app/waves.rsc +4 -4
  173. package/.next/server/app-paths-manifest.json +53 -53
  174. package/.next/server/chunks/1227.js +1 -1
  175. package/.next/server/chunks/1403.js +2 -2
  176. package/.next/server/chunks/1539.js +1 -1
  177. package/.next/server/chunks/2069.js +1 -1
  178. package/.next/server/chunks/2372.js +1 -1
  179. package/.next/server/chunks/2828.js +2 -2
  180. package/.next/server/chunks/3422.js +1 -0
  181. package/.next/server/chunks/3945.js +3 -3
  182. package/.next/server/chunks/519.js +2 -2
  183. package/.next/server/chunks/5444.js +2 -2
  184. package/.next/server/chunks/5750.js +1 -1
  185. package/.next/server/chunks/5918.js +10 -10
  186. package/.next/server/chunks/6226.js +2 -2
  187. package/.next/server/chunks/9088.js +2 -2
  188. package/.next/server/chunks/9490.js +5 -0
  189. package/.next/server/chunks/9543.js +3 -3
  190. package/.next/server/chunks/9624.js +8 -8
  191. package/.next/server/middleware-build-manifest.js +1 -1
  192. package/.next/server/middleware-manifest.json +1 -1
  193. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  194. package/.next/server/pages/404.html +1 -1
  195. package/.next/server/pages/500.html +1 -1
  196. package/.next/server/server-reference-manifest.js +1 -1
  197. package/.next/server/server-reference-manifest.json +1 -1
  198. package/.next/static/chunks/{1161-19176c3e7c655121.js → 1161-563a8028f59f00de.js} +1 -1
  199. package/.next/static/chunks/1521-9ad145dcb8e3abfc.js +1 -0
  200. package/.next/static/chunks/1576.06797b29a19fa26c.js +1 -0
  201. package/.next/static/chunks/{4386-e9621d3c94969a68.js → 2005-f9d38c39f10c321f.js} +1 -1
  202. package/.next/static/chunks/2493-da85c47ef972c066.js +1 -0
  203. package/.next/static/chunks/361.c88d43436e974006.js +1 -0
  204. package/.next/static/chunks/3731-c18f48522b159d7f.js +1 -0
  205. package/.next/static/chunks/3781.5086bce03aa281f7.js +1 -0
  206. package/.next/static/chunks/3969-15a32253b112652c.js +1 -0
  207. package/.next/static/chunks/4167.2ce97ca450815df1.js +1 -0
  208. package/.next/static/chunks/4814-52b7254ab573a455.js +1 -0
  209. package/.next/static/chunks/4965.d401547984d71b7a.js +1 -0
  210. package/.next/static/chunks/5148-9174ba300221fd1b.js +1 -0
  211. package/.next/static/chunks/5417-fb7d3760cc288ab1.js +1 -0
  212. package/.next/static/chunks/5967-34735763d1b03ccc.js +1 -0
  213. package/.next/static/chunks/7260-743e4b0cc4211dcb.js +1 -0
  214. package/.next/static/chunks/7711-7323dabe7dc02311.js +1 -0
  215. package/.next/static/chunks/8124-f99060fe1dfc119e.js +1 -0
  216. package/.next/static/chunks/8135-7fe07a34a8c49967.js +1 -0
  217. package/.next/static/chunks/8529.6187e01de8e9a692.js +1 -0
  218. package/.next/static/chunks/9136-e9ee57cc581ddd50.js +1 -0
  219. package/.next/static/chunks/9140.9180b569c4b26168.js +1 -0
  220. package/.next/static/chunks/9195-6a18a5867bb76c64.js +1 -0
  221. package/.next/static/chunks/app/automation/triggers/{page-594a6294c58344bf.js → page-34b9a8a2e6f28c2f.js} +1 -1
  222. package/.next/static/chunks/app/automation/waves/{page-ce2fef4996cad8e6.js → page-fd4929ea308183b2.js} +1 -1
  223. package/.next/static/chunks/app/chat/page-fb8a33db7628ecd0.js +1 -0
  224. package/.next/static/chunks/app/docs/page-3e21583b1cd5d7ca.js +1 -0
  225. package/.next/static/chunks/app/executions/{page-fcc848de86714386.js → page-56ecca56c17c05d7.js} +1 -1
  226. package/.next/static/chunks/app/flows/page-8c1a656197b15894.js +1 -0
  227. package/.next/static/chunks/app/layout-6e2756704ddc9f39.js +1 -0
  228. package/.next/static/chunks/app/mcp/page-4c4390354fdd94c8.js +1 -0
  229. package/.next/static/chunks/app/models/error-ea477f0ad52f4dcb.js +1 -0
  230. package/.next/static/chunks/app/models/page-e237ac64a0f62c3d.js +1 -0
  231. package/.next/static/chunks/app/packages/page-8680e4bea6b7ea45.js +1 -0
  232. package/.next/static/chunks/app/page-6dca06b6b7667181.js +1 -0
  233. package/.next/static/chunks/app/settings/page-a5f7fedcbf9e3a7f.js +1 -0
  234. package/.next/static/chunks/app/statistics/page-f9f9627d1c1ff963.js +1 -0
  235. package/.next/static/chunks/app/waves/{page-5b53af3eb9409414.js → page-7529febc48eb473d.js} +1 -1
  236. package/.next/static/chunks/{webpack-9fbd3587b9ef4dca.js → webpack-f3df493faa0bd612.js} +1 -1
  237. package/.next/static/css/{400b1b927c3ffaf6.css → 9f9b7f1374ac2d01.css} +1 -1
  238. package/.next/trace +11 -11
  239. package/README.md +1 -1
  240. package/mcp-servers/bash/package.json +1 -1
  241. package/mcp-servers/browser/package.json +1 -1
  242. package/mcp-servers/filesystem/package.json +1 -1
  243. package/mcp-servers/flujo/package.json +1 -1
  244. package/package.json +5 -5
  245. package/.next/server/chunks/7508.js +0 -5
  246. package/.next/server/chunks/8598.js +0 -1
  247. package/.next/static/chunks/1521-1c98c9a56726e053.js +0 -1
  248. package/.next/static/chunks/1576.bc6ae6c9e6d939d8.js +0 -1
  249. package/.next/static/chunks/2005.300528b5119c2d38.js +0 -1
  250. package/.next/static/chunks/2499-92cd97ce4993999f.js +0 -1
  251. package/.next/static/chunks/361.51d642c530c84295.js +0 -1
  252. package/.next/static/chunks/3731-64070760ae44448f.js +0 -1
  253. package/.next/static/chunks/4814-31eb5f3b10c651c1.js +0 -1
  254. package/.next/static/chunks/4965.39e24b54c3c6ca58.js +0 -1
  255. package/.next/static/chunks/5967-59fde8c214c9ca9f.js +0 -1
  256. package/.next/static/chunks/6417.70056fe81ca21682.js +0 -1
  257. package/.next/static/chunks/7711-4b017720ec49c96d.js +0 -1
  258. package/.next/static/chunks/8124-94140ee1dd8ed87c.js +0 -1
  259. package/.next/static/chunks/8135-5b975b9014f8920b.js +0 -1
  260. package/.next/static/chunks/8529.b5a43e728bb5bb8a.js +0 -1
  261. package/.next/static/chunks/9001-4c27a608feddb878.js +0 -1
  262. package/.next/static/chunks/9136-9c415453ec02519c.js +0 -1
  263. package/.next/static/chunks/9140.6502327a2c098d33.js +0 -1
  264. package/.next/static/chunks/9195-3c9c4300e7505d9e.js +0 -1
  265. package/.next/static/chunks/9524-b9d2c7e4426edd07.js +0 -1
  266. package/.next/static/chunks/app/chat/page-203cb7bf21638ada.js +0 -1
  267. package/.next/static/chunks/app/docs/page-c466a58caf5e3336.js +0 -1
  268. package/.next/static/chunks/app/flows/page-172c759ca81ba02f.js +0 -1
  269. package/.next/static/chunks/app/layout-a6ca531683a518a7.js +0 -1
  270. package/.next/static/chunks/app/mcp/page-0a96e6b30e45b1e6.js +0 -1
  271. package/.next/static/chunks/app/models/error-1964203c5c6e7d0e.js +0 -1
  272. package/.next/static/chunks/app/models/page-ad1cbea6d3324966.js +0 -1
  273. package/.next/static/chunks/app/packages/page-dda48425be9fc137.js +0 -1
  274. package/.next/static/chunks/app/page-04189aa1b1318c2d.js +0 -1
  275. package/.next/static/chunks/app/settings/page-906c229c87011ead.js +0 -1
  276. package/.next/static/chunks/app/statistics/page-9b13a95549f438c0.js +0 -1
  277. /package/.next/static/{b1aMk0634gkkiunttd1SQ → utOrEUSzguWncIosxgCeR}/_buildManifest.js +0 -0
  278. /package/.next/static/{b1aMk0634gkkiunttd1SQ → utOrEUSzguWncIosxgCeR}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4814,8135],{9352:(e,r,t)=>{"use strict";t.d(r,{Ic:()=>l,kY:()=>a.k});var o=t(26796),n=t(73288),a=t(34432);let i=(0,n.h)("frontend/utils/theme");function l(){let{isDarkMode:e,visualStyle:r}=(0,o.useTheme)();return i.debug("useThemeUtils called with isDarkMode: ".concat(e)),{getThemeValue:(r,t)=>e?t:r,getThemeColor:t=>{let o=t.split("."),n=("legacy"===r?a.z:a.k)[e?"dark":"light"];for(let e of o)if(!n||"object"!=typeof n||!(e in n))return i.warn("Theme color path not found: ".concat(t)),"";else n=n[e];return n},colors:"legacy"===r?e?a.z.dark:a.z.light:e?a.k.dark:a.k.light,isDarkMode:e,visualStyle:r}}},11433:(e,r,t)=>{"use strict";t.d(r,{Ay:()=>x});var o=t(95155),n=t(12115),a=t(94049),i=t(2300),l=t(25635),s=t(63941),d=t(80372),c=t(29985),u=t(90880);function g(e,r){let t=r.toLocaleLowerCase(),o=new Set;return e.filter(e=>{var r;return!o.has(e.value)&&(o.add(e.value),"".concat(e.label," ").concat(e.name," ").concat(e.server," ").concat(null!=(r=e.description)?r:"").toLocaleLowerCase().includes(t))}).sort((e,r)=>{let t={tool:0,resource:1,global:2,runres:3};return t[e.kind]-t[r.kind]||e.label.localeCompare(r.label)})}function f(e){let r=e.split("\n").map(e=>({type:"paragraph",children:(e=>{let r=(0,u.sE)(e);if(0===r.length)return[{text:e}];let t=[],o=0;for(let n of r)n.index>o&&t.push({text:e.slice(o,n.index)}),t.push({type:"binding-reference",kind:n.kind,server:n.server,name:n.name,children:[{text:""}]}),o=n.index+n.fullMatch.length;return o<e.length&&t.push({text:e.slice(o)}),t})(e)}));return r.length>0?r:[{type:"paragraph",children:[{text:""}]}]}function b(e){return e.map(e=>(e.children||[]).map(e=>s.EY.isText(e)?e.text:(0,u.Pj)(e.kind,e.server,e.name)).join("")).join("\n")}t(32098);let p=(e,r)=>{e.selection||s.gB.select(e,s.KE.end(e,[])),s.gB.insertNodes(e,(e=>({type:"binding-reference",kind:e.kind,server:e.server,name:e.name,children:[{text:""}]}))(r)),s.gB.move(e)},h=e=>{let{element:r,disabled:t,invalid:n}=e,a=(0,c.Zi)(),i="tool"===r.kind&&"handoff"===r.server,l="global"===r.kind?"global":"runres"===r.kind?"runres":"resource"===r.kind?"resource":i?"handoff":"",d=()=>{t||(s.gB.removeNodes(a,{at:c.rL.findPath(a,r)}),c.rL.focus(a))};return(0,o.jsxs)("span",{contentEditable:!1,className:"tool-reference-container ".concat(l).concat(n?" invalid":""),title:n?"This reference is not available in the current context":void 0,"aria-invalid":n||void 0,children:[(0,o.jsx)("span",{className:"tool-reference ".concat(l).concat(n?" invalid":""),children:(0,u.CN)(r)}),!t&&(0,o.jsx)("span",{className:"tool-reference-delete ".concat(l),role:"button","aria-label":"Remove ".concat((0,u.CN)(r)),tabIndex:0,onClick:e=>{e.preventDefault(),e.stopPropagation(),d()},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),e.stopPropagation(),d())},children:"\xd7"})]})},m=(0,n.forwardRef)((e,r)=>{let{value:t,onChange:m,globalNames:x=[],suggestions:k,placeholder:v,disabled:y=!1,multiline:C=!0,minRows:F=1,maxRows:S,autoFocus:A=!1,bare:M=!1,ariaLabel:w,dataTour:j,containerSx:T,onKeyDown:O,onPaste:B}=e,D=(0,n.useMemo)(()=>(0,d.$k)((e=>{let{isInline:r,isVoid:t,insertData:o,insertText:n}=e;return e.isInline=e=>"binding-reference"===e.type||r(e),e.isVoid=e=>"binding-reference"===e.type||t(e),e.insertText=r=>{n(r),r.includes("}")&&(e=>{if(!e.selection||!s.Q6.isCollapsed(e.selection))return;let r=e.selection.anchor,t=s.bP.get(e,r.path);if(!s.EY.isText(t))return;let o=t.text.slice(0,r.offset).match(/\$\{global:([^}\r\n]+)\}$/);if(!o||void 0===o.index)return;let n=(0,u.y4)(o[0]);n&&(s.gB.select(e,{anchor:{path:r.path,offset:o.index},focus:r}),s.gB.delete(e),p(e,n))})(e)},e.insertData=r=>{let t=r.getData("text/plain");if(t&&(0,u.sE)(t).length>0)return void s.gB.insertFragment(e,f(t));o(r)},e})((0,c.o$)((0,s.ie)()))),[]),E=(0,n.useMemo)(()=>f(t||""),[]),[R,I]=(0,n.useState)(null),[W,H]=(0,n.useState)(0),[P,z]=(0,n.useState)(0),N=(0,n.useRef)(!1),X=(0,n.useMemo)(()=>g([...null!=k?k:[],...x.map(e=>(0,u.Ub)({kind:"global",server:"",name:e},e))],""),[x,k]),_=(0,n.useMemo)(()=>k?new Set(X.map(e=>e.value)):null,[X,k]),L=(0,n.useCallback)(()=>{if(!D.selection||!s.Q6.isCollapsed(D.selection))return void I(null);let e=D.selection.anchor,r=s.bP.get(D,e.path);if(!s.EY.isText(r))return void I(null);let t=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length,t=e.slice(0,r).match(/(?:^|\s)@([^\s@{}]*)$/);if(!t||void 0===t.index)return null;let o=t.index+ +!t[0].startsWith("@");return{query:t[1],start:o,end:r}}(r.text,e.offset),o=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length,t=e.slice(0,r).match(/\$\{global:([^{}\r\n]*)$/);return t&&void 0!==t.index?{query:t[1],start:t.index,end:r}:null}(r.text,e.offset),n=null!=t?t:o;if(!n)return void I(null);let a=t?"at":"global",i=g("at"===a?X:X.filter(e=>"global"===e.kind),n.query);H(0),I({...n,mode:a,items:i,range:{anchor:{path:e.path,offset:n.start},focus:e}})},[D,X]),Y=(0,n.useCallback)(e=>{if(!R)return;s.gB.select(D,R.range),s.gB.delete(D);let r=(0,u.y4)(e.value);r&&p(D,r),I(null),c.rL.focus(D)},[R,D]);(0,n.useImperativeHandle)(r,()=>({insertText:e=>{let r=(0,u.y4)(e);r?p(D,r):D.insertText(e),m(b(D.children)),c.rL.focus(D)},focus:()=>c.rL.focus(D)}),[D,m]),(0,n.useEffect)(()=>{b(D.children)!==b(f(t||""))&&(N.current=!0,D.children=f(t||""),D.selection=null,D.onChange(),z(e=>e+1))},[D,t]);let $=(0,n.useCallback)(e=>{if(N.current){N.current=!1;return}m(b(e)),L()},[m,L]),V=(0,n.useCallback)(e=>{let{attributes:r,children:t,element:n}=e;if("binding-reference"===n.type){let e=(0,u.Pj)(n.kind,n.server,n.name);return(0,o.jsxs)("span",{...r,className:"tool-reference-wrapper",children:[(0,o.jsx)(h,{element:n,disabled:y,invalid:null!==_&&!_.has(e)}),t]})}return(0,o.jsx)("p",{...r,children:t})},[y,_]),Z="".concat(1.5*Math.max(1,F),"em"),q=S?"".concat(1.5*Math.max(F,S),"em"):void 0;return(0,o.jsxs)(a.default,{sx:{position:"relative",width:"100%",...T},"data-revision":P,children:[(0,o.jsx)(a.default,{className:M?"global-reference-editor bare":"global-reference-editor",sx:{border:M?"none":"1px solid",borderColor:"rgba(0, 0, 0, 0.23)",borderRadius:+!M,px:1.75*!M,py:+!M,bgcolor:y?"action.disabledBackground":"background.paper","&:focus-within":M?{}:{borderColor:"primary.main",borderWidth:2,px:"13px",py:"7px"}},children:(0,o.jsx)(c.A,{editor:D,initialValue:E,onChange:$,children:(0,o.jsx)(c.Fo,{className:"slate-editor global-reference-editable",renderElement:V,placeholder:v,readOnly:y,autoFocus:A,"aria-label":w,"data-tour":j,role:"textbox","aria-multiline":C,onKeyDown:e=>{if(R){if("ArrowDown"===e.key&&R.items.length>0){e.preventDefault(),H(e=>(e+1)%R.items.length);return}if("ArrowUp"===e.key&&R.items.length>0){e.preventDefault(),H(e=>(e-1+R.items.length)%R.items.length);return}if(("Enter"===e.key||"Tab"===e.key)&&R.items[W]){e.preventDefault(),Y(R.items[W]);return}if("Escape"===e.key){e.preventDefault(),e.stopPropagation(),I(null);return}}if(!C&&"Enter"===e.key)return void e.preventDefault();null==O||O(e)},onPaste:B,style:{minHeight:Z,maxHeight:q,overflowY:q?"auto":void 0,whiteSpace:C?"pre-wrap":"nowrap"}})})}),R&&(0,o.jsx)(i.A,{elevation:8,role:"listbox","aria-label":"at"===R.mode?"Available references":"Global variables",sx:{position:"absolute",zIndex:1500,top:"100%",left:0,right:0,mt:.5,maxHeight:240,overflowY:"auto"},children:0===R.items.length?(0,o.jsx)(a.default,{sx:{px:1.5,py:1.25},children:(0,o.jsx)(l.A,{variant:"body2",color:"text.secondary",children:"No matching references"})}):R.items.map((e,r)=>{var t;let i=null==(t=R.items[r-1])?void 0:t.kind,s="tool"===e.kind?"Tools":"resource"===e.kind?"Resources":"global"===e.kind?"Globals":"Temporary data";return(0,o.jsxs)(n.Fragment,{children:[e.kind!==i&&(0,o.jsx)(l.A,{component:"div",variant:"overline",sx:{px:1.5,pt:0===r?.75:1.25,color:"text.secondary"},children:s}),(0,o.jsxs)(a.default,{role:"option","aria-selected":r===W,onMouseDown:r=>{r.preventDefault(),Y(e)},sx:{px:1.5,py:1,cursor:"pointer",bgcolor:r===W?"action.selected":"background.paper","&:hover":{bgcolor:"action.hover"}},children:[(0,o.jsx)(l.A,{component:"div",sx:{fontFamily:"monospace",fontSize:14},children:e.label}),(0,o.jsx)(l.A,{variant:"caption",color:"text.secondary",sx:{wordBreak:"break-all"},children:e.description||e.value})]})]},e.value)})})]})});m.displayName="GlobalReferenceEditor";let x=m},22573:(e,r,t)=>{"use strict";t.d(r,{A:()=>g});var o=t(95155);t(12115);var n=t(33567),a=t(94049),i=t(41983),l=t(25635),s=t(28548),d=t(50430),c=t(63186),u=t(91665);let g=e=>{let{label:r,count:t,expanded:g,onToggle:f,showFolderIcon:b=!1,children:p}=e,h=(0,n.A)();return(0,o.jsxs)(a.default,{sx:{mb:1.5},children:[(0,o.jsxs)(a.default,{role:"button",tabIndex:0,"aria-expanded":g,onClick:f,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),f())},sx:{display:"flex",alignItems:"center",gap:1,px:1,py:.75,borderRadius:1,cursor:"pointer",userSelect:"none",backgroundColor:h.palette.background.default,border:"1px solid ".concat(h.palette.divider),"&:hover":{backgroundColor:h.palette.action.hover}},children:[(0,o.jsx)(i.A,{size:"small","aria-label":g?"Collapse section":"Expand section",onClick:e=>{e.stopPropagation(),f()},sx:{transition:"transform 0.2s",transform:g?"rotate(0deg)":"rotate(-90deg)"},children:(0,o.jsx)(c.A,{fontSize:"small"})}),b&&(0,o.jsx)(u.A,{fontSize:"small",sx:{color:"text.secondary"}}),(0,o.jsx)(l.A,{variant:"subtitle2",sx:{fontWeight:600},children:r}),(0,o.jsx)(s.A,{label:t,size:"small",sx:{height:20,fontSize:"0.7rem"}})]}),(0,o.jsx)(d.A,{in:g,unmountOnExit:!0,children:(0,o.jsx)(a.default,{sx:{pt:1.5},children:p})})]})}},26796:(e,r,t)=>{"use strict";t.r(r),t.d(r,{ThemeProvider:()=>h,useTheme:()=>m});var o=t(95155),n=t(12115),a=t(73288),i=t(7160),l=t(29197),s=t(8532),d=t(9352),c=t(34432),u=t(84563),g=t(29692);let f=(0,a.h)("frontend/contexts/ThemeContext"),b=(0,n.createContext)(void 0);function p(e,r){let t=document.documentElement;t.classList.toggle("dark-theme","dark"===e),t.classList.toggle("modern-theme","modern"===r),t.classList.toggle("legacy-theme","legacy"===r),t.dataset.visualStyle=r,t.style.colorScheme=e}let h=e=>{let{children:r}=e,[t,a]=(0,n.useState)(!1),[h,m]=(0,n.useState)("modern");(0,n.useEffect)(()=>{(async()=>{f.debug("Loading theme preference from storage");let[e,r]=await Promise.all([(0,g.YM)(g.Zg.THEME,"light"),(0,g.YM)(g.Zg.THEME_STYLE,"modern")]);f.info("Theme loaded from storage: ".concat(e));let t="dark"===e?"dark":"light",o="legacy"===r?"legacy":"modern";a("dark"===t),m(o),p(t,o)})()},[]);let x=(0,n.useMemo)(()=>(function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"modern";return"legacy"===r?function(e){let r="dark"===e?c.z.dark:c.z.light,t="dark"===e;return(0,l.A)({palette:{mode:e,primary:{main:t?"#4f93f5":"#007bff",light:t?"#6aa6f7":"#3395ff",dark:t?"#3a7ad4":"#0056b3"},secondary:{main:t?"#a3adba":"#6c757d"},error:{main:t?"#ff6b6b":"#dc2626",light:t?"#5a2a2e":"#fecaca",dark:t?"#2a1618":"#b91c1c"},warning:{main:t?"#e0a23c":"#f59e0b"},info:{main:t?"#56b6d6":"#3b82f6"},success:{main:t?"#3fae72":"#16a34a"},divider:r.border,background:{default:r.background,paper:r.surface},text:{primary:r.foreground,secondary:r.textSecondary,disabled:r.textDisabled}},typography:{fontFamily:"var(--font-geist-sans), Arial, sans-serif",h1:{fontWeight:700},h2:{fontWeight:700},h3:{fontWeight:600},h4:{fontWeight:600},h5:{fontWeight:600},h6:{fontWeight:600}},components:{MuiButton:{styleOverrides:{root:{textTransform:"none",borderRadius:"0.375rem"}}},MuiPaper:{styleOverrides:{root:{borderRadius:"0.5rem",backgroundImage:"none"}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:"0.375rem"}}}},MuiCard:{styleOverrides:{root:{borderRadius:"0.5rem",border:t?"1px solid ".concat(r.border):void 0,boxShadow:t?"0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3)":"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"}}},MuiMenu:{styleOverrides:{paper:{backgroundColor:r.surfaceRaised,backgroundImage:"none"}}},MuiPopover:{styleOverrides:{paper:{backgroundColor:r.surfaceRaised,backgroundImage:"none"}}},MuiTooltip:{styleOverrides:{tooltip:t?{backgroundColor:r.surfaceRaised,border:"1px solid ".concat(r.border),color:r.foreground}:void 0}}}})}(e):function(e){let r="dark"===e?d.kY.dark:d.kY.light,t="dark"===e,o=t?"#8B7CFF":"#6355E8",n=t?"#ACA2FF":"#6C5CE2",a=t?"#6656E8":"#493BCB",i=t?"#31D2ED":"#129DB8",c=t?"rgba(13, 17, 31, 0.82)":"rgba(255, 255, 255, 0.84)",u=t?"0 18px 55px rgba(0, 0, 0, 0.30)":"0 18px 55px rgba(60, 54, 116, 0.11)",g=t?"0 26px 80px rgba(0, 0, 0, 0.48)":"0 26px 80px rgba(54, 48, 112, 0.18)";return(0,l.A)({palette:{mode:e,primary:{main:o,light:n,dark:a,contrastText:"#FFFFFF"},secondary:{main:i,light:t?"#79E3F4":"#3CBBD0",dark:t?"#10A8C3":"#0B758A"},error:{main:t?"#FF8298":"#C62847",light:r.error.background,dark:r.error.border},warning:{main:t?"#F6BC66":"#C67A13"},info:{main:i},success:{main:t?"#57D59B":"#15885A"},divider:r.border,background:{default:r.background,paper:r.surface},text:{primary:r.foreground,secondary:r.textSecondary,disabled:r.textDisabled}},shape:{borderRadius:14},typography:{fontFamily:"var(--font-geist-sans), Inter, ui-sans-serif, system-ui, -apple-system, sans-serif",fontSize:14,h1:{fontSize:"clamp(2.6rem, 6vw, 5.5rem)",fontWeight:780,lineHeight:.98,letterSpacing:"-0.055em"},h2:{fontSize:"clamp(2.1rem, 4vw, 3.9rem)",fontWeight:760,lineHeight:1.04,letterSpacing:"-0.045em"},h3:{fontSize:"clamp(1.75rem, 3vw, 2.65rem)",fontWeight:730,lineHeight:1.1,letterSpacing:"-0.035em"},h4:{fontSize:"clamp(1.45rem, 2vw, 2rem)",fontWeight:710,lineHeight:1.16,letterSpacing:"-0.028em"},h5:{fontSize:"1.35rem",fontWeight:700,lineHeight:1.24,letterSpacing:"-0.022em"},h6:{fontSize:"1.05rem",fontWeight:680,lineHeight:1.35,letterSpacing:"-0.012em"},subtitle1:{fontWeight:640},button:{fontWeight:680,letterSpacing:"-0.01em"},body1:{lineHeight:1.62},body2:{lineHeight:1.55},caption:{fontSize:"0.74rem",fontWeight:560,letterSpacing:"0.012em"}},transitions:{duration:{shortest:110,shorter:150,short:190,standard:240,complex:320,enteringScreen:260,leavingScreen:190}},components:{MuiCssBaseline:{styleOverrides:{body:{backgroundColor:r.background}}},MuiAppBar:{styleOverrides:{root:{color:r.foreground,backgroundColor:c,backgroundImage:"none",borderBottom:"1px solid ".concat((0,s.X4)(r.border,.82)),boxShadow:"none",backdropFilter:"blur(24px) saturate(150%)"}}},MuiToolbar:{styleOverrides:{root:{minHeight:"var(--app-bar-height)"}}},MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{minHeight:40,paddingInline:16,borderRadius:12,textTransform:"none",transition:"transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, border-color 180ms ease","&:active":{transform:"translateY(1px) scale(0.99)"},"&:focus-visible":{outline:"3px solid ".concat((0,s.X4)(o,.28)),outlineOffset:2}},sizeLarge:{minHeight:48,paddingInline:22,borderRadius:14,fontSize:"0.95rem"},containedPrimary:{color:"#fff",backgroundColor:o,backgroundImage:"linear-gradient(135deg, ".concat(n," 0%, ").concat(o," 46%, ").concat(a," 100%)"),boxShadow:"0 10px 26px ".concat((0,s.X4)(o,t?.28:.22)),"&:hover":{backgroundImage:"linear-gradient(135deg, ".concat(n," 0%, ").concat(o," 38%, ").concat(a," 100%)"),boxShadow:"0 15px 34px ".concat((0,s.X4)(o,t?.38:.3)),transform:"translateY(-1px)"},"&.Mui-disabled":{backgroundImage:"none"}},outlinedPrimary:{borderColor:(0,s.X4)(o,.42),backgroundColor:(0,s.X4)(o,t?.08:.045),"&:hover":{borderColor:o,backgroundColor:(0,s.X4)(o,t?.15:.09),transform:"translateY(-1px)"}}}},MuiPaper:{styleOverrides:{root:{borderRadius:18,backgroundColor:r.surface,backgroundImage:"none"},outlined:{borderColor:r.border},elevation1:{border:"1px solid ".concat(r.border),boxShadow:u},elevation2:{border:"1px solid ".concat(r.border),boxShadow:g}}},MuiCard:{styleOverrides:{root:{overflow:"hidden",border:"1px solid ".concat(r.border),borderRadius:18,backgroundColor:r.surface,backgroundImage:t?"linear-gradient(150deg, rgba(255,255,255,0.028), transparent 42%)":"linear-gradient(150deg, rgba(102,87,245,0.025), transparent 42%)",boxShadow:u}}},MuiCardActionArea:{styleOverrides:{root:{borderRadius:"inherit","&:focus-visible":{outline:"3px solid ".concat((0,s.X4)(o,.3)),outlineOffset:-3}}}},MuiOutlinedInput:{styleOverrides:{root:{minHeight:42,borderRadius:12,backgroundColor:(0,s.X4)(r.surfaceRaised,t?.6:.74),transition:"box-shadow 180ms ease, background-color 180ms ease","& .MuiOutlinedInput-notchedOutline":{borderColor:r.border},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:(0,s.X4)(o,.52)},"&.Mui-focused":{backgroundColor:r.surfaceRaised,boxShadow:"0 0 0 4px ".concat((0,s.X4)(o,.12))},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderWidth:1,borderColor:o}}}},MuiInputBase:{styleOverrides:{input:{"&::placeholder":{color:r.textSecondary,opacity:.78}}}},MuiInputLabel:{styleOverrides:{root:{color:r.textSecondary,fontWeight:560}}},MuiDialog:{styleOverrides:{paper:{border:"1px solid ".concat(r.border),borderRadius:24,backgroundColor:c,boxShadow:g,backdropFilter:"blur(30px) saturate(145%)"}}},MuiDialogTitle:{styleOverrides:{root:{padding:"24px 24px 10px",fontWeight:720,letterSpacing:"-0.025em"}}},MuiDrawer:{styleOverrides:{paper:{borderColor:r.border,backgroundColor:c,backgroundImage:"none",boxShadow:g,backdropFilter:"blur(28px) saturate(150%)"}}},MuiMenu:{styleOverrides:{paper:{marginTop:8,border:"1px solid ".concat(r.border),borderRadius:15,backgroundColor:r.surfaceRaised,backgroundImage:"none",boxShadow:g,backdropFilter:"blur(24px) saturate(140%)"},list:{padding:7}}},MuiMenuItem:{styleOverrides:{root:{minHeight:40,borderRadius:9,"&.Mui-selected":{backgroundColor:(0,s.X4)(o,.14),"&:hover":{backgroundColor:(0,s.X4)(o,.2)}}}}},MuiPopover:{styleOverrides:{paper:{border:"1px solid ".concat(r.border),backgroundColor:r.surfaceRaised,backgroundImage:"none",boxShadow:g,backdropFilter:"blur(24px) saturate(140%)"}}},MuiTooltip:{styleOverrides:{tooltip:{padding:"7px 10px",border:"1px solid ".concat(r.border),borderRadius:9,color:r.foreground,backgroundColor:r.surfaceRaised,boxShadow:u,fontSize:"0.72rem",fontWeight:600}}},MuiChip:{styleOverrides:{root:{height:30,borderRadius:9,fontWeight:650}}},MuiIconButton:{styleOverrides:{root:{borderRadius:11,transition:"transform 160ms ease, background-color 160ms ease, color 160ms ease","&:hover":{backgroundColor:(0,s.X4)(o,.1),transform:"translateY(-1px)"},"&:focus-visible":{outline:"3px solid ".concat((0,s.X4)(o,.28)),outlineOffset:2}}}},MuiTabs:{styleOverrides:{root:{minHeight:42},indicator:{height:3,borderRadius:"3px 3px 0 0",backgroundImage:"linear-gradient(90deg, ".concat(o,", ").concat(i,")")}}},MuiTab:{styleOverrides:{root:{minWidth:0,minHeight:42,padding:"8px 14px",color:r.textSecondary,fontWeight:640,textTransform:"none","&.Mui-selected":{color:r.foreground}}}},MuiAlert:{styleOverrides:{root:{alignItems:"center",border:"1px solid currentColor",borderRadius:14,backgroundImage:"none"},message:{paddingBlock:7}}},MuiAccordion:{styleOverrides:{root:{overflow:"hidden",border:"1px solid ".concat(r.border),borderRadius:"16px !important",backgroundColor:r.surface,boxShadow:"none","&::before":{display:"none"},"& + &":{marginTop:10},"&.Mui-expanded":{marginBlock:10,boxShadow:u}}}},MuiAccordionSummary:{styleOverrides:{root:{minHeight:58,paddingInline:18,"&.Mui-expanded":{minHeight:58}},content:{marginBlock:12,"&.Mui-expanded":{marginBlock:12}}}},MuiListItemButton:{styleOverrides:{root:{minHeight:42,borderRadius:11,"&.Mui-selected":{backgroundColor:(0,s.X4)(o,.14),"&:hover":{backgroundColor:(0,s.X4)(o,.19)}}}}},MuiTableCell:{styleOverrides:{root:{borderColor:r.border},head:{color:r.textSecondary,backgroundColor:(0,s.X4)(r.surfaceRaised,.64),fontSize:"0.72rem",fontWeight:720,letterSpacing:"0.055em",textTransform:"uppercase"}}},MuiDivider:{styleOverrides:{root:{borderColor:r.border}}},MuiSwitch:{styleOverrides:{root:{padding:8},switchBase:{"&.Mui-checked + .MuiSwitch-track":{backgroundColor:o,opacity:.75}},track:{borderRadius:999}}},MuiLinearProgress:{styleOverrides:{root:{height:7,borderRadius:999,backgroundColor:(0,s.X4)(o,.12)},bar:{borderRadius:999,backgroundImage:"linear-gradient(90deg, ".concat(o,", ").concat(i,")")}}},MuiSkeleton:{styleOverrides:{root:{backgroundColor:(0,s.X4)(r.textSecondary,.12)}}}}})}(e)})(t?"dark":"light",h),[t,h]);return f.debug("Rendering ThemeProvider with isDarkMode: ".concat(t)),(0,o.jsx)(b.Provider,{value:{toggleTheme:()=>{a(e=>{let r=!e,t=r?"dark":"light";return f.info("Toggling theme to: ".concat(t)),p(t,h),(0,g.VH)(g.Zg.THEME,t),r})},isDarkMode:t,visualStyle:h,setVisualStyle:e=>{m(e),p(t?"dark":"light",e),(0,g.VH)(g.Zg.THEME_STYLE,e)},setThemePreset:e=>{let{mode:r,style:t}=e;a("dark"===r),m(t),p(r,t),Promise.all([(0,g.VH)(g.Zg.THEME,r),(0,g.VH)(g.Zg.THEME_STYLE,t)])}},children:(0,o.jsxs)(i.A,{theme:x,children:[(0,o.jsx)(u.Ay,{}),r]})})},m=()=>{let e=(0,n.useContext)(b);if(!e)throw f.error("useTheme hook used outside of ThemeProvider"),Error("useTheme must be used within a ThemeProvider");return f.debug("useTheme hook accessed"),e}},32098:()=>{},34432:(e,r,t)=>{"use strict";t.d(r,{k:()=>o,z:()=>n});let o={light:{background:"#F5F7FF",foreground:"#171A2B",surface:"#FFFFFF",surfaceRaised:"#F8FAFF",paperBackground:"#FFFFFF",textSecondary:"#606A84",textDisabled:"#929BB1",border:"#DEE3F0",heading:"#121424",text:"#20243A",secondaryText:"#606A84",error:{background:"#FFF2F5",border:"#FFC7D2",text:"#C62847"},domain:{resource:"#008D83",resourceSoft:"#36B9AD",signal:"#7157D9",startNode:"#7A5C50",codeBackground:"#F2F4FA",http:{get:"#2e7d32",post:"#1565c0",put:"#e65100",patch:"#6a1b9a",delete:"#c62828"},transport:{stdio:{fg:"#1976d2",bg:"#e3f2fd"},websocket:{fg:"#2e7d32",bg:"#e8f5e8"},sse:{fg:"#f57c00",bg:"#fff3e0"},streamable:{fg:"#00796b",bg:"#e0f2f1"},default:{fg:"#757575",bg:"#f5f5f5"}}}},dark:{background:"#070912",foreground:"#F4F6FF",surface:"#12182C",surfaceRaised:"#1C243B",paperBackground:"#12182C",textSecondary:"#ADB6CC",textDisabled:"#69738C",border:"#2A324B",heading:"#F8F9FF",text:"#F4F6FF",secondaryText:"#ADB6CC",error:{background:"#2D151F",border:"#633044",text:"#FF8298"},domain:{resource:"#38C9BC",resourceSoft:"#6BDED4",signal:"#A694FF",startNode:"#C6A69A",codeBackground:"#181E32",http:{get:"#66bb6a",post:"#5b9dff",put:"#ffa726",patch:"#ba68c8",delete:"#ef5350"},transport:{stdio:{fg:"#9DCCFF",bg:"#17243A"},websocket:{fg:"#9DE3B3",bg:"#172D24"},sse:{fg:"#FFD18A",bg:"#322718"},streamable:{fg:"#82E2D9",bg:"#15312F"},default:{fg:"#ADB6CC",bg:"#1C243B"}}}}},n={light:{background:"#FFFFFF",foreground:"#2C3E50",surface:"#F5F6FA",surfaceRaised:"#FFFFFF",paperBackground:"#F5F6FA",textSecondary:"#7F8C8D",textDisabled:"#9CA3AF",border:"#e5e7eb",heading:"#111",text:"#333",secondaryText:"#666",error:{background:"#fef2f2",border:"#fecaca",text:"#dc2626"},domain:{resource:"#009688",resourceSoft:"#4DB6AC",signal:"#7E57C2",startNode:"#795548",codeBackground:"#f5f5f5",http:{get:"#2e7d32",post:"#1565c0",put:"#e65100",patch:"#6a1b9a",delete:"#c62828"},transport:{stdio:{fg:"#1976d2",bg:"#e3f2fd"},websocket:{fg:"#2e7d32",bg:"#e8f5e8"},sse:{fg:"#f57c00",bg:"#fff3e0"},streamable:{fg:"#00796b",bg:"#e0f2f1"},default:{fg:"#757575",bg:"#f5f5f5"}}}},dark:{background:"#0f1319",foreground:"#eef1f5",surface:"#1a212b",surfaceRaised:"#242d3a",paperBackground:"#1a212b",textSecondary:"#b4bdca",textDisabled:"#6b7280",border:"#37404e",heading:"#f5f7fa",text:"#eef1f5",secondaryText:"#b4bdca",error:{background:"#2a1618",border:"#5a2a2e",text:"#ff6b6b"},domain:{resource:"#26a69a",resourceSoft:"#4DB6AC",signal:"#9575CD",startNode:"#a1887f",codeBackground:"#242d3a",http:{get:"#66bb6a",post:"#5b9dff",put:"#ffa726",patch:"#ba68c8",delete:"#ef5350"},transport:{stdio:{fg:"#90caf9",bg:"#1e2a3a"},websocket:{fg:"#a5d6a7",bg:"#1e2e22"},sse:{fg:"#ffcc80",bg:"#33281a"},streamable:{fg:"#80cbc4",bg:"#17322e"},default:{fg:"#b4bdca",bg:"#242d3a"}}}}}},38459:(e,r,t)=>{"use strict";t.d(r,{Az:()=>n,FM:()=>o,Je:()=>i,po:()=>a,yF:()=>l});let o="folder";function n(e,r){let t=[],o=new Map;for(let n of e){let{key:e,label:a}=r(n),i=o.get(e);i||(i={key:e,label:a,items:[]},o.set(e,i),t.push(i)),i.items.push(n)}return t}function a(e){let r=(null!=e?e:"").trim().charAt(0).toUpperCase();return r>="A"&&r<="Z"?{key:"letter:".concat(r),label:r}:{key:"letter:#",label:"#"}}function i(e,r){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Ungrouped",o=new Map,n=[];for(let t of e){var a;let e=null==(a=r(t))?void 0:a.trim();if(e){let r=o.get(e);r?r.push(t):o.set(e,[t])}else n.push(t)}let i=Array.from(o.keys()).sort((e,r)=>e.localeCompare(r)).map(e=>({key:"folder:".concat(e),label:e,items:o.get(e)}));return n.length>0&&i.push({key:"folder:__ungrouped__",label:t,items:n}),i}function l(e,r){let t=new Set;for(let n of e){var o;let e=null==(o=r(n))?void 0:o.trim();e&&t.add(e)}return Array.from(t).sort((e,r)=>e.localeCompare(r))}},61033:(e,r,t)=>{"use strict";t.d(r,{A$:()=>c,X8:()=>l,YP:()=>u,js:()=>d});let o="_-_-_",n=/^(tool|resource):(.+)$/,a=/\$\{((?:tool|resource):[^}]+|_-_-_[^}]+)\}/g;function i(e,r){return"".concat(e,"__").concat(r)}function l(e,r,t){return"${".concat(e,":").concat(i(r,t),"}")}function s(e){let r=n.exec(e);if(r){let e=r[1],t=function(e){let r=e.indexOf("__");if(r<=0)return null;let t=e.slice(r+2);return t?{server:e.slice(0,r),name:t}:null}(r[2]);return t?{kind:e,server:t.server,name:t.name}:null}if(e.startsWith(o)){let r=e.split(o);if(3===r.length&&r[1]&&r[2])return{kind:"tool",server:r[1],name:r[2]}}return null}function d(e){return e.startsWith("${")&&e.endsWith("}")?s(e.slice(2,-1)):null}function c(e){let r,t=[];for(a.lastIndex=0;null!==(r=a.exec(e));){let e=s(r[1]);e&&t.push({...e,fullMatch:r[0],index:r.index})}return t}function u(e){return"tool"===e.kind&&"handoff"===e.server?"handoff:".concat(e.name):"".concat(e.kind,":").concat(i(e.server,e.name))}},65818:(e,r,t)=>{"use strict";t.d(r,{mO:()=>a,oO:()=>i});var o=t(38459);let n=["stdio","websocket","sse","streamable"];function a(e,r){switch(r){case"name-asc":case"name-desc":return(0,o.po)(e.name);case"status-connected":case"status-disconnected":{let r=e.status;if("connected"===r)return{key:"status:connected",label:"Connected"};if("error"===r)return{key:"status:error",label:"Error"};if("requires_authentication"===r)return{key:"status:auth",label:"Requires authentication"};return{key:"status:disconnected",label:"Disconnected"}}case"transport":{let r=e.transport||"unknown";return{key:"transport:".concat(r),label:({stdio:"Stdio",websocket:"WebSocket",sse:"SSE",streamable:"Streamable HTTP"})[r]||r}}default:return{key:"all",label:"All servers"}}}function i(e,r){let t=(e,t)=>{switch(r){case"name-asc":return e.name.localeCompare(t.name);case"name-desc":return t.name.localeCompare(e.name);case"status-connected":if("connected"===e.status&&"connected"!==t.status)return -1;if("connected"!==e.status&&"connected"===t.status)return 1;return e.name.localeCompare(t.name);case"status-disconnected":if("disconnected"===e.status&&"disconnected"!==t.status)return -1;if("disconnected"!==e.status&&"disconnected"===t.status)return 1;return e.name.localeCompare(t.name);case"transport":{var o,a;let r=n.indexOf(null!=(o=e.transport)?o:""),i=n.indexOf(null!=(a=t.transport)?a:"");if(r!==i)return r-i;return e.name.localeCompare(t.name)}default:return 0}};return[...e].sort((e,r)=>{let o=Number(!!r.favorite)-Number(!!e.favorite);return 0!==o?o:t(e,r)})}},81956:(e,r,t)=>{"use strict";t.d(r,{A:()=>v});var o=t(95155),n=t(12115),a=t(36314),i=t(86973),l=t(49501),s=t(17681),d=t(21067),c=t(2778),u=t(52363),g=t(65036),f=t(9562),b=t(75912),p=t(91871),h=t(9693),m=t(91665),x=t(7517),k=t(8190);let v=e=>{let{anchorEl:r,open:t,currentFolder:v,folders:y,onClose:C,onAssign:F}=e,[S,A]=(0,n.useState)(!1),[M,w]=(0,n.useState)(""),j=e=>{F(e),C()},T=()=>{let e=M.trim();e&&(A(!1),j(e))};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(a.A,{anchorEl:r,open:t,onClose:C,onClick:e=>e.stopPropagation(),children:[y.length>0&&y.map(e=>(0,o.jsxs)(i.A,{onClick:()=>j(e),selected:e===v,children:[(0,o.jsx)(l.A,{children:e===v?(0,o.jsx)(h.A,{fontSize:"small"}):(0,o.jsx)(m.A,{fontSize:"small"})}),(0,o.jsx)(s.A,{primary:e})]},e)),y.length>0&&(0,o.jsx)(d.A,{}),(0,o.jsxs)(i.A,{onClick:()=>{w(""),A(!0)},children:[(0,o.jsx)(l.A,{children:(0,o.jsx)(x.A,{fontSize:"small"})}),(0,o.jsx)(s.A,{primary:"New folder…"})]}),v&&(0,o.jsxs)(i.A,{onClick:()=>j(void 0),children:[(0,o.jsx)(l.A,{children:(0,o.jsx)(k.A,{fontSize:"small"})}),(0,o.jsx)(s.A,{primary:"Remove from folder"})]})]}),(0,o.jsxs)(c.A,{open:S,onClose:()=>A(!1),maxWidth:"xs",fullWidth:!0,onClick:e=>e.stopPropagation(),children:[(0,o.jsx)(u.A,{children:"New folder"}),(0,o.jsx)(g.A,{children:(0,o.jsx)(f.A,{autoFocus:!0,margin:"dense",label:"Folder name",fullWidth:!0,value:M,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),T())}})}),(0,o.jsxs)(b.A,{children:[(0,o.jsx)(p.A,{onClick:()=>A(!1),children:"Cancel"}),(0,o.jsx)(p.A,{variant:"contained",disabled:!M.trim(),onClick:T,children:"Create"})]})]})]})}},90880:(e,r,t)=>{"use strict";t.d(r,{CN:()=>c,Pj:()=>s,Ub:()=>d,jX:()=>u,sE:()=>i,y4:()=>l});var o=t(61033);let n=/\$\{res:([^}]+)\}/g,a=/\$\{global:([^}]+)\}/g;function i(e){let r,t=(0,o.A$)(e).map(e=>({kind:e.kind,server:e.server,name:e.name,fullMatch:e.fullMatch,index:e.index}));for(n.lastIndex=0;null!==(r=n.exec(e));)t.push({kind:"runres",server:"",name:r[1],fullMatch:r[0],index:r.index});for(a.lastIndex=0;null!==(r=a.exec(e));)t.push({kind:"global",server:"",name:r[1],fullMatch:r[0],index:r.index});return t.sort((e,r)=>e.index-r.index)}function l(e){if(e.startsWith("${res:")&&e.endsWith("}")){let r=e.slice(6,-1);return r?{kind:"runres",server:"",name:r}:null}if(e.startsWith("${global:")&&e.endsWith("}")){let r=e.slice(9,-1);return r?{kind:"global",server:"",name:r}:null}let r=(0,o.js)(e);return r?{kind:r.kind,server:r.server,name:r.name}:null}function s(e,r,t){return"runres"===e?"${res:".concat(t,"}"):"global"===e?"${global:".concat(t,"}"):(0,o.X8)(e,r,t)}function d(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.name,t=arguments.length>2?arguments[2]:void 0;return{...e,label:r,value:s(e.kind,e.server,e.name),description:t}}function c(e){return"runres"===e.kind?"res:".concat(e.name):"global"===e.kind?"global:".concat(e.name):(0,o.YP)({kind:e.kind,server:e.server,name:e.name})}function u(e){let r=new Set;for(let t of e){let e;if("string"==typeof t&&0!==t.length)for(n.lastIndex=0;null!==(e=n.exec(t));){let t=e[1].trim();t&&r.add(t)}}return[...r].sort((e,r)=>e.localeCompare(r))}},97104:(e,r,t)=>{"use strict";t.d(r,{Aq:()=>n,Xk:()=>i,vi:()=>a});var o=t(12115);function n(e,r){try{let t=window.localStorage.getItem(e);if(null===t)return r;return JSON.parse(t)}catch(e){return r}}function a(e,r){try{window.localStorage.setItem(e,JSON.stringify(r))}catch(e){}}function i(e,r){let[t,i]=(0,o.useState)(()=>n(e,r));return[t,(0,o.useCallback)(r=>{i(t=>{let o="function"==typeof r?r(t):r;return a(e,o),o})},[e])]}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4965],{64965:(e,t,l)=>{l.r(t),l.d(t,{default:()=>B});var r=l(95155),a=l(12115),i=l(20063),o=l(9164),n=l(26796),s=l(34432),c=l(53868);let h=2*Math.PI,d={skyTop:s.k.light.background,skyBottom:s.k.light.surfaceRaised,halo:"rgba(99, 85, 232, 0.20)",star:"rgba(255,255,255,0)",hillFar:s.k.light.border,hillNear:s.k.light.textDisabled,grass:s.k.light.domain.signal,grassLight:c.L.dark.signal,bank:s.k.light.surface,waterTop:c.L.dark.mcp,waterBottom:c.L.light.process,waterLine:"rgba(255,255,255,0.72)",trunk:s.k.light.textSecondary,leaf:c.L.light.resource,leafLight:c.L.dark.resource,structure:s.k.light.surfaceRaised,structureDark:s.k.light.textSecondary,window:c.L.dark.subflow,mist:"rgba(245,247,255,0.34)"},u={skyTop:s.k.dark.background,skyBottom:s.k.dark.surface,halo:"rgba(139, 124, 255, 0.28)",star:"rgba(244,246,255,0.84)",hillFar:s.k.dark.surface,hillNear:s.k.dark.surfaceRaised,grass:s.k.dark.domain.signal,grassLight:c.L.light.signal,bank:s.k.dark.border,waterTop:c.L.light.mcp,waterBottom:c.L.dark.process,waterLine:"rgba(49,210,237,0.42)",trunk:s.k.dark.textDisabled,leaf:c.L.light.resource,leafLight:c.L.dark.resource,structure:s.k.dark.surfaceRaised,structureDark:s.k.dark.border,window:c.L.dark.subflow,mist:"rgba(139,124,255,0.12)"},f=e=>{let t=43758.5453*Math.sin(12.9898*e);return t-Math.floor(t)},m=(e,t)=>{let l=e.replace("#",""),r=Number.parseInt(3===l.length?l.split("").map(e=>"".concat(e).concat(e)).join(""):l,16);return"rgba(".concat(r>>16&255,", ").concat(r>>8&255,", ").concat(255&r,", ").concat(t,")")},g=(e,t,l,r,a,i)=>{let o=Math.min(i,Math.abs(r)/2,Math.abs(a)/2);e.beginPath(),e.moveTo(t+o,l),e.lineTo(t+r-o,l),e.quadraticCurveTo(t+r,l,t+r,l+o),e.lineTo(t+r,l+a-o),e.quadraticCurveTo(t+r,l+a,t+r-o,l+a),e.lineTo(t+o,l+a),e.quadraticCurveTo(t,l+a,t,l+a-o),e.lineTo(t,l+o),e.quadraticCurveTo(t,l,t+o,l),e.closePath()},w=e=>(e.x-50)*130,k=e=>145+42*Math.sin(.00105*e)+19*Math.sin(.00245*e+1.7),v=e=>k(w(e))-44+(e.y-50)*2.25,y=e=>({x:w(e),y:v(e)-82,zoom:e.zoom});function b(e,t,l,r,a,i,o,n,s){e.beginPath(),e.moveTo(t,s),e.lineTo(t,r);for(let o=t;o<=l;o+=90){let t=r-Math.abs(Math.sin(o*i+n))*a-Math.abs(Math.sin(o*i*.41+2.2*n))*a*.52;e.lineTo(o,t)}e.lineTo(l,s),e.closePath(),e.fillStyle=o,e.fill()}function p(e,t,l){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;e.moveTo(t,k(t)+r);for(let a=t+70;a<=l;a+=70)e.lineTo(a,k(a)+r)}function S(e,t,l,r,a){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;e.save(),e.translate(t,l),e.scale(i,i),e.strokeStyle=r.structureDark,e.lineWidth=4,e.beginPath(),e.moveTo(0,0),e.lineTo(0,-48),e.lineTo(10,-48),e.stroke(),e.fillStyle=a,e.shadowColor=a,e.shadowBlur=22,g(e,3,-55,17,20,5),e.fill(),e.restore()}let T={overlook:function(e,t,l,r){e.fillStyle=t.structureDark,g(e,-94,-18,188,21,7),e.fill(),e.fillRect(-72,0,8,25),e.fillRect(64,0,8,25),S(e,-74,-14,t,l,.82),S(e,74,-14,t,l,.82),e.strokeStyle=m(l,.62),e.lineWidth=2,e.beginPath(),e.arc(0,-25,31+3*Math.sin(.0015*r),.1*Math.PI,.9*Math.PI),e.stroke()},spring:function(e,t,l,r){e.fillStyle=m(l,.23),e.beginPath(),e.ellipse(0,6,92,25,0,0,h),e.fill(),e.strokeStyle=m(l,.75),e.lineWidth=3,e.beginPath(),e.ellipse(0,4,75+5*Math.sin(.002*r),17,0,0,h),e.stroke(),[-46,0,43].forEach((t,r)=>{let a=74+24*r;e.save(),e.translate(t,0),e.fillStyle=1===r?l:m(l,.68),e.shadowColor=l,e.shadowBlur=1===r?28:16,e.beginPath(),e.moveTo(-13,0),e.lineTo(-8,-a+18),e.lineTo(0,-a),e.lineTo(10,-a+20),e.lineTo(14,0),e.closePath(),e.fill(),e.restore()})},harbor:function(e,t,l,r){e.strokeStyle=t.structureDark,e.lineWidth=12,e.beginPath(),e.moveTo(-110,0),e.quadraticCurveTo(0,-116,110,0),e.stroke(),e.strokeStyle=t.structure,e.lineWidth=5,e.beginPath(),e.moveTo(-110,-2),e.quadraticCurveTo(0,-105,110,-2),e.stroke();for(let t=0;t<4;t+=1){let a=(11e-5*r+t/4)%1,i=-98+196*a,o=-4-(1-Math.pow((a-.5)*2,2))*79;e.fillStyle=l,e.shadowColor=l,e.shadowBlur=15,e.beginPath(),e.arc(i,o,5,0,h),e.fill()}e.shadowBlur=0},workshop:function(e,t,l,r){let a=[{x:-72,y:-22},{x:0,y:-82},{x:78,y:-18}];e.strokeStyle=m(l,.7),e.lineWidth=3,e.setLineDash([7,9]),e.lineDashOffset=-(.012*r),e.beginPath(),e.moveTo(a[0].x,a[0].y),e.lineTo(a[1].x,a[1].y),e.lineTo(a[2].x,a[2].y),e.stroke(),e.setLineDash([]),a.forEach((r,a)=>{e.fillStyle=1===a?l:t.structure,e.strokeStyle=t.structureDark,e.lineWidth=5,e.shadowColor=1===a?l:"transparent",e.shadowBlur=22*(1===a),e.beginPath(),e.moveTo(r.x,r.y-24),e.lineTo(r.x+25,r.y-4),e.lineTo(r.x+14,r.y+24),e.lineTo(r.x-18,r.y+24),e.lineTo(r.x-26,r.y-5),e.closePath(),e.fill(),e.stroke()}),e.shadowBlur=0},cove:function(e,t,l,r){e.fillStyle=t.structureDark,g(e,-100,-7,200,16,7),e.fill();let a=4*Math.sin(.002*r);[-47,47].forEach((r,i)=>{e.fillStyle=0===i?l:t.window,e.shadowColor=0===i?l:t.window,e.shadowBlur=25,g(e,r-29,-77-a*(i?-1:1),58,43,18),e.fill(),e.beginPath(),e.moveTo(r+(i?-11:11),-37-a*(i?-1:1)),e.lineTo(r+(i?-2:2),-27-a*(i?-1:1)),e.lineTo(r+(i?-20:20),-34-a*(i?-1:1)),e.closePath(),e.fill()}),e.shadowBlur=0},lockworks:function(e,t,l,r){e.fillStyle=t.structure,e.strokeStyle=t.structureDark,e.lineWidth=6,g(e,-95,-91,92,91,10),e.fill(),e.stroke(),e.fillStyle=t.window,e.shadowColor=t.window,e.shadowBlur=12,g(e,-71,-65,34,26,6),e.fill(),e.shadowBlur=0,e.save(),e.translate(51,-38),e.rotate(35e-5*r),e.strokeStyle=l,e.lineWidth=7,e.beginPath(),e.arc(0,0,45,0,h),e.stroke();for(let t=0;t<8;t+=1)e.rotate(h/8),e.beginPath(),e.moveTo(0,0),e.lineTo(0,-55),e.stroke();e.fillStyle=t.structureDark,e.beginPath(),e.arc(0,0,10,0,h),e.fill(),e.restore()},observatory:function(e,t,l,r){e.fillStyle=t.structureDark,g(e,-73,-52,146,53,10),e.fill(),e.fillStyle=t.structure,e.beginPath(),e.arc(0,-53,62,Math.PI,h),e.lineTo(62,-52),e.lineTo(-62,-52),e.closePath(),e.fill(),e.strokeStyle=l,e.lineWidth=3,e.beginPath(),e.arc(0,-53,41,Math.PI+.3,h-.3),e.stroke();for(let t=0;t<3;t+=1){let a=72+(.025*r+32*t)%85;e.strokeStyle=m(l,Math.max(0,.35-(a-72)/260)),e.lineWidth=2,e.beginPath(),e.arc(0,-53,a,1.12*Math.PI,1.88*Math.PI),e.stroke()}},market:function(e,t,l,r){[-72,0,72].forEach((a,i)=>{let o=3*Math.sin(.0017*r+i);e.fillStyle=t.structureDark,g(e,a-29,-55,58,57,6),e.fill(),e.fillStyle=1===i?l:t.structure,e.beginPath(),e.moveTo(a-39,-54),e.lineTo(a+36,-54+o),e.lineTo(a+24,-85+o),e.lineTo(a-27,-85),e.closePath(),e.fill()}),e.fillStyle=m(t.window,.82),e.beginPath(),e.arc(-96,-12,5,0,h),e.arc(99,-16,5,0,h),e.fill()},gauge:function(e,t,l,r){e.fillStyle=t.structureDark,g(e,-32,-142,64,144,10),e.fill(),e.fillStyle=t.structure,e.beginPath(),e.moveTo(-44,-139),e.lineTo(0,-178),e.lineTo(44,-139),e.closePath(),e.fill(),e.fillStyle=l,e.shadowColor=l,e.shadowBlur=25,e.beginPath(),e.arc(0,-137,11,0,h),e.fill(),e.save(),e.translate(0,-137),e.rotate(.72*Math.sin(65e-5*r));let a=e.createLinearGradient(0,0,230,0);a.addColorStop(0,m(l,.3)),a.addColorStop(1,m(l,0)),e.fillStyle=a,e.beginPath(),e.moveTo(0,-8),e.lineTo(235,-47),e.lineTo(235,47),e.lineTo(0,8),e.closePath(),e.fill(),e.restore(),e.shadowBlur=0},archive:function(e,t,l,r){e.fillStyle=t.structureDark,g(e,-93,-100,186,101,12),e.fill(),e.fillStyle=t.structure,e.beginPath(),e.moveTo(-111,-96),e.lineTo(0,-156),e.lineTo(111,-96),e.closePath(),e.fill();for(let a=0;a<4;a+=1){let i=-61+41*a;e.fillStyle=a===Math.floor(3e-4*r%4)?l:t.window,e.shadowColor=e.fillStyle,e.shadowBlur=11,g(e,i,-73,24,35,4),e.fill()}e.shadowBlur=0},"control-house":function(e,t,l,r){e.fillStyle=t.structureDark,g(e,-82,-95,164,96,12),e.fill(),e.fillStyle=t.structure,e.beginPath(),e.moveTo(-98,-91),e.lineTo(0,-146),e.lineTo(98,-91),e.closePath(),e.fill(),e.fillStyle=t.window,e.shadowColor=t.window,e.shadowBlur=13,g(e,-48,-70,38,31,6),e.fill(),e.shadowBlur=0,[l,c.L.dark.resource,c.L.dark.subflow].forEach((t,l)=>{e.fillStyle=t,e.beginPath(),e.arc(22+18*l,-54,4+Math.sin(.002*r+l),0,h),e.fill()}),e.strokeStyle=t.structureDark,e.lineWidth=4,e.beginPath(),e.moveTo(0,-143),e.lineTo(0,-177),e.lineTo(22*Math.cos(45e-5*r),-177+8*Math.sin(45e-5*r)),e.stroke()}};var x=l(38581);let M=Object.values(x.D),P={x:0,y:0},L=(e,t,l)=>Math.min(l,Math.max(t,e)),C=(e,t,l)=>e+(t-e)*l;function B(){var e;let t=(0,i.usePathname)(),{settings:l,settingsHydrated:c}=(0,o.useStorage)(),{isDarkMode:g,visualStyle:S}=(0,n.useTheme)(),B=(0,a.useMemo)(()=>(0,x.X)(t),[t]),E=c&&(null==l||null==(e=l.experimental)?void 0:e.enabled)===!0&&"modern"===S,R=(0,a.useRef)(null),D=(0,a.useRef)(B),_=(0,a.useRef)(g),W=(0,a.useRef)(y(B)),z=(0,a.useRef)(null),A=(0,a.useRef)({...P}),j=(0,a.useRef)({...P}),N=(0,a.useRef)(null),F=(0,a.useRef)(null),[q,I]=(0,a.useState)(!1);return((0,a.useEffect)(()=>{var e;_.current=g,null==(e=N.current)||e.call(N)},[g]),(0,a.useEffect)(()=>{let e=document.documentElement;return e.classList.toggle("living-world-active",E),E?(e.dataset.livingScene=B.id,e.style.setProperty("--river-scene-accent",B.accent)):(delete e.dataset.livingScene,e.style.removeProperty("--river-scene-accent")),()=>{e.classList.remove("living-world-active"),delete e.dataset.livingScene,e.style.removeProperty("--river-scene-accent")}},[E,B.accent,B.id]),(0,a.useEffect)(()=>{var e,t;let l=D.current;D.current=B;let r=y(B);if(!E||l.id===B.id||window.matchMedia("(prefers-reduced-motion: reduce)").matches){W.current=r,z.current=null,I(!1),null==(t=N.current)||t.call(N);return}let a=L(720+.05*Math.abs(r.x-W.current.x),780,1320);z.current={from:{...W.current},to:r,startedAt:performance.now(),duration:a},I(!0),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>I(!1),a+80),null==(e=N.current)||e.call(N)},[E,B]),(0,a.useEffect)(()=>()=>{F.current&&clearTimeout(F.current)},[]),(0,a.useEffect)(()=>{if(!E)return;let e=R.current;if(!e||/jsdom/i.test(window.navigator.userAgent))return;let t=null;try{t=e.getContext("2d",{alpha:!0})}catch(e){return}if(!t)return;let l=1,r=1,a=1,i=0,o=0,n=window.matchMedia("(prefers-reduced-motion: reduce)").matches,c=window.matchMedia("(prefers-reduced-motion: reduce)"),g=window.matchMedia("(hover: hover) and (pointer: fine)"),S=()=>{l=Math.max(1,window.innerWidth),r=Math.max(1,window.innerHeight),a=function(e,t,l){let r=Math.max(1,e),a=Math.max(1,t);return Math.min(Number.isFinite(l)&&l>0?l:1,1.6,Math.sqrt(5e6/(r*a)))}(l,r,window.devicePixelRatio),e.width=Math.max(1,Math.floor(l*a)),e.height=Math.max(1,Math.floor(r*a)),e.style.width="".concat(l,"px"),e.style.height="".concat(r,"px"),null==t||t.setTransform(a,0,0,a,0,0)},x=e=>{if(!t)return;let i=z.current;if(i){let t=L((e-i.startedAt)/i.duration,0,1),l=t<.5?16*t*t*t*t*t:1-Math.pow(-2*t+2,5)/2,r=.085*Math.sin(t*Math.PI);W.current={x:C(i.from.x,i.to.x,l),y:C(i.from.y,i.to.y,l),zoom:Math.max(.84,C(i.from.zoom,i.to.zoom,l)-r)},t>=1&&(W.current={...i.to},z.current=null)}let c=z.current?.035:.055;A.current.x=C(A.current.x,j.current.x,c),A.current.y=C(A.current.y,j.current.y,c),t.setTransform(a,0,0,a,0,0),function(e,t){let l=t.dark?u:d;e.clearRect(0,0,t.width,t.height),function(e,t,l){let{width:r,height:a,time:i,camera:o,dark:n}=t,c=e.createLinearGradient(0,0,0,a);c.addColorStop(0,l.skyTop),c.addColorStop(.72,l.skyBottom),c.addColorStop(1,n?s.k.dark.surfaceRaised:s.k.light.border),e.fillStyle=c,e.fillRect(0,0,r,a);let d=.82*r-.012*o.x%(.16*r),u=.18*a,m=e.createRadialGradient(d,u,0,d,u,.3*a);if(m.addColorStop(0,l.halo),m.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=m,e.fillRect(0,0,r,.72*a),e.save(),e.fillStyle=n?s.k.dark.foreground:s.k.light.surface,e.shadowColor=l.halo,e.shadowBlur=28,e.beginPath(),e.arc(d,u,n?20:29,0,h),e.fill(),n&&(e.globalCompositeOperation="destination-out",e.fillStyle="#000",e.beginPath(),e.arc(d+8,u-7,18,0,h),e.fill()),e.restore(),n){e.fillStyle=l.star;for(let t=0;t<46;t+=1){let l=f(7.13*t)*r,o=18+f(13.71*t)*a*.44;e.globalAlpha=Math.max(.16,.45+.3*Math.sin(.0012*i+t)),e.beginPath(),e.arc(l,o,.7+1.1*f(5.3*t),0,h),e.fill()}e.globalAlpha=1}e.save(),e.globalAlpha=n?.12:.18,e.fillStyle=n?"#91aec7":"#ffffff";for(let t=0;t<5;t+=1){let l=(i*(.003+4e-4*t)+t*r*.31)%(r+360)-180,o=a*(.12+.055*t);e.beginPath(),e.ellipse(l,o,95+12*t,18+2*t,0,0,h),e.ellipse(l+58,o+3,70,14,0,0,h),e.fill()}e.restore()}(e,t,l),e.save();let r=16*t.pointer.x,a=8*t.pointer.y;e.translate(.5*t.width+r,.49*t.height+a),e.scale(t.camera.zoom,t.camera.zoom),e.translate(-t.camera.x,-t.camera.y),function(e,t,l){var r,a,i;let o=Math.max(1600,t.width/Math.max(t.camera.zoom,.8)*.8),n=t.camera.x-o,s=t.camera.x+o,c=(r=t.height,a=t.camera,i=t.pointer,Math.max(960,a.y+(.51*r-8*i.y)/a.zoom+180));b(e,n-500,s+500,115,170,72e-5,l.hillFar,.8,c),b(e,n-500,s+500,148,112,.0011,l.hillNear,2.3,c);let h=e.createLinearGradient(0,80,0,420);h.addColorStop(0,l.grassLight),h.addColorStop(1,l.grass),e.beginPath(),p(e,n-500,s+500),e.lineTo(s+500,c),e.lineTo(n-500,c),e.closePath(),e.fillStyle=h,e.fill(),e.beginPath(),p(e,n-500,s+500,45),e.lineTo(s+500,c),e.lineTo(n-500,c),e.closePath(),e.fillStyle=l.bank,e.fill();let d=e.createLinearGradient(0,170,0,780);d.addColorStop(0,l.waterTop),d.addColorStop(1,l.waterBottom),e.beginPath(),p(e,n-500,s+500,67),e.lineTo(s+500,c),e.lineTo(n-500,c),e.closePath(),e.fillStyle=d,e.fill(),e.save(),e.lineCap="round";for(let r=0;r<10;r+=1){let a=98+34*r,i=t.time*(.018+8e-4*r);e.beginPath();for(let t=n-120;t<=s+120;t+=34){let l=k(t)+a+4*Math.sin((t+i)*.014+r);t===n-120?e.moveTo(t,l):e.lineTo(t,l)}e.strokeStyle=l.waterLine,e.globalAlpha=.1+r%3*.035,e.lineWidth=r%3==0?2.1:1.1,e.setLineDash([30+3*r,70+5*r]),e.lineDashOffset=-i*(.35+.02*r),e.stroke()}e.restore()}(e,t,l),function(e,t,l){let r=t.camera.x-Math.max(1700,t.width/t.camera.zoom),a=t.camera.x+Math.max(1700,t.width/t.camera.zoom),i=t.scenes.map(w),o=150*Math.floor(r/150);for(let r=o;r<=a;r+=150){let a=f(.17*r);if(a<.2||i.some(e=>180>Math.abs(e-r)))continue;let o=58+68*a,n=k(r)+9;!function(e,t,l,r,a,i,o){let n=2.4*Math.sin(55e-5*i+8*o);e.save(),e.translate(t,l),e.strokeStyle=a.trunk,e.lineWidth=Math.max(3,.06*r),e.lineCap="round",e.beginPath(),e.moveTo(0,5),e.quadraticCurveTo(.3*n,-(.46*r),n,-(.78*r)),e.stroke(),e.fillStyle=a.leaf,e.beginPath(),e.ellipse(n,-(.76*r),.28*r,.37*r,.008*n,0,h),e.ellipse(-(.18*r)+n,-(.61*r),.24*r,.31*r,-.35,0,h),e.ellipse(.17*r+n,-(.6*r),.25*r,.3*r,.4,0,h),e.fill(),e.globalAlpha=.48,e.fillStyle=a.leafLight,e.beginPath(),e.ellipse(-(.08*r)+n,-(.83*r),.13*r,.18*r,-.4,0,h),e.fill(),e.restore()}(e,r+(a-.5)*70,n,o,l,t.time,a)}}(e,t,l),function(e,t,l){for(let r of t.scenes){let a=w(r),i=v(r);if(Math.abs(a-t.camera.x)>Math.max(1800,t.width/t.camera.zoom))continue;let o=r.id===t.activeScene;if(e.save(),e.translate(a,i),e.globalAlpha=o?1:.56,o){let l=e.createRadialGradient(0,-62,4,0,-62,190);l.addColorStop(0,m(r.accent,t.dark?.24:.2)),l.addColorStop(1,m(r.accent,0)),e.fillStyle=l,e.fillRect(-210,-270,420,390)}if(T[r.landmark](e,l,r.accent,t.time),o){let l=.65+.22*Math.sin(.0022*t.time);e.strokeStyle=m(r.accent,l),e.lineWidth=2,e.beginPath(),e.ellipse(0,12,116+18*l,20+3*l,0,0,h),e.stroke()}e.restore()}}(e,t,l),function(e,t,l){let r=Math.max(1150,t.width/t.camera.zoom*.65);e.save();for(let a=0;a<34;a+=1){let i=f(19.71*a+4.3*Math.floor(t.camera.x/2200)),o=t.camera.x+(i-.5)*r*2,n=k(o)-35-175*f(8.2*a)+13*Math.sin(9e-4*t.time+1.7*a),s=.2+(Math.sin(.002*t.time+.8*a)+1)*.21;e.fillStyle=a%4==0?l.window:"rgba(190,255,231,0.9)",e.globalAlpha=s,e.shadowColor=e.fillStyle,e.shadowBlur=9,e.beginPath(),e.arc(o,n,1.4+1.8*f(4.2*a),0,h),e.fill()}e.restore()}(e,t,l),function(e,t,l){let r=Math.max(1400,t.width/t.camera.zoom);e.save(),e.fillStyle=l.mist,e.globalAlpha=.42;for(let l=0;l<5;l+=1){let a=(t.time*(.012+.003*l)+480*l)%(2.4*r)-1.2*r,i=t.camera.x+a,o=72+24*l;e.beginPath(),e.ellipse(i,o,280+40*l,26+3*l,0,0,h),e.fill()}e.restore()}(e,t,l),e.restore();let i=e.createLinearGradient(0,.5*t.height,0,t.height);i.addColorStop(0,"rgba(0,0,0,0)"),i.addColorStop(1,t.dark?"rgba(3,8,20,0.28)":"rgba(244,247,255,0.26)"),e.fillStyle=i,e.fillRect(0,.5*t.height,t.width,.5*t.height)}(t,{width:l,height:r,time:n?0:e,dark:_.current,camera:W.current,pointer:n?P:A.current,activeScene:D.current.id,scenes:M}),o=e},B=e=>{if(document.hidden||n){i=0;return}let t=z.current?16:32;e-o>=t&&x(e),i=window.requestAnimationFrame(B)},F=()=>{if(n){W.current=y(D.current),z.current=null,x(performance.now());return}i||document.hidden||(i=window.requestAnimationFrame(B))},q=()=>{S(),F()},G=e=>{g.matches&&(j.current.x=L((e.clientX/l-.5)*2,-1,1),j.current.y=L((e.clientY/r-.5)*2,-1,1))},O=()=>{j.current={...P}},X=()=>{document.hidden?(i&&window.cancelAnimationFrame(i),i=0):F()},H=e=>{n=e.matches,i&&window.cancelAnimationFrame(i),i=0,n&&(W.current=y(D.current),z.current=null,I(!1)),F()};return S(),N.current=F,window.addEventListener("resize",q,{passive:!0}),window.addEventListener("pointermove",G,{passive:!0}),window.addEventListener("blur",O),document.addEventListener("visibilitychange",X),c.addEventListener("change",H),F(),()=>{N.current=null,i&&window.cancelAnimationFrame(i),window.removeEventListener("resize",q),window.removeEventListener("pointermove",G),window.removeEventListener("blur",O),document.removeEventListener("visibilitychange",X),c.removeEventListener("change",H)}},[E]),E)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"living-watershed","aria-hidden":"true","data-living-world":!0,children:[(0,r.jsx)("canvas",{ref:R,className:"living-watershed__canvas"}),(0,r.jsx)("div",{className:"living-watershed__atmosphere"}),(0,r.jsx)("div",{className:"living-watershed__caustics"})]}),(0,r.jsxs)("aside",{className:"living-watershed__location".concat(q?" is-travelling":""),"aria-hidden":"true",children:[(0,r.jsx)("span",{className:"living-watershed__location-orbit","aria-hidden":"true",children:(0,r.jsx)("span",{})}),(0,r.jsxs)("span",{className:"living-watershed__location-copy",children:[(0,r.jsx)("span",{children:B.eyebrow}),(0,r.jsx)("strong",{children:q?"Following the current…":B.label})]},B.id),(0,r.jsx)("span",{className:"living-watershed__experimental",children:"Living Watershed \xb7 Experimental"})]})]}):null}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5967],{10915:(e,t,n)=>{n.d(t,{A:()=>Y});var o=n(95155),r=n(12115),a=n(73288),l=n(84869);let i=(0,a.h)("frontend/services/transcription");async function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{onProgress:n,onStatusChange:o,language:r}=t;try{if(i.debug("Starting transcription service"),o&&o("Initializing transcription..."),!(0,l.G)().supported)throw Error("Web Speech API is not supported in this browser");o&&o("Using browser speech recognition...");let t=await (0,l.S)(e,{language:r,onInterimResult:e=>{o&&o("Transcribing: ".concat(e)),n&&n(50)}});return o&&o("Transcription completed"),i.debug("Web Speech API transcription completed successfully",{textLength:t.length}),{text:t,success:!0,engine:"webspeech"}}catch(e){return i.error("Transcription failed",{error:e}),o&&o("Transcription failed"),{text:"Transcription failed. Please check if your browser supports speech recognition.",success:!1,error:e instanceof Error?e.message:String(e)}}}var d=n(9164),c=n(33567),u=n(2300),p=n(8532),h=n(94049),m=n(25635),g=n(41983),x=n(28548),f=n(78470),y=n(99944),b=n(22822),v=n(2778),j=n(52363),w=n(65036),A=n(4474),C=n(9562),S=n(75912),k=n(91871),I=n(35205),T=n(53612),E=n(3014),R=n(77073),N=n(55930),z=n(9693),M=n(14915),P=n(4823),D=n(76122),O=n(22539),W=n(38700);let _=new Set(["start","process","subflow"]),L=e=>{var t,n;return null!=(n=e.type)?n:null==(t=e.data)?void 0:t.type},F=e=>{let{flow:t,selectedNodeId:n,onSelect:a,onClose:l}=e,i=(0,c.A)(),s=(0,r.useMemo)(()=>((null==t?void 0:t.nodes)||[]).map(e=>{let t=_.has(L(e)||""),o=e.id===n;return{...e,draggable:!1,selectable:!1,style:{...e.style||{},opacity:t?1:.35,cursor:t?"pointer":"default",borderRadius:8,boxShadow:o?"0 0 0 3px ".concat(i.palette.primary.main):void 0,transition:"box-shadow 120ms ease"}}}),[null==t?void 0:t.nodes,n,i.palette.primary.main]),d=(0,r.useMemo)(()=>((null==t?void 0:t.edges)||[]).filter(e=>e.source&&e.target&&e.sourceHandle&&e.targetHandle),[null==t?void 0:t.edges]),u=(0,r.useMemo)(()=>({type:"custom",animated:!1,style:{stroke:i.palette.text.secondary,strokeWidth:2},markerEnd:{type:D.TG.ArrowClosed,width:20,height:20,color:i.palette.text.secondary}}),[i.palette.text.secondary]);return(0,o.jsx)(O.Gc,{nodes:s,edges:d,nodeTypes:W.c_,edgeTypes:W.nd,defaultEdgeOptions:u,connectionLineType:D.Do.SmoothStep,fitView:!0,minZoom:.1,maxZoom:2,onNodeClick:(e,t)=>{_.has(L(t)||"")&&(a(t.id),l())},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,deleteKeyCode:null,proOptions:{hideAttribution:!0},children:(0,o.jsx)(O.VS,{})})},U=e=>{var t,n;let{open:r,flow:a,selectedNodeId:l,allowAutomatic:i,onSelect:s,onClose:d}=e,c=!!(a&&(null!=(n=null==(t=a.nodes)?void 0:t.length)?n:0)>0);return(0,o.jsxs)(v.A,{open:r,onClose:d,maxWidth:"lg",fullWidth:!0,children:[(0,o.jsx)(j.A,{children:"Pick a node to run on"}),(0,o.jsxs)(w.A,{dividers:!0,sx:{p:0},children:[(0,o.jsx)(h.default,{sx:{px:2,pt:1.5},children:(0,o.jsxs)(m.A,{variant:"caption",color:"text.secondary",children:["Click a ",(0,o.jsx)("strong",{children:"Start"}),", ",(0,o.jsx)("strong",{children:"Process"}),", or"," ",(0,o.jsx)("strong",{children:"Subflow"})," node. Other nodes and edges can't be picked."]})}),(0,o.jsx)(h.default,{sx:{height:"62vh",width:"100%"},children:c?(0,o.jsx)(O.Ln,{children:(0,o.jsx)(F,{flow:a,selectedNodeId:l,onSelect:s,onClose:d})}):(0,o.jsx)(h.default,{sx:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(m.A,{variant:"body2",color:"text.secondary",children:"No agent to display."})})})]}),(0,o.jsxs)(S.A,{children:[i&&(0,o.jsx)(k.A,{startIcon:(0,o.jsx)(P.A,{}),onClick:()=>{s(null),d()},children:"Automatic"}),(0,o.jsx)(h.default,{sx:{flex:1}}),(0,o.jsx)(k.A,{onClick:d,children:"Cancel"})]})]})};var H=n(74879),J=n(11433),X=n(17897),G=n(90880);let B=(0,a.h)("frontend/components/Chat/ChatInput"),Y=e=>{var t,n;let{onSendMessage:a,disabled:l=!1,placeholder:i="Type a message...",requireApproval:P=!1,onRequireApprovalChange:D,executeInDebugger:O=!1,onExecuteInDebuggerChange:W,availableNodes:_=[],flow:L=null,currentNodeId:F=null,nodeOverrideActive:Y=!1,onSelectNode:q,editing:V=null,onEditingContentChange:K,onEditingNodeChange:Z,onSaveEdit:$,onCancelEdit:Q}=e,ee=(0,c.A)(),{settings:et,globalEnvVars:en}=(0,d.useStorage)(),eo=(0,r.useMemo)(()=>Object.entries(en).filter(e=>{var t;let[,n]=e;return!(null==(t=n.metadata)?void 0:t.isSecret)}).map(e=>{let[t]=e;return t}).sort((e,t)=>e.localeCompare(t)),[en]),[er,ea]=(0,r.useState)(""),[el,ei]=(0,r.useState)([]),[es,ed]=(0,r.useState)(!1),[ec,eu]=(0,r.useState)(0),[ep,eh]=(0,r.useState)(null),em=(0,r.useRef)(null),eg=(0,r.useRef)(null),ex=(0,r.useRef)([]),[ef,ey]=(0,r.useState)(!1),eb=!!V,ev=eb?null!=(t=null==V?void 0:V.nodeId)?t:null:F,ej=(e=>{var t;return(null==(t=_.find(t=>t.id===e))?void 0:t.label)||(e?"".concat(e.substring(0,6),"..."):"Start")})(ev),[ew,eA]=(0,r.useState)([]);(0,r.useEffect)(()=>{var e,t,n;let o=!1;if(!L)return eA([]),()=>{o=!0};let r=L.nodes.find(e=>{var t,n;return(null!=(n=null==(t=e.data)?void 0:t.type)?n:e.type)==="start"}),a=r?null==(e=L.edges.find(e=>{var t;return e.source===r.id&&(null==(t=e.data)?void 0:t.edgeType)!=="mcp"}))?void 0:e.target:void 0,l=null!=(n=null!=ev?ev:a)?n:null==(t=L.nodes.find(e=>{var t,n;return(null!=(n=null==(t=e.data)?void 0:t.type)?n:e.type)==="process"}))?void 0:t.id;if(!l)return eA([]),()=>{o=!0};let i=new Set(L.edges.filter(e=>{var t;return(null==(t=e.data)?void 0:t.edgeType)==="mcp"&&(e.source===l||e.target===l)}).map(e=>e.source===l?e.target:e.source)),s=L.nodes.filter(e=>{var t,n;return(null!=(n=null==(t=e.data)?void 0:t.type)?n:e.type)==="mcp"&&i.has(e.id)}).map(e=>{var t,n,o,r;return{server:null==(t=e.data.properties)?void 0:t.boundServer,enabledTools:new Set(null!=(r=null==(n=e.data.properties)?void 0:n.enabledTools)?r:[]),enabledResources:null==(o=e.data.properties)?void 0:o.enabledResources}}).filter(e=>!!e.server);return 0===s.length?(eA([]),()=>{o=!0}):(Promise.all(s.map(async e=>{var t,n,o;let{server:r,enabledTools:a,enabledResources:l}=e,i=[];try{for(let e of null!=(t=(await X.S.listServerTools(r)).tools)?t:[])(null==e?void 0:e.name)&&a.has(e.name)&&i.push((0,G.Ub)({kind:"tool",server:r,name:e.name},e.name,e.description||r))}catch(e){B.warn("Failed to load chat @ tool suggestions for ".concat(r),e)}try{let e=await X.S.listServerResources(r),t=e=>void 0===l||"all"===l||l.includes(e);for(let o of null!=(n=e.resources)?n:[])t(o.uri)&&i.push((0,G.Ub)({kind:"resource",server:r,name:o.uri},o.name||o.uri,o.description||"".concat(r," \xb7 ").concat(o.uri)));for(let n of null!=(o=e.resourceTemplates)?o:[])t(n.uriTemplate)&&i.push((0,G.Ub)({kind:"resource",server:r,name:n.uriTemplate},n.name||n.uriTemplate,n.description||"".concat(r," \xb7 ").concat(n.uriTemplate)))}catch(e){B.warn("Failed to load chat @ resource suggestions for ".concat(r),e)}return i})).then(e=>{o||eA(e.flat())}),()=>{o=!0})},[L,ev]);let[eC,eS]=(0,r.useState)(!1),[ek,eI]=(0,r.useState)(""),[eT,eE]=(0,r.useState)(""),[eR,eN]=(0,r.useState)("document"),[ez,eM]=(0,r.useState)(null),[eP,eD]=(0,r.useState)(),[eO,eW]=(0,r.useState)(!1),[e_,eL]=(0,r.useState)(0),[eF,eU]=(0,r.useState)(""),eH=()=>{V&&V.content.trim()&&(null==$||$())},eJ=()=>{(er.trim()||el.length>0)&&(B.debug("Sending message",{messageLength:er.length,attachmentsCount:el.length}),a(er,el),ea(""),ei([]))},eX=async e=>{let t=e.target.files;if(!t||0===t.length)return;let n=t[0];B.debug("File selected",{fileName:n.name,fileSize:n.size,fileType:n.type});try{let e=n.type||"application/octet-stream";if(e.startsWith("text/")||/\.(txt|md|json|csv|html?|xml|js|ts|jsx|tsx|css|scss)$/i.test(n.name)){eE("Processing ".concat(n.name)),eN("document"),eI(""),eW(!0),eS(!0);let e=await eG(n);B.debug("File read successfully",{contentLength:e.length}),eI(e),eW(!1)}else{let t=await eB(n),o=e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document";ei(r=>[...r,{id:(0,H.A)(),type:o,content:t,originalName:n.name,mimeType:e}])}}catch(e){B.error("Error reading file:",e),eI("Error reading file. Please try again."),eW(!1)}em.current&&(em.current.value="")},eG=e=>new Promise((t,n)=>{let o=new FileReader;o.onload=e=>{var o;(null==(o=e.target)?void 0:o.result)?t(e.target.result):n(Error("Failed to read file"))},o.onerror=()=>{n(Error("Error reading file"))},o.readAsText(e)}),eB=e=>new Promise((t,n)=>{let o=new FileReader;o.onload=()=>"string"==typeof o.result?t(o.result):n(Error("Failed to encode file")),o.onerror=()=>n(Error("Error reading file")),o.readAsDataURL(e)}),eY=async()=>{B.debug("Starting audio recording");try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});B.debug("Audio stream obtained successfully"),ex.current=[];let t=new MediaRecorder(e);eg.current=t,t.ondataavailable=e=>{e.data.size>0&&ex.current.push(e.data)},t.onstop=async()=>{var n;let o=t.mimeType||(null==(n=ex.current[0])?void 0:n.type)||"audio/webm",r=new Blob(ex.current,{type:o});eE("Audio Recording"),eN("audio"),eM(await eB(r)),eD(o),eI(""),eW(!0),eS(!0);try{if(((null==et?void 0:et.speech)||{enabled:!0,modelSize:"base",autoDownload:!1}).enabled){eU("Initializing transcription..."),eL(0);let e=await s(r,{onProgress:eL,onStatusChange:eU,language:navigator.language});if(e.success){let t=e.text;eI(t),B.debug("Transcription successful",{textLength:e.text.length,engine:e.engine})}else eI("Error transcribing audio: ".concat(e.error,".")),B.error("Transcription failed",{error:e.error})}else eI("Speech recognition is disabled in settings. Enable it to get automatic transcriptions.")}catch(e){B.error("Error handling audio recording",{error:e}),eI("Failed to process audio: ".concat(e))}finally{eW(!1),e.getTracks().forEach(e=>e.stop())}},t.start(),ed(!0);let n=setInterval(()=>{eu(e=>e+1)},1e3);eh(n)}catch(e){B.error("Error starting recording:",e),alert("Could not access microphone. Please check permissions.")}};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(u.A,{elevation:0,sx:{width:"100%",maxWidth:"none",mx:0,p:{xs:1,sm:1.25},display:"flex",flexDirection:"column",border:"1px solid ".concat((0,p.X4)(ee.palette.primary.main,.24)),borderRadius:0,bgcolor:(0,p.X4)(ee.palette.background.paper,"dark"===ee.palette.mode?.82:.92),boxShadow:"0 22px 70px ".concat((0,p.X4)(ee.palette.common.black,"dark"===ee.palette.mode?.34:.12),", 0 0 0 1px ").concat((0,p.X4)(ee.palette.common.white,.03)," inset"),backdropFilter:"blur(24px) saturate(145%)"},children:[el.length>0&&(0,o.jsx)(h.default,{sx:{mb:2,display:"flex",flexWrap:"wrap",gap:1},children:el.map(e=>(0,o.jsxs)(u.A,{variant:"outlined",sx:{p:1,display:"flex",alignItems:"center",borderRadius:1,bgcolor:"background.default"},children:["image"===e.type?(0,o.jsx)(h.default,{component:"img",src:e.content,alt:e.originalName||"pasted image",sx:{width:40,height:40,objectFit:"cover",borderRadius:1,mr:1}}):"video"===e.type?(0,o.jsx)(h.default,{component:"video",src:e.content,sx:{width:40,height:40,objectFit:"cover",borderRadius:1,mr:1}}):"document"===e.type?(0,o.jsx)(T.A,{fontSize:"small",sx:{mr:1}}):(0,o.jsx)(E.A,{fontSize:"small",sx:{mr:1}}),(0,o.jsx)(m.A,{variant:"body2",noWrap:!0,sx:{maxWidth:150},children:e.originalName||"".concat(e.type," attachment")}),(0,o.jsx)(g.A,{size:"small",onClick:()=>(e=>{B.debug("Removing attachment",{id:e}),ei(el.filter(t=>t.id!==e))})(e.id),sx:{ml:1},children:(0,o.jsx)(R.A,{fontSize:"small"})})]},e.id))}),eb&&(0,o.jsxs)(h.default,{sx:{mb:1,display:"flex",alignItems:"center",gap:1},children:[(0,o.jsx)(x.A,{icon:(0,o.jsx)(M.A,{}),label:"Editing message",size:"small",color:"warning",variant:"outlined"}),(0,o.jsx)(m.A,{variant:"caption",color:"text.secondary",children:"Enter to save \xb7 Esc to cancel"})]}),(0,o.jsxs)(h.default,{sx:{display:"flex",alignItems:"flex-end",gap:.35},children:[(0,o.jsx)(J.Ay,{value:eb?null!=(n=null==V?void 0:V.content)?n:"":er,onChange:e=>{eb?null==K||K(e):ea(e)},globalNames:eo,suggestions:ew,multiline:!0,minRows:1,maxRows:eb?12:4,dataTour:"chat-input",ariaLabel:eb?"Edit message":"Message",placeholder:eb?"Edit message...":i,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&eb&&(e.preventDefault(),null==Q||Q()):(e.preventDefault(),eb?eH():(B.debug("Enter key pressed, sending message"),eJ()))},onPaste:e=>{var t;let n=null==(t=e.clipboardData)?void 0:t.items;if(!n)return;let o=[];for(let e=0;e<n.length;e++){let t=n[e];if("file"===t.kind&&t.type.startsWith("image/")){let e=t.getAsFile();e&&o.push(e)}}0!==o.length&&(e.preventDefault(),B.debug("Pasting image attachment(s)",{count:o.length}),o.forEach(e=>{let t=new FileReader;t.onload=t=>{var n;let o=null==(n=t.target)?void 0:n.result;if("string"!=typeof o)return;let r=(e.type.split("/")[1]||"png").split("+")[0];ei(t=>[...t,{id:(0,H.A)(),type:"image",content:o,originalName:e.name&&!/^image\.\w+$/i.test(e.name)?e.name:"Pasted image.".concat(r)}])},t.onerror=()=>B.error("Failed to read pasted image"),t.readAsDataURL(e)}))},disabled:!eb&&l,autoFocus:eb,containerSx:{flex:1}}),!eb&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(f.A,{title:"Attach document",children:(0,o.jsx)(g.A,{color:"primary",onClick:()=>{var e;B.debug("File selection triggered"),null==(e=em.current)||e.click()},disabled:l||es,children:(0,o.jsx)(T.A,{})})}),(0,o.jsx)("input",{type:"file",ref:em,onChange:eX,style:{display:"none"},accept:"image/*,audio/*,video/*,.pdf,.txt,.md,.json,.csv,.html,.xml,.js,.ts,.jsx,.tsx,.css,.scss"}),(0,o.jsx)(f.A,{title:es?"Stop recording":"Record audio",children:(0,o.jsxs)(g.A,{color:es?"error":"primary",onClick:es?()=>{B.debug("Stopping audio recording"),eg.current&&"inactive"!==eg.current.state&&(eg.current.stop(),ed(!1),ep&&(clearInterval(ep),eh(null)),eu(0))}:eY,disabled:l,children:[(0,o.jsx)(E.A,{}),es&&(0,o.jsx)(m.A,{variant:"caption",sx:{position:"absolute",bottom:-15,fontSize:"0.7rem",color:"error.main"},children:(e=>{let t=Math.floor(e/60);return"".concat(t.toString().padStart(2,"0"),":").concat((e%60).toString().padStart(2,"0"))})(ec)})]})})]}),eb?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(f.A,{title:"Save edit",children:(0,o.jsx)("span",{children:(0,o.jsx)(g.A,{color:"primary","aria-label":"Save edit",onClick:eH,disabled:!(null==V?void 0:V.content.trim()),children:(0,o.jsx)(z.A,{})})})}),(0,o.jsx)(f.A,{title:"Cancel edit",children:(0,o.jsx)(g.A,{color:"default","aria-label":"Cancel edit",onClick:()=>null==Q?void 0:Q(),children:(0,o.jsx)(R.A,{})})})]}):(0,o.jsx)(f.A,{title:"Send message",children:(0,o.jsx)("span",{children:(0,o.jsx)(g.A,{color:"primary",onClick:eJ,disabled:l||!er.trim()&&0===el.length,"aria-label":"Send message",sx:{width:44,height:44,color:"#fff",background:"linear-gradient(135deg, ".concat(ee.palette.primary.light,", ").concat(ee.palette.primary.main," 58%, ").concat(ee.palette.secondary.main,")"),boxShadow:"0 10px 24px ".concat((0,p.X4)(ee.palette.primary.main,.28)),"&:hover":{background:"linear-gradient(135deg, ".concat(ee.palette.primary.light,", ").concat(ee.palette.primary.main," 48%, ").concat(ee.palette.secondary.main,")"),boxShadow:"0 14px 30px ".concat((0,p.X4)(ee.palette.primary.main,.38))},"&.Mui-disabled":{color:"text.disabled",background:(0,p.X4)(ee.palette.text.disabled,.12),boxShadow:"none"}},children:(0,o.jsx)(I.A,{})})})})]})," ",(D||(q||eb)&&_.length>0)&&(0,o.jsxs)(h.default,{sx:{mt:1,pt:1,display:"flex",justifyContent:"flex-start",alignItems:"center",flexWrap:"wrap",gap:1,borderTop:1,borderColor:"divider"},children:[(q||eb)&&_.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(f.A,{title:eb?"Node this message runs on — click to pick from the agent":Y?"Next message will run on this manually picked node — click to change":"Node the next message will run on — click to pick from the agent",children:(0,o.jsx)(x.A,{icon:(0,o.jsx)(N.A,{}),label:ej,size:"small",color:eb||Y?"primary":"default",variant:eb||Y?"filled":"outlined",onClick:()=>ey(!0),disabled:!eb&&l})}),(0,o.jsx)(U,{open:ef,flow:L,selectedNodeId:ev,allowAutomatic:!eb,onSelect:e=>{eb?null==Z||Z(e):null==q||q(e)},onClose:()=>ey(!1)})]}),D&&(0,o.jsx)(y.A,{control:(0,o.jsx)(b.A,{checked:P,onChange:e=>D(e.target.checked),size:"small",disabled:l}),label:(0,o.jsx)(m.A,{variant:"caption",children:"Require Tool Approvals"}),sx:{mr:"auto"}}),W&&(0,o.jsx)(y.A,{control:(0,o.jsx)(b.A,{checked:O,onChange:e=>W(e.target.checked),size:"small",disabled:l}),label:(0,o.jsx)(m.A,{variant:"caption",children:"Execute in Debugger"}),sx:{ml:2}})]})," "]})," ",(0,o.jsxs)(v.A,{open:eC,onClose:()=>!eO&&eS(!1),maxWidth:"md",fullWidth:!0,children:[(0,o.jsxs)(j.A,{children:[eT,!eO&&(0,o.jsx)(g.A,{"aria-label":"close",onClick:()=>eS(!1),sx:{position:"absolute",right:8,top:8},children:(0,o.jsx)(R.A,{})})]}),(0,o.jsx)(w.A,{dividers:!0,children:eO?(0,o.jsxs)(h.default,{sx:{display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",p:4},children:[(0,o.jsx)(A.default,{value:"audio"===eR&&e_?e_:void 0,variant:"audio"===eR&&e_>0?"determinate":"indeterminate"}),"audio"===eR&&(0,o.jsxs)(h.default,{sx:{mt:2,textAlign:"center"},children:[(0,o.jsx)(m.A,{variant:"body2",children:eF||"Processing audio..."}),e_>0&&(0,o.jsxs)(m.A,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[Math.round(e_),"%"]})]})]}):(0,o.jsx)(C.A,{multiline:!0,fullWidth:!0,minRows:10,maxRows:20,value:ek,onChange:e=>eI(e.target.value),variant:"outlined",placeholder:"document"===eR?"Document content":"Audio transcription"})}),(0,o.jsxs)(S.A,{children:[(0,o.jsx)(k.A,{onClick:()=>eS(!1),disabled:eO,children:"Cancel"}),(0,o.jsx)(k.A,{onClick:()=>{B.debug("Adding attachment",{type:eR,titleLength:eT.length}),ei([...el,{id:(0,H.A)(),type:eR,content:"audio"===eR&&ez?ez:ek,originalName:eT,..."audio"===eR&&eP?{mimeType:eP,transcript:ek}:{}}]),eM(null),eD(void 0),eS(!1)},variant:"contained",disabled:eO||!ek.trim(),children:"Add to Message"})]})]})]})}},18037:(e,t,n)=>{n.d(t,{MG:()=>r,Ud:()=>a});var o=n(76122);o.TG.ArrowClosed;let r={type:"resourceEdge",animated:!1,style:{stroke:"#009688",strokeWidth:2},markerEnd:{type:o.TG.ArrowClosed,width:20,height:20,color:"#009688"}},a={type:"mcpEdge",animated:!1,style:{stroke:"#1976d2",strokeWidth:2},markerEnd:{type:o.TG.ArrowClosed,width:20,height:20,color:"#1976d2"},markerStart:{type:o.TG.ArrowClosed,width:20,height:20,color:"#1976d2"}}},18466:(e,t,n)=>{n.d(t,{E9:()=>a,RN:()=>r,n9:()=>o});let o="handoff_to_";function r(e,t){let n=(e&&e.trim()||t&&t.trim()||"node").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/_+/g,"_").replace(/^_+|_+$/g,"");return n.length>48&&(n=n.slice(0,48).replace(/_+$/g,"")),n||(n=t&&t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_")||"node"),n||"node"}function a(e){let t=new Set,n=new Map;for(let a of e){if(n.has(a.id))continue;let e=r(a.label,a.type),l="".concat(o).concat(e);if(t.has(l)){let n=2;for(;t.has("".concat(o).concat(e,"_").concat(n));)n++;l="".concat(o).concat(e,"_").concat(n)}t.add(l),n.set(a.id,l)}return n}},19875:(e,t,n)=>{n.d(t,{C:()=>a,L2:()=>r,P2:()=>i,w4:()=>o,wM:()=>l});let o=["contains","regex","equals","always"],r=["last-assistant","last-message"];function a(e){return"string"==typeof e&&o.includes(e)}function l(e){try{return new RegExp(e),!0}catch(e){return!1}}function i(e){if(!e||!a(e.kind))return"";let t=e.negate?"!":"";if("always"===e.kind)return"".concat(t,"always");let n=e.ignoreCase?" i":"",o="string"==typeof e.value?e.value:"",r=o.length>8?"".concat(o.slice(0,8),"…"):o,l="regex"===e.kind?"/".concat(r,"/"):'"'.concat(r,'"');return"".concat(t).concat(e.kind,":").concat(l).concat(n)}},38700:(e,t,n)=>{n.d(t,{Ay:()=>$,nd:()=>q,c_:()=>Y});var o=n(95155),r=n(12115),a=n(26281),l=n(8279),i=n(2300),s=n(25635),d=n(9562),c=n(56422),u=n(94049),p=n(15712),h=n(22539),m=n(76122),g=n(33567),x=n(8532),f=n(48116),y=n(74879),b=n(90057),v=n(93632),j=n(41603),w=n(86973),A=n(49501),C=n(17681),S=n(21067),k=n(36314),I=n(4484),T=n(52277),E=n(78095),R=n(14915),N=n(74110),z=n(55930);let M=e=>{let{open:t,position:n,onClose:r,onDelete:a,onEditProperties:l,onConvertToSubflow:i,onToggleBidirectional:s,onCopy:d,onPaste:c,canPaste:u,canCopy:p,nodeId:h,selection:m,edgeId:g}=e,x=()=>{l&&l(),r()},f=[];return h&&!m&&(f.push((0,o.jsxs)(w.A,{onClick:x,children:[(0,o.jsx)(A.A,{children:(0,o.jsx)(R.A,{fontSize:"small"})}),(0,o.jsx)(C.A,{children:"Edit Properties"})]},"edit")),i&&f.push((0,o.jsxs)(w.A,{onClick:()=>{i&&i(),r()},children:[(0,o.jsx)(A.A,{children:(0,o.jsx)(z.A,{fontSize:"small"})}),(0,o.jsx)(C.A,{children:"Convert to subflow"})]},"convert-to-subflow"))),g&&!h&&!m&&(l&&f.push((0,o.jsxs)(w.A,{onClick:x,children:[(0,o.jsx)(A.A,{children:(0,o.jsx)(R.A,{fontSize:"small"})}),(0,o.jsx)(C.A,{children:"Edit Properties"})]},"edge-edit")),s&&f.push((0,o.jsxs)(w.A,{onClick:()=>{s&&s(),r()},children:[(0,o.jsx)(A.A,{children:(0,o.jsx)(N.A,{fontSize:"small"})}),(0,o.jsx)(C.A,{children:"Toggle Bidirectional"})]},"edge-bidirectional"))),d&&(h||m)&&f.push((0,o.jsxs)(w.A,{onClick:()=>{d&&d(),r()},disabled:!p,children:[(0,o.jsx)(A.A,{children:(0,o.jsx)(T.A,{fontSize:"small"})}),(0,o.jsx)(C.A,{children:"Copy"})]},"copy")),c&&f.push((0,o.jsxs)(w.A,{onClick:()=>{c&&c(),r()},disabled:!u,children:[(0,o.jsx)(A.A,{children:(0,o.jsx)(E.A,{fontSize:"small"})}),(0,o.jsx)(C.A,{children:"Paste"})]},"paste")),(h||g||m)&&f.push((0,o.jsx)(S.A,{},"delete-divider"),(0,o.jsxs)(w.A,{onClick:()=>{a(),r()},sx:{color:"error.main"},children:[(0,o.jsx)(A.A,{sx:{color:"error.main"},children:(0,o.jsx)(I.A,{fontSize:"small"})}),(0,o.jsx)(C.A,{children:"Delete"})]},"delete")),(0,o.jsx)(k.A,{open:t,onClose:r,anchorReference:"anchorPosition",anchorPosition:null!==n.y&&null!==n.x?{top:n.y,left:n.x}:void 0,children:f})};var P=n(53911),D=n(71738);function O(e,t){return t.find(t=>t.id===e)}var W=n(73288);let _=(0,W.h)("components/flow/FlowBuilder/Canvas/hooks/useCanvasEvents.ts");var L=n(93764),F=n(57563);let U=e=>{let{showMiniMap:t=!0,showControls:n=!0,showBackground:r=!0}=e,a=(0,g.A)(),l="dark"===a.palette.mode;return(0,o.jsxs)(o.Fragment,{children:[r&&(0,o.jsx)(h.VS,{color:l?a.palette.text.disabled:a.palette.divider,gap:20,size:1}),n&&(0,o.jsx)(h.H2,{}),t&&(0,o.jsx)(h.of,{nodeColor:l?a.palette.primary.dark:a.palette.primary.light,maskColor:l?"rgba(0, 0, 0, 0.4)":"rgba(255, 255, 255, 0.6)"})]})};var H=n(98008);let J=(0,W.h)("components/flow/FlowBuilder/Canvas/Canvas.tsx"),X="flujo:flowClipboard",G=null;function B(e){G=e;try{localStorage.setItem(X,JSON.stringify(e))}catch(e){J.warn("Could not persist flow clipboard to localStorage",e)}}let Y={start:j.vm,process:j.Uw,finish:j.IK,mcp:j.v2,subflow:j.lA,resource:j.z9,signal:j.z3,trigger:j.pF},q={custom:P.jY,mcpEdge:P.oY,resourceEdge:P.sZ},V=e=>{let{open:t,position:n,anchorPosition:p,onClose:h,onSelectNodeType:m,sourceNodeType:f,sourceHandleId:y}=e,b=(0,g.A)(),[v,w]=(0,r.useState)("");(0,r.useEffect)(()=>{t&&w("")},[t]);let A=(0,F._w)(f,y);J.debug("NodeSelectionModal: Source node type: ".concat(f,", Source handle ID: ").concat(y)),J.debug("NodeSelectionModal: Valid node types: ".concat(A.join(", ")));let C=[{type:"process",label:"Process Node",description:"Let a LLM do your work"},{type:"finish",label:"Finish Node",description:"End your flow here"},{type:"mcp",label:"MCP Node",description:"Add functionality"},{type:"subflow",label:"Subflow Node",description:"Run another flow"},{type:"resource",label:"Resource Node",description:"A data artifact steps read or write"},{type:"signal",label:"Signal Node",description:"Emit an event to trigger another flow"},{type:"trigger",label:"Trigger Node",description:"Schedule or event-trigger for this flow"}].filter(e=>A.includes(e.type)).filter(e=>{let t=v.trim().toLowerCase();return!t||"".concat(e.label," ").concat(e.description).toLowerCase().includes(t)});return t&&n?(0,o.jsx)(a.A,{children:(0,o.jsx)(l.x,{onClickAway:h,children:(0,o.jsxs)(i.A,{role:"dialog","aria-modal":"false","aria-labelledby":"node-selection-title",elevation:16,onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),h())},sx:{position:"fixed",top:{xs:"auto",sm:p?"clamp(12px, ".concat(p.y+10,"px, calc(100dvh - 460px))"):"50%"},bottom:{xs:12,sm:"auto"},left:{xs:12,sm:p?"clamp(12px, ".concat(p.x+10,"px, calc(100vw - 392px))"):"50%"},right:{xs:12,sm:"auto"},transform:{xs:"none",sm:p?"none":"translate(-50%, -50%)"},zIndex:e=>e.zIndex.modal+1,width:{xs:"auto",sm:380},maxHeight:"min(70dvh, 520px)",overflow:"hidden",border:1,borderColor:"divider",borderRadius:3.5,bgcolor:"background.paper",boxShadow:"dark"===b.palette.mode?"0 28px 80px rgba(0,0,0,.55)":"0 28px 80px rgba(31,27,74,.22)",p:1.5},children:[(0,o.jsx)(s.A,{id:"node-selection-title",variant:"subtitle1",fontWeight:800,children:"Add the next step"}),(0,o.jsx)(s.A,{variant:"caption",color:"text.secondary",children:"It will be connected and selected automatically."}),(0,o.jsx)(d.A,{autoFocus:!0,fullWidth:!0,size:"small",value:v,onChange:e=>w(e.target.value),placeholder:"Search legal node types",inputProps:{"aria-label":"Search legal node types"},sx:{my:1.25},InputProps:{startAdornment:(0,o.jsx)(c.A,{position:"start",children:(0,o.jsx)(H.A,{fontSize:"small"})})}}),(0,o.jsxs)(u.default,{display:"flex",flexDirection:"column",gap:.75,sx:{overflowY:"auto",maxHeight:360},children:[C.map(e=>(0,o.jsx)(i.A,{component:"button",type:"button",onClick:()=>m(e.type,n),sx:{appearance:"none",width:"100%",p:1.1,textAlign:"left",color:"text.primary",bgcolor:"transparent",borderRadius:2.5,border:1,borderColor:"divider",cursor:"pointer",transition:"border-color 160ms ease, background-color 160ms ease, transform 160ms ease","&:hover, &:focus-visible":{outline:"none",borderColor:"finish"===e.type?b.palette.success.main:"subflow"===e.type?b.palette.warning.main:"resource"===e.type?j.nH:b.palette.primary.main,bgcolor:(0,x.X4)(b.palette.primary.main,.06),transform:"translateX(2px)"}},children:(0,o.jsxs)(u.default,{display:"flex",alignItems:"center",gap:1.25,children:[(e=>{switch(e){case"process":default:return(0,o.jsx)("div",{style:{width:24,height:24,backgroundColor:b.palette.primary.main,borderRadius:"50%"}});case"finish":return(0,o.jsx)("div",{style:{width:24,height:24,backgroundColor:b.palette.success.main,borderRadius:"50%"}});case"mcp":return(0,o.jsx)("div",{style:{width:24,height:24,backgroundColor:b.palette.info.main,borderRadius:"50%"}});case"subflow":return(0,o.jsx)("div",{style:{width:24,height:24,backgroundColor:b.palette.warning.main,borderRadius:"50%"}});case"resource":return(0,o.jsx)("div",{style:{width:24,height:24,backgroundColor:j.nH,borderRadius:"50%"}});case"signal":return(0,o.jsx)("div",{style:{width:24,height:24,backgroundColor:j.vp,borderRadius:"50%"}});case"trigger":return(0,o.jsx)("div",{style:{width:24,height:24,backgroundColor:j.$Q,borderRadius:"50%"}})}})(e.type),(0,o.jsxs)(u.default,{children:[(0,o.jsx)(s.A,{variant:"subtitle2",fontWeight:800,children:e.label}),(0,o.jsx)(s.A,{variant:"caption",color:"text.secondary",children:e.description})]})]})},e.type)),0===C.length&&(0,o.jsx)(s.A,{variant:"body2",color:"text.secondary",sx:{p:1},children:"No matching node types are valid for this connection."})]})]})})}):null},K=(0,f.Ay)("div")(e=>{let{theme:t}=e;return{flex:"1 1 0",height:"100%",minHeight:0,width:"100%",border:"1px solid ".concat(t.palette.divider),borderRadius:"18px",overflow:"hidden",backgroundColor:t.palette.background.paper,backgroundImage:"\n linear-gradient(".concat(t.palette.divider," 1px, transparent 1px),\n linear-gradient(90deg, ").concat(t.palette.divider," 1px, transparent 1px),\n radial-gradient(circle at 22% 0%, ").concat((0,x.X4)(t.palette.primary.main,.1),", transparent 38%)\n "),backgroundSize:"28px 28px, 28px 28px, auto",boxShadow:"dark"===t.palette.mode?"inset 0 1px 0 rgba(255,255,255,.035), 0 22px 65px rgba(0,0,0,.24)":"inset 0 1px 0 rgba(255,255,255,.7), 0 22px 65px rgba(53,48,105,.1)",position:"relative",[t.breakpoints.down("sm")]:{flex:"none",height:440,minHeight:440,maxWidth:"100%"}}}),Z=(0,r.forwardRef)((e,t)=>{var n;let a=(0,g.A)(),l=(0,p.A)(a.breakpoints.down("sm"),{noSsr:!0}),{nodes:i,edges:s,onNodesChange:d,onEdgesChange:c,onDrop:u,onDragOver:x,onInit:f,reactFlowWrapper:j,onEditNode:w,onCreateNode:A,onSelectNode:C,onConvertProcessToSubflow:S,onEditEdge:k}=e,{contextMenu:I,selectedElements:T,closeContextMenu:E,handleDelete:R,onNodeContextMenu:N,onEdgeContextMenu:z,onPaneContextMenu:P,onSelectionContextMenu:W}=function(e){let{deleteElements:t}=(0,h.VH)(),[n,o]=(0,r.useState)({open:!1,position:{x:0,y:0}}),[a,l]=(0,r.useState)({nodes:[],edges:[]});(0,h.p4)({onChange:e=>{let{nodes:t,edges:n}=e,o=t.map(e=>e.id),r=n.map(e=>e.id);_.debug("Selection changed: ".concat(o.length," nodes, ").concat(r.length," edges selected")),l({nodes:o,edges:r})}});let i=(0,r.useCallback)((e,t,n,r)=>{e.preventDefault(),t?_.debug("Context menu opened for node: ".concat(t)):n?_.debug("Context menu opened for edge: ".concat(n)):r?_.debug("Context menu opened for the current selection"):_.debug("Context menu opened on canvas at (".concat(e.clientX,", ").concat(e.clientY,")")),o({open:!0,position:{x:e.clientX,y:e.clientY},nodeId:t,edgeId:n,selection:r})},[]),s=(0,r.useCallback)(()=>{_.debug("Context menu closed"),o(e=>({...e,open:!1}))},[]),d=(0,r.useCallback)(()=>{if(n.selection)_.debug("handleDelete: Deleting the current selection"),t({nodes:a.nodes.map(e=>({id:e})),edges:a.edges.map(e=>({id:e}))});else if(n.nodeId){if(_.debug("handleDelete: Attempting to delete node ".concat(n.nodeId)),!function(e,t){let n=O(e,t);return!!n&&"start"!==n.type}(n.nodeId,e)){_.warn("Cannot delete Start node: ".concat(n.nodeId)),alert("Start nodes cannot be deleted");return}t({nodes:[{id:n.nodeId}]})}else n.edgeId&&(_.debug("handleDelete: Deleting edge ".concat(n.edgeId)),t({edges:[{id:n.edgeId}]}))},[n,t,e,a]),c=(0,r.useCallback)((e,t)=>{i(e,t.id)},[i]),u=(0,r.useCallback)((e,t)=>{i(e,void 0,t.id)},[i]),p=(0,r.useCallback)(e=>{i(e)},[i]),m=(0,r.useCallback)(e=>{i(e,void 0,void 0,!0)},[i]);return{contextMenu:n,selectedElements:a,onContextMenu:i,closeContextMenu:s,handleDelete:d,onNodeContextMenu:c,onEdgeContextMenu:u,onPaneContextMenu:p,onSelectionContextMenu:m}}(i),{deleteElements:H}=(0,h.VH)(),Z=(0,h.PI)(),$=(0,r.useRef)(null),[Q,ee]=(0,r.useState)(null),[et,en]=(0,r.useState)({open:!1,position:null}),eo=(0,r.useCallback)(e=>[...i.filter(e=>e.selected).map(e=>({type:"select",id:e.id,selected:!1})),{type:"add",item:{...e,selected:!0}}],[i]);(0,r.useEffect)(()=>{if(!w)return;let e=e=>{if(e.detail&&e.detail.nodeId){let t=O(e.detail.nodeId,i);t&&w(t)}};return document.addEventListener("editNode",e),()=>{document.removeEventListener("editNode",e)}},[i,w]),(0,r.useEffect)(()=>{let e=e=>{var t;let n=null==(t=e.detail)?void 0:t.nodeId;if(!n)return;let o=O(n,i);o&&(d([...i.filter(e=>e.selected&&e.id!==n).map(e=>({type:"select",id:e.id,selected:!1})),{type:"select",id:n,selected:!0}]),null==C||C(o))};return document.addEventListener("selectNode",e),()=>document.removeEventListener("selectNode",e)},[i,d,C]);let er=(0,r.useCallback)(e=>{var t,n;if(!e.sourceHandle||!e.targetHandle)return void J.error("Invalid connection: Missing source or target handle",e);let o=(null==(t=Z.getState().connection.fromHandle)?void 0:t.type)==="target";if(!(0,L.JL)(e,i,s))return;let r=(0,L.wn)(e,i);if((null==(n=r.data)?void 0:n.edgeType)==="standard"){let t=e=>{var t;return(null==(t=e.data)?void 0:t.edgeType)!=="mcp"},n=e=>{var t;return!!(null==(t=e.data)?void 0:t.bidirectional)},r=s.find(n=>t(n)&&n.source===e.source&&n.target===e.target),l=s.find(n=>t(n)&&n.source===e.target&&n.target===e.source),d=e=>{J.info("Merging reverse connection into bidirectional edge ".concat(e.id)),c([{type:"replace",id:e.id,item:{...e,data:{...e.data,bidirectional:!0},markerStart:{type:m.TG.ArrowClosed,width:20,height:20,color:a.palette.text.secondary}}}])};if(o){let e=null!=r?r:l;return e?void(!n(e)&&(0,L.y2)(e,i,s)&&d(e)):void J.info("Connection drawn from a top handle is only allowed to convert an existing edge to bidirectional")}if(r&&n(r))return;if(l){!n(l)&&(0,L.y2)(l,i,s)&&d(l);return}}c([...(0,L.Cm)(r,s).map(e=>({type:"remove",id:e})),{type:"add",item:r}])},[i,s,c,Z,a.palette.text.secondary]),ea=(0,r.useCallback)(e=>(0,L.p9)(e,i,s),[i,s]);(0,r.useEffect)(()=>{let e=e=>{var t;let{edgeId:n,waypoints:o}=e.detail,r=s.find(e=>e.id===n);if(!r)return;let{waypoint:a,...l}=null!=(t=r.data)?t:{};c([{type:"replace",id:n,item:{...r,data:{...l,waypoints:null!=o?o:void 0}}}])};return document.addEventListener(D.R,e),()=>document.removeEventListener(D.R,e)},[s,c]);let el=(0,r.useCallback)(async e=>{let{nodes:t,edges:n}=e,o=t.filter(e=>"start"!==e.type),r=new Set(o.map(e=>e.id)),a=new Set(t.map(e=>e.id)),l=n.filter(e=>!!(e.selected||r.has(e.source)||r.has(e.target))||!(a.has(e.source)||a.has(e.target))),i=o.filter(e=>"trigger"===e.type);return i.length>0&&await Promise.all(i.map(async e=>{var t,n;let o=null==(n=e.data)||null==(t=n.properties)?void 0:t.executionId;if("string"==typeof o&&o)try{await v.P.update(o,{enabled:!1})}catch(e){console.warn("TriggerNode: failed to disarm PlannedExecution",o,e)}})),(0!==o.length||0!==l.length)&&{nodes:o,edges:l}},[]),ei=(0,r.useCallback)(e=>{ee(e),f&&f(e)},[f]),es=(0,r.useCallback)(()=>{if(I.nodeId&&w){let e=O(I.nodeId,i);e&&w(e)}else if(I.edgeId&&k){let e=s.find(e=>e.id===I.edgeId);e&&k(e)}},[I.nodeId,I.edgeId,i,s,w,k]),ed=(0,r.useCallback)(()=>{var e;if(!I.nodeId||!S)return;let t=O(I.nodeId,i);((null==t?void 0:t.type)==="process"||(null==t||null==(e=t.data)?void 0:e.type)==="process")&&S(t)},[I.nodeId,i,S]),ec=(0,r.useCallback)(()=>{var e,t,n;let o;if(!I.edgeId)return;let r=s.find(e=>e.id===I.edgeId);if(!r)return;if((null==(e=r.data)?void 0:e.edgeType)!=="standard")return void J.debug("Toggle bidirectional ignored for non-standard edge ".concat(r.id));let l=!!(null==(t=r.data)?void 0:t.bidirectional);if(!l&&!(0,L.y2)(r,i,s))return void J.info("Edge ".concat(r.id," cannot be made bidirectional (reverse direction is not a legal connection)"));let d={...null!=(n=r.data)?n:{},bidirectional:!l};if(l){let{markerStart:e,...t}=r;o={...t,data:d}}else o={...r,data:d,markerStart:{type:m.TG.ArrowClosed,width:20,height:20,color:a.palette.text.secondary}};c([{type:"replace",id:r.id,item:o}])},[I.edgeId,s,i,c,a.palette.text.secondary]),eu=(0,r.useCallback)((e,t)=>{e.preventDefault(),w&&w(t)},[w]),ep=(0,r.useCallback)((e,t)=>{var n,o;let{fromNode:r,fromHandle:a,toHandle:l}=t;if(!r||!(null==a?void 0:a.id)||!Q)return void J.debug("onConnectEnd: No valid connection start data");J.debug("onConnectEnd: Connection ended from node ".concat(r.id,", handle ").concat(a.id));let i="subflow"===r.type&&s.some(e=>{let t=e.data;return(null==t?void 0:t.edgeType)!=="mcp"&&(null==t?void 0:t.edgeType)!=="resource"&&(e.source===r.id||e.target===r.id&&!!(null==t?void 0:t.bidirectional))}),d=!!(null==(o=e.target)||null==(n=o.closest)?void 0:n.call(o,".react-flow__pane"));if(!function(e){let{fromNodeType:t,fromHandleType:n,fromHandleId:o,landedOnHandle:r,droppedOnPane:a,subflowHasOutgoing:l}=e;return!r&&!!a&&!!o&&("target"!==n||!!(0,F.z5)(o))&&("subflow"!==t||"source"!==n||!l)}({fromNodeType:r.type,fromHandleType:a.type,fromHandleId:a.id,landedOnHandle:!!l,droppedOnPane:d,subflowHasOutgoing:i}))return;let c=e instanceof MouseEvent?e:e.changedTouches[0],u=Q.screenToFlowPosition({x:c.clientX,y:c.clientY});J.debug("onConnectEnd: Connection dropped on pane at position (".concat(u.x,", ").concat(u.y,")")),en({open:!0,position:u,screenPosition:{x:c.clientX,y:c.clientY},sourceNodeId:r.id,sourceNodeType:r.type,sourceHandleId:a.id})},[Q,s]),eh=(0,r.useCallback)((e,t)=>{if(J.debug("handleNodeTypeSelection: Selected node type ".concat(e," at position (").concat(t.x,", ").concat(t.y,")")),"trigger"===e&&i.some(e=>"trigger"===e.type))return void en({open:!1,position:null});let n=b.g.createNode(e,t),{sourceNodeId:o,sourceHandleId:r}=et,a=o?O(o,i):void 0,l=null;if(a&&r&&(l={source:a.id,sourceHandle:r,target:n.id,targetHandle:(0,F.CW)(e,r)},!(0,L.JL)(l,[...i,n],s)))return void en({open:!1,position:null});let u=A?A(e,t,n):n;if(!u)return void en({open:!1,position:null});if(A||d(eo(u)),l){J.debug("handleNodeTypeSelection: Creating connection from ".concat(l.source," to ").concat(l.target));let e=(0,L.wn)(l,[...i,u]);c([...(0,L.Cm)(e,s).map(e=>({type:"remove",id:e})),{type:"add",item:e}]),J.debug("handleNodeTypeSelection: Edge created with id ".concat(e.id))}en({open:!1,position:null}),null==C||C(u)},[et,i,s,eo,d,c,A,C]),em=(0,r.useCallback)(()=>{J.debug("handleCloseNodeSelectionModal: Closing node selection modal"),en({open:!1,position:null})},[]),eg=(0,r.useCallback)(()=>{let e=new Set(T.nodes),t=i.filter(t=>e.has(t.id)&&"start"!==t.type);if(0===t.length)return!1;let n=new Set(t.map(e=>e.id)),o=s.filter(e=>n.has(e.source)&&n.has(e.target));return B({nodes:JSON.parse(JSON.stringify(t)),edges:JSON.parse(JSON.stringify(o))}),J.debug("Copied ".concat(t.length," node(s) and ").concat(o.length," edge(s)")),!0},[T,i,s]),ex=(0,r.useCallback)(()=>{let e=G;if(!e)try{let t=localStorage.getItem(X);t&&(e=JSON.parse(t))}catch(e){J.warn("Could not read flow clipboard from localStorage",e)}if(!e||!e.nodes||0===e.nodes.length)return void J.debug("Paste requested but clipboard is empty");let t=new Map;e.nodes.forEach(e=>t.set(e.id,(0,y.A)()));let n=e.nodes.map(e=>{var n,o,r,a;return{...e,id:t.get(e.id),position:{x:(null!=(r=null==(n=e.position)?void 0:n.x)?r:0)+40,y:(null!=(a=null==(o=e.position)?void 0:o.y)?a:0)+40},selected:!0,data:{...e.data}}}),o=(e.edges||[]).filter(e=>t.has(e.source)&&t.has(e.target)).map(e=>({...e,id:(0,y.A)(),source:t.get(e.source),target:t.get(e.target),selected:!1}));d([...i.filter(e=>e.selected).map(e=>({type:"select",id:e.id,selected:!1})),...n.map(e=>({type:"add",item:e}))]),o.length>0&&c(o.map(e=>({type:"add",item:e}))),J.info("Pasted ".concat(n.length," node(s) and ").concat(o.length," edge(s)"))},[i,d,c]),ef=(0,r.useCallback)(e=>{let t=e.ctrlKey||e.metaKey,n=e.key.toLowerCase();if(t&&"c"===n){eg()&&e.preventDefault();return}if(t&&"x"===n){eg()&&(e.preventDefault(),H({nodes:T.nodes.map(e=>({id:e})),edges:T.edges.map(e=>({id:e}))}));return}if(t&&"v"===n){e.preventDefault(),ex();return}},[eg,ex,H,T]),ey=(0,r.useCallback)(()=>{if(I.nodeId&&!T.nodes.includes(I.nodeId)){let e=i.find(e=>e.id===I.nodeId);e&&"start"!==e.type&&(B({nodes:JSON.parse(JSON.stringify([e])),edges:[]}),J.debug("Copied right-clicked node to clipboard"));return}eg()},[I.nodeId,T,i,eg]),eb=(0,r.useMemo)(()=>{if(G)return!0;try{return!!localStorage.getItem(X)}catch(e){return!1}},[I.open]),ev=(0,r.useMemo)(()=>{if(I.selection){let e=new Set(T.nodes);return i.some(t=>e.has(t.id)&&"start"!==t.type)}if(I.nodeId){let e=i.find(e=>e.id===I.nodeId);return!!e&&"start"!==e.type}return!1},[I.selection,I.nodeId,T,i]);return(0,o.jsxs)(K,{style:l?{flex:"none",width:"100%",maxWidth:"100%",height:440,minHeight:440}:void 0,ref:e=>{t&&("function"==typeof t?t(e):t.current=e),j&&(j.current=e),$.current=e},children:[(0,o.jsx)(h.Gc,{nodes:i,edges:s,nodeTypes:Y,edgeTypes:q,defaultEdgeOptions:(0,r.useMemo)(()=>({type:"custom",animated:!1,style:{stroke:a.palette.text.secondary,strokeWidth:2},markerEnd:{type:m.TG.ArrowClosed,width:20,height:20,color:a.palette.text.secondary}}),[a.palette.text.secondary]),connectionLineType:m.Do.SmoothStep,connectionMode:m.WZ.Loose,isValidConnection:ea,onNodesChange:d,onEdgesChange:c,onConnect:er,onBeforeDelete:el,deleteKeyCode:["Backspace","Delete"],onDrop:u,onDragOver:x,onInit:ei,onNodeContextMenu:N,onEdgeContextMenu:z,onPaneContextMenu:P,onSelectionContextMenu:W,onKeyDown:ef,onNodeDoubleClick:eu,onNodeClick:(e,t)=>null==C?void 0:C(t),onConnectEnd:ep,tabIndex:0,fitView:!0,attributionPosition:"bottom-right",minZoom:.1,maxZoom:2,snapToGrid:!0,snapGrid:[15,15],connectOnClick:!1,children:(0,o.jsx)(U,{})}),(0,o.jsx)(M,{open:I.open,position:I.position,onClose:E,onDelete:R,onEditProperties:es,onConvertToSubflow:S&&I.nodeId&&(null==(n=i.find(e=>e.id===I.nodeId))?void 0:n.type)==="process"?ed:void 0,onToggleBidirectional:ec,onCopy:ey,onPaste:ex,canPaste:eb,canCopy:ev,nodeId:I.nodeId,selection:I.selection,edgeId:I.edgeId}),(0,o.jsx)(V,{open:et.open,position:et.position,anchorPosition:et.screenPosition,onClose:em,onSelectNodeType:eh,sourceNodeType:et.sourceNodeType,sourceHandleId:et.sourceHandleId})]})});Z.displayName="Canvas";let $=Z},49479:(e,t,n)=>{n.d(t,{O:()=>s,b:()=>r});let o=(0,n(73288).h)("frontend/services/chat/index");class r extends Error{constructor(e,t,n){super(e),this.name="ChatApiError",this.status=t,this.body=n}}let a="/v1/chat/conversations";async function l(e){let t;if(204===e.status)return;let n=await e.text();if(n)try{t=JSON.parse(n)}catch(e){t=n}if(!e.ok)throw new r(t&&"object"==typeof t&&(t.error||t.message)||"Request failed with status ".concat(e.status),e.status,t);return t}class i{async listConversations(){return o.debug("listConversations: Entering method"),l(await fetch(a))}async getConversation(e){return o.debug("getConversation: Entering method",{conversationId:e}),l(await fetch("".concat(a,"/").concat(encodeURIComponent(e))))}async createConversation(e){return o.debug("createConversation: Entering method",{conversationId:e.id}),l(await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}))}async updateConversationFlow(e,t){return o.debug("updateConversationFlow: Entering method",{conversationId:e,flowId:t}),l(await fetch("".concat(a,"/").concat(encodeURIComponent(e)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:t})}))}async updateConversationTitle(e,t){return o.debug("updateConversationTitle: Entering method",{conversationId:e}),l(await fetch("".concat(a,"/").concat(encodeURIComponent(e)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t})}))}async updateConversationApproval(e,t){return o.debug("updateConversationApproval: Entering method",{conversationId:e,requireApproval:t}),l(await fetch("".concat(a,"/").concat(encodeURIComponent(e)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireApproval:t})}))}async deleteConversation(e){o.debug("deleteConversation: Entering method",{conversationId:e});let t=await fetch("".concat(a,"/").concat(encodeURIComponent(e)),{method:"DELETE"});await l(t)}async deleteConversations(e){return o.debug("deleteConversations: Entering method",{count:e.length}),l(await fetch(a,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:e})}))}async respondToToolCall(e,t,n,r,i){return o.debug("respondToToolCall: Entering method",{conversationId:e,action:t,toolCallId:n,always:r}),l(await fetch("".concat(a,"/").concat(encodeURIComponent(e),"/respond"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:t,toolCallId:n,...r?{always:!0}:{},...i?{feedback:i}:{}})}))}async debugStep(e){return o.debug("debugStep: Entering method",{conversationId:e}),l(await fetch("".concat(a,"/").concat(encodeURIComponent(e),"/debug/step"),{method:"POST"}))}async debugContinue(e){return o.debug("debugContinue: Entering method",{conversationId:e}),l(await fetch("".concat(a,"/").concat(encodeURIComponent(e),"/debug/continue"),{method:"POST"}))}async setBreakpoints(e,t){o.debug("setBreakpoints: Entering method",{conversationId:e,count:t.length});let n=await fetch("".concat(a,"/").concat(encodeURIComponent(e),"/breakpoints"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({breakpoints:t})});await l(n)}async synthesizeQuickChat(e){return o.debug("synthesizeQuickChat: Entering method",{conversationId:e.conversationId}),l(await fetch("/api/flow/quick-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}))}async synthesizeFlowGenerator(e){return l(await fetch("/api/flow/generator",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}))}async completeFlowGeneratorTurn(e){return l(await fetch("/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:"flow-Flow Generator Session",messages:e.messages,stream:!1,metadata:{flujo:"true",conversationId:e.conversationId}})}))}async restoreFlowGenerator(){return l(await fetch("/api/flow/generator",{method:"PUT"}))}async cancel(e){o.debug("cancel: Entering method",{conversationId:e});let t=await fetch("".concat(a,"/").concat(encodeURIComponent(e),"/cancel"),{method:"POST"});await l(t)}async injectMessage(e,t,n){o.debug("injectMessage: Entering method",{conversationId:e,messageId:n});try{let r=await fetch("".concat(a,"/").concat(encodeURIComponent(e),"/inject"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,id:n})});if(r.ok)return{delivered:!0};if(409===r.status)return o.debug("injectMessage: run is not live; caller should send normally",{conversationId:e}),{delivered:!1};return o.warn("injectMessage: unexpected response; falling back to a normal send",{conversationId:e,status:r.status}),{delivered:!1}}catch(t){return o.warn("injectMessage: request failed; falling back to a normal send",{conversationId:e,err:t}),{delivered:!1}}}async previewRevert(e,t){return l(await fetch("".concat(a,"/").concat(encodeURIComponent(e),"/revert?messageId=").concat(encodeURIComponent(t))))}async revertToMessage(e,t,n){return l(await fetch("".concat(a,"/").concat(encodeURIComponent(e),"/revert"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messageId:t,previewId:n})}))}async undoRevert(e,t){let n=await fetch("".concat(a,"/").concat(encodeURIComponent(e),"/revert"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:t,action:"undo"})});await l(n)}subscribeToEvents(e,t,n){let r=new EventSource(void 0!==n?"".concat(a,"/").concat(encodeURIComponent(e),"/events?fromSeq=").concat(n):"".concat(a,"/").concat(encodeURIComponent(e),"/events"));return r.onopen=()=>{var n;o.debug("Execution event stream open",{conversationId:e}),null==(n=t.onOpen)||n.call(t)},r.onmessage=e=>{try{t.onEvent(JSON.parse(e.data))}catch(e){o.warn("Failed to parse SSE event",{err:e})}},r.onerror=e=>{var n;o.debug("SSE stream error (browser will retry if still open)"),null==(n=t.onError)||n.call(t,e)},r}subscribeToSidebarEvents(e){let t=new EventSource("/v1/chat/events?scope=sidebar");return t.onopen=()=>{var t;o.debug("Sidebar lifecycle event stream open"),null==(t=e.onOpen)||t.call(e)},t.onmessage=t=>{try{e.onEvent(JSON.parse(t.data))}catch(e){o.warn("Failed to parse sidebar lifecycle event",{err:e})}},t.onerror=t=>{var n;o.debug("Sidebar lifecycle stream error (browser will retry if still open)"),null==(n=e.onError)||n.call(e,t)},t}}let s=new i},53911:(e,t,n)=>{n.d(t,{jY:()=>a,oY:()=>l,sZ:()=>i});var o=n(95155);n(12115);var r=n(71738);let a=e=>(0,o.jsx)(r.A,{...e,variant:"standard"}),l=e=>(0,o.jsx)(r.A,{...e,variant:"mcp"}),i=e=>(0,o.jsx)(r.A,{...e,variant:"resource"})},71738:(e,t,n)=>{n.d(t,{R:()=>u,A:()=>f});var o=n(95155),r=n(12115),a=n(22539),l=n(76122),i=n(48116),s=n(33567);function d(e){return e===l.yX.Left||e===l.yX.Right?"h":"v"}var c=n(19875);let u="flowEdgeWaypoint",p={x:16,y:-16},h=(0,i.Ay)("button")(e=>{let{theme:t}=e;return{background:t.palette.background.paper,border:"1px solid ".concat(t.palette.divider),cursor:"pointer",borderRadius:"50%",fontSize:"10px",width:"20px",height:"20px",display:"flex",justifyContent:"center",alignItems:"center",color:t.palette.text.secondary,boxShadow:"dark"===t.palette.mode?"0 2px 4px rgba(0,0,0,0.3)":"0 2px 4px rgba(0,0,0,0.1)","&:hover":{background:t.palette.error.main,borderColor:t.palette.error.main,color:t.palette.error.contrastText}}}),m=(0,i.Ay)(a.tE)({"&&.animated":{strokeDasharray:5,animation:"flowPathAnimation ".concat(500,"ms infinite linear")},"&&.animated-both":{strokeDasharray:5,animation:"flowPathAnimation ".concat(750,"ms infinite linear alternate")},"@keyframes flowPathAnimation":{"0%":{strokeDashoffset:10},"100%":{strokeDashoffset:0}}}),g="#009688",x="#4DB6AC",f=e=>{var t,n,i;let f,y,{variant:b,id:v,source:j,target:w,sourceHandleId:A,targetHandleId:C,sourceX:S,sourceY:k,targetX:I,targetY:T,sourcePosition:E,targetPosition:R,style:N={},markerEnd:z,markerStart:M,data:P,selected:D}=e,O=(0,s.A)(),{deleteElements:W,screenToFlowPosition:_,getNode:L}=(0,a.VH)(),[F,U]=(0,r.useState)(!1),[H,J]=(0,r.useState)(null),X=(0,r.useRef)(null),G=(0,r.useRef)(!1),B="standard"===b&&(null==P?void 0:P.condition)?(0,c.P2)(P.condition):"",Y=e=>!!e&&e.includes("process")&&e.includes("resource"),q="";if("resource"===b){let e=null==(t=L(j))?void 0:t.type,o=null==(n=L(w))?void 0:n.type;"resource"===e&&"process"===o?q="consume":"process"===e&&"resource"===o||Y(A)?q="produce":Y(C)&&(q="consume")}let V=null!=(i=null==P?void 0:P.waypoints)?i:(null==P?void 0:P.waypoint)?[P.waypoint]:[],K=null!=H?H:V,Z="standard"===b&&!!(null==P?void 0:P.bidirectional),$="mcp"===b||"resource"===b,Q=E||($?l.yX.Left:l.yX.Bottom),ee=R||($?l.yX.Right:l.yX.Top),et=null;if(K.length>0)f=(et=function(e,t,n,o,r){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:8,l=[e,...r,n],i=[e],s=[],d=t,c=(e,t)=>{let n;n=i[i.length-1],.01>Math.abs(n.x-e.x)&&.01>Math.abs(n.y-e.y)||(i.push(e),s.push(t))};for(let e=1;e<l.length;e++){let t=i[i.length-1],n=l[e],r=e-1;if(e===l.length-1){if("v"===o)if("h"===d)c({x:n.x,y:t.y},r);else{let e=(t.y+n.y)/2;c({x:t.x,y:e},r),c({x:n.x,y:e},r)}else if("v"===d)c({x:t.x,y:n.y},r);else{let e=(t.x+n.x)/2;c({x:e,y:t.y},r),c({x:e,y:n.y},r)}c(n,r)}else c("v"===d?{x:t.x,y:n.y}:{x:n.x,y:t.y},r),c(n,r),d="v"===d?"h":"v"}!function(e,t){for(let l=1;l<e.length-1;l++){var n,o,r,a;let i=e[l-1],s=e[l],d=e[l+1],c=.01>Math.abs(i.x-s.x)&&.01>Math.abs(d.x-s.x)&&(s.y-i.y)*(d.y-s.y)<0,u=.01>Math.abs(i.y-s.y)&&.01>Math.abs(d.y-s.y)&&(s.x-i.x)*(d.x-s.x)<0;if(c||u){if(c){let r=(null!=(o=null==(n=e[l-2])?void 0:n.x)?o:s.x-1)<=s.x,a=r?s.x-12:s.x+12,c=r?s.x+12:s.x-12,u=t[l-1];e.splice(l-1,3,{x:a,y:i.y},{x:a,y:s.y},{x:c,y:s.y},{x:c,y:d.y}),t.splice(l-1,2,u,u,u)}else{let n=(null!=(a=null==(r=e[l-2])?void 0:r.y)?a:s.y-1)<=s.y,o=n?s.y-12:s.y+12,c=n?s.y+12:s.y-12,u=t[l-1];e.splice(l-1,3,{x:i.x,y:o},{x:s.x,y:o},{x:s.x,y:c},{x:d.x,y:c}),t.splice(l-1,2,u,u,u)}l++}}}(i,s);let u=[];for(let e=0;e<i.length-1;e++)u.push({a:i[e],b:i[e+1],gap:s[e]});return{d:function(e,t){if(0===e.length)return"";let n="M ".concat(e[0].x,",").concat(e[0].y);for(let o=1;o<e.length-1;o++){let r=e[o-1],a=e[o],l=e[o+1],i=Math.hypot(a.x-r.x,a.y-r.y),s=Math.hypot(l.x-a.x,l.y-a.y),d=Math.min(t,i/2,s/2);if(d<.5){n+=" L ".concat(a.x,",").concat(a.y);continue}let c={x:a.x-(a.x-r.x)/i*d,y:a.y-(a.y-r.y)/i*d},u={x:a.x+(l.x-a.x)/s*d,y:a.y+(l.y-a.y)/s*d};n+=" L ".concat(c.x,",").concat(c.y," Q ").concat(a.x,",").concat(a.y," ").concat(u.x,",").concat(u.y)}let o=e[e.length-1];return n+" L ".concat(o.x,",").concat(o.y)}(i,a),points:i,segments:u,midpoint:function(e,t){let n=0;for(let t=0;t<e.length-1;t++)n+=Math.hypot(e[t+1].x-e[t].x,e[t+1].y-e[t].y);if(0===n)return e[0];let o=.5*n;for(let t=0;t<e.length-1;t++){let n=Math.hypot(e[t+1].x-e[t].x,e[t+1].y-e[t].y);if(o<=n){let r=0===n?0:o/n;return{x:e[t].x+(e[t+1].x-e[t].x)*r,y:e[t].y+(e[t+1].y-e[t].y)*r}}o-=n}return e[e.length-1]}(i,.5)}}({x:S,y:k},d(Q),{x:I,y:T},d(ee),K,16)).d,y=et.midpoint;else{let[e,t,n]=(0,l.oN)({sourceX:S,sourceY:k,sourcePosition:Q,targetX:I,targetY:T,targetPosition:ee,borderRadius:16});f=e,y={x:t,y:n}}let en=$?"":Z?"animated-both":(null==P?void 0:P.animated)!==!1?"animated":"",eo={...N,strokeWidth:D?3:2,stroke:"mcp"===b?D?O.palette.info.light:O.palette.info.main:"resource"===b?D?x:g:D?O.palette.primary.main:O.palette.text.secondary,..."resource"===b?{strokeDasharray:"6 4"}:{},...en?{animationDuration:"".concat(Math.round((Z?750:500)*(e=>{let t=0;for(let n=0;n<e.length;n++)t=31*t+e.charCodeAt(n)|0;return .9+Math.abs(t)%1e3/1e3*.2})(v)),"ms")}:{}},er=e=>{document.dispatchEvent(new CustomEvent(u,{detail:{edgeId:v,waypoints:e&&e.length>0?e:null}}))},ea=e=>{if(0!==e.button)return;let t=_({x:e.clientX,y:e.clientY}),n=et?function(e,t){let n=0,o=1/0;for(let r of t){let t=function(e,t,n){let o=n.x-t.x,r=n.y-t.y,a=o*o+r*r,l=0===a?0:Math.max(0,Math.min(1,((e.x-t.x)*o+(e.y-t.y)*r)/a));return Math.hypot(e.x-(t.x+o*l),e.y-(t.y+r*l))}(e,r.a,r.b);t<o&&(o=t,n=r.gap)}return n}(t,et.segments):0,o=[...K];o.splice(n,0,t),X.current={index:n,pointerId:e.pointerId,startClient:{x:e.clientX,y:e.clientY},base:o,active:!1,fromPath:!0},e.target.setPointerCapture(e.pointerId)},el=e=>{let t=X.current;if(!t||e.pointerId!==t.pointerId)return;if(!t.active){if(4>Math.hypot(e.clientX-t.startClient.x,e.clientY-t.startClient.y))return;t.active=!0}let n=[...t.base];n[t.index]=_({x:e.clientX,y:e.clientY}),J(n)},ei=e=>{let t=X.current;if(!t||e.pointerId!==t.pointerId||(X.current=null,e.target.releasePointerCapture(e.pointerId),G.current=t.active,!t.active))return;let n=[...t.base];n[t.index]=_({x:e.clientX,y:e.clientY}),er(n),J(null)},es=null!==H,ed=D||F||es;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(m,{path:f,markerEnd:z,markerStart:M,style:eo,id:v,className:en}),(0,o.jsx)("path",{d:f,fill:"none",stroke:"transparent",strokeWidth:20,style:{cursor:es?"grabbing":"grab"},onMouseEnter:()=>U(!0),onMouseLeave:()=>U(!1),onPointerDown:ea,onPointerMove:el,onPointerUp:ei}),(0,o.jsxs)(a.rV,{children:[B&&(0,o.jsx)("div",{style:{position:"absolute",transform:"translate(-50%, -50%) translate(".concat(y.x,"px,").concat(y.y-18,"px)"),pointerEvents:"none",background:O.palette.info.main,color:O.palette.info.contrastText,borderRadius:4,padding:"1px 6px",fontSize:10,fontWeight:600,whiteSpace:"nowrap",boxShadow:O.shadows[1],zIndex:1002},className:"nodrag nopan",title:"Routing condition: ".concat(B),children:B}),q&&(0,o.jsx)("div",{style:{position:"absolute",transform:"translate(-50%, -50%) translate(".concat(y.x,"px,").concat(y.y-18,"px)"),pointerEvents:"none",background:D?x:g,color:"#ffffff",borderRadius:4,padding:"1px 6px",fontSize:10,fontWeight:600,whiteSpace:"nowrap",boxShadow:O.shadows[1],zIndex:1002},className:"nodrag nopan",title:"consume"===q?"This step consumes (reads) the resource":"This step produces (writes) the resource",children:q}),ed&&K.map((e,t)=>(0,o.jsx)("div",{style:{position:"absolute",transform:"translate(-50%, -50%) translate(".concat(e.x,"px,").concat(e.y,"px)"),width:12,height:12,borderRadius:"50%",background:O.palette.primary.main,border:"2px solid ".concat(O.palette.background.paper),boxShadow:O.shadows[1],cursor:"move",pointerEvents:"all",touchAction:"none",zIndex:1001},className:"nodrag nopan",title:"Drag to move; double-click to remove this bend",onMouseEnter:()=>U(!0),onMouseLeave:()=>U(!1),onPointerDown:e=>{0===e.button&&(e.stopPropagation(),X.current={index:t,pointerId:e.pointerId,startClient:{x:e.clientX,y:e.clientY},base:[...K],active:!1,fromPath:!1},e.target.setPointerCapture(e.pointerId))},onPointerMove:el,onPointerUp:ei,onDoubleClick:e=>{e.stopPropagation(),(e=>{let t=K.filter((t,n)=>n!==e);J(null),er(t)})(t)}},t)),(0,o.jsx)("div",{style:{position:"absolute",transform:"translate(-50%, -50%) translate(".concat(y.x+p.x,"px,").concat(y.y+p.y,"px)"),pointerEvents:ed&&!es?"all":"none",opacity:ed&&!es?1:0,transition:"opacity 120ms ease",zIndex:1e3},className:"nodrag nopan",onMouseEnter:()=>U(!0),onMouseLeave:()=>U(!1),children:(0,o.jsx)(h,{title:"Delete connection (drag to re-route)",style:{touchAction:"none"},onPointerDown:ea,onPointerMove:el,onPointerUp:ei,onClick:e=>{if(e.stopPropagation(),G.current){G.current=!1;return}W({edges:[{id:v}]})},children:"\xd7"})})]})]})}},76750:(e,t,n)=>{n.d(t,{A:()=>eA});var o=n(95155),r=n(12115),a=n(25635),l=n(94049),i=n(91871),s=n(4474),d=n(78470),c=n(28548),u=n(50430),p=n(99944),h=n(9957),m=n(41983),g=n(2300),x=n(98267),f=n(20537),y=n(37960),b=n(22822),v=n(52641),j=n(95436),w=n(55606),A=n(86973),C=n(18369),S=n(9562),k=n(9839),I=n(43861),T=n(75656),E=n(36314),R=n(49501),N=n(17681),z=n(6504),M=n(22133),P=n(11665),D=n(97516),O=n(91861),W=n(53612),_=n(3014),L=n(63186),F=n(70863),U=n(67891),H=n(12121),J=n(60691),X=n(14915),G=n(63992),B=n(59637),Y=n(30949),q=n(50291),V=n(55406),K=n(2778),Z=n(52363),$=n(65036),Q=n(52005),ee=n(22003),et=n(41602),en=n(23820),eo=n(75912),er=n(49479);function ea(e){let{open:t,conversationId:n,messageId:s,onClose:d,onReverted:c}=e,[u,p]=(0,r.useState)(null),[h,m]=(0,r.useState)(null),[g,x]=(0,r.useState)(!1),[f,y]=(0,r.useState)(!1),[b,v]=(0,r.useState)(null);(0,r.useEffect)(()=>{if(!t||!s)return;let e=!1;return p(null),m(null),v(null),x(!0),er.O.previewRevert(n,s).then(t=>{e||p(t)}).catch(t=>{e||m(t instanceof Error?t.message:"Unable to load preview")}).finally(()=>{e||x(!1)}),()=>{e=!0}},[n,s,t]);let j=async()=>{if(s&&u){y(!0),m(null);try{let e=await er.O.revertToMessage(n,s,u.previewId);v(e.operationId),null==c||c(s)}catch(e){m(e instanceof Error?e.message:"Unable to revert changes")}finally{y(!1)}}},w=async()=>{if(b){y(!0),m(null);try{await er.O.undoRevert(n,b),v(null),d()}catch(e){m(e instanceof Error?e.message:"Unable to undo revert")}finally{y(!1)}}};return(0,o.jsxs)(K.A,{open:t,onClose:f?void 0:d,fullWidth:!0,maxWidth:"md",children:[(0,o.jsx)(Z.A,{children:"Revert to here"}),(0,o.jsxs)($.A,{children:[(g||f)&&(0,o.jsx)(Q.A,{sx:{mb:2}}),h&&(0,o.jsx)(ee.A,{severity:"error",sx:{mb:2},children:h}),b?(0,o.jsx)(ee.A,{severity:"success",children:"Changes were reverted. You can undo this operation now."}):u&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a.A,{variant:"body2",children:"Review the affected files before changing the worktree."}),(0,o.jsx)(et.A,{dense:!0,children:u.files.map(e=>(0,o.jsx)(en.Ay,{disableGutters:!0,children:(0,o.jsx)(N.A,{primary:e.path,secondary:e.status})},"".concat(e.status,":").concat(e.path)))}),(0,o.jsx)(l.default,{component:"pre",sx:{maxHeight:360,overflow:"auto",p:1.5,bgcolor:"action.hover",borderRadius:1,fontFamily:"monospace",fontSize:12,whiteSpace:"pre-wrap"},children:u.diff||"No textual diff available."}),u.truncated&&(0,o.jsx)(a.A,{variant:"caption",children:"Preview truncated for safety."})]})]}),(0,o.jsxs)(eo.A,{children:[(0,o.jsx)(i.A,{onClick:d,disabled:f,children:"Cancel"}),b?(0,o.jsx)(i.A,{onClick:w,disabled:f,children:"Undo revert"}):(0,o.jsx)(i.A,{color:"error",variant:"contained",onClick:j,disabled:!u||g||f,children:"Confirm Revert"})]})]})}var el=n(53228),ei=n(1877),es=n(18466);function ed(e){return!!e&&(e.startsWith(es.n9)||"handoff"===e)}var ec=n(23731);function eu(e){var t;return e.url?e.url:e.data?"data:".concat(null!=(t=e.mimeType)?t:"application/octet-stream",";base64,").concat(e.data):void 0}let ep=(0,n(73288).h)("frontend/components/Chat/ChatMessages");function eh(e){return"assistant"===e.role&&"tool_calls"in e&&Array.isArray(e.tool_calls)}function em(e){if("tool"!==e.role||"string"!=typeof e.content)return!1;try{var t;return(null==(t=JSON.parse(e.content))?void 0:t.handoff)===!0}catch(e){return!1}}let eg={p:e=>(0,o.jsx)(a.A,{variant:"body1",sx:{mb:.5,whiteSpace:"pre-line"},children:e.children}),h1:e=>(0,o.jsx)(a.A,{variant:"h5",sx:{mt:2,mb:.5},children:e.children}),h2:e=>(0,o.jsx)(a.A,{variant:"h6",sx:{mt:2,mb:.5},children:e.children}),h3:e=>(0,o.jsx)(a.A,{variant:"subtitle1",sx:{mt:1.5,mb:.5},children:e.children}),h4:e=>(0,o.jsx)(a.A,{variant:"subtitle2",sx:{mt:1.5,mb:.5},children:e.children}),h5:e=>(0,o.jsx)(a.A,{variant:"body1",sx:{mt:1,mb:.5,fontWeight:"bold"},children:e.children}),h6:e=>(0,o.jsx)(a.A,{variant:"body2",sx:{mt:1,mb:.5,fontWeight:"bold"},children:e.children}),ul:e=>(0,o.jsx)(l.default,{component:"ul",sx:{pl:2,mb:1},children:e.children}),ol:e=>(0,o.jsx)(l.default,{component:"ol",sx:{pl:2,mb:1},children:e.children}),li:e=>(0,o.jsx)(l.default,{component:"li",sx:{mb:.5,whiteSpace:"pre-line"},children:e.children}),a:e=>(0,o.jsx)(a.A,{component:"a",sx:{color:"primary.main"},href:e.href,children:e.children}),blockquote:e=>(0,o.jsx)(l.default,{component:"blockquote",sx:{borderLeft:"4px solid",borderColor:"divider",pl:2,py:.5,my:1,bgcolor:"action.hover",borderRadius:"4px"},children:e.children}),code:e=>{let{node:t,className:n,children:r,...i}=e;return/language-(\w+)/.exec(n||"")||n?(0,o.jsx)(l.default,{component:"pre",sx:{bgcolor:"action.hover",p:1.5,borderRadius:"4px",overflowX:"auto",fontFamily:"monospace",fontSize:"0.875rem",my:1,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:r}):(0,o.jsx)(a.A,{component:"code",sx:{bgcolor:"action.hover",px:.5,py:.25,borderRadius:"4px",fontFamily:"monospace",wordBreak:"break-all"},children:r})}},ex=e=>{let{media:t}=e;return(0,o.jsx)(l.default,{sx:{display:"flex",flexDirection:"column",gap:1,mt:1},children:t.map((e,t)=>{var n,r,s,d;let c=eu(e),u=null!=(r=null!=(n=e.resourceUri)?n:e.url)?r:"".concat(e.type,"-").concat(t);return c?"image"===e.type?(0,o.jsx)(l.default,{component:"img",src:c,alt:null!=(s=e.name)?s:"Generated image ".concat(t+1),sx:{maxWidth:"100%",height:"auto",borderRadius:1}},u):"audio"===e.type?(0,o.jsxs)(l.default,{children:[(0,o.jsx)(l.default,{component:"audio",controls:!0,src:c,sx:{width:"100%"}}),e.transcript&&(0,o.jsx)(a.A,{variant:"caption",color:"text.secondary",sx:{display:"block",mt:.5},children:e.transcript})]},u):"video"===e.type?(0,o.jsx)(l.default,{component:"video",controls:!0,src:c,sx:{maxWidth:"100%",maxHeight:560,borderRadius:1}},u):(0,o.jsx)(i.A,{component:"a",href:c,download:e.name||!0,target:"_blank",rel:"noopener noreferrer",variant:"outlined",size:"small",startIcon:(0,o.jsx)(W.A,{}),sx:{alignSelf:"flex-start"},children:null!=(d=e.name)?d:"Download generated file"},u):null})})},ef=e=>{let{content:t,showRaw:n}=e;return n?(0,o.jsx)(l.default,{component:"pre",sx:{whiteSpace:"pre-wrap",wordBreak:"break-all",fontSize:"0.8rem",p:1,borderRadius:1,border:1,borderColor:e=>e.palette.divider,bgcolor:"action.hover",color:e=>e.palette.text.primary,overflow:"auto",maxHeight:"300px"},children:"string"==typeof t?t:"[Invalid tool content]"}):"string"!=typeof t?(0,o.jsx)(a.A,{variant:"body2",fontStyle:"italic",color:"text.secondary",children:"[Invalid tool content]"}):(0,o.jsx)(l.default,{sx:{width:"100%",minWidth:0},children:(()=>{try{let e=JSON.parse(t);if(e&&Array.isArray(e.content))return(0,o.jsx)(l.default,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.content.map((e,t)=>"text"===e.type?(0,o.jsx)(z.oz,{remarkPlugins:[M.A],children:e.text},t):"image"===e.type&&e.data&&e.mimeType?(0,o.jsx)("img",{src:"data:".concat(e.mimeType,";base64,").concat(e.data),alt:"Tool Result Image ".concat(t+1),style:{maxWidth:"100%",height:"auto",borderRadius:"4px",marginTop:"8px"}},t):"audio"===e.type&&e.data&&e.mimeType?(0,o.jsx)("audio",{controls:!0,src:"data:".concat(e.mimeType,";base64,").concat(e.data),style:{width:"100%",marginTop:"8px"},children:"Your browser does not support the audio element."},t):"video"===e.type&&e.data&&e.mimeType?(0,o.jsx)("video",{controls:!0,src:"data:".concat(e.mimeType,";base64,").concat(e.data),style:{maxWidth:"100%",maxHeight:"560px",marginTop:"8px"},children:"Your browser does not support the video element."},t):(0,o.jsx)(l.default,{component:"pre",sx:{whiteSpace:"pre-wrap",wordBreak:"break-all",fontSize:"0.8rem",p:1,borderRadius:1,border:1,borderColor:e=>e.palette.divider,bgcolor:"action.hover",color:e=>e.palette.text.primary,overflow:"auto",mt:1},children:"Unsupported content type: ".concat(e.type,"\n").concat(JSON.stringify(e,null,2))},t))});return(0,o.jsx)(z.oz,{remarkPlugins:[M.A],children:"```json\n".concat(JSON.stringify(e,null,2),"\n```")})}catch(e){return(0,o.jsx)(z.oz,{remarkPlugins:[M.A],children:t})}})()})},ey=e=>{let{pairs:t,messageId:n,conversationId:m,onAppMessage:g,onUpdateModelContext:x,onRegisterAppTeardown:f,onOpenInCanvas:y}=e,[b,v]=(0,r.useState)(null),[j,w]=(0,r.useState)({}),A=(e,t)=>e.toolCall.id||"tc-".concat(n,"-").concat(t);return(0,o.jsxs)(l.default,{sx:{mt:1,pt:1,borderTop:"1px solid",borderColor:"divider"},children:[(0,o.jsxs)(l.default,{sx:{display:"flex",alignItems:"center",color:"primary.main",mb:1},children:[(0,o.jsx)(F.A,{fontSize:"small",sx:{mr:1}}),(0,o.jsx)(a.A,{variant:"body2",children:1===t.length?"The agent used a tool":"The agent used ".concat(t.length," tools")})]}),(0,o.jsx)(l.default,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:.5},children:t.map((e,t)=>{let n=A(e,t),a=function(e){if(!e)return"pending";if("string"==typeof e.content)try{let t=JSON.parse(e.content);if(t&&(!0===t.isError||null!=t.error))return"error"}catch(e){}return"done"}(e.result),i=b===n;return(0,o.jsxs)(r.Fragment,{children:[t>0&&(0,o.jsx)(l.default,{sx:{width:14,height:"2px",bgcolor:"divider",flexShrink:0}}),(0,o.jsx)(d.A,{title:i?"Hide call & result":"Show call & result",children:(0,o.jsx)(c.A,{icon:function(e){return"pending"===e?(0,o.jsx)(s.default,{size:14,thickness:6}):"error"===e?(0,o.jsx)(J.A,{fontSize:"small"}):(0,o.jsx)(H.A,{fontSize:"small"})}(a),label:(0,ei.yo)(e.toolCall.function.name),size:"small",clickable:!0,variant:i?"filled":"outlined",color:"error"===a?"error":"pending"===a?"default":"primary",onClick:()=>v(i?null:n),sx:{maxWidth:"100%"}})})]},n)})}),t.map((e,t)=>{var n,r,d;let v=A(e,t),C=e.toolCall.function.arguments;try{C=JSON.stringify(JSON.parse(e.toolCall.function.arguments),null,2)}catch(e){}let S=!!j[v],k=e.mcpDestination?()=>{let t={};try{let n=JSON.parse(e.toolCall.function.arguments);n&&"object"==typeof n&&!Array.isArray(n)&&(t=n)}catch(e){}let n=new URLSearchParams({server:e.mcpDestination.serverName,tool:e.mcpDestination.toolName,args:JSON.stringify(t)});window.location.assign("/mcp?".concat(n.toString()))}:void 0;return(0,o.jsx)(u.A,{in:b===v,children:(0,o.jsxs)(l.default,{sx:{mt:1,p:1,borderRadius:1,bgcolor:"rgba(0, 0, 0, 0.03)"},children:[(0,o.jsxs)(l.default,{sx:{display:"flex",alignItems:"center",mb:.5},children:[(0,o.jsx)(F.A,{fontSize:"small",sx:{mr:.5,color:"primary.main"}}),(0,o.jsx)(a.A,{variant:"caption",sx:{fontWeight:"bold"},children:"Parameters"}),(0,o.jsx)(c.A,{label:"ID: ".concat(e.toolCall.id?e.toolCall.id.substring(0,8):"N/A","..."),size:"small",color:"default",variant:"outlined",sx:{ml:1,height:20,fontSize:"0.7rem"}})]}),(0,o.jsx)(l.default,{component:"pre",sx:{bgcolor:"action.hover",p:1,borderRadius:"4px",overflowX:"auto",fontFamily:"monospace",fontSize:"0.75rem",my:.5,maxHeight:"150px",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:C}),k&&(0,o.jsx)(i.A,{size:"small",variant:"outlined",startIcon:(0,o.jsx)(V.A,{}),onClick:k,sx:{mt:.5},children:"Execute in Tool Tester"}),(0,o.jsxs)(l.default,{sx:{display:"flex",alignItems:"center",mt:1,mb:.5},children:[(0,o.jsx)(U.A,{fontSize:"small",sx:{mr:.5,color:"text.secondary"}}),(0,o.jsx)(a.A,{variant:"caption",sx:{fontWeight:"bold"},children:"Result"}),e.result&&(0,o.jsx)(p.A,{control:(0,o.jsx)(h.A,{size:"small",checked:S,onChange:e=>w(t=>({...t,[v]:e.target.checked}))}),label:"Raw",sx:{ml:"auto",mr:0,"& .MuiTypography-root":{fontSize:"0.75rem"}}})]}),e.result?(0,o.jsx)(ef,{content:e.result.content,showRaw:S}):(0,o.jsxs)(a.A,{variant:"body2",fontStyle:"italic",color:"text.secondary",sx:{display:"flex",alignItems:"center",gap:1},children:[(0,o.jsx)(s.default,{size:14,thickness:6})," Waiting for the tool to respond…"]}),(null==(r=e.result)||null==(n=r.ui)?void 0:n.uri)&&e.result.ui.serverName&&(0,o.jsx)(ec.Ay,{conversationId:m,serverName:e.result.ui.serverName,uri:e.result.ui.uri,toolName:null!=(d=e.result.ui.toolName)?d:e.toolCall.function.name,toolArgs:e.toolCall.function.arguments,toolResultContent:"string"==typeof e.result.content?e.result.content:void 0,toolCancelledReason:e.result.ui.cancelledReason,toolIsError:e.result.ui.isError,onAppMessage:g,onUpdateModelContext:x,onRegisterTeardown:f,teardownRegistrationKey:"".concat(e.result.ui.serverName,"::").concat(e.result.ui.uri,"::").concat(v),onRequestDock:y?()=>{var t;return y({serverName:e.result.ui.serverName,uri:e.result.ui.uri,toolName:null!=(t=e.result.ui.toolName)?t:e.toolCall.function.name,toolArgs:e.toolCall.function.arguments,resultContent:"string"==typeof e.result.content?e.result.content:void 0,cancelledReason:e.result.ui.cancelledReason,isError:e.result.ui.isError})}:void 0})]})},v)})]})},eb=r.memo(function(e){var t,n,r;let i,{message:s,conversationId:u,nodeLabel:b,availableNodes:v,showRaw:j,toolCallPairs:w,onAppMessage:A,onUpdateModelContext:C,onRegisterAppTeardown:S,onOpenInCanvas:k,hoistedHandoffs:I,isBeingEdited:T,onMenuOpen:E,onToggleRaw:R}=e,N=null!=(n=s.depth)?n:0;return(0,o.jsxs)(l.default,{sx:{display:"flex",flexDirection:"column",alignItems:"user"===s.role?"flex-end":"flex-start",opacity:s.disabled?.5:1,...N>0&&{pl:3*N,borderLeft:"2px solid",borderColor:"divider",ml:1}},children:[(0,o.jsxs)(l.default,{sx:{display:"flex",alignItems:"center",mb:.5},children:[(0,o.jsxs)(a.A,{variant:"caption",color:"text.secondary",sx:{mr:1},children:["user"===s.role?"You":"assistant"===s.role?"Agent":"tool"===s.role?"Tool":"System"," • ","number"!=typeof(r=s.timestamp)||isNaN(r)?(ep.warn("formatTime received invalid timestamp:",r),"Invalid Date"):new Date(r).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})]}),s.processNodeId&&(0,o.jsx)(d.A,{title:"".concat(b?"".concat(b," — "):"","Process Node ID: ").concat(s.processNodeId),children:(0,o.jsx)(c.A,{label:"Node: ".concat(b||"".concat(s.processNodeId.substring(0,6),"...")),size:"small",color:"primary",variant:"outlined",sx:{height:20,fontSize:"0.7rem",mr:1}})}),N>0&&(0,o.jsx)(d.A,{title:"Nested subflow step (depth ".concat(N,")"),children:(0,o.jsx)(c.A,{label:"Subflow step",size:"small",color:"secondary",variant:"outlined",sx:{height:20,fontSize:"0.7rem",mr:1}})}),s.disabled&&(0,o.jsx)(c.A,{label:"Disabled",size:"small",color:"default",variant:"outlined",sx:{height:20,fontSize:"0.7rem"}}),s.usage&&(0,o.jsx)(d.A,{title:"".concat(s.usage.promptTokens.toLocaleString()," prompt + ").concat(s.usage.completionTokens.toLocaleString()," completion tokens (provider-reported)"),children:(0,o.jsx)(c.A,{label:"".concat((i=s.usage.totalTokens)>=1e3?"".concat((i/1e3).toFixed(i>=1e5?0:1),"k"):"".concat(i)," tok"),size:"small",color:"default",variant:"outlined",sx:{height:20,fontSize:"0.7rem",mr:1}})}),(0,o.jsx)(m.A,{size:"small",onClick:e=>E(e,s.id),sx:{ml:1},children:(0,o.jsx)(P.A,{fontSize:"small"})})]}),(0,o.jsxs)(g.A,{elevation:1,sx:{p:2,maxWidth:"75vw",borderRadius:2,bgcolor:"user"===s.role?"primary.light":"assistant"===s.role||"tool"===s.role?"background.paper":"info.light",color:"user"===s.role?"primary.contrastText":"assistant"===s.role||"tool"===s.role?"text.primary":"info.contrastText",position:"relative",borderLeft:"tool"===s.role?"4px solid":"none",borderColor:"tool"===s.role?"grey.400":"transparent",opacity:T?.55:1,outline:T?"2px dashed":"none",outlineColor:"warning.main",overflowWrap:"break-word",wordBreak:"break-word",overflow:"hidden"},children:[(0,o.jsxs)(o.Fragment,{children:["tool"!==s.role&&"string"==typeof s.content&&(0,o.jsx)(z.oz,{remarkPlugins:[M.A],components:eg,children:s.content}),"tool"!==s.role&&Array.isArray(s.content)&&(0,o.jsx)(l.default,{sx:{display:"flex",flexDirection:"column",gap:1},children:s.content.map((e,t)=>{var n;return(null==e?void 0:e.type)==="text"?(0,o.jsx)(z.oz,{remarkPlugins:[M.A],children:e.text},t):(null==e?void 0:e.type)==="image_url"&&(null==(n=e.image_url)?void 0:n.url)?(0,o.jsx)("img",{src:e.image_url.url,alt:"Image ".concat(t+1),style:{maxWidth:"100%",height:"auto",borderRadius:"4px"}},t):null})}),"tool"!==s.role&&s.media&&s.media.length>0&&(0,o.jsx)(ex,{media:s.media.filter(e=>"image"!==e.type||!Array.isArray(s.content)||!s.content.some(t=>{var n;return(null==t?void 0:t.type)==="image_url"&&(null==(n=t.image_url)?void 0:n.url)===eu(e)}))}),"tool"!==s.role&&"string"!=typeof s.content&&!Array.isArray(s.content)&&!eh(s)&&!(null==(t=s.media)?void 0:t.length)&&(0,o.jsx)(a.A,{variant:"body2",fontStyle:"italic",color:"text.secondary",children:"[No text content]"})]}),(()=>{let e=[...eh(s)?s.tool_calls.filter(e=>{var t;return!!(t=e.function.name)&&(t.startsWith(es.n9)||"handoff"===t)}):[],...null!=I?I:[]];return(0,o.jsx)(l.default,{sx:{mt:1,display:"flex",flexWrap:"wrap",gap:.5},children:e.map((e,t)=>(0,o.jsx)(c.A,{size:"small",variant:"outlined",color:"secondary",icon:(0,o.jsx)(Y.A,{fontSize:"small"}),label:"Handoff → ".concat(function(e,t){let n=e.startsWith(es.n9)?e.slice(es.n9.length):e,o=n.replace(/_\d+$/,""),r=t.find(e=>{let t=(0,es.RN)(e.label);return t===n||t===o});return(null==r?void 0:r.label)?r.label:o.split("_").filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")||"target node"}(e.function.name,v)),sx:{maxWidth:"100%",fontWeight:500}},e.id||"handoff-".concat(s.id,"-").concat(t)))})})(),w&&w.length>0&&(0,o.jsx)(ey,{pairs:w,messageId:s.id,conversationId:u,onAppMessage:A,onUpdateModelContext:C,onRegisterAppTeardown:S,onOpenInCanvas:k}),"tool"===s.role&&s.tool_call_id&&!em(s)&&(0,o.jsxs)(l.default,{children:[(0,o.jsxs)(a.A,{variant:"body2",sx:{display:"flex",alignItems:"center",color:"text.secondary",mb:1},children:[(0,o.jsx)(U.A,{fontSize:"small",sx:{mr:1}}),"The tool responded to the agent"]}),(0,o.jsxs)(x.A,{defaultExpanded:!1,sx:{mb:.5,"&:before":{display:"none"},boxShadow:"none",bgcolor:"rgba(0, 0, 0, 0.02)"},children:[(0,o.jsx)(f.A,{expandIcon:(0,o.jsx)(L.A,{}),children:(0,o.jsxs)(l.default,{sx:{display:"flex",alignItems:"center"},children:[(0,o.jsx)(U.A,{fontSize:"small",sx:{mr:1,color:"text.secondary"}}),(0,o.jsx)(a.A,{variant:"subtitle2",children:"Tool Result"}),(0,o.jsx)(c.A,{label:"ID: ".concat(s.tool_call_id.substring(0,8),"..."),size:"small",color:"default",variant:"outlined",sx:{ml:1,height:20,fontSize:"0.7rem"}}),(0,o.jsx)(p.A,{control:(0,o.jsx)(h.A,{size:"small",checked:j,onChange:e=>R(s.id,e.target.checked),onClick:e=>e.stopPropagation()}),label:"Raw",sx:{mr:1,ml:"auto","& .MuiTypography-root":{fontSize:"0.75rem"}},onClick:e=>e.stopPropagation()})]})}),(0,o.jsx)(y.A,{sx:{pt:0,pb:1,overflow:"hidden"},children:(0,o.jsx)(ef,{content:s.content,showRaw:j})})]})]}),s.attachments&&s.attachments.length>0&&(0,o.jsxs)(l.default,{sx:{mt:1,pt:1,borderTop:"1px solid",borderColor:"divider"},children:[(0,o.jsx)(a.A,{variant:"caption",color:"text.secondary",sx:{display:"block",mb:.5},children:"Attachments:"}),s.attachments.map(e=>"image"===e.type?(0,o.jsx)(l.default,{sx:{mb:.5},children:(0,o.jsx)("img",{src:e.content,alt:e.originalName||"image attachment",style:{maxWidth:"100%",height:"auto",borderRadius:"4px"}})},e.id):(0,o.jsxs)(l.default,{sx:{display:"flex",alignItems:"center",p:1,borderRadius:1,bgcolor:"rgba(0, 0, 0, 0.04)",mb:.5},children:["document"===e.type?(0,o.jsx)(W.A,{fontSize:"small",sx:{mr:1}}):(0,o.jsx)(_.A,{fontSize:"small",sx:{mr:1}}),(0,o.jsx)(a.A,{variant:"caption",sx:{wordBreak:"break-all"},children:e.originalName||"".concat(e.type," attachment")})]},e.id))]})]})]})}),ev=e=>{var t;let{elicitation:n,onSubmit:s,onCancel:d}=e,{elicitationId:c,message:u,requestedSchema:h}=n,m=null!=(t=null==h?void 0:h.properties)?t:{},x=Object.keys(m),[f,y]=(0,r.useState)(()=>{let e={};for(let t of x){let n=m[t];void 0!==n.default?e[t]=n.default:"boolean"===n.type?e[t]=!1:"number"===n.type||"integer"===n.type?e[t]=0:e[t]=""}return e}),k=(e,t)=>{y(n=>({...n,[e]:t}))};return(0,o.jsxs)(g.A,{elevation:2,sx:{p:2,mt:2,bgcolor:"info.light",border:"1px solid",borderColor:"info.main",borderRadius:2},children:[(0,o.jsx)(a.A,{variant:"h6",sx:{mb:1},children:"Server needs more information"}),(0,o.jsx)(a.A,{variant:"body2",sx:{mb:2},children:u}),(0,o.jsx)(l.default,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:x.map(e=>{let t=m[e],n=t.title||e,r=f[e];if("boolean"===t.type)return(0,o.jsx)(p.A,{control:(0,o.jsx)(b.A,{checked:!!r,onChange:t=>k(e,t.target.checked),size:"small"}),label:n},e);if(t.enum&&t.enum.length>0)return(0,o.jsxs)(v.A,{size:"small",sx:{minWidth:200},children:[(0,o.jsx)(j.A,{children:n}),(0,o.jsx)(w.A,{label:n,value:String(null!=r?r:""),onChange:t=>k(e,t.target.value),children:t.enum.map((e,n)=>{var r;return(0,o.jsx)(A.A,{value:e,children:(null==(r=t.enumNames)?void 0:r[n])||e},e)})}),t.description&&(0,o.jsx)(C.A,{children:t.description})]},e);let a="number"===t.type||"integer"===t.type;return(0,o.jsx)(S.A,{size:"small",label:n,type:a?"number":"text",value:String(null!=r?r:""),helperText:t.description,inputProps:{minLength:t.minLength,maxLength:t.maxLength,min:t.minimum,max:t.maximum},onChange:t=>{if(a){let n=parseFloat(t.target.value);k(e,isNaN(n)?0:n)}else k(e,t.target.value)}},e)})}),(0,o.jsxs)(l.default,{sx:{display:"flex",justifyContent:"flex-end",gap:1,mt:2},children:[(0,o.jsx)(i.A,{variant:"outlined",color:"inherit",size:"small",onClick:()=>{d&&d(c)},disabled:!d,children:"Cancel"}),(0,o.jsx)(i.A,{variant:"contained",color:"primary",size:"small",onClick:()=>{s&&s(c,f)},disabled:!s,children:"Submit"})]})]})},ej="Type your own answer",ew=e=>{let{question:t,onAnswer:n,onDecline:s}=e,{questionId:d,questions:c}=t,[u,h]=(0,r.useState)(()=>c.map(()=>[])),[m,x]=(0,r.useState)(()=>c.map(()=>"")),f=()=>c.map((e,t)=>{var n;return(null!=(n=u[t])?n:[]).map(e=>e===ej?m[t].trim():e).filter(e=>e.length>0)}),y=c.every((e,t)=>{var n;return(null!=(n=f()[t])?n:[]).length>0});return(0,o.jsxs)(g.A,{elevation:2,sx:{p:2,mt:2,bgcolor:"info.light",border:"1px solid",borderColor:"info.main",borderRadius:2},children:[(0,o.jsx)(a.A,{variant:"h6",sx:{mb:1},children:"The agent is asking"}),(0,o.jsx)(l.default,{sx:{display:"flex",flexDirection:"column",gap:2},children:c.map((e,t)=>{var n,r,a;return(0,o.jsxs)(v.A,{component:"fieldset",sx:{display:"flex"},children:[(0,o.jsx)(k.A,{sx:{mb:.5},children:e.prompt}),e.multiple?(0,o.jsx)(l.default,{sx:{display:"flex",flexDirection:"column"},children:e.options.map(e=>{var n;return(0,o.jsx)(p.A,{control:(0,o.jsx)(b.A,{size:"small",checked:(null!=(n=u[t])?n:[]).includes(e),onChange:()=>((e,t)=>{h(n=>{let o=n.map(e=>[...e]),r=o[e],a=r.indexOf(t);return a>=0?r.splice(a,1):r.push(t),o})})(t,e)}),label:e},e)})}):(0,o.jsx)(I.A,{value:null!=(r=(null!=(n=u[t])?n:[])[0])?r:"",onChange:e=>{var n;return n=e.target.value,void h(e=>{let o=e.map(e=>[...e]);return o[t]=[n],o})},children:e.options.map(e=>(0,o.jsx)(p.A,{value:e,control:(0,o.jsx)(T.A,{size:"small"}),label:e},e))}),(null!=(a=u[t])?a:[]).includes(ej)&&(0,o.jsx)(S.A,{size:"small",sx:{mt:1},placeholder:"Your answer…",value:m[t],onChange:e=>x(n=>{let o=[...n];return o[t]=e.target.value,o})})]},t)})}),(0,o.jsxs)(l.default,{sx:{display:"flex",justifyContent:"flex-end",gap:1,mt:2},children:[(0,o.jsx)(i.A,{variant:"outlined",color:"inherit",size:"small",onClick:()=>{s&&s(d)},disabled:!s,children:"Decline"}),(0,o.jsx)(i.A,{variant:"contained",color:"primary",size:"small",onClick:()=>{n&&n(d,f())},disabled:!n||!y,children:"Answer"})]})]})},eA=e=>{var t;let{messages:n,pendingToolCalls:d,pendingElicitation:u,availableNodes:p=[],conversationId:h,editingMessageId:m,onToggleDisabled:b,onSplitConversation:v,onRevertToHere:j,onBeginEditMessage:w,onApproveToolCall:C,onRejectToolCall:k,onSubmitElicitation:I,onCancelElicitation:T,pendingQuestion:z,onAnswerQuestion:M,onDeclineQuestion:P,onAppMessage:W,onUpdateModelContext:_,onRegisterAppTeardown:U,onOpenInCanvas:H,queuedMessages:J=[],queueHoldReason:Y=null}=e,[V,K]=(0,r.useState)({}),[Z,$]=(0,r.useState)(50);(0,r.useEffect)(()=>{$(50)},[h]);let Q=Math.max(0,(Array.isArray(n)?n.length:0)-Z),ee=(0,r.useMemo)(()=>Array.isArray(n)?Q>0?n.slice(Q):n:[],[n,Q]),{pairsByAnchorId:et,handoffsByAnchorId:en,consumedToolCallIds:eo,groups:er}=(0,r.useMemo)(()=>(function(e){let t=new Map,n=new Map,o=new Set,r=new Set,a=new Map,l=[];if(!Array.isArray(e))return{pairsByAnchorId:t,handoffsByAnchorId:n,hoistedAssistantIds:o,consumedToolCallIds:r,groups:l};let i=new Map;for(let t of e)"tool"===t.role&&"string"==typeof t.tool_call_id&&t.tool_call_id&&!i.has(t.tool_call_id)&&i.set(t.tool_call_id,t);let s=e=>{let o=a.get(e);return o||(o={anchorId:e,memberIds:[e],hoistedIds:[]},a.set(e,o),l.push(o),t.set(e,[]),n.set(e,[])),o},d=null;for(let a of e){if("user"===a.role||"system"===a.role){d=null;continue}if("assistant"!==a.role)continue;let e=Array.isArray(a.tool_calls)?a.tool_calls:[],l=[],p=[];for(let t of e){var c,u;if("function"!==t.type)continue;if(ed(null==(c=t.function)?void 0:c.name)){p.push(t);continue}let e=t.id,n=e?i.get(e):void 0;e&&r.add(e),l.push({toolCall:t,result:n,mcpDestination:e?null==(u=a.mcpToolCalls)?void 0:u[e]:void 0})}let h=function(e){let t=e.content;return"string"==typeof t?t.trim().length>0:!!Array.isArray(t)&&t.some(e=>{var t,n;return!!e&&"object"==typeof e&&("text"===e.type?"string"==typeof e.text&&e.text.trim().length>0:"image_url"===e.type?!!(null==(t=e.image_url)?void 0:t.url):"input_audio"===e.type&&!!(null==(n=e.input_audio)?void 0:n.data))})}(a),m=l.length>0||p.length>0;if(h){d=a.id,m&&(s(a.id),t.get(a.id).push(...l),n.get(a.id).push(...p));continue}if(m)if(d){let e=s(d);t.get(d).push(...l),n.get(d).push(...p),e.memberIds.push(a.id),e.hoistedIds.push(a.id),o.add(a.id)}else d=a.id,s(a.id),t.get(a.id).push(...l),n.get(a.id).push(...p)}return{pairsByAnchorId:t,handoffsByAnchorId:n,hoistedAssistantIds:o,consumedToolCallIds:r,groups:l}})(n),[n]),es=(0,r.useMemo)(()=>(function(e){let t=new Set;if(!Array.isArray(e))return t;for(let o of e){if("assistant"!==o.role)continue;let e=o.tool_calls;if(Array.isArray(e))for(let o of e){var n;"function"===o.type&&ed(null==(n=o.function)?void 0:n.name)&&"string"==typeof o.id&&o.id&&t.add(o.id)}}return t})(n),[n]),ec=(0,r.useMemo)(()=>new Set(ee.map(e=>e.id)),[ee]),{renderPairsById:eu,renderHandoffsById:eh,suppressedIds:eg}=(0,r.useMemo)(()=>{let e=new Map,t=new Map,n=new Set;for(let l of er){var o,r,a;let i=null!=(o=et.get(l.anchorId))?o:[],s=null!=(r=en.get(l.anchorId))?r:[],d=null!=(a=l.memberIds.find(e=>ec.has(e)))?a:l.anchorId;for(let o of(i.length>0&&e.set(d,i),s.length>0&&t.set(d,s),l.hoistedIds))o!==d&&n.add(o)}return{renderPairsById:e,renderHandoffsById:t,suppressedIds:n}},[er,et,en,ec]),[ex,ef]=r.useState(null),[ey,ej]=r.useState(null),[eA,eC]=r.useState(null),[eS,ek]=r.useState({}),eI=(0,r.useCallback)((e,t)=>{ep.debug("handleMenuOpen called with messageId: ".concat(t)),ef(e.currentTarget),ej(t)},[]),eT=(0,r.useCallback)((e,t)=>{ek(n=>({...n,[e]:t}))},[]),eE=()=>{ef(null),ej(null)},eR=()=>{ey&&(null==w||w(ey),eE())},eN=(0,r.useMemo)(()=>{let e=new Map;for(let t of p)e.set(t.id,t.label);return e},[p]),ez=(0,r.useMemo)(()=>ey&&n.find(e=>e.id===ey)||null,[ey,n]);return(0,o.jsxs)(l.default,{sx:{display:"flex",flexDirection:"column",gap:2},children:[Q>0&&(0,o.jsx)(l.default,{sx:{display:"flex",justifyContent:"center"},children:(0,o.jsxs)(i.A,{size:"small",variant:"outlined",onClick:()=>$(e=>e+200),children:["Show earlier messages (",Q," more)"]})}),ee.map((e,t)=>em(e)||"tool"===e.role&&"string"==typeof e.tool_call_id&&es.has(e.tool_call_id)||"tool"===e.role&&"string"==typeof e.tool_call_id&&eo.has(e.tool_call_id)||eg.has(e.id)?null:(0,o.jsx)(eb,{message:e,conversationId:h,nodeLabel:e.processNodeId?eN.get(e.processNodeId):void 0,availableNodes:p,showRaw:!!eS[e.id],toolCallPairs:eu.get(e.id),onAppMessage:W,onUpdateModelContext:_,onRegisterAppTeardown:U,onOpenInCanvas:H,hoistedHandoffs:eh.get(e.id),isBeingEdited:!!m&&e.id===m,onMenuOpen:eI,onToggleRaw:eT},e.id||"msg-".concat(Q+t))),J.map(e=>(0,o.jsx)(l.default,{"data-testid":"queued-bubble",sx:{display:"flex",justifyContent:"flex-end",opacity:.6},children:(0,o.jsxs)(l.default,{sx:{maxWidth:"70%",bgcolor:"primary.light",color:"primary.contrastText",borderRadius:2,px:2,py:1,display:"flex",flexDirection:"column",gap:.5},children:[(0,o.jsx)(a.A,{variant:"body2",sx:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:e.content||(e.attachments.length>0?"".concat(e.attachments.length," attachment(s)"):"")}),(0,o.jsxs)(l.default,{sx:{display:"flex",alignItems:"center",gap:.5,justifyContent:"flex-end"},children:[!Y&&(0,o.jsx)(s.default,{size:10,color:"inherit"}),(0,o.jsx)(a.A,{variant:"caption",sx:{opacity:.85},children:null!=Y?Y:"Queued"})]})]})},e.id)),(0,o.jsxs)(E.A,{anchorEl:ex,open:!!ex,onClose:eE,children:[ez&&(()=>{ep.debug("Entering menu item rendering logic",{activeMessageId:ey}),ep.debug("Active message object for menu:",ez),ep.debug("Active message role for menu:",null==ez?void 0:ez.role);try{if("user"===ez.role&&"string"==typeof ez.content&&w)return(0,o.jsxs)(A.A,{onClick:eR,children:[(0,o.jsx)(R.A,{children:(0,o.jsx)(X.A,{fontSize:"small"})}),(0,o.jsx)(N.A,{children:"Edit Message"})]});return null}catch(e){return ep.error("Error rendering Edit Message menu item",{error:e}),null}})(),(0,o.jsxs)(A.A,{onClick:()=>{ey&&(b(ey),eE())},children:[(0,o.jsx)(R.A,{children:(0,o.jsx)(D.A,{fontSize:"small"})}),(0,o.jsx)(N.A,{children:(null==ez?void 0:ez.disabled)?"Enable Message":"Disable Message"})]}),(0,o.jsxs)(A.A,{onClick:()=>{ey&&(v(ey),eE())},children:[(0,o.jsx)(R.A,{children:(0,o.jsx)(O.A,{fontSize:"small"})}),(0,o.jsx)(N.A,{children:"Split Conversation Here"})]}),el.G.ENABLE_REVERT_TO_HERE&&(null==ez||null==(t=ez.changedFiles)?void 0:t.length)?(0,o.jsxs)(A.A,{onClick:()=>{ey&&(eC(ey),eE())},children:[(0,o.jsx)(R.A,{children:(0,o.jsx)(q.A,{fontSize:"small"})}),(0,o.jsx)(N.A,{children:"Revert to here"})]}):null]}),el.G.ENABLE_REVERT_TO_HERE&&h&&(0,o.jsx)(ea,{open:!!eA,conversationId:h,messageId:eA,onClose:()=>eC(null),onReverted:j}),u&&(0,o.jsx)(ev,{elicitation:u,onSubmit:I,onCancel:T}),z&&(0,o.jsx)(ew,{question:z,onAnswer:M,onDecline:P}),d&&d.length>0&&(0,o.jsxs)(g.A,{elevation:2,sx:{p:2,mt:2,bgcolor:"warning.light",border:"1px solid",borderColor:"warning.main",borderRadius:2},children:[(0,o.jsxs)(a.A,{variant:"h6",sx:{mb:1,display:"flex",alignItems:"center"},children:[(0,o.jsx)(F.A,{sx:{mr:1}})," Tool Approval Required"]}),(0,o.jsx)(a.A,{variant:"body2",sx:{mb:2},children:"The agent wants to use the following tool(s). Please approve or reject each request."}),d.map((e,t)=>{var n;let r=(0,ei.yo)(e.function.name),s=e.function.arguments;try{let t=JSON.parse(e.function.arguments);s=JSON.stringify(t,null,2)}catch(e){}return(0,o.jsxs)(x.A,{defaultExpanded:!0,sx:{mb:1,"&:before":{display:"none"},boxShadow:1},children:[(0,o.jsx)(f.A,{expandIcon:(0,o.jsx)(L.A,{}),children:(0,o.jsxs)(l.default,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[(0,o.jsx)(F.A,{fontSize:"small",sx:{mr:1,color:"primary.main"}}),(0,o.jsx)(a.A,{variant:"subtitle2",sx:{fontWeight:"bold",flexGrow:1},children:r}),(0,o.jsx)(c.A,{label:"ID: ".concat(e.id?e.id.substring(0,8):"N/A","..."),size:"small",variant:"outlined",sx:{ml:1,height:20,fontSize:"0.7rem"}})]})}),(0,o.jsxs)(y.A,{sx:{pt:0},children:[(0,o.jsx)(l.default,{component:"pre",sx:{bgcolor:"action.hover",p:1,borderRadius:"4px",overflowX:"auto",fontFamily:"monospace",fontSize:"0.75rem",my:.5,maxHeight:"150px",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s}),(0,o.jsx)(S.A,{label:"Rejection reason (optional)",placeholder:"e.g. write to dist/ instead",value:null!=(n=V[e.id])?n:"",onChange:t=>K(n=>({...n,[e.id]:t.target.value})),multiline:!0,minRows:1,maxRows:4,fullWidth:!0,size:"small",sx:{mt:1,mb:1}}),(0,o.jsxs)(l.default,{sx:{display:"flex",justifyContent:"flex-end",gap:1,mt:1,flexWrap:"wrap"},children:[(0,o.jsx)(i.A,{variant:"outlined",color:"error",size:"small",startIcon:(0,o.jsx)(B.A,{}),onClick:()=>{var t;return k&&k(e.id,!1,(null==(t=V[e.id])?void 0:t.trim())||void 0)},disabled:!k,children:"Reject"}),(0,o.jsx)(i.A,{variant:"outlined",color:"error",size:"small",onClick:()=>k&&k(e.id,!0),disabled:!k,title:"Always deny this tool — saves a rule so future calls are auto-denied",children:"Always Deny"}),(0,o.jsx)(i.A,{variant:"outlined",color:"success",size:"small",startIcon:(0,o.jsx)(G.A,{}),onClick:()=>C&&C(e.id,!0),disabled:!C,title:"Always allow this tool — saves a rule so future calls are auto-approved",children:"Always Allow"}),(0,o.jsx)(i.A,{variant:"contained",color:"success",size:"small",startIcon:(0,o.jsx)(G.A,{}),onClick:()=>C&&C(e.id),disabled:!C,children:"Approve"})]})]})]},e.id||"ptc-".concat(t))})]})]})}},77890:(e,t,n)=>{n.d(t,{pX:()=>o});function o(e,t,n,o){let r="".concat(e.type,"-bottom"),a="".concat(t.type,"-top");return{id:"".concat(e.id,":").concat(r,"->").concat(t.id,":").concat(a),source:e.id,sourceHandle:r,target:t.id,targetHandle:a,type:"custom",data:{edgeType:"standard",...n?{bidirectional:!0}:{},...o?{condition:o}:{}},animated:!0}}},84869:(e,t,n)=>{n.d(t,{G:()=>l,S:()=>a});let o=(0,n(73288).h)("frontend/services/transcription/webSpeech"),r=()=>"webkitSpeechRecognition"in window||"SpeechRecognition"in window;async function a(e,t){if(!r())throw Error("Web Speech API is not supported in this browser");o.debug("Starting Web Speech API transcription");try{let n=URL.createObjectURL(e),r=new Audio(n),a=new(window.SpeechRecognition||window.webkitSpeechRecognition);return a.continuous=!0,a.interimResults=!0,(null==t?void 0:t.language)&&(a.lang=t.language),new Promise((e,n)=>{let l="";a.onresult=e=>{let n="";for(let t=e.resultIndex;t<e.results.length;t++){let o=e.results[t][0].transcript;e.results[t].isFinal?l+=o+" ":n+=o}(null==t?void 0:t.onInterimResult)&&t.onInterimResult(l+n),o.debug("Recognition interim result",{finalLength:l.length,interimLength:n.length})},a.onend=()=>{o.debug("Recognition ended",{transcriptLength:l.length}),e(l.trim())},a.onerror=e=>{o.error("Recognition error",{error:e.error}),n(Error("Speech recognition error: ".concat(e.error)))},r.onplay=()=>{a.start(),o.debug("Recognition started")},r.onended=()=>{a.stop(),o.debug("Audio playback ended")},r.onerror=e=>{o.error("Audio playback error",{error:e}),a.stop(),n(Error("Error playing audio"))},r.play().catch(e=>{o.error("Error starting audio playback",{error:e}),n(e)})})}catch(e){throw o.error("Error in Web Speech API transcription",{error:e}),e}}function l(){return{supported:r(),message:r()?"Web Speech API is supported":"Web Speech API is not supported in this browser"}}},93764:(e,t,n)=>{n.d(t,{Cm:()=>u,JL:()=>s,p9:()=>i,wn:()=>d,y2:()=>c});var o=n(18037),r=n(57563);function a(e,t,n){return t.filter(t=>{var o;return!(0,r.BY)(t)&&(t.source===e?t.target!==n:t.target===e&&null!=(o=t.data)&&!!o.bidirectional&&t.source!==n)})}function l(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!e.source||!e.target||!e.sourceHandle||!e.targetHandle)return"Missing source, target, or handles";let o=t.find(t=>t.id===e.source),l=t.find(t=>t.id===e.target);if(!o||!l)return"Source or target node not found";let i=(0,r.vC)(o.type,e.sourceHandle,l.type,e.targetHandle);return i||("subflow"===o.type&&a(o.id,n,e.target).length>0?"Subflow nodes can only have one outgoing connection":null)}function i(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return null===l(e,t,n)}function s(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=l(e,t,n);return!o||(console.error("Invalid connection: ".concat(o),e),!1)}function d(e,t,n){let a=t.find(t=>t.id===e.source),l=t.find(t=>t.id===e.target),i=e.sourceHandle,s=e.targetHandle,d=(null==a?void 0:a.type)==="mcp"||(null==l?void 0:l.type)==="mcp"||(0,r.z5)(i)||(0,r.z5)(s),c=!d&&((null==a?void 0:a.type)==="resource"||(null==l?void 0:l.type)==="resource"||(0,r.vM)(i)||(0,r.vM)(s)),u="".concat(e.source,":").concat(i,"->").concat(e.target,":").concat(s);return d?{id:u,...e,type:"mcpEdge",data:{edgeType:"mcp"},animated:!1,markerEnd:o.Ud.markerEnd,markerStart:o.Ud.markerStart,style:o.Ud.style}:c?{id:u,...e,type:"resourceEdge",data:{edgeType:"resource"},animated:!1,markerEnd:o.MG.markerEnd,style:o.MG.style}:{id:u,...e,type:"custom",data:{edgeType:"standard",...n?{condition:n}:{}},animated:!0}}function c(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=t.find(t=>t.id===e.source),l=t.find(t=>t.id===e.target);return!!o&&!!l&&("subflow"!==l.type||!(a(l.id,n,e.source).length>0))&&null===(0,r.vC)(l.type,null,o.type,null)}function u(e,t){let n=e=>{var t;return null==(t=e.data)?void 0:t.edgeType},o=e=>"mcp"===n(e),r=e=>"resource"===n(e);return t.filter(t=>t.id===e.id||(o(e)?o(t)&&(t.source===e.source&&t.target===e.target||t.source===e.target&&t.target===e.source):r(e)?r(t)&&t.source===e.source&&t.target===e.target:!o(t)&&!r(t)&&t.source===e.source&&t.target===e.target)).map(e=>e.id)}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6417],{11587:(t,e,r)=>{r.d(e,{A:()=>n});var o=r(15485),a=r(95155);let n=(0,o.A)([(0,a.jsx)("path",{d:"M21 8c-1.45 0-2.26 1.44-1.93 2.51l-3.55 3.56c-.3-.09-.74-.09-1.04 0l-2.55-2.55C12.27 10.45 11.46 9 10 9c-1.45 0-2.27 1.44-1.93 2.52l-4.56 4.55C2.44 15.74 1 16.55 1 18c0 1.1.9 2 2 2 1.45 0 2.26-1.44 1.93-2.51l4.55-4.56c.3.09.74.09 1.04 0l2.55 2.55C12.73 16.55 13.54 18 15 18c1.45 0 2.27-1.44 1.93-2.52l3.56-3.55c1.07.33 2.51-.48 2.51-1.93 0-1.1-.9-2-2-2"},"0"),(0,a.jsx)("path",{d:"m15 9 .94-2.07L18 6l-2.06-.93L15 3l-.92 2.07L12 6l2.08.93zM3.5 11 4 9l2-.5L4 8l-.5-2L3 8l-2 .5L3 9z"},"1")],"InsightsRounded")},13315:(t,e,r)=>{r.d(e,{Ay:()=>H});var o=r(12115),a=r(2821),n=r(57001),i=r(46320),s=r(56682),l=r(9488),c=r(12549),p=r(44017),d=r(69582),u=r(33567),h=r(47250),v=r(29149),m=r(95155);function f(t,e,r){let o=function(t,e,r){let o,a=e.getBoundingClientRect(),n=r&&r.getBoundingClientRect(),i=(0,v.A)(e);if(e.fakeTransform)o=e.fakeTransform;else{let t=i.getComputedStyle(e);o=t.getPropertyValue("-webkit-transform")||t.getPropertyValue("transform")}let s=0,l=0;if(o&&"none"!==o&&"string"==typeof o){let t=o.split("(")[1].split(")")[0].split(",");s=parseInt(t[4],10),l=parseInt(t[5],10)}return"left"===t?n?"translateX(".concat(n.right+s-a.left,"px)"):"translateX(".concat(i.innerWidth+s-a.left,"px)"):"right"===t?n?"translateX(-".concat(a.right-n.left-s,"px)"):"translateX(-".concat(a.left+a.width-s,"px)"):"up"===t?n?"translateY(".concat(n.bottom+l-a.top,"px)"):"translateY(".concat(i.innerHeight+l-a.top,"px)"):n?"translateY(-".concat(a.top-n.top+a.height-l,"px)"):"translateY(-".concat(a.top+a.height-l,"px)")}(t,e,"function"==typeof r?r():r);o&&(e.style.webkitTransform=o,e.style.transform=o)}let g=o.forwardRef(function(t,e){let r=(0,u.A)(),a={enter:r.transitions.easing.easeOut,exit:r.transitions.easing.sharp},n={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{addEndListener:i,appear:s=!0,children:g,container:y,direction:A="down",easing:b=a,in:x,onEnter:k,onEntered:L,onEntering:M,onExit:B,onExited:w,onExiting:C,style:R,timeout:S=n,TransitionComponent:I=l.Ay,...z}=t,T=o.useRef(null),j=(0,d.A)((0,c.A)(g),T,e),H=t=>e=>{t&&(void 0===e?t(T.current):t(T.current,e))},P=H((t,e)=>{f(A,t,y),(0,h.q)(t),k&&k(t,e)}),E=H((t,e)=>{let o=(0,h.c)({timeout:S,style:R,easing:b},{mode:"enter"});t.style.webkitTransition=r.transitions.create("-webkit-transform",{...o}),t.style.transition=r.transitions.create("transform",{...o}),t.style.webkitTransform="none",t.style.transform="none",M&&M(t,e)}),D=H(L),O=H(C),V=H(t=>{let e=(0,h.c)({timeout:S,style:R,easing:b},{mode:"exit"});t.style.webkitTransition=r.transitions.create("-webkit-transform",e),t.style.transition=r.transitions.create("transform",e),f(A,t,y),B&&B(t)}),F=H(t=>{t.style.webkitTransition="",t.style.transition="",w&&w(t)}),N=o.useCallback(()=>{T.current&&f(A,T.current,y)},[A,y]);return o.useEffect(()=>{if(x||"down"===A||"right"===A)return;let t=(0,p.A)(()=>{T.current&&f(A,T.current,y)}),e=(0,v.A)(T.current);return e.addEventListener("resize",t),()=>{t.clear(),e.removeEventListener("resize",t)}},[A,x,y]),o.useEffect(()=>{x||N()},[x,N]),(0,m.jsx)(I,{nodeRef:T,onEnter:P,onEntered:D,onEntering:E,onExit:V,onExited:F,onExiting:O,addEndListener:t=>{i&&i(T.current,t)},appear:s,in:x,timeout:S,...z,children:(t,e)=>{let{ownerState:r,...a}=e;return o.cloneElement(g,{ref:j,style:{visibility:"exited"!==t||x?void 0:"hidden",...R,...g.props.style},...a})}})});var y=r(2300),A=r(81852),b=r(30424),x=r(48116),k=r(66964),L=r(16625),M=r(85795),B=r(95195);function w(t){return(0,B.Ay)("MuiDrawer",t)}(0,M.A)("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);var C=r(77765),R=r(85560);let S=(t,e)=>{let{ownerState:r}=t;return[e.root,("permanent"===r.variant||"persistent"===r.variant)&&e.docked,e.modal]},I=(0,x.Ay)(s.A,{name:"MuiDrawer",slot:"Root",overridesResolver:S})((0,k.A)(t=>{let{theme:e}=t;return{zIndex:(e.vars||e).zIndex.drawer}})),z=(0,x.Ay)("div",{shouldForwardProp:b.A,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:S})({flex:"0 0 auto"}),T=(0,x.Ay)(y.A,{name:"MuiDrawer",slot:"Paper",overridesResolver:(t,e)=>{let{ownerState:r}=t;return[e.paper,e["paperAnchor".concat((0,A.A)(r.anchor))],"temporary"!==r.variant&&e["paperAnchorDocked".concat((0,A.A)(r.anchor))]]}})((0,k.A)(t=>{let{theme:e}=t;return{overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:t=>{let{ownerState:e}=t;return"left"===e.anchor&&"temporary"!==e.variant},style:{borderRight:"1px solid ".concat((e.vars||e).palette.divider)}},{props:t=>{let{ownerState:e}=t;return"top"===e.anchor&&"temporary"!==e.variant},style:{borderBottom:"1px solid ".concat((e.vars||e).palette.divider)}},{props:t=>{let{ownerState:e}=t;return"right"===e.anchor&&"temporary"!==e.variant},style:{borderLeft:"1px solid ".concat((e.vars||e).palette.divider)}},{props:t=>{let{ownerState:e}=t;return"bottom"===e.anchor&&"temporary"!==e.variant},style:{borderTop:"1px solid ".concat((e.vars||e).palette.divider)}}]}})),j={left:"right",right:"left",top:"down",bottom:"up"},H=o.forwardRef(function(t,e){let r=(0,L.b)({props:t,name:"MuiDrawer"}),s=(0,u.A)(),l=(0,i.I)(),c={enter:s.transitions.duration.enteringScreen,exit:s.transitions.duration.leavingScreen},{anchor:p="left",BackdropProps:d,children:h,className:v,elevation:f=16,hideBackdrop:y=!1,ModalProps:{BackdropProps:b,...x}={},onClose:k,open:M=!1,PaperProps:B={},SlideProps:S,TransitionComponent:H,transitionDuration:P=c,variant:E="temporary",slots:D={},slotProps:O={},...V}=r,F=o.useRef(!1);o.useEffect(()=>{F.current=!0},[]);let N=function(t,e){let{direction:r}=t;return"rtl"===r&&["left","right"].includes(e)?j[e]:e}({direction:l?"rtl":"ltr"},p),X={...r,anchor:p,elevation:f,open:M,variant:E,...V},Y=(t=>{let{classes:e,anchor:r,variant:o}=t,a={root:["root","anchor".concat((0,A.A)(r))],docked:[("permanent"===o||"persistent"===o)&&"docked"],modal:["modal"],paper:["paper","paperAnchor".concat((0,A.A)(r)),"temporary"!==o&&"paperAnchorDocked".concat((0,A.A)(r))]};return(0,n.A)(a,w,e)})(X),G={slots:{transition:H,...D},slotProps:{paper:B,transition:S,...O,backdrop:(0,R.A)(O.backdrop||{...d,...b},{transitionDuration:P})}},[W,q]=(0,C.A)("root",{ref:e,elementType:I,className:(0,a.A)(Y.root,Y.modal,v),shouldForwardComponentProp:!0,ownerState:X,externalForwardedProps:{...G,...V,...x},additionalProps:{open:M,onClose:k,hideBackdrop:y,slots:{backdrop:G.slots.backdrop},slotProps:{backdrop:G.slotProps.backdrop}}}),[_,U]=(0,C.A)("paper",{elementType:T,shouldForwardComponentProp:!0,className:(0,a.A)(Y.paper,B.className),ownerState:X,externalForwardedProps:G,additionalProps:{elevation:"temporary"===E?f:0,square:!0}}),[Q,J]=(0,C.A)("docked",{elementType:z,ref:e,className:(0,a.A)(Y.root,Y.docked,v),ownerState:X,externalForwardedProps:G,additionalProps:V}),[K,Z]=(0,C.A)("transition",{elementType:g,ownerState:X,externalForwardedProps:G,additionalProps:{in:M,direction:j[N],timeout:P,appear:F.current}}),$=(0,m.jsx)(_,{...U,children:h});if("permanent"===E)return(0,m.jsx)(Q,{...J,children:$});let tt=(0,m.jsx)(K,{...Z,children:$});return"persistent"===E?(0,m.jsx)(Q,{...J,children:tt}):(0,m.jsx)(W,{...q,children:tt})})},15712:(t,e,r)=>{r.d(e,{A:()=>p});var o=r(12115),a=r.t(o,2),n=r(89255),i=r(19868),s=r(9027);let l={...a}.useSyncExternalStore;function c(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{themeId:e}=t;return function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=(0,s.A)();a&&e&&(a=a[e]||a);let c="undefined"!=typeof window&&void 0!==window.matchMedia,{defaultMatches:p=!1,matchMedia:d=c?window.matchMedia:null,ssrMatchMedia:u=null,noSsr:h=!1}=(0,i.A)({name:"MuiUseMediaQuery",props:r,theme:a}),v="function"==typeof t?t(a):t;return(v=v.replace(/^@media( ?)/m,"")).includes("print")&&console.warn("MUI: You have provided a `print` query to the `useMediaQuery` hook.\nUsing the print media query to modify print styles can lead to unexpected results.\nConsider using the `displayPrint` field in the `sx` prop instead.\nMore information about `displayPrint` on our docs: https://mui.com/system/display/#display-in-print."),(void 0!==l?function(t,e,r,a,n){let i=o.useCallback(()=>e,[e]),s=o.useMemo(()=>{if(n&&r)return()=>r(t).matches;if(null!==a){let{matches:e}=a(t);return()=>e}return i},[i,t,a,n,r]),[c,p]=o.useMemo(()=>{if(null===r)return[i,()=>()=>{}];let e=r(t);return[()=>e.matches,t=>(e.addEventListener("change",t),()=>{e.removeEventListener("change",t)})]},[i,r,t]);return l(p,c,s)}:function(t,e,r,a,i){let[s,l]=o.useState(()=>i&&r?r(t).matches:a?a(t).matches:e);return(0,n.A)(()=>{if(!r)return;let e=r(t),o=()=>{l(e.matches)};return o(),e.addEventListener("change",o),()=>{e.removeEventListener("change",o)}},[t,r]),s})(v,p,d,u,h)}}c();let p=c({themeId:r(46892).A})},17417:(t,e,r)=>{r.d(e,{A:()=>n});var o=r(15485),a=r(95155);let n=(0,o.A)((0,a.jsx)("path",{d:"M4 18h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1m0-5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1M3 7c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1"}),"MenuRounded")},27530:(t,e,r)=>{r.d(e,{A:()=>n});var o=r(15485),a=r(95155);let n=(0,o.A)((0,a.jsx)("path",{d:"M20 2H4c-1 0-2 .9-2 2v3.01c0 .72.43 1.34 1 1.69V20c0 1.1 1.1 2 2 2h14c.9 0 2-.9 2-2V8.7c.57-.35 1-.97 1-1.69V4c0-1.1-1-2-2-2m-6 12h-4c-.55 0-1-.45-1-1s.45-1 1-1h4c.55 0 1 .45 1 1s-.45 1-1 1m6-7H4V4h16z"}),"Inventory2Rounded")},30354:(t,e,r)=>{r.d(e,{A:()=>v});var o=r(12115),a=r(2821),n=r(57001),i=r(48116),s=r(66964),l=r(16625),c=r(85795),p=r(95195);function d(t){return(0,p.Ay)("MuiToolbar",t)}(0,c.A)("MuiToolbar",["root","gutters","regular","dense"]);var u=r(95155);let h=(0,i.Ay)("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:r}=t;return[e.root,!r.disableGutters&&e.gutters,e[r.variant]]}})((0,s.A)(t=>{let{theme:e}=t;return{position:"relative",display:"flex",alignItems:"center",variants:[{props:t=>{let{ownerState:e}=t;return!e.disableGutters},style:{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}},{props:{variant:"dense"},style:{minHeight:48}},{props:{variant:"regular"},style:e.mixins.toolbar}]}})),v=o.forwardRef(function(t,e){let r=(0,l.b)({props:t,name:"MuiToolbar"}),{className:o,component:i="div",disableGutters:s=!1,variant:c="regular",...p}=r,v={...r,component:i,disableGutters:s,variant:c},m=(t=>{let{classes:e,disableGutters:r,variant:o}=t;return(0,n.A)({root:["root",!r&&"gutters",o]},d,e)})(v);return(0,u.jsx)(h,{as:i,className:(0,a.A)(m.root,o),ref:e,ownerState:v,...p})})},41610:(t,e,r)=>{r.d(e,{A:()=>n});var o=r(15485),a=r(95155);let n=(0,o.A)((0,a.jsx)("path",{d:"M20 8.69V5c0-.55-.45-1-1-1h-3.69l-2.6-2.6a.996.996 0 0 0-1.41 0L8.69 4H5c-.55 0-1 .45-1 1v3.69l-2.6 2.6c-.39.39-.39 1.02 0 1.41L4 15.3V19c0 .55.45 1 1 1h3.69l2.6 2.6c.39.39 1.02.39 1.41 0l2.6-2.6H19c.55 0 1-.45 1-1v-3.69l2.6-2.6c.39-.39.39-1.02 0-1.41zM12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6m0-10c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4"}),"Brightness7Rounded")},43634:(t,e,r)=>{r.d(e,{A:()=>n});var o=r(15485),a=r(95155);let n=(0,o.A)([(0,a.jsx)("path",{d:"M17.5 4.5c-1.95 0-4.05.4-5.5 1.5-1.45-1.1-3.55-1.5-5.5-1.5-1.45 0-2.99.22-4.28.79C1.49 5.62 1 6.33 1 7.14v11.28c0 1.3 1.22 2.26 2.48 1.94.98-.25 2.02-.36 3.02-.36 1.56 0 3.22.26 4.56.92.6.3 1.28.3 1.87 0 1.34-.67 3-.92 4.56-.92 1 0 2.04.11 3.02.36 1.26.33 2.48-.63 2.48-1.94V7.14c0-.81-.49-1.52-1.22-1.85-1.28-.57-2.82-.79-4.27-.79M21 17.23c0 .63-.58 1.09-1.2.98-.75-.14-1.53-.2-2.3-.2-1.7 0-4.15.65-5.5 1.5V8c1.35-.85 3.8-1.5 5.5-1.5.92 0 1.83.09 2.7.28.46.1.8.51.8.98z"},"0"),(0,a.jsx)("path",{d:"M13.98 11.01c-.32 0-.61-.2-.71-.52-.13-.39.09-.82.48-.94 1.54-.5 3.53-.66 5.36-.45.41.05.71.42.66.83s-.42.71-.83.66c-1.62-.19-3.39-.04-4.73.39-.08.01-.16.03-.23.03m0 2.66c-.32 0-.61-.2-.71-.52-.13-.39.09-.82.48-.94 1.53-.5 3.53-.66 5.36-.45.41.05.71.42.66.83s-.42.71-.83.66c-1.62-.19-3.39-.04-4.73.39-.08.02-.16.03-.23.03m0 2.66c-.32 0-.61-.2-.71-.52-.13-.39.09-.82.48-.94 1.53-.5 3.53-.66 5.36-.45.41.05.71.42.66.83s-.42.7-.83.66c-1.62-.19-3.39-.04-4.73.39-.08.02-.16.03-.23.03"},"1")],"MenuBookRounded")},48989:(t,e,r)=>{r.d(e,{A:()=>f});var o=r(12115),a=r(2821),n=r(57001),i=r(48116),s=r(66964),l=r(16625),c=r(81852),p=r(85795),d=r(95195);function u(t){return(0,d.Ay)("MuiListSubheader",t)}(0,p.A)("MuiListSubheader",["root","colorPrimary","colorInherit","gutters","inset","sticky"]);var h=r(95155);let v=(0,i.Ay)("li",{name:"MuiListSubheader",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:r}=t;return[e.root,"default"!==r.color&&e["color".concat((0,c.A)(r.color))],!r.disableGutters&&e.gutters,r.inset&&e.inset,!r.disableSticky&&e.sticky]}})((0,s.A)(t=>{let{theme:e}=t;return{boxSizing:"border-box",lineHeight:"48px",listStyle:"none",color:(e.vars||e).palette.text.secondary,fontFamily:e.typography.fontFamily,fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.pxToRem(14),variants:[{props:{color:"primary"},style:{color:(e.vars||e).palette.primary.main}},{props:{color:"inherit"},style:{color:"inherit"}},{props:t=>{let{ownerState:e}=t;return!e.disableGutters},style:{paddingLeft:16,paddingRight:16}},{props:t=>{let{ownerState:e}=t;return e.inset},style:{paddingLeft:72}},{props:t=>{let{ownerState:e}=t;return!e.disableSticky},style:{position:"sticky",top:0,zIndex:1,backgroundColor:(e.vars||e).palette.background.paper}}]}})),m=o.forwardRef(function(t,e){let r=(0,l.b)({props:t,name:"MuiListSubheader"}),{className:o,color:i="default",component:s="li",disableGutters:p=!1,disableSticky:d=!1,inset:m=!1,...f}=r,g={...r,color:i,component:s,disableGutters:p,disableSticky:d,inset:m},y=(t=>{let{classes:e,color:r,disableGutters:o,inset:a,disableSticky:i}=t,s={root:["root","default"!==r&&"color".concat((0,c.A)(r)),!o&&"gutters",a&&"inset",!i&&"sticky"]};return(0,n.A)(s,u,e)})(g);return(0,h.jsx)(v,{as:s,className:(0,a.A)(y.root,o),ref:e,ownerState:g,...f})});m&&(m.muiSkipListHighlight=!0);let f=m},58081:(t,e,r)=>{r.d(e,{A:()=>i,Y:()=>n});var o=r(85795),a=r(95195);function n(t){return(0,a.Ay)("MuiListItemButton",t)}let i=(0,o.A)("MuiListItemButton",["root","focusVisible","dense","alignItemsFlexStart","disabled","divider","gutters","selected"])},62617:(t,e,r)=>{r.d(e,{A:()=>n});var o=r(15485),a=r(95155);let n=(0,o.A)((0,a.jsx)("path",{d:"M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5s-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20zm-6 8h-4v-2h4zm0-4h-4v-2h4z"}),"BugReport")},63417:(t,e,r)=>{r.d(e,{A:()=>y});var o=r(12115),a=r(2821),n=r(57001),i=r(48116),s=r(66964),l=r(16625),c=r(81852),p=r(74798),d=r(2300),u=r(85795),h=r(95195);function v(t){return(0,h.Ay)("MuiAppBar",t)}(0,u.A)("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);var m=r(95155);let f=(t,e)=>t?"".concat(null==t?void 0:t.replace(")",""),", ").concat(e,")"):e,g=(0,i.Ay)(d.A,{name:"MuiAppBar",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:r}=t;return[e.root,e["position".concat((0,c.A)(r.position))],e["color".concat((0,c.A)(r.color))]]}})((0,s.A)(t=>{let{theme:e}=t;return{display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0,variants:[{props:{position:"fixed"},style:{position:"fixed",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}}},{props:{position:"absolute"},style:{position:"absolute",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"sticky"},style:{position:"sticky",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"static"},style:{position:"static"}},{props:{position:"relative"},style:{position:"relative"}},{props:{color:"inherit"},style:{"--AppBar-color":"inherit"}},{props:{color:"default"},style:{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[100],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[100]),...e.applyStyles("dark",{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[900],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[900])})}},...Object.entries(e.palette).filter((0,p.A)(["contrastText"])).map(t=>{var r,o;let[a]=t;return{props:{color:a},style:{"--AppBar-background":(null!=(r=e.vars)?r:e).palette[a].main,"--AppBar-color":(null!=(o=e.vars)?o:e).palette[a].contrastText}}}),{props:t=>!0===t.enableColorOnDark&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)"}},{props:t=>!1===t.enableColorOnDark&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundColor:e.vars?f(e.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:e.vars?f(e.vars.palette.AppBar.darkColor,"var(--AppBar-color)"):null})}},{props:{color:"transparent"},style:{"--AppBar-background":"transparent","--AppBar-color":"inherit",backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundImage:"none"})}}]}})),y=o.forwardRef(function(t,e){let r=(0,l.b)({props:t,name:"MuiAppBar"}),{className:o,color:i="primary",enableColorOnDark:s=!1,position:p="fixed",...d}=r,u={...r,color:i,position:p,enableColorOnDark:s},h=(t=>{let{color:e,position:r,classes:o}=t,a={root:["root","color".concat((0,c.A)(e)),"position".concat((0,c.A)(r))]};return(0,n.A)(a,v,o)})(u);return(0,m.jsx)(g,{square:!0,component:"header",ownerState:u,elevation:4,className:(0,a.A)(h.root,o,"fixed"===p&&"mui-fixed"),ref:e,...d})})},70723:(t,e,r)=>{r.d(e,{A:()=>n});var o=r(15485),a=r(95155);let n=(0,o.A)((0,a.jsx)("path",{d:"M19.5 12c0-.23-.01-.45-.03-.68l1.86-1.41c.4-.3.51-.86.26-1.3l-1.87-3.23c-.25-.44-.79-.62-1.25-.42l-2.15.91c-.37-.26-.76-.49-1.17-.68l-.29-2.31c-.06-.5-.49-.88-.99-.88h-3.73c-.51 0-.94.38-1 .88l-.29 2.31c-.41.19-.8.42-1.17.68l-2.15-.91c-.46-.2-1-.02-1.25.42L2.41 8.62c-.25.44-.14.99.26 1.3l1.86 1.41c-.02.22-.03.44-.03.67s.01.45.03.68l-1.86 1.41c-.4.3-.51.86-.26 1.3l1.87 3.23c.25.44.79.62 1.25.42l2.15-.91c.37.26.76.49 1.17.68l.29 2.31c.06.5.49.88.99.88h3.73c.5 0 .93-.38.99-.88l.29-2.31c.41-.19.8-.42 1.17-.68l2.15.91c.46.2 1 .02 1.25-.42l1.87-3.23c.25-.44.14-.99-.26-1.3l-1.86-1.41c.03-.23.04-.45.04-.68m-7.46 3.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5"}),"SettingsRounded")},73707:(t,e,r)=>{r.d(e,{A:()=>y});var o=r(12115),a=r(2821),n=r(57001),i=r(8532),s=r(48116),l=r(66964),c=r(16625),p=r(30424),d=r(95070),u=r(36766),h=r(69582),v=r(14028),m=r(58081),f=r(95155);let g=(0,s.Ay)(d.A,{shouldForwardProp:t=>(0,p.A)(t)||"classes"===t,name:"MuiListItemButton",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:r}=t;return[e.root,r.dense&&e.dense,"flex-start"===r.alignItems&&e.alignItemsFlexStart,r.divider&&e.divider,!r.disableGutters&&e.gutters]}})((0,l.A)(t=>{let{theme:e}=t;return{display:"flex",flexGrow:1,justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minWidth:0,boxSizing:"border-box",textAlign:"left",paddingTop:8,paddingBottom:8,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shortest}),"&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},["&.".concat(m.A.selected)]:{backgroundColor:e.vars?"rgba(".concat(e.vars.palette.primary.mainChannel," / ").concat(e.vars.palette.action.selectedOpacity,")"):(0,i.X4)(e.palette.primary.main,e.palette.action.selectedOpacity),["&.".concat(m.A.focusVisible)]:{backgroundColor:e.vars?"rgba(".concat(e.vars.palette.primary.mainChannel," / calc(").concat(e.vars.palette.action.selectedOpacity," + ").concat(e.vars.palette.action.focusOpacity,"))"):(0,i.X4)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},["&.".concat(m.A.selected,":hover")]:{backgroundColor:e.vars?"rgba(".concat(e.vars.palette.primary.mainChannel," / calc(").concat(e.vars.palette.action.selectedOpacity," + ").concat(e.vars.palette.action.hoverOpacity,"))"):(0,i.X4)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?"rgba(".concat(e.vars.palette.primary.mainChannel," / ").concat(e.vars.palette.action.selectedOpacity,")"):(0,i.X4)(e.palette.primary.main,e.palette.action.selectedOpacity)}},["&.".concat(m.A.focusVisible)]:{backgroundColor:(e.vars||e).palette.action.focus},["&.".concat(m.A.disabled)]:{opacity:(e.vars||e).palette.action.disabledOpacity},variants:[{props:t=>{let{ownerState:e}=t;return e.divider},style:{borderBottom:"1px solid ".concat((e.vars||e).palette.divider),backgroundClip:"padding-box"}},{props:{alignItems:"flex-start"},style:{alignItems:"flex-start"}},{props:t=>{let{ownerState:e}=t;return!e.disableGutters},style:{paddingLeft:16,paddingRight:16}},{props:t=>{let{ownerState:e}=t;return e.dense},style:{paddingTop:4,paddingBottom:4}}]}})),y=o.forwardRef(function(t,e){let r=(0,c.b)({props:t,name:"MuiListItemButton"}),{alignItems:i="center",autoFocus:s=!1,component:l="div",children:p,dense:d=!1,disableGutters:y=!1,divider:A=!1,focusVisibleClassName:b,selected:x=!1,className:k,...L}=r,M=o.useContext(v.A),B=o.useMemo(()=>({dense:d||M.dense||!1,alignItems:i,disableGutters:y}),[i,M.dense,d,y]),w=o.useRef(null);(0,u.A)(()=>{s&&w.current&&w.current.focus()},[s]);let C={...r,alignItems:i,dense:B.dense,disableGutters:y,divider:A,selected:x},R=(t=>{let{alignItems:e,classes:r,dense:o,disabled:a,disableGutters:i,divider:s,selected:l}=t,c=(0,n.A)({root:["root",o&&"dense",!i&&"gutters",s&&"divider",a&&"disabled","flex-start"===e&&"alignItemsFlexStart",l&&"selected"]},m.Y,r);return{...r,...c}})(C),S=(0,h.A)(w,e);return(0,f.jsx)(v.A.Provider,{value:B,children:(0,f.jsx)(g,{ref:S,href:L.href||L.to,component:(L.href||L.to)&&"div"===l?"button":l,focusVisibleClassName:(0,a.A)(R.focusVisible,b),ownerState:C,className:(0,a.A)(R.root,k),...L,classes:R,children:p})})})},81577:(t,e,r)=>{r.d(e,{A:()=>n});var o=r(15485),a=r(95155);let n=(0,o.A)((0,a.jsx)("path",{d:"M22.6 11.29 20 8.69V5c0-.55-.45-1-1-1h-3.69l-2.6-2.6a.996.996 0 0 0-1.41 0L8.69 4H5c-.55 0-1 .45-1 1v3.69l-2.6 2.6c-.39.39-.39 1.02 0 1.41L4 15.3V19c0 .55.45 1 1 1h3.69l2.6 2.6c.39.39 1.02.39 1.41 0l2.6-2.6H19c.55 0 1-.45 1-1v-3.69l2.6-2.6c.39-.39.39-1.03 0-1.42m-4.68 1.69c-.34 2.12-1.85 3.94-3.88 4.66-1.21.43-2.41.45-3.5.18-.41-.1-.48-.65-.13-.9C11.98 15.84 13 14.04 13 12s-1.02-3.84-2.58-4.92c-.35-.24-.29-.79.13-.9 1.09-.27 2.29-.25 3.5.18 2.02.72 3.54 2.54 3.88 4.66.05.33.07.66.07.98-.01.32-.03.65-.08.98"}),"Brightness4Rounded")},83478:(t,e,r)=>{r.d(e,{A:()=>n});var o=r(15485),a=r(95155);let n=(0,o.A)((0,a.jsx)("path",{d:"M18.3 5.71a.996.996 0 0 0-1.41 0L12 10.59 7.11 5.7a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0s.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4"}),"CloseRounded")},90363:(t,e,r)=>{r.d(e,{A:()=>n});var o=r(15485),a=r(95155);let n=(0,o.A)((0,a.jsx)("path",{d:"M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z"}),"AutoFixHigh")},92437:(t,e,r)=>{r.d(e,{A:()=>n});var o=r(15485),a=r(95155);let n=(0,o.A)((0,a.jsx)("path",{d:"M10.67 21c-.35 0-.62-.31-.57-.66L11 14H7.5c-.88 0-.33-.75-.31-.78 1.26-2.23 3.15-5.53 5.65-9.93.1-.18.3-.29.5-.29.35 0 .62.31.57.66l-.9 6.34h3.51c.4 0 .62.19.4.66-3.29 5.74-5.2 9.09-5.75 10.05-.1.18-.29.29-.5.29"}),"BoltRounded")}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7711],{17711:(e,t,r)=>{r.r(t),r.d(t,{default:()=>eq});var l=r(95155),n=r(94049),a=r(12115),s=r(33567),i=r(78470),o=r(41983),c=r(99944),d=r(9957),u=r(91871),h=r(25635),x=r(22003),g=r(2300),p=r(9562),f=r(56422),m=r(52641),j=r(95436),A=r(55606),v=r(86973),y=r(4474),b=r(36314),w=r(49501),k=r(17681),S=r(74494),C=r(2778),W=r(52363),T=r(65036),z=r(75912),E=r(86946),R=r(76530),N=r(51611),I=r(64419),F=r(28466),P=r(3986),L=r(94885),O=r(15686),D=r(91665),M=r(89538),U=r(70583),B=r(44055),X=r(93632),q=r(73288),G=r(38459);let H={"name-asc":"Name (A-Z)","name-desc":"Name (Z-A)",newest:"Newest first",oldest:"Oldest first","last-run":"Most recently run"},_={schedule:"Schedule",webhook:"Webhook","file-watch":"File watch","mcp-poll":"MCP poll","url-watch":"URL watch","flow-event":"Flow event"};function $(e){if(!e)return 0;let t=Date.parse(e);return Number.isNaN(t)?0:t}function Z(e,t){return e.execution.name.localeCompare(t.execution.name)||e.execution.id.localeCompare(t.execution.id)}function Q(e){var t,r;return e.status.running?{key:"state:running",label:"Running"}:e.status.lastTriggerError||(null==(t=e.lastRun)?void 0:t.status)==="error"||(null==(r=e.lastRun)?void 0:r.status)==="needs_approval"?{key:"state:attention",label:"Needs attention"}:e.execution.enabled?{key:"state:enabled",label:"Active"}:{key:"state:disabled",label:"Off"}}function J(e){let t=e.execution.trigger.type;return{key:"trigger:".concat(t),label:_[t]}}var K=r(97104),V=r(22573),Y=r(79508),ee=r(28548),et=r(50430),er=r(55406),el=r(14915),en=r(4484),ea=r(63186),es=r(62962),ei=r(3713),eo=r(89296),ec=r(81956);let ed=e=>String(e).padStart(2,"0"),eu=e=>{switch(e){case"completed":return"success.main";case"error":return"error.main";case"skipped":return"warning.main";default:return"transparent"}},eh=e=>e?new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"",ex=e=>{if(!e.finishedAt)return"";let t=new Date(e.finishedAt).getTime()-new Date(e.firedAt).getTime();return t<1e3?"<1s":t<6e4?"".concat(Math.round(t/1e3),"s"):"".concat(Math.round(t/6e4),"min")},eg=e=>{var t;let{entry:r,paused:s,folders:c,onEdit:x,onDelete:p,onToggleEnabled:f,onSetFolder:m,onRanNow:j}=e,{execution:A,status:v,lastRun:b}=r,[w,k]=(0,a.useState)(!1),[S,E]=(0,a.useState)(null),[R,N]=(0,a.useState)(!1),[I,F]=(0,a.useState)(!1),[P,L]=(0,a.useState)(null),[O,M]=(0,a.useState)(10),[U,B]=(0,a.useState)(null),q=(0,a.useCallback)(async()=>{N(!0),E([...await X.P.loadRuns(A.id)].reverse()),M(10),N(!1)},[A.id]);(0,a.useEffect)(()=>{w&&q()},[w,q,null==b?void 0:b.runId]);let G=async()=>{F(!0),await X.P.runNow(A.id),F(!1),w&&q(),j()};return(0,l.jsxs)(g.A,{variant:"outlined",sx:{p:2},children:[(0,l.jsxs)(n.default,{sx:{display:"flex",alignItems:"center",gap:1.5,flexWrap:"wrap"},children:[(0,l.jsxs)(n.default,{sx:{flexGrow:1,minWidth:220},children:[(0,l.jsxs)(n.default,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[(0,l.jsx)(h.A,{variant:"subtitle1",sx:{fontWeight:600},children:A.name}),(0,l.jsx)(ee.A,{size:"small",label:function(e){var t,r,l;switch(e.type){case"schedule":{let r,l=(t=e.cron,(r=/^\*\/(\d+) \* \* \* \* \*$/.exec(t))?"Every ".concat(r[1],"s"):(r=/^\*\/(\d+) \* \* \* \*$/.exec(t))?"Every ".concat(r[1]," min"):(r=/^0 \*\/(\d+) \* \* \*$/.exec(t))?1===Number(r[1])?"Every hour":"Every ".concat(r[1]," hours"):(r=/^(\d+) (\d+) \* \* \*$/.exec(t))?"Daily at ".concat(ed(Number(r[2])),":").concat(ed(Number(r[1]))):(r=/^(\d+) (\d+) \* \* 1-5$/.exec(t))?"Weekdays at ".concat(ed(Number(r[2])),":").concat(ed(Number(r[1]))):null);return null!=l?l:"Schedule: ".concat(e.cron)}case"webhook":return"Webhook";case"file-watch":return"Watching ".concat(e.path);case"mcp-poll":return"Watching ".concat(e.serverName," › ").concat(e.toolName);case"url-watch":try{return"Watching ".concat(new URL(e.url).hostname)}catch(e){return"Watching a URL"}case"flow-event":{if(null==(r=e.source)?void 0:r.topic)return"On signal “".concat(e.source.topic,"”");let t=(null!=(l=e.on)?l:[]).join("/")||"terminal";return"When a flow is ".concat(t)}default:return"Trigger"}}(A.trigger)}),A.exclusive&&(0,l.jsx)(i.A,{title:"Only runs when the scheduler is idle; blocks other runs while active",children:(0,l.jsx)(ee.A,{size:"small",color:"secondary",label:"Exclusive"})}),!A.enabled&&(0,l.jsx)(ee.A,{size:"small",label:"Off",variant:"outlined"}),A.folder&&(0,l.jsx)(ee.A,{size:"small",variant:"outlined",icon:(0,l.jsx)(D.A,{}),label:A.folder})]}),v.running?(0,l.jsxs)(n.default,{sx:{display:"flex",alignItems:"center",gap:.75,mt:.5},children:[(0,l.jsx)(y.default,{size:12,thickness:6}),(0,l.jsxs)(h.A,{variant:"body2",color:"text.secondary",children:["Running…",v.runningSince?" — started ".concat(eh(v.runningSince)):""]})]}):v.blockedByExclusive?(0,l.jsxs)(h.A,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:["Blocked — an exclusive trigger holds the scheduler",v.lastTriggerError?" — trigger error: ".concat(v.lastTriggerError):""]}):(0,l.jsxs)(h.A,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:[(e=>{let{execution:t,status:r}=e;if(!t.enabled)return"";if(r.nextRun)return"Next run: ".concat(eh(r.nextRun));if("paused"===r.notArmedReason)return"Paused (global)";if(r.armed)switch(t.trigger.type){case"webhook":return"Listening for webhook";case"file-watch":return"Watching ".concat(t.trigger.path);case"mcp-poll":case"url-watch":return"Watching for changes";case"flow-event":return"Waiting for flow event";default:return"Armed"}return"Not armed"})(r),v.lastTriggerError?" — trigger error: ".concat(v.lastTriggerError):""]}),b&&(0,l.jsxs)(n.default,{sx:{display:"flex",alignItems:"center",gap:.75,mt:.5},children:[(0,l.jsx)(i.A,{title:b.status,children:(0,l.jsx)(n.default,{sx:{width:10,height:10,borderRadius:"50%",bgcolor:eu(b.status),flexShrink:0}})}),(0,l.jsxs)(h.A,{variant:"body2",color:"text.secondary",children:["Last run ",eh(b.firedAt),"error"===b.status&&b.error?" — ".concat(b.error):""]})]})]}),(0,l.jsx)(i.A,{title:"Run now",children:(0,l.jsx)("span",{children:(0,l.jsx)(o.A,{onClick:G,disabled:I,color:"primary",children:I?(0,l.jsx)(y.default,{size:20}):(0,l.jsx)(er.A,{})})})}),(0,l.jsx)(i.A,{title:s?"Scheduler is paused globally — switch it to Active (top right) to arm triggers":A.enabled?"Turn off":"Turn on",children:(0,l.jsx)(d.A,{checked:A.enabled,onChange:e=>f(e.target.checked)})}),(0,l.jsx)(i.A,{title:"Edit",children:(0,l.jsx)(o.A,{onClick:x,children:(0,l.jsx)(el.A,{})})}),(0,l.jsx)(i.A,{title:A.folder?"Folder: ".concat(A.folder):"Move to folder",children:(0,l.jsx)(o.A,{onClick:e=>B(e.currentTarget),color:A.folder?"primary":"default","aria-label":"move to folder",children:(0,l.jsx)(eo.A,{})})}),(0,l.jsx)(i.A,{title:"Delete",children:(0,l.jsx)(o.A,{onClick:p,children:(0,l.jsx)(en.A,{})})}),(0,l.jsx)(i.A,{title:w?"Hide run history":"Show run history",children:(0,l.jsx)(o.A,{onClick:()=>k(e=>!e),children:w?(0,l.jsx)(es.A,{}):(0,l.jsx)(ea.A,{})})})]}),(0,l.jsx)(et.A,{in:w,timeout:"auto",unmountOnExit:!0,children:(0,l.jsxs)(n.default,{sx:{mt:2,borderTop:1,borderColor:"divider",pt:1.5},children:[R&&!S&&(0,l.jsx)(h.A,{variant:"body2",color:"text.secondary",children:"Loading runs…"}),S&&0===S.length&&(0,l.jsx)(h.A,{variant:"body2",color:"text.secondary",children:"No runs yet. Use the play button to try it now."}),null==S?void 0:S.slice(0,O).map(e=>{var t;return(0,l.jsxs)(n.default,{sx:{display:"flex",gap:1,py:.75,alignItems:"flex-start","&:hover .run-detail-button":{opacity:1}},children:[(0,l.jsx)(n.default,{sx:{width:10,height:10,borderRadius:"50%",bgcolor:eu(e.status),mt:"5px",flexShrink:0}}),(0,l.jsxs)(n.default,{sx:{minWidth:0,flexGrow:1},children:[(0,l.jsxs)(h.A,{variant:"body2",children:[eh(e.firedAt),ex(e)?" \xb7 ".concat(ex(e)):""," \xb7 ",e.triggerSummary,(null==(t=e.usage)?void 0:t.totalTokens)?" \xb7 ".concat(e.usage.totalTokens.toLocaleString()," tokens"):""]}),e.error&&(0,l.jsx)(h.A,{variant:"body2",color:"error",children:e.error}),e.outputText&&(0,l.jsx)(h.A,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-wrap",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.outputText})]}),(0,l.jsx)(i.A,{title:"Show full output",children:(0,l.jsx)(o.A,{className:"run-detail-button",size:"small",onClick:()=>L(e),sx:{opacity:{xs:1,md:.35},transition:"opacity 120ms",flexShrink:0},children:(0,l.jsx)(ei.A,{fontSize:"inherit"})})})]},e.runId)}),S&&S.length>O&&(0,l.jsxs)(u.A,{size:"small",onClick:()=>M(e=>e+10),sx:{mt:1},children:["Load more (",S.length-O," older)"]})]})}),(0,l.jsx)(ec.A,{anchorEl:U,open:!!U,currentFolder:A.folder,folders:c,onClose:()=>B(null),onAssign:m}),(0,l.jsxs)(C.A,{open:null!==P,onClose:()=>L(null),maxWidth:"md",fullWidth:!0,children:[(0,l.jsx)(W.A,{component:"div",children:(0,l.jsxs)(n.default,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,l.jsx)(n.default,{sx:{width:10,height:10,borderRadius:"50%",bgcolor:P?eu(P.status):"transparent",flexShrink:0}}),(0,l.jsxs)(h.A,{variant:"h6",children:[A.name," — ",P?eh(P.firedAt):""]})]})}),(0,l.jsx)(T.A,{dividers:!0,children:P&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(h.A,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:[P.status,ex(P)?" \xb7 ".concat(ex(P)):""," \xb7 ",P.triggerSummary,(null==(t=P.usage)?void 0:t.totalTokens)?" \xb7 ".concat(P.usage.totalTokens.toLocaleString()," tokens (").concat(P.usage.promptTokens.toLocaleString()," in / ").concat(P.usage.completionTokens.toLocaleString()," out)"):""]}),P.error&&(0,l.jsx)(h.A,{variant:"body2",color:"error",sx:{mb:1.5,whiteSpace:"pre-wrap"},children:P.error}),P.outputText?(0,l.jsx)(n.default,{sx:{whiteSpace:"pre-wrap",wordBreak:"break-word",bgcolor:"action.hover",borderRadius:1,p:2,fontSize:14,maxHeight:"55vh",overflow:"auto"},children:P.outputText}):!P.error&&(0,l.jsx)(h.A,{variant:"body2",color:"text.secondary",children:"This run produced no output text."})]})}),(0,l.jsx)(z.A,{children:(0,l.jsx)(u.A,{onClick:()=>L(null),children:"Close"})})]})]})};var ep=r(21067),ef=r(18369),em=r(77073),ej=r(26922),eA=r(40520),ev=r(79299),ey=r(22590),eb=r(53657),ew=r(7107),ek=r(90057),eS=r(23143),eC=r(84765),eW=r(43673),eT=r(21997),ez=r(80811),eE=r(14368),eR=r(23833),eN=r(75870);let eI=(0,q.h)("frontend/components/PlannedExecutions/ExecutionModal"),eF={type:"schedule",cron:"0 9 * * *"},eP={type:"file-watch",path:"",events:["add","change"]},eL={type:"mcp-poll",serverName:"",toolName:"",args:{},cron:"*/5 * * * *",evaluate:{mode:"on-change"}},eO={type:"url-watch",url:"",cron:"*/15 * * * *"},eD={type:"flow-event",source:{flowId:""},on:["completed"]},eM=e=>{var t,r;let{open:s,execution:i,onClose:g,onSaved:f}=e,[y,b]=(0,a.useState)(""),[w,k]=(0,a.useState)(""),[S,E]=(0,a.useState)(""),[R,N]=(0,a.useState)(!1),[I,F]=(0,a.useState)("skip"),[P,L]=(0,a.useState)(!1),[O,D]=(0,a.useState)("queue"),[M,U]=(0,a.useState)(eF),[B,q]=(0,a.useState)(""),[G,H]=(0,a.useState)([]),[_,$]=(0,a.useState)(!1),[Z,Q]=(0,a.useState)(!1),[J,K]=(0,a.useState)(null);(0,a.useEffect)(()=>{var e,t,r,l,n,a;s&&(K(null),b(null!=(e=null==i?void 0:i.name)?e:""),k(null!=(t=null==i?void 0:i.flowId)?t:""),E(null!=(r=null==i?void 0:i.prompt)?r:""),N((null==i?void 0:i.saveConversations)===!0),F(null!=(l=null==i?void 0:i.overlapStrategy)?l:"skip"),L((null==i?void 0:i.exclusive)===!0),D(null!=(n=null==i?void 0:i.nonExclusiveBehavior)?n:"queue"),U(null!=(a=null==i?void 0:i.trigger)?a:eF),q(i?"":crypto.randomUUID()))},[s,i]),(0,a.useEffect)(()=>{if(!s)return;let e=!1;return $(!0),ek.g.loadFlows().then(t=>{e||H(t||[])}).catch(t=>{eI.warn("Failed to load flows for execution picker",t),e||H([])}).finally(()=>{e||$(!1)}),()=>{e=!0}},[s]);let V=!!w&&!_&&G.length>0&&!G.some(e=>e.id===w),Y=async()=>{var e;Q(!0),K(null);let t={name:y,flowId:w,prompt:S,saveConversations:R,overlapStrategy:I,exclusive:P,nonExclusiveBehavior:O,trigger:M,enabled:null==(e=null==i?void 0:i.enabled)||e,...i?{}:{id:B}},r=i?await X.P.update(i.id,t):await X.P.create(t);if(Q(!1),!r.success)return void K(r.error||"Failed to save");f(),g()};return(0,l.jsxs)(C.A,{open:s,onClose:g,maxWidth:"md",fullWidth:!0,PaperProps:{sx:{borderTop:5,borderColor:"primary.main",maxWidth:"95vw",maxHeight:"90vh"}},children:[(0,l.jsx)(W.A,{component:"div",children:(0,l.jsxs)(n.default,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(h.A,{variant:"h6",children:i?"Edit trigger":"New trigger"}),(0,l.jsx)(o.A,{edge:"end",color:"inherit",onClick:g,"aria-label":"close",children:(0,l.jsx)(em.A,{})})]})}),(0,l.jsx)(ep.A,{}),(0,l.jsxs)(T.A,{sx:{p:3},children:[(0,l.jsx)(h.A,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"An Automation trigger runs one of your flows automatically — on a schedule or when something happens — without anyone sitting in the chat. Results show up in its run history on the Triggers page."}),(0,l.jsx)(p.A,{fullWidth:!0,label:"Name",value:y,onChange:e=>b(e.target.value),margin:"normal",placeholder:"e.g. Morning news digest"}),(0,l.jsx)(h.A,{variant:"subtitle1",sx:{mt:3,mb:1,fontWeight:600},children:"1 \xb7 When should it run?"}),(0,l.jsxs)(n.default,{role:"radiogroup","aria-label":"Trigger type",sx:{display:"flex",gap:2,flexWrap:"wrap"},children:[(0,l.jsx)(eS.A,{selected:"schedule"===M.type,onClick:()=>{"schedule"!==M.type&&U((null==i?void 0:i.trigger.type)==="schedule"?i.trigger:eF)},icon:(0,l.jsx)(ej.A,{}),title:"On a schedule",description:"Run at fixed times — every few minutes, daily, on weekdays, or a custom rhythm."}),(0,l.jsx)(eS.A,{selected:"webhook"===M.type,onClick:()=>{"webhook"!==M.type&&U((null==i?void 0:i.trigger.type)==="webhook"?i.trigger:{type:"webhook",token:crypto.randomUUID()})},icon:(0,l.jsx)(eA.A,{}),title:"When called (webhook)",description:"Other apps run this flow by calling a URL — GitHub, Stripe, Slack and most services can send webhooks."}),(0,l.jsx)(eS.A,{selected:"file-watch"===M.type,onClick:()=>{"file-watch"!==M.type&&U((null==i?void 0:i.trigger.type)==="file-watch"?i.trigger:eP)},icon:(0,l.jsx)(ev.A,{}),title:"When files change",description:"Watch a folder on this computer and run when files appear, change, or disappear."}),(0,l.jsx)(eS.A,{selected:"mcp-poll"===M.type,onClick:()=>{"mcp-poll"!==M.type&&U((null==i?void 0:i.trigger.type)==="mcp-poll"?i.trigger:eL)},icon:(0,l.jsx)(ey.A,{}),title:"Watch a tool",description:"Check one of your MCP tools regularly — run when its result changes, or let AI decide."}),(0,l.jsx)(eS.A,{selected:"url-watch"===M.type,onClick:()=>{"url-watch"!==M.type&&U((null==i?void 0:i.trigger.type)==="url-watch"?i.trigger:eO)},icon:(0,l.jsx)(eb.A,{}),title:"When a website changes",description:"Check a URL regularly and run when its content is different from the last check."}),(0,l.jsx)(eS.A,{selected:"flow-event"===M.type,onClick:()=>{"flow-event"!==M.type&&U((null==i?void 0:i.trigger.type)==="flow-event"?i.trigger:eD)},icon:(0,l.jsx)(ew.A,{}),title:"When another flow finishes",description:"React to another flow completing or erroring — chain flows together or run triage when something fails."})]}),"schedule"===M.type&&(0,l.jsx)(eC.A,{cron:M.cron,timezone:M.timezone,onChange:e=>{let{cron:t,timezone:r}=e;return U({...M,cron:t,timezone:r})},catchUp:!0===M.catchUp,onCatchUpChange:e=>U({...M,catchUp:e})}),"webhook"===M.type&&(0,l.jsx)(eW.A,{config:M,onChange:U,executionId:null!=(t=null==i?void 0:i.id)?t:B,saved:null!==i}),"file-watch"===M.type&&(0,l.jsx)(eT.A,{config:M,onChange:U}),"mcp-poll"===M.type&&(0,l.jsx)(ez.A,{config:M,onChange:U}),"url-watch"===M.type&&(0,l.jsx)(eE.A,{config:M,onChange:U}),"flow-event"===M.type&&(0,l.jsx)(eR.A,{config:M,onChange:U,flows:G,currentExecutionId:null!=(r=null==i?void 0:i.id)?r:B}),(0,l.jsxs)(m.A,{fullWidth:!0,margin:"normal",children:[(0,l.jsx)(j.A,{id:"overlap-strategy-label",children:"If it's already running…"}),(0,l.jsxs)(A.A,{labelId:"overlap-strategy-label",label:"If it's already running…",value:I,onChange:e=>F(e.target.value),children:[(0,l.jsx)(v.A,{value:"skip",children:"Skip the new run (default)"}),(0,l.jsx)(v.A,{value:"queue",children:"Queue it — run after the current one finishes"}),(0,l.jsx)(v.A,{value:"parallel",children:"Run in parallel — allow concurrent runs"}),(0,l.jsx)(v.A,{value:"error",children:"Reject it — record an error (webhook gets 409)"})]}),(0,l.jsx)(ef.A,{children:"parallel"===I&&("url-watch"===M.type||"mcp-poll"===M.type)?"Heads up: parallel runs of a change-watching trigger can race each other — skip or queue is usually safer here.":"queue"===I?"Queued fires run one at a time, in order. A burst is capped so it can’t grow without limit.":"What happens when this trigger fires while a previous run of it is still going."})]}),(0,l.jsx)(c.A,{sx:{mt:1},control:(0,l.jsx)(d.A,{checked:P,onChange:e=>L(e.target.checked)}),label:"Exclusive — only run when nothing else is running, and block other runs while it does"}),P&&(0,l.jsxs)(m.A,{fullWidth:!0,margin:"normal",children:[(0,l.jsx)(j.A,{id:"non-exclusive-behavior-label",children:"While this runs, other triggers…"}),(0,l.jsxs)(A.A,{labelId:"non-exclusive-behavior-label",label:"While this runs, other triggers…",value:O,onChange:e=>D(e.target.value),children:[(0,l.jsx)(v.A,{value:"queue",children:"Queue — run them after this finishes (default)"}),(0,l.jsx)(v.A,{value:"skip",children:"Skip — drop them"}),(0,l.jsx)(v.A,{value:"error",children:"Fail — reject them (webhook gets 423)"})]}),(0,l.jsx)(ef.A,{children:"An exclusive run waits until the scheduler is idle, then holds a global lock so no other Automation trigger can start until it finishes."})]}),(0,l.jsx)(ep.A,{sx:{mt:3}}),(0,l.jsx)(h.A,{variant:"subtitle1",sx:{mt:2,mb:0,fontWeight:600},children:"2 \xb7 What should it run?"}),(0,l.jsx)(n.default,{sx:{mt:2},children:(0,l.jsx)(eN.A,{selectedFlowId:w||null,onSelectFlow:k,disabled:Z,hideLabel:!0})}),V&&(0,l.jsx)(x.A,{severity:"warning",sx:{mt:1},children:"The previously selected flow no longer exists. Please choose another."}),(0,l.jsx)(p.A,{fullWidth:!0,label:"What should the flow do?",value:S,onChange:e=>E(e.target.value),margin:"normal",multiline:!0,rows:3,helperText:"Sent to the flow as the user message each time this runs. Run details are attached automatically: current time, what triggered it, the previous run, the next planned run, and any trigger data."}),(0,l.jsx)(c.A,{sx:{mt:1},control:(0,l.jsx)(d.A,{checked:R,onChange:e=>N(e.target.checked)}),label:"Save full conversations (each run appears in the chat sidebar — useful for debugging)"}),J&&(0,l.jsx)(x.A,{severity:"error",sx:{mt:2},children:J})]}),(0,l.jsxs)(z.A,{children:[(0,l.jsx)(u.A,{onClick:g,children:"Cancel"}),(0,l.jsx)(u.A,{onClick:Y,variant:"contained",color:"primary",disabled:Z||!y.trim()||!w,children:Z?"Saving…":"Save trigger"})]})]})},eU=(0,q.h)("frontend/components/PlannedExecutions"),eB=()=>{let e=(0,s.A)(),[t,r]=(0,a.useState)([]),[q,ee]=(0,a.useState)(!1),[et,er]=(0,a.useState)(!1),[el,en]=(0,a.useState)(!1),[ea,es]=(0,a.useState)(null),[ei,eo]=(0,a.useState)(null),[ec,ed]=(0,a.useState)(null),[eu,eh]=(0,a.useState)(""),[ex,ep]=(0,K.Xk)("flujo-ui:planned-executions:filter","all"),[ef,em]=(0,K.Xk)("flujo-ui:planned-executions:trigger","all"),[ej,eA]=(0,K.Xk)("flujo-ui:planned-executions:sort","name-asc"),[ev,ey]=(0,K.Xk)("flujo-ui:planned-executions:group",G.FM),[eb,ew]=(0,K.Xk)("flujo-ui:planned-executions:collapsed",[]),[ek,eS]=(0,a.useState)(null),[eC,eW]=(0,a.useState)(null),eT=(0,a.useMemo)(()=>new Set(eb),[eb]),ez=(0,a.useCallback)(async()=>{let e=await X.P.list();r(e.executions),ee(e.paused),er(!0)},[]);(0,a.useEffect)(()=>{ez()},[ez]);let eE=t.some(e=>e.status.running);(0,a.useEffect)(()=>{let e=setInterval(()=>{document.hidden||ez()},eE?3e3:1e4);return()=>clearInterval(e)},[ez,eE]);let eR=async e=>{ee(e);let t=await X.P.setPaused(e);t.success||eU.warn("Failed to toggle pause",t.error),ez()},eN=async(e,t)=>{let r=await X.P.update(e.id,{enabled:t});if(!r.success){let e=r.error||"Failed to update the trigger.";eU.warn("Failed to toggle enabled",e),ed(e)}ez()},eI=async(e,t)=>{let r=await X.P.update(e.id,{folder:null!=t?t:""});if(!r.success){let e=r.error||"Failed to move the trigger.";eU.warn("Failed to update folder",e),ed(e)}ez()},eF=async()=>{ei&&(await X.P.delete(ei.id),eo(null),ez())},eP=(0,a.useMemo)(()=>(0,G.yF)(t,e=>e.execution.folder),[t]),eL=(0,a.useMemo)(()=>{var e;return e=t.filter(e=>(function(e,t){let r=t.trim().toLocaleLowerCase();if(!r)return!0;let l=e.execution;return[l.name,l.folder,l.prompt,l.flowId,l.trigger.type,_[l.trigger.type]].some(e=>null==e?void 0:e.toLocaleLowerCase().includes(r))})(e,eu)&&function(e,t){switch(t){case"enabled":return e.execution.enabled;case"disabled":return!e.execution.enabled;case"running":return e.status.running;case"attention":var r,l;return!!(e.status.lastTriggerError||(null==(r=e.lastRun)?void 0:r.status)==="error"||(null==(l=e.lastRun)?void 0:l.status)==="needs_approval");default:return!0}}(e,ex)&&("all"===ef||e.execution.trigger.type===ef)),[...e].sort((e,t)=>{switch(ej){case"name-asc":return Z(e,t);case"name-desc":return t.execution.name.localeCompare(e.execution.name)||t.execution.id.localeCompare(e.execution.id);case"newest":return $(t.execution.createdAt)-$(e.execution.createdAt)||Z(e,t);case"oldest":return $(e.execution.createdAt)-$(t.execution.createdAt)||Z(e,t);case"last-run":var r,l;return $(null==(r=t.lastRun)?void 0:r.firedAt)-$(null==(l=e.lastRun)?void 0:l.firedAt)||Z(e,t);default:return 0}})},[t,eu,ex,ef,ej]),eO=(0,a.useMemo)(()=>"folder"===ev?(0,G.Je)(eL,e=>e.execution.folder):"trigger"===ev?(0,G.Az)(eL,J):"status"===ev?(0,G.Az)(eL,Q):[],[eL,ev]),eD=()=>{eh(""),ep("all"),em("all")},eB=""!==eu.trim()||"all"!==ex||"all"!==ef,eX=e=>(0,l.jsx)(n.default,{sx:{display:"flex",flexDirection:"column",gap:2},children:e.map(e=>(0,l.jsx)(eg,{entry:e,folders:eP,onSetFolder:t=>void eI(e.execution,t),onEdit:()=>{es(e.execution),en(!0)},onDelete:()=>eo(e.execution),onToggleEnabled:t=>eN(e.execution,t),onRanNow:()=>void ez(),paused:q},e.execution.id))});return(0,l.jsxs)(n.default,{sx:{width:"100%"},children:[(0,l.jsx)(Y.default,{eyebrow:"Automate",title:"Triggers",description:"Run flows on a schedule or when the world changes — without opening chat.",icon:B.A,maxWidth:1200,actions:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i.A,{title:"Refresh",children:(0,l.jsx)(o.A,{onClick:()=>void ez(),"aria-label":"Refresh triggers",children:(0,l.jsx)(R.A,{})})}),(0,l.jsx)(c.A,{control:(0,l.jsx)(d.A,{checked:!q,onChange:e=>eR(!e.target.checked)}),label:q?"Paused":"Active"}),(0,l.jsx)(u.A,{variant:"contained",startIcon:(0,l.jsx)(E.A,{}),onClick:()=>{es(null),en(!0)},"data-tour":"add-execution",children:"Add trigger"})]})}),(0,l.jsxs)(n.default,{sx:{p:{xs:2,md:3},maxWidth:1200,mx:"auto",width:"100%"},children:[(0,l.jsx)(h.A,{variant:"body2",color:"text.secondary",sx:{mb:3},children:"FLUJO must be running for triggers to fire. The Active/Paused switch above gates all triggers globally."}),q&&t.length>0&&(0,l.jsx)(x.A,{severity:"info",sx:{mb:3},children:"The scheduler is paused — no triggers will fire, so every trigger below shows “Paused (global)”. Switch it to Active (top right) to arm them."}),t.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(g.A,{elevation:0,variant:"outlined",sx:{mb:1.5,p:1.2,borderRadius:3},children:(0,l.jsxs)(n.default,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:1,alignItems:{xs:"stretch",md:"center"},justifyContent:"space-between"},children:[(0,l.jsx)(p.A,{placeholder:"Search triggers...",variant:"outlined",size:"small",fullWidth:!0,value:eu,onChange:e=>eh(e.target.value),InputProps:{startAdornment:(0,l.jsx)(f.A,{position:"start",children:(0,l.jsx)(N.A,{fontSize:"small"})})},sx:{maxWidth:{md:360}}}),(0,l.jsxs)(n.default,{sx:{display:"flex",gap:1,alignItems:"center",flexWrap:"wrap"},children:[(0,l.jsxs)(m.A,{size:"small",sx:{minWidth:130},children:[(0,l.jsx)(j.A,{id:"execution-status-filter-label",children:"Status"}),(0,l.jsxs)(A.A,{labelId:"execution-status-filter-label",label:"Status",value:ex,onChange:e=>ep(e.target.value),children:[(0,l.jsx)(v.A,{value:"all",children:"All statuses"}),(0,l.jsx)(v.A,{value:"enabled",children:"Active"}),(0,l.jsx)(v.A,{value:"disabled",children:"Off"}),(0,l.jsx)(v.A,{value:"running",children:"Running"}),(0,l.jsx)(v.A,{value:"attention",children:"Needs attention"})]})]}),(0,l.jsxs)(m.A,{size:"small",sx:{minWidth:140},children:[(0,l.jsx)(j.A,{id:"execution-trigger-filter-label",children:"Trigger"}),(0,l.jsxs)(A.A,{labelId:"execution-trigger-filter-label",label:"Trigger",value:ef,onChange:e=>em(e.target.value),children:[(0,l.jsx)(v.A,{value:"all",children:"All triggers"}),Object.entries(_).map(e=>{let[t,r]=e;return(0,l.jsx)(v.A,{value:t,children:r},t)})]})]}),eB&&(0,l.jsx)(u.A,{size:"small",onClick:eD,children:"Clear"}),(0,l.jsx)(i.A,{title:"Group cards",children:(0,l.jsx)(o.A,{size:"small",onClick:e=>eW(e.currentTarget),color:"none"!==ev?"primary":"default",sx:{border:"1px solid ".concat(e.palette.divider),backgroundColor:e.palette.background.default},children:(0,l.jsx)(L.A,{fontSize:"small"})})}),(0,l.jsx)(i.A,{title:"Sort triggers",children:(0,l.jsx)(o.A,{size:"small",onClick:e=>eS(e.currentTarget),sx:{border:"1px solid ".concat(e.palette.divider),backgroundColor:e.palette.background.default},children:(0,l.jsx)(I.A,{fontSize:"small"})})})]})]})}),(0,l.jsxs)(n.default,{sx:{display:"flex",justifyContent:"space-between",gap:2,flexWrap:"wrap",mb:2,px:1},children:[(0,l.jsxs)(h.A,{variant:"body2",color:"text.secondary",children:[eL.length," of ",t.length," trigger",1===t.length?"":"s",eu&&' matching "'.concat(eu,'"')]}),(0,l.jsxs)(h.A,{variant:"body2",color:"text.secondary",children:["Sorted by: ",H[ej]]})]})]}),!et&&(0,l.jsx)(n.default,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,l.jsx)(y.default,{})}),et&&0===t.length&&(0,l.jsxs)(n.default,{sx:{border:1,borderColor:"divider",borderRadius:2,borderStyle:"dashed",p:6,textAlign:"center"},children:[(0,l.jsx)(h.A,{variant:"h6",sx:{mb:1},children:"No triggers yet"}),(0,l.jsx)(h.A,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Create your first trigger to run a flow automatically."}),(0,l.jsx)(u.A,{variant:"contained",startIcon:(0,l.jsx)(E.A,{}),onClick:()=>{es(null),en(!0)},children:"New trigger"})]}),et&&t.length>0&&0===eL.length&&(0,l.jsxs)(n.default,{sx:{border:1,borderColor:"divider",borderRadius:2,borderStyle:"dashed",p:6,textAlign:"center"},children:[(0,l.jsx)(h.A,{variant:"h6",sx:{mb:1},children:"No matches"}),(0,l.jsx)(h.A,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Try a different search or filter."}),(0,l.jsx)(u.A,{variant:"outlined",onClick:eD,children:"Clear filters"})]}),et&&eL.length>0&&("none"===ev?eX(eL):eO.map(e=>(0,l.jsx)(V.A,{label:e.label,count:e.items.length,expanded:!eT.has(e.key),onToggle:()=>(e=>{ew(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])})(e.key),showFolderIcon:"folder"===ev,children:eX(e.items)},e.key))),(0,l.jsxs)(b.A,{anchorEl:eC,open:!!eC,onClose:()=>eW(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[(0,l.jsxs)(v.A,{selected:"none"===ev,onClick:()=>{ey("none"),eW(null)},children:[(0,l.jsx)(w.A,{children:(0,l.jsx)(O.A,{fontSize:"small"})}),(0,l.jsx)(k.A,{primary:"No grouping"})]}),(0,l.jsxs)(v.A,{selected:"folder"===ev,onClick:()=>{ey("folder"),eW(null)},children:[(0,l.jsx)(w.A,{children:(0,l.jsx)(D.A,{fontSize:"small"})}),(0,l.jsx)(k.A,{primary:"By folder"})]}),(0,l.jsxs)(v.A,{selected:"trigger"===ev,onClick:()=>{ey("trigger"),eW(null)},children:[(0,l.jsx)(w.A,{children:(0,l.jsx)(M.A,{fontSize:"small"})}),(0,l.jsx)(k.A,{primary:"By trigger"})]}),(0,l.jsxs)(v.A,{selected:"status"===ev,onClick:()=>{ey("status"),eW(null)},children:[(0,l.jsx)(w.A,{children:(0,l.jsx)(U.A,{fontSize:"small"})}),(0,l.jsx)(k.A,{primary:"By status"})]})]}),(0,l.jsxs)(b.A,{anchorEl:ek,open:!!ek,onClose:()=>eS(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[(0,l.jsxs)(v.A,{selected:"name-asc"===ej,onClick:()=>{eA("name-asc"),eS(null)},children:[(0,l.jsx)(w.A,{children:(0,l.jsx)(F.A,{fontSize:"small"})}),(0,l.jsx)(k.A,{primary:"Name (A-Z)"})]}),(0,l.jsxs)(v.A,{selected:"name-desc"===ej,onClick:()=>{eA("name-desc"),eS(null)},children:[(0,l.jsx)(w.A,{children:(0,l.jsx)(F.A,{fontSize:"small",sx:{transform:"scaleX(-1)"}})}),(0,l.jsx)(k.A,{primary:"Name (Z-A)"})]}),(0,l.jsxs)(v.A,{selected:"newest"===ej,onClick:()=>{eA("newest"),eS(null)},children:[(0,l.jsx)(w.A,{children:(0,l.jsx)(P.A,{fontSize:"small"})}),(0,l.jsx)(k.A,{primary:"Newest first"})]}),(0,l.jsxs)(v.A,{selected:"oldest"===ej,onClick:()=>{eA("oldest"),eS(null)},children:[(0,l.jsx)(w.A,{children:(0,l.jsx)(P.A,{fontSize:"small",sx:{transform:"scaleX(-1)"}})}),(0,l.jsx)(k.A,{primary:"Oldest first"})]}),(0,l.jsxs)(v.A,{selected:"last-run"===ej,onClick:()=>{eA("last-run"),eS(null)},children:[(0,l.jsx)(w.A,{children:(0,l.jsx)(U.A,{fontSize:"small"})}),(0,l.jsx)(k.A,{primary:"Most recently run"})]})]}),(0,l.jsx)(eM,{open:el,execution:ea,onClose:()=>en(!1),onSaved:()=>void ez()}),(0,l.jsx)(S.A,{open:null!==ec,autoHideDuration:6e3,onClose:()=>ed(null),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:(0,l.jsx)(x.A,{severity:"error",onClose:()=>ed(null),sx:{width:"100%"},children:ec})}),(0,l.jsxs)(C.A,{open:null!==ei,onClose:()=>eo(null),children:[(0,l.jsxs)(W.A,{children:["Delete “",null==ei?void 0:ei.name,"”?"]}),(0,l.jsx)(T.A,{children:(0,l.jsx)(h.A,{variant:"body2",color:"text.secondary",children:"This removes the trigger and its run history. The flow itself is not affected."})}),(0,l.jsxs)(z.A,{children:[(0,l.jsx)(u.A,{onClick:()=>eo(null),children:"Cancel"}),(0,l.jsx)(u.A,{color:"error",variant:"contained",onClick:eF,children:"Delete"})]})]})]})]})},eX=(0,q.h)("app/executions/page");function eq(){return eX.debug("Rendering ExecutionsPage"),(0,l.jsx)(n.default,{sx:{height:"100%",display:"flex",flexDirection:"column"},children:(0,l.jsx)(eB,{})})}},75870:(e,t,r)=>{r.d(t,{A:()=>g});var l=r(95155),n=r(12115),a=r(94049),s=r(25635),i=r(4474),o=r(91871),c=r(56900),d=r(90057),u=r(96362),h=r(92241),x=r(68503);let g=e=>{let{selectedFlowId:t,onSelectFlow:r,disabled:g=!1,hideLabel:p=!1}=e,[f,m]=(0,n.useState)([]),[j,A]=(0,n.useState)(!0),[v,y]=(0,n.useState)(null),[b,w]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{A(!0),y(null);try{let e=await d.g.loadFlows();m(e)}catch(e){console.error("Error loading flows:",e),y("Failed to load agents")}finally{A(!1)}})()},[]);let k=e=>{r(e),w(!1)},S=async e=>{let t=f.find(t=>t.id===e);if(!t)return;let r=!t.favorite,l={...t,favorite:r||void 0};try{(await d.g.updateFlow(l)).success&&m(t=>t.map(t=>t.id===e?l:t))}catch(e){console.error("Error toggling flow favorite:",e)}},C=(0,x.E)("flows",f),W=e=>({key:e.id,content:(e=>(0,l.jsx)(h.A,{flow:e,selected:e.id===t,onSelect:k,onToggleFavorite:S,pickerMode:!0}))(e)}),T=C.items.map(W),z=C.groups?C.groups.map(e=>({...e,items:e.items.map(W)})):null,E=(()=>{if(!t)return"";let e=f.find(e=>e.id===t);return e?e.name:""})();return(0,l.jsxs)(a.default,{children:[!p&&(0,l.jsx)(s.A,{variant:"subtitle1",gutterBottom:!0,children:"Select Agent"}),j?(0,l.jsxs)(a.default,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,l.jsx)(i.default,{size:20}),(0,l.jsx)(s.A,{variant:"body2",color:"text.secondary",children:"Loading agents..."})]}):v?(0,l.jsx)(s.A,{color:"error",variant:"body2",children:v}):0===f.length?(0,l.jsx)(s.A,{variant:"body2",color:"text.secondary",children:"No agents available. Create an agent first."}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.A,{variant:"outlined",startIcon:(0,l.jsx)(c.A,{}),onClick:()=>w(!0),disabled:g,sx:{textTransform:"none",maxWidth:"100%"},children:(0,l.jsx)(a.default,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t&&E||"Select an agent"})}),(0,l.jsx)(s.A,{variant:"caption",color:"text.secondary",display:"block",sx:{mt:.5},children:t?'Using "'.concat(E,'" agent for this conversation'):"Select an agent for this conversation"}),(0,l.jsx)(u.A,{open:b,onClose:()=>w(!1),title:"Select an agent",description:"Pick the agent for this conversation.",skeleton:(0,l.jsx)(h.o,{}),emptyMessage:"No agents available. Create an agent first.",searchable:!0,searchPlaceholder:"Search agents…",searchTerm:C.searchTerm,onSearchChange:C.setSearchTerm,items:T,groups:z,collapsedKeys:C.collapsedKeys,onToggleGroup:C.toggleGroup})]})]})}}}]);