@xopcai/xopc 0.0.395 → 0.0.397

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 (192) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/src/plugin.js +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BRtkz-ZU.js → agent-avatar-dicebear-CIEGrioy.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-Dqg2NOn-.js → agent-defaults-settings-panel-CzKNVkRn.js} +1 -1
  6. package/dist/gateway/static/root/assets/agent-plugin-dialog-mpA9rwYd.js +1 -0
  7. package/dist/gateway/static/root/assets/{agents-0zgLsfVA.js → agents-7VMa7Rzo.js} +3 -3
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-BZS8FvoL.js → app-management-settings-panel-DIJ0ii-n.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-RxXMAxiB.js → appearance-settings-BGnyHS-p.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-CvqDUvof.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-DEnHq3OR.js → archive-plugin-CR8FcRAa.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-BwkugzB8.js → automations-page-BLInZo7N.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-workspace-K8aDhoYt.js → automations-workspace-DvTSHLt3.js} +1 -1
  14. package/dist/gateway/static/root/assets/{binary-plugins-NWeXhh1k.js → binary-plugins-DW9pu205.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-D_bKN3BN.js → block-editor-ClgTc5v8.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-automation-inputs-vtPkXfJ8.js → browser-automation-inputs-Bn7kDuUB.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-automations-page-DBPbwOG8.js → browser-automations-page-CJGBhDnv.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-settings-page-VBZDYoXD.js → browser-settings-page-tsi5W-cJ.js} +1 -1
  19. package/dist/gateway/static/root/assets/capabilities-page-CfbGk8q_.js +2 -0
  20. package/dist/gateway/static/root/assets/{capabilities-settings-panel-C_OMsW_8.js → capabilities-settings-panel-BkO7QEyA.js} +1 -1
  21. package/dist/gateway/static/root/assets/{capability-header-actions-CMJXWq8a.js → capability-header-actions-9ZG71-BO.js} +1 -1
  22. package/dist/gateway/static/root/assets/{channels-C_TVCc1N.js → channels-D0CwJktG.js} +1 -1
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-9YRAokOl.js → chat-terminal-dock-x1W2_hwc.js} +1 -1
  24. package/dist/gateway/static/root/assets/{computer-settings-page-BPYAZ4ks.js → computer-settings-page-D_b_bFVz.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connector-service-page-B81cEAEX.js → connector-service-page-Kf8kaNm_.js} +1 -1
  26. package/dist/gateway/static/root/assets/{connectors-page-C0NvAP2V.js → connectors-page-DlpfL2Rc.js} +1 -1
  27. package/dist/gateway/static/root/assets/{date-picker-BvKP4P3n.js → date-picker-d5kiPUG0.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-TvrNaf8y.js → dependency-picker-BcH76tQC.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-De-_QNSD.js → desktop-pet-B-925tPX.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-CRSRTIwT.js → desktop-pet-settings-3XJ4qR65.js} +1 -1
  31. package/dist/gateway/static/root/assets/device-pairing-wizard-12m5Z9-8.js +1 -0
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-DOPXwYNR.js → directory-picker-path-field-B-qZCjGR.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-debug-page-DzXvpUwj.js → extension-debug-page-BlQu1u6X.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-C0S1zNeP.js → extension-page-CXxM1M62.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-C3Z7bFjy.js → extension-settings-page-AF5nvsPP.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-settings-Btc2wTQe.js → gateway-settings-ABXvW_yL.js} +1 -1
  37. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-BFYBbh1P.js → highlighted-body-KQOG7T2V-Czdbbi0H.js} +1 -1
  38. package/dist/gateway/static/root/assets/{home-page-C5sLR47Q.js → home-page-LXGxGwVl.js} +1 -1
  39. package/dist/gateway/static/root/assets/{image-generation-api-Vqcyqnzb.js → image-generation-api-DPFPJ2ps.js} +1 -1
  40. package/dist/gateway/static/root/assets/{imports-page-BJGHrzhX.js → imports-page-Bwyotfbt.js} +1 -1
  41. package/dist/gateway/static/root/assets/index-BKHxJaGD.css +1 -0
  42. package/dist/gateway/static/root/assets/{index-BNRLzxpH.js → index-Dsp_gNdl.js} +116 -116
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BQkQoPmm.js → keyboard-shortcuts-settings-C20gl-l7.js} +1 -1
  44. package/dist/gateway/static/root/assets/{local-app-workbench-page-DbxLz9Ms.js → local-app-workbench-page-o0M_OSjC.js} +1 -1
  45. package/dist/gateway/static/root/assets/{local-apps-page-CaatwSrK.js → local-apps-page-DoWJCmOq.js} +1 -1
  46. package/dist/gateway/static/root/assets/{logs-page-3Wo4Lmts.js → logs-page-BFTL93RX.js} +1 -1
  47. package/dist/gateway/static/root/assets/{management-settings-BHlbM8IM.js → management-settings-C52cuMg1.js} +1 -1
  48. package/dist/gateway/static/root/assets/{media-plugins-Cq1uLrd8.js → media-plugins-DLrTRF0a.js} +1 -1
  49. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CPYJsRUJ.js +1 -0
  50. package/dist/gateway/static/root/assets/{note-detail-panel-MjKND8HC.js → note-detail-panel-CNN41byS.js} +3 -3
  51. package/dist/gateway/static/root/assets/{notes-page-Cv040hVD.js → notes-page-BsfBp_8z.js} +1 -1
  52. package/dist/gateway/static/root/assets/{page-context-capture-button-Cp71nTq2.js → page-context-capture-button-YTVWZ02-.js} +1 -1
  53. package/dist/gateway/static/root/assets/{personal-page-CyEUWV2n.js → personal-page-N4KoCZYG.js} +1 -1
  54. package/dist/gateway/static/root/assets/plugin-details-page-DcrrzQI-.js +1 -0
  55. package/dist/gateway/static/root/assets/{preview-open-alternatives-gzCecXc4.js → preview-open-alternatives-DzA__S54.js} +1 -1
  56. package/dist/gateway/static/root/assets/{product-open-page-CWFT7VuQ.js → product-open-page-DvlMKj0T.js} +1 -1
  57. package/dist/gateway/static/root/assets/{product-preview-content-Dh111Kca.js → product-preview-content-qdFyo4NG.js} +1 -1
  58. package/dist/gateway/static/root/assets/{project-detail-page-CyhyZiTi.js → project-detail-page-y67s_fA8.js} +1 -1
  59. package/dist/gateway/static/root/assets/{projects-page-QUdyJino.js → projects-page-D5iYgi0O.js} +1 -1
  60. package/dist/gateway/static/root/assets/{remote-access-hub-Cd8P0Dxs.js → remote-access-hub-DeFF7Re-.js} +1 -1
  61. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-bTjVfYm5.js → runtime-tools-settings-panel-BCHLh-KQ.js} +1 -1
  62. package/dist/gateway/static/root/assets/{schema-form-BGOzfVyj.js → schema-form-CJvaVHkx.js} +1 -1
  63. package/dist/gateway/static/root/assets/{sessions-page-BGMemJF6.js → sessions-page-DZ93_D5M.js} +1 -1
  64. package/dist/gateway/static/root/assets/settings-advanced-gate-F1WX7vxq.js +1 -0
  65. package/dist/gateway/static/root/assets/{settings-form-section-Bqm1IKvR.js → settings-form-section-B3eODxNv.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-page-CniJVL-o.js → settings-page-Dg86uCnr.js} +1 -1
  67. package/dist/gateway/static/root/assets/{setup-status-panel-JPs4-QRw.js → setup-status-panel-ruFzAArp.js} +1 -1
  68. package/dist/gateway/static/root/assets/{share-preview-page-BnDGFgBR.js → share-preview-page-DCy1f25V.js} +1 -1
  69. package/dist/gateway/static/root/assets/{shares-settings-Cgp5BuLt.js → shares-settings-DeIVZvpJ.js} +1 -1
  70. package/dist/gateway/static/root/assets/{skill-api-CFdrz6tl.js → skill-api-RisyPAMA.js} +1 -1
  71. package/dist/gateway/static/root/assets/{skill-reload-api-Cy5jVfms.js → skill-reload-api-Dwkm1Fof.js} +1 -1
  72. package/dist/gateway/static/root/assets/{skills-page-CxaA3P5E.js → skills-page-UiTLsrFc.js} +1 -1
  73. package/dist/gateway/static/root/assets/{style-C_MAnir7.js → style-CwMX73G7.js} +1 -1
  74. package/dist/gateway/static/root/assets/{system-settings-panel-BjnIlilP.js → system-settings-panel-Cma37Pfm.js} +1 -1
  75. package/dist/gateway/static/root/assets/{task-detail-page-Bg79rPnF.js → task-detail-page-BKOF_kxS.js} +1 -1
  76. package/dist/gateway/static/root/assets/{tracing-settings-page-BCI0tUbe.js → tracing-settings-page-DC-kLysq.js} +1 -1
  77. package/dist/gateway/static/root/assets/{tunnel-api-0knnta9z.js → tunnel-api-BgdhbR1L.js} +1 -1
  78. package/dist/gateway/static/root/assets/{usage-page-D5aT1eie.js → usage-page-BSlFg3Xj.js} +1 -1
  79. package/dist/gateway/static/root/assets/{use-autosave-Ds_mbAfe.js → use-autosave-iKvZ1pvC.js} +1 -1
  80. package/dist/gateway/static/root/assets/{user-model-page-D7L0-pDt.js → user-model-page-D4GB8QsM.js} +1 -1
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-CPoGdarN.js → voice-api-key-field-CESbtuwM.js} +1 -1
  82. package/dist/gateway/static/root/assets/{work-discovery-overlay-CWNguy2Z.js → work-discovery-overlay-dtPpmYyh.js} +1 -1
  83. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BcDMFfkT.js → workflow-run-setup-panel-DmFn3E_B.js} +1 -1
  84. package/dist/gateway/static/root/assets/{workflows-page-BwZB-s4N.js → workflows-page-DEtaRuxH.js} +1 -1
  85. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DlKr98VO.js → xopc-cloud-account-card-DTZnabfg.js} +1 -1
  86. package/dist/gateway/static/root/index.html +2 -2
  87. package/dist/package.js +1 -1
  88. package/dist/src/agent/embedded/codemode-extension.d.ts +1 -0
  89. package/dist/src/agent/embedded/codemode-extension.js +6 -1
  90. package/dist/src/agent/embedded/run-for-session.js +1 -1
  91. package/dist/src/agent/embedded/run-turn.js +34 -2
  92. package/dist/src/agent/embedded/session-runner.js +1 -1
  93. package/dist/src/agent/mcp/config.d.ts +2 -0
  94. package/dist/src/agent/mcp/config.js +2 -2
  95. package/dist/src/agent/mcp/connection-setup.js +13 -1
  96. package/dist/src/agent/mcp/effective-server.d.ts +3 -0
  97. package/dist/src/agent/mcp/effective-server.js +27 -0
  98. package/dist/src/agent/mcp/native-mcp.d.ts +1 -1
  99. package/dist/src/agent/mcp/native-mcp.js +13 -4
  100. package/dist/src/agent/mcp/tool-catalog.js +2 -1
  101. package/dist/src/agent/skills/index.d.ts +1 -0
  102. package/dist/src/agent/skills/index.js +6 -2
  103. package/dist/src/agent/skills/skill-manager.d.ts +1 -0
  104. package/dist/src/agent/skills/skill-manager.js +6 -1
  105. package/dist/src/agent/skills/skill-sources.d.ts +1 -0
  106. package/dist/src/agent/skills/skill-sources.js +4 -3
  107. package/dist/src/agent/skills/types.d.ts +1 -0
  108. package/dist/src/agent/workspace-runtime/registry.js +6 -2
  109. package/dist/src/browser/native-messaging-host.js +1 -1
  110. package/dist/src/browser/providers/browser-ext-install.js +2 -2
  111. package/dist/src/channels/index.js +1 -1
  112. package/dist/src/channels/manager.js +1 -1
  113. package/dist/src/cli/commands/channels.js +1 -1
  114. package/dist/src/cli/commands/connectors.js +1 -1
  115. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  116. package/dist/src/cli/commands/extension-agent-plugin.js +92 -7
  117. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  118. package/dist/src/cli/commands/extension.js +1 -1
  119. package/dist/src/cli/commands/mcp.js +6 -4
  120. package/dist/src/cli/commands/models.js +1 -1
  121. package/dist/src/cli/commands/onboard/model.js +1 -1
  122. package/dist/src/cli/commands/onboard.js +1 -1
  123. package/dist/src/extensions/agent-plugins/auth.d.ts +7 -1
  124. package/dist/src/extensions/agent-plugins/auth.js +53 -12
  125. package/dist/src/extensions/agent-plugins/branding.d.ts +6 -0
  126. package/dist/src/extensions/agent-plugins/branding.js +44 -0
  127. package/dist/src/extensions/agent-plugins/cli-authorization.d.ts +22 -0
  128. package/dist/src/extensions/agent-plugins/cli-authorization.js +198 -0
  129. package/dist/src/extensions/agent-plugins/connection-reuse.d.ts +10 -0
  130. package/dist/src/extensions/agent-plugins/connection-reuse.js +23 -0
  131. package/dist/src/extensions/agent-plugins/credentials.js +24 -1
  132. package/dist/src/extensions/agent-plugins/formats.d.ts +27 -0
  133. package/dist/src/extensions/agent-plugins/formats.js +208 -0
  134. package/dist/src/extensions/agent-plugins/inventory.d.ts +142 -2
  135. package/dist/src/extensions/agent-plugins/inventory.js +39 -5
  136. package/dist/src/extensions/agent-plugins/mcp-adapter.d.ts +2 -1
  137. package/dist/src/extensions/agent-plugins/mcp-adapter.js +42 -8
  138. package/dist/src/extensions/agent-plugins/mcp-format.d.ts +2 -0
  139. package/dist/src/extensions/agent-plugins/mcp-format.js +82 -0
  140. package/dist/src/extensions/agent-plugins/resources.d.ts +14 -0
  141. package/dist/src/extensions/agent-plugins/resources.js +112 -0
  142. package/dist/src/extensions/agent-plugins/setup-contract.d.ts +54 -0
  143. package/dist/src/extensions/agent-plugins/setup-contract.js +58 -0
  144. package/dist/src/extensions/agent-plugins/setup.d.ts +119 -0
  145. package/dist/src/extensions/agent-plugins/setup.js +491 -0
  146. package/dist/src/extensions/agent-plugins/source-catalog.d.ts +21 -0
  147. package/dist/src/extensions/agent-plugins/source-catalog.js +175 -0
  148. package/dist/src/extensions/agent-plugins/sources.d.ts +1 -1
  149. package/dist/src/extensions/agent-plugins/sources.js +12 -3
  150. package/dist/src/extensions/agent-plugins/store.d.ts +33 -2
  151. package/dist/src/extensions/agent-plugins/store.js +175 -25
  152. package/dist/src/extensions/agent-plugins/user-config.d.ts +5 -0
  153. package/dist/src/extensions/agent-plugins/user-config.js +49 -0
  154. package/dist/src/extensions/agent-plugins/validation.d.ts +26 -1
  155. package/dist/src/extensions/agent-plugins/validation.js +142 -27
  156. package/dist/src/extensions/sdk/index.js +1 -1
  157. package/dist/src/gateway/hono/app.js +1 -1
  158. package/dist/src/gateway/hono/routes/agent-plugins.js +120 -9
  159. package/dist/src/gateway/hono/routes/browser-install.js +1 -1
  160. package/dist/src/gateway/hono/routes/composer-history.js +22 -4
  161. package/dist/src/gateway/hono/routes/mcp.js +6 -4
  162. package/dist/src/gateway/hono/routes/provider-setup.js +7 -0
  163. package/dist/src/gateway/service.js +11 -9
  164. package/dist/src/gateway/session-context-summary.js +1 -1
  165. package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +4 -0
  166. package/dist/src/gateway/xopc-cloud-capability-setup.js +90 -26
  167. package/dist/src/home-intelligence/host.js +2 -2
  168. package/dist/src/providers/setup/engine.js +12 -10
  169. package/dist/src/providers/setup/voice.js +24 -6
  170. package/dist/src/storage/sqlite/composer-input-history-repository.d.ts +4 -3
  171. package/dist/src/storage/sqlite/composer-input-history-repository.js +10 -8
  172. package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
  173. package/dist/src/storage/sqlite/migrations/257_session_composer_history.sql +11 -0
  174. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  175. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  176. package/dist/src/storage/sqlite/schema.js +1 -1
  177. package/dist/src/tui/backends/embedded-backend.d.ts +2 -2
  178. package/dist/src/tui/backends/embedded-backend.js +4 -4
  179. package/dist/src/tui/backends/gateway-realtime-backend.d.ts +2 -2
  180. package/dist/src/tui/backends/gateway-realtime-backend.js +7 -4
  181. package/dist/src/tui/composer-history.d.ts +14 -0
  182. package/dist/src/tui/composer-history.js +85 -0
  183. package/dist/src/tui/tui-backend.d.ts +4 -3
  184. package/dist/src/tui/tui.js +19 -46
  185. package/package.json +12 -4
  186. package/dist/gateway/static/root/assets/agent-plugin-dialog-CKK95Jmr.js +0 -1
  187. package/dist/gateway/static/root/assets/apps-page-mGU9WLjP.js +0 -1
  188. package/dist/gateway/static/root/assets/capabilities-page-CQsGp9Sx.js +0 -2
  189. package/dist/gateway/static/root/assets/device-pairing-wizard-DnyJ8Bja.js +0 -1
  190. package/dist/gateway/static/root/assets/index-zIgp-ZTu.css +0 -1
  191. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-XhlIBp5t.js +0 -1
  192. package/dist/gateway/static/root/assets/settings-advanced-gate-BiySFw1N.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{g as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./cn-0WouolD0.js";import{c as s,n as c}from"./locale-store-Djl2FW6_.js";import{n as l,r as u}from"./cloud-credits-BMYMiiNn.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{Ao as ee,Cd as te,Fn as ne,G as re,Hn as ie,In as ae,Rc as f,Wc as oe,Xl as p,Zu as m,as as h,du as se,nu as ce,ql as le,ra as g,us as ue,v as _}from"./index-BNRLzxpH.js";import{t as de}from"./number-input-DDeqHK-G.js";import{n as v,r as y}from"./settings-page-layout-Dx5S-Msc.js";import{n as b,t as x}from"./use-autosave-Ds_mbAfe.js";var fe=n(),S=e(t(),1),C=r(),w=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function T(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function pe({draft:e,setDraft:t,zh:n}){let[r,i]=(0,S.useState)(()=>e.runtime.cloudCreditLimitPerRunMicro?l(e.runtime.cloudCreditLimitPerRunMicro):``),[a,o]=(0,S.useState)(!1);return(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`每次运行的 Cloud 消费上限(Credits)`:`Cloud spend limit per run (Credits)`,(0,C.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:r,"aria-invalid":a,placeholder:n?`不设置额外上限`:`No additional limit`,className:`${w} mt-2`,onChange:n=>{let r=n.target.value;i(r);try{let n=r===``?void 0:u(r);if(n===`0`||n&&n.length>15)throw Error(`Invalid limit`);o(!1),t({...e,runtime:{...e.runtime,cloudCreditLimitPerRunMicro:n}})}catch{o(!0)}},onBlur:()=>{a&&i(e.runtime.cloudCreditLimitPerRunMicro?l(e.runtime.cloudCreditLimitPerRunMicro):``),o(!1)}}),(0,C.jsx)(`span`,{className:`mt-2 block font-normal ${a?`text-danger`:`text-fg-subtle`}`,children:a?n?`请输入大于零、最多四位小数的 Credits。无效输入不会保存。`:`Enter positive Credits with up to four decimals. Invalid input is not saved.`:n?`模型、图片和文件语音调用共享上限;不支持实时语音或 Cloud 电脑控制,不包含运行前后的后台调用。达到上限后停止,调整后需手动继续。`:`Shared by model, image and file audio calls during a run. Does not support realtime voice or Cloud computer use; excludes background calls outside the run. Stops at the limit; continue manually after adjusting it.`})]})}function E(e){let t=(0,fe.c)(189),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let s=d(`agent-defaults-workflows`,_,a),c;t[1]===s.data?c=t[2]:(c=s.data??[],t[1]=s.data,t[2]=c);let l;t[3]===c?l=t[4]:(l=c.map(D),t[3]=c,t[4]=l);let u=l,te=n.workflows.allowed===void 0,ne;t[5]!==n||t[6]!==r?(ne=(e,t)=>{let i=n.workflows.allowed??[],a=t?[...new Set([...i,e])]:i.filter(t=>t!==e);r({...n,workflows:{...n.workflows,allowed:a}})},t[5]=n,t[6]=r,t[7]=ne):ne=t[7];let ie=ne,ae=i?`费用控制`:`Spending control`,f;t[8]===ae?f=t[9]:(f=(0,C.jsx)(`h2`,{className:`mb-4 text-base font-semibold text-fg`,children:ae}),t[8]=ae,t[9]=f);let p;t[10]!==n||t[11]!==r||t[12]!==i?(p=(0,C.jsx)(pe,{draft:n,setDraft:r,zh:i}),t[10]=n,t[11]=r,t[12]=i,t[13]=p):p=t[13];let m;t[14]!==f||t[15]!==p?(m=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[f,p]}),t[14]=f,t[15]=p,t[16]=m):m=t[16];let h=i?`执行与缓存策略`:`Execution and cache policy`,se=i?`轮数:${n.runtime.maxTurns??`默认`} · 超时:${n.runtime.timeoutMs??`默认`} · 缓存:${n.runtime.promptCache?.mode??`默认`} · Codemode:${n.runtime.codemode?.enabled?`开启`:`关闭`}`:`Turns: ${n.runtime.maxTurns??`default`} · Timeout: ${n.runtime.timeoutMs??`default`} · Cache: ${n.runtime.promptCache?.mode??`default`} · Codemode: ${n.runtime.codemode?.enabled?`on`:`off`}`,ce=n.runtime.codemode?.enabled??!1,le;t[17]!==n||t[18]!==r?(le=e=>r({...n,runtime:{...n.runtime,codemode:{...n.runtime.codemode,enabled:e.target.checked}}}),t[17]=n,t[18]=r,t[19]=le):le=t[19];let g;t[20]!==ce||t[21]!==le?(g=(0,C.jsx)(`input`,{type:`checkbox`,checked:ce,onChange:le,className:`mt-1 size-4 accent-[var(--color-accent)]`}),t[20]=ce,t[21]=le,t[22]=g):g=t[22];let v=i?`Codemode 读取试点`:`Codemode read pilot`,y;t[23]===v?y=t[24]:(y=(0,C.jsx)(`span`,{className:`block text-base font-semibold text-fg`,children:v}),t[23]=v,t[24]=y);let b=i?`允许智能体用脚本组合已授权的读取工具。默认关闭,保留普通工具调用。`:`Let agents combine authorized reads in scripts. Off by default; ordinary tool calls stay available.`,x;t[25]===b?x=t[26]:(x=(0,C.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:b}),t[25]=b,t[26]=x);let S;t[27]!==y||t[28]!==x?(S=(0,C.jsxs)(`span`,{children:[y,x]}),t[27]=y,t[28]=x,t[29]=S):S=t[29];let E;t[30]!==g||t[31]!==S?(E=(0,C.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:(0,C.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3`,children:[g,S]})}),t[30]=g,t[31]=S,t[32]=E):E=t[32];let O=i?`执行限制`:`Execution limits`,k;t[33]===O?k=t[34]:(k=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:O}),t[33]=O,t[34]=k);let me=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,A;t[35]===me?A=t[36]:(A=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:me}),t[35]=me,t[36]=A);let he=i?`每次运行最多轮数`:`Maximum turns per run`,ge=n.runtime.maxTurns??``,_e=i?`系统默认`:`System default`,j;t[37]!==n||t[38]!==r?(j=e=>r({...n,runtime:{...n.runtime,maxTurns:T(e.target.value)}}),t[37]=n,t[38]=r,t[39]=j):j=t[39];let M;t[40]!==ge||t[41]!==_e||t[42]!==j?(M=(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:ge,placeholder:_e,onChange:j,className:`${w} mt-2`}),t[40]=ge,t[41]=_e,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==he||t[45]!==M?(N=(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[he,M]}),t[44]=he,t[45]=M,t[46]=N):N=t[46];let ve=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,P=n.runtime.timeoutMs??``,F=i?`系统默认`:`System default`,I;t[47]!==n||t[48]!==r?(I=e=>r({...n,runtime:{...n.runtime,timeoutMs:T(e.target.value)}}),t[47]=n,t[48]=r,t[49]=I):I=t[49];let L;t[50]!==P||t[51]!==F||t[52]!==I?(L=(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:P,placeholder:F,onChange:I,className:`${w} mt-2`}),t[50]=P,t[51]=F,t[52]=I,t[53]=L):L=t[53];let R;t[54]!==ve||t[55]!==L?(R=(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[ve,L]}),t[54]=ve,t[55]=L,t[56]=R):R=t[56];let z=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,B=n.runtime.maxToolFailuresPerTurn??``,V=i?`系统默认`:`System default`,H;t[57]!==n||t[58]!==r?(H=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:T(e.target.value)}}),t[57]=n,t[58]=r,t[59]=H):H=t[59];let U;t[60]!==B||t[61]!==V||t[62]!==H?(U=(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:B,placeholder:V,onChange:H,className:`${w} mt-2`}),t[60]=B,t[61]=V,t[62]=H,t[63]=U):U=t[63];let W;t[64]!==z||t[65]!==U?(W=(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[z,U]}),t[64]=z,t[65]=U,t[66]=W):W=t[66];let G;t[67]!==N||t[68]!==R||t[69]!==W?(G=(0,C.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[N,R,W]}),t[67]=N,t[68]=R,t[69]=W,t[70]=G):G=t[70];let K;t[71]!==k||t[72]!==A||t[73]!==G?(K=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[k,A,G]}),t[71]=k,t[72]=A,t[73]=G,t[74]=K):K=t[74];let q=i?`提示词缓存`:`Prompt cache`,J;t[75]===q?J=t[76]:(J=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:q}),t[75]=q,t[76]=J);let Y=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,X;t[77]===Y?X=t[78]:(X=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Y}),t[77]=Y,t[78]=X);let ye=i?`缓存模式`:`Cache mode`,Z;t[79]===ye?Z=t[80]:(Z=(0,C.jsx)(`span`,{children:ye}),t[79]=ye,t[80]=Z);let be=i?`缓存模式`:`Cache mode`,Q;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(Q=[`auto`,`off`],t[81]=Q):Q=t[81];let $;t[82]!==n||t[83]!==r||t[84]!==i?($=Q.map(e=>(0,C.jsx)(oe,{"aria-pressed":n.runtime.promptCache?.mode===e,variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e)),t[82]=n,t[83]=r,t[84]=i,t[85]=$):$=t[85];let xe;t[86]!==be||t[87]!==$?(xe=(0,C.jsx)(ee,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":be,children:$}),t[86]=be,t[87]=$,t[88]=xe):xe=t[88];let Se;t[89]!==Z||t[90]!==xe?(Se=(0,C.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[Z,xe]}),t[89]=Z,t[90]=xe,t[91]=Se):Se=t[91];let Ce;t[92]!==n||t[93]!==r||t[94]!==i?(Ce=n.runtime.promptCache?.mode===`auto`?(0,C.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,C.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,C.jsx)(ee,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":i?`缓存周期`:`Cache lifetime`,children:[`short`,`long`].map(e=>(0,C.jsx)(oe,{"aria-pressed":n.runtime.promptCache?.lifetime===e,variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[92]=n,t[93]=r,t[94]=i,t[95]=Ce):Ce=t[95];let we;t[96]!==Se||t[97]!==Ce?(we=(0,C.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[Se,Ce]}),t[96]=Se,t[97]=Ce,t[98]=we):we=t[98];let Te;t[99]!==J||t[100]!==X||t[101]!==we?(Te=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[J,X,we]}),t[99]=J,t[100]=X,t[101]=we,t[102]=Te):Te=t[102];let Ee;t[103]!==se||t[104]!==E||t[105]!==K||t[106]!==Te||t[107]!==h?(Ee=(0,C.jsxs)(re,{title:h,summary:se,children:[E,K,Te]}),t[103]=se,t[104]=E,t[105]=K,t[106]=Te,t[107]=h,t[108]=Ee):Ee=t[108];let De=i?`工作流`:`Workflows`,Oe;t[109]===De?Oe=t[110]:(Oe=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:De}),t[109]=De,t[110]=Oe);let ke=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,Ae;t[111]===ke?Ae=t[112]:(Ae=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ke}),t[111]=ke,t[112]=Ae);let je=i?`默认工作流`:`Default workflow`,Me=n.workflows.default||(i?`未自动绑定工作流`:`No workflow bound automatically`),Ne=i?`默认工作流`:`Default workflow`,Pe;t[113]===Ne?Pe=t[114]:(Pe=(0,C.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:Ne}),t[113]=Ne,t[114]=Pe);let Fe=n.workflows.default??``,Ie=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,Le=i?`不设置默认工作流`:`No default workflow`,Re=i?`默认工作流`:`Default workflow`,ze;t[115]!==n||t[116]!==r?(ze=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[115]=n,t[116]=r,t[117]=ze):ze=t[117];let Be;t[118]!==Fe||t[119]!==Ie||t[120]!==Le||t[121]!==Re||t[122]!==ze||t[123]!==u||t[124]!==s.isLoading?(Be=(0,C.jsx)(ue,{value:Fe,options:u,placeholder:Ie,emptyLabel:Le,disabled:s.isLoading,ariaLabel:Re,onChange:ze,triggerClassName:`mt-2`}),t[118]=Fe,t[119]=Ie,t[120]=Le,t[121]=Re,t[122]=ze,t[123]=u,t[124]=s.isLoading,t[125]=Be):Be=t[125];let Ve;t[126]!==Pe||t[127]!==Be?(Ve=(0,C.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[Pe,Be]}),t[126]=Pe,t[127]=Be,t[128]=Ve):Ve=t[128];let He;t[129]!==je||t[130]!==Me||t[131]!==Ve?(He=(0,C.jsx)(re,{title:je,summary:Me,children:Ve}),t[129]=je,t[130]=Me,t[131]=Ve,t[132]=He):He=t[132];let Ue;t[133]===s.error?Ue=t[134]:(Ue=s.error?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-red-600`,children:s.error instanceof Error?s.error.message:String(s.error)}):null,t[133]=s.error,t[134]=Ue);let We=i?`允许调用的工作流`:`Allowed workflows`,Ge;t[135]===We?Ge=t[136]:(Ge=(0,C.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:We}),t[135]=We,t[136]=Ge);let Ke;t[137]!==n||t[138]!==r?(Ke=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[137]=n,t[138]=r,t[139]=Ke):Ke=t[139];let qe=te?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,Je;t[140]===qe?Je=t[141]:(Je=o(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,qe),t[140]=qe,t[141]=Je);let Ye=i?`允许全部工作流`:`Allow every workflow`,Xe;t[142]===Ye?Xe=t[143]:(Xe=(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Ye}),t[142]=Ye,t[143]=Xe);let Ze=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,Qe;t[144]===Ze?Qe=t[145]:(Qe=(0,C.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Ze}),t[144]=Ze,t[145]=Qe);let $e;t[146]!==Ke||t[147]!==Je||t[148]!==Xe||t[149]!==Qe?($e=(0,C.jsxs)(`button`,{type:`button`,onClick:Ke,className:Je,children:[Xe,Qe]}),t[146]=Ke,t[147]=Je,t[148]=Xe,t[149]=Qe,t[150]=$e):$e=t[150];let et;t[151]!==n||t[152]!==r?(et=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[151]=n,t[152]=r,t[153]=et):et=t[153];let tt=te?`hover:bg-surface-hover`:`bg-accent-soft shadow-surface`,nt;t[154]===tt?nt=t[155]:(nt=o(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,tt),t[154]=tt,t[155]=nt);let rt=i?`只允许选中的工作流`:`Allow selected workflows only`,it;t[156]===rt?it=t[157]:(it=(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:rt}),t[156]=rt,t[157]=it);let at=i?`未选中的工作流不能被调用。`:`Unselected workflows cannot be invoked.`,ot;t[158]===at?ot=t[159]:(ot=(0,C.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:at}),t[158]=at,t[159]=ot);let st;t[160]!==et||t[161]!==nt||t[162]!==it||t[163]!==ot?(st=(0,C.jsxs)(`button`,{type:`button`,onClick:et,className:nt,children:[it,ot]}),t[160]=et,t[161]=nt,t[162]=it,t[163]=ot,t[164]=st):st=t[164];let ct;t[165]!==$e||t[166]!==st?(ct=(0,C.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[$e,st]}),t[165]=$e,t[166]=st,t[167]=ct):ct=t[167];let lt;t[168]!==te||t[169]!==n.workflows.allowed||t[170]!==ie||t[171]!==s.data||t[172]!==s.isLoading||t[173]!==i?(lt=te?null:(0,C.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1 rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[(s.data??[]).map(e=>(0,C.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>ie(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,C.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,C.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[168]=te,t[169]=n.workflows.allowed,t[170]=ie,t[171]=s.data,t[172]=s.isLoading,t[173]=i,t[174]=lt):lt=t[174];let ut;t[175]!==Ge||t[176]!==ct||t[177]!==lt?(ut=(0,C.jsxs)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:[Ge,ct,lt]}),t[175]=Ge,t[176]=ct,t[177]=lt,t[178]=ut):ut=t[178];let dt;t[179]!==Oe||t[180]!==Ae||t[181]!==He||t[182]!==Ue||t[183]!==ut?(dt=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,Ae,He,Ue,ut]}),t[179]=Oe,t[180]=Ae,t[181]=He,t[182]=Ue,t[183]=ut,t[184]=dt):dt=t[184];let ft;return t[185]!==Ee||t[186]!==m||t[187]!==dt?(ft=(0,C.jsxs)(`div`,{className:`space-y-5`,children:[m,Ee,dt]}),t[185]=Ee,t[186]=m,t[187]=dt,t[188]=ft):ft=t[188],ft}function D(e){return{value:e.id,label:e.title||e.name}}function O(e){return[...new Set(e)].sort()}var k=[{id:`core`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`],en:`Core`,zh:`核心`},{id:`office`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`docx`,`pdf`,`pptx`,`xlsx`],en:`Office`,zh:`办公成果`},{id:`local-app`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`build-xopc-local-app`,`frontend-design`,`theme-factory`],en:`Local App`,zh:`本地应用`},{id:`developer`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`diagnose`,`github`,`tdd`,`webapp-testing`],en:`Developer`,zh:`开发者`},{id:`desktop-pet`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`hatch-pet`],en:`Desktop Pet`,zh:`桌面宠物`}];function me(e){let t=(0,fe.c)(115),{draft:n,setDraft:r,zh:i}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[0]=s):s=t[0];let{data:c,error:l,isLoading:u}=d(`agent-defaults-skills-catalog`,g,s),[ee,te]=(0,S.useState)(``),ne=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;c?.catalog;let re;if(t[1]!==ne||t[2]!==c?.catalog||t[3]!==ee){let e=[...c?.catalog??[]],n=new Set(e.map(j));for(let t of ne)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=ee.trim().toLowerCase();re=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(_e),t[1]=ne,t[2]=c?.catalog,t[3]=ee,t[4]=re}else re=t[4];let ie=re,ae;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(ae=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=ae):ae=t[8];let f=ae,oe;t[9]!==n||t[10]!==r?(oe=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):O([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):O([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=oe):oe=t[11];let p=oe,h;t[12]===c?.catalog?h=t[13]:(h=c?.catalog??[],t[12]=c?.catalog,t[13]=h);let se;if(t[14]!==f||t[15]!==h){let e;t[17]===f?e=t[18]:(e=e=>e.enabled&&f(e.name),t[17]=f,t[18]=e),se=h.filter(e),t[14]=f,t[15]=h,t[16]=se}else se=t[16];let le=se.length,ue;t[19]!==c?.catalog||t[20]!==n||t[21]!==r?(ue=e=>{let t=new Set((c?.catalog??[]).filter(ge).map(he));r({...n,skills:{mode:`selected`,include:O(e.filter(e=>t.has(e)))}})},t[19]=c?.catalog,t[20]=n,t[21]=r,t[22]=ue):ue=t[22];let _=ue,de=i?`技能策略`:`Skill policy`,v;t[23]===de?v=t[24]:(v=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:de}),t[23]=de,t[24]=v);let y=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,b;t[25]===y?b=t[26]:(b=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:y}),t[25]=y,t[26]=b);let x;t[27]!==n||t[28]!==r?(x=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[27]=n,t[28]=r,t[29]=x):x=t[29];let w=n.skills.mode===`all-enabled`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,T;t[30]===w?T=t[31]:(T=o(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,w),t[30]=w,t[31]=T);let pe;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,C.jsx)(a,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=pe):pe=t[32];let E=i?`使用所有已启用技能`:`Use every enabled skill`,D;t[33]===E?D=t[34]:(D=(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:E}),t[33]=E,t[34]=D);let me=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,M;t[35]===me?M=t[36]:(M=(0,C.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:me}),t[35]=me,t[36]=M);let N;t[37]!==D||t[38]!==M?(N=(0,C.jsxs)(`span`,{children:[D,M]}),t[37]=D,t[38]=M,t[39]=N):N=t[39];let ve;t[40]!==x||t[41]!==T||t[42]!==N?(ve=(0,C.jsxs)(`button`,{type:`button`,onClick:x,className:T,children:[pe,N]}),t[40]=x,t[41]=T,t[42]=N,t[43]=ve):ve=t[43];let P;t[44]!==n||t[45]!==r?(P=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[44]=n,t[45]=r,t[46]=P):P=t[46];let F=n.skills.mode===`selected`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,I;t[47]===F?I=t[48]:(I=o(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,F),t[47]=F,t[48]=I);let L;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,C.jsx)(m,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[49]=L):L=t[49];let R=i?`只使用选中的技能`:`Use selected skills only`,z;t[50]===R?z=t[51]:(z=(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:R}),t[50]=R,t[51]=z);let B=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,V;t[52]===B?V=t[53]:(V=(0,C.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:B}),t[52]=B,t[53]=V);let H;t[54]!==z||t[55]!==V?(H=(0,C.jsxs)(`span`,{children:[z,V]}),t[54]=z,t[55]=V,t[56]=H):H=t[56];let U;t[57]!==P||t[58]!==I||t[59]!==H?(U=(0,C.jsxs)(`button`,{type:`button`,onClick:P,className:I,children:[L,H]}),t[57]=P,t[58]=I,t[59]=H,t[60]=U):U=t[60];let W;t[61]!==ve||t[62]!==U?(W=(0,C.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[ve,U]}),t[61]=ve,t[62]=U,t[63]=W):W=t[63];let G=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,K;t[64]===G?K=t[65]:(K=(0,C.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:G}),t[64]=G,t[65]=K);let q;t[66]!==_||t[67]!==c||t[68]!==i?(q=k.map(e=>(0,C.jsx)(`button`,{type:`button`,onClick:()=>_(e.names),disabled:!c,className:`rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-50`,children:i?e.zh:e.en},e.id)),t[66]=_,t[67]=c,t[68]=i,t[69]=q):q=t[69];let J;t[70]===q?J=t[71]:(J=(0,C.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:q}),t[70]=q,t[71]=J);let Y;t[72]!==K||t[73]!==J?(Y=(0,C.jsxs)(`div`,{className:`mt-4`,children:[K,J]}),t[72]=K,t[73]=J,t[74]=Y):Y=t[74];let X;t[75]!==b||t[76]!==W||t[77]!==Y||t[78]!==v?(X=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[v,b,W,Y]}),t[75]=b,t[76]=W,t[77]=Y,t[78]=v,t[79]=X):X=t[79];let ye=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,Z;t[80]===ye?Z=t[81]:(Z=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ye}),t[80]=ye,t[81]=Z);let be=i?`当前默认可用 ${le} 个技能。`:`${le} skills are available by default.`,Q;t[82]===be?Q=t[83]:(Q=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:be}),t[82]=be,t[83]=Q);let $;t[84]!==Z||t[85]!==Q?($=(0,C.jsxs)(`div`,{children:[Z,Q]}),t[84]=Z,t[85]=Q,t[86]=$):$=t[86];let xe=i?`搜索技能`:`Search skills`,Se;t[87]===xe?Se=t[88]:(Se=(0,C.jsx)(`span`,{className:`sr-only`,children:xe}),t[87]=xe,t[88]=Se);let Ce;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,C.jsx)(ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[89]=Ce):Ce=t[89];let we;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(we=e=>te(e.target.value),t[90]=we):we=t[90];let Te=i?`搜索技能`:`Search skills`,Ee;t[91]!==ee||t[92]!==Te?(Ee=(0,C.jsx)(`input`,{type:`search`,value:ee,onChange:we,placeholder:Te,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[91]=ee,t[92]=Te,t[93]=Ee):Ee=t[93];let De;t[94]!==Se||t[95]!==Ee?(De=(0,C.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[Se,Ce,Ee]}),t[94]=Se,t[95]=Ee,t[96]=De):De=t[96];let Oe;t[97]!==$||t[98]!==De?(Oe=(0,C.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[$,De]}),t[97]=$,t[98]=De,t[99]=Oe):Oe=t[99];let ke;t[100]===l?ke=t[101]:(ke=l?(0,C.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:l instanceof Error?l.message:String(l)}):null,t[100]=l,t[101]=ke);let Ae;t[102]!==f||t[103]!==u||t[104]!==ie||t[105]!==p||t[106]!==i?(Ae=u?(0,C.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(A)}):(0,C.jsxs)(`div`,{className:`mt-4 flex max-h-[32rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[ie.map(e=>{let t=f(e.name);return(0,C.jsxs)(`label`,{className:o(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>p(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,C.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,C.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,C.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),ie.length===0?(0,C.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[102]=f,t[103]=u,t[104]=ie,t[105]=p,t[106]=i,t[107]=Ae):Ae=t[107];let je;t[108]!==Oe||t[109]!==ke||t[110]!==Ae?(je=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,ke,Ae]}),t[108]=Oe,t[109]=ke,t[110]=Ae,t[111]=je):je=t[111];let Me;return t[112]!==X||t[113]!==je?(Me=(0,C.jsxs)(`div`,{className:`space-y-5`,children:[X,je]}),t[112]=X,t[113]=je,t[114]=Me):Me=t[114],Me}function A(e){return(0,C.jsx)(f,{className:`h-14 rounded-xl`},e)}function he(e){return e.name}function ge(e){return e.enabled}function _e(e,t){return e.name.localeCompare(t.name)}function j(e){return e.name}function M(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function N(e){let t=(0,fe.c)(101),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,s=ie(),[c,l]=(0,S.useState)(``),[u,d]=(0,S.useState)(`all`),[te,ne]=(0,S.useState)(),ae;t[0]===i?ae=t[1]:(ae=new Map(i.map(F)),t[0]=i,t[1]=ae);let f=ae,p;t[2]!==i||t[3]!==n.tools?(p=[...new Set([...i.map(P),...Object.keys(n.tools)])].filter(ve).sort(),t[2]=i,t[3]=n.tools,t[4]=p):p=t[4];let m=p,h;if(t[5]!==m||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),h=m.filter(e),t[5]=m,t[6]=n.tools,t[7]=h}else h=t[7];let se=h.length,g;if(t[10]!==m||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),g=m.filter(e),t[10]=m,t[11]=n.tools,t[12]=g}else g=t[12];let ue=g.length,_;if(t[15]!==m||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),_=m.filter(e),t[15]=m,t[16]=n.tools,t[17]=_}else _=t[17];let v;t[20]!==h.length||t[21]!==g.length||t[22]!==_.length?(v={allow:se,ask:ue,deny:_.length},t[20]=h.length,t[21]=g.length,t[22]=_.length,t[23]=v):v=t[23];let y=v,b;if(t[24]!==m||t[25]!==f||t[26]!==n.tools||t[27]!==u||t[28]!==c){let e=c.trim().toLowerCase();b=m.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=f.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(u===`all`||r===u)}),t[24]=m,t[25]=f,t[26]=n.tools,t[27]=u,t[28]=c,t[29]=b}else b=t[29];let x=b,w;t[30]!==n||t[31]!==r?(w=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=w):w=t[32];let T=w,pe=a?`全部 ${m.length}`:`All ${m.length}`,E;t[33]===pe?E=t[34]:(E={id:`all`,label:pe},t[33]=pe,t[34]=E);let D=a?`允许 ${y.allow}`:`Allow ${y.allow}`,O;t[35]===D?O=t[36]:(O={id:`allow`,label:D},t[35]=D,t[36]=O);let k=a?`询问 ${y.ask}`:`Ask ${y.ask}`,me;t[37]===k?me=t[38]:(me={id:`ask`,label:k},t[37]=k,t[38]=me);let A=a?`禁用 ${y.deny}`:`Deny ${y.deny}`,he;t[39]===A?he=t[40]:(he={id:`deny`,label:A},t[39]=A,t[40]=he);let ge;t[41]!==E||t[42]!==O||t[43]!==me||t[44]!==he?(ge=[E,O,me,he],t[41]=E,t[42]=O,t[43]=me,t[44]=he,t[45]=ge):ge=t[45];let _e=ge,j=a?`默认工具权限`:`Default tool permissions`,N;t[46]===j?N=t[47]:(N=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:j}),t[46]=j,t[47]=N);let I=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,L;t[48]===I?L=t[49]:(L=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:I}),t[48]=I,t[49]=L);let R;t[50]!==N||t[51]!==L?(R=(0,C.jsxs)(`div`,{children:[N,L]}),t[50]=N,t[51]=L,t[52]=R):R=t[52];let z=a?`工具筛选`:`Tool filter`,B;t[53]!==u||t[54]!==_e?(B=_e.map(e=>(0,C.jsx)(`button`,{"aria-pressed":u===e.id,type:`button`,onClick:()=>d(e.id),className:o(`rounded-lg px-3 py-1.5 text-xs font-medium`,u===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id)),t[53]=u,t[54]=_e,t[55]=B):B=t[55];let V;t[56]!==z||t[57]!==B?(V=(0,C.jsx)(ee,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,role:`group`,"aria-label":z,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:B}),t[56]=z,t[57]=B,t[58]=V):V=t[58];let H=a?`搜索工具`:`Search tools`,U;t[59]===H?U=t[60]:(U=(0,C.jsx)(`span`,{className:`sr-only`,children:H}),t[59]=H,t[60]=U);let W;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,C.jsx)(ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[61]=W):W=t[61];let G;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>l(e.target.value),t[62]=G):G=t[62];let K=a?`搜索工具`:`Search tools`,q;t[63]!==c||t[64]!==K?(q=(0,C.jsx)(`input`,{type:`search`,value:c,onChange:G,placeholder:K,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[63]=c,t[64]=K,t[65]=q):q=t[65];let J;t[66]!==U||t[67]!==q?(J=(0,C.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[U,W,q]}),t[66]=U,t[67]=q,t[68]=J):J=t[68];let Y;t[69]!==V||t[70]!==J?(Y=(0,C.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[V,J]}),t[69]=V,t[70]=J,t[71]=Y):Y=t[71];let X=a?`工具调用限制`:`Tool call limits`,ye=a?`每个工具的调用次数和超时限制继续生效;授权可在下方直接修改。`:`Call and timeout limits remain active; edit permissions below.`,Z;t[72]!==X||t[73]!==ye?(Z=(0,C.jsx)(re,{title:X,summary:ye,children:null}),t[72]=X,t[73]=ye,t[74]=Z):Z=t[74];let be;if(t[75]!==f||t[76]!==n.tools||t[77]!==te||t[78]!==s||t[79]!==T||t[80]!==x||t[81]!==a){let e;t[83]!==f||t[84]!==n.tools||t[85]!==te||t[86]!==s||t[87]!==T||t[88]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=f.get(e),i=te===e;return(0,C.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,C.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(ee,{className:`flex rounded-lg bg-surface-base p-1`,role:`group`,"aria-label":e,indicatorClassName:`rounded-md bg-accent`,children:[`allow`,`ask`,`deny`].map(n=>(0,C.jsx)(`button`,{"aria-pressed":t.mode===n,type:`button`,onClick:()=>T(e,{mode:n}),className:o(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-on-accent`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),s?(0,C.jsx)(oe,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>ne(i?void 0:e),children:(0,C.jsx)(le,{className:`size-4`})}):null]})]}),i&&s?(0,C.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>T(e,{maxCallsPerTurn:M(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>T(e,{timeoutMs:M(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)},t[83]=f,t[84]=n.tools,t[85]=te,t[86]=s,t[87]=T,t[88]=a,t[89]=e):e=t[89],be=x.map(e),t[75]=f,t[76]=n.tools,t[77]=te,t[78]=s,t[79]=T,t[80]=x,t[81]=a,t[82]=be}else be=t[82];let Q;t[90]!==x.length||t[91]!==a?(Q=x.length===0?(0,C.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[90]=x.length,t[91]=a,t[92]=Q):Q=t[92];let $;t[93]!==be||t[94]!==Q?($=(0,C.jsxs)(`div`,{className:`mt-4 flex max-h-[38rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>*]:rounded-lg [&>*]:bg-surface-panel/55`,children:[be,Q]}),t[93]=be,t[94]=Q,t[95]=$):$=t[95];let xe;return t[96]!==R||t[97]!==Y||t[98]!==Z||t[99]!==$?(xe=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[R,Y,Z,$]}),t[96]=R,t[97]=Y,t[98]=Z,t[99]=$,t[100]=xe):xe=t[100],xe}function ve(e){return e!==`computer_use`||h()}function P(e){return e.id}function F(e){return[e.id,e.description]}function I(){let e=(0,fe.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(y,{gap:`gap-5`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(f,{className:`h-7 w-56`}),(0,C.jsx)(f,{className:`h-4 w-96 max-w-full`})]}),(0,C.jsx)(f,{className:`h-9 w-28`})]}),(0,C.jsx)(f,{className:`h-20 rounded-2xl`}),(0,C.jsx)(f,{className:`h-12 rounded-xl`}),(0,C.jsx)(f,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function L(e){let t=(0,fe.c)(65),{initial:n,builtinTools:r,zh:a}=e,[s,c]=i(),l;t[0]===s?l=t[1]:(l=s.get(`panel`),t[0]=s,t[1]=l);let u=l,d=u===`skills`||u===`tools`||u===`runtime`?u:`skills`,re;t[2]!==s||t[3]!==c?(re=e=>{let t=new URLSearchParams(s);t.set(`panel`,e),c(t,{replace:!0})},t[2]=s,t[3]=c,t[4]=re):re=t[4];let ie=re,f;t[5]===n?f=t[6]:(f=()=>structuredClone(n),t[5]=n,t[6]=f);let[m,h]=(0,S.useState)(f),ce;t[7]===n?ce=t[8]:(ce=()=>structuredClone(n),t[7]=n,t[8]=ce);let[le,g]=(0,S.useState)(ce),ue;t[9]===m?ue=t[10]:(ue=JSON.stringify(m),t[9]=m,t[10]=ue);let _;t[11]===le?_=t[12]:(_=JSON.stringify(le),t[11]=le,t[12]=_);let de=ue!==_,w=a?`技能`:`Skills`,T;t[13]===w?T=t[14]:(T={id:`skills`,label:w,icon:se},t[13]=w,t[14]=T);let pe=a?`工具`:`Tools`,D;t[15]===pe?D=t[16]:(D={id:`tools`,label:pe,icon:p},t[15]=pe,t[16]=D);let O=a?`运行`:`Runtime`,k;t[17]===O?k=t[18]:(k={id:`runtime`,label:O,icon:te},t[17]=O,t[18]=k);let A;t[19]!==D||t[20]!==k||t[21]!==T?(A=[T,D,k],t[19]=D,t[20]=k,t[21]=T,t[22]=A):A=t[22];let he=A,ge;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ge=async e=>{let t=structuredClone(e),n=await ne(),r=await ae({...t,models:n.defaults.models},{scope:`agent`}),i=structuredClone(r.defaults);h(e=>JSON.stringify(e)===JSON.stringify(t)?i:e),g(structuredClone(i))},t[23]=ge):ge=t[23];let _e=ge,j;t[24]!==de||t[25]!==m?(j={value:m,dirty:de,onSave:_e,delayMs:0},t[24]=de,t[25]=m,t[26]=j):j=t[26];let M=x(j),ve=M.onBlurCapture,P=a?`智能体设置`:`Agent settings`,F;t[27]!==M.error||t[28]!==M.status?(F=(0,C.jsx)(b,{status:M.status,error:M.error}),t[27]=M.error,t[28]=M.status,t[29]=F):F=t[29];let I;t[30]!==P||t[31]!==F?(I=(0,C.jsx)(v,{title:P,actions:F}),t[30]=P,t[31]=F,t[32]=I):I=t[32];let L;t[33]!==M.error||t[34]!==M.retry||t[35]!==a?(L=M.error?(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:[(0,C.jsx)(`span`,{children:M.error}),(0,C.jsx)(oe,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:M.retry,children:a?`重试`:`Retry`})]}):null,t[33]=M.error,t[34]=M.retry,t[35]=a,t[36]=L):L=t[36];let R=a?`默认配置分区`:`Default configuration sections`,z;t[37]!==d||t[38]!==ie||t[39]!==he?(z=he.map(e=>{let{id:t,label:n,icon:r}=e;return(0,C.jsxs)(`button`,{type:`button`,"aria-pressed":d===t,onClick:()=>ie(t),className:o(`flex min-w-0 items-center justify-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,d===t?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,C.jsx)(r,{className:o(`size-4 shrink-0`,d===t?`text-accent`:`text-fg-subtle`)}),(0,C.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[37]=d,t[38]=ie,t[39]=he,t[40]=z):z=t[40];let B;t[41]!==R||t[42]!==z?(B=(0,C.jsx)(ee,{as:`nav`,className:`grid grid-cols-3 gap-1 rounded-xl bg-surface-hover/20 p-1`,"aria-label":R,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:z}),t[41]=R,t[42]=z,t[43]=B):B=t[43];let V;t[44]!==d||t[45]!==m||t[46]!==a?(V=d===`skills`?(0,C.jsx)(me,{draft:m,setDraft:h,zh:a}):null,t[44]=d,t[45]=m,t[46]=a,t[47]=V):V=t[47];let H;t[48]!==d||t[49]!==r||t[50]!==m||t[51]!==a?(H=d===`tools`?(0,C.jsx)(N,{draft:m,setDraft:h,builtinTools:r,zh:a}):null,t[48]=d,t[49]=r,t[50]=m,t[51]=a,t[52]=H):H=t[52];let U;t[53]!==d||t[54]!==m||t[55]!==a?(U=d===`runtime`?(0,C.jsx)(E,{draft:m,setDraft:h,zh:a}):null,t[53]=d,t[54]=m,t[55]=a,t[56]=U):U=t[56];let W;return t[57]!==M.onBlurCapture||t[58]!==I||t[59]!==L||t[60]!==B||t[61]!==V||t[62]!==H||t[63]!==U?(W=(0,C.jsxs)(y,{gap:`gap-5`,onBlurCapture:ve,children:[I,L,B,V,H,U]}),t[57]=M.onBlurCapture,t[58]=I,t[59]=L,t[60]=B,t[61]=V,t[62]=H,t[63]=U,t[64]=W):W=t[64],W}function R(){let e=(0,fe.c)(17),t=s(B),n=c(z)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=d(t?`settings-agent-defaults`:null,ne);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,C.jsx)(y,{children:(0,C.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,C.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===o?a=e[5]:(a=()=>void o(),e[4]=o,e[5]=a);let s=n?`重试`:`Retry`,c;e[6]!==a||e[7]!==s?(c=(0,C.jsx)(oe,{onClick:a,children:s}),e[6]=a,e[7]=s,e[8]=c):c=e[8];let l;return e[9]!==r||e[10]!==c?(l=(0,C.jsxs)(y,{children:[r,c]}),e[9]=r,e[10]=c,e[11]=l):l=e[11],l}if(a||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsx)(I,{}),e[12]=t):t=e[12],t}let l;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(l=(0,C.jsx)(L,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=l):l=e[16],l}function z(e){return e.language}function B(e){return e.conversationId}export{R as AgentDefaultsSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{g as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./cn-0WouolD0.js";import{c as s,n as c}from"./locale-store-Djl2FW6_.js";import{n as l,r as u}from"./cloud-credits-BMYMiiNn.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{Ao as ee,Cd as te,Fn as ne,G as re,Hn as ie,In as ae,Rc as f,Wc as oe,Xl as p,Zu as m,as as h,du as se,nu as ce,ql as le,ra as g,us as ue,v as _}from"./index-Dsp_gNdl.js";import{t as de}from"./number-input-DDeqHK-G.js";import{n as v,r as y}from"./settings-page-layout-Dx5S-Msc.js";import{n as b,t as x}from"./use-autosave-iKvZ1pvC.js";var fe=n(),S=e(t(),1),C=r(),w=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function T(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function pe({draft:e,setDraft:t,zh:n}){let[r,i]=(0,S.useState)(()=>e.runtime.cloudCreditLimitPerRunMicro?l(e.runtime.cloudCreditLimitPerRunMicro):``),[a,o]=(0,S.useState)(!1);return(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`每次运行的 Cloud 消费上限(Credits)`:`Cloud spend limit per run (Credits)`,(0,C.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:r,"aria-invalid":a,placeholder:n?`不设置额外上限`:`No additional limit`,className:`${w} mt-2`,onChange:n=>{let r=n.target.value;i(r);try{let n=r===``?void 0:u(r);if(n===`0`||n&&n.length>15)throw Error(`Invalid limit`);o(!1),t({...e,runtime:{...e.runtime,cloudCreditLimitPerRunMicro:n}})}catch{o(!0)}},onBlur:()=>{a&&i(e.runtime.cloudCreditLimitPerRunMicro?l(e.runtime.cloudCreditLimitPerRunMicro):``),o(!1)}}),(0,C.jsx)(`span`,{className:`mt-2 block font-normal ${a?`text-danger`:`text-fg-subtle`}`,children:a?n?`请输入大于零、最多四位小数的 Credits。无效输入不会保存。`:`Enter positive Credits with up to four decimals. Invalid input is not saved.`:n?`模型、图片和文件语音调用共享上限;不支持实时语音或 Cloud 电脑控制,不包含运行前后的后台调用。达到上限后停止,调整后需手动继续。`:`Shared by model, image and file audio calls during a run. Does not support realtime voice or Cloud computer use; excludes background calls outside the run. Stops at the limit; continue manually after adjusting it.`})]})}function E(e){let t=(0,fe.c)(189),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let s=d(`agent-defaults-workflows`,_,a),c;t[1]===s.data?c=t[2]:(c=s.data??[],t[1]=s.data,t[2]=c);let l;t[3]===c?l=t[4]:(l=c.map(D),t[3]=c,t[4]=l);let u=l,te=n.workflows.allowed===void 0,ne;t[5]!==n||t[6]!==r?(ne=(e,t)=>{let i=n.workflows.allowed??[],a=t?[...new Set([...i,e])]:i.filter(t=>t!==e);r({...n,workflows:{...n.workflows,allowed:a}})},t[5]=n,t[6]=r,t[7]=ne):ne=t[7];let ie=ne,ae=i?`费用控制`:`Spending control`,f;t[8]===ae?f=t[9]:(f=(0,C.jsx)(`h2`,{className:`mb-4 text-base font-semibold text-fg`,children:ae}),t[8]=ae,t[9]=f);let p;t[10]!==n||t[11]!==r||t[12]!==i?(p=(0,C.jsx)(pe,{draft:n,setDraft:r,zh:i}),t[10]=n,t[11]=r,t[12]=i,t[13]=p):p=t[13];let m;t[14]!==f||t[15]!==p?(m=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[f,p]}),t[14]=f,t[15]=p,t[16]=m):m=t[16];let h=i?`执行与缓存策略`:`Execution and cache policy`,se=i?`轮数:${n.runtime.maxTurns??`默认`} · 超时:${n.runtime.timeoutMs??`默认`} · 缓存:${n.runtime.promptCache?.mode??`默认`} · Codemode:${n.runtime.codemode?.enabled?`开启`:`关闭`}`:`Turns: ${n.runtime.maxTurns??`default`} · Timeout: ${n.runtime.timeoutMs??`default`} · Cache: ${n.runtime.promptCache?.mode??`default`} · Codemode: ${n.runtime.codemode?.enabled?`on`:`off`}`,ce=n.runtime.codemode?.enabled??!1,le;t[17]!==n||t[18]!==r?(le=e=>r({...n,runtime:{...n.runtime,codemode:{...n.runtime.codemode,enabled:e.target.checked}}}),t[17]=n,t[18]=r,t[19]=le):le=t[19];let g;t[20]!==ce||t[21]!==le?(g=(0,C.jsx)(`input`,{type:`checkbox`,checked:ce,onChange:le,className:`mt-1 size-4 accent-[var(--color-accent)]`}),t[20]=ce,t[21]=le,t[22]=g):g=t[22];let v=i?`Codemode 读取试点`:`Codemode read pilot`,y;t[23]===v?y=t[24]:(y=(0,C.jsx)(`span`,{className:`block text-base font-semibold text-fg`,children:v}),t[23]=v,t[24]=y);let b=i?`允许智能体用脚本组合已授权的读取工具。默认关闭,保留普通工具调用。`:`Let agents combine authorized reads in scripts. Off by default; ordinary tool calls stay available.`,x;t[25]===b?x=t[26]:(x=(0,C.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:b}),t[25]=b,t[26]=x);let S;t[27]!==y||t[28]!==x?(S=(0,C.jsxs)(`span`,{children:[y,x]}),t[27]=y,t[28]=x,t[29]=S):S=t[29];let E;t[30]!==g||t[31]!==S?(E=(0,C.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:(0,C.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3`,children:[g,S]})}),t[30]=g,t[31]=S,t[32]=E):E=t[32];let O=i?`执行限制`:`Execution limits`,k;t[33]===O?k=t[34]:(k=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:O}),t[33]=O,t[34]=k);let me=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,A;t[35]===me?A=t[36]:(A=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:me}),t[35]=me,t[36]=A);let he=i?`每次运行最多轮数`:`Maximum turns per run`,ge=n.runtime.maxTurns??``,_e=i?`系统默认`:`System default`,j;t[37]!==n||t[38]!==r?(j=e=>r({...n,runtime:{...n.runtime,maxTurns:T(e.target.value)}}),t[37]=n,t[38]=r,t[39]=j):j=t[39];let M;t[40]!==ge||t[41]!==_e||t[42]!==j?(M=(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:ge,placeholder:_e,onChange:j,className:`${w} mt-2`}),t[40]=ge,t[41]=_e,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==he||t[45]!==M?(N=(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[he,M]}),t[44]=he,t[45]=M,t[46]=N):N=t[46];let ve=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,P=n.runtime.timeoutMs??``,F=i?`系统默认`:`System default`,I;t[47]!==n||t[48]!==r?(I=e=>r({...n,runtime:{...n.runtime,timeoutMs:T(e.target.value)}}),t[47]=n,t[48]=r,t[49]=I):I=t[49];let L;t[50]!==P||t[51]!==F||t[52]!==I?(L=(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:P,placeholder:F,onChange:I,className:`${w} mt-2`}),t[50]=P,t[51]=F,t[52]=I,t[53]=L):L=t[53];let R;t[54]!==ve||t[55]!==L?(R=(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[ve,L]}),t[54]=ve,t[55]=L,t[56]=R):R=t[56];let z=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,B=n.runtime.maxToolFailuresPerTurn??``,V=i?`系统默认`:`System default`,H;t[57]!==n||t[58]!==r?(H=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:T(e.target.value)}}),t[57]=n,t[58]=r,t[59]=H):H=t[59];let U;t[60]!==B||t[61]!==V||t[62]!==H?(U=(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:B,placeholder:V,onChange:H,className:`${w} mt-2`}),t[60]=B,t[61]=V,t[62]=H,t[63]=U):U=t[63];let W;t[64]!==z||t[65]!==U?(W=(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[z,U]}),t[64]=z,t[65]=U,t[66]=W):W=t[66];let G;t[67]!==N||t[68]!==R||t[69]!==W?(G=(0,C.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[N,R,W]}),t[67]=N,t[68]=R,t[69]=W,t[70]=G):G=t[70];let K;t[71]!==k||t[72]!==A||t[73]!==G?(K=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[k,A,G]}),t[71]=k,t[72]=A,t[73]=G,t[74]=K):K=t[74];let q=i?`提示词缓存`:`Prompt cache`,J;t[75]===q?J=t[76]:(J=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:q}),t[75]=q,t[76]=J);let Y=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,X;t[77]===Y?X=t[78]:(X=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Y}),t[77]=Y,t[78]=X);let ye=i?`缓存模式`:`Cache mode`,Z;t[79]===ye?Z=t[80]:(Z=(0,C.jsx)(`span`,{children:ye}),t[79]=ye,t[80]=Z);let be=i?`缓存模式`:`Cache mode`,Q;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(Q=[`auto`,`off`],t[81]=Q):Q=t[81];let $;t[82]!==n||t[83]!==r||t[84]!==i?($=Q.map(e=>(0,C.jsx)(oe,{"aria-pressed":n.runtime.promptCache?.mode===e,variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e)),t[82]=n,t[83]=r,t[84]=i,t[85]=$):$=t[85];let xe;t[86]!==be||t[87]!==$?(xe=(0,C.jsx)(ee,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":be,children:$}),t[86]=be,t[87]=$,t[88]=xe):xe=t[88];let Se;t[89]!==Z||t[90]!==xe?(Se=(0,C.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[Z,xe]}),t[89]=Z,t[90]=xe,t[91]=Se):Se=t[91];let Ce;t[92]!==n||t[93]!==r||t[94]!==i?(Ce=n.runtime.promptCache?.mode===`auto`?(0,C.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,C.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,C.jsx)(ee,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":i?`缓存周期`:`Cache lifetime`,children:[`short`,`long`].map(e=>(0,C.jsx)(oe,{"aria-pressed":n.runtime.promptCache?.lifetime===e,variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[92]=n,t[93]=r,t[94]=i,t[95]=Ce):Ce=t[95];let we;t[96]!==Se||t[97]!==Ce?(we=(0,C.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[Se,Ce]}),t[96]=Se,t[97]=Ce,t[98]=we):we=t[98];let Te;t[99]!==J||t[100]!==X||t[101]!==we?(Te=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[J,X,we]}),t[99]=J,t[100]=X,t[101]=we,t[102]=Te):Te=t[102];let Ee;t[103]!==se||t[104]!==E||t[105]!==K||t[106]!==Te||t[107]!==h?(Ee=(0,C.jsxs)(re,{title:h,summary:se,children:[E,K,Te]}),t[103]=se,t[104]=E,t[105]=K,t[106]=Te,t[107]=h,t[108]=Ee):Ee=t[108];let De=i?`工作流`:`Workflows`,Oe;t[109]===De?Oe=t[110]:(Oe=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:De}),t[109]=De,t[110]=Oe);let ke=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,Ae;t[111]===ke?Ae=t[112]:(Ae=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ke}),t[111]=ke,t[112]=Ae);let je=i?`默认工作流`:`Default workflow`,Me=n.workflows.default||(i?`未自动绑定工作流`:`No workflow bound automatically`),Ne=i?`默认工作流`:`Default workflow`,Pe;t[113]===Ne?Pe=t[114]:(Pe=(0,C.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:Ne}),t[113]=Ne,t[114]=Pe);let Fe=n.workflows.default??``,Ie=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,Le=i?`不设置默认工作流`:`No default workflow`,Re=i?`默认工作流`:`Default workflow`,ze;t[115]!==n||t[116]!==r?(ze=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[115]=n,t[116]=r,t[117]=ze):ze=t[117];let Be;t[118]!==Fe||t[119]!==Ie||t[120]!==Le||t[121]!==Re||t[122]!==ze||t[123]!==u||t[124]!==s.isLoading?(Be=(0,C.jsx)(ue,{value:Fe,options:u,placeholder:Ie,emptyLabel:Le,disabled:s.isLoading,ariaLabel:Re,onChange:ze,triggerClassName:`mt-2`}),t[118]=Fe,t[119]=Ie,t[120]=Le,t[121]=Re,t[122]=ze,t[123]=u,t[124]=s.isLoading,t[125]=Be):Be=t[125];let Ve;t[126]!==Pe||t[127]!==Be?(Ve=(0,C.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[Pe,Be]}),t[126]=Pe,t[127]=Be,t[128]=Ve):Ve=t[128];let He;t[129]!==je||t[130]!==Me||t[131]!==Ve?(He=(0,C.jsx)(re,{title:je,summary:Me,children:Ve}),t[129]=je,t[130]=Me,t[131]=Ve,t[132]=He):He=t[132];let Ue;t[133]===s.error?Ue=t[134]:(Ue=s.error?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-red-600`,children:s.error instanceof Error?s.error.message:String(s.error)}):null,t[133]=s.error,t[134]=Ue);let We=i?`允许调用的工作流`:`Allowed workflows`,Ge;t[135]===We?Ge=t[136]:(Ge=(0,C.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:We}),t[135]=We,t[136]=Ge);let Ke;t[137]!==n||t[138]!==r?(Ke=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[137]=n,t[138]=r,t[139]=Ke):Ke=t[139];let qe=te?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,Je;t[140]===qe?Je=t[141]:(Je=o(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,qe),t[140]=qe,t[141]=Je);let Ye=i?`允许全部工作流`:`Allow every workflow`,Xe;t[142]===Ye?Xe=t[143]:(Xe=(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Ye}),t[142]=Ye,t[143]=Xe);let Ze=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,Qe;t[144]===Ze?Qe=t[145]:(Qe=(0,C.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Ze}),t[144]=Ze,t[145]=Qe);let $e;t[146]!==Ke||t[147]!==Je||t[148]!==Xe||t[149]!==Qe?($e=(0,C.jsxs)(`button`,{type:`button`,onClick:Ke,className:Je,children:[Xe,Qe]}),t[146]=Ke,t[147]=Je,t[148]=Xe,t[149]=Qe,t[150]=$e):$e=t[150];let et;t[151]!==n||t[152]!==r?(et=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[151]=n,t[152]=r,t[153]=et):et=t[153];let tt=te?`hover:bg-surface-hover`:`bg-accent-soft shadow-surface`,nt;t[154]===tt?nt=t[155]:(nt=o(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,tt),t[154]=tt,t[155]=nt);let rt=i?`只允许选中的工作流`:`Allow selected workflows only`,it;t[156]===rt?it=t[157]:(it=(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:rt}),t[156]=rt,t[157]=it);let at=i?`未选中的工作流不能被调用。`:`Unselected workflows cannot be invoked.`,ot;t[158]===at?ot=t[159]:(ot=(0,C.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:at}),t[158]=at,t[159]=ot);let st;t[160]!==et||t[161]!==nt||t[162]!==it||t[163]!==ot?(st=(0,C.jsxs)(`button`,{type:`button`,onClick:et,className:nt,children:[it,ot]}),t[160]=et,t[161]=nt,t[162]=it,t[163]=ot,t[164]=st):st=t[164];let ct;t[165]!==$e||t[166]!==st?(ct=(0,C.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[$e,st]}),t[165]=$e,t[166]=st,t[167]=ct):ct=t[167];let lt;t[168]!==te||t[169]!==n.workflows.allowed||t[170]!==ie||t[171]!==s.data||t[172]!==s.isLoading||t[173]!==i?(lt=te?null:(0,C.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1 rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[(s.data??[]).map(e=>(0,C.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>ie(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,C.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,C.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[168]=te,t[169]=n.workflows.allowed,t[170]=ie,t[171]=s.data,t[172]=s.isLoading,t[173]=i,t[174]=lt):lt=t[174];let ut;t[175]!==Ge||t[176]!==ct||t[177]!==lt?(ut=(0,C.jsxs)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:[Ge,ct,lt]}),t[175]=Ge,t[176]=ct,t[177]=lt,t[178]=ut):ut=t[178];let dt;t[179]!==Oe||t[180]!==Ae||t[181]!==He||t[182]!==Ue||t[183]!==ut?(dt=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,Ae,He,Ue,ut]}),t[179]=Oe,t[180]=Ae,t[181]=He,t[182]=Ue,t[183]=ut,t[184]=dt):dt=t[184];let ft;return t[185]!==Ee||t[186]!==m||t[187]!==dt?(ft=(0,C.jsxs)(`div`,{className:`space-y-5`,children:[m,Ee,dt]}),t[185]=Ee,t[186]=m,t[187]=dt,t[188]=ft):ft=t[188],ft}function D(e){return{value:e.id,label:e.title||e.name}}function O(e){return[...new Set(e)].sort()}var k=[{id:`core`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`],en:`Core`,zh:`核心`},{id:`office`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`docx`,`pdf`,`pptx`,`xlsx`],en:`Office`,zh:`办公成果`},{id:`local-app`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`build-xopc-local-app`,`frontend-design`,`theme-factory`],en:`Local App`,zh:`本地应用`},{id:`developer`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`diagnose`,`github`,`tdd`,`webapp-testing`],en:`Developer`,zh:`开发者`},{id:`desktop-pet`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`hatch-pet`],en:`Desktop Pet`,zh:`桌面宠物`}];function me(e){let t=(0,fe.c)(115),{draft:n,setDraft:r,zh:i}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[0]=s):s=t[0];let{data:c,error:l,isLoading:u}=d(`agent-defaults-skills-catalog`,g,s),[ee,te]=(0,S.useState)(``),ne=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;c?.catalog;let re;if(t[1]!==ne||t[2]!==c?.catalog||t[3]!==ee){let e=[...c?.catalog??[]],n=new Set(e.map(j));for(let t of ne)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=ee.trim().toLowerCase();re=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(_e),t[1]=ne,t[2]=c?.catalog,t[3]=ee,t[4]=re}else re=t[4];let ie=re,ae;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(ae=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=ae):ae=t[8];let f=ae,oe;t[9]!==n||t[10]!==r?(oe=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):O([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):O([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=oe):oe=t[11];let p=oe,h;t[12]===c?.catalog?h=t[13]:(h=c?.catalog??[],t[12]=c?.catalog,t[13]=h);let se;if(t[14]!==f||t[15]!==h){let e;t[17]===f?e=t[18]:(e=e=>e.enabled&&f(e.name),t[17]=f,t[18]=e),se=h.filter(e),t[14]=f,t[15]=h,t[16]=se}else se=t[16];let le=se.length,ue;t[19]!==c?.catalog||t[20]!==n||t[21]!==r?(ue=e=>{let t=new Set((c?.catalog??[]).filter(ge).map(he));r({...n,skills:{mode:`selected`,include:O(e.filter(e=>t.has(e)))}})},t[19]=c?.catalog,t[20]=n,t[21]=r,t[22]=ue):ue=t[22];let _=ue,de=i?`技能策略`:`Skill policy`,v;t[23]===de?v=t[24]:(v=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:de}),t[23]=de,t[24]=v);let y=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,b;t[25]===y?b=t[26]:(b=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:y}),t[25]=y,t[26]=b);let x;t[27]!==n||t[28]!==r?(x=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[27]=n,t[28]=r,t[29]=x):x=t[29];let w=n.skills.mode===`all-enabled`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,T;t[30]===w?T=t[31]:(T=o(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,w),t[30]=w,t[31]=T);let pe;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,C.jsx)(a,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=pe):pe=t[32];let E=i?`使用所有已启用技能`:`Use every enabled skill`,D;t[33]===E?D=t[34]:(D=(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:E}),t[33]=E,t[34]=D);let me=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,M;t[35]===me?M=t[36]:(M=(0,C.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:me}),t[35]=me,t[36]=M);let N;t[37]!==D||t[38]!==M?(N=(0,C.jsxs)(`span`,{children:[D,M]}),t[37]=D,t[38]=M,t[39]=N):N=t[39];let ve;t[40]!==x||t[41]!==T||t[42]!==N?(ve=(0,C.jsxs)(`button`,{type:`button`,onClick:x,className:T,children:[pe,N]}),t[40]=x,t[41]=T,t[42]=N,t[43]=ve):ve=t[43];let P;t[44]!==n||t[45]!==r?(P=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[44]=n,t[45]=r,t[46]=P):P=t[46];let F=n.skills.mode===`selected`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,I;t[47]===F?I=t[48]:(I=o(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,F),t[47]=F,t[48]=I);let L;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,C.jsx)(m,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[49]=L):L=t[49];let R=i?`只使用选中的技能`:`Use selected skills only`,z;t[50]===R?z=t[51]:(z=(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:R}),t[50]=R,t[51]=z);let B=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,V;t[52]===B?V=t[53]:(V=(0,C.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:B}),t[52]=B,t[53]=V);let H;t[54]!==z||t[55]!==V?(H=(0,C.jsxs)(`span`,{children:[z,V]}),t[54]=z,t[55]=V,t[56]=H):H=t[56];let U;t[57]!==P||t[58]!==I||t[59]!==H?(U=(0,C.jsxs)(`button`,{type:`button`,onClick:P,className:I,children:[L,H]}),t[57]=P,t[58]=I,t[59]=H,t[60]=U):U=t[60];let W;t[61]!==ve||t[62]!==U?(W=(0,C.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[ve,U]}),t[61]=ve,t[62]=U,t[63]=W):W=t[63];let G=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,K;t[64]===G?K=t[65]:(K=(0,C.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:G}),t[64]=G,t[65]=K);let q;t[66]!==_||t[67]!==c||t[68]!==i?(q=k.map(e=>(0,C.jsx)(`button`,{type:`button`,onClick:()=>_(e.names),disabled:!c,className:`rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-50`,children:i?e.zh:e.en},e.id)),t[66]=_,t[67]=c,t[68]=i,t[69]=q):q=t[69];let J;t[70]===q?J=t[71]:(J=(0,C.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:q}),t[70]=q,t[71]=J);let Y;t[72]!==K||t[73]!==J?(Y=(0,C.jsxs)(`div`,{className:`mt-4`,children:[K,J]}),t[72]=K,t[73]=J,t[74]=Y):Y=t[74];let X;t[75]!==b||t[76]!==W||t[77]!==Y||t[78]!==v?(X=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[v,b,W,Y]}),t[75]=b,t[76]=W,t[77]=Y,t[78]=v,t[79]=X):X=t[79];let ye=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,Z;t[80]===ye?Z=t[81]:(Z=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ye}),t[80]=ye,t[81]=Z);let be=i?`当前默认可用 ${le} 个技能。`:`${le} skills are available by default.`,Q;t[82]===be?Q=t[83]:(Q=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:be}),t[82]=be,t[83]=Q);let $;t[84]!==Z||t[85]!==Q?($=(0,C.jsxs)(`div`,{children:[Z,Q]}),t[84]=Z,t[85]=Q,t[86]=$):$=t[86];let xe=i?`搜索技能`:`Search skills`,Se;t[87]===xe?Se=t[88]:(Se=(0,C.jsx)(`span`,{className:`sr-only`,children:xe}),t[87]=xe,t[88]=Se);let Ce;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,C.jsx)(ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[89]=Ce):Ce=t[89];let we;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(we=e=>te(e.target.value),t[90]=we):we=t[90];let Te=i?`搜索技能`:`Search skills`,Ee;t[91]!==ee||t[92]!==Te?(Ee=(0,C.jsx)(`input`,{type:`search`,value:ee,onChange:we,placeholder:Te,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[91]=ee,t[92]=Te,t[93]=Ee):Ee=t[93];let De;t[94]!==Se||t[95]!==Ee?(De=(0,C.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[Se,Ce,Ee]}),t[94]=Se,t[95]=Ee,t[96]=De):De=t[96];let Oe;t[97]!==$||t[98]!==De?(Oe=(0,C.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[$,De]}),t[97]=$,t[98]=De,t[99]=Oe):Oe=t[99];let ke;t[100]===l?ke=t[101]:(ke=l?(0,C.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:l instanceof Error?l.message:String(l)}):null,t[100]=l,t[101]=ke);let Ae;t[102]!==f||t[103]!==u||t[104]!==ie||t[105]!==p||t[106]!==i?(Ae=u?(0,C.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(A)}):(0,C.jsxs)(`div`,{className:`mt-4 flex max-h-[32rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[ie.map(e=>{let t=f(e.name);return(0,C.jsxs)(`label`,{className:o(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>p(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,C.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,C.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,C.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),ie.length===0?(0,C.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[102]=f,t[103]=u,t[104]=ie,t[105]=p,t[106]=i,t[107]=Ae):Ae=t[107];let je;t[108]!==Oe||t[109]!==ke||t[110]!==Ae?(je=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,ke,Ae]}),t[108]=Oe,t[109]=ke,t[110]=Ae,t[111]=je):je=t[111];let Me;return t[112]!==X||t[113]!==je?(Me=(0,C.jsxs)(`div`,{className:`space-y-5`,children:[X,je]}),t[112]=X,t[113]=je,t[114]=Me):Me=t[114],Me}function A(e){return(0,C.jsx)(f,{className:`h-14 rounded-xl`},e)}function he(e){return e.name}function ge(e){return e.enabled}function _e(e,t){return e.name.localeCompare(t.name)}function j(e){return e.name}function M(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function N(e){let t=(0,fe.c)(101),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,s=ie(),[c,l]=(0,S.useState)(``),[u,d]=(0,S.useState)(`all`),[te,ne]=(0,S.useState)(),ae;t[0]===i?ae=t[1]:(ae=new Map(i.map(F)),t[0]=i,t[1]=ae);let f=ae,p;t[2]!==i||t[3]!==n.tools?(p=[...new Set([...i.map(P),...Object.keys(n.tools)])].filter(ve).sort(),t[2]=i,t[3]=n.tools,t[4]=p):p=t[4];let m=p,h;if(t[5]!==m||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),h=m.filter(e),t[5]=m,t[6]=n.tools,t[7]=h}else h=t[7];let se=h.length,g;if(t[10]!==m||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),g=m.filter(e),t[10]=m,t[11]=n.tools,t[12]=g}else g=t[12];let ue=g.length,_;if(t[15]!==m||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),_=m.filter(e),t[15]=m,t[16]=n.tools,t[17]=_}else _=t[17];let v;t[20]!==h.length||t[21]!==g.length||t[22]!==_.length?(v={allow:se,ask:ue,deny:_.length},t[20]=h.length,t[21]=g.length,t[22]=_.length,t[23]=v):v=t[23];let y=v,b;if(t[24]!==m||t[25]!==f||t[26]!==n.tools||t[27]!==u||t[28]!==c){let e=c.trim().toLowerCase();b=m.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=f.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(u===`all`||r===u)}),t[24]=m,t[25]=f,t[26]=n.tools,t[27]=u,t[28]=c,t[29]=b}else b=t[29];let x=b,w;t[30]!==n||t[31]!==r?(w=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=w):w=t[32];let T=w,pe=a?`全部 ${m.length}`:`All ${m.length}`,E;t[33]===pe?E=t[34]:(E={id:`all`,label:pe},t[33]=pe,t[34]=E);let D=a?`允许 ${y.allow}`:`Allow ${y.allow}`,O;t[35]===D?O=t[36]:(O={id:`allow`,label:D},t[35]=D,t[36]=O);let k=a?`询问 ${y.ask}`:`Ask ${y.ask}`,me;t[37]===k?me=t[38]:(me={id:`ask`,label:k},t[37]=k,t[38]=me);let A=a?`禁用 ${y.deny}`:`Deny ${y.deny}`,he;t[39]===A?he=t[40]:(he={id:`deny`,label:A},t[39]=A,t[40]=he);let ge;t[41]!==E||t[42]!==O||t[43]!==me||t[44]!==he?(ge=[E,O,me,he],t[41]=E,t[42]=O,t[43]=me,t[44]=he,t[45]=ge):ge=t[45];let _e=ge,j=a?`默认工具权限`:`Default tool permissions`,N;t[46]===j?N=t[47]:(N=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:j}),t[46]=j,t[47]=N);let I=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,L;t[48]===I?L=t[49]:(L=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:I}),t[48]=I,t[49]=L);let R;t[50]!==N||t[51]!==L?(R=(0,C.jsxs)(`div`,{children:[N,L]}),t[50]=N,t[51]=L,t[52]=R):R=t[52];let z=a?`工具筛选`:`Tool filter`,B;t[53]!==u||t[54]!==_e?(B=_e.map(e=>(0,C.jsx)(`button`,{"aria-pressed":u===e.id,type:`button`,onClick:()=>d(e.id),className:o(`rounded-lg px-3 py-1.5 text-xs font-medium`,u===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id)),t[53]=u,t[54]=_e,t[55]=B):B=t[55];let V;t[56]!==z||t[57]!==B?(V=(0,C.jsx)(ee,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,role:`group`,"aria-label":z,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:B}),t[56]=z,t[57]=B,t[58]=V):V=t[58];let H=a?`搜索工具`:`Search tools`,U;t[59]===H?U=t[60]:(U=(0,C.jsx)(`span`,{className:`sr-only`,children:H}),t[59]=H,t[60]=U);let W;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,C.jsx)(ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[61]=W):W=t[61];let G;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>l(e.target.value),t[62]=G):G=t[62];let K=a?`搜索工具`:`Search tools`,q;t[63]!==c||t[64]!==K?(q=(0,C.jsx)(`input`,{type:`search`,value:c,onChange:G,placeholder:K,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[63]=c,t[64]=K,t[65]=q):q=t[65];let J;t[66]!==U||t[67]!==q?(J=(0,C.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[U,W,q]}),t[66]=U,t[67]=q,t[68]=J):J=t[68];let Y;t[69]!==V||t[70]!==J?(Y=(0,C.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[V,J]}),t[69]=V,t[70]=J,t[71]=Y):Y=t[71];let X=a?`工具调用限制`:`Tool call limits`,ye=a?`每个工具的调用次数和超时限制继续生效;授权可在下方直接修改。`:`Call and timeout limits remain active; edit permissions below.`,Z;t[72]!==X||t[73]!==ye?(Z=(0,C.jsx)(re,{title:X,summary:ye,children:null}),t[72]=X,t[73]=ye,t[74]=Z):Z=t[74];let be;if(t[75]!==f||t[76]!==n.tools||t[77]!==te||t[78]!==s||t[79]!==T||t[80]!==x||t[81]!==a){let e;t[83]!==f||t[84]!==n.tools||t[85]!==te||t[86]!==s||t[87]!==T||t[88]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=f.get(e),i=te===e;return(0,C.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,C.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(ee,{className:`flex rounded-lg bg-surface-base p-1`,role:`group`,"aria-label":e,indicatorClassName:`rounded-md bg-accent`,children:[`allow`,`ask`,`deny`].map(n=>(0,C.jsx)(`button`,{"aria-pressed":t.mode===n,type:`button`,onClick:()=>T(e,{mode:n}),className:o(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-on-accent`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),s?(0,C.jsx)(oe,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>ne(i?void 0:e),children:(0,C.jsx)(le,{className:`size-4`})}):null]})]}),i&&s?(0,C.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>T(e,{maxCallsPerTurn:M(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>T(e,{timeoutMs:M(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)},t[83]=f,t[84]=n.tools,t[85]=te,t[86]=s,t[87]=T,t[88]=a,t[89]=e):e=t[89],be=x.map(e),t[75]=f,t[76]=n.tools,t[77]=te,t[78]=s,t[79]=T,t[80]=x,t[81]=a,t[82]=be}else be=t[82];let Q;t[90]!==x.length||t[91]!==a?(Q=x.length===0?(0,C.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[90]=x.length,t[91]=a,t[92]=Q):Q=t[92];let $;t[93]!==be||t[94]!==Q?($=(0,C.jsxs)(`div`,{className:`mt-4 flex max-h-[38rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>*]:rounded-lg [&>*]:bg-surface-panel/55`,children:[be,Q]}),t[93]=be,t[94]=Q,t[95]=$):$=t[95];let xe;return t[96]!==R||t[97]!==Y||t[98]!==Z||t[99]!==$?(xe=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[R,Y,Z,$]}),t[96]=R,t[97]=Y,t[98]=Z,t[99]=$,t[100]=xe):xe=t[100],xe}function ve(e){return e!==`computer_use`||h()}function P(e){return e.id}function F(e){return[e.id,e.description]}function I(){let e=(0,fe.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(y,{gap:`gap-5`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(f,{className:`h-7 w-56`}),(0,C.jsx)(f,{className:`h-4 w-96 max-w-full`})]}),(0,C.jsx)(f,{className:`h-9 w-28`})]}),(0,C.jsx)(f,{className:`h-20 rounded-2xl`}),(0,C.jsx)(f,{className:`h-12 rounded-xl`}),(0,C.jsx)(f,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function L(e){let t=(0,fe.c)(65),{initial:n,builtinTools:r,zh:a}=e,[s,c]=i(),l;t[0]===s?l=t[1]:(l=s.get(`panel`),t[0]=s,t[1]=l);let u=l,d=u===`skills`||u===`tools`||u===`runtime`?u:`skills`,re;t[2]!==s||t[3]!==c?(re=e=>{let t=new URLSearchParams(s);t.set(`panel`,e),c(t,{replace:!0})},t[2]=s,t[3]=c,t[4]=re):re=t[4];let ie=re,f;t[5]===n?f=t[6]:(f=()=>structuredClone(n),t[5]=n,t[6]=f);let[m,h]=(0,S.useState)(f),ce;t[7]===n?ce=t[8]:(ce=()=>structuredClone(n),t[7]=n,t[8]=ce);let[le,g]=(0,S.useState)(ce),ue;t[9]===m?ue=t[10]:(ue=JSON.stringify(m),t[9]=m,t[10]=ue);let _;t[11]===le?_=t[12]:(_=JSON.stringify(le),t[11]=le,t[12]=_);let de=ue!==_,w=a?`技能`:`Skills`,T;t[13]===w?T=t[14]:(T={id:`skills`,label:w,icon:se},t[13]=w,t[14]=T);let pe=a?`工具`:`Tools`,D;t[15]===pe?D=t[16]:(D={id:`tools`,label:pe,icon:p},t[15]=pe,t[16]=D);let O=a?`运行`:`Runtime`,k;t[17]===O?k=t[18]:(k={id:`runtime`,label:O,icon:te},t[17]=O,t[18]=k);let A;t[19]!==D||t[20]!==k||t[21]!==T?(A=[T,D,k],t[19]=D,t[20]=k,t[21]=T,t[22]=A):A=t[22];let he=A,ge;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ge=async e=>{let t=structuredClone(e),n=await ne(),r=await ae({...t,models:n.defaults.models},{scope:`agent`}),i=structuredClone(r.defaults);h(e=>JSON.stringify(e)===JSON.stringify(t)?i:e),g(structuredClone(i))},t[23]=ge):ge=t[23];let _e=ge,j;t[24]!==de||t[25]!==m?(j={value:m,dirty:de,onSave:_e,delayMs:0},t[24]=de,t[25]=m,t[26]=j):j=t[26];let M=x(j),ve=M.onBlurCapture,P=a?`智能体设置`:`Agent settings`,F;t[27]!==M.error||t[28]!==M.status?(F=(0,C.jsx)(b,{status:M.status,error:M.error}),t[27]=M.error,t[28]=M.status,t[29]=F):F=t[29];let I;t[30]!==P||t[31]!==F?(I=(0,C.jsx)(v,{title:P,actions:F}),t[30]=P,t[31]=F,t[32]=I):I=t[32];let L;t[33]!==M.error||t[34]!==M.retry||t[35]!==a?(L=M.error?(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:[(0,C.jsx)(`span`,{children:M.error}),(0,C.jsx)(oe,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:M.retry,children:a?`重试`:`Retry`})]}):null,t[33]=M.error,t[34]=M.retry,t[35]=a,t[36]=L):L=t[36];let R=a?`默认配置分区`:`Default configuration sections`,z;t[37]!==d||t[38]!==ie||t[39]!==he?(z=he.map(e=>{let{id:t,label:n,icon:r}=e;return(0,C.jsxs)(`button`,{type:`button`,"aria-pressed":d===t,onClick:()=>ie(t),className:o(`flex min-w-0 items-center justify-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,d===t?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,C.jsx)(r,{className:o(`size-4 shrink-0`,d===t?`text-accent`:`text-fg-subtle`)}),(0,C.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[37]=d,t[38]=ie,t[39]=he,t[40]=z):z=t[40];let B;t[41]!==R||t[42]!==z?(B=(0,C.jsx)(ee,{as:`nav`,className:`grid grid-cols-3 gap-1 rounded-xl bg-surface-hover/20 p-1`,"aria-label":R,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:z}),t[41]=R,t[42]=z,t[43]=B):B=t[43];let V;t[44]!==d||t[45]!==m||t[46]!==a?(V=d===`skills`?(0,C.jsx)(me,{draft:m,setDraft:h,zh:a}):null,t[44]=d,t[45]=m,t[46]=a,t[47]=V):V=t[47];let H;t[48]!==d||t[49]!==r||t[50]!==m||t[51]!==a?(H=d===`tools`?(0,C.jsx)(N,{draft:m,setDraft:h,builtinTools:r,zh:a}):null,t[48]=d,t[49]=r,t[50]=m,t[51]=a,t[52]=H):H=t[52];let U;t[53]!==d||t[54]!==m||t[55]!==a?(U=d===`runtime`?(0,C.jsx)(E,{draft:m,setDraft:h,zh:a}):null,t[53]=d,t[54]=m,t[55]=a,t[56]=U):U=t[56];let W;return t[57]!==M.onBlurCapture||t[58]!==I||t[59]!==L||t[60]!==B||t[61]!==V||t[62]!==H||t[63]!==U?(W=(0,C.jsxs)(y,{gap:`gap-5`,onBlurCapture:ve,children:[I,L,B,V,H,U]}),t[57]=M.onBlurCapture,t[58]=I,t[59]=L,t[60]=B,t[61]=V,t[62]=H,t[63]=U,t[64]=W):W=t[64],W}function R(){let e=(0,fe.c)(17),t=s(B),n=c(z)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=d(t?`settings-agent-defaults`:null,ne);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,C.jsx)(y,{children:(0,C.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,C.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===o?a=e[5]:(a=()=>void o(),e[4]=o,e[5]=a);let s=n?`重试`:`Retry`,c;e[6]!==a||e[7]!==s?(c=(0,C.jsx)(oe,{onClick:a,children:s}),e[6]=a,e[7]=s,e[8]=c):c=e[8];let l;return e[9]!==r||e[10]!==c?(l=(0,C.jsxs)(y,{children:[r,c]}),e[9]=r,e[10]=c,e[11]=l):l=e[11],l}if(a||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsx)(I,{}),e[12]=t):t=e[12],t}let l;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(l=(0,C.jsx)(L,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=l):l=e[16],l}function z(e){return e.language}function B(e){return e.conversationId}export{R as AgentDefaultsSettingsPanel};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./folder-open-CyzJ19I9.js";import{t as c}from"./messages-DPxcWxfD.js";import{t as l}from"./cn-0WouolD0.js";import{a as u,n as ee,r as d}from"./locale-store-Djl2FW6_.js";import{a as f,i as p,o as m,r as te,s as h,t as g}from"./dist-BGTk37IG.js";import{a as _}from"./vendor-swr-BIWyz7Rc.js";import{$a as v,Ef as y,El as b,Eu as x,Pd as S,Qd as C,Rc as w,Wc as T,Wu as ne,Xl as E,lf as D,of as O}from"./index-Dsp_gNdl.js";import{t as k}from"./browser-BLJWD7WI.js";import{t as A}from"./capability-icon-DVoZxEgW.js";var j=n(),M=e(k(),1),N=e(t(),1),P=r();function F(e){let t=(0,j.c)(6),{fields:n,values:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=Object.entries(n),t[0]=n,t[1]=a);let o;return t[2]!==i||t[3]!==a||t[4]!==r?(o=(0,P.jsx)(P.Fragment,{children:a.map(e=>{let[t,n]=e;return(0,P.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[(0,P.jsxs)(`span`,{children:[n.title,n.required?` *`:``]}),n.type===`boolean`?(0,P.jsx)(`input`,{type:`checkbox`,checked:r[t]===!0,onChange:e=>i({...r,[t]:e.target.checked})}):(0,P.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2.5`,type:n.sensitive?`password`:n.type===`number`?`number`:`text`,required:n.required,autoComplete:`off`,value:String(r[t]??``),onChange:e=>i({...r,[t]:n.type===`number`?Number(e.target.value):e.target.value})})]},t)})}),t[2]=i,t[3]=a,t[4]=r,t[5]=o):o=t[5],o}function re(e){let t=(0,j.c)(62),{account:n,fields:r,zh:i,busy:a,attempt:o,onBack:s,onConnect:c,onSave:l,onRedirect:u,onSkip:ee}=e,[d,f]=(0,N.useState)(n.methods[0]?.id??``),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={},t[0]=p):p=t[0];let[m,te]=(0,N.useState)(p),[h,g]=(0,N.useState)(``),[_,v]=(0,N.useState)(),b;t[1]===d?b=t[2]:(b=e=>e.id===d,t[1]=d,t[2]=b);let x=n.methods.find(b),S;t[3]===i?S=t[4]:(S=(e,t)=>i?e:t,t[3]=i,t[4]=S);let C=S,E=o?.challenge?.type===`qr`?o.challenge.url:void 0,D,O;t[5]===E?(D=t[6],O=t[7]):(D=()=>{let e=!1;return v(void 0),E&&M.toDataURL(E,{width:240,margin:2}).then(t=>{e||v(t)}).catch(L),()=>{e=!0}},O=[E],t[5]=E,t[6]=D,t[7]=O),(0,N.useEffect)(D,O);let k;t[8]===o?k=t[9]:(k=o&&![`cancelled`,`error`,`connected`].includes(o.state),t[8]=o,t[9]=k);let A=k,re=o?.authorizationUrl??o?.challenge?.url,R=`连接 ${n.title}`,z=`Connect ${n.title}`,B;t[10]!==C||t[11]!==R||t[12]!==z?(B=C(R,z),t[10]=C,t[11]=R,t[12]=z,t[13]=B):B=t[13];let V;t[14]===C?V=t[15]:(V=C(`返回插件详情`,`Back to plugin details`),t[14]=C,t[15]=V);let H;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,P.jsx)(y,{className:`size-4`}),t[16]=H):H=t[16];let U;t[17]!==s||t[18]!==V?(U=(0,P.jsx)(T,{variant:`ghost`,className:`shrink-0`,onClick:s,"aria-label":V,children:H}),t[17]=s,t[18]=V,t[19]=U):U=t[19];let W;t[20]===C?W=t[21]:(W=C(`连接 `,`Connect `),t[20]=C,t[21]=W);let G;t[22]!==n.title||t[23]!==W?(G=(0,P.jsxs)(`h3`,{className:`text-base font-semibold`,children:[W,n.title]}),t[22]=n.title,t[23]=W,t[24]=G):G=t[24];let K;t[25]!==n.description||t[26]!==C?(K=n.description??C(`完成授权后自动检查连接。也可以稍后在详情页继续。`,`The connection is checked after authorization. You can also continue later in plugin details.`),t[25]=n.description,t[26]=C,t[27]=K):K=t[27];let q;t[28]===K?q=t[29]:(q=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:K}),t[28]=K,t[29]=q);let J;t[30]!==G||t[31]!==q?(J=(0,P.jsxs)(`div`,{children:[G,q]}),t[30]=G,t[31]=q,t[32]=J):J=t[32];let Y;t[33]!==U||t[34]!==J?(Y=(0,P.jsxs)(`div`,{className:`flex items-start gap-3`,children:[U,J]}),t[33]=U,t[34]=J,t[35]=Y):Y=t[35];let X;t[36]!==n.methods||t[37]!==A||t[38]!==a||t[39]!==d||t[40]!==C?(X=n.methods.length>1?(0,P.jsx)(`div`,{role:`tablist`,"aria-label":C(`授权方式`,`Authorization methods`),className:`flex flex-wrap gap-2 rounded-lg bg-surface-inset p-1.5`,children:n.methods.map(e=>(0,P.jsx)(`button`,{role:`tab`,type:`button`,"aria-selected":d===e.id,className:`min-h-10 rounded-md px-3 text-sm ${d===e.id?`bg-surface-panel font-medium text-fg`:`text-fg-muted`}`,disabled:a||!!A,onClick:()=>{f(e.id),te({})},children:e.title},e.id))}):null,t[36]=n.methods,t[37]=A,t[38]=a,t[39]=d,t[40]=C,t[41]=X):X=t[41];let ie=x?.instructions?.length||x?.helpUrl?(0,P.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[x.instructions?.length?(0,P.jsx)(`ol`,{className:`list-decimal space-y-2 pl-5`,children:x.instructions.map(I)}):null,x.helpUrl?(0,P.jsx)(`a`,{className:`text-accent underline`,href:x.helpUrl,target:`_blank`,rel:`noopener noreferrer`,children:C(`打开官方配置说明`,`Open setup instructions`)}):null]}):null,ae=(x?.type===`form`||x?.fields?.length)&&!A?(0,P.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),l(x.id,m)},children:[(0,P.jsx)(F,{fields:Object.fromEntries((x.fields??[]).filter(e=>r[e]).map(e=>[e,{...r[e],required:!0}])),values:m,onChange:te}),(0,P.jsxs)(T,{type:`submit`,disabled:a||!x.fields?.every(e=>m[e]!==void 0&&m[e]!==``),children:[a?(0,P.jsx)(ne,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,C(`保存并连接`,`Save and connect`)]})]}):(0,P.jsxs)(`div`,{className:`space-y-4`,children:[A?null:(0,P.jsx)(T,{disabled:a,onClick:()=>c(d),children:C(`连接账号`,`Connect account`)}),A?(0,P.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:o.challenge?.message??(o.state===`preparing`?C(`正在准备登录…`,`Preparing sign-in…`):C(`请完成登录,返回后会自动继续。`,`Finish signing in. Installation continues automatically.`))}):null,E&&A?_?(0,P.jsx)(`img`,{src:_,alt:C(`使用 ${n.title} 扫码授权`,`Scan to authorize ${n.title}`),className:`mx-auto size-60 max-w-full rounded-lg`}):(0,P.jsx)(w,{className:`mx-auto size-60`}):null,re&&A?(0,P.jsx)(`a`,{href:re,target:`_blank`,rel:`noopener noreferrer`,className:`inline-block text-sm text-accent underline`,children:E?C(`也可以打开授权页面`,`Or open the authorization page`):C(`打开登录页面`,`Open sign-in page`)}):null,o?.expiresAt&&A?(0,P.jsxs)(`p`,{className:`text-center text-xs text-fg-muted`,children:[C(`本次授权有效期至 `,`This sign-in expires at `),new Date(o.expiresAt).toLocaleTimeString()]}):null,o?.error?(0,P.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:o.error}):null,o?.acceptsRedirect&&A?(0,P.jsxs)(`details`,{className:`text-sm`,children:[(0,P.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:C(`登录后没有自动返回?`,`Did sign-in not return automatically?`)}),(0,P.jsxs)(`form`,{className:`mt-3 space-y-3`,onSubmit:e=>{e.preventDefault(),u(h)},children:[(0,P.jsxs)(`label`,{children:[C(`登录回调地址`,`Sign-in callback URL`),(0,P.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),className:`mt-1 w-full rounded-lg border border-edge bg-surface-inset p-2`})]}),(0,P.jsx)(T,{type:`submit`,disabled:a||!h,children:C(`继续登录`,`Continue sign-in`)})]})]}):null]}),Z;t[42]===C?Z=t[43]:(Z=C(`暂时跳过`,`Skip for now`),t[42]=C,t[43]=Z);let oe;t[44]!==a||t[45]!==ee||t[46]!==Z?(oe=(0,P.jsx)(T,{variant:`secondary`,disabled:a,onClick:ee,children:Z}),t[44]=a,t[45]=ee,t[46]=Z,t[47]=oe):oe=t[47];let se;t[48]===C?se=t[49]:(se=C(`相关功能暂不可用,可随时在插件详情中授权。`,`Features requiring this account stay unavailable. Connect later in plugin details.`),t[48]=C,t[49]=se);let ce;t[50]===se?ce=t[51]:(ce=(0,P.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:se}),t[50]=se,t[51]=ce);let Q;t[52]!==oe||t[53]!==ce?(Q=(0,P.jsxs)(`div`,{className:`border-t border-edge pt-4`,children:[oe,ce]}),t[52]=oe,t[53]=ce,t[54]=Q):Q=t[54];let le;return t[55]!==B||t[56]!==Y||t[57]!==X||t[58]!==ie||t[59]!==ae||t[60]!==Q?(le=(0,P.jsxs)(`section`,{className:`space-y-5`,"aria-label":B,children:[Y,X,ie,ae,Q]}),t[55]=B,t[56]=Y,t[57]=X,t[58]=ie,t[59]=ae,t[60]=Q,t[61]=le):le=t[61],le}function I(e,t){return(0,P.jsx)(`li`,{children:e},t)}function L(){}async function R(e,t=`GET`,n){let r=await u(d(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function z({extension:e,zh:t,onChanged:n,onStart:r,onInstalled:i}){let s=`/api/extensions/agent-plugins/${encodeURIComponent(e.pluginId)}`,[c,l]=(0,N.useState)(),[u,ee]=(0,N.useState)({}),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(``),[te,h]=(0,N.useState)({}),[g,_]=(0,N.useState)(null),[v,y]=(0,N.useState)(``),[b,x]=(0,N.useState)(null),[S,E]=(0,N.useState)(!1),D=(0,N.useRef)(new Set),k=(0,N.useRef)(new Set),A=(0,N.useRef)(void 0),j=(0,N.useRef)(null),M=(e,n)=>t?e:n,I=e.setup?.authorizations??[],L=new Set(I.flatMap(e=>e.servers)),z=[...I,...(c?.connections??[]).filter(t=>!L.has(t.name)&&(e.components?.mcp.find(e=>e.name===t.name)?.type!==`stdio`||t.state===`token_required`)).map(t=>{let n=t.state===`token_required`||e.components?.mcp.find(e=>e.name===t.name)?.connectionAuth?.mode===`api-key`;return{id:t.name,title:t.name,servers:[t.name],methods:[{id:n?`api-key`:`oauth`,title:n?M(`访问令牌`,`Access token`):M(`浏览器登录`,`Browser sign-in`),type:n?`form`:`oauth`,...n?{fields:[`__apiKey`]}:{server:t.name}}]}})],B=e=>e.servers.every(e=>c?.connections.find(t=>t.name===e)?.state===`connected`)&&(!I.some(t=>t.id===e.id)||c?.authorizations?.find(t=>t.id===e.id)?.state===`connected`),V=z.filter(e=>!B(e)),H=c?.installed||c?.state===`completed`,U=e.setup?.userConfig??{},W=new Set(I.flatMap(e=>e.methods.flatMap(e=>e.fields??[]))),G=Object.fromEntries(Object.entries(U).filter(([e])=>!W.has(e))),K=c?.error===`Connection verification failed. Check the credentials or login status and try again.`?M(`连接验证未通过,请检查凭据或登录状态后重试。`,c.error):c?.error,q=Object.fromEntries(Object.entries(U).filter(([e])=>c?.missingConfig?.includes(e))),J=d||c?.state===`running`,Y=z.find(e=>e.id===b);(0,N.useEffect)(()=>{let e=!1;return R(`${s}/setup`).then(t=>{e||l(t)}).catch(t=>{e||(l(null),m(String(t)))}),()=>{e=!0}},[s]),(0,N.useEffect)(()=>{if(c?.state!==`running`)return;let e=!1,t=!1,r=setInterval(()=>{t||(t=!0,R(`${s}/setup`).then(t=>{e||(l(t),t?.state!==`running`&&n())}).catch(t=>{e||m(String(t))}).finally(()=>{t=!1}))},750);return()=>{e=!0,clearInterval(r)}},[s,c?.state]),(0,N.useEffect)(()=>{if(!c||!c.connections.some(e=>[`oauth_required`,`error`].includes(e.state)))return;let e=!1;return R(`${s}/setup/reusable`).then(t=>{e||h(t)}).catch(()=>{e||h({})}),()=>{e=!0}},[s,c?.revision]),(0,N.useEffect)(()=>{if(!v||c?.state===`completed`)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await R(`${s}/setup/auth/${encodeURIComponent(v)}`);e||_(t)}catch(t){e||m(String(t))}finally{t=!1}}};n();let r=setInterval(()=>void n(),1500),i=()=>void n();return window.addEventListener(`focus`,i),()=>{e=!0,clearInterval(r),window.removeEventListener(`focus`,i)}},[s,v,c?.state]),(0,N.useEffect)(()=>{let e=g?.authorizationUrl??(g?.challenge?.type===`url`?g.challenge.url:void 0);if(!e||g?.error||!j.current)return;let t=j.current;j.current=null,t.closed||t.location.replace(e)},[g]);async function X(e,t={},r=c?.revision){f(!0),m(``);try{let a=await R(`${s}/setup`,`POST`,{action:e,expectedRevision:r,...e===`start`?{}:{idempotencyKey:crypto.randomUUID()},...t});return[`configure`,`reuse`,`start`].includes(e)&&(ee({}),E(!1),a=await R(`${s}/setup`,`POST`,{action:`prepare`,expectedRevision:a.revision,idempotencyKey:crypto.randomUUID()})),l(a),await n(),[`complete`,`defer`].includes(e)&&(x(null),_(null),y(``),j.current?.close(),j.current=null,i?.()),a}catch(e){m(e instanceof Error?e.message:String(e));try{l(await R(`${s}/setup`))}catch{}return null}finally{f(!1)}}(0,N.useEffect)(()=>{if(!c||J||p||[`cancelled`,`running`,`failed`].includes(c.state)||c.state===`completed`)return;let e,t=``;if(c.state===`pending`?(e=`prepare`,t=`prepare:${s}:${c.revision}`):g?.state===`connected`&&(e=`prepare`,t=`auth:${s}:${g.id}`),e&&!D.current.has(t)){D.current.add(t),X(e);return}c.resources===`ready`&&!c.missingConfig?.length&&!c.partial&&c.connections.every(e=>e.state===`connected`)&&(c.authorizations??[]).every(e=>e.state===`connected`)&&(t=`complete:${s}:${c.revision}`,D.current.has(t)||(D.current.add(t),X(`complete`)))},[c,g,J,p,s]),(0,N.useEffect)(()=>{J||!c||c.state===`cancelled`||(Y&&c.revision!==A.current&&B(Y)?(x(null),_(null),y(``)):!H&&c.resources===`ready`&&!c.missingConfig?.length&&!b&&V[0]&&!k.current.has(V[0].id)&&(k.current.add(V[0].id),A.current=c.revision,x(V[0].id)))},[c,J,H,b]);function ie(e,t){let n=e.methods.find(e=>e.id===t)?.type===`oauth`?window.open(`about:blank`,`_blank`):null;n&&(n.opener=null),j.current=n,_(null),X(`authorize`,{server:e.id,...I.some(t=>t.id===e.id)?{method:t}:{}}).then(t=>{t?y(e.id):(n?.close(),j.current=null)})}async function ae(t,n,r){if(n===`api-key`&&!I.some(e=>e.id===t.id)){f(!0),m(``);try{let n=e.components?.mcp.find(e=>e.name===t.id);await R(`${s}/mcp/${encodeURIComponent(t.id)}/auth`,`PUT`,{mode:`api-key`,secrets:[{target:n.type===`stdio`?`env`:`headers`,key:n.connectionAuth?.headerName??(n.type===`stdio`?`API_KEY`:`Authorization`),prefix:n.connectionAuth?.prefix??(n.type===`stdio`?``:`Bearer `),value:r.__apiKey}]});let i=await R(`${s}/setup`);l(i),f(!1),await X(`prepare`,{},i.revision);return}catch(e){m(String(e)),f(!1);return}f(!1)}else if(t.methods.find(e=>e.id===n)?.type===`cli`){let e=await X(`configure`,{authorization:t.id,method:n,values:r},c?.revision);e&&await X(`authorize`,{server:t.id,method:n},e.revision)&&y(t.id)}else await X(`configure`,{authorization:t.id,method:n,values:r})}if(c===void 0)return(0,P.jsx)(w,{className:`h-40 w-full`});let Z=()=>{X(`defer`)};return Y?(0,P.jsxs)(`div`,{className:`space-y-3`,children:[(0,P.jsx)(re,{account:Y,fields:{...U,__apiKey:{type:`string`,title:M(`访问令牌`,`Access token`),required:!0,sensitive:!0}},zh:t,busy:J,attempt:g,onBack:()=>x(null),onConnect:e=>ie(Y,e),onSave:(e,t)=>void ae(Y,e,t),onRedirect:e=>{f(!0),R(`${s}/setup/auth/${encodeURIComponent(v)}/redirect`,`POST`,{url:e}).catch(e=>m(String(e))).finally(()=>f(!1))},onSkip:Z},Y.id),te[Y.id]?.map(e=>(0,P.jsxs)(T,{disabled:J,variant:`secondary`,onClick:()=>void X(`reuse`,{server:Y.id,sourceServerId:e.id}),children:[M(`使用已登录账号:`,`Use signed-in account: `),e.name]},e.id)),p||K&&Y.servers.some(e=>c?.connections.find(t=>t.name===e)?.state===`error`)?(0,P.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:p||K}):null]}):(0,P.jsxs)(`section`,{className:`space-y-5`,"aria-label":M(`插件安装与授权`,`Plugin setup`),children:[H?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h3`,{className:`font-medium`,children:M(`安装完成`,`Installation complete`)}),(0,P.jsx)(`p`,{role:`status`,className:`mt-1 text-sm text-fg-muted`,children:e.activationEligible===!1?M(`插件已停用。`,`Plugin is disabled.`):c?.partial||V.length||c?.missingConfig?.length?M(`插件已安装,部分功能仍需要授权。`,`Plugin installed. Some features still need authorization.`):M(`所有 Agent 均可使用。可在 Agent 设置中单独调整。`,`Available to all agents. Customize individual agents in Agent settings.`)})]}):(0,P.jsxs)(`div`,{className:`rounded-xl border border-edge p-4`,children:[(0,P.jsx)(`h3`,{className:`font-medium`,children:M(`安装准备`,`Installation setup`)}),(0,P.jsx)(`ol`,{className:`mt-4 space-y-4 text-sm`,"aria-live":`polite`,children:[{name:M(`准备资源`,`Prepare resources`),done:c?.resources===`ready`,running:J&&c?.resources!==`ready`},{name:M(`授权账号`,`Authorize accounts`),done:c?.resources===`ready`&&!c?.missingConfig?.length&&V.length===0,running:!1},{name:M(`加载可用工具`,`Load available tools`),done:!1,running:J&&c?.resources===`ready`}].map(e=>(0,P.jsxs)(`li`,{className:`flex items-center gap-3`,children:[e.done?(0,P.jsx)(o,{className:`size-5 text-accent`,"aria-hidden":!0}):e.running?(0,P.jsx)(ne,{className:`size-5 animate-spin text-accent`,"aria-hidden":!0}):(0,P.jsx)(C,{className:`size-5 text-fg-muted`,"aria-hidden":!0}),e.name]},e.name))}),(0,P.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:M(`安装后所有 Agent 均可使用,可在各自的设置中调整。`,`Available to all agents after installation. Customize individual agents in Agent settings.`)})]}),!c||c.state===`cancelled`?(0,P.jsx)(T,{disabled:d||e.readiness===`blocked`,onClick:()=>void X(`start`),children:M(`继续安装`,`Continue installation`)}):(0,P.jsxs)(P.Fragment,{children:[c.missingConfig?.length||S?(0,P.jsxs)(`form`,{className:`space-y-4 rounded-xl border border-edge p-4`,onSubmit:e=>{e.preventDefault(),X(`configure`,{values:u})},children:[(0,P.jsx)(`h4`,{className:`font-medium`,children:M(`补充配置`,`Required configuration`)}),(0,P.jsx)(F,{fields:S?G:q,values:u,onChange:ee}),(0,P.jsx)(T,{type:`submit`,disabled:J||!Object.keys(u).length,children:M(`继续`,`Continue`)})]}):null,H&&(V.length||c.missingConfig?.length)?(0,P.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,P.jsx)(O,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`p`,{className:`font-medium`,children:M(`需要授权`,`Authorization required`)}),(0,P.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:M(`授权后即可使用相关功能。已就绪的功能可继续使用。`,`Connect these accounts to use their features. Ready features remain available.`)})]})]}):null,z.length?(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(`h4`,{className:`text-sm font-medium`,children:M(`账号与连接`,`Accounts and connections`)}),z.map(e=>(0,P.jsxs)(`div`,{role:`group`,"aria-label":e.title,className:`flex items-center justify-between gap-3 rounded-lg border border-edge p-3`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium`,children:e.title}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:B(e)?M(`已连接`,`Connected`):M(`需要授权`,`Authorization required`)})]}),(0,P.jsx)(T,{variant:B(e)?`secondary`:`primary`,disabled:J||c.resources!==`ready`,onClick:()=>{_(null),y(``),A.current=c.revision,x(e.id)},children:B(e)?M(`重新授权`,`Reconnect`):M(`连接账号`,`Connect account`)})]},e.id))]}):null,!H&&c.resources===`ready`?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(T,{variant:`secondary`,disabled:J,onClick:Z,children:M(`暂时跳过`,`Skip for now`)}),(0,P.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:M(`先完成安装,稍后在详情页授权。未授权的功能暂不可用。`,`Finish installation and connect later in plugin details. Unauthenticated features remain unavailable.`)})]}):null,H&&Object.keys(G).length&&!S?(0,P.jsx)(T,{variant:`ghost`,disabled:J,onClick:()=>E(!0),children:M(`修改插件配置`,`Edit plugin configuration`)}):null,!J&&(p||[`failed`,`interrupted`].includes(c.state)||c.connections.some(e=>e.state===`error`))?(0,P.jsx)(T,{variant:`secondary`,onClick:()=>void X(`prepare`),children:M(`重试检查`,`Retry checks`)}):null,H?null:(0,P.jsx)(T,{variant:`ghost`,disabled:d,onClick:()=>void X(`cancel`),children:M(`取消安装`,`Cancel installation`)}),H&&!V.length&&!c.missingConfig?.length?e.setup?.tasks?.map(t=>(0,P.jsxs)(`div`,{className:`space-y-3 rounded-lg bg-surface-inset p-4 text-sm`,children:[(0,P.jsx)(`p`,{children:t}),(0,P.jsx)(T,{asChild:!0,disabled:!e.active,children:(0,P.jsx)(a,{to:`/chat/new?${new URLSearchParams({draft:t,projectScope:`none`})}`,state:{forceNewChat:!0},onClick:t=>{e.active?r?.():t.preventDefault()},children:M(`开始这个任务`,`Start this task`)})})]},t)):null]}),J?(0,P.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:M(`正在准备,可关闭后继续。`,`Preparing. You can close this window and resume.`)}):null,c?.error&&!c.deferred&&!c.missingConfig?.length?(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:K}):null,p?(0,P.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:p}):null]})}var B=`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;function V(e,t){if(e.startsWith(`content.skills:`)){let n=e.slice(15);return t?`提供技能:${n}`:`Add skill: ${n}`}if(e.startsWith(`runtime.mcp.stdio:`)){let n=e.slice(18).split(`:`,1)[0];return t?`在 Gateway 上运行工具服务:${n}`:`Run a tool service on the Gateway: ${n}`}if(e.startsWith(`network.mcp:`)){let n=e.slice(12).split(`:`,1)[0];return t?`连接外部工具服务:${n}`:`Connect to an external tool service: ${n}`}return e.startsWith(`runtime.authorization:`)?t?`在本机运行账号登录程序:${e.split(`:`)[1]}`:`Run account sign-in locally: ${e.split(`:`)[1]}`:e.startsWith(`runtime.resource:`)?t?`下载可执行资源:${e.split(`:`)[1]}`:`Download executable resource: ${e.split(`:`)[1]}`:e.startsWith(`network.resource:`)?t?`下载并校验资源:${e.split(`:`)[1]}`:`Download and verify resource: ${e.split(`:`)[1]}`:e}function H(e,t){return t?.publisher?.verification!==`verified`||t.latestVersion.riskTier&&t.latestVersion.riskTier!==`content`?!0:e.addedCapabilities.some(e=>!e.startsWith(`content.skills:`))}async function U(e,t,n){let r=await u(d(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function W(e){let t=(0,j.c)(49),{pluginId:n,server:r,enabled:i}=e,a=ee(G),o;t[0]===a?o=t[1]:(o=a.startsWith(`zh`),t[0]=a,t[1]=o);let s=o,[c,l]=(0,N.useState)(``),[u,d]=(0,N.useState)(!1),[f,p]=(0,N.useState)(``),[m,te]=(0,N.useState)(r.connectionAuth?.headerName??(r.type===`stdio`?`API_KEY`:`Authorization`)),[h,g]=(0,N.useState)(r.connectionAuth?.prefix??(r.type===`stdio`?``:`Bearer `)),_;t[2]!==r.name||t[3]!==r.type?(_=(0,P.jsxs)(`p`,{className:`font-medium`,children:[r.name,` · `,r.type]}),t[2]=r.name,t[3]=r.type,t[4]=_):_=t[4];let v=r.type===`stdio`?`xopc mcp list`:`xopc mcp login ${r.id}`,y;t[5]===v?y=t[6]:(y=(0,P.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-fg-muted`,children:v}),t[5]=v,t[6]=y);let b;t[7]!==m||t[8]!==n||t[9]!==h||t[10]!==c||t[11]!==r.name||t[12]!==r.type||t[13]!==s?(b=e=>{e.preventDefault(),d(!0),p(``),U(`/api/extensions/agent-plugins/${encodeURIComponent(n)}/mcp/${encodeURIComponent(r.name)}/auth`,`PUT`,{mode:`api-key`,secrets:[{target:r.type===`stdio`?`env`:`headers`,key:m,value:c,prefix:h}]}).then(()=>{l(``),p(s?`已保存`:`Saved`)}).catch(e=>p(String(e))).finally(()=>d(!1))},t[7]=m,t[8]=n,t[9]=h,t[10]=c,t[11]=r.name,t[12]=r.type,t[13]=s,t[14]=b):b=t[14];let x=s?`字段名`:`Field name`,S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>te(e.target.value),t[15]=S):S=t[15];let C;t[16]===m?C=t[17]:(C=(0,P.jsx)(`input`,{className:B,value:m,onChange:S,required:!0}),t[16]=m,t[17]=C);let w;t[18]!==x||t[19]!==C?(w=(0,P.jsxs)(`label`,{className:`block`,children:[x,C]}),t[18]=x,t[19]=C,t[20]=w):w=t[20];let ne=s?`前缀`:`Prefix`,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>g(e.target.value),t[21]=E):E=t[21];let D;t[22]===h?D=t[23]:(D=(0,P.jsx)(`input`,{className:B,value:h,onChange:E}),t[22]=h,t[23]=D);let O;t[24]!==ne||t[25]!==D?(O=(0,P.jsxs)(`label`,{className:`block`,children:[ne,D]}),t[24]=ne,t[25]=D,t[26]=O):O=t[26];let k=s?`密钥`:`Secret`,A;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>l(e.target.value),t[27]=A):A=t[27];let M;t[28]===c?M=t[29]:(M=(0,P.jsx)(`input`,{type:`password`,autoComplete:`off`,className:B,value:c,onChange:A,required:!0}),t[28]=c,t[29]=M);let F;t[30]!==k||t[31]!==M?(F=(0,P.jsxs)(`label`,{className:`block`,children:[k,M]}),t[30]=k,t[31]=M,t[32]=F):F=t[32];let re=!i||u||!c,I=s?`保存密钥`:`Save API key`,L;t[33]!==re||t[34]!==I?(L=(0,P.jsx)(T,{type:`submit`,disabled:re,children:I}),t[33]=re,t[34]=I,t[35]=L):L=t[35];let R;t[36]!==w||t[37]!==O||t[38]!==F||t[39]!==L||t[40]!==b?(R=(0,P.jsxs)(`form`,{className:`mt-3 space-y-2`,onSubmit:b,children:[w,O,F,L]}),t[36]=w,t[37]=O,t[38]=F,t[39]=L,t[40]=b,t[41]=R):R=t[41];let z;t[42]===f?z=t[43]:(z=f?(0,P.jsx)(`p`,{className:`mt-2 text-fg-muted`,children:f}):null,t[42]=f,t[43]=z);let V;return t[44]!==R||t[45]!==z||t[46]!==_||t[47]!==y?(V=(0,P.jsxs)(`div`,{className:`rounded-lg border border-edge p-3 text-sm`,children:[_,y,R,z]}),t[44]=R,t[45]=z,t[46]=_,t[47]=y,t[48]=V):V=t[48],V}function G(e){return e.language}function K({extension:e,onClose:t,initialSource:n=``,marketplace:r,autoInstall:a=!1}){let u=ee(e=>e.language),d=u.startsWith(`zh`),y=r?.localizations?.[d?`zh-CN`:`en`],C=y?.displayName??r?.name,w=y?.description??r?.description,O=(0,N.useId)(),{mutate:k}=_(),[j,M]=(0,N.useState)(e),[F,re]=(0,N.useState)(n||e?.installationSource||``),[I,L]=(0,N.useState)(null),[R,G]=(0,N.useState)([]),[K,q]=(0,N.useState)(!1),[J,Y]=(0,N.useState)(``),[X,ie]=(0,N.useState)(!1),[ae,Z]=(0,N.useState)(!1),[oe,se]=(0,N.useState)(!1),[ce,Q]=(0,N.useState)(!1),[le,ue]=(0,N.useState)(!1),[de,fe]=(0,N.useState)(!1),pe=i(),[me,he]=(0,N.useState)(!1),ge=(0,N.useRef)(!1),_e=`/api/extensions/agent-plugins/${encodeURIComponent(j?.pluginId??``)}`,ve=F.trim().startsWith(`store:`),ye=()=>k(`gateway-extensions-list`);async function $(e){q(!0),Y(``);try{await e()}catch(e){Y(e instanceof Error?e.message:String(e))}finally{q(!1)}}function be(e){re(e),L(null),G([]),Y(``)}let xe=typeof window<`u`?window.electronAPI?.file:void 0,Se=/^(?:\/|[A-Za-z]:[\\/])/.test(F.trim())?F.trim():void 0;async function Ce(){if(!xe?.openDirectory){ue(!0);return}let e=await xe.openDirectory(Se?{defaultPath:Se}:void 0);e&&be(e)}async function we(){if(!xe?.openFile){ue(!0);return}let e=await xe.openFile({...Se?{defaultPath:Se}:{},extensions:[`zip`]});e&&be(e)}function Te(e){return[...e.dataTransfer.types].some(e=>e===`Files`||e===`text/plain`||e===`text/uri-list`)}function Ee(e){if(!Te(e))return;e.preventDefault(),Q(!1);let t=Array.from(e.dataTransfer.files);if(t.length){if(t.length>1){Y(d?`一次只能选择一个插件目录或 ZIP。`:`Choose one plugin directory or ZIP at a time.`);return}let e=xe?.getPathForFile?.(t[0]);e?be(e):Y(d?`浏览器无法读取本机文件路径,请使用“选择文件或目录”选择安装包。`:`The browser cannot read local file paths. Use Choose file or folder to select the package.`);return}let n=e.dataTransfer.getData(`text/uri-list`)||e.dataTransfer.getData(`text/plain`);n.trim()&&be(n.trim().split(/\r?\n/)[0])}async function De(e){M(await U(`${_e}/activation`,`POST`,{enabled:e})),await ye()}async function Oe(e){let t=!j,n=await U(t?`/api/extensions/install`:`${_e}/update`,`POST`,{source:F,reviewHash:e.reviewHash,...e.layout?{setup:!0}:{}});M(n),await ye(),!e.layout&&t&&!n.activationEligible&&n.readiness!==`blocked`&&n.pluginId&&(n=await U(`/api/extensions/agent-plugins/${encodeURIComponent(n.pluginId)}/activation`,`POST`,{enabled:!0}),M(n),await ye()),L(null),he(!e.layout&&t&&n.activationEligible===!0)}async function ke(){let e=await U(`/api/extensions/inspect`,`POST`,{source:F});if(H(e,r)){L(e);return}await Oe(e)}(0,N.useEffect)(()=>{e&&!e.setup&&M(e)},[e]),(0,N.useEffect)(()=>{if(!e?.setup||!e.pluginId)return;let t=!1;return U(`/api/extensions/agent-plugins/${encodeURIComponent(e.pluginId)}`,`GET`).then(e=>{t||M(e)}).catch(()=>{}),()=>{t=!0}},[e?.pluginId]),(0,N.useEffect)(()=>{!a||j||!ve||ge.current||(ge.current=!0,$(ke))},[a,j,ve]);let Ae=a&&!j&&ve&&!ge.current;return(0,P.jsx)(g,{defaultOpen:!0,onOpenChange:e=>!e&&t(),children:(0,P.jsxs)(m,{children:[(0,P.jsx)(f,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,P.jsxs)(te,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(82vh,42rem)] w-[min(38rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover`,children:[(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,P.jsx)(A,{iconUrl:j?.branding?.iconUrl??r?.branding?.iconUrl,fallback:x}),(0,P.jsx)(h,{className:`font-semibold`,children:j?.name??C??(d?`安装 Agent Plugin`:`Install Agent Plugin`)})]}),(0,P.jsx)(T,{variant:`ghost`,onClick:t,children:d?`关闭`:`Close`})]}),(0,P.jsx)(p,{className:`sr-only`,children:d?`安装、组件、账号连接和权限`:`Installation, components, connections and permissions`}),(0,P.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[!j&&ve?(0,P.jsxs)(`section`,{className:`space-y-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,P.jsx)(E,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`p`,{className:`font-medium text-fg`,children:C??I?.manifest.name??F.slice(6)}),w?(0,P.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:w}):null,(0,P.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r?.publisher?.verification===`verified`?d?`已认证发布者 · 安装后所有 Agent 均可使用`:`Verified publisher · available to all agents after installation`:d?`安装前会检查来源和所需权限`:`Source and required permissions are checked before installation`})]})]}),I?null:(0,P.jsxs)(T,{className:`w-full`,disabled:K||Ae,onClick:()=>void $(ke),children:[K||Ae?(0,P.jsx)(ne,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,K||Ae?d?`正在安全检查并安装…`:`Checking and installing…`:d?`一键安装`:`Install`]})]}):null,j?(0,P.jsxs)(P.Fragment,{children:[me?(0,P.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-4`,children:[(0,P.jsx)(o,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`p`,{className:`font-medium text-fg`,children:d?`插件已安装并启用`:`Plugin installed and enabled`}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:d?`现在可以直接在对话中使用它。`:`It is ready to use in your conversations.`})]})]}):null,(!j.setup||j.readiness!==`setup_required`)&&!j.activationEligible?(0,P.jsxs)(`div`,{role:`status`,className:`space-y-3 rounded-lg border border-accent/25 bg-accent-soft p-4`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`p`,{className:`font-medium text-accent-fg`,children:d?`插件已安装,当前尚未启用`:`Plugin installed. It is not enabled yet.`}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:d?`启用后,Skills 和 MCP 才会加入 Agent 运行时。`:`Enable it to make its skills and MCP servers available to the Agent runtime.`})]}),(0,P.jsx)(T,{disabled:K||j.readiness===`blocked`,onClick:()=>void $(()=>De(!0)),children:d?`启用插件`:`Enable plugin`})]}):null,j.setup?(0,P.jsx)(z,{extension:j,zh:d,onStart:t,onInstalled:()=>{t(),pe(`/capabilities/extensions/${encodeURIComponent(j.pluginId)}`)},onChanged:async()=>{M(await U(`${_e}`,`GET`)),await ye()}}):null,(0,P.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,children:[(0,P.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:d?`插件详情`:`Plugin details`}),(0,P.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,P.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Agent Plugin · `,j.version,` · `,j.readiness&&{ready:d?`已就绪`:`Ready`,setup_required:d?`待连接`:`Setup required`,degraded:d?`部分不可用`:`Partially available`,blocked:d?`已阻止`:`Blocked`}[j.readiness]]}),j.provenance?(0,P.jsxs)(`p`,{className:`break-words text-xs text-fg-muted`,children:[j.provenance.publisherVerification===`verified`?d?`已认证发布者`:`Verified publisher`:d?`社区发布者`:`Community publisher`,` · `,j.provenance.packageName,`@`,j.provenance.version,` · SHA-256 `,j.provenance.sha256.slice(0,12),`…`,j.provenance.riskTier?` · ${j.provenance.riskTier}`:``]}):null,(0,P.jsx)(`p`,{className:`text-sm`,children:j.description}),j.installationSource?(0,P.jsxs)(`p`,{className:`break-all text-xs text-fg-muted`,children:[d?`来源:`:`Source: `,j.installationSource,j.resolvedCommit?` · ${j.resolvedCommit.slice(0,12)}`:``]}):null,j.activationEligible?(0,P.jsx)(T,{disabled:K,variant:`secondary`,onClick:()=>void $(()=>De(!1)),children:d?`停用`:`Disable`}):null,j.canRollback?(0,P.jsx)(T,{disabled:K,variant:`secondary`,onClick:()=>void $(async()=>{M(await U(`${_e}/rollback`,`POST`)),await ye()}),children:d?`回滚上一版本`:`Roll back`}):null,j.components?.mcp.length?(0,P.jsxs)(`details`,{className:`group rounded-lg border border-edge p-3`,children:[(0,P.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 text-sm font-medium text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,P.jsx)(`span`,{children:d?`连接与密钥(按需)`:`Connections and API keys (as needed)`}),(0,P.jsx)(D,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,P.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:d?`仅当工具服务提示登录或缺少密钥时设置。`:`Only configure this when a tool service asks you to sign in or provide a key.`}),(0,P.jsx)(`div`,{className:`mt-3 space-y-3`,children:j.components.mcp.map(e=>(0,P.jsx)(W,{pluginId:j.pluginId,server:e,enabled:j.readiness!==`blocked`},e.id))})]}):null]})]}),j.diagnostics?.map((e,t)=>(0,P.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.component,`: `,e.message]},t))]}):null,j?(0,P.jsxs)(T,{variant:`ghost`,className:`px-0`,"aria-expanded":de,onClick:()=>fe(e=>!e),children:[(0,P.jsx)(D,{className:l(`size-4 transition-transform motion-reduce:transition-none`,de&&`rotate-180`),"aria-hidden":!0}),d?`高级操作`:`Advanced actions`]}):null,!j&&!ve||de?(0,P.jsxs)(`form`,{className:l(`space-y-3`,j&&`border-t border-edge pt-4`),onSubmit:e=>{e.preventDefault(),$(async()=>{let e=await U(`/api/extensions/inspect`,`POST`,{source:F});e.candidates?(G(e.candidates),L(null)):(G([]),L(e))})},children:[(0,P.jsxs)(`div`,{"data-testid":`plugin-source-dropzone`,className:l(`rounded-xl border border-dashed p-3 transition-colors`,ce?`border-accent bg-accent-soft`:`border-edge bg-surface-inset/40`),onDragEnter:e=>{Te(e)&&(e.preventDefault(),Q(!0))},onDragOver:e=>{Te(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,Q(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Q(!1)},onDrop:Ee,children:[(0,P.jsxs)(`div`,{className:`mb-2 flex items-start gap-2`,children:[(0,P.jsx)(b,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`label`,{htmlFor:O,className:`block text-sm font-medium`,children:j?d?`更新包来源`:`Update package source`:d?`安装包来源`:`Package source`}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:d?`输入 github:组织/仓库、Git / ZIP 地址或宿主目录;marketplace 可选择插件。`:`Enter github:owner/repo, a Git / ZIP URL or a Gateway directory. Marketplaces let you choose a plugin.`})]})]}),(0,P.jsx)(`input`,{id:O,className:B,value:F,onChange:e=>be(e.target.value),placeholder:d?`/插件目录/或/插件.zip`:`/plugin/folder/or/plugin.zip`,autoComplete:`off`,spellCheck:!1,required:!0}),(0,P.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:xe?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(T,{type:`button`,variant:`secondary`,disabled:K,onClick:()=>void $(Ce),children:[(0,P.jsx)(s,{className:`size-4`,"aria-hidden":!0}),d?`选择目录`:`Choose directory`]}),(0,P.jsxs)(T,{type:`button`,variant:`secondary`,disabled:K,onClick:()=>void $(we),children:[(0,P.jsx)(S,{className:`size-4`,"aria-hidden":!0}),d?`选择 ZIP`:`Choose ZIP`]})]}):(0,P.jsxs)(T,{type:`button`,variant:`secondary`,disabled:K,onClick:()=>ue(!0),children:[(0,P.jsx)(s,{className:`size-4`,"aria-hidden":!0}),d?`选择文件或目录`:`Choose file or folder`]})})]}),(0,P.jsx)(T,{type:`submit`,variant:`secondary`,disabled:K||!F,children:d?`检查安装包`:`Inspect package`})]}):null,R.length?(0,P.jsx)(`div`,{className:`space-y-2`,"aria-label":d?`选择插件`:`Choose a plugin`,children:R.map(e=>(0,P.jsx)(T,{variant:`secondary`,className:`w-full justify-start`,onClick:()=>{be(e.source),$(async()=>L(await U(`/api/extensions/inspect`,`POST`,{source:e.source})))},children:e.name},e.source))}):null,I?(0,P.jsxs)(`div`,{role:`region`,"aria-labelledby":`plugin-authorization-title`,className:`space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,P.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,P.jsx)(E,{className:`mt-0.5 size-5 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`p`,{id:`plugin-authorization-title`,className:`font-medium text-fg`,children:d?`需要你的授权`:`Your authorization is required`}),(0,P.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:d?`此插件需要以下新增能力。确认后自动准备资源,按需登录账号,所有 Agent 均可使用。`:`Review these capabilities. Resources are prepared automatically; sign in if needed. Available to all agents.`})]})]}),(0,P.jsx)(`ul`,{className:`space-y-2 rounded-lg border border-edge bg-surface-panel p-3 break-words`,children:I.addedCapabilities.map(e=>(0,P.jsxs)(`li`,{className:`flex gap-2`,children:[(0,P.jsx)(`span`,{"aria-hidden":!0,children:`•`}),(0,P.jsx)(`span`,{children:V(e,d)})]},e))}),I.capabilities.some(e=>e.startsWith(`runtime.`))?(0,P.jsxs)(`details`,{children:[(0,P.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:d?`查看执行内容`:`View execution details`}),(0,P.jsx)(`ul`,{className:`mt-2 space-y-2 break-all font-mono text-xs`,children:I.capabilities.filter(e=>e.startsWith(`runtime.`)).map(e=>(0,P.jsx)(`li`,{children:e},e))})]}):null,I.diagnostics.map((e,t)=>(0,P.jsxs)(`p`,{children:[e.component,`: `,e.message]},t)),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsxs)(T,{disabled:K||!!j&&I.manifest.name!==j.name,onClick:()=>void $(()=>Oe(I)),children:[K?(0,P.jsx)(ne,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?`授权并安装`:`Authorize and install`]}),(0,P.jsx)(T,{variant:`ghost`,disabled:K,onClick:()=>L(null),children:d?`取消`:`Cancel`})]})]}):null,j&&de?(0,P.jsx)(`div`,{className:`border-t border-edge pt-4`,children:oe?(0,P.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,P.jsx)(`p`,{children:d?`卸载保留账号凭据;服务端授权需到相应服务撤销。`:`Credentials are retained. Revoke provider authorization in the service itself.`}),(0,P.jsxs)(`label`,{className:`flex gap-2`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:X,onChange:e=>ie(e.target.checked)}),d?`同时删除插件数据`:`Also delete plugin data`]}),(0,P.jsxs)(`label`,{className:`flex gap-2`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:ae,onChange:e=>Z(e.target.checked)}),d?`同时删除本地凭据`:`Also delete local credentials`]}),(0,P.jsx)(T,{disabled:K,onClick:()=>void $(async()=>{await U(_e,`DELETE`,{removeData:X,removeCredentials:ae}),await ye(),t()}),children:d?`确认卸载`:`Confirm uninstall`})]}):(0,P.jsx)(T,{variant:`ghost`,disabled:K,onClick:()=>se(!0),children:d?`卸载插件`:`Uninstall`})}):null,J?(0,P.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-fg-muted`,children:J}):null]})]}),xe?null:(0,P.jsx)(v,{open:le,onOpenChange:ue,initialAbsolutePath:Se,onConfirm:async e=>be(e),wd:c(u).chat.workingDirectory,selectKind:`file-or-directory`,fileExtensions:[`zip`],title:d?`选择插件安装包`:`Choose plugin package`,description:d?`选择插件目录或 ZIP 文件。`:`Choose a plugin directory or ZIP file.`,confirmLabel:d?`使用此来源`:`Use this source`,nested:!0})]})})}export{W as n,z as r,K as t};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-D_bKN3BN.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BNRLzxpH.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-Djl2FW6_.js","assets/messages-DPxcWxfD.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-DyO7Q0Ms.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-B2HK1psj.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/mermaid-render-604gISVe.js","assets/xml-_d7dTN2Q.js","assets/app-link-BV_eGr7l.js","assets/product-delivery-DwmnNJvk.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Ct4sKkUf.css","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/session-manager-DfVviLTK.js","assets/gateway-realtime-2-o7qk92.js","assets/gateway-realtime-store-DQ6-whg-.js","assets/local-session-drafts-BjwlkAKA.js","assets/session-api-DbNNQps9.js","assets/gateway-startup-retry-BCUswcVy.js","assets/constants-DeXt1mV-.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-BwR2CiR5.js","assets/attachment-utils-core-BIOUBrpT.js","assets/agents-admin-api-BjGOUrAf.js","assets/gateway-config-swr-Di9g6pE8.js","assets/capabilities-CTfLd_UE.js","assets/tasks-PuIUgF9L.js","assets/specialists-4bkS5rZ4.js","assets/files-Bw4SBGdM.js","assets/sliding-indicator-hwz0sx3h.js","assets/index-zIgp-ZTu.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-BYNLO2pt.js","assets/block-editor-Cvy3D_4T.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-B2HK1psj.js";import{t as o}from"./ellipsis-0k4rZLoy.js";import{t as s}from"./eye-CABVeTq0.js";import{t as c}from"./markdown-view-DyO7Q0Ms.js";import{t as l}from"./plus-Q2yW6OE7.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./messages-DPxcWxfD.js";import{t as f}from"./cn-0WouolD0.js";import{c as p,n as m}from"./locale-store-Djl2FW6_.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{t as S}from"./specialists-4bkS5rZ4.js";import{i as C}from"./vendor-swr-BIWyz7Rc.js";import{r as w}from"./gateway-config-swr-Di9g6pE8.js";import{n as T,t as E}from"./registry-api-BwR2CiR5.js";import{c as D,i as O,l as k,n as A,o as j,r as M,s as N,t as P}from"./agents-admin-api-BjGOUrAf.js";import{$i as F,Ao as I,Bn as L,El as R,Fo as z,G as B,Gd as V,Ic as H,Io as U,Kn as W,Ln as G,Lu as K,No as ee,Ql as te,Rc as q,Rn as ne,Ro as re,W as ie,Wc as J,Za as ae,ar as oe,bu as Y,er as se,ff as ce,gd as le,gf as ue,is as de,kl as fe,ks as pe,ms as me,nr as he,ou as ge,ps as _e,ql as ve,qn as ye,rr as be,tr as xe,vs as Se,ys as Ce,zn as we}from"./index-BNRLzxpH.js";import{t as Te}from"./number-input-DDeqHK-G.js";import{r as Ee}from"./settings-page-layout-Dx5S-Msc.js";import{t as De}from"./directory-picker-path-field-DOPXwYNR.js";import{r as Oe,s as ke}from"./image-generation-api-Vqcyqnzb.js";var X=e(t(),1),Z=n();function Ae(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 je(e,t){let{frontMatter:n}=Ae(e);return`${n}${t}`}var Me=[{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-ClgTc5v8.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-Dsp_gNdl.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-Djl2FW6_.js","assets/messages-DPxcWxfD.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-DyO7Q0Ms.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-B2HK1psj.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/mermaid-render-604gISVe.js","assets/xml-_d7dTN2Q.js","assets/app-link-BV_eGr7l.js","assets/product-delivery-DwmnNJvk.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Ct4sKkUf.css","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/session-manager-DfVviLTK.js","assets/gateway-realtime-2-o7qk92.js","assets/gateway-realtime-store-DQ6-whg-.js","assets/local-session-drafts-BjwlkAKA.js","assets/session-api-DbNNQps9.js","assets/gateway-startup-retry-BCUswcVy.js","assets/constants-DeXt1mV-.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-BwR2CiR5.js","assets/attachment-utils-core-BIOUBrpT.js","assets/agents-admin-api-BjGOUrAf.js","assets/gateway-config-swr-Di9g6pE8.js","assets/capabilities-CTfLd_UE.js","assets/tasks-PuIUgF9L.js","assets/specialists-4bkS5rZ4.js","assets/files-Bw4SBGdM.js","assets/sliding-indicator-hwz0sx3h.js","assets/index-BKHxJaGD.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-BYNLO2pt.js","assets/block-editor-Cvy3D_4T.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-B2HK1psj.js";import{t as o}from"./ellipsis-0k4rZLoy.js";import{t as s}from"./eye-CABVeTq0.js";import{t as c}from"./markdown-view-DyO7Q0Ms.js";import{t as l}from"./plus-Q2yW6OE7.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./messages-DPxcWxfD.js";import{t as f}from"./cn-0WouolD0.js";import{c as p,n as m}from"./locale-store-Djl2FW6_.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{t as S}from"./specialists-4bkS5rZ4.js";import{i as C}from"./vendor-swr-BIWyz7Rc.js";import{r as w}from"./gateway-config-swr-Di9g6pE8.js";import{n as T,t as E}from"./registry-api-BwR2CiR5.js";import{c as D,i as O,l as k,n as A,o as j,r as M,s as N,t as P}from"./agents-admin-api-BjGOUrAf.js";import{$i as F,Ao as I,Bn as L,El as R,Fo as z,G as B,Gd as V,Ic as H,Io as U,Kn as W,Ln as G,Lu as K,No as ee,Ql as te,Rc as q,Rn as ne,Ro as re,W as ie,Wc as J,Za as ae,ar as oe,bu as Y,er as se,ff as ce,gd as le,gf as ue,is as de,kl as fe,ks as pe,ms as me,nr as he,ou as ge,ps as _e,ql as ve,qn as ye,rr as be,tr as xe,vs as Se,ys as Ce,zn as we}from"./index-Dsp_gNdl.js";import{t as Te}from"./number-input-DDeqHK-G.js";import{r as Ee}from"./settings-page-layout-Dx5S-Msc.js";import{t as De}from"./directory-picker-path-field-B-qZCjGR.js";import{r as Oe,s as ke}from"./image-generation-api-DPFPJ2ps.js";var X=e(t(),1),Z=n();function Ae(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 je(e,t){let{frontMatter:n}=Ae(e);return`${n}${t}`}var Me=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
3
3
 
4
4
  ## Core Truths
5
5
 
@@ -63,7 +63,7 @@ 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:``}],Ne=[{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(),Pe=()=>i(()=>import(`./block-editor-D_bKN3BN.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])),Fe=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([59,1,55,5,60,61,3])),Ie=(0,X.lazy)(()=>Pe().then(e=>({default:e.BlockEditor}))),Le=(0,X.lazy)(()=>Fe().then(e=>({default:e.MarkdownEditor})));function Re(){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)(q,{className:`h-8 w-52`}),(0,Q.jsx)(q,{className:`h-4 w-full`}),(0,Q.jsx)(q,{className:`h-4 w-4/5`}),(0,Q.jsx)(q,{className:`h-4 w-11/12`})]}),e[0]=t):t=e[0],t}var ze=(0,X.forwardRef)(function({agentId:e,file:t,zh:n,onDirtyChange:r},i){let a=pe(e=>e.resolved===`dark`),[o,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(``),[p,m]=(0,X.useState)(!0),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(null),[x,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(!1),[T,E]=(0,X.useState)(null),[D,k]=(0,X.useState)(`direct`);(0,X.useEffect)(()=>{let n=!1;return m(!0),g(!1),b(null),l(``),d(``),S(!1),E(null),(async()=>{try{let r=await O(e),i=new Set(r.files.filter(e=>!e.missing).map(e=>e.name)).has(t)?await M(e,t):``;if(n)return;l(i),d(i)}catch(e){if(n)return;g(!0),b(e instanceof Error?e.message:String(e))}finally{n||m(!1)}})(),()=>{n=!0}},[e,t]);let A=o!==u;(0,X.useEffect)(()=>r(A),[A,r]);let j=(0,X.useCallback)(async()=>{if(A){v(!0),b(null);try{await N(e,t,o),d(o),S(!0),E(null)}catch(e){throw b(e instanceof Error?e.message:String(e)),e}finally{v(!1)}}},[e,t,A,o]);(0,X.useImperativeHandle)(i,()=>({save:j}),[j]);let P={"SOUL.md":{label:n?`个性与边界`:`Personality & boundaries`,description:n?`定义语气、价值观、行为原则与安全边界。`:`Tone, values, behavior principles, and safety boundaries.`},"TOOLS.md":{label:n?`工具使用约定`:`Tool guidance`,description:n?`补充工具偏好和使用约定,不负责授予权限。`:`Tool preferences and conventions; this does not grant access.`},"AGENTS.md":{label:n?`工作规范`:`Working instructions`,description:n?`该智能体长期遵循的协作和执行规范。`:`Persistent collaboration and execution instructions.`}},F=[ce,le,V,Y],L=Ae(o).body;return(0,Q.jsx)(`div`,{className:`space-y-5`,children:(0,Q.jsx)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:(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)(`h4`,{className:`text-sm font-semibold text-fg`,children:P[t].label}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:P[t].description})]}),(0,Q.jsx)(I,{className:`flex rounded-lg bg-surface-hover p-1`,role:`group`,"aria-label":n?`编辑模式`:`Editor mode`,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`direct`,Y,n?`直接编辑`:`Visual`],[`source`,V,`Markdown`],[`preview`,s,n?`预览`:`Preview`]].map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>k(e),"aria-pressed":D===e,className:f(`inline-flex min-h-9 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,D===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))})]}),t===`SOUL.md`&&!p?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:h,"aria-expanded":C,onClick:()=>w(!C),className:`text-xs font-medium text-accent hover:underline`,children:n?`使用模板`:`Use a template`}),T===null?null:(0,Q.jsx)(`button`,{type:`button`,className:`ml-3 text-xs text-accent hover:underline`,onClick:()=>{l(T),E(null)},children:n?`撤销模板替换`:`Undo template replacement`}),C?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`my-2 text-xs text-fg-muted`,children:n?`模板会替换当前个性正文,保存前可以撤销。`:`A template replaces the personality text. You can undo before saving.`}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:Me.map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{e.content&&(E(o),l(t=>je(t,e.content))),k(`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)(F[t]??ue,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),n?e.labelZh:e.labelEn]},e.id))})]}):null]}):null,y?(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:y}):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`,children:p?(0,Q.jsx)(Re,{}):h?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-fg-muted`,children:n?`无法加载角色配置,未对文件进行任何更改。`:`Profile documents could not be loaded. No files were changed.`}):D===`direct`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(Re,{}),children:(0,Q.jsx)(Ie,{initialContent:L,onChange:e=>l(t=>je(t,e)),placeholder:n?`直接输入内容,或输入 / 使用快捷命令…`:`Start writing, or type / for commands…`},`${e}-${t}-direct`)}):D===`source`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(Re,{}),children:(0,Q.jsx)(Le,{initialContent:o,onChange:e=>l(e),isDark:a,lineWrap:!0,className:`min-h-0 flex-1`},`${e}-${t}-source`)}):(0,Q.jsx)(`div`,{className:`h-full overflow-y-auto p-5`,children:L.trim()?(0,Q.jsx)(c,{content:L}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:n?`暂无内容。`:`No content yet.`})})}),(0,Q.jsx)(`div`,{className:`mt-2 flex justify-end text-xs text-fg-muted`,"aria-live":`polite`,children:_?n?`正在保存角色配置…`:`Saving profile documents…`:A?n?`角色配置有未保存的更改`:`Profile documents have unsaved changes`:x?n?`文档更改已保存`:`Document changes saved`:n?`未修改`:`No changes`})]})})})});function Be(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 Ve(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=C(p&&f!==`image`?E:null,T,m),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[1]=g):g=t[1];let _=C(p&&f===`image`?`agent-defaults-image-models`:null,Oe,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(Ue),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,w;t[10]!==f||t[11]!==S?(w=f===`vision`?S.filter(He):S,t[10]=f,t[11]=S,t[12]=w):w=t[12];let D=w,O=f===`image`?_:h,k;t[13]===n?k=t[14]:(k=(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[13]=n,t[14]=k);let A;t[15]!==i||t[16]!==a?(A=i===void 0?(0,Q.jsx)(Be,{children:a?`继承全局`:`Inherited globally`}):null,t[15]=i,t[16]=a,t[17]=A):A=t[17];let j;t[18]!==d||t[19]!==i||t[20]!==a?(j=i===null?(0,Q.jsx)(Be,{children:d?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[18]=d,t[19]=i,t[20]=a,t[21]=j):j=t[21];let M;t[22]!==k||t[23]!==A||t[24]!==j?(M=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[k,A,j]}),t[22]=k,t[23]=A,t[24]=j,t[25]=M):M=t[25];let N;t[26]!==r?.primary||t[27]!==i||t[28]!==a?(N=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]=N):N=t[29];let P;t[30]!==M||t[31]!==N?(P=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[M,N]}),t[30]=M,t[31]=N,t[32]=P):P=t[32];let I;t[33]!==l||t[34]!==i||t[35]!==a?(I=i===void 0?null:(0,Q.jsx)(J,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(void 0),children:a?`继承全局`:`Inherit globally`}),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)(J,{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)(J,{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)(J,{className:`px-2 py-1 text-xs`,onClick:()=>l({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`单独设置`:`Override for this agent`}),t[47]=p,t[48]=r?.fallbacks,t[49]=r?.primary,t[50]=l,t[51]=a,t[52]=z):z=t[52];let V;t[53]!==I||t[54]!==L||t[55]!==R||t[56]!==z?(V=(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]=V):V=t[57];let H;t[58]!==P||t[59]!==V?(H=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[P,V]}),t[58]=P,t[59]=V,t[60]=H):H=t[60];let U;t[61]!==D||t[62]!==p||t[63]!==n||t[64]!==f||t[65]!==S||t[66]!==l||t[67]!==O||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`}),O.isLoading?(0,Q.jsx)(q,{className:`mt-1.5 h-11 w-full rounded-lg`}):(0,Q.jsx)(F,{value:i.primary,models:S,modelsLoading:O.isLoading,modelsError:O.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)(B,{title:a?`备用模型`:`Fallback models`,summary:a?`已配置 ${i.fallbacks.length} 个备用模型`:`${i.fallbacks.length} fallback models configured`,children:(0,Q.jsx)(ke,{primary:i.primary,value:i.fallbacks,models:D,loading:O.isLoading,error:O.error,zh:a,onChange:e=>l({...i,fallbacks:e})})})]}):null,t[61]=D,t[62]=p,t[63]=n,t[64]=f,t[65]=S,t[66]=l,t[67]=O,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 He(e){return e.vision}function Ue(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}function We(e){let t=(0,Z.c)(88),{agentId:n,avatar:r,zh:i,disabled:a,pending:o,onPendingChange:s,onReadingChange:c,onChange:l}=e,[u,d]=(0,X.useState)(!1),p=(0,X.useRef)(null),m=(0,X.useRef)(null),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(null),y,b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>()=>m.current?.abort(),b=[],t[0]=y,t[1]=b):(y=t[0],b=t[1]),(0,X.useEffect)(y,b);let x=i?`自动头像`:`Automatic`,S;t[2]===x?S=t[3]:(S={value:``,label:x},t[2]=x,t[3]=S);let C=i?`Loopi · 平静`:`Loopi · Calm`,w;t[4]===C?w=t[5]:(w={value:`xopc:loopi:idle`,label:C},t[4]=C,t[5]=w);let T=i?`Loopi · 温暖`:`Loopi · Warm`,E;t[6]===T?E=t[7]:(E={value:`xopc:loopi:care`,label:T},t[6]=T,t[7]=E);let D=i?`Loopi · 好奇`:`Loopi · Curious`,O;t[8]===D?O=t[9]:(O={value:`xopc:loopi:curious`,label:D},t[8]=D,t[9]=O);let k=i?`Loopi · 倾听`:`Loopi · Listening`,A;t[10]===k?A=t[11]:(A={value:`xopc:loopi:listen`,label:k},t[10]=k,t[11]=A);let j;t[12]===n?j=t[13]:(j=U(`bottts`,n),t[12]=n,t[13]=j);let M=i?`机器人`:`Robot`,N;t[14]!==j||t[15]!==M?(N={value:j,label:M},t[14]=j,t[15]=M,t[16]=N):N=t[16];let P;t[17]===n?P=t[18]:(P=U(`adventurer`,n),t[17]=n,t[18]=P);let F=i?`插画人物`:`Illustration`,I;t[19]!==P||t[20]!==F?(I={value:P,label:F},t[19]=P,t[20]=F,t[21]=I):I=t[21];let L;t[22]!==O||t[23]!==A||t[24]!==N||t[25]!==I||t[26]!==S||t[27]!==w||t[28]!==E?(L=[S,w,E,O,A,N,I],t[22]=O,t[23]=A,t[24]=N,t[25]=I,t[26]=S,t[27]=w,t[28]=E,t[29]=L):L=t[29];let B=L,V=B.find(e=>e.value===(r??``))?.label??(i?`自定义头像`:`Custom avatar`),H;t[30]!==l||t[31]!==s||t[32]!==c||t[33]!==i?(H=e=>{if(!e)return;if(v(null),![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){v(i?`请选择 PNG、JPG 或 WebP 图片。`:`Choose a PNG, JPG, or WebP image.`);return}if(!e.size||e.size>524288){v(i?`图片不能为空,且不能超过 512 KB。`:`The image must be non-empty and at most 512 KB.`);return}g(!0),c(!0);let t=new FileReader;m.current=t;let n=()=>{g(!1),c(!1),m.current=null};t.onload=()=>{let r=String(t.result);s({base64:r.slice(r.indexOf(`,`)+1),mimeType:e.type,preview:r}),l(z),n()},t.onerror=()=>{v(i?`图片读取失败,请重新选择。`:`Could not read the image. Choose it again.`),n()},t.readAsDataURL(e)},t[30]=l,t[31]=s,t[32]=c,t[33]=i,t[34]=H):H=t[34];let W=H,G;t[35]===W?G=t[36]:(G=(0,Q.jsx)(`input`,{ref:p,type:`file`,accept:`image/png,image/jpeg,image/webp`,hidden:!0,onChange:e=>{W(e.target.files?.[0]),e.target.value=``}}),t[35]=W,t[36]=G);let K=a||h,te;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(te=()=>p.current?.click(),t[37]=te):te=t[37];let q=i?`上传头像`:`Upload avatar`,ne=`avatar-help-${n}`,re;t[38]!==n||t[39]!==r||t[40]!==o?(re=o?(0,Q.jsx)(`img`,{src:o.preview,alt:``,width:64,height:64,className:`size-full object-cover`}):(0,Q.jsx)(ee,{agentId:n,avatar:r,size:64}),t[38]=n,t[39]=r,t[40]=o,t[41]=re):re=t[41];let ie;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Q.jsx)(`span`,{className:`absolute inset-x-0 bottom-0 flex h-5 items-center justify-center bg-black/55 text-white`,children:(0,Q.jsx)(R,{className:`size-3`,"aria-hidden":!0})}),t[42]=ie):ie=t[42];let ae;t[43]!==K||t[44]!==q||t[45]!==ne||t[46]!==re?(ae=(0,Q.jsxs)(`button`,{type:`button`,disabled:K,onClick:te,"aria-label":q,"aria-describedby":ne,className:`group relative size-16 shrink-0 overflow-hidden rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:opacity-50`,children:[re,ie]}),t[43]=K,t[44]=q,t[45]=ne,t[46]=re,t[47]=ae):ae=t[47];let oe=i?`头像`:`Avatar`,Y;t[48]===oe?Y=t[49]:(Y=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:oe}),t[48]=oe,t[49]=Y);let se=h?i?`正在读取图片…`:`Reading image…`:o?i?`新头像 · 保存后生效`:`New avatar · save to apply`:V,ce;t[50]===se?ce=t[51]:(ce=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:se}),t[50]=se,t[51]=ce);let le=`avatar-help-${n}`,ue=i?`点击头像上传 · PNG、JPG、WebP · 最大 512 KB`:`Click to upload · PNG, JPG, WebP · Max 512 KB`,de;t[52]!==le||t[53]!==ue?(de=(0,Q.jsx)(`p`,{id:le,className:`mt-1 text-xs text-fg-muted`,children:ue}),t[52]=le,t[53]=ue,t[54]=de):de=t[54];let fe;t[55]!==Y||t[56]!==ce||t[57]!==de?(fe=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[Y,ce,de]}),t[55]=Y,t[56]=ce,t[57]=de,t[58]=fe):fe=t[58];let pe=a||h,me=`avatar-options-${n}`,he;t[59]===u?he=t[60]:(he=()=>d(!u),t[59]=u,t[60]=he);let ge=u?i?`收起选择`:`Hide choices`:i?`默认头像`:`Built-in avatars`,_e;t[61]!==u||t[62]!==pe||t[63]!==me||t[64]!==he||t[65]!==ge?(_e=(0,Q.jsx)(J,{variant:`ghost`,disabled:pe,"aria-expanded":u,"aria-controls":me,onClick:he,children:ge}),t[61]=u,t[62]=pe,t[63]=me,t[64]=he,t[65]=ge,t[66]=_e):_e=t[66];let ve;t[67]!==G||t[68]!==ae||t[69]!==fe||t[70]!==_e?(ve=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[G,ae,fe,_e]}),t[67]=G,t[68]=ae,t[69]=fe,t[70]=_e,t[71]=ve):ve=t[71];let ye;t[72]!==n||t[73]!==r||t[74]!==u||t[75]!==a||t[76]!==l||t[77]!==s||t[78]!==B||t[79]!==h||t[80]!==i?(ye=u?(0,Q.jsx)(`div`,{id:`avatar-options-${n}`,className:`grid grid-cols-3 gap-2 sm:grid-cols-4`,role:`group`,"aria-label":i?`选择头像`:`Choose avatar`,children:B.map(e=>(0,Q.jsxs)(`button`,{type:`button`,disabled:a||h,"aria-pressed":(r??``)===e.value,onClick:()=>{s(null),l(e.value),v(null)},className:f(`flex min-h-24 flex-col items-center gap-2 rounded-xl border p-3 text-xs transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,(r??``)===e.value?`border-accent bg-accent-soft text-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover`),children:[(0,Q.jsx)(ee,{agentId:n,avatar:e.value,size:44}),e.label]},e.value))}):null,t[72]=n,t[73]=r,t[74]=u,t[75]=a,t[76]=l,t[77]=s,t[78]=B,t[79]=h,t[80]=i,t[81]=ye):ye=t[81];let be;t[82]===_?be=t[83]:(be=_?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:_}):null,t[82]=_,t[83]=be);let xe;return t[84]!==ve||t[85]!==ye||t[86]!==be?(xe=(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[ve,ye,be]}),t[84]=ve,t[85]=ye,t[86]=be,t[87]=xe):xe=t[87],xe}var Ge={version:1,domains:[],taskTypes:[],inputKinds:[],outputKinds:[],specialties:[],examples:[],limitations:[]},Ke=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,qe=e=>e.split(`
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:``}],Ne=[{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(),Pe=()=>i(()=>import(`./block-editor-ClgTc5v8.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])),Fe=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([59,1,55,5,60,61,3])),Ie=(0,X.lazy)(()=>Pe().then(e=>({default:e.BlockEditor}))),Le=(0,X.lazy)(()=>Fe().then(e=>({default:e.MarkdownEditor})));function Re(){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)(q,{className:`h-8 w-52`}),(0,Q.jsx)(q,{className:`h-4 w-full`}),(0,Q.jsx)(q,{className:`h-4 w-4/5`}),(0,Q.jsx)(q,{className:`h-4 w-11/12`})]}),e[0]=t):t=e[0],t}var ze=(0,X.forwardRef)(function({agentId:e,file:t,zh:n,onDirtyChange:r},i){let a=pe(e=>e.resolved===`dark`),[o,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(``),[p,m]=(0,X.useState)(!0),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(null),[x,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(!1),[T,E]=(0,X.useState)(null),[D,k]=(0,X.useState)(`direct`);(0,X.useEffect)(()=>{let n=!1;return m(!0),g(!1),b(null),l(``),d(``),S(!1),E(null),(async()=>{try{let r=await O(e),i=new Set(r.files.filter(e=>!e.missing).map(e=>e.name)).has(t)?await M(e,t):``;if(n)return;l(i),d(i)}catch(e){if(n)return;g(!0),b(e instanceof Error?e.message:String(e))}finally{n||m(!1)}})(),()=>{n=!0}},[e,t]);let A=o!==u;(0,X.useEffect)(()=>r(A),[A,r]);let j=(0,X.useCallback)(async()=>{if(A){v(!0),b(null);try{await N(e,t,o),d(o),S(!0),E(null)}catch(e){throw b(e instanceof Error?e.message:String(e)),e}finally{v(!1)}}},[e,t,A,o]);(0,X.useImperativeHandle)(i,()=>({save:j}),[j]);let P={"SOUL.md":{label:n?`个性与边界`:`Personality & boundaries`,description:n?`定义语气、价值观、行为原则与安全边界。`:`Tone, values, behavior principles, and safety boundaries.`},"TOOLS.md":{label:n?`工具使用约定`:`Tool guidance`,description:n?`补充工具偏好和使用约定,不负责授予权限。`:`Tool preferences and conventions; this does not grant access.`},"AGENTS.md":{label:n?`工作规范`:`Working instructions`,description:n?`该智能体长期遵循的协作和执行规范。`:`Persistent collaboration and execution instructions.`}},F=[ce,le,V,Y],L=Ae(o).body;return(0,Q.jsx)(`div`,{className:`space-y-5`,children:(0,Q.jsx)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:(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)(`h4`,{className:`text-sm font-semibold text-fg`,children:P[t].label}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:P[t].description})]}),(0,Q.jsx)(I,{className:`flex rounded-lg bg-surface-hover p-1`,role:`group`,"aria-label":n?`编辑模式`:`Editor mode`,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`direct`,Y,n?`直接编辑`:`Visual`],[`source`,V,`Markdown`],[`preview`,s,n?`预览`:`Preview`]].map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>k(e),"aria-pressed":D===e,className:f(`inline-flex min-h-9 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,D===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))})]}),t===`SOUL.md`&&!p?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:h,"aria-expanded":C,onClick:()=>w(!C),className:`text-xs font-medium text-accent hover:underline`,children:n?`使用模板`:`Use a template`}),T===null?null:(0,Q.jsx)(`button`,{type:`button`,className:`ml-3 text-xs text-accent hover:underline`,onClick:()=>{l(T),E(null)},children:n?`撤销模板替换`:`Undo template replacement`}),C?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`my-2 text-xs text-fg-muted`,children:n?`模板会替换当前个性正文,保存前可以撤销。`:`A template replaces the personality text. You can undo before saving.`}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:Me.map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{e.content&&(E(o),l(t=>je(t,e.content))),k(`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)(F[t]??ue,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),n?e.labelZh:e.labelEn]},e.id))})]}):null]}):null,y?(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:y}):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`,children:p?(0,Q.jsx)(Re,{}):h?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-fg-muted`,children:n?`无法加载角色配置,未对文件进行任何更改。`:`Profile documents could not be loaded. No files were changed.`}):D===`direct`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(Re,{}),children:(0,Q.jsx)(Ie,{initialContent:L,onChange:e=>l(t=>je(t,e)),placeholder:n?`直接输入内容,或输入 / 使用快捷命令…`:`Start writing, or type / for commands…`},`${e}-${t}-direct`)}):D===`source`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(Re,{}),children:(0,Q.jsx)(Le,{initialContent:o,onChange:e=>l(e),isDark:a,lineWrap:!0,className:`min-h-0 flex-1`},`${e}-${t}-source`)}):(0,Q.jsx)(`div`,{className:`h-full overflow-y-auto p-5`,children:L.trim()?(0,Q.jsx)(c,{content:L}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:n?`暂无内容。`:`No content yet.`})})}),(0,Q.jsx)(`div`,{className:`mt-2 flex justify-end text-xs text-fg-muted`,"aria-live":`polite`,children:_?n?`正在保存角色配置…`:`Saving profile documents…`:A?n?`角色配置有未保存的更改`:`Profile documents have unsaved changes`:x?n?`文档更改已保存`:`Document changes saved`:n?`未修改`:`No changes`})]})})})});function Be(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 Ve(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=C(p&&f!==`image`?E:null,T,m),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[1]=g):g=t[1];let _=C(p&&f===`image`?`agent-defaults-image-models`:null,Oe,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(Ue),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,w;t[10]!==f||t[11]!==S?(w=f===`vision`?S.filter(He):S,t[10]=f,t[11]=S,t[12]=w):w=t[12];let D=w,O=f===`image`?_:h,k;t[13]===n?k=t[14]:(k=(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[13]=n,t[14]=k);let A;t[15]!==i||t[16]!==a?(A=i===void 0?(0,Q.jsx)(Be,{children:a?`继承全局`:`Inherited globally`}):null,t[15]=i,t[16]=a,t[17]=A):A=t[17];let j;t[18]!==d||t[19]!==i||t[20]!==a?(j=i===null?(0,Q.jsx)(Be,{children:d?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[18]=d,t[19]=i,t[20]=a,t[21]=j):j=t[21];let M;t[22]!==k||t[23]!==A||t[24]!==j?(M=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[k,A,j]}),t[22]=k,t[23]=A,t[24]=j,t[25]=M):M=t[25];let N;t[26]!==r?.primary||t[27]!==i||t[28]!==a?(N=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]=N):N=t[29];let P;t[30]!==M||t[31]!==N?(P=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[M,N]}),t[30]=M,t[31]=N,t[32]=P):P=t[32];let I;t[33]!==l||t[34]!==i||t[35]!==a?(I=i===void 0?null:(0,Q.jsx)(J,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(void 0),children:a?`继承全局`:`Inherit globally`}),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)(J,{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)(J,{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)(J,{className:`px-2 py-1 text-xs`,onClick:()=>l({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`单独设置`:`Override for this agent`}),t[47]=p,t[48]=r?.fallbacks,t[49]=r?.primary,t[50]=l,t[51]=a,t[52]=z):z=t[52];let V;t[53]!==I||t[54]!==L||t[55]!==R||t[56]!==z?(V=(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]=V):V=t[57];let H;t[58]!==P||t[59]!==V?(H=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[P,V]}),t[58]=P,t[59]=V,t[60]=H):H=t[60];let U;t[61]!==D||t[62]!==p||t[63]!==n||t[64]!==f||t[65]!==S||t[66]!==l||t[67]!==O||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`}),O.isLoading?(0,Q.jsx)(q,{className:`mt-1.5 h-11 w-full rounded-lg`}):(0,Q.jsx)(F,{value:i.primary,models:S,modelsLoading:O.isLoading,modelsError:O.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)(B,{title:a?`备用模型`:`Fallback models`,summary:a?`已配置 ${i.fallbacks.length} 个备用模型`:`${i.fallbacks.length} fallback models configured`,children:(0,Q.jsx)(ke,{primary:i.primary,value:i.fallbacks,models:D,loading:O.isLoading,error:O.error,zh:a,onChange:e=>l({...i,fallbacks:e})})})]}):null,t[61]=D,t[62]=p,t[63]=n,t[64]=f,t[65]=S,t[66]=l,t[67]=O,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 He(e){return e.vision}function Ue(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}function We(e){let t=(0,Z.c)(88),{agentId:n,avatar:r,zh:i,disabled:a,pending:o,onPendingChange:s,onReadingChange:c,onChange:l}=e,[u,d]=(0,X.useState)(!1),p=(0,X.useRef)(null),m=(0,X.useRef)(null),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(null),y,b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>()=>m.current?.abort(),b=[],t[0]=y,t[1]=b):(y=t[0],b=t[1]),(0,X.useEffect)(y,b);let x=i?`自动头像`:`Automatic`,S;t[2]===x?S=t[3]:(S={value:``,label:x},t[2]=x,t[3]=S);let C=i?`Loopi · 平静`:`Loopi · Calm`,w;t[4]===C?w=t[5]:(w={value:`xopc:loopi:idle`,label:C},t[4]=C,t[5]=w);let T=i?`Loopi · 温暖`:`Loopi · Warm`,E;t[6]===T?E=t[7]:(E={value:`xopc:loopi:care`,label:T},t[6]=T,t[7]=E);let D=i?`Loopi · 好奇`:`Loopi · Curious`,O;t[8]===D?O=t[9]:(O={value:`xopc:loopi:curious`,label:D},t[8]=D,t[9]=O);let k=i?`Loopi · 倾听`:`Loopi · Listening`,A;t[10]===k?A=t[11]:(A={value:`xopc:loopi:listen`,label:k},t[10]=k,t[11]=A);let j;t[12]===n?j=t[13]:(j=U(`bottts`,n),t[12]=n,t[13]=j);let M=i?`机器人`:`Robot`,N;t[14]!==j||t[15]!==M?(N={value:j,label:M},t[14]=j,t[15]=M,t[16]=N):N=t[16];let P;t[17]===n?P=t[18]:(P=U(`adventurer`,n),t[17]=n,t[18]=P);let F=i?`插画人物`:`Illustration`,I;t[19]!==P||t[20]!==F?(I={value:P,label:F},t[19]=P,t[20]=F,t[21]=I):I=t[21];let L;t[22]!==O||t[23]!==A||t[24]!==N||t[25]!==I||t[26]!==S||t[27]!==w||t[28]!==E?(L=[S,w,E,O,A,N,I],t[22]=O,t[23]=A,t[24]=N,t[25]=I,t[26]=S,t[27]=w,t[28]=E,t[29]=L):L=t[29];let B=L,V=B.find(e=>e.value===(r??``))?.label??(i?`自定义头像`:`Custom avatar`),H;t[30]!==l||t[31]!==s||t[32]!==c||t[33]!==i?(H=e=>{if(!e)return;if(v(null),![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){v(i?`请选择 PNG、JPG 或 WebP 图片。`:`Choose a PNG, JPG, or WebP image.`);return}if(!e.size||e.size>524288){v(i?`图片不能为空,且不能超过 512 KB。`:`The image must be non-empty and at most 512 KB.`);return}g(!0),c(!0);let t=new FileReader;m.current=t;let n=()=>{g(!1),c(!1),m.current=null};t.onload=()=>{let r=String(t.result);s({base64:r.slice(r.indexOf(`,`)+1),mimeType:e.type,preview:r}),l(z),n()},t.onerror=()=>{v(i?`图片读取失败,请重新选择。`:`Could not read the image. Choose it again.`),n()},t.readAsDataURL(e)},t[30]=l,t[31]=s,t[32]=c,t[33]=i,t[34]=H):H=t[34];let W=H,G;t[35]===W?G=t[36]:(G=(0,Q.jsx)(`input`,{ref:p,type:`file`,accept:`image/png,image/jpeg,image/webp`,hidden:!0,onChange:e=>{W(e.target.files?.[0]),e.target.value=``}}),t[35]=W,t[36]=G);let K=a||h,te;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(te=()=>p.current?.click(),t[37]=te):te=t[37];let q=i?`上传头像`:`Upload avatar`,ne=`avatar-help-${n}`,re;t[38]!==n||t[39]!==r||t[40]!==o?(re=o?(0,Q.jsx)(`img`,{src:o.preview,alt:``,width:64,height:64,className:`size-full object-cover`}):(0,Q.jsx)(ee,{agentId:n,avatar:r,size:64}),t[38]=n,t[39]=r,t[40]=o,t[41]=re):re=t[41];let ie;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Q.jsx)(`span`,{className:`absolute inset-x-0 bottom-0 flex h-5 items-center justify-center bg-black/55 text-white`,children:(0,Q.jsx)(R,{className:`size-3`,"aria-hidden":!0})}),t[42]=ie):ie=t[42];let ae;t[43]!==K||t[44]!==q||t[45]!==ne||t[46]!==re?(ae=(0,Q.jsxs)(`button`,{type:`button`,disabled:K,onClick:te,"aria-label":q,"aria-describedby":ne,className:`group relative size-16 shrink-0 overflow-hidden rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:opacity-50`,children:[re,ie]}),t[43]=K,t[44]=q,t[45]=ne,t[46]=re,t[47]=ae):ae=t[47];let oe=i?`头像`:`Avatar`,Y;t[48]===oe?Y=t[49]:(Y=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:oe}),t[48]=oe,t[49]=Y);let se=h?i?`正在读取图片…`:`Reading image…`:o?i?`新头像 · 保存后生效`:`New avatar · save to apply`:V,ce;t[50]===se?ce=t[51]:(ce=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:se}),t[50]=se,t[51]=ce);let le=`avatar-help-${n}`,ue=i?`点击头像上传 · PNG、JPG、WebP · 最大 512 KB`:`Click to upload · PNG, JPG, WebP · Max 512 KB`,de;t[52]!==le||t[53]!==ue?(de=(0,Q.jsx)(`p`,{id:le,className:`mt-1 text-xs text-fg-muted`,children:ue}),t[52]=le,t[53]=ue,t[54]=de):de=t[54];let fe;t[55]!==Y||t[56]!==ce||t[57]!==de?(fe=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[Y,ce,de]}),t[55]=Y,t[56]=ce,t[57]=de,t[58]=fe):fe=t[58];let pe=a||h,me=`avatar-options-${n}`,he;t[59]===u?he=t[60]:(he=()=>d(!u),t[59]=u,t[60]=he);let ge=u?i?`收起选择`:`Hide choices`:i?`默认头像`:`Built-in avatars`,_e;t[61]!==u||t[62]!==pe||t[63]!==me||t[64]!==he||t[65]!==ge?(_e=(0,Q.jsx)(J,{variant:`ghost`,disabled:pe,"aria-expanded":u,"aria-controls":me,onClick:he,children:ge}),t[61]=u,t[62]=pe,t[63]=me,t[64]=he,t[65]=ge,t[66]=_e):_e=t[66];let ve;t[67]!==G||t[68]!==ae||t[69]!==fe||t[70]!==_e?(ve=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[G,ae,fe,_e]}),t[67]=G,t[68]=ae,t[69]=fe,t[70]=_e,t[71]=ve):ve=t[71];let ye;t[72]!==n||t[73]!==r||t[74]!==u||t[75]!==a||t[76]!==l||t[77]!==s||t[78]!==B||t[79]!==h||t[80]!==i?(ye=u?(0,Q.jsx)(`div`,{id:`avatar-options-${n}`,className:`grid grid-cols-3 gap-2 sm:grid-cols-4`,role:`group`,"aria-label":i?`选择头像`:`Choose avatar`,children:B.map(e=>(0,Q.jsxs)(`button`,{type:`button`,disabled:a||h,"aria-pressed":(r??``)===e.value,onClick:()=>{s(null),l(e.value),v(null)},className:f(`flex min-h-24 flex-col items-center gap-2 rounded-xl border p-3 text-xs transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,(r??``)===e.value?`border-accent bg-accent-soft text-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover`),children:[(0,Q.jsx)(ee,{agentId:n,avatar:e.value,size:44}),e.label]},e.value))}):null,t[72]=n,t[73]=r,t[74]=u,t[75]=a,t[76]=l,t[77]=s,t[78]=B,t[79]=h,t[80]=i,t[81]=ye):ye=t[81];let be;t[82]===_?be=t[83]:(be=_?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:_}):null,t[82]=_,t[83]=be);let xe;return t[84]!==ve||t[85]!==ye||t[86]!==be?(xe=(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[ve,ye,be]}),t[84]=ve,t[85]=ye,t[86]=be,t[87]=xe):xe=t[87],xe}var Ge={version:1,domains:[],taskTypes:[],inputKinds:[],outputKinds:[],specialties:[],examples:[],limitations:[]},Ke=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,qe=e=>e.split(`
67
67
  `).map(e=>e.trim()).filter(Boolean);function Je(e){let t=(0,Z.c)(21),{value:n,label:r,hint:i,onChange:a,max:o}=e,s;t[0]===n?s=t[1]:(s=n.join(`
68
68
  `),t[0]=n,t[1]=s);let[c,l]=(0,X.useState)(s),u,d;t[2]!==c||t[3]!==n?(u=()=>{JSON.stringify(qe(c))!==JSON.stringify(n)&&l(n.join(`
69
69
  `))},d=[n,c],t[2]=c,t[3]=n,t[4]=u,t[5]=d):(u=t[4],d=t[5]),(0,X.useEffect)(u,d);let f;t[6]===a?f=t[7]:(f=e=>{l(e.target.value),a(qe(e.target.value))},t[6]=a,t[7]=f);let p;t[8]!==i||t[9]!==f||t[10]!==c?(p=(0,Q.jsx)(`textarea`,{rows:3,className:Ke,value:c,placeholder:i,onChange:f}),t[8]=i,t[9]=f,t[10]=c,t[11]=p):p=t[11];let m;t[12]===c?m=t[13]:(m=qe(c),t[12]=c,t[13]=m);let h;t[14]!==o||t[15]!==m.length?(h=(0,Q.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[m.length,`/`,o]}),t[14]=o,t[15]=m.length,t[16]=h):h=t[16];let g;return t[17]!==r||t[18]!==p||t[19]!==h?(g=(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[r,p,h]}),t[17]=r,t[18]=p,t[19]=h,t[20]=g):g=t[20],g}var Ye={general:`通用`,coordination:`协调`,software:`软件开发`,writing:`写作`,research:`研究`,data:`数据`,design:`设计`,operations:`运营`,general_assistance:`日常协助`,task_planning:`任务规划`,bug_fix:`修复 Bug`,implementation:`功能开发`,code_review:`代码审查`,editing:`编辑润色`,news_research:`新闻研究`,data_analysis:`数据分析`,data_cleaning:`数据清洗`,image_generation:`生成图片`,automation:`自动化`,text:`文本`,repository:`代码仓库`,csv:`CSV`,spreadsheet:`电子表格`,web_page:`网页`,image:`图片`,answer:`回答`,plan:`计划`,code_patch:`代码修改`,document:`文档`,report:`报告`,chart:`图表`,script:`脚本`,design_brief:`设计说明`};function Xe(e){let t=(0,Z.c)(48),{field:n,value:r,label:i,zh:a,onChange:o}=e,s=S[n],c;if(t[0]!==r||t[1]!==s){let e;t[3]===s?e=t[4]:(e=e=>!s.includes(e),t[3]=s,t[4]=e),c=r.filter(e),t[0]=r,t[1]=s,t[2]=c}else c=t[2];let l=c,u;t[5]===a?u=t[6]:(u=e=>a?Ye[e]??e:e.replaceAll(`_`,` `),t[5]=a,t[6]=u);let d=u,f;t[7]!==d||t[8]!==r||t[9]!==a?(f=r.length?r.map(d).join(` · `):a?`选择适用项`:`Select applicable items`,t[7]=d,t[8]=r,t[9]=a,t[10]=f):f=t[10];let p;t[11]===f?p=t[12]:(p=(0,Q.jsx)(`span`,{className:`mt-1 block text-xs font-normal text-fg-muted`,children:f}),t[11]=f,t[12]=p);let m;t[13]!==i||t[14]!==p?(m=(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[i,p]}),t[13]=i,t[14]=p,t[15]=m):m=t[15];let h;if(t[16]!==d||t[17]!==r||t[18]!==s){let e;t[20]!==d||t[21]!==r?(e=e=>({value:e,label:d(e),disabled:r.length>=16&&!r.includes(e)}),t[20]=d,t[21]=r,t[22]=e):e=t[22],h=s.map(e),t[16]=d,t[17]=r,t[18]=s,t[19]=h}else h=t[19];let g;t[23]!==i||t[24]!==o||t[25]!==h||t[26]!==r?(g=(0,Q.jsx)(_e,{options:h,values:r,multiple:!0,ariaLabel:i,onChange:o}),t[23]=i,t[24]=o,t[25]=h,t[26]=r,t[27]=g):g=t[27];let _=a?`自定义标识`:`Custom identifiers`,v;t[28]===_?v=t[29]:(v=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:_}),t[28]=_,t[29]=v);let y=a?`其他标识`:`Other identifiers`,b=a?`每行一个英文标识`:`One identifier per line`,x;t[30]!==o||t[31]!==r||t[32]!==s?(x=e=>o([...new Set([...r.filter(e=>s.includes(e)),...e])]),t[30]=o,t[31]=r,t[32]=s,t[33]=x):x=t[33];let C;t[34]!==l||t[35]!==y||t[36]!==b||t[37]!==x?(C=(0,Q.jsx)(Je,{value:l,label:y,hint:b,max:16,onChange:x}),t[34]=l,t[35]=y,t[36]=b,t[37]=x,t[38]=C):C=t[38];let w;t[39]!==C||t[40]!==v?(w=(0,Q.jsxs)(`details`,{children:[v,C]}),t[39]=C,t[40]=v,t[41]=w):w=t[41];let T;t[42]!==w||t[43]!==g?(T=(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[g,w]}),t[42]=w,t[43]=g,t[44]=T):T=t[44];let E;return t[45]!==T||t[46]!==m?(E=(0,Q.jsxs)(`details`,{className:`min-w-0 rounded-xl border border-edge p-3`,children:[m,T]}),t[45]=T,t[46]=m,t[47]=E):E=t[47],E}function Ze(e){let t=(0,Z.c)(45),{profile:n,zh:r,onChange:i}=e,a=r?`领域`:`Domains`,o;t[0]===a?o=t[1]:(o=[`domains`,a,`software
@@ -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-DPxcWxfD.js";import{t as o}from"./cn-0WouolD0.js";import{a as s,n as c,r as l}from"./locale-store-Djl2FW6_.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{Dn as v,Eu as y,Ic as b,Rc as x,Wc as S,Wu as C,no as w,os as T,vs as E,ys as D}from"./index-BNRLzxpH.js";import{n as O,r as k}from"./settings-page-layout-Dx5S-Msc.js";import{r as A,t as j}from"./settings-form-section-Bqm1IKvR.js";var M=n(),N=e(t(),1),P=r();function F(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 I(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 L(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 R={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function z({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,N.useReducer)(w,R),{info:s,loadError:c,actionError:l,copiedField:_,clearDialogOpen:x,clearConfirmChecked:T,clearConfirmText:O,uninstallDialogOpen:k,removeUserDataOnUninstall:A,busy:M}=r,z=(0,N.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,N.useEffect)(()=>{z()},[z]);let B=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}})},V=async()=>{if(!(!e?.clearUserData||M)){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:I(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},H=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:A});n.ok||a({type:`patch`,patch:{actionError:I(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,P.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,P.jsx)(v,{rows:2});let U=!s.packaged,W=M||s.pendingUpdate||U,G=!U&&s.uninstallMode!==`unsupported`,K=L(s,t),q=T&&O.trim()===t.clearDataConfirmPhrase;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(j,{children:[n?(0,P.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,P.jsx)(y,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,P.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,U?(0,P.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,P.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,P.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,P.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,P.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,P.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`,b.press),onClick:()=>void B(s.appPath,`app`),children:[(0,P.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`app`?t.copied:t.copyPath]})]})]}),(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,P.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,P.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,P.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`,b.press),onClick:()=>void B(s.dataPath,`data`),children:[(0,P.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`data`?t.copied:t.copyPath]})]}),(0,P.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,F(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,P.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,P.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,P.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,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,P.jsx)(`button`,{type:`button`,disabled:W,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`,b.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),G?(0,P.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,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:K})]}),(0,P.jsx)(`button`,{type:`button`,disabled:W,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`,b.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,P.jsx)(h,{open:x,onOpenChange:e=>{!e&&!M&&a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,P.jsxs)(f,{children:[(0,P.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,D)}),(0,P.jsxs)(p,{className:o(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(30rem,calc(100dvh-2rem))] w-[min(100%-2rem,28rem)] flex-col overflow-hidden -translate-x-1/2 -translate-y-1/2`,E,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),onEscapeKeyDown:e=>{M&&e.preventDefault()},onInteractOutside:e=>{M&&e.preventDefault()},"aria-busy":M,children:[(0,P.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,P.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,P.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,P.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,disabled:M,checked:T,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,P.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,P.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,P.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,P.jsx)(`input`,{id:`clear-data-confirm`,disabled:M,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:O,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),M?(0,P.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-live":`polite`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.clearDataProgress}),(0,P.jsx)(`div`,{role:`progressbar`,"aria-label":t.clearDataProgress,className:`h-1.5 overflow-hidden rounded-full bg-surface-active`,children:(0,P.jsx)(`div`,{className:`xopc-clear-data-progress h-full w-1/3 rounded-full bg-accent`})}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataProgressHint})]}):(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]})]}),(0,P.jsxs)(`div`,{className:`mt-6 flex shrink-0 justify-end gap-2`,children:[(0,P.jsx)(S,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,P.jsxs)(S,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:M||!q,onClick:()=>void V(),children:[M?(0,P.jsx)(C,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):null,M?t.clearDataProgress:t.confirmClear]})]})]})]})}),G?(0,P.jsx)(h,{open:k,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,P.jsxs)(f,{children:[(0,P.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,D)}),(0,P.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`,E,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,P.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:K}),(0,P.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:A,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,P.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),A?(0,P.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,P.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,P.jsx)(S,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,P.jsx)(S,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:M,onClick:()=>void H(),children:t.confirmUninstall})]})]})]})}):null]})}async function B(){return(await s(l(`/api/migrations/status`))).payload}async function V(){await s(l(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function H({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=_(`settings-migration-status`,B,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(null);async function l(){o(!0),c(null);try{await V(),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,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":`true`,children:[(0,P.jsx)(x,{className:`h-5 w-40 max-w-full`}),(0,P.jsx)(x,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,P.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,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,P.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,P.jsx)(S,{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,P.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,P.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,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,P.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function U(){let e=(0,M.c)(28),t=c(W),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(!T()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,P.jsx)(O,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,P.jsx)(H,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=A(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,P.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,P.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,P.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,P.jsxs)(k,{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,P.jsx)(O,{title:i.title}),e[18]=i.title,e[19]=s);let l;e[20]===i.migrations?l=e[21]:(l=(0,P.jsx)(H,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,P.jsx)(z,{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,P.jsxs)(k,{gap:`gap-6`,children:[s,l,u]}),e[24]=s,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function W(e){return e.language}export{U 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-DPxcWxfD.js";import{t as o}from"./cn-0WouolD0.js";import{a as s,n as c,r as l}from"./locale-store-Djl2FW6_.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{Dn as v,Eu as y,Ic as b,Rc as x,Wc as S,Wu as C,no as w,os as T,vs as E,ys as D}from"./index-Dsp_gNdl.js";import{n as O,r as k}from"./settings-page-layout-Dx5S-Msc.js";import{r as A,t as j}from"./settings-form-section-B3eODxNv.js";var M=n(),N=e(t(),1),P=r();function F(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 I(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 L(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 R={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function z({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,N.useReducer)(w,R),{info:s,loadError:c,actionError:l,copiedField:_,clearDialogOpen:x,clearConfirmChecked:T,clearConfirmText:O,uninstallDialogOpen:k,removeUserDataOnUninstall:A,busy:M}=r,z=(0,N.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,N.useEffect)(()=>{z()},[z]);let B=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}})},V=async()=>{if(!(!e?.clearUserData||M)){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:I(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},H=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:A});n.ok||a({type:`patch`,patch:{actionError:I(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,P.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,P.jsx)(v,{rows:2});let U=!s.packaged,W=M||s.pendingUpdate||U,G=!U&&s.uninstallMode!==`unsupported`,K=L(s,t),q=T&&O.trim()===t.clearDataConfirmPhrase;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(j,{children:[n?(0,P.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,P.jsx)(y,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,P.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,U?(0,P.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,P.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,P.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,P.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,P.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,P.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`,b.press),onClick:()=>void B(s.appPath,`app`),children:[(0,P.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`app`?t.copied:t.copyPath]})]})]}),(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,P.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,P.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,P.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`,b.press),onClick:()=>void B(s.dataPath,`data`),children:[(0,P.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`data`?t.copied:t.copyPath]})]}),(0,P.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,F(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,P.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,P.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,P.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,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,P.jsx)(`button`,{type:`button`,disabled:W,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`,b.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),G?(0,P.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,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:K})]}),(0,P.jsx)(`button`,{type:`button`,disabled:W,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`,b.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,P.jsx)(h,{open:x,onOpenChange:e=>{!e&&!M&&a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,P.jsxs)(f,{children:[(0,P.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,D)}),(0,P.jsxs)(p,{className:o(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(30rem,calc(100dvh-2rem))] w-[min(100%-2rem,28rem)] flex-col overflow-hidden -translate-x-1/2 -translate-y-1/2`,E,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),onEscapeKeyDown:e=>{M&&e.preventDefault()},onInteractOutside:e=>{M&&e.preventDefault()},"aria-busy":M,children:[(0,P.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,P.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,P.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,P.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,disabled:M,checked:T,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,P.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,P.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,P.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,P.jsx)(`input`,{id:`clear-data-confirm`,disabled:M,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:O,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),M?(0,P.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-live":`polite`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.clearDataProgress}),(0,P.jsx)(`div`,{role:`progressbar`,"aria-label":t.clearDataProgress,className:`h-1.5 overflow-hidden rounded-full bg-surface-active`,children:(0,P.jsx)(`div`,{className:`xopc-clear-data-progress h-full w-1/3 rounded-full bg-accent`})}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataProgressHint})]}):(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]})]}),(0,P.jsxs)(`div`,{className:`mt-6 flex shrink-0 justify-end gap-2`,children:[(0,P.jsx)(S,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,P.jsxs)(S,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:M||!q,onClick:()=>void V(),children:[M?(0,P.jsx)(C,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):null,M?t.clearDataProgress:t.confirmClear]})]})]})]})}),G?(0,P.jsx)(h,{open:k,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,P.jsxs)(f,{children:[(0,P.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,D)}),(0,P.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`,E,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,P.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:K}),(0,P.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:A,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,P.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),A?(0,P.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,P.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,P.jsx)(S,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,P.jsx)(S,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:M,onClick:()=>void H(),children:t.confirmUninstall})]})]})]})}):null]})}async function B(){return(await s(l(`/api/migrations/status`))).payload}async function V(){await s(l(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function H({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=_(`settings-migration-status`,B,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(null);async function l(){o(!0),c(null);try{await V(),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,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":`true`,children:[(0,P.jsx)(x,{className:`h-5 w-40 max-w-full`}),(0,P.jsx)(x,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,P.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,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,P.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,P.jsx)(S,{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,P.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,P.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,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,P.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function U(){let e=(0,M.c)(28),t=c(W),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(!T()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,P.jsx)(O,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,P.jsx)(H,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=A(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,P.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,P.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,P.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,P.jsxs)(k,{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,P.jsx)(O,{title:i.title}),e[18]=i.title,e[19]=s);let l;e[20]===i.migrations?l=e[21]:(l=(0,P.jsx)(H,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,P.jsx)(z,{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,P.jsxs)(k,{gap:`gap-6`,children:[s,l,u]}),e[24]=s,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function W(e){return e.language}export{U 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{t as i}from"./messages-DPxcWxfD.js";import{t as a}from"./cn-0WouolD0.js";import{a as o,n as s,r as c}from"./locale-store-Djl2FW6_.js";import{n as l,r as u}from"./gateway-config-swr-Di9g6pE8.js";import{Hi as d,Ic as f,Rc as p,ds as m,fs as h,ks as g,ls as _}from"./index-BNRLzxpH.js";import{n as v,r as y}from"./settings-page-layout-Dx5S-Msc.js";import{t as b}from"./settings-advanced-gate-BiySFw1N.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 o(c(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await l()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:o}=e,s;t[0]===o?s=t[1]:(s=a(`min-w-0`,o),t[0]=o,t[1]=s);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]!==s||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,E.jsxs)(`section`,{className:s,children:[c,l,u]}),t[8]=s,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=s(F),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,o=g(P),c=g(N),l;e[2]===r.colorSchemeTitle?l=e[3]:(l=(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]=l);let u;e[4]!==r||e[5]!==o||e[6]!==c?(u=j.map(e=>{let{value:t,labelKey:n}=e,i=o===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>c(t),className:a(`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`,f.pressCard,i?`bg-surface-active shadow-surface`:`hover:bg-surface-hover/60`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:a(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=o,e[6]=c,e[7]=u):u=e[7];let d;e[8]===u?d=e[9]:(d=(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]=d);let p;return e[10]!==l||e[11]!==d?(p=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[l,d]}),e[10]=l,e[11]=d,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=s(L),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:o,isLoading:c}=u(!0),l=o?.payload?.config,d;e[2]===l?d=e[3]:(d=w(l),e[2]=l,e[3]=d);let f=d,[g,_]=(0,x.useState)(f),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===f?(D=e[5],O=e[6]):(D=()=>_(f),O=[f],e[4]=f,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]!==c||e[14]!==g||e[15]!==v?(M=c?(0,E.jsx)(p,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(m,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(h,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(h,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(h,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=c,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:a(`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=s(V),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,a=d(B),o=d(z),c;e[2]===r.showRawToolDataTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=c);let l;e[4]===r.showRawToolDataDescription?l=e[5]:(l=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=l);let u;e[6]!==c||e[7]!==l?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[c,l]}),e[6]=c,e[7]=l,e[8]=u):u=e[8];let f;e[9]===o?f=e[10]:(f=e=>o(e.target.checked),e[9]=o,e[10]=f);let p;e[11]!==a||e[12]!==f?(p=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:a,onChange:f}),e[11]=a,e[12]=f,e[13]=p):p=e[13];let m;return e[14]!==u||e[15]!==p?(m=(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,p]})}),e[14]=u,e[15]=p,e[16]=m):m=e[16],m}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=s(U),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,a;e[2]===r.pageTitle?a=e[3]:(a=(0,E.jsx)(v,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=a);let o;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(D,{children:(0,E.jsx)(_,{variant:`page`,sections:[`language`]})}),e[4]=o):o=e[4];let c;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,E.jsxs)(D,{children:[(0,E.jsx)(_,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=c):c=e[5];let l;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,E.jsx)(R,{}),e[6]=l):l=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:l})}),e[7]=r.developerGroupTitle,e[8]=u);let d;return e[9]!==a||e[10]!==u?(d=(0,E.jsxs)(y,{gap:`gap-6`,children:[a,o,c,u]}),e[9]=a,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{t as i}from"./messages-DPxcWxfD.js";import{t as a}from"./cn-0WouolD0.js";import{a as o,n as s,r as c}from"./locale-store-Djl2FW6_.js";import{n as l,r as u}from"./gateway-config-swr-Di9g6pE8.js";import{Hi as d,Ic as f,Rc as p,ds as m,fs as h,ks as g,ls as _}from"./index-Dsp_gNdl.js";import{n as v,r as y}from"./settings-page-layout-Dx5S-Msc.js";import{t as b}from"./settings-advanced-gate-F1WX7vxq.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 o(c(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await l()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:o}=e,s;t[0]===o?s=t[1]:(s=a(`min-w-0`,o),t[0]=o,t[1]=s);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]!==s||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,E.jsxs)(`section`,{className:s,children:[c,l,u]}),t[8]=s,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=s(F),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,o=g(P),c=g(N),l;e[2]===r.colorSchemeTitle?l=e[3]:(l=(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]=l);let u;e[4]!==r||e[5]!==o||e[6]!==c?(u=j.map(e=>{let{value:t,labelKey:n}=e,i=o===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>c(t),className:a(`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`,f.pressCard,i?`bg-surface-active shadow-surface`:`hover:bg-surface-hover/60`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:a(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=o,e[6]=c,e[7]=u):u=e[7];let d;e[8]===u?d=e[9]:(d=(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]=d);let p;return e[10]!==l||e[11]!==d?(p=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[l,d]}),e[10]=l,e[11]=d,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=s(L),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:o,isLoading:c}=u(!0),l=o?.payload?.config,d;e[2]===l?d=e[3]:(d=w(l),e[2]=l,e[3]=d);let f=d,[g,_]=(0,x.useState)(f),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===f?(D=e[5],O=e[6]):(D=()=>_(f),O=[f],e[4]=f,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]!==c||e[14]!==g||e[15]!==v?(M=c?(0,E.jsx)(p,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(m,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(h,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(h,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(h,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=c,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:a(`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=s(V),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,a=d(B),o=d(z),c;e[2]===r.showRawToolDataTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=c);let l;e[4]===r.showRawToolDataDescription?l=e[5]:(l=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=l);let u;e[6]!==c||e[7]!==l?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[c,l]}),e[6]=c,e[7]=l,e[8]=u):u=e[8];let f;e[9]===o?f=e[10]:(f=e=>o(e.target.checked),e[9]=o,e[10]=f);let p;e[11]!==a||e[12]!==f?(p=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:a,onChange:f}),e[11]=a,e[12]=f,e[13]=p):p=e[13];let m;return e[14]!==u||e[15]!==p?(m=(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,p]})}),e[14]=u,e[15]=p,e[16]=m):m=e[16],m}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=s(U),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,a;e[2]===r.pageTitle?a=e[3]:(a=(0,E.jsx)(v,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=a);let o;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(D,{children:(0,E.jsx)(_,{variant:`page`,sections:[`language`]})}),e[4]=o):o=e[4];let c;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,E.jsxs)(D,{children:[(0,E.jsx)(_,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=c):c=e[5];let l;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,E.jsx)(R,{}),e[6]=l):l=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:l})}),e[7]=r.developerGroupTitle,e[8]=u);let d;return e[9]!==a||e[10]!==u?(d=(0,E.jsxs)(y,{gap:`gap-6`,children:[a,o,c,u]}),e[9]=a,e[10]=u,e[11]=d):d=e[11],d}function U(e){return e.language}export{H as AppearanceSettingsPanel};