@xopcai/xopc 0.0.269 → 0.0.272

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 (293) hide show
  1. package/dist/browser-ext/dist/assets/{auth-cwEj8rFb.js → auth-C1QI-uMG.js} +65 -14
  2. package/dist/browser-ext/dist/background.js +23 -2
  3. package/dist/browser-ext/dist/pairing-handoff.js +51 -0
  4. package/dist/browser-ext/dist/sidepanel.html +1 -1
  5. package/dist/browser-ext/dist/sidepanel.js +39 -27
  6. package/dist/browser-ext/manifest.json +12 -1
  7. package/dist/extensions/telegram/xopc.extension.json +1 -1
  8. package/dist/gateway/static/root/assets/{activity-store-DcwCSY6s.js → activity-store-DffqjeqQ.js} +1 -1
  9. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D0NBOWC4.js → agent-avatar-dicebear-Cwj4HCYY.js} +1 -1
  10. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-6CLfLxVc.js +1 -0
  11. package/dist/gateway/static/root/assets/agents-B6mu64fY.js +1 -0
  12. package/dist/gateway/static/root/assets/{api-eaPO-mdr.js → api-CGLdye4i.js} +1 -1
  13. package/dist/gateway/static/root/assets/{app-management-settings-panel-E3xm2teY.js → app-management-settings-panel-BLujSbaw.js} +1 -1
  14. package/dist/gateway/static/root/assets/{appearance-settings-CiZOjgls.js → appearance-settings-BXMcueb8.js} +1 -1
  15. package/dist/gateway/static/root/assets/apps-page-BEgy4hY3.js +1 -0
  16. package/dist/gateway/static/root/assets/{archive-plugin-D09yo_Hc.js → archive-plugin-D4bUampf.js} +1 -1
  17. package/dist/gateway/static/root/assets/{attachment-load-CNYb8Qru.js → attachment-load-CBGNA2Ys.js} +1 -1
  18. package/dist/gateway/static/root/assets/{automations-page-DsrfW5ii.js → automations-page-dQyolNmy.js} +1 -1
  19. package/dist/gateway/static/root/assets/automations-workspace-DxRFrmrV.js +6 -0
  20. package/dist/gateway/static/root/assets/{binary-plugins-OWlaGqlY.js → binary-plugins-bbvp81h2.js} +1 -1
  21. package/dist/gateway/static/root/assets/{block-editor-CVND3M6r.js → block-editor-C8e6Wri4.js} +3 -3
  22. package/dist/gateway/static/root/assets/{browser-automation-inputs-D7IzVK_J.js → browser-automation-inputs-oJWJtQa6.js} +1 -1
  23. package/dist/gateway/static/root/assets/{browser-automations-page-CQ6cCpIv.js → browser-automations-page-CAcJQSjN.js} +2 -2
  24. package/dist/gateway/static/root/assets/browser-settings-page-TLAlqcPo.js +8 -0
  25. package/dist/gateway/static/root/assets/capabilities-settings-panel-z-K_jrZz.js +8 -0
  26. package/dist/gateway/static/root/assets/channels-settings-Dzrk33aB.js +1 -0
  27. package/dist/gateway/static/root/assets/{channels-status-swr-D4JrgJKa.js → channels-status-swr-CfOPNnVr.js} +1 -1
  28. package/dist/gateway/static/root/assets/{chat-terminal-dock-BUjnhT7C.js → chat-terminal-dock-9ZOl92kh.js} +2 -2
  29. package/dist/gateway/static/root/assets/clock-3-DnrAnuyZ.js +1 -0
  30. package/dist/gateway/static/root/assets/connectors-page-B1dIoRNi.js +2 -0
  31. package/dist/gateway/static/root/assets/cron-expression-C26e13YU.js +2 -0
  32. package/dist/gateway/static/root/assets/date-picker-Dj6FRLF9.js +1 -0
  33. package/dist/gateway/static/root/assets/{dependency-picker-Z6Nf0Wjq.js → dependency-picker-D1q89tVc.js} +1 -1
  34. package/dist/gateway/static/root/assets/{desktop-pet-C0F5Iqnc.js → desktop-pet-DfqZBvhp.js} +1 -1
  35. package/dist/gateway/static/root/assets/{desktop-pet-settings-Bj_W6HL1.js → desktop-pet-settings-HCEh2MOm.js} +1 -1
  36. package/dist/gateway/static/root/assets/device-pairing-wizard-CPth92s6.js +1 -0
  37. package/dist/gateway/static/root/assets/{extension-debug-page-Ba09EnAn.js → extension-debug-page-C8cAWVoK.js} +1 -1
  38. package/dist/gateway/static/root/assets/{extension-page-C88aGXJs.js → extension-page-5N87Vaym.js} +1 -1
  39. package/dist/gateway/static/root/assets/extension-settings-page-D85SAUFP.js +1 -0
  40. package/dist/gateway/static/root/assets/{gateway-config-swr-bjzk_4hn.js → gateway-config-swr-BjsDnB_n.js} +1 -1
  41. package/dist/gateway/static/root/assets/gateway-settings-Dqx8PmcT.js +1 -0
  42. package/dist/gateway/static/root/assets/{gateway-startup-retry-DrbIzFyB.js → gateway-startup-retry-BIf0eLWX.js} +1 -1
  43. package/dist/gateway/static/root/assets/git-branch-Dh9uxTot.js +1 -0
  44. package/dist/gateway/static/root/assets/heartbeat-settings-BpDWGE1a.js +1 -0
  45. package/dist/gateway/static/root/assets/home-page-DJaqpC8-.js +1 -0
  46. package/dist/gateway/static/root/assets/{image-generation-api-CBWU9Ner.js → image-generation-api-1m8xTVS_.js} +1 -1
  47. package/dist/gateway/static/root/assets/index-C6PmD0cK.js +74 -0
  48. package/dist/gateway/static/root/assets/index-DKy1Qn1_.css +2 -0
  49. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B8Z7kKQY.js → keyboard-shortcuts-settings-Byy8mCSq.js} +1 -1
  50. package/dist/gateway/static/root/assets/local-app-workbench-page-l2AEiG2C.js +2 -0
  51. package/dist/gateway/static/root/assets/{local-apps-page-CLSfzkRp.js → local-apps-page-BPo0wBgM.js} +1 -1
  52. package/dist/gateway/static/root/assets/locale-store-CRNble2Z.js +1 -0
  53. package/dist/gateway/static/root/assets/logs-page-X5FdLlXK.js +2 -0
  54. package/dist/gateway/static/root/assets/management-settings-DT6NoIjm.js +1 -0
  55. package/dist/gateway/static/root/assets/{markdown-view-DIcfrLmG.js → markdown-view-AglreSOj.js} +1 -1
  56. package/dist/gateway/static/root/assets/{media-plugins-CSv6-xTA.js → media-plugins-Bzka9qXu.js} +1 -1
  57. package/dist/gateway/static/root/assets/message-circle-Badhj-4D.js +1 -0
  58. package/dist/gateway/static/root/assets/message-square-fVE7Ghj1.js +1 -0
  59. package/dist/gateway/static/root/assets/{messages-BRjoarIr.js → messages-DH_HCgmw.js} +3 -3
  60. package/dist/gateway/static/root/assets/note-detail-panel-BUJPoaGZ.js +5 -0
  61. package/dist/gateway/static/root/assets/notes-page-BwFpWRuo.js +8 -0
  62. package/dist/gateway/static/root/assets/{page-tabs-BfV-PQa5.js → page-tabs-Ys0p65Lt.js} +1 -1
  63. package/dist/gateway/static/root/assets/popover-select-Dz_Qis2R.js +1 -0
  64. package/dist/gateway/static/root/assets/{preview-open-alternatives-DQS7NFpg.js → preview-open-alternatives-iknB5xEp.js} +1 -1
  65. package/dist/gateway/static/root/assets/proactive-card-BPZDgNNR.js +1 -0
  66. package/dist/gateway/static/root/assets/proactive-page-CxdZR-p2.js +1 -0
  67. package/dist/gateway/static/root/assets/{product-open-page-BIhjZLKg.js → product-open-page-W1o3f-kz.js} +1 -1
  68. package/dist/gateway/static/root/assets/project-detail-page-BU1RKAcy.js +1 -0
  69. package/dist/gateway/static/root/assets/projects-page-z0X0tL8G.js +1 -0
  70. package/dist/gateway/static/root/assets/{registry-api-CwveUfe8.js → registry-api-DmYFpjsH.js} +1 -1
  71. package/dist/gateway/static/root/assets/remote-access-hub-NNTut2I8.js +1 -0
  72. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DMQ0wpNg.js → runtime-tools-settings-panel-DP1XyYO8.js} +1 -1
  73. package/dist/gateway/static/root/assets/{schema-form-C91g2PRU.js → schema-form-BMYKdzsH.js} +1 -1
  74. package/dist/gateway/static/root/assets/sessions-page-B6SsHlz5.js +1 -0
  75. package/dist/gateway/static/root/assets/settings-advanced-gate-BQu8bAcN.js +1 -0
  76. package/dist/gateway/static/root/assets/{settings-form-section-Cem6L49Y.js → settings-form-section-2LGjz7bu.js} +1 -1
  77. package/dist/gateway/static/root/assets/{settings-page-afDUxqlV.js → settings-page-7DjpC9_C.js} +1 -1
  78. package/dist/gateway/static/root/assets/setup-status-panel-Dj9jFWJt.js +1 -0
  79. package/dist/gateway/static/root/assets/{share-preview-page-CVEVHksg.js → share-preview-page-BxYdSi8c.js} +1 -1
  80. package/dist/gateway/static/root/assets/shares-settings-CMqE0KuK.js +1 -0
  81. package/dist/gateway/static/root/assets/skill-reload-api-BXqSJymN.js +1 -0
  82. package/dist/gateway/static/root/assets/{skills-page-CNrq1W6C.js → skills-page-DNEScMZH.js} +1 -1
  83. package/dist/gateway/static/root/assets/skills-page.utils-q88l65YU.js +1 -0
  84. package/dist/gateway/static/root/assets/{system-settings-panel-BLE8PxWE.js → system-settings-panel-8NIssGKj.js} +1 -1
  85. package/dist/gateway/static/root/assets/task-detail-page-L6dp9v2y.js +1 -0
  86. package/dist/gateway/static/root/assets/{theme-store-BejLVjIT.js → theme-store-BXZG3S25.js} +1 -1
  87. package/dist/gateway/static/root/assets/tunnel-api-CWsRPM84.js +1 -0
  88. package/dist/gateway/static/root/assets/{use-autosave-DmgEA8Qb.js → use-autosave-BwQuoTQU.js} +1 -1
  89. package/dist/gateway/static/root/assets/user-model-page-D4BucMrZ.js +2 -0
  90. package/dist/gateway/static/root/assets/{voice-api-key-field-sZ0J83SF.js → voice-api-key-field-Bd03Ic0s.js} +1 -1
  91. package/dist/gateway/static/root/assets/{voice-config-api-BEbz3avx.js → voice-config-api-gggUp3u9.js} +1 -1
  92. package/dist/gateway/static/root/assets/{work-discovery-overlay-BXnAlbmO.js → work-discovery-overlay-DF8PR_pK.js} +1 -1
  93. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BkwFey0a.js → workflow-run-setup-panel-BiAAWlir.js} +2 -2
  94. package/dist/gateway/static/root/assets/workflows-page-DryKUMfA.js +6 -0
  95. package/dist/gateway/static/root/index.html +15 -11
  96. package/dist/package.js +1 -1
  97. package/dist/packages/gateway-contract/src/device-pairing.js +2 -1
  98. package/dist/packages/gateway-contract/src/notifications.js +2 -2
  99. package/dist/packages/gateway-contract/src/proactive.js +22 -6
  100. package/dist/packages/gateway-contract/src/session-identity.js +37 -0
  101. package/dist/src/agent/memory/compaction-chunks.d.ts +18 -0
  102. package/dist/src/agent/memory/compaction-chunks.js +53 -0
  103. package/dist/src/agent/memory/compaction-request.d.ts +12 -0
  104. package/dist/src/agent/memory/compaction-request.js +72 -0
  105. package/dist/src/agent/memory/compaction.d.ts +3 -0
  106. package/dist/src/agent/memory/compaction.js +166 -118
  107. package/dist/src/agent/service.js +1 -0
  108. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  109. package/dist/src/agent/tool-manuals/xopc-use.js +19 -1
  110. package/dist/src/agent/tools/factory.js +1 -0
  111. package/dist/src/agent/tools/xopc-use-tool.d.ts +3 -2
  112. package/dist/src/agent/tools/xopc-use-tool.js +48 -4
  113. package/dist/src/browser/automations/schema.d.ts +1 -1
  114. package/dist/src/browser/automations/service.d.ts +1 -1
  115. package/dist/src/browser/native-messaging-host.js +3 -1
  116. package/dist/src/cli/commands/connectors.js +1 -1
  117. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  118. package/dist/src/cli/commands/tunnel.js +5 -0
  119. package/dist/src/connectors/connected-source-ingestion.js +1 -1
  120. package/dist/src/connectors/connected-source-normalizers.js +3 -0
  121. package/dist/src/connectors/connection-recovery-service.js +1 -1
  122. package/dist/src/connectors/health.js +1 -1
  123. package/dist/src/gateway/heartbeat/service.js +1 -1
  124. package/dist/src/gateway/hono/app.js +1 -0
  125. package/dist/src/gateway/hono/middleware/auth.d.ts +1 -2
  126. package/dist/src/gateway/hono/middleware/auth.js +49 -31
  127. package/dist/src/gateway/hono/middleware/strict-rate-limit.js +11 -15
  128. package/dist/src/gateway/hono/routes/browser-session.d.ts +3 -0
  129. package/dist/src/gateway/hono/routes/browser-session.js +43 -0
  130. package/dist/src/gateway/hono/routes/capabilities.js +1 -1
  131. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  132. package/dist/src/gateway/hono/routes/devices.js +61 -96
  133. package/dist/src/gateway/hono/routes/exposure.js +3 -7
  134. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  135. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  136. package/dist/src/gateway/hono/routes/models.js +60 -1
  137. package/dist/src/gateway/hono/routes/notes.js +3 -7
  138. package/dist/src/gateway/hono/routes/proactive-control.js +31 -24
  139. package/dist/src/gateway/hono/routes/sessions.js +11 -0
  140. package/dist/src/gateway/hono/routes/shares.js +8 -20
  141. package/dist/src/gateway/hono/routes/site-shares.js +4 -8
  142. package/dist/src/gateway/hono/routes/tunnel.js +13 -13
  143. package/dist/src/gateway/image-generation-setup.d.ts +17 -0
  144. package/dist/src/gateway/image-generation-setup.js +30 -21
  145. package/dist/src/gateway/rate-limit/buckets.d.ts +3 -0
  146. package/dist/src/gateway/rate-limit/buckets.js +10 -0
  147. package/dist/src/gateway/runtime-config.js +2 -0
  148. package/dist/src/gateway/security/browser-session.d.ts +5 -0
  149. package/dist/src/gateway/security/browser-session.js +45 -0
  150. package/dist/src/gateway/security/gateway-principal.d.ts +1 -0
  151. package/dist/src/gateway/service.d.ts +1 -0
  152. package/dist/src/gateway/service.js +21 -11
  153. package/dist/src/heartbeat/index.js +1 -1
  154. package/dist/src/infra/rate-limit/keyed-store.d.ts +3 -0
  155. package/dist/src/infra/rate-limit/keyed-store.js +9 -2
  156. package/dist/src/notifications/web-push.js +1 -1
  157. package/dist/src/proactive/actions/service.js +4 -2
  158. package/dist/src/proactive/execution/authorization.d.ts +2 -0
  159. package/dist/src/proactive/execution/authorization.js +39 -1
  160. package/dist/src/proactive/execution/context.d.ts +4 -0
  161. package/dist/src/proactive/execution/context.js +51 -5
  162. package/dist/src/proactive/execution/insight.js +3 -1
  163. package/dist/src/proactive/execution/repository.js +15 -5
  164. package/dist/src/proactive/execution/types.d.ts +2 -0
  165. package/dist/src/proactive/execution/worker.js +7 -2
  166. package/dist/src/proactive/experience.d.ts +69 -0
  167. package/dist/src/proactive/experience.js +90 -0
  168. package/dist/src/proactive/follow-ups.d.ts +123 -0
  169. package/dist/src/proactive/follow-ups.js +169 -0
  170. package/dist/src/proactive/inbox/cards.js +35 -6
  171. package/dist/src/proactive/inbox/delivery.js +4 -2
  172. package/dist/src/proactive/inbox/digest.js +2 -2
  173. package/dist/src/proactive/inbox/lifecycle.js +4 -1
  174. package/dist/src/proactive/inbox/notification-policy.js +4 -2
  175. package/dist/src/proactive/inbox/repository.js +17 -11
  176. package/dist/src/proactive/inbox/types.d.ts +2 -0
  177. package/dist/src/proactive/inbox/worker.js +1 -1
  178. package/dist/src/proactive/index.js +2 -2
  179. package/dist/src/proactive/mail-thread.d.ts +13 -0
  180. package/dist/src/proactive/mail-thread.js +54 -0
  181. package/dist/src/proactive/policy/service.d.ts +3 -5
  182. package/dist/src/proactive/policy/service.js +3 -5
  183. package/dist/src/proactive/scenarios/control.d.ts +4 -7
  184. package/dist/src/proactive/scenarios/control.js +3 -4
  185. package/dist/src/proactive/scenarios/preview.js +1 -1
  186. package/dist/src/proactive/scenarios/prompt-composer.js +2 -0
  187. package/dist/src/proactive/service.js +1 -1
  188. package/dist/src/proactive/temporal/worker.d.ts +1 -0
  189. package/dist/src/proactive/temporal/worker.js +18 -4
  190. package/dist/src/realtime/runtime.d.ts +2 -1
  191. package/dist/src/realtime/runtime.js +9 -3
  192. package/dist/src/realtime/tickets.d.ts +1 -0
  193. package/dist/src/realtime/tickets.js +3 -0
  194. package/dist/src/session/store.d.ts +2 -0
  195. package/dist/src/session/store.js +17 -2
  196. package/dist/src/session/types.d.ts +2 -1
  197. package/dist/src/storage/sqlite/browser-session-repository.d.ts +17 -0
  198. package/dist/src/storage/sqlite/browser-session-repository.js +54 -0
  199. package/dist/src/storage/sqlite/device-pairing-approval.js +2 -1
  200. package/dist/src/storage/sqlite/device-pairing-repository.d.ts +4 -10
  201. package/dist/src/storage/sqlite/device-pairing-repository.js +10 -62
  202. package/dist/src/storage/sqlite/index.d.ts +1 -1
  203. package/dist/src/storage/sqlite/index.js +2 -2
  204. package/dist/src/storage/sqlite/migrations/162_proactive_product.sql +7 -0
  205. package/dist/src/storage/sqlite/migrations/163_proactive_follow_ups.sql +29 -0
  206. package/dist/src/storage/sqlite/migrations/164_browser_sessions.sql +8 -0
  207. package/dist/src/storage/sqlite/migrations/165_device_pairing_target.sql +40 -0
  208. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  209. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  210. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  211. package/dist/src/storage/sqlite/schema.js +1 -1
  212. package/dist/src/storage/sqlite/session-identity-sql.d.ts +2 -0
  213. package/dist/src/storage/sqlite/session-identity-sql.js +18 -0
  214. package/dist/src/storage/sqlite/session-repository.js +26 -22
  215. package/dist/src/tasks/home-query-service.js +1 -1
  216. package/dist/src/tasks/index.js +4 -4
  217. package/dist/src/tui/tui-startup-resources.js +1 -1
  218. package/dist/src/tunnel/auth-policy.d.ts +3 -0
  219. package/dist/src/tunnel/auth-policy.js +8 -0
  220. package/dist/src/tunnel/broker-client.d.ts +5 -15
  221. package/dist/src/tunnel/broker-client.js +37 -49
  222. package/dist/src/tunnel/frpc-binary.d.ts +8 -6
  223. package/dist/src/tunnel/frpc-binary.js +76 -88
  224. package/dist/src/tunnel/frpc-config.d.ts +2 -1
  225. package/dist/src/tunnel/frpc-config.js +29 -12
  226. package/dist/src/tunnel/frpc-release.d.ts +27 -0
  227. package/dist/src/tunnel/frpc-release.js +30 -0
  228. package/dist/src/tunnel/gateway-lifecycle.js +8 -2
  229. package/dist/src/tunnel/index.js +2 -1
  230. package/dist/src/tunnel/registration-proof.d.ts +19 -0
  231. package/dist/src/tunnel/registration-proof.js +37 -0
  232. package/dist/src/tunnel/tunnel-persist.js +3 -1
  233. package/dist/src/tunnel/tunnel-service.d.ts +1 -0
  234. package/dist/src/tunnel/tunnel-service.js +35 -8
  235. package/dist/src/tunnel/tunnel-state.js +11 -5
  236. package/dist/src/tunnel/tunnel-types.d.ts +2 -0
  237. package/dist/src/tunnel/well-known.js +5 -1
  238. package/dist/src/user-context/config.js +2 -2
  239. package/dist/src/utils/logger/redact.js +4 -0
  240. package/dist/src/voice/dashscope/streaming-stt-session.js +1 -0
  241. package/dist/src/voice/dashscope/streaming-tts-stream.d.ts +1 -0
  242. package/dist/src/voice/dashscope/streaming-tts-stream.js +8 -0
  243. package/dist/src/voice/realtime/agentBroker.js +1 -1
  244. package/dist/src/voice/realtime/agentEngine.js +1 -1
  245. package/dist/src/voice/realtime/pcm-output-gain.d.ts +2 -0
  246. package/dist/src/voice/realtime/pcm-output-gain.js +16 -0
  247. package/dist/src/voice/realtime/runtime.d.ts +1 -0
  248. package/dist/src/voice/realtime/runtime.js +21 -3
  249. package/dist/src/voice/realtime/runtime.types.d.ts +1 -0
  250. package/dist/src/workflows/service/workflow-run-service.js +3 -1
  251. package/dist/src/workflows/service/workflow-session-bridge.d.ts +1 -0
  252. package/dist/src/workflows/service/workflow-session-bridge.js +1 -0
  253. package/package.json +4 -4
  254. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-qKCezlBg.js +0 -1
  255. package/dist/gateway/static/root/assets/agents-BMhnZKhP.js +0 -1
  256. package/dist/gateway/static/root/assets/apps-page-DduJDWGY.js +0 -1
  257. package/dist/gateway/static/root/assets/automations-workspace-X7hNHCjW.js +0 -6
  258. package/dist/gateway/static/root/assets/browser-settings-page-BZ7nK_pN.js +0 -8
  259. package/dist/gateway/static/root/assets/capabilities-settings-panel-BfKvJO1C.js +0 -7
  260. package/dist/gateway/static/root/assets/channels-settings-D1UDxJuA.js +0 -1
  261. package/dist/gateway/static/root/assets/connectors-page-C2nuqs_O.js +0 -2
  262. package/dist/gateway/static/root/assets/cron-expression-DlyRIyUn.js +0 -2
  263. package/dist/gateway/static/root/assets/date-picker-CU-ij_yE.js +0 -1
  264. package/dist/gateway/static/root/assets/extension-settings-page-CMyt0A32.js +0 -1
  265. package/dist/gateway/static/root/assets/gateway-settings-ogv8ZbvG.js +0 -1
  266. package/dist/gateway/static/root/assets/heartbeat-settings-BnrMRKaZ.js +0 -1
  267. package/dist/gateway/static/root/assets/home-page-CbcJCREd.js +0 -1
  268. package/dist/gateway/static/root/assets/index-7PZ6jmhy.css +0 -2
  269. package/dist/gateway/static/root/assets/index-CfyyA9-g.js +0 -74
  270. package/dist/gateway/static/root/assets/local-app-workbench-page-D5XVZnK1.js +0 -2
  271. package/dist/gateway/static/root/assets/locale-store-BQ2HKTWb.js +0 -1
  272. package/dist/gateway/static/root/assets/logs-page-CWDU1AGN.js +0 -2
  273. package/dist/gateway/static/root/assets/management-settings-CuFNgQUy.js +0 -1
  274. package/dist/gateway/static/root/assets/mobile-pairing-wizard-C7d_ztgp.js +0 -1
  275. package/dist/gateway/static/root/assets/note-detail-panel-D5JuBLyt.js +0 -5
  276. package/dist/gateway/static/root/assets/notes-page-C5-ccCi4.js +0 -8
  277. package/dist/gateway/static/root/assets/popover-select-CKBYnT3c.js +0 -1
  278. package/dist/gateway/static/root/assets/proactive-page-fHjPigmx.js +0 -1
  279. package/dist/gateway/static/root/assets/project-detail-page-6v_khvEt.js +0 -1
  280. package/dist/gateway/static/root/assets/projects-page-CCy1aK4V.js +0 -1
  281. package/dist/gateway/static/root/assets/remote-access-hub-pkqKRnch.js +0 -1
  282. package/dist/gateway/static/root/assets/sessions-page-Cr4E4cap.js +0 -1
  283. package/dist/gateway/static/root/assets/settings-advanced-gate-D1JRDRyL.js +0 -1
  284. package/dist/gateway/static/root/assets/setup-status-panel-Cc_iP_vv.js +0 -1
  285. package/dist/gateway/static/root/assets/shares-settings-BrMECMAB.js +0 -1
  286. package/dist/gateway/static/root/assets/skill-reload-api-DuqIDYjc.js +0 -1
  287. package/dist/gateway/static/root/assets/skills-page.utils-D1wGfm22.js +0 -1
  288. package/dist/gateway/static/root/assets/task-detail-page-m0oXUKl2.js +0 -1
  289. package/dist/gateway/static/root/assets/tunnel-api-Dur80zSQ.js +0 -1
  290. package/dist/gateway/static/root/assets/user-model-page-Dl10D_5q.js +0 -2
  291. package/dist/gateway/static/root/assets/workflows-page-CswgoIFU.js +0 -6
  292. package/dist/src/proactive/actions/workflow.d.ts +0 -15
  293. package/dist/src/proactive/actions/workflow.js +0 -88
