@xopcai/xopc 0.0.486 → 0.0.488

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 (426) hide show
  1. package/README.md +9 -3
  2. package/README.zh-CN.md +9 -3
  3. package/dist/browser-ext/_locales/en/messages.json +1 -1
  4. package/dist/browser-ext/_locales/zh_CN/messages.json +1 -1
  5. package/dist/browser-ext/dist/assets/{auth-8EjgHa-n.js → page-context-DCkQH5LX.js} +237 -172
  6. package/dist/browser-ext/dist/background.js +650 -108
  7. package/dist/browser-ext/dist/sidepanel.html +1 -1
  8. package/dist/browser-ext/dist/sidepanel.js +22 -4
  9. package/dist/browser-ext/manifest.json +2 -1
  10. package/dist/extensions/telegram/src/update-offset-store.js +2 -1
  11. package/dist/extensions/telegram/xopc.extension.json +1 -1
  12. package/dist/extensions/weixin/src/messaging/quote-cache.js +3 -1
  13. package/dist/extensions/weixin/src/storage/sync-buf.js +2 -1
  14. package/dist/gateway/server/chunks.bin +1733 -1553
  15. package/dist/gateway/server/chunks.json +1 -1
  16. package/dist/gateway/server/dependency-records.json +42 -0
  17. package/dist/gateway/static/root/assets/{activity-store-hSe5Nbgk.js → activity-store-DyHjQrpP.js} +1 -1
  18. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BY2wRiwY.js → agent-avatar-dicebear-gADhOk89.js} +1 -1
  19. package/dist/gateway/static/root/assets/{agent-avatar-display-D_UDgOr9.js → agent-avatar-display-Dyyk4GdM.js} +2 -2
  20. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BrcyLG9M.js → agent-defaults-settings-panel-DD5mU7h6.js} +1 -1
  21. package/dist/gateway/static/root/assets/{agent-plugin-dialog-CSJC1yud.js → agent-plugin-dialog-RZpnW9HG.js} +1 -1
  22. package/dist/gateway/static/root/assets/{agents-DX-t3X7K.js → agents-Ckt9wMj7.js} +3 -3
  23. package/dist/gateway/static/root/assets/{agents-admin-api-DSr-PWuW.js → agents-admin-api-BW3Mzst8.js} +1 -1
  24. package/dist/gateway/static/root/assets/{api-CGrHK9ij.js → api-Cd5TqEwc.js} +1 -1
  25. package/dist/gateway/static/root/assets/{api-B3T06TLl.js → api-DVQaJzrB.js} +1 -1
  26. package/dist/gateway/static/root/assets/{app-management-settings-panel-D6ZoYKaA.js → app-management-settings-panel-Cim6ZmGT.js} +1 -1
  27. package/dist/gateway/static/root/assets/{appearance-settings-BRb6kZT8.js → appearance-settings-BVMDvmUO.js} +1 -1
  28. package/dist/gateway/static/root/assets/{apps-page-6xeWvMpF.js → apps-page-B7T55D7Y.js} +1 -1
  29. package/dist/gateway/static/root/assets/{archive-plugin-CQ5UXgZk.js → archive-plugin-DVoAuR_a.js} +1 -1
  30. package/dist/gateway/static/root/assets/{automation-api-D-gn6x5E.js → automation-api-B6YcuEsE.js} +1 -1
  31. package/dist/gateway/static/root/assets/{automation-result-state-B7hq0XOL.js → automation-result-state-BycWqFXM.js} +1 -1
  32. package/dist/gateway/static/root/assets/{automation-run-list-CM59-qm5.js → automation-run-list-DDDHtKq0.js} +1 -1
  33. package/dist/gateway/static/root/assets/{automation-task-card-C453Q-Wa.js → automation-task-card-BBEA23Zb.js} +1 -1
  34. package/dist/gateway/static/root/assets/{automations-page-BLFBqaPX.js → automations-page-DelDZorh.js} +1 -1
  35. package/dist/gateway/static/root/assets/{automations-workspace-DiO3Iyuj.js → automations-workspace-leY4yCvw.js} +2 -2
  36. package/dist/gateway/static/root/assets/{binary-plugins-D_zw0TgG.js → binary-plugins-o-jwYyMd.js} +1 -1
  37. package/dist/gateway/static/root/assets/block-editor-BFDeQtYs.css +1 -0
  38. package/dist/gateway/static/root/assets/{block-editor-Cesz2DqP.js → block-editor-Bp6TLleA.js} +46 -46
  39. package/dist/gateway/static/root/assets/{browser-settings-page-BHElJSFt.js → browser-settings-page-CtPARtRA.js} +1 -1
  40. package/dist/gateway/static/root/assets/{capabilities-CW-vdkz6.js → capabilities-B5gHYD8r.js} +1 -1
  41. package/dist/gateway/static/root/assets/{capabilities-DZrjA95P.js → capabilities-G2ZaAAs2.js} +1 -1
  42. package/dist/gateway/static/root/assets/{capabilities-page-DQrfkrBA.js → capabilities-page-C6KCaaHR.js} +2 -2
  43. package/dist/gateway/static/root/assets/{capabilities-settings-panel-DIT2dvtc.js → capabilities-settings-panel-CVwdxuL4.js} +1 -1
  44. package/dist/gateway/static/root/assets/{channels-Dcr5dgqw.js → channels-Bh2bHLni.js} +1 -1
  45. package/dist/gateway/static/root/assets/{chat-agents-api-CyvBfBbp.js → chat-agents-api-DRKlkcuv.js} +1 -1
  46. package/dist/gateway/static/root/assets/{chat-chart-block-B83s8HE9.js → chat-chart-block-DxTCx__V.js} +1 -1
  47. package/dist/gateway/static/root/assets/{chat-page-DWZCzxY7.js → chat-page-XqG9aYBd.js} +31 -31
  48. package/dist/gateway/static/root/assets/{chat-terminal-dock-DCUuwiTt.js → chat-terminal-dock-Ch74AWYF.js} +1 -1
  49. package/dist/gateway/static/root/assets/{command-palette-api-UrqPvWR1.js → command-palette-api-CAKoTF_-.js} +1 -1
  50. package/dist/gateway/static/root/assets/{composer-model-config-control-C2Bku39S.js → composer-model-config-control-Bas1wFVW.js} +1 -1
  51. package/dist/gateway/static/root/assets/{composer-notifications-MGKffwC7.js → composer-notifications-CpBgWAE4.js} +1 -1
  52. package/dist/gateway/static/root/assets/{composer-payload-handoff-a0quQ25p.js → composer-payload-handoff-uT_hvvap.js} +1 -1
  53. package/dist/gateway/static/root/assets/{computer-settings-page-DUzQe6Bz.js → computer-settings-page-x8YUBBuX.js} +1 -1
  54. package/dist/gateway/static/root/assets/confirm-dialog-yhRKgG72.js +1 -0
  55. package/dist/gateway/static/root/assets/{connected-providers-grid-BJKEp0SE.js → connected-providers-grid-DS21-u3Q.js} +1 -1
  56. package/dist/gateway/static/root/assets/{connection-usage-guide-B9hoSOnN.js → connection-usage-guide-DNNFESD9.js} +1 -1
  57. package/dist/gateway/static/root/assets/{connector-service-page-e67KylnM.js → connector-service-page-BS7IJ6oc.js} +1 -1
  58. package/dist/gateway/static/root/assets/{connectors-api-CRGq-TSw.js → connectors-api-B27sJ651.js} +1 -1
  59. package/dist/gateway/static/root/assets/{connectors-page-BteRI1XM.js → connectors-page-DM6TppXV.js} +1 -1
  60. package/dist/gateway/static/root/assets/{date-picker-DwITf4I2.js → date-picker-D3N2BGVY.js} +1 -1
  61. package/dist/gateway/static/root/assets/{date-time-picker-ChG1CqR1.js → date-time-picker-BNw099Is.js} +1 -1
  62. package/dist/gateway/static/root/assets/{desktop-pet-BHoFymL4.js → desktop-pet-BtY6aGrh.js} +1 -1
  63. package/dist/gateway/static/root/assets/{desktop-pet-settings-BYeBN4jj.js → desktop-pet-settings-DVXfAMaU.js} +1 -1
  64. package/dist/gateway/static/root/assets/{dev-view-store-DsjH8x76.js → dev-view-store-D4EyUkRI.js} +1 -1
  65. package/dist/gateway/static/root/assets/{device-connections-panel-DE01vyK_.js → device-connections-panel-DYK_DQzO.js} +1 -1
  66. package/dist/gateway/static/root/assets/{device-pairing-action-w1enAo76.js → device-pairing-action-DXo8MWy2.js} +1 -1
  67. package/dist/gateway/static/root/assets/{device-pairing-wizard-Dt737tSq.js → device-pairing-wizard-NddAztJ2.js} +1 -1
  68. package/dist/gateway/static/root/assets/{directory-picker-path-field-B-eUnbng.js → directory-picker-path-field-Bbq7ZyGn.js} +1 -1
  69. package/dist/gateway/static/root/assets/{extension-authoritative-grants-DYp2nNol.js → extension-authoritative-grants-qpYvHriJ.js} +1 -1
  70. package/dist/gateway/static/root/assets/{extension-debug-page-4jJ1uVQJ.js → extension-debug-page-BOb-6rpq.js} +1 -1
  71. package/dist/gateway/static/root/assets/{extension-iframe-host-CJV5JETm.js → extension-iframe-host-DpgIPfJe.js} +1 -1
  72. package/dist/gateway/static/root/assets/{extension-marketplace-api-DGV5FC-v.js → extension-marketplace-api-BhGNQYHl.js} +1 -1
  73. package/dist/gateway/static/root/assets/{extension-message-router-B4I-Y6qs.js → extension-message-router-QjbtEYyu.js} +1 -1
  74. package/dist/gateway/static/root/assets/{extension-page-lc7a84nG.js → extension-page-BOp7wU9Y.js} +1 -1
  75. package/dist/gateway/static/root/assets/{extension-provider-D8_mIBI0.js → extension-provider-CFPicsnW.js} +1 -1
  76. package/dist/gateway/static/root/assets/{extension-settings-page-Uw2lfWRh.js → extension-settings-page-cXjBvPwg.js} +1 -1
  77. package/dist/gateway/static/root/assets/{gateway-config-swr-BD-ams0X.js → gateway-config-swr-DxelrRtx.js} +1 -1
  78. package/dist/gateway/static/root/assets/gateway-realtime-D2B_nv2b.js +1 -0
  79. package/dist/gateway/static/root/assets/gateway-realtime-store-DrVbjYfI.js +1 -0
  80. package/dist/gateway/static/root/assets/{gateway-restart-Dos1Pp84.js → gateway-restart-Ce6rCCAr.js} +1 -1
  81. package/dist/gateway/static/root/assets/{gateway-settings-DUC1iOVK.js → gateway-settings-BTr0Gwdo.js} +1 -1
  82. package/dist/gateway/static/root/assets/{gateway-startup-retry-DgmvR-hb.js → gateway-startup-retry-Dm0dK8BT.js} +1 -1
  83. package/dist/gateway/static/root/assets/{global-defaults-api-B7suATYU.js → global-defaults-api-BZnu44eA.js} +1 -1
  84. package/dist/gateway/static/root/assets/{home-page-mSRCU81k.js → home-page-Bxr3V5lc.js} +3 -3
  85. package/dist/gateway/static/root/assets/{home-task-actions-_ZAc57Y7.js → home-task-actions-GAO06s1_.js} +1 -1
  86. package/dist/gateway/static/root/assets/{image-generation-api-Baz4xdZ4.js → image-generation-api-DrZPmWFt.js} +1 -1
  87. package/dist/gateway/static/root/assets/{imports-page-DR0eLPgB.js → imports-page-D-x5kijk.js} +1 -1
  88. package/dist/gateway/static/root/assets/index-BjU5H5hz.js +11 -0
  89. package/dist/gateway/static/root/assets/index-CREeN6C_.css +1 -0
  90. package/dist/gateway/static/root/assets/{install-connector-dialog-CntHi8Rh.js → install-connector-dialog-st2O1bez.js} +1 -1
  91. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-DnKkQoqR.js +1 -0
  92. package/dist/gateway/static/root/assets/{local-app-workbench-page-C3Lqi8E1.js → local-app-workbench-page-CKHJa4K8.js} +1 -1
  93. package/dist/gateway/static/root/assets/{local-apps-page-BoCtITdL.js → local-apps-page-D28d-sO0.js} +1 -1
  94. package/dist/gateway/static/root/assets/{local-session-drafts-CGSV1RQg.js → local-session-drafts-KkAOxXk5.js} +2 -2
  95. package/dist/gateway/static/root/assets/{locale-store-CHjsq5NR.js → locale-store-Dy0B0XDJ.js} +1 -1
  96. package/dist/gateway/static/root/assets/{logs-page-0hkRbcUR.js → logs-page-BPuHO-iA.js} +1 -1
  97. package/dist/gateway/static/root/assets/{management-api-FVu7eYXD.js → management-api-BtTRehT0.js} +1 -1
  98. package/dist/gateway/static/root/assets/{management-settings-QQB1r71U.js → management-settings-B2R43Itv.js} +1 -1
  99. package/dist/gateway/static/root/assets/{markdown-view-ihzUc4ud.js → markdown-view-ByuzuGRb.js} +1 -1
  100. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-DffQKrjd.js → mcp-conversation-setup-page-D_6XeyXG.js} +1 -1
  101. package/dist/gateway/static/root/assets/{media-plugins-C78NkHfB.js → media-plugins-B9Q7WvNF.js} +1 -1
  102. package/dist/gateway/static/root/assets/messages-Bj6DCoic.js +3 -0
  103. package/dist/gateway/static/root/assets/{model-selector-QFZY5XNN.js → model-selector-8FTrQQ2N.js} +1 -1
  104. package/dist/gateway/static/root/assets/{models-hub-cache-BrD6r5Qs.js → models-hub-cache-DMBOw544.js} +1 -1
  105. package/dist/gateway/static/root/assets/{new-session-preferences-gb411vZP.js → new-session-preferences-CxCn2Jxk.js} +1 -1
  106. package/dist/gateway/static/root/assets/note-detail-panel-BTNX68oO.js +7 -0
  107. package/dist/gateway/static/root/assets/note-image-lightbox-D20oZuOM.js +1 -0
  108. package/dist/gateway/static/root/assets/{notes-api-D5SvfybU.js → notes-api-M1FuRZbW.js} +1 -1
  109. package/dist/gateway/static/root/assets/{notes-page-RPfvHnl6.js → notes-page-FocipOyc.js} +2 -2
  110. package/dist/gateway/static/root/assets/{oauth-api-DnMpUoyx.js → oauth-api-Dza1tHcr.js} +1 -1
  111. package/dist/gateway/static/root/assets/{oauth-provider-connect-DGYky6ut.js → oauth-provider-connect-BPNIEiMv.js} +1 -1
  112. package/dist/gateway/static/root/assets/{page-context-capture-button-CVHz9b6c.js → page-context-capture-button-DpGnxSrD.js} +1 -1
  113. package/dist/gateway/static/root/assets/{page-context-draft-Bk7jVvAG.js → page-context-draft-CHAS3BY3.js} +1 -1
  114. package/dist/gateway/static/root/assets/{page-header-store-NP7MCIaP.js → page-header-store-BXED3zhV.js} +1 -1
  115. package/dist/gateway/static/root/assets/{personal-avatar-1TVnHakL.js → personal-avatar-BCk4KoeZ.js} +1 -1
  116. package/dist/gateway/static/root/assets/{personal-page-Dt1d3tQT.js → personal-page-CSc2n5UD.js} +1 -1
  117. package/dist/gateway/static/root/assets/{personal-profile-settings-XiT1MgTK.js → personal-profile-settings-C86FBPOH.js} +1 -1
  118. package/dist/gateway/static/root/assets/{personal-settings-panel-bcw04REt.js → personal-settings-panel-BlPLE0Ip.js} +1 -1
  119. package/dist/gateway/static/root/assets/{phone-dependencies-card-B4QsgIEF.js → phone-dependencies-card-BCob98OY.js} +1 -1
  120. package/dist/gateway/static/root/assets/{phone-model-connection-Dk5kE1Ll.js → phone-model-connection-D-CcYcch.js} +1 -1
  121. package/dist/gateway/static/root/assets/{phone-model-picker-CFoxQiws.js → phone-model-picker-eMe7fmZu.js} +1 -1
  122. package/dist/gateway/static/root/assets/{phone-settings-page-Bv1xm8sh.js → phone-settings-page-D7yXeGmR.js} +1 -1
  123. package/dist/gateway/static/root/assets/{phone-workspace-store-DGaibcsi.js → phone-workspace-store-CcA_vo-t.js} +1 -1
  124. package/dist/gateway/static/root/assets/{plugin-details-dialog-FcOJaeP0.js → plugin-details-dialog-BAmodjSZ.js} +1 -1
  125. package/dist/gateway/static/root/assets/{preference-select-fields-B-yK91If.js → preference-select-fields-BBd5CWkM.js} +1 -1
  126. package/dist/gateway/static/root/assets/{preview-runtime-FtWOW5i4.js → preview-runtime-DUJ7XhMP.js} +3 -3
  127. package/dist/gateway/static/root/assets/product-automation-feedback-BDFpFrSs.js +1 -0
  128. package/dist/gateway/static/root/assets/{product-open-page-C09VEZjY.js → product-open-page-t3hsoYql.js} +1 -1
  129. package/dist/gateway/static/root/assets/{product-preview-content-B3mzl6-f.js → product-preview-content-BM0pjf0F.js} +1 -1
  130. package/dist/gateway/static/root/assets/{product-preview-modal-5kTp_7Qk.js → product-preview-modal-CLQcCVjI.js} +2 -2
  131. package/dist/gateway/static/root/assets/project-detail-page-CK_EN6Jq.js +7 -0
  132. package/dist/gateway/static/root/assets/{project-understanding-4IyHVmus.js → project-understanding-CwtdVbMP.js} +1 -1
  133. package/dist/gateway/static/root/assets/{projects-page-C-9x23LR.js → projects-page-ESAmJ4I_.js} +1 -1
  134. package/dist/gateway/static/root/assets/{providers-api-D9NuB7w3.js → providers-api-CR7FJzt-.js} +1 -1
  135. package/dist/gateway/static/root/assets/recording-upload-DrgujKBt.js +1 -0
  136. package/dist/gateway/static/root/assets/{registry-api-CDpUAb2R.js → registry-api-CaBz9f4g.js} +1 -1
  137. package/dist/gateway/static/root/assets/{remote-access-hub-DVTs8pwO.js → remote-access-hub-CB-Js5gd.js} +1 -1
  138. package/dist/gateway/static/root/assets/{resource-unavailable-CZlqZYk-.js → resource-unavailable-DiPPmZsR.js} +1 -1
  139. package/dist/gateway/static/root/assets/right-workspace-store-CcRApllu.js +1 -0
  140. package/dist/gateway/static/root/assets/{route-preload-CzorjVc9.js → route-preload-Ab7Zw-df.js} +2 -2
  141. package/dist/gateway/static/root/assets/{routine-panel-n4IstC8Y.js → routine-panel-DzdJGicv.js} +2 -2
  142. package/dist/gateway/static/root/assets/{runtime-tools-api-BhS0RWf2.js → runtime-tools-api-utBemmh4.js} +1 -1
  143. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-jTbGPGeA.js → runtime-tools-settings-panel-ChXrIluB.js} +1 -1
  144. package/dist/gateway/static/root/assets/{service-recommendation-list-wfd0Mjtu.js → service-recommendation-list-Dm5GcMRy.js} +1 -1
  145. package/dist/gateway/static/root/assets/{session-api-CR3NLqvs.js → session-api-vEn4BzjV.js} +1 -1
  146. package/dist/gateway/static/root/assets/{session-manager-C2MCS4C5.js → session-manager-7nbjJYyy.js} +2 -2
  147. package/dist/gateway/static/root/assets/{sessions-page-9ibCNP9o.js → sessions-page-B__ftjgG.js} +1 -1
  148. package/dist/gateway/static/root/assets/settings-advanced-gate-DV-_ZdXD.js +1 -0
  149. package/dist/gateway/static/root/assets/{settings-advanced-section-CTLdGPvx.js → settings-advanced-section-DhKzGl03.js} +1 -1
  150. package/dist/gateway/static/root/assets/{settings-mode-store-CCQVvItG.js → settings-mode-store-CQofc337.js} +1 -1
  151. package/dist/gateway/static/root/assets/{settings-page-DsM_f07M.js → settings-page-CzW5GM5r.js} +1 -1
  152. package/dist/gateway/static/root/assets/{settings-page-header-C21Iw2rD.js → settings-page-header-CiS6x6sn.js} +1 -1
  153. package/dist/gateway/static/root/assets/{settings-page-layout-BXcLlp6p.js → settings-page-layout-B-rj_rso.js} +1 -1
  154. package/dist/gateway/static/root/assets/{setup-interaction-page-W2F5ZaR_.js → setup-interaction-page-DTgwtj55.js} +1 -1
  155. package/dist/gateway/static/root/assets/{setup-status-panel-BFNwZuhp.js → setup-status-panel-BhKPMIds.js} +1 -1
  156. package/dist/gateway/static/root/assets/{share-link-dialog-2JjvWs0q.js → share-link-dialog-WR7Op1vL.js} +1 -1
  157. package/dist/gateway/static/root/assets/{share-preview-page-C32Mq-BY.js → share-preview-page-DonmTI11.js} +1 -1
  158. package/dist/gateway/static/root/assets/{shares-api-BhWvN3LS.js → shares-api-CoRLwDnw.js} +1 -1
  159. package/dist/gateway/static/root/assets/{shares-settings-BDGbs8wz.js → shares-settings-UA91fiMV.js} +1 -1
  160. package/dist/gateway/static/root/assets/{skill-api-BG9A1WF0.js → skill-api-BE-iPtTQ.js} +1 -1
  161. package/dist/gateway/static/root/assets/{skill-list-api-B26hHnXq.js → skill-list-api-Dsfjdtuu.js} +1 -1
  162. package/dist/gateway/static/root/assets/{skill-reload-api-B9Eu5Yk_.js → skill-reload-api-BIZJWow-.js} +1 -1
  163. package/dist/gateway/static/root/assets/{skills-page-kL8E5zgi.js → skills-page-1wvItQag.js} +1 -1
  164. package/dist/gateway/static/root/assets/{space-api-_uKFiASp.js → space-api-E8VbAaEl.js} +1 -1
  165. package/dist/gateway/static/root/assets/space-page-BCzDsNJd.js +2 -0
  166. package/dist/gateway/static/root/assets/{space-workbook-BAwHwK6O.js → space-workbook-CwltZeHG.js} +1 -1
  167. package/dist/gateway/static/root/assets/{system-settings-panel-0e2zfQLt.js → system-settings-panel-03a25GEc.js} +1 -1
  168. package/dist/gateway/static/root/assets/{task-detail-page-DdCpNW8K.js → task-detail-page-B_YXsT9W.js} +1 -1
  169. package/dist/gateway/static/root/assets/{task-header-title-CLt_lmjb.js → task-header-title-bZVPIbyR.js} +1 -1
  170. package/dist/gateway/static/root/assets/{task-result-presentation-CgvcqEMD.js → task-result-presentation-_VWkiekf.js} +1 -1
  171. package/dist/gateway/static/root/assets/{task-run-issue-notice-8FX876PP.js → task-run-issue-notice-BXOES2t9.js} +1 -1
  172. package/dist/gateway/static/root/assets/{tasks-CvOAtEHv.js → tasks-D8bnpu0N.js} +1 -1
  173. package/dist/gateway/static/root/assets/{terminal-panel-store-Cy90Ix5U.js → terminal-panel-store-BOHv5O2x.js} +1 -1
  174. package/dist/gateway/static/root/assets/{theme-store-CvG266p8.js → theme-store-XNsFzxSj.js} +1 -1
  175. package/dist/gateway/static/root/assets/{tracing-settings-page-Cx_fOH70.js → tracing-settings-page-Y9z2HoGj.js} +1 -1
  176. package/dist/gateway/static/root/assets/{tunnel-api-Cph-ZBBy.js → tunnel-api-XHGjcUi9.js} +1 -1
  177. package/dist/gateway/static/root/assets/turn-outcome-Bf3N3Bmj.js +1 -0
  178. package/dist/gateway/static/root/assets/{understanding-activity-store-CN4JzOIO.js → understanding-activity-store-BDBAkksk.js} +1 -1
  179. package/dist/gateway/static/root/assets/{understanding-refresh-store-BuZZ1_VH.js → understanding-refresh-store-D7gBfD26.js} +1 -1
  180. package/dist/gateway/static/root/assets/{usage-page-Du42x0ej.js → usage-page-DxESTMwa.js} +1 -1
  181. package/dist/gateway/static/root/assets/{use-autosave-B_WH_LBE.js → use-autosave-D7zZrcsj.js} +1 -1
  182. package/dist/gateway/static/root/assets/{use-composer-attachments-BEuyorVm.js → use-composer-attachments-DWiIdMIi.js} +1 -1
  183. package/dist/gateway/static/root/assets/{use-file-preview-expanded-Cehu0745.js → use-file-preview-expanded-CA9vFUTT.js} +1 -1
  184. package/dist/gateway/static/root/assets/{use-generated-media-CzRbgtcv.js → use-generated-media-DX4_ne7C.js} +1 -1
  185. package/dist/gateway/static/root/assets/{use-personal-profile-D4gLM6Wi.js → use-personal-profile-CaCORKeL.js} +1 -1
  186. package/dist/gateway/static/root/assets/{use-personal-work-B25WRGHj.js → use-personal-work-D0tMU1bP.js} +1 -1
  187. package/dist/gateway/static/root/assets/{use-realtime-voice-CV3GIt_T.js → use-realtime-voice-D9k997EW.js} +1 -1
  188. package/dist/gateway/static/root/assets/{use-share-link-WKZLlEqr.js → use-share-link-CqV3o-VZ.js} +1 -1
  189. package/dist/gateway/static/root/assets/{use-workspace-tree-C0C861cb.js → use-workspace-tree-nnrez9-d.js} +1 -1
  190. package/dist/gateway/static/root/assets/{user-model-page-AK2U8vGc.js → user-model-page-CpVdbSxS.js} +1 -1
  191. package/dist/gateway/static/root/assets/{voice-api-key-field-BqXQj51r.js → voice-api-key-field-CVi3dBKx.js} +1 -1
  192. package/dist/gateway/static/root/assets/{voice-config-api-sXEIG6lz.js → voice-config-api-DZbcg7qD.js} +1 -1
  193. package/dist/gateway/static/root/assets/voice-input-shortcut-events-CwKpIInD.js +1 -0
  194. package/dist/gateway/static/root/assets/{voice-player-store-CTbnOdeM.js → voice-player-store-DT0f9GPa.js} +1 -1
  195. package/dist/gateway/static/root/assets/{voice-settings-JpPo3BvX.js → voice-settings-CJdWnHas.js} +1 -1
  196. package/dist/gateway/static/root/assets/{work-discovery-overlay-BjfTRFX8.js → work-discovery-overlay-qEN1Ikir.js} +1 -1
  197. package/dist/gateway/static/root/assets/{work-discovery-page-CSRkFiXc.js → work-discovery-page-JjCyt1Kw.js} +1 -1
  198. package/dist/gateway/static/root/assets/{working-directory-picker-modal-DgM21YVT.js → working-directory-picker-modal-DX6bRmkQ.js} +1 -1
  199. package/dist/gateway/static/root/assets/{workspace-api-CQOuWbVv.js → workspace-api-CD_6YyPI.js} +2 -2
  200. package/dist/gateway/static/root/assets/workspace-editor-agent-store-BuYdf4CO.js +1 -0
  201. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-CmMueTmW.js → workspace-file-preview-dialog-DPHnm_7A.js} +1 -1
  202. package/dist/gateway/static/root/assets/{workspace-open-location-menu-BAbIGS01.js → workspace-open-location-menu-BdXn5F2i.js} +1 -1
  203. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-e8HJFnTs.js → xopc-cloud-account-card-CLM7hfkN.js} +1 -1
  204. package/dist/gateway/static/root/index.html +97 -97
  205. package/dist/package.js +1 -1
  206. package/dist/packages/gateway-contract/src/session-input-command.js +2 -1
  207. package/dist/packages/gateway-contract/src/task-display.js +1 -1
  208. package/dist/packages/gateway-contract/src/task-research-result.js +5 -0
  209. package/dist/packages/realtime-client/src/index.js +6 -1
  210. package/dist/packages/realtime-protocol/src/browser-preview.js +111 -0
  211. package/dist/packages/realtime-protocol/src/index.js +5 -1
  212. package/dist/src/agent/agent-manager.d.ts +2 -2
  213. package/dist/src/agent/agent-manager.js +6 -3
  214. package/dist/src/agent/commands/command-registry.js +2 -1
  215. package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -0
  216. package/dist/src/agent/embedded/execution-tool-policy.js +7 -3
  217. package/dist/src/agent/embedded/run-turn.js +9 -3
  218. package/dist/src/agent/mcp/continuation-guard.js +2 -1
  219. package/dist/src/agent/mcp/conversation-setup.js +2 -1
  220. package/dist/src/agent/mcp/discovery.js +2 -1
  221. package/dist/src/agent/orchestration/child-run-monitor.js +2 -1
  222. package/dist/src/agent/session/interaction-policy-state.js +2 -1
  223. package/dist/src/agent/tools/browser/tool/browser-use-tool.js +24 -16
  224. package/dist/src/agent/tools/browser/tool/schemas.d.ts +1 -0
  225. package/dist/src/agent/tools/browser/tool/schemas.js +6 -1
  226. package/dist/src/agent/tools/clarify-tool.js +1 -1
  227. package/dist/src/agent/tools/factory.js +9 -1
  228. package/dist/src/agent/tools/personal-task-tool.js +79 -16
  229. package/dist/src/agent/tools/session-recall-tool.js +10 -2
  230. package/dist/src/agent/tools/skill-install-tool.js +2 -1
  231. package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
  232. package/dist/src/agent/tools/task-result-tool.js +10 -9
  233. package/dist/src/agent/tools/web.js +5 -3
  234. package/dist/src/agent/tools/xopc-use-tool.js +11 -5
  235. package/dist/src/automations/capabilities/write.js +2 -1
  236. package/dist/src/automations/mcp-source.js +2 -1
  237. package/dist/src/browser/drivers/browser-driver.d.ts +1 -0
  238. package/dist/src/browser/drivers/extension-driver.d.ts +2 -0
  239. package/dist/src/browser/drivers/extension-driver.js +11 -1
  240. package/dist/src/browser/runtime/browser-runtime.d.ts +6 -0
  241. package/dist/src/browser/runtime/browser-runtime.js +13 -1
  242. package/dist/src/capabilities/runtime/dispatcher.d.ts +6 -0
  243. package/dist/src/capabilities/runtime/dispatcher.js +47 -12
  244. package/dist/src/channels/attachments/inbound-persist.js +1 -0
  245. package/dist/src/channels/attachments/outbound-tts-persist.js +1 -0
  246. package/dist/src/channels/message-journal.js +2 -1
  247. package/dist/src/cli/cli-log-level-preset.js +5 -1
  248. package/dist/src/cli/commands/mcp.js +44 -5
  249. package/dist/src/cli/index.js +9 -1
  250. package/dist/src/computer/flows.js +2 -1
  251. package/dist/src/config/schema.d.ts +18 -0
  252. package/dist/src/config/schema.js +6 -0
  253. package/dist/src/connectors/composio-triggers.js +2 -1
  254. package/dist/src/endpoint-tools/delegation.js +2 -1
  255. package/dist/src/endpoint-tools/device-capability-grants.js +2 -1
  256. package/dist/src/endpoint-tools/execution-actor.js +2 -1
  257. package/dist/src/endpoint-tools/folder-connections.js +2 -1
  258. package/dist/src/endpoint-tools/invocation-service.js +2 -1
  259. package/dist/src/endpoint-tools/provider-catalog.js +2 -1
  260. package/dist/src/endpoint-tools/provider-operation-status.js +2 -1
  261. package/dist/src/endpoint-tools/runtime.js +2 -1
  262. package/dist/src/execution-environments/session-environment-service.js +1 -1
  263. package/dist/src/files/workspace-file-spaces.d.ts +4 -0
  264. package/dist/src/files/workspace-file-spaces.js +14 -0
  265. package/dist/src/gateway/file-space-service.d.ts +1 -1
  266. package/dist/src/gateway/file-space-service.js +2 -8
  267. package/dist/src/gateway/hono/app.js +29 -8
  268. package/dist/src/gateway/hono/lib/extension-store.js +2 -1
  269. package/dist/src/gateway/hono/lib/mcp-dispatcher.d.ts +2 -0
  270. package/dist/src/gateway/hono/lib/mcp-dispatcher.js +19 -0
  271. package/dist/src/gateway/hono/routes/browser.js +38 -0
  272. package/dist/src/gateway/hono/routes/capability-operations.d.ts +1 -0
  273. package/dist/src/gateway/hono/routes/capability-operations.js +6 -3
  274. package/dist/src/gateway/hono/routes/device-push.js +7 -2
  275. package/dist/src/gateway/hono/routes/execution-environments.js +4 -0
  276. package/dist/src/gateway/hono/routes/lazy-bundles.js +19 -0
  277. package/dist/src/gateway/hono/routes/mcp-bridge.d.ts +3 -0
  278. package/dist/src/gateway/hono/routes/mcp-bridge.js +87 -0
  279. package/dist/src/gateway/hono/routes/mcp-remote.d.ts +3 -0
  280. package/dist/src/gateway/hono/routes/mcp-remote.js +169 -0
  281. package/dist/src/gateway/hono/routes/notifications.js +11 -7
  282. package/dist/src/gateway/hono/routes/personal-agent.js +2 -1
  283. package/dist/src/gateway/hono/routes/projects.js +2 -3
  284. package/dist/src/gateway/hono/routes/session-command-handler.js +2 -1
  285. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -0
  286. package/dist/src/gateway/security/gateway-scopes.js +2 -0
  287. package/dist/src/gateway/service/agent-runner.js +9 -4
  288. package/dist/src/gateway/service/config-coordinator.d.ts +9 -0
  289. package/dist/src/gateway/service/session-command-service.js +4 -2
  290. package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -0
  291. package/dist/src/gateway/service/session-input-coordinator.js +30 -2
  292. package/dist/src/gateway/service/session-preparation-worker.js +6 -2
  293. package/dist/src/gateway/service.d.ts +6 -0
  294. package/dist/src/gateway/service.js +44 -3
  295. package/dist/src/local-apps/access-audit.js +2 -1
  296. package/dist/src/local-apps/automation-proposals.js +2 -1
  297. package/dist/src/local-apps/capabilities/automation-policy.js +2 -1
  298. package/dist/src/local-apps/capabilities/delegate.js +2 -1
  299. package/dist/src/local-apps/execution-authority.js +2 -1
  300. package/dist/src/local-apps/p1-services.js +2 -1
  301. package/dist/src/local-apps/public-assets.js +2 -1
  302. package/dist/src/local-apps/service.js +2 -1
  303. package/dist/src/local-apps/store.js +2 -1
  304. package/dist/src/mcp/callback-config.d.ts +5 -0
  305. package/dist/src/mcp/callback-config.js +16 -0
  306. package/dist/src/mcp/capability-server.d.ts +1 -2
  307. package/dist/src/mcp/capability-server.js +34 -79
  308. package/dist/src/mcp/connection-grants.d.ts +15 -0
  309. package/dist/src/mcp/connection-grants.js +73 -0
  310. package/dist/src/mcp/delegation.d.ts +329 -0
  311. package/dist/src/mcp/delegation.js +610 -0
  312. package/dist/src/mcp/gateway-http-client.d.ts +2 -2
  313. package/dist/src/mcp/gateway-http-client.js +4 -4
  314. package/dist/src/mcp/product-tools.d.ts +7 -0
  315. package/dist/src/mcp/product-tools.js +292 -0
  316. package/dist/src/mcp/remote-auth.d.ts +8 -0
  317. package/dist/src/mcp/remote-auth.js +51 -0
  318. package/dist/src/mcp/remote-config.d.ts +11 -0
  319. package/dist/src/mcp/remote-config.js +31 -0
  320. package/dist/src/mcp/remote-grants.d.ts +20 -0
  321. package/dist/src/mcp/remote-grants.js +60 -0
  322. package/dist/src/mcp/run-callback-subscriptions.d.ts +13 -0
  323. package/dist/src/mcp/run-callback-subscriptions.js +17 -0
  324. package/dist/src/mcp/run-callbacks.d.ts +6 -0
  325. package/dist/src/mcp/run-callbacks.js +125 -0
  326. package/dist/src/mcp/tool-contract.d.ts +30 -0
  327. package/dist/src/mcp/tool-contract.js +81 -0
  328. package/dist/src/mcp/workspace-search.d.ts +16 -0
  329. package/dist/src/mcp/workspace-search.js +68 -0
  330. package/dist/src/media/index.js +4 -1
  331. package/dist/src/media/media-reference.js +2 -1
  332. package/dist/src/media/session-references.js +4 -2
  333. package/dist/src/media/store.js +2 -1
  334. package/dist/src/media/uri.js +17 -12
  335. package/dist/src/music-generation/artifact.js +2 -1
  336. package/dist/src/music-generation/settings.js +2 -1
  337. package/dist/src/notes/capabilities/write.js +2 -1
  338. package/dist/src/notifications/device-store.js +1 -1
  339. package/dist/src/notifications/platform-push.d.ts +2 -1
  340. package/dist/src/notifications/platform-push.js +4 -3
  341. package/dist/src/notifications/service.js +4 -4
  342. package/dist/src/personal-agent/proactivity/repository.js +2 -1
  343. package/dist/src/personal-agent/proactivity/service.js +2 -1
  344. package/dist/src/personal-agent/reply-result.js +4 -2
  345. package/dist/src/personal-agent/result-reader.d.ts +2 -0
  346. package/dist/src/personal-agent/result-reader.js +12 -1
  347. package/dist/src/personal-agent/specialist-capabilities.js +3 -2
  348. package/dist/src/phone/assistance.js +2 -1
  349. package/dist/src/phone/location-environment.js +2 -1
  350. package/dist/src/phone/repository.js +2 -1
  351. package/dist/src/phone/setup/service.js +2 -1
  352. package/dist/src/projects/index.js +2 -2
  353. package/dist/src/projects/project-kind.d.ts +0 -7
  354. package/dist/src/projects/project-kind.js +1 -6
  355. package/dist/src/projects/project-service.js +1 -9
  356. package/dist/src/realtime/browser-preview-ice.d.ts +2 -0
  357. package/dist/src/realtime/browser-preview-ice.js +42 -0
  358. package/dist/src/realtime/browser-preview.d.ts +45 -0
  359. package/dist/src/realtime/browser-preview.js +191 -0
  360. package/dist/src/realtime/runtime.d.ts +4 -1
  361. package/dist/src/realtime/runtime.js +53 -2
  362. package/dist/src/session/store.js +2 -1
  363. package/dist/src/share/hosted-session-share.js +2 -1
  364. package/dist/src/share/note-share-revocation.js +2 -1
  365. package/dist/src/share/share-store.js +2 -1
  366. package/dist/src/share/site-share-store.js +2 -1
  367. package/dist/src/space/ingest.js +2 -1
  368. package/dist/src/space/workbook-proposals.js +2 -1
  369. package/dist/src/space/workbook-turn.js +2 -1
  370. package/dist/src/space/worker.js +2 -1
  371. package/dist/src/storage/sqlite/durable-state.js +43 -39
  372. package/dist/src/storage/sqlite/session-creation-repository.d.ts +2 -0
  373. package/dist/src/storage/sqlite/session-creation-repository.js +24 -5
  374. package/dist/src/storage/sqlite/session-input-control-repository.js +2 -1
  375. package/dist/src/storage/sqlite/session-input-repository.js +9 -6
  376. package/dist/src/tasks/capabilities/read.js +2 -1
  377. package/dist/src/tasks/capabilities/runs.d.ts +101 -0
  378. package/dist/src/tasks/capabilities/runs.js +41 -34
  379. package/dist/src/tasks/capabilities/write.js +2 -1
  380. package/dist/src/tasks/delegated-run-result.d.ts +16 -0
  381. package/dist/src/tasks/delegated-run-result.js +47 -0
  382. package/dist/src/tasks/index.js +2 -2
  383. package/dist/src/tasks/task-application-service.d.ts +6 -0
  384. package/dist/src/tasks/task-application-service.js +20 -5
  385. package/dist/src/tasks/task-context-assembler.js +10 -6
  386. package/dist/src/tasks/task-contract-planner.js +1 -0
  387. package/dist/src/tasks/task-deliverables.js +19 -14
  388. package/dist/src/tasks/task-handoff.d.ts +20 -3
  389. package/dist/src/tasks/task-handoff.js +207 -146
  390. package/dist/src/tasks/task-json-acceptance.js +3 -2
  391. package/dist/src/tasks/task-main-update-decision-service.js +1 -0
  392. package/dist/src/tasks/task-main-update-delivery.js +4 -2
  393. package/dist/src/tasks/task-origin-repository.d.ts +2 -0
  394. package/dist/src/tasks/task-origin-repository.js +17 -0
  395. package/dist/src/tasks/task-repository.js +3 -0
  396. package/dist/src/tasks/task-research-repair.js +4 -1
  397. package/dist/src/tasks/task-research-result.d.ts +7 -0
  398. package/dist/src/tasks/task-research-result.js +132 -30
  399. package/dist/src/tasks/task-result-delivery-service.js +2 -1
  400. package/dist/src/tasks/task-run-coordinator.js +3 -2
  401. package/dist/src/tasks/task-run-repository.d.ts +2 -1
  402. package/dist/src/tasks/task-run-repository.js +9 -4
  403. package/dist/src/video-generation/artifact.js +2 -1
  404. package/dist/src/video-generation/drafts.js +2 -1
  405. package/dist/src/video-generation/repository.js +2 -1
  406. package/dist/src/video-generation/settings.js +2 -1
  407. package/package.json +3 -1
  408. package/dist/gateway/static/root/assets/block-editor-Cvy3D_4T.css +0 -1
  409. package/dist/gateway/static/root/assets/confirm-dialog-MHCmEEUZ.js +0 -1
  410. package/dist/gateway/static/root/assets/gateway-realtime-CoIFB3im.js +0 -1
  411. package/dist/gateway/static/root/assets/gateway-realtime-store-CTWm23Qi.js +0 -1
  412. package/dist/gateway/static/root/assets/index-B_TGvH_k.css +0 -1
  413. package/dist/gateway/static/root/assets/index-CJAEAcZV.js +0 -11
  414. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-DlGDLJI2.js +0 -1
  415. package/dist/gateway/static/root/assets/messages-C7QSnTdg.js +0 -3
  416. package/dist/gateway/static/root/assets/note-detail-panel-uc-5k3a2.js +0 -7
  417. package/dist/gateway/static/root/assets/note-image-lightbox-Bvjumefe.js +0 -1
  418. package/dist/gateway/static/root/assets/product-automation-feedback-DdFoCDzG.js +0 -1
  419. package/dist/gateway/static/root/assets/project-detail-page-DGPfKx5M.js +0 -7
  420. package/dist/gateway/static/root/assets/recording-upload-plrQDkLa.js +0 -1
  421. package/dist/gateway/static/root/assets/right-workspace-store-Cehybf-G.js +0 -1
  422. package/dist/gateway/static/root/assets/settings-advanced-gate-Cq4HDQu2.js +0 -1
  423. package/dist/gateway/static/root/assets/space-page-DwyuUvI3.js +0 -2
  424. package/dist/gateway/static/root/assets/turn-outcome-Dtw6OgwL.js +0 -1
  425. package/dist/gateway/static/root/assets/voice-input-shortcut-events-DN-_rY5a.js +0 -1
  426. package/dist/gateway/static/root/assets/workspace-editor-agent-store-CX8zX9eZ.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,t as a}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as o,l as s,n as c,o as l}from"./locale-store-CHjsq5NR.js";import{t as u}from"./messages-C7QSnTdg.js";import{n as d,r as f}from"./popover-select-hRG1EzAY.js";import{t as p}from"./secret-input-DsjfQmDn.js";import{t as m}from"./loader-circle-CifKLtgG.js";import{t as h}from"./mic-CuUb7zc-.js";import{t as g}from"./play-kxZvpBg8.js";import{t as _}from"./square-DMK_fB-3.js";import{t as v}from"./volume-2-BSJhAY97.js";import{t as y}from"./cn-0WouolD0.js";import{t as b}from"./skeleton-DzdOeGYz.js";import{a as x,c as S,i as C,m as w,n as T,p as E,u as D}from"./schemas-CCWMleym.js";import{n as O}from"./voice-CUfqdnlR.js";import{i as k}from"./vendor-swr-CdRzEUwF.js";import{n as A,r as j}from"./gateway-config-swr-BD-ams0X.js";import{n as M,s as N}from"./playback-coordinator-CWHIf0wr.js";import{t as P}from"./button-C5tRaJxt.js";import{t as F}from"./open-capability-settings-DQsmJxI7.js";import{a as I,d as L,f as R,i as z,o as B,p as V,t as H,u as U}from"./use-realtime-voice-CV3GIt_T.js";import{t as ee}from"./voice-call-context-BM2A4bLz.js";import{a as te,o as ne,s as W}from"./form-field-width-DJw_jULe.js";import{t as G}from"./secret-input-labels-B5Jl5HqK.js";import{n as K}from"./model-sort-_Tz8s_4N.js";import{r as re}from"./model-selector-QFZY5XNN.js";import{t as ie}from"./settings-loading-skeleton-CAoOV17i.js";import{a as q,i as J}from"./capability-navigation-CZbCI5C2.js";import{t as ae}from"./number-input-El7Szeln.js";import{n as oe,t as se}from"./use-autosave-B_WH_LBE.js";import{a as ce,c as le,d as ue,f as de,g as fe,h as pe,i as Y,l as me,n as he,o as ge,p as _e,r as ve,t as ye,u as be}from"./voice-config-api-sXEIG6lz.js";import{t as xe}from"./voice-api-key-field-BqXQj51r.js";var Se=E({"zh-CN":w().min(1).optional(),en:w().min(1).optional()}),Ce=T([`transcription`,`transcription.stream`,`speech`,`speech.stream`,`conversation`]),we=E({protocolVersion:S(1),serviceVersion:D().int().positive(),modes:C(Ce),transport:S(`websocket-pcm`),inputFormat:E({encoding:S(`pcm_s16le`),sampleRate:S(16e3),channels:S(1)}),outputFormat:E({encoding:S(`pcm_s16le`),sampleRate:S(24e3),channels:S(1)}),turnDetection:C(S(`server_vad`)),bargeIn:x(),tools:x(),resumable:S(!1),voices:C(E({id:w().min(1),name:w(),displayNames:Se.optional(),languages:C(w()),gender:T([`female`,`male`]).optional(),style:w().optional(),description:w().optional(),modes:C(Ce).optional()})),defaultVoice:w().min(1).optional(),limits:E({maxFrameBytes:D().int().positive().max(65536),maxSessionSeconds:D().int().positive()})});function Te(e,t){return e.modes===void 0||e.modes.includes(t)}var Ee=E({mode:Ce,model:w().min(1).max(200),voice:w().min(1).max(200).optional()}),De=E({revision:w().min(1),catalogVersion:w().nullable(),selections:C(Ee),models:C(E({id:w(),name:w(),displayNames:Se.optional(),voice:we}))}),X=n(),Z=e(t(),1),Q=r();function Oe({disabled:e=!1,modes:t,onPendingChange:n}){let r=c(e=>e.language),i=r===`zh`,[a,s]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>(n?.(a),()=>n?.(!1)),[a,n]);let[u,p]=(0,Z.useState)(``),{data:m,mutate:h,error:g}=k(o(`/api/voice/catalog`),async e=>{let t=await l(e);return De.parse(t.payload)}),_=i?{transcription:`录音转文字`,"transcription.stream":`实时听写 / 语音助手输入`,speech:`消息朗读`,"speech.stream":`语音助手输出`,conversation:`自然语音对话`}:{transcription:`Recorded transcription`,"transcription.stream":`Live dictation / assistant input`,speech:`Message readout`,"speech.stream":`Assistant speech`,conversation:`Natural conversation`},v=async e=>{if(m){s(!0),p(``);try{let t=await l(o(e?`/api/voice/selection`:`/api/voice/catalog/refresh`),{method:e?`PUT`:`POST`,...e?{body:JSON.stringify({revision:m.revision,selection:e})}:{}});await h(De.parse(t.payload),!1),await A()}catch(e){p(e instanceof Error?e.message:String(e)),await h()}finally{s(!1)}}};return(0,Q.jsxs)(`section`,{className:`space-y-4 rounded-xl bg-surface-hover/20 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h3`,{className:`font-medium`,children:i?`XOPC 托管语音模型`:`XOPC managed voice models`}),(0,Q.jsx)(P,{variant:`secondary`,disabled:a||e||!m,onClick:()=>void v(),children:i?`刷新目录`:`Refresh catalog`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`修改在下次调用生效。各设备共用此 Gateway 的配置。`:`Changes apply to the next call and are shared across devices.`}),u||g?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:u||String(g)}):null,m?(0,Q.jsx)(Q.Fragment,{children:t.map(t=>{let n=m.selections.find(e=>e.mode===t),o=m.models.filter(e=>e.voice.modes.includes(t)).sort(K),s=o.find(e=>e.id===n?.model),c=s?.voice.voices.filter(e=>Te(e,t))??[],l=n?.voice??c.find(e=>e.id===s?.voice.defaultVoice)?.id??c[0]?.id??``;return(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[(0,Q.jsx)(`span`,{children:_[t]}),(0,Q.jsxs)(d,{className:`w-full`,value:n?.model??``,disabled:a||e||!o.length,onChange:e=>void v({mode:t,model:e.target.value}),children:[(0,Q.jsx)(f,{value:``,disabled:!0,children:i?`选择模型`:`Choose model`}),n&&!s?(0,Q.jsxs)(f,{value:n.model,disabled:!0,children:[n.model,` · `,i?`不可用`:`Unavailable`]}):null,o.map(e=>(0,Q.jsx)(f,{value:e.id,children:re(e,r)},e.id))]}),o.length?null:(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i?`暂无可用模型`:`No available model`})]}),s&&c.length>0?(0,Q.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[(0,Q.jsx)(`span`,{children:i?`音色`:`Voice`}),(0,Q.jsxs)(d,{className:`w-full`,value:l,disabled:a||e,onChange:e=>void v({mode:t,model:s.id,voice:e.target.value}),children:[n?.voice&&!c.some(e=>e.id===n.voice)?(0,Q.jsxs)(f,{value:n.voice,disabled:!0,children:[n.voice,` · `,i?`当前场景不可用`:`Unavailable for this mode`]}):null,c.map(e=>(0,Q.jsxs)(f,{value:e.id,children:[re(e,r),e.gender?` · ${i?e.gender===`female`?`女声`:`男声`:e.gender}`:``,e.style?` · ${e.style}`:``]},e.id))]}),c.find(e=>e.id===l)?.description?(0,Q.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:c.find(e=>e.id===l)?.description}):null]}):null]},t)})}):(0,Q.jsx)(b,{className:`h-48 w-full`})]})}function ke({v:e}){let t=R(e=>e.microphoneId),n=R(e=>e.setMicrophoneId),[r,i]=(0,Z.useState)([]),[a,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(!1),l=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{l.current=!0;let e=()=>{navigator.mediaDevices?.enumerateDevices().then(e=>{l.current&&i(e.filter(e=>e.kind===`audioinput`))}).catch(()=>{})};return e(),navigator.mediaDevices?.addEventListener(`devicechange`,e),()=>{l.current=!1,navigator.mediaDevices?.removeEventListener(`devicechange`,e)}},[]);let u=async()=>{c(!0),o(``);try{(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop());let e=await navigator.mediaDevices.enumerateDevices();l.current&&i(e.filter(e=>e.kind===`audioinput`))}catch(e){l.current&&o(e instanceof Error?e.message:String(e))}finally{l.current&&c(!1)}};return(0,Q.jsxs)(`section`,{className:`space-y-4 rounded-xl bg-surface-hover/20 p-4`,children:[(0,Q.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,Q.jsx)(`span`,{children:e.experience.microphone}),(0,Q.jsxs)(d,{value:t,onChange:e=>n(e.target.value),children:[(0,Q.jsx)(f,{value:``,children:e.experience.systemDevice}),t&&!r.some(e=>e.deviceId===t)?(0,Q.jsx)(f,{value:t,children:e.experience.unavailable}):null,r.filter(e=>e.deviceId&&e.deviceId!=="default").map((t,n)=>(0,Q.jsx)(f,{value:t.deviceId,children:t.label||`${e.experience.microphone} ${n+1}`},t.deviceId))]})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.experience.deviceHint}),(0,Q.jsx)(P,{variant:`secondary`,disabled:s,onClick:()=>void u(),children:e.experience.refreshDevices}),a?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:a}):null]})}var Ae=(0,Z.createContext)(null);function je(e){let t=(0,X.c)(18),n,r;t[0]===e?(n=t[1],r=t[2]):({to:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let[o]=i(),s=(0,Z.useContext)(Ae),c,l;t[3]===r?(c=t[4],l=t[5]):(c=new URLSearchParams(r.split(`?`)[1]??``),l=J(c.get(`configure`)),t[3]=r,t[4]=c,t[5]=l);let u=l,d;t[6]!==s||t[7]!==n||t[8]!==c||t[9]!==u?(d=e=>{n.onClick?.(e),!e.defaultPrevented&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&e.button===0&&s&&u&&c.get(`tab`)===`services`&&(e.preventDefault(),s(u))},t[6]=s,t[7]=n,t[8]=c,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==o||t[12]!==r?(f=q(r,o),t[11]=o,t[12]=r,t[13]=f):f=t[13];let p;return t[14]!==n||t[15]!==d||t[16]!==f?(p=(0,Q.jsx)(a,{...n,onClick:d,to:f}),t[14]=n,t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function Me(e){let t=(0,X.c)(19),{zh:n}=e,{data:r,error:i,mutate:a}=k(`voice-dictation-route`,Ne),o,s;t[0]===a?(o=t[1],s=t[2]):(o=()=>{let e=()=>{a()};return window.addEventListener(`voice-config-changed`,e),window.addEventListener(`config-reload`,e),()=>{window.removeEventListener(`voice-config-changed`,e),window.removeEventListener(`config-reload`,e)}},s=[a],t[0]=a,t[1]=o,t[2]=s),(0,Z.useEffect)(o,s);let c=n?`同时用于聊天听写`:`Also used for chat dictation`,l;t[3]===c?l=t[4]:(l=(0,Q.jsx)(`h2`,{className:`font-medium text-fg`,children:c}),t[3]=c,t[4]=l);let u=n?`默认与录音识别共用模型。已有的独立听写设置会保留。`:`Dictation shares this recognition model. Existing separate dictation settings are preserved.`,d;t[5]===u?d=t[6]:(d=(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:u}),t[5]=u,t[6]=d);let f;t[7]!==r||t[8]!==i||t[9]!==n?(f=!r&&!i?(0,Q.jsx)(b,{className:`h-5 w-64 max-w-full`}):(0,Q.jsx)(`p`,{role:i?`alert`:`status`,className:`text-fg-muted`,children:i?n?`暂时无法读取听写状态。`:`Dictation status could not be loaded.`:r?.mode===`recorded`?n?`当前使用 ${r.provider},点击完成后转为文字。`:`Using ${r.provider}. Choose Finish to transcribe.`:r?.mode===`streaming`?n?`当前使用流式识别${r.provider?` · ${r.provider}`:``}。`:`Using streaming recognition${r.provider?` · ${r.provider}`:``}.`:n?`听写未就绪,请检查识别模型或已有的流式配置。`:`Check the recognition model or existing streaming configuration.`}),t[7]=r,t[8]=i,t[9]=n,t[10]=f):f=t[10];let p;t[11]!==r?.mode||t[12]!==n?(p=r?.mode===`recorded`?null:(0,Q.jsx)(je,{className:`inline-block text-accent-fg hover:underline`,to:`/settings/capabilities/models?tab=services&configure=transcription`,children:n?`管理识别服务`:`Manage recognition services`}),t[11]=r?.mode,t[12]=n,t[13]=p):p=t[13];let m;return t[14]!==l||t[15]!==d||t[16]!==f||t[17]!==p?(m=(0,Q.jsxs)(`section`,{className:`space-y-2 rounded-xl border border-edge p-4 text-sm`,children:[l,d,f,p]}),t[14]=l,t[15]=d,t[16]=f,t[17]=p,t[18]=m):m=t[18],m}function Ne(){return z(AbortSignal.timeout(15e3))}function Pe({v:e,canListen:t,canSpeak:n,disabled:r,onVerified:i}){let a=e.setup,o=(0,Z.useContext)(ee)?.active??!1,[s,c]=(0,Z.useState)(`idle`),[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(``),p=(0,Z.useRef)(`idle`),v=(0,Z.useRef)(null),y=(0,Z.useRef)(!1),b=e=>{p.current=e,c(e)},x=()=>{v.current?.(),v.current=null};(0,Z.useEffect)(()=>()=>v.current?.(),[]);async function S(e){x(),i?.({input:!1,output:!1}),y.current=!1,u(``),f(``),b(e?`connecting`:`playing`);let t=new AbortController,r,o,s,c,l=()=>{o?.cancel(),r?.getTracks().forEach(e=>e.stop()),s?.stop(`surface_closed`)},d=window.setTimeout(()=>m(a.timeout),6e4);v.current=()=>{t.abort(),window.clearTimeout(d),l(),c?.close()};function m(e){t.signal.aborted||(b(`error`),f(e),x())}async function h(){b(`playing`),l();try{let e=await ue(t.signal);if(t.signal.aborted)return;c?.enqueue(e,()=>{t.signal.aborted||(window.clearTimeout(d),b(`confirm`))})}catch(e){m(e instanceof Error?e.message:a.testFailed)}}try{if(n&&(c=new U,await c.start(),t.signal.throwIfAborted()),!e){await h();return}let d=window.electronAPI?.system;if(d){let e=await d.requestMicrophone();if(t.signal.throwIfAborted(),e.status===`denied`)throw Error(a.microphoneDenied)}if(r=await navigator.mediaDevices.getUserMedia({audio:V()}),t.signal.aborted){l();return}if(s=await L.connect({purpose:`dictation`,signal:t.signal,onEvent:e=>{t.signal.aborted||(e.type===`session.error`&&m(a.testFailed),p.current===`listening`&&(e.type===`input.transcript.delta`&&u(e.payload.text),e.type===`input.transcript.final`&&e.payload.text.trim()&&(u(e.payload.text.trim()),y.current=!0,n?h():(b(`passed`),i?.({input:!0,output:!1}),x()))))},onClose:()=>{(p.current===`listening`||p.current===`connecting`)&&m(a.testFailed)}}),t.signal.aborted){l();return}let f;if(o=await I.start(r,{onSamples:e=>{f&&!t.signal.aborted&&s?.sendAudio(f.push(e))}}),t.signal.aborted){l();return}f=new B(o.sampleRate,s.session.inputFormat.sampleRate),b(`listening`)}catch(e){if(t.signal.aborted){l();return}m(e instanceof Error?e.message:a.testFailed)}}let C=s===`connecting`||s===`listening`||s===`playing`;return(0,Q.jsxs)(`div`,{className:`space-y-3 rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(P,{type:`button`,variant:`primary`,disabled:o||r||!t||C,onClick:()=>void S(!0),children:[C?(0,Q.jsx)(m,{className:`size-4 animate-spin`}):(0,Q.jsx)(h,{className:`size-4`}),n?a.test:a.testInput]}),(0,Q.jsxs)(P,{type:`button`,variant:`secondary`,disabled:o||r||!n||C,onClick:()=>void S(!1),children:[(0,Q.jsx)(g,{className:`size-4`}),e.tts.test.play]}),C?(0,Q.jsxs)(P,{type:`button`,variant:`ghost`,onClick:()=>{x(),b(`idle`)},children:[(0,Q.jsx)(_,{className:`size-4`}),e.tts.test.stop]}):null]}),(0,Q.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`space-y-2 text-xs text-fg-muted`,children:[s===`idle`?(0,Q.jsx)(`p`,{children:o?e.experience.endCallBeforeTest:r?a.saveBeforeTest:a.microphoneHint}):null,s===`connecting`?(0,Q.jsx)(`p`,{children:a.connecting}):null,s===`listening`?(0,Q.jsx)(`p`,{children:a.speakNow}):null,l?(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-base p-3 text-sm text-fg`,children:l}):null,s===`playing`?(0,Q.jsx)(`p`,{children:a.playing}):null,s===`confirm`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`span`,{children:a.heardQuestion}),(0,Q.jsx)(P,{type:`button`,variant:`secondary`,onClick:()=>{x(),i?.({input:y.current,output:!0}),b(`passed`)},children:a.heard}),(0,Q.jsx)(P,{type:`button`,variant:`ghost`,onClick:()=>{x(),b(`error`),f(a.notHeard)},children:a.notHeardButton})]}):null,s===`passed`?(0,Q.jsx)(`p`,{children:y.current?n?a.passed:a.inputPassed:a.outputPassed}):null,s===`error`?(0,Q.jsx)(`p`,{role:`alert`,className:`text-red-600 dark:text-red-400`,children:d}):null]})]})}function Fe(e){let t=(0,X.c)(78),{section:n,v:r,form:i,pending:a,onChange:s}=e,l=c(Be),u=r.setup,p;t[0]===i?p=t[1]:(p=JSON.stringify(i),t[0]=i,t[1]=p);let m=p,h;t[2]===m?h=t[3]:(h={signature:m,input:!1,output:!1},t[2]=m,t[3]=h);let[g,_]=(0,Z.useState)(h);g.signature!==m&&_({signature:m,input:!1,output:!1});let v;t[4]!==a||t[5]!==m?(v=a?null:[`voice-realtime-status`,m],t[4]=a,t[5]=m,t[6]=v):v=t[6];let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y={revalidateOnFocus:!0},t[7]=y):y=t[7];let{data:x,error:S,isLoading:C}=k(v,ve,y),w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=o(`/api/voice/catalog`),t[8]=w):w=t[8];let{data:T}=k(w,ze),E=i.voice.realtime,D=E.tts,O=D?.provider??x?.tts?.provider,A=x?.tts?.model,j;t[9]!==A||t[10]!==O?(j=O&&A?[`realtime-voices`,O,A]:null,t[9]=A,t[10]=O,t[11]=j):j=t[11];let M;t[12]!==A||t[13]!==O?(M=()=>Y(O,A,`realtime`),t[12]=A,t[13]=O,t[14]=M):M=t[14];let N;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(N={revalidateOnFocus:!1},t[15]=N):N=t[15];let{data:P}=k(j,M,N),F;t[16]===P?F=t[17]:(F=P===void 0?[]:P,t[16]=P,t[17]=F);let I=F,L=I,R;t[18]===I?R=t[19]:(R=I.filter(Re),t[18]=I,t[19]=R);let z=R,B=E.defaultEngine===`omni`,V=B?E.omni?.voice??``:D?.voice??``,H;t[20]!==T?.models||t[21]!==B||t[22]!==z||t[23]!==E.omni||t[24]!==L?(H=B&&E.omni?.provider===`qwen-token-plan-cn`?[{id:E.omni.voice,name:E.omni.voice}]:B?E.omni?.provider===`xopc-cloud`?T?.models.find(e=>e.id===E.omni?.model)?.voice.voices.filter(Le)??[]:z.length?z:[`Cherry`,`Ethan`,`Serena`,`Chelsie`].map(Ie):L,t[20]=T?.models,t[21]=B,t[22]=z,t[23]=E.omni,t[24]=L,t[25]=H):H=t[25];let U=H,ee=!!(x?.enabled&&x.stt),te=!!(x?.enabled&&x.tts),W;t[26]!==i||t[27]!==s||t[28]!==E?(W=e=>s({...i,voice:{...i.voice,realtime:{...E,...e}}}),t[26]=i,t[27]=s,t[28]=E,t[29]=W):W=t[29];let G=W,K;t[30]!==a||t[31]!==E.enabled||t[32]!==u.disabled||t[33]!==u.needsSetup||t[34]!==u.pending||t[35]!==u.unverified||t[36]!==u.verified||t[37]!==m||t[38]!==g.signature?(K=(e,t)=>E.enabled?a?u.pending:e?t&&g.signature===m?u.verified:u.unverified:u.needsSetup:u.disabled,t[30]=a,t[31]=E.enabled,t[32]=u.disabled,t[33]=u.needsSetup,t[34]=u.pending,t[35]=u.unverified,t[36]=u.verified,t[37]=m,t[38]=g.signature,t[39]=K):K=t[39];let ie=K,q;t[40]!==V||t[41]!==l||t[42]!==B||t[43]!==O||t[44]!==E.bargeIn||t[45]!==E.defaultEngine||t[46]!==E.enabled||t[47]!==E.omni||t[48]!==E.tts||t[49]!==u.bargeIn||t[50]!==u.defaultVoice||t[51]!==u.enable||t[52]!==u.voice||t[53]!==n||t[54]!==D||t[55]!==x?.tts||t[56]!==G||t[57]!==r.experience||t[58]!==r.realtime||t[59]!==U?(q=n===`listening`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm font-medium text-fg`,children:[(0,Q.jsx)(`span`,{children:u.enable}),(0,Q.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":E.enabled,className:`ui-checkbox`,checked:E.enabled,onChange:e=>G({enabled:e.target.checked})})]}),(0,Q.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,Q.jsx)(`span`,{children:r.experience.defaultMode}),(0,Q.jsxs)(d,{value:E.defaultEngine,className:ne,onChange:e=>G({defaultEngine:e.target.value}),children:[(0,Q.jsx)(f,{value:`auto`,children:l===`zh`?`自动选择`:`Automatic`}),(0,Q.jsx)(f,{value:`agent`,children:r.experience.assistant}),(0,Q.jsx)(f,{value:`omni`,children:r.experience.natural})]})]}),(0,Q.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[E.defaultEngine===`agent`?r.experience.assistantHint:r.experience.naturalHint,` `,r.experience.nextCall]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsx)(`label`,{htmlFor:`realtime-voice`,className:`text-sm font-medium text-fg`,children:u.voice}),(0,Q.jsxs)(d,{id:`realtime-voice`,className:`${ne} w-full sm:w-56`,value:V,disabled:B?!E.omni:!D&&!x?.tts,onChange:e=>{if(B&&E.omni){G({omni:{...E.omni,voice:e.target.value}});return}if(O===`alibaba`||O===`xopc-cloud`){let t={...E.tts,provider:O};e.target.value?t.voice=e.target.value:delete t.voice,G({tts:t})}},children:[B?null:(0,Q.jsx)(f,{value:``,children:u.defaultVoice}),V&&!U.some(e=>e.id===V)?(0,Q.jsx)(f,{value:V,children:V}):null,U.map(e=>(0,Q.jsxs)(f,{value:e.id,children:[re(e,l),`gender`in e&&e.gender?` · ${e.gender===`female`?`女声`:`男声`}`:``,`style`in e&&e.style?` · ${e.style}`:``]},e.id))]}),(()=>{let e=U.find(e=>e.id===V);return e&&`description`in e&&typeof e.description==`string`?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.description}):null})()]}),(0,Q.jsxs)(`label`,{className:`flex items-center justify-between gap-4 text-sm text-fg`,children:[(0,Q.jsxs)(`span`,{children:[u.bargeIn,(0,Q.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:r.realtime.bargeInDescription})]}),(0,Q.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":E.bargeIn,checked:E.bargeIn,className:`size-4 accent-accent`,onChange:e=>G({bargeIn:e.target.checked})})]})]}):null,t[40]=V,t[41]=l,t[42]=B,t[43]=O,t[44]=E.bargeIn,t[45]=E.defaultEngine,t[46]=E.enabled,t[47]=E.omni,t[48]=E.tts,t[49]=u.bargeIn,t[50]=u.defaultVoice,t[51]=u.enable,t[52]=u.voice,t[53]=n,t[54]=D,t[55]=x?.tts,t[56]=G,t[57]=r.experience,t[58]=r.realtime,t[59]=U,t[60]=q):q=t[60];let J;t[61]!==ee||t[62]!==te||t[63]!==S||t[64]!==C||t[65]!==a||t[66]!==n||t[67]!==m||t[68]!==x||t[69]!==ie||t[70]!==r||t[71]!==g.input||t[72]!==g.output?(J=n===`diagnostics`?(0,Q.jsxs)(Q.Fragment,{children:[C?(0,Q.jsx)(b,{className:`h-16 w-full`}):(0,Q.jsxs)(`div`,{className:`space-y-2 text-sm`,role:`status`,children:[(0,Q.jsxs)(`p`,{children:[r.experience.dictationReady,` · `,ie(ee,g.input)]}),(0,Q.jsxs)(`p`,{children:[r.experience.agentReady,` · `,ie(ee&&te,g.input&&g.output)]}),(0,Q.jsxs)(`p`,{children:[r.experience.omniReady,` · `,ie(!!(x?.enabled&&x.omni),!1)]})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.experience.configurationOnly}),(0,Q.jsx)(Pe,{v:r,canListen:ee,canSpeak:te,disabled:a||C||!!S,onVerified:e=>_({signature:m,...e})},`${m}:${JSON.stringify(x)}`)]}):null,t[61]=ee,t[62]=te,t[63]=S,t[64]=C,t[65]=a,t[66]=n,t[67]=m,t[68]=x,t[69]=ie,t[70]=r,t[71]=g.input,t[72]=g.output,t[73]=J):J=t[73];let ae;return t[74]!==u.service||t[75]!==q||t[76]!==J?(ae=(0,Q.jsxs)(`section`,{className:`space-y-5 rounded-xl bg-surface-hover/20 p-4 sm:p-5`,"aria-label":u.service,children:[q,J]}),t[74]=u.service,t[75]=q,t[76]=J,t[77]=ae):ae=t[77],ae}function Ie(e){return{id:e,name:e}}function Le(e){return Te(e,`conversation`)}function Re(e){return[`Cherry`,`Ethan`,`Serena`,`Chelsie`].includes(e.id)}async function ze(e){return De.parse((await l(e)).payload)}function Be(e){return e.language}function Ve(e){let t=(0,X.c)(19),{value:n,onChange:r}=e,i=c(He)===`zh`,a=i?`通话指令`:`Conversation instructions`,o;t[0]===a?o=t[1]:(o=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:a}),t[0]=a,t[1]=o);let s=i?`通话会接续当前会话。可在这里调整语气与回答方式。`:`Calls continue the current conversation. Adjust tone and response style here.`,l;t[2]===s?l=t[3]:(l=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s}),t[2]=s,t[3]=l);let u=i?`通话指令`:`Conversation instructions`,d;t[4]===u?d=t[5]:(d=(0,Q.jsx)(`span`,{children:u}),t[4]=u,t[5]=d);let f;t[6]!==r||t[7]!==n?(f=e=>r({...n,instructions:e.target.value}),t[6]=r,t[7]=n,t[8]=f):f=t[8];let p;t[9]!==f||t[10]!==n.instructions?(p=(0,Q.jsx)(`textarea`,{className:`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,rows:3,maxLength:8e3,value:n.instructions,onChange:f}),t[9]=f,t[10]=n.instructions,t[11]=p):p=t[11];let m;t[12]!==d||t[13]!==p?(m=(0,Q.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[d,p]}),t[12]=d,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==o||t[16]!==l||t[17]!==m?(h=(0,Q.jsxs)(`details`,{className:`space-y-3 rounded-xl bg-surface-hover/20 p-4`,children:[o,l,m]}),t[15]=o,t[16]=l,t[17]=m,t[18]=h):h=t[18],h}function He(e){return e.language}function Ue({disabled:e=!1}){let t=c(e=>e.language),n=t===`zh`,{data:r,error:i,mutate:s}=k(o(ye),he),[l,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(0),_=(0,Z.useId)();(0,Z.useLayoutEffect)(()=>{g(e=>e+1)},[]);let[v,y]=(0,Z.useState)(),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(``),[T,E]=(0,Z.useState)(!1),D=H({disabled:e||x,chat:u(t).chat,onTranscript:()=>{},onTestAudioPlayed:()=>E(!0)}),j=D.phase!==`idle`&&D.phase!==`error`,M=v??r?.voice??`default`,N=r?.credentialSource===`global`;async function I(){try{return await _e()}catch(e){throw e instanceof Error&&`status`in e&&e.status===404?Error(n?`当前 Gateway 版本不支持查看密钥。请更新并重启 Gateway。`:`Update and restart the Gateway to view or copy the saved key.`):e}}async function L(e){if(!(x||j)){S(!0),w(``);try{await s(await pe(e),{revalidate:!1}),`apiKey`in e&&(m(``),g(e=>e+1),E(!1),D.cancelVoiceInput()),await A()}catch(e){w(e instanceof Error?e.message:String(e))}finally{S(!1)}}}return(0,Q.jsxs)(`section`,{className:`@container space-y-3 rounded-xl border border-edge bg-surface-panel p-4`,"aria-label":`Boson AI`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Boson AI · Higgs Realtime`}),!r&&!i?(0,Q.jsx)(b,{className:`h-24 w-full`}):null,i?(0,Q.jsxs)(`div`,{role:`alert`,className:`text-sm text-danger`,children:[n?`无法读取 Boson 设置。`:`Could not load Boson settings.`,(0,Q.jsx)(P,{variant:`ghost`,onClick:()=>void s(),children:n?`重试`:`Retry`})]}):null,r&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`fieldset`,{disabled:e||x||j,className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,Q.jsx)(`label`,{htmlFor:_,className:`text-sm font-medium text-fg`,children:`Boson API Key`}),(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:r.credentialSource===`env`?n?`已从环境读取 BOSON_API_KEY`:`Using BOSON_API_KEY from the environment`:r.credentialSource?n?`已保存 API Key`:`API key saved`:n?`尚未连接`:`Connection needed`})]}),(0,Q.jsxs)(`div`,{className:`grid items-start gap-2 @min-[32rem]:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,Q.jsx)(p,{id:_,value:l||(N?`••••••••••••`:``),onChange:e=>m(e.replace(/^•+/u,``)),autoComplete:`new-password`,inputClassName:`min-h-11`,labels:{show:n?`显示密钥`:`Show key`,hide:n?`隐藏密钥`:`Hide key`,copy:n?`复制密钥`:`Copy key`,copied:n?`已复制`:`Copied`},reveal:N?I:void 0,allowUnrevealedCopy:!0,loadFailedLabel:n?`无法查看已保存的密钥。`:`Could not load the saved key.`,notInConfigFile:n?`当前没有已保存的密钥。`:`There is no saved key.`},`${N}:${h}`),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(P,{className:`min-h-11`,variant:`secondary`,type:`button`,disabled:!l.trim(),onClick:()=>void L({apiKey:l}),children:x?n?`正在保存…`:`Saving…`:n?`保存密钥`:`Save key`}),N&&(0,Q.jsx)(P,{className:`min-h-11`,type:`button`,variant:`ghost`,onClick:()=>void L({apiKey:null}),children:n?`移除已保存密钥`:`Remove saved key`})]})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,Q.jsx)(`span`,{children:n?`Higgs 默认音色`:`Default Higgs voice`}),(0,Q.jsx)(d,{"aria-label":n?`Higgs 默认音色`:`Default Higgs voice`,value:M,onChange:e=>{y(e.target.value),E(!1),D.cancelVoiceInput()},children:O.map(e=>(0,Q.jsx)(f,{value:e,children:e==="default"?n?`模型默认`:`Model default`:e},e))})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(P,{type:`button`,variant:`secondary`,disabled:M===r.voice||!r.credentialSource,onClick:()=>void L({voice:M}),children:n?`保存音色`:`Save voice`}),(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:r.defaultForNatural?n?`当前全局自然语音模型`:`Current global natural voice model`:n?`在上方选择全局自然语音模型`:`Choose the global natural voice model above`})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`测试时请说一句中文,听到回复后可以插话。音频由 Boson 处理,测试内容仅在当前面板显示,可能产生用量。`:`Say a sentence and try interrupting the reply. Boson processes the audio. Test content stays in this panel and may incur usage.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[j?(0,Q.jsx)(P,{type:`button`,variant:`secondary`,onClick:D.cancelVoiceInput,children:n?`结束测试`:`End test`}):(0,Q.jsx)(P,{type:`button`,variant:`secondary`,disabled:e||x||!r.credentialSource,onClick:()=>{D.cancelVoiceInput(),E(!1),w(``),D.startHiggsTest(M)},children:n?`测试通话`:`Test call`}),r.credentialSource&&!e&&!x&&!j&&(0,Q.jsx)(a,{className:`px-2 text-sm text-accent-fg hover:underline`,to:`/personal`,onClick:F,children:n?`打开 Ada`:`Open Ada`})]}),j&&(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:D.phase===`recording`?D.responsePhase===`speaking`?n?`正在播放,可以插话`:`Playing reply. You can interrupt.`:n?`麦克风已开启,请说话`:`Microphone on. Say something.`:n?`正在连接测试通话…`:`Connecting test call…`}),T&&(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-success`,children:n?`测试通过,已播放回复`:`Test passed. Reply played.`}),D.finalTranscript&&(0,Q.jsxs)(`p`,{className:`text-sm text-fg`,children:[n?`转写 · `:`Transcript · `,D.finalTranscript]}),D.responseText&&(0,Q.jsxs)(`p`,{className:`text-sm text-fg`,children:[n?`回复 · `:`Reply · `,D.responseText]})]})]}),(C||D.error)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:C||D.error})]})}var We=te;function Ge(){return y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,W,`dark:border-edge`)}function $(){return y(ne,te)}function Ke(e){return!e||e<=0?``:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function qe(e,t){let n=window.atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return URL.createObjectURL(new Blob([r],{type:t}))}function Je(e,t){switch(e){case`xopc-cloud`:return t.setup.hosted;case`openai`:return t.stt.openai;case`alibaba`:return t.stt.alibaba;case`groq`:return`Groq`;default:return e}}function Ye(e,t){switch(e){case`xopc-cloud`:return t.setup.hosted;case`openai`:return t.tts.providerOpenai;case`alibaba`:return t.stt.alibaba;case`edge`:return t.tts.providerEdge;case`minimax`:return`MiniMax`;default:return e}}function Xe(e,t){switch(e){case`edge`:return t.tts.providerHints.edge;case`openai`:return t.tts.providerHints.openai;case`alibaba`:return t.tts.providerHints.alibaba;case`minimax`:return t.tts.providerHints.minimax;default:return t.tts.providerHints.generic}}function Ze(e){return{maskedHelp:e.apiKeyMaskedHelp,copy:e.apiKeyCopy,copied:e.apiKeyCopied,show:e.apiKeyShow,hide:e.apiKeyHide,notInConfigFile:e.apiKeyNotInConfigFile,loadFailed:e.apiKeyRevealFailed}}function Qe(e,t){let n=e[t.key];return typeof n==`string`||typeof n==`number`||typeof n==`boolean`?n:t.defaultValue===void 0?t.type!==`boolean`&&``:t.defaultValue}function $e(e,t){if(e.type===`boolean`)return!!t;if(e.type!==`number`)return t;let n=String(t).trim();if(!n)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function et(e,t){switch(t.type){case`reset`:return{form:null,baseline:null};case`sync`:{let e=structuredClone(t.value);return{form:e,baseline:structuredClone(e)}}case`update`:return{...e,form:t.updater(e.form)};case`saved`:{let n=structuredClone(t.value);return{form:e.form!==null&&JSON.stringify(e.form)!==JSON.stringify(t.value)?e.form:n,baseline:structuredClone(n)}}}}function tt(e){let t=(0,X.c)(10),[n,r]=(0,Z.useState)(0),i;t[0]!==e.capability||t[1]!==e.disabled?(i=e.capability===`conversation`&&(0,Q.jsx)(Ue,{disabled:e.disabled}),t[0]=e.capability,t[1]=e.disabled,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>r(nt),t[3]=a):a=t[3];let o;t[4]!==n||t[5]!==e?(o=(0,Q.jsx)(rt,{...e,onReload:a},n),t[4]=n,t[5]=e,t[6]=o):o=t[6];let s;return t[7]!==i||t[8]!==o?(s=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[i,o]}),t[7]=i,t[8]=o,t[9]=s):s=t[9],s}function nt(e){return e+1}function rt({capability:e,onPendingChange:t,disabled:n=!1,onReload:r}){let i=c(e=>e.language),a=u(i).voiceSettings,l=R(e=>e.captions),p=R(e=>e.setCaptions),m=!!s(e=>e.conversationId),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useReducer)(et,{form:null,baseline:null}),y=_.form,b=_.baseline,[x,S]=(0,Z.useState)(null),C=(0,Z.useRef)(!1),w=(0,Z.useRef)({}),T=(0,Z.useRef)(y);T.current=y;let E=(0,Z.useRef)({parsed:null,models:void 0}),{data:D,error:O,isLoading:A,mutate:M}=j(m),{data:N,error:F,isLoading:I,mutate:L}=k(m?o(`/api/voice/models`):null,ce,{revalidateOnFocus:!1}),{data:z,error:B,isLoading:V}=k(m?o(`/api/voice/providers`):null,ge,{revalidateOnFocus:!1}),{data:H,error:U,isLoading:ee}=k(m?o(`/api/voice/stt-providers`):null,le,{revalidateOnFocus:!1}),te=(0,Z.useMemo)(()=>z?.providers??[],[z]),ne=(0,Z.useMemo)(()=>H?.providers??[],[H]),W=(0,Z.useMemo)(()=>D?.payload?.config===void 0?null:me(D.payload.config),[D]),G=(0,Z.useMemo)(()=>!y||!b?!1:JSON.stringify(y)!==JSON.stringify(b),[y,b]);m?W!==null&&N!==void 0&&!C.current&&(E.current.parsed!==W||E.current.models!==N)&&(E.current={parsed:W,models:N},w.current=de(D?.payload?.config),v({type:`sync`,value:W}),S(N)):(E.current.parsed!==null||E.current.models!==void 0)&&(E.current={parsed:null,models:void 0},v({type:`reset`}),S(null),C.current=!1);let K=!!(m&&(W===null||N===void 0||z===void 0||H===void 0)&&(A||I||V||ee)),re=O instanceof Error?O.message:O?String(O):F instanceof Error?F.message:F?String(F):B instanceof Error?B.message:B?String(B):U instanceof Error?U.message:U?String(U):null,q=(0,Z.useCallback)(e=>{C.current=!0,v({type:`update`,updater:t=>t?{...t,stt:{...t.stt,...e},...e.provider&&e.provider!==`xopc-cloud`?{voice:{...t.voice,realtime:{...t.voice.realtime,stt:void 0}}}:{}}:null})},[]),J=(0,Z.useCallback)(e=>{C.current=!0,v({type:`update`,updater:t=>{if(!t)return null;let n=t.stt.fallback??{enabled:!1,order:[]};return{...t,stt:{...t.stt,fallback:{...n,...e}}}}})},[]),ae=(0,Z.useCallback)(e=>{C.current=!0,v({type:`update`,updater:t=>t?{...t,voice:{...t.voice,input:{...t.voice.input,refinement:{...t.voice.input.refinement,...e}}}}:null})},[]),ue=(0,Z.useCallback)(e=>{C.current=!0,v({type:`update`,updater:t=>t?{...t,voice:{...t.voice,languageMode:e,...e===`auto`?{language:i}:{}}}:null})},[i]),fe=(0,Z.useCallback)(e=>{C.current=!0,v({type:`update`,updater:t=>t?{...t,voice:{...t.voice,realtime:{...t.voice.realtime,...e}}}:null})},[]),pe=(0,Z.useCallback)(e=>{C.current=!0,v({type:`update`,updater:t=>t?{...t,tts:{...t.tts,...e}}:null})},[]),Y=se({value:y,dirty:G,onSave:(0,Z.useCallback)(async t=>{try{let n=await be(t,e,w.current[e]);w.current={...w.current,...n},v({type:`saved`,value:t}),C.current=!!(T.current&&JSON.stringify(T.current)!==JSON.stringify(t))}catch(e){throw Error(e instanceof Error?e.message:a.saveError)}},[a.saveError,e])});(0,Z.useEffect)(()=>{t?.(G||Y.status===`saving`||h)},[G,Y.status,h,t]),(0,Z.useEffect)(()=>()=>t?.(!1),[t]);let he=(0,Z.useCallback)(e=>{C.current=!0,v({type:`update`,updater:()=>e})},[]);if(!m)return(0,Q.jsx)(`div`,{className:`flex flex-col gap-3`,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.needToken})});if(K)return(0,Q.jsx)(ie,{rows:4});if(!y||x===null)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:re??a.loadError}),(0,Q.jsx)(P,{type:`button`,variant:`secondary`,onClick:()=>{M(),L()},children:a.retry})]});let _e=y.stt,ve=y.tts,ye=y.voice.input.refinement,xe=Ze(a);return(0,Q.jsxs)(`fieldset`,{disabled:n||h,className:`flex min-w-0 flex-col gap-4`,onBlurCapture:Y.error?void 0:Y.onBlurCapture,children:[(0,Q.jsx)(oe,{status:Y.status,error:Y.error}),Y.error?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(P,{variant:`secondary`,onClick:Y.retry,children:i===`zh`?`重试保存`:`Retry saving`}),(0,Q.jsx)(P,{variant:`ghost`,onClick:()=>{M().then(()=>r()).catch(()=>{})},children:i===`zh`?`重新加载(放弃未保存更改)`:`Reload and discard unsaved changes`})]}):null,e===`transcription`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Me,{zh:i===`zh`}),(0,Q.jsx)(ot,{managedModel:!0,v:a,apiKeyLabels:xe,stt:_e,models:x,sttProviders:ne,updateStt:q,updateSttFallback:J}),(0,Q.jsx)(at,{v:a,voice:y.voice,updateLanguageMode:ue}),(0,Q.jsxs)(`details`,{"data-voice-section":`input-processing`,className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[a.experience.inputProcessing,` · `,ye.mode===`off`?a.stt.refinementOff:ye.mode===`punctuation`?a.stt.refinementPunctuation:ye.mode===`light`?a.stt.refinementLight:a.setup.advanced]}),(0,Q.jsxs)(`label`,{className:`mt-4 block space-y-2 text-sm`,children:[(0,Q.jsx)(`span`,{children:a.stt.refinement}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.stt.refinementDesc}),(0,Q.jsxs)(d,{className:$(),value:ye.mode,onChange:e=>ae({mode:e.target.value}),children:[(0,Q.jsx)(f,{value:`off`,children:a.stt.refinementOff}),(0,Q.jsx)(f,{value:`punctuation`,children:a.stt.refinementPunctuation}),(0,Q.jsx)(f,{value:`light`,children:a.stt.refinementLight}),ye.mode===`custom`?(0,Q.jsx)(f,{value:`custom`,children:a.setup.advanced}):null]})]})]}),_e.provider===`xopc-cloud`?(0,Q.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:i===`zh`?`实时听写`:`Live dictation`}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(Oe,{modes:[`transcription.stream`],disabled:G||Y.status===`saving`,onPendingChange:g})})]}):null]}):e===`speech`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ct,{managedModel:!0,v:a,apiKeyLabels:xe,tts:ve,models:x,ttsProviders:te,updateTts:pe}),(0,Q.jsx)(it,{v:a,tts:ve,updateTts:pe})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Fe,{section:`listening`,v:a,form:y,pending:G||Y.status===`saving`||!!Y.error,onChange:he}),y.voice.realtime.defaultEngine===`omni`&&y.voice.realtime.omni?(0,Q.jsx)(Ve,{value:y.voice.realtime.omni,onChange:e=>fe({omni:e})}):null,(0,Q.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(12rem,18rem)] sm:items-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.experience.pace}),(0,Q.jsxs)(d,{className:$(),value:String(y.voice.realtime.silenceDurationMs),onChange:e=>fe({silenceDurationMs:Number(e.target.value)}),children:[(0,Q.jsx)(f,{value:`800`,children:a.experience.fast}),(0,Q.jsx)(f,{value:`1200`,children:a.experience.standard}),(0,Q.jsx)(f,{value:`2000`,children:a.experience.relaxed}),[800,1200,2e3].includes(y.voice.realtime.silenceDurationMs)?null:(0,Q.jsxs)(f,{value:String(y.voice.realtime.silenceDurationMs),children:[y.voice.realtime.silenceDurationMs,` ms`]})]})]})}),(0,Q.jsxs)(`label`,{className:`flex items-center justify-between text-sm`,children:[a.experience.captions,(0,Q.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":l,className:`ui-checkbox`,checked:l,onChange:e=>p(e.target.checked)})]}),y.voice.realtime.defaultEngine===`agent`&&_e.provider===`xopc-cloud`?(0,Q.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:i===`zh`?`语音助手输出`:`Assistant speech output`}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(Oe,{modes:[`speech.stream`],disabled:G||Y.status===`saving`,onPendingChange:g})})]}):null,(0,Q.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:i===`zh`?`麦克风、扬声器与诊断`:`Microphone, speakers and diagnostics`}),(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsx)(ke,{v:a}),(0,Q.jsx)(Fe,{section:`diagnostics`,v:a,form:y,pending:G||Y.status===`saving`||!!Y.error,onChange:he})]})]})]})]})}function it(e){let t=(0,X.c)(29),{v:n,tts:r,updateTts:i}=e,a;t[0]===n.setup.readout?a=t[1]:(a=(0,Q.jsx)(`span`,{className:`font-medium`,children:n.setup.readout}),t[0]=n.setup.readout,t[1]=a);let o=n.setup.readout,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=$(),t[2]=s):s=t[2];let c=r.enabled?r.trigger:`off`,l;t[3]===i?l=t[4]:(l=e=>i({enabled:e.target.value!==`off`,trigger:e.target.value}),t[3]=i,t[4]=l);let u;t[5]===n.tts.triggerOff?u=t[6]:(u=(0,Q.jsx)(f,{value:`off`,children:n.tts.triggerOff}),t[5]=n.tts.triggerOff,t[6]=u);let p;t[7]===n.tts.triggerInbound?p=t[8]:(p=(0,Q.jsx)(f,{value:`inbound`,children:n.tts.triggerInbound}),t[7]=n.tts.triggerInbound,t[8]=p);let m;t[9]===n.tts.triggerAlways?m=t[10]:(m=(0,Q.jsx)(f,{value:`always`,children:n.tts.triggerAlways}),t[9]=n.tts.triggerAlways,t[10]=m);let h;t[11]===n.tts.triggerTagged?h=t[12]:(h=(0,Q.jsx)(f,{value:`tagged`,children:n.tts.triggerTagged}),t[11]=n.tts.triggerTagged,t[12]=h);let g;t[13]!==c||t[14]!==l||t[15]!==u||t[16]!==p||t[17]!==m||t[18]!==h||t[19]!==n.setup.readout?(g=(0,Q.jsxs)(d,{"aria-label":o,className:s,value:c,onChange:l,children:[u,p,m,h]}),t[13]=c,t[14]=l,t[15]=u,t[16]=p,t[17]=m,t[18]=h,t[19]=n.setup.readout,t[20]=g):g=t[20];let _;t[21]!==a||t[22]!==g?(_=(0,Q.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[a,g]}),t[21]=a,t[22]=g,t[23]=_):_=t[23];let v;t[24]===n.setup.readoutHint?v=t[25]:(v=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.setup.readoutHint}),t[24]=n.setup.readoutHint,t[25]=v);let y;return t[26]!==_||t[27]!==v?(y=(0,Q.jsxs)(`section`,{className:`space-y-2 rounded-xl bg-surface-hover/20 p-4 sm:p-5`,children:[_,v]}),t[26]=_,t[27]=v,t[28]=y):y=t[28],y}function at(e){let t=(0,X.c)(22),{v:n,voice:r,updateLanguageMode:i}=e,a;t[0]===n.language.title?a=t[1]:(a=(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.language.title}),t[0]=n.language.title,t[1]=a);let o=r.languageMode===`auto`?n.language.autoDescription:n.language.manualDescription,s;t[2]===o?s=t[3]:(s=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:o}),t[2]=o,t[3]=s);let c;t[4]!==a||t[5]!==s?(c=(0,Q.jsxs)(`div`,{children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=$(),t[7]=l):l=t[7];let u;t[8]===i?u=t[9]:(u=e=>i(e.target.value),t[8]=i,t[9]=u);let p;t[10]===n.language.auto?p=t[11]:(p=(0,Q.jsx)(f,{value:`auto`,children:n.language.auto}),t[10]=n.language.auto,t[11]=p);let m;t[12]===n.language.manual?m=t[13]:(m=(0,Q.jsx)(f,{value:`manual`,children:n.language.manual}),t[12]=n.language.manual,t[13]=m);let h;t[14]!==u||t[15]!==p||t[16]!==m||t[17]!==r.languageMode?(h=(0,Q.jsxs)(d,{className:l,value:r.languageMode,onChange:u,children:[p,m]}),t[14]=u,t[15]=p,t[16]=m,t[17]=r.languageMode,t[18]=h):h=t[18];let g;return t[19]!==c||t[20]!==h?(g=(0,Q.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(12rem,18rem)] sm:items-center`,children:[c,h]})}),t[19]=c,t[20]=h,t[21]=g):g=t[21],g}function ot(e){let t=(0,X.c)(65),{v:n,apiKeyLabels:r,stt:i,models:a,sttProviders:o,updateStt:s,updateSttFallback:c,managedModel:l}=e,u=l!==void 0&&l,p;if(t[0]!==o){let e=new Set;p=[];for(let t of o)e.has(t.id)||(e.add(t.id),p.push(t));t[0]=o,t[1]=p}else p=t[1];let m=p,g,_,v,b;if(t[2]!==a||t[3]!==m||t[4]!==i.provider||t[5]!==i.providers){g=m.find(e=>e.id===i.provider);let e;t[10]!==i.provider||t[11]!==i.providers?(e=i.providers?.[i.provider]??{},t[10]=i.provider,t[11]=i.providers,t[12]=e):e=t[12],v=e,_=a?.stt?.[i.provider]?.length?a.stt[i.provider]:g?.models??[],b=g?.fields.find(st),t[2]=a,t[3]=m,t[4]=i.provider,t[5]=i.providers,t[6]=g,t[7]=_,t[8]=v,t[9]=b}else g=t[6],_=t[7],v=t[8],b=t[9];let x=b,S=typeof v.model==`string`?v.model:void 0,C=S??(typeof x?.defaultValue==`string`?x.defaultValue:_[0]?.id),w;t[13]!==i.provider||t[14]!==i.providers||t[15]!==s?(w=e=>{s({providers:{...i.providers??{},[i.provider]:{...i.providers?.[i.provider]??{},...e}}})},t[13]=i.provider,t[14]=i.providers,t[15]=s,t[16]=w):w=t[16];let T=w,E,D;t[17]!==S||t[18]!==C||t[19]!==u||t[20]!==x||t[21]!==T?(E=()=>{!u&&x&&C&&S!==C&&T({model:C})},D=[u,S,C,x,T],t[17]=S,t[18]=C,t[19]=u,t[20]=x,t[21]=T,t[22]=E,t[23]=D):(E=t[22],D=t[23]),(0,Z.useEffect)(E,D);let O;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(h,{"aria-hidden":`true`,className:`size-4 text-accent`,strokeWidth:1.75}),t[24]=O):O=t[24];let k;t[25]===n.stt.title?k=t[26]:(k=(0,Q.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[O,n.stt.title]}),t[25]=n.stt.title,t[26]=k);let A;t[27]===n.stt.enable?A=t[28]:(A=(0,Q.jsx)(`span`,{children:n.stt.enable}),t[27]=n.stt.enable,t[28]=A);let j;t[29]===s?j=t[30]:(j=e=>s({enabled:e.target.checked}),t[29]=s,t[30]=j);let M;t[31]!==i.enabled||t[32]!==j?(M=(0,Q.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":i.enabled,className:`ui-checkbox`,checked:i.enabled,onChange:j}),t[31]=i.enabled,t[32]=j,t[33]=M):M=t[33];let N;t[34]!==M||t[35]!==A?(N=(0,Q.jsxs)(`label`,{className:`flex min-h-10 items-center gap-2 text-xs text-fg-muted`,children:[A,M]}),t[34]=M,t[35]=A,t[36]=N):N=t[36];let P;t[37]!==N||t[38]!==k?(P=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[k,N]}),t[37]=N,t[38]=k,t[39]=P):P=t[39];let F;t[40]===n.stt.description?F=t[41]:(F=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.stt.description}),t[40]=n.stt.description,t[41]=F);let I;t[42]!==P||t[43]!==F?(I=(0,Q.jsxs)(`div`,{className:`mb-4`,children:[P,F]}),t[42]=P,t[43]=F,t[44]=I):I=t[44];let L;t[45]!==g?.fields||t[46]!==r||t[47]!==C||t[48]!==u||t[49]!==_||t[50]!==m||t[51]!==v||t[52]!==i.enabled||t[53]!==i.fallback?.enabled||t[54]!==i.provider||t[55]!==T||t[56]!==s||t[57]!==c||t[58]!==n?(L=i.enabled?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[u?null:(0,Q.jsxs)(`div`,{className:y(`flex flex-col gap-1.5`,We),children:[(0,Q.jsx)(gt,{children:n.stt.provider}),(0,Q.jsx)(d,{"aria-label":n.stt.provider,className:$(),value:i.provider,onChange:e=>s({provider:e.target.value}),children:m.map(e=>(0,Q.jsxs)(f,{value:e.id,children:[Je(e.id,n),e.configured?``:` *`]},e.id))})]}),(0,Q.jsx)(lt,{managedModel:u,kind:`stt`,providerId:i.provider,fields:g?.fields??[],providerSlice:v,models:_,currentModel:C,apiKeyLabels:r,onPatch:T})]}),i.provider===`alibaba`?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.setup.keyHint}):null,(0,Q.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:n.stt.fallback}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.stt.fallback}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.stt.fallbackDesc})]}),(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i.fallback?.enabled??!1,onChange:e=>c({enabled:e.target.checked})})]})]})]}):null,t[45]=g?.fields,t[46]=r,t[47]=C,t[48]=u,t[49]=_,t[50]=m,t[51]=v,t[52]=i.enabled,t[53]=i.fallback?.enabled,t[54]=i.provider,t[55]=T,t[56]=s,t[57]=c,t[58]=n,t[59]=L):L=t[59];let R;t[60]===L?R=t[61]:(R=(0,Q.jsx)(`div`,{className:`space-y-4`,children:L}),t[60]=L,t[61]=R);let z;return t[62]!==I||t[63]!==R?(z=(0,Q.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:[I,R]}),t[62]=I,t[63]=R,t[64]=z):z=t[64],z}function st(e){return e.key===`model`}function ct({v:e,apiKeyLabels:t,tts:n,models:r,ttsProviders:i,updateTts:a,managedModel:o=!1}){let[s,c]=(0,Z.useState)(e.tts.test.sampleText),[l,u]=(0,Z.useState)({status:`idle`}),p=(0,Z.useRef)(null),h=(0,Z.useRef)(null),b=(0,Z.useRef)(null),x=(0,Z.useCallback)(()=>{b.current&&(N(b.current),b.current.abort()),b.current=null,p.current?.pause(),p.current=null,h.current&&=(URL.revokeObjectURL(h.current),null)},[]),S=(0,Z.useMemo)(()=>{let e=new Set,t=[];for(let n of i)e.has(n.id)||(e.add(n.id),t.push(n));return t},[i]),C=S.find(e=>e.id===n.provider),w=n.providers?.[n.provider]??{},T=r?.tts?.[n.provider]?.length?r.tts[n.provider]:C?.models??[],E=C?.fields.find(e=>e.key===`model`),D=C?.fields.find(e=>e.key===`voice`),O=typeof w.model==`string`?w.model:void 0,A=O??(typeof E?.defaultValue==`string`?E.defaultValue:T[0]?.id),j=T.find(e=>e.id===A),F=r?.ttsVoices?.[n.provider]?.length?r.ttsVoices[n.provider]:C?.voices??[],{data:I=[]}=k(A?`voice:tts:${n.provider}:${A}`:null,()=>Y(n.provider,A??``),{revalidateOnFocus:!1}),L=I.length>0?I:F,R=typeof w.voice==`string`?w.voice:void 0,z=R??L.find(e=>e.id===j?.tts?.defaultVoice)?.id??(typeof D?.defaultValue==`string`?D.defaultValue:L[0]?.id),B=(C?.fields??[]).filter(e=>(e.key!==`speed`||j?.tts?.speed!==!1)&&(e.key!==`instructions`||j?.tts?.instructions!==!1)),V=(0,Z.useCallback)(e=>{a({providers:{...n.providers??{},[n.provider]:{...n.providers?.[n.provider]??{},...e}}})},[n.provider,n.providers,a]);(0,Z.useEffect)(()=>{if(o)return;let e={};E&&A&&O!==A&&(e.model=A),D&&z&&R!==z&&(e.voice=z),Object.keys(e).length>0&&V(e)},[o,O,R,A,z,E,V,D]),(0,Z.useEffect)(()=>()=>x(),[x]);let H=(0,Z.useCallback)(e=>{a({provider:e}),u({status:`idle`})},[a]),U=(0,Z.useCallback)(async()=>{let t=s.trim();if(!t){u({status:`error`,message:e.tts.test.emptyText});return}x();let r=new AbortController;b.current=r,M(r,()=>{x(),u({status:`idle`})}),u({status:`loading`});try{let i=await fe({text:t,provider:n.provider,providerConfig:w,...A?{model:A}:{},...z?{voice:z}:{}},r.signal);if(r.signal.aborted)return;let a=qe(i.audio,i.mimeType);h.current=a;let o=new Audio(a);p.current=o;let s=[i.provider,i.format,i.latencyMs===void 0?void 0:`${i.latencyMs}ms`,Ke(i.audioSize)].filter(Boolean).join(` · `);o.addEventListener(`ended`,()=>{N(r),r.signal.aborted||u({status:`done`,summary:s})},{once:!0}),o.addEventListener(`error`,()=>{N(r),r.signal.aborted||u({status:`error`,message:e.tts.test.playFailed})},{once:!0}),await o.play(),r.signal.aborted||u({status:`playing`,summary:s})}catch(e){if(r.signal.aborted)return;x(),u({status:`error`,message:e instanceof Error?e.message:String(e)})}},[A,z,w,x,s,n.provider,e.tts.test.emptyText,e.tts.test.playFailed]);return(0,Q.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`mb-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(v,{className:`size-4 text-accent`,strokeWidth:1.75}),e.tts.title]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.tts.description})]}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:o?null:(0,Q.jsxs)(`div`,{className:y(`flex flex-col gap-1.5`,We),children:[(0,Q.jsx)(gt,{children:e.tts.provider}),(0,Q.jsx)(d,{"aria-label":e.tts.provider,className:$(),value:n.provider,onChange:e=>H(e.target.value),children:S.map(t=>(0,Q.jsx)(f,{value:t.id,children:Ye(t.id,e)},t.id))}),(0,Q.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[C?.configured?e.tts.configured:C?.diagnostics.requiresApiKey?`${e.tts.needsKey} · ${C.diagnostics.envKeys?.join(`, `)??e.stt.apiKey}`:e.tts.noKeyNeeded,` · `,C?.description??Xe(n.provider,e)]})]})}),(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:(0,Q.jsx)(lt,{managedModel:o,kind:`tts`,providerId:n.provider,fields:B,providerSlice:w,models:T,voices:L,currentModel:A,currentVoice:z,apiKeyLabels:t,onPatch:V,resetVoiceOnModelChange:!0})}),(0,Q.jsxs)(`details`,{className:`rounded-xl bg-surface-panel/80 p-3`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:e.tts.test.title}),(0,Q.jsxs)(`div`,{className:`mt-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.tts.test.description})}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,Q.jsxs)(P,{type:`button`,variant:`primary`,onClick:()=>void U(),disabled:l.status===`loading`,className:`h-9`,children:[l.status===`loading`?(0,Q.jsx)(m,{className:`size-4 animate-spin`}):(0,Q.jsx)(g,{className:`size-4`}),l.status===`loading`?e.tts.test.generating:e.tts.test.play]}),(0,Q.jsxs)(P,{type:`button`,variant:`secondary`,onClick:()=>{x(),u(e=>e.status===`playing`?{status:`done`,summary:e.summary}:{status:`idle`})},disabled:l.status!==`playing`,className:`h-9`,children:[(0,Q.jsx)(_,{className:`size-4`}),e.tts.test.stop]})]})]}),(0,Q.jsxs)(`details`,{className:`mt-3`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:e.setup.sampleText}),(0,Q.jsx)(`textarea`,{className:y(Ge(),`mt-3 min-h-20 resize-y`),value:s,onChange:e=>c(e.target.value),maxLength:1e3})]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2 text-xs`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-subtle`,children:[s.length,`/1000`]}),l.status===`playing`||l.status===`done`?(0,Q.jsxs)(`span`,{className:`text-emerald-700 dark:text-emerald-200`,children:[l.status===`playing`?e.tts.test.playing:e.tts.test.ready,` · `,l.summary]}):null,l.status===`error`?(0,Q.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:l.message}):null]})]})]})]})})]})}function lt(e){let t=(0,X.c)(48),{kind:n,providerId:r,fields:i,providerSlice:a,models:o,voices:s,currentModel:l,currentVoice:p,apiKeyLabels:m,onPatch:h,resetVoiceOnModelChange:g,managedModel:_}=e,v;t[0]===s?v=t[1]:(v=s===void 0?[]:s,t[0]=s,t[1]=v);let b=v,x=g!==void 0&&g,S=_!==void 0&&_,C=c(pt),w;t[2]===C?w=t[3]:(w=u(C),t[2]=C,t[3]=w);let T=w.voiceSettings,E=S,D=ft,O=dt,k,A,j;if(t[4]!==m||t[5]!==l||t[6]!==p||t[7]!==i||t[8]!==n||t[9]!==C||t[10]!==S||t[11]!==o||t[12]!==h||t[13]!==r||t[14]!==a||t[15]!==x||t[16]!==E||t[17]!==T||t[18]!==b){let e;t[22]===E?e=t[23]:(e=e=>!E||e.key!==`model`&&!O(e),t[22]=E,t[23]=e);let s=i.filter(e),c;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>!D(e),t[24]=c):c=t[24];let u=s.filter(c),g;t[25]!==m||t[26]!==l||t[27]!==p||t[28]!==n||t[29]!==C||t[30]!==S||t[31]!==o||t[32]!==h||t[33]!==r||t[34]!==a||t[35]!==x||t[36]!==T||t[37]!==b?(g=e=>e.map(e=>S&&e.key===`model`?null:e.key===`apiKey`?(0,Q.jsxs)(`div`,{className:y(`flex flex-col gap-1.5`,We),children:[(0,Q.jsx)(gt,{htmlFor:`voice-${n}-${r}-api-key`,children:T.stt.apiKey}),(0,Q.jsx)(xe,{kind:n,providerId:r,fieldId:`voice-${n}-${r}-api-key`,value:typeof a.apiKey==`string`?a.apiKey:``,onChange:e=>h({apiKey:e}),labels:m,placeholder:e.placeholder}),e.description?(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:e.description}):null]},e.key):e.key===`model`&&o.length>0?(0,Q.jsxs)(`div`,{className:y(`flex flex-col gap-1.5`,We),children:[(0,Q.jsx)(gt,{htmlFor:`voice-${n}-${r}-model`,children:T.stt.model}),(0,Q.jsx)(d,{id:`voice-${n}-${r}-model`,className:$(),value:l??``,onChange:e=>h({model:e.target.value,...x?{voice:void 0}:{}}),children:[...o].sort(K).map(ut)})]},e.key):e.key===`voice`&&b.length>0?(0,Q.jsxs)(`div`,{className:y(`flex flex-col gap-1.5`,We),children:[(0,Q.jsx)(gt,{htmlFor:`voice-${n}-${r}-voice`,children:T.tts.voice}),(0,Q.jsxs)(d,{id:`voice-${n}-${r}-voice`,className:$(),value:p??``,onChange:e=>h({voice:e.target.value}),children:[p&&!b.some(e=>e.id===p)?(0,Q.jsxs)(f,{value:p,children:[p,` · unavailable`]}):null,b.map(e=>(0,Q.jsxs)(f,{value:e.id,children:[re(e,C),e.gender?` · ${e.gender===`female`?`女声`:`男声`}`:``,e.style?` · ${e.style}`:``]},e.id))]}),b.find(e=>e.id===p)?.description?(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:b.find(e=>e.id===p)?.description}):null]},e.key):(0,Q.jsx)(mt,{fieldId:`voice-${n}-${r}-${e.key}`,field:e,value:Qe(a,e),onChange:t=>h({[e.key]:t}),className:e.type===`textarea`?`sm:col-span-2`:We},e.key)),t[25]=m,t[26]=l,t[27]=p,t[28]=n,t[29]=C,t[30]=S,t[31]=o,t[32]=h,t[33]=r,t[34]=a,t[35]=x,t[36]=T,t[37]=b,t[38]=g):g=t[38];let _=g;t[39]!==i||t[40]!==n||t[41]!==C||t[42]!==E?(k=E&&i.some(O)?(0,Q.jsx)(je,{className:`text-sm text-accent-fg hover:underline`,to:`/settings/capabilities/models?tab=services&configure=${n===`stt`?`transcription`:`speech`}`,children:C===`zh`?`管理服务连接`:`Manage service connection`}):null,t[39]=i,t[40]=n,t[41]=C,t[42]=E,t[43]=k):k=t[43],A=_(s.filter(D)),j=u.length?(0,Q.jsxs)(`details`,{className:`rounded-lg border border-edge p-3 sm:col-span-2`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:T.experience.providerOptions}),(0,Q.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:_(u)})]}):null,t[4]=m,t[5]=l,t[6]=p,t[7]=i,t[8]=n,t[9]=C,t[10]=S,t[11]=o,t[12]=h,t[13]=r,t[14]=a,t[15]=x,t[16]=E,t[17]=T,t[18]=b,t[19]=k,t[20]=A,t[21]=j}else k=t[19],A=t[20],j=t[21];let M;return t[44]!==k||t[45]!==A||t[46]!==j?(M=(0,Q.jsxs)(Q.Fragment,{children:[k,A,j]}),t[44]=k,t[45]=A,t[46]=j,t[47]=M):M=t[47],M}function ut(e){return(0,Q.jsx)(f,{value:e.id,children:e.name},e.id)}function dt(e){return e.secret||e.type===`password`||[`apiKey`,`baseUrl`,`region`,`groupId`].includes(e.key)}function ft(e){return e.required||[`apiKey`,`model`,`voice`].includes(e.key)}function pt(e){return e.language}function mt(e){let t=(0,X.c)(37),{fieldId:n,field:r,value:i,onChange:a,className:o}=e,s=n??`voice-schema-field-${r.key}`,c=r.description;if(r.type===`boolean`){let e;t[0]===o?e=t[1]:(e=y(`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,o),t[0]=o,t[1]=e);let n;t[2]===r.label?n=t[3]:(n=(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.label}),t[2]=r.label,t[3]=n);let s;t[4]===c?s=t[5]:(s=c?(0,Q.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:c}):null,t[4]=c,t[5]=s);let l;t[6]!==n||t[7]!==s?(l=(0,Q.jsxs)(`span`,{children:[n,s]}),t[6]=n,t[7]=s,t[8]=l):l=t[8];let u=!!i,d;t[9]!==r||t[10]!==a?(d=e=>a($e(r,e.target.checked)),t[9]=r,t[10]=a,t[11]=d):d=t[11];let f;t[12]!==u||t[13]!==d?(f=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:u,onChange:d}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==e||t[16]!==l||t[17]!==f?(p=(0,Q.jsxs)(`label`,{className:e,children:[l,f]}),t[15]=e,t[16]=l,t[17]=f,t[18]=p):p=t[18],p}let l=typeof i==`boolean`?``:String(i),u;t[19]===o?u=t[20]:(u=y(`flex flex-col gap-1.5`,o),t[19]=o,t[20]=u);let f;t[21]!==r.label||t[22]!==s?(f=(0,Q.jsx)(gt,{htmlFor:s,children:r.label}),t[21]=r.label,t[22]=s,t[23]=f):f=t[23];let m;t[24]!==o||t[25]!==r||t[26]!==l||t[27]!==s||t[28]!==a?(m=r.type===`select`?(0,Q.jsx)(d,{id:s,className:$(),value:l,required:r.required,onChange:e=>a($e(r,e.target.value)),children:(r.options??[]).map(ht)}):r.type===`textarea`?(0,Q.jsx)(`textarea`,{id:s,className:y(Ge(),`min-h-24 resize-y`),value:l,required:r.required,placeholder:r.placeholder,onChange:e=>a($e(r,e.target.value))}):r.type===`password`?(0,Q.jsx)(p,{id:s,className:o,value:l,onChange:e=>a($e(r,e)),placeholder:r.placeholder,labels:G}):r.type===`number`?(0,Q.jsx)(ae,{id:s,className:Ge(),autoComplete:r.secret?`new-password`:`off`,spellCheck:!1,value:l,required:r.required,allowEmpty:!r.required,placeholder:r.placeholder,min:r.min,max:r.max,step:r.step,onChange:e=>a($e(r,e.target.value))}):(0,Q.jsx)(`input`,{id:s,className:Ge(),type:`text`,autoComplete:r.secret?`new-password`:`off`,spellCheck:!1,value:l,required:r.required,placeholder:r.placeholder,min:r.min,max:r.max,step:r.step,onChange:e=>a($e(r,e.target.value))}),t[24]=o,t[25]=r,t[26]=l,t[27]=s,t[28]=a,t[29]=m):m=t[29];let h;t[30]===c?h=t[31]:(h=c?(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:c}):null,t[30]=c,t[31]=h);let g;return t[32]!==u||t[33]!==f||t[34]!==m||t[35]!==h?(g=(0,Q.jsxs)(`div`,{className:u,children:[f,m,h]}),t[32]=u,t[33]=f,t[34]=m,t[35]=h,t[36]=g):g=t[36],g}function ht(e){return(0,Q.jsx)(f,{value:e.id,children:e.name},e.id)}function gt(e){let t=(0,X.c)(3),{children:n,htmlFor:r}=e,i;return t[0]!==n||t[1]!==r?(i=r?(0,Q.jsx)(`label`,{htmlFor:r,className:`text-sm font-medium text-fg`,children:n}):(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}export{Ae as n,tt as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,t as a}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as o,l as s,n as c,o as l}from"./locale-store-Dy0B0XDJ.js";import{t as u}from"./messages-Bj6DCoic.js";import{n as d,r as f}from"./popover-select-hRG1EzAY.js";import{t as p}from"./secret-input-DsjfQmDn.js";import{t as m}from"./loader-circle-CifKLtgG.js";import{t as h}from"./mic-CuUb7zc-.js";import{t as g}from"./play-kxZvpBg8.js";import{t as _}from"./square-DMK_fB-3.js";import{t as v}from"./volume-2-BSJhAY97.js";import{t as y}from"./cn-0WouolD0.js";import{t as b}from"./skeleton-DzdOeGYz.js";import{a as x,c as S,i as C,m as w,n as T,p as E,u as D}from"./schemas-CCWMleym.js";import{n as O}from"./voice-CUfqdnlR.js";import{i as k}from"./vendor-swr-CdRzEUwF.js";import{n as A,r as j}from"./gateway-config-swr-DxelrRtx.js";import{n as M,s as N}from"./playback-coordinator-CWHIf0wr.js";import{t as P}from"./button-C5tRaJxt.js";import{t as F}from"./open-capability-settings-DQsmJxI7.js";import{a as I,d as L,f as R,i as z,o as B,p as V,t as H,u as U}from"./use-realtime-voice-D9k997EW.js";import{t as ee}from"./voice-call-context-BM2A4bLz.js";import{a as te,o as ne,s as W}from"./form-field-width-DJw_jULe.js";import{t as G}from"./secret-input-labels-B5Jl5HqK.js";import{n as K}from"./model-sort-_Tz8s_4N.js";import{r as re}from"./model-selector-8FTrQQ2N.js";import{t as ie}from"./settings-loading-skeleton-CAoOV17i.js";import{a as q,i as J}from"./capability-navigation-CZbCI5C2.js";import{t as ae}from"./number-input-El7Szeln.js";import{n as oe,t as se}from"./use-autosave-D7zZrcsj.js";import{a as ce,c as le,d as ue,f as de,g as fe,h as pe,i as Y,l as me,n as he,o as ge,p as _e,r as ve,t as ye,u as be}from"./voice-config-api-DZbcg7qD.js";import{t as xe}from"./voice-api-key-field-CVi3dBKx.js";var Se=E({"zh-CN":w().min(1).optional(),en:w().min(1).optional()}),Ce=T([`transcription`,`transcription.stream`,`speech`,`speech.stream`,`conversation`]),we=E({protocolVersion:S(1),serviceVersion:D().int().positive(),modes:C(Ce),transport:S(`websocket-pcm`),inputFormat:E({encoding:S(`pcm_s16le`),sampleRate:S(16e3),channels:S(1)}),outputFormat:E({encoding:S(`pcm_s16le`),sampleRate:S(24e3),channels:S(1)}),turnDetection:C(S(`server_vad`)),bargeIn:x(),tools:x(),resumable:S(!1),voices:C(E({id:w().min(1),name:w(),displayNames:Se.optional(),languages:C(w()),gender:T([`female`,`male`]).optional(),style:w().optional(),description:w().optional(),modes:C(Ce).optional()})),defaultVoice:w().min(1).optional(),limits:E({maxFrameBytes:D().int().positive().max(65536),maxSessionSeconds:D().int().positive()})});function Te(e,t){return e.modes===void 0||e.modes.includes(t)}var Ee=E({mode:Ce,model:w().min(1).max(200),voice:w().min(1).max(200).optional()}),De=E({revision:w().min(1),catalogVersion:w().nullable(),selections:C(Ee),models:C(E({id:w(),name:w(),displayNames:Se.optional(),voice:we}))}),X=n(),Z=e(t(),1),Q=r();function Oe({disabled:e=!1,modes:t,onPendingChange:n}){let r=c(e=>e.language),i=r===`zh`,[a,s]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>(n?.(a),()=>n?.(!1)),[a,n]);let[u,p]=(0,Z.useState)(``),{data:m,mutate:h,error:g}=k(o(`/api/voice/catalog`),async e=>{let t=await l(e);return De.parse(t.payload)}),_=i?{transcription:`录音转文字`,"transcription.stream":`实时听写 / 语音助手输入`,speech:`消息朗读`,"speech.stream":`语音助手输出`,conversation:`自然语音对话`}:{transcription:`Recorded transcription`,"transcription.stream":`Live dictation / assistant input`,speech:`Message readout`,"speech.stream":`Assistant speech`,conversation:`Natural conversation`},v=async e=>{if(m){s(!0),p(``);try{let t=await l(o(e?`/api/voice/selection`:`/api/voice/catalog/refresh`),{method:e?`PUT`:`POST`,...e?{body:JSON.stringify({revision:m.revision,selection:e})}:{}});await h(De.parse(t.payload),!1),await A()}catch(e){p(e instanceof Error?e.message:String(e)),await h()}finally{s(!1)}}};return(0,Q.jsxs)(`section`,{className:`space-y-4 rounded-xl bg-surface-hover/20 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h3`,{className:`font-medium`,children:i?`XOPC 托管语音模型`:`XOPC managed voice models`}),(0,Q.jsx)(P,{variant:`secondary`,disabled:a||e||!m,onClick:()=>void v(),children:i?`刷新目录`:`Refresh catalog`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`修改在下次调用生效。各设备共用此 Gateway 的配置。`:`Changes apply to the next call and are shared across devices.`}),u||g?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:u||String(g)}):null,m?(0,Q.jsx)(Q.Fragment,{children:t.map(t=>{let n=m.selections.find(e=>e.mode===t),o=m.models.filter(e=>e.voice.modes.includes(t)).sort(K),s=o.find(e=>e.id===n?.model),c=s?.voice.voices.filter(e=>Te(e,t))??[],l=n?.voice??c.find(e=>e.id===s?.voice.defaultVoice)?.id??c[0]?.id??``;return(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[(0,Q.jsx)(`span`,{children:_[t]}),(0,Q.jsxs)(d,{className:`w-full`,value:n?.model??``,disabled:a||e||!o.length,onChange:e=>void v({mode:t,model:e.target.value}),children:[(0,Q.jsx)(f,{value:``,disabled:!0,children:i?`选择模型`:`Choose model`}),n&&!s?(0,Q.jsxs)(f,{value:n.model,disabled:!0,children:[n.model,` · `,i?`不可用`:`Unavailable`]}):null,o.map(e=>(0,Q.jsx)(f,{value:e.id,children:re(e,r)},e.id))]}),o.length?null:(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i?`暂无可用模型`:`No available model`})]}),s&&c.length>0?(0,Q.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[(0,Q.jsx)(`span`,{children:i?`音色`:`Voice`}),(0,Q.jsxs)(d,{className:`w-full`,value:l,disabled:a||e,onChange:e=>void v({mode:t,model:s.id,voice:e.target.value}),children:[n?.voice&&!c.some(e=>e.id===n.voice)?(0,Q.jsxs)(f,{value:n.voice,disabled:!0,children:[n.voice,` · `,i?`当前场景不可用`:`Unavailable for this mode`]}):null,c.map(e=>(0,Q.jsxs)(f,{value:e.id,children:[re(e,r),e.gender?` · ${i?e.gender===`female`?`女声`:`男声`:e.gender}`:``,e.style?` · ${e.style}`:``]},e.id))]}),c.find(e=>e.id===l)?.description?(0,Q.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:c.find(e=>e.id===l)?.description}):null]}):null]},t)})}):(0,Q.jsx)(b,{className:`h-48 w-full`})]})}function ke({v:e}){let t=R(e=>e.microphoneId),n=R(e=>e.setMicrophoneId),[r,i]=(0,Z.useState)([]),[a,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(!1),l=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{l.current=!0;let e=()=>{navigator.mediaDevices?.enumerateDevices().then(e=>{l.current&&i(e.filter(e=>e.kind===`audioinput`))}).catch(()=>{})};return e(),navigator.mediaDevices?.addEventListener(`devicechange`,e),()=>{l.current=!1,navigator.mediaDevices?.removeEventListener(`devicechange`,e)}},[]);let u=async()=>{c(!0),o(``);try{(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop());let e=await navigator.mediaDevices.enumerateDevices();l.current&&i(e.filter(e=>e.kind===`audioinput`))}catch(e){l.current&&o(e instanceof Error?e.message:String(e))}finally{l.current&&c(!1)}};return(0,Q.jsxs)(`section`,{className:`space-y-4 rounded-xl bg-surface-hover/20 p-4`,children:[(0,Q.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,Q.jsx)(`span`,{children:e.experience.microphone}),(0,Q.jsxs)(d,{value:t,onChange:e=>n(e.target.value),children:[(0,Q.jsx)(f,{value:``,children:e.experience.systemDevice}),t&&!r.some(e=>e.deviceId===t)?(0,Q.jsx)(f,{value:t,children:e.experience.unavailable}):null,r.filter(e=>e.deviceId&&e.deviceId!=="default").map((t,n)=>(0,Q.jsx)(f,{value:t.deviceId,children:t.label||`${e.experience.microphone} ${n+1}`},t.deviceId))]})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.experience.deviceHint}),(0,Q.jsx)(P,{variant:`secondary`,disabled:s,onClick:()=>void u(),children:e.experience.refreshDevices}),a?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:a}):null]})}var Ae=(0,Z.createContext)(null);function je(e){let t=(0,X.c)(18),n,r;t[0]===e?(n=t[1],r=t[2]):({to:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let[o]=i(),s=(0,Z.useContext)(Ae),c,l;t[3]===r?(c=t[4],l=t[5]):(c=new URLSearchParams(r.split(`?`)[1]??``),l=J(c.get(`configure`)),t[3]=r,t[4]=c,t[5]=l);let u=l,d;t[6]!==s||t[7]!==n||t[8]!==c||t[9]!==u?(d=e=>{n.onClick?.(e),!e.defaultPrevented&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&e.button===0&&s&&u&&c.get(`tab`)===`services`&&(e.preventDefault(),s(u))},t[6]=s,t[7]=n,t[8]=c,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==o||t[12]!==r?(f=q(r,o),t[11]=o,t[12]=r,t[13]=f):f=t[13];let p;return t[14]!==n||t[15]!==d||t[16]!==f?(p=(0,Q.jsx)(a,{...n,onClick:d,to:f}),t[14]=n,t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function Me(e){let t=(0,X.c)(19),{zh:n}=e,{data:r,error:i,mutate:a}=k(`voice-dictation-route`,Ne),o,s;t[0]===a?(o=t[1],s=t[2]):(o=()=>{let e=()=>{a()};return window.addEventListener(`voice-config-changed`,e),window.addEventListener(`config-reload`,e),()=>{window.removeEventListener(`voice-config-changed`,e),window.removeEventListener(`config-reload`,e)}},s=[a],t[0]=a,t[1]=o,t[2]=s),(0,Z.useEffect)(o,s);let c=n?`同时用于聊天听写`:`Also used for chat dictation`,l;t[3]===c?l=t[4]:(l=(0,Q.jsx)(`h2`,{className:`font-medium text-fg`,children:c}),t[3]=c,t[4]=l);let u=n?`默认与录音识别共用模型。已有的独立听写设置会保留。`:`Dictation shares this recognition model. Existing separate dictation settings are preserved.`,d;t[5]===u?d=t[6]:(d=(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:u}),t[5]=u,t[6]=d);let f;t[7]!==r||t[8]!==i||t[9]!==n?(f=!r&&!i?(0,Q.jsx)(b,{className:`h-5 w-64 max-w-full`}):(0,Q.jsx)(`p`,{role:i?`alert`:`status`,className:`text-fg-muted`,children:i?n?`暂时无法读取听写状态。`:`Dictation status could not be loaded.`:r?.mode===`recorded`?n?`当前使用 ${r.provider},点击完成后转为文字。`:`Using ${r.provider}. Choose Finish to transcribe.`:r?.mode===`streaming`?n?`当前使用流式识别${r.provider?` · ${r.provider}`:``}。`:`Using streaming recognition${r.provider?` · ${r.provider}`:``}.`:n?`听写未就绪,请检查识别模型或已有的流式配置。`:`Check the recognition model or existing streaming configuration.`}),t[7]=r,t[8]=i,t[9]=n,t[10]=f):f=t[10];let p;t[11]!==r?.mode||t[12]!==n?(p=r?.mode===`recorded`?null:(0,Q.jsx)(je,{className:`inline-block text-accent-fg hover:underline`,to:`/settings/capabilities/models?tab=services&configure=transcription`,children:n?`管理识别服务`:`Manage recognition services`}),t[11]=r?.mode,t[12]=n,t[13]=p):p=t[13];let m;return t[14]!==l||t[15]!==d||t[16]!==f||t[17]!==p?(m=(0,Q.jsxs)(`section`,{className:`space-y-2 rounded-xl border border-edge p-4 text-sm`,children:[l,d,f,p]}),t[14]=l,t[15]=d,t[16]=f,t[17]=p,t[18]=m):m=t[18],m}function Ne(){return z(AbortSignal.timeout(15e3))}function Pe({v:e,canListen:t,canSpeak:n,disabled:r,onVerified:i}){let a=e.setup,o=(0,Z.useContext)(ee)?.active??!1,[s,c]=(0,Z.useState)(`idle`),[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(``),p=(0,Z.useRef)(`idle`),v=(0,Z.useRef)(null),y=(0,Z.useRef)(!1),b=e=>{p.current=e,c(e)},x=()=>{v.current?.(),v.current=null};(0,Z.useEffect)(()=>()=>v.current?.(),[]);async function S(e){x(),i?.({input:!1,output:!1}),y.current=!1,u(``),f(``),b(e?`connecting`:`playing`);let t=new AbortController,r,o,s,c,l=()=>{o?.cancel(),r?.getTracks().forEach(e=>e.stop()),s?.stop(`surface_closed`)},d=window.setTimeout(()=>m(a.timeout),6e4);v.current=()=>{t.abort(),window.clearTimeout(d),l(),c?.close()};function m(e){t.signal.aborted||(b(`error`),f(e),x())}async function h(){b(`playing`),l();try{let e=await ue(t.signal);if(t.signal.aborted)return;c?.enqueue(e,()=>{t.signal.aborted||(window.clearTimeout(d),b(`confirm`))})}catch(e){m(e instanceof Error?e.message:a.testFailed)}}try{if(n&&(c=new U,await c.start(),t.signal.throwIfAborted()),!e){await h();return}let d=window.electronAPI?.system;if(d){let e=await d.requestMicrophone();if(t.signal.throwIfAborted(),e.status===`denied`)throw Error(a.microphoneDenied)}if(r=await navigator.mediaDevices.getUserMedia({audio:V()}),t.signal.aborted){l();return}if(s=await L.connect({purpose:`dictation`,signal:t.signal,onEvent:e=>{t.signal.aborted||(e.type===`session.error`&&m(a.testFailed),p.current===`listening`&&(e.type===`input.transcript.delta`&&u(e.payload.text),e.type===`input.transcript.final`&&e.payload.text.trim()&&(u(e.payload.text.trim()),y.current=!0,n?h():(b(`passed`),i?.({input:!0,output:!1}),x()))))},onClose:()=>{(p.current===`listening`||p.current===`connecting`)&&m(a.testFailed)}}),t.signal.aborted){l();return}let f;if(o=await I.start(r,{onSamples:e=>{f&&!t.signal.aborted&&s?.sendAudio(f.push(e))}}),t.signal.aborted){l();return}f=new B(o.sampleRate,s.session.inputFormat.sampleRate),b(`listening`)}catch(e){if(t.signal.aborted){l();return}m(e instanceof Error?e.message:a.testFailed)}}let C=s===`connecting`||s===`listening`||s===`playing`;return(0,Q.jsxs)(`div`,{className:`space-y-3 rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(P,{type:`button`,variant:`primary`,disabled:o||r||!t||C,onClick:()=>void S(!0),children:[C?(0,Q.jsx)(m,{className:`size-4 animate-spin`}):(0,Q.jsx)(h,{className:`size-4`}),n?a.test:a.testInput]}),(0,Q.jsxs)(P,{type:`button`,variant:`secondary`,disabled:o||r||!n||C,onClick:()=>void S(!1),children:[(0,Q.jsx)(g,{className:`size-4`}),e.tts.test.play]}),C?(0,Q.jsxs)(P,{type:`button`,variant:`ghost`,onClick:()=>{x(),b(`idle`)},children:[(0,Q.jsx)(_,{className:`size-4`}),e.tts.test.stop]}):null]}),(0,Q.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`space-y-2 text-xs text-fg-muted`,children:[s===`idle`?(0,Q.jsx)(`p`,{children:o?e.experience.endCallBeforeTest:r?a.saveBeforeTest:a.microphoneHint}):null,s===`connecting`?(0,Q.jsx)(`p`,{children:a.connecting}):null,s===`listening`?(0,Q.jsx)(`p`,{children:a.speakNow}):null,l?(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-base p-3 text-sm text-fg`,children:l}):null,s===`playing`?(0,Q.jsx)(`p`,{children:a.playing}):null,s===`confirm`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`span`,{children:a.heardQuestion}),(0,Q.jsx)(P,{type:`button`,variant:`secondary`,onClick:()=>{x(),i?.({input:y.current,output:!0}),b(`passed`)},children:a.heard}),(0,Q.jsx)(P,{type:`button`,variant:`ghost`,onClick:()=>{x(),b(`error`),f(a.notHeard)},children:a.notHeardButton})]}):null,s===`passed`?(0,Q.jsx)(`p`,{children:y.current?n?a.passed:a.inputPassed:a.outputPassed}):null,s===`error`?(0,Q.jsx)(`p`,{role:`alert`,className:`text-red-600 dark:text-red-400`,children:d}):null]})]})}function Fe(e){let t=(0,X.c)(78),{section:n,v:r,form:i,pending:a,onChange:s}=e,l=c(Be),u=r.setup,p;t[0]===i?p=t[1]:(p=JSON.stringify(i),t[0]=i,t[1]=p);let m=p,h;t[2]===m?h=t[3]:(h={signature:m,input:!1,output:!1},t[2]=m,t[3]=h);let[g,_]=(0,Z.useState)(h);g.signature!==m&&_({signature:m,input:!1,output:!1});let v;t[4]!==a||t[5]!==m?(v=a?null:[`voice-realtime-status`,m],t[4]=a,t[5]=m,t[6]=v):v=t[6];let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y={revalidateOnFocus:!0},t[7]=y):y=t[7];let{data:x,error:S,isLoading:C}=k(v,ve,y),w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=o(`/api/voice/catalog`),t[8]=w):w=t[8];let{data:T}=k(w,ze),E=i.voice.realtime,D=E.tts,O=D?.provider??x?.tts?.provider,A=x?.tts?.model,j;t[9]!==A||t[10]!==O?(j=O&&A?[`realtime-voices`,O,A]:null,t[9]=A,t[10]=O,t[11]=j):j=t[11];let M;t[12]!==A||t[13]!==O?(M=()=>Y(O,A,`realtime`),t[12]=A,t[13]=O,t[14]=M):M=t[14];let N;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(N={revalidateOnFocus:!1},t[15]=N):N=t[15];let{data:P}=k(j,M,N),F;t[16]===P?F=t[17]:(F=P===void 0?[]:P,t[16]=P,t[17]=F);let I=F,L=I,R;t[18]===I?R=t[19]:(R=I.filter(Re),t[18]=I,t[19]=R);let z=R,B=E.defaultEngine===`omni`,V=B?E.omni?.voice??``:D?.voice??``,H;t[20]!==T?.models||t[21]!==B||t[22]!==z||t[23]!==E.omni||t[24]!==L?(H=B&&E.omni?.provider===`qwen-token-plan-cn`?[{id:E.omni.voice,name:E.omni.voice}]:B?E.omni?.provider===`xopc-cloud`?T?.models.find(e=>e.id===E.omni?.model)?.voice.voices.filter(Le)??[]:z.length?z:[`Cherry`,`Ethan`,`Serena`,`Chelsie`].map(Ie):L,t[20]=T?.models,t[21]=B,t[22]=z,t[23]=E.omni,t[24]=L,t[25]=H):H=t[25];let U=H,ee=!!(x?.enabled&&x.stt),te=!!(x?.enabled&&x.tts),W;t[26]!==i||t[27]!==s||t[28]!==E?(W=e=>s({...i,voice:{...i.voice,realtime:{...E,...e}}}),t[26]=i,t[27]=s,t[28]=E,t[29]=W):W=t[29];let G=W,K;t[30]!==a||t[31]!==E.enabled||t[32]!==u.disabled||t[33]!==u.needsSetup||t[34]!==u.pending||t[35]!==u.unverified||t[36]!==u.verified||t[37]!==m||t[38]!==g.signature?(K=(e,t)=>E.enabled?a?u.pending:e?t&&g.signature===m?u.verified:u.unverified:u.needsSetup:u.disabled,t[30]=a,t[31]=E.enabled,t[32]=u.disabled,t[33]=u.needsSetup,t[34]=u.pending,t[35]=u.unverified,t[36]=u.verified,t[37]=m,t[38]=g.signature,t[39]=K):K=t[39];let ie=K,q;t[40]!==V||t[41]!==l||t[42]!==B||t[43]!==O||t[44]!==E.bargeIn||t[45]!==E.defaultEngine||t[46]!==E.enabled||t[47]!==E.omni||t[48]!==E.tts||t[49]!==u.bargeIn||t[50]!==u.defaultVoice||t[51]!==u.enable||t[52]!==u.voice||t[53]!==n||t[54]!==D||t[55]!==x?.tts||t[56]!==G||t[57]!==r.experience||t[58]!==r.realtime||t[59]!==U?(q=n===`listening`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm font-medium text-fg`,children:[(0,Q.jsx)(`span`,{children:u.enable}),(0,Q.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":E.enabled,className:`ui-checkbox`,checked:E.enabled,onChange:e=>G({enabled:e.target.checked})})]}),(0,Q.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,Q.jsx)(`span`,{children:r.experience.defaultMode}),(0,Q.jsxs)(d,{value:E.defaultEngine,className:ne,onChange:e=>G({defaultEngine:e.target.value}),children:[(0,Q.jsx)(f,{value:`auto`,children:l===`zh`?`自动选择`:`Automatic`}),(0,Q.jsx)(f,{value:`agent`,children:r.experience.assistant}),(0,Q.jsx)(f,{value:`omni`,children:r.experience.natural})]})]}),(0,Q.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[E.defaultEngine===`agent`?r.experience.assistantHint:r.experience.naturalHint,` `,r.experience.nextCall]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsx)(`label`,{htmlFor:`realtime-voice`,className:`text-sm font-medium text-fg`,children:u.voice}),(0,Q.jsxs)(d,{id:`realtime-voice`,className:`${ne} w-full sm:w-56`,value:V,disabled:B?!E.omni:!D&&!x?.tts,onChange:e=>{if(B&&E.omni){G({omni:{...E.omni,voice:e.target.value}});return}if(O===`alibaba`||O===`xopc-cloud`){let t={...E.tts,provider:O};e.target.value?t.voice=e.target.value:delete t.voice,G({tts:t})}},children:[B?null:(0,Q.jsx)(f,{value:``,children:u.defaultVoice}),V&&!U.some(e=>e.id===V)?(0,Q.jsx)(f,{value:V,children:V}):null,U.map(e=>(0,Q.jsxs)(f,{value:e.id,children:[re(e,l),`gender`in e&&e.gender?` · ${e.gender===`female`?`女声`:`男声`}`:``,`style`in e&&e.style?` · ${e.style}`:``]},e.id))]}),(()=>{let e=U.find(e=>e.id===V);return e&&`description`in e&&typeof e.description==`string`?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.description}):null})()]}),(0,Q.jsxs)(`label`,{className:`flex items-center justify-between gap-4 text-sm text-fg`,children:[(0,Q.jsxs)(`span`,{children:[u.bargeIn,(0,Q.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:r.realtime.bargeInDescription})]}),(0,Q.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":E.bargeIn,checked:E.bargeIn,className:`size-4 accent-accent`,onChange:e=>G({bargeIn:e.target.checked})})]})]}):null,t[40]=V,t[41]=l,t[42]=B,t[43]=O,t[44]=E.bargeIn,t[45]=E.defaultEngine,t[46]=E.enabled,t[47]=E.omni,t[48]=E.tts,t[49]=u.bargeIn,t[50]=u.defaultVoice,t[51]=u.enable,t[52]=u.voice,t[53]=n,t[54]=D,t[55]=x?.tts,t[56]=G,t[57]=r.experience,t[58]=r.realtime,t[59]=U,t[60]=q):q=t[60];let J;t[61]!==ee||t[62]!==te||t[63]!==S||t[64]!==C||t[65]!==a||t[66]!==n||t[67]!==m||t[68]!==x||t[69]!==ie||t[70]!==r||t[71]!==g.input||t[72]!==g.output?(J=n===`diagnostics`?(0,Q.jsxs)(Q.Fragment,{children:[C?(0,Q.jsx)(b,{className:`h-16 w-full`}):(0,Q.jsxs)(`div`,{className:`space-y-2 text-sm`,role:`status`,children:[(0,Q.jsxs)(`p`,{children:[r.experience.dictationReady,` · `,ie(ee,g.input)]}),(0,Q.jsxs)(`p`,{children:[r.experience.agentReady,` · `,ie(ee&&te,g.input&&g.output)]}),(0,Q.jsxs)(`p`,{children:[r.experience.omniReady,` · `,ie(!!(x?.enabled&&x.omni),!1)]})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.experience.configurationOnly}),(0,Q.jsx)(Pe,{v:r,canListen:ee,canSpeak:te,disabled:a||C||!!S,onVerified:e=>_({signature:m,...e})},`${m}:${JSON.stringify(x)}`)]}):null,t[61]=ee,t[62]=te,t[63]=S,t[64]=C,t[65]=a,t[66]=n,t[67]=m,t[68]=x,t[69]=ie,t[70]=r,t[71]=g.input,t[72]=g.output,t[73]=J):J=t[73];let ae;return t[74]!==u.service||t[75]!==q||t[76]!==J?(ae=(0,Q.jsxs)(`section`,{className:`space-y-5 rounded-xl bg-surface-hover/20 p-4 sm:p-5`,"aria-label":u.service,children:[q,J]}),t[74]=u.service,t[75]=q,t[76]=J,t[77]=ae):ae=t[77],ae}function Ie(e){return{id:e,name:e}}function Le(e){return Te(e,`conversation`)}function Re(e){return[`Cherry`,`Ethan`,`Serena`,`Chelsie`].includes(e.id)}async function ze(e){return De.parse((await l(e)).payload)}function Be(e){return e.language}function Ve(e){let t=(0,X.c)(19),{value:n,onChange:r}=e,i=c(He)===`zh`,a=i?`通话指令`:`Conversation instructions`,o;t[0]===a?o=t[1]:(o=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:a}),t[0]=a,t[1]=o);let s=i?`通话会接续当前会话。可在这里调整语气与回答方式。`:`Calls continue the current conversation. Adjust tone and response style here.`,l;t[2]===s?l=t[3]:(l=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s}),t[2]=s,t[3]=l);let u=i?`通话指令`:`Conversation instructions`,d;t[4]===u?d=t[5]:(d=(0,Q.jsx)(`span`,{children:u}),t[4]=u,t[5]=d);let f;t[6]!==r||t[7]!==n?(f=e=>r({...n,instructions:e.target.value}),t[6]=r,t[7]=n,t[8]=f):f=t[8];let p;t[9]!==f||t[10]!==n.instructions?(p=(0,Q.jsx)(`textarea`,{className:`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,rows:3,maxLength:8e3,value:n.instructions,onChange:f}),t[9]=f,t[10]=n.instructions,t[11]=p):p=t[11];let m;t[12]!==d||t[13]!==p?(m=(0,Q.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[d,p]}),t[12]=d,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==o||t[16]!==l||t[17]!==m?(h=(0,Q.jsxs)(`details`,{className:`space-y-3 rounded-xl bg-surface-hover/20 p-4`,children:[o,l,m]}),t[15]=o,t[16]=l,t[17]=m,t[18]=h):h=t[18],h}function He(e){return e.language}function Ue({disabled:e=!1}){let t=c(e=>e.language),n=t===`zh`,{data:r,error:i,mutate:s}=k(o(ye),he),[l,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(0),_=(0,Z.useId)();(0,Z.useLayoutEffect)(()=>{g(e=>e+1)},[]);let[v,y]=(0,Z.useState)(),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(``),[T,E]=(0,Z.useState)(!1),D=H({disabled:e||x,chat:u(t).chat,onTranscript:()=>{},onTestAudioPlayed:()=>E(!0)}),j=D.phase!==`idle`&&D.phase!==`error`,M=v??r?.voice??`default`,N=r?.credentialSource===`global`;async function I(){try{return await _e()}catch(e){throw e instanceof Error&&`status`in e&&e.status===404?Error(n?`当前 Gateway 版本不支持查看密钥。请更新并重启 Gateway。`:`Update and restart the Gateway to view or copy the saved key.`):e}}async function L(e){if(!(x||j)){S(!0),w(``);try{await s(await pe(e),{revalidate:!1}),`apiKey`in e&&(m(``),g(e=>e+1),E(!1),D.cancelVoiceInput()),await A()}catch(e){w(e instanceof Error?e.message:String(e))}finally{S(!1)}}}return(0,Q.jsxs)(`section`,{className:`@container space-y-3 rounded-xl border border-edge bg-surface-panel p-4`,"aria-label":`Boson AI`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Boson AI · Higgs Realtime`}),!r&&!i?(0,Q.jsx)(b,{className:`h-24 w-full`}):null,i?(0,Q.jsxs)(`div`,{role:`alert`,className:`text-sm text-danger`,children:[n?`无法读取 Boson 设置。`:`Could not load Boson settings.`,(0,Q.jsx)(P,{variant:`ghost`,onClick:()=>void s(),children:n?`重试`:`Retry`})]}):null,r&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`fieldset`,{disabled:e||x||j,className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,Q.jsx)(`label`,{htmlFor:_,className:`text-sm font-medium text-fg`,children:`Boson API Key`}),(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:r.credentialSource===`env`?n?`已从环境读取 BOSON_API_KEY`:`Using BOSON_API_KEY from the environment`:r.credentialSource?n?`已保存 API Key`:`API key saved`:n?`尚未连接`:`Connection needed`})]}),(0,Q.jsxs)(`div`,{className:`grid items-start gap-2 @min-[32rem]:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,Q.jsx)(p,{id:_,value:l||(N?`••••••••••••`:``),onChange:e=>m(e.replace(/^•+/u,``)),autoComplete:`new-password`,inputClassName:`min-h-11`,labels:{show:n?`显示密钥`:`Show key`,hide:n?`隐藏密钥`:`Hide key`,copy:n?`复制密钥`:`Copy key`,copied:n?`已复制`:`Copied`},reveal:N?I:void 0,allowUnrevealedCopy:!0,loadFailedLabel:n?`无法查看已保存的密钥。`:`Could not load the saved key.`,notInConfigFile:n?`当前没有已保存的密钥。`:`There is no saved key.`},`${N}:${h}`),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(P,{className:`min-h-11`,variant:`secondary`,type:`button`,disabled:!l.trim(),onClick:()=>void L({apiKey:l}),children:x?n?`正在保存…`:`Saving…`:n?`保存密钥`:`Save key`}),N&&(0,Q.jsx)(P,{className:`min-h-11`,type:`button`,variant:`ghost`,onClick:()=>void L({apiKey:null}),children:n?`移除已保存密钥`:`Remove saved key`})]})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,Q.jsx)(`span`,{children:n?`Higgs 默认音色`:`Default Higgs voice`}),(0,Q.jsx)(d,{"aria-label":n?`Higgs 默认音色`:`Default Higgs voice`,value:M,onChange:e=>{y(e.target.value),E(!1),D.cancelVoiceInput()},children:O.map(e=>(0,Q.jsx)(f,{value:e,children:e==="default"?n?`模型默认`:`Model default`:e},e))})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(P,{type:`button`,variant:`secondary`,disabled:M===r.voice||!r.credentialSource,onClick:()=>void L({voice:M}),children:n?`保存音色`:`Save voice`}),(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:r.defaultForNatural?n?`当前全局自然语音模型`:`Current global natural voice model`:n?`在上方选择全局自然语音模型`:`Choose the global natural voice model above`})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`测试时请说一句中文,听到回复后可以插话。音频由 Boson 处理,测试内容仅在当前面板显示,可能产生用量。`:`Say a sentence and try interrupting the reply. Boson processes the audio. Test content stays in this panel and may incur usage.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[j?(0,Q.jsx)(P,{type:`button`,variant:`secondary`,onClick:D.cancelVoiceInput,children:n?`结束测试`:`End test`}):(0,Q.jsx)(P,{type:`button`,variant:`secondary`,disabled:e||x||!r.credentialSource,onClick:()=>{D.cancelVoiceInput(),E(!1),w(``),D.startHiggsTest(M)},children:n?`测试通话`:`Test call`}),r.credentialSource&&!e&&!x&&!j&&(0,Q.jsx)(a,{className:`px-2 text-sm text-accent-fg hover:underline`,to:`/personal`,onClick:F,children:n?`打开 Ada`:`Open Ada`})]}),j&&(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:D.phase===`recording`?D.responsePhase===`speaking`?n?`正在播放,可以插话`:`Playing reply. You can interrupt.`:n?`麦克风已开启,请说话`:`Microphone on. Say something.`:n?`正在连接测试通话…`:`Connecting test call…`}),T&&(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-success`,children:n?`测试通过,已播放回复`:`Test passed. Reply played.`}),D.finalTranscript&&(0,Q.jsxs)(`p`,{className:`text-sm text-fg`,children:[n?`转写 · `:`Transcript · `,D.finalTranscript]}),D.responseText&&(0,Q.jsxs)(`p`,{className:`text-sm text-fg`,children:[n?`回复 · `:`Reply · `,D.responseText]})]})]}),(C||D.error)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:C||D.error})]})}var We=te;function Ge(){return y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,W,`dark:border-edge`)}function $(){return y(ne,te)}function Ke(e){return!e||e<=0?``:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function qe(e,t){let n=window.atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return URL.createObjectURL(new Blob([r],{type:t}))}function Je(e,t){switch(e){case`xopc-cloud`:return t.setup.hosted;case`openai`:return t.stt.openai;case`alibaba`:return t.stt.alibaba;case`groq`:return`Groq`;default:return e}}function Ye(e,t){switch(e){case`xopc-cloud`:return t.setup.hosted;case`openai`:return t.tts.providerOpenai;case`alibaba`:return t.stt.alibaba;case`edge`:return t.tts.providerEdge;case`minimax`:return`MiniMax`;default:return e}}function Xe(e,t){switch(e){case`edge`:return t.tts.providerHints.edge;case`openai`:return t.tts.providerHints.openai;case`alibaba`:return t.tts.providerHints.alibaba;case`minimax`:return t.tts.providerHints.minimax;default:return t.tts.providerHints.generic}}function Ze(e){return{maskedHelp:e.apiKeyMaskedHelp,copy:e.apiKeyCopy,copied:e.apiKeyCopied,show:e.apiKeyShow,hide:e.apiKeyHide,notInConfigFile:e.apiKeyNotInConfigFile,loadFailed:e.apiKeyRevealFailed}}function Qe(e,t){let n=e[t.key];return typeof n==`string`||typeof n==`number`||typeof n==`boolean`?n:t.defaultValue===void 0?t.type!==`boolean`&&``:t.defaultValue}function $e(e,t){if(e.type===`boolean`)return!!t;if(e.type!==`number`)return t;let n=String(t).trim();if(!n)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function et(e,t){switch(t.type){case`reset`:return{form:null,baseline:null};case`sync`:{let e=structuredClone(t.value);return{form:e,baseline:structuredClone(e)}}case`update`:return{...e,form:t.updater(e.form)};case`saved`:{let n=structuredClone(t.value);return{form:e.form!==null&&JSON.stringify(e.form)!==JSON.stringify(t.value)?e.form:n,baseline:structuredClone(n)}}}}function tt(e){let t=(0,X.c)(10),[n,r]=(0,Z.useState)(0),i;t[0]!==e.capability||t[1]!==e.disabled?(i=e.capability===`conversation`&&(0,Q.jsx)(Ue,{disabled:e.disabled}),t[0]=e.capability,t[1]=e.disabled,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>r(nt),t[3]=a):a=t[3];let o;t[4]!==n||t[5]!==e?(o=(0,Q.jsx)(rt,{...e,onReload:a},n),t[4]=n,t[5]=e,t[6]=o):o=t[6];let s;return t[7]!==i||t[8]!==o?(s=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[i,o]}),t[7]=i,t[8]=o,t[9]=s):s=t[9],s}function nt(e){return e+1}function rt({capability:e,onPendingChange:t,disabled:n=!1,onReload:r}){let i=c(e=>e.language),a=u(i).voiceSettings,l=R(e=>e.captions),p=R(e=>e.setCaptions),m=!!s(e=>e.conversationId),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useReducer)(et,{form:null,baseline:null}),y=_.form,b=_.baseline,[x,S]=(0,Z.useState)(null),C=(0,Z.useRef)(!1),w=(0,Z.useRef)({}),T=(0,Z.useRef)(y);T.current=y;let E=(0,Z.useRef)({parsed:null,models:void 0}),{data:D,error:O,isLoading:A,mutate:M}=j(m),{data:N,error:F,isLoading:I,mutate:L}=k(m?o(`/api/voice/models`):null,ce,{revalidateOnFocus:!1}),{data:z,error:B,isLoading:V}=k(m?o(`/api/voice/providers`):null,ge,{revalidateOnFocus:!1}),{data:H,error:U,isLoading:ee}=k(m?o(`/api/voice/stt-providers`):null,le,{revalidateOnFocus:!1}),te=(0,Z.useMemo)(()=>z?.providers??[],[z]),ne=(0,Z.useMemo)(()=>H?.providers??[],[H]),W=(0,Z.useMemo)(()=>D?.payload?.config===void 0?null:me(D.payload.config),[D]),G=(0,Z.useMemo)(()=>!y||!b?!1:JSON.stringify(y)!==JSON.stringify(b),[y,b]);m?W!==null&&N!==void 0&&!C.current&&(E.current.parsed!==W||E.current.models!==N)&&(E.current={parsed:W,models:N},w.current=de(D?.payload?.config),v({type:`sync`,value:W}),S(N)):(E.current.parsed!==null||E.current.models!==void 0)&&(E.current={parsed:null,models:void 0},v({type:`reset`}),S(null),C.current=!1);let K=!!(m&&(W===null||N===void 0||z===void 0||H===void 0)&&(A||I||V||ee)),re=O instanceof Error?O.message:O?String(O):F instanceof Error?F.message:F?String(F):B instanceof Error?B.message:B?String(B):U instanceof Error?U.message:U?String(U):null,q=(0,Z.useCallback)(e=>{C.current=!0,v({type:`update`,updater:t=>t?{...t,stt:{...t.stt,...e},...e.provider&&e.provider!==`xopc-cloud`?{voice:{...t.voice,realtime:{...t.voice.realtime,stt:void 0}}}:{}}:null})},[]),J=(0,Z.useCallback)(e=>{C.current=!0,v({type:`update`,updater:t=>{if(!t)return null;let n=t.stt.fallback??{enabled:!1,order:[]};return{...t,stt:{...t.stt,fallback:{...n,...e}}}}})},[]),ae=(0,Z.useCallback)(e=>{C.current=!0,v({type:`update`,updater:t=>t?{...t,voice:{...t.voice,input:{...t.voice.input,refinement:{...t.voice.input.refinement,...e}}}}:null})},[]),ue=(0,Z.useCallback)(e=>{C.current=!0,v({type:`update`,updater:t=>t?{...t,voice:{...t.voice,languageMode:e,...e===`auto`?{language:i}:{}}}:null})},[i]),fe=(0,Z.useCallback)(e=>{C.current=!0,v({type:`update`,updater:t=>t?{...t,voice:{...t.voice,realtime:{...t.voice.realtime,...e}}}:null})},[]),pe=(0,Z.useCallback)(e=>{C.current=!0,v({type:`update`,updater:t=>t?{...t,tts:{...t.tts,...e}}:null})},[]),Y=se({value:y,dirty:G,onSave:(0,Z.useCallback)(async t=>{try{let n=await be(t,e,w.current[e]);w.current={...w.current,...n},v({type:`saved`,value:t}),C.current=!!(T.current&&JSON.stringify(T.current)!==JSON.stringify(t))}catch(e){throw Error(e instanceof Error?e.message:a.saveError)}},[a.saveError,e])});(0,Z.useEffect)(()=>{t?.(G||Y.status===`saving`||h)},[G,Y.status,h,t]),(0,Z.useEffect)(()=>()=>t?.(!1),[t]);let he=(0,Z.useCallback)(e=>{C.current=!0,v({type:`update`,updater:()=>e})},[]);if(!m)return(0,Q.jsx)(`div`,{className:`flex flex-col gap-3`,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.needToken})});if(K)return(0,Q.jsx)(ie,{rows:4});if(!y||x===null)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:re??a.loadError}),(0,Q.jsx)(P,{type:`button`,variant:`secondary`,onClick:()=>{M(),L()},children:a.retry})]});let _e=y.stt,ve=y.tts,ye=y.voice.input.refinement,xe=Ze(a);return(0,Q.jsxs)(`fieldset`,{disabled:n||h,className:`flex min-w-0 flex-col gap-4`,onBlurCapture:Y.error?void 0:Y.onBlurCapture,children:[(0,Q.jsx)(oe,{status:Y.status,error:Y.error}),Y.error?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(P,{variant:`secondary`,onClick:Y.retry,children:i===`zh`?`重试保存`:`Retry saving`}),(0,Q.jsx)(P,{variant:`ghost`,onClick:()=>{M().then(()=>r()).catch(()=>{})},children:i===`zh`?`重新加载(放弃未保存更改)`:`Reload and discard unsaved changes`})]}):null,e===`transcription`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Me,{zh:i===`zh`}),(0,Q.jsx)(ot,{managedModel:!0,v:a,apiKeyLabels:xe,stt:_e,models:x,sttProviders:ne,updateStt:q,updateSttFallback:J}),(0,Q.jsx)(at,{v:a,voice:y.voice,updateLanguageMode:ue}),(0,Q.jsxs)(`details`,{"data-voice-section":`input-processing`,className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[a.experience.inputProcessing,` · `,ye.mode===`off`?a.stt.refinementOff:ye.mode===`punctuation`?a.stt.refinementPunctuation:ye.mode===`light`?a.stt.refinementLight:a.setup.advanced]}),(0,Q.jsxs)(`label`,{className:`mt-4 block space-y-2 text-sm`,children:[(0,Q.jsx)(`span`,{children:a.stt.refinement}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.stt.refinementDesc}),(0,Q.jsxs)(d,{className:$(),value:ye.mode,onChange:e=>ae({mode:e.target.value}),children:[(0,Q.jsx)(f,{value:`off`,children:a.stt.refinementOff}),(0,Q.jsx)(f,{value:`punctuation`,children:a.stt.refinementPunctuation}),(0,Q.jsx)(f,{value:`light`,children:a.stt.refinementLight}),ye.mode===`custom`?(0,Q.jsx)(f,{value:`custom`,children:a.setup.advanced}):null]})]})]}),_e.provider===`xopc-cloud`?(0,Q.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:i===`zh`?`实时听写`:`Live dictation`}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(Oe,{modes:[`transcription.stream`],disabled:G||Y.status===`saving`,onPendingChange:g})})]}):null]}):e===`speech`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ct,{managedModel:!0,v:a,apiKeyLabels:xe,tts:ve,models:x,ttsProviders:te,updateTts:pe}),(0,Q.jsx)(it,{v:a,tts:ve,updateTts:pe})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Fe,{section:`listening`,v:a,form:y,pending:G||Y.status===`saving`||!!Y.error,onChange:he}),y.voice.realtime.defaultEngine===`omni`&&y.voice.realtime.omni?(0,Q.jsx)(Ve,{value:y.voice.realtime.omni,onChange:e=>fe({omni:e})}):null,(0,Q.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(12rem,18rem)] sm:items-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.experience.pace}),(0,Q.jsxs)(d,{className:$(),value:String(y.voice.realtime.silenceDurationMs),onChange:e=>fe({silenceDurationMs:Number(e.target.value)}),children:[(0,Q.jsx)(f,{value:`800`,children:a.experience.fast}),(0,Q.jsx)(f,{value:`1200`,children:a.experience.standard}),(0,Q.jsx)(f,{value:`2000`,children:a.experience.relaxed}),[800,1200,2e3].includes(y.voice.realtime.silenceDurationMs)?null:(0,Q.jsxs)(f,{value:String(y.voice.realtime.silenceDurationMs),children:[y.voice.realtime.silenceDurationMs,` ms`]})]})]})}),(0,Q.jsxs)(`label`,{className:`flex items-center justify-between text-sm`,children:[a.experience.captions,(0,Q.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":l,className:`ui-checkbox`,checked:l,onChange:e=>p(e.target.checked)})]}),y.voice.realtime.defaultEngine===`agent`&&_e.provider===`xopc-cloud`?(0,Q.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:i===`zh`?`语音助手输出`:`Assistant speech output`}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(Oe,{modes:[`speech.stream`],disabled:G||Y.status===`saving`,onPendingChange:g})})]}):null,(0,Q.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:i===`zh`?`麦克风、扬声器与诊断`:`Microphone, speakers and diagnostics`}),(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsx)(ke,{v:a}),(0,Q.jsx)(Fe,{section:`diagnostics`,v:a,form:y,pending:G||Y.status===`saving`||!!Y.error,onChange:he})]})]})]})]})}function it(e){let t=(0,X.c)(29),{v:n,tts:r,updateTts:i}=e,a;t[0]===n.setup.readout?a=t[1]:(a=(0,Q.jsx)(`span`,{className:`font-medium`,children:n.setup.readout}),t[0]=n.setup.readout,t[1]=a);let o=n.setup.readout,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=$(),t[2]=s):s=t[2];let c=r.enabled?r.trigger:`off`,l;t[3]===i?l=t[4]:(l=e=>i({enabled:e.target.value!==`off`,trigger:e.target.value}),t[3]=i,t[4]=l);let u;t[5]===n.tts.triggerOff?u=t[6]:(u=(0,Q.jsx)(f,{value:`off`,children:n.tts.triggerOff}),t[5]=n.tts.triggerOff,t[6]=u);let p;t[7]===n.tts.triggerInbound?p=t[8]:(p=(0,Q.jsx)(f,{value:`inbound`,children:n.tts.triggerInbound}),t[7]=n.tts.triggerInbound,t[8]=p);let m;t[9]===n.tts.triggerAlways?m=t[10]:(m=(0,Q.jsx)(f,{value:`always`,children:n.tts.triggerAlways}),t[9]=n.tts.triggerAlways,t[10]=m);let h;t[11]===n.tts.triggerTagged?h=t[12]:(h=(0,Q.jsx)(f,{value:`tagged`,children:n.tts.triggerTagged}),t[11]=n.tts.triggerTagged,t[12]=h);let g;t[13]!==c||t[14]!==l||t[15]!==u||t[16]!==p||t[17]!==m||t[18]!==h||t[19]!==n.setup.readout?(g=(0,Q.jsxs)(d,{"aria-label":o,className:s,value:c,onChange:l,children:[u,p,m,h]}),t[13]=c,t[14]=l,t[15]=u,t[16]=p,t[17]=m,t[18]=h,t[19]=n.setup.readout,t[20]=g):g=t[20];let _;t[21]!==a||t[22]!==g?(_=(0,Q.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[a,g]}),t[21]=a,t[22]=g,t[23]=_):_=t[23];let v;t[24]===n.setup.readoutHint?v=t[25]:(v=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.setup.readoutHint}),t[24]=n.setup.readoutHint,t[25]=v);let y;return t[26]!==_||t[27]!==v?(y=(0,Q.jsxs)(`section`,{className:`space-y-2 rounded-xl bg-surface-hover/20 p-4 sm:p-5`,children:[_,v]}),t[26]=_,t[27]=v,t[28]=y):y=t[28],y}function at(e){let t=(0,X.c)(22),{v:n,voice:r,updateLanguageMode:i}=e,a;t[0]===n.language.title?a=t[1]:(a=(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.language.title}),t[0]=n.language.title,t[1]=a);let o=r.languageMode===`auto`?n.language.autoDescription:n.language.manualDescription,s;t[2]===o?s=t[3]:(s=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:o}),t[2]=o,t[3]=s);let c;t[4]!==a||t[5]!==s?(c=(0,Q.jsxs)(`div`,{children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=$(),t[7]=l):l=t[7];let u;t[8]===i?u=t[9]:(u=e=>i(e.target.value),t[8]=i,t[9]=u);let p;t[10]===n.language.auto?p=t[11]:(p=(0,Q.jsx)(f,{value:`auto`,children:n.language.auto}),t[10]=n.language.auto,t[11]=p);let m;t[12]===n.language.manual?m=t[13]:(m=(0,Q.jsx)(f,{value:`manual`,children:n.language.manual}),t[12]=n.language.manual,t[13]=m);let h;t[14]!==u||t[15]!==p||t[16]!==m||t[17]!==r.languageMode?(h=(0,Q.jsxs)(d,{className:l,value:r.languageMode,onChange:u,children:[p,m]}),t[14]=u,t[15]=p,t[16]=m,t[17]=r.languageMode,t[18]=h):h=t[18];let g;return t[19]!==c||t[20]!==h?(g=(0,Q.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(12rem,18rem)] sm:items-center`,children:[c,h]})}),t[19]=c,t[20]=h,t[21]=g):g=t[21],g}function ot(e){let t=(0,X.c)(65),{v:n,apiKeyLabels:r,stt:i,models:a,sttProviders:o,updateStt:s,updateSttFallback:c,managedModel:l}=e,u=l!==void 0&&l,p;if(t[0]!==o){let e=new Set;p=[];for(let t of o)e.has(t.id)||(e.add(t.id),p.push(t));t[0]=o,t[1]=p}else p=t[1];let m=p,g,_,v,b;if(t[2]!==a||t[3]!==m||t[4]!==i.provider||t[5]!==i.providers){g=m.find(e=>e.id===i.provider);let e;t[10]!==i.provider||t[11]!==i.providers?(e=i.providers?.[i.provider]??{},t[10]=i.provider,t[11]=i.providers,t[12]=e):e=t[12],v=e,_=a?.stt?.[i.provider]?.length?a.stt[i.provider]:g?.models??[],b=g?.fields.find(st),t[2]=a,t[3]=m,t[4]=i.provider,t[5]=i.providers,t[6]=g,t[7]=_,t[8]=v,t[9]=b}else g=t[6],_=t[7],v=t[8],b=t[9];let x=b,S=typeof v.model==`string`?v.model:void 0,C=S??(typeof x?.defaultValue==`string`?x.defaultValue:_[0]?.id),w;t[13]!==i.provider||t[14]!==i.providers||t[15]!==s?(w=e=>{s({providers:{...i.providers??{},[i.provider]:{...i.providers?.[i.provider]??{},...e}}})},t[13]=i.provider,t[14]=i.providers,t[15]=s,t[16]=w):w=t[16];let T=w,E,D;t[17]!==S||t[18]!==C||t[19]!==u||t[20]!==x||t[21]!==T?(E=()=>{!u&&x&&C&&S!==C&&T({model:C})},D=[u,S,C,x,T],t[17]=S,t[18]=C,t[19]=u,t[20]=x,t[21]=T,t[22]=E,t[23]=D):(E=t[22],D=t[23]),(0,Z.useEffect)(E,D);let O;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(h,{"aria-hidden":`true`,className:`size-4 text-accent`,strokeWidth:1.75}),t[24]=O):O=t[24];let k;t[25]===n.stt.title?k=t[26]:(k=(0,Q.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[O,n.stt.title]}),t[25]=n.stt.title,t[26]=k);let A;t[27]===n.stt.enable?A=t[28]:(A=(0,Q.jsx)(`span`,{children:n.stt.enable}),t[27]=n.stt.enable,t[28]=A);let j;t[29]===s?j=t[30]:(j=e=>s({enabled:e.target.checked}),t[29]=s,t[30]=j);let M;t[31]!==i.enabled||t[32]!==j?(M=(0,Q.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":i.enabled,className:`ui-checkbox`,checked:i.enabled,onChange:j}),t[31]=i.enabled,t[32]=j,t[33]=M):M=t[33];let N;t[34]!==M||t[35]!==A?(N=(0,Q.jsxs)(`label`,{className:`flex min-h-10 items-center gap-2 text-xs text-fg-muted`,children:[A,M]}),t[34]=M,t[35]=A,t[36]=N):N=t[36];let P;t[37]!==N||t[38]!==k?(P=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[k,N]}),t[37]=N,t[38]=k,t[39]=P):P=t[39];let F;t[40]===n.stt.description?F=t[41]:(F=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.stt.description}),t[40]=n.stt.description,t[41]=F);let I;t[42]!==P||t[43]!==F?(I=(0,Q.jsxs)(`div`,{className:`mb-4`,children:[P,F]}),t[42]=P,t[43]=F,t[44]=I):I=t[44];let L;t[45]!==g?.fields||t[46]!==r||t[47]!==C||t[48]!==u||t[49]!==_||t[50]!==m||t[51]!==v||t[52]!==i.enabled||t[53]!==i.fallback?.enabled||t[54]!==i.provider||t[55]!==T||t[56]!==s||t[57]!==c||t[58]!==n?(L=i.enabled?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[u?null:(0,Q.jsxs)(`div`,{className:y(`flex flex-col gap-1.5`,We),children:[(0,Q.jsx)(gt,{children:n.stt.provider}),(0,Q.jsx)(d,{"aria-label":n.stt.provider,className:$(),value:i.provider,onChange:e=>s({provider:e.target.value}),children:m.map(e=>(0,Q.jsxs)(f,{value:e.id,children:[Je(e.id,n),e.configured?``:` *`]},e.id))})]}),(0,Q.jsx)(lt,{managedModel:u,kind:`stt`,providerId:i.provider,fields:g?.fields??[],providerSlice:v,models:_,currentModel:C,apiKeyLabels:r,onPatch:T})]}),i.provider===`alibaba`?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.setup.keyHint}):null,(0,Q.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:n.stt.fallback}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.stt.fallback}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.stt.fallbackDesc})]}),(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i.fallback?.enabled??!1,onChange:e=>c({enabled:e.target.checked})})]})]})]}):null,t[45]=g?.fields,t[46]=r,t[47]=C,t[48]=u,t[49]=_,t[50]=m,t[51]=v,t[52]=i.enabled,t[53]=i.fallback?.enabled,t[54]=i.provider,t[55]=T,t[56]=s,t[57]=c,t[58]=n,t[59]=L):L=t[59];let R;t[60]===L?R=t[61]:(R=(0,Q.jsx)(`div`,{className:`space-y-4`,children:L}),t[60]=L,t[61]=R);let z;return t[62]!==I||t[63]!==R?(z=(0,Q.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:[I,R]}),t[62]=I,t[63]=R,t[64]=z):z=t[64],z}function st(e){return e.key===`model`}function ct({v:e,apiKeyLabels:t,tts:n,models:r,ttsProviders:i,updateTts:a,managedModel:o=!1}){let[s,c]=(0,Z.useState)(e.tts.test.sampleText),[l,u]=(0,Z.useState)({status:`idle`}),p=(0,Z.useRef)(null),h=(0,Z.useRef)(null),b=(0,Z.useRef)(null),x=(0,Z.useCallback)(()=>{b.current&&(N(b.current),b.current.abort()),b.current=null,p.current?.pause(),p.current=null,h.current&&=(URL.revokeObjectURL(h.current),null)},[]),S=(0,Z.useMemo)(()=>{let e=new Set,t=[];for(let n of i)e.has(n.id)||(e.add(n.id),t.push(n));return t},[i]),C=S.find(e=>e.id===n.provider),w=n.providers?.[n.provider]??{},T=r?.tts?.[n.provider]?.length?r.tts[n.provider]:C?.models??[],E=C?.fields.find(e=>e.key===`model`),D=C?.fields.find(e=>e.key===`voice`),O=typeof w.model==`string`?w.model:void 0,A=O??(typeof E?.defaultValue==`string`?E.defaultValue:T[0]?.id),j=T.find(e=>e.id===A),F=r?.ttsVoices?.[n.provider]?.length?r.ttsVoices[n.provider]:C?.voices??[],{data:I=[]}=k(A?`voice:tts:${n.provider}:${A}`:null,()=>Y(n.provider,A??``),{revalidateOnFocus:!1}),L=I.length>0?I:F,R=typeof w.voice==`string`?w.voice:void 0,z=R??L.find(e=>e.id===j?.tts?.defaultVoice)?.id??(typeof D?.defaultValue==`string`?D.defaultValue:L[0]?.id),B=(C?.fields??[]).filter(e=>(e.key!==`speed`||j?.tts?.speed!==!1)&&(e.key!==`instructions`||j?.tts?.instructions!==!1)),V=(0,Z.useCallback)(e=>{a({providers:{...n.providers??{},[n.provider]:{...n.providers?.[n.provider]??{},...e}}})},[n.provider,n.providers,a]);(0,Z.useEffect)(()=>{if(o)return;let e={};E&&A&&O!==A&&(e.model=A),D&&z&&R!==z&&(e.voice=z),Object.keys(e).length>0&&V(e)},[o,O,R,A,z,E,V,D]),(0,Z.useEffect)(()=>()=>x(),[x]);let H=(0,Z.useCallback)(e=>{a({provider:e}),u({status:`idle`})},[a]),U=(0,Z.useCallback)(async()=>{let t=s.trim();if(!t){u({status:`error`,message:e.tts.test.emptyText});return}x();let r=new AbortController;b.current=r,M(r,()=>{x(),u({status:`idle`})}),u({status:`loading`});try{let i=await fe({text:t,provider:n.provider,providerConfig:w,...A?{model:A}:{},...z?{voice:z}:{}},r.signal);if(r.signal.aborted)return;let a=qe(i.audio,i.mimeType);h.current=a;let o=new Audio(a);p.current=o;let s=[i.provider,i.format,i.latencyMs===void 0?void 0:`${i.latencyMs}ms`,Ke(i.audioSize)].filter(Boolean).join(` · `);o.addEventListener(`ended`,()=>{N(r),r.signal.aborted||u({status:`done`,summary:s})},{once:!0}),o.addEventListener(`error`,()=>{N(r),r.signal.aborted||u({status:`error`,message:e.tts.test.playFailed})},{once:!0}),await o.play(),r.signal.aborted||u({status:`playing`,summary:s})}catch(e){if(r.signal.aborted)return;x(),u({status:`error`,message:e instanceof Error?e.message:String(e)})}},[A,z,w,x,s,n.provider,e.tts.test.emptyText,e.tts.test.playFailed]);return(0,Q.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`mb-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(v,{className:`size-4 text-accent`,strokeWidth:1.75}),e.tts.title]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.tts.description})]}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:o?null:(0,Q.jsxs)(`div`,{className:y(`flex flex-col gap-1.5`,We),children:[(0,Q.jsx)(gt,{children:e.tts.provider}),(0,Q.jsx)(d,{"aria-label":e.tts.provider,className:$(),value:n.provider,onChange:e=>H(e.target.value),children:S.map(t=>(0,Q.jsx)(f,{value:t.id,children:Ye(t.id,e)},t.id))}),(0,Q.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[C?.configured?e.tts.configured:C?.diagnostics.requiresApiKey?`${e.tts.needsKey} · ${C.diagnostics.envKeys?.join(`, `)??e.stt.apiKey}`:e.tts.noKeyNeeded,` · `,C?.description??Xe(n.provider,e)]})]})}),(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:(0,Q.jsx)(lt,{managedModel:o,kind:`tts`,providerId:n.provider,fields:B,providerSlice:w,models:T,voices:L,currentModel:A,currentVoice:z,apiKeyLabels:t,onPatch:V,resetVoiceOnModelChange:!0})}),(0,Q.jsxs)(`details`,{className:`rounded-xl bg-surface-panel/80 p-3`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:e.tts.test.title}),(0,Q.jsxs)(`div`,{className:`mt-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.tts.test.description})}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,Q.jsxs)(P,{type:`button`,variant:`primary`,onClick:()=>void U(),disabled:l.status===`loading`,className:`h-9`,children:[l.status===`loading`?(0,Q.jsx)(m,{className:`size-4 animate-spin`}):(0,Q.jsx)(g,{className:`size-4`}),l.status===`loading`?e.tts.test.generating:e.tts.test.play]}),(0,Q.jsxs)(P,{type:`button`,variant:`secondary`,onClick:()=>{x(),u(e=>e.status===`playing`?{status:`done`,summary:e.summary}:{status:`idle`})},disabled:l.status!==`playing`,className:`h-9`,children:[(0,Q.jsx)(_,{className:`size-4`}),e.tts.test.stop]})]})]}),(0,Q.jsxs)(`details`,{className:`mt-3`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:e.setup.sampleText}),(0,Q.jsx)(`textarea`,{className:y(Ge(),`mt-3 min-h-20 resize-y`),value:s,onChange:e=>c(e.target.value),maxLength:1e3})]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2 text-xs`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-subtle`,children:[s.length,`/1000`]}),l.status===`playing`||l.status===`done`?(0,Q.jsxs)(`span`,{className:`text-emerald-700 dark:text-emerald-200`,children:[l.status===`playing`?e.tts.test.playing:e.tts.test.ready,` · `,l.summary]}):null,l.status===`error`?(0,Q.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:l.message}):null]})]})]})]})})]})}function lt(e){let t=(0,X.c)(48),{kind:n,providerId:r,fields:i,providerSlice:a,models:o,voices:s,currentModel:l,currentVoice:p,apiKeyLabels:m,onPatch:h,resetVoiceOnModelChange:g,managedModel:_}=e,v;t[0]===s?v=t[1]:(v=s===void 0?[]:s,t[0]=s,t[1]=v);let b=v,x=g!==void 0&&g,S=_!==void 0&&_,C=c(pt),w;t[2]===C?w=t[3]:(w=u(C),t[2]=C,t[3]=w);let T=w.voiceSettings,E=S,D=ft,O=dt,k,A,j;if(t[4]!==m||t[5]!==l||t[6]!==p||t[7]!==i||t[8]!==n||t[9]!==C||t[10]!==S||t[11]!==o||t[12]!==h||t[13]!==r||t[14]!==a||t[15]!==x||t[16]!==E||t[17]!==T||t[18]!==b){let e;t[22]===E?e=t[23]:(e=e=>!E||e.key!==`model`&&!O(e),t[22]=E,t[23]=e);let s=i.filter(e),c;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>!D(e),t[24]=c):c=t[24];let u=s.filter(c),g;t[25]!==m||t[26]!==l||t[27]!==p||t[28]!==n||t[29]!==C||t[30]!==S||t[31]!==o||t[32]!==h||t[33]!==r||t[34]!==a||t[35]!==x||t[36]!==T||t[37]!==b?(g=e=>e.map(e=>S&&e.key===`model`?null:e.key===`apiKey`?(0,Q.jsxs)(`div`,{className:y(`flex flex-col gap-1.5`,We),children:[(0,Q.jsx)(gt,{htmlFor:`voice-${n}-${r}-api-key`,children:T.stt.apiKey}),(0,Q.jsx)(xe,{kind:n,providerId:r,fieldId:`voice-${n}-${r}-api-key`,value:typeof a.apiKey==`string`?a.apiKey:``,onChange:e=>h({apiKey:e}),labels:m,placeholder:e.placeholder}),e.description?(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:e.description}):null]},e.key):e.key===`model`&&o.length>0?(0,Q.jsxs)(`div`,{className:y(`flex flex-col gap-1.5`,We),children:[(0,Q.jsx)(gt,{htmlFor:`voice-${n}-${r}-model`,children:T.stt.model}),(0,Q.jsx)(d,{id:`voice-${n}-${r}-model`,className:$(),value:l??``,onChange:e=>h({model:e.target.value,...x?{voice:void 0}:{}}),children:[...o].sort(K).map(ut)})]},e.key):e.key===`voice`&&b.length>0?(0,Q.jsxs)(`div`,{className:y(`flex flex-col gap-1.5`,We),children:[(0,Q.jsx)(gt,{htmlFor:`voice-${n}-${r}-voice`,children:T.tts.voice}),(0,Q.jsxs)(d,{id:`voice-${n}-${r}-voice`,className:$(),value:p??``,onChange:e=>h({voice:e.target.value}),children:[p&&!b.some(e=>e.id===p)?(0,Q.jsxs)(f,{value:p,children:[p,` · unavailable`]}):null,b.map(e=>(0,Q.jsxs)(f,{value:e.id,children:[re(e,C),e.gender?` · ${e.gender===`female`?`女声`:`男声`}`:``,e.style?` · ${e.style}`:``]},e.id))]}),b.find(e=>e.id===p)?.description?(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:b.find(e=>e.id===p)?.description}):null]},e.key):(0,Q.jsx)(mt,{fieldId:`voice-${n}-${r}-${e.key}`,field:e,value:Qe(a,e),onChange:t=>h({[e.key]:t}),className:e.type===`textarea`?`sm:col-span-2`:We},e.key)),t[25]=m,t[26]=l,t[27]=p,t[28]=n,t[29]=C,t[30]=S,t[31]=o,t[32]=h,t[33]=r,t[34]=a,t[35]=x,t[36]=T,t[37]=b,t[38]=g):g=t[38];let _=g;t[39]!==i||t[40]!==n||t[41]!==C||t[42]!==E?(k=E&&i.some(O)?(0,Q.jsx)(je,{className:`text-sm text-accent-fg hover:underline`,to:`/settings/capabilities/models?tab=services&configure=${n===`stt`?`transcription`:`speech`}`,children:C===`zh`?`管理服务连接`:`Manage service connection`}):null,t[39]=i,t[40]=n,t[41]=C,t[42]=E,t[43]=k):k=t[43],A=_(s.filter(D)),j=u.length?(0,Q.jsxs)(`details`,{className:`rounded-lg border border-edge p-3 sm:col-span-2`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:T.experience.providerOptions}),(0,Q.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:_(u)})]}):null,t[4]=m,t[5]=l,t[6]=p,t[7]=i,t[8]=n,t[9]=C,t[10]=S,t[11]=o,t[12]=h,t[13]=r,t[14]=a,t[15]=x,t[16]=E,t[17]=T,t[18]=b,t[19]=k,t[20]=A,t[21]=j}else k=t[19],A=t[20],j=t[21];let M;return t[44]!==k||t[45]!==A||t[46]!==j?(M=(0,Q.jsxs)(Q.Fragment,{children:[k,A,j]}),t[44]=k,t[45]=A,t[46]=j,t[47]=M):M=t[47],M}function ut(e){return(0,Q.jsx)(f,{value:e.id,children:e.name},e.id)}function dt(e){return e.secret||e.type===`password`||[`apiKey`,`baseUrl`,`region`,`groupId`].includes(e.key)}function ft(e){return e.required||[`apiKey`,`model`,`voice`].includes(e.key)}function pt(e){return e.language}function mt(e){let t=(0,X.c)(37),{fieldId:n,field:r,value:i,onChange:a,className:o}=e,s=n??`voice-schema-field-${r.key}`,c=r.description;if(r.type===`boolean`){let e;t[0]===o?e=t[1]:(e=y(`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,o),t[0]=o,t[1]=e);let n;t[2]===r.label?n=t[3]:(n=(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.label}),t[2]=r.label,t[3]=n);let s;t[4]===c?s=t[5]:(s=c?(0,Q.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:c}):null,t[4]=c,t[5]=s);let l;t[6]!==n||t[7]!==s?(l=(0,Q.jsxs)(`span`,{children:[n,s]}),t[6]=n,t[7]=s,t[8]=l):l=t[8];let u=!!i,d;t[9]!==r||t[10]!==a?(d=e=>a($e(r,e.target.checked)),t[9]=r,t[10]=a,t[11]=d):d=t[11];let f;t[12]!==u||t[13]!==d?(f=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:u,onChange:d}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==e||t[16]!==l||t[17]!==f?(p=(0,Q.jsxs)(`label`,{className:e,children:[l,f]}),t[15]=e,t[16]=l,t[17]=f,t[18]=p):p=t[18],p}let l=typeof i==`boolean`?``:String(i),u;t[19]===o?u=t[20]:(u=y(`flex flex-col gap-1.5`,o),t[19]=o,t[20]=u);let f;t[21]!==r.label||t[22]!==s?(f=(0,Q.jsx)(gt,{htmlFor:s,children:r.label}),t[21]=r.label,t[22]=s,t[23]=f):f=t[23];let m;t[24]!==o||t[25]!==r||t[26]!==l||t[27]!==s||t[28]!==a?(m=r.type===`select`?(0,Q.jsx)(d,{id:s,className:$(),value:l,required:r.required,onChange:e=>a($e(r,e.target.value)),children:(r.options??[]).map(ht)}):r.type===`textarea`?(0,Q.jsx)(`textarea`,{id:s,className:y(Ge(),`min-h-24 resize-y`),value:l,required:r.required,placeholder:r.placeholder,onChange:e=>a($e(r,e.target.value))}):r.type===`password`?(0,Q.jsx)(p,{id:s,className:o,value:l,onChange:e=>a($e(r,e)),placeholder:r.placeholder,labels:G}):r.type===`number`?(0,Q.jsx)(ae,{id:s,className:Ge(),autoComplete:r.secret?`new-password`:`off`,spellCheck:!1,value:l,required:r.required,allowEmpty:!r.required,placeholder:r.placeholder,min:r.min,max:r.max,step:r.step,onChange:e=>a($e(r,e.target.value))}):(0,Q.jsx)(`input`,{id:s,className:Ge(),type:`text`,autoComplete:r.secret?`new-password`:`off`,spellCheck:!1,value:l,required:r.required,placeholder:r.placeholder,min:r.min,max:r.max,step:r.step,onChange:e=>a($e(r,e.target.value))}),t[24]=o,t[25]=r,t[26]=l,t[27]=s,t[28]=a,t[29]=m):m=t[29];let h;t[30]===c?h=t[31]:(h=c?(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:c}):null,t[30]=c,t[31]=h);let g;return t[32]!==u||t[33]!==f||t[34]!==m||t[35]!==h?(g=(0,Q.jsxs)(`div`,{className:u,children:[f,m,h]}),t[32]=u,t[33]=f,t[34]=m,t[35]=h,t[36]=g):g=t[36],g}function ht(e){return(0,Q.jsx)(f,{value:e.id,children:e.name},e.id)}function gt(e){let t=(0,X.c)(3),{children:n,htmlFor:r}=e,i;return t[0]!==n||t[1]!==r?(i=r?(0,Q.jsx)(`label`,{htmlFor:r,className:`text-sm font-medium text-fg`,children:n}):(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}export{Ae as n,tt as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i}from"./locale-store-CHjsq5NR.js";import{t as a}from"./messages-C7QSnTdg.js";import{a as o,i as s,o as c,r as l,s as u,t as d}from"./dist-DlirbHVs.js";import{t as f}from"./work-discovery-page-CSRkFiXc.js";import{t as p}from"./understanding-activity-store-CN4JzOIO.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./button-C5tRaJxt.js";import{t as g}from"./brand-logo-CgT9zQfr.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=i(C),w=p(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=a(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(g,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(u,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(s,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(f,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(c,{children:[z,(0,y.jsx)(l,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(d,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i}from"./locale-store-Dy0B0XDJ.js";import{t as a}from"./messages-Bj6DCoic.js";import{a as o,i as s,o as c,r as l,s as u,t as d}from"./dist-DlirbHVs.js";import{t as f}from"./work-discovery-page-JjCyt1Kw.js";import{t as p}from"./understanding-activity-store-BDBAkksk.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./button-C5tRaJxt.js";import{t as g}from"./brand-logo-CgT9zQfr.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=i(C),w=p(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=a(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(g,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(u,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(s,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(f,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(c,{children:[z,(0,y.jsx)(l,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(d,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};
@@ -1 +1 @@
1
- import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{_ as a,f as o}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as s}from"./locale-store-CHjsq5NR.js";import{t as c}from"./messages-C7QSnTdg.js";import{t as l}from"./createLucideIcon-DPHK1VkS.js";import{t as u}from"./service-recommendation-list-wfd0Mjtu.js";import{t as d}from"./calendar-days-hw_Y-g-s.js";import{t as f}from"./check-DUBLcKHA.js";import{t as p}from"./chevron-down-ccbiQQz_.js";import{t as m}from"./chevron-right-BweFrslA.js";import{i as h,t as g}from"./working-directory-picker-modal-DgM21YVT.js";import{t as _}from"./circle-check-C23XjkUj.js";import{t as ee}from"./clock-3-DnrAnuyZ.js";import{t as v}from"./database-CjjeZfRG.js";import{a as te,c as ne,d as re,f as y,i as b,l as x,m as S,n as C,o as w,p as T,r as E,s as D,t as O,u as k}from"./understanding-activity-store-CN4JzOIO.js";import{t as A}from"./file-text-D12HbeVy.js";import{t as j}from"./folder-open-CyzJ19I9.js";import{t as M}from"./git-branch-Dh9uxTot.js";import{t as N}from"./list-todo-CTVRto8O.js";import{t as P}from"./loader-circle-CifKLtgG.js";import{t as F}from"./messages-square-BckAJrEW.js";import{n as I,s as L,t as R}from"./install-connector-dialog-CntHi8Rh.js";import{t as z}from"./plug-zap-L8NMe3Sv.js";import{t as B}from"./plus-Q2yW6OE7.js";import{t as V}from"./shield-check-BU58siTV.js";import{t as ie}from"./sparkles-DHlfQFAF.js";import{t as ae}from"./x-B_N4OPjy.js";import{t as H}from"./cn-0WouolD0.js";import{t as oe}from"./skeleton-DzdOeGYz.js";import{t as U}from"./button-C5tRaJxt.js";import{a as se,r as ce}from"./connectors-api-CRGq-TSw.js";import{t as le}from"./loopi-CNtmi9FU.js";import{t as ue}from"./use-directory-picker-C4p7AgWY.js";var W=l(`book-open-text`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M16 12h2`,key:`7q9ll5`}],[`path`,{d:`M16 8h2`,key:`msurwy`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}],[`path`,{d:`M6 12h2`,key:`32wvfc`}],[`path`,{d:`M6 8h2`,key:`30oboj`}]]),G=e(n(),1),K=new Set([`completed`,`failed`,`canceled`]);function de(){return new Promise(e=>window.setTimeout(e,1200))}async function fe(e,t){let n=[],r=t.wait??de;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!K.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var pe=r();function q(e,t){let n=e.result?.conversationStarter?.trim();if(n)return n;let r=e.result?.suggestions.find(t=>t.id===e.result?.primarySuggestionId)??e.result?.suggestions[0];if(r?.actionPrompt.trim())return r.actionPrompt.trim();let i=e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return t===`zh`?`请先结合 ${i} 当前目录和最近变更,帮我说明这个项目在做什么、现在最值得关注什么,以及建议我下一步从哪里开始。`:`Help me understand ${i}: explain what this project is doing, what matters most right now, and where I should start next.`}var J=i(),me={zh:{eyebrow:`当前理解`,summaryTitle:`我理解的是这样`,summaryQuestion:`可以继续,也可以随时修改。`,matches:`准确,继续`,adjust:`修改`,why:`查看依据`,evidenceHint:`这些内容只用于本次判断。`,current:`当前`,ongoing:`持续`,longTerm:`长期`,correctionTitle:`告诉我正确的重点`,correctionPlaceholder:`你现在真正想推进什么?`,continueWithCorrection:`按此继续`,starterTitle:`从这里开始`,starterHint:`可以修改后直接开始对话。`,startConversation:`进入对话`,cancel:`取消`},en:{eyebrow:`Current understanding`,summaryTitle:`Here’s how I understand it`,summaryQuestion:`Continue, or adjust this anytime.`,matches:`Accurate, continue`,adjust:`Edit`,why:`View sources`,evidenceHint:`These sources are only used for this assessment.`,current:`Current`,ongoing:`Ongoing`,longTerm:`Long term`,correctionTitle:`Tell me the right focus`,correctionPlaceholder:`What do you want to move forward right now?`,continueWithCorrection:`Continue`,starterTitle:`Start here`,starterHint:`Edit this if needed, then start the conversation.`,startConversation:`Start conversation`,cancel:`Cancel`}};function he(e){let t=(0,pe.c)(84),{run:n,language:r,busy:i,error:a,onFinish:o,onStartConversation:s}=e,c=me[r],l=n.result?.lowConfidence===!0,u;t[0]!==r||t[1]!==n?(u=q(n,r),t[0]=r,t[1]=n,t[2]=u):u=t[2];let d=u,[f,m]=(0,G.useState)(l),[h,g]=(0,G.useState)(l?d:``),[_,ee]=(0,G.useState)(!1),[v,te]=(0,G.useState)(!1),[ne,re]=(0,G.useState)(!1),y,b,x,S,C,w,T,E,D,O,k,A;if(t[3]!==i||t[4]!==v||t[5]!==h||t[6]!==f||t[7]!==a||t[8]!==ne||t[9]!==o||t[10]!==s||t[11]!==n.result||t[12]!==c.current||t[13]!==c.evidenceHint||t[14]!==c.eyebrow||t[15]!==c.longTerm||t[16]!==c.ongoing||t[17]!==c.summaryTitle||t[18]!==c.why){let e=n.result?.workThreads?.slice(0,3)??[],r=n.result?.suggestions.find(e=>e.id===n.result?.primarySuggestionId)??n.result?.suggestions[0],l;t[31]!==h||t[32]!==o?(l=async e=>{ee(!0),await o(e,e===`corrected`?h.trim():void 0)||ee(!1)},t[31]=h,t[32]=o,t[33]=l):l=t[33],y=l;let u;t[34]!==h||t[35]!==s?(u=async()=>{let e=h.trim();e&&(te(!0),await s(e,`corrected`)||te(!1))},t[34]=h,t[35]=s,t[36]=u):u=t[36],b=u,x=`xopc-understanding-reveal flex min-h-full flex-1 flex-col`,S=`polite`,D=`xopc-reveal-scene mx-auto flex w-full max-w-[40rem] flex-1 flex-col justify-center py-6 text-center sm:py-10`;let d=a?`care`:i||v?`work`:f?`listen`:`decision`;t[37]===d?O=t[38]:(O=(0,J.jsx)(le,{className:`mx-auto mb-3 size-28`,mood:d}),t[37]=d,t[38]=O),t[39]===c.eyebrow?k=t[40]:(k=(0,J.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.2em] text-accent-fg`,children:c.eyebrow}),t[39]=c.eyebrow,t[40]=k),t[41]===c.summaryTitle?A=t[42]:(A=(0,J.jsx)(`h1`,{className:`mx-auto mt-4 max-w-[34rem] text-3xl font-semibold tracking-[-0.035em] text-fg sm:text-[2.25rem]`,children:c.summaryTitle}),t[41]=c.summaryTitle,t[42]=A),C=`xopc-understanding-hero-card relative mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel px-6 py-7 text-left shadow-surface sm:px-8`,t[43]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,J.jsx)(`div`,{className:`mb-5 flex size-9 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,"aria-hidden":!0,children:(0,J.jsx)(ie,{className:`size-[1.125rem]`})}),t[43]=w):w=t[43];let m=n.result?.projectSummary;t[44]===m?T=t[45]:(T=(0,J.jsx)(`p`,{className:`relative text-lg font-medium leading-8 text-fg sm:text-xl`,children:m}),t[44]=m,t[45]=T),E=n.result?.currentState||e.length||r?.evidence.length?(0,J.jsxs)(`div`,{className:`relative mt-5 border-t border-edge-subtle pt-4`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 text-xs font-medium text-fg-muted hover:text-fg`,onClick:()=>re(_e),children:[c.why,(0,J.jsx)(p,{className:H(`size-3.5 transition-transform`,ne&&`rotate-180`)})]}),ne?(0,J.jsxs)(`div`,{className:`mt-3 space-y-3 text-xs leading-5 text-fg-muted`,children:[(0,J.jsx)(`p`,{className:`text-fg-subtle`,children:c.evidenceHint}),n.result?.currentState?(0,J.jsx)(`p`,{children:n.result.currentState}):null,e.length?(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,J.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg`,children:e.title}),` · `,e.horizon===`current`?c.current:e.horizon===`ongoing`?c.ongoing:c.longTerm]},e.id))}):null,r?.evidence.slice(0,3).map(ge)]}):null]}):null,t[3]=i,t[4]=v,t[5]=h,t[6]=f,t[7]=a,t[8]=ne,t[9]=o,t[10]=s,t[11]=n.result,t[12]=c.current,t[13]=c.evidenceHint,t[14]=c.eyebrow,t[15]=c.longTerm,t[16]=c.ongoing,t[17]=c.summaryTitle,t[18]=c.why,t[19]=y,t[20]=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]=k,t[30]=A}else y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28],k=t[29],A=t[30];let j;t[46]!==C||t[47]!==w||t[48]!==T||t[49]!==E?(j=(0,J.jsxs)(`div`,{className:C,children:[w,T,E]}),t[46]=C,t[47]=w,t[48]=T,t[49]=E,t[50]=j):j=t[50];let M;t[51]!==y||t[52]!==i||t[53]!==v||t[54]!==h||t[55]!==f||t[56]!==l||t[57]!==b||t[58]!==_||t[59]!==c.adjust||t[60]!==c.cancel||t[61]!==c.continueWithCorrection||t[62]!==c.correctionPlaceholder||t[63]!==c.correctionTitle||t[64]!==c.matches||t[65]!==c.startConversation||t[66]!==c.starterHint||t[67]!==c.starterTitle||t[68]!==c.summaryQuestion?(M=f?(0,J.jsxs)(`div`,{className:`xopc-reveal-calibration mx-auto mt-7 w-full max-w-xl rounded-xl border border-edge bg-surface-panel p-5 text-left shadow-surface`,children:[(0,J.jsx)(`label`,{className:`text-sm font-semibold text-fg`,htmlFor:`understanding-correction`,children:l?c.starterTitle:c.correctionTitle}),l?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:c.starterHint}):null,(0,J.jsx)(`textarea`,{id:`understanding-correction`,value:h,onChange:e=>g(e.target.value),placeholder:c.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,J.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[l?null:(0,J.jsx)(U,{variant:`ghost`,disabled:_,onClick:()=>m(!1),children:c.cancel}),(0,J.jsx)(U,{variant:`primary`,disabled:i||v||!h.trim(),onClick:()=>void b(),children:l?c.startConversation:c.continueWithCorrection})]})]}):(0,J.jsxs)(`div`,{className:`mx-auto mt-8 w-full max-w-sm`,children:[(0,J.jsx)(`p`,{className:`text-base font-medium text-fg`,children:c.summaryQuestion}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,J.jsx)(U,{className:`h-11 flex-1`,variant:`primary`,disabled:_,onClick:()=>void y(`confirmed`),children:c.matches}),(0,J.jsx)(U,{className:`h-11 flex-1`,variant:`secondary`,disabled:_,onClick:()=>m(!0),children:c.adjust})]})]}),t[51]=y,t[52]=i,t[53]=v,t[54]=h,t[55]=f,t[56]=l,t[57]=b,t[58]=_,t[59]=c.adjust,t[60]=c.cancel,t[61]=c.continueWithCorrection,t[62]=c.correctionPlaceholder,t[63]=c.correctionTitle,t[64]=c.matches,t[65]=c.startConversation,t[66]=c.starterHint,t[67]=c.starterTitle,t[68]=c.summaryQuestion,t[69]=M):M=t[69];let N;t[70]===a?N=t[71]:(N=a?(0,J.jsx)(`p`,{className:`mt-5 text-sm text-danger`,role:`alert`,children:a}):null,t[70]=a,t[71]=N);let P;t[72]!==j||t[73]!==M||t[74]!==N||t[75]!==D||t[76]!==O||t[77]!==k||t[78]!==A?(P=(0,J.jsxs)(`div`,{className:D,children:[O,k,A,j,M,N]}),t[72]=j,t[73]=M,t[74]=N,t[75]=D,t[76]=O,t[77]=k,t[78]=A,t[79]=P):P=t[79];let F;return t[80]!==x||t[81]!==S||t[82]!==P?(F=(0,J.jsx)(`section`,{className:x,"aria-live":S,children:P}),t[80]=x,t[81]=S,t[82]=P,t[83]=F):F=t[83],F}function ge(e,t){return(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(M,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,J.jsxs)(`span`,{children:[e.path?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${t}-${e.path??e.observation}`)}function _e(e){return!e}var ve={folder:j,file:A,recent:S,git:M,calendar:d,task:N,note:W,mail:T,message:F,service:z,data:v};function ye(e){let t=(0,pe.c)(28),{signals:n,ariaLabel:r,centerLabel:i}=e,a,o,s,c,l,u,d,f;if(t[0]!==r||t[1]!==i||t[2]!==n){let e=n.slice(0,3);a=Math.max(0,n.length-e.length),c=`xopc-source-convergence mx-auto mt-9 w-full max-w-[34rem] overflow-hidden rounded-xl border border-edge bg-surface-panel px-5 py-6 shadow-surface sm:px-6`,l=`img`,u=r;let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,J.jsx)(le,{className:`size-24`,mood:`work`}),t[11]=p):p=t[11],t[12]===i?d=t[13]:(d=(0,J.jsxs)(`div`,{className:`flex flex-col items-center text-center`,"aria-hidden":!0,children:[p,(0,J.jsx)(`span`,{className:`mt-3 text-[11px] font-semibold tracking-[0.16em] text-fg-muted`,children:i})]}),t[12]=i,t[13]=d),t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,J.jsx)(`div`,{className:`mt-5 h-1 overflow-hidden rounded-full bg-surface-hover`,"aria-hidden":!0,children:(0,J.jsx)(`span`,{className:`xopc-source-convergence-progress block h-full w-2/5 rounded-full bg-accent`})}),t[14]=f):f=t[14],o=`mt-5 divide-y divide-edge-subtle border-y border-edge-subtle`,s=e.map(be),t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f}else a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10];let p;t[15]!==o||t[16]!==s?(p=(0,J.jsx)(`div`,{className:o,children:s}),t[15]=o,t[16]=s,t[17]=p):p=t[17];let m;t[18]===a?m=t[19]:(m=a>0?(0,J.jsxs)(`p`,{className:`mt-3 text-center text-xs text-fg-muted`,"aria-hidden":!0,children:[`+`,a]}):null,t[18]=a,t[19]=m);let h;return t[20]!==c||t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f||t[25]!==p||t[26]!==m?(h=(0,J.jsxs)(`div`,{className:c,role:l,"aria-label":u,children:[d,f,p,m]}),t[20]=c,t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=p,t[26]=m,t[27]=h):h=t[27],h}function be(e){let t=ve[e.kind];return(0,J.jsxs)(`div`,{className:`flex min-h-12 items-center gap-3 py-2.5 text-left`,"aria-hidden":!0,children:[(0,J.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,J.jsx)(t,{className:`size-4`})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,title:e.detail,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.label}),e.meta?(0,J.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:e.meta}):null]}),(0,J.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-accent`})]},e.id)}var xe=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];function Y({toolkit:e,displayName:t,description:n,category:r,mode:i,bootstrapWindowDays:a,logoFileName:o=e}){return{id:`composio-${e}`,version:`sessions-v1`,displayName:t,description:n,category:r,kind:`composio`,source:`registry`,capabilities:[`tools`,`auth.oauth`,`events`,`context`,`memory_source`],benefits:[`understand`,`act`],understanding:{mode:i,bootstrapWindowDays:a,readOnly:!0},tags:[`composio`,e,`verified`],branding:{logoUrl:`/connector-icons/${o}.svg`,source:`builtin`},verificationLevel:`verified`,auth:{mode:`oauth`,provider:`composio`},setup:{},runtime:{type:`composio`,toolkit:e,role:`toolkit`},integrationStrategy:{lane:`composio`,workload:`long_tail`,preferred:!0}}}var Se=[Y({toolkit:`gmail`,displayName:`Gmail`,description:`Find and understand recent email, then draft or send with your approval.`,category:`automation`,mode:`activity`,bootstrapWindowDays:30}),Y({toolkit:`googlecalendar`,displayName:`Google Calendar`,description:`Understand your schedule and work with approved calendar events.`,category:`automation`,mode:`activity`,bootstrapWindowDays:90,logoFileName:`google-calendar`}),Y({toolkit:`googledrive`,displayName:`Google Drive`,description:`Search and understand approved files in Google Drive.`,category:`data`,mode:`inventory`,bootstrapWindowDays:90,logoFileName:`google-drive`}),Y({toolkit:`github`,displayName:`GitHub`,description:`Understand repositories, issues, pull requests, and reviews.`,category:`code`,mode:`activity`,bootstrapWindowDays:90}),Y({toolkit:`linear`,displayName:`Linear`,description:`Understand and work with Linear issues and projects.`,category:`code`,mode:`activity`,bootstrapWindowDays:60})];function Ce(e){return e.runtime.type===`composio`&&e.runtime.role===`toolkit`?e.runtime.toolkit.toLocaleLowerCase():``}function we(e){let t=new Map(xe.map((e,t)=>[e,t]));return e.filter(e=>e.understanding!=null&&Ce(e)).sort((e,n)=>(t.get(Ce(e))??2**53-1)-(t.get(Ce(n))??2**53-1)||e.displayName.localeCompare(n.displayName))}function Te(e,t){let n=new Map(e.map(e=>[e.id,e]));for(let e of t)n.set(e.id,e);return we([...n.values()])}var Ee=2500;function De(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}function Oe(e){return e===`gmail`?`mail`:e===`googlecalendar`?`calendar`:e===`googledrive`?`data`:e===`github`?`git`:e===`linear`?`task`:`service`}function ke(e){let t=(0,pe.c)(59),{busy:n,onBack:r,onContinue:i,onSkip:a,onConnectedSignalsChange:o}=e,l=s(Pe),d=c(l),f=d.onboarding.workDiscovery,m=d.connectorsSettings,[g,ee]=(0,G.useState)(Ne),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],t[0]=v):v=t[0];let[te,ne]=(0,G.useState)(v),[re,y]=(0,G.useState)(!0),[b,x]=(0,G.useState)(null),[S,C]=(0,G.useState)(!1),[w,T]=(0,G.useState)(null),E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=async()=>{let e=await se();return ne(e),e},t[1]=E):E=t[1];let D=E,O,k;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{let e=!1,t=window.setTimeout(()=>{e||y(!1)},Ee);return se().then(t=>{e||ne(t)}).catch(t=>{e||x(t instanceof Error?t.message:String(t))}).finally(()=>{e||y(!1),window.clearTimeout(t)}),ce({page:1,pageSize:24,verification:`verified`}).then(t=>{e||ee(Te(Se,t.connectors))}).catch(Me),()=>{e=!0,window.clearTimeout(t)}},k=[],t[2]=O,t[3]=k):(O=t[2],k=t[3]),(0,G.useEffect)(O,k);let A;t[4]===te?A=t[5]:(A=new Map(te.map(je)),t[4]=te,t[5]=A);let j=A,M;if(t[6]!==g||t[7]!==j){let e;t[9]===j?e=t[10]:(e=e=>{if(!De(j.get(e.id)))return[];let t=Ce(e);return[{id:e.id,label:e.displayName,kind:Oe(t)}]},t[9]=j,t[10]=e),M=g.flatMap(e),t[6]=g,t[7]=j,t[8]=M}else M=t[8];let N=M,F,z;t[11]!==N||t[12]!==o?(F=()=>{o(N)},z=[N,o],t[11]=N,t[12]=o,t[13]=F,t[14]=z):(F=t[13],z=t[14]),(0,G.useEffect)(F,z);let V;t[15]!==g||t[16]!==S?(V=S?g:g.slice(0,3),t[15]=g,t[16]=S,t[17]=V):V=t[17];let ie=V,ae=N.length,H;t[18]!==g.length||t[19]!==m||t[20]!==f.connected||t[21]!==f.noWorkServices||t[22]!==f.showFewerServices||t[23]!==f.showMoreServices||t[24]!==S||t[25]!==j||t[26]!==re||t[27]!==l||t[28]!==D||t[29]!==C||t[30]!==T||t[31]!==ie?(H=l===`zh`?(0,J.jsx)(u,{onChanged:async()=>{await D()}}):(0,J.jsxs)(J.Fragment,{children:[ie.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge-subtle bg-surface-base/55`,children:ie.map(e=>{let t=De(j.get(e.id));return(0,J.jsxs)(`article`,{className:`flex min-h-[4.75rem] items-center gap-3 px-3 py-3 sm:px-4`,children:[(0,J.jsx)(I,{connector:e,size:`sm`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.displayName}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-1 text-xs text-fg-muted`,children:e.description})]}),t?(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 text-xs font-medium text-success`,children:[(0,J.jsx)(_,{className:`size-4`}),f.connected]}):re?(0,J.jsx)(oe,{className:`h-8 w-[4.5rem] shrink-0 rounded-lg`,"aria-label":m.loading}):(0,J.jsxs)(U,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-3 text-xs`,onClick:()=>T(L(e)),children:[(0,J.jsx)(B,{className:`size-3.5`}),m.connect]})]},e.id)})}):(0,J.jsx)(`p`,{className:`rounded-xl border border-dashed border-edge px-4 py-8 text-center text-sm text-fg-muted`,children:f.noWorkServices}),g.length>3?(0,J.jsxs)(`button`,{type:`button`,className:`mx-auto mt-3 flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>C(Ae),children:[S?(0,J.jsx)(h,{className:`size-3.5`}):(0,J.jsx)(p,{className:`size-3.5`}),S?f.showFewerServices:f.showMoreServices]}):null]}),t[18]=g.length,t[19]=m,t[20]=f.connected,t[21]=f.noWorkServices,t[22]=f.showFewerServices,t[23]=f.showMoreServices,t[24]=S,t[25]=j,t[26]=re,t[27]=l,t[28]=D,t[29]=C,t[30]=T,t[31]=ie,t[32]=H):H=t[32];let le;t[33]!==f.connectorLoadFailed||t[34]!==b?(le=b?(0,J.jsxs)(`p`,{className:`mt-3 text-center text-xs text-danger`,role:`alert`,children:[f.connectorLoadFailed,`: `,b]}):null,t[33]=f.connectorLoadFailed,t[34]=b,t[35]=le):le=t[35];let ue;t[36]===n?ue=t[37]:(ue=n?(0,J.jsx)(P,{className:`size-4 animate-spin`}):null,t[36]=n,t[37]=ue);let W;t[38]!==n||t[39]!==f.startUnderstanding||t[40]!==i||t[41]!==ue?(W=(0,J.jsxs)(U,{type:`button`,variant:`primary`,className:`h-11 flex-1`,disabled:n,onClick:i,children:[ue,f.startUnderstanding]}),t[38]=n,t[39]=f.startUnderstanding,t[40]=i,t[41]=ue,t[42]=W):W=t[42];let K;t[43]!==n||t[44]!==f.back||t[45]!==r?(K=(0,J.jsx)(U,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:n,onClick:r,children:f.back}),t[43]=n,t[44]=f.back,t[45]=r,t[46]=K):K=t[46];let de;t[47]!==W||t[48]!==K?(de=(0,J.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[W,K]}),t[47]=W,t[48]=K,t[49]=de):de=t[49];let fe;t[50]!==n||t[51]!==f.skipAndEnter||t[52]!==a?(fe=(0,J.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,disabled:n,onClick:a,children:f.skipAndEnter}),t[50]=n,t[51]=f.skipAndEnter,t[52]=a,t[53]=fe):fe=t[53];let q;return t[54]!==m||t[55]!==w||t[56]!==D||t[57]!==T?(q=w?(0,J.jsx)(R,{draft:w,onChange:T,onClose:()=>T(null),t:m,onInstalled:async()=>{await D(),T(null)}}):null,t[54]=m,t[55]=w,t[56]=D,t[57]=T,t[58]=q):q=t[58],(0,J.jsxs)(`section`,{className:`mx-auto flex w-full max-w-[42rem] flex-1 flex-col`,"aria-labelledby":`work-discovery-connectors-title`,children:[(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:f.connectorStepEyebrow}),(0,J.jsx)(`h1`,{id:`work-discovery-connectors-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:f.connectorStepTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-3 max-w-[36rem] text-[0.95rem] leading-7 text-fg-muted`,children:f.connectorStepSubtitle})]}),(0,J.jsxs)(`div`,{className:`mt-7 rounded-xl border border-edge bg-surface-panel p-3 shadow-surface sm:p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1 pb-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.popularWorkServices}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.connectorsOptional})]}),ae?(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 rounded-full bg-success-soft px-2.5 py-1 text-xs font-medium text-success`,children:[(0,J.jsx)(_,{className:`size-3.5`}),f.connectedCount.replace(`{{count}}`,String(ae))]}):null]}),H,le]}),de,fe,q]})}function Ae(e){return!e}function je(e){return[e.connectorId,e]}function Me(){}function Ne(){return we(Se)}function Pe(e){return e.language}var Fe=new Set([`local-recent-files`,`chromium-bookmarks`,`apple-notes`,`apple-mail`,`apple-calendar`,`apple-reminders`]);function Ie(e){return new Set(e.filter(e=>e.availability===`available`&&Fe.has(e.id)).map(e=>e.id))}var Le=t({WorkDiscoveryPage:()=>Ve}),Re=[`folder_structure`,`recent_progress`,`next_steps`];function X(e){return e instanceof Error?e.message:String(e)}function ze(e){return e.replaceAll(`\\`,`/`).split(`/`).filter(Boolean).slice(-2).join(`/`)||e}function Be(e,t){return e.replace(`{{count}}`,String(t))}function Ve({embedded:e=!1,onRequestClose:t,onNavigateAway:n}={}){let r=s(e=>e.language),i=c(r).onboarding.workDiscovery,l=c(r).chat.workingDirectory,u=o(),[d]=a(),h=d.get(`new`)===`1`,[_,v]=(0,G.useState)(`loading`),[S,T]=(0,G.useState)(null),[M,N]=(0,G.useState)(null),[F,I]=(0,G.useState)(null),[L,R]=(0,G.useState)(!1),[z,B]=(0,G.useState)(null),[ie,se]=(0,G.useState)(!1),[ce,W]=(0,G.useState)([]),[K,de]=(0,G.useState)(()=>new Set),[pe,q]=(0,G.useState)([]),[me,ge]=(0,G.useState)(!1),[_e,ve]=(0,G.useState)({current:0,total:0}),[be,xe]=(0,G.useState)([]),[Y,Se]=(0,G.useState)(()=>new Set),[Ce,we]=(0,G.useState)([]),Te=(0,G.useRef)(!1),Ee={recent_documents:`recent`,calendar:`calendar`,tasks:`task`,notes:`note`,mail:`mail`,messages:`message`,code_activity:`git`,files:`file`},De=F?.snapshot?.projectKind??S?.projectKind,Oe=De===`coding`?i.codingProject:De===`general`?i.generalProject:De===`unknown`?i.unknownProject:null,Ae=(F?.snapshot?.files??[]).slice(0,4).map(e=>({id:`snapshot-file:${e.relativePath}`,label:ze(e.relativePath),kind:e.source===`git_change`?`recent`:`file`,meta:e.source===`git_change`?i.sourceSignals.changedFile:e.source===`document`?i.sourceSignals.contextFile:i.sourceSignals.structureFile,detail:e.relativePath})),je=F?.rootPath??S?.canonicalRootPath,Me=Ae.length===0?(S?.fingerprint.recentAreas??[]).slice(0,2).map(e=>({id:`recent-area:${e}`,label:e,kind:`recent`,meta:i.sourceSignals.recentArea,detail:e})):[],Ne=Ae.length===0?Me.length>0?Me:[{id:`project-files`,label:i.sourceSignals.projectFiles,kind:`file`,meta:i.sourceSignals.scanningFiles},{id:`recent-changes`,label:i.sourceSignals.recentChanges,kind:`recent`,meta:i.sourceSignals.checkingChanges}]:[],Pe=F?.snapshot?.sampledPathCount,Fe=[Oe,Pe==null?null:Be(i.sourceSignals.filesScanned,Pe)].filter(e=>!!e).join(` · `),Le=F?.snapshot?.branch??S?.fingerprint.branch,Ve=F?.snapshot?.changedPathCount??S?.fingerprint.changedFileCount,He=[{id:`work-folder`,label:je?ze(je):i.sourceSignals.workFolder,kind:`folder`,...Fe?{meta:Fe}:{},...je?{detail:je}:{}},...Ae,...Ne,{id:`git-state`,label:Le??i.sourceSignals.gitState,kind:`git`,...Ve==null?{}:{meta:Be(i.sourceSignals.changedFiles,Ve)},...Le?{detail:`Git · ${Le}`}:{}},...be.filter(e=>Y.has(e.id)).map(e=>({id:e.id,label:e.displayName,kind:Ee[e.category]??`data`})),...Ce],Ue=e=>{Se(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,G.useEffect)(()=>{let e=!1;return window.electronAPI?.understandingSources?.catalog().then(t=>{e||(xe(t),Se(Ie(t)))}),()=>{e=!0}},[]);let Z=(0,G.useCallback)(e=>{O.getState().updateDirectoryRun(e),I(e),e.status===`completed`?v(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?v(`error`):v(`running`)},[]),We=async()=>{R(!0),B(null);try{let e=await E();if(N(e.processingTarget),!e.candidates.length){B(i.noCandidates);return}W(e.candidates),de(new Set([e.candidates[0].rootPath])),v(`candidates`)}catch(e){B(X(e))}finally{R(!1)}},Ge=e=>{de(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ke=(0,G.useCallback)((e,t,n)=>{O.getState().updateDirectoryRun(e),I(e),ve({current:t+1,total:n}),q(n=>{let r=[...n];return r[t]=e,r}),v(`running`)},[]),qe=(0,G.useCallback)(e=>{q(t=>t.map(t=>t?.id===e.id?e:t))},[]),Je=async()=>{let e=ce.filter(e=>K.has(e.rootPath));if(!e.length)return;R(!0),B(null),q([]),ve({current:1,total:e.length}),ge(!0),Te.current=!1;let t=!1,n=M?.remoteModel?`remote_allowed`:`local_only`;try{let r=await fe(e,{grantDirectory:e=>D(e,n),startRun:re,fetchRun:w,shouldStop:()=>Te.current,onRun:(e,r,i)=>{Ke(e,r,i),t||(t=!0,O.getState().collectSources(e.id,[...Y],n))},onError:(t,n,r)=>{ve({current:r+1,total:e.length}),B(i.folderAnalysisFailed.replace(`{{folder}}`,n.displayName).replace(`{{error}}`,X(t)))}});if(Te.current)return;let a=r.find(e=>e.status===`completed`)??r.at(-1);a?Z(a):v(`candidates`)}catch(e){B(X(e)),v(`candidates`)}finally{ge(!1),R(!1)}},Q=ue({onPicked:(0,G.useCallback)(async e=>{R(!0),B(null);try{let t=await ne(e);T(t),N({provider:t.provider,remoteModel:t.remoteModel}),v(`consent`)}catch(e){B(X(e)),v(`intro`)}finally{R(!1)}},[])});(0,G.useEffect)(()=>{if(!h){let e=O.getState().directoryRun;if(e){Z(e);return}}let e=!1,n=window.setTimeout(()=>{e||v(`intro`)},4e3);return te().then(async({enabled:r,state:i})=>{if(!e){if(!r){window.clearTimeout(n),t?t():u(`/chat`,{replace:!0});return}if(!h&&i.activeRunId)try{let t=await w(i.activeRunId);e||(window.clearTimeout(n),Z(t));return}catch{}e||(window.clearTimeout(n),v(`intro`))}}).catch(t=>{window.clearTimeout(n),e||(B(X(t)),v(`intro`))}),()=>{e=!0,window.clearTimeout(n)}},[Z,u,t,h]),(0,G.useEffect)(()=>{if(!F||_!==`running`||me)return;let e=!1,t=async()=>{try{let t=await w(F.id);e||Z(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===F.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[Z,me,_,F]);let Ye=async()=>{R(!0);try{await b()}finally{t?t():u(`/chat`,{replace:!0})}},Xe=async()=>{if(S){R(!0),B(null),q([]),ve({current:0,total:0});try{let e=S.remoteModel?`remote_allowed`:`local_only`;await D(S.canonicalRootPath,e);let t=await re(S.canonicalRootPath);Z(t),O.getState().collectSources(t.id,[...Y],e)}catch(e){B(X(e)),v(`consent`)}finally{R(!1)}}},Ze=(e,t,r=!1)=>{let i=new URLSearchParams;t&&i.set(`draft`,t),t&&r&&i.set(`autoSend`,`1`);let a=i.toString();n?.(),u(`/chat/${encodeURIComponent(e)}${a?`?${a}`:``}`)},Qe=e=>{I(e),se(!1),e.status===`completed`?v(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?v(`error`):v(`running`)},$e=async()=>{if(!F)return;Te.current=!0;let e=await C(F.id);Z(e)},et=()=>{n?.(),u(`/chat`)},tt=()=>{if(S){Xe();return}Je()},nt=()=>{v(S?`consent`:ce.length?`candidates`:`intro`)},rt=async(e,t)=>{if(!F)return;await k(F.id,e.id).catch(()=>{});let n=t?`${r===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${e.actionPrompt}`:e.actionPrompt;Ze(F.conversationId,n)},it=async(e,t)=>{if(!F)return!1;R(!0),B(null);try{let n=await y(F.id,e,t);return I(n),qe(n),v(`recommendation`),!0}catch(e){return B(X(e)),!1}finally{R(!1)}},at=async(e,t)=>{if(!F)return!1;R(!0),B(null);try{let n=await y(F.id,t,t===`corrected`?e:void 0);return I(n),qe(n),Ze(F.conversationId,e,!0),!0}catch(e){return B(X(e)),!1}finally{R(!1)}},$=F?.result?.suggestions.find(e=>e.id===F.result?.primarySuggestionId)??F?.result?.suggestions[0],ot=F?.result?.suggestions.filter(e=>e.id!==$?.id)??[],st=e=>e===`command`?i.riskCommand:e===`file_write`?i.riskFileWrite:i.riskAnalysis,ct=pe.filter(e=>e?.status===`completed`),lt=e&&_===`candidates`,ut=ct.length>1?(0,J.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,J.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:i.analysisResults}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ct.map(e=>{let t=ce.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,J.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===F?.id?`bg-accent text-on-accent`:`bg-surface-hover text-fg hover:bg-surface-active`}`,onClick:()=>Qe(e),children:t},e.id)})})]}):null;return(0,J.jsxs)(`div`,{className:e?`xopc-work-discovery-experience relative flex h-full min-h-0 flex-1 flex-col overflow-hidden`:`xopc-work-discovery-experience relative flex min-h-full flex-1 flex-col`,children:[(0,J.jsxs)(`main`,{className:e?`app-main-surface xopc-work-discovery-stage xopc-onboarding-scroll relative z-10 mx-auto my-3 flex min-h-0 w-[calc(100%_-_1.5rem)] ${_===`recognition`?`max-w-[58rem]`:`max-w-[46rem]`} flex-1 flex-col rounded-xl bg-surface-panel px-5 py-7 shadow-surface sm:my-4 sm:w-[calc(100%_-_2rem)] sm:px-8 sm:py-9 ${lt?`overflow-hidden`:`overflow-y-auto`}`:`app-main-surface mx-auto my-4 flex w-[calc(100%_-_2rem)] ${_===`recognition`?`max-w-[58rem]`:`max-w-[40rem]`} flex-1 flex-col rounded-xl bg-surface-panel px-5 py-10 shadow-surface sm:px-8 sm:py-16`,children:[_===`intro`?(0,J.jsx)(`div`,{className:H(`flex items-center justify-center`,e?`mb-7 sm:mb-9`:`mb-10`),children:(0,J.jsx)(le,{className:`size-28`,mood:`curious`})}):null,_===`loading`?(0,J.jsxs)(`section`,{className:`mx-auto flex min-h-[32rem] w-full max-w-md flex-1 flex-col items-center justify-center text-center`,"aria-busy":!0,"aria-label":i.loading,children:[(0,J.jsx)(oe,{className:`size-14 rounded-xl`}),(0,J.jsx)(oe,{className:`mt-7 h-5 w-44 rounded-full`}),(0,J.jsx)(oe,{className:`mt-3 h-3.5 w-64 max-w-full rounded-full`})]}):null,_===`intro`?(0,J.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,J.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,J.jsx)(`p`,{className:`mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:i.sourceStepEyebrow}),(0,J.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:i.title}),(0,J.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:i.subtitle})]}),(0,J.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[be.length?(0,J.jsxs)(`div`,{className:`mb-5 overflow-hidden rounded-xl border border-edge bg-surface-panel text-left shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`px-4 py-3.5`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:i.localSourcesTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i.localSourcesSubtitle})]}),(0,J.jsx)(`div`,{className:`grid border-t border-edge-subtle sm:grid-cols-2`,children:be.map(e=>{let t=Y.has(e.id);return(0,J.jsxs)(`button`,{type:`button`,className:H(`flex min-h-12 items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3 text-left text-sm transition-colors last:border-b-0 sm:[&:nth-last-child(-n+2)]:border-b-0 sm:[&:nth-child(odd)]:border-r`,t?`bg-accent-soft/55 text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":t,onClick:()=>Ue(e.id),children:[(0,J.jsx)(`span`,{className:`truncate font-medium`,children:e.displayName}),(0,J.jsx)(`span`,{className:H(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors`,t?`border-accent bg-accent text-on-accent`:`border-edge`),children:t?(0,J.jsx)(f,{className:`size-3`,"aria-hidden":!0}):null})]},e.id)})})]}):null,(0,J.jsxs)(U,{type:`button`,variant:`primary`,className:`h-12 w-full gap-2`,onClick:()=>void We(),disabled:L||Q.picking,children:[L?(0,J.jsx)(P,{className:`size-4 animate-spin`}):(0,J.jsx)(V,{className:`size-4`}),i.quickScan]}),(0,J.jsxs)(U,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:Q.pick,disabled:L||Q.picking,children:[Q.picking?(0,J.jsx)(P,{className:`size-4 animate-spin`}):(0,J.jsx)(j,{className:`size-4`}),i.chooseFolderManually]}),(0,J.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,J.jsx)(V,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,J.jsx)(`span`,{children:i.quickScanNote})]}),z?(0,J.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:z}):null]}),(0,J.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void Ye(),disabled:L,children:i.skip})]}):null,_===`candidates`?(0,J.jsxs)(`section`,{className:e?`flex h-full min-h-0 flex-col`:void 0,"aria-labelledby":`work-discovery-candidates-title`,children:[(0,J.jsxs)(`div`,{className:e?`shrink-0 text-center`:`text-center`,children:[(0,J.jsx)(`p`,{className:`mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:i.sourceStepEyebrow}),(0,J.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:i.candidatesTitle}),(0,J.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:i.candidatesSubtitle})]}),(0,J.jsx)(`div`,{className:e?`xopc-onboarding-scroll mt-5 min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1`:`mt-7 space-y-2`,children:ce.map((e,t)=>{let n=K.has(e.rootPath);return(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":n,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${n?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Ge(e.rootPath),children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${n?`border-accent bg-accent text-on-accent`:`border-edge bg-surface-base text-transparent`}`,children:(0,J.jsx)(f,{className:`size-3.5`})}),(0,J.jsx)(j,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),t===0?(0,J.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:i.recommendedCandidate}):null]}),(0,J.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,J.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,J.jsx)(`span`,{children:e.projectKind===`coding`?i.codingProject:e.projectKind===`general`?i.generalProject:i.unknownProject}),e.branch?(0,J.jsx)(`span`,{children:i.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,J.jsx)(`span`,{children:i.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,J.jsxs)(`div`,{className:e?`shrink-0 border-t border-edge-subtle pt-4`:void 0,children:[(0,J.jsxs)(`div`,{className:`${e?``:`mt-5 `}flex items-start gap-2 rounded-xl bg-surface-hover/70 px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,J.jsx)(V,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,J.jsxs)(`span`,{children:[i.multiFolderPrivacyNote,` `,M?.remoteModel?i.providerDisclosure.replace(`{{provider}}`,M.provider):i.localDisclosure]})]}),z?(0,J.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:z}):null,(0,J.jsxs)(`div`,{className:`${e?`mt-4`:`mt-7`} flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,J.jsx)(U,{type:`button`,variant:`primary`,className:`h-11 flex-1`,disabled:L||K.size===0,onClick:()=>v(`connectors`),children:i.continueToConnectors}),(0,J.jsx)(U,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:L,onClick:Q.pick,children:i.chooseFolderManually})]}),(0,J.jsx)(`button`,{type:`button`,className:`${e?`mt-3`:`mt-6`} mx-auto block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>v(`intro`),children:i.back})]})]}):null,_===`consent`&&S?(0,J.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(`p`,{className:`mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:i.sourceStepEyebrow}),(0,J.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:i.selectedTitle}),(0,J.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:i.selectedSubtitle})]}),(0,J.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,J.jsx)(j,{className:`size-5 shrink-0 text-accent-fg`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:S.displayName}),(0,J.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:S.canonicalRootPath})]}),(0,J.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:S.projectKind===`coding`?i.codingProject:S.projectKind===`general`?i.generalProject:i.unknownProject})]}),(0,J.jsxs)(`div`,{className:`grid gap-4 border-b border-edge-subtle bg-surface-base/35 p-4 sm:grid-cols-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.localFingerprint}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:S.fingerprint.branch?i.branchValue.replace(`{{branch}}`,S.fingerprint.branch):i.noGitBranch})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.recentActivity}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:i.changedFiles.replace(`{{count}}`,String(S.fingerprint.changedFileCount))})]}),S.fingerprint.recentAreas.length>0?(0,J.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.recentAreas}),(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:S.fingerprint.recentAreas.map(e=>(0,J.jsx)(`code`,{className:`rounded-md bg-surface-hover px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,J.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,J.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,J.jsx)(A,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:i.willRead}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.willReadValue})]})]}),(0,J.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,J.jsx)(ae,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:i.willIgnore}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.willIgnoreValue})]})]}),(0,J.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,J.jsx)(V,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,J.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:S.remoteModel?i.providerDisclosure.replace(`{{provider}}`,S.provider):i.localDisclosure})]})]})]}),z?(0,J.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:z}):null,(0,J.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,J.jsx)(U,{type:`button`,variant:`primary`,className:`h-11 flex-1`,disabled:L,onClick:()=>v(`connectors`),children:i.continueToConnectors}),(0,J.jsx)(U,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:L,onClick:Q.pick,children:i.changeFolder})]}),(0,J.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void Ye(),children:i.skip})]}):null,_===`connectors`?(0,J.jsx)(ke,{busy:L,onBack:nt,onContinue:tt,onSkip:()=>void Ye(),onConnectedSignalsChange:we}):null,_===`running`&&F?(0,J.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(`p`,{className:`mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:i.understandingStepEyebrow}),(0,J.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:i.analyzingTitle}),(0,J.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:i.analyzingSubtitle}),_e.total>1?(0,J.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:i.analyzingFolderProgress.replace(`{{current}}`,String(_e.current)).replace(`{{total}}`,String(_e.total))}):null]}),(0,J.jsx)(ye,{signals:He,ariaLabel:i.sourceSignals.ariaLabel,centerLabel:i.sourceSignals.centerLabel}),(0,J.jsx)(`div`,{className:`xopc-understanding-progress mx-auto mt-6 grid max-w-[34rem] grid-cols-3 gap-2`,children:Re.map((e,t)=>{let n=Math.max(0,Re.indexOf(F.stage??`folder_structure`)),r=t<n,a=t===n;return(0,J.jsxs)(`div`,{className:`xopc-understanding-step min-w-0 text-left`,"data-active":a||void 0,"data-complete":r||void 0,children:[(0,J.jsx)(`span`,{className:H(`block h-1 rounded-full`,a||r?`bg-accent`:`bg-surface-hover`)}),(0,J.jsx)(`span`,{className:H(`mt-2 block text-[11px] leading-4`,a?`font-medium text-fg`:`text-fg-muted`),children:i.stages[e]})]},e)})}),(0,J.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:F.rootPath}),(0,J.jsx)(`p`,{className:`mx-auto mt-4 max-w-lg text-center text-xs leading-5 text-fg-muted`,children:i.backgroundChoiceHint}),(0,J.jsxs)(`div`,{className:`mx-auto mt-5 flex max-w-md flex-col gap-3`,children:[(0,J.jsx)(U,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:et,children:i.continueInBackground}),(0,J.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void $e(),children:i.cancelAnalysis})]})]}):null,_===`recognition`&&F?.result?(0,J.jsx)(he,{run:F,language:r,busy:L,error:z,onFinish:it,onStartConversation:at},F.id):null,_===`recommendation`&&F?.result&&$?(0,J.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:i.understandingConfirmed}),(0,J.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:i.primaryRecommendationTitle})]}),ut,(0,J.jsx)(`article`,{className:`mt-7 rounded-xl border border-edge bg-surface-panel p-5 shadow-surface sm:p-7`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg-muted`,children:(0,J.jsx)(m,{className:`size-5`})}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:$.title}),(0,J.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:$.rationale}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-hover px-2.5 py-1 text-fg-muted`,children:[(0,J.jsx)(ee,{className:`size-3.5`}),i.estimatedMinutes.replace(`{{count}}`,String($.estimatedMinutes))]}),(0,J.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-fg-muted`,children:st($.risk)})]}),(0,J.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.expectedTask}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:$.expectedTask})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,J.jsx)(U,{variant:`primary`,className:`h-10 px-4`,onClick:()=>void rt($,!1),children:i.startRecommendedAction}),(0,J.jsx)(U,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void rt($,!0),children:i.explainFirst})]})]})]})}),ot.length>0?(0,J.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>se(e=>!e),children:[i.otherDirections,(0,J.jsx)(p,{className:`size-4 transition-transform ${ie?`rotate-180`:``}`})]}),ie?(0,J.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:ot.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void rt(e,!0),children:[(0,J.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedTask})]})]},e.id))}):null]}):null,(0,J.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Ze(F.conversationId),children:i.doSomethingElse}),(0,J.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>v(`recognition`),children:i.correctUnderstanding})]})]}):null,_===`error`&&F?(0,J.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,J.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,J.jsx)(ae,{className:`size-5`})}),(0,J.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:i.errorTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:F.errorMessage}),(0,J.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,J.jsx)(U,{variant:`primary`,className:`h-11 flex-1`,onClick:()=>void x(F.id).then(Z),children:i.retry}),(0,J.jsx)(U,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{I(null),T(null),v(`intro`)},children:i.chooseDifferent})]}),(0,J.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Ze(F.conversationId),children:i.openConversation})]}):null]},_),Q.hasNativePicker?null:(0,J.jsx)(g,{open:Q.modalOpen,onOpenChange:Q.setModalOpen,initialAbsolutePath:S?.canonicalRootPath,onConfirm:Q.confirmPick,wd:l})]})}export{Le as n,W as r,Ve as t};
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{_ as a,f as o}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as s}from"./locale-store-Dy0B0XDJ.js";import{t as c}from"./messages-Bj6DCoic.js";import{t as l}from"./createLucideIcon-DPHK1VkS.js";import{t as u}from"./service-recommendation-list-Dm5GcMRy.js";import{t as d}from"./calendar-days-hw_Y-g-s.js";import{t as f}from"./check-DUBLcKHA.js";import{t as p}from"./chevron-down-ccbiQQz_.js";import{t as m}from"./chevron-right-BweFrslA.js";import{i as h,t as g}from"./working-directory-picker-modal-DX6bRmkQ.js";import{t as _}from"./circle-check-C23XjkUj.js";import{t as ee}from"./clock-3-DnrAnuyZ.js";import{t as v}from"./database-CjjeZfRG.js";import{a as te,c as ne,d as re,f as y,i as b,l as x,m as S,n as C,o as w,p as T,r as E,s as D,t as O,u as k}from"./understanding-activity-store-BDBAkksk.js";import{t as A}from"./file-text-D12HbeVy.js";import{t as j}from"./folder-open-CyzJ19I9.js";import{t as M}from"./git-branch-Dh9uxTot.js";import{t as N}from"./list-todo-CTVRto8O.js";import{t as P}from"./loader-circle-CifKLtgG.js";import{t as F}from"./messages-square-BckAJrEW.js";import{n as I,s as L,t as R}from"./install-connector-dialog-st2O1bez.js";import{t as z}from"./plug-zap-L8NMe3Sv.js";import{t as B}from"./plus-Q2yW6OE7.js";import{t as V}from"./shield-check-BU58siTV.js";import{t as ie}from"./sparkles-DHlfQFAF.js";import{t as ae}from"./x-B_N4OPjy.js";import{t as H}from"./cn-0WouolD0.js";import{t as oe}from"./skeleton-DzdOeGYz.js";import{t as U}from"./button-C5tRaJxt.js";import{a as se,r as ce}from"./connectors-api-B27sJ651.js";import{t as le}from"./loopi-CNtmi9FU.js";import{t as ue}from"./use-directory-picker-C4p7AgWY.js";var W=l(`book-open-text`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M16 12h2`,key:`7q9ll5`}],[`path`,{d:`M16 8h2`,key:`msurwy`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}],[`path`,{d:`M6 12h2`,key:`32wvfc`}],[`path`,{d:`M6 8h2`,key:`30oboj`}]]),G=e(n(),1),K=new Set([`completed`,`failed`,`canceled`]);function de(){return new Promise(e=>window.setTimeout(e,1200))}async function fe(e,t){let n=[],r=t.wait??de;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!K.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var pe=r();function q(e,t){let n=e.result?.conversationStarter?.trim();if(n)return n;let r=e.result?.suggestions.find(t=>t.id===e.result?.primarySuggestionId)??e.result?.suggestions[0];if(r?.actionPrompt.trim())return r.actionPrompt.trim();let i=e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return t===`zh`?`请先结合 ${i} 当前目录和最近变更,帮我说明这个项目在做什么、现在最值得关注什么,以及建议我下一步从哪里开始。`:`Help me understand ${i}: explain what this project is doing, what matters most right now, and where I should start next.`}var J=i(),me={zh:{eyebrow:`当前理解`,summaryTitle:`我理解的是这样`,summaryQuestion:`可以继续,也可以随时修改。`,matches:`准确,继续`,adjust:`修改`,why:`查看依据`,evidenceHint:`这些内容只用于本次判断。`,current:`当前`,ongoing:`持续`,longTerm:`长期`,correctionTitle:`告诉我正确的重点`,correctionPlaceholder:`你现在真正想推进什么?`,continueWithCorrection:`按此继续`,starterTitle:`从这里开始`,starterHint:`可以修改后直接开始对话。`,startConversation:`进入对话`,cancel:`取消`},en:{eyebrow:`Current understanding`,summaryTitle:`Here’s how I understand it`,summaryQuestion:`Continue, or adjust this anytime.`,matches:`Accurate, continue`,adjust:`Edit`,why:`View sources`,evidenceHint:`These sources are only used for this assessment.`,current:`Current`,ongoing:`Ongoing`,longTerm:`Long term`,correctionTitle:`Tell me the right focus`,correctionPlaceholder:`What do you want to move forward right now?`,continueWithCorrection:`Continue`,starterTitle:`Start here`,starterHint:`Edit this if needed, then start the conversation.`,startConversation:`Start conversation`,cancel:`Cancel`}};function he(e){let t=(0,pe.c)(84),{run:n,language:r,busy:i,error:a,onFinish:o,onStartConversation:s}=e,c=me[r],l=n.result?.lowConfidence===!0,u;t[0]!==r||t[1]!==n?(u=q(n,r),t[0]=r,t[1]=n,t[2]=u):u=t[2];let d=u,[f,m]=(0,G.useState)(l),[h,g]=(0,G.useState)(l?d:``),[_,ee]=(0,G.useState)(!1),[v,te]=(0,G.useState)(!1),[ne,re]=(0,G.useState)(!1),y,b,x,S,C,w,T,E,D,O,k,A;if(t[3]!==i||t[4]!==v||t[5]!==h||t[6]!==f||t[7]!==a||t[8]!==ne||t[9]!==o||t[10]!==s||t[11]!==n.result||t[12]!==c.current||t[13]!==c.evidenceHint||t[14]!==c.eyebrow||t[15]!==c.longTerm||t[16]!==c.ongoing||t[17]!==c.summaryTitle||t[18]!==c.why){let e=n.result?.workThreads?.slice(0,3)??[],r=n.result?.suggestions.find(e=>e.id===n.result?.primarySuggestionId)??n.result?.suggestions[0],l;t[31]!==h||t[32]!==o?(l=async e=>{ee(!0),await o(e,e===`corrected`?h.trim():void 0)||ee(!1)},t[31]=h,t[32]=o,t[33]=l):l=t[33],y=l;let u;t[34]!==h||t[35]!==s?(u=async()=>{let e=h.trim();e&&(te(!0),await s(e,`corrected`)||te(!1))},t[34]=h,t[35]=s,t[36]=u):u=t[36],b=u,x=`xopc-understanding-reveal flex min-h-full flex-1 flex-col`,S=`polite`,D=`xopc-reveal-scene mx-auto flex w-full max-w-[40rem] flex-1 flex-col justify-center py-6 text-center sm:py-10`;let d=a?`care`:i||v?`work`:f?`listen`:`decision`;t[37]===d?O=t[38]:(O=(0,J.jsx)(le,{className:`mx-auto mb-3 size-28`,mood:d}),t[37]=d,t[38]=O),t[39]===c.eyebrow?k=t[40]:(k=(0,J.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.2em] text-accent-fg`,children:c.eyebrow}),t[39]=c.eyebrow,t[40]=k),t[41]===c.summaryTitle?A=t[42]:(A=(0,J.jsx)(`h1`,{className:`mx-auto mt-4 max-w-[34rem] text-3xl font-semibold tracking-[-0.035em] text-fg sm:text-[2.25rem]`,children:c.summaryTitle}),t[41]=c.summaryTitle,t[42]=A),C=`xopc-understanding-hero-card relative mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel px-6 py-7 text-left shadow-surface sm:px-8`,t[43]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,J.jsx)(`div`,{className:`mb-5 flex size-9 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,"aria-hidden":!0,children:(0,J.jsx)(ie,{className:`size-[1.125rem]`})}),t[43]=w):w=t[43];let m=n.result?.projectSummary;t[44]===m?T=t[45]:(T=(0,J.jsx)(`p`,{className:`relative text-lg font-medium leading-8 text-fg sm:text-xl`,children:m}),t[44]=m,t[45]=T),E=n.result?.currentState||e.length||r?.evidence.length?(0,J.jsxs)(`div`,{className:`relative mt-5 border-t border-edge-subtle pt-4`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 text-xs font-medium text-fg-muted hover:text-fg`,onClick:()=>re(_e),children:[c.why,(0,J.jsx)(p,{className:H(`size-3.5 transition-transform`,ne&&`rotate-180`)})]}),ne?(0,J.jsxs)(`div`,{className:`mt-3 space-y-3 text-xs leading-5 text-fg-muted`,children:[(0,J.jsx)(`p`,{className:`text-fg-subtle`,children:c.evidenceHint}),n.result?.currentState?(0,J.jsx)(`p`,{children:n.result.currentState}):null,e.length?(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,J.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg`,children:e.title}),` · `,e.horizon===`current`?c.current:e.horizon===`ongoing`?c.ongoing:c.longTerm]},e.id))}):null,r?.evidence.slice(0,3).map(ge)]}):null]}):null,t[3]=i,t[4]=v,t[5]=h,t[6]=f,t[7]=a,t[8]=ne,t[9]=o,t[10]=s,t[11]=n.result,t[12]=c.current,t[13]=c.evidenceHint,t[14]=c.eyebrow,t[15]=c.longTerm,t[16]=c.ongoing,t[17]=c.summaryTitle,t[18]=c.why,t[19]=y,t[20]=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]=k,t[30]=A}else y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28],k=t[29],A=t[30];let j;t[46]!==C||t[47]!==w||t[48]!==T||t[49]!==E?(j=(0,J.jsxs)(`div`,{className:C,children:[w,T,E]}),t[46]=C,t[47]=w,t[48]=T,t[49]=E,t[50]=j):j=t[50];let M;t[51]!==y||t[52]!==i||t[53]!==v||t[54]!==h||t[55]!==f||t[56]!==l||t[57]!==b||t[58]!==_||t[59]!==c.adjust||t[60]!==c.cancel||t[61]!==c.continueWithCorrection||t[62]!==c.correctionPlaceholder||t[63]!==c.correctionTitle||t[64]!==c.matches||t[65]!==c.startConversation||t[66]!==c.starterHint||t[67]!==c.starterTitle||t[68]!==c.summaryQuestion?(M=f?(0,J.jsxs)(`div`,{className:`xopc-reveal-calibration mx-auto mt-7 w-full max-w-xl rounded-xl border border-edge bg-surface-panel p-5 text-left shadow-surface`,children:[(0,J.jsx)(`label`,{className:`text-sm font-semibold text-fg`,htmlFor:`understanding-correction`,children:l?c.starterTitle:c.correctionTitle}),l?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:c.starterHint}):null,(0,J.jsx)(`textarea`,{id:`understanding-correction`,value:h,onChange:e=>g(e.target.value),placeholder:c.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,J.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[l?null:(0,J.jsx)(U,{variant:`ghost`,disabled:_,onClick:()=>m(!1),children:c.cancel}),(0,J.jsx)(U,{variant:`primary`,disabled:i||v||!h.trim(),onClick:()=>void b(),children:l?c.startConversation:c.continueWithCorrection})]})]}):(0,J.jsxs)(`div`,{className:`mx-auto mt-8 w-full max-w-sm`,children:[(0,J.jsx)(`p`,{className:`text-base font-medium text-fg`,children:c.summaryQuestion}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,J.jsx)(U,{className:`h-11 flex-1`,variant:`primary`,disabled:_,onClick:()=>void y(`confirmed`),children:c.matches}),(0,J.jsx)(U,{className:`h-11 flex-1`,variant:`secondary`,disabled:_,onClick:()=>m(!0),children:c.adjust})]})]}),t[51]=y,t[52]=i,t[53]=v,t[54]=h,t[55]=f,t[56]=l,t[57]=b,t[58]=_,t[59]=c.adjust,t[60]=c.cancel,t[61]=c.continueWithCorrection,t[62]=c.correctionPlaceholder,t[63]=c.correctionTitle,t[64]=c.matches,t[65]=c.startConversation,t[66]=c.starterHint,t[67]=c.starterTitle,t[68]=c.summaryQuestion,t[69]=M):M=t[69];let N;t[70]===a?N=t[71]:(N=a?(0,J.jsx)(`p`,{className:`mt-5 text-sm text-danger`,role:`alert`,children:a}):null,t[70]=a,t[71]=N);let P;t[72]!==j||t[73]!==M||t[74]!==N||t[75]!==D||t[76]!==O||t[77]!==k||t[78]!==A?(P=(0,J.jsxs)(`div`,{className:D,children:[O,k,A,j,M,N]}),t[72]=j,t[73]=M,t[74]=N,t[75]=D,t[76]=O,t[77]=k,t[78]=A,t[79]=P):P=t[79];let F;return t[80]!==x||t[81]!==S||t[82]!==P?(F=(0,J.jsx)(`section`,{className:x,"aria-live":S,children:P}),t[80]=x,t[81]=S,t[82]=P,t[83]=F):F=t[83],F}function ge(e,t){return(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(M,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,J.jsxs)(`span`,{children:[e.path?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${t}-${e.path??e.observation}`)}function _e(e){return!e}var ve={folder:j,file:A,recent:S,git:M,calendar:d,task:N,note:W,mail:T,message:F,service:z,data:v};function ye(e){let t=(0,pe.c)(28),{signals:n,ariaLabel:r,centerLabel:i}=e,a,o,s,c,l,u,d,f;if(t[0]!==r||t[1]!==i||t[2]!==n){let e=n.slice(0,3);a=Math.max(0,n.length-e.length),c=`xopc-source-convergence mx-auto mt-9 w-full max-w-[34rem] overflow-hidden rounded-xl border border-edge bg-surface-panel px-5 py-6 shadow-surface sm:px-6`,l=`img`,u=r;let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,J.jsx)(le,{className:`size-24`,mood:`work`}),t[11]=p):p=t[11],t[12]===i?d=t[13]:(d=(0,J.jsxs)(`div`,{className:`flex flex-col items-center text-center`,"aria-hidden":!0,children:[p,(0,J.jsx)(`span`,{className:`mt-3 text-[11px] font-semibold tracking-[0.16em] text-fg-muted`,children:i})]}),t[12]=i,t[13]=d),t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,J.jsx)(`div`,{className:`mt-5 h-1 overflow-hidden rounded-full bg-surface-hover`,"aria-hidden":!0,children:(0,J.jsx)(`span`,{className:`xopc-source-convergence-progress block h-full w-2/5 rounded-full bg-accent`})}),t[14]=f):f=t[14],o=`mt-5 divide-y divide-edge-subtle border-y border-edge-subtle`,s=e.map(be),t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f}else a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10];let p;t[15]!==o||t[16]!==s?(p=(0,J.jsx)(`div`,{className:o,children:s}),t[15]=o,t[16]=s,t[17]=p):p=t[17];let m;t[18]===a?m=t[19]:(m=a>0?(0,J.jsxs)(`p`,{className:`mt-3 text-center text-xs text-fg-muted`,"aria-hidden":!0,children:[`+`,a]}):null,t[18]=a,t[19]=m);let h;return t[20]!==c||t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f||t[25]!==p||t[26]!==m?(h=(0,J.jsxs)(`div`,{className:c,role:l,"aria-label":u,children:[d,f,p,m]}),t[20]=c,t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=p,t[26]=m,t[27]=h):h=t[27],h}function be(e){let t=ve[e.kind];return(0,J.jsxs)(`div`,{className:`flex min-h-12 items-center gap-3 py-2.5 text-left`,"aria-hidden":!0,children:[(0,J.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,J.jsx)(t,{className:`size-4`})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,title:e.detail,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.label}),e.meta?(0,J.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:e.meta}):null]}),(0,J.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-accent`})]},e.id)}var xe=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];function Y({toolkit:e,displayName:t,description:n,category:r,mode:i,bootstrapWindowDays:a,logoFileName:o=e}){return{id:`composio-${e}`,version:`sessions-v1`,displayName:t,description:n,category:r,kind:`composio`,source:`registry`,capabilities:[`tools`,`auth.oauth`,`events`,`context`,`memory_source`],benefits:[`understand`,`act`],understanding:{mode:i,bootstrapWindowDays:a,readOnly:!0},tags:[`composio`,e,`verified`],branding:{logoUrl:`/connector-icons/${o}.svg`,source:`builtin`},verificationLevel:`verified`,auth:{mode:`oauth`,provider:`composio`},setup:{},runtime:{type:`composio`,toolkit:e,role:`toolkit`},integrationStrategy:{lane:`composio`,workload:`long_tail`,preferred:!0}}}var Se=[Y({toolkit:`gmail`,displayName:`Gmail`,description:`Find and understand recent email, then draft or send with your approval.`,category:`automation`,mode:`activity`,bootstrapWindowDays:30}),Y({toolkit:`googlecalendar`,displayName:`Google Calendar`,description:`Understand your schedule and work with approved calendar events.`,category:`automation`,mode:`activity`,bootstrapWindowDays:90,logoFileName:`google-calendar`}),Y({toolkit:`googledrive`,displayName:`Google Drive`,description:`Search and understand approved files in Google Drive.`,category:`data`,mode:`inventory`,bootstrapWindowDays:90,logoFileName:`google-drive`}),Y({toolkit:`github`,displayName:`GitHub`,description:`Understand repositories, issues, pull requests, and reviews.`,category:`code`,mode:`activity`,bootstrapWindowDays:90}),Y({toolkit:`linear`,displayName:`Linear`,description:`Understand and work with Linear issues and projects.`,category:`code`,mode:`activity`,bootstrapWindowDays:60})];function Ce(e){return e.runtime.type===`composio`&&e.runtime.role===`toolkit`?e.runtime.toolkit.toLocaleLowerCase():``}function we(e){let t=new Map(xe.map((e,t)=>[e,t]));return e.filter(e=>e.understanding!=null&&Ce(e)).sort((e,n)=>(t.get(Ce(e))??2**53-1)-(t.get(Ce(n))??2**53-1)||e.displayName.localeCompare(n.displayName))}function Te(e,t){let n=new Map(e.map(e=>[e.id,e]));for(let e of t)n.set(e.id,e);return we([...n.values()])}var Ee=2500;function De(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}function Oe(e){return e===`gmail`?`mail`:e===`googlecalendar`?`calendar`:e===`googledrive`?`data`:e===`github`?`git`:e===`linear`?`task`:`service`}function ke(e){let t=(0,pe.c)(59),{busy:n,onBack:r,onContinue:i,onSkip:a,onConnectedSignalsChange:o}=e,l=s(Pe),d=c(l),f=d.onboarding.workDiscovery,m=d.connectorsSettings,[g,ee]=(0,G.useState)(Ne),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],t[0]=v):v=t[0];let[te,ne]=(0,G.useState)(v),[re,y]=(0,G.useState)(!0),[b,x]=(0,G.useState)(null),[S,C]=(0,G.useState)(!1),[w,T]=(0,G.useState)(null),E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=async()=>{let e=await se();return ne(e),e},t[1]=E):E=t[1];let D=E,O,k;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{let e=!1,t=window.setTimeout(()=>{e||y(!1)},Ee);return se().then(t=>{e||ne(t)}).catch(t=>{e||x(t instanceof Error?t.message:String(t))}).finally(()=>{e||y(!1),window.clearTimeout(t)}),ce({page:1,pageSize:24,verification:`verified`}).then(t=>{e||ee(Te(Se,t.connectors))}).catch(Me),()=>{e=!0,window.clearTimeout(t)}},k=[],t[2]=O,t[3]=k):(O=t[2],k=t[3]),(0,G.useEffect)(O,k);let A;t[4]===te?A=t[5]:(A=new Map(te.map(je)),t[4]=te,t[5]=A);let j=A,M;if(t[6]!==g||t[7]!==j){let e;t[9]===j?e=t[10]:(e=e=>{if(!De(j.get(e.id)))return[];let t=Ce(e);return[{id:e.id,label:e.displayName,kind:Oe(t)}]},t[9]=j,t[10]=e),M=g.flatMap(e),t[6]=g,t[7]=j,t[8]=M}else M=t[8];let N=M,F,z;t[11]!==N||t[12]!==o?(F=()=>{o(N)},z=[N,o],t[11]=N,t[12]=o,t[13]=F,t[14]=z):(F=t[13],z=t[14]),(0,G.useEffect)(F,z);let V;t[15]!==g||t[16]!==S?(V=S?g:g.slice(0,3),t[15]=g,t[16]=S,t[17]=V):V=t[17];let ie=V,ae=N.length,H;t[18]!==g.length||t[19]!==m||t[20]!==f.connected||t[21]!==f.noWorkServices||t[22]!==f.showFewerServices||t[23]!==f.showMoreServices||t[24]!==S||t[25]!==j||t[26]!==re||t[27]!==l||t[28]!==D||t[29]!==C||t[30]!==T||t[31]!==ie?(H=l===`zh`?(0,J.jsx)(u,{onChanged:async()=>{await D()}}):(0,J.jsxs)(J.Fragment,{children:[ie.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge-subtle bg-surface-base/55`,children:ie.map(e=>{let t=De(j.get(e.id));return(0,J.jsxs)(`article`,{className:`flex min-h-[4.75rem] items-center gap-3 px-3 py-3 sm:px-4`,children:[(0,J.jsx)(I,{connector:e,size:`sm`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.displayName}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-1 text-xs text-fg-muted`,children:e.description})]}),t?(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 text-xs font-medium text-success`,children:[(0,J.jsx)(_,{className:`size-4`}),f.connected]}):re?(0,J.jsx)(oe,{className:`h-8 w-[4.5rem] shrink-0 rounded-lg`,"aria-label":m.loading}):(0,J.jsxs)(U,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-3 text-xs`,onClick:()=>T(L(e)),children:[(0,J.jsx)(B,{className:`size-3.5`}),m.connect]})]},e.id)})}):(0,J.jsx)(`p`,{className:`rounded-xl border border-dashed border-edge px-4 py-8 text-center text-sm text-fg-muted`,children:f.noWorkServices}),g.length>3?(0,J.jsxs)(`button`,{type:`button`,className:`mx-auto mt-3 flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>C(Ae),children:[S?(0,J.jsx)(h,{className:`size-3.5`}):(0,J.jsx)(p,{className:`size-3.5`}),S?f.showFewerServices:f.showMoreServices]}):null]}),t[18]=g.length,t[19]=m,t[20]=f.connected,t[21]=f.noWorkServices,t[22]=f.showFewerServices,t[23]=f.showMoreServices,t[24]=S,t[25]=j,t[26]=re,t[27]=l,t[28]=D,t[29]=C,t[30]=T,t[31]=ie,t[32]=H):H=t[32];let le;t[33]!==f.connectorLoadFailed||t[34]!==b?(le=b?(0,J.jsxs)(`p`,{className:`mt-3 text-center text-xs text-danger`,role:`alert`,children:[f.connectorLoadFailed,`: `,b]}):null,t[33]=f.connectorLoadFailed,t[34]=b,t[35]=le):le=t[35];let ue;t[36]===n?ue=t[37]:(ue=n?(0,J.jsx)(P,{className:`size-4 animate-spin`}):null,t[36]=n,t[37]=ue);let W;t[38]!==n||t[39]!==f.startUnderstanding||t[40]!==i||t[41]!==ue?(W=(0,J.jsxs)(U,{type:`button`,variant:`primary`,className:`h-11 flex-1`,disabled:n,onClick:i,children:[ue,f.startUnderstanding]}),t[38]=n,t[39]=f.startUnderstanding,t[40]=i,t[41]=ue,t[42]=W):W=t[42];let K;t[43]!==n||t[44]!==f.back||t[45]!==r?(K=(0,J.jsx)(U,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:n,onClick:r,children:f.back}),t[43]=n,t[44]=f.back,t[45]=r,t[46]=K):K=t[46];let de;t[47]!==W||t[48]!==K?(de=(0,J.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[W,K]}),t[47]=W,t[48]=K,t[49]=de):de=t[49];let fe;t[50]!==n||t[51]!==f.skipAndEnter||t[52]!==a?(fe=(0,J.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,disabled:n,onClick:a,children:f.skipAndEnter}),t[50]=n,t[51]=f.skipAndEnter,t[52]=a,t[53]=fe):fe=t[53];let q;return t[54]!==m||t[55]!==w||t[56]!==D||t[57]!==T?(q=w?(0,J.jsx)(R,{draft:w,onChange:T,onClose:()=>T(null),t:m,onInstalled:async()=>{await D(),T(null)}}):null,t[54]=m,t[55]=w,t[56]=D,t[57]=T,t[58]=q):q=t[58],(0,J.jsxs)(`section`,{className:`mx-auto flex w-full max-w-[42rem] flex-1 flex-col`,"aria-labelledby":`work-discovery-connectors-title`,children:[(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:f.connectorStepEyebrow}),(0,J.jsx)(`h1`,{id:`work-discovery-connectors-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:f.connectorStepTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-3 max-w-[36rem] text-[0.95rem] leading-7 text-fg-muted`,children:f.connectorStepSubtitle})]}),(0,J.jsxs)(`div`,{className:`mt-7 rounded-xl border border-edge bg-surface-panel p-3 shadow-surface sm:p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1 pb-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.popularWorkServices}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.connectorsOptional})]}),ae?(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 rounded-full bg-success-soft px-2.5 py-1 text-xs font-medium text-success`,children:[(0,J.jsx)(_,{className:`size-3.5`}),f.connectedCount.replace(`{{count}}`,String(ae))]}):null]}),H,le]}),de,fe,q]})}function Ae(e){return!e}function je(e){return[e.connectorId,e]}function Me(){}function Ne(){return we(Se)}function Pe(e){return e.language}var Fe=new Set([`local-recent-files`,`chromium-bookmarks`,`apple-notes`,`apple-mail`,`apple-calendar`,`apple-reminders`]);function Ie(e){return new Set(e.filter(e=>e.availability===`available`&&Fe.has(e.id)).map(e=>e.id))}var Le=t({WorkDiscoveryPage:()=>Ve}),Re=[`folder_structure`,`recent_progress`,`next_steps`];function X(e){return e instanceof Error?e.message:String(e)}function ze(e){return e.replaceAll(`\\`,`/`).split(`/`).filter(Boolean).slice(-2).join(`/`)||e}function Be(e,t){return e.replace(`{{count}}`,String(t))}function Ve({embedded:e=!1,onRequestClose:t,onNavigateAway:n}={}){let r=s(e=>e.language),i=c(r).onboarding.workDiscovery,l=c(r).chat.workingDirectory,u=o(),[d]=a(),h=d.get(`new`)===`1`,[_,v]=(0,G.useState)(`loading`),[S,T]=(0,G.useState)(null),[M,N]=(0,G.useState)(null),[F,I]=(0,G.useState)(null),[L,R]=(0,G.useState)(!1),[z,B]=(0,G.useState)(null),[ie,se]=(0,G.useState)(!1),[ce,W]=(0,G.useState)([]),[K,de]=(0,G.useState)(()=>new Set),[pe,q]=(0,G.useState)([]),[me,ge]=(0,G.useState)(!1),[_e,ve]=(0,G.useState)({current:0,total:0}),[be,xe]=(0,G.useState)([]),[Y,Se]=(0,G.useState)(()=>new Set),[Ce,we]=(0,G.useState)([]),Te=(0,G.useRef)(!1),Ee={recent_documents:`recent`,calendar:`calendar`,tasks:`task`,notes:`note`,mail:`mail`,messages:`message`,code_activity:`git`,files:`file`},De=F?.snapshot?.projectKind??S?.projectKind,Oe=De===`coding`?i.codingProject:De===`general`?i.generalProject:De===`unknown`?i.unknownProject:null,Ae=(F?.snapshot?.files??[]).slice(0,4).map(e=>({id:`snapshot-file:${e.relativePath}`,label:ze(e.relativePath),kind:e.source===`git_change`?`recent`:`file`,meta:e.source===`git_change`?i.sourceSignals.changedFile:e.source===`document`?i.sourceSignals.contextFile:i.sourceSignals.structureFile,detail:e.relativePath})),je=F?.rootPath??S?.canonicalRootPath,Me=Ae.length===0?(S?.fingerprint.recentAreas??[]).slice(0,2).map(e=>({id:`recent-area:${e}`,label:e,kind:`recent`,meta:i.sourceSignals.recentArea,detail:e})):[],Ne=Ae.length===0?Me.length>0?Me:[{id:`project-files`,label:i.sourceSignals.projectFiles,kind:`file`,meta:i.sourceSignals.scanningFiles},{id:`recent-changes`,label:i.sourceSignals.recentChanges,kind:`recent`,meta:i.sourceSignals.checkingChanges}]:[],Pe=F?.snapshot?.sampledPathCount,Fe=[Oe,Pe==null?null:Be(i.sourceSignals.filesScanned,Pe)].filter(e=>!!e).join(` · `),Le=F?.snapshot?.branch??S?.fingerprint.branch,Ve=F?.snapshot?.changedPathCount??S?.fingerprint.changedFileCount,He=[{id:`work-folder`,label:je?ze(je):i.sourceSignals.workFolder,kind:`folder`,...Fe?{meta:Fe}:{},...je?{detail:je}:{}},...Ae,...Ne,{id:`git-state`,label:Le??i.sourceSignals.gitState,kind:`git`,...Ve==null?{}:{meta:Be(i.sourceSignals.changedFiles,Ve)},...Le?{detail:`Git · ${Le}`}:{}},...be.filter(e=>Y.has(e.id)).map(e=>({id:e.id,label:e.displayName,kind:Ee[e.category]??`data`})),...Ce],Ue=e=>{Se(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,G.useEffect)(()=>{let e=!1;return window.electronAPI?.understandingSources?.catalog().then(t=>{e||(xe(t),Se(Ie(t)))}),()=>{e=!0}},[]);let Z=(0,G.useCallback)(e=>{O.getState().updateDirectoryRun(e),I(e),e.status===`completed`?v(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?v(`error`):v(`running`)},[]),We=async()=>{R(!0),B(null);try{let e=await E();if(N(e.processingTarget),!e.candidates.length){B(i.noCandidates);return}W(e.candidates),de(new Set([e.candidates[0].rootPath])),v(`candidates`)}catch(e){B(X(e))}finally{R(!1)}},Ge=e=>{de(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ke=(0,G.useCallback)((e,t,n)=>{O.getState().updateDirectoryRun(e),I(e),ve({current:t+1,total:n}),q(n=>{let r=[...n];return r[t]=e,r}),v(`running`)},[]),qe=(0,G.useCallback)(e=>{q(t=>t.map(t=>t?.id===e.id?e:t))},[]),Je=async()=>{let e=ce.filter(e=>K.has(e.rootPath));if(!e.length)return;R(!0),B(null),q([]),ve({current:1,total:e.length}),ge(!0),Te.current=!1;let t=!1,n=M?.remoteModel?`remote_allowed`:`local_only`;try{let r=await fe(e,{grantDirectory:e=>D(e,n),startRun:re,fetchRun:w,shouldStop:()=>Te.current,onRun:(e,r,i)=>{Ke(e,r,i),t||(t=!0,O.getState().collectSources(e.id,[...Y],n))},onError:(t,n,r)=>{ve({current:r+1,total:e.length}),B(i.folderAnalysisFailed.replace(`{{folder}}`,n.displayName).replace(`{{error}}`,X(t)))}});if(Te.current)return;let a=r.find(e=>e.status===`completed`)??r.at(-1);a?Z(a):v(`candidates`)}catch(e){B(X(e)),v(`candidates`)}finally{ge(!1),R(!1)}},Q=ue({onPicked:(0,G.useCallback)(async e=>{R(!0),B(null);try{let t=await ne(e);T(t),N({provider:t.provider,remoteModel:t.remoteModel}),v(`consent`)}catch(e){B(X(e)),v(`intro`)}finally{R(!1)}},[])});(0,G.useEffect)(()=>{if(!h){let e=O.getState().directoryRun;if(e){Z(e);return}}let e=!1,n=window.setTimeout(()=>{e||v(`intro`)},4e3);return te().then(async({enabled:r,state:i})=>{if(!e){if(!r){window.clearTimeout(n),t?t():u(`/chat`,{replace:!0});return}if(!h&&i.activeRunId)try{let t=await w(i.activeRunId);e||(window.clearTimeout(n),Z(t));return}catch{}e||(window.clearTimeout(n),v(`intro`))}}).catch(t=>{window.clearTimeout(n),e||(B(X(t)),v(`intro`))}),()=>{e=!0,window.clearTimeout(n)}},[Z,u,t,h]),(0,G.useEffect)(()=>{if(!F||_!==`running`||me)return;let e=!1,t=async()=>{try{let t=await w(F.id);e||Z(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===F.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[Z,me,_,F]);let Ye=async()=>{R(!0);try{await b()}finally{t?t():u(`/chat`,{replace:!0})}},Xe=async()=>{if(S){R(!0),B(null),q([]),ve({current:0,total:0});try{let e=S.remoteModel?`remote_allowed`:`local_only`;await D(S.canonicalRootPath,e);let t=await re(S.canonicalRootPath);Z(t),O.getState().collectSources(t.id,[...Y],e)}catch(e){B(X(e)),v(`consent`)}finally{R(!1)}}},Ze=(e,t,r=!1)=>{let i=new URLSearchParams;t&&i.set(`draft`,t),t&&r&&i.set(`autoSend`,`1`);let a=i.toString();n?.(),u(`/chat/${encodeURIComponent(e)}${a?`?${a}`:``}`)},Qe=e=>{I(e),se(!1),e.status===`completed`?v(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?v(`error`):v(`running`)},$e=async()=>{if(!F)return;Te.current=!0;let e=await C(F.id);Z(e)},et=()=>{n?.(),u(`/chat`)},tt=()=>{if(S){Xe();return}Je()},nt=()=>{v(S?`consent`:ce.length?`candidates`:`intro`)},rt=async(e,t)=>{if(!F)return;await k(F.id,e.id).catch(()=>{});let n=t?`${r===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${e.actionPrompt}`:e.actionPrompt;Ze(F.conversationId,n)},it=async(e,t)=>{if(!F)return!1;R(!0),B(null);try{let n=await y(F.id,e,t);return I(n),qe(n),v(`recommendation`),!0}catch(e){return B(X(e)),!1}finally{R(!1)}},at=async(e,t)=>{if(!F)return!1;R(!0),B(null);try{let n=await y(F.id,t,t===`corrected`?e:void 0);return I(n),qe(n),Ze(F.conversationId,e,!0),!0}catch(e){return B(X(e)),!1}finally{R(!1)}},$=F?.result?.suggestions.find(e=>e.id===F.result?.primarySuggestionId)??F?.result?.suggestions[0],ot=F?.result?.suggestions.filter(e=>e.id!==$?.id)??[],st=e=>e===`command`?i.riskCommand:e===`file_write`?i.riskFileWrite:i.riskAnalysis,ct=pe.filter(e=>e?.status===`completed`),lt=e&&_===`candidates`,ut=ct.length>1?(0,J.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,J.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:i.analysisResults}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ct.map(e=>{let t=ce.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,J.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===F?.id?`bg-accent text-on-accent`:`bg-surface-hover text-fg hover:bg-surface-active`}`,onClick:()=>Qe(e),children:t},e.id)})})]}):null;return(0,J.jsxs)(`div`,{className:e?`xopc-work-discovery-experience relative flex h-full min-h-0 flex-1 flex-col overflow-hidden`:`xopc-work-discovery-experience relative flex min-h-full flex-1 flex-col`,children:[(0,J.jsxs)(`main`,{className:e?`app-main-surface xopc-work-discovery-stage xopc-onboarding-scroll relative z-10 mx-auto my-3 flex min-h-0 w-[calc(100%_-_1.5rem)] ${_===`recognition`?`max-w-[58rem]`:`max-w-[46rem]`} flex-1 flex-col rounded-xl bg-surface-panel px-5 py-7 shadow-surface sm:my-4 sm:w-[calc(100%_-_2rem)] sm:px-8 sm:py-9 ${lt?`overflow-hidden`:`overflow-y-auto`}`:`app-main-surface mx-auto my-4 flex w-[calc(100%_-_2rem)] ${_===`recognition`?`max-w-[58rem]`:`max-w-[40rem]`} flex-1 flex-col rounded-xl bg-surface-panel px-5 py-10 shadow-surface sm:px-8 sm:py-16`,children:[_===`intro`?(0,J.jsx)(`div`,{className:H(`flex items-center justify-center`,e?`mb-7 sm:mb-9`:`mb-10`),children:(0,J.jsx)(le,{className:`size-28`,mood:`curious`})}):null,_===`loading`?(0,J.jsxs)(`section`,{className:`mx-auto flex min-h-[32rem] w-full max-w-md flex-1 flex-col items-center justify-center text-center`,"aria-busy":!0,"aria-label":i.loading,children:[(0,J.jsx)(oe,{className:`size-14 rounded-xl`}),(0,J.jsx)(oe,{className:`mt-7 h-5 w-44 rounded-full`}),(0,J.jsx)(oe,{className:`mt-3 h-3.5 w-64 max-w-full rounded-full`})]}):null,_===`intro`?(0,J.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,J.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,J.jsx)(`p`,{className:`mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:i.sourceStepEyebrow}),(0,J.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:i.title}),(0,J.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:i.subtitle})]}),(0,J.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[be.length?(0,J.jsxs)(`div`,{className:`mb-5 overflow-hidden rounded-xl border border-edge bg-surface-panel text-left shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`px-4 py-3.5`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:i.localSourcesTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i.localSourcesSubtitle})]}),(0,J.jsx)(`div`,{className:`grid border-t border-edge-subtle sm:grid-cols-2`,children:be.map(e=>{let t=Y.has(e.id);return(0,J.jsxs)(`button`,{type:`button`,className:H(`flex min-h-12 items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3 text-left text-sm transition-colors last:border-b-0 sm:[&:nth-last-child(-n+2)]:border-b-0 sm:[&:nth-child(odd)]:border-r`,t?`bg-accent-soft/55 text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":t,onClick:()=>Ue(e.id),children:[(0,J.jsx)(`span`,{className:`truncate font-medium`,children:e.displayName}),(0,J.jsx)(`span`,{className:H(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors`,t?`border-accent bg-accent text-on-accent`:`border-edge`),children:t?(0,J.jsx)(f,{className:`size-3`,"aria-hidden":!0}):null})]},e.id)})})]}):null,(0,J.jsxs)(U,{type:`button`,variant:`primary`,className:`h-12 w-full gap-2`,onClick:()=>void We(),disabled:L||Q.picking,children:[L?(0,J.jsx)(P,{className:`size-4 animate-spin`}):(0,J.jsx)(V,{className:`size-4`}),i.quickScan]}),(0,J.jsxs)(U,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:Q.pick,disabled:L||Q.picking,children:[Q.picking?(0,J.jsx)(P,{className:`size-4 animate-spin`}):(0,J.jsx)(j,{className:`size-4`}),i.chooseFolderManually]}),(0,J.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,J.jsx)(V,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,J.jsx)(`span`,{children:i.quickScanNote})]}),z?(0,J.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:z}):null]}),(0,J.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void Ye(),disabled:L,children:i.skip})]}):null,_===`candidates`?(0,J.jsxs)(`section`,{className:e?`flex h-full min-h-0 flex-col`:void 0,"aria-labelledby":`work-discovery-candidates-title`,children:[(0,J.jsxs)(`div`,{className:e?`shrink-0 text-center`:`text-center`,children:[(0,J.jsx)(`p`,{className:`mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:i.sourceStepEyebrow}),(0,J.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:i.candidatesTitle}),(0,J.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:i.candidatesSubtitle})]}),(0,J.jsx)(`div`,{className:e?`xopc-onboarding-scroll mt-5 min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1`:`mt-7 space-y-2`,children:ce.map((e,t)=>{let n=K.has(e.rootPath);return(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":n,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${n?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Ge(e.rootPath),children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${n?`border-accent bg-accent text-on-accent`:`border-edge bg-surface-base text-transparent`}`,children:(0,J.jsx)(f,{className:`size-3.5`})}),(0,J.jsx)(j,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),t===0?(0,J.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:i.recommendedCandidate}):null]}),(0,J.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,J.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,J.jsx)(`span`,{children:e.projectKind===`coding`?i.codingProject:e.projectKind===`general`?i.generalProject:i.unknownProject}),e.branch?(0,J.jsx)(`span`,{children:i.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,J.jsx)(`span`,{children:i.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,J.jsxs)(`div`,{className:e?`shrink-0 border-t border-edge-subtle pt-4`:void 0,children:[(0,J.jsxs)(`div`,{className:`${e?``:`mt-5 `}flex items-start gap-2 rounded-xl bg-surface-hover/70 px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,J.jsx)(V,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,J.jsxs)(`span`,{children:[i.multiFolderPrivacyNote,` `,M?.remoteModel?i.providerDisclosure.replace(`{{provider}}`,M.provider):i.localDisclosure]})]}),z?(0,J.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:z}):null,(0,J.jsxs)(`div`,{className:`${e?`mt-4`:`mt-7`} flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,J.jsx)(U,{type:`button`,variant:`primary`,className:`h-11 flex-1`,disabled:L||K.size===0,onClick:()=>v(`connectors`),children:i.continueToConnectors}),(0,J.jsx)(U,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:L,onClick:Q.pick,children:i.chooseFolderManually})]}),(0,J.jsx)(`button`,{type:`button`,className:`${e?`mt-3`:`mt-6`} mx-auto block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>v(`intro`),children:i.back})]})]}):null,_===`consent`&&S?(0,J.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(`p`,{className:`mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:i.sourceStepEyebrow}),(0,J.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:i.selectedTitle}),(0,J.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:i.selectedSubtitle})]}),(0,J.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,J.jsx)(j,{className:`size-5 shrink-0 text-accent-fg`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:S.displayName}),(0,J.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:S.canonicalRootPath})]}),(0,J.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:S.projectKind===`coding`?i.codingProject:S.projectKind===`general`?i.generalProject:i.unknownProject})]}),(0,J.jsxs)(`div`,{className:`grid gap-4 border-b border-edge-subtle bg-surface-base/35 p-4 sm:grid-cols-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.localFingerprint}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:S.fingerprint.branch?i.branchValue.replace(`{{branch}}`,S.fingerprint.branch):i.noGitBranch})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.recentActivity}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:i.changedFiles.replace(`{{count}}`,String(S.fingerprint.changedFileCount))})]}),S.fingerprint.recentAreas.length>0?(0,J.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.recentAreas}),(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:S.fingerprint.recentAreas.map(e=>(0,J.jsx)(`code`,{className:`rounded-md bg-surface-hover px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,J.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,J.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,J.jsx)(A,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:i.willRead}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.willReadValue})]})]}),(0,J.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,J.jsx)(ae,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:i.willIgnore}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.willIgnoreValue})]})]}),(0,J.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,J.jsx)(V,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,J.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:S.remoteModel?i.providerDisclosure.replace(`{{provider}}`,S.provider):i.localDisclosure})]})]})]}),z?(0,J.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:z}):null,(0,J.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,J.jsx)(U,{type:`button`,variant:`primary`,className:`h-11 flex-1`,disabled:L,onClick:()=>v(`connectors`),children:i.continueToConnectors}),(0,J.jsx)(U,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:L,onClick:Q.pick,children:i.changeFolder})]}),(0,J.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void Ye(),children:i.skip})]}):null,_===`connectors`?(0,J.jsx)(ke,{busy:L,onBack:nt,onContinue:tt,onSkip:()=>void Ye(),onConnectedSignalsChange:we}):null,_===`running`&&F?(0,J.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(`p`,{className:`mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:i.understandingStepEyebrow}),(0,J.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:i.analyzingTitle}),(0,J.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:i.analyzingSubtitle}),_e.total>1?(0,J.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:i.analyzingFolderProgress.replace(`{{current}}`,String(_e.current)).replace(`{{total}}`,String(_e.total))}):null]}),(0,J.jsx)(ye,{signals:He,ariaLabel:i.sourceSignals.ariaLabel,centerLabel:i.sourceSignals.centerLabel}),(0,J.jsx)(`div`,{className:`xopc-understanding-progress mx-auto mt-6 grid max-w-[34rem] grid-cols-3 gap-2`,children:Re.map((e,t)=>{let n=Math.max(0,Re.indexOf(F.stage??`folder_structure`)),r=t<n,a=t===n;return(0,J.jsxs)(`div`,{className:`xopc-understanding-step min-w-0 text-left`,"data-active":a||void 0,"data-complete":r||void 0,children:[(0,J.jsx)(`span`,{className:H(`block h-1 rounded-full`,a||r?`bg-accent`:`bg-surface-hover`)}),(0,J.jsx)(`span`,{className:H(`mt-2 block text-[11px] leading-4`,a?`font-medium text-fg`:`text-fg-muted`),children:i.stages[e]})]},e)})}),(0,J.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:F.rootPath}),(0,J.jsx)(`p`,{className:`mx-auto mt-4 max-w-lg text-center text-xs leading-5 text-fg-muted`,children:i.backgroundChoiceHint}),(0,J.jsxs)(`div`,{className:`mx-auto mt-5 flex max-w-md flex-col gap-3`,children:[(0,J.jsx)(U,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:et,children:i.continueInBackground}),(0,J.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void $e(),children:i.cancelAnalysis})]})]}):null,_===`recognition`&&F?.result?(0,J.jsx)(he,{run:F,language:r,busy:L,error:z,onFinish:it,onStartConversation:at},F.id):null,_===`recommendation`&&F?.result&&$?(0,J.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:i.understandingConfirmed}),(0,J.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:i.primaryRecommendationTitle})]}),ut,(0,J.jsx)(`article`,{className:`mt-7 rounded-xl border border-edge bg-surface-panel p-5 shadow-surface sm:p-7`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg-muted`,children:(0,J.jsx)(m,{className:`size-5`})}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:$.title}),(0,J.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:$.rationale}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-hover px-2.5 py-1 text-fg-muted`,children:[(0,J.jsx)(ee,{className:`size-3.5`}),i.estimatedMinutes.replace(`{{count}}`,String($.estimatedMinutes))]}),(0,J.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-fg-muted`,children:st($.risk)})]}),(0,J.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.expectedTask}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:$.expectedTask})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,J.jsx)(U,{variant:`primary`,className:`h-10 px-4`,onClick:()=>void rt($,!1),children:i.startRecommendedAction}),(0,J.jsx)(U,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void rt($,!0),children:i.explainFirst})]})]})]})}),ot.length>0?(0,J.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>se(e=>!e),children:[i.otherDirections,(0,J.jsx)(p,{className:`size-4 transition-transform ${ie?`rotate-180`:``}`})]}),ie?(0,J.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:ot.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void rt(e,!0),children:[(0,J.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedTask})]})]},e.id))}):null]}):null,(0,J.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Ze(F.conversationId),children:i.doSomethingElse}),(0,J.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>v(`recognition`),children:i.correctUnderstanding})]})]}):null,_===`error`&&F?(0,J.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,J.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,J.jsx)(ae,{className:`size-5`})}),(0,J.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:i.errorTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:F.errorMessage}),(0,J.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,J.jsx)(U,{variant:`primary`,className:`h-11 flex-1`,onClick:()=>void x(F.id).then(Z),children:i.retry}),(0,J.jsx)(U,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{I(null),T(null),v(`intro`)},children:i.chooseDifferent})]}),(0,J.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Ze(F.conversationId),children:i.openConversation})]}):null]},_),Q.hasNativePicker?null:(0,J.jsx)(g,{open:Q.modalOpen,onOpenChange:Q.setModalOpen,initialAbsolutePath:S?.canonicalRootPath,onConfirm:Q.confirmPick,wd:l})]})}export{Le as n,W as r,Ve as t};