@xopcai/xopc 0.0.476 → 0.0.477

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 (288) hide show
  1. package/dist/browser-ext/dist/assets/{auth-CKIyOA1a.js → auth-B658Oa_i.js} +2 -1
  2. package/dist/browser-ext/dist/background.js +1 -1
  3. package/dist/browser-ext/dist/sidepanel.html +1 -1
  4. package/dist/browser-ext/dist/sidepanel.js +1 -1
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/dingtalk/xopc.extension.json +10 -4
  7. package/dist/extensions/discord/xopc.extension.json +9 -3
  8. package/dist/extensions/slack/xopc.extension.json +10 -4
  9. package/dist/extensions/telegram/xopc.extension.json +1 -1
  10. package/dist/extensions/wecom/xopc.extension.json +10 -4
  11. package/dist/gateway/server/chunks.bin +739 -686
  12. package/dist/gateway/server/chunks.json +1 -1
  13. package/dist/gateway/static/root/assets/af-CYmDZ4fF-CZxsvT2y.js +1 -0
  14. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-Bicuh10_.js → agent-defaults-settings-panel-rc9N1-Xr.js} +1 -1
  15. package/dist/gateway/static/root/assets/{agent-plugin-dialog-hRZYhcLp.js → agent-plugin-dialog-D8zi6y5l.js} +1 -1
  16. package/dist/gateway/static/root/assets/{agents-C2DH8M4z.js → agents-D3Kx5DCA.js} +3 -3
  17. package/dist/gateway/static/root/assets/{app-management-settings-panel-BrO0gY6b.js → app-management-settings-panel-CGIFJmRj.js} +1 -1
  18. package/dist/gateway/static/root/assets/{appearance-settings-h82Or0g-.js → appearance-settings-CNy2QkvT.js} +1 -1
  19. package/dist/gateway/static/root/assets/{apps-page-B9Ho8S53.js → apps-page-BWSZCO1g.js} +1 -1
  20. package/dist/gateway/static/root/assets/as-Hwl1DGzz-F6qyW8uH.js +1 -0
  21. package/dist/gateway/static/root/assets/{automation-run-list-CLjSIujK.js → automation-run-list-BzKslhcr.js} +1 -1
  22. package/dist/gateway/static/root/assets/{automation-task-card-BS-RT312.js → automation-task-card-f5_tNbzB.js} +2 -2
  23. package/dist/gateway/static/root/assets/{automations-page-BL6ASYrU.js → automations-page-DT6lvXDX.js} +1 -1
  24. package/dist/gateway/static/root/assets/{automations-workspace-BFk-AF43.js → automations-workspace-uq7eZeoX.js} +4 -4
  25. package/dist/gateway/static/root/assets/be-BgqsjH7X-BYVdQd18.js +1 -0
  26. package/dist/gateway/static/root/assets/bg-Dr9AqrKw-B5xv6TfF.js +1 -0
  27. package/dist/gateway/static/root/assets/{block-editor-Dtz8JtrO.js → block-editor-BIAtRF39.js} +1 -1
  28. package/dist/gateway/static/root/assets/bn-CSXZX5iN-BGS6_hxH.js +1 -0
  29. package/dist/gateway/static/root/assets/{browser-settings-page-CDUHHu0n.js → browser-settings-page-C2Jx09LX.js} +3 -3
  30. package/dist/gateway/static/root/assets/{button-ChmVQg9O.js → button-C5tRaJxt.js} +1 -1
  31. package/dist/gateway/static/root/assets/ca-IXHA7IHe-DrduLk3W.js +1 -0
  32. package/dist/gateway/static/root/assets/capabilities-page-DgQ9OosE.js +2 -0
  33. package/dist/gateway/static/root/assets/{capabilities-settings-panel-ComYXaP1.js → capabilities-settings-panel-BjiHKpmd.js} +2 -2
  34. package/dist/gateway/static/root/assets/{capability-header-actions-BfLcB3Kh.js → capability-header-actions-Ck3ILShB.js} +1 -1
  35. package/dist/gateway/static/root/assets/{channels-Aa2Iun4r.js → channels-C9AQ0m77.js} +1 -1
  36. package/dist/gateway/static/root/assets/{chat-chart-block-DA2S21y2.js → chat-chart-block-BNmGrz2N.js} +1 -1
  37. package/dist/gateway/static/root/assets/chat-page-CJiXMjMM.js +72 -0
  38. package/dist/gateway/static/root/assets/{chat-terminal-dock-BALrP7_l.js → chat-terminal-dock-Bndihzyb.js} +1 -1
  39. package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-BPb7KheU.js → chunk-KS7C4IRE-DbzE-1bp.js} +1 -1
  40. package/dist/gateway/static/root/assets/composer-attachment-handoff-LTJZHQTE.js +1 -0
  41. package/dist/gateway/static/root/assets/{composer-model-config-control-BFC8jNyK.js → composer-model-config-control-Bnx68cDQ.js} +1 -1
  42. package/dist/gateway/static/root/assets/{computer-settings-page-CVWaJ3L8.js → computer-settings-page-MMiCgCEw.js} +1 -1
  43. package/dist/gateway/static/root/assets/{confirm-dialog-DkviAS5j.js → confirm-dialog-MHCmEEUZ.js} +1 -1
  44. package/dist/gateway/static/root/assets/{connected-providers-grid-NZP4qb6S.js → connected-providers-grid-BPydj2zS.js} +1 -1
  45. package/dist/gateway/static/root/assets/{connection-usage-guide-BNoFtMol.js → connection-usage-guide-CHGPjgHg.js} +1 -1
  46. package/dist/gateway/static/root/assets/{connector-service-page-CzrdJ4JY.js → connector-service-page-CjH7WEIw.js} +1 -1
  47. package/dist/gateway/static/root/assets/{connectors-page-BUqNvStL.js → connectors-page-aIaFZHw3.js} +1 -1
  48. package/dist/gateway/static/root/assets/cop-B5tK6J-Z-Dw82IjCr.js +1 -0
  49. package/dist/gateway/static/root/assets/{copy-text-row-BnSoJ0FX.js → copy-text-row-gqdh0Bg1.js} +1 -1
  50. package/dist/gateway/static/root/assets/cs-5GDhZ_Ce-BI5q4aVA.js +1 -0
  51. package/dist/gateway/static/root/assets/cu-BSm1hoGS-BRCy0UAr.js +1 -0
  52. package/dist/gateway/static/root/assets/cy-C9DIxPZF-Cag4snSk.js +1 -0
  53. package/dist/gateway/static/root/assets/da-BsG0TGcE-BWliw5hZ.js +1 -0
  54. package/dist/gateway/static/root/assets/{date-picker-DgTDENzF.js → date-picker-BWrSxZf1.js} +1 -1
  55. package/dist/gateway/static/root/assets/{date-time-picker-Gw4oSOk9.js → date-time-picker-Zhl9Yyzk.js} +1 -1
  56. package/dist/gateway/static/root/assets/de-1901-qqf2iWLB-BlgpCKr2.js +1 -0
  57. package/dist/gateway/static/root/assets/de-1996-LtGglqob-BjfWxQKM.js +1 -0
  58. package/dist/gateway/static/root/assets/de-ch-1901-COn1CKDv-_Xg3_np3.js +1 -0
  59. package/dist/gateway/static/root/assets/{dependency-picker-BJDpQtKY.js → dependency-picker-clYjcOx9.js} +1 -1
  60. package/dist/gateway/static/root/assets/{desktop-pet-BbIPYbvc.js → desktop-pet-CGRfEFeD.js} +1 -1
  61. package/dist/gateway/static/root/assets/{desktop-pet-settings-Cqzplufb.js → desktop-pet-settings-CUVZPqVA.js} +1 -1
  62. package/dist/gateway/static/root/assets/{device-pairing-wizard-DXFZiWMi.js → device-pairing-wizard-C62Ooz-T.js} +1 -1
  63. package/dist/gateway/static/root/assets/{directory-picker-path-field-DVFEzTAJ.js → directory-picker-path-field-3z5dHj8K.js} +1 -1
  64. package/dist/gateway/static/root/assets/{dist-GJ8-1PAx.js → dist-BSVQC3i_.js} +1 -1
  65. package/dist/gateway/static/root/assets/{dist-CxGUk8J-.js → dist-CDSvxjOh.js} +1 -1
  66. package/dist/gateway/static/root/assets/dist-DSRLZhL9.js +1 -0
  67. package/dist/gateway/static/root/assets/dist-DaFr5KMw.js +1 -0
  68. package/dist/gateway/static/root/assets/{dist-CY7CS_D3.js → dist-DlirbHVs.js} +1 -1
  69. package/dist/gateway/static/root/assets/el-monoton-pORtlC9P-CuqNQIvE.js +1 -0
  70. package/dist/gateway/static/root/assets/el-polyton-CDXn9JCY-B5J5pGHR.js +1 -0
  71. package/dist/gateway/static/root/assets/en-gb-BGHhUzDC-COWGBqwJ.js +1 -0
  72. package/dist/gateway/static/root/assets/es-PSvYPNjB-CnHE1eri.js +1 -0
  73. package/dist/gateway/static/root/assets/es2015-CFqg57eW.js +41 -0
  74. package/dist/gateway/static/root/assets/et-CYUTaVWy-H7jVbiHv.js +1 -0
  75. package/dist/gateway/static/root/assets/eu-CRNA9JLT-D1jw9zt8.js +1 -0
  76. package/dist/gateway/static/root/assets/{extension-authoritative-grants-DAfeCx4B.js → extension-authoritative-grants-DIZxVVMM.js} +1 -1
  77. package/dist/gateway/static/root/assets/{extension-debug-page-gW4GEEcj.js → extension-debug-page-D_-TPLjn.js} +1 -1
  78. package/dist/gateway/static/root/assets/{extension-iframe-host-DOPywUKI.js → extension-iframe-host-DQOKplxT.js} +1 -1
  79. package/dist/gateway/static/root/assets/{extension-message-router-TTAx3dPv.js → extension-message-router-Ccwjadyk.js} +1 -1
  80. package/dist/gateway/static/root/assets/{extension-page-Iq7vFC-g.js → extension-page-CmntX-Iw.js} +1 -1
  81. package/dist/gateway/static/root/assets/{extension-provider-BNnLkq95.js → extension-provider-niliLEmM.js} +1 -1
  82. package/dist/gateway/static/root/assets/{extension-settings-page-C0oLjaz6.js → extension-settings-page-Doi9Trxg.js} +1 -1
  83. package/dist/gateway/static/root/assets/fi-DNiE_U0X-mParSSSy.js +1 -0
  84. package/dist/gateway/static/root/assets/{floating-ui.dom-seOukHzT.js → floating-ui.dom-CiMnRY5O.js} +1 -1
  85. package/dist/gateway/static/root/assets/floating-ui.react-dom-Gx6CM22l.js +1 -0
  86. package/dist/gateway/static/root/assets/fr-BIgh4Hkw-Dc1KqFHa.js +1 -0
  87. package/dist/gateway/static/root/assets/fur-CoXvgQfx-tJv2icDr.js +1 -0
  88. package/dist/gateway/static/root/assets/ga-D54K6YtG-CDuqe3gr.js +1 -0
  89. package/dist/gateway/static/root/assets/{gateway-realtime-CfceJ5WX.js → gateway-realtime-BoJ3r2zr.js} +1 -1
  90. package/dist/gateway/static/root/assets/{gateway-restart-Dsg95Dwt.js → gateway-restart-L0ri15AO.js} +1 -1
  91. package/dist/gateway/static/root/assets/{gateway-settings-CMgry8RK.js → gateway-settings--jcl4PYh.js} +1 -1
  92. package/dist/gateway/static/root/assets/gl-Cx_3wrqA-D9_oxkqv.js +1 -0
  93. package/dist/gateway/static/root/assets/grc-gFF6GbE6-DANBReIg.js +1 -0
  94. package/dist/gateway/static/root/assets/gu-9bPoO3RA-COW9d1dt.js +1 -0
  95. package/dist/gateway/static/root/assets/hi-GilZHMjg-CiihDo6Q.js +1 -0
  96. package/dist/gateway/static/root/assets/{home-page-pT-lEQsu.js → home-page-DbLvAmzw.js} +4 -4
  97. package/dist/gateway/static/root/assets/hr-DowcKODH-D_vEJhf2.js +1 -0
  98. package/dist/gateway/static/root/assets/hsb-D_AuBPC_-kb5QeNH1.js +1 -0
  99. package/dist/gateway/static/root/assets/hu-DghCDVxq-Ct1fysVO.js +1 -0
  100. package/dist/gateway/static/root/assets/hy-UUaeTG5g-Cjfrs2ZM.js +1 -0
  101. package/dist/gateway/static/root/assets/ia-CvHYTdA2-B1i9kDPT.js +1 -0
  102. package/dist/gateway/static/root/assets/id-Dpxs7amD-C3Hzl2m4.js +1 -0
  103. package/dist/gateway/static/root/assets/{image-generation-api-DDHOD0Nx.js → image-generation-api-D63Vak-S.js} +1 -1
  104. package/dist/gateway/static/root/assets/{imports-page-BxRXNvQx.js → imports-page-CWr0KA9K.js} +1 -1
  105. package/dist/gateway/static/root/assets/index-CEXEV_TY.css +1 -0
  106. package/dist/gateway/static/root/assets/{index-DdEh8KeB.js → index-DynjhZRv.js} +7 -7
  107. package/dist/gateway/static/root/assets/{install-connector-dialog-Rox2_5eU.js → install-connector-dialog-DyscHGNB.js} +1 -1
  108. package/dist/gateway/static/root/assets/is-CJ1vxS9j-DWEBuJpb.js +1 -0
  109. package/dist/gateway/static/root/assets/it-CpWMQzhA-HiFRunf5.js +1 -0
  110. package/dist/gateway/static/root/assets/ka-CCxCVfU6-BU45urC7.js +1 -0
  111. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D7xlV7xT.js → keyboard-shortcuts-settings-BNxKXzTr.js} +1 -1
  112. package/dist/gateway/static/root/assets/kmr-dEjewOAw-DfPyPgkK.js +1 -0
  113. package/dist/gateway/static/root/assets/kn-Bjy8QS2v-BuXzi7S-.js +1 -0
  114. package/dist/gateway/static/root/assets/la-AGdXyFmb-Bwiuou7l.js +1 -0
  115. package/dist/gateway/static/root/assets/la-x-classic-DcM9aTVI-aO_2QO0y.js +1 -0
  116. package/dist/gateway/static/root/assets/la-x-liturgic-DZCmbwFj-BpDOy20C.js +1 -0
  117. package/dist/gateway/static/root/assets/{local-app-workbench-page-ReBczGac.js → local-app-workbench-page-BB-y__CE.js} +1 -1
  118. package/dist/gateway/static/root/assets/{local-apps-page-Ct07GT0V.js → local-apps-page-kllqJoU6.js} +1 -1
  119. package/dist/gateway/static/root/assets/{logs-page-CtEv5J4C.js → logs-page-DALkj_7O.js} +1 -1
  120. package/dist/gateway/static/root/assets/lt-CN8ITi7t-B3cgXplB.js +1 -0
  121. package/dist/gateway/static/root/assets/lv-C-JuXj31-CLjYDJHB.js +1 -0
  122. package/dist/gateway/static/root/assets/{management-settings-BjvQ4WiZ.js → management-settings-DVjgxWhD.js} +1 -1
  123. package/dist/gateway/static/root/assets/{markdown-view-C7kqotD-.js → markdown-view-BpBBv9Gr.js} +2 -2
  124. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-DfbMmlmC.js → mcp-conversation-setup-page-Cr7uXvcG.js} +1 -1
  125. package/dist/gateway/static/root/assets/ml-BM2UBzMU-Ct0js8Am.js +1 -0
  126. package/dist/gateway/static/root/assets/mn-cyrl-CyRDZzA3-DN6sz9R4.js +1 -0
  127. package/dist/gateway/static/root/assets/mn-cyrl-x-lmc-DbCWj2Po-BJqn49ay.js +1 -0
  128. package/dist/gateway/static/root/assets/{model-selector-BP-t33vd.js → model-selector-RNPw-Mz4.js} +1 -1
  129. package/dist/gateway/static/root/assets/mr-BrkCTYf9-DGtESPcG.js +1 -0
  130. package/dist/gateway/static/root/assets/mul-ethi-D9YZ9OXl-D6ioGuYP.js +1 -0
  131. package/dist/gateway/static/root/assets/nb-DgKeJnSd-BfDSp4tN.js +1 -0
  132. package/dist/gateway/static/root/assets/{new-chat-navigation-BA1IB3hy.js → new-chat-navigation-DM_HUSZ1.js} +1 -1
  133. package/dist/gateway/static/root/assets/nl-BIDJBXRA-8_OIBsy0.js +1 -0
  134. package/dist/gateway/static/root/assets/nn-C4Gas4NI-BWT83oy8.js +1 -0
  135. package/dist/gateway/static/root/assets/no-CSP8-4c2-Cjg1mxae.js +1 -0
  136. package/dist/gateway/static/root/assets/{note-detail-panel-DAhIT6xP.js → note-detail-panel-DQOIB0cU.js} +3 -3
  137. package/dist/gateway/static/root/assets/note-image-lightbox-BQyXXJCE.js +1 -0
  138. package/dist/gateway/static/root/assets/{notes-api-B3Kc4909.js → notes-api-ChV_6O5I.js} +1 -1
  139. package/dist/gateway/static/root/assets/notes-page-BBUD12wy.js +8 -0
  140. package/dist/gateway/static/root/assets/{oauth-provider-connect-3QGibJMl.js → oauth-provider-connect-BgWyUbhu.js} +1 -1
  141. package/dist/gateway/static/root/assets/oc-CyJ2Q9k9-W5_I63nO.js +1 -0
  142. package/dist/gateway/static/root/assets/or-DUhKxVse-Cf5-bcl5.js +1 -0
  143. package/dist/gateway/static/root/assets/pa-NDvVySYt-Bj-XExX_.js +1 -0
  144. package/dist/gateway/static/root/assets/{page-context-capture-button-Bd__UBi9.js → page-context-capture-button-CNyjLpFG.js} +1 -1
  145. package/dist/gateway/static/root/assets/{personal-page-DHik8uj6.js → personal-page-dGPy_J7M.js} +1 -1
  146. package/dist/gateway/static/root/assets/{personal-profile-settings-Cd2xUVbw.js → personal-profile-settings-BlsS-2z3.js} +1 -1
  147. package/dist/gateway/static/root/assets/{personal-settings-panel-CHRra9hc.js → personal-settings-panel-D1W09VMR.js} +1 -1
  148. package/dist/gateway/static/root/assets/{phone-dependencies-card-CREmmRxI.js → phone-dependencies-card-CRABVjt1.js} +1 -1
  149. package/dist/gateway/static/root/assets/{phone-model-connection-BDzr9jXL.js → phone-model-connection-DtBRZXUN.js} +1 -1
  150. package/dist/gateway/static/root/assets/{phone-model-picker-DSQF-RxW.js → phone-model-picker-D3U9iAQo.js} +1 -1
  151. package/dist/gateway/static/root/assets/{phone-settings-page-gP5kr3VO.js → phone-settings-page-ClS7YSnU.js} +1 -1
  152. package/dist/gateway/static/root/assets/pi-znB0BT6g-o9084kBf.js +1 -0
  153. package/dist/gateway/static/root/assets/pl-CaFvP4tu-Bv_p-a9x.js +1 -0
  154. package/dist/gateway/static/root/assets/{plugin-details-dialog-43jCnG5n.js → plugin-details-dialog-DGW2QQJC.js} +1 -1
  155. package/dist/gateway/static/root/assets/pms-92V70vZ4-DfOt2RSi.js +1 -0
  156. package/dist/gateway/static/root/assets/{popover-select-CLsphyzA.js → popover-select-hRG1EzAY.js} +1 -1
  157. package/dist/gateway/static/root/assets/{preference-select-fields-VqtR_pOy.js → preference-select-fields-PZsYT8Db.js} +1 -1
  158. package/dist/gateway/static/root/assets/{preview-runtime-MJUo7XlD.js → preview-runtime-D9y0frrZ.js} +2 -2
  159. package/dist/gateway/static/root/assets/{product-automation-feedback-D43XiQq6.js → product-automation-feedback-W6rFx449.js} +1 -1
  160. package/dist/gateway/static/root/assets/product-open-page-CcJ0dC84.js +1 -0
  161. package/dist/gateway/static/root/assets/{product-preview-content-CkQebfi-.js → product-preview-content-CsdXwIxP.js} +1 -1
  162. package/dist/gateway/static/root/assets/product-preview-modal-CIe5WW9E.js +2 -0
  163. package/dist/gateway/static/root/assets/{project-detail-page-BBF8eVJa.js → project-detail-page-b6pU7eLQ.js} +2 -2
  164. package/dist/gateway/static/root/assets/{project-understanding-BScfv1pD.js → project-understanding-ClhKlj0g.js} +1 -1
  165. package/dist/gateway/static/root/assets/{projects-page-BCMWrLGf.js → projects-page-Bi9Ke76p.js} +1 -1
  166. package/dist/gateway/static/root/assets/pt-BKB_-X0N-CrkeeQaZ.js +1 -0
  167. package/dist/gateway/static/root/assets/{recording-upload-Yy9r6kHe.js → recording-upload-BjZ5SwXZ.js} +1 -1
  168. package/dist/gateway/static/root/assets/{refresh-button-D6ihZgH3.js → refresh-button-DX7bULU5.js} +1 -1
  169. package/dist/gateway/static/root/assets/{remote-access-hub-BeG8Bgy0.js → remote-access-hub-aSIeyTxn.js} +1 -1
  170. package/dist/gateway/static/root/assets/{resource-unavailable-Dccp_uis.js → resource-unavailable-BZVJxGR8.js} +1 -1
  171. package/dist/gateway/static/root/assets/rm-C1letx81-CNhvXnnG.js +1 -0
  172. package/dist/gateway/static/root/assets/ro-BUzliR9z-Bov_DAVD.js +1 -0
  173. package/dist/gateway/static/root/assets/route-preload-D36bLXpD.js +2 -0
  174. package/dist/gateway/static/root/assets/routine-panel-lfYWKBuW.js +2 -0
  175. package/dist/gateway/static/root/assets/ru-B591x1qT-DLdM0nWP.js +1 -0
  176. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-C7sHr-Lm.js → runtime-tools-settings-panel-DxYZLgVT.js} +1 -1
  177. package/dist/gateway/static/root/assets/sa-JnsT9B1R-CvBCyoRG.js +1 -0
  178. package/dist/gateway/static/root/assets/{schema-form-DXHzZPMr.js → schema-form-DkuIsCBU.js} +1 -1
  179. package/dist/gateway/static/root/assets/{service-recommendation-list-Bz9QWUZc.js → service-recommendation-list-BjuL2TaI.js} +1 -1
  180. package/dist/gateway/static/root/assets/{session-manager-fvJusKsK.js → session-manager-1UFhZMpv.js} +1 -1
  181. package/dist/gateway/static/root/assets/{sessions-page-DS-OExY1.js → sessions-page-CeCaW2FJ.js} +1 -1
  182. package/dist/gateway/static/root/assets/{settings-advanced-section-BsqgVQL3.js → settings-advanced-section-YRzA9yeq.js} +1 -1
  183. package/dist/gateway/static/root/assets/{settings-page-header-DKgbD0Bc.js → settings-page-header-C9xiCwzq.js} +1 -1
  184. package/dist/gateway/static/root/assets/{settings-page-layout-BE3vLWp_.js → settings-page-layout-DTOBegnh.js} +1 -1
  185. package/dist/gateway/static/root/assets/{settings-page-B_8kxJQW.js → settings-page-ngcjiqfd.js} +1 -1
  186. package/dist/gateway/static/root/assets/{setup-interaction-page-DLpGv0yp.js → setup-interaction-page-CnC-hC-A.js} +1 -1
  187. package/dist/gateway/static/root/assets/{setup-status-panel-BMaFUPnt.js → setup-status-panel-lAyDbUa1.js} +1 -1
  188. package/dist/gateway/static/root/assets/sh-cyrl-CLuomLGP-UY09gie6.js +1 -0
  189. package/dist/gateway/static/root/assets/sh-latn-DdZKFFaE-De-tA-2J.js +1 -0
  190. package/dist/gateway/static/root/assets/{share-link-dialog-3RNzFIH3.js → share-link-dialog-QvDZwWwI.js} +1 -1
  191. package/dist/gateway/static/root/assets/share-preview-page-7PohUauw.js +2 -0
  192. package/dist/gateway/static/root/assets/{shares-settings-C_ITdQqP.js → shares-settings-DpIh1naz.js} +1 -1
  193. package/dist/gateway/static/root/assets/sk-A3STIA2C-DC8Al4lF.js +1 -0
  194. package/dist/gateway/static/root/assets/{skills-page-B30SsJL6.js → skills-page-CRrTQOth.js} +1 -1
  195. package/dist/gateway/static/root/assets/sl-DjmW7S7C-B8FnrXi1.js +1 -0
  196. package/dist/gateway/static/root/assets/space-BPnfqDsQ.js +1 -0
  197. package/dist/gateway/static/root/assets/space-api-D4zPeS-a.js +1 -0
  198. package/dist/gateway/static/root/assets/space-page-DV-4mGaH.js +2 -0
  199. package/dist/gateway/static/root/assets/space-workbook-CtUQSd5l.js +291 -0
  200. package/dist/gateway/static/root/assets/space-workbook-CvOADsEJ.css +1 -0
  201. package/dist/gateway/static/root/assets/space-workbook-format-D1PqIvbd.js +1 -0
  202. package/dist/gateway/static/root/assets/space-workbook-import.worker-Bw2gfMG9.js +68 -0
  203. package/dist/gateway/static/root/assets/sr-cyrl-DzA2myNl-yGc0Jz1j.js +1 -0
  204. package/dist/gateway/static/root/assets/sv-B01JFt6B-DeQDoAsB.js +1 -0
  205. package/dist/gateway/static/root/assets/{system-settings-panel-KXLPpyOW.js → system-settings-panel-jgzBYOji.js} +1 -1
  206. package/dist/gateway/static/root/assets/ta-biPP5NX3-B5_ztYXp.js +1 -0
  207. package/dist/gateway/static/root/assets/{task-detail-page-DHYm_bsg.js → task-detail-page-qTnkErT0.js} +3 -3
  208. package/dist/gateway/static/root/assets/{task-header-title-Buwr7WTV.js → task-header-title-CRfK-rhR.js} +1 -1
  209. package/dist/gateway/static/root/assets/{task-result-evidence-DpV1mZJA.js → task-result-evidence-C2gEC9Hr.js} +1 -1
  210. package/dist/gateway/static/root/assets/te-DdPqCRaf-BjTOzs5s.js +1 -0
  211. package/dist/gateway/static/root/assets/th-C4s1cxFT-CFfNau1h.js +1 -0
  212. package/dist/gateway/static/root/assets/{time-picker-C1PXAXZF.js → time-picker-otHjbob1.js} +1 -1
  213. package/dist/gateway/static/root/assets/tk-BfqDjfTh-UHPz-lif.js +1 -0
  214. package/dist/gateway/static/root/assets/tr-C2sIij-w-DvQDK0dA.js +1 -0
  215. package/dist/gateway/static/root/assets/{tracing-settings-page-CcyPoojp.js → tracing-settings-page-7DxhxIp3.js} +1 -1
  216. package/dist/gateway/static/root/assets/{tunnel-api-D713CJ9R.js → tunnel-api-CZJEfJym.js} +1 -1
  217. package/dist/gateway/static/root/assets/uk-DBx0redY-DGVpthWV.js +1 -0
  218. package/dist/gateway/static/root/assets/{usage-page-DN1TcxWS.js → usage-page-CVJBXy2I.js} +1 -1
  219. package/dist/gateway/static/root/assets/{use-composer-attachments-4FKbf6PB.js → use-composer-attachments-Cs9sRfEz.js} +1 -1
  220. package/dist/gateway/static/root/assets/use-file-preview-expanded-B7Kp4Y1f.js +1 -0
  221. package/dist/gateway/static/root/assets/use-generated-media-UvehLoUl.js +1 -0
  222. package/dist/gateway/static/root/assets/{use-personal-work-srLCZOam.js → use-personal-work-eUnPoS9h.js} +1 -1
  223. package/dist/gateway/static/root/assets/{use-realtime-voice-tyo85cre.js → use-realtime-voice-CJD_ABL6.js} +1 -1
  224. package/dist/gateway/static/root/assets/{use-workspace-tree-VwHdfiR8.js → use-workspace-tree-BYrp8lL7.js} +1 -1
  225. package/dist/gateway/static/root/assets/{user-model-page-D-F5GO3T.js → user-model-page-s8sYPQwS.js} +2 -2
  226. package/dist/gateway/static/root/assets/{voice-player-store-DyuAAbk0.js → voice-player-store-DwAnvFVJ.js} +1 -1
  227. package/dist/gateway/static/root/assets/{voice-settings-DOajN2ay.js → voice-settings-WIooh0DA.js} +1 -1
  228. package/dist/gateway/static/root/assets/{work-discovery-overlay-CTLp1-tu.js → work-discovery-overlay-WGm3tfRV.js} +1 -1
  229. package/dist/gateway/static/root/assets/{work-discovery-page-B-UzFKIr.js → work-discovery-page-DLXUm21d.js} +1 -1
  230. package/dist/gateway/static/root/assets/{working-directory-picker-modal-DvVtUxHW.js → working-directory-picker-modal-BwmhPsrY.js} +1 -1
  231. package/dist/gateway/static/root/assets/{workspace-api-CIfedJeG.js → workspace-api-DEPruUJB.js} +2 -2
  232. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-iAz_WyiN.js +1 -0
  233. package/dist/gateway/static/root/assets/{workspace-open-location-menu-sbOva_RI.js → workspace-open-location-menu-CbQ5vUV7.js} +1 -1
  234. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BYuMOGaK.js → xopc-cloud-account-card-ClAhPUT1.js} +1 -1
  235. package/dist/gateway/static/root/assets/zh-latn-pinyin-CIit9tZA-CW52gdb_.js +1 -0
  236. package/dist/gateway/static/root/dependency-records.json +1251 -205
  237. package/dist/gateway/static/root/index.html +65 -62
  238. package/dist/package.js +1 -1
  239. package/dist/packages/gateway-contract/src/space.js +5 -2
  240. package/dist/packages/gateway-contract/src/user-message-display.js +6 -1
  241. package/dist/packages/realtime-protocol/src/index.js +4 -2
  242. package/dist/src/agent/inbound/attachment-pipeline.js +15 -6
  243. package/dist/src/agent/mcp/conversation-setup.js +9 -6
  244. package/dist/src/agent/skills/marketplace/search.d.ts +1 -0
  245. package/dist/src/agent/skills/marketplace/search.js +1 -0
  246. package/dist/src/agent/tools/capability-catalog-tool.js +1 -1
  247. package/dist/src/agent/tools/factory.js +3 -3
  248. package/dist/src/capabilities/capability-catalog.d.ts +4 -0
  249. package/dist/src/capabilities/capability-catalog.js +46 -15
  250. package/dist/src/channels/catalog/channel-catalog-service.js +2 -3
  251. package/dist/src/endpoint-tools/registry.d.ts +2 -1
  252. package/dist/src/endpoint-tools/registry.js +5 -3
  253. package/dist/src/endpoint-tools/runtime.d.ts +1 -1
  254. package/dist/src/endpoint-tools/runtime.js +2 -2
  255. package/dist/src/extensions/agent-plugins/mcp-adapter.js +15 -2
  256. package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -1
  257. package/dist/src/gateway/hono/routes/mobile-capability-actions.d.ts +1 -1
  258. package/dist/src/gateway/hono/routes/mobile-capability-actions.js +20 -10
  259. package/dist/src/gateway/hono/routes/mobile-capability-panels.d.ts +20 -0
  260. package/dist/src/gateway/hono/routes/mobile-capability-panels.js +1523 -0
  261. package/dist/src/gateway/hono/routes/space.js +18 -0
  262. package/dist/src/gateway/security/gateway-scopes.js +5 -1
  263. package/dist/src/realtime/runtime.js +1 -1
  264. package/dist/src/session/session-title.js +4 -5
  265. package/dist/src/space/budget-workbook.d.ts +47 -0
  266. package/dist/src/space/budget-workbook.js +210 -0
  267. package/dist/src/space/repository.d.ts +1 -1
  268. package/dist/src/space/repository.js +24 -5
  269. package/dist/src/tunnel/tunnel-service.d.ts +5 -0
  270. package/dist/src/tunnel/tunnel-service.js +131 -30
  271. package/package.json +1 -1
  272. package/dist/gateway/static/root/assets/capabilities-page-D9EpUcuB.js +0 -2
  273. package/dist/gateway/static/root/assets/chat-page-BbahuZ59.js +0 -72
  274. package/dist/gateway/static/root/assets/dist-BuHnPloF.js +0 -1
  275. package/dist/gateway/static/root/assets/dist-ZrL34Ps4.js +0 -1
  276. package/dist/gateway/static/root/assets/es2015-DBLcMg5B.js +0 -41
  277. package/dist/gateway/static/root/assets/index-BtHMU5k4.css +0 -1
  278. package/dist/gateway/static/root/assets/note-image-lightbox-DrVGs1eQ.js +0 -1
  279. package/dist/gateway/static/root/assets/notes-page-zAJJ2OiQ.js +0 -8
  280. package/dist/gateway/static/root/assets/product-open-page-CQMoDCO1.js +0 -1
  281. package/dist/gateway/static/root/assets/product-preview-modal-DToUA1EF.js +0 -2
  282. package/dist/gateway/static/root/assets/route-preload-Bl10PwKS.js +0 -2
  283. package/dist/gateway/static/root/assets/routine-panel-BjqenuXU.js +0 -2
  284. package/dist/gateway/static/root/assets/share-preview-page-C49EIXte.js +0 -2
  285. package/dist/gateway/static/root/assets/space-page-DmvjU1jc.js +0 -2
  286. package/dist/gateway/static/root/assets/use-file-preview-expanded-CRBn6UTd.js +0 -1
  287. package/dist/gateway/static/root/assets/use-generated-media-CEJ5BBxX.js +0 -1
  288. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-Xi5feqPq.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{u as i}from"./chunk-KS7C4IRE-BPb7KheU.js";import{i as a,n as o,o as s}from"./locale-store-B4o4aDCg.js";import{t as c}from"./messages-hlOsXkQ7.js";import{a as ee,i as te,n as l,o as ne,r as re,s as ie,t as ae}from"./dist-CY7CS_D3.js";import{t as u}from"./createLucideIcon-DPHK1VkS.js";import{t as d}from"./chevron-down-ccbiQQz_.js";import{i as f}from"./working-directory-picker-modal-DvVtUxHW.js";import{t as oe}from"./circle-check-C23XjkUj.js";import{t as p}from"./key-round-DWbpyU2U.js";import{t as m}from"./loader-circle-CifKLtgG.js";import{a as h,c as g,i as _,n as v,s as y,t as b}from"./install-connector-dialog-Rox2_5eU.js";import{t as x}from"./package-wATCyihJ.js";import{t as S}from"./plus-Q2yW6OE7.js";import{t as C}from"./server-BlHCBjiE.js";import{t as se}from"./x-B_N4OPjy.js";import{t as w}from"./cn-0WouolD0.js";import{t as T}from"./skeleton-DzdOeGYz.js";import{i as E}from"./vendor-swr-CdRzEUwF.js";import{t as D}from"./button-ChmVQg9O.js";import{n as ce}from"./interaction-BdhHBbYa.js";import{a as O,i as k,o as A,s as j}from"./connectors-api-KA6rkOJX.js";import{i as M,t as N}from"./agent-plugin-dialog-hRZYhcLp.js";import{t as P}from"./capability-icon-CmvCZOJX.js";import{n as F,t as I}from"./extension-marketplace-api-Bo_chffY.js";var L=u(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),R=e(t(),1),z={"notion-office":`notion`,"todoist-mcp":`todoist`,"amap-maps":`amap`,"feishu-workspace":`feishu`,"wecom-workspace":`wecom`,"dingtalk-workspace":`dingtalk`,"wps365-workspace":`wps365`},B=[`feishu`,`wecom`,`dingtalk`,`tencent-docs`,`wps365`,`yuque`,`dida365`,`flomo`,`tencent-meeting`,`amap`,`bailian-web-search`,`railway-12306`,`antv-chart`],V={"store-plugin":0,"builtin-connector":1,"store-connector":2,"registry-connector":3};function H(e){let t=e.toLowerCase().replace(/^composio-/,``);return z[t]??t}function U(e){if(!e)return 2**53-1;let t=B.indexOf(H(e.id));return t>=0?t:e.regions?.includes(`china`)?B.length:2**53-1}function W(e,t){let n=new Map;for(let t of e){if(!t.service)continue;let e=H(t.service.id),r=n.get(e);(!r?.service||V[t.service.source]<V[r.service.source])&&n.set(e,t)}let r=e.filter(e=>!e.service||n.get(H(e.service.id))===e);return t.startsWith(`zh`)?r.toSorted((e,t)=>U(e.service)-U(t.service)):r}function G(e,t){let n=t.trim().toLocaleLowerCase();return!n||[e.name,e.description,e.source,...e.tags].some(e=>e.toLocaleLowerCase().includes(n))}function K(e){return e?[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status)?`attention`:`installed`:`available`}function q(e,t,n,r=`en`){return W(e,r).filter(e=>(t===`all`||e.kind===t)&&G(e,n))}function J(e,t,n,r=`en`){let i=new Map(n.map(e=>[e.connectorId,e])),a=new Map;for(let t of e){let e=i.get(t.id);a.set(t.id,{id:t.id,service:{id:t.id,source:t.source===`builtin`?`builtin-connector`:t.source===`store`?`store-connector`:`registry-connector`},kind:`connector`,name:t.displayName,description:t.description,source:t.source,status:K(e),tags:[t.category,t.kind,...t.tags??[]],href:`/capabilities/connectors?tab=${e?`connected`:`discover`}&${e?`instance`:`connector`}=${encodeURIComponent(e?.instanceId??t.id)}`,iconUrl:t.branding?.logoUrl})}for(let e of t){let t=e.name,n=e.localizations?.[r.startsWith(`zh`)?`zh-CN`:`en`],o=i.get(t);a.set(`store:${t}`,{id:t,service:{id:t,source:`store-connector`,regions:e.regions},kind:`connector`,name:n?.displayName??e.name,description:n?.description??e.description,source:e.author.username||`XOPC Store`,status:K(o),tags:[e.name,e.category,...e.tags??[]].filter(e=>!!e),href:o?`/capabilities/connectors?tab=connected&instance=${encodeURIComponent(o.instanceId)}`:`/capabilities/connectors?tab=discover&storeConnector=${encodeURIComponent(t)}`,iconUrl:e.branding?.iconUrl})}return W([...a.values()],r)}function Y(e,t,n=`en`){return e.map(e=>({id:e.id,kind:`extension`,...e.packageType===`plugin`?{service:{id:e.id,source:`store-plugin`}}:{},name:e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`]?.displayName??e.name,description:e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`]?.description??e.description??``,source:e.author||e.npmPackage,status:t.has(e.id)?`installed`:`available`,tags:[e.id,...e.categories??[],...e.tags??[]],href:`/capabilities/extensions?tab=marketplace&q=${encodeURIComponent(e.name)}`,iconUrl:e.branding?.iconUrl}))}async function X(e=``){let t=await A({q:e,page:1,pageSize:50,sort:`downloads`}),n=await Promise.all(Array.from({length:Math.max(0,t.meta.totalPages-1)},(t,n)=>A({q:e,page:n+2,pageSize:50,sort:`downloads`})));return[...t.items,...n.flatMap(e=>e.items)]}async function Z(e){let[t,n,r]=await Promise.allSettled([I(),k(),X()]),i=[t,n,r].filter(e=>e.status===`rejected`).length;if(i===3)throw Error(`Service recommendations unavailable`);let a=n.status===`fulfilled`?n.value:[];return{items:W([...Y(t.status===`fulfilled`?t.value.filter(e=>e.packageType===`plugin`):[],new Set,e),...J(a,r.status===`fulfilled`?r.value:[],[],e)],e),definitions:a,failedSources:i}}var Q=n(),le=[`understand`,`act`,`reach`];function ue(e){if(e.benefits?.length)return[...new Set(e.benefits)];let t=new Set(e.capabilities),n=[e.id,e.displayName,...e.tags??[]].join(` `).toLowerCase(),r=[];return(t.has(`context`)||t.has(`memory_source`)||t.has(`resources`)||e.category===`docs`||e.category===`data`||/notion|drive|document|confluence|airtable|database|knowledge|wiki/.test(n))&&r.push(`understand`),t.has(`tools`)&&r.push(`act`),(t.has(`channel`)||/slack|telegram|discord|teams|mail|message|wechat|weixin/.test(n))&&r.push(`reach`),r.length?[...new Set(r)]:[`act`]}function de(e){return ue(e)[0]??`act`}function fe(e,t){let n=t?de(t):`act`,r=e.connectionStatus===`connected`||e.status===`connected`||e.usage.lastHealthStatus===`ok`,i=e.status===`not_configured`||e.status===`failed`||e.status===`degraded`||e.status===`unauthorized`||e.connectionStatus===`unauthorized`||e.connectionStatus===`error`,a=n===`understand`?e.usage.lastResourceCount:n===`act`?e.usage.lastToolCount:void 0;return{benefit:n,state:r?`ready`:i?`needs_setup`:`checking`,availableCount:a}}var $=r();function pe(e,t){return t.connectorCapabilityLabels[e]??e}function me(e,t){if(e.runtime.type===`mcp`)return h(t.connectorRuntimeMcp,{serverId:e.runtime.serverId});let n=e.runtime.type===`composio`?e.runtime.toolkit:e.runtime.type===`cli`?e.runtime.adapterId:e.runtime.sourceKind;return h(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function he(e,t){return e.auth.mode===`cli`?t.connectorAuthCli:e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function ge(e){let t=(0,Q.c)(133),{connector:n,installed:r,onClose:i,onInstall:a,t:o}=e,s;t[0]!==n||t[1]!==o?(s=_(n,o),t[0]=n,t[1]=o,t[2]=s):s=t[2];let c=s,u,d,f,m,y,b,x,S,T,E,O,k,A,j,M,N;if(t[3]!==n||t[4]!==c||t[5]!==r||t[6]!==i||t[7]!==o){let e=ue(n),a;t[24]!==n.setup.config||t[25]!==n.setup.secrets?(a=[...(n.setup.secrets??[]).filter(ye),...(n.setup.config??[]).filter(ve)],t[24]=n.setup.config,t[25]=n.setup.secrets,t[26]=a):a=t[26];let s=a,g=n.capabilities.filter(_e);f=ae,x=!0,t[27]===i?S=t[28]:(S=e=>{e||i()},t[27]=i,t[28]=S),d=ne,t[29]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(ee,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[29]=b):b=t[29],u=re,t[30]===Symbol.for(`react.memo_cache_sentinel`)?(m=w(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,42rem)] w-[min(100%-2rem,min(92vw,44rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-overlay shadow-float outline-none dark:border-edge`),t[30]=m):m=t[30];let _;t[31]===n?_=t[32]:(_=(0,$.jsx)(v,{connector:n,size:`lg`}),t[31]=n,t[32]=_);let D;t[33]===n.displayName?D=t[34]:(D=(0,$.jsx)(ie,{className:`text-base font-semibold text-fg`,children:n.displayName}),t[33]=n.displayName,t[34]=D);let P;t[35]!==r||t[36]!==o.connectedBadge?(P=r?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,$.jsx)(oe,{className:`size-3`,"aria-hidden":!0}),o.connectedBadge]}):null,t[35]=r,t[36]=o.connectedBadge,t[37]=P):P=t[37];let F;t[38]!==D||t[39]!==P?(F=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[D,P]}),t[38]=D,t[39]=P,t[40]=F):F=t[40];let I;t[41]===c?I=t[42]:(I=(0,$.jsx)(te,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:c}),t[41]=c,t[42]=I);let L;t[43]!==F||t[44]!==I?(L=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[F,I]}),t[43]=F,t[44]=I,t[45]=L):L=t[45];let R;t[46]!==_||t[47]!==L?(R=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[_,L]}),t[46]=_,t[47]=L,t[48]=R):R=t[48];let z;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(z=w(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ce.focusRingPanel),t[49]=z):z=t[49];let B;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(se,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[50]=B):B=t[50];let V;t[51]===o.modalClose?V=t[52]:(V=(0,$.jsx)(l,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:z,"aria-label":o.modalClose,children:B})}),t[51]=o.modalClose,t[52]=V),t[53]!==R||t[54]!==V?(y=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-5 sm:px-6`,children:[R,V]}),t[53]=R,t[54]=V,t[55]=y):y=t[55],j=`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-5 sm:px-6`,M=e.length?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:o.connectorWhyConnect}),(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:e.map(e=>(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.connectorBenefitHeadings[e]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.connectorBenefitHints[e]})]},e))})]}):null;let H;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[56]=H):H=t[56];let U;t[57]===o.detailPermissions?U=t[58]:(U=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.detailPermissions}),t[57]=o.detailPermissions,t[58]=U);let W;t[59]!==n||t[60]!==o?(W=he(n,o),t[59]=n,t[60]=o,t[61]=W):W=t[61];let G;t[62]===W?G=t[63]:(G=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:W}),t[62]=W,t[63]=G);let K;t[64]!==U||t[65]!==G?(K=(0,$.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3`,children:[H,(0,$.jsxs)(`div`,{children:[U,G]})]}),t[64]=U,t[65]=G,t[66]=K):K=t[66];let q;t[67]===o.connectorSetupTitle?q=t[68]:(q=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.connectorSetupTitle}),t[67]=o.connectorSetupTitle,t[68]=q);let J;t[69]!==s.length||t[70]!==o.connectorRequiredInputsCount||t[71]!==o.connectorSetupNone?(J=s.length?h(o.connectorRequiredInputsCount,{count:String(s.length)}):o.connectorSetupNone,t[69]=s.length,t[70]=o.connectorRequiredInputsCount,t[71]=o.connectorSetupNone,t[72]=J):J=t[72];let Y;t[73]===J?Y=t[74]:(Y=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:J}),t[73]=J,t[74]=Y);let X;t[75]!==q||t[76]!==Y?(X=(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[q,Y]}),t[75]=q,t[76]=Y,t[77]=X):X=t[77],t[78]!==K||t[79]!==X?(N=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base`,children:[K,X]}),t[78]=K,t[79]=X,t[80]=N):N=t[80],k=`rounded-xl border border-edge bg-surface-base`,t[81]===o.connectorTechnicalDetails?A=t[82]:(A=(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-fg-muted hover:text-fg`,children:o.connectorTechnicalDetails}),t[81]=o.connectorTechnicalDetails,t[82]=A),T=`space-y-5 border-t border-edge-subtle px-4 py-4`;let Z;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,$.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),t[83]=Z):Z=t[83];let Q;t[84]===o.connectorRuntimeTitle?Q=t[85]:(Q=(0,$.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[Z,o.connectorRuntimeTitle]}),t[84]=o.connectorRuntimeTitle,t[85]=Q);let le;t[86]!==n||t[87]!==o?(le=me(n,o),t[86]=n,t[87]=o,t[88]=le):le=t[88];let de;t[89]===le?de=t[90]:(de=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-subtle`,children:le}),t[89]=le,t[90]=de),t[91]!==Q||t[92]!==de?(E=(0,$.jsxs)(`div`,{children:[Q,de]}),t[91]=Q,t[92]=de,t[93]=E):E=t[93],O=g.length?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:g.map(e=>(0,$.jsx)(`span`,{className:`rounded-md bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:pe(e,o)},e))}):null,t[3]=n,t[4]=c,t[5]=r,t[6]=i,t[7]=o,t[8]=u,t[9]=d,t[10]=f,t[11]=m,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=T,t[17]=E,t[18]=O,t[19]=k,t[20]=A,t[21]=j,t[22]=M,t[23]=N}else u=t[8],d=t[9],f=t[10],m=t[11],y=t[12],b=t[13],x=t[14],S=t[15],T=t[16],E=t[17],O=t[18],k=t[19],A=t[20],j=t[21],M=t[22],N=t[23];let P;t[94]!==T||t[95]!==E||t[96]!==O?(P=(0,$.jsxs)(`div`,{className:T,children:[E,O]}),t[94]=T,t[95]=E,t[96]=O,t[97]=P):P=t[97];let F;t[98]!==P||t[99]!==k||t[100]!==A?(F=(0,$.jsxs)(`details`,{className:k,children:[A,P]}),t[98]=P,t[99]=k,t[100]=A,t[101]=F):F=t[101];let I;t[102]!==F||t[103]!==j||t[104]!==M||t[105]!==N?(I=(0,$.jsxs)(`div`,{className:j,children:[M,N,F]}),t[102]=F,t[103]=j,t[104]=M,t[105]=N,t[106]=I):I=t[106];let L;t[107]===o.modalClose?L=t[108]:(L=(0,$.jsx)(l,{asChild:!0,children:(0,$.jsx)(D,{variant:`secondary`,children:o.modalClose})}),t[107]=o.modalClose,t[108]=L);let R;t[109]!==n||t[110]!==r||t[111]!==i||t[112]!==a||t[113]!==o.connect?(R=r?null:(0,$.jsxs)(D,{variant:`primary`,onClick:()=>{a(n),i()},children:[(0,$.jsx)(g,{className:`size-4`}),o.connect]}),t[109]=n,t[110]=r,t[111]=i,t[112]=a,t[113]=o.connect,t[114]=R):R=t[114];let z;t[115]!==L||t[116]!==R?(z=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[L,R]}),t[115]=L,t[116]=R,t[117]=z):z=t[117];let B;t[118]!==u||t[119]!==m||t[120]!==y||t[121]!==I||t[122]!==z?(B=(0,$.jsxs)(u,{className:m,children:[y,I,z]}),t[118]=u,t[119]=m,t[120]=y,t[121]=I,t[122]=z,t[123]=B):B=t[123];let V;t[124]!==d||t[125]!==b||t[126]!==B?(V=(0,$.jsxs)(d,{children:[b,B]}),t[124]=d,t[125]=b,t[126]=B,t[127]=V):V=t[127];let H;return t[128]!==f||t[129]!==x||t[130]!==S||t[131]!==V?(H=(0,$.jsx)(f,{open:x,onOpenChange:S,children:V}),t[128]=f,t[129]=x,t[130]=S,t[131]=V,t[132]=H):H=t[132],H}function _e(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}function ve(e){return e.required}function ye(e){return e.required}function be(e){let t=(0,Q.c)(68),{item:n,definition:r,busy:i,onClose:a,onConnect:s}=e,u=o(xe),d;t[0]===u?d=t[1]:(d=u.startsWith(`zh`),t[0]=u,t[1]=d);let f=d,oe;t[2]===u?oe=t[3]:(oe=c(u),t[2]=u,t[3]=oe);let p=oe.connectorsSettings,m=n.service?.source===`store-plugin`,h;t[4]!==m||t[5]!==n.id?(h=m?[`recommended-service-detail`,n.id]:null,t[4]=m,t[5]=n.id,t[6]=h):h=t[6];let g;t[7]===n.id?g=t[8]:(g=()=>F(n.id),t[7]=n.id,t[8]=g);let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_={revalidateOnFocus:!1},t[9]=_):_=t[9];let{data:v,error:y,isLoading:b,mutate:S}=E(h,g,_);if(r&&!m){let e;return t[10]!==r||t[11]!==a||t[12]!==s||t[13]!==p?(e=(0,$.jsx)(ge,{connector:r,installed:!1,onClose:a,onInstall:s,t:p}),t[10]=r,t[11]=a,t[12]=s,t[13]=p,t[14]=e):e=t[14],e}let C;t[15]===a?C=t[16]:(C=e=>{e||a()},t[15]=a,t[16]=C);let w;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(ee,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[17]=w):w=t[17];let ce=m?x:L,O;t[18]!==n.iconUrl||t[19]!==ce?(O=(0,$.jsx)(P,{iconUrl:n.iconUrl,fallback:ce}),t[18]=n.iconUrl,t[19]=ce,t[20]=O):O=t[20];let k;t[21]===n.name?k=t[22]:(k=(0,$.jsx)(ie,{className:`min-w-0 break-words text-base font-semibold text-fg`,children:n.name}),t[21]=n.name,t[22]=k);let A;t[23]!==k||t[24]!==O?(A=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[O,k]}),t[23]=k,t[24]=O,t[25]=A):A=t[25];let j;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(se,{className:`size-5`,"aria-hidden":!0}),t[26]=j):j=t[26];let N;t[27]===p.modalClose?N=t[28]:(N=(0,$.jsx)(l,{asChild:!0,children:(0,$.jsx)(D,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":p.modalClose,children:j})}),t[27]=p.modalClose,t[28]=N);let I;t[29]!==A||t[30]!==N?(I=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge-subtle p-5`,children:[A,N]}),t[29]=A,t[30]=N,t[31]=I):I=t[31];let R=v?.localizations?.[f?`zh-CN`:`en`]?.description||v?.description||n.description,z;t[32]===R?z=t[33]:(z=(0,$.jsx)(te,{className:`whitespace-pre-wrap break-words text-sm leading-7 text-fg-muted`,children:R}),t[32]=R,t[33]=z);let B=f?`来源:`:`Source: `,V=v?.author.username||n.source,H;t[34]!==B||t[35]!==V?(H=(0,$.jsxs)(`p`,{className:`break-words text-xs text-fg-subtle`,children:[B,V]}),t[34]=B,t[35]=V,t[36]=H):H=t[36];let U;t[37]===b?U=t[38]:(U=b?(0,$.jsxs)(`div`,{className:`space-y-3`,"aria-busy":`true`,children:[(0,$.jsx)(T,{className:`h-5 w-32`}),(0,$.jsx)(T,{className:`h-28 w-full rounded-lg`})]}):null,t[37]=b,t[38]=U);let W;t[39]!==v||t[40]!==f?(W=v?(0,$.jsx)(M,{data:v,zh:f}):null,t[39]=v,t[40]=f,t[41]=W):W=t[41];let G;t[42]!==y||t[43]!==S||t[44]!==f?(G=y?(0,$.jsxs)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:[f?`详细信息加载失败。`:`Could not load additional details.`,` `,(0,$.jsx)(`button`,{type:`button`,className:`text-accent-fg hover:underline`,onClick:()=>void S(),children:f?`重试`:`Retry`})]}):null,t[42]=y,t[43]=S,t[44]=f,t[45]=G):G=t[45];let K;t[46]!==z||t[47]!==H||t[48]!==U||t[49]!==W||t[50]!==G?(K=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[z,H,U,W,G]}),t[46]=z,t[47]=H,t[48]=U,t[49]=W,t[50]=G,t[51]=K):K=t[51];let q;t[52]===p.modalClose?q=t[53]:(q=(0,$.jsx)(l,{asChild:!0,children:(0,$.jsx)(D,{variant:`secondary`,children:p.modalClose})}),t[52]=p.modalClose,t[53]=q);let J;t[54]!==i||t[55]!==s||t[56]!==p.connect?(J=(0,$.jsx)(D,{disabled:i,onClick:s,children:p.connect}),t[54]=i,t[55]=s,t[56]=p.connect,t[57]=J):J=t[57];let Y;t[58]!==q||t[59]!==J?(Y=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-4`,children:[q,J]}),t[58]=q,t[59]=J,t[60]=Y):Y=t[60];let X;t[61]!==I||t[62]!==K||t[63]!==Y?(X=(0,$.jsxs)(ne,{children:[w,(0,$.jsxs)(re,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(44rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float`,children:[I,K,Y]})]}),t[61]=I,t[62]=K,t[63]=Y,t[64]=X):X=t[64];let Z;return t[65]!==X||t[66]!==C?(Z=(0,$.jsx)(ae,{open:!0,onOpenChange:C,children:X}),t[65]=X,t[66]=C,t[67]=Z):Z=t[67],Z}function xe(e){return e.language}function Se({initialCount:e=3,showAll:t=!1,query:n=``,layout:r=`list`,onChanged:ee}){let te=i(),l=o(e=>e.language),ne=l.startsWith(`zh`),re=c(l).onboarding.workDiscovery,ie=c(l).connectorsSettings,{data:ae,error:u,isLoading:oe,mutate:p}=E([`service-recommendations`,l],()=>Z(l),{revalidateOnFocus:!1}),{data:h,error:g,mutate:_}=E(`recommended-connector-instances`,O),{data:v,error:C,mutate:se}=E(`gateway-extensions-list`,()=>s(a(`/api/extensions`))),[ce,k]=(0,R.useState)(!1),[A,M]=(0,R.useState)(null),[F,I]=(0,R.useState)(null),[z,B]=(0,R.useState)(null),[V,H]=(0,R.useState)(``),[U,W]=(0,R.useState)(null),G=q(ae?.items??[],`all`,n,l);async function K(){let e=(await Promise.allSettled([_(),se(),Promise.resolve().then(()=>ee?.())])).find(e=>e.status===`rejected`);e?.status===`rejected`&&H(String(e.reason))}async function J(e,t){if(H(``),e.service?.source===`store-plugin`){I({id:e.id,extension:t});return}let n=h?.find(t=>t.connectorId===e.id);if(n){te(`/capabilities/connectors?tab=connected&instance=${encodeURIComponent(n.instanceId)}`);return}B(e.id);try{if(e.service?.source===`store-connector`){let t=await j(e.id);M(y(t.definition,{packageName:t.packageName,version:t.version,reviewHash:t.reviewHash,permissions:t.permissions}))}else{let t=ae?.definitions.find(t=>t.id===e.id);t&&M(y(t))}}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(null)}}return(0,$.jsxs)(`div`,{children:[oe?(0,$.jsx)(`div`,{className:r===`cards`?`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`:`space-y-2`,"aria-busy":`true`,children:Array.from({length:e},(e,t)=>(0,$.jsx)(T,{className:r===`cards`?`h-[8.75rem] rounded-xl`:`h-20 rounded-xl`},t))}):null,u||ae?.failedSources||g||C?(0,$.jsxs)(`p`,{className:`mb-3 text-sm text-fg-muted`,role:`status`,children:[re.connectorLoadFailed,` `,(0,$.jsx)(`button`,{type:`button`,className:`text-accent-fg hover:underline`,onClick:()=>{p(),_(),se()},children:ne?`重试`:`Retry`})]}):null,!oe&&!u&&G.length===0?(0,$.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:re.noWorkServices}):null,(0,$.jsx)(`div`,{className:r===`cards`?`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`:`divide-y divide-edge-subtle rounded-xl border border-edge-subtle bg-surface-base/55`,children:(t||ce?G:G.slice(0,e)).map(e=>{let t=v?.extensions.find(t=>t.format===`agent-plugin`&&t.provenance?.packageName===e.id),n=h?.find(t=>t.connectorId===e.id),i=e.service?.source===`store-plugin`,a=i?!!(t?.active&&t.readiness===`ready`&&[`connected`,`not_required`].includes(t.authorizationStatus??``)):!!(n?.enabled&&n.status===`connected`),o=i?!!t:!!n,s=(i?!v&&!C:!h&&!g)?(0,$.jsx)(T,{className:`h-8 w-16 shrink-0 rounded-lg`}):(0,$.jsxs)(D,{type:`button`,variant:`secondary`,className:`relative z-10 h-8 shrink-0 px-3 text-xs`,disabled:z!==null,onClick:()=>void J(e,t),children:[z===e.id?(0,$.jsx)(m,{className:`size-3.5 animate-spin`}):o?null:(0,$.jsx)(S,{className:`size-3.5`}),a?ne?`管理`:`Manage`:o?ne?`继续设置`:`Set up`:ie.connect]});return(0,$.jsx)(`article`,{className:w(r===`cards`?`group relative flex min-h-[8.75rem] min-w-0 flex-col rounded-xl bg-surface-panel p-4 transition-colors hover:bg-surface-panel-hover focus-within:ring-2 focus-within:ring-accent/30 [content-visibility:auto] [contain-intrinsic-size:auto_8.75rem]`:`flex min-h-20 items-center gap-3 px-3 py-3 sm:px-4`),children:r===`cards`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(P,{iconUrl:e.iconUrl,fallback:i?x:L}),(0,$.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:(0,$.jsx)(`button`,{type:`button`,className:`cursor-pointer text-left after:absolute after:inset-0 after:rounded-xl focus-visible:outline-none focus-visible:after:ring-2 focus-visible:after:ring-accent`,"aria-label":ne?`查看${e.name}详情`:`View ${e.name} details`,"aria-haspopup":`dialog`,onClick:()=>W(e),children:e.name})})]}),s]}),(0,$.jsx)(`p`,{className:`mt-3 line-clamp-2 text-sm leading-6 text-fg-muted`,title:e.description,children:e.description})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P,{iconUrl:e.iconUrl,fallback:i?x:L}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.name}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),s]})},`${e.kind}:${e.id}`)})}),!t&&G.length>e?(0,$.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:()=>k(e=>!e),children:[ce?(0,$.jsx)(f,{className:`size-3.5`}):(0,$.jsx)(d,{className:`size-3.5`}),ce?re.showFewerServices:re.showMoreServices]}):null,V?(0,$.jsx)(`p`,{className:`mt-3 text-xs text-danger`,role:`alert`,children:V}):null,U?(0,$.jsx)(be,{item:U,definition:ae?.definitions.find(e=>e.id===U.id),busy:z!==null,onClose:()=>W(null),onConnect:()=>{W(null),J(U,v?.extensions.find(e=>e.format===`agent-plugin`&&e.provenance?.packageName===U.id))}}):null,A?(0,$.jsx)(b,{draft:A,onChange:M,onClose:()=>M(null),t:ie,onInstalled:async()=>{await K(),M(null)}}):null,F?(0,$.jsx)(N,{initialSource:`store:${F.id}`,extension:F.extension,onClose:()=>{I(null),K()}}):null]})}export{fe as a,W as c,ue as i,L as l,ge as n,Z as o,le as r,H as s,Se 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{d as i}from"./chunk-KS7C4IRE-DbzE-1bp.js";import{i as a,n as o,o as s}from"./locale-store-B4o4aDCg.js";import{t as c}from"./messages-hlOsXkQ7.js";import{a as ee,i as te,n as l,o as ne,r as re,s as ie,t as ae}from"./dist-DlirbHVs.js";import{t as u}from"./createLucideIcon-DPHK1VkS.js";import{t as d}from"./chevron-down-ccbiQQz_.js";import{i as f}from"./working-directory-picker-modal-BwmhPsrY.js";import{t as oe}from"./circle-check-C23XjkUj.js";import{t as p}from"./key-round-DWbpyU2U.js";import{t as m}from"./loader-circle-CifKLtgG.js";import{a as h,c as g,i as _,n as v,s as y,t as b}from"./install-connector-dialog-DyscHGNB.js";import{t as x}from"./package-wATCyihJ.js";import{t as S}from"./plus-Q2yW6OE7.js";import{t as C}from"./server-BlHCBjiE.js";import{t as se}from"./x-B_N4OPjy.js";import{t as w}from"./cn-0WouolD0.js";import{t as T}from"./skeleton-DzdOeGYz.js";import{i as E}from"./vendor-swr-CdRzEUwF.js";import{t as D}from"./button-C5tRaJxt.js";import{n as ce}from"./interaction-BdhHBbYa.js";import{a as O,i as k,o as A,s as j}from"./connectors-api-KA6rkOJX.js";import{i as M,t as N}from"./agent-plugin-dialog-D8zi6y5l.js";import{t as P}from"./capability-icon-CmvCZOJX.js";import{n as F,t as I}from"./extension-marketplace-api-Bo_chffY.js";var L=u(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),R=e(t(),1),z={"notion-office":`notion`,"todoist-mcp":`todoist`,"amap-maps":`amap`,"feishu-workspace":`feishu`,"wecom-workspace":`wecom`,"dingtalk-workspace":`dingtalk`,"wps365-workspace":`wps365`},B=[`feishu`,`wecom`,`dingtalk`,`tencent-docs`,`wps365`,`yuque`,`dida365`,`flomo`,`tencent-meeting`,`amap`,`bailian-web-search`,`railway-12306`,`antv-chart`],V={"store-plugin":0,"builtin-connector":1,"store-connector":2,"registry-connector":3};function H(e){let t=e.toLowerCase().replace(/^composio-/,``);return z[t]??t}function U(e){if(!e)return 2**53-1;let t=B.indexOf(H(e.id));return t>=0?t:e.regions?.includes(`china`)?B.length:2**53-1}function W(e,t){let n=new Map;for(let t of e){if(!t.service)continue;let e=H(t.service.id),r=n.get(e);(!r?.service||V[t.service.source]<V[r.service.source])&&n.set(e,t)}let r=e.filter(e=>!e.service||n.get(H(e.service.id))===e);return t.startsWith(`zh`)?r.toSorted((e,t)=>U(e.service)-U(t.service)):r}function G(e,t){let n=t.trim().toLocaleLowerCase();return!n||[e.name,e.description,e.source,...e.tags].some(e=>e.toLocaleLowerCase().includes(n))}function K(e){return e?[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status)?`attention`:`installed`:`available`}function q(e,t,n,r=`en`){return W(e,r).filter(e=>(t===`all`||e.kind===t)&&G(e,n))}function J(e,t,n,r=`en`){let i=new Map(n.map(e=>[e.connectorId,e])),a=new Map;for(let t of e){let e=i.get(t.id);a.set(t.id,{id:t.id,service:{id:t.id,source:t.source===`builtin`?`builtin-connector`:t.source===`store`?`store-connector`:`registry-connector`},kind:`connector`,name:t.displayName,description:t.description,source:t.source,status:K(e),tags:[t.category,t.kind,...t.tags??[]],href:`/capabilities/connectors?tab=${e?`connected`:`discover`}&${e?`instance`:`connector`}=${encodeURIComponent(e?.instanceId??t.id)}`,iconUrl:t.branding?.logoUrl})}for(let e of t){let t=e.name,n=e.localizations?.[r.startsWith(`zh`)?`zh-CN`:`en`],o=i.get(t);a.set(`store:${t}`,{id:t,service:{id:t,source:`store-connector`,regions:e.regions},kind:`connector`,name:n?.displayName??e.name,description:n?.description??e.description,source:e.author.username||`XOPC Store`,status:K(o),tags:[e.name,e.category,...e.tags??[]].filter(e=>!!e),href:o?`/capabilities/connectors?tab=connected&instance=${encodeURIComponent(o.instanceId)}`:`/capabilities/connectors?tab=discover&storeConnector=${encodeURIComponent(t)}`,iconUrl:e.branding?.iconUrl})}return W([...a.values()],r)}function Y(e,t,n=`en`){return e.map(e=>({id:e.id,kind:`extension`,...e.packageType===`plugin`?{service:{id:e.id,source:`store-plugin`}}:{},name:e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`]?.displayName??e.name,description:e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`]?.description??e.description??``,source:e.author||e.npmPackage,status:t.has(e.id)?`installed`:`available`,tags:[e.id,...e.categories??[],...e.tags??[]],href:`/capabilities/extensions?tab=marketplace&q=${encodeURIComponent(e.name)}`,iconUrl:e.branding?.iconUrl}))}async function X(e=``){let t=await A({q:e,page:1,pageSize:50,sort:`downloads`}),n=await Promise.all(Array.from({length:Math.max(0,t.meta.totalPages-1)},(t,n)=>A({q:e,page:n+2,pageSize:50,sort:`downloads`})));return[...t.items,...n.flatMap(e=>e.items)]}async function Z(e){let[t,n,r]=await Promise.allSettled([I(),k(),X()]),i=[t,n,r].filter(e=>e.status===`rejected`).length;if(i===3)throw Error(`Service recommendations unavailable`);let a=n.status===`fulfilled`?n.value:[];return{items:W([...Y(t.status===`fulfilled`?t.value.filter(e=>e.packageType===`plugin`):[],new Set,e),...J(a,r.status===`fulfilled`?r.value:[],[],e)],e),definitions:a,failedSources:i}}var Q=n(),le=[`understand`,`act`,`reach`];function ue(e){if(e.benefits?.length)return[...new Set(e.benefits)];let t=new Set(e.capabilities),n=[e.id,e.displayName,...e.tags??[]].join(` `).toLowerCase(),r=[];return(t.has(`context`)||t.has(`memory_source`)||t.has(`resources`)||e.category===`docs`||e.category===`data`||/notion|drive|document|confluence|airtable|database|knowledge|wiki/.test(n))&&r.push(`understand`),t.has(`tools`)&&r.push(`act`),(t.has(`channel`)||/slack|telegram|discord|teams|mail|message|wechat|weixin/.test(n))&&r.push(`reach`),r.length?[...new Set(r)]:[`act`]}function de(e){return ue(e)[0]??`act`}function fe(e,t){let n=t?de(t):`act`,r=e.connectionStatus===`connected`||e.status===`connected`||e.usage.lastHealthStatus===`ok`,i=e.status===`not_configured`||e.status===`failed`||e.status===`degraded`||e.status===`unauthorized`||e.connectionStatus===`unauthorized`||e.connectionStatus===`error`,a=n===`understand`?e.usage.lastResourceCount:n===`act`?e.usage.lastToolCount:void 0;return{benefit:n,state:r?`ready`:i?`needs_setup`:`checking`,availableCount:a}}var $=r();function pe(e,t){return t.connectorCapabilityLabels[e]??e}function me(e,t){if(e.runtime.type===`mcp`)return h(t.connectorRuntimeMcp,{serverId:e.runtime.serverId});let n=e.runtime.type===`composio`?e.runtime.toolkit:e.runtime.type===`cli`?e.runtime.adapterId:e.runtime.sourceKind;return h(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function he(e,t){return e.auth.mode===`cli`?t.connectorAuthCli:e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function ge(e){let t=(0,Q.c)(133),{connector:n,installed:r,onClose:i,onInstall:a,t:o}=e,s;t[0]!==n||t[1]!==o?(s=_(n,o),t[0]=n,t[1]=o,t[2]=s):s=t[2];let c=s,u,d,f,m,y,b,x,S,T,E,O,k,A,j,M,N;if(t[3]!==n||t[4]!==c||t[5]!==r||t[6]!==i||t[7]!==o){let e=ue(n),a;t[24]!==n.setup.config||t[25]!==n.setup.secrets?(a=[...(n.setup.secrets??[]).filter(ye),...(n.setup.config??[]).filter(ve)],t[24]=n.setup.config,t[25]=n.setup.secrets,t[26]=a):a=t[26];let s=a,g=n.capabilities.filter(_e);f=ae,x=!0,t[27]===i?S=t[28]:(S=e=>{e||i()},t[27]=i,t[28]=S),d=ne,t[29]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(ee,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[29]=b):b=t[29],u=re,t[30]===Symbol.for(`react.memo_cache_sentinel`)?(m=w(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,42rem)] w-[min(100%-2rem,min(92vw,44rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-overlay shadow-float outline-none dark:border-edge`),t[30]=m):m=t[30];let _;t[31]===n?_=t[32]:(_=(0,$.jsx)(v,{connector:n,size:`lg`}),t[31]=n,t[32]=_);let D;t[33]===n.displayName?D=t[34]:(D=(0,$.jsx)(ie,{className:`text-base font-semibold text-fg`,children:n.displayName}),t[33]=n.displayName,t[34]=D);let P;t[35]!==r||t[36]!==o.connectedBadge?(P=r?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,$.jsx)(oe,{className:`size-3`,"aria-hidden":!0}),o.connectedBadge]}):null,t[35]=r,t[36]=o.connectedBadge,t[37]=P):P=t[37];let F;t[38]!==D||t[39]!==P?(F=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[D,P]}),t[38]=D,t[39]=P,t[40]=F):F=t[40];let I;t[41]===c?I=t[42]:(I=(0,$.jsx)(te,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:c}),t[41]=c,t[42]=I);let L;t[43]!==F||t[44]!==I?(L=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[F,I]}),t[43]=F,t[44]=I,t[45]=L):L=t[45];let R;t[46]!==_||t[47]!==L?(R=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[_,L]}),t[46]=_,t[47]=L,t[48]=R):R=t[48];let z;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(z=w(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ce.focusRingPanel),t[49]=z):z=t[49];let B;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(se,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[50]=B):B=t[50];let V;t[51]===o.modalClose?V=t[52]:(V=(0,$.jsx)(l,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:z,"aria-label":o.modalClose,children:B})}),t[51]=o.modalClose,t[52]=V),t[53]!==R||t[54]!==V?(y=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-5 sm:px-6`,children:[R,V]}),t[53]=R,t[54]=V,t[55]=y):y=t[55],j=`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-5 sm:px-6`,M=e.length?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:o.connectorWhyConnect}),(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:e.map(e=>(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.connectorBenefitHeadings[e]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.connectorBenefitHints[e]})]},e))})]}):null;let H;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[56]=H):H=t[56];let U;t[57]===o.detailPermissions?U=t[58]:(U=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.detailPermissions}),t[57]=o.detailPermissions,t[58]=U);let W;t[59]!==n||t[60]!==o?(W=he(n,o),t[59]=n,t[60]=o,t[61]=W):W=t[61];let G;t[62]===W?G=t[63]:(G=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:W}),t[62]=W,t[63]=G);let K;t[64]!==U||t[65]!==G?(K=(0,$.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3`,children:[H,(0,$.jsxs)(`div`,{children:[U,G]})]}),t[64]=U,t[65]=G,t[66]=K):K=t[66];let q;t[67]===o.connectorSetupTitle?q=t[68]:(q=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.connectorSetupTitle}),t[67]=o.connectorSetupTitle,t[68]=q);let J;t[69]!==s.length||t[70]!==o.connectorRequiredInputsCount||t[71]!==o.connectorSetupNone?(J=s.length?h(o.connectorRequiredInputsCount,{count:String(s.length)}):o.connectorSetupNone,t[69]=s.length,t[70]=o.connectorRequiredInputsCount,t[71]=o.connectorSetupNone,t[72]=J):J=t[72];let Y;t[73]===J?Y=t[74]:(Y=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:J}),t[73]=J,t[74]=Y);let X;t[75]!==q||t[76]!==Y?(X=(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[q,Y]}),t[75]=q,t[76]=Y,t[77]=X):X=t[77],t[78]!==K||t[79]!==X?(N=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base`,children:[K,X]}),t[78]=K,t[79]=X,t[80]=N):N=t[80],k=`rounded-xl border border-edge bg-surface-base`,t[81]===o.connectorTechnicalDetails?A=t[82]:(A=(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-fg-muted hover:text-fg`,children:o.connectorTechnicalDetails}),t[81]=o.connectorTechnicalDetails,t[82]=A),T=`space-y-5 border-t border-edge-subtle px-4 py-4`;let Z;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,$.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),t[83]=Z):Z=t[83];let Q;t[84]===o.connectorRuntimeTitle?Q=t[85]:(Q=(0,$.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[Z,o.connectorRuntimeTitle]}),t[84]=o.connectorRuntimeTitle,t[85]=Q);let le;t[86]!==n||t[87]!==o?(le=me(n,o),t[86]=n,t[87]=o,t[88]=le):le=t[88];let de;t[89]===le?de=t[90]:(de=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-subtle`,children:le}),t[89]=le,t[90]=de),t[91]!==Q||t[92]!==de?(E=(0,$.jsxs)(`div`,{children:[Q,de]}),t[91]=Q,t[92]=de,t[93]=E):E=t[93],O=g.length?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:g.map(e=>(0,$.jsx)(`span`,{className:`rounded-md bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:pe(e,o)},e))}):null,t[3]=n,t[4]=c,t[5]=r,t[6]=i,t[7]=o,t[8]=u,t[9]=d,t[10]=f,t[11]=m,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=T,t[17]=E,t[18]=O,t[19]=k,t[20]=A,t[21]=j,t[22]=M,t[23]=N}else u=t[8],d=t[9],f=t[10],m=t[11],y=t[12],b=t[13],x=t[14],S=t[15],T=t[16],E=t[17],O=t[18],k=t[19],A=t[20],j=t[21],M=t[22],N=t[23];let P;t[94]!==T||t[95]!==E||t[96]!==O?(P=(0,$.jsxs)(`div`,{className:T,children:[E,O]}),t[94]=T,t[95]=E,t[96]=O,t[97]=P):P=t[97];let F;t[98]!==P||t[99]!==k||t[100]!==A?(F=(0,$.jsxs)(`details`,{className:k,children:[A,P]}),t[98]=P,t[99]=k,t[100]=A,t[101]=F):F=t[101];let I;t[102]!==F||t[103]!==j||t[104]!==M||t[105]!==N?(I=(0,$.jsxs)(`div`,{className:j,children:[M,N,F]}),t[102]=F,t[103]=j,t[104]=M,t[105]=N,t[106]=I):I=t[106];let L;t[107]===o.modalClose?L=t[108]:(L=(0,$.jsx)(l,{asChild:!0,children:(0,$.jsx)(D,{variant:`secondary`,children:o.modalClose})}),t[107]=o.modalClose,t[108]=L);let R;t[109]!==n||t[110]!==r||t[111]!==i||t[112]!==a||t[113]!==o.connect?(R=r?null:(0,$.jsxs)(D,{variant:`primary`,onClick:()=>{a(n),i()},children:[(0,$.jsx)(g,{className:`size-4`}),o.connect]}),t[109]=n,t[110]=r,t[111]=i,t[112]=a,t[113]=o.connect,t[114]=R):R=t[114];let z;t[115]!==L||t[116]!==R?(z=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[L,R]}),t[115]=L,t[116]=R,t[117]=z):z=t[117];let B;t[118]!==u||t[119]!==m||t[120]!==y||t[121]!==I||t[122]!==z?(B=(0,$.jsxs)(u,{className:m,children:[y,I,z]}),t[118]=u,t[119]=m,t[120]=y,t[121]=I,t[122]=z,t[123]=B):B=t[123];let V;t[124]!==d||t[125]!==b||t[126]!==B?(V=(0,$.jsxs)(d,{children:[b,B]}),t[124]=d,t[125]=b,t[126]=B,t[127]=V):V=t[127];let H;return t[128]!==f||t[129]!==x||t[130]!==S||t[131]!==V?(H=(0,$.jsx)(f,{open:x,onOpenChange:S,children:V}),t[128]=f,t[129]=x,t[130]=S,t[131]=V,t[132]=H):H=t[132],H}function _e(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}function ve(e){return e.required}function ye(e){return e.required}function be(e){let t=(0,Q.c)(68),{item:n,definition:r,busy:i,onClose:a,onConnect:s}=e,u=o(xe),d;t[0]===u?d=t[1]:(d=u.startsWith(`zh`),t[0]=u,t[1]=d);let f=d,oe;t[2]===u?oe=t[3]:(oe=c(u),t[2]=u,t[3]=oe);let p=oe.connectorsSettings,m=n.service?.source===`store-plugin`,h;t[4]!==m||t[5]!==n.id?(h=m?[`recommended-service-detail`,n.id]:null,t[4]=m,t[5]=n.id,t[6]=h):h=t[6];let g;t[7]===n.id?g=t[8]:(g=()=>F(n.id),t[7]=n.id,t[8]=g);let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_={revalidateOnFocus:!1},t[9]=_):_=t[9];let{data:v,error:y,isLoading:b,mutate:S}=E(h,g,_);if(r&&!m){let e;return t[10]!==r||t[11]!==a||t[12]!==s||t[13]!==p?(e=(0,$.jsx)(ge,{connector:r,installed:!1,onClose:a,onInstall:s,t:p}),t[10]=r,t[11]=a,t[12]=s,t[13]=p,t[14]=e):e=t[14],e}let C;t[15]===a?C=t[16]:(C=e=>{e||a()},t[15]=a,t[16]=C);let w;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(ee,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[17]=w):w=t[17];let ce=m?x:L,O;t[18]!==n.iconUrl||t[19]!==ce?(O=(0,$.jsx)(P,{iconUrl:n.iconUrl,fallback:ce}),t[18]=n.iconUrl,t[19]=ce,t[20]=O):O=t[20];let k;t[21]===n.name?k=t[22]:(k=(0,$.jsx)(ie,{className:`min-w-0 break-words text-base font-semibold text-fg`,children:n.name}),t[21]=n.name,t[22]=k);let A;t[23]!==k||t[24]!==O?(A=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[O,k]}),t[23]=k,t[24]=O,t[25]=A):A=t[25];let j;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(se,{className:`size-5`,"aria-hidden":!0}),t[26]=j):j=t[26];let N;t[27]===p.modalClose?N=t[28]:(N=(0,$.jsx)(l,{asChild:!0,children:(0,$.jsx)(D,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":p.modalClose,children:j})}),t[27]=p.modalClose,t[28]=N);let I;t[29]!==A||t[30]!==N?(I=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge-subtle p-5`,children:[A,N]}),t[29]=A,t[30]=N,t[31]=I):I=t[31];let R=v?.localizations?.[f?`zh-CN`:`en`]?.description||v?.description||n.description,z;t[32]===R?z=t[33]:(z=(0,$.jsx)(te,{className:`whitespace-pre-wrap break-words text-sm leading-7 text-fg-muted`,children:R}),t[32]=R,t[33]=z);let B=f?`来源:`:`Source: `,V=v?.author.username||n.source,H;t[34]!==B||t[35]!==V?(H=(0,$.jsxs)(`p`,{className:`break-words text-xs text-fg-subtle`,children:[B,V]}),t[34]=B,t[35]=V,t[36]=H):H=t[36];let U;t[37]===b?U=t[38]:(U=b?(0,$.jsxs)(`div`,{className:`space-y-3`,"aria-busy":`true`,children:[(0,$.jsx)(T,{className:`h-5 w-32`}),(0,$.jsx)(T,{className:`h-28 w-full rounded-lg`})]}):null,t[37]=b,t[38]=U);let W;t[39]!==v||t[40]!==f?(W=v?(0,$.jsx)(M,{data:v,zh:f}):null,t[39]=v,t[40]=f,t[41]=W):W=t[41];let G;t[42]!==y||t[43]!==S||t[44]!==f?(G=y?(0,$.jsxs)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:[f?`详细信息加载失败。`:`Could not load additional details.`,` `,(0,$.jsx)(`button`,{type:`button`,className:`text-accent-fg hover:underline`,onClick:()=>void S(),children:f?`重试`:`Retry`})]}):null,t[42]=y,t[43]=S,t[44]=f,t[45]=G):G=t[45];let K;t[46]!==z||t[47]!==H||t[48]!==U||t[49]!==W||t[50]!==G?(K=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[z,H,U,W,G]}),t[46]=z,t[47]=H,t[48]=U,t[49]=W,t[50]=G,t[51]=K):K=t[51];let q;t[52]===p.modalClose?q=t[53]:(q=(0,$.jsx)(l,{asChild:!0,children:(0,$.jsx)(D,{variant:`secondary`,children:p.modalClose})}),t[52]=p.modalClose,t[53]=q);let J;t[54]!==i||t[55]!==s||t[56]!==p.connect?(J=(0,$.jsx)(D,{disabled:i,onClick:s,children:p.connect}),t[54]=i,t[55]=s,t[56]=p.connect,t[57]=J):J=t[57];let Y;t[58]!==q||t[59]!==J?(Y=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-4`,children:[q,J]}),t[58]=q,t[59]=J,t[60]=Y):Y=t[60];let X;t[61]!==I||t[62]!==K||t[63]!==Y?(X=(0,$.jsxs)(ne,{children:[w,(0,$.jsxs)(re,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(44rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float`,children:[I,K,Y]})]}),t[61]=I,t[62]=K,t[63]=Y,t[64]=X):X=t[64];let Z;return t[65]!==X||t[66]!==C?(Z=(0,$.jsx)(ae,{open:!0,onOpenChange:C,children:X}),t[65]=X,t[66]=C,t[67]=Z):Z=t[67],Z}function xe(e){return e.language}function Se({initialCount:e=3,showAll:t=!1,query:n=``,layout:r=`list`,onChanged:ee}){let te=i(),l=o(e=>e.language),ne=l.startsWith(`zh`),re=c(l).onboarding.workDiscovery,ie=c(l).connectorsSettings,{data:ae,error:u,isLoading:oe,mutate:p}=E([`service-recommendations`,l],()=>Z(l),{revalidateOnFocus:!1}),{data:h,error:g,mutate:_}=E(`recommended-connector-instances`,O),{data:v,error:C,mutate:se}=E(`gateway-extensions-list`,()=>s(a(`/api/extensions`))),[ce,k]=(0,R.useState)(!1),[A,M]=(0,R.useState)(null),[F,I]=(0,R.useState)(null),[z,B]=(0,R.useState)(null),[V,H]=(0,R.useState)(``),[U,W]=(0,R.useState)(null),G=q(ae?.items??[],`all`,n,l);async function K(){let e=(await Promise.allSettled([_(),se(),Promise.resolve().then(()=>ee?.())])).find(e=>e.status===`rejected`);e?.status===`rejected`&&H(String(e.reason))}async function J(e,t){if(H(``),e.service?.source===`store-plugin`){I({id:e.id,extension:t});return}let n=h?.find(t=>t.connectorId===e.id);if(n){te(`/capabilities/connectors?tab=connected&instance=${encodeURIComponent(n.instanceId)}`);return}B(e.id);try{if(e.service?.source===`store-connector`){let t=await j(e.id);M(y(t.definition,{packageName:t.packageName,version:t.version,reviewHash:t.reviewHash,permissions:t.permissions}))}else{let t=ae?.definitions.find(t=>t.id===e.id);t&&M(y(t))}}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(null)}}return(0,$.jsxs)(`div`,{children:[oe?(0,$.jsx)(`div`,{className:r===`cards`?`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`:`space-y-2`,"aria-busy":`true`,children:Array.from({length:e},(e,t)=>(0,$.jsx)(T,{className:r===`cards`?`h-[8.75rem] rounded-xl`:`h-20 rounded-xl`},t))}):null,u||ae?.failedSources||g||C?(0,$.jsxs)(`p`,{className:`mb-3 text-sm text-fg-muted`,role:`status`,children:[re.connectorLoadFailed,` `,(0,$.jsx)(`button`,{type:`button`,className:`text-accent-fg hover:underline`,onClick:()=>{p(),_(),se()},children:ne?`重试`:`Retry`})]}):null,!oe&&!u&&G.length===0?(0,$.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:re.noWorkServices}):null,(0,$.jsx)(`div`,{className:r===`cards`?`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`:`divide-y divide-edge-subtle rounded-xl border border-edge-subtle bg-surface-base/55`,children:(t||ce?G:G.slice(0,e)).map(e=>{let t=v?.extensions.find(t=>t.format===`agent-plugin`&&t.provenance?.packageName===e.id),n=h?.find(t=>t.connectorId===e.id),i=e.service?.source===`store-plugin`,a=i?!!(t?.active&&t.readiness===`ready`&&[`connected`,`not_required`].includes(t.authorizationStatus??``)):!!(n?.enabled&&n.status===`connected`),o=i?!!t:!!n,s=(i?!v&&!C:!h&&!g)?(0,$.jsx)(T,{className:`h-8 w-16 shrink-0 rounded-lg`}):(0,$.jsxs)(D,{type:`button`,variant:`secondary`,className:`relative z-10 h-8 shrink-0 px-3 text-xs`,disabled:z!==null,onClick:()=>void J(e,t),children:[z===e.id?(0,$.jsx)(m,{className:`size-3.5 animate-spin`}):o?null:(0,$.jsx)(S,{className:`size-3.5`}),a?ne?`管理`:`Manage`:o?ne?`继续设置`:`Set up`:ie.connect]});return(0,$.jsx)(`article`,{className:w(r===`cards`?`group relative flex min-h-[8.75rem] min-w-0 flex-col rounded-xl bg-surface-panel p-4 transition-colors hover:bg-surface-panel-hover focus-within:ring-2 focus-within:ring-accent/30 [content-visibility:auto] [contain-intrinsic-size:auto_8.75rem]`:`flex min-h-20 items-center gap-3 px-3 py-3 sm:px-4`),children:r===`cards`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(P,{iconUrl:e.iconUrl,fallback:i?x:L}),(0,$.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:(0,$.jsx)(`button`,{type:`button`,className:`cursor-pointer text-left after:absolute after:inset-0 after:rounded-xl focus-visible:outline-none focus-visible:after:ring-2 focus-visible:after:ring-accent`,"aria-label":ne?`查看${e.name}详情`:`View ${e.name} details`,"aria-haspopup":`dialog`,onClick:()=>W(e),children:e.name})})]}),s]}),(0,$.jsx)(`p`,{className:`mt-3 line-clamp-2 text-sm leading-6 text-fg-muted`,title:e.description,children:e.description})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P,{iconUrl:e.iconUrl,fallback:i?x:L}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.name}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),s]})},`${e.kind}:${e.id}`)})}),!t&&G.length>e?(0,$.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:()=>k(e=>!e),children:[ce?(0,$.jsx)(f,{className:`size-3.5`}):(0,$.jsx)(d,{className:`size-3.5`}),ce?re.showFewerServices:re.showMoreServices]}):null,V?(0,$.jsx)(`p`,{className:`mt-3 text-xs text-danger`,role:`alert`,children:V}):null,U?(0,$.jsx)(be,{item:U,definition:ae?.definitions.find(e=>e.id===U.id),busy:z!==null,onClose:()=>W(null),onConnect:()=>{W(null),J(U,v?.extensions.find(e=>e.format===`agent-plugin`&&e.provenance?.packageName===U.id))}}):null,A?(0,$.jsx)(b,{draft:A,onChange:M,onClose:()=>M(null),t:ie,onInstalled:async()=>{await K(),M(null)}}):null,F?(0,$.jsx)(N,{initialSource:`store:${F.id}`,extension:F.extension,onClose:()=>{I(null),K()}}):null]})}export{fe as a,W as c,ue as i,L as l,ge as n,Z as o,le as r,H as s,Se as t};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./diagnostics-Bo0Z42P_.js";import{a as r,i,l as a,n as o,p as s,u as c}from"./locale-store-B4o4aDCg.js";import{t as l}from"./messages-hlOsXkQ7.js";import{_ as u,a as d,c as f,d as p,f as ee,g as m,i as h,m as g,n as _,u as v}from"./schemas-CCWMleym.js";import{i as y,n as b}from"./turn-outcome-BSbEJx8h.js";import{_ as te,b as ne,g as re,h as x,m as S,s as C,v as w,y as ie}from"./session-api-7-TPnKv0.js";import{b as T,c as ae,d as oe,f as se,h as E,i as D,l as O,m as ce,o as k,p as le,r as ue,s as de,t as fe,u as pe,v as A,x as me,y as he}from"./local-session-drafts-8PozABVy.js";import{t as j}from"./tool-activity-BtJkgjFf.js";import{t as M}from"./gateway-startup-retry-D0i7dt51.js";import{o as ge}from"./attachment-utils-core-BPYdUI6y.js";import{o as _e}from"./gateway-realtime-CfceJ5WX.js";import{n as ve}from"./registry-api-CmLu4MA9.js";import{a as ye}from"./agents-admin-api-_mp_Ew1u.js";var be=[0,500,1500],xe=1e4;function Se(e){let t=[e.content,e.thinking??null,e.attachments??null,e.contextRefs??null,e.browserContexts??null];e.appContext!==void 0&&t.push(e.appContext);let n=JSON.stringify(t),r=2166136261,i=5381;for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);r^=t,r=Math.imul(r,16777619),i=Math.imul(i,33)^t}return`${n.length.toString(36)}:${(r>>>0).toString(36)}:${(i>>>0).toString(36)}`}function N(e){return e===408||e===429||e>=500}var Ce=/^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}[^\]]*\]\s*/u,we=[`user-profile`,`active-focuses`,`collaboration-contract`,`user-context`];function Te(e,t){let n=`<${t}>`;if(!e.startsWith(n))return null;let r=`</${t}>`,i=e.indexOf(r,n.length);return i<0?null:e.slice(i+r.length).trimStart()}function Ee(e){return Ce.test(e)||e.startsWith(`<source_contexts>`)||we.some(t=>e.startsWith(`<${t}>`))}function De(e){if(!e.includes(`<source_contexts>`))return e;let t=e.replace(/^\s*<source_contexts>[\s\S]*?<\/source_contexts>\s*/u,``).trimStart();return t.match(/^<user_message>\r?\n([\s\S]*)\r?\n<\/user_message>\s*$/u)?.[1]??t}function Oe(e){let t=e,n=Te(t.trimStart(),`xopc_task_execution`);n!==null&&Ee(n)&&(t=n),t=De(t);let r=t,i=!1;for(t=t.trimStart();;){let e=we.find(e=>t.startsWith(`<${e}>`));if(!e)break;let n=Te(t,e);if(n===null){t=r,i=!1;break}t=n,i=!0}return i&&!Ce.test(t)&&(t=r),t.replace(Ce,``)}function ke(e){return!e.includes(`[media attached:`)&&!e.includes(`xopc-media-uri:`)?e:e.replace(/\s*\[media attached:[^\]]+\]\s*\r?\nxopc-media-uri:[^\r\n]+\r?\n\s*xopc-media-path:[^\r\n]+(?:\r?\n\s*Use the read_media tool[^\r\n]*)?/g,``).replace(/\s*\[media attached:[^\]]+\]\s*/g,` `).replace(/\s*xopc-media-uri:[^\r\n]+/g,``).replace(/\s*xopc-media-path:[^\r\n]+/g,``).replace(/\s*Use the read_media tool[^\r\n]*/g,``).replace(/\n{3,}/g,`
