@xopcai/xopc 0.0.111 → 0.0.113

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 (443) hide show
  1. package/dist/browser-ext/icons/icon-128.png +0 -0
  2. package/dist/browser-ext/icons/icon-16.png +0 -0
  3. package/dist/browser-ext/icons/icon-32.png +0 -0
  4. package/dist/browser-ext/icons/icon-48.png +0 -0
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  7. package/dist/extensions/feishu/src/workflow-progress.js +1 -1
  8. package/dist/extensions/telegram/src/adapters/streaming-adapter.js +1 -1
  9. package/dist/extensions/telegram/src/inbound-processor.js +1 -1
  10. package/dist/extensions/telegram/src/plugin.js +1 -1
  11. package/dist/extensions/telegram/src/routing-integration.js +2 -2
  12. package/dist/extensions/telegram/src/update-offset-store.js +1 -1
  13. package/dist/extensions/telegram/src/workflow-progress.js +1 -1
  14. package/dist/extensions/telegram/xopc.extension.json +1 -1
  15. package/dist/extensions/weixin/src/api/api.js +2 -2
  16. package/dist/extensions/weixin/src/auth/accounts.js +1 -1
  17. package/dist/extensions/weixin/src/cdn/upload.js +1 -1
  18. package/dist/extensions/weixin/src/delivery-to.d.ts +3 -3
  19. package/dist/extensions/weixin/src/delivery-to.js.map +1 -1
  20. package/dist/extensions/weixin/src/media/data-url.js +1 -1
  21. package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
  22. package/dist/extensions/weixin/src/messaging/inbound.js +1 -1
  23. package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
  24. package/dist/extensions/weixin/src/plugin.js +1 -1
  25. package/dist/extensions/weixin/src/storage/sync-buf.js +1 -1
  26. package/dist/extensions/weixin/src/workflow-progress.js +1 -1
  27. package/dist/gateway/static/root/apple-touch-icon.png +0 -0
  28. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-zlx9l5Yp.js → agent-avatar-dicebear-CBlklyNr.js} +1 -1
  29. package/dist/gateway/static/root/assets/agent-browser-settings-page-rGbKc2Hh.js +6 -0
  30. package/dist/gateway/static/root/assets/{agent-defaults-tabbed-page-Bz7JWjRM.js → agent-defaults-tabbed-page-CtwVbjOA.js} +1 -1
  31. package/dist/gateway/static/root/assets/agents-CCBmGcwc.js +71 -0
  32. package/dist/gateway/static/root/assets/{app-management-settings-panel-DaQwdeCq.js → app-management-settings-panel-28E_WfMe.js} +1 -1
  33. package/dist/gateway/static/root/assets/{appearance-settings-D2zv6r3P.js → appearance-settings-Do1z0XgJ.js} +1 -1
  34. package/dist/gateway/static/root/assets/{apps-page-BIppe_jj.js → apps-page-xwCsJS15.js} +1 -1
  35. package/dist/gateway/static/root/assets/{archive-plugin-DEmu8eH7.js → archive-plugin-BAFlsov_.js} +1 -1
  36. package/dist/gateway/static/root/assets/{attachment-load-B98lJoN5.js → attachment-load-V3qGPC3x.js} +1 -1
  37. package/dist/gateway/static/root/assets/{binary-plugins-CL9QKmyo.js → binary-plugins-DT8NvA6W.js} +1 -1
  38. package/dist/gateway/static/root/assets/{block-editor-BOAhMAhT.js → block-editor-CdLMEcHd.js} +1 -1
  39. package/dist/gateway/static/root/assets/{channels-settings-Br8iRnXp.js → channels-settings-C044DcYk.js} +1 -1
  40. package/dist/gateway/static/root/assets/{config-api-0o1WYdz2.js → config-api-Bf5mjpu7.js} +1 -1
  41. package/dist/gateway/static/root/assets/config-reload-event-Bjh2zoKp.js +1 -0
  42. package/dist/gateway/static/root/assets/connectors-settings-8VEWUOTj.js +2 -0
  43. package/dist/gateway/static/root/assets/cron-api--pAB_rps.js +1 -0
  44. package/dist/gateway/static/root/assets/cron-page-DqmNGNOy.js +3 -0
  45. package/dist/gateway/static/root/assets/dreaming-settings-6UZE1FSK.js +1 -0
  46. package/dist/gateway/static/root/assets/{extension-debug-page-Cjx6pZVz.js → extension-debug-page-BGhE7msg.js} +1 -1
  47. package/dist/gateway/static/root/assets/{extension-page-BSPNL90V.js → extension-page-CvpI45WG.js} +1 -1
  48. package/dist/gateway/static/root/assets/extension-settings-page-DAmR5FUe.js +1 -0
  49. package/dist/gateway/static/root/assets/{fetch-Bs7in_4F.js → fetch-NZmjSXLl.js} +1 -1
  50. package/dist/gateway/static/root/assets/format-cron-label-BsotZDO5.js +2 -0
  51. package/dist/gateway/static/root/assets/{format-interval-label-CftJ5uXu.js → format-interval-label-qhth3BMV.js} +1 -1
  52. package/dist/gateway/static/root/assets/{gateway-config-api-Clfck-hW.js → gateway-config-api-CaXBt-9R.js} +1 -1
  53. package/dist/gateway/static/root/assets/gateway-settings-DphpbLBc.js +1 -0
  54. package/dist/gateway/static/root/assets/{gateway-startup-retry-BkjVJc38.js → gateway-startup-retry-Be1omjh3.js} +1 -1
  55. package/dist/gateway/static/root/assets/{goal-detail-page-kqJue0sE.js → goal-detail-page-bv0VRDaf.js} +1 -1
  56. package/dist/gateway/static/root/assets/goals-page-1Ywnt4Cb.js +2 -0
  57. package/dist/gateway/static/root/assets/{goals-settings-CJnzNSDo.js → goals-settings-ceEBjnfc.js} +1 -1
  58. package/dist/gateway/static/root/assets/{heartbeat-config-api-Cp7CPuIn.js → heartbeat-config-api-BzO6G4fD.js} +1 -1
  59. package/dist/gateway/static/root/assets/{heartbeat-settings-ifSI1Wbh.js → heartbeat-settings-DCST9-du.js} +1 -1
  60. package/dist/gateway/static/root/assets/index-Cxm6xsps.js +122 -0
  61. package/dist/gateway/static/root/assets/index-b_R4tKqt.css +1 -0
  62. package/dist/gateway/static/root/assets/interval-presets-DJmshV8n.js +1 -0
  63. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings--MI1rYl7.js → keyboard-shortcuts-settings-9AUUlQ5Q.js} +1 -1
  64. package/dist/gateway/static/root/assets/{logs-page-BwrVNlyW.js → logs-page-B_wrxhee.js} +1 -1
  65. package/dist/gateway/static/root/assets/{markdown-split-B_oc9lJe.js → markdown-split-CYYELqAr.js} +1 -1
  66. package/dist/gateway/static/root/assets/{media-plugins-DLPvB5H3.js → media-plugins-BEcMR2M8.js} +1 -1
  67. package/dist/gateway/static/root/assets/messages-CkT-lcgP.js +3 -0
  68. package/dist/gateway/static/root/assets/models-hub-panel-D0JDSbNu.js +2 -0
  69. package/dist/gateway/static/root/assets/note-detail-page-DpFV-EO6.js +2 -0
  70. package/dist/gateway/static/root/assets/{note-image-lightbox-rSqAgOi9.js → note-image-lightbox-DNAoPcmm.js} +1 -1
  71. package/dist/gateway/static/root/assets/{notes-page-C9ACGEty.js → notes-page-CdkjTch8.js} +1 -1
  72. package/dist/gateway/static/root/assets/{preview-open-alternatives-Bw_N2oZi.js → preview-open-alternatives-BPLz0AIv.js} +1 -1
  73. package/dist/gateway/static/root/assets/{remote-access-hub-BhcWIKuM.js → remote-access-hub-DSYVAi96.js} +1 -1
  74. package/dist/gateway/static/root/assets/{save-bar-controls-CNP2jmw0.js → save-bar-controls-CrWwWRVK.js} +1 -1
  75. package/dist/gateway/static/root/assets/schedule-field-CF2sadvN.js +1 -0
  76. package/dist/gateway/static/root/assets/{schema-form-CDPzua9q.js → schema-form-Di5cKjYE.js} +1 -1
  77. package/dist/gateway/static/root/assets/{sessions-page-DzkpSDZr.js → sessions-page-CenkcVjF.js} +1 -1
  78. package/dist/gateway/static/root/assets/settings-advanced-gate-D9sva86V.js +1 -0
  79. package/dist/gateway/static/root/assets/{settings-collapsible-section-C9bff85B.js → settings-collapsible-section-Chh282jW.js} +1 -1
  80. package/dist/gateway/static/root/assets/settings-form-section-Dq-83cQd.js +1 -0
  81. package/dist/gateway/static/root/assets/{settings-page-DWK4Zo7s.js → settings-page-DL35U0x0.js} +1 -1
  82. package/dist/gateway/static/root/assets/setup-status-panel-Ctwbp9Er.js +1 -0
  83. package/dist/gateway/static/root/assets/{share-preview-page-DnutoY_S.js → share-preview-page-0FXYnSUA.js} +1 -1
  84. package/dist/gateway/static/root/assets/{shares-settings-6oRgJMpn.js → shares-settings-DIM3JNsr.js} +1 -1
  85. package/dist/gateway/static/root/assets/skill-reload-api-DAlNaNzL.js +1 -0
  86. package/dist/gateway/static/root/assets/skills-page-CLrHVzAt.js +2 -0
  87. package/dist/gateway/static/root/assets/{system-settings-panel-qP1JDtDd.js → system-settings-panel-W1pTcojB.js} +1 -1
  88. package/dist/gateway/static/root/assets/use-agent-defaults-form-BVRvkK7m.js +1 -0
  89. package/dist/gateway/static/root/assets/{use-channel-catalog-C4mg1hjD.js → use-channel-catalog-CgJibfMM.js} +1 -1
  90. package/dist/gateway/static/root/assets/{use-settings-tab-guard-F6C0mpJt.js → use-settings-tab-guard-Bw_qkRQE.js} +1 -1
  91. package/dist/gateway/static/root/assets/{voice-api-key-field-BnDDb6qO.js → voice-api-key-field-vYAO71Gn.js} +1 -1
  92. package/dist/gateway/static/root/assets/{voice-player-store-B2EwIhtY.js → voice-player-store-C7lziaAx.js} +1 -1
  93. package/dist/gateway/static/root/assets/{workflow-page.utils-CRB7WX9l.js → workflow-page.utils-sgHjOXOm.js} +1 -1
  94. package/dist/gateway/static/root/assets/{workflows-page-2Fptr0je.js → workflows-page-DYyOTmFx.js} +1 -1
  95. package/dist/gateway/static/root/favicon-16x16.png +0 -0
  96. package/dist/gateway/static/root/favicon-32x32.png +0 -0
  97. package/dist/gateway/static/root/favicon-icon.svg +1 -0
  98. package/dist/gateway/static/root/favicon.ico +0 -0
  99. package/dist/gateway/static/root/favicon.png +0 -0
  100. package/dist/gateway/static/root/favicon.svg +24 -15
  101. package/dist/gateway/static/root/index.html +11 -10
  102. package/dist/gateway/static/root/logo-dark.svg +23 -15
  103. package/dist/gateway/static/root/logo.svg +23 -16
  104. package/dist/package.js +1 -1
  105. package/dist/src/agent/agent-manager.d.ts +28 -2
  106. package/dist/src/agent/agent-manager.js +82 -11
  107. package/dist/src/agent/agent-manager.js.map +1 -1
  108. package/dist/src/agent/agent-scope.js +1 -1
  109. package/dist/src/agent/bootstrap/load-bootstrap-files.js +1 -1
  110. package/dist/src/agent/context/workspace-seed.js +2 -2
  111. package/dist/src/agent/context/workspace-state.js +1 -1
  112. package/dist/src/agent/context/workspace.js +1 -1
  113. package/dist/src/agent/goals/goal-locale.js +2 -2
  114. package/dist/src/agent/goals/persistent-goal-service.js +1 -1
  115. package/dist/src/agent/goals/post-turn.js +3 -3
  116. package/dist/src/agent/image/load-image-media.js +2 -2
  117. package/dist/src/agent/ipc/inbox.js +3 -3
  118. package/dist/src/agent/ipc/socket.js +1 -1
  119. package/dist/src/agent/mcp/bundle-mcp-materialize.js +1 -1
  120. package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
  121. package/dist/src/agent/mcp/mcp-transport-config.js +1 -1
  122. package/dist/src/agent/mcp/mcp-transport.js +1 -1
  123. package/dist/src/agent/memory/builtin-memory-store.js +1 -1
  124. package/dist/src/agent/memory/dreaming/deep-promotion.js +1 -1
  125. package/dist/src/agent/memory/dreaming/events.js +1 -1
  126. package/dist/src/agent/memory/dreaming/last-run.js +1 -1
  127. package/dist/src/agent/memory/dreaming/light-sweep.js +1 -1
  128. package/dist/src/agent/memory/dreaming/preview.js +1 -1
  129. package/dist/src/agent/memory/dreaming/rem-patterns.js +1 -1
  130. package/dist/src/agent/memory/dreaming/short-term-store.js +1 -1
  131. package/dist/src/agent/memory/dreaming/utils.js +1 -1
  132. package/dist/src/agent/memory/memory-flush.js +1 -1
  133. package/dist/src/agent/memory/plugin-discovery.js +1 -1
  134. package/dist/src/agent/messaging/command-handler.d.ts +3 -0
  135. package/dist/src/agent/messaging/command-handler.js +5 -0
  136. package/dist/src/agent/messaging/command-handler.js.map +1 -1
  137. package/dist/src/agent/models/manager.js +1 -1
  138. package/dist/src/agent/prompt/memory/index.js +1 -1
  139. package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
  140. package/dist/src/agent/reply/post-compaction-context.js +1 -1
  141. package/dist/src/agent/reply/workspace-boundary-read.js +1 -1
  142. package/dist/src/agent/sandbox/path-policy.js +2 -2
  143. package/dist/src/agent/service/process-direct-streaming.js +9 -4
  144. package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
  145. package/dist/src/agent/service/reconcile-dreaming-cron.js +8 -5
  146. package/dist/src/agent/service/reconcile-dreaming-cron.js.map +1 -1
  147. package/dist/src/agent/service.d.ts +2 -1
  148. package/dist/src/agent/service.js +10 -5
  149. package/dist/src/agent/service.js.map +1 -1
  150. package/dist/src/agent/service.types.d.ts +4 -0
  151. package/dist/src/agent/session/session-config-service.d.ts +8 -0
  152. package/dist/src/agent/session/session-config-service.js +20 -0
  153. package/dist/src/agent/session/session-config-service.js.map +1 -1
  154. package/dist/src/agent/session/session-inspector.js +1 -1
  155. package/dist/src/agent/skills/config.js +2 -2
  156. package/dist/src/agent/skills/filesystem-watcher.d.ts +19 -0
  157. package/dist/src/agent/skills/filesystem-watcher.js +182 -0
  158. package/dist/src/agent/skills/filesystem-watcher.js.map +1 -0
  159. package/dist/src/agent/skills/hub-hash.js +2 -2
  160. package/dist/src/agent/skills/hub-lock.js +1 -1
  161. package/dist/src/agent/skills/hub-pull.js +30 -36
  162. package/dist/src/agent/skills/hub-pull.js.map +1 -1
  163. package/dist/src/agent/skills/index.js +82 -38
  164. package/dist/src/agent/skills/index.js.map +1 -1
  165. package/dist/src/agent/skills/installer.js +2 -2
  166. package/dist/src/agent/skills/managed-store.d.ts +19 -0
  167. package/dist/src/agent/skills/managed-store.js +97 -38
  168. package/dist/src/agent/skills/managed-store.js.map +1 -1
  169. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  170. package/dist/src/agent/skills/skill-manager.d.ts +16 -6
  171. package/dist/src/agent/skills/skill-manager.js +79 -24
  172. package/dist/src/agent/skills/skill-manager.js.map +1 -1
  173. package/dist/src/agent/skills/skill-view-path.js +1 -1
  174. package/dist/src/agent/skills/test-framework.js +1 -1
  175. package/dist/src/agent/skills/types.d.ts +11 -0
  176. package/dist/src/agent/skills/watcher.js +1 -1
  177. package/dist/src/agent/starter-agents.js +1 -1
  178. package/dist/src/agent/tools/cronjob-tool.d.ts +6 -3
  179. package/dist/src/agent/tools/cronjob-tool.js +58 -23
  180. package/dist/src/agent/tools/cronjob-tool.js.map +1 -1
  181. package/dist/src/agent/tools/dreaming-tool.js +1 -1
  182. package/dist/src/agent/tools/factory.js +1 -1
  183. package/dist/src/agent/tools/find.js +1 -1
  184. package/dist/src/agent/tools/grep.js +1 -1
  185. package/dist/src/agent/tools/image-generate-tool.js +1 -1
  186. package/dist/src/agent/tools/skill-manage-tool.js +1 -1
  187. package/dist/src/agent/tools/workflow-tool.js +1 -1
  188. package/dist/src/agent/workflow/catalog.js +1 -1
  189. package/dist/src/agent/workspace-runtime/registry.d.ts +5 -0
  190. package/dist/src/agent/workspace-runtime/registry.js +7 -0
  191. package/dist/src/agent/workspace-runtime/registry.js.map +1 -1
  192. package/dist/src/ai-assist/text-assist.d.ts +42 -0
  193. package/dist/src/ai-assist/text-assist.js +252 -0
  194. package/dist/src/ai-assist/text-assist.js.map +1 -0
  195. package/dist/src/auth/credentials.js +2 -2
  196. package/dist/src/auth/profiles/store.js +2 -2
  197. package/dist/src/auth/sync-provider-auth.js +1 -1
  198. package/dist/src/browser/cache-dir-policy.js +1 -1
  199. package/dist/src/browser/cdp-local-launcher.js +2 -2
  200. package/dist/src/browser/providers/browser-ext-install.js +4 -4
  201. package/dist/src/browser/providers/cloakbrowser.js +5 -5
  202. package/dist/src/browser/providers/playwright-doctor.js +1 -1
  203. package/dist/src/browser/stealth.js +1 -1
  204. package/dist/src/channels/outbound/persist-store.js +1 -1
  205. package/dist/src/channels/pairing/allow-from-file.js +1 -1
  206. package/dist/src/channels/pairing/pairing-store.js +2 -2
  207. package/dist/src/channels/plugins/types.adapters.d.ts +2 -2
  208. package/dist/src/chat-commands/agent-edit.js +2 -2
  209. package/dist/src/chat-commands/builtins/config.js +3 -3
  210. package/dist/src/chat-commands/builtins/system.js +11 -4
  211. package/dist/src/chat-commands/builtins/system.js.map +1 -1
  212. package/dist/src/chat-commands/context.d.ts +3 -0
  213. package/dist/src/chat-commands/context.js +7 -0
  214. package/dist/src/chat-commands/context.js.map +1 -1
  215. package/dist/src/chat-commands/types.d.ts +2 -0
  216. package/dist/src/cli/commands/config.js +1 -1
  217. package/dist/src/cli/commands/cron.js +55 -16
  218. package/dist/src/cli/commands/cron.js.map +1 -1
  219. package/dist/src/cli/commands/doctor/checks/config-health.js +1 -1
  220. package/dist/src/cli/commands/doctor/checks/cron-health.js +2 -83
  221. package/dist/src/cli/commands/doctor/checks/cron-health.js.map +1 -1
  222. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  223. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  224. package/dist/src/cli/commands/doctor/checks/state-integrity.js +1 -1
  225. package/dist/src/cli/commands/doctor/checks/workspace-status.js +1 -1
  226. package/dist/src/cli/commands/extension-create.js +1 -1
  227. package/dist/src/cli/commands/extension-dev.js +2 -2
  228. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  229. package/dist/src/cli/commands/extension-pack.js +2 -2
  230. package/dist/src/cli/commands/extension.js +3 -3
  231. package/dist/src/cli/commands/gateway/logs.js +1 -1
  232. package/dist/src/cli/commands/image.js +1 -1
  233. package/dist/src/cli/commands/init.js +2 -2
  234. package/dist/src/cli/commands/models.js +1 -1
  235. package/dist/src/cli/commands/skills-test.js +1 -1
  236. package/dist/src/cli/templates.js +1 -1
  237. package/dist/src/cli/utils/gateway-client.js +1 -1
  238. package/dist/src/cli/utils/init-workspace-core.js +2 -2
  239. package/dist/src/config/agent-profile.js +1 -1
  240. package/dist/src/config/agent-typed-models.js +1 -1
  241. package/dist/src/config/gateway-bind.js +1 -1
  242. package/dist/src/config/index.js +7 -7
  243. package/dist/src/config/loader.js +4 -4
  244. package/dist/src/config/models-json.js +2 -2
  245. package/dist/src/config/paths-state.js +1 -1
  246. package/dist/src/config/paths.js +1 -1
  247. package/dist/src/config/profile.js +1 -1
  248. package/dist/src/config/reload.js +1 -1
  249. package/dist/src/config/schema.d.ts +0 -2
  250. package/dist/src/config/schema.js +0 -3
  251. package/dist/src/config/schema.js.map +1 -1
  252. package/dist/src/config/web-patch.d.ts +0 -1
  253. package/dist/src/config/web-patch.js +0 -2
  254. package/dist/src/config/web-patch.js.map +1 -1
  255. package/dist/src/config/workspace-path.js +1 -1
  256. package/dist/src/cron/executor.js +102 -71
  257. package/dist/src/cron/executor.js.map +1 -1
  258. package/dist/src/cron/index.d.ts +1 -1
  259. package/dist/src/cron/index.js +3 -3
  260. package/dist/src/cron/run-log-store.d.ts +1 -0
  261. package/dist/src/cron/run-log-store.js +4 -2
  262. package/dist/src/cron/run-log-store.js.map +1 -1
  263. package/dist/src/cron/schedule.d.ts +10 -0
  264. package/dist/src/cron/schedule.js +85 -0
  265. package/dist/src/cron/schedule.js.map +1 -0
  266. package/dist/src/cron/service.d.ts +34 -77
  267. package/dist/src/cron/service.js +327 -264
  268. package/dist/src/cron/service.js.map +1 -1
  269. package/dist/src/cron/types.d.ts +80 -50
  270. package/dist/src/cron/validation.d.ts +358 -90
  271. package/dist/src/cron/validation.js +152 -132
  272. package/dist/src/cron/validation.js.map +1 -1
  273. package/dist/src/cron/workflow-run-completion.js +1 -1
  274. package/dist/src/daemon/constants.js +1 -1
  275. package/dist/src/daemon/install-plan.js +2 -2
  276. package/dist/src/daemon/launchd.js +2 -2
  277. package/dist/src/daemon/schtasks.js +2 -2
  278. package/dist/src/daemon/systemd.js +2 -2
  279. package/dist/src/extensions/bundle-mcp.js +1 -1
  280. package/dist/src/extensions/discover-extensions.js +2 -2
  281. package/dist/src/extensions/health.js +1 -1
  282. package/dist/src/extensions/install.js +2 -2
  283. package/dist/src/extensions/loader.js +2 -2
  284. package/dist/src/extensions/lockfile.js +3 -3
  285. package/dist/src/extensions/security.js +1 -1
  286. package/dist/src/extensions/update.js +2 -2
  287. package/dist/src/gateway/agents-admin.js +2 -2
  288. package/dist/src/gateway/chat-stream/mapper.d.ts +1 -0
  289. package/dist/src/gateway/chat-stream/mapper.js +6 -2
  290. package/dist/src/gateway/chat-stream/mapper.js.map +1 -1
  291. package/dist/src/gateway/chat-stream/protocol.d.ts +2 -0
  292. package/dist/src/gateway/file-path-classifier.js +2 -2
  293. package/dist/src/gateway/hono/lib/config-payload.d.ts +0 -1
  294. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  295. package/dist/src/gateway/hono/lib/extension-store.js +2 -2
  296. package/dist/src/gateway/hono/lib/static-ui.js +2 -2
  297. package/dist/src/gateway/hono/oauth-async.js +1 -1
  298. package/dist/src/gateway/hono/routes/agents.js +1 -1
  299. package/dist/src/gateway/hono/routes/ai-assist.d.ts +3 -0
  300. package/dist/src/gateway/hono/routes/ai-assist.js +66 -0
  301. package/dist/src/gateway/hono/routes/ai-assist.js.map +1 -0
  302. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  303. package/dist/src/gateway/hono/routes/commands-skills.js +7 -0
  304. package/dist/src/gateway/hono/routes/commands-skills.js.map +1 -1
  305. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  306. package/dist/src/gateway/hono/routes/cron.js +24 -5
  307. package/dist/src/gateway/hono/routes/cron.js.map +1 -1
  308. package/dist/src/gateway/hono/routes/dreaming.js +1 -1
  309. package/dist/src/gateway/hono/routes/home.js +5 -3
  310. package/dist/src/gateway/hono/routes/home.js.map +1 -1
  311. package/dist/src/gateway/hono/routes/host-fs.js +2 -2
  312. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  313. package/dist/src/gateway/hono/routes/lazy-bundles.js.map +1 -1
  314. package/dist/src/gateway/hono/routes/models.js +1 -1
  315. package/dist/src/gateway/hono/routes/shares.js +1 -1
  316. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  317. package/dist/src/gateway/hono/routes/workspace.js +2 -2
  318. package/dist/src/gateway/lock.js +3 -3
  319. package/dist/src/gateway/ports.js +1 -1
  320. package/dist/src/gateway/service/agent-runner.js +2 -2
  321. package/dist/src/gateway/service/config-coordinator.js +1 -1
  322. package/dist/src/gateway/service/marketplace-service.d.ts +22 -10
  323. package/dist/src/gateway/service/marketplace-service.js +46 -5
  324. package/dist/src/gateway/service/marketplace-service.js.map +1 -1
  325. package/dist/src/gateway/service.js +11 -5
  326. package/dist/src/gateway/service.js.map +1 -1
  327. package/dist/src/gateway/workspace-fs-file-list.js +1 -1
  328. package/dist/src/goals/goal-notifications.js +1 -1
  329. package/dist/src/goals/goal-workflow-judge.js +3 -3
  330. package/dist/src/i18n/goals-bundle.js +1 -1
  331. package/dist/src/i18n/index.js +1 -1
  332. package/dist/src/i18n/share-tool-bundle.js +2 -2
  333. package/dist/src/infra/brew.js +1 -1
  334. package/dist/src/infra/package-json.js +1 -1
  335. package/dist/src/infra/package-update-steps.js +1 -1
  336. package/dist/src/infra/path-env.js +2 -2
  337. package/dist/src/infra/restart.js +1 -1
  338. package/dist/src/infra/stable-node-path.js +1 -1
  339. package/dist/src/infra/update-check.js +1 -1
  340. package/dist/src/infra/update-global.js +1 -1
  341. package/dist/src/infra/update-lock.js +2 -2
  342. package/dist/src/infra/update-restart.js +1 -1
  343. package/dist/src/infra/update-runner.js +1 -1
  344. package/dist/src/infra/update-startup.js +1 -1
  345. package/dist/src/infra/write-file-atomic.js +2 -2
  346. package/dist/src/media/store.js +1 -1
  347. package/dist/src/notes/agent-context.js +1 -1
  348. package/dist/src/notes/service.js +1 -1
  349. package/dist/src/notes/store.js +2 -2
  350. package/dist/src/project-trust/trust-store.js +2 -2
  351. package/dist/src/providers/auth-runtime/auth-profile-store.js +1 -1
  352. package/dist/src/providers/index.js +1 -1
  353. package/dist/src/providers/model-registry.js +4 -4
  354. package/dist/src/session/init-session-turn.js +2 -2
  355. package/dist/src/session/resolve-session.js +3 -3
  356. package/dist/src/session/session-title.js +2 -2
  357. package/dist/src/session/store-reader.d.ts +5 -0
  358. package/dist/src/session/store-reader.js +1 -0
  359. package/dist/src/session/store.js +1 -1
  360. package/dist/src/share/share-auto.js +2 -2
  361. package/dist/src/share/share-store.js +3 -3
  362. package/dist/src/share/share-thumbnail.js +2 -2
  363. package/dist/src/share/share-zip.js +1 -1
  364. package/dist/src/share/site-share-store.js +3 -3
  365. package/dist/src/share/site-static-serve.js +1 -1
  366. package/dist/src/storage/sqlite/connection.js +1 -1
  367. package/dist/src/storage/sqlite/cron-job-repository.d.ts +6 -0
  368. package/dist/src/storage/sqlite/cron-job-repository.js +70 -0
  369. package/dist/src/storage/sqlite/cron-job-repository.js.map +1 -0
  370. package/dist/src/storage/sqlite/cron-run-repository.js +0 -1
  371. package/dist/src/storage/sqlite/cron-run-repository.js.map +1 -1
  372. package/dist/src/storage/sqlite/index.d.ts +1 -0
  373. package/dist/src/storage/sqlite/index.js +2 -1
  374. package/dist/src/storage/sqlite/memory-index-repository.js +2 -2
  375. package/dist/src/storage/sqlite/migrations/009_cron_jobs.sql +24 -0
  376. package/dist/src/storage/sqlite/migrations/discover.js +1 -1
  377. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  378. package/dist/src/storage/sqlite/migrations/runner.js +4 -4
  379. package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
  380. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  381. package/dist/src/storage/sqlite/schema.js +2 -2
  382. package/dist/src/storage/sqlite/schema.sql +25 -0
  383. package/dist/src/tui/clipboard-image.js +3 -3
  384. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  385. package/dist/src/tui/theme-manager.js +1 -1
  386. package/dist/src/tui/tui-command-formatters.js +4 -4
  387. package/dist/src/tui/tui-commands.js +2 -2
  388. package/dist/src/tui/tui-keybindings-file.js +1 -1
  389. package/dist/src/tui/tui-scoped-models.js +2 -2
  390. package/dist/src/tui/tui-settings.js +1 -1
  391. package/dist/src/tui/tui-startup-resources.js +1 -1
  392. package/dist/src/tui/tui.js +6 -6
  393. package/dist/src/tunnel/frpc-binary.js +4 -4
  394. package/dist/src/tunnel/frpc-config.js +1 -1
  395. package/dist/src/tunnel/frpc-extract.js +1 -1
  396. package/dist/src/tunnel/tunnel-state.js +1 -1
  397. package/dist/src/utils/logger/audit.js +1 -1
  398. package/dist/src/utils/logger/log-store.js +1 -1
  399. package/dist/src/utils/logger/rotation.js +1 -1
  400. package/dist/src/utils/logger/streams.js +1 -1
  401. package/dist/src/voice/tts/audio.js +1 -1
  402. package/dist/src/voice/tts/providers/edge-speech.js +2 -2
  403. package/dist/src/workflows/draft/workflow-draft-service.js +1 -1
  404. package/dist/src/workflows/engine/projector.js +23 -14
  405. package/dist/src/workflows/engine/projector.js.map +1 -1
  406. package/dist/src/workflows/engine/workflow-engine.d.ts +1 -0
  407. package/dist/src/workflows/engine/workflow-engine.js +36 -0
  408. package/dist/src/workflows/engine/workflow-engine.js.map +1 -1
  409. package/dist/src/workflows/index.js +1 -1
  410. package/dist/src/workflows/service/workflow-run-service.js +2 -2
  411. package/dist/src/workflows/service/workflow-session-bridge.js +2 -2
  412. package/dist/src/workflows/store/event-store.js +1 -1
  413. package/dist/src/workflows/store/run-store.js +1 -1
  414. package/package.json +2 -3
  415. package/dist/gateway/static/root/assets/agent-browser-settings-page-B-0zGjt8.js +0 -6
  416. package/dist/gateway/static/root/assets/agents-DwDnJlXT.js +0 -71
  417. package/dist/gateway/static/root/assets/connectors-settings-DDvHo9in.js +0 -2
  418. package/dist/gateway/static/root/assets/cron-api-Dj_UZKST.js +0 -1
  419. package/dist/gateway/static/root/assets/cron-page-Dv7GII9G.js +0 -1
  420. package/dist/gateway/static/root/assets/cron-schedule-picker-DH10KgD6.js +0 -1
  421. package/dist/gateway/static/root/assets/dreaming-settings-L2rgZDQl.js +0 -1
  422. package/dist/gateway/static/root/assets/extension-settings-page-m_UQYkVc.js +0 -1
  423. package/dist/gateway/static/root/assets/gateway-settings-CS177xni.js +0 -1
  424. package/dist/gateway/static/root/assets/goals-page-C0FujUB5.js +0 -2
  425. package/dist/gateway/static/root/assets/index-COkF54xv.js +0 -121
  426. package/dist/gateway/static/root/assets/index-DIaSNGEO.css +0 -1
  427. package/dist/gateway/static/root/assets/interval-presets-B29Ss_2y.js +0 -2
  428. package/dist/gateway/static/root/assets/messages-Csef1aW7.js +0 -3
  429. package/dist/gateway/static/root/assets/models-hub-panel-DHGiTIvf.js +0 -2
  430. package/dist/gateway/static/root/assets/note-detail-page-BM7zlDiT.js +0 -2
  431. package/dist/gateway/static/root/assets/schedule-field-BPAWui3P.js +0 -1
  432. package/dist/gateway/static/root/assets/schedule-summary-B-hdSRdR.js +0 -1
  433. package/dist/gateway/static/root/assets/settings-advanced-gate-BYS-rpzn.js +0 -1
  434. package/dist/gateway/static/root/assets/settings-form-section-BsrK7TBF.js +0 -1
  435. package/dist/gateway/static/root/assets/setup-status-panel-DJiksNu4.js +0 -1
  436. package/dist/gateway/static/root/assets/skill-reload-api-CU9i0nJV.js +0 -1
  437. package/dist/gateway/static/root/assets/skills-page-ERbdWENm.js +0 -2
  438. package/dist/gateway/static/root/assets/use-agent-defaults-form-D3FGVLZb.js +0 -1
  439. package/dist/gateway/static/root/favicon-16.png +0 -0
  440. package/dist/gateway/static/root/favicon-32.png +0 -0
  441. package/dist/src/cron/persistence.d.ts +0 -62
  442. package/dist/src/cron/persistence.js +0 -188
  443. package/dist/src/cron/persistence.js.map +0 -1
