@xopcai/xopc 0.0.363 → 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 (127) 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/{agent-avatar-dicebear-DkcXyPH0.js → agent-avatar-dicebear-7Ct-ZlfL.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-B-l5AaYN.js → agent-defaults-settings-panel-wYj-iyqv.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-plugin-dialog-BY6tPYOK.js → agent-plugin-dialog-C9HYMhnJ.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agents-CdSEoeje.js → agents-hPkFQ81z.js} +3 -3
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-BtD53cfe.js → app-management-settings-panel-CjfsIn9A.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-BAweWgX_.js → appearance-settings-qqHZ15GU.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-CS6-hrIB.js → apps-page-Ba2VkQk6.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automations-page-CtE8r9Y2.js → automations-page-Bt8Q58ut.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-workspace-pnMgR4Da.js → automations-workspace-Ch0ViAJW.js} +1 -1
  12. package/dist/gateway/static/root/assets/{block-editor-D5hf6WcP.js → block-editor-ClRFbHP7.js} +1 -1
  13. package/dist/gateway/static/root/assets/{browser-automations-page-PZDQlXH4.js → browser-automations-page-BjMub7JM.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-settings-page-2YDV-ZWt.js → browser-settings-page-CYrPA-Fp.js} +1 -1
  15. package/dist/gateway/static/root/assets/{capabilities-page-CB-iX3Fy.js → capabilities-page-dW6FXtOy.js} +2 -2
  16. package/dist/gateway/static/root/assets/{capabilities-settings-panel-BCTuWNaW.js → capabilities-settings-panel-gZ8auLwa.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capability-header-actions--aC5XB9E.js → capability-header-actions-L1NvoOUG.js} +1 -1
  18. package/dist/gateway/static/root/assets/{channels-JnAQP1bt.js → channels-Dx5T2G73.js} +1 -1
  19. package/dist/gateway/static/root/assets/{chat-terminal-dock-BFZEpvzn.js → chat-terminal-dock-DsCpKPBe.js} +1 -1
  20. package/dist/gateway/static/root/assets/{computer-settings-page-Dc9ooEM-.js → computer-settings-page-6FWwxYLe.js} +1 -1
  21. package/dist/gateway/static/root/assets/{connector-service-page-1_QB5D-t.js → connector-service-page-mtH9mEBf.js} +1 -1
  22. package/dist/gateway/static/root/assets/{connectors-page-Um_Jy5zh.js → connectors-page-DgDLaws0.js} +1 -1
  23. package/dist/gateway/static/root/assets/{date-picker-C9ZqTPui.js → date-picker-BDcwEaIx.js} +1 -1
  24. package/dist/gateway/static/root/assets/{dependency-picker-DBz0Pmyr.js → dependency-picker-B_fPQBTM.js} +1 -1
  25. package/dist/gateway/static/root/assets/{desktop-pet-BLtp2MmX.js → desktop-pet-CJrO9Vd_.js} +1 -1
  26. package/dist/gateway/static/root/assets/{desktop-pet-settings-BNGbqwec.js → desktop-pet-settings-DYAfri9w.js} +1 -1
  27. package/dist/gateway/static/root/assets/{device-pairing-wizard-7rdo-A7d.js → device-pairing-wizard-CqRys2R8.js} +1 -1
  28. package/dist/gateway/static/root/assets/{directory-picker-path-field-BnilGgwM.js → directory-picker-path-field-D7_qSxNZ.js} +1 -1
  29. package/dist/gateway/static/root/assets/{extension-page-DsrVktRN.js → extension-page-D1zBmd8F.js} +1 -1
  30. package/dist/gateway/static/root/assets/{extension-settings-page-jeb0ytRK.js → extension-settings-page-CTR8AjCG.js} +1 -1
  31. package/dist/gateway/static/root/assets/{fallback-models-bZcxkEDz.js → fallback-models-Chhv4Nfv.js} +1 -1
  32. package/dist/gateway/static/root/assets/{gateway-settings-A9SzLsGp.js → gateway-settings-BVfz4Tla.js} +1 -1
  33. package/dist/gateway/static/root/assets/{home-page-CnHzaH9K.js → home-page-BF_9C9yW.js} +1 -1
  34. package/dist/gateway/static/root/assets/{imports-page-CzpsV6Vz.js → imports-page-9EnECtcl.js} +1 -1
  35. package/dist/gateway/static/root/assets/{index-BYNmHn-z.js → index-BpXej9jJ.js} +5 -5
  36. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D90Dvlwo.js → keyboard-shortcuts-settings-MC7mG2h2.js} +1 -1
  37. package/dist/gateway/static/root/assets/{local-app-workbench-page-_9IKMkV8.js → local-app-workbench-page-CytNu0-_.js} +1 -1
  38. package/dist/gateway/static/root/assets/{local-apps-page-D6gejARs.js → local-apps-page-c3HncHZ3.js} +1 -1
  39. package/dist/gateway/static/root/assets/{logs-page--t8d-oLb.js → logs-page-D4aXtitd.js} +1 -1
  40. package/dist/gateway/static/root/assets/{management-settings-DVDmXzTg.js → management-settings-CRzWi_iJ.js} +1 -1
  41. package/dist/gateway/static/root/assets/{note-detail-panel-DuZAEfU1.js → note-detail-panel-BgbByI-4.js} +3 -3
  42. package/dist/gateway/static/root/assets/{notes-page-CgWNESGp.js → notes-page-R2BX5XCE.js} +1 -1
  43. package/dist/gateway/static/root/assets/{page-context-capture-button-Z72eiQZn.js → page-context-capture-button-RBp1QK0F.js} +1 -1
  44. package/dist/gateway/static/root/assets/{personal-page-BtMatL9a.js → personal-page-F0jTBWva.js} +1 -1
  45. package/dist/gateway/static/root/assets/{product-open-page-w5Hdf0hQ.js → product-open-page-BtDK68qb.js} +1 -1
  46. package/dist/gateway/static/root/assets/{project-detail-page-CP6I3ZCV.js → project-detail-page-DmQEm0yH.js} +1 -1
  47. package/dist/gateway/static/root/assets/{projects-page-DYs6XrrK.js → projects-page-CrLQvkHX.js} +1 -1
  48. package/dist/gateway/static/root/assets/{remote-access-hub-DjYoYAEw.js → remote-access-hub-C25_hQAd.js} +1 -1
  49. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Qar_DXLv.js → runtime-tools-settings-panel-B0c120iI.js} +1 -1
  50. package/dist/gateway/static/root/assets/{scenes-page-BSIcDCa-.js → scenes-page-DM64yMnx.js} +1 -1
  51. package/dist/gateway/static/root/assets/{schema-form-C_cJLGgF.js → schema-form-DQpQc9tH.js} +1 -1
  52. package/dist/gateway/static/root/assets/{sessions-page-BBV5Z24a.js → sessions-page-DvDO8LtA.js} +1 -1
  53. package/dist/gateway/static/root/assets/settings-advanced-gate-BNhgbmcX.js +1 -0
  54. package/dist/gateway/static/root/assets/{settings-page-F2vGXBw7.js → settings-page-GgBEp6O7.js} +1 -1
  55. package/dist/gateway/static/root/assets/{setup-status-panel-DJxbjUOg.js → setup-status-panel-10bMi6yL.js} +1 -1
  56. package/dist/gateway/static/root/assets/{shares-settings-CJa6FBpP.js → shares-settings-DJ1ME-XM.js} +1 -1
  57. package/dist/gateway/static/root/assets/{skill-api-C340XD9d.js → skill-api-1Puv6wOz.js} +1 -1
  58. package/dist/gateway/static/root/assets/{skills-page-C4lF94m5.js → skills-page-D52pEr5x.js} +1 -1
  59. package/dist/gateway/static/root/assets/{system-settings-panel-CmJUu3lb.js → system-settings-panel--yV67a8L.js} +1 -1
  60. package/dist/gateway/static/root/assets/{task-detail-page-De-Rr8W6.js → task-detail-page-D-tcS2bS.js} +1 -1
  61. package/dist/gateway/static/root/assets/{tunnel-api-Bl4nrCuE.js → tunnel-api-COLdiP_E.js} +1 -1
  62. package/dist/gateway/static/root/assets/{usage-page-QZEAaa8n.js → usage-page-CtM5IfrL.js} +1 -1
  63. package/dist/gateway/static/root/assets/{user-model-page-Crh2oNpZ.js → user-model-page-CSh61kZ5.js} +1 -1
  64. package/dist/gateway/static/root/assets/{work-discovery-overlay-9jnjEAaz.js → work-discovery-overlay-C9u7tuEc.js} +1 -1
  65. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BAcPxdcT.js → workflow-run-setup-panel-BMOBbf33.js} +1 -1
  66. package/dist/gateway/static/root/assets/{workflows-page-D8Zm-ooa.js → workflows-page-BrD9vXqO.js} +1 -1
  67. package/dist/gateway/static/root/index.html +1 -1
  68. package/dist/package.js +1 -1
  69. package/dist/src/agent/agent-manager.js +1 -1
  70. package/dist/src/agent/background-review/run-background-review.js +1 -1
  71. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  72. package/dist/src/agent/service.js +1 -1
  73. package/dist/src/agent/skills/index.js +1 -1
  74. package/dist/src/agent/skills/managed-store.js +1 -1
  75. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  76. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  77. package/dist/src/agent-catalog/capabilities.js +2 -2
  78. package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +1 -1
  79. package/dist/src/agent-catalog/repository.js +1 -1
  80. package/dist/src/automations/capabilities/drafts.js +1 -1
  81. package/dist/src/bootstrap/application-state.js +1 -1
  82. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  83. package/dist/src/capabilities/runtime/product.js +1 -1
  84. package/dist/src/cli/commands/agents.js +1 -1
  85. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  86. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  87. package/dist/src/cli/commands/models.js +1 -1
  88. package/dist/src/cli/commands/onboard/model.js +2 -2
  89. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  90. package/dist/src/config/agent-profile.js +1 -1
  91. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  92. package/dist/src/gateway/agents-admin.js +2 -2
  93. package/dist/src/gateway/hono/routes/agents.js +1 -1
  94. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  95. package/dist/src/gateway/hono/routes/notes.js +2 -2
  96. package/dist/src/gateway/hono/routes/projects.js +2 -2
  97. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  98. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  99. package/dist/src/gateway/image-generation-setup.js +1 -1
  100. package/dist/src/gateway/service.js +13 -5
  101. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  102. package/dist/src/home-intelligence/host.js +2 -2
  103. package/dist/src/local-apps/service.js +1 -1
  104. package/dist/src/personal-agent/communication.js +1 -1
  105. package/dist/src/personal-agent/reply-composer.d.ts +22 -0
  106. package/dist/src/personal-agent/reply-composer.js +276 -0
  107. package/dist/src/personal-agent/reply-style.d.ts +2 -0
  108. package/dist/src/personal-agent/reply-style.js +14 -0
  109. package/dist/src/personal-agent/request-delivery.d.ts +1 -1
  110. package/dist/src/personal-agent/request-delivery.js +18 -4
  111. package/dist/src/personal-agent/request-service.js +1 -1
  112. package/dist/src/personal-agent/service.js +10 -2
  113. package/dist/src/storage/sqlite/migrations/234_task_result_reply.sql +14 -0
  114. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  115. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  116. package/dist/src/storage/sqlite/schema.js +1 -1
  117. package/dist/src/tasks/capabilities/read.js +2 -2
  118. package/dist/src/tasks/task-result-delivery-service.js +20 -4
  119. package/dist/src/tui/backends/embedded-backend.js +1 -1
  120. package/dist/src/voice/realtime/agentBroker.js +11 -2
  121. package/dist/src/voice/realtime/agentEngine.js +18 -10
  122. package/dist/src/voice/realtime/omniEngine.js +11 -2
  123. package/dist/src/voice/realtime/persona-context.js +1 -1
  124. package/dist/src/voice/realtime/playback-echo.d.ts +7 -0
  125. package/dist/src/voice/realtime/playback-echo.js +23 -1
  126. package/package.json +4 -4
  127. package/dist/gateway/static/root/assets/settings-advanced-gate-DRc9IDJf.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-D5hf6WcP.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BYNmHn-z.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-DQZ51j9e.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-BMYIfy9x.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-DId6-v2R.js","assets/messages-BHvpZNe9.js","assets/cn-JdwAhgNB.js","assets/app-link-DRL0YnPs.js","assets/product-delivery-BAks11S4.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DSjfHfaW.css","assets/dist-Che_jiQF.js","assets/vendor-swr-BIWyz7Rc.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/check-DUBLcKHA.js","assets/chevron-right-BweFrslA.js","assets/popover-select-BgSdSbCL.js","assets/dist-C3DSFZCi.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/circle-check-C23XjkUj.js","assets/circle-dashed-8qMD7gHf.js","assets/circle-dot-BAseJTrF.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/cloud-C4-yfnnk.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/secret-input-DPl3VYM8.js","assets/eye-CABVeTq0.js","assets/loader-circle-CifKLtgG.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BdhHBbYa.js","assets/is-masked-secret-DOkL5b_X.js","assets/use-composer-attachments-DB0bBGzZ.js","assets/mic-CuUb7zc-.js","assets/use-file-preview-expanded-Bope6MW6.js","assets/folder-open-CyzJ19I9.js","assets/link-2-D_ZKYUW7.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/pencil-DmIY3Oa-.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/index.module-Cd9ENXfk.js","assets/session-api-N3N37MrR.js","assets/gateway-startup-retry-FDS6S6qa.js","assets/constants-Dy8Gw0sF.js","assets/app-chrome-BeB4KgOf.js","assets/attachment-utils-core-BIOUBrpT.js","assets/workspace-api-Cs4sjV2A.js","assets/files-Bw4SBGdM.js","assets/electron-env-Dit0bHgy.js","assets/use-async-resource-GrnWNwMZ.js","assets/activity-store-GvR2gZ0T.js","assets/share-link-dialog-TBBGJPfT.js","assets/globe-DSSGFWFn.js","assets/button-CS04eWY9.js","assets/copy-text-row-BHDs3cBa.js","assets/capabilities-CT_ZW9fT.js","assets/local-session-drafts-gbemPamv.js","assets/tasks-CH6KoBeY.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/shares-api-DU0fHP2G.js","assets/capabilities-BKu9BqPe.js","assets/git-branch-Dh9uxTot.js","assets/notes-api-Byt65v3r.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/settings-2-D-csvaET.js","assets/sparkles-DHlfQFAF.js","assets/middleware-Pd0e8Igk.js","assets/gateway-realtime-D0ygm6bc.js","assets/gateway-realtime-store-DBvCRclh.js","assets/extension-provider-F9JzOWZ3.js","assets/session-manager-CMGUwtbN.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-7F2WNEZC.js","assets/agents-admin-api-BkXb7VEZ.js","assets/gateway-config-swr-CoRoOG1l.js","assets/send-session-input-D1oc6BC6.js","assets/theme-store-OhcbFEUR.js","assets/loopi-Djb8XU3l.js","assets/loopi-C09I2mNj.css","assets/models-hub-cache-B9SKjidc.js","assets/oauth-api-BYsCbyGZ.js","assets/skill-api-utils-C7V4JVXM.js","assets/settings-form-draft-Dy10ldo8.js","assets/index-CbJNcWAn.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-1qg2v-9j.js","assets/block-editor-BdOTO0Yo.css","assets/markdown-editor-BhBJANcx.js","assets/code-editor-CXIH8jQw.js","assets/languages-BFe8nIOO.js"])))=>i.map(i=>d[i]);