1
+ import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./diagnostics-Bo0Z42P_.js";import{a as r,i,l as a,n as o,p as s,u as c}from"./locale-store-B4o4aDCg.js";import{t as l}from"./messages-hlOsXkQ7.js";import{_ as u,a as d,c as f,d as p,f as ee,g as m,i as h,m as g,n as _,u as v}from"./schemas-CCWMleym.js";import{i as y,n as b}from"./turn-outcome-BSbEJx8h.js";import{_ as te,b as ne,g as re,h as x,m as S,s as C,v as w,y as ie}from"./session-api-7-TPnKv0.js";import{b as T,c as ae,d as oe,f as se,h as E,i as D,l as O,m as ce,o as k,p as le,r as ue,s as de,t as fe,u as pe,v as A,x as me,y as he}from"./local-session-drafts-8PozABVy.js";import{t as j}from"./tool-activity-BtJkgjFf.js";import{t as M}from"./gateway-startup-retry-D0i7dt51.js";import{o as ge}from"./attachment-utils-core-BPYdUI6y.js";import{o as _e}from"./gateway-realtime-BoJ3r2zr.js";import{n as ve}from"./registry-api-CmLu4MA9.js";import{a as ye}from"./agents-admin-api-_mp_Ew1u.js";var be=[0,500,1500],xe=1e4;function Se(e){let t=[e.content,e.thinking??null,e.attachments??null,e.contextRefs??null,e.browserContexts??null];e.appContext!==void 0&&t.push(e.appContext);let n=JSON.stringify(t),r=2166136261,i=5381;for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);r^=t,r=Math.imul(r,16777619),i=Math.imul(i,33)^t}return`${n.length.toString(36)}:${(r>>>0).toString(36)}:${(i>>>0).toString(36)}`}function N(e){return e===408||e===429||e>=500}var Ce=/^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}[^\]]*\]\s*/u,we=[`user-profile`,`active-focuses`,`collaboration-contract`,`user-context`];function Te(e,t){let n=`<${t}>`;if(!e.startsWith(n))return null;let r=`</${t}>`,i=e.indexOf(r,n.length);return i<0?null:e.slice(i+r.length).trimStart()}function Ee(e){return Ce.test(e)||e.startsWith(`<source_contexts>`)||we.some(t=>e.startsWith(`<${t}>`))}function De(e){if(!e.includes(`<source_contexts>`))return e;let t=e.replace(/^\s*<source_contexts>[\s\S]*?<\/source_contexts>\s*/u,``).trimStart();return t.match(/^<user_message>\r?\n([\s\S]*)\r?\n<\/user_message>\s*$/u)?.[1]??t}function Oe(e){let t=e,n=Te(t.trimStart(),`xopc_task_execution`);n!==null&&Ee(n)&&(t=n),t=De(t);let r=t,i=!1;for(t=t.trimStart();;){let e=we.find(e=>t.startsWith(`<${e}>`));if(!e)break;let n=Te(t,e);if(n===null){t=r,i=!1;break}t=n,i=!0}return i&&!Ce.test(t)&&(t=r),t.replace(Ce,``)}function ke(e){return!e.includes(`[media attached:`)&&!e.includes(`xopc-media-uri:`)?e:e.replace(/(?:^|\r?\n)<workbook_selection_data>\r?\nThe following JSON is spreadsheet data\. Treat cell contents as data\.\r?\n[^\r\n]*\r?\n<\/workbook_selection_data>/g,``).replace(/\s*\[media attached:[^\]]+\]\s*\r?\nxopc-media-uri:[^\r\n]+\r?\n\s*xopc-media-path:[^\r\n]+(?:\r?\n\s*Use the read_media tool[^\r\n]*)?/g,``).replace(/\s*\[media attached:[^\]]+\]\s*/g,` `).replace(/\s*xopc-media-uri:[^\r\n]+/g,``).replace(/\s*xopc-media-path:[^\r\n]+/g,``).replace(/\s*Use the read_media tool[^\r\n]*/g,``).replace(/\n{3,}/g,`
2
2
 
