@xopcai/xopc 0.0.392 → 0.0.394

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 (547) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/src/plugin.js +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CZmaQbC9.js → agent-avatar-dicebear-CIpp0ZG6.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DzkKx0Dv.js +1 -0
  6. package/dist/gateway/static/root/assets/agent-plugin-dialog-dWqozfQm.js +1 -0
  7. package/dist/gateway/static/root/assets/agents-CXG8SYr5.js +77 -0
  8. package/dist/gateway/static/root/assets/{agents-admin-api-znm6_dW_.js → agents-admin-api-B5aykqg_.js} +1 -1
  9. package/dist/gateway/static/root/assets/app-management-settings-panel-SmT1HDDg.js +1 -0
  10. package/dist/gateway/static/root/assets/appearance-settings-Da9jf0ZC.js +1 -0
  11. package/dist/gateway/static/root/assets/apps-page-DYaxWrTI.js +1 -0
  12. package/dist/gateway/static/root/assets/{archive-plugin-dSkmoISk.js → archive-plugin-D6bFXdsA.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-DhWRn0dZ.js → automations-page-CM3wI2Nr.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-workspace-BSMdKgxD.js +6 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-BJlZrYym.js → binary-plugins-CYKGdQnF.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-OHBssIfN.js → block-editor-Fx38xFF4.js} +40 -40
  17. package/dist/gateway/static/root/assets/browser-automation-inputs-CQMc-Gol.js +1 -0
  18. package/dist/gateway/static/root/assets/browser-automations-page-C4VhFvyu.js +3 -0
  19. package/dist/gateway/static/root/assets/browser-settings-page-8WZOkfL7.js +3 -0
  20. package/dist/gateway/static/root/assets/capabilities-page-dreSJEes.js +2 -0
  21. package/dist/gateway/static/root/assets/{capabilities-CgDteXZH.js → capabilities-pt2M56-E.js} +1 -1
  22. package/dist/gateway/static/root/assets/capabilities-settings-panel-9DviVNpG.js +8 -0
  23. package/dist/gateway/static/root/assets/capability-header-actions-AbVbg7kZ.js +1 -0
  24. package/dist/gateway/static/root/assets/channels-DqGCiVmr.js +1 -0
  25. package/dist/gateway/static/root/assets/chat-terminal-dock-djkqphez.js +36 -0
  26. package/dist/gateway/static/root/assets/computer-settings-page-DE9zl7bK.js +1 -0
  27. package/dist/gateway/static/root/assets/connector-service-page--gB9vL3C.js +1 -0
  28. package/dist/gateway/static/root/assets/connectors-page-Bcr2NNoX.js +1 -0
  29. package/dist/gateway/static/root/assets/date-picker-D9q-5a8a.js +1 -0
  30. package/dist/gateway/static/root/assets/dependency-picker-Ci0dApIr.js +1 -0
  31. package/dist/gateway/static/root/assets/desktop-pet-CjaVVJDQ.js +1 -0
  32. package/dist/gateway/static/root/assets/desktop-pet-settings-C7TFazyr.js +1 -0
  33. package/dist/gateway/static/root/assets/desktop-pet-sprite-Bd-aOI7N.js +30 -0
  34. package/dist/gateway/static/root/assets/desktop-pet-sprite-BuB0g8zv.css +1 -0
  35. package/dist/gateway/static/root/assets/device-pairing-wizard-B6S-RpNJ.js +1 -0
  36. package/dist/gateway/static/root/assets/directory-picker-path-field-BpymM_E_.js +1 -0
  37. package/dist/gateway/static/root/assets/extension-debug-page-CABAv66K.js +1 -0
  38. package/dist/gateway/static/root/assets/extension-page-B3dACpKA.js +1 -0
  39. package/dist/gateway/static/root/assets/extension-settings-page-B3bwBvgp.js +1 -0
  40. package/dist/gateway/static/root/assets/{gateway-config-swr-BM__9Fws.js → gateway-config-swr-BEePO3Wl.js} +1 -1
  41. package/dist/gateway/static/root/assets/{gateway-realtime-DS_GDx-x.js → gateway-realtime-Dng_VOvI.js} +1 -1
  42. package/dist/gateway/static/root/assets/gateway-realtime-store-DtlBf7oH.js +1 -0
  43. package/dist/gateway/static/root/assets/gateway-settings-CzA1bTXZ.js +1 -0
  44. package/dist/gateway/static/root/assets/{gateway-startup-retry-DosoyMIH.js → gateway-startup-retry-CDCiy7Cd.js} +1 -1
  45. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-BYHXWIfK.js → highlighted-body-KQOG7T2V-53FJXO9w.js} +1 -1
  46. package/dist/gateway/static/root/assets/home-page-KRPp-I4O.js +2 -0
  47. package/dist/gateway/static/root/assets/image-generation-api-DWRmAkoe.js +1 -0
  48. package/dist/gateway/static/root/assets/imports-page-B0Y8iy6G.js +1 -0
  49. package/dist/gateway/static/root/assets/index-BvAvfZ5R.js +260 -0
  50. package/dist/gateway/static/root/assets/index-CMRCop32.css +1 -0
  51. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-CjkACa5H.js +1 -0
  52. package/dist/gateway/static/root/assets/local-app-workbench-page-DROP52YA.js +1 -0
  53. package/dist/gateway/static/root/assets/local-apps-page-BELUF7Pg.js +1 -0
  54. package/dist/gateway/static/root/assets/{local-session-drafts-Bye3ZtsW.js → local-session-drafts-CYEDUPH7.js} +1 -1
  55. package/dist/gateway/static/root/assets/{locale-store-BKyOF23r.js → locale-store-CE7L6MlS.js} +1 -1
  56. package/dist/gateway/static/root/assets/logs-page-DBm3g8Mu.js +2 -0
  57. package/dist/gateway/static/root/assets/management-settings-CcsW4Z-r.js +1 -0
  58. package/dist/gateway/static/root/assets/{markdown-view-D_7clISS.js → markdown-view-PrKvVpRh.js} +1 -1
  59. package/dist/gateway/static/root/assets/{media-plugins-B_4o8hac.js → media-plugins-UU3qSAhq.js} +1 -1
  60. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CG664NRI.js +1 -0
  61. package/dist/gateway/static/root/assets/messages-CaeL_miw.js +3 -0
  62. package/dist/gateway/static/root/assets/note-detail-panel-BS9XnQ8a.js +5 -0
  63. package/dist/gateway/static/root/assets/notes-page-Cfy_WnU-.js +8 -0
  64. package/dist/gateway/static/root/assets/page-context-capture-button-BD7T7uqR.js +1 -0
  65. package/dist/gateway/static/root/assets/personal-page-DZEh3dXq.js +1 -0
  66. package/dist/gateway/static/root/assets/preview-open-alternatives--3aGeYJ5.js +1 -0
  67. package/dist/gateway/static/root/assets/product-open-page-B0ZxsnFO.js +1 -0
  68. package/dist/gateway/static/root/assets/product-preview-content-CheSHKJq.js +1 -0
  69. package/dist/gateway/static/root/assets/project-detail-page-Bm7bVHVo.js +1 -0
  70. package/dist/gateway/static/root/assets/projects-page-DPA6QL_Z.js +1 -0
  71. package/dist/gateway/static/root/assets/{registry-api-DLHHYP_v.js → registry-api-BO2Ck3aA.js} +1 -1
  72. package/dist/gateway/static/root/assets/remote-access-hub-Pxf4EiKh.js +1 -0
  73. package/dist/gateway/static/root/assets/{runtime-tools-api-Dq_50s27.js → runtime-tools-api-B1sb8nlw.js} +1 -1
  74. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-2BnqCeNt.js +1 -0
  75. package/dist/gateway/static/root/assets/schema-form-KmnpEBtP.js +1 -0
  76. package/dist/gateway/static/root/assets/{session-api-Br11ih_M.js → session-api-CaAUJvu1.js} +1 -1
  77. package/dist/gateway/static/root/assets/session-manager-DoFTlgNz.js +16 -0
  78. package/dist/gateway/static/root/assets/sessions-page-d0anT7iK.js +1 -0
  79. package/dist/gateway/static/root/assets/settings-advanced-gate-DfDaPyh5.js +1 -0
  80. package/dist/gateway/static/root/assets/settings-form-section-Db5XOKMH.js +1 -0
  81. package/dist/gateway/static/root/assets/{settings-page-4odCW0_2.js → settings-page-aRM6ax6B.js} +1 -1
  82. package/dist/gateway/static/root/assets/setup-status-panel-DCNAcalA.js +1 -0
  83. package/dist/gateway/static/root/assets/share-preview-page-DR3Esqa_.js +2 -0
  84. package/dist/gateway/static/root/assets/shares-settings-CvEwnQch.js +1 -0
  85. package/dist/gateway/static/root/assets/skill-api-BJBU8YgD.js +1 -0
  86. package/dist/gateway/static/root/assets/skill-reload-api-DEQ1bdN9.js +1 -0
  87. package/dist/gateway/static/root/assets/skills-page-BXNFSIIy.js +2 -0
  88. package/dist/gateway/static/root/assets/sliding-indicator-hwz0sx3h.js +1 -0
  89. package/dist/gateway/static/root/assets/style-Df_wL13k.js +7 -0
  90. package/dist/gateway/static/root/assets/system-settings-panel-DWnyafB7.js +1 -0
  91. package/dist/gateway/static/root/assets/tab-completion-input-CxtEp0aP.js +1 -0
  92. package/dist/gateway/static/root/assets/task-detail-page-DyHDW8A5.js +2 -0
  93. package/dist/gateway/static/root/assets/{task-expandable-content-CmQt5uxa.js → task-expandable-content-DTEVoNrM.js} +1 -1
  94. package/dist/gateway/static/root/assets/tracing-settings-page-vvREqbQ3.js +1 -0
  95. package/dist/gateway/static/root/assets/tunnel-api-BEzsymVO.js +1 -0
  96. package/dist/gateway/static/root/assets/usage-page-ByYOqsHo.js +1 -0
  97. package/dist/gateway/static/root/assets/use-autosave-Cp4kZ3E-.js +1 -0
  98. package/dist/gateway/static/root/assets/user-model-page-D0qeCXwD.js +2 -0
  99. package/dist/gateway/static/root/assets/voice-api-key-field-DH3OdR-w.js +1 -0
  100. package/dist/gateway/static/root/assets/{voice-config-api-CmDtDA4g.js → voice-config-api-D0Wscn9W.js} +1 -1
  101. package/dist/gateway/static/root/assets/work-discovery-overlay-CICdfBBR.js +1 -0
  102. package/dist/gateway/static/root/assets/workflow-run-setup-panel-VIJQCUY5.js +3 -0
  103. package/dist/gateway/static/root/assets/workflows-page-DDYp2Jbo.js +6 -0
  104. package/dist/gateway/static/root/assets/xopc-cloud-account-card-BTMfgVTk.js +1 -0
  105. package/dist/gateway/static/root/index.html +20 -69
  106. package/dist/package.js +1 -1
  107. package/dist/src/agent/agent-instance-gateway.d.ts +2 -0
  108. package/dist/src/agent/agent-manager.d.ts +1 -1
  109. package/dist/src/agent/agent-manager.js +19 -28
  110. package/dist/src/agent/background-review/run-background-review.js +6 -6
  111. package/dist/src/agent/child-agent-factory.d.ts +2 -1
  112. package/dist/src/agent/child-agent-factory.js +2 -1
  113. package/dist/src/agent/coding/projectEvidence.d.ts +9 -0
  114. package/dist/src/agent/coding/projectEvidence.js +177 -0
  115. package/dist/src/agent/coding/repository-instructions.d.ts +8 -1
  116. package/dist/src/agent/coding/repository-instructions.js +9 -4
  117. package/dist/src/agent/coding/run-verification.d.ts +17 -2
  118. package/dist/src/agent/coding/run-verification.js +82 -12
  119. package/dist/src/agent/context/execution-context.js +3 -3
  120. package/dist/src/agent/context/project-context.js +3 -3
  121. package/dist/src/agent/embedded/agent-profile-context.js +10 -4
  122. package/dist/src/agent/embedded/codemode-extension.js +1 -1
  123. package/dist/src/agent/embedded/execution-context.d.ts +1 -0
  124. package/dist/src/agent/embedded/execution-context.js +4 -1
  125. package/dist/src/agent/embedded/execution-tool-policy.js +1 -1
  126. package/dist/src/agent/embedded/external-tool-discovery.js +1 -1
  127. package/dist/src/agent/embedded/run-for-session.js +3 -2
  128. package/dist/src/agent/embedded/run-turn.js +42 -6
  129. package/dist/src/agent/embedded/session-runner.js +1 -1
  130. package/dist/src/agent/embedded/session-tool-result-guard.js +5 -0
  131. package/dist/src/agent/embedded/types.d.ts +2 -0
  132. package/dist/src/agent/embedded/xopc-tools-bridge.js +2 -1
  133. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  134. package/dist/src/agent/external-tools/composio-provider.js +3 -3
  135. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  136. package/dist/src/agent/external-tools/extension-provider.js +1 -1
  137. package/dist/src/agent/external-tools/gateway-tools.js +1 -1
  138. package/dist/src/agent/external-tools/memory-provider.js +1 -1
  139. package/dist/src/agent/inbound/attachment-pipeline.js +3 -3
  140. package/dist/src/agent/independent-execution.d.ts +2 -0
  141. package/dist/src/agent/independent-execution.js +12 -0
  142. package/dist/src/agent/memory/compaction.js +1 -1
  143. package/dist/src/agent/orchestration/delegation-scope.d.ts +1 -0
  144. package/dist/src/agent/orchestration/delegation-scope.js +4 -1
  145. package/dist/src/agent/orchestration/loop-guard.js +6 -2
  146. package/dist/src/agent/prompt/response-language.js +1 -1
  147. package/dist/src/agent/prompt/sections/agent-identity.js +4 -6
  148. package/dist/src/agent/prompt/sections/behavior.d.ts +3 -2
  149. package/dist/src/agent/prompt/sections/behavior.js +34 -27
  150. package/dist/src/agent/prompt/sections/memory-skills.d.ts +1 -1
  151. package/dist/src/agent/prompt/sections/memory-skills.js +10 -11
  152. package/dist/src/agent/prompt/sections/messaging-runtime.d.ts +3 -2
  153. package/dist/src/agent/prompt/sections/messaging-runtime.js +21 -24
  154. package/dist/src/agent/prompt/sections/response-language.js +7 -6
  155. package/dist/src/agent/prompt/sections/tooling.js +11 -10
  156. package/dist/src/agent/prompt/service-prompt-builder.js +4 -2
  157. package/dist/src/agent/prompt/system-prompt-params.d.ts +2 -1
  158. package/dist/src/agent/prompt/system-prompt-params.js +2 -0
  159. package/dist/src/agent/prompt/system-prompt.d.ts +2 -1
  160. package/dist/src/agent/prompt/system-prompt.js +21 -18
  161. package/dist/src/agent/prompt/types.d.ts +2 -0
  162. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  163. package/dist/src/agent/service/process-direct-streaming.js +2 -2
  164. package/dist/src/agent/service.js +12 -11
  165. package/dist/src/agent/session/session-config-service.js +2 -2
  166. package/dist/src/agent/session/session-inspector.js +1 -1
  167. package/dist/src/agent/skills/filesystem-watcher.js +1 -1
  168. package/dist/src/agent/skills/format-skills-prompt.js +5 -2
  169. package/dist/src/agent/skills/hub-pull.js +2 -2
  170. package/dist/src/agent/skills/index.js +1 -1
  171. package/dist/src/agent/skills/managed-store.js +1 -1
  172. package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
  173. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
  174. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  175. package/dist/src/agent/tasks/task-judge-service.js +6 -6
  176. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  177. package/dist/src/agent/tool-manuals/xopc-use.js +5 -0
  178. package/dist/src/agent/tools/dataBatch.d.ts +1 -0
  179. package/dist/src/agent/tools/dataBatch.js +4 -1
  180. package/dist/src/agent/tools/delegate-tool.d.ts +1 -0
  181. package/dist/src/agent/tools/delegate-tool.js +1 -0
  182. package/dist/src/agent/tools/error-tracker.js +4 -2
  183. package/dist/src/agent/tools/exec-command.d.ts +2 -0
  184. package/dist/src/agent/tools/exec-command.js +48 -3
  185. package/dist/src/agent/tools/factory.d.ts +1 -0
  186. package/dist/src/agent/tools/factory.js +23 -24
  187. package/dist/src/agent/tools/{delegation-parent-policy.d.ts → noninteractive-tool-policy.d.ts} +1 -1
  188. package/dist/src/agent/tools/{delegation-parent-policy.js → noninteractive-tool-policy.js} +4 -4
  189. package/dist/src/agent/tools/personal-attention-tool.js +1 -1
  190. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  191. package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
  192. package/dist/src/agent/tools/personal-request-tool.js +2 -2
  193. package/dist/src/agent/tools/personal-task-tool.js +6 -6
  194. package/dist/src/agent/tools/publish-artifacts.js +2 -2
  195. package/dist/src/agent/tools/review-workspace.js +1 -1
  196. package/dist/src/agent/tools/search/cache.d.ts +3 -1
  197. package/dist/src/agent/tools/search/cache.js +4 -1
  198. package/dist/src/agent/tools/search/providers/deepseek-protocol.d.ts +9 -0
  199. package/dist/src/agent/tools/search/providers/deepseek-protocol.js +84 -0
  200. package/dist/src/agent/tools/search/providers/deepseek.d.ts +9 -0
  201. package/dist/src/agent/tools/search/providers/deepseek.js +55 -0
  202. package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +2 -1
  203. package/dist/src/agent/tools/search/providers/xopc-cloud.js +36 -1
  204. package/dist/src/agent/tools/search/registry.d.ts +1 -0
  205. package/dist/src/agent/tools/search/registry.js +32 -6
  206. package/dist/src/agent/tools/search/request-gate.d.ts +13 -0
  207. package/dist/src/agent/tools/search/request-gate.js +41 -0
  208. package/dist/src/agent/tools/search/resolve-config.js +1 -1
  209. package/dist/src/agent/tools/search/search-info.d.ts +8 -0
  210. package/dist/src/agent/tools/search/search-info.js +34 -0
  211. package/dist/src/agent/tools/search/types.d.ts +19 -1
  212. package/dist/src/agent/tools/skills-tools.js +1 -1
  213. package/dist/src/agent/tools/task-collaboration-tool.js +3 -3
  214. package/dist/src/agent/tools/toolExposure.d.ts +3 -0
  215. package/dist/src/agent/tools/toolExposure.js +25 -0
  216. package/dist/src/agent/tools/web.js +8 -1
  217. package/dist/src/agent/tools/write.js +1 -1
  218. package/dist/src/agent/tools/xopc-use-tool.js +11 -7
  219. package/dist/src/agent/workflow/subagent-runner.d.ts +1 -0
  220. package/dist/src/agent/workflow/subagent-runner.js +3 -3
  221. package/dist/src/agent/workflow/workflow-child-tools.js +13 -8
  222. package/dist/src/agent/workspace-runtime/registry.js +1 -1
  223. package/dist/src/agent-catalog/capabilities.js +2 -2
  224. package/dist/src/agent-matching/delegation-service.js +1 -1
  225. package/dist/src/ai-assist/text-assist.js +1 -1
  226. package/dist/src/auth/oauth/xopc-cloud.js +2 -2
  227. package/dist/src/auth/sync-provider-auth.js +1 -1
  228. package/dist/src/automations/capabilities/drafts.js +1 -1
  229. package/dist/src/automations/domain/index.js +1 -1
  230. package/dist/src/automations/draft/automation-draft-service.js +1 -1
  231. package/dist/src/automations/index.js +2 -2
  232. package/dist/src/automations/service/action-executor.js +2 -2
  233. package/dist/src/bootstrap/application-state.js +1 -1
  234. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  235. package/dist/src/capabilities/runtime/product.js +1 -1
  236. package/dist/src/capabilities/store-connector.js +2 -2
  237. package/dist/src/channels/index.js +1 -1
  238. package/dist/src/channels/manager.js +1 -1
  239. package/dist/src/chat-commands/agent-edit.js +1 -1
  240. package/dist/src/chat-commands/builtins/config.js +1 -1
  241. package/dist/src/chat-commands/context.js +1 -1
  242. package/dist/src/cli/command-manifest.js +1 -1
  243. package/dist/src/cli/commands/agent.js +1 -1
  244. package/dist/src/cli/commands/agents.js +1 -1
  245. package/dist/src/cli/commands/channels.js +1 -1
  246. package/dist/src/cli/commands/connectors.js +1 -1
  247. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  248. package/dist/src/cli/commands/models.js +2 -2
  249. package/dist/src/cli/commands/onboard/model.js +2 -2
  250. package/dist/src/cli/commands/onboard.js +1 -1
  251. package/dist/src/cli/commands/search.d.ts +2 -2
  252. package/dist/src/cli/commands/search.js +8 -6
  253. package/dist/src/cli/commands/skills.js +1 -1
  254. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  255. package/dist/src/computer/flows.js +1 -1
  256. package/dist/src/computer/model-adapter.d.ts +3 -0
  257. package/dist/src/computer/model-adapter.js +120 -3
  258. package/dist/src/computer/model-policy.d.ts +1 -1
  259. package/dist/src/computer/model-policy.js +13 -6
  260. package/dist/src/computer/runtime.js +1 -0
  261. package/dist/src/config/agent-model-intents.js +1 -1
  262. package/dist/src/config/agent-profile.js +2 -2
  263. package/dist/src/config/index.js +1 -1
  264. package/dist/src/config/loader.js +1 -1
  265. package/dist/src/config/models-json.d.ts +30 -24
  266. package/dist/src/config/models-json.js +3 -1
  267. package/dist/src/config/outbound-proxy.d.ts +11 -0
  268. package/dist/src/config/outbound-proxy.js +30 -0
  269. package/dist/src/config/rules.js +5 -0
  270. package/dist/src/config/schema.d.ts +29 -6
  271. package/dist/src/config/schema.js +25 -8
  272. package/dist/src/connectors/composio-sessions.js +1 -1
  273. package/dist/src/connectors/composio.js +1 -1
  274. package/dist/src/connectors/connected-source-ingestion.js +1 -1
  275. package/dist/src/connectors/connected-source-understanding.js +2 -2
  276. package/dist/src/connectors/health.js +1 -1
  277. package/dist/src/extensions/agent-plugins/auth.js +1 -1
  278. package/dist/src/extensions/agent-plugins/credentials.js +1 -1
  279. package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
  280. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  281. package/dist/src/extensions/api.js +1 -1
  282. package/dist/src/extensions/install.js +1 -1
  283. package/dist/src/extensions/sdk/index.js +1 -1
  284. package/dist/src/extensions/update.js +1 -1
  285. package/dist/src/gateway/agents-admin.js +2 -2
  286. package/dist/src/gateway/config-tools-web.js +15 -4
  287. package/dist/src/gateway/file-path-classifier.js +1 -1
  288. package/dist/src/gateway/gateway-workflow-host.types.d.ts +3 -0
  289. package/dist/src/gateway/hono/lib/config-payload.d.ts +5 -0
  290. package/dist/src/gateway/hono/lib/config-payload.js +6 -1
  291. package/dist/src/gateway/hono/routes/commands-skills.js +3 -3
  292. package/dist/src/gateway/hono/routes/config-patch/gateway.js +7 -0
  293. package/dist/src/gateway/hono/routes/config-patch/misc.js +5 -5
  294. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  295. package/dist/src/gateway/hono/routes/context-sources.js +2 -2
  296. package/dist/src/gateway/hono/routes/memory-learning.js +2 -2
  297. package/dist/src/gateway/hono/routes/models.js +7 -4
  298. package/dist/src/gateway/hono/routes/notes.js +2 -2
  299. package/dist/src/gateway/hono/routes/projects.js +4 -4
  300. package/dist/src/gateway/hono/routes/runtime-tools.js +1 -1
  301. package/dist/src/gateway/hono/routes/session-input-handler.js +2 -2
  302. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  303. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  304. package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
  305. package/dist/src/gateway/hono/routes/user-model.js +6 -6
  306. package/dist/src/gateway/hono/routes/voice.js +1 -1
  307. package/dist/src/gateway/image-generation-setup.js +1 -1
  308. package/dist/src/gateway/lock.js +1 -1
  309. package/dist/src/gateway/media-access.js +1 -1
  310. package/dist/src/gateway/service/agent-runner.js +3 -3
  311. package/dist/src/gateway/service/config-coordinator.d.ts +8 -3
  312. package/dist/src/gateway/service/marketplace-service.js +2 -2
  313. package/dist/src/gateway/service/run-gateway-agent.js +1 -1
  314. package/dist/src/gateway/service/session-command-service.js +2 -2
  315. package/dist/src/gateway/service.js +33 -31
  316. package/dist/src/gateway/session-context-summary.js +4 -4
  317. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  318. package/dist/src/home-intelligence/generator.js +2 -2
  319. package/dist/src/home-intelligence/host.js +2 -2
  320. package/dist/src/imports/compatibility.js +1 -1
  321. package/dist/src/imports/inventory.js +3 -3
  322. package/dist/src/imports/productImport.js +2 -2
  323. package/dist/src/imports/runtime.js +1 -1
  324. package/dist/src/infra/http-proxy-env.d.ts +3 -0
  325. package/dist/src/infra/http-proxy-env.js +22 -2
  326. package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
  327. package/dist/src/knowledge-memory/repository.js +1 -1
  328. package/dist/src/local-apps/service.js +3 -3
  329. package/dist/src/memory-learning/source-learning.js +2 -2
  330. package/dist/src/notes/index.js +1 -1
  331. package/dist/src/notes/service.js +3 -3
  332. package/dist/src/personal-agent/capability-service.js +2 -2
  333. package/dist/src/personal-agent/communication.d.ts +2 -1
  334. package/dist/src/personal-agent/communication.js +11 -2
  335. package/dist/src/personal-agent/persona.d.ts +2 -1
  336. package/dist/src/personal-agent/persona.js +3 -2
  337. package/dist/src/personal-agent/proactivity/routes.js +1 -1
  338. package/dist/src/personal-agent/proactivity/service.js +5 -5
  339. package/dist/src/personal-agent/prompt-context.js +7 -7
  340. package/dist/src/personal-agent/prompts.d.ts +2 -0
  341. package/dist/src/personal-agent/prompts.js +69 -7
  342. package/dist/src/personal-agent/reply-composer.js +8 -8
  343. package/dist/src/personal-agent/reply-style.d.ts +4 -2
  344. package/dist/src/personal-agent/reply-style.js +19 -3
  345. package/dist/src/personal-agent/request-delivery.js +2 -2
  346. package/dist/src/personal-agent/request-service.js +19 -14
  347. package/dist/src/personal-agent/result-reader.js +1 -1
  348. package/dist/src/personal-agent/service.js +3 -3
  349. package/dist/src/personal-agent/task-cancel.js +1 -1
  350. package/dist/src/pets/loopi-artwork.d.ts +2 -0
  351. package/dist/src/pets/loopi-artwork.js +36 -0
  352. package/dist/src/pets/pointer.d.ts +6 -0
  353. package/dist/src/pets/pointer.js +16 -0
  354. package/dist/src/platform/index.js +1 -1
  355. package/dist/src/project-trust/trust-store.d.ts +5 -0
  356. package/dist/src/project-trust/trust-store.js +7 -1
  357. package/dist/src/projects/index.js +1 -1
  358. package/dist/src/projects/project-agent-suggestion.js +1 -1
  359. package/dist/src/projects/project-service.js +1 -1
  360. package/dist/src/projects/project-skill-service.js +2 -2
  361. package/dist/src/projects/workspace.js +1 -1
  362. package/dist/src/providers/cloud-thinking.d.ts +3 -0
  363. package/dist/src/providers/cloud-thinking.js +13 -0
  364. package/dist/src/providers/index.js +3 -3
  365. package/dist/src/providers/model-catalog-persistence.js +1 -1
  366. package/dist/src/providers/model-registry.js +6 -1
  367. package/dist/src/providers/model-supplements.d.ts +0 -2
  368. package/dist/src/providers/model-supplements.js +2 -18
  369. package/dist/src/providers/register-runtime-providers.js +3 -0
  370. package/dist/src/providers/xopc-cloud-credit-budget.d.ts +1 -0
  371. package/dist/src/providers/xopc-cloud-credit-budget.js +4 -1
  372. package/dist/src/routing/agent-session-key.js +1 -1
  373. package/dist/src/routing/resolve-route.js +1 -1
  374. package/dist/src/routing/resolve-tui-session-key.js +1 -1
  375. package/dist/src/session/index.js +1 -1
  376. package/dist/src/session/init-session-turn.js +1 -1
  377. package/dist/src/session/resolve-session.js +1 -1
  378. package/dist/src/session/store.js +2 -2
  379. package/dist/src/share/hosted-session-share.js +2 -2
  380. package/dist/src/share/session-share-service.js +1 -1
  381. package/dist/src/tasks/capabilities/read.js +2 -2
  382. package/dist/src/tasks/capabilities/write.js +2 -2
  383. package/dist/src/tasks/home-query-service.js +1 -1
  384. package/dist/src/tasks/index.js +3 -3
  385. package/dist/src/tasks/task-allocation-service.js +56 -45
  386. package/dist/src/tasks/task-application-service.js +11 -7
  387. package/dist/src/tasks/task-collaboration-delivery.js +1 -1
  388. package/dist/src/tasks/task-context-assembler.js +2 -2
  389. package/dist/src/tasks/task-contract-planner.js +21 -6
  390. package/dist/src/tasks/task-handoff-service.js +2 -2
  391. package/dist/src/tasks/task-handoff.js +5 -5
  392. package/dist/src/tasks/task-language.d.ts +2 -0
  393. package/dist/src/tasks/task-language.js +13 -2
  394. package/dist/src/tasks/task-main-update-decision-service.js +3 -3
  395. package/dist/src/tasks/task-model-call.js +1 -1
  396. package/dist/src/tasks/task-research-result.js +4 -4
  397. package/dist/src/tasks/task-result-delivery-repository.js +1 -1
  398. package/dist/src/tasks/task-result-delivery-service.js +2 -2
  399. package/dist/src/tasks/task-run-coordinator.js +9 -5
  400. package/dist/src/tasks/task-run-dispatcher.js +3 -2
  401. package/dist/src/tui/backends/embedded-backend.js +7 -7
  402. package/dist/src/tui/tui-commands.js +2 -2
  403. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  404. package/dist/src/tui/tui-startup-resources.js +3 -3
  405. package/dist/src/tui/tui.js +2 -2
  406. package/dist/src/user-context/access-policy.js +2 -2
  407. package/dist/src/user-model/bootstrap.js +1 -1
  408. package/dist/src/user-model/capture/executor.js +1 -1
  409. package/dist/src/user-model/index.js +2 -2
  410. package/dist/src/voice/realtime/memory-context.js +5 -5
  411. package/dist/src/voice/realtime/persona-context.js +1 -1
  412. package/dist/src/voice/realtime/runtime.js +1 -1
  413. package/dist/src/work-discovery/incremental-repository.js +1 -1
  414. package/dist/src/work-discovery/service.js +7 -7
  415. package/dist/src/workflows/context/workflow-context.js +1 -1
  416. package/dist/src/workflows/service/workflow-run-service.js +7 -8
  417. package/package.json +7 -3
  418. package/dist/gateway/static/root/assets/activity-YogQEteU.js +0 -1
  419. package/dist/gateway/static/root/assets/activity-store-DtTSRUyF.js +0 -1
  420. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-0GXoU7WL.js +0 -1
  421. package/dist/gateway/static/root/assets/agent-plugin-dialog-BxDqL7uc.js +0 -1
  422. package/dist/gateway/static/root/assets/agents-CYmRcXr-.js +0 -77
  423. package/dist/gateway/static/root/assets/app-chrome-BeB4KgOf.js +0 -1
  424. package/dist/gateway/static/root/assets/app-management-settings-panel-FhWeowCY.js +0 -1
  425. package/dist/gateway/static/root/assets/appearance-settings-DXin262V.js +0 -1
  426. package/dist/gateway/static/root/assets/apps-page-2M_l4Naz.js +0 -1
  427. package/dist/gateway/static/root/assets/automations-workspace-CVIWgoTx.js +0 -6
  428. package/dist/gateway/static/root/assets/browser-automation-inputs-uVEhZWHz.js +0 -1
  429. package/dist/gateway/static/root/assets/browser-automations-page-CEFnpvTO.js +0 -3
  430. package/dist/gateway/static/root/assets/browser-settings-page-sQpJic5b.js +0 -3
  431. package/dist/gateway/static/root/assets/button-aIC072nz.js +0 -1
  432. package/dist/gateway/static/root/assets/capabilities-BSB93QBR.js +0 -1
  433. package/dist/gateway/static/root/assets/capabilities-page-BKkN4sTh.js +0 -2
  434. package/dist/gateway/static/root/assets/capabilities-settings-panel-DCZTR8Hu.js +0 -8
  435. package/dist/gateway/static/root/assets/capability-header-actions-D0HwmxyW.js +0 -1
  436. package/dist/gateway/static/root/assets/channels-DRraXYSd.js +0 -1
  437. package/dist/gateway/static/root/assets/chat-terminal-dock-DpM489kK.js +0 -36
  438. package/dist/gateway/static/root/assets/chevron-left-DqFhpbvK.js +0 -1
  439. package/dist/gateway/static/root/assets/chevron-right-BweFrslA.js +0 -1
  440. package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +0 -1
  441. package/dist/gateway/static/root/assets/circle-dashed-8qMD7gHf.js +0 -1
  442. package/dist/gateway/static/root/assets/circle-dot-BAseJTrF.js +0 -1
  443. package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +0 -1
  444. package/dist/gateway/static/root/assets/computer-settings-page-D0ir9aA1.js +0 -1
  445. package/dist/gateway/static/root/assets/connector-service-page-Y5SYaiJO.js +0 -1
  446. package/dist/gateway/static/root/assets/connectors-page-DRSbj4gn.js +0 -1
  447. package/dist/gateway/static/root/assets/copy-text-row-C7egVuKr.js +0 -1
  448. package/dist/gateway/static/root/assets/date-formatters-CUZAyDEg.js +0 -1
  449. package/dist/gateway/static/root/assets/date-picker-DyUP-8hR.js +0 -1
  450. package/dist/gateway/static/root/assets/dependency-picker-QF9qLWIG.js +0 -1
  451. package/dist/gateway/static/root/assets/desktop-pet-Qfns4SO-.js +0 -1
  452. package/dist/gateway/static/root/assets/desktop-pet-settings-CuITd-Xa.js +0 -1
  453. package/dist/gateway/static/root/assets/desktop-pet-sprite-BP6iMVw1.js +0 -1
  454. package/dist/gateway/static/root/assets/device-pairing-wizard-C8RPqM_F.js +0 -1
  455. package/dist/gateway/static/root/assets/directory-picker-path-field-DnD9eyoU.js +0 -1
  456. package/dist/gateway/static/root/assets/dist-C3DSFZCi.js +0 -1
  457. package/dist/gateway/static/root/assets/electron-env-Dit0bHgy.js +0 -1
  458. package/dist/gateway/static/root/assets/extension-debug-page-B5ikNsSj.js +0 -1
  459. package/dist/gateway/static/root/assets/extension-page-D-PBMAtT.js +0 -1
  460. package/dist/gateway/static/root/assets/extension-provider-CdlACvkE.js +0 -1
  461. package/dist/gateway/static/root/assets/extension-settings-page-BPUYMNb0.js +0 -1
  462. package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +0 -1
  463. package/dist/gateway/static/root/assets/gateway-realtime-store-uEdmIROn.js +0 -1
  464. package/dist/gateway/static/root/assets/gateway-settings-BKj4PQs4.js +0 -1
  465. package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +0 -1
  466. package/dist/gateway/static/root/assets/home-page-D1ZBF3me.js +0 -2
  467. package/dist/gateway/static/root/assets/image-generation-api-BB3D6OV1.js +0 -1
  468. package/dist/gateway/static/root/assets/imports-page-BCcWIxOO.js +0 -1
  469. package/dist/gateway/static/root/assets/index-Bo70AuAq.js +0 -260
  470. package/dist/gateway/static/root/assets/index-BxoR4_xr.css +0 -1
  471. package/dist/gateway/static/root/assets/index.module-Cd9ENXfk.js +0 -1
  472. package/dist/gateway/static/root/assets/interaction-BdhHBbYa.js +0 -1
  473. package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +0 -1
  474. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-Bc9UWPqr.js +0 -1
  475. package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +0 -1
  476. package/dist/gateway/static/root/assets/local-app-workbench-page-jnK1j04U.js +0 -1
  477. package/dist/gateway/static/root/assets/local-apps-page-DpN8UN_Y.js +0 -1
  478. package/dist/gateway/static/root/assets/logs-page-DBR5mfxw.js +0 -2
  479. package/dist/gateway/static/root/assets/loopi-C09I2mNj.css +0 -1
  480. package/dist/gateway/static/root/assets/loopi-Djb8XU3l.js +0 -1
  481. package/dist/gateway/static/root/assets/management-settings-rs2cdb5f.js +0 -1
  482. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-Bl4kOOZT.js +0 -1
  483. package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +0 -1
  484. package/dist/gateway/static/root/assets/messages-B7VtMXec.js +0 -3
  485. package/dist/gateway/static/root/assets/mic-CuUb7zc-.js +0 -1
  486. package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +0 -1
  487. package/dist/gateway/static/root/assets/models-hub-cache-D0vR7vex.js +0 -1
  488. package/dist/gateway/static/root/assets/note-detail-panel-B7R-cZWE.js +0 -5
  489. package/dist/gateway/static/root/assets/notes-api-DZkezSIy.js +0 -2
  490. package/dist/gateway/static/root/assets/notes-page-DY9MNatd.js +0 -8
  491. package/dist/gateway/static/root/assets/page-context-capture-button-C-X8J1IO.js +0 -1
  492. package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +0 -1
  493. package/dist/gateway/static/root/assets/personal-page-CIZWUoUh.js +0 -1
  494. package/dist/gateway/static/root/assets/popover-select-DGKUpVsz.js +0 -1
  495. package/dist/gateway/static/root/assets/preview-open-alternatives-BJU2fmPn.js +0 -1
  496. package/dist/gateway/static/root/assets/product-open-page-CYV_8zRl.js +0 -1
  497. package/dist/gateway/static/root/assets/product-preview-content-DfQ9h_YX.js +0 -1
  498. package/dist/gateway/static/root/assets/project-detail-page-B_fYXcAW.js +0 -1
  499. package/dist/gateway/static/root/assets/projects-page-CHdeAtpp.js +0 -1
  500. package/dist/gateway/static/root/assets/remote-access-hub-CbJWGHW_.js +0 -1
  501. package/dist/gateway/static/root/assets/rotate-ccw-JM1TBLpp.js +0 -1
  502. package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +0 -1
  503. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-jqYXsCuk.js +0 -1
  504. package/dist/gateway/static/root/assets/schema-form-DNXZLVqh.js +0 -1
  505. package/dist/gateway/static/root/assets/search-DA7gz22f.js +0 -1
  506. package/dist/gateway/static/root/assets/secret-input-BxWHx6J6.js +0 -1
  507. package/dist/gateway/static/root/assets/send-session-input-NpLYu1ip.js +0 -1
  508. package/dist/gateway/static/root/assets/session-manager-Bb9pevyM.js +0 -16
  509. package/dist/gateway/static/root/assets/sessions-page-DrGCnBhV.js +0 -1
  510. package/dist/gateway/static/root/assets/settings-2-D-csvaET.js +0 -1
  511. package/dist/gateway/static/root/assets/settings-advanced-gate-B61Eh7eB.js +0 -1
  512. package/dist/gateway/static/root/assets/settings-form-draft-Dy10ldo8.js +0 -1
  513. package/dist/gateway/static/root/assets/settings-form-section-num14vSv.js +0 -1
  514. package/dist/gateway/static/root/assets/settings-shell-dialog-layer-BU3UuiJr.js +0 -1
  515. package/dist/gateway/static/root/assets/setup-status-panel-DaU9o0Ll.js +0 -1
  516. package/dist/gateway/static/root/assets/share-link-dialog-BhjQPZbF.js +0 -1
  517. package/dist/gateway/static/root/assets/share-preview-page-LERhIwgz.js +0 -2
  518. package/dist/gateway/static/root/assets/shares-api-CgsiMdCX.js +0 -1
  519. package/dist/gateway/static/root/assets/shares-settings-DmvyqIyT.js +0 -1
  520. package/dist/gateway/static/root/assets/skeleton-BI5TyibZ.js +0 -1
  521. package/dist/gateway/static/root/assets/skill-api-plToSoFo.js +0 -1
  522. package/dist/gateway/static/root/assets/skill-api-utils-C7V4JVXM.js +0 -1
  523. package/dist/gateway/static/root/assets/skill-reload-api-BFw81Ar6.js +0 -1
  524. package/dist/gateway/static/root/assets/skill-wire-pattern-BPpeIcCi.js +0 -1
  525. package/dist/gateway/static/root/assets/skills-page-BLUsxGOo.js +0 -2
  526. package/dist/gateway/static/root/assets/style-1FPsMO2E.js +0 -7
  527. package/dist/gateway/static/root/assets/system-settings-panel-DL3WXRnL.js +0 -1
  528. package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +0 -1
  529. package/dist/gateway/static/root/assets/task-detail-page-DWM5xGbe.js +0 -2
  530. package/dist/gateway/static/root/assets/theme-store-CPdeCbZI.js +0 -1
  531. package/dist/gateway/static/root/assets/tracing-settings-page-m51enJFx.js +0 -1
  532. package/dist/gateway/static/root/assets/tunnel-api-B5I53jzk.js +0 -1
  533. package/dist/gateway/static/root/assets/usage-page-B7qyfnMN.js +0 -1
  534. package/dist/gateway/static/root/assets/use-async-resource-GrnWNwMZ.js +0 -1
  535. package/dist/gateway/static/root/assets/use-autosave-C2__K1-y.js +0 -1
  536. package/dist/gateway/static/root/assets/use-composer-attachments-61W-5Q6m.js +0 -2
  537. package/dist/gateway/static/root/assets/use-file-preview-expanded-DZUWxdhm.js +0 -2
  538. package/dist/gateway/static/root/assets/user-model-page-DkIuYpuf.js +0 -2
  539. package/dist/gateway/static/root/assets/voice-api-key-field-DB--pFJX.js +0 -1
  540. package/dist/gateway/static/root/assets/voice-transcribe-api-Cp2uDvFO.js +0 -1
  541. package/dist/gateway/static/root/assets/work-discovery-overlay-Blwp7T-_.js +0 -1
  542. package/dist/gateway/static/root/assets/workflow-run-setup-panel-Czfs5XFH.js +0 -3
  543. package/dist/gateway/static/root/assets/workflows-page-RN_QXcGY.js +0 -6
  544. package/dist/gateway/static/root/assets/workspace-api-lHTRLje0.js +0 -2
  545. package/dist/gateway/static/root/assets/xopc-cloud-account-card-D31rz9OQ.js +0 -1
  546. package/dist/src/agent/bootstrap/project-agents-context.d.ts +0 -2
  547. package/dist/src/agent/bootstrap/project-agents-context.js +0 -30
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./plus-Q2yW6OE7.js";import{t as s}from"./messages-CaeL_miw.js";import{a as c,n as l,r as u}from"./locale-store-CE7L6MlS.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{r as f}from"./gateway-config-swr-BEePO3Wl.js";import{n as p,t as m}from"./registry-api-BO2Ck3aA.js";import{Au as h,Bl as g,Fn as _,In as v,Lc as y,Qi as b,Uc as x,Yl as S,bd as C,is as w,ju as T}from"./index-BvAvfZ5R.js";import{n as ee,r as te}from"./settings-page-layout-Dx5S-Msc.js";var E=n(),D=e(t(),1),O=r();function k({zh:e}){let t=s(e?`zh`:`en`).computerSettings,n=d(`settings-agent-defaults`,_),r=d(m,p),a=n.data?.defaults.models.computerUse?.primary??``,[o,c]=(0,D.useState)(a),[l,u]=(0,D.useState)(!1),[f,h]=(0,D.useState)(``),[g,S]=(0,D.useState)(!1);(0,D.useEffect)(()=>{c(a)},[a]);let C=!o||r.data?.some(e=>e.id===o&&e.computerUse),w=async()=>{u(!0),h(``),S(!1);try{if(!C)throw Error(t.modelUnavailable);let e=await _(),r={...e.defaults.models};o?r.computerUse={primary:o,fallbacks:[]}:delete r.computerUse;let i=await v({...e.defaults,models:r});await n.mutate(i,!1),S(!0)}catch(e){h(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,O.jsxs)(`section`,{"aria-label":t.model,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.model}),!n.data&&!n.error?(0,O.jsx)(y,{className:`h-52 w-full rounded-xl`}):n.error?(0,O.jsxs)(`div`,{role:`alert`,className:`text-sm text-danger`,children:[String(n.error),(0,O.jsx)(x,{onClick:()=>{n.mutate().catch(()=>{})},children:t.retry})]}):(0,O.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,O.jsx)(`div`,{className:`min-w-0 flex-1`,children:r.isLoading?(0,O.jsx)(y,{className:`h-11 w-full rounded-lg`}):(0,O.jsx)(b,{value:o,onChange:e=>{c(e),S(!1)},disabled:l,capabilitiesFilter:`computer-use`,models:r.data??[],modelsError:r.error,placeholder:t.selectModel,searchPlaceholder:t.searchModel,noMatches:t.noModels,registryEmptyHint:t.noModels,allowEmpty:!0,emptyLabel:t.noModel,ariaLabel:t.modelLabel,className:`w-full`,contentAlign:`start`})}),(0,O.jsx)(x,{variant:`primary`,disabled:l||o===a||!C||!!r.error||r.isLoading,onClick:()=>{w()},children:t.saveModel})]}),(0,O.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[(0,O.jsx)(`span`,{children:t.modelDataUse}),(0,O.jsx)(x,{asChild:!0,variant:`ghost`,className:`h-auto p-0 text-xs`,children:(0,O.jsx)(i,{to:`/settings/capabilities/models?add=1`,children:t.manageModels})}),g&&(0,O.jsx)(`span`,{role:`status`,children:t.modelSaved})]}),!C&&!r.isLoading&&!r.error&&(0,O.jsx)(`p`,{role:`status`,className:`mt-3 text-sm text-warning`,children:t.modelUnavailable}),r.error&&(0,O.jsxs)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:[String(r.error),(0,O.jsx)(x,{onClick:()=>{r.mutate().catch(()=>{})},children:t.retry})]}),f&&(0,O.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:f})]})]})}function A(e){let t=(0,E.c)(15),{icon:n,title:r,description:i,children:a}=e,o;t[0]===n?o=t[1]:(o=n&&(0,O.jsx)(`div`,{className:`flex size-6 shrink-0 items-center justify-center text-fg-muted`,"aria-hidden":!0,children:n}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,O.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=i&&(0,O.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===a?u=t[10]:(u=a&&(0,O.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:a}),t[9]=a,t[10]=u);let d;return t[11]!==o||t[12]!==l||t[13]!==u?(d=(0,O.jsxs)(`div`,{className:`flex min-h-16 flex-wrap items-center gap-3 px-4 py-3 sm:flex-nowrap sm:px-5`,children:[o,l,u]}),t[11]=o,t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function j(){let e=(0,E.c)(2),t=l(M)===`zh`,n;return e[0]===t?n=e[1]:(n=(0,O.jsx)(N,{zh:t}),e[0]=t,e[1]=n),n}function M(e){return e.language}function N({zh:e}){let t=s(e?`zh`:`en`).computerSettings,{data:n,mutate:r,error:l}=f(!0),d=n?.payload?.config,[p,m]=(0,D.useState)(!1),[_,v]=(0,D.useState)(``),[b,E]=(0,D.useState)(!1),[j,M]=(0,D.useState)(null),[N,P]=(0,D.useState)(!1),[F,I]=(0,D.useState)(null),[ne,L]=(0,D.useState)(!1),[R,z]=(0,D.useState)(``),[B,V]=(0,D.useState)(!1),[re,H]=(0,D.useState)(!1),U=window.electronAPI?.platform===`darwin`?window.electronAPI.computer:void 0,W=window.electronAPI?.platform===`darwin`?window.electronAPI.system:void 0;(0,D.useEffect)(()=>{if(!U)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await U.status();e||(M(t),P(!1))}catch{e||(M(null),P(!0))}finally{t=!1}}};n();let r=window.setInterval(()=>{n()},2e3);return()=>{e=!0,window.clearInterval(r)}},[U]),(0,D.useEffect)(()=>{if(!U?.access)return;let e=!1;return U.access().then(t=>{e||(I(t),L(!1))}).catch(()=>{e||L(!0)}),()=>{e=!0}},[U]);let G=async e=>{m(!0),v(``);try{await e()}catch(e){v(e instanceof Error?e.message:String(e))}finally{m(!1)}},ie=e=>G(async()=>{w()&&(await c(u(`/api/config`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({computer:{enabled:e}})}),await r())}),ae=async()=>{v(``),E(!1);try{await U?.stop(),E(!0),U&&M(await U.status())}catch(e){v(e instanceof Error?e.message:String(e))}},K=j?.session?.status??`idle`,q=t.states[K]??K,J=w()&&d?.computer?.enabled===!0,oe=j?.controlPaused?t.pausedNotice:J?j?.connected?`${t.connected} · ${q}`:j?t.disconnected:t.checking:t.disabled,Y=!U||N||j?.reenrollmentRequired===!0||!!(j?.error||j?.session?.errorCode)||j!=null&&(!j.permissions.accessibility||j.permissions.screenRecording!==`granted`),X=j?.permissions.accessibility===!0&&j.permissions.screenRecording===`granted`&&!j.reenrollmentRequired,Z=F?.apps.filter(e=>F.authorizedAppIds.includes(e.appId))??[],Q=F?.apps.filter(e=>!F.authorizedAppIds.includes(e.appId)&&`${e.name} ${e.appId}`.toLocaleLowerCase().includes(R.toLocaleLowerCase()))??[],$=(0,O.jsxs)(`section`,{"aria-labelledby":`computer-permissions-title`,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{id:`computer-permissions-title`,className:`text-sm font-semibold text-fg`,children:t.permissions}),U?N?(0,O.jsx)(`p`,{role:`alert`,className:`rounded-xl bg-danger-soft p-5 text-sm text-danger`,children:t.nativeError}):j?X&&!re?(0,O.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:(0,O.jsx)(A,{icon:(0,O.jsx)(S,{className:`size-5`}),title:t.systemPermissions,description:t.granted,children:(0,O.jsx)(x,{onClick:()=>H(!0),children:t.viewDetails})})}):(0,O.jsxs)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[(0,O.jsx)(A,{icon:(0,O.jsx)(T,{className:`size-5`}),title:t.device,description:(0,O.jsxs)(`span`,{"aria-live":`polite`,children:[j.connected?t.connected:t.disconnected,` · `,q]}),children:j.reenrollmentRequired&&(0,O.jsx)(x,{disabled:p,onClick:()=>{G(async()=>{M(await U.reenroll())})},children:t.reenroll})}),W&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(A,{icon:(0,O.jsx)(S,{className:`size-5`}),title:t.accessibility,children:[(0,O.jsx)(`span`,{className:`text-xs text-fg-muted`,children:j.permissions.accessibility?t.granted:t.notGranted}),!j.permissions.accessibility&&(0,O.jsx)(x,{disabled:p,"aria-label":`${t.openSettings}: ${t.accessibility}`,onClick:()=>{G(()=>W.requestAccessibility())},children:t.openSettings})]}),(0,O.jsxs)(A,{icon:(0,O.jsx)(T,{className:`size-5`}),title:t.screen,children:[(0,O.jsx)(`span`,{className:`text-xs text-fg-muted`,children:j.permissions.screenRecording===`granted`?t.granted:t.notGranted}),j.permissions.screenRecording!==`granted`&&(0,O.jsx)(x,{disabled:p,"aria-label":`${t.openSettings}: ${t.screen}`,onClick:()=>{G(()=>W.requestScreen())},children:t.openSettings})]})]}),X&&(0,O.jsx)(`div`,{className:`flex justify-end px-4 py-2 sm:px-5`,children:(0,O.jsx)(x,{variant:`ghost`,onClick:()=>H(!1),children:t.hideDetails})})]}):(0,O.jsx)(`div`,{"aria-label":t.checking,children:(0,O.jsx)(y,{className:`h-20 w-full rounded-xl`})}):(0,O.jsx)(`p`,{className:`rounded-xl bg-surface-hover/20 p-5 text-sm leading-relaxed text-fg-muted`,children:window.electronAPI&&window.electronAPI.platform!==`darwin`?t.unsupportedPlatform:t.desktopRequired}),(j?.error||j?.session?.errorCode)&&(0,O.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-red-600`,children:j.error||j.session?.errorCode})]});return(0,O.jsxs)(te,{gap:`gap-7`,children:[(0,O.jsx)(ee,{title:t.title,subtitle:t.subtitle,meta:(0,O.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:t.preview}),actions:U&&(0,O.jsxs)(x,{onClick:()=>{ae()},children:[(0,O.jsx)(g,{className:`size-3.5`}),t.stop]})}),_&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:_}),b&&(0,O.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:t.stoppedNotice}),(0,O.jsxs)(`section`,{"aria-labelledby":`computer-control-title`,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{id:`computer-control-title`,className:`text-sm font-semibold text-fg`,children:t.control}),!d&&!l?(0,O.jsx)(y,{className:`h-32 w-full rounded-xl`}):l?(0,O.jsxs)(`div`,{role:`alert`,className:`text-sm text-fg-muted`,children:[String(l),` `,(0,O.jsx)(x,{onClick:()=>{G(()=>r())},children:t.retry})]}):(0,O.jsxs)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[(0,O.jsx)(A,{icon:(0,O.jsx)(h,{className:`size-5`}),title:t.desktop,description:(0,O.jsx)(`span`,{"aria-live":`polite`,children:oe}),children:(0,O.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":t.desktop,"aria-checked":J,disabled:p||!w(),onClick:()=>{ie(d?.computer?.enabled!==!0)},className:`touch-target flex items-center rounded-lg px-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,O.jsx)(`span`,{className:`flex h-6 w-11 items-center rounded-full p-0.5 transition-colors ${J?`bg-accent`:`bg-fg-muted/30`}`,children:(0,O.jsx)(`span`,{className:`size-5 rounded-full bg-white transition-transform ${J?`translate-x-5`:`translate-x-0`}`})})})}),j?.controlPaused&&(0,O.jsx)(`div`,{className:`flex justify-end border-t border-edge-subtle px-4 py-3 sm:px-5`,children:(0,O.jsx)(x,{disabled:p,onClick:()=>{G(async()=>{U&&M(await U.resume()),E(!1)})},children:t.resume})})]})]}),Y&&$,U?.access&&(0,O.jsxs)(`section`,{"aria-labelledby":`computer-app-access-title`,className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,O.jsx)(`h2`,{id:`computer-app-access-title`,className:`text-sm font-semibold text-fg`,children:t.appAccess}),!F?.allowAllApps&&(0,O.jsxs)(x,{disabled:p,"aria-expanded":B,"aria-controls":B?`computer-app-picker`:void 0,onClick:()=>{V(e=>!e),z(``)},children:[B?(0,O.jsx)(a,{className:`size-4`,"aria-hidden":!0}):(0,O.jsx)(o,{className:`size-4`,"aria-hidden":!0}),B?t.doneAdding:t.addApp]})]}),F?(0,O.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[(0,O.jsx)(A,{icon:(0,O.jsx)(h,{className:`size-5`}),title:t.anyApp,description:t.anyAppDescription,children:(0,O.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":t.anyApp,"aria-checked":F.allowAllApps===!0,disabled:p,onClick:()=>{G(async()=>{I(await U.setAllAppAccess(!F.allowAllApps)),V(!1)})},className:`touch-target flex items-center rounded-lg px-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,O.jsx)(`span`,{className:`flex h-6 w-11 items-center rounded-full p-0.5 transition-colors ${F.allowAllApps?`bg-accent`:`bg-fg-muted/30`}`,children:(0,O.jsx)(`span`,{className:`size-5 rounded-full bg-white transition-transform ${F.allowAllApps?`translate-x-5`:`translate-x-0`}`})})})}),!F.allowAllApps&&(0,O.jsx)(`div`,{className:`border-t border-edge-subtle`,children:Z.length?Z.map(e=>(0,O.jsxs)(`div`,{className:`flex min-h-16 items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3 last:border-b-0 sm:px-5`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),(0,O.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:e.appId})]}),(0,O.jsx)(x,{disabled:p,variant:`ghost`,onClick:()=>{G(async()=>{let t=await U.setAppAccess(e.appId,!1);I(e=>e&&{...e,authorizedAppIds:t.authorizedAppIds})})},children:t.revokeApp})]},e.appId)):(0,O.jsx)(`p`,{className:`px-5 py-6 text-center text-sm text-fg-muted`,children:t.noAuthorizedApps})})]}):ne?(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t.appListError}):(0,O.jsx)(y,{className:`h-20 w-full rounded-xl`}),B&&!F?.allowAllApps&&(0,O.jsxs)(`div`,{id:`computer-app-picker`,className:`space-y-3 rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`input`,{"aria-label":t.searchApps,value:R,onChange:e=>z(e.target.value),placeholder:t.searchApps,className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,O.jsx)(x,{disabled:p,onClick:()=>{G(async()=>{I(await U.access()),L(!1)})},children:t.refreshApps})]}),F&&(0,O.jsx)(`div`,{className:`max-h-64 overflow-y-auto rounded-xl border border-edge`,children:Q.length?Q.map(e=>(0,O.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-3 border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),(0,O.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:e.appId})]}),(0,O.jsx)(x,{disabled:p,variant:`secondary`,onClick:()=>{G(async()=>{let t=await U.setAppAccess(e.appId,!0);I(e=>e&&{...e,authorizedAppIds:t.authorizedAppIds})})},children:t.authorizeApp})]},e.appId)):(0,O.jsx)(`p`,{className:`px-3 py-5 text-center text-sm text-fg-muted`,children:F.appsBusy?t.appsBusy:F.appsUnavailable?t.appListError:t.noMatchingApps})})]})]}),(0,O.jsx)(k,{zh:e}),!Y&&$,(0,O.jsxs)(`section`,{"aria-labelledby":`computer-browser-title`,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{id:`computer-browser-title`,className:`text-sm font-semibold text-fg`,children:t.otherControl}),(0,O.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:(0,O.jsx)(A,{icon:(0,O.jsx)(C,{className:`size-5`}),title:t.browser,description:d?d.browser?.enabled?t.browserEnabled:t.browserDisabled:t.checking,children:(0,O.jsx)(x,{asChild:!0,children:(0,O.jsx)(i,{to:`/settings/agent-browser`,children:t.manage})})})})]}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.previewFootnote})]})}export{j as ComputerSettingsPage,N as ComputerSettingsPanel};
@@ -0,0 +1 @@
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{t as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./x-B_N4OPjy.js";import{t as s}from"./messages-CaeL_miw.js";import{n as c}from"./locale-store-CE7L6MlS.js";import{a as l,c as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./dist-BGTk37IG.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{It as v,Lc as y,Ms as b,Sc as x,Uc as S,Xa as C,Zl as w,dc as T,ec as E,yc as D}from"./index-BvAvfZ5R.js";var O=t({ConnectorServiceDialog:()=>I,ConnectorServicePage:()=>M}),k=r(),A=e(n(),1),j=i();function M(){let e=(0,k.c)(11),t=c(N),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.connectorsSettings,i=t===`zh`,o;e[2]===r.title?o=e[3]:(o=(0,j.jsx)(a,{to:`/capabilities/connectors`,className:`text-sm text-accent-fg`,children:r.title}),e[2]=r.title,e[3]=o);let l=i?`应用连接服务`:`App connection service`,u;e[4]===l?u=e[5]:(u=(0,j.jsx)(`h1`,{className:`text-xl font-semibold`,children:l}),e[4]=l,e[5]=u);let d,f;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,j.jsx)(`p`,{className:`text-sm text-fg-muted`,children:(0,j.jsx)(P,{})}),f=(0,j.jsx)(R,{}),e[6]=d,e[7]=f):(d=e[6],f=e[7]);let p;return e[8]!==o||e[9]!==u?(p=(0,j.jsxs)(`main`,{className:`mx-auto w-full max-w-2xl space-y-6 p-6`,children:[o,u,d,f]}),e[8]=o,e[9]=u,e[10]=p):p=e[10],p}function N(e){return e.language}function P(){let e=(0,k.c)(2),t=c(F)===`zh`?`此设置决定新账号通过哪个服务连接。已有账号继续使用其原来的连接服务。`:`Choose the service for new accounts. Existing accounts keep their original service.`,n;return e[0]===t?n=e[1]:(n=(0,j.jsx)(j.Fragment,{children:t}),e[0]=t,e[1]=n),n}function F(e){return e.language}function I(e){let t=(0,k.c)(27),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{open:r,onOpenChange:i,hideTrigger:a}=n,_=a===void 0?!1:a,v=c(L),y;t[2]===v?y=t[3]:(y=s(v),t[2]=v,t[3]=y);let b=y.connectorsSettings,x=v===`zh`,C;t[4]!==_||t[5]!==x?(C=_?null:(0,j.jsx)(u,{asChild:!0,children:(0,j.jsxs)(S,{type:`button`,variant:`secondary`,className:`shrink-0`,"aria-label":x?`应用连接服务`:`Connection service`,children:[(0,j.jsx)(w,{className:`size-4`,"aria-hidden":!0}),(0,j.jsx)(`span`,{className:`hidden sm:inline`,children:x?`应用连接服务`:`Connection service`})]})}),t[4]=_,t[5]=x,t[6]=C):C=t[6];let T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,j.jsx)(l,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[7]=T):T=t[7];let E=x?`应用连接服务`:`App connection service`,D;t[8]===E?D=t[9]:(D=(0,j.jsx)(h,{className:`text-base font-semibold text-fg`,children:E}),t[8]=E,t[9]=D);let O;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,j.jsx)(d,{className:`mt-1 text-sm text-fg-muted`,children:(0,j.jsx)(P,{})}),t[10]=O):O=t[10];let A;t[11]===D?A=t[12]:(A=(0,j.jsxs)(`div`,{className:`min-w-0`,children:[D,O]}),t[11]=D,t[12]=A);let M;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,j.jsx)(o,{className:`size-5`,"aria-hidden":!0}),t[13]=M):M=t[13];let N;t[14]===b.modalClose?N=t[15]:(N=(0,j.jsx)(f,{asChild:!0,children:(0,j.jsx)(S,{variant:`ghost`,className:`shrink-0 p-1.5`,"aria-label":b.modalClose,children:M})}),t[14]=b.modalClose,t[15]=N);let F;t[16]!==N||t[17]!==A?(F=(0,j.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[A,N]}),t[16]=N,t[17]=A,t[18]=F):F=t[18];let I;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,j.jsx)(R,{})}),t[19]=I):I=t[19];let z;t[20]===F?z=t[21]:(z=(0,j.jsxs)(p,{children:[T,(0,j.jsxs)(m,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100dvh-2rem,42rem)] w-[min(100%-2rem,42rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-float`,children:[F,I]})]}),t[20]=F,t[21]=z);let B;return t[22]!==i||t[23]!==r||t[24]!==z||t[25]!==C?(B=(0,j.jsxs)(g,{open:r,onOpenChange:i,children:[C,z]}),t[22]=i,t[23]=r,t[24]=z,t[25]=C,t[26]=B):B=t[26],B}function L(e){return e.language}function R(){let e=c(e=>e.language),t=s(e).connectorsSettings,n=e===`zh`,{data:r,error:i,mutate:a}=_(`connector-service`,T),[o,l]=(0,A.useState)(``),[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(),[m,h]=(0,A.useState)();async function g(e){d(!0),p(void 0);try{await e(),l(``),await a()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,j.jsxs)(`div`,{className:`space-y-6`,children:[!r&&!i?(0,j.jsx)(y,{className:`h-40 w-full`}):null,r?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-edge p-4`,children:[(0,j.jsx)(`h2`,{className:`font-medium`,children:`XOPC Cloud`}),(0,j.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.composioSetupHint}),(0,j.jsx)(v,{providerId:`xopc-cloud`,displayName:`XOPC Cloud`,connected:r.mode===`managed`&&r.configured,onConnected:()=>{a()}}),(0,j.jsx)(S,{variant:`secondary`,disabled:u||r.mode===`managed`&&r.configured,onClick:()=>void g(()=>x({mode:`managed`})),children:r.mode===`managed`?n?`当前服务`:`Current service`:n?`使用 XOPC Cloud`:`Use XOPC Cloud`})]}),(0,j.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,j.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:t.composioSetupByok}),(0,j.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,j.jsxs)(`ol`,{className:`list-inside list-decimal text-sm text-fg-muted`,children:[(0,j.jsx)(`li`,{children:t.composioSetupStepProject}),(0,j.jsx)(`li`,{children:t.composioSetupStepKey}),(0,j.jsx)(`li`,{children:t.composioSetupStepPaste})]}),(0,j.jsx)(`a`,{href:`https://app.composio.dev`,target:`_blank`,rel:`noreferrer`,className:`text-sm text-accent-fg`,children:t.composioSetupOpenDashboard}),(0,j.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,j.jsx)(`span`,{children:`Composio API key`}),(0,j.jsx)(b,{value:o,onChange:l,labels:t.secretInputLabels,placeholder:t.composioSetupKeyPlaceholder})]}),(0,j.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.composioSetupStorageHint}),(0,j.jsx)(S,{disabled:u||!o.trim(),onClick:()=>void g(()=>E(o)),children:n?`验证并使用新项目`:`Verify and use new project`}),(0,j.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n?`验证只检查连接服务和现有账号访问,不执行写入。工具权限在实际使用时检查。环境变量密钥需在运行环境中修改。`:`Verification checks service and existing account access without writes. Tool permissions are checked on use. Environment keys must be updated in the gateway environment.`}),(0,j.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.composioSessionWritePermissionHint}),r.backends?.filter(e=>e.mode===`byok`).map(e=>(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 text-sm`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{children:e.label}),(0,j.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e.credentialSource===`environment`?n?`环境变量`:`Environment`:n?`本地保存`:`Stored locally`,e.verifiedAt&&` · ${new Date(e.verifiedAt).toLocaleString()}`]})]}),(0,j.jsx)(S,{variant:`ghost`,disabled:u||!o.trim()||e.credentialSource===`environment`,onClick:()=>void g(()=>E(o,e.id)),children:n?`用上方密钥更新`:`Update with key above`}),(0,j.jsx)(S,{variant:`ghost`,disabled:u||e.id===r.backendId,onClick:()=>void g(()=>x({backendId:e.id})),children:e.id===r.backendId?n?`当前服务`:`Current service`:n?`使用`:`Use`}),(0,j.jsx)(S,{variant:`ghost`,disabled:u||e.id===r.backendId,onClick:()=>h(e.id),children:n?`移除`:`Remove`})]},e.id))]})]})]}):null,f||i?(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:f??String(i)}):null,(0,j.jsx)(C,{open:!!m,title:n?`移除连接服务`:`Remove connection service`,description:n?`移除此服务及其本地保存的密钥,不修改环境变量。需要先切换服务并断开该项目的账号,已有数据不会删除。`:`Remove this service and its saved key, without changing environment variables. Switch services and disconnect this project’s accounts first. Existing data is retained.`,confirmLabel:n?`移除`:`Remove`,cancelLabel:t.modalCancel,destructive:!0,onCancel:()=>h(void 0),onConfirm:()=>{let e=m;h(void 0),e&&g(()=>D(e))}})]})}export{O as n,I as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./ellipsis-0k4rZLoy.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./eye-CABVeTq0.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./messages-CaeL_miw.js";import{t as p}from"./cn-0WouolD0.js";import{a as m,c as h,n as g,r as _}from"./locale-store-CE7L6MlS.js";import{a as v,i as y,n as b,o as x,r as S,s as C,t as w}from"./dist-BGTk37IG.js";import{n as T}from"./copy-to-clipboard-HOJ79TWv.js";import{n as E,r as D}from"./gateway-config-swr-BEePO3Wl.js";import{$ as O,$l as k,$n as A,Ac as j,Cc as M,Dc as N,Ec as P,Eu as F,Fc as I,Il as L,J as R,Jn as z,Lc as B,Ld as V,Ls as H,Mc as U,Nc as W,Oc as G,Pd as K,Q as q,Ro as ee,Tc as te,Uc as J,Uu as ne,Wo as re,X as ie,Xa as ae,Xn as oe,Y,Yd as se,Yn as ce,Z as X,Zl as Z,_c as le,ac as ue,af as de,as as fe,bc as pe,cc as me,cf as he,ds as ge,er as _e,et as ve,fc as ye,gc as be,hc as xe,ic as Se,ir as Ce,jc as we,kc as Te,kl as Ee,ko as De,lc as Oe,ls as ke,mc as Ae,nc as je,nr as Me,oc as Ne,od as Pe,of as Fe,ou as Ie,pc as Le,qd as Re,qn as ze,rc as Be,rs as Ve,ru as He,sc as Ue,tc as We,tr as Ge,uc as Ke,us as qe,vc as Je,vl as Ye,wc as Xe,xc as Ze}from"./index-BvAvfZ5R.js";import{n as Qe,t as $e}from"./capability-header-actions-AbVbg7kZ.js";import{t as et}from"./connector-service-page--gB9vL3C.js";import{n as tt}from"./agent-plugin-dialog-dWqozfQm.js";import{t as nt}from"./number-input-DDeqHK-G.js";var Q=e(t(),1),rt=n(),$=r();function it(e){let t=(0,rt.c)(57),{connector:n,installed:r,onInstall:i,onOpenDetails:a,t:s}=e,c,l,u,d,f,m;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==s){let e=n.capabilities.filter(at),h=e.slice(0,2),g=Math.max(0,e.length-h.length),_=s.connect,v;t[11]!==n||t[12]!==s?(v=X(n,s),t[11]=n,t[12]=s,t[13]=v):v=t[13];let y=v,b=n.verificationLevel===`verified`?s.connectorVerified:n.verificationLevel===`beta`?s.connectorBeta:n.verificationLevel===`experimental`?s.connectorExperimental:null,x;t[14]!==_||t[15]!==n||t[16]!==i?(x=e=>(0,$.jsxs)(J,{type:`button`,variant:`primary`,className:p(`h-8 justify-center px-2.5 text-xs font-medium`,e),onClick:()=>i(n),children:[(0,$.jsx)(F,{className:`size-4`}),_]}),t[14]=_,t[15]=n,t[16]=i,t[17]=x):x=t[17],c=x,m=`group flex min-h-[8.75rem] flex-col rounded-xl border border-edge bg-surface-panel p-4 transition-colors hover:bg-surface-hover/45 focus-within:ring-2 focus-within:ring-accent/30`,l=`flex min-w-0 flex-1 flex-col`;let S;t[18]===n?S=t[19]:(S=(0,$.jsx)(ve,{connector:n}),t[18]=n,t[19]=S);let C;t[20]!==n||t[21]!==a?(C=a?(0,$.jsx)(`button`,{type:`button`,className:`block max-w-full truncate text-left text-sm font-semibold text-fg hover:underline`,onClick:()=>a(n),children:n.displayName}):(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.displayName}),t[20]=n,t[21]=a,t[22]=C):C=t[22];let w;t[23]===b?w=t[24]:(w=b?(0,$.jsx)(`span`,{className:`mt-1 inline-flex rounded-full border border-edge px-1.5 py-0.5 text-[10px] font-medium text-fg-subtle`,children:b}):null,t[23]=b,t[24]=w);let T;t[25]!==w||t[26]!==C?(T=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[C,w]}),t[25]=w,t[26]=C,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==S?(E=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[S,T]}),t[28]=T,t[29]=S,t[30]=E):E=t[30];let D;t[31]!==r||t[32]!==c?(D=r?null:(0,$.jsx)(`div`,{className:`hidden shrink-0 items-center gap-1 sm:flex`,children:c()}),t[31]=r,t[32]=c,t[33]=D):D=t[33];let O;t[34]!==r||t[35]!==s.connectedBadge?(O=r?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,$.jsx)(o,{className:`size-3`,"aria-hidden":!0}),s.connectedBadge]}):null,t[34]=r,t[35]=s.connectedBadge,t[36]=O):O=t[36];let k;t[37]!==D||t[38]!==O?(k=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[D,O]}),t[37]=D,t[38]=O,t[39]=k):k=t[39],t[40]!==E||t[41]!==k?(u=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[E,k]}),t[40]=E,t[41]=k,t[42]=u):u=t[42],t[43]===y?d=t[44]:(d=(0,$.jsx)(`p`,{className:`mt-3 line-clamp-2 text-sm leading-6 text-fg-muted`,title:y,children:y}),t[43]=y,t[44]=d),f=h.length>0?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[h.map(e=>(0,$.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:s.connectorCapabilityLabels[e]??e},e)),g>0?(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-subtle`,children:[`+`,g]}):null]}):null,t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=m}else c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],m=t[10];let h;t[45]!==l||t[46]!==u||t[47]!==d||t[48]!==f?(h=(0,$.jsxs)(`div`,{className:l,children:[u,d,f]}),t[45]=l,t[46]=u,t[47]=d,t[48]=f,t[49]=h):h=t[49];let g;t[50]!==r||t[51]!==c?(g=r?null:(0,$.jsx)(`div`,{className:`mt-4 flex flex-col gap-2 border-t border-edge pt-3 sm:hidden`,children:c(`w-full`)}),t[50]=r,t[51]=c,t[52]=g):g=t[52];let _;return t[53]!==m||t[54]!==h||t[55]!==g?(_=(0,$.jsxs)(`div`,{className:m,children:[h,g]}),t[53]=m,t[54]=h,t[55]=g,t[56]=_):_=t[56],_}function at(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}var ot=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function st(e,t){return t.some(t=>t.connectorId===e.id)}var ct=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function lt(){let e=(0,rt.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:p(`size-10 shrink-0 rounded-xl`,ct)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`div`,{className:`flex h-full min-h-[9.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:[t,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:p(`h-4 min-w-0 flex-1`,ct)}),(0,$.jsx)(`div`,{className:p(`h-8 w-[4.5rem] shrink-0 rounded-lg`,ct)})]}),(0,$.jsx)(`div`,{className:p(`h-3 w-full`,ct)}),(0,$.jsx)(`div`,{className:p(`h-3 w-[88%]`,ct)})]})]})}),e[1]=n):n=e[1],n}var ut=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function dt(){let e=(0,rt.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:p(`size-10 shrink-0 rounded-xl`,ut)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,$.jsx)(`div`,{className:p(`h-4 w-48 max-w-full`,ut)}),(0,$.jsx)(`div`,{className:p(`h-3 w-72 max-w-full`,ut)})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-start justify-between gap-3`,children:[n,(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,$.jsx)(`div`,{className:p(`h-9 w-20 rounded-lg`,ut)}),(0,$.jsx)(`div`,{className:p(`h-9 w-20 rounded-lg`,ut)})]})]})]}),e[2]=r):r=e[2];let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:[r,(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,$.jsx)(`div`,{className:p(`h-8 w-20 rounded-md`,ut)}),(0,$.jsx)(`div`,{className:p(`h-8 w-24 rounded-md`,ut)}),(0,$.jsx)(`div`,{className:p(`h-8 w-28 rounded-md`,ut)})]}),(0,$.jsx)(`div`,{className:p(`mt-3 h-20 rounded-xl`,ut)})]}),e[3]=i):i=e[3],i}var ft=[`understand`,`act`,`reach`];function pt(e){if(e.benefits?.length)return[...new Set(e.benefits)];let t=new Set(e.capabilities),n=[e.id,e.displayName,...e.tags??[]].join(` `).toLowerCase(),r=[];return(t.has(`context`)||t.has(`memory_source`)||t.has(`resources`)||e.category===`docs`||e.category===`data`||/notion|drive|document|confluence|airtable|database|knowledge|wiki/.test(n))&&r.push(`understand`),t.has(`tools`)&&r.push(`act`),(t.has(`channel`)||/slack|telegram|discord|teams|mail|message|wechat|weixin/.test(n))&&r.push(`reach`),r.length?[...new Set(r)]:[`act`]}function mt(e){return pt(e)[0]??`act`}function ht(e,t){let n=t?mt(t):`act`,r=e.connectionStatus===`connected`||e.status===`connected`||e.usage.lastHealthStatus===`ok`,i=e.status===`not_configured`||e.status===`failed`||e.status===`degraded`||e.status===`unauthorized`||e.connectionStatus===`unauthorized`||e.connectionStatus===`error`,a=n===`understand`?e.usage.lastResourceCount:n===`act`?e.usage.lastToolCount:void 0;return{benefit:n,state:r?`ready`:i?`needs_setup`:`checking`,availableCount:a}}function gt(e,t){return t.connectorCapabilityLabels[e]??e}function _t(e,t){if(e.runtime.type===`mcp`)return q(t.connectorRuntimeMcp,{serverId:e.runtime.serverId});let n=e.runtime.type===`composio`?e.runtime.toolkit:e.runtime.type===`cli`?e.runtime.adapterId:e.runtime.sourceKind;return q(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function vt(e,t){return e.auth.mode===`cli`?t.connectorAuthCli:e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function yt(e){let t=(0,rt.c)(133),{connector:n,installed:r,onClose:i,onInstall:a,t:s}=e,c;t[0]!==n||t[1]!==s?(c=X(n,s),t[0]=n,t[1]=s,t[2]=c):c=t[2];let l=c,u,f,m,h,g,_,T,E,D,O,A,j,M,N,P,L;if(t[3]!==n||t[4]!==l||t[5]!==r||t[6]!==i||t[7]!==s){let e=pt(n),a;t[24]!==n.setup.config||t[25]!==n.setup.secrets?(a=[...(n.setup.secrets??[]).filter(St),...(n.setup.config??[]).filter(xt)],t[24]=n.setup.config,t[25]=n.setup.secrets,t[26]=a):a=t[26];let c=a,F=n.capabilities.filter(bt);m=w,T=!0,t[27]===i?E=t[28]:(E=e=>{e||i()},t[27]=i,t[28]=E),f=x,t[29]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[29]=_):_=t[29],u=S,t[30]===Symbol.for(`react.memo_cache_sentinel`)?(h=p(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,42rem)] w-[min(100%-2rem,min(92vw,44rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-overlay shadow-float outline-none dark:border-edge`),t[30]=h):h=t[30];let R;t[31]===n?R=t[32]:(R=(0,$.jsx)(ve,{connector:n,size:`lg`}),t[31]=n,t[32]=R);let z;t[33]===n.displayName?z=t[34]:(z=(0,$.jsx)(C,{className:`text-base font-semibold text-fg`,children:n.displayName}),t[33]=n.displayName,t[34]=z);let B;t[35]!==r||t[36]!==s.connectedBadge?(B=r?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,$.jsx)(o,{className:`size-3`,"aria-hidden":!0}),s.connectedBadge]}):null,t[35]=r,t[36]=s.connectedBadge,t[37]=B):B=t[37];let V;t[38]!==z||t[39]!==B?(V=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[z,B]}),t[38]=z,t[39]=B,t[40]=V):V=t[40];let H;t[41]===l?H=t[42]:(H=(0,$.jsx)(y,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:l}),t[41]=l,t[42]=H);let U;t[43]!==V||t[44]!==H?(U=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[V,H]}),t[43]=V,t[44]=H,t[45]=U):U=t[45];let W;t[46]!==R||t[47]!==U?(W=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=W):W=t[48];let G;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(G=p(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,I.focusRingPanel),t[49]=G):G=t[49];let K;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(d,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[50]=K):K=t[50];let ee;t[51]===s.modalClose?ee=t[52]:(ee=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:G,"aria-label":s.modalClose,children:K})}),t[51]=s.modalClose,t[52]=ee),t[53]!==W||t[54]!==ee?(g=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-5 sm:px-6`,children:[W,ee]}),t[53]=W,t[54]=ee,t[55]=g):g=t[55],N=`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-5 sm:px-6`,P=e.length?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.connectorWhyConnect}),(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:e.map(e=>(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:s.connectorBenefitHeadings[e]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.connectorBenefitHints[e]})]},e))})]}):null;let te;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(Pe,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[56]=te):te=t[56];let J;t[57]===s.detailPermissions?J=t[58]:(J=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:s.detailPermissions}),t[57]=s.detailPermissions,t[58]=J);let ne;t[59]!==n||t[60]!==s?(ne=vt(n,s),t[59]=n,t[60]=s,t[61]=ne):ne=t[61];let re;t[62]===ne?re=t[63]:(re=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:ne}),t[62]=ne,t[63]=re);let ie;t[64]!==J||t[65]!==re?(ie=(0,$.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3`,children:[te,(0,$.jsxs)(`div`,{children:[J,re]})]}),t[64]=J,t[65]=re,t[66]=ie):ie=t[66];let ae;t[67]===s.connectorSetupTitle?ae=t[68]:(ae=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:s.connectorSetupTitle}),t[67]=s.connectorSetupTitle,t[68]=ae);let oe;t[69]!==c.length||t[70]!==s.connectorRequiredInputsCount||t[71]!==s.connectorSetupNone?(oe=c.length?q(s.connectorRequiredInputsCount,{count:String(c.length)}):s.connectorSetupNone,t[69]=c.length,t[70]=s.connectorRequiredInputsCount,t[71]=s.connectorSetupNone,t[72]=oe):oe=t[72];let Y;t[73]===oe?Y=t[74]:(Y=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:oe}),t[73]=oe,t[74]=Y);let se;t[75]!==ae||t[76]!==Y?(se=(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[ae,Y]}),t[75]=ae,t[76]=Y,t[77]=se):se=t[77],t[78]!==ie||t[79]!==se?(L=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base`,children:[ie,se]}),t[78]=ie,t[79]=se,t[80]=L):L=t[80],j=`rounded-xl border border-edge bg-surface-base`,t[81]===s.connectorTechnicalDetails?M=t[82]:(M=(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-fg-muted hover:text-fg`,children:s.connectorTechnicalDetails}),t[81]=s.connectorTechnicalDetails,t[82]=M),D=`space-y-5 border-t border-edge-subtle px-4 py-4`;let ce;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),t[83]=ce):ce=t[83];let X;t[84]===s.connectorRuntimeTitle?X=t[85]:(X=(0,$.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[ce,s.connectorRuntimeTitle]}),t[84]=s.connectorRuntimeTitle,t[85]=X);let Z;t[86]!==n||t[87]!==s?(Z=_t(n,s),t[86]=n,t[87]=s,t[88]=Z):Z=t[88];let le;t[89]===Z?le=t[90]:(le=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-subtle`,children:Z}),t[89]=Z,t[90]=le),t[91]!==X||t[92]!==le?(O=(0,$.jsxs)(`div`,{children:[X,le]}),t[91]=X,t[92]=le,t[93]=O):O=t[93],A=F.length?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:F.map(e=>(0,$.jsx)(`span`,{className:`rounded-md bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:gt(e,s)},e))}):null,t[3]=n,t[4]=l,t[5]=r,t[6]=i,t[7]=s,t[8]=u,t[9]=f,t[10]=m,t[11]=h,t[12]=g,t[13]=_,t[14]=T,t[15]=E,t[16]=D,t[17]=O,t[18]=A,t[19]=j,t[20]=M,t[21]=N,t[22]=P,t[23]=L}else u=t[8],f=t[9],m=t[10],h=t[11],g=t[12],_=t[13],T=t[14],E=t[15],D=t[16],O=t[17],A=t[18],j=t[19],M=t[20],N=t[21],P=t[22],L=t[23];let R;t[94]!==D||t[95]!==O||t[96]!==A?(R=(0,$.jsxs)(`div`,{className:D,children:[O,A]}),t[94]=D,t[95]=O,t[96]=A,t[97]=R):R=t[97];let z;t[98]!==R||t[99]!==j||t[100]!==M?(z=(0,$.jsxs)(`details`,{className:j,children:[M,R]}),t[98]=R,t[99]=j,t[100]=M,t[101]=z):z=t[101];let B;t[102]!==z||t[103]!==N||t[104]!==P||t[105]!==L?(B=(0,$.jsxs)(`div`,{className:N,children:[P,L,z]}),t[102]=z,t[103]=N,t[104]=P,t[105]=L,t[106]=B):B=t[106];let V;t[107]===s.modalClose?V=t[108]:(V=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(J,{variant:`secondary`,children:s.modalClose})}),t[107]=s.modalClose,t[108]=V);let H;t[109]!==n||t[110]!==r||t[111]!==i||t[112]!==a||t[113]!==s.connect?(H=r?null:(0,$.jsxs)(J,{variant:`primary`,onClick:()=>{a(n),i()},children:[(0,$.jsx)(F,{className:`size-4`}),s.connect]}),t[109]=n,t[110]=r,t[111]=i,t[112]=a,t[113]=s.connect,t[114]=H):H=t[114];let U;t[115]!==V||t[116]!==H?(U=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[V,H]}),t[115]=V,t[116]=H,t[117]=U):U=t[117];let W;t[118]!==u||t[119]!==h||t[120]!==g||t[121]!==B||t[122]!==U?(W=(0,$.jsxs)(u,{className:h,children:[g,B,U]}),t[118]=u,t[119]=h,t[120]=g,t[121]=B,t[122]=U,t[123]=W):W=t[123];let G;t[124]!==f||t[125]!==_||t[126]!==W?(G=(0,$.jsxs)(f,{children:[_,W]}),t[124]=f,t[125]=_,t[126]=W,t[127]=G):G=t[127];let K;return t[128]!==m||t[129]!==T||t[130]!==E||t[131]!==G?(K=(0,$.jsx)(m,{open:T,onOpenChange:E,children:G}),t[128]=m,t[129]=T,t[130]=E,t[131]=G,t[132]=K):K=t[132],K}function bt(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}function xt(e){return e.required}function St(e){return e.required}var Ct=(0,Q.memo)(function(e){let t=(0,rt.c)(45),{onRefresh:n,refreshing:r,refreshLabel:i,onBrowseCatalog:a,onAddCustomServer:o,addLabel:c,browseLabel:l,customLabel:d,serviceLabel:f,moreActionsLabel:m}=e,[h,g]=(0,Q.useState)(!1),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=p(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[highlighted]:bg-surface-hover`,I.transition),t[0]=_):_=t[0];let v=_,y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(u,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[1]=y):y=t[1];let b;t[2]===c?b=t[3]:(b=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:c}),t[2]=c,t[3]=b);let x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(he,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[4]=x):x=t[4];let S;t[5]!==c||t[6]!==b?(S=(0,$.jsx)(Ce,{asChild:!0,children:(0,$.jsxs)(J,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":c,children:[y,b,x]})}),t[5]=c,t[6]=b,t[7]=S):S=t[7];let C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(L,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[8]=C):C=t[8];let w;t[9]!==l||t[10]!==a?(w=(0,$.jsxs)(_e,{className:v,onSelect:a,children:[C,l]}),t[9]=l,t[10]=a,t[11]=w):w=t[11];let T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Ye,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[12]=T):T=t[12];let E;t[13]!==d||t[14]!==o?(E=(0,$.jsxs)(_e,{className:v,onSelect:o,children:[T,d]}),t[13]=d,t[14]=o,t[15]=E):E=t[15];let D;t[16]!==w||t[17]!==E?(D=(0,$.jsx)(Ge,{children:(0,$.jsxs)(A,{className:`z-50 min-w-[14rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[w,E]})}),t[16]=w,t[17]=E,t[18]=D):D=t[18];let O;t[19]!==D||t[20]!==S?(O=(0,$.jsxs)(Me,{children:[S,D]}),t[19]=D,t[20]=S,t[21]=O):O=t[21];let k;t[22]===h?k=t[23]:(k=(0,$.jsx)(et,{open:h,onOpenChange:g,hideTrigger:!0}),t[22]=h,t[23]=k);let j;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[24]=j):j=t[24];let M;t[25]===m?M=t[26]:(M=(0,$.jsx)(Ce,{asChild:!0,children:(0,$.jsx)(J,{type:`button`,variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":m,title:m,children:j})}),t[25]=m,t[26]=M);let N;t[27]!==n||t[28]!==i||t[29]!==r?(N=n?(0,$.jsxs)(_e,{className:v,disabled:r,onSelect:n,children:[r?(0,$.jsx)(ne,{className:`size-4 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,$.jsx)(Ie,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,t[27]=n,t[28]=i,t[29]=r,t[30]=N):N=t[30];let P,F;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>g(!0),F=(0,$.jsx)(Z,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),t[31]=P,t[32]=F):(P=t[31],F=t[32]);let R;t[33]===f?R=t[34]:(R=(0,$.jsxs)(_e,{className:v,onSelect:P,children:[F,f]}),t[33]=f,t[34]=R);let z;t[35]!==N||t[36]!==R?(z=(0,$.jsx)(Ge,{children:(0,$.jsxs)(A,{className:`z-50 min-w-[14rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[N,R]})}),t[35]=N,t[36]=R,t[37]=z):z=t[37];let B;t[38]!==M||t[39]!==z?(B=(0,$.jsxs)(Me,{children:[M,z]}),t[38]=M,t[39]=z,t[40]=B):B=t[40];let V;return t[41]!==O||t[42]!==k||t[43]!==B?(V=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2`,children:[O,k,B]}),t[41]=O,t[42]=k,t[43]=B,t[44]=V):V=t[44],V});function wt(e=``,t=``){return{clientKey:crypto.randomUUID(),key:e,value:t}}var Tt=/^([^:=]+)[:=](.*)$/;function Et(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return Ot(e)}catch{}let n=[];for(let e of t.split(/\r?\n/)){let t=e.trim();if(!t)continue;let r=Tt.exec(t);r&&n.push(wt(r[1].trim(),r[2].trim()))}return n.length>0?n:null}function Dt(e){let t=Object.create(null);for(let n of e){let e=n.key.trim();e&&(t[e]=n.reference??n.value)}return Object.keys(t).length>0?t:void 0}function Ot(e){if(!e||typeof e!=`object`)return[wt()];let t=Object.entries(e).map(([e,t])=>typeof t==`object`&&t&&!Array.isArray(t)?{...wt(e),reference:t}:wt(e,t==null?``:String(t)));return t.length>0?t:[wt()]}function kt(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e.xopcConnector;return!!(t&&typeof t==`object`&&!Array.isArray(t)&&t.managed===!0)}function At(e){let t=e.trim();if(!t)return;if(t.startsWith(`[`)){let e=JSON.parse(t);if(!Array.isArray(e)||e.some(e=>typeof e!=`string`))throw Error(`Command arguments must be a JSON array of strings.`);return e}let n=[],r=``,i=``,a=!1;for(let e=0;e<t.length;e++){let o=t[e];o===`\\`&&t[e+1]&&i!==`'`&&/[\s"'\\]/.test(t[e+1])?(r+=t[++e],a=!0):i?o===i?i=``:r+=o:o===`"`||o===`'`?(i=o,a=!0):/\s/.test(o)?a&&=(n.push(r),r=``,!1):(r+=o,a=!0)}if(i)throw Error(`Command arguments contain an unclosed quote.`);return a&&n.push(r),n}function jt(e){let t=e.trim();if(!t)return;let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Expected a JSON object`);return n}function Mt(e){let t={...e.extra,exposure:e.exposure};if(e.displayName?.trim()?t.displayName=e.displayName.trim():delete t.displayName,delete t.command,delete t.args,delete t.env,delete t.cwd,delete t.url,delete t.headers,delete t.type,e.transport===`stdio`){t.type=`stdio`,t.command=e.command.trim();let n=At(e.argsText);if(n&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envEntries){let n=new Set;for(let t of e.envEntries)if(!(!t.key.trim()&&!t.value&&!t.reference)){if(!t.key.trim()||n.has(t.key.trim()))throw Error(`Environment variable names must be non-empty and unique.`);n.add(t.key.trim())}let r=Dt(e.envEntries);r&&(t.env=r)}else e.envJson.trim()&&(t.env=jt(e.envJson));delete t.oauth,delete t.auth}else{t.type=`http`,t.url=e.url.trim();let n=Dt(e.headers);n&&(t.headers=n);let r={...t.oauth??{}};e.oauthClientId.trim()?r.clientId=e.oauthClientId.trim():delete r.clientId,Object.keys(r).length?t.oauth=r:delete t.oauth}return e.timeout===void 0?delete t.timeout:t.timeout=e.timeout,t}function Nt(e,t){let n=t.oauth;return{clientKey:e,id:e,displayName:typeof t.displayName==`string`?t.displayName:``,transport:typeof t.url==`string`?`streamable-http`:`stdio`,command:typeof t.command==`string`?t.command:``,argsText:Array.isArray(t.args)?JSON.stringify(t.args):``,envJson:t.env?JSON.stringify(t.env,null,2):``,cwd:typeof t.cwd==`string`?t.cwd:``,url:typeof t.url==`string`?t.url:``,headers:Ot(t.headers),oauthClientId:typeof n?.clientId==`string`?n.clientId:``,timeout:typeof t.timeout==`number`?t.timeout:void 0,exposure:t.exposure??`codemode`,extra:t}}function Pt(e,t){let n=`mcp`;try{n=e.transport===`streamable-http`?new URL(e.url).hostname:e.command.split(/[\\/]/).pop()||n}catch{}let r=n.replace(/[^a-zA-Z0-9_-]+/g,`_`).replace(/^_+|_+$/g,``)||`mcp`,i=new Set([...t].map(e=>e.replace(/-/g,`_`))),a=r;for(let e=2;i.has(a.replace(/-/g,`_`));e++)a=`${r}_${e}`;return a}function Ft(e){let t=e.trim(),n=new URL(/^[a-z][a-z\d+.-]*:/i.test(t)&&!/^[^/]+:\d+(?:[/?#]|$)/.test(t)?t:`${/^(localhost|127\.0\.0\.1)(:|\/|$)/i.test(t)?`http`:`https`}://${t}`);if(![`http:`,`https:`].includes(n.protocol)||n.username||n.password)throw Error(`Use an HTTP or HTTPS MCP address without embedded credentials.`);return n.href}function It(e){let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Expected a JSON object.`);let n=t.mcpServers??t.mcp?.servers??t.servers;if(n!==void 0&&(!n||typeof n!=`object`||Array.isArray(n)))throw Error(`Expected a server configuration object.`);let r=n?Object.entries(n):[[``,t]];if(!r.length)throw Error(`No MCP servers found.`);return r.map(([e,t])=>{if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Invalid MCP server configuration.`);let n=t;if(typeof n.url!=`string`&&typeof n.command!=`string`)throw Error(`The configuration needs an MCP URL or command.`);if(n.args!==void 0&&(!Array.isArray(n.args)||n.args.some(e=>typeof e!=`string`)))throw Error(`Command arguments must be strings.`);let r=Nt(e,n);return r.clientKey=crypto.randomUUID(),r.url&&=Ft(r.url),r})}function Lt(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`streamable-http`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[],oauthClientId:``,timeout:void 0,exposure:`codemode`,extra:{}}}function Rt(e){let t=e?.mcp?.servers??{};return{servers:Object.entries(t).filter(([,e])=>!kt(e)).map(([e,t])=>Nt(e,t)).sort((e,t)=>e.id.localeCompare(t.id))}}function zt(e){return Mt(e)}async function Bt(e,t){return(await m(_(`/api/mcp/servers/${encodeURIComponent(e)}/tools`),{method:`POST`,signal:AbortSignal.any([t,AbortSignal.timeout(95e3)])})).payload.tools}async function Vt(e,t,n,r){return(await m(_(`/api/mcp/drafts`),{method:`POST`,signal:r,body:JSON.stringify({serverId:e.id,sourceServerId:t,expectedServer:n,server:Mt(e)})})).payload}async function Ht(e,t){return(await m(_(`/api/mcp/drafts/${encodeURIComponent(e)}/probe`),{method:`POST`,signal:AbortSignal.any([t,AbortSignal.timeout(95e3)])})).payload}async function Ut(e){await m(_(`/api/mcp/drafts/${encodeURIComponent(e)}`),{method:`DELETE`})}async function Wt(e,t=!1){let n=await m(_(`/api/mcp/drafts/${encodeURIComponent(e)}/commit`),{method:`POST`,body:JSON.stringify({enable:t})});return E(),n.payload}async function Gt(e){return(await m(_(`/api/mcp/drafts/${encodeURIComponent(e)}/auth`),{method:`POST`})).payload}async function Kt(e,t){return(await m(_(`/api/mcp/drafts/${encodeURIComponent(e)}/auth`),{signal:t})).payload}async function qt(e){await m(_(`/api/mcp/drafts/${encodeURIComponent(e)}/auth`),{method:`DELETE`})}async function Jt(e,t){await m(_(`/api/mcp/drafts/${encodeURIComponent(e)}/auth/redirect`),{method:`POST`,body:JSON.stringify({url:t})})}async function Yt(e,t){return(await m(_(`/api/mcp/drafts/${encodeURIComponent(e)}/tools`),{signal:t})).payload.tools}async function Xt(e){let t=await m(_(`/api/mcp/servers`),{signal:e});return Object.fromEntries(t.payload.servers.filter(e=>e.lastCheck&&Number.isFinite(Date.parse(e.lastCheck.checkedAt))).map(e=>[e.id,e.lastCheck]))}async function Zt(e){let t=await m(_(`/api/mcp/servers/${encodeURIComponent(e.id)}`),{method:`DELETE`,body:JSON.stringify({expectedServer:e.extra})});return E(),t.payload}function Qt(e){let t=(0,rt.c)(111),{serverId:n,displayName:r,returnFocusTo:i,draftId:a,t:o,onClose:s,onConfigure:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(!0),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(0),D=(0,Q.useRef)(!1),O;t[1]!==a||t[2]!==n||t[3]!==o.setupAccessDenied||t[4]!==o.setupConflict||t[5]!==o.setupGatewayUnauthorized||t[6]!==o.setupRateLimited||t[7]!==o.toolsLoadFailed?(O=()=>{let e=new AbortController,t=!0;return p(!0),h(``),d([]),(a?Yt(a,e.signal):Bt(n,e.signal)).then(e=>{t&&d(e)}).catch(e=>{let n=e?.status;t&&h(n===401?o.setupGatewayUnauthorized:n===403?o.setupAccessDenied:n===429?o.setupRateLimited:n===404||n===409?o.setupConflict:o.toolsLoadFailed)}).finally(()=>{t&&p(!1)}),()=>{t=!1,e.abort()}},t[1]=a,t[2]=n,t[3]=o.setupAccessDenied,t[4]=o.setupConflict,t[5]=o.setupGatewayUnauthorized,t[6]=o.setupRateLimited,t[7]=o.toolsLoadFailed,t[8]=O):O=t[8];let k;t[9]!==a||t[10]!==T||t[11]!==n||t[12]!==o?(k=[n,a,T,o],t[9]=a,t[10]=T,t[11]=n,t[12]=o,t[13]=k):k=t[13],(0,Q.useEffect)(O,k);let A,j,M,N,P,F,I,L,R,z,B,V,H;if(t[14]!==r||t[15]!==m||t[16]!==f||t[17]!==s||t[18]!==c||t[19]!==g||t[20]!==i||t[21]!==n||t[22]!==o.exposureLabels||t[23]!==o.setupConfigure||t[24]!==o.toolDetails||t[25]!==o.toolsClearSearch||t[26]!==o.toolsDialogSearchEmpty||t[27]!==o.toolsDialogSearchPlaceholder||t[28]!==o.toolsDialogSubtitle||t[29]!==o.toolsDialogTitle||t[30]!==o.toolsEmpty||t[31]!==o.toolsLoading||t[32]!==o.toolsRetryHint||t[33]!==o.toolsSearchSummary||t[34]!==o.toolsTitle||t[35]!==u){let e=g.trim().toLowerCase(),a;if(t[49]!==n){let e;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(e=/-/g,t[51]=e):e=t[51],a=n.replace(e,`_`),t[49]=n,t[50]=a}else a=t[50];let l=`mcp__${a}__`,d=u.filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e));M=w,F=!0,t[52]===s?I=t[53]:(I=e=>{e||s()},t[52]=s,t[53]=I),j=x,t[54]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(v,{className:`fixed inset-0 z-[60] bg-scrim`}),t[54]=P):P=t[54],A=S,t[55]===i?V=t[56]:(V=e=>{(D.current||i)&&e.preventDefault(),!D.current&&i?.isConnected&&i.focus()},t[55]=i,t[56]=V),H=`fixed left-1/2 top-1/2 z-[60] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay`;let p;t[57]===o.toolsDialogTitle?p=t[58]:(p=(0,$.jsx)(C,{className:`font-semibold`,children:o.toolsDialogTitle}),t[57]=o.toolsDialogTitle,t[58]=p);let h;t[59]!==r||t[60]!==m||t[61]!==f||t[62]!==n||t[63]!==o.toolsDialogSubtitle||t[64]!==u.length?(h=f||m?r||n:o.toolsDialogSubtitle.replace(`{{serverId}}`,r||n).replace(`{{count}}`,String(u.length)),t[59]=r,t[60]=m,t[61]=f,t[62]=n,t[63]=o.toolsDialogSubtitle,t[64]=u.length,t[65]=h):h=t[65];let b;t[66]===h?b=t[67]:(b=(0,$.jsx)(y,{className:`mt-1 break-words text-sm text-fg-muted`,children:h}),t[66]=h,t[67]=b);let T;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>_(e.target.value),t[68]=T):T=t[68];let E;t[69]!==g||t[70]!==o.toolsDialogSearchPlaceholder?(E=(0,$.jsx)(`input`,{className:`mt-4 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,value:g,onChange:T,placeholder:o.toolsDialogSearchPlaceholder,"aria-label":o.toolsDialogSearchPlaceholder}),t[69]=g,t[70]=o.toolsDialogSearchPlaceholder,t[71]=E):E=t[71];let O=e&&!f&&!m?(0,$.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-fg-muted`,children:o.toolsSearchSummary.replace(`{{visible}}`,String(d.length)).replace(`{{count}}`,String(u.length))}):null;t[72]!==p||t[73]!==b||t[74]!==E||t[75]!==O?(N=(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge p-5`,children:[p,b,E,O]}),t[72]=p,t[73]=b,t[74]=E,t[75]=O,t[76]=N):N=t[76],L=`min-h-0 flex-1 overflow-y-auto p-5`,R=f,t[77]!==o.toolsTitle||t[78]!==u.length?(z=o.toolsTitle.replace(`{{count}}`,String(u.length)),t[77]=o.toolsTitle,t[78]=u.length,t[79]=z):z=t[79],B=f?(0,$.jsx)(`div`,{role:`status`,"aria-label":o.toolsLoading,className:`space-y-3`,children:[0,1,2].map(en)}):m?(0,$.jsxs)(`div`,{role:`alert`,className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm text-danger`,children:m}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.toolsRetryHint}),c?(0,$.jsx)(J,{variant:`secondary`,onClick:()=>{D.current=!0,c()},children:o.setupConfigure}):null]}):d.length?(0,$.jsx)(`div`,{className:`space-y-3`,children:d.map(e=>(0,$.jsxs)(`article`,{className:`rounded-lg border border-edge p-4`,children:[(0,$.jsx)(`h3`,{className:`break-all font-mono text-sm font-semibold text-fg`,children:e.name.startsWith(l)?e.name.slice(l.length):e.name}),e.exposure&&Object.hasOwn(o.exposureLabels,e.exposure)?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:o.exposureLabels[e.exposure]}):null,e.description?(0,$.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-fg-muted`,children:e.description}):null,(0,$.jsxs)(`details`,{className:`mt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm text-accent-fg`,children:o.toolDetails}),(0,$.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-fg-muted`,children:e.name}),(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto rounded-md bg-surface-panel p-3 text-xs text-fg`,children:JSON.stringify(e.inputSchema,null,2)})]})]},e.name))}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u.length?o.toolsDialogSearchEmpty:o.toolsEmpty}),e?(0,$.jsx)(J,{variant:`secondary`,onClick:()=>_(``),children:o.toolsClearSearch}):null]}),t[14]=r,t[15]=m,t[16]=f,t[17]=s,t[18]=c,t[19]=g,t[20]=i,t[21]=n,t[22]=o.exposureLabels,t[23]=o.setupConfigure,t[24]=o.toolDetails,t[25]=o.toolsClearSearch,t[26]=o.toolsDialogSearchEmpty,t[27]=o.toolsDialogSearchPlaceholder,t[28]=o.toolsDialogSubtitle,t[29]=o.toolsDialogTitle,t[30]=o.toolsEmpty,t[31]=o.toolsLoading,t[32]=o.toolsRetryHint,t[33]=o.toolsSearchSummary,t[34]=o.toolsTitle,t[35]=u,t[36]=A,t[37]=j,t[38]=M,t[39]=N,t[40]=P,t[41]=F,t[42]=I,t[43]=L,t[44]=R,t[45]=z,t[46]=B,t[47]=V,t[48]=H}else A=t[36],j=t[37],M=t[38],N=t[39],P=t[40],F=t[41],I=t[42],L=t[43],R=t[44],z=t[45],B=t[46],V=t[47],H=t[48];let U;t[80]!==L||t[81]!==R||t[82]!==z||t[83]!==B?(U=(0,$.jsx)(`div`,{className:L,"aria-busy":R,"aria-label":z,children:B}),t[80]=L,t[81]=R,t[82]=z,t[83]=B,t[84]=U):U=t[84];let W;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>E($t),t[85]=W):W=t[85];let G;t[86]!==f||t[87]!==o.refreshTools?(G=(0,$.jsx)(J,{variant:`secondary`,disabled:f,onClick:W,children:o.refreshTools}),t[86]=f,t[87]=o.refreshTools,t[88]=G):G=t[88];let K;t[89]!==s||t[90]!==o.toolsDialogClose?(K=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(J,{onClick:s,children:o.toolsDialogClose})}),t[89]=s,t[90]=o.toolsDialogClose,t[91]=K):K=t[91];let q;t[92]!==G||t[93]!==K?(q=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge p-4`,children:[G,K]}),t[92]=G,t[93]=K,t[94]=q):q=t[94];let ee;t[95]!==A||t[96]!==N||t[97]!==U||t[98]!==q||t[99]!==V||t[100]!==H?(ee=(0,$.jsxs)(A,{onCloseAutoFocus:V,className:H,children:[N,U,q]}),t[95]=A,t[96]=N,t[97]=U,t[98]=q,t[99]=V,t[100]=H,t[101]=ee):ee=t[101];let te;t[102]!==j||t[103]!==P||t[104]!==ee?(te=(0,$.jsxs)(j,{children:[P,ee]}),t[102]=j,t[103]=P,t[104]=ee,t[105]=te):te=t[105];let ne;return t[106]!==M||t[107]!==F||t[108]!==I||t[109]!==te?(ne=(0,$.jsx)(M,{open:F,onOpenChange:I,children:te}),t[106]=M,t[107]=F,t[108]=I,t[109]=te,t[110]=ne):ne=t[110],ne}function $t(e){return e+1}function en(e){return(0,$.jsx)(B,{className:`h-24 w-full`},e)}function tn(e){if(e.transport===`stdio`)return e.command.trim();try{let t=new URL(e.url);return`${t.protocol}//${t.host}${t.pathname}`}catch{return e.url.trim().split(/[?#]/,1)[0].replace(/\/\/[^/]*@/,`//`)}}function nn({row:e,lastCheck:t,t:n,cs:r,onEdit:i,onRemove:a}){let[o,s]=(0,Q.useState)(!1),c=(0,Q.useRef)(null),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``);return(0,$.jsxs)(`div`,{className:`px-4 py-3.5`,children:[(0,$.jsxs)(`button`,{className:`block w-full text-left`,onClick:i,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.displayName||e.id}),(0,$.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-fg-muted`,children:tn(e)})]}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:e.extra.enabled===!1?n.setupDisabled:t?n.setupLastCheck.replace(`{{count}}`,String(t.toolCount)):n.setupUnverified}),t?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,$.jsx)(`time`,{dateTime:t.checkedAt,children:new Intl.DateTimeFormat(void 0,{dateStyle:`short`,timeStyle:`short`}).format(new Date(t.checkedAt))})}):null,d?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:d}):null,(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,$.jsx)(J,{variant:`ghost`,onClick:i,children:n.setupConfigure}),(0,$.jsx)(J,{ref:c,variant:`secondary`,disabled:e.extra.enabled===!1,onClick:()=>s(!0),children:n.viewTools}),(0,$.jsx)(J,{variant:`ghost`,onClick:()=>u(!0),children:n.removeServer})]}),o?(0,$.jsx)(Qt,{serverId:e.id,displayName:e.displayName,returnFocusTo:c.current,t:n,onClose:()=>s(!1),onConfigure:()=>{s(!1),i()}}):null,(0,$.jsx)(ae,{open:l,title:r.removeConfirmTitle.replace(`{{name}}`,e.displayName||e.id),description:r.removeConfirmDescription,confirmLabel:n.removeServer,cancelLabel:r.modalCancel,destructive:!0,onCancel:()=>u(!1),onConfirm:()=>{u(!1),f(``),a().catch(()=>f(n.setupRemoveFailed))}})]})}function rn(e){let t=e.connectedAt?Date.parse(e.connectedAt):0;return Number.isFinite(t)?t:0}function an(e,t){return e.status===`active`&&t.status!==`active`?-1:e.status!==`active`&&t.status===`active`?1:e.isCurrentAuthorization===t.isCurrentAuthorization?rn(t)-rn(e):e.isCurrentAuthorization?-1:1}function on(e){let t=new Map;for(let n of e){let e=n.accountId??n.identityKey??`authorization:${n.id}`;t.set(e,[...t.get(e)??[],n])}return[...t.entries()].map(([e,t])=>{let n=[...t].sort(an);return{key:e,primary:n[0],authorizations:n}}).sort((e,t)=>an(e.primary,t.primary))}var sn=p(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,H);function cn(e){return e.materialized.type===`composio`?e.materialized.toolkit:null}function ln(e,t){return e===`write`?t.composioScopeWrite:e===`admin`?t.composioScopeAdmin:t.composioScopeRead}function un(e,t,n){return e.status===`connected`?q(n.composioHealthConnected,{count:String(t)}):e.status===`reauthorization_required`?n.composioHealthReconnect:e.status===`disconnected`?n.composioHealthDisconnected:e.errorCode===`missing_credential`?n.composioHealthMissingCredential:e.errorCode===`unauthorized`?n.composioHealthUnauthorized:e.errorCode===`forbidden`?n.composioHealthForbidden:e.errorCode===`network`?n.composioHealthNetwork:e.errorCode===`timeout`?n.composioHealthTimeout:n.composioHealthDegraded}function dn(e,t){return e===`active`?t.composioConnectionHealthy:e===`pending`?t.composioConnectionPending:e===`expired`?t.composioConnectionExpired:e===`failed`?t.composioConnectionFailed:e===`revoked`||e===`disabled`?t.composioConnectionRevoked:t.composioConnectionUnknown}function fn(e,t,n){return e.status===`paused`?t?.scanEnabled===!1?n.connectorLearningPausedByPolicy:n.connectorLearningPausedByFailure:e.status===`queued`?n.connectorLearningQueued:e.status===`running`?n.connectorLearningRunning:e.status===`completed`?n.connectorLearningCompleted:n.connectorLearningFailed}function pn({instance:e,t,onChanged:n}){let r=cn(e),i=g(e=>e.language)===`zh`,[a,s]=(0,Q.useState)([]),[c,l]=(0,Q.useState)([]),[u,d]=(0,Q.useState)([]),[f,m]=(0,Q.useState)(null),[h,_]=(0,Q.useState)([]),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)([]),[w,T]=(0,Q.useState)({}),[E,D]=(0,Q.useState)(`read`),[O,k]=(0,Q.useState)(!1),[A,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(!1),[K,ee]=(0,Q.useState)(!1),[re,oe]=(0,Q.useState)(!1),Y=(0,Q.useRef)(0),se=(0,Q.useRef)(0),ce=(0,Q.useMemo)(()=>on(a),[a]),X=(0,Q.useCallback)(e=>new Promise((t,n)=>{let r=window.setTimeout(()=>n(Error(i?`连接服务响应超时,请重试。`:`The connection service timed out. Please retry.`)),15e3);e.then(t,n).finally(()=>window.clearTimeout(r))}),[i]),Z=(0,Q.useCallback)(async()=>{if(!r||e.materialized.type!==`composio`||e.materialized.role===`credential`)return;k(!0),N(null);let t=++Y.current;try{let e=(await Promise.allSettled([X(Ae()).then(e=>{t===Y.current&&(s(e.filter(e=>e.toolkit.toLowerCase()===r.toLowerCase())),H(!0))}),X(Ke(r)).then(e=>{t===Y.current&&D(e)}),X(Oe(r)).then(e=>{t===Y.current&&(m(e.policy),_(e.agents))})])).find(e=>e.status===`rejected`);t===Y.current&&e?.status===`rejected`&&N(String(e.reason instanceof Error?e.reason.message:e.reason))}finally{t===Y.current&&k(!1)}},[e.materialized,r,X]);(0,Q.useEffect)(()=>(Z(),()=>{Y.current++}),[Z]);let ue=(0,Q.useCallback)(async()=>{if(!r)return;let e=++se.current;oe(!0),F(!1);let t=t=>n=>{e===se.current&&t(n)},n=await Promise.allSettled([X(xe(r)).then(t(l)),X(be(20)).then(t(e=>d(e.filter(e=>!e.toolkit||e.toolkit.toLowerCase()===r.toLowerCase())))),X(ye(r)).then(t(x)),X(me(r)).then(t(y))]);e===se.current&&(F(n.some(e=>e.status===`rejected`)),oe(!1))},[r,X]);(0,Q.useEffect)(()=>(K&&ue(),()=>{se.current++}),[K,ue]),(0,Q.useEffect)(()=>{let e=!1,t=on(a).map(e=>e.primary).filter(e=>e.supportsLearning&&e.accountId);if(t.length)return X(le()).then(t=>{e||C(t)}).catch(()=>{}),Promise.allSettled(t.map(async e=>[e.accountId,await X(Le(e.accountId))])).then(t=>{e||T(Object.fromEntries(t.flatMap(e=>e.status===`fulfilled`?[e.value]:[])))}),()=>{e=!0}},[a,X]);let pe=(0,Q.useCallback)(async i=>{if(!r)return;let a=fe()?null:window.open(`about:blank`,`_blank`);a&&(a.opener=null),k(!0),N(null);try{if(!fe()&&!a)throw Error(`Allow popups to open the authorization page.`);let t=await te(e.connectorId,i);if(!t.authorizationUrl)throw Error(`The authorization provider did not return an authorization URL.`);if(fe()){let e=await window.electronAPI?.shell?.openExternalUrl(t.authorizationUrl);if(!e?.ok)throw Error(e?.error??`Could not open the system browser.`)}else a.location.href=t.authorizationUrl;let o=await W(r,t.connectionId,12e4,t.attemptId);if(i&&o.accountId!==i)throw Error(`A different account was authorized. The original account and its task bindings were not changed.`);await Promise.all([n?.(),Z()])}catch(e){N(ie(e,t))}finally{a?.close(),k(!1)}},[e.connectorId,Z,n,t,r]),he=(0,Q.useCallback)(async t=>{k(!0),N(null);try{await we(e.instanceId,{config:{...e.config??{},authConfigId:t||void 0}}),await Promise.all([n?.(),Z()])}catch(e){N(e instanceof Error?e.message:String(e))}finally{k(!1)}},[e.config,e.instanceId,Z,n]),_e=async e=>{let t=fe()?null:window.open(`about:blank`,`_blank`);t&&(t.opener=null),N(null);try{let n=await Ue(e.id);if(n.authorizationUrl)if(fe())await window.electronAPI?.shell?.openExternalUrl(n.authorizationUrl);else if(t)t.location.href=n.authorizationUrl;else throw Error(`Allow popups to reopen authorization.`);else t?.close(),await Z()}catch(e){t?.close(),N(e instanceof Error?e.message:String(e))}},ve=(0,Q.useCallback)(async e=>{if(r){D(e),N(null);try{await M(r,e)}catch(e){N(e instanceof Error?e.message:String(e)),await Z()}}},[Z,r]),Se=(0,Q.useCallback)(async e=>{if(r){N(null);try{m(await j(r,e))}catch(e){N(e instanceof Error?e.message:String(e))}}},[r]),Ce=(0,Q.useCallback)(e=>{if(!f)return;let t=f.allowedAgentIds.includes(e);t&&f.allowedAgentIds.length===1||Se({allowedAgentIds:t?f.allowedAgentIds.filter(t=>t!==e):[...f.allowedAgentIds,e]})},[Se,f]),De=(0,Q.useCallback)(async e=>{k(!0),N(null);try{await e(),await Z()}catch(e){N(e instanceof Error?e.message:String(e))}finally{k(!1)}},[Z]);if(!r)return null;if(e.materialized.type===`composio`&&e.materialized.role===`credential`)return(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.composioApiKeyStored});let ke=ce.filter(e=>e.primary.status===`active`).length,je=ke>0?t.composioAddAccount:t.composioConnectAccount,Me=V&&ke>0,Ne=b?.requiresCustomAuthConfig===!0,Fe=b?.authConfigs.filter(e=>e.status===`ENABLED`&&e.isEnabledForToolRouter)??[];return(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsxs)(`section`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`span`,{className:p(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,Me?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:[Me?(0,$.jsx)(o,{className:`size-3.5`}):(0,$.jsx)(de,{className:`size-3.5`}),Me?t.connectionReady:V||A?t.connectionNeedsSetup:t.connectionChecking]}),V&&(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:q(t.composioAccountCount,{count:String(ce.length)})})]}),(0,$.jsxs)(J,{variant:`primary`,className:`shrink-0`,disabled:O,onClick:()=>void pe(),children:[O?(0,$.jsx)(ne,{className:`size-4 animate-spin`}):(0,$.jsx)(Pe,{className:`size-4`}),je]})]}),A?(0,$.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center justify-between gap-2 rounded-xl border border-danger/20 bg-danger/5 px-3 py-2 text-sm text-danger`,children:[(0,$.jsx)(`p`,{children:A}),(0,$.jsx)(J,{variant:`secondary`,disabled:O,onClick:()=>void Z(),children:t.composioRetry})]}):null,v&&!Me?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-amber-500/25 bg-amber-500/5 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:un(v,ke,t)}),v.recovery===`none`?null:(0,$.jsx)(J,{variant:`secondary`,disabled:O,onClick:()=>void(v.recovery===`retry`?Z():pe()),children:v.recovery===`retry`?t.composioRetry:t.composioReconnectAccount})]}):null,Ne&&Fe.length===0?(0,$.jsx)(`p`,{className:`rounded-xl border border-amber-500/25 bg-amber-500/5 px-4 py-3 text-sm text-amber-800 dark:text-amber-200`,children:t.composioAuthConfigEmpty}):null,f?(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle px-4 py-4 sm:grid-cols-[minmax(0,1fr)_15rem] sm:items-start`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioAccessTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:E===`read`?t.composioAccessReadHint:E===`admin`?t.composioAccessAdminHint:t.composioAccessWriteHint})]}),(0,$.jsxs)(qe,{value:E,onChange:e=>void ve(e.currentTarget.value),children:[(0,$.jsx)(ge,{value:`read`,children:t.composioAccessReadOnly}),(0,$.jsx)(ge,{value:`write`,children:t.composioAccessReadWrite}),E===`admin`?(0,$.jsx)(ge,{value:`admin`,children:t.composioAccessAdminCurrent}):null]})]}),(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm text-fg-muted`,children:t.composioAdvancedSettings}),(0,$.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle px-4 py-4 sm:grid-cols-[minmax(0,1fr)_15rem] sm:items-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioConfirmationPolicy}),(0,$.jsxs)(qe,{value:f.confirmationPolicy,onChange:e=>void Se({confirmationPolicy:e.currentTarget.value}),children:[(0,$.jsx)(ge,{value:`writes`,children:t.composioConfirmWrites}),(0,$.jsx)(ge,{value:`always`,children:t.composioConfirmAlways}),f.confirmationPolicy===`never`?(0,$.jsx)(ge,{value:`never`,children:t.composioConfirmNever}):null]})]}),(0,$.jsxs)(`div`,{className:`px-4 py-4`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioAllowedAgents}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.allowedAgentIds.length?t.composioAllowedAgentsSelected:t.composioAllowedAgentsAll}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,className:p(`rounded-full border px-2.5 py-1 text-xs transition-colors`,f.allowedAgentIds.length===0?`border-accent bg-accent/10 text-accent`:`border-edge bg-surface-panel text-fg-muted hover:text-fg`),onClick:()=>void Se({allowedAgentIds:[]}),children:t.composioAllowedAgentsAllOption}),h.map(e=>(0,$.jsx)(`button`,{type:`button`,className:p(`rounded-full border px-2.5 py-1 text-xs transition-colors`,f.allowedAgentIds.includes(e.id)?`border-accent bg-accent/10 text-accent`:`border-edge bg-surface-panel text-fg-muted hover:text-fg`),onClick:()=>Ce(e.id),children:e.name},e.id))]})]}),(0,$.jsxs)(`fieldset`,{className:`space-y-2 border-t border-edge-subtle p-4 text-xs text-fg-muted`,children:[(0,$.jsx)(`legend`,{children:i?`可用账号范围`:`Available accounts`}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:f.selectedAccountIds===null,disabled:O,onChange:e=>void Se({selectedAccountIds:e.currentTarget.checked?null:[]})}),i?`所有账号(包括以后新增)`:`All accounts, including new ones`]}),f.selectedAccountIds!==null&&ce.map(({primary:e})=>e.accountId&&(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,disabled:O,checked:f.selectedAccountIds.includes(e.accountId),onChange:t=>void Se({selectedAccountIds:t.currentTarget.checked?[...f.selectedAccountIds,e.accountId]:f.selectedAccountIds.filter(t=>t!==e.accountId)})}),e.alias??e.accountEmail??e.accountId]},e.accountId)),f.selectedAccountIds?.length===0&&(0,$.jsx)(`p`,{children:i?`未选择账号,Agent 无法使用此应用。`:`No accounts selected. Agents cannot use this app.`})]})]})]}):null,(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.composioConnectedAccounts}),V&&(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:q(t.composioAccountCount,{count:String(ce.length)})})]}),(0,$.jsxs)(J,{variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:O,onClick:()=>void Z(),children:[(0,$.jsx)(Ie,{className:p(`size-3.5`,O&&`animate-spin`)}),t.refresh]})]}),ce.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:ce.map(e=>{let r=e.primary,a=S.find(e=>r.accountId?e.accountId===r.accountId:e.connectionId===r.id),o=r.accountId?w[r.accountId]:void 0;return(0,$.jsxs)(`article`,{className:`px-4 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col items-start justify-between gap-3 sm:flex-row`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:r.alias??r.workspace??r.accountEmail??r.username??t.composioUnnamedAuthorization})}),(0,$.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:r.accountEmail??r.username??r.workspace??r.accountId}),r.backendLabel&&(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:r.backendLabel}),(0,$.jsx)(`p`,{className:p(`mt-1 text-xs`,r.status===`active`?`text-emerald-700 dark:text-emerald-300`:`text-amber-700 dark:text-amber-300`),children:r.accountEnabled===!1?i?`已暂停`:`Paused`:dn(r.status,t)}),a?(0,$.jsx)(`p`,{className:p(`mt-1 text-xs`,a.status===`failed`?`text-red-600`:`text-fg-subtle`),children:q(t.connectorLearningStatus,{status:fn(a,o,t),count:String(a.candidatesCreated)})}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[r.status===`pending`&&(0,$.jsx)(J,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,onClick:()=>void _e(r),children:i?`继续授权`:`Continue authorization`}),r.accountId&&(0,$.jsx)(J,{variant:`ghost`,className:`h-8 px-2.5 text-xs text-danger`,disabled:O,onClick:()=>z(r.accountId),children:i?`断开`:`Disconnect`}),r.accountId&&r.status!==`active`&&(0,$.jsx)(J,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,disabled:O,onClick:()=>void pe(r.accountId),children:t.composioReconnectAccount}),r.accountId&&(0,$.jsx)(J,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,disabled:O,onClick:()=>void De(()=>G(r.accountId,{enabled:r.accountEnabled===!1})),children:r.accountEnabled===!1?i?`启用`:`Enable`:i?`暂停`:`Pause`}),r.supportsLearning&&r.status===`active`&&r.accountEnabled!==!1?(0,$.jsxs)(J,{variant:`secondary`,className:`h-8 shrink-0 px-2.5 text-xs`,disabled:O,onClick:()=>void De(async()=>{if(!r.accountId)throw Error(`Connector account is unavailable.`);await Xe(r.accountId),await n?.()}),children:[(0,$.jsx)(Ie,{className:`size-3.5`}),t.composioSyncNow]}):null]})]}),(0,$.jsxs)(`details`,{className:`mt-3 text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`w-fit cursor-pointer font-medium hover:text-fg`,children:t.composioAccountSettings}),(0,$.jsxs)(`div`,{className:`mt-3 space-y-4 rounded-lg bg-surface-panel p-3`,children:[r.accountId&&(0,$.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,$.jsx)(`legend`,{className:`mb-2 font-medium`,children:t.composioAllowedAgents}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,disabled:O,checked:r.allowedAgentIds==null,onChange:e=>void De(()=>G(r.accountId,{allowedAgentIds:e.currentTarget.checked?null:[]}))}),t.composioAllowedAgentsAllOption]}),r.allowedAgentIds!=null&&h.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,disabled:O,checked:r.allowedAgentIds.includes(e.id),onChange:t=>{let n=t.currentTarget.checked;De(()=>G(r.accountId,{allowedAgentIds:n?[...r.allowedAgentIds,e.id]:r.allowedAgentIds.filter(t=>t!==e.id)}))}}),e.name]},e.id)),r.allowedAgentIds?.length===0&&(0,$.jsx)(`p`,{children:i?`未选择 Agent:任何 Agent 都不能使用此账号。`:`No agents selected: this account is unavailable to all agents.`})]}),r.supportsLearning&&o?(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:o.scanEnabled,disabled:O,onChange:e=>void De(()=>U(r.accountId,{scanEnabled:e.currentTarget.checked}))}),t.connectorScheduledScan]}),o.scanEnabled?(0,$.jsxs)(`label`,{className:`sm:col-span-2`,children:[t.connectorScanInterval,(0,$.jsxs)(qe,{className:`mt-1`,value:String(o.intervalMinutes??30),disabled:O,onChange:e=>void De(()=>U(r.accountId,{intervalMinutes:Number(e.currentTarget.value)})),children:[(0,$.jsxs)(ge,{value:`5`,children:[`5 `,t.connectorMinutes]}),(0,$.jsxs)(ge,{value:`15`,children:[`15 `,t.connectorMinutes]}),(0,$.jsxs)(ge,{value:`30`,children:[`30 `,t.connectorMinutes]}),(0,$.jsxs)(ge,{value:`60`,children:[`60 `,t.connectorMinutes]})]})]}):null]}):null,(0,$.jsxs)(`label`,{className:`block`,children:[t.composioAccountAlias,(0,$.jsx)(`input`,{className:p(sn,`mt-1 h-8 py-1 text-xs`),defaultValue:r.alias??``,onBlur:e=>{e.currentTarget.value!==(r.alias??``)&&De(()=>Te(r.id,{alias:e.currentTarget.value}))}})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:e.authorizations.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`p`,{className:`min-w-0 break-all font-mono text-fg-subtle`,children:[t.composioAuthorizationId,`: `,e.providerConnectionId]}),(0,$.jsx)(J,{variant:`ghost`,className:`size-7 shrink-0 p-0 text-danger`,title:t.composioRevoke,disabled:O,onClick:()=>L(e.id),children:(0,$.jsx)(Ee,{className:`size-3.5`})})]},e.id))}),(0,$.jsx)(`div`,{className:`flex justify-end gap-1`,children:(0,$.jsx)(J,{variant:`ghost`,className:`size-8 p-0`,title:t.refresh,disabled:O,onClick:()=>void De(()=>Je(r.id)),children:(0,$.jsx)(Ie,{className:`size-4`})})})]})]})]},e.key)})}):O&&!V?(0,$.jsxs)(`div`,{"aria-busy":`true`,"aria-label":t.connectionChecking,className:`space-y-3`,children:[(0,$.jsx)(B,{className:`h-16 w-full`}),(0,$.jsx)(B,{className:`h-16 w-full`})]}):V?(0,$.jsx)(`div`,{className:`rounded-xl border border-dashed border-edge px-4 py-8 text-center`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.composioConnectionsEmpty})}):null]}),(0,$.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-base`,onToggle:e=>ee(e.currentTarget.open),children:[(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-fg-muted hover:text-fg`,children:t.composioAdvancedSettings}),(0,$.jsxs)(`div`,{className:`space-y-5 border-t border-edge-subtle px-4 py-4`,children:[re?(0,$.jsx)(B,{"aria-label":t.connectionChecking,className:`h-16 w-full`}):null,P?(0,$.jsxs)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:[t.composioDiagnosticsUnavailable,(0,$.jsx)(J,{variant:`ghost`,disabled:re,onClick:()=>void ue(),children:t.composioRetry})]}):null,b?.mode===`byok`?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioAuthConfigTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:Ne?t.composioAuthConfigRequiredHint:t.composioAuthConfigOptionalHint})]}),(0,$.jsx)(`a`,{className:`text-xs font-medium text-accent-fg hover:underline`,href:`https://app.composio.dev`,target:`_blank`,rel:`noreferrer`,children:t.composioAuthConfigManage})]}),(0,$.jsxs)(qe,{className:`mt-3`,value:typeof e.config?.authConfigId==`string`?e.config.authConfigId:``,disabled:O,onChange:e=>void he(e.currentTarget.value),children:[Ne?null:(0,$.jsx)(ge,{value:``,children:t.composioAuthConfigManaged}),Ne&&typeof e.config?.authConfigId!=`string`?(0,$.jsx)(ge,{value:``,disabled:!0,children:t.composioAuthConfigSelect}):null,Fe.map(e=>(0,$.jsxs)(ge,{value:e.id,children:[e.name,` · `,e.authScheme??`OAuth`]},e.id))]})]}):null,(0,$.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioAgentTools}),(0,$.jsx)(`div`,{className:`space-y-2`,children:c.length?c.slice(0,8).map(e=>(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.slug}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[ln(e.scope,t),e.curated?``:` ${t.composioUncuratedSuffix}`]})]},e.slug)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioToolsEmpty})})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioRecentTriggers}),(0,$.jsx)(`div`,{className:`space-y-2`,children:u.length?u.slice(0,5).map(e=>(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`p`,{className:`truncate text-xs text-fg`,children:e.trigger??e.id}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:new Date(e.at).toLocaleString()})]},`${e.id}-${e.at}`)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioTriggersEmpty})})]})]})]})]}),(0,$.jsx)(ae,{open:R!==null,title:i?`断开账号`:`Disconnect account`,description:i?`停止此账号的工具使用和学习,并撤销其全部授权。已保存的数据不会删除。`:`Stop tool access and learning for this account and revoke all its authorizations. Saved data will not be deleted.`,confirmLabel:i?`断开`:`Disconnect`,cancelLabel:t.modalCancel,destructive:!0,onConfirm:()=>{let e=R;z(null),e&&De(()=>We(e))},onCancel:()=>z(null)}),(0,$.jsx)(ae,{open:I!==null,title:t.composioRevoke,description:t.composioRevokeConfirm,confirmLabel:t.composioRevoke,cancelLabel:t.modalCancel,destructive:!0,onConfirm:()=>{let e=I;L(null),e&&De(()=>Ze(e))},onCancel:()=>L(null)})]})}var mn=p(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,H);function hn(e,t){let n={};for(let r of e?.setup.config??[]){let e=t.config?.[r.key]??r.defaultValue??``;n[r.key]=typeof e==`string`?e:JSON.stringify(e,null,2)}return n}function gn(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function _n({instance:e,definition:t,onClose:n,onChanged:r,t:i}){let[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),[f,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_,T]=(0,Q.useState)(()=>hn(t,e)),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(null),M=t?.setup.config??[],F=(e.materialized.type===`mcp`||e.materialized.type===`memorySource`)&&M.length>0&&(t?.setup.secrets??[]).length===0,L=e.materialized.type===`mcp`,R=e.materialized.type===`composio`,z=e.materialized.type===`memorySource`,B=t?X(t,i):null,H=(0,Q.useCallback)(async()=>{k(!0),D(null);try{let t=await N(e.instanceId);j(t),t.ok||D(t.error??t.action??i.healthStatusLabels[t.status]),await r()}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(!1)}},[e.instanceId,r,i.healthStatusLabels]),U=(0,Q.useCallback)(async()=>{o(!0),D(null);try{await pe(e.instanceId),await r(),n()}catch(e){D(e instanceof Error?e.message:String(e)),o(!1)}},[e.instanceId,r,n]),W=(0,Q.useCallback)(async()=>{if(!(!t||!F)){u(!0),D(null);try{let n={};for(let e of t.setup.config??[]){let t=gn(e.type,_[e.key]??``);t!==void 0&&(n[e.key]=t)}await we(e.instanceId,{config:n}),await r()}catch(e){D(e instanceof Error?e.message:String(e))}finally{u(!1)}}},[_,t,e.instanceId,r,F]),G=(0,Q.useCallback)(async()=>{m(!0),g(null),D(null);try{g((await P(e.connectorId)).recordIds.length),await r()}catch(e){D(e instanceof Error?e.message:String(e))}finally{m(!1)}},[e.connectorId,r]);return(0,$.jsxs)(w,{open:!0,onOpenChange:e=>{e||n()},children:[(0,$.jsxs)(x,{children:[(0,$.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(S,{className:p(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,R?`h-[min(100dvh-2rem,36rem)] w-[min(100%-2rem,40rem)]`:`h-[min(100dvh-2rem,44rem)] w-[min(100%-2rem,min(92vw,54rem))]`,`rounded-2xl border border-edge bg-surface-overlay shadow-float outline-none dark:border-edge`),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(ve,{connector:t,size:`lg`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(C,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,$.jsx)(y,{className:`mt-1 text-sm text-fg-muted`,children:B??(e.materialized.type===`mcp`?q(i.mcpServerRuntime,{serverId:e.materialized.serverId}):q(i.runtimeLabel,{runtime:e.materialized.type}))})]})]}),(0,$.jsx)(b,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:p(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,I.focusRingPanel),"aria-label":i.modalClose,children:[(0,$.jsx)(d,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[E?(0,$.jsx)(`p`,{className:`mb-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:E}):null,L?(0,$.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsx)(`p`,{className:`text-fg-muted`,role:`status`,children:A?.ok?q(i.toolsAvailable,{count:String(A.toolCount)}):A?i.healthStatusLabels[A.status]:e.usage.lastHealthStatus?i.healthStatusLabels[e.usage.lastHealthStatus]:i.healthNotTested}),(0,$.jsxs)(J,{variant:`secondary`,"aria-busy":O,disabled:O||!e.enabled,onClick:()=>void H(),children:[O?(0,$.jsx)(ne,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(Ie,{className:`size-4`,"aria-hidden":!0}),i.test]})]}),F?M.map(e=>(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:e.label}),e.description?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,$.jsx)(`input`,{className:mn,value:_[e.key]??``,placeholder:e.placeholder,onChange:t=>T(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key)):null]}):null,R?(0,$.jsx)(pn,{instance:e,t:i,onChanged:r}):null,z?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-edge bg-surface-base p-4 text-sm`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i.connectedSourceSync}),B?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:B}):null,h===null?null:(0,$.jsx)(`p`,{className:`mt-1 text-xs text-emerald-600`,children:q(i.connectedSourceSynced,{count:String(h)})})]}),(0,$.jsxs)(J,{disabled:f,onClick:()=>void G(),children:[f?(0,$.jsx)(ne,{className:`size-4 animate-spin`}):(0,$.jsx)(V,{className:`size-4`}),i.composioSyncNow]})]}),F?(0,$.jsx)(`div`,{className:`grid gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:M.map(e=>(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),e.description?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,$.jsx)(`input`,{className:mn,value:_[e.key]??``,placeholder:e.placeholder,onChange:t=>T(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]}):null,!L&&!R&&!z?(0,$.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:(0,$.jsx)(`p`,{children:i.connectorPolicyHint})}):null,(0,$.jsxs)(`details`,{className:`mt-5 rounded-xl border border-edge`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-fg-muted hover:text-danger`,children:i.dangerZone}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-danger/15 px-4 py-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i.removeConnectorHint}),(0,$.jsxs)(J,{variant:`secondary`,className:`shrink-0 border-danger/30 text-danger hover:bg-danger/10`,disabled:a,onClick:()=>c(!0),children:[a?(0,$.jsx)(ne,{className:`size-4 animate-spin`}):(0,$.jsx)(Ee,{className:`size-4`}),i.remove]})]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,$.jsx)(J,{variant:`secondary`,onClick:n,children:i.modalClose}),(L||z)&&F?(0,$.jsxs)(J,{variant:`primary`,disabled:l,onClick:()=>void W(),children:[l?(0,$.jsx)(ne,{className:`size-4 animate-spin`}):(0,$.jsx)(He,{className:`size-4`}),i.modalSave]}):null]})]})]}),(0,$.jsx)(ae,{open:s,title:q(i.removeConfirmTitle,{name:e.displayName}),description:i.removeConfirmDescription,confirmLabel:i.removeConfirmAction,cancelLabel:i.modalCancel,destructive:!0,onConfirm:()=>{c(!1),U()},onCancel:()=>{a||c(!1)}})]})}function vn(e){let t=(0,rt.c)(2),n;return t[0]===e?n=t[1]:(n=e.instance.materialized.type===`cli`&&e.definition?(0,$.jsx)(O,{definition:e.definition,instance:e.instance,onClose:e.onClose,onChanged:e.onChanged}):(0,$.jsx)(_n,{...e}),t[0]=e,t[1]=n),n}function yn(e){let t=(0,rt.c)(55),{instance:n,definition:r,highlighted:i,onOpenDetails:a,t:s}=e,c=i===void 0?!1:i,l;t[0]!==r||t[1]!==n?(l=ht(n,r),t[0]=r,t[1]=n,t[2]=l):l=t[2];let u=l.state,d;t[3]!==r||t[4]!==s?(d=r?X(r,s):null,t[3]=r,t[4]=s,t[5]=d):d=t[5];let f=d,m,h,g,_,v,y,b,x,S;if(t[6]!==u||t[7]!==r||t[8]!==c||t[9]!==n||t[10]!==a||t[11]!==s.connectionChecking||t[12]!==s.connectionNeedsSetup||t[13]!==s.connectionReady){m=u===`ready`?{label:s.connectionReady,Icon:o,className:`text-emerald-700 dark:text-emerald-300`}:u===`needs_setup`?{label:s.connectionNeedsSetup,Icon:de,className:`text-amber-700 dark:text-amber-300`}:{label:s.connectionChecking,Icon:Re,className:`text-fg-muted`},x=`button`;let e=c&&`bg-accent-soft`;t[23]===e?S=t[24]:(S=p(`flex w-full items-center gap-3 px-4 py-3.5 text-left hover:bg-surface-hover/60`,`rounded-none first:rounded-t-[calc(var(--radius-xl)-1px)] last:rounded-b-[calc(var(--radius-xl)-1px)]`,I.transition,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,e),t[23]=e,t[24]=S),t[25]!==n||t[26]!==a?(h=()=>a(n),t[25]=n,t[26]=a,t[27]=h):h=t[27],t[28]===r?g=t[29]:(g=(0,$.jsx)(ve,{connector:r}),t[28]=r,t[29]=g),b=`min-w-0 flex-1`,v=`flex min-w-0 items-center gap-2`,t[30]===n.displayName?y=t[31]:(y=(0,$.jsx)(`h3`,{className:`truncate text-sm font-medium text-fg`,children:n.displayName}),t[30]=n.displayName,t[31]=y),_=p(`inline-flex shrink-0 items-center gap-1 text-xs font-medium`,m.className),t[6]=u,t[7]=r,t[8]=c,t[9]=n,t[10]=a,t[11]=s.connectionChecking,t[12]=s.connectionNeedsSetup,t[13]=s.connectionReady,t[14]=m,t[15]=h,t[16]=g,t[17]=_,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S}else m=t[14],h=t[15],g=t[16],_=t[17],v=t[18],y=t[19],b=t[20],x=t[21],S=t[22];let C;t[32]===m.Icon?C=t[33]:(C=(0,$.jsx)(m.Icon,{className:`size-3.5`,"aria-hidden":!0}),t[32]=m.Icon,t[33]=C);let w;t[34]!==m.label||t[35]!==C||t[36]!==_?(w=(0,$.jsxs)(`span`,{className:_,children:[C,m.label]}),t[34]=m.label,t[35]=C,t[36]=_,t[37]=w):w=t[37];let T;t[38]!==w||t[39]!==v||t[40]!==y?(T=(0,$.jsxs)(`div`,{className:v,children:[y,w]}),t[38]=w,t[39]=v,t[40]=y,t[41]=T):T=t[41];let E;t[42]===f?E=t[43]:(E=f?(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:f}):null,t[42]=f,t[43]=E);let D;t[44]!==T||t[45]!==E||t[46]!==b?(D=(0,$.jsxs)(`div`,{className:b,children:[T,E]}),t[44]=T,t[45]=E,t[46]=b,t[47]=D):D=t[47];let O;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(Fe,{className:`size-4 shrink-0 text-fg-disabled`,"aria-hidden":!0}),t[48]=O):O=t[48];let k;return t[49]!==h||t[50]!==g||t[51]!==D||t[52]!==x||t[53]!==S?(k=(0,$.jsxs)(`button`,{type:x,className:S,onClick:h,children:[g,D,O]}),t[49]=h,t[50]=g,t[51]=D,t[52]=x,t[53]=S,t[54]=k):k=t[54],k}function bn(e,t){return Lt()}function xn(e){let t=e.headers.filter(e=>e.key.trim()),n=t.find(e=>e.key.toLowerCase()===`authorization`&&!e.reference&&/^Bearer\s/i.test(e.value)),r=e.extra.auth||t.some(e=>e.reference)||e.extra.oauth&&t.some(e=>e.key.toLowerCase()===`authorization`)?`existing`:e.extra.oauth?`oauth`:n?`bearer`:t.length?`headers`:`auto`;return{mode:r,token:n?.value.replace(/^Bearer\s+/i,``)??``,apiKey:``,headerName:``,customHeaders:t.length?t:[wt()],additionalHeaders:r===`bearer`?t.filter(e=>e!==n):r===`oauth`?t:[]}}function Sn(e,t){if(e.transport===`stdio`||t.mode===`existing`)return{...e,extra:{...e.extra}};let n={...e.extra};delete n.auth,t.mode!==`oauth`&&delete n.oauth;let r=t.mode===`headers`?t.customHeaders:t.additionalHeaders;if(t.mode===`bearer`){let e=t.token.trim().replace(/^Bearer\s+/i,``);r=[...r,wt(`Authorization`,`Bearer ${e}`)]}return t.mode===`apiKey`&&(r=[...r,wt(t.headerName.trim(),t.apiKey.trim())]),{...e,extra:n,headers:r,oauthClientId:t.mode===`oauth`?e.oauthClientId:``}}function Cn(e){let t=new Set;return e.findIndex(e=>{let n=e.key.trim();if(!n&&!e.value&&!e.reference)return!1;if(!/^[!#$%&'*+.^_`|~\da-z-]+$/i.test(n)||/[\r\n]/.test(e.value))return!0;let r=n.toLowerCase();return t.has(r)?!0:(t.add(r),!1)})}function wn(){return p(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,H)}function Tn({label:e,optionalLabel:t,addLabel:n,removeHeaderAria:r,pasteLabel:i,pasteFailed:a,pasteFailedTitle:o,dismissLabel:s,keyPlaceholder:c,valuePlaceholder:u,headers:d,onChange:f,referenceLabel:m=`Existing credential reference`,showValueLabel:h=`Show value`,hideValueLabel:g=`Hide value`,allowPaste:_=!0}){let[v,y]=(0,Q.useState)(new Set),[b,x]=(0,Q.useState)(!1),S=(e,t)=>{f(d.map((n,r)=>r===e?{...n,...t}:n))},C=()=>{f([...d,wt()])},w=e=>{let t=d.filter((t,n)=>n!==e);f(t.length>0?t:[wt()])},E=async()=>{try{let e=await T();if(!e){x(!0);return}let t=Et(e);if(!t?.length){x(!0);return}f(t)}catch{x(!0)}};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 md:col-span-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:e}),t?(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:t}):null]}),_?(0,$.jsxs)(J,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs`,onClick:()=>void E(),children:[(0,$.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),i]}):null]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:d.map((e,t)=>(0,$.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)_auto_auto]`,children:[(0,$.jsx)(`input`,{className:p(wn(),`col-span-3 min-w-0 font-mono text-xs sm:col-span-1`),"aria-label":`${c} ${t+1}`,value:e.key,placeholder:c,onChange:e=>S(t,{key:e.target.value})}),(0,$.jsx)(`input`,{className:p(wn(),`min-w-0 font-mono text-xs`),type:v.has(e.clientKey)?`text`:`password`,autoComplete:`off`,"aria-label":`${u} ${t+1}`,readOnly:!!e.reference,value:e.reference?m:e.value,placeholder:e.reference?m:u,onChange:e=>S(t,{value:e.target.value})}),(0,$.jsx)(J,{type:`button`,variant:`ghost`,className:`size-10 shrink-0 px-0`,disabled:!!e.reference,"aria-label":v.has(e.clientKey)?g:h,onClick:()=>y(t=>{let n=new Set(t);return n.has(e.clientKey)?n.delete(e.clientKey):n.add(e.clientKey),n}),children:v.has(e.clientKey)?(0,$.jsx)(K,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(l,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(J,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 px-0`,disabled:d.length<=1&&!e.key&&!e.value,onClick:()=>w(t),"aria-label":r,children:(0,$.jsx)(Ee,{className:`size-4 text-fg-subtle`,"aria-hidden":!0})}),e.reference?(0,$.jsx)(`p`,{className:`col-span-3 break-words text-xs text-fg-muted sm:col-span-4`,children:m}):null]},e.clientKey))}),(0,$.jsx)(ae,{open:b,title:o,description:a,confirmLabel:s,onConfirm:()=>x(!1),onCancel:()=>x(!1)}),(0,$.jsxs)(`button`,{type:`button`,className:p(`self-start text-sm text-accent hover:underline`,I.press),onClick:C,children:[`+ `,n]})]})}var En=p(`w-full min-w-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,H);function Dn(e){let t=(0,rt.c)(20),{value:n,onChange:r,label:i,t:a,required:o}=e,s=o===void 0?!1:o,[c,u]=(0,Q.useState)(!1),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=p(En,`mt-1.5`),t[0]=d):d=t[0];let f=c?`text`:`password`,m;t[1]===r?m=t[2]:(m=e=>r(e.target.value),t[1]=r,t[2]=m);let h;t[3]!==s||t[4]!==f||t[5]!==m||t[6]!==n?(h=(0,$.jsx)(`input`,{className:d,type:f,value:n,required:s,autoComplete:`off`,onChange:m}),t[3]=s,t[4]=f,t[5]=m,t[6]=n,t[7]=h):h=t[7];let g;t[8]!==i||t[9]!==h?(g=(0,$.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[i,h]}),t[8]=i,t[9]=h,t[10]=g):g=t[10];let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>u(On),t[11]=_):_=t[11];let v;t[12]===c?v=t[13]:(v=c?(0,$.jsx)(K,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(l,{className:`size-4`,"aria-hidden":!0}),t[12]=c,t[13]=v);let y=c?a.setupHideValue:a.setupShowValue,b;t[14]!==v||t[15]!==y?(b=(0,$.jsxs)(J,{type:`button`,variant:`ghost`,className:`gap-1.5 text-xs`,onClick:_,children:[v,y]}),t[14]=v,t[15]=y,t[16]=b):b=t[16];let x;return t[17]!==b||t[18]!==g?(x=(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[g,b]}),t[17]=b,t[18]=g,t[19]=x):x=t[19],x}function On(e){return!e}function kn(e){let t=(0,rt.c)(17),{headers:n,onChange:r,t:i,additional:a,environment:o}=e,s=a===void 0?!1:a,c=o===void 0?!1:o,l=c?i.envLabel:s?i.setupAdditionalHeaders:i.headersLabel,u=c?i.setupAddEnv:i.addHeader,d=c?i.setupRemoveEnv:i.removeHeader,f=c?i.setupEnvName:i.headerKeyPlaceholder,p=c?i.setupEnvValue:i.headerValuePlaceholder,m=!c,h;return t[0]!==n||t[1]!==r||t[2]!==i.optionalSuffix||t[3]!==i.pasteHeaders||t[4]!==i.pasteHeadersDismiss||t[5]!==i.pasteHeadersFailed||t[6]!==i.pasteHeadersFailedTitle||t[7]!==i.setupHideValue||t[8]!==i.setupReference||t[9]!==i.setupShowValue||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==f||t[14]!==p||t[15]!==m?(h=(0,$.jsx)(Tn,{label:l,optionalLabel:i.optionalSuffix,addLabel:u,removeHeaderAria:d,pasteLabel:i.pasteHeaders,pasteFailed:i.pasteHeadersFailed,pasteFailedTitle:i.pasteHeadersFailedTitle,dismissLabel:i.pasteHeadersDismiss,keyPlaceholder:f,valuePlaceholder:p,headers:n,onChange:r,referenceLabel:i.setupReference,showValueLabel:i.setupShowValue,hideValueLabel:i.setupHideValue,allowPaste:m}),t[0]=n,t[1]=r,t[2]=i.optionalSuffix,t[3]=i.pasteHeaders,t[4]=i.pasteHeadersDismiss,t[5]=i.pasteHeadersFailed,t[6]=i.pasteHeadersFailedTitle,t[7]=i.setupHideValue,t[8]=i.setupReference,t[9]=i.setupShowValue,t[10]=l,t[11]=u,t[12]=d,t[13]=f,t[14]=p,t[15]=m,t[16]=h):h=t[16],h}function An(e){let t=(0,rt.c)(52),{draft:n,onChange:r,t:i,allowExisting:a}=e,o=i.setupAuthLabel,s=i.setupAuthLabel,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=p(En,`mt-1.5`),t[0]=c):c=t[0];let l=n.mode,u;t[1]===r?u=t[2]:(u=e=>r({mode:e.target.value}),t[1]=r,t[2]=u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=[`auto`,`oauth`,`bearer`,`apiKey`,`headers`,`none`],t[3]=d):d=t[3];let f;t[4]===i.setupAuthModes?f=t[5]:(f=d.map(e=>(0,$.jsx)(ge,{value:e,children:i.setupAuthModes[e]},e)),t[4]=i.setupAuthModes,t[5]=f);let m;t[6]!==a||t[7]!==n.mode||t[8]!==i.setupAuthModes?(m=a||n.mode===`existing`?(0,$.jsx)(ge,{value:`existing`,children:i.setupAuthModes.existing}):null,t[6]=a,t[7]=n.mode,t[8]=i.setupAuthModes,t[9]=m):m=t[9];let h;t[10]!==n.mode||t[11]!==i.setupAuthLabel||t[12]!==u||t[13]!==f||t[14]!==m?(h=(0,$.jsxs)(qe,{"aria-label":s,className:c,value:l,onChange:u,children:[f,m]}),t[10]=n.mode,t[11]=i.setupAuthLabel,t[12]=u,t[13]=f,t[14]=m,t[15]=h):h=t[15];let g;t[16]!==i.setupAuthLabel||t[17]!==h?(g=(0,$.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[o,h]}),t[16]=i.setupAuthLabel,t[17]=h,t[18]=g):g=t[18];let _;t[19]!==n.mode||t[20]!==i.setupAuthAutoHint?(_=n.mode===`auto`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupAuthAutoHint}):null,t[19]=n.mode,t[20]=i.setupAuthAutoHint,t[21]=_):_=t[21];let v;t[22]!==n.mode||t[23]!==i.setupAuthOAuthHint?(v=n.mode===`oauth`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupAuthOAuthHint}):null,t[22]=n.mode,t[23]=i.setupAuthOAuthHint,t[24]=v):v=t[24];let y;t[25]!==n.mode||t[26]!==i.setupExistingHint?(y=n.mode===`existing`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupExistingHint}):null,t[25]=n.mode,t[26]=i.setupExistingHint,t[27]=y):y=t[27];let b;t[28]!==n.mode||t[29]!==n.token||t[30]!==r||t[31]!==i?(b=n.mode===`bearer`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Dn,{value:n.token,onChange:e=>r({token:e}),label:i.setupTokenLabel,t:i,required:!0}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupTokenHint})]}):null,t[28]=n.mode,t[29]=n.token,t[30]=r,t[31]=i,t[32]=b):b=t[32];let x;t[33]!==n.apiKey||t[34]!==n.headerName||t[35]!==n.mode||t[36]!==r||t[37]!==i?(x=n.mode===`apiKey`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[i.setupApiKeyHeader,(0,$.jsx)(`input`,{className:p(En,`mt-1.5`),placeholder:`x-api-key`,value:n.headerName,required:!0,onChange:e=>r({headerName:e.target.value})})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupApiKeyHint}),(0,$.jsx)(Dn,{value:n.apiKey,onChange:e=>r({apiKey:e}),label:`API Key`,t:i,required:!0})]}):null,t[33]=n.apiKey,t[34]=n.headerName,t[35]=n.mode,t[36]=r,t[37]=i,t[38]=x):x=t[38];let S;t[39]!==n.customHeaders||t[40]!==n.mode||t[41]!==r||t[42]!==i?(S=n.mode===`headers`?(0,$.jsx)(kn,{headers:n.customHeaders,onChange:e=>r({customHeaders:e}),t:i}):null,t[39]=n.customHeaders,t[40]=n.mode,t[41]=r,t[42]=i,t[43]=S):S=t[43];let C;return t[44]!==g||t[45]!==_||t[46]!==v||t[47]!==y||t[48]!==b||t[49]!==x||t[50]!==S?(C=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[g,_,v,y,b,x,S]}),t[44]=g,t[45]=_,t[46]=v,t[47]=y,t[48]=b,t[49]=x,t[50]=S,t[51]=C):C=t[51],C}function jn(e){let t=(0,rt.c)(8),{label:n,children:r,hint:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`span`,{children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i?(0,$.jsx)(`span`,{className:`block text-xs font-normal text-fg-muted`,children:i}):null,t[2]=i,t[3]=o);let s;return t[4]!==r||t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm font-medium text-fg`,children:[a,r,o]}),t[4]=r,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Mn({row:e,t,onUpdate:n}){let[r,i]=(0,Q.useState)(()=>Ot(e.envJson?JSON.parse(e.envJson):void 0)),[a,o]=(0,Q.useState)(!1),s=[];try{s=At(e.argsText)??[]}catch{}let c=e=>n({argsText:JSON.stringify(e)});return(0,$.jsxs)(`div`,{"data-field":`commandOptions`,className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.argsLabel}),(0,$.jsx)(J,{type:`button`,variant:`ghost`,onClick:()=>o(e=>!e),children:a?t.setupArgsRows:t.setupArgsPaste})]}),a?(0,$.jsx)(jn,{label:t.setupArgsPaste,hint:t.argsHint,children:(0,$.jsx)(`input`,{className:En,value:e.argsText,onChange:e=>n({argsText:e.target.value})})}):s.map((e,n)=>(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`input`,{className:En,"aria-label":`${t.argsLabel} ${n+1}`,value:e,onChange:e=>c(s.map((t,r)=>r===n?e.target.value:t))}),(0,$.jsx)(J,{type:`button`,variant:`ghost`,"aria-label":t.setupRemoveArg,onClick:()=>c(s.filter((e,t)=>t!==n)),children:(0,$.jsx)(Ee,{className:`size-4`,"aria-hidden":!0})})]},n)),a?null:(0,$.jsxs)(J,{type:`button`,variant:`ghost`,onClick:()=>c([...s,``]),children:[(0,$.jsx)(u,{className:`size-4`,"aria-hidden":!0}),t.setupAddArg]})]}),(0,$.jsx)(kn,{environment:!0,headers:r,t,onChange:e=>{i(e),n({envEntries:e,envJson:JSON.stringify(Dt(e)??{})})}})]})}function Nn(e){let t=(0,rt.c)(15),{row:n,t:r,onUpdate:i,variant:a,showOAuth:o,idReadOnly:s}=e,c=a===void 0?`all`:a,l=o===void 0?!1:o,u=s===void 0?!1:s,d=c!==`advanced`,f=c!==`basic`,p;t[0]!==d||t[1]!==i||t[2]!==n||t[3]!==r?(p=d?(0,$.jsxs)($.Fragment,{children:[n.transport===`stdio`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(jn,{label:`${r.commandLabel} *`,children:(0,$.jsx)(`input`,{"data-field":`command`,className:En,value:n.command,required:!0,onChange:e=>i({command:e.target.value})})}),(0,$.jsx)(Mn,{row:n,t:r,onUpdate:i})]}):(0,$.jsx)(jn,{label:`${r.urlLabel} *`,children:(0,$.jsx)(`input`,{"data-field":`url`,className:En,value:n.url,placeholder:`https://example.com/mcp`,required:!0,onChange:e=>i({url:e.target.value})})}),(0,$.jsx)(jn,{label:r.setupNameLabel,hint:r.setupNameHint,children:(0,$.jsx)(`input`,{className:En,value:n.displayName??``,placeholder:r.setupNamePlaceholder,onChange:e=>i({displayName:e.target.value})})})]}):null,t[0]=d,t[1]=i,t[2]=n,t[3]=r,t[4]=p):p=t[4];let m;t[5]!==f||t[6]!==u||t[7]!==i||t[8]!==n||t[9]!==l||t[10]!==r?(m=f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(jn,{label:r.serverIdLabel,hint:r.setupIdHint,children:(0,$.jsx)(`input`,{className:En,readOnly:u,value:n.id,onChange:e=>i({id:e.target.value}),placeholder:r.serverIdPlaceholder})}),n.transport===`stdio`?(0,$.jsx)(jn,{label:r.cwdLabel,children:(0,$.jsx)(`input`,{className:En,value:n.cwd,onChange:e=>i({cwd:e.target.value})})}):null,n.transport!==`stdio`&&l?(0,$.jsx)(jn,{label:r.oauthClientIdLabel,hint:r.oauthClientIdHint,children:(0,$.jsx)(`input`,{className:En,value:n.oauthClientId,onChange:e=>i({oauthClientId:e.target.value})})}):null,(0,$.jsx)(jn,{label:r.exposureLabel,hint:r.setupExposureHint,children:(0,$.jsx)(qe,{"aria-label":r.exposureLabel,className:En,value:n.exposure,onChange:e=>i({exposure:e.target.value}),children:[`codemode`,`deferred`,`direct`,`hidden`].map(e=>(0,$.jsx)(ge,{value:e,children:r.exposureLabels[e]},e))})}),(0,$.jsx)(jn,{label:r.requestTimeoutLabel,children:(0,$.jsx)(nt,{allowEmpty:!0,type:`number`,min:1,className:En,value:n.timeout??``,placeholder:r.setupDefaultTimeout,onChange:e=>i({timeout:e.target.value?Number(e.target.value):void 0})})})]}):null,t[5]=f,t[6]=u,t[7]=i,t[8]=n,t[9]=l,t[10]=r,t[11]=m):m=t[11];let h;return t[12]!==p||t[13]!==m?(h=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[p,m]}),t[12]=p,t[13]=m,t[14]=h):h=t[14],h}function Pn(e,t){let n=e;if(n?.status===429)return t.setupRateLimited;if(n?.status===401)return t.setupGatewayUnauthorized;if(n?.status===404||n?.status===409)return t.setupConflict;if(n?.status&&n.status>=500)return t.setupGatewayCheckFailed;let r={command_missing:t.setupCommandMissing,connection_refused:t.setupConnectionRefused,host_not_found:t.setupHostNotFound,timeout:t.setupTimedOut,access_denied:t.setupAccessDenied,network:t.setupServiceNetworkFailed,tls:t.setupTlsFailed,invalid_response:t.setupInvalidResponse,not_found:t.setupEndpointNotFound,rate_limited:t.setupServiceRateLimited,configuration:t.setupInvalidConfig};if(n?.errorCode&&Object.hasOwn(r,n.errorCode))return r[n.errorCode];let i=e instanceof Error?e.message:typeof e==`string`?e:n?.error??``;return/ENOENT|command not found|executable.{0,30}not found/i.test(i)?t.setupCommandMissing:/ECONNREFUSED|connection refused/i.test(i)?t.setupConnectionRefused:/ENOTFOUND|EAI_AGAIN|could not resolve/i.test(i)?t.setupHostNotFound:/timeout|timed out/i.test(i)?t.setupTimedOut:/fetch failed|failed to fetch|network error|NetworkError/i.test(i)?n?.error===void 0?t.setupGatewayNetworkFailed:t.setupServiceNetworkFailed:/\b(?:401|403)\b|unauthorized|forbidden|permission denied/i.test(i)?t.setupAccessDenied:t.setupCheckFailed}function Fn(e,t){return JSON.stringify({id:e.id,config:zt(Sn(e,t))})}function In(e,t){try{return Fn(e,t)}catch{return JSON.stringify({row:e,auth:t})}}function Ln(e){let{t,cs:n}=e,r=(0,Q.useId)(),[i,a]=(0,Q.useState)(e.initialRow),[s,l]=(0,Q.useState)(()=>xn(e.initialRow)),[u,f]=(0,Q.useState)(`idle`),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(!1),[b,T]=(0,Q.useState)(),[E,D]=(0,Q.useState)(),[O,k]=(0,Q.useState)(),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(!1),[P,F]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(``),[R,z]=(0,Q.useState)([]),[B,V]=(0,Q.useState)(`0`),[H,U]=(0,Q.useState)(0),[W,G]=(0,Q.useState)(``),[K,q]=(0,Q.useState)(!1),[ee,te]=(0,Q.useState)(!1),re=e.mode===`edit`,[ie,oe]=(0,Q.useState)(``),Y=(0,Q.useRef)(void 0),[se]=(0,Q.useState)(()=>In(e.initialRow,xn(e.initialRow))),ce=(0,Q.useRef)(e.mode===`edit`?e.initialRow.id:``),X=(0,Q.useRef)(void 0),Z=(0,Q.useRef)(void 0),le=(0,Q.useRef)(void 0),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(``),fe=(0,Q.useRef)(!0),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),he=(0,Q.useRef)(null),_e=(0,Q.useRef)(null),ve=(0,Q.useRef)(e.onSaved);ve.current=e.onSaved;let ye=O?.state===`starting`||O?.state===`authorizing`,be=u!==`idle`||ye,xe=se!==In(i,s),Se=i.extra.enabled===!1,Ce=!g&&(xe||!!P.trim());(0,Q.useEffect)(()=>(fe.current=!0,()=>{fe.current=!1,X.current?.abort(),ue.current?.close(),Y.current&&Ut(Y.current).catch(()=>{})}),[]),(0,Q.useEffect)(()=>{if(!Ce)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[Ce]),(0,Q.useEffect)(()=>{if(!b)return;let e=he.current?.querySelector(`[data-field="${b.field}"]`),t=e?.closest(`details`);t&&(t.open=!0);let n=e?.querySelector(`input,button,textarea`)??e;return n?.setAttribute(`aria-invalid`,`true`),n?.setAttribute(`aria-describedby`,r),b.focus!==!1&&(n??_e.current)?.focus(),()=>{n?.removeAttribute(`aria-invalid`),n?.removeAttribute(`aria-describedby`)}},[b,r]),(0,Q.useEffect)(()=>{if(!O||!ye)return;let e=new AbortController;Z.current=e;let n;async function r(){try{let n=await Kt(Y.current,e.signal);if(e.signal.aborted||(k(n),n.authorizationUrl&&de.current!==n.authorizationUrl&&(de.current=n.authorizationUrl,window.electronAPI?.shell?.openExternalUrl?!(await window.electronAPI.shell.openExternalUrl(n.authorizationUrl)).ok&&!e.signal.aborted&&h(t.oauthOpenFailed):ue.current&&!ue.current.closed&&ue.current.location.replace(n.authorizationUrl)),e.signal.aborted))return;if(n.state===`connected`){le.current=void 0,ue.current?.close(),D({state:`connected`,toolCount:n.toolCount}),h(``);return}if(n.state===`error`||n.state===`cancelled`){le.current=void 0,ue.current?.close(),h(n.state===`cancelled`?t.setupCancelled:t.setupAuthFailed),/client.{0,20}(id|registration)|register|registration/i.test(n.error??``)&&j(!0);return}}catch{if(e.signal.aborted)return;we(),ue.current?.close(),h(t.setupAuthFailed);return}n=setTimeout(()=>void r(),1200)}return r(),()=>{e.abort(),clearTimeout(n)}},[O?.id,ye,t.oauthOpenFailed,t.setupCancelled,t.setupAuthFailed]);function we(){X.current?.abort(),Z.current?.abort(),Y.current&&Ut(Y.current).catch(()=>{}),Y.current=void 0,oe(``),q(!1),D(void 0),k(void 0),h(``),T(void 0)}function Te(e){a(t=>({...t,...e})),we()}function Ee(e){l(t=>({...t,...e})),we()}function Oe(){u===`saving`||ye||(u===`checking`&&(we(),f(`idle`)),Ce?te(!0):e.onClose())}function ke(){try{z(It(P)),V(`0`),L(``)}catch{L(t.setupImportError),z([])}}function Ae(){let t=R[Number(B)];if(!t)return;let n={...t,id:ce.current||t.id,clientKey:e.initialRow.clientKey,extra:{...t.extra,...ce.current?{enabled:i.extra.enabled}:{}}};a(n),l(xn(n)),we(),U(e=>e+1),N(!1),F(``),z([])}function je(e){function n(e,t){return T({field:e,message:t}),!1}if(e.transport===`streamable-http`){try{e.url=Ft(e.url)}catch{return n(`url`,t.setupAddressInvalid)}if(s.mode===`bearer`&&!s.token.trim().replace(/^Bearer\s*/i,``)||s.mode===`apiKey`&&(!s.apiKey.trim()||!s.headerName.trim()))return n(`auth`,t.setupCredentialRequired);if(Cn(e.headers)>=0)return n(`auth`,t.setupHeaderInvalid);if(s.mode===`oauth`&&e.headers.some(e=>e.key.trim().toLowerCase()===`authorization`))return n(`auth`,t.setupOAuthHeaderConflict);if(s.mode===`headers`&&!e.headers.some(e=>e.key.trim()&&(e.value.trim()||e.reference)))return n(`auth`,t.setupCredentialRequired)}else if(!e.command.trim())return n(`command`,t.setupCommandRequired);if(e.timeout!==void 0&&(!Number.isFinite(e.timeout)||e.timeout<=0))return n(`advanced`,t.setupInvalidConfig);try{zt(e)}catch(r){return n(e.transport===`stdio`?`commandOptions`:`advanced`,r instanceof Error&&r.message.startsWith(`Environment`)?t.setupEnvInvalid:t.setupInvalidConfig)}return!0}async function Me(){h(``),f(`checking`),de.current=``,window.electronAPI?.shell?.openExternalUrl||(ue.current=window.open(`about:blank`,`_blank`),ue.current&&(ue.current.opener=null));try{let e=await Gt(Y.current);if(!fe.current){ue.current?.close(),Y.current&&Ut(Y.current).catch(()=>{});return}le.current=e.id,k(e)}catch{ue.current?.close(),fe.current&&h(t.setupAuthFailed)}finally{fe.current&&f(`idle`)}}async function Ne(){let r=Sn(i,s);if(!je(r))return;let o=e.existingCustomServers.filter(t=>t.clientKey!==e.initialRow.clientKey&&t.id!==ce.current),c=new Set([...e.managedServerIds,...o.map(e=>e.id)]);if(r.id=ce.current||r.id.trim()||Pt(r,c),!/^[a-zA-Z0-9_-]+$/.test(r.id)||[...c].some(e=>e.replace(/-/g,`_`)===r.id.replace(/-/g,`_`))){T({field:`advanced`,message:n.duplicateServerId});return}we(),f(`checking`);let l=new AbortController;X.current=l;try{let n=await Vt(r,ce.current||void 0,e.initialRow.extra,l.signal);if(!fe.current||l.signal.aborted){Ut(n.id).catch(()=>{});return}Y.current=n.id,a(r),oe(In(r,s));let i=await Ht(n.id,l.signal);if(!fe.current||l.signal.aborted)return;D(i),i.state===`error`&&h(Pn(i,t))}catch(e){fe.current&&!l.signal.aborted&&h(e.status===409?t.setupConflict:Pn(e,t))}finally{fe.current&&X.current===l&&f(`idle`)}}async function Pe(n=!1){if(!(!Y.current||E?.state!==`connected`||ie!==In(i,s))){f(`saving`),h(``);try{let t=await Wt(Y.current,n);Y.current=void 0,await ve.current().catch(()=>{}),t?.reloadRequired?_(!0):e.onClose()}catch(e){let n=e.status;n===404||n===409?(we(),h(t.setupConflict)):h(t.setupSaveFailed)}finally{fe.current&&f(`idle`)}}}async function Fe(){Z.current?.abort();let e=Y.current;le.current=void 0,k(void 0),ue.current?.close(),h(t.setupCancelled),f(`checking`);try{e&&await qt(e)}catch{fe.current&&(we(),h(t.setupCancelled))}finally{fe.current&&f(`idle`)}}async function Ie(){O?.authorizationUrl&&(window.electronAPI?.shell?.openExternalUrl?(await window.electronAPI.shell.openExternalUrl(O.authorizationUrl)).ok||h(t.oauthOpenFailed):window.open(O.authorizationUrl,`_blank`,`noopener,noreferrer`))}async function Le(){if(O)try{await Jt(Y.current,W),G(``),h(``)}catch{h(t.setupRedirectInvalid)}}let Re=!!Y.current&&ie===In(i,s)&&(s.mode===`oauth`||s.mode===`auto`&&E?.state===`oauth_required`)&&E?.state!==`connected`,ze=/^(?:https?:\/\/)?(?:localhost|127\.0\.0\.1|\[::1\])(?=[:/]|$)/i.test(i.url.trim()),Be=R[Number(B)];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(w,{open:e.open,onOpenChange:e=>{e||Oe()},children:(0,$.jsxs)(x,{children:[(0,$.jsx)(v,{className:`fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(S,{ref:pe,tabIndex:-1,className:`fixed left-1/2 top-1/2 z-[60] flex h-[min(44rem,calc(100dvh-2rem))] w-[min(42rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay`,onOpenAutoFocus:e=>{e.preventDefault(),pe.current?.focus()},children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge p-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(C,{className:`font-semibold`,children:e.mode===`edit`?t.setupEditTitle:t.setupTitle}),(0,$.jsx)(y,{className:`mt-1 text-sm text-fg-muted`,children:t.setupHint})]}),(0,$.jsx)(`button`,{type:`button`,disabled:u===`saving`||ye,onClick:Oe,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover disabled:opacity-50`,"aria-label":n.modalClose,children:(0,$.jsx)(d,{className:`size-5`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-5`,children:[M?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(J,{variant:`ghost`,onClick:()=>N(!1),children:t.setupImportBack}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.setupImportEmpty}),(0,$.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[t.setupImport,(0,$.jsx)(`textarea`,{className:p(En,`mt-1.5 min-h-40 font-mono text-xs`),value:P,placeholder:`{"mcpServers": {"docs": {"url": "https://example.com/mcp"}}}`,onChange:e=>{F(e.target.value),z([]),L(``)}})]}),(0,$.jsx)(J,{variant:`secondary`,disabled:!P.trim(),onClick:ke,children:t.setupImportPreview}),I?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:I}):null,Be?(0,$.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.setupImportScope}),(0,$.jsxs)(`label`,{className:`block text-sm font-medium`,children:[t.setupImportChoose,(0,$.jsx)(qe,{"aria-label":t.setupImportChoose,className:p(En,`mt-1.5`),value:B,onChange:e=>V(e.target.value),children:R.map((e,t)=>(0,$.jsx)(ge,{value:String(t),children:e.displayName||e.id||tn(e)},t))})]}),(0,$.jsxs)(`p`,{className:`break-all text-sm text-fg-muted`,children:[Be.transport===`stdio`?t.setupUseCommand:t.setupUseUrl,` · `,tn(Be)]})]}):null]}):(0,$.jsxs)(`form`,{ref:he,noValidate:!0,onBlurCapture:e=>{if(e.target instanceof HTMLInputElement&&e.target.dataset.field===`url`&&i.url.trim())try{Ft(i.url)}catch{T({field:`url`,message:t.setupAddressInvalid,focus:!1})}},onSubmit:e=>{e.preventDefault(),Ne()},children:[(0,$.jsxs)(`fieldset`,{disabled:be||g,className:`min-w-0 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(De,{className:`flex gap-1`,role:`group`,"aria-label":t.transportLabel,children:[`streamable-http`,`stdio`].map(e=>(0,$.jsx)(J,{type:`button`,variant:i.transport===e?`secondary`:`ghost`,"aria-pressed":i.transport===e,onClick:()=>Te({transport:e}),children:e===`stdio`?t.setupUseCommand:t.setupUseUrl},e))}),(0,$.jsx)(J,{type:`button`,variant:`ghost`,onClick:()=>N(!0),children:t.setupImport})]}),(0,$.jsx)(`div`,{children:(0,$.jsx)(Nn,{row:i,t,variant:`basic`,onUpdate:Te},`${i.transport}-${H}`)}),i.transport===`streamable-http`?(0,$.jsx)(`div`,{"data-field":`auth`,children:(0,$.jsx)(An,{allowExisting:!!i.extra.auth||i.headers.some(e=>!!e.reference),draft:s,onChange:Ee,t})}):null,b?(0,$.jsx)(`p`,{id:r,ref:_e,tabIndex:-1,role:`alert`,className:`text-sm text-danger`,children:b.message}):null,(0,$.jsxs)(`details`,{"data-field":`advanced`,className:`rounded-lg border border-edge p-3`,open:A,onToggle:e=>j(e.currentTarget.open),children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:t.setupAdvanced}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsx)(Nn,{row:i,t,variant:`advanced`,idReadOnly:re,showOAuth:s.mode===`oauth`,onUpdate:Te}),i.transport===`streamable-http`&&s.mode!==`headers`&&s.mode!==`existing`?(0,$.jsx)(kn,{additional:!0,headers:s.additionalHeaders,onChange:e=>Ee({additionalHeaders:e}),t}):null]})]}),(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:i.transport===`stdio`?t.setupCommandHostHint:ze?t.setupLocalhostHint:t.setupGatewayHint}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.setupTestNotice})]}),(0,$.jsx)(`button`,{type:`submit`,hidden:!0})]}),g?(0,$.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-fg`,children:t.setupReloadRequired}):null,!M&&!g?(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,"aria-live":`polite`,children:[u===`idle`?null:(0,$.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(ne,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),u===`saving`?t.setupSaving:t.setupChecking]}),u===`idle`&&re&&!xe&&!E&&!m&&!ye?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:Se?t.setupDisabled:e.lastCheck?t.setupLastCheck.replace(`{{count}}`,String(e.lastCheck.toolCount)):t.setupSavedUnchecked}):null,E?.state===`connected`?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-success`,children:[(0,$.jsx)(o,{className:`size-4 shrink-0`,"aria-hidden":!0}),E.toolCount?t.setupConnected.replace(`{{count}}`,String(E.toolCount)):t.setupZeroTools]}),(0,$.jsx)(J,{ref:me,variant:`secondary`,onClick:()=>q(!0),children:t.viewTools})]}):null,E?.state===`token_required`?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:t.setupNeedsAuth}):null,E?.state===`oauth_required`&&!ye?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.setupOAuthRequired}):null,ye?(0,$.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-4`,children:[(0,$.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(ne,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),t.setupAuthorizing]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[O?.authorizationUrl?(0,$.jsxs)(J,{variant:`secondary`,onClick:()=>void Ie(),children:[(0,$.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t.oauthOpenAuthorization]}):null,(0,$.jsx)(J,{variant:`ghost`,onClick:()=>void Fe(),children:t.setupCancelAuth})]}),O?.acceptsRedirect?(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm text-accent-fg`,children:t.setupRemoteFallback}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.setupRedirectHint}),(0,$.jsxs)(`label`,{className:`mt-2 block text-sm`,children:[t.setupRedirectLabel,(0,$.jsx)(`input`,{className:En,value:W,onChange:e=>G(e.target.value)})]}),(0,$.jsx)(J,{className:`mt-2`,disabled:!W.trim(),onClick:()=>void Le(),children:t.setupContinue})]}):null]}):null,m?(0,$.jsxs)(`div`,{role:`alert`,className:`space-y-1 text-sm`,children:[(0,$.jsx)(`p`,{className:`text-danger`,children:m}),m!==t.setupSaveFailed&&u!==`saving`?(0,$.jsx)(`p`,{className:`text-fg-muted`,children:t.setupTestFailure}):null]}):null]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge p-4`,children:[(0,$.jsx)(J,{variant:`secondary`,disabled:u===`saving`||ye,onClick:Oe,children:re||g?t.setupClose:n.modalCancel}),g?null:M?(0,$.jsx)(J,{variant:`primary`,disabled:!Be,onClick:Ae,children:t.setupImportApply}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{variant:E?.state===`connected`?`secondary`:`primary`,disabled:be,onClick:()=>Re?void Me():void Ne(),children:Re?t.setupSignIn:t.setupTestConnection}),E?.state===`connected`&&ie===In(i,s)?(0,$.jsxs)($.Fragment,{children:[Se?(0,$.jsx)(J,{variant:`secondary`,disabled:be,onClick:()=>void Pe(!0),children:t.setupEnableSave}):null,(0,$.jsx)(J,{variant:`primary`,disabled:be,"aria-busy":be,onClick:()=>void Pe(),children:re?t.setupSaveOnly:t.setupAddConnection})]}):null]})]})]})]})}),(0,$.jsx)(ae,{open:ee,title:t.setupUnsavedTitle,description:t.setupUnsavedHint,confirmLabel:t.setupDiscard,cancelLabel:t.setupKeepEditing,onCancel:()=>te(!1),onConfirm:e.onClose,overlayClassName:`z-[70]`,contentClassName:`z-[70]`}),K?(0,$.jsx)(Qt,{draftId:Y.current,serverId:i.id,displayName:i.displayName,returnFocusTo:me.current,t,onClose:()=>q(!1)}):null]})}var Rn=`builtin`,zn=`composio`,Bn=`xopc-store`;function Vn(e){return Rn}function Hn(e){let t=e.connectorManifest;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;if(n.contractVersion!==1||n.id!==e.name)return null;let r=n.runtime,i=n.auth;if(!r||typeof r!=`object`||Array.isArray(r)||!i||typeof i!=`object`||Array.isArray(i))return null;let a=r,o=i;if(a.type!==`mcp`||typeof a.serverId!=`string`)return null;let s=[`code`,`docs`,`browser`,`data`,`automation`,`custom`].includes(String(n.category??``))?n.category:`custom`,c=o.mode===`oauth`?{mode:`oauth`,...typeof o.clientId==`string`?{clientId:o.clientId}:{}}:o.mode===`apiKey`?{mode:`apiKey`}:{mode:`none`};return{id:e.name,version:e.latestVersion??`store`,displayName:typeof n.displayName==`string`?n.displayName:e.name,description:typeof n.description==`string`?n.description:e.description,category:s,kind:`mcp`,source:`store`,...e.branding?.iconUrl?{branding:{logoUrl:e.branding.iconUrl,source:`registry`}}:{},capabilities:Array.isArray(n.capabilities)?n.capabilities.filter(e=>typeof e==`string`):[],tags:Array.isArray(n.tags)?n.tags.filter(e=>typeof e==`string`):[`store`],auth:c,setup:n.setup&&typeof n.setup==`object`&&!Array.isArray(n.setup)?n.setup:{},runtime:{type:`mcp`,serverId:a.serverId}}}function Un(e){return e.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t)}function Wn(e){return e?.startsWith(`/`)&&!e.startsWith(`//`)?e:`/user-model`}function Gn({embedded:e=!1,onHeaderActionChange:t}){let n=ee().filter(e=>e.format===`agent-plugin`),r=g(e=>e.language),o=f(r),s=o.connectorsSettings,c=o.mcpSettings,l=h(e=>e.conversationId),u=!!l,d=i(),[m,_]=a(),v=m.get(`understanding`)===`1`,y=Wn(m.get(`returnTo`)),b=!!m.get(`returnTo`)&&!v,x=m.get(`tab`),[S,C]=(0,Q.useState)(!v&&x===`connected`?`connected`:`discover`),w=(0,Q.useRef)(!1),[T,E]=(0,Q.useState)({catalog:[],registryCatalog:[],instances:[],loading:!0,error:null}),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(1),[P,F]=(0,Q.useState)(void 0),[I,L]=(0,Q.useState)(``),[B,V]=(0,Q.useState)(v||b?m.get(`connector`)??``:``),[H,U]=(0,Q.useState)(Vn(v?`understanding`:`default`)),[W,G]=(0,Q.useState)(`name`),[K,q]=(0,Q.useState)(v?`understand`:`all`),[te,ie]=(0,Q.useState)(null),[ae,se]=(0,Q.useState)(null),[X,Z]=(0,Q.useState)(null),[le,de]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(null),[me,he]=(0,Q.useState)(null),{data:ge,mutate:_e}=D(u),ve=ge?.payload?.config,ye=(0,Q.useMemo)(()=>ve===void 0?null:Rt(ve),[ve]),be=ye?.servers??[],xe=T.instances.length+be.length+n.reduce((e,t)=>e+(t.components?.mcp.length??0),0),[Ce,we]=(0,Q.useState)({});(0,Q.useEffect)(()=>{if(we({}),!u||!ve)return;let e=new AbortController;return Xt(e.signal).then(t=>{e.signal.aborted||we(t)}).catch(()=>{}),()=>e.abort()},[u,ve]);let Te=(0,Q.useCallback)(async()=>{if(!l){E({catalog:[],registryCatalog:[],instances:[],loading:!1,error:null});return}E(e=>({...e,loading:!0,error:null}));try{let[e,t]=await Promise.all([Be(),Se()]);E(n=>({catalog:e,registryCatalog:n.registryCatalog,instances:t,loading:!1,error:null}))}catch(e){E({catalog:[],registryCatalog:[],instances:[],loading:!1,error:e instanceof Error?e.message:String(e)})}},[l]);(0,Q.useEffect)(()=>{Te()},[Te]),(0,Q.useEffect)(()=>{w.current||T.loading||u&&!ye||(C(v?`discover`:xe>0?`connected`:`discover`),w.current=!0)},[u,xe,ye,v,T.loading]);let Ee=(0,Q.useCallback)(e=>{w.current=!0,C(e)},[]),Oe=(0,Q.useMemo)(()=>[{id:zn,displayName:s.composioSourceName},{id:Bn,displayName:s.storeSourceName}],[s.composioSourceName,s.storeSourceName]),Ae=(0,Q.useCallback)(async e=>{if(!u||H===`builtin`){E(e=>({...e,registryCatalog:[]})),N(1),F(void 0);return}let t=B.trim(),n=Math.max(e?.page??1,1),r=e?.append??!1,i=H===`all`?Oe:Oe.filter(e=>e.id===H);if(i.length!==0){k(!0),r?E(e=>({...e,error:null})):(N(1),F(void 0),E(e=>({...e,registryCatalog:[],error:null})));try{let e=await Promise.all(i.map(async e=>{if(e.id===`composio`){let e=await je({q:t||void 0,page:n,pageSize:24,verification:`experimental`});return{connectors:e.connectors,totalPages:e.meta.totalPages}}let r=await ue({q:t||void 0,page:n,pageSize:24,sort:W===`source`?`newest`:`downloads`});return{connectors:r.items.flatMap(e=>{let t=Hn(e);return t?[t]:[]}),totalPages:r.meta.totalPages}})),a=Un(e.flatMap(e=>e.connectors)),o=Math.max(1,...e.map(e=>e.totalPages??1));N(n),F(o),E(e=>({...e,registryCatalog:r?Un([...e.registryCatalog,...a]):a}))}catch(e){E(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{k(!1)}}},[W,B,H,u,Oe]);(0,Q.useEffect)(()=>{if(S!==`discover`||T.loading)return;if(H===`builtin`){E(e=>({...e,registryCatalog:[]})),N(1),F(void 0);return}let e=window.setTimeout(()=>{Ae()},B.trim()?350:0);return()=>window.clearTimeout(e)},[B,H,Ae,T.loading,S]);let Me=(0,Q.useMemo)(()=>new Set(T.instances.map(e=>e.connectorId)),[T.instances]),Pe=(0,Q.useMemo)(()=>new Map([...T.catalog,...T.registryCatalog].map(e=>[e.id,e])),[T.catalog,T.registryCatalog]);(0,Q.useEffect)(()=>{if(T.loading)return;let e=m.get(`connector`),t=m.get(`instance`);if(!e&&!t)return;let n=T.instances.find(n=>t?n.instanceId===t:n.connectorId===e);if(n)w.current=!0,L(``),Z(n.instanceId),de(n),C(`connected`);else if(e){let t=Pe.get(e);if(!t)return;w.current=!0,U(Vn(v?`understanding`:`default`)),V(``),se(t),C(`discover`)}let r=new URLSearchParams(m);r.delete(`connector`),r.delete(`instance`),r.set(`tab`,n?`connected`:`discover`),_(r,{replace:!0})},[Pe,v,m,_,T.instances,T.loading]);let Fe=(0,Q.useCallback)(async e=>{j(!0),E(e=>({...e,error:null}));try{let t=await Ne(e);ie(R(t.definition,{packageName:t.packageName,version:t.version,reviewHash:t.reviewHash,permissions:t.permissions}))}catch(e){E(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{j(!1)}},[]),Ie=(0,Q.useMemo)(()=>new Set(T.instances.flatMap(e=>e.materialized.type===`mcp`?[e.materialized.serverId]:[])),[T.instances]),Le=(0,Q.useCallback)(async e=>{let t=await Zt(e);await _e(),await Te(),t.reloadRequired&&E(e=>({...e,error:c.setupReloadRequired}))},[Te,_e,c.setupReloadRequired]),Re=(0,Q.useCallback)(()=>{he({mode:`add`,row:bn(be,Ie)})},[be,Ie]),He=re(e=>e.setPageHeader),Ue=re(e=>e.clearPageHeader),We=(0,Q.useMemo)(()=>({searchLabel:S===`connected`?s.connectedSearchPlaceholder:s.discoverSearchPlaceholder,search:(0,$.jsx)(Qe,{value:S===`connected`?I:B,onChange:S===`connected`?L:V,placeholder:S===`connected`?s.connectedSearchPlaceholder:s.discoverSearchPlaceholder}),secondary:(0,$.jsx)(Ct,{onRefresh:S===`connected`&&u?Te:void 0,refreshing:T.loading,refreshLabel:s.refreshConnections,onBrowseCatalog:()=>Ee(`discover`),onAddCustomServer:Re,addLabel:s.addConnection,browseLabel:s.addFromCatalog,customLabel:s.addCustomServerAdvanced,serviceLabel:r.startsWith(`zh`)?`应用连接服务`:`Connection service`,moreActionsLabel:o.capabilitiesHub.moreActions})}),[I,s,B,u,r,Te,o.capabilitiesHub.moreActions,Re,Ee,T.loading,S]);(0,Q.useLayoutEffect)(()=>e?(t?.(We),()=>t?.(null)):(He({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:s.title})}),end:(0,$.jsx)($e,{contribution:We})}),()=>Ue()),[Ue,s.title,e,We,t,He]);let Ge=(0,Q.useMemo)(()=>T.instances.map(e=>({instance:e,value:ht(e,Pe.get(e.connectorId))})),[Pe,T.instances]),Ke=(0,Q.useMemo)(()=>new Map(Ge.map(({instance:e,value:t})=>[e.instanceId,t])),[Ge]),qe=(0,Q.useMemo)(()=>T.instances.filter(e=>ce(e,I)).sort((e,t)=>{let n={needs_setup:0,checking:1,ready:2},r=Ke.get(e.instanceId)?.state??`checking`,i=Ke.get(t.instanceId)?.state??`checking`;return n[r]-n[i]||e.displayName.localeCompare(t.displayName)}),[I,Ke,T.instances]),Je=(0,Q.useMemo)(()=>qe.filter(e=>Ke.get(e.instanceId)?.state===`needs_setup`),[Ke,qe]),Ye=(0,Q.useMemo)(()=>qe.filter(e=>Ke.get(e.instanceId)?.state!==`needs_setup`),[Ke,qe]),Xe=(0,Q.useMemo)(()=>be.filter(e=>ze(e,I)),[I,be]),Ze=(0,Q.useMemo)(()=>{let e=I.trim().toLowerCase();return n.flatMap(t=>(t.components?.mcp??[]).filter(n=>`${t.name} ${n.name}`.toLowerCase().includes(e)).map(e=>({extension:t,server:e})))},[I,n]),et=qe.length+Xe.length+Ze.length,nt=(0,Q.useMemo)(()=>T.catalog.filter(e=>e.source===`builtin`&&e.integrationStrategy?.preferred!==!1&&oe(e)),[T.catalog]),rt=(0,Q.useMemo)(()=>H===`builtin`?nt:H===`all`?Un([...nt,...T.registryCatalog]):T.registryCatalog,[nt,H,T.registryCatalog]),at=(0,Q.useMemo)(()=>{let e=v?rt.filter(e=>e.understanding?.mode===`activity`):rt;return z(K===`all`?e:e.filter(e=>pt(e).includes(K)),B,W)},[W,B,rt,v,K]),ct=(0,Q.useMemo)(()=>ft.filter(e=>rt.some(t=>pt(t).includes(e))),[rt]);(0,Q.useEffect)(()=>{K!==`all`&&!ct.includes(K)&&q(`all`)},[ct,K]);let ut=S===`discover`&&H!==`builtin`&&!!(P&&M<P),mt=(0,Q.useMemo)(()=>T.instances.find(e=>e.instanceId===X)??le,[X,le,T.instances]),gt=(0,Q.useMemo)(()=>[{value:`all`,label:s.discoverSourceAll},{value:Rn,label:s.discoverSourceBuiltin},...Oe.map(e=>({value:e.id,label:e.displayName}))],[s.discoverSourceAll,s.discoverSourceBuiltin,Oe]),_t=[{id:`connected`,label:s.tabConnected,count:xe},{id:`discover`,label:s.tabDiscover}];return(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:p(`mx-auto flex w-full max-w-7xl flex-col gap-6 px-4 sm:px-6 lg:px-8`,e?`pb-7 pt-3 lg:pb-9 lg:pt-4`:`py-7 lg:py-9`),children:[u?null:(0,$.jsx)(`p`,{className:`rounded-xl border border-edge bg-surface-panel px-4 py-3 text-sm text-fg-muted`,children:s.tokenHint}),v?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent-soft px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:s.understandingSetupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.understandingSetupHint})]}),(0,$.jsx)(J,{type:`button`,variant:`secondary`,className:`shrink-0`,onClick:()=>d(y),children:s.understandingSetupDone})]}):null,b?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent-soft px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:s.recoverySetupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.recoverySetupHint})]}),(0,$.jsx)(J,{type:`button`,variant:`secondary`,className:`min-h-11 shrink-0`,onClick:()=>d(y),children:s.recoverySetupDone})]}):null,(0,$.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,$.jsx)(Ve,{items:_t,activeTab:S,onChange:Ee,ariaLabel:s.navAria,tabIdPrefix:`connectors-tab`,panelIdPrefix:`connectors-panel`,className:`flex-wrap`})}),T.error?(0,$.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:T.error}):null,S===`connected`&&u?(0,$.jsx)(`div`,{className:`flex flex-col gap-6`,children:T.loading?(0,$.jsx)(`div`,{className:`grid gap-3`,"aria-busy":`true`,"aria-label":s.loading,children:ot.slice(0,3).map(e=>(0,$.jsx)(dt,{},e))}):xe===0?(0,$.jsxs)(`div`,{className:`py-14 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.connectionsEmpty}),(0,$.jsx)(J,{type:`button`,variant:`primary`,className:`mt-4`,onClick:()=>Ee(`discover`),children:s.addFromCatalog})]}):et===0?(0,$.jsx)(`div`,{className:`py-14 text-center text-sm text-fg-muted`,children:s.connectionsSearchEmpty}):(0,$.jsxs)(`div`,{className:`space-y-6`,children:[Je.length?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:s.needsAttentionTitle}),(0,$.jsx)(`span`,{className:`text-xs tabular-nums text-amber-700 dark:text-amber-300`,children:Je.length})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-amber-500/25 bg-amber-500/5`,children:Je.map(e=>(0,$.jsx)(yn,{instance:e,definition:Pe.get(e.connectorId),highlighted:e.instanceId===fe,onOpenDetails:e=>{pe(null),Z(e.instanceId),de(e)},t:s},e.instanceId))})]}):null,Ye.length?(0,$.jsx)(`section`,{children:(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:Ye.map(e=>(0,$.jsx)(yn,{instance:e,definition:Pe.get(e.connectorId),highlighted:e.instanceId===fe,onOpenDetails:e=>{pe(null),Z(e.instanceId),de(e)},t:s},e.instanceId))})}):null,Ze.map(({extension:e,server:t})=>(0,$.jsx)(tt,{pluginId:e.pluginId,server:t,enabled:e.active},t.id)),Xe.length||!I.trim()?(0,$.jsxs)(`section`,{"aria-label":s.customIntegrationsTitle,className:`rounded-xl border border-edge bg-surface-base`,children:[(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,$.jsx)(`h2`,{className:`inline text-sm font-medium text-fg`,children:s.customIntegrationsTitle}),(0,$.jsx)(`span`,{className:`ml-2 text-xs tabular-nums text-fg-subtle`,children:Xe.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:s.customIntegrationsHint})]}),(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2 px-4 py-3`,children:(0,$.jsx)(J,{type:`button`,variant:`secondary`,className:`h-8 text-xs`,onClick:Re,children:s.addCustomServerAdvanced})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Xe.map(e=>(0,$.jsx)(nn,{row:e,lastCheck:Ce[e.id],t:c,cs:s,onEdit:()=>he({mode:`edit`,row:structuredClone(e)}),onRemove:async()=>Le(e)},e.clientKey))})]})]}):null]})}):null,S===`discover`&&u?(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[v?null:(0,$.jsx)(De,{className:`flex min-w-0 flex-1 basis-80 flex-wrap gap-2`,role:`group`,"aria-label":s.taskFilterAria,indicatorClassName:`rounded-lg bg-surface-active`,children:[`all`,...ct].map(e=>(0,$.jsx)(`button`,{type:`button`,className:p(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,K===e?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":K===e,onClick:()=>q(e),children:e===`all`?s.taskAll:s.connectorBenefitHeadings[e]},e))}),(0,$.jsxs)(`div`,{className:p(`ml-auto grid w-full gap-2 sm:flex sm:w-auto sm:justify-end`,v?`grid-cols-1`:`grid-cols-2`),children:[v?null:(0,$.jsx)(`div`,{className:`min-w-0 sm:w-40`,children:(0,$.jsx)(ke,{value:H,options:gt,placeholder:s.discoverSourceAll,allowEmpty:!1,ariaLabel:s.registrySourceAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:U})}),(0,$.jsx)(`div`,{className:`min-w-0 sm:w-40`,children:(0,$.jsx)(ke,{value:W,options:[{value:`name`,label:s.sortName},{value:`source`,label:s.sortSource}],placeholder:s.sortName,allowEmpty:!1,ariaLabel:s.sortAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:e=>G(e)})})]})]}),(T.loading||O)&&at.length===0?(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-busy":`true`,"aria-label":s.loading,children:ot.map(e=>(0,$.jsx)(lt,{},e))}):at.length===0?(0,$.jsx)(`div`,{className:`py-14 text-center text-sm text-fg-muted`,children:s.discoverEmpty}):(0,$.jsxs)(`div`,{className:`relative`,children:[O?(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":s.loading,children:(0,$.jsx)(ne,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:at.map(e=>(0,$.jsx)(it,{connector:e,installed:Me.has(e.id)||st(e,T.instances),onInstall:e=>{if(e.source===`store`){Fe(e.id);return}ie(R(e))},onOpenDetails:e.source===`store`?void 0:se,t:s},e.id))}),ut?(0,$.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,$.jsxs)(J,{type:`button`,variant:`secondary`,disabled:O||A,onClick:()=>void Ae({page:M+1,append:!0}),children:[O?(0,$.jsx)(ne,{className:`size-4 animate-spin`}):null,s.loadMore]})}):null]})]}):null]}),te?(0,$.jsx)(Y,{draft:te,onChange:ie,onClose:()=>ie(null),t:s,onInstalled:async e=>{await Te(),await _e(),pe(e.instanceId),Ee(`connected`)}}):null,ae?(0,$.jsx)(yt,{connector:ae,installed:Me.has(ae.id)||st(ae,T.instances),onClose:()=>se(null),onInstall:e=>ie(R(e)),t:s}):null,mt?(0,$.jsx)(vn,{instance:mt,definition:Pe.get(mt.connectorId),onClose:()=>{Z(null),de(null)},onChanged:Te,t:s,mcp:c}):null,me?(0,$.jsx)(Ln,{open:!0,mode:me.mode,initialRow:me.row,lastCheck:me.mode===`edit`?Ce[me.row.id]:void 0,existingCustomServers:be,config:ve,managedServerIds:Ie,t:c,cs:s,onClose:()=>he(null),onSaved:async()=>{await _e(),await Te(),Ee(`connected`)}},`${me.mode}-${me.row.clientKey}`):null]})})}export{Gn as ConnectorsPage};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-0WouolD0.js";import{n as a}from"./locale-store-CE7L6MlS.js";import{Ds as o,Es as ee,gs as te,hs as ne,lf as re,ms as ie,of as ae,sf as oe,xs as se}from"./index-BvAvfZ5R.js";var s=e(t(),1),ce=n();function c(e){return String(e).padStart(2,`0`)}function le(e){return`${e.getFullYear()}-${c(e.getMonth()+1)}-${c(e.getDate())}`}function ue(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2])-1,i=Number(t[3]),a=new Date(n,r,i,12);return a.getFullYear()===n&&a.getMonth()===r&&a.getDate()===i?a:null}function de(e,t){let n=ue(e);return n?t===`zh`?`${n.getFullYear()}/${c(n.getMonth()+1)}/${c(n.getDate())}`:new Intl.DateTimeFormat(`en`,{year:`numeric`,month:`short`,day:`numeric`}).format(n):``}var l=r();function fe(e,t){let n=new Date(e.getFullYear(),e.getMonth(),1,12),r=(n.getDay()-t+7)%7;return Array.from({length:42},(e,t)=>new Date(n.getFullYear(),n.getMonth(),1-r+t,12))}function u(e){let t=(0,ce.c)(105),{value:n,onChange:r,disabled:c,className:u,ariaLabel:_e,placeholder:ve,min:d,max:f}=e,p=a(ge),m=p===`zh`?`zh-CN`:`en`,ye;t[0]===n?ye=t[1]:(ye=ue(n),t[0]=n,t[1]=ye);let h=ye,[g,be]=(0,s.useState)(!1),[xe,Se]=(0,s.useState)(null),_;t[2]===h?_=t[3]:(_=()=>h??new Date,t[2]=h,t[3]=_);let[v,Ce]=(0,s.useState)(_),we=ie(xe),Te=te(ne(),we!==null),y=+(p===`zh`),b,x;t[4]!==g||t[5]!==n?(b=()=>{if(!g)return;let e=ue(n);e&&Ce(e)},x=[g,n],t[4]=g,t[5]=n,t[6]=b,t[7]=x):(b=t[6],x=t[7]),(0,s.useEffect)(b,x);let S;t[8]!==v||t[9]!==y?(S=fe(v,y),t[8]=v,t[9]=y,t[10]=S):S=t[10];let Ee=S,C;if(t[11]!==m||t[12]!==y){let e=new Date(2026,7,23,12);C=Array.from({length:7},(t,n)=>{let r=new Date(e);return r.setDate(e.getDate()+y+n),new Intl.DateTimeFormat(m,{weekday:`narrow`}).format(r)}),t[11]=m,t[12]=y,t[13]=C}else C=t[13];let De=C,w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=le(new Date),t[14]=w):w=t[14];let T=w,E;t[15]===h?E=t[16]:(E=h?le(h):``,t[15]=h,t[16]=E);let D=E,O;t[17]!==m||t[18]!==v?(O=new Intl.DateTimeFormat(m,{year:`numeric`,month:`long`}).format(v),t[17]=m,t[18]=v,t[19]=O):O=t[19];let Oe=O,k;t[20]===r?k=t[21]:(k=e=>{r(e),be(!1)},t[20]=r,t[21]=k);let A=k,ke=o,Ae=c&&`cursor-not-allowed opacity-50`,j;t[22]!==u||t[23]!==Ae?(j=i(`flex h-10 w-full min-w-0 items-center justify-between gap-3 rounded-lg bg-surface-hover px-3 text-left text-sm text-fg outline-none transition-colors`,`hover:bg-surface-active focus-visible:ring-2 focus-visible:ring-accent/40`,Ae,u),t[22]=u,t[23]=Ae,t[24]=j):j=t[24];let je=!n&&`text-fg-subtle`,M;t[25]===je?M=t[26]:(M=i(`min-w-0 truncate tabular-nums`,je),t[25]=je,t[26]=M);let N;t[27]!==p||t[28]!==ve||t[29]!==n?(N=de(n,p)||ve||(p===`zh`?`选择日期`:`Select date`),t[27]=p,t[28]=ve,t[29]=n,t[30]=N):N=t[30];let P;t[31]!==M||t[32]!==N?(P=(0,l.jsx)(`span`,{className:M,children:N}),t[31]=M,t[32]=N,t[33]=P):P=t[33];let F;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,l.jsx)(re,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[34]=F):F=t[34];let I;t[35]!==_e||t[36]!==c||t[37]!==j||t[38]!==P?(I=(0,l.jsx)(ee,{asChild:!0,children:(0,l.jsxs)(`button`,{ref:Se,type:`button`,disabled:c,"aria-label":_e,className:j,children:[P,F]})}),t[35]=_e,t[36]=c,t[37]=j,t[38]=P,t[39]=I):I=t[39];let Me=o,Ne=we??void 0,Pe=o,Fe=i(Te,`w-[19rem] rounded-2xl border border-edge bg-surface-overlay p-3 shadow-float outline-none`),Ie=p===`zh`?`上个月`:`Previous month`,L,R;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>Ce(he),R=(0,l.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),t[40]=L,t[41]=R):(L=t[40],R=t[41]);let z;t[42]===Ie?z=t[43]:(z=(0,l.jsx)(`button`,{type:`button`,className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":Ie,onClick:L,children:R}),t[42]=Ie,t[43]=z);let B;t[44]===Oe?B=t[45]:(B=(0,l.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:Oe}),t[44]=Oe,t[45]=B);let Le=p===`zh`?`下个月`:`Next month`,V,Re;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>Ce(me),Re=(0,l.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),t[46]=V,t[47]=Re):(V=t[46],Re=t[47]);let H;t[48]===Le?H=t[49]:(H=(0,l.jsx)(`button`,{type:`button`,className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":Le,onClick:V,children:Re}),t[48]=Le,t[49]=H);let U;t[50]!==z||t[51]!==B||t[52]!==H?(U=(0,l.jsxs)(`div`,{className:`flex h-10 items-center justify-between gap-2 px-1`,children:[z,B,H]}),t[50]=z,t[51]=B,t[52]=H,t[53]=U):U=t[53];let W;t[54]===De?W=t[55]:(W=(0,l.jsx)(`div`,{className:`mt-2 grid grid-cols-7`,"aria-hidden":!0,children:De.map(pe)}),t[54]=De,t[55]=W);let G;if(t[56]!==Ee||t[57]!==m||t[58]!==f||t[59]!==d||t[60]!==A||t[61]!==D||t[62]!==v){let e;t[64]!==m||t[65]!==f||t[66]!==d||t[67]!==A||t[68]!==D||t[69]!==v?(e=e=>{let t=le(e),n=t===D,r=t===T,a=e.getMonth()!==v.getMonth(),o=!!(d&&t<d||f&&t>f);return(0,l.jsx)(`button`,{type:`button`,role:`gridcell`,"aria-selected":n,"aria-disabled":o,disabled:o,"aria-label":new Intl.DateTimeFormat(m,{dateStyle:`full`}).format(e),className:i(`mx-auto flex size-9 items-center justify-center rounded-xl text-sm tabular-nums text-fg transition-colors`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,a&&`text-fg-disabled`,o&&`cursor-not-allowed opacity-35 hover:bg-transparent`,r&&!n&&`bg-accent-soft font-semibold text-accent-fg`,n&&`bg-accent font-semibold text-on-accent hover:bg-accent-hover`),onClick:()=>A(t),children:e.getDate()},t)},t[64]=m,t[65]=f,t[66]=d,t[67]=A,t[68]=D,t[69]=v,t[70]=e):e=t[70],G=Ee.map(e),t[56]=Ee,t[57]=m,t[58]=f,t[59]=d,t[60]=A,t[61]=D,t[62]=v,t[63]=G}else G=t[63];let K;t[71]===G?K=t[72]:(K=(0,l.jsx)(`div`,{className:`grid grid-cols-7 gap-y-1`,role:`grid`,children:G}),t[71]=G,t[72]=K);let ze=!n,q;t[73]===A?q=t[74]:(q=()=>A(``),t[73]=A,t[74]=q);let Be=p===`zh`?`清除`:`Clear`,J;t[75]!==ze||t[76]!==q||t[77]!==Be?(J=(0,l.jsx)(`button`,{type:`button`,disabled:ze,className:`rounded-lg px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg disabled:pointer-events-none disabled:opacity-35`,onClick:q,children:Be}),t[75]=ze,t[76]=q,t[77]=Be,t[78]=J):J=t[78];let Ve=!!(d&&T<d||f&&T>f),Y;t[79]===A?Y=t[80]:(Y=()=>A(T),t[79]=A,t[80]=Y);let He=p===`zh`?`今天`:`Today`,X;t[81]!==Ve||t[82]!==Y||t[83]!==He?(X=(0,l.jsx)(`button`,{type:`button`,disabled:Ve,className:`rounded-lg bg-accent-soft px-2.5 py-1.5 text-xs font-medium text-accent-fg hover:bg-accent-soft/80 disabled:pointer-events-none disabled:opacity-35`,onClick:Y,children:He}),t[81]=Ve,t[82]=Y,t[83]=He,t[84]=X):X=t[84];let Z;t[85]!==J||t[86]!==X?(Z=(0,l.jsxs)(`div`,{className:`mt-2 flex items-center justify-between px-1 pt-1`,children:[J,X]}),t[85]=J,t[86]=X,t[87]=Z):Z=t[87];let Ue;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,l.jsx)(se,{className:`fill-surface-overlay`}),t[88]=Ue):Ue=t[88];let Q;t[89]!==Pe.Content||t[90]!==Fe||t[91]!==U||t[92]!==W||t[93]!==K||t[94]!==Z?(Q=(0,l.jsxs)(Pe.Content,{align:`start`,sideOffset:6,collisionPadding:12,className:Fe,children:[U,W,K,Z,Ue]}),t[89]=Pe.Content,t[90]=Fe,t[91]=U,t[92]=W,t[93]=K,t[94]=Z,t[95]=Q):Q=t[95];let $;t[96]!==Me.Portal||t[97]!==Ne||t[98]!==Q?($=(0,l.jsx)(Me.Portal,{container:Ne,children:Q}),t[96]=Me.Portal,t[97]=Ne,t[98]=Q,t[99]=$):$=t[99];let We;return t[100]!==g||t[101]!==ke.Root||t[102]!==I||t[103]!==$?(We=(0,l.jsxs)(ke.Root,{open:g,onOpenChange:be,children:[I,$]}),t[100]=g,t[101]=ke.Root,t[102]=I,t[103]=$,t[104]=We):We=t[104],We}function pe(e,t){return(0,l.jsx)(`div`,{className:`flex h-8 items-center justify-center text-[11px] font-medium text-fg-subtle`,children:e},`${e}-${t}`)}function me(e){return new Date(e.getFullYear(),e.getMonth()+1,1,12)}function he(e){return new Date(e.getFullYear(),e.getMonth()-1,1,12)}function ge(e){return e.language}export{u as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./x-B_N4OPjy.js";import{t as s}from"./cn-0WouolD0.js";import{Fa as c,Ma as l,Na as u,Pa as d,Uc as f,Zu as p,cf as m,ja as h,tu as g}from"./index-BvAvfZ5R.js";var _=n(),v=e(t(),1),y=r(),b=`!z-[10000] max-w-[min(28rem,90vw)] rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-relaxed text-fg shadow-lg`;function x(e){let t=(0,_.c)(31),{candidates:n,selectedIds:r,labels:x,disabled:C,borderless:w,getTaskHref:T,onChange:E}=e,D=w===void 0?!1:w,[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(``),M;t[0]===A?M=t[1]:(M=A.trim().toLocaleLowerCase(),t[0]=A,t[1]=M);let N=M,P;if(t[2]!==n||t[3]!==N){let e;t[5]===N?e=t[6]:(e=e=>!N||e.title.toLocaleLowerCase().includes(N),t[5]=N,t[6]=e),P=n.filter(e).slice(0,20),t[2]=n,t[3]=N,t[4]=P}else P=t[4];let F=P,I;t[7]!==n||t[8]!==C||t[9]!==T||t[10]!==x.remove||t[11]!==E||t[12]!==r?(I=r.length>0?(0,y.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-2`,children:r.map(e=>{let t=n.find(t=>t.id===e);return t?(0,y.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-lg bg-surface-hover px-2.5 py-1.5 text-xs text-fg-muted`,children:[(0,y.jsxs)(d,{children:[(0,y.jsx)(c,{asChild:!0,children:T?(0,y.jsx)(i,{to:T(t.id),className:`min-w-0 whitespace-normal break-words [overflow-wrap:anywhere] rounded-sm outline-none transition-colors hover:text-fg hover:underline focus-visible:ring-2 focus-visible:ring-accent/50`,children:t.title}):(0,y.jsx)(`span`,{className:`min-w-0 whitespace-normal break-words [overflow-wrap:anywhere]`,children:t.title})}),(0,y.jsx)(l,{children:(0,y.jsx)(h,{side:`top`,sideOffset:6,collisionPadding:12,className:b,children:(0,y.jsx)(`span`,{className:`break-words`,children:t.title})})})]}),(0,y.jsx)(`button`,{type:`button`,className:`shrink-0 rounded text-fg-subtle transition-colors hover:text-fg`,"aria-label":x.remove.replace(`{{task}}`,t.title),disabled:C,onClick:()=>E(r.filter(e=>e!==t.id)),children:(0,y.jsx)(o,{className:`size-3.5`,"aria-hidden":!0})})]},t.id):null})}):null,t[7]=n,t[8]=C,t[9]=T,t[10]=x.remove,t[11]=E,t[12]=r,t[13]=I):I=t[13];let L;t[14]!==D||t[15]!==n.length||t[16]!==C||t[17]!==x.link||t[18]!==x.linked||t[19]!==x.noCandidates||t[20]!==x.noMatches||t[21]!==x.searchPlaceholder||t[22]!==F||t[23]!==E||t[24]!==O||t[25]!==A||t[26]!==r?(L=n.length>0?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(f,{type:`button`,variant:`secondary`,className:s(`w-fit rounded-lg`,D&&`border-0 bg-surface-hover shadow-none`),disabled:C,"aria-expanded":O,onClick:()=>k(S),children:[(0,y.jsx)(p,{className:`size-4`,"aria-hidden":!0}),r.length>0?x.linked.replace(`{{count}}`,String(r.length)):x.link,(0,y.jsx)(m,{className:s(`size-3.5 transition-transform`,O&&`rotate-180`),"aria-hidden":!0})]}),O?(0,y.jsxs)(`div`,{className:s(`grid gap-2 rounded-lg p-2`,D?`bg-surface-hover`:`border border-edge bg-surface-base`),children:[(0,y.jsxs)(`label`,{className:`relative block`,children:[(0,y.jsx)(g,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,y.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),placeholder:x.searchPlaceholder,className:s(`h-9 w-full rounded-md bg-surface-panel pl-8 pr-3 text-sm text-fg outline-none placeholder:text-fg-subtle`,D?`focus:ring-2 focus:ring-accent/30`:`border border-edge focus:border-accent`),autoFocus:!0})]}),F.length>0?(0,y.jsx)(`div`,{className:`grid max-h-52 gap-1 overflow-y-auto`,children:F.map(e=>{let t=r.includes(e.id);return(0,y.jsxs)(`button`,{type:`button`,"aria-pressed":t,disabled:C,onClick:()=>E(t?r.filter(t=>t!==e.id):[...r,e.id]),className:s(`flex items-center gap-2 rounded-md px-2.5 py-2 text-left text-sm transition-colors`,t?`bg-accent-soft text-accent-fg`:`text-fg hover:bg-surface-hover`),children:[(0,y.jsx)(`span`,{className:s(`flex size-4 shrink-0 items-center justify-center rounded`,D?t?`bg-accent text-on-accent`:`bg-surface-active`:t?`border border-accent bg-accent text-on-accent`:`border border-edge`),children:t?(0,y.jsx)(a,{className:`size-3`,"aria-hidden":!0}):null}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-normal break-words [overflow-wrap:anywhere]`,children:e.title})]},e.id)})}):(0,y.jsx)(`p`,{className:`px-2 py-3 text-center text-sm text-fg-subtle`,children:x.noMatches})]}):null]}):(0,y.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:x.noCandidates}),t[14]=D,t[15]=n.length,t[16]=C,t[17]=x.link,t[18]=x.linked,t[19]=x.noCandidates,t[20]=x.noMatches,t[21]=x.searchPlaceholder,t[22]=F,t[23]=E,t[24]=O,t[25]=A,t[26]=r,t[27]=L):L=t[27];let R;return t[28]!==I||t[29]!==L?(R=(0,y.jsx)(u,{delayDuration:300,children:(0,y.jsxs)(`div`,{className:`min-w-0 grid gap-2`,children:[I,L]})}),t[28]=I,t[29]=L,t[30]=R):R=t[30],R}function S(e){return!e}export{x as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./x-B_N4OPjy.js";import{t as a}from"./messages-CaeL_miw.js";import{n as o}from"./locale-store-CE7L6MlS.js";import{cf as s,t as c}from"./index-BvAvfZ5R.js";import{t as l}from"./desktop-pet-sprite-Bd-aOI7N.js";var u=e(t(),1),d=n(),f=9e4,p=3e4,m=20*6e4,h=45e3,g=45*6e4,_=58;function v(e,t){return e.state===`running`&&t-(e.startedAt??e.timestamp)>=f}function y(e,t){return e.state===`running`&&t-e.timestamp>=p}function b(e,t,n){if(e.progress){let t=`${e.progress.completed}/${e.progress.total}`;return e.action.includes(t)?``:` · ${t}`}return e.detail&&!e.action.includes(e.detail)?n.replace(/\{\{detail\}\}/g,e.detail):e.state===`running`?` · ${Math.max(1,Math.floor((t-e.timestamp)/1e3))}s`:``}function ee(e,t){if(e.state!==`success`||!e.publicSummary)return;let n=e.publicSummary.replace(/\s+/g,` `).trim(),r=n.length>_?`${n.slice(0,_-1)}…`:n;return t.replace(/\{\{summary\}\}/g,r)}function x(e,t,n){if(y(e,t))return n.stale;if(v(e,t))return n.longRunning}function S(e,t){let n=e.feedback?.reassurance;return n?t[n]:void 0}function C(e){let t=e.now-e.lastActivityAt,n=t>=m?(t-m)%g:1/0;return e.bubbleEnabled&&e.behaviorMode!==`focus`&&e.proactiveTipsEnabled&&(!e.remindersPausedUntil||e.now>=e.remindersPausedUntil)&&!e.collapsed&&e.queuedCount===0&&e.activeCount===0&&n<=h&&e.now>=e.dismissedUntil}function w(e,t,n){return e.state===`waiting`||e.state===`error`?`action_required`:e.state===`success`?t===`focus`?`ambient`:`notice`:y(e,n)||t===`playful`||t===`companion`&&v(e,n)?`notice`:`ambient`}function T(e,t,n,r){let i=w(e,t,n);return i===`action_required`?!0:r&&n<r?!1:i===`notice`}var E=8e3;function D(e,t){let n=e?.runId===t.runId,r=t.feedback?.sensitivity===`private`;return{...n?e:void 0,...t,startedAt:n?e.startedAt??e.timestamp:t.timestamp,publicSummary:r?void 0:t.publicSummary??(n?e.publicSummary:void 0),feedback:t.feedback??(n?e.feedback:void 0),expiresAt:t.state===`success`?t.timestamp+E:void 0}}function O(e,t){let n={...e};for(let e of t){let t=n[e.conversationId];t?.runId===e.runId&&e.sequence<=t.sequence||(n[e.conversationId]=D(t,e))}return n}function k(e,t){return t?.runId===e.runId&&t.state===e.state}function te(e,t){let n={error:0,waiting:1,running:2,success:3};return e.filter(e=>!e.expiresAt||e.expiresAt>t).sort((e,t)=>n[e.state]-n[t.state]||t.timestamp-e.timestamp).slice(0,3)}function ne(e){return e?`/chat/${e.conversationId}`:void 0}var A=r();function j(e){return e?e.state===`error`?`concern`:e.state===`success`?`success`:e.animation??c(e.phase):`idle`}function M(e,t){if(!e?.length)return;let n=t.sequence;for(let e of`${t.conversationId}:${t.runId}`)n=n*31+e.charCodeAt(0)>>>0;return e[n%e.length]}function N(e,t,n){let r=e.persona?.phrases??n;if(t.state===`success`)return M(r?.success,t);if(t.state===`waiting`)return M(r?.waiting,t);if(t.state===`error`)return M(r?.error,t)}function P(e,t,n){return e?n?`${e} · ${t}`:e:t}function F(e,t){let n=e.feedback?.nextAction?.type;if(n===`confirm`)return t.needsInput;if(n===`review_error`)return t.reviewIssue;if(n===`open_session`)return t.open;if(e.state===`waiting`)return t.needsInput;if(e.state===`error`)return t.reviewIssue;if(e.state===`success`)return t.open}function I(){let e=Date.now();return{prefs:{enabled:!0,showOnStartup:!1,selectedPetId:`loopi`,alwaysOnTop:!0,bubbleEnabled:!0,clickThroughWhenIdle:!1,muted:!1,behaviorMode:`companion`,proactiveTipsEnabled:!0,interactionEnabled:!0,reducedMotion:!1,sizePercent:100,collapsed:!1},relationship:{firstMetAt:e,lastSeenAt:e,completedTaskCount:0,unlockedReactions:[],recentCompletedRunIds:[]},pets:[],visible:!0,customPetsDir:``,petIssues:[],activities:[]}}function L(){let e=a(o(e=>e.language)).desktopPet,[t,n]=(0,u.useState)(I),[r,c]=(0,u.useState)({}),[d,f]=(0,u.useState)({}),[p,m]=(0,u.useState)(Date.now()),[h,_]=(0,u.useState)(()=>Date.now()),[v,y]=(0,u.useState)(0),[w,E]=(0,u.useState)(null),D=(0,u.useRef)(null),L=(0,u.useRef)(!1),R=(0,u.useRef)(null),z=(0,u.useRef)(null),B=(0,u.useRef)(null),V=(0,u.useMemo)(()=>t.pets.find(e=>e.id===t.prefs.selectedPetId)??t.pets[0],[t]),H=Math.min(1.4,Math.max(.7,t.prefs.sizePercent/100)),U=(0,u.useMemo)(()=>te(Object.values(r),p),[r,p]),W=(0,u.useMemo)(()=>t.prefs.bubbleEnabled?U.filter(e=>!k(e,d[e.conversationId])&&T(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)):[],[U,d,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),G=(0,u.useMemo)(()=>t.prefs.bubbleEnabled?U.filter(e=>k(e,d[e.conversationId])&&T(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)).length:0,[U,d,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),K=W[0]??U[0],q=p-h>20*6e4&&(new Date(p).getHours()>=23||new Date(p).getHours()<7)?`sleep`:`idle`,J=w??(K?j(K):q),Y=e.personaPhrases[V?.persona?.tone??`calm`],X=C({bubbleEnabled:t.prefs.bubbleEnabled,behaviorMode:t.prefs.behaviorMode,proactiveTipsEnabled:t.prefs.proactiveTipsEnabled,remindersPausedUntil:t.prefs.remindersPausedUntil,collapsed:t.prefs.collapsed,queuedCount:W.length,activeCount:U.length,now:p,lastActivityAt:h,dismissedUntil:v});(0,u.useEffect)(()=>{document.documentElement.dataset.desktopPet=`true`;let e=window.electronAPI?.pet;if(!e)return;let t=e=>{n(e),c(t=>O(t,e.activities))};e.getState().then(t).catch(()=>{});let r=e.onStateChanged(t),i=e.onEvent(e=>c(t=>(_(Date.now()),O(t,[e])))),a=window.setInterval(()=>m(Date.now()),1e3);return()=>{delete document.documentElement.dataset.desktopPet,r(),i(),window.clearInterval(a)}},[]),(0,u.useEffect)(()=>{if(!t.relationshipMoment)return;E(t.relationshipMoment===`first_meeting`?`wake`:`greet`);let e=window.setTimeout(()=>E(null),1400);return()=>window.clearTimeout(e)},[t.relationshipMoment]),(0,u.useLayoutEffect)(()=>{let e=R.current,t=window.electronAPI?.pet;if(!e||!t)return;let n=()=>{let e=[z.current,B.current].filter(e=>e!==null).map(e=>({left:e.offsetLeft,top:e.offsetTop,right:e.offsetLeft+e.offsetWidth,bottom:e.offsetTop+e.offsetHeight}));if(!e.length)return;let n=Math.min(...e.map(e=>e.left)),r=Math.min(...e.map(e=>e.top)),i=Math.max(...e.map(e=>e.right)),a=Math.max(...e.map(e=>e.bottom)),o=Math.round(132*H),s=o+(z.current?8+z.current.offsetHeight:0);t.setContentSize({width:Math.ceil(Math.max(i-n,o)),height:Math.ceil(Math.max(a-r,s))})},r=new ResizeObserver(n);return r.observe(e),z.current&&r.observe(z.current),B.current&&r.observe(B.current),n(),()=>r.disconnect()},[X,W.length,t.prefs.collapsed,H]);let Z=(e=K)=>{e&&e.state!==`running`&&(window.electronAPI?.pet?.acknowledgeEvent(e.conversationId,e.runId),c(t=>{let{[e.conversationId]:n,...r}=t;return r})),window.electronAPI?.pet?.openMainWindow(ne(e))},re=async()=>{if(Object.keys(d).length>0&&(f({}),!t.prefs.collapsed))return;let e=await window.electronAPI?.pet?.setPrefs({collapsed:!t.prefs.collapsed});e&&n(e)},ie=(0,u.useCallback)(e=>{e.button===0&&(D.current={pointerId:e.pointerId,x:e.screenX,y:e.screenY,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),window.electronAPI?.pet?.startDrag({screenX:e.screenX,screenY:e.screenY}))},[]),ae=(0,u.useCallback)(e=>{let t=D.current;!t||t.pointerId!==e.pointerId||(t.moved||Math.abs(e.screenX-t.x)+Math.abs(e.screenY-t.y)>4)&&(t.moved=!0,E(`pickedUp`),window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}))},[]),Q=(0,u.useCallback)(e=>{let t=D.current;if(!t||e&&t.pointerId!==e.pointerId)return;D.current=null;let n=e?.type===`pointerup`&&Number.isFinite(e.screenX)&&Number.isFinite(e.screenY),r=t.moved||n&&Math.abs(e.screenX-t.x)+Math.abs(e.screenY-t.y)>4;r&&n&&window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}),window.electronAPI?.pet?.endDrag(),r&&(E(`released`),window.setTimeout(()=>E(null),700),L.current=!0,window.setTimeout(()=>{L.current=!1},0))},[]);(0,u.useEffect)(()=>{let e=e=>Q(e),t=()=>Q();return window.addEventListener(`pointerup`,e),window.addEventListener(`pointercancel`,e),window.addEventListener(`blur`,t),()=>{window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e),window.removeEventListener(`blur`,t)}},[Q]);let oe=()=>{L.current||Z()};if(!V)return null;let se={"--desktop-pet-stage-size":`${Math.round(132*H)}px`,"--desktop-pet-menu-size":`${Math.round(28*H)}px`,"--desktop-pet-menu-left":`0px`,"--desktop-pet-menu-bottom":`${Math.round(12*H)}px`},$=t.prefs.collapsed?W.length:G;return(0,A.jsxs)(`div`,{ref:R,className:`desktop-pet-window`,"data-reduced-motion":t.prefs.reducedMotion,style:se,children:[!t.prefs.collapsed&&W.length>0?(0,A.jsx)(`div`,{ref:z,className:`desktop-pet-bubble desktop-pet-queue`,children:W.map(t=>{let n=x(t,p,{longRunning:e.tipLongRunning,stale:e.tipStaleSignal}),r=ee(t,e.tipCompleteSummary),a=S(t,{making_progress:e.petReassuranceMakingProgress,waiting_safely:e.petReassuranceWaitingSafely,completed:e.petReassuranceCompleted,work_preserved:e.petReassuranceWorkPreserved,details_available:e.petReassuranceDetailsAvailable}),o=r??n??a??t.action,s=P(N(V,t,Y),o,!!(r||n||a)),c=F(t,{open:e.viewSession,needsInput:e.petCtaNeedsInput,reviewIssue:e.petCtaReviewIssue});return(0,A.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--${t.state}${n?` desktop-pet-session--health`:``}`,children:[(0,A.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(t),children:[(0,A.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,A.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,A.jsx)(`strong`,{children:t.sessionLabel}),(0,A.jsxs)(`span`,{children:[s,r||n?``:b(t,p,e.tipTargetSuffix)]})]}),c?(0,A.jsx)(`span`,{className:`desktop-pet-session-cta`,children:c}):null]}),(0,A.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>{window.electronAPI?.pet?.acknowledgeEvent(t.conversationId,t.runId),f(e=>({...e,[t.conversationId]:{runId:t.runId,state:t.state}}))},children:(0,A.jsx)(i,{size:12})})]},t.conversationId)})}):null,X?(0,A.jsx)(`div`,{ref:z,className:`desktop-pet-bubble desktop-pet-queue desktop-pet-idle-tip`,children:(0,A.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--idle`,children:[(0,A.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(),children:[(0,A.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,A.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,A.jsx)(`strong`,{children:e.idleTipTitle}),(0,A.jsx)(`span`,{children:M(V.persona?.phrases?.greeting??Y.greeting,{conversationId:`idle`,runId:`idle`,sessionLabel:``,sequence:0,timestamp:h,state:`running`,phase:`waiting`,action:e.idleTipBody})??e.idleTipBody})]})]}),(0,A.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>y(p+g),children:(0,A.jsx)(i,{size:12})})]})}):null,(0,A.jsxs)(`div`,{ref:B,className:`desktop-pet-stage`,children:[(0,A.jsx)(`button`,{type:`button`,className:`desktop-pet-menu-button`,onClick:()=>void re(),"aria-label":e.menu,children:$>0?(0,A.jsx)(`span`,{className:`desktop-pet-tip-count`,children:Math.min(99,$)}):(0,A.jsx)(s,{className:`desktop-pet-menu-chevron size-4`})}),(0,A.jsx)(`button`,{type:`button`,className:`desktop-pet-hit-area`,onClick:oe,onPointerEnter:()=>{!K&&t.prefs.interactionEnabled&&t.prefs.behaviorMode===`playful`&&E(`greet`)},onPointerLeave:()=>{D.current||E(null)},onPointerDown:ie,onPointerMove:ae,onPointerUp:Q,onPointerCancel:Q,onLostPointerCapture:Q,title:e.openApp,children:(0,A.jsx)(l,{animationKey:K?.runId,pet:V,action:J,reducedMotion:t.prefs.reducedMotion,displayHeight:Math.round(112*H)},V.id)})]})]})}function R(){let e=(0,d.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,A.jsx)(L,{}),e[0]=t):t=e[0],t}export{R as DesktopPetPage};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./external-link-DjqjBmc3.js";import{t as o}from"./messages-CaeL_miw.js";import{t as s}from"./cn-0WouolD0.js";import{n as c}from"./locale-store-CE7L6MlS.js";import{Fc as l,Iu as u,Lc as d,Ya as f,af as p,as as m,au as h,bu as g,cf as _,ds as v,us as y,yl as b}from"./index-BvAvfZ5R.js";import{t as x}from"./desktop-pet-sprite-Bd-aOI7N.js";import{n as S,r as C}from"./settings-page-layout-Dx5S-Msc.js";var w=n(),T=e(t(),1),E=r();function D(e){let t=(0,w.c)(16),{title:n,desc:r,checked:i,disabled:a,onChange:o}=e,s;t[0]===n?s=t[1]:(s=(0,E.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,E.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,E.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=e=>o(e.target.checked),t[7]=o,t[8]=u);let d;t[9]!==i||t[10]!==a||t[11]!==u?(d=(0,E.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":i,className:`ui-checkbox`,disabled:a,checked:i,onChange:u}),t[9]=i,t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==l||t[14]!==d?(f=(0,E.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center justify-between gap-3 py-3`,children:[l,d]}),t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function O(){let e=o(c(e=>e.language)).desktopPetSettings,t=i(),[n,r]=(0,T.useState)(null),[w,O]=(0,T.useState)(!1),[k,A]=(0,T.useState)(null),j=typeof window<`u`?window.electronAPI?.pet:void 0,M=(0,T.useMemo)(()=>n?.pets.find(e=>e.id===n.prefs.selectedPetId)??n?.pets[0],[n]),N=(0,T.useCallback)(async()=>{if(j){O(!0);try{r(await j.getState())}finally{O(!1)}}},[j]);if((0,T.useEffect)(()=>{if(j)return N(),j.onStateChanged(r)},[j,N]),!m()||!j)return null;if(!n)return(0,E.jsxs)(C,{gap:`gap-4`,children:[(0,E.jsx)(S,{title:e.title,subtitle:e.subtitle}),(0,E.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":!0,"aria-label":e.loading,children:(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsx)(d,{className:`h-14 rounded-xl`}),(0,E.jsx)(d,{className:`h-14 rounded-xl`}),(0,E.jsx)(d,{className:`h-24 rounded-xl`}),(0,E.jsx)(`div`,{className:`space-y-2 pt-2`,children:Array.from({length:3}).map((e,t)=>(0,E.jsx)(d,{className:`h-16 rounded-xl`},t))})]})})]});let P=async e=>{O(!0);try{r(await j.setPrefs(e))}finally{O(!1)}},F=async e=>{e?(await j.show(),r(await j.getState())):r(await j.setPrefs({enabled:!1}))},I=e=>{P({selectedPetId:e})},L=t=>{if(t.builtin&&t.i18nKey){let n=e.builtinPets[t.i18nKey];if(n)return n}return{name:t.name,description:t.description}},R=e=>{t({pathname:`/chat/new`,search:`?draft=${encodeURIComponent(e)}`})},z=e=>{if(e.sourcePrompt?.trim())return e.sourcePrompt.trim();let{description:t}=L(e);return t.replace(/^Custom pet generated from:\s*/i,``).trim()||t},B=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.split(`{${t}}`).join(n),e),V=()=>{R(e.createChatDraft)},H=t=>{R(B(e.optimizeChatDraft,{id:t.id,name:L(t).name,description:L(t).description,sourcePrompt:z(t)}))},U=t=>{R(B(e.fixChatDraft,{dir:t.dir,reason:t.reason,details:t.details?.join(`; `)||e.noIssueDetails}))},W=k??n.prefs.sizePercent,G=Math.max(1,Math.floor((Date.now()-n.relationship.firstMetAt)/864e5)+1),K=async(e=W)=>{let t=Math.min(140,Math.max(70,Math.round(e/5)*5));A(null),t!==n.prefs.sizePercent&&await P({sizePercent:t})};return(0,E.jsxs)(C,{gap:`gap-5`,children:[(0,E.jsx)(S,{title:e.title,subtitle:e.subtitle,actions:(0,E.jsx)(f,{className:`size-9 shrink-0 p-0`,disabled:w,label:e.refresh,onClick:N})}),(0,E.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:gap-6`,children:[(0,E.jsx)(`div`,{className:`grid h-40 w-40 shrink-0 place-items-center self-center rounded-xl bg-surface-hover/35`,children:M?(0,E.jsx)(x,{pet:M,action:`idle`,displayHeight:Math.round(104*W/100),reducedMotion:n.prefs.reducedMotion}):null}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-6 gap-y-2`,children:[(0,E.jsx)(`h2`,{className:`break-words text-xl font-semibold text-fg`,children:M?L(M).name:e.title}),(0,E.jsx)(D,{title:e.enable,checked:n.prefs.enabled,disabled:w,onChange:e=>void F(e)})]}),(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.bondSummary.replace(`{days}`,String(G)).replace(`{tasks}`,String(n.relationship.completedTaskCount))}),n.pets.length>1?(0,E.jsx)(`div`,{className:`mt-4 max-w-56`,children:(0,E.jsx)(y,{"aria-label":e.petList,value:M?.id??``,onChange:e=>I(e.target.value),disabled:w,children:n.pets.map(e=>(0,E.jsx)(v,{value:e.id,children:L(e).name},e.id))})}):null,M&&!M.builtin?(0,E.jsxs)(`button`,{type:`button`,onClick:()=>H(M),className:`mt-3 inline-flex min-h-9 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,children:[(0,E.jsx)(g,{className:`size-3.5`}),e.optimizeInChat]}):null]})]}),(0,E.jsx)(`div`,{className:`border-t border-edge px-5 py-2`,children:(0,E.jsxs)(`button`,{type:`button`,onClick:V,className:s(`inline-flex min-h-10 items-center gap-2 text-xs font-medium text-fg-muted hover:text-accent-fg`,l.press),children:[(0,E.jsx)(b,{className:`size-4`}),e.createTitle]})})]}),n.petIssues.length>0?(0,E.jsxs)(`section`,{className:`rounded-xl border border-danger/20 bg-danger/5 p-4`,children:[(0,E.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-medium text-danger`,children:[(0,E.jsx)(p,{className:`size-4`}),e.invalidPets]}),(0,E.jsx)(`div`,{className:`mt-3 space-y-3`,children:n.petIssues.map(t=>(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,E.jsxs)(`div`,{className:`min-w-0 text-xs text-fg-muted`,children:[(0,E.jsx)(`p`,{className:`break-words`,children:t.reason}),(0,E.jsxs)(`details`,{className:`mt-1`,children:[(0,E.jsx)(`summary`,{className:`cursor-pointer`,children:e.issueDetails}),(0,E.jsx)(`p`,{className:`mt-2 break-all font-mono`,children:t.dir}),t.details?.length?(0,E.jsx)(`p`,{className:`mt-1 break-words`,children:t.details.join(`; `)}):null]})]}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>U(t),className:`inline-flex min-h-9 shrink-0 items-center gap-1.5 text-xs font-medium text-danger`,children:[(0,E.jsx)(u,{className:`size-3.5`}),e.fixInChat]})]},`${t.dir}-${t.reason}`))})]}):null,(0,E.jsxs)(`section`,{"aria-label":e.displayGroup,children:[(0,E.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:e.displayGroup}),(0,E.jsxs)(`div`,{className:`divide-y divide-edge rounded-xl border border-edge bg-surface-panel px-4`,children:[(0,E.jsx)(D,{title:e.showOnStartup,checked:n.prefs.showOnStartup,disabled:w,onChange:e=>void P({showOnStartup:e})}),(0,E.jsx)(D,{title:e.alwaysOnTop,checked:n.prefs.alwaysOnTop,disabled:w,onChange:e=>void P({alwaysOnTop:e})}),(0,E.jsx)(D,{title:e.bubbles,checked:n.prefs.bubbleEnabled,disabled:w,onChange:e=>void P({bubbleEnabled:e})}),(0,E.jsxs)(`div`,{className:`py-3`,children:[(0,E.jsxs)(`label`,{htmlFor:`desktop-pet-size`,className:`flex items-center justify-between gap-3 text-sm font-medium text-fg`,children:[e.size,(0,E.jsxs)(`span`,{className:`text-xs tabular-nums text-fg-muted`,children:[W,`%`]})]}),(0,E.jsx)(`input`,{id:`desktop-pet-size`,type:`range`,min:70,max:140,step:5,className:`mt-3 w-full accent-accent`,value:W,disabled:w,onChange:e=>A(Number(e.target.value)),onBlur:()=>void K(),onKeyUp:e=>{(e.key===`Enter`||e.key===` `||e.key.startsWith(`Arrow`))&&K()},onPointerUp:()=>void K()})]})]})]}),(0,E.jsxs)(`section`,{"aria-label":e.interactionGroup,children:[(0,E.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:e.interactionGroup}),(0,E.jsxs)(`div`,{className:`divide-y divide-edge rounded-xl border border-edge bg-surface-panel px-4`,children:[(0,E.jsx)(D,{title:e.proactiveTips,checked:n.prefs.proactiveTipsEnabled,disabled:w,onChange:e=>void P({proactiveTipsEnabled:e})}),(0,E.jsx)(D,{title:e.interactions,desc:e.interactionsDesc,checked:n.prefs.interactionEnabled,disabled:w,onChange:e=>void P({interactionEnabled:e})}),(0,E.jsx)(D,{title:e.reducedMotion,checked:n.prefs.reducedMotion,disabled:w,onChange:e=>void P({reducedMotion:e})}),(0,E.jsxs)(`div`,{className:`flex min-h-12 flex-wrap items-center justify-between gap-3 py-3`,children:[(0,E.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.behaviorMode}),(0,E.jsxs)(y,{"aria-label":e.behaviorMode,className:`w-36`,triggerClassName:`h-9 bg-surface-panel`,value:n.prefs.behaviorMode,disabled:w,onChange:e=>void P({behaviorMode:e.target.value}),children:[(0,E.jsx)(v,{value:`focus`,children:e.behaviorFocus}),(0,E.jsx)(v,{value:`companion`,children:e.behaviorCompanion}),(0,E.jsx)(v,{value:`playful`,children:e.behaviorPlayful})]})]})]})]}),(0,E.jsxs)(`details`,{className:`group rounded-xl border border-edge bg-surface-panel`,children:[(0,E.jsxs)(`summary`,{className:`flex min-h-12 cursor-pointer list-none items-center justify-between gap-3 px-4 text-sm font-medium text-fg [&::-webkit-details-marker]:hidden`,children:[e.advanced,(0,E.jsx)(_,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180`})]}),(0,E.jsxs)(`div`,{className:`space-y-3 border-t border-edge px-4 pb-4`,children:[(0,E.jsx)(D,{title:e.clickThrough,desc:e.clickThroughDesc,checked:n.prefs.clickThroughWhenIdle,disabled:w,onChange:e=>void P({clickThroughWhenIdle:e})}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge pt-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.customPets}),(0,E.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-fg-muted`,children:n.customPetsDir})]}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>void j.openCustomPetsDir(),className:`inline-flex min-h-10 shrink-0 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,children:[(0,E.jsx)(a,{className:`size-3.5`}),e.openFolder]})]}),(0,E.jsxs)(`button`,{type:`button`,className:s(`inline-flex min-h-10 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg disabled:opacity-50`,l.press),disabled:w,onClick:()=>void j.resetPosition().then(r),children:[(0,E.jsx)(h,{className:`size-3.5`}),e.resetPosition]})]})]})]})}export{O as DesktopPetSettings};
@@ -0,0 +1,30 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-0WouolD0.js";var a=e(t(),1),o=n();function s(e){return`<svg viewBox="0 0 400 400" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
2
+ <style>.loopi-pet-work-card,.loopi-pet-happy-eyes,.loopi-pet-happy-mouth,.loopi-pet-wait-cue{opacity:0}.loopi-pet-happy-mouth{fill:#232832}</style>
3
+ <defs>
4
+ <linearGradient id="gray-${e}" x1="85" y1="65" x2="270" y2="334" gradientUnits="userSpaceOnUse"><stop stop-color="#83858a"/><stop offset=".22" stop-color="#5a5c61"/><stop offset=".6" stop-color="#45474b"/><stop offset="1" stop-color="#33363a"/></linearGradient>
5
+ <linearGradient id="blue-${e}" x1="210" y1="51" x2="332" y2="176" gradientUnits="userSpaceOnUse"><stop stop-color="#7bbaff"/><stop offset=".27" stop-color="#369bff"/><stop offset=".68" stop-color="#087dff"/><stop offset="1" stop-color="#0064dd"/></linearGradient>
6
+ <radialGradient id="pearl-${e}" cx=".32" cy=".22" r=".85"><stop stop-color="#fffefa"/><stop offset=".5" stop-color="#f6f3f0"/><stop offset=".8" stop-color="#e7e4e1"/><stop offset="1" stop-color="#c9c9cb"/></radialGradient>
7
+ <radialGradient id="eyes-${e}" cx=".3" cy=".25" r=".8"><stop stop-color="#4d5056"/><stop offset=".45" stop-color="#20232a"/><stop offset="1" stop-color="#090d14"/></radialGradient>
8
+ <filter id="blur-${e}" x="-50%" y="-100%" width="200%" height="300%"><feGaussianBlur stdDeviation="4"/></filter>
9
+ <filter id="soft-${e}" x="-30%" y="-30%" width="160%" height="160%"><feGaussianBlur stdDeviation="2.8"/></filter>
10
+ <path id="long-${e}" d="M324.09 211.88 A126 126 0 1 1 178.12 65.91"/>
11
+ <path id="short-${e}" d="M230.48 67.74 A126 126 0 0 1 322.26 159.52"/>
12
+ </defs>
13
+ <ellipse class="loopi-pet-ground" cx="200" cy="352" rx="86" ry="7" fill="#334259" opacity=".14" filter="url(#blur-${e})"/>
14
+ <g class="loopi-pet-pointer-body"><g class="loopi-pet-body-motion">
15
+ <g class="loopi-pet-ring" fill="none" stroke-width="44" stroke-linecap="round">
16
+ <g transform="translate(0 3)"><use href="#long-${e}" stroke="#303237"/><use href="#short-${e}" stroke="#0063d6"/></g>
17
+ <use href="#long-${e}" stroke="url(#gray-${e})"/><use href="#short-${e}" stroke="url(#blue-${e})"/>
18
+ <g transform="translate(-2 -7)" stroke-width="9" opacity=".19" filter="url(#soft-${e})"><use href="#long-${e}" stroke="#fff"/><use href="#short-${e}" stroke="#e0f1ff"/></g>
19
+ </g>
20
+ <path class="loopi-pet-wait-cue" d="M230.48 67.74 A126 126 0 0 1 322.26 159.52" fill="none" stroke="#a4d4ff" stroke-width="2" stroke-linecap="round"/>
21
+ <g class="loopi-pet-pointer-core"><g class="loopi-pet-core-motion"><circle cx="200" cy="193" r="75" fill="#384353" opacity=".08" filter="url(#blur-${e})"/>
22
+ <circle cx="200" cy="190" r="75" fill="url(#pearl-${e})"/><path d="M140 160 A69 69 0 0 1 231 129" stroke="#fff" stroke-width="2" opacity=".48" fill="none" stroke-linecap="round"/>
23
+ <g class="loopi-pet-pointer-face"><g class="loopi-pet-look"><g class="loopi-pet-cheeks" fill="#f0b8a0" filter="url(#soft-${e})"><ellipse cx="160" cy="208" rx="9" ry="5"/><ellipse cx="240" cy="208" rx="9" ry="5"/></g>
24
+ <g class="loopi-pet-eyes"><g class="loopi-pet-normal-eyes"><ellipse cx="174" cy="184" rx="7.8" ry="10.3" fill="url(#eyes-${e})"/><ellipse cx="226" cy="184" rx="7.8" ry="10.3" fill="url(#eyes-${e})"/><ellipse cx="176" cy="180" rx="2.1" ry="2.8" fill="white"/><ellipse cx="228" cy="180" rx="2.1" ry="2.8" fill="white"/></g>
25
+ <g class="loopi-pet-happy-eyes" stroke="#242830" fill="none" stroke-width="4" stroke-linecap="round"><path d="M165 186 Q174 173 183 186"/><path d="M217 186 Q226 173 235 186"/></g></g>
26
+ <path class="loopi-pet-normal-mouth" d="M190 207 Q200 217 210 207" stroke="#292c33" stroke-width="3.8" stroke-linecap="round" fill="none"/>
27
+ <g class="loopi-pet-happy-mouth"><path d="M188 204 Q200 211 212 204 Q210 225 200 223 Q190 222 188 204"/><path d="M194 218 Q200 213 206 218 Q200 224 194 218" fill="#f3a79f"/></g>
28
+ </g></g></g></g>
29
+ <g class="loopi-pet-work-card"><path d="M266 224 L322 217 Q327 216 325 222 L314 259 Q313 262 309 263 L255 269 Q251 270 253 265Z" fill="#c7cdd7" transform="translate(0 3)"/><path d="M266 224 L322 217 Q327 216 325 222 L314 259 Q313 262 309 263 L255 269 Q251 270 253 265Z" fill="#fbfcfe" stroke="#e0e4eb"/><path d="M273 235 L312 230 M270 243 L306 239 M267 252 L290 249" stroke="#c2d0e0" stroke-width="2.5" stroke-linecap="round"/><path class="loopi-pet-scan" d="M273 235 L296 232" stroke="#2588f4" stroke-width="2.5" stroke-linecap="round"/></g>
30
+ </g></g></svg>`}function c(e,t,n){let r=e.x-t.x,i=e.y-t.y,a=Math.max(220,n*2.5),o=Math.max(0,Math.min(1,(a-Math.hypot(r,i))/(a-n*.6))),s=Math.max(1,n*.85),c=e=>Math.round(Math.max(-1,Math.min(1,e/s))*o*1e3)/1e3;return{x:c(r),y:c(i)}}function l(e,t=!0){let n=window.matchMedia?.(`(prefers-reduced-motion: reduce)`),r=t,i={x:0,y:0},a=t=>{let r=e=>Number.isFinite(e)?Math.max(-1,Math.min(1,e)):0;e.style.setProperty(`--loopi-pointer-x`,String(n?.matches?0:r(t.x))),e.style.setProperty(`--loopi-pointer-y`,String(n?.matches?0:r(t.y)))},o=e=>{i=e,r&&a(e)},s=()=>o({x:0,y:0}),l=()=>a(r?i:{x:0,y:0}),u=t=>{if(!r||t.pointerType===`touch`)return;let n=e.getBoundingClientRect();o(c({x:t.clientX,y:t.clientY},{x:n.left+n.width/2,y:n.top+n.height/2},n.height))},d=(e.closest(`.desktop-pet-window`)?window.electronAPI?.pet?.onPointerChanged:void 0)?.(o);return d||(window.addEventListener(`pointermove`,u),document.addEventListener(`pointerleave`,s),window.addEventListener(`blur`,s)),n?.addEventListener(`change`,l),{setEnabled(e){r=e,l()},dispose(){d?.(),window.removeEventListener(`pointermove`,u),document.removeEventListener(`pointerleave`,s),window.removeEventListener(`blur`,s),n?.removeEventListener(`change`,l),a({x:0,y:0})}}}var u=r();function d(e){return[`research`,`read`,`create`,`execute`,`prepare`].includes(e)?`work`:e===`success`?`done`:e===`wait`?`wait`:[`sleep`,`concern`,`pickedUp`,`released`].includes(e)?e:`idle`}function f(e){let t=(0,o.c)(29),{action:n,animationKey:r,displayHeight:i,reducedMotion:c,className:f}=e,m=(0,a.useId)(),h;t[0]===m?h=t[1]:(h=s(m.replace(/[^a-zA-Z0-9_-]/g,``)),t[0]=m,t[1]=h);let g;t[2]===h?g=t[3]:(g={__html:h},t[2]=h,t[3]=g);let _=g,v=(0,a.useRef)(null),[y,b]=(0,a.useState)(p),x;t[4]!==n||t[5]!==r?(x={action:n,animationKey:r},t[4]=n,t[5]=r,t[6]=x):x=t[6];let S=(0,a.useRef)(x),C=(0,a.useRef)(null),w=y||c||n===`sleep`||n===`pickedUp`||n===`released`,T,E;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{if(!v.current)return;let e=l(v.current,!1);return C.current=e,()=>{e.dispose(),C.current=null}},E=[],t[7]=T,t[8]=E):(T=t[7],E=t[8]),(0,a.useEffect)(T,E);let D,O;t[9]===w?(D=t[10],O=t[11]):(D=()=>{C.current?.setEnabled(!w)},O=[w],t[9]=w,t[10]=D,t[11]=O),(0,a.useEffect)(D,O);let k,A;t[12]!==n||t[13]!==r?(k=()=>{let e=S.current;if(S.current={action:n,animationKey:r},!(n!==`success`||e.action!==`success`||e.animationKey===r))for(let e of v.current?.getAnimations?.({subtree:!0})??[])e.currentTime=0},A=[n,r],t[12]=n,t[13]=r,t[14]=k,t[15]=A):(k=t[14],A=t[15]),(0,a.useLayoutEffect)(k,A);let j,M;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{let e=!0,t=()=>b(document.hidden||!e),n=new IntersectionObserver(n=>{let[r]=n;e=r.isIntersecting,t()});return v.current&&n.observe(v.current),document.addEventListener(`visibilitychange`,t),()=>{n.disconnect(),document.removeEventListener(`visibilitychange`,t)}},M=[],t[16]=j,t[17]=M):(j=t[16],M=t[17]),(0,a.useEffect)(j,M);let N=`loopi-desktop ${f??``}`,P;t[18]===n?P=t[19]:(P=d(n),t[18]=n,t[19]=P);let F;t[20]===i?F=t[21]:(F={width:i,height:i},t[20]=i,t[21]=F);let I;return t[22]!==_||t[23]!==y||t[24]!==c||t[25]!==N||t[26]!==P||t[27]!==F?(I=(0,u.jsx)(`span`,{ref:v,className:N,"data-state":P,"data-paused":y,"data-reduced-motion":c,style:F,"aria-hidden":!0,dangerouslySetInnerHTML:_}),t[22]=_,t[23]=y,t[24]=c,t[25]=N,t[26]=P,t[27]=F,t[28]=I):I=t[28],I}function p(){return document.hidden}function m(e){let t=(0,o.c)(48),{pet:n,action:r,size:a,displayHeight:s,reducedMotion:c,animationKey:l,className:d}=e,p=a===void 0?`normal`:a,m=c===void 0?!1:c,_=p===`tiny`?40:p===`small`?54:112,v;t[0]!==_||t[1]!==s?(v=Math.round(s??_),t[0]=_,t[1]=s,t[2]=v):v=t[2];let y=Math.max(1,v);if(n.renderer===`loopi`){let e;return t[3]!==r||t[4]!==l||t[5]!==d||t[6]!==y||t[7]!==m?(e=(0,u.jsx)(f,{action:r,animationKey:l,displayHeight:y,reducedMotion:m,className:d}),t[3]=r,t[4]=l,t[5]=d,t[6]=y,t[7]=m,t[8]=e):e=t[8],e}let b=n.animations[r],x=y/b.frameHeight,S;t[9]!==b.frameWidth||t[10]!==x?(S=Math.round(b.frameWidth*x),t[9]=b.frameWidth,t[10]=x,t[11]=S):S=t[11];let C=S,w;t[12]===n.animations?w=t[13]:(w=Object.values(n.animations),t[12]=n.animations,t[13]=w);let T;t[14]!==b.imageDataUrl||t[15]!==w?(T=w.filter(e=>e.imageDataUrl===b.imageDataUrl).map(g),t[14]=b.imageDataUrl,t[15]=w,t[16]=T):T=t[16];let E=Math.max(b.sheetHeight??0,b.offsetY+b.frameHeight,...T),D;t[17]===n.animations?D=t[18]:(D=Object.values(n.animations),t[17]=n.animations,t[18]=D);let O;t[19]!==b.imageDataUrl||t[20]!==D?(O=D.filter(e=>e.imageDataUrl===b.imageDataUrl).map(h),t[19]=b.imageDataUrl,t[20]=D,t[21]=O):O=t[21];let k=Math.max(b.sheetWidth??0,b.offsetX+b.frameWidth*b.frameCount,...O),A=Math.max(.1,b.frameCount/b.fps),j=`${C}px`,M=`${y}px`,N;t[22]!==x||t[23]!==k?(N=Math.round(k*x),t[22]=x,t[23]=k,t[24]=N):N=t[24];let P;t[25]!==x||t[26]!==E?(P=Math.round(E*x),t[25]=x,t[26]=E,t[27]=P):P=t[27];let F=`${N}px ${P}px`,I=`${-b.offsetX*x}px`,L=`${-b.offsetY*x}px`,R=`${-(b.offsetX+b.frameWidth*b.frameCount)*x}px`,z=`${A}s`,B=`url("${b.imageDataUrl}")`,V;t[28]!==b.frameCount||t[29]!==M||t[30]!==F||t[31]!==I||t[32]!==L||t[33]!==R||t[34]!==z||t[35]!==B||t[36]!==j?(V={width:j,height:M,backgroundSize:F,"--pet-frame-count":b.frameCount,"--pet-frame-start-x":I,"--pet-frame-start-y":L,"--pet-frame-end-x":R,"--pet-animation-duration":z,backgroundImage:B},t[28]=b.frameCount,t[29]=M,t[30]=F,t[31]=I,t[32]=L,t[33]=R,t[34]=z,t[35]=B,t[36]=j,t[37]=V):V=t[37];let H=V,U=`desktop-pet-sprite--${r}`,W=b.loop?`desktop-pet-sprite--loop`:`desktop-pet-sprite--once`,G=m&&`desktop-pet-sprite--reduced-motion`,K=p===`tiny`&&`desktop-pet-sprite--tiny`,q=p===`small`&&`desktop-pet-sprite--small`,J;t[38]!==d||t[39]!==U||t[40]!==W||t[41]!==G||t[42]!==K||t[43]!==q?(J=i(`desktop-pet-sprite`,U,W,G,K,q,d),t[38]=d,t[39]=U,t[40]=W,t[41]=G,t[42]=K,t[43]=q,t[44]=J):J=t[44];let Y;return t[45]!==H||t[46]!==J?(Y=(0,u.jsx)(`span`,{className:J,style:H,"aria-hidden":!0}),t[45]=H,t[46]=J,t[47]=Y):Y=t[47],Y}function h(e){return e.offsetX+e.frameWidth*e.frameCount}function g(e){return e.offsetY+e.frameHeight}export{m as t};
@@ -0,0 +1 @@
1
+ .loopi-desktop{flex-shrink:0;transition:width .24s cubic-bezier(.22,1,.36,1),height .24s cubic-bezier(.22,1,.36,1);display:block}.loopi-desktop[data-reduced-motion=true]{transition:none}.loopi-desktop svg{width:100%;height:100%;display:block;overflow:visible}.loopi-pet-pointer-body{transform-origin:200px 190px;transform:translate(calc(var(--loopi-pointer-x,0) * 2px), calc(var(--loopi-pointer-y,0) * 1px)) rotate(calc(var(--loopi-pointer-x,0) * 2.5deg));transition:transform .32s cubic-bezier(.22,1,.36,1)}.loopi-pet-pointer-core{transform:translate(calc(var(--loopi-pointer-x,0) * 4px), calc(var(--loopi-pointer-y,0) * 3px));transition:transform .24s cubic-bezier(.22,1,.36,1)}.loopi-pet-pointer-face{transform:translate(calc(var(--loopi-pointer-x,0) * 11px), calc(var(--loopi-pointer-y,0) * 6px));transition:transform .16s cubic-bezier(.22,1,.36,1)}.loopi-pet-body-motion{transform-origin:200px 190px;animation:4.4s ease-in-out infinite loopi-pet-breath}.loopi-pet-core-motion{transform-origin:200px 190px;animation:4.4s ease-in-out infinite loopi-pet-core-breathe}.loopi-pet-eyes{transform-origin:200px 184px;animation:6.1s infinite loopi-pet-blink}.loopi-pet-work-card,.loopi-pet-happy-eyes,.loopi-pet-happy-mouth,.loopi-pet-wait-cue{opacity:0}.loopi-pet-normal-mouth,.loopi-pet-normal-eyes{opacity:1}.loopi-pet-look{transition:transform .45s}.loopi-pet-ground{transform-origin:200px 352px;animation:4.4s ease-in-out infinite loopi-pet-shadow}.loopi-pet-happy-mouth{fill:#232832}.loopi-pet-cheeks{opacity:.34}.loopi-pet-work-card{transform-origin:282px 240px}.loopi-pet-wait-cue{transition:opacity .5s}.loopi-desktop[data-state=work] .loopi-pet-look{transform:translate(4px,9px)}.loopi-desktop[data-state=work] .loopi-pet-core-motion{animation:2.8s ease-in-out infinite loopi-pet-work-nod}.loopi-desktop[data-state=work] .loopi-pet-work-card{opacity:1;animation:2.8s ease-in-out infinite loopi-pet-card}.loopi-desktop[data-state=work] .loopi-pet-body-motion{animation:3.6s ease-in-out infinite loopi-pet-work-breathe}.loopi-desktop[data-state=work] .loopi-pet-scan{animation:2s ease-in-out infinite loopi-pet-scan}.loopi-desktop[data-state=wait] .loopi-pet-body-motion{animation:6s ease-in-out infinite loopi-pet-breath}.loopi-desktop[data-state=wait] .loopi-pet-core-motion{animation:6s ease-in-out infinite loopi-pet-core-breathe}.loopi-desktop[data-state=wait] .loopi-pet-wait-cue{opacity:.7}.loopi-desktop[data-state=wait] .loopi-pet-look{transform:translateY(-2px)}.loopi-desktop[data-state=done] .loopi-pet-normal-eyes,.loopi-desktop[data-state=done] .loopi-pet-normal-mouth{opacity:0}.loopi-desktop[data-state=done] .loopi-pet-happy-eyes,.loopi-desktop[data-state=done] .loopi-pet-happy-mouth{opacity:1}.loopi-desktop[data-state=done] .loopi-pet-body-motion{animation:.95s ease-in-out loopi-pet-celebrate,4.4s ease-in-out .95s infinite loopi-pet-breath}.loopi-desktop[data-state=done] .loopi-pet-eyes{animation:none}.loopi-desktop[data-state=done] .loopi-pet-core-motion{animation:.95s ease-in-out loopi-pet-joy}.loopi-desktop[data-state=done] .loopi-pet-ground{animation:.95s ease-in-out loopi-pet-landing}.loopi-desktop[data-state=done] .loopi-pet-cheeks{opacity:.65}@keyframes loopi-pet-breath{50%{transform:translateY(-3px)}}@keyframes loopi-pet-core-breathe{50%{transform:translateY(-1.5px)scale(1.012,1.006)}}@keyframes loopi-pet-blink{0%,43%,47%,to{transform:scaleY(1)}45%{transform:scaleY(.08)}}@keyframes loopi-pet-shadow{50%{opacity:.1;transform:scaleX(.94)}}@keyframes loopi-pet-work-nod{0%,to{transform:translate(1px,2px)}45%{transform:translate(2px,5px)}}@keyframes loopi-pet-work-breathe{50%{transform:translateY(-2px)}}@keyframes loopi-pet-card{50%{transform:translateY(-2px)rotate(-2deg)}}@keyframes loopi-pet-scan{0%,to{opacity:.3}50%{opacity:1}}@keyframes loopi-pet-celebrate{0%,to{transform:translateY(0)}22%{transform:translateY(3px)}48%{transform:translateY(-15px)}77%{transform:translateY(2px)}}@keyframes loopi-pet-joy{22%{transform:scale(1.035,.96)}48%{transform:scale(.99,1.025)}80%{transform:scale(1.02,.98)}}@keyframes loopi-pet-landing{48%{opacity:.07;transform:scaleX(.78)}80%{transform:scaleX(1.05)}}.loopi-desktop[data-paused=true] *{transition:none!important;animation-play-state:paused!important}.loopi-desktop[data-reduced-motion=true] *{transition:none!important;animation:none!important}.loopi-desktop[data-state=sleep] .loopi-pet-eyes{animation:none;transform:scaleY(.08)}.loopi-desktop[data-state=sleep] .loopi-pet-body-motion{animation-duration:7s}.loopi-desktop[data-state=concern] .loopi-pet-normal-mouth{transform-origin:200px 207px;transform:translateY(3px)scaleY(-1)}.loopi-desktop[data-state=pickedUp] .loopi-pet-body-motion{animation:none;transform:translateY(-5px)}.loopi-desktop[data-state=released] .loopi-pet-body-motion{animation:.7s ease-out loopi-pet-joy}@media (prefers-reduced-motion:reduce){.loopi-desktop{transition:none}.loopi-pet-pointer-body,.loopi-pet-pointer-core,.loopi-pet-pointer-face{transform:none!important}.loopi-desktop *{transition:none!important;animation:none!important}}
@@ -0,0 +1 @@
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{f as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./download-Dk-ZjtO6.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./x-B_N4OPjy.js";import{t as u}from"./messages-CaeL_miw.js";import{t as d}from"./cn-0WouolD0.js";import{n as f}from"./locale-store-CE7L6MlS.js";import{a as p,i as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{n as y}from"./app-link-BV_eGr7l.js";import{i as b}from"./vendor-swr-BIWyz7Rc.js";import{Aa as x,Cu as S,F as C,Gl as w,I as T,L as E,Lc as D,Rt as O,Uc as k,Uo as A,Vt as j,_s as M,id as N,of as P,qd as F,vs as ee,zt as I}from"./index-BvAvfZ5R.js";import{_ as te,a as ne,d as re,f as ie,g as ae,h as oe,i as se,l as L,m as ce,n as R,p as le,r as z,s as B,t as V,u as ue,v as de}from"./tunnel-api-BEzsymVO.js";import{t as H}from"./browser-BLJWD7WI.js";var U=e(n(),1),W=r(),G=e(H(),1),K={width:240,margin:4,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}};async function fe(e){let t=await G.toString(e,{...K,type:`svg`});return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}var q=i();function pe(){let e=u(f(e=>e.language)),t=e.endpointToolsSettings.deviceAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=b(`tunnel-status`,R,{refreshInterval:1500}),[o,s]=(0,U.useState)(!1),[l,d]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!0),[h,g]=(0,U.useState)(`idle`),[_,v]=(0,U.useState)(null),[x,S]=(0,U.useState)(``),w=(0,U.useRef)(!0);(0,U.useEffect)(()=>(w.current=!0,()=>{w.current=!1}),[]);let A=async()=>{if(!r)return;if(r.consentRequired&&!o){d(!0);return}let e=r.registrationSecret?.configured?null:E(),t,n=!1;v(null);try{if(r.consentRequired&&await ne(),!r.registrationSecret?.configured){g(`provisioning`);let r=!1;try{await se()}catch(e){if(!ue(e))throw e;r=!0}if(r){g(`authorizing`);let r=sessionStorage.getItem(`device-pairing-oauth`),i=r?JSON.parse(r):null;t=i&&i.expiresAt>Date.now()?i.sessionId:(await j(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`device-pairing-oauth`,JSON.stringify({sessionId:t,expiresAt:i&&i.expiresAt>Date.now()?i.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;w.current&&Date.now()<o;){let r=await I(t);if(r.authUrl&&r.authUrl!==a&&(a=r.authUrl,await T(a,e)||S(a)),r.status===`completed`){s=!0,n=!0;break}if(r.status===`failed`||r.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!w.current)return;if(!s)throw Error(`Authorization expired`);await se()}await a()}if(!w.current)return;g(`starting`),await B(),p&&await z({autoStart:!0}),await a(),n=!0}catch(e){n=!0,w.current&&v(L(e)===`tunnel_key_limit_reached`?`key-limit`:`failed`)}finally{C(e),n&&(sessionStorage.removeItem(`device-pairing-oauth`),t&&O(t).catch(()=>{})),w.current&&(g(`idle`),S(``))}};if(!r&&!i)return(0,q.jsxs)(`div`,{className:`space-y-5`,children:[(0,q.jsx)(D,{className:`h-5 w-4/5`}),(0,q.jsx)(D,{className:`h-24 w-full`})]});let M=h===`provisioning`||h===`starting`||r?.state===`connecting`||r?.state===`reconnecting`;return(0,q.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[(0,q.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:M?t.preparingHint:h===`authorizing`?t.authorizing:t.enableHint}),x&&h===`authorizing`?(0,q.jsx)(`a`,{href:x,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,M?(0,q.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,q.jsx)(D,{className:`h-2 w-full`}),(0,q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(l||r?.consentRequired)&&h===`idle`?(0,q.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,q.jsxs)(`details`,{open:l,className:`text-sm text-fg-muted`,children:[(0,q.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,q.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,q.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,q.jsx)(`li`,{children:e},e))})]}),(0,q.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,_===`key-limit`?(0,q.jsxs)(`div`,{role:`alert`,className:`mt-4 rounded-lg border border-warning/30 bg-warning/5 p-4`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.routeKeyLimitTitle}),(0,q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.routeKeyLimitHint}),(0,q.jsxs)(k,{variant:`secondary`,className:`mt-3`,onClick:()=>void y(V),children:[t.manageTunnelKeys,(0,q.jsx)(c,{className:`size-3`})]})]}):_||i||r?.state===`error`?(0,q.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:t.routeSetupFailed}):null,(0,q.jsx)(`div`,{className:`flex-1`}),(0,q.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:p,disabled:h!==`idle`,onChange:e=>m(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),(0,q.jsx)(k,{className:`w-full`,variant:`primary`,disabled:!r||h!==`idle`||M||l&&!o,onClick:()=>void A(),children:h===`authorizing`?t.authorizing:M?t.preparing:_?t.retry:t.enable}),i&&!r?(0,q.jsx)(k,{variant:`ghost`,onClick:()=>void a(),children:t.retry}):null]})}var J=t({DevicePairingWizard:()=>Y});function Y(e){let t=(0,W.c)(16),{open:n,onOpenChange:r,onPaired:i,targetKind:o}=e,s=a(),[c,l]=(0,U.useState)(o),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{l(o)},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,U.useEffect)(u,d);let f;t[3]!==r||t[4]!==o?(f=e=>{e||l(o),r(e)},t[3]=r,t[4]=o,t[5]=f):f=t[5];let p=f,m;t[6]!==p||t[7]!==s||t[8]!==i||t[9]!==n||t[10]!==c?(m=n?c?(0,q.jsx)(he,{targetKind:c,onClose:()=>p(!1),onPaired:i}):(0,q.jsx)(Z,{onChoose:l,onChooseLocalBrowser:()=>{p(!1),s(`/settings/agent-browser?driver=extension`)},onClose:()=>p(!1)}):null,t[6]=p,t[7]=s,t[8]=i,t[9]=n,t[10]=c,t[11]=m):m=t[11];let h;return t[12]!==p||t[13]!==n||t[14]!==m?(h=(0,q.jsx)(v,{open:n,onOpenChange:p,children:m}),t[12]=p,t[13]=n,t[14]=m,t[15]=h):h=t[15],h}function X(e){let t=(0,W.c)(14),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,q.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,q.jsx)(n,{className:`size-5`,"aria-hidden":`true`})}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,q.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,q.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsx)(P,{className:`size-4 shrink-0 text-fg-disabled transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==o||t[12]!==l?(d=(0,q.jsxs)(`button`,{type:`button`,className:`group flex min-h-18 w-full cursor-pointer items-center gap-4 rounded-xl border border-edge bg-surface-panel px-4 py-3.5 text-left shadow-surface transition-[background-color,border-color,box-shadow,transform] hover:border-edge-strong hover:bg-surface-active hover:shadow-elevated active:translate-y-px active:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel motion-reduce:active:translate-y-0`,onClick:a,children:[o,l,u]}),t[10]=a,t[11]=o,t[12]=l,t[13]=d):d=t[13],d}function Z(e){let t=(0,W.c)(40),{onChoose:n,onChooseLocalBrowser:r,onClose:i}=e,a=f(me),o;t[0]===a?o=t[1]:(o=u(a),t[0]=a,t[1]=o);let s=o.endpointToolsSettings.deviceAccess,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,q.jsx)(p,{className:d(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ee)}),t[2]=c):c=t[2];let v;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=d(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(28rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,M),t[3]=v):v=t[3];let y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,q.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),t[4]=y):y=t[4];let b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,q.jsx)(l,{className:`size-4`}),t[5]=b):b=t[5];let x;t[6]!==s.cancel||t[7]!==i?(x=(0,q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[y,(0,q.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":s.cancel,onClick:i,children:b})]}),t[6]=s.cancel,t[7]=i,t[8]=x):x=t[8];let C;t[9]===s.chooseTitle?C=t[10]:(C=(0,q.jsx)(_,{className:`text-lg font-semibold tracking-tight text-fg sm:text-xl`,children:s.chooseTitle}),t[9]=s.chooseTitle,t[10]=C);let T;t[11]===s.chooseHint?T=t[12]:(T=(0,q.jsx)(m,{className:`mt-1.5 text-sm leading-6 text-fg-muted`,children:s.chooseHint}),t[11]=s.chooseHint,t[12]=T);let E;t[13]!==s.localBrowserHint||t[14]!==s.localBrowserTitle||t[15]!==r?(E=(0,q.jsx)(X,{icon:N,title:s.localBrowserTitle,hint:s.localBrowserHint,onClick:r}),t[13]=s.localBrowserHint,t[14]=s.localBrowserTitle,t[15]=r,t[16]=E):E=t[16];let D;t[17]===n?D=t[18]:(D=()=>n(`mobile`),t[17]=n,t[18]=D);let O;t[19]!==s.mobileHint||t[20]!==s.mobileTitle||t[21]!==D?(O=(0,q.jsx)(X,{icon:w,title:s.mobileTitle,hint:s.mobileHint,onClick:D}),t[19]=s.mobileHint,t[20]=s.mobileTitle,t[21]=D,t[22]=O):O=t[22];let k;t[23]===n?k=t[24]:(k=()=>n(`browser`),t[23]=n,t[24]=k);let A;t[25]!==s.remoteBrowserHint||t[26]!==s.remoteBrowserTitle||t[27]!==k?(A=(0,q.jsx)(X,{icon:S,title:s.remoteBrowserTitle,hint:s.remoteBrowserHint,onClick:k}),t[25]=s.remoteBrowserHint,t[26]=s.remoteBrowserTitle,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==O||t[30]!==A||t[31]!==E?(j=(0,q.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[E,O,A]}),t[29]=O,t[30]=A,t[31]=E,t[32]=j):j=t[32];let P;t[33]!==j||t[34]!==C||t[35]!==T?(P=(0,q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-6 sm:px-8`,children:[C,T,j]}),t[33]=j,t[34]=C,t[35]=T,t[36]=P):P=t[36];let F;return t[37]!==P||t[38]!==x?(F=(0,q.jsxs)(h,{children:[c,(0,q.jsxs)(g,{className:v,children:[x,P]})]}),t[37]=P,t[38]=x,t[39]=F):F=t[39],F}function me(e){return e.language}function he({targetKind:e,onClose:t,onPaired:n}){let r=f(e=>e.language),i=u(r),a=i.endpointToolsSettings.deviceAccess,v=a.flow,[S,C]=(0,U.useState)(!1),w=b(S?`device-pairing-readiness`:null,oe,{refreshInterval:1500}),[T,E]=(0,U.useState)(),[O,j]=(0,U.useState)(null),[N,I]=(0,U.useState)(!1),[ne,se]=(0,U.useState)(Date.now()),[L,R]=(0,U.useState)(null),z=(0,U.useRef)(!0),B=(0,U.useRef)(null),V=(0,U.useRef)(!1),ue=(0,U.useRef)(!1),H=b(T?[`device-pairing-setup`,T.id]:null,()=>ae(T.id),{refreshInterval:1500}),W=H.data?.request,G=W?.status===`completed`,K=G&&W.connectedAt!==void 0,J=b(K&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),Y=T?.targetKind===`mobile`?T.universalLink:``,X=A(()=>fe(Y),[Y],{enabled:!!Y,initial:null,errorData:null}),Z=r===`zh`?`https://xopc.ai/zh#download`:`https://xopc.ai/en#download`,me=r===`zh`?`https://xopcai.github.io/xopc/zh/browser-extension`:`https://xopcai.github.io/xopc/browser-extension`,he=A(()=>fe(Z),[Z],{enabled:!S&&e===`mobile`,initial:null,errorData:null});(0,U.useEffect)(()=>{z.current=!0;let e=setInterval(()=>se(Date.now()),1e3);return()=>{z.current=!1,clearInterval(e),B.current&&re(B.current).catch(()=>{})}},[]);let ge=(0,U.useCallback)(async()=>{if(!V.current){V.current=!0,I(!0),j(null);try{B.current&&await re(B.current),B.current=null,E(void 0);let t=await ie(e);if(t.kind===`ready`){if(!z.current){await re(t.setup.id);return}B.current=t.setup.id,E(t.setup)}else await w.mutate()}catch{z.current&&j(`create`)}finally{V.current=!1,z.current&&I(!1)}}},[w,e]);(0,U.useEffect)(()=>{w.data?.ready&&!T&&O!==`create`&&!V.current&&ge()},[w.data,T,O,ge]),(0,U.useEffect)(()=>{K&&!ue.current&&(ue.current=!0,n?.())},[K,n]);let _e=async e=>{if(W){I(!0),j(null);try{await le(W,e),await H.mutate()}catch{j(`decision`),await H.mutate()}finally{z.current&&I(!1)}}},ve=(0,U.useRef)(0);(0,U.useEffect)(()=>{H.data&&(ve.current=H.data.serverTime-Date.now())},[H.data]);let Q=ne+ve.current,ye=T&&Q>=T.expiresAt&&!W,be=W&&[`expired`,`rejected`,`cancelled`].includes(W.status),xe=T?T.expiresAt-Q<6e4:!1,Se=T?xe?`${Math.max(0,Math.ceil((T.expiresAt-Q)/1e3))}s`:v.valid:``,$=e===`mobile`?{connect:a.mobileScan,connectHint:a.mobileScanHint,allowTitle:a.mobileAllowTitle,success:a.mobileSuccess,successHint:a.mobileSuccessHint}:{connect:a.browserConnect,connectHint:a.browserConnectHint,allowTitle:a.browserAllowTitle,success:a.browserSuccess,successHint:a.browserSuccessHint},Ce=e===`mobile`?a.mobilePrepareTitle:a.browserPrepareTitle,we=e===`mobile`?a.mobilePrepareHint:a.browserPrepareHint,Te=S?K?$.success:W?.status===`pending`?$.allowTitle:G||W?.status===`approved`?v.waiting:T?$.connect:v.title:Ce,Ee=O===`create`?v.createFailed:O===`decision`?v.decisionFailed:O===`background`?v.backgroundFailed:O===`download`?a.browserDownloadFailed:null,De=async()=>{I(!0),j(null);try{await ce()}catch{j(`download`)}finally{z.current&&I(!1)}};return(0,q.jsxs)(h,{children:[(0,q.jsx)(p,{className:d(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ee)}),(0,q.jsxs)(g,{className:d(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,M),children:[(0,q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,q.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,q.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":v.cancel,onClick:t,children:(0,q.jsx)(l,{className:`size-4`})})]}),(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[K?(0,q.jsx)(o,{className:`mb-5 size-7 text-success`}):null,(0,q.jsx)(_,{className:`text-xl font-semibold tracking-tight text-fg`,children:Te}),(0,q.jsx)(m,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:S?K?$.successHint:G?v.waitingForDevice:W?W.displayName:T?$.connectHint:v.intro:we}),Ee?(0,q.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:Ee}):null,S&&w.error?(0,q.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:v.readinessFailed}):null,S&&H.error?(0,q.jsx)(`p`,{role:`status`,className:`mt-4 text-sm text-warning`,children:v.statusUnavailable}):null,S?w.data?K?(0,q.jsxs)(q.Fragment,{children:[J.data?(0,q.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[a.background,(0,q.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":J.data.runInBackground??!1,disabled:!J.data.backgroundSupported,checked:J.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>J.mutate(e.behavior)).catch(()=>j(`background`))}})]}):null,(0,q.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:a.sleep})]}):be||ye?(0,q.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:ye||W?.status===`expired`?v.expired:v.declined}),(0,q.jsx)(k,{variant:`primary`,onClick:()=>void ge(),disabled:N,children:v.refresh})]}):W?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:v.scope}),(0,q.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[W.confirmationCode.slice(0,3),` `,W.confirmationCode.slice(3)]}),(0,q.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:v.compare}),(0,q.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,q.jsx)(`summary`,{className:`cursor-pointer py-2`,children:v.access}),(0,q.jsx)(`p`,{children:v.accessHint})]})]}):T?.targetKind===`mobile`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`my-6 flex flex-col items-center`,children:[(0,q.jsx)(`div`,{className:`rounded-[1.75rem] border border-edge bg-surface-hover/55 p-2.5 shadow-surface`,children:(0,q.jsx)(`div`,{className:`rounded-[1.25rem] bg-white p-2 shadow-sm ring-1 ring-black/5`,children:X.data?(0,q.jsx)(`img`,{src:X.data,alt:a.qrAlt,width:240,height:240,className:`size-[240px] max-w-full rounded-xl bg-white`}):X.error?null:(0,q.jsx)(D,{className:`size-[240px] rounded-xl`})})}),X.error?null:(0,q.jsxs)(`p`,{className:d(`mt-4 inline-flex min-h-8 items-center gap-1.5 rounded-full px-3 text-xs font-medium`,xe?`bg-warning-soft text-warning`:`bg-surface-hover text-fg-muted`),"aria-live":`polite`,children:[(0,q.jsx)(F,{className:`size-3.5`,"aria-hidden":`true`}),Se]})]}),X.error?(0,q.jsx)(`p`,{role:`status`,className:`text-center text-sm text-warning`,children:v.qrFailed}):null,X.error?(0,q.jsx)(`div`,{className:`mt-5`,children:(0,q.jsx)(x,{text:T.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}):(0,q.jsxs)(`details`,{className:`group mx-auto mt-1 w-full max-w-sm rounded-xl border border-edge bg-surface-panel text-xs text-fg-muted`,children:[(0,q.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 rounded-xl px-3.5 transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden`,children:[(0,q.jsx)(`span`,{children:v.fallback}),(0,q.jsx)(P,{className:`size-3.5 shrink-0 transition-transform group-open:rotate-90`,"aria-hidden":`true`})]}),(0,q.jsx)(`div`,{className:`border-t border-edge-subtle p-3`,children:(0,q.jsx)(x,{text:T.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})})]})]}):T?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`ol`,{className:`mt-7 space-y-2 text-sm leading-6 text-fg-muted`,children:[(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserConnectStep1]}),(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserConnectStep2]}),(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserConnectStep3]})]}),(0,q.jsx)(`div`,{className:`mt-6`,children:(0,q.jsx)(x,{text:T.browserInvitation,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}),(0,q.jsx)(`p`,{className:`mt-3 text-center text-xs text-fg-muted`,children:T.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((T.expiresAt-Q)/1e3))}s`:v.valid})]}):w.data.ready?(0,q.jsx)(`div`,{className:`mt-8`,children:(0,q.jsx)(D,{className:`mx-auto size-[216px]`})}):(0,q.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[L===`tailscale`?(0,q.jsx)(de,{embedded:!0}):L===`https`?(0,q.jsx)(te,{}):L===`choices`?(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsx)(k,{variant:`secondary`,className:`w-full`,onClick:()=>R(`tailscale`),children:a.useTailscale}),(0,q.jsx)(k,{variant:`secondary`,className:`w-full`,onClick:()=>R(`https`),children:a.useOwnHttps})]}):(0,q.jsx)(pe,{}),(0,q.jsx)(k,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>R(L?null:`choices`),children:L?v.back:v.existing})]}):(0,q.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,q.jsx)(D,{className:`h-5 w-3/4`}),(0,q.jsx)(D,{className:`h-40 w-full`})]}):e===`mobile`?(0,q.jsxs)(`div`,{className:`mt-7 flex flex-col items-center`,children:[he.data?(0,q.jsx)(`img`,{src:he.data,alt:a.mobileDownloadQrAlt,width:144,height:144,className:`size-36 rounded-lg bg-white`}):(0,q.jsx)(D,{className:`size-36`}),(0,q.jsxs)(k,{variant:`secondary`,className:`mt-5 w-full`,onClick:()=>void y(Z),children:[(0,q.jsx)(c,{className:`size-4`}),a.mobileDownload]}),(0,q.jsx)(`p`,{className:`mt-3 text-center text-xs leading-5 text-fg-muted`,children:a.mobileDownloadHint})]}):(0,q.jsxs)(`div`,{className:`mt-7`,children:[(0,q.jsxs)(k,{variant:`secondary`,className:`w-full`,disabled:N,onClick:()=>void De(),children:[(0,q.jsx)(s,{className:`size-4`}),a.browserDownload]}),(0,q.jsxs)(`ol`,{className:`mt-5 space-y-3 text-sm leading-6 text-fg-muted`,children:[(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserInstallStep1]}),(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserInstallStep2]}),(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserInstallStep3]})]}),(0,q.jsxs)(`button`,{type:`button`,className:`mt-5 inline-flex items-center gap-1 text-xs text-accent hover:underline`,onClick:()=>void y(me),children:[a.browserInstallHelp,(0,q.jsx)(c,{className:`size-3`})]})]})]}),!S||w.error||K||W?.status===`pending`||O===`create`||O===`decision`?(0,q.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:S?K?(0,q.jsx)(k,{className:`w-full`,variant:`primary`,onClick:t,children:v.done}):W?.status===`pending`?(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(k,{className:`w-full`,variant:`primary`,disabled:N,onClick:()=>void _e(`approve`),children:v.allow}),(0,q.jsx)(k,{className:`w-full`,variant:`ghost`,disabled:N,onClick:()=>void _e(`reject`),children:v.cancel})]}):w.error?(0,q.jsx)(k,{className:`w-full`,variant:`primary`,onClick:()=>void w.mutate(),children:v.retry}):(0,q.jsx)(k,{className:`w-full`,variant:`primary`,disabled:N,onClick:()=>void ge(),children:v.retry}):(0,q.jsx)(k,{className:`w-full`,variant:`primary`,onClick:()=>{j(null),C(!0)},children:e===`mobile`?a.mobileReady:a.browserReady})}):null]})]})}export{J as n,Y as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import{Ed as r,Fc as i,Qa as a,no as o,ro as s}from"./index-BvAvfZ5R.js";var c=e(),l=t();function u(e){let t=(0,c.c)(27),{value:a,onPick:o,disabled:u,placeholder:d,title:f,className:p,maxWidthClass:m,compact:h,"aria-label":g}=e,_=m===void 0?`max-w-[min(12rem,40vw)]`:m,v=h===void 0?!1:h,y,b;t[0]!==d||t[1]!==a?(b=a.trim(),y=b?s(b):d??``,t[0]=d,t[1]=a,t[2]=y,t[3]=b):(y=t[2],b=t[3]);let x=y,S=f??(b||void 0),C=g??f??x,w=v?`inline-flex size-9 shrink-0 items-center justify-center rounded-lg p-0`:`inline-flex min-h-8 min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,T=!v&&_,E=u&&`cursor-not-allowed opacity-60`,D;t[4]!==p||t[5]!==w||t[6]!==T||t[7]!==E?(D=n(w,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,i.transition,i.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,T,E,p),t[4]=p,t[5]=w,t[6]=T,t[7]=E,t[8]=D):D=t[8];let O;t[9]!==u||t[10]!==o?(O=e=>{e.stopPropagation(),u||o()},t[9]=u,t[10]=o,t[11]=O):O=t[11];let k=v?`size-4`:`size-3.5`,A;t[12]===k?A=t[13]:(A=n(`shrink-0 text-fg-muted`,k),t[12]=k,t[13]=A);let j;t[14]===A?j=t[15]:(j=(0,l.jsx)(r,{className:A,"aria-hidden":!0}),t[14]=A,t[15]=j);let M;t[16]!==v||t[17]!==x?(M=v?null:(0,l.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:x}),t[16]=v,t[17]=x,t[18]=M):M=t[18];let N;return t[19]!==u||t[20]!==O||t[21]!==j||t[22]!==M||t[23]!==S||t[24]!==C||t[25]!==D?(N=(0,l.jsxs)(`button`,{type:`button`,disabled:u,title:S,"aria-label":C,className:D,onClick:O,children:[j,M]}),t[19]=u,t[20]=O,t[21]=j,t[22]=M,t[23]=S,t[24]=C,t[25]=D,t[26]=N):N=t[26],N}function d(e){let t=(0,c.c)(39),{value:r,onChange:i,disabled:s,wd:d,placeholder:f,inputAriaLabel:p,inputClassName:m,autoFocus:h,trailing:g}=e,_;t[0]!==i||t[1]!==r?(_={initialPath:r,onPicked:i},t[0]=i,t[1]=r,t[2]=_):_=t[2];let v=o(_),y;t[3]===r?y=t[4]:(y=r.trim(),t[3]=r,t[4]=y);let b=y,x=b?`${b}\n${d.chooseFolder}`:`${f??d.notSet}\n${d.selectWorkingDirectory}`,S;t[5]===m?S=t[6]:(S=n(`min-w-0 flex-1`,m),t[5]=m,t[6]=S);let C=s||v.picking,w;t[7]===i?w=t[8]:(w=e=>void i(e.target.value),t[7]=i,t[8]=w);let T=f??d.pathInputPlaceholder,E;t[9]!==h||t[10]!==p||t[11]!==S||t[12]!==C||t[13]!==w||t[14]!==T||t[15]!==r?(E=(0,l.jsx)(`input`,{type:`text`,className:S,value:r,disabled:C,onChange:w,placeholder:T,"aria-label":p,autoFocus:h,autoComplete:`off`,spellCheck:!1}),t[9]=h,t[10]=p,t[11]=S,t[12]=C,t[13]=w,t[14]=T,t[15]=r,t[16]=E):E=t[16];let D=s||v.picking,O;t[17]!==x||t[18]!==v.pick||t[19]!==D||t[20]!==r||t[21]!==d.selectWorkingDirectory?(O=(0,l.jsx)(u,{compact:!0,value:r,onPick:v.pick,disabled:D,title:x,"aria-label":d.selectWorkingDirectory}),t[17]=x,t[18]=v.pick,t[19]=D,t[20]=r,t[21]=d.selectWorkingDirectory,t[22]=O):O=t[22];let k;t[23]!==O||t[24]!==g?(k=(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[O,g]}),t[23]=O,t[24]=g,t[25]=k):k=t[25];let A;t[26]!==k||t[27]!==E?(A=(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[E,k]}),t[26]=k,t[27]=E,t[28]=A):A=t[28];let j;t[29]!==v.confirmPick||t[30]!==v.hasNativePicker||t[31]!==v.modalOpen||t[32]!==v.setModalOpen||t[33]!==b||t[34]!==d?(j=v.hasNativePicker?null:(0,l.jsx)(a,{open:v.modalOpen,onOpenChange:v.setModalOpen,initialAbsolutePath:b||void 0,onConfirm:v.confirmPick,wd:d}),t[29]=v.confirmPick,t[30]=v.hasNativePicker,t[31]=v.modalOpen,t[32]=v.setModalOpen,t[33]=b,t[34]=d,t[35]=j):j=t[35];let M;return t[36]!==A||t[37]!==j?(M=(0,l.jsxs)(l.Fragment,{children:[A,j]}),t[36]=A,t[37]=j,t[38]=M):M=t[38],M}export{d as t};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./messages-CaeL_miw.js";import{n as i}from"./locale-store-CE7L6MlS.js";import{Ro as a}from"./index-BvAvfZ5R.js";import{n as o,r as s}from"./settings-page-layout-Dx5S-Msc.js";var c=t();e();var l=n();function u(){let e=(0,c.c)(40),t=i(p),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let u=n.extensionDebug,m=a(),h;e[2]===m?h=e[3]:(h=m.toSorted(f),e[2]=m,e[3]=h);let g=h,_;e[4]!==u.subtitle||e[5]!==u.title?(_=(0,l.jsx)(o,{title:u.title,subtitle:u.subtitle}),e[4]=u.subtitle,e[5]=u.title,e[6]=_):_=e[6];let v;e[7]===u.listHeading?v=e[8]:(v=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.listHeading}),e[7]=u.listHeading,e[8]=v);let y;e[9]===u.colId?y=e[10]:(y=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colId}),e[9]=u.colId,e[10]=y);let b;e[11]===u.colName?b=e[12]:(b=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colName}),e[11]=u.colName,e[12]=b);let x;e[13]===u.colPermissions?x=e[14]:(x=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colPermissions}),e[13]=u.colPermissions,e[14]=x);let S;e[15]!==y||e[16]!==b||e[17]!==x?(S=(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{className:`text-xs uppercase text-fg-muted`,children:[y,b,x]})}),e[15]=y,e[16]=b,e[17]=x,e[18]=S):S=e[18];let C;e[19]===g?C=e[20]:(C=g.map(d),e[19]=g,e[20]=C);let w;e[21]===C?w=e[22]:(w=(0,l.jsx)(`tbody`,{children:C}),e[21]=C,e[22]=w);let T;e[23]!==S||e[24]!==w?(T=(0,l.jsx)(`div`,{className:`mt-3 overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[32rem] border-separate border-spacing-y-1 text-left text-sm`,children:[S,w]})}),e[23]=S,e[24]=w,e[25]=T):T=e[25];let E;e[26]!==T||e[27]!==v?(E=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[v,T]}),e[26]=T,e[27]=v,e[28]=E):E=e[28];let D;e[29]===u.futureHeading?D=e[30]:(D=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.futureHeading}),e[29]=u.futureHeading,e[30]=D);let O;e[31]===u.futureBody?O=e[32]:(O=(0,l.jsx)(`p`,{className:`mt-2`,children:u.futureBody}),e[31]=u.futureBody,e[32]=O);let k;e[33]!==D||e[34]!==O?(k=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4 text-sm text-fg-muted`,children:[D,O]}),e[33]=D,e[34]=O,e[35]=k):k=e[35];let A;return e[36]!==E||e[37]!==k||e[38]!==_?(A=(0,l.jsxs)(s,{gap:`gap-5`,children:[_,E,k]}),e[36]=E,e[37]=k,e[38]=_,e[39]=A):A=e[39],A}function d(e){return(0,l.jsxs)(`tr`,{className:`bg-surface-base/55`,children:[(0,l.jsx)(`td`,{className:`rounded-l-lg px-3 py-2 font-mono text-xs text-fg`,children:e.id}),(0,l.jsx)(`td`,{className:`px-3 py-2 text-fg`,children:e.name}),(0,l.jsx)(`td`,{className:`rounded-r-lg px-3 py-2 font-mono text-xs text-fg-muted`,children:(e.ui?.permissions??[]).join(`, `)||`—`})]},e.id)}function f(e,t){return e.id.localeCompare(t.id)}function p(e){return e.language}export{u as ExtensionDebugPage};