2
- 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"./preload-helper-zJ_50EbN.js";import{f as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./bot-DjLkhyZL.js";import{s}from"./popover-select-BgSdSbCL.js";import{t as c}from"./ellipsis-0k4rZLoy.js";import{t as l}from"./eye-CABVeTq0.js";import{t as u}from"./markdown-view-DQZ51j9e.js";import{t as d}from"./message-square-plus-XP0tGdlV.js";import{t as f}from"./pencil-DmIY3Oa-.js";import{t as p}from"./plus-Q2yW6OE7.js";import{t as m}from"./rotate-ccw-JM1TBLpp.js";import{t as h}from"./sparkles-DHlfQFAF.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./messages-BHvpZNe9.js";import{t as v}from"./cn-JdwAhgNB.js";import{c as y,n as b}from"./locale-store-DId6-v2R.js";import{a as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./dist-BGTk37IG.js";import{i as O}from"./vendor-swr-BIWyz7Rc.js";import{t as k}from"./button-CS04eWY9.js";import{n as A}from"./interaction-BdhHBbYa.js";import{n as j,t as M}from"./registry-api-7F2WNEZC.js";import{c as N,i as P,n as F,o as I,r as L,s as R,t as z}from"./agents-admin-api-BkXb7VEZ.js";import{i as B}from"./theme-store-OhcbFEUR.js";import{t as V}from"./skeleton-BwbyijEw.js";import{i as H,o as U}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{An as W,Cc as G,Dn as ee,Do as K,Hs as q,Ls as J,Mn as Y,Mo as te,On as ne,Wi as re,Wr as ie,Xs as ae,ao as oe,bn as se,dn as ce,fn as le,ii as ue,kn as de,lc as fe,pn as pe,uo as me,yn as he}from"./index-BYNmHn-z.js";import{r as ge}from"./settings-page-layout-X1x-2Cp9.js";import{t as _e}from"./fallback-models-bZcxkEDz.js";import{r as ve}from"./image-generation-api-BPd76jW5.js";import{t as ye}from"./directory-picker-path-field-BnilGgwM.js";var X=e(t(),1),Z=n();function be(e){let t=e.match(/^(---\r?\n[\s\S]*?\r?\n---(?:\r?\n)*)/);return t?{frontMatter:t[1],body:e.slice(t[1].length)}:{frontMatter:``,body:e}}function xe(e,t){let{frontMatter:n}=be(e);return`${n}${t}`}var Se=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-ClRFbHP7.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BpXej9jJ.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-DQZ51j9e.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-BMYIfy9x.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-DId6-v2R.js","assets/messages-BHvpZNe9.js","assets/cn-JdwAhgNB.js","assets/app-link-DRL0YnPs.js","assets/product-delivery-BAks11S4.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DSjfHfaW.css","assets/dist-Che_jiQF.js","assets/vendor-swr-BIWyz7Rc.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/check-DUBLcKHA.js","assets/chevron-right-BweFrslA.js","assets/popover-select-BgSdSbCL.js","assets/dist-C3DSFZCi.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/circle-check-C23XjkUj.js","assets/circle-dashed-8qMD7gHf.js","assets/circle-dot-BAseJTrF.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/cloud-C4-yfnnk.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/secret-input-DPl3VYM8.js","assets/eye-CABVeTq0.js","assets/loader-circle-CifKLtgG.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BdhHBbYa.js","assets/is-masked-secret-DOkL5b_X.js","assets/use-composer-attachments-DB0bBGzZ.js","assets/mic-CuUb7zc-.js","assets/use-file-preview-expanded-Bope6MW6.js","assets/folder-open-CyzJ19I9.js","assets/link-2-D_ZKYUW7.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/pencil-DmIY3Oa-.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/index.module-Cd9ENXfk.js","assets/session-api-N3N37MrR.js","assets/gateway-startup-retry-FDS6S6qa.js","assets/constants-Dy8Gw0sF.js","assets/app-chrome-BeB4KgOf.js","assets/attachment-utils-core-BIOUBrpT.js","assets/workspace-api-Cs4sjV2A.js","assets/files-Bw4SBGdM.js","assets/electron-env-Dit0bHgy.js","assets/use-async-resource-GrnWNwMZ.js","assets/activity-store-GvR2gZ0T.js","assets/share-link-dialog-TBBGJPfT.js","assets/globe-DSSGFWFn.js","assets/button-CS04eWY9.js","assets/copy-text-row-BHDs3cBa.js","assets/capabilities-CT_ZW9fT.js","assets/local-session-drafts-gbemPamv.js","assets/tasks-CH6KoBeY.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/shares-api-DU0fHP2G.js","assets/capabilities-BKu9BqPe.js","assets/git-branch-Dh9uxTot.js","assets/notes-api-Byt65v3r.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/settings-2-D-csvaET.js","assets/sparkles-DHlfQFAF.js","assets/middleware-Pd0e8Igk.js","assets/gateway-realtime-D0ygm6bc.js","assets/gateway-realtime-store-DBvCRclh.js","assets/extension-provider-F9JzOWZ3.js","assets/session-manager-CMGUwtbN.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-7F2WNEZC.js","assets/agents-admin-api-BkXb7VEZ.js","assets/gateway-config-swr-CoRoOG1l.js","assets/send-session-input-D1oc6BC6.js","assets/theme-store-OhcbFEUR.js","assets/loopi-Djb8XU3l.js","assets/loopi-C09I2mNj.css","assets/models-hub-cache-B9SKjidc.js","assets/oauth-api-BYsCbyGZ.js","assets/skill-api-utils-C7V4JVXM.js","assets/settings-form-draft-Dy10ldo8.js","assets/index-CbJNcWAn.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-1qg2v-9j.js","assets/block-editor-BdOTO0Yo.css","assets/markdown-editor-BhBJANcx.js","assets/code-editor-CXIH8jQw.js","assets/languages-BFe8nIOO.js"])))=>i.map(i=>d[i]);
2
+ 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"./preload-helper-zJ_50EbN.js";import{f as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./bot-DjLkhyZL.js";import{s}from"./popover-select-BgSdSbCL.js";import{t as c}from"./ellipsis-0k4rZLoy.js";import{t as l}from"./eye-CABVeTq0.js";import{t as u}from"./markdown-view-DQZ51j9e.js";import{t as d}from"./message-square-plus-XP0tGdlV.js";import{t as f}from"./pencil-DmIY3Oa-.js";import{t as p}from"./plus-Q2yW6OE7.js";import{t as m}from"./rotate-ccw-JM1TBLpp.js";import{t as h}from"./sparkles-DHlfQFAF.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./messages-BHvpZNe9.js";import{t as v}from"./cn-JdwAhgNB.js";import{c as y,n as b}from"./locale-store-DId6-v2R.js";import{a as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./dist-BGTk37IG.js";import{i as O}from"./vendor-swr-BIWyz7Rc.js";import{t as k}from"./button-CS04eWY9.js";import{n as A}from"./interaction-BdhHBbYa.js";import{n as j,t as M}from"./registry-api-7F2WNEZC.js";import{c as N,i as P,n as F,o as I,r as L,s as R,t as z}from"./agents-admin-api-BkXb7VEZ.js";import{i as B}from"./theme-store-OhcbFEUR.js";import{t as V}from"./skeleton-BwbyijEw.js";import{i as H,o as U}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{An as W,Cc as G,Dn as ee,Do as K,Hs as q,Ls as J,Mn as Y,Mo as te,On as ne,Wi as re,Wr as ie,Xs as ae,ao as oe,bn as se,dn as ce,fn as le,ii as ue,kn as de,lc as fe,pn as pe,uo as me,yn as he}from"./index-BpXej9jJ.js";import{r as ge}from"./settings-page-layout-X1x-2Cp9.js";import{t as _e}from"./fallback-models-Chhv4Nfv.js";import{r as ve}from"./image-generation-api-BPd76jW5.js";import{t as ye}from"./directory-picker-path-field-D7_qSxNZ.js";var X=e(t(),1),Z=n();function be(e){let t=e.match(/^(---\r?\n[\s\S]*?\r?\n---(?:\r?\n)*)/);return t?{frontMatter:t[1],body:e.slice(t[1].length)}:{frontMatter:``,body:e}}function xe(e,t){let{frontMatter:n}=be(e);return`${n}${t}`}var Se=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
3
3
 
4
4
  ## Core Truths
5
5
 
@@ -63,4 +63,4 @@ Warm, friendly, and a little playful. Like a helpful friend who happens to know
63
63
 
64
64
  ## Vibe
65
65
 
66
- Sharp, direct, slightly nerdy. The kind of engineer you'd want on your team — competent, opinionated, and occasionally funny.`},{id:`custom`,labelEn:`Custom`,labelZh:`自定义`,emoji:`✍️`,content:``}],Ce=[{value:`AI assistant`,labelEn:`AI Assistant`,labelZh:`AI 助手`},{value:`robot`,labelEn:`Robot`,labelZh:`机器人`},{value:`familiar`,labelEn:`Familiar`,labelZh:`精灵`},{value:`ghost in the machine`,labelEn:`Ghost in the machine`,labelZh:`机器幽灵`},{value:`digital companion`,labelEn:`Digital Companion`,labelZh:`数字伙伴`}],Q=r(),we=()=>i(()=>import(`./block-editor-D5hf6WcP.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111])),Te=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([112,1,108,5,113,114,3])),Ee=(0,X.lazy)(()=>we().then(e=>({default:e.BlockEditor}))),De=(0,X.lazy)(()=>Te().then(e=>({default:e.MarkdownEditor}))),Oe=[`SOUL.md`,`TOOLS.md`,`AGENTS.md`],ke={"SOUL.md":``,"TOOLS.md":``,"AGENTS.md":``};function Ae(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`space-y-3 p-5`,"aria-busy":`true`,children:[(0,Q.jsx)(V,{className:`h-8 w-52`}),(0,Q.jsx)(V,{className:`h-4 w-full`}),(0,Q.jsx)(V,{className:`h-4 w-4/5`}),(0,Q.jsx)(V,{className:`h-4 w-11/12`})]}),e[0]=t):t=e[0],t}var je=(0,X.forwardRef)(function({agentId:e,zh:t,onDirtyChange:n},r){let i=B(e=>e.resolved===`dark`),[a,s]=(0,X.useState)(ke),[c,d]=(0,X.useState)(ke),[p,m]=(0,X.useState)(!0),[h,g]=(0,X.useState)(!1),[_,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(null),[S,C]=(0,X.useState)(`SOUL.md`),[w,T]=(0,X.useState)(`direct`);(0,X.useEffect)(()=>{let t=!1;return m(!0),g(!1),x(null),s({...ke}),d({...ke}),(async()=>{try{let n=await P(e),r=new Set(n.files.filter(e=>!e.missing).map(e=>e.name)),i=await Promise.all(Oe.map(async t=>[t,r.has(t)?await L(e,t):``]));if(t)return;let a={...ke};for(let[e,t]of i)a[e]=t;s(a),d(a)}catch(e){if(t)return;g(!0),x(e instanceof Error?e.message:String(e))}finally{t||m(!1)}})(),()=>{t=!0}},[e]);let E=(0,X.useMemo)(()=>Oe.some(e=>a[e]!==c[e]),[c,a]);(0,X.useEffect)(()=>n(E),[E,n]);let D=(0,X.useCallback)(async()=>{let t=Oe.filter(e=>a[e]!==c[e]);if(t.length!==0){y(!0),x(null);try{await Promise.all(t.map(t=>R(e,t,a[t]))),d({...a})}catch(e){throw x(e instanceof Error?e.message:String(e)),e}finally{y(!1)}}},[e,c,a]);(0,X.useImperativeHandle)(r,()=>({save:D}),[D]);let O={"SOUL.md":{label:t?`个性与边界`:`Personality & boundaries`,description:t?`定义语气、价值观、行为原则与安全边界。`:`Tone, values, behavior principles, and safety boundaries.`},"TOOLS.md":{label:t?`工具说明`:`Tool guidance`,description:t?`补充工具偏好和使用约定,不负责授予权限。`:`Tool preferences and conventions; this does not grant access.`},"AGENTS.md":{label:t?`工作规范`:`Working instructions`,description:t?`该智能体长期遵循的协作和执行规范。`:`Persistent collaboration and execution instructions.`}},k=[G,J,fe,f],A=be(a[S]).body;return(0,Q.jsx)(`div`,{className:`space-y-5`,children:(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-edge px-4 py-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(ae,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:t?`角色配置`:`Profile documents`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t?`三类角色文件均可编辑。默认使用所见即所得编辑器,熟悉 Markdown 时再切换源码。`:`All three profile documents are editable. The visual editor is the default; switch to Markdown source only when needed.`})]})]}),(0,Q.jsx)(`div`,{className:`mt-4 flex gap-1 overflow-x-auto`,role:`tablist`,"aria-label":t?`角色配置文件`:`Profile documents`,children:Oe.map(e=>(0,Q.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":S===e,onClick:()=>{C(e),T(`direct`)},className:v(`min-h-10 shrink-0 rounded-lg px-3 py-2 font-mono text-xs font-medium transition-colors`,S===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:e},e))})]}),(0,Q.jsxs)(`div`,{className:`p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:O[S].label}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:O[S].description})]}),(0,Q.jsx)(`div`,{className:`flex rounded-lg bg-surface-hover p-1`,role:`group`,"aria-label":t?`编辑模式`:`Editor mode`,children:[[`direct`,f,t?`直接编辑`:`Visual`],[`source`,fe,`Markdown`],[`preview`,l,t?`预览`:`Preview`]].map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>T(e),"aria-pressed":w===e,className:v(`inline-flex min-h-9 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,w===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))})]}),S===`SOUL.md`&&!p?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:t?`从模板开始`:`Start from a template`}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:Se.map((e,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{e.content&&s(t=>({...t,"SOUL.md":xe(t[`SOUL.md`],e.content)})),T(`direct`)},className:`flex min-h-11 items-center gap-2 rounded-xl border border-edge px-3 py-2 text-left text-xs font-medium text-fg-muted transition-colors hover:border-accent/40 hover:bg-surface-hover hover:text-fg`,children:[(0,Q.jsx)(k[n]??o,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t?e.labelZh:e.labelEn]},e.id))})]}):null,b?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,role:`alert`,children:b}):null,(0,Q.jsx)(`div`,{className:`mt-4 h-[min(40vh,22rem)] min-h-64 overflow-hidden rounded-xl border border-edge bg-surface-panel`,role:`tabpanel`,children:p?(0,Q.jsx)(Ae,{}):h?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-fg-muted`,children:t?`无法加载角色配置,未对文件进行任何更改。`:`Profile documents could not be loaded. No files were changed.`}):w===`direct`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(Ae,{}),children:(0,Q.jsx)(Ee,{initialContent:A,onChange:e=>s(t=>({...t,[S]:xe(t[S],e)})),placeholder:t?`直接输入内容,或输入 / 使用快捷命令…`:`Start writing, or type / for commands…`},`${e}-${S}-direct`)}):w===`source`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(Ae,{}),children:(0,Q.jsx)(De,{initialContent:a[S],onChange:e=>s(t=>({...t,[S]:e})),isDark:i,lineWrap:!0,className:`min-h-0 flex-1`},`${e}-${S}-source`)}):(0,Q.jsx)(`div`,{className:`h-full overflow-y-auto p-5`,children:A.trim()?(0,Q.jsx)(u,{content:A}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:t?`暂无内容。`:`No content yet.`})})}),(0,Q.jsx)(`div`,{className:`mt-2 flex justify-end text-xs text-fg-muted`,"aria-live":`polite`,children:_?t?`正在保存角色配置…`:`Saving profile documents…`:E?t?`角色配置有未保存的更改`:`Profile documents have unsaved changes`:t?`角色配置已保存`:`Profile documents saved`})]})]})})});function Me(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function Ne(e){let t=(0,Z.c)(74),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,modelKind:c,onChange:l}=e,u=o===void 0?!1:o,d=s===void 0?!1:s,f=c===void 0?`text`:c,p=i!=null,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[0]=m):m=t[0];let h=O(p&&f!==`image`?M:null,j,m),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[1]=g):g=t[1];let _=O(p&&f===`image`?`agent-defaults-image-models`:null,ve,g),v;t[2]===_.data?v=t[3]:(v=_.data??[],t[2]=_.data,t[3]=v);let y;t[4]===v?y=t[5]:(y=v.flatMap(Fe),t[4]=v,t[5]=y);let b=y,x;t[6]!==b||t[7]!==f||t[8]!==h?(x=f===`image`?b:h.data??[],t[6]=b,t[7]=f,t[8]=h,t[9]=x):x=t[9];let S=x,C;t[10]!==f||t[11]!==S?(C=f===`vision`?S.filter(Pe):S,t[10]=f,t[11]=S,t[12]=C):C=t[12];let w=C,T=f===`image`?_:h,E;t[13]===n?E=t[14]:(E=(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[13]=n,t[14]=E);let D;t[15]!==i||t[16]!==a?(D=i===void 0?(0,Q.jsx)(Me,{children:a?`继承`:`Inherited`}):null,t[15]=i,t[16]=a,t[17]=D):D=t[17];let A;t[18]!==d||t[19]!==i||t[20]!==a?(A=i===null?(0,Q.jsx)(Me,{children:d?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[18]=d,t[19]=i,t[20]=a,t[21]=A):A=t[21];let N;t[22]!==E||t[23]!==D||t[24]!==A?(N=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E,D,A]}),t[22]=E,t[23]=D,t[24]=A,t[25]=N):N=t[25];let P;t[26]!==r?.primary||t[27]!==i||t[28]!==a?(P=i===void 0?(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[26]=r?.primary,t[27]=i,t[28]=a,t[29]=P):P=t[29];let F;t[30]!==N||t[31]!==P?(F=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[N,P]}),t[30]=N,t[31]=P,t[32]=F):F=t[32];let I;t[33]!==l||t[34]!==i||t[35]!==a?(I=i===void 0?null:(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(void 0),children:a?`继承`:`Inherit`}),t[33]=l,t[34]=i,t[35]=a,t[36]=I):I=t[36];let L;t[37]!==u||t[38]!==l||t[39]!==i||t[40]!==a?(L=u&&i!==null?(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`使用 Chat`:`Use Chat`}):null,t[37]=u,t[38]=l,t[39]=i,t[40]=a,t[41]=L):L=t[41];let R;t[42]!==d||t[43]!==l||t[44]!==i||t[45]!==a?(R=d&&i!==null?(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`禁用`:`Disable`}):null,t[42]=d,t[43]=l,t[44]=i,t[45]=a,t[46]=R):R=t[46];let z;t[47]!==p||t[48]!==r?.fallbacks||t[49]!==r?.primary||t[50]!==l||t[51]!==a?(z=p?null:(0,Q.jsx)(k,{className:`px-2 py-1 text-xs`,onClick:()=>l({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`自定义`:`Customize`}),t[47]=p,t[48]=r?.fallbacks,t[49]=r?.primary,t[50]=l,t[51]=a,t[52]=z):z=t[52];let B;t[53]!==I||t[54]!==L||t[55]!==R||t[56]!==z?(B=(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[I,L,R,z]}),t[53]=I,t[54]=L,t[55]=R,t[56]=z,t[57]=B):B=t[57];let H;t[58]!==F||t[59]!==B?(H=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[F,B]}),t[58]=F,t[59]=B,t[60]=H):H=t[60];let U;t[61]!==w||t[62]!==p||t[63]!==n||t[64]!==f||t[65]!==S||t[66]!==l||t[67]!==T||t[68]!==i||t[69]!==a?(U=p?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:a?`主模型`:`Primary model`}),T.isLoading?(0,Q.jsx)(V,{className:`mt-1.5 h-11 w-full rounded-lg`}):(0,Q.jsx)(ie,{value:i.primary,models:S,modelsLoading:T.isLoading,modelsError:T.error,capabilitiesFilter:f===`vision`?`vision`:void 0,placeholder:a?`选择模型`:`Select a model`,searchPlaceholder:a?`搜索模型或服务商`:`Search models or providers`,noMatches:a?`没有匹配的模型`:`No matching models`,contentAlign:`start`,className:`mt-1.5 w-full`,ariaLabel:a?`${n}主模型`:`${n} primary model`,onChange:e=>l({...i,primary:e})})]}),(0,Q.jsx)(_e,{primary:i.primary,value:i.fallbacks,models:w,loading:T.isLoading,error:T.error,zh:a,onChange:e=>l({...i,fallbacks:e})})]}):null,t[61]=w,t[62]=p,t[63]=n,t[64]=f,t[65]=S,t[66]=l,t[67]=T,t[68]=i,t[69]=a,t[70]=U):U=t[70];let W;return t[71]!==H||t[72]!==U?(W=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[H,U]}),t[71]=H,t[72]=U,t[73]=W):W=t[73],W}function Pe(e){return e.vision}function Fe(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var Ie=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],$=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function Le(e){return[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))]}function Re(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function ze(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function Be(e){let t=(0,Z.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Q.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==i||t[8]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[s,i]}),t[7]=i,t[8]=s,t[9]=c):c=t[9],c}function Ve(e){let t=(0,Z.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`mt-2 truncate text-sm font-semibold text-fg`,title:r,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function He(e){return Object.values(e).some(e=>e!==void 0)?e:void 0}function Ue({agent:e,toolIds:t,zh:n,messages:r,externalError:i,onDirtyChange:a,onClose:s,onOpenDefaults:c,onChat:l,onDelete:u}){let[f,p]=(0,X.useState)(`overview`),[g,y]=(0,X.useState)(()=>structuredClone(e.override)),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(null),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(!1),O=(0,X.useRef)(null),A=JSON.stringify(g)!==JSON.stringify(e.override)||E,j=[g.models?.chat,...Object.values(g.models?.intents??{}),g.models?.imageUnderstanding,g.models?.imageGeneration].some(e=>e!=null&&!e.primary.trim());(0,X.useEffect)(()=>a(A),[A,a]);let M=(0,X.useMemo)(()=>[...new Set([...t,...Object.keys(e.effective.tools),...Object.keys(g.tools??{}),...g.toolAllowlist??[]])].sort(),[e.effective.tools,g.toolAllowlist,g.tools,t]),P=[g.models?n?`模型`:`Models`:null,g.skills?n?`技能`:`Skills`:null,g.tools?n?`工具权限`:`Tool access`:null,g.runtime||g.workflows?n?`运行限制`:`Runtime`:null].filter(e=>!!e),F=g.toolAllowlist,I=F?M.filter(t=>F.includes(t)&&e.effective.tools[t]?.mode!==`deny`).length:null,L=Object.values(e.effective.tools).filter(e=>e.mode===`deny`).length,R=e.effective.skills.mode===`selected`?n?`${e.effective.skills.include.length} 个已选技能`:`${e.effective.skills.include.length} selected skills`:n?`所有已启用技能`:`All enabled skills`,z=g.profile?.name??e.name??e.id,B=(t,n)=>{y(r=>({...r,profile:{...r.profile,name:r.profile?.name??e.name??e.id,[t]:n}}))},V=_(n?`zh`:`en`).chat.workingDirectory,H={fast:r.editorIntentFast,reasoning:r.editorIntentReasoning,coding:r.editorIntentCoding,review:r.editorIntentReview,vision:r.editorIntentVision,understanding:r.editorIntentUnderstanding},U={inherit:r.editorToolModeInherit,allow:r.editorToolModeAllow,ask:r.editorToolModeAsk,deny:r.editorToolModeDeny},W=async()=>{x(!0),C(null);try{await O.current?.save();let t=(await N(e.id,{workspace:g.workspace??null,profile:g.profile,models:g.models??null,skills:g.skills??null,tools:g.tools??null,toolAllowlist:g.toolAllowlist??null,workflows:g.workflows??null,runtime:g.runtime??null})).agents.find(t=>t.id===e.id);t&&y(structuredClone(t.override)),D(!1)}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}},G=async()=>{x(!0),C(null);try{await N(e.id,{setDefault:!0})}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}},ee=(e,t)=>{let n={...g.tools??{}};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},y({...g,tools:Object.keys(n).length>0?n:void 0})},K=(t,n)=>{let r=new Set(g.toolAllowlist??[]);n?r.add(t):r.delete(t);let i={...g.tools??{}};n&&(i[t]?.mode===`deny`||e.effective.tools[t]?.mode===`deny`)&&(i[t]={...i[t],mode:`allow`}),y({...g,toolAllowlist:[...r],tools:Object.keys(i).length>0?i:void 0})},J=(e,t)=>{let n={...g.models??{}},r={...n.intents??{}};t===void 0?delete r[e]:r[e]=t,Object.keys(r).length>0?n.intents=r:delete n.intents,y({...g,models:Object.keys(n).length>0?n:void 0})},Y=(0,X.useCallback)(e=>{D(e)},[]);return(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,Q.jsx)(`aside`,{className:`shrink-0 overflow-x-auto border-b border-edge px-3 py-3 sm:w-52 sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-3 sm:py-4`,children:(0,Q.jsx)(`nav`,{className:`flex gap-1 sm:flex-col`,children:[{id:`overview`,label:n?`概览`:`Overview`,icon:q},{id:`profile`,label:n?`个性`:`Profile`,icon:oe},{id:`models`,label:n?`模型`:`Models`,icon:h},{id:`capabilities`,label:n?`技能与工具`:`Skills & tools`,icon:o},{id:`runtime`,label:n?`运行限制`:`Runtime`,icon:q},{id:`danger`,label:n?`危险区`:`Danger zone`,icon:me}].map(({id:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{p(e),e===`profile`&&T(!0)},className:v(`flex shrink-0 items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm font-medium transition-colors`,f===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Q.jsx)(n,{className:`size-4`}),t]},e))})}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:[S||i?(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:S??i}):null,f===`overview`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(Be,{title:n?`配置概览`:`Configuration overview`,description:n?`查看当前真正生效的配置。未覆盖的部分会持续跟随全局默认值。`:`Review what actually takes effect. Anything not overridden keeps following global defaults.`,action:(0,Q.jsxs)(k,{onClick:l,children:[(0,Q.jsx)(d,{className:`size-4`}),n?`开始对话`:`Start chat`]})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-accent/20 bg-accent/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:P.length>0?n?`已自定义:${P.join(`、`)}`:`Customized: ${P.join(`, `)}`:n?`能力配置使用全局默认`:`Capabilities use global defaults`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:P.length>0?n?`其他能力会继续跟随全局默认配置。`:`All other capabilities continue to follow global defaults.`:n?`修改全局默认配置后,这个智能体会自动同步。`:`This agent updates automatically when global defaults change.`})]}),(0,Q.jsx)(k,{onClick:c,children:n?`查看全局默认配置`:`View global defaults`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsx)(Ve,{label:n?`对话模型`:`Chat model`,value:e.effective.models.chat.primary,detail:g.models?.chat?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(Ve,{label:n?`技能`:`Skills`,value:R,detail:g.skills?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(Ve,{label:n?`工具权限`:`Tool access`,value:I===null?L>0?n?`${L} 个禁用`:`${L} denied`:n?`全部可用`:`All available`:n?`${I} 个已开放`:`${I} in scope`,detail:F?n?`受智能体工具范围限制`:`Limited by agent tool scope`:g.tools?n?`${Object.keys(g.tools).length} 个本地覆盖`:`${Object.keys(g.tools).length} local overrides`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(Ve,{label:n?`工作区`:`Workspace`,value:e.effective.workspace,detail:g.workspace?n?`单独设置`:`Agent specific`:n?`自动工作区`:`Automatic workspace`})]}),e.isDefault?null:(0,Q.jsx)(k,{onClick:()=>void G(),disabled:b,children:n?`设为默认智能体`:`Make default agent`})]}):null,w?(0,Q.jsxs)(`div`,{className:v(`space-y-6`,f!==`profile`&&`hidden`),children:[(0,Q.jsx)(Be,{title:n?`身份、个性与工作区`:`Identity, behavior, and workspace`,description:n?`管理结构化身份资料、三类角色文件和工作目录。`:`Manage structured identity, three profile documents, and the working directory.`}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent`,children:(0,Q.jsx)(h,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`智能体身份`:`Agent identity`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`身份资料保存在智能体配置中,供界面、对话和语音共同使用。`:`Identity is saved in the Agent profile and shared by the UI, chat, and voice.`})]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`名称`:`Name`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:z,onChange:e=>B(`name`,e.target.value),placeholder:n?`例如:小助`:`e.g. Nova`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`一句话介绍`:`Description`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.description??``,onChange:e=>B(`description`,e.target.value),placeholder:n?`擅长什么、如何帮助你`:`What this agent is great at`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`类型`:`Type`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,list:`agent-creatures-${e.id}`,value:g.profile?.creature??``,onChange:e=>B(`creature`,e.target.value),placeholder:n?`AI 助手、研究伙伴…`:`AI assistant, research partner…`}),(0,Q.jsx)(`datalist`,{id:`agent-creatures-${e.id}`,children:Ce.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:n?e.labelZh:e.labelEn},e.value))})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`表达风格`:`Style`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.style??``,onChange:e=>B(`style`,e.target.value),placeholder:n?`例如:直接、温和`:`e.g. direct and warm`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`主要语言`:`Primary language`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.language??``,onChange:e=>B(`language`,e.target.value),placeholder:n?`例如:简体中文`:`e.g. English`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`签名表情`:`Signature emoji`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.emoji??``,onChange:e=>B(`emoji`,e.target.value),placeholder:`✨`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`头像地址`:`Avatar URL or path`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.avatar??``,onChange:e=>B(`avatar`,e.target.value),placeholder:n?`URL 或本地路径`:`URL or local path`})]})]})]}),(0,Q.jsx)(je,{ref:O,agentId:e.id,zh:n,onDirtyChange:Y}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作区`:`Workspace`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`选择这个智能体读写文件时使用的目录;留空则使用自动工作区。`:`Choose where this agent reads and writes files, or leave it empty to use the automatic workspace.`})]}),g.workspace?(0,Q.jsxs)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>y(e=>({...e,workspace:void 0})),children:[(0,Q.jsx)(m,{className:`size-3.5`}),n?`恢复自动`:`Use automatic`]}):(0,Q.jsx)(ze,{children:n?`自动`:`Automatic`})]}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(ye,{value:g.workspace??``,onChange:e=>y(t=>({...t,workspace:e||void 0})),wd:V,placeholder:e.effective.workspace,inputAriaLabel:n?`智能体工作区路径`:`Agent workspace path`,inputClassName:`${$} font-mono`,disabled:b})})]}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`附加指令`:`Additional instructions`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`补充简短的执行规则;个性与长期工作规范请写入上方角色配置。`:`Add short execution rules. Keep personality and lasting work guidance in the profile documents above.`}),(0,Q.jsx)(`textarea`,{rows:4,className:`${$} mt-4 resize-y leading-6`,value:g.profile?.instructions??``,onChange:t=>y(n=>({...n,profile:{...n.profile,name:n.profile?.name||e.name||e.id,instructions:t.target.value||void 0}})),placeholder:n?`可选:补充必须始终遵循的规则`:`Optional: add a rule that must always be followed`})]})]}):null,f===`models`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(Be,{title:n?`模型路由`:`Model routing`,description:n?`日常对话使用 Chat;固定意图只在对应任务中生效。默认继承全局。`:`Chat handles normal turns; fixed intents apply only to matching work. Everything inherits by default.`,action:g.models?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,models:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,Q.jsx)(Ne,{label:r.editorChatModel,inherited:e.effective.models.chat,value:g.models?.chat,zh:n,onChange:e=>{let t={...g.models??{}};e?t.chat=e:delete t.chat,y({...g,models:Object.keys(t).length>0?t:void 0})}}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`固定意图`:`Fixed intents`}),(0,Q.jsx)(`div`,{className:`space-y-3`,children:Ie.map(t=>(0,Q.jsx)(Ne,{label:H[t],inherited:e.effective.models.intents[t]??e.effective.models.chat,value:g.models?.intents?.[t],zh:n,allowChatFallback:!0,modelKind:t===`vision`?`vision`:`text`,onChange:e=>J(t,e)},t))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`图片能力`:`Image capabilities`}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(Ne,{label:n?`图片理解`:`Image understanding`,modelKind:`vision`,inherited:e.effective.models.imageUnderstanding,value:g.models?.imageUnderstanding,zh:n,allowDisabled:!0,onChange:e=>{let t={...g.models??{}};e===void 0?delete t.imageUnderstanding:t.imageUnderstanding=e,y({...g,models:Object.keys(t).length>0?t:void 0})}}),(0,Q.jsx)(Ne,{label:n?`图片生成`:`Image generation`,modelKind:`image`,inherited:e.effective.models.imageGeneration,value:g.models?.imageGeneration,zh:n,allowDisabled:!0,onChange:t=>{let n={...g.models??{}};t===void 0?delete n.imageGeneration:t===null?n.imageGeneration=null:n.imageGeneration={...t,timeoutMs:g.models?.imageGeneration?.timeoutMs??e.effective.models.imageGeneration?.timeoutMs,autoProviderFallback:g.models?.imageGeneration?.autoProviderFallback??e.effective.models.imageGeneration?.autoProviderFallback??!0},y({...g,models:Object.keys(n).length>0?n:void 0})}}),g.models?.imageGeneration?(0,Q.jsxs)(`div`,{className:`grid gap-4 rounded-2xl border border-edge bg-surface-base p-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,Q.jsx)(`input`,{type:`number`,min:1,className:`${$} mt-1.5`,value:g.models.imageGeneration.timeoutMs??``,onChange:e=>y({...g,models:{...g.models,imageGeneration:{...g.models.imageGeneration,timeoutMs:Re(e.target.value)}}})})]}),(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`提供商自动回退`:`Automatic provider fallback`}),(0,Q.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[!0,!1].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>y({...g,models:{...g.models,imageGeneration:{...g.models.imageGeneration,autoProviderFallback:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,g.models?.imageGeneration?.autoProviderFallback===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e?n?`开启`:`On`:n?`关闭`:`Off`},String(e)))})]})]}):null]})]})]}):null,f===`capabilities`?(0,Q.jsxs)(`div`,{className:`space-y-7`,children:[(0,Q.jsx)(Be,{title:n?`技能与工具`:`Skills and tools`,description:n?`默认继承全局能力;只设置确实不同的部分。`:`Keep inheritance for global capabilities; override only agents that genuinely differ.`}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`技能策略`:`Skill policy`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g.skills?n?`当前使用单独设置`:`Using an agent override`:n?`当前继承全局`:`Currently inherited globally`})]}),g.skills?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,skills:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),(0,Q.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Q.jsx)(k,{variant:g.skills?.mode===`merge`?`primary`:`secondary`,onClick:()=>y({...g,skills:{mode:`merge`,add:[],remove:[]}}),children:r.editorSkillModeMerge}),(0,Q.jsx)(k,{variant:g.skills?.mode===`replace`?`primary`:`secondary`,onClick:()=>y({...g,skills:{mode:`replace`,include:[]}}),children:r.editorSkillModeReplace})]}),g.skills?.mode===`merge`?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`新增技能`:`Add skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.skills.add.join(`, `),onChange:e=>y({...g,skills:{mode:`merge`,add:Le(e.target.value),remove:g.skills?.mode===`merge`?g.skills.remove:[]}})})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`移除技能`:`Remove skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.skills.remove.join(`, `),onChange:e=>y({...g,skills:{mode:`merge`,add:g.skills?.mode===`merge`?g.skills.add:[],remove:Le(e.target.value)}})})]})]}):null,g.skills?.mode===`replace`?(0,Q.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[n?`仅启用这些技能`:`Enable only these skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.skills.include.join(`, `),onChange:e=>y({...g,skills:{mode:`replace`,include:Le(e.target.value)}})})]}):null]}),(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工具权限`:`Tool permissions`}),g.tools?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,tools:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):null]}),F?(0,Q.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n?`此智能体使用限定的工具范围。可在下方启用或移除工具,保存后从下一轮对话生效。`:`This agent uses a limited tool set. Add or remove tools below; changes apply from the next conversation turn.`}):null,(0,Q.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:M.map(t=>{if(F&&!F.includes(t))return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`code`,{className:`text-xs text-fg-muted`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:n?`未开放`:`Unavailable`})]}),(0,Q.jsx)(k,{variant:`secondary`,className:`px-3 py-1.5 text-xs`,onClick:()=>K(t,!0),children:n?`启用`:`Enable`})]},t);let r=g.tools?.[t]?.mode,i=e.effective.tools[t]?.mode??`allow`;return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`code`,{className:`text-xs text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:r?n?`单独设置`:`Agent override`:`${n?`继承`:`Inherits`} ${U[i]}`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`flex rounded-xl bg-surface-hover p-1`,children:[`inherit`,`allow`,`ask`,`deny`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>ee(t,e),className:v(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,(e===`inherit`?!r:r===e)?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:U[e]},e))}),F?(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1.5 text-xs`,onClick:()=>K(t,!1),children:n?`移除`:`Remove`}):null]})]},t)})})]})]}):null,f===`runtime`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(Be,{title:n?`运行限制`:`Runtime limits`,description:n?`留空即继承全局限制。`:`Leave blank to inherit global limits. Use overrides only to tighten or relax a specialist agent.`,action:g.runtime||g.workflows?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,runtime:void 0,workflows:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,Q.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[[`maxTurns`,n?`单次最大轮数`:`Maximum turns`],[`timeoutMs`,n?`单轮超时(毫秒)`:`Turn timeout (ms)`],[`maxToolFailuresPerTurn`,n?`最大工具失败次数`:`Maximum tool failures`]].map(([t,r])=>(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r,g.runtime?.[t]===void 0?(0,Q.jsx)(ze,{children:n?`继承`:`Inherited`}):null]}),(0,Q.jsx)(`input`,{type:`number`,min:1,className:`${$} mt-1.5`,value:g.runtime?.[t]??``,placeholder:String(e.effective.runtime[t]??``),onChange:e=>{let n=He({...g.runtime??{},[t]:Re(e.target.value)});y({...g,runtime:n})}})]},t))}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作流`:`Workflows`}),(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`默认工作流`:`Default workflow`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.workflows?.default??``,placeholder:e.effective.workflows.default,onChange:e=>{let t=He({...g.workflows??{},default:e.target.value||void 0});y({...g,workflows:t})}})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`允许的工作流`:`Allowed workflows`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.workflows?.allowed?.join(`, `)??``,placeholder:e.effective.workflows.allowed?.join(`, `),onChange:e=>{let t=Le(e.target.value),n=He({...g.workflows??{},allowed:t.length>0?t:void 0});y({...g,workflows:n})}})]})]})]}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`提示词缓存`:`Prompt cache`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g.runtime?.promptCache?n?`使用单独设置`:`Using agent override`:n?`继承全局`:`Inherited globally`})]}),g.runtime?.promptCache?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>{let e=He({...g.runtime??{},promptCache:void 0});y({...g,runtime:e})},children:[(0,Q.jsx)(m,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),g.runtime?.promptCache?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`模式`:`Mode`}),(0,Q.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`auto`,`off`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>y({...g,runtime:{...g.runtime,promptCache:{...g.runtime.promptCache,mode:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,g.runtime?.promptCache?.mode===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`auto`?r.editorCacheModeAuto:r.editorCacheModeOff},e))})]}),(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`缓存周期`:`Lifetime`}),(0,Q.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`short`,`long`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>y({...g,runtime:{...g.runtime,promptCache:{...g.runtime.promptCache,lifetime:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,g.runtime?.promptCache?.lifetime===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`short`?r.editorCacheLifetimeShort:r.editorCacheLifetimeLong},e))})]})]}):(0,Q.jsx)(k,{className:`mt-4`,onClick:()=>y({...g,runtime:{...g.runtime,promptCache:{...e.effective.runtime.promptCache??{mode:`auto`,lifetime:`short`}}}}),children:n?`自定义缓存策略`:`Customize cache policy`})]})]}):null,f===`danger`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(Be,{title:n?`危险区`:`Danger zone`,description:n?`这些操作会改变默认路由或移除智能体。`:`These actions change default routing or remove the agent.`}),e.isDefault?null:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`设为默认智能体`:`Make default agent`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`新会话和未指定路由将使用这个智能体。`:`New sessions and unspecified routes will use this agent.`})]}),(0,Q.jsx)(k,{disabled:b,onClick:()=>void G(),children:n?`设为默认`:`Make default`})]}),e.isDefault?(0,Q.jsx)(`p`,{className:`rounded-2xl bg-surface-base p-4 text-sm text-fg-muted`,children:n?`默认智能体不能删除,请先将其他智能体设为默认。`:`The default agent cannot be deleted. Make another agent the default first.`}):(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-red-500/25 bg-red-500/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-red-600`,children:n?`删除智能体`:`Delete agent`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`配置条目会被移除,删除前仍会再次确认。`:`The configuration entry will be removed after confirmation.`})]}),(0,Q.jsxs)(k,{variant:`ghost`,className:`text-red-600`,onClick:u,children:[(0,Q.jsx)(me,{className:`size-4`}),n?`删除`:`Delete`]})]})]}):null]}),(0,Q.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge bg-surface-panel px-5 py-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:j?n?`请补全自定义模型`:`Complete the custom model reference`:A?n?`有未保存的更改`:`Unsaved changes`:n?`所有更改已保存`:`All changes saved`}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(k,{onClick:s,children:n?`关闭`:`Close`}),(0,Q.jsx)(k,{variant:`primary`,disabled:b||!A||j||g.profile!==void 0&&!g.profile.name.trim(),onClick:()=>void W(),children:b?n?`保存中…`:`Saving…`:n?`保存更改`:`Save changes`})]})]})]})]})}function We(e){let t=(0,Z.c)(36),{agent:n,messages:r,open:i,onOpenChange:a,children:o}=e,[c,l]=(0,X.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(x,{className:v(`xopc-dialog-overlay fixed inset-0 bg-scrim`,U)}),t[0]=u):u=t[0];let d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=v(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,H,`inset-3 h-[calc(100dvh-1.5rem)] min-h-0 sm:inset-auto sm:left-1/2 sm:top-1/2`,`sm:h-[min(88vh,48rem)] sm:w-[min(94vw,62rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=d):d=t[1];let f;t[2]!==n.avatar||t[3]!==n.id?(f=(0,Q.jsx)(re,{agentId:n.id,avatar:n.avatar,size:42,className:`size-11 shrink-0`}),t[2]=n.avatar,t[3]=n.id,t[4]=f):f=t[4];let p;t[5]!==n||t[6]!==r?(p=le(n,r),t[5]=n,t[6]=r,t[7]=p):p=t[7];let m;t[8]===p?m=t[9]:(m=(0,Q.jsx)(E,{className:`truncate text-base font-semibold text-fg`,children:p}),t[8]=p,t[9]=m);let h;t[10]===n.id?h=t[11]:(h=(0,Q.jsx)(S,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,children:n.id}),t[10]=n.id,t[11]=h);let _;t[12]!==m||t[13]!==h?(_=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=_):_=t[14];let y;t[15]!==n.isDefault||t[16]!==r.listDefaultBadge?(y=n.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent`,children:r.listDefaultBadge}):null,t[15]=n.isDefault,t[16]=r.listDefaultBadge,t[17]=y):y=t[17];let b;t[18]!==f||t[19]!==_||t[20]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[f,_,y]}),t[18]=f,t[19]=_,t[20]=y,t[21]=b):b=t[21];let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(g,{className:`size-4`}),t[22]=O):O=t[22];let k;t[23]===r.closeDialogAria?k=t[24]:(k=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":r.closeDialogAria,children:O})}),t[23]=r.closeDialogAria,t[24]=k);let A;t[25]!==k||t[26]!==b?(A=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-edge px-5 py-4`,children:[b,k]}),t[25]=k,t[26]=b,t[27]=A):A=t[27];let j;t[28]!==o||t[29]!==c||t[30]!==A?(j=(0,Q.jsxs)(w,{children:[u,(0,Q.jsx)(T,{ref:l,className:d,onOpenAutoFocus:Ge,children:(0,Q.jsxs)(s,{layer:`modal`,portalContainer:c,children:[A,o]})})]}),t[28]=o,t[29]=c,t[30]=A,t[31]=j):j=t[31];let M;return t[32]!==a||t[33]!==i||t[34]!==j?(M=(0,Q.jsx)(D,{open:i,onOpenChange:a,children:j}),t[32]=a,t[33]=i,t[34]=j,t[35]=M):M=t[35],M}function Ge(e){return e.preventDefault()}function Ke(e){let t=(0,Z.c)(13),{agents:n,busy:r,messages:i,onOpen:a,onChat:o}=e,s;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==o||t[4]!==a){let e;t[6]!==r||t[7]!==i||t[8]!==o||t[9]!==a?(e=e=>{let t=le(e,i),n=ce(e,i);return(0,Q.jsx)(`li`,{className:`min-h-0`,children:(0,Q.jsxs)(`article`,{className:v(`group relative flex min-h-52 flex-col rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface`,`transition-[transform,background-color,border-color] duration-200 ease-out hover:-translate-y-0.5 hover:border-accent/30 hover:bg-surface-hover/35 active:scale-[0.99] motion-reduce:transform-none`),children:[(0,Q.jsx)(`button`,{type:`button`,disabled:r,"aria-label":i.listConfigureAgent.replace(`{{name}}`,t),onClick:()=>a(e.id),className:`absolute inset-0 z-0 rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,Q.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(re,{agentId:e.id,avatar:e.avatar,size:48,className:`size-12 shrink-0`}),(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t})})]}),(0,Q.jsx)(`span`,{className:v(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.isDefault?`bg-accent-soft text-accent`:`bg-surface-hover text-fg-muted`),children:e.isDefault?i.listDefaultBadge:i.listCustomBadge})]}),(0,Q.jsx)(`p`,{className:`pointer-events-none relative z-10 mt-5 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:n||e.override.profile?.instructions||i.listUsesGlobalSettings}),(0,Q.jsxs)(`div`,{className:`pointer-events-none relative z-10 mt-4 rounded-xl bg-surface-base px-3 py-2.5`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:i.listCurrentModelLabel}),(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg`,children:e.effective.models.chat.primary})]}),(0,Q.jsx)(`div`,{className:`relative z-10 mt-auto pt-4`,children:(0,Q.jsxs)(k,{className:`w-full`,disabled:r,onClick:t=>{t.stopPropagation(),o(e.id)},children:[(0,Q.jsx)(d,{className:`size-4`}),i.listChatWithAgent]})})]})},e.id)},t[6]=r,t[7]=i,t[8]=o,t[9]=a,t[10]=e):e=t[10],s=n.map(e),t[0]=n,t[1]=r,t[2]=i,t[3]=o,t[4]=a,t[5]=s}else s=t[5];let c;return t[11]===s?c=t[12]:(c=(0,Q.jsx)(`ul`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:s}),t[11]=s,t[12]=c),c}var qe=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function Je(e){let t=(0,Z.c)(79),{draft:n,busy:r,error:i,messages:a,workingDirectoryMessages:o,onChange:s,onCreate:c,onOpenChange:l}=e,u=n.open,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(x,{className:v(`xopc-dialog-overlay fixed inset-0 bg-scrim`,U)}),t[0]=d):d=t[0];let f;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=v(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(38rem,calc(100dvh-2rem))] w-[min(92vw,36rem)] -translate-x-1/2 -translate-y-1/2 flex-col`,`overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,H),t[1]=f):f=t[1];let p;t[2]===a.manualCreateTitle?p=t[3]:(p=(0,Q.jsx)(E,{className:`text-base font-semibold text-fg`,children:a.manualCreateTitle}),t[2]=a.manualCreateTitle,t[3]=p);let m;t[4]===a.manualCreateDescription?m=t[5]:(m=(0,Q.jsx)(S,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:a.manualCreateDescription}),t[4]=a.manualCreateDescription,t[5]=m);let h;t[6]!==p||t[7]!==m?(h=(0,Q.jsxs)(`div`,{children:[p,m]}),t[6]=p,t[7]=m,t[8]=h):h=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[9]=_):_=t[9];let y;t[10]===a.manualCreateClose?y=t[11]:(y=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`touch-target shrink-0 rounded-lg p-2 text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a.manualCreateClose,children:_})}),t[10]=a.manualCreateClose,t[11]=y);let b;t[12]!==h||t[13]!==y?(b=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[h,y]}),t[12]=h,t[13]=y,t[14]=b):b=t[14];let O;t[15]===i?O=t[16]:(O=i?(0,Q.jsx)(`p`,{role:`alert`,className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:i}):null,t[15]=i,t[16]=O);let A;t[17]===s?A=t[18]:(A=e=>s({name:e.target.value}),t[17]=s,t[18]=A);let j;t[19]!==n.name||t[20]!==a.manualCreateNamePlaceholder||t[21]!==A?(j=(0,Q.jsx)(`input`,{id:`manual-agent-name`,autoFocus:!0,className:`${qe} mt-1.5`,value:n.name,onChange:A,placeholder:a.manualCreateNamePlaceholder}),t[19]=n.name,t[20]=a.manualCreateNamePlaceholder,t[21]=A,t[22]=j):j=t[22];let M;t[23]!==a.manualCreateName||t[24]!==j?(M=(0,Q.jsxs)(`label`,{htmlFor:`manual-agent-name`,className:`block text-xs font-medium text-fg-muted`,children:[a.manualCreateName,j]}),t[23]=a.manualCreateName,t[24]=j,t[25]=M):M=t[25];let N;t[26]===s?N=t[27]:(N=e=>s({instructions:e.target.value}),t[26]=s,t[27]=N);let P;t[28]!==n.instructions||t[29]!==a.manualCreateInstructionsPlaceholder||t[30]!==N?(P=(0,Q.jsx)(`textarea`,{id:`manual-agent-instructions`,rows:4,className:`${qe} mt-1.5 resize-y leading-6`,value:n.instructions,onChange:N,placeholder:a.manualCreateInstructionsPlaceholder}),t[28]=n.instructions,t[29]=a.manualCreateInstructionsPlaceholder,t[30]=N,t[31]=P):P=t[31];let F;t[32]!==a.manualCreateInstructions||t[33]!==P?(F=(0,Q.jsxs)(`label`,{htmlFor:`manual-agent-instructions`,className:`block text-xs font-medium text-fg-muted`,children:[a.manualCreateInstructions,P]}),t[32]=a.manualCreateInstructions,t[33]=P,t[34]=F):F=t[34];let I;t[35]===a.manualCreateWorkspace?I=t[36]:(I=(0,Q.jsx)(`label`,{htmlFor:`manual-agent-workspace`,className:`block text-xs font-medium text-fg-muted`,children:a.manualCreateWorkspace}),t[35]=a.manualCreateWorkspace,t[36]=I);let L;t[37]===a.manualCreateWorkspaceHint?L=t[38]:(L=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:a.manualCreateWorkspaceHint}),t[37]=a.manualCreateWorkspaceHint,t[38]=L);let R;t[39]===s?R=t[40]:(R=e=>s({workspace:e}),t[39]=s,t[40]=R);let z;t[41]!==r||t[42]!==n.workspace||t[43]!==a.manualCreateWorkspace||t[44]!==a.manualCreateWorkspacePlaceholder||t[45]!==R||t[46]!==o?(z=(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(ye,{value:n.workspace,onChange:R,disabled:r,wd:o,placeholder:a.manualCreateWorkspacePlaceholder,inputAriaLabel:a.manualCreateWorkspace,inputClassName:`${qe} font-mono`})}),t[41]=r,t[42]=n.workspace,t[43]=a.manualCreateWorkspace,t[44]=a.manualCreateWorkspacePlaceholder,t[45]=R,t[46]=o,t[47]=z):z=t[47];let B;t[48]!==I||t[49]!==L||t[50]!==z?(B=(0,Q.jsxs)(`div`,{children:[I,L,z]}),t[48]=I,t[49]=L,t[50]=z,t[51]=B):B=t[51];let V;t[52]!==O||t[53]!==M||t[54]!==F||t[55]!==B?(V=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[O,M,F,B]}),t[52]=O,t[53]=M,t[54]=F,t[55]=B,t[56]=V):V=t[56];let W;t[57]!==r||t[58]!==a.manualCreateCancel?(W=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(k,{disabled:r,children:a.manualCreateCancel})}),t[57]=r,t[58]=a.manualCreateCancel,t[59]=W):W=t[59];let G;t[60]!==r||t[61]!==n.name?(G=r||!n.name.trim(),t[60]=r,t[61]=n.name,t[62]=G):G=t[62];let ee=r?a.manualCreating:a.manualCreateSubmit,K;t[63]!==r||t[64]!==c||t[65]!==G||t[66]!==ee?(K=(0,Q.jsx)(k,{variant:`primary`,disabled:G,"aria-busy":r,onClick:c,children:ee}),t[63]=r,t[64]=c,t[65]=G,t[66]=ee,t[67]=K):K=t[67];let q;t[68]!==W||t[69]!==K?(q=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[W,K]}),t[68]=W,t[69]=K,t[70]=q):q=t[70];let J;t[71]!==V||t[72]!==q||t[73]!==b?(J=(0,Q.jsxs)(w,{children:[d,(0,Q.jsxs)(T,{className:f,children:[b,V,q]})]}),t[71]=V,t[72]=q,t[73]=b,t[74]=J):J=t[74];let Y;return t[75]!==n.open||t[76]!==l||t[77]!==J?(Y=(0,Q.jsx)(D,{open:u,onOpenChange:l,children:J}),t[75]=n.open,t[76]=l,t[77]=J,t[78]=Y):Y=t[78],Y}var Ye=`px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,Xe=`max-w-7xl`;function Ze(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(V,{className:`h-7 w-28`}),(0,Q.jsx)(V,{className:`h-4 w-80 max-w-full`})]}),(0,Q.jsx)(V,{className:`h-9 w-28`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(ge,{gap:`gap-5`,padding:Ye,className:Xe,children:[t,(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(Qe)})]}),e[1]=n):n=e[1],n}function Qe(e){return(0,Q.jsx)(V,{className:`h-64 rounded-2xl`},e)}function $e({agentId:e,onHeaderActionChange:t}){let n=y(e=>e.conversationId),r=b(e=>e.language),i=r===`zh`,o=_(r),s=o.agentsSettings,l=a(),{data:u,error:d,isLoading:f,mutate:m}=O(n?`settings-gateway-agents`:null,I),[h,g]=(0,X.useState)(!1),[x,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(null),[T,E]=(0,X.useState)(null),[D,j]=(0,X.useState)({open:!1,name:``,instructions:``,workspace:``}),M=(0,X.useRef)(!1),N=u?.agents.find(t=>t.id===e),P=(0,X.useCallback)(()=>{u&&(S(null),pe(u.defaultId),l(`/chat/new?${new URLSearchParams({agentSetup:`1`,projectScope:`none`,draft:s.setupDraftPrefix}).toString()}`,{state:{forceNewChat:!0,agentId:u.defaultId}}))},[s.setupDraftPrefix,u,l]),L=(0,X.useCallback)(async()=>{if(!(h||!D.name.trim())){g(!0),w(null);try{let e=await z({profile:{name:D.name.trim(),...D.instructions.trim()?{instructions:D.instructions.trim()}:{}},...D.workspace.trim()?{workspace:D.workspace.trim()}:{}});j({open:!1,name:``,instructions:``,workspace:``}),pe(e.createdAgentId),l(`/chat/new?projectScope=none`,{state:{forceNewChat:!0,agentId:e.createdAgentId}})}catch(e){w(e instanceof Error?e.message:String(e))}finally{g(!1)}}},[h,D,l]),R=(0,X.useMemo)(()=>({overflow:(0,Q.jsxs)(W,{children:[(0,Q.jsx)(Y,{asChild:!0,children:(0,Q.jsx)(k,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":o.capabilitiesHub.moreActions,title:o.capabilitiesHub.moreActions,children:(0,Q.jsx)(c,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(de,{children:(0,Q.jsxs)(ee,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Q.jsxs)(ne,{className:v(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,A.transition),onSelect:()=>l(`/settings/agent-defaults`),children:[(0,Q.jsx)(te,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i?`全局默认配置`:`Global defaults`]}),(0,Q.jsxs)(ne,{className:v(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,A.transition),onSelect:()=>{w(null),j(e=>({...e,open:!0}))},children:[(0,Q.jsx)(K,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),s.manualCreateMenu]})]})})]}),primary:(0,Q.jsxs)(k,{variant:`primary`,className:`shrink-0`,"aria-label":s.listNewAgentCard,onClick:P,children:[(0,Q.jsx)(p,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:s.listNewAgentCard})]})}),[s.listNewAgentCard,s.manualCreateMenu,o.capabilitiesHub.moreActions,l,P,i]);(0,X.useLayoutEffect)(()=>(t?.(R),()=>t?.(null)),[R,t]);let B=async e=>{g(!0),S(null);try{await F(e.id),l(he)}catch(e){S(e instanceof Error?e.message:String(e))}finally{g(!1)}},V=e=>{pe(e),l(`/chat/new`)},H=e=>{M.current=!1,window.setTimeout(()=>l(se(e)),0)},U=()=>{if(M.current){E({kind:`discard`,destination:he});return}M.current=!1,l(he)},G=()=>{if(M.current){E({kind:`discard`,destination:`/settings/agent-defaults`});return}M.current=!1,l(`/settings/agent-defaults`)},q=()=>{if(!T)return;if(E(null),T.kind===`discard`){M.current=!1,l(T.destination);return}let e=u?.agents.find(e=>e.id===T.agentId);e&&B(e)},J=(0,X.useCallback)(e=>{M.current=e},[]);return n?d&&!u?(0,Q.jsxs)(ge,{className:Xe,padding:Ye,children:[(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:String(d)}),(0,Q.jsx)(k,{onClick:()=>void m(),children:i?`重试`:`Retry`})]}):f||!u?(0,Q.jsx)(Ze,{}):(0,Q.jsxs)(ge,{gap:`gap-5`,className:Xe,padding:Ye,children:[(d||x)&&!N?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:x??String(d)}):null,(0,Q.jsx)(Ke,{agents:u.agents,busy:h,messages:s,onOpen:H,onChat:V}),N?(0,Q.jsx)(We,{agent:N,messages:s,open:!0,onOpenChange:e=>{e||U()},children:(0,Q.jsx)(Ue,{agent:N,toolIds:u.builtinToolIds,zh:i,messages:s,externalError:x,onDirtyChange:J,onClose:U,onOpenDefaults:G,onChat:()=>V(N.id),onDelete:()=>E({kind:`delete`,agentId:N.id,displayName:le(N,s)})},N.id)}):null,(0,Q.jsx)(Je,{draft:D,busy:h,error:C,messages:s,workingDirectoryMessages:o.chat.workingDirectory,onChange:e=>j(t=>({...t,...e})),onCreate:()=>void L(),onOpenChange:e=>{h||(j(t=>({...t,open:e})),e||w(null))}}),(0,Q.jsx)(ue,{open:T!==null,title:T?.kind===`delete`?i?`删除智能体?`:`Delete agent?`:i?`放弃未保存的更改?`:`Discard unsaved changes?`,description:T?.kind===`delete`?i?`删除 ${T.displayName}?此操作无法撤销。`:`Delete ${T.displayName}? This cannot be undone.`:i?`当前更改尚未保存,离开后将丢失。`:`Your changes have not been saved. Leaving will discard them.`,confirmLabel:T?.kind===`delete`?i?`删除`:`Delete`:i?`放弃并离开`:`Discard and leave`,cancelLabel:i?`继续编辑`:`Keep editing`,destructive:!0,overlayClassName:`z-[100]`,contentClassName:`z-[101]`,onConfirm:q,onCancel:()=>E(null)})]}):(0,Q.jsx)(ge,{className:Xe,padding:Ye,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i?`需要本机服务令牌。`:`Local service token required.`})})}export{$e as AgentsSettingsPanel};
66
+ Sharp, direct, slightly nerdy. The kind of engineer you'd want on your team — competent, opinionated, and occasionally funny.`},{id:`custom`,labelEn:`Custom`,labelZh:`自定义`,emoji:`✍️`,content:``}],Ce=[{value:`AI assistant`,labelEn:`AI Assistant`,labelZh:`AI 助手`},{value:`robot`,labelEn:`Robot`,labelZh:`机器人`},{value:`familiar`,labelEn:`Familiar`,labelZh:`精灵`},{value:`ghost in the machine`,labelEn:`Ghost in the machine`,labelZh:`机器幽灵`},{value:`digital companion`,labelEn:`Digital Companion`,labelZh:`数字伙伴`}],Q=r(),we=()=>i(()=>import(`./block-editor-ClRFbHP7.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111])),Te=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([112,1,108,5,113,114,3])),Ee=(0,X.lazy)(()=>we().then(e=>({default:e.BlockEditor}))),De=(0,X.lazy)(()=>Te().then(e=>({default:e.MarkdownEditor}))),Oe=[`SOUL.md`,`TOOLS.md`,`AGENTS.md`],ke={"SOUL.md":``,"TOOLS.md":``,"AGENTS.md":``};function Ae(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`space-y-3 p-5`,"aria-busy":`true`,children:[(0,Q.jsx)(V,{className:`h-8 w-52`}),(0,Q.jsx)(V,{className:`h-4 w-full`}),(0,Q.jsx)(V,{className:`h-4 w-4/5`}),(0,Q.jsx)(V,{className:`h-4 w-11/12`})]}),e[0]=t):t=e[0],t}var je=(0,X.forwardRef)(function({agentId:e,zh:t,onDirtyChange:n},r){let i=B(e=>e.resolved===`dark`),[a,s]=(0,X.useState)(ke),[c,d]=(0,X.useState)(ke),[p,m]=(0,X.useState)(!0),[h,g]=(0,X.useState)(!1),[_,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(null),[S,C]=(0,X.useState)(`SOUL.md`),[w,T]=(0,X.useState)(`direct`);(0,X.useEffect)(()=>{let t=!1;return m(!0),g(!1),x(null),s({...ke}),d({...ke}),(async()=>{try{let n=await P(e),r=new Set(n.files.filter(e=>!e.missing).map(e=>e.name)),i=await Promise.all(Oe.map(async t=>[t,r.has(t)?await L(e,t):``]));if(t)return;let a={...ke};for(let[e,t]of i)a[e]=t;s(a),d(a)}catch(e){if(t)return;g(!0),x(e instanceof Error?e.message:String(e))}finally{t||m(!1)}})(),()=>{t=!0}},[e]);let E=(0,X.useMemo)(()=>Oe.some(e=>a[e]!==c[e]),[c,a]);(0,X.useEffect)(()=>n(E),[E,n]);let D=(0,X.useCallback)(async()=>{let t=Oe.filter(e=>a[e]!==c[e]);if(t.length!==0){y(!0),x(null);try{await Promise.all(t.map(t=>R(e,t,a[t]))),d({...a})}catch(e){throw x(e instanceof Error?e.message:String(e)),e}finally{y(!1)}}},[e,c,a]);(0,X.useImperativeHandle)(r,()=>({save:D}),[D]);let O={"SOUL.md":{label:t?`个性与边界`:`Personality & boundaries`,description:t?`定义语气、价值观、行为原则与安全边界。`:`Tone, values, behavior principles, and safety boundaries.`},"TOOLS.md":{label:t?`工具说明`:`Tool guidance`,description:t?`补充工具偏好和使用约定,不负责授予权限。`:`Tool preferences and conventions; this does not grant access.`},"AGENTS.md":{label:t?`工作规范`:`Working instructions`,description:t?`该智能体长期遵循的协作和执行规范。`:`Persistent collaboration and execution instructions.`}},k=[G,J,fe,f],A=be(a[S]).body;return(0,Q.jsx)(`div`,{className:`space-y-5`,children:(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-edge px-4 py-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(ae,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:t?`角色配置`:`Profile documents`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t?`三类角色文件均可编辑。默认使用所见即所得编辑器,熟悉 Markdown 时再切换源码。`:`All three profile documents are editable. The visual editor is the default; switch to Markdown source only when needed.`})]})]}),(0,Q.jsx)(`div`,{className:`mt-4 flex gap-1 overflow-x-auto`,role:`tablist`,"aria-label":t?`角色配置文件`:`Profile documents`,children:Oe.map(e=>(0,Q.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":S===e,onClick:()=>{C(e),T(`direct`)},className:v(`min-h-10 shrink-0 rounded-lg px-3 py-2 font-mono text-xs font-medium transition-colors`,S===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:e},e))})]}),(0,Q.jsxs)(`div`,{className:`p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:O[S].label}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:O[S].description})]}),(0,Q.jsx)(`div`,{className:`flex rounded-lg bg-surface-hover p-1`,role:`group`,"aria-label":t?`编辑模式`:`Editor mode`,children:[[`direct`,f,t?`直接编辑`:`Visual`],[`source`,fe,`Markdown`],[`preview`,l,t?`预览`:`Preview`]].map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>T(e),"aria-pressed":w===e,className:v(`inline-flex min-h-9 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,w===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))})]}),S===`SOUL.md`&&!p?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:t?`从模板开始`:`Start from a template`}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:Se.map((e,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{e.content&&s(t=>({...t,"SOUL.md":xe(t[`SOUL.md`],e.content)})),T(`direct`)},className:`flex min-h-11 items-center gap-2 rounded-xl border border-edge px-3 py-2 text-left text-xs font-medium text-fg-muted transition-colors hover:border-accent/40 hover:bg-surface-hover hover:text-fg`,children:[(0,Q.jsx)(k[n]??o,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t?e.labelZh:e.labelEn]},e.id))})]}):null,b?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,role:`alert`,children:b}):null,(0,Q.jsx)(`div`,{className:`mt-4 h-[min(40vh,22rem)] min-h-64 overflow-hidden rounded-xl border border-edge bg-surface-panel`,role:`tabpanel`,children:p?(0,Q.jsx)(Ae,{}):h?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-fg-muted`,children:t?`无法加载角色配置,未对文件进行任何更改。`:`Profile documents could not be loaded. No files were changed.`}):w===`direct`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(Ae,{}),children:(0,Q.jsx)(Ee,{initialContent:A,onChange:e=>s(t=>({...t,[S]:xe(t[S],e)})),placeholder:t?`直接输入内容,或输入 / 使用快捷命令…`:`Start writing, or type / for commands…`},`${e}-${S}-direct`)}):w===`source`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(Ae,{}),children:(0,Q.jsx)(De,{initialContent:a[S],onChange:e=>s(t=>({...t,[S]:e})),isDark:i,lineWrap:!0,className:`min-h-0 flex-1`},`${e}-${S}-source`)}):(0,Q.jsx)(`div`,{className:`h-full overflow-y-auto p-5`,children:A.trim()?(0,Q.jsx)(u,{content:A}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:t?`暂无内容。`:`No content yet.`})})}),(0,Q.jsx)(`div`,{className:`mt-2 flex justify-end text-xs text-fg-muted`,"aria-live":`polite`,children:_?t?`正在保存角色配置…`:`Saving profile documents…`:E?t?`角色配置有未保存的更改`:`Profile documents have unsaved changes`:t?`角色配置已保存`:`Profile documents saved`})]})]})})});function Me(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function Ne(e){let t=(0,Z.c)(74),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,modelKind:c,onChange:l}=e,u=o===void 0?!1:o,d=s===void 0?!1:s,f=c===void 0?`text`:c,p=i!=null,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[0]=m):m=t[0];let h=O(p&&f!==`image`?M:null,j,m),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[1]=g):g=t[1];let _=O(p&&f===`image`?`agent-defaults-image-models`:null,ve,g),v;t[2]===_.data?v=t[3]:(v=_.data??[],t[2]=_.data,t[3]=v);let y;t[4]===v?y=t[5]:(y=v.flatMap(Fe),t[4]=v,t[5]=y);let b=y,x;t[6]!==b||t[7]!==f||t[8]!==h?(x=f===`image`?b:h.data??[],t[6]=b,t[7]=f,t[8]=h,t[9]=x):x=t[9];let S=x,C;t[10]!==f||t[11]!==S?(C=f===`vision`?S.filter(Pe):S,t[10]=f,t[11]=S,t[12]=C):C=t[12];let w=C,T=f===`image`?_:h,E;t[13]===n?E=t[14]:(E=(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[13]=n,t[14]=E);let D;t[15]!==i||t[16]!==a?(D=i===void 0?(0,Q.jsx)(Me,{children:a?`继承`:`Inherited`}):null,t[15]=i,t[16]=a,t[17]=D):D=t[17];let A;t[18]!==d||t[19]!==i||t[20]!==a?(A=i===null?(0,Q.jsx)(Me,{children:d?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[18]=d,t[19]=i,t[20]=a,t[21]=A):A=t[21];let N;t[22]!==E||t[23]!==D||t[24]!==A?(N=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E,D,A]}),t[22]=E,t[23]=D,t[24]=A,t[25]=N):N=t[25];let P;t[26]!==r?.primary||t[27]!==i||t[28]!==a?(P=i===void 0?(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[26]=r?.primary,t[27]=i,t[28]=a,t[29]=P):P=t[29];let F;t[30]!==N||t[31]!==P?(F=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[N,P]}),t[30]=N,t[31]=P,t[32]=F):F=t[32];let I;t[33]!==l||t[34]!==i||t[35]!==a?(I=i===void 0?null:(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(void 0),children:a?`继承`:`Inherit`}),t[33]=l,t[34]=i,t[35]=a,t[36]=I):I=t[36];let L;t[37]!==u||t[38]!==l||t[39]!==i||t[40]!==a?(L=u&&i!==null?(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`使用 Chat`:`Use Chat`}):null,t[37]=u,t[38]=l,t[39]=i,t[40]=a,t[41]=L):L=t[41];let R;t[42]!==d||t[43]!==l||t[44]!==i||t[45]!==a?(R=d&&i!==null?(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`禁用`:`Disable`}):null,t[42]=d,t[43]=l,t[44]=i,t[45]=a,t[46]=R):R=t[46];let z;t[47]!==p||t[48]!==r?.fallbacks||t[49]!==r?.primary||t[50]!==l||t[51]!==a?(z=p?null:(0,Q.jsx)(k,{className:`px-2 py-1 text-xs`,onClick:()=>l({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`自定义`:`Customize`}),t[47]=p,t[48]=r?.fallbacks,t[49]=r?.primary,t[50]=l,t[51]=a,t[52]=z):z=t[52];let B;t[53]!==I||t[54]!==L||t[55]!==R||t[56]!==z?(B=(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[I,L,R,z]}),t[53]=I,t[54]=L,t[55]=R,t[56]=z,t[57]=B):B=t[57];let H;t[58]!==F||t[59]!==B?(H=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[F,B]}),t[58]=F,t[59]=B,t[60]=H):H=t[60];let U;t[61]!==w||t[62]!==p||t[63]!==n||t[64]!==f||t[65]!==S||t[66]!==l||t[67]!==T||t[68]!==i||t[69]!==a?(U=p?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:a?`主模型`:`Primary model`}),T.isLoading?(0,Q.jsx)(V,{className:`mt-1.5 h-11 w-full rounded-lg`}):(0,Q.jsx)(ie,{value:i.primary,models:S,modelsLoading:T.isLoading,modelsError:T.error,capabilitiesFilter:f===`vision`?`vision`:void 0,placeholder:a?`选择模型`:`Select a model`,searchPlaceholder:a?`搜索模型或服务商`:`Search models or providers`,noMatches:a?`没有匹配的模型`:`No matching models`,contentAlign:`start`,className:`mt-1.5 w-full`,ariaLabel:a?`${n}主模型`:`${n} primary model`,onChange:e=>l({...i,primary:e})})]}),(0,Q.jsx)(_e,{primary:i.primary,value:i.fallbacks,models:w,loading:T.isLoading,error:T.error,zh:a,onChange:e=>l({...i,fallbacks:e})})]}):null,t[61]=w,t[62]=p,t[63]=n,t[64]=f,t[65]=S,t[66]=l,t[67]=T,t[68]=i,t[69]=a,t[70]=U):U=t[70];let W;return t[71]!==H||t[72]!==U?(W=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[H,U]}),t[71]=H,t[72]=U,t[73]=W):W=t[73],W}function Pe(e){return e.vision}function Fe(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var Ie=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],$=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function Le(e){return[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))]}function Re(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function ze(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function Be(e){let t=(0,Z.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Q.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==i||t[8]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[s,i]}),t[7]=i,t[8]=s,t[9]=c):c=t[9],c}function Ve(e){let t=(0,Z.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`mt-2 truncate text-sm font-semibold text-fg`,title:r,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function He(e){return Object.values(e).some(e=>e!==void 0)?e:void 0}function Ue({agent:e,toolIds:t,zh:n,messages:r,externalError:i,onDirtyChange:a,onClose:s,onOpenDefaults:c,onChat:l,onDelete:u}){let[f,p]=(0,X.useState)(`overview`),[g,y]=(0,X.useState)(()=>structuredClone(e.override)),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(null),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(!1),O=(0,X.useRef)(null),A=JSON.stringify(g)!==JSON.stringify(e.override)||E,j=[g.models?.chat,...Object.values(g.models?.intents??{}),g.models?.imageUnderstanding,g.models?.imageGeneration].some(e=>e!=null&&!e.primary.trim());(0,X.useEffect)(()=>a(A),[A,a]);let M=(0,X.useMemo)(()=>[...new Set([...t,...Object.keys(e.effective.tools),...Object.keys(g.tools??{}),...g.toolAllowlist??[]])].sort(),[e.effective.tools,g.toolAllowlist,g.tools,t]),P=[g.models?n?`模型`:`Models`:null,g.skills?n?`技能`:`Skills`:null,g.tools?n?`工具权限`:`Tool access`:null,g.runtime||g.workflows?n?`运行限制`:`Runtime`:null].filter(e=>!!e),F=g.toolAllowlist,I=F?M.filter(t=>F.includes(t)&&e.effective.tools[t]?.mode!==`deny`).length:null,L=Object.values(e.effective.tools).filter(e=>e.mode===`deny`).length,R=e.effective.skills.mode===`selected`?n?`${e.effective.skills.include.length} 个已选技能`:`${e.effective.skills.include.length} selected skills`:n?`所有已启用技能`:`All enabled skills`,z=g.profile?.name??e.name??e.id,B=(t,n)=>{y(r=>({...r,profile:{...r.profile,name:r.profile?.name??e.name??e.id,[t]:n}}))},V=_(n?`zh`:`en`).chat.workingDirectory,H={fast:r.editorIntentFast,reasoning:r.editorIntentReasoning,coding:r.editorIntentCoding,review:r.editorIntentReview,vision:r.editorIntentVision,understanding:r.editorIntentUnderstanding},U={inherit:r.editorToolModeInherit,allow:r.editorToolModeAllow,ask:r.editorToolModeAsk,deny:r.editorToolModeDeny},W=async()=>{x(!0),C(null);try{await O.current?.save();let t=(await N(e.id,{workspace:g.workspace??null,profile:g.profile,models:g.models??null,skills:g.skills??null,tools:g.tools??null,toolAllowlist:g.toolAllowlist??null,workflows:g.workflows??null,runtime:g.runtime??null})).agents.find(t=>t.id===e.id);t&&y(structuredClone(t.override)),D(!1)}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}},G=async()=>{x(!0),C(null);try{await N(e.id,{setDefault:!0})}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}},ee=(e,t)=>{let n={...g.tools??{}};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},y({...g,tools:Object.keys(n).length>0?n:void 0})},K=(t,n)=>{let r=new Set(g.toolAllowlist??[]);n?r.add(t):r.delete(t);let i={...g.tools??{}};n&&(i[t]?.mode===`deny`||e.effective.tools[t]?.mode===`deny`)&&(i[t]={...i[t],mode:`allow`}),y({...g,toolAllowlist:[...r],tools:Object.keys(i).length>0?i:void 0})},J=(e,t)=>{let n={...g.models??{}},r={...n.intents??{}};t===void 0?delete r[e]:r[e]=t,Object.keys(r).length>0?n.intents=r:delete n.intents,y({...g,models:Object.keys(n).length>0?n:void 0})},Y=(0,X.useCallback)(e=>{D(e)},[]);return(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,Q.jsx)(`aside`,{className:`shrink-0 overflow-x-auto border-b border-edge px-3 py-3 sm:w-52 sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-3 sm:py-4`,children:(0,Q.jsx)(`nav`,{className:`flex gap-1 sm:flex-col`,children:[{id:`overview`,label:n?`概览`:`Overview`,icon:q},{id:`profile`,label:n?`个性`:`Profile`,icon:oe},{id:`models`,label:n?`模型`:`Models`,icon:h},{id:`capabilities`,label:n?`技能与工具`:`Skills & tools`,icon:o},{id:`runtime`,label:n?`运行限制`:`Runtime`,icon:q},{id:`danger`,label:n?`危险区`:`Danger zone`,icon:me}].map(({id:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{p(e),e===`profile`&&T(!0)},className:v(`flex shrink-0 items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm font-medium transition-colors`,f===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Q.jsx)(n,{className:`size-4`}),t]},e))})}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:[S||i?(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:S??i}):null,f===`overview`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(Be,{title:n?`配置概览`:`Configuration overview`,description:n?`查看当前真正生效的配置。未覆盖的部分会持续跟随全局默认值。`:`Review what actually takes effect. Anything not overridden keeps following global defaults.`,action:(0,Q.jsxs)(k,{onClick:l,children:[(0,Q.jsx)(d,{className:`size-4`}),n?`开始对话`:`Start chat`]})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-accent/20 bg-accent/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:P.length>0?n?`已自定义:${P.join(`、`)}`:`Customized: ${P.join(`, `)}`:n?`能力配置使用全局默认`:`Capabilities use global defaults`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:P.length>0?n?`其他能力会继续跟随全局默认配置。`:`All other capabilities continue to follow global defaults.`:n?`修改全局默认配置后,这个智能体会自动同步。`:`This agent updates automatically when global defaults change.`})]}),(0,Q.jsx)(k,{onClick:c,children:n?`查看全局默认配置`:`View global defaults`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsx)(Ve,{label:n?`对话模型`:`Chat model`,value:e.effective.models.chat.primary,detail:g.models?.chat?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(Ve,{label:n?`技能`:`Skills`,value:R,detail:g.skills?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(Ve,{label:n?`工具权限`:`Tool access`,value:I===null?L>0?n?`${L} 个禁用`:`${L} denied`:n?`全部可用`:`All available`:n?`${I} 个已开放`:`${I} in scope`,detail:F?n?`受智能体工具范围限制`:`Limited by agent tool scope`:g.tools?n?`${Object.keys(g.tools).length} 个本地覆盖`:`${Object.keys(g.tools).length} local overrides`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(Ve,{label:n?`工作区`:`Workspace`,value:e.effective.workspace,detail:g.workspace?n?`单独设置`:`Agent specific`:n?`自动工作区`:`Automatic workspace`})]}),e.isDefault?null:(0,Q.jsx)(k,{onClick:()=>void G(),disabled:b,children:n?`设为默认智能体`:`Make default agent`})]}):null,w?(0,Q.jsxs)(`div`,{className:v(`space-y-6`,f!==`profile`&&`hidden`),children:[(0,Q.jsx)(Be,{title:n?`身份、个性与工作区`:`Identity, behavior, and workspace`,description:n?`管理结构化身份资料、三类角色文件和工作目录。`:`Manage structured identity, three profile documents, and the working directory.`}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent`,children:(0,Q.jsx)(h,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`智能体身份`:`Agent identity`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`身份资料保存在智能体配置中,供界面、对话和语音共同使用。`:`Identity is saved in the Agent profile and shared by the UI, chat, and voice.`})]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`名称`:`Name`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:z,onChange:e=>B(`name`,e.target.value),placeholder:n?`例如:小助`:`e.g. Nova`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`一句话介绍`:`Description`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.description??``,onChange:e=>B(`description`,e.target.value),placeholder:n?`擅长什么、如何帮助你`:`What this agent is great at`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`类型`:`Type`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,list:`agent-creatures-${e.id}`,value:g.profile?.creature??``,onChange:e=>B(`creature`,e.target.value),placeholder:n?`AI 助手、研究伙伴…`:`AI assistant, research partner…`}),(0,Q.jsx)(`datalist`,{id:`agent-creatures-${e.id}`,children:Ce.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:n?e.labelZh:e.labelEn},e.value))})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`表达风格`:`Style`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.style??``,onChange:e=>B(`style`,e.target.value),placeholder:n?`例如:直接、温和`:`e.g. direct and warm`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`主要语言`:`Primary language`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.language??``,onChange:e=>B(`language`,e.target.value),placeholder:n?`例如:简体中文`:`e.g. English`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`签名表情`:`Signature emoji`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.emoji??``,onChange:e=>B(`emoji`,e.target.value),placeholder:`✨`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`头像地址`:`Avatar URL or path`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.avatar??``,onChange:e=>B(`avatar`,e.target.value),placeholder:n?`URL 或本地路径`:`URL or local path`})]})]})]}),(0,Q.jsx)(je,{ref:O,agentId:e.id,zh:n,onDirtyChange:Y}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作区`:`Workspace`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`选择这个智能体读写文件时使用的目录;留空则使用自动工作区。`:`Choose where this agent reads and writes files, or leave it empty to use the automatic workspace.`})]}),g.workspace?(0,Q.jsxs)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>y(e=>({...e,workspace:void 0})),children:[(0,Q.jsx)(m,{className:`size-3.5`}),n?`恢复自动`:`Use automatic`]}):(0,Q.jsx)(ze,{children:n?`自动`:`Automatic`})]}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(ye,{value:g.workspace??``,onChange:e=>y(t=>({...t,workspace:e||void 0})),wd:V,placeholder:e.effective.workspace,inputAriaLabel:n?`智能体工作区路径`:`Agent workspace path`,inputClassName:`${$} font-mono`,disabled:b})})]}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`附加指令`:`Additional instructions`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`补充简短的执行规则;个性与长期工作规范请写入上方角色配置。`:`Add short execution rules. Keep personality and lasting work guidance in the profile documents above.`}),(0,Q.jsx)(`textarea`,{rows:4,className:`${$} mt-4 resize-y leading-6`,value:g.profile?.instructions??``,onChange:t=>y(n=>({...n,profile:{...n.profile,name:n.profile?.name||e.name||e.id,instructions:t.target.value||void 0}})),placeholder:n?`可选:补充必须始终遵循的规则`:`Optional: add a rule that must always be followed`})]})]}):null,f===`models`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(Be,{title:n?`模型路由`:`Model routing`,description:n?`日常对话使用 Chat;固定意图只在对应任务中生效。默认继承全局。`:`Chat handles normal turns; fixed intents apply only to matching work. Everything inherits by default.`,action:g.models?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,models:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,Q.jsx)(Ne,{label:r.editorChatModel,inherited:e.effective.models.chat,value:g.models?.chat,zh:n,onChange:e=>{let t={...g.models??{}};e?t.chat=e:delete t.chat,y({...g,models:Object.keys(t).length>0?t:void 0})}}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`固定意图`:`Fixed intents`}),(0,Q.jsx)(`div`,{className:`space-y-3`,children:Ie.map(t=>(0,Q.jsx)(Ne,{label:H[t],inherited:e.effective.models.intents[t]??e.effective.models.chat,value:g.models?.intents?.[t],zh:n,allowChatFallback:!0,modelKind:t===`vision`?`vision`:`text`,onChange:e=>J(t,e)},t))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`图片能力`:`Image capabilities`}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(Ne,{label:n?`图片理解`:`Image understanding`,modelKind:`vision`,inherited:e.effective.models.imageUnderstanding,value:g.models?.imageUnderstanding,zh:n,allowDisabled:!0,onChange:e=>{let t={...g.models??{}};e===void 0?delete t.imageUnderstanding:t.imageUnderstanding=e,y({...g,models:Object.keys(t).length>0?t:void 0})}}),(0,Q.jsx)(Ne,{label:n?`图片生成`:`Image generation`,modelKind:`image`,inherited:e.effective.models.imageGeneration,value:g.models?.imageGeneration,zh:n,allowDisabled:!0,onChange:t=>{let n={...g.models??{}};t===void 0?delete n.imageGeneration:t===null?n.imageGeneration=null:n.imageGeneration={...t,timeoutMs:g.models?.imageGeneration?.timeoutMs??e.effective.models.imageGeneration?.timeoutMs,autoProviderFallback:g.models?.imageGeneration?.autoProviderFallback??e.effective.models.imageGeneration?.autoProviderFallback??!0},y({...g,models:Object.keys(n).length>0?n:void 0})}}),g.models?.imageGeneration?(0,Q.jsxs)(`div`,{className:`grid gap-4 rounded-2xl border border-edge bg-surface-base p-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,Q.jsx)(`input`,{type:`number`,min:1,className:`${$} mt-1.5`,value:g.models.imageGeneration.timeoutMs??``,onChange:e=>y({...g,models:{...g.models,imageGeneration:{...g.models.imageGeneration,timeoutMs:Re(e.target.value)}}})})]}),(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`提供商自动回退`:`Automatic provider fallback`}),(0,Q.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[!0,!1].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>y({...g,models:{...g.models,imageGeneration:{...g.models.imageGeneration,autoProviderFallback:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,g.models?.imageGeneration?.autoProviderFallback===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e?n?`开启`:`On`:n?`关闭`:`Off`},String(e)))})]})]}):null]})]})]}):null,f===`capabilities`?(0,Q.jsxs)(`div`,{className:`space-y-7`,children:[(0,Q.jsx)(Be,{title:n?`技能与工具`:`Skills and tools`,description:n?`默认继承全局能力;只设置确实不同的部分。`:`Keep inheritance for global capabilities; override only agents that genuinely differ.`}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`技能策略`:`Skill policy`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g.skills?n?`当前使用单独设置`:`Using an agent override`:n?`当前继承全局`:`Currently inherited globally`})]}),g.skills?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,skills:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),(0,Q.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Q.jsx)(k,{variant:g.skills?.mode===`merge`?`primary`:`secondary`,onClick:()=>y({...g,skills:{mode:`merge`,add:[],remove:[]}}),children:r.editorSkillModeMerge}),(0,Q.jsx)(k,{variant:g.skills?.mode===`replace`?`primary`:`secondary`,onClick:()=>y({...g,skills:{mode:`replace`,include:[]}}),children:r.editorSkillModeReplace})]}),g.skills?.mode===`merge`?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`新增技能`:`Add skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.skills.add.join(`, `),onChange:e=>y({...g,skills:{mode:`merge`,add:Le(e.target.value),remove:g.skills?.mode===`merge`?g.skills.remove:[]}})})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`移除技能`:`Remove skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.skills.remove.join(`, `),onChange:e=>y({...g,skills:{mode:`merge`,add:g.skills?.mode===`merge`?g.skills.add:[],remove:Le(e.target.value)}})})]})]}):null,g.skills?.mode===`replace`?(0,Q.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[n?`仅启用这些技能`:`Enable only these skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.skills.include.join(`, `),onChange:e=>y({...g,skills:{mode:`replace`,include:Le(e.target.value)}})})]}):null]}),(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工具权限`:`Tool permissions`}),g.tools?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,tools:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):null]}),F?(0,Q.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n?`此智能体使用限定的工具范围。可在下方启用或移除工具,保存后从下一轮对话生效。`:`This agent uses a limited tool set. Add or remove tools below; changes apply from the next conversation turn.`}):null,(0,Q.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:M.map(t=>{if(F&&!F.includes(t))return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`code`,{className:`text-xs text-fg-muted`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:n?`未开放`:`Unavailable`})]}),(0,Q.jsx)(k,{variant:`secondary`,className:`px-3 py-1.5 text-xs`,onClick:()=>K(t,!0),children:n?`启用`:`Enable`})]},t);let r=g.tools?.[t]?.mode,i=e.effective.tools[t]?.mode??`allow`;return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`code`,{className:`text-xs text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:r?n?`单独设置`:`Agent override`:`${n?`继承`:`Inherits`} ${U[i]}`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`flex rounded-xl bg-surface-hover p-1`,children:[`inherit`,`allow`,`ask`,`deny`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>ee(t,e),className:v(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,(e===`inherit`?!r:r===e)?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:U[e]},e))}),F?(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1.5 text-xs`,onClick:()=>K(t,!1),children:n?`移除`:`Remove`}):null]})]},t)})})]})]}):null,f===`runtime`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(Be,{title:n?`运行限制`:`Runtime limits`,description:n?`留空即继承全局限制。`:`Leave blank to inherit global limits. Use overrides only to tighten or relax a specialist agent.`,action:g.runtime||g.workflows?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,runtime:void 0,workflows:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,Q.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[[`maxTurns`,n?`单次最大轮数`:`Maximum turns`],[`timeoutMs`,n?`单轮超时(毫秒)`:`Turn timeout (ms)`],[`maxToolFailuresPerTurn`,n?`最大工具失败次数`:`Maximum tool failures`]].map(([t,r])=>(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r,g.runtime?.[t]===void 0?(0,Q.jsx)(ze,{children:n?`继承`:`Inherited`}):null]}),(0,Q.jsx)(`input`,{type:`number`,min:1,className:`${$} mt-1.5`,value:g.runtime?.[t]??``,placeholder:String(e.effective.runtime[t]??``),onChange:e=>{let n=He({...g.runtime??{},[t]:Re(e.target.value)});y({...g,runtime:n})}})]},t))}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作流`:`Workflows`}),(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`默认工作流`:`Default workflow`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.workflows?.default??``,placeholder:e.effective.workflows.default,onChange:e=>{let t=He({...g.workflows??{},default:e.target.value||void 0});y({...g,workflows:t})}})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`允许的工作流`:`Allowed workflows`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.workflows?.allowed?.join(`, `)??``,placeholder:e.effective.workflows.allowed?.join(`, `),onChange:e=>{let t=Le(e.target.value),n=He({...g.workflows??{},allowed:t.length>0?t:void 0});y({...g,workflows:n})}})]})]})]}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`提示词缓存`:`Prompt cache`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g.runtime?.promptCache?n?`使用单独设置`:`Using agent override`:n?`继承全局`:`Inherited globally`})]}),g.runtime?.promptCache?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>{let e=He({...g.runtime??{},promptCache:void 0});y({...g,runtime:e})},children:[(0,Q.jsx)(m,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),g.runtime?.promptCache?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`模式`:`Mode`}),(0,Q.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`auto`,`off`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>y({...g,runtime:{...g.runtime,promptCache:{...g.runtime.promptCache,mode:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,g.runtime?.promptCache?.mode===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`auto`?r.editorCacheModeAuto:r.editorCacheModeOff},e))})]}),(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`缓存周期`:`Lifetime`}),(0,Q.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`short`,`long`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>y({...g,runtime:{...g.runtime,promptCache:{...g.runtime.promptCache,lifetime:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,g.runtime?.promptCache?.lifetime===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`short`?r.editorCacheLifetimeShort:r.editorCacheLifetimeLong},e))})]})]}):(0,Q.jsx)(k,{className:`mt-4`,onClick:()=>y({...g,runtime:{...g.runtime,promptCache:{...e.effective.runtime.promptCache??{mode:`auto`,lifetime:`short`}}}}),children:n?`自定义缓存策略`:`Customize cache policy`})]})]}):null,f===`danger`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(Be,{title:n?`危险区`:`Danger zone`,description:n?`这些操作会改变默认路由或移除智能体。`:`These actions change default routing or remove the agent.`}),e.isDefault?null:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`设为默认智能体`:`Make default agent`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`新会话和未指定路由将使用这个智能体。`:`New sessions and unspecified routes will use this agent.`})]}),(0,Q.jsx)(k,{disabled:b,onClick:()=>void G(),children:n?`设为默认`:`Make default`})]}),e.isDefault?(0,Q.jsx)(`p`,{className:`rounded-2xl bg-surface-base p-4 text-sm text-fg-muted`,children:n?`默认智能体不能删除,请先将其他智能体设为默认。`:`The default agent cannot be deleted. Make another agent the default first.`}):(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-red-500/25 bg-red-500/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-red-600`,children:n?`删除智能体`:`Delete agent`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`配置条目会被移除,删除前仍会再次确认。`:`The configuration entry will be removed after confirmation.`})]}),(0,Q.jsxs)(k,{variant:`ghost`,className:`text-red-600`,onClick:u,children:[(0,Q.jsx)(me,{className:`size-4`}),n?`删除`:`Delete`]})]})]}):null]}),(0,Q.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge bg-surface-panel px-5 py-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:j?n?`请补全自定义模型`:`Complete the custom model reference`:A?n?`有未保存的更改`:`Unsaved changes`:n?`所有更改已保存`:`All changes saved`}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(k,{onClick:s,children:n?`关闭`:`Close`}),(0,Q.jsx)(k,{variant:`primary`,disabled:b||!A||j||g.profile!==void 0&&!g.profile.name.trim(),onClick:()=>void W(),children:b?n?`保存中…`:`Saving…`:n?`保存更改`:`Save changes`})]})]})]})]})}function We(e){let t=(0,Z.c)(36),{agent:n,messages:r,open:i,onOpenChange:a,children:o}=e,[c,l]=(0,X.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(x,{className:v(`xopc-dialog-overlay fixed inset-0 bg-scrim`,U)}),t[0]=u):u=t[0];let d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=v(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,H,`inset-3 h-[calc(100dvh-1.5rem)] min-h-0 sm:inset-auto sm:left-1/2 sm:top-1/2`,`sm:h-[min(88vh,48rem)] sm:w-[min(94vw,62rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=d):d=t[1];let f;t[2]!==n.avatar||t[3]!==n.id?(f=(0,Q.jsx)(re,{agentId:n.id,avatar:n.avatar,size:42,className:`size-11 shrink-0`}),t[2]=n.avatar,t[3]=n.id,t[4]=f):f=t[4];let p;t[5]!==n||t[6]!==r?(p=le(n,r),t[5]=n,t[6]=r,t[7]=p):p=t[7];let m;t[8]===p?m=t[9]:(m=(0,Q.jsx)(E,{className:`truncate text-base font-semibold text-fg`,children:p}),t[8]=p,t[9]=m);let h;t[10]===n.id?h=t[11]:(h=(0,Q.jsx)(S,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,children:n.id}),t[10]=n.id,t[11]=h);let _;t[12]!==m||t[13]!==h?(_=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=_):_=t[14];let y;t[15]!==n.isDefault||t[16]!==r.listDefaultBadge?(y=n.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent`,children:r.listDefaultBadge}):null,t[15]=n.isDefault,t[16]=r.listDefaultBadge,t[17]=y):y=t[17];let b;t[18]!==f||t[19]!==_||t[20]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[f,_,y]}),t[18]=f,t[19]=_,t[20]=y,t[21]=b):b=t[21];let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(g,{className:`size-4`}),t[22]=O):O=t[22];let k;t[23]===r.closeDialogAria?k=t[24]:(k=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":r.closeDialogAria,children:O})}),t[23]=r.closeDialogAria,t[24]=k);let A;t[25]!==k||t[26]!==b?(A=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-edge px-5 py-4`,children:[b,k]}),t[25]=k,t[26]=b,t[27]=A):A=t[27];let j;t[28]!==o||t[29]!==c||t[30]!==A?(j=(0,Q.jsxs)(w,{children:[u,(0,Q.jsx)(T,{ref:l,className:d,onOpenAutoFocus:Ge,children:(0,Q.jsxs)(s,{layer:`modal`,portalContainer:c,children:[A,o]})})]}),t[28]=o,t[29]=c,t[30]=A,t[31]=j):j=t[31];let M;return t[32]!==a||t[33]!==i||t[34]!==j?(M=(0,Q.jsx)(D,{open:i,onOpenChange:a,children:j}),t[32]=a,t[33]=i,t[34]=j,t[35]=M):M=t[35],M}function Ge(e){return e.preventDefault()}function Ke(e){let t=(0,Z.c)(13),{agents:n,busy:r,messages:i,onOpen:a,onChat:o}=e,s;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==o||t[4]!==a){let e;t[6]!==r||t[7]!==i||t[8]!==o||t[9]!==a?(e=e=>{let t=le(e,i),n=ce(e,i);return(0,Q.jsx)(`li`,{className:`min-h-0`,children:(0,Q.jsxs)(`article`,{className:v(`group relative flex min-h-52 flex-col rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface`,`transition-[transform,background-color,border-color] duration-200 ease-out hover:-translate-y-0.5 hover:border-accent/30 hover:bg-surface-hover/35 active:scale-[0.99] motion-reduce:transform-none`),children:[(0,Q.jsx)(`button`,{type:`button`,disabled:r,"aria-label":i.listConfigureAgent.replace(`{{name}}`,t),onClick:()=>a(e.id),className:`absolute inset-0 z-0 rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,Q.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(re,{agentId:e.id,avatar:e.avatar,size:48,className:`size-12 shrink-0`}),(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t})})]}),(0,Q.jsx)(`span`,{className:v(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.isDefault?`bg-accent-soft text-accent`:`bg-surface-hover text-fg-muted`),children:e.isDefault?i.listDefaultBadge:i.listCustomBadge})]}),(0,Q.jsx)(`p`,{className:`pointer-events-none relative z-10 mt-5 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:n||e.override.profile?.instructions||i.listUsesGlobalSettings}),(0,Q.jsxs)(`div`,{className:`pointer-events-none relative z-10 mt-4 rounded-xl bg-surface-base px-3 py-2.5`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:i.listCurrentModelLabel}),(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg`,children:e.effective.models.chat.primary})]}),(0,Q.jsx)(`div`,{className:`relative z-10 mt-auto pt-4`,children:(0,Q.jsxs)(k,{className:`w-full`,disabled:r,onClick:t=>{t.stopPropagation(),o(e.id)},children:[(0,Q.jsx)(d,{className:`size-4`}),i.listChatWithAgent]})})]})},e.id)},t[6]=r,t[7]=i,t[8]=o,t[9]=a,t[10]=e):e=t[10],s=n.map(e),t[0]=n,t[1]=r,t[2]=i,t[3]=o,t[4]=a,t[5]=s}else s=t[5];let c;return t[11]===s?c=t[12]:(c=(0,Q.jsx)(`ul`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:s}),t[11]=s,t[12]=c),c}var qe=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function Je(e){let t=(0,Z.c)(79),{draft:n,busy:r,error:i,messages:a,workingDirectoryMessages:o,onChange:s,onCreate:c,onOpenChange:l}=e,u=n.open,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(x,{className:v(`xopc-dialog-overlay fixed inset-0 bg-scrim`,U)}),t[0]=d):d=t[0];let f;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=v(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(38rem,calc(100dvh-2rem))] w-[min(92vw,36rem)] -translate-x-1/2 -translate-y-1/2 flex-col`,`overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,H),t[1]=f):f=t[1];let p;t[2]===a.manualCreateTitle?p=t[3]:(p=(0,Q.jsx)(E,{className:`text-base font-semibold text-fg`,children:a.manualCreateTitle}),t[2]=a.manualCreateTitle,t[3]=p);let m;t[4]===a.manualCreateDescription?m=t[5]:(m=(0,Q.jsx)(S,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:a.manualCreateDescription}),t[4]=a.manualCreateDescription,t[5]=m);let h;t[6]!==p||t[7]!==m?(h=(0,Q.jsxs)(`div`,{children:[p,m]}),t[6]=p,t[7]=m,t[8]=h):h=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[9]=_):_=t[9];let y;t[10]===a.manualCreateClose?y=t[11]:(y=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`touch-target shrink-0 rounded-lg p-2 text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a.manualCreateClose,children:_})}),t[10]=a.manualCreateClose,t[11]=y);let b;t[12]!==h||t[13]!==y?(b=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[h,y]}),t[12]=h,t[13]=y,t[14]=b):b=t[14];let O;t[15]===i?O=t[16]:(O=i?(0,Q.jsx)(`p`,{role:`alert`,className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:i}):null,t[15]=i,t[16]=O);let A;t[17]===s?A=t[18]:(A=e=>s({name:e.target.value}),t[17]=s,t[18]=A);let j;t[19]!==n.name||t[20]!==a.manualCreateNamePlaceholder||t[21]!==A?(j=(0,Q.jsx)(`input`,{id:`manual-agent-name`,autoFocus:!0,className:`${qe} mt-1.5`,value:n.name,onChange:A,placeholder:a.manualCreateNamePlaceholder}),t[19]=n.name,t[20]=a.manualCreateNamePlaceholder,t[21]=A,t[22]=j):j=t[22];let M;t[23]!==a.manualCreateName||t[24]!==j?(M=(0,Q.jsxs)(`label`,{htmlFor:`manual-agent-name`,className:`block text-xs font-medium text-fg-muted`,children:[a.manualCreateName,j]}),t[23]=a.manualCreateName,t[24]=j,t[25]=M):M=t[25];let N;t[26]===s?N=t[27]:(N=e=>s({instructions:e.target.value}),t[26]=s,t[27]=N);let P;t[28]!==n.instructions||t[29]!==a.manualCreateInstructionsPlaceholder||t[30]!==N?(P=(0,Q.jsx)(`textarea`,{id:`manual-agent-instructions`,rows:4,className:`${qe} mt-1.5 resize-y leading-6`,value:n.instructions,onChange:N,placeholder:a.manualCreateInstructionsPlaceholder}),t[28]=n.instructions,t[29]=a.manualCreateInstructionsPlaceholder,t[30]=N,t[31]=P):P=t[31];let F;t[32]!==a.manualCreateInstructions||t[33]!==P?(F=(0,Q.jsxs)(`label`,{htmlFor:`manual-agent-instructions`,className:`block text-xs font-medium text-fg-muted`,children:[a.manualCreateInstructions,P]}),t[32]=a.manualCreateInstructions,t[33]=P,t[34]=F):F=t[34];let I;t[35]===a.manualCreateWorkspace?I=t[36]:(I=(0,Q.jsx)(`label`,{htmlFor:`manual-agent-workspace`,className:`block text-xs font-medium text-fg-muted`,children:a.manualCreateWorkspace}),t[35]=a.manualCreateWorkspace,t[36]=I);let L;t[37]===a.manualCreateWorkspaceHint?L=t[38]:(L=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:a.manualCreateWorkspaceHint}),t[37]=a.manualCreateWorkspaceHint,t[38]=L);let R;t[39]===s?R=t[40]:(R=e=>s({workspace:e}),t[39]=s,t[40]=R);let z;t[41]!==r||t[42]!==n.workspace||t[43]!==a.manualCreateWorkspace||t[44]!==a.manualCreateWorkspacePlaceholder||t[45]!==R||t[46]!==o?(z=(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(ye,{value:n.workspace,onChange:R,disabled:r,wd:o,placeholder:a.manualCreateWorkspacePlaceholder,inputAriaLabel:a.manualCreateWorkspace,inputClassName:`${qe} font-mono`})}),t[41]=r,t[42]=n.workspace,t[43]=a.manualCreateWorkspace,t[44]=a.manualCreateWorkspacePlaceholder,t[45]=R,t[46]=o,t[47]=z):z=t[47];let B;t[48]!==I||t[49]!==L||t[50]!==z?(B=(0,Q.jsxs)(`div`,{children:[I,L,z]}),t[48]=I,t[49]=L,t[50]=z,t[51]=B):B=t[51];let V;t[52]!==O||t[53]!==M||t[54]!==F||t[55]!==B?(V=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[O,M,F,B]}),t[52]=O,t[53]=M,t[54]=F,t[55]=B,t[56]=V):V=t[56];let W;t[57]!==r||t[58]!==a.manualCreateCancel?(W=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(k,{disabled:r,children:a.manualCreateCancel})}),t[57]=r,t[58]=a.manualCreateCancel,t[59]=W):W=t[59];let G;t[60]!==r||t[61]!==n.name?(G=r||!n.name.trim(),t[60]=r,t[61]=n.name,t[62]=G):G=t[62];let ee=r?a.manualCreating:a.manualCreateSubmit,K;t[63]!==r||t[64]!==c||t[65]!==G||t[66]!==ee?(K=(0,Q.jsx)(k,{variant:`primary`,disabled:G,"aria-busy":r,onClick:c,children:ee}),t[63]=r,t[64]=c,t[65]=G,t[66]=ee,t[67]=K):K=t[67];let q;t[68]!==W||t[69]!==K?(q=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[W,K]}),t[68]=W,t[69]=K,t[70]=q):q=t[70];let J;t[71]!==V||t[72]!==q||t[73]!==b?(J=(0,Q.jsxs)(w,{children:[d,(0,Q.jsxs)(T,{className:f,children:[b,V,q]})]}),t[71]=V,t[72]=q,t[73]=b,t[74]=J):J=t[74];let Y;return t[75]!==n.open||t[76]!==l||t[77]!==J?(Y=(0,Q.jsx)(D,{open:u,onOpenChange:l,children:J}),t[75]=n.open,t[76]=l,t[77]=J,t[78]=Y):Y=t[78],Y}var Ye=`px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,Xe=`max-w-7xl`;function Ze(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(V,{className:`h-7 w-28`}),(0,Q.jsx)(V,{className:`h-4 w-80 max-w-full`})]}),(0,Q.jsx)(V,{className:`h-9 w-28`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(ge,{gap:`gap-5`,padding:Ye,className:Xe,children:[t,(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(Qe)})]}),e[1]=n):n=e[1],n}function Qe(e){return(0,Q.jsx)(V,{className:`h-64 rounded-2xl`},e)}function $e({agentId:e,onHeaderActionChange:t}){let n=y(e=>e.conversationId),r=b(e=>e.language),i=r===`zh`,o=_(r),s=o.agentsSettings,l=a(),{data:u,error:d,isLoading:f,mutate:m}=O(n?`settings-gateway-agents`:null,I),[h,g]=(0,X.useState)(!1),[x,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(null),[T,E]=(0,X.useState)(null),[D,j]=(0,X.useState)({open:!1,name:``,instructions:``,workspace:``}),M=(0,X.useRef)(!1),N=u?.agents.find(t=>t.id===e),P=(0,X.useCallback)(()=>{u&&(S(null),pe(u.defaultId),l(`/chat/new?${new URLSearchParams({agentSetup:`1`,projectScope:`none`,draft:s.setupDraftPrefix}).toString()}`,{state:{forceNewChat:!0,agentId:u.defaultId}}))},[s.setupDraftPrefix,u,l]),L=(0,X.useCallback)(async()=>{if(!(h||!D.name.trim())){g(!0),w(null);try{let e=await z({profile:{name:D.name.trim(),...D.instructions.trim()?{instructions:D.instructions.trim()}:{}},...D.workspace.trim()?{workspace:D.workspace.trim()}:{}});j({open:!1,name:``,instructions:``,workspace:``}),pe(e.createdAgentId),l(`/chat/new?projectScope=none`,{state:{forceNewChat:!0,agentId:e.createdAgentId}})}catch(e){w(e instanceof Error?e.message:String(e))}finally{g(!1)}}},[h,D,l]),R=(0,X.useMemo)(()=>({overflow:(0,Q.jsxs)(W,{children:[(0,Q.jsx)(Y,{asChild:!0,children:(0,Q.jsx)(k,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":o.capabilitiesHub.moreActions,title:o.capabilitiesHub.moreActions,children:(0,Q.jsx)(c,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(de,{children:(0,Q.jsxs)(ee,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Q.jsxs)(ne,{className:v(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,A.transition),onSelect:()=>l(`/settings/agent-defaults`),children:[(0,Q.jsx)(te,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i?`全局默认配置`:`Global defaults`]}),(0,Q.jsxs)(ne,{className:v(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,A.transition),onSelect:()=>{w(null),j(e=>({...e,open:!0}))},children:[(0,Q.jsx)(K,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),s.manualCreateMenu]})]})})]}),primary:(0,Q.jsxs)(k,{variant:`primary`,className:`shrink-0`,"aria-label":s.listNewAgentCard,onClick:P,children:[(0,Q.jsx)(p,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:s.listNewAgentCard})]})}),[s.listNewAgentCard,s.manualCreateMenu,o.capabilitiesHub.moreActions,l,P,i]);(0,X.useLayoutEffect)(()=>(t?.(R),()=>t?.(null)),[R,t]);let B=async e=>{g(!0),S(null);try{await F(e.id),l(he)}catch(e){S(e instanceof Error?e.message:String(e))}finally{g(!1)}},V=e=>{pe(e),l(`/chat/new`)},H=e=>{M.current=!1,window.setTimeout(()=>l(se(e)),0)},U=()=>{if(M.current){E({kind:`discard`,destination:he});return}M.current=!1,l(he)},G=()=>{if(M.current){E({kind:`discard`,destination:`/settings/agent-defaults`});return}M.current=!1,l(`/settings/agent-defaults`)},q=()=>{if(!T)return;if(E(null),T.kind===`discard`){M.current=!1,l(T.destination);return}let e=u?.agents.find(e=>e.id===T.agentId);e&&B(e)},J=(0,X.useCallback)(e=>{M.current=e},[]);return n?d&&!u?(0,Q.jsxs)(ge,{className:Xe,padding:Ye,children:[(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:String(d)}),(0,Q.jsx)(k,{onClick:()=>void m(),children:i?`重试`:`Retry`})]}):f||!u?(0,Q.jsx)(Ze,{}):(0,Q.jsxs)(ge,{gap:`gap-5`,className:Xe,padding:Ye,children:[(d||x)&&!N?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:x??String(d)}):null,(0,Q.jsx)(Ke,{agents:u.agents,busy:h,messages:s,onOpen:H,onChat:V}),N?(0,Q.jsx)(We,{agent:N,messages:s,open:!0,onOpenChange:e=>{e||U()},children:(0,Q.jsx)(Ue,{agent:N,toolIds:u.builtinToolIds,zh:i,messages:s,externalError:x,onDirtyChange:J,onClose:U,onOpenDefaults:G,onChat:()=>V(N.id),onDelete:()=>E({kind:`delete`,agentId:N.id,displayName:le(N,s)})},N.id)}):null,(0,Q.jsx)(Je,{draft:D,busy:h,error:C,messages:s,workingDirectoryMessages:o.chat.workingDirectory,onChange:e=>j(t=>({...t,...e})),onCreate:()=>void L(),onOpenChange:e=>{h||(j(t=>({...t,open:e})),e||w(null))}}),(0,Q.jsx)(ue,{open:T!==null,title:T?.kind===`delete`?i?`删除智能体?`:`Delete agent?`:i?`放弃未保存的更改?`:`Discard unsaved changes?`,description:T?.kind===`delete`?i?`删除 ${T.displayName}?此操作无法撤销。`:`Delete ${T.displayName}? This cannot be undone.`:i?`当前更改尚未保存,离开后将丢失。`:`Your changes have not been saved. Leaving will discard them.`,confirmLabel:T?.kind===`delete`?i?`删除`:`Delete`:i?`放弃并离开`:`Discard and leave`,cancelLabel:i?`继续编辑`:`Keep editing`,destructive:!0,overlayClassName:`z-[100]`,contentClassName:`z-[101]`,onConfirm:q,onCancel:()=>E(null)})]}):(0,Q.jsx)(ge,{className:Xe,padding:Ye,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i?`需要本机服务令牌。`:`Local service token required.`})})}export{$e as AgentsSettingsPanel};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./copy-Dv6d4Dvw.js";import{t as a}from"./messages-BHvpZNe9.js";import{t as o}from"./cn-JdwAhgNB.js";import{a as s,n as c,r as l}from"./locale-store-DId6-v2R.js";import{a as u,i as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{t as g}from"./copy-to-clipboard-HOJ79TWv.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-CS04eWY9.js";import{n as y}from"./interaction-BdhHBbYa.js";import{t as b}from"./skeleton-BwbyijEw.js";import{i as x,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as C}from"./electron-env-Dit0bHgy.js";import{r as w}from"./settings-form-draft-Dy10ldo8.js";import{es as T}from"./index-BYNmHn-z.js";import{n as E,r as D}from"./settings-page-layout-X1x-2Cp9.js";import{r as O,t as k}from"./settings-form-section-exRhP9xn.js";import{t as A}from"./settings-loading-skeleton-CAmWMaOT.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,M.useReducer)(w,L),{info:s,loadError:c,actionError:l,copiedField:_,clearDialogOpen:b,clearConfirmChecked:C,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:O,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await g(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:O});n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(A,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=C&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(k,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(T,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:o(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,y.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:o(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,y.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:o(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,y.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:o(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,y.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(h,{open:b,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(f,{children:[(0,N.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:o(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:C,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:o(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(h,{open:D,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(f,{children:[(0,N.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:o(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:O,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),O?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await s(l(`/api/migrations/status`))).payload}async function B(){await s(l(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=_(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":`true`,children:[(0,N.jsx)(b,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(b,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),f=u.filter(e=>e.safety===`auto`&&e.status===`planned`),p=d.length>0||u.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:p?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(f.length))})]}),f.length>0&&!p?(0,N.jsx)(v,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=c(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,o=typeof window<`u`?window.electronAPI?.system:void 0;if(!C()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=O(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let s;e[18]===i.title?s=e[19]:(s=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=s);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:o,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==s||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[s,l,u]}),e[24]=s,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./copy-Dv6d4Dvw.js";import{t as a}from"./messages-BHvpZNe9.js";import{t as o}from"./cn-JdwAhgNB.js";import{a as s,n as c,r as l}from"./locale-store-DId6-v2R.js";import{a as u,i as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{t as g}from"./copy-to-clipboard-HOJ79TWv.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-CS04eWY9.js";import{n as y}from"./interaction-BdhHBbYa.js";import{t as b}from"./skeleton-BwbyijEw.js";import{i as x,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as C}from"./electron-env-Dit0bHgy.js";import{r as w}from"./settings-form-draft-Dy10ldo8.js";import{es as T}from"./index-BpXej9jJ.js";import{n as E,r as D}from"./settings-page-layout-X1x-2Cp9.js";import{r as O,t as k}from"./settings-form-section-exRhP9xn.js";import{t as A}from"./settings-loading-skeleton-CAmWMaOT.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,M.useReducer)(w,L),{info:s,loadError:c,actionError:l,copiedField:_,clearDialogOpen:b,clearConfirmChecked:C,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:O,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await g(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:O});n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(A,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=C&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(k,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(T,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:o(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,y.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:o(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,y.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:o(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,y.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:o(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,y.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(h,{open:b,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(f,{children:[(0,N.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:o(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:C,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:o(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(h,{open:D,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(f,{children:[(0,N.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:o(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:O,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),O?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await s(l(`/api/migrations/status`))).payload}async function B(){await s(l(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=_(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":`true`,children:[(0,N.jsx)(b,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(b,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),f=u.filter(e=>e.safety===`auto`&&e.status===`planned`),p=d.length>0||u.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:p?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(f.length))})]}),f.length>0&&!p?(0,N.jsx)(v,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=c(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,o=typeof window<`u`?window.electronAPI?.system:void 0;if(!C()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=O(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let s;e[18]===i.title?s=e[19]:(s=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=s);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:o,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==s||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[s,l,u]}),e[24]=s,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
@@ -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{n as i,r as a}from"./popover-select-BgSdSbCL.js";import{t as o}from"./messages-BHvpZNe9.js";import{t as s}from"./cn-JdwAhgNB.js";import{a as c,n as l,r as u}from"./locale-store-DId6-v2R.js";import{n as d}from"./interaction-BdhHBbYa.js";import{n as f,r as p}from"./gateway-config-swr-CoRoOG1l.js";import{i as m}from"./theme-store-OhcbFEUR.js";import{t as h}from"./skeleton-BwbyijEw.js";import{Pr as g,ea as _}from"./index-BYNmHn-z.js";import{n as v,r as y}from"./settings-page-layout-X1x-2Cp9.js";import{t as b}from"./settings-advanced-gate-DRc9IDJf.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await c(u(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await f()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:a}=e,o;t[0]===a?o=t[1]:(o=s(`min-w-0`,a),t[0]=a,t[1]=o);let c;t[2]===n?c=t[3]:(c=n?(0,E.jsx)(`h2`,{className:`mb-2 px-1 text-xs font-medium text-fg-muted`,children:n}):null,t[2]=n,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:i}),t[4]=i,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,E.jsx)(`p`,{className:`mt-2 px-1 text-xs leading-5 text-fg-subtle`,children:r}):null,t[6]=r,t[7]=u);let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,E.jsxs)(`section`,{className:o,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}},porcelain:{light:{canvas:`#f6f0e7`,panel:`#fffcf7`,accent:`#985d4d`,fg:`#352e2a`,muted:`#e8d9cf`},dark:{canvas:`#211c19`,panel:`#2b2420`,accent:`#d4a08c`,fg:`#f3eae1`,muted:`#493a32`}},dawn:{light:{canvas:`#accdec`,panel:`#f8fbff`,accent:`#34363a`,fg:`#262626`,muted:`#e7ebf4`},dark:{canvas:`#172433`,panel:`#253342`,accent:`#d9dde2`,fg:`#f3f6fa`,muted:`#415264`}}};function k(e){let t=(0,S.c)(23),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c={backgroundColor:r},t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[4]=i,t[5]=l);let u;t[6]===a?u=t[7]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[6]=a,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===o?f=t[12]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[11]=o,t[12]=f);let p;t[13]===o?p=t[14]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[13]=o,t[14]=p);let m;t[15]!==c||t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm p-1`,style:c,children:[d,f,p]}),t[15]=c,t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==s||t[21]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[20]=s,t[21]=m,t[22]=h):h=t[22],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`porcelain`,labelKey:`colorSchemePorcelain`},{value:`dawn`,labelKey:`colorSchemeDawn`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(13),t=l(F),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=m(P),a=m(N),c;e[2]===r.colorSchemeTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`min-w-0`,children:(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.colorSchemeTitle})}),e[2]=r.colorSchemeTitle,e[3]=c);let u;e[4]!==r||e[5]!==i||e[6]!==a?(u=j.map(e=>{let{value:t,labelKey:n}=e,o=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:()=>a(t),className:s(`flex flex-col gap-2 rounded-xl bg-surface-hover/25 p-2.5 text-left transition-[background-color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,d.pressCard,o?`bg-surface-active shadow-surface`:`hover:bg-surface-hover/60`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:s(`text-xs font-medium leading-none`,o?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=i,e[6]=a,e[7]=u):u=e[7];let f;e[8]===u?f=e[9]:(f=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-5`,children:u}),e[8]=u,e[9]=f);let p;return e[10]!==c||e[11]!==f?(p=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[c,f]}),e[10]=c,e[11]=f,e[12]=p):p=e[12],p}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(28),t=l(L),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:c,isLoading:u}=p(!0),d=c?.payload?.config,f;e[2]===d?f=e[3]:(f=w(d),e[2]=d,e[3]=f);let m=f,[g,_]=(0,x.useState)(m),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===m?(D=e[5],O=e[6]):(D=()=>_(m),O=[m],e[4]=m,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`min-w-0 text-sm font-medium text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]!==r.activityDetailLevels||e[12]!==A||e[13]!==u||e[14]!==g||e[15]!==v?(M=u?(0,E.jsx)(h,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(i,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(a,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(a,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(a,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=u,e[14]=g,e[15]=v,e[16]=M):M=e[16];let N;e[17]!==j||e[18]!==M?(N=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[j,M]}),e[17]=j,e[18]=M,e[19]=N):N=e[19];let P;e[20]!==r.activityDetailSaveError||e[21]!==r.activityDetailSaving||e[22]!==b||e[23]!==v?(P=b||v?(0,E.jsx)(`p`,{className:s(`text-xs`,b?`text-red-600 dark:text-red-400`:`text-fg-subtle`),children:b?r.activityDetailSaveError:r.activityDetailSaving}):null,e[20]=r.activityDetailSaveError,e[21]=r.activityDetailSaving,e[22]=b,e[23]=v,e[24]=P):P=e[24];let F;return e[25]!==N||e[26]!==P?(F=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3.5 sm:px-5 sm:py-4`,children:[N,P]}),e[25]=N,e[26]=P,e[27]=F):F=e[27],F}function L(e){return e.language}function R(){let e=(0,S.c)(17),t=l(V),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=g(B),a=g(z),s;e[2]===r.showRawToolDataTitle?s=e[3]:(s=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=s);let c;e[4]===r.showRawToolDataDescription?c=e[5]:(c=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=c);let u;e[6]!==s||e[7]!==c?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),e[6]=s,e[7]=c,e[8]=u):u=e[8];let d;e[9]===a?d=e[10]:(d=e=>a(e.target.checked),e[9]=a,e[10]=d);let f;e[11]!==i||e[12]!==d?(f=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f?(p=(0,E.jsx)(`div`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[u,f]})}),e[14]=u,e[15]=f,e[16]=p):p=e[16],p}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(12),t=l(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]===r.pageTitle?i=e[3]:(i=(0,E.jsx)(v,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=i);let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,E.jsx)(D,{children:(0,E.jsx)(_,{variant:`page`,sections:[`language`]})}),e[4]=a):a=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,E.jsxs)(D,{children:[(0,E.jsx)(_,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=s):s=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,E.jsx)(R,{}),e[6]=c):c=e[6];let u;e[7]===r.developerGroupTitle?u=e[8]:(u=(0,E.jsx)(b,{children:(0,E.jsx)(D,{title:r.developerGroupTitle,children:c})}),e[7]=r.developerGroupTitle,e[8]=u);let d;return e[9]!==i||e[10]!==u?(d=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,a,s,u]}),e[9]=i,e[10]=u,e[11]=d):d=e[11],d}function U(e){return e.language}export{H as AppearanceSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-BgSdSbCL.js";import{t as o}from"./messages-BHvpZNe9.js";import{t as s}from"./cn-JdwAhgNB.js";import{a as c,n as l,r as u}from"./locale-store-DId6-v2R.js";import{n as d}from"./interaction-BdhHBbYa.js";import{n as f,r as p}from"./gateway-config-swr-CoRoOG1l.js";import{i as m}from"./theme-store-OhcbFEUR.js";import{t as h}from"./skeleton-BwbyijEw.js";import{Pr as g,ea as _}from"./index-BpXej9jJ.js";import{n as v,r as y}from"./settings-page-layout-X1x-2Cp9.js";import{t as b}from"./settings-advanced-gate-BNhgbmcX.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await c(u(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await f()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:a}=e,o;t[0]===a?o=t[1]:(o=s(`min-w-0`,a),t[0]=a,t[1]=o);let c;t[2]===n?c=t[3]:(c=n?(0,E.jsx)(`h2`,{className:`mb-2 px-1 text-xs font-medium text-fg-muted`,children:n}):null,t[2]=n,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:i}),t[4]=i,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,E.jsx)(`p`,{className:`mt-2 px-1 text-xs leading-5 text-fg-subtle`,children:r}):null,t[6]=r,t[7]=u);let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,E.jsxs)(`section`,{className:o,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}},porcelain:{light:{canvas:`#f6f0e7`,panel:`#fffcf7`,accent:`#985d4d`,fg:`#352e2a`,muted:`#e8d9cf`},dark:{canvas:`#211c19`,panel:`#2b2420`,accent:`#d4a08c`,fg:`#f3eae1`,muted:`#493a32`}},dawn:{light:{canvas:`#accdec`,panel:`#f8fbff`,accent:`#34363a`,fg:`#262626`,muted:`#e7ebf4`},dark:{canvas:`#172433`,panel:`#253342`,accent:`#d9dde2`,fg:`#f3f6fa`,muted:`#415264`}}};function k(e){let t=(0,S.c)(23),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c={backgroundColor:r},t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[4]=i,t[5]=l);let u;t[6]===a?u=t[7]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[6]=a,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===o?f=t[12]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[11]=o,t[12]=f);let p;t[13]===o?p=t[14]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[13]=o,t[14]=p);let m;t[15]!==c||t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm p-1`,style:c,children:[d,f,p]}),t[15]=c,t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==s||t[21]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[20]=s,t[21]=m,t[22]=h):h=t[22],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`porcelain`,labelKey:`colorSchemePorcelain`},{value:`dawn`,labelKey:`colorSchemeDawn`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(13),t=l(F),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=m(P),a=m(N),c;e[2]===r.colorSchemeTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`min-w-0`,children:(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.colorSchemeTitle})}),e[2]=r.colorSchemeTitle,e[3]=c);let u;e[4]!==r||e[5]!==i||e[6]!==a?(u=j.map(e=>{let{value:t,labelKey:n}=e,o=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:()=>a(t),className:s(`flex flex-col gap-2 rounded-xl bg-surface-hover/25 p-2.5 text-left transition-[background-color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,d.pressCard,o?`bg-surface-active shadow-surface`:`hover:bg-surface-hover/60`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:s(`text-xs font-medium leading-none`,o?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=i,e[6]=a,e[7]=u):u=e[7];let f;e[8]===u?f=e[9]:(f=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-5`,children:u}),e[8]=u,e[9]=f);let p;return e[10]!==c||e[11]!==f?(p=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[c,f]}),e[10]=c,e[11]=f,e[12]=p):p=e[12],p}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(28),t=l(L),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:c,isLoading:u}=p(!0),d=c?.payload?.config,f;e[2]===d?f=e[3]:(f=w(d),e[2]=d,e[3]=f);let m=f,[g,_]=(0,x.useState)(m),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===m?(D=e[5],O=e[6]):(D=()=>_(m),O=[m],e[4]=m,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`min-w-0 text-sm font-medium text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]!==r.activityDetailLevels||e[12]!==A||e[13]!==u||e[14]!==g||e[15]!==v?(M=u?(0,E.jsx)(h,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(i,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(a,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(a,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(a,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=u,e[14]=g,e[15]=v,e[16]=M):M=e[16];let N;e[17]!==j||e[18]!==M?(N=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[j,M]}),e[17]=j,e[18]=M,e[19]=N):N=e[19];let P;e[20]!==r.activityDetailSaveError||e[21]!==r.activityDetailSaving||e[22]!==b||e[23]!==v?(P=b||v?(0,E.jsx)(`p`,{className:s(`text-xs`,b?`text-red-600 dark:text-red-400`:`text-fg-subtle`),children:b?r.activityDetailSaveError:r.activityDetailSaving}):null,e[20]=r.activityDetailSaveError,e[21]=r.activityDetailSaving,e[22]=b,e[23]=v,e[24]=P):P=e[24];let F;return e[25]!==N||e[26]!==P?(F=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3.5 sm:px-5 sm:py-4`,children:[N,P]}),e[25]=N,e[26]=P,e[27]=F):F=e[27],F}function L(e){return e.language}function R(){let e=(0,S.c)(17),t=l(V),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=g(B),a=g(z),s;e[2]===r.showRawToolDataTitle?s=e[3]:(s=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=s);let c;e[4]===r.showRawToolDataDescription?c=e[5]:(c=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=c);let u;e[6]!==s||e[7]!==c?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),e[6]=s,e[7]=c,e[8]=u):u=e[8];let d;e[9]===a?d=e[10]:(d=e=>a(e.target.checked),e[9]=a,e[10]=d);let f;e[11]!==i||e[12]!==d?(f=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f?(p=(0,E.jsx)(`div`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[u,f]})}),e[14]=u,e[15]=f,e[16]=p):p=e[16],p}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(12),t=l(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]===r.pageTitle?i=e[3]:(i=(0,E.jsx)(v,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=i);let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,E.jsx)(D,{children:(0,E.jsx)(_,{variant:`page`,sections:[`language`]})}),e[4]=a):a=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,E.jsxs)(D,{children:[(0,E.jsx)(_,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=s):s=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,E.jsx)(R,{}),e[6]=c):c=e[6];let u;e[7]===r.developerGroupTitle?u=e[8]:(u=(0,E.jsx)(b,{children:(0,E.jsx)(D,{title:r.developerGroupTitle,children:c})}),e[7]=r.developerGroupTitle,e[8]=u);let d;return e[9]!==i||e[10]!==u?(d=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,a,s,u]}),e[9]=i,e[10]=u,e[11]=d):d=e[11],d}function U(e){return e.language}export{H as AppearanceSettingsPanel};