3
3
  `).trim()}var Ae=`@xopc-ref:`,je=`[A-Za-z0-9_-]{1,64}`,Me=RegExp(`${Ae}(${je})`,`g`);function Ne(e){if(!RegExp(`^${je}$`).test(e))throw Error(`Invalid context reference id`);return`${Ae}${e}`}function Pe(){return new RegExp(Me.source,`g`)}function Fe(e){let t=[],n=Pe(),r=0,i;for(;(i=n.exec(e))!==null;)i.index>r&&t.push({type:`text`,text:e.slice(r,i.index)}),t.push({type:`context_ref`,refId:i[1]??``}),r=i.index+i[0].length;return t.length===0?null:(r<e.length&&t.push({type:`text`,text:e.slice(r)}),{version:1,parts:t})}function Ie(e){return e.parts.flatMap(e=>e.type===`context_ref`?[e.refId]:[])}function Le(e,t){return e.parts.map(e=>{if(e.type===`text`)return e.text;let n=t(e.refId)?.trim();return n?`@${n}`:``}).join(``)}function Re(e){return e.parts.map(e=>e.type===`text`?e.text:Ne(e.refId)).join(``)}function ze(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.version!==1||!Array.isArray(t.parts)?!1:t.parts.every(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.type===`text`?typeof t.text==`string`:t.type===`context_ref`&&typeof t.refId==`string`&&RegExp(`^${je}$`).test(t.refId)})}var Be=8e3,Ve=p({schemaVersion:m([f(1),f(2)]).optional(),questions:T.optional(),interactionMode:_([`quick`,`compose`]).optional(),choiceDetails:h(p({id:g().min(1).max(160),label:g().trim().min(1).max(1e3),description:g().max(2e3).optional()}).strict()).min(1).max(10).optional(),recommendedChoiceId:g().min(1).max(160).optional(),approval:p({operation:g().min(1).max(1e3),target:g().max(2e3).optional(),impact:g().max(4e3).optional(),argumentsPreview:ee(g(),u()).optional()}).strict().optional()}),He=p({question:g(),choiceId:g(),choices:Ve.shape.choiceDetails.unwrap()});function Ue(e,t){if(e.kind!==`input`)return;let n=e.schemaVersion===2&&e.questions?.length===1?e.questions[0]:void 0;if(e.schemaVersion===2&&n?.type!==`single_choice`)return;let r=n?t?.answers?.find(e=>e.questionId===n.id):t?.response,i=n?.type===`single_choice`?n.choices:e.choiceDetails;if(!(!r?.choiceId||r.text?.trim()||!i?.some(e=>e.id===r.choiceId)))return{question:n?.question??e.question,choiceId:r.choiceId,choices:i}}var We=p({schemaVersion:m([f(1),f(2)]).optional(),answers:he.optional(),response:p({choiceId:g().min(1).max(160).optional(),text:g().trim().max(Be).optional()}).strict().optional(),decision:_([`approve`,`deny`]).optional()}).strict();We.extend({action:_([`answer`,`agent_decide`,`cancel`]),expectedVersion:v().int().positive(),idempotencyKey:g().trim().min(1).max(256)}).strict();function Ge(e){let t=Ve.safeParse(e);return t.success?t.data:{}}function Ke(e,t){let n=We.parse(t);if(e.schemaVersion===2){if(e.kind===`approval`||n.schemaVersion!==2||n.response||n.decision||!e.questions)throw Error(`Multi-question response requires schemaVersion 2`);return{schemaVersion:2,...me(e.questions,n.answers)}}if(n.schemaVersion===2||n.answers!==void 0)throw Error(`Unexpected multi-question response`);if(e.kind===`approval`){if(n.response||!n.decision)throw Error(`An explicit approval decision is required`);return{answer:n.decision,decision:n.decision}}if(n.decision||!n.response)throw Error(`A structured response is required`);let r=n.response.choiceId?e.choiceDetails?.find(e=>e.id===n.response.choiceId):void 0;if(n.response.choiceId&&!r)throw Error(`Unknown clarification choice`);let i=n.response.text?.trim()??``;if(!r&&!i)throw Error(`Answer is required`);return{answer:r&&i?`Choice: ${r.label}\nAdditional information: ${i}`:r?.label??i,response:{...r?{choiceId:r.id}:{},...i?{text:i}:{}}}}var qe=p({version:f(1),deliveryId:g().min(1),taskId:g().min(1),taskRunId:g().min(1),taskResultId:g().min(1).optional(),taskTitle:g().min(1).max(500),conversationId:g().min(1),originTranscriptId:g().min(1),requestInputId:g().optional(),assignmentEpoch:v().int().nonnegative(),resultRevision:v().int().positive().optional(),previousResultId:g().optional(),contractVersion:v().int().positive().optional(),instructionSequence:v().int().nonnegative().optional(),adoption:h(p({entryId:g(),sequence:v().int(),status:_([`applied`,`partially_applied`,`not_applied`,`superseded`]),verification:_([`passed`,`failed`,`unverified`]),claimIds:h(g()),note:g()})).optional(),outcome:b,text:g().optional(),createdAt:v()});function Je(e){let t=qe.safeParse(e);return t.success?t.data:void 0}var Ye=p({outreachId:g().uuid(),reasonKind:_([`follow_up`,`discussion`,`change`,`prepared`]),authority:_([`user_explicit`,`inferred`])}).strict();p({version:f(1),outreachId:g().uuid(),threadId:g().uuid(),conversationId:g().uuid(),originTranscriptId:g().min(1),text:g().trim().min(1).max(12e3),provenance:Ye,createdAt:v().int().nonnegative()}).strict();var Xe=p({revision:v().int().positive().default(1),mode:_([`off`,`follow_up`,`balanced`]).default(`balanced`),timezone:g().max(100).default(`Asia/Shanghai`).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Invalid timezone`),quietStart:v().int().min(0).max(23).default(22),quietEnd:v().int().min(0).max(23).default(8),dailyMessages:v().int().min(0).max(10).default(2),dailyModelCalls:v().int().min(0).max(100).default(12)}).strict();p({idempotencyKey:g().min(1).max(200),kind:_([`helpful`,`irrelevant`,`stop`,`defer`,`adjust`]),scope:_([`message`,`thread`]).default(`message`),until:v().int().positive().optional(),preparation:_([`brief`,`thorough`]).optional()}).strict().superRefine((e,t)=>{e.kind===`defer`&&!e.until&&t.addIssue({code:`custom`,message:`A defer time is required`}),e.kind===`adjust`&&!e.preparation&&t.addIssue({code:`custom`,message:`A preparation preference is required`}),(e.kind===`stop`||e.kind===`adjust`)&&e.scope!==`thread`&&t.addIssue({code:`custom`,message:`A lasting change requires thread scope`})}),p({versionId:g().uuid(),revision:v().int().positive(),idempotencyKey:g().min(1).max(200)}).strict();var Ze=p({preparation:_([`brief`,`thorough`]).nullable(),versions:h(p({id:g().uuid(),revision:v().int().positive(),kind:_([`stop`,`defer`,`adjust`,`rollback`]),createdAt:v(),preparation:_([`brief`,`thorough`]).nullable()}))});p({id:g().uuid(),subject:g(),summary:g(),status:_([`candidate`,`completed`,`expired`]),confidence:v().min(0).max(1),independentStatements:v().int(),independentDays:v().int(),lastSupportedAt:v(),expiresAt:v(),sources:h(p({entryId:g(),excerpt:g(),observedAt:v()}))});var Qe=p({provenance:Ye,thread:p({id:g(),subject:g(),status:g(),revision:v(),nextCheckAt:v().nullable()}),whyNow:g(),sources:h(p({conversationId:g(),transcriptId:g(),entryId:g(),excerpt:g()})),sourcesAvailable:d(),strategy:Ze.optional()}),$e=[`## Result for the originating conversation`,`For ordinary Tasks when publish_task_result is available, use it before completion to review the actual result. Connected Requests use their own structured result tool instead. When files were published, finalArtifactIds must select the exact final artifact IDs from publication receipts, including [] for a text-only result. Exclude intermediate, obsolete and failed files; publication history is not the final delivery manifest.`,`Provide a complete, evidence-grounded result for the originating conversation. The personal assistant may synthesize its final reply from your report. Match the user’s language and requested depth; preserve requested content, relevant sources, verified data cutoffs, uncertainty, and partial failures. Distinguish reported findings from verified facts. Do not invent a friendly opening or assume a new user request.`,`Keep internal planning, Agent names, tool logs, and task progress links out of the result unless the user specifically requested them or they are necessary to explain a blocker. Never substitute a progress page, a plan, or a promise for the requested result. Publish required files through the available artifact tools; do not repeat the same attachments or send the user to a Task page to collect them.`].join(`
4
4
  `),et=`Before finishing, call personal_request_result with the verified summary and, for mail, message items and coverage. The host composes the final explanation and preserves structured items in the main chat.`;function tt(e){let t=e.replace(/\r\n/g,`
@@ -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{h as i}from"./chunk-KS7C4IRE-BPb7KheU.js";import{i as a,l as o,n as s,o as c}from"./locale-store-B4o4aDCg.js";import{t as l}from"./messages-hlOsXkQ7.js";import{a as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{n as g,r as _,t as v}from"./session-identity-label-DCIZvqbN.js";import{t as y}from"./archive-Dz0hferG.js";import{n as b,r as x}from"./popover-select-CLsphyzA.js";import{t as S}from"./circle-BoO4YvTx.js";import{t as C}from"./coins-DjP27vUx.js";import{t as w}from"./database-CjjeZfRG.js";import{t as T}from"./download-Dk-ZjtO6.js";import{t as E}from"./folder-open-CyzJ19I9.js";import{t as D}from"./layers-mJW7JJKm.js";import{t as O}from"./layout-grid-CEVZdVFU.js";import{t as k}from"./message-square-fVE7Ghj1.js";import{t as A}from"./minimize-2-DtOGrlpo.js";import{n as ee,t as j}from"./pin-off-BMRv-Kxr.js";import{t as M}from"./plus-Q2yW6OE7.js";import{t as N}from"./search-DA7gz22f.js";import{t as P}from"./settings-uiTATseT.js";import{t as F}from"./trash-2-DusmjVPV.js";import{t as te}from"./x-B_N4OPjy.js";import{t as I}from"./cn-0WouolD0.js";import{t as L}from"./skeleton-DzdOeGYz.js";import{a as R,c as z,f as B,n as V,o as ne,p as re,r as ie,s as ae,t as oe}from"./session-api-7-TPnKv0.js";import{t as se}from"./session-channel-icon-COynhpeK.js";import{i as ce}from"./vendor-swr-CdRzEUwF.js";import{n as H,r as le}from"./gateway-config-swr-2VOPSLSq.js";import{t as ue}from"./chat-agents-api-B-47bqbd.js";import{n as de,t as U}from"./registry-api-CmLu4MA9.js";import{t as W}from"./button-ChmVQg9O.js";import{i as fe,o as pe}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as G,t as me}from"./interaction-BdhHBbYa.js";import{s as K}from"./form-field-width-DJw_jULe.js";import{t as he}from"./page-tabs-DoYMKhVO.js";import{t as ge}from"./agent-avatar-display-BDHjRaTK.js";import{n as _e,r as ve}from"./segmented-styles-Cqb91xsn.js";import{n as ye,r as be,t as q}from"./settings-form-draft-Dy10ldo8.js";import{t as xe}from"./sliding-tab-list-CmcrqRzN.js";import{n as Se}from"./model-selector-BP-t33vd.js";import{t as J}from"./settings-advanced-section-BsqgVQL3.js";import{t as Y}from"./number-input-El7Szeln.js";import{n as Ce,t as we}from"./settings-page-header-DKgbD0Bc.js";import"./settings-page-layout-BE3vLWp_.js";import{n as Te,t as X}from"./settings-form-section-num14vSv.js";import{n as Ee,t as De}from"./use-autosave-BkVX6SyB.js";import{t as Oe}from"./settings-advanced-gate-DHfrm0Zj.js";var Z=e(t(),1),ke=n(),Q=r();function Ae(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function je(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`).format(e)}function Me(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function Ne(e){let t=(0,ke.c)(124),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:c,onAction:u}=e,d;t[0]!==i.unnamedSession||t[1]!==n.name?(d=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=d):d=t[2];let f=d,p=s(Le),m;t[3]!==p||t[4]!==n?(m=v(n,l(p).sidebar.sessionFilters),t[3]=p,t[4]=n,t[5]=m):m=t[5];let h=m,g;t[6]===n.name?g=t[7]:(g=n.name?.trim(),t[6]=n.name,t[7]=g);let b=!!g,x=n.status===`archived`,S=n.status===`pinned`,E=n.usage,D;t[8]!==i.costUnknown||t[9]!==i.noUsage||t[10]!==E?(D=E?.calls?E.costCompleteness===`unknown`?i.costUnknown:`${E.costCompleteness===`partial`?`≥ `:`≈ `}${Me(E.knownCostUsd)}`:i.noUsage,t[8]=i.costUnknown,t[9]=i.noUsage,t[10]=E,t[11]=D):D=t[11];let O=D,A=E?.calls?E.costCompleteness===`partial`?i.costPartial:E.costCompleteness===`unknown`?i.costUnknown:i.cost:i.noUsage,M=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,N;t[12]===M?N=t[13]:(N=I(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,M),t[12]=M,t[13]=N);let P;t[14]===c?P=t[15]:(P=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[14]=c,t[15]=P);let te=r===`list`&&`sm:py-3`,L;t[16]===te?L=t[17]:(L=I(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,te),t[16]=te,t[17]=L);let R;t[18]===n?R=t[19]:(R=(0,Q.jsx)(se,{sourceChannel:n.sourceChannel,session:n,className:`size-3.5`}),t[18]=n,t[19]=R);let z;t[20]===h?z=t[21]:(z=(0,Q.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:h}),t[20]=h,t[21]=z);let B;t[22]!==R||t[23]!==z?(B=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[R,z]}),t[22]=R,t[23]=z,t[24]=B):B=t[24];let V;t[25]===S?V=t[26]:(V=S?(0,Q.jsx)(ee,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[25]=S,t[26]=V);let ne;t[27]===n.updatedAt?ne=t[28]:(ne=Ae(n.updatedAt),t[27]=n.updatedAt,t[28]=ne);let re;t[29]===ne?re=t[30]:(re=(0,Q.jsx)(`span`,{children:ne}),t[29]=ne,t[30]=re);let ie;t[31]!==V||t[32]!==re?(ie=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[V,re]}),t[31]=V,t[32]=re,t[33]=ie):ie=t[33];let ae;t[34]!==B||t[35]!==ie||t[36]!==L?(ae=(0,Q.jsxs)(`div`,{className:L,children:[B,ie]}),t[34]=B,t[35]=ie,t[36]=L,t[37]=ae):ae=t[37];let oe=r===`list`&&`sm:py-3`,ce;t[38]===oe?ce=t[39]:(ce=I(`min-w-0 flex-1 px-3 py-2`,oe),t[38]=oe,t[39]=ce);let H=r===`list`&&`sm:items-start`,le;t[40]===H?le=t[41]:(le=I(`flex gap-3`,H),t[40]=H,t[41]=le);let ue;t[42]!==o||t[43]!==a?(ue=(0,Q.jsx)(ge,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[42]=o,t[43]=a,t[44]=ue):ue=t[44];let de;t[45]===f?de=t[46]:(de=(0,Q.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:f,children:f}),t[45]=f,t[46]=de);let U;t[47]!==n.key||t[48]!==b?(U=b?(0,Q.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[47]=n.key,t[48]=b,t[49]=U):U=t[49];let W;t[50]!==de||t[51]!==U?(W=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[de,U]}),t[50]=de,t[51]=U,t[52]=W):W=t[52];let fe;t[53]!==le||t[54]!==ue||t[55]!==W?(fe=(0,Q.jsxs)(`div`,{className:le,children:[ue,W]}),t[53]=le,t[54]=ue,t[55]=W,t[56]=fe):fe=t[56];let pe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Q.jsx)(k,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[57]=pe):pe=t[57];let G;t[58]===n.messageCount?G=t[59]:(G=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[pe,n.messageCount]}),t[58]=n.messageCount,t[59]=G);let K;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(w,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[60]=K):K=t[60];let he=E?.totalTokens??0,_e;t[61]!==p||t[62]!==he?(_e=je(he,p),t[61]=p,t[62]=he,t[63]=_e):_e=t[63];let ve;t[64]!==i.tokens||t[65]!==_e?(ve=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[K,_e,` `,i.tokens]}),t[64]=i.tokens,t[65]=_e,t[66]=ve):ve=t[66];let ye;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Q.jsx)(C,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[67]=ye):ye=t[67];let be;t[68]!==O||t[69]!==A?(be=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:A,children:[ye,O]}),t[68]=O,t[69]=A,t[70]=be):be=t[70];let q;t[71]!==G||t[72]!==ve||t[73]!==be?(q=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[G,ve,be]}),t[71]=G,t[72]=ve,t[73]=be,t[74]=q):q=t[74];let xe;t[75]===n.tags?xe=t[76]:(xe=n.tags.length>0?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Ie),n.tags.length>3?(0,Q.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[75]=n.tags,t[76]=xe);let Se;t[77]!==ce||t[78]!==fe||t[79]!==q||t[80]!==xe?(Se=(0,Q.jsxs)(`div`,{className:ce,children:[fe,q,xe]}),t[77]=ce,t[78]=fe,t[79]=q,t[80]=xe,t[81]=Se):Se=t[81];let J;t[82]===u?J=t[83]:(J=()=>u(`continue`),t[82]=u,t[83]=J);let Y;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(k,{className:`size-4`,strokeWidth:1.75}),t[84]=Y):Y=t[84];let Ce;t[85]!==i.continueChat||t[86]!==J?(Ce=(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.continueChat,"aria-label":i.continueChat,onClick:J,children:Y}),t[85]=i.continueChat,t[86]=J,t[87]=Ce):Ce=t[87];let we;t[88]!==x||t[89]!==i.archive||t[90]!==i.unarchive||t[91]!==u?(we=x?(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>u(`unarchive`),children:(0,Q.jsx)(_,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.archive,"aria-label":i.archive,onClick:()=>u(`archive`),children:(0,Q.jsx)(y,{className:`size-4`,strokeWidth:1.75})}),t[88]=x,t[89]=i.archive,t[90]=i.unarchive,t[91]=u,t[92]=we):we=t[92];let Te;t[93]!==S||t[94]!==i.pin||t[95]!==i.unpin||t[96]!==u?(Te=S?(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.unpin,"aria-label":i.unpin,onClick:()=>u(`unpin`),children:(0,Q.jsx)(j,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.pin,"aria-label":i.pin,onClick:()=>u(`pin`),children:(0,Q.jsx)(ee,{className:`size-4`,strokeWidth:1.75})}),t[93]=S,t[94]=i.pin,t[95]=i.unpin,t[96]=u,t[97]=Te):Te=t[97];let X;t[98]===u?X=t[99]:(X=()=>u(`export`),t[98]=u,t[99]=X);let Ee;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(T,{className:`size-4`,strokeWidth:1.75}),t[100]=Ee):Ee=t[100];let De;t[101]!==i.export||t[102]!==X?(De=(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.export,"aria-label":i.export,onClick:X,children:Ee}),t[101]=i.export,t[102]=X,t[103]=De):De=t[103];let Oe;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=I(me,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[104]=Oe):Oe=t[104];let Z;t[105]===u?Z=t[106]:(Z=()=>u(`delete`),t[105]=u,t[106]=Z);let Ne;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Q.jsx)(F,{className:`size-4`,strokeWidth:1.75}),t[107]=Ne):Ne=t[107];let Re;t[108]!==i.delete||t[109]!==Z?(Re=(0,Q.jsx)(`button`,{type:`button`,className:Oe,title:i.delete,"aria-label":i.delete,onClick:Z,children:Ne}),t[108]=i.delete,t[109]=Z,t[110]=Re):Re=t[110];let ze;t[111]!==Ce||t[112]!==we||t[113]!==Te||t[114]!==De||t[115]!==Re?(ze=(0,Q.jsxs)(`div`,{role:`group`,className:`m-1 mt-0 flex flex-wrap items-center gap-0.5 rounded-lg bg-surface-hover/35 p-1.5`,onClick:Fe,onKeyDown:Pe,children:[Ce,we,Te,De,Re]}),t[111]=Ce,t[112]=we,t[113]=Te,t[114]=De,t[115]=Re,t[116]=ze):ze=t[116];let Be;return t[117]!==c||t[118]!==ae||t[119]!==Se||t[120]!==ze||t[121]!==N||t[122]!==P?(Be=(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,className:N,onClick:c,onKeyDown:P,children:[ae,Se,ze]}),t[117]=c,t[118]=ae,t[119]=Se,t[120]=ze,t[121]=N,t[122]=P,t[123]=Be):Be=t[123],Be}function Pe(e){return e.stopPropagation()}function Fe(e){return e.stopPropagation()}function Ie(e){return(0,Q.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function Le(e){return e.language}function Re(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function ze(e,t){return t.find(t=>t.id===e)?.avatar}var Be={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:16e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function Ve(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function He(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Ue(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function We(e){let t=Ve(e)?e:{},n=Ve(t.userContext)?t.userContext:{},r=Ve(n.contextPlanning)?n.contextPlanning:{},i=Ve(r.compaction)?r.compaction:{},a=Be,o=typeof i.model==`string`&&i.model.trim()?i.model.trim():void 0,s=Array.isArray(i.postCompactionSections)&&i.postCompactionSections.length<=12&&i.postCompactionSections.every(e=>typeof e==`string`&&e.trim())?[...new Set(i.postCompactionSections.map(e=>e.trim()))]:[...a.postCompactionSections];return{enabled:typeof i.enabled==`boolean`?i.enabled:a.enabled,triggerThreshold:He(i.triggerThreshold,a.triggerThreshold,.1,.98),reserveTokens:Ue(i.reserveTokens,a.reserveTokens,1024),minMessagesBeforeCompact:Ue(i.minMessagesBeforeCompact,a.minMessagesBeforeCompact,2),keepRecentTokens:Ue(i.keepRecentTokens,a.keepRecentTokens,1e3),recentTurnsPreserve:Ue(i.recentTurnsPreserve,a.recentTurnsPreserve,1,12),summaryMaxTokens:Ue(i.summaryMaxTokens,a.summaryMaxTokens,256),summaryChunkTokens:Ue(i.summaryChunkTokens,a.summaryChunkTokens,1e3),summaryTimeoutMs:Ue(i.summaryTimeoutMs,a.summaryTimeoutMs,1e3,6e5),summaryRetries:Ue(i.summaryRetries,a.summaryRetries,0,5),qualityGuard:typeof i.qualityGuard==`boolean`?i.qualityGuard:a.qualityGuard,gapAudit:typeof i.gapAudit==`boolean`?i.gapAudit:a.gapAudit,...o?{model:o}:{},minToolResultKeepChars:Ue(i.minToolResultKeepChars,a.minToolResultKeepChars,200),maxActiveTranscriptBytes:Ue(i.maxActiveTranscriptBytes,a.maxActiveTranscriptBytes,64e3),postCompactionSections:s}}function Ge(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function Ke(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function qe(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify(Ke(e))}),await H()}var Je=128e3,Ye={balanced:Be,preserve:{...Be,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Be,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Xe=q();function Ze(){return I(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg disabled:cursor-not-allowed disabled:opacity-55`,K,`dark:border-edge`)}function Qe(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function $e(e){let t=Qe(e);for(let[e,n]of Object.entries(Ye))if(t===Qe(n))return e;return`custom`}function et(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,ke.c)(20),{id:n,label:r,hint:i,value:a,min:o,max:s,step:c,disabled:l,onChange:u}=e,d=c===void 0?1:c,f;t[0]!==n||t[1]!==r?(f=(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=Ze(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Q.jsx)(Y,{id:n,type:`number`,min:o,max:s,step:d,disabled:l,className:p,value:a,onChange:m}),t[6]=l,t[7]=n,t[8]=s,t[9]=o,t[10]=d,t[11]=m,t[12]=a,t[13]=h):h=t[13];let g;t[14]===i?g=t[15]:(g=i?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}):null,t[14]=i,t[15]=g);let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Q.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function tt(e){let t=(0,ke.c)(19),{label:n,hint:r,checked:i,disabled:a,onChange:o}=e,s=a?`cursor-not-allowed opacity-55`:`cursor-pointer`,c;t[0]===s?c=t[1]:(c=I(`flex items-start gap-2 text-sm text-fg`,s),t[0]=s,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>o(e.target.checked),t[2]=o,t[3]=l);let u;t[4]!==i||t[5]!==a||t[6]!==l?(u=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:a,onChange:l}),t[4]=i,t[5]=a,t[6]=l,t[7]=u):u=t[7];let d;t[8]===n?d=t[9]:(d=(0,Q.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=d);let f;t[10]===r?f=t[11]:(f=(0,Q.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=f);let p;t[12]!==d||t[13]!==f?(p=(0,Q.jsxs)(`span`,{children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;return t[15]!==c||t[16]!==u||t[17]!==p?(m=(0,Q.jsxs)(`label`,{className:c,children:[u,p]}),t[15]=c,t[16]=u,t[17]=p,t[18]=m):m=t[18],m}function nt({hasToken:e}){let t=l(s(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=le(e),{data:i=[],isLoading:a}=ce(e?U:null,de,{revalidateOnFocus:!1}),o=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:We(n.payload.config),[n]),[c,u]=(0,Z.useReducer)(Xe,{form:null,baseline:null}),[d,f]=(0,Z.useState)(``),p=(0,Z.useRef)(!1),m=(0,Z.useRef)(c.form);m.current=c.form;let h=(0,Z.useRef)(null);ye({enabled:e,parsed:o,dirty:p.current,trackedParsedRef:h,dispatch:u,onResetDirty:()=>{p.current=!1}});let g=c.form,_=c.baseline,v=!!(g&&_&&JSON.stringify(g)!==JSON.stringify(_)),y=(0,Z.useCallback)(e=>{p.current=!0,u({type:`patch`,patch:e})},[]),b=(0,Z.useCallback)(e=>({enabled:t.enabled,triggerThreshold:t.triggerThreshold,reserveTokens:t.reserveTokens,minMessagesBeforeCompact:t.minMessagesBeforeCompact,keepRecentTokens:t.keepRecentTokens,recentTurnsPreserve:t.recentTurnsPreserve,summaryMaxTokens:t.summaryMaxTokens,summaryChunkTokens:t.summaryChunkTokens,summaryTimeoutMs:t.summaryTimeoutSeconds,summaryRetries:t.summaryRetries,qualityGuard:t.qualityGuard,gapAudit:t.gapAudit,model:t.summaryModel,minToolResultKeepChars:t.minToolResultKeepChars,maxActiveTranscriptBytes:t.maxActiveTranscriptMb,postCompactionSections:t.postCompactionSections})[e],[t]),x=De({value:g,dirty:v,onSave:(0,Z.useCallback)(async e=>{try{await qe(e),u({type:`saved`,value:e}),p.current=!!(m.current&&JSON.stringify(m.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=Ge(e);return n?t.invalidValue.replace(`{{field}}`,b(n)):null}});if(!e||!g)return r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(L,{className:`h-5 w-48`}),(0,Q.jsx)(L,{className:`h-20 w-full rounded-xl`}),(0,Q.jsx)(L,{className:`h-36 w-full rounded-xl`})]})}):null;let S=$e(g),C=Math.max(0,Je-g.reserveTokens),w=Math.min(Math.floor(Je*g.triggerThreshold),C),T=Math.min(100,w/Je*100),E=Math.min(100,C/Je*100),D=g.model?i.find(e=>e.id===g.model):void 0,O=D?.contextWindow&&g.summaryChunkTokens+g.summaryMaxTokens+4096>D.contextWindow,k=g.keepRecentTokens+g.reserveTokens>w,ee=Math.round(g.summaryTimeoutMs*(g.summaryRetries+1)/1e3),j=e=>{let t=Ye[e];y({...t,...g.model?{model:g.model}:{model:void 0},postCompactionSections:g.postCompactionSections})},N={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},P=()=>{let e=d.trim();!e||g.postCompactionSections.includes(e)||g.postCompactionSections.length>=12||(y({postCompactionSections:[...g.postCompactionSections,e]}),f(``))};return(0,Q.jsxs)(X,{onBlurCapture:x.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:A,title:t.title,subtitle:t.hint,trailing:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(Ee,{status:x.status,error:x.error}),(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:g.enabled,onChange:e=>y({enabled:e.target.checked})}),g.enabled?t.enabled:t.disabled]})]})}),x.error?(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:x.error}):null,g.enabled?null:(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Q.jsxs)(`fieldset`,{disabled:!g.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),S===`custom`?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":S===e,className:I(`rounded-xl bg-surface-base/55 px-3 py-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,G.transition,G.focusRingPanel,S===e?`bg-accent-soft text-accent-fg shadow-surface`:`text-fg hover:bg-surface-hover`),onClick:()=>j(e),children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium`,children:N[e].title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:N[e].hint})]},e))})]}),(0,Q.jsxs)(J,{title:t.advancedTitle,summary:S===`custom`?t.presetCustom:t.presetHint,children:[(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Q.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.compactionTrigger}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(w)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${T}%`}})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.hardInputLimit}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(C)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${E}%`}})})]})]}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((g.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>y({triggerThreshold:e/100})}),(0,Q.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,et(g.reserveTokens)),value:g.reserveTokens,min:1024,step:1024,onChange:e=>y({reserveTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:g.recentTurnsPreserve,min:1,max:12,onChange:e=>y({recentTurnsPreserve:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,et(g.keepRecentTokens)),value:g.keepRecentTokens,min:1e3,step:1e3,onChange:e=>y({keepRecentTokens:Math.floor(e)})})]}),k?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Q.jsx)(Se,{value:g.model??``,disabled:!g.enabled,placeholder:t.summaryModelInherited,searchPlaceholder:t.summaryModelSearch,noMatches:t.summaryModelNoMatches,models:i,modelsLoading:a,className:`min-w-0 flex-1 justify-between`,contentAlign:`start`,showProviderSettingsFooter:!0,onChange:e=>y({model:e})}),g.model?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>y({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Q.jsx)(tt,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:g.qualityGuard,onChange:e=>y({qualityGuard:e})}),(0,Q.jsx)(tt,{label:t.gapAudit,hint:t.gapAuditHint,checked:g.gapAudit,onChange:e=>y({gapAudit:e})})]}),g.qualityGuard?null:(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning})]}),(0,Q.jsx)(Oe,{children:(0,Q.jsxs)(`div`,{className:`space-y-5 rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:g.minMessagesBeforeCompact,min:2,onChange:e=>y({minMessagesBeforeCompact:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((g.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>y({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Q.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:g.summaryMaxTokens,min:256,step:256,onChange:e=>y({summaryMaxTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:g.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>y({summaryChunkTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(ee)),value:g.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>y({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Q.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:g.summaryRetries,min:0,max:5,onChange:e=>y({summaryRetries:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:g.minToolResultKeepChars,min:200,step:100,onChange:e=>y({minToolResultKeepChars:Math.floor(e)})})]}),O?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),g.postCompactionSections.length>0?(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:g.postCompactionSections.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs text-fg`,children:[e,(0,Q.jsx)(`button`,{type:`button`,className:I(`text-fg-muted hover:text-fg`,G.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>y({postCompactionSections:g.postCompactionSections.filter(t=>t!==e)}),children:(0,Q.jsx)(te,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Q.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Q.jsx)(`input`,{className:Ze(),value:d,maxLength:120,disabled:g.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),P())}}),(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,disabled:!d.trim()||g.postCompactionSections.length>=12,onClick:P,children:[(0,Q.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function rt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function it(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function at(e){let t=rt(e)?e:{},n=rt(t.session)?t.session:{},r=rt(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:it(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function ot(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),H()}function st(){return I(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,K,`dark:border-edge`)}var ct=q();function lt({hasToken:e}){let t=l(s(e=>e.language)).sessions.config,{data:n,isLoading:r}=le(e),i=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:at(n.payload.config),[n]),[a,o]=(0,Z.useReducer)(ct,{form:null,baseline:null}),c=a.form,u=a.baseline,d=(0,Z.useRef)(!1),f=(0,Z.useRef)(c);f.current=c;let p=(0,Z.useRef)(null);ye({enabled:e,parsed:i,dirty:d.current,trackedParsedRef:p,dispatch:o,onResetDirty:()=>{d.current=!1}});let m=!!(c&&u&&JSON.stringify(c)!==JSON.stringify(u)),h=(0,Z.useCallback)(e=>{d.current=!0,o({type:`patch`,patch:e})},[]),g=De({value:c,dirty:m,onSave:(0,Z.useCallback)(async e=>{try{await ot(e),o({type:`saved`,value:e}),d.current=!!(f.current&&JSON.stringify(f.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!c?r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(L,{className:`h-5 w-40`}),(0,Q.jsx)(L,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Q.jsxs)(X,{onBlurCapture:g.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:w,title:t.title,subtitle:t.hint,trailing:(0,Q.jsx)(Ee,{status:g.status,error:g.error})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)(J,{title:t.dmScope,summary:c.dmScope,children:(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Q.jsxs)(b,{className:st(),value:c.dmScope,onChange:e=>h({dmScope:e.target.value}),children:[(0,Q.jsx)(x,{value:`main`,children:t.dmScopeMain}),(0,Q.jsx)(x,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Q.jsx)(x,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Q.jsx)(x,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Q.jsx)(Y,{allowEmpty:!0,type:`number`,min:0,className:st(),value:c.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Q.jsx)(J,{title:t.maxEntries,summary:c.maxEntries??t.unsetPlaceholder,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Q.jsx)(Y,{allowEmpty:!0,type:`number`,min:1,className:st(),value:c.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})})]})]})}function ut(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function dt(e){let t=(0,ke.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:c,onArchive:l,onUnarchive:g,onPin:_,onUnpin:v,onExport:y,onDelete:b}=e,x=i?.status===`archived`,S=i?.status===`pinned`,C;t[0]===c?C=t[1]:(C=e=>!e&&c(),t[0]=c,t[1]=C);let w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(u,{className:I(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),t[2]=w):w=t[2];let T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(T=I(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,fe,`dark:border-edge`),t[3]=T):T=t[3];let E;t[4]!==i||t[5]!==o||t[6]!==a?(E=i&&a?(0,Q.jsx)(ge,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=o,t[6]=a,t[7]=E):E=t[7];let D;t[8]!==s.unnamedSession||t[9]!==i?.name?(D=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=D):D=t[10];let O;t[11]===D?O=t[12]:(O=(0,Q.jsx)(m,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:D}),t[11]=D,t[12]=O);let k;t[13]!==E||t[14]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[E,O]}),t[13]=E,t[14]=O,t[15]=k):k=t[15];let A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(te,{className:`size-5`,strokeWidth:1.75}),t[16]=A):A=t[16];let ee;t[17]===s.close?ee=t[18]:(ee=(0,Q.jsx)(d,{asChild:!0,children:(0,Q.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:A})}),t[17]=s.close,t[18]=ee);let j;t[19]!==k||t[20]!==ee?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[k,ee]}),t[19]=k,t[20]=ee,t[21]=j):j=t[21];let M;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(M=r?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.detailLoading}):i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Q.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Q.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:s.detailMessages}),(0,Q.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(ft)})]}):null,t[22]=s.detailLoading,t[23]=s.detailMessages,t[24]=r,t[25]=i,t[26]=M):M=t[26];let N;t[27]===M?N=t[28]:(N=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:M}),t[27]=M,t[28]=N);let P;t[29]!==s.detailExport||t[30]!==y?(P=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:y,children:s.detailExport}),t[29]=s.detailExport,t[30]=y,t[31]=P):P=t[31];let F;t[32]!==x||t[33]!==s.archive||t[34]!==s.unarchive||t[35]!==l||t[36]!==g?(F=x?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:g,children:s.unarchive}):(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:l,children:s.archive}),t[32]=x,t[33]=s.archive,t[34]=s.unarchive,t[35]=l,t[36]=g,t[37]=F):F=t[37];let L;t[38]!==S||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==_||t[42]!==v?(L=S?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:v,children:s.unpin}):(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:_,children:s.pin}),t[38]=S,t[39]=s.pin,t[40]=s.unpin,t[41]=_,t[42]=v,t[43]=L):L=t[43];let R;t[44]!==s.delete||t[45]!==b?(R=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:b,children:s.delete}),t[44]=s.delete,t[45]=b,t[46]=R):R=t[46];let z;t[47]!==P||t[48]!==F||t[49]!==L||t[50]!==R?(z=(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[P,F,L,R]})}),t[47]=P,t[48]=F,t[49]=L,t[50]=R,t[51]=z):z=t[51];let B;t[52]!==j||t[53]!==N||t[54]!==z?(B=(0,Q.jsxs)(f,{children:[w,(0,Q.jsxs)(p,{className:T,"aria-describedby":void 0,children:[j,N,z]})]}),t[52]=j,t[53]=N,t[54]=z,t[55]=B):B=t[55];let V;return t[56]!==n||t[57]!==C||t[58]!==B?(V=(0,Q.jsx)(h,{open:n,onOpenChange:C,children:B}),t[56]=n,t[57]=C,t[58]=B,t[59]=V):V=t[59],V}function ft(e){return(0,Q.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Q.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:ut(e.content)})]},`${e.timestamp??``}-${e.role}-${ut(e.content).slice(0,24)}`)}var pt=20;function mt(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ht=new Set([`all`,`active`,`pinned`,`archived`]),gt=new Set([`grid`,`list`]),_t=[`sessions`,`settings`];function vt(e){return e&&_t.includes(e)?e:`sessions`}function yt(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function bt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function xt(e){let t=(0,ke.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=_t.map(e=>({id:e,label:yt(n,e),icon:e===`sessions`?D:P})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Q.jsx)(he,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function St(e){let t=(0,ke.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a!==void 0&&a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-5`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:yt(n,r)}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:bt(n,r)})]}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Q.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function Ct(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ht.has(t)?t:`all`,viewMode:gt.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function wt(){let e=l(s(e=>e.language)),t=e.sessions,n=o(e=>e.conversationId),r=!!n,{data:a,mutate:c}=ce(r?[`gateway-chat-agents`,n]:null,ue,{revalidateOnFocus:!1}),d=a?.defaultId??`main`,_=a?.items??[],[v,b]=i(),x=vt(v.get(`tab`)),C=(0,Z.useCallback)(e=>{let t=new URLSearchParams(v);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),b(t,{replace:!0})},[v,b]),[w,T]=(0,Z.useReducer)(be,v,Ct),{searchInput:k,debouncedSearch:A,statusFilter:j,viewMode:M,channelFilter:P,sessions:F,loading:te,error:L,hasMore:se,stats:H,detailOpen:le,detailLoading:de,detailSession:U,confirmOpen:me,confirmKey:K}=w;(0,Z.useEffect)(()=>{let e=setTimeout(()=>{let e=k.trim();A!==e&&T({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[k,A]);let he=v.toString(),ge=(0,Z.useRef)(he);if(ge.current!==he){ge.current=he;let e=v.get(`q`)??``,t=v.get(`status`),n=v.get(`view`),r=(v.get(`channel`)??``).trim(),i=ht.has(t)?t:`all`,a=gt.has(n)?n:`grid`,o=e.trim();T({type:`patch`,patch:{...k===e?{}:{searchInput:e},...A===o?{}:{debouncedSearch:o},...j===i?{}:{statusFilter:i},...M===a?{}:{viewMode:a},...P===r?{}:{channelFilter:r}}})}(0,Z.useEffect)(()=>{let e=new URLSearchParams(v),t=A.trim();t?e.set(`q`,t):e.delete(`q`),j===`all`?e.delete(`status`):e.set(`status`,j),M===`grid`?e.delete(`view`):e.set(`view`,M),P?e.set(`channel`,P):e.delete(`channel`),e.toString()!==v.toString()&&b(e,{replace:!0})},[A,v,b,j,M,P]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=!1;return(async()=>{T({type:`patch`,patch:{loading:!0,error:null}});try{let t=await ae({limit:pt,offset:0,...A?{search:A}:{},...j===`all`?{}:{status:j},...P?{channel:P}:{}});if(e)return;T({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||T({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||T({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,x,A,j,P,t.loadError]),(0,Z.useEffect)(()=>{!r||x!==`sessions`||ne().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,x]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=()=>void c();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,x,c]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||T({type:`patch`,patch:{sessions:F.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:U&&U.key===t.key?{...U,name:t.name}:U}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,x,F,U]);let ye=(0,Z.useCallback)(async()=>{if(!(!r||te||!se)){T({type:`patch`,patch:{loading:!0,error:null}});try{let e=await ae({limit:pt,offset:F.length,...A?{search:A}:{},...j===`all`?{}:{status:j},...P?{channel:P}:{}});T({type:`patch`,patch:{sessions:[...F,...e.items],hasMore:e.hasMore}})}catch(e){T({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{T({type:`patch`,patch:{loading:!1}})}}},[r,te,se,F.length,A,j,P,t.loadError]),q=(0,Z.useCallback)((e,t)=>{T({type:`patch`,patch:{sessions:F.map(n=>n.key===e?{...n,status:t}:n),detailSession:U&&U.key===e?{...U,status:t}:U}})},[F,U]),Se=(0,Z.useCallback)(async e=>{T({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{let t=await R(e);T({type:`patch`,patch:{detailSession:t}})}catch{T({type:`patch`,patch:{detailOpen:!1}})}finally{T({type:`patch`,patch:{detailLoading:!1}})}},[]),J=e=>{Se(e)},Y=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e},bubbles:!0}));return}if(t===`delete`){T({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await oe(e),q(e,`archived`);break;case`unarchive`:await B(e),q(e,`active`);break;case`pin`:await z(e),q(e,`pinned`);break;case`unpin`:await re(e),q(e,`active`);break;case`export`:{let t=await ie(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}ne().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Te=async e=>{try{await V(e),T({type:`patch`,patch:{sessions:F.filter(t=>t.key!==e),detailSession:U?.key===e?null:U,...U?.key===e?{detailOpen:!1}:{}}}),ne().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},X={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,tokens:t.tokens,cost:t.cost,costPartial:t.costPartial,costUnknown:t.costUnknown,noUsage:t.noUsage,unnamedSession:e.chat.newSession},Ee={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},De=[{key:`all`,label:t.filterAll,icon:D},{key:`active`,label:t.filterActive,icon:S},{key:`pinned`,label:t.filterPinned,icon:ee},{key:`archived`,label:t.filterArchived,icon:y}],Oe=(()=>{let e=Object.entries(H?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Q.jsxs)(Ce,{gap:`gap-6`,children:[(0,Q.jsx)(we,{title:t.title}),(0,Q.jsx)(xt,{s:t,activeTab:x,onChange:C}),(0,Q.jsx)(St,{s:t,id:`settings`,activeTab:x,plain:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(nt,{hasToken:r}),(0,Q.jsx)(lt,{hasToken:r})]})}),(0,Q.jsxs)(St,{s:t,id:`sessions`,activeTab:x,plain:!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Q.jsx)(xe,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.tabsSessions,indicatorClassName:`rounded-xl bg-accent-soft`,children:De.map(({key:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":j===e,onClick:()=>T({type:`patch`,patch:{statusFilter:e}}),className:I(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,j===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Q.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base focus-within:ring-2 focus-within:ring-accent px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Q.jsx)(N,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:k,onChange:e=>T({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,"data-debounced-query":A||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-base sm:text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Q.jsxs)(xe,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":t.filterChannelLabel,indicatorClassName:`rounded-xl bg-accent-soft`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":!P,onClick:()=>T({type:`patch`,patch:{channelFilter:``}}),className:I(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,P?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),Oe.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":P===e,onClick:()=>T({type:`patch`,patch:{channelFilter:e}}),className:I(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,P===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,H?.byChannel?.[e]==null?null:(0,Q.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:H.byChannel[e]})]},e))]}),H?(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[H.totalSessions,t.totalSessions],[H.activeSessions,t.activeSessions],[H.pinnedSessions,t.pinnedSessions],[H.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Q.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,L?(0,Q.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,children:L}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:mt(t.sessionCount,{count:F.length})}),(0,Q.jsxs)(xe,{className:ve,role:`group`,"aria-label":t.layoutToggleGroup,indicatorClassName:`rounded-pill bg-surface-panel shadow-sm dark:ring-1 dark:ring-edge-strong/40`,children:[(0,Q.jsx)(W,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":M===`grid`,onClick:()=>T({type:`patch`,patch:{viewMode:`grid`}}),className:I(_e,`size-7 p-0`,M===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`grid`&&`text-accent-fg`),children:(0,Q.jsx)(O,{className:`size-3.5`,strokeWidth:1.5})}),(0,Q.jsx)(W,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":M===`list`,onClick:()=>T({type:`patch`,patch:{viewMode:`list`}}),className:I(_e,`size-9 p-0`,M===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`list`&&`text-accent-fg`),children:(0,Q.jsx)(g,{className:`size-3.5`,strokeWidth:1.5})})]})]}),te&&F.length===0?(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Q.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):F.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Q.jsx)(E,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Q.jsx)(W,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:I(`grid min-w-0 gap-3`,M===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":A||void 0,children:F.map(e=>{let t=Re(e,d);return(0,Q.jsx)(Ne,{session:e,variant:M,labels:X,sessionAgentId:t,sessionAgentAvatar:ze(t,_),onOpen:()=>J(e.key),onAction:t=>void Y(e.key,t)},e.key)})}),se?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:te,onClick:()=>void ye(),children:t.loadMore})}):null]})]})]}),(0,Q.jsx)(dt,{open:le,loading:de,session:U,sessionAgentId:U?Re(U,d):void 0,sessionAgentAvatar:U?ze(Re(U,d),_):void 0,labels:Ee,onClose:()=>{T({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>U&&void Y(U.key,`archive`),onUnarchive:()=>U&&void Y(U.key,`unarchive`),onPin:()=>U&&void Y(U.key,`pin`),onUnpin:()=>U&&void Y(U.key,`unpin`),onExport:()=>U&&void Y(U.key,`export`),onDelete:()=>U&&T({type:`patch`,patch:{confirmKey:U.key,confirmOpen:!0}})}),(0,Q.jsx)(h,{open:me,onOpenChange:e=>T({type:`patch`,patch:{confirmOpen:e}}),children:(0,Q.jsxs)(f,{children:[(0,Q.jsx)(u,{className:I(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),(0,Q.jsxs)(p,{className:I(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`,fe),children:[(0,Q.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:K?mt(t.deleteSessionMessage,{name:F.find(e=>e.key===K)?.name?.trim()||e.chat.newSession}):``}),(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>T({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Q.jsx)(W,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{K&&Te(K),T({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Q.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{wt as SessionsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{g as i}from"./chunk-KS7C4IRE-DbzE-1bp.js";import{i as a,l as o,n as s,o as c}from"./locale-store-B4o4aDCg.js";import{t as l}from"./messages-hlOsXkQ7.js";import{a as u,n as d,o as f,r as p,s as m,t as h}from"./dist-DlirbHVs.js";import{n as g,r as _,t as v}from"./session-identity-label-DCIZvqbN.js";import{t as y}from"./archive-Dz0hferG.js";import{n as b,r as x}from"./popover-select-hRG1EzAY.js";import{t as S}from"./circle-BoO4YvTx.js";import{t as C}from"./coins-DjP27vUx.js";import{t as w}from"./database-CjjeZfRG.js";import{t as T}from"./download-Dk-ZjtO6.js";import{t as E}from"./folder-open-CyzJ19I9.js";import{t as D}from"./layers-mJW7JJKm.js";import{t as O}from"./layout-grid-CEVZdVFU.js";import{t as k}from"./message-square-fVE7Ghj1.js";import{t as A}from"./minimize-2-DtOGrlpo.js";import{n as ee,t as j}from"./pin-off-BMRv-Kxr.js";import{t as M}from"./plus-Q2yW6OE7.js";import{t as N}from"./search-DA7gz22f.js";import{t as P}from"./settings-uiTATseT.js";import{t as F}from"./trash-2-DusmjVPV.js";import{t as te}from"./x-B_N4OPjy.js";import{t as I}from"./cn-0WouolD0.js";import{t as L}from"./skeleton-DzdOeGYz.js";import{a as R,c as z,f as B,n as V,o as ne,p as re,r as ie,s as ae,t as oe}from"./session-api-7-TPnKv0.js";import{t as se}from"./session-channel-icon-COynhpeK.js";import{i as ce}from"./vendor-swr-CdRzEUwF.js";import{n as H,r as le}from"./gateway-config-swr-2VOPSLSq.js";import{t as ue}from"./chat-agents-api-B-47bqbd.js";import{n as de,t as U}from"./registry-api-CmLu4MA9.js";import{t as W}from"./button-C5tRaJxt.js";import{i as fe,o as pe}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as G,t as me}from"./interaction-BdhHBbYa.js";import{s as K}from"./form-field-width-DJw_jULe.js";import{t as he}from"./page-tabs-DoYMKhVO.js";import{t as ge}from"./agent-avatar-display-BDHjRaTK.js";import{n as _e,r as ve}from"./segmented-styles-Cqb91xsn.js";import{n as ye,r as be,t as q}from"./settings-form-draft-Dy10ldo8.js";import{t as xe}from"./sliding-tab-list-CmcrqRzN.js";import{n as Se}from"./model-selector-RNPw-Mz4.js";import{t as J}from"./settings-advanced-section-YRzA9yeq.js";import{t as Y}from"./number-input-El7Szeln.js";import{n as Ce,t as we}from"./settings-page-header-C9xiCwzq.js";import"./settings-page-layout-DTOBegnh.js";import{n as Te,t as X}from"./settings-form-section-num14vSv.js";import{n as Ee,t as De}from"./use-autosave-BkVX6SyB.js";import{t as Oe}from"./settings-advanced-gate-DHfrm0Zj.js";var Z=e(t(),1),ke=n(),Q=r();function Ae(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function je(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`).format(e)}function Me(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function Ne(e){let t=(0,ke.c)(124),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:c,onAction:u}=e,d;t[0]!==i.unnamedSession||t[1]!==n.name?(d=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=d):d=t[2];let f=d,p=s(Le),m;t[3]!==p||t[4]!==n?(m=v(n,l(p).sidebar.sessionFilters),t[3]=p,t[4]=n,t[5]=m):m=t[5];let h=m,g;t[6]===n.name?g=t[7]:(g=n.name?.trim(),t[6]=n.name,t[7]=g);let b=!!g,x=n.status===`archived`,S=n.status===`pinned`,E=n.usage,D;t[8]!==i.costUnknown||t[9]!==i.noUsage||t[10]!==E?(D=E?.calls?E.costCompleteness===`unknown`?i.costUnknown:`${E.costCompleteness===`partial`?`≥ `:`≈ `}${Me(E.knownCostUsd)}`:i.noUsage,t[8]=i.costUnknown,t[9]=i.noUsage,t[10]=E,t[11]=D):D=t[11];let O=D,A=E?.calls?E.costCompleteness===`partial`?i.costPartial:E.costCompleteness===`unknown`?i.costUnknown:i.cost:i.noUsage,M=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,N;t[12]===M?N=t[13]:(N=I(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,M),t[12]=M,t[13]=N);let P;t[14]===c?P=t[15]:(P=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[14]=c,t[15]=P);let te=r===`list`&&`sm:py-3`,L;t[16]===te?L=t[17]:(L=I(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,te),t[16]=te,t[17]=L);let R;t[18]===n?R=t[19]:(R=(0,Q.jsx)(se,{sourceChannel:n.sourceChannel,session:n,className:`size-3.5`}),t[18]=n,t[19]=R);let z;t[20]===h?z=t[21]:(z=(0,Q.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:h}),t[20]=h,t[21]=z);let B;t[22]!==R||t[23]!==z?(B=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[R,z]}),t[22]=R,t[23]=z,t[24]=B):B=t[24];let V;t[25]===S?V=t[26]:(V=S?(0,Q.jsx)(ee,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[25]=S,t[26]=V);let ne;t[27]===n.updatedAt?ne=t[28]:(ne=Ae(n.updatedAt),t[27]=n.updatedAt,t[28]=ne);let re;t[29]===ne?re=t[30]:(re=(0,Q.jsx)(`span`,{children:ne}),t[29]=ne,t[30]=re);let ie;t[31]!==V||t[32]!==re?(ie=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[V,re]}),t[31]=V,t[32]=re,t[33]=ie):ie=t[33];let ae;t[34]!==B||t[35]!==ie||t[36]!==L?(ae=(0,Q.jsxs)(`div`,{className:L,children:[B,ie]}),t[34]=B,t[35]=ie,t[36]=L,t[37]=ae):ae=t[37];let oe=r===`list`&&`sm:py-3`,ce;t[38]===oe?ce=t[39]:(ce=I(`min-w-0 flex-1 px-3 py-2`,oe),t[38]=oe,t[39]=ce);let H=r===`list`&&`sm:items-start`,le;t[40]===H?le=t[41]:(le=I(`flex gap-3`,H),t[40]=H,t[41]=le);let ue;t[42]!==o||t[43]!==a?(ue=(0,Q.jsx)(ge,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[42]=o,t[43]=a,t[44]=ue):ue=t[44];let de;t[45]===f?de=t[46]:(de=(0,Q.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:f,children:f}),t[45]=f,t[46]=de);let U;t[47]!==n.key||t[48]!==b?(U=b?(0,Q.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[47]=n.key,t[48]=b,t[49]=U):U=t[49];let W;t[50]!==de||t[51]!==U?(W=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[de,U]}),t[50]=de,t[51]=U,t[52]=W):W=t[52];let fe;t[53]!==le||t[54]!==ue||t[55]!==W?(fe=(0,Q.jsxs)(`div`,{className:le,children:[ue,W]}),t[53]=le,t[54]=ue,t[55]=W,t[56]=fe):fe=t[56];let pe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Q.jsx)(k,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[57]=pe):pe=t[57];let G;t[58]===n.messageCount?G=t[59]:(G=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[pe,n.messageCount]}),t[58]=n.messageCount,t[59]=G);let K;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(w,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[60]=K):K=t[60];let he=E?.totalTokens??0,_e;t[61]!==p||t[62]!==he?(_e=je(he,p),t[61]=p,t[62]=he,t[63]=_e):_e=t[63];let ve;t[64]!==i.tokens||t[65]!==_e?(ve=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[K,_e,` `,i.tokens]}),t[64]=i.tokens,t[65]=_e,t[66]=ve):ve=t[66];let ye;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Q.jsx)(C,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[67]=ye):ye=t[67];let be;t[68]!==O||t[69]!==A?(be=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:A,children:[ye,O]}),t[68]=O,t[69]=A,t[70]=be):be=t[70];let q;t[71]!==G||t[72]!==ve||t[73]!==be?(q=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[G,ve,be]}),t[71]=G,t[72]=ve,t[73]=be,t[74]=q):q=t[74];let xe;t[75]===n.tags?xe=t[76]:(xe=n.tags.length>0?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Ie),n.tags.length>3?(0,Q.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[75]=n.tags,t[76]=xe);let Se;t[77]!==ce||t[78]!==fe||t[79]!==q||t[80]!==xe?(Se=(0,Q.jsxs)(`div`,{className:ce,children:[fe,q,xe]}),t[77]=ce,t[78]=fe,t[79]=q,t[80]=xe,t[81]=Se):Se=t[81];let J;t[82]===u?J=t[83]:(J=()=>u(`continue`),t[82]=u,t[83]=J);let Y;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(k,{className:`size-4`,strokeWidth:1.75}),t[84]=Y):Y=t[84];let Ce;t[85]!==i.continueChat||t[86]!==J?(Ce=(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.continueChat,"aria-label":i.continueChat,onClick:J,children:Y}),t[85]=i.continueChat,t[86]=J,t[87]=Ce):Ce=t[87];let we;t[88]!==x||t[89]!==i.archive||t[90]!==i.unarchive||t[91]!==u?(we=x?(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>u(`unarchive`),children:(0,Q.jsx)(_,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.archive,"aria-label":i.archive,onClick:()=>u(`archive`),children:(0,Q.jsx)(y,{className:`size-4`,strokeWidth:1.75})}),t[88]=x,t[89]=i.archive,t[90]=i.unarchive,t[91]=u,t[92]=we):we=t[92];let Te;t[93]!==S||t[94]!==i.pin||t[95]!==i.unpin||t[96]!==u?(Te=S?(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.unpin,"aria-label":i.unpin,onClick:()=>u(`unpin`),children:(0,Q.jsx)(j,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.pin,"aria-label":i.pin,onClick:()=>u(`pin`),children:(0,Q.jsx)(ee,{className:`size-4`,strokeWidth:1.75})}),t[93]=S,t[94]=i.pin,t[95]=i.unpin,t[96]=u,t[97]=Te):Te=t[97];let X;t[98]===u?X=t[99]:(X=()=>u(`export`),t[98]=u,t[99]=X);let Ee;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(T,{className:`size-4`,strokeWidth:1.75}),t[100]=Ee):Ee=t[100];let De;t[101]!==i.export||t[102]!==X?(De=(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.export,"aria-label":i.export,onClick:X,children:Ee}),t[101]=i.export,t[102]=X,t[103]=De):De=t[103];let Oe;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=I(me,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[104]=Oe):Oe=t[104];let Z;t[105]===u?Z=t[106]:(Z=()=>u(`delete`),t[105]=u,t[106]=Z);let Ne;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Q.jsx)(F,{className:`size-4`,strokeWidth:1.75}),t[107]=Ne):Ne=t[107];let Re;t[108]!==i.delete||t[109]!==Z?(Re=(0,Q.jsx)(`button`,{type:`button`,className:Oe,title:i.delete,"aria-label":i.delete,onClick:Z,children:Ne}),t[108]=i.delete,t[109]=Z,t[110]=Re):Re=t[110];let ze;t[111]!==Ce||t[112]!==we||t[113]!==Te||t[114]!==De||t[115]!==Re?(ze=(0,Q.jsxs)(`div`,{role:`group`,className:`m-1 mt-0 flex flex-wrap items-center gap-0.5 rounded-lg bg-surface-hover/35 p-1.5`,onClick:Fe,onKeyDown:Pe,children:[Ce,we,Te,De,Re]}),t[111]=Ce,t[112]=we,t[113]=Te,t[114]=De,t[115]=Re,t[116]=ze):ze=t[116];let Be;return t[117]!==c||t[118]!==ae||t[119]!==Se||t[120]!==ze||t[121]!==N||t[122]!==P?(Be=(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,className:N,onClick:c,onKeyDown:P,children:[ae,Se,ze]}),t[117]=c,t[118]=ae,t[119]=Se,t[120]=ze,t[121]=N,t[122]=P,t[123]=Be):Be=t[123],Be}function Pe(e){return e.stopPropagation()}function Fe(e){return e.stopPropagation()}function Ie(e){return(0,Q.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function Le(e){return e.language}function Re(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function ze(e,t){return t.find(t=>t.id===e)?.avatar}var Be={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:16e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function Ve(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function He(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Ue(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function We(e){let t=Ve(e)?e:{},n=Ve(t.userContext)?t.userContext:{},r=Ve(n.contextPlanning)?n.contextPlanning:{},i=Ve(r.compaction)?r.compaction:{},a=Be,o=typeof i.model==`string`&&i.model.trim()?i.model.trim():void 0,s=Array.isArray(i.postCompactionSections)&&i.postCompactionSections.length<=12&&i.postCompactionSections.every(e=>typeof e==`string`&&e.trim())?[...new Set(i.postCompactionSections.map(e=>e.trim()))]:[...a.postCompactionSections];return{enabled:typeof i.enabled==`boolean`?i.enabled:a.enabled,triggerThreshold:He(i.triggerThreshold,a.triggerThreshold,.1,.98),reserveTokens:Ue(i.reserveTokens,a.reserveTokens,1024),minMessagesBeforeCompact:Ue(i.minMessagesBeforeCompact,a.minMessagesBeforeCompact,2),keepRecentTokens:Ue(i.keepRecentTokens,a.keepRecentTokens,1e3),recentTurnsPreserve:Ue(i.recentTurnsPreserve,a.recentTurnsPreserve,1,12),summaryMaxTokens:Ue(i.summaryMaxTokens,a.summaryMaxTokens,256),summaryChunkTokens:Ue(i.summaryChunkTokens,a.summaryChunkTokens,1e3),summaryTimeoutMs:Ue(i.summaryTimeoutMs,a.summaryTimeoutMs,1e3,6e5),summaryRetries:Ue(i.summaryRetries,a.summaryRetries,0,5),qualityGuard:typeof i.qualityGuard==`boolean`?i.qualityGuard:a.qualityGuard,gapAudit:typeof i.gapAudit==`boolean`?i.gapAudit:a.gapAudit,...o?{model:o}:{},minToolResultKeepChars:Ue(i.minToolResultKeepChars,a.minToolResultKeepChars,200),maxActiveTranscriptBytes:Ue(i.maxActiveTranscriptBytes,a.maxActiveTranscriptBytes,64e3),postCompactionSections:s}}function Ge(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function Ke(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function qe(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify(Ke(e))}),await H()}var Je=128e3,Ye={balanced:Be,preserve:{...Be,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Be,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Xe=q();function Ze(){return I(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg disabled:cursor-not-allowed disabled:opacity-55`,K,`dark:border-edge`)}function Qe(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function $e(e){let t=Qe(e);for(let[e,n]of Object.entries(Ye))if(t===Qe(n))return e;return`custom`}function et(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,ke.c)(20),{id:n,label:r,hint:i,value:a,min:o,max:s,step:c,disabled:l,onChange:u}=e,d=c===void 0?1:c,f;t[0]!==n||t[1]!==r?(f=(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=Ze(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Q.jsx)(Y,{id:n,type:`number`,min:o,max:s,step:d,disabled:l,className:p,value:a,onChange:m}),t[6]=l,t[7]=n,t[8]=s,t[9]=o,t[10]=d,t[11]=m,t[12]=a,t[13]=h):h=t[13];let g;t[14]===i?g=t[15]:(g=i?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}):null,t[14]=i,t[15]=g);let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Q.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function tt(e){let t=(0,ke.c)(19),{label:n,hint:r,checked:i,disabled:a,onChange:o}=e,s=a?`cursor-not-allowed opacity-55`:`cursor-pointer`,c;t[0]===s?c=t[1]:(c=I(`flex items-start gap-2 text-sm text-fg`,s),t[0]=s,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>o(e.target.checked),t[2]=o,t[3]=l);let u;t[4]!==i||t[5]!==a||t[6]!==l?(u=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:a,onChange:l}),t[4]=i,t[5]=a,t[6]=l,t[7]=u):u=t[7];let d;t[8]===n?d=t[9]:(d=(0,Q.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=d);let f;t[10]===r?f=t[11]:(f=(0,Q.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=f);let p;t[12]!==d||t[13]!==f?(p=(0,Q.jsxs)(`span`,{children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;return t[15]!==c||t[16]!==u||t[17]!==p?(m=(0,Q.jsxs)(`label`,{className:c,children:[u,p]}),t[15]=c,t[16]=u,t[17]=p,t[18]=m):m=t[18],m}function nt({hasToken:e}){let t=l(s(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=le(e),{data:i=[],isLoading:a}=ce(e?U:null,de,{revalidateOnFocus:!1}),o=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:We(n.payload.config),[n]),[c,u]=(0,Z.useReducer)(Xe,{form:null,baseline:null}),[d,f]=(0,Z.useState)(``),p=(0,Z.useRef)(!1),m=(0,Z.useRef)(c.form);m.current=c.form;let h=(0,Z.useRef)(null);ye({enabled:e,parsed:o,dirty:p.current,trackedParsedRef:h,dispatch:u,onResetDirty:()=>{p.current=!1}});let g=c.form,_=c.baseline,v=!!(g&&_&&JSON.stringify(g)!==JSON.stringify(_)),y=(0,Z.useCallback)(e=>{p.current=!0,u({type:`patch`,patch:e})},[]),b=(0,Z.useCallback)(e=>({enabled:t.enabled,triggerThreshold:t.triggerThreshold,reserveTokens:t.reserveTokens,minMessagesBeforeCompact:t.minMessagesBeforeCompact,keepRecentTokens:t.keepRecentTokens,recentTurnsPreserve:t.recentTurnsPreserve,summaryMaxTokens:t.summaryMaxTokens,summaryChunkTokens:t.summaryChunkTokens,summaryTimeoutMs:t.summaryTimeoutSeconds,summaryRetries:t.summaryRetries,qualityGuard:t.qualityGuard,gapAudit:t.gapAudit,model:t.summaryModel,minToolResultKeepChars:t.minToolResultKeepChars,maxActiveTranscriptBytes:t.maxActiveTranscriptMb,postCompactionSections:t.postCompactionSections})[e],[t]),x=De({value:g,dirty:v,onSave:(0,Z.useCallback)(async e=>{try{await qe(e),u({type:`saved`,value:e}),p.current=!!(m.current&&JSON.stringify(m.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=Ge(e);return n?t.invalidValue.replace(`{{field}}`,b(n)):null}});if(!e||!g)return r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(L,{className:`h-5 w-48`}),(0,Q.jsx)(L,{className:`h-20 w-full rounded-xl`}),(0,Q.jsx)(L,{className:`h-36 w-full rounded-xl`})]})}):null;let S=$e(g),C=Math.max(0,Je-g.reserveTokens),w=Math.min(Math.floor(Je*g.triggerThreshold),C),T=Math.min(100,w/Je*100),E=Math.min(100,C/Je*100),D=g.model?i.find(e=>e.id===g.model):void 0,O=D?.contextWindow&&g.summaryChunkTokens+g.summaryMaxTokens+4096>D.contextWindow,k=g.keepRecentTokens+g.reserveTokens>w,ee=Math.round(g.summaryTimeoutMs*(g.summaryRetries+1)/1e3),j=e=>{let t=Ye[e];y({...t,...g.model?{model:g.model}:{model:void 0},postCompactionSections:g.postCompactionSections})},N={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},P=()=>{let e=d.trim();!e||g.postCompactionSections.includes(e)||g.postCompactionSections.length>=12||(y({postCompactionSections:[...g.postCompactionSections,e]}),f(``))};return(0,Q.jsxs)(X,{onBlurCapture:x.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:A,title:t.title,subtitle:t.hint,trailing:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(Ee,{status:x.status,error:x.error}),(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:g.enabled,onChange:e=>y({enabled:e.target.checked})}),g.enabled?t.enabled:t.disabled]})]})}),x.error?(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:x.error}):null,g.enabled?null:(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Q.jsxs)(`fieldset`,{disabled:!g.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),S===`custom`?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":S===e,className:I(`rounded-xl bg-surface-base/55 px-3 py-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,G.transition,G.focusRingPanel,S===e?`bg-accent-soft text-accent-fg shadow-surface`:`text-fg hover:bg-surface-hover`),onClick:()=>j(e),children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium`,children:N[e].title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:N[e].hint})]},e))})]}),(0,Q.jsxs)(J,{title:t.advancedTitle,summary:S===`custom`?t.presetCustom:t.presetHint,children:[(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Q.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.compactionTrigger}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(w)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${T}%`}})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.hardInputLimit}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(C)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${E}%`}})})]})]}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((g.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>y({triggerThreshold:e/100})}),(0,Q.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,et(g.reserveTokens)),value:g.reserveTokens,min:1024,step:1024,onChange:e=>y({reserveTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:g.recentTurnsPreserve,min:1,max:12,onChange:e=>y({recentTurnsPreserve:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,et(g.keepRecentTokens)),value:g.keepRecentTokens,min:1e3,step:1e3,onChange:e=>y({keepRecentTokens:Math.floor(e)})})]}),k?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Q.jsx)(Se,{value:g.model??``,disabled:!g.enabled,placeholder:t.summaryModelInherited,searchPlaceholder:t.summaryModelSearch,noMatches:t.summaryModelNoMatches,models:i,modelsLoading:a,className:`min-w-0 flex-1 justify-between`,contentAlign:`start`,showProviderSettingsFooter:!0,onChange:e=>y({model:e})}),g.model?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>y({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Q.jsx)(tt,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:g.qualityGuard,onChange:e=>y({qualityGuard:e})}),(0,Q.jsx)(tt,{label:t.gapAudit,hint:t.gapAuditHint,checked:g.gapAudit,onChange:e=>y({gapAudit:e})})]}),g.qualityGuard?null:(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning})]}),(0,Q.jsx)(Oe,{children:(0,Q.jsxs)(`div`,{className:`space-y-5 rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:g.minMessagesBeforeCompact,min:2,onChange:e=>y({minMessagesBeforeCompact:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((g.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>y({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Q.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:g.summaryMaxTokens,min:256,step:256,onChange:e=>y({summaryMaxTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:g.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>y({summaryChunkTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(ee)),value:g.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>y({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Q.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:g.summaryRetries,min:0,max:5,onChange:e=>y({summaryRetries:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:g.minToolResultKeepChars,min:200,step:100,onChange:e=>y({minToolResultKeepChars:Math.floor(e)})})]}),O?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),g.postCompactionSections.length>0?(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:g.postCompactionSections.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs text-fg`,children:[e,(0,Q.jsx)(`button`,{type:`button`,className:I(`text-fg-muted hover:text-fg`,G.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>y({postCompactionSections:g.postCompactionSections.filter(t=>t!==e)}),children:(0,Q.jsx)(te,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Q.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Q.jsx)(`input`,{className:Ze(),value:d,maxLength:120,disabled:g.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),P())}}),(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,disabled:!d.trim()||g.postCompactionSections.length>=12,onClick:P,children:[(0,Q.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function rt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function it(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function at(e){let t=rt(e)?e:{},n=rt(t.session)?t.session:{},r=rt(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:it(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function ot(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),H()}function st(){return I(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,K,`dark:border-edge`)}var ct=q();function lt({hasToken:e}){let t=l(s(e=>e.language)).sessions.config,{data:n,isLoading:r}=le(e),i=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:at(n.payload.config),[n]),[a,o]=(0,Z.useReducer)(ct,{form:null,baseline:null}),c=a.form,u=a.baseline,d=(0,Z.useRef)(!1),f=(0,Z.useRef)(c);f.current=c;let p=(0,Z.useRef)(null);ye({enabled:e,parsed:i,dirty:d.current,trackedParsedRef:p,dispatch:o,onResetDirty:()=>{d.current=!1}});let m=!!(c&&u&&JSON.stringify(c)!==JSON.stringify(u)),h=(0,Z.useCallback)(e=>{d.current=!0,o({type:`patch`,patch:e})},[]),g=De({value:c,dirty:m,onSave:(0,Z.useCallback)(async e=>{try{await ot(e),o({type:`saved`,value:e}),d.current=!!(f.current&&JSON.stringify(f.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!c?r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(L,{className:`h-5 w-40`}),(0,Q.jsx)(L,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Q.jsxs)(X,{onBlurCapture:g.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:w,title:t.title,subtitle:t.hint,trailing:(0,Q.jsx)(Ee,{status:g.status,error:g.error})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)(J,{title:t.dmScope,summary:c.dmScope,children:(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Q.jsxs)(b,{className:st(),value:c.dmScope,onChange:e=>h({dmScope:e.target.value}),children:[(0,Q.jsx)(x,{value:`main`,children:t.dmScopeMain}),(0,Q.jsx)(x,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Q.jsx)(x,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Q.jsx)(x,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Q.jsx)(Y,{allowEmpty:!0,type:`number`,min:0,className:st(),value:c.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Q.jsx)(J,{title:t.maxEntries,summary:c.maxEntries??t.unsetPlaceholder,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Q.jsx)(Y,{allowEmpty:!0,type:`number`,min:1,className:st(),value:c.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})})]})]})}function ut(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function dt(e){let t=(0,ke.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:c,onArchive:l,onUnarchive:g,onPin:_,onUnpin:v,onExport:y,onDelete:b}=e,x=i?.status===`archived`,S=i?.status===`pinned`,C;t[0]===c?C=t[1]:(C=e=>!e&&c(),t[0]=c,t[1]=C);let w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(u,{className:I(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),t[2]=w):w=t[2];let T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(T=I(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,fe,`dark:border-edge`),t[3]=T):T=t[3];let E;t[4]!==i||t[5]!==o||t[6]!==a?(E=i&&a?(0,Q.jsx)(ge,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=o,t[6]=a,t[7]=E):E=t[7];let D;t[8]!==s.unnamedSession||t[9]!==i?.name?(D=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=D):D=t[10];let O;t[11]===D?O=t[12]:(O=(0,Q.jsx)(m,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:D}),t[11]=D,t[12]=O);let k;t[13]!==E||t[14]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[E,O]}),t[13]=E,t[14]=O,t[15]=k):k=t[15];let A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(te,{className:`size-5`,strokeWidth:1.75}),t[16]=A):A=t[16];let ee;t[17]===s.close?ee=t[18]:(ee=(0,Q.jsx)(d,{asChild:!0,children:(0,Q.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:A})}),t[17]=s.close,t[18]=ee);let j;t[19]!==k||t[20]!==ee?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[k,ee]}),t[19]=k,t[20]=ee,t[21]=j):j=t[21];let M;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(M=r?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.detailLoading}):i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Q.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Q.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:s.detailMessages}),(0,Q.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(ft)})]}):null,t[22]=s.detailLoading,t[23]=s.detailMessages,t[24]=r,t[25]=i,t[26]=M):M=t[26];let N;t[27]===M?N=t[28]:(N=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:M}),t[27]=M,t[28]=N);let P;t[29]!==s.detailExport||t[30]!==y?(P=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:y,children:s.detailExport}),t[29]=s.detailExport,t[30]=y,t[31]=P):P=t[31];let F;t[32]!==x||t[33]!==s.archive||t[34]!==s.unarchive||t[35]!==l||t[36]!==g?(F=x?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:g,children:s.unarchive}):(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:l,children:s.archive}),t[32]=x,t[33]=s.archive,t[34]=s.unarchive,t[35]=l,t[36]=g,t[37]=F):F=t[37];let L;t[38]!==S||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==_||t[42]!==v?(L=S?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:v,children:s.unpin}):(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:_,children:s.pin}),t[38]=S,t[39]=s.pin,t[40]=s.unpin,t[41]=_,t[42]=v,t[43]=L):L=t[43];let R;t[44]!==s.delete||t[45]!==b?(R=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:b,children:s.delete}),t[44]=s.delete,t[45]=b,t[46]=R):R=t[46];let z;t[47]!==P||t[48]!==F||t[49]!==L||t[50]!==R?(z=(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[P,F,L,R]})}),t[47]=P,t[48]=F,t[49]=L,t[50]=R,t[51]=z):z=t[51];let B;t[52]!==j||t[53]!==N||t[54]!==z?(B=(0,Q.jsxs)(f,{children:[w,(0,Q.jsxs)(p,{className:T,"aria-describedby":void 0,children:[j,N,z]})]}),t[52]=j,t[53]=N,t[54]=z,t[55]=B):B=t[55];let V;return t[56]!==n||t[57]!==C||t[58]!==B?(V=(0,Q.jsx)(h,{open:n,onOpenChange:C,children:B}),t[56]=n,t[57]=C,t[58]=B,t[59]=V):V=t[59],V}function ft(e){return(0,Q.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Q.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:ut(e.content)})]},`${e.timestamp??``}-${e.role}-${ut(e.content).slice(0,24)}`)}var pt=20;function mt(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ht=new Set([`all`,`active`,`pinned`,`archived`]),gt=new Set([`grid`,`list`]),_t=[`sessions`,`settings`];function vt(e){return e&&_t.includes(e)?e:`sessions`}function yt(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function bt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function xt(e){let t=(0,ke.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=_t.map(e=>({id:e,label:yt(n,e),icon:e===`sessions`?D:P})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Q.jsx)(he,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function St(e){let t=(0,ke.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a!==void 0&&a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-5`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:yt(n,r)}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:bt(n,r)})]}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Q.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function Ct(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ht.has(t)?t:`all`,viewMode:gt.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function wt(){let e=l(s(e=>e.language)),t=e.sessions,n=o(e=>e.conversationId),r=!!n,{data:a,mutate:c}=ce(r?[`gateway-chat-agents`,n]:null,ue,{revalidateOnFocus:!1}),d=a?.defaultId??`main`,_=a?.items??[],[v,b]=i(),x=vt(v.get(`tab`)),C=(0,Z.useCallback)(e=>{let t=new URLSearchParams(v);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),b(t,{replace:!0})},[v,b]),[w,T]=(0,Z.useReducer)(be,v,Ct),{searchInput:k,debouncedSearch:A,statusFilter:j,viewMode:M,channelFilter:P,sessions:F,loading:te,error:L,hasMore:se,stats:H,detailOpen:le,detailLoading:de,detailSession:U,confirmOpen:me,confirmKey:K}=w;(0,Z.useEffect)(()=>{let e=setTimeout(()=>{let e=k.trim();A!==e&&T({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[k,A]);let he=v.toString(),ge=(0,Z.useRef)(he);if(ge.current!==he){ge.current=he;let e=v.get(`q`)??``,t=v.get(`status`),n=v.get(`view`),r=(v.get(`channel`)??``).trim(),i=ht.has(t)?t:`all`,a=gt.has(n)?n:`grid`,o=e.trim();T({type:`patch`,patch:{...k===e?{}:{searchInput:e},...A===o?{}:{debouncedSearch:o},...j===i?{}:{statusFilter:i},...M===a?{}:{viewMode:a},...P===r?{}:{channelFilter:r}}})}(0,Z.useEffect)(()=>{let e=new URLSearchParams(v),t=A.trim();t?e.set(`q`,t):e.delete(`q`),j===`all`?e.delete(`status`):e.set(`status`,j),M===`grid`?e.delete(`view`):e.set(`view`,M),P?e.set(`channel`,P):e.delete(`channel`),e.toString()!==v.toString()&&b(e,{replace:!0})},[A,v,b,j,M,P]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=!1;return(async()=>{T({type:`patch`,patch:{loading:!0,error:null}});try{let t=await ae({limit:pt,offset:0,...A?{search:A}:{},...j===`all`?{}:{status:j},...P?{channel:P}:{}});if(e)return;T({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||T({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||T({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,x,A,j,P,t.loadError]),(0,Z.useEffect)(()=>{!r||x!==`sessions`||ne().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,x]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=()=>void c();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,x,c]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||T({type:`patch`,patch:{sessions:F.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:U&&U.key===t.key?{...U,name:t.name}:U}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,x,F,U]);let ye=(0,Z.useCallback)(async()=>{if(!(!r||te||!se)){T({type:`patch`,patch:{loading:!0,error:null}});try{let e=await ae({limit:pt,offset:F.length,...A?{search:A}:{},...j===`all`?{}:{status:j},...P?{channel:P}:{}});T({type:`patch`,patch:{sessions:[...F,...e.items],hasMore:e.hasMore}})}catch(e){T({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{T({type:`patch`,patch:{loading:!1}})}}},[r,te,se,F.length,A,j,P,t.loadError]),q=(0,Z.useCallback)((e,t)=>{T({type:`patch`,patch:{sessions:F.map(n=>n.key===e?{...n,status:t}:n),detailSession:U&&U.key===e?{...U,status:t}:U}})},[F,U]),Se=(0,Z.useCallback)(async e=>{T({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{let t=await R(e);T({type:`patch`,patch:{detailSession:t}})}catch{T({type:`patch`,patch:{detailOpen:!1}})}finally{T({type:`patch`,patch:{detailLoading:!1}})}},[]),J=e=>{Se(e)},Y=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e},bubbles:!0}));return}if(t===`delete`){T({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await oe(e),q(e,`archived`);break;case`unarchive`:await B(e),q(e,`active`);break;case`pin`:await z(e),q(e,`pinned`);break;case`unpin`:await re(e),q(e,`active`);break;case`export`:{let t=await ie(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}ne().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Te=async e=>{try{await V(e),T({type:`patch`,patch:{sessions:F.filter(t=>t.key!==e),detailSession:U?.key===e?null:U,...U?.key===e?{detailOpen:!1}:{}}}),ne().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},X={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,tokens:t.tokens,cost:t.cost,costPartial:t.costPartial,costUnknown:t.costUnknown,noUsage:t.noUsage,unnamedSession:e.chat.newSession},Ee={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},De=[{key:`all`,label:t.filterAll,icon:D},{key:`active`,label:t.filterActive,icon:S},{key:`pinned`,label:t.filterPinned,icon:ee},{key:`archived`,label:t.filterArchived,icon:y}],Oe=(()=>{let e=Object.entries(H?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Q.jsxs)(Ce,{gap:`gap-6`,children:[(0,Q.jsx)(we,{title:t.title}),(0,Q.jsx)(xt,{s:t,activeTab:x,onChange:C}),(0,Q.jsx)(St,{s:t,id:`settings`,activeTab:x,plain:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(nt,{hasToken:r}),(0,Q.jsx)(lt,{hasToken:r})]})}),(0,Q.jsxs)(St,{s:t,id:`sessions`,activeTab:x,plain:!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Q.jsx)(xe,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.tabsSessions,indicatorClassName:`rounded-xl bg-accent-soft`,children:De.map(({key:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":j===e,onClick:()=>T({type:`patch`,patch:{statusFilter:e}}),className:I(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,j===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Q.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base focus-within:ring-2 focus-within:ring-accent px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Q.jsx)(N,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:k,onChange:e=>T({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,"data-debounced-query":A||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-base sm:text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Q.jsxs)(xe,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":t.filterChannelLabel,indicatorClassName:`rounded-xl bg-accent-soft`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":!P,onClick:()=>T({type:`patch`,patch:{channelFilter:``}}),className:I(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,P?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),Oe.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":P===e,onClick:()=>T({type:`patch`,patch:{channelFilter:e}}),className:I(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,P===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,H?.byChannel?.[e]==null?null:(0,Q.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:H.byChannel[e]})]},e))]}),H?(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[H.totalSessions,t.totalSessions],[H.activeSessions,t.activeSessions],[H.pinnedSessions,t.pinnedSessions],[H.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Q.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,L?(0,Q.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,children:L}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:mt(t.sessionCount,{count:F.length})}),(0,Q.jsxs)(xe,{className:ve,role:`group`,"aria-label":t.layoutToggleGroup,indicatorClassName:`rounded-pill bg-surface-panel shadow-sm dark:ring-1 dark:ring-edge-strong/40`,children:[(0,Q.jsx)(W,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":M===`grid`,onClick:()=>T({type:`patch`,patch:{viewMode:`grid`}}),className:I(_e,`size-7 p-0`,M===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`grid`&&`text-accent-fg`),children:(0,Q.jsx)(O,{className:`size-3.5`,strokeWidth:1.5})}),(0,Q.jsx)(W,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":M===`list`,onClick:()=>T({type:`patch`,patch:{viewMode:`list`}}),className:I(_e,`size-9 p-0`,M===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`list`&&`text-accent-fg`),children:(0,Q.jsx)(g,{className:`size-3.5`,strokeWidth:1.5})})]})]}),te&&F.length===0?(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Q.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):F.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Q.jsx)(E,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Q.jsx)(W,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:I(`grid min-w-0 gap-3`,M===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":A||void 0,children:F.map(e=>{let t=Re(e,d);return(0,Q.jsx)(Ne,{session:e,variant:M,labels:X,sessionAgentId:t,sessionAgentAvatar:ze(t,_),onOpen:()=>J(e.key),onAction:t=>void Y(e.key,t)},e.key)})}),se?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:te,onClick:()=>void ye(),children:t.loadMore})}):null]})]})]}),(0,Q.jsx)(dt,{open:le,loading:de,session:U,sessionAgentId:U?Re(U,d):void 0,sessionAgentAvatar:U?ze(Re(U,d),_):void 0,labels:Ee,onClose:()=>{T({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>U&&void Y(U.key,`archive`),onUnarchive:()=>U&&void Y(U.key,`unarchive`),onPin:()=>U&&void Y(U.key,`pin`),onUnpin:()=>U&&void Y(U.key,`unpin`),onExport:()=>U&&void Y(U.key,`export`),onDelete:()=>U&&T({type:`patch`,patch:{confirmKey:U.key,confirmOpen:!0}})}),(0,Q.jsx)(h,{open:me,onOpenChange:e=>T({type:`patch`,patch:{confirmOpen:e}}),children:(0,Q.jsxs)(f,{children:[(0,Q.jsx)(u,{className:I(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),(0,Q.jsxs)(p,{className:I(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`,fe),children:[(0,Q.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:K?mt(t.deleteSessionMessage,{name:F.find(e=>e.key===K)?.name?.trim()||e.chat.newSession}):``}),(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>T({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Q.jsx)(W,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{K&&Te(K),T({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Q.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{wt as SessionsPage};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{n}from"./locale-store-B4o4aDCg.js";import{t as r}from"./button-ChmVQg9O.js";import{t as i}from"./settings-mode-store-BtwrUOdQ.js";var a=e(),o=t();function s(e){let t=(0,a.c)(15),{title:s,summary:d,children:f}=e,p=i(u),m=i(l),h=n(c)===`zh`;if(p)return f;let g;t[0]===s?g=t[1]:(g=(0,o.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:s}),t[0]=s,t[1]=g);let _;t[2]===d?_=t[3]:(_=(0,o.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d}),t[2]=d,t[3]=_);let v;t[4]!==g||t[5]!==_?(v=(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[g,_]}),t[4]=g,t[5]=_,t[6]=v):v=t[6];let y;t[7]===m?y=t[8]:(y=()=>m(`advanced`),t[7]=m,t[8]=y);let b=h?`查看高级设置`:`Show advanced settings`,x;t[9]!==y||t[10]!==b?(x=(0,o.jsx)(r,{type:`button`,variant:`ghost`,onClick:y,children:b}),t[9]=y,t[10]=b,t[11]=x):x=t[11];let S;return t[12]!==v||t[13]!==x?(S=(0,o.jsxs)(`section`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-surface-hover/20 p-4`,children:[v,x]}),t[12]=v,t[13]=x,t[14]=S):S=t[14],S}function c(e){return e.language}function l(e){return e.setMode}function u(e){return e.mode===`advanced`}export{s as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{n}from"./locale-store-B4o4aDCg.js";import{t as r}from"./button-C5tRaJxt.js";import{t as i}from"./settings-mode-store-BtwrUOdQ.js";var a=e(),o=t();function s(e){let t=(0,a.c)(15),{title:s,summary:d,children:f}=e,p=i(u),m=i(l),h=n(c)===`zh`;if(p)return f;let g;t[0]===s?g=t[1]:(g=(0,o.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:s}),t[0]=s,t[1]=g);let _;t[2]===d?_=t[3]:(_=(0,o.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d}),t[2]=d,t[3]=_);let v;t[4]!==g||t[5]!==_?(v=(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[g,_]}),t[4]=g,t[5]=_,t[6]=v):v=t[6];let y;t[7]===m?y=t[8]:(y=()=>m(`advanced`),t[7]=m,t[8]=y);let b=h?`查看高级设置`:`Show advanced settings`,x;t[9]!==y||t[10]!==b?(x=(0,o.jsx)(r,{type:`button`,variant:`ghost`,onClick:y,children:b}),t[9]=y,t[10]=b,t[11]=x):x=t[11];let S;return t[12]!==v||t[13]!==x?(S=(0,o.jsxs)(`section`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-surface-hover/20 p-4`,children:[v,x]}),t[12]=v,t[13]=x,t[14]=S):S=t[14],S}function c(e){return e.language}function l(e){return e.setMode}function u(e){return e.mode===`advanced`}export{s as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./chunk-KS7C4IRE-BPb7KheU.js";import{n as r}from"./locale-store-B4o4aDCg.js";import{t as i}from"./external-link-DjqjBmc3.js";import{t as a}from"./sparkles-DHlfQFAF.js";import{t as o}from"./cn-0WouolD0.js";import{t as s}from"./button-ChmVQg9O.js";var c=e(),l=t();function u(e){let t=(0,c.c)(14),n,r,i,a,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5]):({children:n,className:r,gap:a,padding:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s);let u=a===void 0?`gap-5`:a,d=s===void 0?`px-4 py-6 sm:px-5 xl:px-6`:s,f;t[6]!==r||t[7]!==u||t[8]!==d?(f=o(`settings-page-frame mx-auto flex min-h-full w-full max-w-[56rem] flex-col`,u,d,r),t[6]=r,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;return t[10]!==n||t[11]!==i||t[12]!==f?(p=(0,l.jsx)(`div`,{className:f,...i,children:n}),t[10]=n,t[11]=i,t[12]=f,t[13]=p):p=t[13],p}var d={phone:{scene:`configure-phone`,zh:`帮我配置 Phone Use,从模型、依赖、手机连接到验收。`,en:`Help configure Phone Use: model, dependencies, phone connection and verification.`},browser:{scene:`configure-xopc`,zh:`帮我配置 Browser Use,连接本机 Chrome 并完成验收。`,en:`Help me configure Browser Use with local Chrome and verify it.`}};function f(e){let t=(0,c.c)(8),{target:i}=e,o=r(p)===`zh`,u=d[i],f=o?u.zh:u.en,m;t[0]!==u.scene||t[1]!==f?(m=new URLSearchParams({skill:`configure-xopc`,scene:u.scene,draft:f,autoSend:`1`}),t[0]=u.scene,t[1]=f,t[2]=m):m=t[2];let h=`/chat/new?${m}`,g=o?`让 AI 帮我配置`:`Set up with AI`,_;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,l.jsx)(a,{className:`size-4 shrink-0`,"aria-hidden":!0}),t[3]=_):_=t[3];let v=o?`AI 配置`:`AI setup`,y;return t[4]!==h||t[5]!==g||t[6]!==v?(y=(0,l.jsx)(s,{asChild:!0,className:`order-first whitespace-nowrap sm:order-last text-accent-fg shadow-none sm:shadow-none`,children:(0,l.jsxs)(n,{to:h,title:g,children:[_,v]})}),t[4]=h,t[5]=g,t[6]=v,t[7]=y):y=t[7],y}function p(e){return e.language}function m(e){let t=(0,c.c)(22),{title:n,subtitle:r,docsLink:a,docsLabel:s,meta:u,actions:d,aiSetup:p,className:m}=e,h=p?`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-3`:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,g;t[0]!==m||t[1]!==h?(g=o(h,m),t[0]=m,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=(0,l.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight sm:text-lg text-fg`,children:n}),t[3]=n,t[4]=_);let v;t[5]===r?v=t[6]:(v=r?(0,l.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-fg-muted sm:mt-1`,children:r}):null,t[5]=r,t[6]=v);let y;t[7]!==s||t[8]!==a?(y=a&&s?(0,l.jsxs)(`a`,{href:a,target:`_blank`,rel:`noreferrer`,className:`touch-target mt-1 inline-flex items-center gap-1 text-sm text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[s,(0,l.jsx)(i,{className:`size-3.5`,"aria-hidden":!0})]}):null,t[7]=s,t[8]=a,t[9]=y):y=t[9];let b;t[10]!==u||t[11]!==_||t[12]!==v||t[13]!==y?(b=(0,l.jsxs)(`div`,{className:`min-w-0`,children:[_,v,y,u]}),t[10]=u,t[11]=_,t[12]=v,t[13]=y,t[14]=b):b=t[14];let x;t[15]!==d||t[16]!==p?(x=d||p?(0,l.jsxs)(`div`,{className:o(`flex shrink-0 items-center gap-2`,p?`min-w-0 max-w-[50vw] flex-col items-end sm:flex-row sm:justify-end`:`flex-wrap justify-start sm:justify-end`),children:[d,p&&(0,l.jsx)(f,{target:p})]}):null,t[15]=d,t[16]=p,t[17]=x):x=t[17];let S;return t[18]!==g||t[19]!==b||t[20]!==x?(S=(0,l.jsxs)(`header`,{className:g,children:[b,x]}),t[18]=g,t[19]=b,t[20]=x,t[21]=S):S=t[21],S}export{u as n,m as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./chunk-KS7C4IRE-DbzE-1bp.js";import{n as r}from"./locale-store-B4o4aDCg.js";import{t as i}from"./external-link-DjqjBmc3.js";import{t as a}from"./sparkles-DHlfQFAF.js";import{t as o}from"./cn-0WouolD0.js";import{t as s}from"./button-C5tRaJxt.js";var c=e(),l=t();function u(e){let t=(0,c.c)(14),n,r,i,a,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5]):({children:n,className:r,gap:a,padding:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s);let u=a===void 0?`gap-5`:a,d=s===void 0?`px-4 py-6 sm:px-5 xl:px-6`:s,f;t[6]!==r||t[7]!==u||t[8]!==d?(f=o(`settings-page-frame mx-auto flex min-h-full w-full max-w-[56rem] flex-col`,u,d,r),t[6]=r,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;return t[10]!==n||t[11]!==i||t[12]!==f?(p=(0,l.jsx)(`div`,{className:f,...i,children:n}),t[10]=n,t[11]=i,t[12]=f,t[13]=p):p=t[13],p}var d={phone:{scene:`configure-phone`,zh:`帮我配置 Phone Use,从模型、依赖、手机连接到验收。`,en:`Help configure Phone Use: model, dependencies, phone connection and verification.`},browser:{scene:`configure-xopc`,zh:`帮我配置 Browser Use,连接本机 Chrome 并完成验收。`,en:`Help me configure Browser Use with local Chrome and verify it.`}};function f(e){let t=(0,c.c)(8),{target:i}=e,o=r(p)===`zh`,u=d[i],f=o?u.zh:u.en,m;t[0]!==u.scene||t[1]!==f?(m=new URLSearchParams({skill:`configure-xopc`,scene:u.scene,draft:f,autoSend:`1`}),t[0]=u.scene,t[1]=f,t[2]=m):m=t[2];let h=`/chat/new?${m}`,g=o?`让 AI 帮我配置`:`Set up with AI`,_;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,l.jsx)(a,{className:`size-4 shrink-0`,"aria-hidden":!0}),t[3]=_):_=t[3];let v=o?`AI 配置`:`AI setup`,y;return t[4]!==h||t[5]!==g||t[6]!==v?(y=(0,l.jsx)(s,{asChild:!0,className:`order-first whitespace-nowrap sm:order-last text-accent-fg shadow-none sm:shadow-none`,children:(0,l.jsxs)(n,{to:h,title:g,children:[_,v]})}),t[4]=h,t[5]=g,t[6]=v,t[7]=y):y=t[7],y}function p(e){return e.language}function m(e){let t=(0,c.c)(22),{title:n,subtitle:r,docsLink:a,docsLabel:s,meta:u,actions:d,aiSetup:p,className:m}=e,h=p?`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-3`:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,g;t[0]!==m||t[1]!==h?(g=o(h,m),t[0]=m,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=(0,l.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight sm:text-lg text-fg`,children:n}),t[3]=n,t[4]=_);let v;t[5]===r?v=t[6]:(v=r?(0,l.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-fg-muted sm:mt-1`,children:r}):null,t[5]=r,t[6]=v);let y;t[7]!==s||t[8]!==a?(y=a&&s?(0,l.jsxs)(`a`,{href:a,target:`_blank`,rel:`noreferrer`,className:`touch-target mt-1 inline-flex items-center gap-1 text-sm text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[s,(0,l.jsx)(i,{className:`size-3.5`,"aria-hidden":!0})]}):null,t[7]=s,t[8]=a,t[9]=y):y=t[9];let b;t[10]!==u||t[11]!==_||t[12]!==v||t[13]!==y?(b=(0,l.jsxs)(`div`,{className:`min-w-0`,children:[_,v,y,u]}),t[10]=u,t[11]=_,t[12]=v,t[13]=y,t[14]=b):b=t[14];let x;t[15]!==d||t[16]!==p?(x=d||p?(0,l.jsxs)(`div`,{className:o(`flex shrink-0 items-center gap-2`,p?`min-w-0 max-w-[50vw] flex-col items-end sm:flex-row sm:justify-end`:`flex-wrap justify-start sm:justify-end`),children:[d,p&&(0,l.jsx)(f,{target:p})]}):null,t[15]=d,t[16]=p,t[17]=x):x=t[17];let S;return t[18]!==g||t[19]!==b||t[20]!==x?(S=(0,l.jsxs)(`header`,{className:g,children:[b,x]}),t[18]=g,t[19]=b,t[20]=x,t[21]=S):S=t[21],S}export{u as n,m as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import"./settings-page-header-DKgbD0Bc.js";var r=e(),i=t();function a(e){let t=(0,r.c)(13),{id:a,activeTab:o,tabIdPrefix:s,panelIdPrefix:c,title:l,hint:u,showHeading:d,framed:f,children:p,className:m}=e,h=d===void 0||d,g=f===void 0||f;if(o!==a)return null;let _=`${c}-${a}`,v=`${s}-${a}`,y=g&&`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,b;t[0]!==m||t[1]!==y?(b=n(`min-w-0`,y,m),t[0]=m,t[1]=y,t[2]=b):b=t[2];let x;t[3]!==u||t[4]!==h||t[5]!==l?(x=h&&(l||u)?(0,i.jsxs)(`div`,{className:`mb-5`,children:[l?(0,i.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:l}):null,u?(0,i.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:u}):null]}):null,t[3]=u,t[4]=h,t[5]=l,t[6]=x):x=t[6];let S;return t[7]!==p||t[8]!==_||t[9]!==v||t[10]!==b||t[11]!==x?(S=(0,i.jsxs)(`section`,{id:_,role:`tabpanel`,"aria-labelledby":v,className:b,children:[x,p]}),t[7]=p,t[8]=_,t[9]=v,t[10]=b,t[11]=x,t[12]=S):S=t[12],S}export{a as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import"./settings-page-header-C9xiCwzq.js";var r=e(),i=t();function a(e){let t=(0,r.c)(13),{id:a,activeTab:o,tabIdPrefix:s,panelIdPrefix:c,title:l,hint:u,showHeading:d,framed:f,children:p,className:m}=e,h=d===void 0||d,g=f===void 0||f;if(o!==a)return null;let _=`${c}-${a}`,v=`${s}-${a}`,y=g&&`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,b;t[0]!==m||t[1]!==y?(b=n(`min-w-0`,y,m),t[0]=m,t[1]=y,t[2]=b):b=t[2];let x;t[3]!==u||t[4]!==h||t[5]!==l?(x=h&&(l||u)?(0,i.jsxs)(`div`,{className:`mb-5`,children:[l?(0,i.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:l}):null,u?(0,i.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:u}):null]}):null,t[3]=u,t[4]=h,t[5]=l,t[6]=x):x=t[6];let S;return t[7]!==p||t[8]!==_||t[9]!==v||t[10]!==b||t[11]!==x?(S=(0,i.jsxs)(`section`,{id:_,role:`tabpanel`,"aria-labelledby":v,className:b,children:[x,p]}),t[7]=p,t[8]=_,t[9]=v,t[10]=b,t[11]=x,t[12]=S):S=t[12],S}export{a 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{p as i,r as a}from"./chunk-KS7C4IRE-BPb7KheU.js";import{n as o}from"./locale-store-B4o4aDCg.js";import{t as s}from"./messages-hlOsXkQ7.js";import{E as c,M as l,T as u,b as d,c as f,h as p,i as m,j as h,k as g,l as _,n as v,p as y,r as b}from"./route-preload-Bl10PwKS.js";var x=n(),S=e(t(),1),C=r(),w=[`overview`,`appearance`,`keyboard-shortcuts`,`personal`,`system`,`desktop-pet`,`desktop-app`,`agent-defaults`,`gateway`,`runtimes`,`devices`,`remote-access`,`shares`],T=(0,S.lazy)(()=>g().then(e=>({default:e.SetupStatusPanel}))),E=(0,S.lazy)(()=>m().then(e=>({default:e.AppearanceSettingsPanel}))),D=(0,S.lazy)(()=>p().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),O=(0,S.lazy)(()=>d().then(e=>({default:e.PersonalSettingsPanel}))),k=(0,S.lazy)(()=>l().then(e=>({default:e.SystemSettingsPanel}))),A=(0,S.lazy)(()=>f().then(e=>({default:e.DesktopPetSettings}))),j=(0,S.lazy)(()=>b().then(e=>({default:e.AppManagementSettingsPanel}))),M=(0,S.lazy)(()=>y().then(e=>({default:e.GatewaySettingsPanel}))),N=(0,S.lazy)(()=>c().then(e=>({default:e.RuntimeToolsSettingsPanel}))),P=(0,S.lazy)(()=>u().then(e=>({default:e.RemoteAccessHub}))),F=(0,S.lazy)(()=>h().then(e=>({default:e.SharesSettingsPanel}))),I=(0,S.lazy)(()=>v().then(e=>({default:e.AgentDefaultsSettingsPanel}))),L=(0,S.lazy)(()=>_().then(e=>({default:e.EndpointToolsManagementSettings})));function R(){let e=(0,x.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,C.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function z(e){return(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(R,{}),children:(0,C.jsx)(e,{})})}function B(){let e=(0,x.c)(28),{section:t}=i(),n=o(V),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let i=s(n);if(!t||!w.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsx)(a,{to:`/settings/overview`,replace:!0}),e[7]=t):t=e[7],d=t;break bb0}let o=t;if(o===`overview`){let t;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(T),e[8]=t):t=e[8],d=t;break bb0}let f=i.settingsSections[o];if(o===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(E),e[9]=t):t=e[9],d=t;break bb0}if(o===`keyboard-shortcuts`){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(D),e[10]=t):t=e[10],d=t;break bb0}if(o===`personal`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(O),e[11]=t):t=e[11],d=t;break bb0}if(o===`system`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(k),e[12]=t):t=e[12],d=t;break bb0}if(o===`desktop-pet`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(A),e[13]=t):t=e[13],d=t;break bb0}if(o===`desktop-app`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(j),e[14]=t):t=e[14],d=t;break bb0}if(o===`agent-defaults`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(I),e[15]=t):t=e[15],d=t;break bb0}if(o===`gateway`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(M),e[16]=t):t=e[16],d=t;break bb0}if(o===`runtimes`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(N),e[17]=t):t=e[17],d=t;break bb0}if(o===`devices`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(L),e[18]=t):t=e[18],d=t;break bb0}if(o===`remote-access`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(P),e[19]=t):t=e[19],d=t;break bb0}if(o===`shares`){let t;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(F),e[20]=t):t=e[20],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,C.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=i.settingsPage.comingSoon.replace(`{{title}}`,f)}e[0]=n,e[1]=t,e[2]=r,e[3]=c,e[4]=l,e[5]=u,e[6]=d}else r=e[2],c=e[3],l=e[4],u=e[5],d=e[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;e[21]!==r||e[22]!==c?(f=(0,C.jsx)(`p`,{className:r,children:c}),e[21]=r,e[22]=c,e[23]=f):f=e[23];let p;return e[24]!==l||e[25]!==u||e[26]!==f?(p=(0,C.jsxs)(`div`,{className:l,children:[u,f]}),e[24]=l,e[25]=u,e[26]=f,e[27]=p):p=e[27],p}function V(e){return e.language}export{B as SettingsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i,r as a}from"./chunk-KS7C4IRE-DbzE-1bp.js";import{n as o}from"./locale-store-B4o4aDCg.js";import{t as s}from"./messages-hlOsXkQ7.js";import{E as c,M as l,T as u,b as d,c as f,h as p,i as m,j as h,k as g,l as _,n as v,p as y,r as b}from"./route-preload-D36bLXpD.js";var x=n(),S=e(t(),1),C=r(),w=[`overview`,`appearance`,`keyboard-shortcuts`,`personal`,`system`,`desktop-pet`,`desktop-app`,`agent-defaults`,`gateway`,`runtimes`,`devices`,`remote-access`,`shares`],T=(0,S.lazy)(()=>g().then(e=>({default:e.SetupStatusPanel}))),E=(0,S.lazy)(()=>m().then(e=>({default:e.AppearanceSettingsPanel}))),D=(0,S.lazy)(()=>p().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),O=(0,S.lazy)(()=>d().then(e=>({default:e.PersonalSettingsPanel}))),k=(0,S.lazy)(()=>l().then(e=>({default:e.SystemSettingsPanel}))),A=(0,S.lazy)(()=>f().then(e=>({default:e.DesktopPetSettings}))),j=(0,S.lazy)(()=>b().then(e=>({default:e.AppManagementSettingsPanel}))),M=(0,S.lazy)(()=>y().then(e=>({default:e.GatewaySettingsPanel}))),N=(0,S.lazy)(()=>c().then(e=>({default:e.RuntimeToolsSettingsPanel}))),P=(0,S.lazy)(()=>u().then(e=>({default:e.RemoteAccessHub}))),F=(0,S.lazy)(()=>h().then(e=>({default:e.SharesSettingsPanel}))),I=(0,S.lazy)(()=>v().then(e=>({default:e.AgentDefaultsSettingsPanel}))),L=(0,S.lazy)(()=>_().then(e=>({default:e.EndpointToolsManagementSettings})));function R(){let e=(0,x.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,C.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function z(e){return(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(R,{}),children:(0,C.jsx)(e,{})})}function B(){let e=(0,x.c)(28),{section:t}=i(),n=o(V),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let i=s(n);if(!t||!w.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsx)(a,{to:`/settings/overview`,replace:!0}),e[7]=t):t=e[7],d=t;break bb0}let o=t;if(o===`overview`){let t;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(T),e[8]=t):t=e[8],d=t;break bb0}let f=i.settingsSections[o];if(o===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(E),e[9]=t):t=e[9],d=t;break bb0}if(o===`keyboard-shortcuts`){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(D),e[10]=t):t=e[10],d=t;break bb0}if(o===`personal`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(O),e[11]=t):t=e[11],d=t;break bb0}if(o===`system`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(k),e[12]=t):t=e[12],d=t;break bb0}if(o===`desktop-pet`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(A),e[13]=t):t=e[13],d=t;break bb0}if(o===`desktop-app`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(j),e[14]=t):t=e[14],d=t;break bb0}if(o===`agent-defaults`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(I),e[15]=t):t=e[15],d=t;break bb0}if(o===`gateway`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(M),e[16]=t):t=e[16],d=t;break bb0}if(o===`runtimes`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(N),e[17]=t):t=e[17],d=t;break bb0}if(o===`devices`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(L),e[18]=t):t=e[18],d=t;break bb0}if(o===`remote-access`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(P),e[19]=t):t=e[19],d=t;break bb0}if(o===`shares`){let t;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(F),e[20]=t):t=e[20],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,C.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=i.settingsPage.comingSoon.replace(`{{title}}`,f)}e[0]=n,e[1]=t,e[2]=r,e[3]=c,e[4]=l,e[5]=u,e[6]=d}else r=e[2],c=e[3],l=e[4],u=e[5],d=e[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;e[21]!==r||e[22]!==c?(f=(0,C.jsx)(`p`,{className:r,children:c}),e[21]=r,e[22]=c,e[23]=f):f=e[23];let p;return e[24]!==l||e[25]!==u||e[26]!==f?(p=(0,C.jsxs)(`div`,{className:l,children:[u,f]}),e[24]=l,e[25]=u,e[26]=f,e[27]=p):p=e[27],p}function V(e){return e.language}export{B as SettingsPage};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{h as r,p as i,u as a}from"./chunk-KS7C4IRE-BPb7KheU.js";import{i as o,n as s,o as c}from"./locale-store-B4o4aDCg.js";import{a as l,i as u,o as d,r as f,s as p,t as m}from"./dist-CY7CS_D3.js";import{n as h,r as g}from"./popover-select-CLsphyzA.js";import{t as _}from"./lock-keyhole-DEK5kH0u.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./skeleton-DzdOeGYz.js";import{i as b}from"./vendor-swr-CdRzEUwF.js";import{t as x}from"./button-ChmVQg9O.js";import{n as S,t as C}from"./phone-model-connection-BDzr9jXL.js";var w=e(t(),1),T=n();function E(){let{scene:e,setupId:t}=i(),[n]=r(),E=n.get(`conversationId`)??``,D=n.get(`step`),O=s(e=>e.language)===`zh`,k=a(),[A,j]=(0,w.useState)(!1),M=(0,w.useRef)(null),[N,P]=(0,w.useState)(!1),[F,I]=(0,w.useState)(``),[L,R]=(0,w.useState)(``),z=(0,w.useRef)(!1);(0,w.useEffect)(()=>{z.current=!1,j(!1),R(``),I(``)},[e,t,E]);let B=[`browser`,`phone`].includes(e??``)&&!!(t&&E),V=async(n,r={})=>(await c(o(`/api/${e}/setup`),{method:`POST`,body:JSON.stringify({conversationId:E,setupId:t,action:n,...r})})).payload,{data:H,error:U,mutate:W}=b(B?[`setup-interaction`,e,t,E]:null,()=>V(`get`),{refreshInterval:2e3}),G=e=>e.id===t&&e.conversationId===E&&!e.stale&&![`cancelled`,`completed`].includes(e.state),K=()=>{!N&&!z.current&&k(`/chat/${encodeURIComponent(E)}`,{replace:!0})},q=async(t=``)=>{if(!z.current){z.current=!0,P(!0),I(``);try{let n=await V(`recheck`);if(!G(n))throw Error(`changed`);if(e===`browser`&&!n.endpoints?.some(e=>e.endpointId===t))throw Error(`not-connected`);let r=e===`browser`?O?`允许仅在独立测试页进行读取、点击和示例输入的有界验收,完成后关闭并确认释放,不操作业务网页。`:`I authorize bounded read, click and sample input on the isolated test page only; close and confirm release afterwards. Do not operate business pages.`:``,i=O?`人工配置步骤已完成。${r}请先重新检查本对话 ${e===`browser`?`Browser Use`:`Phone Use`} 的配置进度,继续此前已授权的流程。${t?`本次选择:${t}。`:``}不要扩大设备、权限或任务范围;取消或过期的授权不能恢复。`:`The manual setup step is complete. ${r} Recheck this conversation’s ${e===`browser`?`Browser Use`:`Phone Use`} setup before continuing the previously authorized flow.${t?` Selected target: ${t}.`:``} Do not widen device, permission or task scope, or revive cancelled or expired grants.`,a=new URLSearchParams({draft:i,autoSend:`1`});k(`/chat/${encodeURIComponent(E)}?${a}`,{replace:!0})}catch{z.current=!1,I(O?`尚未检测到有效配置,或原请求已变更。请检查后重试。`:`The setup is not ready or the original request changed. Check and try again.`)}finally{P(!1)}}},J=H&&G(H);if(J&&e===`phone`&&D===`connection`&&H.source===`aliyun`&&!A)return(0,T.jsx)(S,{zh:O,initialMethod:`aliyun`,onClose:K,onSelect:()=>{I(O?`请在原对话确认本机设备。`:`Confirm the local device in the original chat.`)},onAdded:()=>{j(!0),q()}});let Y=e===`browser`?O?`完成浏览器连接`:`Finish browser connection`:D===`model`?O?`配置手机模型`:`Set up Phone model`:O?`完成手机连接`:`Finish phone connection`;return(0,T.jsx)(`main`,{className:`h-full bg-surface-base`,children:(0,T.jsx)(m,{open:!0,onOpenChange:e=>{e||K()},children:(0,T.jsxs)(d,{children:[(0,T.jsx)(l,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-sm`}),(0,T.jsxs)(f,{onOpenAutoFocus:e=>{e.preventDefault(),M.current?.focus()},className:`fixed inset-x-0 bottom-0 z-[70] flex h-[min(36rem,calc(100dvh-1rem))] flex-col overflow-hidden rounded-t-3xl border border-edge bg-surface-overlay text-fg sm:inset-x-auto sm:bottom-auto sm:left-1/2 sm:top-1/2 sm:w-[30rem] sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-3xl`,children:[(0,T.jsxs)(`header`,{className:`relative shrink-0 px-6 pb-5 pt-8 text-center`,children:[(0,T.jsx)(x,{variant:`ghost`,className:`absolute right-2 top-2 size-11 p-0`,disabled:N,"aria-label":O?`暂时关闭`:`Close for now`,onClick:K,children:(0,T.jsx)(v,{className:`size-4`,"aria-hidden":!0})}),(0,T.jsx)(_,{className:`mx-auto mb-4 size-6 text-accent-fg`,"aria-hidden":!0}),(0,T.jsx)(p,{ref:M,tabIndex:-1,className:`text-xl font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:Y}),(0,T.jsx)(u,{className:`mt-3 text-sm text-fg-muted`,children:O?`只完成需要你操作的一步,密钥不会进入对话。`:`Complete only the step that needs you. Secrets never enter the conversation.`})]}),(0,T.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-6 pb-5`,children:[!H&&!U&&B?(0,T.jsx)(y,{className:`h-32 w-full rounded-xl`}):J?e===`phone`&&D===`model`?(0,T.jsx)(C,{zh:O,value:H.readiness?.model.ref??``,disabled:N,onSave:async e=>{P(!0);try{await V(`set_model`,{modelRef:e,expectedRevision:H.revision,replaceExisting:!0}),await W()}finally{P(!1)}await q()}}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:e===`browser`?O?`在 Gateway 所在电脑的 Chrome 加载已准备的扩展,并接受你同意的原生权限。随后选择这个 Chrome,系统会在独立测试页验证读取、点击和输入,再释放控制。`:`Load the prepared extension in Chrome on the Gateway computer and accept the native permissions you agree to. Select that Chrome to verify read, click and fill on an isolated test page, then release control.`:O?`连接并解锁 Gateway 所在电脑上的测试手机,按手机提示确认 USB 调试。返回后会重新检查设备,只继续此前授权的设置页测试。`:`Connect and unlock the test phone on the Gateway computer and confirm USB debugging on the phone. The device will be rechecked before the previously authorized Settings test continues.`}),e===`browser`?(0,T.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,T.jsx)(`span`,{children:O?`用于验收的 Chrome`:`Chrome to verify`}),(0,T.jsxs)(h,{"aria-label":O?`用于验收的 Chrome`:`Chrome to verify`,value:L,onChange:e=>R(e.target.value),children:[(0,T.jsx)(g,{value:``,children:O?`选择 Chrome`:`Choose Chrome`}),H.endpoints?.map(e=>(0,T.jsx)(g,{value:e.endpointId,children:e.displayName},e.endpointId))]})]}):null]}):(0,T.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:O?`此配置请求已失效或无法读取,请返回原对话重新检查。`:`This setup is no longer valid or could not be loaded. Return to the original chat to recheck.`}),F?(0,T.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:F}):null]}),(0,T.jsxs)(`footer`,{className:`shrink-0 space-y-2 border-t border-edge p-5 pb-[max(1.25rem,env(safe-area-inset-bottom))]`,children:[J&&!(e===`phone`&&D===`model`)?(0,T.jsx)(x,{variant:`primary`,className:`min-h-12 w-full`,disabled:N||e===`browser`&&!L,onClick:()=>{q(L)},children:e===`browser`?O?`核对并开始安全验收`:`Recheck and start safe test`:O?`检查并继续原对话`:`Recheck and continue in chat`}):null,(0,T.jsx)(x,{variant:`ghost`,className:`min-h-11 w-full`,disabled:N,onClick:K,children:O?`返回原对话`:`Return to original chat`})]})]})]})})})}export{E as SetupInteractionPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{d as r,g as i,m as a}from"./chunk-KS7C4IRE-DbzE-1bp.js";import{i as o,n as s,o as c}from"./locale-store-B4o4aDCg.js";import{a as l,i as u,o as d,r as f,s as p,t as m}from"./dist-DlirbHVs.js";import{n as h,r as g}from"./popover-select-hRG1EzAY.js";import{t as _}from"./lock-keyhole-DEK5kH0u.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./skeleton-DzdOeGYz.js";import{i as b}from"./vendor-swr-CdRzEUwF.js";import{t as x}from"./button-C5tRaJxt.js";import{n as S,t as C}from"./phone-model-connection-DtBRZXUN.js";var w=e(t(),1),T=n();function E(){let{scene:e,setupId:t}=a(),[n]=i(),E=n.get(`conversationId`)??``,D=n.get(`step`),O=s(e=>e.language)===`zh`,k=r(),[A,j]=(0,w.useState)(!1),M=(0,w.useRef)(null),[N,P]=(0,w.useState)(!1),[F,I]=(0,w.useState)(``),[L,R]=(0,w.useState)(``),z=(0,w.useRef)(!1);(0,w.useEffect)(()=>{z.current=!1,j(!1),R(``),I(``)},[e,t,E]);let B=[`browser`,`phone`].includes(e??``)&&!!(t&&E),V=async(n,r={})=>(await c(o(`/api/${e}/setup`),{method:`POST`,body:JSON.stringify({conversationId:E,setupId:t,action:n,...r})})).payload,{data:H,error:U,mutate:W}=b(B?[`setup-interaction`,e,t,E]:null,()=>V(`get`),{refreshInterval:2e3}),G=e=>e.id===t&&e.conversationId===E&&!e.stale&&![`cancelled`,`completed`].includes(e.state),K=()=>{!N&&!z.current&&k(`/chat/${encodeURIComponent(E)}`,{replace:!0})},q=async(t=``)=>{if(!z.current){z.current=!0,P(!0),I(``);try{let n=await V(`recheck`);if(!G(n))throw Error(`changed`);if(e===`browser`&&!n.endpoints?.some(e=>e.endpointId===t))throw Error(`not-connected`);let r=e===`browser`?O?`允许仅在独立测试页进行读取、点击和示例输入的有界验收,完成后关闭并确认释放,不操作业务网页。`:`I authorize bounded read, click and sample input on the isolated test page only; close and confirm release afterwards. Do not operate business pages.`:``,i=O?`人工配置步骤已完成。${r}请先重新检查本对话 ${e===`browser`?`Browser Use`:`Phone Use`} 的配置进度,继续此前已授权的流程。${t?`本次选择:${t}。`:``}不要扩大设备、权限或任务范围;取消或过期的授权不能恢复。`:`The manual setup step is complete. ${r} Recheck this conversation’s ${e===`browser`?`Browser Use`:`Phone Use`} setup before continuing the previously authorized flow.${t?` Selected target: ${t}.`:``} Do not widen device, permission or task scope, or revive cancelled or expired grants.`,a=new URLSearchParams({draft:i,autoSend:`1`});k(`/chat/${encodeURIComponent(E)}?${a}`,{replace:!0})}catch{z.current=!1,I(O?`尚未检测到有效配置,或原请求已变更。请检查后重试。`:`The setup is not ready or the original request changed. Check and try again.`)}finally{P(!1)}}},J=H&&G(H);if(J&&e===`phone`&&D===`connection`&&H.source===`aliyun`&&!A)return(0,T.jsx)(S,{zh:O,initialMethod:`aliyun`,onClose:K,onSelect:()=>{I(O?`请在原对话确认本机设备。`:`Confirm the local device in the original chat.`)},onAdded:()=>{j(!0),q()}});let Y=e===`browser`?O?`完成浏览器连接`:`Finish browser connection`:D===`model`?O?`配置手机模型`:`Set up Phone model`:O?`完成手机连接`:`Finish phone connection`;return(0,T.jsx)(`main`,{className:`h-full bg-surface-base`,children:(0,T.jsx)(m,{open:!0,onOpenChange:e=>{e||K()},children:(0,T.jsxs)(d,{children:[(0,T.jsx)(l,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-sm`}),(0,T.jsxs)(f,{onOpenAutoFocus:e=>{e.preventDefault(),M.current?.focus()},className:`fixed inset-x-0 bottom-0 z-[70] flex h-[min(36rem,calc(100dvh-1rem))] flex-col overflow-hidden rounded-t-3xl border border-edge bg-surface-overlay text-fg sm:inset-x-auto sm:bottom-auto sm:left-1/2 sm:top-1/2 sm:w-[30rem] sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-3xl`,children:[(0,T.jsxs)(`header`,{className:`relative shrink-0 px-6 pb-5 pt-8 text-center`,children:[(0,T.jsx)(x,{variant:`ghost`,className:`absolute right-2 top-2 size-11 p-0`,disabled:N,"aria-label":O?`暂时关闭`:`Close for now`,onClick:K,children:(0,T.jsx)(v,{className:`size-4`,"aria-hidden":!0})}),(0,T.jsx)(_,{className:`mx-auto mb-4 size-6 text-accent-fg`,"aria-hidden":!0}),(0,T.jsx)(p,{ref:M,tabIndex:-1,className:`text-xl font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:Y}),(0,T.jsx)(u,{className:`mt-3 text-sm text-fg-muted`,children:O?`只完成需要你操作的一步,密钥不会进入对话。`:`Complete only the step that needs you. Secrets never enter the conversation.`})]}),(0,T.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-6 pb-5`,children:[!H&&!U&&B?(0,T.jsx)(y,{className:`h-32 w-full rounded-xl`}):J?e===`phone`&&D===`model`?(0,T.jsx)(C,{zh:O,value:H.readiness?.model.ref??``,disabled:N,onSave:async e=>{P(!0);try{await V(`set_model`,{modelRef:e,expectedRevision:H.revision,replaceExisting:!0}),await W()}finally{P(!1)}await q()}}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:e===`browser`?O?`在 Gateway 所在电脑的 Chrome 加载已准备的扩展,并接受你同意的原生权限。随后选择这个 Chrome,系统会在独立测试页验证读取、点击和输入,再释放控制。`:`Load the prepared extension in Chrome on the Gateway computer and accept the native permissions you agree to. Select that Chrome to verify read, click and fill on an isolated test page, then release control.`:O?`连接并解锁 Gateway 所在电脑上的测试手机,按手机提示确认 USB 调试。返回后会重新检查设备,只继续此前授权的设置页测试。`:`Connect and unlock the test phone on the Gateway computer and confirm USB debugging on the phone. The device will be rechecked before the previously authorized Settings test continues.`}),e===`browser`?(0,T.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,T.jsx)(`span`,{children:O?`用于验收的 Chrome`:`Chrome to verify`}),(0,T.jsxs)(h,{"aria-label":O?`用于验收的 Chrome`:`Chrome to verify`,value:L,onChange:e=>R(e.target.value),children:[(0,T.jsx)(g,{value:``,children:O?`选择 Chrome`:`Choose Chrome`}),H.endpoints?.map(e=>(0,T.jsx)(g,{value:e.endpointId,children:e.displayName},e.endpointId))]})]}):null]}):(0,T.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:O?`此配置请求已失效或无法读取,请返回原对话重新检查。`:`This setup is no longer valid or could not be loaded. Return to the original chat to recheck.`}),F?(0,T.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:F}):null]}),(0,T.jsxs)(`footer`,{className:`shrink-0 space-y-2 border-t border-edge p-5 pb-[max(1.25rem,env(safe-area-inset-bottom))]`,children:[J&&!(e===`phone`&&D===`model`)?(0,T.jsx)(x,{variant:`primary`,className:`min-h-12 w-full`,disabled:N||e===`browser`&&!L,onClick:()=>{q(L)},children:e===`browser`?O?`核对并开始安全验收`:`Recheck and start safe test`:O?`检查并继续原对话`:`Recheck and continue in chat`}):null,(0,T.jsx)(x,{variant:`ghost`,className:`min-h-11 w-full`,disabled:N,onClick:K,children:O?`返回原对话`:`Return to original chat`})]})]})]})})})}export{E as SetupInteractionPage};