@sapienx/agentos 0.1.8 → 0.1.9

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 (527) hide show
  1. package/bundle/.next/BUILD_ID +1 -1
  2. package/bundle/.next/app-path-routes-manifest.json +14 -12
  3. package/bundle/.next/build-manifest.json +6 -6
  4. package/bundle/.next/prerender-manifest.json +3 -3
  5. package/bundle/.next/required-server-files.json +18 -6
  6. package/bundle/.next/routes-manifest.json +17 -0
  7. package/bundle/.next/server/app/_global-error/page.js +32 -3
  8. package/bundle/.next/server/app/_global-error/page.js.nft.json +1 -1
  9. package/bundle/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  10. package/bundle/.next/server/app/_global-error.html +1 -2
  11. package/bundle/.next/server/app/_global-error.rsc +15 -11
  12. package/bundle/.next/server/app/_global-error.segments/_full.segment.rsc +15 -11
  13. package/bundle/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +2 -2
  14. package/bundle/.next/server/app/_global-error.segments/_global-error.segment.rsc +4 -3
  15. package/bundle/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
  16. package/bundle/.next/server/app/_global-error.segments/_index.segment.rsc +4 -3
  17. package/bundle/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  18. package/bundle/.next/server/app/_not-found/page.js +2 -2
  19. package/bundle/.next/server/app/_not-found/page.js.nft.json +1 -1
  20. package/bundle/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  21. package/bundle/.next/server/app/_not-found.html +1 -1
  22. package/bundle/.next/server/app/_not-found.rsc +14 -12
  23. package/bundle/.next/server/app/_not-found.segments/_full.segment.rsc +14 -12
  24. package/bundle/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  25. package/bundle/.next/server/app/_not-found.segments/_index.segment.rsc +5 -5
  26. package/bundle/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  27. package/bundle/.next/server/app/_not-found.segments/_not-found.segment.rsc +4 -3
  28. package/bundle/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  29. package/bundle/.next/server/app/api/agents/route.js +1 -1
  30. package/bundle/.next/server/app/api/agents/route.js.nft.json +1 -1
  31. package/bundle/.next/server/app/api/agents/route_client-reference-manifest.js +1 -1
  32. package/bundle/.next/server/app/api/diagnostics/route.js +1 -1
  33. package/bundle/.next/server/app/api/diagnostics/route.js.nft.json +1 -1
  34. package/bundle/.next/server/app/api/diagnostics/route_client-reference-manifest.js +1 -1
  35. package/bundle/.next/server/app/api/files/reveal/route.js +1 -1
  36. package/bundle/.next/server/app/api/files/reveal/route.js.nft.json +1 -1
  37. package/bundle/.next/server/app/api/files/reveal/route_client-reference-manifest.js +1 -1
  38. package/bundle/.next/server/app/api/gateway/control/route.js +1 -1
  39. package/bundle/.next/server/app/api/gateway/control/route.js.nft.json +1 -1
  40. package/bundle/.next/server/app/api/gateway/control/route_client-reference-manifest.js +1 -1
  41. package/bundle/.next/server/app/api/mission/route.js +1 -1
  42. package/bundle/.next/server/app/api/mission/route.js.nft.json +1 -1
  43. package/bundle/.next/server/app/api/mission/route_client-reference-manifest.js +1 -1
  44. package/bundle/.next/server/app/api/models/providers/route.js +2 -2
  45. package/bundle/.next/server/app/api/models/providers/route.js.nft.json +1 -1
  46. package/bundle/.next/server/app/api/models/providers/route_client-reference-manifest.js +1 -1
  47. package/bundle/.next/server/app/api/onboarding/models/route.js +2 -2
  48. package/bundle/.next/server/app/api/onboarding/models/route.js.nft.json +1 -1
  49. package/bundle/.next/server/app/api/onboarding/models/route_client-reference-manifest.js +1 -1
  50. package/bundle/.next/server/app/api/onboarding/route.js +2 -2
  51. package/bundle/.next/server/app/api/onboarding/route.js.nft.json +1 -1
  52. package/bundle/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
  53. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js +2 -2
  54. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js.nft.json +1 -1
  55. package/bundle/.next/server/app/api/planner/[planId]/deploy/route_client-reference-manifest.js +1 -1
  56. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js +1 -0
  57. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js.nft.json +1 -0
  58. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route_client-reference-manifest.js +1 -0
  59. package/bundle/.next/server/app/api/planner/[planId]/route.js +1 -1
  60. package/bundle/.next/server/app/api/planner/[planId]/route.js.nft.json +1 -1
  61. package/bundle/.next/server/app/api/planner/[planId]/route_client-reference-manifest.js +1 -1
  62. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js +1 -1
  63. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js.nft.json +1 -1
  64. package/bundle/.next/server/app/api/planner/[planId]/simulate/route_client-reference-manifest.js +1 -1
  65. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js +1 -1
  66. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js.nft.json +1 -1
  67. package/bundle/.next/server/app/api/planner/[planId]/turn/route_client-reference-manifest.js +1 -1
  68. package/bundle/.next/server/app/api/planner/route.js +1 -1
  69. package/bundle/.next/server/app/api/planner/route.js.nft.json +1 -1
  70. package/bundle/.next/server/app/api/planner/route_client-reference-manifest.js +1 -1
  71. package/bundle/.next/server/app/api/reset/route.js +2 -2
  72. package/bundle/.next/server/app/api/reset/route.js.nft.json +1 -1
  73. package/bundle/.next/server/app/api/reset/route_client-reference-manifest.js +1 -1
  74. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js +1 -1
  75. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js.nft.json +1 -1
  76. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route_client-reference-manifest.js +1 -1
  77. package/bundle/.next/server/app/api/settings/gateway/route.js +1 -1
  78. package/bundle/.next/server/app/api/settings/gateway/route.js.nft.json +1 -1
  79. package/bundle/.next/server/app/api/settings/gateway/route_client-reference-manifest.js +1 -1
  80. package/bundle/.next/server/app/api/settings/workspace-root/route.js +1 -1
  81. package/bundle/.next/server/app/api/settings/workspace-root/route.js.nft.json +1 -1
  82. package/bundle/.next/server/app/api/settings/workspace-root/route_client-reference-manifest.js +1 -1
  83. package/bundle/.next/server/app/api/snapshot/route.js +1 -1
  84. package/bundle/.next/server/app/api/snapshot/route.js.nft.json +1 -1
  85. package/bundle/.next/server/app/api/snapshot/route_client-reference-manifest.js +1 -1
  86. package/bundle/.next/server/app/api/stream/route.js +2 -2
  87. package/bundle/.next/server/app/api/stream/route.js.nft.json +1 -1
  88. package/bundle/.next/server/app/api/stream/route_client-reference-manifest.js +1 -1
  89. package/bundle/.next/server/app/api/system/open-terminal/route.js +1 -1
  90. package/bundle/.next/server/app/api/system/open-terminal/route.js.nft.json +1 -1
  91. package/bundle/.next/server/app/api/system/open-terminal/route_client-reference-manifest.js +1 -1
  92. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js +1 -1
  93. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js.nft.json +1 -1
  94. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route_client-reference-manifest.js +1 -1
  95. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js +2 -2
  96. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js.nft.json +1 -1
  97. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route_client-reference-manifest.js +1 -1
  98. package/bundle/.next/server/app/api/update/route.js +2 -2
  99. package/bundle/.next/server/app/api/update/route.js.nft.json +1 -1
  100. package/bundle/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  101. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js +1 -0
  102. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js.nft.json +1 -0
  103. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route_client-reference-manifest.js +1 -0
  104. package/bundle/.next/server/app/api/workspaces/route.js +2 -2
  105. package/bundle/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  106. package/bundle/.next/server/app/api/workspaces/route_client-reference-manifest.js +1 -1
  107. package/bundle/.next/server/app/page.js +163 -12
  108. package/bundle/.next/server/app/page.js.nft.json +1 -1
  109. package/bundle/.next/server/app/page_client-reference-manifest.js +1 -1
  110. package/bundle/.next/server/app-paths-manifest.json +14 -12
  111. package/bundle/.next/server/chunks/212.js +98 -0
  112. package/bundle/.next/server/chunks/35.js +45 -0
  113. package/bundle/.next/server/chunks/408.js +18 -0
  114. package/bundle/.next/server/chunks/49.js +250 -0
  115. package/bundle/.next/server/chunks/{350.js → 661.js} +1 -1
  116. package/bundle/.next/server/chunks/678.js +1 -0
  117. package/bundle/.next/server/chunks/825.js +1 -0
  118. package/bundle/.next/server/functions-config-manifest.json +3 -1
  119. package/bundle/.next/server/middleware-build-manifest.js +1 -1
  120. package/bundle/.next/server/pages/404.html +1 -1
  121. package/bundle/.next/server/pages/500.html +1 -2
  122. package/bundle/.next/server/prefetch-hints.json +1 -0
  123. package/bundle/.next/server/server-reference-manifest.json +1 -1
  124. package/bundle/.next/static/GiI1KbaEnOWQ2uB6c5S7l/_buildManifest.js +1 -0
  125. package/bundle/.next/static/chunks/424-90a1df1753670aa3.js +32 -0
  126. package/bundle/.next/static/chunks/4a846800-6992bfdb6d680e8c.js +1 -0
  127. package/bundle/.next/static/chunks/583-20f3363124499c5d.js +1 -0
  128. package/bundle/.next/static/chunks/805-27fb5cc3e5bbb716.js +15 -0
  129. package/bundle/.next/static/chunks/app/_global-error/{page-75723f28c245a30d.js → page-e372189c79e963a1.js} +1 -1
  130. package/bundle/.next/static/chunks/app/_not-found/{page-75723f28c245a30d.js → page-e372189c79e963a1.js} +1 -1
  131. package/bundle/.next/static/chunks/app/api/agents/{route-75723f28c245a30d.js → route-e372189c79e963a1.js} +1 -1
  132. package/bundle/.next/static/chunks/app/api/diagnostics/{route-75723f28c245a30d.js → route-e372189c79e963a1.js} +1 -1
  133. package/bundle/.next/static/chunks/app/api/files/reveal/route-e372189c79e963a1.js +1 -0
  134. package/bundle/.next/static/chunks/app/api/gateway/control/route-e372189c79e963a1.js +1 -0
  135. package/bundle/.next/static/chunks/app/api/mission/route-e372189c79e963a1.js +1 -0
  136. package/bundle/.next/static/chunks/app/api/models/providers/route-e372189c79e963a1.js +1 -0
  137. package/bundle/.next/static/chunks/app/api/onboarding/models/route-e372189c79e963a1.js +1 -0
  138. package/bundle/.next/static/chunks/app/api/onboarding/route-e372189c79e963a1.js +1 -0
  139. package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-e372189c79e963a1.js +1 -0
  140. package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-e372189c79e963a1.js +1 -0
  141. package/bundle/.next/static/chunks/app/api/planner/[planId]/route-e372189c79e963a1.js +1 -0
  142. package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-e372189c79e963a1.js +1 -0
  143. package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-e372189c79e963a1.js +1 -0
  144. package/bundle/.next/static/chunks/app/api/planner/route-e372189c79e963a1.js +1 -0
  145. package/bundle/.next/static/chunks/app/api/reset/route-e372189c79e963a1.js +1 -0
  146. package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-e372189c79e963a1.js +1 -0
  147. package/bundle/.next/static/chunks/app/api/settings/gateway/route-e372189c79e963a1.js +1 -0
  148. package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-e372189c79e963a1.js +1 -0
  149. package/bundle/.next/static/chunks/app/api/snapshot/route-e372189c79e963a1.js +1 -0
  150. package/bundle/.next/static/chunks/app/api/stream/route-e372189c79e963a1.js +1 -0
  151. package/bundle/.next/static/chunks/app/api/system/open-terminal/route-e372189c79e963a1.js +1 -0
  152. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-e372189c79e963a1.js +1 -0
  153. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-e372189c79e963a1.js +1 -0
  154. package/bundle/.next/static/chunks/app/api/update/route-e372189c79e963a1.js +1 -0
  155. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-e372189c79e963a1.js +1 -0
  156. package/bundle/.next/static/chunks/app/api/workspaces/route-e372189c79e963a1.js +1 -0
  157. package/bundle/.next/static/chunks/app/layout-f64f74d82381e703.js +1 -0
  158. package/bundle/.next/static/chunks/app/not-found-e372189c79e963a1.js +1 -0
  159. package/bundle/.next/static/chunks/app/page-f4845e91032a411f.js +163 -0
  160. package/bundle/.next/static/chunks/f6503f1c-76bd524eece75922.js +1 -0
  161. package/bundle/.next/static/chunks/framework-3804ea39af33aa2e.js +1 -0
  162. package/bundle/.next/static/chunks/main-28f7be32434a5aa2.js +5 -0
  163. package/bundle/.next/static/chunks/main-app-5eca1027f109d5af.js +1 -0
  164. package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-e372189c79e963a1.js +1 -0
  165. package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-e372189c79e963a1.js +1 -0
  166. package/bundle/.next/static/chunks/next/dist/client/components/builtin/global-error-e382d739d625239d.js +1 -0
  167. package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-e372189c79e963a1.js +1 -0
  168. package/bundle/.next/static/chunks/webpack-5bdc2ea2996939e4.js +1 -0
  169. package/bundle/.next/static/css/de551c93149758e0.css +3 -0
  170. package/bundle/node_modules/@next/env/package.json +1 -1
  171. package/bundle/node_modules/next/dist/build/adapter/setup-node-env.external.js +15 -0
  172. package/bundle/node_modules/next/dist/build/analysis/extract-const-value.js +78 -63
  173. package/bundle/node_modules/next/dist/build/analysis/get-page-static-info.js +64 -40
  174. package/bundle/node_modules/next/dist/build/create-compiler-aliases.js +2 -0
  175. package/bundle/node_modules/next/dist/build/define-env.js +29 -11
  176. package/bundle/node_modules/next/dist/build/duration-to-string.js +1 -1
  177. package/bundle/node_modules/next/dist/build/entries.js +55 -295
  178. package/bundle/node_modules/next/dist/build/file-classifier.js +76 -0
  179. package/bundle/node_modules/next/dist/build/get-supported-browsers.js +38 -0
  180. package/bundle/node_modules/next/dist/build/load-jsconfig.js +7 -7
  181. package/bundle/node_modules/next/dist/build/lockfile.js +90 -9
  182. package/bundle/node_modules/next/dist/build/next-config-ts/transpile-config.js +128 -49
  183. package/bundle/node_modules/next/dist/build/print-build-errors.js +72 -0
  184. package/bundle/node_modules/next/dist/build/route-discovery.js +353 -0
  185. package/bundle/node_modules/next/dist/build/segment-config/app/app-segment-config.js +34 -17
  186. package/bundle/node_modules/next/dist/build/static-paths/app.js +68 -15
  187. package/bundle/node_modules/next/dist/build/static-paths/pages.js +3 -3
  188. package/bundle/node_modules/next/dist/build/swc/index.js +125 -48
  189. package/bundle/node_modules/next/dist/build/swc/loaderWorkerPool.js +40 -0
  190. package/bundle/node_modules/next/dist/build/swc/options.js +23 -6
  191. package/bundle/node_modules/next/dist/build/utils.js +48 -94
  192. package/bundle/node_modules/next/dist/build/webpack/config/blocks/css/index.js +14 -3
  193. package/bundle/node_modules/next/dist/build/webpack/config/blocks/css/loaders/global.js +4 -2
  194. package/bundle/node_modules/next/dist/build/webpack/config/blocks/css/loaders/modules.js +4 -2
  195. package/bundle/node_modules/next/dist/build/webpack/config/blocks/css/loaders/next-font.js +1 -0
  196. package/bundle/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js +5 -5
  197. package/bundle/node_modules/next/dist/build/webpack/config/index.js +3 -2
  198. package/bundle/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js +2 -1
  199. package/bundle/node_modules/next/dist/build/webpack/loaders/css-loader/src/plugins/postcss-url-parser.js +8 -1
  200. package/bundle/node_modules/next/dist/build/webpack/loaders/lightningcss-loader/src/loader.js +13 -4
  201. package/bundle/node_modules/next/dist/build/webpack/loaders/next-middleware-loader.js +3 -1
  202. package/bundle/node_modules/next/dist/build/webpack/plugins/build-manifest-plugin-utils.js +2 -16
  203. package/bundle/node_modules/next/dist/build/webpack/plugins/build-manifest-plugin.js +2 -2
  204. package/bundle/node_modules/next/dist/build/webpack/plugins/deferred-entries-plugin.js +106 -0
  205. package/bundle/node_modules/next/dist/build/webpack/plugins/flight-client-entry-plugin.js +16 -8
  206. package/bundle/node_modules/next/dist/build/webpack/plugins/flight-manifest-plugin.js +24 -11
  207. package/bundle/node_modules/next/dist/build/webpack/plugins/middleware-plugin.js +21 -2
  208. package/bundle/node_modules/next/dist/build/webpack/plugins/next-types-plugin/index.js +6 -5
  209. package/bundle/node_modules/next/dist/build/webpack/plugins/nextjs-require-cache-hot-reloader.js +10 -14
  210. package/bundle/node_modules/next/dist/build/webpack/plugins/wellknown-errors-plugin/parseNotFoundError.js +18 -4
  211. package/bundle/node_modules/next/dist/build/webpack/plugins/wellknown-errors-plugin/parseScss.js +5 -4
  212. package/bundle/node_modules/next/dist/build/webpack-config.js +18 -8
  213. package/bundle/node_modules/next/dist/cli/next-test.js +4 -3
  214. package/bundle/node_modules/next/dist/client/app-find-source-map-url.js +2 -1
  215. package/bundle/node_modules/next/dist/client/components/app-router-headers.js +10 -0
  216. package/bundle/node_modules/next/dist/client/components/app-router-instance.js +82 -4
  217. package/bundle/node_modules/next/dist/client/components/app-router.js +39 -20
  218. package/bundle/node_modules/next/dist/client/components/builtin/app-error.js +29 -65
  219. package/bundle/node_modules/next/dist/client/components/builtin/error-styles.js +165 -0
  220. package/bundle/node_modules/next/dist/client/components/builtin/global-error.js +56 -38
  221. package/bundle/node_modules/next/dist/client/components/error-boundary.js +16 -6
  222. package/bundle/node_modules/next/dist/client/components/forbidden.js +1 -1
  223. package/bundle/node_modules/next/dist/client/components/handle-isr-error.js +3 -4
  224. package/bundle/node_modules/next/dist/client/components/links.js +7 -0
  225. package/bundle/node_modules/next/dist/client/components/navigation-untracked.js +2 -0
  226. package/bundle/node_modules/next/dist/client/components/navigation.js +27 -0
  227. package/bundle/node_modules/next/dist/client/components/navigation.react-server.js +5 -2
  228. package/bundle/node_modules/next/dist/client/components/not-found.js +1 -1
  229. package/bundle/node_modules/next/dist/client/components/redirect-boundary.js +1 -1
  230. package/bundle/node_modules/next/dist/client/components/redirect-error.js +0 -9
  231. package/bundle/node_modules/next/dist/client/components/redirect.js +2 -2
  232. package/bundle/node_modules/next/dist/client/components/router-reducer/compute-changed-path.js +73 -0
  233. package/bundle/node_modules/next/dist/client/components/router-reducer/create-initial-router-state.js +102 -8
  234. package/bundle/node_modules/next/dist/client/components/router-reducer/fetch-server-response.js +165 -48
  235. package/bundle/node_modules/next/dist/client/components/router-reducer/is-navigating-to-new-root-layout.js +19 -11
  236. package/bundle/node_modules/next/dist/client/components/router-reducer/ppr-navigations.js +669 -457
  237. package/bundle/node_modules/next/dist/client/components/router-reducer/reducers/committed-state.js +49 -0
  238. package/bundle/node_modules/next/dist/client/components/router-reducer/reducers/find-head-in-cache.js +19 -20
  239. package/bundle/node_modules/next/dist/client/components/router-reducer/reducers/navigate-reducer.js +5 -117
  240. package/bundle/node_modules/next/dist/client/components/router-reducer/reducers/refresh-reducer.js +34 -19
  241. package/bundle/node_modules/next/dist/client/components/router-reducer/reducers/restore-reducer.js +16 -32
  242. package/bundle/node_modules/next/dist/client/components/router-reducer/reducers/server-action-reducer.js +85 -57
  243. package/bundle/node_modules/next/dist/client/components/router-reducer/reducers/server-patch-reducer.js +12 -10
  244. package/bundle/node_modules/next/dist/client/components/router-reducer/router-reducer-types.js +10 -1
  245. package/bundle/node_modules/next/dist/client/components/router-reducer/router-reducer.js +1 -1
  246. package/bundle/node_modules/next/dist/client/components/segment-cache/bfcache.js +128 -0
  247. package/bundle/node_modules/next/dist/client/components/segment-cache/cache.js +732 -231
  248. package/bundle/node_modules/next/dist/client/components/segment-cache/lru.js +13 -6
  249. package/bundle/node_modules/next/dist/client/components/segment-cache/navigation-testing-lock.js +194 -0
  250. package/bundle/node_modules/next/dist/client/components/segment-cache/navigation.js +388 -250
  251. package/bundle/node_modules/next/dist/client/components/segment-cache/optimistic-routes.js +543 -0
  252. package/bundle/node_modules/next/dist/client/components/segment-cache/scheduler.js +154 -55
  253. package/bundle/node_modules/next/dist/client/components/segment-cache/vary-path.js +63 -1
  254. package/bundle/node_modules/next/dist/client/components/unauthorized.js +1 -1
  255. package/bundle/node_modules/next/dist/client/components/use-action-queue.js +49 -3
  256. package/bundle/node_modules/next/dist/client/dev/hot-reloader/app/hot-reloader-app.js +9 -1
  257. package/bundle/node_modules/next/dist/client/flight-data-helpers.js +42 -29
  258. package/bundle/node_modules/next/dist/client/lib/javascript-url.js +32 -0
  259. package/bundle/node_modules/next/dist/client/lib/promise.js +53 -0
  260. package/bundle/node_modules/next/dist/client/{app-build-id.js → navigation-build-id.js} +17 -13
  261. package/bundle/node_modules/next/dist/client/react-client-callbacks/on-recoverable-error.js +14 -0
  262. package/bundle/node_modules/next/dist/client/route-loader.js +9 -46
  263. package/bundle/node_modules/next/dist/client/router.js +1 -1
  264. package/bundle/node_modules/next/dist/compiled/@next/font/dist/google/font-data.json +74 -3
  265. package/bundle/node_modules/next/dist/compiled/babel/bundle.js +1 -1
  266. package/bundle/node_modules/next/dist/compiled/babel-packages/packages-bundle.js +4 -4
  267. package/bundle/node_modules/next/dist/compiled/browserslist/index.js +1 -1
  268. package/bundle/node_modules/next/dist/compiled/http-proxy/index.js +5 -5
  269. package/bundle/node_modules/next/dist/compiled/next-devtools/index.js +2209 -23
  270. package/bundle/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js +42 -12
  271. package/bundle/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +42 -12
  272. package/bundle/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +42 -12
  273. package/bundle/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js +42 -12
  274. package/bundle/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js +2 -2
  275. package/bundle/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +10 -10
  276. package/bundle/node_modules/next/dist/compiled/next-server/pages.runtime.prod.js +10 -10
  277. package/bundle/node_modules/next/dist/compiled/react-is/package.json +1 -1
  278. package/bundle/node_modules/next/dist/compiled/tar/index.min.js +1 -0
  279. package/bundle/node_modules/next/dist/compiled/tar/package.json +1 -1
  280. package/bundle/node_modules/next/dist/compiled/unistore/unistore.js +1 -1
  281. package/bundle/node_modules/next/dist/lib/bundler.js +97 -0
  282. package/bundle/node_modules/next/dist/lib/constants.js +19 -4
  283. package/bundle/node_modules/next/dist/lib/download-swc.js +2 -2
  284. package/bundle/node_modules/next/dist/lib/find-root.js +11 -7
  285. package/bundle/node_modules/next/dist/lib/format-server-error.js +1 -0
  286. package/bundle/node_modules/next/dist/lib/generate-interception-routes-rewrites.js +3 -20
  287. package/bundle/node_modules/next/dist/lib/interop-default.js +1 -0
  288. package/bundle/node_modules/next/dist/lib/is-interception-route-rewrite.js +18 -0
  289. package/bundle/node_modules/next/dist/lib/load-custom-routes.js +49 -5
  290. package/bundle/node_modules/next/dist/lib/memory/trace.js +109 -0
  291. package/bundle/node_modules/next/dist/lib/metadata/get-metadata-route.js +11 -2
  292. package/bundle/node_modules/next/dist/lib/needs-experimental-react.js +2 -2
  293. package/bundle/node_modules/next/dist/lib/patch-incorrect-lockfile.js +5 -5
  294. package/bundle/node_modules/next/dist/lib/try-to-parse-path.js +1 -2
  295. package/bundle/node_modules/next/dist/lib/turbopack-warning.js +0 -1
  296. package/bundle/node_modules/next/dist/lib/typescript/diagnosticFormatter.js +6 -3
  297. package/bundle/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js +1 -1
  298. package/bundle/node_modules/next/dist/lib/typescript/missingDependencyError.js +1 -1
  299. package/bundle/node_modules/next/dist/lib/typescript/runTypeCheck.js +6 -8
  300. package/bundle/node_modules/next/dist/lib/typescript/type-paths.js +7 -12
  301. package/bundle/node_modules/next/dist/lib/typescript/writeAppTypeDeclarations.js +17 -7
  302. package/bundle/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.js +9 -12
  303. package/bundle/node_modules/next/dist/lib/verify-typescript-setup.js +66 -16
  304. package/bundle/node_modules/next/dist/next-devtools/server/shared.js +6 -10
  305. package/bundle/node_modules/next/dist/next-devtools/shared/webpack-module-path.js +4 -4
  306. package/bundle/node_modules/next/dist/next-devtools/userspace/app/app-dev-overlay-error-boundary.js +22 -4
  307. package/bundle/node_modules/next/dist/next-devtools/userspace/app/errors/stitched-error.js +7 -1
  308. package/bundle/node_modules/next/dist/next-devtools/userspace/app/forward-logs.js +18 -13
  309. package/bundle/node_modules/next/dist/next-devtools/userspace/app/segment-explorer-node.js +7 -4
  310. package/bundle/node_modules/next/dist/server/app-render/action-handler.js +83 -15
  311. package/bundle/node_modules/next/dist/server/app-render/app-render-prerender-utils.js +0 -82
  312. package/bundle/node_modules/next/dist/server/app-render/app-render-render-utils.js +45 -81
  313. package/bundle/node_modules/next/dist/server/app-render/app-render.js +1746 -803
  314. package/bundle/node_modules/next/dist/server/app-render/create-component-tree.js +136 -50
  315. package/bundle/node_modules/next/dist/server/app-render/create-error-handler.js +6 -4
  316. package/bundle/node_modules/next/dist/server/app-render/create-flight-router-state-from-loader-tree.js +52 -26
  317. package/bundle/node_modules/next/dist/server/app-render/csrf-protection.js +14 -3
  318. package/bundle/node_modules/next/dist/server/app-render/debug-channel-server.js +30 -0
  319. package/bundle/node_modules/next/dist/server/app-render/debug-channel-server.web.js +71 -0
  320. package/bundle/node_modules/next/dist/server/app-render/dynamic-rendering.js +353 -37
  321. package/bundle/node_modules/next/dist/server/app-render/get-asset-query-string.js +2 -2
  322. package/bundle/node_modules/next/dist/server/app-render/get-layer-assets.js +1 -1
  323. package/bundle/node_modules/next/dist/server/app-render/instant-validation/boundary-constants.js +13 -0
  324. package/bundle/node_modules/next/dist/server/app-render/instant-validation/boundary-tracking.js +18 -0
  325. package/bundle/node_modules/next/dist/server/app-render/instant-validation/instant-config.js +181 -0
  326. package/bundle/node_modules/next/dist/server/app-render/instant-validation/instant-samples-client.js +128 -0
  327. package/bundle/node_modules/next/dist/server/app-render/instant-validation/instant-samples.js +432 -0
  328. package/bundle/node_modules/next/dist/server/app-render/instant-validation/instant-validation-error.js +33 -0
  329. package/bundle/node_modules/next/dist/server/app-render/instant-validation/stream-utils.js +96 -0
  330. package/bundle/node_modules/next/dist/server/app-render/manifests-singleton.js +8 -1
  331. package/bundle/node_modules/next/dist/server/app-render/postponed-state.js +2 -1
  332. package/bundle/node_modules/next/dist/server/app-render/prospective-render-utils.js +1 -0
  333. package/bundle/node_modules/next/dist/server/app-render/segment-explorer-path.js +35 -10
  334. package/bundle/node_modules/next/dist/server/app-render/staged-rendering.js +142 -72
  335. package/bundle/node_modules/next/dist/server/app-render/stale-time.js +111 -0
  336. package/bundle/node_modules/next/dist/server/app-render/stream-ops.js +106 -0
  337. package/bundle/node_modules/next/dist/server/app-render/stream-ops.web.js +163 -0
  338. package/bundle/node_modules/next/dist/server/app-render/types.js +10 -4
  339. package/bundle/node_modules/next/dist/server/app-render/use-flight-response.js +3 -1
  340. package/bundle/node_modules/next/dist/server/app-render/vary-params.js +336 -0
  341. package/bundle/node_modules/next/dist/server/app-render/walk-tree-with-flight-router-state.js +59 -12
  342. package/bundle/node_modules/next/dist/server/app-render/work-unit-async-storage.external.js +54 -26
  343. package/bundle/node_modules/next/dist/server/async-storage/request-store.js +4 -4
  344. package/bundle/node_modules/next/dist/server/async-storage/work-store.js +2 -5
  345. package/bundle/node_modules/next/dist/server/base-server.js +65 -53
  346. package/bundle/node_modules/next/dist/server/config-schema.js +93 -8
  347. package/bundle/node_modules/next/dist/server/config-shared.js +57 -7
  348. package/bundle/node_modules/next/dist/server/config.js +96 -25
  349. package/bundle/node_modules/next/dist/server/dev/browser-logs/file-logger.js +9 -6
  350. package/bundle/node_modules/next/dist/server/dev/browser-logs/receive-logs.js +46 -0
  351. package/bundle/node_modules/next/dist/server/dev/browser-logs/source-map.js +1 -4
  352. package/bundle/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +264 -33
  353. package/bundle/node_modules/next/dist/server/dev/hot-reloader-webpack.js +8 -4
  354. package/bundle/node_modules/next/dist/server/dev/log-requests.js +10 -2
  355. package/bundle/node_modules/next/dist/server/dev/middleware-turbopack.js +20 -10
  356. package/bundle/node_modules/next/dist/server/dev/middleware-webpack.js +13 -3
  357. package/bundle/node_modules/next/dist/server/dev/next-dev-server.js +19 -6
  358. package/bundle/node_modules/next/dist/server/dev/on-demand-entry-handler.js +69 -0
  359. package/bundle/node_modules/next/dist/server/dev/require-cache.js +51 -21
  360. package/bundle/node_modules/next/dist/server/dev/server-action-logger.js +37 -0
  361. package/bundle/node_modules/next/dist/server/dev/static-paths-worker.js +1 -0
  362. package/bundle/node_modules/next/dist/server/dev/turbopack-utils.js +6 -15
  363. package/bundle/node_modules/next/dist/server/dynamic-rendering-utils.js +22 -0
  364. package/bundle/node_modules/next/dist/server/image-optimizer.js +157 -27
  365. package/bundle/node_modules/next/dist/server/lib/app-info-log.js +16 -38
  366. package/bundle/node_modules/next/dist/server/lib/cache-control.js +1 -1
  367. package/bundle/node_modules/next/dist/server/lib/clone-response.js +16 -16
  368. package/bundle/node_modules/next/dist/server/lib/cpu-profile.js +47 -16
  369. package/bundle/node_modules/next/dist/server/lib/dev-bundler-service.js +2 -2
  370. package/bundle/node_modules/next/dist/server/lib/disk-lru-cache.external.js +57 -0
  371. package/bundle/node_modules/next/dist/server/lib/find-page-file.js +27 -7
  372. package/bundle/node_modules/next/dist/server/lib/implicit-tags.js +3 -3
  373. package/bundle/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js +5 -3
  374. package/bundle/node_modules/next/dist/server/lib/incremental-cache/index.js +32 -10
  375. package/bundle/node_modules/next/dist/server/lib/incremental-cache/memory-cache.external.js +18 -1
  376. package/bundle/node_modules/next/dist/server/lib/install-code-frame.js +22 -0
  377. package/bundle/node_modules/next/dist/server/lib/lru-cache.js +9 -1
  378. package/bundle/node_modules/next/dist/server/lib/patch-fetch.js +40 -7
  379. package/bundle/node_modules/next/dist/server/lib/postponed-request-body.js +64 -0
  380. package/bundle/node_modules/next/dist/server/lib/render-server.js +4 -1
  381. package/bundle/node_modules/next/dist/server/lib/router-server.js +24 -13
  382. package/bundle/node_modules/next/dist/server/lib/router-utils/block-cross-site-dev.js +110 -0
  383. package/bundle/node_modules/next/dist/server/lib/router-utils/filesystem.js +16 -15
  384. package/bundle/node_modules/next/dist/server/lib/router-utils/resolve-routes.js +32 -11
  385. package/bundle/node_modules/next/dist/server/lib/router-utils/route-types-utils.js +3 -3
  386. package/bundle/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js +71 -71
  387. package/bundle/node_modules/next/dist/server/lib/router-utils/typegen.js +247 -2
  388. package/bundle/node_modules/next/dist/server/lib/server-ipc/utils.js +2 -1
  389. package/bundle/node_modules/next/dist/server/lib/start-server.js +73 -39
  390. package/bundle/node_modules/next/dist/server/lib/trace/tracer.js +11 -1
  391. package/bundle/node_modules/next/dist/server/lib/utils.js +40 -11
  392. package/bundle/node_modules/next/dist/server/load-components.js +2 -0
  393. package/bundle/node_modules/next/dist/server/load-manifest.external.js +37 -17
  394. package/bundle/node_modules/next/dist/server/mcp/tools/get-errors.js +11 -4
  395. package/bundle/node_modules/next/dist/server/mcp/tools/get-logs.js +9 -3
  396. package/bundle/node_modules/next/dist/server/mcp/tools/get-page-metadata.js +52 -44
  397. package/bundle/node_modules/next/dist/server/mcp/tools/get-project-metadata.js +6 -2
  398. package/bundle/node_modules/next/dist/server/mcp/tools/get-routes.js +44 -79
  399. package/bundle/node_modules/next/dist/server/mcp/tools/get-server-action-by-id.js +12 -4
  400. package/bundle/node_modules/next/dist/server/mcp/tools/utils/format-errors.js +62 -72
  401. package/bundle/node_modules/next/dist/server/next-server.js +69 -99
  402. package/bundle/node_modules/next/dist/server/next.js +3 -0
  403. package/bundle/node_modules/next/dist/server/node-environment-extensions/console-dim.external.js +61 -6
  404. package/bundle/node_modules/next/dist/server/node-environment-extensions/date.js +4 -4
  405. package/bundle/node_modules/next/dist/server/node-environment-extensions/fast-set-immediate.external.js +13 -6
  406. package/bundle/node_modules/next/dist/server/node-environment-extensions/{utils.js → io-utils.js} +14 -5
  407. package/bundle/node_modules/next/dist/server/node-environment-extensions/node-crypto.js +8 -8
  408. package/bundle/node_modules/next/dist/server/node-environment-extensions/process-error-handlers.js +91 -0
  409. package/bundle/node_modules/next/dist/server/node-environment-extensions/random.js +2 -2
  410. package/bundle/node_modules/next/dist/server/node-environment-extensions/{unhandled-rejection.js → unhandled-rejection.external.js} +23 -4
  411. package/bundle/node_modules/next/dist/server/node-environment-extensions/web-crypto.js +3 -3
  412. package/bundle/node_modules/next/dist/server/node-environment.js +1 -1
  413. package/bundle/node_modules/next/dist/server/normalizers/request/segment-prefix-rsc.js +2 -1
  414. package/bundle/node_modules/next/dist/server/patch-error-inspect.js +37 -20
  415. package/bundle/node_modules/next/dist/server/render-result.js +9 -0
  416. package/bundle/node_modules/next/dist/server/render.js +27 -25
  417. package/bundle/node_modules/next/dist/server/require-hook.js +19 -8
  418. package/bundle/node_modules/next/dist/server/response-cache/utils.js +1 -0
  419. package/bundle/node_modules/next/dist/server/resume-data-cache/cache-store.js +35 -23
  420. package/bundle/node_modules/next/dist/server/resume-data-cache/resume-data-cache.js +16 -7
  421. package/bundle/node_modules/next/dist/server/revalidation-utils.js +12 -7
  422. package/bundle/node_modules/next/dist/server/route-matcher-providers/dev/dev-app-page-route-matcher-provider.js +2 -1
  423. package/bundle/node_modules/next/dist/server/route-modules/app-page/helpers/prerender-manifest-matcher.js +4 -1
  424. package/bundle/node_modules/next/dist/server/route-modules/app-page/module.js +31 -1
  425. package/bundle/node_modules/next/dist/server/route-modules/app-page/normalize-request-url.js +25 -0
  426. package/bundle/node_modules/next/dist/server/route-modules/pages/pages-handler.js +31 -8
  427. package/bundle/node_modules/next/dist/server/route-modules/route-module.js +71 -18
  428. package/bundle/node_modules/next/dist/server/stream-utils/encoded-tags.js +8 -0
  429. package/bundle/node_modules/next/dist/server/stream-utils/node-web-streams-helper.js +239 -58
  430. package/bundle/node_modules/next/dist/server/stream-utils/uint8array-helpers.js +7 -2
  431. package/bundle/node_modules/next/dist/server/typescript/constant.js +1 -0
  432. package/bundle/node_modules/next/dist/server/typescript/rules/config.js +14 -3
  433. package/bundle/node_modules/next/dist/server/web/adapter.js +7 -3
  434. package/bundle/node_modules/next/dist/server/web/next-url.js +6 -2
  435. package/bundle/node_modules/next/dist/server/web/sandbox/sandbox.js +3 -0
  436. package/bundle/node_modules/next/dist/shared/lib/app-router-types.js +30 -11
  437. package/bundle/node_modules/next/dist/shared/lib/constants.js +7 -7
  438. package/bundle/node_modules/next/dist/shared/lib/deployment-id.js +37 -10
  439. package/bundle/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
  440. package/bundle/node_modules/next/dist/shared/lib/errors/code-frame.js +20 -0
  441. package/bundle/node_modules/next/dist/shared/lib/format-webpack-messages.js +22 -2
  442. package/bundle/node_modules/next/dist/shared/lib/image-config.js +3 -1
  443. package/bundle/node_modules/next/dist/shared/lib/is-internal.js +2 -0
  444. package/bundle/node_modules/next/dist/shared/lib/magic-identifier.js +6 -6
  445. package/bundle/node_modules/next/dist/shared/lib/router/router.js +32 -0
  446. package/bundle/node_modules/next/dist/shared/lib/router/utils/app-paths.js +11 -0
  447. package/bundle/node_modules/next/dist/shared/lib/router/utils/get-dynamic-param.js +11 -4
  448. package/bundle/node_modules/next/dist/shared/lib/router/utils/parse-loader-tree.js +3 -2
  449. package/bundle/node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js +9 -2
  450. package/bundle/node_modules/next/dist/shared/lib/router/utils/parse-url.js +8 -2
  451. package/bundle/node_modules/next/dist/shared/lib/segment-cache/vary-params-decoding.js +32 -0
  452. package/bundle/node_modules/next/dist/shared/lib/server-reference-info.js +4 -0
  453. package/bundle/node_modules/next/dist/shared/lib/size-limit.js +6 -1
  454. package/bundle/node_modules/next/dist/shared/lib/turbopack/compilation-events.js +47 -10
  455. package/bundle/node_modules/next/dist/shared/lib/turbopack/manifest-loader.js +90 -116
  456. package/bundle/node_modules/next/dist/shared/lib/turbopack/utils.js +14 -26
  457. package/bundle/node_modules/next/dist/shared/lib/utils/reflect-utils.js +69 -0
  458. package/bundle/node_modules/next/dist/shared/lib/utils.js +2 -2
  459. package/bundle/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
  460. package/bundle/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
  461. package/bundle/node_modules/next/dist/telemetry/events/version.js +2 -2
  462. package/bundle/node_modules/next/dist/trace/index.js +4 -0
  463. package/bundle/node_modules/next/dist/trace/report/to-json-build.js +11 -108
  464. package/bundle/node_modules/next/dist/trace/report/to-json.js +52 -38
  465. package/bundle/node_modules/next/dist/trace/trace.js +15 -1
  466. package/bundle/node_modules/next/package.json +21 -23
  467. package/bundle/node_modules/react/cjs/react.development.js +1284 -0
  468. package/bundle/package.json +2 -2
  469. package/bundle/server.js +1 -1
  470. package/package.json +1 -1
  471. package/bundle/.next/server/chunks/31.js +0 -1
  472. package/bundle/.next/server/chunks/419.js +0 -249
  473. package/bundle/.next/server/chunks/463.js +0 -13
  474. package/bundle/.next/server/chunks/603.js +0 -91
  475. package/bundle/.next/server/chunks/709.js +0 -22
  476. package/bundle/.next/server/chunks/957.js +0 -1
  477. package/bundle/.next/static/chunks/26-8f7c2b7e8773b4cb.js +0 -2
  478. package/bundle/.next/static/chunks/273-31916bcd40e3f381.js +0 -1
  479. package/bundle/.next/static/chunks/474f1956-ebf51c0dd00ff236.js +0 -1
  480. package/bundle/.next/static/chunks/4a846800-817e4d43c6c4047f.js +0 -1
  481. package/bundle/.next/static/chunks/878-919c758aa9e87b6d.js +0 -13
  482. package/bundle/.next/static/chunks/app/api/files/reveal/route-75723f28c245a30d.js +0 -1
  483. package/bundle/.next/static/chunks/app/api/gateway/control/route-75723f28c245a30d.js +0 -1
  484. package/bundle/.next/static/chunks/app/api/mission/route-75723f28c245a30d.js +0 -1
  485. package/bundle/.next/static/chunks/app/api/models/providers/route-75723f28c245a30d.js +0 -1
  486. package/bundle/.next/static/chunks/app/api/onboarding/models/route-75723f28c245a30d.js +0 -1
  487. package/bundle/.next/static/chunks/app/api/onboarding/route-75723f28c245a30d.js +0 -1
  488. package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-75723f28c245a30d.js +0 -1
  489. package/bundle/.next/static/chunks/app/api/planner/[planId]/route-75723f28c245a30d.js +0 -1
  490. package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-75723f28c245a30d.js +0 -1
  491. package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-75723f28c245a30d.js +0 -1
  492. package/bundle/.next/static/chunks/app/api/planner/route-75723f28c245a30d.js +0 -1
  493. package/bundle/.next/static/chunks/app/api/reset/route-75723f28c245a30d.js +0 -1
  494. package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-75723f28c245a30d.js +0 -1
  495. package/bundle/.next/static/chunks/app/api/settings/gateway/route-75723f28c245a30d.js +0 -1
  496. package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-75723f28c245a30d.js +0 -1
  497. package/bundle/.next/static/chunks/app/api/snapshot/route-75723f28c245a30d.js +0 -1
  498. package/bundle/.next/static/chunks/app/api/stream/route-75723f28c245a30d.js +0 -1
  499. package/bundle/.next/static/chunks/app/api/system/open-terminal/route-75723f28c245a30d.js +0 -1
  500. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-75723f28c245a30d.js +0 -1
  501. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-75723f28c245a30d.js +0 -1
  502. package/bundle/.next/static/chunks/app/api/update/route-75723f28c245a30d.js +0 -1
  503. package/bundle/.next/static/chunks/app/api/workspaces/route-75723f28c245a30d.js +0 -1
  504. package/bundle/.next/static/chunks/app/layout-6c2c9cd9b518452f.js +0 -1
  505. package/bundle/.next/static/chunks/app/not-found-75723f28c245a30d.js +0 -1
  506. package/bundle/.next/static/chunks/app/page-dee040e8fa0bfe5c.js +0 -14
  507. package/bundle/.next/static/chunks/framework-56f40d86ebc2172f.js +0 -1
  508. package/bundle/.next/static/chunks/main-app-245e6e74e3ad1df9.js +0 -1
  509. package/bundle/.next/static/chunks/main-f015e68ea54ff136.js +0 -5
  510. package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-75723f28c245a30d.js +0 -1
  511. package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-75723f28c245a30d.js +0 -1
  512. package/bundle/.next/static/chunks/next/dist/client/components/builtin/global-error-62eeb2b37b76f847.js +0 -1
  513. package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-75723f28c245a30d.js +0 -1
  514. package/bundle/.next/static/chunks/webpack-032b5b42e067a790.js +0 -1
  515. package/bundle/.next/static/css/665b6d1d1e231c6e.css +0 -3
  516. package/bundle/.next/static/dMZieB6mihw477BgExG8r/_buildManifest.js +0 -1
  517. package/bundle/node_modules/next/dist/client/components/router-reducer/handle-mutable.js +0 -66
  518. package/bundle/node_modules/next/dist/compiled/babel/code-frame.js +0 -1
  519. package/bundle/node_modules/next/dist/compiled/babel-code-frame/index.js +0 -1
  520. package/bundle/node_modules/next/dist/compiled/babel-code-frame/package.json +0 -1
  521. package/bundle/node_modules/next/dist/compiled/tar/index.js +0 -1
  522. package/bundle/node_modules/next/dist/server/app-render/staged-validation.js +0 -32
  523. package/bundle/node_modules/next/dist/server/lib/router-utils/block-cross-site.js +0 -76
  524. package/bundle/node_modules/next/dist/shared/lib/segment-cache/output-export-prefetch-encoding.js +0 -52
  525. package/bundle/node_modules/typescript/lib/typescript.js +0 -200276
  526. package/bundle/node_modules/typescript/package.json +0 -120
  527. /package/bundle/.next/static/{dMZieB6mihw477BgExG8r → GiI1KbaEnOWQ2uB6c5S7l}/_ssgManifest.js +0 -0
@@ -1,8 +1,8 @@
1
- (()=>{var a={};a.id=974,a.ids=[974],a.modules={216:()=>{},261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},722:a=>{"use strict";a.exports=require("next/dist/shared/lib/invariant-error")},846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},1025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},1231:(a,b,c)=>{"use strict";a.exports=c(2544)},1421:a=>{"use strict";a.exports=require("node:child_process")},1455:a=>{"use strict";a.exports=require("node:fs/promises")},1630:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,7809,23))},1870:(a,b,c)=>{Promise.resolve().then(c.bind(c,2721))},1894:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,5987,23))},2045:(a,b,c)=>{"use strict";let d,e,f,g,h,i,j;c.d(b,{MissionControlShell:()=>uy});var k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D=c(3958),E=c(636),F=c.t(E,2);let G=a=>{let b=a.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,b,c)=>c?c.toUpperCase():b.toLowerCase());return b.charAt(0).toUpperCase()+b.slice(1)},H=(...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim();var I={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let J=(0,E.forwardRef)(({color:a="currentColor",size:b=24,strokeWidth:c=2,absoluteStrokeWidth:d,className:e="",children:f,iconNode:g,...h},i)=>(0,E.createElement)("svg",{ref:i,...I,width:b,height:b,stroke:a,strokeWidth:d?24*Number(c)/Number(b):c,className:H("lucide",e),...!f&&!(a=>{for(let b in a)if(b.startsWith("aria-")||"role"===b||"title"===b)return!0})(h)&&{"aria-hidden":"true"},...h},[...g.map(([a,b])=>(0,E.createElement)(a,b)),...Array.isArray(f)?f:[f]])),K=(a,b)=>{let c=(0,E.forwardRef)(({className:c,...d},e)=>(0,E.createElement)(J,{ref:e,iconNode:b,className:H(`lucide-${G(a).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${a}`,c),...d}));return c.displayName=G(a),c},L=K("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),M=K("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),N=K("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),O=K("sun-medium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]),P=K("moon-star",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]),Q=K("settings-2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),R=K("circle-arrow-up",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]),S=K("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),T=K("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),U=K("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),V=K("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),W=K("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),X=K("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),Y=K("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),Z=K("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);function $(){for(var a,b,c=0,d="",e=arguments.length;c<e;c++)(a=arguments[c])&&(b=function a(b){var c,d,e="";if("string"==typeof b||"number"==typeof b)e+=b;else if("object"==typeof b)if(Array.isArray(b)){var f=b.length;for(c=0;c<f;c++)b[c]&&(d=a(b[c]))&&(e&&(e+=" "),e+=d)}else for(d in b)b[d]&&(e&&(e+=" "),e+=d);return e}(a))&&(d&&(d+=" "),d+=b);return d}let _=a=>"boolean"==typeof a?`${a}`:0===a?"0":a,aa=(a,b)=>c=>{var d;if((null==b?void 0:b.variants)==null)return $(a,null==c?void 0:c.class,null==c?void 0:c.className);let{variants:e,defaultVariants:f}=b,g=Object.keys(e).map(a=>{let b=null==c?void 0:c[a],d=null==f?void 0:f[a];if(null===b)return null;let g=_(b)||_(d);return e[a][g]}),h=c&&Object.entries(c).reduce((a,b)=>{let[c,d]=b;return void 0===d||(a[c]=d),a},{});return $(a,g,null==b||null==(d=b.compoundVariants)?void 0:d.reduce((a,b)=>{let{class:c,className:d,...e}=b;return Object.entries(e).every(a=>{let[b,c]=a;return Array.isArray(c)?c.includes({...f,...h}[b]):({...f,...h})[b]===c})?[...a,c,d]:a},[]),null==c?void 0:c.class,null==c?void 0:c.className)},ab=(a=new Map,b=null,c)=>({nextPart:a,validators:b,classGroupId:c}),ac=[],ad=(a,b,c)=>{if(0==a.length-b)return c.classGroupId;let d=a[b],e=c.nextPart.get(d);if(e){let c=ad(a,b+1,e);if(c)return c}let f=c.validators;if(null===f)return;let g=0===b?a.join("-"):a.slice(b).join("-"),h=f.length;for(let a=0;a<h;a++){let b=f[a];if(b.validator(g))return b.classGroupId}},ae=(a,b)=>{let c=ab();for(let d in a)af(a[d],c,d,b);return c},af=(a,b,c,d)=>{let e=a.length;for(let f=0;f<e;f++)ag(a[f],b,c,d)},ag=(a,b,c,d)=>{"string"==typeof a?ah(a,b,c):"function"==typeof a?ai(a,b,c,d):aj(a,b,c,d)},ah=(a,b,c)=>{(""===a?b:ak(b,a)).classGroupId=c},ai=(a,b,c,d)=>{al(a)?af(a(d),b,c,d):(null===b.validators&&(b.validators=[]),b.validators.push({classGroupId:c,validator:a}))},aj=(a,b,c,d)=>{let e=Object.entries(a),f=e.length;for(let a=0;a<f;a++){let[f,g]=e[a];af(g,ak(b,f),c,d)}},ak=(a,b)=>{let c=a,d=b.split("-"),e=d.length;for(let a=0;a<e;a++){let b=d[a],e=c.nextPart.get(b);e||(e=ab(),c.nextPart.set(b,e)),c=e}return c},al=a=>"isThemeGetter"in a&&!0===a.isThemeGetter,am=[],an=(a,b,c,d,e)=>({modifiers:a,hasImportantModifier:b,baseClassName:c,maybePostfixModifierPosition:d,isExternal:e}),ao=/\s+/,ap=a=>{let b;if("string"==typeof a)return a;let c="";for(let d=0;d<a.length;d++)a[d]&&(b=ap(a[d]))&&(c&&(c+=" "),c+=b);return c},aq=[],ar=a=>{let b=b=>b[a]||aq;return b.isThemeGetter=!0,b},as=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,at=/^\((?:(\w[\w-]*):)?(.+)\)$/i,au=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,av=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,aw=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ax=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ay=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,az=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,aA=a=>au.test(a),aB=a=>!!a&&!Number.isNaN(Number(a)),aC=a=>!!a&&Number.isInteger(Number(a)),aD=a=>a.endsWith("%")&&aB(a.slice(0,-1)),aE=a=>av.test(a),aF=()=>!0,aG=a=>aw.test(a)&&!ax.test(a),aH=()=>!1,aI=a=>ay.test(a),aJ=a=>az.test(a),aK=a=>!aM(a)&&!aU(a),aL=a=>a0(a,a4,aH),aM=a=>as.test(a),aN=a=>a0(a,a5,aG),aO=a=>a0(a,a6,aB),aP=a=>a0(a,a8,aF),aQ=a=>a0(a,a7,aH),aR=a=>a0(a,a2,aH),aS=a=>a0(a,a3,aJ),aT=a=>a0(a,a9,aI),aU=a=>at.test(a),aV=a=>a1(a,a5),aW=a=>a1(a,a7),aX=a=>a1(a,a2),aY=a=>a1(a,a4),aZ=a=>a1(a,a3),a$=a=>a1(a,a9,!0),a_=a=>a1(a,a8,!0),a0=(a,b,c)=>{let d=as.exec(a);return!!d&&(d[1]?b(d[1]):c(d[2]))},a1=(a,b,c=!1)=>{let d=at.exec(a);return!!d&&(d[1]?b(d[1]):c)},a2=a=>"position"===a||"percentage"===a,a3=a=>"image"===a||"url"===a,a4=a=>"length"===a||"size"===a||"bg-size"===a,a5=a=>"length"===a,a6=a=>"number"===a,a7=a=>"family-name"===a,a8=a=>"number"===a||"weight"===a,a9=a=>"shadow"===a,ba=((a,...b)=>{let c,d,e,f,g=a=>{let b=d(a);if(b)return b;let f=((a,b)=>{let{parseClassName:c,getClassGroupId:d,getConflictingClassGroupIds:e,sortModifiers:f}=b,g=[],h=a.trim().split(ao),i="";for(let a=h.length-1;a>=0;a-=1){let b=h[a],{isExternal:j,modifiers:k,hasImportantModifier:l,baseClassName:m,maybePostfixModifierPosition:n}=c(b);if(j){i=b+(i.length>0?" "+i:i);continue}let o=!!n,p=d(o?m.substring(0,n):m);if(!p){if(!o||!(p=d(m))){i=b+(i.length>0?" "+i:i);continue}o=!1}let q=0===k.length?"":1===k.length?k[0]:f(k).join(":"),r=l?q+"!":q,s=r+p;if(g.indexOf(s)>-1)continue;g.push(s);let t=e(p,o);for(let a=0;a<t.length;++a){let b=t[a];g.push(r+b)}i=b+(i.length>0?" "+i:i)}return i})(a,c);return e(a,f),f};return f=h=>{var i;let j;return d=(c={cache:(a=>{if(a<1)return{get:()=>void 0,set:()=>{}};let b=0,c=Object.create(null),d=Object.create(null),e=(e,f)=>{c[e]=f,++b>a&&(b=0,d=c,c=Object.create(null))};return{get(a){let b=c[a];return void 0!==b?b:void 0!==(b=d[a])?(e(a,b),b):void 0},set(a,b){a in c?c[a]=b:e(a,b)}}})((i=b.reduce((a,b)=>b(a),a())).cacheSize),parseClassName:(a=>{let{prefix:b,experimentalParseClassName:c}=a,d=a=>{let b,c=[],d=0,e=0,f=0,g=a.length;for(let h=0;h<g;h++){let g=a[h];if(0===d&&0===e){if(":"===g){c.push(a.slice(f,h)),f=h+1;continue}if("/"===g){b=h;continue}}"["===g?d++:"]"===g?d--:"("===g?e++:")"===g&&e--}let h=0===c.length?a:a.slice(f),i=h,j=!1;return h.endsWith("!")?(i=h.slice(0,-1),j=!0):h.startsWith("!")&&(i=h.slice(1),j=!0),an(c,j,i,b&&b>f?b-f:void 0)};if(b){let a=b+":",c=d;d=b=>b.startsWith(a)?c(b.slice(a.length)):an(am,!1,b,void 0,!0)}if(c){let a=d;d=b=>c({className:b,parseClassName:a})}return d})(i),sortModifiers:(j=new Map,i.orderSensitiveModifiers.forEach((a,b)=>{j.set(a,1e6+b)}),a=>{let b=[],c=[];for(let d=0;d<a.length;d++){let e=a[d],f="["===e[0],g=j.has(e);f||g?(c.length>0&&(c.sort(),b.push(...c),c=[]),b.push(e)):c.push(e)}return c.length>0&&(c.sort(),b.push(...c)),b}),...(a=>{let b=(a=>{let{theme:b,classGroups:c}=a;return ae(c,b)})(a),{conflictingClassGroups:c,conflictingClassGroupModifiers:d}=a;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]")){var c;let b,d,e;return -1===(c=a).slice(1,-1).indexOf(":")?void 0:(d=(b=c.slice(1,-1)).indexOf(":"),(e=b.slice(0,d))?"arbitrary.."+e:void 0)}let d=a.split("-"),e=+(""===d[0]&&d.length>1);return ad(d,e,b)},getConflictingClassGroupIds:(a,b)=>{if(b){let b=d[a],e=c[a];if(b){if(e){let a=Array(e.length+b.length);for(let b=0;b<e.length;b++)a[b]=e[b];for(let c=0;c<b.length;c++)a[e.length+c]=b[c];return a}return b}return e||ac}return c[a]||ac}}})(i)}).cache.get,e=c.cache.set,f=g,g(h)},(...a)=>f(((...a)=>{let b,c,d=0,e="";for(;d<a.length;)(b=a[d++])&&(c=ap(b))&&(e&&(e+=" "),e+=c);return e})(...a))})(()=>{let a=ar("color"),b=ar("font"),c=ar("text"),d=ar("font-weight"),e=ar("tracking"),f=ar("leading"),g=ar("breakpoint"),h=ar("container"),i=ar("spacing"),j=ar("radius"),k=ar("shadow"),l=ar("inset-shadow"),m=ar("text-shadow"),n=ar("drop-shadow"),o=ar("blur"),p=ar("perspective"),q=ar("aspect"),r=ar("ease"),s=ar("animate"),t=()=>["auto","avoid","all","avoid-page","page","left","right","column"],u=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],v=()=>[...u(),aU,aM],w=()=>["auto","hidden","clip","visible","scroll"],x=()=>["auto","contain","none"],y=()=>[aU,aM,i],z=()=>[aA,"full","auto",...y()],A=()=>[aC,"none","subgrid",aU,aM],B=()=>["auto",{span:["full",aC,aU,aM]},aC,aU,aM],C=()=>[aC,"auto",aU,aM],D=()=>["auto","min","max","fr",aU,aM],E=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...y()],H=()=>[aA,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...y()],I=()=>[aA,"screen","full","dvw","lvw","svw","min","max","fit",...y()],J=()=>[aA,"screen","full","lh","dvh","lvh","svh","min","max","fit",...y()],K=()=>[a,aU,aM],L=()=>[...u(),aX,aR,{position:[aU,aM]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],N=()=>["auto","cover","contain",aY,aL,{size:[aU,aM]}],O=()=>[aD,aV,aN],P=()=>["","none","full",j,aU,aM],Q=()=>["",aB,aV,aN],R=()=>["solid","dashed","dotted","double"],S=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],T=()=>[aB,aD,aX,aR],U=()=>["","none",o,aU,aM],V=()=>["none",aB,aU,aM],W=()=>["none",aB,aU,aM],X=()=>[aB,aU,aM],Y=()=>[aA,"full",...y()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[aE],breakpoint:[aE],color:[aF],container:[aE],"drop-shadow":[aE],ease:["in","out","in-out"],font:[aK],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[aE],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[aE],shadow:[aE],spacing:["px",aB],text:[aE],"text-shadow":[aE],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",aA,aM,aU,q]}],container:["container"],columns:[{columns:[aB,aM,aU,h]}],"break-after":[{"break-after":t()}],"break-before":[{"break-before":t()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:v()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:x()}],"overscroll-x":[{"overscroll-x":x()}],"overscroll-y":[{"overscroll-y":x()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{"inset-s":z(),start:z()}],end:[{"inset-e":z(),end:z()}],"inset-bs":[{"inset-bs":z()}],"inset-be":[{"inset-be":z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[aC,"auto",aU,aM]}],basis:[{basis:[aA,"full","auto",h,...y()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[aB,aA,"auto","initial","none",aM]}],grow:[{grow:["",aB,aU,aM]}],shrink:[{shrink:["",aB,aU,aM]}],order:[{order:[aC,"first","last","none",aU,aM]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:y()}],"gap-x":[{"gap-x":y()}],"gap-y":[{"gap-y":y()}],"justify-content":[{justify:[...E(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...E()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":E()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:y()}],px:[{px:y()}],py:[{py:y()}],ps:[{ps:y()}],pe:[{pe:y()}],pbs:[{pbs:y()}],pbe:[{pbe:y()}],pt:[{pt:y()}],pr:[{pr:y()}],pb:[{pb:y()}],pl:[{pl:y()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mbs:[{mbs:G()}],mbe:[{mbe:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":y()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":y()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"inline-size":[{inline:["auto",...I()]}],"min-inline-size":[{"min-inline":["auto",...I()]}],"max-inline-size":[{"max-inline":["none",...I()]}],"block-size":[{block:["auto",...J()]}],"min-block-size":[{"min-block":["auto",...J()]}],"max-block-size":[{"max-block":["none",...J()]}],w:[{w:[h,"screen",...H()]}],"min-w":[{"min-w":[h,"screen","none",...H()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[g]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",c,aV,aN]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[d,a_,aP]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",aD,aM]}],"font-family":[{font:[aW,aQ,b]}],"font-features":[{"font-features":[aM]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[e,aU,aM]}],"line-clamp":[{"line-clamp":[aB,"none",aU,aO]}],leading:[{leading:[f,...y()]}],"list-image":[{"list-image":["none",aU,aM]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",aU,aM]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...R(),"wavy"]}],"text-decoration-thickness":[{decoration:[aB,"from-font","auto",aU,aN]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[aB,"auto",aU,aM]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:y()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",aU,aM]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",aU,aM]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},aC,aU,aM],radial:["",aU,aM],conic:[aC,aU,aM]},aZ,aS]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:O()}],"gradient-via-pos":[{via:O()}],"gradient-to-pos":[{to:O()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-bs":[{"border-bs":Q()}],"border-w-be":[{"border-be":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...R(),"hidden","none"]}],"divide-style":[{divide:[...R(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-bs":[{"border-bs":K()}],"border-color-be":[{"border-be":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...R(),"none","hidden"]}],"outline-offset":[{"outline-offset":[aB,aU,aM]}],"outline-w":[{outline:["",aB,aV,aN]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",k,a$,aT]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",l,a$,aT]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[aB,aN]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",m,a$,aT]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[aB,aU,aM]}],"mix-blend":[{"mix-blend":[...S(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":S()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[aB]}],"mask-image-linear-from-pos":[{"mask-linear-from":T()}],"mask-image-linear-to-pos":[{"mask-linear-to":T()}],"mask-image-linear-from-color":[{"mask-linear-from":K()}],"mask-image-linear-to-color":[{"mask-linear-to":K()}],"mask-image-t-from-pos":[{"mask-t-from":T()}],"mask-image-t-to-pos":[{"mask-t-to":T()}],"mask-image-t-from-color":[{"mask-t-from":K()}],"mask-image-t-to-color":[{"mask-t-to":K()}],"mask-image-r-from-pos":[{"mask-r-from":T()}],"mask-image-r-to-pos":[{"mask-r-to":T()}],"mask-image-r-from-color":[{"mask-r-from":K()}],"mask-image-r-to-color":[{"mask-r-to":K()}],"mask-image-b-from-pos":[{"mask-b-from":T()}],"mask-image-b-to-pos":[{"mask-b-to":T()}],"mask-image-b-from-color":[{"mask-b-from":K()}],"mask-image-b-to-color":[{"mask-b-to":K()}],"mask-image-l-from-pos":[{"mask-l-from":T()}],"mask-image-l-to-pos":[{"mask-l-to":T()}],"mask-image-l-from-color":[{"mask-l-from":K()}],"mask-image-l-to-color":[{"mask-l-to":K()}],"mask-image-x-from-pos":[{"mask-x-from":T()}],"mask-image-x-to-pos":[{"mask-x-to":T()}],"mask-image-x-from-color":[{"mask-x-from":K()}],"mask-image-x-to-color":[{"mask-x-to":K()}],"mask-image-y-from-pos":[{"mask-y-from":T()}],"mask-image-y-to-pos":[{"mask-y-to":T()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[aU,aM]}],"mask-image-radial-from-pos":[{"mask-radial-from":T()}],"mask-image-radial-to-pos":[{"mask-radial-to":T()}],"mask-image-radial-from-color":[{"mask-radial-from":K()}],"mask-image-radial-to-color":[{"mask-radial-to":K()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":u()}],"mask-image-conic-pos":[{"mask-conic":[aB]}],"mask-image-conic-from-pos":[{"mask-conic-from":T()}],"mask-image-conic-to-pos":[{"mask-conic-to":T()}],"mask-image-conic-from-color":[{"mask-conic-from":K()}],"mask-image-conic-to-color":[{"mask-conic-to":K()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",aU,aM]}],filter:[{filter:["","none",aU,aM]}],blur:[{blur:U()}],brightness:[{brightness:[aB,aU,aM]}],contrast:[{contrast:[aB,aU,aM]}],"drop-shadow":[{"drop-shadow":["","none",n,a$,aT]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",aB,aU,aM]}],"hue-rotate":[{"hue-rotate":[aB,aU,aM]}],invert:[{invert:["",aB,aU,aM]}],saturate:[{saturate:[aB,aU,aM]}],sepia:[{sepia:["",aB,aU,aM]}],"backdrop-filter":[{"backdrop-filter":["","none",aU,aM]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[aB,aU,aM]}],"backdrop-contrast":[{"backdrop-contrast":[aB,aU,aM]}],"backdrop-grayscale":[{"backdrop-grayscale":["",aB,aU,aM]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[aB,aU,aM]}],"backdrop-invert":[{"backdrop-invert":["",aB,aU,aM]}],"backdrop-opacity":[{"backdrop-opacity":[aB,aU,aM]}],"backdrop-saturate":[{"backdrop-saturate":[aB,aU,aM]}],"backdrop-sepia":[{"backdrop-sepia":["",aB,aU,aM]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":y()}],"border-spacing-x":[{"border-spacing-x":y()}],"border-spacing-y":[{"border-spacing-y":y()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",aU,aM]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[aB,"initial",aU,aM]}],ease:[{ease:["linear","initial",r,aU,aM]}],delay:[{delay:[aB,aU,aM]}],animate:[{animate:["none",s,aU,aM]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,aU,aM]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:V()}],"rotate-x":[{"rotate-x":V()}],"rotate-y":[{"rotate-y":V()}],"rotate-z":[{"rotate-z":V()}],scale:[{scale:W()}],"scale-x":[{"scale-x":W()}],"scale-y":[{"scale-y":W()}],"scale-z":[{"scale-z":W()}],"scale-3d":["scale-3d"],skew:[{skew:X()}],"skew-x":[{"skew-x":X()}],"skew-y":[{"skew-y":X()}],transform:[{transform:[aU,aM,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Y()}],"translate-x":[{"translate-x":Y()}],"translate-y":[{"translate-y":Y()}],"translate-z":[{"translate-z":Y()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",aU,aM]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":y()}],"scroll-mx":[{"scroll-mx":y()}],"scroll-my":[{"scroll-my":y()}],"scroll-ms":[{"scroll-ms":y()}],"scroll-me":[{"scroll-me":y()}],"scroll-mbs":[{"scroll-mbs":y()}],"scroll-mbe":[{"scroll-mbe":y()}],"scroll-mt":[{"scroll-mt":y()}],"scroll-mr":[{"scroll-mr":y()}],"scroll-mb":[{"scroll-mb":y()}],"scroll-ml":[{"scroll-ml":y()}],"scroll-p":[{"scroll-p":y()}],"scroll-px":[{"scroll-px":y()}],"scroll-py":[{"scroll-py":y()}],"scroll-ps":[{"scroll-ps":y()}],"scroll-pe":[{"scroll-pe":y()}],"scroll-pbs":[{"scroll-pbs":y()}],"scroll-pbe":[{"scroll-pbe":y()}],"scroll-pt":[{"scroll-pt":y()}],"scroll-pr":[{"scroll-pr":y()}],"scroll-pb":[{"scroll-pb":y()}],"scroll-pl":[{"scroll-pl":y()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",aU,aM]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[aB,aV,aN,aO]}],stroke:[{stroke:["none",...K()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function bb(...a){return ba($(a))}let bc=aa("inline-flex items-center rounded-full border px-2.5 py-0.5 text-[11px] font-medium tracking-[0.14em] uppercase transition-colors",{variants:{variant:{default:"border-cyan-400/30 bg-cyan-400/10 text-cyan-200",muted:"border-white/10 bg-white/5 text-slate-300",success:"border-emerald-400/25 bg-emerald-400/10 text-emerald-200",warning:"border-amber-400/25 bg-amber-400/10 text-amber-100",danger:"border-rose-400/30 bg-rose-400/10 text-rose-100"}},defaultVariants:{variant:"default"}});function bd({className:a,variant:b,...c}){return(0,D.jsx)("div",{className:bb(bc({variant:b}),a),...c})}function be(a,b){if("function"==typeof a)return a(b);null!=a&&(a.current=b)}function bf(...a){return b=>{let c=!1,d=a.map(a=>{let d=be(a,b);return c||"function"!=typeof d||(c=!0),d});if(c)return()=>{for(let b=0;b<d.length;b++){let c=d[b];"function"==typeof c?c():be(a[b],null)}}}}function bg(...a){return E.useCallback(bf(...a),a)}var bh=Symbol.for("react.lazy"),bi=F[" use ".trim().toString()];function bj(a){var b;return null!=a&&"object"==typeof a&&"$$typeof"in a&&a.$$typeof===bh&&"_payload"in a&&"object"==typeof(b=a._payload)&&null!==b&&"then"in b}function bk(a){var b;let c,d=(b=a,(c=E.forwardRef((a,b)=>{let{children:c,...d}=a;if(bj(c)&&"function"==typeof bi&&(c=bi(c._payload)),E.isValidElement(c)){var e;let a,f,g=(e=c,(f=(a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.ref:(f=(a=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.props.ref:e.props.ref||e.ref),h=function(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}(d,c.props);return c.type!==E.Fragment&&(h.ref=b?bf(b,g):g),E.cloneElement(c,h)}return E.Children.count(c)>1?E.Children.only(null):null})).displayName=`${b}.SlotClone`,c),e=E.forwardRef((a,b)=>{let{children:c,...e}=a;bj(c)&&"function"==typeof bi&&(c=bi(c._payload));let f=E.Children.toArray(c),g=f.find(bn);if(g){let a=g.props.children,c=f.map(b=>b!==g?b:E.Children.count(a)>1?E.Children.only(null):E.isValidElement(a)?a.props.children:null);return(0,D.jsx)(d,{...e,ref:b,children:E.isValidElement(a)?E.cloneElement(a,void 0,c):null})}return(0,D.jsx)(d,{...e,ref:b,children:c})});return e.displayName=`${a}.Slot`,e}var bl=bk("Slot"),bm=Symbol("radix.slottable");function bn(a){return E.isValidElement(a)&&"function"==typeof a.type&&"__radixId"in a.type&&a.type.__radixId===bm}let bo=aa("inline-flex items-center justify-center whitespace-nowrap rounded-2xl text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-cyan-400 text-slate-950 shadow-lg shadow-cyan-400/20 hover:bg-cyan-300",secondary:"border border-white/10 bg-white/5 text-slate-100 hover:bg-white/10 hover:text-white",ghost:"text-slate-200 hover:bg-white/[0.08] hover:text-white",destructive:"bg-rose-500 text-white shadow-lg shadow-rose-500/20 hover:bg-rose-400"},size:{default:"h-11 px-4 py-2",sm:"h-9 rounded-xl px-3",lg:"h-12 rounded-2xl px-5",icon:"h-11 w-11"}},defaultVariants:{variant:"default",size:"default"}}),bp=E.forwardRef(({className:a,variant:b,size:c,asChild:d=!1,...e},f)=>(0,D.jsx)(d?bl:"button",{className:bb(bo({variant:b,size:c,className:a})),ref:f,...e}));bp.displayName="Button";let bq=E.forwardRef(({className:a,type:b,...c},d)=>(0,D.jsx)("input",{type:b,className:bb("flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400/60 disabled:cursor-not-allowed disabled:opacity-50",a),ref:d,...c}));function br(a,b,{checkForDefaultPrevented:c=!0}={}){return function(d){if(a?.(d),!1===c||!d.defaultPrevented)return b?.(d)}}function bs(a,b=[]){let c=[],d=()=>{let b=c.map(a=>E.createContext(a));return function(c){let d=c?.[a]||b;return E.useMemo(()=>({[`__scope${a}`]:{...c,[a]:d}}),[c,d])}};return d.scopeName=a,[function(b,d){let e=E.createContext(d),f=c.length;c=[...c,d];let g=b=>{let{scope:c,children:d,...g}=b,h=c?.[a]?.[f]||e,i=E.useMemo(()=>g,Object.values(g));return(0,D.jsx)(h.Provider,{value:i,children:d})};return g.displayName=b+"Provider",[g,function(c,g){let h=g?.[a]?.[f]||e,i=E.useContext(h);if(i)return i;if(void 0!==d)return d;throw Error(`\`${c}\` must be used within \`${b}\``)}]},function(...a){let b=a[0];if(1===a.length)return b;let c=()=>{let c=a.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(a){let d=c.reduce((b,{useScope:c,scopeName:d})=>{let e=c(a)[`__scope${d}`];return{...b,...e}},{});return E.useMemo(()=>({[`__scope${b.scopeName}`]:d}),[d])}};return c.scopeName=b.scopeName,c}(d,...b)]}function bt(a){var b;let c,d=(b=a,(c=E.forwardRef((a,b)=>{let{children:c,...d}=a;if(E.isValidElement(c)){var e;let a,f,g=(e=c,(f=(a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.ref:(f=(a=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.props.ref:e.props.ref||e.ref),h=function(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}(d,c.props);return c.type!==E.Fragment&&(h.ref=b?bf(b,g):g),E.cloneElement(c,h)}return E.Children.count(c)>1?E.Children.only(null):null})).displayName=`${b}.SlotClone`,c),e=E.forwardRef((a,b)=>{let{children:c,...e}=a,f=E.Children.toArray(c),g=f.find(bv);if(g){let a=g.props.children,c=f.map(b=>b!==g?b:E.Children.count(a)>1?E.Children.only(null):E.isValidElement(a)?a.props.children:null);return(0,D.jsx)(d,{...e,ref:b,children:E.isValidElement(a)?E.cloneElement(a,void 0,c):null})}return(0,D.jsx)(d,{...e,ref:b,children:c})});return e.displayName=`${a}.Slot`,e}bq.displayName="Input","u">typeof window&&window.document&&window.document.createElement;var bu=Symbol("radix.slottable");function bv(a){return E.isValidElement(a)&&"function"==typeof a.type&&"__radixId"in a.type&&a.type.__radixId===bu}var bw=new WeakMap;function bx(a,b){var c,d;let e,f,g;if("at"in Array.prototype)return Array.prototype.at.call(a,b);let h=(c=a,d=b,e=c.length,(g=(f=by(d))>=0?f:e+f)<0||g>=e?-1:g);return -1===h?void 0:a[h]}function by(a){return a!=a||0===a?0:Math.trunc(a)}(class a extends Map{#a;constructor(a){super(a),this.#a=[...super.keys()],bw.set(this,!0)}set(a,b){return bw.get(this)&&(this.has(a)?this.#a[this.#a.indexOf(a)]=a:this.#a.push(a)),super.set(a,b),this}insert(a,b,c){let d,e=this.has(b),f=this.#a.length,g=by(a),h=g>=0?g:f+g,i=h<0||h>=f?-1:h;if(i===this.size||e&&i===this.size-1||-1===i)return this.set(b,c),this;let j=this.size+ +!e;g<0&&h++;let k=[...this.#a],l=!1;for(let a=h;a<j;a++)if(h===a){let f=k[a];k[a]===b&&(f=k[a+1]),e&&this.delete(b),d=this.get(f),this.set(b,c)}else{l||k[a-1]!==b||(l=!0);let c=k[l?a:a-1],e=d;d=this.get(c),this.delete(c),this.set(c,e)}return this}with(b,c,d){let e=new a(this);return e.insert(b,c,d),e}before(a){let b=this.#a.indexOf(a)-1;if(!(b<0))return this.entryAt(b)}setBefore(a,b,c){let d=this.#a.indexOf(a);return -1===d?this:this.insert(d,b,c)}after(a){let b=this.#a.indexOf(a);if(-1!==(b=-1===b||b===this.size-1?-1:b+1))return this.entryAt(b)}setAfter(a,b,c){let d=this.#a.indexOf(a);return -1===d?this:this.insert(d+1,b,c)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#a=[],super.clear()}delete(a){let b=super.delete(a);return b&&this.#a.splice(this.#a.indexOf(a),1),b}deleteAt(a){let b=this.keyAt(a);return void 0!==b&&this.delete(b)}at(a){let b=bx(this.#a,a);if(void 0!==b)return this.get(b)}entryAt(a){let b=bx(this.#a,a);if(void 0!==b)return[b,this.get(b)]}indexOf(a){return this.#a.indexOf(a)}keyAt(a){return bx(this.#a,a)}from(a,b){let c=this.indexOf(a);if(-1===c)return;let d=c+b;return d<0&&(d=0),d>=this.size&&(d=this.size-1),this.at(d)}keyFrom(a,b){let c=this.indexOf(a);if(-1===c)return;let d=c+b;return d<0&&(d=0),d>=this.size&&(d=this.size-1),this.keyAt(d)}find(a,b){let c=0;for(let d of this){if(Reflect.apply(a,b,[d,c,this]))return d;c++}}findIndex(a,b){let c=0;for(let d of this){if(Reflect.apply(a,b,[d,c,this]))return c;c++}return -1}filter(b,c){let d=[],e=0;for(let a of this)Reflect.apply(b,c,[a,e,this])&&d.push(a),e++;return new a(d)}map(b,c){let d=[],e=0;for(let a of this)d.push([a[0],Reflect.apply(b,c,[a,e,this])]),e++;return new a(d)}reduce(...a){let[b,c]=a,d=0,e=c??this.at(0);for(let c of this)e=0===d&&1===a.length?c:Reflect.apply(b,this,[e,c,d,this]),d++;return e}reduceRight(...a){let[b,c]=a,d=c??this.at(-1);for(let c=this.size-1;c>=0;c--){let e=this.at(c);d=c===this.size-1&&1===a.length?e:Reflect.apply(b,this,[d,e,c,this])}return d}toSorted(b){return new a([...this.entries()].sort(b))}toReversed(){let b=new a;for(let a=this.size-1;a>=0;a--){let c=this.keyAt(a),d=this.get(c);b.set(c,d)}return b}toSpliced(...b){let c=[...this.entries()];return c.splice(...b),new a(c)}slice(b,c){let d=new a,e=this.size-1;if(void 0===b)return d;b<0&&(b+=this.size),void 0!==c&&c>0&&(e=c-1);for(let a=b;a<=e;a++){let b=this.keyAt(a),c=this.get(b);d.set(b,c)}return d}every(a,b){let c=0;for(let d of this){if(!Reflect.apply(a,b,[d,c,this]))return!1;c++}return!0}some(a,b){let c=0;for(let d of this){if(Reflect.apply(a,b,[d,c,this]))return!0;c++}return!1}});var bz=globalThis?.document?E.useLayoutEffect:()=>{},bA=F[" useId ".trim().toString()]||(()=>void 0),bB=0;function bC(a){let[b,c]=E.useState(bA());return bz(()=>{a||c(a=>a??String(bB++))},[a]),a||(b?`radix-${b}`:"")}var bD=c(1309),bE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,b)=>{let c=bt(`Primitive.${b}`),d=E.forwardRef((a,d)=>{let{asChild:e,...f}=a;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,D.jsx)(e?c:b,{...f,ref:d})});return d.displayName=`Primitive.${b}`,{...a,[b]:d}},{});function bF(a){let b=E.useRef(a);return E.useEffect(()=>{b.current=a}),E.useMemo(()=>(...a)=>b.current?.(...a),[])}var bG=F[" useInsertionEffect ".trim().toString()]||bz;function bH({prop:a,defaultProp:b,onChange:c=()=>{},caller:d}){let[e,f,g]=function({defaultProp:a,onChange:b}){let[c,d]=E.useState(a),e=E.useRef(c),f=E.useRef(b);return bG(()=>{f.current=b},[b]),E.useEffect(()=>{e.current!==c&&(f.current?.(c),e.current=c)},[c,e]),[c,d,f]}({defaultProp:b,onChange:c}),h=void 0!==a,i=h?a:e;{let b=E.useRef(void 0!==a);E.useEffect(()=>{let a=b.current;if(a!==h){let b=h?"controlled":"uncontrolled";console.warn(`${d} is changing from ${a?"controlled":"uncontrolled"} to ${b}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}b.current=h},[h,d])}return[i,E.useCallback(b=>{if(h){let c="function"==typeof b?b(a):b;c!==a&&g.current?.(c)}else f(b)},[h,a,f,g])]}Symbol("RADIX:SYNC_STATE");var bI=E.createContext(void 0);function bJ(a){let b=E.useContext(bI);return a||b||"ltr"}var bK="rovingFocusGroup.onEntryFocus",bL={bubbles:!1,cancelable:!0},bM="RovingFocusGroup",[bN,bO,bP]=function(a){let b=a+"CollectionProvider",[c,d]=bs(b),[e,f]=c(b,{collectionRef:{current:null},itemMap:new Map}),g=a=>{let{scope:b,children:c}=a,d=E.useRef(null),f=E.useRef(new Map).current;return(0,D.jsx)(e,{scope:b,itemMap:f,collectionRef:d,children:c})};g.displayName=b;let h=a+"CollectionSlot",i=bt(h),j=E.forwardRef((a,b)=>{let{scope:c,children:d}=a,e=bg(b,f(h,c).collectionRef);return(0,D.jsx)(i,{ref:e,children:d})});j.displayName=h;let k=a+"CollectionItemSlot",l="data-radix-collection-item",m=bt(k),n=E.forwardRef((a,b)=>{let{scope:c,children:d,...e}=a,g=E.useRef(null),h=bg(b,g),i=f(k,c);return E.useEffect(()=>(i.itemMap.set(g,{ref:g,...e}),()=>void i.itemMap.delete(g))),(0,D.jsx)(m,{...{[l]:""},ref:h,children:d})});return n.displayName=k,[{Provider:g,Slot:j,ItemSlot:n},function(b){let c=f(a+"CollectionConsumer",b);return E.useCallback(()=>{let a=c.collectionRef.current;if(!a)return[];let b=Array.from(a.querySelectorAll(`[${l}]`));return Array.from(c.itemMap.values()).sort((a,c)=>b.indexOf(a.ref.current)-b.indexOf(c.ref.current))},[c.collectionRef,c.itemMap])},d]}(bM),[bQ,bR]=bs(bM,[bP]),[bS,bT]=bQ(bM),bU=E.forwardRef((a,b)=>(0,D.jsx)(bN.Provider,{scope:a.__scopeRovingFocusGroup,children:(0,D.jsx)(bN.Slot,{scope:a.__scopeRovingFocusGroup,children:(0,D.jsx)(bV,{...a,ref:b})})}));bU.displayName=bM;var bV=E.forwardRef((a,b)=>{let{__scopeRovingFocusGroup:c,orientation:d,loop:e=!1,dir:f,currentTabStopId:g,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:i,onEntryFocus:j,preventScrollOnEntryFocus:k=!1,...l}=a,m=E.useRef(null),n=bg(b,m),o=bJ(f),[p,q]=bH({prop:g,defaultProp:h??null,onChange:i,caller:bM}),[r,s]=E.useState(!1),t=bF(j),u=bO(c),v=E.useRef(!1),[w,x]=E.useState(0);return E.useEffect(()=>{let a=m.current;if(a)return a.addEventListener(bK,t),()=>a.removeEventListener(bK,t)},[t]),(0,D.jsx)(bS,{scope:c,orientation:d,dir:o,loop:e,currentTabStopId:p,onItemFocus:E.useCallback(a=>q(a),[q]),onItemShiftTab:E.useCallback(()=>s(!0),[]),onFocusableItemAdd:E.useCallback(()=>x(a=>a+1),[]),onFocusableItemRemove:E.useCallback(()=>x(a=>a-1),[]),children:(0,D.jsx)(bE.div,{tabIndex:r||0===w?-1:0,"data-orientation":d,...l,ref:n,style:{outline:"none",...a.style},onMouseDown:br(a.onMouseDown,()=>{v.current=!0}),onFocus:br(a.onFocus,a=>{let b=!v.current;if(a.target===a.currentTarget&&b&&!r){let b=new CustomEvent(bK,bL);if(a.currentTarget.dispatchEvent(b),!b.defaultPrevented){let a=u().filter(a=>a.focusable);bZ([a.find(a=>a.active),a.find(a=>a.id===p),...a].filter(Boolean).map(a=>a.ref.current),k)}}v.current=!1}),onBlur:br(a.onBlur,()=>s(!1))})})}),bW="RovingFocusGroupItem",bX=E.forwardRef((a,b)=>{let{__scopeRovingFocusGroup:c,focusable:d=!0,active:e=!1,tabStopId:f,children:g,...h}=a,i=bC(),j=f||i,k=bT(bW,c),l=k.currentTabStopId===j,m=bO(c),{onFocusableItemAdd:n,onFocusableItemRemove:o,currentTabStopId:p}=k;return E.useEffect(()=>{if(d)return n(),()=>o()},[d,n,o]),(0,D.jsx)(bN.ItemSlot,{scope:c,id:j,focusable:d,active:e,children:(0,D.jsx)(bE.span,{tabIndex:l?0:-1,"data-orientation":k.orientation,...h,ref:b,onMouseDown:br(a.onMouseDown,a=>{d?k.onItemFocus(j):a.preventDefault()}),onFocus:br(a.onFocus,()=>k.onItemFocus(j)),onKeyDown:br(a.onKeyDown,a=>{if("Tab"===a.key&&a.shiftKey)return void k.onItemShiftTab();if(a.target!==a.currentTarget)return;let b=function(a,b,c){var d;let e=(d=a.key,"rtl"!==c?d:"ArrowLeft"===d?"ArrowRight":"ArrowRight"===d?"ArrowLeft":d);if(!("vertical"===b&&["ArrowLeft","ArrowRight"].includes(e))&&!("horizontal"===b&&["ArrowUp","ArrowDown"].includes(e)))return bY[e]}(a,k.orientation,k.dir);if(void 0!==b){if(a.metaKey||a.ctrlKey||a.altKey||a.shiftKey)return;a.preventDefault();let e=m().filter(a=>a.focusable).map(a=>a.ref.current);if("last"===b)e.reverse();else if("prev"===b||"next"===b){var c,d;"prev"===b&&e.reverse();let f=e.indexOf(a.currentTarget);e=k.loop?(c=e,d=f+1,c.map((a,b)=>c[(d+b)%c.length])):e.slice(f+1)}setTimeout(()=>bZ(e))}}),children:"function"==typeof g?g({isCurrentTabStop:l,hasTabStop:null!=p}):g})})});bX.displayName=bW;var bY={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function bZ(a,b=!1){let c=document.activeElement;for(let d of a)if(d===c||(d.focus({preventScroll:b}),document.activeElement!==c))return}var b$=a=>{var b;let c,d,{present:e,children:f}=a,g=function(a){var b,c;let[d,e]=E.useState(),f=E.useRef(null),g=E.useRef(a),h=E.useRef("none"),[i,j]=(b=a?"mounted":"unmounted",c={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},E.useReducer((a,b)=>c[a][b]??a,b));return E.useEffect(()=>{let a=b_(f.current);h.current="mounted"===i?a:"none"},[i]),bz(()=>{let b=f.current,c=g.current;if(c!==a){let d=h.current,e=b_(b);a?j("MOUNT"):"none"===e||b?.display==="none"?j("UNMOUNT"):c&&d!==e?j("ANIMATION_OUT"):j("UNMOUNT"),g.current=a}},[a,j]),bz(()=>{if(d){let a,b=d.ownerDocument.defaultView??window,c=c=>{let e=b_(f.current).includes(CSS.escape(c.animationName));if(c.target===d&&e&&(j("ANIMATION_END"),!g.current)){let c=d.style.animationFillMode;d.style.animationFillMode="forwards",a=b.setTimeout(()=>{"forwards"===d.style.animationFillMode&&(d.style.animationFillMode=c)})}},e=a=>{a.target===d&&(h.current=b_(f.current))};return d.addEventListener("animationstart",e),d.addEventListener("animationcancel",c),d.addEventListener("animationend",c),()=>{b.clearTimeout(a),d.removeEventListener("animationstart",e),d.removeEventListener("animationcancel",c),d.removeEventListener("animationend",c)}}j("ANIMATION_END")},[d,j]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:E.useCallback(a=>{f.current=a?getComputedStyle(a):null,e(a)},[])}}(e),h="function"==typeof f?f({present:g.isPresent}):E.Children.only(f),i=bg(g.ref,(b=h,(d=(c=Object.getOwnPropertyDescriptor(b.props,"ref")?.get)&&"isReactWarning"in c&&c.isReactWarning)?b.ref:(d=(c=Object.getOwnPropertyDescriptor(b,"ref")?.get)&&"isReactWarning"in c&&c.isReactWarning)?b.props.ref:b.props.ref||b.ref));return"function"==typeof f||g.isPresent?E.cloneElement(h,{ref:i}):null};function b_(a){return a?.animationName||"none"}b$.displayName="Presence";var b0="Tabs",[b1,b2]=bs(b0,[bR]),b3=bR(),[b4,b5]=b1(b0),b6=E.forwardRef((a,b)=>{let{__scopeTabs:c,value:d,onValueChange:e,defaultValue:f,orientation:g="horizontal",dir:h,activationMode:i="automatic",...j}=a,k=bJ(h),[l,m]=bH({prop:d,onChange:e,defaultProp:f??"",caller:b0});return(0,D.jsx)(b4,{scope:c,baseId:bC(),value:l,onValueChange:m,orientation:g,dir:k,activationMode:i,children:(0,D.jsx)(bE.div,{dir:k,"data-orientation":g,...j,ref:b})})});b6.displayName=b0;var b7="TabsList",b8=E.forwardRef((a,b)=>{let{__scopeTabs:c,loop:d=!0,...e}=a,f=b5(b7,c),g=b3(c);return(0,D.jsx)(bU,{asChild:!0,...g,orientation:f.orientation,dir:f.dir,loop:d,children:(0,D.jsx)(bE.div,{role:"tablist","aria-orientation":f.orientation,...e,ref:b})})});b8.displayName=b7;var b9="TabsTrigger",ca=E.forwardRef((a,b)=>{let{__scopeTabs:c,value:d,disabled:e=!1,...f}=a,g=b5(b9,c),h=b3(c),i=cd(g.baseId,d),j=ce(g.baseId,d),k=d===g.value;return(0,D.jsx)(bX,{asChild:!0,...h,focusable:!e,active:k,children:(0,D.jsx)(bE.button,{type:"button",role:"tab","aria-selected":k,"aria-controls":j,"data-state":k?"active":"inactive","data-disabled":e?"":void 0,disabled:e,id:i,...f,ref:b,onMouseDown:br(a.onMouseDown,a=>{e||0!==a.button||!1!==a.ctrlKey?a.preventDefault():g.onValueChange(d)}),onKeyDown:br(a.onKeyDown,a=>{[" ","Enter"].includes(a.key)&&g.onValueChange(d)}),onFocus:br(a.onFocus,()=>{let a="manual"!==g.activationMode;k||e||!a||g.onValueChange(d)})})})});ca.displayName=b9;var cb="TabsContent",cc=E.forwardRef((a,b)=>{let{__scopeTabs:c,value:d,forceMount:e,children:f,...g}=a,h=b5(cb,c),i=cd(h.baseId,d),j=ce(h.baseId,d),k=d===h.value,l=E.useRef(k);return E.useEffect(()=>{let a=requestAnimationFrame(()=>l.current=!1);return()=>cancelAnimationFrame(a)},[]),(0,D.jsx)(b$,{present:e||k,children:({present:c})=>(0,D.jsx)(bE.div,{"data-state":k?"active":"inactive","data-orientation":h.orientation,role:"tabpanel","aria-labelledby":i,hidden:!c,id:j,tabIndex:0,...g,ref:b,style:{...a.style,animationDuration:l.current?"0s":void 0},children:c&&f})})});function cd(a,b){return`${a}-trigger-${b}`}function ce(a,b){return`${a}-content-${b}`}cc.displayName=cb;let cf=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)(b8,{ref:c,className:bb("inline-flex h-11 items-center rounded-2xl border border-white/10 bg-white/5 p-1 text-slate-400",a),...b}));cf.displayName=b8.displayName;let cg=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)(ca,{ref:c,className:bb("inline-flex items-center justify-center whitespace-nowrap rounded-xl px-3 py-2 text-sm transition-all data-[state=active]:bg-white/10 data-[state=active]:text-white",a),...b}));cg.displayName=ca.displayName;let ch=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)(cc,{ref:c,className:bb("mt-4 outline-none focus-visible:ring-0",a),...b}));function ci(a,b){let c=b.trim().toLowerCase();return c?a.filter(a=>`${a.name} ${a.id} ${a.tags.join(" ")}`.toLowerCase().includes(c)):a}function cj({provider:a,models:b,selectedModelIds:c,search:d,onSearchChange:e,onToggleModel:f,onAddSelected:g,isAdding:h}){let i=b.filter(a=>a.recommended),j=b.length>8||"openrouter"===a,k=c.filter(a=>!b.find(b=>b.id===a)?.alreadyAdded).length,l=ci(i,d),m=ci(b,d);return(0,D.jsxs)("div",{className:"rounded-[24px] border border-white/10 bg-[linear-gradient(180deg,rgba(10,15,26,0.94),rgba(7,11,20,0.96))] p-4",children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"font-display text-[0.96rem] text-white",children:"Select models to add"}),(0,D.jsxs)("p",{className:"mt-1 text-[12px] leading-5 text-slate-400",children:["Found ",b.length," model",1===b.length?"":"s"," for this provider."]})]}),(0,D.jsxs)(bd,{variant:"muted",children:[b.filter(a=>a.alreadyAdded).length," already added"]})]}),j?(0,D.jsxs)("div",{className:"relative mt-4",children:[(0,D.jsx)(X,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"}),(0,D.jsx)(bq,{value:d,onChange:a=>e(a.target.value),placeholder:"openrouter"===a?"Search OpenRouter models":"Search models",className:"pl-11"})]}):null,"openrouter"===a?(0,D.jsxs)(b6,{defaultValue:"recommended",className:"mt-4",children:[(0,D.jsxs)(cf,{children:[(0,D.jsx)(cg,{value:"recommended",children:"Recommended"}),(0,D.jsx)(cg,{value:"all",children:"All models"})]}),(0,D.jsx)(ch,{value:"recommended",children:(0,D.jsx)(ck,{models:l,selectedModelIds:c,onToggleModel:f,emptyMessage:"No recommended matches. Switch to All models to browse the full catalog."})}),(0,D.jsx)(ch,{value:"all",children:(0,D.jsx)(ck,{models:m,selectedModelIds:c,onToggleModel:f,emptyMessage:"No models matched this search."})})]}):(0,D.jsx)("div",{className:"mt-4",children:(0,D.jsx)(ck,{models:m,selectedModelIds:c,onToggleModel:f,emptyMessage:"No models matched this search."})}),(0,D.jsxs)("div",{className:"mt-4 flex items-center justify-between gap-3 border-t border-white/10 pt-4",children:[(0,D.jsx)("p",{className:"text-[11px] text-slate-400",children:k>0?`${k} model${1===k?"":"s"} selected`:"Choose at least one model to add"}),(0,D.jsx)(bp,{type:"button",onClick:g,disabled:0===k||h,className:"h-9 rounded-full px-4",children:h?"Adding...":"Add selected models"})]})]})}function ck({models:a,selectedModelIds:b,onToggleModel:c,emptyMessage:d}){return 0===a.length?(0,D.jsx)("div",{className:"rounded-[22px] border border-dashed border-white/10 bg-white/[0.03] px-4 py-8 text-center text-[13px] text-slate-400",children:d}):(0,D.jsx)("div",{className:"max-h-[min(36vh,320px)] space-y-2 overflow-y-auto pr-1",children:a.map(a=>{let d=b.includes(a.id);return(0,D.jsxs)("button",{type:"button",disabled:a.alreadyAdded,onClick:()=>c(a.id),className:bb("flex w-full items-start justify-between gap-3 rounded-[18px] border px-3.5 py-3 text-left transition-all",a.alreadyAdded?"cursor-not-allowed border-white/8 bg-white/[0.02] opacity-70":d?"border-cyan-300/35 bg-cyan-300/[0.08]":"border-white/8 bg-white/[0.03] hover:border-white/16 hover:bg-white/[0.05]"),children:[(0,D.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,D.jsx)("div",{className:bb("mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-md border",a.alreadyAdded?"border-white/10 bg-white/[0.03] text-slate-500":d?"border-cyan-300/50 bg-cyan-300/15 text-cyan-100":"border-white/12 bg-white/[0.03] text-transparent"),children:a.alreadyAdded?(0,D.jsx)(Y,{className:"h-3 w-3"}):(0,D.jsx)(Z,{className:"h-3 w-3"})}),(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate text-[13px] font-medium text-white",children:a.name}),(0,D.jsx)("p",{className:"mt-1 truncate text-[11px] uppercase tracking-[0.18em] text-slate-500",children:a.id}),(0,D.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 text-[11px] text-slate-400",children:[(0,D.jsx)("span",{children:a.input}),a.contextWindow?(0,D.jsxs)("span",{children:[Intl.NumberFormat().format(a.contextWindow)," ctx"]}):null,a.isFree?(0,D.jsx)("span",{children:"free"}):null]})]})]}),(0,D.jsx)("div",{className:"shrink-0",children:a.alreadyAdded?(0,D.jsx)(bd,{variant:"muted",children:"Already added"}):a.recommended?(0,D.jsx)(bd,{variant:"default",children:"Recommended"}):a.local?(0,D.jsx)(bd,{variant:"success",children:"Local"}):(0,D.jsx)(bd,{variant:"muted",children:"Remote"})})]},a.id)})})}ch.displayName=cc.displayName;let cl=K("sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]),cm=K("waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]),cn=K("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),co=K("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),cp={"openai-codex":cl,openrouter:cm,ollama:cn,anthropic:co,openai:K("cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]),xai:K("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]])};function cq({descriptor:a,active:b,compact:c=!1,connected:d=!1,detail:e,onClick:f}){let g=cp[a.id];return(0,D.jsxs)("button",{type:"button",onClick:f,className:bb("group w-full rounded-[24px] border text-left transition-all",c?"p-3.5":"p-4",b?"border-cyan-300/40 bg-[linear-gradient(180deg,rgba(23,32,52,0.98),rgba(11,18,31,0.98))] shadow-[0_18px_45px_rgba(10,16,28,0.26)]":"border-white/10 bg-[linear-gradient(180deg,rgba(15,23,42,0.92),rgba(10,15,28,0.92))] hover:border-white/18 hover:bg-[linear-gradient(180deg,rgba(20,29,49,0.96),rgba(12,18,31,0.96))]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsx)("div",{className:bb("flex items-center justify-center rounded-[18px] border",c?"h-9 w-9":"h-10 w-10",b?"border-cyan-300/25 bg-cyan-300/10 text-cyan-100":"border-white/10 bg-white/[0.04] text-slate-200"),children:(0,D.jsx)(g,{className:"h-4 w-4"})}),(0,D.jsx)(bd,{variant:d?"success":b?"default":"muted",children:d?"Connected":b?"Selected":"Provider"})]}),(0,D.jsxs)("div",{className:c?"mt-3":"mt-4",children:[(0,D.jsx)("p",{className:bb("font-display text-white",c?"text-[0.92rem]":"text-[0.98rem]"),children:a.label}),(0,D.jsx)("p",{className:bb("mt-1.5 text-slate-300",c?"text-[11px] leading-5":"text-[12px] leading-5"),children:a.description}),(0,D.jsx)("p",{className:"mt-3 text-[10px] uppercase tracking-[0.18em] text-slate-500",children:e||a.helperText})]})]})}var cr="dismissableLayer.update",cs=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ct=E.forwardRef((a,b)=>{let{disableOutsidePointerEvents:c=!1,onEscapeKeyDown:d,onPointerDownOutside:e,onFocusOutside:f,onInteractOutside:g,onDismiss:h,...i}=a,j=E.useContext(cs),[k,l]=E.useState(null),m=k?.ownerDocument??globalThis?.document,[,n]=E.useState({}),o=bg(b,a=>l(a)),p=Array.from(j.layers),[q]=[...j.layersWithOutsidePointerEventsDisabled].slice(-1),r=p.indexOf(q),s=k?p.indexOf(k):-1,t=j.layersWithOutsidePointerEventsDisabled.size>0,u=s>=r,v=function(a,b=globalThis?.document){let c=bF(a),d=E.useRef(!1),e=E.useRef(()=>{});return E.useEffect(()=>{let a=a=>{if(a.target&&!d.current){let d=function(){cv("dismissableLayer.pointerDownOutside",c,f,{discrete:!0})},f={originalEvent:a};"touch"===a.pointerType?(b.removeEventListener("click",e.current),e.current=d,b.addEventListener("click",e.current,{once:!0})):d()}else b.removeEventListener("click",e.current);d.current=!1},f=window.setTimeout(()=>{b.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(f),b.removeEventListener("pointerdown",a),b.removeEventListener("click",e.current)}},[b,c]),{onPointerDownCapture:()=>d.current=!0}}(a=>{let b=a.target,c=[...j.branches].some(a=>a.contains(b));u&&!c&&(e?.(a),g?.(a),a.defaultPrevented||h?.())},m),w=function(a,b=globalThis?.document){let c=bF(a),d=E.useRef(!1);return E.useEffect(()=>{let a=a=>{a.target&&!d.current&&cv("dismissableLayer.focusOutside",c,{originalEvent:a},{discrete:!1})};return b.addEventListener("focusin",a),()=>b.removeEventListener("focusin",a)},[b,c]),{onFocusCapture:()=>d.current=!0,onBlurCapture:()=>d.current=!1}}(a=>{let b=a.target;![...j.branches].some(a=>a.contains(b))&&(f?.(a),g?.(a),a.defaultPrevented||h?.())},m);return!function(a,b=globalThis?.document){let c=bF(a);E.useEffect(()=>{let a=a=>{"Escape"===a.key&&c(a)};return b.addEventListener("keydown",a,{capture:!0}),()=>b.removeEventListener("keydown",a,{capture:!0})},[c,b])}(a=>{s===j.layers.size-1&&(d?.(a),!a.defaultPrevented&&h&&(a.preventDefault(),h()))},m),E.useEffect(()=>{if(k)return c&&(0===j.layersWithOutsidePointerEventsDisabled.size&&(e4=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),j.layersWithOutsidePointerEventsDisabled.add(k)),j.layers.add(k),cu(),()=>{c&&1===j.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=e4)}},[k,m,c,j]),E.useEffect(()=>()=>{k&&(j.layers.delete(k),j.layersWithOutsidePointerEventsDisabled.delete(k),cu())},[k,j]),E.useEffect(()=>{let a=()=>n({});return document.addEventListener(cr,a),()=>document.removeEventListener(cr,a)},[]),(0,D.jsx)(bE.div,{...i,ref:o,style:{pointerEvents:t?u?"auto":"none":void 0,...a.style},onFocusCapture:br(a.onFocusCapture,w.onFocusCapture),onBlurCapture:br(a.onBlurCapture,w.onBlurCapture),onPointerDownCapture:br(a.onPointerDownCapture,v.onPointerDownCapture)})});function cu(){let a=new CustomEvent(cr);document.dispatchEvent(a)}function cv(a,b,c,{discrete:d}){let e=c.originalEvent.target,f=new CustomEvent(a,{bubbles:!1,cancelable:!0,detail:c});if(b&&e.addEventListener(a,b,{once:!0}),d)e&&bD.flushSync(()=>e.dispatchEvent(f));else e.dispatchEvent(f)}ct.displayName="DismissableLayer",E.forwardRef((a,b)=>{let c=E.useContext(cs),d=E.useRef(null),e=bg(b,d);return E.useEffect(()=>{let a=d.current;if(a)return c.branches.add(a),()=>{c.branches.delete(a)}},[c.branches]),(0,D.jsx)(bE.div,{...a,ref:e})}).displayName="DismissableLayerBranch";var cw="focusScope.autoFocusOnMount",cx="focusScope.autoFocusOnUnmount",cy={bubbles:!1,cancelable:!0},cz=E.forwardRef((a,b)=>{let{loop:c=!1,trapped:d=!1,onMountAutoFocus:e,onUnmountAutoFocus:f,...g}=a,[h,i]=E.useState(null),j=bF(e),k=bF(f),l=E.useRef(null),m=bg(b,a=>i(a)),n=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(d){let a=function(a){if(n.paused||!h)return;let b=a.target;h.contains(b)?l.current=b:cC(l.current,{select:!0})},b=function(a){if(n.paused||!h)return;let b=a.relatedTarget;null!==b&&(h.contains(b)||cC(l.current,{select:!0}))};document.addEventListener("focusin",a),document.addEventListener("focusout",b);let c=new MutationObserver(function(a){if(document.activeElement===document.body)for(let b of a)b.removedNodes.length>0&&cC(h)});return h&&c.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",a),document.removeEventListener("focusout",b),c.disconnect()}}},[d,h,n.paused]),E.useEffect(()=>{if(h){cD.add(n);let a=document.activeElement;if(!h.contains(a)){let b=new CustomEvent(cw,cy);h.addEventListener(cw,j),h.dispatchEvent(b),b.defaultPrevented||(function(a,{select:b=!1}={}){let c=document.activeElement;for(let d of a)if(cC(d,{select:b}),document.activeElement!==c)return}(cA(h).filter(a=>"A"!==a.tagName),{select:!0}),document.activeElement===a&&cC(h))}return()=>{h.removeEventListener(cw,j),setTimeout(()=>{let b=new CustomEvent(cx,cy);h.addEventListener(cx,k),h.dispatchEvent(b),b.defaultPrevented||cC(a??document.body,{select:!0}),h.removeEventListener(cx,k),cD.remove(n)},0)}}},[h,j,k,n]);let o=E.useCallback(a=>{if(!c&&!d||n.paused)return;let b="Tab"===a.key&&!a.altKey&&!a.ctrlKey&&!a.metaKey,e=document.activeElement;if(b&&e){var f;let b,d=a.currentTarget,[g,h]=[cB(b=cA(f=d),f),cB(b.reverse(),f)];g&&h?a.shiftKey||e!==h?a.shiftKey&&e===g&&(a.preventDefault(),c&&cC(h,{select:!0})):(a.preventDefault(),c&&cC(g,{select:!0})):e===d&&a.preventDefault()}},[c,d,n.paused]);return(0,D.jsx)(bE.div,{tabIndex:-1,...g,ref:m,onKeyDown:o})});function cA(a){let b=[],c=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{let b="INPUT"===a.tagName&&"hidden"===a.type;return a.disabled||a.hidden||b?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;c.nextNode();)b.push(c.currentNode);return b}function cB(a,b){for(let c of a)if(!function(a,{upTo:b}){if("hidden"===getComputedStyle(a).visibility)return!0;for(;a&&(void 0===b||a!==b);){if("none"===getComputedStyle(a).display)return!0;a=a.parentElement}return!1}(c,{upTo:b}))return c}function cC(a,{select:b=!1}={}){if(a&&a.focus){var c;let d=document.activeElement;a.focus({preventScroll:!0}),a!==d&&(c=a)instanceof HTMLInputElement&&"select"in c&&b&&a.select()}}cz.displayName="FocusScope";var cD=(i=[],{add(a){let b=i[0];a!==b&&b?.pause(),(i=cE(i,a)).unshift(a)},remove(a){i=cE(i,a),i[0]?.resume()}});function cE(a,b){let c=[...a],d=c.indexOf(b);return -1!==d&&c.splice(d,1),c}var cF=E.forwardRef((a,b)=>{let{container:c,...d}=a,[e,f]=E.useState(!1);bz(()=>f(!0),[]);let g=c||e&&globalThis?.document?.body;return g?bD.createPortal((0,D.jsx)(bE.div,{...d,ref:b}),g):null});cF.displayName="Portal";var cG=0;function cH(){let a=document.createElement("span");return a.setAttribute("data-radix-focus-guard",""),a.tabIndex=0,a.style.outline="none",a.style.opacity="0",a.style.position="fixed",a.style.pointerEvents="none",a}var cI=function(){return(cI=Object.assign||function(a){for(var b,c=1,d=arguments.length;c<d;c++)for(var e in b=arguments[c])Object.prototype.hasOwnProperty.call(b,e)&&(a[e]=b[e]);return a}).apply(this,arguments)};function cJ(a,b){var c={};for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&0>b.indexOf(d)&&(c[d]=a[d]);if(null!=a&&"function"==typeof Object.getOwnPropertySymbols)for(var e=0,d=Object.getOwnPropertySymbols(a);e<d.length;e++)0>b.indexOf(d[e])&&Object.prototype.propertyIsEnumerable.call(a,d[e])&&(c[d[e]]=a[d[e]]);return c}var cK=("function"==typeof SuppressedError&&SuppressedError,"right-scroll-bar-position"),cL="width-before-scroll-bar";function cM(a,b){return"function"==typeof a?a(b):a&&(a.current=b),a}var cN="u">typeof window?E.useLayoutEffect:E.useEffect,cO=new WeakMap,cP=(void 0===eZ&&(eZ={}),(void 0===e$&&(e$=function(a){return a}),e_=[],e0=!1,e1={read:function(){if(e0)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return e_.length?e_[e_.length-1]:null},useMedium:function(a){var b=e$(a,e0);return e_.push(b),function(){e_=e_.filter(function(a){return a!==b})}},assignSyncMedium:function(a){for(e0=!0;e_.length;){var b=e_;e_=[],b.forEach(a)}e_={push:function(b){return a(b)},filter:function(){return e_}}},assignMedium:function(a){e0=!0;var b=[];if(e_.length){var c=e_;e_=[],c.forEach(a),b=e_}var d=function(){var c=b;b=[],c.forEach(a)},e=function(){return Promise.resolve().then(d)};e(),e_={push:function(a){b.push(a),e()},filter:function(a){return b=b.filter(a),e_}}}}).options=cI({async:!0,ssr:!1},eZ),e1),cQ=function(){},cR=E.forwardRef(function(a,b){var c,d,e,f,g=E.useRef(null),h=E.useState({onScrollCapture:cQ,onWheelCapture:cQ,onTouchMoveCapture:cQ}),i=h[0],j=h[1],k=a.forwardProps,l=a.children,m=a.className,n=a.removeScrollBar,o=a.enabled,p=a.shards,q=a.sideCar,r=a.noRelative,s=a.noIsolation,t=a.inert,u=a.allowPinchZoom,v=a.as,w=a.gapMode,x=cJ(a,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),y=(c=[g,b],d=function(a){return c.forEach(function(b){return cM(b,a)})},(e=(0,E.useState)(function(){return{value:null,callback:d,facade:{get current(){return e.value},set current(value){var a=e.value;a!==value&&(e.value=value,e.callback(value,a))}}}})[0]).callback=d,f=e.facade,cN(function(){var a=cO.get(f);if(a){var b=new Set(a),d=new Set(c),e=f.current;b.forEach(function(a){d.has(a)||cM(a,null)}),d.forEach(function(a){b.has(a)||cM(a,e)})}cO.set(f,c)},[c]),f),z=cI(cI({},x),i);return E.createElement(E.Fragment,null,o&&E.createElement(q,{sideCar:cP,removeScrollBar:n,shards:p,noRelative:r,noIsolation:s,inert:t,setCallbacks:j,allowPinchZoom:!!u,lockRef:g,gapMode:w}),k?E.cloneElement(E.Children.only(l),cI(cI({},z),{ref:y})):E.createElement(void 0===v?"div":v,cI({},z,{className:m,ref:y}),l))});cR.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},cR.classNames={fullWidth:cL,zeroRight:cK};var cS=function(a){var b=a.sideCar,c=cJ(a,["sideCar"]);if(!b)throw Error("Sidecar: please provide `sideCar` property to import the right car");var d=b.read();if(!d)throw Error("Sidecar medium not found");return E.createElement(d,cI({},c))};cS.isSideCarExport=!0;var cT=function(){var a=0,b=null;return{add:function(d){if(0==a&&(b=function(){if(!document)return null;var a=document.createElement("style");a.type="text/css";var b=e5||c.nc;return b&&a.setAttribute("nonce",b),a}())){var e,f;(e=b).styleSheet?e.styleSheet.cssText=d:e.appendChild(document.createTextNode(d)),f=b,(document.head||document.getElementsByTagName("head")[0]).appendChild(f)}a++},remove:function(){--a||!b||(b.parentNode&&b.parentNode.removeChild(b),b=null)}}},cU=function(){var a=cT();return function(b,c){E.useEffect(function(){return a.add(b),function(){a.remove()}},[b&&c])}},cV=function(){var a=cU();return function(b){return a(b.styles,b.dynamic),null}},cW={left:0,top:0,right:0,gap:0},cX=function(a){return parseInt(a||"",10)||0},cY=function(a){var b=window.getComputedStyle(document.body),c=b["padding"===a?"paddingLeft":"marginLeft"],d=b["padding"===a?"paddingTop":"marginTop"],e=b["padding"===a?"paddingRight":"marginRight"];return[cX(c),cX(d),cX(e)]},cZ=function(a){if(void 0===a&&(a="margin"),"u"<typeof window)return cW;var b=cY(a),c=document.documentElement.clientWidth,d=window.innerWidth;return{left:b[0],top:b[1],right:b[2],gap:Math.max(0,d-c+b[2]-b[0])}},c$=cV(),c_="data-scroll-locked",c0=function(a,b,c,d){var e=a.left,f=a.top,g=a.right,h=a.gap;return void 0===c&&(c="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(d,";\n padding-right: ").concat(h,"px ").concat(d,";\n }\n body[").concat(c_,"] {\n overflow: hidden ").concat(d,";\n overscroll-behavior: contain;\n ").concat([b&&"position: relative ".concat(d,";"),"margin"===c&&"\n padding-left: ".concat(e,"px;\n padding-top: ").concat(f,"px;\n padding-right: ").concat(g,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(h,"px ").concat(d,";\n "),"padding"===c&&"padding-right: ".concat(h,"px ").concat(d,";")].filter(Boolean).join(""),"\n }\n \n .").concat(cK," {\n right: ").concat(h,"px ").concat(d,";\n }\n \n .").concat(cL," {\n margin-right: ").concat(h,"px ").concat(d,";\n }\n \n .").concat(cK," .").concat(cK," {\n right: 0 ").concat(d,";\n }\n \n .").concat(cL," .").concat(cL," {\n margin-right: 0 ").concat(d,";\n }\n \n body[").concat(c_,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(h,"px;\n }\n")},c1=function(){var a=parseInt(document.body.getAttribute(c_)||"0",10);return isFinite(a)?a:0},c2=function(){E.useEffect(function(){return document.body.setAttribute(c_,(c1()+1).toString()),function(){var a=c1()-1;a<=0?document.body.removeAttribute(c_):document.body.setAttribute(c_,a.toString())}},[])},c3=function(a){var b=a.noRelative,c=a.noImportant,d=a.gapMode,e=void 0===d?"margin":d;c2();var f=E.useMemo(function(){return cZ(e)},[e]);return E.createElement(c$,{styles:c0(f,!b,e,c?"":"!important")})},c4=!1;if("u">typeof window)try{var c5=Object.defineProperty({},"passive",{get:function(){return c4=!0,!0}});window.addEventListener("test",c5,c5),window.removeEventListener("test",c5,c5)}catch(a){c4=!1}var c6=!!c4&&{passive:!1},c7=function(a,b){if(!(a instanceof Element))return!1;var c=window.getComputedStyle(a);return"hidden"!==c[b]&&(c.overflowY!==c.overflowX||"TEXTAREA"===a.tagName||"visible"!==c[b])},c8=function(a,b){var c=b.ownerDocument,d=b;do{if("u">typeof ShadowRoot&&d instanceof ShadowRoot&&(d=d.host),c9(a,d)){var e=da(a,d);if(e[1]>e[2])return!0}d=d.parentNode}while(d&&d!==c.body);return!1},c9=function(a,b){return"v"===a?c7(b,"overflowY"):c7(b,"overflowX")},da=function(a,b){return"v"===a?[b.scrollTop,b.scrollHeight,b.clientHeight]:[b.scrollLeft,b.scrollWidth,b.clientWidth]},db=function(a,b,c,d,e){var f,g=(f=window.getComputedStyle(b).direction,"h"===a&&"rtl"===f?-1:1),h=g*d,i=c.target,j=b.contains(i),k=!1,l=h>0,m=0,n=0;do{if(!i)break;var o=da(a,i),p=o[0],q=o[1]-o[2]-g*p;(p||q)&&c9(a,i)&&(m+=q,n+=p);var r=i.parentNode;i=r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE?r.host:r}while(!j&&i!==document.body||j&&(b.contains(i)||b===i));return l&&(e&&1>Math.abs(m)||!e&&h>m)?k=!0:!l&&(e&&1>Math.abs(n)||!e&&-h>n)&&(k=!0),k},dc=function(a){return"changedTouches"in a?[a.changedTouches[0].clientX,a.changedTouches[0].clientY]:[0,0]},dd=function(a){return[a.deltaX,a.deltaY]},de=function(a){return a&&"current"in a?a.current:a},df=0,dg=[];let dh=(e2=function(a){var b=E.useRef([]),c=E.useRef([0,0]),d=E.useRef(),e=E.useState(df++)[0],f=E.useState(cV)[0],g=E.useRef(a);E.useEffect(function(){g.current=a},[a]),E.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(e));var b=(function(a,b,c){if(c||2==arguments.length)for(var d,e=0,f=b.length;e<f;e++)!d&&e in b||(d||(d=Array.prototype.slice.call(b,0,e)),d[e]=b[e]);return a.concat(d||Array.prototype.slice.call(b))})([a.lockRef.current],(a.shards||[]).map(de),!0).filter(Boolean);return b.forEach(function(a){return a.classList.add("allow-interactivity-".concat(e))}),function(){document.body.classList.remove("block-interactivity-".concat(e)),b.forEach(function(a){return a.classList.remove("allow-interactivity-".concat(e))})}}},[a.inert,a.lockRef.current,a.shards]);var h=E.useCallback(function(a,b){if("touches"in a&&2===a.touches.length||"wheel"===a.type&&a.ctrlKey)return!g.current.allowPinchZoom;var e,f=dc(a),h=c.current,i="deltaX"in a?a.deltaX:h[0]-f[0],j="deltaY"in a?a.deltaY:h[1]-f[1],k=a.target,l=Math.abs(i)>Math.abs(j)?"h":"v";if("touches"in a&&"h"===l&&"range"===k.type)return!1;var m=window.getSelection(),n=m&&m.anchorNode;if(n&&(n===k||n.contains(k)))return!1;var o=c8(l,k);if(!o)return!0;if(o?e=l:(e="v"===l?"h":"v",o=c8(l,k)),!o)return!1;if(!d.current&&"changedTouches"in a&&(i||j)&&(d.current=e),!e)return!0;var p=d.current||e;return db(p,b,a,"h"===p?i:j,!0)},[]),i=E.useCallback(function(a){if(dg.length&&dg[dg.length-1]===f){var c="deltaY"in a?dd(a):dc(a),d=b.current.filter(function(b){var d;return b.name===a.type&&(b.target===a.target||a.target===b.shadowParent)&&(d=b.delta,d[0]===c[0]&&d[1]===c[1])})[0];if(d&&d.should){a.cancelable&&a.preventDefault();return}if(!d){var e=(g.current.shards||[]).map(de).filter(Boolean).filter(function(b){return b.contains(a.target)});(e.length>0?h(a,e[0]):!g.current.noIsolation)&&a.cancelable&&a.preventDefault()}}},[]),j=E.useCallback(function(a,c,d,e){var f={name:a,delta:c,target:d,should:e,shadowParent:function(a){for(var b=null;null!==a;)a instanceof ShadowRoot&&(b=a.host,a=a.host),a=a.parentNode;return b}(d)};b.current.push(f),setTimeout(function(){b.current=b.current.filter(function(a){return a!==f})},1)},[]),k=E.useCallback(function(a){c.current=dc(a),d.current=void 0},[]),l=E.useCallback(function(b){j(b.type,dd(b),b.target,h(b,a.lockRef.current))},[]),m=E.useCallback(function(b){j(b.type,dc(b),b.target,h(b,a.lockRef.current))},[]);E.useEffect(function(){return dg.push(f),a.setCallbacks({onScrollCapture:l,onWheelCapture:l,onTouchMoveCapture:m}),document.addEventListener("wheel",i,c6),document.addEventListener("touchmove",i,c6),document.addEventListener("touchstart",k,c6),function(){dg=dg.filter(function(a){return a!==f}),document.removeEventListener("wheel",i,c6),document.removeEventListener("touchmove",i,c6),document.removeEventListener("touchstart",k,c6)}},[]);var n=a.removeScrollBar,o=a.inert;return E.createElement(E.Fragment,null,o?E.createElement(f,{styles:"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")}):null,n?E.createElement(c3,{noRelative:a.noRelative,gapMode:a.gapMode}):null)},cP.useMedium(e2),cS);var di=E.forwardRef(function(a,b){return E.createElement(cR,cI({},a,{ref:b,sideCar:dh}))});di.classNames=cR.classNames;var dj=new WeakMap,dk=new WeakMap,dl={},dm=0,dn=function(a){return a&&(a.host||dn(a.parentNode))},dp=function(a,b,c,d){var e=(Array.isArray(a)?a:[a]).map(function(a){if(b.contains(a))return a;var c=dn(a);return c&&b.contains(c)?c:(console.error("aria-hidden",a,"in not contained inside",b,". Doing nothing"),null)}).filter(function(a){return!!a});dl[c]||(dl[c]=new WeakMap);var f=dl[c],g=[],h=new Set,i=new Set(e),j=function(a){!a||h.has(a)||(h.add(a),j(a.parentNode))};e.forEach(j);var k=function(a){!a||i.has(a)||Array.prototype.forEach.call(a.children,function(a){if(h.has(a))k(a);else try{var b=a.getAttribute(d),e=null!==b&&"false"!==b,i=(dj.get(a)||0)+1,j=(f.get(a)||0)+1;dj.set(a,i),f.set(a,j),g.push(a),1===i&&e&&dk.set(a,!0),1===j&&a.setAttribute(c,"true"),e||a.setAttribute(d,"true")}catch(b){console.error("aria-hidden: cannot operate on ",a,b)}})};return k(b),h.clear(),dm++,function(){g.forEach(function(a){var b=dj.get(a)-1,e=f.get(a)-1;dj.set(a,b),f.set(a,e),b||(dk.has(a)||a.removeAttribute(d),dk.delete(a)),e||a.removeAttribute(c)}),--dm||(dj=new WeakMap,dj=new WeakMap,dk=new WeakMap,dl={})}},dq=function(a,b,c){void 0===c&&(c="data-aria-hidden");var d=Array.from(Array.isArray(a)?a:[a]),e=b||("u"<typeof document?null:(Array.isArray(a)?a[0]:a).ownerDocument.body);return e?(d.push.apply(d,Array.from(e.querySelectorAll("[aria-live], script"))),dp(d,e,c,"aria-hidden")):function(){return null}},dr="Dialog",[ds,dt]=bs(dr),[du,dv]=ds(dr),dw=a=>{let{__scopeDialog:b,children:c,open:d,defaultOpen:e,onOpenChange:f,modal:g=!0}=a,h=E.useRef(null),i=E.useRef(null),[j,k]=bH({prop:d,defaultProp:e??!1,onChange:f,caller:dr});return(0,D.jsx)(du,{scope:b,triggerRef:h,contentRef:i,contentId:bC(),titleId:bC(),descriptionId:bC(),open:j,onOpenChange:k,onOpenToggle:E.useCallback(()=>k(a=>!a),[k]),modal:g,children:c})};dw.displayName=dr;var dx="DialogTrigger",dy=E.forwardRef((a,b)=>{let{__scopeDialog:c,...d}=a,e=dv(dx,c),f=bg(b,e.triggerRef);return(0,D.jsx)(bE.button,{type:"button","aria-haspopup":"dialog","aria-expanded":e.open,"aria-controls":e.contentId,"data-state":dS(e.open),...d,ref:f,onClick:br(a.onClick,e.onOpenToggle)})});dy.displayName=dx;var dz="DialogPortal",[dA,dB]=ds(dz,{forceMount:void 0}),dC=a=>{let{__scopeDialog:b,forceMount:c,children:d,container:e}=a,f=dv(dz,b);return(0,D.jsx)(dA,{scope:b,forceMount:c,children:E.Children.map(d,a=>(0,D.jsx)(b$,{present:c||f.open,children:(0,D.jsx)(cF,{asChild:!0,container:e,children:a})}))})};dC.displayName=dz;var dD="DialogOverlay",dE=E.forwardRef((a,b)=>{let c=dB(dD,a.__scopeDialog),{forceMount:d=c.forceMount,...e}=a,f=dv(dD,a.__scopeDialog);return f.modal?(0,D.jsx)(b$,{present:d||f.open,children:(0,D.jsx)(dG,{...e,ref:b})}):null});dE.displayName=dD;var dF=bt("DialogOverlay.RemoveScroll"),dG=E.forwardRef((a,b)=>{let{__scopeDialog:c,...d}=a,e=dv(dD,c);return(0,D.jsx)(di,{as:dF,allowPinchZoom:!0,shards:[e.contentRef],children:(0,D.jsx)(bE.div,{"data-state":dS(e.open),...d,ref:b,style:{pointerEvents:"auto",...d.style}})})}),dH="DialogContent",dI=E.forwardRef((a,b)=>{let c=dB(dH,a.__scopeDialog),{forceMount:d=c.forceMount,...e}=a,f=dv(dH,a.__scopeDialog);return(0,D.jsx)(b$,{present:d||f.open,children:f.modal?(0,D.jsx)(dJ,{...e,ref:b}):(0,D.jsx)(dK,{...e,ref:b})})});dI.displayName=dH;var dJ=E.forwardRef((a,b)=>{let c=dv(dH,a.__scopeDialog),d=E.useRef(null),e=bg(b,c.contentRef,d);return E.useEffect(()=>{let a=d.current;if(a)return dq(a)},[]),(0,D.jsx)(dL,{...a,ref:e,trapFocus:c.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:br(a.onCloseAutoFocus,a=>{a.preventDefault(),c.triggerRef.current?.focus()}),onPointerDownOutside:br(a.onPointerDownOutside,a=>{let b=a.detail.originalEvent,c=0===b.button&&!0===b.ctrlKey;(2===b.button||c)&&a.preventDefault()}),onFocusOutside:br(a.onFocusOutside,a=>a.preventDefault())})}),dK=E.forwardRef((a,b)=>{let c=dv(dH,a.__scopeDialog),d=E.useRef(!1),e=E.useRef(!1);return(0,D.jsx)(dL,{...a,ref:b,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:b=>{a.onCloseAutoFocus?.(b),b.defaultPrevented||(d.current||c.triggerRef.current?.focus(),b.preventDefault()),d.current=!1,e.current=!1},onInteractOutside:b=>{a.onInteractOutside?.(b),b.defaultPrevented||(d.current=!0,"pointerdown"===b.detail.originalEvent.type&&(e.current=!0));let f=b.target;c.triggerRef.current?.contains(f)&&b.preventDefault(),"focusin"===b.detail.originalEvent.type&&e.current&&b.preventDefault()}})}),dL=E.forwardRef((a,b)=>{let{__scopeDialog:c,trapFocus:d,onOpenAutoFocus:e,onCloseAutoFocus:f,...g}=a,h=dv(dH,c),i=E.useRef(null),j=bg(b,i);return E.useEffect(()=>{let a=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",a[0]??cH()),document.body.insertAdjacentElement("beforeend",a[1]??cH()),cG++,()=>{1===cG&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),cG--}},[]),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(cz,{asChild:!0,loop:!0,trapped:d,onMountAutoFocus:e,onUnmountAutoFocus:f,children:(0,D.jsx)(ct,{role:"dialog",id:h.contentId,"aria-describedby":h.descriptionId,"aria-labelledby":h.titleId,"data-state":dS(h.open),...g,ref:j,onDismiss:()=>h.onOpenChange(!1)})}),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(dW,{titleId:h.titleId}),(0,D.jsx)(dX,{contentRef:i,descriptionId:h.descriptionId})]})]})}),dM="DialogTitle",dN=E.forwardRef((a,b)=>{let{__scopeDialog:c,...d}=a,e=dv(dM,c);return(0,D.jsx)(bE.h2,{id:e.titleId,...d,ref:b})});dN.displayName=dM;var dO="DialogDescription",dP=E.forwardRef((a,b)=>{let{__scopeDialog:c,...d}=a,e=dv(dO,c);return(0,D.jsx)(bE.p,{id:e.descriptionId,...d,ref:b})});dP.displayName=dO;var dQ="DialogClose",dR=E.forwardRef((a,b)=>{let{__scopeDialog:c,...d}=a,e=dv(dQ,c);return(0,D.jsx)(bE.button,{type:"button",...d,ref:b,onClick:br(a.onClick,()=>e.onOpenChange(!1))})});function dS(a){return a?"open":"closed"}dR.displayName=dQ;var dT="DialogTitleWarning",[dU,dV]=(e3={contentName:dH,titleName:dM,docsSlug:"dialog"},g=E.createContext(e3),(h=a=>{let{children:b,...c}=a,d=E.useMemo(()=>c,Object.values(c));return(0,D.jsx)(g.Provider,{value:d,children:b})}).displayName=dT+"Provider",[h,function(a){let b=E.useContext(g);if(b)return b;if(void 0!==e3)return e3;throw Error(`\`${a}\` must be used within \`${dT}\``)}]),dW=({titleId:a})=>{let b=dV(dT),c=`\`${b.contentName}\` requires a \`${b.titleName}\` for the component to be accessible for screen reader users.
1
+ (()=>{var a={};a.id=974,a.ids=[974],a.modules={145:(a,b,c)=>{"use strict";let d,e,f,g,h,i,j;c.d(b,{MissionControlShell:()=>u5});var k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D=c(3814),E=c(6247),F=c.t(E,2);let G=a=>{let b=a.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,b,c)=>c?c.toUpperCase():b.toLowerCase());return b.charAt(0).toUpperCase()+b.slice(1)},H=(...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim();var I={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let J=(0,E.forwardRef)(({color:a="currentColor",size:b=24,strokeWidth:c=2,absoluteStrokeWidth:d,className:e="",children:f,iconNode:g,...h},i)=>(0,E.createElement)("svg",{ref:i,...I,width:b,height:b,stroke:a,strokeWidth:d?24*Number(c)/Number(b):c,className:H("lucide",e),...!f&&!(a=>{for(let b in a)if(b.startsWith("aria-")||"role"===b||"title"===b)return!0})(h)&&{"aria-hidden":"true"},...h},[...g.map(([a,b])=>(0,E.createElement)(a,b)),...Array.isArray(f)?f:[f]])),K=(a,b)=>{let c=(0,E.forwardRef)(({className:c,...d},e)=>(0,E.createElement)(J,{ref:e,iconNode:b,className:H(`lucide-${G(a).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${a}`,c),...d}));return c.displayName=G(a),c},L=K("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),M=K("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),N=K("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),O=K("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),P=K("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Q=K("sun-medium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]),R=K("moon-star",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]),S=K("settings-2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),T=K("circle-arrow-up",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]),U=K("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),V=K("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),W=K("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),X=K("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),Y=K("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),Z=K("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),$=K("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);function _(){for(var a,b,c=0,d="",e=arguments.length;c<e;c++)(a=arguments[c])&&(b=function a(b){var c,d,e="";if("string"==typeof b||"number"==typeof b)e+=b;else if("object"==typeof b)if(Array.isArray(b)){var f=b.length;for(c=0;c<f;c++)b[c]&&(d=a(b[c]))&&(e&&(e+=" "),e+=d)}else for(d in b)b[d]&&(e&&(e+=" "),e+=d);return e}(a))&&(d&&(d+=" "),d+=b);return d}let aa=a=>"boolean"==typeof a?`${a}`:0===a?"0":a,ab=(a,b)=>c=>{var d;if((null==b?void 0:b.variants)==null)return _(a,null==c?void 0:c.class,null==c?void 0:c.className);let{variants:e,defaultVariants:f}=b,g=Object.keys(e).map(a=>{let b=null==c?void 0:c[a],d=null==f?void 0:f[a];if(null===b)return null;let g=aa(b)||aa(d);return e[a][g]}),h=c&&Object.entries(c).reduce((a,b)=>{let[c,d]=b;return void 0===d||(a[c]=d),a},{});return _(a,g,null==b||null==(d=b.compoundVariants)?void 0:d.reduce((a,b)=>{let{class:c,className:d,...e}=b;return Object.entries(e).every(a=>{let[b,c]=a;return Array.isArray(c)?c.includes({...f,...h}[b]):({...f,...h})[b]===c})?[...a,c,d]:a},[]),null==c?void 0:c.class,null==c?void 0:c.className)},ac=(a=new Map,b=null,c)=>({nextPart:a,validators:b,classGroupId:c}),ad=[],ae=(a,b,c)=>{if(0==a.length-b)return c.classGroupId;let d=a[b],e=c.nextPart.get(d);if(e){let c=ae(a,b+1,e);if(c)return c}let f=c.validators;if(null===f)return;let g=0===b?a.join("-"):a.slice(b).join("-"),h=f.length;for(let a=0;a<h;a++){let b=f[a];if(b.validator(g))return b.classGroupId}},af=(a,b)=>{let c=ac();for(let d in a)ag(a[d],c,d,b);return c},ag=(a,b,c,d)=>{let e=a.length;for(let f=0;f<e;f++)ah(a[f],b,c,d)},ah=(a,b,c,d)=>{"string"==typeof a?ai(a,b,c):"function"==typeof a?aj(a,b,c,d):ak(a,b,c,d)},ai=(a,b,c)=>{(""===a?b:al(b,a)).classGroupId=c},aj=(a,b,c,d)=>{am(a)?ag(a(d),b,c,d):(null===b.validators&&(b.validators=[]),b.validators.push({classGroupId:c,validator:a}))},ak=(a,b,c,d)=>{let e=Object.entries(a),f=e.length;for(let a=0;a<f;a++){let[f,g]=e[a];ag(g,al(b,f),c,d)}},al=(a,b)=>{let c=a,d=b.split("-"),e=d.length;for(let a=0;a<e;a++){let b=d[a],e=c.nextPart.get(b);e||(e=ac(),c.nextPart.set(b,e)),c=e}return c},am=a=>"isThemeGetter"in a&&!0===a.isThemeGetter,an=[],ao=(a,b,c,d,e)=>({modifiers:a,hasImportantModifier:b,baseClassName:c,maybePostfixModifierPosition:d,isExternal:e}),ap=/\s+/,aq=a=>{let b;if("string"==typeof a)return a;let c="";for(let d=0;d<a.length;d++)a[d]&&(b=aq(a[d]))&&(c&&(c+=" "),c+=b);return c},ar=[],as=a=>{let b=b=>b[a]||ar;return b.isThemeGetter=!0,b},at=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,au=/^\((?:(\w[\w-]*):)?(.+)\)$/i,av=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,aw=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ax=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ay=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,az=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,aA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,aB=a=>av.test(a),aC=a=>!!a&&!Number.isNaN(Number(a)),aD=a=>!!a&&Number.isInteger(Number(a)),aE=a=>a.endsWith("%")&&aC(a.slice(0,-1)),aF=a=>aw.test(a),aG=()=>!0,aH=a=>ax.test(a)&&!ay.test(a),aI=()=>!1,aJ=a=>az.test(a),aK=a=>aA.test(a),aL=a=>!aN(a)&&!aV(a),aM=a=>a1(a,a5,aI),aN=a=>at.test(a),aO=a=>a1(a,a6,aH),aP=a=>a1(a,a7,aC),aQ=a=>a1(a,a9,aG),aR=a=>a1(a,a8,aI),aS=a=>a1(a,a3,aI),aT=a=>a1(a,a4,aK),aU=a=>a1(a,ba,aJ),aV=a=>au.test(a),aW=a=>a2(a,a6),aX=a=>a2(a,a8),aY=a=>a2(a,a3),aZ=a=>a2(a,a5),a$=a=>a2(a,a4),a_=a=>a2(a,ba,!0),a0=a=>a2(a,a9,!0),a1=(a,b,c)=>{let d=at.exec(a);return!!d&&(d[1]?b(d[1]):c(d[2]))},a2=(a,b,c=!1)=>{let d=au.exec(a);return!!d&&(d[1]?b(d[1]):c)},a3=a=>"position"===a||"percentage"===a,a4=a=>"image"===a||"url"===a,a5=a=>"length"===a||"size"===a||"bg-size"===a,a6=a=>"length"===a,a7=a=>"number"===a,a8=a=>"family-name"===a,a9=a=>"number"===a||"weight"===a,ba=a=>"shadow"===a,bb=((a,...b)=>{let c,d,e,f,g=a=>{let b=d(a);if(b)return b;let f=((a,b)=>{let{parseClassName:c,getClassGroupId:d,getConflictingClassGroupIds:e,sortModifiers:f}=b,g=[],h=a.trim().split(ap),i="";for(let a=h.length-1;a>=0;a-=1){let b=h[a],{isExternal:j,modifiers:k,hasImportantModifier:l,baseClassName:m,maybePostfixModifierPosition:n}=c(b);if(j){i=b+(i.length>0?" "+i:i);continue}let o=!!n,p=d(o?m.substring(0,n):m);if(!p){if(!o||!(p=d(m))){i=b+(i.length>0?" "+i:i);continue}o=!1}let q=0===k.length?"":1===k.length?k[0]:f(k).join(":"),r=l?q+"!":q,s=r+p;if(g.indexOf(s)>-1)continue;g.push(s);let t=e(p,o);for(let a=0;a<t.length;++a){let b=t[a];g.push(r+b)}i=b+(i.length>0?" "+i:i)}return i})(a,c);return e(a,f),f};return f=h=>{var i;let j;return d=(c={cache:(a=>{if(a<1)return{get:()=>void 0,set:()=>{}};let b=0,c=Object.create(null),d=Object.create(null),e=(e,f)=>{c[e]=f,++b>a&&(b=0,d=c,c=Object.create(null))};return{get(a){let b=c[a];return void 0!==b?b:void 0!==(b=d[a])?(e(a,b),b):void 0},set(a,b){a in c?c[a]=b:e(a,b)}}})((i=b.reduce((a,b)=>b(a),a())).cacheSize),parseClassName:(a=>{let{prefix:b,experimentalParseClassName:c}=a,d=a=>{let b,c=[],d=0,e=0,f=0,g=a.length;for(let h=0;h<g;h++){let g=a[h];if(0===d&&0===e){if(":"===g){c.push(a.slice(f,h)),f=h+1;continue}if("/"===g){b=h;continue}}"["===g?d++:"]"===g?d--:"("===g?e++:")"===g&&e--}let h=0===c.length?a:a.slice(f),i=h,j=!1;return h.endsWith("!")?(i=h.slice(0,-1),j=!0):h.startsWith("!")&&(i=h.slice(1),j=!0),ao(c,j,i,b&&b>f?b-f:void 0)};if(b){let a=b+":",c=d;d=b=>b.startsWith(a)?c(b.slice(a.length)):ao(an,!1,b,void 0,!0)}if(c){let a=d;d=b=>c({className:b,parseClassName:a})}return d})(i),sortModifiers:(j=new Map,i.orderSensitiveModifiers.forEach((a,b)=>{j.set(a,1e6+b)}),a=>{let b=[],c=[];for(let d=0;d<a.length;d++){let e=a[d],f="["===e[0],g=j.has(e);f||g?(c.length>0&&(c.sort(),b.push(...c),c=[]),b.push(e)):c.push(e)}return c.length>0&&(c.sort(),b.push(...c)),b}),...(a=>{let b=(a=>{let{theme:b,classGroups:c}=a;return af(c,b)})(a),{conflictingClassGroups:c,conflictingClassGroupModifiers:d}=a;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]")){var c;let b,d,e;return -1===(c=a).slice(1,-1).indexOf(":")?void 0:(d=(b=c.slice(1,-1)).indexOf(":"),(e=b.slice(0,d))?"arbitrary.."+e:void 0)}let d=a.split("-"),e=+(""===d[0]&&d.length>1);return ae(d,e,b)},getConflictingClassGroupIds:(a,b)=>{if(b){let b=d[a],e=c[a];if(b){if(e){let a=Array(e.length+b.length);for(let b=0;b<e.length;b++)a[b]=e[b];for(let c=0;c<b.length;c++)a[e.length+c]=b[c];return a}return b}return e||ad}return c[a]||ad}}})(i)}).cache.get,e=c.cache.set,f=g,g(h)},(...a)=>f(((...a)=>{let b,c,d=0,e="";for(;d<a.length;)(b=a[d++])&&(c=aq(b))&&(e&&(e+=" "),e+=c);return e})(...a))})(()=>{let a=as("color"),b=as("font"),c=as("text"),d=as("font-weight"),e=as("tracking"),f=as("leading"),g=as("breakpoint"),h=as("container"),i=as("spacing"),j=as("radius"),k=as("shadow"),l=as("inset-shadow"),m=as("text-shadow"),n=as("drop-shadow"),o=as("blur"),p=as("perspective"),q=as("aspect"),r=as("ease"),s=as("animate"),t=()=>["auto","avoid","all","avoid-page","page","left","right","column"],u=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],v=()=>[...u(),aV,aN],w=()=>["auto","hidden","clip","visible","scroll"],x=()=>["auto","contain","none"],y=()=>[aV,aN,i],z=()=>[aB,"full","auto",...y()],A=()=>[aD,"none","subgrid",aV,aN],B=()=>["auto",{span:["full",aD,aV,aN]},aD,aV,aN],C=()=>[aD,"auto",aV,aN],D=()=>["auto","min","max","fr",aV,aN],E=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...y()],H=()=>[aB,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...y()],I=()=>[aB,"screen","full","dvw","lvw","svw","min","max","fit",...y()],J=()=>[aB,"screen","full","lh","dvh","lvh","svh","min","max","fit",...y()],K=()=>[a,aV,aN],L=()=>[...u(),aY,aS,{position:[aV,aN]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],N=()=>["auto","cover","contain",aZ,aM,{size:[aV,aN]}],O=()=>[aE,aW,aO],P=()=>["","none","full",j,aV,aN],Q=()=>["",aC,aW,aO],R=()=>["solid","dashed","dotted","double"],S=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],T=()=>[aC,aE,aY,aS],U=()=>["","none",o,aV,aN],V=()=>["none",aC,aV,aN],W=()=>["none",aC,aV,aN],X=()=>[aC,aV,aN],Y=()=>[aB,"full",...y()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[aF],breakpoint:[aF],color:[aG],container:[aF],"drop-shadow":[aF],ease:["in","out","in-out"],font:[aL],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[aF],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[aF],shadow:[aF],spacing:["px",aC],text:[aF],"text-shadow":[aF],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",aB,aN,aV,q]}],container:["container"],columns:[{columns:[aC,aN,aV,h]}],"break-after":[{"break-after":t()}],"break-before":[{"break-before":t()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:v()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:x()}],"overscroll-x":[{"overscroll-x":x()}],"overscroll-y":[{"overscroll-y":x()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{"inset-s":z(),start:z()}],end:[{"inset-e":z(),end:z()}],"inset-bs":[{"inset-bs":z()}],"inset-be":[{"inset-be":z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[aD,"auto",aV,aN]}],basis:[{basis:[aB,"full","auto",h,...y()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[aC,aB,"auto","initial","none",aN]}],grow:[{grow:["",aC,aV,aN]}],shrink:[{shrink:["",aC,aV,aN]}],order:[{order:[aD,"first","last","none",aV,aN]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:y()}],"gap-x":[{"gap-x":y()}],"gap-y":[{"gap-y":y()}],"justify-content":[{justify:[...E(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...E()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":E()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:y()}],px:[{px:y()}],py:[{py:y()}],ps:[{ps:y()}],pe:[{pe:y()}],pbs:[{pbs:y()}],pbe:[{pbe:y()}],pt:[{pt:y()}],pr:[{pr:y()}],pb:[{pb:y()}],pl:[{pl:y()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mbs:[{mbs:G()}],mbe:[{mbe:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":y()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":y()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"inline-size":[{inline:["auto",...I()]}],"min-inline-size":[{"min-inline":["auto",...I()]}],"max-inline-size":[{"max-inline":["none",...I()]}],"block-size":[{block:["auto",...J()]}],"min-block-size":[{"min-block":["auto",...J()]}],"max-block-size":[{"max-block":["none",...J()]}],w:[{w:[h,"screen",...H()]}],"min-w":[{"min-w":[h,"screen","none",...H()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[g]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",c,aW,aO]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[d,a0,aQ]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",aE,aN]}],"font-family":[{font:[aX,aR,b]}],"font-features":[{"font-features":[aN]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[e,aV,aN]}],"line-clamp":[{"line-clamp":[aC,"none",aV,aP]}],leading:[{leading:[f,...y()]}],"list-image":[{"list-image":["none",aV,aN]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",aV,aN]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...R(),"wavy"]}],"text-decoration-thickness":[{decoration:[aC,"from-font","auto",aV,aO]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[aC,"auto",aV,aN]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:y()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",aV,aN]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",aV,aN]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},aD,aV,aN],radial:["",aV,aN],conic:[aD,aV,aN]},a$,aT]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:O()}],"gradient-via-pos":[{via:O()}],"gradient-to-pos":[{to:O()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-bs":[{"border-bs":Q()}],"border-w-be":[{"border-be":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...R(),"hidden","none"]}],"divide-style":[{divide:[...R(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-bs":[{"border-bs":K()}],"border-color-be":[{"border-be":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...R(),"none","hidden"]}],"outline-offset":[{"outline-offset":[aC,aV,aN]}],"outline-w":[{outline:["",aC,aW,aO]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",k,a_,aU]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",l,a_,aU]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[aC,aO]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",m,a_,aU]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[aC,aV,aN]}],"mix-blend":[{"mix-blend":[...S(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":S()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[aC]}],"mask-image-linear-from-pos":[{"mask-linear-from":T()}],"mask-image-linear-to-pos":[{"mask-linear-to":T()}],"mask-image-linear-from-color":[{"mask-linear-from":K()}],"mask-image-linear-to-color":[{"mask-linear-to":K()}],"mask-image-t-from-pos":[{"mask-t-from":T()}],"mask-image-t-to-pos":[{"mask-t-to":T()}],"mask-image-t-from-color":[{"mask-t-from":K()}],"mask-image-t-to-color":[{"mask-t-to":K()}],"mask-image-r-from-pos":[{"mask-r-from":T()}],"mask-image-r-to-pos":[{"mask-r-to":T()}],"mask-image-r-from-color":[{"mask-r-from":K()}],"mask-image-r-to-color":[{"mask-r-to":K()}],"mask-image-b-from-pos":[{"mask-b-from":T()}],"mask-image-b-to-pos":[{"mask-b-to":T()}],"mask-image-b-from-color":[{"mask-b-from":K()}],"mask-image-b-to-color":[{"mask-b-to":K()}],"mask-image-l-from-pos":[{"mask-l-from":T()}],"mask-image-l-to-pos":[{"mask-l-to":T()}],"mask-image-l-from-color":[{"mask-l-from":K()}],"mask-image-l-to-color":[{"mask-l-to":K()}],"mask-image-x-from-pos":[{"mask-x-from":T()}],"mask-image-x-to-pos":[{"mask-x-to":T()}],"mask-image-x-from-color":[{"mask-x-from":K()}],"mask-image-x-to-color":[{"mask-x-to":K()}],"mask-image-y-from-pos":[{"mask-y-from":T()}],"mask-image-y-to-pos":[{"mask-y-to":T()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[aV,aN]}],"mask-image-radial-from-pos":[{"mask-radial-from":T()}],"mask-image-radial-to-pos":[{"mask-radial-to":T()}],"mask-image-radial-from-color":[{"mask-radial-from":K()}],"mask-image-radial-to-color":[{"mask-radial-to":K()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":u()}],"mask-image-conic-pos":[{"mask-conic":[aC]}],"mask-image-conic-from-pos":[{"mask-conic-from":T()}],"mask-image-conic-to-pos":[{"mask-conic-to":T()}],"mask-image-conic-from-color":[{"mask-conic-from":K()}],"mask-image-conic-to-color":[{"mask-conic-to":K()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",aV,aN]}],filter:[{filter:["","none",aV,aN]}],blur:[{blur:U()}],brightness:[{brightness:[aC,aV,aN]}],contrast:[{contrast:[aC,aV,aN]}],"drop-shadow":[{"drop-shadow":["","none",n,a_,aU]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",aC,aV,aN]}],"hue-rotate":[{"hue-rotate":[aC,aV,aN]}],invert:[{invert:["",aC,aV,aN]}],saturate:[{saturate:[aC,aV,aN]}],sepia:[{sepia:["",aC,aV,aN]}],"backdrop-filter":[{"backdrop-filter":["","none",aV,aN]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[aC,aV,aN]}],"backdrop-contrast":[{"backdrop-contrast":[aC,aV,aN]}],"backdrop-grayscale":[{"backdrop-grayscale":["",aC,aV,aN]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[aC,aV,aN]}],"backdrop-invert":[{"backdrop-invert":["",aC,aV,aN]}],"backdrop-opacity":[{"backdrop-opacity":[aC,aV,aN]}],"backdrop-saturate":[{"backdrop-saturate":[aC,aV,aN]}],"backdrop-sepia":[{"backdrop-sepia":["",aC,aV,aN]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":y()}],"border-spacing-x":[{"border-spacing-x":y()}],"border-spacing-y":[{"border-spacing-y":y()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",aV,aN]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[aC,"initial",aV,aN]}],ease:[{ease:["linear","initial",r,aV,aN]}],delay:[{delay:[aC,aV,aN]}],animate:[{animate:["none",s,aV,aN]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,aV,aN]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:V()}],"rotate-x":[{"rotate-x":V()}],"rotate-y":[{"rotate-y":V()}],"rotate-z":[{"rotate-z":V()}],scale:[{scale:W()}],"scale-x":[{"scale-x":W()}],"scale-y":[{"scale-y":W()}],"scale-z":[{"scale-z":W()}],"scale-3d":["scale-3d"],skew:[{skew:X()}],"skew-x":[{"skew-x":X()}],"skew-y":[{"skew-y":X()}],transform:[{transform:[aV,aN,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Y()}],"translate-x":[{"translate-x":Y()}],"translate-y":[{"translate-y":Y()}],"translate-z":[{"translate-z":Y()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",aV,aN]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":y()}],"scroll-mx":[{"scroll-mx":y()}],"scroll-my":[{"scroll-my":y()}],"scroll-ms":[{"scroll-ms":y()}],"scroll-me":[{"scroll-me":y()}],"scroll-mbs":[{"scroll-mbs":y()}],"scroll-mbe":[{"scroll-mbe":y()}],"scroll-mt":[{"scroll-mt":y()}],"scroll-mr":[{"scroll-mr":y()}],"scroll-mb":[{"scroll-mb":y()}],"scroll-ml":[{"scroll-ml":y()}],"scroll-p":[{"scroll-p":y()}],"scroll-px":[{"scroll-px":y()}],"scroll-py":[{"scroll-py":y()}],"scroll-ps":[{"scroll-ps":y()}],"scroll-pe":[{"scroll-pe":y()}],"scroll-pbs":[{"scroll-pbs":y()}],"scroll-pbe":[{"scroll-pbe":y()}],"scroll-pt":[{"scroll-pt":y()}],"scroll-pr":[{"scroll-pr":y()}],"scroll-pb":[{"scroll-pb":y()}],"scroll-pl":[{"scroll-pl":y()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",aV,aN]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[aC,aW,aO,aP]}],stroke:[{stroke:["none",...K()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function bc(...a){return bb(_(a))}let bd=ab("inline-flex items-center rounded-full border px-2.5 py-0.5 text-[11px] font-medium tracking-[0.14em] uppercase transition-colors",{variants:{variant:{default:"border-cyan-400/30 bg-cyan-400/10 text-cyan-200",muted:"border-white/10 bg-white/5 text-slate-300",success:"border-emerald-400/25 bg-emerald-400/10 text-emerald-200",warning:"border-amber-400/25 bg-amber-400/10 text-amber-100",danger:"border-rose-400/30 bg-rose-400/10 text-rose-100"}},defaultVariants:{variant:"default"}});function be({className:a,variant:b,...c}){return(0,D.jsx)("div",{className:bc(bd({variant:b}),a),...c})}function bf(a,b){if("function"==typeof a)return a(b);null!=a&&(a.current=b)}function bg(...a){return b=>{let c=!1,d=a.map(a=>{let d=bf(a,b);return c||"function"!=typeof d||(c=!0),d});if(c)return()=>{for(let b=0;b<d.length;b++){let c=d[b];"function"==typeof c?c():bf(a[b],null)}}}}function bh(...a){return E.useCallback(bg(...a),a)}var bi=Symbol.for("react.lazy"),bj=F[" use ".trim().toString()];function bk(a){var b;return null!=a&&"object"==typeof a&&"$$typeof"in a&&a.$$typeof===bi&&"_payload"in a&&"object"==typeof(b=a._payload)&&null!==b&&"then"in b}function bl(a){var b;let c,d=(b=a,(c=E.forwardRef((a,b)=>{let{children:c,...d}=a;if(bk(c)&&"function"==typeof bj&&(c=bj(c._payload)),E.isValidElement(c)){var e;let a,f,g=(e=c,(f=(a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.ref:(f=(a=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.props.ref:e.props.ref||e.ref),h=function(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}(d,c.props);return c.type!==E.Fragment&&(h.ref=b?bg(b,g):g),E.cloneElement(c,h)}return E.Children.count(c)>1?E.Children.only(null):null})).displayName=`${b}.SlotClone`,c),e=E.forwardRef((a,b)=>{let{children:c,...e}=a;bk(c)&&"function"==typeof bj&&(c=bj(c._payload));let f=E.Children.toArray(c),g=f.find(bo);if(g){let a=g.props.children,c=f.map(b=>b!==g?b:E.Children.count(a)>1?E.Children.only(null):E.isValidElement(a)?a.props.children:null);return(0,D.jsx)(d,{...e,ref:b,children:E.isValidElement(a)?E.cloneElement(a,void 0,c):null})}return(0,D.jsx)(d,{...e,ref:b,children:c})});return e.displayName=`${a}.Slot`,e}var bm=bl("Slot"),bn=Symbol("radix.slottable");function bo(a){return E.isValidElement(a)&&"function"==typeof a.type&&"__radixId"in a.type&&a.type.__radixId===bn}let bp=ab("inline-flex items-center justify-center whitespace-nowrap rounded-2xl text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-cyan-400 text-slate-950 shadow-lg shadow-cyan-400/20 hover:bg-cyan-300",secondary:"border border-white/10 bg-white/5 text-slate-100 hover:bg-white/10 hover:text-white",ghost:"text-slate-200 hover:bg-white/[0.08] hover:text-white",destructive:"bg-rose-500 text-white shadow-lg shadow-rose-500/20 hover:bg-rose-400"},size:{default:"h-11 px-4 py-2",sm:"h-9 rounded-xl px-3",lg:"h-12 rounded-2xl px-5",icon:"h-11 w-11"}},defaultVariants:{variant:"default",size:"default"}}),bq=E.forwardRef(({className:a,variant:b,size:c,asChild:d=!1,...e},f)=>(0,D.jsx)(d?bm:"button",{className:bc(bp({variant:b,size:c,className:a})),ref:f,...e}));bq.displayName="Button";let br=E.forwardRef(({className:a,type:b,...c},d)=>(0,D.jsx)("input",{type:b,className:bc("flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400/60 disabled:cursor-not-allowed disabled:opacity-50",a),ref:d,...c}));function bs(a,b,{checkForDefaultPrevented:c=!0}={}){return function(d){if(a?.(d),!1===c||!d.defaultPrevented)return b?.(d)}}function bt(a,b=[]){let c=[],d=()=>{let b=c.map(a=>E.createContext(a));return function(c){let d=c?.[a]||b;return E.useMemo(()=>({[`__scope${a}`]:{...c,[a]:d}}),[c,d])}};return d.scopeName=a,[function(b,d){let e=E.createContext(d),f=c.length;c=[...c,d];let g=b=>{let{scope:c,children:d,...g}=b,h=c?.[a]?.[f]||e,i=E.useMemo(()=>g,Object.values(g));return(0,D.jsx)(h.Provider,{value:i,children:d})};return g.displayName=b+"Provider",[g,function(c,g){let h=g?.[a]?.[f]||e,i=E.useContext(h);if(i)return i;if(void 0!==d)return d;throw Error(`\`${c}\` must be used within \`${b}\``)}]},function(...a){let b=a[0];if(1===a.length)return b;let c=()=>{let c=a.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(a){let d=c.reduce((b,{useScope:c,scopeName:d})=>{let e=c(a)[`__scope${d}`];return{...b,...e}},{});return E.useMemo(()=>({[`__scope${b.scopeName}`]:d}),[d])}};return c.scopeName=b.scopeName,c}(d,...b)]}function bu(a){var b;let c,d=(b=a,(c=E.forwardRef((a,b)=>{let{children:c,...d}=a;if(E.isValidElement(c)){var e;let a,f,g=(e=c,(f=(a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.ref:(f=(a=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.props.ref:e.props.ref||e.ref),h=function(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}(d,c.props);return c.type!==E.Fragment&&(h.ref=b?bg(b,g):g),E.cloneElement(c,h)}return E.Children.count(c)>1?E.Children.only(null):null})).displayName=`${b}.SlotClone`,c),e=E.forwardRef((a,b)=>{let{children:c,...e}=a,f=E.Children.toArray(c),g=f.find(bw);if(g){let a=g.props.children,c=f.map(b=>b!==g?b:E.Children.count(a)>1?E.Children.only(null):E.isValidElement(a)?a.props.children:null);return(0,D.jsx)(d,{...e,ref:b,children:E.isValidElement(a)?E.cloneElement(a,void 0,c):null})}return(0,D.jsx)(d,{...e,ref:b,children:c})});return e.displayName=`${a}.Slot`,e}br.displayName="Input","u">typeof window&&window.document&&window.document.createElement;var bv=Symbol("radix.slottable");function bw(a){return E.isValidElement(a)&&"function"==typeof a.type&&"__radixId"in a.type&&a.type.__radixId===bv}var bx=new WeakMap;function by(a,b){var c,d;let e,f,g;if("at"in Array.prototype)return Array.prototype.at.call(a,b);let h=(c=a,d=b,e=c.length,(g=(f=bz(d))>=0?f:e+f)<0||g>=e?-1:g);return -1===h?void 0:a[h]}function bz(a){return a!=a||0===a?0:Math.trunc(a)}(class a extends Map{#a;constructor(a){super(a),this.#a=[...super.keys()],bx.set(this,!0)}set(a,b){return bx.get(this)&&(this.has(a)?this.#a[this.#a.indexOf(a)]=a:this.#a.push(a)),super.set(a,b),this}insert(a,b,c){let d,e=this.has(b),f=this.#a.length,g=bz(a),h=g>=0?g:f+g,i=h<0||h>=f?-1:h;if(i===this.size||e&&i===this.size-1||-1===i)return this.set(b,c),this;let j=this.size+ +!e;g<0&&h++;let k=[...this.#a],l=!1;for(let a=h;a<j;a++)if(h===a){let f=k[a];k[a]===b&&(f=k[a+1]),e&&this.delete(b),d=this.get(f),this.set(b,c)}else{l||k[a-1]!==b||(l=!0);let c=k[l?a:a-1],e=d;d=this.get(c),this.delete(c),this.set(c,e)}return this}with(b,c,d){let e=new a(this);return e.insert(b,c,d),e}before(a){let b=this.#a.indexOf(a)-1;if(!(b<0))return this.entryAt(b)}setBefore(a,b,c){let d=this.#a.indexOf(a);return -1===d?this:this.insert(d,b,c)}after(a){let b=this.#a.indexOf(a);if(-1!==(b=-1===b||b===this.size-1?-1:b+1))return this.entryAt(b)}setAfter(a,b,c){let d=this.#a.indexOf(a);return -1===d?this:this.insert(d+1,b,c)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#a=[],super.clear()}delete(a){let b=super.delete(a);return b&&this.#a.splice(this.#a.indexOf(a),1),b}deleteAt(a){let b=this.keyAt(a);return void 0!==b&&this.delete(b)}at(a){let b=by(this.#a,a);if(void 0!==b)return this.get(b)}entryAt(a){let b=by(this.#a,a);if(void 0!==b)return[b,this.get(b)]}indexOf(a){return this.#a.indexOf(a)}keyAt(a){return by(this.#a,a)}from(a,b){let c=this.indexOf(a);if(-1===c)return;let d=c+b;return d<0&&(d=0),d>=this.size&&(d=this.size-1),this.at(d)}keyFrom(a,b){let c=this.indexOf(a);if(-1===c)return;let d=c+b;return d<0&&(d=0),d>=this.size&&(d=this.size-1),this.keyAt(d)}find(a,b){let c=0;for(let d of this){if(Reflect.apply(a,b,[d,c,this]))return d;c++}}findIndex(a,b){let c=0;for(let d of this){if(Reflect.apply(a,b,[d,c,this]))return c;c++}return -1}filter(b,c){let d=[],e=0;for(let a of this)Reflect.apply(b,c,[a,e,this])&&d.push(a),e++;return new a(d)}map(b,c){let d=[],e=0;for(let a of this)d.push([a[0],Reflect.apply(b,c,[a,e,this])]),e++;return new a(d)}reduce(...a){let[b,c]=a,d=0,e=c??this.at(0);for(let c of this)e=0===d&&1===a.length?c:Reflect.apply(b,this,[e,c,d,this]),d++;return e}reduceRight(...a){let[b,c]=a,d=c??this.at(-1);for(let c=this.size-1;c>=0;c--){let e=this.at(c);d=c===this.size-1&&1===a.length?e:Reflect.apply(b,this,[d,e,c,this])}return d}toSorted(b){return new a([...this.entries()].sort(b))}toReversed(){let b=new a;for(let a=this.size-1;a>=0;a--){let c=this.keyAt(a),d=this.get(c);b.set(c,d)}return b}toSpliced(...b){let c=[...this.entries()];return c.splice(...b),new a(c)}slice(b,c){let d=new a,e=this.size-1;if(void 0===b)return d;b<0&&(b+=this.size),void 0!==c&&c>0&&(e=c-1);for(let a=b;a<=e;a++){let b=this.keyAt(a),c=this.get(b);d.set(b,c)}return d}every(a,b){let c=0;for(let d of this){if(!Reflect.apply(a,b,[d,c,this]))return!1;c++}return!0}some(a,b){let c=0;for(let d of this){if(Reflect.apply(a,b,[d,c,this]))return!0;c++}return!1}});var bA=globalThis?.document?E.useLayoutEffect:()=>{},bB=F[" useId ".trim().toString()]||(()=>void 0),bC=0;function bD(a){let[b,c]=E.useState(bB());return bA(()=>{a||c(a=>a??String(bC++))},[a]),a||(b?`radix-${b}`:"")}var bE=c(8238),bF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,b)=>{let c=bu(`Primitive.${b}`),d=E.forwardRef((a,d)=>{let{asChild:e,...f}=a;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,D.jsx)(e?c:b,{...f,ref:d})});return d.displayName=`Primitive.${b}`,{...a,[b]:d}},{});function bG(a){let b=E.useRef(a);return E.useEffect(()=>{b.current=a}),E.useMemo(()=>(...a)=>b.current?.(...a),[])}var bH=F[" useInsertionEffect ".trim().toString()]||bA;function bI({prop:a,defaultProp:b,onChange:c=()=>{},caller:d}){let[e,f,g]=function({defaultProp:a,onChange:b}){let[c,d]=E.useState(a),e=E.useRef(c),f=E.useRef(b);return bH(()=>{f.current=b},[b]),E.useEffect(()=>{e.current!==c&&(f.current?.(c),e.current=c)},[c,e]),[c,d,f]}({defaultProp:b,onChange:c}),h=void 0!==a,i=h?a:e;{let b=E.useRef(void 0!==a);E.useEffect(()=>{let a=b.current;if(a!==h){let b=h?"controlled":"uncontrolled";console.warn(`${d} is changing from ${a?"controlled":"uncontrolled"} to ${b}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}b.current=h},[h,d])}return[i,E.useCallback(b=>{if(h){let c="function"==typeof b?b(a):b;c!==a&&g.current?.(c)}else f(b)},[h,a,f,g])]}Symbol("RADIX:SYNC_STATE");var bJ=E.createContext(void 0);function bK(a){let b=E.useContext(bJ);return a||b||"ltr"}var bL="rovingFocusGroup.onEntryFocus",bM={bubbles:!1,cancelable:!0},bN="RovingFocusGroup",[bO,bP,bQ]=function(a){let b=a+"CollectionProvider",[c,d]=bt(b),[e,f]=c(b,{collectionRef:{current:null},itemMap:new Map}),g=a=>{let{scope:b,children:c}=a,d=E.useRef(null),f=E.useRef(new Map).current;return(0,D.jsx)(e,{scope:b,itemMap:f,collectionRef:d,children:c})};g.displayName=b;let h=a+"CollectionSlot",i=bu(h),j=E.forwardRef((a,b)=>{let{scope:c,children:d}=a,e=bh(b,f(h,c).collectionRef);return(0,D.jsx)(i,{ref:e,children:d})});j.displayName=h;let k=a+"CollectionItemSlot",l="data-radix-collection-item",m=bu(k),n=E.forwardRef((a,b)=>{let{scope:c,children:d,...e}=a,g=E.useRef(null),h=bh(b,g),i=f(k,c);return E.useEffect(()=>(i.itemMap.set(g,{ref:g,...e}),()=>void i.itemMap.delete(g))),(0,D.jsx)(m,{...{[l]:""},ref:h,children:d})});return n.displayName=k,[{Provider:g,Slot:j,ItemSlot:n},function(b){let c=f(a+"CollectionConsumer",b);return E.useCallback(()=>{let a=c.collectionRef.current;if(!a)return[];let b=Array.from(a.querySelectorAll(`[${l}]`));return Array.from(c.itemMap.values()).sort((a,c)=>b.indexOf(a.ref.current)-b.indexOf(c.ref.current))},[c.collectionRef,c.itemMap])},d]}(bN),[bR,bS]=bt(bN,[bQ]),[bT,bU]=bR(bN),bV=E.forwardRef((a,b)=>(0,D.jsx)(bO.Provider,{scope:a.__scopeRovingFocusGroup,children:(0,D.jsx)(bO.Slot,{scope:a.__scopeRovingFocusGroup,children:(0,D.jsx)(bW,{...a,ref:b})})}));bV.displayName=bN;var bW=E.forwardRef((a,b)=>{let{__scopeRovingFocusGroup:c,orientation:d,loop:e=!1,dir:f,currentTabStopId:g,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:i,onEntryFocus:j,preventScrollOnEntryFocus:k=!1,...l}=a,m=E.useRef(null),n=bh(b,m),o=bK(f),[p,q]=bI({prop:g,defaultProp:h??null,onChange:i,caller:bN}),[r,s]=E.useState(!1),t=bG(j),u=bP(c),v=E.useRef(!1),[w,x]=E.useState(0);return E.useEffect(()=>{let a=m.current;if(a)return a.addEventListener(bL,t),()=>a.removeEventListener(bL,t)},[t]),(0,D.jsx)(bT,{scope:c,orientation:d,dir:o,loop:e,currentTabStopId:p,onItemFocus:E.useCallback(a=>q(a),[q]),onItemShiftTab:E.useCallback(()=>s(!0),[]),onFocusableItemAdd:E.useCallback(()=>x(a=>a+1),[]),onFocusableItemRemove:E.useCallback(()=>x(a=>a-1),[]),children:(0,D.jsx)(bF.div,{tabIndex:r||0===w?-1:0,"data-orientation":d,...l,ref:n,style:{outline:"none",...a.style},onMouseDown:bs(a.onMouseDown,()=>{v.current=!0}),onFocus:bs(a.onFocus,a=>{let b=!v.current;if(a.target===a.currentTarget&&b&&!r){let b=new CustomEvent(bL,bM);if(a.currentTarget.dispatchEvent(b),!b.defaultPrevented){let a=u().filter(a=>a.focusable);b$([a.find(a=>a.active),a.find(a=>a.id===p),...a].filter(Boolean).map(a=>a.ref.current),k)}}v.current=!1}),onBlur:bs(a.onBlur,()=>s(!1))})})}),bX="RovingFocusGroupItem",bY=E.forwardRef((a,b)=>{let{__scopeRovingFocusGroup:c,focusable:d=!0,active:e=!1,tabStopId:f,children:g,...h}=a,i=bD(),j=f||i,k=bU(bX,c),l=k.currentTabStopId===j,m=bP(c),{onFocusableItemAdd:n,onFocusableItemRemove:o,currentTabStopId:p}=k;return E.useEffect(()=>{if(d)return n(),()=>o()},[d,n,o]),(0,D.jsx)(bO.ItemSlot,{scope:c,id:j,focusable:d,active:e,children:(0,D.jsx)(bF.span,{tabIndex:l?0:-1,"data-orientation":k.orientation,...h,ref:b,onMouseDown:bs(a.onMouseDown,a=>{d?k.onItemFocus(j):a.preventDefault()}),onFocus:bs(a.onFocus,()=>k.onItemFocus(j)),onKeyDown:bs(a.onKeyDown,a=>{if("Tab"===a.key&&a.shiftKey)return void k.onItemShiftTab();if(a.target!==a.currentTarget)return;let b=function(a,b,c){var d;let e=(d=a.key,"rtl"!==c?d:"ArrowLeft"===d?"ArrowRight":"ArrowRight"===d?"ArrowLeft":d);if(!("vertical"===b&&["ArrowLeft","ArrowRight"].includes(e))&&!("horizontal"===b&&["ArrowUp","ArrowDown"].includes(e)))return bZ[e]}(a,k.orientation,k.dir);if(void 0!==b){if(a.metaKey||a.ctrlKey||a.altKey||a.shiftKey)return;a.preventDefault();let e=m().filter(a=>a.focusable).map(a=>a.ref.current);if("last"===b)e.reverse();else if("prev"===b||"next"===b){var c,d;"prev"===b&&e.reverse();let f=e.indexOf(a.currentTarget);e=k.loop?(c=e,d=f+1,c.map((a,b)=>c[(d+b)%c.length])):e.slice(f+1)}setTimeout(()=>b$(e))}}),children:"function"==typeof g?g({isCurrentTabStop:l,hasTabStop:null!=p}):g})})});bY.displayName=bX;var bZ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function b$(a,b=!1){let c=document.activeElement;for(let d of a)if(d===c||(d.focus({preventScroll:b}),document.activeElement!==c))return}var b_=a=>{var b;let c,d,{present:e,children:f}=a,g=function(a){var b,c;let[d,e]=E.useState(),f=E.useRef(null),g=E.useRef(a),h=E.useRef("none"),[i,j]=(b=a?"mounted":"unmounted",c={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},E.useReducer((a,b)=>c[a][b]??a,b));return E.useEffect(()=>{let a=b0(f.current);h.current="mounted"===i?a:"none"},[i]),bA(()=>{let b=f.current,c=g.current;if(c!==a){let d=h.current,e=b0(b);a?j("MOUNT"):"none"===e||b?.display==="none"?j("UNMOUNT"):c&&d!==e?j("ANIMATION_OUT"):j("UNMOUNT"),g.current=a}},[a,j]),bA(()=>{if(d){let a,b=d.ownerDocument.defaultView??window,c=c=>{let e=b0(f.current).includes(CSS.escape(c.animationName));if(c.target===d&&e&&(j("ANIMATION_END"),!g.current)){let c=d.style.animationFillMode;d.style.animationFillMode="forwards",a=b.setTimeout(()=>{"forwards"===d.style.animationFillMode&&(d.style.animationFillMode=c)})}},e=a=>{a.target===d&&(h.current=b0(f.current))};return d.addEventListener("animationstart",e),d.addEventListener("animationcancel",c),d.addEventListener("animationend",c),()=>{b.clearTimeout(a),d.removeEventListener("animationstart",e),d.removeEventListener("animationcancel",c),d.removeEventListener("animationend",c)}}j("ANIMATION_END")},[d,j]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:E.useCallback(a=>{f.current=a?getComputedStyle(a):null,e(a)},[])}}(e),h="function"==typeof f?f({present:g.isPresent}):E.Children.only(f),i=bh(g.ref,(b=h,(d=(c=Object.getOwnPropertyDescriptor(b.props,"ref")?.get)&&"isReactWarning"in c&&c.isReactWarning)?b.ref:(d=(c=Object.getOwnPropertyDescriptor(b,"ref")?.get)&&"isReactWarning"in c&&c.isReactWarning)?b.props.ref:b.props.ref||b.ref));return"function"==typeof f||g.isPresent?E.cloneElement(h,{ref:i}):null};function b0(a){return a?.animationName||"none"}b_.displayName="Presence";var b1="Tabs",[b2,b3]=bt(b1,[bS]),b4=bS(),[b5,b6]=b2(b1),b7=E.forwardRef((a,b)=>{let{__scopeTabs:c,value:d,onValueChange:e,defaultValue:f,orientation:g="horizontal",dir:h,activationMode:i="automatic",...j}=a,k=bK(h),[l,m]=bI({prop:d,onChange:e,defaultProp:f??"",caller:b1});return(0,D.jsx)(b5,{scope:c,baseId:bD(),value:l,onValueChange:m,orientation:g,dir:k,activationMode:i,children:(0,D.jsx)(bF.div,{dir:k,"data-orientation":g,...j,ref:b})})});b7.displayName=b1;var b8="TabsList",b9=E.forwardRef((a,b)=>{let{__scopeTabs:c,loop:d=!0,...e}=a,f=b6(b8,c),g=b4(c);return(0,D.jsx)(bV,{asChild:!0,...g,orientation:f.orientation,dir:f.dir,loop:d,children:(0,D.jsx)(bF.div,{role:"tablist","aria-orientation":f.orientation,...e,ref:b})})});b9.displayName=b8;var ca="TabsTrigger",cb=E.forwardRef((a,b)=>{let{__scopeTabs:c,value:d,disabled:e=!1,...f}=a,g=b6(ca,c),h=b4(c),i=ce(g.baseId,d),j=cf(g.baseId,d),k=d===g.value;return(0,D.jsx)(bY,{asChild:!0,...h,focusable:!e,active:k,children:(0,D.jsx)(bF.button,{type:"button",role:"tab","aria-selected":k,"aria-controls":j,"data-state":k?"active":"inactive","data-disabled":e?"":void 0,disabled:e,id:i,...f,ref:b,onMouseDown:bs(a.onMouseDown,a=>{e||0!==a.button||!1!==a.ctrlKey?a.preventDefault():g.onValueChange(d)}),onKeyDown:bs(a.onKeyDown,a=>{[" ","Enter"].includes(a.key)&&g.onValueChange(d)}),onFocus:bs(a.onFocus,()=>{let a="manual"!==g.activationMode;k||e||!a||g.onValueChange(d)})})})});cb.displayName=ca;var cc="TabsContent",cd=E.forwardRef((a,b)=>{let{__scopeTabs:c,value:d,forceMount:e,children:f,...g}=a,h=b6(cc,c),i=ce(h.baseId,d),j=cf(h.baseId,d),k=d===h.value,l=E.useRef(k);return E.useEffect(()=>{let a=requestAnimationFrame(()=>l.current=!1);return()=>cancelAnimationFrame(a)},[]),(0,D.jsx)(b_,{present:e||k,children:({present:c})=>(0,D.jsx)(bF.div,{"data-state":k?"active":"inactive","data-orientation":h.orientation,role:"tabpanel","aria-labelledby":i,hidden:!c,id:j,tabIndex:0,...g,ref:b,style:{...a.style,animationDuration:l.current?"0s":void 0},children:c&&f})})});function ce(a,b){return`${a}-trigger-${b}`}function cf(a,b){return`${a}-content-${b}`}cd.displayName=cc;let cg=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)(b9,{ref:c,className:bc("inline-flex h-11 items-center rounded-2xl border border-white/10 bg-white/5 p-1 text-slate-400",a),...b}));cg.displayName=b9.displayName;let ch=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)(cb,{ref:c,className:bc("inline-flex items-center justify-center whitespace-nowrap rounded-xl px-3 py-2 text-sm transition-all data-[state=active]:bg-white/10 data-[state=active]:text-white",a),...b}));ch.displayName=cb.displayName;let ci=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)(cd,{ref:c,className:bc("mt-4 outline-none focus-visible:ring-0",a),...b}));function cj(a,b){let c=b.trim().toLowerCase();return c?a.filter(a=>`${a.name} ${a.id} ${a.tags.join(" ")}`.toLowerCase().includes(c)):a}function ck({provider:a,models:b,selectedModelIds:c,search:d,onSearchChange:e,onToggleModel:f,onAddSelected:g,isAdding:h}){let i=b.filter(a=>a.recommended),j=b.length>8||"openrouter"===a,k=c.filter(a=>!b.find(b=>b.id===a)?.alreadyAdded).length,l=cj(i,d),m=cj(b,d);return(0,D.jsxs)("div",{className:"rounded-[24px] border border-white/10 bg-[linear-gradient(180deg,rgba(10,15,26,0.94),rgba(7,11,20,0.96))] p-4",children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"font-display text-[0.96rem] text-white",children:"Select models to add"}),(0,D.jsxs)("p",{className:"mt-1 text-[12px] leading-5 text-slate-400",children:["Found ",b.length," model",1===b.length?"":"s"," for this provider."]})]}),(0,D.jsxs)(be,{variant:"muted",children:[b.filter(a=>a.alreadyAdded).length," already added"]})]}),j?(0,D.jsxs)("div",{className:"relative mt-4",children:[(0,D.jsx)(Y,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"}),(0,D.jsx)(br,{value:d,onChange:a=>e(a.target.value),placeholder:"openrouter"===a?"Search OpenRouter models":"Search models",className:"pl-11"})]}):null,"openrouter"===a?(0,D.jsxs)(b7,{defaultValue:"recommended",className:"mt-4",children:[(0,D.jsxs)(cg,{children:[(0,D.jsx)(ch,{value:"recommended",children:"Recommended"}),(0,D.jsx)(ch,{value:"all",children:"All models"})]}),(0,D.jsx)(ci,{value:"recommended",children:(0,D.jsx)(cl,{models:l,selectedModelIds:c,onToggleModel:f,emptyMessage:"No recommended matches. Switch to All models to browse the full catalog."})}),(0,D.jsx)(ci,{value:"all",children:(0,D.jsx)(cl,{models:m,selectedModelIds:c,onToggleModel:f,emptyMessage:"No models matched this search."})})]}):(0,D.jsx)("div",{className:"mt-4",children:(0,D.jsx)(cl,{models:m,selectedModelIds:c,onToggleModel:f,emptyMessage:"No models matched this search."})}),(0,D.jsxs)("div",{className:"mt-4 flex items-center justify-between gap-3 border-t border-white/10 pt-4",children:[(0,D.jsx)("p",{className:"text-[11px] text-slate-400",children:k>0?`${k} model${1===k?"":"s"} selected`:"Choose at least one model to add"}),(0,D.jsx)(bq,{type:"button",onClick:g,disabled:0===k||h,className:"h-9 rounded-full px-4",children:h?"Adding...":"Add selected models"})]})]})}function cl({models:a,selectedModelIds:b,onToggleModel:c,emptyMessage:d}){return 0===a.length?(0,D.jsx)("div",{className:"rounded-[22px] border border-dashed border-white/10 bg-white/[0.03] px-4 py-8 text-center text-[13px] text-slate-400",children:d}):(0,D.jsx)("div",{className:"max-h-[min(36vh,320px)] space-y-2 overflow-y-auto pr-1",children:a.map(a=>{let d=b.includes(a.id);return(0,D.jsxs)("button",{type:"button",disabled:a.alreadyAdded,onClick:()=>c(a.id),className:bc("flex w-full items-start justify-between gap-3 rounded-[18px] border px-3.5 py-3 text-left transition-all",a.alreadyAdded?"cursor-not-allowed border-white/8 bg-white/[0.02] opacity-70":d?"border-cyan-300/35 bg-cyan-300/[0.08]":"border-white/8 bg-white/[0.03] hover:border-white/16 hover:bg-white/[0.05]"),children:[(0,D.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,D.jsx)("div",{className:bc("mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-md border",a.alreadyAdded?"border-white/10 bg-white/[0.03] text-slate-500":d?"border-cyan-300/50 bg-cyan-300/15 text-cyan-100":"border-white/12 bg-white/[0.03] text-transparent"),children:a.alreadyAdded?(0,D.jsx)(Z,{className:"h-3 w-3"}):(0,D.jsx)($,{className:"h-3 w-3"})}),(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate text-[13px] font-medium text-white",children:a.name}),(0,D.jsx)("p",{className:"mt-1 truncate text-[11px] uppercase tracking-[0.18em] text-slate-500",children:a.id}),(0,D.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 text-[11px] text-slate-400",children:[(0,D.jsx)("span",{children:a.input}),a.contextWindow?(0,D.jsxs)("span",{children:[Intl.NumberFormat().format(a.contextWindow)," ctx"]}):null,a.isFree?(0,D.jsx)("span",{children:"free"}):null]})]})]}),(0,D.jsx)("div",{className:"shrink-0",children:a.alreadyAdded?(0,D.jsx)(be,{variant:"muted",children:"Already added"}):a.recommended?(0,D.jsx)(be,{variant:"default",children:"Recommended"}):a.local?(0,D.jsx)(be,{variant:"success",children:"Local"}):(0,D.jsx)(be,{variant:"muted",children:"Remote"})})]},a.id)})})}ci.displayName=cd.displayName;let cm=K("sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]),cn=K("waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]),co=K("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),cp=K("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),cq={"openai-codex":cm,openrouter:cn,ollama:co,anthropic:cp,openai:K("cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]),xai:K("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]])};function cr({descriptor:a,active:b,compact:c=!1,connected:d=!1,detail:e,onClick:f}){let g=cq[a.id];return(0,D.jsxs)("button",{type:"button",onClick:f,className:bc("group w-full rounded-[24px] border text-left transition-all",c?"p-3.5":"p-4",b?"border-cyan-300/40 bg-[linear-gradient(180deg,rgba(23,32,52,0.98),rgba(11,18,31,0.98))] shadow-[0_18px_45px_rgba(10,16,28,0.26)]":"border-white/10 bg-[linear-gradient(180deg,rgba(15,23,42,0.92),rgba(10,15,28,0.92))] hover:border-white/18 hover:bg-[linear-gradient(180deg,rgba(20,29,49,0.96),rgba(12,18,31,0.96))]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsx)("div",{className:bc("flex items-center justify-center rounded-[18px] border",c?"h-9 w-9":"h-10 w-10",b?"border-cyan-300/25 bg-cyan-300/10 text-cyan-100":"border-white/10 bg-white/[0.04] text-slate-200"),children:(0,D.jsx)(g,{className:"h-4 w-4"})}),(0,D.jsx)(be,{variant:d?"success":b?"default":"muted",children:d?"Connected":b?"Selected":"Provider"})]}),(0,D.jsxs)("div",{className:c?"mt-3":"mt-4",children:[(0,D.jsx)("p",{className:bc("font-display text-white",c?"text-[0.92rem]":"text-[0.98rem]"),children:a.label}),(0,D.jsx)("p",{className:bc("mt-1.5 text-slate-300",c?"text-[11px] leading-5":"text-[12px] leading-5"),children:a.description}),(0,D.jsx)("p",{className:"mt-3 text-[10px] uppercase tracking-[0.18em] text-slate-500",children:e||a.helperText})]})]})}var cs="dismissableLayer.update",ct=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),cu=E.forwardRef((a,b)=>{let{disableOutsidePointerEvents:c=!1,onEscapeKeyDown:d,onPointerDownOutside:e,onFocusOutside:f,onInteractOutside:g,onDismiss:h,...i}=a,j=E.useContext(ct),[k,l]=E.useState(null),m=k?.ownerDocument??globalThis?.document,[,n]=E.useState({}),o=bh(b,a=>l(a)),p=Array.from(j.layers),[q]=[...j.layersWithOutsidePointerEventsDisabled].slice(-1),r=p.indexOf(q),s=k?p.indexOf(k):-1,t=j.layersWithOutsidePointerEventsDisabled.size>0,u=s>=r,v=function(a,b=globalThis?.document){let c=bG(a),d=E.useRef(!1),e=E.useRef(()=>{});return E.useEffect(()=>{let a=a=>{if(a.target&&!d.current){let d=function(){cw("dismissableLayer.pointerDownOutside",c,f,{discrete:!0})},f={originalEvent:a};"touch"===a.pointerType?(b.removeEventListener("click",e.current),e.current=d,b.addEventListener("click",e.current,{once:!0})):d()}else b.removeEventListener("click",e.current);d.current=!1},f=window.setTimeout(()=>{b.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(f),b.removeEventListener("pointerdown",a),b.removeEventListener("click",e.current)}},[b,c]),{onPointerDownCapture:()=>d.current=!0}}(a=>{let b=a.target,c=[...j.branches].some(a=>a.contains(b));u&&!c&&(e?.(a),g?.(a),a.defaultPrevented||h?.())},m),w=function(a,b=globalThis?.document){let c=bG(a),d=E.useRef(!1);return E.useEffect(()=>{let a=a=>{a.target&&!d.current&&cw("dismissableLayer.focusOutside",c,{originalEvent:a},{discrete:!1})};return b.addEventListener("focusin",a),()=>b.removeEventListener("focusin",a)},[b,c]),{onFocusCapture:()=>d.current=!0,onBlurCapture:()=>d.current=!1}}(a=>{let b=a.target;![...j.branches].some(a=>a.contains(b))&&(f?.(a),g?.(a),a.defaultPrevented||h?.())},m);return!function(a,b=globalThis?.document){let c=bG(a);E.useEffect(()=>{let a=a=>{"Escape"===a.key&&c(a)};return b.addEventListener("keydown",a,{capture:!0}),()=>b.removeEventListener("keydown",a,{capture:!0})},[c,b])}(a=>{s===j.layers.size-1&&(d?.(a),!a.defaultPrevented&&h&&(a.preventDefault(),h()))},m),E.useEffect(()=>{if(k)return c&&(0===j.layersWithOutsidePointerEventsDisabled.size&&(e7=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),j.layersWithOutsidePointerEventsDisabled.add(k)),j.layers.add(k),cv(),()=>{c&&1===j.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=e7)}},[k,m,c,j]),E.useEffect(()=>()=>{k&&(j.layers.delete(k),j.layersWithOutsidePointerEventsDisabled.delete(k),cv())},[k,j]),E.useEffect(()=>{let a=()=>n({});return document.addEventListener(cs,a),()=>document.removeEventListener(cs,a)},[]),(0,D.jsx)(bF.div,{...i,ref:o,style:{pointerEvents:t?u?"auto":"none":void 0,...a.style},onFocusCapture:bs(a.onFocusCapture,w.onFocusCapture),onBlurCapture:bs(a.onBlurCapture,w.onBlurCapture),onPointerDownCapture:bs(a.onPointerDownCapture,v.onPointerDownCapture)})});function cv(){let a=new CustomEvent(cs);document.dispatchEvent(a)}function cw(a,b,c,{discrete:d}){let e=c.originalEvent.target,f=new CustomEvent(a,{bubbles:!1,cancelable:!0,detail:c});if(b&&e.addEventListener(a,b,{once:!0}),d)e&&bE.flushSync(()=>e.dispatchEvent(f));else e.dispatchEvent(f)}cu.displayName="DismissableLayer",E.forwardRef((a,b)=>{let c=E.useContext(ct),d=E.useRef(null),e=bh(b,d);return E.useEffect(()=>{let a=d.current;if(a)return c.branches.add(a),()=>{c.branches.delete(a)}},[c.branches]),(0,D.jsx)(bF.div,{...a,ref:e})}).displayName="DismissableLayerBranch";var cx="focusScope.autoFocusOnMount",cy="focusScope.autoFocusOnUnmount",cz={bubbles:!1,cancelable:!0},cA=E.forwardRef((a,b)=>{let{loop:c=!1,trapped:d=!1,onMountAutoFocus:e,onUnmountAutoFocus:f,...g}=a,[h,i]=E.useState(null),j=bG(e),k=bG(f),l=E.useRef(null),m=bh(b,a=>i(a)),n=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(d){let a=function(a){if(n.paused||!h)return;let b=a.target;h.contains(b)?l.current=b:cD(l.current,{select:!0})},b=function(a){if(n.paused||!h)return;let b=a.relatedTarget;null!==b&&(h.contains(b)||cD(l.current,{select:!0}))};document.addEventListener("focusin",a),document.addEventListener("focusout",b);let c=new MutationObserver(function(a){if(document.activeElement===document.body)for(let b of a)b.removedNodes.length>0&&cD(h)});return h&&c.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",a),document.removeEventListener("focusout",b),c.disconnect()}}},[d,h,n.paused]),E.useEffect(()=>{if(h){cE.add(n);let a=document.activeElement;if(!h.contains(a)){let b=new CustomEvent(cx,cz);h.addEventListener(cx,j),h.dispatchEvent(b),b.defaultPrevented||(function(a,{select:b=!1}={}){let c=document.activeElement;for(let d of a)if(cD(d,{select:b}),document.activeElement!==c)return}(cB(h).filter(a=>"A"!==a.tagName),{select:!0}),document.activeElement===a&&cD(h))}return()=>{h.removeEventListener(cx,j),setTimeout(()=>{let b=new CustomEvent(cy,cz);h.addEventListener(cy,k),h.dispatchEvent(b),b.defaultPrevented||cD(a??document.body,{select:!0}),h.removeEventListener(cy,k),cE.remove(n)},0)}}},[h,j,k,n]);let o=E.useCallback(a=>{if(!c&&!d||n.paused)return;let b="Tab"===a.key&&!a.altKey&&!a.ctrlKey&&!a.metaKey,e=document.activeElement;if(b&&e){var f;let b,d=a.currentTarget,[g,h]=[cC(b=cB(f=d),f),cC(b.reverse(),f)];g&&h?a.shiftKey||e!==h?a.shiftKey&&e===g&&(a.preventDefault(),c&&cD(h,{select:!0})):(a.preventDefault(),c&&cD(g,{select:!0})):e===d&&a.preventDefault()}},[c,d,n.paused]);return(0,D.jsx)(bF.div,{tabIndex:-1,...g,ref:m,onKeyDown:o})});function cB(a){let b=[],c=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{let b="INPUT"===a.tagName&&"hidden"===a.type;return a.disabled||a.hidden||b?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;c.nextNode();)b.push(c.currentNode);return b}function cC(a,b){for(let c of a)if(!function(a,{upTo:b}){if("hidden"===getComputedStyle(a).visibility)return!0;for(;a&&(void 0===b||a!==b);){if("none"===getComputedStyle(a).display)return!0;a=a.parentElement}return!1}(c,{upTo:b}))return c}function cD(a,{select:b=!1}={}){if(a&&a.focus){var c;let d=document.activeElement;a.focus({preventScroll:!0}),a!==d&&(c=a)instanceof HTMLInputElement&&"select"in c&&b&&a.select()}}cA.displayName="FocusScope";var cE=(i=[],{add(a){let b=i[0];a!==b&&b?.pause(),(i=cF(i,a)).unshift(a)},remove(a){i=cF(i,a),i[0]?.resume()}});function cF(a,b){let c=[...a],d=c.indexOf(b);return -1!==d&&c.splice(d,1),c}var cG=E.forwardRef((a,b)=>{let{container:c,...d}=a,[e,f]=E.useState(!1);bA(()=>f(!0),[]);let g=c||e&&globalThis?.document?.body;return g?bE.createPortal((0,D.jsx)(bF.div,{...d,ref:b}),g):null});cG.displayName="Portal";var cH=0;function cI(){let a=document.createElement("span");return a.setAttribute("data-radix-focus-guard",""),a.tabIndex=0,a.style.outline="none",a.style.opacity="0",a.style.position="fixed",a.style.pointerEvents="none",a}var cJ=function(){return(cJ=Object.assign||function(a){for(var b,c=1,d=arguments.length;c<d;c++)for(var e in b=arguments[c])Object.prototype.hasOwnProperty.call(b,e)&&(a[e]=b[e]);return a}).apply(this,arguments)};function cK(a,b){var c={};for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&0>b.indexOf(d)&&(c[d]=a[d]);if(null!=a&&"function"==typeof Object.getOwnPropertySymbols)for(var e=0,d=Object.getOwnPropertySymbols(a);e<d.length;e++)0>b.indexOf(d[e])&&Object.prototype.propertyIsEnumerable.call(a,d[e])&&(c[d[e]]=a[d[e]]);return c}var cL=("function"==typeof SuppressedError&&SuppressedError,"right-scroll-bar-position"),cM="width-before-scroll-bar";function cN(a,b){return"function"==typeof a?a(b):a&&(a.current=b),a}var cO="u">typeof window?E.useLayoutEffect:E.useEffect,cP=new WeakMap,cQ=(void 0===e0&&(e0={}),(void 0===e1&&(e1=function(a){return a}),e2=[],e3=!1,e4={read:function(){if(e3)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return e2.length?e2[e2.length-1]:null},useMedium:function(a){var b=e1(a,e3);return e2.push(b),function(){e2=e2.filter(function(a){return a!==b})}},assignSyncMedium:function(a){for(e3=!0;e2.length;){var b=e2;e2=[],b.forEach(a)}e2={push:function(b){return a(b)},filter:function(){return e2}}},assignMedium:function(a){e3=!0;var b=[];if(e2.length){var c=e2;e2=[],c.forEach(a),b=e2}var d=function(){var c=b;b=[],c.forEach(a)},e=function(){return Promise.resolve().then(d)};e(),e2={push:function(a){b.push(a),e()},filter:function(a){return b=b.filter(a),e2}}}}).options=cJ({async:!0,ssr:!1},e0),e4),cR=function(){},cS=E.forwardRef(function(a,b){var c,d,e,f,g=E.useRef(null),h=E.useState({onScrollCapture:cR,onWheelCapture:cR,onTouchMoveCapture:cR}),i=h[0],j=h[1],k=a.forwardProps,l=a.children,m=a.className,n=a.removeScrollBar,o=a.enabled,p=a.shards,q=a.sideCar,r=a.noRelative,s=a.noIsolation,t=a.inert,u=a.allowPinchZoom,v=a.as,w=a.gapMode,x=cK(a,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),y=(c=[g,b],d=function(a){return c.forEach(function(b){return cN(b,a)})},(e=(0,E.useState)(function(){return{value:null,callback:d,facade:{get current(){return e.value},set current(value){var a=e.value;a!==value&&(e.value=value,e.callback(value,a))}}}})[0]).callback=d,f=e.facade,cO(function(){var a=cP.get(f);if(a){var b=new Set(a),d=new Set(c),e=f.current;b.forEach(function(a){d.has(a)||cN(a,null)}),d.forEach(function(a){b.has(a)||cN(a,e)})}cP.set(f,c)},[c]),f),z=cJ(cJ({},x),i);return E.createElement(E.Fragment,null,o&&E.createElement(q,{sideCar:cQ,removeScrollBar:n,shards:p,noRelative:r,noIsolation:s,inert:t,setCallbacks:j,allowPinchZoom:!!u,lockRef:g,gapMode:w}),k?E.cloneElement(E.Children.only(l),cJ(cJ({},z),{ref:y})):E.createElement(void 0===v?"div":v,cJ({},z,{className:m,ref:y}),l))});cS.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},cS.classNames={fullWidth:cM,zeroRight:cL};var cT=function(a){var b=a.sideCar,c=cK(a,["sideCar"]);if(!b)throw Error("Sidecar: please provide `sideCar` property to import the right car");var d=b.read();if(!d)throw Error("Sidecar medium not found");return E.createElement(d,cJ({},c))};cT.isSideCarExport=!0;var cU=function(){var a=0,b=null;return{add:function(d){if(0==a&&(b=function(){if(!document)return null;var a=document.createElement("style");a.type="text/css";var b=e8||c.nc;return b&&a.setAttribute("nonce",b),a}())){var e,f;(e=b).styleSheet?e.styleSheet.cssText=d:e.appendChild(document.createTextNode(d)),f=b,(document.head||document.getElementsByTagName("head")[0]).appendChild(f)}a++},remove:function(){--a||!b||(b.parentNode&&b.parentNode.removeChild(b),b=null)}}},cV=function(){var a=cU();return function(b,c){E.useEffect(function(){return a.add(b),function(){a.remove()}},[b&&c])}},cW=function(){var a=cV();return function(b){return a(b.styles,b.dynamic),null}},cX={left:0,top:0,right:0,gap:0},cY=function(a){return parseInt(a||"",10)||0},cZ=function(a){var b=window.getComputedStyle(document.body),c=b["padding"===a?"paddingLeft":"marginLeft"],d=b["padding"===a?"paddingTop":"marginTop"],e=b["padding"===a?"paddingRight":"marginRight"];return[cY(c),cY(d),cY(e)]},c$=function(a){if(void 0===a&&(a="margin"),"u"<typeof window)return cX;var b=cZ(a),c=document.documentElement.clientWidth,d=window.innerWidth;return{left:b[0],top:b[1],right:b[2],gap:Math.max(0,d-c+b[2]-b[0])}},c_=cW(),c0="data-scroll-locked",c1=function(a,b,c,d){var e=a.left,f=a.top,g=a.right,h=a.gap;return void 0===c&&(c="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(d,";\n padding-right: ").concat(h,"px ").concat(d,";\n }\n body[").concat(c0,"] {\n overflow: hidden ").concat(d,";\n overscroll-behavior: contain;\n ").concat([b&&"position: relative ".concat(d,";"),"margin"===c&&"\n padding-left: ".concat(e,"px;\n padding-top: ").concat(f,"px;\n padding-right: ").concat(g,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(h,"px ").concat(d,";\n "),"padding"===c&&"padding-right: ".concat(h,"px ").concat(d,";")].filter(Boolean).join(""),"\n }\n \n .").concat(cL," {\n right: ").concat(h,"px ").concat(d,";\n }\n \n .").concat(cM," {\n margin-right: ").concat(h,"px ").concat(d,";\n }\n \n .").concat(cL," .").concat(cL," {\n right: 0 ").concat(d,";\n }\n \n .").concat(cM," .").concat(cM," {\n margin-right: 0 ").concat(d,";\n }\n \n body[").concat(c0,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(h,"px;\n }\n")},c2=function(){var a=parseInt(document.body.getAttribute(c0)||"0",10);return isFinite(a)?a:0},c3=function(){E.useEffect(function(){return document.body.setAttribute(c0,(c2()+1).toString()),function(){var a=c2()-1;a<=0?document.body.removeAttribute(c0):document.body.setAttribute(c0,a.toString())}},[])},c4=function(a){var b=a.noRelative,c=a.noImportant,d=a.gapMode,e=void 0===d?"margin":d;c3();var f=E.useMemo(function(){return c$(e)},[e]);return E.createElement(c_,{styles:c1(f,!b,e,c?"":"!important")})},c5=!1;if("u">typeof window)try{var c6=Object.defineProperty({},"passive",{get:function(){return c5=!0,!0}});window.addEventListener("test",c6,c6),window.removeEventListener("test",c6,c6)}catch(a){c5=!1}var c7=!!c5&&{passive:!1},c8=function(a,b){if(!(a instanceof Element))return!1;var c=window.getComputedStyle(a);return"hidden"!==c[b]&&(c.overflowY!==c.overflowX||"TEXTAREA"===a.tagName||"visible"!==c[b])},c9=function(a,b){var c=b.ownerDocument,d=b;do{if("u">typeof ShadowRoot&&d instanceof ShadowRoot&&(d=d.host),da(a,d)){var e=db(a,d);if(e[1]>e[2])return!0}d=d.parentNode}while(d&&d!==c.body);return!1},da=function(a,b){return"v"===a?c8(b,"overflowY"):c8(b,"overflowX")},db=function(a,b){return"v"===a?[b.scrollTop,b.scrollHeight,b.clientHeight]:[b.scrollLeft,b.scrollWidth,b.clientWidth]},dc=function(a,b,c,d,e){var f,g=(f=window.getComputedStyle(b).direction,"h"===a&&"rtl"===f?-1:1),h=g*d,i=c.target,j=b.contains(i),k=!1,l=h>0,m=0,n=0;do{if(!i)break;var o=db(a,i),p=o[0],q=o[1]-o[2]-g*p;(p||q)&&da(a,i)&&(m+=q,n+=p);var r=i.parentNode;i=r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE?r.host:r}while(!j&&i!==document.body||j&&(b.contains(i)||b===i));return l&&(e&&1>Math.abs(m)||!e&&h>m)?k=!0:!l&&(e&&1>Math.abs(n)||!e&&-h>n)&&(k=!0),k},dd=function(a){return"changedTouches"in a?[a.changedTouches[0].clientX,a.changedTouches[0].clientY]:[0,0]},de=function(a){return[a.deltaX,a.deltaY]},df=function(a){return a&&"current"in a?a.current:a},dg=0,dh=[];let di=(e5=function(a){var b=E.useRef([]),c=E.useRef([0,0]),d=E.useRef(),e=E.useState(dg++)[0],f=E.useState(cW)[0],g=E.useRef(a);E.useEffect(function(){g.current=a},[a]),E.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(e));var b=(function(a,b,c){if(c||2==arguments.length)for(var d,e=0,f=b.length;e<f;e++)!d&&e in b||(d||(d=Array.prototype.slice.call(b,0,e)),d[e]=b[e]);return a.concat(d||Array.prototype.slice.call(b))})([a.lockRef.current],(a.shards||[]).map(df),!0).filter(Boolean);return b.forEach(function(a){return a.classList.add("allow-interactivity-".concat(e))}),function(){document.body.classList.remove("block-interactivity-".concat(e)),b.forEach(function(a){return a.classList.remove("allow-interactivity-".concat(e))})}}},[a.inert,a.lockRef.current,a.shards]);var h=E.useCallback(function(a,b){if("touches"in a&&2===a.touches.length||"wheel"===a.type&&a.ctrlKey)return!g.current.allowPinchZoom;var e,f=dd(a),h=c.current,i="deltaX"in a?a.deltaX:h[0]-f[0],j="deltaY"in a?a.deltaY:h[1]-f[1],k=a.target,l=Math.abs(i)>Math.abs(j)?"h":"v";if("touches"in a&&"h"===l&&"range"===k.type)return!1;var m=window.getSelection(),n=m&&m.anchorNode;if(n&&(n===k||n.contains(k)))return!1;var o=c9(l,k);if(!o)return!0;if(o?e=l:(e="v"===l?"h":"v",o=c9(l,k)),!o)return!1;if(!d.current&&"changedTouches"in a&&(i||j)&&(d.current=e),!e)return!0;var p=d.current||e;return dc(p,b,a,"h"===p?i:j,!0)},[]),i=E.useCallback(function(a){if(dh.length&&dh[dh.length-1]===f){var c="deltaY"in a?de(a):dd(a),d=b.current.filter(function(b){var d;return b.name===a.type&&(b.target===a.target||a.target===b.shadowParent)&&(d=b.delta,d[0]===c[0]&&d[1]===c[1])})[0];if(d&&d.should){a.cancelable&&a.preventDefault();return}if(!d){var e=(g.current.shards||[]).map(df).filter(Boolean).filter(function(b){return b.contains(a.target)});(e.length>0?h(a,e[0]):!g.current.noIsolation)&&a.cancelable&&a.preventDefault()}}},[]),j=E.useCallback(function(a,c,d,e){var f={name:a,delta:c,target:d,should:e,shadowParent:function(a){for(var b=null;null!==a;)a instanceof ShadowRoot&&(b=a.host,a=a.host),a=a.parentNode;return b}(d)};b.current.push(f),setTimeout(function(){b.current=b.current.filter(function(a){return a!==f})},1)},[]),k=E.useCallback(function(a){c.current=dd(a),d.current=void 0},[]),l=E.useCallback(function(b){j(b.type,de(b),b.target,h(b,a.lockRef.current))},[]),m=E.useCallback(function(b){j(b.type,dd(b),b.target,h(b,a.lockRef.current))},[]);E.useEffect(function(){return dh.push(f),a.setCallbacks({onScrollCapture:l,onWheelCapture:l,onTouchMoveCapture:m}),document.addEventListener("wheel",i,c7),document.addEventListener("touchmove",i,c7),document.addEventListener("touchstart",k,c7),function(){dh=dh.filter(function(a){return a!==f}),document.removeEventListener("wheel",i,c7),document.removeEventListener("touchmove",i,c7),document.removeEventListener("touchstart",k,c7)}},[]);var n=a.removeScrollBar,o=a.inert;return E.createElement(E.Fragment,null,o?E.createElement(f,{styles:"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")}):null,n?E.createElement(c4,{noRelative:a.noRelative,gapMode:a.gapMode}):null)},cQ.useMedium(e5),cT);var dj=E.forwardRef(function(a,b){return E.createElement(cS,cJ({},a,{ref:b,sideCar:di}))});dj.classNames=cS.classNames;var dk=new WeakMap,dl=new WeakMap,dm={},dn=0,dp=function(a){return a&&(a.host||dp(a.parentNode))},dq=function(a,b,c,d){var e=(Array.isArray(a)?a:[a]).map(function(a){if(b.contains(a))return a;var c=dp(a);return c&&b.contains(c)?c:(console.error("aria-hidden",a,"in not contained inside",b,". Doing nothing"),null)}).filter(function(a){return!!a});dm[c]||(dm[c]=new WeakMap);var f=dm[c],g=[],h=new Set,i=new Set(e),j=function(a){!a||h.has(a)||(h.add(a),j(a.parentNode))};e.forEach(j);var k=function(a){!a||i.has(a)||Array.prototype.forEach.call(a.children,function(a){if(h.has(a))k(a);else try{var b=a.getAttribute(d),e=null!==b&&"false"!==b,i=(dk.get(a)||0)+1,j=(f.get(a)||0)+1;dk.set(a,i),f.set(a,j),g.push(a),1===i&&e&&dl.set(a,!0),1===j&&a.setAttribute(c,"true"),e||a.setAttribute(d,"true")}catch(b){console.error("aria-hidden: cannot operate on ",a,b)}})};return k(b),h.clear(),dn++,function(){g.forEach(function(a){var b=dk.get(a)-1,e=f.get(a)-1;dk.set(a,b),f.set(a,e),b||(dl.has(a)||a.removeAttribute(d),dl.delete(a)),e||a.removeAttribute(c)}),--dn||(dk=new WeakMap,dk=new WeakMap,dl=new WeakMap,dm={})}},dr=function(a,b,c){void 0===c&&(c="data-aria-hidden");var d=Array.from(Array.isArray(a)?a:[a]),e=b||("u"<typeof document?null:(Array.isArray(a)?a[0]:a).ownerDocument.body);return e?(d.push.apply(d,Array.from(e.querySelectorAll("[aria-live], script"))),dq(d,e,c,"aria-hidden")):function(){return null}},ds="Dialog",[dt,du]=bt(ds),[dv,dw]=dt(ds),dx=a=>{let{__scopeDialog:b,children:c,open:d,defaultOpen:e,onOpenChange:f,modal:g=!0}=a,h=E.useRef(null),i=E.useRef(null),[j,k]=bI({prop:d,defaultProp:e??!1,onChange:f,caller:ds});return(0,D.jsx)(dv,{scope:b,triggerRef:h,contentRef:i,contentId:bD(),titleId:bD(),descriptionId:bD(),open:j,onOpenChange:k,onOpenToggle:E.useCallback(()=>k(a=>!a),[k]),modal:g,children:c})};dx.displayName=ds;var dy="DialogTrigger",dz=E.forwardRef((a,b)=>{let{__scopeDialog:c,...d}=a,e=dw(dy,c),f=bh(b,e.triggerRef);return(0,D.jsx)(bF.button,{type:"button","aria-haspopup":"dialog","aria-expanded":e.open,"aria-controls":e.contentId,"data-state":dT(e.open),...d,ref:f,onClick:bs(a.onClick,e.onOpenToggle)})});dz.displayName=dy;var dA="DialogPortal",[dB,dC]=dt(dA,{forceMount:void 0}),dD=a=>{let{__scopeDialog:b,forceMount:c,children:d,container:e}=a,f=dw(dA,b);return(0,D.jsx)(dB,{scope:b,forceMount:c,children:E.Children.map(d,a=>(0,D.jsx)(b_,{present:c||f.open,children:(0,D.jsx)(cG,{asChild:!0,container:e,children:a})}))})};dD.displayName=dA;var dE="DialogOverlay",dF=E.forwardRef((a,b)=>{let c=dC(dE,a.__scopeDialog),{forceMount:d=c.forceMount,...e}=a,f=dw(dE,a.__scopeDialog);return f.modal?(0,D.jsx)(b_,{present:d||f.open,children:(0,D.jsx)(dH,{...e,ref:b})}):null});dF.displayName=dE;var dG=bu("DialogOverlay.RemoveScroll"),dH=E.forwardRef((a,b)=>{let{__scopeDialog:c,...d}=a,e=dw(dE,c);return(0,D.jsx)(dj,{as:dG,allowPinchZoom:!0,shards:[e.contentRef],children:(0,D.jsx)(bF.div,{"data-state":dT(e.open),...d,ref:b,style:{pointerEvents:"auto",...d.style}})})}),dI="DialogContent",dJ=E.forwardRef((a,b)=>{let c=dC(dI,a.__scopeDialog),{forceMount:d=c.forceMount,...e}=a,f=dw(dI,a.__scopeDialog);return(0,D.jsx)(b_,{present:d||f.open,children:f.modal?(0,D.jsx)(dK,{...e,ref:b}):(0,D.jsx)(dL,{...e,ref:b})})});dJ.displayName=dI;var dK=E.forwardRef((a,b)=>{let c=dw(dI,a.__scopeDialog),d=E.useRef(null),e=bh(b,c.contentRef,d);return E.useEffect(()=>{let a=d.current;if(a)return dr(a)},[]),(0,D.jsx)(dM,{...a,ref:e,trapFocus:c.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:bs(a.onCloseAutoFocus,a=>{a.preventDefault(),c.triggerRef.current?.focus()}),onPointerDownOutside:bs(a.onPointerDownOutside,a=>{let b=a.detail.originalEvent,c=0===b.button&&!0===b.ctrlKey;(2===b.button||c)&&a.preventDefault()}),onFocusOutside:bs(a.onFocusOutside,a=>a.preventDefault())})}),dL=E.forwardRef((a,b)=>{let c=dw(dI,a.__scopeDialog),d=E.useRef(!1),e=E.useRef(!1);return(0,D.jsx)(dM,{...a,ref:b,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:b=>{a.onCloseAutoFocus?.(b),b.defaultPrevented||(d.current||c.triggerRef.current?.focus(),b.preventDefault()),d.current=!1,e.current=!1},onInteractOutside:b=>{a.onInteractOutside?.(b),b.defaultPrevented||(d.current=!0,"pointerdown"===b.detail.originalEvent.type&&(e.current=!0));let f=b.target;c.triggerRef.current?.contains(f)&&b.preventDefault(),"focusin"===b.detail.originalEvent.type&&e.current&&b.preventDefault()}})}),dM=E.forwardRef((a,b)=>{let{__scopeDialog:c,trapFocus:d,onOpenAutoFocus:e,onCloseAutoFocus:f,...g}=a,h=dw(dI,c),i=E.useRef(null),j=bh(b,i);return E.useEffect(()=>{let a=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",a[0]??cI()),document.body.insertAdjacentElement("beforeend",a[1]??cI()),cH++,()=>{1===cH&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),cH--}},[]),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(cA,{asChild:!0,loop:!0,trapped:d,onMountAutoFocus:e,onUnmountAutoFocus:f,children:(0,D.jsx)(cu,{role:"dialog",id:h.contentId,"aria-describedby":h.descriptionId,"aria-labelledby":h.titleId,"data-state":dT(h.open),...g,ref:j,onDismiss:()=>h.onOpenChange(!1)})}),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(dX,{titleId:h.titleId}),(0,D.jsx)(dY,{contentRef:i,descriptionId:h.descriptionId})]})]})}),dN="DialogTitle",dO=E.forwardRef((a,b)=>{let{__scopeDialog:c,...d}=a,e=dw(dN,c);return(0,D.jsx)(bF.h2,{id:e.titleId,...d,ref:b})});dO.displayName=dN;var dP="DialogDescription",dQ=E.forwardRef((a,b)=>{let{__scopeDialog:c,...d}=a,e=dw(dP,c);return(0,D.jsx)(bF.p,{id:e.descriptionId,...d,ref:b})});dQ.displayName=dP;var dR="DialogClose",dS=E.forwardRef((a,b)=>{let{__scopeDialog:c,...d}=a,e=dw(dR,c);return(0,D.jsx)(bF.button,{type:"button",...d,ref:b,onClick:bs(a.onClick,()=>e.onOpenChange(!1))})});function dT(a){return a?"open":"closed"}dS.displayName=dR;var dU="DialogTitleWarning",[dV,dW]=(e6={contentName:dI,titleName:dN,docsSlug:"dialog"},g=E.createContext(e6),(h=a=>{let{children:b,...c}=a,d=E.useMemo(()=>c,Object.values(c));return(0,D.jsx)(g.Provider,{value:d,children:b})}).displayName=dU+"Provider",[h,function(a){let b=E.useContext(g);if(b)return b;if(void 0!==e6)return e6;throw Error(`\`${a}\` must be used within \`${dU}\``)}]),dX=({titleId:a})=>{let b=dW(dU),c=`\`${b.contentName}\` requires a \`${b.titleName}\` for the component to be accessible for screen reader users.
2
2
 
3
3
  If you want to hide the \`${b.titleName}\`, you can wrap it with our VisuallyHidden component.
4
4
 
5
- For more information, see https://radix-ui.com/primitives/docs/components/${b.docsSlug}`;return E.useEffect(()=>{a&&(document.getElementById(a)||console.error(c))},[c,a]),null},dX=({contentRef:a,descriptionId:b})=>{let c=dV("DialogDescriptionWarning"),d=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${c.contentName}}.`;return E.useEffect(()=>{let c=a.current?.getAttribute("aria-describedby");b&&c&&(document.getElementById(b)||console.warn(d))},[d,a,b]),null};let dY=K("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),dZ=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)(dE,{ref:c,className:bb("fixed inset-0 z-50 bg-slate-950/75 backdrop-blur-md",a),...b}));dZ.displayName=dE.displayName;let d$=E.forwardRef(({className:a,children:b,...c},d)=>(0,D.jsxs)(dC,{children:[(0,D.jsx)(dZ,{}),(0,D.jsxs)(dI,{ref:d,className:bb("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-[28px] border border-white/10 bg-slate-950/90 p-6 shadow-panel backdrop-blur-xl duration-200",a),...c,children:[b,(0,D.jsxs)(dR,{className:"absolute right-4 top-4 rounded-full p-2 text-slate-400 transition-colors hover:bg-white/5 hover:text-white",children:[(0,D.jsx)(dY,{className:"h-4 w-4"}),(0,D.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));d$.displayName=dI.displayName;let d_=({className:a,...b})=>(0,D.jsx)("div",{className:bb("flex flex-col space-y-2 text-left",a),...b}),d0=({className:a,...b})=>(0,D.jsx)("div",{className:bb("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",a),...b}),d1=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)(dN,{ref:c,className:bb("font-display text-xl text-white",a),...b}));d1.displayName=dN.displayName;let d2=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)(dP,{ref:c,className:bb("text-sm text-slate-400",a),...b}));d2.displayName=dP.displayName;let d3=[{id:"openai-codex",label:"ChatGPT",shortLabel:"ChatGPT",description:"Connect your ChatGPT account and pull in Codex-ready models.",category:"primary",connectKind:"oauth",accent:"from-[#d8f5eb] via-[#ebfbf5] to-white",helperText:"Account-based login with the OpenClaw provider flow."},{id:"openrouter",label:"OpenRouter",shortLabel:"OpenRouter",description:"Add an API key, discover the full catalog, and curate the models you want.",category:"primary",connectKind:"apiKey",accent:"from-[#fff2d7] via-[#fff7ea] to-white",helperText:"Best for broad model access and curated remote routes.",searchPlaceholder:"Search OpenRouter models"},{id:"ollama",label:"Ollama Local",shortLabel:"Ollama",description:"Discover models already available on this machine and add them instantly.",category:"primary",connectKind:"local",accent:"from-[#deefff] via-[#f2f8ff] to-white",helperText:"Local-first discovery with helpful pull commands when empty."},{id:"anthropic",label:"Anthropic",shortLabel:"Anthropic",description:"Paste an API key and add Claude models through the same flow.",category:"other",connectKind:"apiKey",accent:"from-[#efe9ff] via-[#f7f3ff] to-white",helperText:"Simple API key connection."},{id:"openai",label:"OpenAI API",shortLabel:"OpenAI",description:"Connect a standard OpenAI API key for direct GPT model access.",category:"other",connectKind:"apiKey",accent:"from-[#e8f8e8] via-[#f4fbf4] to-white",helperText:"Use this for API-key-based OpenAI routing."},{id:"xai",label:"xAI",shortLabel:"xAI",description:"Use an xAI API key to bring Grok models into AgentOS.",category:"other",connectKind:"apiKey",accent:"from-[#ffe6ea] via-[#fff3f5] to-white",helperText:"Simple API key connection."}],d4=d3.filter(a=>"primary"===a.category),d5=d3.filter(a=>"other"===a.category);function d6(a){let b=d3.find(b=>b.id===a);if(!b)throw Error(`Unknown model provider: ${a}`);return b}async function d7(a){let b=await fetch("/api/models/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json().catch(()=>null);if(!b.ok||!c)throw Error(c?.error||c?.message||"Model provider request failed.");if(!c.ok&&c.message)throw Error(c.message);return c}let d8=Object.fromEntries(d3.map(a=>{var b;return[a.id,{id:b=a.id,descriptor:d6(b),getConnectionStatus:()=>d7({action:"status",provider:b}),connect:a=>d7({action:"connect",provider:b,apiKey:a?.apiKey?.trim()?a.apiKey.trim():void 0,endpoint:a?.endpoint?.trim()?a.endpoint.trim():void 0}),discoverModels:()=>d7({action:"discover",provider:b}),addModels:a=>d7({action:"add-models",provider:b,modelIds:a})}]}));var d9=c(9711);let ea=()=>({flowState:"idle",connection:null,statusMessage:null,errorMessage:null,emptyState:null,manualCommand:null,docsUrl:null,models:[],selectedModelIds:[],apiKey:"",search:"",loaded:!1});function eb({open:a,onOpenChange:b,snapshot:c,initialProvider:d=null,onSnapshotChange:e}){var f,g;let h,i,j,k,[l,m]=(0,E.useState)(d),[n,o]=(0,E.useState)(!1),[p,q]=(0,E.useState)({}),[r,s]=(0,E.useState)(!1);(0,E.useEffectEvent)(a=>{v(a)});let t=l&&p[l]||ea(),u=l?d6(l):null;async function v(a){if(m(a),"ollama"!==a){(p[a]||ea()).loaded||await w(a);return}await y(a,!0)}async function w(a){let b=d8[a];C(a,{flowState:"idle",errorMessage:null});try{let c=await b.getConnectionStatus();F(a,c,c.emptyState?"discovery-empty":"idle")}catch(b){C(a,{flowState:"auth-error",errorMessage:b instanceof Error?b.message:"Provider status could not be loaded.",loaded:!0})}}async function x(a){let b=d8[a],c=p[a]||ea();C(a,{flowState:"connecting",errorMessage:null,statusMessage:"openai-codex"===a?"Opening the ChatGPT connection flow...":`Connecting ${d6(a).shortLabel}...`});try{let d=await b.connect({apiKey:c.apiKey});F(a,d,"openai-codex"===a?"connecting":d.models.length?"discovery-success":"idle"),d.snapshot&&e(d.snapshot),"openai-codex"!==a&&"ollama"!==a&&await y(a)}catch(b){C(a,{flowState:"auth-error",errorMessage:b instanceof Error?b.message:"Provider connection failed."})}}async function y(a,b=!1){let c=d8[a],d=p[a]||ea();if(b||"discovery-loading"!==d.flowState){C(a,{flowState:"discovery-loading",errorMessage:null,statusMessage:"ollama"===a?"Checking the local Ollama runtime...":"Discovering available models..."});try{let b=await c.discoverModels();F(a,b,b.models.length>0?"discovery-success":b.emptyState?"discovery-empty":"idle"),b.snapshot&&e(b.snapshot)}catch(b){C(a,{flowState:"auth-error",errorMessage:b instanceof Error?b.message:"Model discovery failed."})}}}async function z(a){let b=d8[a],c=p[a]||ea(),d=c.selectedModelIds.filter(a=>!c.models.find(b=>b.id===a)?.alreadyAdded);if(0!==d.length){C(a,{flowState:"connecting",errorMessage:null,statusMessage:"Adding selected models..."});try{let c=await b.addModels(d);F(a,c,"add-success",{selectedModelIds:[]}),c.snapshot&&e(c.snapshot),d9.o.success("Models added.",{description:c.message})}catch(b){C(a,{flowState:"add-error",errorMessage:b instanceof Error?b.message:"Models could not be added."})}}}async function A(a){try{s(!0);let b=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:a})}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||"Terminal could not be opened.");d9.o.success("Terminal opened.",{description:"Finish the provider login there, then return here to discover models."})}catch(a){d9.o.error("Unable to open Terminal.",{description:a instanceof Error?a.message:"Unknown terminal error."})}finally{s(!1)}}async function B(a){try{await navigator.clipboard.writeText(a),d9.o.success("Copied.",{description:"Command copied to your clipboard."})}catch{d9.o.error("Copy failed.",{description:"Clipboard access is not available."})}}function C(a,b){q(c=>({...c,[a]:{...c[a]||ea(),...b}}))}function F(a,b,c,d){C(a,{flowState:c,connection:b.connection,statusMessage:b.message,errorMessage:null,emptyState:b.emptyState??null,manualCommand:b.manualCommand??null,docsUrl:b.docsUrl??null,models:b.models,loaded:!0,...d})}return(0,D.jsx)(dw,{open:a,onOpenChange:b,children:(0,D.jsxs)(d$,{className:"flex h-[88dvh] max-h-[88dvh] w-[calc(100vw-20px)] max-w-[940px] flex-col gap-0 overflow-hidden p-0 sm:h-[min(88dvh,860px)] sm:max-h-[min(88dvh,860px)] sm:w-[min(940px,calc(100vw-40px))]",children:[(0,D.jsxs)(d_,{className:"shrink-0 border-b border-white/10 bg-[linear-gradient(180deg,rgba(12,18,31,0.96),rgba(9,13,24,0.98))] px-6 py-5 pr-14",children:[(0,D.jsx)(d1,{className:"text-[1.35rem]",children:"Add Models"}),(0,D.jsx)(d2,{className:"max-w-[560px] text-[13px] leading-6 text-slate-400",children:"Connect a provider, discover available models, and add them in seconds."})]}),(0,D.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:(0,D.jsxs)("div",{className:"space-y-6 px-5 py-5 sm:px-6 sm:py-6",children:[(0,D.jsx)("div",{className:"grid gap-4 lg:grid-cols-3",children:d4.map(a=>(0,D.jsx)(cq,{descriptor:a,active:l===a.id,connected:ed(c,p,a.id).connected,detail:ed(c,p,a.id).detail,onClick:()=>{v(a.id)}},a.id))}),(0,D.jsxs)("div",{className:"rounded-[28px] border border-white/10 bg-[linear-gradient(180deg,rgba(13,20,34,0.94),rgba(9,13,24,0.96))]",children:[(0,D.jsxs)("button",{type:"button",onClick:()=>o(a=>!a),className:"flex w-full items-center justify-between gap-3 px-4 py-3.5 text-left",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"font-display text-[0.95rem] text-white",children:"Other providers"}),(0,D.jsx)("p",{className:"mt-1 text-[11px] leading-5 text-slate-400",children:"Simpler API-key setup for additional provider routes."})]}),(0,D.jsx)(T,{className:bb("h-4 w-4 text-slate-400 transition-transform",n?"rotate-180":"rotate-0")})]}),n?(0,D.jsx)("div",{className:"grid gap-3 border-t border-white/10 px-4 py-4 md:grid-cols-2 xl:grid-cols-3",children:d5.map(a=>(0,D.jsx)(cq,{descriptor:a,active:l===a.id,compact:!0,connected:ed(c,p,a.id).connected,detail:ed(c,p,a.id).detail,onClick:()=>{v(a.id)}},a.id))}):null]}),(0,D.jsx)("div",{className:"rounded-[28px] border border-white/10 bg-[linear-gradient(180deg,rgba(11,18,32,0.96),rgba(6,10,18,0.98))] p-4 sm:p-5",children:l&&u?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"font-display text-[1rem] text-white",children:u.label}),(0,D.jsx)("p",{className:"mt-1 max-w-[620px] text-[12px] leading-6 text-slate-400",children:"oauth"===u.connectKind?"Use your account login, then discover the models that are ready to add.":"local"===u.connectKind?"Check the local runtime first, then add the models already available on this machine.":"Connect the provider, review the discovered catalog, and add only the models you want."})]}),(0,D.jsx)(bd,{variant:t.connection?.connected?"success":"muted",children:t.connection?.connected?"Connected":"Not connected"})]}),(0,D.jsx)("div",{className:"mt-5 flex flex-wrap gap-2",children:(f=l,g=t,h="ollama"===f?!!(g.connection?.connected||g.emptyState):!!(g.connection?.connected||g.manualCommand),i=g.models.length>0||!!g.emptyState,j=g.selectedModelIds.length>0,k="add-success"===g.flowState,[{label:"Choose provider",status:"done"},{label:"ollama"===f?"Local check":"Connect",status:"connecting"!==g.flowState||h?h?"done":"pending":"active"},{label:"Discover",status:"discovery-loading"===g.flowState?"active":i?"done":"pending"},{label:"Select",status:k?"done":j?"active":"pending"},{label:"Add",status:k?"done":"add-error"===g.flowState?"active":"pending"}]).map(a=>(0,D.jsxs)("div",{className:bb("inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-[11px] uppercase tracking-[0.18em]","done"===a.status?"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":"active"===a.status?"border-cyan-300/20 bg-cyan-300/10 text-cyan-100":"border-white/10 bg-white/[0.03] text-slate-500"),children:[(0,D.jsx)("span",{className:bb("h-2 w-2 rounded-full","done"===a.status?"bg-emerald-300":"active"===a.status?"bg-cyan-300":"bg-slate-600")}),a.label]},a.label))}),t.statusMessage?(0,D.jsx)("div",{className:"mt-5 rounded-[22px] border border-white/10 bg-white/[0.04] px-4 py-3",children:(0,D.jsx)("p",{className:"text-[13px] text-slate-200",children:t.statusMessage})}):null,t.errorMessage?(0,D.jsx)("div",{className:"mt-4 rounded-[22px] border border-rose-400/20 bg-rose-400/[0.08] px-4 py-3 text-[13px] text-rose-100",children:t.errorMessage}):null,"openai-codex"===l?(0,D.jsxs)("div",{className:"mt-6 rounded-[28px] border border-white/10 bg-white/[0.03] p-5",children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"font-display text-[1rem] text-white",children:"Connect your ChatGPT account"}),(0,D.jsx)("p",{className:"mt-1 max-w-[560px] text-[13px] leading-6 text-slate-400",children:"This uses OpenClaw's account-based login flow. No API key is required."})]}),(0,D.jsx)(bp,{type:"button",className:"h-10 rounded-full px-5",disabled:"connecting"===t.flowState&&!t.manualCommand,onClick:()=>{x(l)},children:"connecting"!==t.flowState||t.manualCommand?"Connect ChatGPT":(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{className:"mr-2 h-4 w-4 animate-spin"}),"Connecting..."]})})]}),t.manualCommand?(0,D.jsxs)("div",{className:"mt-5 rounded-[22px] border border-cyan-300/15 bg-cyan-300/[0.07] p-4",children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-[13px] font-medium text-cyan-50",children:"Finish sign-in in Terminal"}),(0,D.jsx)("p",{className:"mt-1 max-w-[560px] text-[12px] leading-6 text-cyan-100/80",children:"Open Terminal, complete the provider login, then return here and check discovery."})]}),(0,D.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,D.jsx)(bp,{type:"button",variant:"secondary",size:"sm",className:"h-9 rounded-full px-3",disabled:r,onClick:()=>{A(t.manualCommand||"")},children:r?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Opening..."]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(U,{className:"mr-1.5 h-3.5 w-3.5"}),"Open Terminal"]})}),(0,D.jsxs)(bp,{type:"button",variant:"ghost",size:"sm",className:"h-9 rounded-full px-3",onClick:()=>{B(t.manualCommand||"")},children:[(0,D.jsx)(V,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy command"]}),(0,D.jsxs)(bp,{type:"button",variant:"ghost",size:"sm",className:"h-9 rounded-full px-3",onClick:()=>{y(l)},children:[(0,D.jsx)(S,{className:"mr-1.5 h-3.5 w-3.5"}),"I've connected it"]})]})]}),(0,D.jsx)("div",{className:"mt-4 overflow-x-auto rounded-[18px] border border-white/10 bg-slate-950/60 px-4 py-3",children:(0,D.jsx)("code",{className:"text-[12px] text-slate-200",children:t.manualCommand})})]}):null]}):null,"apiKey"===u.connectKind?(0,D.jsx)("div",{className:"mt-6 rounded-[28px] border border-white/10 bg-white/[0.03] p-5",children:(0,D.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("label",{className:"block text-[11px] uppercase tracking-[0.18em] text-slate-500",children:"API key"}),(0,D.jsx)(bq,{type:"password",value:t.apiKey,onChange:a=>C(l,{apiKey:a.target.value}),placeholder:"openrouter"===l?"sk-or-v1-...":"Paste API key",className:"mt-2"})]}),(0,D.jsx)(bp,{type:"button",className:"h-11 rounded-full px-5",disabled:"connecting"===t.flowState||!t.apiKey.trim(),onClick:()=>{x(l)},children:"connecting"===t.flowState?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{className:"mr-2 h-4 w-4 animate-spin"}),"Connecting..."]}):`Connect ${u.shortLabel}`})]})}):null,"oauth"!==u.connectKind?(0,D.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,D.jsx)(bp,{type:"button",variant:"secondary",size:"sm",className:"h-9 rounded-full px-4",disabled:"discovery-loading"===t.flowState,onClick:()=>{y(l)},children:"discovery-loading"===t.flowState?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Discovering..."]}):"Discover models"}),(0,D.jsx)(bp,{type:"button",variant:"ghost",size:"sm",className:"h-9 rounded-full px-4",onClick:()=>{w(l)},children:"Refresh status"})]}):null,t.emptyState?(0,D.jsx)(ec,{emptyState:t.emptyState,onCopyCommand:a=>{B(a)}}):null,t.models.length>0?(0,D.jsx)("div",{className:"mt-6",children:(0,D.jsx)(cj,{provider:l,models:t.models,selectedModelIds:t.selectedModelIds,search:t.search,onSearchChange:a=>C(l,{search:a}),onToggleModel:a=>{C(l,{selectedModelIds:t.selectedModelIds.includes(a)?t.selectedModelIds.filter(b=>b!==a):[...t.selectedModelIds,a]})},onAddSelected:()=>{z(l)},isAdding:"connecting"===t.flowState&&"Adding selected models..."===t.statusMessage})}):null,"add-success"===t.flowState?(0,D.jsxs)("div",{className:"mt-5 flex items-center gap-3 rounded-[22px] border border-emerald-300/20 bg-emerald-300/[0.08] px-4 py-3",children:[(0,D.jsx)(W,{className:"h-4 w-4 text-emerald-200"}),(0,D.jsx)("p",{className:"text-[13px] text-emerald-50",children:t.statusMessage||"Models were added successfully."})]}):null,t.docsUrl?(0,D.jsx)("a",{href:t.docsUrl,target:"_blank",rel:"noreferrer",className:"mt-5 inline-flex text-[12px] text-slate-300 underline underline-offset-4",children:"OpenClaw model docs"}):null]}):(0,D.jsx)("div",{className:"flex min-h-[240px] items-center justify-center rounded-[24px] border border-dashed border-white/10 bg-white/[0.02] px-6 py-8 text-center",children:(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"font-display text-[1.05rem] text-white",children:"Choose a provider to begin"}),(0,D.jsx)("p",{className:"mt-2 max-w-[420px] text-[13px] leading-6 text-slate-400",children:"Start with ChatGPT, OpenRouter, or Ollama Local. The flow will guide you through connect, discovery, selection, and add."})]})})})]})})]})})}function ec({emptyState:a,onCopyCommand:b}){return(0,D.jsxs)("div",{className:"mt-5 rounded-[28px] border border-white/10 bg-white/[0.03] p-5",children:[(0,D.jsx)("p",{className:"font-display text-[1rem] text-white",children:a.title}),(0,D.jsx)("p",{className:"mt-1 max-w-[620px] text-[13px] leading-6 text-slate-400",children:a.description}),a.commands?.length?(0,D.jsx)("div",{className:"mt-4 space-y-2",children:a.commands.map(a=>(0,D.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-[18px] border border-white/10 bg-slate-950/60 px-4 py-3",children:[(0,D.jsx)("code",{className:"text-[12px] text-slate-200",children:a}),(0,D.jsxs)(bp,{type:"button",size:"sm",variant:"ghost",className:"h-8 rounded-full px-3",onClick:()=>b(a),children:[(0,D.jsx)(V,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy"]})]},a))}):null]})}function ed(a,b,c){let d=b[c]?.connection;if(d)return d;let e=a.diagnostics.modelReadiness.authProviders.find(a=>a.provider===c),f=a.models.filter(a=>a.id.startsWith(`${c}/`)).length;return"ollama"===c?{provider:c,connected:f>0,canConnect:!0,needsTerminal:!1,detail:f>0?`${f} model${1===f?"":"s"} already visible in AgentOS.`:"Detect local models from this machine."}:{provider:c,connected:!!(e?.connected||f>0),canConnect:!0,needsTerminal:"openai-codex"===c,detail:e?.detail||d6(c).helperText}}function ee(a){if("string"==typeof a||"number"==typeof a)return""+a;let b="";if(Array.isArray(a))for(let c=0,d;c<a.length;c++)""!==(d=ee(a[c]))&&(b+=(b&&" ")+d);else for(let c in a)a[c]&&(b+=(b&&" ")+c);return b}var ef={value:()=>{}};function eg(){for(var a,b=0,c=arguments.length,d={};b<c;++b){if(!(a=arguments[b]+"")||a in d||/[\s.]/.test(a))throw Error("illegal type: "+a);d[a]=[]}return new eh(d)}function eh(a){this._=a}function ei(a,b,c){for(var d=0,e=a.length;d<e;++d)if(a[d].name===b){a[d]=ef,a=a.slice(0,d).concat(a.slice(d+1));break}return null!=c&&a.push({name:b,value:c}),a}function ej(){}function ek(a){return null==a?ej:function(){return this.querySelector(a)}}function el(){return[]}function em(a){return null==a?el:function(){return this.querySelectorAll(a)}}function en(a){return function(){return this.matches(a)}}function eo(a){return function(b){return b.matches(a)}}eh.prototype=eg.prototype={constructor:eh,on:function(a,b){var c,d=this._,e=(a+"").trim().split(/^|\s+/).map(function(a){var b="",c=a.indexOf(".");if(c>=0&&(b=a.slice(c+1),a=a.slice(0,c)),a&&!d.hasOwnProperty(a))throw Error("unknown type: "+a);return{type:a,name:b}}),f=-1,g=e.length;if(arguments.length<2){for(;++f<g;)if((c=(a=e[f]).type)&&(c=function(a,b){for(var c,d=0,e=a.length;d<e;++d)if((c=a[d]).name===b)return c.value}(d[c],a.name)))return c;return}if(null!=b&&"function"!=typeof b)throw Error("invalid callback: "+b);for(;++f<g;)if(c=(a=e[f]).type)d[c]=ei(d[c],a.name,b);else if(null==b)for(c in d)d[c]=ei(d[c],a.name,null);return this},copy:function(){var a={},b=this._;for(var c in b)a[c]=b[c].slice();return new eh(a)},call:function(a,b){if((c=arguments.length-2)>0)for(var c,d,e=Array(c),f=0;f<c;++f)e[f]=arguments[f+2];if(!this._.hasOwnProperty(a))throw Error("unknown type: "+a);for(d=this._[a],f=0,c=d.length;f<c;++f)d[f].value.apply(b,e)},apply:function(a,b,c){if(!this._.hasOwnProperty(a))throw Error("unknown type: "+a);for(var d=this._[a],e=0,f=d.length;e<f;++e)d[e].value.apply(b,c)}};var ep=Array.prototype.find;function eq(){return this.firstElementChild}var er=Array.prototype.filter;function es(){return Array.from(this.children)}function et(a){return Array(a.length)}function eu(a,b){this.ownerDocument=a.ownerDocument,this.namespaceURI=a.namespaceURI,this._next=null,this._parent=a,this.__data__=b}function ev(a,b,c,d,e,f){for(var g,h=0,i=b.length,j=f.length;h<j;++h)(g=b[h])?(g.__data__=f[h],d[h]=g):c[h]=new eu(a,f[h]);for(;h<i;++h)(g=b[h])&&(e[h]=g)}function ew(a,b,c,d,e,f,g){var h,i,j,k=new Map,l=b.length,m=f.length,n=Array(l);for(h=0;h<l;++h)(i=b[h])&&(n[h]=j=g.call(i,i.__data__,h,b)+"",k.has(j)?e[h]=i:k.set(j,i));for(h=0;h<m;++h)j=g.call(a,f[h],h,f)+"",(i=k.get(j))?(d[h]=i,i.__data__=f[h],k.delete(j)):c[h]=new eu(a,f[h]);for(h=0;h<l;++h)(i=b[h])&&k.get(n[h])===i&&(e[h]=i)}function ex(a){return a.__data__}function ey(a,b){return a<b?-1:a>b?1:a>=b?0:NaN}eu.prototype={constructor:eu,appendChild:function(a){return this._parent.insertBefore(a,this._next)},insertBefore:function(a,b){return this._parent.insertBefore(a,b)},querySelector:function(a){return this._parent.querySelector(a)},querySelectorAll:function(a){return this._parent.querySelectorAll(a)}};var ez="http://www.w3.org/1999/xhtml";let eA={svg:"http://www.w3.org/2000/svg",xhtml:ez,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function eB(a){var b=a+="",c=b.indexOf(":");return c>=0&&"xmlns"!==(b=a.slice(0,c))&&(a=a.slice(c+1)),eA.hasOwnProperty(b)?{space:eA[b],local:a}:a}function eC(a){return a.ownerDocument&&a.ownerDocument.defaultView||a.document&&a||a.defaultView}function eD(a,b){return a.style.getPropertyValue(b)||eC(a).getComputedStyle(a,null).getPropertyValue(b)}function eE(a){return a.trim().split(/^|\s+/)}function eF(a){return a.classList||new eG(a)}function eG(a){this._node=a,this._names=eE(a.getAttribute("class")||"")}function eH(a,b){for(var c=eF(a),d=-1,e=b.length;++d<e;)c.add(b[d])}function eI(a,b){for(var c=eF(a),d=-1,e=b.length;++d<e;)c.remove(b[d])}function eJ(){this.textContent=""}function eK(){this.innerHTML=""}function eL(){this.nextSibling&&this.parentNode.appendChild(this)}function eM(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function eN(a){var b=eB(a);return(b.local?function(a){return function(){return this.ownerDocument.createElementNS(a.space,a.local)}}:function(a){return function(){var b=this.ownerDocument,c=this.namespaceURI;return c===ez&&b.documentElement.namespaceURI===ez?b.createElement(a):b.createElementNS(c,a)}})(b)}function eO(){return null}function eP(){var a=this.parentNode;a&&a.removeChild(this)}function eQ(){var a=this.cloneNode(!1),b=this.parentNode;return b?b.insertBefore(a,this.nextSibling):a}function eR(){var a=this.cloneNode(!0),b=this.parentNode;return b?b.insertBefore(a,this.nextSibling):a}function eS(a){return function(){var b=this.__on;if(b){for(var c,d=0,e=-1,f=b.length;d<f;++d)(c=b[d],a.type&&c.type!==a.type||c.name!==a.name)?b[++e]=c:this.removeEventListener(c.type,c.listener,c.options);++e?b.length=e:delete this.__on}}}function eT(a,b,c){return function(){var d,e=this.__on,f=function(a){b.call(this,a,this.__data__)};if(e){for(var g=0,h=e.length;g<h;++g)if((d=e[g]).type===a.type&&d.name===a.name){this.removeEventListener(d.type,d.listener,d.options),this.addEventListener(d.type,d.listener=f,d.options=c),d.value=b;return}}this.addEventListener(a.type,f,c),d={type:a.type,name:a.name,value:b,listener:f,options:c},e?e.push(d):this.__on=[d]}}function eU(a,b,c){var d=eC(a),e=d.CustomEvent;"function"==typeof e?e=new e(b,c):(e=d.document.createEvent("Event"),c?(e.initEvent(b,c.bubbles,c.cancelable),e.detail=c.detail):e.initEvent(b,!1,!1)),a.dispatchEvent(e)}eG.prototype={add:function(a){0>this._names.indexOf(a)&&(this._names.push(a),this._node.setAttribute("class",this._names.join(" ")))},remove:function(a){var b=this._names.indexOf(a);b>=0&&(this._names.splice(b,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(a){return this._names.indexOf(a)>=0}};var eV=[null];function eW(a,b){this._groups=a,this._parents=b}function eX(){return new eW([[document.documentElement]],eV)}function eY(a){return((a=Math.exp(a))+1/a)/2}eW.prototype=eX.prototype={constructor:eW,select:function(a){"function"!=typeof a&&(a=ek(a));for(var b=this._groups,c=b.length,d=Array(c),e=0;e<c;++e)for(var f,g,h=b[e],i=h.length,j=d[e]=Array(i),k=0;k<i;++k)(f=h[k])&&(g=a.call(f,f.__data__,k,h))&&("__data__"in f&&(g.__data__=f.__data__),j[k]=g);return new eW(d,this._parents)},selectAll:function(a){if("function"==typeof a){var b;b=a,a=function(){var a;return a=b.apply(this,arguments),null==a?[]:Array.isArray(a)?a:Array.from(a)}}else a=em(a);for(var c=this._groups,d=c.length,e=[],f=[],g=0;g<d;++g)for(var h,i=c[g],j=i.length,k=0;k<j;++k)(h=i[k])&&(e.push(a.call(h,h.__data__,k,i)),f.push(h));return new eW(e,f)},selectChild:function(a){var b;return this.select(null==a?eq:(b="function"==typeof a?a:eo(a),function(){return ep.call(this.children,b)}))},selectChildren:function(a){var b;return this.selectAll(null==a?es:(b="function"==typeof a?a:eo(a),function(){return er.call(this.children,b)}))},filter:function(a){"function"!=typeof a&&(a=en(a));for(var b=this._groups,c=b.length,d=Array(c),e=0;e<c;++e)for(var f,g=b[e],h=g.length,i=d[e]=[],j=0;j<h;++j)(f=g[j])&&a.call(f,f.__data__,j,g)&&i.push(f);return new eW(d,this._parents)},data:function(a,b){if(!arguments.length)return Array.from(this,ex);var c=b?ew:ev,d=this._parents,e=this._groups;"function"!=typeof a&&(s=a,a=function(){return s});for(var f=e.length,g=Array(f),h=Array(f),i=Array(f),j=0;j<f;++j){var k=d[j],l=e[j],m=l.length,n="object"==typeof(r=a.call(k,k&&k.__data__,j,d))&&"length"in r?r:Array.from(r),o=n.length,p=h[j]=Array(o),q=g[j]=Array(o);c(k,l,p,q,i[j]=Array(m),n,b);for(var r,s,t,u,v=0,w=0;v<o;++v)if(t=p[v]){for(v>=w&&(w=v+1);!(u=q[w])&&++w<o;);t._next=u||null}}return(g=new eW(g,d))._enter=h,g._exit=i,g},enter:function(){return new eW(this._enter||this._groups.map(et),this._parents)},exit:function(){return new eW(this._exit||this._groups.map(et),this._parents)},join:function(a,b,c){var d=this.enter(),e=this,f=this.exit();return"function"==typeof a?(d=a(d))&&(d=d.selection()):d=d.append(a+""),null!=b&&(e=b(e))&&(e=e.selection()),null==c?f.remove():c(f),d&&e?d.merge(e).order():e},merge:function(a){for(var b=a.selection?a.selection():a,c=this._groups,d=b._groups,e=c.length,f=d.length,g=Math.min(e,f),h=Array(e),i=0;i<g;++i)for(var j,k=c[i],l=d[i],m=k.length,n=h[i]=Array(m),o=0;o<m;++o)(j=k[o]||l[o])&&(n[o]=j);for(;i<e;++i)h[i]=c[i];return new eW(h,this._parents)},selection:function(){return this},order:function(){for(var a=this._groups,b=-1,c=a.length;++b<c;)for(var d,e=a[b],f=e.length-1,g=e[f];--f>=0;)(d=e[f])&&(g&&4^d.compareDocumentPosition(g)&&g.parentNode.insertBefore(d,g),g=d);return this},sort:function(a){function b(b,c){return b&&c?a(b.__data__,c.__data__):!b-!c}a||(a=ey);for(var c=this._groups,d=c.length,e=Array(d),f=0;f<d;++f){for(var g,h=c[f],i=h.length,j=e[f]=Array(i),k=0;k<i;++k)(g=h[k])&&(j[k]=g);j.sort(b)}return new eW(e,this._parents).order()},call:function(){var a=arguments[0];return arguments[0]=this,a.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var a=this._groups,b=0,c=a.length;b<c;++b)for(var d=a[b],e=0,f=d.length;e<f;++e){var g=d[e];if(g)return g}return null},size:function(){let a=0;for(let b of this)++a;return a},empty:function(){return!this.node()},each:function(a){for(var b=this._groups,c=0,d=b.length;c<d;++c)for(var e,f=b[c],g=0,h=f.length;g<h;++g)(e=f[g])&&a.call(e,e.__data__,g,f);return this},attr:function(a,b){var c=eB(a);if(arguments.length<2){var d=this.node();return c.local?d.getAttributeNS(c.space,c.local):d.getAttribute(c)}return this.each((null==b?c.local?function(a){return function(){this.removeAttributeNS(a.space,a.local)}}:function(a){return function(){this.removeAttribute(a)}}:"function"==typeof b?c.local?function(a,b){return function(){var c=b.apply(this,arguments);null==c?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}}:function(a,b){return function(){var c=b.apply(this,arguments);null==c?this.removeAttribute(a):this.setAttribute(a,c)}}:c.local?function(a,b){return function(){this.setAttributeNS(a.space,a.local,b)}}:function(a,b){return function(){this.setAttribute(a,b)}})(c,b))},style:function(a,b,c){return arguments.length>1?this.each((null==b?function(a){return function(){this.style.removeProperty(a)}}:"function"==typeof b?function(a,b,c){return function(){var d=b.apply(this,arguments);null==d?this.style.removeProperty(a):this.style.setProperty(a,d,c)}}:function(a,b,c){return function(){this.style.setProperty(a,b,c)}})(a,b,null==c?"":c)):eD(this.node(),a)},property:function(a,b){return arguments.length>1?this.each((null==b?function(a){return function(){delete this[a]}}:"function"==typeof b?function(a,b){return function(){var c=b.apply(this,arguments);null==c?delete this[a]:this[a]=c}}:function(a,b){return function(){this[a]=b}})(a,b)):this.node()[a]},classed:function(a,b){var c=eE(a+"");if(arguments.length<2){for(var d=eF(this.node()),e=-1,f=c.length;++e<f;)if(!d.contains(c[e]))return!1;return!0}return this.each(("function"==typeof b?function(a,b){return function(){(b.apply(this,arguments)?eH:eI)(this,a)}}:b?function(a){return function(){eH(this,a)}}:function(a){return function(){eI(this,a)}})(c,b))},text:function(a){return arguments.length?this.each(null==a?eJ:("function"==typeof a?function(a){return function(){var b=a.apply(this,arguments);this.textContent=null==b?"":b}}:function(a){return function(){this.textContent=a}})(a)):this.node().textContent},html:function(a){return arguments.length?this.each(null==a?eK:("function"==typeof a?function(a){return function(){var b=a.apply(this,arguments);this.innerHTML=null==b?"":b}}:function(a){return function(){this.innerHTML=a}})(a)):this.node().innerHTML},raise:function(){return this.each(eL)},lower:function(){return this.each(eM)},append:function(a){var b="function"==typeof a?a:eN(a);return this.select(function(){return this.appendChild(b.apply(this,arguments))})},insert:function(a,b){var c="function"==typeof a?a:eN(a),d=null==b?eO:"function"==typeof b?b:ek(b);return this.select(function(){return this.insertBefore(c.apply(this,arguments),d.apply(this,arguments)||null)})},remove:function(){return this.each(eP)},clone:function(a){return this.select(a?eR:eQ)},datum:function(a){return arguments.length?this.property("__data__",a):this.node().__data__},on:function(a,b,c){var d,e,f=(a+"").trim().split(/^|\s+/).map(function(a){var b="",c=a.indexOf(".");return c>=0&&(b=a.slice(c+1),a=a.slice(0,c)),{type:a,name:b}}),g=f.length;if(arguments.length<2){var h=this.node().__on;if(h){for(var i,j=0,k=h.length;j<k;++j)for(d=0,i=h[j];d<g;++d)if((e=f[d]).type===i.type&&e.name===i.name)return i.value}return}for(d=0,h=b?eT:eS;d<g;++d)this.each(h(f[d],b,c));return this},dispatch:function(a,b){return this.each(("function"==typeof b?function(a,b){return function(){return eU(this,a,b.apply(this,arguments))}}:function(a,b){return function(){return eU(this,a,b)}})(a,b))},[Symbol.iterator]:function*(){for(var a=this._groups,b=0,c=a.length;b<c;++b)for(var d,e=a[b],f=0,g=e.length;f<g;++f)(d=e[f])&&(yield d)}},(function(a,{sourceEvent:b,subject:c,target:d,identifier:e,active:f,x:g,y:h,dx:i,dy:j,dispatch:k}){Object.defineProperties(this,{type:{value:a,enumerable:!0,configurable:!0},sourceEvent:{value:b,enumerable:!0,configurable:!0},subject:{value:c,enumerable:!0,configurable:!0},target:{value:d,enumerable:!0,configurable:!0},identifier:{value:e,enumerable:!0,configurable:!0},active:{value:f,enumerable:!0,configurable:!0},x:{value:g,enumerable:!0,configurable:!0},y:{value:h,enumerable:!0,configurable:!0},dx:{value:i,enumerable:!0,configurable:!0},dy:{value:j,enumerable:!0,configurable:!0},_:{value:k}})}).prototype.on=function(){var a=this._.on.apply(this._,arguments);return a===this._?this:a},!function a(b,c,d){function e(a,e){var f,g,h=a[0],i=a[1],j=a[2],k=e[0],l=e[1],m=e[2],n=k-h,o=l-i,p=n*n+o*o;if(p<1e-12)g=Math.log(m/j)/b,f=function(a){return[h+a*n,i+a*o,j*Math.exp(b*a*g)]};else{var q=Math.sqrt(p),r=(m*m-j*j+d*p)/(2*j*c*q),s=(m*m-j*j-d*p)/(2*m*c*q),t=Math.log(Math.sqrt(r*r+1)-r);g=(Math.log(Math.sqrt(s*s+1)-s)-t)/b,f=function(a){var d,e,f=a*g,k=eY(t),l=j/(c*q)*(k*(((d=Math.exp(2*(d=b*f+t)))-1)/(d+1))-((e=Math.exp(e=t))-1/e)/2);return[h+l*n,i+l*o,j*k/eY(b*f+t)]}}return f.duration=1e3*g*b/Math.SQRT2,f}return e.rho=function(b){var c=Math.max(.001,+b),d=c*c;return a(c,d,d*d)},e}(Math.SQRT2,2,4);var eZ,e$,e_,e0,e1,e2,e3,e4,e5,e6,e7,e8=0,e9=0,fa=0,fb=0,fc=0,fd=0,fe="object"==typeof performance&&performance.now?performance:Date,ff="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(a){setTimeout(a,17)};function fg(){return fc||(ff(fh),fc=fe.now()+fd)}function fh(){fc=0}function fi(){this._call=this._time=this._next=null}function fj(a,b,c){var d=new fi;return d.restart(a,b,c),d}function fk(){fc=(fb=fe.now())+fd,e8=e9=0;try{fg(),++e8;for(var a,b=e6;b;)(a=fc-b._time)>=0&&b._call.call(void 0,a),b=b._next;--e8}finally{e8=0,function(){for(var a,b,c=e6,d=1/0;c;)c._call?(d>c._time&&(d=c._time),a=c,c=c._next):(b=c._next,c._next=null,c=a?a._next=b:e6=b);e7=a,fm(d)}(),fc=0}}function fl(){var a=fe.now(),b=a-fb;b>1e3&&(fd-=b,fb=a)}function fm(a){!e8&&(e9&&(e9=clearTimeout(e9)),a-fc>24?(a<1/0&&(e9=setTimeout(fk,a-fe.now()-fd)),fa&&(fa=clearInterval(fa))):(fa||(fb=fe.now(),fa=setInterval(fl,1e3)),e8=1,ff(fk)))}function fn(a,b,c){var d=new fi;return b=null==b?0:+b,d.restart(c=>{d.stop(),a(c+b)},b,c),d}fi.prototype=fj.prototype={constructor:fi,restart:function(a,b,c){if("function"!=typeof a)throw TypeError("callback is not a function");c=(null==c?fg():+c)+(null==b?0:+b),this._next||e7===this||(e7?e7._next=this:e6=this,e7=this),this._call=a,this._time=c,fm()},stop:function(){this._call&&(this._call=null,this._time=1/0,fm())}};var fo=eg("start","end","cancel","interrupt"),fp=[];function fq(a,b,c,d,e,f){var g=a.__transition;if(g){if(c in g)return}else a.__transition={};!function(a,b,c){var d,e=a.__transition;function f(i){var j,k,l,m;if(1!==c.state)return h();for(j in e)if((m=e[j]).name===c.name){if(3===m.state)return fn(f);4===m.state?(m.state=6,m.timer.stop(),m.on.call("interrupt",a,a.__data__,m.index,m.group),delete e[j]):+j<b&&(m.state=6,m.timer.stop(),m.on.call("cancel",a,a.__data__,m.index,m.group),delete e[j])}if(fn(function(){3===c.state&&(c.state=4,c.timer.restart(g,c.delay,c.time),g(i))}),c.state=2,c.on.call("start",a,a.__data__,c.index,c.group),2===c.state){for(j=0,c.state=3,d=Array(l=c.tween.length),k=-1;j<l;++j)(m=c.tween[j].value.call(a,a.__data__,c.index,c.group))&&(d[++k]=m);d.length=k+1}}function g(b){for(var e=b<c.duration?c.ease.call(null,b/c.duration):(c.timer.restart(h),c.state=5,1),f=-1,g=d.length;++f<g;)d[f].call(a,e);5===c.state&&(c.on.call("end",a,a.__data__,c.index,c.group),h())}function h(){for(var d in c.state=6,c.timer.stop(),delete e[b],e)return;delete a.__transition}e[b]=c,c.timer=fj(function(a){c.state=1,c.timer.restart(f,c.delay,c.time),c.delay<=a&&f(a-c.delay)},0,c.time)}(a,c,{name:b,index:d,group:e,on:fo,tween:fp,time:f.time,delay:f.delay,duration:f.duration,ease:f.ease,timer:null,state:0})}function fr(a,b){var c=ft(a,b);if(c.state>0)throw Error("too late; already scheduled");return c}function fs(a,b){var c=ft(a,b);if(c.state>3)throw Error("too late; already running");return c}function ft(a,b){var c=a.__transition;if(!c||!(c=c[b]))throw Error("transition not found");return c}function fu(a,b){return a*=1,b*=1,function(c){return a*(1-c)+b*c}}var fv=180/Math.PI,fw={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function fx(a,b,c,d,e,f){var g,h,i;return(g=Math.sqrt(a*a+b*b))&&(a/=g,b/=g),(i=a*c+b*d)&&(c-=a*i,d-=b*i),(h=Math.sqrt(c*c+d*d))&&(c/=h,d/=h,i/=h),a*d<b*c&&(a=-a,b=-b,i=-i,g=-g),{translateX:e,translateY:f,rotate:Math.atan2(b,a)*fv,skewX:Math.atan(i)*fv,scaleX:g,scaleY:h}}function fy(a,b,c,d){function e(a){return a.length?a.pop()+" ":""}return function(f,g){var h,i,j,k,l=[],m=[];return f=a(f),g=a(g),!function(a,d,e,f,g,h){if(a!==e||d!==f){var i=g.push("translate(",null,b,null,c);h.push({i:i-4,x:fu(a,e)},{i:i-2,x:fu(d,f)})}else(e||f)&&g.push("translate("+e+b+f+c)}(f.translateX,f.translateY,g.translateX,g.translateY,l,m),h=f.rotate,i=g.rotate,h!==i?(h-i>180?i+=360:i-h>180&&(h+=360),m.push({i:l.push(e(l)+"rotate(",null,d)-2,x:fu(h,i)})):i&&l.push(e(l)+"rotate("+i+d),j=f.skewX,k=g.skewX,j!==k?m.push({i:l.push(e(l)+"skewX(",null,d)-2,x:fu(j,k)}):k&&l.push(e(l)+"skewX("+k+d),!function(a,b,c,d,f,g){if(a!==c||b!==d){var h=f.push(e(f)+"scale(",null,",",null,")");g.push({i:h-4,x:fu(a,c)},{i:h-2,x:fu(b,d)})}else(1!==c||1!==d)&&f.push(e(f)+"scale("+c+","+d+")")}(f.scaleX,f.scaleY,g.scaleX,g.scaleY,l,m),f=g=null,function(a){for(var b,c=-1,d=m.length;++c<d;)l[(b=m[c]).i]=b.x(a);return l.join("")}}}var fz=fy(function(a){let b=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(a+"");return b.isIdentity?fw:fx(b.a,b.b,b.c,b.d,b.e,b.f)},"px, ","px)","deg)"),fA=fy(function(a){return null==a?fw:(u||(u=document.createElementNS("http://www.w3.org/2000/svg","g")),u.setAttribute("transform",a),a=u.transform.baseVal.consolidate())?fx((a=a.matrix).a,a.b,a.c,a.d,a.e,a.f):fw},", ",")",")");function fB(a,b,c){var d=a._id;return a.each(function(){var a=fs(this,d);(a.value||(a.value={}))[b]=c.apply(this,arguments)}),function(a){return ft(a,d).value[b]}}function fC(a,b,c){a.prototype=b.prototype=c,c.constructor=a}function fD(a,b){var c=Object.create(a.prototype);for(var d in b)c[d]=b[d];return c}function fE(){}var fF="\\s*([+-]?\\d+)\\s*",fG="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fH="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",fI=/^#([0-9a-f]{3,8})$/,fJ=RegExp(`^rgb\\(${fF},${fF},${fF}\\)$`),fK=RegExp(`^rgb\\(${fH},${fH},${fH}\\)$`),fL=RegExp(`^rgba\\(${fF},${fF},${fF},${fG}\\)$`),fM=RegExp(`^rgba\\(${fH},${fH},${fH},${fG}\\)$`),fN=RegExp(`^hsl\\(${fG},${fH},${fH}\\)$`),fO=RegExp(`^hsla\\(${fG},${fH},${fH},${fG}\\)$`),fP={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function fQ(){return this.rgb().formatHex()}function fR(){return this.rgb().formatRgb()}function fS(a){var b,c;return a=(a+"").trim().toLowerCase(),(b=fI.exec(a))?(c=b[1].length,b=parseInt(b[1],16),6===c?fT(b):3===c?new fW(b>>8&15|b>>4&240,b>>4&15|240&b,(15&b)<<4|15&b,1):8===c?fU(b>>24&255,b>>16&255,b>>8&255,(255&b)/255):4===c?fU(b>>12&15|b>>8&240,b>>8&15|b>>4&240,b>>4&15|240&b,((15&b)<<4|15&b)/255):null):(b=fJ.exec(a))?new fW(b[1],b[2],b[3],1):(b=fK.exec(a))?new fW(255*b[1]/100,255*b[2]/100,255*b[3]/100,1):(b=fL.exec(a))?fU(b[1],b[2],b[3],b[4]):(b=fM.exec(a))?fU(255*b[1]/100,255*b[2]/100,255*b[3]/100,b[4]):(b=fN.exec(a))?f0(b[1],b[2]/100,b[3]/100,1):(b=fO.exec(a))?f0(b[1],b[2]/100,b[3]/100,b[4]):fP.hasOwnProperty(a)?fT(fP[a]):"transparent"===a?new fW(NaN,NaN,NaN,0):null}function fT(a){return new fW(a>>16&255,a>>8&255,255&a,1)}function fU(a,b,c,d){return d<=0&&(a=b=c=NaN),new fW(a,b,c,d)}function fV(a,b,c,d){var e;return 1==arguments.length?((e=a)instanceof fE||(e=fS(e)),e)?new fW((e=e.rgb()).r,e.g,e.b,e.opacity):new fW:new fW(a,b,c,null==d?1:d)}function fW(a,b,c,d){this.r=+a,this.g=+b,this.b=+c,this.opacity=+d}function fX(){return`#${f_(this.r)}${f_(this.g)}${f_(this.b)}`}function fY(){let a=fZ(this.opacity);return`${1===a?"rgb(":"rgba("}${f$(this.r)}, ${f$(this.g)}, ${f$(this.b)}${1===a?")":`, ${a})`}`}function fZ(a){return isNaN(a)?1:Math.max(0,Math.min(1,a))}function f$(a){return Math.max(0,Math.min(255,Math.round(a)||0))}function f_(a){return((a=f$(a))<16?"0":"")+a.toString(16)}function f0(a,b,c,d){return d<=0?a=b=c=NaN:c<=0||c>=1?a=b=NaN:b<=0&&(a=NaN),new f2(a,b,c,d)}function f1(a){if(a instanceof f2)return new f2(a.h,a.s,a.l,a.opacity);if(a instanceof fE||(a=fS(a)),!a)return new f2;if(a instanceof f2)return a;var b=(a=a.rgb()).r/255,c=a.g/255,d=a.b/255,e=Math.min(b,c,d),f=Math.max(b,c,d),g=NaN,h=f-e,i=(f+e)/2;return h?(g=b===f?(c-d)/h+(c<d)*6:c===f?(d-b)/h+2:(b-c)/h+4,h/=i<.5?f+e:2-f-e,g*=60):h=i>0&&i<1?0:g,new f2(g,h,i,a.opacity)}function f2(a,b,c,d){this.h=+a,this.s=+b,this.l=+c,this.opacity=+d}function f3(a){return(a=(a||0)%360)<0?a+360:a}function f4(a){return Math.max(0,Math.min(1,a||0))}function f5(a,b,c){return(a<60?b+(c-b)*a/60:a<180?c:a<240?b+(c-b)*(240-a)/60:b)*255}function f6(a,b,c,d,e){var f=a*a,g=f*a;return((1-3*a+3*f-g)*b+(4-6*f+3*g)*c+(1+3*a+3*f-3*g)*d+g*e)/6}fC(fE,fS,{copy(a){return Object.assign(new this.constructor,this,a)},displayable(){return this.rgb().displayable()},hex:fQ,formatHex:fQ,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return f1(this).formatHsl()},formatRgb:fR,toString:fR}),fC(fW,fV,fD(fE,{brighter(a){return a=null==a?1.4285714285714286:Math.pow(1.4285714285714286,a),new fW(this.r*a,this.g*a,this.b*a,this.opacity)},darker(a){return a=null==a?.7:Math.pow(.7,a),new fW(this.r*a,this.g*a,this.b*a,this.opacity)},rgb(){return this},clamp(){return new fW(f$(this.r),f$(this.g),f$(this.b),fZ(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:fX,formatHex:fX,formatHex8:function(){return`#${f_(this.r)}${f_(this.g)}${f_(this.b)}${f_((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:fY,toString:fY})),fC(f2,function(a,b,c,d){return 1==arguments.length?f1(a):new f2(a,b,c,null==d?1:d)},fD(fE,{brighter(a){return a=null==a?1.4285714285714286:Math.pow(1.4285714285714286,a),new f2(this.h,this.s,this.l*a,this.opacity)},darker(a){return a=null==a?.7:Math.pow(.7,a),new f2(this.h,this.s,this.l*a,this.opacity)},rgb(){var a=this.h%360+(this.h<0)*360,b=isNaN(a)||isNaN(this.s)?0:this.s,c=this.l,d=c+(c<.5?c:1-c)*b,e=2*c-d;return new fW(f5(a>=240?a-240:a+120,e,d),f5(a,e,d),f5(a<120?a+240:a-120,e,d),this.opacity)},clamp(){return new f2(f3(this.h),f4(this.s),f4(this.l),fZ(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let a=fZ(this.opacity);return`${1===a?"hsl(":"hsla("}${f3(this.h)}, ${100*f4(this.s)}%, ${100*f4(this.l)}%${1===a?")":`, ${a})`}`}}));let f7=a=>()=>a;function f8(a,b){var c=b-a;return c?function(b){return a+b*c}:f7(isNaN(a)?b:a)}let f9=function a(b){var c,d=1==(c=+b)?f8:function(a,b){var d,e,f;return b-a?(d=a,e=b,d=Math.pow(d,f=c),e=Math.pow(e,f)-d,f=1/f,function(a){return Math.pow(d+a*e,f)}):f7(isNaN(a)?b:a)};function e(a,b){var c=d((a=fV(a)).r,(b=fV(b)).r),e=d(a.g,b.g),f=d(a.b,b.b),g=f8(a.opacity,b.opacity);return function(b){return a.r=c(b),a.g=e(b),a.b=f(b),a.opacity=g(b),a+""}}return e.gamma=a,e}(1);function ga(a){return function(b){var c,d,e=b.length,f=Array(e),g=Array(e),h=Array(e);for(c=0;c<e;++c)d=fV(b[c]),f[c]=d.r||0,g[c]=d.g||0,h[c]=d.b||0;return f=a(f),g=a(g),h=a(h),d.opacity=1,function(a){return d.r=f(a),d.g=g(a),d.b=h(a),d+""}}}ga(function(a){var b=a.length-1;return function(c){var d=c<=0?c=0:c>=1?(c=1,b-1):Math.floor(c*b),e=a[d],f=a[d+1],g=d>0?a[d-1]:2*e-f,h=d<b-1?a[d+2]:2*f-e;return f6((c-d/b)*b,g,e,f,h)}}),ga(function(a){var b=a.length;return function(c){var d=Math.floor(((c%=1)<0?++c:c)*b),e=a[(d+b-1)%b],f=a[d%b],g=a[(d+1)%b],h=a[(d+2)%b];return f6((c-d/b)*b,e,f,g,h)}});var gb=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,gc=RegExp(gb.source,"g");function gd(a,b){var c,d,e,f,g,h=gb.lastIndex=gc.lastIndex=0,i=-1,j=[],k=[];for(a+="",b+="";(e=gb.exec(a))&&(f=gc.exec(b));)(g=f.index)>h&&(g=b.slice(h,g),j[i]?j[i]+=g:j[++i]=g),(e=e[0])===(f=f[0])?j[i]?j[i]+=f:j[++i]=f:(j[++i]=null,k.push({i:i,x:fu(e,f)})),h=gc.lastIndex;return h<b.length&&(g=b.slice(h),j[i]?j[i]+=g:j[++i]=g),j.length<2?k[0]?(c=k[0].x,function(a){return c(a)+""}):(d=b,function(){return d}):(b=k.length,function(a){for(var c,d=0;d<b;++d)j[(c=k[d]).i]=c.x(a);return j.join("")})}function ge(a,b){var c;return("number"==typeof b?fu:b instanceof fS?f9:(c=fS(b))?(b=c,f9):gd)(a,b)}var gf=eX.prototype.constructor;function gg(a){return function(){this.style.removeProperty(a)}}var gh=0;function gi(a,b,c,d){this._groups=a,this._parents=b,this._name=c,this._id=d}var gj=eX.prototype;gi.prototype=(function(a){return eX().transition(a)}).prototype={constructor:gi,select:function(a){var b=this._name,c=this._id;"function"!=typeof a&&(a=ek(a));for(var d=this._groups,e=d.length,f=Array(e),g=0;g<e;++g)for(var h,i,j=d[g],k=j.length,l=f[g]=Array(k),m=0;m<k;++m)(h=j[m])&&(i=a.call(h,h.__data__,m,j))&&("__data__"in h&&(i.__data__=h.__data__),l[m]=i,fq(l[m],b,c,m,l,ft(h,c)));return new gi(f,this._parents,b,c)},selectAll:function(a){var b=this._name,c=this._id;"function"!=typeof a&&(a=em(a));for(var d=this._groups,e=d.length,f=[],g=[],h=0;h<e;++h)for(var i,j=d[h],k=j.length,l=0;l<k;++l)if(i=j[l]){for(var m,n=a.call(i,i.__data__,l,j),o=ft(i,c),p=0,q=n.length;p<q;++p)(m=n[p])&&fq(m,b,c,p,n,o);f.push(n),g.push(i)}return new gi(f,g,b,c)},selectChild:gj.selectChild,selectChildren:gj.selectChildren,filter:function(a){"function"!=typeof a&&(a=en(a));for(var b=this._groups,c=b.length,d=Array(c),e=0;e<c;++e)for(var f,g=b[e],h=g.length,i=d[e]=[],j=0;j<h;++j)(f=g[j])&&a.call(f,f.__data__,j,g)&&i.push(f);return new gi(d,this._parents,this._name,this._id)},merge:function(a){if(a._id!==this._id)throw Error();for(var b=this._groups,c=a._groups,d=b.length,e=c.length,f=Math.min(d,e),g=Array(d),h=0;h<f;++h)for(var i,j=b[h],k=c[h],l=j.length,m=g[h]=Array(l),n=0;n<l;++n)(i=j[n]||k[n])&&(m[n]=i);for(;h<d;++h)g[h]=b[h];return new gi(g,this._parents,this._name,this._id)},selection:function(){return new gf(this._groups,this._parents)},transition:function(){for(var a=this._name,b=this._id,c=++gh,d=this._groups,e=d.length,f=0;f<e;++f)for(var g,h=d[f],i=h.length,j=0;j<i;++j)if(g=h[j]){var k=ft(g,b);fq(g,a,c,j,h,{time:k.time+k.delay+k.duration,delay:0,duration:k.duration,ease:k.ease})}return new gi(d,this._parents,a,c)},call:gj.call,nodes:gj.nodes,node:gj.node,size:gj.size,empty:gj.empty,each:gj.each,on:function(a,b){var c,d,e,f,g,h,i=this._id;return arguments.length<2?ft(this.node(),i).on.on(a):this.each((c=i,d=a,e=b,h=(d+"").trim().split(/^|\s+/).every(function(a){var b=a.indexOf(".");return b>=0&&(a=a.slice(0,b)),!a||"start"===a})?fr:fs,function(){var a=h(this,c),b=a.on;b!==f&&(g=(f=b).copy()).on(d,e),a.on=g}))},attr:function(a,b){var c=eB(a),d="transform"===c?fA:ge;return this.attrTween(a,"function"==typeof b?(c.local?function(a,b,c){var d,e,f;return function(){var g,h,i=c(this);return null==i?void this.removeAttributeNS(a.space,a.local):(g=this.getAttributeNS(a.space,a.local))===(h=i+"")?null:g===d&&h===e?f:(e=h,f=b(d=g,i))}}:function(a,b,c){var d,e,f;return function(){var g,h,i=c(this);return null==i?void this.removeAttribute(a):(g=this.getAttribute(a))===(h=i+"")?null:g===d&&h===e?f:(e=h,f=b(d=g,i))}})(c,d,fB(this,"attr."+a,b)):null==b?(c.local?function(a){return function(){this.removeAttributeNS(a.space,a.local)}}:function(a){return function(){this.removeAttribute(a)}})(c):(c.local?function(a,b,c){var d,e,f=c+"";return function(){var g=this.getAttributeNS(a.space,a.local);return g===f?null:g===d?e:e=b(d=g,c)}}:function(a,b,c){var d,e,f=c+"";return function(){var g=this.getAttribute(a);return g===f?null:g===d?e:e=b(d=g,c)}})(c,d,b))},attrTween:function(a,b){var c="attr."+a;if(arguments.length<2)return(c=this.tween(c))&&c._value;if(null==b)return this.tween(c,null);if("function"!=typeof b)throw Error();var d=eB(a);return this.tween(c,(d.local?function(a,b){var c,d;function e(){var e=b.apply(this,arguments);return e!==d&&(c=(d=e)&&function(b){this.setAttributeNS(a.space,a.local,e.call(this,b))}),c}return e._value=b,e}:function(a,b){var c,d;function e(){var e=b.apply(this,arguments);return e!==d&&(c=(d=e)&&function(b){this.setAttribute(a,e.call(this,b))}),c}return e._value=b,e})(d,b))},style:function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y="transform"==(a+="")?fz:ge;return null==b?this.styleTween(a,(d=a,function(){var a=eD(this,d),b=(this.style.removeProperty(d),eD(this,d));return a===b?null:a===e&&b===f?g:g=y(e=a,f=b)})).on("end.style."+a,gg(a)):"function"==typeof b?this.styleTween(a,(h=a,i=fB(this,"style."+a,b),function(){var a=eD(this,h),b=i(this),c=b+"";return null==b&&(this.style.removeProperty(h),c=b=eD(this,h)),a===c?null:a===j&&c===k?l:(k=c,l=y(j=a,b))})).each((m=this._id,t="end."+(s="style."+(n=a)),function(){var a=fs(this,m),b=a.on,c=null==a.value[s]?r||(r=gg(n)):void 0;(b!==o||q!==c)&&(p=(o=b).copy()).on(t,q=c),a.on=p})):this.styleTween(a,(u=a,x=b+"",function(){var a=eD(this,u);return a===x?null:a===v?w:w=y(v=a,b)}),c).on("end.style."+a,null)},styleTween:function(a,b,c){var d="style."+(a+="");if(arguments.length<2)return(d=this.tween(d))&&d._value;if(null==b)return this.tween(d,null);if("function"!=typeof b)throw Error();return this.tween(d,function(a,b,c){var d,e;function f(){var f=b.apply(this,arguments);return f!==e&&(d=(e=f)&&function(b){this.style.setProperty(a,f.call(this,b),c)}),d}return f._value=b,f}(a,b,null==c?"":c))},text:function(a){var b,c;return this.tween("text","function"==typeof a?(b=fB(this,"text",a),function(){var a=b(this);this.textContent=null==a?"":a}):(c=null==a?"":a+"",function(){this.textContent=c}))},textTween:function(a){var b="text";if(arguments.length<1)return(b=this.tween(b))&&b._value;if(null==a)return this.tween(b,null);if("function"!=typeof a)throw Error();return this.tween(b,function(a){var b,c;function d(){var d=a.apply(this,arguments);return d!==c&&(b=(c=d)&&function(a){this.textContent=d.call(this,a)}),b}return d._value=a,d}(a))},remove:function(){var a;return this.on("end.remove",(a=this._id,function(){var b=this.parentNode;for(var c in this.__transition)if(+c!==a)return;b&&b.removeChild(this)}))},tween:function(a,b){var c=this._id;if(a+="",arguments.length<2){for(var d,e=ft(this.node(),c).tween,f=0,g=e.length;f<g;++f)if((d=e[f]).name===a)return d.value;return null}return this.each((null==b?function(a,b){var c,d;return function(){var e=fs(this,a),f=e.tween;if(f!==c){d=c=f;for(var g=0,h=d.length;g<h;++g)if(d[g].name===b){(d=d.slice()).splice(g,1);break}}e.tween=d}}:function(a,b,c){var d,e;if("function"!=typeof c)throw Error();return function(){var f=fs(this,a),g=f.tween;if(g!==d){e=(d=g).slice();for(var h={name:b,value:c},i=0,j=e.length;i<j;++i)if(e[i].name===b){e[i]=h;break}i===j&&e.push(h)}f.tween=e}})(c,a,b))},delay:function(a){var b=this._id;return arguments.length?this.each(("function"==typeof a?function(a,b){return function(){fr(this,a).delay=+b.apply(this,arguments)}}:function(a,b){return b*=1,function(){fr(this,a).delay=b}})(b,a)):ft(this.node(),b).delay},duration:function(a){var b=this._id;return arguments.length?this.each(("function"==typeof a?function(a,b){return function(){fs(this,a).duration=+b.apply(this,arguments)}}:function(a,b){return b*=1,function(){fs(this,a).duration=b}})(b,a)):ft(this.node(),b).duration},ease:function(a){var b=this._id;return arguments.length?this.each(function(a,b){if("function"!=typeof b)throw Error();return function(){fs(this,a).ease=b}}(b,a)):ft(this.node(),b).ease},easeVarying:function(a){var b;if("function"!=typeof a)throw Error();return this.each((b=this._id,function(){var c=a.apply(this,arguments);if("function"!=typeof c)throw Error();fs(this,b).ease=c}))},end:function(){var a,b,c=this,d=c._id,e=c.size();return new Promise(function(f,g){var h={value:g},i={value:function(){0==--e&&f()}};c.each(function(){var c=fs(this,d),e=c.on;e!==a&&((b=(a=e).copy())._.cancel.push(h),b._.interrupt.push(h),b._.end.push(i)),c.on=b}),0===e&&f()})},[Symbol.iterator]:gj[Symbol.iterator]};var gk={time:null,delay:0,duration:250,ease:function(a){return((a*=2)<=1?a*a*a:(a-=2)*a*a+2)/2}};function gl(a,b,c){this.k=a,this.x=b,this.y=c}eX.prototype.interrupt=function(a){return this.each(function(){!function(a,b){var c,d,e,f=a.__transition,g=!0;if(f){for(e in b=null==b?null:b+"",f){if((c=f[e]).name!==b){g=!1;continue}d=c.state>2&&c.state<5,c.state=6,c.timer.stop(),c.on.call(d?"interrupt":"cancel",a,a.__data__,c.index,c.group),delete f[e]}g&&delete a.__transition}}(this,a)})},eX.prototype.transition=function(a){var b,c;a instanceof gi?(b=a._id,a=a._name):(b=++gh,(c=gk).time=fg(),a=null==a?null:a+"");for(var d=this._groups,e=d.length,f=0;f<e;++f)for(var g,h=d[f],i=h.length,j=0;j<i;++j)(g=h[j])&&fq(g,a,b,j,h,c||function(a,b){for(var c;!(c=a.__transition)||!(c=c[b]);)if(!(a=a.parentNode))throw Error(`transition ${b} not found`);return c}(g,b));return new gi(d,this._parents,a,b)},gl.prototype={constructor:gl,scale:function(a){return 1===a?this:new gl(this.k*a,this.x,this.y)},translate:function(a,b){return 0===a&0===b?this:new gl(this.k,this.x+this.k*a,this.y+this.k*b)},apply:function(a){return[a[0]*this.k+this.x,a[1]*this.k+this.y]},applyX:function(a){return a*this.k+this.x},applyY:function(a){return a*this.k+this.y},invert:function(a){return[(a[0]-this.x)/this.k,(a[1]-this.y)/this.k]},invertX:function(a){return(a-this.x)/this.k},invertY:function(a){return(a-this.y)/this.k},rescaleX:function(a){return a.copy().domain(a.range().map(this.invertX,this).map(a.invert,a))},rescaleY:function(a){return a.copy().domain(a.range().map(this.invertY,this).map(a.invert,a))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};new gl(1,0,0);gl.prototype;let gm=()=>"Only child nodes can use a parent extent.",gn=()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",go=[[-1/0,-1/0],[1/0,1/0]],gp=["Enter"," ","Escape"],gq={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:a,x:b,y:c})=>`Moved selected node ${a}. New position, x: ${b}, y: ${c}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};(k=v||(v={})).Strict="strict",k.Loose="loose",(l=w||(w={})).Free="free",l.Vertical="vertical",l.Horizontal="horizontal",(m=x||(x={})).Partial="partial",m.Full="full";let gr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};(n=y||(y={})).Bezier="default",n.Straight="straight",n.Step="step",n.SmoothStep="smoothstep",n.SimpleBezier="simplebezier",(o=z||(z={})).Arrow="arrow",o.ArrowClosed="arrowclosed",(p=A||(A={})).Left="left",p.Top="top",p.Right="right",p.Bottom="bottom";let gs={[A.Left]:A.Right,[A.Right]:A.Left,[A.Top]:A.Bottom,[A.Bottom]:A.Top};function gt(a){return null===a?null:a?"valid":"invalid"}let gu=a=>"id"in a&&"source"in a&&"target"in a,gv=a=>"id"in a&&"internals"in a&&!("source"in a)&&!("target"in a),gw=(a,b=[0,0])=>{let{width:c,height:d}=gW(a),e=a.origin??b,f=c*e[0],g=d*e[1];return{x:a.position.x-f,y:a.position.y-g}},gx=(a,b={})=>{let c={x:1/0,y:1/0,x2:-1/0,y2:-1/0},d=!1;return a.forEach(a=>{(void 0===b.filter||b.filter(a))&&(c=gF(c,gJ(a)),d=!0)}),d?gH(c):{x:0,y:0,width:0,height:0}},gy=(a,b,[c,d,e]=[0,0,1],f=!1,g=!1)=>{let h={...gQ(b,[c,d,e]),width:b.width/e,height:b.height/e},i=[];for(let b of a.values()){let{measured:a,selectable:c=!0,hidden:d=!1}=b;if(g&&!c||d)continue;let e=a.width??b.width??b.initialWidth??null,j=a.height??b.height??b.initialHeight??null,k=gL(h,gI(b)),l=(e??0)*(j??0),m=f&&k>0;(!b.internals.handleBounds||m||k>=l||b.dragging)&&i.push(b)}return i};async function gz({nodes:a,width:b,height:c,panZoom:d,minZoom:e,maxZoom:f},g){let h,i;if(0===a.size)return Promise.resolve(!0);let j=gT(gx((h=new Map,i=g?.nodes?new Set(g.nodes.map(a=>a.id)):null,a.forEach(a=>{a.measured.width&&a.measured.height&&(g?.includeHiddenNodes||!a.hidden)&&(!i||i.has(a.id))&&h.set(a.id,a)}),h)),b,c,g?.minZoom??e,g?.maxZoom??f,g?.padding??.1);return await d.setViewport(j,{duration:g?.duration,ease:g?.ease,interpolate:g?.interpolate}),Promise.resolve(!0)}async function gA({nodesToRemove:a=[],edgesToRemove:b=[],nodes:c,edges:d,onBeforeDelete:e}){let f,g=new Set(a.map(a=>a.id)),h=[];for(let a of c){if(!1===a.deletable)continue;let b=g.has(a.id),c=!b&&a.parentId&&h.find(b=>b.id===a.parentId);(b||c)&&h.push(a)}let i=new Set(b.map(a=>a.id)),j=d.filter(a=>!1!==a.deletable),k=(f=new Set,h.forEach(a=>{f.add(a.id)}),j.filter(a=>f.has(a.source)||f.has(a.target)));for(let a of j)i.has(a.id)&&!k.find(b=>b.id===a.id)&&k.push(a);if(!e)return{edges:k,nodes:h};let l=await e({nodes:h,edges:k});return"boolean"==typeof l?l?{edges:k,nodes:h}:{edges:[],nodes:[]}:l}let gB=(a,b=0,c=1)=>Math.min(Math.max(a,b),c),gC=(a={x:0,y:0},b,c)=>({x:gB(a.x,b[0][0],b[1][0]-(c?.width??0)),y:gB(a.y,b[0][1],b[1][1]-(c?.height??0))});function gD(a,b,c){let{width:d,height:e}=gW(c),{x:f,y:g}=c.internals.positionAbsolute;return gC(a,[[f,g],[f+d,g+e]],b)}let gE=(a,b,c)=>a<b?gB(Math.abs(a-b),1,b)/b:a>c?-gB(Math.abs(a-c),1,b)/b:0,gF=(a,b)=>({x:Math.min(a.x,b.x),y:Math.min(a.y,b.y),x2:Math.max(a.x2,b.x2),y2:Math.max(a.y2,b.y2)}),gG=({x:a,y:b,width:c,height:d})=>({x:a,y:b,x2:a+c,y2:b+d}),gH=({x:a,y:b,x2:c,y2:d})=>({x:a,y:b,width:c-a,height:d-b}),gI=(a,b=[0,0])=>{let{x:c,y:d}=gv(a)?a.internals.positionAbsolute:gw(a,b);return{x:c,y:d,width:a.measured?.width??a.width??a.initialWidth??0,height:a.measured?.height??a.height??a.initialHeight??0}},gJ=(a,b=[0,0])=>{let{x:c,y:d}=gv(a)?a.internals.positionAbsolute:gw(a,b);return{x:c,y:d,x2:c+(a.measured?.width??a.width??a.initialWidth??0),y2:d+(a.measured?.height??a.height??a.initialHeight??0)}},gK=(a,b)=>gH(gF(gG(a),gG(b))),gL=(a,b)=>Math.ceil(Math.max(0,Math.min(a.x+a.width,b.x+b.width)-Math.max(a.x,b.x))*Math.max(0,Math.min(a.y+a.height,b.y+b.height)-Math.max(a.y,b.y))),gM=a=>gN(a.width)&&gN(a.height)&&gN(a.x)&&gN(a.y),gN=a=>!isNaN(a)&&isFinite(a),gO=(a,b)=>{},gP=(a,b=[1,1])=>({x:b[0]*Math.round(a.x/b[0]),y:b[1]*Math.round(a.y/b[1])}),gQ=({x:a,y:b},[c,d,e],f=!1,g=[1,1])=>{let h={x:(a-c)/e,y:(b-d)/e};return f?gP(h,g):h},gR=({x:a,y:b},[c,d,e])=>({x:a*e+c,y:b*e+d});function gS(a,b){if("number"==typeof a)return Math.floor((b-b/(1+a))*.5);if("string"==typeof a&&a.endsWith("px")){let b=parseFloat(a);if(!Number.isNaN(b))return Math.floor(b)}if("string"==typeof a&&a.endsWith("%")){let c=parseFloat(a);if(!Number.isNaN(c))return Math.floor(b*c*.01)}return console.error(`[React Flow] The padding value "${a}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}let gT=(a,b,c,d,e,f)=>{let g=function(a,b,c){if("string"==typeof a||"number"==typeof a){let d=gS(a,c),e=gS(a,b);return{top:d,right:e,bottom:d,left:e,x:2*e,y:2*d}}if("object"==typeof a){let d=gS(a.top??a.y??0,c),e=gS(a.bottom??a.y??0,c),f=gS(a.left??a.x??0,b),g=gS(a.right??a.x??0,b);return{top:d,right:g,bottom:e,left:f,x:f+g,y:d+e}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(f,b,c),h=gB(Math.min((b-g.x)/a.width,(c-g.y)/a.height),d,e),i=a.x+a.width/2,j=a.y+a.height/2,k=b/2-i*h,l=c/2-j*h,m=function(a,b,c,d,e,f){let{x:g,y:h}=gR(a,[b,c,d]),{x:i,y:j}=gR({x:a.x+a.width,y:a.y+a.height},[b,c,d]);return{left:Math.floor(g),top:Math.floor(h),right:Math.floor(e-i),bottom:Math.floor(f-j)}}(a,k,l,h,b,c),n={left:Math.min(m.left-g.left,0),top:Math.min(m.top-g.top,0),right:Math.min(m.right-g.right,0),bottom:Math.min(m.bottom-g.bottom,0)};return{x:k-n.left+n.right,y:l-n.top+n.bottom,zoom:h}},gU=()=>"u">typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function gV(a){return null!=a&&"parent"!==a}function gW(a){return{width:a.measured?.width??a.width??a.initialWidth??0,height:a.measured?.height??a.height??a.initialHeight??0}}function gX(a){return(a.measured?.width??a.width??a.initialWidth)!==void 0&&(a.measured?.height??a.height??a.initialHeight)!==void 0}function gY(a,b){if(a.size!==b.size)return!1;for(let c of a)if(!b.has(c))return!1;return!0}let gZ=a=>({width:a.offsetWidth,height:a.offsetHeight}),g$=a=>a?.getRootNode?.()||window?.document,g_=["INPUT","SELECT","TEXTAREA"],g0=(a,b)=>{let c="clientX"in a,d=c?a.clientX:a.touches?.[0].clientX,e=c?a.clientY:a.touches?.[0].clientY;return{x:d-(b?.left??0),y:e-(b?.top??0)}},g1=(a,b,c,d,e)=>{let f=b.querySelectorAll(`.${a}`);return f&&f.length?Array.from(f).map(b=>{let f=b.getBoundingClientRect();return{id:b.getAttribute("data-handleid"),type:a,nodeId:e,position:b.getAttribute("data-handlepos"),x:(f.left-c.left)/d,y:(f.top-c.top)/d,...gZ(b)}}):null};function g2({sourceX:a,sourceY:b,targetX:c,targetY:d,sourceControlX:e,sourceControlY:f,targetControlX:g,targetControlY:h}){let i=.125*a+.375*e+.375*g+.125*c,j=.125*b+.375*f+.375*h+.125*d,k=Math.abs(i-a),l=Math.abs(j-b);return[i,j,k,l]}function g3(a,b){return a>=0?.5*a:25*b*Math.sqrt(-a)}function g4({pos:a,x1:b,y1:c,x2:d,y2:e,c:f}){switch(a){case A.Left:return[b-g3(b-d,f),c];case A.Right:return[b+g3(d-b,f),c];case A.Top:return[b,c-g3(c-e,f)];case A.Bottom:return[b,c+g3(e-c,f)]}}function g5({sourceX:a,sourceY:b,sourcePosition:c=A.Bottom,targetX:d,targetY:e,targetPosition:f=A.Top,curvature:g=.25}){let[h,i]=g4({pos:c,x1:a,y1:b,x2:d,y2:e,c:g}),[j,k]=g4({pos:f,x1:d,y1:e,x2:a,y2:b,c:g}),[l,m,n,o]=g2({sourceX:a,sourceY:b,targetX:d,targetY:e,sourceControlX:h,sourceControlY:i,targetControlX:j,targetControlY:k});return[`M${a},${b} C${h},${i} ${j},${k} ${d},${e}`,l,m,n,o]}function g6({sourceX:a,sourceY:b,targetX:c,targetY:d}){let e=Math.abs(c-a)/2,f=Math.abs(d-b)/2;return[c<a?c+e:c-e,d<b?d+f:d-f,e,f]}let g7=({source:a,sourceHandle:b,target:c,targetHandle:d})=>`xy-edge__${a}${b||""}-${c}${d||""}`;function g8({sourceX:a,sourceY:b,targetX:c,targetY:d}){let[e,f,g,h]=g6({sourceX:a,sourceY:b,targetX:c,targetY:d});return[`M ${a},${b}L ${c},${d}`,e,f,g,h]}let g9={[A.Left]:{x:-1,y:0},[A.Right]:{x:1,y:0},[A.Top]:{x:0,y:-1},[A.Bottom]:{x:0,y:1}},ha=({source:a,sourcePosition:b=A.Bottom,target:c})=>b===A.Left||b===A.Right?a.x<c.x?{x:1,y:0}:{x:-1,y:0}:a.y<c.y?{x:0,y:1}:{x:0,y:-1},hb=(a,b)=>Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2));function hc({sourceX:a,sourceY:b,sourcePosition:c=A.Bottom,targetX:d,targetY:e,targetPosition:f=A.Top,borderRadius:g=5,centerX:h,centerY:i,offset:j=20,stepPosition:k=.5}){let[l,m,n,o,p]=function({source:a,sourcePosition:b=A.Bottom,target:c,targetPosition:d=A.Top,center:e,offset:f,stepPosition:g}){let h,i,j=g9[b],k=g9[d],l={x:a.x+j.x*f,y:a.y+j.y*f},m={x:c.x+k.x*f,y:c.y+k.y*f},n=ha({source:l,sourcePosition:b,target:m}),o=0!==n.x?"x":"y",p=n[o],q=[],r={x:0,y:0},s={x:0,y:0},[,,t,u]=g6({sourceX:a.x,sourceY:a.y,targetX:c.x,targetY:c.y});if(j[o]*k[o]==-1){"x"===o?(h=e.x??l.x+(m.x-l.x)*g,i=e.y??(l.y+m.y)/2):(h=e.x??(l.x+m.x)/2,i=e.y??l.y+(m.y-l.y)*g);let a=[{x:h,y:l.y},{x:h,y:m.y}],b=[{x:l.x,y:i},{x:m.x,y:i}];q=j[o]===p?"x"===o?a:b:"x"===o?b:a}else{let e=[{x:l.x,y:m.y}],g=[{x:m.x,y:l.y}];if(q="x"===o?j.x===p?g:e:j.y===p?e:g,b===d){let b=Math.abs(a[o]-c[o]);if(b<=f){let d=Math.min(f-1,f-b);j[o]===p?r[o]=(l[o]>a[o]?-1:1)*d:s[o]=(m[o]>c[o]?-1:1)*d}}if(b!==d){let a="x"===o?"y":"x",b=j[o]===k[a],c=l[a]>m[a],d=l[a]<m[a];(1===j[o]&&(!b&&c||b&&d)||1!==j[o]&&(!b&&d||b&&c))&&(q="x"===o?e:g)}let n={x:l.x+r.x,y:l.y+r.y},t={x:m.x+s.x,y:m.y+s.y};Math.max(Math.abs(n.x-q[0].x),Math.abs(t.x-q[0].x))>=Math.max(Math.abs(n.y-q[0].y),Math.abs(t.y-q[0].y))?(h=(n.x+t.x)/2,i=q[0].y):(h=q[0].x,i=(n.y+t.y)/2)}return[[a,{x:l.x+r.x,y:l.y+r.y},...q,{x:m.x+s.x,y:m.y+s.y},c],h,i,t,u]}({source:{x:a,y:b},sourcePosition:c,target:{x:d,y:e},targetPosition:f,center:{x:h,y:i},offset:j,stepPosition:k});return[l.reduce((a,b,c)=>a+(c>0&&c<l.length-1?function(a,b,c,d){let e=Math.min(hb(a,b)/2,hb(b,c)/2,d),{x:f,y:g}=b;if(a.x===f&&f===c.x||a.y===g&&g===c.y)return`L${f} ${g}`;if(a.y===g){let b=a.x<c.x?-1:1,d=a.y<c.y?1:-1;return`L ${f+e*b},${g}Q ${f},${g} ${f},${g+e*d}`}let h=a.x<c.x?1:-1,i=a.y<c.y?-1:1;return`L ${f},${g+e*i}Q ${f},${g} ${f+e*h},${g}`}(l[c-1],b,l[c+1],g):`${0===c?"M":"L"}${b.x} ${b.y}`),""),m,n,o,p]}function hd(a){return a&&!!(a.internals.handleBounds||a.handles?.length)&&!!(a.measured.width||a.width||a.initialWidth)}function he(a){if(!a)return null;let b=[],c=[];for(let d of a)d.width=d.width??1,d.height=d.height??1,"source"===d.type?b.push(d):"target"===d.type&&c.push(d);return{source:b,target:c}}function hf(a,b,c=A.Left,d=!1){let e=(b?.x??0)+a.internals.positionAbsolute.x,f=(b?.y??0)+a.internals.positionAbsolute.y,{width:g,height:h}=b??gW(a);if(d)return{x:e+g/2,y:f+h/2};switch(b?.position??c){case A.Top:return{x:e+g/2,y:f};case A.Right:return{x:e+g,y:f+h/2};case A.Bottom:return{x:e+g/2,y:f+h};case A.Left:return{x:e,y:f+h/2}}}function hg(a,b){return a&&(b?a.find(a=>a.id===b):a[0])||null}function hh(a,b){if(!a)return"";if("string"==typeof a)return a;let c=b?`${b}__`:"";return`${c}${Object.keys(a).sort().map(b=>`${b}=${a[b]}`).join("&")}`}let hi={nodeOrigin:[0,0],nodeExtent:go,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},hj={...hi,checkEquality:!0};function hk(a,b){let c={...a};for(let a in b)void 0!==b[a]&&(c[a]=b[a]);return c}function hl(a){return"manual"===a}function hm(a,b,c,d={}){let e=hk(hj,d),f={i:0},g=new Map(b),h=e?.elevateNodesOnSelect&&!hl(e.zIndexMode)?1e3:0,i=a.length>0;for(let j of(b.clear(),c.clear(),a)){let a=g.get(j.id);if(e.checkEquality&&j===a?.internals.userNode)b.set(j.id,a);else{let c=gC(gw(j,e.nodeOrigin),gV(j.extent)?j.extent:e.nodeExtent,gW(j));a={...e.defaults,...j,measured:{width:j.measured?.width,height:j.measured?.height},internals:{positionAbsolute:c,handleBounds:function(a,b){if(!a.handles)return a.measured?b?.internals.handleBounds:void 0;let c=[],d=[];for(let b of a.handles){let e={id:b.id,width:b.width??1,height:b.height??1,nodeId:a.id,x:b.x,y:b.y,position:b.position,type:b.type};"source"===b.type?c.push(e):"target"===b.type&&d.push(e)}return{source:c,target:d}}(j,a),z:ho(j,h,e.zIndexMode),userNode:j}},b.set(j.id,a)}void 0!==a.measured&&void 0!==a.measured.width&&void 0!==a.measured.height||a.hidden||(i=!1),j.parentId&&hn(a,b,c,d,f)}return i}function hn(a,b,c,d,e){let{elevateNodesOnSelect:f,nodeOrigin:g,nodeExtent:h,zIndexMode:i}=hk(hi,d),j=a.parentId,k=b.get(j);if(!k)return void console.warn(`Parent node ${j} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(a,b){if(!a.parentId)return;let c=b.get(a.parentId);c?c.set(a.id,a):b.set(a.parentId,new Map([[a.id,a]]))}(a,c),e&&!k.parentId&&void 0===k.internals.rootParentIndex&&"auto"===i&&(k.internals.rootParentIndex=++e.i,k.internals.z=k.internals.z+10*e.i),e&&void 0!==k.internals.rootParentIndex&&(e.i=k.internals.rootParentIndex);let{x:l,y:m,z:n}=function(a,b,c,d,e,f){let{x:g,y:h}=b.internals.positionAbsolute,i=gW(a),j=gw(a,c),k=gV(a.extent)?gC(j,a.extent,i):j,l=gC({x:g+k.x,y:h+k.y},d,i);"parent"===a.extent&&(l=gD(l,i,b));let m=ho(a,e,f),n=b.internals.z??0;return{x:l.x,y:l.y,z:n>=m?n+1:m}}(a,k,g,h,f&&!hl(i)?1e3:0,i),{positionAbsolute:o}=a.internals,p=l!==o.x||m!==o.y;(p||n!==a.internals.z)&&b.set(a.id,{...a,internals:{...a.internals,positionAbsolute:p?{x:l,y:m}:o,z:n}})}function ho(a,b,c){let d=gN(a.zIndex)?a.zIndex:0;return hl(c)?d:d+(a.selected?b:0)}function hp(a,b,c,d=[0,0]){let e=[],f=new Map;for(let c of a){let a=b.get(c.parentId);if(!a)continue;let d=gK(f.get(c.parentId)?.expandedRect??gI(a),c.rect);f.set(c.parentId,{expandedRect:d,parent:a})}return f.size>0&&f.forEach(({expandedRect:b,parent:f},g)=>{let h=f.internals.positionAbsolute,i=gW(f),j=f.origin??d,k=b.x<h.x?Math.round(Math.abs(h.x-b.x)):0,l=b.y<h.y?Math.round(Math.abs(h.y-b.y)):0,m=Math.max(i.width,Math.round(b.width)),n=Math.max(i.height,Math.round(b.height)),o=(m-i.width)*j[0],p=(n-i.height)*j[1];(k>0||l>0||o||p)&&(e.push({id:g,type:"position",position:{x:f.position.x-k+o,y:f.position.y-l+p}}),c.get(g)?.forEach(b=>{a.some(a=>a.id===b.id)||e.push({id:b.id,type:"position",position:{x:b.position.x+k,y:b.position.y+l}})})),(i.width<b.width||i.height<b.height||k||l)&&e.push({id:g,type:"dimensions",setAttributes:!0,dimensions:{width:m+(k?j[0]*k-o:0),height:n+(l?j[1]*l-p:0)}})}),e}async function hq({delta:a,panZoom:b,transform:c,translateExtent:d,width:e,height:f}){if(!b||!a.x&&!a.y)return Promise.resolve(!1);let g=await b.setViewportConstrained({x:c[0]+a.x,y:c[1]+a.y,zoom:c[2]},[[0,0],[e,f]],d);return Promise.resolve(!!g&&(g.x!==c[0]||g.y!==c[1]||g.k!==c[2]))}function hr(a,b,c,d,e,f){let g=e,h=d.get(g)||new Map;d.set(g,h.set(c,b)),g=`${e}-${a}`;let i=d.get(g)||new Map;if(d.set(g,i.set(c,b)),f){g=`${e}-${a}-${f}`;let h=d.get(g)||new Map;d.set(g,h.set(c,b))}}function hs(a,b,c){for(let d of(a.clear(),b.clear(),c)){let{source:c,target:e,sourceHandle:f=null,targetHandle:g=null}=d,h={edgeId:d.id,source:c,target:e,sourceHandle:f,targetHandle:g},i=`${c}-${f}--${e}-${g}`;hr("source",h,`${e}-${g}--${c}-${f}`,a,c,f),hr("target",h,i,a,e,g),b.set(d.id,d)}}function ht(a,b,c,d,e,f=!1){let g=d.get(a);if(!g)return null;let h="strict"===e?g.internals.handleBounds?.[b]:[...g.internals.handleBounds?.source??[],...g.internals.handleBounds?.target??[]],i=(c?h?.find(a=>a.id===c):h?.[0])??null;return i&&f?{...i,...hf(g,i,i.position,!0)}:i}function hu(a,b){return a?a:b?.classList.contains("target")?"target":b?.classList.contains("source")?"source":null}let hv=()=>!0;function hw(a,{handle:b,connectionMode:c,fromNodeId:d,fromHandleId:e,fromType:f,doc:g,lib:h,flowId:i,isValidConnection:j=hv,nodeLookup:k}){let l="target"===f,m=b?g.querySelector(`.${h}-flow__handle[data-id="${i}-${b?.nodeId}-${b?.id}-${b?.type}"]`):null,{x:n,y:o}=g0(a),p=g.elementFromPoint(n,o),q=p?.classList.contains(`${h}-flow__handle`)?p:m,r={handleDomNode:q,isValid:!1,connection:null,toHandle:null};if(q){let a=hu(void 0,q),b=q.getAttribute("data-nodeid"),f=q.getAttribute("data-handleid"),g=q.classList.contains("connectable"),h=q.classList.contains("connectableend");if(!b||!a)return r;let i={source:l?b:d,sourceHandle:l?f:e,target:l?d:b,targetHandle:l?e:f};r.connection=i,r.isValid=g&&h&&(c===v.Strict?l&&"source"===a||!l&&"target"===a:b!==d||f!==e)&&j(i),r.toHandle=ht(b,a,f,k,c,!0)}return r}let hx=function(a,{connectionMode:b,connectionRadius:c,handleId:d,nodeId:e,edgeUpdaterType:f,isTarget:g,domNode:h,nodeLookup:i,lib:j,autoPanOnConnect:k,flowId:l,panBy:m,cancelConnection:n,onConnectStart:o,onConnect:p,onConnectEnd:q,isValidConnection:r=hv,onReconnectEnd:s,updateConnection:t,getTransform:u,getFromHandle:v,autoPanSpeed:w,dragThreshold:x=1,handleDomNode:y}){let z,B=g$(a.target),C=0,{x:D,y:E}=g0(a),F=hu(f,y),G=h?.getBoundingClientRect(),H=!1;if(!G||!F)return;let I=ht(e,F,d,i,b);if(!I)return;let J=g0(a,G),K=!1,L=null,M=!1,N=null,O={...I,nodeId:e,type:F,position:I.position},P=i.get(e),Q={inProgress:!0,isValid:null,from:hf(P,O,A.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:P,to:J,toHandle:null,toPosition:gs[O.position],toNode:null,pointer:J};function R(){H=!0,t(Q),o?.(a,{nodeId:e,handleId:d,handleType:F})}function S(a){var f,h;let n;if(!H){let{x:b,y:c}=g0(a),d=b-D,e=c-E;if(!(d*d+e*e>x*x))return;R()}if(!v()||!O)return void T(a);let o=u();z=function(a,b,c,d){let e=[],f=1/0;for(let g of function(a,b,c){let d=[],e={x:a.x-c,y:a.y-c,width:2*c,height:2*c};for(let a of b.values())gL(e,gI(a))>0&&d.push(a);return d}(a,c,b+250))for(let c of[...g.internals.handleBounds?.source??[],...g.internals.handleBounds?.target??[]]){if(d.nodeId===c.nodeId&&d.type===c.type&&d.id===c.id)continue;let{x:h,y:i}=hf(g,c,c.position,!0),j=Math.sqrt(Math.pow(h-a.x,2)+Math.pow(i-a.y,2));j>b||(j<f?(e=[{...c,x:h,y:i}],f=j):j===f&&e.push({...c,x:h,y:i}))}if(!e.length)return null;if(e.length>1){let a="source"===d.type?"target":"source";return e.find(b=>b.type===a)??e[0]}return e[0]}(gQ(J=g0(a,G),o,!1,[1,1]),c,i,O),K||(!function a(){if(!k||!G)return;let[b,c]=((a,b,c=15,d=40)=>[gE(a.x,d,b.width-d)*c,gE(a.y,d,b.height-d)*c])(J,G,w);m({x:b,y:c}),C=requestAnimationFrame(a)}(),K=!0);let p=hw(a,{handle:z,connectionMode:b,fromNodeId:e,fromHandleId:d,fromType:g?"target":"source",isValidConnection:r,doc:B,lib:j,flowId:l,nodeLookup:i});N=p.handleDomNode,L=p.connection,f=!!z,h=p.isValid,n=null,h?n=!0:f&&!h&&(n=!1),M=n;let q=i.get(e),s=q?hf(q,O,A.Left,!0):Q.from,y={...Q,from:s,isValid:M,to:p.toHandle&&M?gR({x:p.toHandle.x,y:p.toHandle.y},o):J,toHandle:p.toHandle,toPosition:M&&p.toHandle?p.toHandle.position:gs[O.position],toNode:p.toHandle?i.get(p.toHandle.nodeId):null,pointer:J};t(y),Q=y}function T(a){if(!("touches"in a)||!(a.touches.length>0)){if(H){(z||N)&&L&&M&&p?.(L);let{inProgress:b,...c}=Q,d={...c,toPosition:Q.toHandle?Q.toPosition:null};q?.(a,d),f&&s?.(a,d)}n(),cancelAnimationFrame(C),K=!1,M=!1,L=null,N=null,B.removeEventListener("mousemove",S),B.removeEventListener("mouseup",T),B.removeEventListener("touchmove",S),B.removeEventListener("touchend",T)}}0===x&&R(),B.addEventListener("mousemove",S),B.addEventListener("mouseup",T),B.addEventListener("touchmove",S),B.addEventListener("touchend",T)};(q=B||(B={})).Line="line",q.Handle="handle";var hy=c(7881);let hz=a=>{let b,c=new Set,d=(a,d)=>{let e="function"==typeof a?a(b):a;if(!Object.is(e,b)){let a=b;b=(null!=d?d:"object"!=typeof e||null===e)?e:Object.assign({},b,e),c.forEach(c=>c(b,a))}},e=()=>b,f={setState:d,getState:e,getInitialState:()=>g,subscribe:a=>(c.add(a),()=>c.delete(a)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),c.clear()}},g=b=a(d,e,f);return f},{useDebugValue:hA}=E,{useSyncExternalStoreWithSelector:hB}=hy,hC=a=>a;function hD(a,b=hC,c){let d=hB(a.subscribe,a.getState,a.getServerState||a.getInitialState,b,c);return hA(d),d}let hE=(a,b)=>{let c=a?hz(a):hz,d=(a,d=b)=>hD(c,a,d);return Object.assign(d,c),d};function hF(a,b){if(Object.is(a,b))return!0;if("object"!=typeof a||null===a||"object"!=typeof b||null===b)return!1;if(a instanceof Map&&b instanceof Map){if(a.size!==b.size)return!1;for(let[c,d]of a)if(!Object.is(d,b.get(c)))return!1;return!0}if(a instanceof Set&&b instanceof Set){if(a.size!==b.size)return!1;for(let c of a)if(!b.has(c))return!1;return!0}let c=Object.keys(a);if(c.length!==Object.keys(b).length)return!1;for(let d of c)if(!Object.prototype.hasOwnProperty.call(b,d)||!Object.is(a[d],b[d]))return!1;return!0}let hG=(0,E.createContext)(null),hH=hG.Provider,hI="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function hJ(a,b){let c=(0,E.useContext)(hG);if(null===c)throw Error(hI);return hD(c,a,b)}function hK(){let a=(0,E.useContext)(hG);if(null===a)throw Error(hI);return(0,E.useMemo)(()=>({getState:a.getState,setState:a.setState,subscribe:a.subscribe}),[a])}let hL={display:"none"},hM={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},hN="react-flow__node-desc",hO="react-flow__edge-desc",hP=a=>a.ariaLiveMessage,hQ=a=>a.ariaLabelConfig;function hR({rfId:a}){let b=hJ(hP);return(0,D.jsx)("div",{id:`react-flow__aria-live-${a}`,"aria-live":"assertive","aria-atomic":"true",style:hM,children:b})}function hS({rfId:a,disableKeyboardA11y:b}){let c=hJ(hQ);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("div",{id:`${hN}-${a}`,style:hL,children:b?c["node.a11yDescription.default"]:c["node.a11yDescription.keyboardDisabled"]}),(0,D.jsx)("div",{id:`${hO}-${a}`,style:hL,children:c["edge.a11yDescription.default"]}),!b&&(0,D.jsx)(hR,{rfId:a})]})}let hT=(0,E.forwardRef)(({position:a="top-left",children:b,className:c,style:d,...e},f)=>{let g=`${a}`.split("-");return(0,D.jsx)("div",{className:ee(["react-flow__panel",c,...g]),style:d,ref:f,...e,children:b})});function hU({proOptions:a,position:b="bottom-right"}){return a?.hideAttribution?null:(0,D.jsx)(hT,{position:b,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:(0,D.jsx)("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}hT.displayName="Panel";let hV=a=>{let b=[],c=[];for(let[,c]of a.nodeLookup)c.selected&&b.push(c.internals.userNode);for(let[,b]of a.edgeLookup)b.selected&&c.push(b);return{selectedNodes:b,selectedEdges:c}},hW=a=>a.id;function hX(a,b){return hF(a.selectedNodes.map(hW),b.selectedNodes.map(hW))&&hF(a.selectedEdges.map(hW),b.selectedEdges.map(hW))}function hY({onSelectionChange:a}){hK();let{selectedNodes:b,selectedEdges:c}=hJ(hV,hX);return null}let hZ=a=>!!a.onSelectionChangeHandlers;function h$({onSelectionChange:a}){let b=hJ(hZ);return a||b?(0,D.jsx)(hY,{onSelectionChange:a}):null}let h_=[0,0],h0={x:0,y:0,zoom:1},h1=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode","rfId"],h2=a=>({setNodes:a.setNodes,setEdges:a.setEdges,setMinZoom:a.setMinZoom,setMaxZoom:a.setMaxZoom,setTranslateExtent:a.setTranslateExtent,setNodeExtent:a.setNodeExtent,reset:a.reset,setDefaultNodesAndEdges:a.setDefaultNodesAndEdges}),h3={translateExtent:go,nodeOrigin:h_,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function h4(a){let{setNodes:b,setEdges:c,setMinZoom:d,setMaxZoom:e,setTranslateExtent:f,setNodeExtent:g,reset:h,setDefaultNodesAndEdges:i}=hJ(h2,hF),j=hK(),k=(0,E.useRef)(h3);return(0,E.useEffect)(()=>{for(let h of h1){let i=a[h];if(i!==k.current[h]&&void 0!==a[h])if("nodes"===h)b(i);else if("edges"===h)c(i);else if("minZoom"===h)d(i);else if("maxZoom"===h)e(i);else if("translateExtent"===h)f(i);else if("nodeExtent"===h)g(i);else if("ariaLabelConfig"===h)j.setState({ariaLabelConfig:{...gq,...i||{}}});else"fitView"===h?j.setState({fitViewQueued:i}):"fitViewOptions"===h?j.setState({fitViewOptions:i}):j.setState({[h]:i})}k.current=a},h1.map(b=>a[b])),null}let h5="u">typeof document?document:null;function h6(a=null,b={target:h5,actInsideInputWithModifier:!0}){let[c,d]=(0,E.useState)(!1);(0,E.useRef)(!1),(0,E.useRef)(new Set([]));let[e,f]=(0,E.useMemo)(()=>{if(null!==a){let b=(Array.isArray(a)?a:[a]).filter(a=>"string"==typeof a).map(a=>a.replace("+","\n").replace("\n\n","\n+").split("\n")),c=b.reduce((a,b)=>a.concat(...b),[]);return[b,c]}return[[],[]]},[a]);return c}function h7(a,b){let c=[],d=new Map,e=[];for(let b of a)if("add"===b.type){e.push(b);continue}else if("remove"===b.type||"replace"===b.type)d.set(b.id,[b]);else{let a=d.get(b.id);a?a.push(b):d.set(b.id,[b])}for(let a of b){let b=d.get(a.id);if(!b){c.push(a);continue}if("remove"===b[0].type)continue;if("replace"===b[0].type){c.push({...b[0].item});continue}let e={...a};for(let a of b){var f=a,g=e;switch(f.type){case"select":g.selected=f.selected;break;case"position":void 0!==f.position&&(g.position=f.position),void 0!==f.dragging&&(g.dragging=f.dragging);break;case"dimensions":void 0!==f.dimensions&&(g.measured={...f.dimensions},f.setAttributes&&((!0===f.setAttributes||"width"===f.setAttributes)&&(g.width=f.dimensions.width),(!0===f.setAttributes||"height"===f.setAttributes)&&(g.height=f.dimensions.height))),"boolean"==typeof f.resizing&&(g.resizing=f.resizing)}}c.push(e)}return e.length&&e.forEach(a=>{void 0!==a.index?c.splice(a.index,0,{...a.item}):c.push({...a.item})}),c}function h8(a,b){return{id:a,type:"select",selected:b}}function h9(a,b=new Set,c=!1){let d=[];for(let[e,f]of a){let a=b.has(e);(void 0!==f.selected||a)&&f.selected!==a&&(c&&(f.selected=a),d.push(h8(f.id,a)))}return d}function ia({items:a=[],lookup:b}){let c=[],d=new Map(a.map(a=>[a.id,a]));for(let[d,e]of a.entries()){let a=b.get(e.id),f=a?.internals?.userNode??a;void 0!==f&&f!==e&&c.push({id:e.id,item:e,type:"replace"}),void 0===f&&c.push({item:e,type:"add",index:d})}for(let[a]of b)void 0===d.get(a)&&c.push({id:a,type:"remove"});return c}function ib(a){return{id:a.id,type:"remove"}}let ic=a=>"id"in a&&"position"in a&&!("source"in a)&&!("target"in a);function id(a){return(0,E.forwardRef)(a)}let ie=E.useEffect;function ig(a){let[b,c]=(0,E.useState)(BigInt(0)),[d]=(0,E.useState)(()=>{var a;let b;return a=()=>c(a=>a+BigInt(1)),b=[],{get:()=>b,reset:()=>{b=[]},push:c=>{b.push(c),a()}}});return ie(()=>{let b=d.get();b.length&&(a(b),d.reset())},[b]),d}let ih=(0,E.createContext)(null);function ii({children:a}){let b=hK(),c=ig((0,E.useCallback)(a=>{let{nodes:c=[],setNodes:d,hasDefaultNodes:e,onNodesChange:f,nodeLookup:g,fitViewQueued:h,onNodesChangeMiddlewareMap:i}=b.getState(),j=c;for(let b of a)j="function"==typeof b?b(j):b;let k=ia({items:j,lookup:g});for(let a of i.values())k=a(k);e&&d(j),k.length>0?f?.(k):h&&window.requestAnimationFrame(()=>{let{fitViewQueued:a,nodes:c,setNodes:d}=b.getState();a&&d(c)})},[])),d=ig((0,E.useCallback)(a=>{let{edges:c=[],setEdges:d,hasDefaultEdges:e,onEdgesChange:f,edgeLookup:g}=b.getState(),h=c;for(let b of a)h="function"==typeof b?b(h):b;e?d(h):f&&f(ia({items:h,lookup:g}))},[])),e=(0,E.useMemo)(()=>({nodeQueue:c,edgeQueue:d}),[]);return(0,D.jsx)(ih.Provider,{value:e,children:a})}let ij=a=>!!a.panZoom;function ik(){let a,b=(a=hK(),(0,E.useMemo)(()=>({zoomIn:b=>{let{panZoom:c}=a.getState();return c?c.scaleBy(1.2,{duration:b?.duration}):Promise.resolve(!1)},zoomOut:b=>{let{panZoom:c}=a.getState();return c?c.scaleBy(1/1.2,{duration:b?.duration}):Promise.resolve(!1)},zoomTo:(b,c)=>{let{panZoom:d}=a.getState();return d?d.scaleTo(b,{duration:c?.duration}):Promise.resolve(!1)},getZoom:()=>a.getState().transform[2],setViewport:async(b,c)=>{let{transform:[d,e,f],panZoom:g}=a.getState();return g?(await g.setViewport({x:b.x??d,y:b.y??e,zoom:b.zoom??f},c),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{let[b,c,d]=a.getState().transform;return{x:b,y:c,zoom:d}},setCenter:async(b,c,d)=>a.getState().setCenter(b,c,d),fitBounds:async(b,c)=>{let{width:d,height:e,minZoom:f,maxZoom:g,panZoom:h}=a.getState(),i=gT(b,d,e,f,g,c?.padding??.1);return h?(await h.setViewport(i,{duration:c?.duration,ease:c?.ease,interpolate:c?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(b,c={})=>{let{transform:d,snapGrid:e,snapToGrid:f,domNode:g}=a.getState();if(!g)return b;let{x:h,y:i}=g.getBoundingClientRect(),j={x:b.x-h,y:b.y-i},k=c.snapGrid??e;return gQ(j,d,c.snapToGrid??f,k)},flowToScreenPosition:b=>{let{transform:c,domNode:d}=a.getState();if(!d)return b;let{x:e,y:f}=d.getBoundingClientRect(),g=gR(b,c);return{x:g.x+e,y:g.y+f}}}),[])),c=hK(),d=function(){let a=(0,E.useContext)(ih);if(!a)throw Error("useBatchContext must be used within a BatchProvider");return a}(),e=hJ(ij),f=(0,E.useMemo)(()=>{let a=a=>c.getState().nodeLookup.get(a),b=a=>{d.nodeQueue.push(a)},e=a=>{d.edgeQueue.push(a)},f=a=>{let{nodeLookup:b,nodeOrigin:d}=c.getState(),e=ic(a)?a:b.get(a.id),f=e.parentId?function(a,b={width:0,height:0},c,d,e){let f={...a},g=d.get(c);if(g){let a=g.origin||e;f.x+=g.internals.positionAbsolute.x-(b.width??0)*a[0],f.y+=g.internals.positionAbsolute.y-(b.height??0)*a[1]}return f}(e.position,e.measured,e.parentId,b,d):e.position;return gI({...e,position:f,width:e.measured?.width??e.width,height:e.measured?.height??e.height})},g=(a,c,d={replace:!1})=>{b(b=>b.map(b=>{if(b.id===a){let a="function"==typeof c?c(b):c;return d.replace&&ic(a)?a:{...b,...a}}return b}))},h=(a,b,c={replace:!1})=>{e(d=>d.map(d=>{if(d.id===a){let a="function"==typeof b?b(d):b;return c.replace&&gu(a)?a:{...d,...a}}return d}))};return{getNodes:()=>c.getState().nodes.map(a=>({...a})),getNode:b=>a(b)?.internals.userNode,getInternalNode:a,getEdges:()=>{let{edges:a=[]}=c.getState();return a.map(a=>({...a}))},getEdge:a=>c.getState().edgeLookup.get(a),setNodes:b,setEdges:e,addNodes:a=>{let b=Array.isArray(a)?a:[a];d.nodeQueue.push(a=>[...a,...b])},addEdges:a=>{let b=Array.isArray(a)?a:[a];d.edgeQueue.push(a=>[...a,...b])},toObject:()=>{let{nodes:a=[],edges:b=[],transform:d}=c.getState(),[e,f,g]=d;return{nodes:a.map(a=>({...a})),edges:b.map(a=>({...a})),viewport:{x:e,y:f,zoom:g}}},deleteElements:async({nodes:a=[],edges:b=[]})=>{let{nodes:d,edges:e,onNodesDelete:f,onEdgesDelete:g,triggerNodeChanges:h,triggerEdgeChanges:i,onDelete:j,onBeforeDelete:k}=c.getState(),{nodes:l,edges:m}=await gA({nodesToRemove:a,edgesToRemove:b,nodes:d,edges:e,onBeforeDelete:k}),n=m.length>0,o=l.length>0;if(n){let a=m.map(ib);g?.(m),i(a)}if(o){let a=l.map(ib);f?.(l),h(a)}return(o||n)&&j?.({nodes:l,edges:m}),{deletedNodes:l,deletedEdges:m}},getIntersectingNodes:(a,b=!0,d)=>{let e=gM(a),g=e?a:f(a),h=void 0!==d;return g?(d||c.getState().nodes).filter(d=>{let f=c.getState().nodeLookup.get(d.id);if(f&&!e&&(d.id===a.id||!f.internals.positionAbsolute))return!1;let i=gI(h?d:f),j=gL(i,g);return b&&j>0||j>=i.width*i.height||j>=g.width*g.height}):[]},isNodeIntersecting:(a,b,c=!0)=>{let d=gM(a)?a:f(a);if(!d)return!1;let e=gL(d,b);return c&&e>0||e>=b.width*b.height||e>=d.width*d.height},updateNode:g,updateNodeData:(a,b,c={replace:!1})=>{g(a,a=>{let d="function"==typeof b?b(a):b;return c.replace?{...a,data:d}:{...a,data:{...a.data,...d}}},c)},updateEdge:h,updateEdgeData:(a,b,c={replace:!1})=>{h(a,a=>{let d="function"==typeof b?b(a):b;return c.replace?{...a,data:d}:{...a,data:{...a.data,...d}}},c)},getNodesBounds:a=>{let{nodeLookup:b,nodeOrigin:d}=c.getState();return((a,b={nodeOrigin:[0,0]})=>0===a.length?{x:0,y:0,width:0,height:0}:gH(a.reduce((a,c)=>{let d="string"==typeof c,e=b.nodeLookup||d?void 0:c;return b.nodeLookup&&(e=d?b.nodeLookup.get(c):gv(c)?c:b.nodeLookup.get(c.id)),gF(a,e?gJ(e,b.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})))(a,{nodeLookup:b,nodeOrigin:d})},getHandleConnections:({type:a,id:b,nodeId:d})=>Array.from(c.getState().connectionLookup.get(`${d}-${a}${b?`-${b}`:""}`)?.values()??[]),getNodeConnections:({type:a,handleId:b,nodeId:d})=>Array.from(c.getState().connectionLookup.get(`${d}${a?b?`-${a}-${b}`:`-${a}`:""}`)?.values()??[]),fitView:async a=>{let b,e,f=c.getState().fitViewResolver??{promise:new Promise((a,c)=>{b=a,e=c}),resolve:b,reject:e};return c.setState({fitViewQueued:!0,fitViewOptions:a,fitViewResolver:f}),d.nodeQueue.push(a=>[...a]),f.promise}}},[]);return(0,E.useMemo)(()=>({...f,...b,viewportInitialized:e}),[e])}let il,im={position:"absolute",width:"100%",height:"100%",top:0,left:0},io=a=>({userSelectionActive:a.userSelectionActive,lib:a.lib,connectionInProgress:a.connection.inProgress});function ip({onPaneContextMenu:a,zoomOnScroll:b=!0,zoomOnPinch:c=!0,panOnScroll:d=!1,panOnScrollSpeed:e=.5,panOnScrollMode:f=w.Free,zoomOnDoubleClick:g=!0,panOnDrag:h=!0,defaultViewport:i,translateExtent:j,minZoom:k,maxZoom:l,zoomActivationKeyCode:m,preventScrolling:n=!0,children:o,noWheelClassName:p,noPanClassName:q,onViewportChange:r,isControlledViewport:s,paneClickDistance:t,selectionOnDrag:u}){let v=hK(),x=(0,E.useRef)(null),{userSelectionActive:y,lib:z,connectionInProgress:A}=hJ(io,hF);return h6(m),(0,E.useRef)(),hK(),(0,E.useCallback)(a=>{r?.({x:a[0],y:a[1],zoom:a[2]}),s||v.setState({transform:a})},[r,s]),(0,D.jsx)("div",{className:"react-flow__renderer",ref:x,style:im,children:o})}let iq=a=>({userSelectionActive:a.userSelectionActive,userSelectionRect:a.userSelectionRect});function ir(){let{userSelectionActive:a,userSelectionRect:b}=hJ(iq,hF);return a&&b?(0,D.jsx)("div",{className:"react-flow__selection react-flow__container",style:{width:b.width,height:b.height,transform:`translate(${b.x}px, ${b.y}px)`}}):null}let is=(a,b)=>c=>{c.target===b.current&&a?.(c)},it=a=>({userSelectionActive:a.userSelectionActive,elementsSelectable:a.elementsSelectable,connectionInProgress:a.connection.inProgress,dragging:a.paneDragging});function iu({isSelecting:a,selectionKeyPressed:b,selectionMode:c=x.Full,panOnDrag:d,paneClickDistance:e,selectionOnDrag:f,onSelectionStart:g,onSelectionEnd:h,onPaneClick:i,onPaneContextMenu:j,onPaneScroll:k,onPaneMouseEnter:l,onPaneMouseMove:m,onPaneMouseLeave:n,children:o}){let p=hK(),{userSelectionActive:q,elementsSelectable:r,dragging:s,connectionInProgress:t}=hJ(it,hF),u=r&&(a||q),v=(0,E.useRef)(null),w=(0,E.useRef)(),y=(0,E.useRef)(new Set),z=(0,E.useRef)(new Set),A=(0,E.useRef)(!1),B=a=>{if(A.current||t){A.current=!1;return}i?.(a),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},C=!0===d||Array.isArray(d)&&d.includes(0);return(0,D.jsxs)("div",{className:ee(["react-flow__pane",{draggable:C,dragging:s,selection:a}]),onClick:u?void 0:is(B,v),onContextMenu:is(a=>{Array.isArray(d)&&d?.includes(2)?a.preventDefault():j?.(a)},v),onWheel:is(k?a=>k(a):void 0,v),onPointerEnter:u?void 0:l,onPointerMove:u?a=>{let{userSelectionRect:d,transform:f,nodeLookup:h,edgeLookup:i,connectionLookup:j,triggerNodeChanges:k,triggerEdgeChanges:l,defaultEdgeOptions:m,resetSelectedElements:n}=p.getState();if(!w.current||!d)return;let{x:o,y:q}=g0(a.nativeEvent,w.current),{startX:r,startY:s}=d;if(!A.current){if(Math.hypot(o-r,q-s)<=(b?0:e))return;n(),g?.(a)}A.current=!0;let t={startX:r,startY:s,x:o<r?o:r,y:q<s?q:s,width:Math.abs(o-r),height:Math.abs(q-s)},u=y.current,v=z.current;y.current=new Set(gy(h,t,f,c===x.Partial,!0).map(a=>a.id)),z.current=new Set;let B=m?.selectable??!0;for(let a of y.current){let b=j.get(a);if(b)for(let{edgeId:a}of b.values()){let b=i.get(a);b&&(b.selectable??B)&&z.current.add(a)}}gY(u,y.current)||k(h9(h,y.current,!0)),gY(v,z.current)||l(h9(i,z.current)),p.setState({userSelectionRect:t,userSelectionActive:!0,nodesSelectionActive:!1})}:m,onPointerUp:u?a=>{0===a.button&&(a.target?.releasePointerCapture?.(a.pointerId),!q&&a.target===v.current&&p.getState().userSelectionRect&&B?.(a),p.setState({userSelectionActive:!1,userSelectionRect:null}),A.current&&(h?.(a),p.setState({nodesSelectionActive:y.current.size>0})))}:void 0,onPointerDownCapture:u?c=>{let{domNode:d}=p.getState();if(w.current=d?.getBoundingClientRect(),!w.current)return;let e=c.target===v.current;if(!e&&c.target.closest(".nokey")||!a||!(f&&e||b)||0!==c.button||!c.isPrimary)return;c.target?.setPointerCapture?.(c.pointerId),A.current=!1;let{x:g,y:h}=g0(c.nativeEvent,w.current);p.setState({userSelectionRect:{width:0,height:0,startX:g,startY:h,x:g,y:h}}),e||(c.stopPropagation(),c.preventDefault())}:void 0,onClickCapture:u?a=>{A.current&&(a.stopPropagation(),A.current=!1)}:void 0,onPointerLeave:n,ref:v,style:im,children:[o,(0,D.jsx)(ir,{})]})}function iv({id:a,store:b,unselect:c=!1,nodeRef:d}){let e,{addSelectedNodes:f,unselectNodesAndEdges:g,multiSelectionActive:h,nodeLookup:i,onError:j}=b.getState(),k=i.get(a);k?(b.setState({nodesSelectionActive:!1}),k.selected?(c||k.selected&&h)&&(g({nodes:[k],edges:[]}),requestAnimationFrame(()=>d?.current?.blur())):f([a])):j?.("012",(e=a,`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`))}function iw({nodeRef:a,disabled:b=!1,noDragClassName:c,handleSelector:d,nodeId:e,isSelectable:f,nodeClickDistance:g}){hK();let[h,i]=(0,E.useState)(!1);return(0,E.useRef)(),h}function ix(){let a=hK();return(0,E.useCallback)(b=>{let{nodeExtent:c,snapToGrid:d,snapGrid:e,nodesDraggable:f,onError:g,updateNodePositions:h,nodeLookup:i,nodeOrigin:j}=a.getState(),k=new Map,l=a=>a.selected&&(a.draggable||f&&void 0===a.draggable),m=d?e[0]:5,n=d?e[1]:5,o=b.direction.x*m*b.factor,p=b.direction.y*n*b.factor;for(let[,a]of i){if(!l(a))continue;let b={x:a.internals.positionAbsolute.x+o,y:a.internals.positionAbsolute.y+p};d&&(b=gP(b,e));let{position:f,positionAbsolute:h}=function({nodeId:a,nextPosition:b,nodeLookup:c,nodeOrigin:d=[0,0],nodeExtent:e,onError:f}){let g=c.get(a),h=g.parentId?c.get(g.parentId):void 0,{x:i,y:j}=h?h.internals.positionAbsolute:{x:0,y:0},k=g.origin??d,l=g.extent||e;if("parent"!==g.extent||g.expandParent)h&&gV(g.extent)&&(l=[[g.extent[0][0]+i,g.extent[0][1]+j],[g.extent[1][0]+i,g.extent[1][1]+j]]);else if(h){let a=h.measured.width,b=h.measured.height;a&&b&&(l=[[i,j],[i+a,j+b]])}else f?.("005",gm());let m=gV(l)?gC(b,l,g.measured):b;return(void 0===g.measured.width||void 0===g.measured.height)&&f?.("015",gn()),{position:{x:m.x-i+(g.measured.width??0)*k[0],y:m.y-j+(g.measured.height??0)*k[1]},positionAbsolute:m}}({nodeId:a.id,nextPosition:b,nodeLookup:i,nodeExtent:c,nodeOrigin:j,onError:g});a.position=f,a.internals.positionAbsolute=h,k.set(a.id,a)}h(k)},[])}let iy=(0,E.createContext)(null),iz=iy.Provider;iy.Consumer;let iA=a=>({connectOnClick:a.connectOnClick,noPanClassName:a.noPanClassName,rfId:a.rfId}),iB=(0,E.memo)(id(function({type:a="source",position:b=A.Top,isValidConnection:c,isConnectable:d=!0,isConnectableStart:e=!0,isConnectableEnd:f=!0,id:g,onConnect:h,children:i,className:j,onMouseDown:k,onTouchStart:l,...m},n){let o=g||null,p="target"===a,q=hK(),r=(0,E.useContext)(iy),{connectOnClick:s,noPanClassName:t,rfId:u}=hJ(iA,hF),{connectingFrom:w,connectingTo:x,clickConnecting:y,isPossibleEndHandle:z,connectionInProcess:B,clickConnectionInProcess:C,valid:F}=hJ(b=>{let{connectionClickStartHandle:c,connectionMode:d,connection:e}=b,{fromHandle:f,toHandle:g,isValid:h}=e,i=g?.nodeId===r&&g?.id===o&&g?.type===a;return{connectingFrom:f?.nodeId===r&&f?.id===o&&f?.type===a,connectingTo:i,clickConnecting:c?.nodeId===r&&c?.id===o&&c?.type===a,isPossibleEndHandle:d===v.Strict?f?.type!==a:r!==f?.nodeId||o!==f?.id,connectionInProcess:!!f,clickConnectionInProcess:!!c,valid:i&&h}},hF);r||q.getState().onError?.("010","Handle: No node id found. Make sure to only use a Handle inside a custom Node.");let G=a=>{let{defaultEdgeOptions:b,onConnect:c,hasDefaultEdges:d}=q.getState(),e={...b,...a};if(d){let{edges:a,setEdges:b}=q.getState();b(((a,b,c={})=>{let d,e;if(!a.source||!a.target)return gO("006","Can't create edge. An edge needs a source and a target."),b;let f=c.getEdgeId||g7;return(e=d=gu(a)?{...a}:{...a,id:f(a)},b.some(a=>a.source===e.source&&a.target===e.target&&(a.sourceHandle===e.sourceHandle||!a.sourceHandle&&!e.sourceHandle)&&(a.targetHandle===e.targetHandle||!a.targetHandle&&!e.targetHandle)))?b:(null===d.sourceHandle&&delete d.sourceHandle,null===d.targetHandle&&delete d.targetHandle,b.concat(d))})(e,a))}c?.(e),h?.(e)},H=a=>{if(!r)return;let b="clientX"in a.nativeEvent;if(e&&(b&&0===a.button||!b)){let b=q.getState();hx(a.nativeEvent,{handleDomNode:a.currentTarget,autoPanOnConnect:b.autoPanOnConnect,connectionMode:b.connectionMode,connectionRadius:b.connectionRadius,domNode:b.domNode,nodeLookup:b.nodeLookup,lib:b.lib,isTarget:p,handleId:o,nodeId:r,flowId:b.rfId,panBy:b.panBy,cancelConnection:b.cancelConnection,onConnectStart:b.onConnectStart,onConnectEnd:(...a)=>q.getState().onConnectEnd?.(...a),updateConnection:b.updateConnection,onConnect:G,isValidConnection:c||((...a)=>q.getState().isValidConnection?.(...a)??!0),getTransform:()=>q.getState().transform,getFromHandle:()=>q.getState().connection.fromHandle,autoPanSpeed:b.autoPanSpeed,dragThreshold:b.connectionDragThreshold})}b?k?.(a):l?.(a)};return(0,D.jsx)("div",{"data-handleid":o,"data-nodeid":r,"data-handlepos":b,"data-id":`${u}-${r}-${o}-${a}`,className:ee(["react-flow__handle",`react-flow__handle-${b}`,"nodrag",t,j,{source:!p,target:p,connectable:d,connectablestart:e,connectableend:f,clickconnecting:y,connectingfrom:w,connectingto:x,valid:F,connectionindicator:d&&(!B||z)&&(B||C?f:e)}]),onMouseDown:H,onTouchStart:H,onClick:s?b=>{let{onClickConnectStart:d,onClickConnectEnd:f,connectionClickStartHandle:g,connectionMode:h,isValidConnection:i,lib:j,rfId:k,nodeLookup:l,connection:m}=q.getState();if(!r||!g&&!e)return;if(!g){d?.(b.nativeEvent,{nodeId:r,handleId:o,handleType:a}),q.setState({connectionClickStartHandle:{nodeId:r,type:a,id:o}});return}let n=g$(b.target),p=c||i,{connection:s,isValid:t}=hw(b.nativeEvent,{handle:{nodeId:r,id:o,type:a},connectionMode:h,fromNodeId:g.nodeId,fromHandleId:g.id||null,fromType:g.type,isValidConnection:p,flowId:k,doc:n,lib:j,nodeLookup:l});t&&s&&G(s);let u=structuredClone(m);delete u.inProgress,u.toPosition=u.toHandle?u.toHandle.position:null,f?.(b,u),q.setState({connectionClickStartHandle:null})}:void 0,ref:n,...m,children:i})})),iC={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},iD={input:function({data:a,isConnectable:b,sourcePosition:c=A.Bottom}){return(0,D.jsxs)(D.Fragment,{children:[a?.label,(0,D.jsx)(iB,{type:"source",position:c,isConnectable:b})]})},default:function({data:a,isConnectable:b,targetPosition:c=A.Top,sourcePosition:d=A.Bottom}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(iB,{type:"target",position:c,isConnectable:b}),a?.label,(0,D.jsx)(iB,{type:"source",position:d,isConnectable:b})]})},output:function({data:a,isConnectable:b,targetPosition:c=A.Top}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(iB,{type:"target",position:c,isConnectable:b}),a?.label]})},group:function(){return null}},iE=a=>{let{width:b,height:c,x:d,y:e}=gx(a.nodeLookup,{filter:a=>!!a.selected});return{width:gN(b)?b:null,height:gN(c)?c:null,userSelectionActive:a.userSelectionActive,transformString:`translate(${a.transform[0]}px,${a.transform[1]}px) scale(${a.transform[2]}) translate(${d}px,${e}px)`}};function iF({onSelectionContextMenu:a,noPanClassName:b,disableKeyboardA11y:c}){let d=hK(),{width:e,height:f,transformString:g,userSelectionActive:h}=hJ(iE,hF),i=ix(),j=(0,E.useRef)(null),k=!h&&null!==e&&null!==f;if(iw({nodeRef:j,disabled:!k}),!k)return null;let l=a?b=>{a(b,d.getState().nodes.filter(a=>a.selected))}:void 0;return(0,D.jsx)("div",{className:ee(["react-flow__nodesselection","react-flow__container",b]),style:{transform:g},children:(0,D.jsx)("div",{ref:j,className:"react-flow__nodesselection-rect",onContextMenu:l,tabIndex:c?void 0:-1,onKeyDown:c?void 0:a=>{Object.prototype.hasOwnProperty.call(iC,a.key)&&(a.preventDefault(),i({direction:iC[a.key],factor:a.shiftKey?4:1}))},style:{width:e,height:f}})})}let iG,iH=a=>({nodesSelectionActive:a.nodesSelectionActive,userSelectionActive:a.userSelectionActive});function iI({children:a,onPaneClick:b,onPaneMouseEnter:c,onPaneMouseMove:d,onPaneMouseLeave:e,onPaneContextMenu:f,onPaneScroll:g,paneClickDistance:h,deleteKeyCode:i,selectionKeyCode:j,selectionOnDrag:k,selectionMode:l,onSelectionStart:m,onSelectionEnd:n,multiSelectionKeyCode:o,panActivationKeyCode:p,zoomActivationKeyCode:q,elementsSelectable:r,zoomOnScroll:s,zoomOnPinch:t,panOnScroll:u,panOnScrollSpeed:v,panOnScrollMode:w,zoomOnDoubleClick:x,panOnDrag:y,defaultViewport:z,translateExtent:A,minZoom:B,maxZoom:C,preventScrolling:E,onSelectionContextMenu:F,noWheelClassName:G,noPanClassName:H,disableKeyboardA11y:I,onViewportChange:J,isControlledViewport:K}){let{nodesSelectionActive:L,userSelectionActive:M}=hJ(iH,hF),N=h6(j,{target:iG}),O=h6(p,{target:iG}),P=O||y,Q=O||u,R=k&&!0!==P,S=N||M||R;return!function({deleteKeyCode:a,multiSelectionKeyCode:b}){hK();let{deleteElements:c}=ik();h6(a,{actInsideInputWithModifier:!1}),h6(b,{target:il})}({deleteKeyCode:i,multiSelectionKeyCode:o}),(0,D.jsx)(ip,{onPaneContextMenu:f,elementsSelectable:r,zoomOnScroll:s,zoomOnPinch:t,panOnScroll:Q,panOnScrollSpeed:v,panOnScrollMode:w,zoomOnDoubleClick:x,panOnDrag:!N&&P,defaultViewport:z,translateExtent:A,minZoom:B,maxZoom:C,zoomActivationKeyCode:q,preventScrolling:E,noWheelClassName:G,noPanClassName:H,onViewportChange:J,isControlledViewport:K,paneClickDistance:h,selectionOnDrag:R,children:(0,D.jsxs)(iu,{onSelectionStart:m,onSelectionEnd:n,onPaneClick:b,onPaneMouseEnter:c,onPaneMouseMove:d,onPaneMouseLeave:e,onPaneContextMenu:f,onPaneScroll:g,panOnDrag:P,isSelecting:!!S,selectionMode:l,selectionKeyPressed:N,paneClickDistance:h,selectionOnDrag:R,children:[a,L&&(0,D.jsx)(iF,{onSelectionContextMenu:F,noPanClassName:H,disableKeyboardA11y:I})]})})}iI.displayName="FlowRenderer";let iJ=(0,E.memo)(iI),iK=a=>a.updateNodeInternals;var iL=(0,E.memo)(function({id:a,onClick:b,onMouseEnter:c,onMouseMove:d,onMouseLeave:e,onContextMenu:f,onDoubleClick:g,nodesDraggable:h,elementsSelectable:i,nodesConnectable:j,nodesFocusable:k,resizeObserver:l,noDragClassName:m,noPanClassName:n,disableKeyboardA11y:o,rfId:p,nodeTypes:q,nodeClickDistance:r,onError:s}){let t,{node:u,internals:v,isParent:w}=hJ(b=>{let c=b.nodeLookup.get(a),d=b.parentLookup.has(a);return{node:c,internals:c.internals,isParent:d}},hF),x=u.type||"default",y=q?.[x]||iD[x];void 0===y&&(s?.("003",(t=x,`Node type "${t}" not found. Using fallback type "default".`)),x="default",y=q?.default||iD.default);let z=!!(u.draggable||h&&void 0===u.draggable),A=!!(u.selectable||i&&void 0===u.selectable),B=!!(u.connectable||j&&void 0===u.connectable),C=!!(u.focusable||k&&void 0===u.focusable),F=hK(),G=gX(u),H=function({node:a,nodeType:b,hasDimensions:c,resizeObserver:d}){hK();let e=(0,E.useRef)(null);return(0,E.useRef)(null),(0,E.useRef)(a.sourcePosition),(0,E.useRef)(a.targetPosition),(0,E.useRef)(b),c&&a.internals.handleBounds,e}({node:u,nodeType:x,hasDimensions:G,resizeObserver:l}),I=iw({nodeRef:H,disabled:u.hidden||!z,noDragClassName:m,handleSelector:u.dragHandle,nodeId:a,isSelectable:A,nodeClickDistance:r}),J=ix();if(u.hidden)return null;let K=gW(u),L=void 0===u.internals.handleBounds?{width:u.width??u.initialWidth??u.style?.width,height:u.height??u.initialHeight??u.style?.height}:{width:u.width??u.style?.width,height:u.height??u.style?.height},M=A||z||b||c||d||e,N=c?a=>c(a,{...v.userNode}):void 0,O=d?a=>d(a,{...v.userNode}):void 0,P=e?a=>e(a,{...v.userNode}):void 0,Q=f?a=>f(a,{...v.userNode}):void 0,R=g?a=>g(a,{...v.userNode}):void 0;return(0,D.jsx)("div",{className:ee(["react-flow__node",`react-flow__node-${x}`,{[n]:z},u.className,{selected:u.selected,selectable:A,parent:w,draggable:z,dragging:I}]),ref:H,style:{zIndex:v.z,transform:`translate(${v.positionAbsolute.x}px,${v.positionAbsolute.y}px)`,pointerEvents:M?"all":"none",visibility:G?"visible":"hidden",...u.style,...L},"data-id":a,"data-testid":`rf__node-${a}`,onMouseEnter:N,onMouseMove:O,onMouseLeave:P,onContextMenu:Q,onClick:c=>{let{selectNodesOnDrag:d,nodeDragThreshold:e}=F.getState();A&&(!d||!z||e>0)&&iv({id:a,store:F,nodeRef:H}),b&&b(c,{...v.userNode})},onDoubleClick:R,onKeyDown:C?b=>{var c;let d;if(c=b.nativeEvent,d=c.composedPath?.()?.[0]||c.target,!(d?.nodeType===1&&(g_.includes(d.nodeName)||d.hasAttribute("contenteditable")||d.closest(".nokey")))&&!o){if(gp.includes(b.key)&&A)iv({id:a,store:F,unselect:"Escape"===b.key,nodeRef:H});else if(z&&u.selected&&Object.prototype.hasOwnProperty.call(iC,b.key)){b.preventDefault();let{ariaLabelConfig:a}=F.getState();F.setState({ariaLiveMessage:a["node.a11yDescription.ariaLiveMessage"]({direction:b.key.replace("Arrow","").toLowerCase(),x:~~v.positionAbsolute.x,y:~~v.positionAbsolute.y})}),J({direction:iC[b.key],factor:b.shiftKey?4:1})}}}:void 0,tabIndex:C?0:void 0,onFocus:C?()=>{if(o||!H.current?.matches(":focus-visible"))return;let{transform:b,width:c,height:d,autoPanOnNodeFocus:e,setCenter:f}=F.getState();!e||gy(new Map([[a,u]]),{x:0,y:0,width:c,height:d},b,!0).length>0||f(u.position.x+K.width/2,u.position.y+K.height/2,{zoom:b[2]})}:void 0,role:u.ariaRole??(C?"group":void 0),"aria-roledescription":"node","aria-describedby":o?void 0:`${hN}-${p}`,"aria-label":u.ariaLabel,...u.domAttributes,children:(0,D.jsx)(iz,{value:a,children:(0,D.jsx)(y,{id:a,data:u.data,type:x,positionAbsoluteX:v.positionAbsolute.x,positionAbsoluteY:v.positionAbsolute.y,selected:u.selected??!1,selectable:A,draggable:z,deletable:u.deletable??!0,isConnectable:B,sourcePosition:u.sourcePosition,targetPosition:u.targetPosition,dragging:I,dragHandle:u.dragHandle,zIndex:v.z,parentId:u.parentId,...K})})})});let iM=a=>({nodesDraggable:a.nodesDraggable,nodesConnectable:a.nodesConnectable,nodesFocusable:a.nodesFocusable,elementsSelectable:a.elementsSelectable,onError:a.onError});function iN(a){var b;let{nodesDraggable:c,nodesConnectable:d,nodesFocusable:e,elementsSelectable:f,onError:g}=hJ(iM,hF),h=(b=a.onlyRenderVisibleElements,hJ((0,E.useCallback)(a=>b?gy(a.nodeLookup,{x:0,y:0,width:a.width,height:a.height},a.transform,!0).map(a=>a.id):Array.from(a.nodeLookup.keys()),[b]),hF)),i=function(){let a=hJ(iK),[b]=(0,E.useState)(()=>"u"<typeof ResizeObserver?null:new ResizeObserver(b=>{let c=new Map;b.forEach(a=>{let b=a.target.getAttribute("data-id");c.set(b,{id:b,nodeElement:a.target,force:!0})}),a(c)}));return b}();return(0,D.jsx)("div",{className:"react-flow__nodes",style:im,children:h.map(b=>(0,D.jsx)(iL,{id:b,nodeTypes:a.nodeTypes,nodeExtent:a.nodeExtent,onClick:a.onNodeClick,onMouseEnter:a.onNodeMouseEnter,onMouseMove:a.onNodeMouseMove,onMouseLeave:a.onNodeMouseLeave,onContextMenu:a.onNodeContextMenu,onDoubleClick:a.onNodeDoubleClick,noDragClassName:a.noDragClassName,noPanClassName:a.noPanClassName,rfId:a.rfId,disableKeyboardA11y:a.disableKeyboardA11y,resizeObserver:i,nodesDraggable:c,nodesConnectable:d,nodesFocusable:e,elementsSelectable:f,nodeClickDistance:a.nodeClickDistance,onError:g},b))})}iN.displayName="NodeRenderer";let iO=(0,E.memo)(iN),iP={[z.Arrow]:({color:a="none",strokeWidth:b=1})=>{let c={strokeWidth:b,...a&&{stroke:a}};return(0,D.jsx)("polyline",{className:"arrow",style:c,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[z.ArrowClosed]:({color:a="none",strokeWidth:b=1})=>{let c={strokeWidth:b,...a&&{stroke:a,fill:a}};return(0,D.jsx)("polyline",{className:"arrowclosed",style:c,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}},iQ=({id:a,type:b,color:c,width:d=12.5,height:e=12.5,markerUnits:f="strokeWidth",strokeWidth:g,orient:h="auto-start-reverse"})=>{let i,j=(i=hK(),(0,E.useMemo)(()=>{let a;return Object.prototype.hasOwnProperty.call(iP,b)?iP[b]:(i.getState().onError?.("009",(a=b,`Marker type "${a}" doesn't exist.`)),null)},[b]));return j?(0,D.jsx)("marker",{className:"react-flow__arrowhead",id:a,markerWidth:`${d}`,markerHeight:`${e}`,viewBox:"-10 -10 20 20",markerUnits:f,orient:h,refX:"0",refY:"0",children:(0,D.jsx)(j,{color:c,strokeWidth:g})}):null},iR=({defaultColor:a,rfId:b})=>{let c=hJ(a=>a.edges),d=hJ(a=>a.defaultEdgeOptions),e=(0,E.useMemo)(()=>(function(a,{id:b,defaultColor:c,defaultMarkerStart:d,defaultMarkerEnd:e}){let f=new Set;return a.reduce((a,g)=>([g.markerStart||d,g.markerEnd||e].forEach(d=>{if(d&&"object"==typeof d){let e=hh(d,b);f.has(e)||(a.push({id:e,color:d.color||c,...d}),f.add(e))}}),a),[]).sort((a,b)=>a.id.localeCompare(b.id))})(c,{id:b,defaultColor:a,defaultMarkerStart:d?.markerStart,defaultMarkerEnd:d?.markerEnd}),[c,d,b,a]);return e.length?(0,D.jsx)("svg",{className:"react-flow__marker","aria-hidden":"true",children:(0,D.jsx)("defs",{children:e.map(a=>(0,D.jsx)(iQ,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};iR.displayName="MarkerDefinitions";var iS=(0,E.memo)(iR);function iT({x:a,y:b,label:c,labelStyle:d,labelShowBg:e=!0,labelBgStyle:f,labelBgPadding:g=[2,4],labelBgBorderRadius:h=2,children:i,className:j,...k}){let[l,m]=(0,E.useState)({x:1,y:0,width:0,height:0}),n=ee(["react-flow__edge-textwrapper",j]),o=(0,E.useRef)(null);return c?(0,D.jsxs)("g",{transform:`translate(${a-l.width/2} ${b-l.height/2})`,className:n,visibility:l.width?"visible":"hidden",...k,children:[e&&(0,D.jsx)("rect",{width:l.width+2*g[0],x:-g[0],y:-g[1],height:l.height+2*g[1],className:"react-flow__edge-textbg",style:f,rx:h,ry:h}),(0,D.jsx)("text",{className:"react-flow__edge-text",y:l.height/2,dy:"0.3em",ref:o,style:d,children:c}),i]}):null}iT.displayName="EdgeText";let iU=(0,E.memo)(iT);function iV({path:a,labelX:b,labelY:c,label:d,labelStyle:e,labelShowBg:f,labelBgStyle:g,labelBgPadding:h,labelBgBorderRadius:i,interactionWidth:j=20,...k}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{...k,d:a,fill:"none",className:ee(["react-flow__edge-path",k.className])}),j?(0,D.jsx)("path",{d:a,fill:"none",strokeOpacity:0,strokeWidth:j,className:"react-flow__edge-interaction"}):null,d&&gN(b)&&gN(c)?(0,D.jsx)(iU,{x:b,y:c,label:d,labelStyle:e,labelShowBg:f,labelBgStyle:g,labelBgPadding:h,labelBgBorderRadius:i}):null]})}function iW({pos:a,x1:b,y1:c,x2:d,y2:e}){return a===A.Left||a===A.Right?[.5*(b+d),c]:[b,.5*(c+e)]}function iX({sourceX:a,sourceY:b,sourcePosition:c=A.Bottom,targetX:d,targetY:e,targetPosition:f=A.Top}){let[g,h]=iW({pos:c,x1:a,y1:b,x2:d,y2:e}),[i,j]=iW({pos:f,x1:d,y1:e,x2:a,y2:b}),[k,l,m,n]=g2({sourceX:a,sourceY:b,targetX:d,targetY:e,sourceControlX:g,sourceControlY:h,targetControlX:i,targetControlY:j});return[`M${a},${b} C${g},${h} ${i},${j} ${d},${e}`,k,l,m,n]}function iY(a){return(0,E.memo)(({id:b,sourceX:c,sourceY:d,targetX:e,targetY:f,sourcePosition:g,targetPosition:h,label:i,labelStyle:j,labelShowBg:k,labelBgStyle:l,labelBgPadding:m,labelBgBorderRadius:n,style:o,markerEnd:p,markerStart:q,interactionWidth:r})=>{let[s,t,u]=iX({sourceX:c,sourceY:d,sourcePosition:g,targetX:e,targetY:f,targetPosition:h}),v=a.isInternal?void 0:b;return(0,D.jsx)(iV,{id:v,path:s,labelX:t,labelY:u,label:i,labelStyle:j,labelShowBg:k,labelBgStyle:l,labelBgPadding:m,labelBgBorderRadius:n,style:o,markerEnd:p,markerStart:q,interactionWidth:r})})}let iZ=iY({isInternal:!1}),i$=iY({isInternal:!0});function i_(a){return(0,E.memo)(({id:b,sourceX:c,sourceY:d,targetX:e,targetY:f,label:g,labelStyle:h,labelShowBg:i,labelBgStyle:j,labelBgPadding:k,labelBgBorderRadius:l,style:m,sourcePosition:n=A.Bottom,targetPosition:o=A.Top,markerEnd:p,markerStart:q,pathOptions:r,interactionWidth:s})=>{let[t,u,v]=hc({sourceX:c,sourceY:d,sourcePosition:n,targetX:e,targetY:f,targetPosition:o,borderRadius:r?.borderRadius,offset:r?.offset,stepPosition:r?.stepPosition}),w=a.isInternal?void 0:b;return(0,D.jsx)(iV,{id:w,path:t,labelX:u,labelY:v,label:g,labelStyle:h,labelShowBg:i,labelBgStyle:j,labelBgPadding:k,labelBgBorderRadius:l,style:m,markerEnd:p,markerStart:q,interactionWidth:s})})}iZ.displayName="SimpleBezierEdge",i$.displayName="SimpleBezierEdgeInternal";let i0=i_({isInternal:!1}),i1=i_({isInternal:!0});function i2(a){return(0,E.memo)(({id:b,...c})=>{let d=a.isInternal?void 0:b;return(0,D.jsx)(i0,{...c,id:d,pathOptions:(0,E.useMemo)(()=>({borderRadius:0,offset:c.pathOptions?.offset}),[c.pathOptions?.offset])})})}i0.displayName="SmoothStepEdge",i1.displayName="SmoothStepEdgeInternal";let i3=i2({isInternal:!1}),i4=i2({isInternal:!0});function i5(a){return(0,E.memo)(({id:b,sourceX:c,sourceY:d,targetX:e,targetY:f,label:g,labelStyle:h,labelShowBg:i,labelBgStyle:j,labelBgPadding:k,labelBgBorderRadius:l,style:m,markerEnd:n,markerStart:o,interactionWidth:p})=>{let[q,r,s]=g8({sourceX:c,sourceY:d,targetX:e,targetY:f}),t=a.isInternal?void 0:b;return(0,D.jsx)(iV,{id:t,path:q,labelX:r,labelY:s,label:g,labelStyle:h,labelShowBg:i,labelBgStyle:j,labelBgPadding:k,labelBgBorderRadius:l,style:m,markerEnd:n,markerStart:o,interactionWidth:p})})}i3.displayName="StepEdge",i4.displayName="StepEdgeInternal";let i6=i5({isInternal:!1}),i7=i5({isInternal:!0});function i8(a){return(0,E.memo)(({id:b,sourceX:c,sourceY:d,targetX:e,targetY:f,sourcePosition:g=A.Bottom,targetPosition:h=A.Top,label:i,labelStyle:j,labelShowBg:k,labelBgStyle:l,labelBgPadding:m,labelBgBorderRadius:n,style:o,markerEnd:p,markerStart:q,pathOptions:r,interactionWidth:s})=>{let[t,u,v]=g5({sourceX:c,sourceY:d,sourcePosition:g,targetX:e,targetY:f,targetPosition:h,curvature:r?.curvature}),w=a.isInternal?void 0:b;return(0,D.jsx)(iV,{id:w,path:t,labelX:u,labelY:v,label:i,labelStyle:j,labelShowBg:k,labelBgStyle:l,labelBgPadding:m,labelBgBorderRadius:n,style:o,markerEnd:p,markerStart:q,interactionWidth:s})})}i6.displayName="StraightEdge",i7.displayName="StraightEdgeInternal";let i9=i8({isInternal:!1}),ja=i8({isInternal:!0});i9.displayName="BezierEdge",ja.displayName="BezierEdgeInternal";let jb={default:ja,straight:i7,step:i4,smoothstep:i1,simplebezier:i$},jc={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},jd="react-flow__edgeupdater";function je({position:a,centerX:b,centerY:c,radius:d=10,onMouseDown:e,onMouseEnter:f,onMouseOut:g,type:h}){return(0,D.jsx)("circle",{onMouseDown:e,onMouseEnter:f,onMouseOut:g,className:ee([jd,`${jd}-${h}`]),cx:a===A.Left?b-d:a===A.Right?b+d:b,cy:a===A.Top?c-d:a===A.Bottom?c+d:c,r:d,stroke:"transparent",fill:"transparent"})}function jf({isReconnectable:a,reconnectRadius:b,edge:c,sourceX:d,sourceY:e,targetX:f,targetY:g,sourcePosition:h,targetPosition:i,onReconnect:j,onReconnectStart:k,onReconnectEnd:l,setReconnecting:m,setUpdateHover:n}){let o=hK(),p=(a,b)=>{if(0!==a.button)return;let{autoPanOnConnect:d,domNode:e,connectionMode:f,connectionRadius:g,lib:h,onConnectStart:i,cancelConnection:n,nodeLookup:p,rfId:q,panBy:r,updateConnection:s}=o.getState(),t="target"===b.type;hx(a.nativeEvent,{autoPanOnConnect:d,connectionMode:f,connectionRadius:g,domNode:e,handleId:b.id,nodeId:b.nodeId,nodeLookup:p,isTarget:t,edgeUpdaterType:b.type,lib:h,flowId:q,cancelConnection:n,panBy:r,isValidConnection:(...a)=>o.getState().isValidConnection?.(...a)??!0,onConnect:a=>j?.(c,a),onConnectStart:(d,e)=>{m(!0),k?.(a,c,b.type),i?.(d,e)},onConnectEnd:(...a)=>o.getState().onConnectEnd?.(...a),onReconnectEnd:(a,d)=>{m(!1),l?.(a,c,b.type,d)},updateConnection:s,getTransform:()=>o.getState().transform,getFromHandle:()=>o.getState().connection.fromHandle,dragThreshold:o.getState().connectionDragThreshold,handleDomNode:a.currentTarget})},q=()=>n(!0),r=()=>n(!1);return(0,D.jsxs)(D.Fragment,{children:[(!0===a||"source"===a)&&(0,D.jsx)(je,{position:h,centerX:d,centerY:e,radius:b,onMouseDown:a=>p(a,{nodeId:c.target,id:c.targetHandle??null,type:"target"}),onMouseEnter:q,onMouseOut:r,type:"source"}),(!0===a||"target"===a)&&(0,D.jsx)(je,{position:i,centerX:f,centerY:g,radius:b,onMouseDown:a=>p(a,{nodeId:c.source,id:c.sourceHandle??null,type:"source"}),onMouseEnter:q,onMouseOut:r,type:"target"})]})}var jg=(0,E.memo)(function({id:a,edgesFocusable:b,edgesReconnectable:c,elementsSelectable:d,onClick:e,onDoubleClick:f,onContextMenu:g,onMouseEnter:h,onMouseMove:i,onMouseLeave:j,reconnectRadius:k,onReconnect:l,onReconnectStart:m,onReconnectEnd:n,rfId:o,edgeTypes:p,noPanClassName:q,onError:r,disableKeyboardA11y:s}){let t,u=hJ(b=>b.edgeLookup.get(a)),w=hJ(a=>a.defaultEdgeOptions),x=(u=w?{...w,...u}:u).type||"default",y=p?.[x]||jb[x];void 0===y&&(r?.("011",(t=x,`Edge type "${t}" not found. Using fallback type "default".`)),x="default",y=p?.default||jb.default);let z=!!(u.focusable||b&&void 0===u.focusable),B=void 0!==l&&(u.reconnectable||c&&void 0===u.reconnectable),C=!!(u.selectable||d&&void 0===u.selectable),F=(0,E.useRef)(null),[G,H]=(0,E.useState)(!1),[I,J]=(0,E.useState)(!1),K=hK(),{zIndex:L,sourceX:M,sourceY:N,targetX:O,targetY:P,sourcePosition:Q,targetPosition:R}=hJ((0,E.useCallback)(b=>{let c=b.nodeLookup.get(u.source),d=b.nodeLookup.get(u.target);if(!c||!d)return{zIndex:u.zIndex,...jc};let e=function(a){let{sourceNode:b,targetNode:c}=a;if(!hd(b)||!hd(c))return null;let d=b.internals.handleBounds||he(b.handles),e=c.internals.handleBounds||he(c.handles),f=hg(d?.source??[],a.sourceHandle),g=hg(a.connectionMode===v.Strict?e?.target??[]:(e?.target??[]).concat(e?.source??[]),a.targetHandle);if(!f||!g)return a.onError?.("008",((a,{id:b,sourceHandle:c,targetHandle:d})=>`Couldn't create edge for ${a} handle id: "${"source"===a?c:d}", edge id: ${b}.`)(!f?"source":"target",{id:a.id,sourceHandle:a.sourceHandle,targetHandle:a.targetHandle})),null;let h=f?.position||A.Bottom,i=g?.position||A.Top,j=hf(b,f,h),k=hf(c,g,i);return{sourceX:j.x,sourceY:j.y,targetX:k.x,targetY:k.y,sourcePosition:h,targetPosition:i}}({id:a,sourceNode:c,targetNode:d,sourceHandle:u.sourceHandle||null,targetHandle:u.targetHandle||null,connectionMode:b.connectionMode,onError:r});return{zIndex:function({sourceNode:a,targetNode:b,selected:c=!1,zIndex:d=0,elevateOnSelect:e=!1,zIndexMode:f="basic"}){if("manual"===f)return d;let g=Math.max(a.parentId||e&&a.selected?a.internals.z:0,b.parentId||e&&b.selected?b.internals.z:0);return(e&&c?d+1e3:d)+g}({selected:u.selected,zIndex:u.zIndex,sourceNode:c,targetNode:d,elevateOnSelect:b.elevateEdgesOnSelect,zIndexMode:b.zIndexMode}),...e||jc}},[u.source,u.target,u.sourceHandle,u.targetHandle,u.selected,u.zIndex]),hF),S=(0,E.useMemo)(()=>u.markerStart?`url('#${hh(u.markerStart,o)}')`:void 0,[u.markerStart,o]),T=(0,E.useMemo)(()=>u.markerEnd?`url('#${hh(u.markerEnd,o)}')`:void 0,[u.markerEnd,o]);if(u.hidden||null===M||null===N||null===O||null===P)return null;let U=f?a=>{f(a,{...u})}:void 0,V=g?a=>{g(a,{...u})}:void 0,W=h?a=>{h(a,{...u})}:void 0,X=i?a=>{i(a,{...u})}:void 0,Y=j?a=>{j(a,{...u})}:void 0;return(0,D.jsx)("svg",{style:{zIndex:L},children:(0,D.jsxs)("g",{className:ee(["react-flow__edge",`react-flow__edge-${x}`,u.className,q,{selected:u.selected,animated:u.animated,inactive:!C&&!e,updating:G,selectable:C}]),onClick:b=>{let{addSelectedEdges:c,unselectNodesAndEdges:d,multiSelectionActive:f}=K.getState();C&&(K.setState({nodesSelectionActive:!1}),u.selected&&f?(d({nodes:[],edges:[u]}),F.current?.blur()):c([a])),e&&e(b,u)},onDoubleClick:U,onContextMenu:V,onMouseEnter:W,onMouseMove:X,onMouseLeave:Y,onKeyDown:z?b=>{if(!s&&gp.includes(b.key)&&C){let{unselectNodesAndEdges:c,addSelectedEdges:d}=K.getState();"Escape"===b.key?(F.current?.blur(),c({edges:[u]})):d([a])}}:void 0,tabIndex:z?0:void 0,role:u.ariaRole??(z?"group":"img"),"aria-roledescription":"edge","data-id":a,"data-testid":`rf__edge-${a}`,"aria-label":null===u.ariaLabel?void 0:u.ariaLabel||`Edge from ${u.source} to ${u.target}`,"aria-describedby":z?`${hO}-${o}`:void 0,ref:F,...u.domAttributes,children:[!I&&(0,D.jsx)(y,{id:a,source:u.source,target:u.target,type:u.type,selected:u.selected,animated:u.animated,selectable:C,deletable:u.deletable??!0,label:u.label,labelStyle:u.labelStyle,labelShowBg:u.labelShowBg,labelBgStyle:u.labelBgStyle,labelBgPadding:u.labelBgPadding,labelBgBorderRadius:u.labelBgBorderRadius,sourceX:M,sourceY:N,targetX:O,targetY:P,sourcePosition:Q,targetPosition:R,data:u.data,style:u.style,sourceHandleId:u.sourceHandle,targetHandleId:u.targetHandle,markerStart:S,markerEnd:T,pathOptions:"pathOptions"in u?u.pathOptions:void 0,interactionWidth:u.interactionWidth}),B&&(0,D.jsx)(jf,{edge:u,isReconnectable:B,reconnectRadius:k,onReconnect:l,onReconnectStart:m,onReconnectEnd:n,sourceX:M,sourceY:N,targetX:O,targetY:P,sourcePosition:Q,targetPosition:R,setUpdateHover:H,setReconnecting:J})]})})});let jh=a=>({edgesFocusable:a.edgesFocusable,edgesReconnectable:a.edgesReconnectable,elementsSelectable:a.elementsSelectable,connectionMode:a.connectionMode,onError:a.onError});function ji({defaultMarkerColor:a,onlyRenderVisibleElements:b,rfId:c,edgeTypes:d,noPanClassName:e,onReconnect:f,onEdgeContextMenu:g,onEdgeMouseEnter:h,onEdgeMouseMove:i,onEdgeMouseLeave:j,onEdgeClick:k,reconnectRadius:l,onEdgeDoubleClick:m,onReconnectStart:n,onReconnectEnd:o,disableKeyboardA11y:p}){let{edgesFocusable:q,edgesReconnectable:r,elementsSelectable:s,onError:t}=hJ(jh,hF),u=hJ((0,E.useCallback)(a=>{if(!b)return a.edges.map(a=>a.id);let c=[];if(a.width&&a.height)for(let b of a.edges){let d=a.nodeLookup.get(b.source),e=a.nodeLookup.get(b.target);d&&e&&function({sourceNode:a,targetNode:b,width:c,height:d,transform:e}){let f=gF(gJ(a),gJ(b));return f.x===f.x2&&(f.x2+=1),f.y===f.y2&&(f.y2+=1),gL({x:-e[0]/e[2],y:-e[1]/e[2],width:c/e[2],height:d/e[2]},gH(f))>0}({sourceNode:d,targetNode:e,width:a.width,height:a.height,transform:a.transform})&&c.push(b.id)}return c},[b]),hF);return(0,D.jsxs)("div",{className:"react-flow__edges",children:[(0,D.jsx)(iS,{defaultColor:a,rfId:c}),u.map(a=>(0,D.jsx)(jg,{id:a,edgesFocusable:q,edgesReconnectable:r,elementsSelectable:s,noPanClassName:e,onReconnect:f,onContextMenu:g,onMouseEnter:h,onMouseMove:i,onMouseLeave:j,onClick:k,reconnectRadius:l,onDoubleClick:m,onReconnectStart:n,onReconnectEnd:o,rfId:c,onError:t,edgeTypes:d,disableKeyboardA11y:p},a))]})}ji.displayName="EdgeRenderer";let jj=(0,E.memo)(ji),jk=a=>`translate(${a.transform[0]}px,${a.transform[1]}px) scale(${a.transform[2]})`;function jl({children:a}){let b=hJ(jk);return(0,D.jsx)("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:b},children:a})}let jm=a=>a.panZoom?.syncViewport;function jn(a){return a.connection.inProgress?{...a.connection,to:gQ(a.connection.to,a.transform)}:{...a.connection}}let jo=a=>({nodesConnectable:a.nodesConnectable,isValid:a.connection.isValid,inProgress:a.connection.inProgress,width:a.width,height:a.height});function jp({containerStyle:a,style:b,type:c,component:d}){let{nodesConnectable:e,width:f,height:g,isValid:h,inProgress:i}=hJ(jo,hF);return f&&e&&i?(0,D.jsx)("svg",{style:a,width:f,height:g,className:"react-flow__connectionline react-flow__container",children:(0,D.jsx)("g",{className:ee(["react-flow__connection",gt(h)]),children:(0,D.jsx)(jq,{style:b,type:c,CustomComponent:d,isValid:h})})}):null}let jq=({style:a,type:b=y.Bezier,CustomComponent:c,isValid:d})=>{let{inProgress:e,from:f,fromNode:g,fromHandle:h,fromPosition:i,to:j,toNode:k,toHandle:l,toPosition:m,pointer:n}=hJ(jn,hF);if(!e)return;if(c)return(0,D.jsx)(c,{connectionLineType:b,connectionLineStyle:a,fromNode:g,fromHandle:h,fromX:f.x,fromY:f.y,toX:j.x,toY:j.y,fromPosition:i,toPosition:m,connectionStatus:gt(d),toNode:k,toHandle:l,pointer:n});let o="",p={sourceX:f.x,sourceY:f.y,sourcePosition:i,targetX:j.x,targetY:j.y,targetPosition:m};switch(b){case y.Bezier:[o]=g5(p);break;case y.SimpleBezier:[o]=iX(p);break;case y.Step:[o]=hc({...p,borderRadius:0});break;case y.SmoothStep:[o]=hc(p);break;default:[o]=g8(p)}return(0,D.jsx)("path",{d:o,fill:"none",className:"react-flow__connection-path",style:a})};jq.displayName="ConnectionLine";let jr={};function js(a=jr){(0,E.useRef)(a),hK()}function jt({nodeTypes:a,edgeTypes:b,onInit:c,onNodeClick:d,onEdgeClick:e,onNodeDoubleClick:f,onEdgeDoubleClick:g,onNodeMouseEnter:h,onNodeMouseMove:i,onNodeMouseLeave:j,onNodeContextMenu:k,onSelectionContextMenu:l,onSelectionStart:m,onSelectionEnd:n,connectionLineType:o,connectionLineStyle:p,connectionLineComponent:q,connectionLineContainerStyle:r,selectionKeyCode:s,selectionOnDrag:t,selectionMode:u,multiSelectionKeyCode:v,panActivationKeyCode:w,zoomActivationKeyCode:x,deleteKeyCode:y,onlyRenderVisibleElements:z,elementsSelectable:A,defaultViewport:B,translateExtent:C,minZoom:F,maxZoom:G,preventScrolling:H,defaultMarkerColor:I,zoomOnScroll:J,zoomOnPinch:K,panOnScroll:L,panOnScrollSpeed:M,panOnScrollMode:N,zoomOnDoubleClick:O,panOnDrag:P,onPaneClick:Q,onPaneMouseEnter:R,onPaneMouseMove:S,onPaneMouseLeave:T,onPaneScroll:U,onPaneContextMenu:V,paneClickDistance:W,nodeClickDistance:X,onEdgeContextMenu:Y,onEdgeMouseEnter:Z,onEdgeMouseMove:$,onEdgeMouseLeave:_,reconnectRadius:aa,onReconnect:ab,onReconnectStart:ac,onReconnectEnd:ad,noDragClassName:ae,noWheelClassName:af,noPanClassName:ag,disableKeyboardA11y:ah,nodeExtent:ai,rfId:aj,viewport:ak,onViewportChange:al}){return js(a),js(b),hK(),(0,E.useRef)(!1),ik(),(0,E.useRef)(!1),hJ(jm),hK(),(0,D.jsx)(iJ,{onPaneClick:Q,onPaneMouseEnter:R,onPaneMouseMove:S,onPaneMouseLeave:T,onPaneContextMenu:V,onPaneScroll:U,paneClickDistance:W,deleteKeyCode:y,selectionKeyCode:s,selectionOnDrag:t,selectionMode:u,onSelectionStart:m,onSelectionEnd:n,multiSelectionKeyCode:v,panActivationKeyCode:w,zoomActivationKeyCode:x,elementsSelectable:A,zoomOnScroll:J,zoomOnPinch:K,zoomOnDoubleClick:O,panOnScroll:L,panOnScrollSpeed:M,panOnScrollMode:N,panOnDrag:P,defaultViewport:B,translateExtent:C,minZoom:F,maxZoom:G,onSelectionContextMenu:l,preventScrolling:H,noDragClassName:ae,noWheelClassName:af,noPanClassName:ag,disableKeyboardA11y:ah,onViewportChange:al,isControlledViewport:!!ak,children:(0,D.jsxs)(jl,{children:[(0,D.jsx)(jj,{edgeTypes:b,onEdgeClick:e,onEdgeDoubleClick:g,onReconnect:ab,onReconnectStart:ac,onReconnectEnd:ad,onlyRenderVisibleElements:z,onEdgeContextMenu:Y,onEdgeMouseEnter:Z,onEdgeMouseMove:$,onEdgeMouseLeave:_,reconnectRadius:aa,defaultMarkerColor:I,noPanClassName:ag,disableKeyboardA11y:ah,rfId:aj}),(0,D.jsx)(jp,{style:p,type:o,component:q,containerStyle:r}),(0,D.jsx)("div",{className:"react-flow__edgelabel-renderer"}),(0,D.jsx)(iO,{nodeTypes:a,onNodeClick:d,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:i,onNodeMouseLeave:j,onNodeContextMenu:k,nodeClickDistance:X,onlyRenderVisibleElements:z,noPanClassName:ag,noDragClassName:ae,disableKeyboardA11y:ah,nodeExtent:ai,rfId:aj}),(0,D.jsx)("div",{className:"react-flow__viewport-portal"})]})})}jt.displayName="GraphView";let ju=(0,E.memo)(jt),jv=({nodes:a,edges:b,defaultNodes:c,defaultEdges:d,width:e,height:f,fitView:g,fitViewOptions:h,minZoom:i=.5,maxZoom:j=2,nodeOrigin:k,nodeExtent:l,zIndexMode:m="basic"}={})=>{let n=new Map,o=new Map,p=new Map,q=new Map,r=d??b??[],s=c??a??[],t=k??[0,0],u=l??go;hs(p,q,r);let w=hm(s,n,o,{nodeOrigin:t,nodeExtent:u,zIndexMode:m}),x=[0,0,1];if(g&&e&&f){let{x:a,y:b,zoom:c}=gT(gx(n,{filter:a=>!!((a.width||a.initialWidth)&&(a.height||a.initialHeight))}),e,f,i,j,h?.padding??.1);x=[a,b,c]}return{rfId:"1",width:e??0,height:f??0,transform:x,nodes:s,nodesInitialized:w,nodeLookup:n,parentLookup:o,edges:r,edgeLookup:q,connectionLookup:p,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==c,hasDefaultEdges:void 0!==d,panZoom:null,minZoom:i,maxZoom:j,translateExtent:go,nodeExtent:u,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:v.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:t,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:g??!1,fitViewOptions:h,fitViewResolver:null,connection:{...gr},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:gO,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:gq,zIndexMode:m,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}};function jw({initialNodes:a,initialEdges:b,defaultNodes:c,defaultEdges:d,initialWidth:e,initialHeight:f,initialMinZoom:g,initialMaxZoom:h,initialFitViewOptions:i,fitView:j,nodeOrigin:k,nodeExtent:l,zIndexMode:m,children:n}){let[o]=(0,E.useState)(()=>(({nodes:a,edges:b,defaultNodes:c,defaultEdges:d,width:e,height:f,fitView:g,fitViewOptions:h,minZoom:i,maxZoom:j,nodeOrigin:k,nodeExtent:l,zIndexMode:m})=>{let n,o;return n=(n,o)=>{async function p(){let{nodeLookup:a,panZoom:b,fitViewOptions:c,fitViewResolver:d,width:e,height:f,minZoom:g,maxZoom:h}=o();b&&(await gz({nodes:a,width:e,height:f,panZoom:b,minZoom:g,maxZoom:h},c),d?.resolve(!0),n({fitViewResolver:null}))}return{...jv({nodes:a,edges:b,width:e,height:f,fitView:g,fitViewOptions:h,minZoom:i,maxZoom:j,nodeOrigin:k,nodeExtent:l,defaultNodes:c,defaultEdges:d,zIndexMode:m}),setNodes:a=>{let{nodeLookup:b,parentLookup:c,nodeOrigin:d,elevateNodesOnSelect:e,fitViewQueued:f,zIndexMode:g}=o(),h=hm(a,b,c,{nodeOrigin:d,nodeExtent:l,elevateNodesOnSelect:e,checkEquality:!0,zIndexMode:g});f&&h?(p(),n({nodes:a,nodesInitialized:h,fitViewQueued:!1,fitViewOptions:void 0})):n({nodes:a,nodesInitialized:h})},setEdges:a=>{let{connectionLookup:b,edgeLookup:c}=o();hs(b,c,a),n({edges:a})},setDefaultNodesAndEdges:(a,b)=>{if(a){let{setNodes:b}=o();b(a),n({hasDefaultNodes:!0})}if(b){let{setEdges:a}=o();a(b),n({hasDefaultEdges:!0})}},updateNodeInternals:a=>{let{triggerNodeChanges:b,nodeLookup:c,parentLookup:d,domNode:e,nodeOrigin:f,nodeExtent:g,debug:h,fitViewQueued:i,zIndexMode:j}=o(),{changes:k,updatedInternals:l}=function(a,b,c,d,e,f,g){let h=d?.querySelector(".xyflow__viewport"),i=!1;if(!h)return{changes:[],updatedInternals:i};let j=[],k=window.getComputedStyle(h),{m22:l}=new window.DOMMatrixReadOnly(k.transform),m=[];for(let d of a.values()){let a=b.get(d.id);if(!a)continue;if(a.hidden){b.set(a.id,{...a,internals:{...a.internals,handleBounds:void 0}}),i=!0;continue}let h=gZ(d.nodeElement),k=a.measured.width!==h.width||a.measured.height!==h.height;if(h.width&&h.height&&(k||!a.internals.handleBounds||d.force)){let n=d.nodeElement.getBoundingClientRect(),o=gV(a.extent)?a.extent:f,{positionAbsolute:p}=a.internals;a.parentId&&"parent"===a.extent?p=gD(p,h,b.get(a.parentId)):o&&(p=gC(p,o,h));let q={...a,measured:h,internals:{...a.internals,positionAbsolute:p,handleBounds:{source:g1("source",d.nodeElement,n,l,a.id),target:g1("target",d.nodeElement,n,l,a.id)}}};b.set(a.id,q),a.parentId&&hn(q,b,c,{nodeOrigin:e,zIndexMode:g}),i=!0,k&&(j.push({id:a.id,type:"dimensions",dimensions:h}),a.expandParent&&a.parentId&&m.push({id:a.id,parentId:a.parentId,rect:gI(q,e)}))}}if(m.length>0){let a=hp(m,b,c,e);j.push(...a)}return{changes:j,updatedInternals:i}}(a,c,d,e,f,g,j);l&&(!function(a,b,c){let d=hk(hi,c);for(let c of a.values())if(c.parentId)hn(c,a,b,d);else{let a=gC(gw(c,d.nodeOrigin),gV(c.extent)?c.extent:d.nodeExtent,gW(c));c.internals.positionAbsolute=a}}(c,d,{nodeOrigin:f,nodeExtent:g,zIndexMode:j}),i?(p(),n({fitViewQueued:!1,fitViewOptions:void 0})):n({}),k?.length>0&&(h&&console.log("React Flow: trigger node changes",k),b?.(k)))},updateNodePositions:(a,b=!1)=>{let c=[],d=[],{nodeLookup:e,triggerNodeChanges:f,connection:g,updateConnection:h,onNodesChangeMiddlewareMap:i}=o();for(let[f,i]of a){let a=e.get(f),j=!!(a?.expandParent&&a?.parentId&&i?.position),k={id:f,type:"position",position:j?{x:Math.max(0,i.position.x),y:Math.max(0,i.position.y)}:i.position,dragging:b};if(a&&g.inProgress&&g.fromNode.id===a.id){let b=hf(a,g.fromHandle,A.Left,!0);h({...g,from:b})}j&&a.parentId&&c.push({id:f,parentId:a.parentId,rect:{...i.internals.positionAbsolute,width:i.measured.width??0,height:i.measured.height??0}}),d.push(k)}if(c.length>0){let{parentLookup:a,nodeOrigin:b}=o(),f=hp(c,e,a,b);d.push(...f)}for(let a of i.values())d=a(d);f(d)},triggerNodeChanges:a=>{let{onNodesChange:b,setNodes:c,nodes:d,hasDefaultNodes:e,debug:f}=o();a?.length&&(e&&c(h7(a,d)),f&&console.log("React Flow: trigger node changes",a),b?.(a))},triggerEdgeChanges:a=>{let{onEdgesChange:b,setEdges:c,edges:d,hasDefaultEdges:e,debug:f}=o();a?.length&&(e&&c(h7(a,d)),f&&console.log("React Flow: trigger edge changes",a),b?.(a))},addSelectedNodes:a=>{let{multiSelectionActive:b,edgeLookup:c,nodeLookup:d,triggerNodeChanges:e,triggerEdgeChanges:f}=o();b?e(a.map(a=>h8(a,!0))):(e(h9(d,new Set([...a]),!0)),f(h9(c)))},addSelectedEdges:a=>{let{multiSelectionActive:b,edgeLookup:c,nodeLookup:d,triggerNodeChanges:e,triggerEdgeChanges:f}=o();b?f(a.map(a=>h8(a,!0))):(f(h9(c,new Set([...a]))),e(h9(d,new Set,!0)))},unselectNodesAndEdges:({nodes:a,edges:b}={})=>{let{edges:c,nodes:d,nodeLookup:e,triggerNodeChanges:f,triggerEdgeChanges:g}=o(),h=[];for(let b of a||d){if(!b.selected)continue;let a=e.get(b.id);a&&(a.selected=!1),h.push(h8(b.id,!1))}let i=[];for(let a of b||c)a.selected&&i.push(h8(a.id,!1));f(h),g(i)},setMinZoom:a=>{let{panZoom:b,maxZoom:c}=o();b?.setScaleExtent([a,c]),n({minZoom:a})},setMaxZoom:a=>{let{panZoom:b,minZoom:c}=o();b?.setScaleExtent([c,a]),n({maxZoom:a})},setTranslateExtent:a=>{o().panZoom?.setTranslateExtent(a),n({translateExtent:a})},resetSelectedElements:()=>{let{edges:a,nodes:b,triggerNodeChanges:c,triggerEdgeChanges:d,elementsSelectable:e}=o();if(!e)return;let f=b.reduce((a,b)=>b.selected?[...a,h8(b.id,!1)]:a,[]),g=a.reduce((a,b)=>b.selected?[...a,h8(b.id,!1)]:a,[]);c(f),d(g)},setNodeExtent:a=>{let{nodes:b,nodeLookup:c,parentLookup:d,nodeOrigin:e,elevateNodesOnSelect:f,nodeExtent:g,zIndexMode:h}=o();(a[0][0]!==g[0][0]||a[0][1]!==g[0][1]||a[1][0]!==g[1][0]||a[1][1]!==g[1][1])&&(hm(b,c,d,{nodeOrigin:e,nodeExtent:a,elevateNodesOnSelect:f,checkEquality:!1,zIndexMode:h}),n({nodeExtent:a}))},panBy:a=>{let{transform:b,width:c,height:d,panZoom:e,translateExtent:f}=o();return hq({delta:a,panZoom:e,transform:b,translateExtent:f,width:c,height:d})},setCenter:async(a,b,c)=>{let{width:d,height:e,maxZoom:f,panZoom:g}=o();if(!g)return Promise.resolve(!1);let h=void 0!==c?.zoom?c.zoom:f;return await g.setViewport({x:d/2-a*h,y:e/2-b*h,zoom:h},{duration:c?.duration,ease:c?.ease,interpolate:c?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{n({connection:{...gr}})},updateConnection:a=>{n({connection:a})},reset:()=>n({...jv()})}},o=Object.is,n?hE(n,o):hE})({nodes:a,edges:b,defaultNodes:c,defaultEdges:d,width:e,height:f,fitView:j,minZoom:g,maxZoom:h,fitViewOptions:i,nodeOrigin:k,nodeExtent:l,zIndexMode:m}));return(0,D.jsx)(hH,{value:o,children:(0,D.jsx)(ii,{children:n})})}function jx({children:a,nodes:b,edges:c,defaultNodes:d,defaultEdges:e,width:f,height:g,fitView:h,fitViewOptions:i,minZoom:j,maxZoom:k,nodeOrigin:l,nodeExtent:m,zIndexMode:n}){return(0,E.useContext)(hG)?(0,D.jsx)(D.Fragment,{children:a}):(0,D.jsx)(jw,{initialNodes:b,initialEdges:c,defaultNodes:d,defaultEdges:e,initialWidth:f,initialHeight:g,fitView:h,initialFitViewOptions:i,initialMinZoom:j,initialMaxZoom:k,nodeOrigin:l,nodeExtent:m,zIndexMode:n,children:a})}let jy={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var jz=id(function({nodes:a,edges:b,defaultNodes:c,defaultEdges:d,className:e,nodeTypes:f,edgeTypes:g,onNodeClick:h,onEdgeClick:i,onInit:j,onMove:k,onMoveStart:l,onMoveEnd:m,onConnect:n,onConnectStart:o,onConnectEnd:p,onClickConnectStart:q,onClickConnectEnd:r,onNodeMouseEnter:s,onNodeMouseMove:t,onNodeMouseLeave:u,onNodeContextMenu:v,onNodeDoubleClick:z,onNodeDragStart:A,onNodeDrag:B,onNodeDragStop:C,onNodesDelete:F,onEdgesDelete:G,onDelete:H,onSelectionChange:I,onSelectionDragStart:J,onSelectionDrag:K,onSelectionDragStop:L,onSelectionContextMenu:M,onSelectionStart:N,onSelectionEnd:O,onBeforeDelete:P,connectionMode:Q,connectionLineType:R=y.Bezier,connectionLineStyle:S,connectionLineComponent:T,connectionLineContainerStyle:U,deleteKeyCode:V="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:X=!1,selectionMode:Y=x.Full,panActivationKeyCode:Z="Space",multiSelectionKeyCode:$=gU()?"Meta":"Control",zoomActivationKeyCode:_=gU()?"Meta":"Control",snapToGrid:aa,snapGrid:ab,onlyRenderVisibleElements:ac=!1,selectNodesOnDrag:ad,nodesDraggable:ae,autoPanOnNodeFocus:af,nodesConnectable:ag,nodesFocusable:ah,nodeOrigin:ai=h_,edgesFocusable:aj,edgesReconnectable:ak,elementsSelectable:al=!0,defaultViewport:am=h0,minZoom:an=.5,maxZoom:ao=2,translateExtent:ap=go,preventScrolling:aq=!0,nodeExtent:ar,defaultMarkerColor:as="#b1b1b7",zoomOnScroll:at=!0,zoomOnPinch:au=!0,panOnScroll:av=!1,panOnScrollSpeed:aw=.5,panOnScrollMode:ax=w.Free,zoomOnDoubleClick:ay=!0,panOnDrag:az=!0,onPaneClick:aA,onPaneMouseEnter:aB,onPaneMouseMove:aC,onPaneMouseLeave:aD,onPaneScroll:aE,onPaneContextMenu:aF,paneClickDistance:aG=1,nodeClickDistance:aH=0,children:aI,onReconnect:aJ,onReconnectStart:aK,onReconnectEnd:aL,onEdgeContextMenu:aM,onEdgeDoubleClick:aN,onEdgeMouseEnter:aO,onEdgeMouseMove:aP,onEdgeMouseLeave:aQ,reconnectRadius:aR=10,onNodesChange:aS,onEdgesChange:aT,noDragClassName:aU="nodrag",noWheelClassName:aV="nowheel",noPanClassName:aW="nopan",fitView:aX,fitViewOptions:aY,connectOnClick:aZ,attributionPosition:a$,proOptions:a_,defaultEdgeOptions:a0,elevateNodesOnSelect:a1=!0,elevateEdgesOnSelect:a2=!1,disableKeyboardA11y:a3=!1,autoPanOnConnect:a4,autoPanOnNodeDrag:a5,autoPanSpeed:a6,connectionRadius:a7,isValidConnection:a8,onError:a9,style:ba,id:bb,nodeDragThreshold:bc,connectionDragThreshold:bd,viewport:be,onViewportChange:bf,width:bg,height:bh,colorMode:bi="light",debug:bj,onScroll:bk,ariaLabelConfig:bl,zIndexMode:bm="basic",...bn},bo){let bp=bb||"1",bq=function(a){let[b,c]=(0,E.useState)("system"===a?null:a);return null!==b?b:"light"}(bi),br=(0,E.useCallback)(a=>{a.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),bk?.(a)},[bk]);return(0,D.jsx)("div",{"data-testid":"rf__wrapper",...bn,onScroll:br,style:{...ba,...jy},ref:bo,className:ee(["react-flow",e,bq]),id:bb,role:"application",children:(0,D.jsxs)(jx,{nodes:a,edges:b,width:bg,height:bh,fitView:aX,fitViewOptions:aY,minZoom:an,maxZoom:ao,nodeOrigin:ai,nodeExtent:ar,zIndexMode:bm,children:[(0,D.jsx)(ju,{onInit:j,onNodeClick:h,onEdgeClick:i,onNodeMouseEnter:s,onNodeMouseMove:t,onNodeMouseLeave:u,onNodeContextMenu:v,onNodeDoubleClick:z,nodeTypes:f,edgeTypes:g,connectionLineType:R,connectionLineStyle:S,connectionLineComponent:T,connectionLineContainerStyle:U,selectionKeyCode:W,selectionOnDrag:X,selectionMode:Y,deleteKeyCode:V,multiSelectionKeyCode:$,panActivationKeyCode:Z,zoomActivationKeyCode:_,onlyRenderVisibleElements:ac,defaultViewport:am,translateExtent:ap,minZoom:an,maxZoom:ao,preventScrolling:aq,zoomOnScroll:at,zoomOnPinch:au,zoomOnDoubleClick:ay,panOnScroll:av,panOnScrollSpeed:aw,panOnScrollMode:ax,panOnDrag:az,onPaneClick:aA,onPaneMouseEnter:aB,onPaneMouseMove:aC,onPaneMouseLeave:aD,onPaneScroll:aE,onPaneContextMenu:aF,paneClickDistance:aG,nodeClickDistance:aH,onSelectionContextMenu:M,onSelectionStart:N,onSelectionEnd:O,onReconnect:aJ,onReconnectStart:aK,onReconnectEnd:aL,onEdgeContextMenu:aM,onEdgeDoubleClick:aN,onEdgeMouseEnter:aO,onEdgeMouseMove:aP,onEdgeMouseLeave:aQ,reconnectRadius:aR,defaultMarkerColor:as,noDragClassName:aU,noWheelClassName:aV,noPanClassName:aW,rfId:bp,disableKeyboardA11y:a3,nodeExtent:ar,viewport:be,onViewportChange:bf}),(0,D.jsx)(h4,{nodes:a,edges:b,defaultNodes:c,defaultEdges:d,onConnect:n,onConnectStart:o,onConnectEnd:p,onClickConnectStart:q,onClickConnectEnd:r,nodesDraggable:ae,autoPanOnNodeFocus:af,nodesConnectable:ag,nodesFocusable:ah,edgesFocusable:aj,edgesReconnectable:ak,elementsSelectable:al,elevateNodesOnSelect:a1,elevateEdgesOnSelect:a2,minZoom:an,maxZoom:ao,nodeExtent:ar,onNodesChange:aS,onEdgesChange:aT,snapToGrid:aa,snapGrid:ab,connectionMode:Q,translateExtent:ap,connectOnClick:aZ,defaultEdgeOptions:a0,fitView:aX,fitViewOptions:aY,onNodesDelete:F,onEdgesDelete:G,onDelete:H,onNodeDragStart:A,onNodeDrag:B,onNodeDragStop:C,onSelectionDrag:K,onSelectionDragStart:J,onSelectionDragStop:L,onMove:k,onMoveStart:l,onMoveEnd:m,noPanClassName:aW,nodeOrigin:ai,rfId:bp,autoPanOnConnect:a4,autoPanOnNodeDrag:a5,autoPanSpeed:a6,onError:a9,connectionRadius:a7,isValidConnection:a8,selectNodesOnDrag:ad,nodeDragThreshold:bc,connectionDragThreshold:bd,onBeforeDelete:P,debug:bj,ariaLabelConfig:bl,zIndexMode:bm}),(0,D.jsx)(h$,{onSelectionChange:I}),aI,(0,D.jsx)(hU,{proOptions:a_,position:a$}),(0,D.jsx)(hS,{rfId:bp,disableKeyboardA11y:a3})]})})});(r=C||(C={})).Lines="lines",r.Dots="dots",r.Cross="cross",C.Dots,C.Lines,C.Cross;let jA=(0,E.memo)(function({id:a,x:b,y:c,width:d,height:e,style:f,color:g,strokeColor:h,strokeWidth:i,className:j,borderRadius:k,shapeRendering:l,selected:m,onClick:n}){let{background:o,backgroundColor:p}=f||{};return(0,D.jsx)("rect",{className:ee(["react-flow__minimap-node",{selected:m},j]),x:b,y:c,rx:k,ry:k,width:d,height:e,style:{fill:g||o||p,stroke:h,strokeWidth:i},shapeRendering:l,onClick:n?b=>n(b,a):void 0})}),jB=a=>a.nodes.map(a=>a.id),jC=a=>a instanceof Function?a:()=>a,jD=(0,E.memo)(function({id:a,nodeColorFunc:b,nodeStrokeColorFunc:c,nodeClassNameFunc:d,nodeBorderRadius:e,nodeStrokeWidth:f,shapeRendering:g,NodeComponent:h,onClick:i}){let{node:j,x:k,y:l,width:m,height:n}=hJ(b=>{let c=b.nodeLookup.get(a);if(!c)return{node:void 0,x:0,y:0,width:0,height:0};let d=c.internals.userNode,{x:e,y:f}=c.internals.positionAbsolute,{width:g,height:h}=gW(d);return{node:d,x:e,y:f,width:g,height:h}},hF);return j&&!j.hidden&&gX(j)?(0,D.jsx)(h,{x:k,y:l,width:m,height:n,style:j.style,selected:!!j.selected,className:d(j),color:b(j),borderRadius:e,strokeColor:c(j),strokeWidth:f,shapeRendering:g,onClick:i,id:j.id}):null});B.Line,B.Handle,c(5222);let jE=K("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]),jF=K("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),jG=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],jH=new Set(jG),jI=(a,b,c)=>c>b?b:c<a?a:c,jJ={test:a=>"number"==typeof a,parse:parseFloat,transform:a=>a},jK={...jJ,transform:a=>jI(0,1,a)},jL={...jJ,default:1},jM=a=>Math.round(1e5*a)/1e5,jN=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,jO=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,jP=(a,b)=>c=>!!("string"==typeof c&&jO.test(c)&&c.startsWith(a)||b&&null!=c&&Object.prototype.hasOwnProperty.call(c,b)),jQ=(a,b,c)=>d=>{if("string"!=typeof d)return d;let[e,f,g,h]=d.match(jN);return{[a]:parseFloat(e),[b]:parseFloat(f),[c]:parseFloat(g),alpha:void 0!==h?parseFloat(h):1}},jR={...jJ,transform:a=>Math.round(jI(0,255,a))},jS={test:jP("rgb","red"),parse:jQ("red","green","blue"),transform:({red:a,green:b,blue:c,alpha:d=1})=>"rgba("+jR.transform(a)+", "+jR.transform(b)+", "+jR.transform(c)+", "+jM(jK.transform(d))+")"},jT={test:jP("#"),parse:function(a){let b="",c="",d="",e="";return a.length>5?(b=a.substring(1,3),c=a.substring(3,5),d=a.substring(5,7),e=a.substring(7,9)):(b=a.substring(1,2),c=a.substring(2,3),d=a.substring(3,4),e=a.substring(4,5),b+=b,c+=c,d+=d,e+=e),{red:parseInt(b,16),green:parseInt(c,16),blue:parseInt(d,16),alpha:e?parseInt(e,16)/255:1}},transform:jS.transform},jU=a=>({test:b=>"string"==typeof b&&b.endsWith(a)&&1===b.split(" ").length,parse:parseFloat,transform:b=>`${b}${a}`}),jV=jU("deg"),jW=jU("%"),jX=jU("px"),jY=jU("vh"),jZ=jU("vw"),j$={...jW,parse:a=>jW.parse(a)/100,transform:a=>jW.transform(100*a)},j_={test:jP("hsl","hue"),parse:jQ("hue","saturation","lightness"),transform:({hue:a,saturation:b,lightness:c,alpha:d=1})=>"hsla("+Math.round(a)+", "+jW.transform(jM(b))+", "+jW.transform(jM(c))+", "+jM(jK.transform(d))+")"},j0={test:a=>jS.test(a)||jT.test(a)||j_.test(a),parse:a=>jS.test(a)?jS.parse(a):j_.test(a)?j_.parse(a):jT.parse(a),transform:a=>"string"==typeof a?a:a.hasOwnProperty("red")?jS.transform(a):j_.transform(a),getAnimatableNone:a=>{let b=j0.parse(a);return b.alpha=0,j0.transform(b)}},j1=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,j2="number",j3="color",j4=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function j5(a){let b=a.toString(),c=[],d={color:[],number:[],var:[]},e=[],f=0,g=b.replace(j4,a=>(j0.test(a)?(d.color.push(f),e.push(j3),c.push(j0.parse(a))):a.startsWith("var(")?(d.var.push(f),e.push("var"),c.push(a)):(d.number.push(f),e.push(j2),c.push(parseFloat(a))),++f,"${}")).split("${}");return{values:c,split:g,indexes:d,types:e}}function j6(a){return j5(a).values}function j7(a){let{split:b,types:c}=j5(a),d=b.length;return a=>{let e="";for(let f=0;f<d;f++)if(e+=b[f],void 0!==a[f]){let b=c[f];b===j2?e+=jM(a[f]):b===j3?e+=j0.transform(a[f]):e+=a[f]}return e}}let j8=a=>"number"==typeof a?0:j0.test(a)?j0.getAnimatableNone(a):a,j9={test:function(a){return isNaN(a)&&"string"==typeof a&&(a.match(jN)?.length||0)+(a.match(j1)?.length||0)>0},parse:j6,createTransformer:j7,getAnimatableNone:function(a){let b=j6(a);return j7(a)(b.map(j8))}},ka=new Set(["brightness","contrast","saturate","opacity"]);function kb(a){let[b,c]=a.slice(0,-1).split("(");if("drop-shadow"===b)return a;let[d]=c.match(jN)||[];if(!d)return a;let e=c.replace(d,""),f=+!!ka.has(b);return d!==c&&(f*=100),b+"("+f+e+")"}let kc=/\b([a-z-]*)\(.*?\)/gu,kd={...j9,getAnimatableNone:a=>{let b=a.match(kc);return b?b.map(kb).join(" "):a}},ke={...j9,getAnimatableNone:a=>{let b=j9.parse(a);return j9.createTransformer(a)(b.map(a=>"number"==typeof a?0:"object"==typeof a?{...a,alpha:1}:a))}},kf={...jJ,transform:Math.round},kg={borderWidth:jX,borderTopWidth:jX,borderRightWidth:jX,borderBottomWidth:jX,borderLeftWidth:jX,borderRadius:jX,borderTopLeftRadius:jX,borderTopRightRadius:jX,borderBottomRightRadius:jX,borderBottomLeftRadius:jX,width:jX,maxWidth:jX,height:jX,maxHeight:jX,top:jX,right:jX,bottom:jX,left:jX,inset:jX,insetBlock:jX,insetBlockStart:jX,insetBlockEnd:jX,insetInline:jX,insetInlineStart:jX,insetInlineEnd:jX,padding:jX,paddingTop:jX,paddingRight:jX,paddingBottom:jX,paddingLeft:jX,paddingBlock:jX,paddingBlockStart:jX,paddingBlockEnd:jX,paddingInline:jX,paddingInlineStart:jX,paddingInlineEnd:jX,margin:jX,marginTop:jX,marginRight:jX,marginBottom:jX,marginLeft:jX,marginBlock:jX,marginBlockStart:jX,marginBlockEnd:jX,marginInline:jX,marginInlineStart:jX,marginInlineEnd:jX,fontSize:jX,backgroundPositionX:jX,backgroundPositionY:jX,rotate:jV,rotateX:jV,rotateY:jV,rotateZ:jV,scale:jL,scaleX:jL,scaleY:jL,scaleZ:jL,skew:jV,skewX:jV,skewY:jV,distance:jX,translateX:jX,translateY:jX,translateZ:jX,x:jX,y:jX,z:jX,perspective:jX,transformPerspective:jX,opacity:jK,originX:j$,originY:j$,originZ:jX,zIndex:kf,fillOpacity:jK,strokeOpacity:jK,numOctaves:kf},kh={...kg,color:j0,backgroundColor:j0,outlineColor:j0,fill:j0,stroke:j0,borderColor:j0,borderTopColor:j0,borderRightColor:j0,borderBottomColor:j0,borderLeftColor:j0,filter:kd,WebkitFilter:kd,mask:ke,WebkitMask:ke},ki=a=>kh[a],kj=()=>({translate:0,scale:1,origin:0,originPoint:0}),kk=()=>({x:kj(),y:kj()}),kl=()=>({min:0,max:0}),km=()=>({x:kl(),y:kl()}),kn=a=>!!(a&&a.getVelocity),ko=new Set(["width","height","top","left","right","bottom",...jG]),kp=a=>b=>b.test(a),kq=[jJ,jX,jW,jV,jZ,jY,{test:a=>"auto"===a,parse:a=>a}],kr=a=>kq.find(kp(a)),ks=()=>{},kt=()=>{},ku=a=>b=>"string"==typeof b&&b.startsWith(a),kv=ku("--"),kw=ku("var(--"),kx=a=>!!kw(a)&&ky.test(a.split("/*")[0].trim()),ky=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function kz(a){return"string"==typeof a&&a.split("/*")[0].includes("var(--")}let kA=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,kB=a=>180*a/Math.PI,kC=a=>kE(kB(Math.atan2(a[1],a[0]))),kD={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:a=>(Math.abs(a[0])+Math.abs(a[3]))/2,rotate:kC,rotateZ:kC,skewX:a=>kB(Math.atan(a[1])),skewY:a=>kB(Math.atan(a[2])),skew:a=>(Math.abs(a[1])+Math.abs(a[2]))/2},kE=a=>((a%=360)<0&&(a+=360),a),kF=a=>Math.sqrt(a[0]*a[0]+a[1]*a[1]),kG=a=>Math.sqrt(a[4]*a[4]+a[5]*a[5]),kH={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:kF,scaleY:kG,scale:a=>(kF(a)+kG(a))/2,rotateX:a=>kE(kB(Math.atan2(a[6],a[5]))),rotateY:a=>kE(kB(Math.atan2(-a[2],a[0]))),rotateZ:kC,rotate:kC,skewX:a=>kB(Math.atan(a[4])),skewY:a=>kB(Math.atan(a[1])),skew:a=>(Math.abs(a[1])+Math.abs(a[4]))/2};function kI(a){return+!!a.includes("scale")}function kJ(a,b){let c,d;if(!a||"none"===a)return kI(b);let e=a.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(e)c=kH,d=e;else{let b=a.match(/^matrix\(([-\d.e\s,]+)\)$/u);c=kD,d=b}if(!d)return kI(b);let f=c[b],g=d[1].split(",").map(kK);return"function"==typeof f?f(g):g[f]}function kK(a){return parseFloat(a.trim())}let kL=a=>a===jJ||a===jX,kM=new Set(["x","y","z"]),kN=jG.filter(a=>!kM.has(a)),kO={width:({x:a},{paddingLeft:b="0",paddingRight:c="0"})=>a.max-a.min-parseFloat(b)-parseFloat(c),height:({y:a},{paddingTop:b="0",paddingBottom:c="0"})=>a.max-a.min-parseFloat(b)-parseFloat(c),top:(a,{top:b})=>parseFloat(b),left:(a,{left:b})=>parseFloat(b),bottom:({y:a},{top:b})=>parseFloat(b)+(a.max-a.min),right:({x:a},{left:b})=>parseFloat(b)+(a.max-a.min),x:(a,{transform:b})=>kJ(b,"x"),y:(a,{transform:b})=>kJ(b,"y")};kO.translateX=kO.x,kO.translateY=kO.y;let kP=a=>a,kQ={},kR=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function kS(a,b){let c=!1,d=!0,e={delta:0,timestamp:0,isProcessing:!1},f=()=>c=!0,g=kR.reduce((a,c)=>(a[c]=function(a,b){let c=new Set,d=new Set,e=!1,f=!1,g=new WeakSet,h={delta:0,timestamp:0,isProcessing:!1},i=0;function j(b){g.has(b)&&(k.schedule(b),a()),i++,b(h)}let k={schedule:(a,b=!1,f=!1)=>{let h=f&&e?c:d;return b&&g.add(a),h.has(a)||h.add(a),a},cancel:a=>{d.delete(a),g.delete(a)},process:a=>{if(h=a,e){f=!0;return}e=!0,[c,d]=[d,c],c.forEach(j),b,i=0,c.clear(),e=!1,f&&(f=!1,k.process(a))}};return k}(f,b?c:void 0),a),{}),{setup:h,read:i,resolveKeyframes:j,preUpdate:k,update:l,preRender:m,render:n,postRender:o}=g,p=()=>{let f=kQ.useManualTiming?e.timestamp:performance.now();c=!1,kQ.useManualTiming||(e.delta=d?1e3/60:Math.max(Math.min(f-e.timestamp,40),1)),e.timestamp=f,e.isProcessing=!0,h.process(e),i.process(e),j.process(e),k.process(e),l.process(e),m.process(e),n.process(e),o.process(e),e.isProcessing=!1,c&&b&&(d=!1,a(p))};return{schedule:kR.reduce((b,f)=>{let h=g[f];return b[f]=(b,f=!1,g=!1)=>(!c&&(c=!0,d=!0,e.isProcessing||a(p)),h.schedule(b,f,g)),b},{}),cancel:a=>{for(let b=0;b<kR.length;b++)g[kR[b]].cancel(a)},state:e,steps:g}}let{schedule:kT,cancel:kU,state:kV,steps:kW}=kS("u">typeof requestAnimationFrame?requestAnimationFrame:kP,!0),kX=new Set,kY=!1,kZ=!1,k$=!1;function k_(){if(kZ){let a=Array.from(kX).filter(a=>a.needsMeasurement),b=new Set(a.map(a=>a.element)),c=new Map;b.forEach(a=>{let b,d=(b=[],kN.forEach(c=>{let d=a.getValue(c);void 0!==d&&(b.push([c,d.get()]),d.set(+!!c.startsWith("scale")))}),b);d.length&&(c.set(a,d),a.render())}),a.forEach(a=>a.measureInitialState()),b.forEach(a=>{a.render();let b=c.get(a);b&&b.forEach(([b,c])=>{a.getValue(b)?.set(c)})}),a.forEach(a=>a.measureEndState()),a.forEach(a=>{void 0!==a.suspendedScrollY&&window.scrollTo(0,a.suspendedScrollY)})}kZ=!1,kY=!1,kX.forEach(a=>a.complete(k$)),kX.clear()}function k0(){kX.forEach(a=>{a.readKeyframes(),a.needsMeasurement&&(kZ=!0)})}class k1{constructor(a,b,c,d,e,f=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...a],this.onComplete=b,this.name=c,this.motionValue=d,this.element=e,this.isAsync=f}scheduleResolve(){this.state="scheduled",this.isAsync?(kX.add(this),kY||(kY=!0,kT.read(k0),kT.resolveKeyframes(k_))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:a,name:b,element:c,motionValue:d}=this;if(null===a[0]){let e=d?.get(),f=a[a.length-1];if(void 0!==e)a[0]=e;else if(c&&b){let d=c.readValue(b,f);null!=d&&(a[0]=d)}void 0===a[0]&&(a[0]=f),d&&void 0===e&&d.set(a[0])}for(let b=1;b<a.length;b++)a[b]??(a[b]=a[b-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(a=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,a),kX.delete(this)}cancel(){"scheduled"===this.state&&(kX.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}let k2=new Set([kd,ke]);function k3(a,b){let c=ki(a);return k2.has(c)||(c=j9),c.getAnimatableNone?c.getAnimatableNone(b):void 0}let k4=new Set(["auto","none","0"]);class k5 extends k1{constructor(a,b,c,d,e){super(a,b,c,d,e,!0)}readKeyframes(){let{unresolvedKeyframes:a,element:b,name:c}=this;if(!b||!b.current)return;super.readKeyframes();for(let c=0;c<a.length;c++){let d=a[c];if("string"==typeof d&&kx(d=d.trim())){let e=function a(b,c,d=1){kt(d<=4,`Max CSS variable fallback depth detected in property "${b}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[e,f]=function(a){let b=kA.exec(a);if(!b)return[,];let[,c,d,e]=b;return[`--${c??d}`,e]}(b);if(!e)return;let g=window.getComputedStyle(c).getPropertyValue(e);if(g){let a=g.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(a)?parseFloat(a):a}return kx(f)?a(f,c,d+1):f}(d,b.current);void 0!==e&&(a[c]=e),c===a.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!ko.has(c)||2!==a.length)return;let[d,e]=a,f=kr(d),g=kr(e);if(kz(d)!==kz(e)&&kO[c]){this.needsMeasurement=!0;return}if(f!==g)if(kL(f)&&kL(g))for(let b=0;b<a.length;b++){let c=a[b];"string"==typeof c&&(a[b]=parseFloat(c))}else kO[c]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:a,name:b}=this,c=[];for(let b=0;b<a.length;b++)(null===a[b]||function(a){if("number"==typeof a)return 0===a;if(null===a)return!0;return"none"===a||"0"===a||/^0[^.\s]+$/u.test(a)}(a[b]))&&c.push(b);c.length&&function(a,b,c){let d,e=0;for(;e<a.length&&!d;){let b=a[e];"string"==typeof b&&!k4.has(b)&&j5(b).values.length&&(d=a[e]),e++}if(d&&c)for(let e of b)a[e]=k3(c,d)}(a,c,b)}measureInitialState(){let{element:a,unresolvedKeyframes:b,name:c}=this;if(!a||!a.current)return;"height"===c&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=kO[c](a.measureViewportBox(),window.getComputedStyle(a.current)),b[0]=this.measuredOrigin;let d=b[b.length-1];void 0!==d&&a.getValue(c,d).jump(d,!1)}measureEndState(){let{element:a,name:b,unresolvedKeyframes:c}=this;if(!a||!a.current)return;let d=a.getValue(b);d&&d.jump(this.measuredOrigin,!1);let e=c.length-1,f=c[e];c[e]=kO[b](a.measureViewportBox(),window.getComputedStyle(a.current)),null!==f&&void 0===this.finalKeyframe&&(this.finalKeyframe=f),this.removedTransforms?.length&&this.removedTransforms.forEach(([b,c])=>{a.getValue(b).set(c)}),this.resolveNoneKeyframes()}}let k6=a=>1e3*a;function k7(a,b){-1===a.indexOf(b)&&a.push(b)}function k8(a,b){let c=a.indexOf(b);c>-1&&a.splice(c,1)}class k9{constructor(){this.subscriptions=[]}add(a){return k7(this.subscriptions,a),()=>k8(this.subscriptions,a)}notify(a,b,c){let d=this.subscriptions.length;if(d)if(1===d)this.subscriptions[0](a,b,c);else for(let e=0;e<d;e++){let d=this.subscriptions[e];d&&d(a,b,c)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function la(a){let b;return()=>(void 0===b&&(b=a()),b)}let lb={};function lc(a,b){let c=la(a);return()=>lb[b]??c()}let ld=lc(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),le=a=>null!==a;function lf(a,{repeat:b,repeatType:c="loop"},d,e=1){let f=a.filter(le),g=e<0||b&&"loop"!==c&&b%2==1?0:f.length-1;return g&&void 0!==d?d:f[g]}class lg{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(a=>{this.resolve=a})}notifyFinished(){this.resolve()}then(a,b){return this.finished.then(a,b)}}let lh={layout:0,mainThread:0,waapi:0},li=a=>Array.isArray(a)&&"number"==typeof a[0],lj=lc(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(a){return!1}return!0},"linearEasing"),lk=(a,b,c=10)=>{let d="",e=Math.max(Math.round(b/c),2);for(let b=0;b<e;b++)d+=Math.round(1e4*a(b/(e-1)))/1e4+", ";return`linear(${d.substring(0,d.length-2)})`},ll=([a,b,c,d])=>`cubic-bezier(${a}, ${b}, ${c}, ${d})`,lm={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ll([0,.65,.55,1]),circOut:ll([.55,0,1,.45]),backIn:ll([.31,.01,.66,-.59]),backOut:ll([.33,1.53,.69,.99])};function ln(a){return"function"==typeof a&&"applyToOptions"in a}class lo extends lg{constructor(a){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!a)return;const{element:b,name:c,keyframes:d,pseudoElement:e,allowFlatten:f=!1,finalKeyframe:g,onComplete:h}=a;this.isPseudoElement=!!e,this.allowFlatten=f,this.options=a,kt("string"!=typeof a.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const i=function({type:a,...b}){return ln(a)&&lj()?a.applyToOptions(b):(b.duration??(b.duration=300),b.ease??(b.ease="easeOut"),b)}(a);this.animation=function(a,b,c,{delay:d=0,duration:e=300,repeat:f=0,repeatType:g="loop",ease:h="easeOut",times:i}={},j){let k={[b]:c};i&&(k.offset=i);let l=function a(b,c){if(b)return"function"==typeof b?lj()?lk(b,c):"ease-out":li(b)?ll(b):Array.isArray(b)?b.map(b=>a(b,c)||lm.easeOut):lm[b]}(h,e);Array.isArray(l)&&(k.easing=l);let m={delay:d,duration:e,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:f+1,direction:"reverse"===g?"alternate":"normal"};j&&(m.pseudoElement=j);let n=a.animate(k,m);return n}(b,c,d,i,e),!1===i.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!e){let a=lf(d,this.options,g,this.speed);this.updateMotionValue&&this.updateMotionValue(a);c.startsWith("--")?b.style.setProperty(c,a):b.style[c]=a,this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(a){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:a}=this;"idle"!==a&&"finished"!==a&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let a=this.options?.element;!this.isPseudoElement&&a?.isConnected&&this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:a=0}=this.options||{};return this.duration+a/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(a){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=k6(a)}get speed(){return this.animation.playbackRate}set speed(a){a<0&&(this.finishedTime=null),this.animation.playbackRate=a}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(a){this.manualStartTime=this.animation.startTime=a}attachTimeline({timeline:a,rangeStart:b,rangeEnd:c,observe:d}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,a&&ld())?(this.animation.timeline=a,b&&(this.animation.rangeStart=b),c&&(this.animation.rangeEnd=c),kP):d(this)}}let lp=new Set(["opacity","clipPath","filter","transform"]),{schedule:lq}=kS(queueMicrotask,!1);function lr(){d=void 0}let ls={now:()=>(void 0===d&&ls.set(kV.isProcessing||kQ.useManualTiming?kV.timestamp:performance.now()),d),set:a=>{d=a,queueMicrotask(lr)}};class lt{constructor(a,b={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{let b=ls.now();if(this.updatedAt!==b&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(a),this.owner=b.owner}setCurrent(a){this.current=a,this.updatedAt=ls.now(),null===this.canTrackVelocity&&void 0!==a&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(a=this.current){this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt}onChange(a){return this.on("change",a)}on(a,b){this.events[a]||(this.events[a]=new k9);let c=this.events[a].add(b);return"change"===a?()=>{c(),kT.read(()=>{this.events.change.getSize()||this.stop()})}:c}clearListeners(){for(let a in this.events)this.events[a].clear()}attach(a,b){this.passiveEffect=a,this.stopPassiveEffect=b}set(a){this.passiveEffect?this.passiveEffect(a,this.updateAndNotify):this.updateAndNotify(a)}setWithVelocity(a,b,c){this.set(b),this.prev=void 0,this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt-c}jump(a,b=!0){this.updateAndNotify(a),this.prev=a,this.prevUpdatedAt=this.prevFrameValue=void 0,b&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(a){this.dependents||(this.dependents=new Set),this.dependents.add(a)}removeDependent(a){this.dependents&&this.dependents.delete(a)}get(){return j&&j.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var a;let b=ls.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||b-this.updatedAt>30)return 0;let c=Math.min(this.updatedAt-this.prevUpdatedAt,30);return a=parseFloat(this.current)-parseFloat(this.prevFrameValue),c?1e3/c*a:0}start(a){return this.stop(),new Promise(b=>{this.hasAnimated=!0,this.animation=a(b),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function lu(a,b){return new lt(a,b)}let lv=[...kq,j0,j9],lw=new WeakMap;function lx(a){return null!==a&&"object"==typeof a&&"function"==typeof a.start}function ly(a){return"string"==typeof a||Array.isArray(a)}let lz=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],lA=["initial",...lz];function lB(a){return lx(a.animate)||lA.some(b=>ly(a[b]))}function lC(a){return!!(lB(a)||a.variants)}let lD={current:null},lE={current:!1},lF="u">typeof window;function lG(a){let b=[{},{}];return a?.values.forEach((a,c)=>{b[0][c]=a.get(),b[1][c]=a.getVelocity()}),b}function lH(a,b,c,d){if("function"==typeof b){let[e,f]=lG(d);b=b(void 0!==c?c:a.custom,e,f)}if("string"==typeof b&&(b=a.variants&&a.variants[b]),"function"==typeof b){let[e,f]=lG(d);b=b(void 0!==c?c:a.custom,e,f)}return b}let lI=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],lJ={};class lK{scrapeMotionValuesFromProps(a,b,c){return{}}constructor({parent:a,props:b,presenceContext:c,reducedMotionConfig:d,skipAnimations:e,blockInitialAnimation:f,visualState:g},h={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=k1,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let a=ls.now();this.renderScheduledAt<a&&(this.renderScheduledAt=a,kT.render(this.render,!1,!0))};const{latestValues:i,renderState:j}=g;this.latestValues=i,this.baseTarget={...i},this.initialValues=b.initial?{...i}:{},this.renderState=j,this.parent=a,this.props=b,this.presenceContext=c,this.depth=a?a.depth+1:0,this.reducedMotionConfig=d,this.skipAnimationsConfig=e,this.options=h,this.blockInitialAnimation=!!f,this.isControllingVariants=lB(b),this.isVariantNode=lC(b),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(a&&a.current);const{willChange:k,...l}=this.scrapeMotionValuesFromProps(b,{},this);for(const a in l){const b=l[a];void 0!==i[a]&&kn(b)&&b.set(i[a])}}mount(a){if(this.hasBeenMounted)for(let a in this.initialValues)this.values.get(a)?.jump(this.initialValues[a]),this.latestValues[a]=this.initialValues[a];this.current=a,lw.set(a,this),this.projection&&!this.projection.instance&&this.projection.mount(a),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((a,b)=>this.bindToMotionValue(b,a)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(lE.current||function(){if(lE.current=!0,lF)if(window.matchMedia){let a=window.matchMedia("(prefers-reduced-motion)"),b=()=>lD.current=a.matches;a.addEventListener("change",b),b()}else lD.current=!1}(),this.shouldReduceMotion=lD.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){for(let a in this.projection&&this.projection.unmount(),kU(this.notifyUpdate),kU(this.render),this.valueSubscriptions.forEach(a=>a()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[a].clear();for(let a in this.features){let b=this.features[a];b&&(b.unmount(),b.isMounted=!1)}this.current=null}addChild(a){this.children.add(a),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(a)}removeChild(a){this.children.delete(a),this.enteringChildren&&this.enteringChildren.delete(a)}bindToMotionValue(a,b){let c;if(this.valueSubscriptions.has(a)&&this.valueSubscriptions.get(a)(),b.accelerate&&lp.has(a)&&this.current instanceof HTMLElement){let{factory:c,keyframes:d,times:e,ease:f,duration:g}=b.accelerate,h=new lo({element:this.current,name:a,keyframes:d,times:e,ease:f,duration:k6(g)}),i=c(h);this.valueSubscriptions.set(a,()=>{i(),h.cancel()});return}let d=jH.has(a);d&&this.onBindTransform&&this.onBindTransform();let e=b.on("change",b=>{this.latestValues[a]=b,this.props.onUpdate&&kT.preRender(this.notifyUpdate),d&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});"u">typeof window&&window.MotionCheckAppearSync&&(c=window.MotionCheckAppearSync(this,a,b)),this.valueSubscriptions.set(a,()=>{e(),c&&c(),b.owner&&b.stop()})}sortNodePosition(a){return this.current&&this.sortInstanceNodePosition&&this.type===a.type?this.sortInstanceNodePosition(this.current,a.current):0}updateFeatures(){let a="animation";for(a in lJ){let b=lJ[a];if(!b)continue;let{isEnabled:c,Feature:d}=b;if(!this.features[a]&&d&&c(this.props)&&(this.features[a]=new d(this)),this.features[a]){let b=this.features[a];b.isMounted?b.update():(b.mount(),b.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):km()}getStaticValue(a){return this.latestValues[a]}setStaticValue(a,b){this.latestValues[a]=b}update(a,b){(a.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=a,this.prevPresenceContext=this.presenceContext,this.presenceContext=b;for(let b=0;b<lI.length;b++){let c=lI[b];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);let d=a["on"+c];d&&(this.propEventSubscriptions[c]=this.on(c,d))}this.prevMotionValues=function(a,b,c){for(let d in b){let e=b[d],f=c[d];if(kn(e))a.addValue(d,e);else if(kn(f))a.addValue(d,lu(e,{owner:a}));else if(f!==e)if(a.hasValue(d)){let b=a.getValue(d);!0===b.liveStyle?b.jump(e):b.hasAnimated||b.set(e)}else{let b=a.getStaticValue(d);a.addValue(d,lu(void 0!==b?b:e,{owner:a}))}}for(let d in c)void 0===b[d]&&a.removeValue(d);return b}(this,this.scrapeMotionValuesFromProps(a,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(a){return this.props.variants?this.props.variants[a]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(a){let b=this.getClosestVariantNode();if(b)return b.variantChildren&&b.variantChildren.add(a),()=>b.variantChildren.delete(a)}addValue(a,b){let c=this.values.get(a);b!==c&&(c&&this.removeValue(a),this.bindToMotionValue(a,b),this.values.set(a,b),this.latestValues[a]=b.get())}removeValue(a){this.values.delete(a);let b=this.valueSubscriptions.get(a);b&&(b(),this.valueSubscriptions.delete(a)),delete this.latestValues[a],this.removeValueFromRenderState(a,this.renderState)}hasValue(a){return this.values.has(a)}getValue(a,b){if(this.props.values&&this.props.values[a])return this.props.values[a];let c=this.values.get(a);return void 0===c&&void 0!==b&&(c=lu(null===b?void 0:b,{owner:this}),this.addValue(a,c)),c}readValue(a,b){let c=void 0===this.latestValues[a]&&this.current?this.getBaseTargetFromProps(this.props,a)??this.readValueFromInstance(this.current,a,this.options):this.latestValues[a];if(null!=c){let d,e;if("string"==typeof c&&(d=c,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(d)||(e=c,/^0[^.\s]+$/u.test(e))))c=parseFloat(c);else{let d;d=c,!lv.find(kp(d))&&j9.test(b)&&(c=k3(a,b))}this.setBaseTarget(a,kn(c)?c.get():c)}return kn(c)?c.get():c}setBaseTarget(a,b){this.baseTarget[a]=b}getBaseTarget(a){let b,{initial:c}=this.props;if("string"==typeof c||"object"==typeof c){let d=lH(this.props,c,this.presenceContext?.custom);d&&(b=d[a])}if(c&&void 0!==b)return b;let d=this.getBaseTargetFromProps(this.props,a);return void 0===d||kn(d)?void 0!==this.initialValues[a]&&void 0===b?void 0:this.baseTarget[a]:d}on(a,b){return this.events[a]||(this.events[a]=new k9),this.events[a].add(b)}notify(a,...b){this.events[a]&&this.events[a].notify(...b)}scheduleRenderMicrotask(){lq.render(this.render)}}class lL extends lK{constructor(){super(...arguments),this.KeyframeResolver=k5}sortInstanceNodePosition(a,b){return 2&a.compareDocumentPosition(b)?1:-1}getBaseTargetFromProps(a,b){let c=a.style;return c?c[b]:void 0}removeValueFromRenderState(a,{vars:b,style:c}){delete b[a],delete c[a]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:a}=this.props;kn(a)&&(this.childSubscription=a.on("change",a=>{this.current&&(this.current.textContent=`${a}`)}))}}function lM(a){return a.replace(/([A-Z])/g,a=>`-${a.toLowerCase()}`)}let lN=(a,b)=>b&&"number"==typeof a?b.transform(a):a,lO={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},lP=jG.length;function lQ(a,b,c){let{style:d,vars:e,transformOrigin:f}=a,g=!1,h=!1;for(let a in b){let c=b[a];if(jH.has(a)){g=!0;continue}if(kv(a)){e[a]=c;continue}{let b=lN(c,kg[a]);a.startsWith("origin")?(h=!0,f[a]=b):d[a]=b}}if(!b.transform&&(g||c?d.transform=function(a,b,c){let d="",e=!0;for(let f=0;f<lP;f++){let g=jG[f],h=a[g];if(void 0===h)continue;let i=!0;if("number"==typeof h)i=h===+!!g.startsWith("scale");else{let a=parseFloat(h);i=g.startsWith("scale")?1===a:0===a}if(!i||c){let a=lN(h,kg[g]);if(!i){e=!1;let b=lO[g]||g;d+=`${b}(${a}) `}c&&(b[g]=a)}}return d=d.trim(),c?d=c(b,e?"":d):e&&(d="none"),d}(b,a.transform,c):d.transform&&(d.transform="none")),h){let{originX:a="50%",originY:b="50%",originZ:c=0}=f;d.transformOrigin=`${a} ${b} ${c}`}}let lR={offset:"stroke-dashoffset",array:"stroke-dasharray"},lS={offset:"strokeDashoffset",array:"strokeDasharray"},lT=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function lU(a,{attrX:b,attrY:c,attrScale:d,pathLength:e,pathSpacing:f=1,pathOffset:g=0,...h},i,j,k){if(lQ(a,h,j),i){a.style.viewBox&&(a.attrs.viewBox=a.style.viewBox);return}a.attrs=a.style,a.style={};let{attrs:l,style:m}=a;for(let a of(l.transform&&(m.transform=l.transform,delete l.transform),(m.transform||l.transformOrigin)&&(m.transformOrigin=l.transformOrigin??"50% 50%",delete l.transformOrigin),m.transform&&(m.transformBox=k?.transformBox??"fill-box",delete l.transformBox),lT))void 0!==l[a]&&(m[a]=l[a],delete l[a]);void 0!==b&&(l.x=b),void 0!==c&&(l.y=c),void 0!==d&&(l.scale=d),void 0!==e&&function(a,b,c=1,d=0,e=!0){a.pathLength=1;let f=e?lR:lS;a[f.offset]=`${-d}`,a[f.array]=`${b} ${c}`}(l,e,f,g,!1)}let lV=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),lW=a=>"string"==typeof a&&"svg"===a.toLowerCase();function lX(a,{style:b,vars:c},d,e){let f,g=a.style;for(f in b)g[f]=b[f];for(f in e?.applyProjectionStyles(g,d),c)g.setProperty(f,c[f])}function lY(a,b){return b.max===b.min?0:a/(b.max-b.min)*100}let lZ={correct:(a,b)=>{if(!b.target)return a;if("string"==typeof a)if(!jX.test(a))return a;else a=parseFloat(a);let c=lY(a,b.target.x),d=lY(a,b.target.y);return`${c}% ${d}%`}},l$=(a,b,c)=>a+(b-a)*c,l_={borderRadius:{...lZ,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:lZ,borderTopRightRadius:lZ,borderBottomLeftRadius:lZ,borderBottomRightRadius:lZ,boxShadow:{correct:(a,{treeScale:b,projectionDelta:c})=>{let d=j9.parse(a);if(d.length>5)return a;let e=j9.createTransformer(a),f=+("number"!=typeof d[0]),g=c.x.scale*b.x,h=c.y.scale*b.y;d[0+f]/=g,d[1+f]/=h;let i=l$(g,h,.5);return"number"==typeof d[2+f]&&(d[2+f]/=i),"number"==typeof d[3+f]&&(d[3+f]/=i),e(d)}}};function l0(a,{layout:b,layoutId:c}){return jH.has(a)||a.startsWith("origin")||(b||void 0!==c)&&(!!l_[a]||"opacity"===a)}function l1(a,b,c){let d=a.style,e=b?.style,f={};if(!d)return f;for(let b in d)(kn(d[b])||e&&kn(e[b])||l0(b,a)||c?.getValue(b)?.liveStyle!==void 0)&&(f[b]=d[b]);return f}function l2(a,b,c){let d=l1(a,b,c);for(let c in a)(kn(a[c])||kn(b[c]))&&(d[-1!==jG.indexOf(c)?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c]=a[c]);return d}class l3 extends lL{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=km}getBaseTargetFromProps(a,b){return a[b]}readValueFromInstance(a,b){if(jH.has(b)){let a=ki(b);return a&&a.default||0}return b=lV.has(b)?b:lM(b),a.getAttribute(b)}scrapeMotionValuesFromProps(a,b,c){return l2(a,b,c)}build(a,b,c){lU(a,b,this.isSVGTag,c.transformTemplate,c.style)}renderInstance(a,b,c,d){for(let c in lX(a,b,void 0,d),b.attrs)a.setAttribute(lV.has(c)?c:lM(c),b.attrs[c])}mount(a){this.isSVGTag=lW(a.tagName),super.mount(a)}}function l4({top:a,left:b,right:c,bottom:d}){return{x:{min:b,max:c},y:{min:a,max:d}}}function l5(a){return void 0===a||1===a}function l6({scale:a,scaleX:b,scaleY:c}){return!l5(a)||!l5(b)||!l5(c)}function l7(a){return l6(a)||l8(a)||a.z||a.rotate||a.rotateX||a.rotateY||a.skewX||a.skewY}function l8(a){var b,c;return(b=a.x)&&"0%"!==b||(c=a.y)&&"0%"!==c}function l9(a,b,c,d,e){return void 0!==e&&(a=d+e*(a-d)),d+c*(a-d)+b}function ma(a,b=0,c=1,d,e){a.min=l9(a.min,b,c,d,e),a.max=l9(a.max,b,c,d,e)}function mb(a,{x:b,y:c}){ma(a.x,b.translate,b.scale,b.originPoint),ma(a.y,c.translate,c.scale,c.originPoint)}function mc(a,b){a.min=a.min+b,a.max=a.max+b}function md(a,b,c,d,e=.5){let f=l$(a.min,a.max,e);ma(a,b,c,f,d)}function me(a,b){return"string"==typeof a?parseFloat(a)/100*(b.max-b.min):a}function mf(a,b){md(a.x,me(b.x,a.x),b.scaleX,b.scale,b.originX),md(a.y,me(b.y,a.y),b.scaleY,b.scale,b.originY)}function mg(a,b){return l4(function(a,b){if(!b)return a;let c=b({x:a.left,y:a.top}),d=b({x:a.right,y:a.bottom});return{top:c.y,left:c.x,bottom:d.y,right:d.x}}(a.getBoundingClientRect(),b))}class mh extends lL{constructor(){super(...arguments),this.type="html",this.renderInstance=lX}readValueFromInstance(a,b){if(jH.has(b))return this.projection?.isProjecting?kI(b):((a,b)=>{let{transform:c="none"}=getComputedStyle(a);return kJ(c,b)})(a,b);{let c=window.getComputedStyle(a),d=(kv(b)?c.getPropertyValue(b):c[b])||0;return"string"==typeof d?d.trim():d}}measureInstanceViewportBox(a,{transformPagePoint:b}){return mg(a,b)}build(a,b,c){lQ(a,b,c.transformTemplate)}scrapeMotionValuesFromProps(a,b,c){return l1(a,b,c)}}let mi=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function mj(a){if("string"!=typeof a||a.includes("-"));else if(mi.indexOf(a)>-1||/[A-Z]/u.test(a))return!0;return!1}let mk=(0,E.createContext)({}),ml=(0,E.createContext)({transformPagePoint:a=>a,isStatic:!1,reducedMotion:"never"}),mm=(0,E.createContext)({});function mn(a){return Array.isArray(a)?a.join(" "):a}let mo=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function mp(a,b,c){for(let d in b)kn(b[d])||l0(d,c)||(a[d]=b[d])}let mq=()=>({...mo(),attrs:{}}),mr=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function ms(a){return a.startsWith("while")||a.startsWith("drag")&&"draggable"!==a||a.startsWith("layout")||a.startsWith("onTap")||a.startsWith("onPan")||a.startsWith("onLayout")||mr.has(a)}let mt=a=>!ms(a);try{s=require("@emotion/is-prop-valid").default,"function"==typeof s&&(mt=a=>a.startsWith("on")?!ms(a):s(a))}catch{}function mu(a){return kn(a)?a.get():a}let mv=(0,E.createContext)(null);function mw(a){let b=(0,E.useRef)(null);return null===b.current&&(b.current=a()),b.current}let mx=a=>(b,c)=>{let d=(0,E.useContext)(mm),e=(0,E.useContext)(mv),f=()=>(function({scrapeMotionValuesFromProps:a,createRenderState:b},c,d,e){return{latestValues:function(a,b,c,d){let e={},f=d(a,{});for(let a in f)e[a]=mu(f[a]);let{initial:g,animate:h}=a,i=lB(a),j=lC(a);b&&j&&!i&&!1!==a.inherit&&(void 0===g&&(g=b.initial),void 0===h&&(h=b.animate));let k=!!c&&!1===c.initial,l=(k=k||!1===g)?h:g;if(l&&"boolean"!=typeof l&&!lx(l)){let b=Array.isArray(l)?l:[l];for(let c=0;c<b.length;c++){let d=lH(a,b[c]);if(d){let{transitionEnd:a,transition:b,...c}=d;for(let a in c){let b=c[a];if(Array.isArray(b)){let a=k?b.length-1:0;b=b[a]}null!==b&&(e[a]=b)}for(let b in a)e[b]=a[b]}}}return e}(c,d,e,a),renderState:b()}})(a,b,d,e);return c?f():mw(f)},my=mx({scrapeMotionValuesFromProps:l1,createRenderState:mo}),mz=mx({scrapeMotionValuesFromProps:l2,createRenderState:mq}),mA={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},mB=!1,mC=Symbol.for("motionComponentSymbol");function mD(a,{forwardMotionProps:b=!1,type:c}={},d,e){d&&function(a){let b=(!function(){if(mB)return;let a={};for(let b in mA)a[b]={isEnabled:a=>mA[b].some(b=>!!a[b])};lJ=a,mB=!0}(),lJ);for(let c in a)b[c]={...b[c],...a[c]};lJ=b}(d);let f=c?"svg"===c:mj(a),g=f?mz:my;function h(c,d){var e;let h,i,j,k={...(0,E.useContext)(ml),...c,layoutId:function({layoutId:a}){let b=(0,E.useContext)(mk).id;return b&&void 0!==a?b+"-"+a:a}(c)},{isStatic:l}=k,m=function(a){let{initial:b,animate:c}=function(a,b){if(lB(a)){let{initial:b,animate:c}=a;return{initial:!1===b||ly(b)?b:void 0,animate:ly(c)?c:void 0}}return!1!==a.inherit?b:{}}(a,(0,E.useContext)(mm));return(0,E.useMemo)(()=>({initial:b,animate:c}),[mn(b),mn(c)])}(c),n=g(c,l);return(0,D.jsxs)(mm.Provider,{value:m,children:[h&&m.visualElement?(0,D.jsx)(h,{visualElement:m.visualElement,...k}):null,function(a,b,c,{latestValues:d},e,f=!1,g){let h=(g??mj(a)?function(a,b,c,d){let e=(0,E.useMemo)(()=>{let c=mq();return lU(c,b,lW(d),a.transformTemplate,a.style),{...c.attrs,style:{...c.style}}},[b]);if(a.style){let b={};mp(b,a.style,a),e.style={...b,...e.style}}return e}:function(a,b){let c,d,e={},f=(c=a.style||{},mp(d={},c,a),Object.assign(d,function({transformTemplate:a},b){return(0,E.useMemo)(()=>{let c=mo();return lQ(c,b,a),Object.assign({},c.vars,c.style)},[b])}(a,b)),d);return a.drag&&!1!==a.dragListener&&(e.draggable=!1,f.userSelect=f.WebkitUserSelect=f.WebkitTouchCallout="none",f.touchAction=!0===a.drag?"none":`pan-${"x"===a.drag?"y":"x"}`),void 0===a.tabIndex&&(a.onTap||a.onTapStart||a.whileTap)&&(e.tabIndex=0),e.style=f,e})(b,d,e,a),i=function(a,b,c){let d={};for(let e in a)("values"!==e||"object"!=typeof a.values)&&(mt(e)||!0===c&&ms(e)||!b&&!ms(e)||a.draggable&&e.startsWith("onDrag"))&&(d[e]=a[e]);return d}(b,"string"==typeof a,f),j=a!==E.Fragment?{...i,...h,ref:c}:{},{children:k}=b,l=(0,E.useMemo)(()=>kn(k)?k.get():k,[k]);return(0,E.createElement)(a,{...j,children:l})}(a,c,(e=m.visualElement,i=(0,E.useRef)(d),(0,E.useInsertionEffect)(()=>{i.current=d}),j=(0,E.useRef)(null),(0,E.useCallback)(a=>{a&&n.onMount?.(a);let b=i.current;if("function"==typeof b)if(a){let c=b(a);"function"==typeof c&&(j.current=c)}else j.current?(j.current(),j.current=null):b(a);else b&&(b.current=a);e&&(a?e.mount(a):e.unmount())},[e])),n,l,b,f)]})}h.displayName=`motion.${"string"==typeof a?a:`create(${a.displayName??a.name??""})`}`;let i=(0,E.forwardRef)(h);return i[mC]=a,i}class mE{constructor(a){this.isMounted=!1,this.node=a}update(){}}function mF(a,b,c){let d=a.getProps();return lH(d,b,void 0!==c?c:d.custom,a)}function mG(a,b){if(a?.inherit&&b){let{inherit:c,...d}=a;return{...b,...d}}return a}function mH(a,b){let c=a?.[b]??a?.default??a;return c!==a?mG(c,a):c}let mI=a=>Array.isArray(a);function mJ(a,b){let c=a.getValue("willChange");if(kn(c)&&c.add)return c.add(b);if(!c&&kQ.WillChange){let c=new kQ.WillChange("auto");a.addValue("willChange",c),c.add(b)}}let mK="data-"+lM("framerAppearId"),mL=(a,b)=>c=>b(a(c)),mM=(...a)=>a.reduce(mL);function mN(a,b,c){return(c<0&&(c+=1),c>1&&(c-=1),c<1/6)?a+(b-a)*6*c:c<.5?b:c<2/3?a+(b-a)*(2/3-c)*6:a}function mO(a,b){return c=>c>0?b:a}let mP=(a,b,c)=>{let d=a*a,e=c*(b*b-d)+d;return e<0?0:Math.sqrt(e)},mQ=[jT,jS,j_];function mR(a){let b=mQ.find(b=>b.test(a));if(ks(!!b,`'${a}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!b)return!1;let c=b.parse(a);return b===j_&&(c=function({hue:a,saturation:b,lightness:c,alpha:d}){a/=360,c/=100;let e=0,f=0,g=0;if(b/=100){let d=c<.5?c*(1+b):c+b-c*b,h=2*c-d;e=mN(h,d,a+1/3),f=mN(h,d,a),g=mN(h,d,a-1/3)}else e=f=g=c;return{red:Math.round(255*e),green:Math.round(255*f),blue:Math.round(255*g),alpha:d}}(c)),c}let mS=(a,b)=>{let c=mR(a),d=mR(b);if(!c||!d)return mO(a,b);let e={...c};return a=>(e.red=mP(c.red,d.red,a),e.green=mP(c.green,d.green,a),e.blue=mP(c.blue,d.blue,a),e.alpha=l$(c.alpha,d.alpha,a),jS.transform(e))},mT=new Set(["none","hidden"]);function mU(a,b){return c=>l$(a,b,c)}function mV(a){return"number"==typeof a?mU:"string"==typeof a?kx(a)?mO:j0.test(a)?mS:mY:Array.isArray(a)?mW:"object"==typeof a?j0.test(a)?mS:mX:mO}function mW(a,b){let c=[...a],d=c.length,e=a.map((a,c)=>mV(a)(a,b[c]));return a=>{for(let b=0;b<d;b++)c[b]=e[b](a);return c}}function mX(a,b){let c={...a,...b},d={};for(let e in c)void 0!==a[e]&&void 0!==b[e]&&(d[e]=mV(a[e])(a[e],b[e]));return a=>{for(let b in d)c[b]=d[b](a);return c}}let mY=(a,b)=>{let c=j9.createTransformer(b),d=j5(a),e=j5(b);if(!(d.indexes.var.length===e.indexes.var.length&&d.indexes.color.length===e.indexes.color.length&&d.indexes.number.length>=e.indexes.number.length))return ks(!0,`Complex values '${a}' and '${b}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),mO(a,b);if(mT.has(a)&&!e.values.length||mT.has(b)&&!d.values.length)return mT.has(a)?c=>c<=0?a:b:c=>c>=1?b:a;return mM(mW(function(a,b){let c=[],d={color:0,var:0,number:0};for(let e=0;e<b.values.length;e++){let f=b.types[e],g=a.indexes[f][d[f]],h=a.values[g]??0;c[e]=h,d[f]++}return c}(d,e),e.values),c)};function mZ(a,b,c){return"number"==typeof a&&"number"==typeof b&&"number"==typeof c?l$(a,b,c):mV(a)(a,b)}let m$=a=>{let b=({timestamp:b})=>a(b);return{start:(a=!0)=>kT.update(b,a),stop:()=>kU(b),now:()=>kV.isProcessing?kV.timestamp:ls.now()}};function m_(a){let b=0,c=a.next(b);for(;!c.done&&b<2e4;)b+=50,c=a.next(b);return b>=2e4?1/0:b}function m0(a,b,c){var d,e;let f=Math.max(b-5,0);return d=c-a(f),(e=b-f)?1e3/e*d:0}let m1=.01,m2=2,m3=.005,m4=.5;function m5(a,b){return a*Math.sqrt(1-b*b)}let m6=["duration","bounce"],m7=["stiffness","damping","mass"];function m8(a,b){return b.some(b=>void 0!==a[b])}function m9(a=.3,b=.3){let c,d="object"!=typeof a?{visualDuration:a,keyframes:[0,1],bounce:b}:a,{restSpeed:e,restDelta:f}=d,g=d.keyframes[0],h=d.keyframes[d.keyframes.length-1],i={done:!1,value:g},{stiffness:j,damping:k,mass:l,duration:m,velocity:n,isResolvedFromDuration:o}=function(a){let b={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...a};if(!m8(a,m7)&&m8(a,m6))if(b.velocity=0,a.visualDuration){let c=2*Math.PI/(1.2*a.visualDuration),d=c*c,e=2*jI(.05,1,1-(a.bounce||0))*Math.sqrt(d);b={...b,mass:1,stiffness:d,damping:e}}else{let c=function({duration:a=800,bounce:b=.3,velocity:c=0,mass:d=1}){let e,f;ks(a<=k6(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let g=1-b;g=jI(.05,1,g),a=jI(.01,10,a/1e3),g<1?(e=b=>{let d=b*g,e=d*a;return .001-(d-c)/m5(b,g)*Math.exp(-e)},f=b=>{let d=b*g*a,f=Math.pow(g,2)*Math.pow(b,2)*a,h=Math.exp(-d),i=m5(Math.pow(b,2),g);return(d*c+c-f)*h*(-e(b)+.001>0?-1:1)/i}):(e=b=>-.001+Math.exp(-b*a)*((b-c)*a+1),f=b=>a*a*(c-b)*Math.exp(-b*a));let h=function(a,b,c){let d=c;for(let c=1;c<12;c++)d-=a(d)/b(d);return d}(e,f,5/a);if(a=k6(a),isNaN(h))return{stiffness:100,damping:10,duration:a};{let b=Math.pow(h,2)*d;return{stiffness:b,damping:2*g*Math.sqrt(d*b),duration:a}}}({...a,velocity:0});(b={...b,...c,mass:1}).isResolvedFromDuration=!0}return b}({...d,velocity:-((d.velocity||0)/1e3)}),p=n||0,q=k/(2*Math.sqrt(j*l)),r=h-g,s=Math.sqrt(j/l)/1e3,t=5>Math.abs(r);if(e||(e=t?m1:m2),f||(f=t?m3:m4),q<1){let a=m5(s,q);c=b=>h-Math.exp(-q*s*b)*((p+q*s*r)/a*Math.sin(a*b)+r*Math.cos(a*b))}else if(1===q)c=a=>h-Math.exp(-s*a)*(r+(p+s*r)*a);else{let a=s*Math.sqrt(q*q-1);c=b=>{let c=Math.exp(-q*s*b),d=Math.min(a*b,300);return h-c*((p+q*s*r)*Math.sinh(d)+a*r*Math.cosh(d))/a}}let u={calculatedDuration:o&&m||null,next:a=>{let b=c(a);if(o)i.done=a>=m;else{let d=0===a?p:0;q<1&&(d=0===a?k6(p):m0(c,a,b));let g=Math.abs(h-b)<=f;i.done=Math.abs(d)<=e&&g}return i.value=i.done?h:b,i},toString:()=>{let a=Math.min(m_(u),2e4),b=lk(b=>u.next(a*b).value,a,30);return a+"ms "+b},toTransition:()=>{}};return u}function na({keyframes:a,velocity:b=0,power:c=.8,timeConstant:d=325,bounceDamping:e=10,bounceStiffness:f=500,modifyTarget:g,min:h,max:i,restDelta:j=.5,restSpeed:k}){let l,m,n=a[0],o={done:!1,value:n},p=c*b,q=n+p,r=void 0===g?q:g(q);r!==q&&(p=r-n);let s=a=>-p*Math.exp(-a/d),t=a=>r+s(a),u=a=>{let b=s(a),c=t(a);o.done=Math.abs(b)<=j,o.value=o.done?r:c},v=a=>{let b;if(b=o.value,void 0!==h&&b<h||void 0!==i&&b>i){var c;l=a,m=m9({keyframes:[o.value,(c=o.value,void 0===h?i:void 0===i||Math.abs(h-c)<Math.abs(i-c)?h:i)],velocity:m0(t,a,o.value),damping:e,stiffness:f,restDelta:j,restSpeed:k})}};return v(0),{calculatedDuration:null,next:a=>{let b=!1;return(m||void 0!==l||(b=!0,u(a),v(a)),void 0!==l&&a>=l)?m.next(a-l):(b||u(a),o)}}}m9.applyToOptions=a=>{let b=function(a,b=100,c){let d=c({...a,keyframes:[0,b]}),e=Math.min(m_(d),2e4);return{type:"keyframes",ease:a=>d.next(e*a).value/b,duration:e/1e3}}(a,100,m9);return a.ease=b.ease,a.duration=k6(b.duration),a.type="keyframes",a};let nb=(a,b,c)=>(((1-3*c+3*b)*a+(3*c-6*b))*a+3*b)*a;function nc(a,b,c,d){return a===b&&c===d?kP:e=>0===e||1===e?e:nb(function(a,b,c,d,e){let f,g,h=0;do(f=nb(g=b+(c-b)/2,d,e)-a)>0?c=g:b=g;while(Math.abs(f)>1e-7&&++h<12);return g}(e,0,1,a,c),b,d)}let nd=nc(.42,0,1,1),ne=nc(0,0,.58,1),nf=nc(.42,0,.58,1),ng=a=>b=>b<=.5?a(2*b)/2:(2-a(2*(1-b)))/2,nh=a=>b=>1-a(1-b),ni=nc(.33,1.53,.69,.99),nj=nh(ni),nk=ng(nj),nl=a=>(a*=2)<1?.5*nj(a):.5*(2-Math.pow(2,-10*(a-1))),nm=a=>1-Math.sin(Math.acos(a)),nn=nh(nm),no=ng(nm),np={linear:kP,easeIn:nd,easeInOut:nf,easeOut:ne,circIn:nm,circInOut:no,circOut:nn,backIn:nj,backInOut:nk,backOut:ni,anticipate:nl},nq=a=>{if(li(a)){kt(4===a.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[b,c,d,e]=a;return nc(b,c,d,e)}return"string"==typeof a?(kt(void 0!==np[a],`Invalid easing type '${a}'`,"invalid-easing-type"),np[a]):a},nr=(a,b,c)=>{let d=b-a;return 0===d?1:(c-a)/d};function ns({duration:a=300,keyframes:b,times:c,ease:d="easeInOut"}){var e;let f,g=Array.isArray(d)&&"number"!=typeof d[0]?d.map(nq):nq(d),h={done:!1,value:b[0]},i=function(a,b,{clamp:c=!0,ease:d,mixer:e}={}){let f=a.length;if(kt(f===b.length,"Both input and output ranges must be the same length","range-length"),1===f)return()=>b[0];if(2===f&&b[0]===b[1])return()=>b[1];let g=a[0]===a[1];a[0]>a[f-1]&&(a=[...a].reverse(),b=[...b].reverse());let h=function(a,b,c){let d=[],e=c||kQ.mix||mZ,f=a.length-1;for(let c=0;c<f;c++){let f=e(a[c],a[c+1]);b&&(f=mM(Array.isArray(b)?b[c]||kP:b,f)),d.push(f)}return d}(b,d,e),i=h.length,j=c=>{if(g&&c<a[0])return b[0];let d=0;if(i>1)for(;d<a.length-2&&!(c<a[d+1]);d++);let e=nr(a[d],a[d+1],c);return h[d](e)};return c?b=>j(jI(a[0],a[f-1],b)):j}((e=c&&c.length===b.length?c:(!function(a,b){let c=a[a.length-1];for(let d=1;d<=b;d++){let e=nr(0,b,d);a.push(l$(c,1,e))}}(f=[0],b.length-1),f),e.map(b=>b*a)),b,{ease:Array.isArray(g)?g:b.map(()=>g||nf).splice(0,b.length-1)});return{calculatedDuration:a,next:b=>(h.value=i(b),h.done=b>=a,h)}}let nt={decay:na,inertia:na,tween:ns,keyframes:ns,spring:m9};function nu(a){"string"==typeof a.type&&(a.type=nt[a.type])}let nv=a=>a/100;class nw extends lg{constructor(a){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:a}=this.options;a&&a.updatedAt!==ls.now()&&this.tick(ls.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},lh.mainThread++,this.options=a,this.initAnimation(),this.play(),!1===a.autoplay&&this.pause()}initAnimation(){let{options:a}=this;nu(a);let{type:b=ns,repeat:c=0,repeatDelay:d=0,repeatType:e,velocity:f=0}=a,{keyframes:g}=a,h=b||ns;h!==ns&&"number"!=typeof g[0]&&(this.mixKeyframes=mM(nv,mZ(g[0],g[1])),g=[0,100]);let i=h({...a,keyframes:g});"mirror"===e&&(this.mirroredGenerator=h({...a,keyframes:[...g].reverse(),velocity:-f})),null===i.calculatedDuration&&(i.calculatedDuration=m_(i));let{calculatedDuration:j}=i;this.calculatedDuration=j,this.resolvedDuration=j+d,this.totalDuration=this.resolvedDuration*(c+1)-d,this.generator=i}updateTime(a){let b=Math.round(a-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=b}tick(a,b=!1){let{generator:c,totalDuration:d,mixKeyframes:e,mirroredGenerator:f,resolvedDuration:g,calculatedDuration:h}=this;if(null===this.startTime)return c.next(0);let{delay:i=0,keyframes:j,repeat:k,repeatType:l,repeatDelay:m,type:n,onUpdate:o,finalKeyframe:p}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,a):this.speed<0&&(this.startTime=Math.min(a-d/this.speed,this.startTime)),b?this.currentTime=a:this.updateTime(a);let q=this.currentTime-i*(this.playbackSpeed>=0?1:-1),r=this.playbackSpeed>=0?q<0:q>d;this.currentTime=Math.max(q,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=d);let s=this.currentTime,t=c;if(k){let a=Math.min(this.currentTime,d)/g,b=Math.floor(a),c=a%1;!c&&a>=1&&(c=1),1===c&&b--,(b=Math.min(b,k+1))%2&&("reverse"===l?(c=1-c,m&&(c-=m/g)):"mirror"===l&&(t=f)),s=jI(0,1,c)*g}let u=r?{done:!1,value:j[0]}:t.next(s);e&&(u.value=e(u.value));let{done:v}=u;r||null===h||(v=this.playbackSpeed>=0?this.currentTime>=d:this.currentTime<=0);let w=null===this.holdTime&&("finished"===this.state||"running"===this.state&&v);return w&&n!==na&&(u.value=lf(j,this.options,p,this.speed)),o&&o(u.value),w&&this.finish(),u}then(a,b){return this.finished.then(a,b)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:a=0}=this.options||{};return this.duration+a/1e3}get time(){return this.currentTime/1e3}set time(a){a=k6(a),this.currentTime=a,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=a:this.driver&&(this.startTime=this.driver.now()-a/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(a){this.updateTime(ls.now());let b=this.playbackSpeed!==a;this.playbackSpeed=a,b&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:a=m$,startTime:b}=this.options;this.driver||(this.driver=a(a=>this.tick(a))),this.options.onPlay?.();let c=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=c):null!==this.holdTime?this.startTime=c-this.holdTime:this.startTime||(this.startTime=b??c),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(ls.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,lh.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(a){return this.startTime=0,this.tick(a,!0)}attachTimeline(a){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),a.observe(this)}}let nx={anticipate:nl,backInOut:nk,circInOut:no};class ny extends lo{constructor(a){!function(a){"string"==typeof a.ease&&a.ease in nx&&(a.ease=nx[a.ease])}(a),nu(a),super(a),void 0!==a.startTime&&(this.startTime=a.startTime),this.options=a}updateMotionValue(a){let{motionValue:b,onUpdate:c,onComplete:d,element:e,...f}=this.options;if(!b)return;if(void 0!==a)return void b.set(a);let g=new nw({...f,autoplay:!1}),h=Math.max(10,ls.now()-this.startTime),i=jI(0,10,h-10);b.setWithVelocity(g.sample(Math.max(0,h-i)).value,g.sample(h).value,i),g.stop()}}let nz=(a,b)=>"zIndex"!==b&&!!("number"==typeof a||Array.isArray(a)||"string"==typeof a&&(j9.test(a)||"0"===a)&&!a.startsWith("url("));function nA(a){a.duration=0,a.type="keyframes"}let nB=new Set(["opacity","clipPath","filter","transform"]),nC=la(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class nD extends lg{constructor({autoplay:a=!0,delay:b=0,type:c="keyframes",repeat:d=0,repeatDelay:e=0,repeatType:f="loop",keyframes:g,name:h,motionValue:i,element:j,...k}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=ls.now();const l={autoplay:a,delay:b,type:c,repeat:d,repeatDelay:e,repeatType:f,name:h,motionValue:i,element:j,...k},m=j?.KeyframeResolver||k1;this.keyframeResolver=new m(g,(a,b,c)=>this.onKeyframesResolved(a,b,l,!c),h,i,j),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(a,b,c,d){this.keyframeResolver=void 0;let{name:e,type:f,velocity:g,delay:h,isHandoff:i,onUpdate:j}=c;this.resolvedAt=ls.now(),!function(a,b,c,d){let e=a[0];if(null===e)return!1;if("display"===b||"visibility"===b)return!0;let f=a[a.length-1],g=nz(e,b),h=nz(f,b);return ks(g===h,`You are trying to animate ${b} from "${e}" to "${f}". "${g?f:e}" is not an animatable value.`,"value-not-animatable"),!!g&&!!h&&(function(a){let b=a[0];if(1===a.length)return!0;for(let c=0;c<a.length;c++)if(a[c]!==b)return!0}(a)||("spring"===c||ln(c))&&d)}(a,e,f,g)&&((kQ.instantAnimations||!h)&&j?.(lf(a,c,b)),a[0]=a[a.length-1],nA(c),c.repeat=0);let k={startTime:d?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:b,...c,keyframes:a},l=!i&&function(a){let{motionValue:b,name:c,repeatDelay:d,repeatType:e,damping:f,type:g}=a;if(!(b?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:h,transformTemplate:i}=b.owner.getProps();return nC()&&c&&nB.has(c)&&("transform"!==c||!i)&&!h&&!d&&"mirror"!==e&&0!==f&&"inertia"!==g}(k),m=k.motionValue?.owner?.current,n=l?new ny({...k,element:m}):new nw(k);n.finished.then(()=>{this.notifyFinished()}).catch(kP),this.pendingTimeline&&(this.stopTimeline=n.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=n}get finished(){return this._animation?this.animation.finished:this._finished}then(a,b){return this.finished.finally(a).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),k$=!0,k0(),k_(),k$=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(a){this.animation.time=a}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(a){this.animation.speed=a}get startTime(){return this.animation.startTime}attachTimeline(a){return this._animation?this.stopTimeline=this.animation.attachTimeline(a):this.pendingTimeline=a,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let nE={type:"spring",stiffness:500,damping:25,restSpeed:10},nF={type:"keyframes",duration:.8},nG={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},nH=a=>null!==a,nI=(a,b,c,d={},e,f)=>g=>{let h=mH(d,a)||{},i=h.delay||d.delay||0,{elapsed:j=0}=d;j-=k6(i);let k={keyframes:Array.isArray(c)?c:[null,c],ease:"easeOut",velocity:b.getVelocity(),...h,delay:-j,onUpdate:a=>{b.set(a),h.onUpdate&&h.onUpdate(a)},onComplete:()=>{g(),h.onComplete&&h.onComplete()},name:a,motionValue:b,element:f?void 0:e};!function({when:a,delay:b,delayChildren:c,staggerChildren:d,staggerDirection:e,repeat:f,repeatType:g,repeatDelay:h,from:i,elapsed:j,...k}){return!!Object.keys(k).length}(h)&&Object.assign(k,((a,{keyframes:b})=>b.length>2?nF:jH.has(a)?a.startsWith("scale")?{type:"spring",stiffness:550,damping:0===b[1]?2*Math.sqrt(550):30,restSpeed:10}:nE:nG)(a,k)),k.duration&&(k.duration=k6(k.duration)),k.repeatDelay&&(k.repeatDelay=k6(k.repeatDelay)),void 0!==k.from&&(k.keyframes[0]=k.from);let l=!1;if(!1!==k.type&&(0!==k.duration||k.repeatDelay)||(nA(k),0===k.delay&&(l=!0)),(kQ.instantAnimations||kQ.skipAnimations||e?.shouldSkipAnimations)&&(l=!0,nA(k),k.delay=0),k.allowFlatten=!h.type&&!h.ease,l&&!f&&void 0!==b.get()){let a=function(a,{repeat:b,repeatType:c="loop"},d){let e=a.filter(nH),f=b&&"loop"!==c&&b%2==1?0:e.length-1;return e[f]}(k.keyframes,h);if(void 0!==a)return void kT.update(()=>{k.onUpdate(a),k.onComplete()})}return h.isSync?new nw(k):new nD(k)};function nJ(a,b,{delay:c=0,transitionOverride:d,type:e}={}){let{transition:f,transitionEnd:g,...h}=b,i=a.getDefaultTransition();f=f?mG(f,i):i;let j=f?.reduceMotion;d&&(f=d);let k=[],l=e&&a.animationState&&a.animationState.getState()[e];for(let b in h){let d=a.getValue(b,a.latestValues[b]??null),e=h[b];if(void 0===e||l&&function({protectedKeys:a,needsAnimating:b},c){let d=a.hasOwnProperty(c)&&!0!==b[c];return b[c]=!1,d}(l,b))continue;let g={delay:c,...mH(f||{},b)},i=d.get();if(void 0!==i&&!d.isAnimating&&!Array.isArray(e)&&e===i&&!g.velocity)continue;let m=!1;if(window.MotionHandoffAnimation){let c=a.props[mK];if(c){let a=window.MotionHandoffAnimation(c,b,kT);null!==a&&(g.startTime=a,m=!0)}}mJ(a,b);let n=j??a.shouldReduceMotion;d.start(nI(b,d,e,n&&ko.has(b)?{type:!1}:g,a,m));let o=d.animation;o&&k.push(o)}if(g){let b=()=>kT.update(()=>{g&&function(a,b){let{transitionEnd:c={},transition:d={},...e}=mF(a,b)||{};for(let b in e={...e,...c}){var f;let c=mI(f=e[b])?f[f.length-1]||0:f;a.hasValue(b)?a.getValue(b).set(c):a.addValue(b,lu(c))}}(a,g)});k.length?Promise.all(k).then(b):b()}return k}function nK(a,b,c,d=0,e=1){let f=Array.from(a).sort((a,b)=>a.sortNodePosition(b)).indexOf(b),g=a.size,h=(g-1)*d;return"function"==typeof c?c(f,g):1===e?f*d:h-f*d}function nL(a,b,c={}){let d=mF(a,b,"exit"===c.type?a.presenceContext?.custom:void 0),{transition:e=a.getDefaultTransition()||{}}=d||{};c.transitionOverride&&(e=c.transitionOverride);let f=d?()=>Promise.all(nJ(a,d,c)):()=>Promise.resolve(),g=a.variantChildren&&a.variantChildren.size?(d=0)=>{let{delayChildren:f=0,staggerChildren:g,staggerDirection:h}=e;return function(a,b,c=0,d=0,e=0,f=1,g){let h=[];for(let i of a.variantChildren)i.notify("AnimationStart",b),h.push(nL(i,b,{...g,delay:c+("function"==typeof d?0:d)+nK(a.variantChildren,i,d,e,f)}).then(()=>i.notify("AnimationComplete",b)));return Promise.all(h)}(a,b,d,f,g,h,c)}:()=>Promise.resolve(),{when:h}=e;if(!h)return Promise.all([f(),g(c.delay)]);{let[a,b]="beforeChildren"===h?[f,g]:[g,f];return a().then(()=>b())}}let nM=lA.length;function nN(a,b){if(!Array.isArray(b))return!1;let c=b.length;if(c!==a.length)return!1;for(let d=0;d<c;d++)if(b[d]!==a[d])return!1;return!0}let nO=[...lz].reverse(),nP=lz.length;function nQ(a=!1){return{isActive:a,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function nR(){return{animate:nQ(!0),whileInView:nQ(),whileHover:nQ(),whileTap:nQ(),whileDrag:nQ(),whileFocus:nQ(),exit:nQ()}}class nS extends mE{constructor(a){super(a),a.animationState||(a.animationState=function(a){let b=b=>Promise.all(b.map(({animation:b,options:c})=>(function(a,b,c={}){let d;if(a.notify("AnimationStart",b),Array.isArray(b))d=Promise.all(b.map(b=>nL(a,b,c)));else if("string"==typeof b)d=nL(a,b,c);else{let e="function"==typeof b?mF(a,b,c.custom):b;d=Promise.all(nJ(a,e,c))}return d.then(()=>{a.notify("AnimationComplete",b)})})(a,b,c))),c=nR(),d=!0,e=!1,f=b=>(c,d)=>{let e=mF(a,d,"exit"===b?a.presenceContext?.custom:void 0);if(e){let{transition:a,transitionEnd:b,...d}=e;c={...c,...d,...b}}return c};function g(g){let{props:h}=a,i=function a(b){if(!b)return;if(!b.isControllingVariants){let c=b.parent&&a(b.parent)||{};return void 0!==b.props.initial&&(c.initial=b.props.initial),c}let c={};for(let a=0;a<nM;a++){let d=lA[a],e=b.props[d];(ly(e)||!1===e)&&(c[d]=e)}return c}(a.parent)||{},j=[],k=new Set,l={},m=1/0;for(let b=0;b<nP;b++){var n,o;let p=nO[b],q=c[p],r=void 0!==h[p]?h[p]:i[p],s=ly(r),t=p===g?q.isActive:null;!1===t&&(m=b);let u=r===i[p]&&r!==h[p]&&s;if(u&&(d||e)&&a.manuallyAnimateOnMount&&(u=!1),q.protectedKeys={...l},!q.isActive&&null===t||!r&&!q.prevProp||lx(r)||"boolean"==typeof r)continue;if("exit"===p&&q.isActive&&!0!==t){q.prevResolvedValues&&(l={...l,...q.prevResolvedValues});continue}let v=(n=q.prevProp,"string"==typeof(o=r)?o!==n:!!Array.isArray(o)&&!nN(o,n)),w=v||p===g&&q.isActive&&!u&&s||b>m&&s,x=!1,y=Array.isArray(r)?r:[r],z=y.reduce(f(p),{});!1===t&&(z={});let{prevResolvedValues:A={}}=q,B={...A,...z},C=b=>{w=!0,k.has(b)&&(x=!0,k.delete(b)),q.needsAnimating[b]=!0;let c=a.getValue(b);c&&(c.liveStyle=!1)};for(let a in B){let b=z[a],c=A[a];if(!l.hasOwnProperty(a))(mI(b)&&mI(c)?nN(b,c):b===c)?void 0!==b&&k.has(a)?C(a):q.protectedKeys[a]=!0:null!=b?C(a):k.add(a)}q.prevProp=r,q.prevResolvedValues=z,q.isActive&&(l={...l,...z}),(d||e)&&a.blockInitialAnimation&&(w=!1);let D=u&&v,E=!D||x;w&&E&&j.push(...y.map(b=>{let c={type:p};if("string"==typeof b&&(d||e)&&!D&&a.manuallyAnimateOnMount&&a.parent){let{parent:d}=a,e=mF(d,b);if(d.enteringChildren&&e){let{delayChildren:b}=e.transition||{};c.delay=nK(d.enteringChildren,a,b)}}return{animation:b,options:c}}))}if(k.size){let b={};if("boolean"!=typeof h.initial){let c=mF(a,Array.isArray(h.initial)?h.initial[0]:h.initial);c&&c.transition&&(b.transition=c.transition)}k.forEach(c=>{let d=a.getBaseTarget(c),e=a.getValue(c);e&&(e.liveStyle=!0),b[c]=d??null}),j.push({animation:b})}let p=!!j.length;return d&&(!1===h.initial||h.initial===h.animate)&&!a.manuallyAnimateOnMount&&(p=!1),d=!1,e=!1,p?b(j):Promise.resolve()}return{animateChanges:g,setActive:function(b,d){if(c[b].isActive===d)return Promise.resolve();a.variantChildren?.forEach(a=>a.animationState?.setActive(b,d)),c[b].isActive=d;let e=g(b);for(let a in c)c[a].protectedKeys={};return e},setAnimateFunction:function(c){b=c(a)},getState:()=>c,reset:()=>{c=nR(),e=!0}}}(a))}updateAnimationControlsSubscription(){let{animate:a}=this.node.getProps();lx(a)&&(this.unmountControls=a.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:a}=this.node.getProps(),{animate:b}=this.node.prevProps||{};a!==b&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let nT=0;class nU extends mE{constructor(){super(...arguments),this.id=nT++}update(){if(!this.node.presenceContext)return;let{isPresent:a,onExitComplete:b}=this.node.presenceContext,{isPresent:c}=this.node.prevPresenceContext||{};if(!this.node.animationState||a===c)return;let d=this.node.animationState.setActive("exit",!a);b&&!a&&d.then(()=>{b(this.id)})}mount(){let{register:a,onExitComplete:b}=this.node.presenceContext||{};b&&b(this.id),a&&(this.unmount=a(this.id))}unmount(){}}let nV={x:!1,y:!1};function nW(a){return[a("x"),a("y")]}function nX(a){return a.max-a.min}function nY(a,b,c,d=.5){a.origin=d,a.originPoint=l$(b.min,b.max,a.origin),a.scale=nX(c)/nX(b),a.translate=l$(c.min,c.max,a.origin)-a.originPoint,(a.scale>=.9999&&a.scale<=1.0001||isNaN(a.scale))&&(a.scale=1),(a.translate>=-.01&&a.translate<=.01||isNaN(a.translate))&&(a.translate=0)}function nZ(a,b,c,d){nY(a.x,b.x,c.x,d?d.originX:void 0),nY(a.y,b.y,c.y,d?d.originY:void 0)}function n$(a,b,c){a.min=c.min+b.min,a.max=a.min+nX(b)}function n_(a,b,c){a.min=b.min-c.min,a.max=a.min+nX(b)}function n0(a,b,c){n_(a.x,b.x,c.x),n_(a.y,b.y,c.y)}let n1=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]),n2=new Set(["INPUT","SELECT","TEXTAREA"]);function n3(a,b,c,d={passive:!0}){return a.addEventListener(b,c,d),()=>a.removeEventListener(b,c)}function n4(a){return"object"==typeof a&&null!==a}function n5(a){return n4(a)&&"ownerSVGElement"in a}function n6(a,b,c){if(null==a)return[];if(a instanceof EventTarget)return[a];if("string"==typeof a){let d=document;b&&(d=b.current);let e=c?.[a]??d.querySelectorAll(a);return e?Array.from(e):[]}return Array.from(a).filter(a=>null!=a)}let n7=new WeakMap,n8=(a,b,c)=>(d,e)=>e&&e[0]?e[0][a+"Size"]:n5(d)&&"getBBox"in d?d.getBBox()[b]:d[c],n9=n8("inline","width","offsetWidth"),oa=n8("block","height","offsetHeight");function ob({target:a,borderBoxSize:b}){n7.get(a)?.forEach(c=>{c(a,{get width(){return n9(a,b)},get height(){return oa(a,b)}})})}function oc(a){a.forEach(ob)}let od=new Set;function oe(a,b){let c;return"function"==typeof a?(od.add(a),f||(f=()=>{let a={get width(){return window.innerWidth},get height(){return window.innerHeight}};od.forEach(b=>b(a))},window.addEventListener("resize",f)),()=>{od.delete(a),od.size||"function"!=typeof f||(window.removeEventListener("resize",f),f=void 0)}):(!e&&"u">typeof ResizeObserver&&(e=new ResizeObserver(oc)),(c=n6(a)).forEach(a=>{let c=n7.get(a);c||(c=new Set,n7.set(a,c)),c.add(b),e?.observe(a)}),()=>{c.forEach(a=>{let c=n7.get(a);c?.delete(b),c?.size||e?.unobserve(a)})})}let of=a=>"mouse"===a.pointerType?"number"!=typeof a.button||a.button<=0:!1!==a.isPrimary;function og(a){return{point:{x:a.pageX,y:a.pageY}}}function oh(a,b,c,d){return n3(a,b,a=>of(a)&&c(a,og(a)),d)}let oi=({current:a})=>a?a.ownerDocument.defaultView:null;function oj(a){return a&&"object"==typeof a&&Object.prototype.hasOwnProperty.call(a,"current")}let ok=(a,b)=>Math.abs(a-b),ol=new Set(["auto","scroll"]);class om{constructor(a,b,{transformPagePoint:c,contextWindow:d=window,dragSnapToOrigin:e=!1,distanceThreshold:f=3,element:g}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=a=>{this.handleScroll(a.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var a,b;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let c=op(this.lastMoveEventInfo,this.history),d=null!==this.startEvent,e=(a=c.offset,b={x:0,y:0},Math.sqrt(ok(a.x,b.x)**2+ok(a.y,b.y)**2)>=this.distanceThreshold);if(!d&&!e)return;let{point:f}=c,{timestamp:g}=kV;this.history.push({...f,timestamp:g});let{onStart:h,onMove:i}=this.handlers;d||(h&&h(this.lastMoveEvent,c),this.startEvent=this.lastMoveEvent),i&&i(this.lastMoveEvent,c)},this.handlePointerMove=(a,b)=>{this.lastMoveEvent=a,this.lastMoveEventInfo=on(b,this.transformPagePoint),kT.update(this.updatePoint,!0)},this.handlePointerUp=(a,b)=>{this.end();let{onEnd:c,onSessionEnd:d,resumeAnimation:e}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&e&&e(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let f=op("pointercancel"===a.type?this.lastMoveEventInfo:on(b,this.transformPagePoint),this.history);this.startEvent&&c&&c(a,f),d&&d(a,f)},!of(a))return;this.dragSnapToOrigin=e,this.handlers=b,this.transformPagePoint=c,this.distanceThreshold=f,this.contextWindow=d||window;const h=on(og(a),this.transformPagePoint),{point:i}=h,{timestamp:j}=kV;this.history=[{...i,timestamp:j}];const{onSessionStart:k}=b;k&&k(a,op(h,this.history)),this.removeListeners=mM(oh(this.contextWindow,"pointermove",this.handlePointerMove),oh(this.contextWindow,"pointerup",this.handlePointerUp),oh(this.contextWindow,"pointercancel",this.handlePointerUp)),g&&this.startScrollTracking(g)}startScrollTracking(a){let b=a.parentElement;for(;b;){let a=getComputedStyle(b);(ol.has(a.overflowX)||ol.has(a.overflowY))&&this.scrollPositions.set(b,{x:b.scrollLeft,y:b.scrollTop}),b=b.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(a){let b=this.scrollPositions.get(a);if(!b)return;let c=a===window,d=c?{x:window.scrollX,y:window.scrollY}:{x:a.scrollLeft,y:a.scrollTop},e={x:d.x-b.x,y:d.y-b.y};(0!==e.x||0!==e.y)&&(c?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=e.x,this.lastMoveEventInfo.point.y+=e.y):this.history.length>0&&(this.history[0].x-=e.x,this.history[0].y-=e.y),this.scrollPositions.set(a,d),kT.update(this.updatePoint,!0))}updateHandlers(a){this.handlers=a}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),kU(this.updatePoint)}}function on(a,b){return b?{point:b(a.point)}:a}function oo(a,b){return{x:a.x-b.x,y:a.y-b.y}}function op({point:a},b){return{point:a,delta:oo(a,oq(b)),offset:oo(a,b[0]),velocity:function(a,b){if(a.length<2)return{x:0,y:0};let c=a.length-1,d=null,e=oq(a);for(;c>=0&&(d=a[c],!(e.timestamp-d.timestamp>k6(.1)));)c--;if(!d)return{x:0,y:0};d===a[0]&&a.length>2&&e.timestamp-d.timestamp>2*k6(.1)&&(d=a[1]);let f=(e.timestamp-d.timestamp)/1e3;if(0===f)return{x:0,y:0};let g={x:(e.x-d.x)/f,y:(e.y-d.y)/f};return g.x===1/0&&(g.x=0),g.y===1/0&&(g.y=0),g}(b,.1)}}function oq(a){return a[a.length-1]}function or(a,b,c){return{min:void 0!==b?a.min+b:void 0,max:void 0!==c?a.max+c-(a.max-a.min):void 0}}function os(a,b){let c=b.min-a.min,d=b.max-a.max;return b.max-b.min<a.max-a.min&&([c,d]=[d,c]),{min:c,max:d}}function ot(a,b,c){return{min:ou(a,b),max:ou(a,c)}}function ou(a,b){return"number"==typeof a?a:a[b]||0}let ov=new WeakMap;class ow{constructor(a){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=km(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=a}start(a,{snapToCursor:b=!1,distanceThreshold:c}={}){let{presenceContext:d}=this.visualElement;if(d&&!1===d.isPresent)return;let e=a=>{b&&this.snapToCursor(og(a).point),this.stopAnimation()},f=(a,b)=>{let{drag:c,dragPropagation:d,onDragStart:e}=this.getProps();if(c&&!d&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(a){if("x"===a||"y"===a)if(nV[a])return null;else return nV[a]=!0,()=>{nV[a]=!1};return nV.x||nV.y?null:(nV.x=nV.y=!0,()=>{nV.x=nV.y=!1})}(c),!this.openDragLock))return;this.latestPointerEvent=a,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),nW(a=>{let b=this.getAxisMotionValue(a).get()||0;if(jW.test(b)){let{projection:c}=this.visualElement;if(c&&c.layout){let d=c.layout.layoutBox[a];d&&(b=nX(d)*(parseFloat(b)/100))}}this.originPoint[a]=b}),e&&kT.update(()=>e(a,b),!1,!0),mJ(this.visualElement,"transform");let{animationState:f}=this.visualElement;f&&f.setActive("whileDrag",!0)},g=(a,b)=>{this.latestPointerEvent=a,this.latestPanInfo=b;let{dragPropagation:c,dragDirectionLock:d,onDirectionLock:e,onDrag:f}=this.getProps();if(!c&&!this.openDragLock)return;let{offset:g}=b;if(d&&null===this.currentDirection){this.currentDirection=function(a,b=10){let c=null;return Math.abs(a.y)>b?c="y":Math.abs(a.x)>b&&(c="x"),c}(g),null!==this.currentDirection&&e&&e(this.currentDirection);return}this.updateAxis("x",b.point,g),this.updateAxis("y",b.point,g),this.visualElement.render(),f&&kT.update(()=>f(a,b),!1,!0)},h=(a,b)=>{this.latestPointerEvent=a,this.latestPanInfo=b,this.stop(a,b),this.latestPointerEvent=null,this.latestPanInfo=null},i=()=>{let{dragSnapToOrigin:a}=this.getProps();(a||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:j}=this.getProps();this.panSession=new om(a,{onSessionStart:e,onStart:f,onMove:g,onSessionEnd:h,resumeAnimation:i},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:j,distanceThreshold:c,contextWindow:oi(this.visualElement),element:this.visualElement.current})}stop(a,b){let c=a||this.latestPointerEvent,d=b||this.latestPanInfo,e=this.isDragging;if(this.cancel(),!e||!d||!c)return;let{velocity:f}=d;this.startAnimation(f);let{onDragEnd:g}=this.getProps();g&&kT.postRender(()=>g(c,d))}cancel(){this.isDragging=!1;let{projection:a,animationState:b}=this.visualElement;a&&(a.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:c}=this.getProps();!c&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),b&&b.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(a,b,c){let{drag:d}=this.getProps();if(!c||!oy(a,d,this.currentDirection))return;let e=this.getAxisMotionValue(a),f=this.originPoint[a]+c[a];this.constraints&&this.constraints[a]&&(f=function(a,{min:b,max:c},d){return void 0!==b&&a<b?a=d?l$(b,a,d.min):Math.max(a,b):void 0!==c&&a>c&&(a=d?l$(c,a,d.max):Math.min(a,c)),a}(f,this.constraints[a],this.elastic[a])),e.set(f)}resolveConstraints(){let{dragConstraints:a,dragElastic:b}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,d=this.constraints;a&&oj(a)?this.constraints||(this.constraints=this.resolveRefConstraints()):a&&c?this.constraints=function(a,{top:b,left:c,bottom:d,right:e}){return{x:or(a.x,c,e),y:or(a.y,b,d)}}(c.layoutBox,a):this.constraints=!1,this.elastic=function(a=.35){return!1===a?a=0:!0===a&&(a=.35),{x:ot(a,"left","right"),y:ot(a,"top","bottom")}}(b),d!==this.constraints&&!oj(a)&&c&&this.constraints&&!this.hasMutatedConstraints&&nW(a=>{var b,d;let e;!1!==this.constraints&&this.getAxisMotionValue(a)&&(this.constraints[a]=(b=c.layoutBox[a],d=this.constraints[a],e={},void 0!==d.min&&(e.min=d.min-b.min),void 0!==d.max&&(e.max=d.max-b.min),e))})}resolveRefConstraints(){var a;let{dragConstraints:b,onMeasureDragConstraints:c}=this.getProps();if(!b||!oj(b))return!1;let d=b.current;kt(null!==d,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:e}=this.visualElement;if(!e||!e.layout)return!1;let f=function(a,b,c){let d=mg(a,c),{scroll:e}=b;return e&&(mc(d.x,e.offset.x),mc(d.y,e.offset.y)),d}(d,e.root,this.visualElement.getTransformPagePoint()),g=(a=e.layout.layoutBox,{x:os(a.x,f.x),y:os(a.y,f.y)});if(c){let a=c(function({x:a,y:b}){return{top:b.min,right:a.max,bottom:b.max,left:a.min}}(g));this.hasMutatedConstraints=!!a,a&&(g=l4(a))}return g}startAnimation(a){let{drag:b,dragMomentum:c,dragElastic:d,dragTransition:e,dragSnapToOrigin:f,onDragTransitionEnd:g}=this.getProps(),h=this.constraints||{};return Promise.all(nW(g=>{if(!oy(g,b,this.currentDirection))return;let i=h&&h[g]||{};f&&(i={min:0,max:0});let j={type:"inertia",velocity:c?a[g]:0,bounceStiffness:d?200:1e6,bounceDamping:d?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...e,...i};return this.startAxisValueAnimation(g,j)})).then(g)}startAxisValueAnimation(a,b){let c=this.getAxisMotionValue(a);return mJ(this.visualElement,a),c.start(nI(a,c,0,b,this.visualElement,!1))}stopAnimation(){nW(a=>this.getAxisMotionValue(a).stop())}getAxisMotionValue(a){let b=`_drag${a.toUpperCase()}`,c=this.visualElement.getProps();return c[b]||this.visualElement.getValue(a,(c.initial?c.initial[a]:void 0)||0)}snapToCursor(a){nW(b=>{let{drag:c}=this.getProps();if(!oy(b,c,this.currentDirection))return;let{projection:d}=this.visualElement,e=this.getAxisMotionValue(b);if(d&&d.layout){let{min:c,max:f}=d.layout.layoutBox[b],g=e.get()||0;e.set(a[b]-l$(c,f,.5)+g)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:a,dragConstraints:b}=this.getProps(),{projection:c}=this.visualElement;if(!oj(b)||!c||!this.constraints)return;this.stopAnimation();let d={x:0,y:0};nW(a=>{let b=this.getAxisMotionValue(a);if(b&&!1!==this.constraints){var c,e;let f,g,h,i=b.get();d[a]=(c={min:i,max:i},e=this.constraints[a],f=.5,g=nX(c),(h=nX(e))>g?f=nr(e.min,e.max-g,c.min):g>h&&(f=nr(c.min,c.max-h,e.min)),jI(0,1,f))}});let{transformTemplate:e}=this.visualElement.getProps();this.visualElement.current.style.transform=e?e({},""):"none",c.root&&c.root.updateScroll(),c.updateLayout(),this.constraints=!1,this.resolveConstraints(),nW(b=>{if(!oy(b,a,null))return;let c=this.getAxisMotionValue(b),{min:e,max:f}=this.constraints[b];c.set(l$(e,f,d[b]))}),this.visualElement.render()}addListeners(){let a;if(!this.visualElement.current)return;ov.set(this.visualElement,this);let b=this.visualElement.current,c=oh(b,"pointerdown",a=>{let{drag:c,dragListener:d=!0}=this.getProps(),e=a.target,f=e!==b&&(n2.has(e.tagName)||!0===e.isContentEditable);c&&d&&!f&&this.start(a)}),d=()=>{var c,d,e;let f,g,{dragConstraints:h}=this.getProps();oj(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),a||(c=b,d=h.current,f=oe(c,ox(e=()=>this.scalePositionWithinConstraints())),g=oe(d,ox(e)),a=()=>{f(),g()}))},{projection:e}=this.visualElement,f=e.addEventListener("measure",d);e&&!e.layout&&(e.root&&e.root.updateScroll(),e.updateLayout()),kT.read(d);let g=n3(window,"resize",()=>this.scalePositionWithinConstraints()),h=e.addEventListener("didUpdate",({delta:a,hasLayoutChanged:b})=>{this.isDragging&&b&&(nW(b=>{let c=this.getAxisMotionValue(b);c&&(this.originPoint[b]+=a[b].translate,c.set(c.get()+a[b].translate))}),this.visualElement.render())});return()=>{g(),c(),f(),h&&h(),a&&a()}}getProps(){let a=this.visualElement.getProps(),{drag:b=!1,dragDirectionLock:c=!1,dragPropagation:d=!1,dragConstraints:e=!1,dragElastic:f=.35,dragMomentum:g=!0}=a;return{...a,drag:b,dragDirectionLock:c,dragPropagation:d,dragConstraints:e,dragElastic:f,dragMomentum:g}}}function ox(a){let b=!0;return()=>{if(b){b=!1;return}a()}}function oy(a,b,c){return(!0===b||b===a)&&(null===c||c===a)}class oz extends mE{constructor(a){super(a),this.removeGroupControls=kP,this.removeListeners=kP,this.controls=new ow(a)}mount(){let{dragControls:a}=this.node.getProps();a&&(this.removeGroupControls=a.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||kP}update(){let{dragControls:a}=this.node.getProps(),{dragControls:b}=this.node.prevProps||{};a!==b&&(this.removeGroupControls(),a&&(this.removeGroupControls=a.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}let oA=a=>(b,c)=>{a&&kT.update(()=>a(b,c),!1,!0)};class oB extends mE{constructor(){super(...arguments),this.removePointerDownListener=kP}onPointerDown(a){this.session=new om(a,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:oi(this.node)})}createPanHandlers(){let{onPanSessionStart:a,onPanStart:b,onPan:c,onPanEnd:d}=this.node.getProps();return{onSessionStart:oA(a),onStart:oA(b),onMove:oA(c),onEnd:(a,b)=>{delete this.session,d&&kT.postRender(()=>d(a,b))}}}mount(){this.removePointerDownListener=oh(this.node.current,"pointerdown",a=>this.onPointerDown(a))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let oC={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function oD(a=!0){let b=(0,E.useContext)(mv);if(null===b)return[!0,null];let{isPresent:c,onExitComplete:d,register:e}=b,f=(0,E.useId)(),g=(0,E.useCallback)(()=>a&&d&&d(f),[f,d,a]);return!c&&d?[!1,g]:[!0]}let oE=(0,E.createContext)({}),oF=!1;class oG extends E.Component{componentDidMount(){let{visualElement:a,layoutGroup:b,switchLayoutGroup:c,layoutId:d}=this.props,{projection:e}=a;e&&(b.group&&b.group.add(e),c&&c.register&&d&&c.register(e),oF&&e.root.didUpdate(),e.addEventListener("animationComplete",()=>{this.safeToRemove()}),e.setOptions({...e.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),oC.hasEverUpdated=!0}getSnapshotBeforeUpdate(a){let{layoutDependency:b,visualElement:c,drag:d,isPresent:e}=this.props,{projection:f}=c;return f&&(f.isPresent=e,a.layoutDependency!==b&&f.setOptions({...f.options,layoutDependency:b}),oF=!0,d||a.layoutDependency!==b||void 0===b||a.isPresent!==e?f.willUpdate():this.safeToRemove(),a.isPresent!==e&&(e?f.promote():f.relegate()||kT.postRender(()=>{let a=f.getStack();a&&a.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:a}=this.props.visualElement;a&&(a.root.didUpdate(),lq.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:a,layoutGroup:b,switchLayoutGroup:c}=this.props,{projection:d}=a;oF=!0,d&&(d.scheduleCheckAfterUnmount(),b&&b.group&&b.group.remove(d),c&&c.deregister&&c.deregister(d))}safeToRemove(){let{safeToRemove:a}=this.props;a&&a()}render(){return null}}function oH(a){let[b,c]=oD(),d=(0,E.useContext)(mk);return(0,D.jsx)(oG,{...a,layoutGroup:d,switchLayoutGroup:(0,E.useContext)(oE),isPresent:b,safeToRemove:c})}let oI=["TopLeft","TopRight","BottomLeft","BottomRight"],oJ=oI.length,oK=a=>"string"==typeof a?parseFloat(a):a,oL=a=>"number"==typeof a||jX.test(a);function oM(a,b){return void 0!==a[b]?a[b]:a.borderRadius}let oN=oP(0,.5,nn),oO=oP(.5,.95,kP);function oP(a,b,c){return d=>d<a?0:d>b?1:c(nr(a,b,d))}function oQ(a,b){a.min=b.min,a.max=b.max}function oR(a,b){oQ(a.x,b.x),oQ(a.y,b.y)}function oS(a,b){a.translate=b.translate,a.scale=b.scale,a.originPoint=b.originPoint,a.origin=b.origin}function oT(a,b,c,d,e){return a-=b,a=d+1/c*(a-d),void 0!==e&&(a=d+1/e*(a-d)),a}function oU(a,b,[c,d,e],f,g){!function(a,b=0,c=1,d=.5,e,f=a,g=a){if(jW.test(b)&&(b=parseFloat(b),b=l$(g.min,g.max,b/100)-g.min),"number"!=typeof b)return;let h=l$(f.min,f.max,d);a===f&&(h-=b),a.min=oT(a.min,b,c,h,e),a.max=oT(a.max,b,c,h,e)}(a,b[c],b[d],b[e],b.scale,f,g)}let oV=["x","scaleX","originX"],oW=["y","scaleY","originY"];function oX(a,b,c,d){oU(a.x,b,oV,c?c.x:void 0,d?d.x:void 0),oU(a.y,b,oW,c?c.y:void 0,d?d.y:void 0)}function oY(a){return 0===a.translate&&1===a.scale}function oZ(a){return oY(a.x)&&oY(a.y)}function o$(a,b){return a.min===b.min&&a.max===b.max}function o_(a,b){return Math.round(a.min)===Math.round(b.min)&&Math.round(a.max)===Math.round(b.max)}function o0(a,b){return o_(a.x,b.x)&&o_(a.y,b.y)}function o1(a){return nX(a.x)/nX(a.y)}function o2(a,b){return a.translate===b.translate&&a.scale===b.scale&&a.originPoint===b.originPoint}class o3{constructor(){this.members=[]}add(a){k7(this.members,a);for(let b=this.members.length-1;b>=0;b--){let c=this.members[b];if(c===a||c===this.lead||c===this.prevLead)continue;let d=c.instance;d&&!1!==d.isConnected||c.snapshot||(k8(this.members,c),c.unmount())}a.scheduleRender()}remove(a){if(k8(this.members,a),a===this.prevLead&&(this.prevLead=void 0),a===this.lead){let a=this.members[this.members.length-1];a&&this.promote(a)}}relegate(a){for(let b=this.members.indexOf(a)-1;b>=0;b--){let a=this.members[b];if(!1!==a.isPresent&&a.instance?.isConnected!==!1)return this.promote(a),!0}return!1}promote(a,b){let c=this.lead;if(a!==c&&(this.prevLead=c,this.lead=a,a.show(),c)){c.updateSnapshot(),a.scheduleRender();let{layoutDependency:d}=c.options,{layoutDependency:e}=a.options;(void 0===d||d!==e)&&(a.resumeFrom=c,b&&(c.preserveOpacity=!0),c.snapshot&&(a.snapshot=c.snapshot,a.snapshot.latestValues=c.animationValues||c.latestValues),a.root?.isUpdating&&(a.isLayoutDirty=!0)),!1===a.options.crossfade&&c.hide()}}exitAnimationComplete(){this.members.forEach(a=>{a.options.onExitComplete?.(),a.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(a=>a.instance&&a.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}let o4=(a,b)=>a.depth-b.depth;class o5{constructor(){this.children=[],this.isDirty=!1}add(a){k7(this.children,a),this.isDirty=!0}remove(a){k8(this.children,a),this.isDirty=!0}forEach(a){this.isDirty&&this.children.sort(o4),this.isDirty=!1,this.children.forEach(a)}}let o6=["","X","Y","Z"],o7=0;function o8(a,b,c,d){let{latestValues:e}=b;e[a]&&(c[a]=e[a],b.setStaticValue(a,0),d&&(d[a]=0))}function o9({attachResizeListener:a,defaultParent:b,measureScroll:c,checkIsScrollRoot:d,resetTransform:e}){return class{constructor(a={},c=b?.()){this.id=o7++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(pc),this.nodes.forEach(pj),this.nodes.forEach(pk),this.nodes.forEach(pd)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let a=0;a<this.path.length;a++)this.path[a].shouldResetTransform=!0;this.root===this&&(this.nodes=new o5)}addEventListener(a,b){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new k9),this.eventHandlers.get(a).add(b)}notifyListeners(a,...b){let c=this.eventHandlers.get(a);c&&c.notify(...b)}hasListeners(a){return this.eventHandlers.has(a)}mount(b){if(this.instance)return;this.isSVG=n5(b)&&!(n5(b)&&"svg"===b.tagName),this.instance=b;let{layoutId:c,layout:d,visualElement:e}=this.options;if(e&&!e.current&&e.mount(b),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(d||c)&&(this.isLayoutDirty=!0),a){let c,d=0,e=()=>this.root.updateBlockedByResize=!1;kT.read(()=>{d=window.innerWidth}),a(b,()=>{let a=window.innerWidth;if(a!==d){let b,f;d=a,this.root.updateBlockedByResize=!0,c&&c(),b=ls.now(),f=({timestamp:a})=>{let c=a-b;c>=250&&(kU(f),e(c-250))},kT.setup(f,!0),c=()=>kU(f),oC.hasAnimatedSinceResize&&(oC.hasAnimatedSinceResize=!1,this.nodes.forEach(pi))}})}c&&this.root.registerSharedNode(c,this),!1!==this.options.animate&&e&&(c||d)&&this.addEventListener("didUpdate",({delta:a,hasLayoutChanged:b,hasRelativeLayoutChanged:c,layout:d})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let f=this.options.transition||e.getDefaultTransition()||pq,{onLayoutAnimationStart:g,onLayoutAnimationComplete:h}=e.getProps(),i=!this.targetLayout||!o0(this.targetLayout,d),j=!b&&c;if(this.options.layoutRoot||this.resumeFrom||j||b&&(i||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let b={...mH(f,"layout"),onPlay:g,onComplete:h};(e.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b),this.setAnimationOrigin(a,j)}else b||pi(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=d})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),kU(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(pl),this.animationId++)}getTransformTemplate(){let{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function a(b){if(b.hasCheckedOptimisedAppear=!0,b.root===b)return;let{visualElement:c}=b.options;if(!c)return;let d=c.props[mK];if(window.MotionHasOptimisedAnimation(d,"transform")){let{layout:a,layoutId:c}=b.options;window.MotionCancelOptimisedAnimation(d,"transform",kT,!(a||c))}let{parent:e}=b;e&&!e.hasCheckedOptimisedAppear&&a(e)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let a=0;a<this.path.length;a++){let b=this.path[a];b.shouldResetTransform=!0,b.updateScroll("snapshot"),b.options.layoutRoot&&b.willUpdate(!1)}let{layoutId:b,layout:c}=this.options;if(void 0===b&&!c)return;let d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(pf);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(pg);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ph),this.nodes.forEach(pa),this.nodes.forEach(pb)):this.nodes.forEach(pg),this.clearAllSnapshots();let a=ls.now();kV.delta=jI(0,1e3/60,a-kV.timestamp),kV.timestamp=a,kV.isProcessing=!0,kW.update.process(kV),kW.preRender.process(kV),kW.render.process(kV),kV.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,lq.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(pe),this.sharedNodes.forEach(pm)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,kT.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){kT.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||nX(this.snapshot.measuredBox.x)||nX(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let a=0;a<this.path.length;a++)this.path[a].updateScroll();let a=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=km(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:b}=this.options;b&&b.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let b=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(b=!1),b&&this.instance){let b=d(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:b,offset:c(this.instance),wasRoot:this.scroll?this.scroll.isRoot:b}}}resetTransform(){if(!e)return;let a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,b=this.projectionDelta&&!oZ(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,f=d!==this.prevTransformTemplateValue;a&&this.instance&&(b||l7(this.latestValues)||f)&&(e(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){var b;let c=this.measurePageBox(),d=this.removeElementScroll(c);return a&&(d=this.removeTransform(d)),pt((b=d).x),pt(b.y),{animationId:this.root.animationId,measuredBox:c,layoutBox:d,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:a}=this.options;if(!a)return km();let b=a.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(pv))){let{scroll:a}=this.root;a&&(mc(b.x,a.offset.x),mc(b.y,a.offset.y))}return b}removeElementScroll(a){let b=km();if(oR(b,a),this.scroll?.wasRoot)return b;for(let c=0;c<this.path.length;c++){let d=this.path[c],{scroll:e,options:f}=d;d!==this.root&&e&&f.layoutScroll&&(e.wasRoot&&oR(b,a),mc(b.x,e.offset.x),mc(b.y,e.offset.y))}return b}applyTransform(a,b=!1){let c=km();oR(c,a);for(let a=0;a<this.path.length;a++){let d=this.path[a];!b&&d.options.layoutScroll&&d.scroll&&d!==d.root&&mf(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),l7(d.latestValues)&&mf(c,d.latestValues)}return l7(this.latestValues)&&mf(c,this.latestValues),c}removeTransform(a){let b=km();oR(b,a);for(let a=0;a<this.path.length;a++){let c=this.path[a];if(!c.instance||!l7(c.latestValues))continue;l6(c.latestValues)&&c.updateSnapshot();let d=km();oR(d,c.measurePageBox()),oX(b,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,d)}return l7(this.latestValues)&&oX(b,this.latestValues),b}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:void 0===a.crossfade||a.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==kV.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){let b=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=b.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=b.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=b.isSharedProjectionDirty);let c=!!this.resumingFrom||this!==b;if(!(a||c&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:d,layoutId:e}=this.options;if(!this.layout||!(d||e))return;this.resolvedRelativeTargetAt=kV.timestamp;let f=this.getClosestProjectingParent();if(f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=km(),this.targetWithTransforms=km()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var g,h,i;this.forceRelativeParentToResolveTarget(),g=this.target,h=this.relativeTarget,i=this.relativeParent.target,n$(g.x,h.x,i.x),n$(g.y,h.y,i.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):oR(this.target,this.layout.layoutBox),mb(this.target,this.targetDelta)):oR(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&1!==this.animationProgress?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||l6(this.parent.latestValues)||l8(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(a,b,c){this.relativeParent=a,this.linkedParentVersion=a.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=km(),this.relativeTargetOrigin=km(),n0(this.relativeTargetOrigin,b,c),oR(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let a=this.getLead(),b=!!this.resumingFrom||this!==a,c=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(c=!1),b&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===kV.timestamp&&(c=!1),c)return;let{layout:d,layoutId:e}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||e))return;oR(this.layoutCorrected,this.layout.layoutBox);let f=this.treeScale.x,g=this.treeScale.y;!function(a,b,c,d=!1){let e,f,g=c.length;if(g){b.x=b.y=1;for(let h=0;h<g;h++){f=(e=c[h]).projectionDelta;let{visualElement:g}=e.options;(!g||!g.props.style||"contents"!==g.props.style.display)&&(d&&e.options.layoutScroll&&e.scroll&&e!==e.root&&mf(a,{x:-e.scroll.offset.x,y:-e.scroll.offset.y}),f&&(b.x*=f.x.scale,b.y*=f.y.scale,mb(a,f)),d&&l7(e.latestValues)&&mf(a,e.latestValues))}b.x<1.0000000000001&&b.x>.999999999999&&(b.x=1),b.y<1.0000000000001&&b.y>.999999999999&&(b.y=1)}}(this.layoutCorrected,this.treeScale,this.path,b),a.layout&&!a.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=km());let{target:h}=a;if(!h){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(oS(this.prevProjectionDelta.x,this.projectionDelta.x),oS(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),nZ(this.projectionDelta,this.layoutCorrected,h,this.latestValues),this.treeScale.x===f&&this.treeScale.y===g&&o2(this.projectionDelta.x,this.prevProjectionDelta.x)&&o2(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",h))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){if(this.options.visualElement?.scheduleRender(),a){let a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=kk(),this.projectionDelta=kk(),this.projectionDeltaWithTransform=kk()}setAnimationOrigin(a,b=!1){let c,d=this.snapshot,e=d?d.latestValues:{},f={...this.latestValues},g=kk();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!b;let h=km(),i=(d?d.source:void 0)!==(this.layout?this.layout.source:void 0),j=this.getStack(),k=!j||j.members.length<=1,l=!!(i&&!k&&!0===this.options.crossfade&&!this.path.some(pp));this.animationProgress=0,this.mixTargetDelta=b=>{let d=b/1e3;if(pn(g.x,a.x,d),pn(g.y,a.y,d),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var j,m,n,o,p,q;n0(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),n=this.relativeTarget,o=this.relativeTargetOrigin,p=h,q=d,po(n.x,o.x,p.x,q),po(n.y,o.y,p.y,q),c&&(j=this.relativeTarget,m=c,o$(j.x,m.x)&&o$(j.y,m.y))&&(this.isProjectionDirty=!1),c||(c=km()),oR(c,this.relativeTarget)}i&&(this.animationValues=f,function(a,b,c,d,e,f){e?(a.opacity=l$(0,c.opacity??1,oN(d)),a.opacityExit=l$(b.opacity??1,0,oO(d))):f&&(a.opacity=l$(b.opacity??1,c.opacity??1,d));for(let e=0;e<oJ;e++){let f=`border${oI[e]}Radius`,g=oM(b,f),h=oM(c,f);(void 0!==g||void 0!==h)&&(g||(g=0),h||(h=0),0===g||0===h||oL(g)===oL(h)?(a[f]=Math.max(l$(oK(g),oK(h),d),0),(jW.test(h)||jW.test(g))&&(a[f]+="%")):a[f]=h)}(b.rotate||c.rotate)&&(a.rotate=l$(b.rotate||0,c.rotate||0,d))}(f,e,this.latestValues,d,l,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=d},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(kU(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=kT.update(()=>{var b,c,d;let e;oC.hasAnimatedSinceResize=!0,lh.layout++,this.motionValue||(this.motionValue=lu(0)),this.motionValue.jump(0,!1),this.currentAnimation=(b=this.motionValue,c=[0,1e3],d={...a,velocity:0,isSync:!0,onUpdate:b=>{this.mixTargetDelta(b),a.onUpdate&&a.onUpdate(b)},onStop:()=>{lh.layout--},onComplete:()=>{lh.layout--,a.onComplete&&a.onComplete(),this.completeAnimation()}},(e=kn(b)?b:lu(b)).start(nI("",e,c,d)),e.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let a=this.getLead(),{targetWithTransforms:b,target:c,layout:d,latestValues:e}=a;if(b&&c&&d){if(this!==a&&this.layout&&d&&pu(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||km();let b=nX(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+b;let d=nX(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+d}oR(b,c),mf(b,e),nZ(this.projectionDeltaWithTransform,this.layoutCorrected,b,e)}}registerSharedNode(a,b){this.sharedNodes.has(a)||this.sharedNodes.set(a,new o3),this.sharedNodes.get(a).add(b);let c=b.options.initialPromotionConfig;b.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(b):void 0})}isLead(){let a=this.getStack();return!a||a.lead===this}getLead(){let{layoutId:a}=this.options;return a&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:a}=this.options;return a?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:b,preserveFollowOpacity:c}={}){let d=this.getStack();d&&d.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),b&&this.setOptions({transition:b})}relegate(){let a=this.getStack();return!!a&&a.relegate(this)}resetSkewAndRotation(){let{visualElement:a}=this.options;if(!a)return;let b=!1,{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(b=!0),!b)return;let d={};c.z&&o8("z",a,d,this.animationValues);for(let b=0;b<o6.length;b++)o8(`rotate${o6[b]}`,a,d,this.animationValues),o8(`skew${o6[b]}`,a,d,this.animationValues);for(let b in a.render(),d)a.setStaticValue(b,d[b]),this.animationValues&&(this.animationValues[b]=d[b]);a.scheduleRender()}applyProjectionStyles(a,b){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}let c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=mu(b?.pointerEvents)||"",a.transform=c?c(this.latestValues,""):"none";return}let d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(a.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,a.pointerEvents=mu(b?.pointerEvents)||""),this.hasProjected&&!l7(this.latestValues)&&(a.transform=c?c({},""):"none",this.hasProjected=!1);return}a.visibility="";let e=d.animationValues||d.latestValues;this.applyTransformsToTarget();let f=function(a,b,c){let d="",e=a.x.translate/b.x,f=a.y.translate/b.y,g=c?.z||0;if((e||f||g)&&(d=`translate3d(${e}px, ${f}px, ${g}px) `),(1!==b.x||1!==b.y)&&(d+=`scale(${1/b.x}, ${1/b.y}) `),c){let{transformPerspective:a,rotate:b,rotateX:e,rotateY:f,skewX:g,skewY:h}=c;a&&(d=`perspective(${a}px) ${d}`),b&&(d+=`rotate(${b}deg) `),e&&(d+=`rotateX(${e}deg) `),f&&(d+=`rotateY(${f}deg) `),g&&(d+=`skewX(${g}deg) `),h&&(d+=`skewY(${h}deg) `)}let h=a.x.scale*b.x,i=a.y.scale*b.y;return(1!==h||1!==i)&&(d+=`scale(${h}, ${i})`),d||"none"}(this.projectionDeltaWithTransform,this.treeScale,e);c&&(f=c(e,f)),a.transform=f;let{x:g,y:h}=this.projectionDelta;for(let b in a.transformOrigin=`${100*g.origin}% ${100*h.origin}% 0`,d.animationValues?a.opacity=d===this?e.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:e.opacityExit:a.opacity=d===this?void 0!==e.opacity?e.opacity:"":void 0!==e.opacityExit?e.opacityExit:0,l_){if(void 0===e[b])continue;let{correct:c,applyTo:g,isCSSVariable:h}=l_[b],i="none"===f?e[b]:c(e[b],d);if(g){let b=g.length;for(let c=0;c<b;c++)a[g[c]]=i}else h?this.options.visualElement.renderState.vars[b]=i:a[b]=i}this.options.layoutId&&(a.pointerEvents=d===this?mu(b?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>a.currentAnimation?.stop()),this.root.nodes.forEach(pf),this.root.sharedNodes.clear()}}}function pa(a){a.updateLayout()}function pb(a){let b=a.resumeFrom?.snapshot||a.snapshot;if(a.isLead()&&a.layout&&b&&a.hasListeners("didUpdate")){let{layoutBox:c,measuredBox:d}=a.layout,{animationType:e}=a.options,f=b.source!==a.layout.source;"size"===e?nW(a=>{let d=f?b.measuredBox[a]:b.layoutBox[a],e=nX(d);d.min=c[a].min,d.max=d.min+e}):pu(e,b.layoutBox,c)&&nW(d=>{let e=f?b.measuredBox[d]:b.layoutBox[d],g=nX(c[d]);e.max=e.min+g,a.relativeTarget&&!a.currentAnimation&&(a.isProjectionDirty=!0,a.relativeTarget[d].max=a.relativeTarget[d].min+g)});let g=kk();nZ(g,c,b.layoutBox);let h=kk();f?nZ(h,a.applyTransform(d,!0),b.measuredBox):nZ(h,c,b.layoutBox);let i=!oZ(g),j=!1;if(!a.resumeFrom){let d=a.getClosestProjectingParent();if(d&&!d.resumeFrom){let{snapshot:e,layout:f}=d;if(e&&f){let g=km();n0(g,b.layoutBox,e.layoutBox);let h=km();n0(h,c,f.layoutBox),o0(g,h)||(j=!0),d.options.layoutRoot&&(a.relativeTarget=h,a.relativeTargetOrigin=g,a.relativeParent=d)}}}a.notifyListeners("didUpdate",{layout:c,snapshot:b,delta:h,layoutDelta:g,hasLayoutChanged:i,hasRelativeLayoutChanged:j})}else if(a.isLead()){let{onExitComplete:b}=a.options;b&&b()}a.options.transition=void 0}function pc(a){a.parent&&(a.isProjecting()||(a.isProjectionDirty=a.parent.isProjectionDirty),a.isSharedProjectionDirty||(a.isSharedProjectionDirty=!!(a.isProjectionDirty||a.parent.isProjectionDirty||a.parent.isSharedProjectionDirty)),a.isTransformDirty||(a.isTransformDirty=a.parent.isTransformDirty))}function pd(a){a.isProjectionDirty=a.isSharedProjectionDirty=a.isTransformDirty=!1}function pe(a){a.clearSnapshot()}function pf(a){a.clearMeasurements()}function pg(a){a.isLayoutDirty=!1}function ph(a){let{visualElement:b}=a.options;b&&b.getProps().onBeforeLayoutMeasure&&b.notify("BeforeLayoutMeasure"),a.resetTransform()}function pi(a){a.finishAnimation(),a.targetDelta=a.relativeTarget=a.target=void 0,a.isProjectionDirty=!0}function pj(a){a.resolveTargetDelta()}function pk(a){a.calcProjection()}function pl(a){a.resetSkewAndRotation()}function pm(a){a.removeLeadSnapshot()}function pn(a,b,c){a.translate=l$(b.translate,0,c),a.scale=l$(b.scale,1,c),a.origin=b.origin,a.originPoint=b.originPoint}function po(a,b,c,d){a.min=l$(b.min,c.min,d),a.max=l$(b.max,c.max,d)}function pp(a){return a.animationValues&&void 0!==a.animationValues.opacityExit}let pq={duration:.45,ease:[.4,0,.1,1]},pr=a=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(a),ps=pr("applewebkit/")&&!pr("chrome/")?Math.round:kP;function pt(a){a.min=ps(a.min),a.max=ps(a.max)}function pu(a,b,c){return"position"===a||"preserve-aspect"===a&&!(.2>=Math.abs(o1(b)-o1(c)))}function pv(a){return a!==a.root&&a.scroll?.wasRoot}let pw=o9({attachResizeListener:(a,b)=>n3(a,"resize",b),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),px={current:void 0},py=o9({measureScroll:a=>({x:a.scrollLeft,y:a.scrollTop}),defaultParent:()=>{if(!px.current){let a=new pw({});a.mount(window),a.setOptions({layoutScroll:!0}),px.current=a}return px.current},resetTransform:(a,b)=>{a.style.transform=void 0!==b?b:"none"},checkIsScrollRoot:a=>"fixed"===window.getComputedStyle(a).position});function pz(a,b){let c=n6(a),d=new AbortController;return[c,{passive:!0,...b,signal:d.signal},()=>d.abort()]}function pA(a,b,c){let{props:d}=a;a.animationState&&d.whileHover&&a.animationState.setActive("whileHover","Start"===c);let e=d["onHover"+c];e&&kT.postRender(()=>e(b,og(b)))}class pB extends mE{mount(){let{current:a}=this.node;a&&(this.unmount=function(a,b,c={}){let[d,e,f]=pz(a,c);return d.forEach(a=>{let c,d=!1,f=!1,g=b=>{c&&(c(b),c=void 0),a.removeEventListener("pointerleave",i)},h=a=>{d=!1,window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),f&&(f=!1,g(a))},i=a=>{if("touch"!==a.pointerType){if(d){f=!0;return}g(a)}};a.addEventListener("pointerenter",d=>{if("touch"===d.pointerType||nV.x||nV.y)return;f=!1;let g=b(a,d);"function"==typeof g&&(c=g,a.addEventListener("pointerleave",i,e))},e),a.addEventListener("pointerdown",()=>{d=!0,window.addEventListener("pointerup",h,e),window.addEventListener("pointercancel",h,e)},e)}),f}(a,(a,b)=>(pA(this.node,b,"Start"),a=>pA(this.node,a,"End"))))}unmount(){}}class pC extends mE{constructor(){super(...arguments),this.isActive=!1}onFocus(){let a=!1;try{a=this.node.current.matches(":focus-visible")}catch(b){a=!0}a&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=mM(n3(this.node.current,"focus",()=>this.onFocus()),n3(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function pD(a){return n4(a)&&"offsetHeight"in a}let pE=(a,b)=>!!b&&(a===b||pE(a,b.parentElement)),pF=new WeakSet;function pG(a){return b=>{"Enter"===b.key&&a(b)}}function pH(a,b){a.dispatchEvent(new PointerEvent("pointer"+b,{isPrimary:!0,bubbles:!0}))}function pI(a){return of(a)&&!(nV.x||nV.y)}let pJ=new WeakSet;function pK(a,b,c){let{props:d}=a;if(a.current instanceof HTMLButtonElement&&a.current.disabled)return;a.animationState&&d.whileTap&&a.animationState.setActive("whileTap","Start"===c);let e=d["onTap"+("End"===c?"":c)];e&&kT.postRender(()=>e(b,og(b)))}class pL extends mE{mount(){let{current:a}=this.node;if(!a)return;let{globalTapTarget:b,propagate:c}=this.node.props;this.unmount=function(a,b,c={}){let[d,e,f]=pz(a,c),g=a=>{let d=a.currentTarget;if(!pI(a)||pJ.has(a))return;pF.add(d),c.stopPropagation&&pJ.add(a);let f=b(d,a),g=(a,b)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",i),pF.has(d)&&pF.delete(d),pI(a)&&"function"==typeof f&&f(a,{success:b})},h=a=>{g(a,d===window||d===document||c.useGlobalTarget||pE(d,a.target))},i=a=>{g(a,!1)};window.addEventListener("pointerup",h,e),window.addEventListener("pointercancel",i,e)};return d.forEach(a=>{((c.useGlobalTarget?window:a).addEventListener("pointerdown",g,e),pD(a))&&(a.addEventListener("focus",a=>((a,b)=>{let c=a.currentTarget;if(!c)return;let d=pG(()=>{if(pF.has(c))return;pH(c,"down");let a=pG(()=>{pH(c,"up")});c.addEventListener("keyup",a,b),c.addEventListener("blur",()=>pH(c,"cancel"),b)});c.addEventListener("keydown",d,b),c.addEventListener("blur",()=>c.removeEventListener("keydown",d),b)})(a,e)),n1.has(a.tagName)||!0===a.isContentEditable||a.hasAttribute("tabindex")||(a.tabIndex=0))}),f}(a,(a,b)=>(pK(this.node,b,"Start"),(a,{success:b})=>pK(this.node,a,b?"End":"Cancel")),{useGlobalTarget:b,stopPropagation:c?.tap===!1})}unmount(){}}let pM=new WeakMap,pN=new WeakMap,pO=a=>{let b=pM.get(a.target);b&&b(a)},pP=a=>{a.forEach(pO)},pQ={some:0,all:1};class pR extends mE{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var a;let b;this.unmount();let{viewport:c={}}=this.node.getProps(),{root:d,margin:e,amount:f="some",once:g}=c,h={root:d?d.current:void 0,rootMargin:e,threshold:"number"==typeof f?f:pQ[f]},i=a=>{let{isIntersecting:b}=a;if(this.isInView===b||(this.isInView=b,g&&!b&&this.hasEnteredView))return;b&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",b);let{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),e=b?c:d;e&&e(a)};return a=this.node.current,b=function({root:a,...b}){let c=a||document;pN.has(c)||pN.set(c,{});let d=pN.get(c),e=JSON.stringify(b);return d[e]||(d[e]=new IntersectionObserver(pP,{root:a,...b})),d[e]}(h),pM.set(a,i),b.observe(a),()=>{pM.delete(a),b.unobserve(a)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:a,prevProps:b}=this.node;["amount","margin","root"].some(function({viewport:a={}},{viewport:b={}}={}){return c=>a[c]!==b[c]}(a,b))&&this.startObserver()}unmount(){}}let pS=function(a,b){if("u"<typeof Proxy)return mD;let c=new Map,d=(c,d)=>mD(c,d,a,b);return new Proxy((a,b)=>d(a,b),{get:(e,f)=>"create"===f?d:(c.has(f)||c.set(f,mD(f,void 0,a,b)),c.get(f))})}({animation:{Feature:nS},exit:{Feature:nU},inView:{Feature:pR},tap:{Feature:pL},focus:{Feature:pC},hover:{Feature:pB},pan:{Feature:oB},drag:{Feature:oz,ProjectionNode:py,MeasureLayout:oH},layout:{ProjectionNode:py,MeasureLayout:oH}},(a,b)=>b.isSVG??mj(a)?new l3(b):new mh(b,{allowProjection:a!==E.Fragment}));function pT({tone:a,pulse:b=!1,className:c}){return(0,D.jsxs)("span",{className:bb("relative inline-flex h-2.5 w-2.5 items-center justify-center",c),children:[b?(0,D.jsx)(pS.span,{className:bb("absolute inset-0 rounded-full",a),animate:{opacity:[.4,0],scale:[1,2.2]},transition:{duration:1.8,repeat:1/0,ease:"easeOut"}}):null,(0,D.jsx)("span",{className:bb("relative inline-flex h-2.5 w-2.5 rounded-full",a)})]})}var pU="ScrollArea",[pV,pW]=bs(pU),[pX,pY]=pV(pU),pZ=E.forwardRef((a,b)=>{let{__scopeScrollArea:c,type:d="hover",dir:e,scrollHideDelay:f=600,...g}=a,[h,i]=E.useState(null),[j,k]=E.useState(null),[l,m]=E.useState(null),[n,o]=E.useState(null),[p,q]=E.useState(null),[r,s]=E.useState(0),[t,u]=E.useState(0),[v,w]=E.useState(!1),[x,y]=E.useState(!1),z=bg(b,a=>i(a)),A=bJ(e);return(0,D.jsx)(pX,{scope:c,type:d,dir:A,scrollHideDelay:f,scrollArea:h,viewport:j,onViewportChange:k,content:l,onContentChange:m,scrollbarX:n,onScrollbarXChange:o,scrollbarXEnabled:v,onScrollbarXEnabledChange:w,scrollbarY:p,onScrollbarYChange:q,scrollbarYEnabled:x,onScrollbarYEnabledChange:y,onCornerWidthChange:s,onCornerHeightChange:u,children:(0,D.jsx)(bE.div,{dir:A,...g,ref:z,style:{position:"relative","--radix-scroll-area-corner-width":r+"px","--radix-scroll-area-corner-height":t+"px",...a.style}})})});pZ.displayName=pU;var p$="ScrollAreaViewport",p_=E.forwardRef((a,b)=>{let{__scopeScrollArea:c,children:d,nonce:e,...f}=a,g=pY(p$,c),h=bg(b,E.useRef(null),g.onViewportChange);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:e}),(0,D.jsx)(bE.div,{"data-radix-scroll-area-viewport":"",...f,ref:h,style:{overflowX:g.scrollbarXEnabled?"scroll":"hidden",overflowY:g.scrollbarYEnabled?"scroll":"hidden",...a.style},children:(0,D.jsx)("div",{ref:g.onContentChange,style:{minWidth:"100%",display:"table"},children:d})})]})});p_.displayName=p$;var p0="ScrollAreaScrollbar",p1=E.forwardRef((a,b)=>{let{forceMount:c,...d}=a,e=pY(p0,a.__scopeScrollArea),{onScrollbarXEnabledChange:f,onScrollbarYEnabledChange:g}=e,h="horizontal"===a.orientation;return E.useEffect(()=>(h?f(!0):g(!0),()=>{h?f(!1):g(!1)}),[h,f,g]),"hover"===e.type?(0,D.jsx)(p2,{...d,ref:b,forceMount:c}):"scroll"===e.type?(0,D.jsx)(p3,{...d,ref:b,forceMount:c}):"auto"===e.type?(0,D.jsx)(p4,{...d,ref:b,forceMount:c}):"always"===e.type?(0,D.jsx)(p5,{...d,ref:b}):null});p1.displayName=p0;var p2=E.forwardRef((a,b)=>{let{forceMount:c,...d}=a,e=pY(p0,a.__scopeScrollArea),[f,g]=E.useState(!1);return E.useEffect(()=>{let a=e.scrollArea,b=0;if(a){let c=()=>{window.clearTimeout(b),g(!0)},d=()=>{b=window.setTimeout(()=>g(!1),e.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(b),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",d)}}},[e.scrollArea,e.scrollHideDelay]),(0,D.jsx)(b$,{present:c||f,children:(0,D.jsx)(p4,{"data-state":f?"visible":"hidden",...d,ref:b})})}),p3=E.forwardRef((a,b)=>{var c;let{forceMount:d,...e}=a,f=pY(p0,a.__scopeScrollArea),g="horizontal"===a.orientation,h=qn(()=>j("SCROLL_END"),100),[i,j]=(c={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},E.useReducer((a,b)=>c[a][b]??a,"hidden"));return E.useEffect(()=>{if("idle"===i){let a=window.setTimeout(()=>j("HIDE"),f.scrollHideDelay);return()=>window.clearTimeout(a)}},[i,f.scrollHideDelay,j]),E.useEffect(()=>{let a=f.viewport,b=g?"scrollLeft":"scrollTop";if(a){let c=a[b],d=()=>{let d=a[b];c!==d&&(j("SCROLL"),h()),c=d};return a.addEventListener("scroll",d),()=>a.removeEventListener("scroll",d)}},[f.viewport,g,j,h]),(0,D.jsx)(b$,{present:d||"hidden"!==i,children:(0,D.jsx)(p5,{"data-state":"hidden"===i?"hidden":"visible",...e,ref:b,onPointerEnter:br(a.onPointerEnter,()=>j("POINTER_ENTER")),onPointerLeave:br(a.onPointerLeave,()=>j("POINTER_LEAVE"))})})}),p4=E.forwardRef((a,b)=>{let c=pY(p0,a.__scopeScrollArea),{forceMount:d,...e}=a,[f,g]=E.useState(!1),h="horizontal"===a.orientation,i=qn(()=>{if(c.viewport){let a=c.viewport.offsetWidth<c.viewport.scrollWidth,b=c.viewport.offsetHeight<c.viewport.scrollHeight;g(h?a:b)}},10);return qo(c.viewport,i),qo(c.content,i),(0,D.jsx)(b$,{present:d||f,children:(0,D.jsx)(p5,{"data-state":f?"visible":"hidden",...e,ref:b})})}),p5=E.forwardRef((a,b)=>{let{orientation:c="vertical",...d}=a,e=pY(p0,a.__scopeScrollArea),f=E.useRef(null),g=E.useRef(0),[h,i]=E.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),j=qi(h.viewport,h.content),k={...d,sizes:h,onSizesChange:i,hasThumb:!!(j>0&&j<1),onThumbChange:a=>f.current=a,onThumbPointerUp:()=>g.current=0,onThumbPointerDown:a=>g.current=a};function l(a,b){return function(a,b,c,d="ltr"){let e=qj(c),f=b||e/2,g=c.scrollbar.paddingStart+f,h=c.scrollbar.size-c.scrollbar.paddingEnd-(e-f),i=c.content-c.viewport;return ql([g,h],"ltr"===d?[0,i]:[-1*i,0])(a)}(a,g.current,h,b)}return"horizontal"===c?(0,D.jsx)(p6,{...k,ref:b,onThumbPositionChange:()=>{if(e.viewport&&f.current){let a=qk(e.viewport.scrollLeft,h,e.dir);f.current.style.transform=`translate3d(${a}px, 0, 0)`}},onWheelScroll:a=>{e.viewport&&(e.viewport.scrollLeft=a)},onDragScroll:a=>{e.viewport&&(e.viewport.scrollLeft=l(a,e.dir))}}):"vertical"===c?(0,D.jsx)(p7,{...k,ref:b,onThumbPositionChange:()=>{if(e.viewport&&f.current){let a=qk(e.viewport.scrollTop,h);f.current.style.transform=`translate3d(0, ${a}px, 0)`}},onWheelScroll:a=>{e.viewport&&(e.viewport.scrollTop=a)},onDragScroll:a=>{e.viewport&&(e.viewport.scrollTop=l(a))}}):null}),p6=E.forwardRef((a,b)=>{let{sizes:c,onSizesChange:d,...e}=a,f=pY(p0,a.__scopeScrollArea),[g,h]=E.useState(),i=E.useRef(null),j=bg(b,i,f.onScrollbarXChange);return E.useEffect(()=>{i.current&&h(getComputedStyle(i.current))},[i]),(0,D.jsx)(qa,{"data-orientation":"horizontal",...e,ref:j,sizes:c,style:{bottom:0,left:"rtl"===f.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===f.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":qj(c)+"px",...a.style},onThumbPointerDown:b=>a.onThumbPointerDown(b.x),onDragScroll:b=>a.onDragScroll(b.x),onWheelScroll:(b,c)=>{if(f.viewport){var d,e;let g=f.viewport.scrollLeft+b.deltaX;a.onWheelScroll(g),d=g,e=c,d>0&&d<e&&b.preventDefault()}},onResize:()=>{i.current&&f.viewport&&g&&d({content:f.viewport.scrollWidth,viewport:f.viewport.offsetWidth,scrollbar:{size:i.current.clientWidth,paddingStart:qh(g.paddingLeft),paddingEnd:qh(g.paddingRight)}})}})}),p7=E.forwardRef((a,b)=>{let{sizes:c,onSizesChange:d,...e}=a,f=pY(p0,a.__scopeScrollArea),[g,h]=E.useState(),i=E.useRef(null),j=bg(b,i,f.onScrollbarYChange);return E.useEffect(()=>{i.current&&h(getComputedStyle(i.current))},[i]),(0,D.jsx)(qa,{"data-orientation":"vertical",...e,ref:j,sizes:c,style:{top:0,right:"ltr"===f.dir?0:void 0,left:"rtl"===f.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":qj(c)+"px",...a.style},onThumbPointerDown:b=>a.onThumbPointerDown(b.y),onDragScroll:b=>a.onDragScroll(b.y),onWheelScroll:(b,c)=>{if(f.viewport){var d,e;let g=f.viewport.scrollTop+b.deltaY;a.onWheelScroll(g),d=g,e=c,d>0&&d<e&&b.preventDefault()}},onResize:()=>{i.current&&f.viewport&&g&&d({content:f.viewport.scrollHeight,viewport:f.viewport.offsetHeight,scrollbar:{size:i.current.clientHeight,paddingStart:qh(g.paddingTop),paddingEnd:qh(g.paddingBottom)}})}})}),[p8,p9]=pV(p0),qa=E.forwardRef((a,b)=>{let{__scopeScrollArea:c,sizes:d,hasThumb:e,onThumbChange:f,onThumbPointerUp:g,onThumbPointerDown:h,onThumbPositionChange:i,onDragScroll:j,onWheelScroll:k,onResize:l,...m}=a,n=pY(p0,c),[o,p]=E.useState(null),q=bg(b,a=>p(a)),r=E.useRef(null),s=E.useRef(""),t=n.viewport,u=d.content-d.viewport,v=bF(k),w=bF(i),x=qn(l,10);function y(a){r.current&&j({x:a.clientX-r.current.left,y:a.clientY-r.current.top})}return E.useEffect(()=>{let a=a=>{let b=a.target;o?.contains(b)&&v(a,u)};return document.addEventListener("wheel",a,{passive:!1}),()=>document.removeEventListener("wheel",a,{passive:!1})},[t,o,u,v]),E.useEffect(w,[d,w]),qo(o,x),qo(n.content,x),(0,D.jsx)(p8,{scope:c,scrollbar:o,hasThumb:e,onThumbChange:bF(f),onThumbPointerUp:bF(g),onThumbPositionChange:w,onThumbPointerDown:bF(h),children:(0,D.jsx)(bE.div,{...m,ref:q,style:{position:"absolute",...m.style},onPointerDown:br(a.onPointerDown,a=>{0===a.button&&(a.target.setPointerCapture(a.pointerId),r.current=o.getBoundingClientRect(),s.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",n.viewport&&(n.viewport.style.scrollBehavior="auto"),y(a))}),onPointerMove:br(a.onPointerMove,y),onPointerUp:br(a.onPointerUp,a=>{let b=a.target;b.hasPointerCapture(a.pointerId)&&b.releasePointerCapture(a.pointerId),document.body.style.webkitUserSelect=s.current,n.viewport&&(n.viewport.style.scrollBehavior=""),r.current=null})})})}),qb="ScrollAreaThumb",qc=E.forwardRef((a,b)=>{let{forceMount:c,...d}=a,e=p9(qb,a.__scopeScrollArea);return(0,D.jsx)(b$,{present:c||e.hasThumb,children:(0,D.jsx)(qd,{ref:b,...d})})}),qd=E.forwardRef((a,b)=>{let{__scopeScrollArea:c,style:d,...e}=a,f=pY(qb,c),g=p9(qb,c),{onThumbPositionChange:h}=g,i=bg(b,a=>g.onThumbChange(a)),j=E.useRef(void 0),k=qn(()=>{j.current&&(j.current(),j.current=void 0)},100);return E.useEffect(()=>{let a=f.viewport;if(a){let b=()=>{k(),j.current||(j.current=qm(a,h),h())};return h(),a.addEventListener("scroll",b),()=>a.removeEventListener("scroll",b)}},[f.viewport,k,h]),(0,D.jsx)(bE.div,{"data-state":g.hasThumb?"visible":"hidden",...e,ref:i,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...d},onPointerDownCapture:br(a.onPointerDownCapture,a=>{let b=a.target.getBoundingClientRect(),c=a.clientX-b.left,d=a.clientY-b.top;g.onThumbPointerDown({x:c,y:d})}),onPointerUp:br(a.onPointerUp,g.onThumbPointerUp)})});qc.displayName=qb;var qe="ScrollAreaCorner",qf=E.forwardRef((a,b)=>{let c=pY(qe,a.__scopeScrollArea),d=!!(c.scrollbarX&&c.scrollbarY);return"scroll"!==c.type&&d?(0,D.jsx)(qg,{...a,ref:b}):null});qf.displayName=qe;var qg=E.forwardRef((a,b)=>{let{__scopeScrollArea:c,...d}=a,e=pY(qe,c),[f,g]=E.useState(0),[h,i]=E.useState(0),j=!!(f&&h);return qo(e.scrollbarX,()=>{let a=e.scrollbarX?.offsetHeight||0;e.onCornerHeightChange(a),i(a)}),qo(e.scrollbarY,()=>{let a=e.scrollbarY?.offsetWidth||0;e.onCornerWidthChange(a),g(a)}),j?(0,D.jsx)(bE.div,{...d,ref:b,style:{width:f,height:h,position:"absolute",right:"ltr"===e.dir?0:void 0,left:"rtl"===e.dir?0:void 0,bottom:0,...a.style}}):null});function qh(a){return a?parseInt(a,10):0}function qi(a,b){let c=a/b;return isNaN(c)?0:c}function qj(a){let b=qi(a.viewport,a.content),c=a.scrollbar.paddingStart+a.scrollbar.paddingEnd;return Math.max((a.scrollbar.size-c)*b,18)}function qk(a,b,c="ltr"){let d=qj(b),e=b.scrollbar.paddingStart+b.scrollbar.paddingEnd,f=b.scrollbar.size-e,g=b.content-b.viewport,h=function(a,[b,c]){return Math.min(c,Math.max(b,a))}(a,"ltr"===c?[0,g]:[-1*g,0]);return ql([0,g],[0,f-d])(h)}function ql(a,b){return c=>{if(a[0]===a[1]||b[0]===b[1])return b[0];let d=(b[1]-b[0])/(a[1]-a[0]);return b[0]+d*(c-a[0])}}var qm=(a,b=()=>{})=>{let c={left:a.scrollLeft,top:a.scrollTop},d=0;return!function e(){let f={left:a.scrollLeft,top:a.scrollTop},g=c.left!==f.left,h=c.top!==f.top;(g||h)&&b(),c=f,d=window.requestAnimationFrame(e)}(),()=>window.cancelAnimationFrame(d)};function qn(a,b){let c=bF(a),d=E.useRef(0);return E.useEffect(()=>()=>window.clearTimeout(d.current),[]),E.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(c,b)},[c,b])}function qo(a,b){let c=bF(b);bz(()=>{let b=0;if(a){let d=new ResizeObserver(()=>{cancelAnimationFrame(b),b=window.requestAnimationFrame(c)});return d.observe(a),()=>{window.cancelAnimationFrame(b),d.unobserve(a)}}},[a,c])}let qp=E.forwardRef(({className:a,children:b,...c},d)=>(0,D.jsxs)(pZ,{ref:d,className:bb("relative overflow-hidden",a),...c,children:[(0,D.jsx)(p_,{className:"mission-scroll h-full w-full rounded-[inherit] [&>div]:!block [&>div]:!w-full [&>div]:!min-w-0",children:b}),(0,D.jsx)(qq,{}),(0,D.jsx)(qf,{})]}));qp.displayName=pZ.displayName;let qq=E.forwardRef(({className:a,orientation:b="vertical",...c},d)=>(0,D.jsx)(p1,{ref:d,orientation:b,className:bb("flex touch-none select-none transition-colors","vertical"===b&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===b&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",a),...c,children:(0,D.jsx)(qc,{className:"relative flex-1 rounded-full bg-white/[0.12]"})}));qq.displayName=p1.displayName;let qr={worker:{label:"Worker",description:"Delivers code, docs, research, review, or analysis without mutating the system.",defaultName:"Worker",defaultEmoji:"\uD83D\uDEE0️",defaultTheme:"slate",badgeVariant:"default"},setup:{label:"Setup / Operator",description:"Prepares the environment, installs dependencies, and unblocks other agents.",defaultName:"Setup Operator",defaultEmoji:"\uD83E\uDDF0",defaultTheme:"amber",badgeVariant:"warning"},browser:{label:"Browser",description:"Captures browser evidence, screenshots, and user-path validation inside the workspace.",defaultName:"Browser Agent",defaultEmoji:"\uD83C\uDF10",defaultTheme:"blue",badgeVariant:"success"},monitoring:{label:"Monitoring",description:"Periodically checks workspace health, drift, and blockers, then leaves triage handoffs.",defaultName:"Monitoring Agent",defaultEmoji:"\uD83D\uDEF0️",defaultTheme:"teal",badgeVariant:"warning"},custom:{label:"Custom",description:"Starts from a safe default policy but leaves room for manual overrides.",defaultName:"Custom Agent",defaultEmoji:"\uD83E\uDDE9",defaultTheme:"violet",badgeVariant:"muted"}},qs={worker:{missingToolBehavior:"fallback",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"},setup:{missingToolBehavior:"allow-install",installScope:"workspace",fileAccess:"workspace-only",networkAccess:"enabled"},browser:{missingToolBehavior:"ask-setup",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"},monitoring:{missingToolBehavior:"fallback",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"},custom:{missingToolBehavior:"fallback",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"}},qt=Object.entries(qr).map(([a,b])=>({value:a,label:b.label,description:b.description})),qu=[{value:"fallback",label:"Fallback",description:"Produce the nearest viable output format instead of failing the task."},{value:"ask-setup",label:"Ask for setup",description:"Stop before environment changes and report the missing capability clearly."},{value:"route-setup",label:"Route to setup agent",description:"Leave an explicit setup handoff instead of attempting installs directly."},{value:"allow-install",label:"Allow install",description:"Install missing tooling when policy allows it and the task truly depends on it."}],qv=[{value:"none",label:"None",description:"Do not install workspace or system dependencies."},{value:"workspace",label:"Workspace only",description:"Only install dependencies inside the project or workspace environment."},{value:"system",label:"System",description:"Permit system-wide installs when they are necessary and intentional."}],qw=[{value:"workspace-only",label:"Workspace only",description:"Keep file work grounded inside the attached workspace."},{value:"extended",label:"Extended",description:"Allow broader file access when the task explicitly needs it."}],qx=[{value:"restricted",label:"Off",description:"Avoid network access unless the task explicitly depends on it."},{value:"enabled",label:"On",description:"Use network access when the task needs external information or downloads."}];function qy(a="worker",b){return{...qs[a],...b??{},preset:a}}function qz(a){return qr[a].label}function qA(a){return qu.find(b=>b.value===a)?.label??a}function qB(a){return qv.find(b=>b.value===a)?.label??a}function qC(a){return qw.find(b=>b.value===a)?.label??a}function qD(a){return qx.find(b=>b.value===a)?.label??a}let qE=Symbol.for("constructDateFrom");function qF(a,b){return"function"==typeof a?a(b):a&&"object"==typeof a&&qE in a?a[qE](b):a instanceof Date?new a.constructor(b):new Date(b)}let qG={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function qH(a){return (b={})=>{let c=b.width?String(b.width):a.defaultWidth;return a.formats[c]||a.formats[a.defaultWidth]}}let qI={date:qH({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:qH({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:qH({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},qJ={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function qK(a){return(b,c)=>{let d;if("formatting"===(c?.context?String(c.context):"standalone")&&a.formattingValues){let b=a.defaultFormattingWidth||a.defaultWidth,e=c?.width?String(c.width):b;d=a.formattingValues[e]||a.formattingValues[b]}else{let b=a.defaultWidth,e=c?.width?String(c.width):a.defaultWidth;d=a.values[e]||a.values[b]}return d[a.argumentCallback?a.argumentCallback(b):b]}}function qL(a){return(b,c={})=>{let d,e=c.width,f=e&&a.matchPatterns[e]||a.matchPatterns[a.defaultMatchWidth],g=b.match(f);if(!g)return null;let h=g[0],i=e&&a.parsePatterns[e]||a.parsePatterns[a.defaultParseWidth],j=Array.isArray(i)?function(a,b){for(let c=0;c<a.length;c++)if(b(a[c]))return c}(i,a=>a.test(h)):function(a,b){for(let c in a)if(Object.prototype.hasOwnProperty.call(a,c)&&b(a[c]))return c}(i,a=>a.test(h));return d=a.valueCallback?a.valueCallback(j):j,{value:d=c.valueCallback?c.valueCallback(d):d,rest:b.slice(h.length)}}}let qM={code:"en-US",formatDistance:(a,b,c)=>{let d,e=qG[a];if(d="string"==typeof e?e:1===b?e.one:e.other.replace("{{count}}",b.toString()),c?.addSuffix)if(c.comparison&&c.comparison>0)return"in "+d;else return d+" ago";return d},formatLong:qI,formatRelative:(a,b,c,d)=>qJ[a],localize:{ordinalNumber:(a,b)=>{let c=Number(a),d=c%100;if(d>20||d<10)switch(d%10){case 1:return c+"st";case 2:return c+"nd";case 3:return c+"rd"}return c+"th"},era:qK({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:qK({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:a=>a-1}),month:qK({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:qK({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:qK({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(t={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:a=>parseInt(a,10)},(a,b={})=>{let c=a.match(t.matchPattern);if(!c)return null;let d=c[0],e=a.match(t.parsePattern);if(!e)return null;let f=t.valueCallback?t.valueCallback(e[0]):e[0];return{value:f=b.valueCallback?b.valueCallback(f):f,rest:a.slice(d.length)}}),era:qL({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:qL({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:a=>a+1}),month:qL({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:qL({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:qL({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},qN={};function qO(a){let b=qF(a,a),c=new Date(Date.UTC(b.getFullYear(),b.getMonth(),b.getDate(),b.getHours(),b.getMinutes(),b.getSeconds(),b.getMilliseconds()));return c.setUTCFullYear(b.getFullYear()),a-c}function qP(a){var b,c;return a?`${c={addSuffix:!0},function(a,b,c){var d;let e,f,g=c?.locale??qN.locale??qM,h=(f=qF(a,a)-qF(b,b))<0?-1:f>0?1:f;if(isNaN(h))throw RangeError("Invalid time value");let i=Object.assign({},c,{addSuffix:c?.addSuffix,comparison:h}),[j,k]=function(a,...b){let c=qF.bind(null,a||b.find(a=>"object"==typeof a));return b.map(c)}(c?.in,...h>0?[b,a]:[a,b]),l=(d=c?.roundingMethod??"round",a=>{let b=(d?Math[d]:Math.trunc)(a);return 0===b?0:b}),m=k.getTime()-j.getTime(),n=m/6e4,o=(m-(qO(k)-qO(j)))/6e4,p=c?.unit;if("second"===(e=p||(n<1?"second":n<60?"minute":n<1440?"hour":o<43200?"day":o<525600?"month":"year"))){let a=l(m/1e3);return g.formatDistance("xSeconds",a,i)}if("minute"===e){let a=l(n);return g.formatDistance("xMinutes",a,i)}if("hour"===e){let a=l(n/60);return g.formatDistance("xHours",a,i)}if("day"===e){let a=l(o/1440);return g.formatDistance("xDays",a,i)}if("month"===e){let a=l(o/43200);return 12===a&&"month"!==p?g.formatDistance("xYears",1,i):g.formatDistance("xMonths",a,i)}else{let a=l(o/525600);return g.formatDistance("xYears",a,i)}}(b=a,qF(b,Date.now()),c)}`:"No activity"}function qQ(a){return a?a>=1e3?`${Math.round(a/1e3)}k`:String(a):"n/a"}function qR(a){return"number"!=typeof a?"0":a>=1e3?`${(a/1e3).toFixed(a>=1e4?0:1)}k`:String(a)}function qS(a){return a.split("/").at(1)||a}function qT(a){switch(a){case"running":return"default";case"completed":return"success";case"cancelled":return"danger";case"stalled":return"warning";default:return"muted"}}function qU(a,b=8){return a?a.length<=b?a:a.slice(0,b):"n/a"}function qV(a){return a.replace(/^\/Users\/[^/]+/,"~")}function qW({label:a,onClick:b,danger:c=!1}){return(0,D.jsx)("button",{type:"button",className:bb("flex w-full items-center rounded-[10px] px-2.5 py-2 text-left text-[11px] transition-colors",c?"text-rose-200 hover:bg-rose-400/10 hover:text-rose-100":"text-slate-200 hover:bg-white/[0.06] hover:text-white"),onClick:b,children:(0,D.jsx)("span",{children:a})})}function qX({label:a,value:b}){return(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3 rounded-[10px] bg-white/[0.02] px-2.5 py-1.5",children:[(0,D.jsx)("span",{className:"shrink-0 text-[9px] uppercase tracking-[0.18em] text-slate-500",children:a}),(0,D.jsx)("span",{className:"min-w-0 text-right text-[10px] leading-4 text-slate-100",children:b})]})}let qY=K("corner-down-left",[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]),qZ=K("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),q$=K("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),q_=K("lock-open",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]),q0=K("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),q1=K("folder-open-dot",[["path",{d:"m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.93a2 2 0 0 1 1.66.9l.82 1.2a2 2 0 0 0 1.66.9H18a2 2 0 0 1 2 2v2",key:"1nmvlm"}],["circle",{cx:"14",cy:"15",r:"1",key:"1gm4qj"}]]),q2=K("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var q3=c(8031);let q4=/https?:\/\/[^\s<>"'`)\]]+/g,q5=/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,q6=/(?:^|[\s(])((?:\.{1,2}\/)?(?:deliverables|memory|docs|app|components|lib|public|scripts|packages|hooks|output)\/[^\s`),;]+)/g,q7=/`((?:\/|\.{1,2}\/|deliverables\/|memory\/|docs\/|app\/|components\/|lib\/|public\/|scripts\/|packages\/|hooks\/|output\/)[^`\n]+)`/g;function q8({text:a,className:b,url:c,filePath:d,displayPath:e,compact:f=!1}){let g=function(a,b){let c=new Set;for(let d of(b&&c.add(b),a.matchAll(q4)))d[0]&&c.add(d[0]);return[...c]}(a,c),h=function(a){let b=new Set;for(let c of a.matchAll(q5))c[0]&&b.add(c[0]);return[...b]}(a),i=function(a,b,c){let d=new Map;for(let e of(b&&d.set(b,{path:b,label:c||b}),a.matchAll(q7))){let a=e[1]?.trim();!a||d.has(a)||d.set(a,{path:a,label:a})}for(let b of a.matchAll(q6)){let a=b[1]?.trim();!a||d.has(a)||d.set(a,{path:a,label:a})}return[...d.values()]}(a,d,e);return(0,D.jsxs)("div",{className:bb("space-y-2",f&&"space-y-1.5"),children:[(0,D.jsx)("p",{className:bb("whitespace-pre-wrap break-words",b),children:function(a){let b=Array.from(a.matchAll(q4));if(0===b.length)return a;let c=[],d=0;for(let[e]of b){let b=a.indexOf(e,d);b>d&&c.push(a.slice(d,b)),c.push((0,D.jsx)("a",{href:e,target:"_blank",rel:"noreferrer",className:"text-cyan-100 underline decoration-cyan-200/45 underline-offset-2 transition-colors hover:text-cyan-50 hover:decoration-cyan-100",onClick:a=>a.stopPropagation(),children:e},`${e}:${b}`)),d=b+e.length}return d<a.length&&c.push(a.slice(d)),c}(a)}),g.length>0||h.length>0||i.length>0?(0,D.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[g.map(a=>(0,D.jsxs)("a",{href:a,target:"_blank",rel:"noreferrer",className:bb("inline-flex max-w-full items-center gap-1 rounded-full border border-cyan-300/16 bg-cyan-400/[0.08] px-2 py-1 text-[10px] text-cyan-100 transition-colors hover:border-cyan-200/30 hover:bg-cyan-400/[0.14]",f&&"px-1.5 py-[3px] text-[9px]"),onClick:a=>a.stopPropagation(),children:[(0,D.jsx)(q2,{className:bb("h-3 w-3 shrink-0",f&&"h-2.5 w-2.5")}),(0,D.jsx)("span",{className:"truncate",children:function(a){try{let b=new URL(a);return`${b.hostname}${"/"===b.pathname?"":b.pathname}`}catch{return a}}(a)})]},a)),h.map(a=>(0,D.jsxs)("a",{href:`mailto:${a}`,className:bb("inline-flex max-w-full items-center gap-1 rounded-full border border-sky-300/16 bg-sky-400/[0.08] px-2 py-1 text-[10px] text-sky-50 transition-colors hover:border-sky-200/30 hover:bg-sky-400/[0.14]",f&&"px-1.5 py-[3px] text-[9px]"),onClick:a=>a.stopPropagation(),children:[(0,D.jsx)(q2,{className:bb("h-3 w-3 shrink-0",f&&"h-2.5 w-2.5")}),(0,D.jsx)("span",{className:"truncate",children:a})]},a)),i.map(a=>(0,D.jsxs)("button",{type:"button",className:bb("inline-flex max-w-full items-center gap-1 rounded-full border border-emerald-300/16 bg-emerald-400/[0.08] px-2 py-1 text-[10px] text-emerald-50 transition-colors hover:border-emerald-200/30 hover:bg-emerald-400/[0.14]",f&&"px-1.5 py-[3px] text-[9px]"),onClick:b=>{b.stopPropagation(),q9(a.path)},children:[(0,D.jsx)(q1,{className:bb("h-3 w-3 shrink-0",f&&"h-2.5 w-2.5")}),(0,D.jsx)("span",{className:"truncate",children:qV(a.label)})]},`${a.path}:${a.label}`))]}):null]})}async function q9(a){try{let b=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})}),c=await b.json();if(!b.ok)throw Error(c.error||"Unable to reveal file.");q3.oR.success("Revealed file.",{description:qV(a)})}catch(a){q3.oR.error("Could not reveal file.",{description:a instanceof Error?a.message:"Unknown file reveal error."})}}function ra({icon:a,label:b,value:c,active:d=!1,onClick:e}){return(0,D.jsxs)("button",{type:"button",className:bb("flex min-h-[38px] w-full items-center justify-between rounded-[12px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-2.5 py-1.5 text-left transition-colors hover:border-cyan-300/20 hover:bg-cyan-400/[0.06]",d&&"border-cyan-300/30 bg-cyan-400/[0.08]"),onClick:a=>{a.stopPropagation(),e?.()},onPointerDown:a=>a.stopPropagation(),children:[(0,D.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[9px] uppercase tracking-[0.16em] text-slate-400",children:[(0,D.jsx)(a,{className:"h-3 w-3 shrink-0"}),(0,D.jsx)("span",{className:"truncate",children:b})]}),c?(0,D.jsx)("span",{className:"ml-2 shrink-0 font-mono text-[10px] text-slate-200",children:c}):null]})}function rb({icon:a,label:b,destructive:c=!1,disabled:d=!1,onClick:e}){return(0,D.jsxs)("button",{type:"button",disabled:d,className:bb("flex w-full items-center gap-2 rounded-[10px] px-2.5 py-2 text-left text-[11px] transition-colors",d?"cursor-not-allowed text-slate-500":c?"text-rose-100 hover:bg-rose-400/10 hover:text-rose-50":"text-slate-200 hover:bg-white/[0.06] hover:text-white"),onClick:e,children:[(0,D.jsx)(a,{className:bb("h-3.5 w-3.5",c?"text-rose-300":"text-cyan-300")}),(0,D.jsx)("span",{children:b})]})}function rc(a){let b="string"==typeof a.metadata.dispatchStatus?a.metadata.dispatchStatus:null,c=a.status;return"cancelled"===b||"aborted"===b||"cancelled"===c||"aborted"===c}let rd=K("folder-kanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]),re=K("orbit",[["path",{d:"M20.341 6.484A10 10 0 0 1 10.266 21.85",key:"1enhxb"}],["path",{d:"M3.659 17.516A10 10 0 0 1 13.74 2.152",key:"1crzgf"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}]]),rf=K("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);function rg({icon:a,label:b,value:c}){return(0,D.jsxs)("div",{className:"inline-flex items-center gap-1.5 rounded-full border border-white/[0.06] bg-slate-950/65 px-2.5 py-1 text-slate-300",children:[(0,D.jsx)(a,{className:"h-3 w-3 text-slate-400"}),(0,D.jsx)("span",{className:"workspace-node__metric-label text-[9px] uppercase tracking-[0.16em] text-slate-500",children:b}),(0,D.jsx)("span",{className:"font-display text-[12px] text-white",children:c})]})}let rh={},ri={workspace:function({data:a,selected:b}){return(0,D.jsx)(pS.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:bb("workspace-node h-full rounded-[26px] border border-white/[0.04] bg-[linear-gradient(180deg,rgba(4,11,22,0.18),rgba(4,9,18,0.06))] p-3 text-white backdrop-blur-[2px]",a.emphasis?"opacity-100":"opacity-75",b&&"border-cyan-300/[0.16]"),children:(0,D.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,D.jsxs)("div",{className:"min-w-0 space-y-1.5",children:[(0,D.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-full border border-white/[0.08] bg-slate-950/75 px-2.5 py-1.5 shadow-[0_14px_28px_rgba(0,0,0,0.2)]",children:[(0,D.jsx)("div",{className:"rounded-full border border-white/10 bg-white/[0.06] p-1.5",children:(0,D.jsx)(rd,{className:"h-3 w-3 text-cyan-200"})}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"font-display text-[12px] tracking-[0.04em] text-white",children:a.workspace.name}),(0,D.jsx)("p",{className:"workspace-node__slug text-[9px] uppercase tracking-[0.22em] text-slate-500",children:a.workspace.slug})]})]}),(0,D.jsx)("p",{className:"workspace-node__path max-w-[300px] truncate pl-1 text-[9px] uppercase tracking-[0.16em] text-slate-600",children:qV(a.workspace.path)})]}),(0,D.jsxs)("div",{className:"flex shrink-0 max-w-[48%] flex-wrap items-center justify-end gap-1.5",children:[(0,D.jsx)(bd,{variant:"muted","data-health":a.workspace.health,className:bb("workspace-node__health",function(a){switch(a){case"engaged":return"border-cyan-300/30 bg-cyan-300/14 text-cyan-50";case"monitoring":return"border-emerald-300/30 bg-emerald-300/14 text-emerald-50";case"ready":return"border-amber-300/30 bg-amber-300/14 text-amber-50";case"offline":return"border-rose-300/30 bg-rose-300/14 text-rose-50";default:return"border-white/12 bg-white/[0.07] text-slate-100"}}(a.workspace.health)),children:a.workspace.health}),(0,D.jsxs)("div",{className:"flex flex-wrap justify-end gap-1.5",children:[(0,D.jsx)(rg,{icon:re,label:"Agents",value:String(a.workspace.agentIds.length)}),(0,D.jsx)(rg,{icon:rf,label:"Models",value:String(a.workspace.modelIds.length)}),(0,D.jsx)(rg,{icon:cl,label:"Runs",value:String(a.workspace.activeRuntimeIds.length)})]})]})]})})},agent:function({data:a,selected:b}){let[c,d]=(0,E.useState)(!1),[e,f]=(0,E.useState)(!1),g=(0,E.useRef)(null),h=`agent-details-${a.agent.id}`,i=function(a){switch(a){case"engaged":return"text-cyan-300";case"monitoring":return"text-emerald-300";case"ready":return"text-amber-200";case"offline":return"text-rose-200";default:return"text-slate-400"}}(a.agent.status),j="engaged"===a.agent.status?"bg-cyan-300":"monitoring"===a.agent.status?"bg-emerald-300":"ready"===a.agent.status?"bg-amber-200":"offline"===a.agent.status?"bg-rose-300":"bg-slate-500",k=a.agent.skills.length,l=a.agent.tools,m=a.agent.observedTools??[],n=l.length,o=m.length,p=`${k} skill${1===k?"":"s"}`,q=o>0?`${o} observed tool${1===o?"":"s"}`:n>0?`${n} configured tool${1===n?"":"s"}`:"No tools observed",r=a.agent.heartbeat.enabled?a.agent.heartbeat.every??("number"==typeof a.agent.heartbeat.everyMs?`${Math.round(a.agent.heartbeat.everyMs/1e3)}s`:null):null,s=a.agent.lastActiveAt?qP(a.agent.lastActiveAt):"No recent activity",t=`${qz(a.agent.policy.preset)} \xb7 ${p} \xb7 ${q}`,u=a.agent.lastActiveAt?`${qC(a.agent.policy.fileAccess)} \xb7 Heartbeat ${a.agent.heartbeat.enabled?r??"on":"off"} \xb7 Last active ${s}`:`${qC(a.agent.policy.fileAccess)} \xb7 Heartbeat ${a.agent.heartbeat.enabled?r??"on":"off"} \xb7 ${s}`;return(0,D.jsxs)(pS.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},className:bb("w-[212px] rounded-[16px] border border-white/[0.1] bg-[linear-gradient(180deg,rgba(15,24,40,0.94),rgba(8,13,24,0.94))] px-3 py-2.5 shadow-[0_16px_28px_rgba(0,0,0,0.26)] backdrop-blur-xl",a.emphasis?"opacity-100":"opacity-72",b&&"border-cyan-300/[0.45] shadow-[0_18px_42px_rgba(34,211,238,0.16)]"),children:[(0,D.jsx)(iB,{type:"source",id:"source-right",position:A.Right,className:"!h-2.5 !w-2.5 !border-0 !bg-cyan-300/90 shadow-[0_0_14px_rgba(103,232,249,0.42)]"}),(0,D.jsxs)("div",{className:"flex items-start justify-between gap-2.5",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsxs)("div",{className:"flex items-center gap-1.5 text-[9px] uppercase tracking-[0.22em] text-slate-500",children:[(0,D.jsx)(pT,{tone:j,pulse:"engaged"===a.agent.status||"monitoring"===a.agent.status}),"Agent"]}),(0,D.jsx)("p",{className:"mt-1.5 truncate font-display text-[0.96rem] text-white",children:a.agent.name}),(0,D.jsx)("p",{className:"mt-0.5 truncate text-[10px] uppercase tracking-[0.16em] text-slate-500",children:a.agent.identity.theme??"OpenClaw operator"})]}),(0,D.jsxs)("div",{className:"relative",ref:g,children:[(0,D.jsx)("button",{type:"button","aria-label":`${a.agent.name} actions`,onClick:a=>{a.stopPropagation(),d(a=>!a)},onPointerDown:a=>a.stopPropagation(),className:"inline-flex rounded-full border border-white/[0.08] bg-white/[0.05] p-1.5 text-slate-300 transition-colors hover:bg-white/[0.1] hover:text-white",children:(0,D.jsx)(jE,{className:"h-3.5 w-3.5"})}),c?(0,D.jsxs)("div",{className:"absolute right-0 top-[calc(100%+8px)] z-30 min-w-[136px] rounded-[14px] border border-white/[0.1] bg-slate-950/96 p-1.5 shadow-[0_20px_44px_rgba(0,0,0,0.42)] backdrop-blur-xl",onClick:a=>a.stopPropagation(),onPointerDown:a=>a.stopPropagation(),children:[(0,D.jsx)(qW,{label:"Edit",onClick:()=>{a.onEdit?.(a.agent.id),d(!1)}}),(0,D.jsx)(qW,{label:"Delete",danger:!0,onClick:()=>{a.onDelete?.(a.agent.id),d(!1)}})]}):null]})]}),(0,D.jsxs)("div",{className:"mt-2.5 flex flex-wrap items-center gap-1.5",children:[(0,D.jsx)(bd,{variant:"engaged"===a.agent.status?"default":"monitoring"===a.agent.status?"success":"warning",children:a.agent.status}),(0,D.jsx)(bd,{variant:"muted",className:"max-w-[132px] truncate",children:qS(a.agent.modelId)})]}),(0,D.jsxs)("div",{className:"mt-2.5 border-t border-white/[0.08] pt-2.5",children:[(0,D.jsx)("p",{className:"text-[12px] leading-4 text-slate-100",children:a.agent.currentAction}),(0,D.jsx)("p",{className:bb("mt-1.5 text-[9px] uppercase tracking-[0.2em]",i),children:a.agent.id})]}),(0,D.jsxs)("div",{className:bb("mt-2.5 border-t border-white/[0.08] pt-2.5",e&&"pb-1"),children:[(0,D.jsxs)("button",{type:"button","aria-expanded":e,"aria-controls":h,className:"group flex w-full items-start justify-between gap-3 rounded-[14px] border border-transparent px-1 py-1.5 text-left transition-colors hover:border-white/[0.06] hover:bg-white/[0.02]",onClick:a=>{a.stopPropagation(),f(a=>!a)},onPointerDown:a=>a.stopPropagation(),children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"text-[9px] uppercase tracking-[0.2em] text-slate-500 transition-colors group-hover:text-slate-400",children:"Agent details"}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] text-slate-300",children:t}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] text-slate-500",children:u})]}),(0,D.jsx)("div",{className:"mt-0.5 shrink-0 rounded-full border border-white/[0.08] bg-white/[0.04] p-1 text-slate-400 transition-colors group-hover:border-white/[0.12] group-hover:text-slate-200",children:e?(0,D.jsx)(jF,{className:"h-3 w-3"}):(0,D.jsx)(T,{className:"h-3 w-3"})})]}),e?(0,D.jsx)(pS.div,{id:h,initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden nowheel",onClick:a=>a.stopPropagation(),children:(0,D.jsx)("div",{className:"pt-2.5",children:(0,D.jsx)(qp,{className:"h-[160px] w-full pr-3",children:(0,D.jsxs)("div",{className:"space-y-2.5",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Capabilities"}),(0,D.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.agent.skills.length>0?a.agent.skills.map(a=>(0,D.jsx)(bd,{variant:"muted",className:"max-w-full truncate",children:a},a)):(0,D.jsx)(bd,{variant:"muted",children:"No explicit skills"})})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Declared tools"}),(0,D.jsx)("div",{className:"flex flex-wrap gap-1.5",children:l.length>0?l.map(a=>(0,D.jsx)(bd,{variant:"warning",className:"max-w-full truncate",children:a},a)):(0,D.jsx)(bd,{variant:"muted",children:"No explicit tools configured"})})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Observed tools"}),(0,D.jsx)("div",{className:"flex flex-wrap gap-1.5",children:m.length>0?m.map(a=>(0,D.jsx)(bd,{variant:"default",className:"max-w-full truncate",children:a},a)):(0,D.jsx)(bd,{variant:"muted",children:"No runtime tool calls recovered yet"})})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Permissions"}),(0,D.jsxs)("div",{className:"grid gap-1.5",children:[(0,D.jsx)(qX,{label:"File access",value:qC(a.agent.policy.fileAccess)}),(0,D.jsx)(qX,{label:"Network",value:qD(a.agent.policy.networkAccess)}),(0,D.jsx)(qX,{label:"Install scope",value:qB(a.agent.policy.installScope)}),(0,D.jsx)(qX,{label:"Missing tools",value:qA(a.agent.policy.missingToolBehavior)})]})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Runtime posture"}),(0,D.jsxs)("div",{className:"grid gap-1.5",children:[(0,D.jsx)(qX,{label:"Last active",value:s}),(0,D.jsx)(qX,{label:"Heartbeat",value:a.agent.heartbeat.enabled?r?`On \xb7 ${r}`:"On":"Off"}),(0,D.jsx)(qX,{label:"Sessions",value:String(a.agent.sessionCount)}),(0,D.jsx)(qX,{label:"Active runs",value:String(a.agent.activeRuntimeIds.length)})]})]})]})})})}):null]})]})},task:function({data:a,selected:b}){var c;let d="string"==typeof a.task.metadata.bootstrapStage?a.task.metadata.bootstrapStage:null,e="string"==typeof a.task.metadata.dispatchSubmittedAt?a.task.metadata.dispatchSubmittedAt:null,f=!!a.pendingCreation,g=!!a.justCreated,h=rc(a.task),i=function(a){if(rc(a))return!1;let b=a.status;return"running"===b||"queued"===b}(a.task),j=h?"text-rose-200":function(a){switch(a){case"running":return"text-cyan-300";case"completed":return"text-emerald-300";case"cancelled":return"text-rose-300";case"stalled":case"queued":return"text-amber-200";default:return"text-slate-400"}}(a.task.status),[k,l]=(0,E.useState)(!1),m=(0,E.useRef)(null),n=f?"warning":h?"danger":qT(a.task.status),o=function(a,b,c,d){if(d)return"aborted";if(!c||!a)return b;switch(a){case"submitting":return"submitting";case"accepted":return"accepted";case"waiting-for-heartbeat":return"starting runner";case"waiting-for-runtime":return"awaiting runtime";case"runtime-observed":return"going live";case"stalled":return"stalled";case"completed":return"completed";default:return b}}(d,a.task.status,f,h),p=function(a,b,c){if(c)return"dispatch aborted";switch(a){case"submitting":return"contacting dispatcher";case"accepted":return"dispatch accepted";case"waiting-for-heartbeat":return"waiting for first heartbeat";case"waiting-for-runtime":return"waiting for first OpenClaw runtime";case"runtime-observed":return"runtime observed";case"stalled":return"dispatch stalled";default:return b>0?`${b} live run${1===b?"":"s"}`:"no live runs right now"}}(d,a.task.liveRunCount,h),q=Array.isArray(a.task.metadata.optimisticEvents)?a.task.metadata.optimisticEvents:[],r=q.length>0&&"object"==typeof(c=q[q.length-1])&&null!==c&&"string"==typeof c.id&&"string"==typeof c.title&&"string"==typeof c.detail?q[q.length-1]:null,s=f?function(a){if(!a)return null;let b=Date.parse(a);if(Number.isNaN(b))return null;let c=Math.floor(Math.max(Date.now()-b,0)/1e3);if(c<60)return`${c}s`;let d=Math.floor(c/60),e=c%60;return 0===e?`${d}m`:`${d}m ${e}s`}(e):null,[t,u]=(0,E.useState)(!1),{feed:v,loading:w,error:x}=function(a,b){let[c,d]=(0,E.useState)({taskId:null,feed:[]}),[e,f]=(0,E.useState)(null),[g,h]=(0,E.useState)({taskId:null,message:null}),i=c.taskId===a?c.feed:[],j=g.taskId===a?g.message:null;return{feed:i,loading:b&&e!==a&&null===j,error:j}}(a.task.id,t),y=v[v.length-1]??r??null,z=y?.title||p,B=y?.detail||(f?[p,s?`${s} elapsed`:null].filter(Boolean).join(" \xb7 "):a.task.subtitle||p),C=v.length>0?String(v.length):void 0,F=`task-feed-${a.task.id}`;return(0,D.jsxs)(pS.div,{initial:f?{opacity:0,scale:.92,y:-10}:g?{opacity:0,scale:.96,y:10}:{opacity:0,x:10},animate:f?{opacity:1,scale:1,y:0}:g?{opacity:1,scale:[1,1.015,1],y:0}:{opacity:1,x:0},transition:g?{duration:.7,times:[0,.45,1]}:void 0,className:bb("relative w-[272px] overflow-hidden rounded-[20px] border border-white/[0.1] bg-[linear-gradient(180deg,rgba(15,24,40,0.96),rgba(8,13,24,0.96))] p-3.5 shadow-[0_18px_36px_rgba(0,0,0,0.28)] backdrop-blur-xl",a.emphasis?"opacity-100":"opacity-72",b&&"border-cyan-300/[0.45] shadow-[0_20px_46px_rgba(34,211,238,0.16)]",f&&"border-cyan-300/30 shadow-[0_24px_54px_rgba(34,211,238,0.2)]",g&&"border-cyan-200/40 shadow-[0_24px_56px_rgba(125,211,252,0.18)]",h&&"border-rose-300/30 shadow-[0_24px_54px_rgba(244,63,94,0.14)]","completed"===a.task.status&&!h&&!f&&!g&&"border-white/[0.06] bg-[linear-gradient(180deg,rgba(13,18,30,0.9),rgba(8,12,22,0.9))]"),children:[f?(0,D.jsx)(pS.div,{className:"pointer-events-none absolute inset-[-16px] rounded-[24px] border border-cyan-200/16",animate:{opacity:[.18,.42,.18],scale:[.985,1.02,.985]},transition:{duration:1.8,repeat:1/0,ease:"easeInOut"}}):null,(0,D.jsx)(iB,{type:"target",id:"target-left",position:A.Left,className:"!h-2.5 !w-2.5 !border-0 !bg-white/35"}),(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsxs)("div",{className:"flex items-center gap-1.5 text-[9px] uppercase tracking-[0.22em] text-slate-500",children:[(0,D.jsx)(pT,{tone:f?"bg-cyan-300":h?"bg-rose-200":"stalled"===a.task.status?"bg-amber-200":"completed"===a.task.status?"bg-emerald-300":"running"===a.task.status?"bg-cyan-300":"bg-amber-200"}),f?"Task bootstrap":"Task"]}),(0,D.jsx)("p",{className:"mt-1.5 line-clamp-2 font-display text-[1rem] leading-5 text-white",children:a.task.title}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.16em] text-slate-500",children:a.task.primaryAgentName||"OpenClaw"})]}),(0,D.jsxs)("div",{className:"relative",ref:m,children:[(0,D.jsx)("button",{type:"button","aria-label":"Task actions",onClick:a=>{a.stopPropagation(),l(a=>!a)},onPointerDown:a=>a.stopPropagation(),className:"inline-flex rounded-full border border-white/[0.08] bg-white/[0.05] p-1.5 text-slate-300 transition-colors hover:bg-white/[0.1] hover:text-white",children:(0,D.jsx)(jE,{className:"h-3 w-3"})}),k?(0,D.jsxs)("div",{className:"absolute right-0 top-[calc(100%+8px)] z-30 min-w-[148px] rounded-[14px] border border-white/[0.1] bg-slate-950/96 p-1.5 shadow-[0_20px_44px_rgba(0,0,0,0.42)] backdrop-blur-xl",onClick:a=>a.stopPropagation(),onPointerDown:a=>a.stopPropagation(),children:[(0,D.jsx)(rb,{icon:qY,label:"Use prompt",onClick:()=>{a.onReply?.(a.task),l(!1)}}),(0,D.jsx)(rb,{icon:V,label:"Copy mission",onClick:()=>{a.onCopyPrompt?.(a.task),l(!1)}}),(0,D.jsx)(rb,{icon:qZ,label:"Hide",onClick:()=>{a.onHide?.(a.task),l(!1)}}),a.onAbortTask&&(i||h)?(0,D.jsx)(rb,{icon:q$,label:h?"Aborted":"Abort task",destructive:!0,disabled:!i,onClick:()=>{i&&(a.onAbortTask?.(a.task),l(!1))}}):null,(0,D.jsx)(rb,{icon:a.locked?q_:Y,label:a.locked?"Unlock":"Lock",onClick:()=>{a.onToggleLock?.(a.task),l(!1)}})]}):null]})]}),(0,D.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:[(0,D.jsx)(bd,{variant:n,children:o}),a.task.warningCount>0?(0,D.jsxs)(bd,{variant:"warning",children:[a.task.warningCount," review",1===a.task.warningCount?"":"s"]}):null,g?(0,D.jsxs)(bd,{variant:"default",className:"gap-1 border-cyan-100/20 bg-cyan-100/12 text-cyan-50",children:[(0,D.jsx)(cl,{className:"h-3 w-3"}),"new"]}):null,(0,D.jsxs)("span",{className:bb("text-[9px] uppercase tracking-[0.18em]",j),children:[qR(a.task.tokenUsage?.total)," tokens"]})]}),(0,D.jsx)("div",{className:"mt-3 rounded-[16px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:(0,D.jsx)("p",{className:"line-clamp-2 text-[12.5px] leading-5 text-slate-100",children:a.task.subtitle})}),(0,D.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-1.5",children:[(0,D.jsx)(ra,{icon:q0,label:"Feed",value:C,active:t,onClick:()=>{a.onInspect?a.onInspect(a.task,"output"):u(a=>!a)}}),(0,D.jsx)(ra,{icon:q1,label:"Runs",value:String(a.task.runtimeCount),onClick:()=>a.onInspect?.(a.task,"overview")}),(0,D.jsx)(ra,{icon:cl,label:"Files",value:String(a.task.artifactCount),onClick:()=>a.onInspect?.(a.task,"files")})]}),(0,D.jsxs)("div",{className:bb("mt-3 border-t border-white/[0.08] pt-2.5",t&&"pb-1"),children:[(0,D.jsxs)("button",{type:"button","aria-expanded":t,"aria-controls":F,className:"group flex w-full items-start justify-between gap-3 rounded-[14px] border border-transparent px-1 py-1.5 text-left transition-colors hover:border-white/[0.06] hover:bg-white/[0.02]",onClick:a=>{a.stopPropagation(),u(a=>!a)},onPointerDown:a=>a.stopPropagation(),children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"text-[9px] uppercase tracking-[0.2em] text-slate-500 transition-colors group-hover:text-slate-400",children:"Live feed"}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] text-slate-300",children:z}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] text-slate-500",children:B})]}),(0,D.jsx)("div",{className:"mt-0.5 shrink-0 rounded-full border border-white/[0.08] bg-white/[0.04] p-1 text-slate-400 transition-colors group-hover:border-white/[0.12] group-hover:text-slate-200",children:t?(0,D.jsx)(jF,{className:"h-3 w-3"}):(0,D.jsx)(T,{className:"h-3 w-3"})})]}),t&&(0,D.jsx)(pS.div,{id:F,initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden nowheel",onClick:a=>a.stopPropagation(),children:(0,D.jsx)("div",{className:"pt-2.5",children:(0,D.jsx)(qp,{className:"h-[164px] w-full pr-3",children:w&&0===v.length?(0,D.jsx)("div",{className:"py-4 text-center text-[10px] text-slate-500",children:"Connecting to feed..."}):x&&0===v.length?(0,D.jsx)("div",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[10px] leading-5 text-amber-100",children:x}):0===v.length?(0,D.jsx)("div",{className:"py-4 text-center text-[10px] text-slate-500",children:"No events yet."}):(0,D.jsx)("div",{className:"flex flex-col gap-2.5",children:v.map(a=>(0,D.jsxs)("div",{className:"group/item relative pl-3",children:[(0,D.jsx)("div",{className:bb("absolute left-0 top-1.5 h-1.5 w-1.5 rounded-full",function(a,b){if(b)return"bg-red-400";switch(a){case"status":return"bg-slate-400";case"assistant":return"bg-cyan-400";case"tool":return"bg-indigo-400";case"artifact":return"bg-emerald-400";case"warning":return"bg-amber-400";case"user":return"bg-pink-400";default:return"bg-slate-500"}}(a.kind,a.isError))}),(0,D.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,D.jsx)("span",{className:"text-[10px] font-medium text-slate-300",children:a.title}),(0,D.jsx)("span",{className:"shrink-0 text-[9px] text-slate-600",children:function(a){try{return new Date(a).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return""}}(a.timestamp)})]}),(0,D.jsx)("div",{className:"mt-0.5",children:(0,D.jsx)(q8,{text:a.detail,className:"text-[10px] leading-relaxed text-slate-400 group-hover/item:text-slate-300",url:"url"in a?a.url:null,filePath:"filePath"in a?a.filePath:null,displayPath:"displayPath"in a?a.displayPath:null,compact:!0})})]},a.id))})})})})]})]})}};function rj({snapshot:a,activeWorkspaceId:b,selectedNodeId:c,recentDispatchId:d,hiddenRuntimeIds:e,hiddenTaskKeys:f,lockedTaskKeys:g,onEditAgent:h,onDeleteAgent:i,onReplyTask:j,onCopyTaskPrompt:k,onHideTask:l,onToggleTaskLock:m,onAbortTask:n,onInspectTask:o,onSelectNode:p,className:q}){var r,s,t,u,v,w,x,y,z,A,B,C,F,G,H;let I,J,K,L,M,N=(0,E.useRef)(null),O=(0,E.useRef)(null);(0,E.useRef)(new Set),(0,E.useRef)(new Map),(0,E.useRef)({}),(0,E.useRef)(!1),(0,E.useRef)(!1),(0,E.useRef)(!1);let[P,Q]=(0,E.useState)([]),[R,S]=(0,E.useState)(null),T=(r=a,s=b,t=P,u=e,v=f,w=g,x=h,y=i,z=j,A=k,B=l,C=m,F=n,G=o,H=rh,I=s?r.workspaces.filter(a=>a.id===s):[...r.workspaces].sort((a,b)=>b.activeRuntimeIds.length-a.activeRuntimeIds.length),J=[],K=[],L=[],I.forEach((a,b)=>{let c=r.agents.filter(b=>b.workspaceId===a.id),d=r.tasks.filter(b=>{var c,d,e;return b.workspaceId===a.id&&(c=b,d=u,e=v,!(!w.includes(c.key)&&(e.includes(c.key)||0!==c.runtimeIds.length&&c.runtimeIds.every(a=>d.includes(a)))))}),e=b%2*1160+44,f=920*Math.floor(b/2)+42,g=e+52,h=e+390,i=f+118;c.forEach((b,c)=>{var e,f;let j=d.filter(a=>{var c;return((c=a).primaryAgentId||c.agentIds[0]||null)===b.id}).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),k=i+4*c;K.push({id:b.id,type:"agent",draggable:!0,position:rk((e=b,`agent:${e.workspaceId}:${e.id}`),{x:g,y:k},H,(f=b.id,`agent:${f}`)),zIndex:10,selected:!1,data:{agent:b,emphasis:!s||s===a.id,onEdit:x,onDelete:y}}),L.push(...j),j.forEach((b,c)=>{var d,e;let f="string"==typeof b.metadata.bootstrapStage?b.metadata.bootstrapStage:null,g="submitting"===f||"accepted"===f||"waiting-for-heartbeat"===f||"waiting-for-runtime"===f||"runtime-observed"===f,i=t.includes(b.id);K.push({id:b.id,type:"task",draggable:!0,selectable:!0,position:rk((d=b,`task:${d.workspaceId||"global"}:${d.key}`),{x:h,y:k+152*c+10},H,(e=b.id,`task:${e}`)),zIndex:g?40:i?28:10,selected:!1,data:{task:b,emphasis:!s||s===a.id,pendingCreation:g,justCreated:i,locked:w.includes(b.key),onReply:z,onCopyPrompt:A,onHide:B,onToggleLock:C,onAbortTask:F,onInspect:G}})}),i+=Math.max(152,152*j.length+44)}),J.push({id:a.id,type:"workspace",draggable:!1,position:{x:e,y:f},zIndex:0,style:{width:1060,height:Math.max(i-f+112,700)},selectable:!0,selected:!1,data:{workspace:a,emphasis:!s||s===a.id}})}),{nodes:M=[...J,...K],edges:function(a,b){let c=[],d=new Map(b.map(a=>[a.id,a]));for(let b of a){if(!b.primaryAgentId)continue;let a=d.get(b.primaryAgentId),e=d.get(b.id);a&&e&&c.push({id:`edge:${b.primaryAgentId}:${b.id}`,source:b.primaryAgentId,target:b.id,sourceHandle:"source-right",targetHandle:"target-left",type:"simplebezier",zIndex:4,animated:"running"===b.status,style:{stroke:"running"===b.status?"rgba(107, 190, 255, 0.85)":"rgba(148, 163, 184, 0.28)",strokeWidth:"running"===b.status?1.45:1.05}})}return c}(L,M)}),[U,V,W]=function(a){let[b,c]=(0,E.useState)(a),d=(0,E.useCallback)(a=>c(b=>h7(a,b)),[]);return[b,c,d]}(T.nodes),[X,Y,Z]=function(a){let[b,c]=(0,E.useState)(a),d=(0,E.useCallback)(a=>c(b=>h7(a,b)),[]);return[b,c,d]}(T.edges);return(0,D.jsx)("div",{ref:N,className:bb("h-full w-full",q),children:(0,D.jsx)(jz,{nodes:U,edges:X,nodeTypes:ri,onInit:a=>{O.current=a},elevateNodesOnSelect:!1,onNodesChange:W,onEdgesChange:Z,onNodeClick:(a,b)=>p(b.id),fitView:!0,fitViewOptions:{padding:.14,duration:700,maxZoom:.9},minZoom:.42,maxZoom:1.2,defaultEdgeOptions:{type:"simplebezier",style:{stroke:"rgba(148, 163, 184, 0.34)",strokeWidth:1.15}},proOptions:{hideAttribution:!0},className:"h-full w-full rounded-[inherit]"})})}function rk(a,b,c,d){let e=c[a]||(d?c[d]:void 0);return e?{x:e.x,y:e.y}:b}let rl=K("send-horizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]),rm=K("refresh-ccw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]),rn=K("sliders-horizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]),ro="u">typeof window?E.useLayoutEffect:E.useEffect;function rp(a,b){if("function"==typeof a)return a(b);null!=a&&(a.current=b)}class rq extends E.Component{getSnapshotBeforeUpdate(a){let b=this.props.childRef.current;if(b&&a.isPresent&&!this.props.isPresent&&!1!==this.props.pop){let a=b.offsetParent,c=pD(a)&&a.offsetWidth||0,d=pD(a)&&a.offsetHeight||0,e=this.props.sizeRef.current;e.height=b.offsetHeight||0,e.width=b.offsetWidth||0,e.top=b.offsetTop,e.left=b.offsetLeft,e.right=c-e.width-e.left,e.bottom=d-e.height-e.top}return null}componentDidUpdate(){}render(){return this.props.children}}function rr({children:a,isPresent:b,anchorX:c,anchorY:d,root:e,pop:f}){let g=(0,E.useId)(),h=(0,E.useRef)(null),i=(0,E.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:j}=(0,E.useContext)(ml),k=function(...a){return E.useCallback(function(...a){return b=>{let c=!1,d=a.map(a=>{let d=rp(a,b);return c||"function"!=typeof d||(c=!0),d});if(c)return()=>{for(let b=0;b<d.length;b++){let c=d[b];"function"==typeof c?c():rp(a[b],null)}}}}(...a),a)}(h,a.props?.ref??a?.ref);return(0,E.useInsertionEffect)(()=>{let{width:a,height:k,top:l,left:m,right:n,bottom:o}=i.current;if(b||!1===f||!h.current||!a||!k)return;let p="left"===c?`left: ${m}`:`right: ${n}`,q="bottom"===d?`bottom: ${o}`:`top: ${l}`;h.current.dataset.motionPopId=g;let r=document.createElement("style");j&&(r.nonce=j);let s=e??document.head;return s.appendChild(r),r.sheet&&r.sheet.insertRule(`
5
+ For more information, see https://radix-ui.com/primitives/docs/components/${b.docsSlug}`;return E.useEffect(()=>{a&&(document.getElementById(a)||console.error(c))},[c,a]),null},dY=({contentRef:a,descriptionId:b})=>{let c=dW("DialogDescriptionWarning"),d=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${c.contentName}}.`;return E.useEffect(()=>{let c=a.current?.getAttribute("aria-describedby");b&&c&&(document.getElementById(b)||console.warn(d))},[d,a,b]),null};let dZ=K("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),d$=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)(dF,{ref:c,className:bc("fixed inset-0 z-50 bg-slate-950/75 backdrop-blur-md",a),...b}));d$.displayName=dF.displayName;let d_=E.forwardRef(({className:a,children:b,...c},d)=>(0,D.jsxs)(dD,{children:[(0,D.jsx)(d$,{}),(0,D.jsxs)(dJ,{ref:d,className:bc("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-[28px] border border-white/10 bg-slate-950/90 p-6 shadow-panel backdrop-blur-xl duration-200",a),...c,children:[b,(0,D.jsxs)(dS,{className:"absolute right-4 top-4 rounded-full p-2 text-slate-400 transition-colors hover:bg-white/5 hover:text-white",children:[(0,D.jsx)(dZ,{className:"h-4 w-4"}),(0,D.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));d_.displayName=dJ.displayName;let d0=({className:a,...b})=>(0,D.jsx)("div",{className:bc("flex flex-col space-y-2 text-left",a),...b}),d1=({className:a,...b})=>(0,D.jsx)("div",{className:bc("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",a),...b}),d2=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)(dO,{ref:c,className:bc("font-display text-xl text-white",a),...b}));d2.displayName=dO.displayName;let d3=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)(dQ,{ref:c,className:bc("text-sm text-slate-400",a),...b}));d3.displayName=dQ.displayName;let d4=[{id:"openai-codex",label:"ChatGPT",shortLabel:"ChatGPT",description:"Connect your ChatGPT account and pull in Codex-ready models.",category:"primary",connectKind:"oauth",accent:"from-[#d8f5eb] via-[#ebfbf5] to-white",helperText:"Account-based login with the OpenClaw provider flow."},{id:"openrouter",label:"OpenRouter",shortLabel:"OpenRouter",description:"Add an API key, discover the full catalog, and curate the models you want.",category:"primary",connectKind:"apiKey",accent:"from-[#fff2d7] via-[#fff7ea] to-white",helperText:"Best for broad model access and curated remote routes.",searchPlaceholder:"Search OpenRouter models"},{id:"ollama",label:"Ollama Local",shortLabel:"Ollama",description:"Discover models already available on this machine and add them instantly.",category:"primary",connectKind:"local",accent:"from-[#deefff] via-[#f2f8ff] to-white",helperText:"Local-first discovery with helpful pull commands when empty."},{id:"anthropic",label:"Anthropic",shortLabel:"Anthropic",description:"Paste an API key and add Claude models through the same flow.",category:"other",connectKind:"apiKey",accent:"from-[#efe9ff] via-[#f7f3ff] to-white",helperText:"Simple API key connection."},{id:"openai",label:"OpenAI API",shortLabel:"OpenAI",description:"Connect a standard OpenAI API key for direct GPT model access.",category:"other",connectKind:"apiKey",accent:"from-[#e8f8e8] via-[#f4fbf4] to-white",helperText:"Use this for API-key-based OpenAI routing."},{id:"xai",label:"xAI",shortLabel:"xAI",description:"Use an xAI API key to bring Grok models into AgentOS.",category:"other",connectKind:"apiKey",accent:"from-[#ffe6ea] via-[#fff3f5] to-white",helperText:"Simple API key connection."}],d5=d4.filter(a=>"primary"===a.category),d6=d4.filter(a=>"other"===a.category);function d7(a){let b=d4.find(b=>b.id===a);if(!b)throw Error(`Unknown model provider: ${a}`);return b}function d8(a){return"string"==typeof a&&d4.some(b=>b.id===a)}function d9(a){if(d8(a))return a;if(a&&"object"==typeof a&&"id"in a){let b=a.id;if(d8(b))return b}return null}async function ea(a){let b=await fetch("/api/models/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json().catch(()=>null);if(!b.ok||!c)throw Error(c?.error||c?.message||"Model provider request failed.");if(!c.ok&&c.message)throw Error(c.message);return c}let eb=Object.fromEntries(d4.map(a=>{var b;return[a.id,{id:b=a.id,descriptor:d7(b),getConnectionStatus:()=>ea({action:"status",provider:b}),connect:a=>ea({action:"connect",provider:b,apiKey:a?.apiKey?.trim()?a.apiKey.trim():void 0,endpoint:a?.endpoint?.trim()?a.endpoint.trim():void 0}),discoverModels:()=>ea({action:"discover",provider:b}),addModels:a=>ea({action:"add-models",provider:b,modelIds:a})}]}));var ec=c(3081);let ed=()=>({flowState:"idle",connection:null,statusMessage:null,errorMessage:null,emptyState:null,manualCommand:null,docsUrl:null,models:[],selectedModelIds:[],apiKey:"",search:"",loaded:!1});function ee({open:a,onOpenChange:b,snapshot:c,initialProvider:d=null,onSnapshotChange:e}){var f,g;let h,i,j,k,l=d9(d),[m,n]=(0,E.useState)(l),[o,p]=(0,E.useState)(!1),[q,r]=(0,E.useState)({}),[s,t]=(0,E.useState)(!1);(0,E.useEffectEvent)(a=>{x(a)});let u=d8(m)?m:null,v=u&&q[u]||ed(),w=u?d7(u):null;async function x(a){if(n(a),"ollama"!==a){(q[a]||ed()).loaded||await y(a);return}await A(a,!0)}async function y(a){let b=eb[a];G(a,{flowState:"idle",errorMessage:null});try{let c=await b.getConnectionStatus();H(a,c,c.emptyState?"discovery-empty":"idle")}catch(b){G(a,{flowState:"auth-error",errorMessage:b instanceof Error?b.message:"Provider status could not be loaded.",loaded:!0})}}async function z(a){let b=eb[a],c=q[a]||ed();G(a,{flowState:"connecting",errorMessage:null,statusMessage:"openai-codex"===a?"Opening the ChatGPT connection flow...":`Connecting ${d7(a).shortLabel}...`});try{let d=await b.connect({apiKey:c.apiKey});H(a,d,"openai-codex"===a?"connecting":d.models.length?"discovery-success":"idle"),d.snapshot&&e(d.snapshot),"openai-codex"!==a&&"ollama"!==a&&await A(a)}catch(b){G(a,{flowState:"auth-error",errorMessage:b instanceof Error?b.message:"Provider connection failed."})}}async function A(a,b=!1){let c=eb[a],d=q[a]||ed();if(b||"discovery-loading"!==d.flowState){G(a,{flowState:"discovery-loading",errorMessage:null,statusMessage:"ollama"===a?"Checking the local Ollama runtime...":"Discovering available models..."});try{let b=await c.discoverModels();H(a,b,b.models.length>0?"discovery-success":b.emptyState?"discovery-empty":"idle"),b.snapshot&&e(b.snapshot)}catch(b){G(a,{flowState:"auth-error",errorMessage:b instanceof Error?b.message:"Model discovery failed."})}}}async function B(a){let b=eb[a],c=q[a]||ed(),d=c.selectedModelIds.filter(a=>!c.models.find(b=>b.id===a)?.alreadyAdded);if(0!==d.length){G(a,{flowState:"connecting",errorMessage:null,statusMessage:"Adding selected models..."});try{let c=await b.addModels(d);H(a,c,"add-success",{selectedModelIds:[]}),c.snapshot&&e(c.snapshot),ec.o.success("Models added.",{description:c.message})}catch(b){G(a,{flowState:"add-error",errorMessage:b instanceof Error?b.message:"Models could not be added."})}}}async function C(a){try{t(!0);let b=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:a})}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||"Terminal could not be opened.");ec.o.success("Terminal opened.",{description:"Finish the provider login there, then return here to discover models."})}catch(a){ec.o.error("Unable to open Terminal.",{description:a instanceof Error?a.message:"Unknown terminal error."})}finally{t(!1)}}async function F(a){try{await navigator.clipboard.writeText(a),ec.o.success("Copied.",{description:"Command copied to your clipboard."})}catch{ec.o.error("Copy failed.",{description:"Clipboard access is not available."})}}function G(a,b){r(c=>({...c,[a]:{...c[a]||ed(),...b}}))}function H(a,b,c,d){G(a,{flowState:c,connection:b.connection,statusMessage:b.message,errorMessage:null,emptyState:b.emptyState??null,manualCommand:b.manualCommand??null,docsUrl:b.docsUrl??null,models:b.models,loaded:!0,...d})}return(0,D.jsx)(dx,{open:a,onOpenChange:b,children:(0,D.jsxs)(d_,{className:"flex h-[88dvh] max-h-[88dvh] w-[calc(100vw-20px)] max-w-[940px] flex-col gap-0 overflow-hidden p-0 sm:h-[min(88dvh,860px)] sm:max-h-[min(88dvh,860px)] sm:w-[min(940px,calc(100vw-40px))]",children:[(0,D.jsxs)(d0,{className:"shrink-0 border-b border-white/10 bg-[linear-gradient(180deg,rgba(12,18,31,0.96),rgba(9,13,24,0.98))] px-6 py-5 pr-14",children:[(0,D.jsx)(d2,{className:"text-[1.35rem]",children:"Add Models"}),(0,D.jsx)(d3,{className:"max-w-[560px] text-[13px] leading-6 text-slate-400",children:"Connect a provider, discover available models, and add them in seconds."})]}),(0,D.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:(0,D.jsxs)("div",{className:"space-y-6 px-5 py-5 sm:px-6 sm:py-6",children:[(0,D.jsx)("div",{className:"grid gap-4 lg:grid-cols-3",children:d5.map(a=>(0,D.jsx)(cr,{descriptor:a,active:u===a.id,connected:eg(c,q,a.id).connected,detail:eg(c,q,a.id).detail,onClick:()=>{x(a.id)}},a.id))}),(0,D.jsxs)("div",{className:"rounded-[28px] border border-white/10 bg-[linear-gradient(180deg,rgba(13,20,34,0.94),rgba(9,13,24,0.96))]",children:[(0,D.jsxs)("button",{type:"button",onClick:()=>p(a=>!a),className:"flex w-full items-center justify-between gap-3 px-4 py-3.5 text-left",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"font-display text-[0.95rem] text-white",children:"Other providers"}),(0,D.jsx)("p",{className:"mt-1 text-[11px] leading-5 text-slate-400",children:"Simpler API-key setup for additional provider routes."})]}),(0,D.jsx)(U,{className:bc("h-4 w-4 text-slate-400 transition-transform",o?"rotate-180":"rotate-0")})]}),o?(0,D.jsx)("div",{className:"grid gap-3 border-t border-white/10 px-4 py-4 md:grid-cols-2 xl:grid-cols-3",children:d6.map(a=>(0,D.jsx)(cr,{descriptor:a,active:u===a.id,compact:!0,connected:eg(c,q,a.id).connected,detail:eg(c,q,a.id).detail,onClick:()=>{x(a.id)}},a.id))}):null]}),(0,D.jsx)("div",{className:"rounded-[28px] border border-white/10 bg-[linear-gradient(180deg,rgba(11,18,32,0.96),rgba(6,10,18,0.98))] p-4 sm:p-5",children:u&&w?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"font-display text-[1rem] text-white",children:w.label}),(0,D.jsx)("p",{className:"mt-1 max-w-[620px] text-[12px] leading-6 text-slate-400",children:"oauth"===w.connectKind?"Use your account login, then discover the models that are ready to add.":"local"===w.connectKind?"Check the local runtime first, then add the models already available on this machine.":"Connect the provider, review the discovered catalog, and add only the models you want."})]}),(0,D.jsx)(be,{variant:v.connection?.connected?"success":"muted",children:v.connection?.connected?"Connected":"Not connected"})]}),(0,D.jsx)("div",{className:"mt-5 flex flex-wrap gap-2",children:(f=u,g=v,h="ollama"===f?!!(g.connection?.connected||g.emptyState):!!(g.connection?.connected||g.manualCommand),i=g.models.length>0||!!g.emptyState,j=g.selectedModelIds.length>0,k="add-success"===g.flowState,[{label:"Choose provider",status:"done"},{label:"ollama"===f?"Local check":"Connect",status:"connecting"!==g.flowState||h?h?"done":"pending":"active"},{label:"Discover",status:"discovery-loading"===g.flowState?"active":i?"done":"pending"},{label:"Select",status:k?"done":j?"active":"pending"},{label:"Add",status:k?"done":"add-error"===g.flowState?"active":"pending"}]).map(a=>(0,D.jsxs)("div",{className:bc("inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-[11px] uppercase tracking-[0.18em]","done"===a.status?"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":"active"===a.status?"border-cyan-300/20 bg-cyan-300/10 text-cyan-100":"border-white/10 bg-white/[0.03] text-slate-500"),children:[(0,D.jsx)("span",{className:bc("h-2 w-2 rounded-full","done"===a.status?"bg-emerald-300":"active"===a.status?"bg-cyan-300":"bg-slate-600")}),a.label]},a.label))}),v.statusMessage?(0,D.jsx)("div",{className:"mt-5 rounded-[22px] border border-white/10 bg-white/[0.04] px-4 py-3",children:(0,D.jsx)("p",{className:"text-[13px] text-slate-200",children:v.statusMessage})}):null,v.errorMessage?(0,D.jsx)("div",{className:"mt-4 rounded-[22px] border border-rose-400/20 bg-rose-400/[0.08] px-4 py-3 text-[13px] text-rose-100",children:v.errorMessage}):null,"openai-codex"===u?(0,D.jsxs)("div",{className:"mt-6 rounded-[28px] border border-white/10 bg-white/[0.03] p-5",children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"font-display text-[1rem] text-white",children:"Connect your ChatGPT account"}),(0,D.jsx)("p",{className:"mt-1 max-w-[560px] text-[13px] leading-6 text-slate-400",children:"This uses OpenClaw's account-based login flow. No API key is required."})]}),(0,D.jsx)(bq,{type:"button",className:"h-10 rounded-full px-5",disabled:"connecting"===v.flowState&&!v.manualCommand,onClick:()=>{z(u)},children:"connecting"!==v.flowState||v.manualCommand?"Connect ChatGPT":(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(N,{className:"mr-2 h-4 w-4 animate-spin"}),"Connecting..."]})})]}),v.manualCommand?(0,D.jsxs)("div",{className:"mt-5 rounded-[22px] border border-cyan-300/15 bg-cyan-300/[0.07] p-4",children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-[13px] font-medium text-cyan-50",children:"Finish sign-in in Terminal"}),(0,D.jsx)("p",{className:"mt-1 max-w-[560px] text-[12px] leading-6 text-cyan-100/80",children:"Open Terminal, complete the provider login, then return here and check discovery."})]}),(0,D.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,D.jsx)(bq,{type:"button",variant:"secondary",size:"sm",className:"h-9 rounded-full px-3",disabled:s,onClick:()=>{C(v.manualCommand||"")},children:s?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(N,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Opening..."]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(V,{className:"mr-1.5 h-3.5 w-3.5"}),"Open Terminal"]})}),(0,D.jsxs)(bq,{type:"button",variant:"ghost",size:"sm",className:"h-9 rounded-full px-3",onClick:()=>{F(v.manualCommand||"")},children:[(0,D.jsx)(W,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy command"]}),(0,D.jsxs)(bq,{type:"button",variant:"ghost",size:"sm",className:"h-9 rounded-full px-3",onClick:()=>{A(u)},children:[(0,D.jsx)(M,{className:"mr-1.5 h-3.5 w-3.5"}),"I've connected it"]})]})]}),(0,D.jsx)("div",{className:"mt-4 overflow-x-auto rounded-[18px] border border-white/10 bg-slate-950/60 px-4 py-3",children:(0,D.jsx)("code",{className:"text-[12px] text-slate-200",children:v.manualCommand})})]}):null]}):null,"apiKey"===w.connectKind?(0,D.jsx)("div",{className:"mt-6 rounded-[28px] border border-white/10 bg-white/[0.03] p-5",children:(0,D.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("label",{className:"block text-[11px] uppercase tracking-[0.18em] text-slate-500",children:"API key"}),(0,D.jsx)(br,{type:"password",value:v.apiKey,onChange:a=>G(u,{apiKey:a.target.value}),placeholder:"openrouter"===u?"sk-or-v1-...":"Paste API key",className:"mt-2"})]}),(0,D.jsx)(bq,{type:"button",className:"h-11 rounded-full px-5",disabled:"connecting"===v.flowState||!v.apiKey.trim(),onClick:()=>{z(u)},children:"connecting"===v.flowState?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(N,{className:"mr-2 h-4 w-4 animate-spin"}),"Connecting..."]}):`Connect ${w.shortLabel}`})]})}):null,"oauth"!==w.connectKind?(0,D.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,D.jsx)(bq,{type:"button",variant:"secondary",size:"sm",className:"h-9 rounded-full px-4",disabled:"discovery-loading"===v.flowState,onClick:()=>{A(u)},children:"discovery-loading"===v.flowState?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(N,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Discovering..."]}):"Discover models"}),(0,D.jsx)(bq,{type:"button",variant:"ghost",size:"sm",className:"h-9 rounded-full px-4",onClick:()=>{y(u)},children:"Refresh status"})]}):null,v.emptyState?(0,D.jsx)(ef,{emptyState:v.emptyState,onCopyCommand:a=>{F(a)}}):null,v.models.length>0?(0,D.jsx)("div",{className:"mt-6",children:(0,D.jsx)(ck,{provider:u,models:v.models,selectedModelIds:v.selectedModelIds,search:v.search,onSearchChange:a=>G(u,{search:a}),onToggleModel:a=>{G(u,{selectedModelIds:v.selectedModelIds.includes(a)?v.selectedModelIds.filter(b=>b!==a):[...v.selectedModelIds,a]})},onAddSelected:()=>{B(u)},isAdding:"connecting"===v.flowState&&"Adding selected models..."===v.statusMessage})}):null,"add-success"===v.flowState?(0,D.jsxs)("div",{className:"mt-5 flex items-center gap-3 rounded-[22px] border border-emerald-300/20 bg-emerald-300/[0.08] px-4 py-3",children:[(0,D.jsx)(X,{className:"h-4 w-4 text-emerald-200"}),(0,D.jsx)("p",{className:"text-[13px] text-emerald-50",children:v.statusMessage||"Models were added successfully."})]}):null,v.docsUrl?(0,D.jsx)("a",{href:v.docsUrl,target:"_blank",rel:"noreferrer",className:"mt-5 inline-flex text-[12px] text-slate-300 underline underline-offset-4",children:"OpenClaw model docs"}):null]}):(0,D.jsx)("div",{className:"flex min-h-[240px] items-center justify-center rounded-[24px] border border-dashed border-white/10 bg-white/[0.02] px-6 py-8 text-center",children:(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"font-display text-[1.05rem] text-white",children:"Choose a provider to begin"}),(0,D.jsx)("p",{className:"mt-2 max-w-[420px] text-[13px] leading-6 text-slate-400",children:"Start with ChatGPT, OpenRouter, or Ollama Local. The flow will guide you through connect, discovery, selection, and add."})]})})})]})})]})})}function ef({emptyState:a,onCopyCommand:b}){return(0,D.jsxs)("div",{className:"mt-5 rounded-[28px] border border-white/10 bg-white/[0.03] p-5",children:[(0,D.jsx)("p",{className:"font-display text-[1rem] text-white",children:a.title}),(0,D.jsx)("p",{className:"mt-1 max-w-[620px] text-[13px] leading-6 text-slate-400",children:a.description}),a.commands?.length?(0,D.jsx)("div",{className:"mt-4 space-y-2",children:a.commands.map(a=>(0,D.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-[18px] border border-white/10 bg-slate-950/60 px-4 py-3",children:[(0,D.jsx)("code",{className:"text-[12px] text-slate-200",children:a}),(0,D.jsxs)(bq,{type:"button",size:"sm",variant:"ghost",className:"h-8 rounded-full px-3",onClick:()=>b(a),children:[(0,D.jsx)(W,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy"]})]},a))}):null]})}function eg(a,b,c){let d=b[c]?.connection;if(d)return d;let e=a.diagnostics.modelReadiness.authProviders.find(a=>a.provider===c),f=a.models.filter(a=>a.id.startsWith(`${c}/`)).length;return"ollama"===c?{provider:c,connected:f>0,canConnect:!0,needsTerminal:!1,detail:f>0?`${f} model${1===f?"":"s"} already visible in AgentOS.`:"Detect local models from this machine."}:{provider:c,connected:!!(e?.connected||f>0),canConnect:!0,needsTerminal:"openai-codex"===c,detail:e?.detail||d7(c).helperText}}function eh(a){if("string"==typeof a||"number"==typeof a)return""+a;let b="";if(Array.isArray(a))for(let c=0,d;c<a.length;c++)""!==(d=eh(a[c]))&&(b+=(b&&" ")+d);else for(let c in a)a[c]&&(b+=(b&&" ")+c);return b}var ei={value:()=>{}};function ej(){for(var a,b=0,c=arguments.length,d={};b<c;++b){if(!(a=arguments[b]+"")||a in d||/[\s.]/.test(a))throw Error("illegal type: "+a);d[a]=[]}return new ek(d)}function ek(a){this._=a}function el(a,b,c){for(var d=0,e=a.length;d<e;++d)if(a[d].name===b){a[d]=ei,a=a.slice(0,d).concat(a.slice(d+1));break}return null!=c&&a.push({name:b,value:c}),a}function em(){}function en(a){return null==a?em:function(){return this.querySelector(a)}}function eo(){return[]}function ep(a){return null==a?eo:function(){return this.querySelectorAll(a)}}function eq(a){return function(){return this.matches(a)}}function er(a){return function(b){return b.matches(a)}}ek.prototype=ej.prototype={constructor:ek,on:function(a,b){var c,d=this._,e=(a+"").trim().split(/^|\s+/).map(function(a){var b="",c=a.indexOf(".");if(c>=0&&(b=a.slice(c+1),a=a.slice(0,c)),a&&!d.hasOwnProperty(a))throw Error("unknown type: "+a);return{type:a,name:b}}),f=-1,g=e.length;if(arguments.length<2){for(;++f<g;)if((c=(a=e[f]).type)&&(c=function(a,b){for(var c,d=0,e=a.length;d<e;++d)if((c=a[d]).name===b)return c.value}(d[c],a.name)))return c;return}if(null!=b&&"function"!=typeof b)throw Error("invalid callback: "+b);for(;++f<g;)if(c=(a=e[f]).type)d[c]=el(d[c],a.name,b);else if(null==b)for(c in d)d[c]=el(d[c],a.name,null);return this},copy:function(){var a={},b=this._;for(var c in b)a[c]=b[c].slice();return new ek(a)},call:function(a,b){if((c=arguments.length-2)>0)for(var c,d,e=Array(c),f=0;f<c;++f)e[f]=arguments[f+2];if(!this._.hasOwnProperty(a))throw Error("unknown type: "+a);for(d=this._[a],f=0,c=d.length;f<c;++f)d[f].value.apply(b,e)},apply:function(a,b,c){if(!this._.hasOwnProperty(a))throw Error("unknown type: "+a);for(var d=this._[a],e=0,f=d.length;e<f;++e)d[e].value.apply(b,c)}};var es=Array.prototype.find;function et(){return this.firstElementChild}var eu=Array.prototype.filter;function ev(){return Array.from(this.children)}function ew(a){return Array(a.length)}function ex(a,b){this.ownerDocument=a.ownerDocument,this.namespaceURI=a.namespaceURI,this._next=null,this._parent=a,this.__data__=b}function ey(a,b,c,d,e,f){for(var g,h=0,i=b.length,j=f.length;h<j;++h)(g=b[h])?(g.__data__=f[h],d[h]=g):c[h]=new ex(a,f[h]);for(;h<i;++h)(g=b[h])&&(e[h]=g)}function ez(a,b,c,d,e,f,g){var h,i,j,k=new Map,l=b.length,m=f.length,n=Array(l);for(h=0;h<l;++h)(i=b[h])&&(n[h]=j=g.call(i,i.__data__,h,b)+"",k.has(j)?e[h]=i:k.set(j,i));for(h=0;h<m;++h)j=g.call(a,f[h],h,f)+"",(i=k.get(j))?(d[h]=i,i.__data__=f[h],k.delete(j)):c[h]=new ex(a,f[h]);for(h=0;h<l;++h)(i=b[h])&&k.get(n[h])===i&&(e[h]=i)}function eA(a){return a.__data__}function eB(a,b){return a<b?-1:a>b?1:a>=b?0:NaN}ex.prototype={constructor:ex,appendChild:function(a){return this._parent.insertBefore(a,this._next)},insertBefore:function(a,b){return this._parent.insertBefore(a,b)},querySelector:function(a){return this._parent.querySelector(a)},querySelectorAll:function(a){return this._parent.querySelectorAll(a)}};var eC="http://www.w3.org/1999/xhtml";let eD={svg:"http://www.w3.org/2000/svg",xhtml:eC,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function eE(a){var b=a+="",c=b.indexOf(":");return c>=0&&"xmlns"!==(b=a.slice(0,c))&&(a=a.slice(c+1)),eD.hasOwnProperty(b)?{space:eD[b],local:a}:a}function eF(a){return a.ownerDocument&&a.ownerDocument.defaultView||a.document&&a||a.defaultView}function eG(a,b){return a.style.getPropertyValue(b)||eF(a).getComputedStyle(a,null).getPropertyValue(b)}function eH(a){return a.trim().split(/^|\s+/)}function eI(a){return a.classList||new eJ(a)}function eJ(a){this._node=a,this._names=eH(a.getAttribute("class")||"")}function eK(a,b){for(var c=eI(a),d=-1,e=b.length;++d<e;)c.add(b[d])}function eL(a,b){for(var c=eI(a),d=-1,e=b.length;++d<e;)c.remove(b[d])}function eM(){this.textContent=""}function eN(){this.innerHTML=""}function eO(){this.nextSibling&&this.parentNode.appendChild(this)}function eP(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function eQ(a){var b=eE(a);return(b.local?function(a){return function(){return this.ownerDocument.createElementNS(a.space,a.local)}}:function(a){return function(){var b=this.ownerDocument,c=this.namespaceURI;return c===eC&&b.documentElement.namespaceURI===eC?b.createElement(a):b.createElementNS(c,a)}})(b)}function eR(){return null}function eS(){var a=this.parentNode;a&&a.removeChild(this)}function eT(){var a=this.cloneNode(!1),b=this.parentNode;return b?b.insertBefore(a,this.nextSibling):a}function eU(){var a=this.cloneNode(!0),b=this.parentNode;return b?b.insertBefore(a,this.nextSibling):a}function eV(a){return function(){var b=this.__on;if(b){for(var c,d=0,e=-1,f=b.length;d<f;++d)(c=b[d],a.type&&c.type!==a.type||c.name!==a.name)?b[++e]=c:this.removeEventListener(c.type,c.listener,c.options);++e?b.length=e:delete this.__on}}}function eW(a,b,c){return function(){var d,e=this.__on,f=function(a){b.call(this,a,this.__data__)};if(e){for(var g=0,h=e.length;g<h;++g)if((d=e[g]).type===a.type&&d.name===a.name){this.removeEventListener(d.type,d.listener,d.options),this.addEventListener(d.type,d.listener=f,d.options=c),d.value=b;return}}this.addEventListener(a.type,f,c),d={type:a.type,name:a.name,value:b,listener:f,options:c},e?e.push(d):this.__on=[d]}}function eX(a,b,c){var d=eF(a),e=d.CustomEvent;"function"==typeof e?e=new e(b,c):(e=d.document.createEvent("Event"),c?(e.initEvent(b,c.bubbles,c.cancelable),e.detail=c.detail):e.initEvent(b,!1,!1)),a.dispatchEvent(e)}eJ.prototype={add:function(a){0>this._names.indexOf(a)&&(this._names.push(a),this._node.setAttribute("class",this._names.join(" ")))},remove:function(a){var b=this._names.indexOf(a);b>=0&&(this._names.splice(b,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(a){return this._names.indexOf(a)>=0}};var eY=[null];function eZ(a,b){this._groups=a,this._parents=b}function e$(){return new eZ([[document.documentElement]],eY)}function e_(a){return((a=Math.exp(a))+1/a)/2}eZ.prototype=e$.prototype={constructor:eZ,select:function(a){"function"!=typeof a&&(a=en(a));for(var b=this._groups,c=b.length,d=Array(c),e=0;e<c;++e)for(var f,g,h=b[e],i=h.length,j=d[e]=Array(i),k=0;k<i;++k)(f=h[k])&&(g=a.call(f,f.__data__,k,h))&&("__data__"in f&&(g.__data__=f.__data__),j[k]=g);return new eZ(d,this._parents)},selectAll:function(a){if("function"==typeof a){var b;b=a,a=function(){var a;return a=b.apply(this,arguments),null==a?[]:Array.isArray(a)?a:Array.from(a)}}else a=ep(a);for(var c=this._groups,d=c.length,e=[],f=[],g=0;g<d;++g)for(var h,i=c[g],j=i.length,k=0;k<j;++k)(h=i[k])&&(e.push(a.call(h,h.__data__,k,i)),f.push(h));return new eZ(e,f)},selectChild:function(a){var b;return this.select(null==a?et:(b="function"==typeof a?a:er(a),function(){return es.call(this.children,b)}))},selectChildren:function(a){var b;return this.selectAll(null==a?ev:(b="function"==typeof a?a:er(a),function(){return eu.call(this.children,b)}))},filter:function(a){"function"!=typeof a&&(a=eq(a));for(var b=this._groups,c=b.length,d=Array(c),e=0;e<c;++e)for(var f,g=b[e],h=g.length,i=d[e]=[],j=0;j<h;++j)(f=g[j])&&a.call(f,f.__data__,j,g)&&i.push(f);return new eZ(d,this._parents)},data:function(a,b){if(!arguments.length)return Array.from(this,eA);var c=b?ez:ey,d=this._parents,e=this._groups;"function"!=typeof a&&(s=a,a=function(){return s});for(var f=e.length,g=Array(f),h=Array(f),i=Array(f),j=0;j<f;++j){var k=d[j],l=e[j],m=l.length,n="object"==typeof(r=a.call(k,k&&k.__data__,j,d))&&"length"in r?r:Array.from(r),o=n.length,p=h[j]=Array(o),q=g[j]=Array(o);c(k,l,p,q,i[j]=Array(m),n,b);for(var r,s,t,u,v=0,w=0;v<o;++v)if(t=p[v]){for(v>=w&&(w=v+1);!(u=q[w])&&++w<o;);t._next=u||null}}return(g=new eZ(g,d))._enter=h,g._exit=i,g},enter:function(){return new eZ(this._enter||this._groups.map(ew),this._parents)},exit:function(){return new eZ(this._exit||this._groups.map(ew),this._parents)},join:function(a,b,c){var d=this.enter(),e=this,f=this.exit();return"function"==typeof a?(d=a(d))&&(d=d.selection()):d=d.append(a+""),null!=b&&(e=b(e))&&(e=e.selection()),null==c?f.remove():c(f),d&&e?d.merge(e).order():e},merge:function(a){for(var b=a.selection?a.selection():a,c=this._groups,d=b._groups,e=c.length,f=d.length,g=Math.min(e,f),h=Array(e),i=0;i<g;++i)for(var j,k=c[i],l=d[i],m=k.length,n=h[i]=Array(m),o=0;o<m;++o)(j=k[o]||l[o])&&(n[o]=j);for(;i<e;++i)h[i]=c[i];return new eZ(h,this._parents)},selection:function(){return this},order:function(){for(var a=this._groups,b=-1,c=a.length;++b<c;)for(var d,e=a[b],f=e.length-1,g=e[f];--f>=0;)(d=e[f])&&(g&&4^d.compareDocumentPosition(g)&&g.parentNode.insertBefore(d,g),g=d);return this},sort:function(a){function b(b,c){return b&&c?a(b.__data__,c.__data__):!b-!c}a||(a=eB);for(var c=this._groups,d=c.length,e=Array(d),f=0;f<d;++f){for(var g,h=c[f],i=h.length,j=e[f]=Array(i),k=0;k<i;++k)(g=h[k])&&(j[k]=g);j.sort(b)}return new eZ(e,this._parents).order()},call:function(){var a=arguments[0];return arguments[0]=this,a.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var a=this._groups,b=0,c=a.length;b<c;++b)for(var d=a[b],e=0,f=d.length;e<f;++e){var g=d[e];if(g)return g}return null},size:function(){let a=0;for(let b of this)++a;return a},empty:function(){return!this.node()},each:function(a){for(var b=this._groups,c=0,d=b.length;c<d;++c)for(var e,f=b[c],g=0,h=f.length;g<h;++g)(e=f[g])&&a.call(e,e.__data__,g,f);return this},attr:function(a,b){var c=eE(a);if(arguments.length<2){var d=this.node();return c.local?d.getAttributeNS(c.space,c.local):d.getAttribute(c)}return this.each((null==b?c.local?function(a){return function(){this.removeAttributeNS(a.space,a.local)}}:function(a){return function(){this.removeAttribute(a)}}:"function"==typeof b?c.local?function(a,b){return function(){var c=b.apply(this,arguments);null==c?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}}:function(a,b){return function(){var c=b.apply(this,arguments);null==c?this.removeAttribute(a):this.setAttribute(a,c)}}:c.local?function(a,b){return function(){this.setAttributeNS(a.space,a.local,b)}}:function(a,b){return function(){this.setAttribute(a,b)}})(c,b))},style:function(a,b,c){return arguments.length>1?this.each((null==b?function(a){return function(){this.style.removeProperty(a)}}:"function"==typeof b?function(a,b,c){return function(){var d=b.apply(this,arguments);null==d?this.style.removeProperty(a):this.style.setProperty(a,d,c)}}:function(a,b,c){return function(){this.style.setProperty(a,b,c)}})(a,b,null==c?"":c)):eG(this.node(),a)},property:function(a,b){return arguments.length>1?this.each((null==b?function(a){return function(){delete this[a]}}:"function"==typeof b?function(a,b){return function(){var c=b.apply(this,arguments);null==c?delete this[a]:this[a]=c}}:function(a,b){return function(){this[a]=b}})(a,b)):this.node()[a]},classed:function(a,b){var c=eH(a+"");if(arguments.length<2){for(var d=eI(this.node()),e=-1,f=c.length;++e<f;)if(!d.contains(c[e]))return!1;return!0}return this.each(("function"==typeof b?function(a,b){return function(){(b.apply(this,arguments)?eK:eL)(this,a)}}:b?function(a){return function(){eK(this,a)}}:function(a){return function(){eL(this,a)}})(c,b))},text:function(a){return arguments.length?this.each(null==a?eM:("function"==typeof a?function(a){return function(){var b=a.apply(this,arguments);this.textContent=null==b?"":b}}:function(a){return function(){this.textContent=a}})(a)):this.node().textContent},html:function(a){return arguments.length?this.each(null==a?eN:("function"==typeof a?function(a){return function(){var b=a.apply(this,arguments);this.innerHTML=null==b?"":b}}:function(a){return function(){this.innerHTML=a}})(a)):this.node().innerHTML},raise:function(){return this.each(eO)},lower:function(){return this.each(eP)},append:function(a){var b="function"==typeof a?a:eQ(a);return this.select(function(){return this.appendChild(b.apply(this,arguments))})},insert:function(a,b){var c="function"==typeof a?a:eQ(a),d=null==b?eR:"function"==typeof b?b:en(b);return this.select(function(){return this.insertBefore(c.apply(this,arguments),d.apply(this,arguments)||null)})},remove:function(){return this.each(eS)},clone:function(a){return this.select(a?eU:eT)},datum:function(a){return arguments.length?this.property("__data__",a):this.node().__data__},on:function(a,b,c){var d,e,f=(a+"").trim().split(/^|\s+/).map(function(a){var b="",c=a.indexOf(".");return c>=0&&(b=a.slice(c+1),a=a.slice(0,c)),{type:a,name:b}}),g=f.length;if(arguments.length<2){var h=this.node().__on;if(h){for(var i,j=0,k=h.length;j<k;++j)for(d=0,i=h[j];d<g;++d)if((e=f[d]).type===i.type&&e.name===i.name)return i.value}return}for(d=0,h=b?eW:eV;d<g;++d)this.each(h(f[d],b,c));return this},dispatch:function(a,b){return this.each(("function"==typeof b?function(a,b){return function(){return eX(this,a,b.apply(this,arguments))}}:function(a,b){return function(){return eX(this,a,b)}})(a,b))},[Symbol.iterator]:function*(){for(var a=this._groups,b=0,c=a.length;b<c;++b)for(var d,e=a[b],f=0,g=e.length;f<g;++f)(d=e[f])&&(yield d)}},(function(a,{sourceEvent:b,subject:c,target:d,identifier:e,active:f,x:g,y:h,dx:i,dy:j,dispatch:k}){Object.defineProperties(this,{type:{value:a,enumerable:!0,configurable:!0},sourceEvent:{value:b,enumerable:!0,configurable:!0},subject:{value:c,enumerable:!0,configurable:!0},target:{value:d,enumerable:!0,configurable:!0},identifier:{value:e,enumerable:!0,configurable:!0},active:{value:f,enumerable:!0,configurable:!0},x:{value:g,enumerable:!0,configurable:!0},y:{value:h,enumerable:!0,configurable:!0},dx:{value:i,enumerable:!0,configurable:!0},dy:{value:j,enumerable:!0,configurable:!0},_:{value:k}})}).prototype.on=function(){var a=this._.on.apply(this._,arguments);return a===this._?this:a},!function a(b,c,d){function e(a,e){var f,g,h=a[0],i=a[1],j=a[2],k=e[0],l=e[1],m=e[2],n=k-h,o=l-i,p=n*n+o*o;if(p<1e-12)g=Math.log(m/j)/b,f=function(a){return[h+a*n,i+a*o,j*Math.exp(b*a*g)]};else{var q=Math.sqrt(p),r=(m*m-j*j+d*p)/(2*j*c*q),s=(m*m-j*j-d*p)/(2*m*c*q),t=Math.log(Math.sqrt(r*r+1)-r);g=(Math.log(Math.sqrt(s*s+1)-s)-t)/b,f=function(a){var d,e,f=a*g,k=e_(t),l=j/(c*q)*(k*(((d=Math.exp(2*(d=b*f+t)))-1)/(d+1))-((e=Math.exp(e=t))-1/e)/2);return[h+l*n,i+l*o,j*k/e_(b*f+t)]}}return f.duration=1e3*g*b/Math.SQRT2,f}return e.rho=function(b){var c=Math.max(.001,+b),d=c*c;return a(c,d,d*d)},e}(Math.SQRT2,2,4);var e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,fa,fb=0,fc=0,fd=0,fe=0,ff=0,fg=0,fh="object"==typeof performance&&performance.now?performance:Date,fi="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(a){setTimeout(a,17)};function fj(){return ff||(fi(fk),ff=fh.now()+fg)}function fk(){ff=0}function fl(){this._call=this._time=this._next=null}function fm(a,b,c){var d=new fl;return d.restart(a,b,c),d}function fn(){ff=(fe=fh.now())+fg,fb=fc=0;try{fj(),++fb;for(var a,b=e9;b;)(a=ff-b._time)>=0&&b._call.call(void 0,a),b=b._next;--fb}finally{fb=0,function(){for(var a,b,c=e9,d=1/0;c;)c._call?(d>c._time&&(d=c._time),a=c,c=c._next):(b=c._next,c._next=null,c=a?a._next=b:e9=b);fa=a,fp(d)}(),ff=0}}function fo(){var a=fh.now(),b=a-fe;b>1e3&&(fg-=b,fe=a)}function fp(a){!fb&&(fc&&(fc=clearTimeout(fc)),a-ff>24?(a<1/0&&(fc=setTimeout(fn,a-fh.now()-fg)),fd&&(fd=clearInterval(fd))):(fd||(fe=fh.now(),fd=setInterval(fo,1e3)),fb=1,fi(fn)))}function fq(a,b,c){var d=new fl;return b=null==b?0:+b,d.restart(c=>{d.stop(),a(c+b)},b,c),d}fl.prototype=fm.prototype={constructor:fl,restart:function(a,b,c){if("function"!=typeof a)throw TypeError("callback is not a function");c=(null==c?fj():+c)+(null==b?0:+b),this._next||fa===this||(fa?fa._next=this:e9=this,fa=this),this._call=a,this._time=c,fp()},stop:function(){this._call&&(this._call=null,this._time=1/0,fp())}};var fr=ej("start","end","cancel","interrupt"),fs=[];function ft(a,b,c,d,e,f){var g=a.__transition;if(g){if(c in g)return}else a.__transition={};!function(a,b,c){var d,e=a.__transition;function f(i){var j,k,l,m;if(1!==c.state)return h();for(j in e)if((m=e[j]).name===c.name){if(3===m.state)return fq(f);4===m.state?(m.state=6,m.timer.stop(),m.on.call("interrupt",a,a.__data__,m.index,m.group),delete e[j]):+j<b&&(m.state=6,m.timer.stop(),m.on.call("cancel",a,a.__data__,m.index,m.group),delete e[j])}if(fq(function(){3===c.state&&(c.state=4,c.timer.restart(g,c.delay,c.time),g(i))}),c.state=2,c.on.call("start",a,a.__data__,c.index,c.group),2===c.state){for(j=0,c.state=3,d=Array(l=c.tween.length),k=-1;j<l;++j)(m=c.tween[j].value.call(a,a.__data__,c.index,c.group))&&(d[++k]=m);d.length=k+1}}function g(b){for(var e=b<c.duration?c.ease.call(null,b/c.duration):(c.timer.restart(h),c.state=5,1),f=-1,g=d.length;++f<g;)d[f].call(a,e);5===c.state&&(c.on.call("end",a,a.__data__,c.index,c.group),h())}function h(){for(var d in c.state=6,c.timer.stop(),delete e[b],e)return;delete a.__transition}e[b]=c,c.timer=fm(function(a){c.state=1,c.timer.restart(f,c.delay,c.time),c.delay<=a&&f(a-c.delay)},0,c.time)}(a,c,{name:b,index:d,group:e,on:fr,tween:fs,time:f.time,delay:f.delay,duration:f.duration,ease:f.ease,timer:null,state:0})}function fu(a,b){var c=fw(a,b);if(c.state>0)throw Error("too late; already scheduled");return c}function fv(a,b){var c=fw(a,b);if(c.state>3)throw Error("too late; already running");return c}function fw(a,b){var c=a.__transition;if(!c||!(c=c[b]))throw Error("transition not found");return c}function fx(a,b){return a*=1,b*=1,function(c){return a*(1-c)+b*c}}var fy=180/Math.PI,fz={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function fA(a,b,c,d,e,f){var g,h,i;return(g=Math.sqrt(a*a+b*b))&&(a/=g,b/=g),(i=a*c+b*d)&&(c-=a*i,d-=b*i),(h=Math.sqrt(c*c+d*d))&&(c/=h,d/=h,i/=h),a*d<b*c&&(a=-a,b=-b,i=-i,g=-g),{translateX:e,translateY:f,rotate:Math.atan2(b,a)*fy,skewX:Math.atan(i)*fy,scaleX:g,scaleY:h}}function fB(a,b,c,d){function e(a){return a.length?a.pop()+" ":""}return function(f,g){var h,i,j,k,l=[],m=[];return f=a(f),g=a(g),!function(a,d,e,f,g,h){if(a!==e||d!==f){var i=g.push("translate(",null,b,null,c);h.push({i:i-4,x:fx(a,e)},{i:i-2,x:fx(d,f)})}else(e||f)&&g.push("translate("+e+b+f+c)}(f.translateX,f.translateY,g.translateX,g.translateY,l,m),h=f.rotate,i=g.rotate,h!==i?(h-i>180?i+=360:i-h>180&&(h+=360),m.push({i:l.push(e(l)+"rotate(",null,d)-2,x:fx(h,i)})):i&&l.push(e(l)+"rotate("+i+d),j=f.skewX,k=g.skewX,j!==k?m.push({i:l.push(e(l)+"skewX(",null,d)-2,x:fx(j,k)}):k&&l.push(e(l)+"skewX("+k+d),!function(a,b,c,d,f,g){if(a!==c||b!==d){var h=f.push(e(f)+"scale(",null,",",null,")");g.push({i:h-4,x:fx(a,c)},{i:h-2,x:fx(b,d)})}else(1!==c||1!==d)&&f.push(e(f)+"scale("+c+","+d+")")}(f.scaleX,f.scaleY,g.scaleX,g.scaleY,l,m),f=g=null,function(a){for(var b,c=-1,d=m.length;++c<d;)l[(b=m[c]).i]=b.x(a);return l.join("")}}}var fC=fB(function(a){let b=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(a+"");return b.isIdentity?fz:fA(b.a,b.b,b.c,b.d,b.e,b.f)},"px, ","px)","deg)"),fD=fB(function(a){return null==a?fz:(u||(u=document.createElementNS("http://www.w3.org/2000/svg","g")),u.setAttribute("transform",a),a=u.transform.baseVal.consolidate())?fA((a=a.matrix).a,a.b,a.c,a.d,a.e,a.f):fz},", ",")",")");function fE(a,b,c){var d=a._id;return a.each(function(){var a=fv(this,d);(a.value||(a.value={}))[b]=c.apply(this,arguments)}),function(a){return fw(a,d).value[b]}}function fF(a,b,c){a.prototype=b.prototype=c,c.constructor=a}function fG(a,b){var c=Object.create(a.prototype);for(var d in b)c[d]=b[d];return c}function fH(){}var fI="\\s*([+-]?\\d+)\\s*",fJ="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fK="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",fL=/^#([0-9a-f]{3,8})$/,fM=RegExp(`^rgb\\(${fI},${fI},${fI}\\)$`),fN=RegExp(`^rgb\\(${fK},${fK},${fK}\\)$`),fO=RegExp(`^rgba\\(${fI},${fI},${fI},${fJ}\\)$`),fP=RegExp(`^rgba\\(${fK},${fK},${fK},${fJ}\\)$`),fQ=RegExp(`^hsl\\(${fJ},${fK},${fK}\\)$`),fR=RegExp(`^hsla\\(${fJ},${fK},${fK},${fJ}\\)$`),fS={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function fT(){return this.rgb().formatHex()}function fU(){return this.rgb().formatRgb()}function fV(a){var b,c;return a=(a+"").trim().toLowerCase(),(b=fL.exec(a))?(c=b[1].length,b=parseInt(b[1],16),6===c?fW(b):3===c?new fZ(b>>8&15|b>>4&240,b>>4&15|240&b,(15&b)<<4|15&b,1):8===c?fX(b>>24&255,b>>16&255,b>>8&255,(255&b)/255):4===c?fX(b>>12&15|b>>8&240,b>>8&15|b>>4&240,b>>4&15|240&b,((15&b)<<4|15&b)/255):null):(b=fM.exec(a))?new fZ(b[1],b[2],b[3],1):(b=fN.exec(a))?new fZ(255*b[1]/100,255*b[2]/100,255*b[3]/100,1):(b=fO.exec(a))?fX(b[1],b[2],b[3],b[4]):(b=fP.exec(a))?fX(255*b[1]/100,255*b[2]/100,255*b[3]/100,b[4]):(b=fQ.exec(a))?f3(b[1],b[2]/100,b[3]/100,1):(b=fR.exec(a))?f3(b[1],b[2]/100,b[3]/100,b[4]):fS.hasOwnProperty(a)?fW(fS[a]):"transparent"===a?new fZ(NaN,NaN,NaN,0):null}function fW(a){return new fZ(a>>16&255,a>>8&255,255&a,1)}function fX(a,b,c,d){return d<=0&&(a=b=c=NaN),new fZ(a,b,c,d)}function fY(a,b,c,d){var e;return 1==arguments.length?((e=a)instanceof fH||(e=fV(e)),e)?new fZ((e=e.rgb()).r,e.g,e.b,e.opacity):new fZ:new fZ(a,b,c,null==d?1:d)}function fZ(a,b,c,d){this.r=+a,this.g=+b,this.b=+c,this.opacity=+d}function f$(){return`#${f2(this.r)}${f2(this.g)}${f2(this.b)}`}function f_(){let a=f0(this.opacity);return`${1===a?"rgb(":"rgba("}${f1(this.r)}, ${f1(this.g)}, ${f1(this.b)}${1===a?")":`, ${a})`}`}function f0(a){return isNaN(a)?1:Math.max(0,Math.min(1,a))}function f1(a){return Math.max(0,Math.min(255,Math.round(a)||0))}function f2(a){return((a=f1(a))<16?"0":"")+a.toString(16)}function f3(a,b,c,d){return d<=0?a=b=c=NaN:c<=0||c>=1?a=b=NaN:b<=0&&(a=NaN),new f5(a,b,c,d)}function f4(a){if(a instanceof f5)return new f5(a.h,a.s,a.l,a.opacity);if(a instanceof fH||(a=fV(a)),!a)return new f5;if(a instanceof f5)return a;var b=(a=a.rgb()).r/255,c=a.g/255,d=a.b/255,e=Math.min(b,c,d),f=Math.max(b,c,d),g=NaN,h=f-e,i=(f+e)/2;return h?(g=b===f?(c-d)/h+(c<d)*6:c===f?(d-b)/h+2:(b-c)/h+4,h/=i<.5?f+e:2-f-e,g*=60):h=i>0&&i<1?0:g,new f5(g,h,i,a.opacity)}function f5(a,b,c,d){this.h=+a,this.s=+b,this.l=+c,this.opacity=+d}function f6(a){return(a=(a||0)%360)<0?a+360:a}function f7(a){return Math.max(0,Math.min(1,a||0))}function f8(a,b,c){return(a<60?b+(c-b)*a/60:a<180?c:a<240?b+(c-b)*(240-a)/60:b)*255}function f9(a,b,c,d,e){var f=a*a,g=f*a;return((1-3*a+3*f-g)*b+(4-6*f+3*g)*c+(1+3*a+3*f-3*g)*d+g*e)/6}fF(fH,fV,{copy(a){return Object.assign(new this.constructor,this,a)},displayable(){return this.rgb().displayable()},hex:fT,formatHex:fT,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return f4(this).formatHsl()},formatRgb:fU,toString:fU}),fF(fZ,fY,fG(fH,{brighter(a){return a=null==a?1.4285714285714286:Math.pow(1.4285714285714286,a),new fZ(this.r*a,this.g*a,this.b*a,this.opacity)},darker(a){return a=null==a?.7:Math.pow(.7,a),new fZ(this.r*a,this.g*a,this.b*a,this.opacity)},rgb(){return this},clamp(){return new fZ(f1(this.r),f1(this.g),f1(this.b),f0(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:f$,formatHex:f$,formatHex8:function(){return`#${f2(this.r)}${f2(this.g)}${f2(this.b)}${f2((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:f_,toString:f_})),fF(f5,function(a,b,c,d){return 1==arguments.length?f4(a):new f5(a,b,c,null==d?1:d)},fG(fH,{brighter(a){return a=null==a?1.4285714285714286:Math.pow(1.4285714285714286,a),new f5(this.h,this.s,this.l*a,this.opacity)},darker(a){return a=null==a?.7:Math.pow(.7,a),new f5(this.h,this.s,this.l*a,this.opacity)},rgb(){var a=this.h%360+(this.h<0)*360,b=isNaN(a)||isNaN(this.s)?0:this.s,c=this.l,d=c+(c<.5?c:1-c)*b,e=2*c-d;return new fZ(f8(a>=240?a-240:a+120,e,d),f8(a,e,d),f8(a<120?a+240:a-120,e,d),this.opacity)},clamp(){return new f5(f6(this.h),f7(this.s),f7(this.l),f0(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let a=f0(this.opacity);return`${1===a?"hsl(":"hsla("}${f6(this.h)}, ${100*f7(this.s)}%, ${100*f7(this.l)}%${1===a?")":`, ${a})`}`}}));let ga=a=>()=>a;function gb(a,b){var c=b-a;return c?function(b){return a+b*c}:ga(isNaN(a)?b:a)}let gc=function a(b){var c,d=1==(c=+b)?gb:function(a,b){var d,e,f;return b-a?(d=a,e=b,d=Math.pow(d,f=c),e=Math.pow(e,f)-d,f=1/f,function(a){return Math.pow(d+a*e,f)}):ga(isNaN(a)?b:a)};function e(a,b){var c=d((a=fY(a)).r,(b=fY(b)).r),e=d(a.g,b.g),f=d(a.b,b.b),g=gb(a.opacity,b.opacity);return function(b){return a.r=c(b),a.g=e(b),a.b=f(b),a.opacity=g(b),a+""}}return e.gamma=a,e}(1);function gd(a){return function(b){var c,d,e=b.length,f=Array(e),g=Array(e),h=Array(e);for(c=0;c<e;++c)d=fY(b[c]),f[c]=d.r||0,g[c]=d.g||0,h[c]=d.b||0;return f=a(f),g=a(g),h=a(h),d.opacity=1,function(a){return d.r=f(a),d.g=g(a),d.b=h(a),d+""}}}gd(function(a){var b=a.length-1;return function(c){var d=c<=0?c=0:c>=1?(c=1,b-1):Math.floor(c*b),e=a[d],f=a[d+1],g=d>0?a[d-1]:2*e-f,h=d<b-1?a[d+2]:2*f-e;return f9((c-d/b)*b,g,e,f,h)}}),gd(function(a){var b=a.length;return function(c){var d=Math.floor(((c%=1)<0?++c:c)*b),e=a[(d+b-1)%b],f=a[d%b],g=a[(d+1)%b],h=a[(d+2)%b];return f9((c-d/b)*b,e,f,g,h)}});var ge=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,gf=RegExp(ge.source,"g");function gg(a,b){var c,d,e,f,g,h=ge.lastIndex=gf.lastIndex=0,i=-1,j=[],k=[];for(a+="",b+="";(e=ge.exec(a))&&(f=gf.exec(b));)(g=f.index)>h&&(g=b.slice(h,g),j[i]?j[i]+=g:j[++i]=g),(e=e[0])===(f=f[0])?j[i]?j[i]+=f:j[++i]=f:(j[++i]=null,k.push({i:i,x:fx(e,f)})),h=gf.lastIndex;return h<b.length&&(g=b.slice(h),j[i]?j[i]+=g:j[++i]=g),j.length<2?k[0]?(c=k[0].x,function(a){return c(a)+""}):(d=b,function(){return d}):(b=k.length,function(a){for(var c,d=0;d<b;++d)j[(c=k[d]).i]=c.x(a);return j.join("")})}function gh(a,b){var c;return("number"==typeof b?fx:b instanceof fV?gc:(c=fV(b))?(b=c,gc):gg)(a,b)}var gi=e$.prototype.constructor;function gj(a){return function(){this.style.removeProperty(a)}}var gk=0;function gl(a,b,c,d){this._groups=a,this._parents=b,this._name=c,this._id=d}var gm=e$.prototype;gl.prototype=(function(a){return e$().transition(a)}).prototype={constructor:gl,select:function(a){var b=this._name,c=this._id;"function"!=typeof a&&(a=en(a));for(var d=this._groups,e=d.length,f=Array(e),g=0;g<e;++g)for(var h,i,j=d[g],k=j.length,l=f[g]=Array(k),m=0;m<k;++m)(h=j[m])&&(i=a.call(h,h.__data__,m,j))&&("__data__"in h&&(i.__data__=h.__data__),l[m]=i,ft(l[m],b,c,m,l,fw(h,c)));return new gl(f,this._parents,b,c)},selectAll:function(a){var b=this._name,c=this._id;"function"!=typeof a&&(a=ep(a));for(var d=this._groups,e=d.length,f=[],g=[],h=0;h<e;++h)for(var i,j=d[h],k=j.length,l=0;l<k;++l)if(i=j[l]){for(var m,n=a.call(i,i.__data__,l,j),o=fw(i,c),p=0,q=n.length;p<q;++p)(m=n[p])&&ft(m,b,c,p,n,o);f.push(n),g.push(i)}return new gl(f,g,b,c)},selectChild:gm.selectChild,selectChildren:gm.selectChildren,filter:function(a){"function"!=typeof a&&(a=eq(a));for(var b=this._groups,c=b.length,d=Array(c),e=0;e<c;++e)for(var f,g=b[e],h=g.length,i=d[e]=[],j=0;j<h;++j)(f=g[j])&&a.call(f,f.__data__,j,g)&&i.push(f);return new gl(d,this._parents,this._name,this._id)},merge:function(a){if(a._id!==this._id)throw Error();for(var b=this._groups,c=a._groups,d=b.length,e=c.length,f=Math.min(d,e),g=Array(d),h=0;h<f;++h)for(var i,j=b[h],k=c[h],l=j.length,m=g[h]=Array(l),n=0;n<l;++n)(i=j[n]||k[n])&&(m[n]=i);for(;h<d;++h)g[h]=b[h];return new gl(g,this._parents,this._name,this._id)},selection:function(){return new gi(this._groups,this._parents)},transition:function(){for(var a=this._name,b=this._id,c=++gk,d=this._groups,e=d.length,f=0;f<e;++f)for(var g,h=d[f],i=h.length,j=0;j<i;++j)if(g=h[j]){var k=fw(g,b);ft(g,a,c,j,h,{time:k.time+k.delay+k.duration,delay:0,duration:k.duration,ease:k.ease})}return new gl(d,this._parents,a,c)},call:gm.call,nodes:gm.nodes,node:gm.node,size:gm.size,empty:gm.empty,each:gm.each,on:function(a,b){var c,d,e,f,g,h,i=this._id;return arguments.length<2?fw(this.node(),i).on.on(a):this.each((c=i,d=a,e=b,h=(d+"").trim().split(/^|\s+/).every(function(a){var b=a.indexOf(".");return b>=0&&(a=a.slice(0,b)),!a||"start"===a})?fu:fv,function(){var a=h(this,c),b=a.on;b!==f&&(g=(f=b).copy()).on(d,e),a.on=g}))},attr:function(a,b){var c=eE(a),d="transform"===c?fD:gh;return this.attrTween(a,"function"==typeof b?(c.local?function(a,b,c){var d,e,f;return function(){var g,h,i=c(this);return null==i?void this.removeAttributeNS(a.space,a.local):(g=this.getAttributeNS(a.space,a.local))===(h=i+"")?null:g===d&&h===e?f:(e=h,f=b(d=g,i))}}:function(a,b,c){var d,e,f;return function(){var g,h,i=c(this);return null==i?void this.removeAttribute(a):(g=this.getAttribute(a))===(h=i+"")?null:g===d&&h===e?f:(e=h,f=b(d=g,i))}})(c,d,fE(this,"attr."+a,b)):null==b?(c.local?function(a){return function(){this.removeAttributeNS(a.space,a.local)}}:function(a){return function(){this.removeAttribute(a)}})(c):(c.local?function(a,b,c){var d,e,f=c+"";return function(){var g=this.getAttributeNS(a.space,a.local);return g===f?null:g===d?e:e=b(d=g,c)}}:function(a,b,c){var d,e,f=c+"";return function(){var g=this.getAttribute(a);return g===f?null:g===d?e:e=b(d=g,c)}})(c,d,b))},attrTween:function(a,b){var c="attr."+a;if(arguments.length<2)return(c=this.tween(c))&&c._value;if(null==b)return this.tween(c,null);if("function"!=typeof b)throw Error();var d=eE(a);return this.tween(c,(d.local?function(a,b){var c,d;function e(){var e=b.apply(this,arguments);return e!==d&&(c=(d=e)&&function(b){this.setAttributeNS(a.space,a.local,e.call(this,b))}),c}return e._value=b,e}:function(a,b){var c,d;function e(){var e=b.apply(this,arguments);return e!==d&&(c=(d=e)&&function(b){this.setAttribute(a,e.call(this,b))}),c}return e._value=b,e})(d,b))},style:function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y="transform"==(a+="")?fC:gh;return null==b?this.styleTween(a,(d=a,function(){var a=eG(this,d),b=(this.style.removeProperty(d),eG(this,d));return a===b?null:a===e&&b===f?g:g=y(e=a,f=b)})).on("end.style."+a,gj(a)):"function"==typeof b?this.styleTween(a,(h=a,i=fE(this,"style."+a,b),function(){var a=eG(this,h),b=i(this),c=b+"";return null==b&&(this.style.removeProperty(h),c=b=eG(this,h)),a===c?null:a===j&&c===k?l:(k=c,l=y(j=a,b))})).each((m=this._id,t="end."+(s="style."+(n=a)),function(){var a=fv(this,m),b=a.on,c=null==a.value[s]?r||(r=gj(n)):void 0;(b!==o||q!==c)&&(p=(o=b).copy()).on(t,q=c),a.on=p})):this.styleTween(a,(u=a,x=b+"",function(){var a=eG(this,u);return a===x?null:a===v?w:w=y(v=a,b)}),c).on("end.style."+a,null)},styleTween:function(a,b,c){var d="style."+(a+="");if(arguments.length<2)return(d=this.tween(d))&&d._value;if(null==b)return this.tween(d,null);if("function"!=typeof b)throw Error();return this.tween(d,function(a,b,c){var d,e;function f(){var f=b.apply(this,arguments);return f!==e&&(d=(e=f)&&function(b){this.style.setProperty(a,f.call(this,b),c)}),d}return f._value=b,f}(a,b,null==c?"":c))},text:function(a){var b,c;return this.tween("text","function"==typeof a?(b=fE(this,"text",a),function(){var a=b(this);this.textContent=null==a?"":a}):(c=null==a?"":a+"",function(){this.textContent=c}))},textTween:function(a){var b="text";if(arguments.length<1)return(b=this.tween(b))&&b._value;if(null==a)return this.tween(b,null);if("function"!=typeof a)throw Error();return this.tween(b,function(a){var b,c;function d(){var d=a.apply(this,arguments);return d!==c&&(b=(c=d)&&function(a){this.textContent=d.call(this,a)}),b}return d._value=a,d}(a))},remove:function(){var a;return this.on("end.remove",(a=this._id,function(){var b=this.parentNode;for(var c in this.__transition)if(+c!==a)return;b&&b.removeChild(this)}))},tween:function(a,b){var c=this._id;if(a+="",arguments.length<2){for(var d,e=fw(this.node(),c).tween,f=0,g=e.length;f<g;++f)if((d=e[f]).name===a)return d.value;return null}return this.each((null==b?function(a,b){var c,d;return function(){var e=fv(this,a),f=e.tween;if(f!==c){d=c=f;for(var g=0,h=d.length;g<h;++g)if(d[g].name===b){(d=d.slice()).splice(g,1);break}}e.tween=d}}:function(a,b,c){var d,e;if("function"!=typeof c)throw Error();return function(){var f=fv(this,a),g=f.tween;if(g!==d){e=(d=g).slice();for(var h={name:b,value:c},i=0,j=e.length;i<j;++i)if(e[i].name===b){e[i]=h;break}i===j&&e.push(h)}f.tween=e}})(c,a,b))},delay:function(a){var b=this._id;return arguments.length?this.each(("function"==typeof a?function(a,b){return function(){fu(this,a).delay=+b.apply(this,arguments)}}:function(a,b){return b*=1,function(){fu(this,a).delay=b}})(b,a)):fw(this.node(),b).delay},duration:function(a){var b=this._id;return arguments.length?this.each(("function"==typeof a?function(a,b){return function(){fv(this,a).duration=+b.apply(this,arguments)}}:function(a,b){return b*=1,function(){fv(this,a).duration=b}})(b,a)):fw(this.node(),b).duration},ease:function(a){var b=this._id;return arguments.length?this.each(function(a,b){if("function"!=typeof b)throw Error();return function(){fv(this,a).ease=b}}(b,a)):fw(this.node(),b).ease},easeVarying:function(a){var b;if("function"!=typeof a)throw Error();return this.each((b=this._id,function(){var c=a.apply(this,arguments);if("function"!=typeof c)throw Error();fv(this,b).ease=c}))},end:function(){var a,b,c=this,d=c._id,e=c.size();return new Promise(function(f,g){var h={value:g},i={value:function(){0==--e&&f()}};c.each(function(){var c=fv(this,d),e=c.on;e!==a&&((b=(a=e).copy())._.cancel.push(h),b._.interrupt.push(h),b._.end.push(i)),c.on=b}),0===e&&f()})},[Symbol.iterator]:gm[Symbol.iterator]};var gn={time:null,delay:0,duration:250,ease:function(a){return((a*=2)<=1?a*a*a:(a-=2)*a*a+2)/2}};function go(a,b,c){this.k=a,this.x=b,this.y=c}e$.prototype.interrupt=function(a){return this.each(function(){!function(a,b){var c,d,e,f=a.__transition,g=!0;if(f){for(e in b=null==b?null:b+"",f){if((c=f[e]).name!==b){g=!1;continue}d=c.state>2&&c.state<5,c.state=6,c.timer.stop(),c.on.call(d?"interrupt":"cancel",a,a.__data__,c.index,c.group),delete f[e]}g&&delete a.__transition}}(this,a)})},e$.prototype.transition=function(a){var b,c;a instanceof gl?(b=a._id,a=a._name):(b=++gk,(c=gn).time=fj(),a=null==a?null:a+"");for(var d=this._groups,e=d.length,f=0;f<e;++f)for(var g,h=d[f],i=h.length,j=0;j<i;++j)(g=h[j])&&ft(g,a,b,j,h,c||function(a,b){for(var c;!(c=a.__transition)||!(c=c[b]);)if(!(a=a.parentNode))throw Error(`transition ${b} not found`);return c}(g,b));return new gl(d,this._parents,a,b)},go.prototype={constructor:go,scale:function(a){return 1===a?this:new go(this.k*a,this.x,this.y)},translate:function(a,b){return 0===a&0===b?this:new go(this.k,this.x+this.k*a,this.y+this.k*b)},apply:function(a){return[a[0]*this.k+this.x,a[1]*this.k+this.y]},applyX:function(a){return a*this.k+this.x},applyY:function(a){return a*this.k+this.y},invert:function(a){return[(a[0]-this.x)/this.k,(a[1]-this.y)/this.k]},invertX:function(a){return(a-this.x)/this.k},invertY:function(a){return(a-this.y)/this.k},rescaleX:function(a){return a.copy().domain(a.range().map(this.invertX,this).map(a.invert,a))},rescaleY:function(a){return a.copy().domain(a.range().map(this.invertY,this).map(a.invert,a))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};new go(1,0,0);go.prototype;let gp=()=>"Only child nodes can use a parent extent.",gq=()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",gr=[[-1/0,-1/0],[1/0,1/0]],gs=["Enter"," ","Escape"],gt={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:a,x:b,y:c})=>`Moved selected node ${a}. New position, x: ${b}, y: ${c}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};(k=v||(v={})).Strict="strict",k.Loose="loose",(l=w||(w={})).Free="free",l.Vertical="vertical",l.Horizontal="horizontal",(m=x||(x={})).Partial="partial",m.Full="full";let gu={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};(n=y||(y={})).Bezier="default",n.Straight="straight",n.Step="step",n.SmoothStep="smoothstep",n.SimpleBezier="simplebezier",(o=z||(z={})).Arrow="arrow",o.ArrowClosed="arrowclosed",(p=A||(A={})).Left="left",p.Top="top",p.Right="right",p.Bottom="bottom";let gv={[A.Left]:A.Right,[A.Right]:A.Left,[A.Top]:A.Bottom,[A.Bottom]:A.Top};function gw(a){return null===a?null:a?"valid":"invalid"}let gx=a=>"id"in a&&"source"in a&&"target"in a,gy=a=>"id"in a&&"internals"in a&&!("source"in a)&&!("target"in a),gz=(a,b=[0,0])=>{let{width:c,height:d}=gZ(a),e=a.origin??b,f=c*e[0],g=d*e[1];return{x:a.position.x-f,y:a.position.y-g}},gA=(a,b={})=>{let c={x:1/0,y:1/0,x2:-1/0,y2:-1/0},d=!1;return a.forEach(a=>{(void 0===b.filter||b.filter(a))&&(c=gI(c,gM(a)),d=!0)}),d?gK(c):{x:0,y:0,width:0,height:0}},gB=(a,b,[c,d,e]=[0,0,1],f=!1,g=!1)=>{let h={...gT(b,[c,d,e]),width:b.width/e,height:b.height/e},i=[];for(let b of a.values()){let{measured:a,selectable:c=!0,hidden:d=!1}=b;if(g&&!c||d)continue;let e=a.width??b.width??b.initialWidth??null,j=a.height??b.height??b.initialHeight??null,k=gO(h,gL(b)),l=(e??0)*(j??0),m=f&&k>0;(!b.internals.handleBounds||m||k>=l||b.dragging)&&i.push(b)}return i};async function gC({nodes:a,width:b,height:c,panZoom:d,minZoom:e,maxZoom:f},g){let h,i;if(0===a.size)return Promise.resolve(!0);let j=gW(gA((h=new Map,i=g?.nodes?new Set(g.nodes.map(a=>a.id)):null,a.forEach(a=>{a.measured.width&&a.measured.height&&(g?.includeHiddenNodes||!a.hidden)&&(!i||i.has(a.id))&&h.set(a.id,a)}),h)),b,c,g?.minZoom??e,g?.maxZoom??f,g?.padding??.1);return await d.setViewport(j,{duration:g?.duration,ease:g?.ease,interpolate:g?.interpolate}),Promise.resolve(!0)}async function gD({nodesToRemove:a=[],edgesToRemove:b=[],nodes:c,edges:d,onBeforeDelete:e}){let f,g=new Set(a.map(a=>a.id)),h=[];for(let a of c){if(!1===a.deletable)continue;let b=g.has(a.id),c=!b&&a.parentId&&h.find(b=>b.id===a.parentId);(b||c)&&h.push(a)}let i=new Set(b.map(a=>a.id)),j=d.filter(a=>!1!==a.deletable),k=(f=new Set,h.forEach(a=>{f.add(a.id)}),j.filter(a=>f.has(a.source)||f.has(a.target)));for(let a of j)i.has(a.id)&&!k.find(b=>b.id===a.id)&&k.push(a);if(!e)return{edges:k,nodes:h};let l=await e({nodes:h,edges:k});return"boolean"==typeof l?l?{edges:k,nodes:h}:{edges:[],nodes:[]}:l}let gE=(a,b=0,c=1)=>Math.min(Math.max(a,b),c),gF=(a={x:0,y:0},b,c)=>({x:gE(a.x,b[0][0],b[1][0]-(c?.width??0)),y:gE(a.y,b[0][1],b[1][1]-(c?.height??0))});function gG(a,b,c){let{width:d,height:e}=gZ(c),{x:f,y:g}=c.internals.positionAbsolute;return gF(a,[[f,g],[f+d,g+e]],b)}let gH=(a,b,c)=>a<b?gE(Math.abs(a-b),1,b)/b:a>c?-gE(Math.abs(a-c),1,b)/b:0,gI=(a,b)=>({x:Math.min(a.x,b.x),y:Math.min(a.y,b.y),x2:Math.max(a.x2,b.x2),y2:Math.max(a.y2,b.y2)}),gJ=({x:a,y:b,width:c,height:d})=>({x:a,y:b,x2:a+c,y2:b+d}),gK=({x:a,y:b,x2:c,y2:d})=>({x:a,y:b,width:c-a,height:d-b}),gL=(a,b=[0,0])=>{let{x:c,y:d}=gy(a)?a.internals.positionAbsolute:gz(a,b);return{x:c,y:d,width:a.measured?.width??a.width??a.initialWidth??0,height:a.measured?.height??a.height??a.initialHeight??0}},gM=(a,b=[0,0])=>{let{x:c,y:d}=gy(a)?a.internals.positionAbsolute:gz(a,b);return{x:c,y:d,x2:c+(a.measured?.width??a.width??a.initialWidth??0),y2:d+(a.measured?.height??a.height??a.initialHeight??0)}},gN=(a,b)=>gK(gI(gJ(a),gJ(b))),gO=(a,b)=>Math.ceil(Math.max(0,Math.min(a.x+a.width,b.x+b.width)-Math.max(a.x,b.x))*Math.max(0,Math.min(a.y+a.height,b.y+b.height)-Math.max(a.y,b.y))),gP=a=>gQ(a.width)&&gQ(a.height)&&gQ(a.x)&&gQ(a.y),gQ=a=>!isNaN(a)&&isFinite(a),gR=(a,b)=>{},gS=(a,b=[1,1])=>({x:b[0]*Math.round(a.x/b[0]),y:b[1]*Math.round(a.y/b[1])}),gT=({x:a,y:b},[c,d,e],f=!1,g=[1,1])=>{let h={x:(a-c)/e,y:(b-d)/e};return f?gS(h,g):h},gU=({x:a,y:b},[c,d,e])=>({x:a*e+c,y:b*e+d});function gV(a,b){if("number"==typeof a)return Math.floor((b-b/(1+a))*.5);if("string"==typeof a&&a.endsWith("px")){let b=parseFloat(a);if(!Number.isNaN(b))return Math.floor(b)}if("string"==typeof a&&a.endsWith("%")){let c=parseFloat(a);if(!Number.isNaN(c))return Math.floor(b*c*.01)}return console.error(`[React Flow] The padding value "${a}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}let gW=(a,b,c,d,e,f)=>{let g=function(a,b,c){if("string"==typeof a||"number"==typeof a){let d=gV(a,c),e=gV(a,b);return{top:d,right:e,bottom:d,left:e,x:2*e,y:2*d}}if("object"==typeof a){let d=gV(a.top??a.y??0,c),e=gV(a.bottom??a.y??0,c),f=gV(a.left??a.x??0,b),g=gV(a.right??a.x??0,b);return{top:d,right:g,bottom:e,left:f,x:f+g,y:d+e}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(f,b,c),h=gE(Math.min((b-g.x)/a.width,(c-g.y)/a.height),d,e),i=a.x+a.width/2,j=a.y+a.height/2,k=b/2-i*h,l=c/2-j*h,m=function(a,b,c,d,e,f){let{x:g,y:h}=gU(a,[b,c,d]),{x:i,y:j}=gU({x:a.x+a.width,y:a.y+a.height},[b,c,d]);return{left:Math.floor(g),top:Math.floor(h),right:Math.floor(e-i),bottom:Math.floor(f-j)}}(a,k,l,h,b,c),n={left:Math.min(m.left-g.left,0),top:Math.min(m.top-g.top,0),right:Math.min(m.right-g.right,0),bottom:Math.min(m.bottom-g.bottom,0)};return{x:k-n.left+n.right,y:l-n.top+n.bottom,zoom:h}},gX=()=>"u">typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function gY(a){return null!=a&&"parent"!==a}function gZ(a){return{width:a.measured?.width??a.width??a.initialWidth??0,height:a.measured?.height??a.height??a.initialHeight??0}}function g$(a){return(a.measured?.width??a.width??a.initialWidth)!==void 0&&(a.measured?.height??a.height??a.initialHeight)!==void 0}function g_(a,b){if(a.size!==b.size)return!1;for(let c of a)if(!b.has(c))return!1;return!0}let g0=a=>({width:a.offsetWidth,height:a.offsetHeight}),g1=a=>a?.getRootNode?.()||window?.document,g2=["INPUT","SELECT","TEXTAREA"],g3=(a,b)=>{let c="clientX"in a,d=c?a.clientX:a.touches?.[0].clientX,e=c?a.clientY:a.touches?.[0].clientY;return{x:d-(b?.left??0),y:e-(b?.top??0)}},g4=(a,b,c,d,e)=>{let f=b.querySelectorAll(`.${a}`);return f&&f.length?Array.from(f).map(b=>{let f=b.getBoundingClientRect();return{id:b.getAttribute("data-handleid"),type:a,nodeId:e,position:b.getAttribute("data-handlepos"),x:(f.left-c.left)/d,y:(f.top-c.top)/d,...g0(b)}}):null};function g5({sourceX:a,sourceY:b,targetX:c,targetY:d,sourceControlX:e,sourceControlY:f,targetControlX:g,targetControlY:h}){let i=.125*a+.375*e+.375*g+.125*c,j=.125*b+.375*f+.375*h+.125*d,k=Math.abs(i-a),l=Math.abs(j-b);return[i,j,k,l]}function g6(a,b){return a>=0?.5*a:25*b*Math.sqrt(-a)}function g7({pos:a,x1:b,y1:c,x2:d,y2:e,c:f}){switch(a){case A.Left:return[b-g6(b-d,f),c];case A.Right:return[b+g6(d-b,f),c];case A.Top:return[b,c-g6(c-e,f)];case A.Bottom:return[b,c+g6(e-c,f)]}}function g8({sourceX:a,sourceY:b,sourcePosition:c=A.Bottom,targetX:d,targetY:e,targetPosition:f=A.Top,curvature:g=.25}){let[h,i]=g7({pos:c,x1:a,y1:b,x2:d,y2:e,c:g}),[j,k]=g7({pos:f,x1:d,y1:e,x2:a,y2:b,c:g}),[l,m,n,o]=g5({sourceX:a,sourceY:b,targetX:d,targetY:e,sourceControlX:h,sourceControlY:i,targetControlX:j,targetControlY:k});return[`M${a},${b} C${h},${i} ${j},${k} ${d},${e}`,l,m,n,o]}function g9({sourceX:a,sourceY:b,targetX:c,targetY:d}){let e=Math.abs(c-a)/2,f=Math.abs(d-b)/2;return[c<a?c+e:c-e,d<b?d+f:d-f,e,f]}let ha=({source:a,sourceHandle:b,target:c,targetHandle:d})=>`xy-edge__${a}${b||""}-${c}${d||""}`;function hb({sourceX:a,sourceY:b,targetX:c,targetY:d}){let[e,f,g,h]=g9({sourceX:a,sourceY:b,targetX:c,targetY:d});return[`M ${a},${b}L ${c},${d}`,e,f,g,h]}let hc={[A.Left]:{x:-1,y:0},[A.Right]:{x:1,y:0},[A.Top]:{x:0,y:-1},[A.Bottom]:{x:0,y:1}},hd=({source:a,sourcePosition:b=A.Bottom,target:c})=>b===A.Left||b===A.Right?a.x<c.x?{x:1,y:0}:{x:-1,y:0}:a.y<c.y?{x:0,y:1}:{x:0,y:-1},he=(a,b)=>Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2));function hf({sourceX:a,sourceY:b,sourcePosition:c=A.Bottom,targetX:d,targetY:e,targetPosition:f=A.Top,borderRadius:g=5,centerX:h,centerY:i,offset:j=20,stepPosition:k=.5}){let[l,m,n,o,p]=function({source:a,sourcePosition:b=A.Bottom,target:c,targetPosition:d=A.Top,center:e,offset:f,stepPosition:g}){let h,i,j=hc[b],k=hc[d],l={x:a.x+j.x*f,y:a.y+j.y*f},m={x:c.x+k.x*f,y:c.y+k.y*f},n=hd({source:l,sourcePosition:b,target:m}),o=0!==n.x?"x":"y",p=n[o],q=[],r={x:0,y:0},s={x:0,y:0},[,,t,u]=g9({sourceX:a.x,sourceY:a.y,targetX:c.x,targetY:c.y});if(j[o]*k[o]==-1){"x"===o?(h=e.x??l.x+(m.x-l.x)*g,i=e.y??(l.y+m.y)/2):(h=e.x??(l.x+m.x)/2,i=e.y??l.y+(m.y-l.y)*g);let a=[{x:h,y:l.y},{x:h,y:m.y}],b=[{x:l.x,y:i},{x:m.x,y:i}];q=j[o]===p?"x"===o?a:b:"x"===o?b:a}else{let e=[{x:l.x,y:m.y}],g=[{x:m.x,y:l.y}];if(q="x"===o?j.x===p?g:e:j.y===p?e:g,b===d){let b=Math.abs(a[o]-c[o]);if(b<=f){let d=Math.min(f-1,f-b);j[o]===p?r[o]=(l[o]>a[o]?-1:1)*d:s[o]=(m[o]>c[o]?-1:1)*d}}if(b!==d){let a="x"===o?"y":"x",b=j[o]===k[a],c=l[a]>m[a],d=l[a]<m[a];(1===j[o]&&(!b&&c||b&&d)||1!==j[o]&&(!b&&d||b&&c))&&(q="x"===o?e:g)}let n={x:l.x+r.x,y:l.y+r.y},t={x:m.x+s.x,y:m.y+s.y};Math.max(Math.abs(n.x-q[0].x),Math.abs(t.x-q[0].x))>=Math.max(Math.abs(n.y-q[0].y),Math.abs(t.y-q[0].y))?(h=(n.x+t.x)/2,i=q[0].y):(h=q[0].x,i=(n.y+t.y)/2)}return[[a,{x:l.x+r.x,y:l.y+r.y},...q,{x:m.x+s.x,y:m.y+s.y},c],h,i,t,u]}({source:{x:a,y:b},sourcePosition:c,target:{x:d,y:e},targetPosition:f,center:{x:h,y:i},offset:j,stepPosition:k});return[l.reduce((a,b,c)=>a+(c>0&&c<l.length-1?function(a,b,c,d){let e=Math.min(he(a,b)/2,he(b,c)/2,d),{x:f,y:g}=b;if(a.x===f&&f===c.x||a.y===g&&g===c.y)return`L${f} ${g}`;if(a.y===g){let b=a.x<c.x?-1:1,d=a.y<c.y?1:-1;return`L ${f+e*b},${g}Q ${f},${g} ${f},${g+e*d}`}let h=a.x<c.x?1:-1,i=a.y<c.y?-1:1;return`L ${f},${g+e*i}Q ${f},${g} ${f+e*h},${g}`}(l[c-1],b,l[c+1],g):`${0===c?"M":"L"}${b.x} ${b.y}`),""),m,n,o,p]}function hg(a){return a&&!!(a.internals.handleBounds||a.handles?.length)&&!!(a.measured.width||a.width||a.initialWidth)}function hh(a){if(!a)return null;let b=[],c=[];for(let d of a)d.width=d.width??1,d.height=d.height??1,"source"===d.type?b.push(d):"target"===d.type&&c.push(d);return{source:b,target:c}}function hi(a,b,c=A.Left,d=!1){let e=(b?.x??0)+a.internals.positionAbsolute.x,f=(b?.y??0)+a.internals.positionAbsolute.y,{width:g,height:h}=b??gZ(a);if(d)return{x:e+g/2,y:f+h/2};switch(b?.position??c){case A.Top:return{x:e+g/2,y:f};case A.Right:return{x:e+g,y:f+h/2};case A.Bottom:return{x:e+g/2,y:f+h};case A.Left:return{x:e,y:f+h/2}}}function hj(a,b){return a&&(b?a.find(a=>a.id===b):a[0])||null}function hk(a,b){if(!a)return"";if("string"==typeof a)return a;let c=b?`${b}__`:"";return`${c}${Object.keys(a).sort().map(b=>`${b}=${a[b]}`).join("&")}`}let hl={nodeOrigin:[0,0],nodeExtent:gr,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},hm={...hl,checkEquality:!0};function hn(a,b){let c={...a};for(let a in b)void 0!==b[a]&&(c[a]=b[a]);return c}function ho(a){return"manual"===a}function hp(a,b,c,d={}){let e=hn(hm,d),f={i:0},g=new Map(b),h=e?.elevateNodesOnSelect&&!ho(e.zIndexMode)?1e3:0,i=a.length>0;for(let j of(b.clear(),c.clear(),a)){let a=g.get(j.id);if(e.checkEquality&&j===a?.internals.userNode)b.set(j.id,a);else{let c=gF(gz(j,e.nodeOrigin),gY(j.extent)?j.extent:e.nodeExtent,gZ(j));a={...e.defaults,...j,measured:{width:j.measured?.width,height:j.measured?.height},internals:{positionAbsolute:c,handleBounds:function(a,b){if(!a.handles)return a.measured?b?.internals.handleBounds:void 0;let c=[],d=[];for(let b of a.handles){let e={id:b.id,width:b.width??1,height:b.height??1,nodeId:a.id,x:b.x,y:b.y,position:b.position,type:b.type};"source"===b.type?c.push(e):"target"===b.type&&d.push(e)}return{source:c,target:d}}(j,a),z:hr(j,h,e.zIndexMode),userNode:j}},b.set(j.id,a)}void 0!==a.measured&&void 0!==a.measured.width&&void 0!==a.measured.height||a.hidden||(i=!1),j.parentId&&hq(a,b,c,d,f)}return i}function hq(a,b,c,d,e){let{elevateNodesOnSelect:f,nodeOrigin:g,nodeExtent:h,zIndexMode:i}=hn(hl,d),j=a.parentId,k=b.get(j);if(!k)return void console.warn(`Parent node ${j} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(a,b){if(!a.parentId)return;let c=b.get(a.parentId);c?c.set(a.id,a):b.set(a.parentId,new Map([[a.id,a]]))}(a,c),e&&!k.parentId&&void 0===k.internals.rootParentIndex&&"auto"===i&&(k.internals.rootParentIndex=++e.i,k.internals.z=k.internals.z+10*e.i),e&&void 0!==k.internals.rootParentIndex&&(e.i=k.internals.rootParentIndex);let{x:l,y:m,z:n}=function(a,b,c,d,e,f){let{x:g,y:h}=b.internals.positionAbsolute,i=gZ(a),j=gz(a,c),k=gY(a.extent)?gF(j,a.extent,i):j,l=gF({x:g+k.x,y:h+k.y},d,i);"parent"===a.extent&&(l=gG(l,i,b));let m=hr(a,e,f),n=b.internals.z??0;return{x:l.x,y:l.y,z:n>=m?n+1:m}}(a,k,g,h,f&&!ho(i)?1e3:0,i),{positionAbsolute:o}=a.internals,p=l!==o.x||m!==o.y;(p||n!==a.internals.z)&&b.set(a.id,{...a,internals:{...a.internals,positionAbsolute:p?{x:l,y:m}:o,z:n}})}function hr(a,b,c){let d=gQ(a.zIndex)?a.zIndex:0;return ho(c)?d:d+(a.selected?b:0)}function hs(a,b,c,d=[0,0]){let e=[],f=new Map;for(let c of a){let a=b.get(c.parentId);if(!a)continue;let d=gN(f.get(c.parentId)?.expandedRect??gL(a),c.rect);f.set(c.parentId,{expandedRect:d,parent:a})}return f.size>0&&f.forEach(({expandedRect:b,parent:f},g)=>{let h=f.internals.positionAbsolute,i=gZ(f),j=f.origin??d,k=b.x<h.x?Math.round(Math.abs(h.x-b.x)):0,l=b.y<h.y?Math.round(Math.abs(h.y-b.y)):0,m=Math.max(i.width,Math.round(b.width)),n=Math.max(i.height,Math.round(b.height)),o=(m-i.width)*j[0],p=(n-i.height)*j[1];(k>0||l>0||o||p)&&(e.push({id:g,type:"position",position:{x:f.position.x-k+o,y:f.position.y-l+p}}),c.get(g)?.forEach(b=>{a.some(a=>a.id===b.id)||e.push({id:b.id,type:"position",position:{x:b.position.x+k,y:b.position.y+l}})})),(i.width<b.width||i.height<b.height||k||l)&&e.push({id:g,type:"dimensions",setAttributes:!0,dimensions:{width:m+(k?j[0]*k-o:0),height:n+(l?j[1]*l-p:0)}})}),e}async function ht({delta:a,panZoom:b,transform:c,translateExtent:d,width:e,height:f}){if(!b||!a.x&&!a.y)return Promise.resolve(!1);let g=await b.setViewportConstrained({x:c[0]+a.x,y:c[1]+a.y,zoom:c[2]},[[0,0],[e,f]],d);return Promise.resolve(!!g&&(g.x!==c[0]||g.y!==c[1]||g.k!==c[2]))}function hu(a,b,c,d,e,f){let g=e,h=d.get(g)||new Map;d.set(g,h.set(c,b)),g=`${e}-${a}`;let i=d.get(g)||new Map;if(d.set(g,i.set(c,b)),f){g=`${e}-${a}-${f}`;let h=d.get(g)||new Map;d.set(g,h.set(c,b))}}function hv(a,b,c){for(let d of(a.clear(),b.clear(),c)){let{source:c,target:e,sourceHandle:f=null,targetHandle:g=null}=d,h={edgeId:d.id,source:c,target:e,sourceHandle:f,targetHandle:g},i=`${c}-${f}--${e}-${g}`;hu("source",h,`${e}-${g}--${c}-${f}`,a,c,f),hu("target",h,i,a,e,g),b.set(d.id,d)}}function hw(a,b,c,d,e,f=!1){let g=d.get(a);if(!g)return null;let h="strict"===e?g.internals.handleBounds?.[b]:[...g.internals.handleBounds?.source??[],...g.internals.handleBounds?.target??[]],i=(c?h?.find(a=>a.id===c):h?.[0])??null;return i&&f?{...i,...hi(g,i,i.position,!0)}:i}function hx(a,b){return a?a:b?.classList.contains("target")?"target":b?.classList.contains("source")?"source":null}let hy=()=>!0;function hz(a,{handle:b,connectionMode:c,fromNodeId:d,fromHandleId:e,fromType:f,doc:g,lib:h,flowId:i,isValidConnection:j=hy,nodeLookup:k}){let l="target"===f,m=b?g.querySelector(`.${h}-flow__handle[data-id="${i}-${b?.nodeId}-${b?.id}-${b?.type}"]`):null,{x:n,y:o}=g3(a),p=g.elementFromPoint(n,o),q=p?.classList.contains(`${h}-flow__handle`)?p:m,r={handleDomNode:q,isValid:!1,connection:null,toHandle:null};if(q){let a=hx(void 0,q),b=q.getAttribute("data-nodeid"),f=q.getAttribute("data-handleid"),g=q.classList.contains("connectable"),h=q.classList.contains("connectableend");if(!b||!a)return r;let i={source:l?b:d,sourceHandle:l?f:e,target:l?d:b,targetHandle:l?e:f};r.connection=i,r.isValid=g&&h&&(c===v.Strict?l&&"source"===a||!l&&"target"===a:b!==d||f!==e)&&j(i),r.toHandle=hw(b,a,f,k,c,!0)}return r}let hA=function(a,{connectionMode:b,connectionRadius:c,handleId:d,nodeId:e,edgeUpdaterType:f,isTarget:g,domNode:h,nodeLookup:i,lib:j,autoPanOnConnect:k,flowId:l,panBy:m,cancelConnection:n,onConnectStart:o,onConnect:p,onConnectEnd:q,isValidConnection:r=hy,onReconnectEnd:s,updateConnection:t,getTransform:u,getFromHandle:v,autoPanSpeed:w,dragThreshold:x=1,handleDomNode:y}){let z,B=g1(a.target),C=0,{x:D,y:E}=g3(a),F=hx(f,y),G=h?.getBoundingClientRect(),H=!1;if(!G||!F)return;let I=hw(e,F,d,i,b);if(!I)return;let J=g3(a,G),K=!1,L=null,M=!1,N=null,O={...I,nodeId:e,type:F,position:I.position},P=i.get(e),Q={inProgress:!0,isValid:null,from:hi(P,O,A.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:P,to:J,toHandle:null,toPosition:gv[O.position],toNode:null,pointer:J};function R(){H=!0,t(Q),o?.(a,{nodeId:e,handleId:d,handleType:F})}function S(a){var f,h;let n;if(!H){let{x:b,y:c}=g3(a),d=b-D,e=c-E;if(!(d*d+e*e>x*x))return;R()}if(!v()||!O)return void T(a);let o=u();z=function(a,b,c,d){let e=[],f=1/0;for(let g of function(a,b,c){let d=[],e={x:a.x-c,y:a.y-c,width:2*c,height:2*c};for(let a of b.values())gO(e,gL(a))>0&&d.push(a);return d}(a,c,b+250))for(let c of[...g.internals.handleBounds?.source??[],...g.internals.handleBounds?.target??[]]){if(d.nodeId===c.nodeId&&d.type===c.type&&d.id===c.id)continue;let{x:h,y:i}=hi(g,c,c.position,!0),j=Math.sqrt(Math.pow(h-a.x,2)+Math.pow(i-a.y,2));j>b||(j<f?(e=[{...c,x:h,y:i}],f=j):j===f&&e.push({...c,x:h,y:i}))}if(!e.length)return null;if(e.length>1){let a="source"===d.type?"target":"source";return e.find(b=>b.type===a)??e[0]}return e[0]}(gT(J=g3(a,G),o,!1,[1,1]),c,i,O),K||(!function a(){if(!k||!G)return;let[b,c]=((a,b,c=15,d=40)=>[gH(a.x,d,b.width-d)*c,gH(a.y,d,b.height-d)*c])(J,G,w);m({x:b,y:c}),C=requestAnimationFrame(a)}(),K=!0);let p=hz(a,{handle:z,connectionMode:b,fromNodeId:e,fromHandleId:d,fromType:g?"target":"source",isValidConnection:r,doc:B,lib:j,flowId:l,nodeLookup:i});N=p.handleDomNode,L=p.connection,f=!!z,h=p.isValid,n=null,h?n=!0:f&&!h&&(n=!1),M=n;let q=i.get(e),s=q?hi(q,O,A.Left,!0):Q.from,y={...Q,from:s,isValid:M,to:p.toHandle&&M?gU({x:p.toHandle.x,y:p.toHandle.y},o):J,toHandle:p.toHandle,toPosition:M&&p.toHandle?p.toHandle.position:gv[O.position],toNode:p.toHandle?i.get(p.toHandle.nodeId):null,pointer:J};t(y),Q=y}function T(a){if(!("touches"in a)||!(a.touches.length>0)){if(H){(z||N)&&L&&M&&p?.(L);let{inProgress:b,...c}=Q,d={...c,toPosition:Q.toHandle?Q.toPosition:null};q?.(a,d),f&&s?.(a,d)}n(),cancelAnimationFrame(C),K=!1,M=!1,L=null,N=null,B.removeEventListener("mousemove",S),B.removeEventListener("mouseup",T),B.removeEventListener("touchmove",S),B.removeEventListener("touchend",T)}}0===x&&R(),B.addEventListener("mousemove",S),B.addEventListener("mouseup",T),B.addEventListener("touchmove",S),B.addEventListener("touchend",T)};(q=B||(B={})).Line="line",q.Handle="handle";var hB=c(7055);let hC=a=>{let b,c=new Set,d=(a,d)=>{let e="function"==typeof a?a(b):a;if(!Object.is(e,b)){let a=b;b=(null!=d?d:"object"!=typeof e||null===e)?e:Object.assign({},b,e),c.forEach(c=>c(b,a))}},e=()=>b,f={setState:d,getState:e,getInitialState:()=>g,subscribe:a=>(c.add(a),()=>c.delete(a)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),c.clear()}},g=b=a(d,e,f);return f},{useDebugValue:hD}=E,{useSyncExternalStoreWithSelector:hE}=hB,hF=a=>a;function hG(a,b=hF,c){let d=hE(a.subscribe,a.getState,a.getServerState||a.getInitialState,b,c);return hD(d),d}let hH=(a,b)=>{let c=a?hC(a):hC,d=(a,d=b)=>hG(c,a,d);return Object.assign(d,c),d};function hI(a,b){if(Object.is(a,b))return!0;if("object"!=typeof a||null===a||"object"!=typeof b||null===b)return!1;if(a instanceof Map&&b instanceof Map){if(a.size!==b.size)return!1;for(let[c,d]of a)if(!Object.is(d,b.get(c)))return!1;return!0}if(a instanceof Set&&b instanceof Set){if(a.size!==b.size)return!1;for(let c of a)if(!b.has(c))return!1;return!0}let c=Object.keys(a);if(c.length!==Object.keys(b).length)return!1;for(let d of c)if(!Object.prototype.hasOwnProperty.call(b,d)||!Object.is(a[d],b[d]))return!1;return!0}let hJ=(0,E.createContext)(null),hK=hJ.Provider,hL="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function hM(a,b){let c=(0,E.useContext)(hJ);if(null===c)throw Error(hL);return hG(c,a,b)}function hN(){let a=(0,E.useContext)(hJ);if(null===a)throw Error(hL);return(0,E.useMemo)(()=>({getState:a.getState,setState:a.setState,subscribe:a.subscribe}),[a])}let hO={display:"none"},hP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},hQ="react-flow__node-desc",hR="react-flow__edge-desc",hS=a=>a.ariaLiveMessage,hT=a=>a.ariaLabelConfig;function hU({rfId:a}){let b=hM(hS);return(0,D.jsx)("div",{id:`react-flow__aria-live-${a}`,"aria-live":"assertive","aria-atomic":"true",style:hP,children:b})}function hV({rfId:a,disableKeyboardA11y:b}){let c=hM(hT);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("div",{id:`${hQ}-${a}`,style:hO,children:b?c["node.a11yDescription.default"]:c["node.a11yDescription.keyboardDisabled"]}),(0,D.jsx)("div",{id:`${hR}-${a}`,style:hO,children:c["edge.a11yDescription.default"]}),!b&&(0,D.jsx)(hU,{rfId:a})]})}let hW=(0,E.forwardRef)(({position:a="top-left",children:b,className:c,style:d,...e},f)=>{let g=`${a}`.split("-");return(0,D.jsx)("div",{className:eh(["react-flow__panel",c,...g]),style:d,ref:f,...e,children:b})});function hX({proOptions:a,position:b="bottom-right"}){return a?.hideAttribution?null:(0,D.jsx)(hW,{position:b,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:(0,D.jsx)("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}hW.displayName="Panel";let hY=a=>{let b=[],c=[];for(let[,c]of a.nodeLookup)c.selected&&b.push(c.internals.userNode);for(let[,b]of a.edgeLookup)b.selected&&c.push(b);return{selectedNodes:b,selectedEdges:c}},hZ=a=>a.id;function h$(a,b){return hI(a.selectedNodes.map(hZ),b.selectedNodes.map(hZ))&&hI(a.selectedEdges.map(hZ),b.selectedEdges.map(hZ))}function h_({onSelectionChange:a}){hN();let{selectedNodes:b,selectedEdges:c}=hM(hY,h$);return null}let h0=a=>!!a.onSelectionChangeHandlers;function h1({onSelectionChange:a}){let b=hM(h0);return a||b?(0,D.jsx)(h_,{onSelectionChange:a}):null}let h2=[0,0],h3={x:0,y:0,zoom:1},h4=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode","rfId"],h5=a=>({setNodes:a.setNodes,setEdges:a.setEdges,setMinZoom:a.setMinZoom,setMaxZoom:a.setMaxZoom,setTranslateExtent:a.setTranslateExtent,setNodeExtent:a.setNodeExtent,reset:a.reset,setDefaultNodesAndEdges:a.setDefaultNodesAndEdges}),h6={translateExtent:gr,nodeOrigin:h2,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function h7(a){let{setNodes:b,setEdges:c,setMinZoom:d,setMaxZoom:e,setTranslateExtent:f,setNodeExtent:g,reset:h,setDefaultNodesAndEdges:i}=hM(h5,hI),j=hN(),k=(0,E.useRef)(h6);return(0,E.useEffect)(()=>{for(let h of h4){let i=a[h];if(i!==k.current[h]&&void 0!==a[h])if("nodes"===h)b(i);else if("edges"===h)c(i);else if("minZoom"===h)d(i);else if("maxZoom"===h)e(i);else if("translateExtent"===h)f(i);else if("nodeExtent"===h)g(i);else if("ariaLabelConfig"===h)j.setState({ariaLabelConfig:{...gt,...i||{}}});else"fitView"===h?j.setState({fitViewQueued:i}):"fitViewOptions"===h?j.setState({fitViewOptions:i}):j.setState({[h]:i})}k.current=a},h4.map(b=>a[b])),null}let h8="u">typeof document?document:null;function h9(a=null,b={target:h8,actInsideInputWithModifier:!0}){let[c,d]=(0,E.useState)(!1);(0,E.useRef)(!1),(0,E.useRef)(new Set([]));let[e,f]=(0,E.useMemo)(()=>{if(null!==a){let b=(Array.isArray(a)?a:[a]).filter(a=>"string"==typeof a).map(a=>a.replace("+","\n").replace("\n\n","\n+").split("\n")),c=b.reduce((a,b)=>a.concat(...b),[]);return[b,c]}return[[],[]]},[a]);return c}function ia(a,b){let c=[],d=new Map,e=[];for(let b of a)if("add"===b.type){e.push(b);continue}else if("remove"===b.type||"replace"===b.type)d.set(b.id,[b]);else{let a=d.get(b.id);a?a.push(b):d.set(b.id,[b])}for(let a of b){let b=d.get(a.id);if(!b){c.push(a);continue}if("remove"===b[0].type)continue;if("replace"===b[0].type){c.push({...b[0].item});continue}let e={...a};for(let a of b){var f=a,g=e;switch(f.type){case"select":g.selected=f.selected;break;case"position":void 0!==f.position&&(g.position=f.position),void 0!==f.dragging&&(g.dragging=f.dragging);break;case"dimensions":void 0!==f.dimensions&&(g.measured={...f.dimensions},f.setAttributes&&((!0===f.setAttributes||"width"===f.setAttributes)&&(g.width=f.dimensions.width),(!0===f.setAttributes||"height"===f.setAttributes)&&(g.height=f.dimensions.height))),"boolean"==typeof f.resizing&&(g.resizing=f.resizing)}}c.push(e)}return e.length&&e.forEach(a=>{void 0!==a.index?c.splice(a.index,0,{...a.item}):c.push({...a.item})}),c}function ib(a,b){return{id:a,type:"select",selected:b}}function ic(a,b=new Set,c=!1){let d=[];for(let[e,f]of a){let a=b.has(e);(void 0!==f.selected||a)&&f.selected!==a&&(c&&(f.selected=a),d.push(ib(f.id,a)))}return d}function id({items:a=[],lookup:b}){let c=[],d=new Map(a.map(a=>[a.id,a]));for(let[d,e]of a.entries()){let a=b.get(e.id),f=a?.internals?.userNode??a;void 0!==f&&f!==e&&c.push({id:e.id,item:e,type:"replace"}),void 0===f&&c.push({item:e,type:"add",index:d})}for(let[a]of b)void 0===d.get(a)&&c.push({id:a,type:"remove"});return c}function ie(a){return{id:a.id,type:"remove"}}let ig=a=>"id"in a&&"position"in a&&!("source"in a)&&!("target"in a);function ih(a){return(0,E.forwardRef)(a)}let ii=E.useEffect;function ij(a){let[b,c]=(0,E.useState)(BigInt(0)),[d]=(0,E.useState)(()=>{var a;let b;return a=()=>c(a=>a+BigInt(1)),b=[],{get:()=>b,reset:()=>{b=[]},push:c=>{b.push(c),a()}}});return ii(()=>{let b=d.get();b.length&&(a(b),d.reset())},[b]),d}let ik=(0,E.createContext)(null);function il({children:a}){let b=hN(),c=ij((0,E.useCallback)(a=>{let{nodes:c=[],setNodes:d,hasDefaultNodes:e,onNodesChange:f,nodeLookup:g,fitViewQueued:h,onNodesChangeMiddlewareMap:i}=b.getState(),j=c;for(let b of a)j="function"==typeof b?b(j):b;let k=id({items:j,lookup:g});for(let a of i.values())k=a(k);e&&d(j),k.length>0?f?.(k):h&&window.requestAnimationFrame(()=>{let{fitViewQueued:a,nodes:c,setNodes:d}=b.getState();a&&d(c)})},[])),d=ij((0,E.useCallback)(a=>{let{edges:c=[],setEdges:d,hasDefaultEdges:e,onEdgesChange:f,edgeLookup:g}=b.getState(),h=c;for(let b of a)h="function"==typeof b?b(h):b;e?d(h):f&&f(id({items:h,lookup:g}))},[])),e=(0,E.useMemo)(()=>({nodeQueue:c,edgeQueue:d}),[]);return(0,D.jsx)(ik.Provider,{value:e,children:a})}let im=a=>!!a.panZoom;function io(){let a,b=(a=hN(),(0,E.useMemo)(()=>({zoomIn:b=>{let{panZoom:c}=a.getState();return c?c.scaleBy(1.2,{duration:b?.duration}):Promise.resolve(!1)},zoomOut:b=>{let{panZoom:c}=a.getState();return c?c.scaleBy(1/1.2,{duration:b?.duration}):Promise.resolve(!1)},zoomTo:(b,c)=>{let{panZoom:d}=a.getState();return d?d.scaleTo(b,{duration:c?.duration}):Promise.resolve(!1)},getZoom:()=>a.getState().transform[2],setViewport:async(b,c)=>{let{transform:[d,e,f],panZoom:g}=a.getState();return g?(await g.setViewport({x:b.x??d,y:b.y??e,zoom:b.zoom??f},c),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{let[b,c,d]=a.getState().transform;return{x:b,y:c,zoom:d}},setCenter:async(b,c,d)=>a.getState().setCenter(b,c,d),fitBounds:async(b,c)=>{let{width:d,height:e,minZoom:f,maxZoom:g,panZoom:h}=a.getState(),i=gW(b,d,e,f,g,c?.padding??.1);return h?(await h.setViewport(i,{duration:c?.duration,ease:c?.ease,interpolate:c?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(b,c={})=>{let{transform:d,snapGrid:e,snapToGrid:f,domNode:g}=a.getState();if(!g)return b;let{x:h,y:i}=g.getBoundingClientRect(),j={x:b.x-h,y:b.y-i},k=c.snapGrid??e;return gT(j,d,c.snapToGrid??f,k)},flowToScreenPosition:b=>{let{transform:c,domNode:d}=a.getState();if(!d)return b;let{x:e,y:f}=d.getBoundingClientRect(),g=gU(b,c);return{x:g.x+e,y:g.y+f}}}),[])),c=hN(),d=function(){let a=(0,E.useContext)(ik);if(!a)throw Error("useBatchContext must be used within a BatchProvider");return a}(),e=hM(im),f=(0,E.useMemo)(()=>{let a=a=>c.getState().nodeLookup.get(a),b=a=>{d.nodeQueue.push(a)},e=a=>{d.edgeQueue.push(a)},f=a=>{let{nodeLookup:b,nodeOrigin:d}=c.getState(),e=ig(a)?a:b.get(a.id),f=e.parentId?function(a,b={width:0,height:0},c,d,e){let f={...a},g=d.get(c);if(g){let a=g.origin||e;f.x+=g.internals.positionAbsolute.x-(b.width??0)*a[0],f.y+=g.internals.positionAbsolute.y-(b.height??0)*a[1]}return f}(e.position,e.measured,e.parentId,b,d):e.position;return gL({...e,position:f,width:e.measured?.width??e.width,height:e.measured?.height??e.height})},g=(a,c,d={replace:!1})=>{b(b=>b.map(b=>{if(b.id===a){let a="function"==typeof c?c(b):c;return d.replace&&ig(a)?a:{...b,...a}}return b}))},h=(a,b,c={replace:!1})=>{e(d=>d.map(d=>{if(d.id===a){let a="function"==typeof b?b(d):b;return c.replace&&gx(a)?a:{...d,...a}}return d}))};return{getNodes:()=>c.getState().nodes.map(a=>({...a})),getNode:b=>a(b)?.internals.userNode,getInternalNode:a,getEdges:()=>{let{edges:a=[]}=c.getState();return a.map(a=>({...a}))},getEdge:a=>c.getState().edgeLookup.get(a),setNodes:b,setEdges:e,addNodes:a=>{let b=Array.isArray(a)?a:[a];d.nodeQueue.push(a=>[...a,...b])},addEdges:a=>{let b=Array.isArray(a)?a:[a];d.edgeQueue.push(a=>[...a,...b])},toObject:()=>{let{nodes:a=[],edges:b=[],transform:d}=c.getState(),[e,f,g]=d;return{nodes:a.map(a=>({...a})),edges:b.map(a=>({...a})),viewport:{x:e,y:f,zoom:g}}},deleteElements:async({nodes:a=[],edges:b=[]})=>{let{nodes:d,edges:e,onNodesDelete:f,onEdgesDelete:g,triggerNodeChanges:h,triggerEdgeChanges:i,onDelete:j,onBeforeDelete:k}=c.getState(),{nodes:l,edges:m}=await gD({nodesToRemove:a,edgesToRemove:b,nodes:d,edges:e,onBeforeDelete:k}),n=m.length>0,o=l.length>0;if(n){let a=m.map(ie);g?.(m),i(a)}if(o){let a=l.map(ie);f?.(l),h(a)}return(o||n)&&j?.({nodes:l,edges:m}),{deletedNodes:l,deletedEdges:m}},getIntersectingNodes:(a,b=!0,d)=>{let e=gP(a),g=e?a:f(a),h=void 0!==d;return g?(d||c.getState().nodes).filter(d=>{let f=c.getState().nodeLookup.get(d.id);if(f&&!e&&(d.id===a.id||!f.internals.positionAbsolute))return!1;let i=gL(h?d:f),j=gO(i,g);return b&&j>0||j>=i.width*i.height||j>=g.width*g.height}):[]},isNodeIntersecting:(a,b,c=!0)=>{let d=gP(a)?a:f(a);if(!d)return!1;let e=gO(d,b);return c&&e>0||e>=b.width*b.height||e>=d.width*d.height},updateNode:g,updateNodeData:(a,b,c={replace:!1})=>{g(a,a=>{let d="function"==typeof b?b(a):b;return c.replace?{...a,data:d}:{...a,data:{...a.data,...d}}},c)},updateEdge:h,updateEdgeData:(a,b,c={replace:!1})=>{h(a,a=>{let d="function"==typeof b?b(a):b;return c.replace?{...a,data:d}:{...a,data:{...a.data,...d}}},c)},getNodesBounds:a=>{let{nodeLookup:b,nodeOrigin:d}=c.getState();return((a,b={nodeOrigin:[0,0]})=>0===a.length?{x:0,y:0,width:0,height:0}:gK(a.reduce((a,c)=>{let d="string"==typeof c,e=b.nodeLookup||d?void 0:c;return b.nodeLookup&&(e=d?b.nodeLookup.get(c):gy(c)?c:b.nodeLookup.get(c.id)),gI(a,e?gM(e,b.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})))(a,{nodeLookup:b,nodeOrigin:d})},getHandleConnections:({type:a,id:b,nodeId:d})=>Array.from(c.getState().connectionLookup.get(`${d}-${a}${b?`-${b}`:""}`)?.values()??[]),getNodeConnections:({type:a,handleId:b,nodeId:d})=>Array.from(c.getState().connectionLookup.get(`${d}${a?b?`-${a}-${b}`:`-${a}`:""}`)?.values()??[]),fitView:async a=>{let b,e,f=c.getState().fitViewResolver??{promise:new Promise((a,c)=>{b=a,e=c}),resolve:b,reject:e};return c.setState({fitViewQueued:!0,fitViewOptions:a,fitViewResolver:f}),d.nodeQueue.push(a=>[...a]),f.promise}}},[]);return(0,E.useMemo)(()=>({...f,...b,viewportInitialized:e}),[e])}let ip,iq={position:"absolute",width:"100%",height:"100%",top:0,left:0},ir=a=>({userSelectionActive:a.userSelectionActive,lib:a.lib,connectionInProgress:a.connection.inProgress});function is({onPaneContextMenu:a,zoomOnScroll:b=!0,zoomOnPinch:c=!0,panOnScroll:d=!1,panOnScrollSpeed:e=.5,panOnScrollMode:f=w.Free,zoomOnDoubleClick:g=!0,panOnDrag:h=!0,defaultViewport:i,translateExtent:j,minZoom:k,maxZoom:l,zoomActivationKeyCode:m,preventScrolling:n=!0,children:o,noWheelClassName:p,noPanClassName:q,onViewportChange:r,isControlledViewport:s,paneClickDistance:t,selectionOnDrag:u}){let v=hN(),x=(0,E.useRef)(null),{userSelectionActive:y,lib:z,connectionInProgress:A}=hM(ir,hI);return h9(m),(0,E.useRef)(),hN(),(0,E.useCallback)(a=>{r?.({x:a[0],y:a[1],zoom:a[2]}),s||v.setState({transform:a})},[r,s]),(0,D.jsx)("div",{className:"react-flow__renderer",ref:x,style:iq,children:o})}let it=a=>({userSelectionActive:a.userSelectionActive,userSelectionRect:a.userSelectionRect});function iu(){let{userSelectionActive:a,userSelectionRect:b}=hM(it,hI);return a&&b?(0,D.jsx)("div",{className:"react-flow__selection react-flow__container",style:{width:b.width,height:b.height,transform:`translate(${b.x}px, ${b.y}px)`}}):null}let iv=(a,b)=>c=>{c.target===b.current&&a?.(c)},iw=a=>({userSelectionActive:a.userSelectionActive,elementsSelectable:a.elementsSelectable,connectionInProgress:a.connection.inProgress,dragging:a.paneDragging});function ix({isSelecting:a,selectionKeyPressed:b,selectionMode:c=x.Full,panOnDrag:d,paneClickDistance:e,selectionOnDrag:f,onSelectionStart:g,onSelectionEnd:h,onPaneClick:i,onPaneContextMenu:j,onPaneScroll:k,onPaneMouseEnter:l,onPaneMouseMove:m,onPaneMouseLeave:n,children:o}){let p=hN(),{userSelectionActive:q,elementsSelectable:r,dragging:s,connectionInProgress:t}=hM(iw,hI),u=r&&(a||q),v=(0,E.useRef)(null),w=(0,E.useRef)(),y=(0,E.useRef)(new Set),z=(0,E.useRef)(new Set),A=(0,E.useRef)(!1),B=a=>{if(A.current||t){A.current=!1;return}i?.(a),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},C=!0===d||Array.isArray(d)&&d.includes(0);return(0,D.jsxs)("div",{className:eh(["react-flow__pane",{draggable:C,dragging:s,selection:a}]),onClick:u?void 0:iv(B,v),onContextMenu:iv(a=>{Array.isArray(d)&&d?.includes(2)?a.preventDefault():j?.(a)},v),onWheel:iv(k?a=>k(a):void 0,v),onPointerEnter:u?void 0:l,onPointerMove:u?a=>{let{userSelectionRect:d,transform:f,nodeLookup:h,edgeLookup:i,connectionLookup:j,triggerNodeChanges:k,triggerEdgeChanges:l,defaultEdgeOptions:m,resetSelectedElements:n}=p.getState();if(!w.current||!d)return;let{x:o,y:q}=g3(a.nativeEvent,w.current),{startX:r,startY:s}=d;if(!A.current){if(Math.hypot(o-r,q-s)<=(b?0:e))return;n(),g?.(a)}A.current=!0;let t={startX:r,startY:s,x:o<r?o:r,y:q<s?q:s,width:Math.abs(o-r),height:Math.abs(q-s)},u=y.current,v=z.current;y.current=new Set(gB(h,t,f,c===x.Partial,!0).map(a=>a.id)),z.current=new Set;let B=m?.selectable??!0;for(let a of y.current){let b=j.get(a);if(b)for(let{edgeId:a}of b.values()){let b=i.get(a);b&&(b.selectable??B)&&z.current.add(a)}}g_(u,y.current)||k(ic(h,y.current,!0)),g_(v,z.current)||l(ic(i,z.current)),p.setState({userSelectionRect:t,userSelectionActive:!0,nodesSelectionActive:!1})}:m,onPointerUp:u?a=>{0===a.button&&(a.target?.releasePointerCapture?.(a.pointerId),!q&&a.target===v.current&&p.getState().userSelectionRect&&B?.(a),p.setState({userSelectionActive:!1,userSelectionRect:null}),A.current&&(h?.(a),p.setState({nodesSelectionActive:y.current.size>0})))}:void 0,onPointerDownCapture:u?c=>{let{domNode:d}=p.getState();if(w.current=d?.getBoundingClientRect(),!w.current)return;let e=c.target===v.current;if(!e&&c.target.closest(".nokey")||!a||!(f&&e||b)||0!==c.button||!c.isPrimary)return;c.target?.setPointerCapture?.(c.pointerId),A.current=!1;let{x:g,y:h}=g3(c.nativeEvent,w.current);p.setState({userSelectionRect:{width:0,height:0,startX:g,startY:h,x:g,y:h}}),e||(c.stopPropagation(),c.preventDefault())}:void 0,onClickCapture:u?a=>{A.current&&(a.stopPropagation(),A.current=!1)}:void 0,onPointerLeave:n,ref:v,style:iq,children:[o,(0,D.jsx)(iu,{})]})}function iy({id:a,store:b,unselect:c=!1,nodeRef:d}){let e,{addSelectedNodes:f,unselectNodesAndEdges:g,multiSelectionActive:h,nodeLookup:i,onError:j}=b.getState(),k=i.get(a);k?(b.setState({nodesSelectionActive:!1}),k.selected?(c||k.selected&&h)&&(g({nodes:[k],edges:[]}),requestAnimationFrame(()=>d?.current?.blur())):f([a])):j?.("012",(e=a,`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`))}function iz({nodeRef:a,disabled:b=!1,noDragClassName:c,handleSelector:d,nodeId:e,isSelectable:f,nodeClickDistance:g}){hN();let[h,i]=(0,E.useState)(!1);return(0,E.useRef)(),h}function iA(){let a=hN();return(0,E.useCallback)(b=>{let{nodeExtent:c,snapToGrid:d,snapGrid:e,nodesDraggable:f,onError:g,updateNodePositions:h,nodeLookup:i,nodeOrigin:j}=a.getState(),k=new Map,l=a=>a.selected&&(a.draggable||f&&void 0===a.draggable),m=d?e[0]:5,n=d?e[1]:5,o=b.direction.x*m*b.factor,p=b.direction.y*n*b.factor;for(let[,a]of i){if(!l(a))continue;let b={x:a.internals.positionAbsolute.x+o,y:a.internals.positionAbsolute.y+p};d&&(b=gS(b,e));let{position:f,positionAbsolute:h}=function({nodeId:a,nextPosition:b,nodeLookup:c,nodeOrigin:d=[0,0],nodeExtent:e,onError:f}){let g=c.get(a),h=g.parentId?c.get(g.parentId):void 0,{x:i,y:j}=h?h.internals.positionAbsolute:{x:0,y:0},k=g.origin??d,l=g.extent||e;if("parent"!==g.extent||g.expandParent)h&&gY(g.extent)&&(l=[[g.extent[0][0]+i,g.extent[0][1]+j],[g.extent[1][0]+i,g.extent[1][1]+j]]);else if(h){let a=h.measured.width,b=h.measured.height;a&&b&&(l=[[i,j],[i+a,j+b]])}else f?.("005",gp());let m=gY(l)?gF(b,l,g.measured):b;return(void 0===g.measured.width||void 0===g.measured.height)&&f?.("015",gq()),{position:{x:m.x-i+(g.measured.width??0)*k[0],y:m.y-j+(g.measured.height??0)*k[1]},positionAbsolute:m}}({nodeId:a.id,nextPosition:b,nodeLookup:i,nodeExtent:c,nodeOrigin:j,onError:g});a.position=f,a.internals.positionAbsolute=h,k.set(a.id,a)}h(k)},[])}let iB=(0,E.createContext)(null),iC=iB.Provider;iB.Consumer;let iD=a=>({connectOnClick:a.connectOnClick,noPanClassName:a.noPanClassName,rfId:a.rfId}),iE=(0,E.memo)(ih(function({type:a="source",position:b=A.Top,isValidConnection:c,isConnectable:d=!0,isConnectableStart:e=!0,isConnectableEnd:f=!0,id:g,onConnect:h,children:i,className:j,onMouseDown:k,onTouchStart:l,...m},n){let o=g||null,p="target"===a,q=hN(),r=(0,E.useContext)(iB),{connectOnClick:s,noPanClassName:t,rfId:u}=hM(iD,hI),{connectingFrom:w,connectingTo:x,clickConnecting:y,isPossibleEndHandle:z,connectionInProcess:B,clickConnectionInProcess:C,valid:F}=hM(b=>{let{connectionClickStartHandle:c,connectionMode:d,connection:e}=b,{fromHandle:f,toHandle:g,isValid:h}=e,i=g?.nodeId===r&&g?.id===o&&g?.type===a;return{connectingFrom:f?.nodeId===r&&f?.id===o&&f?.type===a,connectingTo:i,clickConnecting:c?.nodeId===r&&c?.id===o&&c?.type===a,isPossibleEndHandle:d===v.Strict?f?.type!==a:r!==f?.nodeId||o!==f?.id,connectionInProcess:!!f,clickConnectionInProcess:!!c,valid:i&&h}},hI);r||q.getState().onError?.("010","Handle: No node id found. Make sure to only use a Handle inside a custom Node.");let G=a=>{let{defaultEdgeOptions:b,onConnect:c,hasDefaultEdges:d}=q.getState(),e={...b,...a};if(d){let{edges:a,setEdges:b}=q.getState();b(((a,b,c={})=>{let d,e;if(!a.source||!a.target)return gR("006","Can't create edge. An edge needs a source and a target."),b;let f=c.getEdgeId||ha;return(e=d=gx(a)?{...a}:{...a,id:f(a)},b.some(a=>a.source===e.source&&a.target===e.target&&(a.sourceHandle===e.sourceHandle||!a.sourceHandle&&!e.sourceHandle)&&(a.targetHandle===e.targetHandle||!a.targetHandle&&!e.targetHandle)))?b:(null===d.sourceHandle&&delete d.sourceHandle,null===d.targetHandle&&delete d.targetHandle,b.concat(d))})(e,a))}c?.(e),h?.(e)},H=a=>{if(!r)return;let b="clientX"in a.nativeEvent;if(e&&(b&&0===a.button||!b)){let b=q.getState();hA(a.nativeEvent,{handleDomNode:a.currentTarget,autoPanOnConnect:b.autoPanOnConnect,connectionMode:b.connectionMode,connectionRadius:b.connectionRadius,domNode:b.domNode,nodeLookup:b.nodeLookup,lib:b.lib,isTarget:p,handleId:o,nodeId:r,flowId:b.rfId,panBy:b.panBy,cancelConnection:b.cancelConnection,onConnectStart:b.onConnectStart,onConnectEnd:(...a)=>q.getState().onConnectEnd?.(...a),updateConnection:b.updateConnection,onConnect:G,isValidConnection:c||((...a)=>q.getState().isValidConnection?.(...a)??!0),getTransform:()=>q.getState().transform,getFromHandle:()=>q.getState().connection.fromHandle,autoPanSpeed:b.autoPanSpeed,dragThreshold:b.connectionDragThreshold})}b?k?.(a):l?.(a)};return(0,D.jsx)("div",{"data-handleid":o,"data-nodeid":r,"data-handlepos":b,"data-id":`${u}-${r}-${o}-${a}`,className:eh(["react-flow__handle",`react-flow__handle-${b}`,"nodrag",t,j,{source:!p,target:p,connectable:d,connectablestart:e,connectableend:f,clickconnecting:y,connectingfrom:w,connectingto:x,valid:F,connectionindicator:d&&(!B||z)&&(B||C?f:e)}]),onMouseDown:H,onTouchStart:H,onClick:s?b=>{let{onClickConnectStart:d,onClickConnectEnd:f,connectionClickStartHandle:g,connectionMode:h,isValidConnection:i,lib:j,rfId:k,nodeLookup:l,connection:m}=q.getState();if(!r||!g&&!e)return;if(!g){d?.(b.nativeEvent,{nodeId:r,handleId:o,handleType:a}),q.setState({connectionClickStartHandle:{nodeId:r,type:a,id:o}});return}let n=g1(b.target),p=c||i,{connection:s,isValid:t}=hz(b.nativeEvent,{handle:{nodeId:r,id:o,type:a},connectionMode:h,fromNodeId:g.nodeId,fromHandleId:g.id||null,fromType:g.type,isValidConnection:p,flowId:k,doc:n,lib:j,nodeLookup:l});t&&s&&G(s);let u=structuredClone(m);delete u.inProgress,u.toPosition=u.toHandle?u.toHandle.position:null,f?.(b,u),q.setState({connectionClickStartHandle:null})}:void 0,ref:n,...m,children:i})})),iF={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},iG={input:function({data:a,isConnectable:b,sourcePosition:c=A.Bottom}){return(0,D.jsxs)(D.Fragment,{children:[a?.label,(0,D.jsx)(iE,{type:"source",position:c,isConnectable:b})]})},default:function({data:a,isConnectable:b,targetPosition:c=A.Top,sourcePosition:d=A.Bottom}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(iE,{type:"target",position:c,isConnectable:b}),a?.label,(0,D.jsx)(iE,{type:"source",position:d,isConnectable:b})]})},output:function({data:a,isConnectable:b,targetPosition:c=A.Top}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(iE,{type:"target",position:c,isConnectable:b}),a?.label]})},group:function(){return null}},iH=a=>{let{width:b,height:c,x:d,y:e}=gA(a.nodeLookup,{filter:a=>!!a.selected});return{width:gQ(b)?b:null,height:gQ(c)?c:null,userSelectionActive:a.userSelectionActive,transformString:`translate(${a.transform[0]}px,${a.transform[1]}px) scale(${a.transform[2]}) translate(${d}px,${e}px)`}};function iI({onSelectionContextMenu:a,noPanClassName:b,disableKeyboardA11y:c}){let d=hN(),{width:e,height:f,transformString:g,userSelectionActive:h}=hM(iH,hI),i=iA(),j=(0,E.useRef)(null),k=!h&&null!==e&&null!==f;if(iz({nodeRef:j,disabled:!k}),!k)return null;let l=a?b=>{a(b,d.getState().nodes.filter(a=>a.selected))}:void 0;return(0,D.jsx)("div",{className:eh(["react-flow__nodesselection","react-flow__container",b]),style:{transform:g},children:(0,D.jsx)("div",{ref:j,className:"react-flow__nodesselection-rect",onContextMenu:l,tabIndex:c?void 0:-1,onKeyDown:c?void 0:a=>{Object.prototype.hasOwnProperty.call(iF,a.key)&&(a.preventDefault(),i({direction:iF[a.key],factor:a.shiftKey?4:1}))},style:{width:e,height:f}})})}let iJ,iK=a=>({nodesSelectionActive:a.nodesSelectionActive,userSelectionActive:a.userSelectionActive});function iL({children:a,onPaneClick:b,onPaneMouseEnter:c,onPaneMouseMove:d,onPaneMouseLeave:e,onPaneContextMenu:f,onPaneScroll:g,paneClickDistance:h,deleteKeyCode:i,selectionKeyCode:j,selectionOnDrag:k,selectionMode:l,onSelectionStart:m,onSelectionEnd:n,multiSelectionKeyCode:o,panActivationKeyCode:p,zoomActivationKeyCode:q,elementsSelectable:r,zoomOnScroll:s,zoomOnPinch:t,panOnScroll:u,panOnScrollSpeed:v,panOnScrollMode:w,zoomOnDoubleClick:x,panOnDrag:y,defaultViewport:z,translateExtent:A,minZoom:B,maxZoom:C,preventScrolling:E,onSelectionContextMenu:F,noWheelClassName:G,noPanClassName:H,disableKeyboardA11y:I,onViewportChange:J,isControlledViewport:K}){let{nodesSelectionActive:L,userSelectionActive:M}=hM(iK,hI),N=h9(j,{target:iJ}),O=h9(p,{target:iJ}),P=O||y,Q=O||u,R=k&&!0!==P,S=N||M||R;return!function({deleteKeyCode:a,multiSelectionKeyCode:b}){hN();let{deleteElements:c}=io();h9(a,{actInsideInputWithModifier:!1}),h9(b,{target:ip})}({deleteKeyCode:i,multiSelectionKeyCode:o}),(0,D.jsx)(is,{onPaneContextMenu:f,elementsSelectable:r,zoomOnScroll:s,zoomOnPinch:t,panOnScroll:Q,panOnScrollSpeed:v,panOnScrollMode:w,zoomOnDoubleClick:x,panOnDrag:!N&&P,defaultViewport:z,translateExtent:A,minZoom:B,maxZoom:C,zoomActivationKeyCode:q,preventScrolling:E,noWheelClassName:G,noPanClassName:H,onViewportChange:J,isControlledViewport:K,paneClickDistance:h,selectionOnDrag:R,children:(0,D.jsxs)(ix,{onSelectionStart:m,onSelectionEnd:n,onPaneClick:b,onPaneMouseEnter:c,onPaneMouseMove:d,onPaneMouseLeave:e,onPaneContextMenu:f,onPaneScroll:g,panOnDrag:P,isSelecting:!!S,selectionMode:l,selectionKeyPressed:N,paneClickDistance:h,selectionOnDrag:R,children:[a,L&&(0,D.jsx)(iI,{onSelectionContextMenu:F,noPanClassName:H,disableKeyboardA11y:I})]})})}iL.displayName="FlowRenderer";let iM=(0,E.memo)(iL),iN=a=>a.updateNodeInternals;var iO=(0,E.memo)(function({id:a,onClick:b,onMouseEnter:c,onMouseMove:d,onMouseLeave:e,onContextMenu:f,onDoubleClick:g,nodesDraggable:h,elementsSelectable:i,nodesConnectable:j,nodesFocusable:k,resizeObserver:l,noDragClassName:m,noPanClassName:n,disableKeyboardA11y:o,rfId:p,nodeTypes:q,nodeClickDistance:r,onError:s}){let t,{node:u,internals:v,isParent:w}=hM(b=>{let c=b.nodeLookup.get(a),d=b.parentLookup.has(a);return{node:c,internals:c.internals,isParent:d}},hI),x=u.type||"default",y=q?.[x]||iG[x];void 0===y&&(s?.("003",(t=x,`Node type "${t}" not found. Using fallback type "default".`)),x="default",y=q?.default||iG.default);let z=!!(u.draggable||h&&void 0===u.draggable),A=!!(u.selectable||i&&void 0===u.selectable),B=!!(u.connectable||j&&void 0===u.connectable),C=!!(u.focusable||k&&void 0===u.focusable),F=hN(),G=g$(u),H=function({node:a,nodeType:b,hasDimensions:c,resizeObserver:d}){hN();let e=(0,E.useRef)(null);return(0,E.useRef)(null),(0,E.useRef)(a.sourcePosition),(0,E.useRef)(a.targetPosition),(0,E.useRef)(b),c&&a.internals.handleBounds,e}({node:u,nodeType:x,hasDimensions:G,resizeObserver:l}),I=iz({nodeRef:H,disabled:u.hidden||!z,noDragClassName:m,handleSelector:u.dragHandle,nodeId:a,isSelectable:A,nodeClickDistance:r}),J=iA();if(u.hidden)return null;let K=gZ(u),L=void 0===u.internals.handleBounds?{width:u.width??u.initialWidth??u.style?.width,height:u.height??u.initialHeight??u.style?.height}:{width:u.width??u.style?.width,height:u.height??u.style?.height},M=A||z||b||c||d||e,N=c?a=>c(a,{...v.userNode}):void 0,O=d?a=>d(a,{...v.userNode}):void 0,P=e?a=>e(a,{...v.userNode}):void 0,Q=f?a=>f(a,{...v.userNode}):void 0,R=g?a=>g(a,{...v.userNode}):void 0;return(0,D.jsx)("div",{className:eh(["react-flow__node",`react-flow__node-${x}`,{[n]:z},u.className,{selected:u.selected,selectable:A,parent:w,draggable:z,dragging:I}]),ref:H,style:{zIndex:v.z,transform:`translate(${v.positionAbsolute.x}px,${v.positionAbsolute.y}px)`,pointerEvents:M?"all":"none",visibility:G?"visible":"hidden",...u.style,...L},"data-id":a,"data-testid":`rf__node-${a}`,onMouseEnter:N,onMouseMove:O,onMouseLeave:P,onContextMenu:Q,onClick:c=>{let{selectNodesOnDrag:d,nodeDragThreshold:e}=F.getState();A&&(!d||!z||e>0)&&iy({id:a,store:F,nodeRef:H}),b&&b(c,{...v.userNode})},onDoubleClick:R,onKeyDown:C?b=>{var c;let d;if(c=b.nativeEvent,d=c.composedPath?.()?.[0]||c.target,!(d?.nodeType===1&&(g2.includes(d.nodeName)||d.hasAttribute("contenteditable")||d.closest(".nokey")))&&!o){if(gs.includes(b.key)&&A)iy({id:a,store:F,unselect:"Escape"===b.key,nodeRef:H});else if(z&&u.selected&&Object.prototype.hasOwnProperty.call(iF,b.key)){b.preventDefault();let{ariaLabelConfig:a}=F.getState();F.setState({ariaLiveMessage:a["node.a11yDescription.ariaLiveMessage"]({direction:b.key.replace("Arrow","").toLowerCase(),x:~~v.positionAbsolute.x,y:~~v.positionAbsolute.y})}),J({direction:iF[b.key],factor:b.shiftKey?4:1})}}}:void 0,tabIndex:C?0:void 0,onFocus:C?()=>{if(o||!H.current?.matches(":focus-visible"))return;let{transform:b,width:c,height:d,autoPanOnNodeFocus:e,setCenter:f}=F.getState();!e||gB(new Map([[a,u]]),{x:0,y:0,width:c,height:d},b,!0).length>0||f(u.position.x+K.width/2,u.position.y+K.height/2,{zoom:b[2]})}:void 0,role:u.ariaRole??(C?"group":void 0),"aria-roledescription":"node","aria-describedby":o?void 0:`${hQ}-${p}`,"aria-label":u.ariaLabel,...u.domAttributes,children:(0,D.jsx)(iC,{value:a,children:(0,D.jsx)(y,{id:a,data:u.data,type:x,positionAbsoluteX:v.positionAbsolute.x,positionAbsoluteY:v.positionAbsolute.y,selected:u.selected??!1,selectable:A,draggable:z,deletable:u.deletable??!0,isConnectable:B,sourcePosition:u.sourcePosition,targetPosition:u.targetPosition,dragging:I,dragHandle:u.dragHandle,zIndex:v.z,parentId:u.parentId,...K})})})});let iP=a=>({nodesDraggable:a.nodesDraggable,nodesConnectable:a.nodesConnectable,nodesFocusable:a.nodesFocusable,elementsSelectable:a.elementsSelectable,onError:a.onError});function iQ(a){var b;let{nodesDraggable:c,nodesConnectable:d,nodesFocusable:e,elementsSelectable:f,onError:g}=hM(iP,hI),h=(b=a.onlyRenderVisibleElements,hM((0,E.useCallback)(a=>b?gB(a.nodeLookup,{x:0,y:0,width:a.width,height:a.height},a.transform,!0).map(a=>a.id):Array.from(a.nodeLookup.keys()),[b]),hI)),i=function(){let a=hM(iN),[b]=(0,E.useState)(()=>"u"<typeof ResizeObserver?null:new ResizeObserver(b=>{let c=new Map;b.forEach(a=>{let b=a.target.getAttribute("data-id");c.set(b,{id:b,nodeElement:a.target,force:!0})}),a(c)}));return b}();return(0,D.jsx)("div",{className:"react-flow__nodes",style:iq,children:h.map(b=>(0,D.jsx)(iO,{id:b,nodeTypes:a.nodeTypes,nodeExtent:a.nodeExtent,onClick:a.onNodeClick,onMouseEnter:a.onNodeMouseEnter,onMouseMove:a.onNodeMouseMove,onMouseLeave:a.onNodeMouseLeave,onContextMenu:a.onNodeContextMenu,onDoubleClick:a.onNodeDoubleClick,noDragClassName:a.noDragClassName,noPanClassName:a.noPanClassName,rfId:a.rfId,disableKeyboardA11y:a.disableKeyboardA11y,resizeObserver:i,nodesDraggable:c,nodesConnectable:d,nodesFocusable:e,elementsSelectable:f,nodeClickDistance:a.nodeClickDistance,onError:g},b))})}iQ.displayName="NodeRenderer";let iR=(0,E.memo)(iQ),iS={[z.Arrow]:({color:a="none",strokeWidth:b=1})=>{let c={strokeWidth:b,...a&&{stroke:a}};return(0,D.jsx)("polyline",{className:"arrow",style:c,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[z.ArrowClosed]:({color:a="none",strokeWidth:b=1})=>{let c={strokeWidth:b,...a&&{stroke:a,fill:a}};return(0,D.jsx)("polyline",{className:"arrowclosed",style:c,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}},iT=({id:a,type:b,color:c,width:d=12.5,height:e=12.5,markerUnits:f="strokeWidth",strokeWidth:g,orient:h="auto-start-reverse"})=>{let i,j=(i=hN(),(0,E.useMemo)(()=>{let a;return Object.prototype.hasOwnProperty.call(iS,b)?iS[b]:(i.getState().onError?.("009",(a=b,`Marker type "${a}" doesn't exist.`)),null)},[b]));return j?(0,D.jsx)("marker",{className:"react-flow__arrowhead",id:a,markerWidth:`${d}`,markerHeight:`${e}`,viewBox:"-10 -10 20 20",markerUnits:f,orient:h,refX:"0",refY:"0",children:(0,D.jsx)(j,{color:c,strokeWidth:g})}):null},iU=({defaultColor:a,rfId:b})=>{let c=hM(a=>a.edges),d=hM(a=>a.defaultEdgeOptions),e=(0,E.useMemo)(()=>(function(a,{id:b,defaultColor:c,defaultMarkerStart:d,defaultMarkerEnd:e}){let f=new Set;return a.reduce((a,g)=>([g.markerStart||d,g.markerEnd||e].forEach(d=>{if(d&&"object"==typeof d){let e=hk(d,b);f.has(e)||(a.push({id:e,color:d.color||c,...d}),f.add(e))}}),a),[]).sort((a,b)=>a.id.localeCompare(b.id))})(c,{id:b,defaultColor:a,defaultMarkerStart:d?.markerStart,defaultMarkerEnd:d?.markerEnd}),[c,d,b,a]);return e.length?(0,D.jsx)("svg",{className:"react-flow__marker","aria-hidden":"true",children:(0,D.jsx)("defs",{children:e.map(a=>(0,D.jsx)(iT,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};iU.displayName="MarkerDefinitions";var iV=(0,E.memo)(iU);function iW({x:a,y:b,label:c,labelStyle:d,labelShowBg:e=!0,labelBgStyle:f,labelBgPadding:g=[2,4],labelBgBorderRadius:h=2,children:i,className:j,...k}){let[l,m]=(0,E.useState)({x:1,y:0,width:0,height:0}),n=eh(["react-flow__edge-textwrapper",j]),o=(0,E.useRef)(null);return c?(0,D.jsxs)("g",{transform:`translate(${a-l.width/2} ${b-l.height/2})`,className:n,visibility:l.width?"visible":"hidden",...k,children:[e&&(0,D.jsx)("rect",{width:l.width+2*g[0],x:-g[0],y:-g[1],height:l.height+2*g[1],className:"react-flow__edge-textbg",style:f,rx:h,ry:h}),(0,D.jsx)("text",{className:"react-flow__edge-text",y:l.height/2,dy:"0.3em",ref:o,style:d,children:c}),i]}):null}iW.displayName="EdgeText";let iX=(0,E.memo)(iW);function iY({path:a,labelX:b,labelY:c,label:d,labelStyle:e,labelShowBg:f,labelBgStyle:g,labelBgPadding:h,labelBgBorderRadius:i,interactionWidth:j=20,...k}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("path",{...k,d:a,fill:"none",className:eh(["react-flow__edge-path",k.className])}),j?(0,D.jsx)("path",{d:a,fill:"none",strokeOpacity:0,strokeWidth:j,className:"react-flow__edge-interaction"}):null,d&&gQ(b)&&gQ(c)?(0,D.jsx)(iX,{x:b,y:c,label:d,labelStyle:e,labelShowBg:f,labelBgStyle:g,labelBgPadding:h,labelBgBorderRadius:i}):null]})}function iZ({pos:a,x1:b,y1:c,x2:d,y2:e}){return a===A.Left||a===A.Right?[.5*(b+d),c]:[b,.5*(c+e)]}function i$({sourceX:a,sourceY:b,sourcePosition:c=A.Bottom,targetX:d,targetY:e,targetPosition:f=A.Top}){let[g,h]=iZ({pos:c,x1:a,y1:b,x2:d,y2:e}),[i,j]=iZ({pos:f,x1:d,y1:e,x2:a,y2:b}),[k,l,m,n]=g5({sourceX:a,sourceY:b,targetX:d,targetY:e,sourceControlX:g,sourceControlY:h,targetControlX:i,targetControlY:j});return[`M${a},${b} C${g},${h} ${i},${j} ${d},${e}`,k,l,m,n]}function i_(a){return(0,E.memo)(({id:b,sourceX:c,sourceY:d,targetX:e,targetY:f,sourcePosition:g,targetPosition:h,label:i,labelStyle:j,labelShowBg:k,labelBgStyle:l,labelBgPadding:m,labelBgBorderRadius:n,style:o,markerEnd:p,markerStart:q,interactionWidth:r})=>{let[s,t,u]=i$({sourceX:c,sourceY:d,sourcePosition:g,targetX:e,targetY:f,targetPosition:h}),v=a.isInternal?void 0:b;return(0,D.jsx)(iY,{id:v,path:s,labelX:t,labelY:u,label:i,labelStyle:j,labelShowBg:k,labelBgStyle:l,labelBgPadding:m,labelBgBorderRadius:n,style:o,markerEnd:p,markerStart:q,interactionWidth:r})})}let i0=i_({isInternal:!1}),i1=i_({isInternal:!0});function i2(a){return(0,E.memo)(({id:b,sourceX:c,sourceY:d,targetX:e,targetY:f,label:g,labelStyle:h,labelShowBg:i,labelBgStyle:j,labelBgPadding:k,labelBgBorderRadius:l,style:m,sourcePosition:n=A.Bottom,targetPosition:o=A.Top,markerEnd:p,markerStart:q,pathOptions:r,interactionWidth:s})=>{let[t,u,v]=hf({sourceX:c,sourceY:d,sourcePosition:n,targetX:e,targetY:f,targetPosition:o,borderRadius:r?.borderRadius,offset:r?.offset,stepPosition:r?.stepPosition}),w=a.isInternal?void 0:b;return(0,D.jsx)(iY,{id:w,path:t,labelX:u,labelY:v,label:g,labelStyle:h,labelShowBg:i,labelBgStyle:j,labelBgPadding:k,labelBgBorderRadius:l,style:m,markerEnd:p,markerStart:q,interactionWidth:s})})}i0.displayName="SimpleBezierEdge",i1.displayName="SimpleBezierEdgeInternal";let i3=i2({isInternal:!1}),i4=i2({isInternal:!0});function i5(a){return(0,E.memo)(({id:b,...c})=>{let d=a.isInternal?void 0:b;return(0,D.jsx)(i3,{...c,id:d,pathOptions:(0,E.useMemo)(()=>({borderRadius:0,offset:c.pathOptions?.offset}),[c.pathOptions?.offset])})})}i3.displayName="SmoothStepEdge",i4.displayName="SmoothStepEdgeInternal";let i6=i5({isInternal:!1}),i7=i5({isInternal:!0});function i8(a){return(0,E.memo)(({id:b,sourceX:c,sourceY:d,targetX:e,targetY:f,label:g,labelStyle:h,labelShowBg:i,labelBgStyle:j,labelBgPadding:k,labelBgBorderRadius:l,style:m,markerEnd:n,markerStart:o,interactionWidth:p})=>{let[q,r,s]=hb({sourceX:c,sourceY:d,targetX:e,targetY:f}),t=a.isInternal?void 0:b;return(0,D.jsx)(iY,{id:t,path:q,labelX:r,labelY:s,label:g,labelStyle:h,labelShowBg:i,labelBgStyle:j,labelBgPadding:k,labelBgBorderRadius:l,style:m,markerEnd:n,markerStart:o,interactionWidth:p})})}i6.displayName="StepEdge",i7.displayName="StepEdgeInternal";let i9=i8({isInternal:!1}),ja=i8({isInternal:!0});function jb(a){return(0,E.memo)(({id:b,sourceX:c,sourceY:d,targetX:e,targetY:f,sourcePosition:g=A.Bottom,targetPosition:h=A.Top,label:i,labelStyle:j,labelShowBg:k,labelBgStyle:l,labelBgPadding:m,labelBgBorderRadius:n,style:o,markerEnd:p,markerStart:q,pathOptions:r,interactionWidth:s})=>{let[t,u,v]=g8({sourceX:c,sourceY:d,sourcePosition:g,targetX:e,targetY:f,targetPosition:h,curvature:r?.curvature}),w=a.isInternal?void 0:b;return(0,D.jsx)(iY,{id:w,path:t,labelX:u,labelY:v,label:i,labelStyle:j,labelShowBg:k,labelBgStyle:l,labelBgPadding:m,labelBgBorderRadius:n,style:o,markerEnd:p,markerStart:q,interactionWidth:s})})}i9.displayName="StraightEdge",ja.displayName="StraightEdgeInternal";let jc=jb({isInternal:!1}),jd=jb({isInternal:!0});jc.displayName="BezierEdge",jd.displayName="BezierEdgeInternal";let je={default:jd,straight:ja,step:i7,smoothstep:i4,simplebezier:i1},jf={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},jg="react-flow__edgeupdater";function jh({position:a,centerX:b,centerY:c,radius:d=10,onMouseDown:e,onMouseEnter:f,onMouseOut:g,type:h}){return(0,D.jsx)("circle",{onMouseDown:e,onMouseEnter:f,onMouseOut:g,className:eh([jg,`${jg}-${h}`]),cx:a===A.Left?b-d:a===A.Right?b+d:b,cy:a===A.Top?c-d:a===A.Bottom?c+d:c,r:d,stroke:"transparent",fill:"transparent"})}function ji({isReconnectable:a,reconnectRadius:b,edge:c,sourceX:d,sourceY:e,targetX:f,targetY:g,sourcePosition:h,targetPosition:i,onReconnect:j,onReconnectStart:k,onReconnectEnd:l,setReconnecting:m,setUpdateHover:n}){let o=hN(),p=(a,b)=>{if(0!==a.button)return;let{autoPanOnConnect:d,domNode:e,connectionMode:f,connectionRadius:g,lib:h,onConnectStart:i,cancelConnection:n,nodeLookup:p,rfId:q,panBy:r,updateConnection:s}=o.getState(),t="target"===b.type;hA(a.nativeEvent,{autoPanOnConnect:d,connectionMode:f,connectionRadius:g,domNode:e,handleId:b.id,nodeId:b.nodeId,nodeLookup:p,isTarget:t,edgeUpdaterType:b.type,lib:h,flowId:q,cancelConnection:n,panBy:r,isValidConnection:(...a)=>o.getState().isValidConnection?.(...a)??!0,onConnect:a=>j?.(c,a),onConnectStart:(d,e)=>{m(!0),k?.(a,c,b.type),i?.(d,e)},onConnectEnd:(...a)=>o.getState().onConnectEnd?.(...a),onReconnectEnd:(a,d)=>{m(!1),l?.(a,c,b.type,d)},updateConnection:s,getTransform:()=>o.getState().transform,getFromHandle:()=>o.getState().connection.fromHandle,dragThreshold:o.getState().connectionDragThreshold,handleDomNode:a.currentTarget})},q=()=>n(!0),r=()=>n(!1);return(0,D.jsxs)(D.Fragment,{children:[(!0===a||"source"===a)&&(0,D.jsx)(jh,{position:h,centerX:d,centerY:e,radius:b,onMouseDown:a=>p(a,{nodeId:c.target,id:c.targetHandle??null,type:"target"}),onMouseEnter:q,onMouseOut:r,type:"source"}),(!0===a||"target"===a)&&(0,D.jsx)(jh,{position:i,centerX:f,centerY:g,radius:b,onMouseDown:a=>p(a,{nodeId:c.source,id:c.sourceHandle??null,type:"source"}),onMouseEnter:q,onMouseOut:r,type:"target"})]})}var jj=(0,E.memo)(function({id:a,edgesFocusable:b,edgesReconnectable:c,elementsSelectable:d,onClick:e,onDoubleClick:f,onContextMenu:g,onMouseEnter:h,onMouseMove:i,onMouseLeave:j,reconnectRadius:k,onReconnect:l,onReconnectStart:m,onReconnectEnd:n,rfId:o,edgeTypes:p,noPanClassName:q,onError:r,disableKeyboardA11y:s}){let t,u=hM(b=>b.edgeLookup.get(a)),w=hM(a=>a.defaultEdgeOptions),x=(u=w?{...w,...u}:u).type||"default",y=p?.[x]||je[x];void 0===y&&(r?.("011",(t=x,`Edge type "${t}" not found. Using fallback type "default".`)),x="default",y=p?.default||je.default);let z=!!(u.focusable||b&&void 0===u.focusable),B=void 0!==l&&(u.reconnectable||c&&void 0===u.reconnectable),C=!!(u.selectable||d&&void 0===u.selectable),F=(0,E.useRef)(null),[G,H]=(0,E.useState)(!1),[I,J]=(0,E.useState)(!1),K=hN(),{zIndex:L,sourceX:M,sourceY:N,targetX:O,targetY:P,sourcePosition:Q,targetPosition:R}=hM((0,E.useCallback)(b=>{let c=b.nodeLookup.get(u.source),d=b.nodeLookup.get(u.target);if(!c||!d)return{zIndex:u.zIndex,...jf};let e=function(a){let{sourceNode:b,targetNode:c}=a;if(!hg(b)||!hg(c))return null;let d=b.internals.handleBounds||hh(b.handles),e=c.internals.handleBounds||hh(c.handles),f=hj(d?.source??[],a.sourceHandle),g=hj(a.connectionMode===v.Strict?e?.target??[]:(e?.target??[]).concat(e?.source??[]),a.targetHandle);if(!f||!g)return a.onError?.("008",((a,{id:b,sourceHandle:c,targetHandle:d})=>`Couldn't create edge for ${a} handle id: "${"source"===a?c:d}", edge id: ${b}.`)(!f?"source":"target",{id:a.id,sourceHandle:a.sourceHandle,targetHandle:a.targetHandle})),null;let h=f?.position||A.Bottom,i=g?.position||A.Top,j=hi(b,f,h),k=hi(c,g,i);return{sourceX:j.x,sourceY:j.y,targetX:k.x,targetY:k.y,sourcePosition:h,targetPosition:i}}({id:a,sourceNode:c,targetNode:d,sourceHandle:u.sourceHandle||null,targetHandle:u.targetHandle||null,connectionMode:b.connectionMode,onError:r});return{zIndex:function({sourceNode:a,targetNode:b,selected:c=!1,zIndex:d=0,elevateOnSelect:e=!1,zIndexMode:f="basic"}){if("manual"===f)return d;let g=Math.max(a.parentId||e&&a.selected?a.internals.z:0,b.parentId||e&&b.selected?b.internals.z:0);return(e&&c?d+1e3:d)+g}({selected:u.selected,zIndex:u.zIndex,sourceNode:c,targetNode:d,elevateOnSelect:b.elevateEdgesOnSelect,zIndexMode:b.zIndexMode}),...e||jf}},[u.source,u.target,u.sourceHandle,u.targetHandle,u.selected,u.zIndex]),hI),S=(0,E.useMemo)(()=>u.markerStart?`url('#${hk(u.markerStart,o)}')`:void 0,[u.markerStart,o]),T=(0,E.useMemo)(()=>u.markerEnd?`url('#${hk(u.markerEnd,o)}')`:void 0,[u.markerEnd,o]);if(u.hidden||null===M||null===N||null===O||null===P)return null;let U=f?a=>{f(a,{...u})}:void 0,V=g?a=>{g(a,{...u})}:void 0,W=h?a=>{h(a,{...u})}:void 0,X=i?a=>{i(a,{...u})}:void 0,Y=j?a=>{j(a,{...u})}:void 0;return(0,D.jsx)("svg",{style:{zIndex:L},children:(0,D.jsxs)("g",{className:eh(["react-flow__edge",`react-flow__edge-${x}`,u.className,q,{selected:u.selected,animated:u.animated,inactive:!C&&!e,updating:G,selectable:C}]),onClick:b=>{let{addSelectedEdges:c,unselectNodesAndEdges:d,multiSelectionActive:f}=K.getState();C&&(K.setState({nodesSelectionActive:!1}),u.selected&&f?(d({nodes:[],edges:[u]}),F.current?.blur()):c([a])),e&&e(b,u)},onDoubleClick:U,onContextMenu:V,onMouseEnter:W,onMouseMove:X,onMouseLeave:Y,onKeyDown:z?b=>{if(!s&&gs.includes(b.key)&&C){let{unselectNodesAndEdges:c,addSelectedEdges:d}=K.getState();"Escape"===b.key?(F.current?.blur(),c({edges:[u]})):d([a])}}:void 0,tabIndex:z?0:void 0,role:u.ariaRole??(z?"group":"img"),"aria-roledescription":"edge","data-id":a,"data-testid":`rf__edge-${a}`,"aria-label":null===u.ariaLabel?void 0:u.ariaLabel||`Edge from ${u.source} to ${u.target}`,"aria-describedby":z?`${hR}-${o}`:void 0,ref:F,...u.domAttributes,children:[!I&&(0,D.jsx)(y,{id:a,source:u.source,target:u.target,type:u.type,selected:u.selected,animated:u.animated,selectable:C,deletable:u.deletable??!0,label:u.label,labelStyle:u.labelStyle,labelShowBg:u.labelShowBg,labelBgStyle:u.labelBgStyle,labelBgPadding:u.labelBgPadding,labelBgBorderRadius:u.labelBgBorderRadius,sourceX:M,sourceY:N,targetX:O,targetY:P,sourcePosition:Q,targetPosition:R,data:u.data,style:u.style,sourceHandleId:u.sourceHandle,targetHandleId:u.targetHandle,markerStart:S,markerEnd:T,pathOptions:"pathOptions"in u?u.pathOptions:void 0,interactionWidth:u.interactionWidth}),B&&(0,D.jsx)(ji,{edge:u,isReconnectable:B,reconnectRadius:k,onReconnect:l,onReconnectStart:m,onReconnectEnd:n,sourceX:M,sourceY:N,targetX:O,targetY:P,sourcePosition:Q,targetPosition:R,setUpdateHover:H,setReconnecting:J})]})})});let jk=a=>({edgesFocusable:a.edgesFocusable,edgesReconnectable:a.edgesReconnectable,elementsSelectable:a.elementsSelectable,connectionMode:a.connectionMode,onError:a.onError});function jl({defaultMarkerColor:a,onlyRenderVisibleElements:b,rfId:c,edgeTypes:d,noPanClassName:e,onReconnect:f,onEdgeContextMenu:g,onEdgeMouseEnter:h,onEdgeMouseMove:i,onEdgeMouseLeave:j,onEdgeClick:k,reconnectRadius:l,onEdgeDoubleClick:m,onReconnectStart:n,onReconnectEnd:o,disableKeyboardA11y:p}){let{edgesFocusable:q,edgesReconnectable:r,elementsSelectable:s,onError:t}=hM(jk,hI),u=hM((0,E.useCallback)(a=>{if(!b)return a.edges.map(a=>a.id);let c=[];if(a.width&&a.height)for(let b of a.edges){let d=a.nodeLookup.get(b.source),e=a.nodeLookup.get(b.target);d&&e&&function({sourceNode:a,targetNode:b,width:c,height:d,transform:e}){let f=gI(gM(a),gM(b));return f.x===f.x2&&(f.x2+=1),f.y===f.y2&&(f.y2+=1),gO({x:-e[0]/e[2],y:-e[1]/e[2],width:c/e[2],height:d/e[2]},gK(f))>0}({sourceNode:d,targetNode:e,width:a.width,height:a.height,transform:a.transform})&&c.push(b.id)}return c},[b]),hI);return(0,D.jsxs)("div",{className:"react-flow__edges",children:[(0,D.jsx)(iV,{defaultColor:a,rfId:c}),u.map(a=>(0,D.jsx)(jj,{id:a,edgesFocusable:q,edgesReconnectable:r,elementsSelectable:s,noPanClassName:e,onReconnect:f,onContextMenu:g,onMouseEnter:h,onMouseMove:i,onMouseLeave:j,onClick:k,reconnectRadius:l,onDoubleClick:m,onReconnectStart:n,onReconnectEnd:o,rfId:c,onError:t,edgeTypes:d,disableKeyboardA11y:p},a))]})}jl.displayName="EdgeRenderer";let jm=(0,E.memo)(jl),jn=a=>`translate(${a.transform[0]}px,${a.transform[1]}px) scale(${a.transform[2]})`;function jo({children:a}){let b=hM(jn);return(0,D.jsx)("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:b},children:a})}let jp=a=>a.panZoom?.syncViewport;function jq(a){return a.connection.inProgress?{...a.connection,to:gT(a.connection.to,a.transform)}:{...a.connection}}let jr=a=>({nodesConnectable:a.nodesConnectable,isValid:a.connection.isValid,inProgress:a.connection.inProgress,width:a.width,height:a.height});function js({containerStyle:a,style:b,type:c,component:d}){let{nodesConnectable:e,width:f,height:g,isValid:h,inProgress:i}=hM(jr,hI);return f&&e&&i?(0,D.jsx)("svg",{style:a,width:f,height:g,className:"react-flow__connectionline react-flow__container",children:(0,D.jsx)("g",{className:eh(["react-flow__connection",gw(h)]),children:(0,D.jsx)(jt,{style:b,type:c,CustomComponent:d,isValid:h})})}):null}let jt=({style:a,type:b=y.Bezier,CustomComponent:c,isValid:d})=>{let{inProgress:e,from:f,fromNode:g,fromHandle:h,fromPosition:i,to:j,toNode:k,toHandle:l,toPosition:m,pointer:n}=hM(jq,hI);if(!e)return;if(c)return(0,D.jsx)(c,{connectionLineType:b,connectionLineStyle:a,fromNode:g,fromHandle:h,fromX:f.x,fromY:f.y,toX:j.x,toY:j.y,fromPosition:i,toPosition:m,connectionStatus:gw(d),toNode:k,toHandle:l,pointer:n});let o="",p={sourceX:f.x,sourceY:f.y,sourcePosition:i,targetX:j.x,targetY:j.y,targetPosition:m};switch(b){case y.Bezier:[o]=g8(p);break;case y.SimpleBezier:[o]=i$(p);break;case y.Step:[o]=hf({...p,borderRadius:0});break;case y.SmoothStep:[o]=hf(p);break;default:[o]=hb(p)}return(0,D.jsx)("path",{d:o,fill:"none",className:"react-flow__connection-path",style:a})};jt.displayName="ConnectionLine";let ju={};function jv(a=ju){(0,E.useRef)(a),hN()}function jw({nodeTypes:a,edgeTypes:b,onInit:c,onNodeClick:d,onEdgeClick:e,onNodeDoubleClick:f,onEdgeDoubleClick:g,onNodeMouseEnter:h,onNodeMouseMove:i,onNodeMouseLeave:j,onNodeContextMenu:k,onSelectionContextMenu:l,onSelectionStart:m,onSelectionEnd:n,connectionLineType:o,connectionLineStyle:p,connectionLineComponent:q,connectionLineContainerStyle:r,selectionKeyCode:s,selectionOnDrag:t,selectionMode:u,multiSelectionKeyCode:v,panActivationKeyCode:w,zoomActivationKeyCode:x,deleteKeyCode:y,onlyRenderVisibleElements:z,elementsSelectable:A,defaultViewport:B,translateExtent:C,minZoom:F,maxZoom:G,preventScrolling:H,defaultMarkerColor:I,zoomOnScroll:J,zoomOnPinch:K,panOnScroll:L,panOnScrollSpeed:M,panOnScrollMode:N,zoomOnDoubleClick:O,panOnDrag:P,onPaneClick:Q,onPaneMouseEnter:R,onPaneMouseMove:S,onPaneMouseLeave:T,onPaneScroll:U,onPaneContextMenu:V,paneClickDistance:W,nodeClickDistance:X,onEdgeContextMenu:Y,onEdgeMouseEnter:Z,onEdgeMouseMove:$,onEdgeMouseLeave:_,reconnectRadius:aa,onReconnect:ab,onReconnectStart:ac,onReconnectEnd:ad,noDragClassName:ae,noWheelClassName:af,noPanClassName:ag,disableKeyboardA11y:ah,nodeExtent:ai,rfId:aj,viewport:ak,onViewportChange:al}){return jv(a),jv(b),hN(),(0,E.useRef)(!1),io(),(0,E.useRef)(!1),hM(jp),hN(),(0,D.jsx)(iM,{onPaneClick:Q,onPaneMouseEnter:R,onPaneMouseMove:S,onPaneMouseLeave:T,onPaneContextMenu:V,onPaneScroll:U,paneClickDistance:W,deleteKeyCode:y,selectionKeyCode:s,selectionOnDrag:t,selectionMode:u,onSelectionStart:m,onSelectionEnd:n,multiSelectionKeyCode:v,panActivationKeyCode:w,zoomActivationKeyCode:x,elementsSelectable:A,zoomOnScroll:J,zoomOnPinch:K,zoomOnDoubleClick:O,panOnScroll:L,panOnScrollSpeed:M,panOnScrollMode:N,panOnDrag:P,defaultViewport:B,translateExtent:C,minZoom:F,maxZoom:G,onSelectionContextMenu:l,preventScrolling:H,noDragClassName:ae,noWheelClassName:af,noPanClassName:ag,disableKeyboardA11y:ah,onViewportChange:al,isControlledViewport:!!ak,children:(0,D.jsxs)(jo,{children:[(0,D.jsx)(jm,{edgeTypes:b,onEdgeClick:e,onEdgeDoubleClick:g,onReconnect:ab,onReconnectStart:ac,onReconnectEnd:ad,onlyRenderVisibleElements:z,onEdgeContextMenu:Y,onEdgeMouseEnter:Z,onEdgeMouseMove:$,onEdgeMouseLeave:_,reconnectRadius:aa,defaultMarkerColor:I,noPanClassName:ag,disableKeyboardA11y:ah,rfId:aj}),(0,D.jsx)(js,{style:p,type:o,component:q,containerStyle:r}),(0,D.jsx)("div",{className:"react-flow__edgelabel-renderer"}),(0,D.jsx)(iR,{nodeTypes:a,onNodeClick:d,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:i,onNodeMouseLeave:j,onNodeContextMenu:k,nodeClickDistance:X,onlyRenderVisibleElements:z,noPanClassName:ag,noDragClassName:ae,disableKeyboardA11y:ah,nodeExtent:ai,rfId:aj}),(0,D.jsx)("div",{className:"react-flow__viewport-portal"})]})})}jw.displayName="GraphView";let jx=(0,E.memo)(jw),jy=({nodes:a,edges:b,defaultNodes:c,defaultEdges:d,width:e,height:f,fitView:g,fitViewOptions:h,minZoom:i=.5,maxZoom:j=2,nodeOrigin:k,nodeExtent:l,zIndexMode:m="basic"}={})=>{let n=new Map,o=new Map,p=new Map,q=new Map,r=d??b??[],s=c??a??[],t=k??[0,0],u=l??gr;hv(p,q,r);let w=hp(s,n,o,{nodeOrigin:t,nodeExtent:u,zIndexMode:m}),x=[0,0,1];if(g&&e&&f){let{x:a,y:b,zoom:c}=gW(gA(n,{filter:a=>!!((a.width||a.initialWidth)&&(a.height||a.initialHeight))}),e,f,i,j,h?.padding??.1);x=[a,b,c]}return{rfId:"1",width:e??0,height:f??0,transform:x,nodes:s,nodesInitialized:w,nodeLookup:n,parentLookup:o,edges:r,edgeLookup:q,connectionLookup:p,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==c,hasDefaultEdges:void 0!==d,panZoom:null,minZoom:i,maxZoom:j,translateExtent:gr,nodeExtent:u,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:v.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:t,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:g??!1,fitViewOptions:h,fitViewResolver:null,connection:{...gu},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:gR,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:gt,zIndexMode:m,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}};function jz({initialNodes:a,initialEdges:b,defaultNodes:c,defaultEdges:d,initialWidth:e,initialHeight:f,initialMinZoom:g,initialMaxZoom:h,initialFitViewOptions:i,fitView:j,nodeOrigin:k,nodeExtent:l,zIndexMode:m,children:n}){let[o]=(0,E.useState)(()=>(({nodes:a,edges:b,defaultNodes:c,defaultEdges:d,width:e,height:f,fitView:g,fitViewOptions:h,minZoom:i,maxZoom:j,nodeOrigin:k,nodeExtent:l,zIndexMode:m})=>{let n,o;return n=(n,o)=>{async function p(){let{nodeLookup:a,panZoom:b,fitViewOptions:c,fitViewResolver:d,width:e,height:f,minZoom:g,maxZoom:h}=o();b&&(await gC({nodes:a,width:e,height:f,panZoom:b,minZoom:g,maxZoom:h},c),d?.resolve(!0),n({fitViewResolver:null}))}return{...jy({nodes:a,edges:b,width:e,height:f,fitView:g,fitViewOptions:h,minZoom:i,maxZoom:j,nodeOrigin:k,nodeExtent:l,defaultNodes:c,defaultEdges:d,zIndexMode:m}),setNodes:a=>{let{nodeLookup:b,parentLookup:c,nodeOrigin:d,elevateNodesOnSelect:e,fitViewQueued:f,zIndexMode:g}=o(),h=hp(a,b,c,{nodeOrigin:d,nodeExtent:l,elevateNodesOnSelect:e,checkEquality:!0,zIndexMode:g});f&&h?(p(),n({nodes:a,nodesInitialized:h,fitViewQueued:!1,fitViewOptions:void 0})):n({nodes:a,nodesInitialized:h})},setEdges:a=>{let{connectionLookup:b,edgeLookup:c}=o();hv(b,c,a),n({edges:a})},setDefaultNodesAndEdges:(a,b)=>{if(a){let{setNodes:b}=o();b(a),n({hasDefaultNodes:!0})}if(b){let{setEdges:a}=o();a(b),n({hasDefaultEdges:!0})}},updateNodeInternals:a=>{let{triggerNodeChanges:b,nodeLookup:c,parentLookup:d,domNode:e,nodeOrigin:f,nodeExtent:g,debug:h,fitViewQueued:i,zIndexMode:j}=o(),{changes:k,updatedInternals:l}=function(a,b,c,d,e,f,g){let h=d?.querySelector(".xyflow__viewport"),i=!1;if(!h)return{changes:[],updatedInternals:i};let j=[],k=window.getComputedStyle(h),{m22:l}=new window.DOMMatrixReadOnly(k.transform),m=[];for(let d of a.values()){let a=b.get(d.id);if(!a)continue;if(a.hidden){b.set(a.id,{...a,internals:{...a.internals,handleBounds:void 0}}),i=!0;continue}let h=g0(d.nodeElement),k=a.measured.width!==h.width||a.measured.height!==h.height;if(h.width&&h.height&&(k||!a.internals.handleBounds||d.force)){let n=d.nodeElement.getBoundingClientRect(),o=gY(a.extent)?a.extent:f,{positionAbsolute:p}=a.internals;a.parentId&&"parent"===a.extent?p=gG(p,h,b.get(a.parentId)):o&&(p=gF(p,o,h));let q={...a,measured:h,internals:{...a.internals,positionAbsolute:p,handleBounds:{source:g4("source",d.nodeElement,n,l,a.id),target:g4("target",d.nodeElement,n,l,a.id)}}};b.set(a.id,q),a.parentId&&hq(q,b,c,{nodeOrigin:e,zIndexMode:g}),i=!0,k&&(j.push({id:a.id,type:"dimensions",dimensions:h}),a.expandParent&&a.parentId&&m.push({id:a.id,parentId:a.parentId,rect:gL(q,e)}))}}if(m.length>0){let a=hs(m,b,c,e);j.push(...a)}return{changes:j,updatedInternals:i}}(a,c,d,e,f,g,j);l&&(!function(a,b,c){let d=hn(hl,c);for(let c of a.values())if(c.parentId)hq(c,a,b,d);else{let a=gF(gz(c,d.nodeOrigin),gY(c.extent)?c.extent:d.nodeExtent,gZ(c));c.internals.positionAbsolute=a}}(c,d,{nodeOrigin:f,nodeExtent:g,zIndexMode:j}),i?(p(),n({fitViewQueued:!1,fitViewOptions:void 0})):n({}),k?.length>0&&(h&&console.log("React Flow: trigger node changes",k),b?.(k)))},updateNodePositions:(a,b=!1)=>{let c=[],d=[],{nodeLookup:e,triggerNodeChanges:f,connection:g,updateConnection:h,onNodesChangeMiddlewareMap:i}=o();for(let[f,i]of a){let a=e.get(f),j=!!(a?.expandParent&&a?.parentId&&i?.position),k={id:f,type:"position",position:j?{x:Math.max(0,i.position.x),y:Math.max(0,i.position.y)}:i.position,dragging:b};if(a&&g.inProgress&&g.fromNode.id===a.id){let b=hi(a,g.fromHandle,A.Left,!0);h({...g,from:b})}j&&a.parentId&&c.push({id:f,parentId:a.parentId,rect:{...i.internals.positionAbsolute,width:i.measured.width??0,height:i.measured.height??0}}),d.push(k)}if(c.length>0){let{parentLookup:a,nodeOrigin:b}=o(),f=hs(c,e,a,b);d.push(...f)}for(let a of i.values())d=a(d);f(d)},triggerNodeChanges:a=>{let{onNodesChange:b,setNodes:c,nodes:d,hasDefaultNodes:e,debug:f}=o();a?.length&&(e&&c(ia(a,d)),f&&console.log("React Flow: trigger node changes",a),b?.(a))},triggerEdgeChanges:a=>{let{onEdgesChange:b,setEdges:c,edges:d,hasDefaultEdges:e,debug:f}=o();a?.length&&(e&&c(ia(a,d)),f&&console.log("React Flow: trigger edge changes",a),b?.(a))},addSelectedNodes:a=>{let{multiSelectionActive:b,edgeLookup:c,nodeLookup:d,triggerNodeChanges:e,triggerEdgeChanges:f}=o();b?e(a.map(a=>ib(a,!0))):(e(ic(d,new Set([...a]),!0)),f(ic(c)))},addSelectedEdges:a=>{let{multiSelectionActive:b,edgeLookup:c,nodeLookup:d,triggerNodeChanges:e,triggerEdgeChanges:f}=o();b?f(a.map(a=>ib(a,!0))):(f(ic(c,new Set([...a]))),e(ic(d,new Set,!0)))},unselectNodesAndEdges:({nodes:a,edges:b}={})=>{let{edges:c,nodes:d,nodeLookup:e,triggerNodeChanges:f,triggerEdgeChanges:g}=o(),h=[];for(let b of a||d){if(!b.selected)continue;let a=e.get(b.id);a&&(a.selected=!1),h.push(ib(b.id,!1))}let i=[];for(let a of b||c)a.selected&&i.push(ib(a.id,!1));f(h),g(i)},setMinZoom:a=>{let{panZoom:b,maxZoom:c}=o();b?.setScaleExtent([a,c]),n({minZoom:a})},setMaxZoom:a=>{let{panZoom:b,minZoom:c}=o();b?.setScaleExtent([c,a]),n({maxZoom:a})},setTranslateExtent:a=>{o().panZoom?.setTranslateExtent(a),n({translateExtent:a})},resetSelectedElements:()=>{let{edges:a,nodes:b,triggerNodeChanges:c,triggerEdgeChanges:d,elementsSelectable:e}=o();if(!e)return;let f=b.reduce((a,b)=>b.selected?[...a,ib(b.id,!1)]:a,[]),g=a.reduce((a,b)=>b.selected?[...a,ib(b.id,!1)]:a,[]);c(f),d(g)},setNodeExtent:a=>{let{nodes:b,nodeLookup:c,parentLookup:d,nodeOrigin:e,elevateNodesOnSelect:f,nodeExtent:g,zIndexMode:h}=o();(a[0][0]!==g[0][0]||a[0][1]!==g[0][1]||a[1][0]!==g[1][0]||a[1][1]!==g[1][1])&&(hp(b,c,d,{nodeOrigin:e,nodeExtent:a,elevateNodesOnSelect:f,checkEquality:!1,zIndexMode:h}),n({nodeExtent:a}))},panBy:a=>{let{transform:b,width:c,height:d,panZoom:e,translateExtent:f}=o();return ht({delta:a,panZoom:e,transform:b,translateExtent:f,width:c,height:d})},setCenter:async(a,b,c)=>{let{width:d,height:e,maxZoom:f,panZoom:g}=o();if(!g)return Promise.resolve(!1);let h=void 0!==c?.zoom?c.zoom:f;return await g.setViewport({x:d/2-a*h,y:e/2-b*h,zoom:h},{duration:c?.duration,ease:c?.ease,interpolate:c?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{n({connection:{...gu}})},updateConnection:a=>{n({connection:a})},reset:()=>n({...jy()})}},o=Object.is,n?hH(n,o):hH})({nodes:a,edges:b,defaultNodes:c,defaultEdges:d,width:e,height:f,fitView:j,minZoom:g,maxZoom:h,fitViewOptions:i,nodeOrigin:k,nodeExtent:l,zIndexMode:m}));return(0,D.jsx)(hK,{value:o,children:(0,D.jsx)(il,{children:n})})}function jA({children:a,nodes:b,edges:c,defaultNodes:d,defaultEdges:e,width:f,height:g,fitView:h,fitViewOptions:i,minZoom:j,maxZoom:k,nodeOrigin:l,nodeExtent:m,zIndexMode:n}){return(0,E.useContext)(hJ)?(0,D.jsx)(D.Fragment,{children:a}):(0,D.jsx)(jz,{initialNodes:b,initialEdges:c,defaultNodes:d,defaultEdges:e,initialWidth:f,initialHeight:g,fitView:h,initialFitViewOptions:i,initialMinZoom:j,initialMaxZoom:k,nodeOrigin:l,nodeExtent:m,zIndexMode:n,children:a})}let jB={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var jC=ih(function({nodes:a,edges:b,defaultNodes:c,defaultEdges:d,className:e,nodeTypes:f,edgeTypes:g,onNodeClick:h,onEdgeClick:i,onInit:j,onMove:k,onMoveStart:l,onMoveEnd:m,onConnect:n,onConnectStart:o,onConnectEnd:p,onClickConnectStart:q,onClickConnectEnd:r,onNodeMouseEnter:s,onNodeMouseMove:t,onNodeMouseLeave:u,onNodeContextMenu:v,onNodeDoubleClick:z,onNodeDragStart:A,onNodeDrag:B,onNodeDragStop:C,onNodesDelete:F,onEdgesDelete:G,onDelete:H,onSelectionChange:I,onSelectionDragStart:J,onSelectionDrag:K,onSelectionDragStop:L,onSelectionContextMenu:M,onSelectionStart:N,onSelectionEnd:O,onBeforeDelete:P,connectionMode:Q,connectionLineType:R=y.Bezier,connectionLineStyle:S,connectionLineComponent:T,connectionLineContainerStyle:U,deleteKeyCode:V="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:X=!1,selectionMode:Y=x.Full,panActivationKeyCode:Z="Space",multiSelectionKeyCode:$=gX()?"Meta":"Control",zoomActivationKeyCode:_=gX()?"Meta":"Control",snapToGrid:aa,snapGrid:ab,onlyRenderVisibleElements:ac=!1,selectNodesOnDrag:ad,nodesDraggable:ae,autoPanOnNodeFocus:af,nodesConnectable:ag,nodesFocusable:ah,nodeOrigin:ai=h2,edgesFocusable:aj,edgesReconnectable:ak,elementsSelectable:al=!0,defaultViewport:am=h3,minZoom:an=.5,maxZoom:ao=2,translateExtent:ap=gr,preventScrolling:aq=!0,nodeExtent:ar,defaultMarkerColor:as="#b1b1b7",zoomOnScroll:at=!0,zoomOnPinch:au=!0,panOnScroll:av=!1,panOnScrollSpeed:aw=.5,panOnScrollMode:ax=w.Free,zoomOnDoubleClick:ay=!0,panOnDrag:az=!0,onPaneClick:aA,onPaneMouseEnter:aB,onPaneMouseMove:aC,onPaneMouseLeave:aD,onPaneScroll:aE,onPaneContextMenu:aF,paneClickDistance:aG=1,nodeClickDistance:aH=0,children:aI,onReconnect:aJ,onReconnectStart:aK,onReconnectEnd:aL,onEdgeContextMenu:aM,onEdgeDoubleClick:aN,onEdgeMouseEnter:aO,onEdgeMouseMove:aP,onEdgeMouseLeave:aQ,reconnectRadius:aR=10,onNodesChange:aS,onEdgesChange:aT,noDragClassName:aU="nodrag",noWheelClassName:aV="nowheel",noPanClassName:aW="nopan",fitView:aX,fitViewOptions:aY,connectOnClick:aZ,attributionPosition:a$,proOptions:a_,defaultEdgeOptions:a0,elevateNodesOnSelect:a1=!0,elevateEdgesOnSelect:a2=!1,disableKeyboardA11y:a3=!1,autoPanOnConnect:a4,autoPanOnNodeDrag:a5,autoPanSpeed:a6,connectionRadius:a7,isValidConnection:a8,onError:a9,style:ba,id:bb,nodeDragThreshold:bc,connectionDragThreshold:bd,viewport:be,onViewportChange:bf,width:bg,height:bh,colorMode:bi="light",debug:bj,onScroll:bk,ariaLabelConfig:bl,zIndexMode:bm="basic",...bn},bo){let bp=bb||"1",bq=function(a){let[b,c]=(0,E.useState)("system"===a?null:a);return null!==b?b:"light"}(bi),br=(0,E.useCallback)(a=>{a.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),bk?.(a)},[bk]);return(0,D.jsx)("div",{"data-testid":"rf__wrapper",...bn,onScroll:br,style:{...ba,...jB},ref:bo,className:eh(["react-flow",e,bq]),id:bb,role:"application",children:(0,D.jsxs)(jA,{nodes:a,edges:b,width:bg,height:bh,fitView:aX,fitViewOptions:aY,minZoom:an,maxZoom:ao,nodeOrigin:ai,nodeExtent:ar,zIndexMode:bm,children:[(0,D.jsx)(jx,{onInit:j,onNodeClick:h,onEdgeClick:i,onNodeMouseEnter:s,onNodeMouseMove:t,onNodeMouseLeave:u,onNodeContextMenu:v,onNodeDoubleClick:z,nodeTypes:f,edgeTypes:g,connectionLineType:R,connectionLineStyle:S,connectionLineComponent:T,connectionLineContainerStyle:U,selectionKeyCode:W,selectionOnDrag:X,selectionMode:Y,deleteKeyCode:V,multiSelectionKeyCode:$,panActivationKeyCode:Z,zoomActivationKeyCode:_,onlyRenderVisibleElements:ac,defaultViewport:am,translateExtent:ap,minZoom:an,maxZoom:ao,preventScrolling:aq,zoomOnScroll:at,zoomOnPinch:au,zoomOnDoubleClick:ay,panOnScroll:av,panOnScrollSpeed:aw,panOnScrollMode:ax,panOnDrag:az,onPaneClick:aA,onPaneMouseEnter:aB,onPaneMouseMove:aC,onPaneMouseLeave:aD,onPaneScroll:aE,onPaneContextMenu:aF,paneClickDistance:aG,nodeClickDistance:aH,onSelectionContextMenu:M,onSelectionStart:N,onSelectionEnd:O,onReconnect:aJ,onReconnectStart:aK,onReconnectEnd:aL,onEdgeContextMenu:aM,onEdgeDoubleClick:aN,onEdgeMouseEnter:aO,onEdgeMouseMove:aP,onEdgeMouseLeave:aQ,reconnectRadius:aR,defaultMarkerColor:as,noDragClassName:aU,noWheelClassName:aV,noPanClassName:aW,rfId:bp,disableKeyboardA11y:a3,nodeExtent:ar,viewport:be,onViewportChange:bf}),(0,D.jsx)(h7,{nodes:a,edges:b,defaultNodes:c,defaultEdges:d,onConnect:n,onConnectStart:o,onConnectEnd:p,onClickConnectStart:q,onClickConnectEnd:r,nodesDraggable:ae,autoPanOnNodeFocus:af,nodesConnectable:ag,nodesFocusable:ah,edgesFocusable:aj,edgesReconnectable:ak,elementsSelectable:al,elevateNodesOnSelect:a1,elevateEdgesOnSelect:a2,minZoom:an,maxZoom:ao,nodeExtent:ar,onNodesChange:aS,onEdgesChange:aT,snapToGrid:aa,snapGrid:ab,connectionMode:Q,translateExtent:ap,connectOnClick:aZ,defaultEdgeOptions:a0,fitView:aX,fitViewOptions:aY,onNodesDelete:F,onEdgesDelete:G,onDelete:H,onNodeDragStart:A,onNodeDrag:B,onNodeDragStop:C,onSelectionDrag:K,onSelectionDragStart:J,onSelectionDragStop:L,onMove:k,onMoveStart:l,onMoveEnd:m,noPanClassName:aW,nodeOrigin:ai,rfId:bp,autoPanOnConnect:a4,autoPanOnNodeDrag:a5,autoPanSpeed:a6,onError:a9,connectionRadius:a7,isValidConnection:a8,selectNodesOnDrag:ad,nodeDragThreshold:bc,connectionDragThreshold:bd,onBeforeDelete:P,debug:bj,ariaLabelConfig:bl,zIndexMode:bm}),(0,D.jsx)(h1,{onSelectionChange:I}),aI,(0,D.jsx)(hX,{proOptions:a_,position:a$}),(0,D.jsx)(hV,{rfId:bp,disableKeyboardA11y:a3})]})})});(r=C||(C={})).Lines="lines",r.Dots="dots",r.Cross="cross",C.Dots,C.Lines,C.Cross;let jD=(0,E.memo)(function({id:a,x:b,y:c,width:d,height:e,style:f,color:g,strokeColor:h,strokeWidth:i,className:j,borderRadius:k,shapeRendering:l,selected:m,onClick:n}){let{background:o,backgroundColor:p}=f||{};return(0,D.jsx)("rect",{className:eh(["react-flow__minimap-node",{selected:m},j]),x:b,y:c,rx:k,ry:k,width:d,height:e,style:{fill:g||o||p,stroke:h,strokeWidth:i},shapeRendering:l,onClick:n?b=>n(b,a):void 0})}),jE=a=>a.nodes.map(a=>a.id),jF=a=>a instanceof Function?a:()=>a,jG=(0,E.memo)(function({id:a,nodeColorFunc:b,nodeStrokeColorFunc:c,nodeClassNameFunc:d,nodeBorderRadius:e,nodeStrokeWidth:f,shapeRendering:g,NodeComponent:h,onClick:i}){let{node:j,x:k,y:l,width:m,height:n}=hM(b=>{let c=b.nodeLookup.get(a);if(!c)return{node:void 0,x:0,y:0,width:0,height:0};let d=c.internals.userNode,{x:e,y:f}=c.internals.positionAbsolute,{width:g,height:h}=gZ(d);return{node:d,x:e,y:f,width:g,height:h}},hI);return j&&!j.hidden&&g$(j)?(0,D.jsx)(h,{x:k,y:l,width:m,height:n,style:j.style,selected:!!j.selected,className:d(j),color:b(j),borderRadius:e,strokeColor:c(j),strokeWidth:f,shapeRendering:g,onClick:i,id:j.id}):null});B.Line,B.Handle,c(8295);let jH=K("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]),jI=K("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),jJ=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],jK=new Set(jJ),jL=(a,b,c)=>c>b?b:c<a?a:c,jM={test:a=>"number"==typeof a,parse:parseFloat,transform:a=>a},jN={...jM,transform:a=>jL(0,1,a)},jO={...jM,default:1},jP=a=>Math.round(1e5*a)/1e5,jQ=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,jR=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,jS=(a,b)=>c=>!!("string"==typeof c&&jR.test(c)&&c.startsWith(a)||b&&null!=c&&Object.prototype.hasOwnProperty.call(c,b)),jT=(a,b,c)=>d=>{if("string"!=typeof d)return d;let[e,f,g,h]=d.match(jQ);return{[a]:parseFloat(e),[b]:parseFloat(f),[c]:parseFloat(g),alpha:void 0!==h?parseFloat(h):1}},jU={...jM,transform:a=>Math.round(jL(0,255,a))},jV={test:jS("rgb","red"),parse:jT("red","green","blue"),transform:({red:a,green:b,blue:c,alpha:d=1})=>"rgba("+jU.transform(a)+", "+jU.transform(b)+", "+jU.transform(c)+", "+jP(jN.transform(d))+")"},jW={test:jS("#"),parse:function(a){let b="",c="",d="",e="";return a.length>5?(b=a.substring(1,3),c=a.substring(3,5),d=a.substring(5,7),e=a.substring(7,9)):(b=a.substring(1,2),c=a.substring(2,3),d=a.substring(3,4),e=a.substring(4,5),b+=b,c+=c,d+=d,e+=e),{red:parseInt(b,16),green:parseInt(c,16),blue:parseInt(d,16),alpha:e?parseInt(e,16)/255:1}},transform:jV.transform},jX=a=>({test:b=>"string"==typeof b&&b.endsWith(a)&&1===b.split(" ").length,parse:parseFloat,transform:b=>`${b}${a}`}),jY=jX("deg"),jZ=jX("%"),j$=jX("px"),j_=jX("vh"),j0=jX("vw"),j1={...jZ,parse:a=>jZ.parse(a)/100,transform:a=>jZ.transform(100*a)},j2={test:jS("hsl","hue"),parse:jT("hue","saturation","lightness"),transform:({hue:a,saturation:b,lightness:c,alpha:d=1})=>"hsla("+Math.round(a)+", "+jZ.transform(jP(b))+", "+jZ.transform(jP(c))+", "+jP(jN.transform(d))+")"},j3={test:a=>jV.test(a)||jW.test(a)||j2.test(a),parse:a=>jV.test(a)?jV.parse(a):j2.test(a)?j2.parse(a):jW.parse(a),transform:a=>"string"==typeof a?a:a.hasOwnProperty("red")?jV.transform(a):j2.transform(a),getAnimatableNone:a=>{let b=j3.parse(a);return b.alpha=0,j3.transform(b)}},j4=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,j5="number",j6="color",j7=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function j8(a){let b=a.toString(),c=[],d={color:[],number:[],var:[]},e=[],f=0,g=b.replace(j7,a=>(j3.test(a)?(d.color.push(f),e.push(j6),c.push(j3.parse(a))):a.startsWith("var(")?(d.var.push(f),e.push("var"),c.push(a)):(d.number.push(f),e.push(j5),c.push(parseFloat(a))),++f,"${}")).split("${}");return{values:c,split:g,indexes:d,types:e}}function j9(a){return j8(a).values}function ka(a){let{split:b,types:c}=j8(a),d=b.length;return a=>{let e="";for(let f=0;f<d;f++)if(e+=b[f],void 0!==a[f]){let b=c[f];b===j5?e+=jP(a[f]):b===j6?e+=j3.transform(a[f]):e+=a[f]}return e}}let kb=a=>"number"==typeof a?0:j3.test(a)?j3.getAnimatableNone(a):a,kc={test:function(a){return isNaN(a)&&"string"==typeof a&&(a.match(jQ)?.length||0)+(a.match(j4)?.length||0)>0},parse:j9,createTransformer:ka,getAnimatableNone:function(a){let b=j9(a);return ka(a)(b.map(kb))}},kd=new Set(["brightness","contrast","saturate","opacity"]);function ke(a){let[b,c]=a.slice(0,-1).split("(");if("drop-shadow"===b)return a;let[d]=c.match(jQ)||[];if(!d)return a;let e=c.replace(d,""),f=+!!kd.has(b);return d!==c&&(f*=100),b+"("+f+e+")"}let kf=/\b([a-z-]*)\(.*?\)/gu,kg={...kc,getAnimatableNone:a=>{let b=a.match(kf);return b?b.map(ke).join(" "):a}},kh={...kc,getAnimatableNone:a=>{let b=kc.parse(a);return kc.createTransformer(a)(b.map(a=>"number"==typeof a?0:"object"==typeof a?{...a,alpha:1}:a))}},ki={...jM,transform:Math.round},kj={borderWidth:j$,borderTopWidth:j$,borderRightWidth:j$,borderBottomWidth:j$,borderLeftWidth:j$,borderRadius:j$,borderTopLeftRadius:j$,borderTopRightRadius:j$,borderBottomRightRadius:j$,borderBottomLeftRadius:j$,width:j$,maxWidth:j$,height:j$,maxHeight:j$,top:j$,right:j$,bottom:j$,left:j$,inset:j$,insetBlock:j$,insetBlockStart:j$,insetBlockEnd:j$,insetInline:j$,insetInlineStart:j$,insetInlineEnd:j$,padding:j$,paddingTop:j$,paddingRight:j$,paddingBottom:j$,paddingLeft:j$,paddingBlock:j$,paddingBlockStart:j$,paddingBlockEnd:j$,paddingInline:j$,paddingInlineStart:j$,paddingInlineEnd:j$,margin:j$,marginTop:j$,marginRight:j$,marginBottom:j$,marginLeft:j$,marginBlock:j$,marginBlockStart:j$,marginBlockEnd:j$,marginInline:j$,marginInlineStart:j$,marginInlineEnd:j$,fontSize:j$,backgroundPositionX:j$,backgroundPositionY:j$,rotate:jY,rotateX:jY,rotateY:jY,rotateZ:jY,scale:jO,scaleX:jO,scaleY:jO,scaleZ:jO,skew:jY,skewX:jY,skewY:jY,distance:j$,translateX:j$,translateY:j$,translateZ:j$,x:j$,y:j$,z:j$,perspective:j$,transformPerspective:j$,opacity:jN,originX:j1,originY:j1,originZ:j$,zIndex:ki,fillOpacity:jN,strokeOpacity:jN,numOctaves:ki},kk={...kj,color:j3,backgroundColor:j3,outlineColor:j3,fill:j3,stroke:j3,borderColor:j3,borderTopColor:j3,borderRightColor:j3,borderBottomColor:j3,borderLeftColor:j3,filter:kg,WebkitFilter:kg,mask:kh,WebkitMask:kh},kl=a=>kk[a],km=()=>({translate:0,scale:1,origin:0,originPoint:0}),kn=()=>({x:km(),y:km()}),ko=()=>({min:0,max:0}),kp=()=>({x:ko(),y:ko()}),kq=a=>!!(a&&a.getVelocity),kr=new Set(["width","height","top","left","right","bottom",...jJ]),ks=a=>b=>b.test(a),kt=[jM,j$,jZ,jY,j0,j_,{test:a=>"auto"===a,parse:a=>a}],ku=a=>kt.find(ks(a)),kv=()=>{},kw=()=>{},kx=a=>b=>"string"==typeof b&&b.startsWith(a),ky=kx("--"),kz=kx("var(--"),kA=a=>!!kz(a)&&kB.test(a.split("/*")[0].trim()),kB=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function kC(a){return"string"==typeof a&&a.split("/*")[0].includes("var(--")}let kD=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,kE=a=>180*a/Math.PI,kF=a=>kH(kE(Math.atan2(a[1],a[0]))),kG={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:a=>(Math.abs(a[0])+Math.abs(a[3]))/2,rotate:kF,rotateZ:kF,skewX:a=>kE(Math.atan(a[1])),skewY:a=>kE(Math.atan(a[2])),skew:a=>(Math.abs(a[1])+Math.abs(a[2]))/2},kH=a=>((a%=360)<0&&(a+=360),a),kI=a=>Math.sqrt(a[0]*a[0]+a[1]*a[1]),kJ=a=>Math.sqrt(a[4]*a[4]+a[5]*a[5]),kK={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:kI,scaleY:kJ,scale:a=>(kI(a)+kJ(a))/2,rotateX:a=>kH(kE(Math.atan2(a[6],a[5]))),rotateY:a=>kH(kE(Math.atan2(-a[2],a[0]))),rotateZ:kF,rotate:kF,skewX:a=>kE(Math.atan(a[4])),skewY:a=>kE(Math.atan(a[1])),skew:a=>(Math.abs(a[1])+Math.abs(a[4]))/2};function kL(a){return+!!a.includes("scale")}function kM(a,b){let c,d;if(!a||"none"===a)return kL(b);let e=a.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(e)c=kK,d=e;else{let b=a.match(/^matrix\(([-\d.e\s,]+)\)$/u);c=kG,d=b}if(!d)return kL(b);let f=c[b],g=d[1].split(",").map(kN);return"function"==typeof f?f(g):g[f]}function kN(a){return parseFloat(a.trim())}let kO=a=>a===jM||a===j$,kP=new Set(["x","y","z"]),kQ=jJ.filter(a=>!kP.has(a)),kR={width:({x:a},{paddingLeft:b="0",paddingRight:c="0"})=>a.max-a.min-parseFloat(b)-parseFloat(c),height:({y:a},{paddingTop:b="0",paddingBottom:c="0"})=>a.max-a.min-parseFloat(b)-parseFloat(c),top:(a,{top:b})=>parseFloat(b),left:(a,{left:b})=>parseFloat(b),bottom:({y:a},{top:b})=>parseFloat(b)+(a.max-a.min),right:({x:a},{left:b})=>parseFloat(b)+(a.max-a.min),x:(a,{transform:b})=>kM(b,"x"),y:(a,{transform:b})=>kM(b,"y")};kR.translateX=kR.x,kR.translateY=kR.y;let kS=a=>a,kT={},kU=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function kV(a,b){let c=!1,d=!0,e={delta:0,timestamp:0,isProcessing:!1},f=()=>c=!0,g=kU.reduce((a,c)=>(a[c]=function(a,b){let c=new Set,d=new Set,e=!1,f=!1,g=new WeakSet,h={delta:0,timestamp:0,isProcessing:!1},i=0;function j(b){g.has(b)&&(k.schedule(b),a()),i++,b(h)}let k={schedule:(a,b=!1,f=!1)=>{let h=f&&e?c:d;return b&&g.add(a),h.has(a)||h.add(a),a},cancel:a=>{d.delete(a),g.delete(a)},process:a=>{if(h=a,e){f=!0;return}e=!0,[c,d]=[d,c],c.forEach(j),b,i=0,c.clear(),e=!1,f&&(f=!1,k.process(a))}};return k}(f,b?c:void 0),a),{}),{setup:h,read:i,resolveKeyframes:j,preUpdate:k,update:l,preRender:m,render:n,postRender:o}=g,p=()=>{let f=kT.useManualTiming?e.timestamp:performance.now();c=!1,kT.useManualTiming||(e.delta=d?1e3/60:Math.max(Math.min(f-e.timestamp,40),1)),e.timestamp=f,e.isProcessing=!0,h.process(e),i.process(e),j.process(e),k.process(e),l.process(e),m.process(e),n.process(e),o.process(e),e.isProcessing=!1,c&&b&&(d=!1,a(p))};return{schedule:kU.reduce((b,f)=>{let h=g[f];return b[f]=(b,f=!1,g=!1)=>(!c&&(c=!0,d=!0,e.isProcessing||a(p)),h.schedule(b,f,g)),b},{}),cancel:a=>{for(let b=0;b<kU.length;b++)g[kU[b]].cancel(a)},state:e,steps:g}}let{schedule:kW,cancel:kX,state:kY,steps:kZ}=kV("u">typeof requestAnimationFrame?requestAnimationFrame:kS,!0),k$=new Set,k_=!1,k0=!1,k1=!1;function k2(){if(k0){let a=Array.from(k$).filter(a=>a.needsMeasurement),b=new Set(a.map(a=>a.element)),c=new Map;b.forEach(a=>{let b,d=(b=[],kQ.forEach(c=>{let d=a.getValue(c);void 0!==d&&(b.push([c,d.get()]),d.set(+!!c.startsWith("scale")))}),b);d.length&&(c.set(a,d),a.render())}),a.forEach(a=>a.measureInitialState()),b.forEach(a=>{a.render();let b=c.get(a);b&&b.forEach(([b,c])=>{a.getValue(b)?.set(c)})}),a.forEach(a=>a.measureEndState()),a.forEach(a=>{void 0!==a.suspendedScrollY&&window.scrollTo(0,a.suspendedScrollY)})}k0=!1,k_=!1,k$.forEach(a=>a.complete(k1)),k$.clear()}function k3(){k$.forEach(a=>{a.readKeyframes(),a.needsMeasurement&&(k0=!0)})}class k4{constructor(a,b,c,d,e,f=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...a],this.onComplete=b,this.name=c,this.motionValue=d,this.element=e,this.isAsync=f}scheduleResolve(){this.state="scheduled",this.isAsync?(k$.add(this),k_||(k_=!0,kW.read(k3),kW.resolveKeyframes(k2))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:a,name:b,element:c,motionValue:d}=this;if(null===a[0]){let e=d?.get(),f=a[a.length-1];if(void 0!==e)a[0]=e;else if(c&&b){let d=c.readValue(b,f);null!=d&&(a[0]=d)}void 0===a[0]&&(a[0]=f),d&&void 0===e&&d.set(a[0])}for(let b=1;b<a.length;b++)a[b]??(a[b]=a[b-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(a=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,a),k$.delete(this)}cancel(){"scheduled"===this.state&&(k$.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}let k5=new Set([kg,kh]);function k6(a,b){let c=kl(a);return k5.has(c)||(c=kc),c.getAnimatableNone?c.getAnimatableNone(b):void 0}let k7=new Set(["auto","none","0"]);class k8 extends k4{constructor(a,b,c,d,e){super(a,b,c,d,e,!0)}readKeyframes(){let{unresolvedKeyframes:a,element:b,name:c}=this;if(!b||!b.current)return;super.readKeyframes();for(let c=0;c<a.length;c++){let d=a[c];if("string"==typeof d&&kA(d=d.trim())){let e=function a(b,c,d=1){kw(d<=4,`Max CSS variable fallback depth detected in property "${b}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[e,f]=function(a){let b=kD.exec(a);if(!b)return[,];let[,c,d,e]=b;return[`--${c??d}`,e]}(b);if(!e)return;let g=window.getComputedStyle(c).getPropertyValue(e);if(g){let a=g.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(a)?parseFloat(a):a}return kA(f)?a(f,c,d+1):f}(d,b.current);void 0!==e&&(a[c]=e),c===a.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!kr.has(c)||2!==a.length)return;let[d,e]=a,f=ku(d),g=ku(e);if(kC(d)!==kC(e)&&kR[c]){this.needsMeasurement=!0;return}if(f!==g)if(kO(f)&&kO(g))for(let b=0;b<a.length;b++){let c=a[b];"string"==typeof c&&(a[b]=parseFloat(c))}else kR[c]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:a,name:b}=this,c=[];for(let b=0;b<a.length;b++)(null===a[b]||function(a){if("number"==typeof a)return 0===a;if(null===a)return!0;return"none"===a||"0"===a||/^0[^.\s]+$/u.test(a)}(a[b]))&&c.push(b);c.length&&function(a,b,c){let d,e=0;for(;e<a.length&&!d;){let b=a[e];"string"==typeof b&&!k7.has(b)&&j8(b).values.length&&(d=a[e]),e++}if(d&&c)for(let e of b)a[e]=k6(c,d)}(a,c,b)}measureInitialState(){let{element:a,unresolvedKeyframes:b,name:c}=this;if(!a||!a.current)return;"height"===c&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=kR[c](a.measureViewportBox(),window.getComputedStyle(a.current)),b[0]=this.measuredOrigin;let d=b[b.length-1];void 0!==d&&a.getValue(c,d).jump(d,!1)}measureEndState(){let{element:a,name:b,unresolvedKeyframes:c}=this;if(!a||!a.current)return;let d=a.getValue(b);d&&d.jump(this.measuredOrigin,!1);let e=c.length-1,f=c[e];c[e]=kR[b](a.measureViewportBox(),window.getComputedStyle(a.current)),null!==f&&void 0===this.finalKeyframe&&(this.finalKeyframe=f),this.removedTransforms?.length&&this.removedTransforms.forEach(([b,c])=>{a.getValue(b).set(c)}),this.resolveNoneKeyframes()}}let k9=a=>1e3*a;function la(a,b){-1===a.indexOf(b)&&a.push(b)}function lb(a,b){let c=a.indexOf(b);c>-1&&a.splice(c,1)}class lc{constructor(){this.subscriptions=[]}add(a){return la(this.subscriptions,a),()=>lb(this.subscriptions,a)}notify(a,b,c){let d=this.subscriptions.length;if(d)if(1===d)this.subscriptions[0](a,b,c);else for(let e=0;e<d;e++){let d=this.subscriptions[e];d&&d(a,b,c)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function ld(a){let b;return()=>(void 0===b&&(b=a()),b)}let le={};function lf(a,b){let c=ld(a);return()=>le[b]??c()}let lg=lf(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),lh=a=>null!==a;function li(a,{repeat:b,repeatType:c="loop"},d,e=1){let f=a.filter(lh),g=e<0||b&&"loop"!==c&&b%2==1?0:f.length-1;return g&&void 0!==d?d:f[g]}class lj{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(a=>{this.resolve=a})}notifyFinished(){this.resolve()}then(a,b){return this.finished.then(a,b)}}let lk={layout:0,mainThread:0,waapi:0},ll=a=>Array.isArray(a)&&"number"==typeof a[0],lm=lf(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(a){return!1}return!0},"linearEasing"),ln=(a,b,c=10)=>{let d="",e=Math.max(Math.round(b/c),2);for(let b=0;b<e;b++)d+=Math.round(1e4*a(b/(e-1)))/1e4+", ";return`linear(${d.substring(0,d.length-2)})`},lo=([a,b,c,d])=>`cubic-bezier(${a}, ${b}, ${c}, ${d})`,lp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:lo([0,.65,.55,1]),circOut:lo([.55,0,1,.45]),backIn:lo([.31,.01,.66,-.59]),backOut:lo([.33,1.53,.69,.99])};function lq(a){return"function"==typeof a&&"applyToOptions"in a}class lr extends lj{constructor(a){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!a)return;const{element:b,name:c,keyframes:d,pseudoElement:e,allowFlatten:f=!1,finalKeyframe:g,onComplete:h}=a;this.isPseudoElement=!!e,this.allowFlatten=f,this.options=a,kw("string"!=typeof a.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const i=function({type:a,...b}){return lq(a)&&lm()?a.applyToOptions(b):(b.duration??(b.duration=300),b.ease??(b.ease="easeOut"),b)}(a);this.animation=function(a,b,c,{delay:d=0,duration:e=300,repeat:f=0,repeatType:g="loop",ease:h="easeOut",times:i}={},j){let k={[b]:c};i&&(k.offset=i);let l=function a(b,c){if(b)return"function"==typeof b?lm()?ln(b,c):"ease-out":ll(b)?lo(b):Array.isArray(b)?b.map(b=>a(b,c)||lp.easeOut):lp[b]}(h,e);Array.isArray(l)&&(k.easing=l);let m={delay:d,duration:e,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:f+1,direction:"reverse"===g?"alternate":"normal"};j&&(m.pseudoElement=j);let n=a.animate(k,m);return n}(b,c,d,i,e),!1===i.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!e){let a=li(d,this.options,g,this.speed);this.updateMotionValue&&this.updateMotionValue(a);c.startsWith("--")?b.style.setProperty(c,a):b.style[c]=a,this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(a){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:a}=this;"idle"!==a&&"finished"!==a&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let a=this.options?.element;!this.isPseudoElement&&a?.isConnected&&this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:a=0}=this.options||{};return this.duration+a/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(a){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=k9(a)}get speed(){return this.animation.playbackRate}set speed(a){a<0&&(this.finishedTime=null),this.animation.playbackRate=a}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(a){this.manualStartTime=this.animation.startTime=a}attachTimeline({timeline:a,rangeStart:b,rangeEnd:c,observe:d}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,a&&lg())?(this.animation.timeline=a,b&&(this.animation.rangeStart=b),c&&(this.animation.rangeEnd=c),kS):d(this)}}let ls=new Set(["opacity","clipPath","filter","transform"]),{schedule:lt}=kV(queueMicrotask,!1);function lu(){d=void 0}let lv={now:()=>(void 0===d&&lv.set(kY.isProcessing||kT.useManualTiming?kY.timestamp:performance.now()),d),set:a=>{d=a,queueMicrotask(lu)}};class lw{constructor(a,b={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{let b=lv.now();if(this.updatedAt!==b&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(a),this.owner=b.owner}setCurrent(a){this.current=a,this.updatedAt=lv.now(),null===this.canTrackVelocity&&void 0!==a&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(a=this.current){this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt}onChange(a){return this.on("change",a)}on(a,b){this.events[a]||(this.events[a]=new lc);let c=this.events[a].add(b);return"change"===a?()=>{c(),kW.read(()=>{this.events.change.getSize()||this.stop()})}:c}clearListeners(){for(let a in this.events)this.events[a].clear()}attach(a,b){this.passiveEffect=a,this.stopPassiveEffect=b}set(a){this.passiveEffect?this.passiveEffect(a,this.updateAndNotify):this.updateAndNotify(a)}setWithVelocity(a,b,c){this.set(b),this.prev=void 0,this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt-c}jump(a,b=!0){this.updateAndNotify(a),this.prev=a,this.prevUpdatedAt=this.prevFrameValue=void 0,b&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(a){this.dependents||(this.dependents=new Set),this.dependents.add(a)}removeDependent(a){this.dependents&&this.dependents.delete(a)}get(){return j&&j.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var a;let b=lv.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||b-this.updatedAt>30)return 0;let c=Math.min(this.updatedAt-this.prevUpdatedAt,30);return a=parseFloat(this.current)-parseFloat(this.prevFrameValue),c?1e3/c*a:0}start(a){return this.stop(),new Promise(b=>{this.hasAnimated=!0,this.animation=a(b),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function lx(a,b){return new lw(a,b)}let ly=[...kt,j3,kc],lz=new WeakMap;function lA(a){return null!==a&&"object"==typeof a&&"function"==typeof a.start}function lB(a){return"string"==typeof a||Array.isArray(a)}let lC=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],lD=["initial",...lC];function lE(a){return lA(a.animate)||lD.some(b=>lB(a[b]))}function lF(a){return!!(lE(a)||a.variants)}let lG={current:null},lH={current:!1},lI="u">typeof window;function lJ(a){let b=[{},{}];return a?.values.forEach((a,c)=>{b[0][c]=a.get(),b[1][c]=a.getVelocity()}),b}function lK(a,b,c,d){if("function"==typeof b){let[e,f]=lJ(d);b=b(void 0!==c?c:a.custom,e,f)}if("string"==typeof b&&(b=a.variants&&a.variants[b]),"function"==typeof b){let[e,f]=lJ(d);b=b(void 0!==c?c:a.custom,e,f)}return b}let lL=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],lM={};class lN{scrapeMotionValuesFromProps(a,b,c){return{}}constructor({parent:a,props:b,presenceContext:c,reducedMotionConfig:d,skipAnimations:e,blockInitialAnimation:f,visualState:g},h={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=k4,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let a=lv.now();this.renderScheduledAt<a&&(this.renderScheduledAt=a,kW.render(this.render,!1,!0))};const{latestValues:i,renderState:j}=g;this.latestValues=i,this.baseTarget={...i},this.initialValues=b.initial?{...i}:{},this.renderState=j,this.parent=a,this.props=b,this.presenceContext=c,this.depth=a?a.depth+1:0,this.reducedMotionConfig=d,this.skipAnimationsConfig=e,this.options=h,this.blockInitialAnimation=!!f,this.isControllingVariants=lE(b),this.isVariantNode=lF(b),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(a&&a.current);const{willChange:k,...l}=this.scrapeMotionValuesFromProps(b,{},this);for(const a in l){const b=l[a];void 0!==i[a]&&kq(b)&&b.set(i[a])}}mount(a){if(this.hasBeenMounted)for(let a in this.initialValues)this.values.get(a)?.jump(this.initialValues[a]),this.latestValues[a]=this.initialValues[a];this.current=a,lz.set(a,this),this.projection&&!this.projection.instance&&this.projection.mount(a),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((a,b)=>this.bindToMotionValue(b,a)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(lH.current||function(){if(lH.current=!0,lI)if(window.matchMedia){let a=window.matchMedia("(prefers-reduced-motion)"),b=()=>lG.current=a.matches;a.addEventListener("change",b),b()}else lG.current=!1}(),this.shouldReduceMotion=lG.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){for(let a in this.projection&&this.projection.unmount(),kX(this.notifyUpdate),kX(this.render),this.valueSubscriptions.forEach(a=>a()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[a].clear();for(let a in this.features){let b=this.features[a];b&&(b.unmount(),b.isMounted=!1)}this.current=null}addChild(a){this.children.add(a),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(a)}removeChild(a){this.children.delete(a),this.enteringChildren&&this.enteringChildren.delete(a)}bindToMotionValue(a,b){let c;if(this.valueSubscriptions.has(a)&&this.valueSubscriptions.get(a)(),b.accelerate&&ls.has(a)&&this.current instanceof HTMLElement){let{factory:c,keyframes:d,times:e,ease:f,duration:g}=b.accelerate,h=new lr({element:this.current,name:a,keyframes:d,times:e,ease:f,duration:k9(g)}),i=c(h);this.valueSubscriptions.set(a,()=>{i(),h.cancel()});return}let d=jK.has(a);d&&this.onBindTransform&&this.onBindTransform();let e=b.on("change",b=>{this.latestValues[a]=b,this.props.onUpdate&&kW.preRender(this.notifyUpdate),d&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});"u">typeof window&&window.MotionCheckAppearSync&&(c=window.MotionCheckAppearSync(this,a,b)),this.valueSubscriptions.set(a,()=>{e(),c&&c(),b.owner&&b.stop()})}sortNodePosition(a){return this.current&&this.sortInstanceNodePosition&&this.type===a.type?this.sortInstanceNodePosition(this.current,a.current):0}updateFeatures(){let a="animation";for(a in lM){let b=lM[a];if(!b)continue;let{isEnabled:c,Feature:d}=b;if(!this.features[a]&&d&&c(this.props)&&(this.features[a]=new d(this)),this.features[a]){let b=this.features[a];b.isMounted?b.update():(b.mount(),b.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):kp()}getStaticValue(a){return this.latestValues[a]}setStaticValue(a,b){this.latestValues[a]=b}update(a,b){(a.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=a,this.prevPresenceContext=this.presenceContext,this.presenceContext=b;for(let b=0;b<lL.length;b++){let c=lL[b];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);let d=a["on"+c];d&&(this.propEventSubscriptions[c]=this.on(c,d))}this.prevMotionValues=function(a,b,c){for(let d in b){let e=b[d],f=c[d];if(kq(e))a.addValue(d,e);else if(kq(f))a.addValue(d,lx(e,{owner:a}));else if(f!==e)if(a.hasValue(d)){let b=a.getValue(d);!0===b.liveStyle?b.jump(e):b.hasAnimated||b.set(e)}else{let b=a.getStaticValue(d);a.addValue(d,lx(void 0!==b?b:e,{owner:a}))}}for(let d in c)void 0===b[d]&&a.removeValue(d);return b}(this,this.scrapeMotionValuesFromProps(a,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(a){return this.props.variants?this.props.variants[a]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(a){let b=this.getClosestVariantNode();if(b)return b.variantChildren&&b.variantChildren.add(a),()=>b.variantChildren.delete(a)}addValue(a,b){let c=this.values.get(a);b!==c&&(c&&this.removeValue(a),this.bindToMotionValue(a,b),this.values.set(a,b),this.latestValues[a]=b.get())}removeValue(a){this.values.delete(a);let b=this.valueSubscriptions.get(a);b&&(b(),this.valueSubscriptions.delete(a)),delete this.latestValues[a],this.removeValueFromRenderState(a,this.renderState)}hasValue(a){return this.values.has(a)}getValue(a,b){if(this.props.values&&this.props.values[a])return this.props.values[a];let c=this.values.get(a);return void 0===c&&void 0!==b&&(c=lx(null===b?void 0:b,{owner:this}),this.addValue(a,c)),c}readValue(a,b){let c=void 0===this.latestValues[a]&&this.current?this.getBaseTargetFromProps(this.props,a)??this.readValueFromInstance(this.current,a,this.options):this.latestValues[a];if(null!=c){let d,e;if("string"==typeof c&&(d=c,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(d)||(e=c,/^0[^.\s]+$/u.test(e))))c=parseFloat(c);else{let d;d=c,!ly.find(ks(d))&&kc.test(b)&&(c=k6(a,b))}this.setBaseTarget(a,kq(c)?c.get():c)}return kq(c)?c.get():c}setBaseTarget(a,b){this.baseTarget[a]=b}getBaseTarget(a){let b,{initial:c}=this.props;if("string"==typeof c||"object"==typeof c){let d=lK(this.props,c,this.presenceContext?.custom);d&&(b=d[a])}if(c&&void 0!==b)return b;let d=this.getBaseTargetFromProps(this.props,a);return void 0===d||kq(d)?void 0!==this.initialValues[a]&&void 0===b?void 0:this.baseTarget[a]:d}on(a,b){return this.events[a]||(this.events[a]=new lc),this.events[a].add(b)}notify(a,...b){this.events[a]&&this.events[a].notify(...b)}scheduleRenderMicrotask(){lt.render(this.render)}}class lO extends lN{constructor(){super(...arguments),this.KeyframeResolver=k8}sortInstanceNodePosition(a,b){return 2&a.compareDocumentPosition(b)?1:-1}getBaseTargetFromProps(a,b){let c=a.style;return c?c[b]:void 0}removeValueFromRenderState(a,{vars:b,style:c}){delete b[a],delete c[a]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:a}=this.props;kq(a)&&(this.childSubscription=a.on("change",a=>{this.current&&(this.current.textContent=`${a}`)}))}}function lP(a){return a.replace(/([A-Z])/g,a=>`-${a.toLowerCase()}`)}let lQ=(a,b)=>b&&"number"==typeof a?b.transform(a):a,lR={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},lS=jJ.length;function lT(a,b,c){let{style:d,vars:e,transformOrigin:f}=a,g=!1,h=!1;for(let a in b){let c=b[a];if(jK.has(a)){g=!0;continue}if(ky(a)){e[a]=c;continue}{let b=lQ(c,kj[a]);a.startsWith("origin")?(h=!0,f[a]=b):d[a]=b}}if(!b.transform&&(g||c?d.transform=function(a,b,c){let d="",e=!0;for(let f=0;f<lS;f++){let g=jJ[f],h=a[g];if(void 0===h)continue;let i=!0;if("number"==typeof h)i=h===+!!g.startsWith("scale");else{let a=parseFloat(h);i=g.startsWith("scale")?1===a:0===a}if(!i||c){let a=lQ(h,kj[g]);if(!i){e=!1;let b=lR[g]||g;d+=`${b}(${a}) `}c&&(b[g]=a)}}return d=d.trim(),c?d=c(b,e?"":d):e&&(d="none"),d}(b,a.transform,c):d.transform&&(d.transform="none")),h){let{originX:a="50%",originY:b="50%",originZ:c=0}=f;d.transformOrigin=`${a} ${b} ${c}`}}let lU={offset:"stroke-dashoffset",array:"stroke-dasharray"},lV={offset:"strokeDashoffset",array:"strokeDasharray"},lW=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function lX(a,{attrX:b,attrY:c,attrScale:d,pathLength:e,pathSpacing:f=1,pathOffset:g=0,...h},i,j,k){if(lT(a,h,j),i){a.style.viewBox&&(a.attrs.viewBox=a.style.viewBox);return}a.attrs=a.style,a.style={};let{attrs:l,style:m}=a;for(let a of(l.transform&&(m.transform=l.transform,delete l.transform),(m.transform||l.transformOrigin)&&(m.transformOrigin=l.transformOrigin??"50% 50%",delete l.transformOrigin),m.transform&&(m.transformBox=k?.transformBox??"fill-box",delete l.transformBox),lW))void 0!==l[a]&&(m[a]=l[a],delete l[a]);void 0!==b&&(l.x=b),void 0!==c&&(l.y=c),void 0!==d&&(l.scale=d),void 0!==e&&function(a,b,c=1,d=0,e=!0){a.pathLength=1;let f=e?lU:lV;a[f.offset]=`${-d}`,a[f.array]=`${b} ${c}`}(l,e,f,g,!1)}let lY=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),lZ=a=>"string"==typeof a&&"svg"===a.toLowerCase();function l$(a,{style:b,vars:c},d,e){let f,g=a.style;for(f in b)g[f]=b[f];for(f in e?.applyProjectionStyles(g,d),c)g.setProperty(f,c[f])}function l_(a,b){return b.max===b.min?0:a/(b.max-b.min)*100}let l0={correct:(a,b)=>{if(!b.target)return a;if("string"==typeof a)if(!j$.test(a))return a;else a=parseFloat(a);let c=l_(a,b.target.x),d=l_(a,b.target.y);return`${c}% ${d}%`}},l1=(a,b,c)=>a+(b-a)*c,l2={borderRadius:{...l0,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:l0,borderTopRightRadius:l0,borderBottomLeftRadius:l0,borderBottomRightRadius:l0,boxShadow:{correct:(a,{treeScale:b,projectionDelta:c})=>{let d=kc.parse(a);if(d.length>5)return a;let e=kc.createTransformer(a),f=+("number"!=typeof d[0]),g=c.x.scale*b.x,h=c.y.scale*b.y;d[0+f]/=g,d[1+f]/=h;let i=l1(g,h,.5);return"number"==typeof d[2+f]&&(d[2+f]/=i),"number"==typeof d[3+f]&&(d[3+f]/=i),e(d)}}};function l3(a,{layout:b,layoutId:c}){return jK.has(a)||a.startsWith("origin")||(b||void 0!==c)&&(!!l2[a]||"opacity"===a)}function l4(a,b,c){let d=a.style,e=b?.style,f={};if(!d)return f;for(let b in d)(kq(d[b])||e&&kq(e[b])||l3(b,a)||c?.getValue(b)?.liveStyle!==void 0)&&(f[b]=d[b]);return f}function l5(a,b,c){let d=l4(a,b,c);for(let c in a)(kq(a[c])||kq(b[c]))&&(d[-1!==jJ.indexOf(c)?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c]=a[c]);return d}class l6 extends lO{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=kp}getBaseTargetFromProps(a,b){return a[b]}readValueFromInstance(a,b){if(jK.has(b)){let a=kl(b);return a&&a.default||0}return b=lY.has(b)?b:lP(b),a.getAttribute(b)}scrapeMotionValuesFromProps(a,b,c){return l5(a,b,c)}build(a,b,c){lX(a,b,this.isSVGTag,c.transformTemplate,c.style)}renderInstance(a,b,c,d){for(let c in l$(a,b,void 0,d),b.attrs)a.setAttribute(lY.has(c)?c:lP(c),b.attrs[c])}mount(a){this.isSVGTag=lZ(a.tagName),super.mount(a)}}function l7({top:a,left:b,right:c,bottom:d}){return{x:{min:b,max:c},y:{min:a,max:d}}}function l8(a){return void 0===a||1===a}function l9({scale:a,scaleX:b,scaleY:c}){return!l8(a)||!l8(b)||!l8(c)}function ma(a){return l9(a)||mb(a)||a.z||a.rotate||a.rotateX||a.rotateY||a.skewX||a.skewY}function mb(a){var b,c;return(b=a.x)&&"0%"!==b||(c=a.y)&&"0%"!==c}function mc(a,b,c,d,e){return void 0!==e&&(a=d+e*(a-d)),d+c*(a-d)+b}function md(a,b=0,c=1,d,e){a.min=mc(a.min,b,c,d,e),a.max=mc(a.max,b,c,d,e)}function me(a,{x:b,y:c}){md(a.x,b.translate,b.scale,b.originPoint),md(a.y,c.translate,c.scale,c.originPoint)}function mf(a,b){a.min=a.min+b,a.max=a.max+b}function mg(a,b,c,d,e=.5){let f=l1(a.min,a.max,e);md(a,b,c,f,d)}function mh(a,b){return"string"==typeof a?parseFloat(a)/100*(b.max-b.min):a}function mi(a,b){mg(a.x,mh(b.x,a.x),b.scaleX,b.scale,b.originX),mg(a.y,mh(b.y,a.y),b.scaleY,b.scale,b.originY)}function mj(a,b){return l7(function(a,b){if(!b)return a;let c=b({x:a.left,y:a.top}),d=b({x:a.right,y:a.bottom});return{top:c.y,left:c.x,bottom:d.y,right:d.x}}(a.getBoundingClientRect(),b))}class mk extends lO{constructor(){super(...arguments),this.type="html",this.renderInstance=l$}readValueFromInstance(a,b){if(jK.has(b))return this.projection?.isProjecting?kL(b):((a,b)=>{let{transform:c="none"}=getComputedStyle(a);return kM(c,b)})(a,b);{let c=window.getComputedStyle(a),d=(ky(b)?c.getPropertyValue(b):c[b])||0;return"string"==typeof d?d.trim():d}}measureInstanceViewportBox(a,{transformPagePoint:b}){return mj(a,b)}build(a,b,c){lT(a,b,c.transformTemplate)}scrapeMotionValuesFromProps(a,b,c){return l4(a,b,c)}}let ml=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function mm(a){if("string"!=typeof a||a.includes("-"));else if(ml.indexOf(a)>-1||/[A-Z]/u.test(a))return!0;return!1}let mn=(0,E.createContext)({}),mo=(0,E.createContext)({transformPagePoint:a=>a,isStatic:!1,reducedMotion:"never"}),mp=(0,E.createContext)({});function mq(a){return Array.isArray(a)?a.join(" "):a}let mr=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ms(a,b,c){for(let d in b)kq(b[d])||l3(d,c)||(a[d]=b[d])}let mt=()=>({...mr(),attrs:{}}),mu=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function mv(a){return a.startsWith("while")||a.startsWith("drag")&&"draggable"!==a||a.startsWith("layout")||a.startsWith("onTap")||a.startsWith("onPan")||a.startsWith("onLayout")||mu.has(a)}let mw=a=>!mv(a);try{s=require("@emotion/is-prop-valid").default,"function"==typeof s&&(mw=a=>a.startsWith("on")?!mv(a):s(a))}catch{}function mx(a){return kq(a)?a.get():a}let my=(0,E.createContext)(null);function mz(a){let b=(0,E.useRef)(null);return null===b.current&&(b.current=a()),b.current}let mA=a=>(b,c)=>{let d=(0,E.useContext)(mp),e=(0,E.useContext)(my),f=()=>(function({scrapeMotionValuesFromProps:a,createRenderState:b},c,d,e){return{latestValues:function(a,b,c,d){let e={},f=d(a,{});for(let a in f)e[a]=mx(f[a]);let{initial:g,animate:h}=a,i=lE(a),j=lF(a);b&&j&&!i&&!1!==a.inherit&&(void 0===g&&(g=b.initial),void 0===h&&(h=b.animate));let k=!!c&&!1===c.initial,l=(k=k||!1===g)?h:g;if(l&&"boolean"!=typeof l&&!lA(l)){let b=Array.isArray(l)?l:[l];for(let c=0;c<b.length;c++){let d=lK(a,b[c]);if(d){let{transitionEnd:a,transition:b,...c}=d;for(let a in c){let b=c[a];if(Array.isArray(b)){let a=k?b.length-1:0;b=b[a]}null!==b&&(e[a]=b)}for(let b in a)e[b]=a[b]}}}return e}(c,d,e,a),renderState:b()}})(a,b,d,e);return c?f():mz(f)},mB=mA({scrapeMotionValuesFromProps:l4,createRenderState:mr}),mC=mA({scrapeMotionValuesFromProps:l5,createRenderState:mt}),mD={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},mE=!1,mF=Symbol.for("motionComponentSymbol");function mG(a,{forwardMotionProps:b=!1,type:c}={},d,e){d&&function(a){let b=(!function(){if(mE)return;let a={};for(let b in mD)a[b]={isEnabled:a=>mD[b].some(b=>!!a[b])};lM=a,mE=!0}(),lM);for(let c in a)b[c]={...b[c],...a[c]};lM=b}(d);let f=c?"svg"===c:mm(a),g=f?mC:mB;function h(c,d){var e;let h,i,j,k={...(0,E.useContext)(mo),...c,layoutId:function({layoutId:a}){let b=(0,E.useContext)(mn).id;return b&&void 0!==a?b+"-"+a:a}(c)},{isStatic:l}=k,m=function(a){let{initial:b,animate:c}=function(a,b){if(lE(a)){let{initial:b,animate:c}=a;return{initial:!1===b||lB(b)?b:void 0,animate:lB(c)?c:void 0}}return!1!==a.inherit?b:{}}(a,(0,E.useContext)(mp));return(0,E.useMemo)(()=>({initial:b,animate:c}),[mq(b),mq(c)])}(c),n=g(c,l);return(0,D.jsxs)(mp.Provider,{value:m,children:[h&&m.visualElement?(0,D.jsx)(h,{visualElement:m.visualElement,...k}):null,function(a,b,c,{latestValues:d},e,f=!1,g){let h=(g??mm(a)?function(a,b,c,d){let e=(0,E.useMemo)(()=>{let c=mt();return lX(c,b,lZ(d),a.transformTemplate,a.style),{...c.attrs,style:{...c.style}}},[b]);if(a.style){let b={};ms(b,a.style,a),e.style={...b,...e.style}}return e}:function(a,b){let c,d,e={},f=(c=a.style||{},ms(d={},c,a),Object.assign(d,function({transformTemplate:a},b){return(0,E.useMemo)(()=>{let c=mr();return lT(c,b,a),Object.assign({},c.vars,c.style)},[b])}(a,b)),d);return a.drag&&!1!==a.dragListener&&(e.draggable=!1,f.userSelect=f.WebkitUserSelect=f.WebkitTouchCallout="none",f.touchAction=!0===a.drag?"none":`pan-${"x"===a.drag?"y":"x"}`),void 0===a.tabIndex&&(a.onTap||a.onTapStart||a.whileTap)&&(e.tabIndex=0),e.style=f,e})(b,d,e,a),i=function(a,b,c){let d={};for(let e in a)("values"!==e||"object"!=typeof a.values)&&(mw(e)||!0===c&&mv(e)||!b&&!mv(e)||a.draggable&&e.startsWith("onDrag"))&&(d[e]=a[e]);return d}(b,"string"==typeof a,f),j=a!==E.Fragment?{...i,...h,ref:c}:{},{children:k}=b,l=(0,E.useMemo)(()=>kq(k)?k.get():k,[k]);return(0,E.createElement)(a,{...j,children:l})}(a,c,(e=m.visualElement,i=(0,E.useRef)(d),(0,E.useInsertionEffect)(()=>{i.current=d}),j=(0,E.useRef)(null),(0,E.useCallback)(a=>{a&&n.onMount?.(a);let b=i.current;if("function"==typeof b)if(a){let c=b(a);"function"==typeof c&&(j.current=c)}else j.current?(j.current(),j.current=null):b(a);else b&&(b.current=a);e&&(a?e.mount(a):e.unmount())},[e])),n,l,b,f)]})}h.displayName=`motion.${"string"==typeof a?a:`create(${a.displayName??a.name??""})`}`;let i=(0,E.forwardRef)(h);return i[mF]=a,i}class mH{constructor(a){this.isMounted=!1,this.node=a}update(){}}function mI(a,b,c){let d=a.getProps();return lK(d,b,void 0!==c?c:d.custom,a)}function mJ(a,b){if(a?.inherit&&b){let{inherit:c,...d}=a;return{...b,...d}}return a}function mK(a,b){let c=a?.[b]??a?.default??a;return c!==a?mJ(c,a):c}let mL=a=>Array.isArray(a);function mM(a,b){let c=a.getValue("willChange");if(kq(c)&&c.add)return c.add(b);if(!c&&kT.WillChange){let c=new kT.WillChange("auto");a.addValue("willChange",c),c.add(b)}}let mN="data-"+lP("framerAppearId"),mO=(a,b)=>c=>b(a(c)),mP=(...a)=>a.reduce(mO);function mQ(a,b,c){return(c<0&&(c+=1),c>1&&(c-=1),c<1/6)?a+(b-a)*6*c:c<.5?b:c<2/3?a+(b-a)*(2/3-c)*6:a}function mR(a,b){return c=>c>0?b:a}let mS=(a,b,c)=>{let d=a*a,e=c*(b*b-d)+d;return e<0?0:Math.sqrt(e)},mT=[jW,jV,j2];function mU(a){let b=mT.find(b=>b.test(a));if(kv(!!b,`'${a}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!b)return!1;let c=b.parse(a);return b===j2&&(c=function({hue:a,saturation:b,lightness:c,alpha:d}){a/=360,c/=100;let e=0,f=0,g=0;if(b/=100){let d=c<.5?c*(1+b):c+b-c*b,h=2*c-d;e=mQ(h,d,a+1/3),f=mQ(h,d,a),g=mQ(h,d,a-1/3)}else e=f=g=c;return{red:Math.round(255*e),green:Math.round(255*f),blue:Math.round(255*g),alpha:d}}(c)),c}let mV=(a,b)=>{let c=mU(a),d=mU(b);if(!c||!d)return mR(a,b);let e={...c};return a=>(e.red=mS(c.red,d.red,a),e.green=mS(c.green,d.green,a),e.blue=mS(c.blue,d.blue,a),e.alpha=l1(c.alpha,d.alpha,a),jV.transform(e))},mW=new Set(["none","hidden"]);function mX(a,b){return c=>l1(a,b,c)}function mY(a){return"number"==typeof a?mX:"string"==typeof a?kA(a)?mR:j3.test(a)?mV:m_:Array.isArray(a)?mZ:"object"==typeof a?j3.test(a)?mV:m$:mR}function mZ(a,b){let c=[...a],d=c.length,e=a.map((a,c)=>mY(a)(a,b[c]));return a=>{for(let b=0;b<d;b++)c[b]=e[b](a);return c}}function m$(a,b){let c={...a,...b},d={};for(let e in c)void 0!==a[e]&&void 0!==b[e]&&(d[e]=mY(a[e])(a[e],b[e]));return a=>{for(let b in d)c[b]=d[b](a);return c}}let m_=(a,b)=>{let c=kc.createTransformer(b),d=j8(a),e=j8(b);if(!(d.indexes.var.length===e.indexes.var.length&&d.indexes.color.length===e.indexes.color.length&&d.indexes.number.length>=e.indexes.number.length))return kv(!0,`Complex values '${a}' and '${b}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),mR(a,b);if(mW.has(a)&&!e.values.length||mW.has(b)&&!d.values.length)return mW.has(a)?c=>c<=0?a:b:c=>c>=1?b:a;return mP(mZ(function(a,b){let c=[],d={color:0,var:0,number:0};for(let e=0;e<b.values.length;e++){let f=b.types[e],g=a.indexes[f][d[f]],h=a.values[g]??0;c[e]=h,d[f]++}return c}(d,e),e.values),c)};function m0(a,b,c){return"number"==typeof a&&"number"==typeof b&&"number"==typeof c?l1(a,b,c):mY(a)(a,b)}let m1=a=>{let b=({timestamp:b})=>a(b);return{start:(a=!0)=>kW.update(b,a),stop:()=>kX(b),now:()=>kY.isProcessing?kY.timestamp:lv.now()}};function m2(a){let b=0,c=a.next(b);for(;!c.done&&b<2e4;)b+=50,c=a.next(b);return b>=2e4?1/0:b}function m3(a,b,c){var d,e;let f=Math.max(b-5,0);return d=c-a(f),(e=b-f)?1e3/e*d:0}let m4=.01,m5=2,m6=.005,m7=.5;function m8(a,b){return a*Math.sqrt(1-b*b)}let m9=["duration","bounce"],na=["stiffness","damping","mass"];function nb(a,b){return b.some(b=>void 0!==a[b])}function nc(a=.3,b=.3){let c,d="object"!=typeof a?{visualDuration:a,keyframes:[0,1],bounce:b}:a,{restSpeed:e,restDelta:f}=d,g=d.keyframes[0],h=d.keyframes[d.keyframes.length-1],i={done:!1,value:g},{stiffness:j,damping:k,mass:l,duration:m,velocity:n,isResolvedFromDuration:o}=function(a){let b={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...a};if(!nb(a,na)&&nb(a,m9))if(b.velocity=0,a.visualDuration){let c=2*Math.PI/(1.2*a.visualDuration),d=c*c,e=2*jL(.05,1,1-(a.bounce||0))*Math.sqrt(d);b={...b,mass:1,stiffness:d,damping:e}}else{let c=function({duration:a=800,bounce:b=.3,velocity:c=0,mass:d=1}){let e,f;kv(a<=k9(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let g=1-b;g=jL(.05,1,g),a=jL(.01,10,a/1e3),g<1?(e=b=>{let d=b*g,e=d*a;return .001-(d-c)/m8(b,g)*Math.exp(-e)},f=b=>{let d=b*g*a,f=Math.pow(g,2)*Math.pow(b,2)*a,h=Math.exp(-d),i=m8(Math.pow(b,2),g);return(d*c+c-f)*h*(-e(b)+.001>0?-1:1)/i}):(e=b=>-.001+Math.exp(-b*a)*((b-c)*a+1),f=b=>a*a*(c-b)*Math.exp(-b*a));let h=function(a,b,c){let d=c;for(let c=1;c<12;c++)d-=a(d)/b(d);return d}(e,f,5/a);if(a=k9(a),isNaN(h))return{stiffness:100,damping:10,duration:a};{let b=Math.pow(h,2)*d;return{stiffness:b,damping:2*g*Math.sqrt(d*b),duration:a}}}({...a,velocity:0});(b={...b,...c,mass:1}).isResolvedFromDuration=!0}return b}({...d,velocity:-((d.velocity||0)/1e3)}),p=n||0,q=k/(2*Math.sqrt(j*l)),r=h-g,s=Math.sqrt(j/l)/1e3,t=5>Math.abs(r);if(e||(e=t?m4:m5),f||(f=t?m6:m7),q<1){let a=m8(s,q);c=b=>h-Math.exp(-q*s*b)*((p+q*s*r)/a*Math.sin(a*b)+r*Math.cos(a*b))}else if(1===q)c=a=>h-Math.exp(-s*a)*(r+(p+s*r)*a);else{let a=s*Math.sqrt(q*q-1);c=b=>{let c=Math.exp(-q*s*b),d=Math.min(a*b,300);return h-c*((p+q*s*r)*Math.sinh(d)+a*r*Math.cosh(d))/a}}let u={calculatedDuration:o&&m||null,next:a=>{let b=c(a);if(o)i.done=a>=m;else{let d=0===a?p:0;q<1&&(d=0===a?k9(p):m3(c,a,b));let g=Math.abs(h-b)<=f;i.done=Math.abs(d)<=e&&g}return i.value=i.done?h:b,i},toString:()=>{let a=Math.min(m2(u),2e4),b=ln(b=>u.next(a*b).value,a,30);return a+"ms "+b},toTransition:()=>{}};return u}function nd({keyframes:a,velocity:b=0,power:c=.8,timeConstant:d=325,bounceDamping:e=10,bounceStiffness:f=500,modifyTarget:g,min:h,max:i,restDelta:j=.5,restSpeed:k}){let l,m,n=a[0],o={done:!1,value:n},p=c*b,q=n+p,r=void 0===g?q:g(q);r!==q&&(p=r-n);let s=a=>-p*Math.exp(-a/d),t=a=>r+s(a),u=a=>{let b=s(a),c=t(a);o.done=Math.abs(b)<=j,o.value=o.done?r:c},v=a=>{let b;if(b=o.value,void 0!==h&&b<h||void 0!==i&&b>i){var c;l=a,m=nc({keyframes:[o.value,(c=o.value,void 0===h?i:void 0===i||Math.abs(h-c)<Math.abs(i-c)?h:i)],velocity:m3(t,a,o.value),damping:e,stiffness:f,restDelta:j,restSpeed:k})}};return v(0),{calculatedDuration:null,next:a=>{let b=!1;return(m||void 0!==l||(b=!0,u(a),v(a)),void 0!==l&&a>=l)?m.next(a-l):(b||u(a),o)}}}nc.applyToOptions=a=>{let b=function(a,b=100,c){let d=c({...a,keyframes:[0,b]}),e=Math.min(m2(d),2e4);return{type:"keyframes",ease:a=>d.next(e*a).value/b,duration:e/1e3}}(a,100,nc);return a.ease=b.ease,a.duration=k9(b.duration),a.type="keyframes",a};let ne=(a,b,c)=>(((1-3*c+3*b)*a+(3*c-6*b))*a+3*b)*a;function nf(a,b,c,d){return a===b&&c===d?kS:e=>0===e||1===e?e:ne(function(a,b,c,d,e){let f,g,h=0;do(f=ne(g=b+(c-b)/2,d,e)-a)>0?c=g:b=g;while(Math.abs(f)>1e-7&&++h<12);return g}(e,0,1,a,c),b,d)}let ng=nf(.42,0,1,1),nh=nf(0,0,.58,1),ni=nf(.42,0,.58,1),nj=a=>b=>b<=.5?a(2*b)/2:(2-a(2*(1-b)))/2,nk=a=>b=>1-a(1-b),nl=nf(.33,1.53,.69,.99),nm=nk(nl),nn=nj(nm),no=a=>(a*=2)<1?.5*nm(a):.5*(2-Math.pow(2,-10*(a-1))),np=a=>1-Math.sin(Math.acos(a)),nq=nk(np),nr=nj(np),ns={linear:kS,easeIn:ng,easeInOut:ni,easeOut:nh,circIn:np,circInOut:nr,circOut:nq,backIn:nm,backInOut:nn,backOut:nl,anticipate:no},nt=a=>{if(ll(a)){kw(4===a.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[b,c,d,e]=a;return nf(b,c,d,e)}return"string"==typeof a?(kw(void 0!==ns[a],`Invalid easing type '${a}'`,"invalid-easing-type"),ns[a]):a},nu=(a,b,c)=>{let d=b-a;return 0===d?1:(c-a)/d};function nv({duration:a=300,keyframes:b,times:c,ease:d="easeInOut"}){var e;let f,g=Array.isArray(d)&&"number"!=typeof d[0]?d.map(nt):nt(d),h={done:!1,value:b[0]},i=function(a,b,{clamp:c=!0,ease:d,mixer:e}={}){let f=a.length;if(kw(f===b.length,"Both input and output ranges must be the same length","range-length"),1===f)return()=>b[0];if(2===f&&b[0]===b[1])return()=>b[1];let g=a[0]===a[1];a[0]>a[f-1]&&(a=[...a].reverse(),b=[...b].reverse());let h=function(a,b,c){let d=[],e=c||kT.mix||m0,f=a.length-1;for(let c=0;c<f;c++){let f=e(a[c],a[c+1]);b&&(f=mP(Array.isArray(b)?b[c]||kS:b,f)),d.push(f)}return d}(b,d,e),i=h.length,j=c=>{if(g&&c<a[0])return b[0];let d=0;if(i>1)for(;d<a.length-2&&!(c<a[d+1]);d++);let e=nu(a[d],a[d+1],c);return h[d](e)};return c?b=>j(jL(a[0],a[f-1],b)):j}((e=c&&c.length===b.length?c:(!function(a,b){let c=a[a.length-1];for(let d=1;d<=b;d++){let e=nu(0,b,d);a.push(l1(c,1,e))}}(f=[0],b.length-1),f),e.map(b=>b*a)),b,{ease:Array.isArray(g)?g:b.map(()=>g||ni).splice(0,b.length-1)});return{calculatedDuration:a,next:b=>(h.value=i(b),h.done=b>=a,h)}}let nw={decay:nd,inertia:nd,tween:nv,keyframes:nv,spring:nc};function nx(a){"string"==typeof a.type&&(a.type=nw[a.type])}let ny=a=>a/100;class nz extends lj{constructor(a){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:a}=this.options;a&&a.updatedAt!==lv.now()&&this.tick(lv.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},lk.mainThread++,this.options=a,this.initAnimation(),this.play(),!1===a.autoplay&&this.pause()}initAnimation(){let{options:a}=this;nx(a);let{type:b=nv,repeat:c=0,repeatDelay:d=0,repeatType:e,velocity:f=0}=a,{keyframes:g}=a,h=b||nv;h!==nv&&"number"!=typeof g[0]&&(this.mixKeyframes=mP(ny,m0(g[0],g[1])),g=[0,100]);let i=h({...a,keyframes:g});"mirror"===e&&(this.mirroredGenerator=h({...a,keyframes:[...g].reverse(),velocity:-f})),null===i.calculatedDuration&&(i.calculatedDuration=m2(i));let{calculatedDuration:j}=i;this.calculatedDuration=j,this.resolvedDuration=j+d,this.totalDuration=this.resolvedDuration*(c+1)-d,this.generator=i}updateTime(a){let b=Math.round(a-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=b}tick(a,b=!1){let{generator:c,totalDuration:d,mixKeyframes:e,mirroredGenerator:f,resolvedDuration:g,calculatedDuration:h}=this;if(null===this.startTime)return c.next(0);let{delay:i=0,keyframes:j,repeat:k,repeatType:l,repeatDelay:m,type:n,onUpdate:o,finalKeyframe:p}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,a):this.speed<0&&(this.startTime=Math.min(a-d/this.speed,this.startTime)),b?this.currentTime=a:this.updateTime(a);let q=this.currentTime-i*(this.playbackSpeed>=0?1:-1),r=this.playbackSpeed>=0?q<0:q>d;this.currentTime=Math.max(q,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=d);let s=this.currentTime,t=c;if(k){let a=Math.min(this.currentTime,d)/g,b=Math.floor(a),c=a%1;!c&&a>=1&&(c=1),1===c&&b--,(b=Math.min(b,k+1))%2&&("reverse"===l?(c=1-c,m&&(c-=m/g)):"mirror"===l&&(t=f)),s=jL(0,1,c)*g}let u=r?{done:!1,value:j[0]}:t.next(s);e&&(u.value=e(u.value));let{done:v}=u;r||null===h||(v=this.playbackSpeed>=0?this.currentTime>=d:this.currentTime<=0);let w=null===this.holdTime&&("finished"===this.state||"running"===this.state&&v);return w&&n!==nd&&(u.value=li(j,this.options,p,this.speed)),o&&o(u.value),w&&this.finish(),u}then(a,b){return this.finished.then(a,b)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:a=0}=this.options||{};return this.duration+a/1e3}get time(){return this.currentTime/1e3}set time(a){a=k9(a),this.currentTime=a,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=a:this.driver&&(this.startTime=this.driver.now()-a/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(a){this.updateTime(lv.now());let b=this.playbackSpeed!==a;this.playbackSpeed=a,b&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:a=m1,startTime:b}=this.options;this.driver||(this.driver=a(a=>this.tick(a))),this.options.onPlay?.();let c=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=c):null!==this.holdTime?this.startTime=c-this.holdTime:this.startTime||(this.startTime=b??c),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(lv.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,lk.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(a){return this.startTime=0,this.tick(a,!0)}attachTimeline(a){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),a.observe(this)}}let nA={anticipate:no,backInOut:nn,circInOut:nr};class nB extends lr{constructor(a){!function(a){"string"==typeof a.ease&&a.ease in nA&&(a.ease=nA[a.ease])}(a),nx(a),super(a),void 0!==a.startTime&&(this.startTime=a.startTime),this.options=a}updateMotionValue(a){let{motionValue:b,onUpdate:c,onComplete:d,element:e,...f}=this.options;if(!b)return;if(void 0!==a)return void b.set(a);let g=new nz({...f,autoplay:!1}),h=Math.max(10,lv.now()-this.startTime),i=jL(0,10,h-10);b.setWithVelocity(g.sample(Math.max(0,h-i)).value,g.sample(h).value,i),g.stop()}}let nC=(a,b)=>"zIndex"!==b&&!!("number"==typeof a||Array.isArray(a)||"string"==typeof a&&(kc.test(a)||"0"===a)&&!a.startsWith("url("));function nD(a){a.duration=0,a.type="keyframes"}let nE=new Set(["opacity","clipPath","filter","transform"]),nF=ld(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class nG extends lj{constructor({autoplay:a=!0,delay:b=0,type:c="keyframes",repeat:d=0,repeatDelay:e=0,repeatType:f="loop",keyframes:g,name:h,motionValue:i,element:j,...k}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=lv.now();const l={autoplay:a,delay:b,type:c,repeat:d,repeatDelay:e,repeatType:f,name:h,motionValue:i,element:j,...k},m=j?.KeyframeResolver||k4;this.keyframeResolver=new m(g,(a,b,c)=>this.onKeyframesResolved(a,b,l,!c),h,i,j),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(a,b,c,d){this.keyframeResolver=void 0;let{name:e,type:f,velocity:g,delay:h,isHandoff:i,onUpdate:j}=c;this.resolvedAt=lv.now(),!function(a,b,c,d){let e=a[0];if(null===e)return!1;if("display"===b||"visibility"===b)return!0;let f=a[a.length-1],g=nC(e,b),h=nC(f,b);return kv(g===h,`You are trying to animate ${b} from "${e}" to "${f}". "${g?f:e}" is not an animatable value.`,"value-not-animatable"),!!g&&!!h&&(function(a){let b=a[0];if(1===a.length)return!0;for(let c=0;c<a.length;c++)if(a[c]!==b)return!0}(a)||("spring"===c||lq(c))&&d)}(a,e,f,g)&&((kT.instantAnimations||!h)&&j?.(li(a,c,b)),a[0]=a[a.length-1],nD(c),c.repeat=0);let k={startTime:d?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:b,...c,keyframes:a},l=!i&&function(a){let{motionValue:b,name:c,repeatDelay:d,repeatType:e,damping:f,type:g}=a;if(!(b?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:h,transformTemplate:i}=b.owner.getProps();return nF()&&c&&nE.has(c)&&("transform"!==c||!i)&&!h&&!d&&"mirror"!==e&&0!==f&&"inertia"!==g}(k),m=k.motionValue?.owner?.current,n=l?new nB({...k,element:m}):new nz(k);n.finished.then(()=>{this.notifyFinished()}).catch(kS),this.pendingTimeline&&(this.stopTimeline=n.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=n}get finished(){return this._animation?this.animation.finished:this._finished}then(a,b){return this.finished.finally(a).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),k1=!0,k3(),k2(),k1=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(a){this.animation.time=a}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(a){this.animation.speed=a}get startTime(){return this.animation.startTime}attachTimeline(a){return this._animation?this.stopTimeline=this.animation.attachTimeline(a):this.pendingTimeline=a,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let nH={type:"spring",stiffness:500,damping:25,restSpeed:10},nI={type:"keyframes",duration:.8},nJ={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},nK=a=>null!==a,nL=(a,b,c,d={},e,f)=>g=>{let h=mK(d,a)||{},i=h.delay||d.delay||0,{elapsed:j=0}=d;j-=k9(i);let k={keyframes:Array.isArray(c)?c:[null,c],ease:"easeOut",velocity:b.getVelocity(),...h,delay:-j,onUpdate:a=>{b.set(a),h.onUpdate&&h.onUpdate(a)},onComplete:()=>{g(),h.onComplete&&h.onComplete()},name:a,motionValue:b,element:f?void 0:e};!function({when:a,delay:b,delayChildren:c,staggerChildren:d,staggerDirection:e,repeat:f,repeatType:g,repeatDelay:h,from:i,elapsed:j,...k}){return!!Object.keys(k).length}(h)&&Object.assign(k,((a,{keyframes:b})=>b.length>2?nI:jK.has(a)?a.startsWith("scale")?{type:"spring",stiffness:550,damping:0===b[1]?2*Math.sqrt(550):30,restSpeed:10}:nH:nJ)(a,k)),k.duration&&(k.duration=k9(k.duration)),k.repeatDelay&&(k.repeatDelay=k9(k.repeatDelay)),void 0!==k.from&&(k.keyframes[0]=k.from);let l=!1;if(!1!==k.type&&(0!==k.duration||k.repeatDelay)||(nD(k),0===k.delay&&(l=!0)),(kT.instantAnimations||kT.skipAnimations||e?.shouldSkipAnimations)&&(l=!0,nD(k),k.delay=0),k.allowFlatten=!h.type&&!h.ease,l&&!f&&void 0!==b.get()){let a=function(a,{repeat:b,repeatType:c="loop"}){let d=a.filter(nK),e=b&&"loop"!==c&&b%2==1?0:d.length-1;return d[e]}(k.keyframes,h);if(void 0!==a)return void kW.update(()=>{k.onUpdate(a),k.onComplete()})}return h.isSync?new nz(k):new nG(k)};function nM(a,b,{delay:c=0,transitionOverride:d,type:e}={}){let{transition:f,transitionEnd:g,...h}=b,i=a.getDefaultTransition();f=f?mJ(f,i):i;let j=f?.reduceMotion;d&&(f=d);let k=[],l=e&&a.animationState&&a.animationState.getState()[e];for(let b in h){let d=a.getValue(b,a.latestValues[b]??null),e=h[b];if(void 0===e||l&&function({protectedKeys:a,needsAnimating:b},c){let d=a.hasOwnProperty(c)&&!0!==b[c];return b[c]=!1,d}(l,b))continue;let g={delay:c,...mK(f||{},b)},i=d.get();if(void 0!==i&&!d.isAnimating&&!Array.isArray(e)&&e===i&&!g.velocity)continue;let m=!1;if(window.MotionHandoffAnimation){let c=a.props[mN];if(c){let a=window.MotionHandoffAnimation(c,b,kW);null!==a&&(g.startTime=a,m=!0)}}mM(a,b);let n=j??a.shouldReduceMotion;d.start(nL(b,d,e,n&&kr.has(b)?{type:!1}:g,a,m));let o=d.animation;o&&k.push(o)}if(g){let b=()=>kW.update(()=>{g&&function(a,b){let{transitionEnd:c={},transition:d={},...e}=mI(a,b)||{};for(let b in e={...e,...c}){var f;let c=mL(f=e[b])?f[f.length-1]||0:f;a.hasValue(b)?a.getValue(b).set(c):a.addValue(b,lx(c))}}(a,g)});k.length?Promise.all(k).then(b):b()}return k}function nN(a,b,c,d=0,e=1){let f=Array.from(a).sort((a,b)=>a.sortNodePosition(b)).indexOf(b),g=a.size,h=(g-1)*d;return"function"==typeof c?c(f,g):1===e?f*d:h-f*d}function nO(a,b,c={}){let d=mI(a,b,"exit"===c.type?a.presenceContext?.custom:void 0),{transition:e=a.getDefaultTransition()||{}}=d||{};c.transitionOverride&&(e=c.transitionOverride);let f=d?()=>Promise.all(nM(a,d,c)):()=>Promise.resolve(),g=a.variantChildren&&a.variantChildren.size?(d=0)=>{let{delayChildren:f=0,staggerChildren:g,staggerDirection:h}=e;return function(a,b,c=0,d=0,e=0,f=1,g){let h=[];for(let i of a.variantChildren)i.notify("AnimationStart",b),h.push(nO(i,b,{...g,delay:c+("function"==typeof d?0:d)+nN(a.variantChildren,i,d,e,f)}).then(()=>i.notify("AnimationComplete",b)));return Promise.all(h)}(a,b,d,f,g,h,c)}:()=>Promise.resolve(),{when:h}=e;if(!h)return Promise.all([f(),g(c.delay)]);{let[a,b]="beforeChildren"===h?[f,g]:[g,f];return a().then(()=>b())}}let nP=lD.length;function nQ(a,b){if(!Array.isArray(b))return!1;let c=b.length;if(c!==a.length)return!1;for(let d=0;d<c;d++)if(b[d]!==a[d])return!1;return!0}let nR=[...lC].reverse(),nS=lC.length;function nT(a=!1){return{isActive:a,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function nU(){return{animate:nT(!0),whileInView:nT(),whileHover:nT(),whileTap:nT(),whileDrag:nT(),whileFocus:nT(),exit:nT()}}class nV extends mH{constructor(a){super(a),a.animationState||(a.animationState=function(a){let b=b=>Promise.all(b.map(({animation:b,options:c})=>(function(a,b,c={}){let d;if(a.notify("AnimationStart",b),Array.isArray(b))d=Promise.all(b.map(b=>nO(a,b,c)));else if("string"==typeof b)d=nO(a,b,c);else{let e="function"==typeof b?mI(a,b,c.custom):b;d=Promise.all(nM(a,e,c))}return d.then(()=>{a.notify("AnimationComplete",b)})})(a,b,c))),c=nU(),d=!0,e=!1,f=b=>(c,d)=>{let e=mI(a,d,"exit"===b?a.presenceContext?.custom:void 0);if(e){let{transition:a,transitionEnd:b,...d}=e;c={...c,...d,...b}}return c};function g(g){let{props:h}=a,i=function a(b){if(!b)return;if(!b.isControllingVariants){let c=b.parent&&a(b.parent)||{};return void 0!==b.props.initial&&(c.initial=b.props.initial),c}let c={};for(let a=0;a<nP;a++){let d=lD[a],e=b.props[d];(lB(e)||!1===e)&&(c[d]=e)}return c}(a.parent)||{},j=[],k=new Set,l={},m=1/0;for(let b=0;b<nS;b++){var n,o;let p=nR[b],q=c[p],r=void 0!==h[p]?h[p]:i[p],s=lB(r),t=p===g?q.isActive:null;!1===t&&(m=b);let u=r===i[p]&&r!==h[p]&&s;if(u&&(d||e)&&a.manuallyAnimateOnMount&&(u=!1),q.protectedKeys={...l},!q.isActive&&null===t||!r&&!q.prevProp||lA(r)||"boolean"==typeof r)continue;if("exit"===p&&q.isActive&&!0!==t){q.prevResolvedValues&&(l={...l,...q.prevResolvedValues});continue}let v=(n=q.prevProp,"string"==typeof(o=r)?o!==n:!!Array.isArray(o)&&!nQ(o,n)),w=v||p===g&&q.isActive&&!u&&s||b>m&&s,x=!1,y=Array.isArray(r)?r:[r],z=y.reduce(f(p),{});!1===t&&(z={});let{prevResolvedValues:A={}}=q,B={...A,...z},C=b=>{w=!0,k.has(b)&&(x=!0,k.delete(b)),q.needsAnimating[b]=!0;let c=a.getValue(b);c&&(c.liveStyle=!1)};for(let a in B){let b=z[a],c=A[a];if(!l.hasOwnProperty(a))(mL(b)&&mL(c)?nQ(b,c):b===c)?void 0!==b&&k.has(a)?C(a):q.protectedKeys[a]=!0:null!=b?C(a):k.add(a)}q.prevProp=r,q.prevResolvedValues=z,q.isActive&&(l={...l,...z}),(d||e)&&a.blockInitialAnimation&&(w=!1);let D=u&&v,E=!D||x;w&&E&&j.push(...y.map(b=>{let c={type:p};if("string"==typeof b&&(d||e)&&!D&&a.manuallyAnimateOnMount&&a.parent){let{parent:d}=a,e=mI(d,b);if(d.enteringChildren&&e){let{delayChildren:b}=e.transition||{};c.delay=nN(d.enteringChildren,a,b)}}return{animation:b,options:c}}))}if(k.size){let b={};if("boolean"!=typeof h.initial){let c=mI(a,Array.isArray(h.initial)?h.initial[0]:h.initial);c&&c.transition&&(b.transition=c.transition)}k.forEach(c=>{let d=a.getBaseTarget(c),e=a.getValue(c);e&&(e.liveStyle=!0),b[c]=d??null}),j.push({animation:b})}let p=!!j.length;return d&&(!1===h.initial||h.initial===h.animate)&&!a.manuallyAnimateOnMount&&(p=!1),d=!1,e=!1,p?b(j):Promise.resolve()}return{animateChanges:g,setActive:function(b,d){if(c[b].isActive===d)return Promise.resolve();a.variantChildren?.forEach(a=>a.animationState?.setActive(b,d)),c[b].isActive=d;let e=g(b);for(let a in c)c[a].protectedKeys={};return e},setAnimateFunction:function(c){b=c(a)},getState:()=>c,reset:()=>{c=nU(),e=!0}}}(a))}updateAnimationControlsSubscription(){let{animate:a}=this.node.getProps();lA(a)&&(this.unmountControls=a.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:a}=this.node.getProps(),{animate:b}=this.node.prevProps||{};a!==b&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let nW=0;class nX extends mH{constructor(){super(...arguments),this.id=nW++}update(){if(!this.node.presenceContext)return;let{isPresent:a,onExitComplete:b}=this.node.presenceContext,{isPresent:c}=this.node.prevPresenceContext||{};if(!this.node.animationState||a===c)return;let d=this.node.animationState.setActive("exit",!a);b&&!a&&d.then(()=>{b(this.id)})}mount(){let{register:a,onExitComplete:b}=this.node.presenceContext||{};b&&b(this.id),a&&(this.unmount=a(this.id))}unmount(){}}let nY={x:!1,y:!1};function nZ(a){return[a("x"),a("y")]}function n$(a){return a.max-a.min}function n_(a,b,c,d=.5){a.origin=d,a.originPoint=l1(b.min,b.max,a.origin),a.scale=n$(c)/n$(b),a.translate=l1(c.min,c.max,a.origin)-a.originPoint,(a.scale>=.9999&&a.scale<=1.0001||isNaN(a.scale))&&(a.scale=1),(a.translate>=-.01&&a.translate<=.01||isNaN(a.translate))&&(a.translate=0)}function n0(a,b,c,d){n_(a.x,b.x,c.x,d?d.originX:void 0),n_(a.y,b.y,c.y,d?d.originY:void 0)}function n1(a,b,c){a.min=c.min+b.min,a.max=a.min+n$(b)}function n2(a,b,c){a.min=b.min-c.min,a.max=a.min+n$(b)}function n3(a,b,c){n2(a.x,b.x,c.x),n2(a.y,b.y,c.y)}let n4=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]),n5=new Set(["INPUT","SELECT","TEXTAREA"]);function n6(a,b,c,d={passive:!0}){return a.addEventListener(b,c,d),()=>a.removeEventListener(b,c)}function n7(a){return"object"==typeof a&&null!==a}function n8(a){return n7(a)&&"ownerSVGElement"in a}function n9(a,b,c){if(null==a)return[];if(a instanceof EventTarget)return[a];if("string"==typeof a){let d=document;b&&(d=b.current);let e=c?.[a]??d.querySelectorAll(a);return e?Array.from(e):[]}return Array.from(a).filter(a=>null!=a)}let oa=new WeakMap,ob=(a,b,c)=>(d,e)=>e&&e[0]?e[0][a+"Size"]:n8(d)&&"getBBox"in d?d.getBBox()[b]:d[c],oc=ob("inline","width","offsetWidth"),od=ob("block","height","offsetHeight");function oe({target:a,borderBoxSize:b}){oa.get(a)?.forEach(c=>{c(a,{get width(){return oc(a,b)},get height(){return od(a,b)}})})}function of(a){a.forEach(oe)}let og=new Set;function oh(a,b){let c;return"function"==typeof a?(og.add(a),f||(f=()=>{let a={get width(){return window.innerWidth},get height(){return window.innerHeight}};og.forEach(b=>b(a))},window.addEventListener("resize",f)),()=>{og.delete(a),og.size||"function"!=typeof f||(window.removeEventListener("resize",f),f=void 0)}):(!e&&"u">typeof ResizeObserver&&(e=new ResizeObserver(of)),(c=n9(a)).forEach(a=>{let c=oa.get(a);c||(c=new Set,oa.set(a,c)),c.add(b),e?.observe(a)}),()=>{c.forEach(a=>{let c=oa.get(a);c?.delete(b),c?.size||e?.unobserve(a)})})}let oi=a=>"mouse"===a.pointerType?"number"!=typeof a.button||a.button<=0:!1!==a.isPrimary;function oj(a){return{point:{x:a.pageX,y:a.pageY}}}function ok(a,b,c,d){return n6(a,b,a=>oi(a)&&c(a,oj(a)),d)}let ol=({current:a})=>a?a.ownerDocument.defaultView:null;function om(a){return a&&"object"==typeof a&&Object.prototype.hasOwnProperty.call(a,"current")}let on=(a,b)=>Math.abs(a-b),oo=new Set(["auto","scroll"]);class op{constructor(a,b,{transformPagePoint:c,contextWindow:d=window,dragSnapToOrigin:e=!1,distanceThreshold:f=3,element:g}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=a=>{this.handleScroll(a.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var a,b;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let c=os(this.lastMoveEventInfo,this.history),d=null!==this.startEvent,e=(a=c.offset,b={x:0,y:0},Math.sqrt(on(a.x,b.x)**2+on(a.y,b.y)**2)>=this.distanceThreshold);if(!d&&!e)return;let{point:f}=c,{timestamp:g}=kY;this.history.push({...f,timestamp:g});let{onStart:h,onMove:i}=this.handlers;d||(h&&h(this.lastMoveEvent,c),this.startEvent=this.lastMoveEvent),i&&i(this.lastMoveEvent,c)},this.handlePointerMove=(a,b)=>{this.lastMoveEvent=a,this.lastMoveEventInfo=oq(b,this.transformPagePoint),kW.update(this.updatePoint,!0)},this.handlePointerUp=(a,b)=>{this.end();let{onEnd:c,onSessionEnd:d,resumeAnimation:e}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&e&&e(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let f=os("pointercancel"===a.type?this.lastMoveEventInfo:oq(b,this.transformPagePoint),this.history);this.startEvent&&c&&c(a,f),d&&d(a,f)},!oi(a))return;this.dragSnapToOrigin=e,this.handlers=b,this.transformPagePoint=c,this.distanceThreshold=f,this.contextWindow=d||window;const h=oq(oj(a),this.transformPagePoint),{point:i}=h,{timestamp:j}=kY;this.history=[{...i,timestamp:j}];const{onSessionStart:k}=b;k&&k(a,os(h,this.history)),this.removeListeners=mP(ok(this.contextWindow,"pointermove",this.handlePointerMove),ok(this.contextWindow,"pointerup",this.handlePointerUp),ok(this.contextWindow,"pointercancel",this.handlePointerUp)),g&&this.startScrollTracking(g)}startScrollTracking(a){let b=a.parentElement;for(;b;){let a=getComputedStyle(b);(oo.has(a.overflowX)||oo.has(a.overflowY))&&this.scrollPositions.set(b,{x:b.scrollLeft,y:b.scrollTop}),b=b.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(a){let b=this.scrollPositions.get(a);if(!b)return;let c=a===window,d=c?{x:window.scrollX,y:window.scrollY}:{x:a.scrollLeft,y:a.scrollTop},e={x:d.x-b.x,y:d.y-b.y};(0!==e.x||0!==e.y)&&(c?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=e.x,this.lastMoveEventInfo.point.y+=e.y):this.history.length>0&&(this.history[0].x-=e.x,this.history[0].y-=e.y),this.scrollPositions.set(a,d),kW.update(this.updatePoint,!0))}updateHandlers(a){this.handlers=a}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),kX(this.updatePoint)}}function oq(a,b){return b?{point:b(a.point)}:a}function or(a,b){return{x:a.x-b.x,y:a.y-b.y}}function os({point:a},b){return{point:a,delta:or(a,ot(b)),offset:or(a,b[0]),velocity:function(a){if(a.length<2)return{x:0,y:0};let b=a.length-1,c=null,d=ot(a);for(;b>=0&&(c=a[b],!(d.timestamp-c.timestamp>k9(.1)));)b--;if(!c)return{x:0,y:0};c===a[0]&&a.length>2&&d.timestamp-c.timestamp>2*k9(.1)&&(c=a[1]);let e=(d.timestamp-c.timestamp)/1e3;if(0===e)return{x:0,y:0};let f={x:(d.x-c.x)/e,y:(d.y-c.y)/e};return f.x===1/0&&(f.x=0),f.y===1/0&&(f.y=0),f}(b)}}function ot(a){return a[a.length-1]}function ou(a,b,c){return{min:void 0!==b?a.min+b:void 0,max:void 0!==c?a.max+c-(a.max-a.min):void 0}}function ov(a,b){let c=b.min-a.min,d=b.max-a.max;return b.max-b.min<a.max-a.min&&([c,d]=[d,c]),{min:c,max:d}}function ow(a,b,c){return{min:ox(a,b),max:ox(a,c)}}function ox(a,b){return"number"==typeof a?a:a[b]||0}let oy=new WeakMap;class oz{constructor(a){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=kp(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=a}start(a,{snapToCursor:b=!1,distanceThreshold:c}={}){let{presenceContext:d}=this.visualElement;if(d&&!1===d.isPresent)return;let e=a=>{b&&this.snapToCursor(oj(a).point),this.stopAnimation()},f=(a,b)=>{let{drag:c,dragPropagation:d,onDragStart:e}=this.getProps();if(c&&!d&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(a){if("x"===a||"y"===a)if(nY[a])return null;else return nY[a]=!0,()=>{nY[a]=!1};return nY.x||nY.y?null:(nY.x=nY.y=!0,()=>{nY.x=nY.y=!1})}(c),!this.openDragLock))return;this.latestPointerEvent=a,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),nZ(a=>{let b=this.getAxisMotionValue(a).get()||0;if(jZ.test(b)){let{projection:c}=this.visualElement;if(c&&c.layout){let d=c.layout.layoutBox[a];d&&(b=n$(d)*(parseFloat(b)/100))}}this.originPoint[a]=b}),e&&kW.update(()=>e(a,b),!1,!0),mM(this.visualElement,"transform");let{animationState:f}=this.visualElement;f&&f.setActive("whileDrag",!0)},g=(a,b)=>{this.latestPointerEvent=a,this.latestPanInfo=b;let{dragPropagation:c,dragDirectionLock:d,onDirectionLock:e,onDrag:f}=this.getProps();if(!c&&!this.openDragLock)return;let{offset:g}=b;if(d&&null===this.currentDirection){this.currentDirection=function(a,b=10){let c=null;return Math.abs(a.y)>b?c="y":Math.abs(a.x)>b&&(c="x"),c}(g),null!==this.currentDirection&&e&&e(this.currentDirection);return}this.updateAxis("x",b.point,g),this.updateAxis("y",b.point,g),this.visualElement.render(),f&&kW.update(()=>f(a,b),!1,!0)},h=(a,b)=>{this.latestPointerEvent=a,this.latestPanInfo=b,this.stop(a,b),this.latestPointerEvent=null,this.latestPanInfo=null},i=()=>{let{dragSnapToOrigin:a}=this.getProps();(a||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:j}=this.getProps();this.panSession=new op(a,{onSessionStart:e,onStart:f,onMove:g,onSessionEnd:h,resumeAnimation:i},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:j,distanceThreshold:c,contextWindow:ol(this.visualElement),element:this.visualElement.current})}stop(a,b){let c=a||this.latestPointerEvent,d=b||this.latestPanInfo,e=this.isDragging;if(this.cancel(),!e||!d||!c)return;let{velocity:f}=d;this.startAnimation(f);let{onDragEnd:g}=this.getProps();g&&kW.postRender(()=>g(c,d))}cancel(){this.isDragging=!1;let{projection:a,animationState:b}=this.visualElement;a&&(a.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:c}=this.getProps();!c&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),b&&b.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(a,b,c){let{drag:d}=this.getProps();if(!c||!oB(a,d,this.currentDirection))return;let e=this.getAxisMotionValue(a),f=this.originPoint[a]+c[a];this.constraints&&this.constraints[a]&&(f=function(a,{min:b,max:c},d){return void 0!==b&&a<b?a=d?l1(b,a,d.min):Math.max(a,b):void 0!==c&&a>c&&(a=d?l1(c,a,d.max):Math.min(a,c)),a}(f,this.constraints[a],this.elastic[a])),e.set(f)}resolveConstraints(){let{dragConstraints:a,dragElastic:b}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,d=this.constraints;a&&om(a)?this.constraints||(this.constraints=this.resolveRefConstraints()):a&&c?this.constraints=function(a,{top:b,left:c,bottom:d,right:e}){return{x:ou(a.x,c,e),y:ou(a.y,b,d)}}(c.layoutBox,a):this.constraints=!1,this.elastic=function(a=.35){return!1===a?a=0:!0===a&&(a=.35),{x:ow(a,"left","right"),y:ow(a,"top","bottom")}}(b),d!==this.constraints&&!om(a)&&c&&this.constraints&&!this.hasMutatedConstraints&&nZ(a=>{var b,d;let e;!1!==this.constraints&&this.getAxisMotionValue(a)&&(this.constraints[a]=(b=c.layoutBox[a],d=this.constraints[a],e={},void 0!==d.min&&(e.min=d.min-b.min),void 0!==d.max&&(e.max=d.max-b.min),e))})}resolveRefConstraints(){var a;let{dragConstraints:b,onMeasureDragConstraints:c}=this.getProps();if(!b||!om(b))return!1;let d=b.current;kw(null!==d,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:e}=this.visualElement;if(!e||!e.layout)return!1;let f=function(a,b,c){let d=mj(a,c),{scroll:e}=b;return e&&(mf(d.x,e.offset.x),mf(d.y,e.offset.y)),d}(d,e.root,this.visualElement.getTransformPagePoint()),g=(a=e.layout.layoutBox,{x:ov(a.x,f.x),y:ov(a.y,f.y)});if(c){let a=c(function({x:a,y:b}){return{top:b.min,right:a.max,bottom:b.max,left:a.min}}(g));this.hasMutatedConstraints=!!a,a&&(g=l7(a))}return g}startAnimation(a){let{drag:b,dragMomentum:c,dragElastic:d,dragTransition:e,dragSnapToOrigin:f,onDragTransitionEnd:g}=this.getProps(),h=this.constraints||{};return Promise.all(nZ(g=>{if(!oB(g,b,this.currentDirection))return;let i=h&&h[g]||{};f&&(i={min:0,max:0});let j={type:"inertia",velocity:c?a[g]:0,bounceStiffness:d?200:1e6,bounceDamping:d?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...e,...i};return this.startAxisValueAnimation(g,j)})).then(g)}startAxisValueAnimation(a,b){let c=this.getAxisMotionValue(a);return mM(this.visualElement,a),c.start(nL(a,c,0,b,this.visualElement,!1))}stopAnimation(){nZ(a=>this.getAxisMotionValue(a).stop())}getAxisMotionValue(a){let b=`_drag${a.toUpperCase()}`,c=this.visualElement.getProps();return c[b]||this.visualElement.getValue(a,(c.initial?c.initial[a]:void 0)||0)}snapToCursor(a){nZ(b=>{let{drag:c}=this.getProps();if(!oB(b,c,this.currentDirection))return;let{projection:d}=this.visualElement,e=this.getAxisMotionValue(b);if(d&&d.layout){let{min:c,max:f}=d.layout.layoutBox[b],g=e.get()||0;e.set(a[b]-l1(c,f,.5)+g)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:a,dragConstraints:b}=this.getProps(),{projection:c}=this.visualElement;if(!om(b)||!c||!this.constraints)return;this.stopAnimation();let d={x:0,y:0};nZ(a=>{let b=this.getAxisMotionValue(a);if(b&&!1!==this.constraints){var c,e;let f,g,h,i=b.get();d[a]=(c={min:i,max:i},e=this.constraints[a],f=.5,g=n$(c),(h=n$(e))>g?f=nu(e.min,e.max-g,c.min):g>h&&(f=nu(c.min,c.max-h,e.min)),jL(0,1,f))}});let{transformTemplate:e}=this.visualElement.getProps();this.visualElement.current.style.transform=e?e({},""):"none",c.root&&c.root.updateScroll(),c.updateLayout(),this.constraints=!1,this.resolveConstraints(),nZ(b=>{if(!oB(b,a,null))return;let c=this.getAxisMotionValue(b),{min:e,max:f}=this.constraints[b];c.set(l1(e,f,d[b]))}),this.visualElement.render()}addListeners(){let a;if(!this.visualElement.current)return;oy.set(this.visualElement,this);let b=this.visualElement.current,c=ok(b,"pointerdown",a=>{let{drag:c,dragListener:d=!0}=this.getProps(),e=a.target,f=e!==b&&(n5.has(e.tagName)||!0===e.isContentEditable);c&&d&&!f&&this.start(a)}),d=()=>{var c,d,e;let f,g,{dragConstraints:h}=this.getProps();om(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),a||(c=b,d=h.current,f=oh(c,oA(e=()=>this.scalePositionWithinConstraints())),g=oh(d,oA(e)),a=()=>{f(),g()}))},{projection:e}=this.visualElement,f=e.addEventListener("measure",d);e&&!e.layout&&(e.root&&e.root.updateScroll(),e.updateLayout()),kW.read(d);let g=n6(window,"resize",()=>this.scalePositionWithinConstraints()),h=e.addEventListener("didUpdate",({delta:a,hasLayoutChanged:b})=>{this.isDragging&&b&&(nZ(b=>{let c=this.getAxisMotionValue(b);c&&(this.originPoint[b]+=a[b].translate,c.set(c.get()+a[b].translate))}),this.visualElement.render())});return()=>{g(),c(),f(),h&&h(),a&&a()}}getProps(){let a=this.visualElement.getProps(),{drag:b=!1,dragDirectionLock:c=!1,dragPropagation:d=!1,dragConstraints:e=!1,dragElastic:f=.35,dragMomentum:g=!0}=a;return{...a,drag:b,dragDirectionLock:c,dragPropagation:d,dragConstraints:e,dragElastic:f,dragMomentum:g}}}function oA(a){let b=!0;return()=>{if(b){b=!1;return}a()}}function oB(a,b,c){return(!0===b||b===a)&&(null===c||c===a)}class oC extends mH{constructor(a){super(a),this.removeGroupControls=kS,this.removeListeners=kS,this.controls=new oz(a)}mount(){let{dragControls:a}=this.node.getProps();a&&(this.removeGroupControls=a.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||kS}update(){let{dragControls:a}=this.node.getProps(),{dragControls:b}=this.node.prevProps||{};a!==b&&(this.removeGroupControls(),a&&(this.removeGroupControls=a.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}let oD=a=>(b,c)=>{a&&kW.update(()=>a(b,c),!1,!0)};class oE extends mH{constructor(){super(...arguments),this.removePointerDownListener=kS}onPointerDown(a){this.session=new op(a,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:ol(this.node)})}createPanHandlers(){let{onPanSessionStart:a,onPanStart:b,onPan:c,onPanEnd:d}=this.node.getProps();return{onSessionStart:oD(a),onStart:oD(b),onMove:oD(c),onEnd:(a,b)=>{delete this.session,d&&kW.postRender(()=>d(a,b))}}}mount(){this.removePointerDownListener=ok(this.node.current,"pointerdown",a=>this.onPointerDown(a))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let oF={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function oG(a=!0){let b=(0,E.useContext)(my);if(null===b)return[!0,null];let{isPresent:c,onExitComplete:d,register:e}=b,f=(0,E.useId)(),g=(0,E.useCallback)(()=>a&&d&&d(f),[f,d,a]);return!c&&d?[!1,g]:[!0]}let oH=(0,E.createContext)({}),oI=!1;class oJ extends E.Component{componentDidMount(){let{visualElement:a,layoutGroup:b,switchLayoutGroup:c,layoutId:d}=this.props,{projection:e}=a;e&&(b.group&&b.group.add(e),c&&c.register&&d&&c.register(e),oI&&e.root.didUpdate(),e.addEventListener("animationComplete",()=>{this.safeToRemove()}),e.setOptions({...e.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),oF.hasEverUpdated=!0}getSnapshotBeforeUpdate(a){let{layoutDependency:b,visualElement:c,drag:d,isPresent:e}=this.props,{projection:f}=c;return f&&(f.isPresent=e,a.layoutDependency!==b&&f.setOptions({...f.options,layoutDependency:b}),oI=!0,d||a.layoutDependency!==b||void 0===b||a.isPresent!==e?f.willUpdate():this.safeToRemove(),a.isPresent!==e&&(e?f.promote():f.relegate()||kW.postRender(()=>{let a=f.getStack();a&&a.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:a}=this.props.visualElement;a&&(a.root.didUpdate(),lt.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:a,layoutGroup:b,switchLayoutGroup:c}=this.props,{projection:d}=a;oI=!0,d&&(d.scheduleCheckAfterUnmount(),b&&b.group&&b.group.remove(d),c&&c.deregister&&c.deregister(d))}safeToRemove(){let{safeToRemove:a}=this.props;a&&a()}render(){return null}}function oK(a){let[b,c]=oG(),d=(0,E.useContext)(mn);return(0,D.jsx)(oJ,{...a,layoutGroup:d,switchLayoutGroup:(0,E.useContext)(oH),isPresent:b,safeToRemove:c})}let oL=["TopLeft","TopRight","BottomLeft","BottomRight"],oM=oL.length,oN=a=>"string"==typeof a?parseFloat(a):a,oO=a=>"number"==typeof a||j$.test(a);function oP(a,b){return void 0!==a[b]?a[b]:a.borderRadius}let oQ=oS(0,.5,nq),oR=oS(.5,.95,kS);function oS(a,b,c){return d=>d<a?0:d>b?1:c(nu(a,b,d))}function oT(a,b){a.min=b.min,a.max=b.max}function oU(a,b){oT(a.x,b.x),oT(a.y,b.y)}function oV(a,b){a.translate=b.translate,a.scale=b.scale,a.originPoint=b.originPoint,a.origin=b.origin}function oW(a,b,c,d,e){return a-=b,a=d+1/c*(a-d),void 0!==e&&(a=d+1/e*(a-d)),a}function oX(a,b,[c,d,e],f,g){!function(a,b=0,c=1,d=.5,e,f=a,g=a){if(jZ.test(b)&&(b=parseFloat(b),b=l1(g.min,g.max,b/100)-g.min),"number"!=typeof b)return;let h=l1(f.min,f.max,d);a===f&&(h-=b),a.min=oW(a.min,b,c,h,e),a.max=oW(a.max,b,c,h,e)}(a,b[c],b[d],b[e],b.scale,f,g)}let oY=["x","scaleX","originX"],oZ=["y","scaleY","originY"];function o$(a,b,c,d){oX(a.x,b,oY,c?c.x:void 0,d?d.x:void 0),oX(a.y,b,oZ,c?c.y:void 0,d?d.y:void 0)}function o_(a){return 0===a.translate&&1===a.scale}function o0(a){return o_(a.x)&&o_(a.y)}function o1(a,b){return a.min===b.min&&a.max===b.max}function o2(a,b){return Math.round(a.min)===Math.round(b.min)&&Math.round(a.max)===Math.round(b.max)}function o3(a,b){return o2(a.x,b.x)&&o2(a.y,b.y)}function o4(a){return n$(a.x)/n$(a.y)}function o5(a,b){return a.translate===b.translate&&a.scale===b.scale&&a.originPoint===b.originPoint}class o6{constructor(){this.members=[]}add(a){la(this.members,a);for(let b=this.members.length-1;b>=0;b--){let c=this.members[b];if(c===a||c===this.lead||c===this.prevLead)continue;let d=c.instance;d&&!1!==d.isConnected||c.snapshot||(lb(this.members,c),c.unmount())}a.scheduleRender()}remove(a){if(lb(this.members,a),a===this.prevLead&&(this.prevLead=void 0),a===this.lead){let a=this.members[this.members.length-1];a&&this.promote(a)}}relegate(a){for(let b=this.members.indexOf(a)-1;b>=0;b--){let a=this.members[b];if(!1!==a.isPresent&&a.instance?.isConnected!==!1)return this.promote(a),!0}return!1}promote(a,b){let c=this.lead;if(a!==c&&(this.prevLead=c,this.lead=a,a.show(),c)){c.updateSnapshot(),a.scheduleRender();let{layoutDependency:d}=c.options,{layoutDependency:e}=a.options;(void 0===d||d!==e)&&(a.resumeFrom=c,b&&(c.preserveOpacity=!0),c.snapshot&&(a.snapshot=c.snapshot,a.snapshot.latestValues=c.animationValues||c.latestValues),a.root?.isUpdating&&(a.isLayoutDirty=!0)),!1===a.options.crossfade&&c.hide()}}exitAnimationComplete(){this.members.forEach(a=>{a.options.onExitComplete?.(),a.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(a=>a.instance&&a.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}let o7=(a,b)=>a.depth-b.depth;class o8{constructor(){this.children=[],this.isDirty=!1}add(a){la(this.children,a),this.isDirty=!0}remove(a){lb(this.children,a),this.isDirty=!0}forEach(a){this.isDirty&&this.children.sort(o7),this.isDirty=!1,this.children.forEach(a)}}let o9=["","X","Y","Z"],pa=0;function pb(a,b,c,d){let{latestValues:e}=b;e[a]&&(c[a]=e[a],b.setStaticValue(a,0),d&&(d[a]=0))}function pc({attachResizeListener:a,defaultParent:b,measureScroll:c,checkIsScrollRoot:d,resetTransform:e}){return class{constructor(a={},c=b?.()){this.id=pa++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(pf),this.nodes.forEach(pm),this.nodes.forEach(pn),this.nodes.forEach(pg)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let a=0;a<this.path.length;a++)this.path[a].shouldResetTransform=!0;this.root===this&&(this.nodes=new o8)}addEventListener(a,b){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new lc),this.eventHandlers.get(a).add(b)}notifyListeners(a,...b){let c=this.eventHandlers.get(a);c&&c.notify(...b)}hasListeners(a){return this.eventHandlers.has(a)}mount(b){if(this.instance)return;this.isSVG=n8(b)&&!(n8(b)&&"svg"===b.tagName),this.instance=b;let{layoutId:c,layout:d,visualElement:e}=this.options;if(e&&!e.current&&e.mount(b),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(d||c)&&(this.isLayoutDirty=!0),a){let c,d=0,e=()=>this.root.updateBlockedByResize=!1;kW.read(()=>{d=window.innerWidth}),a(b,()=>{let a=window.innerWidth;if(a!==d){let b,f;d=a,this.root.updateBlockedByResize=!0,c&&c(),b=lv.now(),f=({timestamp:a})=>{let c=a-b;c>=250&&(kX(f),e(c-250))},kW.setup(f,!0),c=()=>kX(f),oF.hasAnimatedSinceResize&&(oF.hasAnimatedSinceResize=!1,this.nodes.forEach(pl))}})}c&&this.root.registerSharedNode(c,this),!1!==this.options.animate&&e&&(c||d)&&this.addEventListener("didUpdate",({delta:a,hasLayoutChanged:b,hasRelativeLayoutChanged:c,layout:d})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let f=this.options.transition||e.getDefaultTransition()||pt,{onLayoutAnimationStart:g,onLayoutAnimationComplete:h}=e.getProps(),i=!this.targetLayout||!o3(this.targetLayout,d),j=!b&&c;if(this.options.layoutRoot||this.resumeFrom||j||b&&(i||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let b={...mK(f,"layout"),onPlay:g,onComplete:h};(e.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b),this.setAnimationOrigin(a,j)}else b||pl(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=d})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),kX(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(po),this.animationId++)}getTransformTemplate(){let{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function a(b){if(b.hasCheckedOptimisedAppear=!0,b.root===b)return;let{visualElement:c}=b.options;if(!c)return;let d=c.props[mN];if(window.MotionHasOptimisedAnimation(d,"transform")){let{layout:a,layoutId:c}=b.options;window.MotionCancelOptimisedAnimation(d,"transform",kW,!(a||c))}let{parent:e}=b;e&&!e.hasCheckedOptimisedAppear&&a(e)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let a=0;a<this.path.length;a++){let b=this.path[a];b.shouldResetTransform=!0,b.updateScroll("snapshot"),b.options.layoutRoot&&b.willUpdate(!1)}let{layoutId:b,layout:c}=this.options;if(void 0===b&&!c)return;let d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(pi);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(pj);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(pk),this.nodes.forEach(pd),this.nodes.forEach(pe)):this.nodes.forEach(pj),this.clearAllSnapshots();let a=lv.now();kY.delta=jL(0,1e3/60,a-kY.timestamp),kY.timestamp=a,kY.isProcessing=!0,kZ.update.process(kY),kZ.preRender.process(kY),kZ.render.process(kY),kY.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,lt.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ph),this.sharedNodes.forEach(pp)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,kW.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){kW.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||n$(this.snapshot.measuredBox.x)||n$(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let a=0;a<this.path.length;a++)this.path[a].updateScroll();let a=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=kp(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:b}=this.options;b&&b.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let b=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(b=!1),b&&this.instance){let b=d(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:b,offset:c(this.instance),wasRoot:this.scroll?this.scroll.isRoot:b}}}resetTransform(){if(!e)return;let a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,b=this.projectionDelta&&!o0(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,f=d!==this.prevTransformTemplateValue;a&&this.instance&&(b||ma(this.latestValues)||f)&&(e(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){var b;let c=this.measurePageBox(),d=this.removeElementScroll(c);return a&&(d=this.removeTransform(d)),pw((b=d).x),pw(b.y),{animationId:this.root.animationId,measuredBox:c,layoutBox:d,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:a}=this.options;if(!a)return kp();let b=a.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(py))){let{scroll:a}=this.root;a&&(mf(b.x,a.offset.x),mf(b.y,a.offset.y))}return b}removeElementScroll(a){let b=kp();if(oU(b,a),this.scroll?.wasRoot)return b;for(let c=0;c<this.path.length;c++){let d=this.path[c],{scroll:e,options:f}=d;d!==this.root&&e&&f.layoutScroll&&(e.wasRoot&&oU(b,a),mf(b.x,e.offset.x),mf(b.y,e.offset.y))}return b}applyTransform(a,b=!1){let c=kp();oU(c,a);for(let a=0;a<this.path.length;a++){let d=this.path[a];!b&&d.options.layoutScroll&&d.scroll&&d!==d.root&&mi(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),ma(d.latestValues)&&mi(c,d.latestValues)}return ma(this.latestValues)&&mi(c,this.latestValues),c}removeTransform(a){let b=kp();oU(b,a);for(let a=0;a<this.path.length;a++){let c=this.path[a];if(!c.instance||!ma(c.latestValues))continue;l9(c.latestValues)&&c.updateSnapshot();let d=kp();oU(d,c.measurePageBox()),o$(b,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,d)}return ma(this.latestValues)&&o$(b,this.latestValues),b}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:void 0===a.crossfade||a.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==kY.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){let b=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=b.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=b.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=b.isSharedProjectionDirty);let c=!!this.resumingFrom||this!==b;if(!(a||c&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:d,layoutId:e}=this.options;if(!this.layout||!(d||e))return;this.resolvedRelativeTargetAt=kY.timestamp;let f=this.getClosestProjectingParent();if(f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=kp(),this.targetWithTransforms=kp()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var g,h,i;this.forceRelativeParentToResolveTarget(),g=this.target,h=this.relativeTarget,i=this.relativeParent.target,n1(g.x,h.x,i.x),n1(g.y,h.y,i.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):oU(this.target,this.layout.layoutBox),me(this.target,this.targetDelta)):oU(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&1!==this.animationProgress?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||l9(this.parent.latestValues)||mb(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(a,b,c){this.relativeParent=a,this.linkedParentVersion=a.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=kp(),this.relativeTargetOrigin=kp(),n3(this.relativeTargetOrigin,b,c),oU(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let a=this.getLead(),b=!!this.resumingFrom||this!==a,c=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(c=!1),b&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===kY.timestamp&&(c=!1),c)return;let{layout:d,layoutId:e}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||e))return;oU(this.layoutCorrected,this.layout.layoutBox);let f=this.treeScale.x,g=this.treeScale.y;!function(a,b,c,d=!1){let e,f,g=c.length;if(g){b.x=b.y=1;for(let h=0;h<g;h++){f=(e=c[h]).projectionDelta;let{visualElement:g}=e.options;(!g||!g.props.style||"contents"!==g.props.style.display)&&(d&&e.options.layoutScroll&&e.scroll&&e!==e.root&&mi(a,{x:-e.scroll.offset.x,y:-e.scroll.offset.y}),f&&(b.x*=f.x.scale,b.y*=f.y.scale,me(a,f)),d&&ma(e.latestValues)&&mi(a,e.latestValues))}b.x<1.0000000000001&&b.x>.999999999999&&(b.x=1),b.y<1.0000000000001&&b.y>.999999999999&&(b.y=1)}}(this.layoutCorrected,this.treeScale,this.path,b),a.layout&&!a.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=kp());let{target:h}=a;if(!h){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(oV(this.prevProjectionDelta.x,this.projectionDelta.x),oV(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),n0(this.projectionDelta,this.layoutCorrected,h,this.latestValues),this.treeScale.x===f&&this.treeScale.y===g&&o5(this.projectionDelta.x,this.prevProjectionDelta.x)&&o5(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",h))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){if(this.options.visualElement?.scheduleRender(),a){let a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=kn(),this.projectionDelta=kn(),this.projectionDeltaWithTransform=kn()}setAnimationOrigin(a,b=!1){let c,d=this.snapshot,e=d?d.latestValues:{},f={...this.latestValues},g=kn();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!b;let h=kp(),i=(d?d.source:void 0)!==(this.layout?this.layout.source:void 0),j=this.getStack(),k=!j||j.members.length<=1,l=!!(i&&!k&&!0===this.options.crossfade&&!this.path.some(ps));this.animationProgress=0,this.mixTargetDelta=b=>{let d=b/1e3;if(pq(g.x,a.x,d),pq(g.y,a.y,d),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var j,m,n,o,p,q;n3(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),n=this.relativeTarget,o=this.relativeTargetOrigin,p=h,q=d,pr(n.x,o.x,p.x,q),pr(n.y,o.y,p.y,q),c&&(j=this.relativeTarget,m=c,o1(j.x,m.x)&&o1(j.y,m.y))&&(this.isProjectionDirty=!1),c||(c=kp()),oU(c,this.relativeTarget)}i&&(this.animationValues=f,function(a,b,c,d,e,f){e?(a.opacity=l1(0,c.opacity??1,oQ(d)),a.opacityExit=l1(b.opacity??1,0,oR(d))):f&&(a.opacity=l1(b.opacity??1,c.opacity??1,d));for(let e=0;e<oM;e++){let f=`border${oL[e]}Radius`,g=oP(b,f),h=oP(c,f);(void 0!==g||void 0!==h)&&(g||(g=0),h||(h=0),0===g||0===h||oO(g)===oO(h)?(a[f]=Math.max(l1(oN(g),oN(h),d),0),(jZ.test(h)||jZ.test(g))&&(a[f]+="%")):a[f]=h)}(b.rotate||c.rotate)&&(a.rotate=l1(b.rotate||0,c.rotate||0,d))}(f,e,this.latestValues,d,l,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=d},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(kX(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=kW.update(()=>{var b,c,d;let e;oF.hasAnimatedSinceResize=!0,lk.layout++,this.motionValue||(this.motionValue=lx(0)),this.motionValue.jump(0,!1),this.currentAnimation=(b=this.motionValue,c=[0,1e3],d={...a,velocity:0,isSync:!0,onUpdate:b=>{this.mixTargetDelta(b),a.onUpdate&&a.onUpdate(b)},onStop:()=>{lk.layout--},onComplete:()=>{lk.layout--,a.onComplete&&a.onComplete(),this.completeAnimation()}},(e=kq(b)?b:lx(b)).start(nL("",e,c,d)),e.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let a=this.getLead(),{targetWithTransforms:b,target:c,layout:d,latestValues:e}=a;if(b&&c&&d){if(this!==a&&this.layout&&d&&px(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||kp();let b=n$(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+b;let d=n$(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+d}oU(b,c),mi(b,e),n0(this.projectionDeltaWithTransform,this.layoutCorrected,b,e)}}registerSharedNode(a,b){this.sharedNodes.has(a)||this.sharedNodes.set(a,new o6),this.sharedNodes.get(a).add(b);let c=b.options.initialPromotionConfig;b.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(b):void 0})}isLead(){let a=this.getStack();return!a||a.lead===this}getLead(){let{layoutId:a}=this.options;return a&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:a}=this.options;return a?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:b,preserveFollowOpacity:c}={}){let d=this.getStack();d&&d.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),b&&this.setOptions({transition:b})}relegate(){let a=this.getStack();return!!a&&a.relegate(this)}resetSkewAndRotation(){let{visualElement:a}=this.options;if(!a)return;let b=!1,{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(b=!0),!b)return;let d={};c.z&&pb("z",a,d,this.animationValues);for(let b=0;b<o9.length;b++)pb(`rotate${o9[b]}`,a,d,this.animationValues),pb(`skew${o9[b]}`,a,d,this.animationValues);for(let b in a.render(),d)a.setStaticValue(b,d[b]),this.animationValues&&(this.animationValues[b]=d[b]);a.scheduleRender()}applyProjectionStyles(a,b){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}let c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=mx(b?.pointerEvents)||"",a.transform=c?c(this.latestValues,""):"none";return}let d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(a.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,a.pointerEvents=mx(b?.pointerEvents)||""),this.hasProjected&&!ma(this.latestValues)&&(a.transform=c?c({},""):"none",this.hasProjected=!1);return}a.visibility="";let e=d.animationValues||d.latestValues;this.applyTransformsToTarget();let f=function(a,b,c){let d="",e=a.x.translate/b.x,f=a.y.translate/b.y,g=c?.z||0;if((e||f||g)&&(d=`translate3d(${e}px, ${f}px, ${g}px) `),(1!==b.x||1!==b.y)&&(d+=`scale(${1/b.x}, ${1/b.y}) `),c){let{transformPerspective:a,rotate:b,rotateX:e,rotateY:f,skewX:g,skewY:h}=c;a&&(d=`perspective(${a}px) ${d}`),b&&(d+=`rotate(${b}deg) `),e&&(d+=`rotateX(${e}deg) `),f&&(d+=`rotateY(${f}deg) `),g&&(d+=`skewX(${g}deg) `),h&&(d+=`skewY(${h}deg) `)}let h=a.x.scale*b.x,i=a.y.scale*b.y;return(1!==h||1!==i)&&(d+=`scale(${h}, ${i})`),d||"none"}(this.projectionDeltaWithTransform,this.treeScale,e);c&&(f=c(e,f)),a.transform=f;let{x:g,y:h}=this.projectionDelta;for(let b in a.transformOrigin=`${100*g.origin}% ${100*h.origin}% 0`,d.animationValues?a.opacity=d===this?e.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:e.opacityExit:a.opacity=d===this?void 0!==e.opacity?e.opacity:"":void 0!==e.opacityExit?e.opacityExit:0,l2){if(void 0===e[b])continue;let{correct:c,applyTo:g,isCSSVariable:h}=l2[b],i="none"===f?e[b]:c(e[b],d);if(g){let b=g.length;for(let c=0;c<b;c++)a[g[c]]=i}else h?this.options.visualElement.renderState.vars[b]=i:a[b]=i}this.options.layoutId&&(a.pointerEvents=d===this?mx(b?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>a.currentAnimation?.stop()),this.root.nodes.forEach(pi),this.root.sharedNodes.clear()}}}function pd(a){a.updateLayout()}function pe(a){let b=a.resumeFrom?.snapshot||a.snapshot;if(a.isLead()&&a.layout&&b&&a.hasListeners("didUpdate")){let{layoutBox:c,measuredBox:d}=a.layout,{animationType:e}=a.options,f=b.source!==a.layout.source;"size"===e?nZ(a=>{let d=f?b.measuredBox[a]:b.layoutBox[a],e=n$(d);d.min=c[a].min,d.max=d.min+e}):px(e,b.layoutBox,c)&&nZ(d=>{let e=f?b.measuredBox[d]:b.layoutBox[d],g=n$(c[d]);e.max=e.min+g,a.relativeTarget&&!a.currentAnimation&&(a.isProjectionDirty=!0,a.relativeTarget[d].max=a.relativeTarget[d].min+g)});let g=kn();n0(g,c,b.layoutBox);let h=kn();f?n0(h,a.applyTransform(d,!0),b.measuredBox):n0(h,c,b.layoutBox);let i=!o0(g),j=!1;if(!a.resumeFrom){let d=a.getClosestProjectingParent();if(d&&!d.resumeFrom){let{snapshot:e,layout:f}=d;if(e&&f){let g=kp();n3(g,b.layoutBox,e.layoutBox);let h=kp();n3(h,c,f.layoutBox),o3(g,h)||(j=!0),d.options.layoutRoot&&(a.relativeTarget=h,a.relativeTargetOrigin=g,a.relativeParent=d)}}}a.notifyListeners("didUpdate",{layout:c,snapshot:b,delta:h,layoutDelta:g,hasLayoutChanged:i,hasRelativeLayoutChanged:j})}else if(a.isLead()){let{onExitComplete:b}=a.options;b&&b()}a.options.transition=void 0}function pf(a){a.parent&&(a.isProjecting()||(a.isProjectionDirty=a.parent.isProjectionDirty),a.isSharedProjectionDirty||(a.isSharedProjectionDirty=!!(a.isProjectionDirty||a.parent.isProjectionDirty||a.parent.isSharedProjectionDirty)),a.isTransformDirty||(a.isTransformDirty=a.parent.isTransformDirty))}function pg(a){a.isProjectionDirty=a.isSharedProjectionDirty=a.isTransformDirty=!1}function ph(a){a.clearSnapshot()}function pi(a){a.clearMeasurements()}function pj(a){a.isLayoutDirty=!1}function pk(a){let{visualElement:b}=a.options;b&&b.getProps().onBeforeLayoutMeasure&&b.notify("BeforeLayoutMeasure"),a.resetTransform()}function pl(a){a.finishAnimation(),a.targetDelta=a.relativeTarget=a.target=void 0,a.isProjectionDirty=!0}function pm(a){a.resolveTargetDelta()}function pn(a){a.calcProjection()}function po(a){a.resetSkewAndRotation()}function pp(a){a.removeLeadSnapshot()}function pq(a,b,c){a.translate=l1(b.translate,0,c),a.scale=l1(b.scale,1,c),a.origin=b.origin,a.originPoint=b.originPoint}function pr(a,b,c,d){a.min=l1(b.min,c.min,d),a.max=l1(b.max,c.max,d)}function ps(a){return a.animationValues&&void 0!==a.animationValues.opacityExit}let pt={duration:.45,ease:[.4,0,.1,1]},pu=a=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(a),pv=pu("applewebkit/")&&!pu("chrome/")?Math.round:kS;function pw(a){a.min=pv(a.min),a.max=pv(a.max)}function px(a,b,c){return"position"===a||"preserve-aspect"===a&&!(.2>=Math.abs(o4(b)-o4(c)))}function py(a){return a!==a.root&&a.scroll?.wasRoot}let pz=pc({attachResizeListener:(a,b)=>n6(a,"resize",b),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),pA={current:void 0},pB=pc({measureScroll:a=>({x:a.scrollLeft,y:a.scrollTop}),defaultParent:()=>{if(!pA.current){let a=new pz({});a.mount(window),a.setOptions({layoutScroll:!0}),pA.current=a}return pA.current},resetTransform:(a,b)=>{a.style.transform=void 0!==b?b:"none"},checkIsScrollRoot:a=>"fixed"===window.getComputedStyle(a).position});function pC(a,b){let c=n9(a),d=new AbortController;return[c,{passive:!0,...b,signal:d.signal},()=>d.abort()]}function pD(a,b,c){let{props:d}=a;a.animationState&&d.whileHover&&a.animationState.setActive("whileHover","Start"===c);let e=d["onHover"+c];e&&kW.postRender(()=>e(b,oj(b)))}class pE extends mH{mount(){let{current:a}=this.node;a&&(this.unmount=function(a,b,c={}){let[d,e,f]=pC(a,c);return d.forEach(a=>{let c,d=!1,f=!1,g=b=>{c&&(c(b),c=void 0),a.removeEventListener("pointerleave",i)},h=a=>{d=!1,window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),f&&(f=!1,g(a))},i=a=>{if("touch"!==a.pointerType){if(d){f=!0;return}g(a)}};a.addEventListener("pointerenter",d=>{if("touch"===d.pointerType||nY.x||nY.y)return;f=!1;let g=b(a,d);"function"==typeof g&&(c=g,a.addEventListener("pointerleave",i,e))},e),a.addEventListener("pointerdown",()=>{d=!0,window.addEventListener("pointerup",h,e),window.addEventListener("pointercancel",h,e)},e)}),f}(a,(a,b)=>(pD(this.node,b,"Start"),a=>pD(this.node,a,"End"))))}unmount(){}}class pF extends mH{constructor(){super(...arguments),this.isActive=!1}onFocus(){let a=!1;try{a=this.node.current.matches(":focus-visible")}catch(b){a=!0}a&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=mP(n6(this.node.current,"focus",()=>this.onFocus()),n6(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function pG(a){return n7(a)&&"offsetHeight"in a}let pH=(a,b)=>!!b&&(a===b||pH(a,b.parentElement)),pI=new WeakSet;function pJ(a){return b=>{"Enter"===b.key&&a(b)}}function pK(a,b){a.dispatchEvent(new PointerEvent("pointer"+b,{isPrimary:!0,bubbles:!0}))}function pL(a){return oi(a)&&!(nY.x||nY.y)}let pM=new WeakSet;function pN(a,b,c){let{props:d}=a;if(a.current instanceof HTMLButtonElement&&a.current.disabled)return;a.animationState&&d.whileTap&&a.animationState.setActive("whileTap","Start"===c);let e=d["onTap"+("End"===c?"":c)];e&&kW.postRender(()=>e(b,oj(b)))}class pO extends mH{mount(){let{current:a}=this.node;if(!a)return;let{globalTapTarget:b,propagate:c}=this.node.props;this.unmount=function(a,b,c={}){let[d,e,f]=pC(a,c),g=a=>{let d=a.currentTarget;if(!pL(a)||pM.has(a))return;pI.add(d),c.stopPropagation&&pM.add(a);let f=b(d,a),g=(a,b)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",i),pI.has(d)&&pI.delete(d),pL(a)&&"function"==typeof f&&f(a,{success:b})},h=a=>{g(a,d===window||d===document||c.useGlobalTarget||pH(d,a.target))},i=a=>{g(a,!1)};window.addEventListener("pointerup",h,e),window.addEventListener("pointercancel",i,e)};return d.forEach(a=>{((c.useGlobalTarget?window:a).addEventListener("pointerdown",g,e),pG(a))&&(a.addEventListener("focus",a=>((a,b)=>{let c=a.currentTarget;if(!c)return;let d=pJ(()=>{if(pI.has(c))return;pK(c,"down");let a=pJ(()=>{pK(c,"up")});c.addEventListener("keyup",a,b),c.addEventListener("blur",()=>pK(c,"cancel"),b)});c.addEventListener("keydown",d,b),c.addEventListener("blur",()=>c.removeEventListener("keydown",d),b)})(a,e)),n4.has(a.tagName)||!0===a.isContentEditable||a.hasAttribute("tabindex")||(a.tabIndex=0))}),f}(a,(a,b)=>(pN(this.node,b,"Start"),(a,{success:b})=>pN(this.node,a,b?"End":"Cancel")),{useGlobalTarget:b,stopPropagation:c?.tap===!1})}unmount(){}}let pP=new WeakMap,pQ=new WeakMap,pR=a=>{let b=pP.get(a.target);b&&b(a)},pS=a=>{a.forEach(pR)},pT={some:0,all:1};class pU extends mH{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var a;let b;this.unmount();let{viewport:c={}}=this.node.getProps(),{root:d,margin:e,amount:f="some",once:g}=c,h={root:d?d.current:void 0,rootMargin:e,threshold:"number"==typeof f?f:pT[f]},i=a=>{let{isIntersecting:b}=a;if(this.isInView===b||(this.isInView=b,g&&!b&&this.hasEnteredView))return;b&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",b);let{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),e=b?c:d;e&&e(a)};return a=this.node.current,b=function({root:a,...b}){let c=a||document;pQ.has(c)||pQ.set(c,{});let d=pQ.get(c),e=JSON.stringify(b);return d[e]||(d[e]=new IntersectionObserver(pS,{root:a,...b})),d[e]}(h),pP.set(a,i),b.observe(a),()=>{pP.delete(a),b.unobserve(a)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:a,prevProps:b}=this.node;["amount","margin","root"].some(function({viewport:a={}},{viewport:b={}}={}){return c=>a[c]!==b[c]}(a,b))&&this.startObserver()}unmount(){}}let pV=function(a,b){if("u"<typeof Proxy)return mG;let c=new Map,d=(c,d)=>mG(c,d,a,b);return new Proxy((a,b)=>d(a,b),{get:(e,f)=>"create"===f?d:(c.has(f)||c.set(f,mG(f,void 0,a,b)),c.get(f))})}({animation:{Feature:nV},exit:{Feature:nX},inView:{Feature:pU},tap:{Feature:pO},focus:{Feature:pF},hover:{Feature:pE},pan:{Feature:oE},drag:{Feature:oC,ProjectionNode:pB,MeasureLayout:oK},layout:{ProjectionNode:pB,MeasureLayout:oK}},(a,b)=>b.isSVG??mm(a)?new l6(b):new mk(b,{allowProjection:a!==E.Fragment}));function pW({tone:a,pulse:b=!1,className:c}){return(0,D.jsxs)("span",{className:bc("relative inline-flex h-2.5 w-2.5 items-center justify-center",c),children:[b?(0,D.jsx)(pV.span,{className:bc("absolute inset-0 rounded-full",a),animate:{opacity:[.4,0],scale:[1,2.2]},transition:{duration:1.8,repeat:1/0,ease:"easeOut"}}):null,(0,D.jsx)("span",{className:bc("relative inline-flex h-2.5 w-2.5 rounded-full",a)})]})}var pX="ScrollArea",[pY,pZ]=bt(pX),[p$,p_]=pY(pX),p0=E.forwardRef((a,b)=>{let{__scopeScrollArea:c,type:d="hover",dir:e,scrollHideDelay:f=600,...g}=a,[h,i]=E.useState(null),[j,k]=E.useState(null),[l,m]=E.useState(null),[n,o]=E.useState(null),[p,q]=E.useState(null),[r,s]=E.useState(0),[t,u]=E.useState(0),[v,w]=E.useState(!1),[x,y]=E.useState(!1),z=bh(b,a=>i(a)),A=bK(e);return(0,D.jsx)(p$,{scope:c,type:d,dir:A,scrollHideDelay:f,scrollArea:h,viewport:j,onViewportChange:k,content:l,onContentChange:m,scrollbarX:n,onScrollbarXChange:o,scrollbarXEnabled:v,onScrollbarXEnabledChange:w,scrollbarY:p,onScrollbarYChange:q,scrollbarYEnabled:x,onScrollbarYEnabledChange:y,onCornerWidthChange:s,onCornerHeightChange:u,children:(0,D.jsx)(bF.div,{dir:A,...g,ref:z,style:{position:"relative","--radix-scroll-area-corner-width":r+"px","--radix-scroll-area-corner-height":t+"px",...a.style}})})});p0.displayName=pX;var p1="ScrollAreaViewport",p2=E.forwardRef((a,b)=>{let{__scopeScrollArea:c,children:d,nonce:e,...f}=a,g=p_(p1,c),h=bh(b,E.useRef(null),g.onViewportChange);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:e}),(0,D.jsx)(bF.div,{"data-radix-scroll-area-viewport":"",...f,ref:h,style:{overflowX:g.scrollbarXEnabled?"scroll":"hidden",overflowY:g.scrollbarYEnabled?"scroll":"hidden",...a.style},children:(0,D.jsx)("div",{ref:g.onContentChange,style:{minWidth:"100%",display:"table"},children:d})})]})});p2.displayName=p1;var p3="ScrollAreaScrollbar",p4=E.forwardRef((a,b)=>{let{forceMount:c,...d}=a,e=p_(p3,a.__scopeScrollArea),{onScrollbarXEnabledChange:f,onScrollbarYEnabledChange:g}=e,h="horizontal"===a.orientation;return E.useEffect(()=>(h?f(!0):g(!0),()=>{h?f(!1):g(!1)}),[h,f,g]),"hover"===e.type?(0,D.jsx)(p5,{...d,ref:b,forceMount:c}):"scroll"===e.type?(0,D.jsx)(p6,{...d,ref:b,forceMount:c}):"auto"===e.type?(0,D.jsx)(p7,{...d,ref:b,forceMount:c}):"always"===e.type?(0,D.jsx)(p8,{...d,ref:b}):null});p4.displayName=p3;var p5=E.forwardRef((a,b)=>{let{forceMount:c,...d}=a,e=p_(p3,a.__scopeScrollArea),[f,g]=E.useState(!1);return E.useEffect(()=>{let a=e.scrollArea,b=0;if(a){let c=()=>{window.clearTimeout(b),g(!0)},d=()=>{b=window.setTimeout(()=>g(!1),e.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(b),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",d)}}},[e.scrollArea,e.scrollHideDelay]),(0,D.jsx)(b_,{present:c||f,children:(0,D.jsx)(p7,{"data-state":f?"visible":"hidden",...d,ref:b})})}),p6=E.forwardRef((a,b)=>{var c;let{forceMount:d,...e}=a,f=p_(p3,a.__scopeScrollArea),g="horizontal"===a.orientation,h=qq(()=>j("SCROLL_END"),100),[i,j]=(c={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},E.useReducer((a,b)=>c[a][b]??a,"hidden"));return E.useEffect(()=>{if("idle"===i){let a=window.setTimeout(()=>j("HIDE"),f.scrollHideDelay);return()=>window.clearTimeout(a)}},[i,f.scrollHideDelay,j]),E.useEffect(()=>{let a=f.viewport,b=g?"scrollLeft":"scrollTop";if(a){let c=a[b],d=()=>{let d=a[b];c!==d&&(j("SCROLL"),h()),c=d};return a.addEventListener("scroll",d),()=>a.removeEventListener("scroll",d)}},[f.viewport,g,j,h]),(0,D.jsx)(b_,{present:d||"hidden"!==i,children:(0,D.jsx)(p8,{"data-state":"hidden"===i?"hidden":"visible",...e,ref:b,onPointerEnter:bs(a.onPointerEnter,()=>j("POINTER_ENTER")),onPointerLeave:bs(a.onPointerLeave,()=>j("POINTER_LEAVE"))})})}),p7=E.forwardRef((a,b)=>{let c=p_(p3,a.__scopeScrollArea),{forceMount:d,...e}=a,[f,g]=E.useState(!1),h="horizontal"===a.orientation,i=qq(()=>{if(c.viewport){let a=c.viewport.offsetWidth<c.viewport.scrollWidth,b=c.viewport.offsetHeight<c.viewport.scrollHeight;g(h?a:b)}},10);return qr(c.viewport,i),qr(c.content,i),(0,D.jsx)(b_,{present:d||f,children:(0,D.jsx)(p8,{"data-state":f?"visible":"hidden",...e,ref:b})})}),p8=E.forwardRef((a,b)=>{let{orientation:c="vertical",...d}=a,e=p_(p3,a.__scopeScrollArea),f=E.useRef(null),g=E.useRef(0),[h,i]=E.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),j=ql(h.viewport,h.content),k={...d,sizes:h,onSizesChange:i,hasThumb:!!(j>0&&j<1),onThumbChange:a=>f.current=a,onThumbPointerUp:()=>g.current=0,onThumbPointerDown:a=>g.current=a};function l(a,b){return function(a,b,c,d="ltr"){let e=qm(c),f=b||e/2,g=c.scrollbar.paddingStart+f,h=c.scrollbar.size-c.scrollbar.paddingEnd-(e-f),i=c.content-c.viewport;return qo([g,h],"ltr"===d?[0,i]:[-1*i,0])(a)}(a,g.current,h,b)}return"horizontal"===c?(0,D.jsx)(p9,{...k,ref:b,onThumbPositionChange:()=>{if(e.viewport&&f.current){let a=qn(e.viewport.scrollLeft,h,e.dir);f.current.style.transform=`translate3d(${a}px, 0, 0)`}},onWheelScroll:a=>{e.viewport&&(e.viewport.scrollLeft=a)},onDragScroll:a=>{e.viewport&&(e.viewport.scrollLeft=l(a,e.dir))}}):"vertical"===c?(0,D.jsx)(qa,{...k,ref:b,onThumbPositionChange:()=>{if(e.viewport&&f.current){let a=qn(e.viewport.scrollTop,h);f.current.style.transform=`translate3d(0, ${a}px, 0)`}},onWheelScroll:a=>{e.viewport&&(e.viewport.scrollTop=a)},onDragScroll:a=>{e.viewport&&(e.viewport.scrollTop=l(a))}}):null}),p9=E.forwardRef((a,b)=>{let{sizes:c,onSizesChange:d,...e}=a,f=p_(p3,a.__scopeScrollArea),[g,h]=E.useState(),i=E.useRef(null),j=bh(b,i,f.onScrollbarXChange);return E.useEffect(()=>{i.current&&h(getComputedStyle(i.current))},[i]),(0,D.jsx)(qd,{"data-orientation":"horizontal",...e,ref:j,sizes:c,style:{bottom:0,left:"rtl"===f.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===f.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":qm(c)+"px",...a.style},onThumbPointerDown:b=>a.onThumbPointerDown(b.x),onDragScroll:b=>a.onDragScroll(b.x),onWheelScroll:(b,c)=>{if(f.viewport){var d,e;let g=f.viewport.scrollLeft+b.deltaX;a.onWheelScroll(g),d=g,e=c,d>0&&d<e&&b.preventDefault()}},onResize:()=>{i.current&&f.viewport&&g&&d({content:f.viewport.scrollWidth,viewport:f.viewport.offsetWidth,scrollbar:{size:i.current.clientWidth,paddingStart:qk(g.paddingLeft),paddingEnd:qk(g.paddingRight)}})}})}),qa=E.forwardRef((a,b)=>{let{sizes:c,onSizesChange:d,...e}=a,f=p_(p3,a.__scopeScrollArea),[g,h]=E.useState(),i=E.useRef(null),j=bh(b,i,f.onScrollbarYChange);return E.useEffect(()=>{i.current&&h(getComputedStyle(i.current))},[i]),(0,D.jsx)(qd,{"data-orientation":"vertical",...e,ref:j,sizes:c,style:{top:0,right:"ltr"===f.dir?0:void 0,left:"rtl"===f.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":qm(c)+"px",...a.style},onThumbPointerDown:b=>a.onThumbPointerDown(b.y),onDragScroll:b=>a.onDragScroll(b.y),onWheelScroll:(b,c)=>{if(f.viewport){var d,e;let g=f.viewport.scrollTop+b.deltaY;a.onWheelScroll(g),d=g,e=c,d>0&&d<e&&b.preventDefault()}},onResize:()=>{i.current&&f.viewport&&g&&d({content:f.viewport.scrollHeight,viewport:f.viewport.offsetHeight,scrollbar:{size:i.current.clientHeight,paddingStart:qk(g.paddingTop),paddingEnd:qk(g.paddingBottom)}})}})}),[qb,qc]=pY(p3),qd=E.forwardRef((a,b)=>{let{__scopeScrollArea:c,sizes:d,hasThumb:e,onThumbChange:f,onThumbPointerUp:g,onThumbPointerDown:h,onThumbPositionChange:i,onDragScroll:j,onWheelScroll:k,onResize:l,...m}=a,n=p_(p3,c),[o,p]=E.useState(null),q=bh(b,a=>p(a)),r=E.useRef(null),s=E.useRef(""),t=n.viewport,u=d.content-d.viewport,v=bG(k),w=bG(i),x=qq(l,10);function y(a){r.current&&j({x:a.clientX-r.current.left,y:a.clientY-r.current.top})}return E.useEffect(()=>{let a=a=>{let b=a.target;o?.contains(b)&&v(a,u)};return document.addEventListener("wheel",a,{passive:!1}),()=>document.removeEventListener("wheel",a,{passive:!1})},[t,o,u,v]),E.useEffect(w,[d,w]),qr(o,x),qr(n.content,x),(0,D.jsx)(qb,{scope:c,scrollbar:o,hasThumb:e,onThumbChange:bG(f),onThumbPointerUp:bG(g),onThumbPositionChange:w,onThumbPointerDown:bG(h),children:(0,D.jsx)(bF.div,{...m,ref:q,style:{position:"absolute",...m.style},onPointerDown:bs(a.onPointerDown,a=>{0===a.button&&(a.target.setPointerCapture(a.pointerId),r.current=o.getBoundingClientRect(),s.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",n.viewport&&(n.viewport.style.scrollBehavior="auto"),y(a))}),onPointerMove:bs(a.onPointerMove,y),onPointerUp:bs(a.onPointerUp,a=>{let b=a.target;b.hasPointerCapture(a.pointerId)&&b.releasePointerCapture(a.pointerId),document.body.style.webkitUserSelect=s.current,n.viewport&&(n.viewport.style.scrollBehavior=""),r.current=null})})})}),qe="ScrollAreaThumb",qf=E.forwardRef((a,b)=>{let{forceMount:c,...d}=a,e=qc(qe,a.__scopeScrollArea);return(0,D.jsx)(b_,{present:c||e.hasThumb,children:(0,D.jsx)(qg,{ref:b,...d})})}),qg=E.forwardRef((a,b)=>{let{__scopeScrollArea:c,style:d,...e}=a,f=p_(qe,c),g=qc(qe,c),{onThumbPositionChange:h}=g,i=bh(b,a=>g.onThumbChange(a)),j=E.useRef(void 0),k=qq(()=>{j.current&&(j.current(),j.current=void 0)},100);return E.useEffect(()=>{let a=f.viewport;if(a){let b=()=>{k(),j.current||(j.current=qp(a,h),h())};return h(),a.addEventListener("scroll",b),()=>a.removeEventListener("scroll",b)}},[f.viewport,k,h]),(0,D.jsx)(bF.div,{"data-state":g.hasThumb?"visible":"hidden",...e,ref:i,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...d},onPointerDownCapture:bs(a.onPointerDownCapture,a=>{let b=a.target.getBoundingClientRect(),c=a.clientX-b.left,d=a.clientY-b.top;g.onThumbPointerDown({x:c,y:d})}),onPointerUp:bs(a.onPointerUp,g.onThumbPointerUp)})});qf.displayName=qe;var qh="ScrollAreaCorner",qi=E.forwardRef((a,b)=>{let c=p_(qh,a.__scopeScrollArea),d=!!(c.scrollbarX&&c.scrollbarY);return"scroll"!==c.type&&d?(0,D.jsx)(qj,{...a,ref:b}):null});qi.displayName=qh;var qj=E.forwardRef((a,b)=>{let{__scopeScrollArea:c,...d}=a,e=p_(qh,c),[f,g]=E.useState(0),[h,i]=E.useState(0),j=!!(f&&h);return qr(e.scrollbarX,()=>{let a=e.scrollbarX?.offsetHeight||0;e.onCornerHeightChange(a),i(a)}),qr(e.scrollbarY,()=>{let a=e.scrollbarY?.offsetWidth||0;e.onCornerWidthChange(a),g(a)}),j?(0,D.jsx)(bF.div,{...d,ref:b,style:{width:f,height:h,position:"absolute",right:"ltr"===e.dir?0:void 0,left:"rtl"===e.dir?0:void 0,bottom:0,...a.style}}):null});function qk(a){return a?parseInt(a,10):0}function ql(a,b){let c=a/b;return isNaN(c)?0:c}function qm(a){let b=ql(a.viewport,a.content),c=a.scrollbar.paddingStart+a.scrollbar.paddingEnd;return Math.max((a.scrollbar.size-c)*b,18)}function qn(a,b,c="ltr"){let d=qm(b),e=b.scrollbar.paddingStart+b.scrollbar.paddingEnd,f=b.scrollbar.size-e,g=b.content-b.viewport,h=function(a,[b,c]){return Math.min(c,Math.max(b,a))}(a,"ltr"===c?[0,g]:[-1*g,0]);return qo([0,g],[0,f-d])(h)}function qo(a,b){return c=>{if(a[0]===a[1]||b[0]===b[1])return b[0];let d=(b[1]-b[0])/(a[1]-a[0]);return b[0]+d*(c-a[0])}}var qp=(a,b=()=>{})=>{let c={left:a.scrollLeft,top:a.scrollTop},d=0;return!function e(){let f={left:a.scrollLeft,top:a.scrollTop},g=c.left!==f.left,h=c.top!==f.top;(g||h)&&b(),c=f,d=window.requestAnimationFrame(e)}(),()=>window.cancelAnimationFrame(d)};function qq(a,b){let c=bG(a),d=E.useRef(0);return E.useEffect(()=>()=>window.clearTimeout(d.current),[]),E.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(c,b)},[c,b])}function qr(a,b){let c=bG(b);bA(()=>{let b=0;if(a){let d=new ResizeObserver(()=>{cancelAnimationFrame(b),b=window.requestAnimationFrame(c)});return d.observe(a),()=>{window.cancelAnimationFrame(b),d.unobserve(a)}}},[a,c])}let qs=E.forwardRef(({className:a,children:b,...c},d)=>(0,D.jsxs)(p0,{ref:d,className:bc("relative overflow-hidden",a),...c,children:[(0,D.jsx)(p2,{className:"mission-scroll h-full w-full rounded-[inherit] [&>div]:!block [&>div]:!w-full [&>div]:!min-w-0",children:b}),(0,D.jsx)(qt,{}),(0,D.jsx)(qi,{})]}));qs.displayName=p0.displayName;let qt=E.forwardRef(({className:a,orientation:b="vertical",...c},d)=>(0,D.jsx)(p4,{ref:d,orientation:b,className:bc("flex touch-none select-none transition-colors","vertical"===b&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===b&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",a),...c,children:(0,D.jsx)(qf,{className:"relative flex-1 rounded-full bg-white/[0.12]"})}));qt.displayName=p4.displayName;let qu={worker:{label:"Worker",description:"Delivers code, docs, research, review, or analysis without mutating the system.",defaultName:"Worker",defaultEmoji:"\uD83D\uDEE0️",defaultTheme:"slate",badgeVariant:"default"},setup:{label:"Setup / Operator",description:"Prepares the environment, installs dependencies, and unblocks other agents.",defaultName:"Setup Operator",defaultEmoji:"\uD83E\uDDF0",defaultTheme:"amber",badgeVariant:"warning"},browser:{label:"Browser",description:"Captures browser evidence, screenshots, and user-path validation inside the workspace.",defaultName:"Browser Agent",defaultEmoji:"\uD83C\uDF10",defaultTheme:"blue",badgeVariant:"success"},monitoring:{label:"Monitoring",description:"Periodically checks workspace health, drift, and blockers, then leaves triage handoffs.",defaultName:"Monitoring Agent",defaultEmoji:"\uD83D\uDEF0️",defaultTheme:"teal",badgeVariant:"warning"},custom:{label:"Custom",description:"Starts from a safe default policy but leaves room for manual overrides.",defaultName:"Custom Agent",defaultEmoji:"\uD83E\uDDE9",defaultTheme:"violet",badgeVariant:"muted"}},qv={worker:{missingToolBehavior:"fallback",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"},setup:{missingToolBehavior:"allow-install",installScope:"workspace",fileAccess:"workspace-only",networkAccess:"enabled"},browser:{missingToolBehavior:"ask-setup",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"},monitoring:{missingToolBehavior:"fallback",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"},custom:{missingToolBehavior:"fallback",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"}},qw=Object.entries(qu).map(([a,b])=>({value:a,label:b.label,description:b.description})),qx=[{value:"fallback",label:"Fallback",description:"Produce the nearest viable output format instead of failing the task."},{value:"ask-setup",label:"Ask for setup",description:"Stop before environment changes and report the missing capability clearly."},{value:"route-setup",label:"Route to setup agent",description:"Leave an explicit setup handoff instead of attempting installs directly."},{value:"allow-install",label:"Allow install",description:"Install missing tooling when policy allows it and the task truly depends on it."}],qy=[{value:"none",label:"None",description:"Do not install workspace or system dependencies."},{value:"workspace",label:"Workspace only",description:"Only install dependencies inside the project or workspace environment."},{value:"system",label:"System",description:"Permit system-wide installs when they are necessary and intentional."}],qz=[{value:"workspace-only",label:"Workspace only",description:"Keep file work grounded inside the attached workspace."},{value:"extended",label:"Extended",description:"Allow broader file access when the task explicitly needs it."}],qA=[{value:"restricted",label:"Off",description:"Avoid network access unless the task explicitly depends on it."},{value:"enabled",label:"On",description:"Use network access when the task needs external information or downloads."}];function qB(a="worker",b){return{...qv[a],...b??{},preset:a}}function qC(a){return qu[a].label}function qD(a){return qx.find(b=>b.value===a)?.label??a}function qE(a){return qy.find(b=>b.value===a)?.label??a}function qF(a){return qz.find(b=>b.value===a)?.label??a}function qG(a){return qA.find(b=>b.value===a)?.label??a}let qH={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function qI(a){return (b={})=>{let c=b.width?String(b.width):a.defaultWidth;return a.formats[c]||a.formats[a.defaultWidth]}}let qJ={date:qI({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:qI({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:qI({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},qK={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function qL(a){return(b,c)=>{let d;if("formatting"===(c?.context?String(c.context):"standalone")&&a.formattingValues){let b=a.defaultFormattingWidth||a.defaultWidth,e=c?.width?String(c.width):b;d=a.formattingValues[e]||a.formattingValues[b]}else{let b=a.defaultWidth,e=c?.width?String(c.width):a.defaultWidth;d=a.values[e]||a.values[b]}return d[a.argumentCallback?a.argumentCallback(b):b]}}function qM(a){return(b,c={})=>{let d,e=c.width,f=e&&a.matchPatterns[e]||a.matchPatterns[a.defaultMatchWidth],g=b.match(f);if(!g)return null;let h=g[0],i=e&&a.parsePatterns[e]||a.parsePatterns[a.defaultParseWidth],j=Array.isArray(i)?function(a,b){for(let c=0;c<a.length;c++)if(b(a[c]))return c}(i,a=>a.test(h)):function(a,b){for(let c in a)if(Object.prototype.hasOwnProperty.call(a,c)&&b(a[c]))return c}(i,a=>a.test(h));return d=a.valueCallback?a.valueCallback(j):j,{value:d=c.valueCallback?c.valueCallback(d):d,rest:b.slice(h.length)}}}let qN={code:"en-US",formatDistance:(a,b,c)=>{let d,e=qH[a];if(d="string"==typeof e?e:1===b?e.one:e.other.replace("{{count}}",b.toString()),c?.addSuffix)if(c.comparison&&c.comparison>0)return"in "+d;else return d+" ago";return d},formatLong:qJ,formatRelative:(a,b,c,d)=>qK[a],localize:{ordinalNumber:(a,b)=>{let c=Number(a),d=c%100;if(d>20||d<10)switch(d%10){case 1:return c+"st";case 2:return c+"nd";case 3:return c+"rd"}return c+"th"},era:qL({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:qL({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:a=>a-1}),month:qL({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:qL({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:qL({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(t={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:a=>parseInt(a,10)},(a,b={})=>{let c=a.match(t.matchPattern);if(!c)return null;let d=c[0],e=a.match(t.parsePattern);if(!e)return null;let f=t.valueCallback?t.valueCallback(e[0]):e[0];return{value:f=b.valueCallback?b.valueCallback(f):f,rest:a.slice(d.length)}}),era:qM({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:qM({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:a=>a+1}),month:qM({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:qM({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:qM({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},qO={},qP=Symbol.for("constructDateFrom");function qQ(a,b){return"function"==typeof a?a(b):a&&"object"==typeof a&&qP in a?a[qP](b):a instanceof Date?new a.constructor(b):new Date(b)}function qR(a){let b=qQ(a,a),c=new Date(Date.UTC(b.getFullYear(),b.getMonth(),b.getDate(),b.getHours(),b.getMinutes(),b.getSeconds(),b.getMilliseconds()));return c.setUTCFullYear(b.getFullYear()),a-c}function qS(a,b=Date.now()){return null==a||Number.isNaN(a)?"No activity":`${function(a,b,c){var d;let e,f,g=c?.locale??qO.locale??qN,h=(f=qQ(a,a)-qQ(b,b))<0?-1:f>0?1:f;if(isNaN(h))throw RangeError("Invalid time value");let i=Object.assign({},c,{addSuffix:c?.addSuffix,comparison:h}),[j,k]=function(a,...b){let c=qQ.bind(null,a||b.find(a=>"object"==typeof a));return b.map(c)}(c?.in,...h>0?[b,a]:[a,b]),l=(d=c?.roundingMethod??"round",a=>{let b=(d?Math[d]:Math.trunc)(a);return 0===b?0:b}),m=k.getTime()-j.getTime(),n=m/6e4,o=(m-(qR(k)-qR(j)))/6e4,p=c?.unit;if("second"===(e=p||(n<1?"second":n<60?"minute":n<1440?"hour":o<43200?"day":o<525600?"month":"year"))){let a=l(m/1e3);return g.formatDistance("xSeconds",a,i)}if("minute"===e){let a=l(n);return g.formatDistance("xMinutes",a,i)}if("hour"===e){let a=l(n/60);return g.formatDistance("xHours",a,i)}if("day"===e){let a=l(o/1440);return g.formatDistance("xDays",a,i)}if("month"===e){let a=l(o/43200);return 12===a&&"month"!==p?g.formatDistance("xYears",1,i):g.formatDistance("xMonths",a,i)}else{let a=l(o/525600);return g.formatDistance("xYears",a,i)}}(a,b,{addSuffix:!0})}`}function qT(a){if(!a)return Date.now();let b=Date.parse(a);return Number.isNaN(b)?Date.now():b}function qU(a){return a?a>=1e3?`${Math.round(a/1e3)}k`:String(a):"n/a"}function qV(a){return"number"!=typeof a?"0":a>=1e3?`${(a/1e3).toFixed(a>=1e4?0:1)}k`:String(a)}function qW(a){return a.split("/").at(1)||a}function qX(a){switch(a){case"running":return"default";case"completed":return"success";case"cancelled":return"danger";case"stalled":return"warning";default:return"muted"}}function qY(a,b=8){return a?a.length<=b?a:a.slice(0,b):"n/a"}function qZ(a){return a.replace(/^\/Users\/[^/]+/,"~")}let q$=[/^Task output routing:/i,/^Agent operating policy:/i];function q_(a,b=64){if(!a)return"";let c=function(a){let b=a.replace(/\r\n/g,"\n").trim();if(!b)return"";let c=[];for(let a of b.split("\n")){let b=a.trim();if(q$.some(a=>a.test(b)))break;c.push(a)}return c.join(" ").replace(/\s+/g," ").trim()}(a);return c?c.length<=b?c:`${c.slice(0,Math.max(b-1,1)).trimEnd()}…`:""}function q0({label:a,onClick:b,danger:c=!1}){return(0,D.jsx)("button",{type:"button",className:bc("nodrag nopan flex w-full items-center rounded-[10px] px-2.5 py-2 text-left text-[11px] transition-colors",c?"text-rose-200 hover:bg-rose-400/10 hover:text-rose-100":"text-slate-200 hover:bg-white/[0.06] hover:text-white"),onClick:b,children:(0,D.jsx)("span",{children:a})})}function q1({label:a,value:b}){return(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3 rounded-[10px] bg-white/[0.02] px-2.5 py-1.5",children:[(0,D.jsx)("span",{className:"shrink-0 text-[9px] uppercase tracking-[0.18em] text-slate-500",children:a}),(0,D.jsx)("span",{className:"min-w-0 text-right text-[10px] leading-4 text-slate-100",children:b})]})}let q2=K("corner-down-left",[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]),q3=K("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),q4=K("lock-open",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]),q5=K("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]),q6=K("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),q7=K("folder-open-dot",[["path",{d:"m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.93a2 2 0 0 1 1.66.9l.82 1.2a2 2 0 0 0 1.66.9H18a2 2 0 0 1 2 2v2",key:"1nmvlm"}],["circle",{cx:"14",cy:"15",r:"1",key:"1gm4qj"}]]),q8=K("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var q9=c(7825);let ra=/https?:\/\/[^\s<>"'`)\]]+/g,rb=/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,rc=/(?:^|[\s(])((?:\.{1,2}\/)?(?:deliverables|memory|docs|app|components|lib|public|scripts|packages|hooks|output)\/[^\s`),;]+)/g,rd=/`((?:\/|\.{1,2}\/|deliverables\/|memory\/|docs\/|app\/|components\/|lib\/|public\/|scripts\/|packages\/|hooks\/|output\/)[^`\n]+)`/g;function re({text:a,className:b,url:c,filePath:d,displayPath:e,compact:f=!1}){let g=function(a,b){let c=new Set;for(let d of(b&&c.add(b),a.matchAll(ra)))d[0]&&c.add(d[0]);return[...c]}(a,c),h=function(a){let b=new Set;for(let c of a.matchAll(rb))c[0]&&b.add(c[0]);return[...b]}(a),i=function(a,b,c){let d=new Map;for(let e of(b&&d.set(b,{path:b,label:c||b}),a.matchAll(rd))){let a=e[1]?.trim();!a||d.has(a)||d.set(a,{path:a,label:a})}for(let b of a.matchAll(rc)){let a=b[1]?.trim();!a||d.has(a)||d.set(a,{path:a,label:a})}return[...d.values()]}(a,d,e);return(0,D.jsxs)("div",{className:bc("space-y-2",f&&"space-y-1.5"),children:[(0,D.jsx)("p",{className:bc("whitespace-pre-wrap break-words",b),children:function(a){let b=Array.from(a.matchAll(ra));if(0===b.length)return a;let c=[],d=0;for(let[e]of b){let b=a.indexOf(e,d);b>d&&c.push(a.slice(d,b)),c.push((0,D.jsx)("a",{href:e,target:"_blank",rel:"noreferrer",className:"nodrag nopan text-cyan-100 underline decoration-cyan-200/45 underline-offset-2 transition-colors hover:text-cyan-50 hover:decoration-cyan-100",onClick:a=>a.stopPropagation(),children:e},`${e}:${b}`)),d=b+e.length}return d<a.length&&c.push(a.slice(d)),c}(a)}),g.length>0||h.length>0||i.length>0?(0,D.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[g.map(a=>(0,D.jsxs)("a",{href:a,target:"_blank",rel:"noreferrer",className:bc("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-cyan-300/16 bg-cyan-400/[0.08] px-2 py-1 text-[10px] text-cyan-100 transition-colors hover:border-cyan-200/30 hover:bg-cyan-400/[0.14]",f&&"px-1.5 py-[3px] text-[9px]"),onClick:a=>a.stopPropagation(),children:[(0,D.jsx)(q8,{className:bc("h-3 w-3 shrink-0",f&&"h-2.5 w-2.5")}),(0,D.jsx)("span",{className:"truncate",children:function(a){try{let b=new URL(a);return`${b.hostname}${"/"===b.pathname?"":b.pathname}`}catch{return a}}(a)})]},a)),h.map(a=>(0,D.jsxs)("a",{href:`mailto:${a}`,className:bc("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-sky-300/16 bg-sky-400/[0.08] px-2 py-1 text-[10px] text-sky-50 transition-colors hover:border-sky-200/30 hover:bg-sky-400/[0.14]",f&&"px-1.5 py-[3px] text-[9px]"),onClick:a=>a.stopPropagation(),children:[(0,D.jsx)(q8,{className:bc("h-3 w-3 shrink-0",f&&"h-2.5 w-2.5")}),(0,D.jsx)("span",{className:"truncate",children:a})]},a)),i.map(a=>(0,D.jsxs)("button",{type:"button",className:bc("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-emerald-300/16 bg-emerald-400/[0.08] px-2 py-1 text-[10px] text-emerald-50 transition-colors hover:border-emerald-200/30 hover:bg-emerald-400/[0.14]",f&&"px-1.5 py-[3px] text-[9px]"),onClick:b=>{b.stopPropagation(),rf(a.path)},children:[(0,D.jsx)(q7,{className:bc("h-3 w-3 shrink-0",f&&"h-2.5 w-2.5")}),(0,D.jsx)("span",{className:"truncate",children:qZ(a.label)})]},`${a.path}:${a.label}`))]}):null]})}async function rf(a){try{let b=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})}),c=await b.json();if(!b.ok)throw Error(c.error||"Unable to reveal file.");q9.oR.success("Revealed file.",{description:qZ(a)})}catch(a){q9.oR.error("Could not reveal file.",{description:a instanceof Error?a.message:"Unknown file reveal error."})}}function rg({icon:a,label:b,value:c,active:d=!1,onClick:e}){return(0,D.jsxs)("button",{type:"button",className:bc("nodrag nopan flex min-h-[38px] w-full items-center justify-between rounded-[12px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-2.5 py-1.5 text-left transition-colors hover:border-amber-300/20 hover:bg-amber-400/[0.06]",d&&"border-amber-300/30 bg-amber-400/[0.08]"),onClick:a=>{a.stopPropagation(),e?.()},onPointerDown:a=>a.stopPropagation(),children:[(0,D.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[9px] uppercase tracking-[0.16em] text-slate-400",children:[(0,D.jsx)(a,{className:"h-3 w-3 shrink-0"}),(0,D.jsx)("span",{className:"truncate",children:b})]}),c?(0,D.jsx)("span",{className:"ml-2 shrink-0 font-mono text-[10px] text-slate-200",children:c}):null]})}function rh({icon:a,label:b,destructive:c=!1,disabled:d=!1,onClick:e}){return(0,D.jsxs)("button",{type:"button",disabled:d,className:bc("nodrag nopan flex w-full items-center gap-2 rounded-[10px] px-2.5 py-2 text-left text-[11px] transition-colors",d?"cursor-not-allowed text-slate-500":c?"text-rose-100 hover:bg-rose-400/10 hover:text-rose-50":"text-slate-200 hover:bg-white/[0.06] hover:text-white"),onClick:e,children:[(0,D.jsx)(a,{className:bc("h-3.5 w-3.5",c?"text-rose-300":"text-cyan-300")}),(0,D.jsx)("span",{children:b})]})}function ri(a){let b="string"==typeof a.metadata.dispatchStatus?a.metadata.dispatchStatus:null,c=a.status;return"cancelled"===b||"aborted"===b||"cancelled"===c||"aborted"===c}let rj=K("folder-kanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]),rk=K("orbit",[["path",{d:"M20.341 6.484A10 10 0 0 1 10.266 21.85",key:"1enhxb"}],["path",{d:"M3.659 17.516A10 10 0 0 1 13.74 2.152",key:"1crzgf"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}]]),rl=K("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]),rm=K("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);function rn({icon:a,label:b,value:c}){return(0,D.jsxs)("div",{className:"workspace-node__chip inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1",children:[(0,D.jsx)(a,{className:"workspace-node__chip-icon h-3 w-3 text-inherit"}),(0,D.jsx)("span",{className:"workspace-node__chip-label text-[9px] uppercase tracking-[0.16em] text-inherit",children:b}),(0,D.jsx)("span",{className:"workspace-node__chip-value font-display text-[12px] text-inherit",children:c})]})}function ro({value:a,taskCardsHidden:b,disabled:c,onToggle:d}){return(0,D.jsxs)("button",{type:"button","aria-pressed":b,"aria-label":b?"Show task cards in this workspace":"Hide task cards in this workspace",title:b?"Show task cards in this workspace":"Hide task cards in this workspace",disabled:c,onClick:a=>{a.stopPropagation(),d()},onPointerDown:a=>a.stopPropagation(),className:bc("workspace-node__chip workspace-node__task-toggle nodrag nopan inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 focus-visible:outline-none disabled:cursor-default disabled:opacity-50",c&&"pointer-events-none"),children:[b?(0,D.jsx)(L,{className:"workspace-node__chip-icon h-3 w-3 text-inherit"}):(0,D.jsx)(rm,{className:"workspace-node__chip-icon h-3 w-3 text-inherit"}),(0,D.jsx)("span",{className:bc("workspace-node__chip-label text-[9px] uppercase tracking-[0.16em] text-inherit"),children:"Runs"}),(0,D.jsx)("span",{className:"workspace-node__chip-value font-display text-[12px] text-inherit",children:a})]})}let rp={},rq={workspace:function({data:a,selected:b}){return(0,D.jsx)(pV.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:bc("workspace-node h-full rounded-[26px] border border-white/[0.04] bg-[linear-gradient(180deg,rgba(4,11,22,0.18),rgba(4,9,18,0.06))] p-3 text-white backdrop-blur-[2px]",a.emphasis?"opacity-100":"opacity-75",b&&"border-cyan-300/[0.16]"),children:(0,D.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,D.jsxs)("div",{className:"min-w-0 space-y-1.5",children:[(0,D.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-full border border-white/[0.08] bg-slate-950/75 px-2.5 py-1.5 shadow-[0_14px_28px_rgba(0,0,0,0.2)]",children:[(0,D.jsx)("div",{className:"rounded-full border border-white/10 bg-white/[0.06] p-1.5",children:(0,D.jsx)(rj,{className:"h-3 w-3 text-cyan-200"})}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"font-display text-[12px] tracking-[0.04em] text-white",children:a.workspace.name}),(0,D.jsx)("p",{className:"workspace-node__slug text-[9px] uppercase tracking-[0.22em] text-slate-500",children:a.workspace.slug})]})]}),(0,D.jsx)("p",{className:"workspace-node__path max-w-[300px] truncate pl-1 text-[9px] uppercase tracking-[0.16em] text-slate-600",children:qZ(a.workspace.path)})]}),(0,D.jsxs)("div",{className:"flex shrink-0 max-w-[48%] flex-wrap items-center justify-end gap-1.5",children:[(0,D.jsx)(be,{variant:"muted","data-health":a.workspace.health,className:bc("workspace-node__health",function(a){switch(a){case"engaged":return"border-cyan-300/30 bg-cyan-300/14 text-cyan-50";case"monitoring":return"border-emerald-300/30 bg-emerald-300/14 text-emerald-50";case"ready":return"border-amber-300/30 bg-amber-300/14 text-amber-50";case"offline":return"border-rose-300/30 bg-rose-300/14 text-rose-50";default:return"border-white/12 bg-white/[0.07] text-slate-100"}}(a.workspace.health)),children:a.workspace.health}),(0,D.jsxs)("div",{className:"flex flex-wrap justify-end gap-1.5",children:[(0,D.jsx)(rn,{icon:rk,label:"Agents",value:String(a.workspace.agentIds.length)}),(0,D.jsx)(rn,{icon:rl,label:"Models",value:String(a.workspace.modelIds.length)}),(0,D.jsx)(ro,{value:String(a.workspace.activeRuntimeIds.length),taskCardsHidden:a.taskCardsHidden,disabled:0===a.taskCardCount||!a.onToggleTaskCards,onToggle:()=>a.onToggleTaskCards?.()})]})]})]})})},agent:function({data:a,selected:b}){let[c,d]=(0,E.useState)(!1),[e,f]=(0,E.useState)(!1),g=(0,E.useRef)(null),h=`agent-details-${a.agent.id}`,i=function(a){switch(a){case"engaged":return"text-cyan-300";case"monitoring":return"text-emerald-300";case"ready":return"text-amber-200";case"offline":return"text-rose-200";default:return"text-slate-400"}}(a.agent.status),j="engaged"===a.agent.status?"bg-cyan-300":"monitoring"===a.agent.status?"bg-emerald-300":"ready"===a.agent.status?"bg-amber-200":"offline"===a.agent.status?"bg-rose-300":"bg-slate-500",k=a.agent.skills.length,l=a.agent.tools,m=a.agent.observedTools??[],n=l.length,o=m.length,p=`${k} skill${1===k?"":"s"}`,q=o>0?`${o} observed tool${1===o?"":"s"}`:n>0?`${n} configured tool${1===n?"":"s"}`:"No tools observed",r=a.agent.heartbeat.enabled?a.agent.heartbeat.every??("number"==typeof a.agent.heartbeat.everyMs?`${Math.round(a.agent.heartbeat.everyMs/1e3)}s`:null):null,s=a.agent.lastActiveAt?qS(a.agent.lastActiveAt,a.relativeTimeReferenceMs):"No recent activity",t=`${qC(a.agent.policy.preset)} \xb7 ${p} \xb7 ${q}`,u=a.agent.lastActiveAt?`${qF(a.agent.policy.fileAccess)} \xb7 Heartbeat ${a.agent.heartbeat.enabled?r??"on":"off"} \xb7 Last active ${s}`:`${qF(a.agent.policy.fileAccess)} \xb7 Heartbeat ${a.agent.heartbeat.enabled?r??"on":"off"} \xb7 ${s}`;return(0,D.jsxs)(pV.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},className:bc("relative w-[212px] overflow-hidden rounded-[16px] border border-cyan-300/12 bg-[linear-gradient(180deg,rgba(15,24,40,0.94),rgba(8,13,24,0.94))] px-3 py-2.5 shadow-[0_16px_28px_rgba(0,0,0,0.26)] backdrop-blur-xl",a.emphasis?"opacity-100":"opacity-72",b&&"border-cyan-300/[0.45] shadow-[0_18px_42px_rgba(34,211,238,0.16)]"),children:[(0,D.jsx)("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_18%_10%,rgba(34,211,238,0.18),transparent_36%),radial-gradient(circle_at_84%_18%,rgba(16,185,129,0.08),transparent_28%)]"}),(0,D.jsx)("div",{className:"pointer-events-none absolute inset-y-4 left-0 w-[3px] rounded-r-full bg-[linear-gradient(180deg,rgba(125,211,252,0.9),rgba(34,211,238,0.14))]"}),(0,D.jsx)("div",{className:"pointer-events-none absolute inset-x-3 top-0 h-px bg-cyan-200/10"}),(0,D.jsx)("div",{className:"pointer-events-none absolute right-2 top-2 h-10 w-10 rounded-full bg-cyan-300/10 blur-xl"}),(0,D.jsxs)("div",{className:"relative z-10",children:[(0,D.jsx)(iE,{type:"source",id:"source-right",position:A.Right,className:"!h-2.5 !w-2.5 !border-0 !bg-cyan-300/90 shadow-[0_0_14px_rgba(103,232,249,0.42)]"}),(0,D.jsxs)("div",{className:"flex items-start justify-between gap-2.5",children:[(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsxs)("div",{className:"flex items-center gap-1.5 text-[9px] uppercase tracking-[0.22em] text-slate-500",children:[(0,D.jsx)(pW,{tone:j,pulse:"engaged"===a.agent.status||"monitoring"===a.agent.status}),"Agent"]}),(0,D.jsx)("p",{className:"mt-1.5 truncate font-display text-[0.96rem] text-white",children:a.agent.name}),(0,D.jsx)("p",{className:"mt-0.5 truncate text-[10px] uppercase tracking-[0.16em] text-slate-500",children:a.agent.identity.theme??"OpenClaw operator"})]}),(0,D.jsxs)("div",{className:"nodrag nopan relative",ref:g,children:[(0,D.jsx)("button",{type:"button","aria-label":`${a.agent.name} actions`,onClick:a=>{a.stopPropagation(),d(a=>!a)},onPointerDown:a=>a.stopPropagation(),className:"nodrag nopan inline-flex rounded-full border border-white/[0.08] bg-white/[0.05] p-1.5 text-slate-300 transition-colors hover:bg-white/[0.1] hover:text-white",children:(0,D.jsx)(jH,{className:"h-3.5 w-3.5"})}),c?(0,D.jsxs)("div",{className:"absolute right-0 top-[calc(100%+8px)] z-30 min-w-[136px] rounded-[14px] border border-white/[0.1] bg-slate-950/96 p-1.5 shadow-[0_20px_44px_rgba(0,0,0,0.42)] backdrop-blur-xl",onClick:a=>a.stopPropagation(),onPointerDown:a=>a.stopPropagation(),children:[(0,D.jsx)(q0,{label:a.focused?"Clear focus":"Focus",onClick:()=>{a.onFocus?.(a.agent.id),d(!1)}}),(0,D.jsx)(q0,{label:"Edit",onClick:()=>{a.onEdit?.(a.agent.id),d(!1)}}),(0,D.jsx)(q0,{label:"Delete",danger:!0,onClick:()=>{a.onDelete?.(a.agent.id),d(!1)}})]}):null]})]}),(0,D.jsxs)("div",{className:"mt-2.5 flex flex-wrap items-center gap-1.5",children:[(0,D.jsx)(be,{variant:"engaged"===a.agent.status?"default":"monitoring"===a.agent.status?"success":"warning",children:a.agent.status}),(0,D.jsx)(be,{variant:"muted",className:"max-w-[132px] truncate",children:qW(a.agent.modelId)})]}),(0,D.jsxs)("div",{className:"mt-2.5 rounded-[14px] border border-cyan-300/10 bg-cyan-400/[0.05] px-2.5 py-2",children:[(0,D.jsx)("p",{className:"text-[9px] uppercase tracking-[0.22em] text-cyan-100/70",children:"Active command"}),(0,D.jsx)("p",{className:"mt-1 text-[12px] leading-4 text-slate-100",children:a.agent.currentAction}),(0,D.jsx)("p",{className:bc("mt-1.5 text-[9px] uppercase tracking-[0.2em]",i),children:a.agent.id})]}),(0,D.jsxs)("div",{className:bc("mt-2.5 border-t border-white/[0.08] pt-2.5",e&&"pb-1"),children:[(0,D.jsxs)("button",{type:"button","aria-expanded":e,"aria-controls":h,className:"nodrag nopan group flex w-full items-start justify-between gap-3 rounded-[14px] border border-transparent px-1 py-1.5 text-left transition-colors hover:border-white/[0.06] hover:bg-white/[0.02]",onClick:a=>{a.stopPropagation(),f(a=>!a)},onPointerDown:a=>a.stopPropagation(),children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"text-[9px] uppercase tracking-[0.2em] text-slate-500 transition-colors group-hover:text-slate-400",children:"Agent details"}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] text-slate-300",children:t}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] text-slate-500",children:u})]}),(0,D.jsx)("div",{className:"mt-0.5 shrink-0 rounded-full border border-white/[0.08] bg-white/[0.04] p-1 text-slate-400 transition-colors group-hover:border-white/[0.12] group-hover:text-slate-200",children:e?(0,D.jsx)(jI,{className:"h-3 w-3"}):(0,D.jsx)(U,{className:"h-3 w-3"})})]}),e?(0,D.jsx)(pV.div,{id:h,initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"nodrag nopan overflow-hidden nowheel",onClick:a=>a.stopPropagation(),children:(0,D.jsx)("div",{className:"pt-2.5",children:(0,D.jsx)(qs,{className:"h-[160px] w-full pr-3",children:(0,D.jsxs)("div",{className:"space-y-2.5",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Capabilities"}),(0,D.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.agent.skills.length>0?a.agent.skills.map(a=>(0,D.jsx)(be,{variant:"muted",className:"max-w-full truncate",children:a},a)):(0,D.jsx)(be,{variant:"muted",children:"No explicit skills"})})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Declared tools"}),(0,D.jsx)("div",{className:"flex flex-wrap gap-1.5",children:l.length>0?l.map(a=>(0,D.jsx)(be,{variant:"warning",className:"max-w-full truncate",children:a},a)):(0,D.jsx)(be,{variant:"muted",children:"No explicit tools configured"})})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Observed tools"}),(0,D.jsx)("div",{className:"flex flex-wrap gap-1.5",children:m.length>0?m.map(a=>(0,D.jsx)(be,{variant:"default",className:"max-w-full truncate",children:a},a)):(0,D.jsx)(be,{variant:"muted",children:"No runtime tool calls recovered yet"})})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Permissions"}),(0,D.jsxs)("div",{className:"grid gap-1.5",children:[(0,D.jsx)(q1,{label:"File access",value:qF(a.agent.policy.fileAccess)}),(0,D.jsx)(q1,{label:"Network",value:qG(a.agent.policy.networkAccess)}),(0,D.jsx)(q1,{label:"Install scope",value:qE(a.agent.policy.installScope)}),(0,D.jsx)(q1,{label:"Missing tools",value:qD(a.agent.policy.missingToolBehavior)})]})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Runtime posture"}),(0,D.jsxs)("div",{className:"grid gap-1.5",children:[(0,D.jsx)(q1,{label:"Last active",value:s}),(0,D.jsx)(q1,{label:"Heartbeat",value:a.agent.heartbeat.enabled?r?`On \xb7 ${r}`:"On":"Off"}),(0,D.jsx)(q1,{label:"Sessions",value:String(a.agent.sessionCount)}),(0,D.jsx)(q1,{label:"Active runs",value:String(a.agent.activeRuntimeIds.length)})]})]})]})})})}):null]})]})]})},task:function({data:a,selected:b}){var c;let d="string"==typeof a.task.metadata.bootstrapStage?a.task.metadata.bootstrapStage:null,e="string"==typeof a.task.metadata.dispatchSubmittedAt?a.task.metadata.dispatchSubmittedAt:null,f=!!a.pendingCreation,g=!!a.justCreated,h=ri(a.task),i=function(a){if(ri(a))return!1;let b=a.status;return"running"===b||"queued"===b}(a.task),j=h?"text-rose-200":function(a){switch(a){case"running":return"text-cyan-300";case"completed":return"text-emerald-300";case"cancelled":return"text-rose-300";case"stalled":case"queued":return"text-amber-200";default:return"text-slate-400"}}(a.task.status),[k,l]=(0,E.useState)(!1),m=(0,E.useRef)(null),n=f?"warning":h?"danger":qX(a.task.status),o=function(a,b,c,d){if(d)return"aborted";if(!c||!a)return b;switch(a){case"submitting":return"submitting";case"accepted":return"accepted";case"waiting-for-heartbeat":return"starting runner";case"waiting-for-runtime":return"awaiting runtime";case"runtime-observed":return"going live";case"stalled":return"stalled";case"completed":return"completed";default:return b}}(d,a.task.status,f,h),p=function(a,b,c){if(c)return"dispatch aborted";switch(a){case"submitting":return"contacting dispatcher";case"accepted":return"dispatch accepted";case"waiting-for-heartbeat":return"waiting for first heartbeat";case"waiting-for-runtime":return"waiting for first OpenClaw runtime";case"runtime-observed":return"runtime observed";case"stalled":return"dispatch stalled";default:return b>0?`${b} live run${1===b?"":"s"}`:"no live runs right now"}}(d,a.task.liveRunCount,h),q=Array.isArray(a.task.metadata.optimisticEvents)?a.task.metadata.optimisticEvents:[],r=q.length>0&&"object"==typeof(c=q[q.length-1])&&null!==c&&"string"==typeof c.id&&"string"==typeof c.title&&"string"==typeof c.detail?q[q.length-1]:null,s=f?function(a,b){if(!a)return null;let c=Date.parse(a);if(Number.isNaN(c))return null;let d=Math.floor(Math.max(b-c,0)/1e3);if(d<60)return`${d}s`;let e=Math.floor(d/60),f=d%60;return 0===f?`${e}m`:`${e}m ${f}s`}(e,a.relativeTimeReferenceMs):null,[t,u]=(0,E.useState)(!1),{feed:v,loading:w,error:x}=function(a,b){let[c,d]=(0,E.useState)({taskId:null,feed:[]}),[e,f]=(0,E.useState)(null),[g,h]=(0,E.useState)({taskId:null,message:null}),i=c.taskId===a?c.feed:[],j=g.taskId===a?g.message:null;return{feed:i,loading:b&&e!==a&&null===j,error:j}}(a.task.id,t),y=v[v.length-1]??r??null,z=y?.title||p,B=q_(y?.detail,88)||(f?[p,s?`${s} elapsed`:null].filter(Boolean).join(" \xb7 "):q_(a.task.subtitle,72)||p),C=v.length>0?String(v.length):void 0,F=`task-feed-${a.task.id}`;return(0,D.jsxs)(pV.div,{initial:f?{opacity:0,scale:.92,y:-10}:g?{opacity:0,scale:.96,y:10}:{opacity:0,x:10},animate:f?{opacity:1,scale:1,y:0}:g?{opacity:1,scale:[1,1.015,1],y:0}:{opacity:1,x:0},transition:g?{duration:.7,times:[0,.45,1]}:void 0,className:bc("relative w-[272px] overflow-visible rounded-[22px] border border-amber-200/10 bg-[linear-gradient(180deg,rgba(20,18,14,0.98),rgba(9,8,6,0.96))] p-3.5 shadow-[0_18px_36px_rgba(0,0,0,0.28)] backdrop-blur-xl",a.emphasis?"opacity-100":"opacity-72",b&&"border-cyan-300/[0.45] shadow-[0_20px_46px_rgba(34,211,238,0.16)]",f&&"border-cyan-300/30 shadow-[0_24px_54px_rgba(34,211,238,0.2)]",g&&"border-cyan-200/40 shadow-[0_24px_56px_rgba(125,211,252,0.18)]",h&&"border-rose-300/30 shadow-[0_24px_54px_rgba(244,63,94,0.14)]","completed"===a.task.status&&!h&&!f&&!g&&"border-white/[0.06] bg-[linear-gradient(180deg,rgba(13,18,30,0.9),rgba(8,12,22,0.9))]"),children:[(0,D.jsxs)("div",{className:"pointer-events-none absolute inset-0 overflow-hidden rounded-[22px]",children:[(0,D.jsx)("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_82%_0%,rgba(251,191,36,0.22),transparent_30%),radial-gradient(circle_at_12%_100%,rgba(217,119,6,0.08),transparent_26%)]"}),(0,D.jsx)("div",{className:"absolute inset-x-0 top-0 h-[4px] bg-[linear-gradient(90deg,rgba(251,191,36,0.78),rgba(217,119,6,0.18),rgba(255,255,255,0.04))]"}),(0,D.jsx)("div",{className:"absolute right-3 top-3 h-12 w-12 rounded-full bg-amber-300/10 blur-xl"})]}),(0,D.jsxs)("div",{className:"relative z-10",children:[f?(0,D.jsx)(pV.div,{className:"pointer-events-none absolute inset-[-16px] rounded-[24px] border border-cyan-200/16",animate:{opacity:[.18,.42,.18],scale:[.985,1.02,.985]},transition:{duration:1.8,repeat:1/0,ease:"easeInOut"}}):null,(0,D.jsx)(iE,{type:"target",id:"target-left",position:A.Left,className:"!h-2.5 !w-2.5 !border-0 !bg-white/35"}),(0,D.jsxs)("div",{className:"relative z-20 overflow-visible rounded-[18px] border border-amber-200/12 bg-amber-400/[0.05] px-3 py-3 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsx)("div",{className:"text-[9px] uppercase tracking-[0.24em] text-amber-100/75",children:"Task"}),(0,D.jsxs)("div",{className:"nodrag nopan relative flex items-center gap-1.5",ref:m,children:[(0,D.jsx)(be,{variant:n,className:"max-w-[112px] truncate",children:o}),(0,D.jsx)("button",{type:"button","aria-label":"Task actions",onClick:a=>{a.stopPropagation(),l(a=>!a)},onPointerDown:a=>a.stopPropagation(),className:"nodrag nopan inline-flex rounded-full border border-white/[0.08] bg-white/[0.05] p-1.5 text-slate-300 transition-colors hover:bg-white/[0.1] hover:text-white",children:(0,D.jsx)(jH,{className:"h-3 w-3"})}),k?(0,D.jsxs)("div",{className:"nodrag nopan absolute right-0 top-[calc(100%+8px)] z-[70] min-w-[148px] rounded-[14px] border border-white/[0.1] bg-slate-950/96 p-1.5 shadow-[0_20px_44px_rgba(0,0,0,0.42)] backdrop-blur-xl",onClick:a=>a.stopPropagation(),onPointerDown:a=>a.stopPropagation(),children:[(0,D.jsx)(rh,{icon:q2,label:"Use prompt",onClick:()=>{a.onReply?.(a.task),l(!1)}}),(0,D.jsx)(rh,{icon:W,label:"Copy mission",onClick:()=>{a.onCopyPrompt?.(a.task),l(!1)}}),(0,D.jsx)(rh,{icon:L,label:"Hide",onClick:()=>{a.onHide?.(a.task),l(!1)}}),a.onAbortTask&&(i||h)?(0,D.jsx)(rh,{icon:q3,label:h?"Aborted":"Abort task",destructive:!0,disabled:!i,onClick:()=>{i&&(a.onAbortTask?.(a.task),l(!1))}}):null,(0,D.jsx)(rh,{icon:a.locked?q4:Z,label:a.locked?"Unlock":"Lock",onClick:()=>{a.onToggleLock?.(a.task),l(!1)}})]}):null]})]}),(0,D.jsxs)("div",{className:"mt-3 flex items-start gap-3",children:[(0,D.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[14px] border border-amber-300/20 bg-amber-400/[0.1] text-amber-100 shadow-[0_0_20px_rgba(251,191,36,0.12)]",children:(0,D.jsx)(q5,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("p",{className:"line-clamp-1 font-display text-[1rem] leading-5 text-white",children:q_(a.task.title||a.task.mission,44)||a.task.title}),(0,D.jsx)("p",{className:"mt-0.5 truncate text-[10px] uppercase tracking-[0.16em] text-slate-500",children:a.task.primaryAgentName||"OpenClaw"})]})]})]}),(0,D.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:[a.task.warningCount>0?(0,D.jsxs)(be,{variant:"warning",children:[a.task.warningCount," review",1===a.task.warningCount?"":"s"]}):null,g?(0,D.jsxs)(be,{variant:"default",className:"gap-1 border-cyan-100/20 bg-cyan-100/12 text-cyan-50",children:[(0,D.jsx)(cm,{className:"h-3 w-3"}),"new"]}):null,(0,D.jsxs)("span",{className:bc("text-[9px] uppercase tracking-[0.18em]",j),children:[qV(a.task.tokenUsage?.total)," tokens"]})]}),(0,D.jsx)("div",{className:"mt-3 rounded-[16px] border border-amber-300/12 bg-amber-400/[0.04] px-3 py-2.5",children:(0,D.jsx)("p",{className:"line-clamp-1 text-[12.5px] leading-5 text-slate-100",children:q_(a.task.subtitle,72)||a.task.subtitle})}),(0,D.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-1.5",children:[(0,D.jsx)(rg,{icon:q6,label:"Feed",value:C,active:t,onClick:()=>{a.onInspect?a.onInspect(a.task,"output"):u(a=>!a)}}),(0,D.jsx)(rg,{icon:q7,label:"Runs",value:String(a.task.runtimeCount),onClick:()=>a.onInspect?.(a.task,"overview")}),(0,D.jsx)(rg,{icon:cm,label:"Files",value:String(a.task.artifactCount),onClick:()=>a.onInspect?.(a.task,"files")})]}),(0,D.jsxs)("div",{className:bc("mt-3 border-t border-white/[0.08] pt-2.5",t&&"pb-1"),children:[(0,D.jsxs)("button",{type:"button","aria-expanded":t,"aria-controls":F,className:"nodrag nopan group flex w-full items-start justify-between gap-3 rounded-[14px] border border-transparent px-1 py-1.5 text-left transition-colors hover:border-white/[0.06] hover:bg-white/[0.02]",onClick:a=>{a.stopPropagation(),u(a=>!a)},onPointerDown:a=>a.stopPropagation(),children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"text-[9px] uppercase tracking-[0.2em] text-slate-500 transition-colors group-hover:text-slate-400",children:"Live feed"}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] text-slate-300",children:z}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] text-slate-500",children:B})]}),(0,D.jsx)("div",{className:"mt-0.5 shrink-0 rounded-full border border-white/[0.08] bg-white/[0.04] p-1 text-slate-400 transition-colors group-hover:border-white/[0.12] group-hover:text-slate-200",children:t?(0,D.jsx)(jI,{className:"h-3 w-3"}):(0,D.jsx)(U,{className:"h-3 w-3"})})]}),t&&(0,D.jsx)(pV.div,{id:F,initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"nodrag nopan overflow-hidden nowheel",onClick:a=>a.stopPropagation(),children:(0,D.jsx)("div",{className:"pt-2.5",children:(0,D.jsx)(qs,{className:"h-[164px] w-full pr-3",children:w&&0===v.length?(0,D.jsx)("div",{className:"py-4 text-center text-[10px] text-slate-500",children:"Connecting to feed..."}):x&&0===v.length?(0,D.jsx)("div",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[10px] leading-5 text-amber-100",children:x}):0===v.length?(0,D.jsx)("div",{className:"py-4 text-center text-[10px] text-slate-500",children:"No events yet."}):(0,D.jsx)("div",{className:"flex flex-col gap-2.5",children:v.map(a=>(0,D.jsxs)("div",{className:"group/item relative pl-3",children:[(0,D.jsx)("div",{className:bc("absolute left-0 top-1.5 h-1.5 w-1.5 rounded-full",function(a,b){if(b)return"bg-red-400";switch(a){case"status":return"bg-slate-400";case"assistant":return"bg-cyan-400";case"tool":return"bg-indigo-400";case"artifact":return"bg-emerald-400";case"warning":return"bg-amber-400";case"user":return"bg-pink-400";default:return"bg-slate-500"}}(a.kind,a.isError))}),(0,D.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,D.jsx)("span",{className:"text-[10px] font-medium text-slate-300",children:a.title}),(0,D.jsx)("span",{className:"shrink-0 text-[9px] text-slate-600",children:function(a){try{return new Date(a).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return""}}(a.timestamp)})]}),(0,D.jsx)("div",{className:"mt-0.5",children:(0,D.jsx)(re,{text:a.detail,className:"text-[10px] leading-relaxed text-slate-400 group-hover/item:text-slate-300",url:"url"in a?a.url:null,filePath:"filePath"in a?a.filePath:null,displayPath:"displayPath"in a?a.displayPath:null,compact:!0})})]},a.id))})})})})]})]})]})}},rr={simplebezier:function({id:a,sourceX:b,sourceY:c,sourcePosition:d,targetX:e,targetY:f,targetPosition:g,style:h,selected:i,animated:j,markerEnd:k,interactionWidth:l=28}){let[m]=i$({sourceX:b,sourceY:c,sourcePosition:d,targetX:e,targetY:f,targetPosition:g}),n=function(a,b){if("number"==typeof a&&Number.isFinite(a))return a;if("string"==typeof a){let b=Number.parseFloat(a);if(Number.isFinite(b))return b}return b?2.95:2.25}(h?.strokeWidth,!!j),o=`mission-edge-motion-${a.replace(/[^a-zA-Z0-9_-]/g,"-")}`,p=j?[{size:4.6,halo:8.4,duration:2.4,delay:0,alpha:.96},{size:3.2,halo:6.4,duration:2.95,delay:.78,alpha:.86},{size:2.2,halo:5.2,duration:2.65,delay:1.42,alpha:.8}]:[],q={...h,animation:"none",pointerEvents:"none",strokeDasharray:"none",strokeWidth:n+4},r={...h,animation:"none",pointerEvents:"none",strokeDasharray:"none",strokeWidth:n};return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(iY,{path:m,className:bc("mission-edge__path mission-edge__path--glow",j&&"mission-edge__path--animated",i&&"mission-edge__path--selected"),interactionWidth:0,style:q}),(0,D.jsx)(iY,{path:m,className:bc("mission-edge__path mission-edge__path--core",j&&"mission-edge__path--animated",i&&"mission-edge__path--selected"),interactionWidth:l,markerEnd:k,style:r}),j?(0,D.jsx)("path",{id:o,d:m,fill:"none",stroke:"none",opacity:0,style:{pointerEvents:"none"}}):null,p.map((a,b)=>(0,D.jsxs)("g",{className:"mission-edge__packet",style:{color:"var(--mission-edge-packet)",opacity:a.alpha,filter:"drop-shadow(0 0 10px var(--mission-edge-glow-active))"},"aria-hidden":"true",children:[(0,D.jsx)("circle",{r:a.halo,fill:"currentColor",opacity:.16}),(0,D.jsx)("circle",{r:a.size,fill:"currentColor",opacity:.95}),(0,D.jsx)("animateMotion",{dur:`${a.duration}s`,begin:`${a.delay}s`,repeatCount:"indefinite",rotate:"auto",children:(0,D.jsx)("mpath",{href:`#${o}`})})]},`${o}-packet-${b}`))]})}};function rs({snapshot:a,activeWorkspaceId:b,selectedNodeId:c,focusedAgentId:d,recentDispatchId:e,hiddenRuntimeIds:f,hiddenTaskKeys:g,lockedTaskKeys:h,onToggleWorkspaceTaskCards:i,onEditAgent:j,onDeleteAgent:k,onFocusAgent:l,onReplyTask:m,onCopyTaskPrompt:n,onHideTask:o,onToggleTaskLock:p,onAbortTask:q,onInspectTask:r,onSelectNode:s,className:t}){var u,v,w,x,y,A,B,C,F,G,H,I,J,K,L,M,N,O,P;let Q,R,S,T,U,V,W,X,Y=(0,E.useRef)(null),Z=(0,E.useRef)(null);(0,E.useRef)(new Set),(0,E.useRef)(new Map),(0,E.useRef)({}),(0,E.useRef)(!1),(0,E.useRef)(!1),(0,E.useRef)(!1);let $=qT(a.generatedAt),[_,aa]=(0,E.useState)([]),[ab,ac]=(0,E.useState)(null),ad=(u=a,v=$,w=b,x=d,y=_,A=f,B=g,C=h,F=i,G=j,H=k,I=l,J=m,K=n,L=o,M=p,N=q,O=r,P=rp,Q=x?u.agents.find(a=>a.id===x):null,R=Q?.workspaceId??null,T=(S=null!==Q)?u.workspaces.filter(a=>a.id===R):w?u.workspaces.filter(a=>a.id===w):[...u.workspaces].sort((a,b)=>b.activeRuntimeIds.length-a.activeRuntimeIds.length),U=[],V=[],W=[],T.forEach((a,b)=>{let c=S?u.agents.filter(b=>b.workspaceId===a.id&&b.id===x):u.agents.filter(b=>b.workspaceId===a.id),d=S?u.tasks.filter(b=>b.workspaceId===a.id&&b.primaryAgentId===x):u.tasks.filter(b=>b.workspaceId===a.id),e=S?[]:d.filter(a=>!C.includes(a.key)),f=S?d:d.filter(a=>!rt(a,A,B,C)),g=!S&&e.length>0&&e.every(a=>rt(a,A,B,C)),h=b%2*1160+44,i=920*Math.floor(b/2)+42,j=h+52,k=h+390,l=i+118;c.forEach((b,c)=>{var d,e;let g=f.filter(a=>{var c;return((c=a).primaryAgentId||c.agentIds[0]||null)===b.id}).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),h=l+4*c;V.push({id:b.id,type:"agent",draggable:!0,position:ru((d=b,`agent:${d.workspaceId}:${d.id}`),{x:j,y:h},P,(e=b.id,`agent:${e}`)),zIndex:10,selected:!1,data:{agent:b,emphasis:!!S||!w||w===a.id,focused:x===b.id,relativeTimeReferenceMs:v,onEdit:G,onDelete:H,onFocus:I}}),W.push(...g),g.forEach((b,c)=>{var d,e;let f="string"==typeof b.metadata.bootstrapStage?b.metadata.bootstrapStage:null,g="submitting"===f||"accepted"===f||"waiting-for-heartbeat"===f||"waiting-for-runtime"===f||"runtime-observed"===f,i=y.includes(b.id);V.push({id:b.id,type:"task",draggable:!0,selectable:!0,position:ru((d=b,`task:${d.workspaceId||"global"}:${d.key}`),{x:k,y:h+152*c+10},P,(e=b.id,`task:${e}`)),zIndex:g?40:i?28:10,selected:!1,data:{task:b,emphasis:!!S||!w||w===a.id,relativeTimeReferenceMs:v,pendingCreation:g,justCreated:i,locked:C.includes(b.key),onReply:J,onCopyPrompt:K,onHide:L,onToggleLock:M,onAbortTask:N,onInspect:O}})}),l+=Math.max(152,152*g.length+44)}),S||U.push({id:a.id,type:"workspace",draggable:!1,position:{x:h,y:i},zIndex:0,style:{width:1060,height:Math.max(l-i+112,700)},selectable:!0,selected:!1,data:{workspace:a,emphasis:!w||w===a.id,taskCardCount:e.length,taskCardsHidden:g,onToggleTaskCards:e.length>0?()=>F(a.id):void 0}})}),{nodes:X=[...U,...V],edges:function(a,b){let c=[],d=new Map(b.map(a=>[a.id,a]));for(let b of a){if(!b.primaryAgentId)continue;let a=d.get(b.primaryAgentId),e=d.get(b.id);a&&e&&c.push({id:`edge:${b.primaryAgentId}:${b.id}`,source:b.primaryAgentId,target:b.id,sourceHandle:"source-right",targetHandle:"target-left",type:"simplebezier",zIndex:4,animated:"running"===b.status,style:{strokeWidth:"running"===b.status?2.95:2.25}})}return c}(W,X)}),[ae,af,ag]=function(a){let[b,c]=(0,E.useState)(a),d=(0,E.useCallback)(a=>c(b=>ia(a,b)),[]);return[b,c,d]}(ad.nodes),[ah,ai,aj]=function(a){let[b,c]=(0,E.useState)(a),d=(0,E.useCallback)(a=>c(b=>ia(a,b)),[]);return[b,c,d]}(ad.edges);return(0,D.jsx)("div",{ref:Y,className:bc("h-full w-full",t),children:(0,D.jsx)(jC,{nodes:ae,edges:ah,nodeTypes:rq,onInit:a=>{Z.current=a},elevateNodesOnSelect:!1,onNodesChange:ag,onEdgesChange:aj,onNodeClick:(a,b)=>s(b.id),fitView:!0,fitViewOptions:{padding:.14,duration:700,maxZoom:.9},minZoom:.42,maxZoom:1.2,defaultEdgeOptions:{type:"simplebezier",markerEnd:{type:z.ArrowClosed,width:16,height:16,color:"var(--mission-edge-arrow)"},style:{strokeWidth:2.25}},edgeTypes:rr,defaultMarkerColor:"var(--mission-edge-arrow)",proOptions:{hideAttribution:!0},className:"h-full w-full rounded-[inherit]"})})}function rt(a,b,c,d){return!d.includes(a.key)&&(!!c.includes(a.key)||0!==a.runtimeIds.length&&a.runtimeIds.every(a=>b.includes(a)))}function ru(a,b,c,d){let e=c[a]||(d?c[d]:void 0);return e?{x:e.x,y:e.y}:b}let rv=K("send-horizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]),rw=K("refresh-ccw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]),rx=K("sliders-horizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]),ry="u">typeof window?E.useLayoutEffect:E.useEffect;function rz(a,b){if("function"==typeof a)return a(b);null!=a&&(a.current=b)}class rA extends E.Component{getSnapshotBeforeUpdate(a){let b=this.props.childRef.current;if(b&&a.isPresent&&!this.props.isPresent&&!1!==this.props.pop){let a=b.offsetParent,c=pG(a)&&a.offsetWidth||0,d=pG(a)&&a.offsetHeight||0,e=this.props.sizeRef.current;e.height=b.offsetHeight||0,e.width=b.offsetWidth||0,e.top=b.offsetTop,e.left=b.offsetLeft,e.right=c-e.width-e.left,e.bottom=d-e.height-e.top}return null}componentDidUpdate(){}render(){return this.props.children}}function rB({children:a,isPresent:b,anchorX:c,anchorY:d,root:e,pop:f}){let g=(0,E.useId)(),h=(0,E.useRef)(null),i=(0,E.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:j}=(0,E.useContext)(mo),k=function(...a){return E.useCallback(function(...a){return b=>{let c=!1,d=a.map(a=>{let d=rz(a,b);return c||"function"!=typeof d||(c=!0),d});if(c)return()=>{for(let b=0;b<d.length;b++){let c=d[b];"function"==typeof c?c():rz(a[b],null)}}}}(...a),a)}(h,a.props?.ref??a?.ref);return(0,E.useInsertionEffect)(()=>{let{width:a,height:k,top:l,left:m,right:n,bottom:o}=i.current;if(b||!1===f||!h.current||!a||!k)return;let p="left"===c?`left: ${m}`:`right: ${n}`,q="bottom"===d?`bottom: ${o}`:`top: ${l}`;h.current.dataset.motionPopId=g;let r=document.createElement("style");j&&(r.nonce=j);let s=e??document.head;return s.appendChild(r),r.sheet&&r.sheet.insertRule(`
6
6
  [data-motion-pop-id="${g}"] {
7
7
  position: absolute !important;
8
8
  width: ${a}px !important;
@@ -10,18 +10,169 @@ For more information, see https://radix-ui.com/primitives/docs/components/${b.do
10
10
  ${p}px !important;
11
11
  ${q}px !important;
12
12
  }
13
- `),()=>{s.contains(r)&&s.removeChild(r)}},[b]),(0,D.jsx)(rq,{isPresent:b,childRef:h,sizeRef:i,pop:f,children:!1===f?a:E.cloneElement(a,{ref:k})})}let rs=({children:a,initial:b,isPresent:c,onExitComplete:d,custom:e,presenceAffectsLayout:f,mode:g,anchorX:h,anchorY:i,root:j})=>{let k=mw(rt),l=(0,E.useId)(),m=!0,n=(0,E.useMemo)(()=>(m=!1,{id:l,initial:b,isPresent:c,custom:e,onExitComplete:a=>{for(let b of(k.set(a,!0),k.values()))if(!b)return;d&&d()},register:a=>(k.set(a,!1),()=>k.delete(a))}),[c,k,d]);return f&&m&&(n={...n}),(0,E.useMemo)(()=>{k.forEach((a,b)=>k.set(b,!1))},[c]),E.useEffect(()=>{c||k.size||!d||d()},[c]),a=(0,D.jsx)(rr,{pop:"popLayout"===g,isPresent:c,anchorX:h,anchorY:i,root:j,children:a}),(0,D.jsx)(mv.Provider,{value:n,children:a})};function rt(){return new Map}let ru=a=>a.key||"";function rv(a){let b=[];return E.Children.forEach(a,a=>{(0,E.isValidElement)(a)&&b.push(a)}),b}let rw=({children:a,custom:b,initial:c=!0,onExitComplete:d,presenceAffectsLayout:e=!0,mode:f="sync",propagate:g=!1,anchorX:h="left",anchorY:i="top",root:j})=>{let[k,l]=oD(g),m=(0,E.useMemo)(()=>rv(a),[a]),n=g&&!k?[]:m.map(ru),o=(0,E.useRef)(!0),p=(0,E.useRef)(m),q=mw(()=>new Map),r=(0,E.useRef)(new Set),[s,t]=(0,E.useState)(m),[u,v]=(0,E.useState)(m);ro(()=>{o.current=!1,p.current=m;for(let a=0;a<u.length;a++){let b=ru(u[a]);n.includes(b)?(q.delete(b),r.current.delete(b)):!0!==q.get(b)&&q.set(b,!1)}},[u,n.length,n.join("-")]);let w=[];if(m!==s){let a=[...m];for(let b=0;b<u.length;b++){let c=u[b],d=ru(c);n.includes(d)||(a.splice(b,0,c),w.push(c))}return"wait"===f&&w.length&&(a=w),v(rv(a)),t(m),null}let{forceRender:x}=(0,E.useContext)(mk);return(0,D.jsx)(D.Fragment,{children:u.map(a=>{let s=ru(a),t=(!g||!!k)&&(m===u||n.includes(s));return(0,D.jsx)(rs,{isPresent:t,initial:(!o.current||!!c)&&void 0,custom:b,presenceAffectsLayout:e,mode:f,root:j,onExitComplete:t?void 0:()=>{if(r.current.has(s)||(r.current.add(s),!q.has(s)))return;q.set(s,!0);let a=!0;q.forEach(b=>{b||(a=!1)}),a&&(x?.(),v(p.current),g&&l?.(),d&&d())},anchorX:h,anchorY:i,children:a},s)})})};var rx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,b)=>{let c=bk(`Primitive.${b}`),d=E.forwardRef((a,d)=>{let{asChild:e,...f}=a;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,D.jsx)(e?c:b,{...f,ref:d})});return d.displayName=`Primitive.${b}`,{...a,[b]:d}},{}),ry=E.forwardRef((a,b)=>(0,D.jsx)(rx.label,{...a,ref:b,onMouseDown:b=>{b.target.closest("button, input, select, textarea")||(a.onMouseDown?.(b),!b.defaultPrevented&&b.detail>1&&b.preventDefault())}}));ry.displayName="Label";let rz=aa("text-xs font-medium uppercase tracking-[0.18em] text-slate-400"),rA=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)(ry,{ref:c,className:bb(rz(),a),...b}));rA.displayName=ry.displayName;let rB=[{value:"15m",label:"15 min"},{value:"30m",label:"30 min"},{value:"60m",label:"1 hour"},{value:"240m",label:"4 hours"}];function rC(a){return"monitoring"===a?{enabled:!0,every:"30m"}:{enabled:!1,every:"30m"}}function rD(a,b){let c=rC(a),d="string"==typeof b?.every&&b.every.trim()&&"disabled"!==b.every?b.every.trim():c.every;return"boolean"==typeof b?.enabled?{enabled:b.enabled,every:d}:b?.every==="disabled"?{enabled:!1,every:d}:c}function rE(a,b,c){let d=rC(b);return a.enabled!==d.enabled||a.every!==d.every?a:rC(c)}function rF({snapshot:a,defaultWorkspaceId:b,onRefresh:c,onAgentCreated:d,trigger:e}){var f,g;let h,i,[j,k]=(0,E.useState)(!1),[l,m]=(0,E.useState)(!1),[n,o]=(0,E.useState)(!1),[p,q]=(0,E.useState)(!1),[r,s]=(0,E.useState)(!1),[t,u]=(0,E.useState)(()=>(function(a,b={}){let c=qy(b.policy?.preset??"worker",b.policy),d=qr[c.preset],e=rD(c.preset,b.heartbeat);return{id:b.id??"",workspaceId:a,modelId:b.modelId??"",name:b.name??d.defaultName,emoji:b.emoji??d.defaultEmoji,theme:b.theme??d.defaultTheme,avatar:b.avatar??"",policy:c,heartbeat:e}})(b??a.workspaces[0]?.id??"")),v=a.workspaces.find(a=>a.id===t.workspaceId)??a.workspaces[0]??null,w=(f=v?.slug,g=t.name||qr[t.policy.preset].defaultName,h=rK(f??""),i=rK(g)||"agent",h?`${h}-${i}`:i),x=rK(t.id),y=x.length>0?a.agents.find(a=>a.id===x)??null:null,z=y?a.workspaces.find(a=>a.id===y.workspaceId)?.name??y.workspacePath:null,A=!!(x&&t.workspaceId)&&!p&&null===y,B=n||"monitoring"===t.policy.preset,C=async()=>{if(x&&!y){q(!0);try{let a=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,id:x})}),b=await a.json();if(!a.ok||b.error||!b.agentId)throw Error(b.error||"OpenClaw could not create the agent.");d9.o.success("Agent created in OpenClaw.",{description:b.agentId}),m(!1),await c(),d?.(b.agentId)}catch(a){d9.o.error("Agent creation failed.",{description:a instanceof Error?a.message:"Unknown agent error."})}finally{q(!1)}}};return j?(0,D.jsxs)(dw,{open:l,onOpenChange:m,children:[(0,D.jsx)(dy,{asChild:!0,children:e}),(0,D.jsxs)(d$,{className:"max-h-[90vh] overflow-y-auto sm:max-w-3xl",children:[(0,D.jsxs)(d_,{children:[(0,D.jsx)(d1,{children:"Create a new OpenClaw agent"}),(0,D.jsx)(d2,{children:"This creates a real isolated agent bound to an existing workspace with a preset policy."})]}),(0,D.jsxs)("div",{className:"space-y-5",children:[(0,D.jsxs)("div",{className:"space-y-3",children:[(0,D.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:"Agent preset"}),(0,D.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:qt.map(a=>(0,D.jsx)(rH,{label:a.label,description:a.description,active:t.policy.preset===a.value,badgeVariant:qr[a.value].badgeVariant,onClick:()=>u(b=>{var c,d;let e,f,g;return c=b,d=a.value,e=qr[c.policy.preset],f=qr[d],g=qy(d),{...c,name:c.name&&c.name!==e.defaultName?c.name:f.defaultName,emoji:c.emoji&&c.emoji!==e.defaultEmoji?c.emoji:f.defaultEmoji,theme:c.theme&&c.theme!==e.defaultTheme?c.theme:f.defaultTheme,policy:g,heartbeat:rE(c.heartbeat,c.policy.preset,d)}})},a.value))})]}),(0,D.jsx)(rI,{policy:t.policy}),(0,D.jsxs)(rG,{label:"Agent id",htmlFor:"create-agent-id",children:[(0,D.jsx)(bq,{id:"create-agent-id",value:t.id,onChange:a=>{let b=a.target.value,c=rK(b);s(!!c&&c!==w),u(a=>({...a,id:b}))},placeholder:w||"workspace-agent"}),(0,D.jsx)("p",{className:bb("text-[12px]",y?"text-rose-300":"text-slate-500"),children:y?`ID "${x}" is already used by ${y.name} in ${z}.`:x&&x!==t.id.trim()?`Saved as ${x}. Suggested workspace-scoped id: ${w}.`:`Workspace-scoped id: ${w}.`})]}),(0,D.jsx)(rG,{label:"Display name",htmlFor:"create-agent-name",children:(0,D.jsx)(bq,{id:"create-agent-name",value:t.name,onChange:a=>u(b=>({...b,name:a.target.value})),placeholder:qr[t.policy.preset].defaultName})}),(0,D.jsx)(rG,{label:"Workspace",htmlFor:"create-agent-workspace",children:(0,D.jsx)("select",{id:"create-agent-workspace",value:t.workspaceId,onChange:a=>u(b=>({...b,workspaceId:a.target.value})),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:a.workspaces.map(a=>(0,D.jsx)("option",{value:a.id,children:a.name},a.id))})}),(0,D.jsx)(rG,{label:"Model",htmlFor:"create-agent-model",children:(0,D.jsxs)("select",{id:"create-agent-model",value:t.modelId,onChange:a=>u(b=>({...b,modelId:a.target.value})),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:[(0,D.jsx)("option",{value:"",children:"Use OpenClaw default"}),a.models.map(a=>(0,D.jsx)("option",{value:a.id,children:a.id},a.id))]})}),(0,D.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,D.jsx)(rG,{label:"Emoji",htmlFor:"create-agent-emoji",children:(0,D.jsx)(bq,{id:"create-agent-emoji",value:t.emoji,onChange:a=>u(b=>({...b,emoji:a.target.value})),placeholder:qr[t.policy.preset].defaultEmoji})}),(0,D.jsx)(rG,{label:"Theme",htmlFor:"create-agent-theme",children:(0,D.jsx)(bq,{id:"create-agent-theme",value:t.theme,onChange:a=>u(b=>({...b,theme:a.target.value})),placeholder:qr[t.policy.preset].defaultTheme})})]}),(0,D.jsx)(rG,{label:"Avatar URL",htmlFor:"create-agent-avatar",children:(0,D.jsx)(bq,{id:"create-agent-avatar",value:t.avatar,onChange:a=>u(b=>({...b,avatar:a.target.value})),placeholder:"https://example.com/avatar.png"})}),(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-white/[0.03] p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:"Advanced policy"}),(0,D.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"Override missing-tool behavior, install scope, file access, and network posture."})]}),(0,D.jsx)(bp,{type:"button",variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>o(a=>!a),children:n?"Hide":"Show"})]}),B?(0,D.jsxs)("div",{className:"mt-4 rounded-[18px] border border-white/10 bg-slate-950/40 p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:"Heartbeat"}),(0,D.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"Use this only for periodic watch or triage agents. Leave it off for normal task execution."})]}),(0,D.jsx)(bp,{type:"button",variant:t.heartbeat.enabled?"default":"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>u(a=>({...a,heartbeat:a.heartbeat.enabled?{...a.heartbeat,enabled:!1}:{...a.heartbeat,enabled:!0,every:a.heartbeat.every||rC(a.policy.preset).every}})),children:t.heartbeat.enabled?"On":"Off"})]}),t.heartbeat.enabled?(0,D.jsx)("div",{className:"mt-3",children:(0,D.jsx)(rG,{label:"Interval",htmlFor:"create-agent-heartbeat-every",children:(0,D.jsx)("select",{id:"create-agent-heartbeat-every",value:t.heartbeat.every,onChange:a=>u(b=>({...b,heartbeat:{...b.heartbeat,every:a.target.value}})),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:rB.map(a=>(0,D.jsx)("option",{value:a.value,children:a.label},a.value))})})}):null]}):null,n?(0,D.jsxs)("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:[(0,D.jsx)(rJ,{label:"Missing tool behavior",htmlFor:"create-agent-missing-tools",value:t.policy.missingToolBehavior,options:qu,onChange:a=>u(b=>({...b,policy:{...b.policy,missingToolBehavior:a}}))}),(0,D.jsx)(rJ,{label:"Install scope",htmlFor:"create-agent-install-scope",value:t.policy.installScope,options:qv,onChange:a=>u(b=>({...b,policy:{...b.policy,installScope:a}}))}),(0,D.jsx)(rJ,{label:"File access",htmlFor:"create-agent-file-access",value:t.policy.fileAccess,options:qw,onChange:a=>u(b=>({...b,policy:{...b.policy,fileAccess:a}}))}),(0,D.jsx)(rJ,{label:"Network access",htmlFor:"create-agent-network-access",value:t.policy.networkAccess,options:qx,onChange:a=>u(b=>({...b,policy:{...b.policy,networkAccess:a}}))})]}):null]})]}),(0,D.jsxs)(d0,{children:[(0,D.jsx)(bp,{variant:"secondary",onClick:()=>m(!1),children:"Cancel"}),(0,D.jsx)(bp,{onClick:C,disabled:!A,children:p?"Creating...":"Create agent"})]})]})]}):(0,D.jsx)(D.Fragment,{children:e})}function rG({label:a,htmlFor:b,children:c}){return(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)(rA,{htmlFor:b,className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:a}),c]})}function rH({label:a,description:b,active:c,badgeVariant:d,onClick:e}){return(0,D.jsx)("button",{type:"button",onClick:e,className:bb("rounded-[20px] border p-4 text-left transition-colors",c?"border-cyan-300/30 bg-cyan-400/10":"border-white/10 bg-white/[0.03]"),children:(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"space-y-1",children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:a}),(0,D.jsx)("p",{className:"text-xs leading-5 text-slate-400",children:b})]}),(0,D.jsx)(bd,{variant:d,children:c?"selected":"preset"})]})})}function rI({policy:a}){let b=qr[a.preset];return(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-slate-950/50 p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:b.label}),(0,D.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:b.description})]}),(0,D.jsx)(bd,{variant:b.badgeVariant,children:b.label})]}),(0,D.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,D.jsx)(bd,{variant:"muted",children:qA(a.missingToolBehavior)}),(0,D.jsx)(bd,{variant:"muted",children:qB(a.installScope)}),(0,D.jsx)(bd,{variant:"muted",children:qC(a.fileAccess)}),(0,D.jsxs)(bd,{variant:"muted",children:["Network ",qD(a.networkAccess)]})]})]})}function rJ({label:a,htmlFor:b,value:c,options:d,onChange:e}){return(0,D.jsx)(rG,{label:a,htmlFor:b,children:(0,D.jsx)("select",{id:b,value:c,onChange:a=>e(a.target.value),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:d.map(a=>(0,D.jsxs)("option",{value:a.value,children:[a.label," - ",a.description]},a.value))})})}function rK(a){return a.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}let rL=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)("textarea",{className:bb("flex min-h-[96px] w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-3 text-sm text-white placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400/60 disabled:cursor-not-allowed disabled:opacity-50",a),ref:c,...b}));rL.displayName="Textarea";let rM="mission-control-recent-prompts";function rN({snapshot:a,activeWorkspaceId:b,selectedNodeId:c,composeIntent:d,onRefresh:e,onOpenWorkspaceCreate:f,onMissionDispatchStart:g,onMissionDispatchFailure:h,onMissionResponse:i}){var j,k;let l,m,[n,o]=(0,E.useState)(""),[p,q]=(0,E.useState)(""),[r,s]=(0,E.useState)("medium"),[t,u]=(0,E.useState)(!1),[v,w]=(0,E.useState)(!1),[x,y]=(0,E.useState)(!1),[z,A]=(0,E.useState)(!1),[B,C]=(0,E.useState)(!1),[F,G]=(0,E.useState)(!1),[H,I]=(0,E.useState)(null),J=(0,E.useRef)(null);(0,E.useRef)(null);let K=(0,E.useRef)(null);(0,E.useRef)(null);let M=(0,E.useRef)(!1);(0,E.useRef)(null);let N=a.workspaces.find(a=>a.id===b)??a.workspaces[0],O=a.agents.filter(a=>!N||a.workspaceId===N.id),P=O.find(a=>a.id===p)??O[0]??null,Q=P?.id??null,R=O.map(a=>({label:a.name,value:a.id})),S=(j=N?.id??b??null,k=Q,j||k?`mission-control-composer-draft:${j??"global"}:${k??"unassigned"}`:null),T=!!(n.trim()&&Q&&!t),U=P?`Compose for ${P.name}...`:"Compose a mission...",V=((l=[]).push({id:"workspace-create",label:"Create workspace",action:"open-workspace-create"}),m=new Set,l.filter(a=>{let b=`${a.action||"mission"}:${a.mission?.trim().toLowerCase()||a.label.toLowerCase()}`;return!m.has(b)&&(m.add(b),!0)}).slice(0,3)),W=V.length>0,X=B&&!F&&!z&&!x&&!t&&0===n.trim().length&&null===H,Y=async a=>{u(!0);let c=a.agentId||Q,d=Date.now(),f=globalThis.crypto?.randomUUID?.()||`dispatch:${d}`,j=new AbortController;c&&g({requestId:f,mission:a.mission.trim(),agentId:c,workspaceId:N?.id??b??null,submittedAt:d,abortController:j});try{let g=a.mission.trim(),h=await fetch("/api/mission",{method:"POST",headers:{"Content-Type":"application/json"},signal:j.signal,body:JSON.stringify(a)}),k=await h.json();if(!h.ok||k.error)throw Error(k.error||"OpenClaw rejected the mission.");i(k,{requestId:f}),o(""),I(null),y(!1),M.current=!0,S&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(S),c&&function(a){let b=[a,...(function(){try{let a=globalThis.localStorage.getItem(rM);if(!a)return[];let b=JSON.parse(a);if(!Array.isArray(b))return[];return b.filter(a=>"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.mission&&"string"==typeof a.agentId&&"string"==typeof a.agentName&&"number"==typeof a.submittedAt).slice(0,6)}catch{return[]}})().filter(b=>b.mission.trim()!==a.mission.trim()||b.agentId!==a.agentId||b.workspaceId!==a.workspaceId)].slice(0,6);try{globalThis.localStorage.setItem(rM,JSON.stringify(b))}catch{}}({id:globalThis.crypto?.randomUUID?.()||`${d}`,mission:g,agentId:c,agentName:P?.name??"Agent",workspaceId:N?.id??b,workspaceName:N?.name??null,submittedAt:d});let l="string"==typeof k.meta?.outputDirRelative?`${k.status} via ${k.agentId} \xb7 ${k.meta.outputDirRelative}`:`${k.status} via ${k.agentId}`;"stalled"===k.status?d9.o.error("Mission could not start.",{description:k.summary||l}):d9.o.success("Mission queued in OpenClaw.",{description:l}),e().catch(()=>null)}catch(a){if(a instanceof DOMException&&"AbortError"===a.name)return;h(f,a instanceof Error?a.message:"Unknown mission error."),d9.o.error("Mission dispatch failed.",{description:a instanceof Error?a.message:"Unknown mission error."})}finally{u(!1)}},Z=(a,b={})=>{b.thinking&&s(b.thinking),o(c=>{var d,e;let f,g;return"replace"===b.mode?a:(d=c,e=a,f=d.trim(),g=e.trim(),f?g?`${f}
13
+ `),()=>{s.contains(r)&&s.removeChild(r)}},[b]),(0,D.jsx)(rA,{isPresent:b,childRef:h,sizeRef:i,pop:f,children:!1===f?a:E.cloneElement(a,{ref:k})})}let rC=({children:a,initial:b,isPresent:c,onExitComplete:d,custom:e,presenceAffectsLayout:f,mode:g,anchorX:h,anchorY:i,root:j})=>{let k=mz(rD),l=(0,E.useId)(),m=!0,n=(0,E.useMemo)(()=>(m=!1,{id:l,initial:b,isPresent:c,custom:e,onExitComplete:a=>{for(let b of(k.set(a,!0),k.values()))if(!b)return;d&&d()},register:a=>(k.set(a,!1),()=>k.delete(a))}),[c,k,d]);return f&&m&&(n={...n}),(0,E.useMemo)(()=>{k.forEach((a,b)=>k.set(b,!1))},[c]),E.useEffect(()=>{c||k.size||!d||d()},[c]),a=(0,D.jsx)(rB,{pop:"popLayout"===g,isPresent:c,anchorX:h,anchorY:i,root:j,children:a}),(0,D.jsx)(my.Provider,{value:n,children:a})};function rD(){return new Map}let rE=a=>a.key||"";function rF(a){let b=[];return E.Children.forEach(a,a=>{(0,E.isValidElement)(a)&&b.push(a)}),b}let rG=({children:a,custom:b,initial:c=!0,onExitComplete:d,presenceAffectsLayout:e=!0,mode:f="sync",propagate:g=!1,anchorX:h="left",anchorY:i="top",root:j})=>{let[k,l]=oG(g),m=(0,E.useMemo)(()=>rF(a),[a]),n=g&&!k?[]:m.map(rE),o=(0,E.useRef)(!0),p=(0,E.useRef)(m),q=mz(()=>new Map),r=(0,E.useRef)(new Set),[s,t]=(0,E.useState)(m),[u,v]=(0,E.useState)(m);ry(()=>{o.current=!1,p.current=m;for(let a=0;a<u.length;a++){let b=rE(u[a]);n.includes(b)?(q.delete(b),r.current.delete(b)):!0!==q.get(b)&&q.set(b,!1)}},[u,n.length,n.join("-")]);let w=[];if(m!==s){let a=[...m];for(let b=0;b<u.length;b++){let c=u[b],d=rE(c);n.includes(d)||(a.splice(b,0,c),w.push(c))}return"wait"===f&&w.length&&(a=w),v(rF(a)),t(m),null}let{forceRender:x}=(0,E.useContext)(mn);return(0,D.jsx)(D.Fragment,{children:u.map(a=>{let s=rE(a),t=(!g||!!k)&&(m===u||n.includes(s));return(0,D.jsx)(rC,{isPresent:t,initial:(!o.current||!!c)&&void 0,custom:b,presenceAffectsLayout:e,mode:f,root:j,onExitComplete:t?void 0:()=>{if(r.current.has(s)||(r.current.add(s),!q.has(s)))return;q.set(s,!0);let a=!0;q.forEach(b=>{b||(a=!1)}),a&&(x?.(),v(p.current),g&&l?.(),d&&d())},anchorX:h,anchorY:i,children:a},s)})})};var rH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,b)=>{let c=bl(`Primitive.${b}`),d=E.forwardRef((a,d)=>{let{asChild:e,...f}=a;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,D.jsx)(e?c:b,{...f,ref:d})});return d.displayName=`Primitive.${b}`,{...a,[b]:d}},{}),rI=E.forwardRef((a,b)=>(0,D.jsx)(rH.label,{...a,ref:b,onMouseDown:b=>{b.target.closest("button, input, select, textarea")||(a.onMouseDown?.(b),!b.defaultPrevented&&b.detail>1&&b.preventDefault())}}));rI.displayName="Label";let rJ=ab("text-xs font-medium uppercase tracking-[0.18em] text-slate-400"),rK=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)(rI,{ref:c,className:bc(rJ(),a),...b}));rK.displayName=rI.displayName;let rL=[{value:"15m",label:"15 min"},{value:"30m",label:"30 min"},{value:"60m",label:"1 hour"},{value:"240m",label:"4 hours"}];function rM(a){return"monitoring"===a?{enabled:!0,every:"30m"}:{enabled:!1,every:"30m"}}function rN(a,b){let c=rM(a),d="string"==typeof b?.every&&b.every.trim()&&"disabled"!==b.every?b.every.trim():c.every;return"boolean"==typeof b?.enabled?{enabled:b.enabled,every:d}:b?.every==="disabled"?{enabled:!1,every:d}:c}function rO(a,b,c){let d=rM(b);return a.enabled!==d.enabled||a.every!==d.every?a:rM(c)}function rP({snapshot:a,defaultWorkspaceId:b,onRefresh:c,onAgentCreated:d,trigger:e}){var f,g;let h,i,[j,k]=(0,E.useState)(!1),[l,m]=(0,E.useState)(!1),[n,o]=(0,E.useState)(!1),[p,q]=(0,E.useState)(!1),[r,s]=(0,E.useState)(!1),[t,u]=(0,E.useState)(()=>(function(a,b={}){let c=qB(b.policy?.preset??"worker",b.policy),d=qu[c.preset],e=rN(c.preset,b.heartbeat);return{id:b.id??"",workspaceId:a,modelId:b.modelId??"",name:b.name??d.defaultName,emoji:b.emoji??d.defaultEmoji,theme:b.theme??d.defaultTheme,avatar:b.avatar??"",policy:c,heartbeat:e}})(b??a.workspaces[0]?.id??"")),v=a.workspaces.find(a=>a.id===t.workspaceId)??a.workspaces[0]??null,w=(f=v?.slug,g=t.name||qu[t.policy.preset].defaultName,h=rU(f??""),i=rU(g)||"agent",h?`${h}-${i}`:i),x=rU(t.id),y=x.length>0?a.agents.find(a=>a.id===x)??null:null,z=y?a.workspaces.find(a=>a.id===y.workspaceId)?.name??y.workspacePath:null,A=!!(x&&t.workspaceId)&&!p&&null===y,B=n||"monitoring"===t.policy.preset,C=async()=>{if(x&&!y){q(!0);try{let a=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,id:x})}),b=await a.json();if(!a.ok||b.error||!b.agentId)throw Error(b.error||"OpenClaw could not create the agent.");ec.o.success("Agent created in OpenClaw.",{description:b.agentId}),m(!1),await c(),d?.(b.agentId)}catch(a){ec.o.error("Agent creation failed.",{description:a instanceof Error?a.message:"Unknown agent error."})}finally{q(!1)}}};return j?(0,D.jsxs)(dx,{open:l,onOpenChange:m,children:[(0,D.jsx)(dz,{asChild:!0,children:e}),(0,D.jsxs)(d_,{className:"max-h-[90vh] overflow-y-auto sm:max-w-3xl",children:[(0,D.jsxs)(d0,{children:[(0,D.jsx)(d2,{children:"Create a new OpenClaw agent"}),(0,D.jsx)(d3,{children:"This creates a real isolated agent bound to an existing workspace with a preset policy."})]}),(0,D.jsxs)("div",{className:"space-y-5",children:[(0,D.jsxs)("div",{className:"space-y-3",children:[(0,D.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:"Agent preset"}),(0,D.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:qw.map(a=>(0,D.jsx)(rR,{label:a.label,description:a.description,active:t.policy.preset===a.value,badgeVariant:qu[a.value].badgeVariant,onClick:()=>u(b=>{var c,d;let e,f,g;return c=b,d=a.value,e=qu[c.policy.preset],f=qu[d],g=qB(d),{...c,name:c.name&&c.name!==e.defaultName?c.name:f.defaultName,emoji:c.emoji&&c.emoji!==e.defaultEmoji?c.emoji:f.defaultEmoji,theme:c.theme&&c.theme!==e.defaultTheme?c.theme:f.defaultTheme,policy:g,heartbeat:rO(c.heartbeat,c.policy.preset,d)}})},a.value))})]}),(0,D.jsx)(rS,{policy:t.policy}),(0,D.jsxs)(rQ,{label:"Agent id",htmlFor:"create-agent-id",children:[(0,D.jsx)(br,{id:"create-agent-id",value:t.id,onChange:a=>{let b=a.target.value,c=rU(b);s(!!c&&c!==w),u(a=>({...a,id:b}))},placeholder:w||"workspace-agent"}),(0,D.jsx)("p",{className:bc("text-[12px]",y?"text-rose-300":"text-slate-500"),children:y?`ID "${x}" is already used by ${y.name} in ${z}.`:x&&x!==t.id.trim()?`Saved as ${x}. Suggested workspace-scoped id: ${w}.`:`Workspace-scoped id: ${w}.`})]}),(0,D.jsx)(rQ,{label:"Display name",htmlFor:"create-agent-name",children:(0,D.jsx)(br,{id:"create-agent-name",value:t.name,onChange:a=>u(b=>({...b,name:a.target.value})),placeholder:qu[t.policy.preset].defaultName})}),(0,D.jsx)(rQ,{label:"Workspace",htmlFor:"create-agent-workspace",children:(0,D.jsx)("select",{id:"create-agent-workspace",value:t.workspaceId,onChange:a=>u(b=>({...b,workspaceId:a.target.value})),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:a.workspaces.map(a=>(0,D.jsx)("option",{value:a.id,children:a.name},a.id))})}),(0,D.jsx)(rQ,{label:"Model",htmlFor:"create-agent-model",children:(0,D.jsxs)("select",{id:"create-agent-model",value:t.modelId,onChange:a=>u(b=>({...b,modelId:a.target.value})),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:[(0,D.jsx)("option",{value:"",children:"Use OpenClaw default"}),a.models.map(a=>(0,D.jsx)("option",{value:a.id,children:a.id},a.id))]})}),(0,D.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,D.jsx)(rQ,{label:"Emoji",htmlFor:"create-agent-emoji",children:(0,D.jsx)(br,{id:"create-agent-emoji",value:t.emoji,onChange:a=>u(b=>({...b,emoji:a.target.value})),placeholder:qu[t.policy.preset].defaultEmoji})}),(0,D.jsx)(rQ,{label:"Theme",htmlFor:"create-agent-theme",children:(0,D.jsx)(br,{id:"create-agent-theme",value:t.theme,onChange:a=>u(b=>({...b,theme:a.target.value})),placeholder:qu[t.policy.preset].defaultTheme})})]}),(0,D.jsx)(rQ,{label:"Avatar URL",htmlFor:"create-agent-avatar",children:(0,D.jsx)(br,{id:"create-agent-avatar",value:t.avatar,onChange:a=>u(b=>({...b,avatar:a.target.value})),placeholder:"https://example.com/avatar.png"})}),(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-white/[0.03] p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:"Advanced policy"}),(0,D.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"Override missing-tool behavior, install scope, file access, and network posture."})]}),(0,D.jsx)(bq,{type:"button",variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>o(a=>!a),children:n?"Hide":"Show"})]}),B?(0,D.jsxs)("div",{className:"mt-4 rounded-[18px] border border-white/10 bg-slate-950/40 p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:"Heartbeat"}),(0,D.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"Use this only for periodic watch or triage agents. Leave it off for normal task execution."})]}),(0,D.jsx)(bq,{type:"button",variant:t.heartbeat.enabled?"default":"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>u(a=>({...a,heartbeat:a.heartbeat.enabled?{...a.heartbeat,enabled:!1}:{...a.heartbeat,enabled:!0,every:a.heartbeat.every||rM(a.policy.preset).every}})),children:t.heartbeat.enabled?"On":"Off"})]}),t.heartbeat.enabled?(0,D.jsx)("div",{className:"mt-3",children:(0,D.jsx)(rQ,{label:"Interval",htmlFor:"create-agent-heartbeat-every",children:(0,D.jsx)("select",{id:"create-agent-heartbeat-every",value:t.heartbeat.every,onChange:a=>u(b=>({...b,heartbeat:{...b.heartbeat,every:a.target.value}})),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:rL.map(a=>(0,D.jsx)("option",{value:a.value,children:a.label},a.value))})})}):null]}):null,n?(0,D.jsxs)("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:[(0,D.jsx)(rT,{label:"Missing tool behavior",htmlFor:"create-agent-missing-tools",value:t.policy.missingToolBehavior,options:qx,onChange:a=>u(b=>({...b,policy:{...b.policy,missingToolBehavior:a}}))}),(0,D.jsx)(rT,{label:"Install scope",htmlFor:"create-agent-install-scope",value:t.policy.installScope,options:qy,onChange:a=>u(b=>({...b,policy:{...b.policy,installScope:a}}))}),(0,D.jsx)(rT,{label:"File access",htmlFor:"create-agent-file-access",value:t.policy.fileAccess,options:qz,onChange:a=>u(b=>({...b,policy:{...b.policy,fileAccess:a}}))}),(0,D.jsx)(rT,{label:"Network access",htmlFor:"create-agent-network-access",value:t.policy.networkAccess,options:qA,onChange:a=>u(b=>({...b,policy:{...b.policy,networkAccess:a}}))})]}):null]})]}),(0,D.jsxs)(d1,{children:[(0,D.jsx)(bq,{variant:"secondary",onClick:()=>m(!1),children:"Cancel"}),(0,D.jsx)(bq,{onClick:C,disabled:!A,children:p?"Creating...":"Create agent"})]})]})]}):(0,D.jsx)(D.Fragment,{children:e})}function rQ({label:a,htmlFor:b,children:c}){return(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)(rK,{htmlFor:b,className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:a}),c]})}function rR({label:a,description:b,active:c,badgeVariant:d,onClick:e}){return(0,D.jsx)("button",{type:"button",onClick:e,className:bc("rounded-[20px] border p-4 text-left transition-colors",c?"border-cyan-300/30 bg-cyan-400/10":"border-white/10 bg-white/[0.03]"),children:(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"space-y-1",children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:a}),(0,D.jsx)("p",{className:"text-xs leading-5 text-slate-400",children:b})]}),(0,D.jsx)(be,{variant:d,children:c?"selected":"preset"})]})})}function rS({policy:a}){let b=qu[a.preset];return(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-slate-950/50 p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:b.label}),(0,D.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:b.description})]}),(0,D.jsx)(be,{variant:b.badgeVariant,children:b.label})]}),(0,D.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,D.jsx)(be,{variant:"muted",children:qD(a.missingToolBehavior)}),(0,D.jsx)(be,{variant:"muted",children:qE(a.installScope)}),(0,D.jsx)(be,{variant:"muted",children:qF(a.fileAccess)}),(0,D.jsxs)(be,{variant:"muted",children:["Network ",qG(a.networkAccess)]})]})]})}function rT({label:a,htmlFor:b,value:c,options:d,onChange:e}){return(0,D.jsx)(rQ,{label:a,htmlFor:b,children:(0,D.jsx)("select",{id:b,value:c,onChange:a=>e(a.target.value),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:d.map(a=>(0,D.jsxs)("option",{value:a.value,children:[a.label," - ",a.description]},a.value))})})}function rU(a){return a.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}let rV=E.forwardRef(({className:a,...b},c)=>(0,D.jsx)("textarea",{className:bc("flex min-h-[96px] w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-3 text-sm text-white placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400/60 disabled:cursor-not-allowed disabled:opacity-50",a),ref:c,...b}));rV.displayName="Textarea";let rW="mission-control-recent-prompts";function rX({snapshot:a,activeWorkspaceId:b,selectedNodeId:c,composeIntent:d,onRefresh:e,onOpenWorkspaceCreate:f,onMissionDispatchStart:g,onMissionDispatchFailure:h,onMissionResponse:i}){var j,k;let l,m,[n,o]=(0,E.useState)(""),[p,q]=(0,E.useState)(""),[r,s]=(0,E.useState)("medium"),[t,u]=(0,E.useState)(!1),[v,w]=(0,E.useState)(!1),[x,y]=(0,E.useState)(!1),[z,A]=(0,E.useState)(!1),[B,C]=(0,E.useState)(!1),[F,G]=(0,E.useState)(!1),[H,I]=(0,E.useState)(null),J=(0,E.useRef)(null);(0,E.useRef)(null);let K=(0,E.useRef)(null);(0,E.useRef)(null);let L=(0,E.useRef)(!1);(0,E.useRef)(null);let M=a.workspaces.find(a=>a.id===b)??a.workspaces[0],O=a.agents.filter(a=>!M||a.workspaceId===M.id),P=O.find(a=>a.id===p)??O[0]??null,Q=P?.id??null,R=O.map(a=>({label:a.name,value:a.id})),S=(j=M?.id??b??null,k=Q,j||k?`mission-control-composer-draft:${j??"global"}:${k??"unassigned"}`:null),T=!!(n.trim()&&Q&&!t),U=P?`Compose for ${P.name}...`:"Compose a mission...",V=((l=[]).push({id:"workspace-create",label:"Create workspace",action:"open-workspace-create"}),m=new Set,l.filter(a=>{let b=`${a.action||"mission"}:${a.mission?.trim().toLowerCase()||a.label.toLowerCase()}`;return!m.has(b)&&(m.add(b),!0)}).slice(0,3)),W=V.length>0,X=B&&!F&&!z&&!x&&!t&&0===n.trim().length&&null===H,Y=async a=>{u(!0);let c=a.agentId||Q,d=Date.now(),f=globalThis.crypto?.randomUUID?.()||`dispatch:${d}`,j=new AbortController;c&&g({requestId:f,mission:a.mission.trim(),agentId:c,workspaceId:M?.id??b??null,submittedAt:d,abortController:j});try{let g=a.mission.trim(),h=await fetch("/api/mission",{method:"POST",headers:{"Content-Type":"application/json"},signal:j.signal,body:JSON.stringify(a)}),k=await h.json();if(!h.ok||k.error)throw Error(k.error||"OpenClaw rejected the mission.");i(k,{requestId:f}),o(""),I(null),y(!1),L.current=!0,S&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(S),c&&function(a){let b=[a,...(function(){try{let a=globalThis.localStorage.getItem(rW);if(!a)return[];let b=JSON.parse(a);if(!Array.isArray(b))return[];return b.filter(a=>"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.mission&&"string"==typeof a.agentId&&"string"==typeof a.agentName&&"number"==typeof a.submittedAt).slice(0,6)}catch{return[]}})().filter(b=>b.mission.trim()!==a.mission.trim()||b.agentId!==a.agentId||b.workspaceId!==a.workspaceId)].slice(0,6);try{globalThis.localStorage.setItem(rW,JSON.stringify(b))}catch{}}({id:globalThis.crypto?.randomUUID?.()||`${d}`,mission:g,agentId:c,agentName:P?.name??"Agent",workspaceId:M?.id??b,workspaceName:M?.name??null,submittedAt:d});let l="string"==typeof k.meta?.outputDirRelative?`${k.status} via ${k.agentId} \xb7 ${k.meta.outputDirRelative}`:`${k.status} via ${k.agentId}`;"stalled"===k.status?ec.o.error("Mission could not start.",{description:k.summary||l}):ec.o.success("Mission queued in OpenClaw.",{description:l}),e().catch(()=>null)}catch(a){if(a instanceof DOMException&&"AbortError"===a.name)return;h(f,a instanceof Error?a.message:"Unknown mission error."),ec.o.error("Mission dispatch failed.",{description:a instanceof Error?a.message:"Unknown mission error."})}finally{u(!1)}},Z=(a,b={})=>{b.thinking&&s(b.thinking),o(c=>{var d,e;let f,g;return"replace"===b.mode?a:(d=c,e=a,f=d.trim(),g=e.trim(),f?g?`${f}
14
14
 
15
- ${g}`:f:g)}),requestAnimationFrame(()=>{J.current?.focus();let a=J.current?.value??"";J.current?.setSelectionRange(a.length,a.length)})};return(0,D.jsx)("div",{className:bb("mx-auto w-full transition-[width] duration-300",X&&"lg:w-[360px]"),onMouseEnter:()=>{B&&G(!0)},onMouseLeave:()=>{B&&G(!1)},children:(0,D.jsx)(rw,{initial:!1,mode:"wait",children:X?(0,D.jsx)(pS.button,{type:"button",initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.98},onFocus:()=>G(!0),onClick:()=>{G(!0),requestAnimationFrame(()=>{J.current?.focus()})},className:"w-full overflow-hidden rounded-full border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] p-2 text-left shadow-[0_24px_72px_rgba(0,0,0,0.22)] isolate",children:(0,D.jsxs)("div",{className:"flex items-center gap-2 rounded-full border border-white/[0.07] bg-[linear-gradient(180deg,rgba(20,28,43,0.9),rgba(11,17,28,0.88))] px-3 py-2 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",children:[(0,D.jsx)("span",{className:"inline-flex h-7 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-2.5 text-[11px] text-slate-300",children:P?.name||"No agent"}),(0,D.jsx)("p",{className:"min-w-0 flex-1 truncate text-[13px] text-[#f6eee5]/58",children:U}),(0,D.jsxs)("span",{className:"inline-flex h-8 items-center rounded-full bg-white px-3 text-[12px] font-medium text-slate-950",children:[(0,D.jsx)(rl,{className:"mr-1.5 h-3.5 w-3.5"}),"Create task"]})]})},"collapsed"):(0,D.jsxs)(pS.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.985},className:"overflow-hidden rounded-[26px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] p-2.5 shadow-[0_24px_72px_rgba(0,0,0,0.26)] isolate",children:[(0,D.jsx)(rw,{initial:!1,children:H?(0,D.jsxs)(pS.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-[12px] text-slate-400",children:[(0,D.jsxs)("span",{className:"truncate",children:["From ",H.sourceLabel]}),(0,D.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>Z(H.mission,{mode:"replace"}),children:"Replace"}),(0,D.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>Z(H.mission),children:"Append"}),(0,D.jsx)("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center rounded-full text-slate-400 transition-colors hover:bg-white/[0.06] hover:text-white",onClick:()=>I(null),"aria-label":"Dismiss runtime suggestion",children:(0,D.jsx)(dY,{className:"h-3.5 w-3.5"})})]}):null}),(0,D.jsxs)("div",{className:bb("rounded-[22px] border border-white/[0.07] bg-[linear-gradient(180deg,rgba(20,28,43,0.92),rgba(10,16,26,0.9))] shadow-[inset_0_1px_0_rgba(255,255,255,0.04)] transition-all duration-200",z&&"border-white/[0.14] bg-[linear-gradient(180deg,rgba(24,34,50,0.94),rgba(12,18,30,0.92))] shadow-[inset_0_1px_0_rgba(255,255,255,0.06)]"),onFocusCapture:()=>A(!0),onBlurCapture:a=>{let b=a.relatedTarget;b instanceof Node&&a.currentTarget.contains(b)||A(!1)},children:[(0,D.jsxs)("div",{className:"flex items-center gap-2 px-2.5 pb-1 pt-2.5",children:[P?(0,D.jsx)(rO,{value:p,options:R,onChange:a=>{q(a)}}):(0,D.jsx)(rS,{children:"No agent"}),(0,D.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,D.jsx)(rQ,{label:"Refresh mission control",onClick:async()=>{w(!0),await e(),w(!1)},children:v?(0,D.jsx)(L,{className:"h-3.5 w-3.5 animate-spin"}):(0,D.jsx)(rm,{className:"h-3.5 w-3.5"})}),(0,D.jsx)(rQ,{label:"Create workspace",onClick:f,children:(0,D.jsx)(cl,{className:"h-3.5 w-3.5"})}),(0,D.jsx)(rQ,{label:"Composer settings",onClick:()=>y(a=>!a),active:x||"medium"!==r,children:(0,D.jsxs)("span",{className:"relative inline-flex",children:[(0,D.jsx)(rn,{className:"h-3.5 w-3.5"}),"medium"!==r?(0,D.jsx)("span",{className:"absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-white/80"}):null]})})]})]}),(0,D.jsx)("div",{className:"px-2.5 pt-0.5",children:(0,D.jsx)(rL,{ref:J,value:n,onChange:a=>o(a.target.value),onKeyDown:async a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&(a.preventDefault(),T&&Q&&await Y({mission:n,agentId:Q,workspaceId:b??void 0,thinking:r}))},placeholder:U,className:"min-h-[50px] max-h-[150px] resize-none overflow-y-auto border-0 bg-transparent px-0 py-0.5 text-[15px] leading-[1.6] text-white placeholder:text-[#f6eee5]/60 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"})}),(0,D.jsxs)("div",{className:"flex items-end justify-between gap-2.5 px-2.5 pb-2.5 pt-1.5",children:[(0,D.jsx)(rw,{initial:!1,children:W?(0,D.jsxs)(pS.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[V.map(a=>(0,D.jsx)(rR,{label:a.label,onClick:()=>{"open-workspace-create"===a.action?f():a.mission&&Z(a.mission,{thinking:a.thinking})}},a.id)),N?(0,D.jsx)(rF,{snapshot:a,defaultWorkspaceId:N.id,onRefresh:e,onAgentCreated:a=>{K.current=a,q(a)},trigger:(0,D.jsx)("button",{type:"button",className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300 transition-all hover:bg-white/[0.08] hover:text-white",children:"+ Create Agent"})}):null]}):(0,D.jsx)("div",{})}),(0,D.jsxs)(bp,{className:"h-9 rounded-full bg-white px-3.5 text-slate-950 shadow-none hover:bg-white/92",disabled:!T,onClick:async()=>{Q&&await Y({mission:n,agentId:Q,workspaceId:b??void 0,thinking:r})},children:[t?(0,D.jsx)(L,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,D.jsx)(rl,{className:"mr-1.5 h-3.5 w-3.5"}),"Create task"]})]})]}),(0,D.jsx)(rw,{initial:!1,children:x?(0,D.jsx)(pS.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},className:"mt-2 flex justify-end",children:(0,D.jsxs)("div",{className:"w-full max-w-[232px] rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(14,20,31,0.96),rgba(10,15,24,0.94))] p-3 shadow-[0_16px_32px_rgba(0,0,0,0.22)]",children:[(0,D.jsx)("p",{className:"text-[11px] text-slate-300",children:"Thinking"}),(0,D.jsx)("div",{className:"mt-2",children:(0,D.jsx)(rP,{ariaLabel:"Select thinking level",value:r,options:[{label:"off",value:"off"},{label:"minimal",value:"minimal"},{label:"low",value:"low"},{label:"medium",value:"medium"},{label:"high",value:"high"}],onChange:a=>s(a)})}),(0,D.jsx)("button",{type:"button",className:"mt-3 text-[12px] text-slate-400 transition-colors hover:text-white",onClick:()=>{o(""),s("medium"),I(null),M.current=!0,S&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(S)},children:"Clear draft"})]})}):null})]},"expanded")})})}function rO({value:a,options:b,onChange:c}){let d=b.find(b=>b.value===a)??b[0],e=b.length>1;return(0,D.jsxs)("div",{className:"relative inline-flex items-center rounded-full border border-white/[0.08] bg-white/[0.04] text-slate-100",children:[e?(0,D.jsx)("select",{"aria-label":"Select mission agent",value:d?.value??"",onChange:a=>c(a.target.value),className:"h-8 appearance-none bg-transparent pl-3 pr-8 text-[12px] outline-none",children:b.map(a=>(0,D.jsx)("option",{value:a.value,children:a.label},a.value))}):(0,D.jsx)("span",{className:"px-3 text-[12px]",children:d?.label||"No agent"}),e?(0,D.jsx)(T,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"}):null]})}function rP({ariaLabel:a,value:b,options:c,onChange:d}){let e=c.find(a=>a.value===b)??c[0];return(0,D.jsxs)("div",{className:"relative inline-flex w-full items-center rounded-full border border-white/[0.08] bg-white/[0.04] text-slate-100",children:[(0,D.jsx)("select",{"aria-label":a,value:e?.value??"",onChange:a=>d(a.target.value),className:"h-9 w-full appearance-none bg-transparent pl-3 pr-9 text-[12px] outline-none",children:c.map(a=>(0,D.jsx)("option",{value:a.value,children:a.label},a.value))}),(0,D.jsx)(T,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"})]})}function rQ({label:a,active:b=!1,onClick:c,children:d}){return(0,D.jsx)("button",{type:"button","aria-label":a,title:a,onClick:c,className:bb("inline-flex h-8 w-8 items-center justify-center rounded-full border border-transparent text-slate-400 transition-all hover:border-white/[0.08] hover:bg-white/[0.06] hover:text-white",b&&"border-white/[0.08] bg-white/[0.06] text-white"),children:d})}function rR({label:a,onClick:b}){return(0,D.jsx)("button",{type:"button",onClick:b,className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300 transition-all hover:bg-white/[0.08] hover:text-white",children:a})}function rS({children:a}){return(0,D.jsx)("div",{className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300",children:a})}let rT=K("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),rU=K("folder-git-2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]),rV=K("file-json",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),rW=K("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),rX=K("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),rY=K("radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]);function rZ(a){return(0,D.jsx)(r$,{...a},a.selectedNodeId??"overview")}function r$({snapshot:a,selectedNodeId:b,lastMission:c,onAbortTask:d,collapsed:e,onToggleCollapsed:f,activeTab:g,onActiveTabChange:h}){let i=a.workspaces.find(a=>a.id===b),j=a.agents.find(a=>a.id===b),k=a.tasks.find(a=>a.id===b),l=a.runtimes.find(a=>a.id===b),m=a.models.find(a=>a.id===b),n=!!k?.metadata.optimistic,o=i||j||k||l||m||null,p=l?.id??null,q=k?.id??null,[r,s]=(0,E.useState)(null),[t,u]=(0,E.useState)(null),[v,w]=(0,E.useState)(null),[x,y]=(0,E.useState)(null),z=(0,E.useMemo)(()=>{var a;let b;return n&&k?{task:a=k,runs:[],outputs:[],liveFeed:Array.isArray(b=a.metadata.optimisticEvents)?b.filter(r7).sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp)):[],createdFiles:[],warnings:"stalled"===a.status||r8(a)?[a.subtitle]:[],integrity:r6(a)}:null},[n,k]),A=r&&r.runtimeId===p?r:null,B=t?.runtimeId===p?t.message:null,C=v&&v.task.id===q?v:null,F=x?.taskId===q?x.message:null,G=z??C,H=!!q&&!n&&!G&&!F,I=!!p&&!A&&!B,J=!!(l||k),K=!!(l||k),L=("output"!==g||J)&&("files"!==g||K)?g:"overview",M=k?"Feed":"Output",N=i?.name||j?.name||k?.title||l?.title||m?.name||"Gateway overview",O=i?"workspace focus":j?"agent focus":k?"task focus":l?"run focus":m?"model focus":"live selection",P=(0,E.useMemo)(()=>[{id:"overview",label:"Overview",icon:rT,enabled:!0},{id:"output",label:M,icon:U,enabled:J},{id:"files",label:"Files",icon:rU,enabled:K},{id:"raw",label:"Raw",icon:rV,enabled:!0}],[M,K,J]);return(0,D.jsxs)("div",{className:"panel-surface panel-glow flex h-full flex-row-reverse overflow-hidden rounded-[30px] border border-white/[0.08] bg-[#04070e]/88 shadow-[0_28px_90px_rgba(0,0,0,0.42)] backdrop-blur-2xl",children:[(0,D.jsxs)("div",{className:bb("flex h-full shrink-0 flex-col items-center bg-[linear-gradient(180deg,rgba(7,10,18,0.98),rgba(3,6,12,0.98))] px-3 py-4",e?"w-full":"w-[78px] border-l border-white/[0.08]"),children:[(0,D.jsx)("button",{type:"button","aria-label":e?"Expand inspector":"Collapse inspector",onClick:f,className:"flex h-12 w-12 items-center justify-center rounded-[18px] border border-cyan-300/20 bg-cyan-400/[0.12] shadow-[0_10px_24px_rgba(34,211,238,0.18)] transition-all hover:border-cyan-200/30 hover:bg-cyan-400/[0.16]",children:(0,D.jsx)(U,{className:"h-5 w-5 text-cyan-200"})}),(0,D.jsx)("button",{type:"button","aria-label":e?"Expand inspector":"Collapse inspector",onClick:f,className:"mt-4 inline-flex h-11 w-11 items-center justify-center rounded-[16px] border border-white/10 bg-white/[0.04] text-slate-300 transition-all hover:border-cyan-300/18 hover:bg-white/[0.08] hover:text-white",children:e?(0,D.jsx)(rW,{className:"h-4 w-4"}):(0,D.jsx)(rX,{className:"h-4 w-4"})}),(0,D.jsx)("div",{className:"mt-6 flex flex-1 flex-col items-center gap-2",children:P.map(a=>(0,D.jsx)(sd,{icon:a.icon,label:a.label,active:L===a.id,disabled:!a.enabled,onClick:()=>{a.enabled&&(h(a.id),e&&f())}},a.id))}),(0,D.jsxs)("div",{className:"mt-4 flex flex-col items-center gap-2",children:[(0,D.jsx)(bd,{variant:"muted",children:o?"live":"idle"}),e?(0,D.jsx)("p",{className:"max-w-[56px] truncate text-center text-[9px] uppercase tracking-[0.16em] text-slate-500",children:O}):null]})]}),e?null:(0,D.jsx)("div",{className:"min-w-0 flex-1 bg-[linear-gradient(180deg,rgba(6,10,18,0.96),rgba(3,6,14,0.98))]",children:(0,D.jsxs)("div",{className:"mission-scroll flex h-full min-h-0 flex-col overflow-y-auto overscroll-contain",children:[(0,D.jsxs)("div",{className:"shrink-0 border-b border-white/[0.08] px-5 pb-4 pt-5",children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"text-[11px] uppercase tracking-[0.28em] text-slate-500",children:"Inspector"}),(0,D.jsx)("h2",{className:"mt-2 font-display text-[1.38rem] leading-tight text-white",children:N}),(0,D.jsx)("p",{className:"mt-2 text-[12px] leading-5 text-slate-400",children:o?"Live OpenClaw-backed details for the selected entity.":"Local gateway health, recent presence, and last mission response."})]}),(0,D.jsx)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.04] p-2.5 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]",children:(0,D.jsx)(U,{className:"h-4 w-4 text-cyan-200"})})]}),(0,D.jsxs)("div",{className:"mt-4 rounded-[22px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(13,20,34,0.98),rgba(6,10,18,0.96))] p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Selected entity"}),(0,D.jsx)("p",{className:"mt-1.5 text-[14px] text-white",children:N})]}),(0,D.jsx)(bd,{variant:"muted",children:O})]}),k?(0,D.jsxs)("p",{className:"mt-3 text-[12px] leading-5 text-slate-400",children:[k.runtimeCount," runs \xb7 ",k.liveRunCount," live \xb7 ",qP(k.updatedAt)]}):null,l?(0,D.jsxs)("p",{className:"mt-3 text-[12px] leading-5 text-slate-400",children:["Run ",qU(l.runId||l.id,10)," \xb7 ",l.status," \xb7 ",qP(l.updatedAt)]}):null]}),(0,D.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:P.filter(a=>a.enabled).map(a=>(0,D.jsx)(se,{label:a.label,active:L===a.id,onClick:()=>h(a.id)},a.id))})]}),(0,D.jsx)("div",{className:"flex-1 p-4",children:(0,D.jsx)(rw,{mode:"wait",children:(0,D.jsxs)(pS.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},className:"space-y-3.5",children:["overview"===L?(0,D.jsxs)(D.Fragment,{children:[i?(0,D.jsx)(r0,{snapshot:a,workspaceId:i.id}):null,j?(0,D.jsx)(r1,{snapshot:a,agentId:j.id}):null,k?(0,D.jsx)(r2,{snapshot:a,task:k,taskId:k.id,taskDetail:G,taskDetailLoading:H,taskDetailError:F,onAbortTask:d}):null,l?(0,D.jsx)(r9,{snapshot:a,runtimeId:l.id,runtimeOutput:A,runtimeOutputLoading:I,runtimeOutputError:B}):null,m?(0,D.jsx)(sc,{snapshot:a,modelId:m.id}):null,o?null:(0,D.jsx)(r_,{snapshot:a,lastMission:c})]}):null,"output"===L&&k?(0,D.jsx)(r4,{task:k,taskDetail:G,taskDetailLoading:H,taskDetailError:F}):null,"output"===L&&l?(0,D.jsx)(sb,{runtime:l,runtimeOutput:A,runtimeOutputLoading:I,runtimeOutputError:B}):null,"files"===L&&k?(0,D.jsx)(r5,{snapshot:a,task:k,taskDetail:G}):null,"files"===L&&l?(0,D.jsx)(sa,{runtime:l,runtimeOutput:A}):null,"raw"===L?(0,D.jsx)("pre",{className:"overflow-x-auto rounded-[18px] border border-white/[0.08] bg-slate-950/[0.72] p-3 text-[11px] leading-5 text-slate-300",children:JSON.stringify(k&&G?G:l&&A?{runtime:l,output:A}:o||a,null,2)}):null]},`${b||"overview"}:${L}`)})}),(0,D.jsx)("div",{className:"shrink-0 border-t border-white/[0.08] p-4",children:(0,D.jsx)("div",{className:"rounded-[22px] border border-cyan-300/10 bg-[linear-gradient(180deg,rgba(7,22,31,0.95),rgba(5,13,22,0.95))] p-4 shadow-[0_16px_40px_rgba(0,0,0,0.22)]",children:(0,D.jsxs)("div",{className:"flex items-center gap-3",children:[(0,D.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-full border border-cyan-300/15 bg-cyan-400/[0.12] text-cyan-200",children:(0,D.jsx)(rY,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:N}),(0,D.jsx)("p",{className:"mt-1 text-[12px] text-slate-400",children:k?`${G?.liveFeed.length??0} live feed events`:l?`${A?.items.length??0} transcript entries`:j?`${j.activeRuntimeIds.length} tracked runs`:i?`${i.agentIds.length} agents attached`:`${a.presence.length} live beacons`})]})]})})})]})})]})}function r_({snapshot:a,lastMission:b}){let c=a.diagnostics.runtime.stateWritable&&a.diagnostics.runtime.sessionStoreWritable?"passed"===a.diagnostics.runtime.smokeTest.status?"verified":"pending smoke test":"attention";return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(sf,{icon:rY,title:"Gateway health",value:a.diagnostics.health,children:[(0,D.jsx)("p",{children:a.diagnostics.gatewayUrl}),(0,D.jsx)("p",{children:a.diagnostics.dashboardUrl})]}),(0,D.jsxs)(sf,{icon:rU,title:"Runtime preflight",value:c,children:[(0,D.jsx)("p",{className:"font-mono text-xs text-slate-400",children:a.diagnostics.runtime.stateRoot}),(0,D.jsx)("p",{children:a.diagnostics.runtime.sessionStores.length>0?`${a.diagnostics.runtime.sessionStores.filter(a=>a.writable).length}/${a.diagnostics.runtime.sessionStores.length} session stores writable`:"No agent session stores have been probed yet."}),a.diagnostics.runtime.smokeTest.checkedAt?(0,D.jsxs)("p",{children:["Smoke test ",a.diagnostics.runtime.smokeTest.status," \xb7"," ",a.diagnostics.runtime.smokeTest.agentId||"unknown agent"," \xb7"," ",qP(Date.parse(a.diagnostics.runtime.smokeTest.checkedAt))]}):(0,D.jsx)("p",{children:"No runtime smoke test has been recorded yet."}),a.diagnostics.runtime.issues[0]?(0,D.jsx)("div",{className:"rounded-[14px] border border-amber-400/15 bg-amber-400/8 px-3 py-2 text-[13px] text-amber-50",children:a.diagnostics.runtime.issues[0]}):null]}),(0,D.jsxs)(sf,{icon:U,title:"Presence beacons",value:String(a.presence.length),children:[0===a.presence.length?(0,D.jsx)("p",{children:"No live presence payloads."}):null,a.presence.map(a=>(0,D.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,D.jsx)("div",{className:"text-[13px] text-white",children:a.host}),(0,D.jsxs)("div",{className:"mt-1 text-xs text-slate-400",children:[a.ip," \xb7 ",a.platform," \xb7 ",a.version]})]},a.ts))]}),b?(0,D.jsxs)(sf,{icon:cn,title:"Last mission",value:b.status,children:[(0,D.jsx)("p",{className:"text-sm text-white",children:b.summary}),(0,D.jsx)("p",{className:"font-mono text-xs text-slate-500",children:b.runId?`Run ${b.runId}`:`Dispatch ${b.dispatchId??"pending"}`}),"string"==typeof b.meta?.outputDirRelative?(0,D.jsx)("p",{className:"font-mono text-xs text-slate-400",children:b.meta.outputDirRelative}):null,b.payloads[0]?.text?(0,D.jsx)("div",{className:"rounded-[14px] border border-cyan-400/15 bg-cyan-400/8 px-3 py-2 text-[13px] text-cyan-50",children:b.payloads[0].text}):null]}):null]})}function r0({snapshot:a,workspaceId:b}){let c=a.workspaces.find(a=>a.id===b),d=a.agents.filter(a=>a.workspaceId===b),e=c?c.modelIds.map(b=>a.models.find(a=>a.id===b)?.name||b):[],f=a.runtimes.filter(a=>a.workspaceId===b||c?.activeRuntimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0));if(!c)return null;let g=f.filter(a=>"running"===a.status||"queued"===a.status||"idle"===a.status),h=f[0]??null,i=sm(f.flatMap(sl)).slice(0,8),j=c.bootstrap.coreFiles.every(a=>a.present)&&c.bootstrap.projectShell.every(a=>a.present)?"ready":c.bootstrap.coreFiles.some(a=>a.present)||c.bootstrap.projectShell.some(a=>a.present)?"partial":"thin",k=Array.from(new Set(d.flatMap(a=>a.observedTools??[]))),l=0===d.length?"no agents":c.capabilities.workspaceOnlyAgentCount===d.length?"workspace-only":0===c.capabilities.workspaceOnlyAgentCount?"open":"mixed";return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(sf,{icon:rU,title:"Overview",value:c.health,children:[(0,D.jsx)("p",{className:"font-mono text-xs text-slate-400",children:qV(c.path)}),(0,D.jsx)(sh,{items:[{label:"Agents",value:String(d.length)},{label:"Models",value:String(c.modelIds.length)},{label:"Runs",value:String(f.length)},{label:"Sessions",value:String(c.totalSessions)}]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Models"}),(0,D.jsx)(sj,{emptyLabel:"No models attached",items:e,emptyVariant:"muted",itemVariant:"muted"})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Team"}),(0,D.jsx)("div",{className:"flex flex-wrap gap-2",children:d.map(a=>(0,D.jsx)(bd,{variant:a.isDefault?"default":"muted",children:a.name},a.id))})]})]}),(0,D.jsxs)(sf,{icon:cn,title:"Bootstrap",value:j,children:[(0,D.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,D.jsx)(bd,{variant:c.bootstrap.template?"default":"muted",children:c.bootstrap.template||"template unknown"}),(0,D.jsx)(bd,{variant:c.bootstrap.sourceMode?"muted":"warning",children:c.bootstrap.sourceMode||"source unknown"}),c.bootstrap.agentTemplate?(0,D.jsx)(bd,{variant:"muted",children:c.bootstrap.agentTemplate}):null]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Core files"}),(0,D.jsx)(si,{items:c.bootstrap.coreFiles,missingVariant:"warning"})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Optional scaffold"}),(0,D.jsx)(si,{items:[...c.bootstrap.optionalFiles,...c.bootstrap.folders]})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Project shell"}),(0,D.jsx)(si,{items:c.bootstrap.projectShell})]})]}),(0,D.jsxs)(sf,{icon:cn,title:"Capabilities",value:l,children:[(0,D.jsxs)("p",{children:[c.capabilities.workspaceOnlyAgentCount,"/",d.length," agents are configured with"," ",(0,D.jsx)("span",{className:"font-mono text-xs text-slate-300",children:"fs.workspaceOnly"}),"."]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Skills"}),(0,D.jsx)(sj,{emptyLabel:"No explicit skills",items:c.capabilities.skills,emptyVariant:"muted",itemVariant:"muted"})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Local workspace skills"}),(0,D.jsx)(sj,{emptyLabel:"No local SKILL.md scaffolds",items:c.bootstrap.localSkillIds,emptyVariant:"muted",itemVariant:"success"})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,D.jsx)(sj,{emptyLabel:"No explicit tools configured",items:c.capabilities.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,D.jsx)(sj,{emptyLabel:"No runtime tool calls recovered yet",items:k,emptyVariant:"muted",itemVariant:"default"})]})]}),(0,D.jsxs)(sf,{icon:U,title:"Activity",value:`${g.length} live`,children:[(0,D.jsxs)("p",{children:[f.length," tracked runs across ",c.totalSessions," recorded sessions."]}),(0,D.jsx)("p",{children:h?`Latest update ${qP(h.updatedAt)}`:"No runtime activity has been recorded yet."}),f.length>0?(0,D.jsx)("div",{className:"space-y-2 pt-1",children:f.slice(0,3).map(a=>(0,D.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate text-[13px] text-white",children:a.title}),(0,D.jsxs)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:[a.subtitle," \xb7 ",qU(a.runId||a.id,10)]})]}),(0,D.jsx)(bd,{variant:qT(a.status),children:a.status})]},a.id))}):null,(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Agent posture"}),(0,D.jsx)("div",{className:"space-y-2",children:d.map(a=>(0,D.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate text-[13px] text-white",children:a.name}),(0,D.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.currentAction})]}),(0,D.jsx)(bd,{variant:"engaged"===a.status?"default":"offline"===a.status?"danger":"muted",children:a.status})]},a.id))})]})]}),(0,D.jsx)(sf,{icon:rV,title:"Created files",value:String(i.length),children:(0,D.jsx)(sg,{files:i,emptyLabel:"No file artifacts have been detected in recent workspace runs."})})]})}function r1({snapshot:a,agentId:b}){let c=a.agents.find(a=>a.id===b),d=a.workspaces.find(a=>a.id===c?.workspaceId),e=a.models.find(a=>a.id===c?.modelId),f=c?.observedTools??[],g=a.runtimes.filter(a=>c?.activeRuntimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),h=sm(g.flatMap(sl)).slice(0,8);return c?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(sf,{icon:cn,title:"Agent identity",value:c.id,children:[(0,D.jsx)("p",{children:c.name}),(0,D.jsx)("p",{children:c.identity.emoji?`${c.identity.emoji} \xb7 ${c.identity.theme??"theme unset"}`:"No identity emoji"}),(0,D.jsxs)("div",{className:"flex flex-wrap gap-2",children:[c.isDefault?(0,D.jsx)(bd,{variant:"default",children:"default agent"}):null,(0,D.jsx)(bd,{variant:qr[c.policy.preset].badgeVariant,children:qz(c.policy.preset)}),c.identity.source?(0,D.jsx)(bd,{variant:"muted",children:c.identity.source}):null]})]}),(0,D.jsxs)(sf,{icon:rU,title:"Workspace",value:d?.name||"n/a",children:[(0,D.jsx)("p",{className:"font-mono text-xs text-slate-400",children:qV(c.workspacePath)}),(0,D.jsxs)("p",{children:[c.sessionCount," recorded sessions"]})]}),(0,D.jsxs)(sf,{icon:cn,title:"Model assignment",value:e?.name||c.modelId,children:[(0,D.jsx)("p",{children:e?`${e.provider} \xb7 ${qQ(e.contextWindow)} ctx`:"Model metadata unavailable"}),(0,D.jsx)("p",{children:e?.available===!1?"Currently unavailable":e?.local?"Local model route":"Remote model route"})]}),(0,D.jsxs)(sf,{icon:cn,title:"Agent profile",value:c.profile.purpose||"Profile not declared",children:[(0,D.jsx)("p",{children:c.profile.purpose||"No explicit purpose was found in the workspace bootstrap files."}),(0,D.jsx)("div",{className:"flex flex-wrap gap-2",children:c.profile.sourceFiles.length>0?c.profile.sourceFiles.map(a=>(0,D.jsx)(bd,{variant:"muted",children:a},a)):(0,D.jsx)(bd,{variant:"warning",children:"derived from config"})})]}),(0,D.jsx)(sf,{icon:U,title:"Operating style",value:`${c.profile.operatingInstructions.length} rules`,children:(0,D.jsxs)("div",{className:"space-y-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Operating instructions"}),(0,D.jsx)(sk,{emptyLabel:"No workspace bootstrap instructions were found.",items:c.profile.operatingInstructions})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Response style"}),(0,D.jsx)(sj,{emptyLabel:"No explicit response style",items:c.profile.responseStyle,emptyVariant:"muted",itemVariant:"muted"})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-1 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Output preference"}),(0,D.jsx)("p",{children:c.profile.outputPreference||"No explicit output preference was found."})]})]})}),(0,D.jsxs)(sf,{icon:rY,title:"Runtime posture",value:c.status,children:[(0,D.jsx)("p",{children:c.currentAction}),(0,D.jsxs)("p",{children:["Last active ",qP(c.lastActiveAt)]}),(0,D.jsx)("p",{children:c.heartbeat.enabled?`Heartbeat ${c.heartbeat.every}`:"Heartbeat disabled"}),(0,D.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,D.jsx)(bd,{variant:c.heartbeat.enabled?"success":"muted",children:c.heartbeat.enabled?"heartbeat on":"heartbeat off"}),"number"==typeof c.heartbeat.everyMs?(0,D.jsxs)(bd,{variant:"muted",children:[Math.round(c.heartbeat.everyMs/1e3),"s interval"]}):null]})]}),(0,D.jsxs)(sf,{icon:U,title:"Operating policy",value:qz(c.policy.preset),children:[(0,D.jsx)("p",{children:qr[c.policy.preset].description}),(0,D.jsxs)("div",{className:"mt-3 grid gap-2 text-[13px] text-slate-300",children:[(0,D.jsxs)("p",{children:["Missing tools: ",(0,D.jsx)("span",{className:"text-white",children:qA(c.policy.missingToolBehavior)})]}),(0,D.jsxs)("p",{children:["Install scope: ",(0,D.jsx)("span",{className:"text-white",children:qB(c.policy.installScope)})]}),(0,D.jsxs)("p",{children:["File access: ",(0,D.jsx)("span",{className:"text-white",children:qC(c.policy.fileAccess)})]}),(0,D.jsxs)("p",{children:["Network: ",(0,D.jsx)("span",{className:"text-white",children:qD(c.policy.networkAccess)})]})]})]}),(0,D.jsxs)(sf,{icon:U,title:"Run history",value:String(g.length),children:[0===g.length?(0,D.jsx)("p",{children:"No runtime history has been recorded for this agent yet."}):null,g.map(a=>(0,D.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate text-[13px] text-white",children:a.title}),(0,D.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.subtitle})]}),(0,D.jsx)(bd,{variant:qT(a.status),children:a.status})]},a.id))]}),(0,D.jsx)(sf,{icon:rV,title:"Created files",value:String(h.length),children:(0,D.jsx)(sg,{files:h,emptyLabel:"No file artifacts have been detected for this agent yet."})}),(0,D.jsxs)(sf,{icon:cn,title:"Capabilities",value:`${c.skills.length} skills`,children:[(0,D.jsx)(sj,{emptyLabel:"No explicit skills",items:c.skills,emptyVariant:"muted",itemVariant:"muted"}),(0,D.jsxs)("div",{className:"pt-1",children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,D.jsx)(sj,{emptyLabel:"No explicit tools configured",items:c.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,D.jsxs)("div",{className:"pt-1",children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,D.jsx)(sj,{emptyLabel:"No runtime tool calls recovered yet",items:f,emptyVariant:"muted",itemVariant:"default"})]})]})]}):null}function r2({snapshot:a,task:b,taskId:c,taskDetail:d,taskDetailLoading:e,taskDetailError:f,onAbortTask:g}){let h=a.tasks.find(a=>a.id===c)??b,i=r8(h),j=!!g&&function(a){if(r8(a))return!1;let b=a.status;return"running"===b||"queued"===b}(h),k=a.workspaces.find(a=>a.id===b?.workspaceId),l=a.agents.find(a=>a.id===b?.primaryAgentId),m=d?.runs??a.runtimes.filter(a=>b?.runtimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),n=d?.createdFiles??sm(m.flatMap(a=>sl(a))),o=d?.warnings??[];if(!b)return null;let p=d?.integrity??r6(b);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(sf,{icon:rU,title:"Task overview",value:i?"aborted":h.status,children:[(0,D.jsx)("p",{className:"text-sm text-white",children:h.mission||h.title}),(0,D.jsx)("p",{children:h.subtitle}),(0,D.jsx)(sh,{items:[{label:"Runs",value:String(h.runtimeCount)},{label:"Feed",value:String(h.updateCount)},{label:"Files",value:String(h.artifactCount)},{label:"Live",value:String(h.liveRunCount)}]}),g&&(j||i)?(0,D.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,D.jsxs)(bp,{type:"button",variant:i?"secondary":"destructive",size:"sm",disabled:!j,className:"gap-2",onClick:()=>{j&&g(h)},children:[(0,D.jsx)(N,{className:"h-3.5 w-3.5"}),i?"Aborted":"Abort task"]})}):null,(0,D.jsxs)("div",{className:"flex flex-wrap gap-2",children:[k?(0,D.jsx)(bd,{variant:"muted",children:k.name}):null,l?(0,D.jsx)(bd,{variant:"default",children:l.name}):null,h.dispatchId?(0,D.jsxs)(bd,{variant:"muted",children:["dispatch ",qU(h.dispatchId,8)]}):null,i?(0,D.jsx)(bd,{variant:"danger",children:"aborted"}):null]}),e&&!d?(0,D.jsx)("p",{children:"Connecting live task feed…"}):null,f?(0,D.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:f}):null]}),(0,D.jsx)(r3,{task:h,integrity:p}),(0,D.jsxs)(sf,{icon:U,title:"Runs",value:String(m.length),children:[0===m.length?(0,D.jsx)("p",{children:"No OpenClaw runs have been grouped into this task yet."}):null,(0,D.jsx)("div",{className:"space-y-2",children:m.map(a=>(0,D.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate text-[13px] text-white",children:a.title}),(0,D.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.subtitle})]}),(0,D.jsx)(bd,{variant:qT(a.status),children:a.status})]},a.id))})]}),(0,D.jsx)(sf,{icon:rV,title:"Artifacts",value:String(n.length),children:(0,D.jsx)(sg,{files:n,emptyLabel:"This task has not produced a detectable file artifact yet."})}),o.length>0?(0,D.jsx)(sf,{icon:rY,title:"Warnings",value:String(o.length),children:(0,D.jsx)(sk,{items:o,emptyLabel:"No warnings detected."})}):null]})}function r3({task:a,integrity:b}){let c=r8(a),d=b.issues.find(a=>"partial-final-response"===a.id),e=c?"This task was aborted by an operator. Captured evidence may be incomplete.":"verified"===b.status?"Mission Control found a matching transcript and the captured result looks internally consistent.":b.sessionMismatch?"The linked transcript belongs to a different mission or stale session, so this completion cannot be trusted yet.":b.issues.some(a=>"empty-output-dir"===a.id)?"The task is marked completed, but the expected deliverables are missing from the output folder.":"error"===b.status?"The captured evidence does not line up with the requested mission.":"Mission Control recovered partial evidence, but this result still needs operator review.";return(0,D.jsxs)(sf,{icon:rY,title:"Result integrity",value:c?"aborted":"stalled"===a.status?"stalled":b.status,children:[(0,D.jsx)("p",{children:e}),(0,D.jsx)(sh,{items:[{label:"Output files",value:String(b.outputFileCount)},{label:"Transcript turns",value:String(b.transcriptTurnCount)},{label:"Matched turns",value:String(b.matchingTranscriptTurnCount)},{label:"Tools",value:String(b.toolNames.length)},{label:"Emails",value:String(b.emails.length)}]}),b.outputDir||b.outputDirRelative?(0,D.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Output folder"}),(0,D.jsx)("div",{className:"mt-2",children:(0,D.jsx)(q8,{text:b.outputDirRelative||b.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:b.outputDir,displayPath:b.outputDirRelative||b.outputDir})}),(0,D.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:b.outputDirExists?`${b.outputFileCount} file${1===b.outputFileCount?"":"s"} detected in the folder.`:"The output folder is not currently accessible."})]}):null,(0,D.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,D.jsxs)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:["Final response ","none"!==b.finalResponseSource?`(${b.finalResponseSource})`:""]}),d?(0,D.jsx)("p",{className:"mt-2 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:d.detail}):null,(0,D.jsx)("div",{className:"mt-2",children:b.finalResponseText?(0,D.jsx)(q8,{text:b.finalResponseText,className:"text-[12.5px] leading-5 text-slate-100"}):(0,D.jsx)("p",{className:"text-[12.5px] leading-5 text-slate-400",children:"No final response was captured."})})]}),(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Recovered tools"}),b.toolNames.length>0?(0,D.jsx)("div",{className:"flex flex-wrap gap-2",children:b.toolNames.map(a=>(0,D.jsx)(bd,{variant:"muted",children:a},a))}):(0,D.jsx)("p",{children:"No tool calls were recovered from a matching transcript turn."})]}),(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Detected emails"}),b.emails.length>0?(0,D.jsx)("div",{className:"flex flex-wrap gap-2",children:b.emails.map(a=>(0,D.jsx)(bd,{variant:"muted",children:a},a))}):(0,D.jsx)("p",{children:"No email addresses were detected in the captured result."})]}),b.dispatchSessionId?(0,D.jsxs)("p",{className:"font-mono text-xs text-slate-400",children:["session ",qU(b.dispatchSessionId,12),b.sessionMismatch?" \xb7 mismatch detected":""]}):null,b.issues.length>0?(0,D.jsxs)("div",{className:"rounded-[14px] border border-amber-400/16 bg-amber-400/[0.06] px-3 py-2.5",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-amber-100/80",children:"Review issues"}),(0,D.jsx)("div",{className:"mt-2",children:(0,D.jsx)(sk,{items:b.issues.map(a=>`${a.title}: ${a.detail}`),emptyLabel:"No integrity issues detected."})})]}):null]})}function r4({task:a,taskDetail:b,taskDetailLoading:c,taskDetailError:d}){if(c&&!b)return(0,D.jsx)(sf,{icon:U,title:"Live feed",value:"connecting",children:(0,D.jsxs)("p",{children:["Connecting to the task feed for ",a.title,"…"]})});if(d&&!b)return(0,D.jsx)(sf,{icon:U,title:"Live feed",value:"error",children:(0,D.jsx)("p",{children:d})});let e=b?.liveFeed??[],f=b?.integrity??r6(a);return(0,D.jsxs)(sf,{icon:U,title:"Live feed",value:String(e.length),children:[d?(0,D.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:d}):null,f.issues.length>0?(0,D.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:f.issues[0]?.detail}):null,0===e.length?(0,D.jsx)("p",{children:"No streamed task events have arrived yet."}):null,(0,D.jsx)("div",{className:"space-y-2",children:e.map(a=>(0,D.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2.5",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,D.jsx)(bd,{variant:function(a,b){if(b)return"danger";switch(a){case"assistant":return"default";case"tool":case"warning":return"warning";case"artifact":return"success";default:return"muted"}}(a.kind,a.isError),children:a.kind}),(0,D.jsx)("p",{className:"truncate text-[12px] text-white",children:a.title})]}),(0,D.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:qP(new Date(a.timestamp).getTime())})]}),(0,D.jsx)("div",{className:"mt-2",children:(0,D.jsx)(q8,{text:a.detail,className:"text-[12.5px] leading-5 text-slate-100",url:a.url,filePath:a.filePath,displayPath:a.displayPath})})]},a.id))})]})}function r5({snapshot:a,task:b,taskDetail:c}){let d=c?.runs??a.runtimes.filter(a=>b.runtimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),e=c?.createdFiles??sm(d.flatMap(a=>sl(a))),f=c?.integrity??r6(b);return(0,D.jsxs)(sf,{icon:rV,title:"Files",value:String(e.length),children:[(0,D.jsxs)("p",{children:[d.length," run",1===d.length?"":"s"," contributed to this task."]}),f.outputDir||f.outputDirRelative?(0,D.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Output folder"}),(0,D.jsx)("div",{className:"mt-2",children:(0,D.jsx)(q8,{text:f.outputDirRelative||f.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:f.outputDir,displayPath:f.outputDirRelative||f.outputDir})}),(0,D.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:f.outputDirExists?`${f.outputFileCount} file${1===f.outputFileCount?"":"s"} detected in the folder.`:"The output folder is not currently accessible."})]}):null,(0,D.jsx)(sg,{files:e,emptyLabel:"This task has not produced a detectable file artifact yet."})]})}function r6(a){let b=r8(a)?[{id:"task-cancelled",severity:"warning",title:"Task was cancelled by the operator",detail:"The mission dispatch was stopped before completion, so the captured evidence is intentionally incomplete."}]:"stalled"===a.status?[{id:"stalled-dispatch",severity:"warning",title:"Dispatch stalled before evidence was captured",detail:a.subtitle}]:a.metadata.optimistic?[{id:"pending-evidence",severity:"warning",title:"Waiting for runtime evidence",detail:"Mission Control will attach transcript, tool, and file evidence after the first runtime is observed."}]:[];return{status:b.some(a=>"error"===a.severity)?"error":b.length>0?"warning":"verified",outputDir:"string"==typeof a.metadata.outputDir&&a.metadata.outputDir.trim().length>0?a.metadata.outputDir:null,outputDirRelative:"string"==typeof a.metadata.outputDirRelative&&a.metadata.outputDirRelative.trim().length>0?a.metadata.outputDirRelative:null,outputDirExists:!1,outputFileCount:0,transcriptTurnCount:0,matchingTranscriptTurnCount:0,finalResponseText:null,finalResponseSource:"none",dispatchSessionId:null,sessionMismatch:!1,toolNames:[],emails:[],issues:b}}function r7(a){return"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.kind&&"string"==typeof a.timestamp&&"string"==typeof a.title&&"string"==typeof a.detail}function r8(a){let b="string"==typeof a.metadata.dispatchStatus?a.metadata.dispatchStatus:null,c=a.status;return"cancelled"===b||"aborted"===b||"cancelled"===c||"aborted"===c}function r9({snapshot:a,runtimeId:b,runtimeOutput:c,runtimeOutputLoading:d,runtimeOutputError:e}){let f,g=a.runtimes.find(a=>a.id===b),h=sm(c?.createdFiles??(g?sl(g):[])),i=c?.warnings??(g&&Array.isArray(f=g.metadata.warnings)?f.filter(a=>"string"==typeof a&&a.trim().length>0):[]),j=c?.warningSummary??i[0]??null;return g?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(sf,{icon:U,title:"Runtime key",value:g.status,children:[(0,D.jsx)("p",{className:"font-mono text-xs text-slate-400",children:g.key}),(0,D.jsxs)("p",{children:["Session ",qU(g.sessionId,12)]}),g.taskId?(0,D.jsxs)("p",{children:["Task ",qU(g.taskId,12)]}):null,g.runId?(0,D.jsxs)("p",{children:["Run ",qU(g.runId,12)]}):null]}),(0,D.jsxs)(sf,{icon:rY,title:"Activity",value:qP(g.updatedAt),children:[(0,D.jsx)("p",{children:g.subtitle}),(0,D.jsxs)("p",{children:[qR(g.tokenUsage?.total)," tokens"]})]}),(0,D.jsxs)(sf,{icon:cn,title:"Latest output",value:c?.stopReason||(d?"loading":"no transcript"),children:[d?(0,D.jsx)("p",{children:"Loading transcript output…"}):null,e?(0,D.jsx)("p",{children:e}):null,d||e?null:(0,D.jsx)(q8,{text:c?.finalText||c?.errorMessage||"No assistant output has been recorded for this runtime yet.",className:"text-[13px] leading-5 text-slate-100"}),j?(0,D.jsxs)("p",{className:"mt-3 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:["Fallback used: ",j]}):null,c?.finalTimestamp?(0,D.jsxs)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:["Updated ",qP(new Date(c.finalTimestamp).getTime())]}):null]}),(0,D.jsx)(sf,{icon:rV,title:"Created files",value:String(h.length),children:(0,D.jsx)(sg,{files:h,emptyLabel:"This runtime has not produced a detectable file artifact."})})]}):null}function sa({runtime:a,runtimeOutput:b}){let c=sm(b?.createdFiles??sl(a));return(0,D.jsxs)(sf,{icon:rV,title:"Files",value:String(c.length),children:[(0,D.jsx)("p",{children:a.title}),(0,D.jsx)(sg,{files:c,emptyLabel:"This runtime has not produced a detectable file artifact."})]})}function sb({runtime:a,runtimeOutput:b,runtimeOutputLoading:c,runtimeOutputError:d}){return c?(0,D.jsx)(sf,{icon:U,title:"Runtime output",value:"loading",children:(0,D.jsxs)("p",{children:["Loading transcript output for ",a.title,"…"]})}):d?(0,D.jsx)(sf,{icon:U,title:"Runtime output",value:"error",children:(0,D.jsx)("p",{children:d})}):b?(0,D.jsxs)("div",{className:"space-y-3.5",children:[b.warningSummary?(0,D.jsx)(sf,{icon:rY,title:"Warnings",value:String(b.warnings.length),children:(0,D.jsx)("p",{children:b.warningSummary})}):null,(0,D.jsx)(sf,{icon:rV,title:"Created files",value:String(b.createdFiles.length),children:(0,D.jsx)(sg,{files:b.createdFiles,emptyLabel:"This runtime transcript does not include a successful file creation."})}),(0,D.jsxs)(sf,{icon:U,title:"Final response",value:"stalled"===a.status||"cancelled"===a.status?a.status:b.stopReason||b.status,children:["stalled"===a.status||"cancelled"===a.status?(0,D.jsx)("p",{className:"mb-2 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:"This runtime did not complete cleanly. The text below is the last captured assistant output, not a verified completion."}):null,b.errorMessage?(0,D.jsx)("p",{className:"mb-2 rounded-[12px] border border-rose-400/20 bg-rose-400/10 px-3 py-2 text-[12px] leading-5 text-rose-100",children:b.errorMessage}):null,(0,D.jsx)(q8,{text:b.finalText||b.errorMessage||"No assistant output has been recorded for this runtime yet.",className:"text-[13px] leading-5 text-slate-100"}),b.finalTimestamp?(0,D.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:new Date(b.finalTimestamp).toLocaleString()}):null]}),(0,D.jsxs)(sf,{icon:rY,title:"Transcript trail",value:String(b.items.length),children:[0===b.items.length?(0,D.jsx)("p",{children:"No transcript entries were found."}):null,(0,D.jsx)("div",{className:"space-y-2",children:b.items.map(a=>(0,D.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2.5",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)(bd,{variant:"assistant"===a.role?a.isError?"danger":"default":"toolResult"===a.role?"warning":"muted",children:a.role}),a.toolName?(0,D.jsx)(bd,{variant:"muted",children:a.toolName}):null]}),(0,D.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:qP(new Date(a.timestamp).getTime())})]}),(0,D.jsx)("div",{className:"mt-2",children:(0,D.jsx)(q8,{text:a.text,className:"text-[12.5px] leading-5 text-slate-100"})})]},a.id))})]})]}):(0,D.jsx)(sf,{icon:U,title:"Runtime output",value:"missing",children:(0,D.jsx)("p",{children:"No transcript data is available for this runtime."})})}function sc({snapshot:a,modelId:b}){let c=a.models.find(a=>a.id===b);return c?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(sf,{icon:cn,title:"Model routing",value:c.provider,children:[(0,D.jsx)("p",{children:c.name}),(0,D.jsx)("p",{children:c.local?"Local model":"Remote model"})]}),(0,D.jsxs)(sf,{icon:rY,title:"Capacity",value:`${qQ(c.contextWindow)} ctx`,children:[(0,D.jsx)("p",{children:c.input}),(0,D.jsx)("p",{children:!1===c.available?"Unavailable":"Available"}),(0,D.jsxs)("p",{children:[c.usageCount," attached agents"]})]})]}):null}function sd({icon:a,label:b,active:c,disabled:d=!1,onClick:e}){return(0,D.jsx)("button",{type:"button",title:b,disabled:d,onClick:e,className:bb("inline-flex h-11 w-11 items-center justify-center rounded-[16px] border transition-all",d?"border-white/5 bg-white/[0.02] text-slate-600":c?"border-cyan-300/20 bg-cyan-400 text-slate-950 shadow-[0_12px_28px_rgba(96,165,250,0.35)]":"border-white/10 bg-white/[0.03] text-slate-400 hover:border-white/15 hover:bg-white/[0.08] hover:text-white"),children:(0,D.jsx)(a,{className:"h-4 w-4"})})}function se({label:a,active:b,onClick:c}){return(0,D.jsx)("button",{type:"button",onClick:c,className:bb("inline-flex items-center rounded-full border px-3 py-2 text-[11px] uppercase tracking-[0.18em] transition-all",b?"border-cyan-300/20 bg-cyan-400 text-slate-950 shadow-[0_10px_24px_rgba(96,165,250,0.28)]":"border-white/[0.08] bg-white/[0.03] text-slate-300 hover:bg-white/[0.07] hover:text-white"),children:a})}function sf({icon:a,title:b,value:c,children:d}){return(0,D.jsxs)("section",{className:"rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(12,19,34,0.86),rgba(8,13,24,0.82))] p-3.5",children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"space-y-1",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.24em] text-slate-500",children:b}),(0,D.jsx)("p",{className:"font-display text-[1rem] text-white",children:c})]}),(0,D.jsx)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/5 p-2 text-slate-300",children:(0,D.jsx)(a,{className:"h-3.5 w-3.5"})})]}),(0,D.jsx)("div",{className:"mt-3 space-y-1.5 text-[12.5px] leading-5 text-slate-300",children:d})]})}function sg({files:a,emptyLabel:b}){return 0===a.length?(0,D.jsx)("p",{className:"text-[12px] text-slate-400",children:b}):(0,D.jsx)("div",{className:"space-y-2",children:a.map(a=>(0,D.jsx)("button",{type:"button",onClick:()=>void sn(a.path),className:"w-full rounded-[14px] border border-cyan-300/12 bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2 text-left transition-all hover:border-cyan-300/28 hover:bg-cyan-400/[0.08]",children:(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate font-mono text-[12px] text-cyan-100",children:a.displayPath}),(0,D.jsx)("p",{className:"truncate text-[11px] text-slate-400",children:qV(a.path)})]}),(0,D.jsx)(bd,{variant:"muted",children:"reveal"})]})},a.path))})}function sh({items:a}){return(0,D.jsx)("div",{className:"grid grid-cols-2 gap-2",children:a.map(a=>(0,D.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.label}),(0,D.jsx)("p",{className:"mt-1 text-[13px] text-white",children:a.value})]},a.label))})}function si({items:a,missingVariant:b="muted"}){return(0,D.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(a=>(0,D.jsx)(bd,{variant:a.present?"success":b,children:a.label},a.id))})}function sj({items:a,emptyLabel:b,itemVariant:c,emptyVariant:d}){return 0===a.length?(0,D.jsx)(bd,{variant:d,children:b}):(0,D.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(a=>(0,D.jsx)(bd,{variant:c,children:a},a))})}function sk({items:a,emptyLabel:b}){return 0===a.length?(0,D.jsx)("p",{className:"text-[12px] text-slate-400",children:b}):(0,D.jsx)("div",{className:"space-y-2",children:a.map(a=>(0,D.jsx)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:(0,D.jsx)("p",{className:"text-[12px] leading-5 text-slate-200",children:a})},a))})}function sl(a){let b=a.metadata.createdFiles;return Array.isArray(b)?b.flatMap(a=>{if(!a||"object"!=typeof a)return[];let b="path"in a&&"string"==typeof a.path?a.path:null,c="displayPath"in a&&"string"==typeof a.displayPath?a.displayPath:b;return b&&c?[{path:b,displayPath:c}]:[]}):[]}function sm(a){let b=new Set,c=[];for(let d of a)!d.path||b.has(d.path)||(b.add(d.path),c.push(d));return c}async function sn(a){try{let b=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})}),c=await b.json();if(!b.ok)throw Error(c.error||"Unable to reveal file.");q3.oR.success("Revealed file.",{description:qV(a)})}catch(a){q3.oR.error("Could not reveal file.",{description:a instanceof Error?a.message:"Unknown file reveal error."})}}let so=K("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),sp=K("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);function sq(a){var b;return a.diagnostics.installed&&a.diagnostics.rpcOk&&(b=a).diagnostics.runtime.stateWritable&&b.diagnostics.runtime.sessionStoreWritable}function sr(a){return sq(a)&&a.diagnostics.modelReadiness.ready&&"passed"===a.diagnostics.runtime.smokeTest.status}function ss({snapshot:a,surfaceTheme:b,stage:c,systemActionLabel:d,systemActionDescription:e,systemPhase:f,modelPhase:g,systemRun:h,modelRun:i,selectedModelId:j,discoveredModels:k,onSelectedModelIdChange:l,onRunSystemSetup:m,onRunModelAutoSetup:n,onRunModelDiscover:o,onRunModelRefresh:p,onRunModelSetDefault:q,onContinueToModels:r,onBackToSystem:s,onDismiss:t,canDismiss:u}){var v,w,x,y,z,A,B,C,E,F,G,H,I,J,K,M,N,O;let P,Q,R,S,T,U=sq(a),V=sr(a),W=(v=c,w=U,x=V,[{id:"system",order:1,label:"System setup",description:"CLI, gateway service, live RPC, runtime state",state:sx(w,"system"===v&&!w)},{id:"models",order:2,label:"Model setup",description:"Default model, provider auth, live smoke test",state:sx(x,"models"===v&&!x)}]),X=(y=a,z=f,P=y.diagnostics.rpcOk&&!y.diagnostics.loaded,Q=y.diagnostics.installed||"installing-gateway"===z||"starting-gateway"===z||"verifying"===z||"ready"===z,R=y.diagnostics.loaded||P||"starting-gateway"===z||"verifying"===z||"ready"===z,S=y.diagnostics.rpcOk||"ready"===z,T=y.diagnostics.runtime.stateWritable&&y.diagnostics.runtime.sessionStoreWritable||"ready"===z,[{id:"cli",label:"OpenClaw CLI",description:y.diagnostics.installed?`Installed${y.diagnostics.version?` \xb7 v${y.diagnostics.version}`:""}`:"Install the OpenClaw CLI on this machine.",state:sx(Q,!Q&&("detecting"===z||"installing-cli"===z))},{id:"gateway",label:"Gateway service",description:y.diagnostics.loaded?"The local gateway service is already registered on this machine.":P?"Gateway is live via direct run.":"Register the gateway service once so Mission Control can start it reliably.",state:sx(R,!R&&("installing-gateway"===z||Q&&"detecting"===z))},{id:"runtime",label:"Live connection",description:y.diagnostics.rpcOk?"Mission Control is connected to a live OpenClaw gateway.":"Start the gateway and wait for RPC health to turn online.",state:sx(S,!S&&("starting-gateway"===z||"verifying"===z||R&&"detecting"===z))},{id:"state",label:"Runtime state",description:y.diagnostics.runtime.stateWritable&&y.diagnostics.runtime.sessionStoreWritable?"Mission Control can write to the OpenClaw state root and agent session stores.":"Verify write access to the OpenClaw runtime state before live work begins.",state:sx(T,!T&&("verifying"===z||S))}]),Y=a.models.filter(a=>!1!==a.available&&!a.missing),$=k.filter(a=>!Y.some(b=>b.id===a.modelId)),_="system"===c?h:i,aa=_.statusMessage||_.resultMessage||(A=c,B=e,"system"===A?B:"Choose or connect a usable model route so the product is actually ready."),ab="system"===c?(C=f,sq(E=a)?"ready":E.diagnostics.rpcOk?"verifying access":E.diagnostics.loaded&&!E.diagnostics.rpcOk?"verifying"===C?"connecting":"starting gateway":C?C.replace("-"," "):"waiting"):(F=g,sr(G=a)?"ready":G.diagnostics.modelReadiness.ready&&"passed"!==G.diagnostics.runtime.smokeTest.status?"smoke test":F?F.replace("-"," "):"waiting"),ac="idle"!==_.runState||!!_.manualCommand||_.log.trim().length>0,ad=(H=_.runState,I=c,J=V,"running"===H?"Running":J?"Ready":"success"===H?"models"===I?"Updated":"Step complete":"error"===H?"Needs attention":"system"===I?"Step 1":"Step 2"),ae="system"===(K={stage:c,systemReady:U,modelReady:V,systemActionLabel:d,selectedModelId:j,availableModelIds:Y.map(a=>a.id)}).stage?K.systemReady&&K.modelReady?{kind:"dismiss",label:"Enter Mission Control"}:K.systemReady?{kind:"continue",label:"Continue to model setup"}:{kind:"system",label:K.systemActionLabel}:K.modelReady?{kind:"dismiss",label:"Enter Mission Control"}:K.selectedModelId&&K.availableModelIds.includes(K.selectedModelId)||K.selectedModelId?{kind:"set-default",label:"Use selected model"}:{kind:"auto",label:"Auto configure models"};return(0,D.jsx)(pS.div,{initial:{opacity:0,backdropFilter:"blur(0px)"},animate:{opacity:1,backdropFilter:"blur(12px)"},exit:{opacity:0,backdropFilter:"blur(0px)"},className:bb("absolute inset-0 z-[80] pointer-events-auto flex items-center justify-center overflow-y-auto px-3 py-4 sm:px-4 sm:py-6","light"===b?"bg-[radial-gradient(circle_at_top,rgba(255,255,255,0.94),rgba(247,239,232,0.88)_46%,rgba(242,230,220,0.92))]":"bg-[radial-gradient(circle_at_top,rgba(17,24,39,0.9),rgba(3,7,18,0.92)_48%,rgba(2,6,23,0.96))]"),children:(0,D.jsxs)(pS.div,{initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},className:bb("my-auto flex w-full max-w-[420px] flex-col overflow-hidden rounded-[16px] border shadow-[0_18px_46px_rgba(0,0,0,0.18)] backdrop-blur-2xl max-h-[min(80vh,560px)]","light"===b?"border-[#dccabd]/90 bg-[rgba(255,250,246,0.92)] text-[#47362b] shadow-[0_18px_50px_rgba(161,125,101,0.15)]":"border-white/10 bg-[rgba(6,10,18,0.84)] text-slate-100"),children:[(0,D.jsxs)("div",{className:"overflow-y-auto px-2.5 py-2.5 sm:px-3 sm:py-3",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,D.jsxs)("span",{className:bb("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===b?"border-[#d8c0b0] bg-[#f3e7dc] text-[#8d725f]":"border-white/10 bg-white/[0.06] text-slate-300"),children:[(0,D.jsx)(cl,{className:"h-2 w-2"}),"Welcome"]}),(0,D.jsx)("span",{className:bb("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.16em]",(M=_.runState,N=V,O=b,"error"===M?"light"===O?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200":"success"===M||N?"light"===O?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"running"===M?"light"===O?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-300":"light"===O?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-400")),children:ad})]}),(0,D.jsxs)("div",{className:"mt-3",children:[(0,D.jsx)("p",{className:bb("text-[7px] uppercase tracking-[0.18em]","light"===b?"text-[#977b69]":"text-slate-500"),children:"OpenClaw Mission Control"}),(0,D.jsx)("h1",{className:bb("mt-1 font-display text-[1.12rem] leading-[1.25rem]","light"===b?"text-[#33251c]":"text-white"),children:"Bring your local OpenClaw online."}),(0,D.jsx)("p",{className:bb("mt-1.5 text-[11px] leading-[1.05rem]","light"===b?"text-[#705b4d]":"text-slate-300"),children:"Finish the system layer first, then lock a usable default model so the product is ready for real work."})]}),(0,D.jsx)("div",{className:"mt-3 grid gap-1.5 sm:grid-cols-2",children:W.map(a=>(0,D.jsx)("div",{className:bb("rounded-[14px] border px-2.5 py-2",sA(a.state,b)),children:(0,D.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,D.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,D.jsx)("span",{className:bb("inline-flex h-5 w-5 items-center justify-center rounded-full border text-[9px] font-medium",sB(a.state,b)),children:"complete"===a.state?(0,D.jsx)(Z,{className:"h-2.5 w-2.5"}):a.order}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bb("text-[11px]","light"===b?"text-[#3e2f24]":"text-white"),children:a.label}),(0,D.jsx)("p",{className:bb("mt-0.5 text-[8px] leading-[0.85rem]","light"===b?"text-[#8f7664]":"text-slate-500"),children:a.description})]})]}),(0,D.jsx)("span",{className:bb("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",sC(a.state,b)),children:"complete"===a.state?"Ready":"current"===a.state?"Active":"Pending"})]})},a.id))}),"system"===c?(0,D.jsx)(st,{steps:X,surfaceTheme:b,statusCopy:aa,showDetails:ac,phaseLabel:ab,run:_}):(0,D.jsx)(su,{snapshot:a,surfaceTheme:b,statusCopy:aa,showDetails:ac,phaseLabel:ab,run:_,selectedModelId:j,availableModels:Y.map(a=>({id:a.id,name:a.name,provider:a.provider})),discoveredModels:$,onSelectedModelIdChange:l,onRunModelDiscover:o,onRunModelRefresh:p,onRunModelSetDefault:q})]}),(0,D.jsxs)("div",{className:bb("mt-auto flex flex-wrap items-center justify-between gap-1.5 border-t px-2.5 py-2 sm:px-3","light"===b?"border-[#ebddd2]":"border-white/8"),children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:["models"===c?(0,D.jsxs)(bp,{type:"button",variant:"ghost",size:"sm",onClick:s,disabled:"running"===_.runState,className:"light"===b?"border border-[#d7bca7] bg-[#f8ede4] text-[#5a4131] hover:bg-[#eedbcc] hover:text-[#3f2d21]":"text-slate-500 hover:bg-white/[0.08] hover:text-slate-200",children:[(0,D.jsx)(so,{className:"mr-1.5 h-3.5 w-3.5"}),"Back"]}):null,u?(0,D.jsx)("button",{type:"button",onClick:t,className:bb("text-[9px] uppercase tracking-[0.16em] transition-colors","light"===b?"text-[#8f7664] hover:text-[#6f5949]":"text-slate-500 hover:text-slate-300"),children:"Open demo surface"}):null]}),(0,D.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:["models"!==c||V?null:(0,D.jsx)(bp,{type:"button",variant:"secondary",size:"sm",onClick:n,disabled:"running"===i.runState,className:sy(b),children:"running"===i.runState?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Working..."]}):"Auto configure"}),(0,D.jsx)(bp,{type:"button",onClick:()=>{"system"===c?U&&V?t():U?r():m():V?t():"set-default"===ae.kind?q():n()},disabled:"running"===_.runState,className:bb("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===b?"bg-[#c8946f] text-white shadow-[0_14px_34px_rgba(200,148,111,0.24)] hover:bg-[#b88461]":"bg-white text-slate-950 hover:bg-white/92"),children:"running"===_.runState?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Working..."]}):(0,D.jsxs)(D.Fragment,{children:[ae.label,(0,D.jsx)(sp,{className:"ml-1.5 h-3 w-3"})]})})]})]})]})})}function st({steps:a,surfaceTheme:b,statusCopy:c,showDetails:d,phaseLabel:e,run:f}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{className:"mt-3",children:[(0,D.jsx)("p",{className:bb("text-[7px] uppercase tracking-[0.18em]","light"===b?"text-[#977b69]":"text-slate-500"),children:"Step 1"}),(0,D.jsx)("h2",{className:bb("mt-1 text-[13px] font-medium","light"===b?"text-[#33251c]":"text-white"),children:"System setup"}),(0,D.jsx)("p",{className:bb("mt-1 text-[10px] leading-[0.95rem]","light"===b?"text-[#705b4d]":"text-slate-400"),children:"Install the CLI if needed, make sure the gateway service exists, and verify a live RPC connection."})]}),(0,D.jsx)("div",{className:"mt-2.5 space-y-1.5",children:a.map((a,c)=>(0,D.jsxs)("div",{className:bb("flex items-center gap-1.5 rounded-[12px] border px-2 py-1.5",sA(a.state,b)),children:[(0,D.jsx)("span",{className:bb("mt-0.5 inline-flex h-5 w-5 items-center justify-center rounded-full border text-[9px] font-medium",sB(a.state,b)),children:"complete"===a.state?(0,D.jsx)(Z,{className:"h-2.5 w-2.5"}):c+1}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,D.jsx)("p",{className:bb("text-[11px]","light"===b?"text-[#3e2f24]":"text-white"),children:a.label}),(0,D.jsx)("span",{className:bb("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",sC(a.state,b)),children:"complete"===a.state?"Ready":"current"===a.state?"Active":"Pending"})]}),(0,D.jsx)("p",{className:bb("mt-0.5 text-[8px] leading-[0.82rem]","light"===b?"text-[#8f7664]":"text-slate-500"),children:a.description})]})]},a.id))}),(0,D.jsx)(sv,{surfaceTheme:b,statusCopy:c,showDetails:d,phaseLabel:e,run:f})]})}function su({snapshot:a,surfaceTheme:b,statusCopy:c,showDetails:d,phaseLabel:e,run:f,selectedModelId:g,availableModels:h,discoveredModels:i,onSelectedModelIdChange:j,onRunModelDiscover:k,onRunModelRefresh:l,onRunModelSetDefault:m}){let n=a.diagnostics.modelReadiness;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{className:"mt-3",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bb("text-[7px] uppercase tracking-[0.18em]","light"===b?"text-[#977b69]":"text-slate-500"),children:"Step 2"}),(0,D.jsx)("h2",{className:bb("mt-1 text-[13px] font-medium","light"===b?"text-[#33251c]":"text-white"),children:"Model setup"})]}),(0,D.jsxs)(bp,{type:"button",variant:"secondary",size:"sm",onClick:l,disabled:"running"===f.runState,className:sy(b),children:[(0,D.jsx)(S,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh"]})]}),(0,D.jsx)("p",{className:bb("mt-1 text-[10px] leading-[0.95rem]","light"===b?"text-[#705b4d]":"text-slate-400"),children:"Lock a usable default model before handing the user into the live product."})]}),(0,D.jsxs)("div",{className:"mt-2.5 grid gap-1.5 sm:grid-cols-3",children:[(0,D.jsx)(sw,{surfaceTheme:b,label:"Default model",value:n.resolvedDefaultModel||n.defaultModel||"Not set"}),(0,D.jsx)(sw,{surfaceTheme:b,label:"Available routes",value:`${n.availableModelCount}/${n.totalModelCount}`}),(0,D.jsx)(sw,{surfaceTheme:b,label:"Connected providers",value:String(n.authProviders.filter(a=>a.connected).length)})]}),(0,D.jsxs)("div",{className:bb("mt-2.5 rounded-[12px] border px-2.5 py-2.5","light"===b?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,D.jsxs)("div",{className:"grid gap-2.5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end",children:[(0,D.jsxs)("label",{className:"block",children:[(0,D.jsx)("span",{className:bb("text-[7px] uppercase tracking-[0.16em]","light"===b?"text-[#977b69]":"text-slate-500"),children:"Default model"}),(0,D.jsxs)("select",{value:g,onChange:a=>j(a.target.value),className:bb("mt-1.5 h-9 w-full rounded-[12px] border px-2.5 text-[11px] outline-none","light"===b?"border-[#dccabd] bg-white text-[#33251c]":"border-white/10 bg-white/[0.04] text-slate-100"),children:[(0,D.jsx)("option",{value:"",children:"Auto choose"}),h.map(a=>(0,D.jsxs)("option",{value:a.id,children:[a.name," \xb7 ",a.provider]},a.id))]})]}),(0,D.jsxs)("div",{className:bb("rounded-[12px] border px-2.5 py-1.5 text-[10px]","light"===b?"border-[#eadcd0] bg-[#fff7f2] text-[#705b4d]":"border-white/10 bg-white/[0.03] text-slate-400"),children:[n.localModelCount," local \xb7 ",n.remoteModelCount," remote"]})]}),(0,D.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:(0,D.jsx)(bp,{type:"button",variant:"secondary",size:"sm",onClick:k,disabled:"running"===f.runState,className:sy(b),children:i.length>0?"Scan again":"Discover models"})}),n.issues.length>0?(0,D.jsx)("div",{className:"mt-2.5 space-y-1",children:n.issues.map(a=>(0,D.jsx)("p",{className:bb("rounded-[10px] border px-2 py-1.5 text-[9px] leading-[0.85rem]","light"===b?"border-amber-200 bg-amber-50 text-amber-800":"border-amber-300/20 bg-amber-300/10 text-amber-100"),children:a},a))}):null,a.diagnostics.modelReadiness.authProviders.length>0?(0,D.jsx)("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:a.diagnostics.modelReadiness.authProviders.map(a=>(0,D.jsxs)("span",{className:bb("rounded-full border px-2 py-0.5 text-[9px]",a.connected?"light"===b?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-200":"light"===b?"border-[#dccabd] bg-white text-[#705b4d]":"border-white/10 bg-white/[0.04] text-slate-300"),children:[sz(a.provider),a.detail?` \xb7 ${a.detail}`:""]},a.provider))}):null,i.length>0?(0,D.jsxs)("div",{className:"mt-2.5 space-y-1.5",children:[(0,D.jsx)("p",{className:bb("text-[7px] uppercase tracking-[0.16em]","light"===b?"text-[#977b69]":"text-slate-500"),children:"Discovered routes"}),(0,D.jsx)("div",{className:"space-y-1.5",children:i.slice(0,3).map(a=>(0,D.jsxs)("div",{className:bb("flex items-center justify-between gap-2 rounded-[12px] border px-2 py-1.5","light"===b?"border-[#eadcd0] bg-[#fff7f2]":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:bb("truncate text-[10px]","light"===b?"text-[#3e2f24]":"text-white"),children:a.name}),(0,D.jsxs)("p",{className:bb("mt-0.5 text-[8px] leading-[0.85rem]","light"===b?"text-[#8f7664]":"text-slate-500"),children:[sz(a.provider),a.isFree?" \xb7 free":"",a.supportsTools?" \xb7 tools":""]})]}),(0,D.jsx)(bp,{type:"button",variant:"secondary",size:"sm",onClick:()=>m(a.modelId),disabled:"running"===f.runState,className:sy(b),children:"Use"})]},a.modelId))}),(0,D.jsx)("p",{className:bb("text-[9px] leading-[0.95rem]","light"===b?"text-[#705b4d]":"text-slate-500"),children:"The dropdown only shows routes that are already configured. Use a discovered route here to add it first; if credentials are missing, Mission Control will hand you off to OpenClaw."})]}):null]}),(0,D.jsx)(sv,{surfaceTheme:b,statusCopy:c,showDetails:d,phaseLabel:e,run:f})]})}function sv({surfaceTheme:a,statusCopy:b,showDetails:c,phaseLabel:d,run:e}){let[f,g]=(0,E.useState)(!1),h=!!e.manualCommand?.trim().startsWith("openclaw "),i=async()=>{if(e.manualCommand)try{await navigator.clipboard.writeText(e.manualCommand),d9.o.success("Command copied.",{description:"Open Terminal and paste the command to continue setup."})}catch(a){d9.o.error("Could not copy command.",{description:a instanceof Error?a.message:"Clipboard access is unavailable."})}},j=async()=>{if(e.manualCommand&&h){g(!0);try{let a=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e.manualCommand})}),b=await a.json().catch(()=>null);if(!a.ok||b?.error)throw Error(b?.error||"Unable to open Terminal.");d9.o.success("Terminal opened.",{description:"Finish the OpenClaw auth flow there, then return and refresh setup."})}catch(a){d9.o.error("Could not open Terminal.",{description:a instanceof Error?a.message:"Open Terminal manually and run the command below."})}finally{g(!1)}}};return(0,D.jsxs)("div",{className:bb("mt-2.5 rounded-[12px] border","light"===a?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,D.jsxs)("div",{className:"px-2.5 py-2",children:[(0,D.jsx)("p",{className:bb("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:"Current status"}),(0,D.jsx)("p",{className:bb("mt-1 text-[11px] leading-[1rem]","light"===a?"text-[#5f4b3e]":"text-slate-300"),children:b})]}),c?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{className:bb("flex items-center justify-between border-y px-2.5 py-1.5","light"===a?"border-[#ebddd2]":"border-white/8"),children:[(0,D.jsx)("p",{className:bb("text-[8px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:"Setup log"}),(0,D.jsx)("span",{className:"light"===a?"text-[10px] text-[#8c7362]":"text-[10px] text-slate-400",children:d})]}),(0,D.jsx)("pre",{className:bb("max-h-[120px] min-h-[68px] overflow-auto whitespace-pre-wrap break-words px-2.5 py-2 font-mono text-[8px] leading-[0.82rem]","light"===a?"text-[#4f3d31]":"text-slate-200"),children:e.log||"No command output yet.\n\nStart this step and Mission Control will stream each action here."}),e.manualCommand?(0,D.jsxs)("div",{className:bb("border-t px-2.5 py-2","light"===a?"border-[#ebddd2]":"border-white/8"),children:[(0,D.jsx)("p",{className:bb("text-[8px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:h?"Run in terminal":"Manual fallback"}),h?(0,D.jsx)("p",{className:bb("mt-1 text-[9px] leading-[0.95rem]","light"===a?"text-[#705b4d]":"text-slate-400"),children:"Open Terminal and run this command to continue setup."}):null,(0,D.jsx)("p",{className:bb("mt-1 break-all font-mono text-[9px] leading-[0.92rem]","light"===a?"text-[#4f3d31]":"text-slate-200"),children:e.manualCommand}),(0,D.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[(0,D.jsxs)(bp,{type:"button",variant:"secondary",size:"sm",onClick:i,className:sy(a),children:[(0,D.jsx)(V,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),h?(0,D.jsx)(bp,{type:"button",variant:"secondary",size:"sm",onClick:j,disabled:f,className:sy(a),children:f?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(U,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null]}),e.docsUrl?(0,D.jsxs)("a",{href:e.docsUrl,target:"_blank",rel:"noreferrer",className:bb("mt-2 inline-flex items-center gap-1 text-[9px] underline underline-offset-4","light"===a?"text-[#7f6554]":"text-slate-300"),children:["Setup docs",(0,D.jsx)(sp,{className:"h-2.5 w-2.5"})]}):null]}):null]}):null]})}function sw({surfaceTheme:a,label:b,value:c}){return(0,D.jsxs)("div",{className:bb("rounded-[12px] border px-2.5 py-2","light"===a?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,D.jsx)("p",{className:bb("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:b}),(0,D.jsx)("p",{className:bb("mt-1 text-[11px] leading-[0.92rem]","light"===a?"text-[#3e2f24]":"text-white"),children:c})]})}function sx(a,b){return a?"complete":b?"current":"pending"}function sy(a){return"light"===a?"border-[#b89374] bg-[#ecd4c1] text-[#4a3426] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#e4c6af] hover:text-[#38261b]":"border-white/10 bg-white/[0.05] text-slate-200 hover:bg-white/[0.1]"}function sz(a){let b=a.trim().toLowerCase();return"openrouter"===b?"OpenRouter":"openai-codex"===b?"OpenAI Codex":"openai"===b?"OpenAI":"anthropic"===b?"Anthropic":"ollama"===b?"Ollama":a.split("-").map(a=>a?a[0].toUpperCase()+a.slice(1):a).join(" ")}function sA(a,b){return"complete"===a?"light"===b?"border-emerald-200 bg-emerald-50/60":"border-emerald-400/20 bg-emerald-400/8":"current"===a?"light"===b?"border-[#d9c2b3] bg-white/70":"border-white/12 bg-white/[0.05]":"light"===b?"border-[#eadcd0] bg-[#fffaf6]/80":"border-white/6 bg-white/[0.02]"}function sB(a,b){return"complete"===a?"light"===b?"border-emerald-300 bg-emerald-100 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"current"===a?"light"===b?"border-[#d5b9a5] bg-[#f5ebe3] text-[#8b6d5a]":"border-white/12 bg-white/[0.06] text-white":"light"===b?"border-[#e1ccc0] bg-white text-[#9a7f6c]":"border-white/8 bg-white/[0.03] text-slate-400"}function sC(a,b){return"complete"===a?"light"===b?"bg-emerald-100 text-emerald-700":"bg-emerald-300/10 text-emerald-200":"current"===a?"light"===b?"bg-[#efe1d4] text-[#876c5a]":"bg-white/[0.06] text-slate-300":"light"===b?"bg-[#f6ece4] text-[#a08471]":"bg-white/[0.04] text-slate-500"}let sD=K("package-x",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]),sE=K("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),sF=K("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);function sG({open:a,target:b,surfaceTheme:c,previewState:d,preview:e,previewError:f,runState:g,statusMessage:h,resultMessage:i,backgroundLogPath:j,log:k,confirmText:l,onConfirmTextChange:m,onRefreshPreview:n,onExecute:o,onOpenChange:p}){let q="full-uninstall"===b?"FULL UNINSTALL":"RESET MISSION CONTROL",r="running"===g,s="success"===g||"error"===g,t=null!==b&&"ready"===d&&!r&&!s&&l.trim()===q,u="full-uninstall"===b?"Full Uninstall":"Reset Mission Control",v="light"===c?"border-rose-400/80 bg-rose-600 text-white hover:bg-rose-700":"border-rose-400/35 bg-rose-500/90 text-white hover:bg-rose-500";return(0,D.jsx)(dw,{open:a,onOpenChange:a=>{(a||!r)&&p(a)},children:(0,D.jsxs)(d$,{className:bb("max-h-[88vh] w-[min(92vw,56rem)] max-w-[92vw] min-w-0 overflow-x-hidden overflow-y-auto sm:max-w-3xl","light"===c?"border-[#dcc8bb] bg-[rgba(252,247,241,0.98)] text-[#402f24]":"border-white/12 bg-[rgba(7,12,22,0.96)] text-slate-100"),children:[(0,D.jsxs)(d_,{children:[(0,D.jsxs)(d1,{className:bb("flex items-center gap-2","light"===c?"text-[#3f2f24]":"text-white"),children:["full-uninstall"===b?(0,D.jsx)(sD,{className:"h-4 w-4"}):(0,D.jsx)(sE,{className:"h-4 w-4"}),u]}),(0,D.jsx)(d2,{className:"light"===c?"text-[#7e6555]":"text-slate-400",children:"full-uninstall"===b?"Remove Mission Control state, OpenClaw service and local state, then attempt to remove detected OpenClaw and AgentOS packages.":"Remove Mission Control-managed workspaces, attached agents, planner state, and browser state."})]}),"loading"===d?(0,D.jsxs)("div",{className:bb("flex items-center gap-2 rounded-[16px] border px-4 py-4 text-sm","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsx)(L,{className:"h-4 w-4 animate-spin"}),"Loading the reset preview..."]}):null,"error"===d?(0,D.jsxs)("div",{className:bb("rounded-[16px] border px-4 py-4","light"===c?"border-rose-200 bg-rose-50 text-rose-900":"border-rose-400/25 bg-rose-500/10 text-rose-100"),children:[(0,D.jsx)("p",{className:"text-sm font-medium",children:"Preview could not be prepared."}),(0,D.jsx)("p",{className:"mt-1 text-sm",children:f||"Unknown reset preview error."})]}):null,e?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,D.jsx)(sH,{label:"Delete folders",value:String(e.summary.deleteFolderCount),surfaceTheme:c}),(0,D.jsx)(sH,{label:"Keep folders",value:String(e.summary.metadataOnlyCount),surfaceTheme:c}),(0,D.jsx)(sH,{label:"Agents",value:String(e.summary.agentCount),surfaceTheme:c}),(0,D.jsx)(sH,{label:"Live agents",value:String(e.summary.liveAgentCount),surfaceTheme:c,danger:e.summary.liveAgentCount>0})]}),e.warnings.length>0?(0,D.jsx)("div",{className:bb("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-amber-300/90 bg-amber-50 text-amber-950":"border-amber-300/25 bg-amber-300/10 text-amber-50"),children:(0,D.jsxs)("div",{className:"flex items-start gap-2",children:[(0,D.jsx)(N,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,D.jsx)("div",{className:"space-y-1 text-sm",children:e.warnings.map(a=>(0,D.jsx)("p",{children:a},a))})]})}):null,(0,D.jsxs)("div",{className:bb("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bb("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:"Workspace impact"}),(0,D.jsx)("p",{className:bb("mt-1 text-sm","light"===c?"text-[#6d5647]":"text-slate-400"),children:"`Delete folder` removes the workspace directory. `Keep folder` only removes OpenClaw and Mission Control integration from that location."})]}),(0,D.jsx)(bp,{type:"button",size:"sm",variant:"secondary",onClick:n,className:"light"===c?"border-[#dcc6b6] bg-white text-[#5d4739] hover:bg-[#f7eee7] hover:text-[#5d4739]":void 0,children:"Refresh preview"})]}),(0,D.jsx)("div",{className:"mt-3 space-y-2",children:e.workspaces.map(a=>(0,D.jsxs)("div",{className:bb("rounded-[14px] border px-3 py-3","light"===c?"border-[#ece0d6] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bb("text-sm font-medium","light"===c?"text-[#3f2f24]":"text-white"),children:a.name}),(0,D.jsx)("p",{className:bb("mt-1 break-all font-mono text-[11px]","light"===c?"text-[#7e6555]":"text-slate-400"),children:a.path})]}),(0,D.jsx)("span",{className:bb("rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]","delete-folder"===a.action?"light"===c?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-400/25 bg-rose-500/10 text-rose-200":"light"===c?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:"delete-folder"===a.action?"Delete folder":"Keep folder"})]}),(0,D.jsxs)("p",{className:bb("mt-2 text-xs","light"===c?"text-[#6d5647]":"text-slate-400"),children:[a.agentCount," agents, ",a.runtimeCount," tracked runs, ",a.liveAgentCount," live agents."]}),(0,D.jsx)("div",{className:"mt-2 space-y-1",children:a.reasons.map(a=>(0,D.jsx)("p",{className:bb("text-xs","light"===c?"text-[#7e6555]":"text-slate-500"),children:a},a))})]},a.workspaceId))})]}),(0,D.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,D.jsx)(sI,{title:"Mission Control state",items:e.missionControlPaths,surfaceTheme:c}),(0,D.jsx)(sI,{title:"Browser state",items:e.browserStorageKeys,surfaceTheme:c})]}),"full-uninstall"===b?(0,D.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,D.jsx)(sI,{title:"OpenClaw state",items:e.openClawPaths,surfaceTheme:c}),(0,D.jsxs)("div",{className:bb("rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsx)("p",{className:bb("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:"Package cleanup"}),(0,D.jsx)("div",{className:"mt-3 space-y-2",children:e.packageActions.map(a=>(0,D.jsxs)("div",{className:bb("min-w-0 overflow-hidden rounded-[14px] border px-3 py-3","light"===c?"border-[#ece0d6] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,D.jsx)("p",{className:bb("min-w-0 break-all text-sm font-medium","light"===c?"text-[#3f2f24]":"text-white"),children:a.packageName}),(0,D.jsx)("span",{className:bb("shrink-0 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",a.detected?"light"===c?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-400/25 bg-rose-500/10 text-rose-200":"light"===c?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-white/10 bg-white/[0.05] text-slate-300"),children:a.detected?"Scheduled":"Manual"})]}),(0,D.jsx)("p",{className:bb("mt-1 break-words text-xs","light"===c?"text-[#6d5647]":"text-slate-400"),children:a.reason||"No extra detail."}),(0,D.jsx)("p",{className:bb("mt-1 whitespace-pre-wrap break-all font-mono text-[11px]","light"===c?"text-[#7e6555]":"text-slate-500"),children:a.command||"Automatic package removal is not available."})]},a.packageName))})]})]}):null,(0,D.jsxs)("div",{className:bb("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-rose-200 bg-rose-50/70 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50"),children:[(0,D.jsxs)(rA,{htmlFor:"reset-confirm",className:"text-sm font-medium text-inherit",children:["Type ",q," to continue"]}),(0,D.jsx)(bq,{id:"reset-confirm",value:l,onChange:a=>m(a.target.value),placeholder:q,disabled:r,className:bb("mt-2 h-10","light"===c?"border-rose-200 bg-white text-rose-950 placeholder:text-rose-300":"border-rose-300/20 bg-slate-950/50 text-rose-50 placeholder:text-rose-200/35")})]})]}):null,"idle"!==g||i||k?(0,D.jsxs)("div",{className:bb("min-w-0 overflow-hidden rounded-[16px] border px-4 py-4","error"===g?"light"===c?"border-rose-200 bg-rose-50 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50":"success"===g?"light"===c?"border-emerald-200 bg-emerald-50 text-emerald-950":"border-emerald-400/25 bg-emerald-500/10 text-emerald-50":"light"===c?"border-[#e6d6ca] bg-white text-[#3f2f24]":"border-white/10 bg-white/[0.03] text-slate-100"),children:[(0,D.jsx)("p",{className:"text-sm font-medium",children:h||i||"Reset status"}),i?(0,D.jsx)("p",{className:"mt-1 text-sm",children:i}):null,j?(0,D.jsxs)("p",{className:"mt-2 break-all font-mono text-[11px]",children:["Background cleanup log: ",j]}):null,(0,D.jsx)("pre",{className:bb("mt-3 max-h-56 w-full max-w-full overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-[14px] border px-3 py-3 text-[11px] leading-relaxed","light"===c?"border-[#e6d6ca] bg-[#fffaf6] text-[#5f4a3d]":"border-white/10 bg-slate-950/45 text-slate-300"),children:k||"Waiting for command output..."})]}):null,(0,D.jsxs)(d0,{children:[(0,D.jsx)(bp,{type:"button",variant:s?"default":"secondary",onClick:()=>p(!1),disabled:r,className:s&&"light"===c?"bg-[#5c4437] text-white hover:bg-[#4d382d]":s?"bg-cyan-400 text-slate-950 hover:bg-cyan-300":void 0,children:s?"Done":"Close"}),s?null:(0,D.jsx)(bp,{type:"button",onClick:o,disabled:!t,className:v,children:r?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Running..."]}):(0,D.jsxs)(D.Fragment,{children:["full-uninstall"===b?(0,D.jsx)(sD,{className:"mr-1.5 h-3.5 w-3.5"}):(0,D.jsx)(sF,{className:"mr-1.5 h-3.5 w-3.5"}),u]})})]})]})})}function sH({label:a,value:b,surfaceTheme:c,danger:d=!1}){return(0,D.jsxs)("div",{className:bb("rounded-[16px] border px-4 py-3",d?"light"===c?"border-rose-200 bg-rose-50":"border-rose-400/20 bg-rose-500/10":"light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsx)("p",{className:bb("text-[11px] uppercase tracking-[0.16em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:a}),(0,D.jsx)("p",{className:bb("mt-1 font-display text-lg","light"===c?"text-[#3f2f24]":"text-white"),children:b})]})}function sI({title:a,items:b,surfaceTheme:c}){return(0,D.jsxs)("div",{className:bb("rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsx)("p",{className:bb("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:a}),(0,D.jsx)("div",{className:"mt-3 space-y-2",children:b.map(a=>(0,D.jsx)("p",{className:bb("break-all rounded-[12px] border px-3 py-2 font-mono text-[11px]","light"===c?"border-[#ece0d6] bg-[#fffaf6] text-[#6d5647]":"border-white/8 bg-white/[0.03] text-slate-400"),children:a},a))})]})}let sJ=K("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),sK=K("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);function sL({snapshot:a,activeWorkspaceId:b,requestedAgentAction:c,connectionState:d,collapsed:e,modelManager:f,onToggleCollapsed:g,onSelectWorkspace:h,onRefresh:i,onRunModelRefresh:j,onRunModelDiscover:k,onRunModelSetDefault:l,onConnectModelProvider:m,onOpenModelSetup:n,onOpenAddModels:o}){var p;let q=function(a){switch(a){case"healthy":return"text-emerald-300";case"degraded":return"text-amber-200";default:return"text-rose-200"}}(a.diagnostics.health),r="healthy"===a.diagnostics.health?"bg-emerald-300":"degraded"===a.diagnostics.health?"bg-amber-200":"bg-rose-300",s=a.diagnostics.gatewayUrl.replace(/^wss?:\/\//,"").replace(/\/$/,""),[t,u]=(0,E.useState)(!1),[v,w]=(0,E.useState)(!1),[x,y]=(0,E.useState)(!1),[z,A]=(0,E.useState)(!1),[B,C]=(0,E.useState)(!1),[F,G]=(0,E.useState)(!1),[H,I]=(0,E.useState)(!1),[J,K]=(0,E.useState)(!1),[M,O]=(0,E.useState)(null),[P,Q]=(0,E.useState)(null),[R,T]=(0,E.useState)(null),[U,V]=(0,E.useState)(""),[W,X]=(0,E.useState)(null),[Y,Z]=(0,E.useState)(""),[$,_]=(0,E.useState)("workspaces"),[aa,ab]=(0,E.useState)("");(0,E.useRef)(null);let ac=(0,E.useMemo)(()=>a.agents.filter(a=>!b||a.workspaceId===b).sort((a,b)=>a.workspaceId!==b.workspaceId?a.workspaceId.localeCompare(b.workspaceId):a.name.localeCompare(b.name)),[a.agents,b]),ad=a.workspaces.find(a=>a.id===b)??a.workspaces[0]??null,ae=(0,E.useMemo)(()=>a.models.filter(a=>!1!==a.available&&!a.missing),[a.models]),af=(0,E.useMemo)(()=>f.discoveredModels.filter(b=>!a.models.some(a=>a.id===b.modelId)),[f.discoveredModels,a.models]),ag=aa&&(ae.some(a=>a.id===aa)||af.some(a=>a.modelId===aa))?aa:(p=a).diagnostics.modelReadiness.resolvedDefaultModel||p.diagnostics.modelReadiness.defaultModel||p.models.find(a=>!1!==a.available&&!a.missing)?.id||"",ah=!!M&&(v||"monitoring"===M.policy.preset),ai=[{id:"overview",label:"Overview",icon:sJ},{id:"workspaces",label:"Workspaces",icon:rd,badge:String(a.workspaces.length)},{id:"agents",label:"Agents",icon:co,badge:String(ac.length)},{id:"models",label:"Models",icon:cn,badge:String(a.models.length)}],aj=(0,E.useMemo)(()=>R?a.agents.filter(a=>a.workspaceId===R.id):[],[R,a.agents]),ak=(0,E.useMemo)(()=>aj.filter(a=>"engaged"===a.status||"monitoring"===a.status||"ready"===a.status),[aj]),al=(0,E.useMemo)(()=>R?a.runtimes.filter(a=>a.workspaceId===R.id):[],[R,a.runtimes]),am=(0,E.useMemo)(()=>W?a.runtimes.filter(a=>a.agentId===W.id):[],[W,a.runtimes]),an=W?a.workspaces.find(a=>a.id===W.workspaceId)??null:null,ao=!!W&&("engaged"===W.status||"monitoring"===W.status||"ready"===W.status),ap=async()=>{if(M){y(!0);try{let a=await fetch("/api/agents",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)}),b=await a.json();if(!a.ok||b.error)throw Error(b.error||"OpenClaw could not update the agent.");d9.o.success("Agent updated in OpenClaw.",{description:M.id}),u(!1),await i()}catch(a){d9.o.error("Agent update failed.",{description:a instanceof Error?a.message:"Unknown agent error."})}finally{y(!1)}}},aq=async()=>{if(P){G(!0);try{let a=await fetch("/api/workspaces",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceId:P.workspaceId,name:P.name.trim()||void 0,directory:P.directory.trim()||void 0})}),b=await a.json();if(!a.ok||b.error)throw Error(b.error||"OpenClaw could not update the workspace.");d9.o.success("Workspace updated in OpenClaw.",{description:b.workspacePath||P.currentPath}),A(!1),await i(),h(b.workspaceId??P.workspaceId)}catch(a){d9.o.error("Workspace update failed.",{description:a instanceof Error?a.message:"Unknown workspace error."})}finally{G(!1)}}},ar=async()=>{if(R){G(!0);try{let a=await fetch("/api/workspaces",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceId:R.id})}),c=await a.json();if(!a.ok||c.error)throw Error(c.error||"OpenClaw could not delete the workspace.");d9.o.success("Workspace deleted from OpenClaw.",{description:c.workspacePath||R.path}),C(!1),T(null),V(""),h(b===R.id?null:b),await i()}catch(a){d9.o.error("Workspace deletion failed.",{description:a instanceof Error?a.message:"Unknown workspace error."})}finally{G(!1)}}},as=async()=>{if(W){K(!0);try{let a=await fetch("/api/agents",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentId:W.id})}),b=await a.json();if(!a.ok||b.error)throw Error(b.error||"OpenClaw could not delete the agent.");d9.o.success("Agent deleted from OpenClaw.",{description:b.agentId||W.id}),M?.id===W.id&&(u(!1),O(null)),I(!1),X(null),Z(""),await i()}catch(a){d9.o.error("Agent deletion failed.",{description:a instanceof Error?a.message:"Unknown agent error."})}finally{K(!1)}}};return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{className:"panel-surface panel-glow flex h-full overflow-hidden rounded-[30px] border border-white/[0.08] bg-[#04070e]/88 shadow-[0_28px_90px_rgba(0,0,0,0.42)] backdrop-blur-2xl",children:[(0,D.jsxs)("div",{className:bb("flex h-full shrink-0 flex-col items-center bg-[linear-gradient(180deg,rgba(7,10,18,0.98),rgba(3,6,12,0.98))] px-3 py-4",e?"w-full":"w-[78px] border-r border-white/[0.08]"),children:[(0,D.jsx)("button",{type:"button","aria-label":e?"Expand mission control":"Collapse mission control",onClick:g,className:"flex h-12 w-12 items-center justify-center rounded-[18px] border border-cyan-300/20 bg-cyan-400/[0.12] shadow-[0_10px_24px_rgba(34,211,238,0.18)] transition-all hover:border-cyan-200/30 hover:bg-cyan-400/[0.16]",children:(0,D.jsx)(sK,{className:"h-5 w-5 text-cyan-200"})}),(0,D.jsx)("button",{type:"button","aria-label":e?"Expand mission control":"Collapse mission control",onClick:g,className:"mt-4 inline-flex h-11 w-11 items-center justify-center rounded-[16px] border border-white/10 bg-white/[0.04] text-slate-300 transition-all hover:border-cyan-300/18 hover:bg-white/[0.08] hover:text-white",children:e?(0,D.jsx)(rX,{className:"h-4 w-4"}):(0,D.jsx)(rW,{className:"h-4 w-4"})}),(0,D.jsx)("div",{className:"mt-6 flex flex-1 flex-col items-center gap-2",children:ai.map(a=>(0,D.jsx)(sM,{icon:a.icon,label:a.label,active:$===a.id,onClick:()=>{_(a.id),e&&g()}},a.id))}),(0,D.jsxs)("div",{className:"mt-4 flex flex-col items-center gap-2",children:[(0,D.jsx)(pT,{tone:r,pulse:"healthy"===a.diagnostics.health}),e?(0,D.jsx)("p",{className:"text-[9px] uppercase tracking-[0.18em] text-slate-500",children:a.mode}):null]})]}),e?null:(0,D.jsx)("div",{className:"min-w-0 flex-1 bg-[linear-gradient(180deg,rgba(6,10,18,0.96),rgba(3,6,14,0.98))]",children:(0,D.jsxs)("div",{className:"mission-scroll flex h-full min-h-0 flex-col overflow-y-auto overscroll-contain",children:[(0,D.jsxs)("div",{className:"shrink-0 border-b border-white/[0.08] px-5 pb-4 pt-5",children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"text-[11px] uppercase tracking-[0.28em] text-slate-500",children:"OpenClaw"}),(0,D.jsx)("h1",{className:"mt-2 font-display text-[1.38rem] text-white",children:"Mission Control"}),(0,D.jsx)("p",{className:"mt-2 text-[12px] leading-5 text-slate-400",children:"Classic operations rail for live workspaces, agents, and model routing."})]}),(0,D.jsx)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.04] p-2.5 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]",children:(0,D.jsx)(sK,{className:"h-4 w-4 text-cyan-200"})})]}),(0,D.jsxs)("div",{className:"mt-4 rounded-[22px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(13,20,34,0.98),rgba(6,10,18,0.96))] p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{className:"flex items-center gap-3",children:[(0,D.jsx)(pT,{tone:r,pulse:"healthy"===a.diagnostics.health}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bb("text-[13px] font-medium capitalize",q),children:a.diagnostics.health}),(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"live"===d?"stream online":d})]})]}),(0,D.jsx)(bd,{variant:"muted",children:a.mode})]}),(0,D.jsxs)("div",{className:"mt-3 rounded-[16px] border border-white/[0.06] bg-white/[0.03] px-3 py-2.5",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Gateway"}),(0,D.jsx)("p",{className:"mt-1.5 text-[13px] text-white",children:s})]}),a.diagnostics.issues.length>0?(0,D.jsx)("div",{className:"mt-3 rounded-[16px] border border-amber-400/15 bg-amber-400/[0.08] px-3 py-2 text-xs text-amber-100",children:a.diagnostics.issues[0]}):null]}),(0,D.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:ai.map(a=>(0,D.jsx)(sN,{label:a.label,badge:a.badge,active:$===a.id,onClick:()=>_(a.id)},a.id))})]}),(0,D.jsxs)("div",{className:"flex-1 space-y-6 p-4",children:["overview"===$?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(sO,{eyebrow:"Overview",title:"System summary",detail:"Current health, active focus, and runtime inventory."}),(0,D.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,D.jsx)(sP,{label:"Workspaces",value:String(a.workspaces.length)}),(0,D.jsx)(sP,{label:"Agents",value:String(a.agents.length)}),(0,D.jsx)(sP,{label:"Models",value:String(a.models.length)}),(0,D.jsx)(sP,{label:"Runs",value:String(a.runtimes.length)})]}),ad?(0,D.jsxs)("div",{className:"rounded-[22px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(6,10,18,0.88))] p-4",children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:ad.name}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.22em] text-slate-500",children:ad.slug})]}),(0,D.jsx)(bd,{variant:"muted",children:ad.health})]}),(0,D.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[10px] uppercase tracking-[0.16em] text-slate-400",children:[(0,D.jsxs)("span",{children:[ad.agentIds.length," agents"]}),(0,D.jsxs)("span",{children:[ad.modelIds.length," models"]}),(0,D.jsxs)("span",{children:[ad.activeRuntimeIds.length," runs"]})]}),(0,D.jsx)("p",{className:"mt-3 text-[12px] text-slate-400",children:function(a){let b=qV(a),c=b.split("/").filter(Boolean).filter(a=>{var b;return b=a,!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(b)});if(c.length<=3)return b;let d="~"===c[0]?"~/":"/";return`${d}…/${c.slice(-2).join("/")}`}(ad.path)})]}):null]}):null,"workspaces"===$?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(sO,{eyebrow:"Home",title:"Workspaces",detail:"Select, rename, or remove real OpenClaw workspaces.",action:(0,D.jsx)(bp,{variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>h(null),children:"All"})}),(0,D.jsx)("div",{className:"space-y-3",children:a.workspaces.map(a=>{let c=a.id===b;return(0,D.jsxs)("div",{className:bb("rounded-[20px] border p-3.5 transition-all",c?"border-cyan-300/[0.35] bg-cyan-400/[0.08] shadow-[0_14px_40px_rgba(34,211,238,0.12)]":"border-white/[0.08] bg-white/[0.03] hover:bg-white/[0.05]"),children:[(0,D.jsx)("button",{type:"button",onClick:()=>h(c?null:a.id),className:"w-full text-left",children:(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:a.name}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a.slug})]}),(0,D.jsx)(bd,{variant:c?"default":"muted",children:a.health})]})}),(0,D.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[10px] uppercase tracking-[0.16em] text-slate-400",children:[(0,D.jsxs)("span",{children:[a.agentIds.length," agents"]}),(0,D.jsxs)("span",{children:[a.modelIds.length," models"]}),(0,D.jsxs)("span",{children:[a.activeRuntimeIds.length," runs"]})]}),(0,D.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,D.jsx)(bp,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>{Q({workspaceId:a.id,name:a.name,directory:"",currentPath:a.path}),A(!0)},children:"Edit"}),(0,D.jsx)(bp,{variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px] text-rose-200 hover:bg-rose-400/10 hover:text-rose-100",onClick:()=>{T(a),V(""),C(!0)},children:"Delete"})]})]},a.id)})})]}):null,"agents"===$?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(sO,{eyebrow:"Apps",title:"Agents",detail:"Create and tune live isolated OpenClaw operators.",action:(0,D.jsx)(rF,{snapshot:a,defaultWorkspaceId:b??a.workspaces[0]?.id??null,onRefresh:i,trigger:(0,D.jsx)(bp,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:0===a.workspaces.length,children:"Add"})})}),(0,D.jsxs)("div",{className:"space-y-3",children:[0===ac.length?(0,D.jsx)("div",{className:"rounded-[18px] border border-white/[0.08] bg-white/[0.03] px-3.5 py-3 text-[12px] text-slate-400",children:"No agents are attached to this workspace yet."}):null,ac.map(c=>(0,D.jsxs)("div",{className:"rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] p-3.5",children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsxs)("p",{className:"truncate text-[13px] font-medium text-white",children:[c.identity.emoji?`${c.identity.emoji} `:"",c.name]}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.22em] text-slate-500",children:c.id}),(0,D.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[(0,D.jsx)(bd,{variant:qr[c.policy.preset].badgeVariant,children:qz(c.policy.preset)}),(0,D.jsx)(bd,{variant:"engaged"===c.status?"default":"muted",children:c.status})]})]}),(0,D.jsx)(sX,{agentName:c.name,onEdit:()=>{O({...function(a,b={}){let c=qy(b.policy?.preset??"worker",b.policy),d=qr[c.preset],e=rD(c.preset,b.heartbeat);return{id:b.id??"",workspaceId:a,modelId:b.modelId??"",name:b.name??d.defaultName,emoji:b.emoji??d.defaultEmoji,theme:b.theme??d.defaultTheme,avatar:b.avatar??"",policy:c,heartbeat:e}}(c.workspaceId,{id:c.id,modelId:"unassigned"===c.modelId?"":c.modelId,name:c.name,emoji:c.identity.emoji??"",theme:c.identity.theme??"",avatar:c.identity.avatar??"",policy:c.policy,heartbeat:rD(c.policy.preset,{enabled:c.heartbeat.enabled,every:c.heartbeat.every??void 0})})}),w(!1),u(!0)},onDelete:()=>{X(c),Z(""),I(!0)}})]}),(0,D.jsx)("div",{className:"mt-3 flex items-center gap-2",children:(0,D.jsx)("div",{className:"min-w-0 flex-1 rounded-full border border-white/[0.08] bg-white/[0.03] px-3 py-2 text-[10px] uppercase tracking-[0.16em] text-slate-400",children:(0,D.jsx)("span",{className:"truncate",children:"unassigned"===c.modelId?"default model":qS(c.modelId)})})}),b?null:(0,D.jsx)("p",{className:"mt-2 truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.workspaces.find(a=>a.id===c.workspaceId)?.name||"Workspace"})]},c.id))]})]}):null,"models"===$?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(sO,{eyebrow:"Models",title:"Models & providers",detail:"Connect providers, choose a default route, and manage live model readiness.",action:(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)(bp,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:o,children:"Add models"}),(0,D.jsxs)(bp,{variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:"running"===f.runState,onClick:j,children:["running"===f.runState?(0,D.jsx)(L,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,D.jsx)(S,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh"]})]})}),(0,D.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,D.jsx)(sP,{label:"Default",value:a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||"Not set"}),(0,D.jsx)(sP,{label:"Providers",value:String(a.diagnostics.modelReadiness.authProviders.filter(a=>a.connected).length)}),(0,D.jsx)(sP,{label:"Routes",value:`${a.diagnostics.modelReadiness.availableModelCount}/${a.diagnostics.modelReadiness.totalModelCount}`})]}),f.systemReady?null:(0,D.jsxs)("div",{className:"rounded-[20px] border border-amber-400/15 bg-amber-400/[0.08] p-4",children:[(0,D.jsx)("p",{className:"text-[13px] font-medium text-amber-50",children:"Finish system setup first"}),(0,D.jsx)("p",{className:"mt-1.5 text-[12px] leading-5 text-amber-100/80",children:"Provider auth and model verification need a live OpenClaw gateway and writable runtime state."}),(0,D.jsx)("div",{className:"mt-3",children:(0,D.jsx)(bp,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:n,children:"Open setup"})})]}),(0,D.jsx)("div",{className:"space-y-3",children:a.diagnostics.modelReadiness.authProviders.map(a=>(0,D.jsx)(sQ,{provider:a,disabled:!f.systemReady||"running"===f.runState,onConnect:()=>m(a.provider)},a.provider))}),(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] p-4",children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"font-display text-[15px] text-white",children:"Default route"}),(0,D.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-slate-400",children:"Pick the model AgentOS should prefer for live work, or discover new routes first."})]}),(0,D.jsxs)(bd,{variant:"muted",children:[a.diagnostics.modelReadiness.localModelCount," local \xb7 ",a.diagnostics.modelReadiness.remoteModelCount," remote"]})]}),(0,D.jsxs)("label",{className:"mt-3 block",children:[(0,D.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Default model"}),(0,D.jsxs)("select",{value:ag,onChange:a=>ab(a.target.value),className:"mt-1.5 h-10 w-full rounded-[14px] border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-100 outline-none",children:[(0,D.jsx)("option",{value:"",children:"Auto choose"}),ae.map(a=>(0,D.jsxs)("option",{value:a.id,children:[a.name," \xb7 ",a.provider]},a.id))]})]}),(0,D.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,D.jsx)(bp,{variant:"default",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:o,children:"Add models"}),(0,D.jsx)(bp,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:!f.systemReady||"running"===f.runState,onClick:()=>l(ag||void 0),children:"running"===f.runState?"Working...":"Use selected model"}),(0,D.jsx)(bp,{variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:!f.systemReady||"running"===f.runState,onClick:k,children:"Discover routes"})]}),a.diagnostics.modelReadiness.issues.length>0?(0,D.jsx)("div",{className:"mt-3 space-y-2",children:a.diagnostics.modelReadiness.issues.map(a=>(0,D.jsx)("div",{className:"rounded-[14px] border border-amber-400/15 bg-amber-400/[0.08] px-3 py-2 text-[12px] leading-5 text-amber-100",children:a},a))}):null]}),af.length>0?(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"font-display text-[15px] text-white",children:"Discovered routes"}),(0,D.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-slate-400",children:"Newly detected remote routes that are not configured in the current model deck yet."})]}),(0,D.jsx)(bd,{variant:"muted",children:af.length})]}),(0,D.jsx)("div",{className:"mt-3 space-y-2",children:af.slice(0,6).map(a=>(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate text-[13px] font-medium text-white",children:a.name}),(0,D.jsxs)("p",{className:"mt-1 text-[10px] uppercase tracking-[0.18em] text-slate-500",children:[sS(a.provider),a.isFree?" \xb7 free":"",a.supportsTools?" \xb7 tools":""]})]}),(0,D.jsx)(bp,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:!f.systemReady||"running"===f.runState,onClick:()=>l(a.modelId),children:"Use"})]},a.modelId))})]}):null,(0,D.jsx)("div",{className:"space-y-3",children:a.models.slice(0,8).map(a=>(0,D.jsxs)("div",{className:"rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] px-3.5 py-3",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate text-[13px] font-medium text-white",children:qS(a.id)}),(0,D.jsx)("p",{className:"mt-1 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a.provider})]}),(0,D.jsx)(bd,{variant:a.local?"success":a.missing?"danger":"muted",children:a.local?"local":a.missing?"missing":"remote"})]}),(0,D.jsxs)("div",{className:"mt-3 flex items-center justify-between text-[11px] text-slate-400",children:[(0,D.jsxs)("span",{children:[qQ(a.contextWindow)," ctx"]}),(0,D.jsxs)("span",{children:[a.usageCount," agents"]})]})]},a.id))}),(0,D.jsx)(sR,{manager:f})]}):null]}),(0,D.jsx)("div",{className:"shrink-0 border-t border-white/[0.08] p-4",children:(0,D.jsx)("div",{className:"rounded-[22px] border border-cyan-300/10 bg-[linear-gradient(180deg,rgba(7,22,31,0.95),rgba(5,13,22,0.95))] p-4 shadow-[0_16px_40px_rgba(0,0,0,0.22)]",children:(0,D.jsxs)("div",{className:"flex items-center gap-3",children:[(0,D.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-full border border-cyan-300/15 bg-cyan-400/[0.12] text-cyan-200",children:(0,D.jsx)(sK,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:ad?.name||"No active workspace"}),(0,D.jsx)("p",{className:"mt-1 text-[12px] text-slate-400",children:ad?`${ad.agentIds.length} agents \xb7 ${ad.activeRuntimeIds.length} runs`:`${a.agents.length} agents \xb7 ${a.runtimes.length} runs`})]})]})})})]})})]}),(0,D.jsx)(dw,{open:z,onOpenChange:A,children:(0,D.jsxs)(d$,{children:[(0,D.jsxs)(d_,{children:[(0,D.jsx)(d1,{children:"Edit OpenClaw workspace"}),(0,D.jsx)(d2,{children:"Renaming a workspace moves the real directory and updates every attached agent binding."})]}),P?(0,D.jsxs)("div",{className:"space-y-4",children:[(0,D.jsx)(sT,{label:"Workspace name",htmlFor:"edit-workspace-name",children:(0,D.jsx)(bq,{id:"edit-workspace-name",value:P.name,onChange:a=>Q(b=>b?{...b,name:a.target.value}:b),placeholder:"Workspace name"})}),(0,D.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.03] px-3.5 py-3",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Current path"}),(0,D.jsx)("p",{className:"mt-1.5 break-all font-mono text-xs text-slate-300",children:P.currentPath})]}),(0,D.jsx)(sT,{label:"Directory override",htmlFor:"edit-workspace-directory",children:(0,D.jsx)(bq,{id:"edit-workspace-directory",value:P.directory,onChange:a=>Q(b=>b?{...b,directory:a.target.value}:b),placeholder:"Leave blank to rename in the same parent folder"})})]}):null,(0,D.jsxs)(d0,{children:[(0,D.jsx)(bp,{variant:"secondary",onClick:()=>A(!1),children:"Cancel"}),(0,D.jsx)(bp,{onClick:aq,disabled:F||!P?.name.trim(),children:F?"Saving…":"Save workspace"})]})]})}),(0,D.jsx)(dw,{open:B,onOpenChange:C,children:(0,D.jsxs)(d$,{children:[(0,D.jsxs)(d_,{children:[(0,D.jsx)(d1,{children:"Delete OpenClaw workspace"}),(0,D.jsx)(d2,{children:"This permanently removes the workspace directory and all OpenClaw agents bound to it."})]}),R?(0,D.jsxs)("div",{className:"space-y-4",children:[(0,D.jsx)("div",{className:"rounded-[20px] border border-rose-400/20 bg-rose-500/[0.08] px-4 py-3.5",children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("div",{className:"mt-0.5 rounded-full border border-rose-300/20 bg-rose-400/10 p-2 text-rose-200",children:(0,D.jsx)(N,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"space-y-1.5 text-sm text-rose-50",children:[(0,D.jsx)("p",{className:"font-medium",children:"This action cannot be undone."}),(0,D.jsx)("p",{className:"text-rose-100/80",children:"OpenClaw will remove the workspace folder from disk and prune the attached agents/state."})]})]})}),(0,D.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,D.jsx)(sZ,{label:"Agents",value:String(aj.length)}),(0,D.jsx)(sZ,{label:"Runs",value:String(al.length)}),(0,D.jsx)(sZ,{label:"Live agents",value:String(ak.length),danger:ak.length>0})]}),(0,D.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.03] px-3.5 py-3",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Workspace path"}),(0,D.jsx)("p",{className:"mt-1.5 break-all font-mono text-xs text-slate-300",children:R.path})]}),ak.length>0||al.length>0?(0,D.jsx)("div",{className:"rounded-[18px] border border-amber-400/15 bg-amber-400/[0.08] px-3.5 py-3 text-sm text-amber-100",children:ak.length>0?`${ak.length} active or recently engaged agents are still attached to this workspace.`:`${al.length} runtime records are still associated with this workspace.`}):null,(0,D.jsx)(sT,{label:`Type ${R.slug} to confirm`,htmlFor:"delete-workspace-confirm",children:(0,D.jsx)(bq,{id:"delete-workspace-confirm",value:U,onChange:a=>V(a.target.value),placeholder:R.slug})})]}):null,(0,D.jsxs)(d0,{children:[(0,D.jsx)(bp,{variant:"secondary",onClick:()=>{C(!1),T(null),V("")},children:"Cancel"}),(0,D.jsx)(bp,{variant:"destructive",onClick:ar,disabled:F||!R||U.trim()!==R.slug,children:F?"Deleting…":"Delete workspace"})]})]})}),(0,D.jsx)(dw,{open:H,onOpenChange:I,children:(0,D.jsxs)(d$,{children:[(0,D.jsxs)(d_,{children:[(0,D.jsx)(d1,{children:"Delete OpenClaw agent"}),(0,D.jsx)(d2,{children:"This removes the selected agent from OpenClaw and detaches its workspace binding."})]}),W?(0,D.jsxs)("div",{className:"space-y-4",children:[(0,D.jsx)("div",{className:"rounded-[20px] border border-rose-400/20 bg-rose-500/[0.08] px-4 py-3.5",children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("div",{className:"mt-0.5 rounded-full border border-rose-300/20 bg-rose-400/10 p-2 text-rose-200",children:(0,D.jsx)(N,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"space-y-1.5 text-sm text-rose-50",children:[(0,D.jsx)("p",{className:"font-medium",children:"This action cannot be undone."}),(0,D.jsx)("p",{className:"text-rose-100/80",children:"OpenClaw will delete this agent, remove its config entry, remove its manifest record, and clean up agent-specific policy/state files. Shared workspace docs and files will remain."})]})]})}),(0,D.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,D.jsx)(sZ,{label:"Status",value:W.status,danger:ao}),(0,D.jsx)(sZ,{label:"Runs",value:String(am.length)}),(0,D.jsx)(sZ,{label:"Workspace",value:an?.name??"Unknown"})]}),(0,D.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.03] px-3.5 py-3",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Agent id"}),(0,D.jsx)("p",{className:"mt-1.5 break-all font-mono text-xs text-slate-300",children:W.id})]}),ao||am.length>0?(0,D.jsx)("div",{className:"rounded-[18px] border border-amber-400/15 bg-amber-400/[0.08] px-3.5 py-3 text-sm text-amber-100",children:ao?"This agent is still active or recently engaged. Delete it only if you want to stop using it entirely.":`${am.length} runtime records are still associated with this agent.`}):null,(0,D.jsx)(sT,{label:`Type ${W.id} to confirm`,htmlFor:"delete-agent-confirm",children:(0,D.jsx)(bq,{id:"delete-agent-confirm",value:Y,onChange:a=>Z(a.target.value),placeholder:W.id})})]}):null,(0,D.jsxs)(d0,{children:[(0,D.jsx)(bp,{variant:"secondary",onClick:()=>{I(!1),X(null),Z("")},children:"Cancel"}),(0,D.jsx)(bp,{variant:"destructive",onClick:as,disabled:J||!W||Y.trim()!==W.id,children:J?"Deleting…":"Delete agent"})]})]})}),(0,D.jsx)(dw,{open:t,onOpenChange:u,children:(0,D.jsxs)(d$,{className:"max-h-[90vh] overflow-y-auto sm:max-w-3xl",children:[(0,D.jsxs)(d_,{children:[(0,D.jsx)(d1,{children:"Edit OpenClaw agent"}),(0,D.jsx)(d2,{children:"Update the selected agent identity, preset, and operating policy."})]}),M?(0,D.jsxs)("div",{className:"space-y-5",children:[(0,D.jsxs)("div",{className:"space-y-3",children:[(0,D.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:"Agent preset"}),(0,D.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:qt.map(a=>(0,D.jsx)(sU,{label:a.label,description:a.description,active:M.policy.preset===a.value,badgeVariant:qr[a.value].badgeVariant,onClick:()=>O(b=>{var c,d;let e,f,g;return b?(c=b,d=a.value,e=qr[c.policy.preset],f=qr[d],g=qy(d),{...c,name:c.name&&c.name!==e.defaultName?c.name:f.defaultName,emoji:c.emoji&&c.emoji!==e.defaultEmoji?c.emoji:f.defaultEmoji,theme:c.theme&&c.theme!==e.defaultTheme?c.theme:f.defaultTheme,policy:g,heartbeat:rE(c.heartbeat,c.policy.preset,d)}):b})},a.value))})]}),(0,D.jsx)(sV,{policy:M.policy}),(0,D.jsx)(sT,{label:"Agent id",htmlFor:"edit-agent-id",children:(0,D.jsx)(bq,{id:"edit-agent-id",value:M.id,disabled:!0})}),(0,D.jsx)(sT,{label:"Display name",htmlFor:"edit-agent-name",children:(0,D.jsx)(bq,{id:"edit-agent-name",value:M.name,onChange:a=>O(b=>b?{...b,name:a.target.value}:b),placeholder:qr[M.policy.preset].defaultName})}),(0,D.jsx)(sT,{label:"Workspace",htmlFor:"edit-agent-workspace",children:(0,D.jsx)(bq,{id:"edit-agent-workspace",value:a.workspaces.find(a=>a.id===M.workspaceId)?.name||M.workspaceId,disabled:!0})}),(0,D.jsx)(sT,{label:"Model",htmlFor:"edit-agent-model",children:(0,D.jsxs)("select",{id:"edit-agent-model",value:M.modelId,onChange:a=>O(b=>b?{...b,modelId:a.target.value}:b),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:[(0,D.jsx)("option",{value:"",children:"Use OpenClaw default"}),a.models.map(a=>(0,D.jsx)("option",{value:a.id,children:a.id},a.id))]})}),(0,D.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,D.jsx)(sT,{label:"Emoji",htmlFor:"edit-agent-emoji",children:(0,D.jsx)(bq,{id:"edit-agent-emoji",value:M.emoji,onChange:a=>O(b=>b?{...b,emoji:a.target.value}:b),placeholder:qr[M.policy.preset].defaultEmoji})}),(0,D.jsx)(sT,{label:"Theme",htmlFor:"edit-agent-theme",children:(0,D.jsx)(bq,{id:"edit-agent-theme",value:M.theme,onChange:a=>O(b=>b?{...b,theme:a.target.value}:b),placeholder:qr[M.policy.preset].defaultTheme})})]}),(0,D.jsx)(sT,{label:"Avatar URL",htmlFor:"edit-agent-avatar",children:(0,D.jsx)(bq,{id:"edit-agent-avatar",value:M.avatar,onChange:a=>O(b=>b?{...b,avatar:a.target.value}:b),placeholder:"https://example.com/avatar.png"})}),(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-white/[0.03] p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:"Advanced policy"}),(0,D.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"Override how this agent handles missing tools, installs, file scope, and network usage."})]}),(0,D.jsx)(bp,{type:"button",variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>w(a=>!a),children:v?"Hide":"Show"})]}),ah?(0,D.jsxs)("div",{className:"mt-4 rounded-[18px] border border-white/10 bg-slate-950/40 p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:"Heartbeat"}),(0,D.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"Use this only for periodic watch or triage agents. Leave it off for normal task execution."})]}),(0,D.jsx)(bp,{type:"button",variant:M.heartbeat.enabled?"default":"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>O(a=>a?{...a,heartbeat:a.heartbeat.enabled?{...a.heartbeat,enabled:!1}:{...a.heartbeat,enabled:!0,every:a.heartbeat.every||rC(a.policy.preset).every}}:a),children:M.heartbeat.enabled?"On":"Off"})]}),M.heartbeat.enabled?(0,D.jsx)("div",{className:"mt-3",children:(0,D.jsx)(sT,{label:"Interval",htmlFor:"edit-agent-heartbeat-every",children:(0,D.jsx)("select",{id:"edit-agent-heartbeat-every",value:M.heartbeat.every,onChange:a=>O(b=>b?{...b,heartbeat:{...b.heartbeat,every:a.target.value}}:b),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:rB.map(a=>(0,D.jsx)("option",{value:a.value,children:a.label},a.value))})})}):null]}):null,v?(0,D.jsxs)("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:[(0,D.jsx)(sW,{label:"Missing tool behavior",htmlFor:"edit-agent-missing-tools",value:M.policy.missingToolBehavior,options:qu,onChange:a=>O(b=>b?{...b,policy:{...b.policy,missingToolBehavior:a}}:b)}),(0,D.jsx)(sW,{label:"Install scope",htmlFor:"edit-agent-install-scope",value:M.policy.installScope,options:qv,onChange:a=>O(b=>b?{...b,policy:{...b.policy,installScope:a}}:b)}),(0,D.jsx)(sW,{label:"File access",htmlFor:"edit-agent-file-access",value:M.policy.fileAccess,options:qw,onChange:a=>O(b=>b?{...b,policy:{...b.policy,fileAccess:a}}:b)}),(0,D.jsx)(sW,{label:"Network access",htmlFor:"edit-agent-network-access",value:M.policy.networkAccess,options:qx,onChange:a=>O(b=>b?{...b,policy:{...b.policy,networkAccess:a}}:b)})]}):null]})]}):null,(0,D.jsxs)(d0,{children:[(0,D.jsx)(bp,{variant:"secondary",onClick:()=>u(!1),children:"Cancel"}),(0,D.jsx)(bp,{onClick:ap,disabled:x||!M,children:x?"Saving…":"Save changes"})]})]})})]})}function sM({icon:a,label:b,active:c,onClick:d}){return(0,D.jsx)("button",{type:"button",onClick:d,title:b,className:bb("inline-flex h-11 w-11 items-center justify-center rounded-[16px] border transition-all",c?"border-cyan-300/20 bg-cyan-400 text-slate-950 shadow-[0_12px_28px_rgba(96,165,250,0.35)]":"border-white/10 bg-white/[0.03] text-slate-400 hover:border-white/15 hover:bg-white/[0.08] hover:text-white"),children:(0,D.jsx)(a,{className:"h-4 w-4"})})}function sN({label:a,badge:b,active:c,onClick:d}){return(0,D.jsxs)("button",{type:"button",onClick:d,className:bb("inline-flex items-center gap-2 rounded-full border px-3 py-2 text-[11px] uppercase tracking-[0.18em] transition-all",c?"border-cyan-300/20 bg-cyan-400 text-slate-950 shadow-[0_10px_24px_rgba(96,165,250,0.28)]":"border-white/[0.08] bg-white/[0.03] text-slate-300 hover:bg-white/[0.07] hover:text-white"),children:[(0,D.jsx)("span",{children:a}),b?(0,D.jsx)("span",{className:bb("rounded-full px-1.5 py-0.5 text-[10px] tracking-normal",c?"bg-slate-950/14 text-slate-950":"bg-white/[0.08] text-slate-400"),children:b}):null]})}function sO({eyebrow:a,title:b,detail:c,action:d}){return(0,D.jsxs)("div",{className:"flex items-end justify-between gap-4",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a}),(0,D.jsx)("h2",{className:"mt-1.5 font-display text-[1.02rem] text-white",children:b}),(0,D.jsx)("p",{className:"mt-1.5 text-[12px] leading-5 text-slate-400",children:c})]}),d?(0,D.jsx)("div",{className:"shrink-0",children:d}):null]})}function sP({label:a,value:b}){return(0,D.jsxs)("div",{className:"rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.88),rgba(7,12,22,0.82))] px-3.5 py-3",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:a}),(0,D.jsx)("p",{className:"mt-1.5 font-display text-[1.2rem] text-white",children:b})]})}function sQ({provider:a,disabled:b,onConnect:c}){var d;let e="openai-codex"===a.provider?"Connect ChatGPT":"openrouter"===a.provider?"Add API key":"Connect";return(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] p-4",children:[(0,D.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:sS(a.provider)}),(0,D.jsx)(bd,{variant:a.connected?"success":a.canLogin?"warning":"muted",children:a.connected?"connected":a.canLogin?"needs auth":"local"})]}),(0,D.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-slate-400",children:a.detail||("openai-codex"===(d=a.provider)?"Use the OpenClaw OpenAI Codex route. If your ChatGPT plan includes Codex access, connect that account here.":"openrouter"===d?"Paste an API key to unlock OpenRouter-hosted routes.":"ollama"===d?"Local model provider. Pull models locally to make new routes available.":"Connect this provider to make its remote routes available inside AgentOS.")})]})}),(0,D.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[a.canLogin?(0,D.jsx)(bp,{variant:a.connected?"ghost":"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:b,onClick:c,children:e}):null,"openai-codex"===a.provider?(0,D.jsx)(bd,{variant:"muted",children:"ChatGPT/Codex route"}):null]})]})}function sR({manager:a}){var b;let[c,d]=(0,E.useState)(!1),e=!!a.manualCommand?.trim().startsWith("openclaw "),f=a.statusMessage||a.resultMessage||"Refresh provider status, connect a route, or choose a default model to keep AgentOS ready.",g=async()=>{if(a.manualCommand)try{await navigator.clipboard.writeText(a.manualCommand),d9.o.success("Command copied.",{description:"Open Terminal and paste the command to continue model setup."})}catch(a){d9.o.error("Could not copy command.",{description:a instanceof Error?a.message:"Clipboard access is unavailable."})}},h=async()=>{if(a.manualCommand&&e){d(!0);try{let b=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:a.manualCommand})}),c=await b.json().catch(()=>null);if(!b.ok||c?.error)throw Error(c?.error||"Unable to open Terminal.");d9.o.success("Terminal opened.",{description:"Finish the OpenClaw provider flow there, then return and refresh this panel."})}catch(a){d9.o.error("Could not open Terminal.",{description:a instanceof Error?a.message:"Open Terminal manually and run the command below."})}finally{d(!1)}}};return(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] p-4",children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)("p",{className:"font-display text-[15px] text-white",children:"Model setup console"}),(0,D.jsx)(bd,{variant:"success"===(b=a.runState)?"success":"error"===b?"warning":"running"===b?"default":"muted",children:"idle"===a.runState?"idle":a.runState})]}),(0,D.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-slate-400",children:f})]}),"running"===a.runState?(0,D.jsx)(L,{className:"mt-0.5 h-4 w-4 animate-spin text-cyan-200"}):(0,D.jsx)(cl,{className:"mt-0.5 h-4 w-4 text-cyan-200"})]}),(0,D.jsx)("pre",{className:"mt-3 max-h-[180px] overflow-auto rounded-[16px] border border-white/[0.08] bg-slate-950/[0.72] px-3 py-2.5 font-mono text-[10px] leading-5 text-slate-300",children:a.log||"No model-management output yet.\n\nProvider auth and model actions will stream here."}),a.manualCommand?(0,D.jsxs)("div",{className:"mt-3 rounded-[16px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Manual command"}),(0,D.jsx)("p",{className:"mt-1.5 break-all font-mono text-[11px] leading-5 text-slate-200",children:a.manualCommand}),(0,D.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,D.jsxs)(bp,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:g,children:[(0,D.jsx)(V,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy command"]}),e?(0,D.jsx)(bp,{variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:h,disabled:c,children:c?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Opening..."]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(U,{className:"mr-1.5 h-3.5 w-3.5"}),"Open Terminal"]})}):null]}),a.docsUrl?(0,D.jsx)("a",{href:a.docsUrl,target:"_blank",rel:"noreferrer",className:"mt-3 inline-flex items-center gap-1 text-[11px] text-slate-300 underline underline-offset-4",children:"Setup docs"}):null]}):null]})}function sS(a){let b=a.trim().toLowerCase();return"openrouter"===b?"OpenRouter":"openai-codex"===b?"OpenAI Codex":"openai"===b?"OpenAI":"anthropic"===b?"Anthropic":"ollama"===b?"Ollama":a.split("-").map(a=>a?a[0].toUpperCase()+a.slice(1):a).join(" ")}function sT({label:a,htmlFor:b,children:c}){return(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)(rA,{htmlFor:b,className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:a}),c]})}function sU({label:a,description:b,active:c,badgeVariant:d,onClick:e}){return(0,D.jsx)("button",{type:"button",onClick:e,className:bb("rounded-[20px] border p-4 text-left transition-colors",c?"border-cyan-300/30 bg-cyan-400/10":"border-white/10 bg-white/[0.03]"),children:(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"space-y-1",children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:a}),(0,D.jsx)("p",{className:"text-xs leading-5 text-slate-400",children:b})]}),(0,D.jsx)(bd,{variant:d,children:c?"selected":"preset"})]})})}function sV({policy:a}){let b=qr[a.preset];return(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-slate-950/50 p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:b.label}),(0,D.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:b.description})]}),(0,D.jsx)(bd,{variant:b.badgeVariant,children:b.label})]}),(0,D.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,D.jsx)(bd,{variant:"muted",children:qA(a.missingToolBehavior)}),(0,D.jsx)(bd,{variant:"muted",children:qB(a.installScope)}),(0,D.jsx)(bd,{variant:"muted",children:qC(a.fileAccess)}),(0,D.jsxs)(bd,{variant:"muted",children:["Network ",qD(a.networkAccess)]})]})]})}function sW({label:a,htmlFor:b,value:c,options:d,onChange:e}){return(0,D.jsx)(sT,{label:a,htmlFor:b,children:(0,D.jsx)("select",{id:b,value:c,onChange:a=>e(a.target.value),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:d.map(a=>(0,D.jsxs)("option",{value:a.value,children:[a.label," - ",a.description]},a.value))})})}function sX({agentName:a,onEdit:b,onDelete:c}){let[d,e]=(0,E.useState)(!1),f=(0,E.useRef)(null);return(0,D.jsxs)("div",{className:"relative",ref:f,children:[(0,D.jsx)("button",{type:"button","aria-label":`${a} actions`,onClick:()=>e(a=>!a),className:"inline-flex rounded-full border border-white/[0.08] bg-white/[0.05] p-1.5 text-slate-300 transition-colors hover:bg-white/[0.1] hover:text-white",children:(0,D.jsx)(jE,{className:"h-3.5 w-3.5"})}),d?(0,D.jsxs)("div",{className:"absolute right-0 top-[calc(100%+8px)] z-30 min-w-[136px] rounded-[14px] border border-white/[0.1] bg-slate-950/96 p-1.5 shadow-[0_20px_44px_rgba(0,0,0,0.42)] backdrop-blur-xl",children:[(0,D.jsx)(sY,{label:"Edit",onClick:()=>{e(!1),b()}}),(0,D.jsx)(sY,{label:"Delete",danger:!0,onClick:()=>{e(!1),c()}})]}):null]})}function sY({label:a,onClick:b,danger:c=!1}){return(0,D.jsx)("button",{type:"button",className:bb("flex w-full items-center rounded-[10px] px-2.5 py-2 text-left text-[11px] transition-colors",c?"text-rose-200 hover:bg-rose-400/10 hover:text-rose-100":"text-slate-200 hover:bg-white/[0.06] hover:text-white"),onClick:b,children:(0,D.jsx)("span",{children:a})})}function sZ({label:a,value:b,danger:c=!1}){return(0,D.jsxs)("div",{className:bb("rounded-[18px] border px-3.5 py-3",c?"border-amber-300/20 bg-amber-400/[0.08]":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:a}),(0,D.jsx)("p",{className:bb("mt-1.5 font-display text-lg",c?"text-amber-100":"text-white"),children:b})]})}let s$=K("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);function s_({progress:a,className:b}){return(0,D.jsxs)("div",{className:bb("rounded-[18px] border border-white/10 bg-slate-950/50 p-4",b),children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"max-w-2xl",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a.title}),(0,D.jsx)("p",{className:"mt-2 text-sm text-slate-200",children:a.description})]}),(0,D.jsxs)("div",{className:"shrink-0 text-right",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Progress"}),(0,D.jsxs)("p",{className:"mt-1 text-lg font-semibold text-white",children:[a.percent,"%"]})]})]}),(0,D.jsx)("div",{className:"mt-4 h-2 overflow-hidden rounded-full bg-white/8",children:(0,D.jsx)("div",{className:"h-full rounded-full bg-cyan-300/85 transition-[width] duration-500 ease-out",style:{width:`${a.percent}%`}})}),(0,D.jsx)("div",{className:"mt-4 space-y-2.5",children:a.steps.map((a,b)=>{let c="done"===a.status?"border-emerald-400/20 bg-emerald-400/10":"active"===a.status?"border-cyan-400/25 bg-cyan-400/10":"error"===a.status?"border-amber-400/25 bg-amber-400/10":"border-white/10 bg-white/[0.03]",d="done"===a.status?"border-emerald-300/30 bg-emerald-300/15 text-emerald-100":"active"===a.status?"border-cyan-300/30 bg-cyan-300/15 text-cyan-100":"error"===a.status?"border-amber-300/30 bg-amber-300/15 text-amber-100":"border-white/10 bg-slate-950/65 text-slate-400",e="done"===a.status?"bg-emerald-300/85":"active"===a.status?"bg-cyan-300/85":"error"===a.status?"bg-amber-300/85":"bg-transparent";return(0,D.jsx)("div",{className:bb("rounded-[14px] border px-3 py-2.5 transition-colors",c),children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("span",{className:bb("mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-[10px] font-medium",d),children:"done"===a.status?(0,D.jsx)(Z,{className:"h-3.5 w-3.5"}):"active"===a.status?(0,D.jsx)(L,{className:"h-3.5 w-3.5 animate-spin"}):"error"===a.status?(0,D.jsx)(N,{className:"h-3.5 w-3.5"}):b+1}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[(0,D.jsx)("p",{className:"text-sm text-white",children:a.label}),(0,D.jsxs)("span",{className:"text-xs tabular-nums text-slate-400",children:[a.percent,"%"]})]}),(0,D.jsx)("p",{className:"mt-0.5 text-xs leading-5 text-slate-400",children:a.detail||a.description}),(0,D.jsx)("div",{className:"mt-2 h-1.5 overflow-hidden rounded-full bg-white/8",children:(0,D.jsx)("div",{className:bb("h-full rounded-full transition-[width] duration-500 ease-out",e),style:{width:`${a.percent}%`}})}),a.activities.length>0?(0,D.jsx)("div",{className:"mt-2.5 space-y-1.5",children:a.activities.map(a=>(0,D.jsxs)("div",{className:"flex items-start gap-2 text-[11px] leading-5 text-slate-300",children:[(0,D.jsx)("span",{className:bb("mt-[7px] h-1.5 w-1.5 shrink-0 rounded-full","done"===a.status&&"bg-emerald-300","active"===a.status&&"bg-cyan-300","error"===a.status&&"bg-amber-300","pending"===a.status&&"bg-slate-500")}),(0,D.jsx)("span",{className:"min-w-0",children:a.message})]},a.id))}):null]})]})},a.id)})})]})}let s0=K("rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]),s1=K("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),s2=K("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),s3=K("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),s4=K("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),s5=K("lock-keyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]),s6=K("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),s7=[{id:"company",label:"Company",icon:K("building-2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]])},{id:"product",label:"Product",icon:K("briefcase-business",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M22 13a18.15 18.15 0 0 1-20 0",key:"12hx5q"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]])},{id:"workspace",label:"Workspace",icon:K("boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]])},{id:"team",label:"Team",icon:co},{id:"operations",label:"Operations",icon:sK},{id:"deploy",label:"Deploy",icon:s0}],s8=[{id:"intake",label:"Intake",section:"company"},{id:"context-harvest",label:"Context",section:"workspace"},{id:"team-synthesis",label:"Team",section:"team"},{id:"pressure-test",label:"Review",section:"operations"},{id:"decision-lock",label:"Lock",section:"deploy"},{id:"ready",label:"Ready",section:"deploy"},{id:"deploying",label:"Deploying",section:"deploy"},{id:"deployed",label:"Live",section:"deploy"}];function s9(a){return s8.find(b=>b.id===a)?.label??"Draft"}function ta(a,b){switch(b){case"company":{let b=[a.company.name,a.company.mission,a.company.targetCustomer].filter(a=>!a.trim()).length;return 0===b?{label:"Ready to review",variant:"success"}:{label:`${b} core field${1===b?"":"s"} missing`,variant:"warning"}}case"product":{let b=[+!a.product.offer.trim(),a.product.scopeV1.length>0?0:1,a.product.launchPriority.length>0?0:1].reduce((a,b)=>a+b,0);return 0===b?{label:"Scope is defined",variant:"success"}:{label:`${b} product decision${1===b?"":"s"} pending`,variant:"warning"}}case"workspace":{let b=+!a.workspace.name.trim();return"clone"!==a.workspace.sourceMode||a.workspace.repoUrl?.trim()||(b+=1),"existing"!==a.workspace.sourceMode||a.workspace.existingPath?.trim()||(b+=1),0===b?{label:"Provisioning path set",variant:"success"}:{label:`${b} workspace input${1===b?"":"s"} missing`,variant:"warning"}}case"team":{let b=a.team.persistentAgents.filter(a=>a.enabled).length,c=a.team.persistentAgents.some(a=>a.enabled&&a.isPrimary);if(0===b)return{label:"Add at least one agent",variant:"danger"};if(!c)return{label:"Primary agent missing",variant:"warning"};return{label:`${b} active agent${1===b?"":"s"}`,variant:"success"}}case"operations":{let b=a.operations.workflows.filter(a=>a.enabled).length,c=a.operations.automations.filter(a=>a.enabled).length;if(0===b&&0===c)return{label:"No runtime loops yet",variant:"warning"};return{label:`${b} workflows, ${c} automations`,variant:"success"}}default:if(!a.intake.reviewRequested&&"deploying"!==a.status&&"deployed"!==a.status)return{label:"Review not opened yet",variant:"muted"};if(a.deploy.blockers.length>0)return{label:`${a.deploy.blockers.length} blocker${1===a.deploy.blockers.length?"":"s"}`,variant:"danger"};if(a.deploy.warnings.length>0)return{label:`${a.deploy.warnings.length} warning${1===a.deploy.warnings.length?"":"s"}`,variant:"warning"};return{label:"Ready to deploy",variant:"success"}}}function tb(a,b){switch(b){case"company":return a.company.name?`${a.company.name}${a.company.mission?` \xb7 ${a.company.mission}`:""}`:"Mission and audience are still being shaped.";case"product":return a.product.offer||"Offer and V1 scope are still being drafted.";case"workspace":return`${tc(a.workspace.template)} \xb7 ${tc(a.workspace.sourceMode)}`;case"team":return`${a.team.persistentAgents.filter(a=>a.enabled).length} agents drafted`;case"operations":return`${a.operations.workflows.filter(a=>a.enabled).length} workflows \xb7 ${a.operations.automations.filter(a=>a.enabled).length} automations`;default:return a.intake.reviewRequested?"Deploy review is open.":"Review not started."}}function tc(a){return a.split(/[-_]/g).filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}let td={workspaceOnly:!0,generateStarterDocs:!0,generateMemory:!0,kickoffMission:!0},te={software:[{id:"builder",role:"Builder",name:"Builder",emoji:"\uD83D\uDEE0️",theme:"amber",skillId:"project-builder",isPrimary:!0,description:"Implements requested changes and drives delivery forward."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Reviews work for correctness, regressions, and product risk."},{id:"tester",role:"Tester",name:"Tester",emoji:"\uD83E\uDDEA",theme:"emerald",skillId:"project-tester",description:"Validates behavior, tests, and environment assumptions."},{id:"learner",role:"Learner",name:"Learner",emoji:"\uD83E\uDDE0",theme:"cyan",skillId:"project-learner",description:"Consolidates durable project knowledge and memory."}],frontend:[{id:"builder",role:"Builder",name:"Builder",emoji:"\uD83D\uDEE0️",theme:"amber",skillId:"project-builder",isPrimary:!0,description:"Implements UI and frontend product work."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Reviews interaction, correctness, and regression risk."},{id:"tester",role:"Tester",name:"Tester",emoji:"\uD83E\uDDEA",theme:"emerald",skillId:"project-tester",description:"Checks behavior, responsive states, and verification gaps."},{id:"learner",role:"Learner",name:"Learner",emoji:"\uD83E\uDDE0",theme:"cyan",skillId:"project-learner",description:"Maintains stable product and implementation knowledge."},{id:"browser",role:"Browser Agent",name:"Browser Agent",emoji:"\uD83C\uDF10",theme:"blue",skillId:"project-browser",description:"Exercises browser flows, captures UI evidence, and validates user paths."}],backend:[{id:"builder",role:"Builder",name:"Builder",emoji:"\uD83D\uDEE0️",theme:"amber",skillId:"project-builder",isPrimary:!0,description:"Implements service, API, and infrastructure changes."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Catches correctness, data handling, and operational risks."},{id:"tester",role:"Tester",name:"Tester",emoji:"\uD83E\uDDEA",theme:"emerald",skillId:"project-tester",description:"Validates APIs, background jobs, migrations, and failure paths."},{id:"learner",role:"Learner",name:"Learner",emoji:"\uD83E\uDDE0",theme:"cyan",skillId:"project-learner",description:"Maintains architecture notes and durable operational memory."}],research:[{id:"researcher",role:"Research Lead",name:"Research Lead",emoji:"\uD83D\uDD2C",theme:"violet",skillId:"project-researcher",isPrimary:!0,description:"Runs investigations, frames questions, and synthesizes findings."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Pressure-tests claims, assumptions, and interpretation quality."},{id:"learner",role:"Archivist",name:"Archivist",emoji:"\uD83E\uDDE0",theme:"cyan",skillId:"project-learner",description:"Distills durable research notes, memory, and takeaways."}],content:[{id:"strategist",role:"Strategist",name:"Strategist",emoji:"\uD83D\uDCE3",theme:"orange",skillId:"project-strategist",isPrimary:!0,description:"Frames audience, goals, positioning, and campaign direction."},{id:"writer",role:"Writer",name:"Writer",emoji:"✍️",theme:"sky",skillId:"project-writer",description:"Drafts content, messaging, and campaign assets."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Edits for clarity, quality, and consistency."},{id:"analyst",role:"Analyst",name:"Analyst",emoji:"\uD83D\uDCC8",theme:"emerald",skillId:"project-analyst",description:"Tracks results, experiments, and performance insights."}]};function tf(a,b){let c=["AGENTS.md","SOUL.md","IDENTITY.md","TOOLS.md","HEARTBEAT.md"];return b.generateMemory&&c.push("MEMORY.md","memory/blueprint.md","memory/decisions.md"),b.generateStarterDocs&&c.push("docs/brief.md","docs/architecture.md","deliverables/README.md"),"frontend"===a&&c.push("docs/ux-notes.md"),"backend"===a&&c.push("docs/service-map.md"),"research"===a&&c.push("docs/research-plan.md"),"content"===a&&c.push("docs/content-brief.md"),c}let tg=Object.fromEntries([{value:"software",label:"Software project",description:"Balanced software delivery setup for product and engineering work."},{value:"frontend",label:"Frontend app",description:"UI-focused team with browser coverage and product-facing documentation."},{value:"backend",label:"Backend/API",description:"Service and API template with strong testing and delivery defaults."},{value:"research",label:"Research",description:"Exploration-first workspace for investigation, synthesis, and durable notes."},{value:"content",label:"Content/Growth",description:"Campaign and content setup for strategy, writing, review, and analytics."}].map(a=>[a.value,a.label]));function th({className:a,surfaceTheme:b,mode:c,snapshot:d,plan:e,resolvedName:f,resolvedTemplate:g,sourceAnalysis:h,workspacePath:i,notice:j,basicRules:k,basicPreset:l,onBasicPresetChange:m,onBasicRuleToggle:n,progress:o}){let p="light"===b,q=(0,E.useRef)({});(0,E.useRef)(null);let[r,s]=(0,E.useState)(null);return(0,E.useMemo)(()=>(function({mode:a,plan:b,notice:c,progress:d,resolvedName:e,resolvedTemplate:f,basicRules:g,basicPreset:h,sourceAnalysis:i,workspacePath:j}){return{mode:a,noticeSignature:c?`${c.tone}:${c.title}:${c.description}`:"",progressSignature:d?JSON.stringify(d):"",basic:{architectSignature:b?`${b.architectSummary}:${b.intake.confirmations.join("|")}`:"",summarySignature:[e,f,i.kind,i.label,i.hint,i.repoUrl??"",i.existingPath??"",i.websiteUrl??"",j].join(":"),defaultsSignature:`${h}:${g.generateStarterDocs}:${g.generateMemory}:${g.kickoffMission}`},advanced:{stage:b?.stage??null,readinessSignature:b?`${b.readinessScore}:${b.architectSummary}`:"",deploySignature:b?`${b.intake.reviewRequested}:${b.deploy.blockers.join("|")}:${b.deploy.warnings.join("|")}`:"",sectionSignatures:Object.fromEntries(s7.map(a=>[a.id,b?`${ta(b,a.id).label}:${ta(b,a.id).variant}:${tb(b,a.id)}`:""]))}}})({mode:c,plan:e,notice:j,progress:o,resolvedName:f,resolvedTemplate:g,basicRules:k,basicPreset:l,sourceAnalysis:h,workspacePath:i}),[l,k,c,j,e,o,f,g,h,i]),(0,D.jsx)("aside",{className:bb("min-h-0 border-t lg:border-l lg:border-t-0",p?"border-[#ebe5dd] bg-[#f7f2eb]":"border-white/10 bg-[rgba(5,9,18,0.92)]",a),children:(0,D.jsx)(qp,{className:"h-full",children:(0,D.jsxs)("div",{className:"space-y-4 p-4 md:p-5",children:[(0,D.jsx)(tj,{surfaceTheme:b,title:"basic"===c?"Workspace draft":"Workspace blueprint",subtitle:"basic"===c?"Architect is filling this live while the fast create path stays available.":"Live structured view of what Architect is shaping through conversation."}),(0,D.jsx)(ti,{sectionKey:"setup-speed",activeSection:r,surfaceTheme:b,register:a=>{q.current["setup-speed"]=a},children:(0,D.jsx)(to,{surfaceTheme:b,mode:c,preset:l,onPresetChange:m})}),j?(0,D.jsx)(ti,{sectionKey:"notice",activeSection:r,surfaceTheme:b,register:a=>{q.current.notice=a},children:(0,D.jsxs)("div",{className:bb("rounded-[18px] border px-4 py-3","warning"===j.tone?p?"border-amber-200 bg-amber-50 text-amber-900":"border-amber-400/25 bg-amber-400/10 text-amber-100":p?"border-[#e3ddd4] bg-white text-[#3f3933]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,D.jsx)("p",{className:bb("text-[11px] uppercase tracking-[0.18em]",p?"text-[#9c9389]":"text-slate-500"),children:j.title}),(0,D.jsx)("p",{className:"mt-1 text-[13px] leading-6",children:j.description})]})}):null,o?(0,D.jsx)(ti,{sectionKey:"progress",activeSection:r,surfaceTheme:b,register:a=>{q.current.progress=a},children:(0,D.jsx)(s_,{progress:o,className:bb(p?"border-[#e5ded3] bg-white text-slate-900 [&_p]:text-inherit":"border-white/10 bg-slate-950/50")})}):null,"basic"===c?(0,D.jsxs)("div",{className:"space-y-3",children:[e?(0,D.jsx)(ti,{sectionKey:"architect-readout",activeSection:r,surfaceTheme:b,register:a=>{q.current["architect-readout"]=a},children:(0,D.jsx)("div",{className:bb("rounded-[22px] border p-4",p?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("span",{className:bb("inline-flex size-9 shrink-0 items-center justify-center rounded-full border",p?"border-[#e7e0d6] bg-[#faf6f1] text-[#5e5750]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,D.jsx)(co,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("p",{className:bb("text-[11px] uppercase tracking-[0.18em]",p?"text-[#a0978b]":"text-slate-500"),children:"Architect readout"}),(0,D.jsx)("p",{className:bb("mt-1 text-[13px] leading-6",p?"text-[#171410]":"text-white"),children:e.architectSummary}),e.intake.confirmations.length>0?(0,D.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,D.jsx)("p",{className:bb("text-[11px] uppercase tracking-[0.16em]",p?"text-[#8d8276]":"text-slate-500"),children:"Next decisions"}),e.intake.confirmations.slice(0,2).map(a=>(0,D.jsx)("div",{className:bb("rounded-[16px] border px-3 py-2 text-[12px] leading-5",p?"border-[#e8e0d6] bg-[#faf6f1] text-[#5d554d]":"border-white/10 bg-white/[0.05] text-slate-300"),children:a},a))]}):null]})]})})}):null,(0,D.jsx)(ti,{sectionKey:"summary",activeSection:r,surfaceTheme:b,register:a=>{q.current.summary=a},children:(0,D.jsx)(tk,{surfaceTheme:b,resolvedName:f,resolvedTemplate:g,sourceAnalysis:h,workspacePath:i,workspaceRoot:d.diagnostics.workspaceRoot,summaryLabel:e?"Updated from Architect's latest read of the conversation.":"Resolved from your quick setup."})}),(0,D.jsx)(ti,{sectionKey:"defaults",activeSection:r,surfaceTheme:b,register:a=>{q.current.defaults=a},children:(0,D.jsxs)("div",{className:bb("rounded-[22px] border p-4",p?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,D.jsx)("p",{className:bb("text-[11px] uppercase tracking-[0.18em]",p?"text-[#a0978b]":"text-slate-500"),children:"Fast-path defaults"}),(0,D.jsx)(tn,{surfaceTheme:b,template:g,rules:k,preset:l,onRuleToggle:n})]})})]}):e?(0,D.jsxs)("div",{className:"space-y-3",children:[(0,D.jsx)(ti,{sectionKey:"readiness",activeSection:r,surfaceTheme:b,register:a=>{q.current.readiness=a},children:(0,D.jsx)("div",{className:bb("rounded-[22px] border p-4",p?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bb("text-[11px] uppercase tracking-[0.18em]",p?"text-[#a0978b]":"text-slate-500"),children:"Readiness"}),(0,D.jsxs)("p",{className:bb("mt-1 text-[28px] font-semibold tracking-[-0.03em]",p?"text-[#181612]":"text-white"),children:[e.readinessScore,"%"]}),(0,D.jsx)("p",{className:bb("text-[13px] leading-6",p?"text-[#6e665d]":"text-slate-300"),children:e.architectSummary})]}),(0,D.jsx)("span",{className:bb("inline-flex size-10 items-center justify-center rounded-full border",p?"border-[#e5ddd2] bg-[#f5f0e8] text-[#6a635b]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,D.jsx)(co,{className:"h-4 w-4"})})]})})}),s7.map(a=>{let c=ta(e,a.id),d=a.icon,f=`section-${a.id}`;return(0,D.jsx)(ti,{sectionKey:f,activeSection:r,surfaceTheme:b,register:a=>{q.current[f]=a},children:(0,D.jsx)("div",{className:bb("rounded-[22px] border p-4",p?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("span",{className:bb("inline-flex size-9 shrink-0 items-center justify-center rounded-full border",p?"border-[#e7e0d6] bg-[#faf6f1] text-[#5e5750]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,D.jsx)(d,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,D.jsx)("p",{className:bb("text-[14px] font-semibold",p?"text-[#171410]":"text-white"),children:a.label}),(0,D.jsx)(tm,{surfaceTheme:b,tone:c.variant,label:c.label})]}),(0,D.jsx)("p",{className:bb("mt-1 text-[13px] leading-6",p?"text-[#70685f]":"text-slate-300"),children:tb(e,a.id)})]})]})})},a.id)}),(0,D.jsx)(ti,{sectionKey:"deploy-review",activeSection:r,surfaceTheme:b,register:a=>{q.current["deploy-review"]=a},children:(0,D.jsxs)("div",{className:bb("rounded-[22px] border p-4",p?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)(s0,{className:bb("h-4 w-4",p?"text-[#5f5952]":"text-slate-300")}),(0,D.jsx)("p",{className:bb("text-[14px] font-semibold",p?"text-[#171410]":"text-white"),children:"Deploy review"})]}),e.deploy.blockers.length>0?(0,D.jsx)(tr,{surfaceTheme:b,title:"Blockers",tone:"danger",items:e.deploy.blockers}):null,e.deploy.warnings.length>0?(0,D.jsx)(tr,{surfaceTheme:b,title:"Warnings",tone:"warning",items:e.deploy.warnings}):null,0===e.deploy.blockers.length&&0===e.deploy.warnings.length?(0,D.jsx)("p",{className:bb("mt-3 text-[13px] leading-6",p?"text-[#70685f]":"text-slate-300"),children:"Architect has not surfaced blockers or warnings yet. Request review when the blueprint feels directionally right."}):null]})})]}):(0,D.jsxs)("div",{className:bb("rounded-[22px] border border-dashed p-5",p?"border-[#ddd5ca] bg-white/80":"border-white/10 bg-white/[0.04]"),children:[(0,D.jsx)("p",{className:bb("text-[14px] font-medium",p?"text-[#211d19]":"text-white"),children:"Architect is preparing the blueprint."}),(0,D.jsx)("p",{className:bb("mt-1 text-[13px] leading-6",p?"text-[#776f65]":"text-slate-300"),children:"Once the first plan is ready, this pane will start reflecting the structured workspace draft."})]})]})})})}function ti({sectionKey:a,activeSection:b,surfaceTheme:c,register:d,children:e}){return(0,D.jsx)("div",{ref:d,className:bb("scroll-mt-6 rounded-[26px] transition-all duration-500",b===a&&("light"===c?"ring-2 ring-[#d8b184]/70 shadow-[0_0_0_1px_rgba(216,177,132,0.18),0_18px_36px_rgba(102,78,47,0.16)]":"ring-2 ring-cyan-300/45 shadow-[0_0_0_1px_rgba(103,232,249,0.14),0_18px_36px_rgba(6,182,212,0.16)]")),children:e})}function tj({surfaceTheme:a,title:b,subtitle:c}){let d="light"===a;return(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bb("text-[11px] uppercase tracking-[0.18em]",d?"text-[#8b7262]":"text-slate-500"),children:b}),(0,D.jsx)("p",{className:bb("mt-1 text-[13px] leading-6",d?"text-[#705b4d]":"text-slate-300"),children:c})]})}function tk({surfaceTheme:a,resolvedName:b,resolvedTemplate:c,sourceAnalysis:d,workspacePath:e,workspaceRoot:f,summaryLabel:g}){let h="light"===a;return(0,D.jsx)("div",{className:bb("rounded-[22px] border p-4",h?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("span",{className:bb("inline-flex size-9 shrink-0 items-center justify-center rounded-full border",h?"border-[#e7e0d6] bg-[#faf6f1] text-[#5e5750]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,D.jsx)(cl,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("p",{className:bb("text-[11px] uppercase tracking-[0.18em]",h?"text-[#a0978b]":"text-slate-500"),children:"Fast-path snapshot"}),(0,D.jsx)("p",{className:bb("mt-1 text-[12px] leading-5",h?"text-[#776f65]":"text-slate-400"),children:g}),(0,D.jsxs)("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[(0,D.jsx)(tl,{surfaceTheme:a,label:"Name",value:b,icon:cl}),(0,D.jsx)(tl,{surfaceTheme:a,label:"Template",value:tg[c],icon:s1}),(0,D.jsx)(tl,{surfaceTheme:a,label:"Source",value:d.label,icon:"clone"===d.kind?s2:"website"===d.kind?s3:s4}),(0,D.jsx)(tl,{surfaceTheme:a,label:"Path",value:e,detail:`Root: ${f}`,icon:s4,mono:!0})]})]})]})})}function tl({surfaceTheme:a,label:b,value:c,icon:d,detail:e,mono:f=!1}){let g="light"===a;return(0,D.jsx)("div",{className:bb("rounded-[18px] border px-3 py-3",g?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]"),children:(0,D.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,D.jsx)("span",{className:bb("mt-0.5 inline-flex size-7 shrink-0 items-center justify-center rounded-full border",g?"border-[#e0d7cc] bg-white text-[#615a52]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,D.jsx)(d,{className:"h-3.5 w-3.5"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("p",{className:bb("text-[11px] uppercase tracking-[0.16em]",g?"text-[#8d8276]":"text-slate-500"),children:b}),(0,D.jsx)("p",{className:bb("mt-1 break-words text-[13px] font-medium leading-5",g?"text-[#171410]":"text-white",f&&"font-mono text-[12px]"),children:c}),e?(0,D.jsx)("p",{className:bb("mt-1 text-[11px] leading-5",g?"text-[#776f65]":"text-slate-400"),children:e}):null]})]})})}function tm({surfaceTheme:a,tone:b,label:c}){return(0,D.jsx)("span",{className:bb("inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-[0.16em]","muted"===b&&("light"===a?"border-[#e4ddd3] bg-[#f7f2eb] text-[#746b61]":"border-white/10 bg-white/[0.05] text-slate-300"),"success"===b&&"border-emerald-200 bg-emerald-50 text-emerald-700","warning"===b&&"border-amber-200 bg-amber-50 text-amber-700","danger"===b&&"border-rose-200 bg-rose-50 text-rose-700"),children:c})}function tn({surfaceTheme:a,template:b,rules:c,preset:d,onRuleToggle:e}){var f,g,h;let i,j="light"===a,k=(f=b,g=c,i="frontend"===(h=f)?["docs/ux-notes.md"]:"backend"===h?["docs/service-map.md"]:"research"===h?["docs/research-plan.md"]:"content"===h?["docs/content-brief.md"]:[],[{id:"core",title:"Core agent files",description:"Required bootstrap files that define the workspace identity and operating instructions.",checked:!0,locked:!0,files:["AGENTS.md","SOUL.md","IDENTITY.md","TOOLS.md","HEARTBEAT.md"],rule:void 0},{id:"docs",title:"Starter docs",description:"Brief, architecture notes, and the initial deliverables handoff scaffold.",checked:g.generateStarterDocs,locked:!1,files:["docs/brief.md","docs/architecture.md","deliverables/README.md",...i],rule:"generateStarterDocs"},{id:"memory",title:"Memory files",description:"Durable project memory for blueprint decisions and accumulated context.",checked:g.generateMemory,locked:!1,files:["MEMORY.md","memory/blueprint.md","memory/decisions.md"],rule:"generateMemory"},{id:"kickoff",title:"Kickoff mission",description:"Runs the first mission immediately after bootstrap so the agent starts with momentum.",checked:g.kickoffMission,locked:!1,files:[],rule:"kickoffMission"}]),l=tf(b,c);return(0,D.jsxs)("div",{className:"mt-3 space-y-4",children:["custom"===d?(0,D.jsx)(tm,{surfaceTheme:a,tone:"muted",label:"Custom mix"}):null,(0,D.jsx)("div",{className:"space-y-2",children:k.map(b=>(0,D.jsx)("button",{type:"button",onClick:b.rule?()=>e(b.rule):void 0,disabled:!b.rule,className:bb("w-full rounded-[18px] border px-3 py-3 text-left transition-colors",j?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]",b.rule?j?"hover:border-[#d8c9ba] hover:bg-[#f6efe6]":"hover:border-white/15 hover:bg-white/[0.05]":"cursor-default"),children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("span",{className:bb("mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-md border",b.checked?j?"border-[#1f1b17] bg-[#1f1b17] text-white":"border-cyan-300 bg-cyan-300 text-slate-950":j?"border-[#d9d0c6] bg-white text-transparent":"border-white/15 bg-transparent text-transparent"),children:(0,D.jsx)(Z,{className:"h-3 w-3"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,D.jsx)("p",{className:bb("text-[13px] font-medium",j?"text-[#171410]":"text-white"),children:b.title}),b.locked?(0,D.jsxs)("span",{className:bb("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",j?"border-[#e0d7cc] bg-white text-[#7a7168]":"border-white/10 bg-white/[0.05] text-slate-400"),children:[(0,D.jsx)(s5,{className:"h-3 w-3"}),"Required"]}):null]}),(0,D.jsx)("p",{className:bb("mt-1 text-[12px] leading-5",j?"text-[#776f65]":"text-slate-400"),children:b.description}),b.files.length>0?(0,D.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:b.files.map(b=>(0,D.jsx)(tq,{surfaceTheme:a,label:b},b))}):null]})]})},b.id))}),(0,D.jsxs)("div",{className:bb("rounded-[18px] border px-3 py-3",j?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)(s6,{className:bb("h-4 w-4",j?"text-[#5f5952]":"text-slate-300")}),(0,D.jsx)("p",{className:bb("text-[12px] uppercase tracking-[0.16em]",j?"text-[#8d8276]":"text-slate-500"),children:"Will create"})]}),(0,D.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[l.map(b=>(0,D.jsx)(tq,{surfaceTheme:a,label:b},b)),c.kickoffMission?(0,D.jsx)(tq,{surfaceTheme:a,label:"Kickoff mission",accent:!0}):null]})]}),(0,D.jsxs)("p",{className:bb("text-[13px] leading-6",j?"text-[#70685f]":"text-slate-300"),children:["fastest"===d?"Fastest setup keeps only the core agent files and skips kickoff.":"custom"===d?"Custom setup keeps only the extras you left enabled.":"Standard setup creates starter docs, memory, and a kickoff mission."," Need more control later? Switch to Advanced and keep the same draft."]})]})}function to({surfaceTheme:a,mode:b,preset:c,onPresetChange:d}){let e="light"===a;return(0,D.jsxs)("div",{className:bb("rounded-[22px] border p-4",e?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bb("text-[11px] uppercase tracking-[0.18em]",e?"text-[#a0978b]":"text-slate-500"),children:"Setup speed"}),(0,D.jsx)("p",{className:bb("mt-1 text-[13px] leading-6",e?"text-[#70685f]":"text-slate-300"),children:"basic"===b?"Choose how much scaffold the fast create path should write before the workspace opens.":"These presets also work in Advanced and update the workspace bootstrap rules."})]}),"custom"===c?(0,D.jsx)(tm,{surfaceTheme:a,tone:"muted",label:"Custom mix"}):null]}),(0,D.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[(0,D.jsx)(tp,{surfaceTheme:a,active:"standard"===c,title:"Standard",description:"Docs, memory, and kickoff mission",onClick:()=>d("standard")}),(0,D.jsx)(tp,{surfaceTheme:a,active:"fastest"===c,title:"Fastest setup",description:"Core files only, no kickoff",onClick:()=>d("fastest")})]})]})}function tp({surfaceTheme:a,active:b,title:c,description:d,onClick:e}){let f="light"===a;return(0,D.jsxs)("button",{type:"button",onClick:e,className:bb("rounded-[18px] border px-3 py-3 text-left transition-colors",b?f?"border-[#1f1b17] bg-[#1f1b17] text-white":"border-cyan-300 bg-cyan-300/15 text-cyan-50":f?"border-[#e8e0d6] bg-[#faf6f1] text-[#171410] hover:border-[#d8c9ba] hover:bg-[#f6efe6]":"border-white/10 bg-white/[0.03] text-white hover:border-white/15 hover:bg-white/[0.05]"),children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)(s1,{className:"h-4 w-4"}),(0,D.jsx)("p",{className:"text-[13px] font-medium",children:c})]}),(0,D.jsx)("p",{className:bb("mt-1 text-[12px] leading-5",b?"opacity-80":f?"text-[#776f65]":"text-slate-400"),children:d})]})}function tq({surfaceTheme:a,label:b,accent:c=!1}){return(0,D.jsxs)("span",{className:bb("inline-flex items-center rounded-full border px-2.5 py-1 font-mono text-[10px]",c?"light"===a?"border-[#d8b184] bg-[#f8efe3] text-[#7c5a34]":"border-cyan-300/30 bg-cyan-300/10 text-cyan-100":"light"===a?"border-[#e4ddd3] bg-white text-[#6c645b]":"border-white/10 bg-white/[0.05] text-slate-300"),children:[(0,D.jsx)(Z,{className:"mr-1 h-3 w-3"}),b]})}function tr({surfaceTheme:a,title:b,tone:c,items:d}){let e="light"===a;return(0,D.jsxs)("div",{className:bb("mt-3 rounded-[18px] border px-4 py-3","danger"===c?e?"border-rose-200 bg-rose-50":"border-rose-400/25 bg-rose-400/10":e?"border-amber-200 bg-amber-50":"border-amber-400/25 bg-amber-400/10"),children:[(0,D.jsx)("p",{className:bb("text-[11px] uppercase tracking-[0.18em]",e?"text-[#9f958a]":"text-slate-500"),children:b}),(0,D.jsx)("div",{className:"mt-2 space-y-2",children:d.map(a=>(0,D.jsxs)("div",{className:bb("flex items-start gap-2 text-[13px] leading-6",e?"text-[#403934]":"text-slate-200"),children:[(0,D.jsx)(N,{className:"mt-1 h-3.5 w-3.5 shrink-0"}),(0,D.jsx)("span",{children:a})]},a))})]})}let ts=K("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);function tt({surfaceTheme:a,mode:b,onModeChange:c,onNewDraft:d,badges:e}){let f="light"===a;return(0,D.jsxs)("div",{className:bb("relative z-[1] border-b px-4 py-3 md:px-5",f?"border-[#e7e1d8] bg-[linear-gradient(180deg,rgba(255,255,255,0.96),rgba(248,244,237,0.94))]":"border-white/10 bg-[linear-gradient(180deg,rgba(10,16,29,0.96),rgba(6,11,21,0.94))]"),children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,D.jsx)("div",{className:"min-w-0",children:(0,D.jsxs)("div",{className:"flex items-center gap-3",children:[(0,D.jsx)("span",{className:bb("inline-flex size-10 shrink-0 items-center justify-center rounded-full border shadow-[0_8px_24px_rgba(56,47,38,0.08)]",f?"border-[#e3ddd4] bg-white text-[#4c4640]":"border-white/10 bg-white/[0.05] text-slate-200 shadow-[0_16px_36px_rgba(0,0,0,0.28)]"),children:(0,D.jsx)(co,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:bb("text-[11px] uppercase tracking-[0.22em]",f?"text-[#7f6554]":"text-slate-500"),children:"Architect"}),(0,D.jsx)("h2",{className:bb("truncate text-[18px] font-semibold tracking-[-0.02em]",f?"text-[#2d2118]":"text-white"),children:"Create workspace"}),(0,D.jsx)("p",{className:bb("text-[13px]",f?"text-[#604c3f]":"text-slate-300"),children:"Talk to Architect once. Stay on the fast path or open the full blueprint without losing the draft."})]})]})}),(0,D.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,D.jsxs)("div",{className:bb("inline-flex rounded-full border p-1",f?"border-[#e4ddd3] bg-[#f4efe7]":"border-white/10 bg-white/[0.04]"),children:[(0,D.jsx)(tu,{surfaceTheme:a,active:"basic"===b,label:"Basic",onClick:()=>c("basic")}),(0,D.jsx)(tu,{surfaceTheme:a,active:"advanced"===b,label:"Advanced",onClick:()=>c("advanced")})]}),(0,D.jsxs)("button",{type:"button",onClick:d,className:bb("inline-flex h-9 items-center gap-2 rounded-full border px-3 text-[13px] transition-colors",f?"border-[#dfd8ce] bg-white text-[#38322d] hover:bg-[#f5f1ea]":"border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]"),children:[(0,D.jsx)(ts,{className:"h-3.5 w-3.5"}),"New draft"]})]})]}),e.length>0?(0,D.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:e.map(a=>(0,D.jsx)("span",{className:bb("inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.16em]","success"===a.tone&&"border-emerald-200 bg-emerald-50 text-emerald-700","warning"===a.tone&&"border-amber-200 bg-amber-50 text-amber-700","danger"===a.tone&&"border-rose-200 bg-rose-50 text-rose-700",(!a.tone||"muted"===a.tone)&&(f?"border-[#e4ddd3] bg-white text-[#5f5348]":"border-white/10 bg-white/[0.05] text-slate-300")),children:a.label},a.id))}):null]})}function tu({surfaceTheme:a,active:b,label:c,onClick:d}){let e="light"===a;return(0,D.jsx)("button",{type:"button",onClick:d,className:bb("inline-flex min-w-[92px] items-center justify-center rounded-full px-3 py-1.5 text-[13px] transition-colors",b?e?"bg-white text-[#151310] shadow-sm":"bg-[#0f1726] text-white shadow-[0_8px_18px_rgba(0,0,0,0.28)]":e?"text-[#6d584a] hover:text-[#2d2824]":"text-slate-400 hover:text-slate-100"),children:c})}let tv=K("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);function tw({surfaceTheme:a,value:b,placeholder:c,onChange:d,onSubmit:e,disabled:f=!1,isBusy:g=!1,helperText:h,toolbar:i,className:j}){let k=(0,E.useRef)(null),l=!!b.trim()&&!f,m=async a=>{a.preventDefault(),l&&await e()},n=async a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),l&&await e())},o="light"===a;return(0,D.jsxs)("form",{onSubmit:m,className:bb("rounded-[24px] border p-3",o?"border-[#dfd9d1] bg-white shadow-[0_24px_80px_rgba(56,47,38,0.08)]":"border-white/10 bg-[rgba(7,12,22,0.92)] shadow-[0_24px_80px_rgba(0,0,0,0.38)]",j),children:[(0,D.jsx)("textarea",{ref:k,value:b,onChange:a=>d(a.target.value),onKeyDown:n,placeholder:c,className:bb("min-h-[44px] max-h-[200px] w-full resize-none overflow-y-auto border-0 bg-transparent px-2 py-1 text-[15px] leading-6 outline-none",o?"text-[#191714] placeholder:text-[#9b948c]":"text-slate-100 placeholder:text-slate-500")}),(0,D.jsxs)("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-3",children:[(0,D.jsxs)("div",{className:"flex min-h-8 items-center gap-2",children:[i,h?(0,D.jsx)("p",{className:bb("text-[11px]",o?"text-[#8b837a]":"text-slate-400"),children:h}):null]}),(0,D.jsx)("button",{type:"submit",disabled:!l,className:bb("inline-flex size-8 items-center justify-center rounded-full transition-colors disabled:cursor-not-allowed",o?"bg-[#161514] text-white hover:bg-[#26231f] disabled:bg-[#d5cec5] disabled:text-[#8d857c]":"bg-cyan-300 text-slate-950 hover:bg-cyan-200 disabled:bg-white/[0.08] disabled:text-slate-500"),children:g?(0,D.jsx)(L,{className:"h-3.5 w-3.5 animate-spin"}):(0,D.jsx)(tv,{className:"h-3.5 w-3.5"})})]})]})}function tx({surfaceTheme:a,messages:b,isTyping:c=!1,typingLabel:d="Typing…",emptyState:e,auxiliary:f,className:g}){let h=(0,E.useRef)(null);return(0,D.jsx)(qp,{className:bb("h-full",g),children:(0,D.jsxs)("div",{className:"mx-auto flex min-h-full w-full max-w-4xl flex-col gap-5 px-2 py-4 md:gap-6 md:px-4",children:[e,f,b.map(b=>(0,D.jsx)(ty,{message:b,surfaceTheme:a},b.id)),c?(0,D.jsx)(tz,{surfaceTheme:a,label:d}):null,(0,D.jsx)("div",{ref:h,className:"h-6 w-full shrink-0"})]})})}function ty({message:a,surfaceTheme:b}){let c="light"===b;if("system"===a.role)return(0,D.jsxs)("div",{className:bb("mx-auto w-full max-w-3xl rounded-[18px] border px-4 py-3 text-[13px] leading-6",c?"border-[#e3ddd4] bg-[#f5f0e8] text-[#5b544d]":"border-white/10 bg-white/[0.05] text-slate-300"),children:[(0,D.jsx)("p",{className:bb("text-[11px] uppercase tracking-[0.18em]",c?"text-[#8b8074]":"text-slate-500"),children:a.author||"Workspace Wizard"}),(0,D.jsx)("p",{className:"mt-1",children:a.text})]});let d="user"===a.role,e="pending"===a.status;return(0,D.jsxs)("div",{className:bb("flex w-full items-start gap-3",d?"justify-end":"justify-start"),children:[d?null:(0,D.jsx)("div",{className:bb("mt-0.5 inline-flex size-8 shrink-0 items-center justify-center rounded-full border",c?"border-[#e6dfd4] bg-white text-[#5f5a53]":"border-white/10 bg-white/[0.05] text-slate-300"),children:"Architect"===a.author?(0,D.jsx)(co,{className:"h-3.5 w-3.5"}):(0,D.jsx)(cl,{className:"h-3.5 w-3.5"})}),(0,D.jsxs)("div",{className:bb("max-w-[min(100%,720px)]",d?c?"rounded-[22px] bg-[#191714] px-4 py-2.5 text-white":"rounded-[22px] bg-cyan-300 px-4 py-2.5 text-slate-950":c?"px-0 py-0 text-[#1b1815]":"px-0 py-0 text-slate-100",e&&"opacity-75"),children:[!d&&a.author?(0,D.jsx)("p",{className:bb("mb-1 text-[11px] uppercase tracking-[0.18em]",c?"text-[#8f857a]":"text-slate-500"),children:a.author}):null,(0,D.jsx)("p",{className:bb("whitespace-pre-wrap text-[15px] leading-7",d&&"leading-6"),children:a.text})]})]})}function tz({surfaceTheme:a,label:b}){let c="light"===a;return(0,D.jsxs)("div",{className:"flex w-full items-start gap-3",children:[(0,D.jsx)("div",{className:bb("mt-0.5 inline-flex size-8 shrink-0 items-center justify-center rounded-full border",c?"border-[#e6dfd4] bg-white text-[#5f5a53]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,D.jsx)(co,{className:"h-3.5 w-3.5"})}),(0,D.jsxs)("div",{className:"max-w-[min(100%,720px)]",children:[(0,D.jsx)("p",{className:bb("mb-1 text-[11px] uppercase tracking-[0.18em]",c?"text-[#8f857a]":"text-slate-500"),children:"Architect"}),(0,D.jsxs)("div",{className:"flex items-center gap-3",children:[(0,D.jsxs)("div",{className:bb("inline-flex items-center gap-1.5 rounded-full border px-3 py-2",c?"border-[#e6dfd5] bg-white text-[#5a534c]":"border-white/10 bg-white/[0.05] text-slate-300"),children:[(0,D.jsx)("span",{className:bb("inline-flex size-1.5 animate-pulse rounded-full",c?"bg-[#5a534c]":"bg-slate-300")}),(0,D.jsx)("span",{className:bb("inline-flex size-1.5 animate-pulse rounded-full [animation-delay:120ms]",c?"bg-[#5a534c]":"bg-slate-300")}),(0,D.jsx)("span",{className:bb("inline-flex size-1.5 animate-pulse rounded-full [animation-delay:240ms]",c?"bg-[#5a534c]":"bg-slate-300")})]}),(0,D.jsx)("p",{className:bb("text-[13px] leading-6",c?"text-[#6f685f]":"text-slate-400"),children:b})]})]})]})}function tA({surfaceTheme:a,chips:b,onSelect:c,disabled:d=!1,className:e}){if(0===b.length)return null;let f="light"===a;return(0,D.jsx)("div",{className:bb("flex flex-wrap items-center gap-2",e),children:b.map(a=>(0,D.jsx)("button",{type:"button",onClick:()=>c(a),disabled:d,className:bb("inline-flex min-h-8 items-center rounded-full border px-4 py-1.5 text-left text-[12px] transition-colors disabled:cursor-not-allowed disabled:opacity-50",f?"border-[#ddd7cf] bg-white text-[#4a443f] hover:border-[#cfc7bc] hover:bg-[#f3efe8]":"border-white/10 bg-white/[0.05] text-slate-200 hover:bg-white/[0.08] hover:text-white"),children:a.label},a.id))})}async function tB(a,b){if(!a.body)throw Error("The server did not return a readable stream.");let c=a.body.getReader(),d=new TextDecoder,e="";for(;;){let{value:a,done:f}=await c.read();if(f)break;let g=(e+=d.decode(a,{stream:!0})).indexOf("\n");for(;g>=0;){let a=e.slice(0,g).trim();e=e.slice(g+1),a&&await b(JSON.parse(a)),g=e.indexOf("\n")}}let f=e.trim();f&&await b(JSON.parse(f))}let tC={founder:"Founder",product:"Product Lead",architect:"System Architect",ops:"Operations",growth:"Growth",reviewer:"Reviewer"},tD={small:{label:"Small",agentCount:1,workflowCount:1,automationCount:0,externalChannelCount:0,confirmationLimit:1,suggestedReplyLimit:2},medium:{label:"Medium",agentCount:3,workflowCount:3,automationCount:1,externalChannelCount:0,confirmationLimit:2,suggestedReplyLimit:3},large:{label:"Large",agentCount:5,workflowCount:4,automationCount:2,externalChannelCount:1,confirmationLimit:3,suggestedReplyLimit:4}};function tE(a){return tD[a]??tD.medium}let tF={internal:{label:"Internal",requiresCredentials:!1,credentials:[]},slack:{label:"Slack",requiresCredentials:!0,credentials:[{key:"botToken",label:"Bot token",placeholder:"xoxb-...",secret:!0}]},telegram:{label:"Telegram",requiresCredentials:!0,credentials:[{key:"token",label:"Bot token",placeholder:"123456:ABC...",secret:!0}]},discord:{label:"Discord",requiresCredentials:!0,credentials:[{key:"token",label:"Bot token",placeholder:"Discord bot token",secret:!0}]},googlechat:{label:"Google Chat",requiresCredentials:!0,credentials:[{key:"webhookUrl",label:"Webhook URL",placeholder:"https://chat.googleapis.com/...",secret:!0}]}};function tG(){return globalThis.crypto?.randomUUID?.()??`plan-${Date.now()}`}function tH(a,b,c){return{id:tG(),role:a,author:b,text:c,createdAt:new Date().toISOString()}}function tI(a){return{id:a.id?.trim()||tG(),kind:a.kind,label:a.label.trim(),summary:a.summary.trim(),details:t1(a.details),status:a.status??"ready",createdAt:a.createdAt??new Date().toISOString(),url:t0(a.url),error:t0(a.error)}}function tJ(a){return{id:a.id?.trim()||tG(),section:a.section,label:a.label.trim(),value:a.value.trim(),confidence:Math.max(0,Math.min(100,Math.round(a.confidence??72))),status:a.status??"inferred",rationale:t_(a.rationale??""),sourceLabels:t1(a.sourceLabels)}}function tK(a){let b=t4(a?.id||a?.name||"operator")||"operator",c=a?.role?.trim()||"Operator",d=a?.name?.trim()||t5(b);return{id:b,role:c,name:d,purpose:a?.purpose?.trim()||`${d} owns ${c.toLowerCase()} execution and handoffs.`,enabled:a?.enabled!==!1,isPrimary:!!a?.isPrimary,emoji:a?.emoji?.trim(),theme:a?.theme?.trim(),skillId:a?.skillId?.trim(),modelId:a?.modelId?.trim(),policy:a?.policy??qy("worker"),heartbeat:a?.heartbeat??{enabled:!1},responsibilities:t1(a?.responsibilities),outputs:t1(a?.outputs)}}function tL(a){return{id:t4(a?.id||a?.name||`workflow-${Date.now()}`)||`workflow-${Date.now()}`,name:a?.name?.trim()||"New workflow",goal:a?.goal?.trim()||"",trigger:a?.trigger??"manual",ownerAgentId:a?.ownerAgentId?.trim(),collaboratorAgentIds:t1(a?.collaboratorAgentIds),successDefinition:a?.successDefinition?.trim()||"",outputs:t1(a?.outputs),channelIds:t1(a?.channelIds),enabled:a?.enabled!==!1}}function tM(a="internal",b){let c=tF[a];return{id:t4(b?.id||b?.name||`${a}-${Date.now()}`)||`${a}-${Date.now()}`,type:a,name:b?.name?.trim()||c.label,purpose:b?.purpose?.trim()||"",target:b?.target?.trim(),enabled:b?.enabled!==!1,announce:!!b?.announce,requiresCredentials:c.requiresCredentials,credentials:b?.credentials?.map(a=>({...a,value:a.value??""}))??c.credentials.map(a=>({...a,value:""}))}}function tN(a){return{id:t4(a?.id||a?.name||`automation-${Date.now()}`)||`automation-${Date.now()}`,name:a?.name?.trim()||"New automation",description:a?.description?.trim()||"",enabled:a?.enabled!==!1,scheduleKind:a?.scheduleKind??"every",scheduleValue:a?.scheduleValue?.trim()||"24h",agentId:a?.agentId?.trim(),mission:a?.mission?.trim()||"",thinking:a?.thinking??"medium",announce:!!a?.announce,channelId:a?.channelId?.trim()}}function tO(a){return(function(a,b){let c=te[a];if("solo"===b){let a=c.find(a=>a.isPrimary)??c[0];return[{...a,name:"Builder"===a.role?"Default Agent":a.name,policy:qy("browser"===a.id?"browser":"worker"),enabled:!0}]}return c.map(a=>({id:a.id,role:a.role,name:a.name,emoji:a.emoji,theme:a.theme,skillId:a.skillId,modelId:a.modelId,isPrimary:!!a.isPrimary,policy:qy("browser"===a.id?"browser":"worker"),enabled:!0}))})(a,"core").map(b=>{var c,d,e,f,g,h,i;return tK({id:b.id,role:b.role,name:b.name,purpose:(c=b.id,d=b.role,e=a,/review/i.test(c)||/review/i.test(d)?`Pressure-test ${e} work for correctness, regression risk, and missing validation.`:/test/i.test(c)||/test/i.test(d)?`Validate behavior, environment assumptions, and release confidence for this ${e} workspace.`:/learn/i.test(c)||/learn/i.test(d)?"Keep the workspace memory, conventions, and durable decisions coherent over time.":/browser/i.test(c)||/browser/i.test(d)?"Exercise real UI flows and collect evidence for browser-facing work.":`Own hands-on delivery and keep the ${e} workspace moving.`),enabled:b.enabled,isPrimary:b.isPrimary,emoji:b.emoji,theme:b.theme,skillId:b.skillId,modelId:b.modelId,policy:b.policy??qy("worker"),heartbeat:b.heartbeat??{enabled:!1},responsibilities:(f=b.id,g=a,/review/i.test(f)?["Review active work","Call out regressions","Protect launch quality"]:/test/i.test(f)?["Run verification loops","Capture evidence","Surface failing assumptions"]:/learn/i.test(f)?["Update durable memory","Track decisions","Reduce restart friction"]:/browser/i.test(f)?["Exercise flows","Capture screenshots","Validate responsive states"]:"content"===g?["Drive content production","Coordinate handoffs","Prepare launch artifacts"]:["Implement the next increment","Coordinate specialists","Keep execution momentum"]),outputs:(h=b.id,i=a,/review/i.test(h)?["review notes","risk checklist"]:/test/i.test(h)?["verification report","repro steps"]:/learn/i.test(h)?["memory updates","decision log entries"]:/browser/i.test(h)?["screenshots","browser validation notes"]:"research"===i?["research summary","evidence log"]:["implementation artifacts","handoff summary"])})})}function tP(a,b){let c=b.find(a=>a.enabled&&a.isPrimary)?.id,d=tZ(b,"review"),e=tZ(b,"test"),f=tZ(b,"learn"),g=tZ(b,"browser");if("research"===a)return[tL({id:"research-loop",name:"Research loop",goal:"Turn the main question into evidence-backed findings and explicit unknowns.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[f,d].filter(Boolean),successDefinition:"Question, evidence, synthesis, and next-step recommendations are documented.",outputs:["docs/research-plan.md","deliverables/<run>/research-summary.md"]}),tL({id:"finding-review",name:"Finding review",goal:"Pressure-test claims before publishing or acting on them.",trigger:"manual",ownerAgentId:d??c,collaboratorAgentIds:[c].filter(Boolean),successDefinition:"Assumptions, risks, and evidence gaps are explicit.",outputs:["deliverables/<run>/review-notes.md"]})];if("content"===a)return[tL({id:"strategy",name:"Strategy and briefing",goal:"Clarify audience, offer, channels, and campaign bets before production.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[d,f].filter(Boolean),successDefinition:"The team agrees on brief, priorities, and success signals.",outputs:["docs/content-brief.md","deliverables/<run>/campaign-brief.md"]}),tL({id:"production",name:"Production and QA",goal:"Create assets, review them, and prepare a launch package.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[d].filter(Boolean),successDefinition:"Assets are approved and delivery-ready.",outputs:["deliverables/<run>/drafts/","deliverables/<run>/launch-package.md"]}),tL({id:"performance-loop",name:"Performance loop",goal:"Review outcomes, learn from results, and feed the next iteration.",trigger:"cron",ownerAgentId:f??d??c,collaboratorAgentIds:[c].filter(Boolean),successDefinition:"Measured results and next changes are documented.",outputs:["deliverables/<run>/performance-review.md"]})];let h=g&&"frontend"===a?g:c;return[tL({id:"scope-v1",name:"V1 shaping",goal:"Turn the product goal into a constrained first delivery batch.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[f,d].filter(Boolean),successDefinition:"Scope, non-goals, and critical path are documented.",outputs:["docs/brief.md","memory/blueprint.md"]}),tL({id:"delivery",name:"Delivery loop",goal:"Implement, validate, and hand off the next meaningful increment.",trigger:"manual",ownerAgentId:h,collaboratorAgentIds:[e,d].filter(Boolean),successDefinition:"A tested increment ships with review notes and clear handoff.",outputs:["deliverables/<run>/release-notes.md","deliverables/<run>/verification.md"]}),tL({id:"launch-readiness",name:"Launch readiness",goal:"Check blockers, rollback posture, and communication before launch.",trigger:"launch",ownerAgentId:d??c,collaboratorAgentIds:[e,f].filter(Boolean),successDefinition:"Launch risks, open blockers, and go/no-go signal are explicit.",outputs:["deliverables/<run>/launch-checklist.md"]})]}function tQ(){return[tM("internal",{id:"internal-ops",name:"Internal ops",purpose:"Default internal coordination surface for planner outputs and deploy notes.",announce:!1})]}function tR(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;let A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T=t3(a);if(T.runtime=(b=T.id,c=T.runtime,N=c?.architectSessionId?.trim()||`planner-${b}-architect`,O=Object.fromEntries(Object.entries(c?.advisorAgentIds??{}).filter(([,a])=>"string"==typeof a&&a.trim())),P=Object.fromEntries(Object.entries(tC).map(([a])=>[a,c?.advisorSessionIds?.[a]?.trim()||`planner-${b}-${a}`])),{mode:c?.mode==="fallback"?"fallback":"agent",status:c?.status==="error"?"error":c?.status==="ready"?"ready":"pending",workspaceId:t0(c?.workspaceId),workspacePath:t0(c?.workspacePath),architectAgentId:t0(c?.architectAgentId),architectSessionId:N,advisorAgentIds:O,advisorSessionIds:P,lastArchitectRunId:t0(c?.lastArchitectRunId),lastAdvisorRunIds:t1(c?.lastAdvisorRunIds),lastError:t0(c?.lastError)}),T.intake=(d={...T.intake,started:!!T.intake?.started||T.conversation.some(a=>"user"===a.role)},{started:!!d?.started,initialPrompt:t_(d?.initialPrompt??""),latestPrompt:t_(d?.latestPrompt??""),sources:(d?.sources??[]).map(a=>tI(a)),confirmations:t1(d?.confirmations).map(a=>a.trim()).filter(Boolean).slice(0,3),mode:d?.mode==="advanced"?"advanced":"guided",size:d?.size==="small"||d?.size==="large"?d.size:"medium",reviewRequested:!!d?.reviewRequested,turnCount:Math.max(0,Math.floor(d?.turnCount??0)),inferences:(d?.inferences??[]).map(a=>tJ(a)),suggestedReplies:t1(d?.suggestedReplies).slice(0,4)}),T.company.name=t_(T.company.name),T.company.mission=t_(T.company.mission),T.company.targetCustomer=t_(T.company.targetCustomer),T.company.constraints=t1(T.company.constraints),T.company.successSignals=t1(T.company.successSignals),T.product.offer=t_(T.product.offer),T.product.scopeV1=t1(T.product.scopeV1),T.product.nonGoals=t1(T.product.nonGoals),T.product.revenueModel=t_(T.product.revenueModel),T.product.launchPriority=t1(T.product.launchPriority),T.workspace.name=t_(T.workspace.name),T.workspace.directory=t0(T.workspace.directory),T.workspace.repoUrl=t0(T.workspace.repoUrl),T.workspace.existingPath=t0(T.workspace.existingPath),T.workspace.stackDecisions=t1(T.workspace.stackDecisions),T.workspace.docs=t2(t1(T.workspace.docs).concat(tf(T.workspace.template,T.workspace.rules))),T.team.persistentAgents=T.team.persistentAgents.map(a=>tK({...a,id:a.id,role:a.role,name:a.name,purpose:a.purpose,enabled:a.enabled,isPrimary:a.isPrimary,emoji:a.emoji,theme:a.theme,skillId:a.skillId,modelId:a.modelId,policy:a.policy,heartbeat:a.heartbeat,responsibilities:a.responsibilities,outputs:a.outputs})).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),0===T.team.persistentAgents.length&&(T.team.persistentAgents=tO(T.workspace.template)),!T.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)){let a=T.team.persistentAgents.find(a=>a.enabled);a&&(a.isPrimary=!0)}if(T.operations.channels=T.operations.channels.map(a=>tM(a.type,a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),0===T.operations.channels.length&&(T.operations.channels=tQ()),T.operations.workflows=T.operations.workflows.map(a=>tL(a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),0===T.operations.workflows.length&&(T.operations.workflows=tP(T.workspace.template,T.team.persistentAgents)),T.operations.automations=T.operations.automations.map(a=>tN(a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),R=tE((Q=t3(T)).intake.size),Q.team.persistentAgents=function(a,b,c){var d;let e,f;if(c<=0)return[];return t$((f=(d=[...b,...tO(a),...(e=tK({id:"ops-lead",role:"Operations Lead",name:"Operations Lead",purpose:"Own automations, reporting cadence, and cross-agent handoffs for the workspace.",responsibilities:["Maintain the operating cadence","Wire recurring automations","Keep handoffs durable"],outputs:["ops brief","automation notes"]}),"research"===a?[tK({id:"analyst",role:"Analyst",name:"Analyst",purpose:"Turn gathered evidence into patterns, themes, and decision-ready summaries.",responsibilities:["Cluster findings","Spot repeated signals","Prepare concise summaries"],outputs:["insight summary","theme map"]}),e]:[e])]).find(a=>a.isPrimary)??d[0])?[f,...d.filter(a=>a.id!==f.id)]:d).slice(0,c).map((a,b)=>tK({...a,enabled:!0,isPrimary:a.isPrimary||0===b}))}(Q.workspace.template,Q.team.persistentAgents,R.agentCount),Q.operations.channels=function(a,b,c){let d=b.find(a=>"internal"===a.type)??tQ()[0],e=[...b.filter(a=>"internal"!==a.type),...("content"===a?["telegram","discord","slack"]:["slack","discord","telegram"]).map(b=>tM(b,{id:`${b}-ops`,purpose:"content"===a?"Optional distribution or community surface for a larger operating setup.":"Optional external operating surface for a larger workspace.",enabled:!1,announce:!0}))].filter((a,b,c)=>c.findIndex(b=>b.type===a.type)===b);return[tM("internal",{...d,enabled:!0}),...e.slice(0,c)]}(Q.workspace.template,Q.operations.channels,R.externalChannelCount),Q.operations.workflows=function(a,b,c,d){let e,f,g,h;return d<=0?[]:t$([...b,...tP(a,c),...(e=c.find(a=>a.enabled&&a.isPrimary)?.id,f=tZ(c,"review"),g=tZ(c,"learn"),h=tZ(c,"ops"),[tL({id:"context-sync",name:"research"===a?"Evidence sync":"Context sync",goal:"Pull new context from linked sources and keep the blueprint aligned with reality.",trigger:"manual",ownerAgentId:g??e,collaboratorAgentIds:[e,f].filter(Boolean),successDefinition:"New context is reflected in durable docs, scope, and decision notes.",outputs:["memory/blueprint.md","deliverables/<run>/context-sync.md"]}),tL({id:"ops-rhythm",name:"Operating rhythm",goal:"Review handoffs, automations, and next-step ownership on a repeatable cadence.",trigger:"cron",ownerAgentId:h??f??g??e,collaboratorAgentIds:[e].filter(Boolean),successDefinition:"The workspace has a fresh operator brief and an explicit next batch of work.",outputs:["deliverables/<run>/ops-rhythm.md"]})])]).slice(0,d).map(a=>{var b,d;let e,f,g,h,i;return b=a,e=new Set((d=c).filter(a=>a.enabled).map(a=>a.id)),f=d.find(a=>a.enabled&&a.isPrimary)?.id,g=tZ(d,"review"),h=tZ(d,"learn"),i=b.ownerAgentId&&e.has(b.ownerAgentId)?b.ownerAgentId:g??h??f,tL({...b,ownerAgentId:i,collaboratorAgentIds:b.collaboratorAgentIds.filter(a=>e.has(a)&&a!==i),enabled:!0})})}(Q.workspace.template,Q.operations.workflows,Q.team.persistentAgents,R.workflowCount),Q.operations.automations=function(a,b,c,d,e){let f,g,h;return e<=0?[]:t$([...b,...(f=tZ(c,"review")??c.find(a=>a.enabled)?.id,g=tZ(c,"learn")??f,[tN({id:"daily-triage",name:"Daily triage",description:"Review drift, blockers, and next handoffs every day.",scheduleKind:"every",scheduleValue:"24h",agentId:f,mission:"content"===a?"Review active campaigns, blockers, and next content handoffs. Leave a concise operator brief.":"Inspect the workspace, surface blockers, and leave a concise next-step handoff for the team.",thinking:"medium",channelId:h=d[0]?.id}),tN({id:"weekly-review",name:"Weekly review",description:"Capture progress, decisions, and next bets once per week.",scheduleKind:"every",scheduleValue:"168h",agentId:g,mission:"research"===a?"Summarize evidence gathered this week, open questions, and the next investigation batch.":"Summarize progress, major decisions, and the next delivery batch for this workspace.",thinking:"high",channelId:h})].filter(a=>a.agentId))]).slice(0,e).map(a=>{var b,e,f;let g,h,i,j,k;return b=a,e=c,f=d,g=new Set(e.filter(a=>a.enabled).map(a=>a.id)),h=new Set(f.map(a=>a.id)),i=e.find(a=>a.enabled&&a.isPrimary)?.id,j=tZ(e,"review"),k=tZ(e,"learn"),tN({...b,agentId:b.agentId&&g.has(b.agentId)?b.agentId:j??k??i,channelId:b.channelId&&h.has(b.channelId)?b.channelId:f[0]?.id,enabled:!0})})}(Q.workspace.template,Q.operations.automations,Q.team.persistentAgents,Q.operations.channels,R.automationCount),(T=Q).operations.hooks=T.operations.hooks.map(a=>({id:t4(a?.id||a?.name||`hook-${Date.now()}`)||`hook-${Date.now()}`,name:a?.name?.trim()||"New hook",source:a?.source?.trim()||"",enabled:a?.enabled!==!1,notes:a?.notes?.trim()||""})).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),T.operations.sandbox=(e=T.operations.sandbox,{workspaceOnly:e?.workspaceOnly??!0,mode:e?.mode??"default",notes:t1(e?.notes)}),T.deploy.firstMissions=(S=(f=T).team.persistentAgents.find(a=>a.enabled&&a.isPrimary),t2([S?"Inspect the new workspace, refine docs to match the blueprint, and break the first delivery batch into concrete tasks.":"",f.team.persistentAgents.find(a=>/review/i.test(a.role)&&a.enabled)?"Review the blueprint against the created workspace, call out execution risks, and leave a launch-readiness checklist.":"",f.team.persistentAgents.find(a=>/learn/i.test(a.role)&&a.enabled)?"Capture durable facts, decisions, and conventions in memory files so the team can continue without drift.":""].filter(Boolean))),!T.company.name&&T.workspace.name&&(T.company.name=T.workspace.name),!T.workspace.name&&T.company.name&&(T.workspace.name=T.company.name),!T.intake.started)return T.deploy.blockers=[],T.deploy.warnings=[],T.intake.confirmations=[],T.intake.inferences=[],T.intake.suggestedReplies=[],T.readinessScore=0,T.architectSummary="Start with one prompt. Paste the project goal, website URL, repo, or existing folder and the architect will draft the workspace for you.",T.stage="intake",T.status="draft",T.updatedAt=new Date().toISOString(),T;let U=function(a){var b;let c,d,e=tS(a),f=[],g=tE(a.intake.size),h=a.intake.sources.some(a=>"website"===a.kind&&"ready"===a.status),i=tT(a),j=!!(a.company.mission&&a.company.targetCustomer&&(a.product.offer||a.product.scopeV1.length>0));for(let g of(a.company.name||f.push("tr"===e?"Şirkete ya da workspace'e ne ad verelim?":"What should I call the company or workspace?"),a.company.mission||f.push("tr"===e?"Bu workspace \xf6nce tam olarak hangi \xe7ıktıyı optimize etmeli?":"What exact outcome should this workspace optimize for first?"),a.company.targetCustomer||f.push((c=tS(b=a),(d=tU(b))?"tr"===c?`İlk hedef kitleyi ${d} olarak okuyorum. Bunu koruyalım mı, yoksa daha doğru segmenti sen mi g\xf6stereceksin?`:`I can read the first audience as ${d}. Keep that, or point me to the better segment?`:"content"===b.workspace.template?b.operations.channels.some(a=>"telegram"===a.type&&a.enabled)?"tr"===c?"İlk kullanıcı topluluk y\xf6neticileri, moderat\xf6rler ya da Telegram \xfcyeleri mi olmalı?":"Should the first user be community managers, moderators, or Telegram members?":"tr"===c?"Bu i\xe7erik ya da topluluk workspace'i \xf6nce kime hizmet etmeli?":"Who should this content or community workspace serve first?":"research"===b.workspace.template?"tr"===c?"Bu araştırma workspace'i i\xe7in ilk karar verici ya da hedef kitle kim?":"Who is the first decision-maker or audience for this research workspace?":"tr"===c?"İlk kullanıcı ya da m\xfcşteri segmenti kim?":"Who is the first user or customer segment?")),a.workspace.repoUrl||a.workspace.existingPath||!(a.intake.turnCount<=1)||tV(a.intake.latestPrompt||a.intake.initialPrompt)||f.push("tr"===e?"Buna sıfırdan mı başlayalım, bir repo mu klonlayalım, yoksa mevcut bir klas\xf6r\xfc m\xfc bağlayalım?":"Should this start from scratch, clone a repo, or attach an existing folder?"),a.company.mission&&a.company.targetCustomer&&0===a.product.scopeV1.length?f.push("tr"===e?"İlk \xe7ıkaracağımız en k\xfc\xe7\xfck V1 sonucu ne olmalı?":"What is the smallest V1 outcome we should launch first?"):0===a.product.nonGoals.length&&j&&a.product.scopeV1.length>0&&("advanced"===a.intake.mode||a.intake.reviewRequested||a.intake.turnCount>=4)&&f.push("tr"===e?"V1 i\xe7in neleri \xf6zellikle kapsam dışında bırakalım?":"What should stay explicitly out of scope for V1?"),a.company.mission&&(a.product.scopeV1.length>0||h||i.length>0)&&0===a.company.successSignals.length&&("advanced"===a.intake.mode||a.intake.reviewRequested||a.intake.turnCount>=3)&&f.push("tr"===e?"Bu workspace'in işe yaradığını bize hangi sinyal g\xf6stermeli?":"What signal should tell us this workspace is working?"),a.intake.sources.filter(a=>"error"===a.status)))f.push("tr"===e?`${g.label} kaynağını inceleyemedim. Bu kaynak \xf6nemliyse şirket bağlamını manuel olarak doğrula.`:`I could not inspect ${g.label}. Confirm the company context manually if this source matters.`);return t2(f).slice(0,Math.min(h?2:3,g.confirmationLimit))}(T),V=function(a){let b=[];for(let c of(a.company.name||b.push("Company or workspace name is missing."),a.company.mission||b.push("Mission is missing."),a.company.targetCustomer||b.push("Target customer is missing."),a.workspace.name||b.push("Workspace name is missing."),"clone"!==a.workspace.sourceMode||a.workspace.repoUrl||b.push("Clone mode needs a repository URL."),"existing"!==a.workspace.sourceMode||a.workspace.existingPath||b.push("Existing-folder mode needs a folder path."),a.team.persistentAgents.some(a=>a.enabled)||b.push("At least one persistent agent must be enabled."),a.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)||b.push("One enabled agent must be marked as primary."),a.operations.workflows.some(a=>a.enabled)||b.push("At least one enabled workflow is required."),a.operations.workflows.filter(a=>a.enabled)))c.name&&c.goal&&c.successDefinition||b.push(`Workflow "${c.name||c.id}" is incomplete.`),c.ownerAgentId&&!a.team.persistentAgents.some(a=>a.id===c.ownerAgentId&&a.enabled)&&b.push(`Workflow "${c.name}" points to a missing or disabled owner agent.`);for(let c of a.operations.automations.filter(a=>a.enabled))c.mission&&c.scheduleValue||b.push(`Automation "${c.name}" is incomplete.`),c.agentId&&!a.team.persistentAgents.some(a=>a.id===c.agentId&&a.enabled)&&b.push(`Automation "${c.name}" points to a missing or disabled agent.`);for(let c of a.operations.channels.filter(a=>a.enabled&&a.requiresCredentials))c.credentials.filter(a=>!a.value.trim()).length>0&&b.push(`Channel "${c.name}" is missing required credentials.`);return t2(b)}(T),W=(A=[],B=tE((g=T).intake.size),0===g.product.nonGoals.length&&A.push("No non-goals are defined for V1."),0===g.product.launchPriority.length&&A.push("Launch priorities are not ordered yet."),0===g.company.successSignals.length&&A.push("Success signals are still empty."),0===g.workspace.stackDecisions.length&&"content"!==g.workspace.template&&A.push("Critical stack decisions are not captured yet."),B.automationCount>0&&!g.operations.automations.some(a=>a.enabled)&&A.push("No automation loops are enabled."),B.externalChannelCount>0&&!g.operations.channels.some(a=>"internal"!==a.type)&&A.push("Only internal channels are configured."),B.agentCount>=3&&g.team.maxParallelRuns<2&&A.push("Parallel run limit is conservative for a multi-agent workspace."),t2(A)),X=(h=T).intake.reviewRequested||"deploying"===h.status||"deployed"===h.status;return T.intake.confirmations=U,T.intake.inferences=(C=[],D=(i=T).intake.sources.filter(a=>"ready"===a.status).map(a=>a.label),E=i.intake.confirmations.join(" ").toLowerCase(),i.company.name&&C.push(tJ({section:"company",label:"Company",value:i.company.name,confidence:tW(i,"company-name"),status:tX(E,"company"),rationale:D.length>0?"Derived from linked context and the current brief.":"Derived from the current brief.",sourceLabels:D})),i.company.mission&&C.push(tJ({section:"company",label:"Mission",value:i.company.mission,confidence:tW(i,"mission"),status:tX(E,"outcome"),rationale:"Architect condensed the first business outcome from the request.",sourceLabels:D})),i.company.targetCustomer&&C.push(tJ({section:"company",label:"First audience",value:i.company.targetCustomer,confidence:tW(i,"target-customer"),status:tX(E,"audience"),rationale:"This is the current best guess for the first user or buyer segment.",sourceLabels:D})),C.push(tJ({section:"workspace",label:"Workspace type",value:t5(i.workspace.template),confidence:tW(i,"template"),status:"inferred",rationale:"Template is inferred from the requested operating model and linked context.",sourceLabels:D})),C.push(tJ({section:"workspace",label:"Starting point",value:"clone"===i.workspace.sourceMode?i.workspace.repoUrl||"Clone an existing repository":"existing"===i.workspace.sourceMode?i.workspace.existingPath||"Attach an existing folder":"Start from scratch",confidence:tW(i,"source-mode"),status:tX(E,"start"),rationale:"This is how the workspace will be materialized when you deploy.",sourceLabels:D})),i.product.offer&&C.push(tJ({section:"product",label:"Offer",value:i.product.offer,confidence:tW(i,"offer"),status:"inferred",rationale:"Architect turned the brief into a concrete operator-facing offer.",sourceLabels:D})),(F=i.operations.channels.filter(a=>a.enabled&&"internal"!==a.type)).length>0&&C.push(tJ({section:"operations",label:"External channels",value:F.map(a=>a.name).join(", "),confidence:tW(i,"channels"),status:"inferred",rationale:"The request implies these operating channels should exist after deploy.",sourceLabels:D})),(G=i.team.persistentAgents.find(a=>a.enabled&&a.isPrimary))&&C.push(tJ({section:"team",label:"Primary operator",value:`${G.name} (${G.role})`,confidence:tW(i,"team"),status:"inferred",rationale:"Architect drafted a primary agent to own the first delivery loop.",sourceLabels:D})),(H=i.operations.workflows.find(a=>a.enabled))&&C.push(tJ({section:"operations",label:"First workflow",value:H.name,confidence:tW(i,"workflow"),status:"inferred",rationale:"This is the first operational loop the company would run after deploy.",sourceLabels:D})),C.slice(0,8)),T.intake.suggestedReplies=(j=T,k=U,I=tS(j),J=[],K=tE(j.intake.size),L=tU(j),j.company.targetCustomer||(L&&J.push("tr"===I?`İlk hedef kitle ${tY(L)} gibi g\xf6r\xfcn\xfcyor.`:`The first audience looks like ${tY(L)}.`),"content"===j.workspace.template?(J.push("tr"===I?"İlk kullanıcılar topluluk y\xf6neticileri ve moderat\xf6rler.":"The first users are community managers and moderators."),J.push("tr"===I?"İlk kullanıcılar daha hızlı moderasyon ve onboarding isteyen Telegram \xfcyeleri.":"The first users are Telegram members who need faster moderation and onboarding.")):J.push("tr"===I?"İlk kullanıcılar bu iş akışını her g\xfcn y\xfcr\xfcten operat\xf6rler.":"The first users are the operators running this workflow every day.")),j.company.mission||J.push("tr"===I?"İlk hedef, hacmi en y\xfcksek manuel iş akışını otomatikleştirmek.":"The first outcome is automating the highest-volume manual workflow."),!j.product.scopeV1.length&&j.company.mission&&j.company.targetCustomer&&J.push("tr"===I?"V1, genişlemeden \xf6nce en dar ama faydalı d\xf6ng\xfcy\xfc u\xe7tan uca \xe7\xf6zmeli.":"V1 should handle the narrowest useful loop end to end before we expand."),j.workspace.repoUrl||j.workspace.existingPath||tV(j.intake.latestPrompt||j.intake.initialPrompt)||(J.push("tr"===I?"Şimdilik sıfırdan başlayalım.":"Start from scratch for now."),J.push("tr"===I?"İyi bir temel bulursak mevcut bir repository klonlayabiliriz.":"Clone an existing repository if you find a good base.")),0===j.company.successSignals.length&&j.intake.turnCount>=2&&J.push("tr"===I?"Başarı; daha az manuel iş, daha hızlı yanıt s\xfcreleri ve daha net bir operasyon ritmi demek.":"Success means less manual work, faster response times, and a clearer operating cadence."),0===k.length&&(J.push("tr"===I?"Gelişmiş edit\xf6r\xfc a\xe7.":"Open the advanced editor."),J.push("tr"===I?"Deploy review aşamasına ge\xe7.":"Move into deploy review.")),t2(J).slice(0,K.suggestedReplyLimit)),T.deploy.blockers=X?V:[],T.deploy.warnings=X?W:[],T.readinessScore=(l=T,m=V,n=W,o=X,M=14,l.company.name&&(M+=10),l.company.mission&&(M+=15),l.company.targetCustomer&&(M+=15),l.product.offer&&(M+=10),l.product.scopeV1.length>0&&(M+=10),l.workspace.name&&(M+=10),l.intake.sources.length>0&&(M+=6),l.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)&&(M+=10),l.operations.workflows.some(a=>a.enabled)&&(M+=10),l.operations.automations.some(a=>a.enabled)&&(M+=5),o?(M-=12*m.length,M-=3*n.length):M-=4*Math.max(0,l.intake.confirmations.length-1),Math.max(0,Math.min(100,M))),T.architectSummary=function(a,b,c,d){let e=tS(a),f=tE(a.intake.size);if(!a.intake.started)return"tr"===e?`Tek bir mesajla başla. ${f.label} modunda sohbet yalın kalır; Architect ise arka planda proje bağlamını toplar, ekibi taslaklar ve workspace blueprint'ini hazırlar.`:`Start with one prompt. ${f.label} mode keeps the chat lean while the architect still harvests full project context, drafts the team, and prepares the workspace blueprint.`;let g=a.team.persistentAgents.filter(a=>a.enabled).length,h=a.operations.workflows.filter(a=>a.enabled).length,i=a.operations.automations.filter(a=>a.enabled).length,j=a.intake.confirmations.length;return d?"tr"===e?[a.company.mission?`${a.company.name||a.workspace.name||"Bu şirket"} ${a.company.mission} hedefi etrafında konumlandı.`:"Şirket misyonu i\xe7in h\xe2l\xe2 kısa ve net bir c\xfcmle gerekiyor.",a.company.targetCustomer?`Birincil hedef kitle: ${a.company.targetCustomer}.`:"Hedef m\xfcşteri h\xe2l\xe2 eksik.",`${g} agent, ${h} g\xf6rev ve ${i} automation yapılandırıldı.`,j>0?`Senden ${j} doğrulama daha gerekiyor.`:b.length>0?`Deploy \xf6ncesi ${b.length} blocker kaldı.`:c.length>0?`G\xf6zden ge\xe7irilmesi gereken ${c.length} warning var.`:"Kritik blocker kalmadı."].join(" "):[a.company.mission?`${a.company.name||a.workspace.name||"This company"} is pointed at ${a.company.mission}.`:"The company mission still needs a concise sentence.",a.company.targetCustomer?`Primary audience: ${a.company.targetCustomer}.`:"Target customer is still missing.",`${g} agents, ${h} tasks, and ${i} automations are configured.`,j>0?`${j} confirmation item${1===j?"":"s"} still need your input.`:b.length>0?`${b.length} blocker${1===b.length?"":"s"} remain before deploy.`:c.length>0?`${c.length} warning${1===c.length?"":"s"} remain to review.`:"No hard blockers remain."].join(" "):"tr"===e?[a.company.mission?`${a.company.name||a.workspace.name||"Bu workspace"} i\xe7in odak alanı ${a.company.mission}.`:a.company.name||a.workspace.name?`${a.company.name||a.workspace.name} i\xe7in ilk operasyonel \xe7ıktıyı şekillendiriyorum.`:"Bu workspace i\xe7in ilk somut \xe7ıktıyı h\xe2l\xe2 netleştiriyorum.",a.company.targetCustomer?`İlk hedef kitle: ${a.company.targetCustomer}.`:"İlk kullanıcı ya da hedef segmenti h\xe2l\xe2 netleştirmem gerekiyor.",a.intake.sources.length>0?`${a.intake.sources.length} bağlam kaynağını zaten topladım.`:"Bir website, repo ya da kısa bir brief ver; ilk taslağı \xe7ıkarayım.",`${f.label.toLowerCase()} mod i\xe7in ${g} agent, ${h} g\xf6rev ve ${i} automation taslağı hazır.`,j>0?`Senden sadece ${j} kritik karar daha gerekiyor.`:"Taslak tutarlı g\xf6r\xfcn\xfcyor. İstersen full blueprint'i a\xe7abilir ya da deploy review'a ge\xe7ebilirim."].join(" "):[a.company.mission?`${a.company.name||a.workspace.name||"This workspace"} looks like a ${t5(a.workspace.template).toLowerCase()} company focused on ${a.company.mission}.`:a.company.name||a.workspace.name?`I am shaping the first operating outcome for ${a.company.name||a.workspace.name}.`:"I am still shaping the first concrete outcome for this workspace.",a.company.targetCustomer?`First audience: ${a.company.targetCustomer}.`:"I still need the first audience or user segment.",a.intake.sources.length>0?`I already harvested ${a.intake.sources.length} context source${1===a.intake.sources.length?"":"s"}.`:"Give me a website, repo, or short brief and I will infer the first draft.",`${g} agents, ${h} tasks, and ${i} automations are drafted for ${f.label.toLowerCase()} mode.`,j>0?`Only ${j} high-value decision${1===j?"":"s"} still need your input.`:"The draft is coherent. I can open the full blueprint or move into deploy review."].join(" ")}(T,V,W,X),T.stage=(p=T,q=V,r=W,s=U,t=X,p.intake.started?"deploying"===p.status?"deploying":"deployed"===p.status?"deployed":(u=p).company.mission||u.product.offer||u.workspace.name||u.intake.sources.length>0?((v=p).company.name||v.workspace.name)&&v.company.mission&&v.team.persistentAgents.some(a=>a.enabled)&&v.operations.workflows.some(a=>a.enabled)?t?q.length>0?"pressure-test":r.length>0||p.readinessScore<90?"decision-lock":"ready":s.length>0?"team-synthesis":"decision-lock":"team-synthesis":p.intake.turnCount>1?"context-harvest":"intake":"intake"),T.status=(w=T,x=V,y=U,z=X,w.intake.started?"deploying"===w.status||"deployed"===w.status?w.status:z?"blocked"===w.status&&x.length>0||x.length>0?"blocked":w.readinessScore>=90?"ready":"review":y.length>0?"draft":"review":"draft"),T.updatedAt=new Date().toISOString(),T}function tS(a,b){for(let d of[b,...a.conversation.slice().reverse().filter(a=>"user"===a.role).map(a=>a.text),a.intake.latestPrompt,a.intake.initialPrompt]){var c;let a=!function(a){let b=a?.trim();if(!b)return!1;if(/[çğıöşüÇĞİÖŞÜ]/.test(b))return!0;let c=b.toLowerCase().match(/\b(ve|bir|bu|şu|için|ile|olarak|olan|mı|mi|mu|mü|ne|nasıl|hangi|neden|hedef|ilk|müşteri|kullanıcı|oluştur|gerekli|alanları|yardımcı)\b/g);return!!(c&&c.length>=2)}(c=d)?!function(a){let b=a?.trim();if(!b||/[çğıöşüÇĞİÖŞÜ]/.test(b))return!1;let c=b.toLowerCase().match(/\b(let'?s|the|and|for|with|from|this|that|what|how|why|when|where|who|should|could|would|need|want|start|build|create|launch|project|workspace|customer|user|team|goal|mission|review|deploy|product|website|repo|folder)\b/g);return!!(c&&c.length>=2)}(c)?null:"en":"tr";if(a)return a}return"en"}function tT(a){return a.intake.sources.filter(a=>"ready"===a.status).flatMap(a=>[a.label,a.summary,...a.details]).join(" ").toLowerCase()}function tU(a){let b=tT(a);if(!b)return;let c=/\bweb3|onchain|crypto|blockchain|token\b/.test(b),d=/\bstartup|startups|founder|founders|business(?:es)?\b/.test(b),e=/\bcommunity|communities|member|members|holder|holders|nft|dao|governance\b/.test(b),f=/\bdeveloper|developers|builder|builders|engineer|engineers\b/.test(b),g=/\boperator|operators|moderator|moderators|admin|admins|ops\b/.test(b);return d&&e?c?"Web3 startups and token-led communities":"startups and their communities":d?c?"Web3 startups and founders":"startups and founders":e?c?"DAO, NFT, and Web3 communities":"community leads and members":f&&g?"developers and internal operators":f?"developers and technical teams":g?"internal operators and moderators":void 0}function tV(a){return/\b(from scratch|greenfield|empty workspace|clone|repo|existing folder|existing workspace|s[ıi]f[ıi]rdan|mevcut klas[oö]r|mevcut repo|bo[sş])\b/i.test(a)}function tW(a,b){let c=`${a.intake.initialPrompt} ${a.intake.latestPrompt}`.toLowerCase(),d=a.intake.sources.filter(a=>"ready"===a.status),e=66;return d.length>0&&(e+=8),a.intake.turnCount>1&&(e+=6),("template"===b&&/\b(telegram|discord|community|topluluk|grup|content|marketing|research|frontend|backend)\b/.test(c)||"source-mode"===b&&tV(c)||"channels"===b&&/\b(slack|telegram|discord|google chat)\b/.test(c))&&(e+=10),"company-name"===b&&d.some(a=>"website"===a.kind)&&(e+=6),"target-customer"!==b||a.company.targetCustomer||(e-=18),("workflow"===b||"team"===b)&&(e-=4),Math.max(52,Math.min(96,e))}function tX(a,b){return a.includes(b)?"needs-confirmation":"inferred"}function tY(a){return a?a.charAt(0).toLowerCase()+a.slice(1):a}function tZ(a,b){return a.find(a=>RegExp(b,"i").test(`${a.id} ${a.role} ${a.name}`))?.id}function t$(a){return a.filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b)}function t_(a){return a.trim()}function t0(a){return a?.trim()||void 0}function t1(a){return t2((a??[]).flatMap(a=>a.split(/\r?\n|,/g).map(a=>a.trim()).filter(Boolean)).map(a=>a.trim()).filter(Boolean))}function t2(a){return Array.from(new Set(a.filter(Boolean)))}function t3(a){return structuredClone(a)}function t4(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function t5(a){return a.split(/[-_]/g).filter(Boolean).map(a=>a[0].toUpperCase()+a.slice(1)).join(" ")}function t6(a){let b="clone"===a.sourceMode?{label:"Cloning repository",description:"The repository is being cloned before workspace files are added."}:"existing"===a.sourceMode?{label:"Attaching existing folder",description:"Mission Control is validating the existing directory and preparing it for bootstrap."}:{label:"Preparing workspace folder",description:"A fresh workspace directory is being created inside the configured workspace root."};return{title:"Provisioning workspace",description:"Mission Control is creating the workspace and reporting each real bootstrap step as it finishes.",steps:[{id:"validate",label:"Checking input and target path",description:"Workspace input, agent ids, and the destination directory are being validated."},{id:"source",label:b.label,description:b.description},{id:"scaffold",label:"Scaffolding workspace files",description:"Core docs, local state, starter memory, and shared workspace metadata are being written."},{id:"agents",label:1===a.agentCount?"Creating the first agent":"Creating workspace agents",description:1===a.agentCount?"The primary agent is being provisioned and linked to the workspace.":"Each enabled agent is being provisioned and linked to the workspace."},{id:"kickoff",label:a.kickoffMission?"Running kickoff mission":"Finalizing workspace",description:a.kickoffMission?"The primary agent is inspecting the new workspace and refining the initial setup.":"Workspace bootstrap is wrapping up without a kickoff mission."}]}}function t7(a){return{title:a.title,description:a.description,percent:0,steps:a.steps.map(a=>({...a,status:"pending",percent:0,activities:[]}))}}let t8=new Set(["a","an","and","autonomous","automate","automated","automation","build","create","for","from","in","launch","new","of","on","project","run","runs","set","setup","start","that","the","to","up","workspace","adı","agent","ajan","asistan","benim","bide","bir","birde","de","diye","ekleyelim","gibi","i\xe7in","olarak","olsun","proje","şahsi","verelim","yeni"]);function t9(){return{name:"",goal:"",source:""}}function ua(a){let b=a.trim();if(!b)return{kind:"empty",createSourceMode:"empty",label:"Fresh workspace",hint:"Mission Control will scaffold a new project folder."};if(ue(b))return{kind:"existing",createSourceMode:"existing",label:"Existing folder",hint:b,existingPath:b};if(uf(b))return{kind:"clone",createSourceMode:"clone",label:"Clone repository",hint:b,repoUrl:b};let c=ug(b);return c?uh(c)?{kind:"clone",createSourceMode:"clone",label:"Clone repository",hint:c,repoUrl:c}:{kind:"website",createSourceMode:"empty",label:"Fresh workspace + website",hint:c,websiteUrl:c}:{kind:"context",createSourceMode:"empty",label:"Fresh workspace + context",hint:"The pasted source will be attached to the brief.",contextText:b}}function ub(a){let b=a.toLowerCase();return/\b(telegram|discord|community|channel automation|campaign|content|marketing|growth|seo|newsletter)\b/.test(b)?"content":/\b(frontend|ui|website|landing page|design system|dashboard)\b/.test(b)?"frontend":/\b(backend|api|service|microservice|worker|cron|queue|sdk)\b/.test(b)?"backend":/\b(research|investigation|analysis|benchmark|thesis)\b/.test(b)?"research":"software"}function uc(a){return a.name.trim()||function(a,b){let c=function(a){let b=a.trim();if(!b)return;if(uf(b))return ui(b.split(":").at(-1)??"");let c=ug(b);return c?uh(c)?ui(new URL(c).pathname):function(a){try{let[b]=new URL(a).hostname.replace(/^www\./,"").split(".");if(!b)return;return b.split(/[-_]+/g).filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}catch{return}}(c):ue(b)?ui(b):void 0}(a);if(c)return c;let d=function(a){let b=a.match(/["“]([^"”]+)["”]/)?.[1]?.trim();if(b)return b;for(let b of[/\b(?:adı|ismi|name)\s*(?:olarak|:|=)?\s*([\p{L}\p{N}][\p{L}\p{N}._-]{1,40}(?:\s+[\p{L}\p{N}][\p{L}\p{N}._-]{1,40}){0,2})(?=\s+(?:olsun|olacak|diyelim|verelim|koyalım|olarak|için)\b|[.!?,]|$)/iu,/\b([\p{L}\p{N}][\p{L}\p{N}._-]{1,40}(?:\s+[\p{L}\p{N}][\p{L}\p{N}._-]{1,40}){0,2})\s+diye\b/iu]){let c=(a.match(b)?.[1]??"").replace(/\b(yeni|bir|workspace|project|proje|ekleyelim|kuralım|başlatalım|oluşturalım)\b/giu," ").replace(/\b(diye|olarak|benim|bide|bir de)\b.*$/iu,"").replace(/\s+/g," ").trim();if(c)return c}}(b);if(d)return d;let e=b.toLowerCase().replace(/[^a-z0-9\s-]+/g," ").split(/\s+/).map(a=>a.trim()).filter(a=>a&&!t8.has(a)).slice(0,4);return 0===e.length?"":e.map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}(a.source,a.goal)||"New Workspace"}function ud(a){let b=a.workspace.repoUrl?.trim()||a.workspace.existingPath?.trim()||a.intake.sources.find(a=>"website"===a.kind)?.url||a.intake.sources.find(a=>"prompt"===a.kind)?.summary||"";return{name:a.workspace.name||"",goal:a.company.mission||a.product.offer||a.intake.latestPrompt||"",source:b}}function ue(a){return a.startsWith("/")||a.startsWith("./")||a.startsWith("../")}function uf(a){return/^git@[^:]+:[^/].+/.test(a)}function ug(a){if(a.includes("@"))return null;let b=a.replace(/[),.;!?]+$/g,""),c=/^https?:\/\//i.test(b)?b:`https://${b}`;try{let a=new URL(c);return a.hostname.includes(".")?a.toString():null}catch{return null}}function uh(a){try{let b=new URL(a),c=b.hostname.toLowerCase(),d=b.pathname.toLowerCase();return"github.com"===c||"gitlab.com"===c||"bitbucket.org"===c||d.endsWith(".git")}catch{return!1}}function ui(a){let b=a.replace(/\\/g,"/").replace(/\/+$/g,"").split("/").filter(Boolean).at(-1)?.replace(/\.git$/i,"");if(b)return b.split(/[-_]+/g).filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}let uj="workspace-wizard-basic-source",uk="Imported quick setup assumptions:";function ul(a="standard"){return{...td,workspaceOnly:!0,generateStarterDocs:"fastest"!==a,generateMemory:"fastest"!==a,kickoffMission:"fastest"!==a}}function um(a){return{...ul(),...a,workspaceOnly:!0}}function un(a,b,c){let d=structuredClone(a),e=ua(b.source),f=uc(b),g=b.goal.trim();return d.intake.mode=d.intake.mode||"guided",d.intake.started=!!(g||b.source.trim()),g&&(d.intake.initialPrompt||(d.intake.initialPrompt=g),d.intake.latestPrompt=g,d.company.mission=g,d.product.offer.trim()||(d.product.offer=g)),d.workspace.name=f,d.workspace.sourceMode=e.createSourceMode,d.workspace.repoUrl=e.repoUrl,d.workspace.existingPath=e.existingPath,d.workspace.template=ub(`${g}
16
- ${b.source}`),d.workspace.modelProfile=d.workspace.modelProfile||"balanced",d.workspace.rules=um(c??d.workspace.rules),d.intake.sources=d.intake.sources.filter(a=>a.id!==uj),"empty"!==e.kind&&d.intake.sources.unshift(tI({id:uj,kind:"clone"===e.kind?"repo":"existing"===e.kind?"folder":"website"===e.kind?"website":"prompt",label:e.label,summary:e.hint,details:[e.hint],url:e.repoUrl??e.websiteUrl})),tR(d)}function uo(a){return um(a.workspace.rules)}let up="mission-control-workspace-plan-id",uq=[{id:"software",label:"Ship a software workspace",prompt:"Create a software workspace to ship product work, review changes, and keep durable project context."},{id:"frontend",label:"Spin up a frontend squad",prompt:"Create a frontend workspace for rapid UI delivery, QA, and release-ready product handoffs."},{id:"content",label:"Run a content engine",prompt:"Create a content workspace to plan campaigns, produce copy, and keep publishing operations organized."},{id:"research",label:"Start a research pod",prompt:"Create a research workspace for investigation, synthesis, benchmarking, and note capture."}];function ur({open:a,onOpenChange:b,initialMode:c="basic",surfaceTheme:d,snapshot:e,onRefresh:f,onWorkspaceCreated:g}){let h=function({open:a,initialMode:b,onRefresh:c,onWorkspaceCreated:d}){let[e,f]=(0,E.useState)(b),[g,h]=(0,E.useState)(null),[i,j]=(0,E.useState)(null),[k,l]=(0,E.useState)(!1),[m,n]=(0,E.useState)(t9),[o,p]=(0,E.useState)(ul),[q,r]=(0,E.useState)(null),[s,t]=(0,E.useState)(!1),[u,v]=(0,E.useState)(!1),[w,x]=(0,E.useState)(!1),[y,z]=(0,E.useState)(!1),[A,B]=(0,E.useState)(!1),[C,D]=(0,E.useState)(!1),[F,G]=(0,E.useState)(null),[H,I]=(0,E.useState)(null),[J,K]=(0,E.useState)(0),[L,M]=(0,E.useState)(null),N=(0,E.useRef)(null),O=(0,E.useMemo)(()=>ua(m.source),[m.source]),P=(0,E.useMemo)(()=>{let a;return(a=um(o)).generateStarterDocs||a.generateMemory||a.kickoffMission?a.generateStarterDocs&&a.generateMemory&&a.kickoffMission?"standard":"custom":"fastest"},[o]),Q=(0,E.useMemo)(()=>(function({initialTurn:a,step:b,active:c}){return c?a?b>=2?{title:"Still working",description:"The first turn is the slowest. The planner is usually inspecting links and provisioning the hidden architect runtime."}:b>=1?{title:"Collecting context",description:"The architect is reading the prompt, inspecting websites or repos, and drafting the first workspace blueprint."}:{title:"Starting planner",description:"The architect is opening the planning session and preparing the first draft."}:b>=2?{title:"Still working",description:"The architect is waiting on the planner runtime. This can happen when linked context or advisor runs take longer."}:b>=1?{title:"Updating draft",description:"Refreshing context, specialist notes, and the current workspace plan."}:{title:"Architect thinking",description:"Applying your latest direction to the workspace draft."}:null})({initialTurn:!g?.intake.started,step:J,active:u}),[u,g?.intake.started,J]),R=(0,E.useCallback)(a=>{h(b=>b?tR(a(structuredClone(b))):b)},[]),S=(0,E.useCallback)(()=>globalThis.localStorage?.getItem(up)??null,[]),T=(0,E.useCallback)(()=>{globalThis.localStorage?.removeItem(up),l(!1)},[]),U=(0,E.useCallback)(a=>(h(a),l(!!a),a)?(j(a.id),n(ud(a)),p(uo(a)),globalThis.localStorage?.setItem(up,a.id),a):(j(null),null),[]),V=(0,E.useCallback)(async({resumeStored:a})=>{let b=a?globalThis.localStorage?.getItem(up):null;if(b){let a=await fetch(`/api/planner/${b}`,{cache:"no-store"});if(a.ok)return(await a.json()).plan}let c=await fetch("/api/planner",{method:"POST"}),d=await c.json();if(!c.ok||!d.plan)throw Error(d.error||"Unable to create planner workspace.");return d.plan},[]),W=(0,E.useCallback)(async({resumeStored:a,draftOverride:b})=>{if(g)return g;if(N.current)return N.current;let c=(async()=>{t(!0);try{let c=await V({resumeStored:a}),d=b??m,e=d.goal.trim()||d.source.trim()||d.name.trim()?un(c,d,o):c;return U(e)}catch(a){return d9.o.error("Workspace architect could not start.",{description:a instanceof Error?a.message:"Unknown planner error."}),null}finally{t(!1),N.current=null}})();return N.current=c,c},[m,o,U,g,V]),X=(0,E.useCallback)(async()=>{if(r(null),G(null),I(null),v(!1),x(!1),z(!1),B(!1),D(!1),M(null),N.current=null,"basic"===e){T(),h(null),j(null),n(t9()),p(ul());return}T(),h(null),j(null);let a=t9();n(a),p(ul()),await W({resumeStored:!1,draftOverride:a})&&f("advanced")},[T,W,e]),Y=(0,E.useCallback)(()=>{T(),r(null)},[T]),Z=(0,E.useCallback)(async()=>{if(!g||!i)return!1;x(!0);try{let a=await fetch(`/api/planner/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:g})}),b=await a.json();if(!a.ok||!b.plan)throw Error(b.error||"Unable to save planner workspace.");return U(b.plan),d9.o.success("Planner draft saved."),!0}catch(a){return d9.o.error("Planner draft could not be saved.",{description:a instanceof Error?a.message:"Unknown planner save error."}),!1}finally{x(!1)}},[U,g,i]),$=(0,E.useCallback)(async()=>{if(!g||!i)return!1;z(!0);try{let a=await fetch(`/api/planner/${i}/simulate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:g})}),b=await a.json();if(!a.ok||!b.plan)throw Error(b.error||"Unable to simulate planner team.");return U(b.plan),d9.o.success("Planner team simulated."),!0}catch(a){return d9.o.error("Planner simulation failed.",{description:a instanceof Error?a.message:"Unknown planner simulation error."}),!1}finally{z(!1)}},[U,g,i]),_=(0,E.useCallback)(()=>{R(a=>(a.intake.mode="advanced",a.intake.reviewRequested=!0,a.advisorNotes=[],a.conversation.push(tH("assistant","Workspace Architect","Deploy review is open now. I am surfacing the real blockers and warnings that matter before launch.")),a))},[R]),aa=(0,E.useCallback)(async()=>{let a=await W({resumeStored:!1,draftOverride:m})??g;if(!a)return null;let b=un(a,m,o);U(b),D(!0),I(t7(t6({sourceMode:b.workspace.sourceMode,agentCount:1,kickoffMission:b.workspace.rules.kickoffMission??!0})));try{var e;let a=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...{name:b.workspace.name,brief:[(e=b).company.mission.trim()||e.product.offer.trim(),e.company.name.trim()?`Company: ${e.company.name.trim()}`:null,e.product.scopeV1.length>0?`Scope: ${e.product.scopeV1.join(", ")}`:null,...e.intake.sources.flatMap(a=>a.id!==uj?[]:"repo"===a.kind&&a.url?[`Bootstrap source: clone ${a.url}`]:"folder"===a.kind?[`Bootstrap source: existing folder ${a.summary}`]:"website"===a.kind&&a.url?[`Reference website: ${a.url}`]:"prompt"===a.kind?[`Additional context: ${a.summary}`]:[])].filter(a=>!!a?.trim()).join("\n"),directory:b.workspace.directory,modelId:b.workspace.modelId,sourceMode:b.workspace.sourceMode,repoUrl:b.workspace.repoUrl,existingPath:b.workspace.existingPath,template:b.workspace.template,teamPreset:"solo",modelProfile:b.workspace.modelProfile||"balanced",rules:um(b.workspace.rules)},stream:!0})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"OpenClaw could not create the workspace.")}let f=null,g=null;if(await tB(a,async a=>{"progress"===a.type?I(a.progress):(a.progress&&I(a.progress),a.ok?f=a.result:g=a.error)}),g||!f)throw Error(g||"OpenClaw could not create the workspace.");let h=f;return T(),await c(),d(h.workspaceId),d9.o.success("Workspace created.",{description:`${h.agentIds.length} agent${1===h.agentIds.length?"":"s"} created at ${h.workspacePath}`}),h.kickoffError&&d9.o.message("Workspace created, but kickoff needs attention.",{description:h.kickoffError}),h}catch(a){return d9.o.error("Workspace creation failed.",{description:a instanceof Error?a.message:"Unknown workspace error."}),null}finally{D(!1)}},[m,o,T,U,W,c,d,g]),ab=(0,E.useCallback)(async()=>{var a;if(!g||!i)return null;B(!0),G(t7({title:"Deploying workspace",description:"The planner is turning the blueprint into a live workspace and streaming each deploy stage.",steps:[{id:"plan",label:"Locking deploy plan",description:"Deploy blockers are being checked and the planner state is being locked for launch."},...t6({sourceMode:(a={sourceMode:g.workspace.sourceMode??"empty",agentCount:g.team.persistentAgents.filter(a=>a.enabled).length,kickoffMission:g.workspace.rules.kickoffMission??!0,hasChannels:!!g.operations.channels.some(a=>a.enabled&&"internal"!==a.type),hasAutomations:!!g.operations.automations.some(a=>a.enabled),hasPlannerKickoffs:!!g.deploy.firstMissions.some(a=>a.trim().length>0)}).sourceMode,agentCount:a.agentCount,kickoffMission:a.kickoffMission}).steps,{id:"blueprint",label:"Writing planner files",description:"Planner blueprint, company notes, and workflow docs are being written into the workspace."},{id:"channels",label:a.hasChannels?"Provisioning channels":"Checking channels",description:a.hasChannels?"Enabled external channels are being provisioned and connected.":"No external channels are enabled, so this stage will pass quickly."},{id:"automations",label:a.hasAutomations?"Provisioning automations":"Checking automation loops",description:a.hasAutomations?"Enabled recurring loops are being attached to their target agents.":"No recurring automations are enabled, so this stage is mostly validation."},{id:"planner-kickoff",label:a.hasPlannerKickoffs?"Running planner kickoff missions":"Finalizing deploy",description:a.hasPlannerKickoffs?"The first missions are being dispatched so the new workspace starts with clear momentum.":"The workspace is being finalized and the deploy request is wrapping up."}]}));try{let a=await fetch(`/api/planner/${i}/deploy`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:g,stream:!0})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Unable to deploy planner workspace.")}let b=null,e=null;if(await tB(a,async a=>{"progress"===a.type?G(a.progress):(a.progress&&G(a.progress),a.ok?b=a.result:e=a.error)}),e||!b)throw Error(e||"Unable to deploy planner workspace.");let f=b;return U(f.plan),T(),await c(),d(f.workspaceId),d9.o.success("Workspace deployed.",{description:f.workspacePath}),f}catch(a){return d9.o.error("Planner deploy failed.",{description:a instanceof Error?a.message:"Unknown deploy error."}),null}finally{B(!1)}},[T,U,c,d,g,i]),ac=(0,E.useCallback)(async a=>{if(!a.trim())return!1;v(!0),M(a.trim());try{let c="advanced"===b&&!g&&!m.goal.trim()&&!m.source.trim()&&!m.name.trim(),d=await W({resumeStored:c,draftOverride:m})??g;if(!d)return!1;let e=await fetch(`/api/planner/${d.id}/turn`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:a,plan:d})}),f=await e.json();if(!e.ok||!f.plan)throw Error(f.error||"Unable to process planner turn.");return U(f.plan),r(null),!0}catch(a){return d9.o.error("Planner turn failed.",{description:a instanceof Error?a.message:"Unknown planner turn error."}),!1}finally{M(null),v(!1)}},[m,U,W,b,g]),ad=(0,E.useCallback)(async()=>{let a=S();if(!a)return l(!1),!1;t(!0);try{let b=await fetch(`/api/planner/${a}`,{cache:"no-store"}),c=await b.json();if(!b.ok||!c.plan)throw Error(c.error||"Unable to load the stored planner draft.");return U(c.plan),f("advanced"),r({tone:"muted",title:"Resumed previous draft",description:"Architect restored your earlier blueprint so you can keep shaping the same workspace."}),!0}catch(a){return d9.o.error("Stored draft could not be resumed.",{description:a instanceof Error?a.message:"Unknown planner error."}),!1}finally{t(!1),N.current=null}},[U,S]),ae=(0,E.useCallback)(async a=>{if(a!==e){if("advanced"===a){let a=await W({resumeStored:!1,draftOverride:m});if(!a)return;let b=un(a,m,o),c=!b.intake.started&&b.conversation.filter(a=>"system"!==a.role).length<=1?function(a,b){let c=structuredClone(a),d=b.goal.trim(),e=b.source.trim();if(c.conversation=c.conversation.filter(a=>!("system"===a.role&&"Workspace Wizard"===a.author&&a.text.startsWith(uk))),!d&&!e)return tR(c);let f=[d?`goal: ${d}`:null,e?`source: ${e}`:null,`fast-path name: ${uc(b)}`].filter(Boolean);return c.conversation.push(tH("system","Workspace Wizard",`${uk} ${f.join(" \xb7 ")}`)),tR(c)}(b,m):b;U(c),r(c.intake.started||m.goal.trim()||m.source.trim()?{tone:"muted",title:"Same draft, deeper controls",description:"Architect will keep extending the exact same conversation and blueprint as you move into Advanced."}:null),f("advanced");return}if(g)n(ud(g)),p(uo(g)),r(g&&(g.team.persistentAgents.filter(a=>a.enabled).length>1||g.operations.workflows.some(a=>a.enabled)||g.operations.automations.some(a=>a.enabled)||g.operations.channels.some(a=>a.enabled&&"internal"!==a.type)||g.operations.hooks.some(a=>a.enabled))?{tone:"warning",title:"Advanced details preserved",description:"Basic mode will keep showing the fast path, but the richer blueprint remains in memory if you switch back."}:null);else r(null);f("basic")}},[m,o,U,W,e,g]),af=(0,E.useCallback)(a=>{n(b=>{let c={...b,goal:a};return"basic"===e&&h(a=>a?un(a,c,o):a),c})},[o,e]),ag=(0,E.useCallback)(a=>{n(b=>{let c={...b,source:a};return"basic"===e&&h(a=>a?un(a,c,o):a),c})},[o,e]),ah=(0,E.useCallback)(a=>{n(b=>{let c={...b,name:a};return"basic"===e&&h(a=>a?un(a,c,o):a),c})},[o,e]),ai=(0,E.useCallback)(a=>{let b=ul(a);p(b),h(a=>a?un(a,m,b):a)},[m]),aj=(0,E.useCallback)(a=>{p(b=>{let c={...b,[a]:!b[a],workspaceOnly:!0};return h(a=>a?un(a,m,c):a),c})},[m]);return{mode:e,plan:g,planId:i,hasStoredDraft:k,notice:q,sourceAnalysis:O,basicDraft:m,basicRules:o,basicPreset:P,isPlanLoading:s,isSending:u,isSaving:w,isSimulating:y,isDeploying:A,isCreating:C,createProgress:H,deployProgress:F,architectBusyStatus:Q,pendingUserMessage:L,setBasicGoal:af,setBasicSource:ag,setBasicName:ah,setBasicPreset:ai,toggleBasicRule:aj,setNotice:r,updatePlan:R,switchMode:ae,startFreshDraft:X,discardStoredDraft:Y,resumeStoredDraft:ad,savePlan:Z,simulatePlan:$,requestReview:_,createWorkspace:aa,deployPlan:ab,submitArchitectTurn:ac}}({open:a,initialMode:c,onRefresh:f,onWorkspaceCreated:g}),[i,j]=(0,E.useState)(""),[k,l]=(0,E.useState)(!1),m="light"===d,n=a=>{a||(j(""),l(!1)),b(a)},o=uc(h.basicDraft),p=ub(`${h.basicDraft.goal}
17
- ${h.basicDraft.source}`),q=function(a,b,c=ua(b.source)){if("existing"===c.kind&&c.existingPath)return c.existingPath;let d=uc(b).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return`${qV(a)}/${d||"workspace"}`}(e.diagnostics.workspaceRoot,h.basicDraft,h.sourceAnalysis),r=(0,E.useMemo)(()=>{var a,b;let c;return a=h.mode,b=h.plan,c=[{id:"surface",label:"basic"===a?"Architect-assisted fast path":"Architect co-design",tone:"muted"}],b&&("basic"===a?b.intake.confirmations.length>0?c.push({id:"confirmations",label:`${b.intake.confirmations.length} decision${1===b.intake.confirmations.length?"":"s"} needed`,tone:b.intake.confirmations.length>1?"warning":"muted"}):b.intake.started&&c.push({id:"draft",label:"Draft synced live",tone:"muted"}):(b.intake.confirmations.length>0&&c.push({id:"confirmations",label:`${b.intake.confirmations.length} decision${1===b.intake.confirmations.length?"":"s"} needed`,tone:b.intake.confirmations.length>1?"warning":"muted"}),c.push({id:"stage",label:`Stage \xb7 ${s9(b.stage)}`,tone:"muted"}),c.push({id:"readiness",label:`${b.readinessScore}% drafted`,tone:b.readinessScore>=85?"success":b.readinessScore>=45?"warning":"muted"}),c.push({id:"status",label:`Status \xb7 ${b.status}`,tone:"blocked"===b.status?"danger":"ready"===b.status||"deployed"===b.status?"success":"review"===b.status?"warning":"muted"}))),c},[h.mode,h.plan]),s=(0,E.useMemo)(()=>{var a,b;let c;return a=h.plan,b=h.pendingUserMessage,c=a?.conversation.map(a=>({id:a.id,role:a.role,author:"assistant"===a.role?"Architect":"system"===a.role?"Workspace Wizard":a.author,text:a.text}))??[],b?.trim()&&c.push({id:"pending-user-message",role:"user",text:b.trim(),status:"pending"}),c},[h.pendingUserMessage,h.plan]),t=(0,E.useMemo)(()=>{let a=(h.plan?.intake.suggestedReplies??[]).filter(a=>a.trim().length>0).map((a,b)=>({id:`reply-${b}`,label:a,prompt:a})).slice(0,"basic"===h.mode?3:4);return a.length>0?a:h.plan?.intake.started?[]:uq.slice(0,"basic"===h.mode?3:4)},[h.mode,h.plan?.intake.started,h.plan?.intake.suggestedReplies]),u=h.isCreating?h.createProgress:h.isDeploying?h.deployProgress:null,v=h.isSending||h.isPlanLoading||h.isDeploying||h.isCreating,w="basic"===h.mode&&h.hasStoredDraft&&!h.plan&&!h.isPlanLoading,x=!!(h.plan?.intake.started||h.basicDraft.goal.trim()||i.trim()),y=async a=>{let b=(a??i).trim();if(!b)return!1;let c=void 0===a;c&&j("");let d=await h.submitArchitectTurn(b);return!d&&c&&j(i),d},z=async()=>{(!i.trim()||await y())&&await h.createWorkspace()&&n(!1)},A=async()=>{await h.deployPlan()&&n(!1)};return(0,D.jsx)(dw,{open:a,onOpenChange:n,children:(0,D.jsxs)(d$,{className:m?"h-[92vh] max-w-[min(1380px,96vw)] gap-0 overflow-hidden border-[#e7dfd4] bg-[#fcfaf6] p-0 text-[#161411] shadow-[0_40px_140px_rgba(16,12,8,0.45)]":"h-[92vh] max-w-[min(1380px,96vw)] gap-0 overflow-hidden border-white/10 bg-[rgba(4,8,15,0.96)] p-0 text-white shadow-[0_40px_140px_rgba(0,0,0,0.58)]",children:[(0,D.jsx)(d1,{className:"sr-only",children:"Create workspace"}),(0,D.jsx)(d2,{className:"sr-only",children:"Create a workspace in Basic or Advanced mode using the Architect wizard."}),(0,D.jsxs)("div",{className:"relative flex h-full min-h-0 flex-col overflow-hidden",children:[(0,D.jsx)("div",{className:m?"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_top,rgba(255,255,255,0.86),transparent_34%),linear-gradient(180deg,rgba(248,244,237,0.92),rgba(252,250,246,0.86)_24%,rgba(244,238,230,0.82)_100%)]":"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_top,rgba(59,130,246,0.14),transparent_28%),radial-gradient(circle_at_80%_18%,rgba(56,189,248,0.12),transparent_24%),linear-gradient(180deg,rgba(9,15,27,0.98),rgba(4,8,15,0.96)_28%,rgba(2,6,13,0.98)_100%)]"}),(0,D.jsx)(tt,{surfaceTheme:d,mode:h.mode,onModeChange:a=>{h.switchMode(a)},onNewDraft:()=>{j(""),l(!1),h.startFreshDraft()},badges:r}),(0,D.jsxs)("div",{className:"relative z-[1] grid min-h-0 flex-1 lg:grid-cols-[minmax(0,1fr),390px] xl:grid-cols-[minmax(0,1fr),420px]",children:[(0,D.jsxs)("div",{className:m?"flex min-h-0 flex-col bg-[linear-gradient(180deg,rgba(252,250,246,0.7),rgba(247,242,235,0.92))]":"flex min-h-0 flex-col bg-[linear-gradient(180deg,rgba(8,13,24,0.2),rgba(6,10,18,0.42))]",children:[(0,D.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[h.architectBusyStatus?(0,D.jsx)("div",{className:m?"border-b border-[#ece5db] px-4 py-3 md:px-5":"border-b border-white/10 px-4 py-3 md:px-5",children:(0,D.jsxs)("div",{className:m?"rounded-[18px] border border-[#e6dfd5] bg-white px-4 py-3":"rounded-[18px] border border-white/10 bg-white/[0.04] px-4 py-3",children:[(0,D.jsx)("p",{className:m?"text-[11px] uppercase tracking-[0.18em] text-[#8b7262]":"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:h.architectBusyStatus.title}),(0,D.jsx)("p",{className:m?"mt-1 text-[13px] leading-6 text-[#6d665e]":"mt-1 text-[13px] leading-6 text-slate-300",children:h.architectBusyStatus.description})]})}):null,(0,D.jsx)("div",{className:"min-h-0 flex-1",children:(0,D.jsx)(tx,{surfaceTheme:d,messages:s,isTyping:h.isSending,typingLabel:"Architect is shaping the next pass...",emptyState:h.isPlanLoading&&0===s.length?(0,D.jsx)(uu,{surfaceTheme:d}):0===s.length&&"basic"===h.mode?(0,D.jsx)(us,{surfaceTheme:d}):0===s.length?(0,D.jsx)(ut,{surfaceTheme:d}):null,auxiliary:(0,D.jsxs)(D.Fragment,{children:[w?(0,D.jsx)(uw,{surfaceTheme:d,isBusy:v,onResume:()=>{h.resumeStoredDraft()},onStartFresh:h.discardStoredDraft}):null,u?(0,D.jsx)("div",{className:"mx-auto w-full max-w-3xl",children:(0,D.jsx)(s_,{progress:u,className:m?"border-[#e6dfd5] bg-white":"border-white/10 bg-slate-950/50"})}):"basic"!==h.mode||h.plan?.intake.started||h.pendingUserMessage?null:(0,D.jsx)(uv,{surfaceTheme:d,name:h.basicDraft.name,source:h.basicDraft.source,onNameChange:h.setBasicName,onSourceChange:h.setBasicSource})]})})})]}),(0,D.jsx)("div",{className:m?"border-t border-[#ece5db] bg-[linear-gradient(180deg,rgba(252,250,246,0.7),rgba(247,242,235,0.92))] px-4 py-4 md:px-5":"border-t border-white/10 bg-[linear-gradient(180deg,rgba(5,9,18,0.68),rgba(4,8,15,0.94))] px-4 py-4 md:px-5",children:(0,D.jsxs)("div",{className:"mx-auto w-full max-w-4xl",children:[(0,D.jsx)(tA,{surfaceTheme:d,chips:t.map(a=>({id:a.id,label:a.label})),disabled:v,onSelect:a=>{let b=t.find(b=>b.id===a.id);b&&y(b.prompt)},className:"mb-3"}),(0,D.jsx)(tw,{surfaceTheme:d,value:i,onChange:j,onSubmit:async()=>{await y()},placeholder:"basic"===h.mode?"Tell Architect what this workspace should do first...":"Keep shaping the workspace with Architect...",disabled:v,isBusy:h.isSending,helperText:"basic"===h.mode?"Architect keeps the fast-path draft synced while you stay in one lightweight flow.":"Architect updates the same structured draft with every turn.",toolbar:"basic"!==h.mode||h.plan?h.plan?(0,D.jsxs)("span",{className:m?"inline-flex items-center rounded-full border border-[#e3ddd4] bg-[#f6f1ea] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-[#6c645b]":"inline-flex items-center rounded-full border border-white/10 bg-white/[0.05] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-slate-300",children:["Stage \xb7 ",s9(h.plan.stage)]}):null:(0,D.jsx)("span",{className:m?"inline-flex items-center rounded-full border border-[#e3ddd4] bg-[#f6f1ea] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-[#6c645b]":"inline-flex items-center rounded-full border border-white/10 bg-white/[0.05] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-slate-300",children:"Architect live"})})]})})]}),(0,D.jsx)(th,{className:"hidden lg:block",surfaceTheme:d,mode:h.mode,snapshot:e,plan:h.plan,resolvedName:o,resolvedTemplate:p,sourceAnalysis:h.sourceAnalysis,workspacePath:q,notice:h.notice,basicRules:h.basicRules,basicPreset:h.basicPreset,onBasicPresetChange:h.setBasicPreset,onBasicRuleToggle:h.toggleBasicRule,progress:"basic"===h.mode?h.createProgress:h.isDeploying?h.deployProgress:null})]}),k?(0,D.jsxs)("div",{className:m?"absolute inset-0 z-20 flex flex-col bg-[rgba(22,18,14,0.18)] backdrop-blur-sm lg:hidden":"absolute inset-0 z-20 flex flex-col bg-[rgba(2,6,13,0.56)] backdrop-blur-sm lg:hidden",children:[(0,D.jsxs)("div",{className:m?"flex items-center justify-between border-b border-[#e7dfd4] bg-[#fcfaf6] px-4 py-3":"flex items-center justify-between border-b border-white/10 bg-[rgba(4,8,15,0.96)] px-4 py-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:m?"text-[11px] uppercase tracking-[0.18em] text-[#9f958a]":"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:"basic"===h.mode?"Workspace draft":"Workspace blueprint"}),(0,D.jsx)("p",{className:m?"text-[13px] text-[#6f675e]":"text-[13px] text-slate-300",children:"Review the structured side of the same wizard."})]}),(0,D.jsx)("button",{type:"button",onClick:()=>l(!1),className:m?"inline-flex size-9 items-center justify-center rounded-full border border-[#e4ddd3] bg-white text-[#4f4943] transition-colors hover:bg-[#f4efe7]":"inline-flex size-9 items-center justify-center rounded-full border border-white/10 bg-white/[0.05] text-slate-200 transition-colors hover:bg-white/[0.08]",children:(0,D.jsx)(dY,{className:"h-4 w-4"})})]}),(0,D.jsx)(th,{className:"min-h-0 flex-1 border-t-0 lg:hidden",surfaceTheme:d,mode:h.mode,snapshot:e,plan:h.plan,resolvedName:o,resolvedTemplate:p,sourceAnalysis:h.sourceAnalysis,workspacePath:q,notice:h.notice,basicRules:h.basicRules,basicPreset:h.basicPreset,onBasicPresetChange:h.setBasicPreset,onBasicRuleToggle:h.toggleBasicRule,progress:"basic"===h.mode?h.createProgress:h.isDeploying?h.deployProgress:null})]}):null,(0,D.jsx)("div",{className:m?"relative z-[1] border-t border-[#e7dfd4] bg-white/90 px-4 py-3 backdrop-blur-sm md:px-5":"relative z-[1] border-t border-white/10 bg-[rgba(4,8,15,0.88)] px-4 py-3 backdrop-blur-sm md:px-5",children:(0,D.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[(0,D.jsx)("p",{className:m?"text-[13px] text-[#776f65]":"text-[13px] text-slate-300",children:"basic"===h.mode?"One prompt is enough to start. Create now or open the richer blueprint.":"Advanced keeps the conversation and blueprint aligned through launch review."}),(0,D.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,D.jsxs)(bp,{variant:"secondary",size:"sm",className:m?"rounded-full border-[#dfd8ce] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3] lg:hidden":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08] lg:hidden",onClick:()=>l(!0),children:[(0,D.jsx)(s$,{className:"mr-2 h-4 w-4"}),"View blueprint"]}),"basic"===h.mode?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(bp,{variant:"secondary",size:"sm",className:m?"rounded-full border-[#dfd8ce] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",onClick:()=>{h.switchMode("advanced")},disabled:h.isCreating||h.isSending||h.isPlanLoading,children:"Advanced details"}),(0,D.jsxs)(bp,{size:"sm",className:m?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>void z(),disabled:h.isCreating||h.isSending||h.isPlanLoading||!x,children:[h.isCreating?(0,D.jsx)(L,{className:"mr-2 h-4 w-4 animate-spin"}):(0,D.jsx)(cl,{className:"mr-2 h-4 w-4"}),"Create workspace"]})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(bp,{variant:"secondary",size:"sm",className:m?"rounded-full border-[#dfd8ce] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",onClick:()=>void h.savePlan(),disabled:!h.plan||h.isSaving||h.isPlanLoading,children:[h.isSaving?(0,D.jsx)(L,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save draft"]}),h.plan?.intake.reviewRequested?(0,D.jsxs)(bp,{size:"sm",className:m?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>void A(),disabled:!h.plan||h.plan.deploy.blockers.length>0||h.isDeploying||h.isPlanLoading,children:[h.isDeploying?(0,D.jsx)(L,{className:"mr-2 h-4 w-4 animate-spin"}):(0,D.jsx)(co,{className:"mr-2 h-4 w-4"}),"Deploy workspace"]}):(0,D.jsx)(bp,{size:"sm",className:m?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>h.requestReview(),disabled:!h.plan||h.isSending||h.isDeploying,children:"Review blueprint"})]})]})]})})]})]})})}function us({surfaceTheme:a}){let b="light"===a;return(0,D.jsxs)("div",{className:"mx-auto mt-4 flex w-full max-w-3xl flex-col justify-center px-4 md:mt-16 md:px-8",children:[(0,D.jsx)("p",{className:b?"text-[28px] font-semibold tracking-[-0.03em] text-[#181612]":"text-[28px] font-semibold tracking-[-0.03em] text-white",children:"One message is enough to start."}),(0,D.jsx)("p",{className:b?"mt-2 text-[28px] tracking-[-0.03em] text-[#7f756b]":"mt-2 text-[28px] tracking-[-0.03em] text-slate-400",children:"Describe the outcome, paste a source, and let Architect shape the workspace without pushing you into full planning too early."})]})}function ut({surfaceTheme:a}){let b="light"===a;return(0,D.jsxs)("div",{className:"mx-auto mt-4 flex w-full max-w-3xl flex-col justify-center px-4 md:mt-16 md:px-8",children:[(0,D.jsx)("p",{className:b?"text-[28px] font-semibold tracking-[-0.03em] text-[#181612]":"text-[28px] font-semibold tracking-[-0.03em] text-white",children:"Design the workspace with Architect."}),(0,D.jsx)("p",{className:b?"mt-2 text-[28px] tracking-[-0.03em] text-[#7f756b]":"mt-2 text-[28px] tracking-[-0.03em] text-slate-400",children:"Describe the operating model, and the blueprint will update alongside the conversation."})]})}function uu({surfaceTheme:a}){return(0,D.jsxs)("div",{className:"light"===a?"mx-auto mt-10 flex w-full max-w-3xl items-center gap-3 rounded-[22px] border border-[#e6dfd5] bg-white px-5 py-4 text-[14px] text-[#6d665e]":"mx-auto mt-10 flex w-full max-w-3xl items-center gap-3 rounded-[22px] border border-white/10 bg-white/[0.04] px-5 py-4 text-[14px] text-slate-300",children:[(0,D.jsx)(L,{className:"h-4 w-4 animate-spin"}),"Architect is opening the planning session and loading the latest blueprint."]})}function uv({surfaceTheme:a,name:b,source:c,onNameChange:d,onSourceChange:e}){let f="light"===a;return(0,D.jsx)("div",{className:f?"mx-auto w-full max-w-3xl rounded-[24px] border border-[#e4ddd3] bg-white p-4 shadow-[0_24px_80px_rgba(56,47,38,0.06)]":"mx-auto w-full max-w-3xl rounded-[24px] border border-white/10 bg-white/[0.04] p-4 shadow-[0_24px_80px_rgba(0,0,0,0.28)]",children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("span",{className:f?"inline-flex size-9 shrink-0 items-center justify-center rounded-full border border-[#e4ddd3] bg-[#faf6f1] text-[#5e5750]":"inline-flex size-9 shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/[0.05] text-slate-300",children:(0,D.jsx)(cl,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("p",{className:f?"text-[11px] uppercase tracking-[0.18em] text-[#8b7262]":"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:"Quick setup"}),(0,D.jsx)("p",{className:f?"mt-1 text-[13px] leading-6 text-[#70685f]":"mt-1 text-[13px] leading-6 text-slate-300",children:"Keep the fast path lightweight. Optional name and source live here; the main goal still comes through the composer."}),(0,D.jsxs)("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[(0,D.jsx)(ux,{surfaceTheme:a,label:"Workspace name",children:(0,D.jsx)(bq,{value:b,onChange:a=>d(a.target.value),placeholder:"Optional. Architect can infer it.",className:f?"border-[#e4ddd3] bg-[#fcfaf6] text-[#1c1916] placeholder:text-[#9b948c] focus-visible:ring-[#b8ada1]":"border-white/10 bg-[rgba(4,8,15,0.64)] text-slate-100 placeholder:text-slate-500 focus-visible:ring-cyan-300/60"})}),(0,D.jsx)(ux,{surfaceTheme:a,label:"Source",children:(0,D.jsx)(bq,{value:c,onChange:a=>e(a.target.value),placeholder:"Repo URL, website URL, or existing folder path",className:f?"border-[#e4ddd3] bg-[#fcfaf6] text-[#1c1916] placeholder:text-[#9b948c] focus-visible:ring-[#b8ada1]":"border-white/10 bg-[rgba(4,8,15,0.64)] text-slate-100 placeholder:text-slate-500 focus-visible:ring-cyan-300/60"})})]})]})]})})}function uw({surfaceTheme:a,isBusy:b,onResume:c,onStartFresh:d}){let e="light"===a;return(0,D.jsx)("div",{className:e?"mx-auto w-full max-w-3xl rounded-[22px] border border-[#e4ddd3] bg-[#fffaf3] px-4 py-4 shadow-[0_18px_48px_rgba(56,47,38,0.05)]":"mx-auto w-full max-w-3xl rounded-[22px] border border-white/10 bg-white/[0.05] px-4 py-4",children:(0,D.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:e?"text-[11px] uppercase tracking-[0.18em] text-[#8b7262]":"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:"Previous draft found"}),(0,D.jsx)("p",{className:e?"mt-1 text-[14px] leading-6 text-[#30261d]":"mt-1 text-[14px] leading-6 text-white",children:"Architect still has an earlier workspace blueprint. Resume it or start fresh before creating a new one."})]}),(0,D.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,D.jsx)(bp,{variant:"secondary",size:"sm",className:e?"rounded-full border-[#dfd8ce] bg-white text-[#403934] hover:bg-[#f7f2eb]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",onClick:d,disabled:b,children:"Start fresh"}),(0,D.jsx)(bp,{size:"sm",className:e?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:c,disabled:b,children:"Resume blueprint"})]})]})})}function ux({surfaceTheme:a,label:b,children:c}){return(0,D.jsxs)("div",{className:"space-y-1.5",children:[(0,D.jsx)("p",{className:"light"===a?"text-[11px] uppercase tracking-[0.16em] text-[#8d8276]":"text-[11px] uppercase tracking-[0.16em] text-slate-500",children:b}),c]})}function uy({initialSnapshot:a}){var b,c,d,e,f,g,h;let{snapshot:i,connectionState:j,refresh:k,refreshSnapshot:l,setSnapshot:m}=function(a){let[b,c]=(0,E.useState)(a),[d,e]=(0,E.useState)("connecting"),f=async()=>{let a=await fetch("/api/snapshot",{cache:"no-store"}),b=await a.json();return(0,E.startTransition)(()=>{c(b),e("live")}),b};return{snapshot:b,connectionState:d,refresh:async()=>{await f()},refreshSnapshot:f,setSnapshot:c}}(a),[n,o]=(0,E.useState)(a.workspaces[0]?.id??null),[p,q]=(0,E.useState)(a.workspaces[0]?.id??null),[r,s]=(0,E.useState)("overview"),[t,u]=(0,E.useState)(null),[v,w]=(0,E.useState)(null),[x,y]=(0,E.useState)([]),[z,A]=(0,E.useState)(null),[B,C]=(0,E.useState)([]),[F,G]=(0,E.useState)([]),[H,I]=(0,E.useState)([]),[J,K]=(0,E.useState)(null),[O,P]=(0,E.useState)(null),[Q,R]=(0,E.useState)("idle"),[S,T]=(0,E.useState)(null),U=(0,E.useRef)(new Map),[V,W]=(0,E.useState)(!1),[X,Y]=(0,E.useState)(!1),[Z,$]=(0,E.useState)(!1),[_,aa]=(0,E.useState)(!1),[ab,ac]=(0,E.useState)(null),[ad,ae]=(0,E.useState)("idle"),[af,ag]=(0,E.useState)(null),[ah,ai]=(0,E.useState)(null),[aj,ak]=(0,E.useState)("idle"),[al,am]=(0,E.useState)(null),[an,ao]=(0,E.useState)(null),[ap,aq]=(0,E.useState)(null),[ar,as]=(0,E.useState)(""),[at,au]=(0,E.useState)(""),[av,aw]=(0,E.useState)(()=>uH(a)),[ax,ay]=(0,E.useState)(()=>uI(a)),[az,aA]=(0,E.useState)(!1),[aB,aC]=(0,E.useState)(!1),[aD,aE]=(0,E.useState)(!1),[aF,aG]=(0,E.useState)("idle"),[aH,aI]=(0,E.useState)(null),[aJ,aK]=(0,E.useState)(null),[aL,aM]=(0,E.useState)(""),[aN,aO]=(0,E.useState)("idle"),[aP,aQ]=(0,E.useState)(null),[aR,aS]=(0,E.useState)(null),[aT,aU]=(0,E.useState)(null),[aV,aW]=(0,E.useState)(""),[aX,aY]=(0,E.useState)(null),[aZ,a$]=(0,E.useState)(null),[a_,a0]=(0,E.useState)("system"),[a1,a2]=(0,E.useState)(""),[a3,a4]=(0,E.useState)([]),[a5,a6]=(0,E.useState)("idle"),[a7,a8]=(0,E.useState)(null),[a9,ba]=(0,E.useState)(null),[bc,bd]=(0,E.useState)(null),[be,bf]=(0,E.useState)(""),[bg,bh]=(0,E.useState)(null),[bi,bj]=(0,E.useState)(null),[bk,bl]=(0,E.useState)(!1),[bm,bn]=(0,E.useState)(!1),[bo,bq]=(0,E.useState)(!1),[br,bs]=(0,E.useState)(()=>sr(a)),[bt,bu]=(0,E.useState)(null),[bv,bw]=(0,E.useState)(null),[bx,by]=(0,E.useState)("dark"),[bz,bA]=(0,E.useState)(!1),[bB,bC]=(0,E.useState)("basic"),[bD,bE]=(0,E.useState)(!1),[bF,bG]=(0,E.useState)(null),bH=(0,E.useMemo)(()=>(function(a,b){if(0===b.length)return a;let c=b.filter(b=>!b.dispatchId||!a.tasks.some(a=>a.dispatchId===b.dispatchId)).map(a=>a.task);return 0===c.length?a:{...a,tasks:[...c,...a.tasks]}})(i,x),[i,x]),bI=(0,E.useCallback)((a,b="overview")=>{q(a),s(b)},[]),bJ=(0,E.useRef)(null);(0,E.useRef)(null);let bK=i.runtimes.filter(a=>"running"===a.status||"queued"===a.status).length,bL=sq(i),bM=sr(i),bN=[i.diagnostics.updatePackageManager,i.diagnostics.updateInstallKind].filter(Boolean).join(" \xb7 "),bO="running"===aF,bP="success"===aF||"error"===aF,bQ="running"===(b=aF)?"Updating OpenClaw":"success"===b?"Update complete":"error"===b?"Update failed":"Update OpenClaw",bR="running"===(c=aF)?"OpenClaw is being updated now. Local gateway activity may pause briefly while the CLI is replaced.":"success"===c?"The CLI update finished. Review the result below, then close this panel when you are done.":"error"===c?"The update did not complete cleanly. Review the result and captured output before trying again.":"This runs openclaw update against the installed CLI and may briefly interrupt local gateway activity.",bS=(d=i).diagnostics.installed?sq(d)?{label:"Enter Mission Control",description:"OpenClaw is online and the runtime state is writable."}:d.diagnostics.rpcOk?{label:"Repair runtime access",description:"OpenClaw is online, but Mission Control still needs verified write access to the runtime state."}:d.diagnostics.loaded?(!d.diagnostics.rpcOk,{label:"Start OpenClaw",description:"Start the local gateway service and wait for a live RPC connection."}):{label:"Prepare local gateway",description:"OpenClaw CLI is already ready. Mission Control will register the local gateway service once, then start it."}:{label:"Install OpenClaw",description:"Download the OpenClaw CLI and prepare this machine for Mission Control."},bT=bK>0||x.length>0,bU=!bk&&!bM&&!bT&&(!br||"offline"===i.diagnostics.health),bV=i.tasks.filter(a=>!n||a.workspaceId===n),bW=bV.filter(a=>{var b,c,d;return b=a,c=B,d=F,!H.includes(b.key)&&(!!d.includes(b.key)||0!==b.runtimeIds.length&&b.runtimeIds.every(a=>c.includes(a)))}).length,bX=bV.filter(a=>"completed"===a.status||"stalled"===a.status||"cancelled"===a.status||"idle"===a.status||uC(a)).length,bY=()=>{"running"!==aF&&(aG("idle"),aI(null),aK(null),aM(""))},bZ=a=>{aM(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},b$=a=>{aW(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},b_=a=>{bf(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},b0=a=>{as(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},b1=(0,E.useCallback)(async()=>{if(!O||"running"===Q)return;let a="string"==typeof O.metadata.optimisticRequestId?O.metadata.optimisticRequestId:null,b=a?x.find(b=>b.requestId===a):x.find(a=>a.task.id===O.id),c="string"==typeof O.dispatchId?O.dispatchId:b?.dispatchId??null;if(a&&!c){U.current.get(a)?.abort(),U.current.delete(a),y(b=>b.map(b=>b.requestId===a?{...b,task:uE(b.task,{status:"cancelled",subtitle:"Mission submission cancelled before dispatch.",bootstrapStage:"cancelled",feedEvent:{id:`${b.task.id}:cancelled:${Date.now()}`,kind:"warning",timestamp:new Date().toISOString(),title:"Dispatch cancelled",detail:"Mission submission cancelled before dispatch.",isError:!1}})}:b)),d9.o.success("Mission submission cancelled.",{description:O.title}),P(null),R("idle"),T(null);return}R("running"),T(null);try{let a=await fetch(`/api/tasks/${encodeURIComponent(O.id)}/abort`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Aborted from Mission Control.",dispatchId:c})}),b=await a.json().catch(()=>null);if(!a.ok)throw Error(b?.error||b?.message||b?.summary||"Unable to abort task.");d9.o.success("Task abort requested.",{description:O.title}),P(null),R("idle"),await k()}catch(b){let a=b instanceof Error?b.message:"Unknown abort error.";R("error"),T(a),d9.o.error("Task abort failed.",{description:a})}},[x,k,O,Q]),b2=a=>{a&&a4(a)},b3=async()=>{aE(!0),aG("running"),aI("Starting OpenClaw update..."),aK(null),aM("");try{let a=await fetch("/api/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirmed:!0})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"OpenClaw update request failed.")}if(!a.body)throw Error("OpenClaw update did not return a readable stream.");let b=a.body.getReader(),c=new TextDecoder,d="",e=!1;for(;;){let{value:a,done:f}=await b.read();if(f)break;let g=(d+=c.decode(a,{stream:!0})).indexOf("\n");for(;g>=0;){let a=d.slice(0,g).trim();if(d=d.slice(g+1),a){let b=JSON.parse(a);"status"===b.type?(aI(b.message),bZ(`
15
+ ${g}`:f:g)}),requestAnimationFrame(()=>{J.current?.focus();let a=J.current?.value??"";J.current?.setSelectionRange(a.length,a.length)})};return(0,D.jsx)("div",{className:bc("mx-auto w-full transition-[width] duration-300",X&&"lg:w-[360px]"),onMouseEnter:()=>{B&&G(!0)},onMouseLeave:()=>{B&&G(!1)},children:(0,D.jsx)(rG,{initial:!1,mode:"wait",children:X?(0,D.jsx)(pV.button,{type:"button",initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.98},onFocus:()=>G(!0),onClick:()=>{G(!0),requestAnimationFrame(()=>{J.current?.focus()})},className:"w-full overflow-hidden rounded-full border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] p-2 text-left shadow-[0_24px_72px_rgba(0,0,0,0.22)] isolate",children:(0,D.jsxs)("div",{className:"flex items-center gap-2 rounded-full border border-white/[0.07] bg-[linear-gradient(180deg,rgba(20,28,43,0.9),rgba(11,17,28,0.88))] px-3 py-2 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",children:[(0,D.jsx)("span",{className:"inline-flex h-7 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-2.5 text-[11px] text-slate-300",children:P?.name||"No agent"}),(0,D.jsx)("p",{className:"min-w-0 flex-1 truncate text-[13px] text-[#f6eee5]/58",children:U}),(0,D.jsxs)("span",{className:"inline-flex h-8 items-center rounded-full bg-white px-3 text-[12px] font-medium text-slate-950",children:[(0,D.jsx)(rv,{className:"mr-1.5 h-3.5 w-3.5"}),"Create task"]})]})},"collapsed"):(0,D.jsxs)(pV.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.985},className:"overflow-hidden rounded-[26px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] p-2.5 shadow-[0_24px_72px_rgba(0,0,0,0.26)] isolate",children:[(0,D.jsx)(rG,{initial:!1,children:H?(0,D.jsxs)(pV.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-[12px] text-slate-400",children:[(0,D.jsxs)("span",{className:"truncate",children:["From ",H.sourceLabel]}),(0,D.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>Z(H.mission,{mode:"replace"}),children:"Replace"}),(0,D.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>Z(H.mission),children:"Append"}),(0,D.jsx)("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center rounded-full text-slate-400 transition-colors hover:bg-white/[0.06] hover:text-white",onClick:()=>I(null),"aria-label":"Dismiss runtime suggestion",children:(0,D.jsx)(dZ,{className:"h-3.5 w-3.5"})})]}):null}),(0,D.jsxs)("div",{className:bc("rounded-[22px] border border-white/[0.07] bg-[linear-gradient(180deg,rgba(20,28,43,0.92),rgba(10,16,26,0.9))] shadow-[inset_0_1px_0_rgba(255,255,255,0.04)] transition-all duration-200",z&&"border-white/[0.14] bg-[linear-gradient(180deg,rgba(24,34,50,0.94),rgba(12,18,30,0.92))] shadow-[inset_0_1px_0_rgba(255,255,255,0.06)]"),onFocusCapture:()=>A(!0),onBlurCapture:a=>{let b=a.relatedTarget;b instanceof Node&&a.currentTarget.contains(b)||A(!1)},children:[(0,D.jsxs)("div",{className:"flex items-center gap-2 px-2.5 pb-1 pt-2.5",children:[P?(0,D.jsx)(rY,{value:p,options:R,onChange:a=>{q(a)}}):(0,D.jsx)(r0,{children:"No agent"}),(0,D.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,D.jsx)(r$,{label:"Refresh mission control",onClick:async()=>{w(!0),await e(),w(!1)},children:v?(0,D.jsx)(N,{className:"h-3.5 w-3.5 animate-spin"}):(0,D.jsx)(rw,{className:"h-3.5 w-3.5"})}),(0,D.jsx)(r$,{label:"Create workspace",onClick:f,children:(0,D.jsx)(cm,{className:"h-3.5 w-3.5"})}),(0,D.jsx)(r$,{label:"Composer settings",onClick:()=>y(a=>!a),active:x||"medium"!==r,children:(0,D.jsxs)("span",{className:"relative inline-flex",children:[(0,D.jsx)(rx,{className:"h-3.5 w-3.5"}),"medium"!==r?(0,D.jsx)("span",{className:"absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-white/80"}):null]})})]})]}),(0,D.jsx)("div",{className:"px-2.5 pt-0.5",children:(0,D.jsx)(rV,{ref:J,value:n,onChange:a=>o(a.target.value),onKeyDown:async a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&(a.preventDefault(),T&&Q&&await Y({mission:n,agentId:Q,workspaceId:b??void 0,thinking:r}))},placeholder:U,className:"min-h-[50px] max-h-[150px] resize-none overflow-y-auto border-0 bg-transparent px-0 py-0.5 text-[15px] leading-[1.6] text-white placeholder:text-[#f6eee5]/60 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"})}),(0,D.jsxs)("div",{className:"flex items-end justify-between gap-2.5 px-2.5 pb-2.5 pt-1.5",children:[(0,D.jsx)(rG,{initial:!1,children:W?(0,D.jsxs)(pV.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[V.map(a=>(0,D.jsx)(r_,{label:a.label,onClick:()=>{"open-workspace-create"===a.action?f():a.mission&&Z(a.mission,{thinking:a.thinking})}},a.id)),M?(0,D.jsx)(rP,{snapshot:a,defaultWorkspaceId:M.id,onRefresh:e,onAgentCreated:a=>{K.current=a,q(a)},trigger:(0,D.jsx)("button",{type:"button",className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300 transition-all hover:bg-white/[0.08] hover:text-white",children:"+ Create Agent"})}):null]}):(0,D.jsx)("div",{})}),(0,D.jsxs)(bq,{className:"h-9 rounded-full bg-white px-3.5 text-slate-950 shadow-none hover:bg-white/92",disabled:!T,onClick:async()=>{Q&&await Y({mission:n,agentId:Q,workspaceId:b??void 0,thinking:r})},children:[t?(0,D.jsx)(N,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,D.jsx)(rv,{className:"mr-1.5 h-3.5 w-3.5"}),"Create task"]})]})]}),(0,D.jsx)(rG,{initial:!1,children:x?(0,D.jsx)(pV.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},className:"mt-2 flex justify-end",children:(0,D.jsxs)("div",{className:"w-full max-w-[232px] rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(14,20,31,0.96),rgba(10,15,24,0.94))] p-3 shadow-[0_16px_32px_rgba(0,0,0,0.22)]",children:[(0,D.jsx)("p",{className:"text-[11px] text-slate-300",children:"Thinking"}),(0,D.jsx)("div",{className:"mt-2",children:(0,D.jsx)(rZ,{ariaLabel:"Select thinking level",value:r,options:[{label:"off",value:"off"},{label:"minimal",value:"minimal"},{label:"low",value:"low"},{label:"medium",value:"medium"},{label:"high",value:"high"}],onChange:a=>s(a)})}),(0,D.jsx)("button",{type:"button",className:"mt-3 text-[12px] text-slate-400 transition-colors hover:text-white",onClick:()=>{o(""),s("medium"),I(null),L.current=!0,S&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(S)},children:"Clear draft"})]})}):null})]},"expanded")})})}function rY({value:a,options:b,onChange:c}){let d=b.find(b=>b.value===a)??b[0],e=b.length>1;return(0,D.jsxs)("div",{className:"relative inline-flex items-center rounded-full border border-white/[0.08] bg-white/[0.04] text-slate-100",children:[e?(0,D.jsx)("select",{"aria-label":"Select mission agent",value:d?.value??"",onChange:a=>c(a.target.value),className:"h-8 appearance-none bg-transparent pl-3 pr-8 text-[12px] outline-none",children:b.map(a=>(0,D.jsx)("option",{value:a.value,children:a.label},a.value))}):(0,D.jsx)("span",{className:"px-3 text-[12px]",children:d?.label||"No agent"}),e?(0,D.jsx)(U,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"}):null]})}function rZ({ariaLabel:a,value:b,options:c,onChange:d}){let e=c.find(a=>a.value===b)??c[0];return(0,D.jsxs)("div",{className:"relative inline-flex w-full items-center rounded-full border border-white/[0.08] bg-white/[0.04] text-slate-100",children:[(0,D.jsx)("select",{"aria-label":a,value:e?.value??"",onChange:a=>d(a.target.value),className:"h-9 w-full appearance-none bg-transparent pl-3 pr-9 text-[12px] outline-none",children:c.map(a=>(0,D.jsx)("option",{value:a.value,children:a.label},a.value))}),(0,D.jsx)(U,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"})]})}function r$({label:a,active:b=!1,onClick:c,children:d}){return(0,D.jsx)("button",{type:"button","aria-label":a,title:a,onClick:c,className:bc("inline-flex h-8 w-8 items-center justify-center rounded-full border border-transparent text-slate-400 transition-all hover:border-white/[0.08] hover:bg-white/[0.06] hover:text-white",b&&"border-white/[0.08] bg-white/[0.06] text-white"),children:d})}function r_({label:a,onClick:b}){return(0,D.jsx)("button",{type:"button",onClick:b,className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300 transition-all hover:bg-white/[0.08] hover:text-white",children:a})}function r0({children:a}){return(0,D.jsx)("div",{className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300",children:a})}let r1=K("folder-git-2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]),r2=K("file-json",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),r3=K("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),r4=K("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),r5=K("radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]);function r6(a){return(0,D.jsx)(r7,{...a},a.selectedNodeId??"overview")}function r7({snapshot:a,selectedNodeId:b,lastMission:c,onAbortTask:d,collapsed:e,onToggleCollapsed:f,activeTab:g,onActiveTabChange:h}){let i=qT(a.generatedAt),j=a.workspaces.find(a=>a.id===b),k=a.agents.find(a=>a.id===b),l=a.tasks.find(a=>a.id===b),m=a.runtimes.find(a=>a.id===b),n=a.models.find(a=>a.id===b),o=!!l?.metadata.optimistic,p=j||k||l||m||n||null,q=m?.id??null,r=l?.id??null,[s,t]=(0,E.useState)(null),[u,v]=(0,E.useState)(null),[w,x]=(0,E.useState)(null),[y,z]=(0,E.useState)(null),A=(0,E.useMemo)(()=>{var a;let b;return o&&l?{task:a=l,runs:[],outputs:[],liveFeed:Array.isArray(b=a.metadata.optimisticEvents)?b.filter(sg).sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp)):[],createdFiles:[],warnings:"stalled"===a.status||sh(a)?[a.subtitle]:[],integrity:sf(a)}:null},[o,l]),B=s&&s.runtimeId===q?s:null,C=u?.runtimeId===q?u.message:null,F=w&&w.task.id===r?w:null,G=y?.taskId===r?y.message:null,H=A??F,I=!!r&&!o&&!H&&!G,J=!!q&&!B&&!C,K=!!(m||l),L=!!(m||l),M=("output"!==g||K)&&("files"!==g||L)?g:"overview",N=l?"Feed":"Output",O=j?.name||k?.name||(l?q_(l.title||l.mission||"Task",48)||"Task":null)||(m?q_(m.title||"Run",48)||"Run":null)||n?.name||"Gateway overview",P=j?"workspace":k?"agent":l?"task":m?"run":n?"model":"selection",Q=(0,E.useMemo)(()=>[{id:"overview",label:"Overview",icon:rm,enabled:!0},{id:"output",label:N,icon:V,enabled:K},{id:"files",label:"Files",icon:r1,enabled:L},{id:"raw",label:"Raw",icon:r2,enabled:!0}],[N,L,K]);return(0,D.jsxs)("div",{className:"panel-surface panel-glow flex h-full flex-row-reverse overflow-hidden rounded-[30px] border border-white/[0.08] bg-[#04070e]/88 shadow-[0_28px_90px_rgba(0,0,0,0.42)] backdrop-blur-2xl",children:[(0,D.jsxs)("div",{className:bc("flex h-full shrink-0 flex-col items-center bg-[linear-gradient(180deg,rgba(7,10,18,0.98),rgba(3,6,12,0.98))] px-3 py-4",e?"w-full":"w-[78px] border-l border-white/[0.08]"),children:[(0,D.jsx)("button",{type:"button","aria-label":e?"Expand inspector":"Collapse inspector",onClick:f,className:"flex h-12 w-12 items-center justify-center rounded-[18px] border border-cyan-300/20 bg-cyan-400/[0.12] shadow-[0_10px_24px_rgba(34,211,238,0.18)] transition-all hover:border-cyan-200/30 hover:bg-cyan-400/[0.16]",children:(0,D.jsx)(V,{className:"h-5 w-5 text-cyan-200"})}),(0,D.jsx)("button",{type:"button","aria-label":e?"Expand inspector":"Collapse inspector",onClick:f,className:"mt-4 inline-flex h-11 w-11 items-center justify-center rounded-[16px] border border-white/10 bg-white/[0.04] text-slate-300 transition-all hover:border-cyan-300/18 hover:bg-white/[0.08] hover:text-white",children:e?(0,D.jsx)(r3,{className:"h-4 w-4"}):(0,D.jsx)(r4,{className:"h-4 w-4"})}),(0,D.jsx)("div",{className:"mt-6 flex flex-1 flex-col items-center gap-2",children:Q.map(a=>(0,D.jsx)(sm,{icon:a.icon,label:a.label,active:M===a.id,disabled:!a.enabled,onClick:()=>{a.enabled&&(h(a.id),e&&f())}},a.id))}),(0,D.jsxs)("div",{className:"mt-4 flex flex-col items-center gap-2",children:[(0,D.jsx)(be,{variant:"muted",children:p?"live":"idle"}),e?(0,D.jsx)("p",{className:"max-w-[56px] truncate text-center text-[9px] uppercase tracking-[0.16em] text-slate-500",children:P}):null]})]}),e?null:(0,D.jsx)("div",{className:"min-w-0 flex-1 bg-[linear-gradient(180deg,rgba(6,10,18,0.96),rgba(3,6,14,0.98))]",children:(0,D.jsxs)("div",{className:"mission-scroll flex h-full min-h-0 flex-col overflow-y-auto overscroll-contain",children:[(0,D.jsxs)("div",{className:"shrink-0 border-b border-white/[0.08] px-5 pb-4 pt-5",children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"text-[11px] uppercase tracking-[0.28em] text-slate-500",children:"Inspector"}),(0,D.jsx)("h2",{className:"mt-2 line-clamp-1 font-display text-[1.24rem] leading-tight text-white",children:O}),(0,D.jsx)("p",{className:"mt-2 text-[12px] leading-5 text-slate-400",children:p?"Live selection details.":"Gateway status and activity."})]}),(0,D.jsx)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.04] p-2.5 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]",children:(0,D.jsx)(V,{className:"h-4 w-4 text-cyan-200"})})]}),(0,D.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[(0,D.jsx)(be,{variant:"muted",children:P}),(0,D.jsx)("p",{className:"text-[12px] leading-5 text-slate-400",children:l?`${l.runtimeCount} runs \xb7 ${l.liveRunCount} live \xb7 ${qS(l.updatedAt,i)}`:m?`Run ${qY(m.runId||m.id,10)} \xb7 ${m.status} \xb7 ${qS(m.updatedAt,i)}`:k?`${k.activeRuntimeIds.length} active runs`:j?`${j.agentIds.length} agents attached`:n?`${n.provider} model`:"Live gateway context"})]}),(0,D.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:Q.filter(a=>a.enabled).map(a=>(0,D.jsx)(sn,{label:a.label,active:M===a.id,onClick:()=>h(a.id)},a.id))})]}),(0,D.jsx)("div",{className:"flex-1 p-4",children:(0,D.jsx)(rG,{mode:"wait",children:(0,D.jsxs)(pV.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},className:"space-y-3.5",children:["overview"===M?(0,D.jsxs)(D.Fragment,{children:[j?(0,D.jsx)(r9,{snapshot:a,workspaceId:j.id}):null,k?(0,D.jsx)(sa,{snapshot:a,agentId:k.id}):null,l?(0,D.jsx)(sb,{snapshot:a,task:l,taskId:l.id,taskDetail:H,taskDetailLoading:I,taskDetailError:G,onAbortTask:d}):null,m?(0,D.jsx)(si,{snapshot:a,runtimeId:m.id,runtimeOutput:B,runtimeOutputLoading:J,runtimeOutputError:C}):null,n?(0,D.jsx)(sl,{snapshot:a,modelId:n.id}):null,p?null:(0,D.jsx)(r8,{snapshot:a,lastMission:c})]}):null,"output"===M&&l?(0,D.jsx)(sd,{task:l,taskDetail:H,taskDetailLoading:I,taskDetailError:G}):null,"output"===M&&m?(0,D.jsx)(sk,{runtime:m,runtimeOutput:B,runtimeOutputLoading:J,runtimeOutputError:C}):null,"files"===M&&l?(0,D.jsx)(se,{snapshot:a,task:l,taskDetail:H}):null,"files"===M&&m?(0,D.jsx)(sj,{runtime:m,runtimeOutput:B}):null,"raw"===M?(0,D.jsx)("pre",{className:"overflow-x-auto rounded-[18px] border border-white/[0.08] bg-slate-950/[0.72] p-3 text-[11px] leading-5 text-slate-300",children:JSON.stringify(l&&H?H:m&&B?{runtime:m,output:B}:p||a,null,2)}):null]},`${b||"overview"}:${M}`)})}),(0,D.jsx)("div",{className:"shrink-0 border-t border-white/[0.08] p-4",children:(0,D.jsx)("div",{className:"rounded-[22px] border border-cyan-300/10 bg-[linear-gradient(180deg,rgba(7,22,31,0.95),rgba(5,13,22,0.95))] p-4 shadow-[0_16px_40px_rgba(0,0,0,0.22)]",children:(0,D.jsxs)("div",{className:"flex items-center gap-3",children:[(0,D.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-full border border-cyan-300/15 bg-cyan-400/[0.12] text-cyan-200",children:(0,D.jsx)(r5,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:l?`${l.runtimeCount} runs`:m?`Run ${qY(m.runId||m.id,10)}`:k?`${k.activeRuntimeIds.length} active runs`:j?`${j.agentIds.length} agents`:n?n.provider:"Gateway overview"}),(0,D.jsxs)("p",{className:"mt-1 text-[12px] text-slate-400",children:[P," \xb7"," ",l?`${H?.liveFeed.length??0} live feed events`:m?`${B?.items.length??0} transcript entries`:k?`${k.activeRuntimeIds.length} tracked runs`:j?`${j.agentIds.length} attached`:`${a.presence.length} live beacons`]})]})]})})})]})})]})}function r8({snapshot:a,lastMission:b}){let c=qT(a.generatedAt),d=a.diagnostics.runtime.stateWritable&&a.diagnostics.runtime.sessionStoreWritable?"passed"===a.diagnostics.runtime.smokeTest.status?"verified":"pending smoke test":"attention";return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(so,{icon:r5,title:"Gateway health",value:a.diagnostics.health,children:[(0,D.jsx)("p",{children:a.diagnostics.gatewayUrl}),(0,D.jsx)("p",{children:a.diagnostics.dashboardUrl})]}),(0,D.jsxs)(so,{icon:r1,title:"Runtime preflight",value:d,children:[(0,D.jsx)("p",{className:"font-mono text-xs text-slate-400",children:a.diagnostics.runtime.stateRoot}),(0,D.jsx)("p",{children:a.diagnostics.runtime.sessionStores.length>0?`${a.diagnostics.runtime.sessionStores.filter(a=>a.writable).length}/${a.diagnostics.runtime.sessionStores.length} session stores writable`:"No agent session stores have been probed yet."}),a.diagnostics.runtime.smokeTest.checkedAt?(0,D.jsxs)("p",{children:["Smoke test ",a.diagnostics.runtime.smokeTest.status," \xb7"," ",a.diagnostics.runtime.smokeTest.agentId||"unknown agent"," \xb7"," ",qS(Date.parse(a.diagnostics.runtime.smokeTest.checkedAt),c)]}):(0,D.jsx)("p",{children:"No runtime smoke test has been recorded yet."}),a.diagnostics.runtime.issues[0]?(0,D.jsx)("div",{className:"rounded-[14px] border border-amber-400/15 bg-amber-400/8 px-3 py-2 text-[13px] text-amber-50",children:a.diagnostics.runtime.issues[0]}):null]}),(0,D.jsxs)(so,{icon:V,title:"Presence beacons",value:String(a.presence.length),children:[0===a.presence.length?(0,D.jsx)("p",{children:"No live presence payloads."}):null,a.presence.map(a=>(0,D.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,D.jsx)("div",{className:"text-[13px] text-white",children:a.host}),(0,D.jsxs)("div",{className:"mt-1 text-xs text-slate-400",children:[a.ip," \xb7 ",a.platform," \xb7 ",a.version]})]},a.ts))]}),b?(0,D.jsxs)(so,{icon:co,title:"Last mission",value:b.status,children:[(0,D.jsx)("p",{className:"text-sm text-white",children:b.summary}),(0,D.jsx)("p",{className:"font-mono text-xs text-slate-500",children:b.runId?`Run ${b.runId}`:`Dispatch ${b.dispatchId??"pending"}`}),"string"==typeof b.meta?.outputDirRelative?(0,D.jsx)("p",{className:"font-mono text-xs text-slate-400",children:b.meta.outputDirRelative}):null,b.payloads[0]?.text?(0,D.jsx)("div",{className:"rounded-[14px] border border-cyan-400/15 bg-cyan-400/8 px-3 py-2 text-[13px] text-cyan-50",children:b.payloads[0].text}):null]}):null]})}function r9({snapshot:a,workspaceId:b}){let c=qT(a.generatedAt),d=a.workspaces.find(a=>a.id===b),e=a.agents.filter(a=>a.workspaceId===b),f=d?d.modelIds.map(b=>a.models.find(a=>a.id===b)?.name||b):[],g=a.runtimes.filter(a=>a.workspaceId===b||d?.activeRuntimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0));if(!d)return null;let h=g.filter(a=>"running"===a.status||"queued"===a.status||"idle"===a.status),i=g[0]??null,j=sv(g.flatMap(su)).slice(0,8),k=d.bootstrap.coreFiles.every(a=>a.present)&&d.bootstrap.projectShell.every(a=>a.present)?"ready":d.bootstrap.coreFiles.some(a=>a.present)||d.bootstrap.projectShell.some(a=>a.present)?"partial":"thin",l=Array.from(new Set(e.flatMap(a=>a.observedTools??[]))),m=0===e.length?"no agents":d.capabilities.workspaceOnlyAgentCount===e.length?"workspace-only":0===d.capabilities.workspaceOnlyAgentCount?"open":"mixed";return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(so,{icon:r1,title:"Overview",value:d.health,children:[(0,D.jsx)("p",{className:"font-mono text-xs text-slate-400",children:qZ(d.path)}),(0,D.jsx)(sq,{items:[{label:"Agents",value:String(e.length)},{label:"Models",value:String(d.modelIds.length)},{label:"Runs",value:String(g.length)},{label:"Sessions",value:String(d.totalSessions)}]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Models"}),(0,D.jsx)(ss,{emptyLabel:"No models attached",items:f,emptyVariant:"muted",itemVariant:"muted"})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Team"}),(0,D.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(a=>(0,D.jsx)(be,{variant:a.isDefault?"default":"muted",children:a.name},a.id))})]})]}),(0,D.jsxs)(so,{icon:co,title:"Bootstrap",value:k,children:[(0,D.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,D.jsx)(be,{variant:d.bootstrap.template?"default":"muted",children:d.bootstrap.template||"template unknown"}),(0,D.jsx)(be,{variant:d.bootstrap.sourceMode?"muted":"warning",children:d.bootstrap.sourceMode||"source unknown"}),d.bootstrap.agentTemplate?(0,D.jsx)(be,{variant:"muted",children:d.bootstrap.agentTemplate}):null]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Core files"}),(0,D.jsx)(sr,{items:d.bootstrap.coreFiles,missingVariant:"warning"})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Optional scaffold"}),(0,D.jsx)(sr,{items:[...d.bootstrap.optionalFiles,...d.bootstrap.folders]})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Project shell"}),(0,D.jsx)(sr,{items:d.bootstrap.projectShell})]})]}),(0,D.jsxs)(so,{icon:co,title:"Capabilities",value:m,children:[(0,D.jsxs)("p",{children:[d.capabilities.workspaceOnlyAgentCount,"/",e.length," agents are configured with"," ",(0,D.jsx)("span",{className:"font-mono text-xs text-slate-300",children:"fs.workspaceOnly"}),"."]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Skills"}),(0,D.jsx)(ss,{emptyLabel:"No explicit skills",items:d.capabilities.skills,emptyVariant:"muted",itemVariant:"muted"})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Local workspace skills"}),(0,D.jsx)(ss,{emptyLabel:"No local SKILL.md scaffolds",items:d.bootstrap.localSkillIds,emptyVariant:"muted",itemVariant:"success"})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,D.jsx)(ss,{emptyLabel:"No explicit tools configured",items:d.capabilities.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,D.jsx)(ss,{emptyLabel:"No runtime tool calls recovered yet",items:l,emptyVariant:"muted",itemVariant:"default"})]})]}),(0,D.jsxs)(so,{icon:V,title:"Activity",value:`${h.length} live`,children:[(0,D.jsxs)("p",{children:[g.length," tracked runs across ",d.totalSessions," recorded sessions."]}),(0,D.jsx)("p",{children:i?`Latest update ${qS(i.updatedAt,c)}`:"No runtime activity has been recorded yet."}),g.length>0?(0,D.jsx)("div",{className:"space-y-2 pt-1",children:g.slice(0,3).map(a=>(0,D.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate text-[13px] text-white",children:a.title}),(0,D.jsxs)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:[a.subtitle," \xb7 ",qY(a.runId||a.id,10)]})]}),(0,D.jsx)(be,{variant:qX(a.status),children:a.status})]},a.id))}):null,(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Agent posture"}),(0,D.jsx)("div",{className:"space-y-2",children:e.map(a=>(0,D.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate text-[13px] text-white",children:a.name}),(0,D.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.currentAction})]}),(0,D.jsx)(be,{variant:"engaged"===a.status?"default":"offline"===a.status?"danger":"muted",children:a.status})]},a.id))})]})]}),(0,D.jsx)(so,{icon:r2,title:"Created files",value:String(j.length),children:(0,D.jsx)(sp,{files:j,emptyLabel:"No file artifacts have been detected in recent workspace runs."})})]})}function sa({snapshot:a,agentId:b}){let c=qT(a.generatedAt),d=a.agents.find(a=>a.id===b),e=a.workspaces.find(a=>a.id===d?.workspaceId),f=a.models.find(a=>a.id===d?.modelId),g=d?.observedTools??[],h=a.runtimes.filter(a=>d?.activeRuntimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),i=sv(h.flatMap(su)).slice(0,8);return d?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(so,{icon:co,title:"Agent identity",value:d.id,children:[(0,D.jsx)("p",{children:d.name}),(0,D.jsx)("p",{children:d.identity.emoji?`${d.identity.emoji} \xb7 ${d.identity.theme??"theme unset"}`:"No identity emoji"}),(0,D.jsxs)("div",{className:"flex flex-wrap gap-2",children:[d.isDefault?(0,D.jsx)(be,{variant:"default",children:"default agent"}):null,(0,D.jsx)(be,{variant:qu[d.policy.preset].badgeVariant,children:qC(d.policy.preset)}),d.identity.source?(0,D.jsx)(be,{variant:"muted",children:d.identity.source}):null]})]}),(0,D.jsxs)(so,{icon:r1,title:"Workspace",value:e?.name||"n/a",children:[(0,D.jsx)("p",{className:"font-mono text-xs text-slate-400",children:qZ(d.workspacePath)}),(0,D.jsxs)("p",{children:[d.sessionCount," recorded sessions"]})]}),(0,D.jsxs)(so,{icon:co,title:"Model assignment",value:f?.name||d.modelId,children:[(0,D.jsx)("p",{children:f?`${f.provider} \xb7 ${qU(f.contextWindow)} ctx`:"Model metadata unavailable"}),(0,D.jsx)("p",{children:f?.available===!1?"Currently unavailable":f?.local?"Local model route":"Remote model route"})]}),(0,D.jsxs)(so,{icon:co,title:"Agent profile",value:d.profile.purpose||"Profile not declared",children:[(0,D.jsx)("p",{children:d.profile.purpose||"No explicit purpose was found in the workspace bootstrap files."}),(0,D.jsx)("div",{className:"flex flex-wrap gap-2",children:d.profile.sourceFiles.length>0?d.profile.sourceFiles.map(a=>(0,D.jsx)(be,{variant:"muted",children:a},a)):(0,D.jsx)(be,{variant:"warning",children:"derived from config"})})]}),(0,D.jsx)(so,{icon:V,title:"Operating style",value:`${d.profile.operatingInstructions.length} rules`,children:(0,D.jsxs)("div",{className:"space-y-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Operating instructions"}),(0,D.jsx)(st,{emptyLabel:"No workspace bootstrap instructions were found.",items:d.profile.operatingInstructions})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Response style"}),(0,D.jsx)(ss,{emptyLabel:"No explicit response style",items:d.profile.responseStyle,emptyVariant:"muted",itemVariant:"muted"})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"mb-1 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Output preference"}),(0,D.jsx)("p",{children:d.profile.outputPreference||"No explicit output preference was found."})]})]})}),(0,D.jsxs)(so,{icon:r5,title:"Runtime posture",value:d.status,children:[(0,D.jsx)("p",{children:d.currentAction}),(0,D.jsxs)("p",{children:["Last active ",qS(d.lastActiveAt,c)]}),(0,D.jsx)("p",{children:d.heartbeat.enabled?`Heartbeat ${d.heartbeat.every}`:"Heartbeat disabled"}),(0,D.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,D.jsx)(be,{variant:d.heartbeat.enabled?"success":"muted",children:d.heartbeat.enabled?"heartbeat on":"heartbeat off"}),"number"==typeof d.heartbeat.everyMs?(0,D.jsxs)(be,{variant:"muted",children:[Math.round(d.heartbeat.everyMs/1e3),"s interval"]}):null]})]}),(0,D.jsxs)(so,{icon:V,title:"Operating policy",value:qC(d.policy.preset),children:[(0,D.jsx)("p",{children:qu[d.policy.preset].description}),(0,D.jsxs)("div",{className:"mt-3 grid gap-2 text-[13px] text-slate-300",children:[(0,D.jsxs)("p",{children:["Missing tools: ",(0,D.jsx)("span",{className:"text-white",children:qD(d.policy.missingToolBehavior)})]}),(0,D.jsxs)("p",{children:["Install scope: ",(0,D.jsx)("span",{className:"text-white",children:qE(d.policy.installScope)})]}),(0,D.jsxs)("p",{children:["File access: ",(0,D.jsx)("span",{className:"text-white",children:qF(d.policy.fileAccess)})]}),(0,D.jsxs)("p",{children:["Network: ",(0,D.jsx)("span",{className:"text-white",children:qG(d.policy.networkAccess)})]})]})]}),(0,D.jsxs)(so,{icon:V,title:"Run history",value:String(h.length),children:[0===h.length?(0,D.jsx)("p",{children:"No runtime history has been recorded for this agent yet."}):null,h.map(a=>(0,D.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate text-[13px] text-white",children:a.title}),(0,D.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.subtitle})]}),(0,D.jsx)(be,{variant:qX(a.status),children:a.status})]},a.id))]}),(0,D.jsx)(so,{icon:r2,title:"Created files",value:String(i.length),children:(0,D.jsx)(sp,{files:i,emptyLabel:"No file artifacts have been detected for this agent yet."})}),(0,D.jsxs)(so,{icon:co,title:"Capabilities",value:`${d.skills.length} skills`,children:[(0,D.jsx)(ss,{emptyLabel:"No explicit skills",items:d.skills,emptyVariant:"muted",itemVariant:"muted"}),(0,D.jsxs)("div",{className:"pt-1",children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,D.jsx)(ss,{emptyLabel:"No explicit tools configured",items:d.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,D.jsxs)("div",{className:"pt-1",children:[(0,D.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,D.jsx)(ss,{emptyLabel:"No runtime tool calls recovered yet",items:g,emptyVariant:"muted",itemVariant:"default"})]})]})]}):null}function sb({snapshot:a,task:b,taskId:c,taskDetail:d,taskDetailLoading:e,taskDetailError:f,onAbortTask:g}){let h=a.tasks.find(a=>a.id===c)??b,i=sh(h),j=!!g&&function(a){if(sh(a))return!1;let b=a.status;return"running"===b||"queued"===b}(h),k=a.workspaces.find(a=>a.id===b?.workspaceId),l=a.agents.find(a=>a.id===b?.primaryAgentId),m=d?.runs??a.runtimes.filter(a=>b?.runtimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),n=d?.createdFiles??sv(m.flatMap(a=>su(a))),o=d?.warnings??[];if(!b)return null;let p=d?.integrity??sf(b);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(so,{icon:r1,title:"Mission",value:i?"aborted":h.status,children:[(0,D.jsx)("p",{className:"line-clamp-1 text-sm text-white",children:q_(h.mission||h.title,80)||h.title}),(0,D.jsx)("p",{className:"line-clamp-1 text-[12.5px] leading-5 text-slate-400",children:q_(h.subtitle,110)||h.subtitle}),(0,D.jsx)(sq,{items:[{label:"Runs",value:String(h.runtimeCount)},{label:"Feed",value:String(h.updateCount)},{label:"Files",value:String(h.artifactCount)},{label:"Live",value:String(h.liveRunCount)}]}),g&&(j||i)?(0,D.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,D.jsxs)(bq,{type:"button",variant:i?"secondary":"destructive",size:"sm",disabled:!j,className:"gap-2",onClick:()=>{j&&g(h)},children:[(0,D.jsx)(P,{className:"h-3.5 w-3.5"}),i?"Aborted":"Abort task"]})}):null,(0,D.jsxs)("div",{className:"flex flex-wrap gap-2",children:[k?(0,D.jsx)(be,{variant:"muted",children:k.name}):null,l?(0,D.jsx)(be,{variant:"default",children:l.name}):null,h.dispatchId?(0,D.jsxs)(be,{variant:"muted",children:["dispatch ",qY(h.dispatchId,8)]}):null,i?(0,D.jsx)(be,{variant:"danger",children:"aborted"}):null]}),e&&!d?(0,D.jsx)("p",{children:"Connecting live task feed…"}):null,f?(0,D.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:f}):null]}),(0,D.jsx)(sc,{task:h,integrity:p}),(0,D.jsxs)(so,{icon:V,title:"Runs",value:String(m.length),children:[0===m.length?(0,D.jsx)("p",{children:"No OpenClaw runs have been grouped into this task yet."}):null,(0,D.jsx)("div",{className:"space-y-2",children:m.map(a=>(0,D.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate text-[13px] text-white",children:a.title}),(0,D.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.subtitle})]}),(0,D.jsx)(be,{variant:qX(a.status),children:a.status})]},a.id))})]}),(0,D.jsx)(so,{icon:r2,title:"Artifacts",value:String(n.length),children:(0,D.jsx)(sp,{files:n,emptyLabel:"This task has not produced a detectable file artifact yet."})}),o.length>0?(0,D.jsx)(so,{icon:r5,title:"Warnings",value:String(o.length),children:(0,D.jsx)(st,{items:o,emptyLabel:"No warnings detected."})}):null]})}function sc({task:a,integrity:b}){let c=sh(a),d=b.issues.find(a=>"partial-final-response"===a.id),e=c?"This task was aborted by an operator. Captured evidence may be incomplete.":"verified"===b.status?"Mission Control found a matching transcript and the captured result looks internally consistent.":b.sessionMismatch?"The linked transcript belongs to a different mission or stale session, so this completion cannot be trusted yet.":b.issues.some(a=>"empty-output-dir"===a.id)?"The task is marked completed, but the expected deliverables are missing from the output folder.":"error"===b.status?"The captured evidence does not line up with the requested mission.":"Mission Control recovered partial evidence, but this result still needs operator review.";return(0,D.jsxs)(so,{icon:r5,title:"Result integrity",value:c?"aborted":"stalled"===a.status?"stalled":b.status,children:[(0,D.jsx)("p",{children:e}),(0,D.jsx)(sq,{items:[{label:"Output files",value:String(b.outputFileCount)},{label:"Transcript turns",value:String(b.transcriptTurnCount)},{label:"Matched turns",value:String(b.matchingTranscriptTurnCount)},{label:"Tools",value:String(b.toolNames.length)},{label:"Emails",value:String(b.emails.length)}]}),b.outputDir||b.outputDirRelative?(0,D.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Output folder"}),(0,D.jsx)("div",{className:"mt-2",children:(0,D.jsx)(re,{text:b.outputDirRelative||b.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:b.outputDir,displayPath:b.outputDirRelative||b.outputDir})}),(0,D.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:b.outputDirExists?`${b.outputFileCount} file${1===b.outputFileCount?"":"s"} detected in the folder.`:"The output folder is not currently accessible."})]}):null,(0,D.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,D.jsxs)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:["Final response ","none"!==b.finalResponseSource?`(${b.finalResponseSource})`:""]}),d?(0,D.jsx)("p",{className:"mt-2 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:d.detail}):null,(0,D.jsx)("div",{className:"mt-2",children:b.finalResponseText?(0,D.jsx)(re,{text:b.finalResponseText,className:"text-[12.5px] leading-5 text-slate-100"}):(0,D.jsx)("p",{className:"text-[12.5px] leading-5 text-slate-400",children:"No final response was captured."})})]}),(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Recovered tools"}),b.toolNames.length>0?(0,D.jsx)("div",{className:"flex flex-wrap gap-2",children:b.toolNames.map(a=>(0,D.jsx)(be,{variant:"muted",children:a},a))}):(0,D.jsx)("p",{children:"No tool calls were recovered from a matching transcript turn."})]}),(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Detected emails"}),b.emails.length>0?(0,D.jsx)("div",{className:"flex flex-wrap gap-2",children:b.emails.map(a=>(0,D.jsx)(be,{variant:"muted",children:a},a))}):(0,D.jsx)("p",{children:"No email addresses were detected in the captured result."})]}),b.dispatchSessionId?(0,D.jsxs)("p",{className:"font-mono text-xs text-slate-400",children:["session ",qY(b.dispatchSessionId,12),b.sessionMismatch?" \xb7 mismatch detected":""]}):null,b.issues.length>0?(0,D.jsxs)("div",{className:"rounded-[14px] border border-amber-400/16 bg-amber-400/[0.06] px-3 py-2.5",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-amber-100/80",children:"Review issues"}),(0,D.jsx)("div",{className:"mt-2",children:(0,D.jsx)(st,{items:b.issues.map(a=>`${a.title}: ${a.detail}`),emptyLabel:"No integrity issues detected."})})]}):null]})}function sd({task:a,taskDetail:b,taskDetailLoading:c,taskDetailError:d}){if(c&&!b)return(0,D.jsx)(so,{icon:V,title:"Live feed",value:"connecting",children:(0,D.jsx)("p",{children:"Connecting to the task feed…"})});if(d&&!b)return(0,D.jsx)(so,{icon:V,title:"Live feed",value:"error",children:(0,D.jsx)("p",{children:d})});let e=b?.liveFeed??[],f=b?.integrity??sf(a);return(0,D.jsxs)(so,{icon:V,title:"Live feed",value:String(e.length),children:[d?(0,D.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:d}):null,f.issues.length>0?(0,D.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:f.issues[0]?.detail}):null,0===e.length?(0,D.jsx)("p",{children:"No streamed task events have arrived yet."}):null,(0,D.jsx)("div",{className:"space-y-2",children:e.map(a=>(0,D.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2.5",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,D.jsx)(be,{variant:function(a,b){if(b)return"danger";switch(a){case"assistant":return"default";case"tool":case"warning":return"warning";case"artifact":return"success";default:return"muted"}}(a.kind,a.isError),children:a.kind}),(0,D.jsx)("p",{className:"truncate text-[12px] text-white",children:a.title})]}),(0,D.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:qS(new Date(a.timestamp).getTime())})]}),(0,D.jsx)("div",{className:"mt-2",children:(0,D.jsx)(re,{text:a.detail,className:"text-[12.5px] leading-5 text-slate-100",url:a.url,filePath:a.filePath,displayPath:a.displayPath})})]},a.id))})]})}function se({snapshot:a,task:b,taskDetail:c}){let d=c?.runs??a.runtimes.filter(a=>b.runtimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),e=c?.createdFiles??sv(d.flatMap(a=>su(a))),f=c?.integrity??sf(b);return(0,D.jsxs)(so,{icon:r2,title:"Files",value:String(e.length),children:[(0,D.jsxs)("p",{children:[d.length," run",1===d.length?"":"s"," contributed to this task."]}),f.outputDir||f.outputDirRelative?(0,D.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Output folder"}),(0,D.jsx)("div",{className:"mt-2",children:(0,D.jsx)(re,{text:f.outputDirRelative||f.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:f.outputDir,displayPath:f.outputDirRelative||f.outputDir})}),(0,D.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:f.outputDirExists?`${f.outputFileCount} file${1===f.outputFileCount?"":"s"} detected in the folder.`:"The output folder is not currently accessible."})]}):null,(0,D.jsx)(sp,{files:e,emptyLabel:"This task has not produced a detectable file artifact yet."})]})}function sf(a){let b=sh(a)?[{id:"task-cancelled",severity:"warning",title:"Task was cancelled by the operator",detail:"The mission dispatch was stopped before completion, so the captured evidence is intentionally incomplete."}]:"stalled"===a.status?[{id:"stalled-dispatch",severity:"warning",title:"Dispatch stalled before evidence was captured",detail:a.subtitle}]:a.metadata.optimistic?[{id:"pending-evidence",severity:"warning",title:"Waiting for runtime evidence",detail:"Mission Control will attach transcript, tool, and file evidence after the first runtime is observed."}]:[];return{status:b.some(a=>"error"===a.severity)?"error":b.length>0?"warning":"verified",outputDir:"string"==typeof a.metadata.outputDir&&a.metadata.outputDir.trim().length>0?a.metadata.outputDir:null,outputDirRelative:"string"==typeof a.metadata.outputDirRelative&&a.metadata.outputDirRelative.trim().length>0?a.metadata.outputDirRelative:null,outputDirExists:!1,outputFileCount:0,transcriptTurnCount:0,matchingTranscriptTurnCount:0,finalResponseText:null,finalResponseSource:"none",dispatchSessionId:null,sessionMismatch:!1,toolNames:[],emails:[],issues:b}}function sg(a){return"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.kind&&"string"==typeof a.timestamp&&"string"==typeof a.title&&"string"==typeof a.detail}function sh(a){let b="string"==typeof a.metadata.dispatchStatus?a.metadata.dispatchStatus:null,c=a.status;return"cancelled"===b||"aborted"===b||"cancelled"===c||"aborted"===c}function si({snapshot:a,runtimeId:b,runtimeOutput:c,runtimeOutputLoading:d,runtimeOutputError:e}){let f,g=qT(a.generatedAt),h=a.runtimes.find(a=>a.id===b),i=sv(c?.createdFiles??(h?su(h):[])),j=c?.warnings??(h&&Array.isArray(f=h.metadata.warnings)?f.filter(a=>"string"==typeof a&&a.trim().length>0):[]),k=c?.warningSummary??j[0]??null;return h?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(so,{icon:V,title:"Runtime key",value:h.status,children:[(0,D.jsx)("p",{className:"font-mono text-xs text-slate-400",children:h.key}),(0,D.jsxs)("p",{children:["Session ",qY(h.sessionId,12)]}),h.taskId?(0,D.jsxs)("p",{children:["Task ",qY(h.taskId,12)]}):null,h.runId?(0,D.jsxs)("p",{children:["Run ",qY(h.runId,12)]}):null]}),(0,D.jsxs)(so,{icon:r5,title:"Activity",value:qS(h.updatedAt,g),children:[(0,D.jsx)("p",{children:h.subtitle}),(0,D.jsxs)("p",{children:[qV(h.tokenUsage?.total)," tokens"]})]}),(0,D.jsxs)(so,{icon:co,title:"Latest output",value:c?.stopReason||(d?"loading":"no transcript"),children:[d?(0,D.jsx)("p",{children:"Loading transcript output…"}):null,e?(0,D.jsx)("p",{children:e}):null,d||e?null:(0,D.jsx)(re,{text:c?.finalText||c?.errorMessage||"No assistant output has been recorded for this runtime yet.",className:"text-[13px] leading-5 text-slate-100"}),k?(0,D.jsxs)("p",{className:"mt-3 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:["Fallback used: ",k]}):null,c?.finalTimestamp?(0,D.jsxs)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:["Updated ",qS(new Date(c.finalTimestamp).getTime())]}):null]}),(0,D.jsx)(so,{icon:r2,title:"Created files",value:String(i.length),children:(0,D.jsx)(sp,{files:i,emptyLabel:"This runtime has not produced a detectable file artifact."})})]}):null}function sj({runtime:a,runtimeOutput:b}){let c=sv(b?.createdFiles??su(a));return(0,D.jsxs)(so,{icon:r2,title:"Files",value:String(c.length),children:[(0,D.jsx)("p",{children:a.title}),(0,D.jsx)(sp,{files:c,emptyLabel:"This runtime has not produced a detectable file artifact."})]})}function sk({runtime:a,runtimeOutput:b,runtimeOutputLoading:c,runtimeOutputError:d}){return c?(0,D.jsx)(so,{icon:V,title:"Runtime output",value:"loading",children:(0,D.jsxs)("p",{children:["Loading transcript output for ",a.title,"…"]})}):d?(0,D.jsx)(so,{icon:V,title:"Runtime output",value:"error",children:(0,D.jsx)("p",{children:d})}):b?(0,D.jsxs)("div",{className:"space-y-3.5",children:[b.warningSummary?(0,D.jsx)(so,{icon:r5,title:"Warnings",value:String(b.warnings.length),children:(0,D.jsx)("p",{children:b.warningSummary})}):null,(0,D.jsx)(so,{icon:r2,title:"Created files",value:String(b.createdFiles.length),children:(0,D.jsx)(sp,{files:b.createdFiles,emptyLabel:"This runtime transcript does not include a successful file creation."})}),(0,D.jsxs)(so,{icon:V,title:"Final response",value:"stalled"===a.status||"cancelled"===a.status?a.status:b.stopReason||b.status,children:["stalled"===a.status||"cancelled"===a.status?(0,D.jsx)("p",{className:"mb-2 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:"This runtime did not complete cleanly. The text below is the last captured assistant output, not a verified completion."}):null,b.errorMessage?(0,D.jsx)("p",{className:"mb-2 rounded-[12px] border border-rose-400/20 bg-rose-400/10 px-3 py-2 text-[12px] leading-5 text-rose-100",children:b.errorMessage}):null,(0,D.jsx)(re,{text:b.finalText||b.errorMessage||"No assistant output has been recorded for this runtime yet.",className:"text-[13px] leading-5 text-slate-100"}),b.finalTimestamp?(0,D.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:new Date(b.finalTimestamp).toLocaleString()}):null]}),(0,D.jsxs)(so,{icon:r5,title:"Transcript trail",value:String(b.items.length),children:[0===b.items.length?(0,D.jsx)("p",{children:"No transcript entries were found."}):null,(0,D.jsx)("div",{className:"space-y-2",children:b.items.map(a=>(0,D.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2.5",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)(be,{variant:"assistant"===a.role?a.isError?"danger":"default":"toolResult"===a.role?"warning":"muted",children:a.role}),a.toolName?(0,D.jsx)(be,{variant:"muted",children:a.toolName}):null]}),(0,D.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:qS(new Date(a.timestamp).getTime())})]}),(0,D.jsx)("div",{className:"mt-2",children:(0,D.jsx)(re,{text:a.text,className:"text-[12.5px] leading-5 text-slate-100"})})]},a.id))})]})]}):(0,D.jsx)(so,{icon:V,title:"Runtime output",value:"missing",children:(0,D.jsx)("p",{children:"No transcript data is available for this runtime."})})}function sl({snapshot:a,modelId:b}){let c=a.models.find(a=>a.id===b);return c?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(so,{icon:co,title:"Model routing",value:c.provider,children:[(0,D.jsx)("p",{children:c.name}),(0,D.jsx)("p",{children:c.local?"Local model":"Remote model"})]}),(0,D.jsxs)(so,{icon:r5,title:"Capacity",value:`${qU(c.contextWindow)} ctx`,children:[(0,D.jsx)("p",{children:c.input}),(0,D.jsx)("p",{children:!1===c.available?"Unavailable":"Available"}),(0,D.jsxs)("p",{children:[c.usageCount," attached agents"]})]})]}):null}function sm({icon:a,label:b,active:c,disabled:d=!1,onClick:e}){return(0,D.jsx)("button",{type:"button",title:b,disabled:d,onClick:e,className:bc("inline-flex h-11 w-11 items-center justify-center rounded-[16px] border transition-all",d?"border-white/5 bg-white/[0.02] text-slate-600":c?"border-cyan-300/20 bg-cyan-400 text-slate-950 shadow-[0_12px_28px_rgba(96,165,250,0.35)]":"border-white/10 bg-white/[0.03] text-slate-400 hover:border-white/15 hover:bg-white/[0.08] hover:text-white"),children:(0,D.jsx)(a,{className:"h-4 w-4"})})}function sn({label:a,active:b,onClick:c}){return(0,D.jsx)("button",{type:"button",onClick:c,className:bc("inline-flex items-center rounded-full border px-3 py-2 text-[11px] uppercase tracking-[0.18em] transition-all",b?"border-cyan-300/20 bg-cyan-400 text-slate-950 shadow-[0_10px_24px_rgba(96,165,250,0.28)]":"border-white/[0.08] bg-white/[0.03] text-slate-300 hover:bg-white/[0.07] hover:text-white"),children:a})}function so({icon:a,title:b,value:c,children:d}){return(0,D.jsxs)("section",{className:"rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(12,19,34,0.86),rgba(8,13,24,0.82))] p-3.5",children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"space-y-1",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.24em] text-slate-500",children:b}),(0,D.jsx)("p",{className:"font-display text-[1rem] text-white",children:c})]}),(0,D.jsx)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/5 p-2 text-slate-300",children:(0,D.jsx)(a,{className:"h-3.5 w-3.5"})})]}),(0,D.jsx)("div",{className:"mt-3 space-y-1.5 text-[12.5px] leading-5 text-slate-300",children:d})]})}function sp({files:a,emptyLabel:b}){return 0===a.length?(0,D.jsx)("p",{className:"text-[12px] text-slate-400",children:b}):(0,D.jsx)("div",{className:"space-y-2",children:a.map(a=>(0,D.jsx)("button",{type:"button",onClick:()=>void sw(a.path),className:"w-full rounded-[14px] border border-cyan-300/12 bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2 text-left transition-all hover:border-cyan-300/28 hover:bg-cyan-400/[0.08]",children:(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate font-mono text-[12px] text-cyan-100",children:a.displayPath}),(0,D.jsx)("p",{className:"truncate text-[11px] text-slate-400",children:qZ(a.path)})]}),(0,D.jsx)(be,{variant:"muted",children:"reveal"})]})},a.path))})}function sq({items:a}){return(0,D.jsx)("div",{className:"grid grid-cols-2 gap-2",children:a.map(a=>(0,D.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.label}),(0,D.jsx)("p",{className:"mt-1 text-[13px] text-white",children:a.value})]},a.label))})}function sr({items:a,missingVariant:b="muted"}){return(0,D.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(a=>(0,D.jsx)(be,{variant:a.present?"success":b,children:a.label},a.id))})}function ss({items:a,emptyLabel:b,itemVariant:c,emptyVariant:d}){return 0===a.length?(0,D.jsx)(be,{variant:d,children:b}):(0,D.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(a=>(0,D.jsx)(be,{variant:c,children:a},a))})}function st({items:a,emptyLabel:b}){return 0===a.length?(0,D.jsx)("p",{className:"text-[12px] text-slate-400",children:b}):(0,D.jsx)("div",{className:"space-y-2",children:a.map(a=>(0,D.jsx)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:(0,D.jsx)("p",{className:"text-[12px] leading-5 text-slate-200",children:a})},a))})}function su(a){let b=a.metadata.createdFiles;return Array.isArray(b)?b.flatMap(a=>{if(!a||"object"!=typeof a)return[];let b="path"in a&&"string"==typeof a.path?a.path:null,c="displayPath"in a&&"string"==typeof a.displayPath?a.displayPath:b;return b&&c?[{path:b,displayPath:c}]:[]}):[]}function sv(a){let b=new Set,c=[];for(let d of a)!d.path||b.has(d.path)||(b.add(d.path),c.push(d));return c}async function sw(a){try{let b=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})}),c=await b.json();if(!b.ok)throw Error(c.error||"Unable to reveal file.");q9.oR.success("Revealed file.",{description:qZ(a)})}catch(a){q9.oR.error("Could not reveal file.",{description:a instanceof Error?a.message:"Unknown file reveal error."})}}let sx=K("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),sy=K("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);function sz(a){var b;return a.diagnostics.installed&&a.diagnostics.rpcOk&&(b=a).diagnostics.runtime.stateWritable&&b.diagnostics.runtime.sessionStoreWritable}function sA(a){return sz(a)&&a.diagnostics.modelReadiness.ready&&"passed"===a.diagnostics.runtime.smokeTest.status}function sB({snapshot:a,surfaceTheme:b,stage:c,systemActionLabel:d,systemActionDescription:e,systemPhase:f,modelPhase:g,systemRun:h,modelRun:i,selectedModelId:j,discoveredModels:k,onSelectedModelIdChange:l,onRunSystemSetup:m,onRunModelAutoSetup:n,onRunModelDiscover:o,onRunModelRefresh:p,onRunModelSetDefault:q,onContinueToModels:r,onBackToSystem:s,onDismiss:t,canDismiss:u}){var v,w,x,y,z,A,B,C,E,F,G,H,I,J,K,L,M,O;let P,Q,R,S,T,U=sz(a),V=sA(a),W=(v=c,w=U,x=V,[{id:"system",order:1,label:"System setup",description:"CLI, gateway service, live RPC, runtime state",state:sG(w,"system"===v&&!w)},{id:"models",order:2,label:"Model setup",description:"Default model, provider auth, live smoke test",state:sG(x,"models"===v&&!x)}]),X=(y=a,z=f,P=y.diagnostics.rpcOk&&!y.diagnostics.loaded,Q=y.diagnostics.installed||"installing-gateway"===z||"starting-gateway"===z||"verifying"===z||"ready"===z,R=y.diagnostics.loaded||P||"starting-gateway"===z||"verifying"===z||"ready"===z,S=y.diagnostics.rpcOk||"ready"===z,T=y.diagnostics.runtime.stateWritable&&y.diagnostics.runtime.sessionStoreWritable||"ready"===z,[{id:"cli",label:"OpenClaw CLI",description:y.diagnostics.installed?`Installed${y.diagnostics.version?` \xb7 v${y.diagnostics.version}`:""}`:"Install the OpenClaw CLI on this machine.",state:sG(Q,!Q&&("detecting"===z||"installing-cli"===z))},{id:"gateway",label:"Gateway service",description:y.diagnostics.loaded?"The local gateway service is already registered on this machine.":P?"Gateway is live via direct run.":"Register the gateway service once so Mission Control can start it reliably.",state:sG(R,!R&&("installing-gateway"===z||Q&&"detecting"===z))},{id:"runtime",label:"Live connection",description:y.diagnostics.rpcOk?"Mission Control is connected to a live OpenClaw gateway.":"Start the gateway and wait for RPC health to turn online.",state:sG(S,!S&&("starting-gateway"===z||"verifying"===z||R&&"detecting"===z))},{id:"state",label:"Runtime state",description:y.diagnostics.runtime.stateWritable&&y.diagnostics.runtime.sessionStoreWritable?"Mission Control can write to the OpenClaw state root and agent session stores.":"Verify write access to the OpenClaw runtime state before live work begins.",state:sG(T,!T&&("verifying"===z||S))}]),Y=a.models.filter(a=>!1!==a.available&&!a.missing),Z=k.filter(a=>!Y.some(b=>b.id===a.modelId)),_="system"===c?h:i,aa=_.statusMessage||_.resultMessage||(A=c,B=e,"system"===A?B:"Choose or connect a usable model route so the product is actually ready."),ab="system"===c?(C=f,sz(E=a)?"ready":E.diagnostics.rpcOk?"verifying access":E.diagnostics.loaded&&!E.diagnostics.rpcOk?"verifying"===C?"connecting":"starting gateway":C?C.replace("-"," "):"waiting"):(F=g,sA(G=a)?"ready":G.diagnostics.modelReadiness.ready&&"passed"!==G.diagnostics.runtime.smokeTest.status?"smoke test":F?F.replace("-"," "):"waiting"),ac="idle"!==_.runState||!!_.manualCommand||_.log.trim().length>0,ad=(H=_.runState,I=c,J=V,"running"===H?"Running":J?"Ready":"success"===H?"models"===I?"Updated":"Step complete":"error"===H?"Needs attention":"system"===I?"Step 1":"Step 2"),ae="system"===(K={stage:c,systemReady:U,modelReady:V,systemActionLabel:d,selectedModelId:j,availableModelIds:Y.map(a=>a.id)}).stage?K.systemReady&&K.modelReady?{kind:"dismiss",label:"Enter Mission Control"}:K.systemReady?{kind:"continue",label:"Continue to model setup"}:{kind:"system",label:K.systemActionLabel}:K.modelReady?{kind:"dismiss",label:"Enter Mission Control"}:K.selectedModelId&&K.availableModelIds.includes(K.selectedModelId)||K.selectedModelId?{kind:"set-default",label:"Use selected model"}:{kind:"auto",label:"Auto configure models"};return(0,D.jsx)(pV.div,{initial:{opacity:0,backdropFilter:"blur(0px)"},animate:{opacity:1,backdropFilter:"blur(12px)"},exit:{opacity:0,backdropFilter:"blur(0px)"},className:bc("absolute inset-0 z-[80] pointer-events-auto flex items-center justify-center overflow-y-auto px-3 py-4 sm:px-4 sm:py-6","light"===b?"bg-[radial-gradient(circle_at_top,rgba(255,255,255,0.94),rgba(247,239,232,0.88)_46%,rgba(242,230,220,0.92))]":"bg-[radial-gradient(circle_at_top,rgba(17,24,39,0.9),rgba(3,7,18,0.92)_48%,rgba(2,6,23,0.96))]"),children:(0,D.jsxs)(pV.div,{initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},className:bc("my-auto flex w-full max-w-[420px] flex-col overflow-hidden rounded-[16px] border shadow-[0_18px_46px_rgba(0,0,0,0.18)] backdrop-blur-2xl max-h-[min(80vh,560px)]","light"===b?"border-[#dccabd]/90 bg-[rgba(255,250,246,0.92)] text-[#47362b] shadow-[0_18px_50px_rgba(161,125,101,0.15)]":"border-white/10 bg-[rgba(6,10,18,0.84)] text-slate-100"),children:[(0,D.jsxs)("div",{className:"overflow-y-auto px-2.5 py-2.5 sm:px-3 sm:py-3",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,D.jsxs)("span",{className:bc("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===b?"border-[#d8c0b0] bg-[#f3e7dc] text-[#8d725f]":"border-white/10 bg-white/[0.06] text-slate-300"),children:[(0,D.jsx)(cm,{className:"h-2 w-2"}),"Welcome"]}),(0,D.jsx)("span",{className:bc("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.16em]",(L=_.runState,M=V,O=b,"error"===L?"light"===O?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200":"success"===L||M?"light"===O?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"running"===L?"light"===O?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-300":"light"===O?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-400")),children:ad})]}),(0,D.jsxs)("div",{className:"mt-3",children:[(0,D.jsx)("p",{className:bc("text-[7px] uppercase tracking-[0.18em]","light"===b?"text-[#977b69]":"text-slate-500"),children:"OpenClaw Mission Control"}),(0,D.jsx)("h1",{className:bc("mt-1 font-display text-[1.12rem] leading-[1.25rem]","light"===b?"text-[#33251c]":"text-white"),children:"Bring your local OpenClaw online."}),(0,D.jsx)("p",{className:bc("mt-1.5 text-[11px] leading-[1.05rem]","light"===b?"text-[#705b4d]":"text-slate-300"),children:"Finish the system layer first, then lock a usable default model so the product is ready for real work."})]}),(0,D.jsx)("div",{className:"mt-3 grid gap-1.5 sm:grid-cols-2",children:W.map(a=>(0,D.jsx)("div",{className:bc("rounded-[14px] border px-2.5 py-2",sJ(a.state,b)),children:(0,D.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,D.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,D.jsx)("span",{className:bc("inline-flex h-5 w-5 items-center justify-center rounded-full border text-[9px] font-medium",sK(a.state,b)),children:"complete"===a.state?(0,D.jsx)($,{className:"h-2.5 w-2.5"}):a.order}),(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bc("text-[11px]","light"===b?"text-[#3e2f24]":"text-white"),children:a.label}),(0,D.jsx)("p",{className:bc("mt-0.5 text-[8px] leading-[0.85rem]","light"===b?"text-[#8f7664]":"text-slate-500"),children:a.description})]})]}),(0,D.jsx)("span",{className:bc("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",sL(a.state,b)),children:"complete"===a.state?"Ready":"current"===a.state?"Active":"Pending"})]})},a.id))}),"system"===c?(0,D.jsx)(sC,{steps:X,surfaceTheme:b,statusCopy:aa,showDetails:ac,phaseLabel:ab,run:_}):(0,D.jsx)(sD,{snapshot:a,surfaceTheme:b,statusCopy:aa,showDetails:ac,phaseLabel:ab,run:_,selectedModelId:j,availableModels:Y.map(a=>({id:a.id,name:a.name,provider:a.provider})),discoveredModels:Z,onSelectedModelIdChange:l,onRunModelDiscover:o,onRunModelRefresh:p,onRunModelSetDefault:q})]}),(0,D.jsxs)("div",{className:bc("mt-auto flex flex-wrap items-center justify-between gap-1.5 border-t px-2.5 py-2 sm:px-3","light"===b?"border-[#ebddd2]":"border-white/8"),children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:["models"===c?(0,D.jsxs)(bq,{type:"button",variant:"ghost",size:"sm",onClick:s,disabled:"running"===_.runState,className:"light"===b?"border border-[#d7bca7] bg-[#f8ede4] text-[#5a4131] hover:bg-[#eedbcc] hover:text-[#3f2d21]":"text-slate-500 hover:bg-white/[0.08] hover:text-slate-200",children:[(0,D.jsx)(sx,{className:"mr-1.5 h-3.5 w-3.5"}),"Back"]}):null,u?(0,D.jsx)("button",{type:"button",onClick:t,className:bc("text-[9px] uppercase tracking-[0.16em] transition-colors","light"===b?"text-[#8f7664] hover:text-[#6f5949]":"text-slate-500 hover:text-slate-300"),children:"Open demo surface"}):null]}),(0,D.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:["models"!==c||V?null:(0,D.jsx)(bq,{type:"button",variant:"secondary",size:"sm",onClick:n,disabled:"running"===i.runState,className:sH(b),children:"running"===i.runState?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(N,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Working..."]}):"Auto configure"}),(0,D.jsx)(bq,{type:"button",onClick:()=>{"system"===c?U&&V?t():U?r():m():V?t():"set-default"===ae.kind?q():n()},disabled:"running"===_.runState,className:bc("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===b?"bg-[#c8946f] text-white shadow-[0_14px_34px_rgba(200,148,111,0.24)] hover:bg-[#b88461]":"bg-white text-slate-950 hover:bg-white/92"),children:"running"===_.runState?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(N,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Working..."]}):(0,D.jsxs)(D.Fragment,{children:[ae.label,(0,D.jsx)(sy,{className:"ml-1.5 h-3 w-3"})]})})]})]})]})})}function sC({steps:a,surfaceTheme:b,statusCopy:c,showDetails:d,phaseLabel:e,run:f}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{className:"mt-3",children:[(0,D.jsx)("p",{className:bc("text-[7px] uppercase tracking-[0.18em]","light"===b?"text-[#977b69]":"text-slate-500"),children:"Step 1"}),(0,D.jsx)("h2",{className:bc("mt-1 text-[13px] font-medium","light"===b?"text-[#33251c]":"text-white"),children:"System setup"}),(0,D.jsx)("p",{className:bc("mt-1 text-[10px] leading-[0.95rem]","light"===b?"text-[#705b4d]":"text-slate-400"),children:"Install the CLI if needed, make sure the gateway service exists, and verify a live RPC connection."})]}),(0,D.jsx)("div",{className:"mt-2.5 space-y-1.5",children:a.map((a,c)=>(0,D.jsxs)("div",{className:bc("flex items-center gap-1.5 rounded-[12px] border px-2 py-1.5",sJ(a.state,b)),children:[(0,D.jsx)("span",{className:bc("mt-0.5 inline-flex h-5 w-5 items-center justify-center rounded-full border text-[9px] font-medium",sK(a.state,b)),children:"complete"===a.state?(0,D.jsx)($,{className:"h-2.5 w-2.5"}):c+1}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,D.jsx)("p",{className:bc("text-[11px]","light"===b?"text-[#3e2f24]":"text-white"),children:a.label}),(0,D.jsx)("span",{className:bc("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",sL(a.state,b)),children:"complete"===a.state?"Ready":"current"===a.state?"Active":"Pending"})]}),(0,D.jsx)("p",{className:bc("mt-0.5 text-[8px] leading-[0.82rem]","light"===b?"text-[#8f7664]":"text-slate-500"),children:a.description})]})]},a.id))}),(0,D.jsx)(sE,{surfaceTheme:b,statusCopy:c,showDetails:d,phaseLabel:e,run:f})]})}function sD({snapshot:a,surfaceTheme:b,statusCopy:c,showDetails:d,phaseLabel:e,run:f,selectedModelId:g,availableModels:h,discoveredModels:i,onSelectedModelIdChange:j,onRunModelDiscover:k,onRunModelRefresh:l,onRunModelSetDefault:m}){let n=a.diagnostics.modelReadiness;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{className:"mt-3",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bc("text-[7px] uppercase tracking-[0.18em]","light"===b?"text-[#977b69]":"text-slate-500"),children:"Step 2"}),(0,D.jsx)("h2",{className:bc("mt-1 text-[13px] font-medium","light"===b?"text-[#33251c]":"text-white"),children:"Model setup"})]}),(0,D.jsxs)(bq,{type:"button",variant:"secondary",size:"sm",onClick:l,disabled:"running"===f.runState,className:sH(b),children:[(0,D.jsx)(M,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh"]})]}),(0,D.jsx)("p",{className:bc("mt-1 text-[10px] leading-[0.95rem]","light"===b?"text-[#705b4d]":"text-slate-400"),children:"Lock a usable default model before handing the user into the live product."})]}),(0,D.jsxs)("div",{className:"mt-2.5 grid gap-1.5 sm:grid-cols-3",children:[(0,D.jsx)(sF,{surfaceTheme:b,label:"Default model",value:n.resolvedDefaultModel||n.defaultModel||"Not set"}),(0,D.jsx)(sF,{surfaceTheme:b,label:"Available routes",value:`${n.availableModelCount}/${n.totalModelCount}`}),(0,D.jsx)(sF,{surfaceTheme:b,label:"Connected providers",value:String(n.authProviders.filter(a=>a.connected).length)})]}),(0,D.jsxs)("div",{className:bc("mt-2.5 rounded-[12px] border px-2.5 py-2.5","light"===b?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,D.jsxs)("div",{className:"grid gap-2.5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end",children:[(0,D.jsxs)("label",{className:"block",children:[(0,D.jsx)("span",{className:bc("text-[7px] uppercase tracking-[0.16em]","light"===b?"text-[#977b69]":"text-slate-500"),children:"Default model"}),(0,D.jsxs)("select",{value:g,onChange:a=>j(a.target.value),className:bc("mt-1.5 h-9 w-full rounded-[12px] border px-2.5 text-[11px] outline-none","light"===b?"border-[#dccabd] bg-white text-[#33251c]":"border-white/10 bg-white/[0.04] text-slate-100"),children:[(0,D.jsx)("option",{value:"",children:"Auto choose"}),h.map(a=>(0,D.jsxs)("option",{value:a.id,children:[a.name," \xb7 ",a.provider]},a.id))]})]}),(0,D.jsxs)("div",{className:bc("rounded-[12px] border px-2.5 py-1.5 text-[10px]","light"===b?"border-[#eadcd0] bg-[#fff7f2] text-[#705b4d]":"border-white/10 bg-white/[0.03] text-slate-400"),children:[n.localModelCount," local \xb7 ",n.remoteModelCount," remote"]})]}),(0,D.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:(0,D.jsx)(bq,{type:"button",variant:"secondary",size:"sm",onClick:k,disabled:"running"===f.runState,className:sH(b),children:i.length>0?"Scan again":"Discover models"})}),n.issues.length>0?(0,D.jsx)("div",{className:"mt-2.5 space-y-1",children:n.issues.map(a=>(0,D.jsx)("p",{className:bc("rounded-[10px] border px-2 py-1.5 text-[9px] leading-[0.85rem]","light"===b?"border-amber-200 bg-amber-50 text-amber-800":"border-amber-300/20 bg-amber-300/10 text-amber-100"),children:a},a))}):null,a.diagnostics.modelReadiness.authProviders.length>0?(0,D.jsx)("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:a.diagnostics.modelReadiness.authProviders.map(a=>(0,D.jsxs)("span",{className:bc("rounded-full border px-2 py-0.5 text-[9px]",a.connected?"light"===b?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-200":"light"===b?"border-[#dccabd] bg-white text-[#705b4d]":"border-white/10 bg-white/[0.04] text-slate-300"),children:[sI(a.provider),a.detail?` \xb7 ${a.detail}`:""]},a.provider))}):null,i.length>0?(0,D.jsxs)("div",{className:"mt-2.5 space-y-1.5",children:[(0,D.jsx)("p",{className:bc("text-[7px] uppercase tracking-[0.16em]","light"===b?"text-[#977b69]":"text-slate-500"),children:"Discovered routes"}),(0,D.jsx)("div",{className:"space-y-1.5",children:i.slice(0,3).map(a=>(0,D.jsxs)("div",{className:bc("flex items-center justify-between gap-2 rounded-[12px] border px-2 py-1.5","light"===b?"border-[#eadcd0] bg-[#fff7f2]":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:bc("truncate text-[10px]","light"===b?"text-[#3e2f24]":"text-white"),children:a.name}),(0,D.jsxs)("p",{className:bc("mt-0.5 text-[8px] leading-[0.85rem]","light"===b?"text-[#8f7664]":"text-slate-500"),children:[sI(a.provider),a.isFree?" \xb7 free":"",a.supportsTools?" \xb7 tools":""]})]}),(0,D.jsx)(bq,{type:"button",variant:"secondary",size:"sm",onClick:()=>m(a.modelId),disabled:"running"===f.runState,className:sH(b),children:"Use"})]},a.modelId))}),(0,D.jsx)("p",{className:bc("text-[9px] leading-[0.95rem]","light"===b?"text-[#705b4d]":"text-slate-500"),children:"The dropdown only shows routes that are already configured. Use a discovered route here to add it first; if credentials are missing, Mission Control will hand you off to OpenClaw."})]}):null]}),(0,D.jsx)(sE,{surfaceTheme:b,statusCopy:c,showDetails:d,phaseLabel:e,run:f})]})}function sE({surfaceTheme:a,statusCopy:b,showDetails:c,phaseLabel:d,run:e}){let[f,g]=(0,E.useState)(!1),h=!!e.manualCommand?.trim().startsWith("openclaw "),i=async()=>{if(e.manualCommand)try{await navigator.clipboard.writeText(e.manualCommand),ec.o.success("Command copied.",{description:"Open Terminal and paste the command to continue setup."})}catch(a){ec.o.error("Could not copy command.",{description:a instanceof Error?a.message:"Clipboard access is unavailable."})}},j=async()=>{if(e.manualCommand&&h){g(!0);try{let a=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e.manualCommand})}),b=await a.json().catch(()=>null);if(!a.ok||b?.error)throw Error(b?.error||"Unable to open Terminal.");ec.o.success("Terminal opened.",{description:"Finish the OpenClaw auth flow there, then return and refresh setup."})}catch(a){ec.o.error("Could not open Terminal.",{description:a instanceof Error?a.message:"Open Terminal manually and run the command below."})}finally{g(!1)}}};return(0,D.jsxs)("div",{className:bc("mt-2.5 rounded-[12px] border","light"===a?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,D.jsxs)("div",{className:"px-2.5 py-2",children:[(0,D.jsx)("p",{className:bc("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:"Current status"}),(0,D.jsx)("p",{className:bc("mt-1 text-[11px] leading-[1rem]","light"===a?"text-[#5f4b3e]":"text-slate-300"),children:b})]}),c?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{className:bc("flex items-center justify-between border-y px-2.5 py-1.5","light"===a?"border-[#ebddd2]":"border-white/8"),children:[(0,D.jsx)("p",{className:bc("text-[8px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:"Setup log"}),(0,D.jsx)("span",{className:"light"===a?"text-[10px] text-[#8c7362]":"text-[10px] text-slate-400",children:d})]}),(0,D.jsx)("pre",{className:bc("max-h-[120px] min-h-[68px] overflow-auto whitespace-pre-wrap break-words px-2.5 py-2 font-mono text-[8px] leading-[0.82rem]","light"===a?"text-[#4f3d31]":"text-slate-200"),children:e.log||"No command output yet.\n\nStart this step and Mission Control will stream each action here."}),e.manualCommand?(0,D.jsxs)("div",{className:bc("border-t px-2.5 py-2","light"===a?"border-[#ebddd2]":"border-white/8"),children:[(0,D.jsx)("p",{className:bc("text-[8px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:h?"Run in terminal":"Manual fallback"}),h?(0,D.jsx)("p",{className:bc("mt-1 text-[9px] leading-[0.95rem]","light"===a?"text-[#705b4d]":"text-slate-400"),children:"Open Terminal and run this command to continue setup."}):null,(0,D.jsx)("p",{className:bc("mt-1 break-all font-mono text-[9px] leading-[0.92rem]","light"===a?"text-[#4f3d31]":"text-slate-200"),children:e.manualCommand}),(0,D.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[(0,D.jsxs)(bq,{type:"button",variant:"secondary",size:"sm",onClick:i,className:sH(a),children:[(0,D.jsx)(W,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),h?(0,D.jsx)(bq,{type:"button",variant:"secondary",size:"sm",onClick:j,disabled:f,className:sH(a),children:f?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(N,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(V,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null]}),e.docsUrl?(0,D.jsxs)("a",{href:e.docsUrl,target:"_blank",rel:"noreferrer",className:bc("mt-2 inline-flex items-center gap-1 text-[9px] underline underline-offset-4","light"===a?"text-[#7f6554]":"text-slate-300"),children:["Setup docs",(0,D.jsx)(sy,{className:"h-2.5 w-2.5"})]}):null]}):null]}):null]})}function sF({surfaceTheme:a,label:b,value:c}){return(0,D.jsxs)("div",{className:bc("rounded-[12px] border px-2.5 py-2","light"===a?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,D.jsx)("p",{className:bc("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:b}),(0,D.jsx)("p",{className:bc("mt-1 text-[11px] leading-[0.92rem]","light"===a?"text-[#3e2f24]":"text-white"),children:c})]})}function sG(a,b){return a?"complete":b?"current":"pending"}function sH(a){return"light"===a?"border-[#b89374] bg-[#ecd4c1] text-[#4a3426] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#e4c6af] hover:text-[#38261b]":"border-white/10 bg-white/[0.05] text-slate-200 hover:bg-white/[0.1]"}function sI(a){let b=a.trim().toLowerCase();return"openrouter"===b?"OpenRouter":"openai-codex"===b?"OpenAI Codex":"openai"===b?"OpenAI":"anthropic"===b?"Anthropic":"ollama"===b?"Ollama":a.split("-").map(a=>a?a[0].toUpperCase()+a.slice(1):a).join(" ")}function sJ(a,b){return"complete"===a?"light"===b?"border-emerald-200 bg-emerald-50/60":"border-emerald-400/20 bg-emerald-400/8":"current"===a?"light"===b?"border-[#d9c2b3] bg-white/70":"border-white/12 bg-white/[0.05]":"light"===b?"border-[#eadcd0] bg-[#fffaf6]/80":"border-white/6 bg-white/[0.02]"}function sK(a,b){return"complete"===a?"light"===b?"border-emerald-300 bg-emerald-100 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"current"===a?"light"===b?"border-[#d5b9a5] bg-[#f5ebe3] text-[#8b6d5a]":"border-white/12 bg-white/[0.06] text-white":"light"===b?"border-[#e1ccc0] bg-white text-[#9a7f6c]":"border-white/8 bg-white/[0.03] text-slate-400"}function sL(a,b){return"complete"===a?"light"===b?"bg-emerald-100 text-emerald-700":"bg-emerald-300/10 text-emerald-200":"current"===a?"light"===b?"bg-[#efe1d4] text-[#876c5a]":"bg-white/[0.06] text-slate-300":"light"===b?"bg-[#f6ece4] text-[#a08471]":"bg-white/[0.04] text-slate-500"}let sM=K("package-x",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]),sN=K("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),sO=K("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);function sP({open:a,target:b,surfaceTheme:c,previewState:d,preview:e,previewError:f,runState:g,statusMessage:h,resultMessage:i,backgroundLogPath:j,log:k,confirmText:l,onConfirmTextChange:m,onRefreshPreview:n,onExecute:o,onOpenChange:p}){let q="full-uninstall"===b?"FULL UNINSTALL":"RESET MISSION CONTROL",r="running"===g,s="success"===g||"error"===g,t=null!==b&&"ready"===d&&!r&&!s&&l.trim()===q,u="full-uninstall"===b?"Full Uninstall":"Reset Mission Control",v="light"===c?"border-rose-400/80 bg-rose-600 text-white hover:bg-rose-700":"border-rose-400/35 bg-rose-500/90 text-white hover:bg-rose-500";return(0,D.jsx)(dx,{open:a,onOpenChange:a=>{(a||!r)&&p(a)},children:(0,D.jsxs)(d_,{className:bc("max-h-[88vh] w-[min(92vw,56rem)] max-w-[92vw] min-w-0 overflow-x-hidden overflow-y-auto sm:max-w-3xl","light"===c?"border-[#dcc8bb] bg-[rgba(252,247,241,0.98)] text-[#402f24]":"border-white/12 bg-[rgba(7,12,22,0.96)] text-slate-100"),children:[(0,D.jsxs)(d0,{children:[(0,D.jsxs)(d2,{className:bc("flex items-center gap-2","light"===c?"text-[#3f2f24]":"text-white"),children:["full-uninstall"===b?(0,D.jsx)(sM,{className:"h-4 w-4"}):(0,D.jsx)(sN,{className:"h-4 w-4"}),u]}),(0,D.jsx)(d3,{className:"light"===c?"text-[#7e6555]":"text-slate-400",children:"full-uninstall"===b?"Remove Mission Control state, OpenClaw service and local state, then attempt to remove detected OpenClaw and AgentOS packages.":"Remove Mission Control-managed workspaces, attached agents, planner state, and browser state."})]}),"loading"===d?(0,D.jsxs)("div",{className:bc("flex items-center gap-2 rounded-[16px] border px-4 py-4 text-sm","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsx)(N,{className:"h-4 w-4 animate-spin"}),"Loading the reset preview..."]}):null,"error"===d?(0,D.jsxs)("div",{className:bc("rounded-[16px] border px-4 py-4","light"===c?"border-rose-200 bg-rose-50 text-rose-900":"border-rose-400/25 bg-rose-500/10 text-rose-100"),children:[(0,D.jsx)("p",{className:"text-sm font-medium",children:"Preview could not be prepared."}),(0,D.jsx)("p",{className:"mt-1 text-sm",children:f||"Unknown reset preview error."})]}):null,e?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,D.jsx)(sQ,{label:"Delete folders",value:String(e.summary.deleteFolderCount),surfaceTheme:c}),(0,D.jsx)(sQ,{label:"Keep folders",value:String(e.summary.metadataOnlyCount),surfaceTheme:c}),(0,D.jsx)(sQ,{label:"Agents",value:String(e.summary.agentCount),surfaceTheme:c}),(0,D.jsx)(sQ,{label:"Live agents",value:String(e.summary.liveAgentCount),surfaceTheme:c,danger:e.summary.liveAgentCount>0})]}),e.warnings.length>0?(0,D.jsx)("div",{className:bc("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-amber-300/90 bg-amber-50 text-amber-950":"border-amber-300/25 bg-amber-300/10 text-amber-50"),children:(0,D.jsxs)("div",{className:"flex items-start gap-2",children:[(0,D.jsx)(P,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,D.jsx)("div",{className:"space-y-1 text-sm",children:e.warnings.map(a=>(0,D.jsx)("p",{children:a},a))})]})}):null,(0,D.jsxs)("div",{className:bc("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bc("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:"Workspace impact"}),(0,D.jsx)("p",{className:bc("mt-1 text-sm","light"===c?"text-[#6d5647]":"text-slate-400"),children:"`Delete folder` removes the workspace directory. `Keep folder` only removes OpenClaw and Mission Control integration from that location."})]}),(0,D.jsx)(bq,{type:"button",size:"sm",variant:"secondary",onClick:n,className:"light"===c?"border-[#dcc6b6] bg-white text-[#5d4739] hover:bg-[#f7eee7] hover:text-[#5d4739]":void 0,children:"Refresh preview"})]}),(0,D.jsx)("div",{className:"mt-3 space-y-2",children:e.workspaces.map(a=>(0,D.jsxs)("div",{className:bc("rounded-[14px] border px-3 py-3","light"===c?"border-[#ece0d6] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bc("text-sm font-medium","light"===c?"text-[#3f2f24]":"text-white"),children:a.name}),(0,D.jsx)("p",{className:bc("mt-1 break-all font-mono text-[11px]","light"===c?"text-[#7e6555]":"text-slate-400"),children:a.path})]}),(0,D.jsx)("span",{className:bc("rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]","delete-folder"===a.action?"light"===c?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-400/25 bg-rose-500/10 text-rose-200":"light"===c?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:"delete-folder"===a.action?"Delete folder":"Keep folder"})]}),(0,D.jsxs)("p",{className:bc("mt-2 text-xs","light"===c?"text-[#6d5647]":"text-slate-400"),children:[a.agentCount," agents, ",a.runtimeCount," tracked runs, ",a.liveAgentCount," live agents."]}),(0,D.jsx)("div",{className:"mt-2 space-y-1",children:a.reasons.map(a=>(0,D.jsx)("p",{className:bc("text-xs","light"===c?"text-[#7e6555]":"text-slate-500"),children:a},a))})]},a.workspaceId))})]}),(0,D.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,D.jsx)(sR,{title:"Mission Control state",items:e.missionControlPaths,surfaceTheme:c}),(0,D.jsx)(sR,{title:"Browser state",items:e.browserStorageKeys,surfaceTheme:c})]}),"full-uninstall"===b?(0,D.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,D.jsx)(sR,{title:"OpenClaw state",items:e.openClawPaths,surfaceTheme:c}),(0,D.jsxs)("div",{className:bc("rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsx)("p",{className:bc("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:"Package cleanup"}),(0,D.jsx)("div",{className:"mt-3 space-y-2",children:e.packageActions.map(a=>(0,D.jsxs)("div",{className:bc("min-w-0 overflow-hidden rounded-[14px] border px-3 py-3","light"===c?"border-[#ece0d6] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,D.jsx)("p",{className:bc("min-w-0 break-all text-sm font-medium","light"===c?"text-[#3f2f24]":"text-white"),children:a.packageName}),(0,D.jsx)("span",{className:bc("shrink-0 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",a.detected?"light"===c?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-400/25 bg-rose-500/10 text-rose-200":"light"===c?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-white/10 bg-white/[0.05] text-slate-300"),children:a.detected?"Scheduled":"Manual"})]}),(0,D.jsx)("p",{className:bc("mt-1 break-words text-xs","light"===c?"text-[#6d5647]":"text-slate-400"),children:a.reason||"No extra detail."}),(0,D.jsx)("p",{className:bc("mt-1 whitespace-pre-wrap break-all font-mono text-[11px]","light"===c?"text-[#7e6555]":"text-slate-500"),children:a.command||"Automatic package removal is not available."})]},a.packageName))})]})]}):null,(0,D.jsxs)("div",{className:bc("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-rose-200 bg-rose-50/70 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50"),children:[(0,D.jsxs)(rK,{htmlFor:"reset-confirm",className:"text-sm font-medium text-inherit",children:["Type ",q," to continue"]}),(0,D.jsx)(br,{id:"reset-confirm",value:l,onChange:a=>m(a.target.value),placeholder:q,disabled:r,className:bc("mt-2 h-10","light"===c?"border-rose-200 bg-white text-rose-950 placeholder:text-rose-300":"border-rose-300/20 bg-slate-950/50 text-rose-50 placeholder:text-rose-200/35")})]})]}):null,"idle"!==g||i||k?(0,D.jsxs)("div",{className:bc("min-w-0 overflow-hidden rounded-[16px] border px-4 py-4","error"===g?"light"===c?"border-rose-200 bg-rose-50 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50":"success"===g?"light"===c?"border-emerald-200 bg-emerald-50 text-emerald-950":"border-emerald-400/25 bg-emerald-500/10 text-emerald-50":"light"===c?"border-[#e6d6ca] bg-white text-[#3f2f24]":"border-white/10 bg-white/[0.03] text-slate-100"),children:[(0,D.jsx)("p",{className:"text-sm font-medium",children:h||i||"Reset status"}),i?(0,D.jsx)("p",{className:"mt-1 text-sm",children:i}):null,j?(0,D.jsxs)("p",{className:"mt-2 break-all font-mono text-[11px]",children:["Background cleanup log: ",j]}):null,(0,D.jsx)("pre",{className:bc("mt-3 max-h-56 w-full max-w-full overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-[14px] border px-3 py-3 text-[11px] leading-relaxed","light"===c?"border-[#e6d6ca] bg-[#fffaf6] text-[#5f4a3d]":"border-white/10 bg-slate-950/45 text-slate-300"),children:k||"Waiting for command output..."})]}):null,(0,D.jsxs)(d1,{children:[(0,D.jsx)(bq,{type:"button",variant:s?"default":"secondary",onClick:()=>p(!1),disabled:r,className:s&&"light"===c?"bg-[#5c4437] text-white hover:bg-[#4d382d]":s?"bg-cyan-400 text-slate-950 hover:bg-cyan-300":void 0,children:s?"Done":"Close"}),s?null:(0,D.jsx)(bq,{type:"button",onClick:o,disabled:!t,className:v,children:r?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(N,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Running..."]}):(0,D.jsxs)(D.Fragment,{children:["full-uninstall"===b?(0,D.jsx)(sM,{className:"mr-1.5 h-3.5 w-3.5"}):(0,D.jsx)(sO,{className:"mr-1.5 h-3.5 w-3.5"}),u]})})]})]})})}function sQ({label:a,value:b,surfaceTheme:c,danger:d=!1}){return(0,D.jsxs)("div",{className:bc("rounded-[16px] border px-4 py-3",d?"light"===c?"border-rose-200 bg-rose-50":"border-rose-400/20 bg-rose-500/10":"light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsx)("p",{className:bc("text-[11px] uppercase tracking-[0.16em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:a}),(0,D.jsx)("p",{className:bc("mt-1 font-display text-lg","light"===c?"text-[#3f2f24]":"text-white"),children:b})]})}function sR({title:a,items:b,surfaceTheme:c}){return(0,D.jsxs)("div",{className:bc("rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsx)("p",{className:bc("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:a}),(0,D.jsx)("div",{className:"mt-3 space-y-2",children:b.map(a=>(0,D.jsx)("p",{className:bc("break-all rounded-[12px] border px-3 py-2 font-mono text-[11px]","light"===c?"border-[#ece0d6] bg-[#fffaf6] text-[#6d5647]":"border-white/8 bg-white/[0.03] text-slate-400"),children:a},a))})]})}var sS=c(4518),sT=c.n(sS);let sU=K("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),sV=K("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);function sW({snapshot:a,activeWorkspaceId:b,requestedAgentAction:c,connectionState:d,collapsed:e,modelManager:f,onToggleCollapsed:g,onSelectWorkspace:h,onRefresh:i,onRunModelRefresh:j,onRunModelDiscover:k,onRunModelSetDefault:l,onConnectModelProvider:m,onOpenModelSetup:n,onOpenAddModels:o,onEditWorkspace:p}){var q;let[r,s]=(0,E.useState)(!1),t=function(a){switch(a){case"healthy":return"text-emerald-300";case"degraded":return"text-amber-200";default:return"text-rose-200"}}(a.diagnostics.health),u="healthy"===a.diagnostics.health?"bg-emerald-300":"degraded"===a.diagnostics.health?"bg-amber-200":"bg-rose-300",v=a.diagnostics.gatewayUrl.replace(/^wss?:\/\//,"").replace(/\/$/,""),[w,x]=(0,E.useState)(!1),[y,z]=(0,E.useState)(!1),[A,B]=(0,E.useState)(!1),[C,F]=(0,E.useState)(!1),[G,H]=(0,E.useState)(!1),[I,J]=(0,E.useState)(!1),[K,L]=(0,E.useState)(!1),[O,Q]=(0,E.useState)(null),[R,S]=(0,E.useState)(null),[T,V]=(0,E.useState)(""),[W,X]=(0,E.useState)(null),[Y,Z]=(0,E.useState)(""),[$,_]=(0,E.useState)("workspaces"),[aa,ab]=(0,E.useState)("");(0,E.useRef)(null);let ac=(0,E.useMemo)(()=>a.agents.filter(a=>!b||a.workspaceId===b).sort((a,b)=>a.workspaceId!==b.workspaceId?a.workspaceId.localeCompare(b.workspaceId):a.name.localeCompare(b.name)),[a.agents,b]),ad=a.workspaces.find(a=>a.id===b)??a.workspaces[0]??null,ae=(0,E.useMemo)(()=>a.models.filter(a=>!1!==a.available&&!a.missing),[a.models]),af=(0,E.useMemo)(()=>f.discoveredModels.filter(b=>!a.models.some(a=>a.id===b.modelId)),[f.discoveredModels,a.models]),ag=aa&&(ae.some(a=>a.id===aa)||af.some(a=>a.modelId===aa))?aa:(q=a).diagnostics.modelReadiness.resolvedDefaultModel||q.diagnostics.modelReadiness.defaultModel||q.models.find(a=>!1!==a.available&&!a.missing)?.id||"",ah=!!O&&(y||"monitoring"===O.policy.preset),ai=()=>{r&&s(!1),e&&g()},aj=[{id:"overview",label:"Overview",icon:sU},{id:"workspaces",label:"Workspaces",icon:rj,badge:String(a.workspaces.length)},{id:"agents",label:"Agents",icon:cp,badge:String(ac.length)},{id:"models",label:"Models",icon:co,badge:String(a.models.length)}],ak=(0,E.useMemo)(()=>R?a.agents.filter(a=>a.workspaceId===R.id):[],[R,a.agents]),al=(0,E.useMemo)(()=>ak.filter(a=>"engaged"===a.status||"monitoring"===a.status||"ready"===a.status),[ak]),am=(0,E.useMemo)(()=>R?a.runtimes.filter(a=>a.workspaceId===R.id):[],[R,a.runtimes]),an=(0,E.useMemo)(()=>W?a.runtimes.filter(a=>a.agentId===W.id):[],[W,a.runtimes]),ao=W?a.workspaces.find(a=>a.id===W.workspaceId)??null:null,ap=!!W&&("engaged"===W.status||"monitoring"===W.status||"ready"===W.status),aq=async()=>{if(O){B(!0);try{let a=await fetch("/api/agents",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)}),b=await a.json();if(!a.ok||b.error)throw Error(b.error||"OpenClaw could not update the agent.");ec.o.success("Agent updated in OpenClaw.",{description:O.id}),x(!1),await i()}catch(a){ec.o.error("Agent update failed.",{description:a instanceof Error?a.message:"Unknown agent error."})}finally{B(!1)}}},ar=async()=>{if(R){H(!0);try{let a=await fetch("/api/workspaces",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceId:R.id})}),c=await a.json();if(!a.ok||c.error)throw Error(c.error||"OpenClaw could not delete the workspace.");ec.o.success("Workspace deleted from OpenClaw.",{description:c.workspacePath||R.path}),F(!1),S(null),V(""),h(b===R.id?null:b),await i()}catch(a){ec.o.error("Workspace deletion failed.",{description:a instanceof Error?a.message:"Unknown workspace error."})}finally{H(!1)}}},as=async()=>{if(W){L(!0);try{let a=await fetch("/api/agents",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentId:W.id})}),b=await a.json();if(!a.ok||b.error)throw Error(b.error||"OpenClaw could not delete the agent.");ec.o.success("Agent deleted from OpenClaw.",{description:b.agentId||W.id}),O?.id===W.id&&(x(!1),Q(null)),J(!1),X(null),Z(""),await i()}catch(a){ec.o.error("Agent deletion failed.",{description:a instanceof Error?a.message:"Unknown agent error."})}finally{L(!1)}}};return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{className:"relative flex h-full items-start overflow-visible",children:[(0,D.jsxs)("div",{className:bc("panel-surface panel-glow relative flex h-full shrink-0 self-stretch flex-col items-center overflow-hidden px-3 py-4 transition-[max-height] duration-500 ease-[cubic-bezier(0.22,1,0.36,1)]",e?"w-full rounded-[30px]":"w-[78px] rounded-l-[30px] rounded-r-none border-r-0",r?"max-h-[176px]":"max-h-full"),children:[(0,D.jsx)("button",{type:"button","aria-label":e?"Open mission control":"Collapse mission control",onClick:()=>{e?ai():g()},className:"flex h-12 w-12 shrink-0 aspect-square items-center justify-center overflow-hidden rounded-[18px] border border-cyan-300/20 bg-cyan-400/[0.12] shadow-[0_10px_24px_rgba(34,211,238,0.18)]",children:(0,D.jsx)(sT(),{src:"/assets/logo.webp",alt:"",width:32,height:32,"aria-hidden":"true",className:"pointer-events-none h-8 w-8 select-none object-contain",priority:!0})}),(0,D.jsx)("div",{className:bc("mt-6 flex w-full flex-1 flex-col items-center gap-2 overflow-hidden transition-[max-height,opacity,transform] duration-500 ease-[cubic-bezier(0.22,1,0.36,1)]",r?"max-h-0 -translate-y-3 opacity-0 pointer-events-none":"max-h-[420px] translate-y-0 opacity-100"),children:aj.map(a=>(0,D.jsx)(sX,{icon:a.icon,label:a.label,active:$===a.id,onClick:()=>{(_(a.id),e)?ai():$===a.id&&g()}},a.id))}),(0,D.jsxs)("div",{className:"mt-auto flex w-full flex-col items-center gap-2 pb-1",children:[(0,D.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,D.jsx)(pW,{tone:u,pulse:"healthy"===a.diagnostics.health}),e?(0,D.jsx)("p",{className:"text-[9px] uppercase tracking-[0.18em] text-slate-500",children:a.mode}):null]}),(0,D.jsx)("button",{type:"button","aria-label":r?"Expand rail":"Collapse rail",onClick:()=>{e||g(),s(a=>!a)},className:"inline-flex h-11 w-11 items-center justify-center rounded-[16px] border border-white/10 bg-white/[0.04] text-slate-300 transition-all hover:border-cyan-300/18 hover:bg-white/[0.08] hover:text-white",children:r?(0,D.jsx)(U,{className:"h-4 w-4"}):(0,D.jsx)(jI,{className:"h-4 w-4"})})]})]}),(0,D.jsx)("div",{className:bc("panel-surface panel-glow h-full min-w-0 flex-1 overflow-hidden rounded-r-[30px] border border-white/[0.08] bg-[#04070e]/88 shadow-[0_28px_90px_rgba(0,0,0,0.42)] backdrop-blur-2xl transition-[opacity,transform] duration-500 ease-[cubic-bezier(0.22,1,0.36,1)]",e?"-translate-x-4 opacity-0 pointer-events-none":"translate-x-0 opacity-100",!e&&"rounded-l-none border-l-0"),children:(0,D.jsxs)("div",{className:"mission-scroll flex h-full min-h-0 flex-col overflow-y-auto overscroll-contain",children:[(0,D.jsxs)("div",{className:"shrink-0 px-5 pb-4 pt-5",children:[(0,D.jsxs)("div",{className:"flex w-full items-baseline justify-center gap-2 whitespace-nowrap text-center",children:[(0,D.jsx)("span",{className:"font-display text-[15px] font-semibold tracking-[0.2em] text-slate-100",children:"AgentOS"}),(0,D.jsx)("span",{className:"text-[11px] font-medium text-slate-600",children:"|"}),(0,D.jsx)("span",{className:"font-display text-[11px] font-normal tracking-[0.2em] text-slate-500",children:"Mission Control"})]}),(0,D.jsx)("div",{className:"mt-4 h-px w-full bg-white/[0.08]"}),(0,D.jsxs)("div",{className:"mt-4 rounded-[22px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(13,20,34,0.98),rgba(6,10,18,0.96))] p-4",children:[(0,D.jsxs)("div",{className:"flex items-center gap-3",children:[(0,D.jsx)(pW,{tone:u,pulse:"healthy"===a.diagnostics.health}),(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:bc("text-[13px] font-medium capitalize",t),children:a.diagnostics.health}),(0,D.jsxs)("p",{className:"truncate text-[10px] uppercase tracking-[0.2em] text-slate-500",children:["live"===d?"online":d,(0,D.jsx)("span",{className:"mx-2 text-slate-600",children:"\xb7"}),v]})]})]}),a.diagnostics.issues.length>0?(0,D.jsx)("div",{className:"mt-3 rounded-[16px] border border-amber-400/15 bg-amber-400/[0.08] px-3 py-2 text-xs text-amber-100",children:a.diagnostics.issues[0]}):null]}),(0,D.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:aj.map(a=>(0,D.jsx)(sY,{label:a.label,badge:a.badge,active:$===a.id,onClick:()=>_(a.id)},a.id))})]}),(0,D.jsxs)("div",{className:"flex-1 space-y-6 p-4",children:["overview"===$?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(sZ,{eyebrow:"Overview",title:"System summary",detail:"Current health, active focus, and runtime inventory."}),(0,D.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,D.jsx)(s$,{label:"Workspaces",value:String(a.workspaces.length)}),(0,D.jsx)(s$,{label:"Agents",value:String(a.agents.length)}),(0,D.jsx)(s$,{label:"Models",value:String(a.models.length)}),(0,D.jsx)(s$,{label:"Runs",value:String(a.runtimes.length)})]}),ad?(0,D.jsxs)("div",{className:"rounded-[22px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(6,10,18,0.88))] p-4",children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:ad.name}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.22em] text-slate-500",children:ad.slug})]}),(0,D.jsx)(be,{variant:"muted",children:ad.health})]}),(0,D.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[10px] uppercase tracking-[0.16em] text-slate-400",children:[(0,D.jsxs)("span",{children:[ad.agentIds.length," agents"]}),(0,D.jsxs)("span",{children:[ad.modelIds.length," models"]}),(0,D.jsxs)("span",{children:[ad.activeRuntimeIds.length," runs"]})]}),(0,D.jsx)("p",{className:"mt-3 text-[12px] text-slate-400",children:function(a){let b=qZ(a),c=b.split("/").filter(Boolean).filter(a=>{var b;return b=a,!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(b)});if(c.length<=3)return b;let d="~"===c[0]?"~/":"/";return`${d}…/${c.slice(-2).join("/")}`}(ad.path)})]}):null]}):null,"workspaces"===$?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(sZ,{eyebrow:"Home",title:"Workspaces",detail:"Select, rename, or remove real OpenClaw workspaces.",action:(0,D.jsx)(bq,{variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>h(null),children:"All"})}),(0,D.jsx)("div",{className:"space-y-3",children:a.workspaces.map(a=>{let c=a.id===b;return(0,D.jsxs)("div",{className:bc("rounded-[20px] border p-3.5 transition-all",c?"border-cyan-300/[0.35] bg-cyan-400/[0.08] shadow-[0_14px_40px_rgba(34,211,238,0.12)]":"border-white/[0.08] bg-white/[0.03] hover:bg-white/[0.05]"),children:[(0,D.jsx)("button",{type:"button",onClick:()=>h(c?null:a.id),className:"w-full text-left",children:(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:a.name}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a.slug})]}),(0,D.jsx)(be,{variant:c?"default":"muted",children:a.health})]})}),(0,D.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[10px] uppercase tracking-[0.16em] text-slate-400",children:[(0,D.jsxs)("span",{children:[a.agentIds.length," agents"]}),(0,D.jsxs)("span",{children:[a.modelIds.length," models"]}),(0,D.jsxs)("span",{children:[a.activeRuntimeIds.length," runs"]})]}),(0,D.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,D.jsx)(bq,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>p(a.id),children:"Edit"}),(0,D.jsx)(bq,{variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px] text-rose-200 hover:bg-rose-400/10 hover:text-rose-100",onClick:()=>{S(a),V(""),F(!0)},children:"Delete"})]})]},a.id)})})]}):null,"agents"===$?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(sZ,{eyebrow:"Apps",title:"Agents",detail:"Create and tune live isolated OpenClaw operators.",action:(0,D.jsx)(rP,{snapshot:a,defaultWorkspaceId:b??a.workspaces[0]?.id??null,onRefresh:i,trigger:(0,D.jsx)(bq,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:0===a.workspaces.length,children:"Add"})})}),(0,D.jsxs)("div",{className:"space-y-3",children:[0===ac.length?(0,D.jsx)("div",{className:"rounded-[18px] border border-white/[0.08] bg-white/[0.03] px-3.5 py-3 text-[12px] text-slate-400",children:"No agents are attached to this workspace yet."}):null,ac.map(c=>(0,D.jsxs)("div",{className:"rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] p-3.5",children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsxs)("p",{className:"truncate text-[13px] font-medium text-white",children:[c.identity.emoji?`${c.identity.emoji} `:"",c.name]}),(0,D.jsx)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.22em] text-slate-500",children:c.id}),(0,D.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[(0,D.jsx)(be,{variant:qu[c.policy.preset].badgeVariant,children:qC(c.policy.preset)}),(0,D.jsx)(be,{variant:"engaged"===c.status?"default":"muted",children:c.status})]})]}),(0,D.jsx)(s5,{agentName:c.name,onEdit:()=>{Q({...function(a,b={}){let c=qB(b.policy?.preset??"worker",b.policy),d=qu[c.preset],e=rN(c.preset,b.heartbeat);return{id:b.id??"",workspaceId:a,modelId:b.modelId??"",name:b.name??d.defaultName,emoji:b.emoji??d.defaultEmoji,theme:b.theme??d.defaultTheme,avatar:b.avatar??"",policy:c,heartbeat:e}}(c.workspaceId,{id:c.id,modelId:"unassigned"===c.modelId?"":c.modelId,name:c.name,emoji:c.identity.emoji??"",theme:c.identity.theme??"",avatar:c.identity.avatar??"",policy:c.policy,heartbeat:rN(c.policy.preset,{enabled:c.heartbeat.enabled,every:c.heartbeat.every??void 0})})}),z(!1),x(!0)},onDelete:()=>{X(c),Z(""),J(!0)}})]}),(0,D.jsx)("div",{className:"mt-3 flex items-center gap-2",children:(0,D.jsx)("div",{className:"min-w-0 flex-1 rounded-full border border-white/[0.08] bg-white/[0.03] px-3 py-2 text-[10px] uppercase tracking-[0.16em] text-slate-400",children:(0,D.jsx)("span",{className:"truncate",children:"unassigned"===c.modelId?"default model":qW(c.modelId)})})}),b?null:(0,D.jsx)("p",{className:"mt-2 truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.workspaces.find(a=>a.id===c.workspaceId)?.name||"Workspace"})]},c.id))]})]}):null,"models"===$?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(sZ,{eyebrow:"Models",title:"Models & providers",detail:"Connect providers, choose a default route, and manage live model readiness."}),(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] p-4",children:[(0,D.jsxs)("div",{className:"space-y-1.5",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Default"}),(0,D.jsx)("p",{className:"font-display text-[15px] text-white",children:a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||"Not set"}),(0,D.jsx)("p",{className:"text-[12px] leading-5 text-slate-400",children:"Connect providers, choose a default route, and keep live model readiness visible."})]}),(0,D.jsxs)("div",{className:"mt-4 grid gap-3 border-t border-white/[0.06] pt-4 sm:grid-cols-2",children:[(0,D.jsxs)("div",{className:"rounded-[16px] border border-white/[0.06] bg-white/[0.03] px-3 py-2.5",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Providers"}),(0,D.jsxs)("p",{className:"mt-1.5 text-[13px] leading-5 text-white",children:[a.diagnostics.modelReadiness.authProviders.filter(a=>a.connected).length," ","connected"]})]}),(0,D.jsxs)("div",{className:"rounded-[16px] border border-white/[0.06] bg-white/[0.03] px-3 py-2.5",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Routes"}),(0,D.jsxs)("p",{className:"mt-1.5 text-[13px] leading-5 text-white",children:[a.diagnostics.modelReadiness.availableModelCount,"/",a.diagnostics.modelReadiness.totalModelCount," available"]})]})]}),f.systemReady?null:(0,D.jsxs)("div",{className:"mt-4 rounded-[16px] border border-amber-400/15 bg-amber-400/[0.08] px-3 py-2.5",children:[(0,D.jsx)("p",{className:"text-[13px] font-medium text-amber-50",children:"Finish system setup first"}),(0,D.jsx)("p",{className:"mt-1.5 text-[12px] leading-5 text-amber-100/80",children:"Provider auth and model verification need a live OpenClaw gateway and writable runtime state."}),(0,D.jsx)("div",{className:"mt-3",children:(0,D.jsx)(bq,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:n,children:"Open setup"})})]}),(0,D.jsxs)("label",{className:"mt-4 block space-y-1 border-t border-white/[0.06] pt-4",children:[(0,D.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Default model"}),(0,D.jsxs)("select",{value:ag,onChange:a=>ab(a.target.value),className:"h-10 w-full rounded-[14px] border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-100 outline-none",children:[(0,D.jsx)("option",{value:"",children:"Auto choose"}),ae.map(a=>(0,D.jsxs)("option",{value:a.id,children:[a.name," \xb7 ",a.provider]},a.id))]})]}),(0,D.jsxs)("div",{className:"mt-4 grid gap-2",children:[(0,D.jsx)(bq,{variant:"secondary",size:"sm",className:"h-8 w-full justify-center rounded-full px-3 text-[11px]",disabled:!f.systemReady||"running"===f.runState,onClick:()=>l(ag||void 0),children:"running"===f.runState?"Working...":"Use selected model"}),(0,D.jsx)(bq,{variant:"ghost",size:"sm",className:"h-8 w-full justify-center rounded-full px-3 text-[11px]",disabled:!f.systemReady||"running"===f.runState,onClick:k,children:"Discover routes"})]})]}),(0,D.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,D.jsx)(bq,{variant:"secondary",size:"sm",className:"h-8 w-full justify-center rounded-full px-3 text-[11px]",onClick:o,children:"Add models"}),(0,D.jsxs)(bq,{variant:"ghost",size:"sm",className:"h-8 w-full justify-center rounded-full px-3 text-[11px]",disabled:"running"===f.runState,onClick:j,children:["running"===f.runState?(0,D.jsx)(N,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,D.jsx)(M,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh"]})]}),(0,D.jsx)("div",{className:"space-y-3",children:a.diagnostics.modelReadiness.authProviders.map(a=>(0,D.jsx)(s_,{provider:a,disabled:!f.systemReady||"running"===f.runState,onConnect:()=>m(a.provider)},a.provider))}),af.length>0?(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"font-display text-[15px] text-white",children:"Discovered routes"}),(0,D.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-slate-400",children:"Newly detected remote routes that are not configured in the current model deck yet."})]}),(0,D.jsx)(be,{variant:"muted",children:af.length})]}),(0,D.jsx)("div",{className:"mt-3 space-y-2",children:af.slice(0,6).map(a=>(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate text-[13px] font-medium text-white",children:a.name}),(0,D.jsxs)("p",{className:"mt-1 text-[10px] uppercase tracking-[0.18em] text-slate-500",children:[s0(a.provider),a.isFree?" \xb7 free":"",a.supportsTools?" \xb7 tools":""]})]}),(0,D.jsx)(bq,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:!f.systemReady||"running"===f.runState,onClick:()=>l(a.modelId),children:"Use"})]},a.modelId))})]}):null,(0,D.jsx)("div",{className:"space-y-3",children:a.models.slice(0,8).map(a=>(0,D.jsxs)("div",{className:"rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] px-3.5 py-3",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate text-[13px] font-medium text-white",children:qW(a.id)}),(0,D.jsx)("p",{className:"mt-1 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a.provider})]}),(0,D.jsx)(be,{variant:a.local?"success":a.missing?"danger":"muted",children:a.local?"local":a.missing?"missing":"remote"})]}),(0,D.jsxs)("div",{className:"mt-3 flex items-center justify-between text-[11px] text-slate-400",children:[(0,D.jsxs)("span",{children:[qU(a.contextWindow)," ctx"]}),(0,D.jsxs)("span",{children:[a.usageCount," agents"]})]})]},a.id))})]}):null]}),(0,D.jsx)("div",{className:"shrink-0 border-t border-white/[0.08] p-4",children:(0,D.jsx)("div",{className:"rounded-[22px] border border-cyan-300/10 bg-[linear-gradient(180deg,rgba(7,22,31,0.95),rgba(5,13,22,0.95))] p-4 shadow-[0_16px_40px_rgba(0,0,0,0.22)]",children:(0,D.jsxs)("div",{className:"flex items-center gap-3",children:[(0,D.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-full border border-cyan-300/15 bg-cyan-400/[0.12] text-cyan-200",children:(0,D.jsx)(sV,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:ad?.name||"No active workspace"}),(0,D.jsx)("p",{className:"mt-1 text-[12px] text-slate-400",children:ad?`${ad.agentIds.length} agents \xb7 ${ad.activeRuntimeIds.length} runs`:`${a.agents.length} agents \xb7 ${a.runtimes.length} runs`})]})]})})})]})})]}),(0,D.jsx)(dx,{open:C,onOpenChange:F,children:(0,D.jsxs)(d_,{children:[(0,D.jsxs)(d0,{children:[(0,D.jsx)(d2,{children:"Delete OpenClaw workspace"}),(0,D.jsx)(d3,{children:"This permanently removes the workspace directory and all OpenClaw agents bound to it."})]}),R?(0,D.jsxs)("div",{className:"space-y-4",children:[(0,D.jsx)("div",{className:"rounded-[20px] border border-rose-400/20 bg-rose-500/[0.08] px-4 py-3.5",children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("div",{className:"mt-0.5 rounded-full border border-rose-300/20 bg-rose-400/10 p-2 text-rose-200",children:(0,D.jsx)(P,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"space-y-1.5 text-sm text-rose-50",children:[(0,D.jsx)("p",{className:"font-medium",children:"This action cannot be undone."}),(0,D.jsx)("p",{className:"text-rose-100/80",children:"OpenClaw will remove the workspace folder from disk and prune the attached agents/state."})]})]})}),(0,D.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,D.jsx)(s7,{label:"Agents",value:String(ak.length)}),(0,D.jsx)(s7,{label:"Runs",value:String(am.length)}),(0,D.jsx)(s7,{label:"Live agents",value:String(al.length),danger:al.length>0})]}),(0,D.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.03] px-3.5 py-3",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Workspace path"}),(0,D.jsx)("p",{className:"mt-1.5 break-all font-mono text-xs text-slate-300",children:R.path})]}),al.length>0||am.length>0?(0,D.jsx)("div",{className:"rounded-[18px] border border-amber-400/15 bg-amber-400/[0.08] px-3.5 py-3 text-sm text-amber-100",children:al.length>0?`${al.length} active or recently engaged agents are still attached to this workspace.`:`${am.length} runtime records are still associated with this workspace.`}):null,(0,D.jsx)(s1,{label:`Type ${R.slug} to confirm`,htmlFor:"delete-workspace-confirm",children:(0,D.jsx)(br,{id:"delete-workspace-confirm",value:T,onChange:a=>V(a.target.value),placeholder:R.slug})})]}):null,(0,D.jsxs)(d1,{children:[(0,D.jsx)(bq,{variant:"secondary",onClick:()=>{F(!1),S(null),V("")},children:"Cancel"}),(0,D.jsx)(bq,{variant:"destructive",onClick:ar,disabled:G||!R||T.trim()!==R.slug,children:G?"Deleting…":"Delete workspace"})]})]})}),(0,D.jsx)(dx,{open:I,onOpenChange:J,children:(0,D.jsxs)(d_,{children:[(0,D.jsxs)(d0,{children:[(0,D.jsx)(d2,{children:"Delete OpenClaw agent"}),(0,D.jsx)(d3,{children:"This removes the selected agent from OpenClaw and detaches its workspace binding."})]}),W?(0,D.jsxs)("div",{className:"space-y-4",children:[(0,D.jsx)("div",{className:"rounded-[20px] border border-rose-400/20 bg-rose-500/[0.08] px-4 py-3.5",children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("div",{className:"mt-0.5 rounded-full border border-rose-300/20 bg-rose-400/10 p-2 text-rose-200",children:(0,D.jsx)(P,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"space-y-1.5 text-sm text-rose-50",children:[(0,D.jsx)("p",{className:"font-medium",children:"This action cannot be undone."}),(0,D.jsx)("p",{className:"text-rose-100/80",children:"OpenClaw will delete this agent, remove its config entry, remove its manifest record, and clean up agent-specific policy/state files. Shared workspace docs and files will remain."})]})]})}),(0,D.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,D.jsx)(s7,{label:"Status",value:W.status,danger:ap}),(0,D.jsx)(s7,{label:"Runs",value:String(an.length)}),(0,D.jsx)(s7,{label:"Workspace",value:ao?.name??"Unknown"})]}),(0,D.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.03] px-3.5 py-3",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Agent id"}),(0,D.jsx)("p",{className:"mt-1.5 break-all font-mono text-xs text-slate-300",children:W.id})]}),ap||an.length>0?(0,D.jsx)("div",{className:"rounded-[18px] border border-amber-400/15 bg-amber-400/[0.08] px-3.5 py-3 text-sm text-amber-100",children:ap?"This agent is still active or recently engaged. Delete it only if you want to stop using it entirely.":`${an.length} runtime records are still associated with this agent.`}):null,(0,D.jsx)(s1,{label:`Type ${W.id} to confirm`,htmlFor:"delete-agent-confirm",children:(0,D.jsx)(br,{id:"delete-agent-confirm",value:Y,onChange:a=>Z(a.target.value),placeholder:W.id})})]}):null,(0,D.jsxs)(d1,{children:[(0,D.jsx)(bq,{variant:"secondary",onClick:()=>{J(!1),X(null),Z("")},children:"Cancel"}),(0,D.jsx)(bq,{variant:"destructive",onClick:as,disabled:K||!W||Y.trim()!==W.id,children:K?"Deleting…":"Delete agent"})]})]})}),(0,D.jsx)(dx,{open:w,onOpenChange:x,children:(0,D.jsxs)(d_,{className:"max-h-[90vh] overflow-y-auto sm:max-w-3xl",children:[(0,D.jsxs)(d0,{children:[(0,D.jsx)(d2,{children:"Edit OpenClaw agent"}),(0,D.jsx)(d3,{children:"Update the selected agent identity, preset, and operating policy."})]}),O?(0,D.jsxs)("div",{className:"space-y-5",children:[(0,D.jsxs)("div",{className:"space-y-3",children:[(0,D.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:"Agent preset"}),(0,D.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:qw.map(a=>(0,D.jsx)(s2,{label:a.label,description:a.description,active:O.policy.preset===a.value,badgeVariant:qu[a.value].badgeVariant,onClick:()=>Q(b=>{var c,d;let e,f,g;return b?(c=b,d=a.value,e=qu[c.policy.preset],f=qu[d],g=qB(d),{...c,name:c.name&&c.name!==e.defaultName?c.name:f.defaultName,emoji:c.emoji&&c.emoji!==e.defaultEmoji?c.emoji:f.defaultEmoji,theme:c.theme&&c.theme!==e.defaultTheme?c.theme:f.defaultTheme,policy:g,heartbeat:rO(c.heartbeat,c.policy.preset,d)}):b})},a.value))})]}),(0,D.jsx)(s3,{policy:O.policy}),(0,D.jsx)(s1,{label:"Agent id",htmlFor:"edit-agent-id",children:(0,D.jsx)(br,{id:"edit-agent-id",value:O.id,disabled:!0})}),(0,D.jsx)(s1,{label:"Display name",htmlFor:"edit-agent-name",children:(0,D.jsx)(br,{id:"edit-agent-name",value:O.name,onChange:a=>Q(b=>b?{...b,name:a.target.value}:b),placeholder:qu[O.policy.preset].defaultName})}),(0,D.jsx)(s1,{label:"Workspace",htmlFor:"edit-agent-workspace",children:(0,D.jsx)(br,{id:"edit-agent-workspace",value:a.workspaces.find(a=>a.id===O.workspaceId)?.name||O.workspaceId,disabled:!0})}),(0,D.jsx)(s1,{label:"Model",htmlFor:"edit-agent-model",children:(0,D.jsxs)("select",{id:"edit-agent-model",value:O.modelId,onChange:a=>Q(b=>b?{...b,modelId:a.target.value}:b),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:[(0,D.jsx)("option",{value:"",children:"Use OpenClaw default"}),a.models.map(a=>(0,D.jsx)("option",{value:a.id,children:a.id},a.id))]})}),(0,D.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,D.jsx)(s1,{label:"Emoji",htmlFor:"edit-agent-emoji",children:(0,D.jsx)(br,{id:"edit-agent-emoji",value:O.emoji,onChange:a=>Q(b=>b?{...b,emoji:a.target.value}:b),placeholder:qu[O.policy.preset].defaultEmoji})}),(0,D.jsx)(s1,{label:"Theme",htmlFor:"edit-agent-theme",children:(0,D.jsx)(br,{id:"edit-agent-theme",value:O.theme,onChange:a=>Q(b=>b?{...b,theme:a.target.value}:b),placeholder:qu[O.policy.preset].defaultTheme})})]}),(0,D.jsx)(s1,{label:"Avatar URL",htmlFor:"edit-agent-avatar",children:(0,D.jsx)(br,{id:"edit-agent-avatar",value:O.avatar,onChange:a=>Q(b=>b?{...b,avatar:a.target.value}:b),placeholder:"https://example.com/avatar.png"})}),(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-white/[0.03] p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:"Advanced policy"}),(0,D.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"Override how this agent handles missing tools, installs, file scope, and network usage."})]}),(0,D.jsx)(bq,{type:"button",variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>z(a=>!a),children:y?"Hide":"Show"})]}),ah?(0,D.jsxs)("div",{className:"mt-4 rounded-[18px] border border-white/10 bg-slate-950/40 p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:"Heartbeat"}),(0,D.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"Use this only for periodic watch or triage agents. Leave it off for normal task execution."})]}),(0,D.jsx)(bq,{type:"button",variant:O.heartbeat.enabled?"default":"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>Q(a=>a?{...a,heartbeat:a.heartbeat.enabled?{...a.heartbeat,enabled:!1}:{...a.heartbeat,enabled:!0,every:a.heartbeat.every||rM(a.policy.preset).every}}:a),children:O.heartbeat.enabled?"On":"Off"})]}),O.heartbeat.enabled?(0,D.jsx)("div",{className:"mt-3",children:(0,D.jsx)(s1,{label:"Interval",htmlFor:"edit-agent-heartbeat-every",children:(0,D.jsx)("select",{id:"edit-agent-heartbeat-every",value:O.heartbeat.every,onChange:a=>Q(b=>b?{...b,heartbeat:{...b.heartbeat,every:a.target.value}}:b),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:rL.map(a=>(0,D.jsx)("option",{value:a.value,children:a.label},a.value))})})}):null]}):null,y?(0,D.jsxs)("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:[(0,D.jsx)(s4,{label:"Missing tool behavior",htmlFor:"edit-agent-missing-tools",value:O.policy.missingToolBehavior,options:qx,onChange:a=>Q(b=>b?{...b,policy:{...b.policy,missingToolBehavior:a}}:b)}),(0,D.jsx)(s4,{label:"Install scope",htmlFor:"edit-agent-install-scope",value:O.policy.installScope,options:qy,onChange:a=>Q(b=>b?{...b,policy:{...b.policy,installScope:a}}:b)}),(0,D.jsx)(s4,{label:"File access",htmlFor:"edit-agent-file-access",value:O.policy.fileAccess,options:qz,onChange:a=>Q(b=>b?{...b,policy:{...b.policy,fileAccess:a}}:b)}),(0,D.jsx)(s4,{label:"Network access",htmlFor:"edit-agent-network-access",value:O.policy.networkAccess,options:qA,onChange:a=>Q(b=>b?{...b,policy:{...b.policy,networkAccess:a}}:b)})]}):null]})]}):null,(0,D.jsxs)(d1,{children:[(0,D.jsx)(bq,{variant:"secondary",onClick:()=>x(!1),children:"Cancel"}),(0,D.jsx)(bq,{onClick:aq,disabled:A||!O,children:A?"Saving…":"Save changes"})]})]})})]})}function sX({icon:a,label:b,active:c,onClick:d}){return(0,D.jsx)("button",{type:"button",onClick:d,title:b,className:bc("inline-flex h-11 w-11 items-center justify-center rounded-[16px] border transition-all",c?"border-cyan-300/20 bg-cyan-400 text-slate-950 shadow-[0_12px_28px_rgba(96,165,250,0.35)]":"border-white/10 bg-white/[0.03] text-slate-400 hover:border-white/15 hover:bg-white/[0.08] hover:text-white"),children:(0,D.jsx)(a,{className:"h-4 w-4"})})}function sY({label:a,badge:b,active:c,onClick:d}){return(0,D.jsxs)("button",{type:"button",onClick:d,className:bc("inline-flex items-center gap-2 rounded-full border px-3 py-2 text-[11px] uppercase tracking-[0.18em] transition-all",c?"border-cyan-300/20 bg-cyan-400 text-slate-950 shadow-[0_10px_24px_rgba(96,165,250,0.28)]":"border-white/[0.08] bg-white/[0.03] text-slate-300 hover:bg-white/[0.07] hover:text-white"),children:[(0,D.jsx)("span",{children:a}),b?(0,D.jsx)("span",{className:bc("rounded-full px-1.5 py-0.5 text-[10px] tracking-normal",c?"bg-slate-950/14 text-slate-950":"bg-white/[0.08] text-slate-400"),children:b}):null]})}function sZ({eyebrow:a,title:b,detail:c,action:d}){return(0,D.jsxs)("div",{className:"flex items-end justify-between gap-4",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a}),(0,D.jsx)("h2",{className:"mt-1.5 font-display text-[1.02rem] text-white",children:b}),(0,D.jsx)("p",{className:"mt-1.5 text-[12px] leading-5 text-slate-400",children:c})]}),d?(0,D.jsx)("div",{className:"shrink-0",children:d}):null]})}function s$({label:a,value:b}){return(0,D.jsxs)("div",{className:"rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.88),rgba(7,12,22,0.82))] px-3.5 py-3",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:a}),(0,D.jsx)("p",{className:"mt-1.5 font-display text-[1.2rem] text-white",children:b})]})}function s_({provider:a,disabled:b,onConnect:c}){var d;let e="openai-codex"===a.provider?"Connect ChatGPT":"openrouter"===a.provider?"Add API key":"Connect";return(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] p-4",children:[(0,D.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:s0(a.provider)}),(0,D.jsx)(be,{variant:a.connected?"success":a.canLogin?"warning":"muted",children:a.connected?"connected":a.canLogin?"needs auth":"local"})]}),(0,D.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-slate-400",children:a.detail||("openai-codex"===(d=a.provider)?"Use the OpenClaw OpenAI Codex route. If your ChatGPT plan includes Codex access, connect that account here.":"openrouter"===d?"Paste an API key to unlock OpenRouter-hosted routes.":"ollama"===d?"Local model provider. Pull models locally to make new routes available.":"Connect this provider to make its remote routes available inside AgentOS.")})]})}),(0,D.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[a.canLogin?(0,D.jsx)(bq,{variant:a.connected?"ghost":"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:b,onClick:c,children:e}):null,"openai-codex"===a.provider?(0,D.jsx)(be,{variant:"muted",children:"ChatGPT/Codex route"}):null]})]})}function s0(a){let b=a.trim().toLowerCase();return"openrouter"===b?"OpenRouter":"openai-codex"===b?"OpenAI Codex":"openai"===b?"OpenAI":"anthropic"===b?"Anthropic":"ollama"===b?"Ollama":a.split("-").map(a=>a?a[0].toUpperCase()+a.slice(1):a).join(" ")}function s1({label:a,htmlFor:b,children:c}){return(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)(rK,{htmlFor:b,className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:a}),c]})}function s2({label:a,description:b,active:c,badgeVariant:d,onClick:e}){return(0,D.jsx)("button",{type:"button",onClick:e,className:bc("rounded-[20px] border p-4 text-left transition-colors",c?"border-cyan-300/30 bg-cyan-400/10":"border-white/10 bg-white/[0.03]"),children:(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"space-y-1",children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:a}),(0,D.jsx)("p",{className:"text-xs leading-5 text-slate-400",children:b})]}),(0,D.jsx)(be,{variant:d,children:c?"selected":"preset"})]})})}function s3({policy:a}){let b=qu[a.preset];return(0,D.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-slate-950/50 p-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:"text-sm font-medium text-white",children:b.label}),(0,D.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:b.description})]}),(0,D.jsx)(be,{variant:b.badgeVariant,children:b.label})]}),(0,D.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,D.jsx)(be,{variant:"muted",children:qD(a.missingToolBehavior)}),(0,D.jsx)(be,{variant:"muted",children:qE(a.installScope)}),(0,D.jsx)(be,{variant:"muted",children:qF(a.fileAccess)}),(0,D.jsxs)(be,{variant:"muted",children:["Network ",qG(a.networkAccess)]})]})]})}function s4({label:a,htmlFor:b,value:c,options:d,onChange:e}){return(0,D.jsx)(s1,{label:a,htmlFor:b,children:(0,D.jsx)("select",{id:b,value:c,onChange:a=>e(a.target.value),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:d.map(a=>(0,D.jsxs)("option",{value:a.value,children:[a.label," - ",a.description]},a.value))})})}function s5({agentName:a,onEdit:b,onDelete:c}){let[d,e]=(0,E.useState)(!1),f=(0,E.useRef)(null);return(0,D.jsxs)("div",{className:"relative",ref:f,children:[(0,D.jsx)("button",{type:"button","aria-label":`${a} actions`,onClick:()=>e(a=>!a),className:"inline-flex rounded-full border border-white/[0.08] bg-white/[0.05] p-1.5 text-slate-300 transition-colors hover:bg-white/[0.1] hover:text-white",children:(0,D.jsx)(jH,{className:"h-3.5 w-3.5"})}),d?(0,D.jsxs)("div",{className:"absolute right-0 top-[calc(100%+8px)] z-30 min-w-[136px] rounded-[14px] border border-white/[0.1] bg-slate-950/96 p-1.5 shadow-[0_20px_44px_rgba(0,0,0,0.42)] backdrop-blur-xl",children:[(0,D.jsx)(s6,{label:"Edit",onClick:()=>{e(!1),b()}}),(0,D.jsx)(s6,{label:"Delete",danger:!0,onClick:()=>{e(!1),c()}})]}):null]})}function s6({label:a,onClick:b,danger:c=!1}){return(0,D.jsx)("button",{type:"button",className:bc("flex w-full items-center rounded-[10px] px-2.5 py-2 text-left text-[11px] transition-colors",c?"text-rose-200 hover:bg-rose-400/10 hover:text-rose-100":"text-slate-200 hover:bg-white/[0.06] hover:text-white"),onClick:b,children:(0,D.jsx)("span",{children:a})})}function s7({label:a,value:b,danger:c=!1}){return(0,D.jsxs)("div",{className:bc("rounded-[18px] border px-3.5 py-3",c?"border-amber-300/20 bg-amber-400/[0.08]":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:a}),(0,D.jsx)("p",{className:bc("mt-1.5 font-display text-lg",c?"text-amber-100":"text-white"),children:b})]})}let s8=K("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);function s9({progress:a,className:b}){return(0,D.jsxs)("div",{className:bc("rounded-[18px] border border-white/10 bg-slate-950/50 p-4",b),children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"max-w-2xl",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a.title}),(0,D.jsx)("p",{className:"mt-2 text-sm text-slate-200",children:a.description})]}),(0,D.jsxs)("div",{className:"shrink-0 text-right",children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Progress"}),(0,D.jsxs)("p",{className:"mt-1 text-lg font-semibold text-white",children:[a.percent,"%"]})]})]}),(0,D.jsx)("div",{className:"mt-4 h-2 overflow-hidden rounded-full bg-white/8",children:(0,D.jsx)("div",{className:"h-full rounded-full bg-cyan-300/85 transition-[width] duration-500 ease-out",style:{width:`${a.percent}%`}})}),(0,D.jsx)("div",{className:"mt-4 space-y-2.5",children:a.steps.map((a,b)=>{let c="done"===a.status?"border-emerald-400/20 bg-emerald-400/10":"active"===a.status?"border-cyan-400/25 bg-cyan-400/10":"error"===a.status?"border-amber-400/25 bg-amber-400/10":"border-white/10 bg-white/[0.03]",d="done"===a.status?"border-emerald-300/30 bg-emerald-300/15 text-emerald-100":"active"===a.status?"border-cyan-300/30 bg-cyan-300/15 text-cyan-100":"error"===a.status?"border-amber-300/30 bg-amber-300/15 text-amber-100":"border-white/10 bg-slate-950/65 text-slate-400",e="done"===a.status?"bg-emerald-300/85":"active"===a.status?"bg-cyan-300/85":"error"===a.status?"bg-amber-300/85":"bg-transparent";return(0,D.jsx)("div",{className:bc("rounded-[14px] border px-3 py-2.5 transition-colors",c),children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("span",{className:bc("mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-[10px] font-medium",d),children:"done"===a.status?(0,D.jsx)($,{className:"h-3.5 w-3.5"}):"active"===a.status?(0,D.jsx)(N,{className:"h-3.5 w-3.5 animate-spin"}):"error"===a.status?(0,D.jsx)(P,{className:"h-3.5 w-3.5"}):b+1}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[(0,D.jsx)("p",{className:"text-sm text-white",children:a.label}),(0,D.jsxs)("span",{className:"text-xs tabular-nums text-slate-400",children:[a.percent,"%"]})]}),(0,D.jsx)("p",{className:"mt-0.5 text-xs leading-5 text-slate-400",children:a.detail||a.description}),(0,D.jsx)("div",{className:"mt-2 h-1.5 overflow-hidden rounded-full bg-white/8",children:(0,D.jsx)("div",{className:bc("h-full rounded-full transition-[width] duration-500 ease-out",e),style:{width:`${a.percent}%`}})}),a.activities.length>0?(0,D.jsx)("div",{className:"mt-2.5 space-y-1.5",children:a.activities.map(a=>(0,D.jsxs)("div",{className:"flex items-start gap-2 text-[11px] leading-5 text-slate-300",children:[(0,D.jsx)("span",{className:bc("mt-[7px] h-1.5 w-1.5 shrink-0 rounded-full","done"===a.status&&"bg-emerald-300","active"===a.status&&"bg-cyan-300","error"===a.status&&"bg-amber-300","pending"===a.status&&"bg-slate-500")}),(0,D.jsx)("span",{className:"min-w-0",children:a.message})]},a.id))}):null]})]})},a.id)})})]})}let ta=K("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),tb={software:"Software project",frontend:"Frontend app",backend:"Backend/API",research:"Research",content:"Content/Growth"},tc=["Use repository-local scripts or documented commands for repeatable workflows.","Update this file when the project exposes a cleaner build, test, or release path."];function td(a){let b=tg(a.template,a.rules),c=new Map(tf(a.docOverrides).map(a=>[a.path,a.content]));return b.map(b=>{let d=b.render(a),e=c.has(b.path);return{path:b.path,title:b.title,description:b.description,category:b.category,baseContent:d,content:e?c.get(b.path)??"":d,overridden:e}})}function te(a){let b=td(a).map(a=>({...a,generated:!0})),c=new Set(b.map(a=>a.path));return[...b,...tf(a.docOverrides).filter(a=>!c.has(a.path)).map(a=>{var b;return{path:a.path,title:a.path,description:"Existing workspace file.",category:(b=a.path).startsWith("memory/")?"memory":b.startsWith("docs/")?"docs":b.startsWith("deliverables/")?"deliverables":"core",baseContent:a.content,content:a.content,overridden:!1,generated:!1}})]}function tf(a){let b=new Map;for(let c of a??[]){let a=c.path.trim();a&&b.set(a,c.content)}return Array.from(b.entries()).map(([a,b])=>({path:a,content:b}))}function tg(a,b){let c=[{path:"AGENTS.md",title:"AGENTS.md",description:"Shared operating instructions for all agents.",category:"core",render:th},{path:"SOUL.md",title:"SOUL.md",description:"Purpose, operating style, and active focus.",category:"core",render:({template:a,brief:b})=>{var c,d;return c=a,d=b,`# SOUL
16
+
17
+ ## My Purpose
18
+ Help this ${tb[c].toLowerCase()} workspace turn intent into real outcomes with pragmatic execution, verification, and durable memory.
19
+
20
+ ## How I Operate
21
+ - Start from the current workspace reality before proposing large moves.
22
+ - Prefer concrete action, visible artifacts, and clear handoffs.
23
+ - Keep docs, memory, and deliverables aligned with the actual state of the work.
24
+
25
+ ## My Quirks
26
+ - Pragmatic
27
+ - Direct
28
+ - Product-aware
29
+ - Quality-minded
30
+
31
+ ${d?`## Active Focus
32
+ ${d}
33
+ `:""}`}},{path:"IDENTITY.md",title:"IDENTITY.md",description:"Workspace identity and vibe.",category:"core",render:({template:a})=>{var b;return b=a,`# IDENTITY
34
+
35
+ ## Role
36
+ This workspace hosts a ${tb[b].toLowerCase()} team coordinated through OpenClaw.
37
+
38
+ **Vibe:** pragmatic, concise, quality-minded, workspace-grounded
39
+ `}},{path:"TOOLS.md",title:"TOOLS.md",description:"Repository commands and workflow notes.",category:"core",render:({template:a,toolExamples:b})=>{var c,d;return c=a,d=b??tc,`# TOOLS
40
+
41
+ Repository commands and workflow notes for this ${tb[c].toLowerCase()} workspace.
42
+
43
+ ## Examples
44
+ ${d.map(a=>`- ${a}`).join("\n")}
45
+
46
+ ## Notes
47
+ - Replace these examples with sharper project-specific commands when the repo exposes them.
48
+ - Prefer repeatable commands that other agents can run without interpretation drift.
49
+ `}},{path:"HEARTBEAT.md",title:"HEARTBEAT.md",description:"Refresh ritual and coherence checks.",category:"core",render:({template:a})=>{var b;return b=a,`# HEARTBEAT
50
+
51
+ - Start each substantial task by refreshing the brief, docs, and current files.
52
+ - Keep the ${tb[b].toLowerCase()} workspace coherent across code, docs, and memory.
53
+ - Prefer explicit handoffs between implementation, review, testing, and knowledge capture.
54
+ `}}];return b.generateMemory&&c.push({path:"MEMORY.md",title:"MEMORY.md",description:"Durable project memory.",category:"memory",render:({name:a,template:b,brief:c})=>{var d,e,f;return d=a,e=b,f=c,`# ${d} Memory
55
+
56
+ Durable project facts for this ${tb[e].toLowerCase()} workspace.
57
+
58
+ ## Current brief
59
+ ${f||"No brief captured yet. Fill this in as soon as the project goal is clarified."}
60
+
61
+ ## Stable facts
62
+ - Add durable architecture, product, or workflow facts here.
63
+ - Move longer notes into memory/*.md when they outgrow this file.
64
+ `}},{path:"memory/blueprint.md",title:"memory/blueprint.md",description:"Project blueprint and current outcome.",category:"memory",render:({name:a,template:b,brief:c})=>{var d,e,f;return d=a,e=b,f=c,`# ${d} Blueprint
65
+
66
+ ## Workspace type
67
+ ${tb[e]}
68
+
69
+ ## Outcome
70
+ ${f||"Define the target outcome, user impact, and quality bar for this workspace."}
71
+
72
+ ## Constraints
73
+ - Add technical, product, legal, or operational constraints here.
74
+
75
+ ## Unknowns
76
+ - Capture unresolved questions that block confident execution.
77
+ `}},{path:"memory/decisions.md",title:"memory/decisions.md",description:"Decision log.",category:"memory",render:()=>`# Decisions
78
+
79
+ Use this file for durable decisions that should survive across sessions.
80
+
81
+ ## Template
82
+ - Date:
83
+ - Decision:
84
+ - Context:
85
+ - Consequence:
86
+ `}),b.generateStarterDocs&&c.push({path:"docs/brief.md",title:"docs/brief.md",description:"Objective, source mode, and success signals.",category:"docs",render:({name:a,template:b,brief:c,sourceMode:d})=>{var e,f,g,h;return e=a,f=b,g=c,h=d,`# ${e} Brief
87
+
88
+ ## Template
89
+ ${tb[f]}
90
+
91
+ ## Source mode
92
+ ${h}
93
+
94
+ ## Objective
95
+ ${g||"Clarify the main goal, target user, and success definition for this workspace."}
96
+
97
+ ## Success signals
98
+ - Define what success looks like in observable terms.
99
+
100
+ ## Open questions
101
+ - List the unknowns worth resolving first.
102
+ `}},{path:"docs/architecture.md",title:"docs/architecture.md",description:"Current system shape and dependencies.",category:"docs",render:({template:a})=>{var b;return b=a,`# Architecture
103
+
104
+ ## Current shape
105
+ - Describe the main components, systems, or content lanes in this ${tb[b].toLowerCase()} workspace.
106
+
107
+ ## Dependencies
108
+ - List critical external services, repos, data sources, or channels.
109
+
110
+ ## Risks
111
+ - Capture structural, operational, or delivery risks here.
112
+ `}},{path:"deliverables/README.md",title:"deliverables/README.md",description:"Guidance for handoff artifacts.",category:"deliverables",render:()=>`# Deliverables
113
+
114
+ Use this folder for substantial output artifacts that should be easy to hand off or review.
115
+
116
+ - Create one subfolder per task or run, for example \`deliverables/2026-03-07-15-30-00-launch-brief/\`.
117
+ - Put drafts, reports, docs, and publishable assets for that task inside its run folder.
118
+ - Keep filenames descriptive and tied to the task or audience.
119
+ `}),"frontend"===a&&c.push({path:"docs/ux-notes.md",title:"docs/ux-notes.md",description:"Interaction patterns and UI risks.",category:"docs",render:()=>ti("ux")}),"backend"===a&&c.push({path:"docs/service-map.md",title:"docs/service-map.md",description:"Service, queue, and dependency map.",category:"docs",render:()=>ti("backend")}),"research"===a&&c.push({path:"docs/research-plan.md",title:"docs/research-plan.md",description:"Question framing and evidence plan.",category:"docs",render:()=>ti("research")}),"content"===a&&c.push({path:"docs/content-brief.md",title:"docs/content-brief.md",description:"Audience, channel, and campaign brief.",category:"docs",render:()=>ti("content")}),c}function th({name:a,brief:b,template:c,sourceMode:d,rules:e,agents:f=[]}){let g=f.map(a=>`- ${a.role}: ${a.name}${a.skillId?` \xb7 skill ${a.skillId}`:""}${a.policy?` \xb7 ${qC(a.policy.preset)}`:""}`);return`# ${a}
120
+
121
+ Shared project context for all agents working in this workspace.
122
+
123
+ ## Workspace
124
+ - Template: ${tb[c]}
125
+ - Source mode: ${d}
126
+ - Workspace-only access: ${e.workspaceOnly?"enabled":"disabled"}
127
+
128
+ ## Team
129
+ ${g.length>0?g.join("\n"):"- No agents configured yet."}
130
+
131
+ ## Customize
132
+ ${b||"Clarify the project goal, definition of done, constraints, and success signals before large changes."}
133
+
134
+ ## Safety defaults
135
+ - Stay inside the attached workspace unless the task explicitly requires another location.
136
+ - Prefer direct, reviewable changes over speculative rewrites.
137
+ - Preserve user work and avoid destructive actions without clear approval.
138
+ - Update durable docs when stable architecture, workflow, or product decisions change.
139
+ - Worker and browser agents should not install tooling unless their explicit policy allows it.
140
+ - Route environment preparation to setup-oriented agents when the work depends on new tooling.
141
+
142
+ ## Daily memory
143
+ - Capture durable facts in MEMORY.md and memory/*.md.
144
+ - Record stable decisions in memory/decisions.md.
145
+ - Keep temporary chatter and scratch notes in memory/.
146
+
147
+ ## Output
148
+ - Be concise in chat and write longer output to files when the artifact matters.
149
+ - Put task-specific deliverables, drafts, reports, and docs inside per-run folders under deliverables/.
150
+ - Avoid writing final artifacts to the workspace root unless explicitly requested.
151
+ `}function ti(a){return"ux"===a?`# UX Notes
152
+
153
+ - Track interaction patterns, responsive edge cases, and visual risk areas here.
154
+ `:"backend"===a?`# Service Map
155
+
156
+ - Document services, jobs, queues, external dependencies, and critical flows here.
157
+ `:"research"===a?`# Research Plan
158
+
159
+ - State the question, method, evidence sources, and expected output before large investigation work.
160
+ `:`# Content Brief
161
+
162
+ - Capture audience, channel, tone, CTA, and distribution assumptions for this content workspace.
163
+ `}let tj=[{value:"empty",label:"Empty workspace",description:"Create a fresh project folder and scaffold the shared OpenClaw context."},{value:"clone",label:"Clone repo",description:"Clone a repository first, then layer workspace docs, memory, and agents on top."},{value:"existing",label:"Use existing folder",description:"Attach OpenClaw to a folder that already exists and preserve any current files."}],tk=[{value:"software",label:"Software project",description:"Balanced software delivery setup for product and engineering work."},{value:"frontend",label:"Frontend app",description:"UI-focused team with browser coverage and product-facing documentation."},{value:"backend",label:"Backend/API",description:"Service and API template with strong testing and delivery defaults."},{value:"research",label:"Research",description:"Exploration-first workspace for investigation, synthesis, and durable notes."},{value:"content",label:"Content/Growth",description:"Campaign and content setup for strategy, writing, review, and analytics."}],tl=[{value:"balanced",label:"Balanced",description:"General-purpose default for daily execution, review, and coordination."},{value:"fast",label:"Fast",description:"Favor speed and iteration for high-throughput tasking and first passes."},{value:"quality",label:"Quality",description:"Favor deeper reasoning and more careful outputs for critical work."}],tm={workspaceOnly:!0,generateStarterDocs:!0,generateMemory:!0,kickoffMission:!0},tn={software:[{id:"builder",role:"Builder",name:"Builder",emoji:"\uD83D\uDEE0️",theme:"amber",skillId:"project-builder",isPrimary:!0,description:"Implements requested changes and drives delivery forward."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Reviews work for correctness, regressions, and product risk."},{id:"tester",role:"Tester",name:"Tester",emoji:"\uD83E\uDDEA",theme:"emerald",skillId:"project-tester",description:"Validates behavior, tests, and environment assumptions."},{id:"learner",role:"Learner",name:"Learner",emoji:"\uD83E\uDDE0",theme:"cyan",skillId:"project-learner",description:"Consolidates durable project knowledge and memory."}],frontend:[{id:"builder",role:"Builder",name:"Builder",emoji:"\uD83D\uDEE0️",theme:"amber",skillId:"project-builder",isPrimary:!0,description:"Implements UI and frontend product work."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Reviews interaction, correctness, and regression risk."},{id:"tester",role:"Tester",name:"Tester",emoji:"\uD83E\uDDEA",theme:"emerald",skillId:"project-tester",description:"Checks behavior, responsive states, and verification gaps."},{id:"learner",role:"Learner",name:"Learner",emoji:"\uD83E\uDDE0",theme:"cyan",skillId:"project-learner",description:"Maintains stable product and implementation knowledge."},{id:"browser",role:"Browser Agent",name:"Browser Agent",emoji:"\uD83C\uDF10",theme:"blue",skillId:"project-browser",description:"Exercises browser flows, captures UI evidence, and validates user paths."}],backend:[{id:"builder",role:"Builder",name:"Builder",emoji:"\uD83D\uDEE0️",theme:"amber",skillId:"project-builder",isPrimary:!0,description:"Implements service, API, and infrastructure changes."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Catches correctness, data handling, and operational risks."},{id:"tester",role:"Tester",name:"Tester",emoji:"\uD83E\uDDEA",theme:"emerald",skillId:"project-tester",description:"Validates APIs, background jobs, migrations, and failure paths."},{id:"learner",role:"Learner",name:"Learner",emoji:"\uD83E\uDDE0",theme:"cyan",skillId:"project-learner",description:"Maintains architecture notes and durable operational memory."}],research:[{id:"researcher",role:"Research Lead",name:"Research Lead",emoji:"\uD83D\uDD2C",theme:"violet",skillId:"project-researcher",isPrimary:!0,description:"Runs investigations, frames questions, and synthesizes findings."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Pressure-tests claims, assumptions, and interpretation quality."},{id:"learner",role:"Archivist",name:"Archivist",emoji:"\uD83E\uDDE0",theme:"cyan",skillId:"project-learner",description:"Distills durable research notes, memory, and takeaways."}],content:[{id:"strategist",role:"Strategist",name:"Strategist",emoji:"\uD83D\uDCE3",theme:"orange",skillId:"project-strategist",isPrimary:!0,description:"Frames audience, goals, positioning, and campaign direction."},{id:"writer",role:"Writer",name:"Writer",emoji:"✍️",theme:"sky",skillId:"project-writer",description:"Drafts content, messaging, and campaign assets."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Edits for clarity, quality, and consistency."},{id:"analyst",role:"Analyst",name:"Analyst",emoji:"\uD83D\uDCC8",theme:"emerald",skillId:"project-analyst",description:"Tracks results, experiments, and performance insights."}]};function to(a,b,c){let d=function(a){let b=a?.trim();if(!b)return"";let c=(!/\s/.test(b)&&b.includes(".")?b.split(".")[0]:b).replace(/[^A-Za-z0-9\u00C0-\u024F]+/g," ").trim();return c?c.split(/\s+/).filter(Boolean).map(a=>a[0].toUpperCase()+a.slice(1)).join(" "):""}(a);if(!d)return c;let e=b.trim();return e?`${d} ${e}`:d}function tp(a,b){return tg(a,b).map(a=>a.path)}function tq({open:a,surfaceTheme:b,plan:c,focus:d,busy:e=!1,onClose:f,onSave:g}){var h;let[i,j]=(0,E.useState)(()=>"raw"===d?"raw":"fields"),[k,l]=(0,E.useState)(()=>{var a;return c?{companyName:(a=c).company.name,companyMission:a.company.mission,companyTargetCustomer:a.company.targetCustomer,companyConstraints:ts(a.company.constraints),companySuccessSignals:ts(a.company.successSignals),productOffer:a.product.offer,productRevenueModel:a.product.revenueModel,productScopeV1:ts(a.product.scopeV1),productNonGoals:ts(a.product.nonGoals),productLaunchPriority:ts(a.product.launchPriority),workspaceName:a.workspace.name,workspaceDirectory:a.workspace.directory??"",workspaceSourceMode:a.workspace.sourceMode,workspaceRepoUrl:a.workspace.repoUrl??"",workspaceExistingPath:a.workspace.existingPath??"",workspaceTemplate:a.workspace.template,workspaceModelProfile:a.workspace.modelProfile,workspaceModelId:a.workspace.modelId??"",workspaceStackDecisions:ts(a.workspace.stackDecisions),workspaceDocs:ts(a.workspace.docs),workspaceRuleGenerateStarterDocs:a.workspace.rules.generateStarterDocs,workspaceRuleGenerateMemory:a.workspace.rules.generateMemory,workspaceRuleKickoffMission:a.workspace.rules.kickoffMission,intakeReviewRequested:a.intake.reviewRequested,intakeAutopilot:a.autopilot,teamAllowEphemeralSubagents:a.team.allowEphemeralSubagents,teamMaxParallelRuns:String(a.team.maxParallelRuns),teamEscalationRules:ts(a.team.escalationRules),deployBlockers:ts(a.deploy.blockers),deployWarnings:ts(a.deploy.warnings),deployFirstMissions:ts(a.deploy.firstMissions)}:null}),[m,n]=(0,E.useState)(()=>c?JSON.stringify(c,null,2):""),[o,p]=(0,E.useState)(null),q=(0,E.useRef)({}),r=(0,E.useRef)({}),s="light"===b,t=d&&"raw"!==d?function(a){if("raw"===a)return"workspace";let[b]=a.split(".");return b}(d):null,u=d&&"raw"!==d&&(h=d).includes(".")?h:null,v=!!(c&&k);if(!a||!c||!k)return null;let w=(a,b)=>{l(c=>c?{...c,[a]:b}:c)},x=a=>b=>{r.current[a]=b},y=async()=>{var a,b,d,e;let h,i,j,l,m,n,o,p,q=(a=c,b=k,h=structuredClone(a),i=a.company.name.trim(),j=a.workspace.name.trim(),l=b.companyName.trim(),m=b.workspaceName.trim(),n=l!==i,o=m!==j,h.company.name=l,h.company.mission=b.companyMission.trim(),h.company.targetCustomer=b.companyTargetCustomer.trim(),h.company.constraints=tt(b.companyConstraints),h.company.successSignals=tt(b.companySuccessSignals),h.product.offer=b.productOffer.trim(),h.product.revenueModel=b.productRevenueModel.trim(),h.product.scopeV1=tt(b.productScopeV1),h.product.nonGoals=tt(b.productNonGoals),h.product.launchPriority=tt(b.productLaunchPriority),h.workspace.name=m,h.workspace.directory=tu(b.workspaceDirectory),h.workspace.sourceMode=b.workspaceSourceMode,h.workspace.repoUrl=tu(b.workspaceRepoUrl),h.workspace.existingPath=tu(b.workspaceExistingPath),h.workspace.template=b.workspaceTemplate,h.workspace.modelProfile=b.workspaceModelProfile,h.workspace.modelId=tu(b.workspaceModelId),h.workspace.stackDecisions=tt(b.workspaceStackDecisions),h.workspace.docs=tt(b.workspaceDocs),h.workspace.rules={...h.workspace.rules,workspaceOnly:!0,generateStarterDocs:b.workspaceRuleGenerateStarterDocs,generateMemory:b.workspaceRuleGenerateMemory,kickoffMission:b.workspaceRuleKickoffMission},o&&!n?h.company.name=m:n&&!o&&(h.workspace.name=l),h.team.allowEphemeralSubagents=b.teamAllowEphemeralSubagents,h.team.maxParallelRuns=Number.isFinite(Number(b.teamMaxParallelRuns))?Math.max(1,Number(b.teamMaxParallelRuns)):h.team.maxParallelRuns,h.team.escalationRules=tt(b.teamEscalationRules),h.intake.reviewRequested=b.intakeReviewRequested,h.autopilot=b.intakeAutopilot,h.deploy.blockers=tt(b.deployBlockers),h.deploy.warnings=tt(b.deployWarnings),h.deploy.firstMissions=tt(b.deployFirstMissions),h),r=(d=c,e=q,p=[],(tr(d.company,e.company)&&p.push("company"),tr(d.product,e.product)&&p.push("product"),tr(d.workspace,e.workspace)&&p.push("workspace"),tr(d.team,e.team)&&p.push("team"),tr({reviewRequested:d.intake.reviewRequested,autopilot:d.autopilot},{reviewRequested:e.intake.reviewRequested,autopilot:e.autopilot})&&p.push("intake"),tr(d.deploy,e.deploy)&&p.push("deploy"),0===p.length)?"Manual blueprint edit applied.":`Manual blueprint edit applied to ${p.join(", ")}.`);await g(q,r)&&f()},z=async()=>{try{let a=JSON.parse(m);await g(a,"Manual raw blueprint edit applied.")&&f()}catch(a){p(a instanceof Error?a.message:"Raw JSON could not be parsed.")}};return(0,D.jsxs)("div",{className:"absolute inset-0 z-30",children:[(0,D.jsx)("button",{type:"button","aria-label":"Close blueprint editor",onClick:f,className:bc("absolute inset-0 h-full w-full cursor-default",s?"bg-[rgba(17,14,10,0.26)]":"bg-[rgba(2,6,13,0.56)]")}),(0,D.jsxs)("div",{className:bc("absolute inset-y-0 right-0 flex h-full w-full flex-col border-l shadow-[0_34px_120px_rgba(0,0,0,0.35)] lg:max-w-[760px]",s?"border-[#e6ded4] bg-[linear-gradient(180deg,rgba(255,253,249,0.98),rgba(247,241,233,0.98))] text-[#151311]":"border-white/10 bg-[linear-gradient(180deg,rgba(5,9,18,0.98),rgba(3,7,15,0.98))] text-white"),onClick:a=>a.stopPropagation(),children:[(0,D.jsxs)("div",{className:bc("flex items-start justify-between gap-4 border-b px-4 py-4 md:px-5",s?"border-[#e7dfd4]":"border-white/10"),children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:bc("text-[11px] uppercase tracking-[0.18em]",s?"text-[#9a9085]":"text-slate-500"),children:"Blueprint editor"}),(0,D.jsx)("h2",{className:bc("mt-1 text-[18px] font-semibold tracking-[-0.03em]",s?"text-[#171410]":"text-white"),children:"Edit any detail, then keep chatting with Architect"}),(0,D.jsx)("p",{className:bc("mt-1 text-[13px] leading-6",s?"text-[#6f675e]":"text-slate-300"),children:"Structured fields cover the common edits. Raw JSON lets you change anything else in the same plan."})]}),(0,D.jsx)("button",{type:"button",onClick:f,className:bc("inline-flex size-9 shrink-0 items-center justify-center rounded-full border transition-colors",s?"border-[#e3dbd0] bg-white text-[#5d564d] hover:bg-[#f5efe6]":"border-white/10 bg-white/[0.05] text-slate-300 hover:bg-white/[0.08]"),children:(0,D.jsx)(dZ,{className:"h-4 w-4"})})]}),(0,D.jsxs)("div",{className:bc("flex items-center gap-2 border-b px-4 py-3 md:px-5",s?"border-[#e7dfd4]":"border-white/10"),children:[(0,D.jsx)(tv,{surfaceTheme:b,label:`Stage \xb7 ${c.stage}`}),(0,D.jsx)(tv,{surfaceTheme:b,label:`Status \xb7 ${c.status}`}),(0,D.jsx)(tv,{surfaceTheme:b,label:`Readiness \xb7 ${c.readinessScore}%`})]}),(0,D.jsxs)(b7,{value:i,onValueChange:a=>j(a),className:"flex min-h-0 flex-1 flex-col px-4 py-4 md:px-5",children:[(0,D.jsxs)(cg,{className:bc("w-fit",s?"bg-[#f2ece4] text-[#645b52]":"bg-white/5"),children:[(0,D.jsx)(ch,{value:"fields",children:"Fields"}),(0,D.jsx)(ch,{value:"raw",children:"Raw JSON"})]}),(0,D.jsx)(ci,{value:"fields",className:"min-h-0 flex-1",children:(0,D.jsx)(qs,{className:"h-full pr-1",children:(0,D.jsxs)("div",{className:"space-y-4 pb-4",children:[(0,D.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,D.jsxs)(tw,{surfaceTheme:b,sectionId:"company",highlighted:"company"===t,title:"Company",description:"Mission and audience details.",register:a=>{q.current.company=a},children:[(0,D.jsx)(tx,{label:"Name",children:(0,D.jsx)(br,{ref:x("company.name"),value:k.companyName,onChange:a=>w("companyName",a.target.value)})}),(0,D.jsx)(tx,{label:"Mission",children:(0,D.jsx)(rV,{ref:x("company.mission"),value:k.companyMission,onChange:a=>w("companyMission",a.target.value),className:"min-h-[96px]"})}),(0,D.jsx)(tx,{label:"Target customer",children:(0,D.jsx)(br,{ref:x("company.targetCustomer"),value:k.companyTargetCustomer,onChange:a=>w("companyTargetCustomer",a.target.value)})}),(0,D.jsx)(tx,{label:"Constraints",children:(0,D.jsx)(rV,{ref:x("company.constraints"),value:k.companyConstraints,onChange:a=>w("companyConstraints",a.target.value),placeholder:"One constraint per line",className:"min-h-[84px]"})}),(0,D.jsx)(tx,{label:"Success signals",children:(0,D.jsx)(rV,{ref:x("company.successSignals"),value:k.companySuccessSignals,onChange:a=>w("companySuccessSignals",a.target.value),placeholder:"One signal per line",className:"min-h-[84px]"})})]}),(0,D.jsxs)(tw,{surfaceTheme:b,sectionId:"product",highlighted:"product"===t,title:"Product",description:"Offer and V1 shape.",register:a=>{q.current.product=a},children:[(0,D.jsx)(tx,{label:"Offer",children:(0,D.jsx)(rV,{ref:x("product.offer"),value:k.productOffer,onChange:a=>w("productOffer",a.target.value),className:"min-h-[96px]"})}),(0,D.jsx)(tx,{label:"Revenue model",children:(0,D.jsx)(br,{ref:x("product.revenueModel"),value:k.productRevenueModel,onChange:a=>w("productRevenueModel",a.target.value)})}),(0,D.jsx)(tx,{label:"Scope V1",children:(0,D.jsx)(rV,{ref:x("product.scopeV1"),value:k.productScopeV1,onChange:a=>w("productScopeV1",a.target.value),placeholder:"One item per line",className:"min-h-[84px]"})}),(0,D.jsx)(tx,{label:"Non-goals",children:(0,D.jsx)(rV,{ref:x("product.nonGoals"),value:k.productNonGoals,onChange:a=>w("productNonGoals",a.target.value),placeholder:"One item per line",className:"min-h-[84px]"})}),(0,D.jsx)(tx,{label:"Launch priority",children:(0,D.jsx)(rV,{ref:x("product.launchPriority"),value:k.productLaunchPriority,onChange:a=>w("productLaunchPriority",a.target.value),placeholder:"One item per line",className:"min-h-[84px]"})})]})]}),(0,D.jsxs)(tw,{surfaceTheme:b,sectionId:"workspace",highlighted:"workspace"===t,title:"Workspace",description:"Provisioning path and bootstrap rules.",register:a=>{q.current.workspace=a},children:[(0,D.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,D.jsx)(tx,{label:"Workspace name",children:(0,D.jsx)(br,{ref:x("workspace.name"),value:k.workspaceName,onChange:a=>w("workspaceName",a.target.value)})}),(0,D.jsx)(tx,{label:"Workspace directory",children:(0,D.jsx)(br,{ref:x("workspace.directory"),value:k.workspaceDirectory,onChange:a=>w("workspaceDirectory",a.target.value)})}),(0,D.jsx)(tx,{label:"Repository URL",children:(0,D.jsx)(br,{ref:x("workspace.repoUrl"),value:k.workspaceRepoUrl,onChange:a=>w("workspaceRepoUrl",a.target.value)})}),(0,D.jsx)(tx,{label:"Existing folder path",children:(0,D.jsx)(br,{ref:x("workspace.existingPath"),value:k.workspaceExistingPath,onChange:a=>w("workspaceExistingPath",a.target.value)})}),(0,D.jsx)(tx,{label:"Model id",children:(0,D.jsx)(br,{ref:x("workspace.modelId"),value:k.workspaceModelId,onChange:a=>w("workspaceModelId",a.target.value)})})]}),(0,D.jsx)(ty,{surfaceTheme:b,label:"Source mode",value:k.workspaceSourceMode,options:tj,onChange:a=>w("workspaceSourceMode",a),fieldRef:x("workspace.sourceMode"),highlighted:"workspace.sourceMode"===u}),(0,D.jsx)(ty,{surfaceTheme:b,label:"Template",value:k.workspaceTemplate,options:tk,onChange:a=>w("workspaceTemplate",a),fieldRef:x("workspace.template"),highlighted:"workspace.template"===u}),(0,D.jsx)(ty,{surfaceTheme:b,label:"Model profile",value:k.workspaceModelProfile,options:tl,onChange:a=>w("workspaceModelProfile",a),fieldRef:x("workspace.modelProfile"),highlighted:"workspace.modelProfile"===u}),(0,D.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,D.jsx)(tx,{label:"Stack decisions",children:(0,D.jsx)(rV,{ref:x("workspace.stackDecisions"),value:k.workspaceStackDecisions,onChange:a=>w("workspaceStackDecisions",a.target.value),placeholder:"One item per line",className:"min-h-[84px]"})}),(0,D.jsx)(tx,{label:"Docs",children:(0,D.jsx)(rV,{ref:x("workspace.docs"),value:k.workspaceDocs,onChange:a=>w("workspaceDocs",a.target.value),placeholder:"One item per line",className:"min-h-[84px]"})})]}),(0,D.jsx)(tz,{surfaceTheme:b,label:"Starter docs",description:"Generate the first brief, architecture, and deliverables scaffold.",checked:k.workspaceRuleGenerateStarterDocs,onToggle:()=>w("workspaceRuleGenerateStarterDocs",!k.workspaceRuleGenerateStarterDocs),fieldRef:x("workspace.ruleGenerateStarterDocs"),highlighted:"workspace.ruleGenerateStarterDocs"===u}),(0,D.jsx)(tz,{surfaceTheme:b,label:"Memory",description:"Generate the persistent memory files for blueprint decisions.",checked:k.workspaceRuleGenerateMemory,onToggle:()=>w("workspaceRuleGenerateMemory",!k.workspaceRuleGenerateMemory),fieldRef:x("workspace.ruleGenerateMemory"),highlighted:"workspace.ruleGenerateMemory"===u}),(0,D.jsx)(tz,{surfaceTheme:b,label:"Kickoff mission",description:"Run the first mission immediately after bootstrap.",checked:k.workspaceRuleKickoffMission,onToggle:()=>w("workspaceRuleKickoffMission",!k.workspaceRuleKickoffMission),fieldRef:x("workspace.ruleKickoffMission"),highlighted:"workspace.ruleKickoffMission"===u})]}),(0,D.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,D.jsxs)(tw,{surfaceTheme:b,sectionId:"team",highlighted:"team"===t,title:"Team",description:"Planner behavior and coordination rules.",register:a=>{q.current.team=a},children:[(0,D.jsx)(tz,{surfaceTheme:b,label:"Allow ephemeral subagents",description:"Let the planner spin up temporary helpers when useful.",checked:k.teamAllowEphemeralSubagents,onToggle:()=>w("teamAllowEphemeralSubagents",!k.teamAllowEphemeralSubagents),fieldRef:x("team.allowEphemeralSubagents"),highlighted:"team.allowEphemeralSubagents"===u}),(0,D.jsx)(tz,{surfaceTheme:b,label:"Autopilot",description:"Let the planner take a stronger lead when the shape is clear.",checked:k.intakeAutopilot,onToggle:()=>w("intakeAutopilot",!k.intakeAutopilot),fieldRef:x("team.autopilot"),highlighted:"team.autopilot"===u}),(0,D.jsx)(tz,{surfaceTheme:b,label:"Review requested",description:"Keep the planner in a review-heavy shaping mode.",checked:k.intakeReviewRequested,onToggle:()=>w("intakeReviewRequested",!k.intakeReviewRequested),fieldRef:x("team.reviewRequested"),highlighted:"team.reviewRequested"===u}),(0,D.jsx)(tx,{label:"Max parallel runs",children:(0,D.jsx)(br,{ref:x("team.maxParallelRuns"),type:"number",min:1,value:k.teamMaxParallelRuns,onChange:a=>w("teamMaxParallelRuns",a.target.value)})}),(0,D.jsx)(tx,{label:"Escalation rules",children:(0,D.jsx)(rV,{ref:x("team.escalationRules"),value:k.teamEscalationRules,onChange:a=>w("teamEscalationRules",a.target.value),placeholder:"One rule per line",className:"min-h-[84px]"})})]}),(0,D.jsxs)(tw,{surfaceTheme:b,sectionId:"deploy",highlighted:"deploy"===t,title:"Deploy",description:"Review blockers, warnings, and first missions.",register:a=>{q.current.deploy=a},children:[(0,D.jsx)(tx,{label:"Blockers",children:(0,D.jsx)(rV,{ref:x("deploy.blockers"),value:k.deployBlockers,onChange:a=>w("deployBlockers",a.target.value),placeholder:"One blocker per line",className:"min-h-[84px]"})}),(0,D.jsx)(tx,{label:"Warnings",children:(0,D.jsx)(rV,{ref:x("deploy.warnings"),value:k.deployWarnings,onChange:a=>w("deployWarnings",a.target.value),placeholder:"One warning per line",className:"min-h-[84px]"})}),(0,D.jsx)(tx,{label:"First missions",children:(0,D.jsx)(rV,{ref:x("deploy.firstMissions"),value:k.deployFirstMissions,onChange:a=>w("deployFirstMissions",a.target.value),placeholder:"One mission per line",className:"min-h-[84px]"})})]}),(0,D.jsxs)(tw,{surfaceTheme:b,title:"Note",description:"What happens on save?",children:[(0,D.jsx)("p",{className:bc("text-[13px] leading-6",s?"text-[#6f675e]":"text-slate-300"),children:"Derived plan fields like readiness score, stage, and recommended missions are recalculated after you save."}),(0,D.jsx)("p",{className:bc("mt-3 text-[13px] leading-6",s?"text-[#6f675e]":"text-slate-300"),children:"If you want to edit something that is not shown here, switch to Raw JSON and change the exact nested field."})]})]})]})})}),(0,D.jsx)(ci,{value:"raw",className:"min-h-0 flex-1",children:(0,D.jsxs)("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[(0,D.jsx)("div",{className:bc("rounded-[18px] border px-4 py-3",s?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,D.jsx)("p",{className:bc("text-[13px] leading-6",s?"text-[#6f675e]":"text-slate-300"),children:"This view edits the full blueprint JSON. It is the fastest way to change nested fields, agents, workflows, and any other detail."})}),(0,D.jsx)(rV,{value:m,onChange:a=>{n(a.target.value),p(null)},className:bc("min-h-0 flex-1 font-mono text-[12px] leading-5",s?"border-[#dcd4c9] bg-white text-[#1a1714]":"border-white/10 bg-[#03060d] text-slate-100")}),o?(0,D.jsx)("p",{className:"rounded-xl border border-rose-300/30 bg-rose-500/10 px-3 py-2 text-[13px] leading-5 text-rose-200",children:o}):null,(0,D.jsx)("p",{className:bc("text-[12px] leading-5",s?"text-[#7b7268]":"text-slate-400"),children:"Current draft JSON snapshot loaded on open. Changes are saved through the same planner draft path as the structured editor."})]})})]}),(0,D.jsxs)("div",{className:bc("flex items-center justify-between gap-3 border-t px-4 py-4 md:px-5",s?"border-[#e7dfd4]":"border-white/10"),children:[(0,D.jsx)(bq,{type:"button",variant:"secondary",onClick:f,className:s?"rounded-full border-[#ddd6cb] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",children:"Cancel"}),(0,D.jsxs)(bq,{type:"button",onClick:"raw"===i?z:y,disabled:!v||e,className:s?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",children:[e?(0,D.jsx)(N,{className:"mr-2 h-4 w-4 animate-spin"}):(0,D.jsx)(ta,{className:"mr-2 h-4 w-4"}),"Apply changes"]})]})]})]})}function tr(a,b){return JSON.stringify(a)!==JSON.stringify(b)}function ts(a){return a.join("\n")}function tt(a){return a.split(/\r?\n/).map(a=>a.trim()).filter(Boolean)}function tu(a){let b=a.trim();return b.length>0?b:void 0}function tv({surfaceTheme:a,label:b}){return(0,D.jsx)("span",{className:bc("inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-[0.16em]","light"===a?"border-[#e4ddd3] bg-[#f7f2eb] text-[#746b61]":"border-white/10 bg-white/[0.05] text-slate-300"),children:b})}function tw({surfaceTheme:a,sectionId:b,highlighted:c=!1,title:d,description:e,register:f,children:g}){let h="light"===a;return(0,D.jsxs)("section",{ref:f,"data-blueprint-section":b,className:bc("rounded-[22px] border p-4 transition-all duration-300",h?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]",c&&(h?"ring-2 ring-[#d8b184]/70 shadow-[0_0_0_1px_rgba(216,177,132,0.18),0_18px_36px_rgba(102,78,47,0.16)]":"ring-2 ring-cyan-300/45 shadow-[0_0_0_1px_rgba(103,232,249,0.14),0_18px_36px_rgba(6,182,212,0.16)]")),children:[(0,D.jsxs)("div",{className:"mb-4",children:[(0,D.jsx)("p",{className:bc("text-[11px] uppercase tracking-[0.18em]",h?"text-[#a0978b]":"text-slate-500"),children:d}),(0,D.jsx)("p",{className:bc("mt-1 text-[13px] leading-6",h?"text-[#6f675e]":"text-slate-300"),children:e})]}),(0,D.jsx)("div",{className:"space-y-4",children:g})]})}function tx({label:a,children:b}){return(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)(rK,{children:a}),b]})}function ty({surfaceTheme:a,label:b,value:c,options:d,onChange:e,fieldRef:f,highlighted:g=!1}){let h="light"===a;return(0,D.jsxs)("div",{ref:f,tabIndex:-1,className:bc("space-y-2 rounded-[18px] border p-3 transition-all",h?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]",g&&(h?"ring-2 ring-[#d8b184]/60 shadow-[0_0_0_1px_rgba(216,177,132,0.12)]":"ring-2 ring-cyan-300/30 shadow-[0_0_0_1px_rgba(103,232,249,0.12)]")),children:[(0,D.jsx)(rK,{children:b}),(0,D.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:d.map(a=>{let b=a.value===c;return(0,D.jsx)("button",{type:"button",onClick:()=>e(a.value),className:bc("rounded-[16px] border px-3 py-3 text-left transition-colors",b?h?"border-[#161514] bg-[#161514] text-white":"border-cyan-300 bg-cyan-300/15 text-cyan-50":h?"border-[#e7dfd4] bg-[#faf6f1] text-[#171410] hover:border-[#d6cab9] hover:bg-[#f6efe6]":"border-white/10 bg-white/[0.03] text-slate-100 hover:border-white/15 hover:bg-white/[0.05]"),children:(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"text-[13px] font-medium",children:a.label}),(0,D.jsx)("p",{className:bc("mt-1 text-[12px] leading-5",b?"opacity-80":h?"text-[#70685e]":"text-slate-400"),children:a.description})]}),b?(0,D.jsx)($,{className:"mt-0.5 h-4 w-4 shrink-0"}):null]})},a.value)})})]})}function tz({surfaceTheme:a,label:b,description:c,checked:d,onToggle:e,fieldRef:f,highlighted:g=!1}){let h="light"===a;return(0,D.jsx)("button",{type:"button",onClick:e,ref:f,className:bc("w-full rounded-[16px] border px-3 py-3 text-left transition-colors",d?h?"border-[#1f1b17] bg-[#1f1b17] text-white":"border-cyan-300 bg-cyan-300/15 text-cyan-50":h?"border-[#e7dfd4] bg-[#faf6f1] text-[#171410] hover:border-[#d6cab9] hover:bg-[#f6efe6]":"border-white/10 bg-white/[0.03] text-slate-100 hover:border-white/15 hover:bg-white/[0.05]",g&&(h?"ring-2 ring-[#d8b184]/60 shadow-[0_0_0_1px_rgba(216,177,132,0.12)]":"ring-2 ring-cyan-300/30 shadow-[0_0_0_1px_rgba(103,232,249,0.12)]")),children:(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"text-[13px] font-medium",children:b}),(0,D.jsx)("p",{className:bc("mt-1 text-[12px] leading-5",d?"opacity-80":h?"text-[#70685e]":"text-slate-400"),children:c})]}),(0,D.jsx)("span",{className:bc("mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-full border",d?h?"border-white/25 bg-white text-[#171410]":"border-white/20 bg-white text-slate-950":h?"border-[#cfc6ba] bg-transparent text-transparent":"border-white/15 bg-transparent text-transparent"),children:(0,D.jsx)($,{className:"h-3 w-3"})})]})})}function tA({open:a,surfaceTheme:b,plan:c,path:d,busy:e=!1,rewriteBusy:f=!1,onClose:g,onSave:h,onRewriteWithArchitect:i}){let j="light"===b,k=(0,E.useMemo)(()=>a&&c?te({name:c.workspace.name||"Workspace",brief:c.company.mission||c.product.offer||void 0,template:c.workspace.template,sourceMode:c.workspace.sourceMode,rules:c.workspace.rules,agents:c.team.persistentAgents.filter(a=>a.enabled),docOverrides:c.workspace.docOverrides,toolExamples:[]}).find(a=>a.path===d)??null:null,[a,d,c]),[l,m]=(0,E.useState)(()=>k?.content??""),[n,o]=(0,E.useState)(""),[p,q]=(0,E.useState)(null),r=e||f||!!p;if(!a||!c||!k)return null;let s=async()=>{let a=await i({path:k.path,currentContent:l,instruction:n.trim()||void 0});if(!a)return;let b=function(a,b){if(a===b)return null;let c=a.split(/\r?\n/),d=b.split(/\r?\n/),e=0;for(;e<c.length&&e<d.length&&c[e]===d[e];)e+=1;let f=0;for(;f<c.length-e&&f<d.length-e&&c[c.length-1-f]===d[d.length-1-f];)f+=1;let g=d.slice(0,e),h=c.slice(e,c.length-f),i=d.slice(e,d.length-f),j=d.slice(d.length-f),k=i.join("\n"),l=Array.from(k).length;return{prefixLines:g,changedFromLines:h,changedToLines:i,suffixLines:j,changedToText:k,changedToCharCount:l,revealedCharCount:0,nextContent:b}}(l,a);if(!b){m(a),o("");return}q(b),o("")},t=async()=>{let a=structuredClone(c),b=tf([...a.workspace.docOverrides.filter(a=>a.path!==k.path),...l===k.baseContent?[]:[{path:k.path,content:l}]]);a.workspace.docOverrides=b;let d=l===k.baseContent?k.generated?`Reset ${k.path} to the generated default scaffold.`:`Kept ${k.path} at the loaded workspace content.`:k.generated?`Updated ${k.path} scaffold content.`:`Updated ${k.path} existing file content.`;await h(a,d)&&g()};return(0,D.jsxs)("div",{className:"absolute inset-0 z-30",children:[(0,D.jsx)("button",{type:"button","aria-label":"Close document editor",onClick:g,className:bc("absolute inset-0 h-full w-full cursor-default",j?"bg-[rgba(17,14,10,0.26)]":"bg-[rgba(2,6,13,0.56)]")}),(0,D.jsxs)("div",{className:bc("absolute inset-y-0 right-0 flex h-full w-full flex-col border-l shadow-[0_34px_120px_rgba(0,0,0,0.35)] lg:max-w-[860px]",j?"border-[#e6ded4] bg-[linear-gradient(180deg,rgba(255,253,249,0.98),rgba(247,241,233,0.98))] text-[#151311]":"border-white/10 bg-[linear-gradient(180deg,rgba(5,9,18,0.98),rgba(3,7,15,0.98))] text-white"),onClick:a=>a.stopPropagation(),children:[(0,D.jsxs)("div",{className:bc("flex items-center justify-between gap-4 border-b px-4 py-3 md:px-5",j?"border-[#e7dfd4]":"border-white/10"),children:[(0,D.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,D.jsx)("p",{className:bc("text-[11px] uppercase tracking-[0.18em]",j?"text-[#9a9085]":"text-slate-500"),children:"Document editor"}),(0,D.jsx)("span",{className:bc("text-[11px] uppercase tracking-[0.18em]",j?"text-[#c2b6a5]":"text-slate-600"),children:"/"}),(0,D.jsx)("p",{className:bc("truncate font-mono text-[12px]",j?"text-[#4a433b]":"text-slate-300"),children:k.path}),(0,D.jsx)("span",{className:bc("inline-flex shrink-0 items-center rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",k.generated?k.overridden?j?"border-emerald-200 bg-emerald-50 text-emerald-900":"border-emerald-300/30 bg-emerald-300/12 text-emerald-100":j?"border-[#e0d7cc] bg-white text-[#7a7168]":"border-white/10 bg-white/[0.05] text-slate-400":j?"border-cyan-200 bg-cyan-50 text-cyan-900":"border-cyan-300/25 bg-cyan-300/12 text-cyan-100"),children:k.generated?k.overridden?"Customized":"Generated":"Existing"})]}),(0,D.jsx)("button",{type:"button",onClick:g,className:bc("inline-flex size-9 shrink-0 items-center justify-center rounded-full border transition-colors",j?"border-[#e3dbd0] bg-white text-[#5d564d] hover:bg-[#f5efe6]":"border-white/10 bg-white/[0.05] text-slate-300 hover:bg-white/[0.08]"),children:(0,D.jsx)(dZ,{className:"h-4 w-4"})})]}),(0,D.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-3 px-4 py-3 md:px-5",children:[(0,D.jsx)(qs,{className:"min-h-0 flex-1",children:p?(0,D.jsx)(tB,{surfaceTheme:b,animation:p}):(0,D.jsx)(rV,{value:l,onChange:a=>m(a.target.value),className:bc("min-h-[60vh] font-mono text-[12px] leading-5",j?"border-[#dcd4c9] bg-white text-[#1a1714]":"border-white/10 bg-[#03060d] text-slate-100"),disabled:r})}),(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t pt-2",style:{borderColor:j?"#e7dfd4":"rgba(255,255,255,0.1)"},children:[(0,D.jsx)(bq,{type:"button",variant:"secondary",onClick:()=>{m(k.baseContent)},disabled:r,className:j?"rounded-full border-[#ddd6cb] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",children:k.generated?"Reset to default":"Reset to loaded content"}),(0,D.jsxs)(bq,{type:"button",onClick:t,disabled:r,className:j?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",children:[e?(0,D.jsx)(N,{className:"mr-2 h-4 w-4 animate-spin"}):(0,D.jsx)(ta,{className:"mr-2 h-4 w-4"}),"Apply changes"]})]}),(0,D.jsx)("div",{className:bc("rounded-[18px] border px-4 py-3",j?"border-[#e5ded3] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,D.jsxs)("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr),auto] md:items-end",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("label",{htmlFor:"architect-rewrite-prompt",className:bc("text-[11px] uppercase tracking-[0.18em]",j?"text-[#8b8278]":"text-slate-400"),children:"Architect instructions"}),(0,D.jsx)(rV,{id:"architect-rewrite-prompt",value:n,onChange:a=>o(a.target.value),placeholder:"Tell Architect what to rewrite in this document.",className:bc("mt-2 min-h-[88px] font-sans text-[13px] leading-6",j?"border-[#dcd4c9] bg-white text-[#1a1714]":"border-white/10 bg-[#03060d] text-slate-100"),disabled:r}),(0,D.jsx)("p",{className:bc("mt-2 text-[12px] leading-5",j?"text-[#7b7268]":"text-slate-400"),children:"Leave it blank for a general pass. Architect will rewrite only the changed block and keep the rest intact."})]}),(0,D.jsxs)(bq,{type:"button",variant:"secondary",onClick:s,disabled:r,className:j?"rounded-full border-[#d8d0c4] bg-[#f8f3eb] text-[#3f3831] hover:bg-[#f1ebe4]":"rounded-full border-cyan-300/20 bg-cyan-300/10 text-cyan-100 hover:bg-cyan-300/16",children:[f?(0,D.jsx)(N,{className:"mr-2 h-4 w-4 animate-spin"}):(0,D.jsx)(cm,{className:"mr-2 h-4 w-4"}),"Rewrite with Architect"]})]})})]})]})]})}function tB({surfaceTheme:a,animation:b}){var c,d;let e="light"===a,f=bc("whitespace-pre-wrap break-words rounded-lg border px-3 py-2",e?"border-[#e4ddd2] bg-white text-[#1a1714]":"border-white/10 bg-[#040810] text-slate-100"),g=(c=b.changedToText,(d=b.revealedCharCount)<=0?"":Array.from(c).slice(0,d).join(""));return(0,D.jsxs)("div",{className:bc("rounded-[18px] border px-4 py-3",e?"border-[#e5ded3] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,D.jsxs)("div",{className:bc("flex items-center justify-between gap-2 whitespace-nowrap text-[9px] uppercase tracking-[0.18em] leading-none",e?"text-[#8b8278]":"text-slate-400"),children:[(0,D.jsx)("span",{className:"min-w-0 truncate",children:"Rewriting"}),(0,D.jsxs)("span",{className:bc("shrink-0 rounded-full border px-2 py-0.5",e?"border-[#dfd7cc] bg-[#faf6f1] text-[#6e6458]":"border-white/10 bg-white/[0.04] text-slate-300"),children:[b.revealedCharCount,"/",b.changedToCharCount||1]})]}),(0,D.jsxs)("div",{className:"mt-2 space-y-2 font-mono text-[12px] leading-5",children:[b.prefixLines.length?(0,D.jsx)("div",{className:bc("space-y-1.5",e?"text-[#27231e]":"text-slate-100"),children:b.prefixLines.map((a,b)=>(0,D.jsx)("div",{className:"whitespace-pre-wrap break-words",children:a||"\xa0"},`prefix-${b}`))}):null,(0,D.jsx)("div",{className:bc("rounded-2xl border px-3 py-2.5",e?"border-[#d8cdbc] bg-[#f9f5ef]":"border-cyan-300/20 bg-cyan-300/6"),children:(0,D.jsxs)("div",{className:"grid gap-2 md:grid-cols-2",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:bc("mb-1 text-[9px] uppercase tracking-[0.18em]",e?"text-[#968a7c]":"text-slate-400"),children:"Old"}),(0,D.jsx)("div",{className:f,children:b.changedFromLines.length?b.changedFromLines.map((a,b)=>(0,D.jsx)("div",{className:"whitespace-pre-wrap break-words opacity-55 line-through",children:a||"\xa0"},`before-${b}`)):(0,D.jsx)("div",{className:"opacity-45",children:"[empty]"})})]}),(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:bc("mb-1 text-[9px] uppercase tracking-[0.18em]",e?"text-[#968a7c]":"text-slate-400"),children:"New"}),(0,D.jsx)("div",{className:bc(f,"min-h-[96px]"),children:b.changedToCharCount>0?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("span",{className:"whitespace-pre-wrap break-words",children:g}),b.revealedCharCount<b.changedToCharCount?(0,D.jsx)(pV.span,{"aria-hidden":"true",className:bc("ml-0.5 inline-block align-[-0.15em] text-[1.1em] leading-none",e?"text-[#161514]":"text-cyan-100"),animate:{opacity:[0,1,0]},transition:{duration:.8,repeat:1/0,ease:"easeInOut"},children:"|"}):null]}):(0,D.jsx)("span",{className:bc("opacity-45",e?"text-[#7d7266]":"text-slate-400"),children:"[removed]"})})]})]})}),b.suffixLines.length?(0,D.jsx)("div",{className:bc("space-y-1.5",e?"text-[#27231e]":"text-slate-100"),children:b.suffixLines.map((a,b)=>(0,D.jsx)("div",{className:"whitespace-pre-wrap break-words",children:a||"\xa0"},`suffix-${b}`))}):null]})]})}let tC=K("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),tD=K("rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]),tE=K("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),tF=K("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),tG=K("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),tH=K("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),tI=K("lock-keyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]),tJ=[{id:"company",label:"Company",icon:K("building-2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]])},{id:"product",label:"Product",icon:K("briefcase-business",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M22 13a18.15 18.15 0 0 1-20 0",key:"12hx5q"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]])},{id:"workspace",label:"Workspace",icon:K("boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]])},{id:"team",label:"Team",icon:cp},{id:"operations",label:"Operations",icon:sV},{id:"deploy",label:"Deploy",icon:tD}],tK=[{id:"intake",label:"Intake",section:"company"},{id:"context-harvest",label:"Context",section:"workspace"},{id:"team-synthesis",label:"Team",section:"team"},{id:"pressure-test",label:"Review",section:"operations"},{id:"decision-lock",label:"Lock",section:"deploy"},{id:"ready",label:"Ready",section:"deploy"},{id:"deploying",label:"Deploying",section:"deploy"},{id:"deployed",label:"Live",section:"deploy"}];function tL(a){return tK.find(b=>b.id===a)?.label??"Draft"}function tM(a,b){switch(b){case"company":{let b=[a.company.name,a.company.mission,a.company.targetCustomer].filter(a=>!a.trim()).length;return 0===b?{label:"Ready to review",variant:"success"}:{label:`${b} core field${1===b?"":"s"} missing`,variant:"warning"}}case"product":{let b=[+!a.product.offer.trim(),a.product.scopeV1.length>0?0:1,a.product.launchPriority.length>0?0:1].reduce((a,b)=>a+b,0);return 0===b?{label:"Scope is defined",variant:"success"}:{label:`${b} product decision${1===b?"":"s"} pending`,variant:"warning"}}case"workspace":{let b=+!a.workspace.name.trim();return"clone"!==a.workspace.sourceMode||a.workspace.repoUrl?.trim()||(b+=1),"existing"!==a.workspace.sourceMode||a.workspace.existingPath?.trim()||(b+=1),0===b?{label:"Provisioning path set",variant:"success"}:{label:`${b} workspace input${1===b?"":"s"} missing`,variant:"warning"}}case"team":{let b=a.team.persistentAgents.filter(a=>a.enabled).length,c=a.team.persistentAgents.some(a=>a.enabled&&a.isPrimary);if(0===b)return{label:"Add at least one agent",variant:"danger"};if(!c)return{label:"Primary agent missing",variant:"warning"};return{label:`${b} active agent${1===b?"":"s"}`,variant:"success"}}case"operations":{let b=a.operations.workflows.filter(a=>a.enabled).length,c=a.operations.automations.filter(a=>a.enabled).length;if(0===b&&0===c)return{label:"No runtime loops yet",variant:"warning"};return{label:`${b} workflows, ${c} automations`,variant:"success"}}default:if(!a.intake.reviewRequested&&"deploying"!==a.status&&"deployed"!==a.status)return{label:"Review not opened yet",variant:"muted"};if(a.deploy.blockers.length>0)return{label:`${a.deploy.blockers.length} blocker${1===a.deploy.blockers.length?"":"s"}`,variant:"danger"};if(a.deploy.warnings.length>0)return{label:`${a.deploy.warnings.length} warning${1===a.deploy.warnings.length?"":"s"}`,variant:"warning"};return{label:"Ready to deploy",variant:"success"}}}function tN(a,b){switch(b){case"company":return a.company.name?`${a.company.name}${a.company.mission?` \xb7 ${a.company.mission}`:""}`:"Mission and audience are still being shaped.";case"product":return a.product.offer||"Offer and V1 scope are still being drafted.";case"workspace":return`${tO(a.workspace.template)} \xb7 ${tO(a.workspace.sourceMode)}`;case"team":return`${a.team.persistentAgents.filter(a=>a.enabled).length} agents drafted`;case"operations":return`${a.operations.workflows.filter(a=>a.enabled).length} workflows \xb7 ${a.operations.automations.filter(a=>a.enabled).length} automations`;default:return a.intake.reviewRequested?"Deploy review is open.":"Review not started."}}function tO(a){return a.split(/[-_]/g).filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}let tP=Object.fromEntries(tk.map(a=>[a.value,a.label]));function tQ({className:a,surfaceTheme:b,workspaceMode:c="create",mode:d,snapshot:e,basicQuickSetup:f,plan:g,resolvedName:h,resolvedTemplate:i,sourceAnalysis:j,workspacePath:k,notice:l,basicRules:m,basicPreset:n,onOpenBlueprintEditor:o,onOpenDocumentEditor:p,onBasicPresetChange:q,onBasicRuleToggle:r,progress:s}){let t="light"===b,u=(0,E.useRef)({});(0,E.useRef)(null);let[v,w]=(0,E.useState)(null),x=(a="workspace.name")=>{o?.(a)};(0,E.useMemo)(()=>(function({mode:a,plan:b,notice:c,progress:d,resolvedName:e,resolvedTemplate:f,basicRules:g,basicPreset:h,sourceAnalysis:i,workspacePath:j}){return{mode:a,noticeSignature:c?`${c.tone}:${c.title}:${c.description}`:"",progressSignature:d?JSON.stringify(d):"",basic:{architectSignature:b?`${b.architectSummary}:${b.intake.confirmations.join("|")}`:"",summarySignature:[e,f,i.kind,i.label,i.hint,i.repoUrl??"",i.existingPath??"",i.websiteUrl??"",j].join(":"),defaultsSignature:`${h}:${g.generateStarterDocs}:${g.generateMemory}:${g.kickoffMission}`},advanced:{stage:b?.stage??null,readinessSignature:b?`${b.readinessScore}:${b.architectSummary}`:"",deploySignature:b?`${b.intake.reviewRequested}:${b.deploy.blockers.join("|")}:${b.deploy.warnings.join("|")}`:"",sectionSignatures:Object.fromEntries(tJ.map(a=>[a.id,b?`${tM(b,a.id).label}:${tM(b,a.id).variant}:${tN(b,a.id)}`:""]))}}})({mode:d,plan:g,notice:l,progress:s,resolvedName:h,resolvedTemplate:i,basicRules:m,basicPreset:n,sourceAnalysis:j,workspacePath:k}),[n,m,d,l,g,s,h,i,j,k]);let y=(0,E.useMemo)(()=>g?te({name:g.workspace.name||"Workspace",brief:g.company.mission||g.product.offer||void 0,template:g.workspace.template,sourceMode:g.workspace.sourceMode,rules:g.workspace.rules,agents:g.team.persistentAgents.filter(a=>a.enabled),docOverrides:g.workspace.docOverrides,toolExamples:[]}):[],[g]);return(0,D.jsx)("aside",{className:bc("min-h-0 border-t lg:border-l lg:border-t-0",t?"border-[#ebe5dd] bg-[#f7f2eb]":"border-white/10 bg-[rgba(5,9,18,0.92)]",a),children:(0,D.jsx)(qs,{className:"h-full",children:(0,D.jsxs)("div",{className:"space-y-4 p-4 md:p-5",children:[(0,D.jsx)(tS,{surfaceTheme:b,title:"basic"===d?"Workspace draft":"Workspace blueprint",subtitle:"basic"===d?"Live draft view. The fast path stays available while Architect fills in the details.":"Structured blueprint synced with the conversation.",action:g&&o?(0,D.jsxs)(bq,{type:"button",variant:"secondary",size:"sm",onClick:()=>x("workspace.name"),className:t?"rounded-full border-[#ddd6cb] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",children:[(0,D.jsx)(ta,{className:"mr-2 h-3.5 w-3.5"}),"Edit details"]}):null}),"create"===c?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(tR,{sectionKey:"setup-speed",activeSection:v,surfaceTheme:b,register:a=>{u.current["setup-speed"]=a},children:(0,D.jsx)(tX,{surfaceTheme:b,mode:d,preset:n,onPresetChange:q,onOpenBlueprintEditor:x})}),f?(0,D.jsx)("div",{className:"space-y-3",children:f}):null]}):null,l?(0,D.jsx)(tR,{sectionKey:"notice",activeSection:v,surfaceTheme:b,register:a=>{u.current.notice=a},children:(0,D.jsxs)("div",{className:bc("rounded-[18px] border px-4 py-3","warning"===l.tone?t?"border-amber-200 bg-amber-50 text-amber-900":"border-amber-400/25 bg-amber-400/10 text-amber-100":t?"border-[#e3ddd4] bg-white text-[#3f3933]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,D.jsx)("p",{className:bc("text-[11px] uppercase tracking-[0.18em]",t?"text-[#9c9389]":"text-slate-500"),children:l.title}),(0,D.jsx)("p",{className:"mt-1 text-[13px] leading-6",children:l.description})]})}):null,s?(0,D.jsx)(tR,{sectionKey:"progress",activeSection:v,surfaceTheme:b,register:a=>{u.current.progress=a},children:(0,D.jsx)(s9,{progress:s,className:bc(t?"border-[#e5ded3] bg-white text-slate-900 [&_p]:text-inherit":"border-white/10 bg-slate-950/50")})}):null,"basic"===d?(0,D.jsxs)("div",{className:"space-y-3",children:[g?(0,D.jsx)(tR,{sectionKey:"architect-readout",activeSection:v,surfaceTheme:b,register:a=>{u.current["architect-readout"]=a},children:(0,D.jsx)("button",{type:"button",onClick:()=>x("company.mission"),className:bc("w-full rounded-[22px] border p-4 text-left transition-colors",t?"border-[#e5ddd2] bg-white hover:border-[#d9ccbf] hover:bg-[#fdfbf7]":"border-white/10 bg-white/[0.04] hover:border-white/15 hover:bg-white/[0.06]"),children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("span",{className:bc("inline-flex size-9 shrink-0 items-center justify-center rounded-full border",t?"border-[#e7e0d6] bg-[#faf6f1] text-[#5e5750]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,D.jsx)(cp,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("p",{className:bc("text-[11px] uppercase tracking-[0.18em]",t?"text-[#a0978b]":"text-slate-500"),children:"Architect readout"}),(0,D.jsx)("p",{className:bc("mt-1 text-[13px] leading-6",t?"text-[#171410]":"text-white"),children:g.architectSummary}),g.intake.confirmations.length>0?(0,D.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,D.jsx)("p",{className:bc("text-[11px] uppercase tracking-[0.16em]",t?"text-[#8d8276]":"text-slate-500"),children:"Next decisions"}),g.intake.confirmations.slice(0,2).map(a=>(0,D.jsx)("div",{className:bc("rounded-[16px] border px-3 py-2 text-[12px] leading-5",t?"border-[#e8e0d6] bg-[#faf6f1] text-[#5d554d]":"border-white/10 bg-white/[0.05] text-slate-300"),children:a},a))]}):null]})]})})}):null,(0,D.jsx)(tR,{sectionKey:"summary",activeSection:v,surfaceTheme:b,register:a=>{u.current.summary=a},children:(0,D.jsx)(tT,{surfaceTheme:b,resolvedName:h,resolvedTemplate:i,sourceAnalysis:j,workspacePath:k,workspaceRoot:e.diagnostics.workspaceRoot,summaryLabel:g?"Updated from Architect's latest read of the conversation.":"Resolved from your quick setup.",onOpenBlueprintEditor:x})}),(0,D.jsx)(tR,{sectionKey:"defaults",activeSection:v,surfaceTheme:b,register:a=>{u.current.defaults=a},children:(0,D.jsxs)("div",{className:bc("rounded-[22px] border p-4",t?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,D.jsx)("p",{className:bc("text-[11px] uppercase tracking-[0.18em]",t?"text-[#a0978b]":"text-slate-500"),children:"Fast-path defaults"}),(0,D.jsx)(tW,{surfaceTheme:b,plan:g,template:i,rules:m,preset:n,onRuleToggle:r,onOpenBlueprintEditor:x,onOpenDocumentEditor:p})]})})]}):g?(0,D.jsxs)("div",{className:"space-y-3",children:[(0,D.jsx)(tR,{sectionKey:"readiness",activeSection:v,surfaceTheme:b,register:a=>{u.current.readiness=a},children:(0,D.jsx)("button",{type:"button",onClick:()=>x("deploy.blockers"),className:bc("w-full rounded-[22px] border p-4 text-left transition-colors",t?"border-[#e5ddd2] bg-white hover:border-[#d9ccbf] hover:bg-[#fdfbf7]":"border-white/10 bg-white/[0.04] hover:border-white/15 hover:bg-white/[0.06]"),children:(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bc("text-[11px] uppercase tracking-[0.18em]",t?"text-[#a0978b]":"text-slate-500"),children:"Readiness"}),(0,D.jsxs)("p",{className:bc("mt-1 text-[28px] font-semibold tracking-[-0.03em]",t?"text-[#181612]":"text-white"),children:[g.readinessScore,"%"]}),(0,D.jsx)("p",{className:bc("text-[13px] leading-6",t?"text-[#6e665d]":"text-slate-300"),children:g.architectSummary})]}),(0,D.jsx)("span",{className:bc("inline-flex size-10 items-center justify-center rounded-full border",t?"border-[#e5ddd2] bg-[#f5f0e8] text-[#6a635b]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,D.jsx)(cp,{className:"h-4 w-4"})})]})})}),tJ.map(a=>{let c=tM(g,a.id),d=a.icon,e=`section-${a.id}`;return(0,D.jsx)(tR,{sectionKey:e,activeSection:v,surfaceTheme:b,register:a=>{u.current[e]=a},children:(0,D.jsx)("button",{type:"button",onClick:()=>x("company"===a.id?"company.mission":"product"===a.id?"product.offer":"workspace"===a.id?"workspace.name":"team"===a.id?"team.maxParallelRuns":"deploy.blockers"),className:bc("w-full rounded-[22px] border p-4 text-left transition-colors",t?"border-[#e5ddd2] bg-white hover:border-[#d9ccbf] hover:bg-[#fdfbf7]":"border-white/10 bg-white/[0.04] hover:border-white/15 hover:bg-white/[0.06]"),children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("span",{className:bc("inline-flex size-9 shrink-0 items-center justify-center rounded-full border",t?"border-[#e7e0d6] bg-[#faf6f1] text-[#5e5750]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,D.jsx)(d,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,D.jsx)("p",{className:bc("text-[14px] font-semibold",t?"text-[#171410]":"text-white"),children:a.label}),(0,D.jsx)(tV,{surfaceTheme:b,tone:c.variant,label:c.label})]}),(0,D.jsx)("p",{className:bc("mt-1 text-[13px] leading-6",t?"text-[#70685f]":"text-slate-300"),children:tN(g,a.id)})]})]})})},a.id)}),(0,D.jsx)(tR,{sectionKey:"documents",activeSection:v,surfaceTheme:b,register:a=>{u.current.documents=a},children:(0,D.jsxs)("div",{className:bc("rounded-[22px] border p-4",t?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)(tC,{className:bc("h-4 w-4",t?"text-[#5f5952]":"text-slate-300")}),(0,D.jsx)("p",{className:bc("text-[14px] font-semibold",t?"text-[#171410]":"text-white"),children:"Documents"})]}),(0,D.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:y.map(a=>(0,D.jsx)(tZ,{surfaceTheme:b,label:a.path,tone:a.generated?a.overridden?"success":"default":"accent",interactive:!!p,onClick:p?()=>p(a.path):void 0},a.path))}),p?(0,D.jsx)("p",{className:bc("mt-2 text-[11px] leading-5",t?"text-[#7a7168]":"text-slate-400"),children:"edit"===c?"These are the current workspace files. Click a chip to edit one.":"These are the scaffold documents that will be written for this workspace."}):null]})}),(0,D.jsx)(tR,{sectionKey:"deploy-review",activeSection:v,surfaceTheme:b,register:a=>{u.current["deploy-review"]=a},children:(0,D.jsxs)("button",{type:"button",onClick:()=>x("deploy.blockers"),className:bc("w-full rounded-[22px] border p-4 text-left transition-colors",t?"border-[#e5ddd2] bg-white hover:border-[#d9ccbf] hover:bg-[#fdfbf7]":"border-white/10 bg-white/[0.04] hover:border-white/15 hover:bg-white/[0.06]"),children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)(tD,{className:bc("h-4 w-4",t?"text-[#5f5952]":"text-slate-300")}),(0,D.jsx)("p",{className:bc("text-[14px] font-semibold",t?"text-[#171410]":"text-white"),children:"Deploy review"})]}),g.deploy.blockers.length>0?(0,D.jsx)(t$,{surfaceTheme:b,title:"Blockers",tone:"danger",items:g.deploy.blockers}):null,g.deploy.warnings.length>0?(0,D.jsx)(t$,{surfaceTheme:b,title:"Warnings",tone:"warning",items:g.deploy.warnings}):null,0===g.deploy.blockers.length&&0===g.deploy.warnings.length?(0,D.jsx)("p",{className:bc("mt-3 text-[13px] leading-6",t?"text-[#70685f]":"text-slate-300"),children:"Architect has not surfaced blockers or warnings yet. Request review when the blueprint feels directionally right."}):null]})})]}):(0,D.jsxs)("div",{className:bc("rounded-[22px] border border-dashed p-5",t?"border-[#ddd5ca] bg-white/80":"border-white/10 bg-white/[0.04]"),children:[(0,D.jsx)("p",{className:bc("text-[14px] font-medium",t?"text-[#211d19]":"text-white"),children:"Architect is preparing the blueprint."}),(0,D.jsx)("p",{className:bc("mt-1 text-[13px] leading-6",t?"text-[#776f65]":"text-slate-300"),children:"Once the first plan is ready, this pane will start reflecting the structured workspace draft."})]})]})})})}function tR({sectionKey:a,activeSection:b,surfaceTheme:c,register:d,children:e}){return(0,D.jsx)("div",{ref:d,className:bc("scroll-mt-6 rounded-[26px] transition-all duration-500",b===a&&("light"===c?"ring-2 ring-[#d8b184]/70 shadow-[0_0_0_1px_rgba(216,177,132,0.18),0_18px_36px_rgba(102,78,47,0.16)]":"ring-2 ring-cyan-300/45 shadow-[0_0_0_1px_rgba(103,232,249,0.14),0_18px_36px_rgba(6,182,212,0.16)]")),children:e})}function tS({surfaceTheme:a,title:b,subtitle:c,action:d}){let e="light"===a;return(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:bc("text-[11px] uppercase tracking-[0.18em]",e?"text-[#8b7262]":"text-slate-500"),children:b}),(0,D.jsx)("p",{className:bc("mt-1 text-[13px] leading-6",e?"text-[#705b4d]":"text-slate-300"),children:c})]}),d?(0,D.jsx)("div",{className:"shrink-0",children:d}):null]})}function tT({surfaceTheme:a,resolvedName:b,resolvedTemplate:c,sourceAnalysis:d,workspacePath:e,workspaceRoot:f,summaryLabel:g,onOpenBlueprintEditor:h}){let i="light"===a;return(0,D.jsx)("div",{className:bc("rounded-[22px] border p-4",i?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("span",{className:bc("inline-flex size-9 shrink-0 items-center justify-center rounded-full border",i?"border-[#e7e0d6] bg-[#faf6f1] text-[#5e5750]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,D.jsx)(cm,{className:"h-4 w-4"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("p",{className:bc("text-[11px] uppercase tracking-[0.18em]",i?"text-[#a0978b]":"text-slate-500"),children:"Fast-path snapshot"}),(0,D.jsx)("p",{className:bc("mt-1 text-[12px] leading-5",i?"text-[#776f65]":"text-slate-400"),children:g}),(0,D.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,D.jsx)(tU,{surfaceTheme:a,label:"Name",value:b,icon:cm,onClick:()=>h?.("workspace.name")}),(0,D.jsx)(tU,{surfaceTheme:a,label:"Template",value:tP[c],icon:tE,onClick:()=>h?.("workspace.template")}),(0,D.jsx)(tU,{surfaceTheme:a,label:"Source",value:d.label,icon:"clone"===d.kind?tF:"website"===d.kind?tG:tH,onClick:()=>h?.("workspace.sourceMode")}),(0,D.jsx)(tU,{surfaceTheme:a,label:"Path",value:e,icon:tH,mono:!0,title:`Root: ${f}`,onClick:()=>h?.("workspace.directory")})]})]})]})})}function tU({surfaceTheme:a,label:b,value:c,icon:d,detail:e,mono:f=!1,title:g,onClick:h}){let i="light"===a,j=!!h;return(0,D.jsx)("button",{type:"button",onClick:h,className:bc("w-full rounded-[14px] border px-3 py-2.5 text-left transition-colors",i?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]",j&&(i?"cursor-pointer hover:border-[#d9b78b] hover:bg-[#f7efe3] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#d9b78b]/60":"cursor-pointer hover:border-cyan-300/30 hover:bg-white/[0.06] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/30")),title:g,children:(0,D.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,D.jsx)("span",{className:bc("inline-flex size-6 shrink-0 items-center justify-center rounded-full border",i?"border-[#e0d7cc] bg-white text-[#615a52]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,D.jsx)(d,{className:"h-3 w-3"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("p",{className:bc("text-[10px] uppercase tracking-[0.16em]",i?"text-[#8d8276]":"text-slate-500"),children:b}),(0,D.jsx)("p",{className:bc("truncate text-[12px] font-medium leading-4",i?"text-[#171410]":"text-white",f&&"font-mono text-[12px]"),title:c,children:c})]}),j?(0,D.jsx)(ta,{className:bc("h-3.5 w-3.5 shrink-0",i?"text-[#8f8377]":"text-slate-400")}):null,e?(0,D.jsx)("span",{className:bc("shrink-0 text-[10px] leading-4",i?"text-[#776f65]":"text-slate-400"),children:e}):null]})})}function tV({surfaceTheme:a,tone:b,label:c}){return(0,D.jsx)("span",{className:bc("inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-[0.16em]","muted"===b&&("light"===a?"border-[#e4ddd3] bg-[#f7f2eb] text-[#746b61]":"border-white/10 bg-white/[0.05] text-slate-300"),"success"===b&&"border-emerald-200 bg-emerald-50 text-emerald-700","warning"===b&&"border-amber-200 bg-amber-50 text-amber-700","danger"===b&&"border-rose-200 bg-rose-50 text-rose-700"),children:c})}function tW({surfaceTheme:a,plan:b,template:c,rules:d,preset:e,onRuleToggle:f,onOpenBlueprintEditor:g,onOpenDocumentEditor:h}){var i,j,k;let l,m="light"===a,n=(i=c,j=d,l="frontend"===(k=i)?["docs/ux-notes.md"]:"backend"===k?["docs/service-map.md"]:"research"===k?["docs/research-plan.md"]:"content"===k?["docs/content-brief.md"]:[],[{id:"core",title:"Core agent files",description:"Required bootstrap files that define the workspace identity and operating instructions.",checked:!0,locked:!0,files:["AGENTS.md","SOUL.md","IDENTITY.md","TOOLS.md","HEARTBEAT.md"],rule:void 0},{id:"docs",title:"Starter docs",description:"Brief, architecture notes, and the initial deliverables handoff scaffold.",checked:j.generateStarterDocs,locked:!1,files:["docs/brief.md","docs/architecture.md","deliverables/README.md",...l],rule:"generateStarterDocs"},{id:"memory",title:"Memory files",description:"Durable project memory for blueprint decisions and accumulated context.",checked:j.generateMemory,locked:!1,files:["MEMORY.md","memory/blueprint.md","memory/decisions.md"],rule:"generateMemory"},{id:"kickoff",title:"Kickoff mission",description:"Runs the first mission immediately after bootstrap so the agent starts with momentum.",checked:j.kickoffMission,locked:!1,files:[],rule:"kickoffMission"}]),o=tp(c,d),p=(0,E.useMemo)(()=>new Set(tf(b?.workspace.docOverrides).map(a=>a.path)),[b?.workspace.docOverrides]),q=!!b;return(0,D.jsxs)("div",{className:"mt-3 space-y-4",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-2",children:["custom"===e?(0,D.jsx)(tV,{surfaceTheme:a,tone:"muted",label:"Custom mix"}):(0,D.jsx)("span",{}),g?(0,D.jsxs)(bq,{type:"button",variant:"secondary",size:"sm",onClick:()=>g("workspace.ruleGenerateStarterDocs"),className:m?"rounded-full border-[#ddd6cb] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",children:[(0,D.jsx)(ta,{className:"mr-2 h-3.5 w-3.5"}),"Edit section"]}):null]}),(0,D.jsx)("div",{className:"space-y-2",children:n.map(b=>(0,D.jsx)("button",{type:"button",onClick:b.rule?()=>f(b.rule):void 0,disabled:!b.rule,className:bc("w-full rounded-[18px] border px-3 py-3 text-left transition-colors",m?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]",b.rule?m?"hover:border-[#d8c9ba] hover:bg-[#f6efe6]":"hover:border-white/15 hover:bg-white/[0.05]":"cursor-default"),children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("span",{className:bc("mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-md border",b.checked?m?"border-[#1f1b17] bg-[#1f1b17] text-white":"border-cyan-300 bg-cyan-300 text-slate-950":m?"border-[#d9d0c6] bg-white text-transparent":"border-white/15 bg-transparent text-transparent"),children:(0,D.jsx)($,{className:"h-3 w-3"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,D.jsx)("p",{className:bc("text-[13px] font-medium",m?"text-[#171410]":"text-white"),children:b.title}),b.locked?(0,D.jsxs)("span",{className:bc("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",m?"border-[#e0d7cc] bg-white text-[#7a7168]":"border-white/10 bg-white/[0.05] text-slate-400"),children:[(0,D.jsx)(tI,{className:"h-3 w-3"}),"Required"]}):null]}),(0,D.jsx)("p",{className:bc("mt-1 text-[12px] leading-5",m?"text-[#776f65]":"text-slate-400"),children:b.description}),b.files.length>0?(0,D.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:b.files.map(b=>(0,D.jsx)(tZ,{surfaceTheme:a,label:b},b))}):null]})]})},b.id))}),(0,D.jsxs)("div",{className:bc("rounded-[18px] border px-3 py-3",m?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)(tC,{className:bc("h-4 w-4",m?"text-[#5f5952]":"text-slate-300")}),(0,D.jsx)("p",{className:bc("text-[12px] uppercase tracking-[0.16em]",m?"text-[#8d8276]":"text-slate-500"),children:"Will create"})]}),(0,D.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[o.map(b=>(0,D.jsx)(tZ,{surfaceTheme:a,label:b,tone:p.has(b)?"success":"default",interactive:!!(q&&h),onClick:q&&h?()=>h(b):void 0},b)),d.kickoffMission?(0,D.jsx)(tZ,{surfaceTheme:a,label:"Kickoff mission",tone:"accent"}):null]}),q&&h?(0,D.jsx)("p",{className:bc("mt-2 text-[11px] leading-5",m?"text-[#7a7168]":"text-slate-400"),children:"Click a document chip to edit its scaffold."}):null]}),(0,D.jsxs)("p",{className:bc("text-[13px] leading-6",m?"text-[#70685f]":"text-slate-300"),children:["fastest"===e?"Fastest setup keeps only the core agent files and skips kickoff.":"custom"===e?"Custom setup keeps only the extras you left enabled.":"Standard setup creates starter docs, memory, and a kickoff mission."," Need more control later? Switch to Advanced and keep the same draft."]})]})}function tX({surfaceTheme:a,mode:b,preset:c,onPresetChange:d,onOpenBlueprintEditor:e}){let f="light"===a;return(0,D.jsxs)("div",{className:bc("rounded-xl border p-3",f?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:bc("text-[10px] uppercase tracking-[0.18em]",f?"text-[#a0978b]":"text-slate-500"),children:"Setup speed"}),(0,D.jsx)("p",{className:bc("mt-1 text-[11px] leading-5",f?"text-[#70685f]":"text-slate-300"),children:"basic"===b?"Choose how much scaffold the fast create path should write before the workspace opens.":"These presets also work in Advanced and update the workspace bootstrap rules."})]}),(0,D.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:["custom"===c?(0,D.jsx)(tV,{surfaceTheme:a,tone:"muted",label:"Custom"}):null,e?(0,D.jsxs)(bq,{type:"button",variant:"secondary",size:"sm",onClick:()=>e("workspace.ruleGenerateStarterDocs"),className:f?"rounded-full border-[#ddd6cb] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",children:[(0,D.jsx)(ta,{className:"mr-2 h-3.5 w-3.5"}),"Edit"]}):null]})]}),(0,D.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,D.jsx)(tY,{surfaceTheme:a,active:"standard"===c,title:"Standard",description:"Docs, memory, and kickoff mission",onClick:()=>d("standard")}),(0,D.jsx)(tY,{surfaceTheme:a,active:"fastest"===c,title:"Fastest setup",description:"Core files only, no kickoff",onClick:()=>d("fastest")})]})]})}function tY({surfaceTheme:a,active:b,title:c,description:d,onClick:e}){let f="light"===a;return(0,D.jsx)("button",{type:"button",onClick:e,className:bc("w-full rounded-[14px] border px-3 py-2 text-left transition-colors",b?f?"border-[#1f1b17] bg-[#1f1b17] text-white":"border-cyan-300 bg-cyan-300/15 text-cyan-50":f?"border-[#e8e0d6] bg-[#faf6f1] text-[#171410] hover:border-[#d8c9ba] hover:bg-[#f6efe6]":"border-white/10 bg-white/[0.03] text-white hover:border-white/15 hover:bg-white/[0.05]"),children:(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,D.jsx)(tE,{className:"h-3.5 w-3.5 shrink-0"}),(0,D.jsx)("p",{className:"truncate text-[12px] font-medium",children:c})]}),(0,D.jsx)("p",{className:bc("truncate text-right text-[11px] leading-4",b?"opacity-80":f?"text-[#776f65]":"text-slate-400"),children:d})]})})}function tZ({surfaceTheme:a,label:b,tone:c="default",interactive:d=!1,onClick:e}){let f=bc("inline-flex items-center rounded-full border px-2.5 py-1 font-mono text-[10px] transition-colors","accent"===c?"light"===a?"border-[#d8b184] bg-[#f8efe3] text-[#7c5a34]":"border-cyan-300/30 bg-cyan-300/10 text-cyan-100":"success"===c?"light"===a?"border-emerald-300 bg-emerald-50 text-emerald-900":"border-emerald-300/30 bg-emerald-300/12 text-emerald-100":"light"===a?"border-[#e4ddd3] bg-white text-[#6c645b]":"border-white/10 bg-white/[0.05] text-slate-300",d?"success"===c?"light"===a?"cursor-pointer hover:border-emerald-400 hover:bg-emerald-100":"cursor-pointer hover:border-emerald-300/45 hover:bg-emerald-300/16":"light"===a?"cursor-pointer hover:border-[#d8c8ba] hover:bg-[#f6efe6]":"cursor-pointer hover:border-white/15 hover:bg-white/[0.08]":"");return d?(0,D.jsxs)("button",{type:"button",onClick:e,"aria-label":`Edit ${b}`,className:f,children:[(0,D.jsx)(ta,{className:"mr-1 h-3 w-3"}),b]}):(0,D.jsxs)("span",{className:f,children:[(0,D.jsx)($,{className:"mr-1 h-3 w-3"}),b]})}function t$({surfaceTheme:a,title:b,tone:c,items:d}){let e="light"===a;return(0,D.jsxs)("div",{className:bc("mt-3 rounded-[18px] border px-4 py-3","danger"===c?e?"border-rose-200 bg-rose-50":"border-rose-400/25 bg-rose-400/10":e?"border-amber-200 bg-amber-50":"border-amber-400/25 bg-amber-400/10"),children:[(0,D.jsx)("p",{className:bc("text-[11px] uppercase tracking-[0.18em]",e?"text-[#9f958a]":"text-slate-500"),children:b}),(0,D.jsx)("div",{className:"mt-2 space-y-2",children:d.map(a=>(0,D.jsxs)("div",{className:bc("flex items-start gap-2 text-[13px] leading-6",e?"text-[#403934]":"text-slate-200"),children:[(0,D.jsx)(P,{className:"mt-1 h-3.5 w-3.5 shrink-0"}),(0,D.jsx)("span",{children:a})]},a))})]})}let t_=K("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);function t0({surfaceTheme:a,mode:b,onModeChange:c,onNewDraft:d,badges:e,title:f="Create workspace",showModeToggle:g=!0,showNewDraft:h=!0}){let i="light"===a;return(0,D.jsx)("div",{className:bc("relative z-[1] border-b px-4 py-2 md:px-5",i?"border-[#e7e1d8] bg-[linear-gradient(180deg,rgba(255,255,255,0.96),rgba(248,244,237,0.94))]":"border-white/10 bg-[linear-gradient(180deg,rgba(10,16,29,0.96),rgba(6,11,21,0.94))]"),children:(0,D.jsxs)("div",{className:"flex flex-col gap-2 md:flex-nowrap md:flex-row md:items-center md:justify-between md:gap-3",children:[(0,D.jsx)("div",{className:"min-w-0",children:(0,D.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,D.jsx)("span",{className:bc("inline-flex size-8 shrink-0 items-center justify-center rounded-full border shadow-[0_8px_20px_rgba(56,47,38,0.08)]",i?"border-[#e3ddd4] bg-white text-[#4c4640]":"border-white/10 bg-white/[0.05] text-slate-200 shadow-[0_16px_36px_rgba(0,0,0,0.28)]"),children:(0,D.jsx)(cp,{className:"h-3.5 w-3.5"})}),(0,D.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,D.jsx)("p",{className:bc("text-[10px] uppercase tracking-[0.22em]",i?"text-[#7f6554]":"text-slate-500"),children:"Architect"}),(0,D.jsx)("span",{className:bc("text-[10px] uppercase tracking-[0.18em]",i?"text-[#a59a8e]":"text-slate-600"),children:"/"}),(0,D.jsx)("h2",{className:bc("truncate text-[16px] font-semibold tracking-[-0.02em]",i?"text-[#2d2118]":"text-white"),children:f})]})]})}),(0,D.jsxs)("div",{className:"flex flex-wrap items-center gap-2 md:flex-nowrap md:justify-end",children:[e.length>0?(0,D.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 md:flex-nowrap",children:e.map(a=>(0,D.jsx)("span",{className:bc("inline-flex items-center rounded-full border px-2.5 py-0.5 text-[9px] font-medium uppercase tracking-[0.16em]","success"===a.tone&&"border-emerald-200 bg-emerald-50 text-emerald-700","warning"===a.tone&&"border-amber-200 bg-amber-50 text-amber-700","danger"===a.tone&&"border-rose-200 bg-rose-50 text-rose-700",(!a.tone||"muted"===a.tone)&&(i?"border-[#e4ddd3] bg-white text-[#5f5348]":"border-white/10 bg-white/[0.05] text-slate-300")),children:a.label},a.id))}):null,g?(0,D.jsxs)("div",{className:bc("inline-flex rounded-full border p-0.5",i?"border-[#e4ddd3] bg-[#f4efe7]":"border-white/10 bg-white/[0.04]"),children:[(0,D.jsx)(t1,{surfaceTheme:a,active:"basic"===b,label:"Basic",onClick:()=>c("basic")}),(0,D.jsx)(t1,{surfaceTheme:a,active:"advanced"===b,label:"Advanced",onClick:()=>c("advanced")})]}):null,h&&d?(0,D.jsxs)("button",{type:"button",onClick:d,className:bc("inline-flex h-8 items-center gap-2 rounded-full border px-2.5 text-[11px] transition-colors",i?"border-[#dfd8ce] bg-white text-[#38322d] hover:bg-[#f5f1ea]":"border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]"),children:[(0,D.jsx)(t_,{className:"h-3.5 w-3.5"}),"New draft"]}):null]})]})})}function t1({surfaceTheme:a,active:b,label:c,onClick:d}){let e="light"===a;return(0,D.jsx)("button",{type:"button",onClick:d,className:bc("inline-flex min-w-[78px] items-center justify-center rounded-full px-2.5 py-1 text-[11px] transition-colors",b?e?"bg-white text-[#151310] shadow-sm":"bg-[#0f1726] text-white shadow-[0_8px_18px_rgba(0,0,0,0.28)]":e?"text-[#6d584a] hover:text-[#2d2824]":"text-slate-400 hover:text-slate-100"),children:c})}let t2=K("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);function t3({surfaceTheme:a,value:b,placeholder:c,onChange:d,onSubmit:e,disabled:f=!1,isBusy:g=!1,helperText:h,toolbar:i,className:j}){let k=(0,E.useRef)(null),l=!!b.trim()&&!f,m=async a=>{a.preventDefault(),l&&await e()},n=async a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),l&&await e())},o="light"===a;return(0,D.jsxs)("form",{onSubmit:m,className:bc("rounded-[20px] border p-2.5 transition-all duration-200 focus-within:shadow-[0_0_0_1px_rgba(0,0,0,0.02)]",o?"border-[#ddd6cb] bg-white shadow-[0_18px_56px_rgba(56,47,38,0.08)] focus-within:border-[#cfc6ba]":"border-white/10 bg-[rgba(7,12,22,0.92)] shadow-[0_18px_56px_rgba(0,0,0,0.34)] focus-within:border-cyan-300/30",j),children:[(0,D.jsx)("textarea",{ref:k,value:b,onChange:a=>d(a.target.value),onKeyDown:n,placeholder:c,className:bc("min-h-[44px] max-h-[200px] w-full resize-none overflow-y-auto border-0 bg-transparent px-1.5 py-1.5 text-[15px] leading-6 outline-none",o?"text-[#191714] placeholder:text-[#9b948c]":"text-slate-100 placeholder:text-slate-500")}),(0,D.jsxs)("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2",children:[(0,D.jsxs)("div",{className:"flex min-h-8 items-center gap-2",children:[i,h?(0,D.jsx)("p",{className:bc("text-[11px]",o?"text-[#8b837a]":"text-slate-400"),children:h}):null]}),(0,D.jsx)("button",{type:"submit",disabled:!l,className:bc("inline-flex size-8 items-center justify-center rounded-full transition-colors disabled:cursor-not-allowed",o?"bg-[#161514] text-white hover:bg-[#26231f] disabled:bg-[#d5cec5] disabled:text-[#8d857c]":"bg-cyan-300 text-slate-950 hover:bg-cyan-200 disabled:bg-white/[0.08] disabled:text-slate-500"),children:g?(0,D.jsx)(N,{className:"h-3.5 w-3.5 animate-spin"}):(0,D.jsx)(t2,{className:"h-3.5 w-3.5"})})]})]})}function t4({surfaceTheme:a,messages:b,isTyping:c=!1,typingLabel:d="Typing…",emptyState:e,auxiliary:f,className:g}){let h=(0,E.useRef)(null);return(0,D.jsx)(qs,{className:bc("h-full",g),children:(0,D.jsxs)("div",{className:"mx-auto flex min-h-full w-full max-w-3xl flex-col gap-4 px-2 py-4 md:gap-5 md:px-4",children:[e,f,b.map(b=>(0,D.jsx)(t5,{message:b,surfaceTheme:a},b.id)),c?(0,D.jsx)(t6,{surfaceTheme:a,label:d}):null,(0,D.jsx)("div",{ref:h,className:"h-6 w-full shrink-0"})]})})}function t5({message:a,surfaceTheme:b}){let c="light"===b;if("system"===a.role)return(0,D.jsxs)("div",{className:bc("mx-auto w-full max-w-2xl rounded-2xl border px-4 py-3 text-[13px] leading-6",c?"border-[#e3ddd4] bg-[#f5f0e8] text-[#5b544d]":"border-white/10 bg-white/[0.05] text-slate-300"),children:[(0,D.jsx)("p",{className:bc("text-[11px] uppercase tracking-[0.18em]",c?"text-[#8b8074]":"text-slate-500"),children:a.author||"Workspace Wizard"}),(0,D.jsx)("p",{className:"mt-1",children:a.text})]});let d="user"===a.role,e="pending"===a.status;return(0,D.jsxs)("div",{className:bc("flex w-full items-start gap-2.5",d?"justify-end":"justify-start"),children:[d?null:(0,D.jsx)("div",{className:bc("mt-0.5 inline-flex size-8 shrink-0 items-center justify-center rounded-full border",c?"border-[#e6dfd4] bg-white text-[#5f5a53]":"border-white/10 bg-white/[0.05] text-slate-300"),children:"Architect"===a.author?(0,D.jsx)(cp,{className:"h-3.5 w-3.5"}):(0,D.jsx)(cm,{className:"h-3.5 w-3.5"})}),(0,D.jsxs)("div",{className:bc("max-w-[min(100%,680px)]",d?c?"rounded-2xl border border-[#ddd6cb] bg-[#1a1715] px-3 py-2 text-white":"rounded-2xl border border-cyan-200/40 bg-cyan-300 px-3 py-2 text-slate-950":"space-y-1 px-0 py-0",e&&"opacity-75"),children:[!d&&a.author?(0,D.jsx)("p",{className:bc("text-[10px] uppercase tracking-[0.2em]",c?"text-[#8f857a]":"text-slate-500"),children:a.author}):null,(0,D.jsx)("p",{className:bc("whitespace-pre-wrap text-[14px] leading-7",d&&"leading-6"),children:a.text})]})]})}function t6({surfaceTheme:a,label:b}){let c="light"===a;return(0,D.jsxs)("div",{className:"flex w-full items-start gap-2.5",children:[(0,D.jsx)("div",{className:bc("mt-0.5 inline-flex size-8 shrink-0 items-center justify-center rounded-full border",c?"border-[#e6dfd4] bg-white text-[#5f5a53]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,D.jsx)(cp,{className:"h-3.5 w-3.5"})}),(0,D.jsxs)("div",{className:"max-w-[min(100%,680px)]",children:[(0,D.jsx)("p",{className:bc("text-[10px] uppercase tracking-[0.2em]",c?"text-[#8f857a]":"text-slate-500"),children:"Architect"}),(0,D.jsxs)("div",{className:"mt-1 flex items-center gap-2.5",children:[(0,D.jsxs)("div",{className:bc("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5",c?"border-[#e6dfd5] bg-white text-[#5a534c]":"border-white/10 bg-white/[0.05] text-slate-300"),children:[(0,D.jsx)("span",{className:bc("inline-flex size-1.5 animate-pulse rounded-full",c?"bg-[#5a534c]":"bg-slate-300")}),(0,D.jsx)("span",{className:bc("inline-flex size-1.5 animate-pulse rounded-full [animation-delay:120ms]",c?"bg-[#5a534c]":"bg-slate-300")}),(0,D.jsx)("span",{className:bc("inline-flex size-1.5 animate-pulse rounded-full [animation-delay:240ms]",c?"bg-[#5a534c]":"bg-slate-300")})]}),(0,D.jsx)("p",{className:bc("text-[12px] leading-5",c?"text-[#6f685f]":"text-slate-400"),children:b})]})]})]})}function t7({surfaceTheme:a,chips:b,onSelect:c,disabled:d=!1,className:e}){if(0===b.length)return null;let f="light"===a;return(0,D.jsx)("div",{className:bc("flex flex-wrap items-center gap-1.5",e),children:b.map(a=>(0,D.jsx)("button",{type:"button",onClick:()=>c(a),disabled:d,className:bc("inline-flex min-h-8 items-center rounded-full border px-3.5 py-1.5 text-left text-[11px] transition-colors disabled:cursor-not-allowed disabled:opacity-50",f?"border-[#ddd7cf] bg-white text-[#4a443f] hover:border-[#cfc7bc] hover:bg-[#f3efe8]":"border-white/10 bg-white/[0.05] text-slate-200 hover:bg-white/[0.08] hover:text-white"),children:a.label},a.id))})}async function t8(a,b){if(!a.body)throw Error("The server did not return a readable stream.");let c=a.body.getReader(),d=new TextDecoder,e="";for(;;){let{value:a,done:f}=await c.read();if(f)break;let g=(e+=d.decode(a,{stream:!0})).indexOf("\n");for(;g>=0;){let a=e.slice(0,g).trim();e=e.slice(g+1),a&&await b(JSON.parse(a)),g=e.indexOf("\n")}}let f=e.trim();f&&await b(JSON.parse(f))}let t9={founder:"Founder",product:"Product Lead",architect:"System Architect",ops:"Operations",growth:"Growth",reviewer:"Reviewer"},ua={small:{label:"Small",agentCount:1,workflowCount:1,automationCount:0,externalChannelCount:0,confirmationLimit:1,suggestedReplyLimit:2},medium:{label:"Medium",agentCount:3,workflowCount:3,automationCount:1,externalChannelCount:0,confirmationLimit:2,suggestedReplyLimit:3},large:{label:"Large",agentCount:5,workflowCount:4,automationCount:2,externalChannelCount:1,confirmationLimit:3,suggestedReplyLimit:4}};function ub(a){return ua[a]??ua.medium}let uc={internal:{label:"Internal",requiresCredentials:!1,credentials:[]},slack:{label:"Slack",requiresCredentials:!0,credentials:[{key:"botToken",label:"Bot token",placeholder:"xoxb-...",secret:!0}]},telegram:{label:"Telegram",requiresCredentials:!0,credentials:[{key:"token",label:"Bot token",placeholder:"123456:ABC...",secret:!0}]},discord:{label:"Discord",requiresCredentials:!0,credentials:[{key:"token",label:"Bot token",placeholder:"Discord bot token",secret:!0}]},googlechat:{label:"Google Chat",requiresCredentials:!0,credentials:[{key:"webhookUrl",label:"Webhook URL",placeholder:"https://chat.googleapis.com/...",secret:!0}]}};function ud(){return globalThis.crypto?.randomUUID?.()??`plan-${Date.now()}`}function ue(a,b,c){return{id:ud(),role:a,author:b,text:c,createdAt:new Date().toISOString()}}function uf(a){return{id:a.id?.trim()||ud(),kind:a.kind,label:a.label.trim(),summary:a.summary.trim(),details:uA(a.details),status:a.status??"ready",createdAt:a.createdAt??new Date().toISOString(),confidence:"number"==typeof a.confidence?Math.max(0,Math.min(100,Math.round(a.confidence))):void 0,url:uz(a.url),error:uz(a.error)}}function ug(a){return{id:a.id?.trim()||ud(),section:a.section,label:a.label.trim(),value:a.value.trim(),confidence:Math.max(0,Math.min(100,Math.round(a.confidence??72))),status:a.status??"inferred",rationale:uy(a.rationale??""),sourceLabels:uA(a.sourceLabels)}}function uh(a){let b=uD(a?.id||a?.name||"operator")||"operator",c=a?.role?.trim()||"Operator",d=a?.name?.trim()||uE(b);return{id:b,role:c,name:d,purpose:a?.purpose?.trim()||`${d} owns ${c.toLowerCase()} execution and handoffs.`,enabled:a?.enabled!==!1,isPrimary:!!a?.isPrimary,emoji:a?.emoji?.trim(),theme:a?.theme?.trim(),skillId:a?.skillId?.trim(),modelId:a?.modelId?.trim(),policy:a?.policy??qB("worker"),heartbeat:a?.heartbeat??{enabled:!1},responsibilities:uA(a?.responsibilities),outputs:uA(a?.outputs)}}function ui(a){return{id:uD(a?.id||a?.name||`workflow-${Date.now()}`)||`workflow-${Date.now()}`,name:a?.name?.trim()||"New workflow",goal:a?.goal?.trim()||"",trigger:a?.trigger??"manual",ownerAgentId:a?.ownerAgentId?.trim(),collaboratorAgentIds:uA(a?.collaboratorAgentIds),successDefinition:a?.successDefinition?.trim()||"",outputs:uA(a?.outputs),channelIds:uA(a?.channelIds),enabled:a?.enabled!==!1}}function uj(a="internal",b){let c=uc[a];return{id:uD(b?.id||b?.name||`${a}-${Date.now()}`)||`${a}-${Date.now()}`,type:a,name:b?.name?.trim()||c.label,purpose:b?.purpose?.trim()||"",target:b?.target?.trim(),enabled:b?.enabled!==!1,announce:!!b?.announce,requiresCredentials:c.requiresCredentials,credentials:b?.credentials?.map(a=>({...a,value:a.value??""}))??c.credentials.map(a=>({...a,value:""}))}}function uk(a){return{id:uD(a?.id||a?.name||`automation-${Date.now()}`)||`automation-${Date.now()}`,name:a?.name?.trim()||"New automation",description:a?.description?.trim()||"",enabled:a?.enabled!==!1,scheduleKind:a?.scheduleKind??"every",scheduleValue:a?.scheduleValue?.trim()||"24h",agentId:a?.agentId?.trim(),mission:a?.mission?.trim()||"",thinking:a?.thinking??"medium",announce:!!a?.announce,channelId:a?.channelId?.trim()}}function ul(a,b){return(function(a,b,c){let d=tn[a];if("solo"===b){let a=d.find(a=>a.isPrimary)??d[0];return[{...a,name:to(c,a.role,"Builder"===a.role?"Default Agent":a.name),policy:qB("browser"===a.id?"browser":"worker"),enabled:!0}]}return d.map(a=>({id:a.id,role:a.role,name:a.isPrimary?to(c,a.role,a.name):a.name,emoji:a.emoji,theme:a.theme,skillId:a.skillId,modelId:a.modelId,isPrimary:!!a.isPrimary,policy:qB("browser"===a.id?"browser":"worker"),enabled:!0}))})(a,"core",b).map(b=>{var c,d,e,f,g,h,i;return uh({id:b.id,role:b.role,name:b.name,purpose:(c=b.id,d=b.role,e=a,/review/i.test(c)||/review/i.test(d)?`Pressure-test ${e} work for correctness, regression risk, and missing validation.`:/test/i.test(c)||/test/i.test(d)?`Validate behavior, environment assumptions, and release confidence for this ${e} workspace.`:/learn/i.test(c)||/learn/i.test(d)?"Keep the workspace memory, conventions, and durable decisions coherent over time.":/browser/i.test(c)||/browser/i.test(d)?"Exercise real UI flows and collect evidence for browser-facing work.":`Own hands-on delivery and keep the ${e} workspace moving.`),enabled:b.enabled,isPrimary:b.isPrimary,emoji:b.emoji,theme:b.theme,skillId:b.skillId,modelId:b.modelId,policy:b.policy??qB("worker"),heartbeat:b.heartbeat??{enabled:!1},responsibilities:(f=b.id,g=a,/review/i.test(f)?["Review active work","Call out regressions","Protect launch quality"]:/test/i.test(f)?["Run verification loops","Capture evidence","Surface failing assumptions"]:/learn/i.test(f)?["Update durable memory","Track decisions","Reduce restart friction"]:/browser/i.test(f)?["Exercise flows","Capture screenshots","Validate responsive states"]:"content"===g?["Drive content production","Coordinate handoffs","Prepare launch artifacts"]:["Implement the next increment","Coordinate specialists","Keep execution momentum"]),outputs:(h=b.id,i=a,/review/i.test(h)?["review notes","risk checklist"]:/test/i.test(h)?["verification report","repro steps"]:/learn/i.test(h)?["memory updates","decision log entries"]:/browser/i.test(h)?["screenshots","browser validation notes"]:"research"===i?["research summary","evidence log"]:["implementation artifacts","handoff summary"])})})}function um(a,b){let c=b.find(a=>a.enabled&&a.isPrimary)?.id,d=uw(b,"review"),e=uw(b,"test"),f=uw(b,"learn"),g=uw(b,"browser");if("research"===a)return[ui({id:"research-loop",name:"Research loop",goal:"Turn the main question into evidence-backed findings and explicit unknowns.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[f,d].filter(Boolean),successDefinition:"Question, evidence, synthesis, and next-step recommendations are documented.",outputs:["docs/research-plan.md","deliverables/<run>/research-summary.md"]}),ui({id:"finding-review",name:"Finding review",goal:"Pressure-test claims before publishing or acting on them.",trigger:"manual",ownerAgentId:d??c,collaboratorAgentIds:[c].filter(Boolean),successDefinition:"Assumptions, risks, and evidence gaps are explicit.",outputs:["deliverables/<run>/review-notes.md"]})];if("content"===a)return[ui({id:"strategy",name:"Strategy and briefing",goal:"Clarify audience, offer, channels, and campaign bets before production.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[d,f].filter(Boolean),successDefinition:"The team agrees on brief, priorities, and success signals.",outputs:["docs/content-brief.md","deliverables/<run>/campaign-brief.md"]}),ui({id:"production",name:"Production and QA",goal:"Create assets, review them, and prepare a launch package.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[d].filter(Boolean),successDefinition:"Assets are approved and delivery-ready.",outputs:["deliverables/<run>/drafts/","deliverables/<run>/launch-package.md"]}),ui({id:"performance-loop",name:"Performance loop",goal:"Review outcomes, learn from results, and feed the next iteration.",trigger:"cron",ownerAgentId:f??d??c,collaboratorAgentIds:[c].filter(Boolean),successDefinition:"Measured results and next changes are documented.",outputs:["deliverables/<run>/performance-review.md"]})];let h=g&&"frontend"===a?g:c;return[ui({id:"scope-v1",name:"V1 shaping",goal:"Turn the product goal into a constrained first delivery batch.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[f,d].filter(Boolean),successDefinition:"Scope, non-goals, and critical path are documented.",outputs:["docs/brief.md","memory/blueprint.md"]}),ui({id:"delivery",name:"Delivery loop",goal:"Implement, validate, and hand off the next meaningful increment.",trigger:"manual",ownerAgentId:h,collaboratorAgentIds:[e,d].filter(Boolean),successDefinition:"A tested increment ships with review notes and clear handoff.",outputs:["deliverables/<run>/release-notes.md","deliverables/<run>/verification.md"]}),ui({id:"launch-readiness",name:"Launch readiness",goal:"Check blockers, rollback posture, and communication before launch.",trigger:"launch",ownerAgentId:d??c,collaboratorAgentIds:[e,f].filter(Boolean),successDefinition:"Launch risks, open blockers, and go/no-go signal are explicit.",outputs:["deliverables/<run>/launch-checklist.md"]})]}function un(){return[uj("internal",{id:"internal-ops",name:"Internal ops",purpose:"Default internal coordination surface for planner outputs and deploy notes.",announce:!1})]}function uo(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;let C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W=uC(a),X=W.intake.sources.some(a=>"workspace-edit-source"===a.id);if(W.runtime=(b=W.id,c=W.runtime,Q=c?.architectSessionId?.trim()||`planner-${b}-architect`,R=Object.fromEntries(Object.entries(c?.advisorAgentIds??{}).filter(([,a])=>"string"==typeof a&&a.trim())),S=Object.fromEntries(Object.entries(t9).map(([a])=>[a,c?.advisorSessionIds?.[a]?.trim()||`planner-${b}-${a}`])),{mode:c?.mode==="fallback"?"fallback":"agent",status:c?.status==="error"?"error":c?.status==="ready"?"ready":"pending",workspaceId:uz(c?.workspaceId),workspacePath:uz(c?.workspacePath),architectAgentId:uz(c?.architectAgentId),architectSessionId:Q,advisorAgentIds:R,advisorSessionIds:S,lastArchitectRunId:uz(c?.lastArchitectRunId),lastAdvisorRunIds:uA(c?.lastAdvisorRunIds),lastError:uz(c?.lastError)}),W.intake=(d={...W.intake,started:!!W.intake?.started||W.conversation.some(a=>"user"===a.role)},{started:!!d?.started,initialPrompt:uy(d?.initialPrompt??""),latestPrompt:uy(d?.latestPrompt??""),sources:(d?.sources??[]).map(a=>uf(a)),confirmations:uA(d?.confirmations).map(a=>a.trim()).filter(Boolean).slice(0,3),mode:d?.mode==="advanced"?"advanced":"guided",size:d?.size==="small"||d?.size==="large"?d.size:"medium",reviewRequested:!!d?.reviewRequested,turnCount:Math.max(0,Math.floor(d?.turnCount??0)),inferences:(d?.inferences??[]).map(a=>ug(a)),suggestedReplies:uA(d?.suggestedReplies).slice(0,4)}),W.company.name=uy(W.company.name),W.company.mission=uy(W.company.mission),W.company.targetCustomer=uy(W.company.targetCustomer),W.company.constraints=uA(W.company.constraints),W.company.successSignals=uA(W.company.successSignals),W.product.offer=uy(W.product.offer),W.product.scopeV1=uA(W.product.scopeV1),W.product.nonGoals=uA(W.product.nonGoals),W.product.revenueModel=uy(W.product.revenueModel),W.product.launchPriority=uA(W.product.launchPriority),W.workspace.name=uy(W.workspace.name),W.workspace.directory=uz(W.workspace.directory),W.workspace.repoUrl=uz(W.workspace.repoUrl),W.workspace.existingPath=uz(W.workspace.existingPath),W.workspace.stackDecisions=uA(W.workspace.stackDecisions),W.workspace.docs=uB(uA(W.workspace.docs).concat(tp(W.workspace.template,W.workspace.rules))),W.workspace.docOverrides=tf(W.workspace.docOverrides),W.team.persistentAgents=W.team.persistentAgents.map(a=>uh({...a,id:a.id,role:a.role,name:a.name,purpose:a.purpose,enabled:a.enabled,isPrimary:a.isPrimary,emoji:a.emoji,theme:a.theme,skillId:a.skillId,modelId:a.modelId,policy:a.policy,heartbeat:a.heartbeat,responsibilities:a.responsibilities,outputs:a.outputs})).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),X){if(!W.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)){let a=W.team.persistentAgents.find(a=>a.enabled);a&&(a.isPrimary=!0)}}else{let a,b;if(0===W.team.persistentAgents.length&&(W.team.persistentAgents=ul(W.workspace.template,W.workspace.name)),!W.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)){let a=W.team.persistentAgents.find(a=>a.enabled);a&&(a.isPrimary=!0)}let c=W.team.persistentAgents.find(a=>a.enabled&&a.isPrimary);c&&W.workspace.name&&(g=c.name,h=c.role,a=g.trim().toLowerCase(),b=h.trim().toLowerCase(),!a||"default agent"===a||a===b||"primary agent"===a||"workspace agent"===a)&&(c.name=to(W.workspace.name,c.role,c.name))}W.operations.channels=W.operations.channels.map(a=>uj(a.type,a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),X||0!==W.operations.channels.length||(W.operations.channels=un()),W.operations.workflows=W.operations.workflows.map(a=>ui(a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),X||0!==W.operations.workflows.length||(W.operations.workflows=um(W.workspace.template,W.team.persistentAgents)),W.operations.automations=W.operations.automations.map(a=>uk(a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),X||(U=ub((T=uC(W)).intake.size),T.team.persistentAgents=function(a,b,c){var d;let e,f;if(c<=0)return[];return ux((f=(d=[...b,...ul(a),...(e=uh({id:"ops-lead",role:"Operations Lead",name:"Operations Lead",purpose:"Own automations, reporting cadence, and cross-agent handoffs for the workspace.",responsibilities:["Maintain the operating cadence","Wire recurring automations","Keep handoffs durable"],outputs:["ops brief","automation notes"]}),"research"===a?[uh({id:"analyst",role:"Analyst",name:"Analyst",purpose:"Turn gathered evidence into patterns, themes, and decision-ready summaries.",responsibilities:["Cluster findings","Spot repeated signals","Prepare concise summaries"],outputs:["insight summary","theme map"]}),e]:[e])]).find(a=>a.isPrimary)??d[0])?[f,...d.filter(a=>a.id!==f.id)]:d).slice(0,c).map((a,b)=>uh({...a,enabled:!0,isPrimary:a.isPrimary||0===b}))}(T.workspace.template,T.team.persistentAgents,U.agentCount),T.operations.channels=function(a,b,c){let d=b.find(a=>"internal"===a.type)??un()[0],e=[...b.filter(a=>"internal"!==a.type),...("content"===a?["telegram","discord","slack"]:["slack","discord","telegram"]).map(b=>uj(b,{id:`${b}-ops`,purpose:"content"===a?"Optional distribution or community surface for a larger operating setup.":"Optional external operating surface for a larger workspace.",enabled:!1,announce:!0}))].filter((a,b,c)=>c.findIndex(b=>b.type===a.type)===b);return[uj("internal",{...d,enabled:!0}),...e.slice(0,c)]}(T.workspace.template,T.operations.channels,U.externalChannelCount),T.operations.workflows=function(a,b,c,d){let e,f,g,h;return d<=0?[]:ux([...b,...um(a,c),...(e=c.find(a=>a.enabled&&a.isPrimary)?.id,f=uw(c,"review"),g=uw(c,"learn"),h=uw(c,"ops"),[ui({id:"context-sync",name:"research"===a?"Evidence sync":"Context sync",goal:"Pull new context from linked sources and keep the blueprint aligned with reality.",trigger:"manual",ownerAgentId:g??e,collaboratorAgentIds:[e,f].filter(Boolean),successDefinition:"New context is reflected in durable docs, scope, and decision notes.",outputs:["memory/blueprint.md","deliverables/<run>/context-sync.md"]}),ui({id:"ops-rhythm",name:"Operating rhythm",goal:"Review handoffs, automations, and next-step ownership on a repeatable cadence.",trigger:"cron",ownerAgentId:h??f??g??e,collaboratorAgentIds:[e].filter(Boolean),successDefinition:"The workspace has a fresh operator brief and an explicit next batch of work.",outputs:["deliverables/<run>/ops-rhythm.md"]})])]).slice(0,d).map(a=>{var b,d;let e,f,g,h,i;return b=a,e=new Set((d=c).filter(a=>a.enabled).map(a=>a.id)),f=d.find(a=>a.enabled&&a.isPrimary)?.id,g=uw(d,"review"),h=uw(d,"learn"),i=b.ownerAgentId&&e.has(b.ownerAgentId)?b.ownerAgentId:g??h??f,ui({...b,ownerAgentId:i,collaboratorAgentIds:b.collaboratorAgentIds.filter(a=>e.has(a)&&a!==i),enabled:!0})})}(T.workspace.template,T.operations.workflows,T.team.persistentAgents,U.workflowCount),T.operations.automations=function(a,b,c,d,e){let f,g,h;return e<=0?[]:ux([...b,...(f=uw(c,"review")??c.find(a=>a.enabled)?.id,g=uw(c,"learn")??f,[uk({id:"daily-triage",name:"Daily triage",description:"Review drift, blockers, and next handoffs every day.",scheduleKind:"every",scheduleValue:"24h",agentId:f,mission:"content"===a?"Review active campaigns, blockers, and next content handoffs. Leave a concise operator brief.":"Inspect the workspace, surface blockers, and leave a concise next-step handoff for the team.",thinking:"medium",channelId:h=d[0]?.id}),uk({id:"weekly-review",name:"Weekly review",description:"Capture progress, decisions, and next bets once per week.",scheduleKind:"every",scheduleValue:"168h",agentId:g,mission:"research"===a?"Summarize evidence gathered this week, open questions, and the next investigation batch.":"Summarize progress, major decisions, and the next delivery batch for this workspace.",thinking:"high",channelId:h})].filter(a=>a.agentId))]).slice(0,e).map(a=>{var b,e,f;let g,h,i,j,k;return b=a,e=c,f=d,g=new Set(e.filter(a=>a.enabled).map(a=>a.id)),h=new Set(f.map(a=>a.id)),i=e.find(a=>a.enabled&&a.isPrimary)?.id,j=uw(e,"review"),k=uw(e,"learn"),uk({...b,agentId:b.agentId&&g.has(b.agentId)?b.agentId:j??k??i,channelId:b.channelId&&h.has(b.channelId)?b.channelId:f[0]?.id,enabled:!0})})}(T.workspace.template,T.operations.automations,T.team.persistentAgents,T.operations.channels,U.automationCount),W=T),W.operations.hooks=W.operations.hooks.map(a=>({id:uD(a?.id||a?.name||`hook-${Date.now()}`)||`hook-${Date.now()}`,name:a?.name?.trim()||"New hook",source:a?.source?.trim()||"",enabled:a?.enabled!==!1,notes:a?.notes?.trim()||""})).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),W.operations.sandbox=(e=W.operations.sandbox,{workspaceOnly:e?.workspaceOnly??!0,mode:e?.mode??"default",notes:uA(e?.notes)}),X||(W.deploy.firstMissions=(V=(f=W).team.persistentAgents.find(a=>a.enabled&&a.isPrimary),uB([V?"Inspect the new workspace, refine docs to match the blueprint, and break the first delivery batch into concrete tasks.":"",f.team.persistentAgents.find(a=>/review/i.test(a.role)&&a.enabled)?"Review the blueprint against the created workspace, call out execution risks, and leave a launch-readiness checklist.":"",f.team.persistentAgents.find(a=>/learn/i.test(a.role)&&a.enabled)?"Capture durable facts, decisions, and conventions in memory files so the team can continue without drift.":""].filter(Boolean))));let Y=uu(W.company.name),Z=uu(W.workspace.name);if((!W.company.name||Y)&&W.workspace.name&&!Z&&(W.company.name=W.workspace.name),(!W.workspace.name||Z)&&W.company.name&&!Y&&(W.workspace.name=W.company.name),!W.intake.started)return W.deploy.blockers=[],W.deploy.warnings=[],W.intake.confirmations=[],W.intake.inferences=[],W.intake.suggestedReplies=[],W.readinessScore=0,W.architectSummary="Start with one prompt. Paste the project goal, website URL, repo, or existing folder and the architect will draft the workspace for you.",W.stage="intake",W.status="draft",W.updatedAt=new Date().toISOString(),W;let $=function(a){let b=[],c=ub(a.intake.size);for(let c of a.intake.sources.filter(a=>"error"===a.status))b.push("tr"===uq(a)?`${c.label} kaynağını inceleyemedim. Bu kaynak \xf6nemliyse şirket bağlamını manuel olarak doğrula.`:`I could not inspect ${c.label}. Confirm the company context manually if this source matters.`);return uB(b).slice(0,c.confirmationLimit)}(W),_=function(a){let b=[];for(let c of(a.company.name||b.push("Company or workspace name is missing."),a.company.mission||b.push("Mission is missing."),a.company.targetCustomer||b.push("Target customer is missing."),a.workspace.name||b.push("Workspace name is missing."),"clone"!==a.workspace.sourceMode||a.workspace.repoUrl||b.push("Clone mode needs a repository URL."),"existing"!==a.workspace.sourceMode||a.workspace.existingPath||b.push("Existing-folder mode needs a folder path."),a.team.persistentAgents.some(a=>a.enabled)||b.push("At least one persistent agent must be enabled."),a.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)||b.push("One enabled agent must be marked as primary."),a.operations.workflows.some(a=>a.enabled)||b.push("At least one enabled workflow is required."),a.operations.workflows.filter(a=>a.enabled)))c.name&&c.goal&&c.successDefinition||b.push(`Workflow "${c.name||c.id}" is incomplete.`),c.ownerAgentId&&!a.team.persistentAgents.some(a=>a.id===c.ownerAgentId&&a.enabled)&&b.push(`Workflow "${c.name}" points to a missing or disabled owner agent.`);for(let c of a.operations.automations.filter(a=>a.enabled))c.mission&&c.scheduleValue||b.push(`Automation "${c.name}" is incomplete.`),c.agentId&&!a.team.persistentAgents.some(a=>a.id===c.agentId&&a.enabled)&&b.push(`Automation "${c.name}" points to a missing or disabled agent.`);for(let c of a.operations.channels.filter(a=>a.enabled&&a.requiresCredentials))c.credentials.filter(a=>!a.value.trim()).length>0&&b.push(`Channel "${c.name}" is missing required credentials.`);return uB(b)}(W),aa=(C=[],D=ub((i=W).intake.size),0===i.product.nonGoals.length&&C.push("No non-goals are defined for V1."),0===i.product.launchPriority.length&&C.push("Launch priorities are not ordered yet."),0===i.company.successSignals.length&&C.push("Success signals are still empty."),0===i.workspace.stackDecisions.length&&"content"!==i.workspace.template&&C.push("Critical stack decisions are not captured yet."),D.automationCount>0&&!i.operations.automations.some(a=>a.enabled)&&C.push("No automation loops are enabled."),D.externalChannelCount>0&&!i.operations.channels.some(a=>"internal"!==a.type)&&C.push("Only internal channels are configured."),D.agentCount>=3&&i.team.maxParallelRuns<2&&C.push("Parallel run limit is conservative for a multi-agent workspace."),uB(C)),ab=(j=W).intake.reviewRequested||"deploying"===j.status||"deployed"===j.status;return W.intake.confirmations=$,W.intake.inferences=(E=[],F=(k=W).intake.sources.filter(a=>"ready"===a.status).map(a=>a.label),G=k.intake.confirmations.join(" ").toLowerCase(),k.company.name&&E.push(ug({section:"company",label:"Company",value:k.company.name,confidence:us(k,"company-name"),status:ut(G,"company"),rationale:F.length>0?"Derived from linked context and the current brief.":"Derived from the current brief.",sourceLabels:F})),k.company.mission&&E.push(ug({section:"company",label:"Mission",value:k.company.mission,confidence:us(k,"mission"),status:ut(G,"outcome"),rationale:"Architect condensed the first business outcome from the request.",sourceLabels:F})),k.company.targetCustomer&&E.push(ug({section:"company",label:"First audience",value:k.company.targetCustomer,confidence:us(k,"target-customer"),status:ut(G,"audience"),rationale:"This is the current best guess for the first user or buyer segment.",sourceLabels:F})),E.push(ug({section:"workspace",label:"Workspace type",value:uE(k.workspace.template),confidence:us(k,"template"),status:"inferred",rationale:"Template is inferred from the requested operating model and linked context.",sourceLabels:F})),E.push(ug({section:"workspace",label:"Starting point",value:"clone"===k.workspace.sourceMode?k.workspace.repoUrl||"Clone an existing repository":"existing"===k.workspace.sourceMode?k.workspace.existingPath||"Attach an existing folder":"Start from scratch",confidence:us(k,"source-mode"),status:ut(G,"start"),rationale:"This is how the workspace will be materialized when you deploy.",sourceLabels:F})),k.product.offer&&E.push(ug({section:"product",label:"Offer",value:k.product.offer,confidence:us(k,"offer"),status:"inferred",rationale:"Architect turned the brief into a concrete operator-facing offer.",sourceLabels:F})),(H=k.operations.channels.filter(a=>a.enabled&&"internal"!==a.type)).length>0&&E.push(ug({section:"operations",label:"External channels",value:H.map(a=>a.name).join(", "),confidence:us(k,"channels"),status:"inferred",rationale:"The request implies these operating channels should exist after deploy.",sourceLabels:F})),(I=k.team.persistentAgents.find(a=>a.enabled&&a.isPrimary))&&E.push(ug({section:"team",label:"Primary operator",value:`${I.name} (${I.role})`,confidence:us(k,"team"),status:"inferred",rationale:"Architect drafted a primary agent to own the first delivery loop.",sourceLabels:F})),(J=k.operations.workflows.find(a=>a.enabled))&&E.push(ug({section:"operations",label:"First workflow",value:J.name,confidence:us(k,"workflow"),status:"inferred",rationale:"This is the first operational loop the company would run after deploy.",sourceLabels:F})),E.slice(0,8)),W.intake.suggestedReplies=(l=W,m=$,K=uq(l),L=[],M=ub(l.intake.size),N=function(a){let b=a.intake.sources.filter(a=>"ready"===a.status).flatMap(a=>[a.label,a.summary,...a.details]).join(" ").toLowerCase();if(!b)return;let c=/\bweb3|onchain|crypto|blockchain|token\b/.test(b),d=/\bstartup|startups|founder|founders|business(?:es)?\b/.test(b),e=/\bcommunity|communities|member|members|holder|holders|nft|dao|governance\b/.test(b),f=/\bdeveloper|developers|builder|builders|engineer|engineers\b/.test(b),g=/\boperator|operators|moderator|moderators|admin|admins|ops\b/.test(b);return d&&e?c?"Web3 startups and token-led communities":"startups and their communities":d?c?"Web3 startups and founders":"startups and founders":e?c?"DAO, NFT, and Web3 communities":"community leads and members":f&&g?"developers and internal operators":f?"developers and technical teams":g?"internal operators and moderators":void 0}(l),O=up(l),l.company.targetCustomer||(N&&L.push("tr"===K?`İlk hedef kitle ${uv(N)} gibi g\xf6r\xfcn\xfcyor.`:`The first audience looks like ${uv(N)}.`),"content"===l.workspace.template?(L.push("tr"===K?"İlk kullanıcılar topluluk y\xf6neticileri ve moderat\xf6rler.":"The first users are community managers and moderators."),L.push("tr"===K?"İlk kullanıcılar daha hızlı moderasyon ve onboarding isteyen Telegram \xfcyeleri.":"The first users are Telegram members who need faster moderation and onboarding.")):L.push("tr"===K?"İlk kullanıcılar bu iş akışını her g\xfcn y\xfcr\xfcten operat\xf6rler.":"The first users are the operators running this workflow every day.")),l.company.mission||L.push("tr"===K?"İlk hedef, hacmi en y\xfcksek manuel iş akışını otomatikleştirmek.":"The first outcome is automating the highest-volume manual workflow."),!l.product.scopeV1.length&&l.company.mission&&l.company.targetCustomer&&L.push("tr"===K?"V1, genişlemeden \xf6nce en dar ama faydalı d\xf6ng\xfcy\xfc u\xe7tan uca \xe7\xf6zmeli.":"V1 should handle the narrowest useful loop end to end before we expand."),l.workspace.repoUrl||l.workspace.existingPath||ur(l.intake.latestPrompt||l.intake.initialPrompt)||(L.push("tr"===K?"Şimdilik varsayılan bir başlangı\xe7la ilerleyelim; kaynak t\xfcr\xfcn\xfc daha sonra istediğin gibi revize edebiliriz.":"We can proceed with a default starting point and revise the source later if you want."),L.push("tr"===K?"Eğer bir repo ya da mevcut klas\xf6r istiyorsan sonraki mesajda sadece onu s\xf6ylemen yeterli.":"If you want a repo or existing folder, just say so in the next edit.")),0===l.company.successSignals.length&&l.intake.turnCount>=2&&L.push("tr"===K?"Başarı; daha az manuel iş, daha hızlı yanıt s\xfcreleri ve daha net bir operasyon ritmi demek.":"Success means less manual work, faster response times, and a clearer operating cadence."),0!==m.length||O||(L.push("tr"===K?"İstersen bu taslağı şimdi daha keskin hale getirebiliriz.":"If you want, we can tighten this draft right now."),L.push("tr"===K?"Gelişmiş edit\xf6r\xfc a\xe7.":"Open the advanced editor.")),uB(L).slice(0,M.suggestedReplyLimit)),W.deploy.blockers=ab?_:[],W.deploy.warnings=ab?aa:[],W.readinessScore=(n=W,o=_,p=aa,q=ab,P=14,n.company.name&&(P+=10),n.company.mission&&(P+=15),n.company.targetCustomer&&(P+=15),n.product.offer&&(P+=10),n.product.scopeV1.length>0&&(P+=10),n.workspace.name&&(P+=10),n.intake.sources.length>0&&(P+=6),n.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)&&(P+=10),n.operations.workflows.some(a=>a.enabled)&&(P+=10),n.operations.automations.some(a=>a.enabled)&&(P+=5),q?(P-=12*o.length,P-=3*p.length):P-=4*Math.max(0,n.intake.confirmations.length-1),Math.max(0,Math.min(100,P))),W.architectSummary=function(a,b,c,d){let e=uq(a),f=up(a),g=a.intake.sources.find(a=>"website"===a.kind&&"ready"===a.status&&"number"==typeof a.confidence&&a.confidence<80&&!!a.label),h=a.team.persistentAgents.filter(a=>a.enabled).length,i=a.operations.workflows.filter(a=>a.enabled).length,j=a.operations.automations.filter(a=>a.enabled).length,k=a.intake.confirmations.length;if(!a.intake.started)return"tr"===e?"Tek mesajla başla.":"Start with one prompt.";if(!d&&f){let b=a.company.mission||a.product.offer||a.company.name||a.workspace.name,c="clone"===a.workspace.sourceMode?"tr"===e?"klon repo":"a cloned repo":"existing"===a.workspace.sourceMode?"tr"===e?"mevcut klas\xf6r":"an existing folder":"tr"===e?"sıfırdan":"scratch",d=!g||a.company.name||a.workspace.name?"":"tr"===e?`Site adı i\xe7in ${g.label} varsayımını kullandım.`:`I used ${g.label} as the site name.`;return"tr"===e?[d,b?`İlk taslak ${b} etrafında hazır.`:`İlk taslak ${c} başlangıcıyla hazır.`].filter(Boolean).join(" "):[d,b?`First pass ready around ${b}.`:`First pass ready from ${c}.`].filter(Boolean).join(" ")}return d?"tr"===e?[a.company.mission?`Odak: ${a.company.mission}.`:"Misyon kısa bir c\xfcmle istiyor.",a.company.targetCustomer?`Kitle: ${a.company.targetCustomer}.`:"Kitle a\xe7ık.",`${h} agent, ${i} g\xf6rev, ${j} automation.`,k>0?`${k} revizyon kaldı.`:b.length>0?`${b.length} blocker kaldı.`:c.length>0?`${c.length} warning var.`:"Deploy'a hazır."].join(" "):[a.company.mission?`Focus: ${a.company.mission}.`:"Mission still needs a short sentence.",a.company.targetCustomer?`Audience: ${a.company.targetCustomer}.`:"Audience open.",`${h} agents, ${i} workflows, ${j} automations.`,k>0?`${k} revision${1===k?"":"s"} left.`:b.length>0?`${b.length} blocker${1===b.length?"":"s"} remain.`:c.length>0?`${c.length} warning${1===c.length?"":"s"} remain.`:"Ready to deploy."].join(" "):"tr"===e?[a.company.mission?`Odak: ${a.company.mission}.`:a.company.name||a.workspace.name?`İlk \xe7ıktı: ${a.company.name||a.workspace.name}.`:"İlk \xe7ıktı netleşiyor.",a.company.targetCustomer?`Kitle: ${a.company.targetCustomer}.`:"Kitle a\xe7ık.",a.intake.sources.length>0?`${a.intake.sources.length} kaynak topladım.`:"URL, repo ya da kısa brief yeterli.",`${h} agent, ${i} g\xf6rev, ${j} automation.`,k>0?`${k} revizyon kaldı.`:"Revizyona hazır."].join(" "):[a.company.mission?`Focus: ${a.company.mission}.`:`First outcome: ${a.company.name||a.workspace.name||"this workspace"}.`,a.company.targetCustomer?`Audience: ${a.company.targetCustomer}.`:"Audience open.",a.intake.sources.length>0?`I have ${a.intake.sources.length} source${1===a.intake.sources.length?"":"s"}.`:"Add a URL, repo, or short brief.",`${h} agents, ${i} workflows, ${j} automations.`,k>0?`${k} revision${1===k?"":"s"} left.`:"Ready to revise."].join(" ")}(W,_,aa,ab),W.stage=(r=W,s=_,t=aa,u=$,v=ab,r.intake.started?!v&&up(r)?r.intake.sources.length>0?"context-harvest":"intake":"deploying"===r.status?"deploying":"deployed"===r.status?"deployed":(w=r).company.mission||w.product.offer||w.workspace.name||w.intake.sources.length>0?((x=r).company.name||x.workspace.name)&&x.company.mission&&x.team.persistentAgents.some(a=>a.enabled)&&x.operations.workflows.some(a=>a.enabled)?v?s.length>0?"pressure-test":t.length>0||r.readinessScore<90?"decision-lock":"ready":u.length>0?"team-synthesis":"decision-lock":"team-synthesis":r.intake.turnCount>1?"context-harvest":"intake":"intake"),W.status=(y=W,z=_,A=$,B=ab,y.intake.started?"deploying"===y.status||"deployed"===y.status?y.status:B?"blocked"===y.status&&z.length>0||z.length>0?"blocked":y.readinessScore>=90?"ready":"review":up(y)||A.length>0?"draft":"review":"draft"),W.updatedAt=new Date().toISOString(),W}function up(a){return a.intake.turnCount<=1&&!a.intake.reviewRequested}function uq(a,b){for(let d of[b,...a.conversation.slice().reverse().filter(a=>"user"===a.role).map(a=>a.text),a.intake.latestPrompt,a.intake.initialPrompt]){var c;let a=!function(a){let b=a?.trim();if(!b)return!1;if(/[çğıöşüÇĞİÖŞÜ]/.test(b))return!0;let c=b.toLowerCase().match(/\b(ve|bir|bu|şu|için|ile|olarak|olan|mı|mi|mu|mü|ne|nasıl|hangi|neden|hedef|ilk|müşteri|kullanıcı|oluştur|gerekli|alanları|yardımcı)\b/g);return!!(c&&c.length>=2)}(c=d)?!function(a){let b=a?.trim();if(!b||/[çğıöşüÇĞİÖŞÜ]/.test(b))return!1;let c=b.toLowerCase().match(/\b(let'?s|the|and|for|with|from|this|that|what|how|why|when|where|who|should|could|would|need|want|start|build|create|launch|project|workspace|customer|user|team|goal|mission|review|deploy|product|website|repo|folder)\b/g);return!!(c&&c.length>=2)}(c)?null:"en":"tr";if(a)return a}return"en"}function ur(a){return/\b(from scratch|greenfield|empty workspace|clone|repo|existing folder|existing workspace|s[ıi]f[ıi]rdan|mevcut klas[oö]r|mevcut repo|bo[sş])\b/i.test(a)}function us(a,b){let c=`${a.intake.initialPrompt} ${a.intake.latestPrompt}`.toLowerCase(),d=a.intake.sources.filter(a=>"ready"===a.status),e=66;return d.length>0&&(e+=8),a.intake.turnCount>1&&(e+=6),("template"===b&&/\b(telegram|discord|community|topluluk|grup|content|marketing|research|frontend|backend)\b/.test(c)||"source-mode"===b&&ur(c)||"channels"===b&&/\b(slack|telegram|discord|google chat)\b/.test(c))&&(e+=10),"company-name"===b&&d.some(a=>"website"===a.kind)&&(e+=6),"target-customer"!==b||a.company.targetCustomer||(e-=18),("workflow"===b||"team"===b)&&(e-=4),Math.max(52,Math.min(96,e))}function ut(a,b){return a.includes(b)?"needs-confirmation":"inferred"}function uu(a){let b=a.toLowerCase();return/\b(yapal[ıi]m|ekleyelim|başlatal[ıi]m|kural[ıi]m|olsun|diyelim|verelim|koyal[ıi]m|kurmak|kurulum|oluşturmak|oluşturma|başlatmak|başlama|yapmak|yapma|istiyorum|istiyoruz|istemek|want|build|create|make|start|launch|setup|set up)\b/.test(b)}function uv(a){return a?a.charAt(0).toLowerCase()+a.slice(1):a}function uw(a,b){return a.find(a=>RegExp(b,"i").test(`${a.id} ${a.role} ${a.name}`))?.id}function ux(a){return a.filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b)}function uy(a){return a.trim()}function uz(a){return a?.trim()||void 0}function uA(a){return uB((a??[]).flatMap(a=>a.split(/\r?\n|,/g).map(a=>a.trim()).filter(Boolean)).map(a=>a.trim()).filter(Boolean))}function uB(a){return Array.from(new Set(a.filter(Boolean)))}function uC(a){return structuredClone(a)}function uD(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function uE(a){return a.split(/[-_]/g).filter(Boolean).map(a=>a[0].toUpperCase()+a.slice(1)).join(" ")}function uF(a){let b="clone"===a.sourceMode?{label:"Cloning repository",description:"The repository is being cloned before workspace files are added."}:"existing"===a.sourceMode?{label:"Attaching existing folder",description:"Mission Control is validating the existing directory and preparing it for bootstrap."}:{label:"Preparing workspace folder",description:"A fresh workspace directory is being created inside the configured workspace root."};return{title:"Provisioning workspace",description:"Mission Control is creating the workspace and reporting each real bootstrap step as it finishes.",steps:[{id:"validate",label:"Checking input and target path",description:"Workspace input, agent ids, and the destination directory are being validated."},{id:"source",label:b.label,description:b.description},{id:"scaffold",label:"Scaffolding workspace files",description:"Core docs, local state, starter memory, and shared workspace metadata are being written."},{id:"agents",label:1===a.agentCount?"Creating the first agent":"Creating workspace agents",description:1===a.agentCount?"The primary agent is being provisioned and linked to the workspace.":"Each enabled agent is being provisioned and linked to the workspace."},{id:"kickoff",label:a.kickoffMission?"Running kickoff mission":"Finalizing workspace",description:a.kickoffMission?"The primary agent is inspecting the new workspace and refining the initial setup.":"Workspace bootstrap is wrapping up without a kickoff mission."}]}}function uG(a){return{title:a.title,description:a.description,percent:0,steps:a.steps.map(a=>({...a,status:"pending",percent:0,activities:[]}))}}let uH=new Set(["a","an","and","autonomous","automate","automated","automation","build","create","for","from","in","launch","new","of","on","project","run","runs","set","setup","start","that","the","to","up","workspace","adı","agent","ajan","asistan","benim","bide","bir","birde","de","diye","ekleyelim","gibi","i\xe7in","olarak","olsun","proje","şahsi","verelim","yeni"]);function uI(){return{name:"",goal:"",source:""}}function uJ(a){let b=a.trim();if(!b)return{kind:"empty",createSourceMode:"empty",label:"Fresh workspace",hint:"Mission Control will scaffold a new project folder."};if(uN(b))return{kind:"existing",createSourceMode:"existing",label:"Existing folder",hint:b,existingPath:b};if(uO(b))return{kind:"clone",createSourceMode:"clone",label:"Clone repository",hint:b,repoUrl:b};let c=uP(b);return c?uQ(c)?{kind:"clone",createSourceMode:"clone",label:"Clone repository",hint:c,repoUrl:c}:{kind:"website",createSourceMode:"empty",label:"Fresh workspace + website",hint:c,websiteUrl:c}:{kind:"context",createSourceMode:"empty",label:"Fresh workspace + context",hint:"The pasted source will be attached to the brief.",contextText:b}}function uK(a){let b=a.toLowerCase();return/\b(telegram|discord|community|channel automation|campaign|content|marketing|growth|seo|newsletter)\b/.test(b)?"content":/\b(frontend|ui|website|landing page|design system|dashboard)\b/.test(b)?"frontend":/\b(backend|api|service|microservice|worker|cron|queue|sdk)\b/.test(b)?"backend":/\b(research|investigation|analysis|benchmark|thesis)\b/.test(b)?"research":"software"}function uL(a){return a.name.trim()||function(a,b){let c=function(a){let b=a.trim();if(!b)return;if(uO(b))return uR(b.split(":").at(-1)??"");let c=uP(b);return c?uQ(c)?uR(new URL(c).pathname):function(a){try{let[b]=new URL(a).hostname.replace(/^www\./,"").split(".");if(!b)return;return b.split(/[-_]+/g).filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}catch{return}}(c):uN(b)?uR(b):void 0}(a);if(c)return c;let d=function(a){let b=a.match(/["“]([^"”]+)["”]/)?.[1]?.trim();if(b)return b;for(let b of[/\b(?:adı|ismi|name)\s*(?:olarak|:|=)?\s*([\p{L}\p{N}][\p{L}\p{N}._-]{1,40}(?:\s+[\p{L}\p{N}][\p{L}\p{N}._-]{1,40}){0,2})(?=\s+(?:olsun|olacak|diyelim|verelim|koyalım|olarak|için)\b|[.!?,]|$)/iu,/\b([\p{L}\p{N}][\p{L}\p{N}._-]{1,40}(?:\s+[\p{L}\p{N}][\p{L}\p{N}._-]{1,40}){0,2})\s+diye\b/iu]){let c=(a.match(b)?.[1]??"").replace(/\b(yeni|bir|workspace|project|proje|ekleyelim|kuralım|başlatalım|oluşturalım)\b/giu," ").replace(/\b(diye|olarak|benim|bide|bir de)\b.*$/iu,"").replace(/\s+/g," ").trim();if(c)return c}}(b);if(d)return d;let e=b.toLowerCase().replace(/[^a-z0-9\s-]+/g," ").split(/\s+/).map(a=>a.trim()).filter(a=>a&&!uH.has(a)).slice(0,4);return 0===e.length?"":e.map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}(a.source,a.goal)||"New Workspace"}function uM(a){let b=a.workspace.repoUrl?.trim()||a.workspace.existingPath?.trim()||a.intake.sources.find(a=>"website"===a.kind)?.url||a.intake.sources.find(a=>"prompt"===a.kind)?.summary||"";return{name:a.workspace.name||"",goal:a.company.mission||a.product.offer||a.intake.latestPrompt||"",source:b}}function uN(a){return a.startsWith("/")||a.startsWith("./")||a.startsWith("../")}function uO(a){return/^git@[^:]+:[^/].+/.test(a)}function uP(a){if(a.includes("@"))return null;let b=a.replace(/[),.;!?]+$/g,""),c=/^https?:\/\//i.test(b)?b:`https://${b}`;try{let a=new URL(c);return a.hostname.includes(".")?a.toString():null}catch{return null}}function uQ(a){try{let b=new URL(a),c=b.hostname.toLowerCase(),d=b.pathname.toLowerCase();return"github.com"===c||"gitlab.com"===c||"bitbucket.org"===c||d.endsWith(".git")}catch{return!1}}function uR(a){let b=a.replace(/\\/g,"/").replace(/\/+$/g,"").split("/").filter(Boolean).at(-1)?.replace(/\.git$/i,"");if(b)return b.split(/[-_]+/g).filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}let uS="workspace-wizard-basic-source",uT="Imported quick setup assumptions:";function uU(a="standard"){return{...tm,workspaceOnly:!0,generateStarterDocs:"fastest"!==a,generateMemory:"fastest"!==a,kickoffMission:"fastest"!==a}}function uV(a){return{...uU(),...a,workspaceOnly:!0}}function uW(a,b,c){let d=structuredClone(a),e=uJ(b.source),f=uL(b),g=b.goal.trim();return d.intake.mode=d.intake.mode||"guided",d.intake.started=!!(g||b.source.trim()),g&&(d.intake.initialPrompt||(d.intake.initialPrompt=g),d.intake.latestPrompt=g,d.company.mission=g,d.product.offer.trim()||(d.product.offer=g)),d.workspace.name=f,d.workspace.sourceMode=e.createSourceMode,d.workspace.repoUrl=e.repoUrl,d.workspace.existingPath=e.existingPath,d.workspace.template=uK(`${g}
164
+ ${b.source}`),d.workspace.modelProfile=d.workspace.modelProfile||"balanced",d.workspace.rules=uV(c??d.workspace.rules),d.intake.sources=d.intake.sources.filter(a=>a.id!==uS),"empty"!==e.kind&&d.intake.sources.unshift(uf({id:uS,kind:"clone"===e.kind?"repo":"existing"===e.kind?"folder":"website"===e.kind?"website":"prompt",label:e.label,summary:e.hint,details:[e.hint],url:e.repoUrl??e.websiteUrl})),uo(d)}function uX(a){return uV(a.workspace.rules)}let uY="mission-control-workspace-plan-id",uZ=[{id:"software",label:"Ship a software workspace",prompt:"Create a software workspace to ship product work, review changes, and keep durable project context."},{id:"frontend",label:"Spin up a frontend squad",prompt:"Create a frontend workspace for rapid UI delivery, QA, and release-ready product handoffs."},{id:"content",label:"Run a content engine",prompt:"Create a content workspace to plan campaigns, produce copy, and keep publishing operations organized."},{id:"research",label:"Start a research pod",prompt:"Create a research workspace for investigation, synthesis, benchmarking, and note capture."}];function u$({open:a,onOpenChange:b,initialMode:c="basic",workspaceEditId:d=null,surfaceTheme:e,snapshot:f,onRefresh:g,onWorkspaceCreated:h,onWorkspaceUpdated:i}){let j=!!d,k=function({open:a,initialMode:b,workspaceEditId:c,onRefresh:d,onWorkspaceCreated:e,onWorkspaceUpdated:f}){let[g,h]=(0,E.useState)(b),[i,j]=(0,E.useState)(null),[k,l]=(0,E.useState)(null),[m,n]=(0,E.useState)(!1),[o,p]=(0,E.useState)(uI),[q,r]=(0,E.useState)(()=>uU("fastest")),[s,t]=(0,E.useState)(null),[u,v]=(0,E.useState)(!1),[w,x]=(0,E.useState)(!1),[y,z]=(0,E.useState)(!1),[A,B]=(0,E.useState)(!1),[C,D]=(0,E.useState)(!1),[F,G]=(0,E.useState)(!1),[H,I]=(0,E.useState)(!1),[J,K]=(0,E.useState)(!1),[,L]=(0,E.useState)(null),[M,N]=(0,E.useState)(null),[O,P]=(0,E.useState)(null),[Q,R]=(0,E.useState)(0),[S,T]=(0,E.useState)(null),U=(0,E.useRef)(null),V=(0,E.useRef)(null),W=(0,E.useRef)(null),X=(0,E.useMemo)(()=>c?`${uY}:${c}`:uY,[c]),Y=(0,E.useMemo)(()=>uJ(o.source),[o.source]),Z=(0,E.useMemo)(()=>{let a;return(a=uV(q)).generateStarterDocs||a.generateMemory||a.kickoffMission?a.generateStarterDocs&&a.generateMemory&&a.kickoffMission?"standard":"custom":"fastest"},[q]),$=(0,E.useMemo)(()=>(function({initialTurn:a,step:b,active:c}){return c?a?b>=2?{title:"Still working",description:"The first turn is the slowest. The planner is usually inspecting links, extracting intent, and narrowing the plan."}:b>=1?{title:"Collecting context",description:"The architect is reading the prompt, extracting intent, and drafting the next clarifying question."}:{title:"Starting planner",description:"The architect is opening the planning session and preparing the first intent pass."}:b>=2?{title:"Still working",description:"The architect is waiting on the planner runtime. This can happen when linked context or advisor runs take longer."}:b>=1?{title:"Updating draft",description:"Refreshing context, specialist notes, and the current workspace plan."}:{title:"Architect thinking",description:"Applying your latest direction to the workspace draft."}:null})({initialTurn:!i?.intake.started,step:w?Q:0,active:w||H||J}),[J,H,w,i?.intake.started,Q]),_=(0,E.useCallback)(a=>(V.current=a,j(a),n(!!a),a)?(l(a.id),p(uM(a)),r(uX(a)),globalThis.localStorage?.setItem(X,a.id),a):(l(null),null),[X]),aa=(0,E.useCallback)(a=>{if(!i)return null;let b=uo(a(structuredClone(i)));return _(b),b},[_,i]),ab=(0,E.useCallback)(()=>globalThis.localStorage?.getItem(X)??null,[X]),ac=(0,E.useCallback)(()=>{globalThis.localStorage?.removeItem(X),n(!1)},[X]),ad=(0,E.useCallback)(async({resumeStored:a})=>{if(c){let b=a?globalThis.localStorage?.getItem(X):null;if(b){let a=await fetch(`/api/planner/${b}`,{cache:"no-store"});if(a.ok)return(await a.json()).plan}let d=await fetch(`/api/workspaces/${c}/edit-draft`,{method:"POST"}),e=await d.json();if(!d.ok||!e.plan)throw Error(e.error||"Unable to create workspace edit draft.");return e.seed&&(W.current=e.seed,L(e.seed)),e.plan}let b=a?globalThis.localStorage?.getItem(X):null;if(b){let a=await fetch(`/api/planner/${b}`,{cache:"no-store"});if(a.ok)return(await a.json()).plan}let d=await fetch("/api/planner",{method:"POST"}),e=await d.json();if(!d.ok||!e.plan)throw Error(e.error||"Unable to create planner workspace.");return e.plan},[X,c]),ae=(0,E.useCallback)(async({resumeStored:a,draftOverride:b})=>{if(i)return i;if(U.current)return U.current;let c=(async()=>{v(!0);try{let c=await ad({resumeStored:a}),d=b??o,e=d.goal.trim()||d.source.trim()||d.name.trim()?uW(c,d,q):c;return _(e)}catch(a){return ec.o.error("Workspace architect could not start.",{description:a instanceof Error?a.message:"Unknown planner error."}),null}finally{v(!1),U.current=null}})();return U.current=c,c},[o,q,_,i,ad]),af=(0,E.useCallback)(async()=>{if(t(null),N(null),P(null),x(!1),z(!1),B(!1),D(!1),G(!1),I(!1),T(null),U.current=null,c){ac(),j(null),V.current=null,l(null),await ae({resumeStored:!1,draftOverride:void 0})&&h("advanced");return}if("basic"===g){ac(),j(null),V.current=null,l(null),p(uI()),r(uU("fastest"));return}ac(),j(null),V.current=null,l(null);let a=uI();p(a),r(uU("fastest")),await ae({resumeStored:!1,draftOverride:a})&&h("advanced")},[ac,ae,g,c]),ag=(0,E.useCallback)(()=>{ac(),t(null)},[ac]),ah=(0,E.useCallback)(async a=>{let b=a??V.current;if(!b||!k)return!1;z(!0);try{let a=await fetch(`/api/planner/${k}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:b})}),c=await a.json();if(!a.ok||!c.plan)throw Error(c.error||"Unable to save planner workspace.");return _(c.plan),ec.o.success("Planner draft saved."),!0}catch(a){return ec.o.error("Planner draft could not be saved.",{description:a instanceof Error?a.message:"Unknown planner save error."}),!1}finally{z(!1)}},[_,k]),ai=(0,E.useCallback)(async a=>{let b=a??V.current;if(!b||!k)return!1;B(!0);try{let a=await fetch(`/api/planner/${k}/simulate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:b})}),c=await a.json();if(!a.ok||!c.plan)throw Error(c.error||"Unable to simulate planner team.");return _(c.plan),ec.o.success("Planner team simulated."),!0}catch(a){return ec.o.error("Planner simulation failed.",{description:a instanceof Error?a.message:"Unknown planner simulation error."}),!1}finally{B(!1)}},[_,k]),aj=(0,E.useCallback)(()=>{aa(a=>(a.intake.mode="advanced",a.intake.reviewRequested=!0,a.advisorNotes=[],a.conversation.push(ue("assistant","Workspace Architect","Deploy review is open now. I am surfacing the real blockers and warnings that matter before launch.")),a))},[aa]),ak=(0,E.useCallback)(async()=>{if(c)return null;let a=await ae({resumeStored:!1,draftOverride:o})??V.current;if(!a)return null;let b=uW(a,o,q);_(b),G(!0),P(uG(uF({sourceMode:b.workspace.sourceMode,agentCount:1,kickoffMission:b.workspace.rules.kickoffMission??!0})));try{var f;let a=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...{name:b.workspace.name,brief:[(f=b).company.mission.trim()||f.product.offer.trim(),f.company.name.trim()?`Company: ${f.company.name.trim()}`:null,f.product.scopeV1.length>0?`Scope: ${f.product.scopeV1.join(", ")}`:null,...f.intake.sources.flatMap(a=>a.id!==uS?[]:"repo"===a.kind&&a.url?[`Bootstrap source: clone ${a.url}`]:"folder"===a.kind?[`Bootstrap source: existing folder ${a.summary}`]:"website"===a.kind&&a.url?[`Reference website: ${a.url}`]:"prompt"===a.kind?[`Additional context: ${a.summary}`]:[])].filter(a=>!!a?.trim()).join("\n"),directory:b.workspace.directory,modelId:b.workspace.modelId,sourceMode:b.workspace.sourceMode,repoUrl:b.workspace.repoUrl,existingPath:b.workspace.existingPath,template:b.workspace.template,teamPreset:"solo",modelProfile:b.workspace.modelProfile||"balanced",docOverrides:b.workspace.docOverrides,rules:uV(b.workspace.rules)},stream:!0})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"OpenClaw could not create the workspace.")}let c=null,g=null;if(await t8(a,async a=>{"progress"===a.type?P(a.progress):(a.progress&&P(a.progress),a.ok?c=a.result:g=a.error)}),g||!c)throw Error(g||"OpenClaw could not create the workspace.");let h=c;return ac(),await d(),e(h.workspaceId),ec.o.success("Workspace created.",{description:`${h.agentIds.length} agent${1===h.agentIds.length?"":"s"} created at ${h.workspacePath}`}),h.kickoffError&&ec.o.message("Workspace created, but kickoff needs attention.",{description:h.kickoffError}),h}catch(a){return ec.o.error("Workspace creation failed.",{description:a instanceof Error?a.message:"Unknown workspace error."}),null}finally{G(!1)}},[o,q,ac,_,ae,d,e,c]),al=(0,E.useCallback)(async()=>{let a=V.current,b=W.current;if(!a||!c)return null;K(!0);try{let e=await fetch("/api/workspaces",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceId:c,name:a.workspace.name,directory:a.workspace.directory,plan:a,baseline:b})}),g=await e.json();if(!e.ok||g.error)throw Error(g.error||"OpenClaw could not update the workspace.");return ac(),await d(),f?.(g.workspaceId??c),ec.o.success("Workspace updated.",{description:g.workspacePath||a.workspace.directory||a.workspace.name}),g}catch(a){return ec.o.error("Workspace update failed.",{description:a instanceof Error?a.message:"Unknown workspace error."}),null}finally{K(!1)}},[ac,d,f,c]),am=(0,E.useCallback)(async()=>{var a;let b=V.current;if(!b||!k)return null;D(!0),N(uG({title:"Deploying workspace",description:"The planner is turning the blueprint into a live workspace and streaming each deploy stage.",steps:[{id:"plan",label:"Locking deploy plan",description:"Deploy blockers are being checked and the planner state is being locked for launch."},...uF({sourceMode:(a={sourceMode:b.workspace.sourceMode??"empty",agentCount:b.team.persistentAgents.filter(a=>a.enabled).length,kickoffMission:b.workspace.rules.kickoffMission??!0,hasChannels:!!b.operations.channels.some(a=>a.enabled&&"internal"!==a.type),hasAutomations:!!b.operations.automations.some(a=>a.enabled),hasPlannerKickoffs:!!b.deploy.firstMissions.some(a=>a.trim().length>0)}).sourceMode,agentCount:a.agentCount,kickoffMission:a.kickoffMission}).steps,{id:"blueprint",label:"Writing planner files",description:"Planner blueprint, company notes, and workflow docs are being written into the workspace."},{id:"channels",label:a.hasChannels?"Provisioning channels":"Checking channels",description:a.hasChannels?"Enabled external channels are being provisioned and connected.":"No external channels are enabled, so this stage will pass quickly."},{id:"automations",label:a.hasAutomations?"Provisioning automations":"Checking automation loops",description:a.hasAutomations?"Enabled recurring loops are being attached to their target agents.":"No recurring automations are enabled, so this stage is mostly validation."},{id:"planner-kickoff",label:a.hasPlannerKickoffs?"Running planner kickoff missions":"Finalizing deploy",description:a.hasPlannerKickoffs?"The first missions are being dispatched so the new workspace starts with clear momentum.":"The workspace is being finalized and the deploy request is wrapping up."}]}));try{let a=await fetch(`/api/planner/${k}/deploy`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:b,stream:!0})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Unable to deploy planner workspace.")}let c=null,f=null;if(await t8(a,async a=>{"progress"===a.type?N(a.progress):(a.progress&&N(a.progress),a.ok?c=a.result:f=a.error)}),f||!c)throw Error(f||"Unable to deploy planner workspace.");let g=c;return _(g.plan),ac(),await d(),e(g.workspaceId),ec.o.success("Workspace deployed.",{description:g.workspacePath}),g}catch(a){return ec.o.error("Planner deploy failed.",{description:a instanceof Error?a.message:"Unknown deploy error."}),null}finally{D(!1)}},[ac,_,d,e,k]),an=(0,E.useCallback)(async a=>{if(!a.trim())return!1;x(!0),T(a.trim());try{let c="advanced"===b&&!i&&!o.goal.trim()&&!o.source.trim()&&!o.name.trim(),d=await ae({resumeStored:c,draftOverride:o})??i;if(!d)return!1;let e=await fetch(`/api/planner/${d.id}/turn`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:a,plan:d})}),f=await e.json();if(!e.ok||!f.plan)throw Error(f.error||"Unable to process planner turn.");return _(f.plan),t(null),!0}catch(a){return ec.o.error("Planner turn failed.",{description:a instanceof Error?a.message:"Unknown planner turn error."}),!1}finally{T(null),x(!1)}},[o,_,ae,b,i]),ao=(0,E.useCallback)(async({path:a,currentContent:b,instruction:c})=>{if(!i||!k)return null;let d=a.trim();if(!d)return null;I(!0);try{let a=await fetch(`/api/planner/${k}/document-rewrite`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:i,path:d,currentContent:b,instruction:c?.trim()||"Rewrite this document to improve clarity, usefulness, and consistency with the workspace context."})}),e=await a.json();if(!a.ok||!e.plan)throw Error(e.error||"Unable to rewrite the document.");_(e.plan),t(null);let f=td({name:e.plan.workspace.name||"Workspace",brief:e.plan.company.mission||e.plan.product.offer||void 0,template:e.plan.workspace.template,sourceMode:e.plan.workspace.sourceMode,rules:e.plan.workspace.rules,agents:e.plan.team.persistentAgents.filter(a=>a.enabled),docOverrides:e.plan.workspace.docOverrides,toolExamples:[]}).find(a=>a.path===d);return ec.o.success(`Architect rewrote ${d}.`,{description:e.reply||"The document override has been updated."}),f?.content??null}catch(a){return ec.o.error("Document rewrite failed.",{description:a instanceof Error?a.message:"Unknown document rewrite error."}),null}finally{I(!1)}},[_,i,k]),ap=(0,E.useCallback)(async()=>{let a=ab();if(!a)return n(!1),!1;v(!0);try{let b=await fetch(`/api/planner/${a}`,{cache:"no-store"}),d=await b.json();if(!b.ok||!d.plan)throw Error(d.error||"Unable to load the stored planner draft.");return _(d.plan),h("advanced"),t({tone:"muted",title:c?"Resumed workspace edit":"Resumed previous draft",description:c?"Architect restored your earlier edit session so you can keep shaping the same workspace.":"Architect restored your earlier blueprint so you can keep shaping the same workspace."}),!0}catch(a){return ec.o.error("Stored draft could not be resumed.",{description:a instanceof Error?a.message:"Unknown planner error."}),!1}finally{v(!1),U.current=null}},[_,ab,c]),aq=(0,E.useCallback)(async a=>{if(a!==g){if(c){if("basic"===a)return;h("advanced");return}if("advanced"===a){let a=await ae({resumeStored:!1,draftOverride:o});if(!a)return;let b=uW(a,o,q),c=!b.intake.started&&b.conversation.filter(a=>"system"!==a.role).length<=1?function(a,b){let c=structuredClone(a),d=b.goal.trim(),e=b.source.trim();if(c.conversation=c.conversation.filter(a=>!("system"===a.role&&"Workspace Wizard"===a.author&&a.text.startsWith(uT))),!d&&!e)return uo(c);let f=[d?`goal: ${d}`:null,e?`source: ${e}`:null,`fast-path name: ${uL(b)}`].filter(Boolean);return c.conversation.push(ue("system","Workspace Wizard",`${uT} ${f.join(" \xb7 ")}`)),uo(c)}(b,o):b;_(c),t(c.intake.started||o.goal.trim()||o.source.trim()?{tone:"muted",title:"Same draft, deeper controls",description:"Architect will keep extending the exact same conversation and blueprint as you move into Advanced."}:null),h("advanced");return}if(i)p(uM(i)),r(uX(i)),t(i&&(i.team.persistentAgents.filter(a=>a.enabled).length>1||i.operations.workflows.some(a=>a.enabled)||i.operations.automations.some(a=>a.enabled)||i.operations.channels.some(a=>a.enabled&&"internal"!==a.type)||i.operations.hooks.some(a=>a.enabled))?{tone:"warning",title:"Advanced details preserved",description:"Basic mode will keep showing the fast path, but the richer blueprint remains in memory if you switch back."}:null);else t(null);h("basic")}},[o,q,_,ae,g,i,c]),ar=(0,E.useCallback)(a=>{p(b=>{let c={...b,goal:a};return"basic"===g&&j(a=>{let b=a?uW(a,c,q):a;return V.current=b,b}),c})},[q,g]),as=(0,E.useCallback)(a=>{p(b=>{let c={...b,source:a};return"basic"===g&&j(a=>{let b=a?uW(a,c,q):a;return V.current=b,b}),c})},[q,g]),at=(0,E.useCallback)(a=>{p(b=>{let c={...b,name:a};return"basic"===g&&j(a=>{let b=a?uW(a,c,q):a;return V.current=b,b}),c})},[q,g]),au=(0,E.useCallback)(a=>{let b=uU(a);r(b),j(a=>{let c=a?uW(a,o,b):a;return V.current=c,c})},[o]),av=(0,E.useCallback)(a=>{r(b=>{let c={...b,[a]:!b[a],workspaceOnly:!0};return j(a=>{let b=a?uW(a,o,c):a;return V.current=b,b}),c})},[o]);return{mode:g,plan:i,planId:k,hasStoredDraft:m,notice:s,sourceAnalysis:Y,basicDraft:o,basicRules:q,basicPreset:Z,isPlanLoading:u,isSending:w,isSaving:y,isSimulating:A,isDeploying:C,isCreating:F,isApplyingWorkspaceChanges:J,isDocumentRewriting:H,createProgress:O,deployProgress:M,architectBusyStatus:$,pendingUserMessage:S,setBasicGoal:ar,setBasicSource:as,setBasicName:at,setBasicPreset:au,toggleBasicRule:av,setNotice:t,updatePlan:aa,switchMode:aq,startFreshDraft:af,discardStoredDraft:ag,resumeStoredDraft:ap,savePlan:ah,simulatePlan:ai,requestReview:aj,createWorkspace:ak,deployPlan:am,applyWorkspaceChanges:al,submitArchitectTurn:an,rewriteDocumentWithArchitect:ao}}({open:a,initialMode:c,workspaceEditId:d,onRefresh:g,onWorkspaceCreated:h,onWorkspaceUpdated:i}),[l,m]=(0,E.useState)(""),[n,o]=(0,E.useState)(!1),[p,q]=(0,E.useState)(!1),[r,s]=(0,E.useState)(!1),[t,u]=(0,E.useState)("workspace.name"),[v,w]=(0,E.useState)("AGENTS.md"),x="light"===e,y=j?f.workspaces.find(a=>a.id===d)??null:null,z=a=>{a||(m(""),o(!1),q(!1),s(!1),u("workspace.name"),w("AGENTS.md")),b(a)},A=j?k.plan?.workspace.name??y?.name??uL(k.basicDraft):uL(k.basicDraft),B=j?k.plan?.workspace.template??y?.bootstrap.template??uK(`${k.basicDraft.goal}
165
+ ${k.basicDraft.source}`):uK(`${k.basicDraft.goal}
166
+ ${k.basicDraft.source}`),C=j?k.plan?.workspace.directory??y?.path??f.diagnostics.workspaceRoot:function(a,b,c=uJ(b.source)){if("existing"===c.kind&&c.existingPath)return c.existingPath;let d=uL(b).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return`${qZ(a)}/${d||"workspace"}`}(f.diagnostics.workspaceRoot,k.basicDraft,k.sourceAnalysis),F=(0,E.useMemo)(()=>{var a,b;let c;return a=k.mode,b=k.plan,c=[{id:"surface",label:j?"Editing workspace":"basic"===a?"Architect-assisted fast path":"Architect co-design",tone:"muted"}],b&&("basic"===a?b.intake.confirmations.length>0?c.push({id:"confirmations",label:`${b.intake.confirmations.length} decision${1===b.intake.confirmations.length?"":"s"} needed`,tone:b.intake.confirmations.length>1?"warning":"muted"}):b.intake.started&&c.push({id:"draft",label:"Draft synced live",tone:"muted"}):(b.intake.confirmations.length>0&&c.push({id:"confirmations",label:`${b.intake.confirmations.length} decision${1===b.intake.confirmations.length?"":"s"} needed`,tone:b.intake.confirmations.length>1?"warning":"muted"}),c.push({id:"stage",label:`Stage \xb7 ${tL(b.stage)}`,tone:"muted"}),c.push({id:"readiness",label:`${b.readinessScore}% drafted`,tone:b.readinessScore>=85?"success":b.readinessScore>=45?"warning":"muted"}),c.push({id:"status",label:`Status \xb7 ${b.status}`,tone:"blocked"===b.status?"danger":"ready"===b.status||"deployed"===b.status?"success":"review"===b.status?"warning":"muted"}))),c},[j,k.mode,k.plan]),G=(0,E.useMemo)(()=>{var a,b;let c;return a=k.plan,b=k.pendingUserMessage,c=a?.conversation.map(a=>({id:a.id,role:a.role,author:"assistant"===a.role?"Architect":"system"===a.role?"Workspace Wizard":a.author,text:a.text}))??[],b?.trim()&&c.push({id:"pending-user-message",role:"user",text:b.trim(),status:"pending"}),c},[k.pendingUserMessage,k.plan]),H=(0,E.useMemo)(()=>{let a=(k.plan?.intake.suggestedReplies??[]).filter(a=>a.trim().length>0).map((a,b)=>({id:`reply-${b}`,label:a,prompt:a})).slice(0,"basic"===k.mode?3:4);return a.length>0?a:k.plan?.intake.started?[]:uZ.slice(0,"basic"===k.mode?3:4)},[k.mode,k.plan?.intake.started,k.plan?.intake.suggestedReplies]),I=k.isCreating?k.createProgress:k.isDeploying?k.deployProgress:null,J=k.isSending||k.isPlanLoading||k.isDeploying||k.isCreating||k.isDocumentRewriting||k.isApplyingWorkspaceChanges,K="basic"===k.mode&&k.hasStoredDraft&&!k.plan&&!k.isPlanLoading,L=j?!!(k.plan||l.trim()):!!(k.plan?.intake.started||k.basicDraft.goal.trim()||l.trim()),M=!!(k.plan?.intake.started||k.basicDraft.name.trim()||k.basicDraft.goal.trim()||k.basicDraft.source.trim()||l.trim()),O=j||"basic"!==k.mode?null:(0,D.jsx)(u2,{surfaceTheme:e,name:k.basicDraft.name,source:k.basicDraft.source,onNameChange:k.setBasicName,onSourceChange:k.setBasicSource}),P=async a=>{let b=(a??l).trim();if(!b)return!1;let c=void 0===a;c&&m("");let d=await k.submitArchitectTurn(b);return!d&&c&&m(l),d},Q=async()=>{if(j){if(!(!l.trim()||await P()))return;await k.applyWorkspaceChanges()&&z(!1);return}(!l.trim()||await P())&&await k.createWorkspace()&&z(!1)},R=async()=>{j||await k.deployPlan()&&z(!1)},S=async(a,b)=>{let c=b.trim()?{...a,conversation:[...a.conversation,ue("system","Workspace Wizard",b)]}:a;return k.savePlan(c)},T=async(a,b)=>{let c=b.trim()?{...a,conversation:[...a.conversation,ue("system","Workspace Wizard",b)]}:a;return k.savePlan(c)},U=(a="workspace.name")=>{u(a),o(!1),q(!0),s(!1)},V=a=>{w(a),o(!1),q(!1),s(!0)};return(0,D.jsx)(dx,{open:a,onOpenChange:z,children:(0,D.jsxs)(d_,{className:x?"h-[92vh] max-w-[min(1380px,96vw)] gap-0 overflow-hidden border-[#e7dfd4] bg-[#fcfaf6] p-0 text-[#161411] shadow-[0_40px_140px_rgba(16,12,8,0.45)]":"h-[92vh] max-w-[min(1380px,96vw)] gap-0 overflow-hidden border-white/10 bg-[rgba(4,8,15,0.96)] p-0 text-white shadow-[0_40px_140px_rgba(0,0,0,0.58)]",children:[(0,D.jsx)(d2,{className:"sr-only",children:j?"Edit workspace":"Create workspace"}),(0,D.jsx)(d3,{className:"sr-only",children:j?"Edit the existing workspace blueprint, documents, and agents using Architect.":"Create a workspace in Basic or Advanced mode using the Architect wizard."}),(0,D.jsxs)("div",{className:"relative flex h-full min-h-0 flex-col overflow-hidden",children:[(0,D.jsx)("div",{className:x?"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_top,rgba(255,255,255,0.86),transparent_34%),linear-gradient(180deg,rgba(248,244,237,0.92),rgba(252,250,246,0.86)_24%,rgba(244,238,230,0.82)_100%)]":"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_top,rgba(59,130,246,0.14),transparent_28%),radial-gradient(circle_at_80%_18%,rgba(56,189,248,0.12),transparent_24%),linear-gradient(180deg,rgba(9,15,27,0.98),rgba(4,8,15,0.96)_28%,rgba(2,6,13,0.98)_100%)]"}),(0,D.jsx)(t0,{surfaceTheme:e,mode:k.mode,onModeChange:a=>{k.switchMode(a)},onNewDraft:j?void 0:()=>{m(""),o(!1),q(!1),s(!1),k.startFreshDraft()},title:j?"Edit workspace":"Create workspace",showModeToggle:!j,showNewDraft:!j,badges:F}),(0,D.jsxs)("div",{className:"relative z-[1] grid min-h-0 flex-1 lg:grid-cols-[minmax(0,1fr),390px] xl:grid-cols-[minmax(0,1fr),420px]",children:[(0,D.jsxs)("div",{className:x?"flex min-h-0 flex-col bg-[linear-gradient(180deg,rgba(252,250,246,0.7),rgba(247,242,235,0.92))]":"flex min-h-0 flex-col bg-[linear-gradient(180deg,rgba(8,13,24,0.2),rgba(6,10,18,0.42))]",children:[(0,D.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[k.architectBusyStatus?(0,D.jsx)("div",{className:x?"border-b border-[#ece5db] px-4 py-2.5 md:px-5":"border-b border-white/10 px-4 py-2.5 md:px-5",children:(0,D.jsxs)("div",{className:x?"rounded-2xl border border-[#e6dfd5] bg-white px-3 py-2":"rounded-2xl border border-white/10 bg-white/[0.04] px-3 py-2",children:[(0,D.jsx)("p",{className:x?"text-[10px] uppercase tracking-[0.2em] text-[#8b7262]":"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:k.architectBusyStatus.title}),(0,D.jsx)("p",{className:x?"mt-1 text-[12px] leading-5 text-[#6d665e]":"mt-1 text-[12px] leading-5 text-slate-300",children:k.architectBusyStatus.description})]})}):null,(0,D.jsx)("div",{className:"min-h-0 flex-1",children:(0,D.jsx)(t4,{surfaceTheme:e,messages:G,isTyping:k.isSending,typingLabel:"Architect is shaping the next pass...",emptyState:k.isPlanLoading&&0===G.length?(0,D.jsx)(u1,{surfaceTheme:e}):0===G.length&&"basic"===k.mode?(0,D.jsx)(u_,{surfaceTheme:e}):0===G.length?(0,D.jsx)(u0,{surfaceTheme:e}):null,auxiliary:(0,D.jsxs)(D.Fragment,{children:[K?(0,D.jsx)(u3,{surfaceTheme:e,isBusy:J,onResume:()=>{k.resumeStoredDraft()},onStartFresh:k.discardStoredDraft}):null,I?(0,D.jsx)("div",{className:"mx-auto w-full max-w-3xl",children:(0,D.jsx)(s9,{progress:I,className:x?"border-[#e6dfd5] bg-white":"border-white/10 bg-slate-950/50"})}):null]})})})]}),(0,D.jsx)("div",{className:x?"border-t border-[#ece5db] bg-[linear-gradient(180deg,rgba(252,250,246,0.7),rgba(247,242,235,0.92))] px-4 py-4 md:px-5":"border-t border-white/10 bg-[linear-gradient(180deg,rgba(5,9,18,0.68),rgba(4,8,15,0.94))] px-4 py-4 md:px-5",children:(0,D.jsxs)("div",{className:"mx-auto w-full max-w-3xl",children:[(0,D.jsx)(t7,{surfaceTheme:e,chips:H.map(a=>({id:a.id,label:a.label})),disabled:J,onSelect:a=>{let b=H.find(b=>b.id===a.id);b&&P(b.prompt)},className:"mb-2.5"}),(0,D.jsx)(t3,{surfaceTheme:e,value:l,onChange:m,onSubmit:async()=>{await P()},placeholder:j?"Tell Architect what to change in this workspace...":"basic"===k.mode?"Describe what this workspace should do...":"Refine the blueprint with Architect...",disabled:J,isBusy:k.isSending,helperText:j?"Architect updates the existing workspace draft as you chat.":"basic"===k.mode?"Architect keeps the fast-path draft synced as you chat.":"Architect updates the shared blueprint on every turn.",toolbar:j?(0,D.jsx)("span",{className:x?"inline-flex items-center rounded-full border border-[#e3ddd4] bg-[#f6f1ea] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-[#6c645b]":"inline-flex items-center rounded-full border border-white/10 bg-white/[0.05] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-slate-300",children:"Editing draft"}):"basic"!==k.mode||k.plan?k.plan?(0,D.jsxs)("span",{className:x?"inline-flex items-center rounded-full border border-[#e3ddd4] bg-[#f6f1ea] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-[#6c645b]":"inline-flex items-center rounded-full border border-white/10 bg-white/[0.05] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-slate-300",children:["Stage \xb7 ",tL(k.plan.stage)]}):null:(0,D.jsx)("span",{className:x?"inline-flex items-center rounded-full border border-[#e3ddd4] bg-[#f6f1ea] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-[#6c645b]":"inline-flex items-center rounded-full border border-white/10 bg-white/[0.05] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-slate-300",children:"Live draft"})})]})})]}),(0,D.jsx)(tQ,{className:"hidden lg:block",surfaceTheme:e,workspaceMode:j?"edit":"create",mode:k.mode,snapshot:f,basicQuickSetup:O,plan:k.plan,resolvedName:A,resolvedTemplate:B,sourceAnalysis:k.sourceAnalysis,workspacePath:C,notice:k.notice,basicRules:k.basicRules,basicPreset:k.basicPreset,onOpenBlueprintEditor:U,onOpenDocumentEditor:V,onBasicPresetChange:k.setBasicPreset,onBasicRuleToggle:k.toggleBasicRule,progress:j?null:"basic"===k.mode?k.createProgress:k.isDeploying?k.deployProgress:null})]}),n?(0,D.jsxs)("div",{className:x?"absolute inset-0 z-20 flex flex-col bg-[rgba(22,18,14,0.18)] backdrop-blur-sm lg:hidden":"absolute inset-0 z-20 flex flex-col bg-[rgba(2,6,13,0.56)] backdrop-blur-sm lg:hidden",children:[(0,D.jsxs)("div",{className:x?"flex items-center justify-between border-b border-[#e7dfd4] bg-[#fcfaf6] px-4 py-3":"flex items-center justify-between border-b border-white/10 bg-[rgba(4,8,15,0.96)] px-4 py-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:x?"text-[11px] uppercase tracking-[0.18em] text-[#9f958a]":"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:"basic"===k.mode?"Workspace draft":"Workspace blueprint"}),(0,D.jsx)("p",{className:x?"text-[13px] text-[#6f675e]":"text-[13px] text-slate-300",children:"Review the structured side of the same wizard."})]}),(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[k.plan?(0,D.jsx)(bq,{type:"button",variant:"secondary",size:"sm",onClick:()=>U(),className:x?"rounded-full border-[#ddd6cb] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",children:"Edit details"}):null,(0,D.jsx)("button",{type:"button",onClick:()=>o(!1),className:x?"inline-flex size-9 items-center justify-center rounded-full border border-[#e4ddd3] bg-white text-[#4f4943] transition-colors hover:bg-[#f4efe7]":"inline-flex size-9 items-center justify-center rounded-full border border-white/10 bg-white/[0.05] text-slate-200 transition-colors hover:bg-white/[0.08]",children:(0,D.jsx)(dZ,{className:"h-4 w-4"})})]})]}),(0,D.jsx)(tQ,{className:"min-h-0 flex-1 border-t-0 lg:hidden",surfaceTheme:e,workspaceMode:j?"edit":"create",mode:k.mode,snapshot:f,basicQuickSetup:O,plan:k.plan,resolvedName:A,resolvedTemplate:B,sourceAnalysis:k.sourceAnalysis,workspacePath:C,notice:k.notice,basicRules:k.basicRules,basicPreset:k.basicPreset,onOpenBlueprintEditor:U,onOpenDocumentEditor:V,onBasicPresetChange:k.setBasicPreset,onBasicRuleToggle:k.toggleBasicRule,progress:j?null:"basic"===k.mode?k.createProgress:k.isDeploying?k.deployProgress:null})]}):null,p&&k.plan?(0,D.jsx)(tq,{open:p,surfaceTheme:e,plan:k.plan,busy:k.isSaving,focus:t,onClose:()=>q(!1),onSave:S},`${k.plan.id}:${t}`):null,r&&k.plan?(0,D.jsx)(tA,{open:r,surfaceTheme:e,plan:k.plan,path:v,busy:k.isSaving,rewriteBusy:k.isDocumentRewriting,onClose:()=>s(!1),onSave:T,onRewriteWithArchitect:k.rewriteDocumentWithArchitect},`${k.plan.id}:${v}`):null,(0,D.jsx)("div",{className:x?"relative z-[1] border-t border-[#e7dfd4] bg-white/90 px-4 py-3 backdrop-blur-sm md:px-5":"relative z-[1] border-t border-white/10 bg-[rgba(4,8,15,0.88)] px-4 py-3 backdrop-blur-sm md:px-5",children:(0,D.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[(0,D.jsx)("p",{className:x?"text-[13px] text-[#776f65]":"text-[13px] text-slate-300",children:"basic"===k.mode?"Chat stays fast. Open the blueprint for details.":"Chat and blueprint stay synced as you refine the plan."}),(0,D.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,D.jsxs)(bq,{variant:"secondary",size:"sm",className:x?"rounded-full border-[#dfd8ce] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3] lg:hidden":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08] lg:hidden",onClick:()=>o(!0),children:[(0,D.jsx)(s8,{className:"mr-2 h-4 w-4"}),"View blueprint"]}),j?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(bq,{variant:"secondary",size:"sm",className:x?"rounded-full border-[#dfd8ce] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",onClick:()=>void k.savePlan(),disabled:!k.plan||k.isSaving||k.isPlanLoading,children:[k.isSaving?(0,D.jsx)(N,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save draft"]}),(0,D.jsxs)(bq,{size:"sm",className:x?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>void Q(),disabled:!L||k.isPlanLoading||k.isSending||k.isSaving||k.isApplyingWorkspaceChanges,children:[k.isApplyingWorkspaceChanges?(0,D.jsx)(N,{className:"mr-2 h-4 w-4 animate-spin"}):(0,D.jsx)(cm,{className:"mr-2 h-4 w-4"}),"Apply changes"]})]}):"basic"===k.mode?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(bq,{variant:"secondary",size:"sm",className:x?"rounded-full border-[#dfd8ce] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",onClick:()=>{k.switchMode("advanced")},disabled:k.isCreating||k.isSending||k.isPlanLoading,children:"Advanced details"}),(0,D.jsxs)(bq,{size:"sm",className:x?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>void Q(),disabled:k.isCreating||k.isSending||k.isPlanLoading||!M,children:[k.isCreating?(0,D.jsx)(N,{className:"mr-2 h-4 w-4 animate-spin"}):(0,D.jsx)(cm,{className:"mr-2 h-4 w-4"}),"Create workspace"]})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(bq,{variant:"secondary",size:"sm",className:x?"rounded-full border-[#dfd8ce] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",onClick:()=>void k.savePlan(),disabled:!k.plan||k.isSaving||k.isPlanLoading,children:[k.isSaving?(0,D.jsx)(N,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save draft"]}),k.plan?.intake.reviewRequested?(0,D.jsxs)(bq,{size:"sm",className:x?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>void R(),disabled:!k.plan||k.plan.deploy.blockers.length>0||k.isDeploying||k.isPlanLoading,children:[k.isDeploying?(0,D.jsx)(N,{className:"mr-2 h-4 w-4 animate-spin"}):(0,D.jsx)(cp,{className:"mr-2 h-4 w-4"}),"Deploy workspace"]}):(0,D.jsx)(bq,{size:"sm",className:x?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>k.requestReview(),disabled:!k.plan||k.isSending||k.isDeploying,children:"Review blueprint"})]})]})]})})]})]})})}function u_({surfaceTheme:a}){let b="light"===a;return(0,D.jsxs)("div",{className:"mx-auto mt-4 flex w-full max-w-2xl flex-col gap-3 px-4 md:mt-12 md:px-6",children:[(0,D.jsx)("p",{className:bc("text-[10px] uppercase tracking-[0.22em]",b?"text-[#8b7262]":"text-slate-500"),children:"Fast path"}),(0,D.jsx)("p",{className:b?"text-[24px] font-semibold tracking-[-0.03em] text-[#181612]":"text-[24px] font-semibold tracking-[-0.03em] text-white",children:"Start with one prompt."}),(0,D.jsx)("p",{className:b?"text-[15px] leading-7 text-[#7f756b]":"text-[15px] leading-7 text-slate-400",children:"Tell Architect what this workspace should do. It will reflect the intent back and ask the next critical question."})]})}function u0({surfaceTheme:a}){let b="light"===a;return(0,D.jsxs)("div",{className:"mx-auto mt-4 flex w-full max-w-2xl flex-col gap-3 px-4 md:mt-12 md:px-6",children:[(0,D.jsx)("p",{className:bc("text-[10px] uppercase tracking-[0.22em]",b?"text-[#8b7262]":"text-slate-500"),children:"Blueprint mode"}),(0,D.jsx)("p",{className:b?"text-[24px] font-semibold tracking-[-0.03em] text-[#181612]":"text-[24px] font-semibold tracking-[-0.03em] text-white",children:"Shape the workspace with Architect."}),(0,D.jsx)("p",{className:b?"text-[15px] leading-7 text-[#7f756b]":"text-[15px] leading-7 text-slate-400",children:"Describe the operating model, and the structured draft updates as you chat."})]})}function u1({surfaceTheme:a}){return(0,D.jsxs)("div",{className:"light"===a?"mx-auto mt-10 flex w-full max-w-2xl items-center gap-3 rounded-2xl border border-[#e6dfd5] bg-white px-4 py-3 text-[13px] text-[#6d665e]":"mx-auto mt-10 flex w-full max-w-2xl items-center gap-3 rounded-2xl border border-white/10 bg-white/[0.04] px-4 py-3 text-[13px] text-slate-300",children:[(0,D.jsx)(N,{className:"h-4 w-4 animate-spin"}),"Architect is opening the planning session and extracting intent from the latest brief."]})}function u2({surfaceTheme:a,name:b,source:c,onNameChange:d,onSourceChange:e}){let f="light"===a;return(0,D.jsx)("div",{className:f?"mx-auto w-full max-w-3xl rounded-2xl border border-[#e4ddd3] bg-white p-3.5 shadow-[0_18px_56px_rgba(56,47,38,0.06)]":"mx-auto w-full max-w-3xl rounded-2xl border border-white/10 bg-white/[0.04] p-3.5 shadow-[0_18px_56px_rgba(0,0,0,0.24)]",children:(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("span",{className:f?"inline-flex size-8 shrink-0 items-center justify-center rounded-full border border-[#e4ddd3] bg-[#faf6f1] text-[#5e5750]":"inline-flex size-8 shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/[0.05] text-slate-300",children:(0,D.jsx)(cm,{className:"h-3.5 w-3.5"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("p",{className:f?"text-[10px] uppercase tracking-[0.2em] text-[#8b7262]":"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Quick details"}),(0,D.jsx)("p",{className:f?"mt-1 text-[12px] leading-5 text-[#70685f]":"mt-1 text-[12px] leading-5 text-slate-300",children:"Optional name and source live here. Architect can still infer both from the prompt."}),(0,D.jsxs)("div",{className:"mt-3 grid gap-2.5 md:grid-cols-2",children:[(0,D.jsx)(u4,{surfaceTheme:a,label:"Workspace name",children:(0,D.jsx)(br,{value:b,onChange:a=>d(a.target.value),placeholder:"Optional. Architect can infer it.",className:f?"border-[#e4ddd3] bg-[#fcfaf6] text-[#1c1916] placeholder:text-[#9b948c] focus-visible:ring-[#b8ada1]":"border-white/10 bg-[rgba(4,8,15,0.64)] text-slate-100 placeholder:text-slate-500 focus-visible:ring-cyan-300/60"})}),(0,D.jsx)(u4,{surfaceTheme:a,label:"Source",children:(0,D.jsx)(br,{value:c,onChange:a=>e(a.target.value),placeholder:"Repo URL, website URL, or existing folder path",className:f?"border-[#e4ddd3] bg-[#fcfaf6] text-[#1c1916] placeholder:text-[#9b948c] focus-visible:ring-[#b8ada1]":"border-white/10 bg-[rgba(4,8,15,0.64)] text-slate-100 placeholder:text-slate-500 focus-visible:ring-cyan-300/60"})})]})]})]})})}function u3({surfaceTheme:a,isBusy:b,onResume:c,onStartFresh:d}){let e="light"===a;return(0,D.jsx)("div",{className:e?"mx-auto w-full max-w-3xl rounded-[22px] border border-[#e4ddd3] bg-[#fffaf3] px-4 py-4 shadow-[0_18px_48px_rgba(56,47,38,0.05)]":"mx-auto w-full max-w-3xl rounded-[22px] border border-white/10 bg-white/[0.05] px-4 py-4",children:(0,D.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:e?"text-[11px] uppercase tracking-[0.18em] text-[#8b7262]":"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:"Previous draft found"}),(0,D.jsx)("p",{className:e?"mt-1 text-[14px] leading-6 text-[#30261d]":"mt-1 text-[14px] leading-6 text-white",children:"Architect still has an earlier workspace blueprint. Resume it or start fresh before creating a new one."})]}),(0,D.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,D.jsx)(bq,{variant:"secondary",size:"sm",className:e?"rounded-full border-[#dfd8ce] bg-white text-[#403934] hover:bg-[#f7f2eb]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",onClick:d,disabled:b,children:"Start fresh"}),(0,D.jsx)(bq,{size:"sm",className:e?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:c,disabled:b,children:"Resume blueprint"})]})]})})}function u4({surfaceTheme:a,label:b,children:c}){return(0,D.jsxs)("div",{className:"space-y-1.5",children:[(0,D.jsx)("p",{className:"light"===a?"text-[11px] uppercase tracking-[0.16em] text-[#8d8276]":"text-[11px] uppercase tracking-[0.16em] text-slate-500",children:b}),c]})}function u5({initialSnapshot:a}){var b,c,d,e,f,g,h;let{snapshot:i,connectionState:j,refresh:k,refreshSnapshot:l,setSnapshot:m}=function(a){let[b,c]=(0,E.useState)(a),[d,e]=(0,E.useState)("connecting"),f=async()=>{let a=await fetch("/api/snapshot",{cache:"no-store"}),b=await a.json();return(0,E.startTransition)(()=>{c(b),e("live")}),b};return{snapshot:b,connectionState:d,refresh:async()=>{await f()},refreshSnapshot:f,setSnapshot:c}}(a),[n,o]=(0,E.useState)(a.workspaces[0]?.id??null),[p,q]=(0,E.useState)(a.workspaces[0]?.id??null),[r,s]=(0,E.useState)(null),[t,u]=(0,E.useState)("overview"),[v,w]=(0,E.useState)(null),[x,y]=(0,E.useState)(null),[z,A]=(0,E.useState)([]),[B,C]=(0,E.useState)(null),[F,G]=(0,E.useState)([]),[H,I]=(0,E.useState)([]),[J,K]=(0,E.useState)([]),[Q,R]=(0,E.useState)(null),[S,T]=(0,E.useState)(null),[U,V]=(0,E.useState)("idle"),[W,X]=(0,E.useState)(null),Y=(0,E.useRef)(new Map),[Z,$]=(0,E.useState)(!1),[_,aa]=(0,E.useState)(!1),[ab,ac]=(0,E.useState)(!1),[ad,ae]=(0,E.useState)(!1),[af,ag]=(0,E.useState)(null),[ah,ai]=(0,E.useState)("idle"),[aj,ak]=(0,E.useState)(null),[al,am]=(0,E.useState)(null),[an,ao]=(0,E.useState)("idle"),[ap,aq]=(0,E.useState)(null),[ar,as]=(0,E.useState)(null),[at,au]=(0,E.useState)(null),[av,aw]=(0,E.useState)(""),[ax,ay]=(0,E.useState)(""),[az,aA]=(0,E.useState)(()=>ve(a)),[aB,aC]=(0,E.useState)(()=>vf(a)),[aD,aE]=(0,E.useState)(!1),[aF,aG]=(0,E.useState)(!1),[aH,aI]=(0,E.useState)(!1),[aJ,aK]=(0,E.useState)("idle"),[aL,aM]=(0,E.useState)(null),[aN,aO]=(0,E.useState)(null),[aP,aQ]=(0,E.useState)(""),[aR,aS]=(0,E.useState)("idle"),[aT,aU]=(0,E.useState)(null),[aV,aW]=(0,E.useState)(null),[aX,aY]=(0,E.useState)(null),[aZ,a$]=(0,E.useState)(""),[a_,a0]=(0,E.useState)(null),[a1,a2]=(0,E.useState)(null),[a3,a4]=(0,E.useState)("system"),[a5,a6]=(0,E.useState)(""),[a7,a8]=(0,E.useState)([]),[a9,ba]=(0,E.useState)("idle"),[bb,bd]=(0,E.useState)(null),[be,bf]=(0,E.useState)(null),[bg,bh]=(0,E.useState)(null),[bi,bj]=(0,E.useState)(""),[bk,bl]=(0,E.useState)(null),[bm,bn]=(0,E.useState)(null),[bo,bp]=(0,E.useState)(!1),[br,bs]=(0,E.useState)(!1),[bt,bu]=(0,E.useState)(!1),[bv,bw]=(0,E.useState)(()=>sA(a)),[bx,by]=(0,E.useState)(null),[bz,bA]=(0,E.useState)(null),[bB,bC]=(0,E.useState)("dark"),[bD,bE]=(0,E.useState)(!1),[bF,bG]=(0,E.useState)("basic"),[bH,bI]=(0,E.useState)(null),[bJ,bK]=(0,E.useState)(!1),[bL,bM]=(0,E.useState)(null),[bN,bO]=(0,E.useState)(null),bP=(0,E.useMemo)(()=>(function(a,b){if(0===b.length)return a;let c=b.filter(b=>!b.dispatchId||!a.tasks.some(a=>a.dispatchId===b.dispatchId)).map(a=>a.task);return 0===c.length?a:{...a,tasks:[...c,...a.tasks]}})(i,z),[i,z]),bQ=(0,E.useCallback)((a,b="overview")=>{q(a),u(b)},[]),bR=(0,E.useRef)(null);(0,E.useRef)(null);let bS=i.runtimes.filter(a=>"running"===a.status||"queued"===a.status).length,bT=sz(i),bU=sA(i),bV=[i.diagnostics.updatePackageManager,i.diagnostics.updateInstallKind].filter(Boolean).join(" \xb7 "),bW="running"===aJ,bX="success"===aJ||"error"===aJ,bY="running"===(b=aJ)?"Updating OpenClaw":"success"===b?"Update complete":"error"===b?"Update failed":"Update OpenClaw",bZ="running"===(c=aJ)?"OpenClaw is being updated now. Local gateway activity may pause briefly while the CLI is replaced.":"success"===c?"The CLI update finished. Review the result below, then close this panel when you are done.":"error"===c?"The update did not complete cleanly. Review the result and captured output before trying again.":"This runs openclaw update against the installed CLI and may briefly interrupt local gateway activity.",b$=(d=i).diagnostics.installed?sz(d)?{label:"Enter Mission Control",description:"OpenClaw is online and the runtime state is writable."}:d.diagnostics.rpcOk?{label:"Repair runtime access",description:"OpenClaw is online, but Mission Control still needs verified write access to the runtime state."}:d.diagnostics.loaded?(!d.diagnostics.rpcOk,{label:"Start OpenClaw",description:"Start the local gateway service and wait for a live RPC connection."}):{label:"Prepare local gateway",description:"OpenClaw CLI is already ready. Mission Control will register the local gateway service once, then start it."}:{label:"Install OpenClaw",description:"Download the OpenClaw CLI and prepare this machine for Mission Control."},b_=bS>0||z.length>0,b0=!bo&&!bU&&!b_&&(!bv||"offline"===i.diagnostics.health),b1=bP.tasks.filter(a=>!n||a.workspaceId===n).filter(a=>vb(a,F,H,J)).length,b2=(0,E.useCallback)(a=>{let b=bP.tasks.filter(b=>b.workspaceId===a).filter(a=>!J.includes(a.key));if(0===b.length)return;let c=b.every(a=>vb(a,F,H,J)),d=new Set(b.map(a=>a.key)),e=new Set(b.flatMap(a=>a.runtimeIds));if(c){I(a=>a.filter(a=>!d.has(a))),G(a=>a.filter(a=>!e.has(a)));return}I(a=>Array.from(new Set([...a,...d]))),G(a=>Array.from(new Set([...a,...e])))},[bP.tasks,F,H,J]),b3=(0,E.useCallback)(a=>{let b=bP.agents.find(b=>b.id===a);b&&(s(b=>b===a?null:a),o(b.workspaceId),bQ(a))},[bQ,bP.agents]),b4=(0,E.useCallback)(()=>{s(null),bQ(n??bP.workspaces[0]?.id??null)},[n,bQ,bP.workspaces]),b5=(0,E.useCallback)((a="basic")=>{bI(null),bG(a),bE(!0)},[]),b6=(0,E.useCallback)(a=>{bI(a),bG("advanced"),bE(!0)},[]),b7=(0,E.useCallback)(a=>{bE(a),a||(bI(null),bG("basic"))},[]),b8=()=>{"running"!==aJ&&(aK("idle"),aM(null),aO(null),aQ(""))},b9=a=>{aQ(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},ca=a=>{a$(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},cb=a=>{bj(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},cc=a=>{aw(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},cd=(0,E.useCallback)(async()=>{if(!S||"running"===U)return;let a="string"==typeof S.metadata.optimisticRequestId?S.metadata.optimisticRequestId:null,b=a?z.find(b=>b.requestId===a):z.find(a=>a.task.id===S.id),c="string"==typeof S.dispatchId?S.dispatchId:b?.dispatchId??null;if(a&&!c){Y.current.get(a)?.abort(),Y.current.delete(a),A(b=>b.map(b=>b.requestId===a?{...b,task:va(b.task,{status:"cancelled",subtitle:"Mission submission cancelled before dispatch.",bootstrapStage:"cancelled",feedEvent:{id:`${b.task.id}:cancelled:${Date.now()}`,kind:"warning",timestamp:new Date().toISOString(),title:"Dispatch cancelled",detail:"Mission submission cancelled before dispatch.",isError:!1}})}:b)),ec.o.success("Mission submission cancelled.",{description:S.title}),T(null),V("idle"),X(null);return}V("running"),X(null);try{let a=await fetch(`/api/tasks/${encodeURIComponent(S.id)}/abort`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Aborted from Mission Control.",dispatchId:c})}),b=await a.json().catch(()=>null);if(!a.ok)throw Error(b?.error||b?.message||b?.summary||"Unable to abort task.");ec.o.success("Task abort requested.",{description:S.title}),T(null),V("idle"),await k()}catch(b){let a=b instanceof Error?b.message:"Unknown abort error.";V("error"),X(a),ec.o.error("Task abort failed.",{description:a})}},[z,k,S,U]),ce=a=>{a&&a8(a)},cf=async()=>{aI(!0),aK("running"),aM("Starting OpenClaw update..."),aO(null),aQ("");try{let a=await fetch("/api/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirmed:!0})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"OpenClaw update request failed.")}if(!a.body)throw Error("OpenClaw update did not return a readable stream.");let b=a.body.getReader(),c=new TextDecoder,d="",e=!1;for(;;){let{value:a,done:f}=await b.read();if(f)break;let g=(d+=c.decode(a,{stream:!0})).indexOf("\n");for(;g>=0;){let a=d.slice(0,g).trim();if(d=d.slice(g+1),a){let b=JSON.parse(a);"status"===b.type?(aM(b.message),b9(`
18
167
  > ${b.message}
19
- `)):"log"===b.type?bZ(b.text):(e=!0,aI(null),aK(b.message),aG(b.ok?"success":"error"),b.snapshot&&m(b.snapshot),b.ok?d9.o.success("OpenClaw updated.",{description:b.message}):d9.o.error("OpenClaw update failed.",{description:b.message}))}g=d.indexOf("\n")}}let f=d.trim();if(f){let a=JSON.parse(f);"done"===a.type&&(e=!0,aI(null),aK(a.message),aG(a.ok?"success":"error"),a.snapshot&&m(a.snapshot))}if(!e)throw Error("OpenClaw update stream ended unexpectedly.")}catch(a){aG("error"),aI(null),aK(a instanceof Error?a.message:"OpenClaw update failed."),d9.o.error("OpenClaw update failed.",{description:a instanceof Error?a.message:"Unknown update error."})}},b4=async()=>{bl(!1),a0("system"),aO("running"),aQ("detecting"),aS("Checking local OpenClaw status..."),aU(null),aY(null),a$(null),aW("");try{let a=await fetch("/api/onboarding",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"auto"})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"OpenClaw onboarding request failed.")}if(!a.body)throw Error("OpenClaw onboarding did not return a readable stream.");let b=a.body.getReader(),c=new TextDecoder,d="",e=!1;for(;;){let{value:a,done:f}=await b.read();if(f)break;let g=(d+=c.decode(a,{stream:!0})).indexOf("\n");for(;g>=0;){let a=d.slice(0,g).trim();if(d=d.slice(g+1),a){let b=JSON.parse(a);"status"===b.type?(aQ(b.phase),aS(b.message),b$(`
168
+ `)):"log"===b.type?b9(b.text):(e=!0,aM(null),aO(b.message),aK(b.ok?"success":"error"),b.snapshot&&m(b.snapshot),b.ok?ec.o.success("OpenClaw updated.",{description:b.message}):ec.o.error("OpenClaw update failed.",{description:b.message}))}g=d.indexOf("\n")}}let f=d.trim();if(f){let a=JSON.parse(f);"done"===a.type&&(e=!0,aM(null),aO(a.message),aK(a.ok?"success":"error"),a.snapshot&&m(a.snapshot))}if(!e)throw Error("OpenClaw update stream ended unexpectedly.")}catch(a){aK("error"),aM(null),aO(a instanceof Error?a.message:"OpenClaw update failed."),ec.o.error("OpenClaw update failed.",{description:a instanceof Error?a.message:"Unknown update error."})}},cg=async()=>{bp(!1),a4("system"),aS("running"),aU("detecting"),aW("Checking local OpenClaw status..."),aY(null),a0(null),a2(null),a$("");try{let a=await fetch("/api/onboarding",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"auto"})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"OpenClaw onboarding request failed.")}if(!a.body)throw Error("OpenClaw onboarding did not return a readable stream.");let b=a.body.getReader(),c=new TextDecoder,d="",e=!1;for(;;){let{value:a,done:f}=await b.read();if(f)break;let g=(d+=c.decode(a,{stream:!0})).indexOf("\n");for(;g>=0;){let a=d.slice(0,g).trim();if(d=d.slice(g+1),a){let b=JSON.parse(a);"status"===b.type?(aU(b.phase),aW(b.message),ca(`
20
169
  > ${b.message}
21
- `)):"log"===b.type?b$(b.text):(e=!0,aQ(b.phase),aS(null),aU(b.message),aY(b.manualCommand??null),a$(b.docsUrl??null),aO(b.ok?"success":"error"),b.snapshot&&m(b.snapshot),b.ok?d9.o.success("System setup ready.",{description:b.message}):d9.o.error("OpenClaw onboarding failed.",{description:b.message}))}g=d.indexOf("\n")}}let f=d.trim();if(f){let a=JSON.parse(f);"done"===a.type&&(e=!0,aQ(a.phase),aS(null),aU(a.message),aY(a.manualCommand??null),a$(a.docsUrl??null),aO(a.ok?"success":"error"),a.snapshot&&m(a.snapshot))}if(!e)throw Error("OpenClaw onboarding stream ended unexpectedly.")}catch(a){aO("error"),aS(null),aU(a instanceof Error?a.message:"OpenClaw onboarding failed."),d9.o.error("OpenClaw onboarding failed.",{description:a instanceof Error?a.message:"Unknown onboarding error."})}},b5=async a=>{var b,c;let d="discover"===(b=a.intent)?{statusMessage:"Scanning remote model routes...",successTitle:"Models discovered.",errorTitle:"Model discovery failed."}:"login-provider"===b?{statusMessage:"Preparing provider auth...",successTitle:"Provider connected.",errorTitle:"Provider auth needs attention."}:"refresh"===b?{statusMessage:"Refreshing model status...",successTitle:"Model setup refreshed.",errorTitle:"Model refresh failed."}:{statusMessage:"Checking available models and provider auth...",successTitle:"Model setup ready.",errorTitle:"Model setup failed."};bl(!1),a0("models"),a6("running"),a8("refresh"===(c=a.intent)?"refreshing":"discover"===c?"discovering":"detecting"),ba(d.statusMessage),bd(null),bh(null),bj(null),bf("");try{let b=await fetch("/api/onboarding/models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok){let a=await b.json().catch(()=>null);throw Error(a?.error||"Model onboarding request failed.")}if(!b.body)throw Error("Model onboarding did not return a readable stream.");let c=b.body.getReader(),e=new TextDecoder,f="",g=!1;for(;;){let{value:a,done:b}=await c.read();if(b)break;let h=(f+=e.decode(a,{stream:!0})).indexOf("\n");for(;h>=0;){let a=f.slice(0,h).trim();if(f=f.slice(h+1),a){let b=JSON.parse(a);"status"===b.type?(a8(b.phase),ba(b.message),b_(`
170
+ `)):"log"===b.type?ca(b.text):(e=!0,aU(b.phase),aW(null),aY(b.message),a0(b.manualCommand??null),a2(b.docsUrl??null),aS(b.ok?"success":"error"),b.snapshot&&m(b.snapshot),b.ok?ec.o.success("System setup ready.",{description:b.message}):ec.o.error("OpenClaw onboarding failed.",{description:b.message}))}g=d.indexOf("\n")}}let f=d.trim();if(f){let a=JSON.parse(f);"done"===a.type&&(e=!0,aU(a.phase),aW(null),aY(a.message),a0(a.manualCommand??null),a2(a.docsUrl??null),aS(a.ok?"success":"error"),a.snapshot&&m(a.snapshot))}if(!e)throw Error("OpenClaw onboarding stream ended unexpectedly.")}catch(a){aS("error"),aW(null),aY(a instanceof Error?a.message:"OpenClaw onboarding failed."),ec.o.error("OpenClaw onboarding failed.",{description:a instanceof Error?a.message:"Unknown onboarding error."})}},ch=async a=>{var b,c;let d="discover"===(b=a.intent)?{statusMessage:"Scanning remote model routes...",successTitle:"Models discovered.",errorTitle:"Model discovery failed."}:"login-provider"===b?{statusMessage:"Preparing provider auth...",successTitle:"Provider connected.",errorTitle:"Provider auth needs attention."}:"refresh"===b?{statusMessage:"Refreshing model status...",successTitle:"Model setup refreshed.",errorTitle:"Model refresh failed."}:{statusMessage:"Checking available models and provider auth...",successTitle:"Model setup ready.",errorTitle:"Model setup failed."};bp(!1),a4("models"),ba("running"),bd("refresh"===(c=a.intent)?"refreshing":"discover"===c?"discovering":"detecting"),bf(d.statusMessage),bh(null),bl(null),bn(null),bj("");try{let b=await fetch("/api/onboarding/models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok){let a=await b.json().catch(()=>null);throw Error(a?.error||"Model onboarding request failed.")}if(!b.body)throw Error("Model onboarding did not return a readable stream.");let c=b.body.getReader(),e=new TextDecoder,f="",g=!1;for(;;){let{value:a,done:b}=await c.read();if(b)break;let h=(f+=e.decode(a,{stream:!0})).indexOf("\n");for(;h>=0;){let a=f.slice(0,h).trim();if(f=f.slice(h+1),a){let b=JSON.parse(a);"status"===b.type?(bd(b.phase),bf(b.message),cb(`
22
171
  > ${b.message}
23
- `)):"log"===b.type?b_(b.text):(g=!0,a8(b.phase),ba(null),bd(b.message),bh(b.manualCommand??null),bj(b.docsUrl??null),a6(b.ok?"success":"error"),b2(b.discoveredModels),b.snapshot&&m(b.snapshot),b.ok?d9.o.success(d.successTitle,{description:b.message}):"authenticating"===b.phase&&b.manualCommand?d9.o.message("Continue in terminal.",{description:b.message}):d9.o.error(d.errorTitle,{description:b.message}))}h=f.indexOf("\n")}}let h=f.trim();if(h){let a=JSON.parse(h);"done"===a.type&&(g=!0,a8(a.phase),ba(null),bd(a.message),bh(a.manualCommand??null),bj(a.docsUrl??null),a6(a.ok?"success":"error"),b2(a.discoveredModels),a.snapshot&&m(a.snapshot))}if(!g)throw Error("Model onboarding stream ended unexpectedly.")}catch(a){a6("error"),ba(null),bd(a instanceof Error?a.message:"Model onboarding failed."),d9.o.error(d.errorTitle,{description:a instanceof Error?a.message:"Unknown model onboarding error."})}},b6=async()=>{await b5({intent:"auto",modelId:a1||void 0})},b7=async()=>{await b5({intent:"refresh"})},b8=async()=>{await b5({intent:"discover"})},b9=async a=>{await b5({intent:"login-provider",provider:a})},ca=async a=>{let b=a||a1;b?await b5({intent:"set-default",modelId:b}):await b6()},cb=(a=bL?"models":"system")=>{$(!1),a0(a),bl(!1),bq(!1),bn(!0)},cc=async a=>{bu(a);try{let b=await fetch("/api/gateway/control",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:a})}),c=await b.json();if(!b.ok||c.error||!c.snapshot)throw Error(c.error||"Gateway control request failed.");m(c.snapshot),d9.o.success("Gateway updated.",{description:c.message||"Gateway state changed."})}catch(a){d9.o.error("Gateway action failed.",{description:a instanceof Error?a.message:"Unknown gateway control error."})}finally{bu(null)}},cd=a=>{bG(a??null),bE(!0)},ce=async()=>{aa(!0);try{let a=await l(),b=Date.now(),c=a.diagnostics.updateInfo?.trim();if(bw(b),!a.diagnostics.installed)return void d9.o.message("OpenClaw is unavailable.",{description:a.diagnostics.issues[0]||"Mission Control is running in fallback mode."});if(a.diagnostics.updateAvailable)return void d9.o.message("Update available.",{description:c||`v${a.diagnostics.latestVersion} is available. Current version: v${a.diagnostics.version||"unknown"}.`});if(a.diagnostics.latestVersion&&!a.diagnostics.version)return void d9.o.message("Update status refreshed.",{description:c||`Latest available version: v${a.diagnostics.latestVersion}.`});if(a.diagnostics.updateError)return void d9.o.error("Update check could not reach the registry.",{description:c||a.diagnostics.updateError});d9.o.success("OpenClaw is up to date.",{description:c||`Current version: v${a.diagnostics.version||"unknown"}. No newer release was reported.`})}catch(a){d9.o.error("Update check failed.",{description:a instanceof Error?a.message:"Unable to refresh OpenClaw status."})}finally{aa(!1)}},cf=async a=>{aA(!0);try{let b=await fetch("/api/settings/gateway",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({gatewayUrl:a})});if(!b.ok){let a=await b.json().catch(()=>null);throw Error(a?.error||"Gateway settings could not be updated.")}let c=await b.json();m(c.snapshot),aw(uH(c.snapshot)),d9.o.success("Gateway updated.",{description:a?.trim()?`Mission Control now targets ${c.snapshot.diagnostics.configuredGatewayUrl||c.snapshot.diagnostics.gatewayUrl}.`:"Mission Control reverted to the local default gateway."})}catch(a){d9.o.error("Gateway update failed.",{description:a instanceof Error?a.message:"Unable to update the OpenClaw gateway."})}finally{aA(!1)}},cg=async a=>{aC(!0);try{let b=await fetch("/api/settings/workspace-root",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceRoot:a})});if(!b.ok){let a=await b.json().catch(()=>null);throw Error(a?.error||"Workspace root could not be updated.")}let c=await b.json();m(c.snapshot),ay(uI(c.snapshot)),d9.o.success("Workspace root updated.",{description:a?.trim()?`New workspaces will default to ${qV(c.snapshot.diagnostics.workspaceRoot)}. Existing workspaces stay where they are.`:"Mission Control reverted to the default workspace root. Existing workspaces were not moved."})}catch(a){d9.o.error("Workspace root update failed.",{description:a instanceof Error?a.message:"Unable to update the default workspace root."})}finally{aC(!1)}},ch=()=>{if(void 0===globalThis.localStorage)return;let a=["mission-control-composer-draft:"];for(let a of["mission-control-surface-theme","mission-control-workspace-plan-id","mission-control-recent-prompts"])globalThis.localStorage.removeItem(a);for(let b=globalThis.localStorage.length-1;b>=0;b-=1){let c=globalThis.localStorage.key(b);c&&a.some(a=>c.startsWith(a))&&globalThis.localStorage.removeItem(c)}},ci=()=>{ae("idle"),ag(null),ai(null),ak("idle"),am(null),ao(null),aq(null),as(""),au("")},cj=async a=>{ae("loading"),ag(null),ai(null);try{let b=await fetch("/api/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"preview",target:a})}),c=await b.json().catch(()=>null);if(!b.ok||!c?.preview)throw Error(c?.error||"Reset preview could not be loaded.");ag(c.preview),ae("ready")}catch(a){ae("error"),ai(a instanceof Error?a.message:"Reset preview failed.")}},ck=async a=>{$(!1),ac(a),ci(),await cj(a)},cl=async()=>{if(ab){ak("running"),am("full-uninstall"===ab?"Starting full uninstall...":"Starting Mission Control reset..."),ao(null),aq(null),as("");try{let a=await fetch("/api/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"execute",target:ab,confirmed:!0})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Reset request failed.")}if(!a.body)throw Error("Reset request did not return a readable stream.");let b=a.body.getReader(),c=new TextDecoder,d="",e=!1;for(;;){let{value:a,done:f}=await b.read();if(f)break;let g=(d+=c.decode(a,{stream:!0})).indexOf("\n");for(;g>=0;){let a=d.slice(0,g).trim();if(d=d.slice(g+1),a){let b=JSON.parse(a);"status"===b.type?(am(b.message),b0(`
172
+ `)):"log"===b.type?cb(b.text):(g=!0,bd(b.phase),bf(null),bh(b.message),bl(b.manualCommand??null),bn(b.docsUrl??null),ba(b.ok?"success":"error"),ce(b.discoveredModels),b.snapshot&&m(b.snapshot),b.ok?ec.o.success(d.successTitle,{description:b.message}):"authenticating"===b.phase&&b.manualCommand?ec.o.message("Continue in terminal.",{description:b.message}):ec.o.error(d.errorTitle,{description:b.message}))}h=f.indexOf("\n")}}let h=f.trim();if(h){let a=JSON.parse(h);"done"===a.type&&(g=!0,bd(a.phase),bf(null),bh(a.message),bl(a.manualCommand??null),bn(a.docsUrl??null),ba(a.ok?"success":"error"),ce(a.discoveredModels),a.snapshot&&m(a.snapshot))}if(!g)throw Error("Model onboarding stream ended unexpectedly.")}catch(a){ba("error"),bf(null),bh(a instanceof Error?a.message:"Model onboarding failed."),ec.o.error(d.errorTitle,{description:a instanceof Error?a.message:"Unknown model onboarding error."})}},ci=async()=>{await ch({intent:"auto",modelId:a5||void 0})},cj=async()=>{await ch({intent:"refresh"})},ck=async()=>{await ch({intent:"discover"})},cl=async a=>{await ch({intent:"login-provider",provider:a})},cm=async a=>{let b=a||a5;b?await ch({intent:"set-default",modelId:b}):await ci()},cn=(a=bT?"models":"system")=>{ac(!1),a4(a),bp(!1),bu(!1),bs(!0)},co=async a=>{by(a);try{let b=await fetch("/api/gateway/control",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:a})}),c=await b.json();if(!b.ok||c.error||!c.snapshot)throw Error(c.error||"Gateway control request failed.");m(c.snapshot),ec.o.success("Gateway updated.",{description:c.message||"Gateway state changed."})}catch(a){ec.o.error("Gateway action failed.",{description:a instanceof Error?a.message:"Unknown gateway control error."})}finally{by(null)}},cp=a=>{bM(d9(a)),bK(!0)},cq=async()=>{ae(!0);try{let a=await l(),b=Date.now(),c=a.diagnostics.updateInfo?.trim();if(bA(b),!a.diagnostics.installed)return void ec.o.message("OpenClaw is unavailable.",{description:a.diagnostics.issues[0]||"Mission Control is running in fallback mode."});if(a.diagnostics.updateAvailable)return void ec.o.message("Update available.",{description:c||`v${a.diagnostics.latestVersion} is available. Current version: v${a.diagnostics.version||"unknown"}.`});if(a.diagnostics.latestVersion&&!a.diagnostics.version)return void ec.o.message("Update status refreshed.",{description:c||`Latest available version: v${a.diagnostics.latestVersion}.`});if(a.diagnostics.updateError)return void ec.o.error("Update check could not reach the registry.",{description:c||a.diagnostics.updateError});ec.o.success("OpenClaw is up to date.",{description:c||`Current version: v${a.diagnostics.version||"unknown"}. No newer release was reported.`})}catch(a){ec.o.error("Update check failed.",{description:a instanceof Error?a.message:"Unable to refresh OpenClaw status."})}finally{ae(!1)}},cr=async a=>{aE(!0);try{let b=await fetch("/api/settings/gateway",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({gatewayUrl:a})});if(!b.ok){let a=await b.json().catch(()=>null);throw Error(a?.error||"Gateway settings could not be updated.")}let c=await b.json();m(c.snapshot),aA(ve(c.snapshot)),ec.o.success("Gateway updated.",{description:a?.trim()?`Mission Control now targets ${c.snapshot.diagnostics.configuredGatewayUrl||c.snapshot.diagnostics.gatewayUrl}.`:"Mission Control reverted to the local default gateway."})}catch(a){ec.o.error("Gateway update failed.",{description:a instanceof Error?a.message:"Unable to update the OpenClaw gateway."})}finally{aE(!1)}},cs=async a=>{aG(!0);try{let b=await fetch("/api/settings/workspace-root",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceRoot:a})});if(!b.ok){let a=await b.json().catch(()=>null);throw Error(a?.error||"Workspace root could not be updated.")}let c=await b.json();m(c.snapshot),aC(vf(c.snapshot)),ec.o.success("Workspace root updated.",{description:a?.trim()?`New workspaces will default to ${qZ(c.snapshot.diagnostics.workspaceRoot)}. Existing workspaces stay where they are.`:"Mission Control reverted to the default workspace root. Existing workspaces were not moved."})}catch(a){ec.o.error("Workspace root update failed.",{description:a instanceof Error?a.message:"Unable to update the default workspace root."})}finally{aG(!1)}},ct=()=>{if(void 0===globalThis.localStorage)return;let a=["mission-control-composer-draft:"];for(let a of["mission-control-surface-theme","mission-control-workspace-plan-id","mission-control-recent-prompts"])globalThis.localStorage.removeItem(a);for(let b=globalThis.localStorage.length-1;b>=0;b-=1){let c=globalThis.localStorage.key(b);c&&a.some(a=>c.startsWith(a))&&globalThis.localStorage.removeItem(c)}},cu=()=>{ai("idle"),ak(null),am(null),ao("idle"),aq(null),as(null),au(null),aw(""),ay("")},cv=async a=>{ai("loading"),ak(null),am(null);try{let b=await fetch("/api/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"preview",target:a})}),c=await b.json().catch(()=>null);if(!b.ok||!c?.preview)throw Error(c?.error||"Reset preview could not be loaded.");ak(c.preview),ai("ready")}catch(a){ai("error"),am(a instanceof Error?a.message:"Reset preview failed.")}},cw=async a=>{ac(!1),ag(a),cu(),await cv(a)},cx=async()=>{if(af){ao("running"),aq("full-uninstall"===af?"Starting full uninstall...":"Starting Mission Control reset..."),as(null),au(null),aw("");try{let a=await fetch("/api/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"execute",target:af,confirmed:!0})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Reset request failed.")}if(!a.body)throw Error("Reset request did not return a readable stream.");let b=a.body.getReader(),c=new TextDecoder,d="",e=!1;for(;;){let{value:a,done:f}=await b.read();if(f)break;let g=(d+=c.decode(a,{stream:!0})).indexOf("\n");for(;g>=0;){let a=d.slice(0,g).trim();if(d=d.slice(g+1),a){let b=JSON.parse(a);"status"===b.type?(aq(b.message),cc(`
24
173
  > ${b.message}
25
- `)):"log"===b.type?b0(`${b.text}
26
- `):(e=!0,am(null),ao(b.message),aq(b.backgroundLogPath??null),ak(b.ok?"success":"error"),b.snapshot&&m(b.snapshot),b.ok?(ch(),d9.o.success("full-uninstall"===ab?"Full uninstall started.":"Mission Control reset completed.",{description:b.message})):d9.o.error("full-uninstall"===ab?"Full uninstall failed.":"Mission Control reset failed.",{description:b.message}))}g=d.indexOf("\n")}}let f=d.trim();if(f){let a=JSON.parse(f);"done"===a.type&&(e=!0,am(null),ao(a.message),aq(a.backgroundLogPath??null),ak(a.ok?"success":"error"),a.snapshot&&m(a.snapshot),a.ok&&ch())}if(!e)throw Error("Reset stream ended unexpectedly.")}catch(a){ak("error"),am(null),ao(a instanceof Error?a.message:"Reset failed."),d9.o.error("full-uninstall"===ab?"Full uninstall failed.":"Mission Control reset failed.",{description:a instanceof Error?a.message:"Unknown reset error."})}}};return(0,D.jsxs)("div",{className:bb("mission-shell relative min-h-screen overflow-hidden","light"===bx&&"mission-shell--light"),children:[(0,D.jsxs)("div",{className:"mission-canvas-backdrop absolute inset-0 z-0",children:[(0,D.jsx)("div",{"aria-hidden":"true",className:"mission-canvas-pattern absolute inset-0 z-0"}),(0,D.jsx)("div",{className:"absolute inset-0 z-10",children:(0,D.jsx)(rj,{snapshot:bH,activeWorkspaceId:n,selectedNodeId:p,recentDispatchId:v,hiddenRuntimeIds:B,hiddenTaskKeys:F,lockedTaskKeys:H,className:"rounded-none",onEditAgent:a=>{bI(a),K({requestId:`edit:${a}:${Date.now()}`,kind:"edit",agentId:a})},onDeleteAgent:a=>{bI(a),K({requestId:`delete:${a}:${Date.now()}`,kind:"delete",agentId:a})},onReplyTask:a=>{let b=uB(a);A({id:`reply:${a.id}:${Date.now()}`,mission:b,agentId:a.primaryAgentId,sourceKind:"reply",sourceLabel:a.title.trim()||a.subtitle.trim()||a.id})},onCopyTaskPrompt:async a=>{let b=uB(a);A({id:`copy:${a.id}:${Date.now()}`,mission:b,agentId:a.primaryAgentId,sourceKind:"copy",sourceLabel:a.title.trim()||a.subtitle.trim()||a.id});try{await navigator.clipboard.writeText(b),d9.o.success("Prompt copied to clipboard.",{description:"The mission input was also populated."})}catch{d9.o.message("Prompt moved into mission input.",{description:"Clipboard access was not available."})}},onHideTask:a=>{H.includes(a.key)||(G(b=>b.includes(a.key)?b:[...b,a.key]),C(b=>{let c=new Set(b);return a.runtimeIds.forEach(a=>c.add(a)),Array.from(c)}))},onToggleTaskLock:a=>{I(b=>b.includes(a.key)?b.filter(b=>b!==a.key):[...b,a.key])},onAbortTask:a=>{uD(a)&&(P(a),R("idle"),T(null))},onInspectTask:(a,b)=>{bI(a.id,b),Y(!0)},onSelectNode:a=>{bI(a)}})})]}),(0,D.jsx)("div",{className:bb("pointer-events-none absolute top-0 z-40 hidden lg:block",V?"lg:left-[442px]":"lg:left-[118px]",X?"lg:right-[442px]":"lg:right-[118px]"),children:(0,D.jsx)(uA,{snapshot:i,surfaceTheme:bx,settingsRef:bJ,isSettingsOpen:Z,gatewayDraft:av,workspaceRootDraft:ax,isSavingGateway:az,isSavingWorkspaceRoot:aB,isCheckingForUpdates:_,selectedModelId:a1,modelOnboardingRunState:a5,gatewayControlAction:bt,lastCheckedAt:bv,onToggleTheme:()=>by(a=>"light"===a?"dark":"light"),onToggleSettings:()=>$(a=>!a),onGatewayDraftChange:aw,onWorkspaceRootDraftChange:ay,onSelectedModelIdChange:a2,onSaveGatewaySettings:cf,onSaveWorkspaceRootSettings:cg,onCheckForUpdates:ce,onControlGateway:cc,onOpenSetupWizard:cb,onRunModelRefresh:b7,onRunModelSetDefault:ca,onOpenAddModels:cd,onOpenUpdateDialog:()=>{bY(),aE(!0)},onOpenResetDialog:a=>{ck(a)}})}),(0,D.jsxs)("div",{className:"relative z-20 min-h-screen pointer-events-none lg:h-screen",children:[(0,D.jsx)("div",{className:"pointer-events-none absolute left-1/2 top-4 z-30 -translate-x-1/2 lg:hidden",children:(0,D.jsx)(uz,{surfaceTheme:bx})}),(0,D.jsx)("div",{className:bb("pointer-events-auto absolute left-4 top-4 z-30",V?"bottom-[calc(env(safe-area-inset-bottom)+124px)] w-[calc(100vw-112px)] max-w-[300px] lg:bottom-[244px] lg:top-6 lg:w-[394px] lg:max-w-none":"w-[78px] lg:bottom-[244px] lg:top-6"),children:(0,D.jsx)(sL,{snapshot:bH,activeWorkspaceId:n,requestedAgentAction:J,connectionState:j,collapsed:!V,modelManager:{runState:a5,statusMessage:a9,resultMessage:bc,log:be,manualCommand:bg,docsUrl:bi,discoveredModels:a3,systemReady:bL},onToggleCollapsed:()=>W(a=>!a),onSelectWorkspace:a=>{o(a),bI(a)},onRefresh:k,onRunModelRefresh:b7,onRunModelDiscover:b8,onRunModelSetDefault:ca,onConnectModelProvider:b9,onOpenModelSetup:()=>cb(bL?"models":"system"),onOpenAddModels:cd})}),(0,D.jsx)("div",{className:bb("pointer-events-auto absolute right-4 top-4 z-30",X?"bottom-[calc(env(safe-area-inset-bottom)+124px)] w-[calc(100vw-112px)] max-w-[300px] lg:bottom-[244px] lg:top-6 lg:w-[394px] lg:max-w-none":"w-[78px] lg:bottom-[244px] lg:top-6"),children:(0,D.jsx)(rZ,{snapshot:bH,selectedNodeId:p,lastMission:t,collapsed:!X,onToggleCollapsed:()=>Y(a=>!a),activeTab:r,onActiveTabChange:s,onAbortTask:a=>{uD(a)&&(P(a),R("idle"),T(null))}})}),(0,D.jsxs)("div",{className:"pointer-events-auto absolute bottom-[calc(env(safe-area-inset-bottom)+12px)] left-4 right-4 z-40 lg:bottom-6 lg:left-1/2 lg:right-auto lg:w-[min(800px,calc(100vw-320px))] lg:-translate-x-1/2",children:[(0,D.jsxs)("div",{className:"mx-auto mb-1 flex w-full max-w-[260px] items-center justify-between rounded-full border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] p-0.5 text-[8px] text-slate-200 shadow-[0_10px_24px_rgba(0,0,0,0.14)]",children:[(0,D.jsxs)("span",{className:"truncate pl-1.5 pr-1 leading-3 text-slate-300",children:[bW," hidden"]}),(0,D.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,D.jsx)(bp,{type:"button",variant:"secondary",size:"sm",disabled:0===bX,className:"h-5 rounded-full border-white/[0.1] bg-white/[0.06] px-1.5 text-[8px] text-slate-200 hover:bg-white/[0.1]",onClick:()=>{let a=bV.filter(a=>("completed"===a.status||"stalled"===a.status||"idle"===a.status||uC(a))&&!H.includes(a.key)).map(a=>a.key);0!==a.length&&G(b=>Array.from(new Set([...b,...a])))},children:"Hide"}),(0,D.jsx)(bp,{type:"button",variant:"secondary",size:"sm",disabled:0===bW,className:"h-5 rounded-full border-white/[0.1] bg-white/[0.06] px-1.5 text-[8px] text-slate-200 hover:bg-white/[0.1]",onClick:()=>{let a=new Set(bV.map(a=>a.key)),b=new Set(bV.flatMap(a=>a.runtimeIds));G(b=>b.filter(b=>!a.has(b))),C(a=>a.filter(a=>!b.has(a)))},children:"Show"})]})]}),(0,D.jsx)(rN,{snapshot:bH,activeWorkspaceId:n,selectedNodeId:p,composeIntent:z,onRefresh:k,onOpenWorkspaceCreate:()=>{bC("basic"),bA(!0)},onMissionDispatchStart:a=>{var b,c;let d,e,f;U.current.set(a.requestId,a.abortController);let g=(b=a,c=i,d=new Date(b.submittedAt).toISOString(),e=c.agents.find(a=>a.id===b.agentId),f={id:`optimistic:${b.requestId}:submitted`,kind:"user",timestamp:d,title:"Mission submitted",detail:uG(b.mission,220),agentId:b.agentId},{requestId:b.requestId,dispatchId:null,task:{id:`optimistic-task:${b.requestId}`,key:`optimistic:${b.requestId}`,title:uG(b.mission,86),mission:b.mission,subtitle:"Sending mission to AgentOS. Waiting for a dispatch id.",status:"queued",updatedAt:b.submittedAt,ageMs:0,workspaceId:b.workspaceId??void 0,primaryAgentId:b.agentId,primaryAgentName:e?.name??"OpenClaw",runtimeIds:[],agentIds:[b.agentId],sessionIds:[],runIds:[],runtimeCount:0,updateCount:0,liveRunCount:0,artifactCount:0,warningCount:0,metadata:{optimistic:!0,optimisticRequestId:b.requestId,bootstrapStage:"submitting",dispatchSubmittedAt:d,optimisticEvents:[f]}}});y(b=>[g,...b.filter(b=>b.requestId!==a.requestId)]),a.workspaceId&&o(a.workspaceId),bI(g.task.id),Y(!0)},onMissionDispatchFailure:(a,b)=>{U.current.delete(a),y(c=>c.map(c=>c.requestId===a?{...c,task:uE(c.task,{status:"stalled",subtitle:b,bootstrapStage:"stalled",feedEvent:{id:`${c.task.id}:failed:${Date.now()}`,kind:"warning",timestamp:new Date().toISOString(),title:"Dispatch failed",detail:b,isError:!0}})}:c))},onMissionResponse:(a,b)=>{U.current.delete(b.requestId),u(a),y(c=>c.map(c=>c.requestId===b.requestId?{...c,dispatchId:a.dispatchId??c.dispatchId,task:uE(c.task,{dispatchId:a.dispatchId,status:"stalled"===a.status?"stalled":"cancelled"===a.status?"cancelled":"queued",subtitle:a.summary,bootstrapStage:"stalled"===a.status?"stalled":"cancelled"===a.status?"cancelled":"accepted",feedEvent:{id:`${c.task.id}:response:${Date.now()}`,kind:"stalled"===a.status||"cancelled"===a.status?"warning":"status",timestamp:new Date().toISOString(),title:"stalled"===a.status?"Dispatch blocked":"cancelled"===a.status?"Dispatch cancelled":"Mission accepted",detail:a.summary||"Mission accepted and queued for OpenClaw execution.",isError:"stalled"===a.status||"cancelled"===a.status}})}:c)),a.dispatchId&&w(a.dispatchId)}})]}),bU||bo||bm?(0,D.jsx)(ss,{snapshot:i,surfaceTheme:bx,stage:a_,systemActionLabel:bS.label,systemActionDescription:bS.description,systemPhase:aP,modelPhase:a7,systemRun:{runState:aN,statusMessage:aR,resultMessage:aT,log:aV,manualCommand:aX,docsUrl:aZ},modelRun:{runState:a5,statusMessage:a9,resultMessage:bc,log:be,manualCommand:bg,docsUrl:bi},selectedModelId:a1,discoveredModels:a3,onSelectedModelIdChange:a2,onRunSystemSetup:b4,onRunModelAutoSetup:b6,onRunModelDiscover:b8,onRunModelRefresh:b7,onRunModelSetDefault:ca,onContinueToModels:()=>a0("models"),onBackToSystem:()=>a0("system"),onDismiss:()=>{bn(!1),bq(!1),bM||bl(!0)},canDismiss:!bo&&"running"!==aN&&"running"!==a5}):null,(0,D.jsx)(ur,{open:bz,onOpenChange:bA,initialMode:bB,surfaceTheme:bx,snapshot:i,onRefresh:k,onWorkspaceCreated:a=>{o(a),bI(a)}}),(0,D.jsx)(eb,{open:bD,onOpenChange:bE,snapshot:i,initialProvider:bF,onSnapshotChange:m}),(0,D.jsx)(sG,{open:null!==ab,target:ab,surfaceTheme:bx,previewState:ad,preview:af,previewError:ah,runState:aj,statusMessage:al,resultMessage:an,backgroundLogPath:ap,log:ar,confirmText:at,onConfirmTextChange:au,onRefreshPreview:()=>{ab&&cj(ab)},onExecute:()=>{cl()},onOpenChange:a=>{a||"running"!==aj&&(ac(null),ci())}}),(0,D.jsx)(dw,{open:null!==O,onOpenChange:a=>{"running"!==Q&&(a||(P(null),R("idle"),T(null)))},children:(0,D.jsxs)(d$,{className:bb("max-w-[480px] gap-5 p-5 sm:p-6","light"===bx?"border-[#d7c5b7] bg-[rgba(252,247,241,0.98)] text-[#4a382c] shadow-[0_30px_80px_rgba(161,125,101,0.2)]":"border-white/10 bg-slate-950/94 text-slate-100"),children:[(0,D.jsxs)(d_,{children:[(0,D.jsx)(d1,{className:"light"===bx?"text-[#3f2f24]":"text-white",children:"Abort task?"}),(0,D.jsx)(d2,{className:"light"===bx?"text-[#7e6555]":"text-slate-400",children:"This stops the current OpenClaw dispatch for the selected task. It does not delete captured evidence or files."})]}),O?(0,D.jsxs)("div",{className:bb("rounded-[20px] border px-4 py-4","light"===bx?"border-[#e3d4c8] bg-[#fffaf6] text-[#4f3d31]":"border-rose-400/20 bg-rose-400/10 text-rose-50"),children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.24em] text-slate-500",children:"Selected task"}),(0,D.jsx)("p",{className:"mt-2 font-display text-[1.02rem] leading-6 text-inherit",children:O.title}),(0,D.jsx)("p",{className:bb("mt-1 text-sm leading-6","light"===bx?"text-[#8b7262]":"text-rose-100/80"),children:O.subtitle}),S?(0,D.jsx)("p",{className:"mt-3 rounded-[16px] border border-rose-400/20 bg-rose-400/10 px-3 py-2 text-sm text-rose-50",children:S}):null]}):null,(0,D.jsxs)(d0,{children:[(0,D.jsx)(bp,{type:"button",variant:"secondary",disabled:"running"===Q,className:"light"===bx?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",onClick:()=>{"running"!==Q&&(P(null),R("idle"),T(null))},children:"Cancel"}),(0,D.jsx)(bp,{type:"button",variant:"destructive",disabled:!O||"running"===Q,onClick:()=>{b1()},children:"running"===Q?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{className:"mr-2 h-4 w-4 animate-spin"}),"Aborting..."]}):"Abort task"})]})]})}),(0,D.jsxs)("div",{className:bb("pointer-events-auto absolute bottom-3 right-4 z-30 text-[11px] tracking-[0.04em] lg:bottom-4 lg:right-6","light"===bx?"text-[#8f7664]":"text-slate-500"),children:["Built on"," ",(0,D.jsx)("a",{href:"https://openclaw.ai/",target:"_blank",rel:"noreferrer",className:bb("transition-colors","light"===bx?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"OpenClaw"})," ","by"," ",(0,D.jsx)("a",{href:"https://sapienx.app/",target:"_blank",rel:"noreferrer",className:bb("transition-colors","light"===bx?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"SapienX"})]}),(0,D.jsx)(dw,{open:aD,onOpenChange:a=>{"running"!==aF&&(aE(a),a||bY())},children:(0,D.jsxs)(d$,{className:bb("max-w-[468px] gap-5 p-5 sm:p-6","light"===bx?"border-[#d7c5b7] bg-[rgba(252,247,241,0.98)] text-[#4a382c] shadow-[0_30px_80px_rgba(161,125,101,0.2)]":"border-white/10 bg-slate-950/94 text-slate-100"),children:[(0,D.jsxs)(d_,{children:[(0,D.jsx)(d1,{className:"light"===bx?"text-[#3f2f24]":"text-white",children:bQ}),(0,D.jsx)(d2,{className:"light"===bx?"text-[#7e6555]":"text-slate-400",children:bR})]}),bP?(0,D.jsxs)("div",{className:bb("space-y-4","light"===bx?"text-[#4f3d31]":"text-slate-200"),children:[(0,D.jsxs)("div",{className:bb("rounded-[24px] border px-4 py-5",(e=aF,f=bx,"success"===e?"light"===f?"border-emerald-300 bg-emerald-50/80 text-emerald-950":"border-emerald-300/25 bg-emerald-300/10 text-emerald-50":"light"===f?"border-rose-300 bg-rose-50/90 text-rose-950":"border-rose-300/25 bg-rose-300/10 text-rose-50")),children:[(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("div",{className:bb("flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl border",(g=aF,h=bx,"success"===g?"light"===h?"border-emerald-300 bg-white/80 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===h?"border-rose-300 bg-white/80 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200")),children:"success"===aF?(0,D.jsx)(M,{className:"h-5 w-5"}):(0,D.jsx)(N,{className:"h-5 w-5"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("p",{className:"font-display text-[1.05rem] leading-6",children:"success"===aF?"OpenClaw is up to date":"Update needs attention"}),(0,D.jsx)("p",{className:"mt-1 text-sm leading-6",children:aJ||("success"===aF?"The update finished successfully.":"The update did not finish cleanly.")})]})]}),(0,D.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[(0,D.jsxs)("div",{className:bb("rounded-[18px] border px-3 py-3","light"===bx?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,D.jsx)("p",{className:"light"===bx?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Installed version"}),(0,D.jsxs)("p",{className:"mt-2 font-display text-lg text-inherit",children:["v",i.diagnostics.version||i.diagnostics.latestVersion||"unknown"]})]}),(0,D.jsxs)("div",{className:bb("rounded-[18px] border px-3 py-3","light"===bx?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,D.jsx)("p",{className:"light"===bx?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Install mode"}),(0,D.jsx)("p",{className:"mt-2 text-sm font-medium text-inherit",children:bN||"unknown"})]})]})]}),(0,D.jsxs)("div",{className:bb("rounded-[20px] border","light"===bx?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:bb("flex items-center justify-between border-b px-4 py-3","light"===bx?"border-[#eadccf]":"border-white/8"),children:[(0,D.jsx)("p",{className:bb("text-[10px] uppercase tracking-[0.24em]","light"===bx?"text-[#9a7f6c]":"text-slate-500"),children:"Update log"}),(0,D.jsx)("span",{className:"light"===bx?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:"success"===aF?"Completed":"Failed"})]}),(0,D.jsx)("pre",{className:bb("max-h-[180px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===bx?"text-[#4f3d31]":"text-slate-200"),children:aL||"No command output was captured."})]})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{className:bb("grid gap-3 sm:grid-cols-2","light"===bx?"text-[#4f3d31]":"text-slate-200"),children:[(0,D.jsxs)("div",{className:bb("rounded-[20px] border px-4 py-4","light"===bx?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsx)("p",{className:bb("text-[10px] uppercase tracking-[0.24em]","light"===bx?"text-[#9a7f6c]":"text-slate-500"),children:"Version target"}),(0,D.jsxs)("p",{className:"mt-2 font-display text-[1.1rem] leading-6 text-inherit",children:["v",i.diagnostics.latestVersion||i.diagnostics.version||"unknown"]}),(0,D.jsxs)("p",{className:"light"===bx?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:["Current: v",i.diagnostics.version||"unknown"]})]}),(0,D.jsxs)("div",{className:bb("rounded-[20px] border px-4 py-4","light"===bx?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsx)("p",{className:bb("text-[10px] uppercase tracking-[0.24em]","light"===bx?"text-[#9a7f6c]":"text-slate-500"),children:"Install mode"}),(0,D.jsx)("p",{className:"mt-2 text-sm font-medium leading-6 text-inherit",children:bN||"unknown"}),(0,D.jsx)("p",{className:"light"===bx?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:qV(i.diagnostics.updateRoot||"")||"Install root unavailable"})]})]}),(0,D.jsx)("div",{className:bb("rounded-[20px] border px-4 py-3 text-sm",bK>0?"light"===bx?"border-rose-300/80 bg-rose-50 text-rose-800":"border-rose-300/25 bg-rose-300/10 text-rose-100":"light"===bx?"border-[#e3d4c8] bg-[#fffaf6] text-[#745e4f]":"border-white/8 bg-white/[0.03] text-slate-300"),children:bK>0?`${bK} running or queued runtime${1===bK?"":"s"} may be interrupted during the update.`:"No running runtimes are currently tracked, so the update risk is lower."}),bO?(0,D.jsxs)("div",{className:bb("rounded-[20px] border","light"===bx?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:bb("flex items-center gap-3 border-b px-4 py-3","light"===bx?"border-[#eadccf]":"border-white/8"),children:[(0,D.jsx)("div",{className:bb("flex h-9 w-9 items-center justify-center rounded-2xl border","light"===bx?"border-[#dcc6b6] bg-[#f4e8dd] text-[#7b6453]":"border-white/10 bg-white/[0.05] text-slate-200"),children:(0,D.jsx)(L,{className:"h-4 w-4 animate-spin"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("p",{className:"light"===bx?"text-sm font-medium text-[#4a382c]":"text-sm font-medium text-white",children:"Update in progress"}),(0,D.jsx)("p",{className:"light"===bx?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:aH||"Streaming OpenClaw output..."})]})]}),(0,D.jsx)("pre",{className:bb("max-h-[180px] min-h-[120px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===bx?"text-[#4f3d31]":"text-slate-200"),children:aL||"Waiting for command output..."})]}):null]}),(0,D.jsxs)(d0,{children:[(0,D.jsx)(bp,{type:"button",variant:"secondary",onClick:()=>{aE(!1),bY()},disabled:bO,className:"light"===bx?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:bP?"Done":"Cancel"}),bP?null:(0,D.jsx)(bp,{type:"button",onClick:b3,disabled:bO,className:bb(i.diagnostics.updateAvailable?"bg-amber-400 text-slate-950 shadow-lg shadow-amber-400/20 hover:bg-amber-300":"","light"!==bx||i.diagnostics.updateAvailable?"":"bg-[#c8946f] text-white shadow-[0_12px_28px_rgba(200,148,111,0.24)] hover:bg-[#b88461]"),children:bO?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating..."]}):"Update now"})]})]})})]})]})}function uz({surfaceTheme:a}){return(0,D.jsxs)("div",{className:bb("flex h-11 items-center gap-3 rounded-full border px-4 shadow-[0_18px_50px_rgba(0,0,0,0.24)] backdrop-blur-xl","light"===a?"border-[#d9c9bc]/90 bg-[#f8f5f0]/86 shadow-[0_18px_42px_rgba(161,125,101,0.14)]":"border-cyan-300/10 bg-slate-950/45"),children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)("span",{className:bb("inline-flex h-7 w-7 items-center justify-center overflow-hidden rounded-[8px] border","light"===a?"border-[#d1bcad] bg-[#f5ece4]":"border-white/[0.08] bg-white/[0.03]"),children:(0,D.jsx)("video",{"aria-hidden":"true",autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"auto",className:"h-full w-full scale-[1.15] object-cover",children:(0,D.jsx)("source",{src:"/assets/logo.webm",type:"video/webm"})})}),(0,D.jsx)("p",{className:bb("text-[10px] tracking-[0.18em]","light"===a?"text-[#8a7261]":"text-slate-500"),children:"AgentOS"})]}),(0,D.jsx)("span",{"aria-hidden":"true",className:bb("h-4 w-px","light"===a?"bg-[#cdb7a8]/80":"bg-white/[0.08]")}),(0,D.jsx)("h2",{className:bb("font-display text-[0.88rem]","light"===a?"text-[#816958]/80":"text-slate-400/75"),children:"Mission Control"})]})}function uA({snapshot:a,surfaceTheme:b,settingsRef:c,isSettingsOpen:d,gatewayDraft:e,workspaceRootDraft:f,isSavingGateway:g,isSavingWorkspaceRoot:h,isCheckingForUpdates:i,selectedModelId:j,modelOnboardingRunState:k,gatewayControlAction:l,lastCheckedAt:m,onToggleTheme:n,onToggleSettings:o,onGatewayDraftChange:p,onWorkspaceRootDraftChange:q,onSelectedModelIdChange:r,onSaveGatewaySettings:s,onSaveWorkspaceRootSettings:t,onCheckForUpdates:u,onControlGateway:v,onOpenSetupWizard:w,onRunModelRefresh:x,onRunModelSetDefault:y,onOpenAddModels:z,onOpenUpdateDialog:A,onOpenResetDialog:B}){let C=sr(a),E=null!==l,F="running"===k,G=uJ(b,"secondary"),H=uJ(b,"primary"),I=uJ(b,"warning"),J=uJ(b,"warningSolid"),K=bb("inline-flex h-8 w-8 items-center justify-center rounded-full border transition-[background-color,border-color,color,transform] duration-150 active:scale-[0.96]","light"===b?"border-[#d0bcae] bg-[#efe5dc] text-[#7f6554] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#e7d9ce] hover:border-[#c8b09f] hover:text-[#5f4a3d] active:bg-[#ddcdbf]":"border-white/12 bg-white/[0.08] text-slate-200 hover:bg-white/[0.12] hover:border-white/16 hover:text-slate-100 active:bg-white/[0.16]"),M=bb("relative inline-flex h-7 w-14 items-center rounded-full border transition-[background-color,border-color,transform] duration-150 active:scale-[0.98]","light"===b?"border-[#d0bcae] bg-[#eaded3] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#e3d5c8] hover:border-[#c8b09f] active:bg-[#d9c8ba]":"border-white/12 bg-white/[0.08] hover:bg-white/[0.12] hover:border-white/16 active:bg-white/[0.16]"),T=bb("absolute left-1 inline-flex h-5 w-5 items-center justify-center rounded-full shadow-[0_4px_12px_rgba(0,0,0,0.18)] transition-[transform,background-color,color] duration-150","light"===b?"translate-x-7 bg-[#c8946f] text-white":"translate-x-0 bg-cyan-300 text-slate-950");return(0,D.jsxs)("div",{className:"flex w-full items-center justify-between px-0 pt-6",children:[(0,D.jsx)(uz,{surfaceTheme:b}),(0,D.jsxs)("div",{ref:c,className:"pointer-events-auto relative",children:[(0,D.jsxs)("div",{className:bb("flex h-11 items-center gap-3 rounded-full border px-4 shadow-[0_18px_50px_rgba(0,0,0,0.24)] backdrop-blur-xl","light"===b?"border-[#d9c9bc]/90 bg-[#f8f5f0]/86 shadow-[0_18px_42px_rgba(161,125,101,0.14)]":"border-cyan-300/10 bg-slate-950/45"),children:[(0,D.jsxs)("div",{className:"flex items-baseline gap-[3px]",children:[(0,D.jsx)("span",{className:bb("text-[10px] uppercase tracking-[0.3em]","light"===b?"text-[#8a7261]":"text-slate-500"),children:"OPENCLAW"}),(0,D.jsxs)("span",{className:bb("font-mono text-[8px] tracking-[0.04em]","light"===b?"text-[#6f5a4b]/85":"text-slate-300/80"),children:["v",a.diagnostics.version||"unknown"]})]}),(0,D.jsxs)("span",{className:bb("inline-flex items-center gap-2 rounded-full border px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.22em]",function(a,b){switch(a){case"healthy":return"light"===b?"border-emerald-300/80 bg-emerald-50 text-emerald-700":"border-emerald-400/25 bg-emerald-400/10 text-emerald-200";case"degraded":return"light"===b?"border-amber-300/90 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200";default:return"light"===b?"border-rose-300/80 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200"}}(a.diagnostics.health,b)),children:[(0,D.jsx)("span",{"aria-hidden":"true",className:bb("h-2 w-2 rounded-full shadow-[0_0_12px_currentColor]",function(a){switch(a){case"healthy":return"bg-emerald-400";case"degraded":return"bg-amber-300";default:return"bg-rose-300"}}(a.diagnostics.health))}),function(a){switch(a){case"healthy":return"Online";case"degraded":return"Degraded";default:return"Offline"}}(a.diagnostics.health)]}),(0,D.jsx)("button",{type:"button",role:"switch","aria-label":"light"===b?"Switch to dark theme":"Switch to light theme","aria-checked":"light"===b,onClick:n,className:M,children:(0,D.jsx)("span",{className:T,children:"light"===b?(0,D.jsx)(O,{className:"h-3 w-3"}):(0,D.jsx)(P,{className:"h-3 w-3"})})}),(0,D.jsx)("button",{type:"button","aria-label":"Open settings","aria-expanded":d,"aria-haspopup":"menu",onClick:o,className:K,children:(0,D.jsx)(Q,{className:"h-3.5 w-3.5"})})]}),d?(0,D.jsxs)("div",{role:"menu","aria-label":"OpenClaw settings",className:bb("absolute right-0 top-[calc(100%+12px)] z-[70] max-h-[min(82vh,calc(100svh-96px))] w-[300px] overflow-y-auto overscroll-contain rounded-[20px] border p-3 shadow-[0_22px_64px_rgba(0,0,0,0.24)] backdrop-blur-2xl","light"===b?"border-[#dbc9bc]/90 bg-[rgba(252,247,241,0.95)] text-[#4a382c] shadow-[0_24px_60px_rgba(161,125,101,0.18)]":"border-cyan-300/12 bg-[rgba(10,16,28,0.9)] text-slate-100"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bb("text-[8px] uppercase tracking-[0.24em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Settings"}),(0,D.jsx)("h3",{className:bb("mt-0.5 font-display text-[14px]","light"===b?"text-[#3f2f24]":"text-white"),children:"OpenClaw surface"})]}),(0,D.jsx)("span",{className:bb("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===b?"border-[#d6c0b0] bg-[#f3e7dc] text-[#8a7261]":"border-white/10 bg-white/[0.06] text-slate-400"),children:a.mode})]}),a.diagnostics.updateAvailable&&a.diagnostics.latestVersion?(0,D.jsxs)("div",{className:bb("mt-2.5 rounded-[18px] border px-3 py-3","light"===b?"border-amber-300/90 bg-[linear-gradient(135deg,rgba(255,247,237,0.98),rgba(252,231,214,0.94))] shadow-[0_16px_36px_rgba(194,120,55,0.16)]":"border-amber-300/30 bg-[linear-gradient(135deg,rgba(71,35,8,0.62),rgba(33,20,8,0.82))] shadow-[0_18px_42px_rgba(245,158,11,0.14)]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-2.5",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bb("text-[8px] uppercase tracking-[0.18em]","light"===b?"text-amber-800/70":"text-amber-200/80"),children:"Update available"}),(0,D.jsxs)("div",{className:"mt-1.5 flex items-baseline gap-1.5",children:[(0,D.jsxs)("p",{className:bb("font-display text-[0.98rem]","light"===b?"text-amber-950":"text-amber-50"),children:["v",a.diagnostics.latestVersion]}),(0,D.jsxs)("p",{className:bb("text-[9px]","light"===b?"text-amber-900/70":"text-amber-100/70"),children:["from v",a.diagnostics.version||"unknown"]})]})]}),(0,D.jsx)(R,{className:bb("mt-0.5 h-4 w-4","light"===b?"text-amber-700":"text-amber-300")})]}),(0,D.jsx)("p",{className:bb("mt-1.5 text-[10px] leading-[1.05rem]","light"===b?"text-amber-950/80":"text-amber-50/85"),children:"A newer OpenClaw release was detected. You can update directly from Mission Control."}),(0,D.jsx)("button",{type:"button",onClick:A,className:bb("mt-2.5 inline-flex items-center justify-center py-1",J),children:"Update now"})]}):null,(0,D.jsxs)("div",{className:bb("mt-2.5 rounded-[16px] border px-2.5 py-2","light"===b?"border-[#e6d7cb] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsx)("p",{className:bb("text-[8px] uppercase tracking-[0.18em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"OpenClaw version"}),(0,D.jsxs)("div",{className:"mt-1.5 flex items-center justify-between gap-2",children:[(0,D.jsx)("p",{className:bb("font-display text-[0.88rem]","light"===b?"text-[#3f2f24]":"text-white"),children:a.diagnostics.version||"Unavailable"}),a.diagnostics.updateChannel?(0,D.jsx)("span",{className:bb("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===b?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-cyan-400/14 bg-cyan-400/8 text-cyan-100"),children:a.diagnostics.updateChannel}):null]}),(0,D.jsx)("p",{className:bb("mt-1.5 text-[10px] leading-[1.05rem]","light"===b?"text-[#816958]":"text-slate-400"),children:a.diagnostics.updateInfo?.trim()||"No additional update message was returned in the latest OpenClaw status snapshot."}),(0,D.jsxs)("div",{className:"mt-3",children:[(0,D.jsx)(bp,{type:"button",size:"sm",variant:"secondary",onClick:()=>{u()},disabled:i,className:bb("w-full disabled:cursor-wait",a.diagnostics.updateAvailable?I:G),children:i?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Checking..."]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(S,{className:"mr-1.5 h-3.5 w-3.5"}),"Check for updates"]})}),m?(0,D.jsxs)("p",{className:bb("mt-2 text-center text-[9px]","light"===b?"text-[#8f7664]":"text-slate-500"),children:["Last checked at"," ",new Date(m).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]}):null]})]}),(0,D.jsxs)("div",{className:bb("mt-2 rounded-[16px] border px-2.5 py-2.5","light"===b?"border-[#e6d7cb] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bb("text-[8px] uppercase tracking-[0.18em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Setup center"}),(0,D.jsx)("p",{className:bb("mt-1 text-[10px] leading-[1.05rem]","light"===b?"text-[#816958]":"text-slate-400"),children:"Reopen the wizard, control the gateway, and manage the minimum model setup from one place."})]}),(0,D.jsx)("span",{className:bb("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]",C?"light"===b?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===b?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:C?"Ready":"Needs attention"})]}),(0,D.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,D.jsx)(bp,{type:"button",size:"sm",variant:"secondary",onClick:()=>w(a.diagnostics.rpcOk?"models":"system"),className:G,children:"Open wizard"}),(0,D.jsx)(bp,{type:"button",size:"sm",variant:"secondary",disabled:F,onClick:()=>{x()},className:G,children:"Refresh setup"})]}),(0,D.jsxs)("div",{className:bb("mt-3 rounded-[14px] border px-2.5 py-2.5","light"===b?"border-[#eadcd0] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bb("text-[11px]","light"===b?"text-[#9a7f6c]":"text-slate-400"),children:"Gateway control"}),(0,D.jsx)("p",{className:bb("mt-0.5 text-[10px] leading-[1.05rem]","light"===b?"text-[#816958]":"text-slate-500"),children:a.diagnostics.rpcOk?"Live RPC connection is online.":a.diagnostics.loaded?"Service is loaded but Mission Control cannot verify RPC yet.":"Service is not loaded on this machine yet."})]}),(0,D.jsx)("span",{className:bb("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]",a.diagnostics.rpcOk?"light"===b?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===b?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:a.diagnostics.rpcOk?"Online":a.diagnostics.loaded?"Service only":"Offline"})]}),(0,D.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,D.jsx)(bp,{type:"button",size:"sm",variant:"secondary",disabled:E||a.diagnostics.rpcOk,onClick:()=>{v("start")},className:G,children:"start"===l?"Starting...":"Start"}),(0,D.jsx)(bp,{type:"button",size:"sm",variant:"secondary",disabled:E||!a.diagnostics.loaded,onClick:()=>{v("restart")},className:G,children:"restart"===l?"Restarting...":"Restart"}),(0,D.jsx)(bp,{type:"button",size:"sm",variant:"secondary",disabled:E||!a.diagnostics.loaded,onClick:()=>{v("stop")},className:G,children:"stop"===l?"Stopping...":"Stop"})]})]}),(0,D.jsxs)("div",{className:bb("mt-2 rounded-[14px] border px-2.5 py-2.5","light"===b?"border-[#eadcd0] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bb("text-[11px]","light"===b?"text-[#9a7f6c]":"text-slate-400"),children:"Model setup"}),(0,D.jsxs)("p",{className:bb("mt-0.5 text-[10px] leading-[1.05rem]","light"===b?"text-[#816958]":"text-slate-500"),children:["Default model: ",a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||"Not set"]})]}),(0,D.jsxs)("span",{className:bb("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]",a.diagnostics.modelReadiness.ready?"light"===b?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===b?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:[a.diagnostics.modelReadiness.availableModelCount,"/",a.diagnostics.modelReadiness.totalModelCount]})]}),(0,D.jsxs)("select",{value:j,onChange:a=>r(a.target.value),disabled:F,className:bb("mt-2.5 h-9 w-full rounded-[14px] border px-2.5 text-[11px]","light"===b?"border-[#d9c9bc] bg-[#fffdfb] text-[#4f3d31]":"border-white/10 bg-white/[0.04] text-slate-100"),children:[(0,D.jsx)("option",{value:"",children:"Auto choose"}),a.models.filter(a=>!1!==a.available&&!a.missing).map(a=>(0,D.jsxs)("option",{value:a.id,children:[a.name," \xb7 ",a.provider]},a.id))]}),(0,D.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,D.jsx)(bp,{type:"button",size:"sm",variant:"secondary",disabled:F,onClick:()=>{y()},className:G,children:F?"Working...":"Use selected"}),(0,D.jsx)(bp,{type:"button",size:"sm",variant:"secondary",disabled:F,onClick:()=>{z()},className:G,children:"Add models"})]})]})]}),(0,D.jsxs)("div",{className:bb("mt-2 rounded-[16px] border px-2.5 py-2.5","light"===b?"border-[#e6d7cb] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)(rA,{htmlFor:"workspace-root",className:bb("text-[11px]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Workspace root"}),(0,D.jsx)("p",{className:bb("mt-0.5 text-[10px] leading-[1.05rem]","light"===b?"text-[#816958]":"text-slate-400"),children:"Default parent path for newly created workspaces. Existing workspaces stay at their current paths."})]}),(0,D.jsx)("span",{className:bb("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===b?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-white/10 bg-white/[0.05] text-slate-300"),children:"New only"})]}),(0,D.jsx)(bq,{id:"workspace-root",value:f,onChange:a=>q(a.target.value),placeholder:"~/Documents/Shared/projects",disabled:h,style:"light"===b?{colorScheme:"light"}:void 0,className:bb("mt-2.5 h-9 rounded-[14px] px-2.5 text-[11px]","light"===b?"border-[#d9c9bc] bg-[#fffdfb] text-[#4f3d31] caret-[#7c5a46] placeholder:text-[#b29b8b] shadow-[inset_0_0_0_1000px_#fffdfb] [-webkit-text-fill-color:#4f3d31] focus-visible:ring-[#c8946f]/45":"border-white/10 bg-white/[0.04] text-slate-100 placeholder:text-slate-500")}),(0,D.jsxs)("p",{className:bb("mt-1.5 break-all font-mono text-[9px] leading-[1rem]","light"===b?"text-[#6f5a4b]":"text-slate-300"),children:["Configured root: ",a.diagnostics.configuredWorkspaceRoot?qV(a.diagnostics.configuredWorkspaceRoot):"default"]}),(0,D.jsxs)("p",{className:bb("mt-1 break-all font-mono text-[9px] leading-[1rem]","light"===b?"text-[#6f5a4b]":"text-slate-300"),children:["Effective root: ",qV(a.diagnostics.workspaceRoot)]}),(0,D.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,D.jsx)(bp,{type:"button",size:"sm",variant:"secondary",disabled:h,onClick:()=>{t(null)},className:G,children:"Use default"}),(0,D.jsx)(bp,{type:"button",size:"sm",disabled:h,onClick:()=>{t(f)},className:H,children:h?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):"Save root"})]})]}),(0,D.jsxs)("div",{className:bb("mt-2 rounded-[16px] border px-2.5 py-2.5","light"===b?"border-[#e6d7cb] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)(rA,{htmlFor:"gateway-url",className:bb("text-[11px]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"OpenClaw gateway"}),(0,D.jsx)("p",{className:bb("mt-0.5 text-[10px] leading-[1.05rem]","light"===b?"text-[#816958]":"text-slate-400"),children:"Enter a `ws://` or `wss://` endpoint. Leave it empty to use the local default gateway."})]}),(0,D.jsx)("span",{className:bb("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===b?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-white/10 bg-white/[0.05] text-slate-300"),children:a.diagnostics.bindMode||"default"})]}),(0,D.jsx)(bq,{id:"gateway-url",value:e,onChange:a=>p(a.target.value),placeholder:"ws://127.0.0.1:18789",disabled:g,style:"light"===b?{colorScheme:"light"}:void 0,className:bb("mt-2.5 h-9 rounded-[14px] px-2.5 text-[11px]","light"===b?"border-[#d9c9bc] bg-[#fffdfb] text-[#4f3d31] caret-[#7c5a46] placeholder:text-[#b29b8b] shadow-[inset_0_0_0_1000px_#fffdfb] [-webkit-text-fill-color:#4f3d31] focus-visible:ring-[#c8946f]/45":"border-white/10 bg-white/[0.04] text-slate-100 placeholder:text-slate-500")}),(0,D.jsxs)("p",{className:bb("mt-1.5 break-all font-mono text-[9px] leading-[1rem]","light"===b?"text-[#6f5a4b]":"text-slate-300"),children:["Configured endpoint: ",a.diagnostics.configuredGatewayUrl||"local default"]}),(0,D.jsxs)("p",{className:bb("mt-1 break-all font-mono text-[9px] leading-[1rem]","light"===b?"text-[#6f5a4b]":"text-slate-300"),children:["Effective endpoint: ",a.diagnostics.gatewayUrl]}),(0,D.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,D.jsx)(bp,{type:"button",size:"sm",variant:"secondary",disabled:g,onClick:()=>{s(null)},className:G,children:"Use local"}),(0,D.jsx)(bp,{type:"button",size:"sm",disabled:g,onClick:()=>{s(e)},className:H,children:g?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):"Save gateway"})]})]}),(0,D.jsxs)("div",{className:bb("mt-2 rounded-[16px] border px-2.5 py-2.5","light"===b?"border-rose-200 bg-[linear-gradient(135deg,rgba(255,245,245,0.96),rgba(255,236,236,0.92))]":"border-rose-400/18 bg-[linear-gradient(135deg,rgba(62,16,24,0.46),rgba(24,10,15,0.82))]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bb("text-[8px] uppercase tracking-[0.18em]","light"===b?"text-rose-700/80":"text-rose-200/75"),children:"Danger zone"}),(0,D.jsx)("p",{className:bb("mt-1 text-[10px] leading-[1.05rem]","light"===b?"text-rose-900/80":"text-rose-100/80"),children:"Review exactly which workspaces, agents, integration files, and packages would be removed before taking irreversible actions."})]}),(0,D.jsx)(N,{className:bb("mt-0.5 h-4 w-4","light"===b?"text-rose-700":"text-rose-200")})]}),(0,D.jsxs)("div",{className:"mt-3 grid gap-2",children:[(0,D.jsx)(bp,{type:"button",size:"sm",variant:"secondary",onClick:()=>B("mission-control"),className:bb("justify-start","light"===b?"border-rose-200 bg-white text-rose-900 hover:bg-rose-50 hover:text-rose-900":"border-rose-400/20 bg-white/[0.04] text-rose-100 hover:bg-rose-500/10"),children:"Reset Mission Control"}),(0,D.jsx)(bp,{type:"button",size:"sm",variant:"secondary",onClick:()=>B("full-uninstall"),className:bb("justify-start","light"===b?"border-rose-300 bg-rose-600 text-white hover:bg-rose-700":"border-rose-400/24 bg-rose-500/90 text-white hover:bg-rose-500"),children:"Full Uninstall"})]})]})]}):null]})]})}function uB(a){return a.mission?.trim()?a.mission.trim():a.title.trim()?a.title.trim():a.subtitle.trim()||"Continue this task."}function uC(a){let b="string"==typeof a.metadata.dispatchStatus?a.metadata.dispatchStatus:null,c=a.status;return"cancelled"===b||"aborted"===b||"cancelled"===c||"aborted"===c}function uD(a){if(uC(a))return!1;let b=a.status;return"running"===b||"queued"===b}function uE(a,b){let c,d=(Array.isArray(c=a.metadata.optimisticEvents)?c.filter(uF):[]).concat(b.feedEvent);return{...a,dispatchId:b.dispatchId??a.dispatchId,status:b.status,subtitle:b.subtitle,updatedAt:Date.now(),liveRunCount:+("stalled"!==b.status&&"cancelled"!==b.status),warningCount:"stalled"===b.status||"cancelled"===b.status?1:a.warningCount,metadata:{...a.metadata,bootstrapStage:b.bootstrapStage,optimisticEvents:function(a){let b=new Map;for(let c of a)b.set(c.id,c);return[...b.values()].sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp))}(d)}}}function uF(a){return"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.kind&&"string"==typeof a.timestamp&&"string"==typeof a.title&&"string"==typeof a.detail}function uG(a,b){let c=a.replace(/\s+/g," ").trim();return c.length<=b?c:`${c.slice(0,Math.max(b-1,1)).trimEnd()}…`}function uH(a){return(a.diagnostics.configuredGatewayUrl||a.diagnostics.gatewayUrl).replace(/\/$/,"")}function uI(a){return qV(a.diagnostics.configuredWorkspaceRoot||a.diagnostics.workspaceRoot)}function uJ(a,b){let c="h-8 rounded-[12px] border px-2.5 text-[9px] uppercase tracking-[0.18em] transition-[background-color,border-color,color,box-shadow,transform] duration-150 active:scale-[0.985]";return"primary"===b?bb(c,"light"===a?"border-[#c8946f] bg-[#c8946f] text-white shadow-[0_12px_28px_rgba(200,148,111,0.24)] hover:bg-[#b88461] hover:border-[#b88461] hover:text-white active:bg-[#a97553] active:border-[#a97553]":"border-cyan-300/30 bg-cyan-300 text-slate-950 shadow-[0_12px_28px_rgba(34,211,238,0.2)] hover:bg-cyan-200 hover:border-cyan-200 hover:text-slate-950 active:bg-cyan-100 active:border-cyan-100"):"warning"===b?bb(c,"light"===a?"border-amber-400/90 bg-amber-100 text-amber-900 shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-amber-200 hover:border-amber-400 hover:text-amber-900 active:bg-amber-300":"border-amber-300/35 bg-amber-300/16 text-amber-100 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)] hover:bg-amber-300/24 hover:border-amber-300/45 hover:text-amber-50 active:bg-amber-300/30"):"warningSolid"===b?bb(c,"light"===a?"border-amber-900 bg-amber-900 text-amber-50 shadow-[0_12px_28px_rgba(146,64,14,0.18)] hover:bg-amber-800 hover:border-amber-800 hover:text-amber-50 active:bg-amber-700 active:border-amber-700":"border-amber-300 bg-amber-300 text-slate-950 shadow-[0_12px_28px_rgba(245,158,11,0.18)] hover:bg-amber-200 hover:border-amber-200 hover:text-slate-950 active:bg-amber-100 active:border-amber-100"):bb(c,"light"===a?"border-[#d3bba9] bg-[#f1e3d7] text-[#6f5949] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#ead8ca] hover:border-[#caa98f] hover:text-[#5f4a3d] active:bg-[#dfc9b7] active:border-[#bf9c82]":"border-white/12 bg-white/[0.05] text-slate-200 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)] hover:bg-white/[0.1] hover:border-white/16 hover:text-slate-100 active:bg-white/[0.14] active:border-white/20")}},2544:(a,b,c)=>{"use strict";var d=c(636),e="function"==typeof Object.is?Object.is:function(a,b){return a===b&&(0!==a||1/a==1/b)||a!=a&&b!=b},f=d.useState,g=d.useEffect,h=d.useLayoutEffect,i=d.useDebugValue;function j(a){var b=a.getSnapshot;a=a.value;try{var c=b();return!e(a,c)}catch(a){return!0}}var k="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(a,b){return b()}:function(a,b){var c=b(),d=f({inst:{value:c,getSnapshot:b}}),e=d[0].inst,k=d[1];return h(function(){e.value=c,e.getSnapshot=b,j(e)&&k({inst:e})},[a,c,b]),g(function(){return j(e)&&k({inst:e}),a(function(){j(e)&&k({inst:e})})},[a]),i(c),c};b.useSyncExternalStore=void 0!==d.useSyncExternalStore?d.useSyncExternalStore:k},2671:(a,b,c)=>{Promise.resolve().then(c.bind(c,2045))},2721:(a,b,c)=>{"use strict";c.d(b,{Toaster:()=>e});var d=c(2623);let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call Toaster() from the server but Toaster is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/kazimakgul/Documents/GitHub/AgentOS/components/ui/sonner.tsx","Toaster");(0,d.registerClientReference)(function(){throw Error("Attempted to call toast() from the server but toast is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/kazimakgul/Documents/GitHub/AgentOS/components/ui/sonner.tsx","toast")},3024:a=>{"use strict";a.exports=require("node:fs")},3033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},3703:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>h,dynamic:()=>g});var d=c(9055),e=c(9787),f=c(9879);let g="force-dynamic";async function h(){let a=await (0,f.GM)();return(0,d.jsx)(e.MissionControlShell,{initialSnapshot:a})}},3823:(a,b,c)=>{"use strict";var d=c(636),e=c(1231),f="function"==typeof Object.is?Object.is:function(a,b){return a===b&&(0!==a||1/a==1/b)||a!=a&&b!=b},g=e.useSyncExternalStore,h=d.useRef,i=d.useEffect,j=d.useMemo,k=d.useDebugValue;b.useSyncExternalStoreWithSelector=function(a,b,c,d,e){var l=h(null);if(null===l.current){var m={hasValue:!1,value:null};l.current=m}else m=l.current;var n=g(a,(l=j(function(){function a(a){if(!i){if(i=!0,g=a,a=d(a),void 0!==e&&m.hasValue){var b=m.value;if(e(b,a))return h=b}return h=a}if(b=h,f(g,a))return b;var c=d(a);return void 0!==e&&e(b,c)?(g=a,b):(g=a,h=c)}var g,h,i=!1,j=void 0===c?null:c;return[function(){return a(b())},null===j?void 0:function(){return a(j())}]},[b,c,d,e]))[0],l[1]);return i(function(){m.hasValue=!0,m.value=n},[n]),k(n),n}},3873:a=>{"use strict";a.exports=require("path")},3954:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/interception-routes")},4918:(a,b,c)=>{Promise.resolve().then(c.bind(c,9711))},5222:()=>{},6439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},6713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},6760:a=>{"use strict";a.exports=require("node:path")},6836:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,7809,23)),Promise.resolve().then(c.t.bind(c,1992,23)),Promise.resolve().then(c.t.bind(c,3926,23)),Promise.resolve().then(c.t.bind(c,5225,23)),Promise.resolve().then(c.t.bind(c,7581,23)),Promise.resolve().then(c.t.bind(c,9511,23)),Promise.resolve().then(c.t.bind(c,6136,23)),Promise.resolve().then(c.bind(c,5669))},6980:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,5987,23)),Promise.resolve().then(c.t.bind(c,3394,23)),Promise.resolve().then(c.t.bind(c,4612,23)),Promise.resolve().then(c.t.bind(c,3051,23)),Promise.resolve().then(c.t.bind(c,3467,23)),Promise.resolve().then(c.t.bind(c,2757,23)),Promise.resolve().then(c.t.bind(c,7786,23)),Promise.resolve().then(c.t.bind(c,107,23))},7068:a=>{"use strict";a.exports=require("next/dist/shared/lib/size-limit")},7591:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GlobalError:()=>D.a,__next_app__:()=>L,handler:()=>N,routeModule:()=>M});var d=c(6761),e=c(5246),f=c(8830),g=c(4111),h=c(2533),i=c(6701),j=c(4788),k=c(7301),l=c(9682),m=c(5471),n=c(523),o=c(6867),p=c(9530),q=c(261),r=c(9902),s=c(8323),t=c(6713),u=c(2559),v=c(7900),w=c(2976),x=c(8049),y=c(6087),z=c(6525),A=c(6439),B=c(7068),C=c(5987),D=c.n(C),E=c(7711),F=c(782),G=c(722),H=c(5257),I=c(3954),J={};for(let a in E)0>["default","GlobalError","__next_app__","routeModule","handler"].indexOf(a)&&(J[a]=()=>E[a]);c.d(b,J);let K=["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,3703)),"/Users/kazimakgul/Documents/GitHub/AgentOS/app/page.tsx"]}]},{layout:[()=>Promise.resolve().then(c.bind(c,9616)),"/Users/kazimakgul/Documents/GitHub/AgentOS/app/layout.tsx"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,5987,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.bind(c,9380)),"/Users/kazimakgul/Documents/GitHub/AgentOS/app/not-found.tsx"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,1326,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,265,23)),"next/dist/client/components/builtin/unauthorized.js"]}],L={require:c,loadChunk:()=>Promise.resolve()},M=new d.AppPageRouteModule({definition:{kind:e.RouteKind.APP_PAGE,page:"/page",pathname:"/",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:K},distDir:".next",relativeProjectDir:""});async function N(a,b,d){var C;M.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let J=!!(0,h.getRequestMeta)(a,"minimalMode"),O="/page";"/index"===O&&(O="/");let P=await M.prepare(a,b,{srcPage:O,multiZoneDraftMode:!1});if(!P)return b.statusCode=400,b.end("Bad Request"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let{buildId:Q,query:R,params:S,pageIsDynamic:T,buildManifest:U,nextFontManifest:V,reactLoadableManifest:W,serverActionsManifest:X,clientReferenceManifest:Y,subresourceIntegrityManifest:Z,prerenderManifest:$,isDraftMode:_,resolvedPathname:aa,revalidateOnlyGenerated:ab,routerServerContext:ac,nextConfig:ad,parsedUrl:ae,interceptionRoutePatterns:af,deploymentId:ag}=P,ah=(0,q.normalizeAppPath)(O),{isOnDemandRevalidate:ai}=P,aj=ad.experimental.ppr&&!ad.cacheComponents&&(0,I.isInterceptionRouteAppPath)(aa)?null:M.match(aa,$),ak=!!$.routes[aa],al=a.headers["user-agent"]||"",am=(0,t.getBotType)(al),an=(0,p.isHtmlBotRequest)(a),ao=(0,h.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[s.NEXT_ROUTER_PREFETCH_HEADER],ap=(0,h.getRequestMeta)(a,"isRSCRequest")??!!a.headers[s.RSC_HEADER],aq=(0,r.getIsPossibleServerAction)(a),ar=(0,m.checkIsAppPPREnabled)(ad.experimental.ppr);if(!(0,h.getRequestMeta)(a,"postponed")&&ar&&"1"===a.headers[x.NEXT_RESUME_HEADER]&&"POST"===a.method){let b=[];for await(let c of a)b.push(c);let c=Buffer.concat(b).toString("utf8");(0,h.addRequestMeta)(a,"postponed",c)}let as=ar&&(null==(C=$.routes[ah]??$.dynamicRoutes[ah])?void 0:C.renderingMode)==="PARTIALLY_STATIC",at=!1,au=!1,av=as?(0,h.getRequestMeta)(a,"postponed"):void 0,aw=as&&ap&&!ao;J&&(aw=aw&&!!av);let ax=(0,h.getRequestMeta)(a,"segmentPrefetchRSCRequest"),ay=(!an||!as)&&(!al||(0,p.shouldServeStreamingMetadata)(al,ad.htmlLimitedBots)),az=!!((aj||ak||$.routes[ah])&&!(an&&as)),aA=as&&!0===ad.cacheComponents,aB=!0===M.isDev||!az||"string"==typeof av||(aA&&(0,h.getRequestMeta)(a,"onCacheEntryV2")?aw&&!J:aw),aC=an&&as,aD=null;_||!az||aB||aq||av||aw||(aD=aa);let aE=aD;!aE&&M.isDev&&(aE=aa),M.isDev||_||!az||!ap||aw||(0,k.d)(a.headers);let aF={...E,tree:K,GlobalError:D(),handler:N,routeModule:M,__next_app__:L};X&&Y&&(0,o.setManifestsSingleton)({page:O,clientReferenceManifest:Y,serverActionsManifest:X});let aG=a.method||"GET",aH=(0,g.getTracer)(),aI=aH.getActiveScopeSpan(),aJ=async()=>((null==ac?void 0:ac.render404)?await ac.render404(a,b,ae,!1):b.end("This page could not be found"),null);try{let f=M.getVaryHeader(aa,af);b.setHeader("Vary",f);let k=async(c,d)=>{let e=new l.NodeNextRequest(a),f=new l.NodeNextResponse(b);return M.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let a=aH.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==i.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let d=a.get("next.route");if(d){let a=`${aG} ${d}`;c.setAttributes({"next.route":d,"http.route":d,"next.span_name":a}),c.updateName(a)}else c.updateName(`${aG} ${O}`)})},m=(0,h.getRequestMeta)(a,"incrementalCache"),o=async({span:e,postponed:f,fallbackRouteParams:g,forceStaticRender:i})=>{let l={query:R,params:S,page:ah,sharedContext:{buildId:Q},serverComponentsHmrCache:(0,h.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:g,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aF,Component:(0,j.T)(aF),params:S,routeModule:M,page:O,postponed:f,shouldWaitOnAllReady:aC,serveStreamingMetadata:ay,supportsDynamicResponse:"string"==typeof f||aB,buildManifest:U,nextFontManifest:V,reactLoadableManifest:W,subresourceIntegrityManifest:Z,setCacheStatus:null==ac?void 0:ac.setCacheStatus,setIsrStatus:null==ac?void 0:ac.setIsrStatus,setReactDebugChannel:null==ac?void 0:ac.setReactDebugChannel,sendErrorsToBrowser:null==ac?void 0:ac.sendErrorsToBrowser,dir:c(3873).join(process.cwd(),M.relativeProjectDir),isDraftMode:_,botType:am,isOnDemandRevalidate:ai,isPossibleServerAction:aq,assetPrefix:ad.assetPrefix,nextConfigOutput:ad.output,crossOrigin:ad.crossOrigin,trailingSlash:ad.trailingSlash,images:ad.images,previewProps:$.preview,deploymentId:ag,enableTainting:ad.experimental.taint,htmlLimitedBots:ad.htmlLimitedBots,reactMaxHeadersLength:ad.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:m,cacheLifeProfiles:ad.cacheLife,basePath:ad.basePath,serverActions:ad.experimental.serverActions,...at||au?{nextExport:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isDebugDynamicAccesses:at}:{},cacheComponents:!!ad.cacheComponents,experimental:{isRoutePPREnabled:as,expireTime:ad.expireTime,staleTimes:ad.experimental.staleTimes,dynamicOnHover:!!ad.experimental.dynamicOnHover,inlineCss:!!ad.experimental.inlineCss,authInterrupts:!!ad.experimental.authInterrupts,clientTraceMetadata:ad.experimental.clientTraceMetadata||[],clientParamParsingOrigins:ad.experimental.clientParamParsingOrigins,maxPostponedStateSizeBytes:(0,B.parseMaxPostponedStateSize)(ad.experimental.maxPostponedStateSize)},waitUntil:d.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d,e)=>M.onRequestError(a,b,d,e,ac),err:(0,h.getRequestMeta)(a,"invokeError"),dev:M.isDev}};at&&(l.renderOpts.nextExport=!0,l.renderOpts.supportsDynamicResponse=!1,l.renderOpts.isDebugDynamicAccesses=at),i&&(l.renderOpts.supportsDynamicResponse=!1);let n=await k(e,l),{metadata:o}=n,{cacheControl:p,headers:q={},fetchTags:r,fetchMetrics:s}=o;if(r&&(q[x.NEXT_CACHE_TAGS_HEADER]=r),a.fetchMetrics=s,az&&(null==p?void 0:p.revalidate)===0&&!M.isDev&&!as){let a=o.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${aa}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""}
27
- see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:u.CachedRouteKind.APP_PAGE,html:n,headers:q,rscData:o.flightData,postponed:o.postponed,status:o.statusCode,segmentData:o.segmentData},cacheControl:p}},p=async({hasResolved:c,previousCacheEntry:f,isRevalidating:g,span:i,forceStaticRender:j=!1})=>{let k,l=!1===M.isDev,q=c||b.writableEnded;if(ai&&ab&&!f&&!J)return(null==ac?void 0:ac.render404)?await ac.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(aj&&(k=(0,v.parseFallbackField)(aj.fallback)),k===v.FallbackMode.PRERENDER&&(0,t.isBot)(al)&&(!as||an)&&(k=v.FallbackMode.BLOCKING_STATIC_RENDER),(null==f?void 0:f.isStale)===-1&&(ai=!0),ai&&(k!==v.FallbackMode.NOT_FOUND||f)&&(k=v.FallbackMode.BLOCKING_STATIC_RENDER),!J&&k!==v.FallbackMode.BLOCKING_STATIC_RENDER&&aE&&!q&&!_&&T&&(l||!ak)){if((l||aj)&&k===v.FallbackMode.NOT_FOUND){if(ad.experimental.adapterPath)return await aJ();throw new A.NoFallbackError}if(as&&(ad.cacheComponents?!aw:!ap)){let b=l&&"string"==typeof(null==aj?void 0:aj.fallback)?aj.fallback:ah,c=l&&(null==aj?void 0:aj.fallbackRouteParams)?(0,n.createOpaqueFallbackRouteParams)(aj.fallbackRouteParams):au?(0,n.getFallbackRouteParams)(ah,M):null,f=await M.handleResponse({cacheKey:b,req:a,nextConfig:ad,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:$,isRoutePPREnabled:as,responseGenerator:async()=>o({span:i,postponed:void 0,fallbackRouteParams:c,forceStaticRender:!1}),waitUntil:d.waitUntil,isMinimalMode:J});if(null===f)return null;if(f)return delete f.cacheControl,f}}let r=ai||g||!av?void 0:av;if(aA&&!J&&m&&aw&&!j){let b=await m.get(aa,{kind:u.IncrementalCacheKind.APP_PAGE,isRoutePPREnabled:!0,isFallback:!1});b&&b.value&&b.value.kind===u.CachedRouteKind.APP_PAGE&&(r=b.value.postponed,b&&(-1===b.isStale||!0===b.isStale)&&(0,H.scheduleOnNextTick)(async()=>{let b=M.getResponseCache(a);try{await b.revalidate(aa,m,as,!1,a=>p({...a,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}))}if(at&&void 0!==r)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:u.CachedRouteKind.PAGES,html:w.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let s=l&&(null==aj?void 0:aj.fallbackRouteParams)&&(0,h.getRequestMeta)(a,"renderFallbackShell")?(0,n.createOpaqueFallbackRouteParams)(aj.fallbackRouteParams):au?(0,n.getFallbackRouteParams)(ah,M):null;return o({span:i,postponed:r,fallbackRouteParams:s,forceStaticRender:j})},q=async c=>{var f,g,i,j,k;let l,m=await M.handleResponse({cacheKey:aD,responseGenerator:a=>p({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ai,isRoutePPREnabled:as,req:a,nextConfig:ad,prerenderManifest:$,waitUntil:d.waitUntil,isMinimalMode:J});if(_&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),M.isDev&&b.setHeader("Cache-Control","no-store, must-revalidate"),!m){if(aD)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=m.value)?void 0:f.kind)!==u.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=m.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let n="string"==typeof m.value.postponed;az&&!aw&&(!n||ao)&&(J||b.setHeader("x-nextjs-cache",ai?"REVALIDATED":m.isMiss?"MISS":m.isStale?"STALE":"HIT"),b.setHeader(s.NEXT_IS_PRERENDER_HEADER,"1"));let{value:q}=m;if(av)l={revalidate:0,expire:void 0};else if(aw)l={revalidate:0,expire:void 0};else if(!M.isDev)if(_)l={revalidate:0,expire:void 0};else if(az){if(m.cacheControl)if("number"==typeof m.cacheControl.revalidate){if(m.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${m.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});l={revalidate:m.cacheControl.revalidate,expire:(null==(j=m.cacheControl)?void 0:j.expire)??ad.expireTime}}else l={revalidate:x.CACHE_ONE_YEAR,expire:void 0}}else b.getHeader("Cache-Control")||(l={revalidate:0,expire:void 0});if(m.cacheControl=l,"string"==typeof ax&&(null==q?void 0:q.kind)===u.CachedRouteKind.APP_PAGE&&q.segmentData){b.setHeader(s.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=q.headers)?void 0:k[x.NEXT_CACHE_TAGS_HEADER];J&&az&&c&&"string"==typeof c&&b.setHeader(x.NEXT_CACHE_TAGS_HEADER,c);let d=q.segmentData.get(ax);return void 0!==d?(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:w.default.fromStatic(d,s.RSC_CONTENT_TYPE_HEADER),cacheControl:m.cacheControl}):(b.statusCode=204,(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:w.default.EMPTY,cacheControl:m.cacheControl}))}let r=aA?(0,h.getRequestMeta)(a,"onCacheEntryV2")??(0,h.getRequestMeta)(a,"onCacheEntry"):(0,h.getRequestMeta)(a,"onCacheEntry");if(r&&await r(m,{url:(0,h.getRequestMeta)(a,"initURL")??a.url}))return null;if(q.headers){let a={...q.headers};for(let[c,d]of(J&&az||delete a[x.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let t=null==(g=q.headers)?void 0:g[x.NEXT_CACHE_TAGS_HEADER];if(J&&az&&t&&"string"==typeof t&&b.setHeader(x.NEXT_CACHE_TAGS_HEADER,t),!q.status||ap&&as||(b.statusCode=q.status),!J&&q.status&&F.RedirectStatusCode[q.status]&&ap&&(b.statusCode=200),n&&!aw&&b.setHeader(s.NEXT_DID_POSTPONE_HEADER,"1"),ap&&!_){if(void 0===q.rscData){if(q.html.contentType!==s.RSC_CONTENT_TYPE_HEADER)if(ad.cacheComponents)return b.statusCode=404,(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:w.default.EMPTY,cacheControl:m.cacheControl});else throw Object.defineProperty(new G.InvariantError(`Expected RSC response, got ${q.html.contentType}`),"__NEXT_ERROR_CODE",{value:"E789",enumerable:!1,configurable:!0});return(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:q.html,cacheControl:m.cacheControl})}return(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:w.default.fromStatic(q.rscData,s.RSC_CONTENT_TYPE_HEADER),cacheControl:m.cacheControl})}let v=q.html;if(!n||J||ap)return(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:v,cacheControl:m.cacheControl});if(at)return v.push(new ReadableStream({start(a){a.enqueue(y.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:v,cacheControl:{revalidate:0,expire:void 0}});let A=new TransformStream;return v.push(A.readable),o({span:c,postponed:q.postponed,fallbackRouteParams:null,forceStaticRender:!1}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==u.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(A.writable)}).catch(a=>{A.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:v,cacheControl:{revalidate:0,expire:void 0}})};if(!aI)return await aH.withPropagatedContext(a.headers,()=>aH.trace(i.BaseServerSpan.handleRequest,{spanName:`${aG} ${O}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aG,"http.target":a.url}},q));await q(aI)}catch(b){throw b instanceof A.NoFallbackError||await M.onRequestError(a,b,{routerKind:"App Router",routePath:O,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:az,isOnDemandRevalidate:ai})},!1,ac),b}}},7598:a=>{"use strict";a.exports=require("node:crypto")},7881:(a,b,c)=>{"use strict";a.exports=c(3823)},7975:a=>{"use strict";a.exports=require("node:util")},8161:a=>{"use strict";a.exports=require("node:os")},8354:a=>{"use strict";a.exports=require("util")},9121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},9294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},9380:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(9055);function e(){return(0,d.jsx)("main",{className:"flex min-h-screen items-center justify-center bg-[#050816] px-6 text-white",children:(0,d.jsxs)("div",{className:"rounded-[24px] border border-white/10 bg-white/[0.03] px-8 py-10 text-center shadow-[0_24px_80px_rgba(0,0,0,0.35)] backdrop-blur-xl",children:[(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-[0.32em] text-slate-500",children:"OpenClaw"}),(0,d.jsx)("h1",{className:"mt-3 font-display text-3xl",children:"Page not found"}),(0,d.jsx)("p",{className:"mt-3 max-w-md text-sm leading-6 text-slate-400",children:"The requested mission-control route does not exist in this workspace."})]})})}},9527:(a,b,c)=>{Promise.resolve().then(c.bind(c,9787))},9616:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>m,metadata:()=>l,viewport:()=>k});var d=c(9055),e=c(2721);c(216);let f="AgentOS | OpenClaw Mission Control",g="Human Control Layer for AI Agents and Companies | Built on OpenClaw.",h="/readme/agentos1.webp",i=process.env.NEXT_PUBLIC_SITE_URL??process.env.VERCEL_URL,j=new URL(i?i.startsWith("http")?i:`https://${i}`:"http://localhost:3000"),k={themeColor:"#09101c"},l={metadataBase:j,title:f,description:g,applicationName:"AgentOS | Mission Control",manifest:"/site.webmanifest",openGraph:{type:"website",siteName:"AgentOS | Mission Control",title:f,description:g,images:[{url:h,width:1536,height:1024,alt:"AgentOS mission-control interface"}]},twitter:{card:"summary_large_image",title:f,description:g,images:[h]},icons:{icon:[{url:"/favicon.ico",sizes:"any"},{url:"/favicon-16x16.png",sizes:"16x16",type:"image/png"},{url:"/favicon-32x32.png",sizes:"32x32",type:"image/png"}],apple:[{url:"/apple-touch-icon.png",sizes:"180x180",type:"image/png"}],shortcut:["/favicon.ico"]}};function m({children:a}){return(0,d.jsx)("html",{lang:"en",className:"dark",suppressHydrationWarning:!0,children:(0,d.jsxs)("body",{children:[a,(0,d.jsx)(e.Toaster,{theme:"dark",richColors:!0,closeButton:!0})]})})}},9711:(a,b,c)=>{"use strict";c.d(b,{Toaster:()=>d.l$,o:()=>d.oR});var d=c(8031)},9787:(a,b,c)=>{"use strict";c.d(b,{MissionControlShell:()=>d});let d=(0,c(2623).registerClientReference)(function(){throw Error("Attempted to call MissionControlShell() from the server but MissionControlShell is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/kazimakgul/Documents/GitHub/AgentOS/components/mission-control/mission-control-shell.tsx","MissionControlShell")}};var b=require("../webpack-runtime.js");b.C(a);var c=b.X(0,[709,463,31,419],()=>b(b.s=7591));module.exports=c})();
174
+ `)):"log"===b.type?cc(`${b.text}
175
+ `):(e=!0,aq(null),as(b.message),au(b.backgroundLogPath??null),ao(b.ok?"success":"error"),b.snapshot&&m(b.snapshot),b.ok?(ct(),ec.o.success("full-uninstall"===af?"Full uninstall started.":"Mission Control reset completed.",{description:b.message})):ec.o.error("full-uninstall"===af?"Full uninstall failed.":"Mission Control reset failed.",{description:b.message}))}g=d.indexOf("\n")}}let f=d.trim();if(f){let a=JSON.parse(f);"done"===a.type&&(e=!0,aq(null),as(a.message),au(a.backgroundLogPath??null),ao(a.ok?"success":"error"),a.snapshot&&m(a.snapshot),a.ok&&ct())}if(!e)throw Error("Reset stream ended unexpectedly.")}catch(a){ao("error"),aq(null),as(a instanceof Error?a.message:"Reset failed."),ec.o.error("full-uninstall"===af?"Full uninstall failed.":"Mission Control reset failed.",{description:a instanceof Error?a.message:"Unknown reset error."})}}};return(0,D.jsxs)("div",{className:bc("mission-shell relative min-h-screen overflow-hidden","light"===bB&&"mission-shell--light"),children:[(0,D.jsxs)("div",{className:"mission-canvas-backdrop absolute inset-0 z-0",children:[(0,D.jsx)("div",{"aria-hidden":"true",className:"mission-canvas-pattern absolute inset-0 z-0"}),(0,D.jsx)("div",{className:"absolute inset-0 z-10",children:(0,D.jsx)(rs,{snapshot:bP,activeWorkspaceId:n,selectedNodeId:p,focusedAgentId:r,recentDispatchId:x,hiddenRuntimeIds:F,hiddenTaskKeys:H,lockedTaskKeys:J,onToggleWorkspaceTaskCards:b2,className:"rounded-none",onEditAgent:a=>{bQ(a),R({requestId:`edit:${a}:${Date.now()}`,kind:"edit",agentId:a})},onDeleteAgent:a=>{bQ(a),R({requestId:`delete:${a}:${Date.now()}`,kind:"delete",agentId:a})},onFocusAgent:b3,onReplyTask:a=>{let b=u8(a);C({id:`reply:${a.id}:${Date.now()}`,mission:b,agentId:a.primaryAgentId,sourceKind:"reply",sourceLabel:a.title.trim()||a.subtitle.trim()||a.id})},onCopyTaskPrompt:async a=>{let b=u8(a);C({id:`copy:${a.id}:${Date.now()}`,mission:b,agentId:a.primaryAgentId,sourceKind:"copy",sourceLabel:a.title.trim()||a.subtitle.trim()||a.id});try{await navigator.clipboard.writeText(b),ec.o.success("Prompt copied to clipboard.",{description:"The mission input was also populated."})}catch{ec.o.message("Prompt moved into mission input.",{description:"Clipboard access was not available."})}},onHideTask:a=>{J.includes(a.key)||(I(b=>b.includes(a.key)?b:[...b,a.key]),G(b=>{let c=new Set(b);return a.runtimeIds.forEach(a=>c.add(a)),Array.from(c)}))},onToggleTaskLock:a=>{K(b=>b.includes(a.key)?b.filter(b=>b!==a.key):[...b,a.key])},onAbortTask:a=>{u9(a)&&(T(a),V("idle"),X(null))},onInspectTask:(a,b)=>{bQ(a.id,b),aa(!0)},onSelectNode:a=>{bQ(a)}})})]}),(0,D.jsx)("div",{className:bc("pointer-events-none absolute top-0 z-40 hidden lg:block",Z?"lg:left-[442px]":"lg:left-[118px]",_?"lg:right-[442px]":"lg:right-[118px]"),children:(0,D.jsx)(u7,{snapshot:i,surfaceTheme:bB,settingsRef:bR,isSettingsOpen:ab,gatewayDraft:az,workspaceRootDraft:aB,isSavingGateway:aD,isSavingWorkspaceRoot:aF,isCheckingForUpdates:ad,selectedModelId:a5,modelOnboardingRunState:a9,gatewayControlAction:bx,lastCheckedAt:bz,onToggleTheme:()=>bC(a=>"light"===a?"dark":"light"),onToggleSettings:()=>ac(a=>!a),onGatewayDraftChange:aA,onWorkspaceRootDraftChange:aC,onSelectedModelIdChange:a6,onSaveGatewaySettings:cr,onSaveWorkspaceRootSettings:cs,onCheckForUpdates:cq,onControlGateway:co,onOpenSetupWizard:cn,onRunModelRefresh:cj,onRunModelSetDefault:cm,onOpenAddModels:cp,onOpenUpdateDialog:()=>{b8(),aI(!0)},onOpenResetDialog:a=>{cw(a)}})}),(0,D.jsxs)("div",{className:"relative z-20 min-h-screen pointer-events-none lg:h-screen",children:[(0,D.jsx)("div",{className:"pointer-events-none absolute left-1/2 top-4 z-30 -translate-x-1/2 lg:hidden",children:(0,D.jsx)(u6,{surfaceTheme:bB})}),(0,D.jsx)("div",{className:bc("pointer-events-auto absolute left-4 top-4 z-30",Z?"bottom-[calc(env(safe-area-inset-bottom)+124px)] w-[calc(100vw-112px)] max-w-[300px] lg:bottom-[244px] lg:top-6 lg:w-[394px] lg:max-w-none":"w-[78px] lg:bottom-[244px] lg:top-6"),children:(0,D.jsx)(sW,{snapshot:bP,activeWorkspaceId:n,requestedAgentAction:Q,connectionState:j,collapsed:!Z,modelManager:{runState:a9,statusMessage:be,resultMessage:bg,log:bi,manualCommand:bk,docsUrl:bm,discoveredModels:a7,systemReady:bT},onToggleCollapsed:()=>$(a=>!a),onSelectWorkspace:a=>{o(a),bQ(a)},onRefresh:k,onRunModelRefresh:cj,onRunModelDiscover:ck,onRunModelSetDefault:cm,onConnectModelProvider:cl,onOpenModelSetup:()=>cn(bT?"models":"system"),onOpenAddModels:cp,onEditWorkspace:b6})}),(0,D.jsx)("div",{className:bc("pointer-events-auto absolute right-4 top-4 z-30",_?"bottom-[calc(env(safe-area-inset-bottom)+124px)] w-[calc(100vw-112px)] max-w-[300px] lg:bottom-[244px] lg:top-6 lg:w-[394px] lg:max-w-none":"w-[78px] lg:bottom-[244px] lg:top-6"),children:(0,D.jsx)(r6,{snapshot:bP,selectedNodeId:p,lastMission:v,collapsed:!_,onToggleCollapsed:()=>aa(a=>!a),activeTab:t,onActiveTabChange:u,onAbortTask:a=>{u9(a)&&(T(a),V("idle"),X(null))}})}),(0,D.jsxs)("div",{className:"pointer-events-auto absolute bottom-[calc(env(safe-area-inset-bottom)+12px)] left-4 right-4 z-40 lg:bottom-6 lg:left-1/2 lg:right-auto lg:w-[min(800px,calc(100vw-320px))] lg:-translate-x-1/2",children:[(0,D.jsxs)("div",{className:"mx-auto mb-1 flex w-fit flex-col items-start gap-1",children:[b1>0?(0,D.jsxs)("div",{className:"inline-flex items-center gap-1.5 rounded-full border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] px-3 py-1 text-[8px] text-slate-200 shadow-[0_10px_24px_rgba(0,0,0,0.14)]",children:[(0,D.jsx)(L,{className:"h-3 w-3 text-slate-400"}),(0,D.jsxs)("span",{className:"leading-3 text-slate-300",children:[b1," hidden"]})]}):null,r?(0,D.jsxs)("button",{type:"button",onClick:b4,className:"inline-flex items-center gap-1.5 rounded-full border border-cyan-300/18 bg-[linear-gradient(180deg,rgba(16,25,38,0.98),rgba(8,12,20,0.96))] px-3 py-1 text-[8px] text-cyan-100 shadow-[0_10px_24px_rgba(0,0,0,0.14)] transition-colors hover:border-cyan-200/30 hover:bg-[linear-gradient(180deg,rgba(20,33,49,0.98),rgba(10,15,25,0.96))]","aria-label":"Reset focus and show the full workspace",title:"Reset Focus",children:[(0,D.jsx)(M,{className:"h-3 w-3 text-cyan-300"}),(0,D.jsx)("span",{className:"leading-3 text-cyan-50",children:"Reset Focus"})]}):null]}),(0,D.jsx)(rX,{snapshot:bP,activeWorkspaceId:n,selectedNodeId:p,composeIntent:B,onRefresh:k,onOpenWorkspaceCreate:()=>{b5("basic")},onMissionDispatchStart:a=>{var b,c;let d,e,f;Y.current.set(a.requestId,a.abortController);let g=(b=a,c=i,d=new Date(b.submittedAt).toISOString(),e=c.agents.find(a=>a.id===b.agentId),f={id:`optimistic:${b.requestId}:submitted`,kind:"user",timestamp:d,title:"Mission submitted",detail:vd(b.mission,220),agentId:b.agentId},{requestId:b.requestId,dispatchId:null,task:{id:`optimistic-task:${b.requestId}`,key:`optimistic:${b.requestId}`,title:vd(b.mission,86),mission:b.mission,subtitle:"Sending mission to AgentOS. Waiting for a dispatch id.",status:"queued",updatedAt:b.submittedAt,ageMs:0,workspaceId:b.workspaceId??void 0,primaryAgentId:b.agentId,primaryAgentName:e?.name??"OpenClaw",runtimeIds:[],agentIds:[b.agentId],sessionIds:[],runIds:[],runtimeCount:0,updateCount:0,liveRunCount:0,artifactCount:0,warningCount:0,metadata:{optimistic:!0,optimisticRequestId:b.requestId,bootstrapStage:"submitting",dispatchSubmittedAt:d,optimisticEvents:[f]}}});A(b=>[g,...b.filter(b=>b.requestId!==a.requestId)]),a.workspaceId&&o(a.workspaceId),bQ(g.task.id),aa(!0)},onMissionDispatchFailure:(a,b)=>{Y.current.delete(a),A(c=>c.map(c=>c.requestId===a?{...c,task:va(c.task,{status:"stalled",subtitle:b,bootstrapStage:"stalled",feedEvent:{id:`${c.task.id}:failed:${Date.now()}`,kind:"warning",timestamp:new Date().toISOString(),title:"Dispatch failed",detail:b,isError:!0}})}:c))},onMissionResponse:(a,b)=>{Y.current.delete(b.requestId),w(a),A(c=>c.map(c=>c.requestId===b.requestId?{...c,dispatchId:a.dispatchId??c.dispatchId,task:va(c.task,{dispatchId:a.dispatchId,status:"stalled"===a.status?"stalled":"cancelled"===a.status?"cancelled":"queued",subtitle:a.summary,bootstrapStage:"stalled"===a.status?"stalled":"cancelled"===a.status?"cancelled":"accepted",feedEvent:{id:`${c.task.id}:response:${Date.now()}`,kind:"stalled"===a.status||"cancelled"===a.status?"warning":"status",timestamp:new Date().toISOString(),title:"stalled"===a.status?"Dispatch blocked":"cancelled"===a.status?"Dispatch cancelled":"Mission accepted",detail:a.summary||"Mission accepted and queued for OpenClaw execution.",isError:"stalled"===a.status||"cancelled"===a.status}})}:c)),a.dispatchId&&y(a.dispatchId)}})]}),b0||bt||br?(0,D.jsx)(sB,{snapshot:i,surfaceTheme:bB,stage:a3,systemActionLabel:b$.label,systemActionDescription:b$.description,systemPhase:aT,modelPhase:bb,systemRun:{runState:aR,statusMessage:aV,resultMessage:aX,log:aZ,manualCommand:a_,docsUrl:a1},modelRun:{runState:a9,statusMessage:be,resultMessage:bg,log:bi,manualCommand:bk,docsUrl:bm},selectedModelId:a5,discoveredModels:a7,onSelectedModelIdChange:a6,onRunSystemSetup:cg,onRunModelAutoSetup:ci,onRunModelDiscover:ck,onRunModelRefresh:cj,onRunModelSetDefault:cm,onContinueToModels:()=>a4("models"),onBackToSystem:()=>a4("system"),onDismiss:()=>{bs(!1),bu(!1),bU||bp(!0)},canDismiss:!bt&&"running"!==aR&&"running"!==a9}):null,(0,D.jsx)(u$,{open:bD,onOpenChange:b7,initialMode:bF,workspaceEditId:bH,surfaceTheme:bB,snapshot:i,onRefresh:k,onWorkspaceCreated:a=>{bO(a),o(a),bQ(a)},onWorkspaceUpdated:a=>{bO(a),o(a),bQ(a)}},bH?`workspace-edit:${bH}`:"workspace-create"),(0,D.jsx)(ee,{open:bJ,onOpenChange:bK,snapshot:i,initialProvider:bL,onSnapshotChange:m}),(0,D.jsx)(sP,{open:null!==af,target:af,surfaceTheme:bB,previewState:ah,preview:aj,previewError:al,runState:an,statusMessage:ap,resultMessage:ar,backgroundLogPath:at,log:av,confirmText:ax,onConfirmTextChange:ay,onRefreshPreview:()=>{af&&cv(af)},onExecute:()=>{cx()},onOpenChange:a=>{a||"running"!==an&&(ag(null),cu())}}),(0,D.jsx)(dx,{open:null!==S,onOpenChange:a=>{"running"!==U&&(a||(T(null),V("idle"),X(null)))},children:(0,D.jsxs)(d_,{className:bc("max-w-[480px] gap-5 p-5 sm:p-6","light"===bB?"border-[#d7c5b7] bg-[rgba(252,247,241,0.98)] text-[#4a382c] shadow-[0_30px_80px_rgba(161,125,101,0.2)]":"border-white/10 bg-slate-950/94 text-slate-100"),children:[(0,D.jsxs)(d0,{children:[(0,D.jsx)(d2,{className:"light"===bB?"text-[#3f2f24]":"text-white",children:"Abort task?"}),(0,D.jsx)(d3,{className:"light"===bB?"text-[#7e6555]":"text-slate-400",children:"This stops the current OpenClaw dispatch for the selected task. It does not delete captured evidence or files."})]}),S?(0,D.jsxs)("div",{className:bc("rounded-[20px] border px-4 py-4","light"===bB?"border-[#e3d4c8] bg-[#fffaf6] text-[#4f3d31]":"border-rose-400/20 bg-rose-400/10 text-rose-50"),children:[(0,D.jsx)("p",{className:"text-[10px] uppercase tracking-[0.24em] text-slate-500",children:"Selected task"}),(0,D.jsx)("p",{className:"mt-2 font-display text-[1.02rem] leading-6 text-inherit",children:S.title}),(0,D.jsx)("p",{className:bc("mt-1 text-sm leading-6","light"===bB?"text-[#8b7262]":"text-rose-100/80"),children:S.subtitle}),W?(0,D.jsx)("p",{className:"mt-3 rounded-[16px] border border-rose-400/20 bg-rose-400/10 px-3 py-2 text-sm text-rose-50",children:W}):null]}):null,(0,D.jsxs)(d1,{children:[(0,D.jsx)(bq,{type:"button",variant:"secondary",disabled:"running"===U,className:"light"===bB?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",onClick:()=>{"running"!==U&&(T(null),V("idle"),X(null))},children:"Cancel"}),(0,D.jsx)(bq,{type:"button",variant:"destructive",disabled:!S||"running"===U,onClick:()=>{cd()},children:"running"===U?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(N,{className:"mr-2 h-4 w-4 animate-spin"}),"Aborting..."]}):"Abort task"})]})]})}),(0,D.jsxs)("div",{className:bc("pointer-events-auto absolute bottom-3 right-4 z-30 text-[11px] tracking-[0.04em] lg:bottom-4 lg:right-6","light"===bB?"text-[#8f7664]":"text-slate-500"),children:["Built on"," ",(0,D.jsx)("a",{href:"https://openclaw.ai/",target:"_blank",rel:"noreferrer",className:bc("transition-colors","light"===bB?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"OpenClaw"})," ","by"," ",(0,D.jsx)("a",{href:"https://sapienx.app/",target:"_blank",rel:"noreferrer",className:bc("transition-colors","light"===bB?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"SapienX"})]}),(0,D.jsx)(dx,{open:aH,onOpenChange:a=>{"running"!==aJ&&(aI(a),a||b8())},children:(0,D.jsxs)(d_,{className:bc("max-w-[468px] gap-5 p-5 sm:p-6","light"===bB?"border-[#d7c5b7] bg-[rgba(252,247,241,0.98)] text-[#4a382c] shadow-[0_30px_80px_rgba(161,125,101,0.2)]":"border-white/10 bg-slate-950/94 text-slate-100"),children:[(0,D.jsxs)(d0,{children:[(0,D.jsx)(d2,{className:"light"===bB?"text-[#3f2f24]":"text-white",children:bY}),(0,D.jsx)(d3,{className:"light"===bB?"text-[#7e6555]":"text-slate-400",children:bZ})]}),bX?(0,D.jsxs)("div",{className:bc("space-y-4","light"===bB?"text-[#4f3d31]":"text-slate-200"),children:[(0,D.jsxs)("div",{className:bc("rounded-[24px] border px-4 py-5",(e=aJ,f=bB,"success"===e?"light"===f?"border-emerald-300 bg-emerald-50/80 text-emerald-950":"border-emerald-300/25 bg-emerald-300/10 text-emerald-50":"light"===f?"border-rose-300 bg-rose-50/90 text-rose-950":"border-rose-300/25 bg-rose-300/10 text-rose-50")),children:[(0,D.jsxs)("div",{className:"flex items-start gap-3",children:[(0,D.jsx)("div",{className:bc("flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl border",(g=aJ,h=bB,"success"===g?"light"===h?"border-emerald-300 bg-white/80 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===h?"border-rose-300 bg-white/80 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200")),children:"success"===aJ?(0,D.jsx)(O,{className:"h-5 w-5"}):(0,D.jsx)(P,{className:"h-5 w-5"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("p",{className:"font-display text-[1.05rem] leading-6",children:"success"===aJ?"OpenClaw is up to date":"Update needs attention"}),(0,D.jsx)("p",{className:"mt-1 text-sm leading-6",children:aN||("success"===aJ?"The update finished successfully.":"The update did not finish cleanly.")})]})]}),(0,D.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[(0,D.jsxs)("div",{className:bc("rounded-[18px] border px-3 py-3","light"===bB?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,D.jsx)("p",{className:"light"===bB?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Installed version"}),(0,D.jsxs)("p",{className:"mt-2 font-display text-lg text-inherit",children:["v",i.diagnostics.version||i.diagnostics.latestVersion||"unknown"]})]}),(0,D.jsxs)("div",{className:bc("rounded-[18px] border px-3 py-3","light"===bB?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,D.jsx)("p",{className:"light"===bB?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Install mode"}),(0,D.jsx)("p",{className:"mt-2 text-sm font-medium text-inherit",children:bV||"unknown"})]})]})]}),(0,D.jsxs)("div",{className:bc("rounded-[20px] border","light"===bB?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:bc("flex items-center justify-between border-b px-4 py-3","light"===bB?"border-[#eadccf]":"border-white/8"),children:[(0,D.jsx)("p",{className:bc("text-[10px] uppercase tracking-[0.24em]","light"===bB?"text-[#9a7f6c]":"text-slate-500"),children:"Update log"}),(0,D.jsx)("span",{className:"light"===bB?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:"success"===aJ?"Completed":"Failed"})]}),(0,D.jsx)("pre",{className:bc("max-h-[180px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===bB?"text-[#4f3d31]":"text-slate-200"),children:aP||"No command output was captured."})]})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{className:bc("grid gap-3 sm:grid-cols-2","light"===bB?"text-[#4f3d31]":"text-slate-200"),children:[(0,D.jsxs)("div",{className:bc("rounded-[20px] border px-4 py-4","light"===bB?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsx)("p",{className:bc("text-[10px] uppercase tracking-[0.24em]","light"===bB?"text-[#9a7f6c]":"text-slate-500"),children:"Version target"}),(0,D.jsxs)("p",{className:"mt-2 font-display text-[1.1rem] leading-6 text-inherit",children:["v",i.diagnostics.latestVersion||i.diagnostics.version||"unknown"]}),(0,D.jsxs)("p",{className:"light"===bB?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:["Current: v",i.diagnostics.version||"unknown"]})]}),(0,D.jsxs)("div",{className:bc("rounded-[20px] border px-4 py-4","light"===bB?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsx)("p",{className:bc("text-[10px] uppercase tracking-[0.24em]","light"===bB?"text-[#9a7f6c]":"text-slate-500"),children:"Install mode"}),(0,D.jsx)("p",{className:"mt-2 text-sm font-medium leading-6 text-inherit",children:bV||"unknown"}),(0,D.jsx)("p",{className:"light"===bB?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:qZ(i.diagnostics.updateRoot||"")||"Install root unavailable"})]})]}),(0,D.jsx)("div",{className:bc("rounded-[20px] border px-4 py-3 text-sm",bS>0?"light"===bB?"border-rose-300/80 bg-rose-50 text-rose-800":"border-rose-300/25 bg-rose-300/10 text-rose-100":"light"===bB?"border-[#e3d4c8] bg-[#fffaf6] text-[#745e4f]":"border-white/8 bg-white/[0.03] text-slate-300"),children:bS>0?`${bS} running or queued runtime${1===bS?"":"s"} may be interrupted during the update.`:"No running runtimes are currently tracked, so the update risk is lower."}),bW?(0,D.jsxs)("div",{className:bc("rounded-[20px] border","light"===bB?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:bc("flex items-center gap-3 border-b px-4 py-3","light"===bB?"border-[#eadccf]":"border-white/8"),children:[(0,D.jsx)("div",{className:bc("flex h-9 w-9 items-center justify-center rounded-2xl border","light"===bB?"border-[#dcc6b6] bg-[#f4e8dd] text-[#7b6453]":"border-white/10 bg-white/[0.05] text-slate-200"),children:(0,D.jsx)(N,{className:"h-4 w-4 animate-spin"})}),(0,D.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,D.jsx)("p",{className:"light"===bB?"text-sm font-medium text-[#4a382c]":"text-sm font-medium text-white",children:"Update in progress"}),(0,D.jsx)("p",{className:"light"===bB?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:aL||"Streaming OpenClaw output..."})]})]}),(0,D.jsx)("pre",{className:bc("max-h-[180px] min-h-[120px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===bB?"text-[#4f3d31]":"text-slate-200"),children:aP||"Waiting for command output..."})]}):null]}),(0,D.jsxs)(d1,{children:[(0,D.jsx)(bq,{type:"button",variant:"secondary",onClick:()=>{aI(!1),b8()},disabled:bW,className:"light"===bB?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:bX?"Done":"Cancel"}),bX?null:(0,D.jsx)(bq,{type:"button",onClick:cf,disabled:bW,className:bc(i.diagnostics.updateAvailable?"bg-amber-400 text-slate-950 shadow-lg shadow-amber-400/20 hover:bg-amber-300":"","light"!==bB||i.diagnostics.updateAvailable?"":"bg-[#c8946f] text-white shadow-[0_12px_28px_rgba(200,148,111,0.24)] hover:bg-[#b88461]"),children:bW?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(N,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating..."]}):"Update now"})]})]})})]})]})}function u6({surfaceTheme:a}){return(0,D.jsxs)("div",{className:bc("flex h-11 items-center gap-3 rounded-full border px-4 shadow-[0_18px_50px_rgba(0,0,0,0.24)] backdrop-blur-xl","light"===a?"border-[#d9c9bc]/90 bg-[#f8f5f0]/86 shadow-[0_18px_42px_rgba(161,125,101,0.14)]":"border-cyan-300/10 bg-slate-950/45"),children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)("span",{className:bc("inline-flex h-7 w-7 items-center justify-center overflow-hidden rounded-[8px] border","light"===a?"border-[#d1bcad] bg-[#f5ece4]":"border-white/[0.08] bg-white/[0.03]"),children:(0,D.jsx)("video",{"aria-hidden":"true",autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"auto",className:"h-full w-full scale-[1.15] object-cover",children:(0,D.jsx)("source",{src:"/assets/logo.webm",type:"video/webm"})})}),(0,D.jsx)("p",{className:bc("text-[10px] tracking-[0.18em]","light"===a?"text-[#8a7261]":"text-slate-500"),children:"AgentOS"})]}),(0,D.jsx)("span",{"aria-hidden":"true",className:bc("h-4 w-px","light"===a?"bg-[#cdb7a8]/80":"bg-white/[0.08]")}),(0,D.jsx)("h2",{className:bc("font-display text-[0.88rem]","light"===a?"text-[#816958]/80":"text-slate-400/75"),children:"Mission Control"})]})}function u7({snapshot:a,surfaceTheme:b,settingsRef:c,isSettingsOpen:d,gatewayDraft:e,workspaceRootDraft:f,isSavingGateway:g,isSavingWorkspaceRoot:h,isCheckingForUpdates:i,selectedModelId:j,modelOnboardingRunState:k,gatewayControlAction:l,lastCheckedAt:m,onToggleTheme:n,onToggleSettings:o,onGatewayDraftChange:p,onWorkspaceRootDraftChange:q,onSelectedModelIdChange:r,onSaveGatewaySettings:s,onSaveWorkspaceRootSettings:t,onCheckForUpdates:u,onControlGateway:v,onOpenSetupWizard:w,onRunModelRefresh:x,onRunModelSetDefault:y,onOpenAddModels:z,onOpenUpdateDialog:A,onOpenResetDialog:B}){let C=sA(a),E=null!==l,F="running"===k,G=vg(b,"secondary"),H=vg(b,"primary"),I=vg(b,"warning"),J=vg(b,"warningSolid"),K=bc("inline-flex h-8 w-8 items-center justify-center rounded-full border transition-[background-color,border-color,color,transform] duration-150 active:scale-[0.96]","light"===b?"border-[#d0bcae] bg-[#efe5dc] text-[#7f6554] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#e7d9ce] hover:border-[#c8b09f] hover:text-[#5f4a3d] active:bg-[#ddcdbf]":"border-white/12 bg-white/[0.08] text-slate-200 hover:bg-white/[0.12] hover:border-white/16 hover:text-slate-100 active:bg-white/[0.16]"),L=bc("relative inline-flex h-7 w-14 items-center rounded-full border transition-[background-color,border-color,transform] duration-150 active:scale-[0.98]","light"===b?"border-[#d0bcae] bg-[#eaded3] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#e3d5c8] hover:border-[#c8b09f] active:bg-[#d9c8ba]":"border-white/12 bg-white/[0.08] hover:bg-white/[0.12] hover:border-white/16 active:bg-white/[0.16]"),O=bc("absolute left-1 inline-flex h-5 w-5 items-center justify-center rounded-full shadow-[0_4px_12px_rgba(0,0,0,0.18)] transition-[transform,background-color,color] duration-150","light"===b?"translate-x-7 bg-[#c8946f] text-white":"translate-x-0 bg-cyan-300 text-slate-950");return(0,D.jsxs)("div",{className:"flex w-full items-center justify-between px-0 pt-6",children:[(0,D.jsx)(u6,{surfaceTheme:b}),(0,D.jsxs)("div",{ref:c,className:"pointer-events-auto relative",children:[(0,D.jsxs)("div",{className:bc("flex h-11 items-center gap-3 rounded-full border px-4 shadow-[0_18px_50px_rgba(0,0,0,0.24)] backdrop-blur-xl","light"===b?"border-[#d9c9bc]/90 bg-[#f8f5f0]/86 shadow-[0_18px_42px_rgba(161,125,101,0.14)]":"border-cyan-300/10 bg-slate-950/45"),children:[(0,D.jsxs)("div",{className:"flex items-baseline gap-[3px]",children:[(0,D.jsx)("span",{className:bc("text-[10px] uppercase tracking-[0.3em]","light"===b?"text-[#8a7261]":"text-slate-500"),children:"OPENCLAW"}),(0,D.jsxs)("span",{className:bc("font-mono text-[8px] tracking-[0.04em]","light"===b?"text-[#6f5a4b]/85":"text-slate-300/80"),children:["v",a.diagnostics.version||"unknown"]})]}),(0,D.jsxs)("span",{className:bc("inline-flex items-center gap-2 rounded-full border px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.22em]",function(a,b){switch(a){case"healthy":return"light"===b?"border-emerald-300/80 bg-emerald-50 text-emerald-700":"border-emerald-400/25 bg-emerald-400/10 text-emerald-200";case"degraded":return"light"===b?"border-amber-300/90 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200";default:return"light"===b?"border-rose-300/80 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200"}}(a.diagnostics.health,b)),children:[(0,D.jsx)("span",{"aria-hidden":"true",className:bc("h-2 w-2 rounded-full shadow-[0_0_12px_currentColor]",function(a){switch(a){case"healthy":return"bg-emerald-400";case"degraded":return"bg-amber-300";default:return"bg-rose-300"}}(a.diagnostics.health))}),function(a){switch(a){case"healthy":return"Online";case"degraded":return"Degraded";default:return"Offline"}}(a.diagnostics.health)]}),(0,D.jsx)("button",{type:"button",role:"switch","aria-label":"light"===b?"Switch to dark theme":"Switch to light theme","aria-checked":"light"===b,onClick:n,className:L,children:(0,D.jsx)("span",{className:O,children:"light"===b?(0,D.jsx)(Q,{className:"h-3 w-3"}):(0,D.jsx)(R,{className:"h-3 w-3"})})}),(0,D.jsx)("button",{type:"button","aria-label":"Open settings","aria-expanded":d,"aria-haspopup":"menu",onClick:o,className:K,children:(0,D.jsx)(S,{className:"h-3.5 w-3.5"})})]}),d?(0,D.jsxs)("div",{role:"menu","aria-label":"OpenClaw settings",className:bc("absolute right-0 top-[calc(100%+12px)] z-[70] max-h-[min(82vh,calc(100svh-96px))] w-[300px] overflow-y-auto overscroll-contain rounded-[20px] border p-3 shadow-[0_22px_64px_rgba(0,0,0,0.24)] backdrop-blur-2xl","light"===b?"border-[#dbc9bc]/90 bg-[rgba(252,247,241,0.95)] text-[#4a382c] shadow-[0_24px_60px_rgba(161,125,101,0.18)]":"border-cyan-300/12 bg-[rgba(10,16,28,0.9)] text-slate-100"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bc("text-[8px] uppercase tracking-[0.24em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Settings"}),(0,D.jsx)("h3",{className:bc("mt-0.5 font-display text-[14px]","light"===b?"text-[#3f2f24]":"text-white"),children:"OpenClaw surface"})]}),(0,D.jsx)("span",{className:bc("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===b?"border-[#d6c0b0] bg-[#f3e7dc] text-[#8a7261]":"border-white/10 bg-white/[0.06] text-slate-400"),children:a.mode})]}),a.diagnostics.updateAvailable&&a.diagnostics.latestVersion?(0,D.jsxs)("div",{className:bc("mt-2.5 rounded-[18px] border px-3 py-3","light"===b?"border-amber-300/90 bg-[linear-gradient(135deg,rgba(255,247,237,0.98),rgba(252,231,214,0.94))] shadow-[0_16px_36px_rgba(194,120,55,0.16)]":"border-amber-300/30 bg-[linear-gradient(135deg,rgba(71,35,8,0.62),rgba(33,20,8,0.82))] shadow-[0_18px_42px_rgba(245,158,11,0.14)]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-2.5",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bc("text-[8px] uppercase tracking-[0.18em]","light"===b?"text-amber-800/70":"text-amber-200/80"),children:"Update available"}),(0,D.jsxs)("div",{className:"mt-1.5 flex items-baseline gap-1.5",children:[(0,D.jsxs)("p",{className:bc("font-display text-[0.98rem]","light"===b?"text-amber-950":"text-amber-50"),children:["v",a.diagnostics.latestVersion]}),(0,D.jsxs)("p",{className:bc("text-[9px]","light"===b?"text-amber-900/70":"text-amber-100/70"),children:["from v",a.diagnostics.version||"unknown"]})]})]}),(0,D.jsx)(T,{className:bc("mt-0.5 h-4 w-4","light"===b?"text-amber-700":"text-amber-300")})]}),(0,D.jsx)("p",{className:bc("mt-1.5 text-[10px] leading-[1.05rem]","light"===b?"text-amber-950/80":"text-amber-50/85"),children:"A newer OpenClaw release was detected. You can update directly from Mission Control."}),(0,D.jsx)("button",{type:"button",onClick:A,className:bc("mt-2.5 inline-flex items-center justify-center py-1",J),children:"Update now"})]}):null,(0,D.jsxs)("div",{className:bc("mt-2.5 rounded-[16px] border px-2.5 py-2","light"===b?"border-[#e6d7cb] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsx)("p",{className:bc("text-[8px] uppercase tracking-[0.18em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"OpenClaw version"}),(0,D.jsxs)("div",{className:"mt-1.5 flex items-center justify-between gap-2",children:[(0,D.jsx)("p",{className:bc("font-display text-[0.88rem]","light"===b?"text-[#3f2f24]":"text-white"),children:a.diagnostics.version||"Unavailable"}),a.diagnostics.updateChannel?(0,D.jsx)("span",{className:bc("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===b?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-cyan-400/14 bg-cyan-400/8 text-cyan-100"),children:a.diagnostics.updateChannel}):null]}),(0,D.jsx)("p",{className:bc("mt-1.5 text-[10px] leading-[1.05rem]","light"===b?"text-[#816958]":"text-slate-400"),children:a.diagnostics.updateInfo?.trim()||"No additional update message was returned in the latest OpenClaw status snapshot."}),(0,D.jsxs)("div",{className:"mt-3",children:[(0,D.jsx)(bq,{type:"button",size:"sm",variant:"secondary",onClick:()=>{u()},disabled:i,className:bc("w-full disabled:cursor-wait",a.diagnostics.updateAvailable?I:G),children:i?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(N,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Checking..."]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(M,{className:"mr-1.5 h-3.5 w-3.5"}),"Check for updates"]})}),m?(0,D.jsxs)("p",{className:bc("mt-2 text-center text-[9px]","light"===b?"text-[#8f7664]":"text-slate-500"),children:["Last checked at"," ",new Date(m).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]}):null]})]}),(0,D.jsxs)("div",{className:bc("mt-2 rounded-[16px] border px-2.5 py-2.5","light"===b?"border-[#e6d7cb] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bc("text-[8px] uppercase tracking-[0.18em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Setup center"}),(0,D.jsx)("p",{className:bc("mt-1 text-[10px] leading-[1.05rem]","light"===b?"text-[#816958]":"text-slate-400"),children:"Reopen the wizard, control the gateway, and manage the minimum model setup from one place."})]}),(0,D.jsx)("span",{className:bc("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]",C?"light"===b?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===b?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:C?"Ready":"Needs attention"})]}),(0,D.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,D.jsx)(bq,{type:"button",size:"sm",variant:"secondary",onClick:()=>w(a.diagnostics.rpcOk?"models":"system"),className:G,children:"Open wizard"}),(0,D.jsx)(bq,{type:"button",size:"sm",variant:"secondary",disabled:F,onClick:()=>{x()},className:G,children:"Refresh setup"})]}),(0,D.jsxs)("div",{className:bc("mt-3 rounded-[14px] border px-2.5 py-2.5","light"===b?"border-[#eadcd0] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bc("text-[11px]","light"===b?"text-[#9a7f6c]":"text-slate-400"),children:"Gateway control"}),(0,D.jsx)("p",{className:bc("mt-0.5 text-[10px] leading-[1.05rem]","light"===b?"text-[#816958]":"text-slate-500"),children:a.diagnostics.rpcOk?"Live RPC connection is online.":a.diagnostics.loaded?"Service is loaded but Mission Control cannot verify RPC yet.":"Service is not loaded on this machine yet."})]}),(0,D.jsx)("span",{className:bc("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]",a.diagnostics.rpcOk?"light"===b?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===b?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:a.diagnostics.rpcOk?"Online":a.diagnostics.loaded?"Service only":"Offline"})]}),(0,D.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,D.jsx)(bq,{type:"button",size:"sm",variant:"secondary",disabled:E||a.diagnostics.rpcOk,onClick:()=>{v("start")},className:G,children:"start"===l?"Starting...":"Start"}),(0,D.jsx)(bq,{type:"button",size:"sm",variant:"secondary",disabled:E||!a.diagnostics.loaded,onClick:()=>{v("restart")},className:G,children:"restart"===l?"Restarting...":"Restart"}),(0,D.jsx)(bq,{type:"button",size:"sm",variant:"secondary",disabled:E||!a.diagnostics.loaded,onClick:()=>{v("stop")},className:G,children:"stop"===l?"Stopping...":"Stop"})]})]}),(0,D.jsxs)("div",{className:bc("mt-2 rounded-[14px] border px-2.5 py-2.5","light"===b?"border-[#eadcd0] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bc("text-[11px]","light"===b?"text-[#9a7f6c]":"text-slate-400"),children:"Model setup"}),(0,D.jsxs)("p",{className:bc("mt-0.5 text-[10px] leading-[1.05rem]","light"===b?"text-[#816958]":"text-slate-500"),children:["Default model: ",a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||"Not set"]})]}),(0,D.jsxs)("span",{className:bc("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]",a.diagnostics.modelReadiness.ready?"light"===b?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===b?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:[a.diagnostics.modelReadiness.availableModelCount,"/",a.diagnostics.modelReadiness.totalModelCount]})]}),(0,D.jsxs)("select",{value:j,onChange:a=>r(a.target.value),disabled:F,className:bc("mt-2.5 h-9 w-full rounded-[14px] border px-2.5 text-[11px]","light"===b?"border-[#d9c9bc] bg-[#fffdfb] text-[#4f3d31]":"border-white/10 bg-white/[0.04] text-slate-100"),children:[(0,D.jsx)("option",{value:"",children:"Auto choose"}),a.models.filter(a=>!1!==a.available&&!a.missing).map(a=>(0,D.jsxs)("option",{value:a.id,children:[a.name," \xb7 ",a.provider]},a.id))]}),(0,D.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,D.jsx)(bq,{type:"button",size:"sm",variant:"secondary",disabled:F,onClick:()=>{y()},className:G,children:F?"Working...":"Use selected"}),(0,D.jsx)(bq,{type:"button",size:"sm",variant:"secondary",disabled:F,onClick:()=>{z()},className:G,children:"Add models"})]})]})]}),(0,D.jsxs)("div",{className:bc("mt-2 rounded-[16px] border px-2.5 py-2.5","light"===b?"border-[#e6d7cb] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)(rK,{htmlFor:"workspace-root",className:bc("text-[11px]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Workspace root"}),(0,D.jsx)("p",{className:bc("mt-0.5 text-[10px] leading-[1.05rem]","light"===b?"text-[#816958]":"text-slate-400"),children:"Default parent path for newly created workspaces. Existing workspaces stay at their current paths."})]}),(0,D.jsx)("span",{className:bc("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===b?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-white/10 bg-white/[0.05] text-slate-300"),children:"New only"})]}),(0,D.jsx)(br,{id:"workspace-root",value:f,onChange:a=>q(a.target.value),placeholder:"~/Documents/Shared/projects",disabled:h,style:"light"===b?{colorScheme:"light"}:void 0,className:bc("mt-2.5 h-9 rounded-[14px] px-2.5 text-[11px]","light"===b?"border-[#d9c9bc] bg-[#fffdfb] text-[#4f3d31] caret-[#7c5a46] placeholder:text-[#b29b8b] shadow-[inset_0_0_0_1000px_#fffdfb] [-webkit-text-fill-color:#4f3d31] focus-visible:ring-[#c8946f]/45":"border-white/10 bg-white/[0.04] text-slate-100 placeholder:text-slate-500")}),(0,D.jsxs)("p",{className:bc("mt-1.5 break-all font-mono text-[9px] leading-[1rem]","light"===b?"text-[#6f5a4b]":"text-slate-300"),children:["Configured root: ",a.diagnostics.configuredWorkspaceRoot?qZ(a.diagnostics.configuredWorkspaceRoot):"default"]}),(0,D.jsxs)("p",{className:bc("mt-1 break-all font-mono text-[9px] leading-[1rem]","light"===b?"text-[#6f5a4b]":"text-slate-300"),children:["Effective root: ",qZ(a.diagnostics.workspaceRoot)]}),(0,D.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,D.jsx)(bq,{type:"button",size:"sm",variant:"secondary",disabled:h,onClick:()=>{t(null)},className:G,children:"Use default"}),(0,D.jsx)(bq,{type:"button",size:"sm",disabled:h,onClick:()=>{t(f)},className:H,children:h?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(N,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):"Save root"})]})]}),(0,D.jsxs)("div",{className:bc("mt-2 rounded-[16px] border px-2.5 py-2.5","light"===b?"border-[#e6d7cb] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)(rK,{htmlFor:"gateway-url",className:bc("text-[11px]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"OpenClaw gateway"}),(0,D.jsx)("p",{className:bc("mt-0.5 text-[10px] leading-[1.05rem]","light"===b?"text-[#816958]":"text-slate-400"),children:"Enter a `ws://` or `wss://` endpoint. Leave it empty to use the local default gateway."})]}),(0,D.jsx)("span",{className:bc("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===b?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-white/10 bg-white/[0.05] text-slate-300"),children:a.diagnostics.bindMode||"default"})]}),(0,D.jsx)(br,{id:"gateway-url",value:e,onChange:a=>p(a.target.value),placeholder:"ws://127.0.0.1:18789",disabled:g,style:"light"===b?{colorScheme:"light"}:void 0,className:bc("mt-2.5 h-9 rounded-[14px] px-2.5 text-[11px]","light"===b?"border-[#d9c9bc] bg-[#fffdfb] text-[#4f3d31] caret-[#7c5a46] placeholder:text-[#b29b8b] shadow-[inset_0_0_0_1000px_#fffdfb] [-webkit-text-fill-color:#4f3d31] focus-visible:ring-[#c8946f]/45":"border-white/10 bg-white/[0.04] text-slate-100 placeholder:text-slate-500")}),(0,D.jsxs)("p",{className:bc("mt-1.5 break-all font-mono text-[9px] leading-[1rem]","light"===b?"text-[#6f5a4b]":"text-slate-300"),children:["Configured endpoint: ",a.diagnostics.configuredGatewayUrl||"local default"]}),(0,D.jsxs)("p",{className:bc("mt-1 break-all font-mono text-[9px] leading-[1rem]","light"===b?"text-[#6f5a4b]":"text-slate-300"),children:["Effective endpoint: ",a.diagnostics.gatewayUrl]}),(0,D.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,D.jsx)(bq,{type:"button",size:"sm",variant:"secondary",disabled:g,onClick:()=>{s(null)},className:G,children:"Use local"}),(0,D.jsx)(bq,{type:"button",size:"sm",disabled:g,onClick:()=>{s(e)},className:H,children:g?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(N,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):"Save gateway"})]})]}),(0,D.jsxs)("div",{className:bc("mt-2 rounded-[16px] border px-2.5 py-2.5","light"===b?"border-rose-200 bg-[linear-gradient(135deg,rgba(255,245,245,0.96),rgba(255,236,236,0.92))]":"border-rose-400/18 bg-[linear-gradient(135deg,rgba(62,16,24,0.46),rgba(24,10,15,0.82))]"),children:[(0,D.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("p",{className:bc("text-[8px] uppercase tracking-[0.18em]","light"===b?"text-rose-700/80":"text-rose-200/75"),children:"Danger zone"}),(0,D.jsx)("p",{className:bc("mt-1 text-[10px] leading-[1.05rem]","light"===b?"text-rose-900/80":"text-rose-100/80"),children:"Review exactly which workspaces, agents, integration files, and packages would be removed before taking irreversible actions."})]}),(0,D.jsx)(P,{className:bc("mt-0.5 h-4 w-4","light"===b?"text-rose-700":"text-rose-200")})]}),(0,D.jsxs)("div",{className:"mt-3 grid gap-2",children:[(0,D.jsx)(bq,{type:"button",size:"sm",variant:"secondary",onClick:()=>B("mission-control"),className:bc("justify-start","light"===b?"border-rose-200 bg-white text-rose-900 hover:bg-rose-50 hover:text-rose-900":"border-rose-400/20 bg-white/[0.04] text-rose-100 hover:bg-rose-500/10"),children:"Reset Mission Control"}),(0,D.jsx)(bq,{type:"button",size:"sm",variant:"secondary",onClick:()=>B("full-uninstall"),className:bc("justify-start","light"===b?"border-rose-300 bg-rose-600 text-white hover:bg-rose-700":"border-rose-400/24 bg-rose-500/90 text-white hover:bg-rose-500"),children:"Full Uninstall"})]})]})]}):null]})]})}function u8(a){return a.mission?.trim()?a.mission.trim():a.title.trim()?a.title.trim():a.subtitle.trim()||"Continue this task."}function u9(a){let b,c;if(b="string"==typeof a.metadata.dispatchStatus?a.metadata.dispatchStatus:null,c=a.status,"cancelled"===b||"aborted"===b||"cancelled"===c||"aborted"===c)return!1;let d=a.status;return"running"===d||"queued"===d}function va(a,b){let c,d=(Array.isArray(c=a.metadata.optimisticEvents)?c.filter(vc):[]).concat(b.feedEvent);return{...a,dispatchId:b.dispatchId??a.dispatchId,status:b.status,subtitle:b.subtitle,updatedAt:Date.now(),liveRunCount:+("stalled"!==b.status&&"cancelled"!==b.status),warningCount:"stalled"===b.status||"cancelled"===b.status?1:a.warningCount,metadata:{...a.metadata,bootstrapStage:b.bootstrapStage,optimisticEvents:function(a){let b=new Map;for(let c of a)b.set(c.id,c);return[...b.values()].sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp))}(d)}}}function vb(a,b,c,d){return!d.includes(a.key)&&(!!c.includes(a.key)||0!==a.runtimeIds.length&&a.runtimeIds.every(a=>b.includes(a)))}function vc(a){return"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.kind&&"string"==typeof a.timestamp&&"string"==typeof a.title&&"string"==typeof a.detail}function vd(a,b){let c=a.replace(/\s+/g," ").trim();return c.length<=b?c:`${c.slice(0,Math.max(b-1,1)).trimEnd()}…`}function ve(a){return(a.diagnostics.configuredGatewayUrl||a.diagnostics.gatewayUrl).replace(/\/$/,"")}function vf(a){return qZ(a.diagnostics.configuredWorkspaceRoot||a.diagnostics.workspaceRoot)}function vg(a,b){let c="h-8 rounded-[12px] border px-2.5 text-[9px] uppercase tracking-[0.18em] transition-[background-color,border-color,color,box-shadow,transform] duration-150 active:scale-[0.985]";return"primary"===b?bc(c,"light"===a?"border-[#c8946f] bg-[#c8946f] text-white shadow-[0_12px_28px_rgba(200,148,111,0.24)] hover:bg-[#b88461] hover:border-[#b88461] hover:text-white active:bg-[#a97553] active:border-[#a97553]":"border-cyan-300/30 bg-cyan-300 text-slate-950 shadow-[0_12px_28px_rgba(34,211,238,0.2)] hover:bg-cyan-200 hover:border-cyan-200 hover:text-slate-950 active:bg-cyan-100 active:border-cyan-100"):"warning"===b?bc(c,"light"===a?"border-amber-400/90 bg-amber-100 text-amber-900 shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-amber-200 hover:border-amber-400 hover:text-amber-900 active:bg-amber-300":"border-amber-300/35 bg-amber-300/16 text-amber-100 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)] hover:bg-amber-300/24 hover:border-amber-300/45 hover:text-amber-50 active:bg-amber-300/30"):"warningSolid"===b?bc(c,"light"===a?"border-amber-900 bg-amber-900 text-amber-50 shadow-[0_12px_28px_rgba(146,64,14,0.18)] hover:bg-amber-800 hover:border-amber-800 hover:text-amber-50 active:bg-amber-700 active:border-amber-700":"border-amber-300 bg-amber-300 text-slate-950 shadow-[0_12px_28px_rgba(245,158,11,0.18)] hover:bg-amber-200 hover:border-amber-200 hover:text-slate-950 active:bg-amber-100 active:border-amber-100"):bc(c,"light"===a?"border-[#d3bba9] bg-[#f1e3d7] text-[#6f5949] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#ead8ca] hover:border-[#caa98f] hover:text-[#5f4a3d] active:bg-[#dfc9b7] active:border-[#bf9c82]":"border-white/12 bg-white/[0.05] text-slate-200 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)] hover:bg-white/[0.1] hover:border-white/16 hover:text-slate-100 active:bg-white/[0.14] active:border-white/20")}},146:(a,b,c)=>{"use strict";var d=c(6247),e=c(197),f="function"==typeof Object.is?Object.is:function(a,b){return a===b&&(0!==a||1/a==1/b)||a!=a&&b!=b},g=e.useSyncExternalStore,h=d.useRef,i=d.useEffect,j=d.useMemo,k=d.useDebugValue;b.useSyncExternalStoreWithSelector=function(a,b,c,d,e){var l=h(null);if(null===l.current){var m={hasValue:!1,value:null};l.current=m}else m=l.current;var n=g(a,(l=j(function(){function a(a){if(!i){if(i=!0,g=a,a=d(a),void 0!==e&&m.hasValue){var b=m.value;if(e(b,a))return h=b}return h=a}if(b=h,f(g,a))return b;var c=d(a);return void 0!==e&&e(b,c)?(g=a,b):(g=a,h=c)}var g,h,i=!1,j=void 0===c?null:c;return[function(){return a(b())},null===j?void 0:function(){return a(j())}]},[b,c,d,e]))[0],l[1]);return i(function(){m.hasValue=!0,m.value=n},[n]),k(n),n}},164:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"getImgProps",{enumerable:!0,get:function(){return j}}),c(2525);let d=c(2362),e=c(2547),f=c(8695),g=["-moz-initial","fill","none","scale-down",void 0];function h(a){return void 0!==a.default}function i(a){return void 0===a?a:"number"==typeof a?Number.isFinite(a)?a:NaN:"string"==typeof a&&/^[0-9]+$/.test(a)?parseInt(a,10):NaN}function j({src:a,sizes:b,unoptimized:c=!1,priority:k=!1,preload:l=!1,loading:m,className:n,quality:o,width:p,height:q,fill:r=!1,style:s,overrideSrc:t,onLoad:u,onLoadingComplete:v,placeholder:w="empty",blurDataURL:x,fetchPriority:y,decoding:z="async",layout:A,objectFit:B,objectPosition:C,lazyBoundary:D,lazyRoot:E,...F},G){var H;let I,J,K,{imgConf:L,showAltText:M,blurComplete:N,defaultLoader:O}=G,P=L||f.imageConfigDefault;if("allSizes"in P)I=P;else{let a=[...P.deviceSizes,...P.imageSizes].sort((a,b)=>a-b),b=P.deviceSizes.sort((a,b)=>a-b),c=P.qualities?.sort((a,b)=>a-b);I={...P,allSizes:a,deviceSizes:b,qualities:c}}if(void 0===O)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let Q=F.loader||O;delete F.loader,delete F.srcSet;let R="__next_img_default"in Q;if(R){if("custom"===I.loader)throw Object.defineProperty(Error(`Image with src "${a}" is missing "loader" prop.
176
+ Read more: https://nextjs.org/docs/messages/next-image-missing-loader`),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let a=Q;Q=b=>{let{config:c,...d}=b;return a(d)}}if(A){"fill"===A&&(r=!0);let a={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[A];a&&(s={...s,...a});let c={responsive:"100vw",fill:"100vw"}[A];c&&!b&&(b=c)}let S="",T=i(p),U=i(q);if((H=a)&&"object"==typeof H&&(h(H)||void 0!==H.src)){let b=h(a)?a.default:a;if(!b.src)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(b)}`),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!b.height||!b.width)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(b)}`),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(J=b.blurWidth,K=b.blurHeight,x=x||b.blurDataURL,S=b.src,!r)if(T||U){if(T&&!U){let a=T/b.width;U=Math.round(b.height*a)}else if(!T&&U){let a=U/b.height;T=Math.round(b.width*a)}}else T=b.width,U=b.height}let V=!k&&!l&&("lazy"===m||void 0===m);(!(a="string"==typeof a?a:S)||a.startsWith("data:")||a.startsWith("blob:"))&&(c=!0,V=!1),I.unoptimized&&(c=!0),R&&!I.dangerouslyAllowSVG&&a.split("?",1)[0].endsWith(".svg")&&(c=!0);let W=i(o),X=Object.assign(r?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:B,objectPosition:C}:{},M?{}:{color:"transparent"},s),Y=N||"empty"===w?null:"blur"===w?`url("data:image/svg+xml;charset=utf-8,${(0,e.getImageBlurSvg)({widthInt:T,heightInt:U,blurWidth:J,blurHeight:K,blurDataURL:x||"",objectFit:X.objectFit})}")`:`url("${w}")`,Z=g.includes(X.objectFit)?"fill"===X.objectFit?"100% 100%":"cover":X.objectFit,$=Y?{backgroundSize:Z,backgroundPosition:X.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:Y}:{},_=function({config:a,src:b,unoptimized:c,width:e,quality:f,sizes:g,loader:h}){if(c){if(b.startsWith("/")&&!b.startsWith("//")){let a=(0,d.getDeploymentId)();if(a){let c=b.indexOf("?");if(-1!==c){let d=new URLSearchParams(b.slice(c+1));d.get("dpl")||(d.append("dpl",a),b=b.slice(0,c)+"?"+d.toString())}else b+=`?dpl=${a}`}}return{src:b,srcSet:void 0,sizes:void 0}}let{widths:i,kind:j}=function({deviceSizes:a,allSizes:b},c,d){if(d){let c=/(^|\s)(1?\d?\d)vw/g,e=[];for(let a;a=c.exec(d);)e.push(parseInt(a[2]));if(e.length){let c=.01*Math.min(...e);return{widths:b.filter(b=>b>=a[0]*c),kind:"w"}}return{widths:b,kind:"w"}}return"number"!=typeof c?{widths:a,kind:"w"}:{widths:[...new Set([c,2*c].map(a=>b.find(b=>b>=a)||b[b.length-1]))],kind:"x"}}(a,e,g),k=i.length-1;return{sizes:g||"w"!==j?g:"100vw",srcSet:i.map((c,d)=>`${h({config:a,src:b,quality:f,width:c})} ${"w"===j?c:d+1}${j}`).join(", "),src:h({config:a,src:b,quality:f,width:i[k]})}}({config:I,src:a,unoptimized:c,width:T,quality:W,sizes:b,loader:Q}),aa=V?"lazy":m;return{props:{...F,loading:aa,fetchPriority:y,width:T,height:U,decoding:z,className:n,style:{...X,...$},sizes:_.sizes,srcSet:_.srcSet,src:t||_.src},meta:{unoptimized:c,preload:l||k,placeholder:w,fill:r}}}},197:(a,b,c)=>{"use strict";a.exports=c(8086)},251:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,3316,23)),Promise.resolve().then(c.t.bind(c,4943,23)),Promise.resolve().then(c.t.bind(c,7907,23)),Promise.resolve().then(c.t.bind(c,966,23)),Promise.resolve().then(c.t.bind(c,9698,23)),Promise.resolve().then(c.t.bind(c,201,23)),Promise.resolve().then(c.t.bind(c,3635,23)),Promise.resolve().then(c.t.bind(c,4246,23))},261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},722:a=>{"use strict";a.exports=require("next/dist/shared/lib/invariant-error")},740:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,3316,23))},800:(a,b,c)=>{"use strict";a.exports=c(566).vendored.contexts.HeadManagerContext},846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},927:(a,b,c)=>{"use strict";c.d(b,{Toaster:()=>e});var d=c(7196);let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call Toaster() from the server but Toaster is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/kazimakgul/Documents/GitHub/AgentOS/components/ui/sonner.tsx","Toaster");(0,d.registerClientReference)(function(){throw Error("Attempted to call toast() from the server but toast is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/kazimakgul/Documents/GitHub/AgentOS/components/ui/sonner.tsx","toast")},1025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},1210:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(248);function e(){return(0,d.jsx)("main",{className:"flex min-h-screen items-center justify-center bg-[#050816] px-6 text-white",children:(0,d.jsxs)("div",{className:"rounded-[24px] border border-white/10 bg-white/[0.03] px-8 py-10 text-center shadow-[0_24px_80px_rgba(0,0,0,0.35)] backdrop-blur-xl",children:[(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-[0.32em] text-slate-500",children:"OpenClaw"}),(0,d.jsx)("h1",{className:"mt-3 font-display text-3xl",children:"Page not found"}),(0,d.jsx)("p",{className:"mt-3 max-w-md text-sm leading-6 text-slate-400",children:"The requested mission-control route does not exist in this workspace."})]})})}},1421:a=>{"use strict";a.exports=require("node:child_process")},1455:a=>{"use strict";a.exports=require("node:fs/promises")},2180:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,7990,23))},2230:(a,b,c)=>{"use strict";a.exports=c(566).vendored.contexts.RouterContext},2542:(a,b,c)=>{Promise.resolve().then(c.bind(c,7281))},2547:(a,b)=>{"use strict";function c({widthInt:a,heightInt:b,blurWidth:d,blurHeight:e,blurDataURL:f,objectFit:g}){let h=d?40*d:a,i=e?40*e:b,j=h&&i?`viewBox='0 0 ${h} ${i}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${j}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${j?"none":"contain"===g?"xMidYMid":"cover"===g?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${f}'/%3E%3C/svg%3E`}Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"getImageBlurSvg",{enumerable:!0,get:function(){return c}})},2728:(a,b)=>{"use strict";function c(a,b){let c=a||75;return b?.qualities?.length?b.qualities.reduce((a,b)=>Math.abs(b-c)<Math.abs(a-c)?b:a,b.qualities[0]):c}Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"findClosestQuality",{enumerable:!0,get:function(){return c}})},2798:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>h,dynamic:()=>g});var d=c(248),e=c(7281),f=c(3715);let g="force-dynamic";async function h(){let a=await (0,f.GM)();return(0,d.jsx)(e.MissionControlShell,{initialSnapshot:a})}},2965:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>M,handler:()=>O,routeModule:()=>N});var d=c(3088),e=c(1039),f=c(8697),g=c(9446),h=c(2504),i=c(8554),j=c(3233),k=c(3074),l=c(4728),m=c(7698),n=c(7836),o=c(3250),p=c(5503),q=c(261),r=c(107),s=c(4824),t=c(6713),u=c(6898),v=c(6615),w=c(7995),x=c(2572),y=c(9548),z=c(9712),A=c(2252),B=c(6439),C=c(7068),D=c(1216),E=c(1144),F=c(7457),G=c(722),H=c(9576),I=c(3954),J=c(7891),K={};for(let a in E)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(K[a]=()=>E[a]);c.d(b,K);let L=["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,2798)),"/Users/kazimakgul/Documents/GitHub/AgentOS/app/page.tsx"]}]},{layout:[()=>Promise.resolve().then(c.bind(c,4890)),"/Users/kazimakgul/Documents/GitHub/AgentOS/app/layout.tsx"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,3316,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.bind(c,1210)),"/Users/kazimakgul/Documents/GitHub/AgentOS/app/not-found.tsx"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,1171,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,7270,23)),"next/dist/client/components/builtin/unauthorized.js"]},[]],M={require:c,loadChunk:()=>Promise.resolve()},N=new d.AppPageRouteModule({definition:{kind:e.RouteKind.APP_PAGE,page:"/page",pathname:"/",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:L},distDir:".next",relativeProjectDir:""});async function O(a,b,d){var K,P,Q,R,S;d.requestMeta&&(0,h.setRequestMeta)(a,d.requestMeta),N.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let T=!!(0,h.getRequestMeta)(a,"minimalMode"),U="/page";"/index"===U&&(U="/");let V=await N.prepare(a,b,{srcPage:U,multiZoneDraftMode:!1});if(!V)return b.statusCode=400,b.end("Bad Request"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let{buildId:W,query:X,params:Y,pageIsDynamic:Z,buildManifest:$,nextFontManifest:_,reactLoadableManifest:aa,serverActionsManifest:ab,clientReferenceManifest:ac,subresourceIntegrityManifest:ad,prerenderManifest:ae,isDraftMode:af,resolvedPathname:ag,revalidateOnlyGenerated:ah,routerServerContext:ai,nextConfig:aj,parsedUrl:ak,interceptionRoutePatterns:al,deploymentId:am,clientAssetToken:an}=V,ao=(0,q.normalizeAppPath)(U),{isOnDemandRevalidate:ap}=V,aq=aj.experimental.ppr&&!aj.cacheComponents&&(0,I.isInterceptionRouteAppPath)(ag)?null:N.match(ag,ae),ar=(null==aq?void 0:aq.route)??null,as=!!ae.routes[ag],at=a.headers["user-agent"]||"",au=(0,t.getBotType)(at),av=(0,p.isHtmlBotRequest)(a),aw=(0,h.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[s.NEXT_ROUTER_PREFETCH_HEADER],ax=(0,h.getRequestMeta)(a,"isRSCRequest")??!!a.headers[s.RSC_HEADER],ay=(0,r.getIsPossibleServerAction)(a),az=(0,m.checkIsAppPPREnabled)(aj.experimental.ppr),aA=a.headers[x.NEXT_RESUME_STATE_LENGTH_HEADER];if(!(0,h.getRequestMeta)(a,"postponed")&&T&&az&&ay&&aA&&"string"==typeof aA){let e=parseInt(aA,10),{maxPostponedStateSize:f,maxPostponedStateSizeBytes:g}=(0,D.getMaxPostponedStateSize)(aj.experimental.maxPostponedStateSize);if(!isNaN(e)&&e>0){if(e>g)return b.statusCode=413,b.end((0,D.getPostponedStateExceededErrorMessage)(f)),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let i="1 MB",j=(null==(S=aj.experimental.serverActions)?void 0:S.bodySizeLimit)??i,k=e+(j!==i?c(5113).parse(j):1048576),l=await (0,D.readBodyWithSizeLimit)(a,k);if(null===l)return b.statusCode=413,b.end("Request body exceeded limit. To configure the body size limit for Server Actions, see: https://nextjs.org/docs/app/api-reference/next-config-js/serverActions#bodysizelimit"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;if(l.length>=e){let b=l.subarray(0,e).toString("utf8");(0,h.addRequestMeta)(a,"postponed",b);let c=l.subarray(e);(0,h.addRequestMeta)(a,"actionBody",c)}else throw Object.defineProperty(Error(`invariant: expected ${e} bytes of postponed state but only received ${l.length} bytes`),"__NEXT_ERROR_CODE",{value:"E979",enumerable:!1,configurable:!0})}}if(!(0,h.getRequestMeta)(a,"postponed")&&az&&"1"===a.headers[x.NEXT_RESUME_HEADER]&&"POST"===a.method){let{maxPostponedStateSize:c,maxPostponedStateSizeBytes:e}=(0,D.getMaxPostponedStateSize)(aj.experimental.maxPostponedStateSize),f=await (0,D.readBodyWithSizeLimit)(a,e);if(null===f)return b.statusCode=413,b.end((0,D.getPostponedStateExceededErrorMessage)(c)),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let g=f.toString("utf8");(0,h.addRequestMeta)(a,"postponed",g)}let aB=!0===N.isDev||!0===aj.experimental.exposeTestingApiInProductionBuild,aC=aB&&("1"===a.headers[s.NEXT_INSTANT_PREFETCH_HEADER]||void 0===a.headers[s.RSC_HEADER]&&"string"==typeof a.headers.cookie&&a.headers.cookie.includes(s.NEXT_INSTANT_TEST_COOKIE+"=")),aD=(az||aC)&&((null==(K=ae.routes[ao]??ae.dynamicRoutes[ao])?void 0:K.renderingMode)==="PARTIALLY_STATIC"||aC&&(aB||(null==ai?void 0:ai.experimentalTestProxy)===!0)),aE=aC&&aD,aF=aE&&!0===N.isDev,aG=!1,aH=aD?(0,h.getRequestMeta)(a,"postponed"):void 0,aI=null==(P=ae.routes[ag])?void 0:P.prefetchDataRoute,aJ=aD&&ax&&!aw&&!aI;T&&(aJ=aJ&&!!aH);let aK=(0,h.getRequestMeta)(a,"segmentPrefetchRSCRequest"),aL=(!au||!aD)&&(!at||(0,p.shouldServeStreamingMetadata)(at,aj.htmlLimitedBots)),aM=!!((ar||as||ae.routes[ao])&&!(au&&aD)),aN=aD&&!0===aj.cacheComponents,aO=!0===N.isDev||!aM||"string"==typeof aH||(aN&&(0,h.getRequestMeta)(a,"onCacheEntryV2")?aJ&&!T:aJ),aP=!!au&&aD,aQ=(null==ar?void 0:ar.remainingPrerenderableParams)??[],aR=(null==ar?void 0:ar.fallback)===null&&((null==(Q=ar.fallbackRootParams)?void 0:Q.length)??0)>0,aS=null;if(!af&&aM&&!aO&&!ay&&!aH&&!aJ){let a=aq?"string"==typeof(null==ar?void 0:ar.fallback)?ar.fallback:aq.source:null;if(!0===aj.experimental.partialFallbacks&&a&&(null==ar?void 0:ar.fallbackRouteParams)&&!aR){if(aQ.length>0){let b,c=(b=new Map(aQ.map(a=>[a.paramName,a])),a.split("/").map(a=>{let c=(0,J.getSegmentParam)(a);if(!c)return a;let d=b.get(c.paramName);if(!d)return a;let e=null==Y?void 0:Y[d.paramName];if(!e)return a;let f=Array.isArray(e)?e.map(a=>encodeURIComponent(a)).join("/"):encodeURIComponent(e);return a.replace(function(a){let{repeat:b,optional:c}=(0,J.getParamProperties)(a.paramType);return c?`[[...${a.paramName}]]`:b?`[...${a.paramName}]`:`[${a.paramName}]`}(d),f)}).join("/")||"/");aS=c!==a?c:null}}else aS=ag}let aT=aS;!aT&&(N.isDev||aM&&Z&&(null==ar?void 0:ar.fallbackRouteParams))&&(aT=ag),N.isDev||af||!aM||!ax||aJ||(0,k.d)(a.headers);let aU={...E,tree:L,handler:O,routeModule:N,__next_app__:M};ab&&ac&&(0,o.setManifestsSingleton)({page:U,clientReferenceManifest:ac,serverActionsManifest:ab});let aV=a.method||"GET",aW=(0,g.getTracer)(),aX=aW.getActiveScopeSpan(),aY=!!(null==ai?void 0:ai.isWrappedByNextServer),aZ=!0===aj.experimental.partialFallbacks&&aQ.length>0?(null==ar||null==(R=ar.fallbackRouteParams)?void 0:R.filter(a=>!aQ.some(b=>b.paramName===a.paramName)))??[]:[],a$=async()=>((null==ai?void 0:ai.render404)?await ai.render404(a,b,ak,!1):b.end("This page could not be found"),null);try{let f,k=N.getVaryHeader(ag,al);b.setHeader("Vary",k);let m=async(c,d)=>{let e=new l.NodeNextRequest(a),g=new l.NodeNextResponse(b);return N.render(e,g,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let a=aW.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==i.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let d=a.get("next.route");if(d){let a=`${aV} ${d}`;c.setAttributes({"next.route":d,"http.route":d,"next.span_name":a}),c.updateName(a),f&&f!==c&&(f.setAttribute("http.route",d),f.updateName(a))}else c.updateName(`${aV} ${U}`)})},o=(0,h.getRequestMeta)(a,"incrementalCache")||await N.getIncrementalCache(a,aj,ae,T);null==o||o.resetRequestCache(),globalThis.__incrementalCache=o;let p=async({span:e,postponed:f,fallbackRouteParams:g,forceStaticRender:i})=>{let k={query:X,params:Y,page:ao,sharedContext:{buildId:W,deploymentId:am,clientAssetToken:an},serverComponentsHmrCache:(0,h.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:g,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aU,Component:(0,j.T)(aU),params:Y,routeModule:N,page:U,postponed:f,shouldWaitOnAllReady:aP,serveStreamingMetadata:aL,supportsDynamicResponse:"string"==typeof f||aO,buildManifest:$,nextFontManifest:_,reactLoadableManifest:aa,subresourceIntegrityManifest:ad,setCacheStatus:null==ai?void 0:ai.setCacheStatus,setIsrStatus:null==ai?void 0:ai.setIsrStatus,setReactDebugChannel:null==ai?void 0:ai.setReactDebugChannel,sendErrorsToBrowser:null==ai?void 0:ai.sendErrorsToBrowser,dir:c(3873).join(process.cwd(),N.relativeProjectDir),isDraftMode:af,botType:au,isOnDemandRevalidate:ap,isPossibleServerAction:ay,assetPrefix:aj.assetPrefix,nextConfigOutput:aj.output,crossOrigin:aj.crossOrigin,trailingSlash:aj.trailingSlash,images:aj.images,previewProps:ae.preview,enableTainting:aj.experimental.taint,htmlLimitedBots:aj.htmlLimitedBots,reactMaxHeadersLength:aj.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:o,cacheLifeProfiles:aj.cacheLife,basePath:aj.basePath,serverActions:aj.experimental.serverActions,logServerFunctions:"object"==typeof aj.logging&&!!aj.logging.serverFunctions,...aE||aF||aG?{isBuildTimePrerendering:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isDebugDynamicAccesses:aF}:{},cacheComponents:!!aj.cacheComponents,experimental:{isRoutePPREnabled:aD,expireTime:aj.expireTime,staleTimes:aj.experimental.staleTimes,dynamicOnHover:!!aj.experimental.dynamicOnHover,optimisticRouting:!!aj.experimental.optimisticRouting,inlineCss:!!aj.experimental.inlineCss,prefetchInlining:aj.experimental.prefetchInlining??!1,authInterrupts:!!aj.experimental.authInterrupts,cachedNavigations:!!aj.experimental.cachedNavigations,clientTraceMetadata:aj.experimental.clientTraceMetadata||[],clientParamParsingOrigins:aj.experimental.clientParamParsingOrigins,maxPostponedStateSizeBytes:(0,C.parseMaxPostponedStateSize)(aj.experimental.maxPostponedStateSize)},waitUntil:d.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d,e)=>N.onRequestError(a,b,d,e,ai),err:(0,h.getRequestMeta)(a,"invokeError")}};i&&(k.renderOpts.supportsDynamicResponse=!1);let l=await m(e,k),{metadata:n}=l,{cacheControl:p,headers:q={},fetchTags:r,fetchMetrics:s}=n;if(r&&(q[x.NEXT_CACHE_TAGS_HEADER]=r),a.fetchMetrics=s,aM&&(null==p?void 0:p.revalidate)===0&&!N.isDev&&!aD){let a=n.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${ag}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""}
177
+ see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:u.CachedRouteKind.APP_PAGE,html:l,headers:q,rscData:n.flightData,postponed:n.postponed,status:n.statusCode,segmentData:n.segmentData},cacheControl:p}},q=async({hasResolved:c,previousCacheEntry:f,isRevalidating:g,span:i,forceStaticRender:j=!1})=>{let k,l=!1===N.isDev,m=c||b.writableEnded;if(ap&&ah&&!f&&!T)return(null==ai?void 0:ai.render404)?await ai.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(ar&&(k=(0,v.parseFallbackField)(ar.fallback)),!0===aj.experimental.partialFallbacks&&(null==ar?void 0:ar.fallback)===null&&!aR&&aQ.length>0&&(k=v.FallbackMode.PRERENDER),k===v.FallbackMode.PRERENDER&&(0,t.isBot)(at)&&(!aD||av)&&(k=v.FallbackMode.BLOCKING_STATIC_RENDER),(null==f?void 0:f.isStale)===-1&&(ap=!0),ap&&(k!==v.FallbackMode.NOT_FOUND||f)&&(k=v.FallbackMode.BLOCKING_STATIC_RENDER),!T&&k!==v.FallbackMode.BLOCKING_STATIC_RENDER&&aT&&!m&&!af&&Z&&(l||!as)){if((l||ar)&&k===v.FallbackMode.NOT_FOUND){if(aj.adapterPath)return await a$();throw new B.NoFallbackError}if(aD&&(aj.cacheComponents?!aJ:!ax)){let b=l&&"string"==typeof(null==ar?void 0:ar.fallback)?ar.fallback:ao,f=(l||aE)&&(null==ar?void 0:ar.fallbackRouteParams)?(0,n.createOpaqueFallbackRouteParams)(ar.fallbackRouteParams):aG?(0,n.getFallbackRouteParams)(ao,N):null;aE&&f&&(0,h.addRequestMeta)(a,"fallbackParams",f);let g=await N.handleResponse({cacheKey:b,req:a,nextConfig:aj,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:ae,isRoutePPREnabled:aD,responseGenerator:async()=>p({span:i,postponed:void 0,fallbackRouteParams:f,forceStaticRender:!0}),waitUntil:d.waitUntil,isMinimalMode:T});if(null===g)return null;if(g)return T||!aD||!(aQ.length>0)||!0!==aj.experimental.partialFallbacks||!aS||!o||ap||aG||aB||aC||aw||(0,H.scheduleOnNextTick)(async()=>{let b=N.getResponseCache(a);try{await b.revalidate(aS,o,aD,!1,a=>p({span:a.span,postponed:void 0,fallbackRouteParams:aZ.length>0?(0,n.createOpaqueFallbackRouteParams)(aZ):null,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}),delete g.cacheControl,g}}let r=ap||g||!aH?void 0:aH;if(aN&&!T&&o&&(aJ||ay)&&!j){let b=await o.get(ag,{kind:u.IncrementalCacheKind.APP_PAGE,isRoutePPREnabled:!0,isFallback:!1});b&&b.value&&b.value.kind===u.CachedRouteKind.APP_PAGE&&(r=b.value.postponed,b&&(-1===b.isStale||!0===b.isStale)&&(0,H.scheduleOnNextTick)(async()=>{let b=N.getResponseCache(a);try{await b.revalidate(ag,o,aD,!1,a=>q({...a,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}))}if((aE||aF)&&void 0!==r)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:u.CachedRouteKind.PAGES,html:w.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let s=(l&&(0,h.getRequestMeta)(a,"renderFallbackShell")||aE&&!as)&&(null==ar?void 0:ar.fallbackRouteParams)?(0,n.createOpaqueFallbackRouteParams)(ar.fallbackRouteParams):aG?(0,n.getFallbackRouteParams)(ao,N):null;if((l||aE)&&aj.cacheComponents&&!as&&(null==ar?void 0:ar.fallbackRouteParams)){let b=(0,n.createOpaqueFallbackRouteParams)(ar.fallbackRouteParams);b&&(0,h.addRequestMeta)(a,"fallbackParams",b)}return p({span:i,postponed:r,fallbackRouteParams:s,forceStaticRender:j})},r=async c=>{var f,g,i,j,k;let l,m=await N.handleResponse({cacheKey:aS,responseGenerator:a=>q({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ap,isRoutePPREnabled:aD,req:a,nextConfig:aj,prerenderManifest:ae,waitUntil:d.waitUntil,isMinimalMode:T});if(af&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),N.isDev&&b.setHeader("Cache-Control","no-cache, must-revalidate"),!m){if(aS)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=m.value)?void 0:f.kind)!==u.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=m.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let n="string"==typeof m.value.postponed;ax&&!ay&&am&&b.setHeader(x.NEXT_NAV_DEPLOYMENT_ID_HEADER,am),aM&&!aJ&&(!n||aw)&&(T||b.setHeader("x-nextjs-cache",ap?"REVALIDATED":m.isMiss?"MISS":m.isStale?"STALE":"HIT"),b.setHeader(s.NEXT_IS_PRERENDER_HEADER,"1"));let{value:o}=m;if(aH)l={revalidate:0,expire:void 0};else if(aJ)l={revalidate:0,expire:void 0};else if(!N.isDev)if(af)l={revalidate:0,expire:void 0};else if(aM){if(m.cacheControl)if("number"==typeof m.cacheControl.revalidate){if(m.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${m.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});l={revalidate:m.cacheControl.revalidate,expire:(null==(j=m.cacheControl)?void 0:j.expire)??aj.expireTime}}else l={revalidate:x.CACHE_ONE_YEAR_SECONDS,expire:void 0}}else b.getHeader("Cache-Control")||(l={revalidate:0,expire:void 0});if(m.cacheControl=l,"string"==typeof aK&&(null==o?void 0:o.kind)===u.CachedRouteKind.APP_PAGE&&o.segmentData){b.setHeader(s.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=o.headers)?void 0:k[x.NEXT_CACHE_TAGS_HEADER];T&&aM&&c&&"string"==typeof c&&b.setHeader(x.NEXT_CACHE_TAGS_HEADER,c);let d=o.segmentData.get(aK);return void 0!==d?(0,A.sendRenderResult)({req:a,res:b,generateEtags:aj.generateEtags,poweredByHeader:aj.poweredByHeader,result:w.default.fromStatic(d,s.RSC_CONTENT_TYPE_HEADER),cacheControl:m.cacheControl}):(b.statusCode=204,(0,A.sendRenderResult)({req:a,res:b,generateEtags:aj.generateEtags,poweredByHeader:aj.poweredByHeader,result:w.default.EMPTY,cacheControl:m.cacheControl}))}let r=aN?(0,h.getRequestMeta)(a,"onCacheEntryV2")??(0,h.getRequestMeta)(a,"onCacheEntry"):(0,h.getRequestMeta)(a,"onCacheEntry");if(r&&await r(m,{url:(0,h.getRequestMeta)(a,"initURL")??a.url}))return null;if(o.headers){let a={...o.headers};for(let[c,d]of(T&&aM||delete a[x.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let t=null==(g=o.headers)?void 0:g[x.NEXT_CACHE_TAGS_HEADER];if(T&&aM&&t&&"string"==typeof t&&b.setHeader(x.NEXT_CACHE_TAGS_HEADER,t),!o.status||ax&&aD||(b.statusCode=o.status),!T&&o.status&&F.RedirectStatusCode[o.status]&&ax&&(b.statusCode=200),n&&!aJ&&b.setHeader(s.NEXT_DID_POSTPONE_HEADER,"1"),ax&&!af){if(void 0===o.rscData){if(o.html.contentType!==s.RSC_CONTENT_TYPE_HEADER)if(aj.cacheComponents)return b.statusCode=404,(0,A.sendRenderResult)({req:a,res:b,generateEtags:aj.generateEtags,poweredByHeader:aj.poweredByHeader,result:w.default.EMPTY,cacheControl:m.cacheControl});else throw Object.defineProperty(new G.InvariantError(`Expected RSC response, got ${o.html.contentType}`),"__NEXT_ERROR_CODE",{value:"E789",enumerable:!1,configurable:!0});return(0,A.sendRenderResult)({req:a,res:b,generateEtags:aj.generateEtags,poweredByHeader:aj.poweredByHeader,result:o.html,cacheControl:m.cacheControl})}return(0,A.sendRenderResult)({req:a,res:b,generateEtags:aj.generateEtags,poweredByHeader:aj.poweredByHeader,result:w.default.fromStatic(o.rscData,s.RSC_CONTENT_TYPE_HEADER),cacheControl:m.cacheControl})}let v=o.html;if(aC&&aE){let c=!0===N.isDev?crypto.randomUUID():null;return v.pipeThrough((0,z.createInstantTestScriptInsertionTransformStream)(c)),(0,A.sendRenderResult)({req:a,res:b,generateEtags:aj.generateEtags,poweredByHeader:aj.poweredByHeader,result:v,cacheControl:{revalidate:0,expire:void 0}})}if(!n||T||ax)return(0,A.sendRenderResult)({req:a,res:b,generateEtags:aj.generateEtags,poweredByHeader:aj.poweredByHeader,result:v,cacheControl:m.cacheControl});if(aE||aF)return v.push(new ReadableStream({start(a){a.enqueue(y.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,A.sendRenderResult)({req:a,res:b,generateEtags:aj.generateEtags,poweredByHeader:aj.poweredByHeader,result:v,cacheControl:{revalidate:0,expire:void 0}});let B=new TransformStream;return v.push(B.readable),p({span:c,postponed:o.postponed,fallbackRouteParams:null,forceStaticRender:!1}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==u.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(B.writable)}).catch(a=>{B.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,A.sendRenderResult)({req:a,res:b,generateEtags:aj.generateEtags,poweredByHeader:aj.poweredByHeader,result:v,cacheControl:{revalidate:0,expire:void 0}})};if(!aY||!aX)return f=aW.getActiveScopeSpan(),await aW.withPropagatedContext(a.headers,()=>aW.trace(i.BaseServerSpan.handleRequest,{spanName:`${aV} ${U}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aV,"http.target":a.url}},r),void 0,!aY);await r(aX)}catch(b){throw b instanceof B.NoFallbackError||await N.onRequestError(a,b,{routerKind:"App Router",routePath:U,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:aM,isOnDemandRevalidate:ap})},!1,ai),b}}},3024:a=>{"use strict";a.exports=require("node:fs")},3033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},3081:(a,b,c)=>{"use strict";c.d(b,{Toaster:()=>d.l$,o:()=>d.oR});var d=c(7825)},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},3381:()=>{},3395:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,7990,23)),Promise.resolve().then(c.t.bind(c,2681,23)),Promise.resolve().then(c.t.bind(c,5585,23)),Promise.resolve().then(c.t.bind(c,6568,23)),Promise.resolve().then(c.t.bind(c,40,23)),Promise.resolve().then(c.t.bind(c,5804,23)),Promise.resolve().then(c.t.bind(c,2125,23)),Promise.resolve().then(c.bind(c,700))},3873:a=>{"use strict";a.exports=require("path")},3954:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/interception-routes")},4518:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});var d={default:function(){return k},getImageProps:function(){return j}};for(var e in d)Object.defineProperty(b,e,{enumerable:!0,get:d[e]});let f=c(8517),g=c(164),h=c(8732),i=f._(c(4594));function j(a){let{props:b}=(0,g.getImgProps)(a,{defaultLoader:i.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[a,c]of Object.entries(b))void 0===c&&delete b[a];return{props:b}}let k=h.Image},4594:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"default",{enumerable:!0,get:function(){return g}});let d=c(2728),e=c(2362);function f({config:a,src:b,width:c,quality:g}){let h=(0,e.getDeploymentId)();if(b.startsWith("/")&&!b.startsWith("//")){let a=b.indexOf("?");if(-1!==a){let c=new URLSearchParams(b.slice(a+1)),d=c.get("dpl");if(d){h=d,c.delete("dpl");let e=c.toString();b=b.slice(0,a)+(e?"?"+e:"")}}}if(b.startsWith("/")&&b.includes("?")&&a.localPatterns?.length===1&&"**"===a.localPatterns[0].pathname&&""===a.localPatterns[0].search)throw Object.defineProperty(Error(`Image with src "${b}" is using a query string which is not configured in images.localPatterns.
178
+ Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`),"__NEXT_ERROR_CODE",{value:"E871",enumerable:!1,configurable:!0});let i=(0,d.findClosestQuality)(g,a);return`${a.path}?url=${encodeURIComponent(b)}&w=${c}&q=${i}${b.startsWith("/")&&h?`&dpl=${h}`:""}`}f.__next_img_default=!0;let g=f},4890:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>m,metadata:()=>l,viewport:()=>k});var d=c(248),e=c(927);c(3381);let f="AgentOS | OpenClaw Mission Control",g="Human Control Layer for AI Agents and Companies | Built on OpenClaw.",h="/readme/agentos1.webp",i=process.env.NEXT_PUBLIC_SITE_URL??process.env.VERCEL_URL,j=new URL(i?i.startsWith("http")?i:`https://${i}`:"http://localhost:3000"),k={themeColor:"#09101c"},l={metadataBase:j,title:f,description:g,applicationName:"AgentOS | Mission Control",manifest:"/site.webmanifest",openGraph:{type:"website",siteName:"AgentOS | Mission Control",title:f,description:g,images:[{url:h,width:1536,height:1024,alt:"AgentOS mission-control interface"}]},twitter:{card:"summary_large_image",title:f,description:g,images:[h]},icons:{icon:[{url:"/favicon.ico",sizes:"any"},{url:"/favicon-16x16.png",sizes:"16x16",type:"image/png"},{url:"/favicon-32x32.png",sizes:"32x32",type:"image/png"}],apple:[{url:"/apple-touch-icon.png",sizes:"180x180",type:"image/png"}],shortcut:["/favicon.ico"]}};function m({children:a}){return(0,d.jsx)("html",{lang:"en",className:"dark",suppressHydrationWarning:!0,children:(0,d.jsxs)("body",{children:[a,(0,d.jsx)(e.Toaster,{theme:"dark",richColors:!0,closeButton:!0})]})})}},5590:(a,b,c)=>{Promise.resolve().then(c.bind(c,145))},5723:(a,b,c)=>{Promise.resolve().then(c.bind(c,927))},5826:(a,b,c)=>{"use strict";a.exports=c(566).vendored.contexts.ImageConfigContext},6439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},6713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},6760:a=>{"use strict";a.exports=require("node:path")},7055:(a,b,c)=>{"use strict";a.exports=c(146)},7068:a=>{"use strict";a.exports=require("next/dist/shared/lib/size-limit")},7281:(a,b,c)=>{"use strict";c.d(b,{MissionControlShell:()=>d});let d=(0,c(7196).registerClientReference)(function(){throw Error("Attempted to call MissionControlShell() from the server but MissionControlShell is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/kazimakgul/Documents/GitHub/AgentOS/components/mission-control/mission-control-shell.tsx","MissionControlShell")},7467:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});var d={default:function(){return p},defaultHead:function(){return l}};for(var e in d)Object.defineProperty(b,e,{enumerable:!0,get:d[e]});let f=c(8517),g=c(3896),h=c(3814),i=g._(c(6247)),j=f._(c(8150)),k=c(800);function l(){return[(0,h.jsx)("meta",{charSet:"utf-8"},"charset"),(0,h.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")]}function m(a,b){return"string"==typeof b||"number"==typeof b?a:b.type===i.default.Fragment?a.concat(i.default.Children.toArray(b.props.children).reduce((a,b)=>"string"==typeof b||"number"==typeof b?a:a.concat(b),[])):a.concat(b)}c(2525);let n=["name","httpEquiv","charSet","itemProp"];function o(a){let b,c,d,e;return a.reduce(m,[]).reverse().concat(l().reverse()).filter((b=new Set,c=new Set,d=new Set,e={},a=>{let f=!0,g=!1;if(a.key&&"number"!=typeof a.key&&a.key.indexOf("$")>0){g=!0;let c=a.key.slice(a.key.indexOf("$")+1);b.has(c)?f=!1:b.add(c)}switch(a.type){case"title":case"base":c.has(a.type)?f=!1:c.add(a.type);break;case"meta":for(let b=0,c=n.length;b<c;b++){let c=n[b];if(a.props.hasOwnProperty(c))if("charSet"===c)d.has(c)?f=!1:d.add(c);else{let b=a.props[c],d=e[c]||new Set;("name"!==c||!g)&&d.has(b)?f=!1:(d.add(b),e[c]=d)}}}return f})).reverse().map((a,b)=>{let c=a.key||b;return i.default.cloneElement(a,{key:c})})}let p=function({children:a}){let b=(0,i.useContext)(k.HeadManagerContext);return(0,h.jsx)(j.default,{reduceComponentsToState:o,headManager:b,children:a})};("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},7598:a=>{"use strict";a.exports=require("node:crypto")},7891:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/get-segment-param")},7975:a=>{"use strict";a.exports=require("node:util")},8086:(a,b,c)=>{"use strict";var d=c(6247),e="function"==typeof Object.is?Object.is:function(a,b){return a===b&&(0!==a||1/a==1/b)||a!=a&&b!=b},f=d.useState,g=d.useEffect,h=d.useLayoutEffect,i=d.useDebugValue;function j(a){var b=a.getSnapshot;a=a.value;try{var c=b();return!e(a,c)}catch(a){return!0}}var k="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(a,b){return b()}:function(a,b){var c=b(),d=f({inst:{value:c,getSnapshot:b}}),e=d[0].inst,k=d[1];return h(function(){e.value=c,e.getSnapshot=b,j(e)&&k({inst:e})},[a,c,b]),g(function(){return j(e)&&k({inst:e}),a(function(){j(e)&&k({inst:e})})},[a]),i(c),c};b.useSyncExternalStore=void 0!==d.useSyncExternalStore?d.useSyncExternalStore:k},8150:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"default",{enumerable:!0,get:function(){return f}});let d=c(6247),e=()=>{};function f(a){let{headManager:b,reduceComponentsToState:c}=a;function f(){if(b&&b.mountedInstances){let a=d.Children.toArray(Array.from(b.mountedInstances).filter(Boolean));b.updateHead(c(a))}}return b?.mountedInstances?.add(a.children),f(),e(()=>(b?.mountedInstances?.add(a.children),()=>{b?.mountedInstances?.delete(a.children)})),e(()=>(b&&(b._pendingUpdate=f),()=>{b&&(b._pendingUpdate=f)})),null}},8161:a=>{"use strict";a.exports=require("node:os")},8295:()=>{},8354:a=>{"use strict";a.exports=require("util")},8695:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});var c={VALID_LOADERS:function(){return e},imageConfigDefault:function(){return f}};for(var d in c)Object.defineProperty(b,d,{enumerable:!0,get:c[d]});let e=["default","imgix","cloudinary","akamai","custom"],f={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumDiskCacheSize:void 0,maximumRedirects:3,maximumResponseBody:5e7,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1,customCacheHandler:!1}},8732:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"Image",{enumerable:!0,get:function(){return u}});let d=c(8517),e=c(3896),f=c(3814),g=e._(c(6247)),h=d._(c(8238)),i=d._(c(7467)),j=c(164),k=c(8695),l=c(5826);c(2525);let m=c(2230),n=d._(c(4594)),o=c(8973),p={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function q(a,b,c,d,e,f,g){let h=a?.src;a&&a["data-loaded-src"]!==h&&(a["data-loaded-src"]=h,("decode"in a?a.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(a.parentElement&&a.isConnected){if("empty"!==b&&e(!0),c?.current){let b=new Event("load");Object.defineProperty(b,"target",{writable:!1,value:a});let d=!1,e=!1;c.current({...b,nativeEvent:b,currentTarget:a,target:a,isDefaultPrevented:()=>d,isPropagationStopped:()=>e,persist:()=>{},preventDefault:()=>{d=!0,b.preventDefault()},stopPropagation:()=>{e=!0,b.stopPropagation()}})}d?.current&&d.current(a)}}))}function r(a){return g.use?{fetchPriority:a}:{fetchpriority:a}}globalThis.__NEXT_IMAGE_IMPORTED=!0;let s=(0,g.forwardRef)(({src:a,srcSet:b,sizes:c,height:d,width:e,decoding:h,className:i,style:j,fetchPriority:k,placeholder:l,loading:m,unoptimized:n,fill:p,onLoadRef:s,onLoadingCompleteRef:t,setBlurComplete:u,setShowAltText:v,sizesInput:w,onLoad:x,onError:y,...z},A)=>{let B=(0,g.useCallback)(a=>{a&&(y&&(a.src=a.src),a.complete&&q(a,l,s,t,u,n,w))},[a,l,s,t,u,y,n,w]),C=(0,o.useMergedRef)(A,B);return(0,f.jsx)("img",{...z,...r(k),loading:m,width:e,height:d,decoding:h,"data-nimg":p?"fill":"1",className:i,style:j,sizes:c,srcSet:b,src:a,ref:C,onLoad:a=>{q(a.currentTarget,l,s,t,u,n,w)},onError:a=>{v(!0),"empty"!==l&&u(!0),y&&y(a)}})});function t({isAppRouter:a,imgAttributes:b}){let c={as:"image",imageSrcSet:b.srcSet,imageSizes:b.sizes,crossOrigin:b.crossOrigin,referrerPolicy:b.referrerPolicy,...r(b.fetchPriority)};return a&&h.default.preload?(h.default.preload(b.src,c),null):(0,f.jsx)(i.default,{children:(0,f.jsx)("link",{rel:"preload",href:b.srcSet?void 0:b.src,...c},"__nimg-"+b.src+b.srcSet+b.sizes)})}let u=(0,g.forwardRef)((a,b)=>{let c=(0,g.useContext)(m.RouterContext),d=(0,g.useContext)(l.ImageConfigContext),e=(0,g.useMemo)(()=>{let a=p||d||k.imageConfigDefault,b=[...a.deviceSizes,...a.imageSizes].sort((a,b)=>a-b),c=a.deviceSizes.sort((a,b)=>a-b),e=a.qualities?.sort((a,b)=>a-b);return{...a,allSizes:b,deviceSizes:c,qualities:e,localPatterns:d?.localPatterns}},[d]),{onLoad:h,onLoadingComplete:i}=a,o=(0,g.useRef)(h);(0,g.useEffect)(()=>{o.current=h},[h]);let q=(0,g.useRef)(i);(0,g.useEffect)(()=>{q.current=i},[i]);let[r,u]=(0,g.useState)(!1),[v,w]=(0,g.useState)(!1),{props:x,meta:y}=(0,j.getImgProps)(a,{defaultLoader:n.default,imgConf:e,blurComplete:r,showAltText:v});return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(s,{...x,unoptimized:y.unoptimized,placeholder:y.placeholder,fill:y.fill,onLoadRef:o,onLoadingCompleteRef:q,setBlurComplete:u,setShowAltText:w,sizesInput:a.sizes,ref:b}),y.preload?(0,f.jsx)(t,{isAppRouter:!c,imgAttributes:x}):null]})});("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},8867:(a,b,c)=>{Promise.resolve().then(c.bind(c,3081))},8973:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"useMergedRef",{enumerable:!0,get:function(){return e}});let d=c(6247);function e(a,b){let c=(0,d.useRef)(null),e=(0,d.useRef)(null);return(0,d.useCallback)(d=>{if(null===d){let a=c.current;a&&(c.current=null,a());let b=e.current;b&&(e.current=null,b())}else a&&(c.current=f(a,d)),b&&(e.current=f(b,d))},[a,b])}function f(a,b){if("function"!=typeof a)return a.current=b,()=>{a.current=null};{let c=a(b);return"function"==typeof c?c:()=>a(null)}}("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},9121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},9294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")}};var b=require("../webpack-runtime.js");b.C(a);var c=b.X(0,[408,35,825,49],()=>b(b.s=2965));module.exports=c})();