@@ -0,0 +1,71 @@
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-JdwAhgNB.js";import{t as a}from"./messages-CkT-lcgP.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{i as s}from"./theme-store-CD2wtgZV.js";import{c}from"./fetch-NZmjSXLl.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{$n as u,$r as d,An as f,Bo as p,Bt as m,Da as h,Di as g,Ds as _,Ea as v,Es as y,Fi as b,Fn as x,Ft as S,G as C,Gt as w,Hi as T,In as E,Io as D,It as O,Jn as k,Jr as A,Ko as j,Kr as M,Kt as N,Li as P,Lt as F,Ma as I,Mi as L,Mn as R,Nn as ee,Oi as z,Oo as te,Pn as ne,Pt as re,Qn as ie,Qr as ae,Ri as B,Rt as oe,Ss as se,To as ce,Ts as le,U as ue,Ua as de,Ut as fe,Vi as pe,Vt as me,W as V,Wt as he,Xn as H,Xr as ge,Yn as U,Yr as _e,Zn as W,Zr as ve,_n as ye,ba as G,bi as be,br as xe,bs as Se,ds as Ce,ei as K,eo as q,er as we,gn as Te,ii as Ee,ji as De,jn as Oe,ki as J,n as ke,ni as Ae,nr as je,oo as Me,pa as Ne,qr as Pe,qt as Fe,ra as Ie,ri as Le,rr as Re,t as ze,ta as Be,ti as Ve,tr as He,ui as Y,uo as Ue,vn as We,wa as Ge,xi as X,zn as Ke,zt as Z}from"./index-Cxm6xsps.js";import{t as qe}from"./markdown-editor-AssmZFx4.js";import{n as Je,t as Ye}from"./settings-form-section-Dq-83cQd.js";import{n as Xe}from"./agent-avatar-dicebear-CBlklyNr.js";import{a as Ze,c as Qe,n as $e,o as et,s as tt}from"./config-api-Bf5mjpu7.js";import{AgentBrowserSettingsPage as nt}from"./agent-browser-settings-page-rGbKc2Hh.js";import{AgentDefaultsTabbedPage as rt,a as it,i as at,n as ot,o as st,r as ct,t as lt}from"./agent-defaults-tabbed-page-CtwVbjOA.js";import{S as ut,d as dt,f as ft,g as pt,i as mt,o as ht,w as gt,x as _t}from"./cron-api--pAB_rps.js";import{t as vt}from"./cron-dreaming-jobs-nCMWCf0p.js";var yt=n(),Q=r();function bt(e){let t=(0,yt.c)(40),{open:n,onOpenChange:r,busy:a,deletePurge:o,deleteTarget:s,deleteConfirmText:c,onDeleteConfirmTextChange:l,onConfirm:u,onCancel:f,a:p}=e,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(ge,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=m):m=t[0];let h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=i(`fixed left-1/2 top-1/2 z-[81] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),t[1]=h):h=t[1];let g=o?p.purgeDisk:p.removeFromConfig,_;t[2]===g?_=t[3]:(_=(0,Q.jsx)(d,{className:`text-base font-semibold text-fg`,children:g}),t[2]=g,t[3]=_);let v=o?p.confirmDeletePurge:p.confirmDelete,y;t[4]===v?y=t[5]:(y=(0,Q.jsx)(_e,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:v}),t[4]=v,t[5]=y);let b;t[6]!==p.purgeConfirmHint||t[7]!==p.purgeConfirmLabel||t[8]!==p.purgeConfirmPlaceholder||t[9]!==c||t[10]!==o||t[11]!==s||t[12]!==l?(b=o&&s?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:p.purgeConfirmLabel}),(0,Q.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:p.purgeConfirmPlaceholder.replace(`{{agentId}}`,s.id),value:c,onChange:e=>l(e.target.value)}),(0,Q.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:p.purgeConfirmHint.replace(`{{agentId}}`,s.id)})]}):null,t[6]=p.purgeConfirmHint,t[7]=p.purgeConfirmLabel,t[8]=p.purgeConfirmPlaceholder,t[9]=c,t[10]=o,t[11]=s,t[12]=l,t[13]=b):b=t[13];let x;t[14]!==p.createModalCancel||t[15]!==a||t[16]!==f?(x=(0,Q.jsx)(J,{type:`button`,variant:`ghost`,disabled:a,onClick:f,children:p.createModalCancel}),t[14]=p.createModalCancel,t[15]=a,t[16]=f,t[17]=x):x=t[17];let S=o?`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`:void 0,C;t[18]!==a||t[19]!==c||t[20]!==o||t[21]!==s?(C=a||!s||o&&c.trim().toLowerCase()!==s.id.toLowerCase(),t[18]=a,t[19]=c,t[20]=o,t[21]=s,t[22]=C):C=t[22];let w=o?p.purgeDisk:p.removeFromConfig,T;t[23]!==u||t[24]!==C||t[25]!==w||t[26]!==S?(T=(0,Q.jsx)(J,{type:`button`,variant:`secondary`,className:S,disabled:C,onClick:u,children:w}),t[23]=u,t[24]=C,t[25]=w,t[26]=S,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==x?(E=(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[x,T]}),t[28]=T,t[29]=x,t[30]=E):E=t[30];let D;t[31]!==E||t[32]!==_||t[33]!==y||t[34]!==b?(D=(0,Q.jsxs)(ve,{children:[m,(0,Q.jsxs)(A,{className:h,onOpenAutoFocus:xt,children:[_,y,b,E]})]}),t[31]=E,t[32]=_,t[33]=y,t[34]=b,t[35]=D):D=t[35];let O;return t[36]!==r||t[37]!==n||t[38]!==D?(O=(0,Q.jsx)(ae,{open:n,onOpenChange:r,children:D}),t[36]=r,t[37]=n,t[38]=D,t[39]=O):O=t[39],O}function xt(e){return e.preventDefault()}var St=[{id:`overview`,labelKey:`navIdentity`,icon:b},{id:`profile`,labelKey:`navProfile`,icon:j},{id:`models`,labelKey:`navModels`,icon:Me},{id:`tools`,labelKey:`navTools`,icon:L},{id:`skills`,labelKey:`navSkills`,icon:Ge},{id:`files`,labelKey:`navCoreFiles`,icon:ce}],Ct=[{id:`channels`,labelKey:`tabChannels`,icon:h},{id:`cron`,labelKey:`tabCron`,icon:p}];function wt(e){let t=(0,yt.c)(20),{a:n,panel:r,onPanelChange:a}=e,o;t[0]!==a||t[1]!==r?(o=(e,t,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(e),className:i(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,X.press,r===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Q.jsx)(n,{className:`size-4 shrink-0 opacity-90`,strokeWidth:2,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]},e),t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c=n.editorNavAria,l;t[3]!==n||t[4]!==s?(l=St.map(e=>{let{id:t,labelKey:r,icon:i}=e;return s(t,n[r],i)}),t[3]=n,t[4]=s,t[5]=l):l=t[5];let u;t[6]===l?u=t[7]:(u=(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l}),t[6]=l,t[7]=u);let d;t[8]===n.navAdvanced?d=t[9]:(d=(0,Q.jsx)(`p`,{className:`mt-4 px-3 text-[10px] font-semibold uppercase tracking-wide text-fg-subtle`,children:n.navAdvanced}),t[8]=n.navAdvanced,t[9]=d);let f;t[10]!==n||t[11]!==s?(f=Ct.map(e=>{let{id:t,labelKey:r,icon:i}=e;return s(t,n[r],i)}),t[10]=n,t[11]=s,t[12]=f):f=t[12];let p;t[13]===f?p=t[14]:(p=(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:f}),t[13]=f,t[14]=p);let m;return t[15]!==n.editorNavAria||t[16]!==u||t[17]!==d||t[18]!==p?(m=(0,Q.jsxs)(`nav`,{className:`flex w-full flex-col gap-1`,"aria-label":c,children:[u,d,p]}),t[15]=n.editorNavAria,t[16]=u,t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function Tt(e){let t=(0,yt.c)(49),{open:n,onOpenChange:r,a,title:o,subtitle:s,panel:c,onPanelChange:l,onFooterSave:u,footerSaveDisabled:f,footerSavedFlash:p,busy:m,children:h}=e,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(ge,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ye)}),t[0]=g):g=t[0];let _;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=i(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,Te,`inset-4 h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] min-h-0`,`sm:inset-auto sm:left-1/2 sm:top-1/2 sm:h-[min(88vh,48rem)] sm:max-h-[min(88vh,48rem)] sm:min-h-[32rem] sm:w-[min(100%-2rem,58rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=_):_=t[1];let v;t[2]===o?v=t[3]:(v=(0,Q.jsx)(d,{className:`text-base font-semibold leading-snug text-fg`,children:o}),t[2]=o,t[3]=v);let y;t[4]===s?y=t[5]:(y=(0,Q.jsx)(_e,{className:`mt-1 font-mono text-xs text-fg-muted`,children:s}),t[4]=s,t[5]=y);let b;t[6]!==v||t[7]!==y?(b=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[v,y]}),t[6]=v,t[7]=y,t[8]=b):b=t[8];let x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=i(be,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=x):x=t[9];let S;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(De,{className:`size-4`,"aria-hidden":!0}),t[10]=S):S=t[10];let C;t[11]===a.closeDialogAria?C=t[12]:(C=(0,Q.jsx)(Pe,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:x,"aria-label":a.closeDialogAria,children:S})}),t[11]=a.closeDialogAria,t[12]=C);let w;t[13]!==b||t[14]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-edge-subtle px-4 pb-3 pt-4 dark:border-edge`,children:[b,C]}),t[13]=b,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==a||t[17]!==l||t[18]!==c?(T=(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-4 py-3 dark:border-edge sm:flex sm:w-56 sm:shrink-0 sm:flex-col sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-0 sm:py-4 sm:pl-4 sm:pr-3`,children:(0,Q.jsx)(wt,{a,panel:c,onPanelChange:l})}),t[16]=a,t[17]=l,t[18]=c,t[19]=T):T=t[19];let E;t[20]===h?E=t[21]:(E=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:h}),t[20]=h,t[21]=E);let D;t[22]!==a.footerSaveNotApplicable||t[23]!==a.personaSaved||t[24]!==f||t[25]!==p?(D=p?(0,Q.jsxs)(`p`,{className:`order-2 text-center text-xs font-medium text-green-600 sm:order-1 sm:mr-auto sm:text-left dark:text-green-400`,children:[`✓ `,a.personaSaved]}):f?(0,Q.jsx)(`p`,{className:`order-2 text-center text-xs text-fg-muted sm:order-1 sm:mr-auto sm:text-left`,children:a.footerSaveNotApplicable}):null,t[22]=a.footerSaveNotApplicable,t[23]=a.personaSaved,t[24]=f,t[25]=p,t[26]=D):D=t[26];let O=m||f,k;t[27]===u?k=t[28]:(k=()=>void u(),t[27]=u,t[28]=k);let j;t[29]!==a.save||t[30]!==O||t[31]!==k?(j=(0,Q.jsx)(J,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:O,onClick:k,children:a.save}),t[29]=a.save,t[30]=O,t[31]=k,t[32]=j):j=t[32];let M;t[33]!==D||t[34]!==j?(M=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-t border-edge-subtle px-4 py-3 dark:border-edge sm:flex-row sm:items-center sm:justify-end sm:gap-3`,children:[D,j]}),t[33]=D,t[34]=j,t[35]=M):M=t[35];let N;t[36]!==E||t[37]!==M?(N=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[E,M]}),t[36]=E,t[37]=M,t[38]=N):N=t[38];let P;t[39]!==N||t[40]!==T?(P=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[T,N]}),t[39]=N,t[40]=T,t[41]=P):P=t[41];let F;t[42]!==P||t[43]!==w?(F=(0,Q.jsxs)(ve,{children:[g,(0,Q.jsx)(A,{className:_,onOpenAutoFocus:Et,children:(0,Q.jsxs)(V,{layer:`modal`,children:[w,P]})})]}),t[42]=P,t[43]=w,t[44]=F):F=t[44];let I;return t[45]!==r||t[46]!==n||t[47]!==F?(I=(0,Q.jsx)(ae,{open:n,onOpenChange:r,children:F}),t[45]=r,t[46]=n,t[47]=F,t[48]=I):I=t[48],I}function Et(e){return e.preventDefault()}function Dt(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,z,`dark:border-edge`)}function Ot(e,t,n){let r=e.agentId?.trim().toLowerCase();return r?r===t.toLowerCase():t.toLowerCase()===n.toLowerCase()}function kt(e){return[e.channel,e.accountId,e.peerKind,e.peerId].filter(e=>typeof e==`string`&&e.length>0).join(` · `)||e.channel}function At(e,t,n,r){let i=e.trim(),a=t.trim();if(a)return{channel:i,peerId:a};if(n!=null){let e=r[n];if(!e)return{channel:i};let t={channel:i};e.accountId?.trim()&&(t.accountId=e.accountId.trim()),e.peerKind?.trim()&&(t.peerKind=e.peerKind.trim());let a=e.peerId?.trim()||e.chatId?.trim();return a&&(t.peerId=a),t}return{channel:i}}var jt=i(g,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function Mt(e){let t=(0,yt.c)(62),{a:n,busy:r,bindingsLoading:a,agentBindings:o,onRemoveBinding:s,onAddBinding:c,channelStatuses:l,channelsStatusLoading:u,useManualChannel:d,newBindChannel:f,setNewBindChannel:p,bindSessionChats:m,sessionsLoading:h,newBindSessionIdx:g,setNewBindSessionIdx:_,newBindCustomPeer:v,setNewBindCustomPeer:y,onRefreshSessions:b,lastActiveLabels:x,selectRecipient:S}=e,C=!u&&(d||l.length>0),w;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(w=(0,Q.jsx)(Je,{className:`shrink-0`,icon:q,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=w):w=t[2];let T;t[3]!==n.channelsLoading||t[4]!==n.channelsNone||t[5]!==n.removeBinding||t[6]!==o||t[7]!==a||t[8]!==r||t[9]!==s?(T=a?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsLoading}):o.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsNone}):(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:o.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:kt(e.match)}),(0,Q.jsx)(J,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void s(e),children:n.removeBinding})]},`${e.match.channel}-${kt(e.match)}`))}),t[3]=n.channelsLoading,t[4]=n.channelsNone,t[5]=n.removeBinding,t[6]=o,t[7]=a,t[8]=r,t[9]=s,t[10]=T):T=t[10];let E;t[11]!==n.channelLabel||t[12]!==n.channelsDisabledSuffix||t[13]!==n.channelsLoadingChannels||t[14]!==n.channelsManualChannelHint||t[15]!==l||t[16]!==u||t[17]!==f||t[18]!==p||t[19]!==y||t[20]!==_||t[21]!==d?(E=u?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsLoadingChannels}):d?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(`input`,{className:Dt(),value:f,onChange:e=>p(e.target.value),placeholder:`telegram`,autoComplete:`off`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsManualChannelHint})]}):(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(`select`,{className:i(Dt(),`py-2`),value:f,onChange:e=>{p(e.target.value),_(null),y(``)},children:l.map(e=>(0,Q.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:n.channelsDisabledSuffix]},e.name))})]}),t[11]=n.channelLabel,t[12]=n.channelsDisabledSuffix,t[13]=n.channelsLoadingChannels,t[14]=n.channelsManualChannelHint,t[15]=l,t[16]=u,t[17]=f,t[18]=p,t[19]=y,t[20]=_,t[21]=d,t[22]=E):E=t[22];let D;t[23]!==n.channelsCustomPeerHint||t[24]!==n.channelsCustomPeerPlaceholder||t[25]!==n.channelsLoadingSessions||t[26]!==n.channelsNoSessionsHint||t[27]!==n.channelsPeerAny||t[28]!==n.channelsPeerFromSessions||t[29]!==n.channelsRefreshSessions||t[30]!==n.channelsRefreshSessionsHint||t[31]!==n.channelsSessionLabel||t[32]!==n.peerIdLabel||t[33]!==m||t[34]!==r||t[35]!==x||t[36]!==f||t[37]!==v||t[38]!==g||t[39]!==b||t[40]!==S||t[41]!==h||t[42]!==y||t[43]!==_||t[44]!==C?(D=C&&f.trim()?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsSessionLabel}),(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||h||!f.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>b(),children:[(0,Q.jsx)(G,{className:i(`size-3.5`,h&&`animate-spin`),strokeWidth:1.75}),n.channelsRefreshSessions]})]}),h&&m.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsLoadingSessions}):null,(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsPeerFromSessions}),(0,Q.jsxs)(`select`,{className:i(Dt(),`py-2`),value:g==null?``:String(g),disabled:r||!f.trim()||!!v.trim(),onChange:e=>{let t=e.target.value;_(t===``?null:Number(t))},children:[(0,Q.jsx)(`option`,{value:``,children:n.channelsPeerAny}),m.map((e,t)=>(0,Q.jsx)(`option`,{value:String(t),children:_t(e,x)},`${e.channel}-${e.chatId}`))]})]}),m.length===0&&f.trim()&&!h?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsNoSessionsHint}):null,(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.peerIdLabel}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,Q.jsx)(`input`,{type:`text`,className:i(Dt(),`min-w-0 w-full sm:flex-1`),value:v,onChange:e=>{y(e.target.value),e.target.value.trim()&&_(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,Q.jsxs)(`select`,{className:jt,value:v,onChange:e=>{let t=e.target.value;y(t||``),_(null)},children:[(0,Q.jsx)(`option`,{value:``,children:S}),m.map(e=>(0,Q.jsx)(`option`,{value:e.chatId,children:_t(e,x)},`${e.channel}-${e.chatId}`))]})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsCustomPeerHint})]})]}):null,t[23]=n.channelsCustomPeerHint,t[24]=n.channelsCustomPeerPlaceholder,t[25]=n.channelsLoadingSessions,t[26]=n.channelsNoSessionsHint,t[27]=n.channelsPeerAny,t[28]=n.channelsPeerFromSessions,t[29]=n.channelsRefreshSessions,t[30]=n.channelsRefreshSessionsHint,t[31]=n.channelsSessionLabel,t[32]=n.peerIdLabel,t[33]=m,t[34]=r,t[35]=x,t[36]=f,t[37]=v,t[38]=g,t[39]=b,t[40]=S,t[41]=h,t[42]=y,t[43]=_,t[44]=C,t[45]=D):D=t[45];let O;t[46]!==r||t[47]!==u||t[48]!==f?(O=r||!f.trim()||u,t[46]=r,t[47]=u,t[48]=f,t[49]=O):O=t[49];let k;t[50]!==n.addBinding||t[51]!==O?(k=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(J,{type:`submit`,disabled:O,children:n.addBinding})}),t[50]=n.addBinding,t[51]=O,t[52]=k):k=t[52];let A;t[53]!==c||t[54]!==E||t[55]!==D||t[56]!==k?(A=(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:c,children:[E,D,k]}),t[53]=c,t[54]=E,t[55]=D,t[56]=k,t[57]=A):A=t[57];let j;return t[58]!==w||t[59]!==T||t[60]!==A?(j=(0,Q.jsxs)(Ye,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[w,T,A]}),t[58]=w,t[59]=T,t[60]=A,t[61]=j):j=t[61],j}function Nt(e){let t=(0,yt.c)(20),{a:n,data:r,busy:s,cronLoading:c,agentCronJobs:l,onSetCronJobAgent:u}=e,d=o(Ft),f;if(t[0]!==n.cronAgentClear||t[1]!==n.cronAgentDefault||t[2]!==n.cronColAgent||t[3]!==n.cronColMessage||t[4]!==n.cronColSchedule||t[5]!==n.cronColSession||t[6]!==n.cronHint||t[7]!==n.cronLoading||t[8]!==n.cronNone||t[9]!==n.cronTitle||t[10]!==l||t[11]!==s||t[12]!==c||t[13]!==r||t[14]!==d||t[15]!==u){let e=a(d),o=d===`zh`?`zh-CN`:`en-US`,p=e.cron.scheduleBadge,m;t[17]!==n.cronHint||t[18]!==n.cronTitle?(m=(0,Q.jsx)(Je,{className:`shrink-0`,icon:Se,title:n.cronTitle,subtitle:n.cronHint}),t[17]=n.cronHint,t[18]=n.cronTitle,t[19]=m):m=t[19],f=(0,Q.jsxs)(Ye,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[m,c?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.cronLoading}):l.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.cronNone}):(0,Q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Q.jsxs)(`table`,{className:`w-full min-w-[32rem] border-collapse text-left text-sm`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-edge text-fg-muted`,children:[(0,Q.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColSchedule}),(0,Q.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColMessage}),(0,Q.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColSession}),(0,Q.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColAgent})]})}),(0,Q.jsx)(`tbody`,{children:l.map(e=>{let t=!e.agentId?.trim(),a=t?``:e.agentId.trim().toLowerCase();return(0,Q.jsxs)(`tr`,{className:`border-b border-edge-subtle`,children:[(0,Q.jsx)(`td`,{className:`py-2 pr-3`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:ut(e,o,p)}),(0,Q.jsx)(`span`,{className:`truncate font-mono text-[0.65rem] text-fg-subtle`,title:gt(e.schedule),children:gt(e.schedule)})]})}),(0,Q.jsx)(`td`,{className:`max-w-[12rem] truncate py-2 pr-3 text-xs`,title:mt(e),children:mt(e)}),(0,Q.jsx)(`td`,{className:`py-2 pr-3 text-xs`,children:e.sessionTarget??`main`}),(0,Q.jsx)(`td`,{className:`py-2 pr-3`,children:(0,Q.jsxs)(`select`,{className:i(Dt(),`min-w-[8rem] py-1 text-xs`),value:a,disabled:s||e.sessionTarget!==`isolated`,onChange:t=>void u(e,t.target.value),children:[(0,Q.jsx)(`option`,{value:``,children:t?n.cronAgentDefault:n.cronAgentClear}),r.agents.map(Pt)]})})]},e.id)})})]})})]}),t[0]=n.cronAgentClear,t[1]=n.cronAgentDefault,t[2]=n.cronColAgent,t[3]=n.cronColMessage,t[4]=n.cronColSchedule,t[5]=n.cronColSession,t[6]=n.cronHint,t[7]=n.cronLoading,t[8]=n.cronNone,t[9]=n.cronTitle,t[10]=l,t[11]=s,t[12]=c,t[13]=r,t[14]=d,t[15]=u,t[16]=f}else f=t[16];return f}function Pt(e){return(0,Q.jsx)(`option`,{value:e.id,children:e.id},e.id)}function Ft(e){return e.language}function It(e){let t=(0,yt.c)(29),{a:n,filesLoading:r,files:a,activeFile:o,setActiveFile:c,filesViewMode:l,setFilesViewMode:u,fileDraft:d,setFileDraft:f,fileSaving:p,profileFileLoading:m,profileEditorNonce:h,onTryInChat:g}=e,_=s(Lt),v;t[0]===n.filesHint?v=t[1]:(v=(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[0]=n.filesHint,t[1]=v);let y;t[2]!==n.filesAutoSaveHint||t[3]!==n.filesEmpty||t[4]!==n.filesLoading||t[5]!==n.filesMarkdownEdit||t[6]!==n.filesMarkdownPreview||t[7]!==n.filesSavingStatus||t[8]!==n.missing||t[9]!==n.navCoreFiles||t[10]!==n.pickFile||t[11]!==n.tryInChat||t[12]!==o||t[13]!==d||t[14]!==p||t[15]!==a||t[16]!==r||t[17]!==l||t[18]!==_||t[19]!==g||t[20]!==h||t[21]!==m||t[22]!==c||t[23]!==f||t[24]!==u?(y=r?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesLoading}):a?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,Q.jsx)(`nav`,{className:`-mx-1 flex shrink-0 flex-wrap gap-1 px-1 pb-1`,role:`tablist`,"aria-label":n.navCoreFiles,children:a.files.map(e=>{let t=o===e.name;return(0,Q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t,className:i(`inline-flex shrink-0 items-center rounded-lg px-3 py-2 font-mono text-xs font-medium whitespace-nowrap transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,X.press,t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`,e.missing&&`opacity-60`),onClick:()=>c(e.name),children:[e.name,e.missing?` (${n.missing})`:``]},e.name)})}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden`,children:o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-panel p-0.5`,role:`group`,"aria-label":`${n.filesMarkdownEdit} / ${n.filesMarkdownPreview}`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,X.press,l===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>u(`edit`),children:[(0,Q.jsx)(Be,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownEdit]}),(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,X.press,l===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>u(`preview`),children:[(0,Q.jsx)(te,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownPreview]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[p?(0,Q.jsx)(`span`,{children:n.filesSavingStatus}):null,(0,Q.jsx)(`span`,{children:n.filesAutoSaveHint}),g?(0,Q.jsxs)(J,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:g,children:[(0,Q.jsx)(de,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),l===`edit`?(0,Q.jsx)(`div`,{className:i(Dt(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(qe,{initialContent:d,onChange:f,isDark:_,className:`min-h-0 flex-1`},`${o??`file`}-${h}`)}):(0,Q.jsx)(`div`,{className:i(Dt(),`min-h-0 flex-1 overflow-y-auto text-sm`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(Ke,{content:d,className:`text-sm`})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.pickFile})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesEmpty}),t[2]=n.filesAutoSaveHint,t[3]=n.filesEmpty,t[4]=n.filesLoading,t[5]=n.filesMarkdownEdit,t[6]=n.filesMarkdownPreview,t[7]=n.filesSavingStatus,t[8]=n.missing,t[9]=n.navCoreFiles,t[10]=n.pickFile,t[11]=n.tryInChat,t[12]=o,t[13]=d,t[14]=p,t[15]=a,t[16]=r,t[17]=l,t[18]=_,t[19]=g,t[20]=h,t[21]=m,t[22]=c,t[23]=f,t[24]=u,t[25]=y):y=t[25];let b;return t[26]!==v||t[27]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[v,y]}),t[26]=v,t[27]=y,t[28]=b):b=t[28],b}function Lt(e){return e.resolved===`dark`}function Rt(e){let t=(0,yt.c)(52),{a:n,chat:r,selected:i,busy:a,modelRows:o,setModelRows:s,onSaveModels:c,onClearModelsEntry:l,hideInlineSave:u}=e,d;t[0]!==n.modelsTabHint||t[1]!==n.modelsTabTitle?(d=(0,Q.jsx)(Je,{className:`shrink-0`,icon:Me,title:n.modelsTabTitle,subtitle:n.modelsTabHint}),t[0]=n.modelsTabHint,t[1]=n.modelsTabTitle,t[2]=d):d=t[2];let f;t[3]===n.modelsDefaultsLabel?f=t[4]:(f=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsDefaultsLabel}),t[3]=n.modelsDefaultsLabel,t[4]=f);let p;t[5]===i.typedModels.defaults?p=t[6]:(p=et(i.typedModels.defaults),t[5]=i.typedModels.defaults,t[6]=p);let m;t[7]!==f||t[8]!==p?(m=(0,Q.jsxs)(`div`,{children:[f,` `,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===n.modelsEffectiveLabel?h=t[11]:(h=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsEffectiveLabel}),t[10]=n.modelsEffectiveLabel,t[11]=h);let g;t[12]===i.typedModels.effective?g=t[13]:(g=et(i.typedModels.effective),t[12]=i.typedModels.effective,t[13]=g);let _;t[14]!==h||t[15]!==g?(_=(0,Q.jsxs)(`div`,{children:[h,` `,g]}),t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==m||t[18]!==_?(v=(0,Q.jsxs)(`div`,{className:`mb-4 grid gap-2 rounded-lg border border-edge-subtle bg-surface-base/60 p-3 text-xs text-fg-muted dark:border-edge`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==n.addTypedModel||t[21]!==n.removeTypedModel||t[22]!==n.typedModelDescriptionLabel||t[23]!==n.typedModelDescriptionPlaceholder||t[24]!==n.typedModelIdLabel||t[25]!==n.typedModelIdPlaceholder?(y={id:n.typedModelIdLabel,description:n.typedModelDescriptionLabel,add:n.addTypedModel,remove:n.removeTypedModel,idPlaceholder:n.typedModelIdPlaceholder,descriptionPlaceholder:n.typedModelDescriptionPlaceholder},t[20]=n.addTypedModel,t[21]=n.removeTypedModel,t[22]=n.typedModelDescriptionLabel,t[23]=n.typedModelDescriptionPlaceholder,t[24]=n.typedModelIdLabel,t[25]=n.typedModelIdPlaceholder,t[26]=y):y=t[26];let b;t[27]!==a||t[28]!==r||t[29]!==o||t[30]!==s||t[31]!==y?(b=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(st,{rows:o,onChange:s,disabled:a,chat:r,labels:y})}),t[27]=a,t[28]=r,t[29]=o,t[30]=s,t[31]=y,t[32]=b):b=t[32];let x;t[33]!==n.modelsSave||t[34]!==a||t[35]!==u||t[36]!==c?(x=u?null:(0,Q.jsx)(J,{type:`button`,disabled:a,onClick:()=>void c(),children:n.modelsSave}),t[33]=n.modelsSave,t[34]=a,t[35]=u,t[36]=c,t[37]=x):x=t[37];let S;t[38]===l?S=t[39]:(S=()=>void l(),t[38]=l,t[39]=S);let C;t[40]!==n.modelsResetInherit||t[41]!==a||t[42]!==S?(C=(0,Q.jsx)(J,{type:`button`,variant:`secondary`,disabled:a,onClick:S,children:n.modelsResetInherit}),t[40]=n.modelsResetInherit,t[41]=a,t[42]=S,t[43]=C):C=t[43];let w;t[44]!==x||t[45]!==C?(w=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[x,C]}),t[44]=x,t[45]=C,t[46]=w):w=t[46];let T;return t[47]!==d||t[48]!==w||t[49]!==v||t[50]!==b?(T=(0,Q.jsxs)(Ye,{className:`flex min-h-0 flex-1 flex-col`,children:[d,v,b,w]}),t[47]=d,t[48]=w,t[49]=v,t[50]=b,t[51]=T):T=t[51],T}var $=e(t(),1);function zt(e){let t=(0,yt.c)(19),{label:n,mode:r,value:a,inheritedFrom:o,inheritLabel:s,overrideLabel:c}=e,l;t[0]===n?l=t[1]:(l=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=l);let u=a||`—`,d;t[2]===u?d=t[3]:(d=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:u}),t[2]=u,t[3]=d);let f;t[4]!==o||t[5]!==r?(f=r===`inherit`&&o?(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:o}):null,t[4]=o,t[5]=r,t[6]=f):f=t[6];let p;t[7]!==l||t[8]!==d||t[9]!==f?(p=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[l,d,f]}),t[7]=l,t[8]=d,t[9]=f,t[10]=p):p=t[10];let m=r===`inherit`?`bg-surface-hover text-fg-muted`:`bg-accent-soft text-accent-fg`,h;t[11]===m?h=t[12]:(h=i(`mt-2 inline-flex shrink-0 self-start rounded-full px-2.5 py-0.5 text-xs font-medium sm:mt-0`,m),t[11]=m,t[12]=h);let g=r===`inherit`?s:c,_;t[13]!==h||t[14]!==g?(_=(0,Q.jsx)(`span`,{className:h,children:g}),t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;return t[16]!==p||t[17]!==_?(v=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[p,_]}),t[16]=p,t[17]=_,t[18]=v):v=t[18],v}function Bt(e){let t=(0,yt.c)(41),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,settingsPath:s,settingsState:c}=e,l=s===void 0?`/settings/agent-defaults`:s,u=n.inheritance,d;t[0]===a?d=t[1]:(d=a.trim(),t[0]=a,t[1]=d);let f=!d,p;t[2]!==o||t[3]!==i?(p=!o.trim()||i.trim().length>0&&o.trim()===i.trim(),t[2]=o,t[3]=i,t[4]=p):p=t[4];let m=p,h=f?r||u.unset:a,g=m?i||u.unset:o,_;t[5]!==u.editDefaultsLink||t[6]!==l||t[7]!==c?(_=(0,Q.jsx)(se,{to:l,state:c,className:`text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:u.editDefaultsLink}),t[5]=u.editDefaultsLink,t[6]=l,t[7]=c,t[8]=_):_=t[8];let v;t[9]!==u.subtitle||t[10]!==u.title||t[11]!==_?(v=(0,Q.jsx)(Je,{icon:q,title:u.title,subtitle:u.subtitle,trailing:_}),t[9]=u.subtitle,t[10]=u.title,t[11]=_,t[12]=v):v=t[12];let y=f?`inherit`:`override`,b;t[13]!==r||t[14]!==u.inheritsValue||t[15]!==f?(b=f&&r?u.inheritsValue.replace(`{{value}}`,r):void 0,t[13]=r,t[14]=u.inheritsValue,t[15]=f,t[16]=b):b=t[16];let x;t[17]!==h||t[18]!==u.badgeInherit||t[19]!==u.badgeOverride||t[20]!==u.modelLabel||t[21]!==y||t[22]!==b?(x=(0,Q.jsx)(zt,{label:u.modelLabel,mode:y,value:h,inheritedFrom:b,inheritLabel:u.badgeInherit,overrideLabel:u.badgeOverride}),t[17]=h,t[18]=u.badgeInherit,t[19]=u.badgeOverride,t[20]=u.modelLabel,t[21]=y,t[22]=b,t[23]=x):x=t[23];let S=m?`inherit`:`override`,C;t[24]!==i||t[25]!==u.inheritsValue||t[26]!==m?(C=m&&i?u.inheritsValue.replace(`{{value}}`,i):void 0,t[24]=i,t[25]=u.inheritsValue,t[26]=m,t[27]=C):C=t[27];let w;t[28]!==g||t[29]!==u.badgeInherit||t[30]!==u.badgeOverride||t[31]!==u.workspaceLabel||t[32]!==S||t[33]!==C?(w=(0,Q.jsx)(zt,{label:u.workspaceLabel,mode:S,value:g,inheritedFrom:C,inheritLabel:u.badgeInherit,overrideLabel:u.badgeOverride}),t[28]=g,t[29]=u.badgeInherit,t[30]=u.badgeOverride,t[31]=u.workspaceLabel,t[32]=S,t[33]=C,t[34]=w):w=t[34];let T;t[35]!==w||t[36]!==x?(T=(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[x,w]}),t[35]=w,t[36]=x,t[37]=T):T=t[37];let E;return t[38]!==T||t[39]!==v?(E=(0,Q.jsxs)(Ye,{children:[v,T]}),t[38]=T,t[39]=v,t[40]=E):E=t[40],E}function Vt(e,t){switch(e){case`adventurer`:return t.avatarStyleAdventurer;case`bottts`:return t.avatarStyleRobot;case`lorelei`:return t.avatarStyleLorelei;case`thumbs`:return t.avatarStyleThumbs;case`fun-emoji`:return t.avatarStyleFunEmoji;default:return e}}function Ht(e){let{agentId:t,value:n,onChange:r,a,id:o}=e,s=(0,$.useRef)(null),[c,l]=(0,$.useState)(!1),[d,f]=(0,$.useState)(null),[p,m]=(0,$.useState)(!1),h=(0,$.useMemo)(()=>{let e=He(n.trim());return e&&we(e.styleId)?e.styleId:W[0]??`adventurer`},[n]),g=(0,$.useCallback)(async(e,n)=>{try{await F(t)}catch{}r(u(e,n)),m(!1)},[t,r]),_=(0,$.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){f(null),l(!0);try{await Fe(t,n),je(t),r(ie)}catch(e){let t=e instanceof Error?e.message:``;f(t===`avatar_too_large`?a.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?a.avatarInvalidImage:a.avatarUploadFailed)}finally{l(!1)}}},[a,t,r]),v=(e,t)=>{let r=He(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,Q.jsxs)(`div`,{...o?{id:o}:{},className:`flex flex-col gap-3 sm:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.avatarPickerTitle}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{ref:s,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void _(e)}),(0,Q.jsxs)(J,{type:`button`,variant:`secondary`,className:`gap-1.5 px-2.5 py-1.5 text-xs`,disabled:c,onClick:()=>s.current?.click(),children:[(0,Q.jsx)(B,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),c?a.avatarUploading:a.avatarUploadCustom]})]})]}),d?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:d}):null,(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:W.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void g(e,H[0]??t),className:i(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,X.press,h===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:Vt(e,a)},e))}),(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/50 p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[H.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void g(h,e),className:i(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,X.press,v(h,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:Xe(h,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)(Ae,{open:p,onOpenChange:m,children:[(0,Q.jsx)(Le,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:i(`flex size-12 shrink-0 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`,X.press),children:a.avatarMore})}),(0,Q.jsx)(Ve,{children:(0,Q.jsxs)(K,{className:`z-[80] max-h-72 w-[min(22rem,calc(100vw-2rem))] overflow-y-auto rounded-xl border border-edge-subtle bg-surface-panel p-3 shadow-lg`,sideOffset:6,align:`end`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:Vt(h,a)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:U.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void g(h,e),className:i(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,X.press,v(h,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:Xe(h,e,88),alt:``,width:40,height:40,className:`size-10 rounded-full object-cover`,draggable:!1})},e))})]})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.personaAvatar}),(0,Q.jsx)(k,{agentId:t,avatar:n,size:40}),n.trim()&&!He(n.trim())&&n.trim()!==`xopc:custom`?(0,Q.jsx)(`span`,{className:`truncate font-mono text-[10px] text-fg-muted`,title:n,children:n}):null]})]})]})}var Ut={name:``,description:``,language:``,creature:``,emoji:``,avatar:``};function Wt(e){let t={...Ut};if(!e.trim())return t;let n={name:`name`,description:`description`,language:`language`,creature:`creature`,emoji:`emoji`,avatar:`avatar`};for(let r of e.split(`
2
+ `)){let e=r.match(/^[-*]\s+\*\*(\w+):\*\*\s*(.*)/i);if(!e)continue;let i=n[e[1].toLowerCase()];if(!i)continue;let a=e[2].trim();/^_\(.*\)_$/.test(a)&&(a=``),t[i]=a}return t}function Gt(e){return[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${e.name}`,`- **Description:** ${e.description}`,`- **Language:** ${e.language}`,`- **Creature:** ${e.creature}`,`- **Emoji:** ${e.emoji}`,`- **Avatar:** ${e.avatar}`,``].join(`
3
+ `)}var Kt={callName:``,pronouns:``,timezone:``,notes:``};function qt(e){let t={...Kt};if(!e.trim())return t;let n={name:`callName`,"what to call them":`callName`,pronouns:`pronouns`,timezone:`timezone`,notes:`notes`},r=e.split(`
4
+ `),i=-1;for(let e=0;e<r.length;e++){let a=r[e];if(/^##\s+Context/i.test(a)){i=e+1;continue}let o=a.match(/^[-*]\s+\*\*(.+?):\*\*\s*(.*)/i);if(!o)continue;let s=n[o[1].toLowerCase().trim()];if(!s)continue;let c=o[2].trim();/^_\(.*\)_$/.test(c)&&(c=``),t[s]=c}if(i>0){let e=r.slice(i).join(`
5
+ `).replace(/^_\(.*?\)_\s*/gm,``).replace(/^---\s*$/gm,``).replace(/The more you know.*$/s,``).trim();e&&!t.notes&&(t.notes=e)}return t}function Jt(e){let t=[`# USER.md - About Your Human`,``,`- **Name:** ${e.callName}`,`- **Pronouns:** ${e.pronouns}`,`- **Timezone:** ${e.timezone}`,``];return e.notes.trim()&&t.push(`## Context`,``,e.notes.trim(),``),t.join(`
6
+ `)}var Yt=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
7
+
8
+ ## Core Truths
9
+
10
+ **Be genuinely helpful, not performatively helpful.** Skip the filler words — just help. Actions speak louder than pleasantries.
11
+
12
+ **Be precise and efficient.** Value the user's time. Give concise, actionable answers. Expand only when asked.
13
+
14
+ **Earn trust through competence.** Be careful with external actions. Be bold with internal ones (reading, organizing, learning).
15
+
16
+ **Remember you're a guest.** You have access to someone's life. Treat it with respect.
17
+
18
+ ## Boundaries
19
+
20
+ - Private things stay private. Period.
21
+ - When in doubt, ask before acting externally.
22
+ - Never send half-baked replies to messaging surfaces.
23
+
24
+ ## Vibe
25
+
26
+ Professional, competent, and respectful. Concise when needed, thorough when it matters.`},{id:`casual`,labelEn:`Warm & Friendly`,labelZh:`轻松友好`,emoji:`😊`,content:`# SOUL.md - Who You Are
27
+
28
+ ## Core Truths
29
+
30
+ **Be a good friend, not a corporate drone.** Be warm, genuine, and real. Skip the formality when it gets in the way.
31
+
32
+ **Have personality.** You're allowed to be amused, surprised, or excited. An assistant with no personality is just a search engine.
33
+
34
+ **Be resourceful before asking.** Try to figure it out first. Then ask if you're stuck.
35
+
36
+ **Earn trust by being reliable.** Show up, follow through, and remember what matters.
37
+
38
+ **Respect the intimacy.** You have access to someone's life. That's a privilege.
39
+
40
+ ## Boundaries
41
+
42
+ - Private things stay private. Always.
43
+ - When in doubt, ask before acting externally.
44
+ - Be careful in group chats — you're not the user's voice.
45
+
46
+ ## Vibe
47
+
48
+ Warm, friendly, and a little playful. Like a helpful friend who happens to know everything.`},{id:`geeky`,labelEn:`Geeky & Witty`,labelZh:`极客风格`,emoji:`🧑‍💻`,content:`# SOUL.md - Who You Are
49
+
50
+ ## Core Truths
51
+
52
+ **Precision over politeness.** "This is broken" beats "This might be worth considering." Be direct.
53
+
54
+ **Have opinions.** Disagree, prefer things, find stuff interesting or dull. No personality = no value.
55
+
56
+ **Go deep.** When something is interesting, explore it. Surface-level answers are for search engines.
57
+
58
+ **Be resourceful.** Read the file. Check the context. Search for it. Come back with answers, not questions.
59
+
60
+ **Earn trust through competence.** Be careful with external actions. Be bold with internal ones.
61
+
62
+ ## Boundaries
63
+
64
+ - Private things stay private.
65
+ - When in doubt, ask before acting externally.
66
+ - Never send half-baked replies.
67
+
68
+ ## Vibe
69
+
70
+ Sharp, direct, slightly nerdy. The kind of engineer you'd want on your team — competent, opinionated, and occasionally funny.`},{id:`custom`,labelEn:`Custom`,labelZh:`自定义`,emoji:`✍️`,content:``}];function Xt(e){let t=e.trimStart();if(!t.startsWith(`---`))return e;let n=t.indexOf(`---`,3);return n===-1?e:t.slice(n+3).trimStart()}function Zt(e){let t=Xt(e).trim();if(!t)return`professional`;for(let e of Yt)if(e.id!==`custom`&&(t===e.content.trim()||$t(t,e.id)>=2))return e.id;return`custom`}var Qt={professional:/precise and efficient|Value the user's time|actionable answers/g,casual:/good friend|corporate drone|a little playful/g,geeky:/Precision over politeness|Go deep|slightly nerdy/g};function $t(e,t){let n=Qt[t];if(!n)return 0;let r=new RegExp(n.source,`g`),i=new Set,a;for(;(a=r.exec(e))!==null;)if(i.add(a[0]),i.size>=2)return i.size;return i.size}var en=[{value:``,labelEn:`Not set`,labelZh:`未设置`},{value:`Asia/Shanghai`,labelEn:`Asia/Shanghai (CST, UTC+8)`,labelZh:`亚洲/上海 (北京时间, UTC+8)`},{value:`Asia/Tokyo`,labelEn:`Asia/Tokyo (JST, UTC+9)`,labelZh:`亚洲/东京 (日本时间, UTC+9)`},{value:`Asia/Seoul`,labelEn:`Asia/Seoul (KST, UTC+9)`,labelZh:`亚洲/首尔 (韩国时间, UTC+9)`},{value:`Asia/Singapore`,labelEn:`Asia/Singapore (SGT, UTC+8)`,labelZh:`亚洲/新加坡 (UTC+8)`},{value:`Asia/Hong_Kong`,labelEn:`Asia/Hong Kong (HKT, UTC+8)`,labelZh:`亚洲/香港 (UTC+8)`},{value:`Asia/Taipei`,labelEn:`Asia/Taipei (CST, UTC+8)`,labelZh:`亚洲/台北 (UTC+8)`},{value:`Asia/Kolkata`,labelEn:`Asia/Kolkata (IST, UTC+5:30)`,labelZh:`亚洲/加尔各答 (印度时间, UTC+5:30)`},{value:`Asia/Dubai`,labelEn:`Asia/Dubai (GST, UTC+4)`,labelZh:`亚洲/迪拜 (UTC+4)`},{value:`Europe/London`,labelEn:`Europe/London (GMT/BST)`,labelZh:`欧洲/伦敦 (格林尼治时间)`},{value:`Europe/Paris`,labelEn:`Europe/Paris (CET, UTC+1)`,labelZh:`欧洲/巴黎 (中欧时间, UTC+1)`},{value:`Europe/Berlin`,labelEn:`Europe/Berlin (CET, UTC+1)`,labelZh:`欧洲/柏林 (中欧时间, UTC+1)`},{value:`Europe/Moscow`,labelEn:`Europe/Moscow (MSK, UTC+3)`,labelZh:`欧洲/莫斯科 (UTC+3)`},{value:`America/New_York`,labelEn:`America/New York (EST, UTC-5)`,labelZh:`美国/纽约 (东部时间, UTC-5)`},{value:`America/Chicago`,labelEn:`America/Chicago (CST, UTC-6)`,labelZh:`美国/芝加哥 (中部时间, UTC-6)`},{value:`America/Denver`,labelEn:`America/Denver (MST, UTC-7)`,labelZh:`美国/丹佛 (山地时间, UTC-7)`},{value:`America/Los_Angeles`,labelEn:`America/Los Angeles (PST, UTC-8)`,labelZh:`美国/洛杉矶 (太平洋时间, UTC-8)`},{value:`America/Sao_Paulo`,labelEn:`America/São Paulo (BRT, UTC-3)`,labelZh:`美洲/圣保罗 (巴西时间, UTC-3)`},{value:`Australia/Sydney`,labelEn:`Australia/Sydney (AEST, UTC+10)`,labelZh:`澳大利亚/悉尼 (UTC+10)`},{value:`Pacific/Auckland`,labelEn:`Pacific/Auckland (NZST, UTC+12)`,labelZh:`太平洋/奥克兰 (新西兰时间, UTC+12)`}];function tn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return``}}var nn=[{value:`先生`,labelEn:`Mr.`,labelZh:`先生`},{value:`女士`,labelEn:`Ms.`,labelZh:`女士`},{value:`同学`,labelEn:`Colleague`,labelZh:`同学`},{value:`老师`,labelEn:`Teacher`,labelZh:`老师`},{value:`老板`,labelEn:`Boss`,labelZh:`老板`},{value:`朋友`,labelEn:`Friend`,labelZh:`朋友`}],rn=[{value:`AI assistant`,labelEn:`AI Assistant`,labelZh:`AI 助手`},{value:`robot`,labelEn:`Robot`,labelZh:`机器人`},{value:`familiar`,labelEn:`Familiar`,labelZh:`精灵`},{value:`ghost in the machine`,labelEn:`Ghost in the machine`,labelZh:`机器幽灵`},{value:`digital companion`,labelEn:`Digital Companion`,labelZh:`数字伙伴`}];function an(e){let t=(0,yt.c)(216),{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:f,setEditDescription:p,editWorkspace:m,setEditWorkspace:h,editModel:g,setEditModel:_,onSetDefault:v,onSaveAgentEdits:y,onDelete:x,hideInlineSave:S,profileMarkdownLoading:w,profileDraft:E,updateIdentity:O,handleSoulTemplateChange:j,handleSoulContentChange:M,setAvatarDialogOpen:N,toggleSoulPreviewMode:P,defaultModel:F,defaultWorkspace:L,onTryInChat:R}=e,ee=F===void 0?``:F,z=L===void 0?``:L,ne=o(cn),re=s(sn),ie;t[0]===E?.identity?ie=t[1]:(ie=E?.identity??{name:``,description:``,language:``,creature:``,emoji:``,avatar:``},t[0]=E?.identity,t[1]=ie);let B=ie,oe=E?.soulTemplate??`professional`,se=E?.soulCustomContent??``,ce=E?.soulEditorNonce??0,le=E?.soulPreviewMode??!1,fe=E?.avatarDialogOpen??!1,me;t[2]===ne?me=t[3]:(me=(e,t)=>ne===`zh`?t:e,t[2]=ne,t[3]=me);let V=me,he;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(he=Dt(),t[4]=he):he=t[4];let H=he;if(!a){let e;return t[5]===n.selectAgentHint?e=t[6]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[5]=n.selectAgentHint,t[6]=e),e}let U;t[7]===a.id?U=t[8]:(U=ke(a.id),t[7]=a.id,t[8]=U);let W;t[9]===U?W=t[10]:(W={[C]:U},t[9]=U,t[10]=W);let G;t[11]!==n||t[12]!==ee||t[13]!==z||t[14]!==g||t[15]!==m||t[16]!==W?(G=(0,Q.jsx)(Bt,{a:n,defaultModel:ee,defaultWorkspace:z,agentModel:g,agentWorkspace:m,settingsState:W}),t[11]=n,t[12]=ee,t[13]=z,t[14]=g,t[15]=m,t[16]=W,t[17]=G):G=t[17];let xe;t[18]!==B.avatar||t[19]!==a.id?(xe=(0,Q.jsx)(k,{agentId:a.id,avatar:B.avatar,size:36,className:`size-9 rounded-lg`}),t[18]=B.avatar,t[19]=a.id,t[20]=xe):xe=t[20];let Se;t[21]===N?Se=t[22]:(Se=()=>N(!0),t[21]=N,t[22]=Se);let Ce;t[23]!==n.avatarOpenSettingsAria||t[24]!==Se?(Ce={onClick:Se,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[23]=n.avatarOpenSettingsAria,t[24]=Se,t[25]=Ce):Ce=t[25];let K;t[26]!==n.setDefault||t[27]!==c||t[28]!==v||t[29]!==a.isDefault?(K=a.isDefault?null:(0,Q.jsx)(J,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:c,onClick:()=>void v(),children:n.setDefault}),t[26]=n.setDefault,t[27]=c,t[28]=v,t[29]=a.isDefault,t[30]=K):K=t[30];let q;t[31]!==n.personaSectionIdentity||t[32]!==n.personaSectionIdentityHint||t[33]!==Ce||t[34]!==K||t[35]!==xe?(q=(0,Q.jsx)(Je,{icon:Ie,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:xe,iconInteractive:Ce,trailing:K}),t[31]=n.personaSectionIdentity,t[32]=n.personaSectionIdentityHint,t[33]=Ce,t[34]=K,t[35]=xe,t[36]=q):q=t[36];let we;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Q.jsx)(ge,{className:i(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,ye)}),t[37]=we):we=t[37];let Ee;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=i(`fixed left-1/2 top-1/2 w-[min(calc(100vw-2rem),26rem)] max-h-[min(90dvh,36rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,Te),t[38]=Ee):Ee=t[38];let Oe;t[39]===n.avatarPickerTitle?Oe=t[40]:(Oe=(0,Q.jsx)(d,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[39]=n.avatarPickerTitle,t[40]=Oe);let Ae;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=i(be,`shrink-0 p-1.5 hover:bg-surface-base`),t[41]=Ae):Ae=t[41];let je;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Q.jsx)(De,{className:`size-4`,"aria-hidden":!0}),t[42]=je):je=t[42];let Me;t[43]===n.closeDialogAria?Me=t[44]:(Me=(0,Q.jsx)(Pe,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:Ae,"aria-label":n.closeDialogAria,children:je})}),t[43]=n.closeDialogAria,t[44]=Me);let Ne;t[45]!==Oe||t[46]!==Me?(Ne=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[Oe,Me]}),t[45]=Oe,t[46]=Me,t[47]=Ne):Ne=t[47];let Fe;t[48]===n.avatarRowHint?Fe=t[49]:(Fe=(0,Q.jsx)(_e,{className:`sr-only`,children:n.avatarRowHint}),t[48]=n.avatarRowHint,t[49]=Fe);let Le;t[50]===O?Le=t[51]:(Le=e=>O({avatar:e}),t[50]=O,t[51]=Le);let Re;t[52]!==n||t[53]!==B.avatar||t[54]!==a.id||t[55]!==Le?(Re=(0,Q.jsx)(Ht,{agentId:a.id,value:B.avatar,onChange:Le,a:n}),t[52]=n,t[53]=B.avatar,t[54]=a.id,t[55]=Le,t[56]=Re):Re=t[56];let ze;t[57]!==Ne||t[58]!==Fe||t[59]!==Re?(ze=(0,Q.jsxs)(ve,{children:[we,(0,Q.jsxs)(A,{className:Ee,onOpenAutoFocus:on,children:[Ne,Fe,Re]})]}),t[57]=Ne,t[58]=Fe,t[59]=Re,t[60]=ze):ze=t[60];let Be;t[61]!==fe||t[62]!==N||t[63]!==ze?(Be=(0,Q.jsx)(ae,{open:fe,onOpenChange:N,children:ze}),t[61]=fe,t[62]=N,t[63]=ze,t[64]=Be):Be=t[64];let Ve;t[65]===n.displayName?Ve=t[66]:(Ve=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[65]=n.displayName,t[66]=Ve);let He;t[67]!==u||t[68]!==O?(He=e=>{u(e.target.value),O({name:e.target.value})},t[67]=u,t[68]=O,t[69]=He):He=t[69];let Y;t[70]!==n.personaNamePlaceholder||t[71]!==l||t[72]!==He?(Y=(0,Q.jsx)(`input`,{className:H,value:l,onChange:He,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[70]=n.personaNamePlaceholder,t[71]=l,t[72]=He,t[73]=Y):Y=t[73];let Ue;t[74]!==Ve||t[75]!==Y?(Ue=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Ve,Y]}),t[74]=Ve,t[75]=Y,t[76]=Ue):Ue=t[76];let We;t[77]===n.personaEmoji?We=t[78]:(We=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[77]=n.personaEmoji,t[78]=We);let Ge;t[79]===O?Ge=t[80]:(Ge=e=>O({emoji:e.target.value}),t[79]=O,t[80]=Ge);let Z;t[81]!==n.personaEmojiPlaceholder||t[82]!==B.emoji||t[83]!==Ge?(Z=(0,Q.jsx)(`input`,{className:H,value:B.emoji,onChange:Ge,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[81]=n.personaEmojiPlaceholder,t[82]=B.emoji,t[83]=Ge,t[84]=Z):Z=t[84];let Xe;t[85]!==We||t[86]!==Z?(Xe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[We,Z]}),t[85]=We,t[86]=Z,t[87]=Xe):Xe=t[87];let Ze;t[88]===n.agentDescription?Ze=t[89]:(Ze=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[88]=n.agentDescription,t[89]=Ze);let Qe;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=i(H,`min-h-16 resize-y text-sm leading-relaxed`),t[90]=Qe):Qe=t[90];let $e;t[91]!==p||t[92]!==O?($e=e=>{p(e.target.value),O({description:e.target.value})},t[91]=p,t[92]=O,t[93]=$e):$e=t[93];let et;t[94]!==n.agentDescriptionPlaceholder||t[95]!==f||t[96]!==$e?(et=(0,Q.jsx)(`textarea`,{className:Qe,value:f,onChange:$e,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[94]=n.agentDescriptionPlaceholder,t[95]=f,t[96]=$e,t[97]=et):et=t[97];let tt;t[98]!==Ze||t[99]!==et?(tt=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[Ze,et]}),t[98]=Ze,t[99]=et,t[100]=tt):tt=t[100];let nt;t[101]===n.personaCreature?nt=t[102]:(nt=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[101]=n.personaCreature,t[102]=nt);let rt;t[103]===B.creature?rt=t[104]:(rt=rn.some(e=>e.value===B.creature)?B.creature:`__custom__`,t[103]=B.creature,t[104]=rt);let it;t[105]===O?it=t[106]:(it=e=>{if(e.target.value===`__custom__`){O({creature:``});return}O({creature:e.target.value})},t[105]=O,t[106]=it);let at;t[107]===V?at=t[108]:(at=rn.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:V(e.labelEn,e.labelZh)},e.value)),t[107]=V,t[108]=at);let ot;t[109]===V?ot=t[110]:(ot=V(`Custom…`,`自定义…`),t[109]=V,t[110]=ot);let st;t[111]===ot?st=t[112]:(st=(0,Q.jsx)(`option`,{value:`__custom__`,children:ot}),t[111]=ot,t[112]=st);let lt;t[113]!==rt||t[114]!==it||t[115]!==at||t[116]!==st?(lt=(0,Q.jsxs)(`select`,{className:H,value:rt,onChange:it,children:[at,st]}),t[113]=rt,t[114]=it,t[115]=at,t[116]=st,t[117]=lt):lt=t[117];let ut;t[118]!==n.personaCreaturePlaceholder||t[119]!==B.creature||t[120]!==O?(ut=rn.some(e=>e.value===B.creature)?null:(0,Q.jsx)(`input`,{className:i(H,`mt-1 text-xs`),value:B.creature,onChange:e=>O({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[118]=n.personaCreaturePlaceholder,t[119]=B.creature,t[120]=O,t[121]=ut):ut=t[121];let dt;t[122]!==nt||t[123]!==lt||t[124]!==ut?(dt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[nt,lt,ut]}),t[122]=nt,t[123]=lt,t[124]=ut,t[125]=dt):dt=t[125];let ft;t[126]!==Ue||t[127]!==Xe||t[128]!==tt||t[129]!==dt?(ft=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[Ue,Xe,tt,dt]}),t[126]=Ue,t[127]=Xe,t[128]=tt,t[129]=dt,t[130]=ft):ft=t[130];let pt;t[131]!==q||t[132]!==Be||t[133]!==ft?(pt=(0,Q.jsxs)(Ye,{children:[q,Be,ft]}),t[131]=q,t[132]=Be,t[133]=ft,t[134]=pt):pt=t[134];let mt;t[135]!==n.editAgent||t[136]!==n.editAgentHint?(mt=(0,Q.jsx)(Je,{icon:D,title:n.editAgent,subtitle:n.editAgentHint}),t[135]=n.editAgent,t[136]=n.editAgentHint,t[137]=mt):mt=t[137];let ht;t[138]===n.modelPrimary?ht=t[139]:(ht=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelPrimary}),t[138]=n.modelPrimary,t[139]=ht);let gt;t[140]===_?gt=t[141]:(gt=e=>_(e),t[140]=_,t[141]=gt);let _t;t[142]!==c||t[143]!==r.modelNoMatches||t[144]!==r.modelPlaceholder||t[145]!==r.modelSearchPlaceholder||t[146]!==g||t[147]!==gt?(_t=(0,Q.jsx)(ue,{className:`min-w-0 flex-1`,value:g,disabled:c,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:gt}),t[142]=c,t[143]=r.modelNoMatches,t[144]=r.modelPlaceholder,t[145]=r.modelSearchPlaceholder,t[146]=g,t[147]=gt,t[148]=_t):_t=t[148];let vt;t[149]!==n.modelClear||t[150]!==c||t[151]!==g||t[152]!==_?(vt=g.trim()?(0,Q.jsx)(J,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:c,onClick:()=>_(``),children:n.modelClear}):null,t[149]=n.modelClear,t[150]=c,t[151]=g,t[152]=_,t[153]=vt):vt=t[153];let bt;t[154]!==_t||t[155]!==vt?(bt=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[_t,vt]}),t[154]=_t,t[155]=vt,t[156]=bt):bt=t[156];let xt;t[157]!==ht||t[158]!==bt?(xt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ht,bt]}),t[157]=ht,t[158]=bt,t[159]=xt):xt=t[159];let St;t[160]===n.workspacePath?St=t[161]:(St=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[160]=n.workspacePath,t[161]=St);let Ct=r.workingDirectory,wt=r.workingDirectory.notSet,Tt;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=i(H,`font-mono text-xs`),t[162]=Tt):Tt=t[162];let Et;t[163]!==c||t[164]!==r.workingDirectory||t[165]!==m||t[166]!==h?(Et=(0,Q.jsx)(ct,{value:m,onChange:h,disabled:c,wd:Ct,placeholder:wt,inputClassName:Tt}),t[163]=c,t[164]=r.workingDirectory,t[165]=m,t[166]=h,t[167]=Et):Et=t[167];let Ot;t[168]!==St||t[169]!==Et?(Ot=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[St,Et]}),t[168]=St,t[169]=Et,t[170]=Ot):Ot=t[170];let kt;t[171]!==xt||t[172]!==Ot?(kt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[xt,Ot]}),t[171]=xt,t[172]=Ot,t[173]=kt):kt=t[173];let At;t[174]!==n.save||t[175]!==n.tryInChat||t[176]!==c||t[177]!==S||t[178]!==y||t[179]!==R?(At=S?null:(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(J,{type:`button`,disabled:c,onClick:()=>void y(),children:n.save}),R?(0,Q.jsxs)(J,{type:`button`,variant:`secondary`,disabled:c,onClick:R,children:[(0,Q.jsx)(de,{className:`mr-1.5 size-4`,"aria-hidden":!0}),n.tryInChat]}):null]}),t[174]=n.save,t[175]=n.tryInChat,t[176]=c,t[177]=S,t[178]=y,t[179]=R,t[180]=At):At=t[180];let jt;t[181]!==mt||t[182]!==kt||t[183]!==At?(jt=(0,Q.jsxs)(Ye,{children:[mt,kt,At]}),t[181]=mt,t[182]=kt,t[183]=At,t[184]=jt):jt=t[184];let Mt;t[185]!==n.loading||t[186]!==n.personaSectionSoul||t[187]!==n.personaSectionSoulHint||t[188]!==n.personaSoulCustomEdit||t[189]!==n.personaSoulEdit||t[190]!==n.personaSoulPreview||t[191]!==n.personaSoulTemplate||t[192]!==M||t[193]!==j||t[194]!==re||t[195]!==V||t[196]!==w||t[197]!==se||t[198]!==ce||t[199]!==le||t[200]!==oe||t[201]!==P?(Mt=w?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.loading}):(0,Q.jsxs)(Ye,{children:[(0,Q.jsx)(Je,{icon:b,title:n.personaSectionSoul,subtitle:n.personaSectionSoulHint}),(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulTemplate}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:Yt.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:i(`flex flex-col items-center gap-1.5 rounded-xl border-2 p-3 text-center transition-all`,X.pressCard,oe===e.id?`border-accent bg-accent-soft/40 shadow-sm`:`border-edge hover:border-accent/40 hover:bg-surface-hover`),onClick:()=>j(e.id),children:[(0,Q.jsx)(`span`,{className:`text-xl`,children:e.emoji}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:V(e.labelEn,e.labelZh)})]},e.id))})]}),oe===`custom`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulCustomEdit}),(0,Q.jsx)(`button`,{type:`button`,className:i(be,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),title:le?n.personaSoulEdit:n.personaSoulPreview,"aria-label":le?n.personaSoulEdit:n.personaSoulPreview,onClick:P,children:le?(0,Q.jsx)(I,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(te,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsx)(`div`,{className:i(H,`flex min-h-64 flex-col overflow-hidden p-0`),children:le?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(Ke,{content:se})}):(0,Q.jsx)(qe,{initialContent:se,onChange:M,isDark:re,className:`min-h-0 flex-1`},`soul-${ce}`)})]}):null]}),t[185]=n.loading,t[186]=n.personaSectionSoul,t[187]=n.personaSectionSoulHint,t[188]=n.personaSoulCustomEdit,t[189]=n.personaSoulEdit,t[190]=n.personaSoulPreview,t[191]=n.personaSoulTemplate,t[192]=M,t[193]=j,t[194]=re,t[195]=V,t[196]=w,t[197]=se,t[198]=ce,t[199]=le,t[200]=oe,t[201]=P,t[202]=Mt):Mt=t[202];let Nt;t[203]!==n.purgeDisk||t[204]!==n.removeFromConfig||t[205]!==c||t[206]!==V||t[207]!==x||t[208]!==a.id?(Nt=a.id===`main`?null:(0,Q.jsxs)(Ye,{children:[(0,Q.jsx)(Je,{icon:pe,title:V(`Danger Zone`,`危险操作`),subtitle:V(`Actions that cannot be undone. Be careful.`,`以下操作不可撤销,请谨慎操作。`)}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(J,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>void x(!1),children:[(0,Q.jsx)(T,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(J,{type:`button`,variant:`secondary`,className:`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`,disabled:c,onClick:()=>void x(!0),children:n.purgeDisk})]})]}),t[203]=n.purgeDisk,t[204]=n.removeFromConfig,t[205]=c,t[206]=V,t[207]=x,t[208]=a.id,t[209]=Nt):Nt=t[209];let Pt;return t[210]!==pt||t[211]!==jt||t[212]!==Mt||t[213]!==Nt||t[214]!==G?(Pt=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto`,children:[G,pt,jt,Mt,Nt]}),t[210]=pt,t[211]=jt,t[212]=Mt,t[213]=Nt,t[214]=G,t[215]=Pt):Pt=t[215],Pt}function on(e){return e.preventDefault()}function sn(e){return e.resolved===`dark`}function cn(e){return e.language}function ln(e){let t=!e.pronouns||nn.some(t=>t.value===e.pronouns),n=en.some(t=>t.value===e.timezone);return{showCustomPronouns:!!(e.pronouns&&!t),showCustomTimezone:!!(e.timezone&&!n),customTimezone:e.timezone&&!n?e.timezone:``}}function un(e,t){switch(t.type){case`load`:{let e=ln(t.user),n=JSON.stringify(t.user);return{user:t.user,snapshot:n,...e}}case`patch`:{let n={...e.user,...t.patch};return{...e,user:n}}case`setShowCustomPronouns`:return{...e,showCustomPronouns:t.value};case`setShowCustomTimezone`:return{...e,showCustomTimezone:t.value};case`setCustomTimezone`:return{...e,customTimezone:t.value};case`saved`:return{...e,snapshot:JSON.stringify(e.user)}}}var dn={callName:``,pronouns:``,timezone:``,notes:``},fn={user:dn,showCustomPronouns:!1,showCustomTimezone:!1,customTimezone:``,snapshot:JSON.stringify(dn)};function pn({a:e,agentId:t,saveRef:n,onDirtyChange:r}){let a=o(e=>e.language),[s,c]=(0,$.useReducer)(un,fn),l=(0,$.useRef)(t);l.current=t;let u=(0,$.useRef)(r);u.current=r;let d=M(async()=>{let e=qt(await Z(t,`USER.md`).catch(()=>``));if(!e.timezone){let t=tn();if(t)return{...e,timezone:t}}return e},[t],{enabled:!!t,initial:null,errorData:dn}),f=(0,$.useRef)(null);(0,$.useEffect)(()=>{d.loading||!d.data||f.current!==t&&(f.current=t,c({type:`load`,user:d.data}),u.current?.(!1))},[t,d.loading,d.data]);let p=(0,$.useCallback)(async e=>{await w(l.current,`USER.md`,e)},[]),m=(0,$.useRef)(s.user);m.current=s.user,(0,$.useEffect)(()=>{if(n)return n.current=async()=>{await p(Jt(m.current)),c({type:`saved`}),u.current?.(!1)},()=>{n.current=null}},[n,p]);let h=(0,$.useCallback)(e=>{c({type:`patch`,patch:e});let t={...m.current,...e};u.current?.(JSON.stringify(t)!==s.snapshot)},[s.snapshot]),g=(0,$.useCallback)(e=>{if(e===`__custom__`){c({type:`setShowCustomTimezone`,value:!0});return}c({type:`setShowCustomTimezone`,value:!1}),c({type:`setCustomTimezone`,value:``}),h({timezone:e})},[h]),_=(0,$.useCallback)(e=>{c({type:`setCustomTimezone`,value:e}),h({timezone:e})},[h]),v=(0,$.useCallback)(()=>{let e=tn();e&&(en.some(t=>t.value===e)?(c({type:`setShowCustomTimezone`,value:!1}),c({type:`setCustomTimezone`,value:``})):(c({type:`setShowCustomTimezone`,value:!0}),c({type:`setCustomTimezone`,value:e})),h({timezone:e}))},[h]),y=s.showCustomTimezone?`__custom__`:en.some(e=>e.value===s.user.timezone)?s.user.timezone:`__custom__`,b=(0,$.useCallback)((e,t)=>a===`zh`?t:e,[a]);if(d.loading)return(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.loading});let x=Dt(),{user:S,showCustomPronouns:C,showCustomTimezone:T,customTimezone:E}=s;return(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.personaSectionUserHint}),(0,Q.jsxs)(Ye,{children:[(0,Q.jsx)(Je,{icon:j,title:e.personaSectionUser,subtitle:e.personaSectionUserHint}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.personaCallName}),(0,Q.jsx)(`input`,{className:x,value:S.callName,onChange:e=>h({callName:e.target.value}),placeholder:e.personaCallNamePlaceholder,autoComplete:`off`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.personaPronouns}),(0,Q.jsxs)(`select`,{className:x,value:nn.some(e=>e.value===S.pronouns)?S.pronouns:`__custom__`,onChange:e=>{if(e.target.value===`__custom__`){c({type:`setShowCustomPronouns`,value:!0});return}c({type:`setShowCustomPronouns`,value:!1}),h({pronouns:e.target.value})},children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,children:e.personaPronounsPlaceholder}),nn.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:b(e.labelEn,e.labelZh)},e.value)),(0,Q.jsx)(`option`,{value:`__custom__`,children:b(`Custom…`,`自定义…`)})]}),C?(0,Q.jsx)(`input`,{className:i(x,`mt-1 text-xs`),value:nn.some(e=>e.value===S.pronouns)?``:S.pronouns,onChange:e=>h({pronouns:e.target.value}),placeholder:e.personaPronounsPlaceholder,autoComplete:`off`}):null]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.personaTimezone}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[(0,Q.jsxs)(`select`,{className:i(x,`min-w-0 flex-1`),value:y,onChange:e=>g(e.target.value),children:[en.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:b(e.labelEn,e.labelZh)},e.value)),(0,Q.jsx)(`option`,{value:`__custom__`,children:e.personaTimezoneCustom})]}),(0,Q.jsx)(`button`,{type:`button`,className:i(`shrink-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,X.press),onClick:v,children:e.personaTimezoneDetect})]}),T?(0,Q.jsx)(`input`,{className:i(x,`mt-1 font-mono text-xs`),value:E,onChange:e=>_(e.target.value),placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.personaNotes}),(0,Q.jsx)(`textarea`,{className:i(x,`min-h-16 resize-y text-sm leading-relaxed`),value:S.notes,onChange:e=>h({notes:e.target.value}),placeholder:e.personaNotesPlaceholder,rows:3,spellCheck:!0})]})]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft/30 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,Q.jsx)(Ue,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:e.personaMemoryNote})]})]})]})}function mn(e){let t=(0,yt.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(pn,{...e},e.agentId),t[0]=e,t[1]=n),n}function hn(e){let t=(0,yt.c)(66),{a:n,selected:r,busy:a,skillsCatalogLoading:o,catalogForPick:s,skillsInherit:c,setSkillsInherit:l,skillsPick:u,setSkillsPick:d,onSaveSkills:f,hideInlineSave:p}=e,m;t[0]===r.skills.effectiveAllowlist?m=t[1]:(m=function(e){let t=r.skills.effectiveAllowlist;return t===void 0?!0:t.length===0?!1:t.includes(e)},t[0]=r.skills.effectiveAllowlist,t[1]=m);let h=m,g;t[2]!==s||t[3]!==r.skills.effectiveAllowlist?(g=function(){let e=r.skills.effectiveAllowlist;return e===void 0?new Set(s.map(gn)):new Set(e)},t[2]=s,t[3]=r.skills.effectiveAllowlist,t[4]=g):g=t[4];let _=g,v;t[5]!==n.skillsHint||t[6]!==n.skillsTitle?(v=(0,Q.jsx)(Je,{className:`shrink-0`,icon:Ce,title:n.skillsTitle,subtitle:n.skillsHint}),t[5]=n.skillsHint,t[6]=n.skillsTitle,t[7]=v):v=t[7];let y;t[8]===l?y=t[9]:(y=()=>l(!0),t[8]=l,t[9]=y);let b;t[10]!==n.skillsInherit||t[11]!==a||t[12]!==y?(b=(0,Q.jsx)(J,{type:`button`,variant:`secondary`,disabled:a,onClick:y,children:n.skillsInherit}),t[10]=n.skillsInherit,t[11]=a,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==_||t[15]!==l||t[16]!==d?(x=()=>{l(!1),d(_())},t[14]=_,t[15]=l,t[16]=d,t[17]=x):x=t[17];let S;t[18]!==n.skillsCustomize||t[19]!==a||t[20]!==x?(S=(0,Q.jsx)(J,{type:`button`,variant:`secondary`,disabled:a,onClick:x,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=a,t[20]=x,t[21]=S):S=t[21];let C;t[22]!==b||t[23]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b,S]}),t[22]=b,t[23]=S,t[24]=C):C=t[24];let w;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(w=Y(`skills`),t[25]=w):w=t[25];let T;t[26]===n.skillsLibraryLink?T=t[27]:(T=(0,Q.jsx)(se,{to:w,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[26]=n.skillsLibraryLink,t[27]=T);let E;t[28]!==C||t[29]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[C,T]}),t[28]=C,t[29]=T,t[30]=E):E=t[30];let D;t[31]===r.skills.defaults?D=t[32]:(D=r.skills.defaults.length?r.skills.defaults.join(`, `):`—`,t[31]=r.skills.defaults,t[32]=D);let O;t[33]!==n.skillsDefaultsLabel||t[34]!==D?(O=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsDefaultsLabel,` `,D]}),t[33]=n.skillsDefaultsLabel,t[34]=D,t[35]=O):O=t[35];let k;t[36]!==n.skillsInherit||t[37]!==r.skills.effectiveAllowlist||t[38]!==c?(k=r.skills.effectiveAllowlist?.length?r.skills.effectiveAllowlist.join(`, `):c?n.skillsInherit:`—`,t[36]=n.skillsInherit,t[37]=r.skills.effectiveAllowlist,t[38]=c,t[39]=k):k=t[39];let A;t[40]!==n.skillsEffectiveLabel||t[41]!==k?(A=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,k]}),t[40]=n.skillsEffectiveLabel,t[41]=k,t[42]=A):A=t[42];let j;t[43]!==n.skillsCatalogLoading||t[44]!==n.skillsEmptyCatalog||t[45]!==n.skillsNoDescription||t[46]!==a||t[47]!==s||t[48]!==h||t[49]!==d||t[50]!==o||t[51]!==c||t[52]!==u?(j=o?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsCatalogLoading}):s.length===0?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsEmptyCatalog}):(0,Q.jsx)(`div`,{className:i(`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,c&&`opacity-50`),children:(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:s.map(e=>{let t=e.name||e.directoryId,r=c?h(t):u.has(t),o=typeof e.description==`string`?e.description.trim():``,s=o||n.skillsNoDescription;return(0,Q.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 dark:border-edge-subtle`,children:(0,Q.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:r,disabled:c||a,onChange:()=>{d(e=>{let n=new Set(e);return r?n.delete(t):n.add(t),n})},"aria-label":t}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,Q.jsx)(`p`,{className:i(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!o&&`italic text-fg-subtle`),title:s,children:s})]})]})},t)})})}),t[43]=n.skillsCatalogLoading,t[44]=n.skillsEmptyCatalog,t[45]=n.skillsNoDescription,t[46]=a,t[47]=s,t[48]=h,t[49]=d,t[50]=o,t[51]=c,t[52]=u,t[53]=j):j=t[53];let M;t[54]!==n.skillsSave||t[55]!==a||t[56]!==p||t[57]!==f?(M=p?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(J,{type:`button`,disabled:a,onClick:()=>void f(),children:n.skillsSave})}),t[54]=n.skillsSave,t[55]=a,t[56]=p,t[57]=f,t[58]=M):M=t[58];let N;return t[59]!==E||t[60]!==O||t[61]!==A||t[62]!==j||t[63]!==M||t[64]!==v?(N=(0,Q.jsxs)(Ye,{className:`flex min-h-0 flex-1 flex-col`,children:[v,E,O,A,j,M]}),t[59]=E,t[60]=O,t[61]=A,t[62]=j,t[63]=M,t[64]=v,t[65]=N):N=t[65],N}function gn(e){return e.name||e.directoryId}function _n(e){let t=(0,yt.c)(51),{a:n,data:r,selected:i,busy:s,toolEntryDisable:c,setToolEntryDisable:l,onSaveTools:u,onClearToolsEntry:d,hideInlineSave:f}=e,p=o(yn),m;t[0]===p?m=t[1]:(m=a(p),t[0]=p,t[1]=m);let h=m.agentSettings.advanced,g;t[2]===i.tools.defaultsDisable?g=t[3]:(g=new Set(i.tools.defaultsDisable.flatMap(vn)),t[2]=i.tools.defaultsDisable,t[3]=g);let _=g,v;t[4]===l?v=t[5]:(v=e=>{l(e)},t[4]=l,t[5]=v);let y=v,b=n.toolsDisableGroups,x;t[6]===b?x=t[7]:(x=e=>b[e],t[6]=b,t[7]=x);let S=x,C;t[8]===n.toolDescriptions?C=t[9]:(C=e=>e in n.toolDescriptions?n.toolDescriptions[e]:``,t[8]=n.toolDescriptions,t[9]=C);let w=C,T;t[10]!==n.toolsHint||t[11]!==n.toolsTitle?(T=(0,Q.jsx)(Je,{className:`shrink-0`,icon:L,title:n.toolsTitle,subtitle:n.toolsHint}),t[10]=n.toolsHint,t[11]=n.toolsTitle,t[12]=T):T=t[12];let E;t[13]!==n.toolsLockedByDefaults||t[14]!==h.toolsDisableEmptyBuiltin||t[15]!==h.toolsDisableLoadingBuiltin||t[16]!==h.toolsDisableNotInBuiltin||t[17]!==h.toolsDisableQuickActionsLabel||t[18]!==h.toolsDisableQuickDisableAll||t[19]!==h.toolsDisableQuickEnableAll||t[20]!==h.toolsDisableQuickHighRiskOff||t[21]!==h.toolsDisableQuickNoOutbound||t[22]!==h.toolsDisableQuickReadOnlyWorkspace?(E={loadingBuiltin:h.toolsDisableLoadingBuiltin,emptyBuiltin:h.toolsDisableEmptyBuiltin,quickActionsLabel:h.toolsDisableQuickActionsLabel,quickEnableAll:h.toolsDisableQuickEnableAll,quickDisableAll:h.toolsDisableQuickDisableAll,quickReadOnlyWorkspace:h.toolsDisableQuickReadOnlyWorkspace,quickHighRiskOff:h.toolsDisableQuickHighRiskOff,quickNoOutbound:h.toolsDisableQuickNoOutbound,notInBuiltin:h.toolsDisableNotInBuiltin,lockedByDefaults:n.toolsLockedByDefaults},t[13]=n.toolsLockedByDefaults,t[14]=h.toolsDisableEmptyBuiltin,t[15]=h.toolsDisableLoadingBuiltin,t[16]=h.toolsDisableNotInBuiltin,t[17]=h.toolsDisableQuickActionsLabel,t[18]=h.toolsDisableQuickDisableAll,t[19]=h.toolsDisableQuickEnableAll,t[20]=h.toolsDisableQuickHighRiskOff,t[21]=h.toolsDisableQuickNoOutbound,t[22]=h.toolsDisableQuickReadOnlyWorkspace,t[23]=E):E=t[23];let D;t[24]!==s||t[25]!==r.builtinToolIds||t[26]!==_||t[27]!==S||t[28]!==w||t[29]!==y||t[30]!==E||t[31]!==c?(D=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(it,{mode:`agentEntry`,builtinToolIds:r.builtinToolIds,loading:!1,disableSet:c,onDisableSetChange:y,defaultsDisableSet:_,getToolDescription:w,getGroupTitle:S,quickActionsDisabled:s,labels:E})}),t[24]=s,t[25]=r.builtinToolIds,t[26]=_,t[27]=S,t[28]=w,t[29]=y,t[30]=E,t[31]=c,t[32]=D):D=t[32];let O;t[33]!==n.toolsSave||t[34]!==s||t[35]!==f||t[36]!==u?(O=f?null:(0,Q.jsx)(J,{type:`button`,disabled:s,onClick:()=>void u(),children:n.toolsSave}),t[33]=n.toolsSave,t[34]=s,t[35]=f,t[36]=u,t[37]=O):O=t[37];let k;t[38]===d?k=t[39]:(k=()=>void d(),t[38]=d,t[39]=k);let A;t[40]!==n.toolsClearEntry||t[41]!==s||t[42]!==k?(A=(0,Q.jsx)(J,{type:`button`,variant:`secondary`,disabled:s,onClick:k,children:n.toolsClearEntry}),t[40]=n.toolsClearEntry,t[41]=s,t[42]=k,t[43]=A):A=t[43];let j;t[44]!==A||t[45]!==O?(j=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[O,A]}),t[44]=A,t[45]=O,t[46]=j):j=t[46];let M;return t[47]!==j||t[48]!==T||t[49]!==D?(M=(0,Q.jsxs)(Ye,{className:`flex min-h-0 flex-1 flex-col`,children:[T,D,j]}),t[47]=j,t[48]=T,t[49]=D,t[50]=M):M=t[50],M}function vn(e){let t=String(e).trim();return t?[t]:[]}function yn(e){return e.language}function bn(e){let t=(0,yt.c)(107),{a:n,chat:r,cCron:i,selected:a,panel:o,data:s,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,defaultModel:_,defaultWorkspace:v,onSetDefault:y,onSaveAgentEdits:b,onDelete:x,profileSaveRef:S,overviewProfile:C,setProfileDirty:w,filesLoading:T,files:E,activeFile:D,setActiveFile:O,filesViewMode:k,setFilesViewMode:A,fileDraft:j,setFileDraft:M,fileSaving:N,profileFileLoading:P,profileEditorNonce:F,toolEntryDisable:I,setToolEntryDisable:L,onSaveTools:R,onClearToolsEntry:ee,modelRows:z,setModelRows:te,onSaveModels:ne,onClearModelsEntry:re,skillsCatalogLoading:ie,catalogForPick:ae,skillsInherit:B,setSkillsInherit:oe,skillsPick:se,setSkillsPick:ce,onSaveSkills:le,bindingsLoading:ue,agentBindings:de,bindChannelStatuses:fe,bindChannelsLoading:pe,useManualChannel:me,newBindChannel:V,setNewBindChannel:he,bindSessionChats:H,bindSessionsLoading:ge,newBindSessionIdx:U,setNewBindSessionIdx:_e,newBindCustomPeer:W,setNewBindCustomPeer:ve,refreshBindSessions:ye,onRemoveBinding:G,onAddBinding:be,cronLoading:xe,agentCronJobs:Se,onSetCronJobAgent:Ce,onTryInChat:K}=e;if(!a){let e;return t[0]===n.selectAgentHint?e=t[1]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[0]=n.selectAgentHint,t[1]=e),e}if(o===`overview`){let e;return t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==_||t[6]!==v||t[7]!==d||t[8]!==h||t[9]!==l||t[10]!==p||t[11]!==x||t[12]!==b||t[13]!==y||t[14]!==K||t[15]!==C.draft||t[16]!==C.handleSoulContentChange||t[17]!==C.handleSoulTemplateChange||t[18]!==C.profileMarkdownLoading||t[19]!==C.setAvatarDialogOpen||t[20]!==C.toggleSoulPreviewMode||t[21]!==C.updateIdentity||t[22]!==a||t[23]!==f||t[24]!==g||t[25]!==u||t[26]!==m?(e=(0,Q.jsx)(an,{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,onSetDefault:y,onSaveAgentEdits:b,onDelete:x,hideInlineSave:!0,profileMarkdownLoading:C.profileMarkdownLoading,profileDraft:C.draft,updateIdentity:C.updateIdentity,handleSoulTemplateChange:C.handleSoulTemplateChange,handleSoulContentChange:C.handleSoulContentChange,setAvatarDialogOpen:C.setAvatarDialogOpen,toggleSoulPreviewMode:C.toggleSoulPreviewMode,defaultModel:_,defaultWorkspace:v,onTryInChat:K}),t[2]=n,t[3]=c,t[4]=r,t[5]=_,t[6]=v,t[7]=d,t[8]=h,t[9]=l,t[10]=p,t[11]=x,t[12]=b,t[13]=y,t[14]=K,t[15]=C.draft,t[16]=C.handleSoulContentChange,t[17]=C.handleSoulTemplateChange,t[18]=C.profileMarkdownLoading,t[19]=C.setAvatarDialogOpen,t[20]=C.toggleSoulPreviewMode,t[21]=C.updateIdentity,t[22]=a,t[23]=f,t[24]=g,t[25]=u,t[26]=m,t[27]=e):e=t[27],e}if(o===`profile`){let e;return t[28]!==n||t[29]!==S||t[30]!==a.id||t[31]!==w?(e=(0,Q.jsx)(mn,{a:n,agentId:a.id,saveRef:S,onDirtyChange:w}),t[28]=n,t[29]=S,t[30]=a.id,t[31]=w,t[32]=e):e=t[32],e}if(o===`files`){let e;return t[33]!==n||t[34]!==D||t[35]!==j||t[36]!==N||t[37]!==E||t[38]!==T||t[39]!==k||t[40]!==K||t[41]!==F||t[42]!==P||t[43]!==O||t[44]!==M||t[45]!==A?(e=(0,Q.jsx)(It,{a:n,filesLoading:T,files:E,activeFile:D,setActiveFile:O,filesViewMode:k,setFilesViewMode:A,fileDraft:j,setFileDraft:M,fileSaving:N,profileFileLoading:P,profileEditorNonce:F,onTryInChat:K}),t[33]=n,t[34]=D,t[35]=j,t[36]=N,t[37]=E,t[38]=T,t[39]=k,t[40]=K,t[41]=F,t[42]=P,t[43]=O,t[44]=M,t[45]=A,t[46]=e):e=t[46],e}if(o===`tools`){let e;return t[47]!==n||t[48]!==c||t[49]!==s||t[50]!==ee||t[51]!==R||t[52]!==a||t[53]!==L||t[54]!==I?(e=(0,Q.jsx)(_n,{a:n,data:s,selected:a,busy:c,toolEntryDisable:I,setToolEntryDisable:L,onSaveTools:R,onClearToolsEntry:ee,hideInlineSave:!0}),t[47]=n,t[48]=c,t[49]=s,t[50]=ee,t[51]=R,t[52]=a,t[53]=L,t[54]=I,t[55]=e):e=t[55],e}if(o===`models`){let e;return t[56]!==n||t[57]!==c||t[58]!==r||t[59]!==z||t[60]!==re||t[61]!==ne||t[62]!==a||t[63]!==te?(e=(0,Q.jsx)(Rt,{a:n,chat:r,selected:a,busy:c,modelRows:z,setModelRows:te,onSaveModels:ne,onClearModelsEntry:re,hideInlineSave:!0}),t[56]=n,t[57]=c,t[58]=r,t[59]=z,t[60]=re,t[61]=ne,t[62]=a,t[63]=te,t[64]=e):e=t[64],e}if(o===`skills`){let e;return t[65]!==n||t[66]!==c||t[67]!==ae||t[68]!==le||t[69]!==a||t[70]!==oe||t[71]!==ce||t[72]!==ie||t[73]!==B||t[74]!==se?(e=(0,Q.jsx)(hn,{a:n,selected:a,busy:c,skillsCatalogLoading:ie,catalogForPick:ae,skillsInherit:B,setSkillsInherit:oe,skillsPick:se,setSkillsPick:ce,onSaveSkills:le,hideInlineSave:!0}),t[65]=n,t[66]=c,t[67]=ae,t[68]=le,t[69]=a,t[70]=oe,t[71]=ce,t[72]=ie,t[73]=B,t[74]=se,t[75]=e):e=t[75],e}if(o===`channels`){let e;return t[76]!==n||t[77]!==de||t[78]!==fe||t[79]!==pe||t[80]!==H||t[81]!==ge||t[82]!==ue||t[83]!==c||t[84]!==i.lastActiveLabels||t[85]!==i.selectRecipient||t[86]!==V||t[87]!==W||t[88]!==U||t[89]!==be||t[90]!==G||t[91]!==ye||t[92]!==he||t[93]!==ve||t[94]!==_e||t[95]!==me?(e=(0,Q.jsx)(Mt,{a:n,busy:c,bindingsLoading:ue,agentBindings:de,channelStatuses:fe,channelsStatusLoading:pe,useManualChannel:me,newBindChannel:V,setNewBindChannel:he,bindSessionChats:H,sessionsLoading:ge,newBindSessionIdx:U,setNewBindSessionIdx:_e,newBindCustomPeer:W,setNewBindCustomPeer:ve,onRefreshSessions:ye,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:G,onAddBinding:be}),t[76]=n,t[77]=de,t[78]=fe,t[79]=pe,t[80]=H,t[81]=ge,t[82]=ue,t[83]=c,t[84]=i.lastActiveLabels,t[85]=i.selectRecipient,t[86]=V,t[87]=W,t[88]=U,t[89]=be,t[90]=G,t[91]=ye,t[92]=he,t[93]=ve,t[94]=_e,t[95]=me,t[96]=e):e=t[96],e}if(o===`cron`&&s){let e;return t[97]!==n||t[98]!==Se||t[99]!==c||t[100]!==xe||t[101]!==s||t[102]!==Ce||t[103]!==a?(e=(0,Q.jsx)(Nt,{a:n,data:s,selected:a,busy:c,cronLoading:xe,agentCronJobs:Se,onSetCronJobAgent:Ce}),t[97]=n,t[98]=Se,t[99]=c,t[100]=xe,t[101]=s,t[102]=Ce,t[103]=a,t[104]=e):e=t[104],e}let q;return t[105]===n.selectAgentHint?q=t[106]:(q=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[105]=n.selectAgentHint,t[106]=q),q}function xn(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=S(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=re(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function Sn(e,t){return e.replace(`{{count}}`,String(t))}function Cn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Sn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Sn(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function wn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Sn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Sn(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function Tn(e){let t=(0,yt.c)(11),{text:n,children:r,className:a}=e,o;t[0]!==r||t[1]!==a||t[2]!==n?(o=(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsx)(`span`,{className:a,title:n,children:r})}),t[0]=r,t[1]=a,t[2]=n,t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=i(`max-w-[min(28rem,calc(100vw-2rem))] rounded-lg border border-edge bg-surface-panel px-2.5 py-2`,`text-left text-xs leading-snug text-fg shadow-popover`,We),t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(f,{className:`fill-surface-panel`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(R,{children:(0,Q.jsxs)(Oe,{side:`top`,align:`start`,sideOffset:6,className:s,children:[n,c]})}),t[6]=n,t[7]=l);let u;return t[8]!==o||t[9]!==l?(u=(0,Q.jsx)(ee,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(ne,{children:[o,l]})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}function En(e){let t=(0,yt.c)(28),{a:n,agents:r,searchQuery:a,onOpenAgent:o,onChatWithAgent:s,busy:c}=e,l,u,d,f,p;if(t[0]!==n||t[1]!==r||t[2]!==c||t[3]!==s||t[4]!==o||t[5]!==a){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=xn(r,a,n),m=r.length>0&&e.length===0&&a.trim().length>0;if(r.length===0){let e;t[11]===n.listNoAgentsYet?e=t[12]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.listNoAgentsYet}),t[11]=n.listNoAgentsYet,t[12]=e),p=e;break bb0}d=`flex flex-col gap-4`,t[13]!==n||t[14]!==m?(f=m?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.listEmpty}):null,t[13]=n,t[14]=m,t[15]=f):f=t[15],l=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`;let h;t[16]!==n||t[17]!==c||t[18]!==s||t[19]!==o?(h=e=>{let t=S(e,n),r=e.id,a=re(e,n),l=Cn(e,n),u=wn(e,n);return(0,Q.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Q.jsxs)(`article`,{className:`flex min-h-[15.5rem] flex-col rounded-xl border border-edge-subtle bg-surface-panel p-4 shadow-surface transition-colors hover:border-edge`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`button`,{type:`button`,disabled:c,onClick:()=>o(e.id),className:i(`flex min-w-0 items-start gap-3 text-left`,`rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,`disabled:pointer-events-none disabled:opacity-50`,X.pressCard),children:[(0,Q.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base text-fg ring-1 ring-edge-subtle/40`,"aria-hidden":!0,children:(0,Q.jsx)(k,{agentId:e.id,avatar:e.avatar,size:48,className:`size-full`})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,title:r,children:r})]})]}),e.isDefault?(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.defaultBadge}):(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:n.listCustomBadge})]}),(0,Q.jsxs)(`button`,{type:`button`,disabled:c,onClick:()=>o(e.id),className:i(`mt-5 min-h-[6.25rem] text-left`,`rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-base px-3 py-3`,children:(0,Q.jsx)(`p`,{className:i(`line-clamp-2 text-sm leading-5`,a?`text-fg`:`text-fg-muted`),title:a||void 0,children:a||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:l,children:u.map(Dn)})]}),(0,Q.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,Q.jsxs)(J,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>s(e.id),className:`w-full rounded-2xl py-2.5`,children:[(0,Q.jsx)(de,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[16]=n,t[17]=c,t[18]=s,t[19]=o,t[20]=h):h=t[20],u=e.map(h)}t[0]=n,t[1]=r,t[2]=c,t[3]=s,t[4]=o,t[5]=a,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[21]!==l||t[22]!==u?(m=(0,Q.jsx)(`ul`,{className:l,children:u}),t[21]=l,t[22]=u,t[23]=m):m=t[23];let h;return t[24]!==d||t[25]!==f||t[26]!==m?(h=(0,Q.jsxs)(`div`,{className:d,children:[f,m]}),t[24]=d,t[25]=f,t[26]=m,t[27]=h):h=t[27],h}function Dn(e){return(0,Q.jsx)(Tn,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function On(e){let t=(0,yt.c)(130),{open:n,onOpenChange:r,a,chat:o,busy:s,modalError:c,profileLanguageLabel:l,createDisplayName:u,setCreateDisplayName:f,createAgentId:p,setCreateAgentId:m,createDescription:h,setCreateDescription:g,createWorkspace:_,setCreateWorkspace:v,createModel:y,setCreateModel:b,onCreate:x,onSuggestWorkspace:C,agents:w,duplicateSourceId:T,onSelectDuplicateSource:E}=e,D;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(ge,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ye)}),t[0]=D):D=t[0];let O;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(O=i(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,640px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,Te,`overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=O):O=t[1];let k;t[2]===a.addAgent?k=t[3]:(k=(0,Q.jsx)(d,{className:`text-base font-semibold text-fg`,children:a.addAgent}),t[2]=a.addAgent,t[3]=k);let j;t[4]===a.addAgentHint?j=t[5]:(j=(0,Q.jsx)(_e,{className:`mt-0.5 text-xs text-fg-muted`,children:a.addAgentHint}),t[4]=a.addAgentHint,t[5]=j);let M;t[6]!==k||t[7]!==j?(M=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[k,j]}),t[6]=k,t[7]=j,t[8]=M):M=t[8];let N;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=i(be,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=N):N=t[9];let F;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(De,{className:`size-4`,"aria-hidden":!0}),t[10]=F):F=t[10];let I;t[11]===a.closeDialogAria?I=t[12]:(I=(0,Q.jsx)(Pe,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:N,"aria-label":a.closeDialogAria,children:F})}),t[11]=a.closeDialogAria,t[12]=I);let L;t[13]!==M||t[14]!==I?(L=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[M,I]}),t[13]=M,t[14]=I,t[15]=L):L=t[15];let R;t[16]!==a||t[17]!==w||t[18]!==T||t[19]!==E?(R=w.length>0?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.copyFromExistingAgent}),(0,Q.jsxs)(`select`,{className:i(Dt(),`bg-surface-panel`),value:T??``,onChange:e=>E(e.target.value||null),children:[(0,Q.jsx)(`option`,{value:``,children:a.copyFromExistingAgentNone}),w.map(e=>(0,Q.jsxs)(`option`,{value:e.id,children:[S(e,a),` · `,e.id]},e.id))]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.duplicateAgentHint})]}):null,t[16]=a,t[17]=w,t[18]=T,t[19]=E,t[20]=R):R=t[20];let ee;t[21]===c?ee=t[22]:(ee=c?(0,Q.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:c}):null,t[21]=c,t[22]=ee);let z;t[23]!==a.newAgentLabel||t[24]!==l?(z=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.newAgentLabel,` (`,l,`)`]}),t[23]=a.newAgentLabel,t[24]=l,t[25]=z):z=t[25];let te;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(te=Dt(),t[26]=te):te=t[26];let ne;t[27]===f?ne=t[28]:(ne=e=>f(e.target.value),t[27]=f,t[28]=ne);let re;t[29]===C?re=t[30]:(re=()=>C(),t[29]=C,t[30]=re);let ie;t[31]!==u||t[32]!==ne||t[33]!==re?(ie=(0,Q.jsx)(`input`,{className:te,value:u,onChange:ne,onBlur:re,required:!0,autoComplete:`off`}),t[31]=u,t[32]=ne,t[33]=re,t[34]=ie):ie=t[34];let B;t[35]!==z||t[36]!==ie?(B=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[z,ie]}),t[35]=z,t[36]=ie,t[37]=B):B=t[37];let oe;t[38]===a.newAgentIdOptional?oe=t[39]:(oe=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newAgentIdOptional}),t[38]=a.newAgentIdOptional,t[39]=oe);let se;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(se=i(Dt(),`font-mono text-xs`),t[40]=se):se=t[40];let ce;t[41]===m?ce=t[42]:(ce=e=>m(e.target.value),t[41]=m,t[42]=ce);let le;t[43]===C?le=t[44]:(le=()=>C(),t[43]=C,t[44]=le);let de;t[45]!==a.newAgentIdPlaceholder||t[46]!==a.newAgentIdRules||t[47]!==p||t[48]!==ce||t[49]!==le?(de=(0,Q.jsx)(`input`,{className:se,value:p,onChange:ce,onBlur:le,placeholder:a.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:a.newAgentIdRules}),t[45]=a.newAgentIdPlaceholder,t[46]=a.newAgentIdRules,t[47]=p,t[48]=ce,t[49]=le,t[50]=de):de=t[50];let fe;t[51]===a.newAgentIdRules?fe=t[52]:(fe=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.newAgentIdRules}),t[51]=a.newAgentIdRules,t[52]=fe);let pe;t[53]!==oe||t[54]!==de||t[55]!==fe?(pe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[oe,de,fe]}),t[53]=oe,t[54]=de,t[55]=fe,t[56]=pe):pe=t[56];let me;t[57]!==a.agentDescription||t[58]!==l?(me=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.agentDescription,` (`,l,`)`]}),t[57]=a.agentDescription,t[58]=l,t[59]=me):me=t[59];let he;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(he=i(Dt(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[60]=he):he=t[60];let H;t[61]===g?H=t[62]:(H=e=>g(e.target.value),t[61]=g,t[62]=H);let U;t[63]!==a.agentDescriptionPlaceholder||t[64]!==h||t[65]!==H?(U=(0,Q.jsx)(`textarea`,{className:he,value:h,onChange:H,placeholder:a.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[63]=a.agentDescriptionPlaceholder,t[64]=h,t[65]=H,t[66]=U):U=t[66];let W;t[67]!==me||t[68]!==U?(W=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[me,U]}),t[67]=me,t[68]=U,t[69]=W):W=t[69];let G;t[70]===a.newWorkspace?G=t[71]:(G=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newWorkspace}),t[70]=a.newWorkspace,t[71]=G);let xe;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(xe=i(Dt(),`font-mono text-xs`),t[72]=xe):xe=t[72];let Se;t[73]===v?Se=t[74]:(Se=e=>v(e.target.value),t[73]=v,t[74]=Se);let Ce;t[75]!==_||t[76]!==Se?(Ce=(0,Q.jsx)(`input`,{className:xe,value:_,onChange:Se,required:!0,autoComplete:`off`}),t[75]=_,t[76]=Se,t[77]=Ce):Ce=t[77];let K;t[78]!==G||t[79]!==Ce?(K=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[G,Ce]}),t[78]=G,t[79]=Ce,t[80]=K):K=t[80];let q;t[81]===a.newModelOptional?q=t[82]:(q=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newModelOptional}),t[81]=a.newModelOptional,t[82]=q);let we;t[83]===b?we=t[84]:(we=e=>b(e),t[83]=b,t[84]=we);let Ee;t[85]!==s||t[86]!==o.modelNoMatches||t[87]!==o.modelPlaceholder||t[88]!==o.modelSearchPlaceholder||t[89]!==y||t[90]!==we?(Ee=(0,Q.jsx)(ue,{className:`min-w-0 flex-1`,value:y,disabled:s,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,onChange:we}),t[85]=s,t[86]=o.modelNoMatches,t[87]=o.modelPlaceholder,t[88]=o.modelSearchPlaceholder,t[89]=y,t[90]=we,t[91]=Ee):Ee=t[91];let Oe;t[92]!==a.modelClear||t[93]!==s||t[94]!==y||t[95]!==b?(Oe=y.trim()?(0,Q.jsx)(J,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:s,onClick:()=>b(``),children:a.modelClear}):null,t[92]=a.modelClear,t[93]=s,t[94]=y,t[95]=b,t[96]=Oe):Oe=t[96];let ke;t[97]!==Ee||t[98]!==Oe?(ke=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[Ee,Oe]}),t[97]=Ee,t[98]=Oe,t[99]=ke):ke=t[99];let Ae;t[100]!==q||t[101]!==ke?(Ae=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[q,ke]}),t[100]=q,t[101]=ke,t[102]=Ae):Ae=t[102];let je;t[103]!==a.createModalCancel||t[104]!==s?(je=(0,Q.jsx)(Pe,{asChild:!0,children:(0,Q.jsx)(J,{type:`button`,variant:`secondary`,disabled:s,children:a.createModalCancel})}),t[103]=a.createModalCancel,t[104]=s,t[105]=je):je=t[105];let Me;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Q.jsx)(P,{className:`mr-1 size-4`,"aria-hidden":!0}),t[106]=Me):Me=t[106];let Ne;t[107]!==a.create||t[108]!==s?(Ne=(0,Q.jsxs)(J,{type:`submit`,disabled:s,children:[Me,a.create]}),t[107]=a.create,t[108]=s,t[109]=Ne):Ne=t[109];let Fe;t[110]!==je||t[111]!==Ne?(Fe=(0,Q.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[je,Ne]}),t[110]=je,t[111]=Ne,t[112]=Fe):Fe=t[112];let Ie;t[113]!==x||t[114]!==ee||t[115]!==B||t[116]!==pe||t[117]!==W||t[118]!==K||t[119]!==Ae||t[120]!==Fe||t[121]!==R?(Ie=(0,Q.jsxs)(`form`,{className:`grid gap-3`,onSubmit:x,children:[R,ee,B,pe,W,K,Ae,Fe]}),t[113]=x,t[114]=ee,t[115]=B,t[116]=pe,t[117]=W,t[118]=K,t[119]=Ae,t[120]=Fe,t[121]=R,t[122]=Ie):Ie=t[122];let Le;t[123]!==Ie||t[124]!==L?(Le=(0,Q.jsxs)(ve,{children:[D,(0,Q.jsx)(A,{className:O,onOpenAutoFocus:kn,children:(0,Q.jsxs)(V,{layer:`modal`,children:[L,Ie]})})]}),t[123]=Ie,t[124]=L,t[125]=Le):Le=t[125];let Re;return t[126]!==r||t[127]!==n||t[128]!==Le?(Re=(0,Q.jsx)(ae,{open:n,onOpenChange:r,children:Le}),t[126]=r,t[127]=n,t[128]=Le,t[129]=Re):Re=t[129],Re}function kn(e){return e.preventDefault()}function An(e){let t=(0,yt.c)(18),{a:n,busy:r,listSearchQuery:i,onListSearchQueryChange:a,onAddAgent:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(Ne,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e.target.value),t[1]=a,t[2]=c);let l;t[3]!==n.listSearchPlaceholder||t[4]!==i||t[5]!==c?(l=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[s,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:c,placeholder:n.listSearchPlaceholder,autoComplete:`off`,spellCheck:!1,"aria-label":n.listSearchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[3]=n.listSearchPlaceholder,t[4]=i,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=()=>o(),t[7]=o,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(v,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=d):d=t[9];let f;t[10]!==n.addAgent||t[11]!==n.addAgentAria||t[12]!==r||t[13]!==u?(f=(0,Q.jsxs)(J,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":n.addAgentAria,disabled:r,onClick:u,children:[d,n.addAgent]}),t[10]=n.addAgent,t[11]=n.addAgentAria,t[12]=r,t[13]=u,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function jn(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function Mn(e){let{agentId:t,enabled:n,saveRef:r}=e,i=M(async()=>{if(!t)return null;let[e,n]=await Promise.all([Z(t,`IDENTITY.md`).catch(()=>``),Z(t,`SOUL.md`).catch(()=>``)]),r=Wt(e);return{identity:r,soulTemplate:Zt(n),soulCustomContent:n,identityBaseline:JSON.stringify(r),soulBaseline:n}},[t],{enabled:n&&!!t,initial:null,errorData:null}),a=i.data,o=i.loading,s=(0,$.useRef)(!1),[c,l]=(0,$.useState)(null),u=t??``,d=(0,$.useRef)(u);d.current!==u&&(d.current=u,s.current=!1,l(null));let f=c??(a?jn(a):null),p=(0,$.useMemo)(()=>f?JSON.stringify(f.identity)!==f.identityBaseline||f.soulCustomContent!==f.soulBaseline:!1,[f]),m=(0,$.useRef)(t);m.current=t;let h=(0,$.useCallback)(e=>{s.current=!0,l(t=>{let n=t??(a?jn(a):null);return n?e(n):null})},[a]),g=(0,$.useCallback)(e=>{h(t=>({...t,identity:{...t.identity,...e}}))},[h]),_=(0,$.useCallback)(e=>{h(t=>{if(e===`custom`)return{...t,soulTemplate:`custom`};let n=Yt.find(t=>t.id===e);return n?.content?{...t,soulTemplate:e,soulCustomContent:n.content,soulEditorNonce:t.soulEditorNonce+1}:{...t,soulTemplate:e}})},[h]),v=(0,$.useCallback)(e=>{h(t=>({...t,soulCustomContent:e,soulTemplate:`custom`}))},[h]),y=(0,$.useCallback)(e=>{h(t=>({...t,avatarDialogOpen:e}))},[h]),b=(0,$.useCallback)(()=>{h(e=>({...e,soulPreviewMode:!e.soulPreviewMode}))},[h]),x=(0,$.useCallback)(async()=>{let e=m.current;!e||!f||(await Promise.all([w(e,`IDENTITY.md`,Gt(f.identity)),w(e,`SOUL.md`,f.soulCustomContent)]),s.current=!1,l(e=>{let t=e??f;return{...t,identityBaseline:JSON.stringify(t.identity),soulBaseline:t.soulCustomContent}}))},[f]);return(0,$.useLayoutEffect)(()=>{if(r)return r.current=x,()=>{r.current=null}},[x,r]),{profileMarkdownLoading:o,draft:f,dirty:p,updateIdentity:g,handleSoulTemplateChange:_,handleSoulContentChange:v,setAvatarDialogOpen:y,toggleSoulPreviewMode:b}}var Nn={draft:``,editorNonce:0,loadedKey:``};function Pn(e,t){switch(t.type){case`load`:return{draft:t.content,editorNonce:e.editorNonce+1,loadedKey:t.key};case`setDraft`:return{...e,draft:t.value};case`clear`:return{draft:``,editorNonce:e.editorNonce,loadedKey:``};case`resetViewMode`:return e}}function Fn(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=M(()=>n?m(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`files`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,f]=(0,$.useState)(null),[p,h]=(0,$.useReducer)(Pn,Nn),[g,_]=(0,$.useState)(!1),[v,y]=(0,$.useState)(`edit`),b=(0,$.useRef)(n);(0,$.useEffect)(()=>{n!==b.current&&(b.current=n,f(null))},[n]),(0,$.useEffect)(()=>{if(c&&c.files.length>0&&!d){let e=c.files.find(e=>e.name===`AGENTS.md`);f(e?e.name:c.files[0].name)}},[c,d]);let x=p.draft,S=p.editorNonce,C=(0,$.useRef)(x);C.current=x;let T=(0,$.useRef)(n);T.current=n;let D=(0,$.useRef)(d);D.current=d;let O=(0,$.useRef)(null),k=(0,$.useRef)(``),A=(0,$.useRef)(``),j=(0,$.useRef)(``),N=(0,$.useRef)(()=>{}),P=M(()=>d&&n?Z(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),F=P.loading,I=E(async()=>{let e=T.current,t=D.current;if(!e||!t||`${e}:${t}`!==k.current)return;let n=C.current;if(n!==A.current){_(!0),o(null);try{await w(e,t,n),A.current=n,l(n=>!n||n.agentId!==e?n:{...n,files:n.files.map(e=>e.name===t?{...e,missing:!1}:e)})}catch(e){o(e instanceof Error?e.message:a)}finally{_(!1)}}},800);N.current=I.flush,(0,$.useEffect)(()=>()=>{N.current()},[]);let L=(0,$.useRef)(t);L.current!==t&&(L.current===`files`&&N.current(),L.current=t);let R=d&&n?`${n}:${d}`:``;(0,$.useEffect)(()=>{R!==j.current&&(N.current(),j.current=R)},[R]),(0,$.useEffect)(()=>{if(!R){h({type:`clear`});return}F||(k.current=R,A.current=P.data,h({type:`load`,key:R,content:P.data}))},[R,F,P.data]);let ee=(0,$.useRef)({activeFile:d,selectedId:n});return(ee.current.activeFile!==d||ee.current.selectedId!==n)&&(ee.current={activeFile:d,selectedId:n},y(`edit`)),{files:c,setFiles:l,filesLoading:u,activeFile:d,setActiveFile:(0,$.useCallback)(e=>{N.current(),f(e)},[]),fileDraft:x,setFileDraft:(0,$.useCallback)(e=>{h({type:`setDraft`,value:typeof e==`function`?e(C.current):e}),I()},[I]),fileSaving:g,filesViewMode:v,setFilesViewMode:y,profileFileLoading:F,profileEditorNonce:S,overviewSaveProfileMarkdownRef:O,saveProfileMarkdownDebounced:I}}function In(e){let{panel:t,hasToken:n,bindingsFromConfig:r,gatewayCfgLoading:i,selected:a,saveErrorMessage:o,setBusy:s,setError:c}=e,l=(0,$.useRef)(!1),[u,d]=(0,$.useState)(null),f=(0,$.useRef)(r);t===`channels`&&n&&!l.current&&f.current!==r&&(f.current=r,d(r));let p=u??r,m=t===`channels`&&n,h=M(()=>ht(),[t,n],{enabled:m,initial:[],errorData:[]}),g=h.data,_=h.loading,v=(0,$.useMemo)(()=>_||g.length===0?``:g[0]?.name??``,[g,_]),[y,b]=(0,$.useState)(``),x=(0,$.useRef)(v);t===`channels`&&!_&&v&&x.current!==v&&(!y||!g.some(e=>e.name===y))&&(x.current=v,b(v)),x.current=v;let S=y.trim(),C=m&&S.length>0,w=M(()=>dt(S),[t,n,S],{enabled:C,initial:[],errorData:[]}),T=w.data,E=w.loading,D=w.setData,[O,k]=(0,$.useState)(null),[A,j]=(0,$.useState)(``),N=(0,$.useRef)(S);N.current!==S&&(N.current=S,k(null));let P=(0,$.useMemo)(()=>a?p.filter(e=>e.agentId.toLowerCase()===a.id.toLowerCase()):[],[p,a?.id]),F=(0,$.useCallback)(()=>{let e=y.trim();e&&dt(e).then(e=>{D(e),k(t=>t!=null&&t<e.length?t:null)}).catch(()=>{D([]),k(null)})},[y,D]),I=!_&&g.length===0,L=t===`channels`&&n&&i,R=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await he(t),l.current=!0,d(t)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,o,s,c]);return{agentBindings:P,allBindings:p,bindChannelStatuses:g,bindChannelsLoading:_,bindSessionChats:T,bindSessionsLoading:E,bindingsLoading:L,newBindChannel:y,setNewBindChannel:b,newBindSessionIdx:O,setNewBindSessionIdx:k,newBindCustomPeer:A,setNewBindCustomPeer:j,onAddBinding:(0,$.useCallback)(async e=>{if(e.preventDefault(),!a||!y.trim())return;let t=At(y,A,O,T),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await he(n),l.current=!0,d(n),k(null),j(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,T,y,A,O,o,a,s,c]),onRemoveBinding:R,refreshBindSessions:F,useManualChannel:I}}function Ln(e){let{panel:t,hasToken:n,data:r,selected:i,saveErrorMessage:a,setBusy:o,setError:s}=e,{data:c,loading:l}=M(()=>ft(),[t,n],{enabled:t===`cron`&&n,initial:[],errorData:[]}),[u,d]=(0,$.useState)(null),f=u??c,p=(0,$.useMemo)(()=>!r||!i?[]:f.filter(e=>!vt(e)&&Ot(e,i.id,r.defaultId)),[f,r,i]);async function m(e,t){o(!0),s(null);try{await pt(e.id,{agentId:t}),d(await ft())}catch(e){s(e instanceof Error?e.message:a)}finally{o(!1)}}return{agentCronJobs:p,cronJobs:f,cronLoading:l,onSetCronJobAgent:m}}function Rn(e){return new Set(e.tools.entryDisable)}function zn(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function Bn(e){let{panel:t,selected:n}=e,r=`${t}:${n?.id??``}`,i=(0,$.useRef)(r),[a,o]=(0,$.useState)(()=>new Set),[s,c]=(0,$.useState)(()=>new Set),[l,u]=(0,$.useState)(!0),[d,f]=(0,$.useState)(()=>[]);if(i.current!==r){if(i.current=r,n&&t===`tools`&&o(Rn(n)),n&&t===`skills`){let e=zn(n);u(e.inherit),c(e.pick)}n&&t===`models`&&f(tt(n.typedModels.entry))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:f}}function Vn(){let e=o(e=>e.language),t=a(e),n=t.agentsSettings,[r,i]=(0,$.useState)(!1),[s,u]=(0,$.useState)(null),[d,f]=(0,$.useState)(!1),[p,m]=(0,$.useState)(``),h=t.cron,g=t.chat,v=!!c(e=>e.token),[b,x]=_(),w=le(),{agentId:T}=y(),E=Ee(e=>e.setPageHeader),D=Ee(e=>e.clearPageHeader),{data:k,error:A,isLoading:j,mutate:M}=l(v?`settings-gateway-agents`:null,me,{revalidateOnFocus:!1}),{data:P}=xe(v),F=(0,$.useMemo)(()=>fe(P?.payload?.config??{}),[P]),I=(0,$.useMemo)(()=>$e(P?.payload?.config??{}),[P]),L=k??null,R=!!(v&&j),[ee,z]=(0,$.useState)(null),te=A instanceof Error?A.message:A?n.loadError:null,ne=ee??te,[re,ie]=(0,$.useState)(null),[ae,B]=(0,$.useState)(`overview`),[se,ce]=(0,$.useState)(``),[ue,de]=(0,$.useState)(``),[pe,V]=(0,$.useState)(``),[he,H]=(0,$.useState)(``),[ge,U]=(0,$.useState)(``),[_e,W]=(0,$.useState)(null),[ve,ye]=(0,$.useState)(!1),G=(0,$.useRef)(``),[be,Se]=(0,$.useState)(null),[Ce,K]=(0,$.useState)(!1),[q,we]=(0,$.useState)(``),[Te,De]=(0,$.useState)(``),[Oe,J]=(0,$.useState)(``),[Ae,je]=(0,$.useState)(``),[Me,Ne]=(0,$.useState)(``),Pe=(0,$.useRef)(null),Fe=(0,$.useRef)(null),[Ie,Le]=(0,$.useState)(!1),[Be,Ve]=(0,$.useState)(!1),He=(0,$.useRef)({data:null,routeAgentId:void 0});L&&(L!==He.current.data||T!==He.current.routeAgentId)&&(He.current={data:L,routeAgentId:T},T&&L.agents.some(e=>e.id===T)?ie(T):ie(e=>e&&L.agents.some(t=>t.id===e)?e:L.defaultId)),(0,$.useEffect)(()=>{!L||!T||L.agents.some(e=>e.id===T)||w(ze,{replace:!0})},[L,T,w]),(0,$.useEffect)(()=>{T&&B(`overview`)},[T]),(0,$.useEffect)(()=>{b.get(`panel`)===`defaults`&&w(`/settings/agent-defaults`,{replace:!0,state:{[C]:T?ke(T):ze}})},[b,T,w]),(0,$.useEffect)(()=>{if(b.get(`focus`)!==`avatar`||!T||(B(`overview`),R||!L?.agents.some(e=>e.id===T)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),x(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[b,T,R,L,x]);let Y=(0,$.useMemo)(()=>L?.agents.find(e=>e.id===re)??null,[L,re]),Ue=(0,$.useRef)(null),We=Y?Y.id:null;Y&&Ue.current!==We?(Ue.current=We,De(Y.workspace),J(Y.model?.primary??``),je(S(Y,a(e).agentsSettings)),Ne(Y.description??``)):!Y&&Ue.current!==null&&(Ue.current=null,De(``),J(``),je(``),Ne(``));let Ge=Mn({agentId:Y?.id??null,enabled:ae===`overview`&&!!Y,saveRef:Fe}),X=Fn({panel:ae,selectedId:re,hasToken:v,dataAgentsLength:L?.agents.length,saveErrorMessage:n.saveError,setError:z}),Ke=Bn({panel:ae,selected:Y}),Z=In({panel:ae,hasToken:v,bindingsFromConfig:F,gatewayCfgLoading:P===void 0,selected:Y,saveErrorMessage:n.saveError,setBusy:K,setError:z}),qe=Ln({panel:ae,hasToken:v,data:L,selected:Y,saveErrorMessage:n.saveError,setBusy:K,setError:z}),Je=at({panel:ae,hasToken:v}),Ye=(0,$.useCallback)(()=>{let e=lt(ue.trim()||se);H(t=>t===``||t===G.current?(G.current=e,e):t)},[ue,se]),Xe=(0,$.useCallback)(()=>{G.current=``,ce(``),de(``),V(``),H(``),U(``),W(null),Se(null),ye(!0)},[]),et=(0,$.useCallback)(e=>{let t=new Set(L?.agents.map(e=>e.id.toLowerCase())??[]),r=e.trim();if(!t.has(r.toLowerCase()))return r;let i=`${r}${n.duplicateIdSuffix}`;if(!t.has(i.toLowerCase()))return i;for(let e=2;e<1e3;e+=1){let n=`${i}-${e}`;if(!t.has(n.toLowerCase()))return n}return i},[n.duplicateIdSuffix,L]),tt=(0,$.useCallback)(e=>{if(Se(e),!e)return;let t=L?.agents.find(t=>t.id===e);if(!t)return;let r=t.name?.trim()??t.id,i=n.duplicateName.replace(`{{name}}`,r),a=et(t.id),o=t.description??``;G.current=``,ce(i),de(a),V(o),H(t.workspace),U(t.model?.primary??``),W(null)},[n.duplicateName,L,et]),nt=(0,$.useCallback)(e=>{tt(e),ye(!0)},[tt]),rt=(0,$.useMemo)(()=>(0,Q.jsx)(An,{a:n,busy:Ce,listSearchQuery:q,onListSearchQueryChange:we,onAddAgent:()=>Xe()}),[n,Ce,q,Xe]);(0,$.useLayoutEffect)(()=>v?(E({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title})}),end:rt}),()=>D()):(D(),()=>D()),[n.title,rt,D,v,E]);async function it(t){t.preventDefault();let r=se.trim();if(!r)return;let i=ot(ue,r);if(i.ok===!1){W(i.error);return}let a=he.trim()||lt(ue.trim()||r);if(a){K(!0),W(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${pe.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
71
+ `),{createdAgentId:n,...i}=await O({workspace:a,...ue.trim()?{id:ue.trim()}:{},...ge.trim()?{models:{chat:{primary:ge.trim()}}}:{},profileFiles:{"IDENTITY.md":t},...be?{cloneFrom:be}:{}});M(i,{revalidate:!1}),ce(``),de(``),V(``),H(``),U(``),W(null),ye(!1),ie(n),w(ke(n))}catch(e){W(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}}async function st(){if(Y){K(!0),z(null);try{M(await N(Y.id,{workspace:Te.trim()||void 0,models:{chat:Oe.trim()?{primary:Oe.trim()}:null}}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}}async function ct(e){K(!0),z(null);try{M(await N(e.id,{setDefault:!0}),{revalidate:!1}),ie(e.id)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}async function ut(e,t){K(!0),z(null);try{let n=await oe(e.id,t);M(n,{revalidate:!1}),ie(n.defaultId),B(`overview`),T===e.id&&w(ze,{replace:!0}),i(!1),u(null),m(``)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}function dt(e,t){e.id!==`main`&&(u(e),f(t),m(``),i(!0))}async function ft(){if(Y){K(!0),z(null);try{let e=Array.from(Ke.toolEntryDisable).toSorted((e,t)=>e.localeCompare(t));M(await N(Y.id,{tools:{disable:e}}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}}async function pt(){if(Y){K(!0),z(null);try{M(await N(Y.id,{tools:{disable:null}}),{revalidate:!1}),Ke.setToolEntryDisable(new Set)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}}async function mt(){if(!Y)return;let e=Qe(Ke.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e){z(e);return}K(!0),z(null);try{M(await N(Y.id,{models:{roles:Ze(Ke.modelRows)?.roles??{}}}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}async function ht(){if(Y){K(!0),z(null);try{M(await N(Y.id,{models:{roles:null}}),{revalidate:!1}),Ke.setModelRows([])}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}}async function gt(){if(Y){K(!0),z(null);try{M(await N(Y.id,{skills:Ke.skillsInherit?null:[...Ke.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}}let _t=ae===`channels`||ae===`cron`,vt=(()=>{if(!Y||ae!==`overview`)return!1;let e=Y.workspace,t=Y.model?.primary??``;return Te.trim()!==e||Oe.trim()!==t})(),yt=(()=>{if(_t||!Y)return!1;switch(ae){case`overview`:return vt||Ge.dirty;case`profile`:return Ie;default:return!0}})(),bt=_t||!yt;function xt(){Ve(!0),setTimeout(()=>Ve(!1),2e3)}async function St(){switch(ae){case`overview`:await Promise.all([st(),Fe.current?.()??Promise.resolve()]),xt();break;case`profile`:await Pe.current?.(),xt();break;case`tools`:await ft(),xt();break;case`models`:await mt(),xt();break;case`skills`:await gt(),xt();break;case`files`:X.saveProfileMarkdownDebounced.flush(),xt();break;default:break}}function Ct(e){e||w(ze)}let wt=Y?Ae.trim()||S(Y,n):T??``,Tt=Y?.id??T??``,Et=(0,$.useCallback)(async()=>{if(Y){await St();try{globalThis.localStorage?.setItem(Re,Y.id)}catch{}w(`/chat/new`,{state:{agentId:Y.id,fromAgentEditor:!0}})}},[Y,St,w]),Dt={a:n,chat:g,cCron:h,selected:Y,panel:ae,data:L,busy:Ce,editName:Ae,setEditName:je,editDescription:Me,setEditDescription:Ne,editWorkspace:Te,setEditWorkspace:De,editModel:Oe,setEditModel:J,defaultModel:I.model,defaultWorkspace:I.workspace,onSetDefault:()=>{Y&&ct(Y)},onSaveAgentEdits:()=>void st(),onDelete:e=>{Y&&dt(Y,e)},onTryInChat:()=>void Et(),overviewSaveProfileMarkdownRef:Fe,profileSaveRef:Pe,overviewProfile:Ge,setProfileDirty:Le,filesLoading:X.filesLoading,files:X.files,activeFile:X.activeFile,setActiveFile:X.setActiveFile,filesViewMode:X.filesViewMode,setFilesViewMode:X.setFilesViewMode,fileDraft:X.fileDraft,setFileDraft:X.setFileDraft,fileSaving:X.fileSaving,profileFileLoading:X.profileFileLoading,profileEditorNonce:X.profileEditorNonce,toolEntryDisable:Ke.toolEntryDisable,setToolEntryDisable:Ke.setToolEntryDisable,onSaveTools:()=>void ft(),onClearToolsEntry:()=>void pt(),modelRows:Ke.modelRows,setModelRows:Ke.setModelRows,onSaveModels:()=>void mt(),onClearModelsEntry:()=>void ht(),skillsCatalogLoading:Je.skillsCatalogLoading,catalogForPick:Je.catalogForPick,skillsInherit:Ke.skillsInherit,setSkillsInherit:Ke.setSkillsInherit,skillsPick:Ke.skillsPick,setSkillsPick:Ke.setSkillsPick,onSaveSkills:()=>void gt(),bindingsLoading:Z.bindingsLoading,agentBindings:Z.agentBindings,bindChannelStatuses:Z.bindChannelStatuses,bindChannelsLoading:Z.bindChannelsLoading,useManualChannel:Z.useManualChannel,newBindChannel:Z.newBindChannel,setNewBindChannel:Z.setNewBindChannel,bindSessionChats:Z.bindSessionChats,bindSessionsLoading:Z.bindSessionsLoading,newBindSessionIdx:Z.newBindSessionIdx,setNewBindSessionIdx:Z.setNewBindSessionIdx,newBindCustomPeer:Z.newBindCustomPeer,setNewBindCustomPeer:Z.setNewBindCustomPeer,refreshBindSessions:Z.refreshBindSessions,onRemoveBinding:e=>void Z.onRemoveBinding(e),onAddBinding:Z.onAddBinding,cronLoading:qe.cronLoading,agentCronJobs:qe.agentCronJobs,onSetCronJobAgent:(e,t)=>void qe.onSetCronJobAgent(e,t)};return{hasToken:v,a:n,chat:g,language:e,data:L,loading:R,displayError:ne,navigate:w,routeAgentId:T,busy:Ce,listSearchQuery:q,openAddAgentModal:Xe,openDuplicateAgentModal:nt,duplicateSourceId:be,onSelectDuplicateSource:tt,panel:ae,setPanel:B,modalTitle:wt,modalSubtitle:Tt,footerSaveDisabled:bt,savedFlash:Be,handleModalFooterSave:St,onAgentModalOpenChange:Ct,addAgentModalOpen:ve,setAddAgentModalOpen:ye,createWorkspaceSuggestedRef:G,createModalError:_e,setCreateModalError:W,createDisplayName:se,setCreateDisplayName:ce,createAgentId:ue,setCreateAgentId:de,createDescription:pe,setCreateDescription:V,createWorkspace:he,setCreateWorkspace:H,createModel:ge,setCreateModel:U,onCreate:it,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:Ye,deleteDialogOpen:r,setDeleteDialogOpen:i,deletePurge:d,deleteTarget:s,setDeleteTarget:u,deleteConfirmText:p,setDeleteConfirmText:m,performDelete:ut,editorPanelProps:Dt}}function Hn(){let e=Vn();return e.hasToken?(0,Q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-8`,children:[e.displayError?(0,Q.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:e.displayError}):null,e.loading?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.loading}):e.data?(0,Q.jsx)(En,{a:e.a,agents:e.data.agents,searchQuery:e.listSearchQuery,onOpenAgent:t=>e.navigate(ke(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(Re,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},busy:e.busy}):null,e.routeAgentId&&e.hasToken?(0,Q.jsx)(Tt,{open:!!e.routeAgentId,onOpenChange:e.onAgentModalOpenChange,a:e.a,title:e.modalTitle,subtitle:e.modalSubtitle,panel:e.panel,onPanelChange:e.setPanel,onFooterSave:()=>void e.handleModalFooterSave(),footerSaveDisabled:e.footerSaveDisabled,footerSavedFlash:e.savedFlash,busy:e.busy,children:e.loading||!e.data?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.loading}):(0,Q.jsx)(bn,{...e.editorPanelProps})}):null,(0,Q.jsx)(On,{open:e.addAgentModalOpen,onOpenChange:t=>{e.setAddAgentModalOpen(t),t||(e.createWorkspaceSuggestedRef.current=``,e.setCreateDisplayName(``),e.setCreateAgentId(``),e.setCreateDescription(``),e.setCreateWorkspace(``),e.setCreateModel(``),e.setCreateModalError(null),e.onSelectDuplicateSource(null))},a:e.a,chat:e.chat,busy:e.busy,modalError:e.createModalError,profileLanguageLabel:e.currentLanguageLabel,createDisplayName:e.createDisplayName,setCreateDisplayName:e.setCreateDisplayName,createAgentId:e.createAgentId,setCreateAgentId:e.setCreateAgentId,createDescription:e.createDescription,setCreateDescription:e.setCreateDescription,createWorkspace:e.createWorkspace,setCreateWorkspace:e.setCreateWorkspace,createModel:e.createModel,setCreateModel:e.setCreateModel,onCreate:e.onCreate,onSuggestWorkspace:()=>e.applyCreateWorkspaceSuggestion(),agents:e.data?.agents??[],duplicateSourceId:e.duplicateSourceId,onSelectDuplicateSource:e.onSelectDuplicateSource}),(0,Q.jsx)(bt,{open:e.deleteDialogOpen,onOpenChange:t=>{e.setDeleteDialogOpen(t),t||(e.setDeleteTarget(null),e.setDeleteConfirmText(``))},busy:e.busy,deletePurge:e.deletePurge,deleteTarget:e.deleteTarget,deleteConfirmText:e.deleteConfirmText,onDeleteConfirmTextChange:e.setDeleteConfirmText,onConfirm:()=>{e.deleteTarget&&e.performDelete(e.deleteTarget,e.deletePurge)},onCancel:()=>e.setDeleteDialogOpen(!1),a:e.a})]}):(0,Q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-8`,children:[(0,Q.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:e.a.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]})}export{nt as AgentBrowserSettingsPage,rt as AgentDefaultsTabbedPage,Hn as AgentsSettingsPanel};
@@ -1 +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-JdwAhgNB.js";import{t as a}from"./messages-Csef1aW7.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{$r as s,B as c,Fo as l,Jr as u,Pa as d,Qr as f,Xr as p,Yr as m,Zr as h,_i as g,_n as _,ai as v,gn as y,ki as b,wo as x,xi as S}from"./index-COkF54xv.js";import{r as C,t as w}from"./settings-form-section-BsrK7TBF.js";var T=n(),E=e(t(),1),D=r();function O(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function k(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function A(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var j={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function M({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,E.useReducer)(c,j),{info:o,loadError:v,actionError:C,copiedField:T,clearDialogOpen:M,clearConfirmChecked:N,clearConfirmText:P,uninstallDialogOpen:F,removeUserDataOnUninstall:I,busy:L}=r,R=(0,E.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,E.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await g(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async e=>{let t=window.electronAPI?.shell;if(!t)return;let n=await t.openPath(e);n.error&&a({type:`patch`,patch:{actionError:n.error}})},V=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:k(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},H=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:I});n.ok||a({type:`patch`,patch:{actionError:k(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(v)return(0,D.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:v});if(!o)return(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.loading});let U=!o.packaged,W=L||o.pendingUpdate||U,G=!U&&o.uninstallMode!==`unsupported`,K=A(o,t),q=N&&P.trim()===t.clearDataConfirmPhrase;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(w,{children:[n?(0,D.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,D.jsx)(d,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,C?(0,D.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:C}):null,U?(0,D.jsxs)(`div`,{className:`mb-4 rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 py-2.5`,children:[(0,D.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,o.pendingUpdate?(0,D.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,o.hasSeparateCliData&&o.cliDataPath?(0,D.jsxs)(`div`,{className:`mb-4 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2.5`,children:[(0,D.jsx)(`p`,{className:`text-xs text-amber-800 dark:text-amber-200`,children:t.cliDataWarning}),(0,D.jsxs)(`button`,{type:`button`,className:i(`mt-2 inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,S.press),onClick:()=>void B(o.cliDataPath),children:[(0,D.jsx)(x,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t.openCliData]})]}):null,(0,D.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,D.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/60 p-3`,children:[(0,D.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,D.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,D.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.appPath}),(0,D.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,S.press),onClick:()=>void z(o.appPath,`app`),children:[(0,D.jsx)(l,{className:`size-3`,"aria-hidden":!0}),T===`app`?t.copied:t.copyPath]})]})]}),(0,D.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/60 p-3`,children:[(0,D.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,D.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,D.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.userDataPath}),(0,D.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,S.press),onClick:()=>void z(o.userDataPath,`data`),children:[(0,D.jsx)(l,{className:`size-3`,"aria-hidden":!0}),T===`data`?t.copied:t.copyPath]})]}),(0,D.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,O(o.userDataSizeBytes,t.dataSizeUnknown)]})]})]}),(0,D.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-panel/60 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,D.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,D.jsx)(`button`,{type:`button`,disabled:W,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,S.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),G?(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-panel/60 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,D.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:K})]}),(0,D.jsx)(`button`,{type:`button`,disabled:W,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,S.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,D.jsx)(f,{open:M,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,D.jsxs)(h,{children:[(0,D.jsx)(p,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,_)}),(0,D.jsxs)(u,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,y,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,D.jsx)(s,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,D.jsx)(m,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,D.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,D.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:N,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,D.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,D.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,D.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,D.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:P,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,D.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,D.jsx)(b,{type:`button`,variant:`secondary`,disabled:L,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,D.jsx)(b,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:L||!q,onClick:()=>void V(),children:t.confirmClear})]})]})]})}),G?(0,D.jsx)(f,{open:F,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,D.jsxs)(h,{children:[(0,D.jsx)(p,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,_)}),(0,D.jsxs)(u,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,y,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,D.jsx)(s,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,D.jsx)(m,{className:`mt-2 text-sm text-fg-muted`,children:K}),(0,D.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,D.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:I,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,D.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),I?(0,D.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,D.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,D.jsx)(b,{type:`button`,variant:`secondary`,disabled:L,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,D.jsx)(b,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:L,onClick:()=>void H(),children:t.confirmUninstall})]})]})]})}):null]})}function N(){let e=(0,T.c)(22),t=o(P),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.appManagement,s=typeof window<`u`?window.electronAPI?.system:void 0;if(!v()||!s){let t;e[2]===i.title?t=e[3]:(t=(0,D.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=C(),e[4]=n):n=e[4];let a;e[5]===r.desktopOnlyTitle?a=e[6]:(a=(0,D.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[5]=r.desktopOnlyTitle,e[6]=a);let o;e[7]===r.desktopOnlyBody?o=e[8]:(o=(0,D.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[7]=r.desktopOnlyBody,e[8]=o);let s;e[9]!==a||e[10]!==o?(s=(0,D.jsxs)(`div`,{className:n,children:[a,o]}),e[9]=a,e[10]=o,e[11]=s):s=e[11];let c;return e[12]!==t||e[13]!==s?(c=(0,D.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-8`,children:[t,s]}),e[12]=t,e[13]=s,e[14]=c):c=e[14],c}let c;e[15]===i.title?c=e[16]:(c=(0,D.jsx)(`div`,{children:(0,D.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:i.title})}),e[15]=i.title,e[16]=c);let l;e[17]===i?l=e[18]:(l=(0,D.jsx)(M,{api:s,messages:i,embedded:!1}),e[17]=i,e[18]=l);let u;return e[19]!==c||e[20]!==l?(u=(0,D.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-8`,children:[c,l]}),e[19]=c,e[20]=l,e[21]=u):u=e[21],u}function P(e){return e.language}export{N as AppManagementSettingsPanel};
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-JdwAhgNB.js";import{t as a}from"./messages-CkT-lcgP.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{$r as s,B as c,Fo as l,Jr as u,Pa as d,Qr as f,Xr as p,Yr as m,Zr as h,_i as g,_n as _,ai as v,gn as y,ki as b,wo as x,xi as S}from"./index-Cxm6xsps.js";import{r as C,t as w}from"./settings-form-section-Dq-83cQd.js";var T=n(),E=e(t(),1),D=r();function O(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function k(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function A(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var j={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function M({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,E.useReducer)(c,j),{info:o,loadError:v,actionError:C,copiedField:T,clearDialogOpen:M,clearConfirmChecked:N,clearConfirmText:P,uninstallDialogOpen:F,removeUserDataOnUninstall:I,busy:L}=r,R=(0,E.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,E.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await g(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async e=>{let t=window.electronAPI?.shell;if(!t)return;let n=await t.openPath(e);n.error&&a({type:`patch`,patch:{actionError:n.error}})},V=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:k(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},H=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:I});n.ok||a({type:`patch`,patch:{actionError:k(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(v)return(0,D.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:v});if(!o)return(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.loading});let U=!o.packaged,W=L||o.pendingUpdate||U,G=!U&&o.uninstallMode!==`unsupported`,K=A(o,t),q=N&&P.trim()===t.clearDataConfirmPhrase;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(w,{children:[n?(0,D.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,D.jsx)(d,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,C?(0,D.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:C}):null,U?(0,D.jsxs)(`div`,{className:`mb-4 rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 py-2.5`,children:[(0,D.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,o.pendingUpdate?(0,D.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,o.hasSeparateCliData&&o.cliDataPath?(0,D.jsxs)(`div`,{className:`mb-4 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2.5`,children:[(0,D.jsx)(`p`,{className:`text-xs text-amber-800 dark:text-amber-200`,children:t.cliDataWarning}),(0,D.jsxs)(`button`,{type:`button`,className:i(`mt-2 inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,S.press),onClick:()=>void B(o.cliDataPath),children:[(0,D.jsx)(x,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t.openCliData]})]}):null,(0,D.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,D.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/60 p-3`,children:[(0,D.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,D.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,D.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.appPath}),(0,D.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,S.press),onClick:()=>void z(o.appPath,`app`),children:[(0,D.jsx)(l,{className:`size-3`,"aria-hidden":!0}),T===`app`?t.copied:t.copyPath]})]})]}),(0,D.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/60 p-3`,children:[(0,D.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,D.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,D.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.userDataPath}),(0,D.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,S.press),onClick:()=>void z(o.userDataPath,`data`),children:[(0,D.jsx)(l,{className:`size-3`,"aria-hidden":!0}),T===`data`?t.copied:t.copyPath]})]}),(0,D.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,O(o.userDataSizeBytes,t.dataSizeUnknown)]})]})]}),(0,D.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-panel/60 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,D.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,D.jsx)(`button`,{type:`button`,disabled:W,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,S.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),G?(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-panel/60 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,D.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:K})]}),(0,D.jsx)(`button`,{type:`button`,disabled:W,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,S.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,D.jsx)(f,{open:M,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,D.jsxs)(h,{children:[(0,D.jsx)(p,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,_)}),(0,D.jsxs)(u,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,y,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,D.jsx)(s,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,D.jsx)(m,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,D.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,D.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:N,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,D.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,D.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,D.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,D.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:P,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,D.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,D.jsx)(b,{type:`button`,variant:`secondary`,disabled:L,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,D.jsx)(b,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:L||!q,onClick:()=>void V(),children:t.confirmClear})]})]})]})}),G?(0,D.jsx)(f,{open:F,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,D.jsxs)(h,{children:[(0,D.jsx)(p,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,_)}),(0,D.jsxs)(u,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,y,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,D.jsx)(s,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,D.jsx)(m,{className:`mt-2 text-sm text-fg-muted`,children:K}),(0,D.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,D.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:I,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,D.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),I?(0,D.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,D.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,D.jsx)(b,{type:`button`,variant:`secondary`,disabled:L,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,D.jsx)(b,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:L,onClick:()=>void H(),children:t.confirmUninstall})]})]})]})}):null]})}function N(){let e=(0,T.c)(22),t=o(P),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.appManagement,s=typeof window<`u`?window.electronAPI?.system:void 0;if(!v()||!s){let t;e[2]===i.title?t=e[3]:(t=(0,D.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=C(),e[4]=n):n=e[4];let a;e[5]===r.desktopOnlyTitle?a=e[6]:(a=(0,D.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[5]=r.desktopOnlyTitle,e[6]=a);let o;e[7]===r.desktopOnlyBody?o=e[8]:(o=(0,D.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[7]=r.desktopOnlyBody,e[8]=o);let s;e[9]!==a||e[10]!==o?(s=(0,D.jsxs)(`div`,{className:n,children:[a,o]}),e[9]=a,e[10]=o,e[11]=s):s=e[11];let c;return e[12]!==t||e[13]!==s?(c=(0,D.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-8`,children:[t,s]}),e[12]=t,e[13]=s,e[14]=c):c=e[14],c}let c;e[15]===i.title?c=e[16]:(c=(0,D.jsx)(`div`,{children:(0,D.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:i.title})}),e[15]=i.title,e[16]=c);let l;e[17]===i?l=e[18]:(l=(0,D.jsx)(M,{api:s,messages:i,embedded:!1}),e[17]=i,e[18]=l);let u;return e[19]!==c||e[20]!==l?(u=(0,D.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-8`,children:[c,l]}),e[19]=c,e[20]=l,e[21]=u):u=e[21],u}function P(e){return e.language}export{N as AppManagementSettingsPanel};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{t as r}from"./messages-Csef1aW7.js";import{t as i}from"./locale-store-DjbfSsfA.js";import{i as a}from"./theme-store-CD2wtgZV.js";import{fi as o,x as s,xi as c}from"./index-COkF54xv.js";import{t as l}from"./settings-advanced-gate-BYS-rpzn.js";var u=e(),d=t();function f(){return n(`rounded-xl border border-edge-subtle bg-surface-base px-4 py-1 sm:px-5`)}var p={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function m(e){let t=(0,u.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,d.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let f;t[7]===a?f=t[8]:(f=(0,d.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=f);let p;t[9]!==l||t[10]!==f?(p=(0,d.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,f]}),t[9]=l,t[10]=f,t[11]=p):p=t[11];let m;t[12]===o?m=t[13]:(m=(0,d.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=m);let h;t[14]===o?h=t[15]:(h=(0,d.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=h);let g;t[16]!==c||t[17]!==p||t[18]!==m||t[19]!==h?(g=(0,d.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[p,m,h]}),t[16]=c,t[17]=p,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==s||t[22]!==g?(_=(0,d.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:g}),t[21]=s,t[22]=g,t[23]=_):_=t[23],_}function h(e){let t=(0,u.c)(8),{scheme:n}=e,{light:r,dark:i}=p[n],a;t[0]===r?a=t[1]:(a=(0,d.jsx)(m,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,d.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,d.jsx)(m,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,d.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var g=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function _(){let e=(0,u.c)(18),t=i(b),o;e[0]===t?o=e[1]:(o=r(t),e[0]=t,e[1]=o);let s=o.appearanceSettings,l=a(y),f=a(v),p;e[2]===s.colorSchemeTitle?p=e[3]:(p=(0,d.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:s.colorSchemeTitle}),e[2]=s.colorSchemeTitle,e[3]=p);let m;e[4]===s.colorSchemeDescription?m=e[5]:(m=(0,d.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.colorSchemeDescription}),e[4]=s.colorSchemeDescription,e[5]=m);let _;e[6]!==p||e[7]!==m?(_=(0,d.jsxs)(`div`,{className:`min-w-0`,children:[p,m]}),e[6]=p,e[7]=m,e[8]=_):_=e[8];let x;e[9]!==s||e[10]!==l||e[11]!==f?(x=g.map(e=>{let{value:t,labelKey:r}=e,i=l===t;return(0,d.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>f(t),className:n(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,c.pressCard,i?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,d.jsx)(h,{scheme:t}),(0,d.jsx)(`span`,{className:n(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:s[r]})]},t)}),e[9]=s,e[10]=l,e[11]=f,e[12]=x):x=e[12];let S;e[13]===x?S=e[14]:(S=(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:x}),e[13]=x,e[14]=S);let C;return e[15]!==_||e[16]!==S?(C=(0,d.jsxs)(`div`,{className:`flex flex-col gap-2 border-b border-edge-subtle py-3.5 last:border-b-0 sm:py-4`,children:[_,S]}),e[15]=_,e[16]=S,e[17]=C):C=e[17],C}function v(e){return e.setColorScheme}function y(e){return e.colorScheme}function b(e){return e.language}function x(){let e=(0,u.c)(27),t=i(w),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o=s(C),c=s(S),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,d.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let f;e[4]===a.developerGroupDescription?f=e[5]:(f=(0,d.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=f);let p;e[6]!==l||e[7]!==f?(p=(0,d.jsxs)(`div`,{className:`min-w-0`,children:[l,f]}),e[6]=l,e[7]=f,e[8]=p):p=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,d.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,d.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,d.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===c?_=e[17]:(_=e=>c(e.target.checked),e[16]=c,e[17]=_);let v;e[18]!==o||e[19]!==_?(v=(0,d.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:o,onChange:_}),e[18]=o,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,d.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==p||e[25]!==y?(b=(0,d.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[p,y]}),e[24]=p,e[25]=y,e[26]=b):b=e[26],b}function S(e){return e.setShowRawToolData}function C(e){return e.showRawToolData}function w(e){return e.language}function T(){let e=(0,u.c)(33),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,s;e[2]===a.pageTitle?s=e[3]:(s=(0,d.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight text-fg`,children:a.pageTitle}),e[2]=a.pageTitle,e[3]=s);let c;e[4]===a.subtitle?c=e[5]:(c=(0,d.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.subtitle}),e[4]=a.subtitle,e[5]=c);let p;e[6]!==s||e[7]!==c?(p=(0,d.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[s,c]}),e[6]=s,e[7]=c,e[8]=p):p=e[8];let m;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=f(),e[9]=m):m=e[9];let h;e[10]===a.languageTitle?h=e[11]:(h=(0,d.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:a.languageTitle}),e[10]=a.languageTitle,e[11]=h);let g;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,d.jsx)(o,{variant:`page`,sections:[`language`]}),e[12]=g):g=e[12];let v;e[13]===h?v=e[14]:(v=(0,d.jsxs)(`section`,{className:m,"aria-labelledby":`pref-language-heading`,children:[h,g]}),e[13]=h,e[14]=v);let y;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=f(),e[15]=y):y=e[15];let b;e[16]===a.themeTitle?b=e[17]:(b=(0,d.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:a.themeTitle}),e[16]=a.themeTitle,e[17]=b);let S,C;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,d.jsx)(o,{variant:`page`,sections:[`theme`,`font`]}),C=(0,d.jsx)(_,{}),e[18]=S,e[19]=C):(S=e[18],C=e[19]);let w;e[20]===b?w=e[21]:(w=(0,d.jsxs)(`section`,{className:y,"aria-labelledby":`pref-appearance-heading`,children:[b,S,C]}),e[20]=b,e[21]=w);let T;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(T=f(),e[22]=T):T=e[22];let D;e[23]===a.developerGroupTitle?D=e[24]:(D=(0,d.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:a.developerGroupTitle}),e[23]=a.developerGroupTitle,e[24]=D);let O;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,d.jsx)(x,{}),e[25]=O):O=e[25];let k;e[26]===D?k=e[27]:(k=(0,d.jsx)(l,{children:(0,d.jsxs)(`section`,{className:T,"aria-labelledby":`pref-developer-heading`,children:[D,O]})}),e[26]=D,e[27]=k);let A;return e[28]!==w||e[29]!==k||e[30]!==p||e[31]!==v?(A=(0,d.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6`,children:[p,v,w,k]}),e[28]=w,e[29]=k,e[30]=p,e[31]=v,e[32]=A):A=e[32],A}function E(e){return e.language}export{T as AppearanceSettingsPanel};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{t as r}from"./messages-CkT-lcgP.js";import{t as i}from"./locale-store-DjbfSsfA.js";import{i as a}from"./theme-store-CD2wtgZV.js";import{fi as o,x as s,xi as c}from"./index-Cxm6xsps.js";import{t as l}from"./settings-advanced-gate-D9sva86V.js";var u=e(),d=t();function f(){return n(`rounded-xl border border-edge-subtle bg-surface-base px-4 py-1 sm:px-5`)}var p={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function m(e){let t=(0,u.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,d.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let f;t[7]===a?f=t[8]:(f=(0,d.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=f);let p;t[9]!==l||t[10]!==f?(p=(0,d.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,f]}),t[9]=l,t[10]=f,t[11]=p):p=t[11];let m;t[12]===o?m=t[13]:(m=(0,d.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=m);let h;t[14]===o?h=t[15]:(h=(0,d.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=h);let g;t[16]!==c||t[17]!==p||t[18]!==m||t[19]!==h?(g=(0,d.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[p,m,h]}),t[16]=c,t[17]=p,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==s||t[22]!==g?(_=(0,d.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:g}),t[21]=s,t[22]=g,t[23]=_):_=t[23],_}function h(e){let t=(0,u.c)(8),{scheme:n}=e,{light:r,dark:i}=p[n],a;t[0]===r?a=t[1]:(a=(0,d.jsx)(m,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,d.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,d.jsx)(m,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,d.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var g=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function _(){let e=(0,u.c)(18),t=i(b),o;e[0]===t?o=e[1]:(o=r(t),e[0]=t,e[1]=o);let s=o.appearanceSettings,l=a(y),f=a(v),p;e[2]===s.colorSchemeTitle?p=e[3]:(p=(0,d.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:s.colorSchemeTitle}),e[2]=s.colorSchemeTitle,e[3]=p);let m;e[4]===s.colorSchemeDescription?m=e[5]:(m=(0,d.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.colorSchemeDescription}),e[4]=s.colorSchemeDescription,e[5]=m);let _;e[6]!==p||e[7]!==m?(_=(0,d.jsxs)(`div`,{className:`min-w-0`,children:[p,m]}),e[6]=p,e[7]=m,e[8]=_):_=e[8];let x;e[9]!==s||e[10]!==l||e[11]!==f?(x=g.map(e=>{let{value:t,labelKey:r}=e,i=l===t;return(0,d.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>f(t),className:n(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,c.pressCard,i?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,d.jsx)(h,{scheme:t}),(0,d.jsx)(`span`,{className:n(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:s[r]})]},t)}),e[9]=s,e[10]=l,e[11]=f,e[12]=x):x=e[12];let S;e[13]===x?S=e[14]:(S=(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:x}),e[13]=x,e[14]=S);let C;return e[15]!==_||e[16]!==S?(C=(0,d.jsxs)(`div`,{className:`flex flex-col gap-2 border-b border-edge-subtle py-3.5 last:border-b-0 sm:py-4`,children:[_,S]}),e[15]=_,e[16]=S,e[17]=C):C=e[17],C}function v(e){return e.setColorScheme}function y(e){return e.colorScheme}function b(e){return e.language}function x(){let e=(0,u.c)(27),t=i(w),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o=s(C),c=s(S),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,d.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let f;e[4]===a.developerGroupDescription?f=e[5]:(f=(0,d.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=f);let p;e[6]!==l||e[7]!==f?(p=(0,d.jsxs)(`div`,{className:`min-w-0`,children:[l,f]}),e[6]=l,e[7]=f,e[8]=p):p=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,d.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,d.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,d.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===c?_=e[17]:(_=e=>c(e.target.checked),e[16]=c,e[17]=_);let v;e[18]!==o||e[19]!==_?(v=(0,d.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:o,onChange:_}),e[18]=o,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,d.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==p||e[25]!==y?(b=(0,d.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[p,y]}),e[24]=p,e[25]=y,e[26]=b):b=e[26],b}function S(e){return e.setShowRawToolData}function C(e){return e.showRawToolData}function w(e){return e.language}function T(){let e=(0,u.c)(33),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,s;e[2]===a.pageTitle?s=e[3]:(s=(0,d.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight text-fg`,children:a.pageTitle}),e[2]=a.pageTitle,e[3]=s);let c;e[4]===a.subtitle?c=e[5]:(c=(0,d.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.subtitle}),e[4]=a.subtitle,e[5]=c);let p;e[6]!==s||e[7]!==c?(p=(0,d.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[s,c]}),e[6]=s,e[7]=c,e[8]=p):p=e[8];let m;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=f(),e[9]=m):m=e[9];let h;e[10]===a.languageTitle?h=e[11]:(h=(0,d.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:a.languageTitle}),e[10]=a.languageTitle,e[11]=h);let g;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,d.jsx)(o,{variant:`page`,sections:[`language`]}),e[12]=g):g=e[12];let v;e[13]===h?v=e[14]:(v=(0,d.jsxs)(`section`,{className:m,"aria-labelledby":`pref-language-heading`,children:[h,g]}),e[13]=h,e[14]=v);let y;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=f(),e[15]=y):y=e[15];let b;e[16]===a.themeTitle?b=e[17]:(b=(0,d.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:a.themeTitle}),e[16]=a.themeTitle,e[17]=b);let S,C;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,d.jsx)(o,{variant:`page`,sections:[`theme`,`font`]}),C=(0,d.jsx)(_,{}),e[18]=S,e[19]=C):(S=e[18],C=e[19]);let w;e[20]===b?w=e[21]:(w=(0,d.jsxs)(`section`,{className:y,"aria-labelledby":`pref-appearance-heading`,children:[b,S,C]}),e[20]=b,e[21]=w);let T;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(T=f(),e[22]=T):T=e[22];let D;e[23]===a.developerGroupTitle?D=e[24]:(D=(0,d.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:a.developerGroupTitle}),e[23]=a.developerGroupTitle,e[24]=D);let O;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,d.jsx)(x,{}),e[25]=O):O=e[25];let k;e[26]===D?k=e[27]:(k=(0,d.jsx)(l,{children:(0,d.jsxs)(`section`,{className:T,"aria-labelledby":`pref-developer-heading`,children:[D,O]})}),e[26]=D,e[27]=k);let A;return e[28]!==w||e[29]!==k||e[30]!==p||e[31]!==v?(A=(0,d.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6`,children:[p,v,w,k]}),e[28]=w,e[29]=k,e[30]=p,e[31]=v,e[32]=A):A=e[32],A}function E(e){return e.language}export{T as AppearanceSettingsPanel};
@@ -1 +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-JdwAhgNB.js";import{t as a}from"./messages-Csef1aW7.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{c as s,i as c,n as l,t as u}from"./fetch-Bs7in_4F.js";import{a as d,i as f}from"./vendor-swr-BIWyz7Rc.js";import{$r as p,Ar as m,B as h,Dr as g,Ds as _,Ea as v,Er as y,Hi as b,Jr as x,Nt as S,Or as C,Pa as w,Qo as T,Qr as E,Ss as D,Xr as O,Yr as k,Zr as A,gs as j,ii as M,is as N,ji as P,ki as F,ko as I,kr as L,la as R,pa as z,qa as B,zn as ee}from"./index-COkF54xv.js";var V=e(t(),1),H=n();function U(e){return e===`builtin`||e===`user`?e:`marketplace`}async function W(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function te(e){let t=await u(c(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await W(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function G(e){let t=await u(c(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await W(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function K(e){let t=await u(c(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await W(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function q(e){let t=await u(c(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await W(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var J=r();function Y(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var X={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function ne({className:e}){let t=a(o(e=>e.language)).appsPage,n=s(e=>!!e.token),r=g(),{mutate:u}=d(),[p,m]=(0,V.useReducer)(h,X),{q:_,debounced:v,detailPkg:y,rowBusy:x,actionError:C,restartHint:E}=p,D=n?`marketplace-${v}`:null;(0,V.useEffect)(()=>{let e=window.setTimeout(()=>m({type:`patch`,patch:{debounced:_.trim()}}),300);return()=>window.clearTimeout(e)},[_]);let{data:O,isLoading:k,error:A}=f(D,async()=>l(v.length>0?c(`/api/marketplace?q=${encodeURIComponent(v)}`):c(`/api/marketplace`)),{revalidateOnFocus:!1}),j=(0,V.useCallback)(()=>{u(`gateway-extensions-list`),S()},[u]),M=(0,V.useCallback)(async(e,n)=>{m({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await G({name:e,overwrite:n});j(),r.requiresGatewayRestart&&m({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw m({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{m({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,j]),N=(0,V.useCallback)(async e=>{m({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await q(e);j(),n.requiresGatewayRestart&&m({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw m({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{m({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,j]),P=O?.extensions??[];return(0,J.jsxs)(`div`,{className:i(`flex flex-col gap-4`,e),children:[(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(z,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,value:_,onChange:e=>m({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),A?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:A instanceof Error?A.message:t.marketplaceLoadFailed}):null,C?(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:C}):null,E?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:E}):null,k&&!O?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):(0,J.jsx)(`ul`,{className:`flex flex-col gap-3`,children:P.length===0?(0,J.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):P.map(e=>{let n=Y(r,e.id),a=x===e.id;return(0,J.jsx)(`li`,{className:`list-none`,children:(0,J.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>m({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),m({type:`patch`,patch:{detailPkg:e.id}}))},className:i(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl border border-edge bg-surface-base p-4 text-left shadow-surface`,`transition-[transform,background-color,border-color,box-shadow] duration-150 ease-out`,`hover:border-edge-subtle hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,J.jsx)(T,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,J.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,J.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,J.jsx)(w,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,J.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,J.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,J.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&N(e.id).catch(()=>{})},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,J.jsx)(B,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(b,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,J.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{M(e.id,!1).catch(()=>{})},className:i(`inline-flex w-full items-center justify-center rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white`,`shadow-surface transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,J.jsx)(B,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t.marketplaceInstall]})})]})},e.id)})}),y?(0,J.jsx)(re,{packageName:y,copy:t,extensions:r,onClose:()=>m({type:`patch`,patch:{detailPkg:null}}),onInstall:M,onUninstall:N}):null]})}function re(e){let t=(0,H.c)(61),{packageName:n,copy:r,extensions:a,onClose:o,onInstall:c,onUninstall:l}=e,[u,d]=(0,V.useState)(!1),m=s(se)?`ext-mp-detail-${n}`:null,h;t[0]===n?h=t[1]:(h=async()=>te(n),t[0]=n,t[1]=h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[2]=g):g=t[2];let{data:_,error:v,isLoading:y}=f(m,h,g),S;t[3]!==a||t[4]!==n?(S=Y(a,n),t[3]=a,t[4]=n,t[5]=S):S=t[5];let C=S,w=C===`user`,T;t[6]!==r.marketplaceNoReadme||t[7]!==_?(T=_?.readme?.trim()||(_?.description?.trim()?`### ${_.name}\n\n${_.description}`:`*${r.marketplaceNoReadme}*`),t[6]=r.marketplaceNoReadme,t[7]=_,t[8]=T):T=t[8];let k=T,M;t[9]===o?M=t[10]:(M=e=>!e&&o(),t[9]=o,t[10]=M);let N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,J.jsx)(O,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[11]=N):N=t[11];let F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,J.jsx)(j,{className:`size-5`}),t[12]=F):F=t[12];let I;t[13]!==r.detailBack||t[14]!==o?(I=(0,J.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 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`,"aria-label":r.detailBack,children:F}),t[13]=r.detailBack,t[14]=o,t[15]=I):I=t[15];let L;t[16]===r.marketplaceDetailTitle?L=t[17]:(L=(0,J.jsx)(p,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[16]=r.marketplaceDetailTitle,t[17]=L);let R;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,J.jsx)(P,{className:`size-5`}),t[18]=R):R=t[18];let z;t[19]!==r.detailClose||t[20]!==o?(z=(0,J.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 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`,"aria-label":r.detailClose,children:R}),t[19]=r.detailClose,t[20]=o,t[21]=z):z=t[21];let U;t[22]!==z||t[23]!==I||t[24]!==L?(U=(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[I,L,z]}),t[22]=z,t[23]=I,t[24]=L,t[25]=U):U=t[25];let W;t[26]!==r.marketplaceAuthor||t[27]!==r.marketplaceDetailLoadFailed||t[28]!==r.marketplaceDetailReadmeHeading||t[29]!==r.marketplaceDownloads||t[30]!==r.marketplaceVersion||t[31]!==_||t[32]!==v||t[33]!==y||t[34]!==k?(W=y&&!_?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):v?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.marketplaceDetailLoadFailed}):_?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:_.name}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,J.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:_.id})}),(0,J.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,J.jsx)(`dd`,{children:_.author.username})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,J.jsx)(`dd`,{children:_.latestVersion.version})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,J.jsx)(`dd`,{children:_.downloads})]})]}),_.readme?.trim()?(0,J.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,J.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,J.jsx)(ee,{content:k})})]}):null,t[26]=r.marketplaceAuthor,t[27]=r.marketplaceDetailLoadFailed,t[28]=r.marketplaceDetailReadmeHeading,t[29]=r.marketplaceDownloads,t[30]=r.marketplaceVersion,t[31]=_,t[32]=v,t[33]=y,t[34]=k,t[35]=W):W=t[35];let G;t[36]===W?G=t[37]:(G=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:W}),t[36]=W,t[37]=G);let K;t[38]!==u||t[39]!==r.marketplaceBuiltinGoBuiltin||t[40]!==r.marketplaceBuiltinManageHint||t[41]!==r.marketplaceInstall||t[42]!==r.marketplaceReinstall||t[43]!==r.marketplaceReinstallConfirm||t[44]!==r.marketplaceUninstall||t[45]!==r.marketplaceUninstallConfirm||t[46]!==_||t[47]!==C||t[48]!==o||t[49]!==c||t[50]!==l||t[51]!==n||t[52]!==w?(K=_?(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:C===`bundled`?(0,J.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,J.jsx)(D,{to:`/apps?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{w&&!window.confirm(r.marketplaceReinstallConfirm)||(d(!0),c(n,w).catch(ae).finally(()=>d(!1)))},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[u?(0,J.jsx)(B,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,w?r.marketplaceReinstall:r.marketplaceInstall]}),w?(0,J.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(d(!0),l(n).then(()=>o()).catch(ie).finally(()=>d(!1)))},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,J.jsx)(b,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[38]=u,t[39]=r.marketplaceBuiltinGoBuiltin,t[40]=r.marketplaceBuiltinManageHint,t[41]=r.marketplaceInstall,t[42]=r.marketplaceReinstall,t[43]=r.marketplaceReinstallConfirm,t[44]=r.marketplaceUninstall,t[45]=r.marketplaceUninstallConfirm,t[46]=_,t[47]=C,t[48]=o,t[49]=c,t[50]=l,t[51]=n,t[52]=w,t[53]=K):K=t[53];let q;t[54]!==U||t[55]!==G||t[56]!==K?(q=(0,J.jsxs)(A,{children:[N,(0,J.jsxs)(x,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:oe,children:[U,G,K]})]}),t[54]=U,t[55]=G,t[56]=K,t[57]=q):q=t[57];let X;return t[58]!==q||t[59]!==M?(X=(0,J.jsx)(E,{defaultOpen:!0,onOpenChange:M,children:q}),t[58]=q,t[59]=M,t[60]=X):X=t[60],X}function ie(){}function ae(){}function oe(e){return e.preventDefault()}function se(e){return!!e.token}function ce(){let e=o(e=>e.language),t=a(e),n=M(e=>e.setPageHeader),r=M(e=>e.clearPageHeader),s=g(),c=C(),[l,u]=_(),d=U(l.get(`tab`)),f=l.get(`q`)??``,[p,m]=(0,V.useState)(d),[h,v]=(0,V.useState)(f),[y,b]=(0,V.useState)(null),x=l.toString(),S=(0,V.useRef)(x);if(S.current!==x){S.current=x;let e=U(l.get(`tab`)),t=l.get(`q`)??``;m(t=>t===e?t:e),v(e=>e===t?e:t)}(0,V.useEffect)(()=>{u(e=>{let t=new URLSearchParams(e),n=h.trim();return n?t.set(`q`,n):t.delete(`q`),p===`marketplace`?t.delete(`tab`):t.set(`tab`,p),t.toString()===e.toString()?e:t},{replace:!0})},[p,h,u]);let w=(0,V.useMemo)(()=>s.filter(e=>e.source===`bundled`),[s]),T=(0,V.useMemo)(()=>s.filter(e=>e.source!==`bundled`),[s]),E=p===`builtin`?w:T,D=(0,V.useMemo)(()=>{let t=h.trim().toLowerCase(),n=E;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[E,h,e]);if((0,V.useEffect)(()=>{b(e=>{if(!e)return e;let t=s.find(t=>t.id===e.id);return t?Z(e)===Z(t)&&e.active===t.active?e:t:null})},[s]),(0,V.useLayoutEffect)(()=>(n({startExtra:null,main:(0,J.jsx)(`div`,{className:`min-w-0`,children:(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.appsPage.title})}),end:null}),()=>r()),[r,t.appsPage.title,n]),c&&p!==`marketplace`)return(0,J.jsx)(pe,{});let O=p!==`marketplace`&&E.length>0;return(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,J.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[(0,J.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-x-1 gap-y-1`,role:`tablist`,"aria-label":t.appsPage.appsNavAria,children:[(0,J.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`marketplace`,className:i(`relative max-w-full rounded-md px-3 py-2 text-left text-sm font-medium transition-colors sm:text-center`,p===`marketplace`?`text-fg`:`text-fg-muted hover:text-fg`,p===`marketplace`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`marketplace`),children:t.appsPage.tabMarketplace}),(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`builtin`,className:i(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,p===`builtin`?`text-fg`:`text-fg-muted hover:text-fg`,p===`builtin`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`builtin`),children:[t.appsPage.tabBuiltin,(0,J.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,w.length,`)`]})]}),(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`user`,className:i(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,p===`user`?`text-fg`:`text-fg-muted hover:text-fg`,p===`user`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`user`),children:[t.appsPage.tabUser,(0,J.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,T.length,`)`]})]})]}),O?(0,J.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,J.jsx)(z,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,value:h,onChange:e=>v(e.target.value),placeholder:t.appsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),p===`marketplace`?(0,J.jsx)(ne,{}):p===`builtin`&&w.length===0?(0,J.jsx)(he,{message:t.appsPage.emptyBuiltin}):p===`user`&&T.length===0?(0,J.jsx)(he,{message:t.appsPage.emptyUser}):D.length===0?(0,J.jsx)(`p`,{className:`rounded-xl border border-dashed border-edge-subtle bg-surface-hover/30 px-4 py-8 text-center text-sm text-fg-muted dark:bg-surface-hover/15`,children:t.appsPage.noSearchResults}):(0,J.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:D.map(e=>(0,J.jsx)(de,{extension:e,copy:t.appsPage,showSourceBadge:p===`user`,onOpen:()=>b(e)},e.id))})]}),y?(0,J.jsx)(fe,{extension:y,copy:t.appsPage,onClose:()=>b(null)},y.id):null]})}function Z(e){return e.activationEligible??e.active}function Q(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function le(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function ue(e,t){let n=Z(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function de(e){let t=(0,H.c)(45),{extension:n,copy:r,showSourceBadge:a,onOpen:o}=e,s;t[0]===n?s=t[1]:(s=Z(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=i(`group flex w-full flex-col rounded-xl border border-edge bg-surface-base p-4 text-left shadow-sm transition-colors`,`hover:border-edge-subtle hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=u):u=t[2];let d=n.name||n.id,f;t[3]===d?f=t[4]:(f=d.charAt(0).toUpperCase(),t[3]=d,t[4]=f);let p;t[5]===f?p=t[6]:(p=(0,J.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:f}),t[5]=f,t[6]=p);let m;t[7]===n.name?m=t[8]:(m=(0,J.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=m);let h;t[9]===n.version?h=t[10]:(h=n.version?(0,J.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=h);let g;t[11]!==m||t[12]!==h?(g=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==r.statusEnabled||t[15]!==c?(_=c?(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,J.jsx)(N,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,J.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,J.jsx)(v,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=_):_=t[16];let y;t[17]!==g||t[18]!==_?(y=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[g,_]}),t[17]=g,t[18]=_,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,J.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==l?(C=(0,J.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=l,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==n||t[30]!==a?(w=n.source===`bundled`?(0,J.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):a?(0,J.jsx)(`span`,{title:Q(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:le(n,r)}):null,t[28]=r,t[29]=n,t[30]=a,t[31]=w):w=t[31];let T;t[32]!==C||t[33]!==w?(T=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,w]}),t[32]=C,t[33]=w,t[34]=T):T=t[34];let E;t[35]!==y||t[36]!==x||t[37]!==T?(E=(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,T]}),t[35]=y,t[36]=x,t[37]=T,t[38]=E):E=t[38];let D;t[39]!==E||t[40]!==p?(D=(0,J.jsxs)(`div`,{className:`flex gap-3`,children:[p,E]}),t[39]=E,t[40]=p,t[41]=D):D=t[41];let O;return t[42]!==o||t[43]!==D?(O=(0,J.jsx)(`button`,{type:`button`,onClick:o,className:u,children:D}),t[42]=o,t[43]=D,t[44]=O):O=t[44],O}function fe({extension:e,copy:t,onClose:n}){let{mutate:r}=d(),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(!1),f=e.activationEligible===!0,h=(0,V.useCallback)(async()=>{if(e.source===`bundled`){c(null),u(!1),o(!0);try{let{requiresGatewayRestart:t}=await K({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),S(),u(t)}catch(e){c(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),g=e.ui?.contributions?.pages??[],_=e.ui?.contributions?.settingsPanels??[],v=e.ui?.contributions?.chatWidgets??[],b=e.ui?.contributions?.sidebarPanels??[],C=g.find(e=>e.showInNav)??g[0],w=_[0],T=C?y(e.id,C):null,M=w?`/settings/ext/${e.id}/${w.id}`:e.hasConfigSchema||L(e)?`/settings/ext/${e.id}`:null;return(0,J.jsx)(E,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,J.jsxs)(A,{children:[(0,J.jsx)(O,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,J.jsxs)(x,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 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`,"aria-label":t.detailBack,children:(0,J.jsx)(j,{className:`size-5`})}),(0,J.jsx)(p,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,J.jsxs)(k,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,J.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 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`,"aria-label":t.detailClose,children:(0,J.jsx)(P,{className:`size-5`})})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,J.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,J.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,Q(e,t)]}),e.version?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,J.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,J.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:ue(e,t)}),e.source===`bundled`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`mt-4 rounded-lg border border-edge-subtle bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,J.jsxs)(`div`,{className:`mt-3 rounded-lg border border-edge-subtle bg-surface-hover/40 p-3 dark:bg-surface-hover/20`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,J.jsx)(F,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void h(),className:`shrink-0 py-1.5 text-xs`,children:a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(B,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,l?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,J.jsx)(`p`,{className:`mt-4 rounded-lg border border-edge-subtle bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(g.length>0||_.length>0||v.length>0)?(0,J.jsxs)(`section`,{className:`mt-8`,children:[(0,J.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,J.jsx)($,{template:t.badgePages,count:g.length,hidden:g.length===0}),(0,J.jsx)($,{template:t.badgeSettings,count:_.length,hidden:_.length===0}),(0,J.jsx)($,{template:t.badgeWidgets,count:v.length,hidden:v.length===0}),(0,J.jsx)($,{template:t.badgeSidebar,count:b.length,hidden:b.length===0})]})]}):null,m(e)&&(T||M)?(0,J.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[T?(0,J.jsxs)(D,{to:T,onClick:n,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,J.jsx)(I,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,M?(0,J.jsxs)(D,{to:M,onClick:n,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,J.jsx)(R,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,J.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function $(e){let t=(0,H.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,J.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function pe(){let e=(0,H.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,J.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,J.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,J.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,J.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[t,n,r,(0,J.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(me)})]})}),e[4]=a):a=e[4],a}function me(e){return(0,J.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge bg-surface-base`},e)}function he(e){let t=(0,H.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,J.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-dashed border-edge-subtle bg-surface-hover/40 px-4 py-12 text-center dark:bg-surface-hover/20`,children:(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{ce as AppsPage};
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-JdwAhgNB.js";import{t as a}from"./messages-CkT-lcgP.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{c as s,i as c,n as l,t as u}from"./fetch-NZmjSXLl.js";import{a as d,i as f}from"./vendor-swr-BIWyz7Rc.js";import{$r as p,Ar as m,B as h,Dr as g,Ds as _,Ea as v,Er as y,Hi as b,Jr as x,Nt as S,Or as C,Pa as w,Qo as T,Qr as E,Ss as D,Xr as O,Yr as k,Zr as A,gs as j,ii as M,is as N,ji as P,ki as F,ko as I,kr as L,la as R,pa as z,qa as B,zn as ee}from"./index-Cxm6xsps.js";var V=e(t(),1),H=n();function U(e){return e===`builtin`||e===`user`?e:`marketplace`}async function W(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function te(e){let t=await u(c(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await W(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function G(e){let t=await u(c(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await W(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function K(e){let t=await u(c(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await W(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function q(e){let t=await u(c(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await W(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var J=r();function Y(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var X={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function ne({className:e}){let t=a(o(e=>e.language)).appsPage,n=s(e=>!!e.token),r=g(),{mutate:u}=d(),[p,m]=(0,V.useReducer)(h,X),{q:_,debounced:v,detailPkg:y,rowBusy:x,actionError:C,restartHint:E}=p,D=n?`marketplace-${v}`:null;(0,V.useEffect)(()=>{let e=window.setTimeout(()=>m({type:`patch`,patch:{debounced:_.trim()}}),300);return()=>window.clearTimeout(e)},[_]);let{data:O,isLoading:k,error:A}=f(D,async()=>l(v.length>0?c(`/api/marketplace?q=${encodeURIComponent(v)}`):c(`/api/marketplace`)),{revalidateOnFocus:!1}),j=(0,V.useCallback)(()=>{u(`gateway-extensions-list`),S()},[u]),M=(0,V.useCallback)(async(e,n)=>{m({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await G({name:e,overwrite:n});j(),r.requiresGatewayRestart&&m({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw m({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{m({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,j]),N=(0,V.useCallback)(async e=>{m({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await q(e);j(),n.requiresGatewayRestart&&m({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw m({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{m({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,j]),P=O?.extensions??[];return(0,J.jsxs)(`div`,{className:i(`flex flex-col gap-4`,e),children:[(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(z,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,value:_,onChange:e=>m({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),A?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:A instanceof Error?A.message:t.marketplaceLoadFailed}):null,C?(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:C}):null,E?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:E}):null,k&&!O?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):(0,J.jsx)(`ul`,{className:`flex flex-col gap-3`,children:P.length===0?(0,J.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):P.map(e=>{let n=Y(r,e.id),a=x===e.id;return(0,J.jsx)(`li`,{className:`list-none`,children:(0,J.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>m({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),m({type:`patch`,patch:{detailPkg:e.id}}))},className:i(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl border border-edge bg-surface-base p-4 text-left shadow-surface`,`transition-[transform,background-color,border-color,box-shadow] duration-150 ease-out`,`hover:border-edge-subtle hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,J.jsx)(T,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,J.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,J.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,J.jsx)(w,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,J.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,J.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,J.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&N(e.id).catch(()=>{})},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,J.jsx)(B,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(b,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,J.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{M(e.id,!1).catch(()=>{})},className:i(`inline-flex w-full items-center justify-center rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white`,`shadow-surface transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,J.jsx)(B,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t.marketplaceInstall]})})]})},e.id)})}),y?(0,J.jsx)(re,{packageName:y,copy:t,extensions:r,onClose:()=>m({type:`patch`,patch:{detailPkg:null}}),onInstall:M,onUninstall:N}):null]})}function re(e){let t=(0,H.c)(61),{packageName:n,copy:r,extensions:a,onClose:o,onInstall:c,onUninstall:l}=e,[u,d]=(0,V.useState)(!1),m=s(se)?`ext-mp-detail-${n}`:null,h;t[0]===n?h=t[1]:(h=async()=>te(n),t[0]=n,t[1]=h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[2]=g):g=t[2];let{data:_,error:v,isLoading:y}=f(m,h,g),S;t[3]!==a||t[4]!==n?(S=Y(a,n),t[3]=a,t[4]=n,t[5]=S):S=t[5];let C=S,w=C===`user`,T;t[6]!==r.marketplaceNoReadme||t[7]!==_?(T=_?.readme?.trim()||(_?.description?.trim()?`### ${_.name}\n\n${_.description}`:`*${r.marketplaceNoReadme}*`),t[6]=r.marketplaceNoReadme,t[7]=_,t[8]=T):T=t[8];let k=T,M;t[9]===o?M=t[10]:(M=e=>!e&&o(),t[9]=o,t[10]=M);let N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,J.jsx)(O,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[11]=N):N=t[11];let F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,J.jsx)(j,{className:`size-5`}),t[12]=F):F=t[12];let I;t[13]!==r.detailBack||t[14]!==o?(I=(0,J.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 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`,"aria-label":r.detailBack,children:F}),t[13]=r.detailBack,t[14]=o,t[15]=I):I=t[15];let L;t[16]===r.marketplaceDetailTitle?L=t[17]:(L=(0,J.jsx)(p,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[16]=r.marketplaceDetailTitle,t[17]=L);let R;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,J.jsx)(P,{className:`size-5`}),t[18]=R):R=t[18];let z;t[19]!==r.detailClose||t[20]!==o?(z=(0,J.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 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`,"aria-label":r.detailClose,children:R}),t[19]=r.detailClose,t[20]=o,t[21]=z):z=t[21];let U;t[22]!==z||t[23]!==I||t[24]!==L?(U=(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[I,L,z]}),t[22]=z,t[23]=I,t[24]=L,t[25]=U):U=t[25];let W;t[26]!==r.marketplaceAuthor||t[27]!==r.marketplaceDetailLoadFailed||t[28]!==r.marketplaceDetailReadmeHeading||t[29]!==r.marketplaceDownloads||t[30]!==r.marketplaceVersion||t[31]!==_||t[32]!==v||t[33]!==y||t[34]!==k?(W=y&&!_?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):v?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.marketplaceDetailLoadFailed}):_?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:_.name}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,J.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:_.id})}),(0,J.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,J.jsx)(`dd`,{children:_.author.username})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,J.jsx)(`dd`,{children:_.latestVersion.version})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,J.jsx)(`dd`,{children:_.downloads})]})]}),_.readme?.trim()?(0,J.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,J.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,J.jsx)(ee,{content:k})})]}):null,t[26]=r.marketplaceAuthor,t[27]=r.marketplaceDetailLoadFailed,t[28]=r.marketplaceDetailReadmeHeading,t[29]=r.marketplaceDownloads,t[30]=r.marketplaceVersion,t[31]=_,t[32]=v,t[33]=y,t[34]=k,t[35]=W):W=t[35];let G;t[36]===W?G=t[37]:(G=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:W}),t[36]=W,t[37]=G);let K;t[38]!==u||t[39]!==r.marketplaceBuiltinGoBuiltin||t[40]!==r.marketplaceBuiltinManageHint||t[41]!==r.marketplaceInstall||t[42]!==r.marketplaceReinstall||t[43]!==r.marketplaceReinstallConfirm||t[44]!==r.marketplaceUninstall||t[45]!==r.marketplaceUninstallConfirm||t[46]!==_||t[47]!==C||t[48]!==o||t[49]!==c||t[50]!==l||t[51]!==n||t[52]!==w?(K=_?(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:C===`bundled`?(0,J.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,J.jsx)(D,{to:`/apps?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{w&&!window.confirm(r.marketplaceReinstallConfirm)||(d(!0),c(n,w).catch(ae).finally(()=>d(!1)))},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[u?(0,J.jsx)(B,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,w?r.marketplaceReinstall:r.marketplaceInstall]}),w?(0,J.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(d(!0),l(n).then(()=>o()).catch(ie).finally(()=>d(!1)))},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,J.jsx)(b,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[38]=u,t[39]=r.marketplaceBuiltinGoBuiltin,t[40]=r.marketplaceBuiltinManageHint,t[41]=r.marketplaceInstall,t[42]=r.marketplaceReinstall,t[43]=r.marketplaceReinstallConfirm,t[44]=r.marketplaceUninstall,t[45]=r.marketplaceUninstallConfirm,t[46]=_,t[47]=C,t[48]=o,t[49]=c,t[50]=l,t[51]=n,t[52]=w,t[53]=K):K=t[53];let q;t[54]!==U||t[55]!==G||t[56]!==K?(q=(0,J.jsxs)(A,{children:[N,(0,J.jsxs)(x,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:oe,children:[U,G,K]})]}),t[54]=U,t[55]=G,t[56]=K,t[57]=q):q=t[57];let X;return t[58]!==q||t[59]!==M?(X=(0,J.jsx)(E,{defaultOpen:!0,onOpenChange:M,children:q}),t[58]=q,t[59]=M,t[60]=X):X=t[60],X}function ie(){}function ae(){}function oe(e){return e.preventDefault()}function se(e){return!!e.token}function ce(){let e=o(e=>e.language),t=a(e),n=M(e=>e.setPageHeader),r=M(e=>e.clearPageHeader),s=g(),c=C(),[l,u]=_(),d=U(l.get(`tab`)),f=l.get(`q`)??``,[p,m]=(0,V.useState)(d),[h,v]=(0,V.useState)(f),[y,b]=(0,V.useState)(null),x=l.toString(),S=(0,V.useRef)(x);if(S.current!==x){S.current=x;let e=U(l.get(`tab`)),t=l.get(`q`)??``;m(t=>t===e?t:e),v(e=>e===t?e:t)}(0,V.useEffect)(()=>{u(e=>{let t=new URLSearchParams(e),n=h.trim();return n?t.set(`q`,n):t.delete(`q`),p===`marketplace`?t.delete(`tab`):t.set(`tab`,p),t.toString()===e.toString()?e:t},{replace:!0})},[p,h,u]);let w=(0,V.useMemo)(()=>s.filter(e=>e.source===`bundled`),[s]),T=(0,V.useMemo)(()=>s.filter(e=>e.source!==`bundled`),[s]),E=p===`builtin`?w:T,D=(0,V.useMemo)(()=>{let t=h.trim().toLowerCase(),n=E;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[E,h,e]);if((0,V.useEffect)(()=>{b(e=>{if(!e)return e;let t=s.find(t=>t.id===e.id);return t?Z(e)===Z(t)&&e.active===t.active?e:t:null})},[s]),(0,V.useLayoutEffect)(()=>(n({startExtra:null,main:(0,J.jsx)(`div`,{className:`min-w-0`,children:(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.appsPage.title})}),end:null}),()=>r()),[r,t.appsPage.title,n]),c&&p!==`marketplace`)return(0,J.jsx)(pe,{});let O=p!==`marketplace`&&E.length>0;return(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,J.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[(0,J.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-x-1 gap-y-1`,role:`tablist`,"aria-label":t.appsPage.appsNavAria,children:[(0,J.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`marketplace`,className:i(`relative max-w-full rounded-md px-3 py-2 text-left text-sm font-medium transition-colors sm:text-center`,p===`marketplace`?`text-fg`:`text-fg-muted hover:text-fg`,p===`marketplace`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`marketplace`),children:t.appsPage.tabMarketplace}),(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`builtin`,className:i(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,p===`builtin`?`text-fg`:`text-fg-muted hover:text-fg`,p===`builtin`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`builtin`),children:[t.appsPage.tabBuiltin,(0,J.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,w.length,`)`]})]}),(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`user`,className:i(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,p===`user`?`text-fg`:`text-fg-muted hover:text-fg`,p===`user`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`user`),children:[t.appsPage.tabUser,(0,J.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,T.length,`)`]})]})]}),O?(0,J.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,J.jsx)(z,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,value:h,onChange:e=>v(e.target.value),placeholder:t.appsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),p===`marketplace`?(0,J.jsx)(ne,{}):p===`builtin`&&w.length===0?(0,J.jsx)(he,{message:t.appsPage.emptyBuiltin}):p===`user`&&T.length===0?(0,J.jsx)(he,{message:t.appsPage.emptyUser}):D.length===0?(0,J.jsx)(`p`,{className:`rounded-xl border border-dashed border-edge-subtle bg-surface-hover/30 px-4 py-8 text-center text-sm text-fg-muted dark:bg-surface-hover/15`,children:t.appsPage.noSearchResults}):(0,J.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:D.map(e=>(0,J.jsx)(de,{extension:e,copy:t.appsPage,showSourceBadge:p===`user`,onOpen:()=>b(e)},e.id))})]}),y?(0,J.jsx)(fe,{extension:y,copy:t.appsPage,onClose:()=>b(null)},y.id):null]})}function Z(e){return e.activationEligible??e.active}function Q(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function le(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function ue(e,t){let n=Z(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function de(e){let t=(0,H.c)(45),{extension:n,copy:r,showSourceBadge:a,onOpen:o}=e,s;t[0]===n?s=t[1]:(s=Z(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=i(`group flex w-full flex-col rounded-xl border border-edge bg-surface-base p-4 text-left shadow-sm transition-colors`,`hover:border-edge-subtle hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=u):u=t[2];let d=n.name||n.id,f;t[3]===d?f=t[4]:(f=d.charAt(0).toUpperCase(),t[3]=d,t[4]=f);let p;t[5]===f?p=t[6]:(p=(0,J.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:f}),t[5]=f,t[6]=p);let m;t[7]===n.name?m=t[8]:(m=(0,J.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=m);let h;t[9]===n.version?h=t[10]:(h=n.version?(0,J.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=h);let g;t[11]!==m||t[12]!==h?(g=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==r.statusEnabled||t[15]!==c?(_=c?(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,J.jsx)(N,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,J.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,J.jsx)(v,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=_):_=t[16];let y;t[17]!==g||t[18]!==_?(y=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[g,_]}),t[17]=g,t[18]=_,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,J.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==l?(C=(0,J.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=l,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==n||t[30]!==a?(w=n.source===`bundled`?(0,J.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):a?(0,J.jsx)(`span`,{title:Q(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:le(n,r)}):null,t[28]=r,t[29]=n,t[30]=a,t[31]=w):w=t[31];let T;t[32]!==C||t[33]!==w?(T=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,w]}),t[32]=C,t[33]=w,t[34]=T):T=t[34];let E;t[35]!==y||t[36]!==x||t[37]!==T?(E=(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,T]}),t[35]=y,t[36]=x,t[37]=T,t[38]=E):E=t[38];let D;t[39]!==E||t[40]!==p?(D=(0,J.jsxs)(`div`,{className:`flex gap-3`,children:[p,E]}),t[39]=E,t[40]=p,t[41]=D):D=t[41];let O;return t[42]!==o||t[43]!==D?(O=(0,J.jsx)(`button`,{type:`button`,onClick:o,className:u,children:D}),t[42]=o,t[43]=D,t[44]=O):O=t[44],O}function fe({extension:e,copy:t,onClose:n}){let{mutate:r}=d(),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(!1),f=e.activationEligible===!0,h=(0,V.useCallback)(async()=>{if(e.source===`bundled`){c(null),u(!1),o(!0);try{let{requiresGatewayRestart:t}=await K({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),S(),u(t)}catch(e){c(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),g=e.ui?.contributions?.pages??[],_=e.ui?.contributions?.settingsPanels??[],v=e.ui?.contributions?.chatWidgets??[],b=e.ui?.contributions?.sidebarPanels??[],C=g.find(e=>e.showInNav)??g[0],w=_[0],T=C?y(e.id,C):null,M=w?`/settings/ext/${e.id}/${w.id}`:e.hasConfigSchema||L(e)?`/settings/ext/${e.id}`:null;return(0,J.jsx)(E,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,J.jsxs)(A,{children:[(0,J.jsx)(O,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,J.jsxs)(x,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 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`,"aria-label":t.detailBack,children:(0,J.jsx)(j,{className:`size-5`})}),(0,J.jsx)(p,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,J.jsxs)(k,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,J.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 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`,"aria-label":t.detailClose,children:(0,J.jsx)(P,{className:`size-5`})})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,J.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,J.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,Q(e,t)]}),e.version?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,J.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,J.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:ue(e,t)}),e.source===`bundled`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`mt-4 rounded-lg border border-edge-subtle bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,J.jsxs)(`div`,{className:`mt-3 rounded-lg border border-edge-subtle bg-surface-hover/40 p-3 dark:bg-surface-hover/20`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,J.jsx)(F,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void h(),className:`shrink-0 py-1.5 text-xs`,children:a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(B,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,l?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,J.jsx)(`p`,{className:`mt-4 rounded-lg border border-edge-subtle bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(g.length>0||_.length>0||v.length>0)?(0,J.jsxs)(`section`,{className:`mt-8`,children:[(0,J.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,J.jsx)($,{template:t.badgePages,count:g.length,hidden:g.length===0}),(0,J.jsx)($,{template:t.badgeSettings,count:_.length,hidden:_.length===0}),(0,J.jsx)($,{template:t.badgeWidgets,count:v.length,hidden:v.length===0}),(0,J.jsx)($,{template:t.badgeSidebar,count:b.length,hidden:b.length===0})]})]}):null,m(e)&&(T||M)?(0,J.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[T?(0,J.jsxs)(D,{to:T,onClick:n,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,J.jsx)(I,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,M?(0,J.jsxs)(D,{to:M,onClick:n,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,J.jsx)(R,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,J.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function $(e){let t=(0,H.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,J.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function pe(){let e=(0,H.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,J.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,J.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,J.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,J.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[t,n,r,(0,J.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(me)})]})}),e[4]=a):a=e[4],a}function me(e){return(0,J.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge bg-surface-base`},e)}function he(e){let t=(0,H.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,J.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-dashed border-edge-subtle bg-surface-hover/40 px-4 py-12 text-center dark:bg-surface-hover/20`,children:(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{ce as AppsPage};