@@ -1 +0,0 @@
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,h as a,t as o}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a as s,i as c,o as l,r as u,s as d,t as f}from"./dist-CpzYSoz7.js";import{t as p}from"./check-DUBLcKHA.js";import{t as m}from"./copy-Dv6d4Dvw.js";import{t as h}from"./external-link-DjqjBmc3.js";import{t as g}from"./globe-DSSGFWFn.js";import{t as _}from"./loader-circle-CifKLtgG.js";import{t as v}from"./copy-to-clipboard-HOJ79TWv.js";import{t as y}from"./messages-BRjoarIr.js";import{n as b,s as x}from"./locale-store-BQ2HKTWb.js";import{t as S}from"./cn-JdwAhgNB.js";import{i as C}from"./vendor-swr-BIWyz7Rc.js";import{t as w}from"./button-B11EPpor.js";import{n as T,r as E}from"./gateway-config-swr-bjzk_4hn.js";import{i as D,o as O}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{B as k,Bc as A,Gi as j,Ot as M,R as N,St as P,Ta as F,Tc as I,Us as L,ac as R,fu as z,iu as B,ju as V,ki as H,mo as U,mu as W,pc as G,pl as ee,qs as K,sc as te,wt as ne,xt as re,z as ie}from"./index-CfyyA9-g.js";import{n as q,r as J,t as ae}from"./settings-page-layout-DYelDcMV.js";import{a as oe,c as se,d as Y,g as ce,i as le,l as ue,n as de,o as fe,r as pe,s as me,t as he,u as ge}from"./tunnel-api-Dur80zSQ.js";import{n as X,r as _e,t as ve}from"./settings-form-section-Cem6L49Y.js";import{t as ye}from"./page-tabs-BfV-PQa5.js";import{t as be}from"./settings-advanced-gate-D1JRDRyL.js";var Z=e(t(),1),Q=n(),$=r();function xe(e){switch(e){case`active`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`connecting`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;default:return`bg-surface-hover text-fg-muted`}}function Se(e){let t=(0,Q.c)(5),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=S(`rounded-full px-2 py-0.5 text-[11px] font-medium`,xe(r)),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,$.jsx)(`span`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function Ce(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=b(Te),i;t[0]===r?i=t[1]:(i=y(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!x(we),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=C(o?`exposure-status`:null,ge,s),l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},t[3]=l):l=t[3];let{data:u}=C(o?`tunnel-status`:null,he,l),d=E(o);if(!o)return null;let f=c?.tailscale.active===!0,p=u?.state,m=u?.enabled&&p===`connected`,h=u?.enabled&&(p===`connecting`||p===`reconnecting`||!!u?.startProgress||!!u?.frpcDownload),_=d.data?.payload?.config,v=!!(_&&typeof _==`object`&&!Array.isArray(_)&&_.gateway?.publicUrl),w=f?`active`:`off`,T=f?a.statusActive:a.statusOff,D;t[4]!==a.tailscaleCardTitle||t[5]!==w||t[6]!==T?(D={tab:`tailscale`,icon:g,title:a.tailscaleCardTitle,kind:w,statusLabel:T},t[4]=a.tailscaleCardTitle,t[5]=w,t[6]=T,t[7]=D):D=t[7];let O=m?`active`:h?`connecting`:`off`,k=m?a.statusActive:h?a.statusConnecting:a.statusOff,j;t[8]!==a.publicCardTitle||t[9]!==O||t[10]!==k?(j={tab:`public`,icon:A,title:a.publicCardTitle,kind:O,statusLabel:k},t[8]=a.publicCardTitle,t[9]=O,t[10]=k,t[11]=j):j=t[11];let M=v?`active`:`off`,N=v?a.statusActive:a.statusOff,P;t[12]!==a.reverseProxyCardTitle||t[13]!==M||t[14]!==N?(P={tab:`reverse-proxy`,icon:te,title:a.reverseProxyCardTitle,kind:M,statusLabel:N},t[12]=a.reverseProxyCardTitle,t[13]=M,t[14]=N,t[15]=P):P=t[15];let F;t[16]!==a.sshCardStatus||t[17]!==a.sshCardTitle?(F={tab:`ssh`,icon:K,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[16]=a.sshCardStatus,t[17]=a.sshCardTitle,t[18]=F):F=t[18];let I;t[19]!==a.lanCardStatus||t[20]!==a.lanCardTitle?(I={tab:`lan`,icon:G,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[19]=a.lanCardStatus,t[20]=a.lanCardTitle,t[21]=I):I=t[21];let L;t[22]!==P||t[23]!==F||t[24]!==I||t[25]!==D||t[26]!==j?(L=[D,j,P,F,I],t[22]=P,t[23]=F,t[24]=I,t[25]=D,t[26]=j,t[27]=L):L=t[27];let R=L,z;return t[28]!==R||t[29]!==n?(z=(0,$.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:R.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:S(`flex items-start gap-3 rounded-xl bg-surface-base px-3 py-2.5 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/50`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(Se,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=R,t[29]=n,t[30]=z):z=t[30],z}function we(e){return e.token}function Te(e){return e.language}function Ee(e){let t=(0,Q.c)(26),{title:n,description:r,recommended:i,icon:a,onOpen:o,openLabel:s,recommendedLabel:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=S(`group flex w-full flex-col rounded-2xl bg-surface-base p-4 text-left transition-colors`,`hover:bg-surface-hover/40`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=l):l=t[0];let u;t[1]===a?u=t[2]:(u=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,children:(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=a,t[2]=u);let d;t[3]===n?d=t[4]:(d=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=d);let f;t[5]!==i||t[6]!==c?(f=i&&c?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:c}):null,t[5]=i,t[6]=c,t[7]=f):f=t[7];let p;t[8]!==d||t[9]!==f?(p=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10];let m;t[11]===r?m=t[12]:(m=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[p,m]}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(z,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[16]=g):g=t[16];let _;t[17]!==u||t[18]!==h?(_=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[u,h,g]}),t[17]=u,t[18]=h,t[19]=_):_=t[19];let v;t[20]===s?v=t[21]:(v=(0,$.jsx)(`span`,{className:`mt-3 text-xs font-medium text-accent`,children:s}),t[20]=s,t[21]=v);let y;return t[22]!==o||t[23]!==v||t[24]!==_?(y=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:l,children:[_,v]}),t[22]=o,t[23]=v,t[24]=_,t[25]=y):y=t[25],y}function De(e){let t=(0,Q.c)(83),{onOpenTab:n}=e,r=b(Ae),i;t[0]===r?i=t[1]:(i=y(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!x(ke),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:l}=C(s?`exposure-status`:null,ge,c),u;t[3]===l?.conflicts?u=t[4]:(u=l?.conflicts??[],t[3]=l?.conflicts,t[4]=u);let d=u;if(!s){let e;return t[5]===o.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.needToken}),t[5]=o.needToken,t[6]=e),e}let f;t[7]===n?f=t[8]:(f=(0,$.jsx)(Ce,{onOpenTab:n}),t[7]=n,t[8]=f);let p;t[9]!==d||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(p=d.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:o.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:o.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:d.map(Oe)})]}):null,t[9]=d,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=p):p=t[12];let m;t[13]===o.pickMethod?m=t[14]:(m=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=m);let h;t[15]===n?h=t[16]:(h=()=>n(`tailscale`),t[15]=n,t[16]=h);let _;t[17]!==o.configure||t[18]!==o.recommended||t[19]!==o.tailscaleCardDesc||t[20]!==o.tailscaleCardTitle||t[21]!==h?(_=(0,$.jsx)(Ee,{icon:g,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,openLabel:o.configure,onOpen:h}),t[17]=o.configure,t[18]=o.recommended,t[19]=o.tailscaleCardDesc,t[20]=o.tailscaleCardTitle,t[21]=h,t[22]=_):_=t[22];let v;t[23]===n?v=t[24]:(v=()=>n(`public`),t[23]=n,t[24]=v);let S;t[25]!==o.configure||t[26]!==o.publicCardDesc||t[27]!==o.publicCardTitle||t[28]!==v?(S=(0,$.jsx)(Ee,{icon:A,title:o.publicCardTitle,description:o.publicCardDesc,openLabel:o.configure,onOpen:v}),t[25]=o.configure,t[26]=o.publicCardDesc,t[27]=o.publicCardTitle,t[28]=v,t[29]=S):S=t[29];let w;t[30]===n?w=t[31]:(w=()=>n(`reverse-proxy`),t[30]=n,t[31]=w);let T;t[32]!==o.configure||t[33]!==o.reverseProxyCardDesc||t[34]!==o.reverseProxyCardTitle||t[35]!==w?(T=(0,$.jsx)(Ee,{icon:te,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,openLabel:o.configure,onOpen:w}),t[32]=o.configure,t[33]=o.reverseProxyCardDesc,t[34]=o.reverseProxyCardTitle,t[35]=w,t[36]=T):T=t[36];let E;t[37]===n?E=t[38]:(E=()=>n(`ssh`),t[37]=n,t[38]=E);let D;t[39]!==o.configure||t[40]!==o.sshCardDesc||t[41]!==o.sshCardTitle||t[42]!==E?(D=(0,$.jsx)(Ee,{icon:K,title:o.sshCardTitle,description:o.sshCardDesc,openLabel:o.configure,onOpen:E}),t[39]=o.configure,t[40]=o.sshCardDesc,t[41]=o.sshCardTitle,t[42]=E,t[43]=D):D=t[43];let O;t[44]===n?O=t[45]:(O=()=>n(`lan`),t[44]=n,t[45]=O);let k;t[46]!==o.configure||t[47]!==o.lanCardDesc||t[48]!==o.lanCardTitle||t[49]!==O?(k=(0,$.jsx)(Ee,{icon:G,title:o.lanCardTitle,description:o.lanCardDesc,openLabel:o.configure,onOpen:O}),t[46]=o.configure,t[47]=o.lanCardDesc,t[48]=o.lanCardTitle,t[49]=O,t[50]=k):k=t[50];let j;t[51]!==S||t[52]!==T||t[53]!==D||t[54]!==k||t[55]!==_?(j=(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:[_,S,T,D,k]}),t[51]=S,t[52]=T,t[53]=D,t[54]=k,t[55]=_,t[56]=j):j=t[56];let M;t[57]!==j||t[58]!==m?(M=(0,$.jsxs)(`div`,{children:[m,j]}),t[57]=j,t[58]=m,t[59]=M):M=t[59];let N;t[60]===o.oneAtATimeHint?N=t[61]:(N=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[60]=o.oneAtATimeHint,t[61]=N);let P;t[62]===a.advanced.proxyTitle?P=t[63]:(P=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[62]=a.advanced.proxyTitle,t[63]=P);let F;t[64]===a.advanced.proxyBody?F=t[65]:(F=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[64]=a.advanced.proxyBody,t[65]=F);let I;t[66]!==r||t[67]!==a.advanced.proxyDocs?(I=(0,$.jsx)(Y,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[66]=r,t[67]=a.advanced.proxyDocs,t[68]=I):I=t[68];let L;t[69]!==P||t[70]!==F||t[71]!==I?(L=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-4 py-3`,children:[P,F,I]}),t[69]=P,t[70]=F,t[71]=I,t[72]=L):L=t[72];let R;t[73]!==o.docsLink||t[74]!==r?(R=(0,$.jsx)(Y,{language:r,label:o.docsLink}),t[73]=o.docsLink,t[74]=r,t[75]=R):R=t[75];let z;return t[76]!==M||t[77]!==N||t[78]!==L||t[79]!==R||t[80]!==f||t[81]!==p?(z=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[f,p,M,N,L,R]}),t[76]=M,t[77]=N,t[78]=L,t[79]=R,t[80]=f,t[81]=p,t[82]=z):z=t[82],z}function Oe(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function ke(e){return e.token}function Ae(e){return e.language}function je(){let e=(0,Q.c)(16),t=b(Me),n;e[0]===t?n=e[1]:(n=y(t),e[0]=t,e[1]=n);let r=n.remoteAccess.lan,i;e[2]!==r.subtitle||e[3]!==r.title?(i=(0,$.jsx)(X,{icon:G,title:r.title,subtitle:r.subtitle}),e[2]=r.subtitle,e[3]=r.title,e[4]=i):i=e[4];let a;e[5]===r.body?a=e[6]:(a=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.body}),e[5]=r.body,e[6]=a);let s;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),e[7]=s):s=e[7];let c;e[8]===r.link?c=e[9]:(c=(0,$.jsxs)(o,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[r.link,s]}),e[8]=r.link,e[9]=c);let l;e[10]!==a||e[11]!==c?(l=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[a,c]}),e[10]=a,e[11]=c,e[12]=l):l=e[12];let u;return e[13]!==i||e[14]!==l?(u=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(ve,{children:[i,l]})}),e[13]=i,e[14]=l,e[15]=u):u=e[15],u}function Me(e){return e.language}function Ne(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=b(Pe),a;t[0]===i?a=t[1]:(a=y(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[s,c]=(0,Z.useState)(!1),l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=async()=>{await v(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(c(!0),setTimeout(()=>c(!1),2e3))},t[2]=l):l=t[2];let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg border border-edge bg-surface px-3 py-2 text-xs text-fg-muted`,children:`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`}),t[3]=d):d=t[3];let f,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>void u(),p=(0,$.jsx)(m,{className:`mr-1 size-4`}),t[4]=f,t[5]=p):(f=t[4],p=t[5]);let h=s?o.copied:o.copy,g;t[6]===h?g=t[7]:(g=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(w,{type:`button`,variant:`ghost`,onClick:f,children:[p,h]})}),t[6]=h,t[7]=g);let _;t[8]!==r||t[9]!==o.hint?(_=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:o.hint}):null,t[8]=r,t[9]=o.hint,t[10]=_):_=t[10];let x;t[11]!==g||t[12]!==_?(x=(0,$.jsxs)($.Fragment,{children:[d,g,_]}),t[11]=g,t[12]=_,t[13]=x):x=t[13];let S=x;if(r){let e;t[14]!==o.subtitle||t[15]!==o.title?(e=(0,$.jsx)(X,{icon:K,title:o.title,subtitle:o.subtitle}),t[14]=o.subtitle,t[15]=o.title,t[16]=e):e=t[16];let n;t[17]===S?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:S}),t[17]=S,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(ve,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let C;t[22]!==o.subtitle||t[23]!==o.title?(C=(0,$.jsx)(X,{icon:K,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=C):C=t[24];let T;t[25]===S?T=t[26]:(T=(0,$.jsx)(`div`,{className:`mt-4`,children:S}),t[25]=S,t[26]=T);let E;return t[27]!==C||t[28]!==T?(E=(0,$.jsxs)(ve,{children:[C,T]}),t[27]=C,t[28]=T,t[29]=E):E=t[29],E}function Pe(e){return e.language}function Fe(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Ne,{embedded:!0}),e[0]=t):t=e[0],t}var Ie=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Le(e){return e&&Ie.includes(e)?e:`guide`}function Re(e){let t=(0,Q.c)(32),{showLabel:n,hideLabel:r,icon:i,hint:a,children:o,className:s,defaultOpen:c,advancedOnly:l}=e,u=l===void 0?!1:l,[d,f]=(0,Z.useState)(c??!1),p;t[0]===s?p=t[1]:(p=S(`rounded-2xl bg-surface-base`,s),t[0]=s,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>f(ze),t[2]=m):m=t[2];let h=d&&`rotate-180`,g;t[3]===h?g=t[4]:(g=S(`size-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,h),t[3]=h,t[4]=g);let _;t[5]===g?_=t[6]:(_=(0,$.jsx)(W,{className:g,"aria-hidden":!0}),t[5]=g,t[6]=_);let v;t[7]===i?v=t[8]:(v=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[7]=i,t[8]=v);let y=d?r:n,b;t[9]===y?b=t[10]:(b=(0,$.jsx)(`span`,{children:y}),t[9]=y,t[10]=b);let x;t[11]!==d||t[12]!==_||t[13]!==v||t[14]!==b?(x=(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:m,className:`flex w-full items-center gap-2 rounded-2xl px-4 py-3.5 text-left text-sm font-medium text-fg transition-colors hover:text-fg`,children:[_,v,b]}),t[11]=d,t[12]=_,t[13]=v,t[14]=b,t[15]=x):x=t[15];let C=d?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`,w;t[16]===C?w=t[17]:(w=S(`grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none`,C),t[16]=C,t[17]=w);let T;t[18]===a?T=t[19]:(T=a?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[18]=a,t[19]=T);let E;t[20]!==o||t[21]!==T?(E=(0,$.jsx)(`div`,{className:`overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[T,o]})}),t[20]=o,t[21]=T,t[22]=E):E=t[22];let D;t[23]!==w||t[24]!==E?(D=(0,$.jsx)(`div`,{className:w,children:E}),t[23]=w,t[24]=E,t[25]=D):D=t[25];let O;t[26]!==x||t[27]!==D||t[28]!==p?(O=(0,$.jsxs)(`section`,{className:p,children:[x,D]}),t[26]=x,t[27]=D,t[28]=p,t[29]=O):O=t[29];let k=O;if(u){let e;return t[30]===k?e=t[31]:(e=(0,$.jsx)(be,{children:k}),t[30]=k,t[31]=e),e}return k}function ze(e){return!e}function Be(e){let t=(0,Q.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:p,cancelLabel:m,onConfirm:h,onCancel:g}=e,[_,v]=(0,Z.useState)(!1),y;t[0]===g?y=t[1]:(y=e=>{e||(v(!1),g())},t[0]=g,t[1]=y);let b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(s,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,O)}),t[2]=b):b=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=S(`fixed left-1/2 top-1/2 max-h-[min(90vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`,D),t[3]=x):x=t[3];let C;t[4]===r?C=t[5]:(C=(0,$.jsx)(d,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=C);let T;t[6]===i?T=t[7]:(T=(0,$.jsx)(c,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=T);let E;t[8]===a?E=t[9]:(E=a.map(Ve),t[8]=a,t[9]=E);let k;t[10]===E?k=t[11]:(k=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:E}),t[10]=E,t[11]=k);let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>v(e.target.checked),t[12]=A):A=t[12];let j;t[13]===_?j=t[14]:(j=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:_,onChange:A}),t[13]=_,t[14]=j);let M;t[15]===o?M=t[16]:(M=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=M);let N;t[17]!==M||t[18]!==j?(N=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[j,M]}),t[17]=M,t[18]=j,t[19]=N):N=t[19];let P;t[20]!==m||t[21]!==g?(P=(0,$.jsx)(w,{type:`button`,variant:`secondary`,onClick:g,children:m}),t[20]=m,t[21]=g,t[22]=P):P=t[22];let F=!_,I;t[23]!==p||t[24]!==h||t[25]!==F?(I=(0,$.jsx)(w,{type:`button`,disabled:F,onClick:h,children:p}),t[23]=p,t[24]=h,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==P||t[28]!==I?(L=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[P,I]}),t[27]=P,t[28]=I,t[29]=L):L=t[29];let R;t[30]!==N||t[31]!==L||t[32]!==C||t[33]!==T||t[34]!==k?(R=(0,$.jsxs)(l,{children:[b,(0,$.jsxs)(u,{className:x,onOpenAutoFocus:He,children:[C,T,k,N,L]})]}),t[30]=N,t[31]=L,t[32]=C,t[33]=T,t[34]=k,t[35]=R):R=t[35];let z;return t[36]!==n||t[37]!==y||t[38]!==R?(z=(0,$.jsx)(f,{open:n,onOpenChange:y,children:R}),t[36]=n,t[37]=y,t[38]=R,t[39]=z):z=t[39],z}function Ve(e){return(0,$.jsx)(`li`,{children:e},e)}function He(e){return e.preventDefault()}function Ue(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var We=[`preparing_frpc`,`registering`,`starting_frpc`];function Ge(e){return e?e===`reconnecting_frpc`?We.indexOf(`starting_frpc`):We.indexOf(e):-1}function Ke(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=We.indexOf(e),i=Ge(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function qe(e,t,n){let r=n.startProgress;return Ke(t,n)===`active`?t===`preparing_frpc`&&n.frpcDownload?n.frpcDownload.phase===`extracting`?e.frpcExtracting:n.frpcDownload.percent==null?e.frpcDownloading:e.frpcDownloadingPercent.replace(`{{percent}}`,String(n.frpcDownload.percent)):t===`registering`&&r?.publicUrl?e.stepRegisterDetail:t===`starting_frpc`?r?.phase===`reconnecting_frpc`?e.stepReconnectDetail:e.stepFrpcDetail:null:null}function Je(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function Ye(e){if(!e)return null;let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function Xe(e){let t=(0,Q.c)(31),{status:n,t:r}=e,[,i]=(0,Z.useState)(0),a;t[0]!==i||t[1]!==n.state?(a=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>i(Ze),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let o=n.startProgress?.startedAt,s;if(t[3]!==n.state||t[4]!==o?(s=[n.state,o],t[3]=n.state,t[4]=o,t[5]=s):s=t[5],(0,Z.useEffect)(a,s),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let c,l,u,d,f;if(t[6]!==n||t[7]!==r){let e=Ye(n.startProgress?.startedAt);c=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,l=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`;let i;t[13]===r.startProgressTitle?i=t[14]:(i=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=i);let a;t[15]===r.startProgressHint?a=t[16]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=a),t[17]!==i||t[18]!==a?(u=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=u):u=t[19];let o=We.map(e=>{let t=Ke(e,n),i=qe(r,e,n);return(0,$.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-subtle`,"aria-hidden":!0,children:t===`done`?(0,$.jsx)(p,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(_,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(B,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:S(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:Je(r,e)}),i?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload&&n.frpcDownload.phase===`downloading`?(0,$.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,$.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-panel`,children:(0,$.jsx)(`div`,{className:S(`h-full rounded-full bg-accent transition-[width] duration-300`,n.frpcDownload.percent==null&&`w-1/3 animate-pulse`),style:n.frpcDownload.percent==null?void 0:{width:`${n.frpcDownload.percent}%`}})}),n.frpcDownload.bytesReceived!=null&&n.frpcDownload.totalBytes?(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[Ue(n.frpcDownload.bytesReceived),` /`,` `,Ue(n.frpcDownload.totalBytes)]}):null]}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload?.url?(0,$.jsxs)(`p`,{className:`mt-2 text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`font-sans`,children:[r.frpcDownloadingUrlLabel,`: `]}),(0,$.jsx)(`a`,{href:n.frpcDownload.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all font-mono text-[11px] text-accent hover:underline`,children:n.frpcDownload.url})]}):null]})]},e)});t[20]===o?d=t[21]:(d=(0,$.jsx)(`ol`,{className:`space-y-2`,children:o}),t[20]=o,t[21]=d),f=e&&n.startProgress?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.startProgressElapsed.replace(`{{elapsed}}`,e)}):null,t[6]=n,t[7]=r,t[8]=c,t[9]=l,t[10]=u,t[11]=d,t[12]=f}else c=t[8],l=t[9],u=t[10],d=t[11],f=t[12];let m;t[22]!==c||t[23]!==r.publicUrlPendingNotice?(m=c?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=c,t[23]=r.publicUrlPendingNotice,t[24]=m):m=t[24];let h;return t[25]!==l||t[26]!==u||t[27]!==d||t[28]!==f||t[29]!==m?(h=(0,$.jsxs)(`div`,{className:l,children:[u,d,f,m]}),t[25]=l,t[26]=u,t[27]=d,t[28]=f,t[29]=m,t[30]=h):h=t[30],h}function Ze(e){return e+1}function Qe(e,t){return t.state===`connected`?e.statusConnected:t.state===`error`?e.statusError:t.startProgress?.phase===`reconnecting_frpc`?e.statusReconnecting:t.startProgress?.phase===`starting_frpc`?e.statusStartingFrpc:t.startProgress?.phase===`registering`?e.statusRegistering:t.startProgress?.phase===`preparing_frpc`||t.frpcDownload?e.statusPreparingFrpc:t.state===`connecting`||t.state===`reconnecting`?e.statusConnecting:e.statusOff}function $e(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function et(e){switch(e){case`connected`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`progress`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;case`error`:return`bg-red-500/15 text-red-700 dark:text-red-400`;default:return`bg-surface-hover text-fg-muted`}}function tt(e){if(!e)return`—`;let t=Date.now()-new Date(e).getTime();if(t<0)return`—`;let n=Math.floor(t/6e4);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function nt(e){let t=(0,Q.c)(61),{t:n,status:r,isLoading:i,statusErr:a,starting:o,stopping:s,showConsentExpired:c,copyLabels:l,startDisabled:u,startDisabledReason:d,stepLabel:f,onStart:p,onStop:m}=e,h=u===void 0?!1:u,v,y,b,x,C,T,E;t[0]!==r||t[1]!==o?(E=$e(r),v=r.enabled||o,y=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=S(_e(),`space-y-4`),t[9]=T):T=t[9],C=`flex flex-wrap items-start justify-between gap-3`,x=`flex items-center gap-2`,b=S(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,et(E)),t[0]=r,t[1]=o,t[2]=v,t[3]=y,t[4]=b,t[5]=x,t[6]=C,t[7]=T,t[8]=E):(v=t[2],y=t[3],b=t[4],x=t[5],C=t[6],T=t[7],E=t[8]);let D=E===`connected`&&`bg-emerald-500`,O=E===`progress`&&`bg-amber-500 animate-pulse`,k=E===`error`&&`bg-red-500`,A=E===`off`&&`bg-fg-subtle`,j;t[10]!==D||t[11]!==O||t[12]!==k||t[13]!==A?(j=S(`size-1.5 rounded-full`,D,O,k,A),t[10]=D,t[11]=O,t[12]=k,t[13]=A,t[14]=j):j=t[14];let M;t[15]===j?M=t[16]:(M=(0,$.jsx)(`span`,{className:j,"aria-hidden":!0}),t[15]=j,t[16]=M);let N;t[17]!==i||t[18]!==r||t[19]!==n?(N=i&&!r.enabled?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-3 w-16 animate-pulse rounded-full bg-surface-hover/70 motion-reduce:animate-none`}):Qe(n,r),t[17]=i,t[18]=r,t[19]=n,t[20]=N):N=t[20];let P;t[21]!==M||t[22]!==N||t[23]!==b?(P=(0,$.jsxs)(`span`,{className:b,children:[M,N]}),t[21]=M,t[22]=N,t[23]=b,t[24]=P):P=t[24];let F;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(F=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,tt(r.connectedSince)]}):null,t[25]=r.connectedSince,t[26]=r.state,t[27]=n.uptime,t[28]=F):F=t[28];let R;t[29]!==P||t[30]!==F||t[31]!==x?(R=(0,$.jsxs)(`div`,{className:x,children:[P,F]}),t[29]=P,t[30]=F,t[31]=x,t[32]=R):R=t[32];let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(g,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=z):z=t[33];let B;t[34]!==R||t[35]!==C?(B=(0,$.jsxs)(`div`,{className:C,children:[R,z]}),t[34]=R,t[35]=C,t[36]=B):B=t[36];let V;t[37]===a?V=t[38]:(V=a?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a instanceof Error?a.message:String(a)}):null,t[37]=a,t[38]=V);let U;t[39]!==c||t[40]!==n.consentExpiredBanner?(U=c?(0,$.jsx)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[39]=c,t[40]=n.consentExpiredBanner,t[41]=U):U=t[41];let W;t[42]!==v||t[43]!==l||t[44]!==p||t[45]!==m||t[46]!==y||t[47]!==r||t[48]!==h||t[49]!==d||t[50]!==o||t[51]!==f||t[52]!==s||t[53]!==n?(W=v?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,$.jsx)(H,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,y?(0,$.jsx)(Xe,{status:r,t:n}):null,r.lastError&&r.state===`error`?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:r.lastError}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.enabled?(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:s,onClick:m,children:[s?(0,$.jsx)(_,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(w,{type:`button`,disabled:o,onClick:p,children:[o?(0,$.jsx)(_,{className:`size-4 animate-spin`}):(0,$.jsx)(I,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[f?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:f}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.emptyStateTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.emptyStateBody})]}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(L,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),h&&d?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:d}):null,(0,$.jsxs)(w,{type:`button`,disabled:o||h,onClick:p,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(_,{className:`size-4 animate-spin`}):(0,$.jsx)(I,{className:`size-4`}),n.start]})]}),t[42]=v,t[43]=l,t[44]=p,t[45]=m,t[46]=y,t[47]=r,t[48]=h,t[49]=d,t[50]=o,t[51]=f,t[52]=s,t[53]=n,t[54]=W):W=t[54];let G;return t[55]!==B||t[56]!==V||t[57]!==U||t[58]!==W||t[59]!==T?(G=(0,$.jsxs)(`section`,{className:T,children:[B,V,U,W]}),t[55]=B,t[56]=V,t[57]=U,t[58]=W,t[59]=T,t[60]=G):G=t[60],G}var rt=`https://console.xopc.ai/access/client`,it={reconfiguring:!1};function at(e){let t=(0,Q.c)(89),{t:n,brokerSecretReady:r,brokerSecretConfiguredInConfig:i,brokerSecretMaskedValue:a,brokerSecretDraft:o,savingBrokerSecret:s,authorizingBrokerSecret:c,brokerSecretAuthorizationUrl:l,brokerSecretNotice:u,copyFailedLabel:d,onDraftChange:f,onSave:m,onAuthorize:g,onClear:v,sectionRef:y}=e,b=(0,Z.useId)(),x=r,C=!x,[T,E]=(0,Z.useReducer)(F,it),{reconfiguring:D}=T,O;t[0]!==i||t[1]!==o||t[2]!==D?(O=i&&!D&&!o.trim(),t[0]=i,t[1]=o,t[2]=D,t[3]=O):O=t[3];let k=O,A;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(A={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[4]=n.copied,t[5]=n.copyKey,t[6]=n.hideKey,t[7]=n.showKey,t[8]=A):A=t[8];let j=A,N;t[9]===o?N=t[10]:(N=o.trim().length>0&&!M(o.trim()),t[9]=o,t[10]=N);let P=N,I;t[11]===f?I=t[12]:(I=()=>{E({type:`patch`,patch:{reconfiguring:!1}}),f(``)},t[11]=f,t[12]=I);let L=I,R=C&&`ring-1 ring-amber-500/30`,z;t[13]===R?z=t[14]:(z=S(R),t[13]=R,t[14]=z);let B=x?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:C?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,V;t[15]===B?V=t[16]:(V=S(`flex size-9 shrink-0 items-center justify-center rounded-lg`,B),t[15]=B,t[16]=V);let H;t[17]===x?H=t[18]:(H=x?(0,$.jsx)(p,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(ee,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=x,t[18]=H);let W;t[19]!==V||t[20]!==H?(W=(0,$.jsx)(`span`,{className:V,children:H}),t[19]=V,t[20]=H,t[21]=W):W=t[21];let G=x?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,K;t[22]===G?K=t[23]:(K=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:G}),t[22]=G,t[23]=K);let te=x?n.brokerSecretReadyHint:n.brokerSecretHint,ne;t[24]===te?ne=t[25]:(ne=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:te}),t[24]=te,t[25]=ne);let re;t[26]!==C||t[27]!==n.brokerSecretMissingHint?(re=C?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[26]=C,t[27]=n.brokerSecretMissingHint,t[28]=re):re=t[28];let ie;t[29]!==K||t[30]!==ne||t[31]!==re?(ie=(0,$.jsxs)(`div`,{children:[K,ne,re]}),t[29]=K,t[30]=ne,t[31]=re,t[32]=ie):ie=t[32];let q;t[33]!==c||t[34]!==C||t[35]!==g||t[36]!==D||t[37]!==s||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(q=C||D?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(w,{type:`button`,disabled:s||c,onClick:g,children:[c?(0,$.jsx)(_,{className:`size-4 animate-spin`}):null,c?n.brokerSecretAuthorizing:n.brokerSecretAuthorize]}),(0,$.jsxs)(`a`,{href:rt,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n.brokerSecretConsoleLink,(0,$.jsx)(h,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=c,t[34]=C,t[35]=g,t[36]=D,t[37]=s,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=q):q=t[41];let J;t[42]!==c||t[43]!==l||t[44]!==n.brokerSecretOpenAuthorization?(J=c&&l?(0,$.jsxs)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.brokerSecretOpenAuthorization,(0,$.jsx)(h,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=c,t[43]=l,t[44]=n.brokerSecretOpenAuthorization,t[45]=J):J=t[45];let ae;t[46]!==i||t[47]!==o||t[48]!==a||t[49]!==P||t[50]!==L||t[51]!==d||t[52]!==b||t[53]!==C||t[54]!==v||t[55]!==f||t[56]!==m||t[57]!==D||t[58]!==s||t[59]!==j||t[60]!==k||t[61]!==n.brokerSecretCancelReconfigure||t[62]!==n.brokerSecretClear||t[63]!==n.brokerSecretMaskedHelp||t[64]!==n.brokerSecretNotInConfigFile||t[65]!==n.brokerSecretPlaceholder||t[66]!==n.brokerSecretReconfigure||t[67]!==n.brokerSecretRevealFailed||t[68]!==n.brokerSecretSave||t[69]!==n.brokerSecretSaveAndContinue||t[70]!==n.brokerSecretTitle?(ae=k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:b,children:n.brokerSecretTitle}),(0,$.jsx)(U,{id:b,value:a,labels:j,reveal:ot,loadFailedLabel:d||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(w,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>{E({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:s,onClick:v,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:b,children:n.brokerSecretTitle}),(0,$.jsx)(U,{id:b,value:o,onChange:f,placeholder:n.brokerSecretPlaceholder,labels:j,disabled:s}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(w,{type:`button`,disabled:s||!P,onClick:m,children:[s?(0,$.jsx)(_,{className:`size-4 animate-spin`}):null,C?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:s,onClick:v,children:n.brokerSecretClear}):null,D?(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:s,onClick:L,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=o,t[48]=a,t[49]=P,t[50]=L,t[51]=d,t[52]=b,t[53]=C,t[54]=v,t[55]=f,t[56]=m,t[57]=D,t[58]=s,t[59]=j,t[60]=k,t[61]=n.brokerSecretCancelReconfigure,t[62]=n.brokerSecretClear,t[63]=n.brokerSecretMaskedHelp,t[64]=n.brokerSecretNotInConfigFile,t[65]=n.brokerSecretPlaceholder,t[66]=n.brokerSecretReconfigure,t[67]=n.brokerSecretRevealFailed,t[68]=n.brokerSecretSave,t[69]=n.brokerSecretSaveAndContinue,t[70]=n.brokerSecretTitle,t[71]=ae):ae=t[71];let oe;t[72]===u?oe=t[73]:(oe=u?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:u}):null,t[72]=u,t[73]=oe);let se;t[74]!==ie||t[75]!==q||t[76]!==J||t[77]!==ae||t[78]!==oe?(se=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[ie,q,J,ae,oe]}),t[74]=ie,t[75]=q,t[76]=J,t[77]=ae,t[78]=oe,t[79]=se):se=t[79];let Y;t[80]!==W||t[81]!==se?(Y=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[W,se]}),t[80]=W,t[81]=se,t[82]=Y):Y=t[82];let ce;t[83]!==Y||t[84]!==z?(ce=(0,$.jsx)(ve,{className:z,children:Y}),t[83]=Y,t[84]=z,t[85]=ce):ce=t[85];let le;return t[86]!==y||t[87]!==ce?(le=(0,$.jsx)(`div`,{ref:y,id:`tunnel-broker-secret-setup`,children:ce}),t[86]=y,t[87]=ce,t[88]=le):le=t[88],le}function ot(){return oe().then(st)}function st(e){return e.registrationSecret??null}var ct={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null};function lt({embedded:e=!1}){let t=b(e=>e.language),n=y(t).tunnelSettings,r=!!x(e=>e.token),[i,a]=(0,Z.useReducer)(F,ct),{actionError:o,starting:s,stopping:c,savingAutoStart:l,consentOpen:u,autoStartConfirmOpen:d,releaseConfirmOpen:f,releasing:p,brokerSecretDraft:m,savingBrokerSecret:h,authorizingBrokerSecret:v,brokerSecretAuthorizationUrl:D,brokerSecretNotice:O}=i,A=(0,Z.useRef)(null),{data:I}=E(r),{data:L,error:R,isLoading:z,mutate:B}=C(r?`tunnel-status`:null,he,{refreshInterval:e=>s?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),V=(0,Z.useMemo)(()=>{let e=I?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)&&t.autoStart===!0)return!0}return L?.config?.autoStart===!0},[I,L?.config?.autoStart]),H=(0,Z.useMemo)(()=>{let e=I?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t.registrationSecret;if(typeof e==`string`)return e}}return``},[I]),U=M(H),W=L?.registrationSecret?.configured??U;(0,Z.useEffect)(()=>{let e=()=>{B()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[B]);let G=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),ee=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await fe(),await B(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{starting:!1}})}},[B]),K=(0,Z.useCallback)(()=>{if(!W){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),A.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(L?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}ee()},[W,L?.consentRequired,ee,n.brokerSecretRequiredBeforeStart]),te=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await le(),await Promise.all([B(),ee()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[B,ee]),q=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await me(),await B(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[B]),J=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await de({autoStart:e}),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),ae=(0,Z.useCallback)(()=>{if(V){J(!1);return}if(L?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!L?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[J,L?.canAutoStart,L?.consentRequired,n,V]),oe=(0,Z.useCallback)(async()=>{let e=m.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await de({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),T(),await B(),a({type:`patch`,patch:{actionError:null}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[m,B,n.brokerSecretSaved]),se=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await de({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),T(),await B()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[B,n.brokerSecretCleared]),ce=(0,Z.useCallback)(async()=>{let e=k(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await ne(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await P(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await ie(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await pe(),await Promise.all([B(),T()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{N(e),t&&re(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[B,n.brokerSecretSaved]),ue=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await me({release:!0}),await B(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[B]),ge=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:y(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!r)return(0,$.jsx)(`div`,{className:e?void 0:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let X=L??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:V,brokerUrl:`https://frp.xopc.ai/api`}},_e=L?.consentRequired&&(X.enabled||V||L?.consent?.acceptedAt),ye=(0,$.jsx)(at,{t:n,brokerSecretReady:W,brokerSecretConfiguredInConfig:U,brokerSecretMaskedValue:U?H:``,brokerSecretDraft:m,savingBrokerSecret:h,authorizingBrokerSecret:v,brokerSecretAuthorizationUrl:D,brokerSecretNotice:O,copyFailedLabel:y(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void oe(),onAuthorize:()=>void ce(),onClear:()=>void se(),sectionRef:A}),be=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Be,{open:u,title:n.consentTitle,intro:n.consentIntro,bullets:G,checkboxLabel:n.consentCheckbox,confirmLabel:_e?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void te(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},u?`consent-open`:`consent-closed`),(0,$.jsx)(j,{open:d,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),J(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(j,{open:f,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void ue(),onCancel:()=>a({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ye,(0,$.jsx)(nt,{t:n,status:X,isLoading:z,statusErr:R,starting:s,stopping:c,showConsentExpired:!!_e,copyLabels:ge,startDisabled:!W,startDisabledReason:W?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:K,onStop:()=>void q()}),(0,$.jsxs)(Re,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:S(`flex items-center gap-3 text-sm text-fg`,!V&&!L?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:V,disabled:l||!V&&!L?.canAutoStart,onChange:ae}),n.autoStart]}),!L?.canAutoStart&&!V?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,X.subdomain||X.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-4`,children:[(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:p||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[p?(0,$.jsx)(_,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(Re,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(Y,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),be]}):(0,$.jsxs)(`div`,{className:e?`flex w-full flex-col gap-6`:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[e?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ye,(0,$.jsx)(nt,{t:n,status:X,isLoading:z,statusErr:R,starting:s,stopping:c,showConsentExpired:!!_e,copyLabels:ge,startDisabled:!W,startDisabledReason:W?void 0:n.brokerSecretRequiredBeforeStart,onStart:K,onStop:()=>void q()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:p||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[p?(0,$.jsx)(_,{className:`size-4 animate-spin`}):null,n.release]})}):null,X.subdomain||X.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(ve,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:S(`flex items-center gap-3 text-sm text-fg`,!V&&!L?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:V,disabled:l||!V&&!L?.canAutoStart,onChange:ae}),n.autoStart]}),!L?.canAutoStart&&!V?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.autoStartHint}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-subtle shadow-surface`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(Y,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),be]})}function ut(e,t){return e.tabs[t]}function dt(e,t){return e.tabIntro[t]}function ft(e){switch(e){case`tailscale`:return`tailscale-serve`;case`public`:return`public-tunnel`;case`reverse-proxy`:return`reverse-proxy`;case`ssh`:return`ssh-tunnel`;case`lan`:return`lan`;default:return}}function pt(e){let t=(0,Q.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(De,{onOpenTab:r}),t[0]=r,t[1]=e),e}case`tailscale`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ue,{embedded:!0}),t[2]=e):e=t[2],e}case`public`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(lt,{embedded:!0}),t[3]=e):e=t[3],e}case`reverse-proxy`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(se,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Fe,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(je,{}),t[6]=e):e=t[6],e}}}function mt(){let e=(0,Q.c)(3),t=i(),n=b(gt),r=y(n).remoteAccess,o=!!x(ht),[s,c]=a(),l=Le(s.get(`tab`)),u=s.get(`intent`)===`mobile-pairing`,d;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={refreshInterval:2e3},e[0]=d):d=e[0];let f=C(u?`mobile-pairing-readiness`:null,ce,d),p;e[1]===c?p=e[2]:(p=e=>{c(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[1]=c,e[2]=p);let m=p,h=dt(r,l),g=Ie.map(e=>({id:e,label:ut(r,e)}));return(0,$.jsxs)(J,{children:[(0,$.jsx)(q,{title:r.pageTitle,meta:(0,$.jsx)(Y,{language:n,label:r.docsLink,section:ft(l),className:`mt-1`})}),o?(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-accent/25 bg-accent-soft px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(R,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.mobilePairingFlow.title}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.data?.ready?r.mobilePairingFlow.ready:r.mobilePairingFlow.hint})]})]}),(0,$.jsxs)(w,{variant:`primary`,disabled:!f.data?.ready,onClick:()=>t(`/settings/devices?startMobilePairing=1`),children:[f.data?.ready?r.mobilePairingFlow.continue:r.mobilePairingFlow.waiting,(0,$.jsx)(V,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(ye,{items:g,activeTab:l,onChange:m,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(ae,{id:l,activeTab:l,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:ut(r,l),hint:l===`public`?void 0:h,showHeading:!1,children:(0,$.jsx)(pt,{tab:l,onOpenTab:m})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function ht(e){return e.token}function gt(e){return e.language}export{mt as RemoteAccessHub};
@@ -1 +0,0 @@
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-Cq1tE_3b.js";import{a,n as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{n as d,r as f}from"./popover-select-CKBYnT3c.js";import{t as p}from"./download-Dk-ZjtO6.js";import{t as m}from"./plus-Q2yW6OE7.js";import{t as h}from"./x-B_N4OPjy.js";import{t as g}from"./messages-BRjoarIr.js";import{a as _,n as v,r as y,s as b}from"./locale-store-BQ2HKTWb.js";import{t as x}from"./cn-JdwAhgNB.js";import{i as S}from"./vendor-swr-BIWyz7Rc.js";import{t as C}from"./button-B11EPpor.js";import{n as w,r as T}from"./gateway-config-swr-bjzk_4hn.js";import{t as E}from"./skeleton-BwbyijEw.js";import{i as ee,o as D}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as O,t as k}from"./registry-api-CwveUfe8.js";import{Ac as A,Ca as j,Fu as M,Gl as N,Hc as P,Ji as F,Ki as I,Na as L,Ns as R,P as z,Pu as te,Qi as B,Rt as V,Ta as H,Wc as U,Ws as ne,Xi as W,Yi as re,Zi as ie,bo as G,cl as ae,dc as oe,dl as se,ea as ce,hc as le,iu as ue,jc as de,jl as fe,ll as pe,ni as K,os as q,qi as me,ss as J,ta as he,wa as Y,zt as ge}from"./index-CfyyA9-g.js";import{n as _e,t as ve}from"./settings-form-section-Cem6L49Y.js";import{n as ye,t as be}from"./use-autosave-DmgEA8Qb.js";import{t as xe}from"./page-tabs-BfV-PQa5.js";import{t as Se}from"./settings-advanced-gate-D1JRDRyL.js";var X=e(t(),1),Ce=n(),Z=r();function we(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 Te(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Ee(e){let t=(0,Ce.c)(105),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:s,onAction:c}=e,l;t[0]!==i.unnamedSession||t[1]!==n.name?(l=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=l):l=t[2];let u=l,d;t[3]===n.name?d=t[4]:(d=n.name?.trim(),t[3]=n.name,t[4]=d);let f=!!d,m=n.status===`archived`,h=n.status===`pinned`,g=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,_;t[5]===g?_=t[6]:(_=x(`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`,g),t[5]=g,t[6]=_);let v;t[7]===s?v=t[8]:(v=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())},t[7]=s,t[8]=v);let y=r===`list`&&`sm:py-3`,b;t[9]===y?b=t[10]:(b=x(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,y),t[9]=y,t[10]=b);let S;t[11]===n.sourceChannel?S=t[12]:(S=(0,Z.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,Z.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:n.sourceChannel})}),t[11]=n.sourceChannel,t[12]=S);let C;t[13]===h?C=t[14]:(C=h?(0,Z.jsx)(de,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[13]=h,t[14]=C);let w;t[15]===n.updatedAt?w=t[16]:(w=we(n.updatedAt),t[15]=n.updatedAt,t[16]=w);let T;t[17]===w?T=t[18]:(T=(0,Z.jsx)(`span`,{children:w}),t[17]=w,t[18]=T);let E;t[19]!==T||t[20]!==C?(E=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[C,T]}),t[19]=T,t[20]=C,t[21]=E):E=t[21];let ee;t[22]!==E||t[23]!==b||t[24]!==S?(ee=(0,Z.jsxs)(`div`,{className:b,children:[S,E]}),t[22]=E,t[23]=b,t[24]=S,t[25]=ee):ee=t[25];let D=r===`list`&&`sm:py-3`,O;t[26]===D?O=t[27]:(O=x(`min-w-0 flex-1 px-3 py-2`,D),t[26]=D,t[27]=O);let k=r===`list`&&`sm:items-start`,j;t[28]===k?j=t[29]:(j=x(`flex gap-3`,k),t[28]=k,t[29]=j);let N;t[30]!==o||t[31]!==a?(N=(0,Z.jsx)(z,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[30]=o,t[31]=a,t[32]=N):N=t[32];let P;t[33]===u?P=t[34]:(P=(0,Z.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:u,children:u}),t[33]=u,t[34]=P);let F;t[35]!==n.key||t[36]!==f?(F=f?(0,Z.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[35]=n.key,t[36]=f,t[37]=F):F=t[37];let I;t[38]!==P||t[39]!==F?(I=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[P,F]}),t[38]=P,t[39]=F,t[40]=I):I=t[40];let L;t[41]!==j||t[42]!==N||t[43]!==I?(L=(0,Z.jsxs)(`div`,{className:j,children:[N,I]}),t[41]=j,t[42]=N,t[43]=I,t[44]=L):L=t[44];let B;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(U,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[45]=B):B=t[45];let V;t[46]===n.messageCount?V=t[47]:(V=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[B,n.messageCount]}),t[46]=n.messageCount,t[47]=V);let H;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(R,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[48]=H):H=t[48];let W;t[49]===n.estimatedTokens?W=t[50]:(W=Te(n.estimatedTokens),t[49]=n.estimatedTokens,t[50]=W);let re;t[51]===W?re=t[52]:(re=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[H,W]}),t[51]=W,t[52]=re);let ie;t[53]!==V||t[54]!==re?(ie=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[V,re]}),t[53]=V,t[54]=re,t[55]=ie):ie=t[55];let G;t[56]===n.tags?G=t[57]:(G=n.tags.length>0?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(ke),n.tags.length>3?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[56]=n.tags,t[57]=G);let ae;t[58]!==O||t[59]!==L||t[60]!==ie||t[61]!==G?(ae=(0,Z.jsxs)(`div`,{className:O,children:[L,ie,G]}),t[58]=O,t[59]=L,t[60]=ie,t[61]=G,t[62]=ae):ae=t[62];let oe;t[63]===c?oe=t[64]:(oe=()=>c(`continue`),t[63]=c,t[64]=oe);let se;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(U,{className:`size-4`,strokeWidth:1.75}),t[65]=se):se=t[65];let ce;t[66]!==i.continueChat||t[67]!==oe?(ce=(0,Z.jsx)(`button`,{type:`button`,className:q,title:i.continueChat,"aria-label":i.continueChat,onClick:oe,children:se}),t[66]=i.continueChat,t[67]=oe,t[68]=ce):ce=t[68];let le;t[69]!==m||t[70]!==i.archive||t[71]!==i.unarchive||t[72]!==c?(le=m?(0,Z.jsx)(`button`,{type:`button`,className:q,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>c(`unarchive`),children:(0,Z.jsx)(M,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:q,title:i.archive,"aria-label":i.archive,onClick:()=>c(`archive`),children:(0,Z.jsx)(te,{className:`size-4`,strokeWidth:1.75})}),t[69]=m,t[70]=i.archive,t[71]=i.unarchive,t[72]=c,t[73]=le):le=t[73];let ue;t[74]!==h||t[75]!==i.pin||t[76]!==i.unpin||t[77]!==c?(ue=h?(0,Z.jsx)(`button`,{type:`button`,className:q,title:i.unpin,"aria-label":i.unpin,onClick:()=>c(`unpin`),children:(0,Z.jsx)(A,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:q,title:i.pin,"aria-label":i.pin,onClick:()=>c(`pin`),children:(0,Z.jsx)(de,{className:`size-4`,strokeWidth:1.75})}),t[74]=h,t[75]=i.pin,t[76]=i.unpin,t[77]=c,t[78]=ue):ue=t[78];let fe;t[79]===c?fe=t[80]:(fe=()=>c(`export`),t[79]=c,t[80]=fe);let pe;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(p,{className:`size-4`,strokeWidth:1.75}),t[81]=pe):pe=t[81];let K;t[82]!==i.export||t[83]!==fe?(K=(0,Z.jsx)(`button`,{type:`button`,className:q,title:i.export,"aria-label":i.export,onClick:fe,children:pe}),t[82]=i.export,t[83]=fe,t[84]=K):K=t[84];let me;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(me=x(q,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[85]=me):me=t[85];let J;t[86]===c?J=t[87]:(J=()=>c(`delete`),t[86]=c,t[87]=J);let he;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(ne,{className:`size-4`,strokeWidth:1.75}),t[88]=he):he=t[88];let Y;t[89]!==i.delete||t[90]!==J?(Y=(0,Z.jsx)(`button`,{type:`button`,className:me,title:i.delete,"aria-label":i.delete,onClick:J,children:he}),t[89]=i.delete,t[90]=J,t[91]=Y):Y=t[91];let ge;t[92]!==ce||t[93]!==le||t[94]!==ue||t[95]!==K||t[96]!==Y?(ge=(0,Z.jsxs)(`div`,{role:`group`,className:`flex flex-wrap items-center gap-0.5 border-t border-edge-subtle/80 bg-surface-hover/25 p-2 dark:border-edge-subtle`,onClick:Oe,onKeyDown:De,children:[ce,le,ue,K,Y]}),t[92]=ce,t[93]=le,t[94]=ue,t[95]=K,t[96]=Y,t[97]=ge):ge=t[97];let _e;return t[98]!==s||t[99]!==ee||t[100]!==ae||t[101]!==_||t[102]!==ge||t[103]!==v?(_e=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,className:_,onClick:s,onKeyDown:v,children:[ee,ae,ge]}),t[98]=s,t[99]=ee,t[100]=ae,t[101]=_,t[102]=ge,t[103]=v,t[104]=_e):_e=t[104],_e}function De(e){return e.stopPropagation()}function Oe(e){return e.stopPropagation()}function ke(e){return(0,Z.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 Ae(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function je(e,t){return t.find(t=>t.id===e)?.avatar}var Me={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:2e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function Ne(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Pe(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Q(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function Fe(e){let t=Ne(e)?e:{},n=Ne(t.userContext)?t.userContext:{},r=Ne(n.contextPlanning)?n.contextPlanning:{},i=Ne(r.compaction)?r.compaction:{},a=Me,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:Pe(i.triggerThreshold,a.triggerThreshold,.1,.98),reserveTokens:Q(i.reserveTokens,a.reserveTokens,1024),minMessagesBeforeCompact:Q(i.minMessagesBeforeCompact,a.minMessagesBeforeCompact,2),keepRecentTokens:Q(i.keepRecentTokens,a.keepRecentTokens,1e3),recentTurnsPreserve:Q(i.recentTurnsPreserve,a.recentTurnsPreserve,1,12),summaryMaxTokens:Q(i.summaryMaxTokens,a.summaryMaxTokens,256),summaryChunkTokens:Q(i.summaryChunkTokens,a.summaryChunkTokens,1e3),summaryTimeoutMs:Q(i.summaryTimeoutMs,a.summaryTimeoutMs,1e3,6e5),summaryRetries:Q(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:Q(i.minToolResultKeepChars,a.minToolResultKeepChars,200),maxActiveTranscriptBytes:Q(i.maxActiveTranscriptBytes,a.maxActiveTranscriptBytes,64e3),postCompactionSections:s}}function Ie(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 Le(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function Re(e){await _(y(`/api/config`),{method:`PATCH`,body:JSON.stringify(Le(e))}),await w()}var ze=128e3,Be={balanced:Me,preserve:{...Me,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Me,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Ve=j();function He(){return x(`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`,G,`dark:border-edge`)}function Ue(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function We(e){let t=Ue(e);for(let[e,n]of Object.entries(Be))if(t===Ue(n))return e;return`custom`}function Ge(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,Ce.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,Z.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=He(),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,Z.jsx)(`input`,{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,Z.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,Z.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function Ke(e){let t=(0,Ce.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=x(`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,Z.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,Z.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=d);let f;t[10]===r?f=t[11]:(f=(0,Z.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,Z.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,Z.jsxs)(`label`,{className:c,children:[u,p]}),t[15]=c,t[16]=u,t[17]=p,t[18]=m):m=t[18],m}function qe({hasToken:e}){let t=g(v(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=T(e),{data:i=[],isLoading:a}=S(e?k:null,O,{revalidateOnFocus:!1}),o=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:Fe(n.payload.config),[n]),[s,c]=(0,X.useReducer)(Ve,{form:null,baseline:null}),[l,u]=(0,X.useState)(``),d=(0,X.useRef)(!1),f=(0,X.useRef)(s.form);f.current=s.form;let p=(0,X.useRef)(null);Y({enabled:e,parsed:o,dirty:d.current,trackedParsedRef:p,dispatch:c,onResetDirty:()=>{d.current=!1}});let _=s.form,y=s.baseline,b=!!(_&&y&&JSON.stringify(_)!==JSON.stringify(y)),w=(0,X.useCallback)(e=>{d.current=!0,c({type:`patch`,patch:e})},[]),ee=(0,X.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]),D=be({value:_,dirty:b,onSave:(0,X.useCallback)(async e=>{try{await Re(e),c({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]),validate:e=>{let n=Ie(e);return n?t.invalidValue.replace(`{{field}}`,ee(n)):null}});if(!e||!_)return r?(0,Z.jsx)(ve,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(E,{className:`h-5 w-48`}),(0,Z.jsx)(E,{className:`h-20 w-full rounded-xl`}),(0,Z.jsx)(E,{className:`h-36 w-full rounded-xl`})]})}):null;let A=We(_),j=Math.max(0,ze-_.reserveTokens),M=Math.min(Math.floor(ze*_.triggerThreshold),j),N=Math.min(100,M/ze*100),F=Math.min(100,j/ze*100),I=_.model?i.find(e=>e.id===_.model):void 0,L=I?.contextWindow&&_.summaryChunkTokens+_.summaryMaxTokens+4096>I.contextWindow,R=_.keepRecentTokens+_.reserveTokens>M,z=Math.round(_.summaryTimeoutMs*(_.summaryRetries+1)/1e3),te=e=>{let t=Be[e];w({...t,..._.model?{model:_.model}:{model:void 0},postCompactionSections:_.postCompactionSections})},B={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},V=()=>{let e=l.trim();!e||_.postCompactionSections.includes(e)||_.postCompactionSections.length>=12||(w({postCompactionSections:[..._.postCompactionSections,e]}),u(``))};return(0,Z.jsxs)(ve,{onBlurCapture:D.onBlurCapture,children:[(0,Z.jsx)(_e,{icon:P,title:t.title,subtitle:t.hint,trailing:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(ye,{status:D.status,error:D.error}),(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:_.enabled,onChange:e=>w({enabled:e.target.checked})}),_.enabled?t.enabled:t.disabled]})]})}),D.error?(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:D.error}):null,_.enabled?null:(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Z.jsxs)(`fieldset`,{disabled:!_.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),A===`custom`?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":A===e,className:x(`rounded-xl border px-3 py-3 text-left`,J.transition,J.focusRingPanel,A===e?`border-accent/50 bg-accent-soft text-accent-fg`:`border-edge bg-surface-panel text-fg hover:bg-surface-hover`),onClick:()=>te(e),children:[(0,Z.jsx)(`span`,{className:`block text-sm font-medium`,children:B[e].title}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:B[e].hint})]},e))})]}),(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-hover/35 p-4 dark:border-edge`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.compactionTrigger}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:Ge(M)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${N}%`}})})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.hardInputLimit}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:Ge(j)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${F}%`}})})]})]}),(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((_.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>w({triggerThreshold:e/100})}),(0,Z.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,Ge(_.reserveTokens)),value:_.reserveTokens,min:1024,step:1024,onChange:e=>w({reserveTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:_.recentTurnsPreserve,min:1,max:12,onChange:e=>w({recentTurnsPreserve:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,Ge(_.keepRecentTokens)),value:_.keepRecentTokens,min:1e3,step:1e3,onChange:e=>w({keepRecentTokens:Math.floor(e)})})]}),R?(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):null,(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Z.jsx)(K,{value:_.model??``,disabled:!_.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=>w({model:e})}),_.model?(0,Z.jsx)(C,{type:`button`,variant:`secondary`,onClick:()=>w({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Z.jsx)(Ke,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:_.qualityGuard,onChange:e=>w({qualityGuard:e})}),(0,Z.jsx)(Ke,{label:t.gapAudit,hint:t.gapAuditHint,checked:_.gapAudit,onChange:e=>w({gapAudit:e})})]}),_.qualityGuard?null:(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning}),(0,Z.jsx)(Se,{children:(0,Z.jsxs)(`div`,{className:`space-y-5 border-t border-edge pt-5`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:_.minMessagesBeforeCompact,min:2,onChange:e=>w({minMessagesBeforeCompact:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((_.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>w({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Z.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:_.summaryMaxTokens,min:256,step:256,onChange:e=>w({summaryMaxTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:_.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>w({summaryChunkTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(z)),value:_.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>w({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Z.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:_.summaryRetries,min:0,max:5,onChange:e=>w({summaryRetries:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:_.minToolResultKeepChars,min:200,step:100,onChange:e=>w({minToolResultKeepChars:Math.floor(e)})})]}),L?(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Z.jsxs)(`div`,{className:`border-t border-edge pt-5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),_.postCompactionSections.length>0?(0,Z.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:_.postCompactionSections.map(e=>(0,Z.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,Z.jsx)(`button`,{type:`button`,className:x(`text-fg-muted hover:text-fg`,J.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>w({postCompactionSections:_.postCompactionSections.filter(t=>t!==e)}),children:(0,Z.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Z.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Z.jsx)(`input`,{className:He(),value:l,maxLength:120,disabled:_.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),V())}}),(0,Z.jsxs)(C,{type:`button`,variant:`secondary`,disabled:!l.trim()||_.postCompactionSections.length>=12,onClick:V,children:[(0,Z.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function Je(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ye(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function Xe(e){let t=Je(e)?e:{},n=Je(t.session)?t.session:{},r=Je(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:Ye(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function Ze(e){await _(y(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),w()}function Qe(){return x(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,G,`dark:border-edge`)}var $e=j();function et({hasToken:e}){let t=g(v(e=>e.language)).sessions.config,{data:n,isLoading:r}=T(e),i=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:Xe(n.payload.config),[n]),[a,o]=(0,X.useReducer)($e,{form:null,baseline:null}),s=a.form,c=a.baseline,l=(0,X.useRef)(!1),u=(0,X.useRef)(s);u.current=s;let p=(0,X.useRef)(null);Y({enabled:e,parsed:i,dirty:l.current,trackedParsedRef:p,dispatch:o,onResetDirty:()=>{l.current=!1}});let m=!!(s&&c&&JSON.stringify(s)!==JSON.stringify(c)),h=(0,X.useCallback)(e=>{l.current=!0,o({type:`patch`,patch:e})},[]),_=be({value:s,dirty:m,onSave:(0,X.useCallback)(async e=>{try{await Ze(e),o({type:`saved`,value:e}),l.current=!!(u.current&&JSON.stringify(u.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!s?r?(0,Z.jsx)(ve,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(E,{className:`h-5 w-40`}),(0,Z.jsx)(E,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Z.jsxs)(ve,{onBlurCapture:_.onBlurCapture,children:[(0,Z.jsx)(_e,{icon:N,title:t.title,subtitle:t.hint,trailing:(0,Z.jsx)(ye,{status:_.status,error:_.error})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Z.jsxs)(d,{className:Qe(),value:s.dmScope,onChange:e=>h({dmScope:e.target.value}),children:[(0,Z.jsx)(f,{value:`main`,children:t.dmScopeMain}),(0,Z.jsx)(f,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Z.jsx)(f,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Z.jsx)(f,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Z.jsx)(`input`,{type:`number`,min:0,className:Qe(),value:s.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,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Z.jsx)(`input`,{type:`number`,min:1,className:Qe(),value:s.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 tt(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 nt(e){let t=(0,Ce.c)(60),{open:n,loading:r,session:i,sessionAgentId:d,sessionAgentAvatar:f,labels:p,onClose:m,onArchive:g,onUnarchive:_,onPin:v,onUnpin:y,onExport:b,onDelete:S}=e,w=i?.status===`archived`,T=i?.status===`pinned`,E;t[0]===m?E=t[1]:(E=e=>!e&&m(),t[0]=m,t[1]=E);let O;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(a,{className:x(`xopc-dialog-overlay fixed inset-0 bg-scrim`,D)}),t[2]=O):O=t[2];let k;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=x(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,ee,`dark:border-edge`),t[3]=k):k=t[3];let A;t[4]!==i||t[5]!==f||t[6]!==d?(A=i&&d?(0,Z.jsx)(z,{agentId:d,avatar:f,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=f,t[6]=d,t[7]=A):A=t[7];let j;t[8]!==p.unnamedSession||t[9]!==i?.name?(j=i?.name?.trim()||p.unnamedSession,t[8]=p.unnamedSession,t[9]=i?.name,t[10]=j):j=t[10];let M;t[11]===j?M=t[12]:(M=(0,Z.jsx)(l,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:j}),t[11]=j,t[12]=M);let N;t[13]!==A||t[14]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[A,M]}),t[13]=A,t[14]=M,t[15]=N):N=t[15];let P;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(h,{className:`size-5`,strokeWidth:1.75}),t[16]=P):P=t[16];let F;t[17]===p.close?F=t[18]:(F=(0,Z.jsx)(o,{asChild:!0,children:(0,Z.jsx)(C,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":p.close,children:P})}),t[17]=p.close,t[18]=F);let I;t[19]!==N||t[20]!==F?(I=(0,Z.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:[N,F]}),t[19]=N,t[20]=F,t[21]=I):I=t[21];let L;t[22]!==p.detailLoading||t[23]!==p.detailMessages||t[24]!==r||t[25]!==i?(L=r?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p.detailLoading}):i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Z.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Z.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Z.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:p.detailMessages}),(0,Z.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(rt)})]}):null,t[22]=p.detailLoading,t[23]=p.detailMessages,t[24]=r,t[25]=i,t[26]=L):L=t[26];let R;t[27]===L?R=t[28]:(R=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:L}),t[27]=L,t[28]=R);let te;t[29]!==p.detailExport||t[30]!==b?(te=(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:b,children:p.detailExport}),t[29]=p.detailExport,t[30]=b,t[31]=te):te=t[31];let B;t[32]!==w||t[33]!==p.archive||t[34]!==p.unarchive||t[35]!==g||t[36]!==_?(B=w?(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:_,children:p.unarchive}):(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:g,children:p.archive}),t[32]=w,t[33]=p.archive,t[34]=p.unarchive,t[35]=g,t[36]=_,t[37]=B):B=t[37];let V;t[38]!==T||t[39]!==p.pin||t[40]!==p.unpin||t[41]!==v||t[42]!==y?(V=T?(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:y,children:p.unpin}):(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:v,children:p.pin}),t[38]=T,t[39]=p.pin,t[40]=p.unpin,t[41]=v,t[42]=y,t[43]=V):V=t[43];let H;t[44]!==p.delete||t[45]!==S?(H=(0,Z.jsx)(C,{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:S,children:p.delete}),t[44]=p.delete,t[45]=S,t[46]=H):H=t[46];let U;t[47]!==te||t[48]!==B||t[49]!==V||t[50]!==H?(U=(0,Z.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[te,B,V,H]})}),t[47]=te,t[48]=B,t[49]=V,t[50]=H,t[51]=U):U=t[51];let ne;t[52]!==I||t[53]!==R||t[54]!==U?(ne=(0,Z.jsxs)(s,{children:[O,(0,Z.jsxs)(c,{className:k,"aria-describedby":void 0,children:[I,R,U]})]}),t[52]=I,t[53]=R,t[54]=U,t[55]=ne):ne=t[55];let W;return t[56]!==n||t[57]!==E||t[58]!==ne?(W=(0,Z.jsx)(u,{open:n,onOpenChange:E,children:ne}),t[56]=n,t[57]=E,t[58]=ne,t[59]=W):W=t[59],W}function rt(e){return(0,Z.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Z.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Z.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:tt(e.content)})]},`${e.timestamp??``}-${e.role}-${tt(e.content).slice(0,24)}`)}var it=20;function at(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ot=new Set([`all`,`active`,`pinned`,`archived`]),st=new Set([`grid`,`list`]),ct=[`sessions`,`settings`];function lt(e){return e&&ct.includes(e)?e:`sessions`}function ut(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function dt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function ft(e){let t=(0,Ce.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=ct.map(e=>({id:e,label:ut(n,e),icon:e===`sessions`?se:oe})),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,Z.jsx)(xe,{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 pt(e){let t=(0,Ce.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a===void 0?!1:a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-2xl bg-surface-base px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mb-5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:ut(n,r)}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:dt(n,r)})]}),(0,Z.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,Z.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 mt(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ot.has(t)?t:`all`,viewMode:st.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 ht(){let e=g(v(e=>e.language)),t=e.sessions,n=b(e=>e.token),r=!!n,{data:o,mutate:d}=S(r?[`gateway-chat-agents`,n]:null,L,{revalidateOnFocus:!1}),f=o?.defaultId??`main`,p=o?.items??[],[m,h]=i(),_=lt(m.get(`tab`)),y=(0,X.useCallback)(e=>{let t=new URLSearchParams(m);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),h(t,{replace:!0})},[m,h]),[w,T]=(0,X.useReducer)(H,m,mt),{searchInput:E,debouncedSearch:O,statusFilter:k,viewMode:A,channelFilter:j,sessions:M,loading:N,error:P,hasMore:R,stats:z,detailOpen:U,detailLoading:ne,detailSession:G,confirmOpen:oe,confirmKey:K}=w;(0,X.useEffect)(()=>{let e=setTimeout(()=>{let e=E.trim();O!==e&&T({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[E,O]);let q=m.toString(),Y=(0,X.useRef)(q);if(Y.current!==q){Y.current=q;let e=m.get(`q`)??``,t=m.get(`status`),n=m.get(`view`),r=(m.get(`channel`)??``).trim(),i=ot.has(t)?t:`all`,a=st.has(n)?n:`grid`,o=e.trim();T({type:`patch`,patch:{...E===e?{}:{searchInput:e},...O===o?{}:{debouncedSearch:o},...k===i?{}:{statusFilter:i},...A===a?{}:{viewMode:a},...j===r?{}:{channelFilter:r}}})}(0,X.useEffect)(()=>{let e=new URLSearchParams(m),t=O.trim();t?e.set(`q`,t):e.delete(`q`),k===`all`?e.delete(`status`):e.set(`status`,k),A===`grid`?e.delete(`view`):e.set(`view`,A),j?e.set(`channel`,j):e.delete(`channel`),e.toString()!==m.toString()&&h(e,{replace:!0})},[O,m,h,k,A,j]),(0,X.useEffect)(()=>{if(!r||_!==`sessions`)return;let e=!1;return(async()=>{T({type:`patch`,patch:{loading:!0,error:null}});try{let t=await ie({limit:it,offset:0,...O?{search:O}:{},...k===`all`?{}:{status:k},...j?{channel:j}:{}});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,_,O,k,j,t.loadError]),(0,X.useEffect)(()=>{!r||_!==`sessions`||W().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,_]),(0,X.useEffect)(()=>{if(!r||_!==`sessions`)return;let e=()=>void d();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,_,d]),(0,X.useEffect)(()=>{if(!r||_!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||T({type:`patch`,patch:{sessions:M.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:G&&G.key===t.key?{...G,name:t.name}:G}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,_,M,G]);let _e=(0,X.useCallback)(async()=>{if(!(!r||N||!R)){T({type:`patch`,patch:{loading:!0,error:null}});try{let e=await ie({limit:it,offset:M.length,...O?{search:O}:{},...k===`all`?{}:{status:k},...j?{channel:j}:{}});T({type:`patch`,patch:{sessions:[...M,...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,N,R,M.length,O,k,j,t.loadError]),ve=(0,X.useCallback)((e,t)=>{T({type:`patch`,patch:{sessions:M.map(n=>n.key===e?{...n,status:t}:n),detailSession:G&&G.key===e?{...G,status:t}:G}})},[M,G]),ye=(0,X.useCallback)(async e=>{T({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{T({type:`patch`,patch:{detailSession:await re(e)}})}catch{T({type:`patch`,patch:{detailOpen:!1}})}finally{T({type:`patch`,patch:{detailLoading:!1}})}},[]),be=e=>{ye(e)},xe=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:e},bubbles:!0}));return}if(t===`delete`){T({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await I(e),ve(e,`archived`);break;case`unarchive`:await ce(e),ve(e,`active`);break;case`pin`:await B(e),ve(e,`pinned`);break;case`unpin`:await he(e),ve(e,`active`);break;case`export`:{let t=await F(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}W().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Se=async e=>{try{await me(e),T({type:`patch`,patch:{sessions:M.filter(t=>t.key!==e),detailSession:G?.key===e?null:G,...G?.key===e?{detailOpen:!1}:{}}}),W().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Ce={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,unnamedSession:e.chat.newSession},we={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},Te=[{key:`all`,label:t.filterAll,icon:se},{key:`active`,label:t.filterActive,icon:ue},{key:`pinned`,label:t.filterPinned,icon:de},{key:`archived`,label:t.filterArchived,icon:te}],De=(()=>{let e=Object.entries(z?.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,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,Z.jsx)(`header`,{className:`flex flex-col gap-2`,children:(0,Z.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:t.title})}),(0,Z.jsx)(ft,{s:t,activeTab:_,onChange:y}),(0,Z.jsx)(pt,{s:t,id:`settings`,activeTab:_,plain:!0,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(qe,{hasToken:r}),(0,Z.jsx)(et,{hasToken:r})]})}),(0,Z.jsxs)(pt,{s:t,id:`sessions`,activeTab:_,plain:!0,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Te.map(({key:e,label:t,icon:n})=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":k===e,onClick:()=>T({type:`patch`,patch:{statusFilter:e}}),className:x(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,J.transition,J.focusRingPanel,k===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,Z.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Z.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Z.jsx)(le,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:E,onChange:e=>T({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"data-debounced-query":O||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":!j,onClick:()=>T({type:`patch`,patch:{channelFilter:``}}),className:x(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,J.transition,J.focusRingPanel,j?`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}),De.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":j===e,onClick:()=>T({type:`patch`,patch:{channelFilter:e}}),className:x(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,J.transition,J.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:[e,z?.byChannel?.[e]==null?null:(0,Z.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:z.byChannel[e]})]},e))]}),z?(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[z.totalSessions,t.totalSessions],[z.activeSessions,t.activeSessions],[z.pinnedSessions,t.pinnedSessions],[z.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Z.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Z.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,P?(0,Z.jsx)(`div`,{className:`rounded-lg border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,children:P}):null,(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:at(t.sessionCount,{count:M.length})}),(0,Z.jsxs)(`div`,{className:ge,role:`group`,"aria-label":t.layoutToggleGroup,children:[(0,Z.jsx)(C,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":A===`grid`,onClick:()=>T({type:`patch`,patch:{viewMode:`grid`}}),className:x(V,`size-7 p-0`,A===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,A===`grid`&&`text-accent-fg`),children:(0,Z.jsx)(pe,{className:`size-3.5`,strokeWidth:1.5})}),(0,Z.jsx)(C,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":A===`list`,onClick:()=>T({type:`patch`,patch:{viewMode:`list`}}),className:x(V,`size-9 p-0`,A===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,A===`list`&&`text-accent-fg`),children:(0,Z.jsx)(ae,{className:`size-3.5`,strokeWidth:1.5})})]})]}),N&&M.length===0?(0,Z.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,Z.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):M.length===0?(0,Z.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,Z.jsx)(fe,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Z.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Z.jsx)(C,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:x(`grid min-w-0 gap-3`,A===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":O||void 0,children:M.map(e=>{let t=Ae(e,f);return(0,Z.jsx)(Ee,{session:e,variant:A,labels:Ce,sessionAgentId:t,sessionAgentAvatar:je(t,p),onOpen:()=>be(e.key),onAction:t=>void xe(e.key,t)},e.key)})}),R?(0,Z.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Z.jsx)(C,{type:`button`,variant:`secondary`,disabled:N,onClick:()=>void _e(),children:t.loadMore})}):null]})]})]}),(0,Z.jsx)(nt,{open:U,loading:ne,session:G,sessionAgentId:G?Ae(G,f):void 0,sessionAgentAvatar:G?je(Ae(G,f),p):void 0,labels:we,onClose:()=>{T({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>G&&void xe(G.key,`archive`),onUnarchive:()=>G&&void xe(G.key,`unarchive`),onPin:()=>G&&void xe(G.key,`pin`),onUnpin:()=>G&&void xe(G.key,`unpin`),onExport:()=>G&&void xe(G.key,`export`),onDelete:()=>G&&T({type:`patch`,patch:{confirmKey:G.key,confirmOpen:!0}})}),(0,Z.jsx)(u,{open:oe,onOpenChange:e=>T({type:`patch`,patch:{confirmOpen:e}}),children:(0,Z.jsxs)(s,{children:[(0,Z.jsx)(a,{className:x(`xopc-dialog-overlay fixed inset-0 bg-scrim`,D)}),(0,Z.jsxs)(c,{className:x(`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-panel p-4 shadow-popover dark:border-edge`,ee),children:[(0,Z.jsx)(l,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:K?at(t.deleteSessionMessage,{name:M.find(e=>e.key===K)?.name?.trim()||e.chat.newSession}):``}),(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(C,{type:`button`,variant:`secondary`,onClick:()=>T({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Z.jsx)(C,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{K&&Se(K),T({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Z.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{ht as SessionsPage};
@@ -1 +0,0 @@
1
- import{dn as e}from"./index-CfyyA9-g.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./messages-BRjoarIr.js";import{a as c,n as l,r as u,s as d}from"./locale-store-BQ2HKTWb.js";import{t as f}from"./cn-JdwAhgNB.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{r as m}from"./gateway-config-swr-bjzk_4hn.js";import{n as h,t as g}from"./registry-api-CwveUfe8.js";import{Dt as _,Ha as v,Iu as y,Qs as b,Us as x,au as S,bc as ee,cn as C,fu as w,hl as T,ho as E,iu as D,ss as O}from"./index-CfyyA9-g.js";import{n as k,r as A}from"./settings-page-layout-DYelDcMV.js";import{n as j}from"./settings-loading-skeleton-CAmWMaOT.js";import{n as M,t as N}from"./settings-form-section-Cem6L49Y.js";import{t as P}from"./settings-advanced-gate-D1JRDRyL.js";var F=e(t(),1),I=n();function L(e){if(!e||typeof e!=`object`)return 0;let t=e.providers;return!t||typeof t!=`object`||Array.isArray(t)?0:Object.values(t).filter(e=>typeof e==`string`&&E(e)).length}function R(e){if(!e||typeof e!=`object`)return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.defaults,r=n&&typeof n==`object`&&!Array.isArray(n)?n.models:void 0;if(!r||typeof r!=`object`||Array.isArray(r))return``;let i=r.chat;if(!i||typeof i!=`object`||Array.isArray(i))return``;let a=i.primary;return typeof a==`string`?a.trim():``}function te(e){if(!e||typeof e!=`object`)return!1;let t=e.channels;return!t||typeof t!=`object`||Array.isArray(t)?!1:Object.values(t).some(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(`configured`in t||`config`in t||`schema`in t||`uiHints`in t){if(t.configured===!0)return!0;let e=t.config;if(!e||typeof e!=`object`||Array.isArray(e))return!1;let n=e;return n.enabled===!0||Object.keys(n).length>0}return t.enabled===!0||Object.keys(t).length>0})}function z(e){if(!e||typeof e!=`object`)return{enabled:!1,driverKind:`extension`};let t=e.browser;if(!t||typeof t!=`object`||Array.isArray(t))return{enabled:!1,driverKind:`extension`};let n=t,r=n.driver&&typeof n.driver==`object`&&!Array.isArray(n.driver)?n.driver:void 0;return{enabled:n.enabled===!0,driverKind:typeof r?.kind==`string`&&r.kind.trim()?r.kind.trim():`extension`}}function B(e){return e?`pass`:`fail`}function V(e){if(e===`provider-auth`)return`/settings/capabilities/models`;if(e===`config-health`)return`/settings/gateway`;if(e===`state-integrity`||e===`workspace-status`)return`/agents`;if(e===`database-schema`||e===`session-integrity`)return`/settings/sessions`;if(e===`channel-config`||e===`channel-pairing-pending`||e.startsWith(`channel:`))return`/channels`;if(e===`security-audit`||e===`gateway-service`||e===`gateway-health`)return`/settings/gateway`;if(e===`version-check`)return`/settings/desktop-app`}function H(e){return{fail:4,warn:3,skip:2,pass:1}[e]}function U(e){return e.filter(e=>e.status===`fail`||e.status===`warn`).map(e=>({id:e.id,label:e.label,status:e.status,message:e.message,hints:e.hints,path:V(e.id),source:`doctor`})).toSorted((e,t)=>H(t.status)-H(e.status)||e.label.localeCompare(t.label))}function W(e){let t=new Map(e.doctorChecks.map(e=>[e.id,e])),n=[];for(let e of[`security-audit`,`channel-config`,`channel-pairing-pending`,`gateway-health`]){let r=t.get(e);r&&n.push({id:r.id,label:r.label,status:r.status,message:r.message,path:V(r.id)})}if(e.logsHealth){let t=e.logsHealth.stats?.errorsLast24h??0;n.push({id:`logs-health`,label:`Logs`,status:e.logsHealth.shuttingDown||t>0?`warn`:`pass`,message:e.logsHealth.shuttingDown?`Logger is shutting down.`:t>0?`${t} error(s) in the last 24 hours.`:`Log system is healthy.`,path:`/settings/logs`})}for(let t of e.browserDiagnostics??[])n.push(t);return n}function ne(e){let t=L(e.config),n=e.providerMeta?.configured??t,r=e.providerMeta?.total??0,i=n>0||t>0,a=R(e.config),o=a.length>0,s=e.hasToken&&e.realtimeConnected,c=te(e.config),l=e.skillCount>0,u=e.doctorChecks??[],d=U(u),f=[{id:`gateway`,done:s,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline},{id:`provider`,done:i,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing},{id:`defaultModel`,done:o,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing},{id:`channel`,done:c,optional:!0,detail:c?e.labels.channelConfigured:e.labels.channelMissing},{id:`skill`,done:l,optional:!0,detail:l?e.labels.skillsConfigured(e.skillCount):e.labels.skillsMissing}],p=f.filter(e=>!e.optional).every(e=>e.done),m=f.every(e=>e.done),h=[{id:`gateway`,status:B(s),title:`Gateway`,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline,path:`/settings/gateway`},{id:`provider`,status:B(i),title:`Model provider`,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing,path:`/settings/capabilities/models`},{id:`defaultModel`,status:B(o),title:`Default model`,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing,path:`/settings/capabilities/models`},{id:`ready`,status:p?`pass`:`fail`,title:`Chat readiness`,detail:p?e.labels.readyToChat:e.labels.modelMissing,path:`/chat`}],g=d.some(e=>e.status===`fail`),_=d.some(e=>e.status===`warn`),v=g?`blocked`:_?`attention`:p?`ready`:`setup`,y=W({doctorChecks:u,logsHealth:e.logsHealth,browserDiagnostics:e.browserDiagnostics});return{gatewayConnected:s,providerConfigured:i,providerCount:t,providerMetaConfigured:n,providerMetaTotal:r,defaultModel:a,defaultModelConfigured:o,channelConfigured:c,skillInstalled:l,skillCount:e.skillCount,checklist:f,readiness:h,issues:d,healthTier:v,diagnosticSignals:y,requiredComplete:p,allComplete:m}}function re(e){return z(e)}function G(e){return!e.id||!e.label||!e.status||!e.message||![`pass`,`warn`,`fail`,`skip`].includes(e.status)?null:{id:e.id,label:e.label,status:e.status,message:e.message,hints:Array.isArray(e.hints)?e.hints.filter(e=>typeof e==`string`):[],fixed:e.fixed===!0,findings:Array.isArray(e.findings)?e.findings:void 0}}function ie(){return u(`/api/doctor`)}async function ae(){return((await c(ie())).checks??[]).map(G).filter(e=>e!==null)}function oe(){return u(`/api/logs/health`)}async function se(){return c(oe())}function ce(e){return e?`pass`:`warn`}function le(e){return e?.enabled?[`setup-browser-diagnostics`,e]:null}async function K(e){if(!e.enabled)return[];if(e.driverKind===`playwright`){let e=await c(u(`/api/browser/playwright/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-playwright`,label:`Browser: Playwright`,status:ce(t),message:t?`Local Chromium is installed.`:e.payload?.reason??`Local Chromium is not installed.`,path:`/settings/agent-browser`}]}if(e.driverKind===`extension`){let e=await c(u(`/api/browser/extension-status?probe=true`)),t=e.artifacts?.installed===!0,n=e.connected===!0,r=e.artifacts?.needsRefresh===!0||e.artifacts?.needsChromeReload===!0;return[{id:`browser-extension`,label:`Browser: Chrome extension`,status:n?`pass`:`warn`,message:n?`Chrome extension bridge is connected.`:t?r?`Chrome extension needs refresh.`:`Chrome extension is installed but not connected.`:`Chrome extension is not installed.`,path:`/settings/agent-browser`}]}return[{id:`browser-playwright`,label:`Browser`,status:`skip`,message:`Browser driver "${e.driverKind}" is configured.`,path:`/settings/agent-browser`}]}function q(){let e=(0,I.c)(57),t=d(he),n=l(me),r;e[0]===n?r=e[1]:(r=s(n),e[0]=n,e[1]=r);let i=r,a=i.setupStatus.labels,o=v(pe),{data:c,error:u,isLoading:f,mutate:y}=m(!!t),b;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(b={revalidateOnFocus:!1},e[2]=b):b=e[2];let{data:x,error:S,isLoading:ee,mutate:C}=p(t?`setup-checklist-skills`:null,fe,b),w;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(w={revalidateOnFocus:!1},e[3]=w):w=e[3];let{data:T,error:E,isLoading:D,mutate:O}=p(t?`setup-checklist-provider-meta`:null,_,w),k;e[4]===t?k=e[5]:(k=t?ie():null,e[4]=t,e[5]=k);let A;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(A={revalidateOnFocus:!1},e[6]=A):A=e[6];let{data:j,error:M,isLoading:N,mutate:P}=p(k,ae,A),F;e[7]===t?F=e[8]:(F=t?oe():null,e[7]=t,e[8]=F);let L;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(L={revalidateOnFocus:!1},e[9]=L):L=e[9];let{data:R,isLoading:te,mutate:z}=p(F,se,L);c?.payload?.config;let B=c?.payload?.config,V;e[10]===B?V=e[11]:(V=re(B),e[10]=B,e[11]=V);let H=t?V:null,U;e[12]===H?U=e[13]:(U=le(H),e[12]=H,e[13]=U);let W;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(W={revalidateOnFocus:!1},e[14]=W):W=e[14];let{data:G,isLoading:ce,mutate:K}=p(U,de,W),q;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(q={revalidateOnFocus:!1},e[15]=q):q=e[15],p(t?g:null,h,q);let J=!t||!f&&!ee&&!D&&!N&&!te&&!ce,Y=!!(u||S||E||M),X;bb0:{if(!t||!J){X=null;break bb0}let n=x?.catalog?.length??0,r;if(e[16]!==G||e[17]!==c?.payload?.config||e[18]!==j||e[19]!==a.channelConfigured||e[20]!==a.channelMissing||e[21]!==a.gatewayOffline||e[22]!==a.gatewayOnline||e[23]!==a.modelConfigured||e[24]!==a.modelMissing||e[25]!==a.providersConfigured||e[26]!==a.providersMetaReady||e[27]!==a.providersMissing||e[28]!==a.skillsConfigured||e[29]!==a.skillsMissing||e[30]!==R||e[31]!==i.setupStatus.requiredCompleteMessage||e[32]!==T||e[33]!==o||e[34]!==n||e[35]!==t){let s=T?.filter(ue).length??0,l=T?.length??0,u;e[37]===a.providersConfigured?u=e[38]:(u=e=>a.providersConfigured.replace(`{{count}}`,String(e)),e[37]=a.providersConfigured,e[38]=u);let d;e[39]===a.providersMetaReady?d=e[40]:(d=(e,t)=>a.providersMetaReady.replace(`{{configured}}`,String(e)).replace(`{{total}}`,String(t)),e[39]=a.providersMetaReady,e[40]=d);let f;e[41]===a.modelConfigured?f=e[42]:(f=e=>a.modelConfigured.replace(`{{model}}`,e),e[41]=a.modelConfigured,e[42]=f);let p;e[43]===a.skillsConfigured?p=e[44]:(p=e=>a.skillsConfigured.replace(`{{count}}`,String(e)),e[43]=a.skillsConfigured,e[44]=p),r=ne({hasToken:!!t,realtimeConnected:o,config:c?.payload?.config,skillCount:n,providerMeta:l>0?{configured:s,total:l}:null,doctorChecks:j,logsHealth:R,browserDiagnostics:G,labels:{gatewayOnline:a.gatewayOnline,gatewayOffline:a.gatewayOffline,providersConfigured:u,providersMetaReady:d,providersMissing:a.providersMissing,modelConfigured:f,modelMissing:a.modelMissing,channelConfigured:a.channelConfigured,channelMissing:a.channelMissing,skillsConfigured:p,skillsMissing:a.skillsMissing,readyToChat:i.setupStatus.requiredCompleteMessage}}),e[16]=G,e[17]=c?.payload?.config,e[18]=j,e[19]=a.channelConfigured,e[20]=a.channelMissing,e[21]=a.gatewayOffline,e[22]=a.gatewayOnline,e[23]=a.modelConfigured,e[24]=a.modelMissing,e[25]=a.providersConfigured,e[26]=a.providersMetaReady,e[27]=a.providersMissing,e[28]=a.skillsConfigured,e[29]=a.skillsMissing,e[30]=R,e[31]=i.setupStatus.requiredCompleteMessage,e[32]=T,e[33]=o,e[34]=n,e[35]=t,e[36]=r}else r=e[36];X=r}let Z=X,Q;e[45]!==K||e[46]!==y||e[47]!==P||e[48]!==z||e[49]!==O||e[50]!==C?(Q=async()=>{await Promise.all([y(),C(),O(),P(),z(),K()])},e[45]=K,e[46]=y,e[47]=P,e[48]=z,e[49]=O,e[50]=C,e[51]=Q):Q=e[51];let ge=Q,$;return e[52]!==Y||e[53]!==J||e[54]!==ge||e[55]!==Z?($={ready:J,error:Y,snapshot:Z,refresh:ge},e[52]=Y,e[53]=J,e[54]=ge,e[55]=Z,e[56]=$):$=e[56],$}function ue(e){return e.configured}function de(e){let[,t]=e;return K(t)}function fe(){return C()}function pe(e){return e.connectionState===`connected`}function me(e){return e.language}function he(e){return e.token}var J=r();function Y(e){return e===`pass`?`border-success/30 bg-success-soft text-success`:e===`warn`?`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`fail`?`border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge bg-surface-hover text-fg-muted`}function X(e){return e===`pass`?a:e===`warn`?x:e===`fail`?S:T}function Z(e,t){return e===`blocked`?{icon:S,className:`bg-red-500/10 text-red-950 dark:text-red-100`,title:t.health.blockedTitle,body:t.health.blockedBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`attention`?{icon:x,className:`bg-amber-500/10 text-amber-950 dark:text-amber-100`,title:t.health.attentionTitle,body:t.health.attentionBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`setup`?{icon:D,className:`bg-surface-base text-fg shadow-surface`,title:t.health.setupTitle,body:t.health.setupBody,action:t.health.continueSetup,targetId:`next-steps`}:{icon:a,className:`bg-success-soft text-success`,title:t.health.readyTitle,body:t.health.readyBody,action:t.health.startChat,actionPath:`/chat`}}function Q(e){let t=(0,I.c)(46),{tier:n,issueCount:r,onRunDoctor:a,ready:c,doctorRunning:u,doctorRunState:d}=e,p=l(ge),m,h,g,_,v,y,b,x,S;if(t[0]!==r||t[1]!==p||t[2]!==n){h=s(p).setupStatus;let e=Z(n,h),a=e.icon,o=`targetId`in e&&typeof e.targetId==`string`?e.targetId:null,c=`actionPath`in e&&typeof e.actionPath==`string`?e.actionPath:`/chat`;m=o?(0,J.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(o)?.scrollIntoView({block:`start`,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}),className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,J.jsx)(w,{className:`size-4`,"aria-hidden":!0})]}):(0,J.jsxs)(i,{to:c,className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,J.jsx)(w,{className:`size-4`,"aria-hidden":!0})]}),S=f(`rounded-xl p-4`,e.className),x=`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,y=`flex min-w-0 gap-3`,b=(0,J.jsx)(a,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),g=`min-w-0`,_=(0,J.jsx)(`h2`,{className:`text-base font-semibold`,children:e.title}),v=r>0?(0,J.jsx)(`p`,{className:`mt-1 text-sm opacity-80`,children:h.health.issueCount.replace(`{{count}}`,String(r))}):null,t[0]=r,t[1]=p,t[2]=n,t[3]=m,t[4]=h,t[5]=g,t[6]=_,t[7]=v,t[8]=y,t[9]=b,t[10]=x,t[11]=S}else m=t[3],h=t[4],g=t[5],_=t[6],v=t[7],y=t[8],b=t[9],x=t[10],S=t[11];let C;t[12]!==g||t[13]!==_||t[14]!==v?(C=(0,J.jsxs)(`div`,{className:g,children:[_,v]}),t[12]=g,t[13]=_,t[14]=v,t[15]=C):C=t[15];let T;t[16]!==y||t[17]!==b||t[18]!==C?(T=(0,J.jsxs)(`div`,{className:y,children:[b,C]}),t[16]=y,t[17]=b,t[18]=C,t[19]=T):T=t[19];let E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=f(`inline-flex items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,O.press),t[20]=E):E=t[20];let D=!c||u,k;t[21]===u?k=t[22]:(k=u?(0,J.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[21]=u,t[22]=k);let A=u?h.health.runDoctorRunning:h.health.runDoctor,j;t[23]!==u||t[24]!==a||t[25]!==D||t[26]!==k||t[27]!==A?(j=(0,J.jsxs)(`button`,{type:`button`,className:E,onClick:a,disabled:D,"aria-busy":u,children:[k,A]}),t[23]=u,t[24]=a,t[25]=D,t[26]=k,t[27]=A,t[28]=j):j=t[28];let M;t[29]!==m||t[30]!==j?(M=(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[m,j]}),t[29]=m,t[30]=j,t[31]=M):M=t[31];let N;t[32]!==M||t[33]!==x||t[34]!==T?(N=(0,J.jsxs)(`div`,{className:x,children:[T,M]}),t[32]=M,t[33]=x,t[34]=T,t[35]=N):N=t[35];let P;t[36]!==d||t[37]!==u||t[38]!==h.health.doctorCompleteMessage||t[39]!==h.health.doctorFailedMessage||t[40]!==h.health.doctorRunningMessage?(P=u||d!==`idle`?(0,J.jsx)(`p`,{className:`mt-3 text-xs opacity-75`,role:`status`,"aria-live":`polite`,children:u?h.health.doctorRunningMessage:d===`success`?h.health.doctorCompleteMessage:h.health.doctorFailedMessage}):null,t[36]=d,t[37]=u,t[38]=h.health.doctorCompleteMessage,t[39]=h.health.doctorFailedMessage,t[40]=h.health.doctorRunningMessage,t[41]=P):P=t[41];let F;return t[42]!==N||t[43]!==P||t[44]!==S?(F=(0,J.jsxs)(`section`,{className:S,children:[N,P]}),t[42]=N,t[43]=P,t[44]=S,t[45]=F):F=t[45],F}function ge(e){return e.language}function $(e){let t=(0,I.c)(26),{issue:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=X(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,J.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=s);let c;t[4]===n.label?c=t[5]:(c=(0,J.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:n.label}),t[4]=n.label,t[5]=c);let l;t[6]===n.message?l=t[7]:(l=(0,J.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=l);let u;t[8]===n.hints[0]?u=t[9]:(u=n.hints[0]?(0,J.jsx)(`span`,{className:`mt-1 block truncate text-xs text-fg-subtle`,children:n.hints[0]}):null,t[8]=n.hints[0],t[9]=u);let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]!==r||t[15]!==n.path?(f=n.path?(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg`,children:[r,(0,J.jsx)(w,{className:`size-4`,"aria-hidden":!0})]}):null,t[14]=r,t[15]=n.path,t[16]=f):f=t[16];let p;t[17]!==s||t[18]!==d||t[19]!==f?(p=(0,J.jsxs)(J.Fragment,{children:[s,d,f]}),t[17]=s,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m=p;if(n.path){let e;return t[21]!==m||t[22]!==n.path?(e=(0,J.jsx)(i,{to:n.path,className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:m}),t[21]=m,t[22]=n.path,t[23]=e):e=t[23],e}let h;return t[24]===m?h=t[25]:(h=(0,J.jsx)(`div`,{className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`,children:m}),t[24]=m,t[25]=h),h}function _e(e){let t=(0,I.c)(27),{item:n,labels:r}=e,a;t[0]===n.status?a=t[1]:(a=X(n.status),t[0]=n.status,t[1]=a);let o=a,s=r[n.id]??n.title,c;t[2]===n.status?c=t[3]:(c=f(`flex size-7 shrink-0 items-center justify-center rounded-full border`,Y(n.status)),t[2]=n.status,t[3]=c);let l;t[4]===o?l=t[5]:(l=(0,J.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t[4]=o,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,J.jsx)(`span`,{className:c,children:l}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===s?d=t[10]:(d=(0,J.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:s}),t[9]=s,t[10]=d);let p;t[11]===n.detail?p=t[12]:(p=(0,J.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.detail}),t[11]=n.detail,t[12]=p);let m;t[13]!==d||t[14]!==p?(m=(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,p]}),t[13]=d,t[14]=p,t[15]=m):m=t[15];let h;t[16]===n.path?h=t[17]:(h=n.path?(0,J.jsx)(w,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[16]=n.path,t[17]=h);let g;t[18]!==u||t[19]!==m||t[20]!==h?(g=(0,J.jsxs)(J.Fragment,{children:[u,m,h]}),t[18]=u,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _=g;if(n.path){let e;return t[22]!==_||t[23]!==n.path?(e=(0,J.jsx)(i,{to:n.path,className:`flex items-center gap-3 rounded-lg p-3 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:_}),t[22]=_,t[23]=n.path,t[24]=e):e=t[24],e}let v;return t[25]===_?v=t[26]:(v=(0,J.jsx)(`div`,{className:`flex items-center gap-3 rounded-lg p-3`,children:_}),t[25]=_,t[26]=v),v}function ve(e){let t=(0,I.c)(23),{signal:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=X(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,J.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=s);let c;t[4]===n.label?c=t[5]:(c=(0,J.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.label}),t[4]=n.label,t[5]=c);let l;t[6]===n.message?l=t[7]:(l=(0,J.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=l);let u;t[8]!==c||t[9]!==l?(u=(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==r||t[12]!==n.path?(d=n.path?(0,J.jsx)(`span`,{className:`sr-only`,children:r}):null,t[11]=r,t[12]=n.path,t[13]=d):d=t[13];let f;t[14]!==s||t[15]!==u||t[16]!==d?(f=(0,J.jsxs)(J.Fragment,{children:[s,u,d]}),t[14]=s,t[15]=u,t[16]=d,t[17]=f):f=t[17];let p=f;if(n.path){let e;return t[18]!==p||t[19]!==n.path?(e=(0,J.jsx)(i,{to:n.path,className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:p}),t[18]=p,t[19]=n.path,t[20]=e):e=t[20],e}let m;return t[21]===p?m=t[22]:(m=(0,J.jsx)(`div`,{className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:p}),t[21]=p,t[22]=m),m}function ye(){let e=s(l(e=>e.language)).setupStatus,{ready:t,error:n,snapshot:r,refresh:i}=q(),[a,o]=(0,F.useState)(!1),[c,u]=(0,F.useState)(`idle`),d=r?.diagnosticSignals.filter(e=>e.status===`fail`||e.status===`warn`)??[],f=async()=>{if(!(a||!t)){o(!0),u(`idle`);try{await i(),u(`success`)}catch{u(`error`)}finally{o(!1)}}};return(0,J.jsxs)(A,{gap:`gap-6`,children:[(0,J.jsx)(k,{title:e.title}),n?(0,J.jsx)(`p`,{className:`rounded-xl border border-red-300/40 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300`,children:e.loadError}):null,!t||!r?(0,J.jsx)(j,{sections:2}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{tier:r.healthTier,issueCount:r.issues.length,ready:t,onRunDoctor:()=>void f(),doctorRunning:a,doctorRunState:c}),(0,J.jsxs)(N,{id:`next-steps`,children:[(0,J.jsx)(M,{icon:r.issues.length?x:y,title:e.nextStepsTitle}),r.issues.length?(0,J.jsx)(`div`,{className:`mt-4 flex flex-col gap-2`,children:r.issues.slice(0,8).map(t=>(0,J.jsx)($,{issue:t,fixLabel:e.fixIssue},`${t.source}:${t.id}`))}):(0,J.jsx)(`div`,{className:`mt-4 rounded-lg bg-surface-panel/80 shadow-surface`,children:r.readiness.map(t=>(0,J.jsx)(_e,{item:t,labels:e.readinessLabels},t.id))})]}),(0,J.jsx)(P,{children:(0,J.jsxs)(N,{children:[(0,J.jsx)(M,{icon:b,title:e.diagnosticsTitle}),d.length?(0,J.jsx)(`div`,{className:`mt-4 grid gap-2 md:grid-cols-2`,children:d.map(t=>(0,J.jsx)(ve,{signal:t,fixLabel:e.fixIssue},t.id))}):(0,J.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-panel/80 p-3 text-sm text-fg-muted shadow-surface`,children:r.diagnosticSignals.length?e.diagnosticsAllClear:e.diagnosticsEmpty})]})})]})]})}export{ye as SetupStatusPanel};
@@ -1 +0,0 @@
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-Cq1tE_3b.js";import{a,n as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{t as d}from"./check-DUBLcKHA.js";import{n as f,r as p}from"./popover-select-CKBYnT3c.js";import{t as m}from"./copy-Dv6d4Dvw.js";import{t as h}from"./loader-circle-CifKLtgG.js";import{t as g}from"./plus-Q2yW6OE7.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./copy-to-clipboard-HOJ79TWv.js";import{t as y}from"./messages-BRjoarIr.js";import{a as b,n as x,r as S,s as C}from"./locale-store-BQ2HKTWb.js";import{t as w}from"./cn-JdwAhgNB.js";import{i as ee}from"./vendor-swr-BIWyz7Rc.js";import{t as T}from"./button-B11EPpor.js";import{n as E,r as D}from"./gateway-config-swr-bjzk_4hn.js";import{t as O}from"./skeleton-BwbyijEw.js";import{$l as k,Ci as A,Di as j,Ei as M,Gi as N,Il as P,Oi as F,Ql as I,Si as L,Ta as R,Ti as z,Ui as B,Wc as V,Ws as H,Zs as U,an as W,bc as te,bo as G,di as ne,gi as K,hi as re,jl as ie,li as ae,mi as oe,mu as se,nn as ce,pi as le,vi as ue,wi as de,xi as fe,xl as pe,yi as me,yt as he}from"./index-CfyyA9-g.js";import{n as ge,r as _e,t as ve}from"./settings-page-layout-DYelDcMV.js";import{t as ye}from"./settings-loading-skeleton-CAmWMaOT.js";import{t as q}from"./settings-form-section-Cem6L49Y.js";import{t as be}from"./page-tabs-BfV-PQa5.js";var J=e(t(),1),xe=n(),Y={enabled:!0,defaultTtlHours:24,maxTtlDays:30,maxActiveShares:500,maxFileSizeMb:500,directoryMaxFolderSizeMb:2048,directoryMaxFileCount:1e4,inlinePreviewMimes:[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`application/pdf`,`text/html`,`text/markdown`,`text/plain`,`application/json`],noteEnabled:!0,noteMaxTotalSizeMb:250,noteMaxAttachmentCount:50,siteEnabled:!0,siteDefaultTtlHours:24,siteMaxTtlDays:30,maxActiveSites:50,siteMaxRootDirSizeMb:1024,siteMaxFileCount:2e4};function Se(){return structuredClone(Y)}var X=36e5,Z=864e5,Q=1048576;function Ce(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function we(e,t=32){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function Te(e){let t=Ce(e)?e:{},n=Ce(t.gateway)?t.gateway:{},r=Ce(n.share)?n.share:{},i=Ce(r.directory)?r.directory:{},a=Ce(r.note)?r.note:{},o=Ce(n.siteShare)?n.siteShare:{},s=Ce(o.static)?o.static:{},c=typeof r.defaultTtlMs==`number`&&Number.isFinite(r.defaultTtlMs)?Math.floor(r.defaultTtlMs):Y.defaultTtlHours*X,l=typeof r.maxTtlMs==`number`&&Number.isFinite(r.maxTtlMs)?Math.floor(r.maxTtlMs):Y.maxTtlDays*Z,u=typeof r.maxFileSize==`number`&&Number.isFinite(r.maxFileSize)?Math.floor(r.maxFileSize):Y.maxFileSizeMb*Q,d=typeof i.maxFolderSize==`number`&&Number.isFinite(i.maxFolderSize)?Math.floor(i.maxFolderSize):Y.directoryMaxFolderSizeMb*Q,f=typeof o.defaultTtlMs==`number`&&Number.isFinite(o.defaultTtlMs)?Math.floor(o.defaultTtlMs):Y.siteDefaultTtlHours*X,p=typeof o.maxTtlMs==`number`&&Number.isFinite(o.maxTtlMs)?Math.floor(o.maxTtlMs):Y.siteMaxTtlDays*Z,m=typeof s.maxRootDirSize==`number`&&Number.isFinite(s.maxRootDirSize)?Math.floor(s.maxRootDirSize):Y.siteMaxRootDirSizeMb*Q,h=typeof a.maxTotalSize==`number`&&Number.isFinite(a.maxTotalSize)?Math.floor(a.maxTotalSize):Y.noteMaxTotalSizeMb*Q;return{enabled:r.enabled!==!1,defaultTtlHours:Math.max(1,Math.round(c/X)),maxTtlDays:Math.max(1,Math.round(l/Z)),maxActiveShares:typeof r.maxActiveShares==`number`&&Number.isFinite(r.maxActiveShares)?Math.max(1,Math.min(1e4,Math.floor(r.maxActiveShares))):Y.maxActiveShares,maxFileSizeMb:Math.max(1,Math.round(u/Q)),directoryMaxFolderSizeMb:Math.max(1,Math.round(d/Q)),directoryMaxFileCount:typeof i.maxFileCount==`number`&&Number.isFinite(i.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(i.maxFileCount))):Y.directoryMaxFileCount,inlinePreviewMimes:we(r.inlinePreviewMimes,32).length?we(r.inlinePreviewMimes,32):[...Y.inlinePreviewMimes],noteEnabled:a.enabled!==!1,noteMaxTotalSizeMb:Math.max(1,Math.round(h/Q)),noteMaxAttachmentCount:typeof a.maxAttachmentCount==`number`&&Number.isFinite(a.maxAttachmentCount)?Math.max(0,Math.min(500,Math.floor(a.maxAttachmentCount))):Y.noteMaxAttachmentCount,siteEnabled:o.enabled!==!1,siteDefaultTtlHours:Math.max(1,Math.round(f/X)),siteMaxTtlDays:Math.max(1,Math.round(p/Z)),maxActiveSites:typeof o.maxActiveSites==`number`&&Number.isFinite(o.maxActiveSites)?Math.max(1,Math.min(1e3,Math.floor(o.maxActiveSites))):Y.maxActiveSites,siteMaxRootDirSizeMb:Math.max(1,Math.round(m/Q)),siteMaxFileCount:typeof s.maxFileCount==`number`&&Number.isFinite(s.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(s.maxFileCount))):Y.siteMaxFileCount}}function Ee(e){let t=e.defaultTtlHours*X,n=e.maxTtlDays*Z,r=e.siteDefaultTtlHours*X,i=e.siteMaxTtlDays*Z;return t<6e4||t>6048e5?`Default share TTL must be between 1 minute and 7 days.`:n<6e4||n>2592e6?`Maximum share TTL must be between 1 minute and 30 days.`:t>n?`Default TTL cannot exceed maximum TTL.`:e.maxActiveShares<1||e.maxActiveShares>1e4?`Maximum active shares must be between 1 and 10,000.`:e.maxActiveSites<1||e.maxActiveSites>1e3?`Maximum active site shares must be between 1 and 1,000.`:e.maxFileSizeMb<1||e.maxFileSizeMb>10240?`Maximum file size must be between 1 MB and 10 GB.`:e.directoryMaxFolderSizeMb<1||e.directoryMaxFolderSizeMb>10240?`Maximum folder size must be between 1 MB and 10 GB.`:e.directoryMaxFileCount<1||e.directoryMaxFileCount>1e5?`Maximum directory file count must be between 1 and 100,000.`:e.noteMaxTotalSizeMb<1||e.noteMaxTotalSizeMb>2048?`Maximum Note snapshot size must be between 1 MB and 2 GB.`:e.noteMaxAttachmentCount<0||e.noteMaxAttachmentCount>500?`Maximum Note attachment count must be between 0 and 500.`:r<6e4||r>6048e5?`Default site share TTL must be between 1 minute and 7 days.`:i<6e4||i>2592e6?`Maximum site share TTL must be between 1 minute and 30 days.`:r>i?`Default site TTL cannot exceed maximum site TTL.`:e.siteMaxRootDirSizeMb<1||e.siteMaxRootDirSizeMb>10240?`Maximum static site size must be between 1 MB and 10 GB.`:e.siteMaxFileCount<1||e.siteMaxFileCount>1e5?`Maximum static site file count must be between 1 and 100,000.`:null}async function De(e){let t=Ee(e);if(t)throw Error(t);await b(S(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{share:{enabled:e.enabled,defaultTtlMs:e.defaultTtlHours*X,maxTtlMs:e.maxTtlDays*Z,maxActiveShares:e.maxActiveShares,maxFileSize:e.maxFileSizeMb*Q,inlinePreviewMimes:e.inlinePreviewMimes,directory:{maxFolderSize:e.directoryMaxFolderSizeMb*Q,maxFileCount:e.directoryMaxFileCount},note:{enabled:e.noteEnabled,maxTotalSize:e.noteMaxTotalSizeMb*Q,maxAttachmentCount:e.noteMaxAttachmentCount}},siteShare:{enabled:e.siteEnabled,defaultTtlMs:e.siteDefaultTtlHours*X,maxTtlMs:e.siteMaxTtlDays*Z,maxActiveSites:e.maxActiveSites,static:{maxRootDirSize:e.siteMaxRootDirSizeMb*Q,maxFileCount:e.siteMaxFileCount}}}})}),E()}var $=r();function Oe(){return w(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,G,`dark:border-edge`)}function ke({hasToken:e}){let t=y(x(e=>e.language)).sharesSettings,{data:n,isLoading:r}=D(e),i=(0,J.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(Te(n.payload.config)),[n]),a=(0,J.useRef)(!1),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(!1),m=o??i,h=i,g=(0,J.useMemo)(()=>!m||!h?!1:JSON.stringify(m)!==JSON.stringify(h),[m,h]),_=(0,J.useCallback)(e=>{a.current=!0,s(t=>{let n=t??h;return n?{...n,...e}:null})},[h]),v=(0,J.useCallback)(async()=>{if(!(!m||c)){l(!0),d(null),p(!1);try{await De(m),a.current=!1,s(null),p(!0),window.setTimeout(()=>p(!1),2500)}catch(e){d(e instanceof Error?e.message:t.policySaveError)}finally{l(!1)}}},[m,c,t.policySaveError]),b=(0,J.useCallback)(()=>{a.current=!1,s(null),d(null),p(!1)},[]);return!e||!m?r?(0,$.jsx)(q,{children:(0,$.jsx)(ye,{rows:2})}):null:(0,$.jsxs)(q,{children:[(0,$.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.policyTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.policyHint})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[f?(0,$.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.policySaved}):null,(0,$.jsx)(T,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>_(Se()),children:t.policyUseRecommended}),(0,$.jsx)(T,{type:`button`,variant:`secondary`,disabled:!g||c,onClick:b,children:t.policyDiscard}),(0,$.jsx)(T,{type:`button`,variant:`primary`,disabled:!g||c,onClick:()=>void v(),children:c?t.policySaving:t.policySave})]})]}),g?(0,$.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:t.policyUnsaved}):null,u?(0,$.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:u}):null,(0,$.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:t.policyRestartHint}),(0,$.jsx)(Ae,{t,form:m,onChange:_})]})}function Ae(e){let t=(0,xe.c)(189),{t:n,form:r,onChange:i}=e,a;t[0]===n.policyFileSection?a=t[1]:(a=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyFileSection}),t[0]=n.policyFileSection,t[1]=a);let o;t[2]===n.policyFileSectionHint?o=t[3]:(o=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyFileSectionHint}),t[2]=n.policyFileSectionHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,$.jsxs)(`div`,{className:`mb-4`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.policyEnabled||t[13]!==l?(u=(0,$.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.policyEnabled]}),t[12]=n.policyEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({defaultTtlHours:e}),t[15]=i,t[16]=f);let p;t[17]!==r.defaultTtlHours||t[18]!==n.policyDefaultTtlHint||t[19]!==n.policyDefaultTtlHours||t[20]!==d||t[21]!==f?(p=(0,$.jsx)(je,{id:`share-default-ttl-hours`,label:n.policyDefaultTtlHours,hint:n.policyDefaultTtlHint,value:r.defaultTtlHours,min:1,max:168,disabled:d,onChange:f}),t[17]=r.defaultTtlHours,t[18]=n.policyDefaultTtlHint,t[19]=n.policyDefaultTtlHours,t[20]=d,t[21]=f,t[22]=p):p=t[22];let m=!r.enabled,h;t[23]===i?h=t[24]:(h=e=>i({maxTtlDays:e}),t[23]=i,t[24]=h);let g;t[25]!==r.maxTtlDays||t[26]!==n.policyMaxTtlDays||t[27]!==n.policyMaxTtlHint||t[28]!==m||t[29]!==h?(g=(0,$.jsx)(je,{id:`share-max-ttl-days`,label:n.policyMaxTtlDays,hint:n.policyMaxTtlHint,value:r.maxTtlDays,min:1,max:30,disabled:m,onChange:h}),t[25]=r.maxTtlDays,t[26]=n.policyMaxTtlDays,t[27]=n.policyMaxTtlHint,t[28]=m,t[29]=h,t[30]=g):g=t[30];let _=!r.enabled,v;t[31]===i?v=t[32]:(v=e=>i({maxActiveShares:e}),t[31]=i,t[32]=v);let y;t[33]!==r.maxActiveShares||t[34]!==n.policyMaxActiveShares||t[35]!==n.policyMaxActiveSharesHint||t[36]!==_||t[37]!==v?(y=(0,$.jsx)(je,{id:`share-max-active`,label:n.policyMaxActiveShares,hint:n.policyMaxActiveSharesHint,value:r.maxActiveShares,min:1,max:1e4,disabled:_,onChange:v}),t[33]=r.maxActiveShares,t[34]=n.policyMaxActiveShares,t[35]=n.policyMaxActiveSharesHint,t[36]=_,t[37]=v,t[38]=y):y=t[38];let b=!r.enabled,x;t[39]===i?x=t[40]:(x=e=>i({maxFileSizeMb:e}),t[39]=i,t[40]=x);let S;t[41]!==r.maxFileSizeMb||t[42]!==n.policyMaxFileSizeHint||t[43]!==n.policyMaxFileSizeMb||t[44]!==b||t[45]!==x?(S=(0,$.jsx)(je,{id:`share-max-file-mb`,label:n.policyMaxFileSizeMb,hint:n.policyMaxFileSizeHint,value:r.maxFileSizeMb,min:1,max:10240,disabled:b,onChange:x}),t[41]=r.maxFileSizeMb,t[42]=n.policyMaxFileSizeHint,t[43]=n.policyMaxFileSizeMb,t[44]=b,t[45]=x,t[46]=S):S=t[46];let C=!r.enabled,w;t[47]===i?w=t[48]:(w=e=>i({directoryMaxFolderSizeMb:e}),t[47]=i,t[48]=w);let ee;t[49]!==r.directoryMaxFolderSizeMb||t[50]!==n.policyDirectoryMaxFolderSizeHint||t[51]!==n.policyDirectoryMaxFolderSizeMb||t[52]!==C||t[53]!==w?(ee=(0,$.jsx)(je,{id:`share-directory-max-size-mb`,label:n.policyDirectoryMaxFolderSizeMb,hint:n.policyDirectoryMaxFolderSizeHint,value:r.directoryMaxFolderSizeMb,min:1,max:10240,disabled:C,onChange:w}),t[49]=r.directoryMaxFolderSizeMb,t[50]=n.policyDirectoryMaxFolderSizeHint,t[51]=n.policyDirectoryMaxFolderSizeMb,t[52]=C,t[53]=w,t[54]=ee):ee=t[54];let T=!r.enabled,E;t[55]===i?E=t[56]:(E=e=>i({directoryMaxFileCount:e}),t[55]=i,t[56]=E);let D;t[57]!==r.directoryMaxFileCount||t[58]!==n.policyDirectoryMaxFileCount||t[59]!==n.policyDirectoryMaxFileCountHint||t[60]!==T||t[61]!==E?(D=(0,$.jsx)(je,{id:`share-directory-max-files`,label:n.policyDirectoryMaxFileCount,hint:n.policyDirectoryMaxFileCountHint,value:r.directoryMaxFileCount,min:1,max:1e5,disabled:T,onChange:E}),t[57]=r.directoryMaxFileCount,t[58]=n.policyDirectoryMaxFileCount,t[59]=n.policyDirectoryMaxFileCountHint,t[60]=T,t[61]=E,t[62]=D):D=t[62];let O;t[63]!==g||t[64]!==y||t[65]!==S||t[66]!==ee||t[67]!==D||t[68]!==p?(O=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[p,g,y,S,ee,D]}),t[63]=g,t[64]=y,t[65]=S,t[66]=ee,t[67]=D,t[68]=p,t[69]=O):O=t[69];let k=!r.enabled,A;t[70]===i?A=t[71]:(A=e=>i({inlinePreviewMimes:e}),t[70]=i,t[71]=A);let j;t[72]!==r.inlinePreviewMimes||t[73]!==n||t[74]!==k||t[75]!==A?(j=(0,$.jsx)(Me,{t:n,values:r.inlinePreviewMimes,disabled:k,onChange:A}),t[72]=r.inlinePreviewMimes,t[73]=n,t[74]=k,t[75]=A,t[76]=j):j=t[76];let M;t[77]!==O||t[78]!==j||t[79]!==s||t[80]!==u?(M=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[s,u,O,j]}),t[77]=O,t[78]=j,t[79]=s,t[80]=u,t[81]=M):M=t[81];let N;t[82]===n.policyNoteSection?N=t[83]:(N=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyNoteSection}),t[82]=n.policyNoteSection,t[83]=N);let P;t[84]===n.policyNoteSectionHint?P=t[85]:(P=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyNoteSectionHint}),t[84]=n.policyNoteSectionHint,t[85]=P);let F;t[86]!==N||t[87]!==P?(F=(0,$.jsxs)(`div`,{className:`mb-4`,children:[N,P]}),t[86]=N,t[87]=P,t[88]=F):F=t[88];let I;t[89]===i?I=t[90]:(I=e=>i({noteEnabled:e.target.checked}),t[89]=i,t[90]=I);let L;t[91]!==r.noteEnabled||t[92]!==I?(L=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.noteEnabled,onChange:I}),t[91]=r.noteEnabled,t[92]=I,t[93]=L):L=t[93];let R;t[94]!==n.policyNoteEnabled||t[95]!==L?(R=(0,$.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[L,n.policyNoteEnabled]}),t[94]=n.policyNoteEnabled,t[95]=L,t[96]=R):R=t[96];let z=!r.enabled||!r.noteEnabled,B;t[97]===i?B=t[98]:(B=e=>i({noteMaxTotalSizeMb:e}),t[97]=i,t[98]=B);let V;t[99]!==r.noteMaxTotalSizeMb||t[100]!==n.policyNoteMaxTotalSizeHint||t[101]!==n.policyNoteMaxTotalSizeMb||t[102]!==z||t[103]!==B?(V=(0,$.jsx)(je,{id:`share-note-max-size-mb`,label:n.policyNoteMaxTotalSizeMb,hint:n.policyNoteMaxTotalSizeHint,value:r.noteMaxTotalSizeMb,min:1,max:2048,disabled:z,onChange:B}),t[99]=r.noteMaxTotalSizeMb,t[100]=n.policyNoteMaxTotalSizeHint,t[101]=n.policyNoteMaxTotalSizeMb,t[102]=z,t[103]=B,t[104]=V):V=t[104];let H=!r.enabled||!r.noteEnabled,U;t[105]===i?U=t[106]:(U=e=>i({noteMaxAttachmentCount:e}),t[105]=i,t[106]=U);let W;t[107]!==r.noteMaxAttachmentCount||t[108]!==n.policyNoteMaxAttachmentCount||t[109]!==n.policyNoteMaxAttachmentCountHint||t[110]!==H||t[111]!==U?(W=(0,$.jsx)(je,{id:`share-note-max-attachments`,label:n.policyNoteMaxAttachmentCount,hint:n.policyNoteMaxAttachmentCountHint,value:r.noteMaxAttachmentCount,min:0,max:500,disabled:H,onChange:U}),t[107]=r.noteMaxAttachmentCount,t[108]=n.policyNoteMaxAttachmentCount,t[109]=n.policyNoteMaxAttachmentCountHint,t[110]=H,t[111]=U,t[112]=W):W=t[112];let te;t[113]!==V||t[114]!==W?(te=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[V,W]}),t[113]=V,t[114]=W,t[115]=te):te=t[115];let G;t[116]!==F||t[117]!==R||t[118]!==te?(G=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[F,R,te]}),t[116]=F,t[117]=R,t[118]=te,t[119]=G):G=t[119];let ne;t[120]===n.policySiteSection?ne=t[121]:(ne=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policySiteSection}),t[120]=n.policySiteSection,t[121]=ne);let K;t[122]===n.policySiteSectionHint?K=t[123]:(K=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policySiteSectionHint}),t[122]=n.policySiteSectionHint,t[123]=K);let re;t[124]!==ne||t[125]!==K?(re=(0,$.jsxs)(`div`,{className:`mb-4`,children:[ne,K]}),t[124]=ne,t[125]=K,t[126]=re):re=t[126];let ie;t[127]===i?ie=t[128]:(ie=e=>i({siteEnabled:e.target.checked}),t[127]=i,t[128]=ie);let ae;t[129]!==r.siteEnabled||t[130]!==ie?(ae=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.siteEnabled,onChange:ie}),t[129]=r.siteEnabled,t[130]=ie,t[131]=ae):ae=t[131];let oe;t[132]!==n.policySiteEnabled||t[133]!==ae?(oe=(0,$.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[ae,n.policySiteEnabled]}),t[132]=n.policySiteEnabled,t[133]=ae,t[134]=oe):oe=t[134];let se=!r.siteEnabled,ce;t[135]===i?ce=t[136]:(ce=e=>i({siteDefaultTtlHours:e}),t[135]=i,t[136]=ce);let le;t[137]!==r.siteDefaultTtlHours||t[138]!==n.policySiteDefaultTtlHint||t[139]!==n.policySiteDefaultTtlHours||t[140]!==se||t[141]!==ce?(le=(0,$.jsx)(je,{id:`site-share-default-ttl-hours`,label:n.policySiteDefaultTtlHours,hint:n.policySiteDefaultTtlHint,value:r.siteDefaultTtlHours,min:1,max:168,disabled:se,onChange:ce}),t[137]=r.siteDefaultTtlHours,t[138]=n.policySiteDefaultTtlHint,t[139]=n.policySiteDefaultTtlHours,t[140]=se,t[141]=ce,t[142]=le):le=t[142];let ue=!r.siteEnabled,de;t[143]===i?de=t[144]:(de=e=>i({siteMaxTtlDays:e}),t[143]=i,t[144]=de);let fe;t[145]!==r.siteMaxTtlDays||t[146]!==n.policySiteMaxTtlDays||t[147]!==n.policySiteMaxTtlHint||t[148]!==ue||t[149]!==de?(fe=(0,$.jsx)(je,{id:`site-share-max-ttl-days`,label:n.policySiteMaxTtlDays,hint:n.policySiteMaxTtlHint,value:r.siteMaxTtlDays,min:1,max:30,disabled:ue,onChange:de}),t[145]=r.siteMaxTtlDays,t[146]=n.policySiteMaxTtlDays,t[147]=n.policySiteMaxTtlHint,t[148]=ue,t[149]=de,t[150]=fe):fe=t[150];let pe=!r.siteEnabled,me;t[151]===i?me=t[152]:(me=e=>i({maxActiveSites:e}),t[151]=i,t[152]=me);let he;t[153]!==r.maxActiveSites||t[154]!==n.policyMaxActiveSites||t[155]!==n.policyMaxActiveSitesHint||t[156]!==pe||t[157]!==me?(he=(0,$.jsx)(je,{id:`site-share-max-active`,label:n.policyMaxActiveSites,hint:n.policyMaxActiveSitesHint,value:r.maxActiveSites,min:1,max:1e3,disabled:pe,onChange:me}),t[153]=r.maxActiveSites,t[154]=n.policyMaxActiveSites,t[155]=n.policyMaxActiveSitesHint,t[156]=pe,t[157]=me,t[158]=he):he=t[158];let ge=!r.siteEnabled,_e;t[159]===i?_e=t[160]:(_e=e=>i({siteMaxRootDirSizeMb:e}),t[159]=i,t[160]=_e);let ve;t[161]!==r.siteMaxRootDirSizeMb||t[162]!==n.policySiteMaxRootDirSizeHint||t[163]!==n.policySiteMaxRootDirSizeMb||t[164]!==ge||t[165]!==_e?(ve=(0,$.jsx)(je,{id:`site-share-max-root-size-mb`,label:n.policySiteMaxRootDirSizeMb,hint:n.policySiteMaxRootDirSizeHint,value:r.siteMaxRootDirSizeMb,min:1,max:10240,disabled:ge,onChange:_e}),t[161]=r.siteMaxRootDirSizeMb,t[162]=n.policySiteMaxRootDirSizeHint,t[163]=n.policySiteMaxRootDirSizeMb,t[164]=ge,t[165]=_e,t[166]=ve):ve=t[166];let ye=!r.siteEnabled,q;t[167]===i?q=t[168]:(q=e=>i({siteMaxFileCount:e}),t[167]=i,t[168]=q);let be;t[169]!==r.siteMaxFileCount||t[170]!==n.policySiteMaxFileCount||t[171]!==n.policySiteMaxFileCountHint||t[172]!==ye||t[173]!==q?(be=(0,$.jsx)(je,{id:`site-share-max-files`,label:n.policySiteMaxFileCount,hint:n.policySiteMaxFileCountHint,value:r.siteMaxFileCount,min:1,max:1e5,disabled:ye,onChange:q}),t[169]=r.siteMaxFileCount,t[170]=n.policySiteMaxFileCount,t[171]=n.policySiteMaxFileCountHint,t[172]=ye,t[173]=q,t[174]=be):be=t[174];let J;t[175]!==le||t[176]!==fe||t[177]!==he||t[178]!==ve||t[179]!==be?(J=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[le,fe,he,ve,be]}),t[175]=le,t[176]=fe,t[177]=he,t[178]=ve,t[179]=be,t[180]=J):J=t[180];let Y;t[181]!==re||t[182]!==oe||t[183]!==J?(Y=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[re,oe,J]}),t[181]=re,t[182]=oe,t[183]=J,t[184]=Y):Y=t[184];let Se;return t[185]!==M||t[186]!==G||t[187]!==Y?(Se=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[M,G,Y]}),t[185]=M,t[186]=G,t[187]=Y,t[188]=Se):Se=t[188],Se}function je(e){let t=(0,xe.c)(21),{id:n,label:r,hint:i,value:a,min:o,max:s,disabled:c,onChange:l}=e,u;t[0]!==n||t[1]!==r?(u=(0,$.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=u):u=t[2];let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=w(Oe(),`max-w-xs font-mono text-xs`),t[3]=d):d=t[3];let f;t[4]!==s||t[5]!==o||t[6]!==l?(f=e=>{let t=Number(e.target.value);Number.isFinite(t)&&l(Math.max(o,Math.min(s,Math.floor(t))))},t[4]=s,t[5]=o,t[6]=l,t[7]=f):f=t[7];let p;t[8]!==c||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==f||t[13]!==a?(p=(0,$.jsx)(`input`,{id:n,type:`number`,min:o,max:s,disabled:c,className:d,value:a,onChange:f}),t[8]=c,t[9]=n,t[10]=s,t[11]=o,t[12]=f,t[13]=a,t[14]=p):p=t[14];let m;t[15]===i?m=t[16]:(m=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[15]=i,t[16]=m);let h;return t[17]!==u||t[18]!==p||t[19]!==m?(h=(0,$.jsxs)(`div`,{children:[u,p,m]}),t[17]=u,t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function Me(e){let t=(0,xe.c)(25),{t:n,values:r,disabled:i,onChange:a}=e,o;t[0]!==a||t[1]!==r?(o=e=>{let t=e.trim();!t||r.includes(t)||r.length>=32||a([...r,t])},t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]===n.policyInlinePreviewMimes?c=t[4]:(c=(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.policyInlinePreviewMimes}),t[3]=n.policyInlinePreviewMimes,t[4]=c);let l;t[5]===n.policyInlinePreviewMimesHint?l=t[6]:(l=(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.policyInlinePreviewMimesHint}),t[5]=n.policyInlinePreviewMimesHint,t[6]=l);let u;t[7]!==i||t[8]!==a||t[9]!==r?(u=r.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,i?null:(0,$.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,"aria-label":`Remove ${e}`,onClick:()=>a(r.filter(t=>t!==e)),children:`×`})]},e)),t[7]=i,t[8]=a,t[9]=r,t[10]=u):u=t[10];let d;t[11]===u?d=t[12]:(d=(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u}),t[11]=u,t[12]=d);let f;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(f=w(Oe(),`font-mono text-xs`),t[13]=f):f=t[13];let p=i||r.length>=32,m;t[14]===s?m=t[15]:(m=e=>{e.key===`Enter`&&(e.preventDefault(),s(e.target.value),e.target.value=``)},t[14]=s,t[15]=m);let h;t[16]!==n.policyMimePlaceholder||t[17]!==p||t[18]!==m?(h=(0,$.jsx)(`input`,{className:f,placeholder:n.policyMimePlaceholder,disabled:p,onKeyDown:m}),t[16]=n.policyMimePlaceholder,t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;return t[20]!==c||t[21]!==l||t[22]!==d||t[23]!==h?(g=(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-4`,children:[c,l,d,h]}),t[20]=c,t[21]=l,t[22]=d,t[23]=h,t[24]=g):g=t[24],g}function Ne(e){let t=(0,xe.c)(70),{open:n,onOpenChange:r,onConfirm:i,initialPath:d,selectKind:m,sessionKey:g,agentId:v}=e,b=m===void 0?`any`:m,S=y(x(Ie)),E=S.workspace,D=S.sharesSettings,O=ae(Fe),{data:k}=ee(C(Pe)?`picker-agents-list`:null,W),A;bb0:{let e;t[0]===v?e=t[1]:(e=v?.trim(),t[0]=v,t[1]=e);let n=e;if(n){A=n;break bb0}let r;t[2]===O?r=t[3]:(r=O.trim(),t[2]=O,t[3]=r);let i=r;if(i){A=i;break bb0}if(k?.defaultId){A=k.defaultId;break bb0}if(k?.agents?.[0]?.id){A=k.agents[0].id;break bb0}A=``}let j=A,[M,N]=(0,J.useState)(j),P,F;t[4]===j?(P=t[5],F=t[6]):(P=()=>{N(j)},F=[j],t[4]=j,t[5]=P,t[6]=F),(0,J.useEffect)(P,F);let{tree:I,loading:L,error:R,loadRoot:z,loadChildren:V,reset:H}=ne(M,g??null),U;t[7]===d?U=t[8]:(U=d?{path:d,isDirectory:!1}:null,t[7]=d,t[8]=U);let[G,K]=(0,J.useState)(U),re;t[9]!==d||t[10]!==z||t[11]!==n||t[12]!==H||t[13]!==K?(re=()=>{if(!n){H(),K(d?{path:d,isDirectory:!1}:null);return}z()},t[9]=d,t[10]=z,t[11]=n,t[12]=H,t[13]=K,t[14]=re):re=t[14];let oe;t[15]!==d||t[16]!==z||t[17]!==n||t[18]!==M||t[19]!==H||t[20]!==g?(oe=[n,M,g,z,H,d],t[15]=d,t[16]=z,t[17]=n,t[18]=M,t[19]=H,t[20]=g,t[21]=oe):oe=t[21],(0,J.useEffect)(re,oe);let se;t[22]===V?se=t[23]:(se=e=>{V(e)},t[22]=V,t[23]=se);let le=se,ue=G!==null&&(b===`any`||b===`file`&&!G.isDirectory||b===`directory`&&G.isDirectory),de;bb1:{if(!G){de=D.pickerHintNone;break bb1}if(b===`file`&&G.isDirectory){de=D.pickerHintNeedsFile;break bb1}if(b===`directory`&&!G.isDirectory){de=D.pickerHintNeedsDirectory;break bb1}de=`${G.isDirectory?`📁`:`📄`} ${G.path}`}let fe=de,pe=k?.agents??[],me;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,$.jsx)(a,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[24]=me):me=t[24];let he;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(he=w(`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2`,`flex h-[min(28rem,calc(100vh-3rem))] flex-col overflow-hidden rounded-lg border border-edge bg-surface-panel shadow-popover outline-none`),t[25]=he):he=t[25];let ge;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,$.jsx)(ie,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[26]=ge):ge=t[26];let _e=S.cron.refresh,ve=S.cron.refresh,ye;t[27]===z?ye=t[28]:(ye=()=>void z(),t[27]=z,t[28]=ye);let q=L&&`animate-spin`,be;t[29]===q?be=t[30]:(be=w(`size-4`,q),t[29]=q,t[30]=be);let Y;t[31]===be?Y=t[32]:(Y=(0,$.jsx)(te,{className:be,"aria-hidden":!0}),t[31]=be,t[32]=Y);let Se;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,$.jsx)(_,{className:`size-4`}),t[33]=Se):Se=t[33];let X;t[34]!==R||t[35]!==E.loadError?(X=R?(0,$.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[E.loadError,`: `,R]}):null,t[34]=R,t[35]=E.loadError,t[36]=X):X=t[36];let Z;t[37]!==le||t[38]!==L||t[39]!==G?.path||t[40]!==K||t[41]!==E.emptyDir||t[42]!==E.title||t[43]!==I?(Z=L&&I.length===0?(0,$.jsxs)(`p`,{className:`flex shrink-0 items-center gap-2 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(h,{className:`size-4 animate-spin`}),E.title,`…`]}):(0,$.jsx)(B,{tree:I,selectedPath:G?.path??null,onSelectFile:e=>K({path:e,isDirectory:!1}),onSelectEntry:(e,t)=>K({path:e,isDirectory:t}),onExpandDir:le,onAction:void 0,emptyHint:E.emptyDir}),t[37]=le,t[38]=L,t[39]=G?.path,t[40]=K,t[41]=E.emptyDir,t[42]=E.title,t[43]=I,t[44]=Z):Z=t[44];let Q;t[45]!==X||t[46]!==Z?(Q=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[X,Z]}),t[45]=X,t[46]=Z,t[47]=Q):Q=t[47];let Ce;t[48]===fe?Ce=t[49]:(Ce=(0,$.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:fe}),t[48]=fe,t[49]=Ce);let we;t[50]===r?we=t[51]:(we=()=>r(!1),t[50]=r,t[51]=we);let Te;t[52]!==D.cancel||t[53]!==we?(Te=(0,$.jsx)(T,{type:`button`,variant:`ghost`,onClick:we,children:D.cancel}),t[52]=D.cancel,t[53]=we,t[54]=Te):Te=t[54];let Ee=!ue,De;t[55]!==i||t[56]!==r||t[57]!==M||t[58]!==G?(De=()=>{G&&(i({...G,agentId:M}),r(!1))},t[55]=i,t[56]=r,t[57]=M,t[58]=G,t[59]=De):De=t[59];let Oe;t[60]!==D.pickerConfirm||t[61]!==Ee||t[62]!==De?(Oe=(0,$.jsx)(T,{type:`button`,disabled:Ee,onClick:De,children:D.pickerConfirm}),t[60]=D.pickerConfirm,t[61]=Ee,t[62]=De,t[63]=Oe):Oe=t[63];let ke;t[64]!==Te||t[65]!==Oe?(ke=(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[Te,Oe]}),t[64]=Te,t[65]=Oe,t[66]=ke):ke=t[66];let Ae;return t[67]!==Ce||t[68]!==ke?(Ae=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[Ce,ke]}),t[67]=Ce,t[68]=ke,t[69]=Ae):Ae=t[69],(0,$.jsx)(u,{open:n,onOpenChange:r,children:(0,$.jsxs)(s,{children:[me,(0,$.jsxs)(c,{className:he,children:[(0,$.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4`,children:[ge,(0,$.jsx)(l,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:D.pickerTitle}),(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,title:_e,"aria-label":ve,disabled:L,onClick:ye,children:Y}),(0,$.jsx)(o,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":E.close,children:Se})})]}),pe.length>0?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-edge px-4 py-2`,children:[(0,$.jsx)(`label`,{className:`text-xs text-fg-muted`,htmlFor:`picker-agent-select`,children:D.pickerAgentLabel}),(0,$.jsx)(f,{id:`picker-agent-select`,className:`min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-2 py-1 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:M,onChange:e=>{N(e.target.value),K(null)},children:pe.map(e=>(0,$.jsxs)(p,{value:e.id,children:[ce(e,S.agentsSettings),e.id===k?.defaultId?` ★`:``]},e.id))})]}):null,Q,Ae]})]})})}function Pe(e){return e.token}function Fe(e){return e.agentId}function Ie(e){return e.language}var Le=[`shares`,`policy`];function Re(e){let t=(e??``).trim();return Le.includes(t)?t:`shares`}function ze(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Be(e,t){let n=new Date(e).getTime()-Date.now(),r=Math.abs(n),i=n<0;if(r<6e4)return t===`zh`?`刚刚`:`just now`;let a=Math.floor(r/6e4);if(a<60){let e=t===`zh`?`${a} 分钟`:`${a}m`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let o=Math.floor(a/60);if(o<24){let e=t===`zh`?`${o} 小时`:`${o}h`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let s=Math.floor(o/24),c=t===`zh`?`${s} 天`:`${s}d`;return i?t===`zh`?`${c}前`:`${c} ago`:c}var Ve=[{value:36e5,key:`1h`},{value:216e5,key:`6h`},{value:864e5,key:`24h`},{value:2592e5,key:`3d`},{value:6048e5,key:`7d`},{value:2592e6,key:`30d`}];function He(){let e=(0,xe.c)(23),t=x(We),n=y(t).sharesSettings,r=!!C(Ue),[a,o]=i(),s;e[0]===a?s=e[1]:(s=Re(a.get(`tab`)),e[0]=a,e[1]=s);let c=s,l;e[2]===o?l=e[3]:(l=e=>{o(t=>{let n=new URLSearchParams(t);return e===`shares`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[2]=o,e[3]=l);let u=l;if(!r)return(0,$.jsx)(_e,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let d={shares:n.tabShares,policy:n.tabPolicy},f=Le.map(e=>({id:e,label:d[e]})),p;e[4]===n.title?p=e[5]:(p=(0,$.jsx)(ge,{title:n.title}),e[4]=n.title,e[5]=p);let m;e[6]!==c||e[7]!==u||e[8]!==n.tabsAria||e[9]!==f?(m=(0,$.jsx)(be,{items:f,activeTab:c,onChange:u,ariaLabel:n.tabsAria,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`}),e[6]=c,e[7]=u,e[8]=n.tabsAria,e[9]=f,e[10]=m):m=e[10];let h;e[11]!==c||e[12]!==r||e[13]!==t||e[14]!==n?(h=c===`shares`?(0,$.jsx)(Ge,{t:n,language:t}):(0,$.jsx)(ke,{hasToken:r}),e[11]=c,e[12]=r,e[13]=t,e[14]=n,e[15]=h):h=e[15];let g;e[16]!==c||e[17]!==h?(g=(0,$.jsx)(ve,{id:c,activeTab:c,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`,showHeading:!1,children:h}),e[16]=c,e[17]=h,e[18]=g):g=e[18];let _;return e[19]!==p||e[20]!==m||e[21]!==g?(_=(0,$.jsxs)(_e,{children:[p,m,g]}),e[19]=p,e[20]=m,e[21]=g,e[22]=_):_=e[22],_}function Ue(e){return e.token}function We(e){return e.language}function Ge(e){let t=(0,xe.c)(79),{t:n,language:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={refreshInterval:3e4},t[0]=i):i=t[0];let{data:a,error:o,isLoading:s,mutate:c}=ee(`shares-list`,fe,i),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:3e4},t[1]=l):l=t[1];let u=ee(`hosted-publications-list`,me,l),d;t[2]===a?.payload?.shares?d=t[3]:(d=a?.payload?.shares??[],t[2]=a?.payload?.shares,t[3]=d);let f=d,[p,m]=(0,J.useState)(!1),h;bb0:{if(p){h=f;break bb0}let e;t[4]===f?e=t[5]:(e=f.filter(Xe),t[4]=f,t[5]=e),h=e}let g=h,_;t[6]===f?_=t[7]:(_=f.filter(Ye),t[6]=f,t[7]=_);let v=_.length,y;t[8]===f?y=t[9]:(y=f.filter(Je),t[8]=f,t[9]=y);let b=y.length,x;t[10]===c?x=t[11]:(x=()=>void c(),t[10]=c,t[11]=x);let S;t[12]!==n||t[13]!==x?(S=(0,$.jsx)(nt,{t:n,onCreated:x}),t[12]=n,t[13]=x,t[14]=S):S=t[14];let C=u.data?.connected===!0,E=u.data?.publishingAllowed===!0,D;t[15]===u?D=t[16]:(D=()=>void u.mutate(),t[15]=u,t[16]=D);let O;t[17]!==r||t[18]!==E||t[19]!==D||t[20]!==C?(O=(0,$.jsx)(Ze,{language:r,connected:C,publishingAllowed:E,onCreated:D}),t[17]=r,t[18]=E,t[19]=D,t[20]=C,t[21]=O):O=t[21];let k=p?n.allSharesTitle:n.listTitle,A;t[22]===v?A=t[23]:(A=v>0&&(0,$.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:[`(`,v,`)`]}),t[22]=v,t[23]=A);let j;t[24]!==k||t[25]!==A?(j=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[k,A]}),t[24]=k,t[25]=A,t[26]=j):j=t[26];let M;t[27]===c?M=t[28]:(M=()=>void c(),t[27]=c,t[28]=M);let N=s&&`animate-spin`,P;t[29]===N?P=t[30]:(P=w(`size-3.5`,N),t[29]=N,t[30]=P);let F;t[31]===P?F=t[32]:(F=(0,$.jsx)(te,{className:P}),t[31]=P,t[32]=F);let I;t[33]!==s||t[34]!==M||t[35]!==F?(I=(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:M,disabled:s,children:F}),t[33]=s,t[34]=M,t[35]=F,t[36]=I):I=t[36];let L;t[37]!==b||t[38]!==p||t[39]!==n.hideExpired||t[40]!==n.showExpired?(L=b>0&&(0,$.jsx)(`button`,{type:`button`,className:`text-xs text-accent hover:underline`,onClick:()=>m(qe),children:p?n.hideExpired:n.showExpired}),t[37]=b,t[38]=p,t[39]=n.hideExpired,t[40]=n.showExpired,t[41]=L):L=t[41];let R;t[42]!==I||t[43]!==L?(R=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[I,L]}),t[42]=I,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==j||t[46]!==R?(z=(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[j,R]}),t[45]=j,t[46]=R,t[47]=z):z=t[47];let B;t[48]!==a||t[49]!==o||t[50]!==g||t[51]!==s||t[52]!==r||t[53]!==c||t[54]!==n?(B=s&&!a?(0,$.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:4}).map(Ke)}):o?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-red-600 dark:text-red-400`,children:[(0,$.jsx)(`span`,{children:n.error}),(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>void c(),children:n.retry})]}):g.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.emptyState}):(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:g.map(e=>(0,$.jsx)(it,{share:e,t:n,language:r,onRevoked:()=>void c(),onExtended:()=>void c()},e.id))}),t[48]=a,t[49]=o,t[50]=g,t[51]=s,t[52]=r,t[53]=c,t[54]=n,t[55]=B):B=t[55];let V;t[56]!==b||t[57]!==c||t[58]!==p||t[59]!==n?(V=b>0&&p&&(0,$.jsx)(at,{t:n,onCleaned:()=>void c()}),t[56]=b,t[57]=c,t[58]=p,t[59]=n,t[60]=V):V=t[60];let H;t[61]!==z||t[62]!==B||t[63]!==V?(H=(0,$.jsxs)(q,{children:[z,B,V]}),t[61]=z,t[62]=B,t[63]=V,t[64]=H):H=t[64];let U;t[65]===u?U=t[66]:(U=()=>void u.mutate(),t[65]=u,t[66]=U);let W;t[67]!==u.data||t[68]!==u.error||t[69]!==u.isLoading||t[70]!==r||t[71]!==n||t[72]!==U?(W=(0,$.jsx)(Qe,{data:u.data,error:u.error,isLoading:u.isLoading,language:r,t:n,onChanged:U}),t[67]=u.data,t[68]=u.error,t[69]=u.isLoading,t[70]=r,t[71]=n,t[72]=U,t[73]=W):W=t[73];let G;return t[74]!==O||t[75]!==H||t[76]!==W||t[77]!==S?(G=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[S,O,H,W]}),t[74]=O,t[75]=H,t[76]=W,t[77]=S,t[78]=G):G=t[78],G}function Ke(e,t){return(0,$.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(O,{className:`h-4 w-2/3`}),(0,$.jsx)(O,{className:`mt-2 h-3 w-1/2`})]}),(0,$.jsx)(O,{className:`h-7 w-20 rounded-md`})]})},t)}function qe(e){return!e}function Je(e){return e.expired||e.revoked}function Ye(e){return!e.expired&&!e.revoked}function Xe(e){return!e.expired&&!e.revoked}function Ze({language:e,connected:t,publishingAllowed:n,onCreated:r}){let i=e===`zh`,[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,m]=(0,J.useState)(!1),[g,_]=(0,J.useState)(``),[y,b]=(0,J.useState)(6048e5),[x,S]=(0,J.useState)(!1),[C,w]=(0,J.useState)(null),[ee,E]=(0,J.useState)(null),D=async()=>{if(a.trim()){S(!0),E(null);try{w(await oe({path:a.trim(),title:g.trim()||void 0,ttlMs:y,spaFallback:!0,...s?{agentId:s}:{}})),r()}catch(e){E(e instanceof Error?e.message:String(e))}finally{S(!1)}}};return(0,$.jsxs)(q,{children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(I,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i?`发布静态网站`:`Publish static website`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:i?`把工作区内的 HTML 文件,或包含 index.html 的网站目录,发布到隔离的托管域名。`:`Publish an HTML file or a website directory containing index.html to the isolated hosted origin.`}),t&&!n?(0,$.jsx)(`p`,{className:`mt-3 rounded-md border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning`,children:i?`管理员已暂停你的公网分享能力。已有远端链接当前不可访问;你仍可在下方撤销它们。`:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but you can still revoke them below.`}):null,(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-[1fr_12rem]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`input`,{value:a,onChange:e=>{o(e.target.value),u(!1),w(null)},placeholder:i?`选择 HTML 文件或网站目录`:`Select an HTML file or website directory`,className:`h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent`}),(0,$.jsxs)(T,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>m(!0),children:[a&&!l?(0,$.jsx)(P,{className:`size-4`}):(0,$.jsx)(ie,{className:`size-4`}),a?i?`更换`:`Change`:i?`选择`:`Browse`]})]}),(0,$.jsxs)(f,{value:String(y),onChange:e=>b(Number(e.target.value)),children:[(0,$.jsx)(p,{value:`86400000`,children:i?`24 小时`:`24 hours`}),(0,$.jsx)(p,{value:`604800000`,children:i?`7 天`:`7 days`}),(0,$.jsx)(p,{value:`2592000000`,children:i?`30 天`:`30 days`})]}),(0,$.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),placeholder:i?`网站标题(可选)`:`Site title (optional)`,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent sm:col-span-2`})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,$.jsxs)(T,{type:`button`,onClick:()=>void D(),disabled:!a.trim()||x||!t||!n,children:[x?(0,$.jsx)(h,{className:`size-4 animate-spin`}):(0,$.jsx)(I,{className:`size-4`}),x?i?`发布中…`:`Publishing…`:i?`发布网站`:`Publish site`]}),C?(0,$.jsxs)(`button`,{type:`button`,className:`min-w-0 truncate text-xs text-accent hover:underline`,onClick:()=>void v(C.shareUrl),children:[C.shareUrl,` · `,C.fileCount,` `,i?`个文件`:`files`,` · `,ze(C.totalBytes)]}):null]}),ee?(0,$.jsx)(`p`,{className:`mt-3 text-xs text-danger`,children:ee}):null]})]}),(0,$.jsx)(Ne,{open:d,onOpenChange:m,initialPath:a||void 0,agentId:s||void 0,selectKind:`any`,onConfirm:e=>{o(e.path),c(e.agentId),u(e.isDirectory),w(null),E(null)}})]})}function Qe(e){let t=(0,xe.c)(18),{data:n,error:r,isLoading:i,language:a,t:o,onChanged:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(I,{className:`size-4 text-accent`,"aria-hidden":!0}),t[0]=c):c=t[0];let l;t[1]===o.hostedTitle?l=t[2]:(l=(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[c,o.hostedTitle]}),t[1]=o.hostedTitle,t[2]=l);let u;t[3]===o.hostedHint?u=t[4]:(u=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:o.hostedHint}),t[3]=o.hostedHint,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,$.jsx)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:(0,$.jsxs)(`div`,{children:[l,u]})}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;t[8]!==n||t[9]!==r||t[10]!==i||t[11]!==a||t[12]!==s||t[13]!==o?(f=i&&!n?(0,$.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:2}).map($e)}):r?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o.error}):n?.connected?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[n.publishingAllowed?null:(0,$.jsx)(`p`,{className:`rounded-md border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning`,children:a===`zh`?`管理员已暂停公网分享。已有托管链接当前不可访问,也不能更新;撤销操作仍然可用。`:`An administrator has paused public sharing. Existing hosted links are unavailable and cannot be updated; revocation remains available.`}),n.publications.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.hostedEmpty}):(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.publications.map(e=>(0,$.jsx)(et,{publication:e,language:a,t:o,publishingAllowed:n.publishingAllowed,onChanged:s},e.id))})]}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.hostedDisconnected}),(0,$.jsx)(he,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:s})]}),t[8]=n,t[9]=r,t[10]=i,t[11]=a,t[12]=s,t[13]=o,t[14]=f):f=t[14];let p;return t[15]!==d||t[16]!==f?(p=(0,$.jsxs)(q,{children:[d,f]}),t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function $e(e,t){return(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(O,{className:`h-4 w-2/3`}),(0,$.jsx)(O,{className:`mt-2 h-3 w-1/2`})]},t)}function et({publication:e,language:t,t:n,publishingAllowed:r,onChanged:i}){let[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),[f,p]=(0,J.useState)(!1),[g,_]=(0,J.useState)(!1),y=Date.now()>=new Date(e.expiresAt).getTime(),b=e.status===`active`&&!y,x=e.status===`revoked`?n.statusRevoked:y?n.statusExpired:e.status===`staging`?t===`zh`?`准备中`:`Staging`:n.statusActive,S=e.kind===`note_document`?U:e.kind===`static_site`?I:V,C=e.kind===`note_document`?t===`zh`?`笔记文档`:`Note document`:e.kind===`static_site`?t===`zh`?`静态网站`:`Static website`:t===`zh`?`会话快照`:`Conversation snapshot`,ee=(0,J.useCallback)(async()=>{e.shareUrl&&await v(e.shareUrl)&&(u(!0),window.setTimeout(()=>u(!1),2e3))},[e.shareUrl]),E=(0,J.useCallback)(async()=>{o(!1),c(!0);try{await A(e.id),i()}catch{}finally{c(!1)}},[e.id,i]),D=(0,J.useCallback)(async()=>{if(!(!e.revision||e.revision<=1)){p(!0);try{let t=(await ue(e.id)).find(t=>t.revision<e.revision);if(!t)return;await z(e.id,e.revision,t.revision),i()}catch{}finally{p(!1)}}},[e.id,e.revision,i]),O=(0,J.useCallback)(async()=>{_(!0);try{await L(e.id),i()}catch{}finally{_(!1)}},[e.id,i]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-panel/80 px-3 py-2.5`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(S,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:w(`text-xs font-medium`,b?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`),children:x})]}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[C,` · `,n.hostedRevision,` `,e.revision??`—`,` · `,e.managedFromThisDevice?n.hostedThisDevice:n.hostedOtherDevice]}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,$.jsxs)(`span`,{children:[t===`zh`?`浏览`:`Views`,`: `,e.viewCount,e.maxViews===null?``:` / ${e.maxViews}`]}),(0,$.jsx)(`span`,{children:y?n.statusExpired:Be(e.expiresAt,t)}),e.description?(0,$.jsx)(`span`,{className:`italic`,children:e.description}):null]})]}),b?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.shareUrl?(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1`,disabled:!r,title:n.copyUrl,onClick:()=>void ee(),children:l?(0,$.jsx)(d,{className:`size-3.5 text-emerald-500`}):(0,$.jsx)(m,{className:`size-3.5`})}):null,(e.revision??0)>1?(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1`,disabled:f||!r,onClick:()=>void D(),title:t===`zh`?`回滚上一版本`:`Roll back one revision`,children:f?(0,$.jsx)(h,{className:`size-3.5 animate-spin`}):(0,$.jsx)(pe,{className:`size-3.5`})}):null,e.kind===`static_site`&&e.managedFromThisDevice?(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1`,disabled:g||!r,onClick:()=>void O(),title:t===`zh`?`发布工作区中的最新版本`:`Publish latest workspace version`,children:(0,$.jsx)(te,{className:w(`size-3.5`,g&&`animate-spin`)})}):null,(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,disabled:s,onClick:()=>o(!0),children:s?(0,$.jsx)(h,{className:`size-3.5 animate-spin`}):(0,$.jsx)(H,{className:`size-3.5`})})]}):null]})}),(0,$.jsx)(N,{open:a,title:n.revokeConfirmTitle,description:n.revokeConfirmBody,confirmLabel:n.revokeConfirmLabel,cancelLabel:n.cancel,destructive:!0,onConfirm:()=>void E(),onCancel:()=>o(!1)})]})}var tt={expanded:!0,path:``,isDirectory:!1,agentId:``,ttlMs:864e5,maxViews:null,description:``,directoryMode:`browse`,creating:!1,result:null,errorMsg:null,resultDialogOpen:!1,pickerOpen:!1};function nt({t:e,onCreated:t}){let[n,r]=(0,J.useReducer)(R,tt),{expanded:i,path:a,isDirectory:o,agentId:s,ttlMs:c,maxViews:l,description:u,directoryMode:d,creating:m,result:_,errorMsg:v,resultDialogOpen:y,pickerOpen:b}=n,x=(0,J.useCallback)(async()=>{if(a.trim()){r({type:`patch`,patch:{creating:!0,errorMsg:null,result:null}});try{r({type:`patch`,patch:{result:(await re({path:a.trim(),ttlMs:c,maxViews:l,description:u.trim()||void 0,...s?{agentId:s}:{},...o?{kind:`directory`,directoryMode:d}:{}})).payload,resultDialogOpen:!0}}),t()}catch(e){r({type:`patch`,patch:{errorMsg:e instanceof Error?e.message:String(e)}})}finally{r({type:`patch`,patch:{creating:!1}})}}},[a,o,s,c,l,u,d,t]),S=(0,J.useCallback)(()=>{r({type:`patch`,patch:{path:``,isDirectory:!1,agentId:``,description:``,maxViews:null,ttlMs:864e5,directoryMode:`browse`,result:null,errorMsg:null}})},[]);return i?(0,$.jsxs)(q,{children:[(0,$.jsx)(`h2`,{className:`mb-1 text-sm font-semibold text-fg`,children:e.createTitle}),(0,$.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:e.createHint}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.pathLabel}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:w(`flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm`,a?`text-fg`:`text-fg-subtle`),children:a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:o?`📁`:`📄`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:a,children:a})]}):(0,$.jsx)(`span`,{className:`truncate`,children:e.pathPlaceholder})}),(0,$.jsxs)(T,{type:`button`,variant:`ghost`,onClick:()=>r({type:`patch`,patch:{pickerOpen:!0}}),children:[(0,$.jsx)(P,{className:`size-4`}),a?e.pathBrowseChange:e.pathBrowse]})]})]}),o?(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.directoryModeLabel}),(0,$.jsxs)(f,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:d,onChange:e=>r({type:`patch`,patch:{directoryMode:e.target.value===`zip-only`?`zip-only`:`browse`}}),children:[(0,$.jsx)(p,{value:`browse`,children:e.directoryModeBrowse}),(0,$.jsx)(p,{value:`zip-only`,children:e.directoryModeZipOnly})]})]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.ttlLabel}),(0,$.jsx)(f,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:c,onChange:e=>r({type:`patch`,patch:{ttlMs:Number(e.target.value)}}),children:Ve.map(t=>(0,$.jsx)(p,{value:t.value,children:e.ttlOptions[t.key]},t.key))})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.maxViewsLabel}),(0,$.jsxs)(f,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:l??`unlimited`,onChange:e=>r({type:`patch`,patch:{maxViews:e.target.value===`unlimited`?null:Number(e.target.value)}}),children:[(0,$.jsx)(p,{value:`unlimited`,children:e.maxViewsUnlimited}),(0,$.jsx)(p,{value:`1`,children:`1`}),(0,$.jsx)(p,{value:`5`,children:`5`}),(0,$.jsx)(p,{value:`10`,children:`10`}),(0,$.jsx)(p,{value:`50`,children:`50`}),(0,$.jsx)(p,{value:`100`,children:`100`})]})]})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.descriptionLabel}),(0,$.jsx)(`input`,{type:`text`,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:outline-none focus:ring-2 focus:ring-accent`,placeholder:e.descriptionPlaceholder,value:u,onChange:e=>r({type:`patch`,patch:{description:e.target.value}})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,$.jsxs)(T,{type:`button`,disabled:m||!a.trim(),onClick:()=>void x(),children:[m?(0,$.jsx)(h,{className:`size-4 animate-spin`}):(0,$.jsx)(g,{className:`size-4`}),m?e.creating:e.createButton]}),(0,$.jsx)(T,{type:`button`,variant:`ghost`,onClick:()=>{S(),r({type:`patch`,patch:{expanded:!1}})},children:e.cancel})]}),v&&(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:v})]}),(0,$.jsx)(j,{open:y,onOpenChange:e=>{r({type:`patch`,patch:{resultDialogOpen:e,...e?{}:{result:null}}})},result:_}),(0,$.jsx)(Ne,{open:b,onOpenChange:e=>r({type:`patch`,patch:{pickerOpen:e}}),initialPath:a||void 0,selectKind:`any`,onConfirm:e=>r({type:`patch`,patch:{path:e.path,isDirectory:e.isDirectory,agentId:e.agentId,directoryMode:`browse`}})})]}):(0,$.jsxs)(T,{type:`button`,onClick:()=>r({type:`patch`,patch:{expanded:!0}}),className:`self-start`,children:[(0,$.jsx)(g,{className:`size-4`}),e.createTitle]})}var rt={revokeOpen:!1,revoking:!1,linksOpen:!1,urlCopied:!1,copyFailed:!1,extending:!1};function it({share:e,t,language:n,onRevoked:r,onExtended:i}){let[a,o]=(0,J.useReducer)(R,rt),{revokeOpen:s,revoking:c,linksOpen:l,urlCopied:u,copyFailed:f,extending:p}=a,g=!e.expired&&!e.revoked,_=e.revoked?t.statusRevoked:e.expired?t.statusExpired:t.statusActive,y=e.revoked?`text-red-600 dark:text-red-400`:e.expired?`text-fg-subtle`:`text-emerald-600 dark:text-emerald-400`,b=(0,J.useCallback)(async()=>{o({type:`patch`,patch:{revokeOpen:!1,revoking:!0}});try{await de(e.id),r()}catch{}finally{o({type:`patch`,patch:{revoking:!1}})}},[e.id,r]),x=(0,J.useCallback)(async()=>{if(o({type:`patch`,patch:{linksOpen:!0,copyFailed:!1}}),!await v(e.shareUrl)){o({type:`patch`,patch:{copyFailed:!0}}),window.setTimeout(()=>o({type:`patch`,patch:{copyFailed:!1}}),2500);return}o({type:`patch`,patch:{urlCopied:!0}}),window.setTimeout(()=>o({type:`patch`,patch:{urlCopied:!1}}),2e3)},[e.shareUrl]),S=(0,J.useCallback)(async()=>{o({type:`patch`,patch:{extending:!0}});try{await K(e.id,864e5),i()}catch{}finally{o({type:`patch`,patch:{extending:!1}})}},[e.id,i]),C=`share-links-${e.id}`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:w(`flex min-w-0 flex-1 items-start gap-3 rounded-md text-left`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),"aria-expanded":l,"aria-controls":C,onClick:()=>o({type:`patch`,patch:{linksOpen:!l}}),children:[(0,$.jsx)(se,{className:w(`mt-0.5 size-4 shrink-0 text-fg-muted transition-transform`,l?`rotate-0`:`-rotate-90`),"aria-hidden":!0}),e.kind===`note`?(0,$.jsx)(U,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):e.kind===`session`?(0,$.jsx)(V,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):(0,$.jsx)(P,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:w(`text-xs font-medium`,y),children:_})]}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.kind===`note`?n===`zh`?`笔记快照 · 版本 ${e.snapshotRevision??1}`:`Note snapshot · revision ${e.snapshotRevision??1}`:e.kind===`session`?n===`zh`?`会话快照 · ${e.messageCount??0} 条消息 · 版本 ${e.snapshotRevision??1}`:`Conversation snapshot · ${e.messageCount??0} messages · revision ${e.snapshotRevision??1}`:e.workspaceRelativePath}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:ze(e.fileSize)}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(k,{className:`size-3`}),e.expired?n===`zh`?`已过期`:`expired`:Be(e.expiresAt,n)]}),(0,$.jsxs)(`span`,{children:[t.views,`: `,e.downloadCount,e.maxViews!==null&&` ${t.viewsOf} ${e.maxViews}`]}),e.description&&(0,$.jsx)(`span`,{className:`italic text-fg-subtle`,children:e.description})]})]})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:g&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1`,title:t.copyUrl,onClick:()=>void x(),children:u?(0,$.jsx)(d,{className:`size-3.5 text-emerald-500`}):(0,$.jsx)(m,{className:`size-3.5`})}),(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:()=>void S(),disabled:p,title:t.extend,children:p?(0,$.jsx)(h,{className:`size-3.5 animate-spin`}):(0,$.jsx)(k,{className:`size-3.5`})}),(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,onClick:()=>o({type:`patch`,patch:{revokeOpen:!0}}),disabled:c,children:c?(0,$.jsx)(h,{className:`size-3.5 animate-spin`}):(0,$.jsx)(H,{className:`size-3.5`})})]})})]}),g&&l?(0,$.jsxs)(`div`,{id:C,className:`mt-3 bg-surface-base/45 py-3 pl-7 pr-3`,children:[(0,$.jsx)(F,{shareUrl:e.shareUrl,lanUrl:e.lanUrl,reachability:e.reachability,compact:!0}),f?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:t.copyFailed}):null,(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsx)(M,{reachability:e.reachability})})]}):null]}),(0,$.jsx)(N,{open:s,title:t.revokeConfirmTitle,description:t.revokeConfirmBody,confirmLabel:t.revokeConfirmLabel,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void b(),onCancel:()=>o({type:`patch`,patch:{revokeOpen:!1}})})]})}function at({t:e,onCleaned:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(!1),o=(0,J.useCallback)(async()=>{r(!1),a(!0);try{await le(),t()}catch{}finally{a(!1)}},[t]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(T,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>r(!0),className:`border-danger/40 px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:[i?(0,$.jsx)(h,{className:`size-3.5 animate-spin`}):(0,$.jsx)(H,{className:`size-3.5`}),e.cleanExpired]})}),(0,$.jsx)(N,{open:n,title:e.cleanExpiredConfirmTitle,description:e.cleanExpiredConfirmBody,confirmLabel:e.cleanExpiredConfirmLabel,cancelLabel:e.cancel,destructive:!0,onConfirm:()=>void o(),onCancel:()=>r(!1)})]})}export{He as SharesSettingsPanel};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{i as t,r as n}from"./locale-store-BQ2HKTWb.js";import{ln as r}from"./index-CfyyA9-g.js";var i=e({reloadSkills:()=>a});async function a(){let e=await t(n(`/api/skills/reload`),{method:`POST`});if(!e.ok)throw Error(await r(e))}export{i as n,a as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{i as n,r,s as i}from"./locale-store-BQ2HKTWb.js";import{t as a}from"./cn-JdwAhgNB.js";import{ln as o}from"./index-CfyyA9-g.js";import"./skill-reload-api-DuqIDYjc.js";async function s(e,t){let n=new FormData;n.append(`file`,e),t.skillId&&n.append(`skillId`,t.skillId),t.overwrite&&n.append(`overwrite`,`true`),n.append(`target`,t.target??`global`);let a=i.getState().token,o=new Headers;a&&o.set(`Authorization`,`Bearer ${a}`);let s=await fetch(r(`/api/skills/upload`),{method:`POST`,headers:o,body:n});s.status===401&&i.getState().onUnauthorized();let c=await s.json().catch(()=>({}));if(!s.ok)throw Error(c.error||`HTTP ${s.status}`);if(!c.payload?.skillId)throw Error(`Invalid response`);return c.payload}async function c(e,t){let i=t?`?target=${encodeURIComponent(t)}`:``,a=await n(r(`/api/skills/${encodeURIComponent(e)}${i}`),{method:`DELETE`});if(!a.ok)throw Error(await o(a))}async function l(e,t){let i=await n(r(`/api/skills/enabled`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skillName:e,enabled:t})});if(!i.ok)throw Error(await o(i))}function u(e,t){t?.trim()&&e.set(`provider`,t.trim())}async function d(e){let t=new URLSearchParams;u(t,e?.provider),e?.locale?.trim()&&t.set(`locale`,e.locale.trim());let i=t.toString(),a=await n(r(`/api/skills/marketplace/categories${i?`?${i}`:``}`),{cache:`no-store`});if(!a.ok)throw Error(await o(a));let s=await a.json();if(!s.payload||!Array.isArray(s.payload.items))throw Error(`Invalid response`);return{items:s.payload.items}}async function f(e){let t=new URLSearchParams;e.q?.trim()&&t.set(`q`,e.q.trim()),e.page!=null&&t.set(`page`,String(e.page)),e.pageSize!=null&&t.set(`pageSize`,String(e.pageSize)),e.sort&&t.set(`sort`,e.sort),e.category?.trim()&&t.set(`category`,e.category.trim()),u(t,e.provider);let i=t.toString(),a=await n(r(`/api/skills/marketplace${i?`?${i}`:``}`),{cache:`no-store`,signal:e.signal});if(!a.ok)throw Error(await o(a));let s=await a.json();if(!s.payload?.items||!s.payload.meta)throw Error(`Invalid response`);return s.payload}async function p(e,t){let i=encodeURIComponent(e),a=new URLSearchParams;u(a,t?.provider);let s=a.toString(),c=await n(r(`/api/skills/marketplace/packages/${i}${s?`?${s}`:``}`),{cache:`no-store`});if(!c.ok)throw Error(await o(c));let l=(await c.json()).payload;if(!l?.name||!l.skillDocPreview||typeof l.skillDocPreview.name!=`string`||typeof l.skillDocPreview.description!=`string`||typeof l.skillDocPreview.bodyMarkdown!=`string`||typeof l.skillDocPreview.disableModelInvocation!=`boolean`||!l.skillDocPreview.metadata||typeof l.skillDocPreview.metadata!=`object`||typeof l.skillDocPreview.metadata.name!=`string`||typeof l.skillDocPreview.metadata.description!=`string`)throw Error(`Invalid response`);return l}async function m(e){let t=await n(r(`/api/skills/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:`global`,...e})});if(!t.ok)throw Error(await o(t));let i=await t.json();if(!i.payload?.skillId)throw Error(i.error||`Invalid response`);return i.payload}async function h(e){let t=await n(r(`/api/skills/${encodeURIComponent(e)}/content`),{cache:`no-store`});if(!t.ok)throw Error(await o(t));let i=(await t.json()).payload;if(!i||typeof i.name!=`string`||typeof i.description!=`string`||typeof i.bodyMarkdown!=`string`||typeof i.disableModelInvocation!=`boolean`||!i.metadata||typeof i.metadata!=`object`||typeof i.metadata.name!=`string`||typeof i.metadata.description!=`string`)throw Error(`Invalid response`);return i}async function g(){let e=await n(r(`/api/skills/marketplace/provider`),{cache:`no-store`});if(!e.ok)throw Error(await o(e));let t=await e.json();if(!t.payload?.provider)throw Error(`Invalid response`);return t.payload}async function _(){let e=await n(r(`/api/skills/marketplace/providers`),{cache:`no-store`});if(!e.ok)throw Error(await o(e));let t=await e.json();if(!t.payload?.providers)throw Error(`Invalid response`);return t.payload}var v=e(),y=t(),b=[{light:`bg-sky-100 text-sky-800`,dark:`dark:bg-sky-950/55 dark:text-sky-200`},{light:`bg-violet-100 text-violet-800`,dark:`dark:bg-violet-950/55 dark:text-violet-200`},{light:`bg-emerald-100 text-emerald-800`,dark:`dark:bg-emerald-950/55 dark:text-emerald-200`},{light:`bg-orange-100 text-orange-800`,dark:`dark:bg-orange-950/55 dark:text-orange-200`},{light:`bg-rose-100 text-rose-800`,dark:`dark:bg-rose-950/55 dark:text-rose-200`},{light:`bg-amber-100 text-amber-900`,dark:`dark:bg-amber-950/55 dark:text-amber-200`},{light:`bg-cyan-100 text-cyan-800`,dark:`dark:bg-cyan-950/55 dark:text-cyan-200`},{light:`bg-indigo-100 text-indigo-800`,dark:`dark:bg-indigo-950/55 dark:text-indigo-200`},{light:`bg-fuchsia-100 text-fuchsia-800`,dark:`dark:bg-fuchsia-950/55 dark:text-fuchsia-200`},{light:`bg-teal-100 text-teal-800`,dark:`dark:bg-teal-950/55 dark:text-teal-200`}];function x(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n)|0;return Math.abs(t)}function S(e){let t=e.trim();if(!t)return`?`;let n=t.match(/[\p{L}\p{N}]/u);return n?n[0].toLocaleUpperCase(`en-US`):t[0]}function C(e){let t=(0,v.c)(9),{name:n,className:r}=e,i;t[0]===n?i=t[1]:(i=S(n),t[0]=n,t[1]=i);let o=i,s=b[x(n)%b.length],c;t[2]!==r||t[3]!==s.dark||t[4]!==s.light?(c=a(`flex size-11 shrink-0 items-center justify-center rounded-xl font-semibold tracking-tight shadow-surface`,`text-[1.05rem] ring-1 ring-inset ring-black/[0.06] dark:ring-white/[0.1]`,`transition-[transform,box-shadow] duration-200 ease-out group-hover:ring-black/[0.1] dark:group-hover:ring-white/[0.14]`,`group-hover:-translate-y-px`,s.light,s.dark,r),t[2]=r,t[3]=s.dark,t[4]=s.light,t[5]=c):c=t[5];let l;return t[6]!==o||t[7]!==c?(l=(0,y.jsx)(`div`,{className:c,"aria-hidden":!0,children:o}),t[6]=o,t[7]=c,t[8]=l):l=t[8],l}var w=`https://skillhub.cn`,T=`https://clawhub.ai`;function E(e){let t=e.trim();return t?`${w}/skills/${encodeURIComponent(t)}`:null}function D(e){let t=e.trim();return t?`${T}/${encodeURIComponent(t)}`:null}function O(e,t){return e===`skillhub`?E(t):e===`clawhub`?D(t):null}function k(e,t){return t===`store`?e.name.trim()||e.id:e.id.trim()||e.name}function A(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function j(e){return e.filter(e=>e.type!==`collision`)}function M(e){let t=[e.kind];return e.label?.trim()&&t.push(e.label.trim()),e.package?.trim()&&t.push(e.package.trim()),e.formula?.trim()&&t.push(e.formula.trim()),e.module?.trim()&&t.push(e.module.trim()),e.url?.trim()&&t.push(e.url.trim()),t.join(` · `)}function N(e){return{...e,enabled:e.enabled??!0,disableModelInvocation:e.disableModelInvocation??!1}}export{s as _,O as a,c,g as d,_ as f,l as g,m as h,k as i,d as l,h as m,M as n,N as o,f as p,A as r,C as s,j as t,p as u};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{d as a,h as o,p as s,t as c}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{i as l,n as u,o as d,r as f,s as p,t as m}from"./dist-CpzYSoz7.js";import{n as h,r as g}from"./popover-select-CKBYnT3c.js";import{t as _}from"./circle-check-C23XjkUj.js";import{t as v}from"./external-link-DjqjBmc3.js";import{d as ee,p as te,t as ne}from"./markdown-view-DIcfrLmG.js";import{t as re}from"./x-B_N4OPjy.js";import{n as ie,s as y}from"./locale-store-BQ2HKTWb.js";import{t as b}from"./cn-JdwAhgNB.js";import{t as x}from"./button-B11EPpor.js";import{t as S}from"./skeleton-BwbyijEw.js";import{As as ae,Bt as oe,Cs as C,Ds as w,Gi as se,Hl as ce,Ml as le,Mu as ue,Na as de,Nr as fe,Oc as T,Os as pe,P as me,Pc as E,Ts as D,Wc as he,Xn as ge,_n as O,ao as k,au as A,bn as j,ci as M,cs as _e,ds as N,gn as P,iu as F,jl as ve,ks as I,ms as L,n as ye,si as be,ua as xe,us as Se,vn as Ce,xn as we,yn as Te,ys as Ee}from"./index-CfyyA9-g.js";import{t as De}from"./date-picker-CU-ij_yE.js";import{t as Oe}from"./dependency-picker-Z6Nf0Wjq.js";var R=e(t(),1),ke=e(n(),1),z=r();function Ae(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function je(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}var B=i();function Me(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Ne(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,B.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,B.jsx)(S,{className:`h-32 rounded-2xl`}),(0,B.jsx)(S,{className:`h-52 rounded-2xl`}),(0,B.jsx)(S,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Pe(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Fe(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var V=[`backlog`,`ready`,`active`,`review`,`closed`],H=[`low`,`normal`,`high`,`critical`],Ie=(0,R.memo)(function(e){let t=(0,z.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:c,onChange:l}=e,u;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(u=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=u):u=t[4];let d=u,f;t[5]===c?f=t[6]:(f=(0,B.jsx)(`span`,{children:c}),t[5]=c,t[6]=f);let p;t[7]===l?p=t[8]:(p=e=>l(e.target.value),t[7]=l,t[8]=p);let m;t[9]!==s||t[10]!==d?(m=V.map(e=>(0,B.jsx)(g,{value:e,disabled:d(e),children:Me(e,s)},e)),t[9]=s,t[10]=d,t[11]=m):m=t[11];let _;t[12]!==r||t[13]!==p||t[14]!==m||t[15]!==n?(_=(0,B.jsx)(h,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:p,children:m}),t[12]=r,t[13]=p,t[14]=m,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==f||t[18]!==_?(v=(0,B.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[f,_]}),t[17]=f,t[18]=_,t[19]=v):v=t[19],v}),Le=(0,R.memo)(function(e){let t=(0,z.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,B.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=e=>o(e.target.value),t[2]=o,t[3]=c);let l;t[4]===a?l=t[5]:(l=H.map(e=>(0,B.jsx)(g,{value:e,children:a[e]},e)),t[4]=a,t[5]=l);let u;t[6]!==r||t[7]!==c||t[8]!==l||t[9]!==n?(u=(0,B.jsx)(h,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:c,children:l}),t[6]=r,t[7]=c,t[8]=l,t[9]=n,t[10]=u):u=t[10];let d;return t[11]!==s||t[12]!==u?(d=(0,B.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,u]}),t[11]=s,t[12]=u,t[13]=d):d=t[13],d}),Re=(0,R.memo)(function(e){let t=(0,z.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,B.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,B.jsx)(De,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,B.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),ze=(0,R.memo)(function(e){let t=(0,z.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,c;t[0]===i?c=t[1]:(c=(0,B.jsx)(`span`,{children:i}),t[0]=i,t[1]=c);let l;t[2]===s?l=t[3]:(l=e=>s(e.target.value),t[2]=s,t[3]=l);let u;t[4]===a?u=t[5]:(u=(0,B.jsx)(g,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=u);let d;t[6]===o?d=t[7]:(d=o.map(it),t[6]=o,t[7]=d);let f;t[8]!==r||t[9]!==l||t[10]!==u||t[11]!==d||t[12]!==n?(f=(0,B.jsxs)(h,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:l,children:[u,d]}),t[8]=r,t[9]=l,t[10]=u,t[11]=d,t[12]=n,t[13]=f):f=t[13];let p;return t[14]!==c||t[15]!==f?(p=(0,B.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[c,f]}),t[14]=c,t[15]=f,t[16]=p):p=t[16],p}),Be=(0,R.memo)(function(e){let t=(0,z.c)(9),{candidates:n,selected:r,disabled:i,labels:a,getTaskHref:o,onChange:s}=e,c;t[0]===r?c=t[1]:(c=r.map(at),t[0]=r,t[1]=c);let l;return t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,B.jsx)(Oe,{borderless:!0,candidates:n,selectedIds:c,disabled:i,getTaskHref:o,onChange:s,labels:a}),t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8],l},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.getTaskHref===t.getTaskHref&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Ve=`xopc.taskDetail.chatPanelPercent`,He=42;function Ue(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?He:Math.min(r,Math.max(n,e))}function We(){try{let e=Number(window.localStorage.getItem(Ve));return Number.isFinite(e)&&e>=30&&e<=60?e:He}catch{return He}}function Ge(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`paused`:e.operationalState}function Ke(e){return e===`needsUser`||e===`blocked`?`bg-warning/10 text-warning`:e===`completed`?`bg-success-soft text-success`:e===`running`||e===`verifying`||e===`review`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function U(e){let t=(0,z.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,B.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,B.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,B.jsx)(t===`passed`?_:t===`failed`?A:F,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,B.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,B.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function qe({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[i]=o(),s=a(),l=ie(e=>e.language),u=y(e=>e.token),d=(0,R.useMemo)(()=>ae(l),[l]),f=k(e=>e.setPageHeader),p=k(e=>e.clearPageHeader),m=M(e=>e.open),h=M(e=>e.sessionKeyOverride),g=M(e=>e.openForSession),re=ge(e=>e.setOpen),{data:S,error:oe,mutate:A,lastChange:F,conversationLoading:be,conversationError:De}=_e(e),[Oe,z]=(0,R.useState)(null),[Me,V]=(0,R.useState)(null),[H,qe]=(0,R.useState)(()=>new Set),[Je,Ye]=(0,R.useState)([]),[Xe,Ze]=(0,R.useState)(null),[Qe,$e]=(0,R.useState)([]),[et,W]=(0,R.useState)(!1),[tt,nt]=(0,R.useState)(``),[rt,G]=(0,R.useState)(!1),[it,at]=(0,R.useState)(``),[ot,st]=(0,R.useState)(We),[ct,lt]=(0,R.useState)(!1),ut=(0,R.useRef)(null),dt=(0,R.useRef)(!1),ft=(0,R.useRef)(!1),pt=(0,R.useRef)(``),mt=(0,R.useRef)(null),ht=(0,R.useRef)(null),gt=(0,R.useRef)(null),_t=(0,R.useRef)(S),[vt,K]=(0,R.useState)(null),[yt,bt]=(0,R.useState)(null),[xt,St]=(0,R.useState)(!1),Ct=(0,R.useMemo)(()=>({link:d.linkDependencies,linked:d.linkedDependencies,searchPlaceholder:d.dependencySearchPlaceholder,noMatches:d.noDependencyMatches,noCandidates:d.noDependencyCandidates,remove:d.removeDependency}),[d.dependencySearchPlaceholder,d.linkDependencies,d.linkedDependencies,d.noDependencyCandidates,d.noDependencyMatches,d.removeDependency]),wt=S?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,Tt=(0,R.useMemo)(()=>ee(i.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[i]),Et=(0,R.useCallback)(e=>t===`modal`&&n?I(n,e):te(`/tasks/${encodeURIComponent(e)}`,Tt),[n,t,Tt]);_t.current=S;let q=(0,R.useCallback)((e,t)=>{qe(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,R.useEffect)(()=>{V(null),K(null),W(!1),G(!1),bt(null),St(!1)},[e]),(0,R.useEffect)(()=>{let e=!0;return de().then(t=>{e&&$e(t.items)}).catch(()=>void 0),()=>{e=!1}},[u]),(0,R.useEffect)(()=>{if(!F||F.source===`user`)return;bt(F);let e=window.setTimeout(()=>bt(null),3500);return()=>window.clearTimeout(e)},[F]),(0,R.useEffect)(()=>{let t=S?.task.projectId,n=S?.dependencies??[];if(!t){gt.current=null,Ze(null),Ye(n);return}gt.current!==t&&(gt.current=t,Ze(null));let r=!0;return xe(t).then(t=>{if(!r)return;Ze(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});Ye([...i.values()])}).catch(()=>{r&&Ye(n)}),()=>{r=!1}},[wt,S?.task.projectId,e]);let J=(0,R.useCallback)(async(t,n=`command`)=>{let r=_t.current;if(r){q(n,!0),V(null);try{await A(await N(e,t,r.task.version),{revalidate:!1})}catch{V(d.actionFailed)}finally{q(n,!1)}}},[d.actionFailed,A,q,e]),Y=(0,R.useCallback)(async(t,n)=>{let r=_t.current;if(!r)return!1;n&&q(n,!0),V(null);try{return await A(D(e,t,r.task.version),{optimisticData:je(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return V(d.actionFailed),!1}finally{n&&q(n,!1)}},[d.actionFailed,A,q,e]),Dt=async()=>{if(!S)return;if(dt.current){dt.current=!1;return}let e=tt.trim(),t=mt.current;if(Ae(t,S.task.version,S.task.title,e)){K(`title`);return}if(!e||e===S.task.title){nt(S.task.title),W(!1);return}await Y({title:e})&&(K(null),W(!1))},Ot=async()=>{if(!S)return;if(ft.current){ft.current=!1;return}let e=it.trim(),t=ht.current;if(Ae(t,S.task.version,S.task.body??``,e)){K(`description`);return}if(it===pt.current||e===(S.task.body??``).trim()){G(!1);return}await Y({body:e||null})&&(K(null),G(!1))},kt=(0,R.useCallback)(async e=>{let t=_t.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await J({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await J({type:`close`,resolution:`done`},`phase`);return}await J({type:`move`,phase:e},`phase`)}},[J]),At=(0,R.useCallback)(e=>{Y({priority:e},`priority`)},[Y]),jt=(0,R.useCallback)(e=>{Y({dueAt:Fe(e)},`dueAt`)},[Y]),Mt=(0,R.useCallback)(e=>{st(e);try{window.localStorage.setItem(Ve,String(e))}catch{}},[]),Nt=(0,R.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=ut.current?.clientWidth??0;Mt(Ue(e.key===`Home`?He:ot+(e.key===`ArrowLeft`?2:-2),t))},[ot,Mt]),Pt=(0,R.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=ut.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),lt(!0);let i=ot,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Ue((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}lt(!1),Mt(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[ot,Mt]),Ft=(0,R.useCallback)(async t=>{let n=_t.current;if(n){q(`dependencies`,!0),V(null);try{await A(await w(e,t,n.task.version),{revalidate:!1})}catch{V(d.dependencyUpdateFailed)}finally{q(`dependencies`,!1)}}},[d.dependencyUpdateFailed,A,q,e]),It=(0,R.useCallback)(async t=>{let n=_t.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){q(`delegateAgentId`,!0),V(null);try{await A(await Ee(e,t,n.task.version),{revalidate:!1})}catch{V(d.actionFailed)}finally{q(`delegateAgentId`,!1)}}},[d.actionFailed,A,q,e]),Lt=(0,R.useCallback)(async()=>{q(`delete`,!0),V(null);try{await L(e),r?r():s(Tt,{replace:!0})}catch(e){V(e instanceof Error?e.message:d.actionFailed)}finally{q(`delete`,!1)}},[d.actionFailed,s,r,Tt,q,e]);if((0,R.useLayoutEffect)(()=>{if(t!==`modal`)return f({startExtra:(0,B.jsx)(c,{to:Tt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":d.backToWork,children:(0,B.jsx)(ue,{className:`size-4`})}),main:S?(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:Xe?`${Xe} / ${d.taskLabel}`:d.taskLabel}),(0,B.jsx)(`p`,{className:`text-xs text-fg-muted`,children:d.detailStatuses[Ge(S)]})]}):null,end:(0,B.jsx)(`div`,{ref:z,className:`flex min-w-0 items-center justify-end`})}),p},[p,d.backToWork,d.detailStatuses,d.taskLabel,S,t,Xe,Tt,f]),oe&&!S)return(0,B.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:d.taskNotFound});if(!S)return(0,B.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,B.jsx)(Ne,{})});let Rt=S.waits[0],zt=Rt?.kind===`paused`?Rt:void 0,X=S.receipts[0],Bt=Ge(S),Vt=d.detailStatuses[Bt],Ht=S.task.body?.trim()||S.task.contract?.objective.trim(),Ut=new Map(X?.verification.checks.map(e=>[e.criterion,e.status])),Wt=S.allowedCommands.includes(`mark_ready`),Gt=S.allowedCommands.includes(`start`),Kt=S.allowedCommands.includes(`add_wait`),qt=S.task.phase===`review`&&S.allowedCommands.includes(`close`),Jt=S.allowedCommands.includes(`reopen`),Z=S.conversation.activeSessionKey,Yt=S.conversation.currentExecutorAgentId??S.task.delegateAgentId??S.task.ownerId,Xt=Qe.find(e=>e.id===Yt),Zt=!!(Z&&m&&h===Z),Qt=S.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),$t=S.task.contract?.acceptanceCriteria??[],en=$t.filter(e=>Ut.get(e)===`passed`).length,tn=S.task.contract?.expectedOutputs??[],nn=S.task.contract?.constraints??[],rn=S.task.contract?.approvalRequired??[],an=S.task.contract?.assumptions??[],on=S.task.contract?.risks??[],Q=(...e)=>!!yt?.changedFields.some(t=>e.includes(t)),sn=S.allowedCommands.includes(`move`),$=H.has(`command`),cn=H.has(`delete`),ln=S.runs.find(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),un=ln!==void 0,dn=(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Wt?(0,B.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`mark_ready`}),children:[(0,B.jsx)(T,{className:`size-4`}),d.scheduleTask]}):null,zt?(0,B.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`resolve_wait`,waitId:zt.id}),children:[(0,B.jsx)(T,{className:`size-4`}),d.resumeTask]}):null,!Rt&&Gt&&Yt?(0,B.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`start`,executor:{kind:`agent`,agentId:Yt}}),children:[(0,B.jsx)(T,{className:`size-4`}),d.runTask]}):null,qt?(0,B.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`close`,resolution:`done`}),children:[(0,B.jsx)(_,{className:`size-4`}),d.approveTask]}):null,Jt?(0,B.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`reopen`,phase:`ready`}),children:[(0,B.jsx)(T,{className:`size-4`}),d.reopenTask]}):null,!Rt&&Kt?(0,B.jsxs)(x,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:$,onClick:()=>void J({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,B.jsx)(E,{className:`size-4`}),d.pauseTask]}):null,(0,B.jsxs)(Te,{children:[(0,B.jsx)(we,{asChild:!0,children:(0,B.jsx)(x,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$||cn,"aria-label":d.moreActions,children:(0,B.jsx)(ce,{className:`size-4`,"aria-hidden":!0})})}),(0,B.jsx)(Ce,{children:(0,B.jsxs)(P,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[ln?(0,B.jsx)(O,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{q(`command`,!0),V(null),A(Se(e,ln.id,ln.version),{revalidate:!1}).catch(()=>V(d.actionFailed)).finally(()=>q(`command`,!1))},children:d.cancelActiveRun}):null,ln?(0,B.jsx)(j,{className:`my-1 h-px bg-edge`}):null,S.task.phase===`closed`?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(O,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void J({type:`close`,resolution:`cancelled`}),children:d.cancelTask}),(0,B.jsx)(j,{className:`my-1 h-px bg-edge`})]}),(0,B.jsx)(O,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(un){V(d.deleteActiveTaskBlocked);return}St(!0)},children:d.deleteTask})]})})]})]}),Z&&t!==`modal`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(x,{type:`button`,variant:`ghost`,className:b(`h-8 shrink-0 px-2 text-xs`,Zt&&`bg-surface-hover text-fg`),"aria-label":l===`zh`?`项目文件`:`Project files`,"aria-pressed":Zt,onClick:()=>{re(Z,!1),g(Z)},children:[(0,B.jsx)(ve,{className:`size-3.5`,"aria-hidden":!0}),l===`zh`?`文件`:`Files`]}),(0,B.jsx)(x,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,B.jsxs)(c,{to:pe(e),children:[(0,B.jsx)(v,{className:`size-3.5`}),l===`zh`?`全屏`:`Full screen`]})})]}):null]});return(0,B.jsxs)(`div`,{ref:ut,className:`${t===`modal`?`flex h-full min-h-0 flex-col lg:flex-row`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden lg:flex-row`} ${ct?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${ot}%`},children:[t===`page`&&Oe?(0,ke.createPortal)(dn,Oe):null,(0,B.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,B.jsxs)(`header`,{className:b(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,B.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[Xe?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),Xe]}):null,(0,B.jsx)(`span`,{children:`/`}),(0,B.jsx)(`span`,{children:d.taskLabel}),(0,B.jsx)(`span`,{className:b(`rounded-full px-2 py-0.5 text-[11px] font-medium`,Ke(Bt)),children:Vt}),(0,B.jsx)(`span`,{className:`text-fg-subtle`,children:d.updatedAt.replace(`{{date}}`,fe(S.task.updatedAt,l))}),yt?(0,B.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:yt.source===`agent`?l===`zh`?`Agent 刚刚更新`:`Updated by Agent`:l===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),et?(0,B.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:tt,onChange:e=>nt(e.target.value),onBlur:()=>void Dt(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),dt.current=!0,nt(S.task.title),W(!1),queueMicrotask(()=>{dt.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,B.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{mt.current={value:S.task.title,version:S.task.version},K(null),nt(S.task.title),W(!0)},children:(0,B.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:S.task.title})}),vt===`title`?(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,B.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{nt(S.task.title),K(null),W(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({title:tt.trim()}).then(e=>{e&&(K(null),W(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),Me?(0,B.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:Me}):null]}),S.attention.length>0?(0,B.jsxs)(`section`,{className:b(`mb-4 rounded-xl border border-warning/20 bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:Qt?d.needsAttention:d.waitingStatus}),(0,B.jsx)(`ul`,{className:`mt-2 space-y-1.5 text-sm leading-6 text-fg-muted`,children:S.attention.map((e,t)=>(0,B.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsxs)(`main`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,B.jsxs)(`section`,{className:b(`p-5`,Q(`body`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:d.taskDescription}),rt?(0,B.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:it,onChange:e=>at(e.target.value),onBlur:()=>void Ot(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ft.current=!0,at(S.task.body??S.task.contract?.objective??``),G(!1),queueMicrotask(()=>{ft.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,B.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=S.task.body??S.task.contract?.objective??``;pt.current=e,ht.current={value:S.task.body??``,version:S.task.version},K(null),at(e),G(!0)},children:(0,B.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Ht&&Ht!==S.task.title?Ht:d.noTaskDescription})}),vt===`description`?(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,B.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{at(S.task.body??``),K(null),G(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({body:it.trim()||null}).then(e=>{e&&(K(null),G(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,B.jsxs)(`section`,{className:b(`p-5`,Q(`contract`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:d.taskDefinition}),(0,B.jsxs)(`div`,{className:`mt-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:d.successDefinition}),$t.length>0?(0,B.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:d.criteriaProgress.replace(`{{verified}}`,String(en)).replace(`{{total}}`,String($t.length))}):null]}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(U,{items:$t,empty:d.noDefinition,verificationByCriterion:Ut})})]}),tn.length>0?(0,B.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-5`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:d.expectedOutputs}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(U,{items:tn,empty:d.noDefinition})})]}):null,nn.length>0?(0,B.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:d.constraints}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(U,{items:nn,empty:d.noDefinition})})]}):null,rn.length>0?(0,B.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:d.approvalRequired}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(U,{items:rn,empty:d.noDefinition})})]}):null,an.length>0?(0,B.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:d.contextAssumptions}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(U,{items:an,empty:d.noDefinition})})]}):null,on.length>0?(0,B.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:d.contextRisks}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(U,{items:on,empty:d.noDefinition})})]}):null]}),X?(0,B.jsxs)(`section`,{className:b(`p-5`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:d.latestResult}),(0,B.jsx)(ne,{content:X.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`})]}),(0,B.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[d.receiptStatuses[X.status],` · `,d.verificationStatuses[X.verification.status]]})]}),X.remainingWork.length>0?(0,B.jsxs)(`div`,{className:`mt-4`,children:[(0,B.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:d.remainingWork}),(0,B.jsx)(`div`,{className:`mt-2`,children:(0,B.jsx)(U,{items:X.remainingWork,empty:d.noRemainingWork})})]}):null,X.nextAction?(0,B.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,B.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:d.nextAction}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:X.nextAction})]}):null,(0,B.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(x,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void C(X.runId,`helpful`),children:d.doneWell}),(0,B.jsx)(x,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void C(X.runId,`not_helpful`),children:d.needsFix}),X.evidence.filter(e=>e.uri).map(e=>(0,B.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,B.jsx)(v,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),S.receipts.length>1?(0,B.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:d.executionHistory.replace(`{{count}}`,String(S.receipts.length-1))}),(0,B.jsx)(`div`,{className:`mt-3 space-y-3`,children:S.receipts.slice(1).map(e=>(0,B.jsx)(`article`,{className:`rounded-lg bg-surface-hover p-3`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:d.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,S.context.length>0?(0,B.jsxs)(`section`,{className:b(`p-5`,Q(`context`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:d.contextUsed}),(0,B.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:S.context.map(e=>(0,B.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,B.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[d.contextRoleLabels[e.role],` · `,d.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,B.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,B.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,B.jsxs)(`aside`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,B.jsxs)(`section`,{className:b(`p-5`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:d.taskProperties}),(0,B.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,B.jsx)(Ie,{value:S.task.phase,disabled:H.has(`phase`),canMove:sn,canApprove:qt,canReopen:Jt,language:l,label:d.taskPhase,onChange:kt}),(0,B.jsx)(Le,{value:S.task.priority,disabled:H.has(`priority`),label:d.priority,labels:d.priorityLabels,onChange:At}),(0,B.jsx)(Re,{value:Pe(S.task.dueAt),disabled:H.has(`dueAt`),label:d.dueDate,onChange:jt}),(0,B.jsx)(ze,{value:S.conversation.currentExecutorAgentId??``,disabled:H.has(`delegateAgentId`),label:d.executorLabel,unassignedLabel:d.unassigned,agents:Qe,onChange:It})]})]}),(0,B.jsxs)(`section`,{className:b(`p-5`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:d.taskRelations}),(0,B.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:d.dependencies}),(0,B.jsx)(Be,{candidates:Je,selected:S.dependencies,disabled:H.has(`dependencies`),labels:Ct,getTaskHref:Et,onChange:Ft})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:d.dependents}),S.dependents.length>0?(0,B.jsx)(`div`,{className:`space-y-1.5`,children:S.dependents.map(e=>(0,B.jsx)(c,{to:Et(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-fg-muted transition-colors hover:text-fg`,children:e.title},e.id))}):(0,B.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:d.noDependents})]})]})]})]})]})]}),(0,B.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":l===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(ot),tabIndex:0,onPointerDown:Pt,onKeyDown:Nt,onDoubleClick:()=>Mt(He),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${ct?`bg-surface-hover`:``}`,children:(0,B.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,B.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,B.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,B.jsx)(`div`,{className:`min-w-0`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Yt?(0,B.jsx)(me,{agentId:Yt,avatar:Xt?.avatar,size:28,className:`shrink-0`}):null,(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:l===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,B.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[Xt?.name??Yt??d.unassigned,` · `,Vt]})]})]})}),t===`modal`?dn:null]}),Z?(0,B.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,B.jsx)(ye,{embedded:!0,sessionKey:Z,taskId:e})}):be?(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,B.jsxs)(`div`,{className:`max-w-xs`,children:[(0,B.jsx)(he,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):De?(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,B.jsxs)(`div`,{className:`max-w-xs`,children:[(0,B.jsx)(he,{className:`mx-auto size-8 text-danger`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,B.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:De instanceof Error?De.message:String(De)})]})}):(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,B.jsxs)(`div`,{className:`max-w-xs`,children:[(0,B.jsx)(he,{className:`mx-auto size-8 text-fg-subtle`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,B.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:l===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]}),(0,B.jsx)(se,{open:xt,title:d.deleteTaskTitle,description:d.deleteTaskDescription.replace(`{{title}}`,S.task.title),confirmLabel:d.confirmDeleteTask,cancelLabel:d.keepTask,destructive:!0,onConfirm:()=>{St(!1),Lt()},onCancel:()=>St(!1)})]})}function Je(){let e=(0,z.c)(2),{taskId:t}=s(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,B.jsx)(qe,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function Ye(e){let t=(0,z.c)(58),{taskId:n,backgroundPath:r,onClose:i}=e,a=ie(G),{data:o}=_e(n),s=o?.conversation.activeSessionKey??null,h=M(rt),g=M(nt),_=M(tt),ee=M(W),te=ge(et),ne=be($e),y=be(Qe),x=h?g:0,S;t[0]!==i||t[1]!==y?(S=e=>{e||(y(null),i())},t[0]=i,t[1]=y,t[2]=S):S=t[2];let ae=a===`zh`?`关闭任务详情`:`Close task details`,C;t[3]!==i||t[4]!==y?(C=()=>{y(null),i()},t[3]=i,t[4]=y,t[5]=C):C=t[5];let w;t[6]!==ae||t[7]!==C?(w=(0,B.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":ae,onClick:C}),t[6]=ae,t[7]=C,t[8]=w):w=t[8];let se=h?`true`:`false`,ce=`${x/2}px`,le=`${x}px`,ue;t[9]!==ce||t[10]!==le?(ue={"--task-detail-workspace-offset":ce,"--task-detail-workspace-width":le},t[9]=ce,t[10]=le,t[11]=ue):ue=t[11];let de=ue,fe=a===`zh`?`任务详情`:`Task details`,T;t[12]===fe?T=t[13]:(T=(0,B.jsx)(p,{className:`font-medium text-fg`,children:fe}),t[12]=fe,t[13]=T);let me=a===`zh`?`查看并操作任务详情`:`View and manage task details`,E;t[14]===me?E=t[15]:(E=(0,B.jsx)(l,{className:`sr-only`,children:me}),t[14]=me,t[15]=E);let D;t[16]!==s||t[17]!==a||t[18]!==ee||t[19]!==te||t[20]!==n||t[21]!==h||t[22]!==_?(D=s?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:b(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,h&&_===s&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":h&&_===s,onClick:()=>{te(s,!1),ee(s)},children:(0,B.jsx)(ve,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsx)(c,{to:pe(n),className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a===`zh`?`全屏打开对话`:`Open chat full screen`,title:a===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,B.jsx)(v,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=s,t[17]=a,t[18]=ee,t[19]=te,t[20]=n,t[21]=h,t[22]=_,t[23]=D):D=t[23];let he=a===`zh`?`关闭任务详情`:`Close task details`,O;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,B.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t[24]=O):O=t[24];let k;t[25]===he?k=t[26]:(k=(0,B.jsx)(u,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":he,children:O}),t[25]=he,t[26]=k);let A;t[27]!==D||t[28]!==k?(A=(0,B.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[D,k]}),t[27]=D,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==T||t[31]!==E||t[32]!==A?(j=(0,B.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[T,E,A]}),t[30]=T,t[31]=E,t[32]=A,t[33]=j):j=t[33];let N;t[34]!==i||t[35]!==y?(N=()=>{y(null),i()},t[34]=i,t[35]=y,t[36]=N):N=t[36];let P;t[37]!==r||t[38]!==N||t[39]!==n?(P=(0,B.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,B.jsx)(qe,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:N})}),t[37]=r,t[38]=N,t[39]=n,t[40]=P):P=t[40];let F;t[41]!==j||t[42]!==P||t[43]!==se||t[44]!==de?(F=(0,B.jsxs)(f,{className:`task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl bg-surface-base shadow-float focus:outline-none`,"data-workspace-panel-open":se,style:de,onEscapeKeyDown:Ze,onInteractOutside:Xe,children:[j,P]}),t[41]=j,t[42]=P,t[43]=se,t[44]=de,t[45]=F):F=t[45];let I;t[46]!==ne||t[47]!==h||t[48]!==g||t[49]!==_?(I=ne?(0,B.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:h?g:0},children:(0,B.jsx)(oe,{allowOutsideChat:!0,sessionKey:_??void 0})}):null,t[46]=ne,t[47]=h,t[48]=g,t[49]=_,t[50]=I):I=t[50];let L;t[51]!==F||t[52]!==I||t[53]!==w?(L=(0,B.jsxs)(d,{children:[w,F,I]}),t[51]=F,t[52]=I,t[53]=w,t[54]=L):L=t[54];let ye;return t[55]!==S||t[56]!==L?(ye=(0,B.jsx)(m,{modal:!1,open:!0,onOpenChange:S,children:L}),t[55]=S,t[56]=L,t[57]=ye):ye=t[57],ye}function Xe(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Ze(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function Qe(e){return e.setPath}function $e(e){return e.path}function et(e){return e.setOpen}function W(e){return e.openForSession}function tt(e){return e.sessionKeyOverride}function nt(e){return e.widthPx}function rt(e){return e.open}function G(e){return e.language}function it(e){return(0,B.jsx)(g,{value:e.id,children:e.name||e.id},e.id)}function at(e){return e.id}export{Ye as TaskDetailModal,Je as TaskDetailPage};