@xopcai/xopc 0.0.362 → 0.0.364

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-_2aJ4ozN.js → activity-store-GvR2gZ0T.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CSIn4ghK.js → agent-avatar-dicebear-7Ct-ZlfL.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DBNFaHYa.js → agent-defaults-settings-panel-wYj-iyqv.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-plugin-dialog-DJkGbMVg.js → agent-plugin-dialog-C9HYMhnJ.js} +1 -1
  7. package/dist/gateway/static/root/assets/{agents-admin-api-Dl0V7UQq.js → agents-admin-api-BkXb7VEZ.js} +1 -1
  8. package/dist/gateway/static/root/assets/{agents-CuQayYYr.js → agents-hPkFQ81z.js} +3 -3
  9. package/dist/gateway/static/root/assets/{app-management-settings-panel-CSczq9QV.js → app-management-settings-panel-CjfsIn9A.js} +1 -1
  10. package/dist/gateway/static/root/assets/{appearance-settings-W0vc1J1Q.js → appearance-settings-qqHZ15GU.js} +1 -1
  11. package/dist/gateway/static/root/assets/{apps-page-esnvb3hh.js → apps-page-Ba2VkQk6.js} +1 -1
  12. package/dist/gateway/static/root/assets/{archive-plugin-CBR91gHK.js → archive-plugin-CKe3qAaL.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-B9RdzKUS.js → automations-page-Bt8Q58ut.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automations-workspace-U9TEZd_t.js → automations-workspace-Ch0ViAJW.js} +1 -1
  15. package/dist/gateway/static/root/assets/{binary-plugins-C9KIjPph.js → binary-plugins-J51oS7-D.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-C0bammwh.js → block-editor-ClRFbHP7.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-automation-inputs-D2E0co_S.js → browser-automation-inputs-5B3qAdmb.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-automations-page-8kqdhAOz.js → browser-automations-page-BjMub7JM.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-settings-page-Dl4idi13.js → browser-settings-page-CYrPA-Fp.js} +1 -1
  20. package/dist/gateway/static/root/assets/{capabilities-Bfktn_7E.js → capabilities-BKu9BqPe.js} +1 -1
  21. package/dist/gateway/static/root/assets/{capabilities-BmMMlNmY.js → capabilities-CT_ZW9fT.js} +1 -1
  22. package/dist/gateway/static/root/assets/{capabilities-page-3ImhKPBx.js → capabilities-page-dW6FXtOy.js} +2 -2
  23. package/dist/gateway/static/root/assets/{capabilities-settings-panel-4VDEB_ob.js → capabilities-settings-panel-gZ8auLwa.js} +1 -1
  24. package/dist/gateway/static/root/assets/{capability-header-actions-D1gxCGi8.js → capability-header-actions-L1NvoOUG.js} +1 -1
  25. package/dist/gateway/static/root/assets/{channels-Drbr2JR-.js → channels-Dx5T2G73.js} +1 -1
  26. package/dist/gateway/static/root/assets/{chat-terminal-dock-CSkksCaa.js → chat-terminal-dock-DsCpKPBe.js} +1 -1
  27. package/dist/gateway/static/root/assets/{computer-settings-page-BIXpOJAk.js → computer-settings-page-6FWwxYLe.js} +1 -1
  28. package/dist/gateway/static/root/assets/{connector-service-page-CTnlVEE1.js → connector-service-page-mtH9mEBf.js} +1 -1
  29. package/dist/gateway/static/root/assets/{connectors-page-BluT2l4d.js → connectors-page-DgDLaws0.js} +1 -1
  30. package/dist/gateway/static/root/assets/{date-picker-Bw-CydDe.js → date-picker-BDcwEaIx.js} +1 -1
  31. package/dist/gateway/static/root/assets/{dependency-picker-CgHzhtAc.js → dependency-picker-B_fPQBTM.js} +1 -1
  32. package/dist/gateway/static/root/assets/{desktop-pet-YahEnyfd.js → desktop-pet-CJrO9Vd_.js} +1 -1
  33. package/dist/gateway/static/root/assets/{desktop-pet-settings-47Z4bqJr.js → desktop-pet-settings-DYAfri9w.js} +1 -1
  34. package/dist/gateway/static/root/assets/{device-pairing-wizard-C3aPEEaM.js → device-pairing-wizard-CqRys2R8.js} +1 -1
  35. package/dist/gateway/static/root/assets/{directory-picker-path-field-DH_ok92y.js → directory-picker-path-field-D7_qSxNZ.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-debug-page-t1TiLQrR.js → extension-debug-page-BGyJpRv4.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-page-BeV-7G1h.js → extension-page-D1zBmd8F.js} +1 -1
  38. package/dist/gateway/static/root/assets/{extension-provider-CFCxzqna.js → extension-provider-F9JzOWZ3.js} +1 -1
  39. package/dist/gateway/static/root/assets/{extension-settings-page-DCODJHOu.js → extension-settings-page-CTR8AjCG.js} +1 -1
  40. package/dist/gateway/static/root/assets/{fallback-models-CJzvASNV.js → fallback-models-Chhv4Nfv.js} +1 -1
  41. package/dist/gateway/static/root/assets/{gateway-config-swr-B3LfyXpc.js → gateway-config-swr-CoRoOG1l.js} +1 -1
  42. package/dist/gateway/static/root/assets/{gateway-realtime-CWxXXAe_.js → gateway-realtime-D0ygm6bc.js} +1 -1
  43. package/dist/gateway/static/root/assets/gateway-realtime-store-DBvCRclh.js +1 -0
  44. package/dist/gateway/static/root/assets/{gateway-settings-Q5NFzAJ_.js → gateway-settings-BVfz4Tla.js} +1 -1
  45. package/dist/gateway/static/root/assets/{gateway-startup-retry-BzQP02wp.js → gateway-startup-retry-FDS6S6qa.js} +1 -1
  46. package/dist/gateway/static/root/assets/{home-page-DndTkAw8.js → home-page-BF_9C9yW.js} +1 -1
  47. package/dist/gateway/static/root/assets/{image-generation-api-BO-Xs__S.js → image-generation-api-BPd76jW5.js} +1 -1
  48. package/dist/gateway/static/root/assets/{imports-page-Bb6Gm30L.js → imports-page-9EnECtcl.js} +1 -1
  49. package/dist/gateway/static/root/assets/{index-qOHWhsEK.js → index-BpXej9jJ.js} +7 -7
  50. package/dist/gateway/static/root/assets/index-CbJNcWAn.css +1 -0
  51. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D2u6sk5l.js → keyboard-shortcuts-settings-MC7mG2h2.js} +1 -1
  52. package/dist/gateway/static/root/assets/{local-app-workbench-page-CHeMfXrB.js → local-app-workbench-page-CytNu0-_.js} +1 -1
  53. package/dist/gateway/static/root/assets/{local-apps-page-BanU1SLr.js → local-apps-page-c3HncHZ3.js} +1 -1
  54. package/dist/gateway/static/root/assets/{local-session-drafts-DLZQBcZY.js → local-session-drafts-gbemPamv.js} +1 -1
  55. package/dist/gateway/static/root/assets/{locale-store-BbwWB0ra.js → locale-store-DId6-v2R.js} +1 -1
  56. package/dist/gateway/static/root/assets/{logs-page-CQdHKCL0.js → logs-page-D4aXtitd.js} +1 -1
  57. package/dist/gateway/static/root/assets/{management-settings-D0V5kCx0.js → management-settings-CRzWi_iJ.js} +1 -1
  58. package/dist/gateway/static/root/assets/{markdown-view-DIBLXsPm.js → markdown-view-DQZ51j9e.js} +1 -1
  59. package/dist/gateway/static/root/assets/{media-plugins-XPzvDZPz.js → media-plugins-XLewwq2q.js} +1 -1
  60. package/dist/gateway/static/root/assets/{messages-B4AhAW4B.js → messages-BHvpZNe9.js} +2 -2
  61. package/dist/gateway/static/root/assets/models-hub-cache-B9SKjidc.js +1 -0
  62. package/dist/gateway/static/root/assets/{note-detail-panel-CodeKI_W.js → note-detail-panel-BgbByI-4.js} +3 -3
  63. package/dist/gateway/static/root/assets/{notes-api-CLn4r03Z.js → notes-api-Byt65v3r.js} +1 -1
  64. package/dist/gateway/static/root/assets/{notes-page-liRQoHbF.js → notes-page-R2BX5XCE.js} +1 -1
  65. package/dist/gateway/static/root/assets/{oauth-api-D9zkd42J.js → oauth-api-BYsCbyGZ.js} +1 -1
  66. package/dist/gateway/static/root/assets/{page-context-capture-button-DO6DB9pi.js → page-context-capture-button-RBp1QK0F.js} +1 -1
  67. package/dist/gateway/static/root/assets/{personal-page-DdfdwOv5.js → personal-page-F0jTBWva.js} +1 -1
  68. package/dist/gateway/static/root/assets/{product-open-page-C9a3sm6Z.js → product-open-page-BtDK68qb.js} +1 -1
  69. package/dist/gateway/static/root/assets/{project-detail-page-BVe5R-Nj.js → project-detail-page-DmQEm0yH.js} +1 -1
  70. package/dist/gateway/static/root/assets/{projects-page-D_rCwi7w.js → projects-page-CrLQvkHX.js} +1 -1
  71. package/dist/gateway/static/root/assets/{registry-api-BFxQTbXQ.js → registry-api-7F2WNEZC.js} +1 -1
  72. package/dist/gateway/static/root/assets/{remote-access-hub-B3imt2du.js → remote-access-hub-C25_hQAd.js} +1 -1
  73. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-C9WC8hJM.js → runtime-tools-settings-panel-B0c120iI.js} +1 -1
  74. package/dist/gateway/static/root/assets/{scenes-page-DL95V1UP.js → scenes-page-DM64yMnx.js} +1 -1
  75. package/dist/gateway/static/root/assets/{schema-form-CDgGmgrq.js → schema-form-DQpQc9tH.js} +1 -1
  76. package/dist/gateway/static/root/assets/{send-session-input-tkAQXGBG.js → send-session-input-D1oc6BC6.js} +1 -1
  77. package/dist/gateway/static/root/assets/{session-api-9X7qep91.js → session-api-N3N37MrR.js} +1 -1
  78. package/dist/gateway/static/root/assets/{session-manager-Dy22bbJT.js → session-manager-CMGUwtbN.js} +1 -1
  79. package/dist/gateway/static/root/assets/{sessions-page-CeeKIVsM.js → sessions-page-DvDO8LtA.js} +1 -1
  80. package/dist/gateway/static/root/assets/settings-advanced-gate-BNhgbmcX.js +1 -0
  81. package/dist/gateway/static/root/assets/{settings-page-xmUGYSOG.js → settings-page-GgBEp6O7.js} +1 -1
  82. package/dist/gateway/static/root/assets/{setup-status-panel-CmjT9Q4P.js → setup-status-panel-10bMi6yL.js} +1 -1
  83. package/dist/gateway/static/root/assets/{share-link-dialog-DeOe9qfQ.js → share-link-dialog-TBBGJPfT.js} +1 -1
  84. package/dist/gateway/static/root/assets/{share-preview-page-Ck27gozJ.js → share-preview-page-DyRLPsPv.js} +1 -1
  85. package/dist/gateway/static/root/assets/{shares-api-D-GuMkPu.js → shares-api-DU0fHP2G.js} +1 -1
  86. package/dist/gateway/static/root/assets/{shares-settings-DpvM2OyO.js → shares-settings-DJ1ME-XM.js} +1 -1
  87. package/dist/gateway/static/root/assets/{skill-api-BpD02td8.js → skill-api-1Puv6wOz.js} +1 -1
  88. package/dist/gateway/static/root/assets/{skill-reload-api-CezAwYxM.js → skill-reload-api-ClyFqHk7.js} +1 -1
  89. package/dist/gateway/static/root/assets/{skills-page-BCgbVI-P.js → skills-page-D52pEr5x.js} +1 -1
  90. package/dist/gateway/static/root/assets/{system-settings-panel-UODcpzsP.js → system-settings-panel--yV67a8L.js} +1 -1
  91. package/dist/gateway/static/root/assets/{task-detail-page-BbqQnNes.js → task-detail-page-D-tcS2bS.js} +1 -1
  92. package/dist/gateway/static/root/assets/{theme-store-6IK2Ik2J.js → theme-store-OhcbFEUR.js} +1 -1
  93. package/dist/gateway/static/root/assets/tracing-settings-page-DoBJ0TYY.js +1 -0
  94. package/dist/gateway/static/root/assets/{tunnel-api-Eey2aZIz.js → tunnel-api-COLdiP_E.js} +1 -1
  95. package/dist/gateway/static/root/assets/{usage-page-BrWj5mk3.js → usage-page-CtM5IfrL.js} +1 -1
  96. package/dist/gateway/static/root/assets/{use-autosave-B-3BJbnn.js → use-autosave-veoM0dHn.js} +1 -1
  97. package/dist/gateway/static/root/assets/{use-composer-attachments-ByAHuR8v.js → use-composer-attachments-DB0bBGzZ.js} +1 -1
  98. package/dist/gateway/static/root/assets/{use-file-preview-expanded-CXVwWJeP.js → use-file-preview-expanded-Bope6MW6.js} +2 -2
  99. package/dist/gateway/static/root/assets/{user-model-page-Cg-oM8nY.js → user-model-page-CSh61kZ5.js} +1 -1
  100. package/dist/gateway/static/root/assets/{voice-api-key-field-BtffIKZD.js → voice-api-key-field-CwD6a3KQ.js} +1 -1
  101. package/dist/gateway/static/root/assets/{voice-config-api-BMm9dSKX.js → voice-config-api-Daexehmc.js} +1 -1
  102. package/dist/gateway/static/root/assets/{work-discovery-overlay-ByHhF_4r.js → work-discovery-overlay-C9u7tuEc.js} +1 -1
  103. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DfNn5VTy.js → workflow-run-setup-panel-BMOBbf33.js} +1 -1
  104. package/dist/gateway/static/root/assets/{workflows-page-B67D-7Wt.js → workflows-page-BrD9vXqO.js} +1 -1
  105. package/dist/gateway/static/root/assets/{workspace-api-TAD7LYsc.js → workspace-api-Cs4sjV2A.js} +2 -2
  106. package/dist/gateway/static/root/index.html +28 -28
  107. package/dist/package.js +1 -1
  108. package/dist/src/agent/agent-manager.js +11 -7
  109. package/dist/src/agent/background-review/run-background-review.js +1 -1
  110. package/dist/src/agent/embedded/model-runtime.js +1 -1
  111. package/dist/src/agent/embedded/run-for-session.js +28 -3
  112. package/dist/src/agent/embedded/run-turn.js +18 -3
  113. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  114. package/dist/src/agent/image/tool-model-config.js +1 -1
  115. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  116. package/dist/src/agent/service.js +6 -4
  117. package/dist/src/agent/skills/hub-lock.js +1 -1
  118. package/dist/src/agent/skills/index.js +1 -1
  119. package/dist/src/agent/skills/managed-store.js +1 -1
  120. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  121. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  122. package/dist/src/agent-catalog/capabilities.js +2 -2
  123. package/dist/src/auth/credentials.js +2 -2
  124. package/dist/src/auth/oauth-provider-lock.js +1 -1
  125. package/dist/src/auth/profiles/store.js +1 -1
  126. package/dist/src/auth/sync-provider-auth.js +1 -1
  127. package/dist/src/automations/capabilities/drafts.js +1 -1
  128. package/dist/src/bootstrap/application-state.js +1 -1
  129. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  130. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  131. package/dist/src/capabilities/runtime/product.js +1 -1
  132. package/dist/src/chat-commands/agent-edit.js +1 -1
  133. package/dist/src/chat-commands/builtins/config.js +1 -1
  134. package/dist/src/cli/commands/agent.js +1 -1
  135. package/dist/src/cli/commands/agents.js +1 -1
  136. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  137. package/dist/src/cli/commands/doctor/checks/image-providers.js +1 -1
  138. package/dist/src/cli/commands/doctor/checks/provider-auth.js +3 -3
  139. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  140. package/dist/src/cli/commands/models.js +2 -2
  141. package/dist/src/cli/commands/onboard/model.js +4 -4
  142. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  143. package/dist/src/config/index.js +4 -4
  144. package/dist/src/config/loader.js +2 -2
  145. package/dist/src/config/models-json.js +1 -1
  146. package/dist/src/config/reload.d.ts +1 -0
  147. package/dist/src/config/reload.js +4 -0
  148. package/dist/src/config/rules.js +5 -0
  149. package/dist/src/config/schema.d.ts +23 -0
  150. package/dist/src/config/schema.js +6 -3
  151. package/dist/src/extensions/activation-context.js +1 -1
  152. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  153. package/dist/src/extensions/lockfile.js +1 -1
  154. package/dist/src/gateway/agents-admin.js +2 -2
  155. package/dist/src/gateway/file-path-classifier.js +1 -1
  156. package/dist/src/gateway/hono/lib/config-payload.js +2 -2
  157. package/dist/src/gateway/hono/routes/config-patch/misc.js +3 -3
  158. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  159. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  160. package/dist/src/gateway/hono/routes/models.js +2 -2
  161. package/dist/src/gateway/hono/routes/notes.js +2 -2
  162. package/dist/src/gateway/hono/routes/observability.d.ts +3 -0
  163. package/dist/src/gateway/hono/routes/observability.js +106 -0
  164. package/dist/src/gateway/hono/routes/projects.js +2 -2
  165. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  166. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  167. package/dist/src/gateway/image-generation-setup.js +2 -2
  168. package/dist/src/gateway/lock.js +1 -1
  169. package/dist/src/gateway/security/gateway-scopes.js +1 -0
  170. package/dist/src/gateway/service/config-coordinator.d.ts +0 -25
  171. package/dist/src/gateway/service/config-coordinator.js +31 -0
  172. package/dist/src/gateway/service.js +18 -8
  173. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  174. package/dist/src/home-intelligence/host.js +2 -2
  175. package/dist/src/infra/update-restart.js +1 -1
  176. package/dist/src/local-apps/service.js +1 -1
  177. package/dist/src/observability/config.d.ts +40 -0
  178. package/dist/src/observability/config.js +31 -0
  179. package/dist/src/observability/langfuse.d.ts +31 -0
  180. package/dist/src/observability/langfuse.js +180 -0
  181. package/dist/src/observability/runtime.d.ts +57 -0
  182. package/dist/src/observability/runtime.js +404 -0
  183. package/dist/src/observability/sanitize.d.ts +3 -0
  184. package/dist/src/observability/sanitize.js +74 -0
  185. package/dist/src/observability/store.d.ts +20 -0
  186. package/dist/src/observability/store.js +128 -0
  187. package/dist/src/observability/storeWorker.d.ts +2 -0
  188. package/dist/src/observability/storeWorker.js +155 -0
  189. package/dist/src/observability/types.d.ts +21 -0
  190. package/dist/src/observability/types.js +1 -0
  191. package/dist/src/personal-agent/communication.js +1 -1
  192. package/dist/src/personal-agent/reply-composer.d.ts +22 -0
  193. package/dist/src/personal-agent/reply-composer.js +276 -0
  194. package/dist/src/personal-agent/reply-style.d.ts +2 -0
  195. package/dist/src/personal-agent/reply-style.js +14 -0
  196. package/dist/src/personal-agent/request-delivery.d.ts +1 -1
  197. package/dist/src/personal-agent/request-delivery.js +18 -4
  198. package/dist/src/personal-agent/request-service.js +1 -1
  199. package/dist/src/personal-agent/service.js +10 -2
  200. package/dist/src/platform/index.js +1 -1
  201. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  202. package/dist/src/providers/index.js +3 -3
  203. package/dist/src/providers/model-call.js +19 -5
  204. package/dist/src/providers/model-catalog-persistence.js +1 -1
  205. package/dist/src/providers/model-registry.js +1 -1
  206. package/dist/src/providers/provider-disconnect-core.js +1 -1
  207. package/dist/src/providers/xopc-cloud-catalog-coordinator.js +1 -1
  208. package/dist/src/storage/sqlite/ai-usage-repository.d.ts +6 -0
  209. package/dist/src/storage/sqlite/ai-usage-repository.js +4 -2
  210. package/dist/src/storage/sqlite/migrations/233_observability_usage_links.sql +3 -0
  211. package/dist/src/storage/sqlite/migrations/234_task_result_reply.sql +14 -0
  212. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  213. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  214. package/dist/src/storage/sqlite/schema.js +1 -1
  215. package/dist/src/tasks/capabilities/read.js +2 -2
  216. package/dist/src/tasks/task-result-delivery-service.js +20 -4
  217. package/dist/src/tui/backends/embedded-backend.js +3 -3
  218. package/dist/src/tui/tui-commands.js +1 -1
  219. package/dist/src/tui/tui-startup-resources.js +1 -1
  220. package/dist/src/tui/tui.js +1 -1
  221. package/dist/src/usage/recorder.d.ts +4 -2
  222. package/dist/src/usage/recorder.js +54 -26
  223. package/dist/src/usage/types.d.ts +3 -0
  224. package/dist/src/utils/logger/context.d.ts +1 -1
  225. package/dist/src/utils/logger/context.js +4 -1
  226. package/dist/src/utils/logger/types.d.ts +3 -0
  227. package/dist/src/voice/realtime/agentBroker.js +11 -2
  228. package/dist/src/voice/realtime/agentEngine.js +18 -10
  229. package/dist/src/voice/realtime/omniEngine.js +11 -2
  230. package/dist/src/voice/realtime/persona-context.js +1 -1
  231. package/dist/src/voice/realtime/playback-echo.d.ts +7 -0
  232. package/dist/src/voice/realtime/playback-echo.js +23 -1
  233. package/package.json +7 -4
  234. package/dist/gateway/static/root/assets/gateway-realtime-store-DS4WzQyF.js +0 -1
  235. package/dist/gateway/static/root/assets/index-Byk2QKIS.css +0 -1
  236. package/dist/gateway/static/root/assets/models-hub-cache-DN5MnhL8.js +0 -1
  237. package/dist/gateway/static/root/assets/settings-advanced-gate-DuvJrDU2.js +0 -1
