@xopcai/xopc 0.0.425 → 0.0.427

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 (448) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/src/adapters/security-adapter.js +1 -1
  3. package/dist/extensions/telegram/src/pairing-config-resolver.js +1 -1
  4. package/dist/extensions/telegram/src/plugin.js +2 -2
  5. package/dist/extensions/telegram/xopc.extension.json +1 -1
  6. package/dist/extensions/weixin/src/api/api.js +1 -1
  7. package/dist/extensions/weixin/src/auth/accounts.js +2 -2
  8. package/dist/extensions/weixin/src/auth/pairing.js +1 -1
  9. package/dist/extensions/weixin/src/cdn/upload.js +1 -1
  10. package/dist/extensions/weixin/src/cli/gateway-qr-login.js +1 -1
  11. package/dist/extensions/weixin/src/cli/qr-login.js +1 -1
  12. package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
  13. package/dist/extensions/weixin/src/messaging/inbound.js +2 -2
  14. package/dist/extensions/weixin/src/messaging/process-message.js +3 -3
  15. package/dist/extensions/weixin/src/messaging/send.js +12 -3
  16. package/dist/extensions/weixin/src/monitor/monitor.js +1 -1
  17. package/dist/extensions/weixin/src/outbound-send.js +12 -3
  18. package/dist/extensions/weixin/src/pairing-config-resolver.js +1 -1
  19. package/dist/extensions/weixin/src/plugin.js +1 -1
  20. package/dist/gateway/static/root/assets/{activity-store-CMw8qBuC.js → activity-store-D_DXNHba.js} +1 -1
  21. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-JI0YWOIm.js → agent-avatar-dicebear-CjaQxFQt.js} +1 -1
  22. package/dist/gateway/static/root/assets/{agent-avatar-display-YqmwzOSa.js → agent-avatar-display-6Z4m31Fz.js} +2 -2
  23. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D4ClP_DJ.js +1 -0
  24. package/dist/gateway/static/root/assets/agent-plugin-dialog-m1A8wF9p.js +1 -0
  25. package/dist/gateway/static/root/assets/agents-B9slUA_1.js +77 -0
  26. package/dist/gateway/static/root/assets/{agents-admin-api-DLnmdC1h.js → agents-admin-api-u5c3GREg.js} +1 -1
  27. package/dist/gateway/static/root/assets/{api-Boc-CVh7.js → api-C3Tp9MkF.js} +1 -1
  28. package/dist/gateway/static/root/assets/{api-bL7sxjAF.js → api-CRT9ZyH0.js} +1 -1
  29. package/dist/gateway/static/root/assets/app-link-DRy3-k7j.js +1 -0
  30. package/dist/gateway/static/root/assets/{app-management-settings-panel-jIG5i7KE.js → app-management-settings-panel-XqoIBF2H.js} +1 -1
  31. package/dist/gateway/static/root/assets/{appearance-settings-BnaQW9Xd.js → appearance-settings-9ZtqCASo.js} +1 -1
  32. package/dist/gateway/static/root/assets/apps-page-DUeu_7iC.js +1 -0
  33. package/dist/gateway/static/root/assets/{archive-plugin-DjboG3kA.js → archive-plugin-BCQnOkV8.js} +1 -1
  34. package/dist/gateway/static/root/assets/attachment-load-DrVGNxJm.js +1 -0
  35. package/dist/gateway/static/root/assets/{automation-api-CZqL9l_d.js → automation-api-hRsGx-qe.js} +1 -1
  36. package/dist/gateway/static/root/assets/{automation-result-state-DRd-X_Ai.js → automation-result-state-CMfVTv_i.js} +1 -1
  37. package/dist/gateway/static/root/assets/automation-task-card-Bur78p68.js +3 -0
  38. package/dist/gateway/static/root/assets/{automations-page-HyBQIfmn.js → automations-page-DMIyWsP0.js} +1 -1
  39. package/dist/gateway/static/root/assets/automations-workspace-DEkDjxeU.js +9 -0
  40. package/dist/gateway/static/root/assets/{binary-plugins-Bg8ARZUH.js → binary-plugins-CIB5cbvQ.js} +1 -1
  41. package/dist/gateway/static/root/assets/{block-editor-DKohqFAW.js → block-editor-CXdlNAmZ.js} +2 -2
  42. package/dist/gateway/static/root/assets/{browser-automation-inputs-YeibTzw4.js → browser-automation-inputs-Fxo7HbK6.js} +1 -1
  43. package/dist/gateway/static/root/assets/{browser-automations-page-BWNcbuz2.js → browser-automations-page-Dn3LN5wo.js} +2 -2
  44. package/dist/gateway/static/root/assets/{browser-control-api-CDeuxy2x.js → browser-control-api-CbbPvhHR.js} +1 -1
  45. package/dist/gateway/static/root/assets/browser-settings-page-Cpm9fEPV.js +3 -0
  46. package/dist/gateway/static/root/assets/{button-CnRSIP6m.js → button-Cc4hUNTt.js} +1 -1
  47. package/dist/gateway/static/root/assets/{capabilities-BcQa8c9n.js → capabilities-BEvywfF9.js} +1 -1
  48. package/dist/gateway/static/root/assets/capabilities-Bo2qEJhH.js +1 -0
  49. package/dist/gateway/static/root/assets/capabilities-page-BCzsIzvC.js +2 -0
  50. package/dist/gateway/static/root/assets/capabilities-settings-panel-Cr67ziwX.js +8 -0
  51. package/dist/gateway/static/root/assets/{capability-header-actions-CTUCuBlW.js → capability-header-actions-BxMYfQ8y.js} +1 -1
  52. package/dist/gateway/static/root/assets/channels-CA5z5dGY.js +1 -0
  53. package/dist/gateway/static/root/assets/{chat-agents-api-B8JO6Tcj.js → chat-agents-api-D8YS5amE.js} +1 -1
  54. package/dist/gateway/static/root/assets/{chat-chart-block-DRtuFfF1.js → chat-chart-block-B39npsXj.js} +1 -1
  55. package/dist/gateway/static/root/assets/chat-page-D92AWJbh.js +72 -0
  56. package/dist/gateway/static/root/assets/{chat-terminal-dock-Dkqq5FSL.js → chat-terminal-dock-DjFnElAM.js} +2 -2
  57. package/dist/gateway/static/root/assets/{command-palette-api-qujvNqkK.js → command-palette-api-Dijix7V6.js} +1 -1
  58. package/dist/gateway/static/root/assets/composer-payload-handoff-BQXlFKf4.js +1 -0
  59. package/dist/gateway/static/root/assets/{computer-settings-page-8q4hRmoo.js → computer-settings-page-MkqyKyf3.js} +1 -1
  60. package/dist/gateway/static/root/assets/confirm-dialog-D7dQJytv.js +1 -0
  61. package/dist/gateway/static/root/assets/connected-providers-grid-BSvKP2u-.js +1 -0
  62. package/dist/gateway/static/root/assets/{connector-service-page-DQaTI21R.js → connector-service-page-DlIl9bLx.js} +1 -1
  63. package/dist/gateway/static/root/assets/{connectors-api-BjypBp2g.js → connectors-api-DEJU8mgn.js} +1 -1
  64. package/dist/gateway/static/root/assets/connectors-page-Vx8-MY0Y.js +1 -0
  65. package/dist/gateway/static/root/assets/{copy-text-row-CYIv7RfP.js → copy-text-row-CpiRzq4G.js} +1 -1
  66. package/dist/gateway/static/root/assets/{date-picker-D_PSHGpe.js → date-picker-BIfjfOTM.js} +1 -1
  67. package/dist/gateway/static/root/assets/dependency-picker-XjPB8FJS.js +1 -0
  68. package/dist/gateway/static/root/assets/{desktop-pet-1Et9VqkM.js → desktop-pet-DFNehTtd.js} +1 -1
  69. package/dist/gateway/static/root/assets/{desktop-pet-narrative-rADKU0FX.js → desktop-pet-narrative-ChwjpnsG.js} +1 -1
  70. package/dist/gateway/static/root/assets/{desktop-pet-settings-0fCGgaG7.js → desktop-pet-settings-BDjsFown.js} +1 -1
  71. package/dist/gateway/static/root/assets/{dev-view-store-TTj_djD8.js → dev-view-store-CeZZLOc6.js} +1 -1
  72. package/dist/gateway/static/root/assets/device-pairing-wizard-DH_uJ698.js +1 -0
  73. package/dist/gateway/static/root/assets/{directory-picker-path-field-C07a7wYX.js → directory-picker-path-field-DiZXY7jF.js} +1 -1
  74. package/dist/gateway/static/root/assets/{discussion-annotation-sync-BFqKm9ky.js → discussion-annotation-sync-BXqNuZnx.js} +1 -1
  75. package/dist/gateway/static/root/assets/dist-BGTk37IG.js +1 -0
  76. package/dist/gateway/static/root/assets/dist-BuHnPloF.js +1 -0
  77. package/dist/gateway/static/root/assets/dist-GJ8-1PAx.js +1 -0
  78. package/dist/gateway/static/root/assets/dist-ZrL34Ps4.js +1 -0
  79. package/dist/gateway/static/root/assets/{extension-debug-page-DFaVlqas.js → extension-debug-page-myQqsol2.js} +1 -1
  80. package/dist/gateway/static/root/assets/{extension-iframe-host-BfzPfXBq.js → extension-iframe-host-DaL-OcTw.js} +1 -1
  81. package/dist/gateway/static/root/assets/{extension-marketplace-api-ow0K1Y4_.js → extension-marketplace-api-DRBszrCR.js} +1 -1
  82. package/dist/gateway/static/root/assets/{extension-page-CrDADV5W.js → extension-page-DvlGhZLa.js} +1 -1
  83. package/dist/gateway/static/root/assets/{extension-provider-mnRoa63o.js → extension-provider-fOi6V6Cr.js} +1 -1
  84. package/dist/gateway/static/root/assets/{extension-settings-page-BLl02GFY.js → extension-settings-page-DOGlQpkx.js} +1 -1
  85. package/dist/gateway/static/root/assets/{file-preview-surface-TGdKqhCf.js → file-preview-surface-DfkXvFnc.js} +1 -1
  86. package/dist/gateway/static/root/assets/{gateway-config-swr-DfPQIHOL.js → gateway-config-swr-BOCt_zOo.js} +1 -1
  87. package/dist/gateway/static/root/assets/{gateway-realtime-67vWg_M2.js → gateway-realtime-BL_Cf0OQ.js} +1 -1
  88. package/dist/gateway/static/root/assets/gateway-realtime-store-BHBOPF_q.js +1 -0
  89. package/dist/gateway/static/root/assets/{gateway-restart-CLtR2wkL.js → gateway-restart-CHf8qY7H.js} +1 -1
  90. package/dist/gateway/static/root/assets/{gateway-settings-COvC3r-l.js → gateway-settings-Di41peSM.js} +1 -1
  91. package/dist/gateway/static/root/assets/{gateway-startup-retry-9YQllbw2.js → gateway-startup-retry-CvkJYurV.js} +1 -1
  92. package/dist/gateway/static/root/assets/{global-defaults-api-DYMRjGvd.js → global-defaults-api-BWMbKu72.js} +1 -1
  93. package/dist/gateway/static/root/assets/home-page-B3sgqrl3.js +2 -0
  94. package/dist/gateway/static/root/assets/{image-generation-api-Dzydfvy8.js → image-generation-api-Ce-IY7Ug.js} +1 -1
  95. package/dist/gateway/static/root/assets/{imports-page-Csd_YZXZ.js → imports-page-W7_cDbxy.js} +1 -1
  96. package/dist/gateway/static/root/assets/index-D4B6O8B3.js +11 -0
  97. package/dist/gateway/static/root/assets/index-DGWBJDAM.css +1 -0
  98. package/dist/gateway/static/root/assets/install-connector-dialog-DWVl9ekV.js +1 -0
  99. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B201bMIa.js → keyboard-shortcuts-settings-Doyu0Q9e.js} +1 -1
  100. package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +1 -0
  101. package/dist/gateway/static/root/assets/local-app-workbench-page-B3h3P6aI.js +1 -0
  102. package/dist/gateway/static/root/assets/{local-apps-page-BOwqNH0L.js → local-apps-page-D6D2bZGW.js} +1 -1
  103. package/dist/gateway/static/root/assets/{local-session-drafts-DjmK-SM9.js → local-session-drafts-BJ1B1dQ7.js} +1 -1
  104. package/dist/gateway/static/root/assets/{locale-store-Bg_XR36n.js → locale-store-Br7IfbXK.js} +1 -1
  105. package/dist/gateway/static/root/assets/{logs-page-gw3E9CMQ.js → logs-page-qiXos_12.js} +2 -2
  106. package/dist/gateway/static/root/assets/management-settings-C0WcSdK7.js +1 -0
  107. package/dist/gateway/static/root/assets/{markdown-view-BUpXJUPv.js → markdown-view-Ck5s16p9.js} +2 -2
  108. package/dist/gateway/static/root/assets/mcp-conversation-setup-page-CENs3hGU.js +1 -0
  109. package/dist/gateway/static/root/assets/{media-plugins-_shnaEMY.js → media-plugins-Ba6vUE4J.js} +1 -1
  110. package/dist/gateway/static/root/assets/messages-ByFlEbsu.js +3 -0
  111. package/dist/gateway/static/root/assets/model-selector-DCBmsHzj.js +1 -0
  112. package/dist/gateway/static/root/assets/{models-hub-cache-KOJC3z6Q.js → models-hub-cache-Bd-fYUrV.js} +1 -1
  113. package/dist/gateway/static/root/assets/note-detail-panel-CnuxqWMd.js +5 -0
  114. package/dist/gateway/static/root/assets/note-image-lightbox-BFKZ7qJr.js +1 -0
  115. package/dist/gateway/static/root/assets/{notes-api-BSmikUKI.js → notes-api-8kp0X1x6.js} +1 -1
  116. package/dist/gateway/static/root/assets/{notes-page-CA0NRL8O.js → notes-page-XMdy-H3H.js} +1 -1
  117. package/dist/gateway/static/root/assets/{oauth-api-D2t9HXoC.js → oauth-api-DMMdeaNd.js} +1 -1
  118. package/dist/gateway/static/root/assets/{oauth-provider-connect-DGGGGtcB.js → oauth-provider-connect-CfOK8mPM.js} +1 -1
  119. package/dist/gateway/static/root/assets/{page-context-capture-button-BH54VO0V.js → page-context-capture-button-CKlKWSJ7.js} +1 -1
  120. package/dist/gateway/static/root/assets/{page-context-draft-BS5y8Cx9.js → page-context-draft-LF33STHC.js} +1 -1
  121. package/dist/gateway/static/root/assets/page-header-store-Du44NIEJ.js +1 -0
  122. package/dist/gateway/static/root/assets/{personal-avatar-D8DtpDTa.js → personal-avatar-D6CzIIfo.js} +1 -1
  123. package/dist/gateway/static/root/assets/personal-page-CIMMSI25.js +1 -0
  124. package/dist/gateway/static/root/assets/{personal-settings-panel-9uDaNJy5.js → personal-settings-panel-wKdlrfPq.js} +1 -1
  125. package/dist/gateway/static/root/assets/{phone-dependencies-card-DLYrI0C4.js → phone-dependencies-card-CDhk5277.js} +1 -1
  126. package/dist/gateway/static/root/assets/phone-model-connection-DZ-ZunPz.js +1 -0
  127. package/dist/gateway/static/root/assets/{phone-model-picker-BbA2iI-3.js → phone-model-picker-DuZc5jYO.js} +1 -1
  128. package/dist/gateway/static/root/assets/phone-settings-page-0u0GQl_R.js +1 -0
  129. package/dist/gateway/static/root/assets/{phone-workspace-store-CVDk80Bf.js → phone-workspace-store-SN7hfddU.js} +1 -1
  130. package/dist/gateway/static/root/assets/plugin-details-dialog-Bfc-Wmrd.js +1 -0
  131. package/dist/gateway/static/root/assets/{popover-select-DD8fmrxH.js → popover-select-CEMWIrtY.js} +1 -1
  132. package/dist/gateway/static/root/assets/{preference-select-fields-BVoN-lAv.js → preference-select-fields-BKeHZLXZ.js} +1 -1
  133. package/dist/gateway/static/root/assets/{product-automation-feedback-DCo90zGh.js → product-automation-feedback-BPur0vyo.js} +2 -2
  134. package/dist/gateway/static/root/assets/{product-open-page-OWl8IAoY.js → product-open-page-Bfd7R483.js} +1 -1
  135. package/dist/gateway/static/root/assets/{product-preview-content-Cjas7UNe.js → product-preview-content-Bnq68oVw.js} +1 -1
  136. package/dist/gateway/static/root/assets/{product-preview-modal-CPWRvBI9.js → product-preview-modal-BPmTeweh.js} +2 -2
  137. package/dist/gateway/static/root/assets/project-detail-page-D9nnyvrI.js +7 -0
  138. package/dist/gateway/static/root/assets/{project-understanding-Ba02SFzB.js → project-understanding-DLvxAoTT.js} +1 -1
  139. package/dist/gateway/static/root/assets/projects-page-BGy1pw9a.js +1 -0
  140. package/dist/gateway/static/root/assets/{providers-api-rwQ4LWzr.js → providers-api-DOnNfkwQ.js} +1 -1
  141. package/dist/gateway/static/root/assets/{recording-upload-BSmvRrZQ.js → recording-upload-CHFJbqW1.js} +1 -1
  142. package/dist/gateway/static/root/assets/{refresh-button-bU_0NarN.js → refresh-button-DiWdGAaX.js} +1 -1
  143. package/dist/gateway/static/root/assets/{registry-api-Vy7LfH6E.js → registry-api-DFDvOTg4.js} +1 -1
  144. package/dist/gateway/static/root/assets/{remote-access-hub-UXrnpGev.js → remote-access-hub-BVqwnOqO.js} +1 -1
  145. package/dist/gateway/static/root/assets/{resource-unavailable-f9OzSi4W.js → resource-unavailable-TQcRCpAg.js} +1 -1
  146. package/dist/gateway/static/root/assets/route-preload-DI43HQV_.js +2 -0
  147. package/dist/gateway/static/root/assets/{runtime-tools-api-Bt8t37z5.js → runtime-tools-api-9o3Wfji1.js} +1 -1
  148. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DU4UXnBm.js → runtime-tools-settings-panel-ccVBG-bZ.js} +1 -1
  149. package/dist/gateway/static/root/assets/{schema-form-BKeP5G7b.js → schema-form-C-jw6Hid.js} +1 -1
  150. package/dist/gateway/static/root/assets/{secret-input-BQvFXqzz.js → secret-input-Dryrns2s.js} +1 -1
  151. package/dist/gateway/static/root/assets/{service-recommendation-list-CuYsRcBB.js → service-recommendation-list-CNghOavt.js} +1 -1
  152. package/dist/gateway/static/root/assets/{session-api-DJI9eSgw.js → session-api-Bs3r_d2_.js} +1 -1
  153. package/dist/gateway/static/root/assets/session-manager-Bnq3qpqy.js +23 -0
  154. package/dist/gateway/static/root/assets/sessions-page-CyBj1Xw2.js +1 -0
  155. package/dist/gateway/static/root/assets/settings-advanced-gate-BI4DMz4_.js +1 -0
  156. package/dist/gateway/static/root/assets/{settings-advanced-section-BxUuF_yi.js → settings-advanced-section-DwpPPxT0.js} +1 -1
  157. package/dist/gateway/static/root/assets/{settings-mode-store-CaoRh2gt.js → settings-mode-store-CiRpsdTJ.js} +1 -1
  158. package/dist/gateway/static/root/assets/{settings-page-qQ8-6dJ_.js → settings-page-Cd8Ermnn.js} +1 -1
  159. package/dist/gateway/static/root/assets/{settings-page-header-CyUHrn7c.js → settings-page-header-BZl4AMiN.js} +1 -1
  160. package/dist/gateway/static/root/assets/{settings-page-layout-DGVqXrlp.js → settings-page-layout-onhEgq-K.js} +1 -1
  161. package/dist/gateway/static/root/assets/setup-interaction-page-Cvvj6JyV.js +1 -0
  162. package/dist/gateway/static/root/assets/setup-status-panel-D4qgE7QM.js +1 -0
  163. package/dist/gateway/static/root/assets/share-link-dialog-DA0QuFOD.js +1 -0
  164. package/dist/gateway/static/root/assets/{share-preview-page-Cem96FbB.js → share-preview-page-YDpIY4dC.js} +1 -1
  165. package/dist/gateway/static/root/assets/{shares-api-Dowes16l.js → shares-api-D8Q-m46d.js} +1 -1
  166. package/dist/gateway/static/root/assets/shares-settings-DUvjOMmA.js +1 -0
  167. package/dist/gateway/static/root/assets/{skill-api-D8ZwFEVe.js → skill-api-uKU4sRiv.js} +1 -1
  168. package/dist/gateway/static/root/assets/{skill-list-api-B4gp00-f.js → skill-list-api-BzKzG-xG.js} +1 -1
  169. package/dist/gateway/static/root/assets/{skill-reload-api-ClmaaDXo.js → skill-reload-api-DkUXekcd.js} +1 -1
  170. package/dist/gateway/static/root/assets/skills-page-ClyNSh-7.js +2 -0
  171. package/dist/gateway/static/root/assets/{system-settings-panel-D095uacX.js → system-settings-panel-BN6sUX0H.js} +1 -1
  172. package/dist/gateway/static/root/assets/task-detail-page-CS9m7Ipo.js +2 -0
  173. package/dist/gateway/static/root/assets/{task-result-evidence-LUrJlUhb.js → task-result-evidence-DKygspo2.js} +1 -1
  174. package/dist/gateway/static/root/assets/{terminal-panel-store-BqEDB1Vl.js → terminal-panel-store-DJVC7HqA.js} +1 -1
  175. package/dist/gateway/static/root/assets/{theme-store-gAcojLgP.js → theme-store-Dlnmgryi.js} +1 -1
  176. package/dist/gateway/static/root/assets/tool-friendly-title-DcCc6g7o.js +1 -0
  177. package/dist/gateway/static/root/assets/tracing-settings-page-Bs76WeoF.js +1 -0
  178. package/dist/gateway/static/root/assets/{tunnel-api-C9u9E3UQ.js → tunnel-api-B7nx0NQJ.js} +1 -1
  179. package/dist/gateway/static/root/assets/{understanding-activity-store-BTrzsR6_.js → understanding-activity-store-C4bblRnQ.js} +1 -1
  180. package/dist/gateway/static/root/assets/{understanding-refresh-store-5Qava3jh.js → understanding-refresh-store-BvCj9-Ue.js} +1 -1
  181. package/dist/gateway/static/root/assets/{usage-page-DFMLYKAc.js → usage-page-anU5gslJ.js} +1 -1
  182. package/dist/gateway/static/root/assets/{use-autosave-3O-X7x15.js → use-autosave-YHxQ-UZg.js} +1 -1
  183. package/dist/gateway/static/root/assets/use-composer-attachments-DYY3Yz4a.js +2 -0
  184. package/dist/gateway/static/root/assets/use-file-preview-expanded-CYgWzDnv.js +2 -0
  185. package/dist/gateway/static/root/assets/{use-personal-profile-MusPgljM.js → use-personal-profile-D2Un8G1L.js} +1 -1
  186. package/dist/gateway/static/root/assets/{use-workspace-tree-Ck_U2yTw.js → use-workspace-tree-Dkg9tUr4.js} +1 -1
  187. package/dist/gateway/static/root/assets/user-model-page-DIgPL3tN.js +2 -0
  188. package/dist/gateway/static/root/assets/{voice-api-key-field-C5zJApoa.js → voice-api-key-field-BUes-Jlp.js} +1 -1
  189. package/dist/gateway/static/root/assets/{voice-config-api-DC1bYDt1.js → voice-config-api-CrULrSKC.js} +1 -1
  190. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-0SZjJdVV.js → voice-input-shortcut-events-DFMNIyy4.js} +1 -1
  191. package/dist/gateway/static/root/assets/voice-transcribe-api-Dy4hfftb.js +1 -0
  192. package/dist/gateway/static/root/assets/{work-discovery-overlay-DAQ8McVe.js → work-discovery-overlay-CFF4cRFl.js} +1 -1
  193. package/dist/gateway/static/root/assets/{work-discovery-page-DUQysEyb.js → work-discovery-page-BnYaVH3V.js} +1 -1
  194. package/dist/gateway/static/root/assets/working-directory-picker-modal-GFwVefVA.js +1 -0
  195. package/dist/gateway/static/root/assets/{workspace-api-ZrN6yUER.js → workspace-api-BdB4NEOh.js} +2 -2
  196. package/dist/gateway/static/root/assets/workspace-editor-agent-store-4cZ26iaD.js +1 -0
  197. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-Yj_kBWSb.js → workspace-file-preview-dialog-NRL3YRjg.js} +1 -1
  198. package/dist/gateway/static/root/assets/{workspace-open-location-menu-yxT7wajO.js → workspace-open-location-menu-Dcij7wvJ.js} +1 -1
  199. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-IcH9KDzx.js → xopc-cloud-account-card-DC9aG7Pl.js} +1 -1
  200. package/dist/gateway/static/root/index.html +100 -98
  201. package/dist/package.js +1 -1
  202. package/dist/packages/gateway-contract/src/automations.js +7 -0
  203. package/dist/packages/gateway-contract/src/capabilities.js +1 -1
  204. package/dist/src/agent/agent-manager.d.ts +1 -0
  205. package/dist/src/agent/agent-manager.js +1 -0
  206. package/dist/src/agent/child-agent-factory.js +1 -1
  207. package/dist/src/agent/data-acquisition/service.js +1 -1
  208. package/dist/src/agent/embedded/configuration-capability-correction.d.ts +3 -0
  209. package/dist/src/agent/embedded/configuration-capability-correction.js +14 -0
  210. package/dist/src/agent/embedded/run-for-session.js +20 -5
  211. package/dist/src/agent/embedded/run-turn.js +13 -1
  212. package/dist/src/agent/embedded/session-runner.js +6 -3
  213. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  214. package/dist/src/agent/image/load-image-media.js +1 -1
  215. package/dist/src/agent/inbound/inbound-loop.js +4 -1
  216. package/dist/src/agent/independent-execution.js +1 -1
  217. package/dist/src/agent/mcp/config.js +1 -1
  218. package/dist/src/agent/mcp/connection-drafts.d.ts +3 -1
  219. package/dist/src/agent/mcp/connection-drafts.js +3 -2
  220. package/dist/src/agent/mcp/connection-setup.js +34 -2
  221. package/dist/src/agent/mcp/conversation-setup.d.ts +163 -0
  222. package/dist/src/agent/mcp/conversation-setup.js +621 -0
  223. package/dist/src/agent/mcp/native-mcp.d.ts +1 -0
  224. package/dist/src/agent/mcp/tool-catalog.d.ts +5 -0
  225. package/dist/src/agent/mcp/tool-catalog.js +19 -2
  226. package/dist/src/agent/mcp/weixin-setup-scope.d.ts +12 -0
  227. package/dist/src/agent/mcp/weixin-setup-scope.js +43 -0
  228. package/dist/src/agent/prompt/conversational-configuration-guide.js +2 -1
  229. package/dist/src/agent/prompt/sections/tooling.js +3 -2
  230. package/dist/src/agent/prompt/service-prompt-builder.js +1 -1
  231. package/dist/src/agent/service/direct-turn-helpers.js +1 -1
  232. package/dist/src/agent/service/process-direct-streaming.js +2 -2
  233. package/dist/src/agent/service.d.ts +2 -0
  234. package/dist/src/agent/service.js +11 -1
  235. package/dist/src/agent/service.types.d.ts +1 -0
  236. package/dist/src/agent/tasks/task-judge-service.js +2 -2
  237. package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +6 -4
  238. package/dist/src/agent/tool-manuals/xopc-configuration.js +92 -8
  239. package/dist/src/agent/tools/automation-tool.d.ts +9 -1
  240. package/dist/src/agent/tools/automation-tool.js +34 -5
  241. package/dist/src/agent/tools/create-share-tool.js +1 -1
  242. package/dist/src/agent/tools/factory.d.ts +3 -0
  243. package/dist/src/agent/tools/factory.js +34 -23
  244. package/dist/src/agent/tools/image-generate-tool.js +3 -3
  245. package/dist/src/agent/tools/index.d.ts +1 -0
  246. package/dist/src/agent/tools/index.js +5 -4
  247. package/dist/src/agent/tools/mcp-setup-tool.d.ts +9 -0
  248. package/dist/src/agent/tools/mcp-setup-tool.js +32 -0
  249. package/dist/src/agent/tools/personal-task-tool.js +2 -2
  250. package/dist/src/agent/tools/publish-artifacts.js +1 -1
  251. package/dist/src/agent/tools/read.js +1 -1
  252. package/dist/src/agent/tools/skill-install-tool.js +56 -1
  253. package/dist/src/agent/tools/skill-manage-tool.d.ts +4 -0
  254. package/dist/src/agent/tools/skill-manage-tool.js +74 -2
  255. package/dist/src/agent/tools/skills-tools.js +1 -1
  256. package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
  257. package/dist/src/agent/tools/tool-manual-tool.d.ts +1 -1
  258. package/dist/src/agent/tools/tool-manual-tool.js +3 -1
  259. package/dist/src/agent/tools/toolExposure.js +2 -0
  260. package/dist/src/agent/tools/write.js +1 -1
  261. package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
  262. package/dist/src/agent/tools/xopc-use-tool.js +60 -10
  263. package/dist/src/agent-catalog/service.d.ts +1 -1
  264. package/dist/src/agent-catalog/service.js +2 -1
  265. package/dist/src/automations/capabilities/drafts.js +5 -2
  266. package/dist/src/automations/capabilities/read.js +18 -7
  267. package/dist/src/automations/capabilities/write.d.ts +111 -52
  268. package/dist/src/automations/capabilities/write.js +44 -10
  269. package/dist/src/automations/delivery/delivery-router.d.ts +1 -0
  270. package/dist/src/automations/delivery/delivery-router.js +7 -1
  271. package/dist/src/automations/domain/types.d.ts +8 -0
  272. package/dist/src/automations/domain/validation.d.ts +24 -0
  273. package/dist/src/automations/domain/validation.js +7 -0
  274. package/dist/src/automations/draft/automation-draft-validator.d.ts +6 -0
  275. package/dist/src/automations/index.js +2 -2
  276. package/dist/src/automations/mcp-source.d.ts +60 -0
  277. package/dist/src/automations/mcp-source.js +173 -0
  278. package/dist/src/automations/service/action-executor.js +15 -1
  279. package/dist/src/automations/service/automation-service.d.ts +5 -0
  280. package/dist/src/automations/service/automation-service.js +52 -2
  281. package/dist/src/automations/service/index.js +2 -2
  282. package/dist/src/browser/setup/repository.d.ts +1 -0
  283. package/dist/src/browser/setup/repository.js +7 -1
  284. package/dist/src/browser/setup/service.d.ts +3 -0
  285. package/dist/src/browser/setup/service.js +41 -18
  286. package/dist/src/browser/setup/types.d.ts +1 -0
  287. package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
  288. package/dist/src/channels/index.js +1 -1
  289. package/dist/src/channels/manager.d.ts +1 -0
  290. package/dist/src/channels/outbound-sender.d.ts +1 -0
  291. package/dist/src/channels/outbound-sender.js +3 -0
  292. package/dist/src/channels/pairing/pairing-service.js +1 -1
  293. package/dist/src/channels/weixin/account-identity.d.ts +2 -0
  294. package/dist/src/channels/weixin/account-identity.js +15 -0
  295. package/dist/src/chat-commands/builtins/config.js +1 -1
  296. package/dist/src/cli/commands/backup.js +1 -1
  297. package/dist/src/cli/commands/channels.js +2 -2
  298. package/dist/src/cli/commands/doctor/checks/channel-pairing-pending.js +1 -1
  299. package/dist/src/cli/commands/mcp.js +1 -1
  300. package/dist/src/config/models-json.d.ts +12 -0
  301. package/dist/src/extensions/agent-plugins/credentials.js +1 -1
  302. package/dist/src/extensions/agent-plugins/setup.d.ts +1 -1
  303. package/dist/src/extensions/agent-plugins/setup.js +3 -3
  304. package/dist/src/extensions/api.js +1 -1
  305. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  306. package/dist/src/gateway/agents-admin.js +1 -1
  307. package/dist/src/gateway/device-routes.js +1 -1
  308. package/dist/src/gateway/global-defaults-admin.js +1 -1
  309. package/dist/src/gateway/hono/app.js +1 -1
  310. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  311. package/dist/src/gateway/hono/oauth-async.js +1 -1
  312. package/dist/src/gateway/hono/routes/channels.js +1 -1
  313. package/dist/src/gateway/hono/routes/config.js +1 -1
  314. package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -1
  315. package/dist/src/gateway/hono/routes/mcp.js +39 -2
  316. package/dist/src/gateway/hono/routes/notes.js +2 -2
  317. package/dist/src/gateway/hono/routes/phone-setup.js +45 -16
  318. package/dist/src/gateway/hono/routes/phone.js +2 -4
  319. package/dist/src/gateway/hono/routes/projects.js +1 -1
  320. package/dist/src/gateway/hono/routes/provider-setup.js +1 -1
  321. package/dist/src/gateway/hono/routes/public-gateway.js +22 -0
  322. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  323. package/dist/src/gateway/hono/routes/shares.js +1 -1
  324. package/dist/src/gateway/hono/routes/site-shares.js +1 -1
  325. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  326. package/dist/src/gateway/media-access.js +1 -1
  327. package/dist/src/gateway/service/agent-runner.d.ts +1 -0
  328. package/dist/src/gateway/service/agent-runner.js +3 -1
  329. package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
  330. package/dist/src/gateway/service/config-coordinator.js +2 -1
  331. package/dist/src/gateway/service/run-gateway-agent.js +1 -1
  332. package/dist/src/gateway/service/sessions-api.js +2 -1
  333. package/dist/src/gateway/service.d.ts +5 -1
  334. package/dist/src/gateway/service.js +86 -12
  335. package/dist/src/gateway/session-context-summary.js +1 -1
  336. package/dist/src/gateway/session-reset-service.d.ts +1 -0
  337. package/dist/src/gateway/session-reset-service.js +15 -2
  338. package/dist/src/gateway/xopc-cloud-capability-setup.js +9 -1
  339. package/dist/src/notes/service.js +1 -1
  340. package/dist/src/personal-agent/prompts.js +1 -1
  341. package/dist/src/personal-agent/reply-composer.js +2 -2
  342. package/dist/src/personal-agent/request-service.js +3 -3
  343. package/dist/src/personal-agent/service.js +1 -1
  344. package/dist/src/personal-agent/task-cancel.js +1 -1
  345. package/dist/src/phone/cloud-adb-connection.js +8 -5
  346. package/dist/src/phone/contracts.d.ts +4 -0
  347. package/dist/src/phone/contracts.js +6 -1
  348. package/dist/src/phone/gui-protocol.d.ts +7 -0
  349. package/dist/src/phone/gui-protocol.js +302 -0
  350. package/dist/src/phone/model-adapter.d.ts +1 -1
  351. package/dist/src/phone/model-adapter.js +7 -4
  352. package/dist/src/phone/runtime.js +8 -2
  353. package/dist/src/phone/setup/service.d.ts +14 -4
  354. package/dist/src/phone/setup/service.js +106 -28
  355. package/dist/src/phone/ui-dump-binary.d.ts +1 -1
  356. package/dist/src/phone/ui-dump-binary.js +1 -1
  357. package/dist/src/phone/ui-session.d.ts +2 -0
  358. package/dist/src/phone/ui-session.js +23 -4
  359. package/dist/src/projects/index.js +1 -1
  360. package/dist/src/projects/project-service.js +1 -1
  361. package/dist/src/providers/env-keys.js +2 -0
  362. package/dist/src/providers/index.js +11 -0
  363. package/dist/src/providers/model-catalog-types.d.ts +1 -1
  364. package/dist/src/providers/model-supplements.d.ts +1 -1
  365. package/dist/src/providers/model-supplements.js +6 -3
  366. package/dist/src/providers/phone-models.d.ts +3 -0
  367. package/dist/src/providers/phone-models.js +33 -0
  368. package/dist/src/providers/presentation.js +0 -1
  369. package/dist/src/runtime-tools/phone-dependencies.d.ts +2 -0
  370. package/dist/src/runtime-tools/phone-dependencies.js +10 -0
  371. package/dist/src/share/note-share-service.js +1 -1
  372. package/dist/src/share/site-proxy.js +1 -1
  373. package/dist/src/tasks/capabilities/write.js +1 -1
  374. package/dist/src/tasks/index.js +1 -1
  375. package/dist/src/tasks/task-allocation-service.js +3 -3
  376. package/dist/src/tasks/task-application-service.js +2 -2
  377. package/dist/src/tasks/task-context-assembler.js +1 -1
  378. package/dist/src/tasks/task-contract-planner.js +1 -1
  379. package/dist/src/tasks/task-handoff.js +1 -1
  380. package/dist/src/tasks/task-research-result.js +1 -1
  381. package/dist/src/tasks/task-run-coordinator.js +2 -2
  382. package/dist/src/tui/backends/embedded-backend.js +1 -1
  383. package/dist/src/tui/tui.js +1 -1
  384. package/dist/src/voice/platform-catalog.d.ts +1 -1
  385. package/package.json +3 -1
  386. package/skills/tools/configure-xopc/SKILL.md +10 -3
  387. package/skills/tools/configure-xopc/references/browser/chrome-extension.md +4 -1
  388. package/skills/tools/configure-xopc/references/browser/overview.md +2 -2
  389. package/skills/tools/configure-xopc/references/phone/aliyun.md +3 -2
  390. package/skills/tools/configure-xopc/references/phone/overview.md +2 -2
  391. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DlvjxWg6.js +0 -1
  392. package/dist/gateway/static/root/assets/agent-plugin-dialog-OBueuQSc.js +0 -1
  393. package/dist/gateway/static/root/assets/agents-Cp6_5OOQ.js +0 -77
  394. package/dist/gateway/static/root/assets/app-link-1j40sJ-z.js +0 -1
  395. package/dist/gateway/static/root/assets/apps-page-C2WKUwtN.js +0 -1
  396. package/dist/gateway/static/root/assets/attachment-load-qjPpQzYY.js +0 -1
  397. package/dist/gateway/static/root/assets/automation-task-card-wbnR5i6N.js +0 -3
  398. package/dist/gateway/static/root/assets/automations-workspace-D6cTOKr7.js +0 -9
  399. package/dist/gateway/static/root/assets/browser-settings-page-L0nBjfhG.js +0 -3
  400. package/dist/gateway/static/root/assets/capabilities-aT-QjNTl.js +0 -1
  401. package/dist/gateway/static/root/assets/capabilities-page-DlpuHdHi.js +0 -2
  402. package/dist/gateway/static/root/assets/capabilities-settings-panel-pvqkN2-2.js +0 -8
  403. package/dist/gateway/static/root/assets/channels-BUPtawh6.js +0 -1
  404. package/dist/gateway/static/root/assets/chat-page-BP0huA-W.js +0 -72
  405. package/dist/gateway/static/root/assets/composer-payload-handoff-CYIhcczq.js +0 -1
  406. package/dist/gateway/static/root/assets/confirm-dialog-XGclfBqe.js +0 -1
  407. package/dist/gateway/static/root/assets/connected-providers-grid-CKZfhHSD.js +0 -1
  408. package/dist/gateway/static/root/assets/connectors-page-Lf1ZzaVn.js +0 -1
  409. package/dist/gateway/static/root/assets/dependency-picker-UqKVJ9dv.js +0 -1
  410. package/dist/gateway/static/root/assets/device-pairing-wizard-ByEL5lvM.js +0 -1
  411. package/dist/gateway/static/root/assets/dist-CaUuvp8-.js +0 -1
  412. package/dist/gateway/static/root/assets/dist-D3lWNSe7.js +0 -1
  413. package/dist/gateway/static/root/assets/dist-DfWfZ9iu.js +0 -1
  414. package/dist/gateway/static/root/assets/dist-DusecO_p.js +0 -1
  415. package/dist/gateway/static/root/assets/gateway-realtime-store-Bkt1z-xo.js +0 -1
  416. package/dist/gateway/static/root/assets/home-page-k9LFXcVa.js +0 -2
  417. package/dist/gateway/static/root/assets/index-CpwPxKQ8.css +0 -1
  418. package/dist/gateway/static/root/assets/index-DKW7BeT_.js +0 -11
  419. package/dist/gateway/static/root/assets/install-connector-dialog-CTQAKTPv.js +0 -1
  420. package/dist/gateway/static/root/assets/local-app-workbench-page-CD_8_gd_.js +0 -1
  421. package/dist/gateway/static/root/assets/management-settings-t_Z2mCyw.js +0 -1
  422. package/dist/gateway/static/root/assets/messages-DG4HLOER.js +0 -3
  423. package/dist/gateway/static/root/assets/model-selector-a7PIT1Lk.js +0 -1
  424. package/dist/gateway/static/root/assets/note-detail-panel-BsHYUFgk.js +0 -5
  425. package/dist/gateway/static/root/assets/note-image-lightbox-B-bEtjhj.js +0 -1
  426. package/dist/gateway/static/root/assets/page-header-store-BdZnUh-D.js +0 -1
  427. package/dist/gateway/static/root/assets/personal-page-KJezmTKP.js +0 -1
  428. package/dist/gateway/static/root/assets/phone-settings-page-Cg_BPss4.js +0 -1
  429. package/dist/gateway/static/root/assets/plugin-details-dialog-DgibLkc3.js +0 -1
  430. package/dist/gateway/static/root/assets/project-detail-page-B_HlZux_.js +0 -7
  431. package/dist/gateway/static/root/assets/projects-page-CdfKjp95.js +0 -1
  432. package/dist/gateway/static/root/assets/route-preload-BtObM-co.js +0 -2
  433. package/dist/gateway/static/root/assets/session-manager-CtKgACGl.js +0 -23
  434. package/dist/gateway/static/root/assets/sessions-page-BAsKzRHt.js +0 -1
  435. package/dist/gateway/static/root/assets/settings-advanced-gate-CjAFqg2U.js +0 -1
  436. package/dist/gateway/static/root/assets/setup-status-panel-BpaPb625.js +0 -1
  437. package/dist/gateway/static/root/assets/share-link-dialog-CQJ6Ykm2.js +0 -1
  438. package/dist/gateway/static/root/assets/shares-settings-DZEkZDR0.js +0 -1
  439. package/dist/gateway/static/root/assets/skills-page-CV0X9rvG.js +0 -2
  440. package/dist/gateway/static/root/assets/task-detail-page-CY2C4AM2.js +0 -2
  441. package/dist/gateway/static/root/assets/tool-friendly-title-o6sxGVUu.js +0 -1
  442. package/dist/gateway/static/root/assets/tracing-settings-page-B1ZRh-Is.js +0 -1
  443. package/dist/gateway/static/root/assets/use-composer-attachments-BLc4dBfe.js +0 -2
  444. package/dist/gateway/static/root/assets/use-file-preview-expanded-BaOmTXsT.js +0 -2
  445. package/dist/gateway/static/root/assets/user-model-page-Den5Lg-k.js +0 -2
  446. package/dist/gateway/static/root/assets/voice-transcribe-api-CxVeANPX.js +0 -1
  447. package/dist/gateway/static/root/assets/working-directory-picker-modal-BO9qdJyZ.js +0 -1
  448. package/dist/gateway/static/root/assets/workspace-editor-agent-store-Bo5dwoWP.js +0 -1
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,n as o,o as s}from"./locale-store-Br7IfbXK.js";import{t as c}from"./messages-ByFlEbsu.js";import{t as l,v as u}from"./chat-page-D92AWJbh.js";import{t as d}from"./arrow-left-D880xG-P.js";import{t as f}from"./arrow-right-DSSvoX71.js";import{t as p}from"./arrow-up-right-T72JbQ1Q.js";import{t as m}from"./check-DUBLcKHA.js";import{t as h}from"./popover-select-CEMWIrtY.js";import{t as g}from"./list-todo-CTVRto8O.js";import{F as _}from"./markdown-view-Ck5s16p9.js";import{n as v,s as y,t as b}from"./install-connector-dialog-DWVl9ekV.js";import{n as x,t as S}from"./personal-avatar-D6CzIIfo.js";import{t as C}from"./play-kxZvpBg8.js";import{t as w}from"./settings-2-D-csvaET.js";import{t as ee}from"./square-DMK_fB-3.js";import{t as T}from"./upload-rrb46c3c.js";import{t as E}from"./x-B_N4OPjy.js";import{t as D}from"./skeleton-BI5TyibZ.js";import{l as te}from"./voice-transcribe-api-Dy4hfftb.js";import{T as O,d as k,t as A}from"./session-manager-Bnq3qpqy.js";import{a as j,i as M,o as N,r as P,s as F,t as ne}from"./dist-GJ8-1PAx.js";import{a as re,r as ie}from"./connectors-api-DEJU8mgn.js";import{n as ae}from"./voice-call-context-BM2A4bLz.js";import{t as oe}from"./page-header-store-Du44NIEJ.js";import{s as I}from"./agent-avatar-display-6Z4m31Fz.js";import{l as L,n as se,t as ce}from"./voice-config-api-CrULrSKC.js";import{t as R}from"./date-formatters-DukWSVwc.js";var z=n(),B=e(t(),1),V=r(),H=[`intro`,`identity`,`voice`,`connections`],le=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function U(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function W(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await s(a(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),I(e)}function ue({modelsAvailable:e,onCreated:t}){let n=o(e=>e.language)===`zh`,r=o(e=>e.language),[l,u]=(0,B.useState)(`intro`),[p,h]=(0,B.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[g,_]=(0,B.useState)(!1),[x,w]=(0,B.useState)(!1),[ee,E]=(0,B.useState)(null),[O,k]=(0,B.useState)(null),[A,j]=(0,B.useState)(null),[M,N]=(0,B.useState)(null),[P,F]=(0,B.useState)(!0),[ne,ae]=(0,B.useState)([]),[oe,I]=(0,B.useState)(null),R=(0,B.useRef)(null),z=(0,B.useRef)(null),[ue,de]=(0,B.useState)([]),[G,fe]=(0,B.useState)(!0),[pe,K]=(0,B.useState)([]),[q,J]=(0,B.useState)(null);(0,B.useEffect)(()=>{let e=!1;return s(a(`/api/personal-agent/onboarding`)).then(t=>{e||(u(t.payload.step),h(t.payload.draft))}).catch(t=>{e||E(t instanceof Error?t.message:String(t))}).finally(()=>{e||_(!0)}),()=>{e=!0}},[]),(0,B.useEffect)(()=>{if(!g)return;let e=window.setTimeout(()=>{s(a(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:l,draft:p})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[p,g,l]),(0,B.useEffect)(()=>{let e=!1;return ce().then(t=>{e||(t.tts&&t.enabled?N({provider:t.tts.provider,model:t.tts.model,enabled:!0}):F(!1))}).catch(()=>{e||F(!1)}),()=>{e=!0}},[]),(0,B.useEffect)(()=>{if(!M?.enabled)return;let e=!1;return se(M.provider,M.model,`realtime`).then(t=>{e||ae(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||F(!1)}),()=>{e=!0}},[M]),(0,B.useEffect)(()=>{if(l!==`connections`)return;let e=!1;return fe(!0),Promise.allSettled([ie({page:1,pageSize:24,verification:`verified`}),re()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];de(t.value.connectors.filter(t=>t.runtime.type===`composio`&&e.includes(t.runtime.toolkit)).sort((t,n)=>e.indexOf(t.runtime.type===`composio`?t.runtime.toolkit:``)-e.indexOf(n.runtime.type===`composio`?n.runtime.toolkit:``)))}n.status===`fulfilled`&&K(n.value),fe(!1)}}),()=>{e=!0}},[l]),(0,B.useEffect)(()=>()=>{z.current?.abort(),R.current?.close()},[]),(0,B.useEffect)(()=>()=>{A&&URL.revokeObjectURL(A)},[A]);let me=async(e,t=p)=>{await s(a(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),u(e)},Y=async e=>{E(null);let t=H[Math.max(0,Math.min(H.length-1,H.indexOf(l)+e))];try{await me(t)}catch(e){E(e instanceof Error?e.message:String(e))}},he=async(n=!1)=>{if(!(!e||x)){w(!0),E(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:p,r=e.voice&&M?.enabled&&ne.some(t=>t.id===e.voice)?{provider:M.provider,model:M.model,voice:e.voice}:void 0,i=(await s(a(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,o=!1;if(!n&&O)try{await W(i.agentId,O),i=(await s(a(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:i.revision,displayName:i.displayName,appearance:`custom`})})).payload}catch{o=!0}t(i,o)}catch(e){E(e instanceof Error?e.message:String(e))}finally{w(!1)}}},X=(0,B.useCallback)(async e=>{z.current?.abort(),R.current?.close();let t=new AbortController;z.current=t,I(e),E(null);try{let n=new te;R.current=n,await n.start();let r=await L(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>I(null))}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e)),I(null)}},[]);if(!g)return(0,V.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,V.jsx)(D,{className:`h-10 w-2/3`}),(0,V.jsx)(D,{className:`h-64 w-full rounded-2xl`}),(0,V.jsx)(D,{className:`h-12 w-full rounded-xl`})]});let Z=H.indexOf(l),ge={intro:n?`创建一个和你一起做事的助手`:`Create an assistant to work with you`,identity:n?`先给它一个形象和名字`:`Choose a look and a name`,voice:n?`想让我用什么声音回应?`:`How should your assistant sound?`,connections:n?`要让我了解哪些信息?`:`What information can your assistant use?`}[l];return(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,V.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,V.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[Z>0?(0,V.jsxs)(`button`,{type:`button`,disabled:x,onClick:()=>void Y(-1),className:`-ml-2 inline-flex min-h-10 items-center gap-1.5 rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:[(0,V.jsx)(d,{className:`size-4`}),n?`上一步`:`Back`]}):(0,V.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,V.jsx)(i,{to:`/chat`,className:`-mr-2 inline-flex min-h-10 items-center rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`稍后继续`:`Finish later`})]}),(0,V.jsx)(`div`,{className:`mt-4 grid grid-cols-4 gap-1.5`,role:`progressbar`,"aria-label":n?`设置进度`:`Setup progress`,"aria-valuenow":Z+1,"aria-valuemin":1,"aria-valuemax":H.length,children:H.map((e,t)=>(0,V.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=Z?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,V.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,V.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,V.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,V.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:A?(0,V.jsx)(`img`,{src:A,alt:``,className:`size-14 rounded-xl object-cover`}):(0,V.jsx)(S,{appearance:p.appearance,className:`size-14`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,V.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:p.displayName||`Ada`})]})]}),(0,V.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${Z+1} 步 · 共 ${H.length} 步`:`Step ${Z+1} of ${H.length}`}),(0,V.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:ge}),l===`intro`&&(0,V.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,V.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,V.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,V.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),l===`identity`&&(0,V.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,V.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,V.jsx)(`input`,{value:p.displayName,maxLength:60,onChange:e=>h(t=>({...t,displayName:e.target.value})),onBlur:()=>h(e=>({...e,displayName:e.displayName.trim()||`Ada`})),className:`mt-2 block w-full rounded-xl border border-edge bg-surface-panel px-4 py-3 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[le.map(e=>(0,V.jsxs)(`button`,{type:`button`,"aria-pressed":!O&&p.appearance===e.id,onClick:()=>{k(null),j(null),h(t=>({...t,appearance:e.id}))},className:`flex min-h-28 flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${!O&&p.appearance===e.id?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,V.jsx)(S,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,V.jsxs)(`label`,{className:`flex min-h-28 cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-within:ring-2 focus-within:ring-accent ${O?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,V.jsx)(T,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,V.jsx)(`input`,{className:`sr-only`,type:`file`,accept:`image/png,image/jpeg,image/webp`,onChange:e=>{let t=e.target.files?.[0];if(t){if(t.size>512*1024||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){E(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}k(t),j(URL.createObjectURL(t))}}})]})]}),(0,V.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n?`自定义图片在创建助手时上传;刷新后需要重新选择。`:`Custom images upload when you create the assistant; select again after a refresh.`})]})]}),l===`voice`&&(0,V.jsxs)(`div`,{className:`mt-5`,children:[(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`用于这个助手的语音通话;文字回答不受影响。试听不会使用麦克风。`:`This affects calls with this assistant. Text stays the same. Preview does not use your microphone.`}),P?(0,V.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(D,{className:`h-20 rounded-xl`}),(0,V.jsx)(D,{className:`h-20 rounded-xl`})]}):M?.enabled&&ne.length>0?(0,V.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-pressed":!p.voice,onClick:()=>h(e=>({...e,voice:null})),className:`rounded-xl p-4 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${p.voice?`bg-surface-panel text-fg-muted hover:bg-surface-hover`:`bg-accent/10 text-fg ring-1 ring-accent/40`}`,children:n?`使用默认声音`:`Use the default voice`}),ne.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${p.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-pressed":p.voice===e.id,onClick:()=>h(t=>({...t,voice:e.id})),children:[(0,V.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,V.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void X(e.id),className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-hover text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`试听${e.name}`:`Preview ${e.name}`,children:(0,V.jsx)(C,{className:`size-4 ${oe===e.id?`text-accent`:``}`})})]},e.id))]}):(0,V.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,V.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,V.jsx)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),l===`connections`&&(0,V.jsxs)(`div`,{className:`mt-5`,children:[(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`现在连接,或进入对话后再添加。连接不会自动读取历史数据或创建持续关注。`:`Connect now or add sources later. Connecting does not automatically scan history or create ongoing monitoring.`}),G?(0,V.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,V.jsx)(D,{className:`h-18 rounded-xl`}),(0,V.jsx)(D,{className:`h-18 rounded-xl`})]}):(0,V.jsx)(`div`,{className:`mt-5 space-y-2`,children:ue.length?ue.map(e=>{let t=U(pe.find(t=>t.connectorId===e.id));return(0,V.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,V.jsx)(v,{connector:e,size:`sm`}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,V.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,V.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,V.jsx)(m,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,V.jsx)(`button`,{type:`button`,onClick:()=>J(y(e)),className:`rounded-lg bg-surface-hover px-3 py-2 text-xs text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`连接`:`Connect`})]},e.id)}):(0,V.jsx)(`p`,{className:`rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:n?`暂无可用的推荐服务;你仍可直接进入对话。`:`No suggested services are available. You can continue to chat.`})})]}),!e&&(0,V.jsxs)(`p`,{className:`mt-5 rounded-xl bg-warning/5 p-4 text-sm text-fg-muted`,children:[n?`开始前需要一个可用模型。`:`A compatible model is required before you start.`,` `,(0,V.jsx)(i,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),ee&&(0,V.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:ee})]},l)}),(0,V.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,V.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[l===`intro`&&(0,V.jsx)(`button`,{type:`button`,disabled:!e||x,onClick:()=>void he(!0),className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:n?`用默认设置开始`:`Use defaults`}),l===`voice`&&(0,V.jsx)(`button`,{type:`button`,onClick:()=>{let e={...p,voice:null};h(e),E(null),me(`connections`,e).catch(e=>E(e instanceof Error?e.message:String(e)))},className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`跳过`:`Skip`}),(0,V.jsxs)(`button`,{type:`button`,disabled:x||l===`connections`&&!e,onClick:()=>l===`connections`?void he():void Y(1),className:`flex min-h-11 items-center gap-2 rounded-xl bg-accent px-5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:opacity-40`,children:[x?n?`正在创建…`:`Creating…`:l===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!x&&(0,V.jsx)(f,{className:`size-4`})]})]})]})}),q&&(0,V.jsx)(b,{draft:q,onChange:J,onClose:()=>J(null),t:c(r).connectorsSettings,onInstalled:async()=>{K(await re()),J(null)}})]})}function de({record:e,zh:t,onSelectVoice:n,onGreetingChange:r}){let[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(!0),[l,u]=(0,B.useState)(``),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)([]),[g,_]=(0,B.useState)(e.voicePreference?.voice??``),[v,y]=(0,B.useState)(!1),[b,x]=(0,B.useState)(null),[S,w]=(0,B.useState)(null),T=(0,B.useRef)(null),E=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await ce();if(e||(o(t.openingGreeting===!0),!t.enabled||!t.tts))return;let n={provider:t.tts.provider,model:t.tts.model};f(n);let r=await se(n.provider,n.model,`realtime`);e||m(r)}catch(t){e||x(t instanceof Error?t.message:String(t))}finally{e||c(!1)}})(),()=>{e=!0}},[]),(0,B.useEffect)(()=>()=>{E.current?.abort(),T.current?.close()},[]);let O=()=>{E.current?.abort(),E.current=null,T.current?.close(),T.current=null,w(null)},k=async e=>{if(S!==null){O();return}O(),x(null);let n=new AbortController;E.current=n,w(e);try{let t=new te;T.current=t,await t.start();let r=await L(n.signal,e);n.signal.aborted||t.enqueue(r,()=>{E.current===n&&(w(null),E.current=null,T.current=null,t.close())})}catch(e){if(!n.signal.aborted){let n=e?.body?.error?.code;x(t&&n===`unsupported_voice`?`当前音色暂不可用,请刷新语音目录或选择其他音色。`:e instanceof Error?e.message:String(e))}E.current===n&&O()}},A=async e=>{if(v||e===g)return;O();let t=g;_(e),u(``),y(!0),x(null);try{await n(e&&d?{provider:d.provider,model:d.model,voice:e}:null)||_(t)}catch(e){_(t),x(e instanceof Error?e.message:String(e))}finally{y(!1)}},j=p.find(e=>e.id===g),M=t?`默认声音`:`Default voice`,N=j?.name||(g?t?`当前音色不可用`:`Current voice unavailable`:M),P=l.trim().toLocaleLowerCase(),F=p.filter(e=>!P||`${e.name} ${e.description??``} ${e.style??``}`.toLocaleLowerCase().includes(P)).map(e=>({value:e.id,label:e.name}));return(0,V.jsxs)(`section`,{className:`border-t border-edge pt-5`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:t?`通话声音`:`Call voice`}),s?(0,V.jsx)(`div`,{className:`mt-3`,"aria-busy":`true`,children:(0,V.jsx)(D,{className:`h-10 w-full`})}):d&&p.length?(0,V.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,V.jsx)(h,{value:g,selectedLabel:N,options:F,placeholder:M,emptyLabel:M,ariaLabel:t?`选择通话音色`:`Choose call voice`,disabled:v,onChange:e=>void A(e),searchPlaceholder:p.length>8?t?`搜索音色`:`Search voices`:void 0,searchValue:l,onSearchChange:u,statusMessage:P&&!F.length?t?`没有匹配的音色`:`No matching voices`:void 0})}),(0,V.jsxs)(`button`,{type:`button`,disabled:v||!!(g&&!j),onClick:()=>void k(g),className:`touch-target flex h-10 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-edge px-3 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,title:S===null?t?`试听${N}`:`Preview ${N}`:t?`停止试听`:`Stop preview`,"aria-label":S===null?t?`试听${N}`:`Preview ${N}`:t?`停止试听`:`Stop preview`,children:[S===null?(0,V.jsx)(C,{className:`size-4`,"aria-hidden":!0}):(0,V.jsx)(ee,{className:`size-4 text-accent`,"aria-hidden":!0}),S===null?t?`试听`:`Preview`:t?`停止`:`Stop`]})]}),(0,V.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:j?.description||j?.style||(g?t?`选择后自动保存,用于之后的语音通话。`:`Saved automatically for future voice calls.`:t?`跟随语音服务的默认音色。`:`Uses the voice service’s default voice.`)})]}):(0,V.jsxs)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:[t?`当前没有可用音色。`:`No voice is ready.`,` `,(0,V.jsx)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`})]}),r&&a&&(0,V.jsxs)(`label`,{className:`mt-4 flex items-center justify-between gap-3 text-sm text-fg`,children:[t?`连接时打招呼`:`Greet me when connected`,(0,V.jsx)(`input`,{type:`checkbox`,checked:e.voiceCallPreferences?.openingGreetingEnabled??!0,disabled:v,onChange:e=>{let t=e.target.checked;y(!0),r(t).catch(e=>x(String(e))).finally(()=>y(!1))}})]}),b&&(0,V.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:b})]})}var G=new A;function fe({conversationId:e,zh:t,onSaved:n}){let r=O(t=>t.sessions[e]),[i,a]=(0,B.useState)(!0),[o,s]=(0,B.useState)(``);(0,B.useEffect)(()=>{let t=!0;return G.loadSessionAgentConfig(e).then(n=>{t&&k(e,n)}).catch(e=>{t&&s(String(e))}).finally(()=>{t&&a(!1)}),()=>{t=!1}},[e]);let l=!!r?.modelConfigSaving;async function d(t,i){O.getState().patchSessionMeta(e,{modelConfigSaving:!0});try{k(e,await G.patchSessionAgentConfig(e,{model:t,thinkingLevel:i,configVersion:r?.configVersion})),await n()}catch(t){let n=await G.loadSessionAgentConfig(e).catch(()=>null);throw n&&k(e,n),t}finally{O.getState().patchSessionMeta(e,{modelConfigSaving:!1})}}return(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:t?`对话模型与思考强度`:`Conversation model and thinking`}),i?(0,V.jsx)(D,{className:`h-9 w-full`}):(0,V.jsx)(u,{chat:c(t?`zh`:`en`).chat,sessionModel:r?.model??``,thinkingLevel:r?.thinkingLevel??`off`,modelDisabled:l,thinkingDisabled:l,onModelChange:d,onThinkingChange:e=>d(r?.model??``,e)}),o&&(0,V.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:o})]})}var pe=5;function K(e){let t=e.replace(/\s+/g,` `).trim();if(t.length<=58)return t;let n=t.replace(/([^)]{1,80})|\([^)]{1,80}\)/g,``).replace(/([A-Za-z0-9])(?=[\u4e00-\u9fff])/g,`$1 `).replace(/\s+/g,` `).trim(),r=n.split(/[。!?;;,]/,1)[0]?.trim()||n;return r.length>58?`${r.slice(0,57).trimEnd()}…`:r}function q(e,t){if(e.phase===`closed`)return{label:t?`已结束`:`Finished`,tone:`bg-fg-subtle`};let n=e.operationalState??e.runStatus;return n===`running`?{label:t?`正在执行`:`Working`,tone:`bg-accent`}:n===`queued`?{label:t?`等待开始`:`Queued`,tone:`bg-fg-subtle`}:n===`failed`?{label:t?`执行失败`:`Failed`,tone:`bg-danger`}:n===`waiting`?{label:t?`等待继续`:`Waiting`,tone:`bg-warning`}:n===`blocked`?{label:t?`已阻塞`:`Blocked`,tone:`bg-warning`}:n===`verifying`?{label:t?`正在验证`:`Verifying`,tone:`bg-accent`}:n===`cancelled`?{label:t?`执行已取消`:`Cancelled`,tone:`bg-fg-subtle`}:e.phase===`review`?{label:t?`等待验收`:`In review`,tone:`bg-warning`}:e.phase===`active`?{label:t?`正在推进`:`In progress`,tone:`bg-accent`}:e.phase===`ready`?{label:t?`准备开始`:`Ready`,tone:`bg-fg-subtle`}:{label:t?`待处理`:`Planned`,tone:`bg-fg-subtle`}}function J(e){let t=(0,z.c)(30),{item:n,zh:r}=e,a;t[0]!==n||t[1]!==r?(a=q(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]===n.id?s=t[4]:(s=_(`/personal`,n.id),t[3]=n.id,t[4]=s);let c=`mt-2 size-1.5 shrink-0 rounded-full ${o.tone}`,l;t[5]===c?l=t[6]:(l=(0,V.jsx)(`span`,{className:c,"aria-hidden":!0}),t[5]=c,t[6]=l);let u;t[7]===n.title?u=t[8]:(u=K(n.title),t[7]=n.title,t[8]=u);let d;t[9]===u?d=t[10]:(d=(0,V.jsx)(`span`,{className:`line-clamp-2 break-words text-sm font-medium leading-5 text-fg`,children:u}),t[9]=u,t[10]=d);let f;t[11]===o.label?f=t[12]:(f=(0,V.jsx)(`span`,{children:o.label}),t[11]=o.label,t[12]=f);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,V.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`·`}),t[13]=m):m=t[13];let h=r?`zh`:`en`,g;t[14]!==n.updatedAt||t[15]!==h?(g=R(n.updatedAt,h),t[14]=n.updatedAt,t[15]=h,t[16]=g):g=t[16];let v;t[17]===g?v=t[18]:(v=(0,V.jsx)(`span`,{children:g}),t[17]=g,t[18]=v);let y;t[19]!==v||t[20]!==f?(y=(0,V.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2 text-xs text-fg-muted`,children:[f,m,v]}),t[19]=v,t[20]=f,t[21]=y):y=t[21];let b;t[22]!==y||t[23]!==d?(b=(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,y]}),t[22]=y,t[23]=d,t[24]=b):b=t[24];let x;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,V.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0}),t[25]=x):x=t[25];let S;return t[26]!==b||t[27]!==s||t[28]!==l?(S=(0,V.jsxs)(i,{to:s,className:`group flex min-w-0 items-start gap-3 rounded-2xl bg-surface-panel px-4 py-4 transition-colors duration-150 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[l,b,x]}),t[26]=b,t[27]=s,t[28]=l,t[29]=S):S=t[29],S}var me=[{id:`loopi`,zh:`Loopi`,en:`Loopi`,color:`bg-slate-100/50 dark:bg-slate-400/10`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`,color:`bg-blue-100/50 dark:bg-blue-400/10`},{id:`loopi-care`,zh:`温和`,en:`Gentle`,color:`bg-violet-100/50 dark:bg-violet-400/10`}];function Y(){let e=ae(),t=(0,B.useRef)(e);t.current=e;let n=o(e=>e.language)===`zh`,r=oe(e=>e.setPageHeader),i=oe(e=>e.clearPageHeader),[c,u]=(0,B.useState)(null),d=(0,B.useRef)(null),f=(0,B.useRef)(Promise.resolve()),[p,m]=(0,B.useState)([]),[h,_]=(0,B.useState)(!0),[v,y]=(0,B.useState)(0),[b,C]=(0,B.useState)(null),[ee,te]=(0,B.useState)(!1),[O,k]=(0,B.useState)(`loopi`),[A,re]=(0,B.useState)(!1),ie=(0,B.useRef)(null),L=(0,B.useRef)(null),se=(0,B.useRef)(null),[ce,R]=(0,B.useState)(``),[z,H]=(0,B.useState)(!1),[le,U]=(0,B.useState)(!1),[W,G]=(0,B.useState)(!1),[K,q]=(0,B.useState)(null),[Y,he]=(0,B.useState)(!1),[X,Z]=(0,B.useState)(!1),[ge,_e]=(0,B.useState)(!1),[Q,ve]=(0,B.useState)(0),$=(0,B.useRef)(0),ye=(0,B.useCallback)(()=>{G(!1),U(!1),H(!0)},[]),be=(0,B.useCallback)(()=>{G(!1),U(!1),H(e=>!e)},[]),xe=(0,B.useCallback)(async()=>{try{let[e,t]=await Promise.all([s(a(`/api/personal-agent`)),s(a(`/api/personal-agent/models`))]);d.current=e.payload,u(e.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),m(t.payload),e.payload&&(R(e.payload.displayName),k(e.payload.appearance))}catch(e){C(e instanceof Error?e.message:String(e))}finally{_(!1)}},[]);(0,B.useEffect)(()=>{xe()},[xe]);let Se=(0,B.useCallback)(e=>{y(e=>e+1),C(null);let t=f.current.then(async()=>{let t=d.current;if(!t)return!1;let n=e.displayName?.trim()||t.displayName,r=e.appearance??t.appearance,i=e.voicePreference===void 0?t.voicePreference:e.voicePreference;if(n===t.displayName&&r===t.appearance&&JSON.stringify(i)===JSON.stringify(t.voicePreference)&&(!e.voiceCallPreferences||JSON.stringify(e.voiceCallPreferences)===JSON.stringify(t.voiceCallPreferences)))return!0;try{let o=await s(a(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:t.revision,displayName:n,appearance:r,...e.voicePreference===void 0?{}:{voicePreference:i},...e.voiceCallPreferences?{voiceCallPreferences:e.voiceCallPreferences}:{}})});return d.current=o.payload,u(o.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:o.payload})),!0}catch(e){return C(e instanceof Error?e.message:String(e)),!1}}).finally(()=>y(e=>e-1));return f.current=t,t},[]),Ce=(0,B.useCallback)(async()=>{let e=++$.current;G(!0),q(null),he(!1),Z(!1),_e(!1),ve(0);try{let t=await s(a(`/api/personal-agent/activity?limit=${pe}&offset=0`));if(e!==$.current)return;q(t.payload),ve(t.payload.items.length)}catch{e===$.current&&he(!0)}},[]),we=(0,B.useCallback)(async()=>{if(!K||X||Q>=K.total)return;let e=$.current;Z(!0),_e(!1);try{let t=await s(a(`/api/personal-agent/activity?limit=${pe}&offset=${Q}`));if(e!==$.current)return;q(e=>e?{total:t.payload.total,items:[...e.items,...t.payload.items.filter(t=>!e.items.some(e=>e.id===t.id))]}:t.payload),ve(e=>e+t.payload.items.length)}catch{e===$.current&&_e(!0)}finally{e===$.current&&Z(!1)}},[K,Q,X]);(0,B.useEffect)(()=>{if(!W||!K||X)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(async()=>{let e=$.current;try{let t=await s(a(`/api/personal-agent/activity?limit=${Math.max(pe,Math.min(100,Q))}&offset=0`));if(e!==$.current)return;q(t.payload),ve(t.payload.items.length)}catch{}},120)},n=window.setInterval(t,5e3);return window.addEventListener(`task-changed-v2`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.clearTimeout(e),window.clearInterval(n),window.removeEventListener(`task-changed-v2`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[K,Q,X,W]);let Te=async e=>{if(!c||![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){C(n?`请选择 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image.`);return}if(e.size===0||e.size>512*1024){C(n?`图片大小不能超过 512 KB。`:`Image must be 512 KB or smaller.`);return}re(!0),C(null);try{let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(e)});await s(a(`/api/agents/${encodeURIComponent(c.agentId)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:t.slice(t.indexOf(`,`)+1),mimeType:e.type})}),I(c.agentId),k(`custom`),U(!1),await Se({appearance:`custom`})}catch(e){C(e instanceof Error?e.message:String(e))}finally{re(!1)}};(0,B.useLayoutEffect)(()=>{let a=c?.state===`ready`,o=a?c.appearance:O,s=a?c.displayName:`Ada`;return r({startExtra:null,main:(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[a?(0,V.jsx)(`button`,{ref:se,type:`button`,onClick:be,"aria-expanded":z,className:`touch-target -m-1 shrink-0 rounded-full p-1 transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`编辑${s}的资料`:`Edit ${s}'s profile`,title:n?`资料`:`Profile`,children:(0,V.jsx)(`span`,{className:`flex size-8 items-center justify-center`,children:(0,V.jsx)(S,{appearance:o,agentId:c?.agentId,className:`size-8`})})}):(0,V.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center`,children:(0,V.jsx)(S,{appearance:o,agentId:c?.agentId,className:`size-8`})}),(0,V.jsx)(`h1`,{className:`min-w-0 truncate text-sm font-semibold text-fg sm:text-base`,children:s})]}),end:a?(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(`button`,{type:`button`,disabled:e.active,onClick:()=>{c?.state===`ready`&&t.current.open({conversationId:c.conversationId,name:c.displayName,mode:`assistant`})},className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,"aria-label":n?`语音通话`:`Voice call`,title:n?`语音通话`:`Voice call`,children:(0,V.jsx)(x,{className:`size-5`})}),(0,V.jsxs)(N,{open:W,onOpenChange:e=>{e?Ce():G(!1)},children:[(0,V.jsx)(F,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,"aria-pressed":W,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`正在做的事`:`Activity`,children:(0,V.jsx)(g,{className:`size-5`})})}),(0,V.jsx)(j,{children:(0,V.jsxs)(M,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`派发的任务`:`Delegated tasks`,className:`z-50 flex h-[min(34rem,calc(100dvh-6rem))] w-[min(22rem,calc(100vw-1rem))] min-h-0 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl focus:outline-none`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-6 pb-3 pt-6`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n?`交给我推进的事`:`Delegated work`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:K?n?`最近更新 · 共 ${K.total} 项`:`Recently updated · ${K.total} total`:n?`查看任务进展与结果`:`Follow progress and results`})]}),(0,V.jsx)(P,{className:`touch-target -mr-2 -mt-1 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`关闭活动`:`Close activity`,children:(0,V.jsx)(E,{className:`size-4`})})]}),(0,V.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-5 pt-3`,children:[!K&&!Y&&(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(D,{className:`h-18 rounded-2xl`}),(0,V.jsx)(D,{className:`h-18 rounded-2xl`}),(0,V.jsx)(D,{className:`h-18 rounded-2xl`})]}),Y&&(0,V.jsxs)(`div`,{className:`px-5 py-12 text-center`,children:[(0,V.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`暂时无法读取任务`:`Could not load tasks`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void Ce(),className:`mt-3 rounded-lg px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:n?`重试`:`Try again`})]}),K?.items.length===0&&(0,V.jsxs)(`div`,{className:`px-5 py-16 text-center`,children:[(0,V.jsx)(g,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,V.jsx)(`p`,{className:`mt-4 text-sm font-medium text-fg`,children:n?`还没有派发的任务`:`No delegated work yet`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`你可以在对话里直接告诉我想推进的事。`:`Tell me what you would like to move forward in chat.`})]}),K&&K.items.length>0&&(0,V.jsx)(`div`,{className:`space-y-2`,children:K.items.map(e=>(0,V.jsx)(J,{item:e,zh:n},e.id))}),K&&Q<K.total&&(0,V.jsxs)(`div`,{className:`pt-4 text-center`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>void we(),disabled:X,className:`min-h-10 rounded-xl bg-surface-panel px-5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-50`,children:X?n?`正在加载…`:`Loading…`:n?`加载更多`:`Load more`}),ge&&(0,V.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:n?`加载失败,请重试`:`Could not load more. Try again.`})]})]})]})})]}),(0,V.jsx)(`button`,{ref:L,type:`button`,onClick:be,"aria-expanded":z,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`编辑资料`:`Edit profile`,children:(0,V.jsx)(w,{className:`size-5`})})]}):null}),()=>i()},[K,Y,Q,X,ge,O,i,we,Ce,c,r,W,z,be,e.active,n]);function Ee(){return c?(0,V.jsxs)(N,{open:z,onOpenChange:e=>{H(e),e||U(!1)},children:[(0,V.jsx)(ne,{virtualRef:L}),(0,V.jsx)(j,{children:(0,V.jsxs)(M,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`编辑 Personal AI`:`Edit Personal AI`,onInteractOutside:e=>{e.target instanceof Node&&(L.current?.contains(e.target)||se.current?.contains(e.target))&&e.preventDefault()},className:`z-50 flex w-[min(22rem,calc(100vw-1rem))] flex-col rounded-2xl border border-edge bg-surface-overlay shadow-xl outline-none`,children:[(0,V.jsxs)(`div`,{className:`relative flex shrink-0 flex-col items-center px-4 pt-4 text-center`,children:[(0,V.jsx)(`button`,{type:`button`,disabled:A,onClick:()=>U(e=>!e),"aria-expanded":le,"aria-controls":`personal-appearance-options`,"aria-label":n?`选择头像`:`Choose avatar`,className:`rounded-full transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,V.jsx)(S,{appearance:O,agentId:c.agentId,className:`size-16`})}),(0,V.jsx)(`input`,{id:`personal-name`,"aria-label":n?`助手名称`:`Assistant name`,value:ce,onChange:e=>R(e.target.value),onBlur:e=>{let t=e.currentTarget.value.trim();t?(R(t),Se({displayName:t})):R(d.current?.displayName??``)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=d.current?.displayName??``,R(e.currentTarget.value),e.currentTarget.blur())},maxLength:60,placeholder:`Ada`,className:`mt-2 w-full min-w-0 rounded-lg border border-transparent bg-transparent px-2 py-1 text-center text-lg font-semibold text-fg outline-none transition-colors hover:border-edge focus:border-edge focus:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`}),v>0&&(0,V.jsx)(`span`,{className:`absolute right-4 top-4 text-xs text-fg-muted`,children:n?`正在保存…`:`Saving…`})]}),(0,V.jsxs)(`div`,{className:`space-y-4 px-4 py-4`,children:[b&&(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:b}),le&&(0,V.jsxs)(`section`,{id:`personal-appearance-options`,children:[(0,V.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`形象`:`Appearance`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[me.map(e=>(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{k(e.id),U(!1),Se({appearance:e.id})},"aria-pressed":O===e.id,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${O===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,V.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full ${e.color}`,children:(0,V.jsx)(S,{appearance:e.id,className:`size-8`})}),(0,V.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:n?e.zh:e.en})]},e.id)),(0,V.jsx)(`input`,{ref:ie,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`sr-only`,"aria-label":n?`上传头像`:`Upload avatar`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&Te(t),e.currentTarget.value=``}}),(0,V.jsxs)(`button`,{type:`button`,disabled:A,onClick:()=>ie.current?.click(),"aria-pressed":O===`custom`,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50 ${O===`custom`?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,V.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-surface-panel`,children:O===`custom`?(0,V.jsx)(S,{appearance:`custom`,agentId:c.agentId,className:`size-8`}):(0,V.jsx)(T,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),(0,V.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:A?n?`上传中…`:`Uploading…`:n?`上传`:`Upload`})]})]})]}),(0,V.jsx)(de,{onGreetingChange:e=>Se({voiceCallPreferences:{openingGreetingEnabled:e}}),record:c,zh:n,onSelectVoice:e=>Se({voicePreference:e})}),(0,V.jsx)(`div`,{className:`border-t border-edge pt-4`,children:(0,V.jsx)(fe,{conversationId:c.conversationId,zh:n,onSaved:async()=>{let e=await s(a(`/api/personal-agent`));e.ok&&e.payload&&(d.current=e.payload,u(e.payload))}})})]})]})})]}):null}return h?(0,V.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,V.jsx)(D,{className:`h-20 w-20 rounded-full`}),(0,V.jsx)(D,{className:`h-9 w-72`}),(0,V.jsx)(D,{className:`h-44 w-full rounded-2xl`})]}):c?.state===`ready`?(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[ee&&(0,V.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 items-center justify-between gap-3 border-b border-warning/30 bg-warning/5 px-5 py-3 text-sm text-fg-muted`,children:[(0,V.jsx)(`span`,{children:n?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>{te(!1),ye()},className:`shrink-0 text-accent hover:underline`,children:n?`打开设置`:`Open settings`})]}),(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,V.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,V.jsx)(l,{embedded:!0,personal:!0,personalWelcome:{name:c.displayName,addressAs:c.userCallName??void 0,avatar:(0,V.jsx)(S,{appearance:c.appearance,agentId:c.agentId,className:`size-14`}),opening:n?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`},conversationId:c.conversationId})})}),Ee()]}):(0,V.jsx)(ue,{modelsAvailable:p.length>0,onCreated:(e,t)=>{d.current=e,u(e),R(e.displayName),te(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{Y as PersonalPage};
@@ -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{i,n as a,o}from"./locale-store-Bg_XR36n.js";import{t as s}from"./popover-select-DD8fmrxH.js";import{t as c}from"./skeleton-BI5TyibZ.js";import{t as l}from"./personal-proactivity-DaRnbB1f.js";import{t as u}from"./use-personal-profile-MusPgljM.js";import{n as d,t as f}from"./settings-page-header-CyUHrn7c.js";import"./settings-page-layout-DGVqXrlp.js";var p=n(),m=e(t(),1),h=r();function g(){try{return[`UTC`,...Intl.supportedValuesOf(`timeZone`)]}catch{return[`UTC`,`Asia/Shanghai`,`Asia/Hong_Kong`,`Asia/Taipei`,`Asia/Tokyo`,`Asia/Seoul`,`Asia/Singapore`,`Asia/Kolkata`,`Asia/Dubai`,`Europe/London`,`Europe/Paris`,`Europe/Berlin`,`America/New_York`,`America/Chicago`,`America/Denver`,`America/Los_Angeles`,`Australia/Sydney`,`Pacific/Auckland`]}}var _=g();function v({zh:e}){let[t,n]=(0,m.useState)(),[r,a]=(0,m.useState)(``),[u,d]=(0,m.useState)(!1),[f,p]=(0,m.useState)(``),g=f.trim().toLowerCase().replaceAll(`_`,` `),v=[...new Set([..._,t?.timezone].filter(e=>!!e))].sort().filter(e=>e.replaceAll(`_`,` `).toLowerCase().includes(g)).map(e=>({value:e,label:e.replaceAll(`_`,` `),group:e.split(`/`)[0]}));(0,m.useEffect)(()=>{let e=!0;return o(i(`/api/personal-agent/proactivity`)).then(t=>{e&&t.ok&&n(l.parse(t.payload))}).catch(t=>{e&&a(String(t))}),()=>{e=!1}},[]);async function y(e){if(!(!t||u)){d(!0),a(``);try{let r=await o(i(`/api/personal-agent/proactivity`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,...e})});r.ok&&n(l.parse(r.payload))}catch(e){a(String(e));let t=await o(i(`/api/personal-agent/proactivity`)).catch(()=>null);t?.ok&&n(l.parse(t.payload))}finally{d(!1)}}}return(0,h.jsxs)(`section`,{className:`space-y-3 border-t border-edge pt-5`,children:[(0,h.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:e?`主动联系`:`Proactive messages`}),!t&&!r?(0,h.jsx)(c,{className:`h-9 w-full`}):t&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{placeholder:e?`选择主动方式`:`Choose participation`,value:t.mode,disabled:u,allowEmpty:!1,options:[{value:`off`,label:e?`关闭主动联系`:`Off`},{value:`follow_up`,label:e?`仅明确跟进`:`Requested follow-ups`},{value:`balanced`,label:e?`适度主动`:`Thoughtful participation`}],onChange:e=>void y({mode:e})}),(0,h.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,h.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`免打扰开始`:`Quiet from`,(0,h.jsx)(s,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietStart),disabled:u,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void y({quietStart:Number(e)})})]}),(0,h.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`免打扰结束`:`Quiet until`,(0,h.jsx)(s,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietEnd),disabled:u,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void y({quietEnd:Number(e)})})]})]}),(0,h.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[e?`时区`:`Timezone`,(0,h.jsx)(s,{placeholder:e?`选择时区`:`Choose timezone`,ariaLabel:e?`时区`:`Timezone`,value:t.timezone,selectedLabel:t.timezone.replaceAll(`_`,` `),options:v,disabled:u,allowEmpty:!1,triggerClassName:`mt-1`,searchPlaceholder:e?`搜索时区或城市`:`Search timezone or city`,searchValue:f,onSearchChange:p,statusMessage:v.length?void 0:e?`没有匹配的时区`:`No matching timezones`,onChange:e=>{p(``),e!==t.timezone&&y({timezone:e})}})]}),(0,h.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`有值得交流的进展时,在聊天里留下消息。明确请求的结果会照常交付。`:`Useful developments appear in this chat. Requested results are delivered as usual.`})]}),r&&(0,h.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:r})]})}function y(){let e=(0,p.c)(8),{displayName:t}=u(),n=a(b)===`zh`,r=n?`设置 ${t} 主动联系你的方式和免打扰时段。`:`Manage proactive messages from ${t} and quiet hours.`,i;e[0]!==t||e[1]!==r?(i=(0,h.jsx)(f,{title:t,subtitle:r}),e[0]=t,e[1]=r,e[2]=i):i=e[2];let o;e[3]===n?o=e[4]:(o=(0,h.jsx)(v,{zh:n}),e[3]=n,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,h.jsxs)(d,{children:[i,o]}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function b(e){return e.language}export{y as PersonalSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,n as a,o}from"./locale-store-Br7IfbXK.js";import{t as s}from"./popover-select-CEMWIrtY.js";import{t as c}from"./skeleton-BI5TyibZ.js";import{t as l}from"./personal-proactivity-DaRnbB1f.js";import{t as u}from"./use-personal-profile-D2Un8G1L.js";import{n as d,t as f}from"./settings-page-header-BZl4AMiN.js";import"./settings-page-layout-onhEgq-K.js";var p=n(),m=e(t(),1),h=r();function g(){try{return[`UTC`,...Intl.supportedValuesOf(`timeZone`)]}catch{return[`UTC`,`Asia/Shanghai`,`Asia/Hong_Kong`,`Asia/Taipei`,`Asia/Tokyo`,`Asia/Seoul`,`Asia/Singapore`,`Asia/Kolkata`,`Asia/Dubai`,`Europe/London`,`Europe/Paris`,`Europe/Berlin`,`America/New_York`,`America/Chicago`,`America/Denver`,`America/Los_Angeles`,`Australia/Sydney`,`Pacific/Auckland`]}}var _=g();function v({zh:e}){let[t,n]=(0,m.useState)(),[r,a]=(0,m.useState)(``),[u,d]=(0,m.useState)(!1),[f,p]=(0,m.useState)(``),g=f.trim().toLowerCase().replaceAll(`_`,` `),v=[...new Set([..._,t?.timezone].filter(e=>!!e))].sort().filter(e=>e.replaceAll(`_`,` `).toLowerCase().includes(g)).map(e=>({value:e,label:e.replaceAll(`_`,` `),group:e.split(`/`)[0]}));(0,m.useEffect)(()=>{let e=!0;return o(i(`/api/personal-agent/proactivity`)).then(t=>{e&&t.ok&&n(l.parse(t.payload))}).catch(t=>{e&&a(String(t))}),()=>{e=!1}},[]);async function y(e){if(!(!t||u)){d(!0),a(``);try{let r=await o(i(`/api/personal-agent/proactivity`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,...e})});r.ok&&n(l.parse(r.payload))}catch(e){a(String(e));let t=await o(i(`/api/personal-agent/proactivity`)).catch(()=>null);t?.ok&&n(l.parse(t.payload))}finally{d(!1)}}}return(0,h.jsxs)(`section`,{className:`space-y-3 border-t border-edge pt-5`,children:[(0,h.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:e?`主动联系`:`Proactive messages`}),!t&&!r?(0,h.jsx)(c,{className:`h-9 w-full`}):t&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{placeholder:e?`选择主动方式`:`Choose participation`,value:t.mode,disabled:u,allowEmpty:!1,options:[{value:`off`,label:e?`关闭主动联系`:`Off`},{value:`follow_up`,label:e?`仅明确跟进`:`Requested follow-ups`},{value:`balanced`,label:e?`适度主动`:`Thoughtful participation`}],onChange:e=>void y({mode:e})}),(0,h.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,h.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`免打扰开始`:`Quiet from`,(0,h.jsx)(s,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietStart),disabled:u,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void y({quietStart:Number(e)})})]}),(0,h.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`免打扰结束`:`Quiet until`,(0,h.jsx)(s,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietEnd),disabled:u,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void y({quietEnd:Number(e)})})]})]}),(0,h.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[e?`时区`:`Timezone`,(0,h.jsx)(s,{placeholder:e?`选择时区`:`Choose timezone`,ariaLabel:e?`时区`:`Timezone`,value:t.timezone,selectedLabel:t.timezone.replaceAll(`_`,` `),options:v,disabled:u,allowEmpty:!1,triggerClassName:`mt-1`,searchPlaceholder:e?`搜索时区或城市`:`Search timezone or city`,searchValue:f,onSearchChange:p,statusMessage:v.length?void 0:e?`没有匹配的时区`:`No matching timezones`,onChange:e=>{p(``),e!==t.timezone&&y({timezone:e})}})]}),(0,h.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`有值得交流的进展时,在聊天里留下消息。明确请求的结果会照常交付。`:`Useful developments appear in this chat. Requested results are delivered as usual.`})]}),r&&(0,h.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:r})]})}function y(){let e=(0,p.c)(8),{displayName:t}=u(),n=a(b)===`zh`,r=n?`设置 ${t} 主动联系你的方式和免打扰时段。`:`Manage proactive messages from ${t} and quiet hours.`,i;e[0]!==t||e[1]!==r?(i=(0,h.jsx)(f,{title:t,subtitle:r}),e[0]=t,e[1]=r,e[2]=i):i=e[2];let o;e[3]===n?o=e[4]:(o=(0,h.jsx)(v,{zh:n}),e[3]=n,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,h.jsxs)(d,{children:[i,o]}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function b(e){return e.language}export{y as PersonalSettingsPanel};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{i as r,n as i,o as a}from"./locale-store-Bg_XR36n.js";import{t as o}from"./chevron-down-ccbiQQz_.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./download-Dk-ZjtO6.js";import{t as l}from"./refresh-cw-BRlGaq2w.js";import{t as u}from"./wrench-DFb4r8bH.js";import{t as d}from"./button-CnRSIP6m.js";import{t as f}from"./skeleton-BI5TyibZ.js";import{i as p}from"./vendor-swr-CdRzEUwF.js";import{a as m}from"./runtime-tools-api-Bt8t37z5.js";var h=e(t(),1),g=()=>r(`/api/runtime-tools/phone-dependencies`);async function _(){return(await a(g())).payload}async function v(e){await a(r(`/api/runtime-tools/phone-dependencies/adb/path`),{method:`POST`,body:JSON.stringify({path:e})})}async function y(e,t,n,r){return m({path:`/api/runtime-tools/phone-dependencies/${e}/${t}/stream`,body:r?{path:r}:{},onProgress:n})}var b=n();function x({cloudOnly:e=!1,onChanged:t,expanded:n=!0,onExpandedChange:r}){let a=i(e=>e.language)===`zh`,[m,x]=(0,h.useState)(),[S,C]=(0,h.useState)(!1),[w,T]=(0,h.useState)({adb:``,scrcpy:``}),[E,D]=(0,h.useState)(),[O,k]=(0,h.useState)(``),[A,j]=(0,h.useState)(!1),{data:M,error:N,mutate:P}=p(g(),_,{refreshInterval:m?2500:0}),F=a?{ready:`已就绪`,absent:`未安装`,corrupted:`需要修复`,unsupported:`当前平台需自行安装`,installing:`安装中`}:{ready:`Ready`,absent:`Not installed`,corrupted:`Needs repair`,unsupported:`Use an existing installation`,installing:`Installing`},I=a?{download:`下载中`,verify:`校验文件`,extract:`解压文件`,install:`安装中`,probe:`验证版本`,complete:`安装完成`}:{download:`Downloading`,verify:`Verifying files`,extract:`Extracting`,install:`Installing`,probe:`Checking version`,complete:`Installed`};async function L(e,n){x(e),j(!1),k(``),D(void 0);try{n===`detect`?await v(``):n===`existing`&&e===`adb`?await v(w.adb.trim()):await y(e,n===`existing`?`import`:n,D,n===`existing`?w.scrcpy.trim():void 0),await P(),t?.(),k(a?`依赖已就绪。`:`Dependency is ready.`)}catch(e){j(!0),k(e instanceof Error?e.message:String(e))}finally{x(void 0),D(void 0)}}let R=M?.statuses.filter(t=>!e||t.kind!==`adb`),z=!!(R?.length&&R.every(e=>e.state===`ready`));return(0,b.jsxs)(`details`,{open:n,onToggle:e=>{e.currentTarget.open!==n&&r?.(e.currentTarget.open)},className:`group rounded-2xl border border-edge bg-surface-panel`,"aria-label":a?`手机依赖状态`:`Phone dependencies`,children:[(0,b.jsxs)(`summary`,{className:`flex min-h-16 cursor-pointer list-none items-center gap-3 p-5 [&::-webkit-details-marker]:hidden`,children:[(0,b.jsx)(u,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,b.jsx)(`h2`,{className:`text-sm font-semibold`,children:a?`连接组件`:`Connection components`}),(0,b.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 text-xs ${N?`text-danger`:`text-fg-muted`}`,children:[z&&(0,b.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N?a?`检测失败`:`Check failed`:M?z?a?`已就绪`:`Ready`:a?`需要配置`:`Setup needed`:a?`检测中`:`Checking`]}),(0,b.jsx)(o,{className:`size-4 shrink-0 text-fg-muted group-open:rotate-180`,"aria-hidden":!0})]}),(0,b.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle p-4 sm:p-5`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`安装在 Gateway 电脑上,无需全局安装。`:`Installed on your Gateway computer. No global installation needed.`}),(0,b.jsx)(d,{variant:`ghost`,"aria-label":a?`刷新手机依赖状态`:`Refresh phone dependencies`,disabled:!!m,onClick:()=>void P(),children:(0,b.jsx)(l,{className:`size-4`,"aria-hidden":!0})})]}),M?.installationEnabled===!1?(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`托管安装已禁用,可在运行环境中启用;已有 ADB 仍可使用。`:`Managed installation is disabled. Enable it in Runtime Tools, or use an existing ADB installation.`}):null,e?(0,b.jsxs)(`div`,{className:`space-y-2 text-xs text-fg-muted`,children:[(0,b.jsx)(`p`,{children:a?`阿里云连接无需本机 ADB;实时视频、持续触控和中文输入需要 scrcpy server。`:`Alibaba Cloud connections need no local ADB. Live video, continuous touch and Unicode input require scrcpy server.`}),(0,b.jsx)(`button`,{className:`text-accent-fg hover:underline`,"aria-expanded":S,onClick:()=>C(e=>!e),children:S?a?`收起本机连接依赖`:`Hide local connection dependencies`:a?`连接本机手机?查看 ADB 依赖`:`Connecting a local phone? Show ADB dependencies`})]}):null,N?(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:a?`无法读取依赖状态,请刷新重试。`:`Could not load dependency status. Refresh to retry.`}):M?M.statuses.filter(t=>!e||S||t.kind!==`adb`).map(e=>(0,b.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium`,children:e.kind===`adb`?`ADB · Android Platform Tools`:`scrcpy server`}),(0,b.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[F[e.state],e.version?` · ${e.version}`:` · ${a?`托管版本`:`Managed version`} ${e.requestedVersion}`,e.source===`system`?a?` · 使用已有安装`:` · Existing installation`:e.source===`custom`?a?` · 自定义路径`:` · Custom path`:``]})]}),(0,b.jsxs)(d,{disabled:!!m||e.state===`installing`||!e.canInstall,variant:e.state===`ready`?`secondary`:`primary`,onClick:()=>void L(e.kind,e.state===`corrupted`||e.state===`ready`&&e.source===`managed`?`repair`:`install`),children:[(0,b.jsx)(c,{className:`size-4`,"aria-hidden":!0}),m===e.kind||e.state===`installing`?a?`处理中…`:`Working…`:e.state===`ready`&&e.source!==`managed`?a?`安装托管副本`:`Install managed copy`:e.state===`ready`||e.state===`corrupted`?a?`修复托管安装`:`Repair managed copy`:a?`安装`:`Install`]})]}),(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.kind===`adb`?a?`仅连接本机 USB 手机或模拟器时需要;云手机无需安装。`:`Required for local USB phones and emulators. Cloud phones do not need it.`:a?`用于实时画面、跟手操作和中文输入;缺失时仍可查看截图并手动输入。`:`Required for live video, continuous touch and Unicode input. Snapshots and manual typing remain available without it.`}),(0,b.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer py-1`,children:e.kind===`adb`?a?`使用已有 ADB`:`Use existing ADB`:a?`导入已有 scrcpy server`:`Import existing scrcpy server`}),e.path?(0,b.jsxs)(`p`,{className:`mt-2 break-all`,children:[a?`当前文件:`:`Current file: `,e.path]}):null,(0,b.jsxs)(`label`,{className:`mt-3 block space-y-2`,children:[(0,b.jsx)(`span`,{children:e.kind===`adb`?a?`Gateway 上的 ADB 可执行文件绝对路径`:`Absolute ADB executable path on Gateway`:a?`Gateway 上的 scrcpy server 文件绝对路径`:`Absolute scrcpy server file path on Gateway`}),(0,b.jsx)(`input`,{"aria-label":e.kind===`adb`?a?`已有 ADB 路径`:`Existing ADB path`:a?`已有 scrcpy server 路径`:`Existing scrcpy server path`,value:w[e.kind],disabled:!!m,onChange:t=>T(n=>({...n,[e.kind]:t.target.value})),className:`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`})]}),(0,b.jsx)(`p`,{className:`mt-2`,children:e.kind===`scrcpy`?a?`只接受固定版本 ${e.requestedVersion},校验通过后复制到托管目录。`:`Only pinned version ${e.requestedVersion} is accepted and copied into managed storage after verification.`:a?`验证版本后保存路径;不会替换此文件或重启 ADB 服务。`:`Checks the version and saves the path without replacing files or restarting ADB.`}),(0,b.jsx)(d,{className:`mt-3`,disabled:!!m||!w[e.kind].trim(),onClick:()=>void L(e.kind,`existing`),children:a?`验证并使用`:`Verify and use`}),e.kind===`adb`?(0,b.jsx)(d,{variant:`ghost`,className:`ml-2 mt-3`,disabled:!!m,onClick:()=>void L(`adb`,`detect`),children:a?`恢复自动检测`:`Use automatic detection`}):null]})]},e.kind)):(0,b.jsx)(f,{className:`h-28 rounded-xl`}),(0,b.jsx)(`div`,{className:`min-h-5 text-xs`,"aria-live":`polite`,children:E?(0,b.jsxs)(`p`,{role:`status`,className:`text-fg-muted`,children:[I[E.phase]??E.phase,E.downloadedBytes&&E.totalBytes?` · ${Math.min(100,Math.round(E.downloadedBytes/E.totalBytes*100))}%`:``]}):O?(0,b.jsx)(`p`,{role:A?`alert`:`status`,className:A?`text-danger`:`text-fg-muted`,children:O}):null}),(0,b.jsx)(`a`,{href:`#/settings/runtimes`,className:`text-xs text-accent-fg hover:underline`,children:a?`管理下载代理与离线包`:`Manage download proxy and offline packages`})]})]})}export{x as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{i as r,n as i,o as a}from"./locale-store-Br7IfbXK.js";import{t as o}from"./chevron-down-ccbiQQz_.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./download-Dk-ZjtO6.js";import{t as l}from"./refresh-cw-BRlGaq2w.js";import{t as u}from"./wrench-DFb4r8bH.js";import{t as d}from"./skeleton-BI5TyibZ.js";import{i as f}from"./vendor-swr-CdRzEUwF.js";import{t as p}from"./button-Cc4hUNTt.js";import{a as m}from"./runtime-tools-api-9o3Wfji1.js";var h=e(t(),1),g=()=>r(`/api/runtime-tools/phone-dependencies`);async function _(){return(await a(g())).payload}async function v(e){await a(r(`/api/runtime-tools/phone-dependencies/adb/path`),{method:`POST`,body:JSON.stringify({path:e})})}async function y(e,t,n,r){return m({path:`/api/runtime-tools/phone-dependencies/${e}/${t}/stream`,body:r?{path:r}:{},onProgress:n})}var b=n();function x({cloudOnly:e=!1,onChanged:t,expanded:n=!0,onExpandedChange:r}){let a=i(e=>e.language)===`zh`,[m,x]=(0,h.useState)(),[S,C]=(0,h.useState)(!1),[w,T]=(0,h.useState)({adb:``,scrcpy:``}),[E,D]=(0,h.useState)(),[O,k]=(0,h.useState)(``),[A,j]=(0,h.useState)(!1),{data:M,error:N,mutate:P}=f(g(),_,{refreshInterval:m?2500:0}),F=a?{ready:`已就绪`,absent:`未安装`,corrupted:`需要修复`,unsupported:`当前平台需自行安装`,installing:`安装中`}:{ready:`Ready`,absent:`Not installed`,corrupted:`Needs repair`,unsupported:`Use an existing installation`,installing:`Installing`},I=a?{download:`下载中`,verify:`校验文件`,extract:`解压文件`,install:`安装中`,probe:`验证版本`,complete:`安装完成`}:{download:`Downloading`,verify:`Verifying files`,extract:`Extracting`,install:`Installing`,probe:`Checking version`,complete:`Installed`};async function L(e,n){x(e),j(!1),k(``),D(void 0);try{n===`detect`?await v(``):n===`existing`&&e===`adb`?await v(w.adb.trim()):await y(e,n===`existing`?`import`:n,D,n===`existing`?w.scrcpy.trim():void 0),await P(),t?.(),k(a?`依赖已就绪。`:`Dependency is ready.`)}catch(e){j(!0),k(e instanceof Error?e.message:String(e))}finally{x(void 0),D(void 0)}}let R=M?.statuses.filter(t=>!e||t.kind!==`adb`),z=!!(R?.length&&R.every(e=>e.state===`ready`));return(0,b.jsxs)(`details`,{open:n,onToggle:e=>{e.currentTarget.open!==n&&r?.(e.currentTarget.open)},className:`group rounded-2xl border border-edge bg-surface-panel`,"aria-label":a?`手机依赖状态`:`Phone dependencies`,children:[(0,b.jsxs)(`summary`,{className:`flex min-h-16 cursor-pointer list-none items-center gap-3 p-5 [&::-webkit-details-marker]:hidden`,children:[(0,b.jsx)(u,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,b.jsx)(`h2`,{className:`text-sm font-semibold`,children:a?`连接组件`:`Connection components`}),(0,b.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 text-xs ${N?`text-danger`:`text-fg-muted`}`,children:[z&&(0,b.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N?a?`检测失败`:`Check failed`:M?z?a?`已就绪`:`Ready`:a?`需要配置`:`Setup needed`:a?`检测中`:`Checking`]}),(0,b.jsx)(o,{className:`size-4 shrink-0 text-fg-muted group-open:rotate-180`,"aria-hidden":!0})]}),(0,b.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle p-4 sm:p-5`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`安装在 Gateway 电脑上,无需全局安装。`:`Installed on your Gateway computer. No global installation needed.`}),(0,b.jsx)(p,{variant:`ghost`,"aria-label":a?`刷新手机依赖状态`:`Refresh phone dependencies`,disabled:!!m,onClick:()=>void P(),children:(0,b.jsx)(l,{className:`size-4`,"aria-hidden":!0})})]}),M?.installationEnabled===!1?(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`托管安装已禁用,可在运行环境中启用;已有 ADB 仍可使用。`:`Managed installation is disabled. Enable it in Runtime Tools, or use an existing ADB installation.`}):null,e?(0,b.jsxs)(`div`,{className:`space-y-2 text-xs text-fg-muted`,children:[(0,b.jsx)(`p`,{children:a?`阿里云连接无需本机 ADB;实时视频、持续触控和中文输入需要 scrcpy server。`:`Alibaba Cloud connections need no local ADB. Live video, continuous touch and Unicode input require scrcpy server.`}),(0,b.jsx)(`button`,{className:`text-accent-fg hover:underline`,"aria-expanded":S,onClick:()=>C(e=>!e),children:S?a?`收起本机连接依赖`:`Hide local connection dependencies`:a?`连接本机手机?查看 ADB 依赖`:`Connecting a local phone? Show ADB dependencies`})]}):null,N?(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:a?`无法读取依赖状态,请刷新重试。`:`Could not load dependency status. Refresh to retry.`}):M?M.statuses.filter(t=>!e||S||t.kind!==`adb`).map(e=>(0,b.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium`,children:e.kind===`adb`?`ADB · Android Platform Tools`:`scrcpy server`}),(0,b.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[F[e.state],e.version?` · ${e.version}`:` · ${a?`托管版本`:`Managed version`} ${e.requestedVersion}`,e.source===`system`?a?` · 使用已有安装`:` · Existing installation`:e.source===`custom`?a?` · 自定义路径`:` · Custom path`:``]})]}),(0,b.jsxs)(p,{disabled:!!m||e.state===`installing`||!e.canInstall,variant:e.state===`ready`?`secondary`:`primary`,onClick:()=>void L(e.kind,e.state===`corrupted`||e.state===`ready`&&e.source===`managed`?`repair`:`install`),children:[(0,b.jsx)(c,{className:`size-4`,"aria-hidden":!0}),m===e.kind||e.state===`installing`?a?`处理中…`:`Working…`:e.state===`ready`&&e.source!==`managed`?a?`安装托管副本`:`Install managed copy`:e.state===`ready`||e.state===`corrupted`?a?`修复托管安装`:`Repair managed copy`:a?`安装`:`Install`]})]}),(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.kind===`adb`?a?`仅连接本机 USB 手机或模拟器时需要;云手机无需安装。`:`Required for local USB phones and emulators. Cloud phones do not need it.`:a?`用于实时画面、跟手操作和中文输入;缺失时仍可查看截图并手动输入。`:`Required for live video, continuous touch and Unicode input. Snapshots and manual typing remain available without it.`}),(0,b.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer py-1`,children:e.kind===`adb`?a?`使用已有 ADB`:`Use existing ADB`:a?`导入已有 scrcpy server`:`Import existing scrcpy server`}),e.path?(0,b.jsxs)(`p`,{className:`mt-2 break-all`,children:[a?`当前文件:`:`Current file: `,e.path]}):null,(0,b.jsxs)(`label`,{className:`mt-3 block space-y-2`,children:[(0,b.jsx)(`span`,{children:e.kind===`adb`?a?`Gateway 上的 ADB 可执行文件绝对路径`:`Absolute ADB executable path on Gateway`:a?`Gateway 上的 scrcpy server 文件绝对路径`:`Absolute scrcpy server file path on Gateway`}),(0,b.jsx)(`input`,{"aria-label":e.kind===`adb`?a?`已有 ADB 路径`:`Existing ADB path`:a?`已有 scrcpy server 路径`:`Existing scrcpy server path`,value:w[e.kind],disabled:!!m,onChange:t=>T(n=>({...n,[e.kind]:t.target.value})),className:`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`})]}),(0,b.jsx)(`p`,{className:`mt-2`,children:e.kind===`scrcpy`?a?`只接受固定版本 ${e.requestedVersion},校验通过后复制到托管目录。`:`Only pinned version ${e.requestedVersion} is accepted and copied into managed storage after verification.`:a?`验证版本后保存路径;不会替换此文件或重启 ADB 服务。`:`Checks the version and saves the path without replacing files or restarting ADB.`}),(0,b.jsx)(p,{className:`mt-3`,disabled:!!m||!w[e.kind].trim(),onClick:()=>void L(e.kind,`existing`),children:a?`验证并使用`:`Verify and use`}),e.kind===`adb`?(0,b.jsx)(p,{variant:`ghost`,className:`ml-2 mt-3`,disabled:!!m,onClick:()=>void L(`adb`,`detect`),children:a?`恢复自动检测`:`Use automatic detection`}):null]})]},e.kind)):(0,b.jsx)(d,{className:`h-28 rounded-xl`}),(0,b.jsx)(`div`,{className:`min-h-5 text-xs`,"aria-live":`polite`,children:E?(0,b.jsxs)(`p`,{role:`status`,className:`text-fg-muted`,children:[I[E.phase]??E.phase,E.downloadedBytes&&E.totalBytes?` · ${Math.min(100,Math.round(E.downloadedBytes/E.totalBytes*100))}%`:``]}):O?(0,b.jsx)(`p`,{role:A?`alert`:`status`,className:A?`text-danger`:`text-fg-muted`,children:O}):null}),(0,b.jsx)(`a`,{href:`#/settings/runtimes`,className:`text-xs text-accent-fg hover:underline`,children:a?`管理下载代理与离线包`:`Manage download proxy and offline packages`})]})]})}export{x as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a,i as o,n as s,o as c,r as l,s as u,t as d}from"./dist-BGTk37IG.js";import{t as f}from"./arrow-left-D880xG-P.js";import{t as p}from"./refresh-cw-BRlGaq2w.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./skeleton-BI5TyibZ.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";import{t as _}from"./button-Cc4hUNTt.js";import{t as v}from"./open-capability-settings-Cvb65hQB.js";import{n as y}from"./providers-api-DOnNfkwQ.js";import{t as b}from"./mobile-pair-qr-CuIbmw5x.js";import{a as x,c as S,n as C,o as w}from"./phone-model-picker-DuZc5jYO.js";var T=n(),E=e(t(),1),D=r();function ee({zh:e,onAdded:t}){let[n,r]=(0,E.useState)(e?`阿里云手机`:`Alibaba Cloud Phone`),[i,a]=(0,E.useState)(``),[o,s]=(0,E.useState)(),[c,l]=(0,E.useState)(),[u,d]=(0,E.useState)(!1),[f,p]=(0,E.useState)(!1),[m,h]=(0,E.useState)(``),g=(0,E.useRef)(void 0),v=(0,E.useRef)(!0),y=()=>{let e=g.current;g.current=void 0,l(void 0),e&&S(`/cloud/aliyun/tests/${e}`,void 0,`DELETE`).catch(()=>{})};(0,E.useEffect)(()=>(v.current=!0,()=>{v.current=!1,g.current&&S(`/cloud/aliyun/tests/${g.current}`,void 0,`DELETE`).catch(()=>{})}),[]);let b=async()=>{if(o){y(),p(!0),h(``);try{if(o.size>16384)throw Error(e?`私钥文件不能超过 16 KB`:`Private key must be at most 16 KB`);let t=await S(`/cloud/aliyun/test`,{endpoint:i.trim(),privateKey:await o.text()});if(!v.current){S(`/cloud/aliyun/tests/${t.token}`,void 0,`DELETE`).catch(()=>{});return}g.current=t.token,l(t)}catch(e){v.current&&h(String(e instanceof Error?e.message:e))}finally{v.current&&p(!1)}}},x=async()=>{if(c){p(!0),h(``);try{await S(`/cloud/aliyun/add`,{token:c.token,name:n.trim(),makeDefault:u}),g.current=void 0,t()}catch(e){v.current&&h(String(e instanceof Error?e.message:e))}finally{v.current&&p(!1)}}},C=`mt-2 w-full rounded-xl border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;return(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e?`在阿里云控制台绑定密钥对并创建 ADB 连接,复制公网或 Gateway 可访问的内网地址。无需云账号 AccessKey。`:`Bind a key pair and create an ADB connection in the Alibaba console. Use an address reachable from the Gateway. No cloud account AccessKey is needed.`}),(0,D.jsxs)(`label`,{className:`block text-sm`,children:[e?`手机名称`:`Phone name`,(0,D.jsx)(`input`,{className:C,value:n,maxLength:100,disabled:f,onChange:e=>r(e.target.value)})]}),(0,D.jsxs)(`label`,{className:`block text-sm`,children:[e?`ADB 地址`:`ADB address`,(0,D.jsx)(`input`,{className:C,placeholder:`203.0.113.10:10001`,value:i,disabled:f,autoComplete:`off`,onChange:e=>{y(),a(e.target.value)}})]}),(0,D.jsxs)(`label`,{className:`block text-sm`,children:[e?`私钥文件(adbkey)`:`Private key file (adbkey)`,(0,D.jsx)(`input`,{className:C,type:`file`,disabled:f,onChange:e=>{y(),s(e.target.files?.[0])}})]}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`私钥仅提交到当前 Gateway,添加后保存在 Gateway 凭据目录,不会替换电脑现有 ADB 密钥。`:`The key is sent only to this Gateway and saved in its credentials directory after adding. Existing host ADB keys stay unchanged.`}),(0,D.jsx)(_,{disabled:f||!i.trim()||!o,onClick:()=>void b(),children:f?e?`处理中…`:`Working…`:e?`测试连接`:`Test connection`}),m&&(0,D.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:m}),c&&(0,D.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge p-4`,children:[(0,D.jsxs)(`p`,{role:`status`,className:`text-sm`,children:[e?`连接成功`:`Connected`,` · `,c.model,` · Android `,c.androidVersion]}),(0,D.jsx)(`img`,{src:c.screenshot,alt:e?`云手机当前画面`:`Current cloud phone screen`,className:`mx-auto max-h-64 rounded-lg object-contain`}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`添加后可在聊天中使用实时视频、接管操作和交还 Agent;视频不可用时使用截图。测试结果有效期为 10 分钟。默认只允许系统设置,添加后可在「管理」中调整。`:`After adding, use live video, takeover and Agent handback in chat, with snapshots when video is unavailable. Test expires after 10 minutes. Settings is the initial allowed app; adjust it in Manage.`}),(0,D.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:u,disabled:f,onChange:e=>d(e.target.checked)}),e?`设为默认手机`:`Set as default phone`]}),(0,D.jsx)(_,{variant:`primary`,disabled:f||!n.trim()||c.expiresAt<=Date.now(),onClick:()=>void x(),children:e?`添加手机`:`Add phone`})]}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`移除连接只删除 xopc 的连接与私钥,不会销毁云手机,也不会关闭阿里云侧的 ADB 端口。`:`Removing a connection deletes its xopc credentials. It does not destroy the cloud phone or close its cloud ADB endpoint.`})]})}var O=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm`,k=new Set([`connected`,`timeout`,`error`,`cancelled`]);function A({zh:e,onSelect:t}){let[n,r]=(0,E.useState)(`qr`),[i,a]=(0,E.useState)(),[o,s]=(0,E.useState)(``),[c,l]=(0,E.useState)(``),[u,d]=(0,E.useState)(``),[f,p]=(0,E.useState)(``),[m,v]=(0,E.useState)(``),[y,x]=(0,E.useState)(!1),[C,w]=(0,E.useState)(``),[T,ee]=(0,E.useState)(Date.now()),A=(0,E.useRef)(void 0),j=(0,E.useRef)(0),M=(0,E.useRef)(t);M.current=t;let N=g(`phone-wireless-discovery`,()=>S(`/wireless/discovery`),{refreshInterval:4e3}),P=()=>{j.current++;let e=A.current;A.current=void 0,e&&S(`/wireless/pairings/${e}`,void 0,`DELETE`).catch(()=>{})},F=async e=>{P();let t=j.current;x(!0),w(``),a(void 0),s(``);try{if(e===`connect`){let e=await S(`/wireless/connect`,{host:c,port:Number(f)});j.current===t&&M.current(e)}else{let n=await S(`/wireless/pairings`,e===`qr`?{method:`qr`}:{method:`code`,host:c,pairingPort:Number(u),code:m,...f?{connectPort:Number(f)}:{}});if(j.current!==t){S(`/wireless/pairings/${n.id}`,void 0,`DELETE`).catch(()=>{});return}A.current=n.id,a(n),v(``)}}catch(e){j.current===t&&w(e instanceof Error?e.message:String(e))}finally{j.current===t&&x(!1)}};(0,E.useEffect)(()=>(n===`qr`&&F(`qr`),P),[n]),(0,E.useEffect)(()=>{let t=!0;return s(``),i?.qrPayload&&b(i.qrPayload).then(e=>{t&&s(e)}).catch(()=>{t&&w(e?`二维码生成失败,请重试`:`Unable to render QR code`)}),()=>{t=!1}},[i?.qrPayload,e]),(0,E.useEffect)(()=>{if(!i||k.has(i.status))return;let e=!0,t,n=async()=>{try{let r=await S(`/wireless/pairings/${i.id}`);if(!e)return;if(a(r),ee(Date.now()),r.status===`connected`&&r.device){M.current(r.device);return}k.has(r.status)||(t=setTimeout(()=>{n()},1e3))}catch(r){if(!e)return;w(r instanceof Error?r.message:String(r)),Date.now()<i.expiresAt+5e3?t=setTimeout(()=>{n()},2e3):a(e=>e&&{...e,status:`timeout`,qrPayload:void 0})}};return t=setTimeout(()=>{n()},1e3),()=>{e=!1,clearTimeout(t)}},[i?.id,i?.status]);let I=e?{waiting:`等待扫码`,pairing:`正在配对`,paired:`已配对,正在查找连接地址`,connecting:`正在连接`,connected:`已连接`,timeout:`操作超时`,error:`配对失败`,cancelled:`已取消`}:{waiting:`Waiting for scan`,pairing:`Pairing`,paired:`Paired · Finding connection address`,connecting:`Connecting`,connected:`Connected`,timeout:`Timed out`,error:`Pairing failed`,cancelled:`Cancelled`},L=y||!!(i&&!k.has(i.status));return(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-3 text-sm`,children:e?`手机须与 Gateway 所在电脑处于同一局域网。仅浏览器与手机同网还不够。支持 Android 11 及以上。`:`Android 11+. The phone and Gateway host must share a local network.`}),(0,D.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":e?`无线连接方式`:`Wireless connection method`,children:[[`qr`,e?`扫码配对`:`QR pairing`],[`code`,e?`配对码`:`Pairing code`],[`connect`,e?`连接已配对设备`:`Already paired`]].map(([e,t])=>(0,D.jsx)(_,{"aria-pressed":n===e,onClick:()=>{P(),x(!1),a(void 0),w(``),s(``),r(e)},children:t},e))}),(0,D.jsxs)(`ol`,{className:`list-decimal space-y-1 pl-5 text-sm text-fg-muted`,children:[(0,D.jsx)(`li`,{children:e?`打开手机「设置 → 开发者选项 → 无线调试」。`:`Open Settings → Developer options → Wireless debugging.`}),(0,D.jsx)(`li`,{children:n===`qr`?e?`选择「使用二维码配对设备」,扫描下方二维码。`:`Choose Pair device with QR code and scan below.`:n===`code`?e?`选择「使用配对码配对设备」,填写显示的地址和六位配对码。`:`Choose Pair device with pairing code and enter its address and six-digit code.`:e?`填写无线调试首页显示的 IP 地址与连接端口。`:`Enter the IP and port shown on the main Wireless debugging screen.`})]}),N.isLoading&&(0,D.jsx)(h,{className:`h-12 w-full`}),(N.error||N.data?.mdns===!1)&&(0,D.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:e?`自动发现不可用。可使用配对码并手动填写连接端口。请检查 Gateway 的 ADB、网络及防火墙。`:`Discovery unavailable. Use a pairing code and enter the connection port manually. Check Gateway ADB, network and firewall.`}),n===`qr`?(0,D.jsxs)(`div`,{className:`space-y-3 text-center`,children:[o?(0,D.jsx)(`img`,{src:o,alt:e?`无线调试配对二维码`:`Wireless debugging pairing QR code`,className:`mx-auto size-60 rounded-lg bg-white`}):i&&!k.has(i.status)?(0,D.jsx)(h,{className:`mx-auto size-60`}):null,i&&(0,D.jsxs)(`p`,{role:`status`,className:`text-sm`,children:[I[i.status],k.has(i.status)?``:` · ${Math.max(0,Math.ceil((i.expiresAt-T)/1e3))}s`]}),(0,D.jsx)(_,{disabled:y,onClick:()=>{F(`qr`)},children:e?`重新生成`:`Regenerate`})]}):(0,D.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),F(n)},children:[N.data?.services.filter(e=>e.kind===(n===`code`?`pairing`:`connect`)).map(e=>(0,D.jsxs)(_,{type:`button`,disabled:L,onClick:()=>{if(l(e.host),n===`code`){d(String(e.port));let t=N.data?.services.find(t=>t.kind===`connect`&&t.host===e.host);p(t?String(t.port):``)}else p(String(e.port))},children:[e.host,`:`,e.port]},`${e.name}:${e.port}`)),(0,D.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[e?`手机 IP 地址`:`Phone IP address`,(0,D.jsx)(`input`,{className:O,value:c,onChange:e=>l(e.target.value.trim()),required:!0,disabled:L,placeholder:`192.168.1.10`})]}),n===`code`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[e?`配对端口`:`Pairing port`,(0,D.jsx)(`input`,{className:O,type:`number`,min:1,max:65535,value:u,onChange:e=>d(e.target.value),required:!0,disabled:L})]}),(0,D.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[e?`六位配对码`:`Six-digit pairing code`,(0,D.jsx)(`input`,{className:O,inputMode:`numeric`,autoComplete:`off`,pattern:`[0-9]{6}`,maxLength:6,value:m,onChange:e=>v(e.target.value),required:!0,disabled:L})]})]}),(0,D.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[e?`连接端口`:`Connection port`,(0,D.jsx)(`input`,{className:O,type:`number`,min:1,max:65535,value:f,onChange:e=>p(e.target.value),required:n===`connect`,disabled:L,placeholder:e?`留空自动发现`:`Auto-discover if empty`})]}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`连接端口在无线调试首页显示,与配对端口不同,会随设备状态变化。`:`The connection port is on the main Wireless debugging screen. It differs from the pairing port and can change.`}),i&&(0,D.jsx)(`p`,{role:`status`,className:`text-sm`,children:I[i.status]}),(0,D.jsx)(_,{type:`submit`,disabled:L,children:e?n===`code`?`配对并连接`:`连接`:n===`code`?`Pair and connect`:`Connect`})]}),i?.errorCode&&(0,D.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:i.errorCode===`PHONE_CONNECT_TIMEOUT`?e?`已配对,但未能连接。切换「连接已配对设备」并填写当前连接端口,无需重新配对。`:`Paired but not connected. Use Already paired with the current connection port.`:e?`未完成配对。请检查手机配对页面、网络和配对码后重试。`:`Pairing incomplete. Check the phone pairing screen, network and code, then retry.`}),L&&(0,D.jsx)(_,{onClick:()=>{P(),x(!1),a(void 0),s(``)},children:e?`取消配对`:`Cancel pairing`}),C&&(0,D.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:C})]})}var j=[{id:`wireless`,available:!0,name:[`无线连接 Android 手机`,`Wireless Android phone`],description:[`Android 11+,扫码或输入配对码,无需数据线。`,`Android 11+ · Pair with a QR code or pairing code.`]},{id:`local-adb`,available:!0,name:[`Gateway 电脑上的手机 / 模拟器`,`Phone or emulator on the Gateway host`],description:[`通过 USB 或已配对的无线 ADB 连接。`,`Connect over USB or previously paired wireless ADB.`]},{id:`remote-connector`,available:!1,name:[`通过本地连接器连接`,`Local connector`],description:[`Gateway 在服务器上,手机连接在你的电脑上。`,`Connect a phone on your computer to a remote Gateway.`]},{id:`aliyun`,available:!0,name:[`阿里云手机`,`Alibaba Cloud Phone`],description:[`填写 ADB 地址并上传私钥,连接已有云手机。`,`Connect an existing cloud phone with its ADB address and private key.`]},{id:`tencent`,available:!1,name:[`腾讯云手机`,`Tencent Cloud Phone`],description:[`连接云账号,选择地域和已有实例。`,`Connect an account, then choose a region and existing instance.`]}];function M(e){let t=(0,T.c)(48),{zh:n,onClose:r,onSelect:i,onAdded:v,initialMethod:y}=e,[b,S]=(0,E.useState)(y),C;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C={refreshInterval:3e3},t[0]=C):C=t[0];let w=g(b===`local-adb`?`phone-devices`:null,x,C),O;t[1]===b?O=t[2]:(O=j.find(e=>e.id===b),t[1]=b,t[2]=O);let k=O,M=+!n,N;t[3]===n?N=t[4]:(N=n?{device:`已连接,可添加`,unauthorized:`等待手机授权:解锁手机,点击「允许 USB 调试」`,offline:`设备离线:重新连接数据线或无线调试`,recovery:`恢复模式:请先启动 Android 系统`,sideload:`请退出刷机模式并启动 Android 系统`}:{device:`Connected · Ready to add`,unauthorized:`Unlock the phone and allow USB debugging`,offline:`Offline · Reconnect USB or wireless debugging`,recovery:`Boot Android before connecting`,sideload:`Exit sideload mode and boot Android`},t[3]=n,t[4]=N);let P=N,F;t[5]===w.data?.discovery?F=t[6]:(F=w.data?.discovery??[],t[5]=w.data?.discovery,t[6]=F);let I=F,L;t[7]===r?L=t[8]:(L=e=>{e||r()},t[7]=r,t[8]=L);let R;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,D.jsx)(a,{className:`fixed inset-0 z-[80] bg-black/40`}),t[9]=R):R=t[9];let z;t[10]!==b||t[11]!==n?(z=b&&(0,D.jsx)(_,{variant:`ghost`,"aria-label":n?`返回连接方式`:`Back to connection methods`,onClick:()=>S(void 0),children:(0,D.jsx)(f,{className:`size-4`})}),t[10]=b,t[11]=n,t[12]=z):z=t[12];let B=n?`添加手机`:`Add phone`,V;t[13]===B?V=t[14]:(V=(0,D.jsx)(u,{className:`text-base font-semibold`,children:B}),t[13]=B,t[14]=V);let H=k?k.name[M]:n?`选择手机连接在哪里。手机模型在添加设备后独立配置。`:`Choose where the phone connects. Phone models are configured separately.`,U;t[15]===H?U=t[16]:(U=(0,D.jsx)(o,{className:`mt-1 text-sm text-fg-muted`,children:H}),t[15]=H,t[16]=U);let W;t[17]!==U||t[18]!==V?(W=(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[V,U]}),t[17]=U,t[18]=V,t[19]=W):W=t[19];let G=n?`关闭添加手机`:`Close add phone`,K;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,D.jsx)(m,{className:`size-4`}),t[20]=K):K=t[20];let q;t[21]===G?q=t[22]:(q=(0,D.jsx)(s,{asChild:!0,children:(0,D.jsx)(_,{variant:`ghost`,"aria-label":G,children:K})}),t[21]=G,t[22]=q);let J;t[23]!==W||t[24]!==q||t[25]!==z?(J=(0,D.jsxs)(`header`,{className:`flex shrink-0 items-start gap-3 border-b border-edge p-5`,children:[z,W,q]}),t[23]=W,t[24]=q,t[25]=z,t[26]=J):J=t[26];let Y;t[27]!==w||t[28]!==I||t[29]!==M||t[30]!==b||t[31]!==v||t[32]!==r||t[33]!==i||t[34]!==P||t[35]!==n?(Y=b?b===`aliyun`?(0,D.jsx)(ee,{zh:n,onAdded:()=>{v?.(),r()}}):b===`wireless`?(0,D.jsx)(A,{zh:n,onSelect:i}):b===`local-adb`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-3 text-sm`,children:n?`连接位置:Gateway 所在电脑。若 Gateway 在服务器上,浏览器无法访问你电脑的 USB 手机。`:`Connection location: the Gateway host. A remote Gateway cannot access your browser computer’s USB phone.`}),(0,D.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-sm text-fg-muted`,children:[(0,D.jsx)(`li`,{children:n?`手机开启开发者选项和 USB 调试;模拟器直接启动即可。`:`Enable developer options and USB debugging, or start an emulator.`}),(0,D.jsx)(`li`,{children:n?`用数据线连接 Gateway 电脑,在手机上允许 USB 调试。`:`Connect to the Gateway host with a data cable, then allow USB debugging on the phone.`}),(0,D.jsx)(`li`,{children:n?`等待下方显示设备,选择后确认名称和应用范围。`:`Select a discovered device below, then confirm its name and app access.`})]}),(0,D.jsxs)(`details`,{className:`text-sm`,children:[(0,D.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:n?`使用无线连接或安装连接工具`:`Wireless connection or connection tools`}),(0,D.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:n?`可返回连接方式,选择「无线连接 Android 手机」进行扫码或配对码配对。ADB 可在手机控制页的「手机依赖状态」中手动安装,或使用 Gateway 电脑上已有的 Platform Tools;无需安装完整 Android Studio。`:`Choose Wireless Android phone to pair with a QR code or pairing code. Install ADB from Phone dependencies or use existing Platform Tools on the Gateway host.`}),(0,D.jsx)(`a`,{href:`https://developer.android.com/tools/adb`,target:`_blank`,rel:`noopener noreferrer`,className:`mt-2 inline-block text-xs text-accent-fg hover:underline`,children:n?`查看 Android 官方连接指引`:`Android connection guide`})]}),(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,D.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`发现的设备`:`Discovered devices`}),(0,D.jsxs)(_,{disabled:w.isValidating,onClick:()=>{w.mutate()},children:[(0,D.jsx)(p,{className:`size-4`}),n?`刷新`:`Refresh`]})]}),!w.data&&!w.error?(0,D.jsx)(h,{className:`h-24 w-full rounded-xl`}):null,(w.error||w.data?.diagnostic)&&(0,D.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[n?`无法检测设备,请检查 Gateway 电脑的 ADB 安装与连接。`:`Unable to detect devices. Check ADB on the Gateway host.`,(0,D.jsx)(`span`,{className:`mt-1 block break-all text-xs`,children:w.data?.diagnostic??String(w.error)})]}),I.map(e=>{let t=w.data?.devices.some(t=>t.serial===e.serial);return(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-edge p-3`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,D.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:e.serial}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:P[e.state]??e.state})]}),(0,D.jsx)(_,{disabled:t||e.state!==`device`,onClick:()=>i(e),children:t?n?`已添加`:`Added`:n?`选择设备`:`Choose device`})]},e.serial)}),w.data&&!I.length&&(0,D.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:n?`尚未发现设备。请检查数据线、手机调试授权,或启动模拟器。`:`No devices found. Check the cable and debugging authorization, or start an emulator.`})]}):(0,D.jsxs)(`div`,{className:`space-y-4 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,D.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`此接入方式暂未支持`:`This connection method is not available yet`}),(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:b===`remote-connector`?n?`后续可通过本地连接器将电脑上的手机接入远程 Gateway。当前请将手机连接到 Gateway 所在电脑。`:`A future local connector will connect your phone to a remote Gateway. For now, connect it to the Gateway host.`:n?`云手机适配器接入后,可配置云账号、选择地域和已有实例,再验证连接并添加。当前尚不能连接云实例,不会要求填写云密钥。`:`Once the cloud adapter is available, connect an account, select a region and existing instance, then verify and add it. Cloud connections are not supported yet.`}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`添加已有实例与购买、创建、销毁实例分开处理。`:`Adding existing instances is separate from purchasing, creating or destroying them.`})]}):j.map(e=>(0,D.jsxs)(`button`,{className:`block min-h-20 w-full rounded-xl border border-edge bg-surface-base p-4 text-left hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent`,onClick:()=>S(e.id),children:[(0,D.jsxs)(`span`,{className:`flex flex-wrap items-center justify-between gap-2 text-sm font-medium`,children:[e.name[M],!e.available&&(0,D.jsx)(`span`,{className:`text-xs font-normal text-fg-muted`,children:n?`暂未支持`:`Not available yet`})]}),(0,D.jsx)(`span`,{className:`mt-2 block text-xs text-fg-muted`,children:e.description[M]})]},e.id)),t[27]=w,t[28]=I,t[29]=M,t[30]=b,t[31]=v,t[32]=r,t[33]=i,t[34]=P,t[35]=n,t[36]=Y):Y=t[36];let X;t[37]===Y?X=t[38]:(X=(0,D.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:Y}),t[37]=Y,t[38]=X);let te=n?`取消`:`Cancel`,Z;t[39]===te?Z=t[40]:(Z=(0,D.jsx)(`footer`,{className:`flex shrink-0 justify-end border-t border-edge p-4`,children:(0,D.jsx)(s,{asChild:!0,children:(0,D.jsx)(_,{children:te})})}),t[39]=te,t[40]=Z);let Q;t[41]!==J||t[42]!==X||t[43]!==Z?(Q=(0,D.jsxs)(c,{children:[R,(0,D.jsxs)(l,{className:`fixed left-1/2 top-1/2 z-[81] flex h-[min(42rem,90dvh)] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay text-fg`,children:[J,X,Z]})]}),t[41]=J,t[42]=X,t[43]=Z,t[44]=Q):Q=t[44];let $;return t[45]!==Q||t[46]!==L?($=(0,D.jsx)(d,{open:!0,onOpenChange:L,children:Q}),t[45]=Q,t[46]=L,t[47]=$):$=t[47],$}function N({value:e,zh:t,disabled:n,onSave:r,onSelect:a}){let o=g(`phone-models`,w),s=g(`phone-provider-meta`,y),[c,l]=(0,E.useState)(e),[u,d]=(0,E.useState)(!1),[f,p]=(0,E.useState)(``),[m,h]=(0,E.useState)(!1);(0,E.useEffect)(()=>{l(e)},[e]);let b=o.data?.models.find(e=>e.id===c),x=c.split(`/`)[0],S=s.data?.find(e=>e.id===x)?.name??x,T=!c||!!b?.configured,ee=async()=>{if(!(u||!T)){d(!0),p(``),h(!1);try{await r(c),h(!0)}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}};return(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start`,children:[(0,D.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,D.jsx)(C,{value:c,onChange:e=>{l(e),a?.(e),h(!1),p(``)},zh:t,disabled:n||u})}),(0,D.jsx)(_,{variant:c===e?`secondary`:`primary`,disabled:n||u||!o.data||!T||c===e,onClick:()=>{ee()},children:u?t?`保存中…`:`Saving…`:t?`保存`:`Save`})]}),(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-2`,children:[c&&o.data?(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:b?`${S} · ${b.configured?t?`凭据就绪`:`Credentials ready`:t?`请先配置凭据`:`Configure credentials first`}`:t?`当前模型不可用,请重新选择。`:`This model is unavailable. Choose another model.`}):null,(0,D.jsx)(i,{to:`/settings/capabilities/models?returnTo=%2Fsettings%2Fphone-use&purpose=phone`,onClick:e=>{!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&(e.preventDefault(),v(`chat`,`services`,`phone`))},className:`inline-flex min-h-8 items-center text-xs text-accent-fg hover:underline`,children:t?`管理模型`:`Manage models`})]}),f&&(0,D.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:f}),m&&(0,D.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:t?`手机模型已保存,请返回手机连接测试实际操作。`:`Phone model saved. Test it from the phone connection.`})]})}export{M as n,N as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{i as n,o as r}from"./locale-store-Bg_XR36n.js";import{n as i,r as a}from"./popover-select-DD8fmrxH.js";import{t as o}from"./skeleton-BI5TyibZ.js";import{i as s}from"./vendor-swr-CdRzEUwF.js";var c=e(),l=`phone-mock/settings-about`;async function u(e,t,i=t===void 0?`GET`:`POST`){let a=await r(n(`/api/phone${e}`),{method:i,...t===void 0?{}:{headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}});if(!a.ok)throw Error(a.error?.message??`Phone operation failed`);return a.payload}var d=()=>u(`/settings`),f=()=>u(`/devices`),p=()=>u(`/models`);async function m(e,t){return(await u(e?`/devices/${encodeURIComponent(e)}/apps`:`/apps?serial=${encodeURIComponent(t)}`)).applications}var h=t();function g(e){let t=(0,c.c)(25),{value:n,onChange:r,zh:l,disabled:u}=e,d=u!==void 0&&u,f=s(`phone-models`,p);if(!f.data&&!f.error){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,h.jsx)(o,{className:`h-11 w-full rounded-lg`}),t[0]=e):e=t[0],e}let m=l?`手机模型`:`Phone model`,g=d||!!f.error,_;t[1]===r?_=t[2]:(_=e=>r(e.target.value),t[1]=r,t[2]=_);let v=l?`未配置`:`Not configured`,y;t[3]===v?y=t[4]:(y=(0,h.jsx)(a,{value:``,children:v}),t[3]=v,t[4]=y);let b;t[5]!==f.data?.models||t[6]!==n||t[7]!==l?(b=n&&!f.data?.models.some(e=>e.id===n)&&(0,h.jsx)(a,{value:n,disabled:!0,children:l?`当前模型不可用,请重新选择`:`Current model unavailable; choose another`}),t[5]=f.data?.models,t[6]=n,t[7]=l,t[8]=b):b=t[8];let x;t[9]!==f.data?.models||t[10]!==l?(x=f.data?.models.map(e=>(0,h.jsx)(a,{value:e.id,children:`${e.name} · ${e.id.split(`/`)[0]}${e.configured?``:l?` · 待配置凭据`:` · Credentials needed`}`},e.id)),t[9]=f.data?.models,t[10]=l,t[11]=x):x=t[11];let S;t[12]!==m||t[13]!==g||t[14]!==_||t[15]!==y||t[16]!==b||t[17]!==x||t[18]!==n?(S=(0,h.jsxs)(i,{"aria-label":m,value:n,disabled:g,onChange:_,children:[y,b,x]}),t[12]=m,t[13]=g,t[14]=_,t[15]=y,t[16]=b,t[17]=x,t[18]=n,t[19]=S):S=t[19];let C;t[20]===f.error?C=t[21]:(C=f.error&&(0,h.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(f.error)}),t[20]=f.error,t[21]=C);let w;return t[22]!==C||t[23]!==S?(w=(0,h.jsxs)(`div`,{className:`space-y-2`,children:[S,C]}),t[22]=C,t[23]=S,t[24]=w):w=t[24],w}function _(e){let t=(0,c.c)(24),{value:n,inherited:r,onChange:i,zh:a}=e,o=a?`手机操作模型`:`Phone Use model`,s;t[0]===o?s=t[1]:(s=(0,h.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:o}),t[0]=o,t[1]=s);let l=n?n.primary:`${a?`继承全局`:`Inherited`}: ${r?.primary??`—`}`,u;t[2]===l?u=t[3]:(u=(0,h.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:l}),t[2]=l,t[3]=u);let d;t[4]!==s||t[5]!==u?(d=(0,h.jsxs)(`div`,{children:[s,u]}),t[4]=s,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==r?.primary||t[8]!==i||t[9]!==n?(f=()=>i(n?void 0:{primary:r?.primary??``,fallbacks:[]}),t[7]=r?.primary,t[8]=i,t[9]=n,t[10]=f):f=t[10];let p=n?a?`继承全局`:`Inherit globally`:a?`单独设置`:`Override`,m;t[11]!==f||t[12]!==p?(m=(0,h.jsx)(`button`,{type:`button`,className:`touch-target rounded-lg px-3 py-2 text-sm text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:f,children:p}),t[11]=f,t[12]=p,t[13]=m):m=t[13];let _;t[14]!==d||t[15]!==m?(_=(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[d,m]}),t[14]=d,t[15]=m,t[16]=_):_=t[16];let v;t[17]!==i||t[18]!==n||t[19]!==a?(v=n&&(0,h.jsx)(g,{value:n.primary,onChange:e=>i({primary:e,fallbacks:[]}),zh:a}),t[17]=i,t[18]=n,t[19]=a,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==_?(y=(0,h.jsxs)(`section`,{className:`space-y-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[_,v]}),t[21]=v,t[22]=_,t[23]=y):y=t[23],y}export{f as a,u as c,m as i,g as n,p as o,l as r,d as s,_ as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{i as n,o as r}from"./locale-store-Br7IfbXK.js";import{n as i,r as a}from"./popover-select-CEMWIrtY.js";import{t as o}from"./skeleton-BI5TyibZ.js";import{i as s}from"./vendor-swr-CdRzEUwF.js";var c=e(),l=`phone-mock/settings-about`;async function u(e,t,i=t===void 0?`GET`:`POST`){let a=await r(n(`/api/phone${e}`),{method:i,...t===void 0?{}:{headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}});if(!a.ok)throw Error(a.error?.message??`Phone operation failed`);return a.payload}var d=()=>u(`/settings`),f=()=>u(`/devices`),p=()=>u(`/models`);async function m(e,t){return(await u(e?`/devices/${encodeURIComponent(e)}/apps`:`/apps?serial=${encodeURIComponent(t)}`)).applications}var h=t();function g(e){let t=(0,c.c)(25),{value:n,onChange:r,zh:l,disabled:u}=e,d=u!==void 0&&u,f=s(`phone-models`,p);if(!f.data&&!f.error){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,h.jsx)(o,{className:`h-11 w-full rounded-lg`}),t[0]=e):e=t[0],e}let m=l?`手机模型`:`Phone model`,g=d||!!f.error,_;t[1]===r?_=t[2]:(_=e=>r(e.target.value),t[1]=r,t[2]=_);let v=l?`未配置`:`Not configured`,y;t[3]===v?y=t[4]:(y=(0,h.jsx)(a,{value:``,children:v}),t[3]=v,t[4]=y);let b;t[5]!==f.data?.models||t[6]!==n||t[7]!==l?(b=n&&!f.data?.models.some(e=>e.id===n)&&(0,h.jsx)(a,{value:n,disabled:!0,children:l?`当前模型不可用,请重新选择`:`Current model unavailable; choose another`}),t[5]=f.data?.models,t[6]=n,t[7]=l,t[8]=b):b=t[8];let x;t[9]!==f.data?.models||t[10]!==l?(x=f.data?.models.map(e=>(0,h.jsx)(a,{value:e.id,children:`${e.name} · ${e.id.split(`/`)[0]}${e.configured?``:l?` · 待配置凭据`:` · Credentials needed`}`},e.id)),t[9]=f.data?.models,t[10]=l,t[11]=x):x=t[11];let S;t[12]!==m||t[13]!==g||t[14]!==_||t[15]!==y||t[16]!==b||t[17]!==x||t[18]!==n?(S=(0,h.jsxs)(i,{"aria-label":m,value:n,disabled:g,onChange:_,children:[y,b,x]}),t[12]=m,t[13]=g,t[14]=_,t[15]=y,t[16]=b,t[17]=x,t[18]=n,t[19]=S):S=t[19];let C;t[20]===f.error?C=t[21]:(C=f.error&&(0,h.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(f.error)}),t[20]=f.error,t[21]=C);let w;return t[22]!==C||t[23]!==S?(w=(0,h.jsxs)(`div`,{className:`space-y-2`,children:[S,C]}),t[22]=C,t[23]=S,t[24]=w):w=t[24],w}function _(e){let t=(0,c.c)(24),{value:n,inherited:r,onChange:i,zh:a}=e,o=a?`手机操作模型`:`Phone Use model`,s;t[0]===o?s=t[1]:(s=(0,h.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:o}),t[0]=o,t[1]=s);let l=n?n.primary:`${a?`继承全局`:`Inherited`}: ${r?.primary??`—`}`,u;t[2]===l?u=t[3]:(u=(0,h.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:l}),t[2]=l,t[3]=u);let d;t[4]!==s||t[5]!==u?(d=(0,h.jsxs)(`div`,{children:[s,u]}),t[4]=s,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==r?.primary||t[8]!==i||t[9]!==n?(f=()=>i(n?void 0:{primary:r?.primary??``,fallbacks:[]}),t[7]=r?.primary,t[8]=i,t[9]=n,t[10]=f):f=t[10];let p=n?a?`继承全局`:`Inherit globally`:a?`单独设置`:`Override`,m;t[11]!==f||t[12]!==p?(m=(0,h.jsx)(`button`,{type:`button`,className:`touch-target rounded-lg px-3 py-2 text-sm text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:f,children:p}),t[11]=f,t[12]=p,t[13]=m):m=t[13];let _;t[14]!==d||t[15]!==m?(_=(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[d,m]}),t[14]=d,t[15]=m,t[16]=_):_=t[16];let v;t[17]!==i||t[18]!==n||t[19]!==a?(v=n&&(0,h.jsx)(g,{value:n.primary,onChange:e=>i({primary:e,fallbacks:[]}),zh:a}),t[17]=i,t[18]=n,t[19]=a,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==_?(y=(0,h.jsxs)(`section`,{className:`space-y-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[_,v]}),t[21]=v,t[22]=_,t[23]=y):y=t[23],y}export{f as a,u as c,m as i,g as n,p as o,l as r,d as s,_ as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i,u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as o}from"./locale-store-Br7IfbXK.js";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./dist-BGTk37IG.js";import{t as m}from"./app-window-DXFNqt_0.js";import{t as h}from"./chevron-down-ccbiQQz_.js";import{n as g,r as _}from"./popover-select-CEMWIrtY.js";import{n as v,t as y}from"./beta-badge-BnzdzIEl.js";import{t as b}from"./play-kxZvpBg8.js";import{t as x}from"./plus-Q2yW6OE7.js";import{t as S}from"./refresh-cw-BRlGaq2w.js";import{t as C}from"./search-DA7gz22f.js";import{t as w}from"./shield-check-BU58siTV.js";import{t as T}from"./smartphone-DSSsQFqA.js";import{t as E}from"./x-B_N4OPjy.js";import{t as D}from"./cn-0WouolD0.js";import{t as O}from"./skeleton-BI5TyibZ.js";import{i as k}from"./vendor-swr-CdRzEUwF.js";import{t as A}from"./button-Cc4hUNTt.js";import{t as ee}from"./phone-workspace-store-SN7hfddU.js";import{l as te,m as ne,o as re,r as j,t as ie,u as ae}from"./dist-ZrL34Ps4.js";import{n as oe,t as se}from"./global-defaults-api-BWMbKu72.js";import{n as ce,t as le}from"./settings-page-header-BZl4AMiN.js";import{a as ue,c as M,i as N,r as de,s as fe}from"./phone-model-picker-DuZc5jYO.js";import{t as pe}from"./phone-dependencies-card-CDhk5277.js";import{n as me,t as he}from"./phone-model-connection-DZ-ZunPz.js";var P=e(t(),1),F=r();function ge({device:e,zh:t,onClose:n,onConnected:r}){let[i,a]=(0,P.useState)(!1),[o,l]=(0,P.useState)(e.wireless?.host??``),[m,h]=(0,P.useState)(``),[g,_]=(0,P.useState)(!1),[v,y]=(0,P.useState)(``),b=async()=>{_(!0),y(``);try{await M(`/devices/${e.id}/reconnect`,i?{host:o,port:Number(m)}:{}),await r(),n()}catch(e){y(e instanceof Error?e.message:String(e)),a(!0)}finally{_(!1)}};return(0,F.jsx)(p,{open:!0,onOpenChange:e=>{!e&&!g&&n()},children:(0,F.jsxs)(u,{children:[(0,F.jsx)(s,{className:`fixed inset-0 z-[80] bg-black/40`}),(0,F.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[81] flex h-[min(28rem,90dvh)] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay p-5 text-fg`,children:[(0,F.jsxs)(f,{className:`text-base font-semibold`,children:[t?`重新连接手机`:`Reconnect phone`,` · `,e.name]}),(0,F.jsx)(c,{className:`mt-2 text-sm text-fg-muted`,children:t?`开启手机无线调试,并连接 Gateway 所在局域网。重连会保留设备权限,之前的任务需要重新打开。`:`Enable wireless debugging on the Gateway network. Device permissions are preserved; reopen the previous task.`}),(0,F.jsxs)(`form`,{className:`mt-4 flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,F.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto`,children:[(0,F.jsxs)(`label`,{className:`flex min-h-11 items-center gap-2 text-sm`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:i,disabled:g,onChange:e=>a(e.target.checked)}),t?`手动填写当前连接地址`:`Enter current connection address`]}),i&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`label`,{className:`block text-sm`,children:[t?`手机 IP 地址`:`Phone IP address`,(0,F.jsx)(`input`,{className:`mt-1 w-full rounded-lg border border-edge bg-surface-base p-2`,required:!0,value:o,disabled:g,onChange:e=>l(e.target.value.trim())})]}),(0,F.jsxs)(`label`,{className:`block text-sm`,children:[t?`连接端口(无线调试首页)`:`Connection port (Wireless debugging screen)`,(0,F.jsx)(`input`,{className:`mt-1 w-full rounded-lg border border-edge bg-surface-base p-2`,type:`number`,min:1,max:65535,required:!0,value:m,disabled:g,onChange:e=>h(e.target.value)})]})]}),v&&(0,F.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:v})]}),(0,F.jsxs)(`footer`,{className:`mt-4 flex shrink-0 justify-end gap-2 border-t border-edge pt-4`,children:[(0,F.jsx)(A,{type:`button`,disabled:g,onClick:n,children:t?`取消`:`Cancel`}),(0,F.jsx)(A,{type:`submit`,variant:`primary`,disabled:g,children:g?t?`正在连接…`:`Connecting…`:t?`重新连接`:`Reconnect`})]})]})]})]})})}var I=n();function _e(e){let t=(0,I.c)(29),{deviceId:n,serial:r,mode:i,selected:a,onModeChange:o,onSelectedChange:s,disabled:c,zh:l}=e,u=(0,P.useId)(),[d,f]=(0,P.useState)(``),p;t[0]!==n||t[1]!==i||t[2]!==r?(p=i===`selected`?[`phone-applications`,n??r]:null,t[0]=n,t[1]=i,t[2]=r,t[3]=p):p=t[3];let h;t[4]!==n||t[5]!==r?(h=()=>N(n,r),t[4]=n,t[5]=r,t[6]=h):h=t[6];let g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1,shouldRetryOnError:!1},t[7]=g):g=t[7];let _=k(p,h,g),v;if(t[8]!==_||t[9]!==c||t[10]!==u||t[11]!==i||t[12]!==o||t[13]!==s||t[14]!==d||t[15]!==a||t[16]!==l){let e=d.trim().toLocaleLowerCase(),n=_.data?.filter(t=>`${t.label} ${t.packageName}`.toLocaleLowerCase().includes(e))??[],r=_.data,p=r?a.filter(e=>!r.some(t=>t.packageName===e)):[],h;t[18]!==s||t[19]!==a?(h=e=>s(a.includes(e)?a.filter(t=>t!==e):[...a,e]),t[18]=s,t[19]=a,t[20]=h):h=t[20];let g=h,y=l?`应用权限`:`Application access`,b;t[21]===y?b=t[22]:(b=(0,F.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:y}),t[21]=y,t[22]=b);let x;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(x=[`all`,`selected`],t[23]=x):x=t[23];let w;t[24]!==u||t[25]!==i||t[26]!==o||t[27]!==l?(w=(0,F.jsx)(`div`,{className:`grid gap-2`,children:x.map(e=>(0,F.jsxs)(`label`,{className:D(`flex min-h-14 cursor-pointer items-start gap-3 rounded-xl border p-3`,i===e?`border-accent/50 bg-accent-soft`:`border-edge bg-surface-base`),children:[(0,F.jsx)(`input`,{type:`radio`,name:u,value:e,checked:i===e,onChange:()=>o(e),className:`mt-1 size-4 shrink-0 accent-accent`}),(0,F.jsxs)(`span`,{className:`min-w-0`,children:[(0,F.jsx)(`span`,{className:`block text-sm font-medium`,children:e===`all`?l?`允许所有应用`:`Allow all apps`:l?`仅允许所选应用`:`Only selected apps`}),(0,F.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-fg-muted`,children:e===`all`?l?`可在手机上的应用间切换,无需逐个配置。`:`Switch between apps on this phone without individual setup.`:l?`从手机上已安装的应用中选择。`:`Choose from applications installed on the phone.`})]})]},e))}),t[24]=u,t[25]=i,t[26]=o,t[27]=l,t[28]=w):w=t[28],v=(0,F.jsxs)(`fieldset`,{disabled:c,className:`space-y-3`,children:[b,w,i===`selected`?(0,F.jsxs)(`div`,{className:`space-y-2`,"aria-label":l?`选择手机应用`:`Choose phone applications`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:l?`已选择 ${a.length} 个应用`:`${a.length} apps selected`}),(0,F.jsxs)(A,{variant:`ghost`,className:`gap-1 px-2 py-1 text-xs`,"aria-label":l?`刷新应用列表`:`Refresh applications`,disabled:c||_.isValidating,onClick:()=>{_.mutate()},children:[(0,F.jsx)(S,{className:D(`size-3.5`,_.isValidating&&`animate-spin motion-reduce:animate-none`),"aria-hidden":!0}),l?`刷新`:`Refresh`]})]}),(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(C,{className:`pointer-events-none absolute left-3 top-3 size-4 text-fg-muted`,"aria-hidden":!0}),(0,F.jsx)(`input`,{type:`search`,"aria-label":l?`搜索手机应用`:`Search phone applications`,placeholder:l?`搜索应用`:`Search apps`,value:d,onChange:e=>f(e.target.value),className:`min-h-10 w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm focus-visible:outline-2 focus-visible:outline-accent`})]}),_.error?(0,F.jsxs)(`div`,{role:`alert`,className:`rounded-lg bg-surface-inset p-3 text-sm text-fg-muted`,children:[l?`暂时无法读取应用,请确认手机已连接后重试。之前的选择会保留。`:`Unable to read apps. Check the phone connection and retry. Previous selections are preserved.`,(0,F.jsx)(A,{variant:`ghost`,className:`ml-1 text-accent`,onClick:()=>{_.mutate()},children:l?`重试`:`Retry`})]}):null,!_.data&&!_.error?(0,F.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,F.jsx)(O,{className:`h-10 w-full`}),(0,F.jsx)(O,{className:`h-10 w-full`}),(0,F.jsx)(O,{className:`h-10 w-full`})]}):_.data?(0,F.jsxs)(`div`,{className:`max-h-56 overflow-y-auto overscroll-contain rounded-lg border border-edge bg-surface-base`,"aria-label":l?`可选应用`:`Available applications`,children:[n.map(e=>(0,F.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center gap-3 px-3 py-2 hover:bg-surface-hover`,children:[(0,F.jsx)(m,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`span`,{className:`block truncate text-sm`,title:e.label,children:e.label}),e.label!==e.packageName&&_.data.some(t=>t.packageName!==e.packageName&&t.label===e.label)?(0,F.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:e.packageName}):null]}),(0,F.jsx)(`input`,{type:`checkbox`,"aria-label":e.label,checked:a.includes(e.packageName),onChange:()=>g(e.packageName),className:`size-4 shrink-0 accent-accent`})]},e.packageName)),n.length?null:(0,F.jsx)(`p`,{className:`p-4 text-center text-sm text-fg-muted`,children:e?l?`没有找到匹配的应用`:`No matching applications`:l?`这台手机上没有可打开的应用`:`No launchable applications on this phone`})]}):null,p.length?(0,F.jsxs)(`div`,{className:`space-y-1 text-xs text-fg-muted`,children:[(0,F.jsx)(`p`,{children:l?`以下原有选择未在手机上找到,可取消选择。`:`These previous selections are no longer available. You may deselect them.`}),p.map(e=>(0,F.jsxs)(`label`,{className:`flex min-h-9 items-center gap-2`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:!0,onChange:()=>g(e),className:`accent-accent`}),(0,F.jsx)(`span`,{className:`break-all`,children:e})]},e))]}):null,a.length?null:(0,F.jsx)(`p`,{className:`text-xs text-fg-muted`,children:l?`至少选择一个应用后保存。`:`Choose at least one application before saving.`})]}):null]}),t[8]=_,t[9]=c,t[10]=u,t[11]=i,t[12]=o,t[13]=s,t[14]=d,t[15]=a,t[16]=l,t[17]=v}else v=t[17];return v}function L({deviceId:e,value:t,onChange:n,disabled:r,zh:i}){let[a,o]=(0,P.useState)(!1),[s,c]=(0,P.useState)(``);async function l(){o(!0),c(``);try{let t=await M(`/devices/${e}/input-status`);c(t.unicode===`available`?i?`中文输入通道已就绪,具体应用仍需允许粘贴。`:`Unicode input is ready. The app must allow pasting.`:t.unicode===`setup_required`?i?`请在手机依赖中安装或修复 scrcpy server,再重试检测。无需安装手机输入法。`:`Install or repair scrcpy server under phone dependencies, then retry. No phone keyboard installation is needed.`:i?`这台手机暂不支持自动中文输入,请接管后使用手机自带键盘。`:`Automatic Unicode input is unavailable. Take over and use the phone keyboard.`)}catch{c(i?`暂时无法检测,请确认手机连接后重试。`:`Unable to check. Reconnect the phone and retry.`)}finally{o(!1)}}return(0,F.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge bg-surface-base p-3`,children:[(0,F.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-3 text-sm font-medium`,children:[i?`允许自动输入文字`:`Allow automatic text input`,(0,F.jsx)(`input`,{type:`checkbox`,checked:t===`auto`,disabled:r,onChange:e=>n(e.target.checked?`auto`:`manual`),className:`size-4 accent-accent`})]}),(0,F.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:t===`auto`?i?`中文和 Emoji 通过手机剪贴板粘贴,不安装或切换输入法。输入内容可能留在手机剪贴板;不会读取或同步原有剪贴板。`:`Chinese and emoji use the phone clipboard without installing or switching keyboards. Supplied text may remain there; existing clipboard contents are never read or synced.`:i?`Agent 会在需要输入时暂停。请接管手机,使用手机自带键盘输入,完成后交还 Agent。`:`The Agent pauses when text is needed. Take over, type with the phone keyboard, then hand back to the Agent.`}),e?(0,F.jsx)(A,{variant:`ghost`,className:`min-h-9 px-2 text-xs text-accent`,disabled:r||a,onClick:()=>void l(),children:a?i?`正在检测…`:`Checking…`:i?`检测中文输入能力`:`Check Unicode input`}):null,s?(0,F.jsx)(`p`,{role:`status`,className:`text-xs leading-relaxed text-fg-muted`,children:s}):null]})}var R=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,z=`min-h-11 w-full cursor-default rounded-lg px-3 py-2 text-left text-sm outline-none data-[highlighted]:bg-surface-hover data-[highlighted]:ring-2 data-[highlighted]:ring-inset data-[highlighted]:ring-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,B=`space-y-4 rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`;function ve({device:e,serial:t,name:n,onSave:r,onClose:i,zh:a}){let[o,m]=(0,P.useState)(e?.name??n),[h,g]=(0,P.useState)(e?.appAccess??(e?.allowedApps.length?`selected`:`all`)),[_,v]=(0,P.useState)(e?.allowedApps??[]),[y,b]=(0,P.useState)(e?.textInput??`auto`),[x,S]=(0,P.useState)(e?.enabled??!0),[C,w]=(0,P.useState)(!1),[T,D]=(0,P.useState)(``),O=async()=>{w(!0),D(``);try{let n={name:o,appAccess:h,allowedApps:h===`all`?[]:_,textInput:y,enabled:x};await M(e?`/devices/${e.id}`:`/devices`,e?n:{...n,serial:t},e?`PATCH`:`POST`),await r(),i()}catch(e){D(e instanceof Error?e.message:String(e))}finally{w(!1)}};return(0,F.jsx)(p,{open:!0,onOpenChange:e=>{!e&&!C&&i()},children:(0,F.jsxs)(u,{children:[(0,F.jsx)(s,{className:`fixed inset-0 z-[80] bg-black/40`}),(0,F.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[81] flex h-[min(44rem,90dvh)] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay p-5 text-fg`,children:[(0,F.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(f,{className:`text-base font-semibold`,children:e?a?`管理手机`:`Manage phone`:a?`添加手机`:`Add phone`}),(0,F.jsx)(c,{className:`mt-1 text-sm text-fg-muted`,children:a?`设备连接在 Gateway 所在电脑。修改权限会停止当前控制。`:`This phone connects to the Gateway host. Changing access stops active control.`})]}),(0,F.jsx)(l,{asChild:!0,children:(0,F.jsx)(A,{variant:`ghost`,disabled:C,"aria-label":a?`关闭`:`Close`,children:(0,F.jsx)(E,{className:`size-4`})})})]}),(0,F.jsxs)(`form`,{className:`mt-5 flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),O()},children:[(0,F.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto pr-1`,children:[(0,F.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[a?`名称`:`Name`,(0,F.jsx)(`input`,{className:R,value:o,maxLength:100,required:!0,onChange:e=>m(e.target.value)})]}),(0,F.jsxs)(`p`,{className:`break-all text-xs text-fg-muted`,children:[`ADB: `,t]}),(0,F.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`已启用 phone_use 工具的 Agent 可使用这台手机。`:`Agents with the phone_use tool can use this phone.`}),(0,F.jsx)(_e,{deviceId:e?.id,serial:t,mode:h,selected:_,onModeChange:g,onSelectedChange:v,zh:a,disabled:C}),(0,F.jsx)(L,{deviceId:e?.id,value:y,onChange:b,disabled:C,zh:a}),(0,F.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-3 text-sm`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>S(e.target.checked)}),a?`允许访问这台手机`:`Enable access to this phone`]}),T&&(0,F.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:T})]}),(0,F.jsxs)(`div`,{className:`mt-4 flex shrink-0 justify-end gap-2 border-t border-edge pt-4`,children:[(0,F.jsx)(A,{type:`button`,disabled:C,onClick:i,children:a?`取消`:`Cancel`}),(0,F.jsx)(A,{type:`submit`,variant:`primary`,disabled:C||!o.trim()||h===`selected`&&!_.length,children:C?a?`保存中…`:`Saving…`:a?`保存手机`:`Save phone`})]})]})]})]})})}function V(){let[e,t]=i(),n=(t,n=!1)=>e.has(t)?e.get(t)===`1`:n,r=(e,r,i=!1)=>{r!==n(e,i)&&t(t=>{let n=new URLSearchParams(t);return n.set(e,r?`1`:`0`),n})},s=o(e=>e.language)===`zh`,c=k(`phone-settings`,fe),l=k(`phone-devices`,ue,{refreshInterval:15e3}),u=k(`settings-agent-defaults`,se),d=u.data?.defaults.models.phoneUse?.primary??``,[f,p]=(0,P.useState)(d);(0,P.useEffect)(()=>{p(d)},[d]);let[m,C]=(0,P.useState)(!1),[E,D]=(0,P.useState)(``),[N,I]=(0,P.useState)(``),[_e,L]=(0,P.useState)(!1),[V,ye]=(0,P.useState)(),[be,H]=(0,P.useState)(),[xe,Se]=(0,P.useState)(``),[U,Ce]=(0,P.useState)(``),[W,we]=(0,P.useState)(``),[G,Te]=(0,P.useState)(()=>sessionStorage.getItem(`phone-settings-session`)??``),K=k(G?[`phone-session`,G]:null,()=>M(`/sessions/${G}`),{refreshInterval:1500}),Ee=a(),[q,J]=(0,P.useState)({}),Y=K.data,X=Y?.status===`running`,Z=xe||l.data?.defaultDeviceId||``,De=d===de,Q=async(e,t)=>{C(!0),D(``),I(``);try{await e(),t&&I(t)}catch(e){D(e instanceof Error?e.message:String(e))}finally{C(!1)}},Oe=async e=>{let t=await se(),n={...t.defaults.models};e?n.phoneUse={primary:e,fallbacks:[]}:delete n.phoneUse;let r=await oe({...t.defaults,models:n},{scope:`models`,expectedModels:t.defaults.models});await u.mutate(r,!1),p(e)},ke=()=>Q(async()=>{G&&Y&&![`closed`,`cancelled`,`failed`,`outcome_unknown`].includes(Y.status)&&await M(`/sessions/${G}/execute`,{op:`close`});let e=await M(`/sessions`,{deviceId:Z,mode:`control`});Te(e.id),sessionStorage.setItem(`phone-settings-session`,e.id),await M(`/sessions/${e.id}/execute`,{op:`run`,goal:U,...W?{expectText:W}:{},maxActions:6})}),$=e=>Q(async()=>{await M(`/sessions/${G}/execute`,{op:e}),await K.mutate()}),Ae=async e=>{J(t=>({...t,[e.id]:{pending:!0,text:s?`正在诊断…`:`Checking…`}}));try{let t=await M(`/devices/${e.id}/diagnostics`,{}),n=s?{device:`已连接`,disconnected:`未连接`,unauthorized:`未授权调试`,offline:`离线`}:{device:`Connected`,disconnected:`Disconnected`,unauthorized:`Debugging not authorized`,offline:`Offline`};J(r=>({...r,[e.id]:{pending:!1,text:`${s?`诊断结果`:`Diagnostics`}:${n[t.state]??t.state}`}}))}catch(t){J(n=>({...n,[e.id]:{pending:!1,error:!0,text:t instanceof Error?t.message:String(t)}}))}},je=s?{ready:`就绪`,running:`执行中`,paused:`已暂停`,needs_user:`等待人工处理`,completed:`执行结束`,cancelled:`已停止`,closed:`已关闭`,failed:`执行失败`,outcome_unknown:`结果待核查`}:{},Me=!!(l.data?.devices.length&&l.data.devices.every(e=>e.connection));return(0,F.jsxs)(ce,{gap:`gap-6`,className:`max-w-[48rem]`,children:[(0,F.jsx)(le,{aiSetup:`phone`,title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[s?`手机控制`:`Phone Use`,(0,F.jsx)(y,{})]}),subtitle:s?`让 AI 帮你操作 Android 手机。`:`Let AI work with your Android phone.`}),E&&(0,F.jsx)(`p`,{role:`alert`,className:`rounded-xl bg-danger-soft p-3 text-sm text-danger`,children:E}),N&&(0,F.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:N}),c.error&&(0,F.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(c.error)}),(0,F.jsx)(`section`,{className:B,"aria-label":s?`手机控制设置`:`Phone control settings`,children:(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,F.jsx)(`span`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl bg-surface-inset text-fg-muted`,children:(0,F.jsx)(T,{className:`size-6`,"aria-hidden":!0})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h2`,{className:`text-sm font-semibold`,children:s?`启用手机控制`:`Enable Phone Use`}),(0,F.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:s?`连接与操作在 Gateway 电脑上执行。`:`Connects and runs on your Gateway computer.`})]})]}),c.data?(0,F.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":c.data.config.enabled,"aria-label":s?`启用手机控制`:`Enable Phone Use`,disabled:m||X,className:`touch-target flex shrink-0 items-center rounded-lg px-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,onClick:()=>{let e=!c.data.config.enabled;Q(async()=>{await M(`/settings`,{...c.data.config,enabled:e},`PATCH`),await c.mutate()})},children:(0,F.jsx)(`span`,{className:`flex h-6 w-11 items-center rounded-full p-0.5 transition-colors motion-reduce:transition-none ${c.data.config.enabled?`bg-accent`:`bg-fg-muted/30`}`,children:(0,F.jsx)(`span`,{className:`size-5 rounded-full bg-white transition-transform motion-reduce:transition-none ${c.data.config.enabled?`translate-x-5`:`translate-x-0`}`})})}):(0,F.jsx)(O,{className:`h-8 w-12`})]})}),(0,F.jsx)(`section`,{className:B,children:(0,F.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,F.jsx)(`span`,{children:s?`默认执行方式`:`Default execution strategy`}),c.data?(0,F.jsxs)(g,{"aria-label":s?`默认执行方式`:`Default execution strategy`,value:c.data.config.executionMode??`collaborative`,disabled:m,onChange:e=>{let t=e.target.value;Q(async()=>{await M(`/settings`,{...c.data.config,executionMode:t},`PATCH`),await c.mutate()})},children:[(0,F.jsx)(_,{value:`collaborative`,children:s?`主 Agent 协作(默认)`:`Main Agent collaboration (default)`}),(0,F.jsx)(_,{value:`direct`,children:s?`直接执行`:`Direct execution`})]}):(0,F.jsx)(O,{className:`h-10 w-full`}),(0,F.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s?`协作:主 Agent 拆解目标并根据反馈继续。直接执行:手机模型自行规划完整手机任务。修改只影响新任务,聊天可覆盖。`:`Collaboration: the main Agent plans small goals using feedback. Direct: the phone model plans the full phone task. Changes affect new tasks; chats can override.`})]})}),(0,F.jsxs)(`section`,{"aria-label":s?`手机模型配置`:`Phone model configuration`,className:B,children:[(0,F.jsx)(`h2`,{className:`text-sm font-semibold`,children:s?`操作模型`:`Phone model`}),c.data&&(0,F.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,F.jsx)(`span`,{children:s?`连接保持时间`:`Connection lifetime`}),(0,F.jsxs)(g,{"aria-label":s?`连接保持时间`:`Connection lifetime`,value:String(c.data.config.idleDisconnectMs??0),disabled:m||X,onChange:e=>{let t=Number(e.target.value);Q(async()=>{await M(`/settings`,{...c.data.config,idleDisconnectMs:t},`PATCH`),await c.mutate()})},children:[(0,F.jsx)(_,{value:`0`,children:s?`保持连接,直到手动断开`:`Keep connected until disconnected`}),[15,30,60].map(e=>(0,F.jsx)(_,{value:String(e*6e4),children:s?`闲置 ${e} 分钟后断开`:`Disconnect after ${e} idle minutes`},e))]}),(0,F.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s?`任务结束后保留连接;执行任务、人工操作和查看画面期间不计闲置。`:`Tasks finish without disconnecting. Running tasks, manual control and viewing the screen do not count as idle.`})]}),!u.data&&!u.error?(0,F.jsx)(O,{className:`h-20 w-full`}):(0,F.jsx)(he,{value:d,onSelect:p,onSave:Oe,zh:s,disabled:m||X||!u.data}),u.error&&(0,F.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(u.error)}),(0,F.jsx)(`div`,{className:`flex flex-wrap items-center gap-3`,children:(0,F.jsx)(A,{variant:`ghost`,className:`px-0 text-accent-fg hover:bg-transparent hover:underline`,disabled:m||!f||f===`phone-mock/settings-about`,onClick:()=>{Q(async()=>{let e=await M(`/models/diagnostics`,{modelRef:f});I(e.mock?s?`模拟适配器可用;此测试不验证真实模型。`:`Mock adapter ready; this does not validate a real model.`:e.groundingVerified?s?`模型连接、动作协议和测试图定位通过;未操作真实手机。`:`Connection, protocol and test-image grounding passed. No phone was operated.`:s?`动作协议有效,但测试图定位未通过。`:`Protocol valid, but test-image grounding did not pass.`)})},children:s?`测试模型连接`:`Test model connection`})}),(0,F.jsxs)(`details`,{open:n(`privacy`),onToggle:e=>r(`privacy`,e.currentTarget.open),className:`group border-t border-edge-subtle pt-1 text-xs text-fg-muted`,children:[(0,F.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-2 [&::-webkit-details-marker]:hidden`,children:[(0,F.jsx)(w,{className:`size-4`,"aria-hidden":!0}),s?`隐私与执行限制`:`Privacy & execution limits`,(0,F.jsx)(h,{className:`ml-auto size-4 group-open:rotate-180`,"aria-hidden":!0})]}),(0,F.jsxs)(`div`,{className:`space-y-3 pb-2 leading-relaxed`,children:[(0,F.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:s?`手机截图会发送给所选模型;页面摘要可能进入聊天模型。`:`Phone screenshots go to the selected model; page summaries may reach the chat model.`}),` `,c.data&&(0,F.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[s?`每次小目标最多 12 步、${c.data.config.maxOperationDurationMs/1e3} 秒活跃执行时间;会话限制`:`Each goal: up to 12 actions / ${c.data.config.maxOperationDurationMs/1e3} active seconds. Session limits`,`: `,c.data.config.maxActionsPerSession,` `,s?`动作`:`actions`,` · `,c.data.config.maxModelRequests,` `,s?`模型请求`:`model requests`]}),(0,F.jsx)(`p`,{children:s?`远程浏览器无法访问你本机的 USB 设备。`:`A remote browser cannot access your local USB devices.`})]})]})]}),(0,F.jsxs)(`section`,{className:`space-y-3`,"aria-label":s?`手机管理`:`Phone management`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsx)(`h2`,{className:`text-sm font-semibold`,children:s?`手机管理`:`Phones`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(A,{variant:`ghost`,disabled:m,onClick:()=>L(!0),children:[(0,F.jsx)(x,{className:`size-4`,"aria-hidden":!0}),s?`添加手机`:`Add phone`]}),(0,F.jsxs)(A,{variant:`ghost`,disabled:m||l.isValidating,onClick:()=>{Q(()=>l.mutate())},children:[(0,F.jsx)(S,{className:`size-4`,"aria-hidden":!0}),s?`刷新`:`Refresh`]})]})]}),!l.data&&!l.error?(0,F.jsx)(O,{className:`h-32 w-full rounded-xl`}):(0,F.jsxs)(`div`,{className:B,children:[(l.error||!Me&&l.data?.diagnostic)&&(0,F.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[l.data?.diagnostic??String(l.error),` · `,s?`检查 Gateway 电脑的 Android SDK 与 ADB。`:`Check Android SDK and ADB on the Gateway host.`]}),l.data?.devices.map(e=>(0,F.jsxs)(`div`,{className:`border-b border-edge-subtle pb-4 last:border-b-0 last:pb-0`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col items-start justify-between gap-3 sm:flex-row sm:gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3`,children:[(0,F.jsx)(T,{className:`mt-0.5 size-5 shrink-0 text-fg-muted`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`p`,{className:`break-words text-sm font-medium`,children:[e.name,e.id===l.data?.defaultDeviceId&&(0,F.jsx)(`span`,{className:`ml-2 inline-block rounded-md bg-surface-inset px-2 py-0.5 text-xs font-normal text-fg-muted`,children:s?`默认`:`Default`})]}),(0,F.jsxs)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:[e.connection?`${s?`阿里云`:`Alibaba Cloud`} · ADB · `:``,e.serial,` · `,e.enabled?e.connection?s?`已配置 · 按需连接`:`Configured · Connects on demand`:{device:s?`已连接`:`Connected`,offline:s?`离线`:`Offline`,unauthorized:s?`待授权`:`Unauthorized`}[l.data?.discovery.find(t=>t.serial===e.serial)?.state??``]??(s?`未连接`:`Disconnected`):s?`已禁用`:`Disabled`]})]})]}),(0,F.jsxs)(`div`,{className:`flex max-w-full shrink-0 flex-wrap items-center justify-end gap-1 self-end sm:self-start`,children:[(0,F.jsx)(A,{variant:`ghost`,disabled:m,onClick:()=>H({device:e,serial:e.serial,name:e.name}),children:s?`管理`:`Manage`}),(0,F.jsx)(A,{variant:`ghost`,disabled:m||!e.enabled,onClick:()=>{Q(async()=>{await M(`/devices/${e.id}/view`,{}),window.dispatchEvent(new Event(`phone-connections-changed`)),ee.getState().show(e.id)})},children:s?`查看屏幕`:`View screen`}),(0,F.jsx)(A,{variant:`ghost`,disabled:m||!e.enabled,onClick:()=>{Q(async()=>{let t=await M(`/devices/${e.id}/conversations`,{});window.dispatchEvent(new Event(`session-created`)),ee.getState().hide(),Ee(`/chat/${t.conversationId}`)})},children:s?`对话控制手机`:`Control in chat`}),(0,F.jsxs)(te,{modal:!1,children:[(0,F.jsx)(ne,{asChild:!0,children:(0,F.jsxs)(A,{variant:`ghost`,disabled:m,"aria-label":s?`${e.name}的更多操作`:`More actions for ${e.name}`,children:[s?`更多`:`More`,(0,F.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,F.jsx)(re,{children:(0,F.jsxs)(ie,{align:`end`,sideOffset:6,collisionPadding:12,className:`z-[90] min-w-40 max-w-[calc(100vw-1.5rem)] rounded-xl border border-edge bg-surface-overlay p-1 text-fg shadow-popover`,children:[e.wireless&&(0,F.jsx)(j,{disabled:m||!e.enabled,className:z,onSelect:()=>ye(e),children:s?`重新连接`:`Reconnect`}),(0,F.jsx)(j,{disabled:m||q[e.id]?.pending,className:z,onSelect:()=>{Ae(e)},children:e.connection?s?`连接诊断`:`Connect & diagnose`:s?`诊断`:`Diagnose`}),e.id!==l.data?.defaultDeviceId&&(0,F.jsx)(j,{disabled:m,className:z,onSelect:()=>{Q(async()=>{await M(`/devices/${e.id}/default`,{}),await l.mutate()})},children:s?`设为默认`:`Set default`}),(0,F.jsx)(ae,{className:`my-1 border-t border-edge-subtle`}),(0,F.jsx)(j,{disabled:m,className:`${z} text-danger`,onSelect:()=>{Q(async()=>{await M(`/devices/${e.id}`,void 0,`DELETE`),await l.mutate()})},children:s?`移除连接`:`Remove connection`})]})})]})]})]}),(0,F.jsx)(`p`,{role:`status`,"aria-live":`polite`,title:q[e.id]?.text,className:`h-5 truncate text-xs leading-5 ${q[e.id]?.error?`text-danger`:`text-fg-muted`}`,children:q[e.id]?.text})]},e.id)),l.data?.discovery.filter(e=>!l.data?.devices.some(t=>t.serial===e.serial)).map(e=>(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`p`,{className:`text-sm`,children:e.name}),(0,F.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e.emulator?s?`Android 模拟器`:`Android emulator`:`Android`,` · `,e.state]})]}),(0,F.jsx)(A,{disabled:m||e.state!==`device`,onClick:()=>H({serial:e.serial,name:e.name}),children:s?`添加手机`:`Add phone`})]},e.serial)),!l.data?.devices.length&&!l.data?.discovery.length&&(0,F.jsx)(`p`,{className:`py-3 text-sm text-fg-muted`,children:s?`尚未发现设备。先启动 Android 模拟器,或通过 USB 连接手机并允许调试。`:`No devices found. Start an Android emulator, or connect a phone over USB and authorize debugging.`})]})]}),(0,F.jsx)(pe,{expanded:n(`components`),onExpandedChange:e=>r(`components`,e),cloudOnly:Me,onChanged:()=>{l.mutate(),c.mutate()}}),(0,F.jsxs)(`details`,{open:n(`test`,!!G),onToggle:e=>r(`test`,e.currentTarget.open,!!G),className:`group rounded-2xl border border-edge bg-surface-panel`,"aria-label":s?`手机试运行`:`Phone test run`,children:[(0,F.jsxs)(`summary`,{className:`flex min-h-16 cursor-pointer list-none items-center gap-3 p-5 [&::-webkit-details-marker]:hidden`,children:[(0,F.jsx)(v,{className:`size-5 text-fg-muted`,"aria-hidden":!0}),(0,F.jsx)(`h2`,{className:`text-sm font-semibold`,children:s?`试运行`:`Test run`}),(0,F.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:s?`验证手机操作`:`Try a task`}),(0,F.jsx)(h,{className:`size-4 shrink-0 text-fg-muted group-open:rotate-180`,"aria-hidden":!0})]}),(0,F.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle p-5`,children:[(0,F.jsxs)(g,{"aria-label":s?`测试手机`:`Test phone`,value:Z,disabled:m||X,onChange:e=>Se(e.target.value),children:[(0,F.jsx)(_,{value:``,children:s?`选择手机`:`Choose phone`}),l.data?.devices.filter(e=>e.enabled).map(e=>(0,F.jsx)(_,{value:e.id,children:e.name},e.id))]}),(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[s?`本次授权的小目标`:`Authorized goal`,(0,F.jsx)(`textarea`,{className:R,value:U,maxLength:2e3,onChange:e=>Ce(e.target.value)})]}),(0,F.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[s?`完成时应显示的文字(可选)`:`Expected completion text (optional)`,(0,F.jsx)(`input`,{className:R,value:W,maxLength:200,onChange:e=>we(e.target.value)})]}),(0,F.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s?`先手动打开允许的应用。模型说完成只表示执行结束,只有匹配界面证据才会显示验证通过。`:`First open an allowed app manually. A model completion claim remains unverified until native UI evidence matches.`})]}),(0,F.jsxs)(A,{variant:`primary`,disabled:m||X||!c.data?.config.enabled||!d||De||f!==d||!Z||!U.trim(),onClick:()=>{ke()},children:[(0,F.jsx)(b,{className:`size-4`}),s?`开始试运行`:`Start test run`]}),K.error&&(0,F.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(K.error)}),Y&&(0,F.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge bg-surface-inset p-4`,"aria-live":`polite`,children:[(0,F.jsxs)(`p`,{className:`text-sm font-medium`,children:[Y.deviceName,` · `,je[Y.status]??Y.status]}),(0,F.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[Y.actions,` `,s?`动作`:`actions`,` · `,Y.modelRequests,` `,s?`模型请求`:`model requests`,` · `,Y.verified?s?`界面条件已验证`:`UI condition verified`:s?`尚未验证完成`:`Completion unverified`]}),Y.message&&(0,F.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Y.message}),(Y.errorCode||Y.stopReason)&&(0,F.jsx)(`p`,{className:`break-all text-xs text-fg-muted`,children:Y.errorCode??Y.stopReason}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsx)(A,{disabled:m||!X,onClick:()=>{$(`pause`)},children:s?`暂停`:`Pause`}),(0,F.jsx)(A,{disabled:m||![`paused`,`needs_user`].includes(Y.status),onClick:()=>{$(`resume`)},children:s?`恢复`:`Resume`}),(0,F.jsx)(A,{disabled:m||[`closed`,`cancelled`].includes(Y.status),onClick:()=>{$(`cancel`)},children:s?`停止`:`Stop`}),(0,F.jsx)(A,{disabled:m,onClick:()=>{$(`close`)},children:s?`释放手机`:`Release phone`}),Y.status===`ready`&&!Y.mock&&(0,F.jsx)(A,{disabled:m,onClick:()=>{Q(async()=>{await M(`/sessions/${G}/execute`,{op:`run`,goal:U,...W?{expectText:W}:{}}),await K.mutate()})},children:s?`继续当前目标`:`Continue goal`})]}),Y.facts?.length?(0,F.jsxs)(`details`,{children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:s?`本次观察到的界面文字`:`Observed UI text`}),(0,F.jsx)(`ul`,{className:`mt-2 max-h-52 space-y-1 overflow-auto text-xs text-fg-muted`,children:Y.facts.map((e,t)=>(0,F.jsx)(`li`,{className:`break-words`,children:e},t))})]}):null]})]})]},G),_e&&(0,F.jsx)(me,{onAdded:()=>{l.mutate()},zh:s,onClose:()=>L(!1),onSelect:e=>{L(!1),H({serial:e.serial,name:e.name})}}),V&&(0,F.jsx)(ge,{device:V,zh:s,onClose:()=>ye(void 0),onConnected:async()=>{await l.mutate()}}),be&&c.data&&(0,F.jsx)(ve,{...be,zh:s,onSave:async()=>{await l.mutate()},onClose:()=>H(void 0)})]})}export{V as PhoneSettingsPage};
@@ -1 +1 @@
1
- import{p as e}from"./locale-store-Bg_XR36n.js";var t=e(e=>({activation:0,open:!1,selected:null,controlConversationId:null,displayMode:`docked`,position:null,floatingWidth:288,setFloatingWidth:t=>e({floatingWidth:t}),setDisplayMode:t=>e({displayMode:t}),setPosition:t=>e(e=>e.position?.x===t.x&&e.position?.y===t.y?e:{position:t}),show:(t,n=!0,r)=>e(e=>({activation:e.activation+ +!!n,selected:n||!e.selected?t??e.selected:e.selected,open:n||e.open,controlConversationId:n||!e.open?r??(t===void 0||t===e.selected?e.controlConversationId:null):e.controlConversationId})),hide:()=>e({open:!1})}));export{t};
1
+ import{p as e}from"./locale-store-Br7IfbXK.js";var t=e(e=>({activation:0,open:!1,selected:null,controlConversationId:null,displayMode:`docked`,position:null,floatingWidth:288,setFloatingWidth:t=>e({floatingWidth:t}),setDisplayMode:t=>e({displayMode:t}),setPosition:t=>e(e=>e.position?.x===t.x&&e.position?.y===t.y?e:{position:t}),show:(t,n=!0,r)=>e(e=>({activation:e.activation+ +!!n,selected:n||!e.selected?t??e.selected:e.selected,open:n||e.open,controlConversationId:n||!e.open?r??(t===void 0||t===e.selected?e.controlConversationId:null):e.controlConversationId})),hide:()=>e({open:!1})}));export{t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as ee,n as a,o}from"./locale-store-Br7IfbXK.js";import{a as te,i as ne,n as s,o as c,r as l,s as u,t as d}from"./dist-BGTk37IG.js";import{t as f}from"./package-wATCyihJ.js";import{t as re}from"./x-B_N4OPjy.js";import{t as p}from"./skeleton-BI5TyibZ.js";import{a as ie,i as m}from"./vendor-swr-CdRzEUwF.js";import{t as h}from"./button-Cc4hUNTt.js";import{n as ae,t as oe}from"./agent-plugin-dialog-m1A8wF9p.js";import{n as se}from"./capability-links-DzQWK1Fh.js";import{t as ce}from"./capability-icon-DVoZxEgW.js";import{n as g,t as le}from"./plugin-presentation-CO5BFDGW.js";var _=n(),v=e(t(),1),y=r();function b(e){let t=(0,_.c)(61),{pluginId:n,initialConnect:r,onClose:b}=e,S=r!==void 0&&r,C=a(x).startsWith(`zh`),{mutate:w}=ie(),[ue,T]=(0,v.useState)(!1),E=(0,v.useRef)(document.activeElement instanceof HTMLElement?document.activeElement:null),D;t[0]===n?D=t[1]:(D=async()=>{let e=await o(ee(`/api/extensions/agent-plugins/${encodeURIComponent(n)}`));if(!e.ok)throw Error(e.error??`Plugin not found`);return e.payload},t[0]=n,t[1]=D);let O;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(O={revalidateOnFocus:!0},t[2]=O):O=t[2];let{data:k,error:A,mutate:j}=m(`plugin-details:${n}`,D,O),M=k?g(k,C):C?`插件详情`:`Plugin details`,N=k?.localizations?.[C?`zh-CN`:`en`]?.description??k?.description;if(ue&&k){let e;t[3]!==j||t[4]!==T?(e=()=>{T(!1),j()},t[3]=j,t[4]=T,t[5]=e):e=t[5];let n;return t[6]!==k||t[7]!==b||t[8]!==e?(n=(0,y.jsx)(oe,{extension:k,onUninstalled:b,onClose:e}),t[6]=k,t[7]=b,t[8]=e,t[9]=n):n=t[9],n}let P;t[10]===b?P=t[11]:(P=e=>{e||b()},t[10]=b,t[11]=P);let F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,y.jsx)(te,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[12]=F):F=t[12];let I;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>{E.current?.isConnected&&(e.preventDefault(),E.current.focus({preventScroll:!0}))},t[13]=I):I=t[13];let L=k?.branding?.iconUrl,R;t[14]===L?R=t[15]:(R=(0,y.jsx)(ce,{iconUrl:L,fallback:f}),t[14]=L,t[15]=R);let z;t[16]===M?z=t[17]:(z=(0,y.jsx)(u,{className:`truncate text-base font-semibold text-fg`,children:M}),t[16]=M,t[17]=z);let B;t[18]===k?B=t[19]:(B=k?(0,y.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[k.version,` · `,k.name]}):null,t[18]=k,t[19]=B);let V;t[20]!==B||t[21]!==z?(V=(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[z,B]}),t[20]=B,t[21]=z,t[22]=V):V=t[22];let H=C?`关闭插件详情`:`Close plugin details`,U;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,y.jsx)(re,{className:`size-5`,"aria-hidden":!0}),t[23]=U):U=t[23];let W;t[24]===H?W=t[25]:(W=(0,y.jsx)(s,{asChild:!0,children:(0,y.jsx)(h,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":H,children:U})}),t[24]=H,t[25]=W);let G;t[26]!==V||t[27]!==W||t[28]!==R?(G=(0,y.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-edge px-5 py-4`,children:[R,V,W]}),t[26]=V,t[27]=W,t[28]=R,t[29]=G):G=t[29];let K=C?`查看插件能力、管理账号连接与授权。关闭后返回原来的列表。`:`View plugin capabilities and manage account connections. Close to return to the list.`,q;t[30]===K?q=t[31]:(q=(0,y.jsx)(ne,{className:`sr-only`,children:K}),t[30]=K,t[31]=q);let J;t[32]!==k||t[33]!==N||t[34]!==A||t[35]!==S||t[36]!==w||t[37]!==b||t[38]!==n||t[39]!==j||t[40]!==C?(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:A?(0,y.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:String(A)}):k?(0,y.jsxs)(y.Fragment,{children:[N?(0,y.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:N}):null,(0,y.jsx)(ae,{initialConnect:S,extension:k,zh:C,onChanged:async()=>{await j(),await w(`gateway-extensions-list`)}},n),k.components?.skills.length?(0,y.jsxs)(`section`,{className:`space-y-3 border-t border-edge pt-5`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-medium`,children:C?`技能(${k.components.skills.length})`:`Skills (${k.components.skills.length})`}),(0,y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:k.components.skills.map(e=>(0,y.jsx)(i,{onClick:b,to:`/capabilities/skills?${new URLSearchParams({tab:`installed`,source:`plugin`,q:k.dialect===`portable`?e.name:`${n}.${e.name}`})}`,className:`max-w-full break-words rounded-lg border border-edge px-3 py-2 text-sm text-accent hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.name},e.name))})]}):null]}):(0,y.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,y.jsx)(p,{className:`h-14 w-full`}),(0,y.jsx)(p,{className:`h-28 w-full`}),(0,y.jsx)(p,{className:`h-40 w-full`})]})}),t[32]=k,t[33]=N,t[34]=A,t[35]=S,t[36]=w,t[37]=b,t[38]=n,t[39]=j,t[40]=C,t[41]=J):J=t[41];let Y;t[42]!==k||t[43]!==T||t[44]!==C?(Y=k?(0,y.jsx)(h,{variant:`ghost`,onClick:()=>T(!0),children:C?`管理插件`:`Manage plugin`}):(0,y.jsx)(`span`,{}),t[42]=k,t[43]=T,t[44]=C,t[45]=Y):Y=t[45];let X;t[46]!==k||t[47]!==M||t[48]!==C?(X=k&&le(k)?(0,y.jsx)(h,{asChild:!0,children:(0,y.jsx)(i,{to:se(M,C),children:C?`开始使用`:`Start using`})}):(0,y.jsx)(s,{asChild:!0,children:(0,y.jsx)(h,{variant:`secondary`,children:C?`完成`:`Done`})}),t[46]=k,t[47]=M,t[48]=C,t[49]=X):X=t[49];let Z;t[50]!==Y||t[51]!==X?(Z=(0,y.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-edge px-5 py-4`,children:[Y,X]}),t[50]=Y,t[51]=X,t[52]=Z):Z=t[52];let Q;t[53]!==G||t[54]!==q||t[55]!==J||t[56]!==Z?(Q=(0,y.jsxs)(c,{children:[F,(0,y.jsxs)(l,{onCloseAutoFocus:I,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(38rem,calc(100dvh-2rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover`,children:[G,q,J,Z]})]}),t[53]=G,t[54]=q,t[55]=J,t[56]=Z,t[57]=Q):Q=t[57];let $;return t[58]!==Q||t[59]!==P?($=(0,y.jsx)(d,{open:!0,onOpenChange:P,children:Q}),t[58]=Q,t[59]=P,t[60]=$):$=t[60],$}function x(e){return e.language}export{b as PluginDetailsDialog};
@@ -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"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./cn-0WouolD0.js";import{t as s}from"./skeleton-BI5TyibZ.js";import{a as c,i as l,o as u,s as d}from"./dist-CaUuvp8-.js";import{a as f,s as p,t as m}from"./settings-shell-dialog-layer-BU3UuiJr.js";var h=i(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),g=e(t(),1),_=n();function v(e,t=!1){if(!t)return m;switch(e){case`modal`:return f;case`page`:return p;default:return`z-50`}}var y=r(),b=(0,g.createContext)({layer:`default`,portalContainer:null});function x(e,t){return e===`modal`||t===`modal`?`modal`:e===`page`||t===`page`?`page`:`default`}function S(e){let t=(0,_.c)(9),{layer:n,portalContainer:r,children:i}=e,a=(0,g.useContext)(b),o;t[0]!==n||t[1]!==a.layer?(o=x(a.layer,n),t[0]=n,t[1]=a.layer,t[2]=o):o=t[2];let s=o,c=r??a.portalContainer,l;t[3]!==s||t[4]!==c?(l={layer:s,portalContainer:c},t[3]=s,t[4]=c,t[5]=l):l=t[5];let u;return t[6]!==i||t[7]!==l?(u=(0,y.jsx)(b.Provider,{value:l,children:i}),t[6]=i,t[7]=l,t[8]=u):u=t[8],u}function C(){return(0,g.useContext)(b).layer}function w(){return(0,g.useContext)(b).portalContainer}function T(e){let t=(0,_.c)(3),n=w(),r;return t[0]!==n||t[1]!==e?(r=e?.closest(`[role="dialog"]`)??n,t[0]=n,t[1]=e,t[2]=r):r=t[2],r}function E(e){let t=(0,_.c)(14),{options:n,values:r,multiple:i,onChange:a,ariaLabel:s}=e,c=i!==void 0&&i,l=(0,g.useId)(),u;if(t[0]!==c||t[1]!==l||t[2]!==a||t[3]!==n||t[4]!==r){let e;t[6]!==c||t[7]!==l||t[8]!==a||t[9]!==r?(e=e=>(0,y.jsxs)(`label`,{className:o(`touch-target flex min-h-10 min-w-0 items-center gap-3 rounded-md px-2 py-2 text-sm text-fg has-focus-visible:ring-2 has-focus-visible:ring-accent`,e.disabled?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-surface-hover`),children:[(0,y.jsx)(`input`,{type:c?`checkbox`:`radio`,name:l,value:e.value,checked:r.includes(e.value),disabled:e.disabled,className:`shrink-0 accent-accent`,onChange:t=>a(c?t.target.checked?[...r,e.value]:r.filter(t=>t!==e.value):[e.value])}),e.icon,(0,y.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:e.label})]},e.value),t[6]=c,t[7]=l,t[8]=a,t[9]=r,t[10]=e):e=t[10],u=n.map(e),t[0]=c,t[1]=l,t[2]=a,t[3]=n,t[4]=r,t[5]=u}else u=t[5];let d;return t[11]!==s||t[12]!==u?(d=(0,y.jsx)(`fieldset`,{"aria-label":s,className:`min-w-0 space-y-0.5`,children:u}),t[11]=s,t[12]=u,t[13]=d):d=t[13],d}var D=`flex max-h-[min(20rem,var(--radix-popover-content-available-height))] flex-col overflow-hidden`,O=`min-h-0 flex-1 overflow-y-auto overscroll-y-contain touch-pan-y [scrollbar-gutter:stable]`;function k({value:e,options:t,placeholder:n,allowEmpty:r=!0,emptyLabel:i=n,emptyDisabled:f=!1,disabledValues:p,disabled:m,id:_,ariaLabel:b,ariaLabelledBy:x,ariaDescribedBy:S,title:w,triggerClassName:E,triggerIcon:k,contentClassName:A,side:j=`bottom`,align:M=`start`,onChange:N,searchPlaceholder:P,searchValue:F,onSearchChange:I,loading:L=!1,statusMessage:R,selectedLabel:z}){let[B,V]=(0,g.useState)(!1),[H,U]=(0,g.useState)(null),W=C(),G=T(H),K=v(W,G!==null),q=t.find(t=>t.value===e),J=z??q?.label??(e?`${e} · unavailable`:n),Y;return(0,y.jsxs)(u,{open:B,onOpenChange:V,children:[(0,y.jsx)(d,{asChild:!0,children:(0,y.jsxs)(`button`,{ref:U,id:_,type:`button`,"aria-label":b,"aria-labelledby":x,"aria-describedby":S,title:w,disabled:m,className:o(`touch-target box-border flex h-10 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-edge bg-surface-inset px-3 text-left text-sm font-normal text-fg`,`hover:border-edge-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,m&&`cursor-not-allowed opacity-50 hover:border-edge`,E),children:[k,(0,y.jsx)(`span`,{className:o(`min-w-0 truncate`,!e&&`text-fg-subtle`),children:J}),(0,y.jsx)(h,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`})]})}),(0,y.jsx)(c,{container:G??void 0,children:(0,y.jsxs)(l,{side:j,align:M,sideOffset:4,collisionPadding:8,className:o(K,D,`w-[var(--radix-popover-trigger-width)] min-w-[16rem] rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover outline-none`,A),children:[P?(0,y.jsx)(`input`,{type:`search`,"aria-label":P,placeholder:P,value:F,onChange:e=>I?.(e.target.value),className:`mb-1 w-full shrink-0 rounded-md bg-surface-base px-3 py-2 text-base text-fg placeholder:text-fg-subtle sm:text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}):null,(0,y.jsxs)(`div`,{"data-select-scroll-region":!0,className:o(O,`max-h-64`),children:[r?(0,y.jsxs)(`button`,{type:`button`,disabled:f,className:o(`touch-target flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,e===``&&`bg-surface-active font-medium`,f&&`cursor-not-allowed opacity-45 hover:bg-transparent`),onClick:()=>{f||(N(``),V(!1))},children:[(0,y.jsx)(a,{className:o(`size-4 shrink-0`,e!==``&&`invisible`),"aria-hidden":`true`}),(0,y.jsx)(`span`,{className:`min-w-0 truncate text-fg-subtle`,children:i})]}):null,L?(0,y.jsx)(`div`,{className:`space-y-2 p-2`,"aria-busy":`true`,children:[0,1,2].map(e=>(0,y.jsx)(s,{className:`h-8 w-full`},e))}):null,R&&!L?(0,y.jsx)(`p`,{role:`status`,className:`px-3 py-2 text-xs text-fg-muted`,children:R}):null,(L?[]:t).map(t=>{let n=t.disabled===!0||p?.has(t.value)===!0&&t.value!==e,r=t.group&&t.group!==Y;return Y=t.group,(0,y.jsxs)(g.Fragment,{children:[r?(0,y.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.group}):null,(0,y.jsxs)(`button`,{type:`button`,disabled:n,className:o(`touch-target flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,t.value===e&&`bg-surface-active font-medium`,n&&`cursor-not-allowed opacity-45 hover:bg-transparent`),onClick:()=>{n||(N(t.value),V(!1))},children:[t.icon??(0,y.jsx)(a,{className:o(`size-4 shrink-0`,t.value!==e&&`invisible`),"aria-hidden":`true`}),(0,y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.label}),t.icon?(0,y.jsx)(a,{className:o(`ml-auto size-4 shrink-0`,t.value!==e&&`invisible`),"aria-hidden":!0}):null]})]},`${t.group??``}:${t.value}`)})]})]})})]})}function A(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(A).join(``):(0,g.isValidElement)(e)?A(e.props.children):``}function j(e,t){let n=[];return g.Children.forEach(e,e=>{if(!(0,g.isValidElement)(e))return;if(e.type===g.Fragment){n.push(...j(e.props.children,t));return}if(e.type===N){let t=e.props;n.push(...j(t.children,A(t.label)));return}if(e.type!==M)return;let r=e.props,i=A(r.children).trim(),a=r.value==null?i:String(r.value);n.push({value:a,label:i,disabled:r.disabled,group:t})}),n}function M(e){return null}function N(e){return null}function P(e){if(!e)return;let t=e.split(/\s+/).filter(Boolean).filter(e=>{let t=e.includes(`:`)?e.slice(e.lastIndexOf(`:`)+1):e;return t===`block`||t===`inline-block`||t===`inline-flex`||t===`flex`||t===`flex-1`||t===`flex-auto`||t===`flex-initial`||t===`flex-none`||t===`grow`||t===`shrink`||t===`min-w-0`||t===`min-h-0`||t.startsWith(`w-`)||t.startsWith(`min-w-`)||t.startsWith(`max-w-`)||t.startsWith(`basis-`)||t.startsWith(`grow-`)||t.startsWith(`shrink-`)||t.startsWith(`self-`)||t.startsWith(`order-`)||t.startsWith(`col-`)||t.startsWith(`row-`)});return t.length===0?void 0:t.join(` `)}function F(e){let t=(0,_.c)(67),n,r,i,a,s,c,l,u,d,f,p,m;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12]):({align:n,children:r,className:i,contentClassName:a,disabled:s,id:c,onChange:l,placeholder:u,side:f,triggerClassName:p,value:m,...d}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m);let h=(0,g.useId)(),v=m==null?``:String(m),b,x,S,C,w,T,E,D,O,A;if(t[13]!==r||t[14]!==i||t[15]!==s||t[16]!==h||t[17]!==c||t[18]!==u||t[19]!==d.name||t[20]!==v){let e=j(r);C=e.find(L),x=C!==void 0,S=C?.label||u||``,D=s||void 0,t[31]===i?O=t[32]:(O=P(i),t[31]=i,t[32]=O),A=d.name,b=k,w=c??h,T=v,E=e.filter(I),t[13]=r,t[14]=i,t[15]=s,t[16]=h,t[17]=c,t[18]=u,t[19]=d.name,t[20]=v,t[21]=b,t[22]=x,t[23]=S,t[24]=C,t[25]=w,t[26]=T,t[27]=E,t[28]=D,t[29]=O,t[30]=A}else b=t[21],x=t[22],S=t[23],C=t[24],w=t[25],T=t[26],E=t[27],D=t[28],O=t[29],A=t[30];let M=u??S,N=C?.disabled===!0,F=d[`aria-label`],R=d[`aria-labelledby`],z=d[`aria-describedby`],B=d.title,V;t[33]!==i||t[34]!==p?(V=o(i,p),t[33]=i,t[34]=p,t[35]=V):V=t[35];let H;t[36]===l?H=t[37]:(H=e=>l?.({target:{value:e},currentTarget:{value:e}}),t[36]=l,t[37]=H);let U;t[38]!==b||t[39]!==n||t[40]!==x||t[41]!==a||t[42]!==s||t[43]!==S||t[44]!==d.title||t[45]!==f||t[46]!==w||t[47]!==R||t[48]!==z||t[49]!==V||t[50]!==H||t[51]!==T||t[52]!==E||t[53]!==M||t[54]!==N||t[55]!==F?(U=(0,y.jsx)(b,{id:w,value:T,options:E,placeholder:M,allowEmpty:x,emptyLabel:S,emptyDisabled:N,disabled:s,ariaLabel:F,ariaLabelledBy:R,ariaDescribedBy:z,title:B,side:f,align:n,triggerClassName:V,contentClassName:a,onChange:H}),t[38]=b,t[39]=n,t[40]=x,t[41]=a,t[42]=s,t[43]=S,t[44]=d.title,t[45]=f,t[46]=w,t[47]=R,t[48]=z,t[49]=V,t[50]=H,t[51]=T,t[52]=E,t[53]=M,t[54]=N,t[55]=F,t[56]=U):U=t[56];let W;t[57]!==s||t[58]!==d.name||t[59]!==v?(W=(0,y.jsx)(`input`,{name:d.name,value:v,readOnly:!0,hidden:!0,disabled:s}),t[57]=s,t[58]=d.name,t[59]=v,t[60]=W):W=t[60];let G;return t[61]!==U||t[62]!==W||t[63]!==D||t[64]!==O||t[65]!==A?(G=(0,y.jsxs)(`div`,{"aria-disabled":D,className:O,"data-select-name":A,children:[U,W]}),t[61]=U,t[62]=W,t[63]=D,t[64]=O,t[65]=A,t[66]=G):G=t[66],G}function I(e){return e.value!==``}function L(e){return e.value===``}export{D as a,T as c,h as d,E as i,C as l,F as n,O as o,M as r,S as s,k as t,v as u};
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"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./cn-0WouolD0.js";import{t as s}from"./skeleton-BI5TyibZ.js";import{a as c,i as l,o as u,s as d}from"./dist-GJ8-1PAx.js";import{a as f,s as p,t as m}from"./settings-shell-dialog-layer-BU3UuiJr.js";var h=i(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),g=e(t(),1),_=n();function v(e,t=!1){if(!t)return m;switch(e){case`modal`:return f;case`page`:return p;default:return`z-50`}}var y=r(),b=(0,g.createContext)({layer:`default`,portalContainer:null});function x(e,t){return e===`modal`||t===`modal`?`modal`:e===`page`||t===`page`?`page`:`default`}function S(e){let t=(0,_.c)(9),{layer:n,portalContainer:r,children:i}=e,a=(0,g.useContext)(b),o;t[0]!==n||t[1]!==a.layer?(o=x(a.layer,n),t[0]=n,t[1]=a.layer,t[2]=o):o=t[2];let s=o,c=r??a.portalContainer,l;t[3]!==s||t[4]!==c?(l={layer:s,portalContainer:c},t[3]=s,t[4]=c,t[5]=l):l=t[5];let u;return t[6]!==i||t[7]!==l?(u=(0,y.jsx)(b.Provider,{value:l,children:i}),t[6]=i,t[7]=l,t[8]=u):u=t[8],u}function C(){return(0,g.useContext)(b).layer}function w(){return(0,g.useContext)(b).portalContainer}function T(e){let t=(0,_.c)(3),n=w(),r;return t[0]!==n||t[1]!==e?(r=e?.closest(`[role="dialog"]`)??n,t[0]=n,t[1]=e,t[2]=r):r=t[2],r}function E(e){let t=(0,_.c)(14),{options:n,values:r,multiple:i,onChange:a,ariaLabel:s}=e,c=i!==void 0&&i,l=(0,g.useId)(),u;if(t[0]!==c||t[1]!==l||t[2]!==a||t[3]!==n||t[4]!==r){let e;t[6]!==c||t[7]!==l||t[8]!==a||t[9]!==r?(e=e=>(0,y.jsxs)(`label`,{className:o(`touch-target flex min-h-10 min-w-0 items-center gap-3 rounded-md px-2 py-2 text-sm text-fg has-focus-visible:ring-2 has-focus-visible:ring-accent`,e.disabled?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-surface-hover`),children:[(0,y.jsx)(`input`,{type:c?`checkbox`:`radio`,name:l,value:e.value,checked:r.includes(e.value),disabled:e.disabled,className:`shrink-0 accent-accent`,onChange:t=>a(c?t.target.checked?[...r,e.value]:r.filter(t=>t!==e.value):[e.value])}),e.icon,(0,y.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:e.label})]},e.value),t[6]=c,t[7]=l,t[8]=a,t[9]=r,t[10]=e):e=t[10],u=n.map(e),t[0]=c,t[1]=l,t[2]=a,t[3]=n,t[4]=r,t[5]=u}else u=t[5];let d;return t[11]!==s||t[12]!==u?(d=(0,y.jsx)(`fieldset`,{"aria-label":s,className:`min-w-0 space-y-0.5`,children:u}),t[11]=s,t[12]=u,t[13]=d):d=t[13],d}var D=`flex max-h-[min(20rem,var(--radix-popover-content-available-height))] flex-col overflow-hidden`,O=`min-h-0 flex-1 overflow-y-auto overscroll-y-contain touch-pan-y [scrollbar-gutter:stable]`;function k({value:e,options:t,placeholder:n,allowEmpty:r=!0,emptyLabel:i=n,emptyDisabled:f=!1,disabledValues:p,disabled:m,id:_,ariaLabel:b,ariaLabelledBy:x,ariaDescribedBy:S,title:w,triggerClassName:E,triggerIcon:k,contentClassName:A,side:j=`bottom`,align:M=`start`,onChange:N,searchPlaceholder:P,searchValue:F,onSearchChange:I,loading:L=!1,statusMessage:R,selectedLabel:z}){let[B,V]=(0,g.useState)(!1),[H,U]=(0,g.useState)(null),W=C(),G=T(H),K=v(W,G!==null),q=t.find(t=>t.value===e),J=z??q?.label??(e?`${e} · unavailable`:n),Y;return(0,y.jsxs)(u,{open:B,onOpenChange:V,children:[(0,y.jsx)(d,{asChild:!0,children:(0,y.jsxs)(`button`,{ref:U,id:_,type:`button`,"aria-label":b,"aria-labelledby":x,"aria-describedby":S,title:w,disabled:m,className:o(`touch-target box-border flex h-10 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-edge bg-surface-inset px-3 text-left text-sm font-normal text-fg`,`hover:border-edge-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,m&&`cursor-not-allowed opacity-50 hover:border-edge`,E),children:[k,(0,y.jsx)(`span`,{className:o(`min-w-0 truncate`,!e&&`text-fg-subtle`),children:J}),(0,y.jsx)(h,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`})]})}),(0,y.jsx)(c,{container:G??void 0,children:(0,y.jsxs)(l,{side:j,align:M,sideOffset:4,collisionPadding:8,className:o(K,D,`w-[var(--radix-popover-trigger-width)] min-w-[16rem] rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover outline-none`,A),children:[P?(0,y.jsx)(`input`,{type:`search`,"aria-label":P,placeholder:P,value:F,onChange:e=>I?.(e.target.value),className:`mb-1 w-full shrink-0 rounded-md bg-surface-base px-3 py-2 text-base text-fg placeholder:text-fg-subtle sm:text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}):null,(0,y.jsxs)(`div`,{"data-select-scroll-region":!0,className:o(O,`max-h-64`),children:[r?(0,y.jsxs)(`button`,{type:`button`,disabled:f,className:o(`touch-target flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,e===``&&`bg-surface-active font-medium`,f&&`cursor-not-allowed opacity-45 hover:bg-transparent`),onClick:()=>{f||(N(``),V(!1))},children:[(0,y.jsx)(a,{className:o(`size-4 shrink-0`,e!==``&&`invisible`),"aria-hidden":`true`}),(0,y.jsx)(`span`,{className:`min-w-0 truncate text-fg-subtle`,children:i})]}):null,L?(0,y.jsx)(`div`,{className:`space-y-2 p-2`,"aria-busy":`true`,children:[0,1,2].map(e=>(0,y.jsx)(s,{className:`h-8 w-full`},e))}):null,R&&!L?(0,y.jsx)(`p`,{role:`status`,className:`px-3 py-2 text-xs text-fg-muted`,children:R}):null,(L?[]:t).map(t=>{let n=t.disabled===!0||p?.has(t.value)===!0&&t.value!==e,r=t.group&&t.group!==Y;return Y=t.group,(0,y.jsxs)(g.Fragment,{children:[r?(0,y.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.group}):null,(0,y.jsxs)(`button`,{type:`button`,disabled:n,className:o(`touch-target flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,t.value===e&&`bg-surface-active font-medium`,n&&`cursor-not-allowed opacity-45 hover:bg-transparent`),onClick:()=>{n||(N(t.value),V(!1))},children:[t.icon??(0,y.jsx)(a,{className:o(`size-4 shrink-0`,t.value!==e&&`invisible`),"aria-hidden":`true`}),(0,y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.label}),t.icon?(0,y.jsx)(a,{className:o(`ml-auto size-4 shrink-0`,t.value!==e&&`invisible`),"aria-hidden":!0}):null]})]},`${t.group??``}:${t.value}`)})]})]})})]})}function A(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(A).join(``):(0,g.isValidElement)(e)?A(e.props.children):``}function j(e,t){let n=[];return g.Children.forEach(e,e=>{if(!(0,g.isValidElement)(e))return;if(e.type===g.Fragment){n.push(...j(e.props.children,t));return}if(e.type===N){let t=e.props;n.push(...j(t.children,A(t.label)));return}if(e.type!==M)return;let r=e.props,i=A(r.children).trim(),a=r.value==null?i:String(r.value);n.push({value:a,label:i,disabled:r.disabled,group:t})}),n}function M(e){return null}function N(e){return null}function P(e){if(!e)return;let t=e.split(/\s+/).filter(Boolean).filter(e=>{let t=e.includes(`:`)?e.slice(e.lastIndexOf(`:`)+1):e;return t===`block`||t===`inline-block`||t===`inline-flex`||t===`flex`||t===`flex-1`||t===`flex-auto`||t===`flex-initial`||t===`flex-none`||t===`grow`||t===`shrink`||t===`min-w-0`||t===`min-h-0`||t.startsWith(`w-`)||t.startsWith(`min-w-`)||t.startsWith(`max-w-`)||t.startsWith(`basis-`)||t.startsWith(`grow-`)||t.startsWith(`shrink-`)||t.startsWith(`self-`)||t.startsWith(`order-`)||t.startsWith(`col-`)||t.startsWith(`row-`)});return t.length===0?void 0:t.join(` `)}function F(e){let t=(0,_.c)(67),n,r,i,a,s,c,l,u,d,f,p,m;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12]):({align:n,children:r,className:i,contentClassName:a,disabled:s,id:c,onChange:l,placeholder:u,side:f,triggerClassName:p,value:m,...d}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m);let h=(0,g.useId)(),v=m==null?``:String(m),b,x,S,C,w,T,E,D,O,A;if(t[13]!==r||t[14]!==i||t[15]!==s||t[16]!==h||t[17]!==c||t[18]!==u||t[19]!==d.name||t[20]!==v){let e=j(r);C=e.find(L),x=C!==void 0,S=C?.label||u||``,D=s||void 0,t[31]===i?O=t[32]:(O=P(i),t[31]=i,t[32]=O),A=d.name,b=k,w=c??h,T=v,E=e.filter(I),t[13]=r,t[14]=i,t[15]=s,t[16]=h,t[17]=c,t[18]=u,t[19]=d.name,t[20]=v,t[21]=b,t[22]=x,t[23]=S,t[24]=C,t[25]=w,t[26]=T,t[27]=E,t[28]=D,t[29]=O,t[30]=A}else b=t[21],x=t[22],S=t[23],C=t[24],w=t[25],T=t[26],E=t[27],D=t[28],O=t[29],A=t[30];let M=u??S,N=C?.disabled===!0,F=d[`aria-label`],R=d[`aria-labelledby`],z=d[`aria-describedby`],B=d.title,V;t[33]!==i||t[34]!==p?(V=o(i,p),t[33]=i,t[34]=p,t[35]=V):V=t[35];let H;t[36]===l?H=t[37]:(H=e=>l?.({target:{value:e},currentTarget:{value:e}}),t[36]=l,t[37]=H);let U;t[38]!==b||t[39]!==n||t[40]!==x||t[41]!==a||t[42]!==s||t[43]!==S||t[44]!==d.title||t[45]!==f||t[46]!==w||t[47]!==R||t[48]!==z||t[49]!==V||t[50]!==H||t[51]!==T||t[52]!==E||t[53]!==M||t[54]!==N||t[55]!==F?(U=(0,y.jsx)(b,{id:w,value:T,options:E,placeholder:M,allowEmpty:x,emptyLabel:S,emptyDisabled:N,disabled:s,ariaLabel:F,ariaLabelledBy:R,ariaDescribedBy:z,title:B,side:f,align:n,triggerClassName:V,contentClassName:a,onChange:H}),t[38]=b,t[39]=n,t[40]=x,t[41]=a,t[42]=s,t[43]=S,t[44]=d.title,t[45]=f,t[46]=w,t[47]=R,t[48]=z,t[49]=V,t[50]=H,t[51]=T,t[52]=E,t[53]=M,t[54]=N,t[55]=F,t[56]=U):U=t[56];let W;t[57]!==s||t[58]!==d.name||t[59]!==v?(W=(0,y.jsx)(`input`,{name:d.name,value:v,readOnly:!0,hidden:!0,disabled:s}),t[57]=s,t[58]=d.name,t[59]=v,t[60]=W):W=t[60];let G;return t[61]!==U||t[62]!==W||t[63]!==D||t[64]!==O||t[65]!==A?(G=(0,y.jsxs)(`div`,{"aria-disabled":D,className:O,"data-select-name":A,children:[U,W]}),t[61]=U,t[62]=W,t[63]=D,t[64]=O,t[65]=A,t[66]=G):G=t[66],G}function I(e){return e.value!==``}function L(e){return e.value===``}export{D as a,T as c,h as d,E as i,C as l,F as n,O as o,M as r,S as s,k as t,v as u};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{n,p as r}from"./locale-store-Bg_XR36n.js";import{t as i}from"./messages-DG4HLOER.js";import{n as a,r as o}from"./popover-select-DD8fmrxH.js";import{t as s}from"./cn-0WouolD0.js";import{t as c}from"./middleware-Pd0e8Igk.js";import{o as l}from"./form-field-width-DJw_jULe.js";import{i as u}from"./theme-store-gAcojLgP.js";var d=e(),f=[`compact`,`default`,`large`];function p(e){document.documentElement.dataset.fontScale=e}function m(){try{let e=localStorage.getItem(`xopc-web-font-scale`),t=`default`;if(e){let n=JSON.parse(e).state?.preference;n&&f.includes(n)&&(t=n)}p(t)}catch{p(`default`)}}var h=r(c(e=>({preference:`default`,setPreference:t=>{p(t),e({preference:t})}}),{name:`xopc-web-font-scale`}));function g(){p(h.getState().preference)}var _=t(),v=[`language`,`theme`,`font`];function y(e){let t=(0,d.c)(59),{variant:r,sections:c}=e,f=c===void 0?v:c,p=n(T),m=n(w),g=u(C),y=u(S),E=h(x),D=h(b),O;t[0]===p?O=t[1]:(O=i(p),t[0]=p,t[1]=O);let k=O.appearanceSettings,A=r===`page`?`w-full max-w-[min(100%,12rem)] shrink-0 sm:ml-auto sm:w-auto sm:max-w-[11rem]`:r===`toolbar`?`w-auto min-w-[6.5rem] max-w-[10rem] shrink-0 sm:min-w-[7.5rem]`:`w-full`,j;t[2]===A?j=t[3]:(j=s(l,A),t[2]=A,t[3]=j);let M=j,N=r===`page`?`flex flex-col gap-2 border-b border-edge-subtle px-4 py-3.5 last:border-b-0 sm:flex-row sm:items-center sm:justify-between sm:gap-6 sm:px-5 sm:py-4`:`flex flex-col gap-1.5`,P;t[4]===f?P=t[5]:(P=e=>f.includes(e),t[4]=f,t[5]=P);let F=P;if(r===`toolbar`){let e;t[6]!==k||t[7]!==p||t[8]!==M||t[9]!==m||t[10]!==F?(e=F(`language`)?(0,_.jsxs)(a,{className:M,value:p,"aria-label":k.languageTitle,onChange:e=>m(e.target.value),children:[(0,_.jsx)(o,{value:`en`,children:k.langOptionEn}),(0,_.jsx)(o,{value:`zh`,children:k.langOptionZh})]}):null,t[6]=k,t[7]=p,t[8]=M,t[9]=m,t[10]=F,t[11]=e):e=t[11];let n;t[12]!==k||t[13]!==M||t[14]!==y||t[15]!==F||t[16]!==g?(n=F(`theme`)?(0,_.jsxs)(a,{className:M,value:g,"aria-label":k.themeTitle,onChange:e=>y(e.target.value),children:[(0,_.jsx)(o,{value:`light`,children:k.themeOptionLight}),(0,_.jsx)(o,{value:`dark`,children:k.themeOptionDark}),(0,_.jsx)(o,{value:`system`,children:k.themeOptionSystem})]}):null,t[12]=k,t[13]=M,t[14]=y,t[15]=F,t[16]=g,t[17]=n):n=t[17];let r;t[18]!==k||t[19]!==E||t[20]!==M||t[21]!==D||t[22]!==F?(r=F(`font`)?(0,_.jsxs)(a,{className:M,value:E,"aria-label":k.fontScaleTitle,onChange:e=>D(e.target.value),children:[(0,_.jsx)(o,{value:`compact`,children:k.fontScaleCompact}),(0,_.jsx)(o,{value:`default`,children:k.fontScaleDefault}),(0,_.jsx)(o,{value:`large`,children:k.fontScaleLarge})]}):null,t[18]=k,t[19]=E,t[20]=M,t[21]=D,t[22]=F,t[23]=r):r=t[23];let i;return t[24]!==e||t[25]!==n||t[26]!==r?(i=(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[e,n,r]}),t[24]=e,t[25]=n,t[26]=r,t[27]=i):i=t[27],i}let I=r===`sidebar`&&`flex flex-col gap-4`,L;t[28]===I?L=t[29]:(L=s(I),t[28]=I,t[29]=L);let R;t[30]!==k||t[31]!==p||t[32]!==N||t[33]!==M||t[34]!==m||t[35]!==F||t[36]!==r?(R=F(`language`)?(0,_.jsxs)(`div`,{className:N,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:k.languageTitle}),r===`page`?null:(0,_.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:k.languageDescription})]}),(0,_.jsxs)(a,{className:M,value:p,"aria-label":k.languageTitle,onChange:e=>m(e.target.value),children:[(0,_.jsx)(o,{value:`en`,children:k.langOptionEn}),(0,_.jsx)(o,{value:`zh`,children:k.langOptionZh})]})]}):null,t[30]=k,t[31]=p,t[32]=N,t[33]=M,t[34]=m,t[35]=F,t[36]=r,t[37]=R):R=t[37];let z;t[38]!==k||t[39]!==N||t[40]!==M||t[41]!==y||t[42]!==F||t[43]!==g||t[44]!==r?(z=F(`theme`)?(0,_.jsxs)(`div`,{className:N,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:k.themeTitle}),r===`page`?null:(0,_.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:k.themeDescription})]}),(0,_.jsxs)(a,{className:M,value:g,"aria-label":k.themeTitle,onChange:e=>y(e.target.value),children:[(0,_.jsx)(o,{value:`light`,children:k.themeOptionLight}),(0,_.jsx)(o,{value:`dark`,children:k.themeOptionDark}),(0,_.jsx)(o,{value:`system`,children:k.themeOptionSystem})]})]}):null,t[38]=k,t[39]=N,t[40]=M,t[41]=y,t[42]=F,t[43]=g,t[44]=r,t[45]=z):z=t[45];let B;t[46]!==k||t[47]!==E||t[48]!==N||t[49]!==M||t[50]!==D||t[51]!==F||t[52]!==r?(B=F(`font`)?(0,_.jsxs)(`div`,{className:N,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:k.fontScaleTitle}),r===`page`?null:(0,_.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:k.fontScaleDescription})]}),(0,_.jsxs)(a,{className:M,value:E,"aria-label":k.fontScaleTitle,onChange:e=>D(e.target.value),children:[(0,_.jsx)(o,{value:`compact`,children:k.fontScaleCompact}),(0,_.jsx)(o,{value:`default`,children:k.fontScaleDefault}),(0,_.jsx)(o,{value:`large`,children:k.fontScaleLarge})]})]}):null,t[46]=k,t[47]=E,t[48]=N,t[49]=M,t[50]=D,t[51]=F,t[52]=r,t[53]=B):B=t[53];let V;return t[54]!==B||t[55]!==L||t[56]!==R||t[57]!==z?(V=(0,_.jsxs)(`div`,{className:L,children:[R,z,B]}),t[54]=B,t[55]=L,t[56]=R,t[57]=z,t[58]=V):V=t[58],V}function b(e){return e.setPreference}function x(e){return e.preference}function S(e){return e.setPreference}function C(e){return e.preference}function w(e){return e.setLanguage}function T(e){return e.language}export{h as i,m as n,g as r,y as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{n,p as r}from"./locale-store-Br7IfbXK.js";import{t as i}from"./messages-ByFlEbsu.js";import{n as a,r as o}from"./popover-select-CEMWIrtY.js";import{t as s}from"./cn-0WouolD0.js";import{t as c}from"./middleware-Pd0e8Igk.js";import{o as l}from"./form-field-width-DJw_jULe.js";import{i as u}from"./theme-store-Dlnmgryi.js";var d=e(),f=[`compact`,`default`,`large`];function p(e){document.documentElement.dataset.fontScale=e}function m(){try{let e=localStorage.getItem(`xopc-web-font-scale`),t=`default`;if(e){let n=JSON.parse(e).state?.preference;n&&f.includes(n)&&(t=n)}p(t)}catch{p(`default`)}}var h=r(c(e=>({preference:`default`,setPreference:t=>{p(t),e({preference:t})}}),{name:`xopc-web-font-scale`}));function g(){p(h.getState().preference)}var _=t(),v=[`language`,`theme`,`font`];function y(e){let t=(0,d.c)(59),{variant:r,sections:c}=e,f=c===void 0?v:c,p=n(T),m=n(w),g=u(C),y=u(S),E=h(x),D=h(b),O;t[0]===p?O=t[1]:(O=i(p),t[0]=p,t[1]=O);let k=O.appearanceSettings,A=r===`page`?`w-full max-w-[min(100%,12rem)] shrink-0 sm:ml-auto sm:w-auto sm:max-w-[11rem]`:r===`toolbar`?`w-auto min-w-[6.5rem] max-w-[10rem] shrink-0 sm:min-w-[7.5rem]`:`w-full`,j;t[2]===A?j=t[3]:(j=s(l,A),t[2]=A,t[3]=j);let M=j,N=r===`page`?`flex flex-col gap-2 border-b border-edge-subtle px-4 py-3.5 last:border-b-0 sm:flex-row sm:items-center sm:justify-between sm:gap-6 sm:px-5 sm:py-4`:`flex flex-col gap-1.5`,P;t[4]===f?P=t[5]:(P=e=>f.includes(e),t[4]=f,t[5]=P);let F=P;if(r===`toolbar`){let e;t[6]!==k||t[7]!==p||t[8]!==M||t[9]!==m||t[10]!==F?(e=F(`language`)?(0,_.jsxs)(a,{className:M,value:p,"aria-label":k.languageTitle,onChange:e=>m(e.target.value),children:[(0,_.jsx)(o,{value:`en`,children:k.langOptionEn}),(0,_.jsx)(o,{value:`zh`,children:k.langOptionZh})]}):null,t[6]=k,t[7]=p,t[8]=M,t[9]=m,t[10]=F,t[11]=e):e=t[11];let n;t[12]!==k||t[13]!==M||t[14]!==y||t[15]!==F||t[16]!==g?(n=F(`theme`)?(0,_.jsxs)(a,{className:M,value:g,"aria-label":k.themeTitle,onChange:e=>y(e.target.value),children:[(0,_.jsx)(o,{value:`light`,children:k.themeOptionLight}),(0,_.jsx)(o,{value:`dark`,children:k.themeOptionDark}),(0,_.jsx)(o,{value:`system`,children:k.themeOptionSystem})]}):null,t[12]=k,t[13]=M,t[14]=y,t[15]=F,t[16]=g,t[17]=n):n=t[17];let r;t[18]!==k||t[19]!==E||t[20]!==M||t[21]!==D||t[22]!==F?(r=F(`font`)?(0,_.jsxs)(a,{className:M,value:E,"aria-label":k.fontScaleTitle,onChange:e=>D(e.target.value),children:[(0,_.jsx)(o,{value:`compact`,children:k.fontScaleCompact}),(0,_.jsx)(o,{value:`default`,children:k.fontScaleDefault}),(0,_.jsx)(o,{value:`large`,children:k.fontScaleLarge})]}):null,t[18]=k,t[19]=E,t[20]=M,t[21]=D,t[22]=F,t[23]=r):r=t[23];let i;return t[24]!==e||t[25]!==n||t[26]!==r?(i=(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[e,n,r]}),t[24]=e,t[25]=n,t[26]=r,t[27]=i):i=t[27],i}let I=r===`sidebar`&&`flex flex-col gap-4`,L;t[28]===I?L=t[29]:(L=s(I),t[28]=I,t[29]=L);let R;t[30]!==k||t[31]!==p||t[32]!==N||t[33]!==M||t[34]!==m||t[35]!==F||t[36]!==r?(R=F(`language`)?(0,_.jsxs)(`div`,{className:N,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:k.languageTitle}),r===`page`?null:(0,_.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:k.languageDescription})]}),(0,_.jsxs)(a,{className:M,value:p,"aria-label":k.languageTitle,onChange:e=>m(e.target.value),children:[(0,_.jsx)(o,{value:`en`,children:k.langOptionEn}),(0,_.jsx)(o,{value:`zh`,children:k.langOptionZh})]})]}):null,t[30]=k,t[31]=p,t[32]=N,t[33]=M,t[34]=m,t[35]=F,t[36]=r,t[37]=R):R=t[37];let z;t[38]!==k||t[39]!==N||t[40]!==M||t[41]!==y||t[42]!==F||t[43]!==g||t[44]!==r?(z=F(`theme`)?(0,_.jsxs)(`div`,{className:N,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:k.themeTitle}),r===`page`?null:(0,_.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:k.themeDescription})]}),(0,_.jsxs)(a,{className:M,value:g,"aria-label":k.themeTitle,onChange:e=>y(e.target.value),children:[(0,_.jsx)(o,{value:`light`,children:k.themeOptionLight}),(0,_.jsx)(o,{value:`dark`,children:k.themeOptionDark}),(0,_.jsx)(o,{value:`system`,children:k.themeOptionSystem})]})]}):null,t[38]=k,t[39]=N,t[40]=M,t[41]=y,t[42]=F,t[43]=g,t[44]=r,t[45]=z):z=t[45];let B;t[46]!==k||t[47]!==E||t[48]!==N||t[49]!==M||t[50]!==D||t[51]!==F||t[52]!==r?(B=F(`font`)?(0,_.jsxs)(`div`,{className:N,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:k.fontScaleTitle}),r===`page`?null:(0,_.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:k.fontScaleDescription})]}),(0,_.jsxs)(a,{className:M,value:E,"aria-label":k.fontScaleTitle,onChange:e=>D(e.target.value),children:[(0,_.jsx)(o,{value:`compact`,children:k.fontScaleCompact}),(0,_.jsx)(o,{value:`default`,children:k.fontScaleDefault}),(0,_.jsx)(o,{value:`large`,children:k.fontScaleLarge})]})]}):null,t[46]=k,t[47]=E,t[48]=N,t[49]=M,t[50]=D,t[51]=F,t[52]=r,t[53]=B):B=t[53];let V;return t[54]!==B||t[55]!==L||t[56]!==R||t[57]!==z?(V=(0,_.jsxs)(`div`,{className:L,children:[R,z,B]}),t[54]=B,t[55]=L,t[56]=R,t[57]=z,t[58]=V):V=t[58],V}function b(e){return e.setPreference}function x(e){return e.preference}function S(e){return e.setPreference}function C(e){return e.preference}function w(e){return e.setLanguage}function T(e){return e.language}export{h as i,m as n,g as r,y as t};