@@ -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"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./popover-select-BgSdSbCL.js";import{b as s}from"./markdown-view-DIBLXsPm.js";import{t as c}from"./play-kxZvpBg8.js";import{t as l}from"./settings-2-D-csvaET.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./messages-B4AhAW4B.js";import{a as f,n as p,r as m}from"./locale-store-BbwWB0ra.js";import{t as h,u as g,w as _}from"./session-manager-Dy22bbJT.js";import{a as v,i as y,o as b,r as x,s as ee,t as S}from"./dist-C3DSFZCi.js";import{t as C}from"./skeleton-BwbyijEw.js";import{Fc as te,Ic as ne,Ji as re,K as ie,Pc as w,Q as T,Ui as E,Ur as ae,Yi as oe,Yo as D,_a as se,gs as O,n as ce,oa as le,q as ue,so as de,ua as k,wr as A,ya as j}from"./index-qOHWhsEK.js";import{l as M,n as N,t as P}from"./voice-config-api-BMm9dSKX.js";var F=n(),I=e(t(),1),L=r(),R=[`intro`,`identity`,`voice`,`connections`],fe=[{id:`loopi`,zh:`小环`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function pe(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function me(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await f(m(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),re(e)}function z({modelsAvailable:e,onCreated:t}){let n=p(e=>e.language)===`zh`,r=p(e=>e.language),[o,s]=(0,I.useState)(`intro`),[l,u]=(0,I.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[h,g]=(0,I.useState)(!1),[_,v]=(0,I.useState)(!1),[y,b]=(0,I.useState)(null),[x,ee]=(0,I.useState)(null),[S,re]=(0,I.useState)(null),[w,ae]=(0,I.useState)(null),[oe,D]=(0,I.useState)(!0),[O,ce]=(0,I.useState)([]),[le,A]=(0,I.useState)(null),F=(0,I.useRef)(null),z=(0,I.useRef)(null),[he,B]=(0,I.useState)([]),[ge,V]=(0,I.useState)(!0),[_e,H]=(0,I.useState)([]),[ve,U]=(0,I.useState)(null);(0,I.useEffect)(()=>{let e=!1;return f(m(`/api/personal-agent/onboarding`)).then(t=>{e||(s(t.payload.step),u(t.payload.draft))}).catch(t=>{e||b(t instanceof Error?t.message:String(t))}).finally(()=>{e||g(!0)}),()=>{e=!0}},[]),(0,I.useEffect)(()=>{if(!h)return;let e=window.setTimeout(()=>{f(m(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:o,draft:l})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[l,h,o]),(0,I.useEffect)(()=>{let e=!1;return P().then(t=>{e||(t.tts&&t.enabled?ae({provider:t.tts.provider,model:t.tts.model,enabled:!0}):D(!1))}).catch(()=>{e||D(!1)}),()=>{e=!0}},[]),(0,I.useEffect)(()=>{if(!w?.enabled)return;let e=!1;return N(w.provider,w.model,`realtime`).then(t=>{e||ce(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||D(!1)}),()=>{e=!0}},[w]),(0,I.useEffect)(()=>{if(o!==`connections`)return;let e=!1;return V(!0),Promise.allSettled([se({page:1,pageSize:24,verification:`verified`}),j()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];B(t.value.connectors.filter(t=>t.runtime.type===`composio`&&e.includes(t.runtime.toolkit)).sort((t,n)=>e.indexOf(t.runtime.type===`composio`?t.runtime.toolkit:``)-e.indexOf(n.runtime.type===`composio`?n.runtime.toolkit:``)))}n.status===`fulfilled`&&H(n.value),V(!1)}}),()=>{e=!0}},[o]),(0,I.useEffect)(()=>()=>{z.current?.abort(),F.current?.close()},[]),(0,I.useEffect)(()=>()=>{S&&URL.revokeObjectURL(S)},[S]);let ye=async(e,t=l)=>{await f(m(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),s(e)},be=async e=>{b(null);let t=R[Math.max(0,Math.min(R.length-1,R.indexOf(o)+e))];try{await ye(t)}catch(e){b(e instanceof Error?e.message:String(e))}},xe=async(n=!1)=>{if(!(!e||_)){v(!0),b(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:l,r=e.voice&&w?.enabled&&O.some(t=>t.id===e.voice)?{provider:w.provider,model:w.model,voice:e.voice}:void 0,i=(await f(m(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,a=!1;if(!n&&x)try{await me(i.agentId,x),i=(await f(m(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:i.revision,displayName:i.displayName,appearance:`custom`,preferences:i.preferences})})).payload}catch{a=!0}t(i,a)}catch(e){b(e instanceof Error?e.message:String(e))}finally{v(!1)}}},Se=(0,I.useCallback)(async e=>{z.current?.abort(),F.current?.close();let t=new AbortController;z.current=t,A(e),b(null);try{let n=new k;F.current=n,await n.start();let r=await M(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>A(null))}catch(e){t.signal.aborted||b(e instanceof Error?e.message:String(e)),A(null)}},[]);if(!h)return(0,L.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,L.jsx)(C,{className:`h-10 w-2/3`}),(0,L.jsx)(C,{className:`h-64 w-full rounded-2xl`}),(0,L.jsx)(C,{className:`h-12 w-full rounded-xl`})]});let W=R.indexOf(o),Ce={intro:n?`创建一个和你一起做事的助手`:`Create an assistant to work with you`,identity:n?`先给它一个形象和名字`:`Choose a look and a name`,voice:n?`想让我用什么声音回应?`:`How should your assistant sound?`,connections:n?`要让我了解哪些信息?`:`What information can your assistant use?`}[o];return(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,L.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,L.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,L.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[W>0?(0,L.jsxs)(`button`,{type:`button`,disabled:_,onClick:()=>void be(-1),className:`-ml-2 inline-flex min-h-10 items-center gap-1.5 rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:[(0,L.jsx)(ne,{className:`size-4`}),n?`上一步`:`Back`]}):(0,L.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,L.jsx)(i,{to:`/chat`,className:`-mr-2 inline-flex min-h-10 items-center rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`稍后继续`:`Finish later`})]}),(0,L.jsx)(`div`,{className:`mt-4 grid grid-cols-4 gap-1.5`,role:`progressbar`,"aria-label":n?`设置进度`:`Setup progress`,"aria-valuenow":W+1,"aria-valuemin":1,"aria-valuemax":R.length,children:R.map((e,t)=>(0,L.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=W?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,L.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,L.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,L.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,L.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:S?(0,L.jsx)(`img`,{src:S,alt:``,className:`size-14 rounded-xl object-cover`}):(0,L.jsx)(E,{appearance:l.appearance,className:`size-14`})}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,L.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:l.displayName||`Ada`})]})]}),(0,L.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${W+1} 步 · 共 ${R.length} 步`:`Step ${W+1} of ${R.length}`}),(0,L.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:Ce}),o===`intro`&&(0,L.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,L.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,L.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,L.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),o===`identity`&&(0,L.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,L.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,L.jsx)(`input`,{value:l.displayName,maxLength:60,onChange:e=>u(t=>({...t,displayName:e.target.value})),onBlur:()=>u(e=>({...e,displayName:e.displayName.trim()||`Ada`})),className:`mt-2 block w-full rounded-xl border border-edge bg-surface-panel px-4 py-3 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[fe.map(e=>(0,L.jsxs)(`button`,{type:`button`,"aria-pressed":!x&&l.appearance===e.id,onClick:()=>{ee(null),re(null),u(t=>({...t,appearance:e.id}))},className:`flex min-h-28 flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${!x&&l.appearance===e.id?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,L.jsx)(E,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,L.jsxs)(`label`,{className:`flex min-h-28 cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-within:ring-2 focus-within:ring-accent ${x?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,L.jsx)(de,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,L.jsx)(`input`,{className:`sr-only`,type:`file`,accept:`image/png,image/jpeg,image/webp`,onChange:e=>{let t=e.target.files?.[0];if(t){if(t.size>512*1024||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){b(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}ee(t),re(URL.createObjectURL(t))}}})]})]}),(0,L.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n?`自定义图片在创建助手时上传;刷新后需要重新选择。`:`Custom images upload when you create the assistant; select again after a refresh.`})]})]}),o===`voice`&&(0,L.jsxs)(`div`,{className:`mt-5`,children:[(0,L.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`用于这个助手的语音通话;文字回答不受影响。试听不会使用麦克风。`:`This affects calls with this assistant. Text stays the same. Preview does not use your microphone.`}),oe?(0,L.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(C,{className:`h-20 rounded-xl`}),(0,L.jsx)(C,{className:`h-20 rounded-xl`})]}):w?.enabled&&O.length>0?(0,L.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(`button`,{type:`button`,"aria-pressed":!l.voice,onClick:()=>u(e=>({...e,voice:null})),className:`rounded-xl p-4 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${l.voice?`bg-surface-panel text-fg-muted hover:bg-surface-hover`:`bg-accent/10 text-fg ring-1 ring-accent/40`}`,children:n?`使用默认声音`:`Use the default voice`}),O.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${l.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-pressed":l.voice===e.id,onClick:()=>u(t=>({...t,voice:e.id})),children:[(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,L.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void Se(e.id),className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-hover text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`试听${e.name}`:`Preview ${e.name}`,children:(0,L.jsx)(c,{className:`size-4 ${le===e.id?`text-accent`:``}`})})]},e.id))]}):(0,L.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,L.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,L.jsx)(i,{to:`/settings/capabilities/voice?returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),o===`connections`&&(0,L.jsxs)(`div`,{className:`mt-5`,children:[(0,L.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`现在连接,或进入对话后再添加。连接不会自动读取历史数据或创建持续关注。`:`Connect now or add sources later. Connecting does not automatically scan history or create ongoing monitoring.`}),ge?(0,L.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,L.jsx)(C,{className:`h-18 rounded-xl`}),(0,L.jsx)(C,{className:`h-18 rounded-xl`})]}):(0,L.jsx)(`div`,{className:`mt-5 space-y-2`,children:he.length?he.map(e=>{let t=pe(_e.find(t=>t.connectorId===e.id));return(0,L.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,L.jsx)(T,{connector:e,size:`sm`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,L.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,L.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,L.jsx)(a,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,L.jsx)(`button`,{type:`button`,onClick:()=>U(ie(e)),className:`rounded-lg bg-surface-hover px-3 py-2 text-xs text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`连接`:`Connect`})]},e.id)}):(0,L.jsx)(`p`,{className:`rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:n?`暂无可用的推荐服务;你仍可直接进入对话。`:`No suggested services are available. You can continue to chat.`})})]}),!e&&(0,L.jsxs)(`p`,{className:`mt-5 rounded-xl bg-warning/5 p-4 text-sm text-fg-muted`,children:[n?`开始前需要一个可用模型。`:`A compatible model is required before you start.`,` `,(0,L.jsx)(i,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),y&&(0,L.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:y})]},o)}),(0,L.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,L.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[o===`intro`&&(0,L.jsx)(`button`,{type:`button`,disabled:!e||_,onClick:()=>void xe(!0),className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:n?`用默认设置开始`:`Use defaults`}),o===`voice`&&(0,L.jsx)(`button`,{type:`button`,onClick:()=>{let e={...l,voice:null};u(e),b(null),ye(`connections`,e).catch(e=>b(e instanceof Error?e.message:String(e)))},className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`跳过`:`Skip`}),(0,L.jsxs)(`button`,{type:`button`,disabled:_||o===`connections`&&!e,onClick:()=>o===`connections`?void xe():void be(1),className:`flex min-h-11 items-center gap-2 rounded-xl bg-accent px-5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:opacity-40`,children:[_?n?`正在创建…`:`Creating…`:o===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!_&&(0,L.jsx)(te,{className:`size-4`})]})]})]})}),ve&&(0,L.jsx)(ue,{draft:ve,onChange:U,onClose:()=>U(null),t:d(r).connectorsSettings,onInstalled:async()=>{H(await j()),U(null)}})]})}function he({record:e,zh:t,onSelectVoice:n}){let[r,a]=(0,I.useState)(null),[o,s]=(0,I.useState)([]),[l,u]=(0,I.useState)(e.voicePreference?.voice??``),[d,f]=(0,I.useState)(!1),[p,m]=(0,I.useState)(null),[h,g]=(0,I.useState)(null),_=(0,I.useRef)(null),v=(0,I.useRef)(null);(0,I.useEffect)(()=>{let e=!1;return P().then(t=>{!e&&t.enabled&&t.tts&&a({provider:t.tts.provider,model:t.tts.model})}).catch(()=>{}),()=>{e=!0}},[]),(0,I.useEffect)(()=>{if(!r)return;let e=!1;return N(r.provider,r.model,`realtime`).then(t=>{e||s(t)}).catch(t=>{e||m(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[r]),(0,I.useEffect)(()=>()=>{v.current?.abort(),_.current?.close()},[]);let y=async e=>{v.current?.abort(),_.current?.close();let t=new AbortController;v.current=t,g(e);try{let n=new k;_.current=n,await n.start();let r=await M(t.signal,e);t.signal.aborted||n.enqueue(r,()=>g(null))}catch(e){t.signal.aborted||m(e instanceof Error?e.message:String(e)),g(null)}},b=async e=>{if(d)return;let t=l;u(e),f(!0),m(null);try{await n(e&&r?{provider:r.provider,model:r.model,voice:e}:null)||u(t)}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,L.jsxs)(`section`,{className:`border-t border-edge pt-5`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:t?`通话声音`:`Call voice`}),r&&o.length?(0,L.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:[(0,L.jsx)(`button`,{type:`button`,disabled:d,onClick:()=>void b(``),"aria-pressed":!l,className:`rounded-xl px-3 py-3 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50 ${l?`bg-surface-panel text-fg-muted hover:bg-surface-hover`:`bg-accent/10 text-fg ring-1 ring-accent/40`}`,children:t?`默认声音`:`Default voice`}),o.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center rounded-xl px-3 py-2 transition-colors ${l===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,L.jsxs)(`button`,{type:`button`,disabled:d,"aria-pressed":l===e.id,onClick:()=>void b(e.id),className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,L.jsx)(`span`,{className:`block text-sm text-fg`,children:e.name}),(0,L.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:e.description||e.style})]}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void y(e.id),className:`flex size-9 items-center justify-center rounded-full hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t?`试听${e.name}`:`Preview ${e.name}`,children:(0,L.jsx)(c,{className:`size-4 ${h===e.id?`text-accent`:`text-fg-muted`}`})})]},e.id))]}):(0,L.jsxs)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:[t?`当前没有可用音色。`:`No voice is ready.`,` `,(0,L.jsx)(i,{to:`/settings/capabilities/voice?returnTo=%2Fpersonal`,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`})]}),p&&(0,L.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:p})]})}var B=new h;function ge({conversationId:e,zh:t,onSaved:n}){let r=_(t=>t.sessions[e]),[i,a]=(0,I.useState)(!0),[o,s]=(0,I.useState)(``);(0,I.useEffect)(()=>{let t=!0;return B.loadSessionAgentConfig(e).then(n=>{t&&g(e,n)}).catch(e=>{t&&s(String(e))}).finally(()=>{t&&a(!1)}),()=>{t=!1}},[e]);let c=!!(r?.sending||r?.streaming||r?.modelConfigSaving);async function l(t,i){_.getState().patchSessionMeta(e,{modelConfigSaving:!0});try{g(e,await B.patchSessionAgentConfig(e,{model:t,thinkingLevel:i,configVersion:r?.configVersion})),await n()}catch(t){let n=await B.loadSessionAgentConfig(e).catch(()=>null);throw n&&g(e,n),t}finally{_.getState().patchSessionMeta(e,{modelConfigSaving:!1})}}return(0,L.jsxs)(`section`,{children:[(0,L.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:t?`对话模型与思考强度`:`Conversation model and thinking`}),i?(0,L.jsx)(C,{className:`h-9 w-full`}):(0,L.jsx)(ae,{chat:d(t?`zh`:`en`).chat,sessionModel:r?.model??``,thinkingLevel:r?.thinkingLevel??`off`,modelDisabled:c,thinkingDisabled:c,onModelChange:l,onThinkingChange:e=>l(r?.model??``,e)}),o&&(0,L.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:o})]})}var V=5;function _e(e){let t=e.replace(/\s+/g,` `).trim();if(t.length<=58)return t;let n=t.replace(/([^)]{1,80})|\([^)]{1,80}\)/g,``).replace(/([A-Za-z0-9])(?=[\u4e00-\u9fff])/g,`$1 `).replace(/\s+/g,` `).trim(),r=n.split(/[。!?;;,]/,1)[0]?.trim()||n;return r.length>58?`${r.slice(0,57).trimEnd()}…`:r}function H(e,t){if(e.phase===`closed`)return{label:t?`已结束`:`Finished`,tone:`bg-fg-subtle`};let n=e.operationalState??e.runStatus;return n===`running`?{label:t?`正在执行`:`Working`,tone:`bg-accent`}:n===`queued`?{label:t?`等待开始`:`Queued`,tone:`bg-fg-subtle`}:n===`failed`?{label:t?`执行失败`:`Failed`,tone:`bg-danger`}:n===`waiting`?{label:t?`等待继续`:`Waiting`,tone:`bg-warning`}:n===`blocked`?{label:t?`已阻塞`:`Blocked`,tone:`bg-warning`}:n===`verifying`?{label:t?`正在验证`:`Verifying`,tone:`bg-accent`}:n===`cancelled`?{label:t?`执行已取消`:`Cancelled`,tone:`bg-fg-subtle`}:e.phase===`review`?{label:t?`等待验收`:`In review`,tone:`bg-warning`}:e.phase===`active`?{label:t?`正在推进`:`In progress`,tone:`bg-accent`}:e.phase===`ready`?{label:t?`准备开始`:`Ready`,tone:`bg-fg-subtle`}:{label:t?`待处理`:`Planned`,tone:`bg-fg-subtle`}}function ve(e){let t=(0,F.c)(30),{item:n,zh:r}=e,a;t[0]!==n||t[1]!==r?(a=H(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=a,c;t[3]===n.id?c=t[4]:(c=s(`/personal`,n.id),t[3]=n.id,t[4]=c);let l=`mt-2 size-1.5 shrink-0 rounded-full ${o.tone}`,u;t[5]===l?u=t[6]:(u=(0,L.jsx)(`span`,{className:l,"aria-hidden":!0}),t[5]=l,t[6]=u);let d;t[7]===n.title?d=t[8]:(d=_e(n.title),t[7]=n.title,t[8]=d);let f;t[9]===d?f=t[10]:(f=(0,L.jsx)(`span`,{className:`line-clamp-2 break-words text-sm font-medium leading-5 text-fg`,children:d}),t[9]=d,t[10]=f);let p;t[11]===o.label?p=t[12]:(p=(0,L.jsx)(`span`,{children:o.label}),t[11]=o.label,t[12]=p);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,L.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`·`}),t[13]=m):m=t[13];let h=r?`zh`:`en`,g;t[14]!==n.updatedAt||t[15]!==h?(g=A(n.updatedAt,h),t[14]=n.updatedAt,t[15]=h,t[16]=g):g=t[16];let _;t[17]===g?_=t[18]:(_=(0,L.jsx)(`span`,{children:g}),t[17]=g,t[18]=_);let v;t[19]!==_||t[20]!==p?(v=(0,L.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2 text-xs text-fg-muted`,children:[p,m,_]}),t[19]=_,t[20]=p,t[21]=v):v=t[21];let y;t[22]!==v||t[23]!==f?(y=(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,v]}),t[22]=v,t[23]=f,t[24]=y):y=t[24];let b;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,L.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0}),t[25]=b):b=t[25];let x;return t[26]!==y||t[27]!==c||t[28]!==u?(x=(0,L.jsxs)(i,{to:c,className:`group flex min-w-0 items-start gap-3 rounded-2xl bg-surface-panel px-4 py-4 transition-colors duration-150 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,y,b]}),t[26]=y,t[27]=c,t[28]=u,t[29]=x):x=t[29],x}var U=[{id:`direct`,warmth:`reserved`,zh:`直接`,en:`Direct`},{id:`natural`,warmth:`balanced`,zh:`自然`,en:`Natural`},{id:`gentle`,warmth:`gentle`,zh:`温和`,en:`Gentle`}],ye=[{id:`loopi`,zh:`小环`,en:`Loopi`,color:`bg-slate-100/50 dark:bg-slate-400/10`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`,color:`bg-blue-100/50 dark:bg-blue-400/10`},{id:`loopi-care`,zh:`温和`,en:`Gentle`,color:`bg-violet-100/50 dark:bg-violet-400/10`}];function be(e,t){return e.warmth===`reserved`?t?`你可以直接说目标或问题。我会先给结论,需要时再展开。`:`Tell me the goal or question. I’ll lead with the answer and expand when useful.`:e.warmth===`gentle`?t?`想聊一件事,或让我帮你推进工作,都可以从这里开始。我会认真听,也会把下一步说清楚。`:`You can talk something through or ask me to move work forward. I’ll listen carefully and make the next step clear.`:t?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`}function xe(e){return U.find(t=>t.warmth===e.warmth)?.id??`natural`}function Se(){let e=le(),t=(0,I.useRef)(e);t.current=e;let n=p(e=>e.language)===`zh`,r=oe(e=>e.setPageHeader),i=oe(e=>e.clearPageHeader),[a,s]=(0,I.useState)(null),c=(0,I.useRef)(null),d=(0,I.useRef)(Promise.resolve()),[h,g]=(0,I.useState)([]),[_,te]=(0,I.useState)(!0),[ne,ie]=(0,I.useState)(0),[w,T]=(0,I.useState)(null),[ae,se]=(0,I.useState)(!0),[ue,k]=(0,I.useState)(!1),[A,j]=(0,I.useState)(`natural`),[M,N]=(0,I.useState)(`loopi`),[P,F]=(0,I.useState)(!1),R=(0,I.useRef)(null),fe=(0,I.useRef)(null),pe=(0,I.useRef)(null),[me,B]=(0,I.useState)(``),[_e,H]=(0,I.useState)(`untangle`),[Se,W]=(0,I.useState)(`none`),[Ce,we]=(0,I.useState)(`balanced`),[Te,Ee]=(0,I.useState)(`decisions`),[G,De]=(0,I.useState)(!1),[Oe,K]=(0,I.useState)(!1),[q,J]=(0,I.useState)(!1),[Y,ke]=(0,I.useState)(null),[Ae,je]=(0,I.useState)(!1),[X,Me]=(0,I.useState)(!1),[Ne,Pe]=(0,I.useState)(!1),[Z,Fe]=(0,I.useState)(0),Q=(0,I.useRef)(0),Ie=(0,I.useCallback)(()=>{J(!1),K(!1),De(!0)},[]),Le=(0,I.useCallback)(()=>{J(!1),K(!1),De(e=>!e)},[]),Re=(0,I.useCallback)(async()=>{try{let[e,t]=await Promise.all([f(m(`/api/personal-agent`)),f(m(`/api/personal-agent/models`))]);if(c.current=e.payload,s(e.payload),e.payload?.state===`ready`){let e=await f(m(`/api/personal-agent/onboarding`));se(!e.payload.completed||e.payload.welcomeDone)}window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),g(t.payload),e.payload&&(B(e.payload.displayName),N(e.payload.appearance),j(xe(e.payload.preferences)),H(e.payload.preferences.supportMode??`untangle`),W(e.payload.preferences.humor??`none`),we(e.payload.preferences.detailLevel??`balanced`),Ee(e.payload.preferences.proactivity??`decisions`))}catch(e){T(e instanceof Error?e.message:String(e))}finally{te(!1)}},[]);(0,I.useEffect)(()=>{Re()},[Re]);let $=(0,I.useCallback)(e=>{ie(e=>e+1),T(null);let t=d.current.then(async()=>{let t=c.current;if(!t)return!1;let n=e.displayName?.trim()||t.displayName,r=e.appearance??t.appearance,i={...t.preferences,...e.preferences},a=e.voicePreference===void 0?t.voicePreference:e.voicePreference;if(n===t.displayName&&r===t.appearance&&JSON.stringify(i)===JSON.stringify(t.preferences)&&JSON.stringify(a)===JSON.stringify(t.voicePreference))return!0;try{let o=await f(m(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:t.revision,displayName:n,appearance:r,preferences:i,...e.voicePreference===void 0?{}:{voicePreference:a}})});return c.current=o.payload,s(o.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:o.payload})),!0}catch(e){return T(e instanceof Error?e.message:String(e)),!1}}).finally(()=>ie(e=>e-1));return d.current=t,t},[]),ze=async e=>{if(a){T(null);try{if(e){let t=await f(m(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:a.revision,displayName:a.displayName,appearance:a.appearance,preferences:{...a.preferences,supportMode:e}})});c.current=t.payload,s(t.payload)}await f(m(`/api/personal-agent/onboarding/welcome`),{method:`POST`,body:`{}`}),se(!0)}catch(e){T(e instanceof Error?e.message:String(e))}}},Be=(0,I.useCallback)(async()=>{let e=++Q.current;J(!0),ke(null),je(!1),Me(!1),Pe(!1),Fe(0);try{let t=await f(m(`/api/personal-agent/activity?limit=${V}&offset=0`));if(e!==Q.current)return;ke(t.payload),Fe(t.payload.items.length)}catch{e===Q.current&&je(!0)}},[]),Ve=(0,I.useCallback)(async()=>{if(!Y||X||Z>=Y.total)return;let e=Q.current;Me(!0),Pe(!1);try{let t=await f(m(`/api/personal-agent/activity?limit=${V}&offset=${Z}`));if(e!==Q.current)return;ke(e=>e?{total:t.payload.total,items:[...e.items,...t.payload.items.filter(t=>!e.items.some(e=>e.id===t.id))]}:t.payload),Fe(e=>e+t.payload.items.length)}catch{e===Q.current&&Pe(!0)}finally{e===Q.current&&Me(!1)}},[Y,Z,X]);(0,I.useEffect)(()=>{if(!q||!Y||X)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(async()=>{let e=Q.current;try{let t=await f(m(`/api/personal-agent/activity?limit=${Math.max(V,Math.min(100,Z))}&offset=0`));if(e!==Q.current)return;ke(t.payload),Fe(t.payload.items.length)}catch{}},120)},n=window.setInterval(t,5e3);return window.addEventListener(`task-changed-v2`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.clearTimeout(e),window.clearInterval(n),window.removeEventListener(`task-changed-v2`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[Y,Z,X,q]);let He=async e=>{if(!a||![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){T(n?`请选择 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image.`);return}if(e.size===0||e.size>512*1024){T(n?`图片大小不能超过 512 KB。`:`Image must be 512 KB or smaller.`);return}F(!0),T(null);try{let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(e)});await f(m(`/api/agents/${encodeURIComponent(a.agentId)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:t.slice(t.indexOf(`,`)+1),mimeType:e.type})}),re(a.agentId),N(`custom`),K(!1),await $({appearance:`custom`})}catch(e){T(e instanceof Error?e.message:String(e))}finally{F(!1)}};(0,I.useLayoutEffect)(()=>{let o=a?.state===`ready`,s=o?a.appearance:M,c=o?a.displayName:`Ada`;return r({startExtra:null,main:(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[o?(0,L.jsx)(`button`,{ref:pe,type:`button`,onClick:Le,"aria-expanded":G,className:`touch-target -m-1 shrink-0 rounded-full p-1 transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`编辑${c}的资料`:`Edit ${c}'s profile`,title:n?`资料`:`Profile`,children:(0,L.jsx)(`span`,{className:`flex size-8 items-center justify-center`,children:(0,L.jsx)(E,{appearance:s,agentId:a?.agentId,className:`size-8`})})}):(0,L.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center`,children:(0,L.jsx)(E,{appearance:s,agentId:a?.agentId,className:`size-8`})}),(0,L.jsx)(`h1`,{className:`min-w-0 truncate text-sm font-semibold text-fg sm:text-base`,children:c})]}),end:o?(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`button`,{type:`button`,disabled:e.active,onClick:()=>{a?.state===`ready`&&t.current.open({conversationId:a.conversationId,name:a.displayName,mode:`assistant`})},className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,"aria-label":n?`语音通话`:`Voice call`,title:n?`语音通话`:`Voice call`,children:(0,L.jsx)(D,{className:`size-5`})}),(0,L.jsxs)(b,{open:q,onOpenChange:e=>{e?Be():J(!1)},children:[(0,L.jsx)(ee,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-pressed":q,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`正在做的事`:`Activity`,children:(0,L.jsx)(O,{className:`size-5`})})}),(0,L.jsx)(v,{children:(0,L.jsxs)(y,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`派发的任务`:`Delegated tasks`,className:`z-50 flex h-[min(34rem,calc(100dvh-6rem))] w-[min(25rem,calc(100vw-1rem))] min-h-0 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-inset shadow-xl focus:outline-none`,children:[(0,L.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-6 pb-3 pt-6`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n?`交给我推进的事`:`Delegated work`}),(0,L.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:Y?n?`最近更新 · 共 ${Y.total} 项`:`Recently updated · ${Y.total} total`:n?`查看任务进展与结果`:`Follow progress and results`})]}),(0,L.jsx)(x,{className:`touch-target -mr-2 -mt-1 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`关闭活动`:`Close activity`,children:(0,L.jsx)(u,{className:`size-4`})})]}),(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-5 pt-3`,children:[!Y&&!Ae&&(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(C,{className:`h-18 rounded-2xl`}),(0,L.jsx)(C,{className:`h-18 rounded-2xl`}),(0,L.jsx)(C,{className:`h-18 rounded-2xl`})]}),Ae&&(0,L.jsxs)(`div`,{className:`px-5 py-12 text-center`,children:[(0,L.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`暂时无法读取任务`:`Could not load tasks`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void Be(),className:`mt-3 rounded-lg px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:n?`重试`:`Try again`})]}),Y?.items.length===0&&(0,L.jsxs)(`div`,{className:`px-5 py-16 text-center`,children:[(0,L.jsx)(O,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,L.jsx)(`p`,{className:`mt-4 text-sm font-medium text-fg`,children:n?`还没有派发的任务`:`No delegated work yet`}),(0,L.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`你可以在对话里直接告诉我想推进的事。`:`Tell me what you would like to move forward in chat.`})]}),Y&&Y.items.length>0&&(0,L.jsx)(`div`,{className:`space-y-2`,children:Y.items.map(e=>(0,L.jsx)(ve,{item:e,zh:n},e.id))}),Y&&Z<Y.total&&(0,L.jsxs)(`div`,{className:`pt-4 text-center`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>void Ve(),disabled:X,className:`min-h-10 rounded-xl bg-surface-panel px-5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-50`,children:X?n?`正在加载…`:`Loading…`:n?`加载更多`:`Load more`}),Ne&&(0,L.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:n?`加载失败,请重试`:`Could not load more. Try again.`})]})]})]})})]}),(0,L.jsx)(`button`,{ref:fe,type:`button`,onClick:Le,"aria-expanded":G,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`回应偏好`:`Response preferences`,children:(0,L.jsx)(l,{className:`size-5`})})]}):null}),()=>i()},[Y,Ae,Z,X,Ne,M,i,Ve,Be,a,r,q,G,Le,e.active,n]);function Ue(){return a?(0,L.jsxs)(b,{open:G,onOpenChange:e=>{De(e),e||K(!1)},children:[(0,L.jsx)(S,{virtualRef:fe}),(0,L.jsx)(v,{children:(0,L.jsxs)(y,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`编辑 Personal AI`:`Edit Personal AI`,onInteractOutside:e=>{e.target instanceof Node&&(fe.current?.contains(e.target)||pe.current?.contains(e.target))&&e.preventDefault()},className:`z-50 flex h-[min(38rem,calc(100dvh-6rem))] w-[min(28rem,calc(100vw-1rem))] min-h-0 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl outline-none`,children:[(0,L.jsxs)(`div`,{className:`relative flex shrink-0 flex-col items-center px-5 pt-5 text-center`,children:[(0,L.jsx)(`button`,{type:`button`,disabled:P,onClick:()=>K(e=>!e),"aria-expanded":Oe,"aria-controls":`personal-appearance-options`,"aria-label":n?`选择头像`:`Choose avatar`,className:`rounded-full transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,L.jsx)(E,{appearance:M,agentId:a.agentId,className:`size-20`})}),(0,L.jsx)(`input`,{id:`personal-name`,"aria-label":n?`助手名称`:`Assistant name`,value:me,onChange:e=>B(e.target.value),onBlur:e=>{let t=e.currentTarget.value.trim();t?(B(t),$({displayName:t})):B(c.current?.displayName??``)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=c.current?.displayName??``,B(e.currentTarget.value),e.currentTarget.blur())},maxLength:60,placeholder:`Ada`,className:`mt-3 w-full min-w-0 rounded-lg border border-transparent bg-transparent px-2 py-1 text-center text-lg font-semibold text-fg outline-none transition-colors hover:border-edge focus:border-edge focus:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`}),ne>0&&(0,L.jsx)(`span`,{className:`absolute right-4 top-4 text-xs text-fg-muted`,children:n?`正在保存…`:`Saving…`})]}),(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-6 overflow-y-auto overscroll-contain px-5 py-5`,children:[w&&(0,L.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:w}),Oe&&(0,L.jsxs)(`section`,{id:`personal-appearance-options`,children:[(0,L.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`形象`:`Appearance`}),(0,L.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[ye.map(e=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>{N(e.id),K(!1),$({appearance:e.id})},"aria-pressed":M===e.id,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${M===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,L.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full ${e.color}`,children:(0,L.jsx)(E,{appearance:e.id,className:`size-8`})}),(0,L.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:n?e.zh:e.en})]},e.id)),(0,L.jsx)(`input`,{ref:R,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`sr-only`,"aria-label":n?`上传头像`:`Upload avatar`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&He(t),e.currentTarget.value=``}}),(0,L.jsxs)(`button`,{type:`button`,disabled:P,onClick:()=>R.current?.click(),"aria-pressed":M===`custom`,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50 ${M===`custom`?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,L.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-surface-panel`,children:M===`custom`?(0,L.jsx)(E,{appearance:`custom`,agentId:a.agentId,className:`size-8`}):(0,L.jsx)(de,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),(0,L.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:P?n?`上传中…`:`Uploading…`:n?`上传`:`Upload`})]})]})]}),(0,L.jsxs)(`section`,{children:[(0,L.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`语气`:`Tone`}),(0,L.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:U.map(e=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>{j(e.id),$({preferences:{warmth:e.warmth}})},"aria-pressed":A===e.id,className:`min-h-10 rounded-xl px-2 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${A===e.id?`bg-accent/10 font-medium text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:n?e.zh:e.en},e.id))})]}),(0,L.jsxs)(`section`,{children:[(0,L.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`棘手时`:`When things get tricky`}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[[`listen`,n?`先听`:`Listen`],[`untangle`,n?`理清`:`Untangle`],[`solutions`,n?`给办法`:`Suggest`]].map(([e,t])=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":_e===e,onClick:()=>{H(e),$({preferences:{supportMode:e}})},className:`min-h-9 rounded-full px-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${_e===e?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:t},e))})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`mb-2 text-sm font-medium text-fg`,children:n?`回答长度`:`Length`}),(0,L.jsx)(o,{value:Ce??`balanced`,options:[{value:`brief`,label:n?`简短`:`Brief`},{value:`balanced`,label:n?`适中`:`Balanced`},{value:`detailed`,label:n?`详细`:`Detailed`}],placeholder:n?`选择长度`:`Choose length`,allowEmpty:!1,onChange:e=>{let t=e;we(t),$({preferences:{detailLevel:t}})}})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`mb-2 text-sm font-medium text-fg`,children:n?`主动更新`:`Updates`}),(0,L.jsx)(o,{value:Te??`decisions`,options:[{value:`decisions`,label:n?`结果与决定`:`Results only`},{value:`important`,label:n?`重要进展`:`Milestones`},{value:`open`,label:n?`多提建议`:`Suggestions`}],placeholder:n?`选择频率`:`Choose frequency`,allowEmpty:!1,onChange:e=>{let t=e;Ee(t),$({preferences:{proactivity:t}})}})]})]}),(0,L.jsxs)(`details`,{className:`text-sm text-fg-muted`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer select-none`,children:n?`更多偏好`:`More preferences`}),(0,L.jsxs)(`div`,{className:`mt-3`,children:[(0,L.jsx)(`p`,{className:`mb-2 font-medium text-fg`,children:n?`轻松程度`:`Humor`}),(0,L.jsx)(o,{value:Se??`none`,options:[{value:`none`,label:n?`不加玩笑`:`None`},{value:`occasional`,label:n?`偶尔轻松`:`Sometimes`},{value:`playful`,label:n?`活泼`:`Playful`}],placeholder:n?`选择程度`:`Choose level`,allowEmpty:!1,onChange:e=>{let t=e;W(t),$({preferences:{humor:t}})}})]})]}),(0,L.jsx)(he,{record:a,zh:n,onSelectVoice:e=>$({voicePreference:e})}),(0,L.jsx)(`div`,{className:`border-t border-edge pt-5`,children:(0,L.jsx)(ge,{conversationId:a.conversationId,zh:n,onSaved:async()=>{let e=await f(m(`/api/personal-agent`));e.ok&&e.payload&&(c.current=e.payload,s(e.payload))}})})]})]})})]}):null}return _?(0,L.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,L.jsx)(C,{className:`h-20 w-20 rounded-full`}),(0,L.jsx)(C,{className:`h-9 w-72`}),(0,L.jsx)(C,{className:`h-44 w-full rounded-2xl`})]}):a?.state===`ready`?(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[ue&&(0,L.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 items-center justify-between gap-3 border-b border-warning/30 bg-warning/5 px-5 py-3 text-sm text-fg-muted`,children:[(0,L.jsx)(`span`,{children:n?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>{k(!1),Ie()},className:`shrink-0 text-accent hover:underline`,children:n?`打开设置`:`Open settings`})]}),(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,L.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,L.jsx)(ce,{embedded:!0,personal:!0,personalWelcome:{name:a.displayName,addressAs:a.userCallName??void 0,avatar:(0,L.jsx)(E,{appearance:a.appearance,agentId:a.agentId,className:`size-14`}),opening:be(a.preferences,n),showSupportChoice:!ae,onChooseSupport:e=>void ze(e),onSkipSupport:()=>void ze(),supportChoiceError:w},conversationId:a.conversationId})})}),Ue()]}):(0,L.jsx)(z,{modelsAvailable:h.length>0,onCreated:(e,t)=>{c.current=e,s(e),B(e.displayName),se(!1),k(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{Se as PersonalPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./popover-select-BgSdSbCL.js";import{b as s}from"./markdown-view-DQZ51j9e.js";import{t as c}from"./play-kxZvpBg8.js";import{t as l}from"./settings-2-D-csvaET.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./messages-BHvpZNe9.js";import{a as f,n as p,r as m}from"./locale-store-DId6-v2R.js";import{t as h,u as g,w as _}from"./session-manager-CMGUwtbN.js";import{a as v,i as y,o as b,r as x,s as ee,t as S}from"./dist-C3DSFZCi.js";import{t as C}from"./skeleton-BwbyijEw.js";import{Fc as te,Ic as ne,Ji as re,K as ie,Pc as w,Q as T,Ui as E,Ur as ae,Yi as oe,Yo as D,_a as se,gs as O,n as ce,oa as le,q as ue,so as de,ua as k,wr as A,ya as j}from"./index-BpXej9jJ.js";import{l as M,n as N,t as P}from"./voice-config-api-Daexehmc.js";var F=n(),I=e(t(),1),L=r(),R=[`intro`,`identity`,`voice`,`connections`],fe=[{id:`loopi`,zh:`小环`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function pe(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function me(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await f(m(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),re(e)}function z({modelsAvailable:e,onCreated:t}){let n=p(e=>e.language)===`zh`,r=p(e=>e.language),[o,s]=(0,I.useState)(`intro`),[l,u]=(0,I.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[h,g]=(0,I.useState)(!1),[_,v]=(0,I.useState)(!1),[y,b]=(0,I.useState)(null),[x,ee]=(0,I.useState)(null),[S,re]=(0,I.useState)(null),[w,ae]=(0,I.useState)(null),[oe,D]=(0,I.useState)(!0),[O,ce]=(0,I.useState)([]),[le,A]=(0,I.useState)(null),F=(0,I.useRef)(null),z=(0,I.useRef)(null),[he,B]=(0,I.useState)([]),[ge,V]=(0,I.useState)(!0),[_e,H]=(0,I.useState)([]),[ve,U]=(0,I.useState)(null);(0,I.useEffect)(()=>{let e=!1;return f(m(`/api/personal-agent/onboarding`)).then(t=>{e||(s(t.payload.step),u(t.payload.draft))}).catch(t=>{e||b(t instanceof Error?t.message:String(t))}).finally(()=>{e||g(!0)}),()=>{e=!0}},[]),(0,I.useEffect)(()=>{if(!h)return;let e=window.setTimeout(()=>{f(m(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:o,draft:l})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[l,h,o]),(0,I.useEffect)(()=>{let e=!1;return P().then(t=>{e||(t.tts&&t.enabled?ae({provider:t.tts.provider,model:t.tts.model,enabled:!0}):D(!1))}).catch(()=>{e||D(!1)}),()=>{e=!0}},[]),(0,I.useEffect)(()=>{if(!w?.enabled)return;let e=!1;return N(w.provider,w.model,`realtime`).then(t=>{e||ce(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||D(!1)}),()=>{e=!0}},[w]),(0,I.useEffect)(()=>{if(o!==`connections`)return;let e=!1;return V(!0),Promise.allSettled([se({page:1,pageSize:24,verification:`verified`}),j()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];B(t.value.connectors.filter(t=>t.runtime.type===`composio`&&e.includes(t.runtime.toolkit)).sort((t,n)=>e.indexOf(t.runtime.type===`composio`?t.runtime.toolkit:``)-e.indexOf(n.runtime.type===`composio`?n.runtime.toolkit:``)))}n.status===`fulfilled`&&H(n.value),V(!1)}}),()=>{e=!0}},[o]),(0,I.useEffect)(()=>()=>{z.current?.abort(),F.current?.close()},[]),(0,I.useEffect)(()=>()=>{S&&URL.revokeObjectURL(S)},[S]);let ye=async(e,t=l)=>{await f(m(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),s(e)},be=async e=>{b(null);let t=R[Math.max(0,Math.min(R.length-1,R.indexOf(o)+e))];try{await ye(t)}catch(e){b(e instanceof Error?e.message:String(e))}},xe=async(n=!1)=>{if(!(!e||_)){v(!0),b(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:l,r=e.voice&&w?.enabled&&O.some(t=>t.id===e.voice)?{provider:w.provider,model:w.model,voice:e.voice}:void 0,i=(await f(m(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,a=!1;if(!n&&x)try{await me(i.agentId,x),i=(await f(m(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:i.revision,displayName:i.displayName,appearance:`custom`,preferences:i.preferences})})).payload}catch{a=!0}t(i,a)}catch(e){b(e instanceof Error?e.message:String(e))}finally{v(!1)}}},Se=(0,I.useCallback)(async e=>{z.current?.abort(),F.current?.close();let t=new AbortController;z.current=t,A(e),b(null);try{let n=new k;F.current=n,await n.start();let r=await M(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>A(null))}catch(e){t.signal.aborted||b(e instanceof Error?e.message:String(e)),A(null)}},[]);if(!h)return(0,L.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,L.jsx)(C,{className:`h-10 w-2/3`}),(0,L.jsx)(C,{className:`h-64 w-full rounded-2xl`}),(0,L.jsx)(C,{className:`h-12 w-full rounded-xl`})]});let W=R.indexOf(o),Ce={intro:n?`创建一个和你一起做事的助手`:`Create an assistant to work with you`,identity:n?`先给它一个形象和名字`:`Choose a look and a name`,voice:n?`想让我用什么声音回应?`:`How should your assistant sound?`,connections:n?`要让我了解哪些信息?`:`What information can your assistant use?`}[o];return(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,L.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,L.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,L.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[W>0?(0,L.jsxs)(`button`,{type:`button`,disabled:_,onClick:()=>void be(-1),className:`-ml-2 inline-flex min-h-10 items-center gap-1.5 rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:[(0,L.jsx)(ne,{className:`size-4`}),n?`上一步`:`Back`]}):(0,L.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,L.jsx)(i,{to:`/chat`,className:`-mr-2 inline-flex min-h-10 items-center rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`稍后继续`:`Finish later`})]}),(0,L.jsx)(`div`,{className:`mt-4 grid grid-cols-4 gap-1.5`,role:`progressbar`,"aria-label":n?`设置进度`:`Setup progress`,"aria-valuenow":W+1,"aria-valuemin":1,"aria-valuemax":R.length,children:R.map((e,t)=>(0,L.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=W?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,L.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,L.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,L.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,L.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:S?(0,L.jsx)(`img`,{src:S,alt:``,className:`size-14 rounded-xl object-cover`}):(0,L.jsx)(E,{appearance:l.appearance,className:`size-14`})}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,L.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:l.displayName||`Ada`})]})]}),(0,L.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${W+1} 步 · 共 ${R.length} 步`:`Step ${W+1} of ${R.length}`}),(0,L.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:Ce}),o===`intro`&&(0,L.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,L.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,L.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,L.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),o===`identity`&&(0,L.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,L.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,L.jsx)(`input`,{value:l.displayName,maxLength:60,onChange:e=>u(t=>({...t,displayName:e.target.value})),onBlur:()=>u(e=>({...e,displayName:e.displayName.trim()||`Ada`})),className:`mt-2 block w-full rounded-xl border border-edge bg-surface-panel px-4 py-3 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[fe.map(e=>(0,L.jsxs)(`button`,{type:`button`,"aria-pressed":!x&&l.appearance===e.id,onClick:()=>{ee(null),re(null),u(t=>({...t,appearance:e.id}))},className:`flex min-h-28 flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${!x&&l.appearance===e.id?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,L.jsx)(E,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,L.jsxs)(`label`,{className:`flex min-h-28 cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-within:ring-2 focus-within:ring-accent ${x?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,L.jsx)(de,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,L.jsx)(`input`,{className:`sr-only`,type:`file`,accept:`image/png,image/jpeg,image/webp`,onChange:e=>{let t=e.target.files?.[0];if(t){if(t.size>512*1024||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){b(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}ee(t),re(URL.createObjectURL(t))}}})]})]}),(0,L.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n?`自定义图片在创建助手时上传;刷新后需要重新选择。`:`Custom images upload when you create the assistant; select again after a refresh.`})]})]}),o===`voice`&&(0,L.jsxs)(`div`,{className:`mt-5`,children:[(0,L.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`用于这个助手的语音通话;文字回答不受影响。试听不会使用麦克风。`:`This affects calls with this assistant. Text stays the same. Preview does not use your microphone.`}),oe?(0,L.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(C,{className:`h-20 rounded-xl`}),(0,L.jsx)(C,{className:`h-20 rounded-xl`})]}):w?.enabled&&O.length>0?(0,L.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(`button`,{type:`button`,"aria-pressed":!l.voice,onClick:()=>u(e=>({...e,voice:null})),className:`rounded-xl p-4 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${l.voice?`bg-surface-panel text-fg-muted hover:bg-surface-hover`:`bg-accent/10 text-fg ring-1 ring-accent/40`}`,children:n?`使用默认声音`:`Use the default voice`}),O.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${l.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-pressed":l.voice===e.id,onClick:()=>u(t=>({...t,voice:e.id})),children:[(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,L.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void Se(e.id),className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-hover text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`试听${e.name}`:`Preview ${e.name}`,children:(0,L.jsx)(c,{className:`size-4 ${le===e.id?`text-accent`:``}`})})]},e.id))]}):(0,L.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,L.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,L.jsx)(i,{to:`/settings/capabilities/voice?returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),o===`connections`&&(0,L.jsxs)(`div`,{className:`mt-5`,children:[(0,L.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`现在连接,或进入对话后再添加。连接不会自动读取历史数据或创建持续关注。`:`Connect now or add sources later. Connecting does not automatically scan history or create ongoing monitoring.`}),ge?(0,L.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,L.jsx)(C,{className:`h-18 rounded-xl`}),(0,L.jsx)(C,{className:`h-18 rounded-xl`})]}):(0,L.jsx)(`div`,{className:`mt-5 space-y-2`,children:he.length?he.map(e=>{let t=pe(_e.find(t=>t.connectorId===e.id));return(0,L.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,L.jsx)(T,{connector:e,size:`sm`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,L.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,L.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,L.jsx)(a,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,L.jsx)(`button`,{type:`button`,onClick:()=>U(ie(e)),className:`rounded-lg bg-surface-hover px-3 py-2 text-xs text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`连接`:`Connect`})]},e.id)}):(0,L.jsx)(`p`,{className:`rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:n?`暂无可用的推荐服务;你仍可直接进入对话。`:`No suggested services are available. You can continue to chat.`})})]}),!e&&(0,L.jsxs)(`p`,{className:`mt-5 rounded-xl bg-warning/5 p-4 text-sm text-fg-muted`,children:[n?`开始前需要一个可用模型。`:`A compatible model is required before you start.`,` `,(0,L.jsx)(i,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),y&&(0,L.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:y})]},o)}),(0,L.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,L.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[o===`intro`&&(0,L.jsx)(`button`,{type:`button`,disabled:!e||_,onClick:()=>void xe(!0),className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:n?`用默认设置开始`:`Use defaults`}),o===`voice`&&(0,L.jsx)(`button`,{type:`button`,onClick:()=>{let e={...l,voice:null};u(e),b(null),ye(`connections`,e).catch(e=>b(e instanceof Error?e.message:String(e)))},className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`跳过`:`Skip`}),(0,L.jsxs)(`button`,{type:`button`,disabled:_||o===`connections`&&!e,onClick:()=>o===`connections`?void xe():void be(1),className:`flex min-h-11 items-center gap-2 rounded-xl bg-accent px-5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:opacity-40`,children:[_?n?`正在创建…`:`Creating…`:o===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!_&&(0,L.jsx)(te,{className:`size-4`})]})]})]})}),ve&&(0,L.jsx)(ue,{draft:ve,onChange:U,onClose:()=>U(null),t:d(r).connectorsSettings,onInstalled:async()=>{H(await j()),U(null)}})]})}function he({record:e,zh:t,onSelectVoice:n}){let[r,a]=(0,I.useState)(null),[o,s]=(0,I.useState)([]),[l,u]=(0,I.useState)(e.voicePreference?.voice??``),[d,f]=(0,I.useState)(!1),[p,m]=(0,I.useState)(null),[h,g]=(0,I.useState)(null),_=(0,I.useRef)(null),v=(0,I.useRef)(null);(0,I.useEffect)(()=>{let e=!1;return P().then(t=>{!e&&t.enabled&&t.tts&&a({provider:t.tts.provider,model:t.tts.model})}).catch(()=>{}),()=>{e=!0}},[]),(0,I.useEffect)(()=>{if(!r)return;let e=!1;return N(r.provider,r.model,`realtime`).then(t=>{e||s(t)}).catch(t=>{e||m(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[r]),(0,I.useEffect)(()=>()=>{v.current?.abort(),_.current?.close()},[]);let y=async e=>{v.current?.abort(),_.current?.close();let t=new AbortController;v.current=t,g(e);try{let n=new k;_.current=n,await n.start();let r=await M(t.signal,e);t.signal.aborted||n.enqueue(r,()=>g(null))}catch(e){t.signal.aborted||m(e instanceof Error?e.message:String(e)),g(null)}},b=async e=>{if(d)return;let t=l;u(e),f(!0),m(null);try{await n(e&&r?{provider:r.provider,model:r.model,voice:e}:null)||u(t)}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,L.jsxs)(`section`,{className:`border-t border-edge pt-5`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:t?`通话声音`:`Call voice`}),r&&o.length?(0,L.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:[(0,L.jsx)(`button`,{type:`button`,disabled:d,onClick:()=>void b(``),"aria-pressed":!l,className:`rounded-xl px-3 py-3 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50 ${l?`bg-surface-panel text-fg-muted hover:bg-surface-hover`:`bg-accent/10 text-fg ring-1 ring-accent/40`}`,children:t?`默认声音`:`Default voice`}),o.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center rounded-xl px-3 py-2 transition-colors ${l===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,L.jsxs)(`button`,{type:`button`,disabled:d,"aria-pressed":l===e.id,onClick:()=>void b(e.id),className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,L.jsx)(`span`,{className:`block text-sm text-fg`,children:e.name}),(0,L.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:e.description||e.style})]}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void y(e.id),className:`flex size-9 items-center justify-center rounded-full hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t?`试听${e.name}`:`Preview ${e.name}`,children:(0,L.jsx)(c,{className:`size-4 ${h===e.id?`text-accent`:`text-fg-muted`}`})})]},e.id))]}):(0,L.jsxs)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:[t?`当前没有可用音色。`:`No voice is ready.`,` `,(0,L.jsx)(i,{to:`/settings/capabilities/voice?returnTo=%2Fpersonal`,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`})]}),p&&(0,L.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:p})]})}var B=new h;function ge({conversationId:e,zh:t,onSaved:n}){let r=_(t=>t.sessions[e]),[i,a]=(0,I.useState)(!0),[o,s]=(0,I.useState)(``);(0,I.useEffect)(()=>{let t=!0;return B.loadSessionAgentConfig(e).then(n=>{t&&g(e,n)}).catch(e=>{t&&s(String(e))}).finally(()=>{t&&a(!1)}),()=>{t=!1}},[e]);let c=!!(r?.sending||r?.streaming||r?.modelConfigSaving);async function l(t,i){_.getState().patchSessionMeta(e,{modelConfigSaving:!0});try{g(e,await B.patchSessionAgentConfig(e,{model:t,thinkingLevel:i,configVersion:r?.configVersion})),await n()}catch(t){let n=await B.loadSessionAgentConfig(e).catch(()=>null);throw n&&g(e,n),t}finally{_.getState().patchSessionMeta(e,{modelConfigSaving:!1})}}return(0,L.jsxs)(`section`,{children:[(0,L.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:t?`对话模型与思考强度`:`Conversation model and thinking`}),i?(0,L.jsx)(C,{className:`h-9 w-full`}):(0,L.jsx)(ae,{chat:d(t?`zh`:`en`).chat,sessionModel:r?.model??``,thinkingLevel:r?.thinkingLevel??`off`,modelDisabled:c,thinkingDisabled:c,onModelChange:l,onThinkingChange:e=>l(r?.model??``,e)}),o&&(0,L.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:o})]})}var V=5;function _e(e){let t=e.replace(/\s+/g,` `).trim();if(t.length<=58)return t;let n=t.replace(/([^)]{1,80})|\([^)]{1,80}\)/g,``).replace(/([A-Za-z0-9])(?=[\u4e00-\u9fff])/g,`$1 `).replace(/\s+/g,` `).trim(),r=n.split(/[。!?;;,]/,1)[0]?.trim()||n;return r.length>58?`${r.slice(0,57).trimEnd()}…`:r}function H(e,t){if(e.phase===`closed`)return{label:t?`已结束`:`Finished`,tone:`bg-fg-subtle`};let n=e.operationalState??e.runStatus;return n===`running`?{label:t?`正在执行`:`Working`,tone:`bg-accent`}:n===`queued`?{label:t?`等待开始`:`Queued`,tone:`bg-fg-subtle`}:n===`failed`?{label:t?`执行失败`:`Failed`,tone:`bg-danger`}:n===`waiting`?{label:t?`等待继续`:`Waiting`,tone:`bg-warning`}:n===`blocked`?{label:t?`已阻塞`:`Blocked`,tone:`bg-warning`}:n===`verifying`?{label:t?`正在验证`:`Verifying`,tone:`bg-accent`}:n===`cancelled`?{label:t?`执行已取消`:`Cancelled`,tone:`bg-fg-subtle`}:e.phase===`review`?{label:t?`等待验收`:`In review`,tone:`bg-warning`}:e.phase===`active`?{label:t?`正在推进`:`In progress`,tone:`bg-accent`}:e.phase===`ready`?{label:t?`准备开始`:`Ready`,tone:`bg-fg-subtle`}:{label:t?`待处理`:`Planned`,tone:`bg-fg-subtle`}}function ve(e){let t=(0,F.c)(30),{item:n,zh:r}=e,a;t[0]!==n||t[1]!==r?(a=H(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=a,c;t[3]===n.id?c=t[4]:(c=s(`/personal`,n.id),t[3]=n.id,t[4]=c);let l=`mt-2 size-1.5 shrink-0 rounded-full ${o.tone}`,u;t[5]===l?u=t[6]:(u=(0,L.jsx)(`span`,{className:l,"aria-hidden":!0}),t[5]=l,t[6]=u);let d;t[7]===n.title?d=t[8]:(d=_e(n.title),t[7]=n.title,t[8]=d);let f;t[9]===d?f=t[10]:(f=(0,L.jsx)(`span`,{className:`line-clamp-2 break-words text-sm font-medium leading-5 text-fg`,children:d}),t[9]=d,t[10]=f);let p;t[11]===o.label?p=t[12]:(p=(0,L.jsx)(`span`,{children:o.label}),t[11]=o.label,t[12]=p);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,L.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`·`}),t[13]=m):m=t[13];let h=r?`zh`:`en`,g;t[14]!==n.updatedAt||t[15]!==h?(g=A(n.updatedAt,h),t[14]=n.updatedAt,t[15]=h,t[16]=g):g=t[16];let _;t[17]===g?_=t[18]:(_=(0,L.jsx)(`span`,{children:g}),t[17]=g,t[18]=_);let v;t[19]!==_||t[20]!==p?(v=(0,L.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2 text-xs text-fg-muted`,children:[p,m,_]}),t[19]=_,t[20]=p,t[21]=v):v=t[21];let y;t[22]!==v||t[23]!==f?(y=(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,v]}),t[22]=v,t[23]=f,t[24]=y):y=t[24];let b;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,L.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0}),t[25]=b):b=t[25];let x;return t[26]!==y||t[27]!==c||t[28]!==u?(x=(0,L.jsxs)(i,{to:c,className:`group flex min-w-0 items-start gap-3 rounded-2xl bg-surface-panel px-4 py-4 transition-colors duration-150 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,y,b]}),t[26]=y,t[27]=c,t[28]=u,t[29]=x):x=t[29],x}var U=[{id:`direct`,warmth:`reserved`,zh:`直接`,en:`Direct`},{id:`natural`,warmth:`balanced`,zh:`自然`,en:`Natural`},{id:`gentle`,warmth:`gentle`,zh:`温和`,en:`Gentle`}],ye=[{id:`loopi`,zh:`小环`,en:`Loopi`,color:`bg-slate-100/50 dark:bg-slate-400/10`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`,color:`bg-blue-100/50 dark:bg-blue-400/10`},{id:`loopi-care`,zh:`温和`,en:`Gentle`,color:`bg-violet-100/50 dark:bg-violet-400/10`}];function be(e,t){return e.warmth===`reserved`?t?`你可以直接说目标或问题。我会先给结论,需要时再展开。`:`Tell me the goal or question. I’ll lead with the answer and expand when useful.`:e.warmth===`gentle`?t?`想聊一件事,或让我帮你推进工作,都可以从这里开始。我会认真听,也会把下一步说清楚。`:`You can talk something through or ask me to move work forward. I’ll listen carefully and make the next step clear.`:t?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`}function xe(e){return U.find(t=>t.warmth===e.warmth)?.id??`natural`}function Se(){let e=le(),t=(0,I.useRef)(e);t.current=e;let n=p(e=>e.language)===`zh`,r=oe(e=>e.setPageHeader),i=oe(e=>e.clearPageHeader),[a,s]=(0,I.useState)(null),c=(0,I.useRef)(null),d=(0,I.useRef)(Promise.resolve()),[h,g]=(0,I.useState)([]),[_,te]=(0,I.useState)(!0),[ne,ie]=(0,I.useState)(0),[w,T]=(0,I.useState)(null),[ae,se]=(0,I.useState)(!0),[ue,k]=(0,I.useState)(!1),[A,j]=(0,I.useState)(`natural`),[M,N]=(0,I.useState)(`loopi`),[P,F]=(0,I.useState)(!1),R=(0,I.useRef)(null),fe=(0,I.useRef)(null),pe=(0,I.useRef)(null),[me,B]=(0,I.useState)(``),[_e,H]=(0,I.useState)(`untangle`),[Se,W]=(0,I.useState)(`none`),[Ce,we]=(0,I.useState)(`balanced`),[Te,Ee]=(0,I.useState)(`decisions`),[G,De]=(0,I.useState)(!1),[Oe,K]=(0,I.useState)(!1),[q,J]=(0,I.useState)(!1),[Y,ke]=(0,I.useState)(null),[Ae,je]=(0,I.useState)(!1),[X,Me]=(0,I.useState)(!1),[Ne,Pe]=(0,I.useState)(!1),[Z,Fe]=(0,I.useState)(0),Q=(0,I.useRef)(0),Ie=(0,I.useCallback)(()=>{J(!1),K(!1),De(!0)},[]),Le=(0,I.useCallback)(()=>{J(!1),K(!1),De(e=>!e)},[]),Re=(0,I.useCallback)(async()=>{try{let[e,t]=await Promise.all([f(m(`/api/personal-agent`)),f(m(`/api/personal-agent/models`))]);if(c.current=e.payload,s(e.payload),e.payload?.state===`ready`){let e=await f(m(`/api/personal-agent/onboarding`));se(!e.payload.completed||e.payload.welcomeDone)}window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),g(t.payload),e.payload&&(B(e.payload.displayName),N(e.payload.appearance),j(xe(e.payload.preferences)),H(e.payload.preferences.supportMode??`untangle`),W(e.payload.preferences.humor??`none`),we(e.payload.preferences.detailLevel??`balanced`),Ee(e.payload.preferences.proactivity??`decisions`))}catch(e){T(e instanceof Error?e.message:String(e))}finally{te(!1)}},[]);(0,I.useEffect)(()=>{Re()},[Re]);let $=(0,I.useCallback)(e=>{ie(e=>e+1),T(null);let t=d.current.then(async()=>{let t=c.current;if(!t)return!1;let n=e.displayName?.trim()||t.displayName,r=e.appearance??t.appearance,i={...t.preferences,...e.preferences},a=e.voicePreference===void 0?t.voicePreference:e.voicePreference;if(n===t.displayName&&r===t.appearance&&JSON.stringify(i)===JSON.stringify(t.preferences)&&JSON.stringify(a)===JSON.stringify(t.voicePreference))return!0;try{let o=await f(m(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:t.revision,displayName:n,appearance:r,preferences:i,...e.voicePreference===void 0?{}:{voicePreference:a}})});return c.current=o.payload,s(o.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:o.payload})),!0}catch(e){return T(e instanceof Error?e.message:String(e)),!1}}).finally(()=>ie(e=>e-1));return d.current=t,t},[]),ze=async e=>{if(a){T(null);try{if(e){let t=await f(m(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:a.revision,displayName:a.displayName,appearance:a.appearance,preferences:{...a.preferences,supportMode:e}})});c.current=t.payload,s(t.payload)}await f(m(`/api/personal-agent/onboarding/welcome`),{method:`POST`,body:`{}`}),se(!0)}catch(e){T(e instanceof Error?e.message:String(e))}}},Be=(0,I.useCallback)(async()=>{let e=++Q.current;J(!0),ke(null),je(!1),Me(!1),Pe(!1),Fe(0);try{let t=await f(m(`/api/personal-agent/activity?limit=${V}&offset=0`));if(e!==Q.current)return;ke(t.payload),Fe(t.payload.items.length)}catch{e===Q.current&&je(!0)}},[]),Ve=(0,I.useCallback)(async()=>{if(!Y||X||Z>=Y.total)return;let e=Q.current;Me(!0),Pe(!1);try{let t=await f(m(`/api/personal-agent/activity?limit=${V}&offset=${Z}`));if(e!==Q.current)return;ke(e=>e?{total:t.payload.total,items:[...e.items,...t.payload.items.filter(t=>!e.items.some(e=>e.id===t.id))]}:t.payload),Fe(e=>e+t.payload.items.length)}catch{e===Q.current&&Pe(!0)}finally{e===Q.current&&Me(!1)}},[Y,Z,X]);(0,I.useEffect)(()=>{if(!q||!Y||X)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(async()=>{let e=Q.current;try{let t=await f(m(`/api/personal-agent/activity?limit=${Math.max(V,Math.min(100,Z))}&offset=0`));if(e!==Q.current)return;ke(t.payload),Fe(t.payload.items.length)}catch{}},120)},n=window.setInterval(t,5e3);return window.addEventListener(`task-changed-v2`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.clearTimeout(e),window.clearInterval(n),window.removeEventListener(`task-changed-v2`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[Y,Z,X,q]);let He=async e=>{if(!a||![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){T(n?`请选择 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image.`);return}if(e.size===0||e.size>512*1024){T(n?`图片大小不能超过 512 KB。`:`Image must be 512 KB or smaller.`);return}F(!0),T(null);try{let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(e)});await f(m(`/api/agents/${encodeURIComponent(a.agentId)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:t.slice(t.indexOf(`,`)+1),mimeType:e.type})}),re(a.agentId),N(`custom`),K(!1),await $({appearance:`custom`})}catch(e){T(e instanceof Error?e.message:String(e))}finally{F(!1)}};(0,I.useLayoutEffect)(()=>{let o=a?.state===`ready`,s=o?a.appearance:M,c=o?a.displayName:`Ada`;return r({startExtra:null,main:(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[o?(0,L.jsx)(`button`,{ref:pe,type:`button`,onClick:Le,"aria-expanded":G,className:`touch-target -m-1 shrink-0 rounded-full p-1 transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`编辑${c}的资料`:`Edit ${c}'s profile`,title:n?`资料`:`Profile`,children:(0,L.jsx)(`span`,{className:`flex size-8 items-center justify-center`,children:(0,L.jsx)(E,{appearance:s,agentId:a?.agentId,className:`size-8`})})}):(0,L.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center`,children:(0,L.jsx)(E,{appearance:s,agentId:a?.agentId,className:`size-8`})}),(0,L.jsx)(`h1`,{className:`min-w-0 truncate text-sm font-semibold text-fg sm:text-base`,children:c})]}),end:o?(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`button`,{type:`button`,disabled:e.active,onClick:()=>{a?.state===`ready`&&t.current.open({conversationId:a.conversationId,name:a.displayName,mode:`assistant`})},className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,"aria-label":n?`语音通话`:`Voice call`,title:n?`语音通话`:`Voice call`,children:(0,L.jsx)(D,{className:`size-5`})}),(0,L.jsxs)(b,{open:q,onOpenChange:e=>{e?Be():J(!1)},children:[(0,L.jsx)(ee,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-pressed":q,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`正在做的事`:`Activity`,children:(0,L.jsx)(O,{className:`size-5`})})}),(0,L.jsx)(v,{children:(0,L.jsxs)(y,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`派发的任务`:`Delegated tasks`,className:`z-50 flex h-[min(34rem,calc(100dvh-6rem))] w-[min(25rem,calc(100vw-1rem))] min-h-0 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-inset shadow-xl focus:outline-none`,children:[(0,L.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-6 pb-3 pt-6`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n?`交给我推进的事`:`Delegated work`}),(0,L.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:Y?n?`最近更新 · 共 ${Y.total} 项`:`Recently updated · ${Y.total} total`:n?`查看任务进展与结果`:`Follow progress and results`})]}),(0,L.jsx)(x,{className:`touch-target -mr-2 -mt-1 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`关闭活动`:`Close activity`,children:(0,L.jsx)(u,{className:`size-4`})})]}),(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-5 pt-3`,children:[!Y&&!Ae&&(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(C,{className:`h-18 rounded-2xl`}),(0,L.jsx)(C,{className:`h-18 rounded-2xl`}),(0,L.jsx)(C,{className:`h-18 rounded-2xl`})]}),Ae&&(0,L.jsxs)(`div`,{className:`px-5 py-12 text-center`,children:[(0,L.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`暂时无法读取任务`:`Could not load tasks`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void Be(),className:`mt-3 rounded-lg px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:n?`重试`:`Try again`})]}),Y?.items.length===0&&(0,L.jsxs)(`div`,{className:`px-5 py-16 text-center`,children:[(0,L.jsx)(O,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,L.jsx)(`p`,{className:`mt-4 text-sm font-medium text-fg`,children:n?`还没有派发的任务`:`No delegated work yet`}),(0,L.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`你可以在对话里直接告诉我想推进的事。`:`Tell me what you would like to move forward in chat.`})]}),Y&&Y.items.length>0&&(0,L.jsx)(`div`,{className:`space-y-2`,children:Y.items.map(e=>(0,L.jsx)(ve,{item:e,zh:n},e.id))}),Y&&Z<Y.total&&(0,L.jsxs)(`div`,{className:`pt-4 text-center`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>void Ve(),disabled:X,className:`min-h-10 rounded-xl bg-surface-panel px-5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-50`,children:X?n?`正在加载…`:`Loading…`:n?`加载更多`:`Load more`}),Ne&&(0,L.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:n?`加载失败,请重试`:`Could not load more. Try again.`})]})]})]})})]}),(0,L.jsx)(`button`,{ref:fe,type:`button`,onClick:Le,"aria-expanded":G,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`回应偏好`:`Response preferences`,children:(0,L.jsx)(l,{className:`size-5`})})]}):null}),()=>i()},[Y,Ae,Z,X,Ne,M,i,Ve,Be,a,r,q,G,Le,e.active,n]);function Ue(){return a?(0,L.jsxs)(b,{open:G,onOpenChange:e=>{De(e),e||K(!1)},children:[(0,L.jsx)(S,{virtualRef:fe}),(0,L.jsx)(v,{children:(0,L.jsxs)(y,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`编辑 Personal AI`:`Edit Personal AI`,onInteractOutside:e=>{e.target instanceof Node&&(fe.current?.contains(e.target)||pe.current?.contains(e.target))&&e.preventDefault()},className:`z-50 flex h-[min(38rem,calc(100dvh-6rem))] w-[min(28rem,calc(100vw-1rem))] min-h-0 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl outline-none`,children:[(0,L.jsxs)(`div`,{className:`relative flex shrink-0 flex-col items-center px-5 pt-5 text-center`,children:[(0,L.jsx)(`button`,{type:`button`,disabled:P,onClick:()=>K(e=>!e),"aria-expanded":Oe,"aria-controls":`personal-appearance-options`,"aria-label":n?`选择头像`:`Choose avatar`,className:`rounded-full transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,L.jsx)(E,{appearance:M,agentId:a.agentId,className:`size-20`})}),(0,L.jsx)(`input`,{id:`personal-name`,"aria-label":n?`助手名称`:`Assistant name`,value:me,onChange:e=>B(e.target.value),onBlur:e=>{let t=e.currentTarget.value.trim();t?(B(t),$({displayName:t})):B(c.current?.displayName??``)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=c.current?.displayName??``,B(e.currentTarget.value),e.currentTarget.blur())},maxLength:60,placeholder:`Ada`,className:`mt-3 w-full min-w-0 rounded-lg border border-transparent bg-transparent px-2 py-1 text-center text-lg font-semibold text-fg outline-none transition-colors hover:border-edge focus:border-edge focus:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`}),ne>0&&(0,L.jsx)(`span`,{className:`absolute right-4 top-4 text-xs text-fg-muted`,children:n?`正在保存…`:`Saving…`})]}),(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-6 overflow-y-auto overscroll-contain px-5 py-5`,children:[w&&(0,L.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:w}),Oe&&(0,L.jsxs)(`section`,{id:`personal-appearance-options`,children:[(0,L.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`形象`:`Appearance`}),(0,L.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[ye.map(e=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>{N(e.id),K(!1),$({appearance:e.id})},"aria-pressed":M===e.id,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${M===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,L.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full ${e.color}`,children:(0,L.jsx)(E,{appearance:e.id,className:`size-8`})}),(0,L.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:n?e.zh:e.en})]},e.id)),(0,L.jsx)(`input`,{ref:R,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`sr-only`,"aria-label":n?`上传头像`:`Upload avatar`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&He(t),e.currentTarget.value=``}}),(0,L.jsxs)(`button`,{type:`button`,disabled:P,onClick:()=>R.current?.click(),"aria-pressed":M===`custom`,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50 ${M===`custom`?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,L.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-surface-panel`,children:M===`custom`?(0,L.jsx)(E,{appearance:`custom`,agentId:a.agentId,className:`size-8`}):(0,L.jsx)(de,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),(0,L.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:P?n?`上传中…`:`Uploading…`:n?`上传`:`Upload`})]})]})]}),(0,L.jsxs)(`section`,{children:[(0,L.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`语气`:`Tone`}),(0,L.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:U.map(e=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>{j(e.id),$({preferences:{warmth:e.warmth}})},"aria-pressed":A===e.id,className:`min-h-10 rounded-xl px-2 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${A===e.id?`bg-accent/10 font-medium text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:n?e.zh:e.en},e.id))})]}),(0,L.jsxs)(`section`,{children:[(0,L.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`棘手时`:`When things get tricky`}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[[`listen`,n?`先听`:`Listen`],[`untangle`,n?`理清`:`Untangle`],[`solutions`,n?`给办法`:`Suggest`]].map(([e,t])=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":_e===e,onClick:()=>{H(e),$({preferences:{supportMode:e}})},className:`min-h-9 rounded-full px-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${_e===e?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:t},e))})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`mb-2 text-sm font-medium text-fg`,children:n?`回答长度`:`Length`}),(0,L.jsx)(o,{value:Ce??`balanced`,options:[{value:`brief`,label:n?`简短`:`Brief`},{value:`balanced`,label:n?`适中`:`Balanced`},{value:`detailed`,label:n?`详细`:`Detailed`}],placeholder:n?`选择长度`:`Choose length`,allowEmpty:!1,onChange:e=>{let t=e;we(t),$({preferences:{detailLevel:t}})}})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`mb-2 text-sm font-medium text-fg`,children:n?`主动更新`:`Updates`}),(0,L.jsx)(o,{value:Te??`decisions`,options:[{value:`decisions`,label:n?`结果与决定`:`Results only`},{value:`important`,label:n?`重要进展`:`Milestones`},{value:`open`,label:n?`多提建议`:`Suggestions`}],placeholder:n?`选择频率`:`Choose frequency`,allowEmpty:!1,onChange:e=>{let t=e;Ee(t),$({preferences:{proactivity:t}})}})]})]}),(0,L.jsxs)(`details`,{className:`text-sm text-fg-muted`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer select-none`,children:n?`更多偏好`:`More preferences`}),(0,L.jsxs)(`div`,{className:`mt-3`,children:[(0,L.jsx)(`p`,{className:`mb-2 font-medium text-fg`,children:n?`轻松程度`:`Humor`}),(0,L.jsx)(o,{value:Se??`none`,options:[{value:`none`,label:n?`不加玩笑`:`None`},{value:`occasional`,label:n?`偶尔轻松`:`Sometimes`},{value:`playful`,label:n?`活泼`:`Playful`}],placeholder:n?`选择程度`:`Choose level`,allowEmpty:!1,onChange:e=>{let t=e;W(t),$({preferences:{humor:t}})}})]})]}),(0,L.jsx)(he,{record:a,zh:n,onSelectVoice:e=>$({voicePreference:e})}),(0,L.jsx)(`div`,{className:`border-t border-edge pt-5`,children:(0,L.jsx)(ge,{conversationId:a.conversationId,zh:n,onSaved:async()=>{let e=await f(m(`/api/personal-agent`));e.ok&&e.payload&&(c.current=e.payload,s(e.payload))}})})]})]})})]}):null}return _?(0,L.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,L.jsx)(C,{className:`h-20 w-20 rounded-full`}),(0,L.jsx)(C,{className:`h-9 w-72`}),(0,L.jsx)(C,{className:`h-44 w-full rounded-2xl`})]}):a?.state===`ready`?(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[ue&&(0,L.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 items-center justify-between gap-3 border-b border-warning/30 bg-warning/5 px-5 py-3 text-sm text-fg-muted`,children:[(0,L.jsx)(`span`,{children:n?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>{k(!1),Ie()},className:`shrink-0 text-accent hover:underline`,children:n?`打开设置`:`Open settings`})]}),(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,L.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,L.jsx)(ce,{embedded:!0,personal:!0,personalWelcome:{name:a.displayName,addressAs:a.userCallName??void 0,avatar:(0,L.jsx)(E,{appearance:a.appearance,agentId:a.agentId,className:`size-14`}),opening:be(a.preferences,n),showSupportChoice:!ae,onChooseSupport:e=>void ze(e),onSkipSupport:()=>void ze(),supportChoiceError:w},conversationId:a.conversationId})})}),Ue()]}):(0,L.jsx)(z,{modelsAvailable:h.length>0,onCreated:(e,t)=>{c.current=e,s(e),B(e.displayName),se(!1),k(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{Se as PersonalPage};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{r as n,t as r,u as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{n as a}from"./locale-store-BbwWB0ra.js";import{a as o,r as s}from"./product-delivery-BAks11S4.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{t as l}from"./skeleton-BwbyijEw.js";import{Rn as u}from"./index-qOHWhsEK.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=i(),r=a(h)===`zh`,m=s(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=c(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=r?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==r?(n=(0,p.jsx)(g,{message:t,zh:r}),e[0]=t,e[1]=r,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=o({...m,title:m.id,capabilities:[`open`]}),i;return e[3]!==t||e[4]!==r?(i=t?(0,p.jsx)(n,{to:t,replace:!0}):(0,p.jsx)(g,{message:r?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:r}),e[3]=t,e[4]=r,e[5]=i):i=e[5],i}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?r?`找不到这个应用,它可能已被删除。`:`This app was not found and may have been deleted.`:y instanceof Error?y.message:r?`无法打开这个应用。`:`Unable to open this app.`,n;return e[6]!==t||e[7]!==r?(n=(0,p.jsx)(g,{message:t,zh:r}),e[6]=t,e[7]=r,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let r;return e[11]===t?r=e[12]:(r=(0,p.jsx)(n,{to:t,replace:!0}),e[11]=t,e[12]=r),r}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:i}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=i?`查看应用`:`View apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(r,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{r as n,t as r,u as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{n as a}from"./locale-store-DId6-v2R.js";import{a as o,r as s}from"./product-delivery-BAks11S4.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{t as l}from"./skeleton-BwbyijEw.js";import{Rn as u}from"./index-BpXej9jJ.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=i(),r=a(h)===`zh`,m=s(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=c(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=r?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==r?(n=(0,p.jsx)(g,{message:t,zh:r}),e[0]=t,e[1]=r,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=o({...m,title:m.id,capabilities:[`open`]}),i;return e[3]!==t||e[4]!==r?(i=t?(0,p.jsx)(n,{to:t,replace:!0}):(0,p.jsx)(g,{message:r?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:r}),e[3]=t,e[4]=r,e[5]=i):i=e[5],i}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?r?`找不到这个应用,它可能已被删除。`:`This app was not found and may have been deleted.`:y instanceof Error?y.message:r?`无法打开这个应用。`:`Unable to open this app.`,n;return e[6]!==t||e[7]!==r?(n=(0,p.jsx)(g,{message:t,zh:r}),e[6]=t,e[7]=r,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let r;return e[11]===t?r=e[12]:(r=(0,p.jsx)(n,{to:t,replace:!0}),e[11]=t,e[12]=r),r}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:i}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=i?`查看应用`:`View apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(r,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};