@xopcai/xopc 0.0.397 → 0.0.398

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 (230) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/src/plugin.js +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CIEGrioy.js → agent-avatar-dicebear-Q-lKLSrc.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CobxTBV_.js +1 -0
  6. package/dist/gateway/static/root/assets/agents-Bgmmue5K.js +77 -0
  7. package/dist/gateway/static/root/assets/{agents-admin-api-BjGOUrAf.js → agents-admin-api-DvSe10zu.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-DIJ0ii-n.js → app-management-settings-panel-CB_W2ano.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-BGnyHS-p.js → appearance-settings-B-ppSGBm.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-3qUgsGui.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-CR8FcRAa.js → archive-plugin-CeQrQ693.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-BLInZo7N.js → automations-page-Cc9vZanv.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-workspace-Bc4c_AEq.js +6 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-DW9pu205.js → binary-plugins-BqaVBv1R.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-ClgTc5v8.js → block-editor-B4ij8nZi.js} +40 -40
  16. package/dist/gateway/static/root/assets/{browser-automation-inputs-Bn7kDuUB.js → browser-automation-inputs-DngvcZH9.js} +1 -1
  17. package/dist/gateway/static/root/assets/browser-automations-page-CdqwXyYq.js +3 -0
  18. package/dist/gateway/static/root/assets/browser-settings-page-CJT0rB-I.js +3 -0
  19. package/dist/gateway/static/root/assets/{capabilities-CTfLd_UE.js → capabilities-glv1DeRI.js} +1 -1
  20. package/dist/gateway/static/root/assets/capabilities-page-C56VsP0Y.js +2 -0
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel-DZiA8JIq.js +8 -0
  22. package/dist/gateway/static/root/assets/{capability-header-actions-9ZG71-BO.js → capability-header-actions-Cu-ATcJq.js} +1 -1
  23. package/dist/gateway/static/root/assets/capability-links--dcwUjgv.js +1 -0
  24. package/dist/gateway/static/root/assets/channels-gIjZtYnV.js +1 -0
  25. package/dist/gateway/static/root/assets/{chat-terminal-dock-x1W2_hwc.js → chat-terminal-dock-COdvmTgN.js} +2 -2
  26. package/dist/gateway/static/root/assets/computer-settings-page-C1XHsuI8.js +1 -0
  27. package/dist/gateway/static/root/assets/{connector-service-page-Kf8kaNm_.js → connector-service-page-Cv2bhnQ5.js} +1 -1
  28. package/dist/gateway/static/root/assets/connectors-page-SmKItq0N.js +1 -0
  29. package/dist/gateway/static/root/assets/{date-picker-d5kiPUG0.js → date-picker-CCnqYwy0.js} +1 -1
  30. package/dist/gateway/static/root/assets/{dependency-picker-BcH76tQC.js → dependency-picker-nt5ruIio.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-B-925tPX.js → desktop-pet-Bn8xj1v3.js} +1 -1
  32. package/dist/gateway/static/root/assets/{desktop-pet-settings-3XJ4qR65.js → desktop-pet-settings-Cbl1J_VE.js} +1 -1
  33. package/dist/gateway/static/root/assets/device-pairing-wizard-Tadg9co1.js +1 -0
  34. package/dist/gateway/static/root/assets/{directory-picker-path-field-B-qZCjGR.js → directory-picker-path-field-DuE5ez1E.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-debug-page-BlQu1u6X.js → extension-debug-page-jsNxwqNi.js} +1 -1
  36. package/dist/gateway/static/root/assets/extension-page-N_rBjYX8.js +1 -0
  37. package/dist/gateway/static/root/assets/extension-settings-page-7qAdvlRB.js +1 -0
  38. package/dist/gateway/static/root/assets/{gateway-config-swr-Di9g6pE8.js → gateway-config-swr-DAir1JsW.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-realtime-2-o7qk92.js → gateway-realtime-dE0XrVAT.js} +1 -1
  40. package/dist/gateway/static/root/assets/gateway-realtime-store-CPlVuu0d.js +1 -0
  41. package/dist/gateway/static/root/assets/gateway-settings-ViqOhx_m.js +1 -0
  42. package/dist/gateway/static/root/assets/{gateway-startup-retry-BCUswcVy.js → gateway-startup-retry-CqyGHM2M.js} +1 -1
  43. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-Czdbbi0H.js → highlighted-body-KQOG7T2V-XrkWdmrk.js} +1 -1
  44. package/dist/gateway/static/root/assets/home-page-C_Xn_Kkz.js +2 -0
  45. package/dist/gateway/static/root/assets/{image-generation-api-DPFPJ2ps.js → image-generation-api-CmHdM2uL.js} +1 -1
  46. package/dist/gateway/static/root/assets/{imports-page-Bwyotfbt.js → imports-page-B-dnvHP_.js} +1 -1
  47. package/dist/gateway/static/root/assets/index-DWzv8ZoO.css +1 -0
  48. package/dist/gateway/static/root/assets/{index-Dsp_gNdl.js → index-DvKDT-RQ.js} +11 -11
  49. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-C20gl-l7.js → keyboard-shortcuts-settings-mCs9cDgv.js} +1 -1
  50. package/dist/gateway/static/root/assets/{local-app-workbench-page-o0M_OSjC.js → local-app-workbench-page-B7AtlfWQ.js} +1 -1
  51. package/dist/gateway/static/root/assets/{local-apps-page-DoWJCmOq.js → local-apps-page-CIJE7jME.js} +1 -1
  52. package/dist/gateway/static/root/assets/{local-session-drafts-BjwlkAKA.js → local-session-drafts-fhip41-L.js} +1 -1
  53. package/dist/gateway/static/root/assets/{locale-store-Djl2FW6_.js → locale-store-Jnhw2WMv.js} +1 -1
  54. package/dist/gateway/static/root/assets/{logs-page-BFTL93RX.js → logs-page-HawXUKF2.js} +2 -2
  55. package/dist/gateway/static/root/assets/management-settings-DByEh6rq.js +1 -0
  56. package/dist/gateway/static/root/assets/{markdown-view-DyO7Q0Ms.js → markdown-view-B58RypQ4.js} +1 -1
  57. package/dist/gateway/static/root/assets/{media-plugins-DLrTRF0a.js → media-plugins-B8BLxQgj.js} +1 -1
  58. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CZjPT7xE.js +1 -0
  59. package/dist/gateway/static/root/assets/messages-DBvKzlCl.js +3 -0
  60. package/dist/gateway/static/root/assets/note-detail-panel-hQHB5fCs.js +5 -0
  61. package/dist/gateway/static/root/assets/notes-page-BEusEk31.js +8 -0
  62. package/dist/gateway/static/root/assets/{page-context-capture-button-YTVWZ02-.js → page-context-capture-button-42bq8N6-.js} +1 -1
  63. package/dist/gateway/static/root/assets/personal-page-DPR5gzhf.js +1 -0
  64. package/dist/gateway/static/root/assets/plugin-details-dialog-D8dKKIY9.js +1 -0
  65. package/dist/gateway/static/root/assets/plugin-presentation-BrQpVvjC.js +1 -0
  66. package/dist/gateway/static/root/assets/{preview-open-alternatives-DzA__S54.js → preview-open-alternatives-DKyLVLpX.js} +1 -1
  67. package/dist/gateway/static/root/assets/{product-open-page-DvlMKj0T.js → product-open-page-DcGH0AXN.js} +1 -1
  68. package/dist/gateway/static/root/assets/{product-preview-content-qdFyo4NG.js → product-preview-content-Ck6OzP09.js} +1 -1
  69. package/dist/gateway/static/root/assets/project-detail-page-BHoQ10Eo.js +1 -0
  70. package/dist/gateway/static/root/assets/projects-page-DYsq_OLJ.js +1 -0
  71. package/dist/gateway/static/root/assets/{registry-api-BwR2CiR5.js → registry-api-BbUEMGcj.js} +1 -1
  72. package/dist/gateway/static/root/assets/remote-access-hub-CU3EChY0.js +1 -0
  73. package/dist/gateway/static/root/assets/{runtime-tools-api-C_VOMhLI.js → runtime-tools-api-D0xtCTXr.js} +1 -1
  74. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BCHLh-KQ.js → runtime-tools-settings-panel-Bfs5zKDg.js} +1 -1
  75. package/dist/gateway/static/root/assets/{schema-form-CJvaVHkx.js → schema-form-BbI2BuSU.js} +1 -1
  76. package/dist/gateway/static/root/assets/{session-api-DbNNQps9.js → session-api-CAKgrbgz.js} +1 -1
  77. package/dist/gateway/static/root/assets/{session-manager-DfVviLTK.js → session-manager-D_N7qha7.js} +1 -1
  78. package/dist/gateway/static/root/assets/sessions-page-CjB2GOTs.js +1 -0
  79. package/dist/gateway/static/root/assets/settings-advanced-gate-jbVx8gcF.js +1 -0
  80. package/dist/gateway/static/root/assets/{settings-form-section-B3eODxNv.js → settings-form-section-BfBBJlr-.js} +1 -1
  81. package/dist/gateway/static/root/assets/{settings-page-Dg86uCnr.js → settings-page-9yu4SN1j.js} +1 -1
  82. package/dist/gateway/static/root/assets/setup-status-panel-DhWB3feW.js +1 -0
  83. package/dist/gateway/static/root/assets/{share-preview-page-DCy1f25V.js → share-preview-page-B6lQl5xb.js} +1 -1
  84. package/dist/gateway/static/root/assets/shares-settings-UJGjdz3F.js +1 -0
  85. package/dist/gateway/static/root/assets/{skill-api-RisyPAMA.js → skill-api-y2m3k_R4.js} +1 -1
  86. package/dist/gateway/static/root/assets/skill-reload-api-Bk9FqsVa.js +1 -0
  87. package/dist/gateway/static/root/assets/skills-page-DLd4O-Fo.js +2 -0
  88. package/dist/gateway/static/root/assets/{style-CwMX73G7.js → style-C2ptQg95.js} +1 -1
  89. package/dist/gateway/static/root/assets/{system-settings-panel-Cma37Pfm.js → system-settings-panel-DYzcLnVk.js} +1 -1
  90. package/dist/gateway/static/root/assets/task-detail-page-DLGtmHAH.js +2 -0
  91. package/dist/gateway/static/root/assets/{task-expandable-content-D3i_51Oc.js → task-expandable-content-HdEeV_0-.js} +1 -1
  92. package/dist/gateway/static/root/assets/{tracing-settings-page-DC-kLysq.js → tracing-settings-page-DKQYmzFn.js} +1 -1
  93. package/dist/gateway/static/root/assets/{tunnel-api-BgdhbR1L.js → tunnel-api-C2VY_HTy.js} +1 -1
  94. package/dist/gateway/static/root/assets/usage-page-CjzunQtj.js +1 -0
  95. package/dist/gateway/static/root/assets/{use-autosave-iKvZ1pvC.js → use-autosave-BElgnGMt.js} +1 -1
  96. package/dist/gateway/static/root/assets/user-model-page-DsOGCDTR.js +2 -0
  97. package/dist/gateway/static/root/assets/{voice-api-key-field-CESbtuwM.js → voice-api-key-field-FVjX0qhn.js} +1 -1
  98. package/dist/gateway/static/root/assets/{voice-config-api-Ceo_hqZC.js → voice-config-api-T3nM4buh.js} +1 -1
  99. package/dist/gateway/static/root/assets/{work-discovery-overlay-dtPpmYyh.js → work-discovery-overlay-B2S2NZuK.js} +1 -1
  100. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DmFn3E_B.js → workflow-run-setup-panel-2Gq34KQk.js} +2 -2
  101. package/dist/gateway/static/root/assets/workflows-page-CjeFD3mk.js +6 -0
  102. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DTZnabfg.js → xopc-cloud-account-card-BZMIZxWg.js} +1 -1
  103. package/dist/gateway/static/root/index.html +15 -15
  104. package/dist/package.js +1 -1
  105. package/dist/src/agent/agent-manager.d.ts +8 -0
  106. package/dist/src/agent/agent-manager.js +3 -3
  107. package/dist/src/agent/background-review/run-background-review.js +1 -1
  108. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  109. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  110. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  111. package/dist/src/agent/service/process-direct-streaming.js +1 -1
  112. package/dist/src/agent/service.js +2 -2
  113. package/dist/src/agent/skills/index.js +1 -1
  114. package/dist/src/agent/skills/managed-store.js +1 -1
  115. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  116. package/dist/src/agent/tools/factory.js +1 -1
  117. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  118. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  119. package/dist/src/agent/workspace-runtime/registry.js +1 -1
  120. package/dist/src/agent-catalog/capabilities.js +2 -2
  121. package/dist/src/automations/capabilities/drafts.js +1 -1
  122. package/dist/src/automations/service/action-executor.js +2 -2
  123. package/dist/src/bootstrap/application-state.js +1 -1
  124. package/dist/src/browser/native-messaging-host.js +1 -1
  125. package/dist/src/browser/providers/browser-ext-install.js +2 -2
  126. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  127. package/dist/src/capabilities/runtime/product.js +1 -1
  128. package/dist/src/channels/index.js +1 -1
  129. package/dist/src/channels/manager.js +1 -1
  130. package/dist/src/chat-commands/agent-edit.js +1 -1
  131. package/dist/src/cli/commands/agent.js +1 -1
  132. package/dist/src/cli/commands/agents.js +1 -1
  133. package/dist/src/cli/commands/channels.js +1 -1
  134. package/dist/src/cli/commands/connectors.js +1 -1
  135. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  136. package/dist/src/cli/commands/models.js +2 -2
  137. package/dist/src/cli/commands/onboard/model.js +1 -1
  138. package/dist/src/cli/commands/onboard.js +1 -1
  139. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  140. package/dist/src/config/agent-model-intents.js +1 -1
  141. package/dist/src/config/agent-profile.js +2 -2
  142. package/dist/src/config/loader.js +1 -1
  143. package/dist/src/config/models-json.js +1 -1
  144. package/dist/src/config/schema.js +2 -2
  145. package/dist/src/extensions/agent-plugins/branding.d.ts +6 -0
  146. package/dist/src/extensions/agent-plugins/branding.js +11 -1
  147. package/dist/src/extensions/agent-plugins/cli-authorization.d.ts +11 -0
  148. package/dist/src/extensions/agent-plugins/cli-authorization.js +11 -6
  149. package/dist/src/extensions/agent-plugins/inventory.d.ts +12 -0
  150. package/dist/src/extensions/agent-plugins/inventory.js +3 -2
  151. package/dist/src/extensions/agent-plugins/setup-contract.d.ts +20 -0
  152. package/dist/src/extensions/agent-plugins/setup-contract.js +20 -1
  153. package/dist/src/extensions/agent-plugins/setup.d.ts +8 -0
  154. package/dist/src/extensions/agent-plugins/setup.js +10 -5
  155. package/dist/src/extensions/agent-plugins/skill-catalog.d.ts +14 -0
  156. package/dist/src/extensions/agent-plugins/skill-catalog.js +95 -0
  157. package/dist/src/extensions/agent-plugins/store.js +1 -1
  158. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  159. package/dist/src/extensions/sdk/index.js +1 -1
  160. package/dist/src/gateway/agents-admin.js +2 -2
  161. package/dist/src/gateway/hono/app.js +1 -1
  162. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  163. package/dist/src/gateway/hono/routes/agent-plugins.js +1 -1
  164. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  165. package/dist/src/gateway/hono/routes/browser-install.js +1 -1
  166. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  167. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  168. package/dist/src/gateway/hono/routes/context-sources.js +1 -1
  169. package/dist/src/gateway/hono/routes/notes.js +2 -2
  170. package/dist/src/gateway/hono/routes/projects.js +2 -2
  171. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  172. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  173. package/dist/src/gateway/image-generation-setup.js +1 -1
  174. package/dist/src/gateway/lock.js +1 -1
  175. package/dist/src/gateway/service/marketplace-service.js +4 -2
  176. package/dist/src/gateway/service.js +9 -9
  177. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  178. package/dist/src/home-intelligence/host.js +2 -2
  179. package/dist/src/local-apps/service.js +1 -1
  180. package/dist/src/personal-agent/proactivity/service.js +1 -1
  181. package/dist/src/personal-agent/service.js +2 -2
  182. package/dist/src/providers/model-catalog-persistence.js +1 -1
  183. package/dist/src/routing/resolve-route.js +1 -1
  184. package/dist/src/routing/resolve-tui-session-key.js +1 -1
  185. package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
  186. package/dist/src/tasks/capabilities/read.js +2 -2
  187. package/dist/src/tasks/capabilities/write.js +1 -1
  188. package/dist/src/tasks/task-handoff-service.js +1 -1
  189. package/dist/src/tui/backends/embedded-backend.js +2 -2
  190. package/dist/src/voice/realtime/persona-context.js +1 -1
  191. package/package.json +3 -3
  192. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CzKNVkRn.js +0 -1
  193. package/dist/gateway/static/root/assets/agent-plugin-dialog-mpA9rwYd.js +0 -1
  194. package/dist/gateway/static/root/assets/agents-7VMa7Rzo.js +0 -77
  195. package/dist/gateway/static/root/assets/apps-page-CvqDUvof.js +0 -1
  196. package/dist/gateway/static/root/assets/automations-workspace-DvTSHLt3.js +0 -6
  197. package/dist/gateway/static/root/assets/browser-automations-page-CJGBhDnv.js +0 -3
  198. package/dist/gateway/static/root/assets/browser-settings-page-tsi5W-cJ.js +0 -3
  199. package/dist/gateway/static/root/assets/capabilities-page-CfbGk8q_.js +0 -2
  200. package/dist/gateway/static/root/assets/capabilities-settings-panel-BkO7QEyA.js +0 -8
  201. package/dist/gateway/static/root/assets/channels-D0CwJktG.js +0 -1
  202. package/dist/gateway/static/root/assets/computer-settings-page-D_b_bFVz.js +0 -1
  203. package/dist/gateway/static/root/assets/connectors-page-DlpfL2Rc.js +0 -1
  204. package/dist/gateway/static/root/assets/device-pairing-wizard-12m5Z9-8.js +0 -1
  205. package/dist/gateway/static/root/assets/extension-page-CXxM1M62.js +0 -1
  206. package/dist/gateway/static/root/assets/extension-settings-page-AF5nvsPP.js +0 -1
  207. package/dist/gateway/static/root/assets/gateway-realtime-store-DQ6-whg-.js +0 -1
  208. package/dist/gateway/static/root/assets/gateway-settings-ABXvW_yL.js +0 -1
  209. package/dist/gateway/static/root/assets/home-page-LXGxGwVl.js +0 -2
  210. package/dist/gateway/static/root/assets/index-BKHxJaGD.css +0 -1
  211. package/dist/gateway/static/root/assets/management-settings-C52cuMg1.js +0 -1
  212. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CPYJsRUJ.js +0 -1
  213. package/dist/gateway/static/root/assets/messages-DPxcWxfD.js +0 -3
  214. package/dist/gateway/static/root/assets/note-detail-panel-CNN41byS.js +0 -5
  215. package/dist/gateway/static/root/assets/notes-page-BsfBp_8z.js +0 -8
  216. package/dist/gateway/static/root/assets/personal-page-N4KoCZYG.js +0 -1
  217. package/dist/gateway/static/root/assets/plugin-details-page-DcrrzQI-.js +0 -1
  218. package/dist/gateway/static/root/assets/project-detail-page-y67s_fA8.js +0 -1
  219. package/dist/gateway/static/root/assets/projects-page-D5iYgi0O.js +0 -1
  220. package/dist/gateway/static/root/assets/remote-access-hub-DeFF7Re-.js +0 -1
  221. package/dist/gateway/static/root/assets/sessions-page-DZ93_D5M.js +0 -1
  222. package/dist/gateway/static/root/assets/settings-advanced-gate-F1WX7vxq.js +0 -1
  223. package/dist/gateway/static/root/assets/setup-status-panel-ruFzAArp.js +0 -1
  224. package/dist/gateway/static/root/assets/shares-settings-DeIVZvpJ.js +0 -1
  225. package/dist/gateway/static/root/assets/skill-reload-api-Dwkm1Fof.js +0 -1
  226. package/dist/gateway/static/root/assets/skills-page-UiTLsrFc.js +0 -2
  227. package/dist/gateway/static/root/assets/task-detail-page-BKOF_kxS.js +0 -2
  228. package/dist/gateway/static/root/assets/usage-page-BSlFg3Xj.js +0 -1
  229. package/dist/gateway/static/root/assets/user-model-page-D4GB8QsM.js +0 -2
  230. package/dist/gateway/static/root/assets/workflows-page-DEtaRuxH.js +0 -6
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./folder-open-CyzJ19I9.js";import{t as o}from"./plus-Q2yW6OE7.js";import{t as s}from"./x-B_N4OPjy.js";import{t as ee}from"./messages-DBvKzlCl.js";import{t as c}from"./cn-0WouolD0.js";import{n as l}from"./locale-store-Jnhw2WMv.js";import{a as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./dist-BGTk37IG.js";import{$a as _,Co as v,Dd as te,Ef as y,Go as b,Gu as x,Mi as S,Oo as C,Rc as w,To as T,Wc as E,co as D,ds as O,fs as k,kf as ne,mo as A,po as j,ro as re,ru as ie,su as M,vu as N,wo as ae,yu as P}from"./index-DvKDT-RQ.js";var F=n(),I=e(t(),1),L=r();function R(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:S(n)}function oe(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function se(){let e=(0,F.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},z)}),e[0]=t):t=e[0],t}function z(e,t){return(0,L.jsx)(w,{className:`h-40 rounded-xl`},t)}function ce(e){let t=(0,F.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=l(B),c,u,d,f,p,m,h,g;if(t[0]!==s||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(s).projectsPage;c=e.management,h=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,L.jsx)(te,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,L.jsx)(`h2`,{className:`truncate text-base font-semibold sm:text-sm text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,L.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,L.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),l;t[20]===o?l=t[21]:(l=(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=l);let _;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,L.jsx)(y,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=_):_=t[22];let v;t[23]===l?v=t[24]:(v=(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[l,_]}),t[23]=l,t[24]=v),g=(0,L.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[v,(0,L.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-6 sm:text-xs sm:leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),m=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,f=`min-w-0 text-xs text-fg-muted`,p=(0,L.jsx)(`p`,{className:`hidden truncate sm:block`,children:n.workspaceRoot||e.agentDefault}),u=`mt-1`,d=R(n.lastActiveAt??n.updatedAt,e.never),t[0]=s,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=c,t[10]=u,t[11]=d,t[12]=f,t[13]=p,t[14]=m,t[15]=h,t[16]=g}else c=t[9],u=t[10],d=t[11],f=t[12],p=t[13],m=t[14],h=t[15],g=t[16];let _;t[25]!==u||t[26]!==d?(_=(0,L.jsx)(`p`,{className:u,children:d}),t[25]=u,t[26]=d,t[27]=_):_=t[27];let v;t[28]!==f||t[29]!==p||t[30]!==_?(v=(0,L.jsxs)(`div`,{className:f,children:[p,_]}),t[28]=f,t[29]=p,t[30]=_,t[31]=v):v=t[31];let b=n.pinnedAt?c.unpin:c.pin,x=n.pinnedAt?c.unpin:c.pin,S;t[32]===n.pinnedAt?S=t[33]:(S=n.pinnedAt?(0,L.jsx)(N,{className:`size-4`,"aria-hidden":!0}):(0,L.jsx)(P,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=S);let C;t[34]!==r||t[35]!==a||t[36]!==b||t[37]!==x||t[38]!==S?(C=(0,L.jsx)(E,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":b,title:x,children:S}),t[34]=r,t[35]=a,t[36]=b,t[37]=x,t[38]=S,t[39]=C):C=t[39];let w=n.status===`archived`?c.restore:c.archive,T=n.status===`archived`?c.restore:c.archive,D;t[40]===n.status?D=t[41]:(D=n.status===`archived`?(0,L.jsx)(M,{className:`size-4`,"aria-hidden":!0}):(0,L.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=D);let O;t[42]!==r||t[43]!==o||t[44]!==w||t[45]!==T||t[46]!==D?(O=(0,L.jsx)(E,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":w,title:T,children:D}),t[42]=r,t[43]=o,t[44]=w,t[45]=T,t[46]=D,t[47]=O):O=t[47];let k;t[48]!==C||t[49]!==O?(k=(0,L.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[C,O]}),t[48]=C,t[49]=O,t[50]=k):k=t[50];let A;t[51]!==k||t[52]!==m||t[53]!==v?(A=(0,L.jsxs)(`div`,{className:m,children:[v,k]}),t[51]=k,t[52]=m,t[53]=v,t[54]=A):A=t[54];let j;return t[55]!==A||t[56]!==h||t[57]!==g?(j=(0,L.jsxs)(`article`,{className:h,children:[g,A]}),t[55]=A,t[56]=h,t[57]=g,t[58]=j):j=t[58],j}function B(e){return e.language}function V(){let e=ee(l(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=b(e=>e.setPageHeader),y=b(e=>e.clearPageHeader),[S,w]=(0,I.useState)([]),[ne,M]=(0,I.useState)(!0),[N,P]=(0,I.useState)(null),[F,R]=(0,I.useState)(``),[z,B]=(0,I.useState)(!1),[V,le]=(0,I.useState)(`active`),[ue,de]=(0,I.useState)(null),[fe,H]=(0,I.useState)(!1),[pe,U]=(0,I.useState)(null),[W,G]=(0,I.useState)(!1),[K,me]=(0,I.useState)(!0),[q,he]=(0,I.useState)(``),[J,ge]=(0,I.useState)(``),[Y,_e]=(0,I.useState)(``),X=re({initialPath:Y,onPicked:_e}),Z=(0,I.useRef)(0),Q=(0,I.useCallback)(async(e=!1)=>{let t=++Z.current;e||(M(!0),P(null));try{let e=await v({limit:100,sortBy:`updatedAt`,sortOrder:`desc`});t===Z.current&&w(oe(e.items))}catch(n){!e&&t===Z.current&&P(n instanceof Error?n.message:String(n))}finally{t===Z.current&&M(!1)}},[]);(0,I.useEffect)(()=>(Q(),()=>{Z.current++}),[Q]),(0,I.useEffect)(()=>{let e=()=>{Q(!0)};return window.addEventListener(`project-resource-changed`,e),()=>{window.removeEventListener(`project-resource-changed`,e)}},[Q]);let $=(0,I.useMemo)(()=>{let e=F.trim().toLocaleLowerCase();return S.filter(e=>V===`all`||e.status===V).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[V,S,F]),ve=(0,I.useMemo)(()=>(0,L.jsxs)(E,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>H(!0),children:[(0,L.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,I.useLayoutEffect)(()=>(i({startExtra:null,main:(0,L.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:ve}),()=>y()),[y,ve,n.title,i]);let ye=(0,I.useCallback)(async e=>{e.preventDefault();let t=q.trim(),n=Y.trim();if(!(!t||!n||W)){G(!0),U(null);try{let e=await A({autoUnderstand:K,name:t,...J.trim()?{description:J.trim()}:{},workspaceRoot:n});w(t=>[e,...t.filter(t=>t.id!==e.id)]),he(``),ge(``),_e(``),me(!0),H(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){U(e instanceof Error?e.message:String(e))}finally{G(!1)}}},[W,J,q,Y,K]),be=(0,I.useCallback)(async(e,t)=>{de(e.id),P(null);try{let n;n=t===`pin`?e.pinnedAt?await C(e.id,e.version):await ae(e.id,e.version):e.status===`archived`?await T(e.id,e.version):await j(e.id,e.version),w(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){P(e instanceof Error?e.message:String(e))}finally{de(null)}},[]),xe=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}],Se=xe.find(e=>e.id===V)?.label??t.all,Ce=n.resultCount.replace(`{{status}}`,Se).replace(`{{count}}`,String($.length));return(0,L.jsxs)(`main`,{className:`mx-auto flex w-full max-w-7xl flex-1 flex-col gap-5 px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,L.jsx)(g,{open:fe,onOpenChange:e=>{H(e),e||U(null)},children:(0,L.jsxs)(p,{children:[(0,L.jsx)(u,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,L.jsxs)(m,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,L.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,L.jsx)(h,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,L.jsx)(d,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,L.jsxs)(`form`,{onSubmit:ye,className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,L.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,L.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:q,onChange:e=>he(e.target.value),maxLength:160})]}),(0,L.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,L.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>ge(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,L.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,L.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,L.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:X.pick,disabled:W||X.picking,children:[X.picking?(0,L.jsx)(x,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,L.jsx)(a,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Y?r.chooseFolder:r.selectWorkingDirectory}),(0,L.jsx)(`span`,{className:c(`mt-0.5 block truncate font-mono text-xs font-normal`,Y?`text-fg-muted`:`text-fg-subtle`),title:Y||void 0,children:Y||t.workspaceSelectionPlaceholder})]})]}),(0,L.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),(0,L.jsx)(D,{checked:K,onChange:me,disabled:W}),pe?(0,L.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:pe}):null]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,L.jsx)(f,{asChild:!0,children:(0,L.jsx)(E,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,L.jsx)(E,{type:`submit`,variant:`primary`,disabled:W||!q.trim()||!Y.trim(),children:W?t.home.creating:t.create})]})]})]})]})}),X.hasNativePicker?null:(0,L.jsx)(_,{open:X.modalOpen,onOpenChange:X.setModalOpen,initialAbsolutePath:Y||void 0,onConfirm:X.confirmPick,wd:r}),(0,L.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:Ce}),(0,L.jsxs)(`div`,{className:c(`ml-auto flex min-w-0 items-center justify-end gap-2`,z&&`w-full sm:w-auto`),children:[z?(0,L.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,L.jsx)(ie,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,L.jsx)(`input`,{autoFocus:!0,className:`h-11 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-12 text-base sm:h-9 sm:text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:F,onChange:e=>R(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,L.jsx)(`button`,{type:`button`,className:`touch-target absolute right-0 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{R(``),B(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,L.jsx)(s,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,L.jsx)(E,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>B(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,L.jsx)(ie,{className:`size-4`,"aria-hidden":!0})}),(0,L.jsx)(O,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:V,"aria-label":n.filterLabel,onChange:e=>le(e.target.value),children:xe.map(e=>(0,L.jsx)(k,{value:e.id,children:e.label},e.id))})]})]}),N?(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,L.jsx)(`span`,{children:N}),(0,L.jsx)(E,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,ne?(0,L.jsx)(se,{}):$.length?(0,L.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,L.jsx)(ce,{project:e,busy:ue===e.id,onTogglePin:()=>void be(e,`pin`),onToggleArchive:()=>void be(e,`archive`)},e.id))}):(0,L.jsxs)(`section`,{className:`py-16 text-center`,children:[(0,L.jsx)(te,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,L.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{V as ProjectsPage};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-swr-BIWyz7Rc.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-zJ_50EbN.js";import{r as t}from"./locale-store-Djl2FW6_.js";import{t as n}from"./gateway-startup-retry-BCUswcVy.js";async function r(){let e=await n(t(`/api/models`));if(!e.ok)throw Error(`Models: HTTP ${e.status}`);return(await e.json()).payload?.models??[]}var i=null,a=0,o=null,s=6e4,c=`gateway-configured-models`;async function l(){i=null,a=0;let{mutate:t}=await e(async()=>{let{mutate:e}=await import(`./vendor-swr-BIWyz7Rc.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2]));await t(c)}async function u(e=!1){if(!e&&i&&Date.now()<a)return i;if(e){let e=await r();return i=e,a=Date.now()+s,e}return o||(o=r().then(e=>(i=e,a=Date.now()+s,e)).finally(()=>{o=null}),o)}export{u as n,l as r,c as t};
2
+ import{t as e}from"./preload-helper-zJ_50EbN.js";import{r as t}from"./locale-store-Jnhw2WMv.js";import{t as n}from"./gateway-startup-retry-CqyGHM2M.js";async function r(){let e=await n(t(`/api/models`));if(!e.ok)throw Error(`Models: HTTP ${e.status}`);return(await e.json()).payload?.models??[]}var i=null,a=0,o=null,s=6e4,c=`gateway-configured-models`;async function l(){i=null,a=0;let{mutate:t}=await e(async()=>{let{mutate:e}=await import(`./vendor-swr-BIWyz7Rc.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2]));await t(c)}async function u(e=!1){if(!e&&i&&Date.now()<a)return i;if(e){let e=await r();return i=e,a=Date.now()+s,e}return o||(o=r().then(e=>(i=e,a=Date.now()+s,e)).finally(()=>{o=null}),o)}export{u as n,l as r,c as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,t as o}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./messages-DBvKzlCl.js";import{t as d}from"./cn-0WouolD0.js";import{c as f,n as p}from"./locale-store-Jnhw2WMv.js";import{a as m,i as h,o as g,r as _,s as v,t as y}from"./dist-BGTk37IG.js";import{t as b}from"./copy-to-clipboard-HOJ79TWv.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{n as S,r as C}from"./gateway-config-swr-DAir1JsW.js";import{$d as w,Al as T,Au as E,Ef as D,F as O,Fl as k,G as A,Gt as j,Gu as M,Hn as N,I as P,L as F,Ns as I,Rt as L,Sd as R,Vt as z,Wc as B,Yl as V,Za as H,cd as ee,cf as U,is as W,ja as te,no as ne,pu as G,ql as K,tu as q,uf as re,vs as J,ys as ie,zt as ae}from"./index-DvKDT-RQ.js";import{n as oe,r as se,t as ce}from"./settings-page-layout-Dx5S-Msc.js";import{n as Y,r as le,t as ue}from"./settings-form-section-BfBBJlr-.js";import{_ as X,a as de,b as fe,c as pe,h as me,i as he,n as ge,o as _e,r as ve,s as ye,t as be,v as xe,y as Se}from"./tunnel-api-C2VY_HTy.js";import{t as Ce}from"./settings-advanced-gate-jbVx8gcF.js";var Z=e(t(),1),Q=n(),$=r();function we(e){switch(e){case`active`:return`text-emerald-700 dark:text-emerald-400`;case`connecting`:return`text-amber-700 dark:text-amber-400`;default:return`text-fg-muted`}}function Te(e){let t=(0,Q.c)(11),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=d(`inline-flex items-center gap-1.5 text-xs font-medium`,we(r)),t[0]=r,t[1]=i);let a=r===`active`&&`bg-emerald-500`,o=r===`connecting`&&`bg-amber-500`,s;t[2]!==a||t[3]!==o?(s=d(`size-1.5 rounded-full bg-fg-subtle/50`,a,o),t[2]=a,t[3]=o,t[4]=s):s=t[4];let c;t[5]===s?c=t[6]:(c=(0,$.jsx)(`span`,{className:s,"aria-hidden":!0}),t[5]=s,t[6]=c);let l;return t[7]!==n||t[8]!==i||t[9]!==c?(l=(0,$.jsxs)(`span`,{className:i,children:[c,n]}),t[7]=n,t[8]=i,t[9]=c,t[10]=l):l=t[10],l}function Ee(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=p(Oe),i;t[0]===r?i=t[1]:(i=u(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!f(De),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=x(o?`exposure-status`:null,Se,s),l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},t[3]=l):l=t[3];let{data:m}=x(o?`tunnel-status`:null,ge,l),h=C(o);if(!o)return null;let g=c?.tailscale.active===!0,_=m?.state,v=m?.enabled&&_===`connected`,y=m?.enabled&&(_===`connecting`||_===`reconnecting`||!!m?.startProgress||!!m?.frpcDownload),b=h.data?.payload?.config,S=!!(b&&typeof b==`object`&&!Array.isArray(b)&&b.gateway?.publicUrl),w=g?`active`:`off`,T=g?a.statusActive:a.statusOff,D;t[4]!==a.tailscaleCardTitle||t[5]!==w||t[6]!==T?(D={tab:`tailscale`,icon:R,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=v?`active`:y?`connecting`:`off`,A=v?a.statusActive:y?a.statusConnecting:a.statusOff,j;t[8]!==a.publicCardTitle||t[9]!==O||t[10]!==A?(j={tab:`public`,icon:E,title:a.publicCardTitle,kind:O,statusLabel:A},t[8]=a.publicCardTitle,t[9]=O,t[10]=A,t[11]=j):j=t[11];let M=S?`active`:`off`,N=S?a.statusActive:a.statusOff,P;t[12]!==a.reverseProxyCardTitle||t[13]!==M||t[14]!==N?(P={tab:`reverse-proxy`,icon:V,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:q,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 z=L,B;return t[28]!==z||t[29]!==n?(B=(0,$.jsx)(`div`,{className:`grid gap-1 rounded-xl bg-surface-hover/20 p-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:z.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:d(`flex items-start gap-3 rounded-lg bg-surface-base/45 px-2 py-3 text-left transition-colors`,`hover:bg-surface-hover/30`,`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 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)(Te,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=z,t[29]=n,t[30]=B):B=t[30],B}function De(e){return e.conversationId}function Oe(e){return e.language}function ke(e){let t=(0,Q.c)(21),{title:n,description:r,recommended:i,icon:a,onOpen:o,recommendedLabel:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=d(`group flex w-full items-start gap-3 px-3 py-4 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/70 text-fg-muted`,children:(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=a,t[2]=l);let u;t[3]===n?u=t[4]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=u);let f;t[5]!==i||t[6]!==s?(f=i&&s?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:s}):null,t[5]=i,t[6]=s,t[7]=f):f=t[7];let p;t[8]!==u||t[9]!==f?(p=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[u,f]}),t[8]=u,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)(U,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":!0}),t[16]=g):g=t[16];let _;return t[17]!==o||t[18]!==l||t[19]!==h?(_=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:c,children:[l,h,g]}),t[17]=o,t[18]=l,t[19]=h,t[20]=_):_=t[20],_}function Ae(e){let t=(0,Q.c)(78),{onOpenTab:n}=e,r=p(Ne),i;t[0]===r?i=t[1]:(i=u(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!f(Me),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:l}=x(s?`exposure-status`:null,Se,c),d;t[3]===l?.conflicts?d=t[4]:(d=l?.conflicts??[],t[3]=l?.conflicts,t[4]=d);let m=d;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 h;t[7]===n?h=t[8]:(h=(0,$.jsx)(Ee,{onOpenTab:n}),t[7]=n,t[8]=h);let g;t[9]!==m||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(g=m.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl bg-amber-500/10 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:m.map(je)})]}):null,t[9]=m,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=g):g=t[12];let _;t[13]===o.pickMethod?_=t[14]:(_=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=_);let v;t[15]===n?v=t[16]:(v=()=>n(`tailscale`),t[15]=n,t[16]=v);let y;t[17]!==o.recommended||t[18]!==o.tailscaleCardDesc||t[19]!==o.tailscaleCardTitle||t[20]!==v?(y=(0,$.jsx)(ke,{icon:R,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,onOpen:v}),t[17]=o.recommended,t[18]=o.tailscaleCardDesc,t[19]=o.tailscaleCardTitle,t[20]=v,t[21]=y):y=t[21];let b;t[22]===n?b=t[23]:(b=()=>n(`public`),t[22]=n,t[23]=b);let S;t[24]!==o.publicCardDesc||t[25]!==o.publicCardTitle||t[26]!==b?(S=(0,$.jsx)(ke,{icon:E,title:o.publicCardTitle,description:o.publicCardDesc,onOpen:b}),t[24]=o.publicCardDesc,t[25]=o.publicCardTitle,t[26]=b,t[27]=S):S=t[27];let C;t[28]===n?C=t[29]:(C=()=>n(`reverse-proxy`),t[28]=n,t[29]=C);let w;t[30]!==o.reverseProxyCardDesc||t[31]!==o.reverseProxyCardTitle||t[32]!==C?(w=(0,$.jsx)(ke,{icon:V,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,onOpen:C}),t[30]=o.reverseProxyCardDesc,t[31]=o.reverseProxyCardTitle,t[32]=C,t[33]=w):w=t[33];let T;t[34]===n?T=t[35]:(T=()=>n(`ssh`),t[34]=n,t[35]=T);let D;t[36]!==o.sshCardDesc||t[37]!==o.sshCardTitle||t[38]!==T?(D=(0,$.jsx)(ke,{icon:k,title:o.sshCardTitle,description:o.sshCardDesc,onOpen:T}),t[36]=o.sshCardDesc,t[37]=o.sshCardTitle,t[38]=T,t[39]=D):D=t[39];let O;t[40]!==a.advanced.proxyBody||t[41]!==a.advanced.proxyTitle||t[42]!==w||t[43]!==D?(O=(0,$.jsxs)(A,{title:a.advanced.proxyTitle,summary:a.advanced.proxyBody,children:[w,D]}),t[40]=a.advanced.proxyBody,t[41]=a.advanced.proxyTitle,t[42]=w,t[43]=D,t[44]=O):O=t[44];let j;t[45]===n?j=t[46]:(j=()=>n(`lan`),t[45]=n,t[46]=j);let M;t[47]!==o.lanCardDesc||t[48]!==o.lanCardTitle||t[49]!==j?(M=(0,$.jsx)(ke,{icon:q,title:o.lanCardTitle,description:o.lanCardDesc,onOpen:j}),t[47]=o.lanCardDesc,t[48]=o.lanCardTitle,t[49]=j,t[50]=M):M=t[50];let N;t[51]!==S||t[52]!==O||t[53]!==M||t[54]!==y?(N=(0,$.jsxs)(`div`,{className:`mt-2 flex max-w-3xl flex-col gap-1 rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:[y,S,O,M]}),t[51]=S,t[52]=O,t[53]=M,t[54]=y,t[55]=N):N=t[55];let P;t[56]!==N||t[57]!==_?(P=(0,$.jsxs)(`div`,{children:[_,N]}),t[56]=N,t[57]=_,t[58]=P):P=t[58];let F;t[59]===o.oneAtATimeHint?F=t[60]:(F=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[59]=o.oneAtATimeHint,t[60]=F);let I;t[61]===a.advanced.proxyTitle?I=t[62]:(I=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[61]=a.advanced.proxyTitle,t[62]=I);let L;t[63]===a.advanced.proxyBody?L=t[64]:(L=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[63]=a.advanced.proxyBody,t[64]=L);let z;t[65]!==r||t[66]!==a.advanced.proxyDocs?(z=(0,$.jsx)(fe,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[65]=r,t[66]=a.advanced.proxyDocs,t[67]=z):z=t[67];let B;t[68]!==I||t[69]!==L||t[70]!==z?(B=(0,$.jsxs)(`div`,{className:`max-w-3xl rounded-xl bg-surface-hover/20 px-4 py-4`,children:[I,L,z]}),t[68]=I,t[69]=L,t[70]=z,t[71]=B):B=t[71];let H;return t[72]!==P||t[73]!==F||t[74]!==B||t[75]!==h||t[76]!==g?(H=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[h,g,P,F,B]}),t[72]=P,t[73]=F,t[74]=B,t[75]=h,t[76]=g,t[77]=H):H=t[77],H}function je(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Me(e){return e.conversationId}function Ne(e){return e.language}function Pe(){let e=(0,Q.c)(16),t=p(Fe),n;e[0]===t?n=e[1]:(n=u(t),e[0]=t,e[1]=n);let r=n.remoteAccess.lan,i;e[2]!==r.subtitle||e[3]!==r.title?(i=(0,$.jsx)(Y,{icon:q,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)(l,{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 d;e[10]!==a||e[11]!==c?(d=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[a,c]}),e[10]=a,e[11]=c,e[12]=d):d=e[12];let f;return e[13]!==i||e[14]!==d?(f=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(ue,{children:[i,d]})}),e[13]=i,e[14]=d,e[15]=f):f=e[15],f}function Fe(e){return e.language}function Ie(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=p(Le),a;t[0]===i?a=t[1]:(a=u(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[s,l]=(0,Z.useState)(!1),d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=async()=>{await b(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(l(!0),setTimeout(()=>l(!1),2e3))},t[2]=d):d=t[2];let f=d,m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg bg-surface-base/55 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]=m):m=t[3];let h,g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>void f(),g=(0,$.jsx)(c,{className:`mr-1 size-4`}),t[4]=h,t[5]=g):(h=t[4],g=t[5]);let _=s?o.copied:o.copy,v;t[6]===_?v=t[7]:(v=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(B,{type:`button`,variant:`ghost`,onClick:h,children:[g,_]})}),t[6]=_,t[7]=v);let y;t[8]!==r||t[9]!==o.hint?(y=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]=y):y=t[10];let x;t[11]!==v||t[12]!==y?(x=(0,$.jsxs)($.Fragment,{children:[m,v,y]}),t[11]=v,t[12]=y,t[13]=x):x=t[13];let S=x;if(r){let e;t[14]!==o.subtitle||t[15]!==o.title?(e=(0,$.jsx)(Y,{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)(ue,{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)(Y,{icon:k,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=C):C=t[24];let w;t[25]===S?w=t[26]:(w=(0,$.jsx)(`div`,{className:`mt-4`,children:S}),t[25]=S,t[26]=w);let T;return t[27]!==C||t[28]!==w?(T=(0,$.jsxs)(ue,{children:[C,w]}),t[27]=C,t[28]=w,t[29]=T):T=t[29],T}function Le(e){return e.language}function Re(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Ie,{embedded:!0}),e[0]=t):t=e[0],t}var ze=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Be(e){return e&&ze.includes(e)?e:`guide`}function Ve(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,[f,p]=(0,Z.useState)(c??!1),m;t[0]===s?m=t[1]:(m=d(`rounded-xl bg-surface-hover/20`,s),t[0]=s,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>p(He),t[2]=h):h=t[2];let g=f&&`rotate-180`,_;t[3]===g?_=t[4]:(_=d(`size-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,g),t[3]=g,t[4]=_);let v;t[5]===_?v=t[6]:(v=(0,$.jsx)(re,{className:_,"aria-hidden":!0}),t[5]=_,t[6]=v);let y;t[7]===i?y=t[8]:(y=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[7]=i,t[8]=y);let b=f?r:n,x;t[9]===b?x=t[10]:(x=(0,$.jsx)(`span`,{children:b}),t[9]=b,t[10]=x);let S;t[11]!==f||t[12]!==v||t[13]!==y||t[14]!==x?(S=(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":f,onClick:h,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,y,x]}),t[11]=f,t[12]=v,t[13]=y,t[14]=x,t[15]=S):S=t[15];let C=f?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`,w;t[16]===C?w=t[17]:(w=d(`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]!==S||t[27]!==D||t[28]!==m?(O=(0,$.jsxs)(`section`,{className:m,children:[S,D]}),t[26]=S,t[27]=D,t[28]=m,t[29]=O):O=t[29];let k=O;if(u){let e;return t[30]===k?e=t[31]:(e=(0,$.jsx)(Ce,{children:k}),t[30]=k,t[31]=e),e}return k}function He(e){return!e}function Ue(e){let t=(0,Q.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:s,cancelLabel:c,onConfirm:l,onCancel:u}=e,[f,p]=(0,Z.useState)(!1),b;t[0]===u?b=t[1]:(b=e=>{e||(p(!1),u())},t[0]=u,t[1]=b);let x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(m,{className:d(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ie)}),t[2]=x):x=t[2];let S;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(S=d(`xopc-dialog-content 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-overlay p-6 shadow-popover outline-none dark:border-edge`,J),t[3]=S):S=t[3];let C;t[4]===r?C=t[5]:(C=(0,$.jsx)(v,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=C);let w;t[6]===i?w=t[7]:(w=(0,$.jsx)(h,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=w);let T;t[8]===a?T=t[9]:(T=a.map(We),t[8]=a,t[9]=T);let E;t[10]===T?E=t[11]:(E=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:T}),t[10]=T,t[11]=E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>p(e.target.checked),t[12]=D):D=t[12];let O;t[13]===f?O=t[14]:(O=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:f,onChange:D}),t[13]=f,t[14]=O);let k;t[15]===o?k=t[16]:(k=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=k);let A;t[17]!==k||t[18]!==O?(A=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[O,k]}),t[17]=k,t[18]=O,t[19]=A):A=t[19];let j;t[20]!==c||t[21]!==u?(j=(0,$.jsx)(B,{type:`button`,variant:`secondary`,onClick:u,children:c}),t[20]=c,t[21]=u,t[22]=j):j=t[22];let M=!f,N;t[23]!==s||t[24]!==l||t[25]!==M?(N=(0,$.jsx)(B,{type:`button`,disabled:M,onClick:l,children:s}),t[23]=s,t[24]=l,t[25]=M,t[26]=N):N=t[26];let P;t[27]!==j||t[28]!==N?(P=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[j,N]}),t[27]=j,t[28]=N,t[29]=P):P=t[29];let F;t[30]!==A||t[31]!==P||t[32]!==C||t[33]!==w||t[34]!==E?(F=(0,$.jsxs)(g,{children:[x,(0,$.jsxs)(_,{className:S,onOpenAutoFocus:Ge,children:[C,w,E,A,P]})]}),t[30]=A,t[31]=P,t[32]=C,t[33]=w,t[34]=E,t[35]=F):F=t[35];let I;return t[36]!==n||t[37]!==b||t[38]!==F?(I=(0,$.jsx)(y,{open:n,onOpenChange:b,children:F}),t[36]=n,t[37]=b,t[38]=F,t[39]=I):I=t[39],I}function We(e){return(0,$.jsx)(`li`,{children:e},e)}function Ge(e){return e.preventDefault()}function Ke(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var qe=[`preparing_frpc`,`registering`,`starting_frpc`];function Je(e){return e?e===`reconnecting_frpc`?qe.indexOf(`starting_frpc`):qe.indexOf(e):-1}function Ye(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=qe.indexOf(e),i=Je(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Xe(e,t,n){let r=n.startProgress;return Ye(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 Ze(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function Qe(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 $e(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(et),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let o=n.startProgress?.startedAt,c;if(t[3]!==n.state||t[4]!==o?(c=[n.state,o],t[3]=n.state,t[4]=o,t[5]=c):c=t[5],(0,Z.useEffect)(a,c),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let l,u,f,p,m;if(t[6]!==n||t[7]!==r){let e=Qe(n.startProgress?.startedAt);l=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,u=`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?(f=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=f):f=t[19];let o=qe.map(e=>{let t=Ye(e,n),i=Xe(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)(s,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(M,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(w,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:d(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:Ze(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:d(`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:[Ke(n.frpcDownload.bytesReceived),` /`,` `,Ke(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?p=t[21]:(p=(0,$.jsx)(`ol`,{className:`space-y-2`,children:o}),t[20]=o,t[21]=p),m=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]=l,t[9]=u,t[10]=f,t[11]=p,t[12]=m}else l=t[8],u=t[9],f=t[10],p=t[11],m=t[12];let h;t[22]!==l||t[23]!==r.publicUrlPendingNotice?(h=l?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=l,t[23]=r.publicUrlPendingNotice,t[24]=h):h=t[24];let g;return t[25]!==u||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h?(g=(0,$.jsxs)(`div`,{className:u,children:[f,p,m,h]}),t[25]=u,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g):g=t[30],g}function et(e){return e+1}function tt(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 nt(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function rt(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 it(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 at(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:f,stepLabel:p,onStart:m,onStop:h}=e,g=u===void 0?!1:u,_,v,y,b,x,S,C;t[0]!==r||t[1]!==o?(C=nt(r),_=r.enabled||o,v=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=d(le(),`space-y-4`),t[9]=S):S=t[9],x=`flex flex-wrap items-start justify-between gap-3`,b=`flex items-center gap-2`,y=d(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,rt(C)),t[0]=r,t[1]=o,t[2]=_,t[3]=v,t[4]=y,t[5]=b,t[6]=x,t[7]=S,t[8]=C):(_=t[2],v=t[3],y=t[4],b=t[5],x=t[6],S=t[7],C=t[8]);let w=C===`connected`&&`bg-emerald-500`,E=C===`progress`&&`bg-amber-500 animate-pulse`,D=C===`error`&&`bg-red-500`,O=C===`off`&&`bg-fg-subtle`,k;t[10]!==w||t[11]!==E||t[12]!==D||t[13]!==O?(k=d(`size-1.5 rounded-full`,w,E,D,O),t[10]=w,t[11]=E,t[12]=D,t[13]=O,t[14]=k):k=t[14];let A;t[15]===k?A=t[16]:(A=(0,$.jsx)(`span`,{className:k,"aria-hidden":!0}),t[15]=k,t[16]=A);let j;t[17]!==i||t[18]!==r||t[19]!==n?(j=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`}):tt(n,r),t[17]=i,t[18]=r,t[19]=n,t[20]=j):j=t[20];let N;t[21]!==A||t[22]!==j||t[23]!==y?(N=(0,$.jsxs)(`span`,{className:y,children:[A,j]}),t[21]=A,t[22]=j,t[23]=y,t[24]=N):N=t[24];let P;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(P=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,it(r.connectedSince)]}):null,t[25]=r.connectedSince,t[26]=r.state,t[27]=n.uptime,t[28]=P):P=t[28];let F;t[29]!==N||t[30]!==P||t[31]!==b?(F=(0,$.jsxs)(`div`,{className:b,children:[N,P]}),t[29]=N,t[30]=P,t[31]=b,t[32]=F):F=t[32];let I;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(R,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=I):I=t[33];let L;t[34]!==F||t[35]!==x?(L=(0,$.jsxs)(`div`,{className:x,children:[F,I]}),t[34]=F,t[35]=x,t[36]=L):L=t[36];let z;t[37]===a?z=t[38]:(z=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]=z);let V;t[39]!==c||t[40]!==n.consentExpiredBanner?(V=c?(0,$.jsx)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[39]=c,t[40]=n.consentExpiredBanner,t[41]=V):V=t[41];let H;t[42]!==_||t[43]!==l||t[44]!==m||t[45]!==h||t[46]!==v||t[47]!==r||t[48]!==g||t[49]!==f||t[50]!==o||t[51]!==p||t[52]!==s||t[53]!==n?(H=_?(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)(te,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,v?(0,$.jsx)($e,{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)(B,{type:`button`,variant:`secondary`,disabled:s,onClick:h,children:[s?(0,$.jsx)(M,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(B,{type:`button`,disabled:o,onClick:m,children:[o?(0,$.jsx)(M,{className:`size-4 animate-spin`}):(0,$.jsx)(G,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[p?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:p}):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 bg-amber-500/10 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(T,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),g&&f?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:f}):null,(0,$.jsxs)(B,{type:`button`,disabled:o||g,onClick:m,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(M,{className:`size-4 animate-spin`}):(0,$.jsx)(G,{className:`size-4`}),n.start]})]}),t[42]=_,t[43]=l,t[44]=m,t[45]=h,t[46]=v,t[47]=r,t[48]=g,t[49]=f,t[50]=o,t[51]=p,t[52]=s,t[53]=n,t[54]=H):H=t[54];let ee;return t[55]!==L||t[56]!==z||t[57]!==V||t[58]!==H||t[59]!==S?(ee=(0,$.jsxs)(`section`,{className:S,children:[L,z,V,H]}),t[55]=L,t[56]=z,t[57]=V,t[58]=H,t[59]=S,t[60]=ee):ee=t[60],ee}var ot={reconfiguring:!1};function st(e){let t=(0,Q.c)(89),{t:n,brokerSecretReady:r,brokerSecretConfiguredInConfig:i,brokerSecretMaskedValue:a,brokerSecretDraft:o,savingBrokerSecret:c,authorizingBrokerSecret:u,brokerSecretAuthorizationUrl:f,brokerSecretNotice:p,copyFailedLabel:m,onDraftChange:h,onSave:g,onAuthorize:_,onClear:v,sectionRef:y}=e,b=(0,Z.useId)(),x=r,S=!x,[C,w]=(0,Z.useReducer)(ne,ot),{reconfiguring:T}=C,E;t[0]!==i||t[1]!==o||t[2]!==T?(E=i&&!T&&!o.trim(),t[0]=i,t[1]=o,t[2]=T,t[3]=E):E=t[3];let D=E,O;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(O={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]=O):O=t[8];let k=O,A;t[9]===o?A=t[10]:(A=o.trim().length>0&&!j(o.trim()),t[9]=o,t[10]=A);let N=A,P;t[11]===h?P=t[12]:(P=()=>{w({type:`patch`,patch:{reconfiguring:!1}}),h(``)},t[11]=h,t[12]=P);let F=P,L=S&&`ring-1 ring-amber-500/30`,R;t[13]===L?R=t[14]:(R=d(L),t[13]=L,t[14]=R);let z=x?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:S?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,V;t[15]===z?V=t[16]:(V=d(`flex size-9 shrink-0 items-center justify-center rounded-lg`,z),t[15]=z,t[16]=V);let H;t[17]===x?H=t[18]:(H=x?(0,$.jsx)(s,{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 U;t[19]!==V||t[20]!==H?(U=(0,$.jsx)(`span`,{className:V,children:H}),t[19]=V,t[20]=H,t[21]=U):U=t[21];let W=x?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,te;t[22]===W?te=t[23]:(te=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:W}),t[22]=W,t[23]=te);let G=x?n.brokerSecretReadyHint:n.brokerSecretHint,K;t[24]===G?K=t[25]:(K=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:G}),t[24]=G,t[25]=K);let q;t[26]!==S||t[27]!==n.brokerSecretMissingHint?(q=S?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[26]=S,t[27]=n.brokerSecretMissingHint,t[28]=q):q=t[28];let re;t[29]!==te||t[30]!==K||t[31]!==q?(re=(0,$.jsxs)(`div`,{children:[te,K,q]}),t[29]=te,t[30]=K,t[31]=q,t[32]=re):re=t[32];let J;t[33]!==u||t[34]!==S||t[35]!==_||t[36]!==T||t[37]!==c||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(J=S||T?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(B,{type:`button`,disabled:c||u,onClick:_,children:[u?(0,$.jsx)(M,{className:`size-4 animate-spin`}):null,u?n.brokerSecretAuthorizing:n.brokerSecretAuthorize]}),(0,$.jsxs)(`a`,{href:be,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)(l,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=u,t[34]=S,t[35]=_,t[36]=T,t[37]=c,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=J):J=t[41];let ie;t[42]!==u||t[43]!==f||t[44]!==n.brokerSecretOpenAuthorization?(ie=u&&f?(0,$.jsxs)(`a`,{href:f,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)(l,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=u,t[43]=f,t[44]=n.brokerSecretOpenAuthorization,t[45]=ie):ie=t[45];let ae;t[46]!==i||t[47]!==o||t[48]!==a||t[49]!==N||t[50]!==F||t[51]!==m||t[52]!==b||t[53]!==S||t[54]!==v||t[55]!==h||t[56]!==g||t[57]!==T||t[58]!==c||t[59]!==k||t[60]!==D||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=D?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:b,children:n.brokerSecretTitle}),(0,$.jsx)(I,{id:b,value:a,labels:k,reveal:ct,loadFailedLabel:m||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(B,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>{w({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(B,{type:`button`,variant:`ghost`,disabled:c,onClick:v,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:b,children:n.brokerSecretTitle}),(0,$.jsx)(I,{id:b,value:o,onChange:h,placeholder:n.brokerSecretPlaceholder,labels:k,disabled:c}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(B,{type:`button`,disabled:c||!N,onClick:g,children:[c?(0,$.jsx)(M,{className:`size-4 animate-spin`}):null,S?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(B,{type:`button`,variant:`ghost`,disabled:c,onClick:v,children:n.brokerSecretClear}):null,T?(0,$.jsx)(B,{type:`button`,variant:`ghost`,disabled:c,onClick:F,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=o,t[48]=a,t[49]=N,t[50]=F,t[51]=m,t[52]=b,t[53]=S,t[54]=v,t[55]=h,t[56]=g,t[57]=T,t[58]=c,t[59]=k,t[60]=D,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]===p?oe=t[73]:(oe=p?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:p}):null,t[72]=p,t[73]=oe);let se;t[74]!==re||t[75]!==J||t[76]!==ie||t[77]!==ae||t[78]!==oe?(se=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[re,J,ie,ae,oe]}),t[74]=re,t[75]=J,t[76]=ie,t[77]=ae,t[78]=oe,t[79]=se):se=t[79];let ce;t[80]!==U||t[81]!==se?(ce=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[U,se]}),t[80]=U,t[81]=se,t[82]=ce):ce=t[82];let Y;t[83]!==ce||t[84]!==R?(Y=(0,$.jsx)(ue,{className:R,children:ce}),t[83]=ce,t[84]=R,t[85]=Y):Y=t[85];let le;return t[86]!==y||t[87]!==Y?(le=(0,$.jsx)(`div`,{ref:y,id:`tunnel-broker-secret-setup`,children:Y}),t[86]=y,t[87]=Y,t[88]=le):le=t[88],le}function ct(){return _e().then(lt)}function lt(e){return e.registrationSecret??null}var ut={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 dt({embedded:e=!1}){let t=p(e=>e.language),n=u(t).tunnelSettings,r=!!f(e=>e.conversationId),[i,a]=(0,Z.useReducer)(ne,ut),{actionError:o,starting:s,stopping:c,savingAutoStart:l,consentOpen:m,autoStartConfirmOpen:h,releaseConfirmOpen:g,releasing:_,brokerSecretDraft:v,savingBrokerSecret:y,authorizingBrokerSecret:b,brokerSecretAuthorizationUrl:w,brokerSecretNotice:T}=i,E=(0,Z.useRef)(null),{data:D}=C(r),{data:k,error:A,isLoading:N,mutate:I}=x(r?`tunnel-status`:null,ge,{refreshInterval:e=>s?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),V=(0,Z.useMemo)(()=>{let e=D?.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 k?.config?.autoStart===!0},[D,k?.config?.autoStart]),ee=(0,Z.useMemo)(()=>{let e=D?.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``},[D]),U=j(ee),W=k?.registrationSecret?.configured??U;(0,Z.useEffect)(()=>{let e=()=>{I()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[I]);let te=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),G=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await ye(),await I(),S()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{starting:!1}})}},[I]),K=(0,Z.useCallback)(()=>{if(!W){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),E.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(k?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}G()},[W,k?.consentRequired,G,n.brokerSecretRequiredBeforeStart]),q=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await de(),await Promise.all([I(),G()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[I,G]),re=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await pe(),await I(),S()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[I]),J=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await ve({autoStart:e}),S()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),ie=(0,Z.useCallback)(()=>{if(V){J(!1);return}if(k?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!k?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[J,k?.canAutoStart,k?.consentRequired,n,V]),oe=(0,Z.useCallback)(async()=>{let e=v.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ve({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),S(),await I(),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}})}}},[v,I,n.brokerSecretSaved]),se=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ve({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),S(),await I()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[I,n.brokerSecretCleared]),ce=(0,Z.useCallback)(async()=>{let e=F(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await z(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await ae(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await P(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await he(),await Promise.all([I(),S()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{O(e),t&&L(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[I,n.brokerSecretSaved]),Y=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await pe({release:!0}),await I(),S()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[I]),le=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:u(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=k??{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`}},me=k?.consentRequired&&(X.enabled||V||k?.consent?.acceptedAt),_e=(0,$.jsx)(st,{t:n,brokerSecretReady:W,brokerSecretConfiguredInConfig:U,brokerSecretMaskedValue:U?ee:``,brokerSecretDraft:v,savingBrokerSecret:y,authorizingBrokerSecret:b,brokerSecretAuthorizationUrl:w,brokerSecretNotice:T,copyFailedLabel:u(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void oe(),onAuthorize:()=>void ce(),onClear:()=>void se(),sectionRef:E}),be=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ue,{open:m,title:n.consentTitle,intro:n.consentIntro,bullets:te,checkboxLabel:n.consentCheckbox,confirmLabel:me?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void q(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},m?`consent-open`:`consent-closed`),(0,$.jsx)(H,{open:h,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)(H,{open:g,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void Y(),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,_e,(0,$.jsx)(at,{t:n,status:X,isLoading:N,statusErr:A,starting:s,stopping:c,showConsentExpired:!!me,copyLabels:le,startDisabled:!W,startDisabledReason:W?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:K,onStop:()=>void re()}),(0,$.jsxs)(Ve,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:d(`flex items-center gap-3 text-sm text-fg`,!V&&!k?.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&&!k?.canAutoStart,onChange:ie}),n.autoStart]}),!k?.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 rounded-xl bg-surface-base/45 p-4`,children:[(0,$.jsxs)(B,{type:`button`,variant:`secondary`,disabled:_||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[_?(0,$.jsx)(M,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(Ve,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-base/45 p-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(R,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(fe,{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,_e,(0,$.jsx)(at,{t:n,status:X,isLoading:N,statusErr:A,starting:s,stopping:c,showConsentExpired:!!me,copyLabels:le,startDisabled:!W,startDisabledReason:W?void 0:n.brokerSecretRequiredBeforeStart,onStart:K,onStop:()=>void re()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(B,{type:`button`,variant:`secondary`,disabled:_||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[_?(0,$.jsx)(M,{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)(ue,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:d(`flex items-center gap-3 text-sm text-fg`,!V&&!k?.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&&!k?.canAutoStart,onChange:ie}),n.autoStart]}),!k?.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)(R,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(fe,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),be]})}function ft(e,t){return e.tabs[t]}function pt(e,t){return e.tabIntro[t]}function mt(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 ht(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)(Ae,{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)(xe,{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)(dt,{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)(X,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Re,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Pe,{}),t[6]=e):e=t[6],e}}}function gt(){let e=(0,Q.c)(3),t=i(),n=p(vt),r=u(n).remoteAccess,o=!!f(_t),[s,c]=a(),l=N(),d=Be(s.get(`tab`)),m=s.get(`intent`)===`mobile-pairing`,h;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={refreshInterval:2e3},e[0]=h):h=e[0];let g=x(m?`device-pairing-readiness`:null,me,h),_;e[1]===c?_=e[2]:(_=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]=_);let v=_,y=pt(r,d),b=ze.filter(e=>l||e!==`ssh`&&e!==`reverse-proxy`||e===d).map(e=>({id:e,label:ft(r,e)}));return(0,$.jsxs)(se,{children:[(0,$.jsx)(oe,{title:r.pageTitle,meta:(0,$.jsx)(fe,{language:n,label:r.docsLink,section:mt(d),className:`mt-1`})}),o?(0,$.jsxs)($.Fragment,{children:[m?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(K,{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:g.data?.ready?r.mobilePairingFlow.ready:r.mobilePairingFlow.hint})]})]}),(0,$.jsxs)(B,{variant:`primary`,disabled:!g.data?.ready,onClick:()=>t(`/settings/devices?startDevicePairing=mobile`),children:[g.data?.ready?r.mobilePairingFlow.continue:r.mobilePairingFlow.waiting,(0,$.jsx)(D,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(W,{items:b,activeTab:d,onChange:v,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(ce,{id:d,activeTab:d,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:ft(r,d),hint:d===`public`?void 0:y,showHeading:!1,framed:!1,children:(0,$.jsx)(ht,{tab:d,onOpenTab:v})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function _t(e){return e.conversationId}function vt(e){return e.language}export{gt as RemoteAccessHub};
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,r as n}from"./locale-store-Djl2FW6_.js";async function r(){return e(n(`/api/runtime-tools`))}async function i(t){await e(n(`/api/runtime-tools/config`),{method:`PATCH`,body:JSON.stringify(t)})}async function a(){return(await e(n(`/api/runtime-tools/prune`),{method:`POST`})).payload}async function o(e){let r=await t(n(`/api/runtime-tools/${e.runtime}/${e.action}/stream`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify({version:e.version})});if(!r.ok||!r.body)throw Error(`HTTP ${r.status}`);let i=r.body.getReader(),a=new TextDecoder,o=``,s=!1;try{for(;!s;){let{done:t,value:n}=await i.read();if(t)break;o+=a.decode(n,{stream:!0}).replace(/\r\n/g,`
1
+ import{a as e,i as t,r as n}from"./locale-store-Jnhw2WMv.js";async function r(){return e(n(`/api/runtime-tools`))}async function i(t){await e(n(`/api/runtime-tools/config`),{method:`PATCH`,body:JSON.stringify(t)})}async function a(){return(await e(n(`/api/runtime-tools/prune`),{method:`POST`})).payload}async function o(e){let r=await t(n(`/api/runtime-tools/${e.runtime}/${e.action}/stream`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify({version:e.version})});if(!r.ok||!r.body)throw Error(`HTTP ${r.status}`);let i=r.body.getReader(),a=new TextDecoder,o=``,s=!1;try{for(;!s;){let{done:t,value:n}=await i.read();if(t)break;o+=a.decode(n,{stream:!0}).replace(/\r\n/g,`
2
2
  `);let r=o.split(`
3
3
 
4
4
  `);o=r.pop()??``;for(let t of r){let n=``,r=``;for(let e of t.split(`
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./circle-check-C23XjkUj.js";import{t as i}from"./download-Dk-ZjtO6.js";import{t as a}from"./messages-DPxcWxfD.js";import{n as o,r as s}from"./locale-store-Djl2FW6_.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{On as l,Wc as u,Xa as d,ds as f,fs as p,of as m,ou as h}from"./index-Dsp_gNdl.js";import{n as g,r as _}from"./settings-page-layout-Dx5S-Msc.js";import{t as v}from"./settings-advanced-gate-F1WX7vxq.js";import{i as y,n as b,r as x}from"./runtime-tools-api-C_VOMhLI.js";var S=e(t(),1);function C(e){return e?.trim()||void 0}function w(e,t,n){return e?.state===`ready`?C(t)!==C(n):!0}var T=n(),E=[`node`,`python`,`uv`];function D(){let e=a(o(e=>e.language)).runtimeToolsSettings,{data:t,error:n,isLoading:C,mutate:D}=c(s(`/api/runtime-tools`)),[O,k]=(0,S.useState)(null),[A,j]=(0,S.useState)(!1),[M,N]=(0,S.useState)(!1),[P,F]=(0,S.useState)({}),[I,L]=(0,S.useState)({}),[R,z]=(0,S.useState)(null),B=Object.values(P).some(Boolean);if((0,S.useEffect)(()=>{t?.payload.config&&k(structuredClone(t.payload.config))},[t?.payload.config]),n)return(0,T.jsxs)(_,{children:[(0,T.jsx)(g,{title:e.title,subtitle:e.loadError}),(0,T.jsx)(u,{onClick:()=>void D(),children:e.refresh})]});if(C||!O)return(0,T.jsx)(_,{children:(0,T.jsx)(l,{sections:3})});let V=new Map(t?.payload.statuses.map(e=>[e.runtime,e])),H=(e,t)=>k(n=>n&&{...n,[e]:{...n[e],...t}}),U=async()=>{j(!0),z(null);try{await y(O),await D()}catch(e){z(e instanceof Error?e.message:String(e))}finally{j(!1)}},W=async(e,t)=>{F(t=>({...t,[e]:!0})),z(null);try{await y(O),await x({runtime:e,action:t,version:e===`uv`?O.uv.version:O[e].version,onProgress:t=>L(n=>({...n,[e]:t}))}),await D()}catch(e){z(e instanceof Error?e.message:String(e))}finally{F(t=>({...t,[e]:!1}))}},G=async()=>{N(!0),z(null);try{await b(),await D()}catch(e){z(e instanceof Error?e.message:String(e))}finally{N(!1)}};return(0,T.jsxs)(_,{gap:`gap-6`,children:[(0,T.jsx)(g,{title:e.title,actions:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(d,{className:`size-9 shrink-0 p-0`,disabled:B,label:e.refresh,onClick:async()=>{await D()}}),(0,T.jsx)(u,{onClick:()=>void G(),disabled:M||B,children:M?e.pruning:e.prune}),(0,T.jsx)(u,{variant:`primary`,onClick:()=>void U(),disabled:A||B,children:A?e.saving:e.save})]})}),R?(0,T.jsx)(`div`,{className:`rounded-xl bg-danger/10 px-4 py-3 text-sm text-danger`,children:R}):null,(0,T.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:(0,T.jsxs)(`label`,{className:`flex items-center justify-between gap-4`,children:[(0,T.jsxs)(`span`,{children:[(0,T.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.enabled}),(0,T.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.enabledHint})]}),(0,T.jsx)(`input`,{type:`checkbox`,checked:O.enabled,onChange:e=>k({...O,enabled:e.target.checked}),className:`size-4 accent-accent`})]})}),(0,T.jsx)(v,{children:(0,T.jsxs)(`section`,{className:`grid gap-4 rounded-xl bg-surface-hover/20 p-4 md:grid-cols-2`,children:[(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.downloadSource,(0,T.jsxs)(f,{value:O.download.source,onChange:e=>k({...O,download:{...O.download,source:e.target.value}}),children:[(0,T.jsx)(p,{value:`auto`,children:e.downloadSources.auto}),(0,T.jsx)(p,{value:`website-only`,children:e.downloadSources.websiteOnly}),(0,T.jsx)(p,{value:`direct-only`,children:e.downloadSources.directOnly})]})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.gatewayBaseUrl,(0,T.jsx)(`input`,{value:O.download.gatewayBaseUrl,disabled:O.download.source===`direct-only`,onChange:e=>k({...O,download:{...O.download,gatewayBaseUrl:e.target.value}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong disabled:opacity-50`})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.offlineBundle,(0,T.jsx)(`input`,{value:O.download.bundleDir??``,placeholder:e.offlineBundlePlaceholder,onChange:e=>k({...O,download:{...O.download,bundleDir:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.proxy,(0,T.jsx)(`input`,{value:O.download.proxy??``,placeholder:`http://127.0.0.1:7890`,onChange:e=>k({...O,download:{...O.download,proxy:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]})]})}),(0,T.jsx)(`div`,{className:`flex flex-col gap-4`,children:E.map(n=>{let a=V.get(n),o=a?.state===`ready`,s=I[n],c=n===`uv`?O.uv:O[n],l=n===`uv`?t?.payload.config.uv:t?.payload.config[n],d=P[n]===!0,g=w(a,c.version,l?.version);return(0,T.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-5 rounded-xl bg-surface-base/55 p-5 sm:p-6`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e.runtimeNames[n]}),(0,T.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:a?.message??e.unknown})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o?(0,T.jsx)(r,{className:`size-5 shrink-0 text-success`}):(0,T.jsx)(m,{className:`size-5 shrink-0 text-warning`}),(0,T.jsx)(`input`,{type:`checkbox`,"aria-label":`${e.runtimeNames[n]} ${e.enabled}`,checked:c.enabled,onChange:e=>{n===`uv`?k({...O,uv:{...O.uv,enabled:e.target.checked}}):H(n,{enabled:e.target.checked})},className:`size-4 accent-accent`})]})]}),(0,T.jsxs)(`div`,{className:n===`uv`?`grid gap-4 md:grid-cols-[minmax(16rem,28rem)]`:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:[(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.version,(0,T.jsx)(`input`,{value:c.version??``,placeholder:a?.requestedVersion,onChange:e=>{let t=e.target.value||void 0;n===`uv`?k({...O,uv:{...O.uv,version:t}}):H(n,{version:t})},className:`h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),n===`uv`?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.sourcePolicy,(0,T.jsxs)(f,{value:O[n].preference,onChange:e=>H(n,{preference:e.target.value}),children:[(0,T.jsx)(p,{value:`managed-first`,children:e.preferences.managedFirst}),(0,T.jsx)(p,{value:`system-first`,children:e.preferences.systemFirst}),(0,T.jsx)(p,{value:`managed-only`,children:e.preferences.managedOnly}),(0,T.jsx)(p,{value:`system-only`,children:e.preferences.systemOnly})]})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.provisionPolicy,(0,T.jsxs)(f,{value:O[n].provision,onChange:e=>H(n,{provision:e.target.value}),children:[(0,T.jsx)(p,{value:`eager`,children:e.provisions.eager}),(0,T.jsx)(p,{value:`on-demand`,children:e.provisions.onDemand}),(0,T.jsx)(p,{value:`disabled`,children:e.provisions.disabled})]})]})]})]}),s&&d?(0,T.jsxs)(`div`,{className:`rounded-lg bg-accent-soft px-3 py-2 text-xs text-accent-fg`,children:[s.message,s.totalBytes&&s.downloadedBytes?` · ${Math.round(s.downloadedBytes/s.totalBytes*100)}%`:``]}):null,(0,T.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[g?(0,T.jsxs)(u,{variant:`primary`,disabled:!O.enabled||!c.enabled||d,onClick:()=>void W(n,`install`),children:[(0,T.jsx)(i,{className:`size-4`}),d?e.working:e.install]}):(0,T.jsxs)(`span`,{className:`inline-flex h-9 items-center gap-2 px-1 text-sm text-success`,children:[(0,T.jsx)(r,{className:`size-4`}),e.installed]}),a?.repairable?(0,T.jsxs)(u,{disabled:!O.enabled||!c.enabled||d,onClick:()=>void W(n,`repair`),children:[(0,T.jsx)(h,{className:`size-4`}),e.repair]}):null]}),(0,T.jsx)(v,{children:a?.resolved?.executable?(0,T.jsx)(`code`,{className:`break-all text-[11px] text-fg-subtle`,children:a.resolved.executable}):null})]})]},n)})})]})}export{D as RuntimeToolsSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./circle-check-C23XjkUj.js";import{t as i}from"./download-Dk-ZjtO6.js";import{t as a}from"./messages-DBvKzlCl.js";import{n as o,r as s}from"./locale-store-Jnhw2WMv.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{On as l,Wc as u,Xa as d,ds as f,fs as p,sf as m,su as h}from"./index-DvKDT-RQ.js";import{n as g,r as _}from"./settings-page-layout-Dx5S-Msc.js";import{t as v}from"./settings-advanced-gate-jbVx8gcF.js";import{i as y,n as b,r as x}from"./runtime-tools-api-D0xtCTXr.js";var S=e(t(),1);function C(e){return e?.trim()||void 0}function w(e,t,n){return e?.state===`ready`?C(t)!==C(n):!0}var T=n(),E=[`node`,`python`,`uv`];function D(){let e=a(o(e=>e.language)).runtimeToolsSettings,{data:t,error:n,isLoading:C,mutate:D}=c(s(`/api/runtime-tools`)),[O,k]=(0,S.useState)(null),[A,j]=(0,S.useState)(!1),[M,N]=(0,S.useState)(!1),[P,F]=(0,S.useState)({}),[I,L]=(0,S.useState)({}),[R,z]=(0,S.useState)(null),B=Object.values(P).some(Boolean);if((0,S.useEffect)(()=>{t?.payload.config&&k(structuredClone(t.payload.config))},[t?.payload.config]),n)return(0,T.jsxs)(_,{children:[(0,T.jsx)(g,{title:e.title,subtitle:e.loadError}),(0,T.jsx)(u,{onClick:()=>void D(),children:e.refresh})]});if(C||!O)return(0,T.jsx)(_,{children:(0,T.jsx)(l,{sections:3})});let V=new Map(t?.payload.statuses.map(e=>[e.runtime,e])),H=(e,t)=>k(n=>n&&{...n,[e]:{...n[e],...t}}),U=async()=>{j(!0),z(null);try{await y(O),await D()}catch(e){z(e instanceof Error?e.message:String(e))}finally{j(!1)}},W=async(e,t)=>{F(t=>({...t,[e]:!0})),z(null);try{await y(O),await x({runtime:e,action:t,version:e===`uv`?O.uv.version:O[e].version,onProgress:t=>L(n=>({...n,[e]:t}))}),await D()}catch(e){z(e instanceof Error?e.message:String(e))}finally{F(t=>({...t,[e]:!1}))}},G=async()=>{N(!0),z(null);try{await b(),await D()}catch(e){z(e instanceof Error?e.message:String(e))}finally{N(!1)}};return(0,T.jsxs)(_,{gap:`gap-6`,children:[(0,T.jsx)(g,{title:e.title,actions:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(d,{className:`size-9 shrink-0 p-0`,disabled:B,label:e.refresh,onClick:async()=>{await D()}}),(0,T.jsx)(u,{onClick:()=>void G(),disabled:M||B,children:M?e.pruning:e.prune}),(0,T.jsx)(u,{variant:`primary`,onClick:()=>void U(),disabled:A||B,children:A?e.saving:e.save})]})}),R?(0,T.jsx)(`div`,{className:`rounded-xl bg-danger/10 px-4 py-3 text-sm text-danger`,children:R}):null,(0,T.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:(0,T.jsxs)(`label`,{className:`flex items-center justify-between gap-4`,children:[(0,T.jsxs)(`span`,{children:[(0,T.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.enabled}),(0,T.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.enabledHint})]}),(0,T.jsx)(`input`,{type:`checkbox`,checked:O.enabled,onChange:e=>k({...O,enabled:e.target.checked}),className:`size-4 accent-accent`})]})}),(0,T.jsx)(v,{children:(0,T.jsxs)(`section`,{className:`grid gap-4 rounded-xl bg-surface-hover/20 p-4 md:grid-cols-2`,children:[(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.downloadSource,(0,T.jsxs)(f,{value:O.download.source,onChange:e=>k({...O,download:{...O.download,source:e.target.value}}),children:[(0,T.jsx)(p,{value:`auto`,children:e.downloadSources.auto}),(0,T.jsx)(p,{value:`website-only`,children:e.downloadSources.websiteOnly}),(0,T.jsx)(p,{value:`direct-only`,children:e.downloadSources.directOnly})]})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.gatewayBaseUrl,(0,T.jsx)(`input`,{value:O.download.gatewayBaseUrl,disabled:O.download.source===`direct-only`,onChange:e=>k({...O,download:{...O.download,gatewayBaseUrl:e.target.value}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong disabled:opacity-50`})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.offlineBundle,(0,T.jsx)(`input`,{value:O.download.bundleDir??``,placeholder:e.offlineBundlePlaceholder,onChange:e=>k({...O,download:{...O.download,bundleDir:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.proxy,(0,T.jsx)(`input`,{value:O.download.proxy??``,placeholder:`http://127.0.0.1:7890`,onChange:e=>k({...O,download:{...O.download,proxy:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]})]})}),(0,T.jsx)(`div`,{className:`flex flex-col gap-4`,children:E.map(n=>{let a=V.get(n),o=a?.state===`ready`,s=I[n],c=n===`uv`?O.uv:O[n],l=n===`uv`?t?.payload.config.uv:t?.payload.config[n],d=P[n]===!0,g=w(a,c.version,l?.version);return(0,T.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-5 rounded-xl bg-surface-base/55 p-5 sm:p-6`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e.runtimeNames[n]}),(0,T.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:a?.message??e.unknown})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o?(0,T.jsx)(r,{className:`size-5 shrink-0 text-success`}):(0,T.jsx)(m,{className:`size-5 shrink-0 text-warning`}),(0,T.jsx)(`input`,{type:`checkbox`,"aria-label":`${e.runtimeNames[n]} ${e.enabled}`,checked:c.enabled,onChange:e=>{n===`uv`?k({...O,uv:{...O.uv,enabled:e.target.checked}}):H(n,{enabled:e.target.checked})},className:`size-4 accent-accent`})]})]}),(0,T.jsxs)(`div`,{className:n===`uv`?`grid gap-4 md:grid-cols-[minmax(16rem,28rem)]`:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:[(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.version,(0,T.jsx)(`input`,{value:c.version??``,placeholder:a?.requestedVersion,onChange:e=>{let t=e.target.value||void 0;n===`uv`?k({...O,uv:{...O.uv,version:t}}):H(n,{version:t})},className:`h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),n===`uv`?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.sourcePolicy,(0,T.jsxs)(f,{value:O[n].preference,onChange:e=>H(n,{preference:e.target.value}),children:[(0,T.jsx)(p,{value:`managed-first`,children:e.preferences.managedFirst}),(0,T.jsx)(p,{value:`system-first`,children:e.preferences.systemFirst}),(0,T.jsx)(p,{value:`managed-only`,children:e.preferences.managedOnly}),(0,T.jsx)(p,{value:`system-only`,children:e.preferences.systemOnly})]})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.provisionPolicy,(0,T.jsxs)(f,{value:O[n].provision,onChange:e=>H(n,{provision:e.target.value}),children:[(0,T.jsx)(p,{value:`eager`,children:e.provisions.eager}),(0,T.jsx)(p,{value:`on-demand`,children:e.provisions.onDemand}),(0,T.jsx)(p,{value:`disabled`,children:e.provisions.disabled})]})]})]})]}),s&&d?(0,T.jsxs)(`div`,{className:`rounded-lg bg-accent-soft px-3 py-2 text-xs text-accent-fg`,children:[s.message,s.totalBytes&&s.downloadedBytes?` · ${Math.round(s.downloadedBytes/s.totalBytes*100)}%`:``]}):null,(0,T.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[g?(0,T.jsxs)(u,{variant:`primary`,disabled:!O.enabled||!c.enabled||d,onClick:()=>void W(n,`install`),children:[(0,T.jsx)(i,{className:`size-4`}),d?e.working:e.install]}):(0,T.jsxs)(`span`,{className:`inline-flex h-9 items-center gap-2 px-1 text-sm text-success`,children:[(0,T.jsx)(r,{className:`size-4`}),e.installed]}),a?.repairable?(0,T.jsxs)(u,{disabled:!O.enabled||!c.enabled||d,onClick:()=>void W(n,`repair`),children:[(0,T.jsx)(h,{className:`size-4`}),e.repair]}):null]}),(0,T.jsx)(v,{children:a?.resolved?.executable?(0,T.jsx)(`code`,{className:`break-all text-[11px] text-fg-subtle`,children:a.resolved.executable}):null})]})]},n)})})]})}export{D as RuntimeToolsSettingsPanel};
@@ -1 +1 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-0WouolD0.js";import{As as i,Ns as a,ds as o,fs as s}from"./index-Dsp_gNdl.js";import{t as c}from"./number-input-DDeqHK-G.js";var l=t();e();var u=n();function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function p(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function m(e){return e[`x-hidden`]===!0}function h(e){let t=e.properties;if(!d(t))return[];let n=[];for(let[e,r]of Object.entries(t))d(r)&&(m(r)||n.push({key:e,sub:r,order:f(r),group:p(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function g(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function _(e){let t=(0,l.c)(38),{name:n,s:r,value:s,onChange:c,disabled:d}=e,f=typeof r.description==`string`?r.description:void 0,p=(typeof r[`x-placeholder`]==`string`?r[`x-placeholder`]:null)||f,m=r.format;if(Array.isArray(r.enum)&&r.enum.every(y)){let e;t[0]===f?e=t[1]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let i;t[2]===c?i=t[3]:(i=e=>c(e.target.value),t[2]=c,t[3]=i);let a;t[4]===r.enum?a=t[5]:(a=r.enum.map(v),t[4]=r.enum,t[5]=a);let l;t[6]!==d||t[7]!==n||t[8]!==i||t[9]!==a||t[10]!==s?(l=(0,u.jsx)(o,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:s,disabled:d,onChange:i,children:a}),t[6]=d,t[7]=n,t[8]=i,t[9]=a,t[10]=s,t[11]=l):l=t[11];let p;return t[12]!==e||t[13]!==l?(p=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,l]}),t[12]=e,t[13]=l,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==c||t[19]!==p||t[20]!==s?(n=(0,u.jsx)(a,{value:s,onChange:c,placeholder:p,labels:i,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=c,t[19]=p,t[20]=s,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===c?g=t[28]:(g=e=>c(e.target.value),t[27]=c,t[28]=g);let _;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==s?(_=(0,u.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:s,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=s,t[34]=_):_=t[34];let b;return t[35]!==h||t[36]!==_?(b=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,_]}),t[35]=h,t[36]=_,t[37]=b):b=t[37],b}function v(e){return(0,u.jsx)(s,{value:e,children:e},e)}function y(e){return typeof e==`string`}function b(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let d=Number.isFinite(r)?r:0,f;t[2]===i?f=t[3]:(f=e=>i(Number(e.target.value)),t[2]=i,t[3]=f);let p;t[4]!==a||t[5]!==d||t[6]!==f?(p=(0,u.jsx)(c,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:d,disabled:a,onChange:f}),t[4]=a,t[5]=d,t[6]=f,t[7]=p):p=t[7];let m;return t[8]!==s||t[9]!==p?(m=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,p]}),t[8]=s,t[9]=p,t[10]=m):m=t[10],m}function x(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),c;t[0]===i?c=t[1]:(c=e=>i(e.target.checked),t[0]=i,t[1]=c);let d;t[2]!==a||t[3]!==c||t[4]!==r?(d=(0,u.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:c}),t[2]=a,t[3]=c,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,u.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,u.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function S(e){let t=(0,l.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,c=n.items,f=d(c)?c.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,u.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,u.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,u.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,u.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,u.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function C(e){let t=(0,l.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,c=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(c===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let l;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(l=(0,u.jsx)(x,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=l):l=t[9];let d;return t[10]!==e||t[11]!==l?(d=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,l]}),t[10]=e,t[11]=l,t[12]=d):d=t[12],d}if(c===`number`||c===`integer`){let e;t[13]===f?e=t[14]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,u.jsx)(b,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(c===`string`){let e;t[23]===f?e=t[24]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,u.jsx)(_,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let l;return t[31]!==e||t[32]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=l):l=t[33],l}if(c===`array`){let e=r.items,n=d(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(w)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,u.jsx)(S,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let l;return t[44]!==e||t[45]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=l):l=t[46],l}}if(c===`object`){let e;t[47]===i?e=t[48]:(e=d(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let l;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(l=(0,u.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,u.jsx)(T,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=l):l=t[56];let p;return t[57]!==c||t[58]!==l?(p=(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,l]}),t[57]=c,t[58]=l,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==c||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof c==`string`?c:void 0)??`${f}: unsupported field type${typeof c==`string`?` (${c})`:``}`,t[60]=s,t[61]=c,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function w(e){return typeof e==`string`||typeof e==`number`}function T(e){let t=(0,l.c)(28),{schema:n,values:i,onChange:a,disabled:o,className:s,labels:c}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=h(n),t[1]=n,t[2]=e),p=e}let m=p,_;bb1:{if(m.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===m?e=t[5]:(e=g(m),t[4]=m,t[5]=e),_=e}let v=_,y;t[6]!==a||t[7]!==i?(y=(e,t)=>{a({...i,[e]:t})},t[6]=a,t[7]=i,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!d(n.properties)||m.length===0)return null;let x,S;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==c||t[13]!==b||t[14]!==i){let e=Array.from(v.keys()).sort(E);t[17]===s?x=t[18]:(x=r(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==c||t[22]!==b||t[23]!==i?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,u.jsx)(C,{k:e.key,sub:e.sub,value:i[e.key],onValue:t=>b(e.key,t),disabled:f,labels:c},e.key));return e===``?(0,u.jsx)(`div`,{children:t},`default`):(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,u.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=c,t[22]=b,t[23]=i,t[24]=n):n=t[24],S=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=c,t[13]=b,t[14]=i,t[15]=x,t[16]=S}else x=t[15],S=t[16];let w;return t[25]!==x||t[26]!==S?(w=(0,u.jsx)(`div`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=w):w=t[27],w}function E(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{T as t};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-0WouolD0.js";import{As as i,Ns as a,ds as o,fs as s}from"./index-DvKDT-RQ.js";import{t as c}from"./number-input-DDeqHK-G.js";var l=t();e();var u=n();function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function p(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function m(e){return e[`x-hidden`]===!0}function h(e){let t=e.properties;if(!d(t))return[];let n=[];for(let[e,r]of Object.entries(t))d(r)&&(m(r)||n.push({key:e,sub:r,order:f(r),group:p(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function g(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function _(e){let t=(0,l.c)(38),{name:n,s:r,value:s,onChange:c,disabled:d}=e,f=typeof r.description==`string`?r.description:void 0,p=(typeof r[`x-placeholder`]==`string`?r[`x-placeholder`]:null)||f,m=r.format;if(Array.isArray(r.enum)&&r.enum.every(y)){let e;t[0]===f?e=t[1]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let i;t[2]===c?i=t[3]:(i=e=>c(e.target.value),t[2]=c,t[3]=i);let a;t[4]===r.enum?a=t[5]:(a=r.enum.map(v),t[4]=r.enum,t[5]=a);let l;t[6]!==d||t[7]!==n||t[8]!==i||t[9]!==a||t[10]!==s?(l=(0,u.jsx)(o,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:s,disabled:d,onChange:i,children:a}),t[6]=d,t[7]=n,t[8]=i,t[9]=a,t[10]=s,t[11]=l):l=t[11];let p;return t[12]!==e||t[13]!==l?(p=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,l]}),t[12]=e,t[13]=l,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==c||t[19]!==p||t[20]!==s?(n=(0,u.jsx)(a,{value:s,onChange:c,placeholder:p,labels:i,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=c,t[19]=p,t[20]=s,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===c?g=t[28]:(g=e=>c(e.target.value),t[27]=c,t[28]=g);let _;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==s?(_=(0,u.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:s,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=s,t[34]=_):_=t[34];let b;return t[35]!==h||t[36]!==_?(b=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,_]}),t[35]=h,t[36]=_,t[37]=b):b=t[37],b}function v(e){return(0,u.jsx)(s,{value:e,children:e},e)}function y(e){return typeof e==`string`}function b(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let d=Number.isFinite(r)?r:0,f;t[2]===i?f=t[3]:(f=e=>i(Number(e.target.value)),t[2]=i,t[3]=f);let p;t[4]!==a||t[5]!==d||t[6]!==f?(p=(0,u.jsx)(c,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:d,disabled:a,onChange:f}),t[4]=a,t[5]=d,t[6]=f,t[7]=p):p=t[7];let m;return t[8]!==s||t[9]!==p?(m=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,p]}),t[8]=s,t[9]=p,t[10]=m):m=t[10],m}function x(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),c;t[0]===i?c=t[1]:(c=e=>i(e.target.checked),t[0]=i,t[1]=c);let d;t[2]!==a||t[3]!==c||t[4]!==r?(d=(0,u.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:c}),t[2]=a,t[3]=c,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,u.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,u.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function S(e){let t=(0,l.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,c=n.items,f=d(c)?c.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,u.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,u.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,u.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,u.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,u.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function C(e){let t=(0,l.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,c=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(c===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let l;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(l=(0,u.jsx)(x,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=l):l=t[9];let d;return t[10]!==e||t[11]!==l?(d=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,l]}),t[10]=e,t[11]=l,t[12]=d):d=t[12],d}if(c===`number`||c===`integer`){let e;t[13]===f?e=t[14]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,u.jsx)(b,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(c===`string`){let e;t[23]===f?e=t[24]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,u.jsx)(_,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let l;return t[31]!==e||t[32]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=l):l=t[33],l}if(c===`array`){let e=r.items,n=d(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(w)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,u.jsx)(S,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let l;return t[44]!==e||t[45]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=l):l=t[46],l}}if(c===`object`){let e;t[47]===i?e=t[48]:(e=d(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let l;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(l=(0,u.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,u.jsx)(T,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=l):l=t[56];let p;return t[57]!==c||t[58]!==l?(p=(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,l]}),t[57]=c,t[58]=l,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==c||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof c==`string`?c:void 0)??`${f}: unsupported field type${typeof c==`string`?` (${c})`:``}`,t[60]=s,t[61]=c,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function w(e){return typeof e==`string`||typeof e==`number`}function T(e){let t=(0,l.c)(28),{schema:n,values:i,onChange:a,disabled:o,className:s,labels:c}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=h(n),t[1]=n,t[2]=e),p=e}let m=p,_;bb1:{if(m.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===m?e=t[5]:(e=g(m),t[4]=m,t[5]=e),_=e}let v=_,y;t[6]!==a||t[7]!==i?(y=(e,t)=>{a({...i,[e]:t})},t[6]=a,t[7]=i,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!d(n.properties)||m.length===0)return null;let x,S;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==c||t[13]!==b||t[14]!==i){let e=Array.from(v.keys()).sort(E);t[17]===s?x=t[18]:(x=r(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==c||t[22]!==b||t[23]!==i?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,u.jsx)(C,{k:e.key,sub:e.sub,value:i[e.key],onValue:t=>b(e.key,t),disabled:f,labels:c},e.key));return e===``?(0,u.jsx)(`div`,{children:t},`default`):(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,u.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=c,t[22]=b,t[23]=i,t[24]=n):n=t[24],S=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=c,t[13]=b,t[14]=i,t[15]=x,t[16]=S}else x=t[15],S=t[16];let w;return t[25]!==x||t[26]!==S?(w=(0,u.jsx)(`div`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=w):w=t[27],w}function E(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{T as t};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./locale-store-Djl2FW6_.js";import{d as n,g as r,h as i,i as a,l as o,p as s,r as c,s as l,t as u,u as d,v as f}from"./schemas-CObaziC7.js";import{t as p}from"./gateway-startup-retry-BCUswcVy.js";var m=f().transform(e=>e.toLowerCase()).brand(),h=s().trim().regex(/^[a-z0-9][a-z0-9._-]{0,127}$/i).brand(),g=u([`active`,`idle`,`archived`,`pinned`]),_=d({agentId:s().optional(),source:s().optional(),accountId:s().optional(),peerKind:s().optional(),peerId:s().optional(),threadId:s().optional(),scopeId:s().optional()}).passthrough();d({agentId:s().optional(),projectId:s().optional(),key:s(),transcriptId:h.optional(),name:s().optional(),title:s().optional(),displayName:s().optional(),messageCount:o(),updatedAt:s(),sourceChannel:s().optional(),status:g.optional(),usage:d({calls:o().int().nonnegative(),unknownCostCalls:o().int().nonnegative(),totalTokens:o().int().nonnegative(),knownCostUsd:s(),costCompleteness:u([`complete`,`partial`,`unknown`])}).optional(),routing:_.optional()}).passthrough();var v=d({items:c(r()),total:o(),limit:o(),offset:o(),hasMore:a()}),y=d({role:s(),content:r(),timestamp:i([s(),o()]).optional()}).passthrough(),b=d({key:s(),messages:c(y)}).passthrough(),x=d({session:b}),ee=d({session:d({key:s(),transcriptId:h.optional(),messages:c(y),name:s().optional(),status:g.optional(),sourceChannel:s().optional(),sourceChatId:s().optional(),projectId:s().optional(),customData:n(s(),r()).optional(),routing:_.optional()}).passthrough(),pagination:d({total:o(),limit:o(),offset:o(),hasMore:a(),before:s().optional(),nextBeforeCursor:s().optional(),revision:o().int().nonnegative().optional()}).passthrough()}).passthrough(),S=d({ok:l(!0),conversationId:f(),rowCount:o().int().nonnegative(),lastTurnId:s().min(1),session:b}).passthrough(),C=d({ok:a().optional(),payload:d({active:a(),runId:s().optional()}).passthrough().optional()}).passthrough(),w=d({ok:a().optional(),error:s().optional()}).passthrough(),T=w.extend({renamed:a().optional()}),E=w.extend({reset:a().optional(),transcriptId:h.optional(),previousTranscriptId:s().optional(),session:r().optional()}),D=d({totalSessions:o(),activeSessions:o(),archivedSessions:o(),pinnedSessions:o(),totalMessages:o(),totalTokens:o(),oldestSession:s().optional(),newestSession:s().optional(),byChannel:n(s(),o())}).passthrough();d({ok:a(),payload:d({conversationId:f(),transcriptId:h,session:r()}).passthrough().optional(),error:s().optional()}).passthrough();var O=d({ok:l(!0),projects:d({items:c(d({project:r(),sessions:c(r()),sessionTotal:o(),sessionHasMore:a()}).passthrough()),total:o(),limit:o(),offset:o(),hasMore:a()}),inbox:v,pinned:c(r()).default([]),layouts:n(s(),d({itemIds:c(s()),revision:o().int().nonnegative()})).default({}),childrenByConversationId:n(s(),d({total:o(),activeCount:o(),items:c(d({taskId:s(),title:s(),phase:s(),runStatus:s().optional(),activeConversationId:s().optional()}))})).default({})}).passthrough();function k(e){return x.parse(e)}function A(e){return ee.parse(e)}function j(e){return S.parse(e)}function M(e){return C.parse(e)}function N(e){return w.parse(e)}function P(e){return T.parse(e)}function F(e){return E.parse(e)}function I(e){return D.parse(e)}function L(e){return O.parse(e)}function R(e){let t=M(e).payload,n=typeof t?.runId==`string`?t.runId.trim():``;return!t?.active||!n?{active:!1}:{active:!0,runId:n}}function z(e){let t=new URLSearchParams;if(!e)return``;e.status&&t.set(`status`,e.status),e.search&&t.set(`search`,e.search),e.channel&&t.set(`channel`,e.channel),e.sources?.length&&t.set(`sources`,e.sources.join(`,`)),e.purposes?.length&&t.set(`purposes`,e.purposes.join(`,`)),e.activity&&t.set(`activity`,e.activity),e.agentId&&t.set(`agentId`,e.agentId),e.excludeArchived&&t.set(`excludeArchived`,`true`),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.updatedAfter!=null&&t.set(`updatedAfter`,String(e.updatedAfter)),e.includePinned&&t.set(`includePinned`,`true`),e.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId),e.rootConversationsOnly&&t.set(`rootConversationsOnly`,`true`),e.sessionTypes?.length&&t.set(`types`,e.sessionTypes.join(`,`)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}function B(e,t){let n=[];t?.includeTranscript&&n.push(`transcript`),t?.includeTranscriptRows&&n.push(`transcriptRows`);let r=n.length?`?include=${n.join(`,`)}`:``;return`/api/sessions/${encodeURIComponent(e)}${r}`}function V(e){return`/api/sessions/${encodeURIComponent(e)}/fork-at-turn`}function te(e,t){let n=new URLSearchParams;n.set(`limit`,String(t?.limit??50));let r=t?.before?.trim();return r?n.set(`before`,r):t?.offset!=null&&n.set(`offset`,String(t.offset)),`/api/sessions/${encodeURIComponent(e)}/history?${n.toString()}`}function H(e){return`/api/sessions/${encodeURIComponent(e)}/run`}function U(){return`/api/sessions/stats`}function W(e){let t=new URLSearchParams;e?.projectLimit!=null&&t.set(`projectLimit`,String(e.projectLimit)),e?.projectOffset!=null&&t.set(`projectOffset`,String(e.projectOffset)),e?.sessionPreviewLimit!=null&&t.set(`sessionPreviewLimit`,String(e.sessionPreviewLimit)),e?.inboxLimit!=null&&t.set(`inboxLimit`,String(e.inboxLimit)),e?.inboxOffset!=null&&t.set(`inboxOffset`,String(e.inboxOffset)),e?.staleDays!=null&&t.set(`staleDays`,String(e.staleDays)),e?.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId);let n=t.toString();return`/api/sidebar/chat-list${n?`?${n}`:``}`}function G(e){return`/api/sidebar/layouts/${encodeURIComponent(e)}`}function K(e,t){let n=encodeURIComponent(e);return t===`delete`?`/api/sessions/${n}`:`/api/sessions/${n}/${t}`}function q(e){return e?JSON.stringify({status:e.status,search:e.search,channel:e.channel,sources:e.sources,purposes:e.purposes,activity:e.activity,agentId:e.agentId,excludeArchived:e.excludeArchived,projectId:e.projectId,unassigned:e.unassigned,updatedAfter:e.updatedAfter,includePinned:e.includePinned,includeConversationId:e.includeConversationId,sessionTypes:e.sessionTypes,sortBy:e.sortBy,sortOrder:e.sortOrder,limit:e.limit,offset:e.offset}):`default`}var J=new Map;async function Y(e){let n=q(e),r=J.get(n);if(r)return r;let i=t(`/api/sessions${z(e)}`),a=(async()=>{let e=await p(i);if(!e.ok){let t=await e.json().catch(()=>({})),n=typeof t.error==`string`?t.error:t.error?.message;throw Error(n??`HTTP ${e.status}`)}return await e.json()})().finally(()=>{J.delete(n)});return J.set(n,a),a}async function X(n){return L(await e(t(W(n))))}async function Z(n){let r=await e(t(G(n.containerId)),{method:`PUT`,body:JSON.stringify({itemIds:n.itemIds,expectedRevision:n.expectedRevision})});if(!r.ok||!r.layout)throw Error(r.error??`Failed to save sidebar order`);return r.layout}async function Q(){return I(await e(t(U())))}async function ne(n,r){let i=k(await e(t(B(n,r))));if(!i.session)throw Error(`Session not found`);return i.session}async function re(n){let r=await e(t(`/api/sessions/resolve`),{method:`POST`,body:JSON.stringify(n)});if(!r.ok||!r.payload)throw Error(r.error??`Session not found`);return r.payload}async function ie(n){N(await e(t(K(n,`delete`)),{method:`DELETE`}))}async function ae(n,r){return{renamed:P(await e(t(K(n,`rename`)),{method:`POST`,body:JSON.stringify({name:r})})).renamed===!0}}async function oe(n){N(await e(t(K(n,`archive`)),{method:`POST`}))}async function $(n){N(await e(t(K(n,`unarchive`)),{method:`POST`}))}async function se(n){N(await e(t(K(n,`pin`)),{method:`POST`}))}async function ce(n){N(await e(t(K(n,`unpin`)),{method:`POST`}))}async function le(n){return(await e(t(`/api/sessions/${encodeURIComponent(n)}/export?format=json`))).content}export{R as _,ne as a,F as b,se as c,Z as d,$ as f,H as g,te as h,X as i,ae as l,V as m,ie as n,Q as o,ce as p,le as r,Y as s,oe as t,re as u,j as v,m as x,A as y};
1
+ import{a as e,r as t}from"./locale-store-Jnhw2WMv.js";import{d as n,g as r,h as i,i as a,l as o,p as s,r as c,s as l,t as u,u as d,v as f}from"./schemas-CObaziC7.js";import{t as p}from"./gateway-startup-retry-CqyGHM2M.js";var m=f().transform(e=>e.toLowerCase()).brand(),h=s().trim().regex(/^[a-z0-9][a-z0-9._-]{0,127}$/i).brand(),g=u([`active`,`idle`,`archived`,`pinned`]),_=d({agentId:s().optional(),source:s().optional(),accountId:s().optional(),peerKind:s().optional(),peerId:s().optional(),threadId:s().optional(),scopeId:s().optional()}).passthrough();d({agentId:s().optional(),projectId:s().optional(),key:s(),transcriptId:h.optional(),name:s().optional(),title:s().optional(),displayName:s().optional(),messageCount:o(),updatedAt:s(),sourceChannel:s().optional(),status:g.optional(),usage:d({calls:o().int().nonnegative(),unknownCostCalls:o().int().nonnegative(),totalTokens:o().int().nonnegative(),knownCostUsd:s(),costCompleteness:u([`complete`,`partial`,`unknown`])}).optional(),routing:_.optional()}).passthrough();var v=d({items:c(r()),total:o(),limit:o(),offset:o(),hasMore:a()}),y=d({role:s(),content:r(),timestamp:i([s(),o()]).optional()}).passthrough(),b=d({key:s(),messages:c(y)}).passthrough(),x=d({session:b}),ee=d({session:d({key:s(),transcriptId:h.optional(),messages:c(y),name:s().optional(),status:g.optional(),sourceChannel:s().optional(),sourceChatId:s().optional(),projectId:s().optional(),customData:n(s(),r()).optional(),routing:_.optional()}).passthrough(),pagination:d({total:o(),limit:o(),offset:o(),hasMore:a(),before:s().optional(),nextBeforeCursor:s().optional(),revision:o().int().nonnegative().optional()}).passthrough()}).passthrough(),S=d({ok:l(!0),conversationId:f(),rowCount:o().int().nonnegative(),lastTurnId:s().min(1),session:b}).passthrough(),C=d({ok:a().optional(),payload:d({active:a(),runId:s().optional()}).passthrough().optional()}).passthrough(),w=d({ok:a().optional(),error:s().optional()}).passthrough(),T=w.extend({renamed:a().optional()}),E=w.extend({reset:a().optional(),transcriptId:h.optional(),previousTranscriptId:s().optional(),session:r().optional()}),D=d({totalSessions:o(),activeSessions:o(),archivedSessions:o(),pinnedSessions:o(),totalMessages:o(),totalTokens:o(),oldestSession:s().optional(),newestSession:s().optional(),byChannel:n(s(),o())}).passthrough();d({ok:a(),payload:d({conversationId:f(),transcriptId:h,session:r()}).passthrough().optional(),error:s().optional()}).passthrough();var O=d({ok:l(!0),projects:d({items:c(d({project:r(),sessions:c(r()),sessionTotal:o(),sessionHasMore:a()}).passthrough()),total:o(),limit:o(),offset:o(),hasMore:a()}),inbox:v,pinned:c(r()).default([]),layouts:n(s(),d({itemIds:c(s()),revision:o().int().nonnegative()})).default({}),childrenByConversationId:n(s(),d({total:o(),activeCount:o(),items:c(d({taskId:s(),title:s(),phase:s(),runStatus:s().optional(),activeConversationId:s().optional()}))})).default({})}).passthrough();function k(e){return x.parse(e)}function A(e){return ee.parse(e)}function j(e){return S.parse(e)}function M(e){return C.parse(e)}function N(e){return w.parse(e)}function P(e){return T.parse(e)}function F(e){return E.parse(e)}function I(e){return D.parse(e)}function L(e){return O.parse(e)}function R(e){let t=M(e).payload,n=typeof t?.runId==`string`?t.runId.trim():``;return!t?.active||!n?{active:!1}:{active:!0,runId:n}}function z(e){let t=new URLSearchParams;if(!e)return``;e.status&&t.set(`status`,e.status),e.search&&t.set(`search`,e.search),e.channel&&t.set(`channel`,e.channel),e.sources?.length&&t.set(`sources`,e.sources.join(`,`)),e.purposes?.length&&t.set(`purposes`,e.purposes.join(`,`)),e.activity&&t.set(`activity`,e.activity),e.agentId&&t.set(`agentId`,e.agentId),e.excludeArchived&&t.set(`excludeArchived`,`true`),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.updatedAfter!=null&&t.set(`updatedAfter`,String(e.updatedAfter)),e.includePinned&&t.set(`includePinned`,`true`),e.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId),e.rootConversationsOnly&&t.set(`rootConversationsOnly`,`true`),e.sessionTypes?.length&&t.set(`types`,e.sessionTypes.join(`,`)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}function B(e,t){let n=[];t?.includeTranscript&&n.push(`transcript`),t?.includeTranscriptRows&&n.push(`transcriptRows`);let r=n.length?`?include=${n.join(`,`)}`:``;return`/api/sessions/${encodeURIComponent(e)}${r}`}function V(e){return`/api/sessions/${encodeURIComponent(e)}/fork-at-turn`}function te(e,t){let n=new URLSearchParams;n.set(`limit`,String(t?.limit??50));let r=t?.before?.trim();return r?n.set(`before`,r):t?.offset!=null&&n.set(`offset`,String(t.offset)),`/api/sessions/${encodeURIComponent(e)}/history?${n.toString()}`}function H(e){return`/api/sessions/${encodeURIComponent(e)}/run`}function U(){return`/api/sessions/stats`}function W(e){let t=new URLSearchParams;e?.projectLimit!=null&&t.set(`projectLimit`,String(e.projectLimit)),e?.projectOffset!=null&&t.set(`projectOffset`,String(e.projectOffset)),e?.sessionPreviewLimit!=null&&t.set(`sessionPreviewLimit`,String(e.sessionPreviewLimit)),e?.inboxLimit!=null&&t.set(`inboxLimit`,String(e.inboxLimit)),e?.inboxOffset!=null&&t.set(`inboxOffset`,String(e.inboxOffset)),e?.staleDays!=null&&t.set(`staleDays`,String(e.staleDays)),e?.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId);let n=t.toString();return`/api/sidebar/chat-list${n?`?${n}`:``}`}function G(e){return`/api/sidebar/layouts/${encodeURIComponent(e)}`}function K(e,t){let n=encodeURIComponent(e);return t===`delete`?`/api/sessions/${n}`:`/api/sessions/${n}/${t}`}function q(e){return e?JSON.stringify({status:e.status,search:e.search,channel:e.channel,sources:e.sources,purposes:e.purposes,activity:e.activity,agentId:e.agentId,excludeArchived:e.excludeArchived,projectId:e.projectId,unassigned:e.unassigned,updatedAfter:e.updatedAfter,includePinned:e.includePinned,includeConversationId:e.includeConversationId,sessionTypes:e.sessionTypes,sortBy:e.sortBy,sortOrder:e.sortOrder,limit:e.limit,offset:e.offset}):`default`}var J=new Map;async function Y(e){let n=q(e),r=J.get(n);if(r)return r;let i=t(`/api/sessions${z(e)}`),a=(async()=>{let e=await p(i);if(!e.ok){let t=await e.json().catch(()=>({})),n=typeof t.error==`string`?t.error:t.error?.message;throw Error(n??`HTTP ${e.status}`)}return await e.json()})().finally(()=>{J.delete(n)});return J.set(n,a),a}async function X(n){return L(await e(t(W(n))))}async function Z(n){let r=await e(t(G(n.containerId)),{method:`PUT`,body:JSON.stringify({itemIds:n.itemIds,expectedRevision:n.expectedRevision})});if(!r.ok||!r.layout)throw Error(r.error??`Failed to save sidebar order`);return r.layout}async function Q(){return I(await e(t(U())))}async function ne(n,r){let i=k(await e(t(B(n,r))));if(!i.session)throw Error(`Session not found`);return i.session}async function re(n){let r=await e(t(`/api/sessions/resolve`),{method:`POST`,body:JSON.stringify(n)});if(!r.ok||!r.payload)throw Error(r.error??`Session not found`);return r.payload}async function ie(n){N(await e(t(K(n,`delete`)),{method:`DELETE`}))}async function ae(n,r){return{renamed:P(await e(t(K(n,`rename`)),{method:`POST`,body:JSON.stringify({name:r})})).renamed===!0}}async function oe(n){N(await e(t(K(n,`archive`)),{method:`POST`}))}async function $(n){N(await e(t(K(n,`unarchive`)),{method:`POST`}))}async function se(n){N(await e(t(K(n,`pin`)),{method:`POST`}))}async function ce(n){N(await e(t(K(n,`unpin`)),{method:`POST`}))}async function le(n){return(await e(t(`/api/sessions/${encodeURIComponent(n)}/export?format=json`))).content}export{R as _,ne as a,F as b,se as c,Z as d,$ as f,H as g,te as h,X as i,ae as l,V as m,ie as n,Q as o,ce as p,le as r,Y as s,oe as t,re as u,j as v,m as x,A as y};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./messages-DPxcWxfD.js";import{c as n,i as r,n as i,p as a,r as o,u as s}from"./locale-store-Djl2FW6_.js";import{d as c,g as l,i as u,l as d,p as f,r as p,s as m,t as h,u as g}from"./schemas-CObaziC7.js";import{i as _,n as v}from"./constants-DeXt1mV-.js";import{_ as ee,b as y,g as b,h as x,m as S,s as C,v as w,y as te}from"./session-api-DbNNQps9.js";import{_ as ne,a as T,c as re,d as ie,f as ae,i as oe,l as E,o as se,p as ce,r as le,s as ue,t as de,u as fe}from"./local-session-drafts-BjwlkAKA.js";import{t as D}from"./tool-activity-BtJkgjFf.js";import{a as pe}from"./attachment-utils-core-BIOUBrpT.js";import{a as me}from"./gateway-realtime-2-o7qk92.js";import{t as he}from"./gateway-startup-retry-BCUswcVy.js";import{n as ge}from"./registry-api-BwR2CiR5.js";import{a as _e}from"./agents-admin-api-BjGOUrAf.js";var ve=[0,500,1500],ye=1e4;function be(e){let t=[e.content,e.thinking??null,e.attachments??null,e.contextRefs??null,e.browserContexts??null];e.appContext!==void 0&&t.push(e.appContext);let n=JSON.stringify(t),r=2166136261,i=5381;for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);r^=t,r=Math.imul(r,16777619),i=Math.imul(i,33)^t}return`${n.length.toString(36)}:${(r>>>0).toString(36)}:${(i>>>0).toString(36)}`}function xe(e){return e===408||e===429||e>=500}var Se=/^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}[^\]]*\]\s*/u,Ce=[`user-profile`,`active-focuses`,`collaboration-contract`,`user-context`];function we(e,t){let n=`<${t}>`;if(!e.startsWith(n))return null;let r=`</${t}>`,i=e.indexOf(r,n.length);return i<0?null:e.slice(i+r.length).trimStart()}function Te(e){return Se.test(e)||e.startsWith(`<source_contexts>`)||Ce.some(t=>e.startsWith(`<${t}>`))}function Ee(e){if(!e.includes(`<source_contexts>`))return e;let t=e.replace(/^\s*<source_contexts>[\s\S]*?<\/source_contexts>\s*/u,``).trimStart();return t.match(/^<user_message>\r?\n([\s\S]*)\r?\n<\/user_message>\s*$/u)?.[1]??t}function De(e){let t=e,n=we(t.trimStart(),`xopc_task_execution`);n!==null&&Te(n)&&(t=n),t=Ee(t);let r=t,i=!1;for(t=t.trimStart();;){let e=Ce.find(e=>t.startsWith(`<${e}>`));if(!e)break;let n=we(t,e);if(n===null){t=r,i=!1;break}t=n,i=!0}return i&&!Se.test(t)&&(t=r),t.replace(Se,``)}function Oe(e){return!e.includes(`[media attached:`)&&!e.includes(`xopc-media-uri:`)?e:e.replace(/\s*\[media attached:[^\]]+\]\s*\r?\nxopc-media-uri:[^\r\n]+\r?\n\s*xopc-media-path:[^\r\n]+(?:\r?\n\s*Use the read_media tool[^\r\n]*)?/g,``).replace(/\s*\[media attached:[^\]]+\]\s*/g,` `).replace(/\s*xopc-media-uri:[^\r\n]+/g,``).replace(/\s*xopc-media-path:[^\r\n]+/g,``).replace(/\s*Use the read_media tool[^\r\n]*/g,``).replace(/\n{3,}/g,`
1
+ import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./messages-DBvKzlCl.js";import{c as n,i as r,n as i,p as a,r as o,u as s}from"./locale-store-Jnhw2WMv.js";import{d as c,g as l,i as u,l as d,p as f,r as p,s as m,t as h,u as g}from"./schemas-CObaziC7.js";import{i as _,n as v}from"./constants-DeXt1mV-.js";import{_ as ee,b as y,g as b,h as x,m as S,s as C,v as w,y as te}from"./session-api-CAKgrbgz.js";import{_ as ne,a as T,c as re,d as ie,f as ae,i as oe,l as E,o as se,p as ce,r as le,s as ue,t as de,u as fe}from"./local-session-drafts-fhip41-L.js";import{t as D}from"./tool-activity-BtJkgjFf.js";import{a as pe}from"./attachment-utils-core-BIOUBrpT.js";import{a as me}from"./gateway-realtime-dE0XrVAT.js";import{t as he}from"./gateway-startup-retry-CqyGHM2M.js";import{n as ge}from"./registry-api-BbUEMGcj.js";import{a as _e}from"./agents-admin-api-DvSe10zu.js";var ve=[0,500,1500],ye=1e4;function be(e){let t=[e.content,e.thinking??null,e.attachments??null,e.contextRefs??null,e.browserContexts??null];e.appContext!==void 0&&t.push(e.appContext);let n=JSON.stringify(t),r=2166136261,i=5381;for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);r^=t,r=Math.imul(r,16777619),i=Math.imul(i,33)^t}return`${n.length.toString(36)}:${(r>>>0).toString(36)}:${(i>>>0).toString(36)}`}function xe(e){return e===408||e===429||e>=500}var Se=/^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}[^\]]*\]\s*/u,Ce=[`user-profile`,`active-focuses`,`collaboration-contract`,`user-context`];function we(e,t){let n=`<${t}>`;if(!e.startsWith(n))return null;let r=`</${t}>`,i=e.indexOf(r,n.length);return i<0?null:e.slice(i+r.length).trimStart()}function Te(e){return Se.test(e)||e.startsWith(`<source_contexts>`)||Ce.some(t=>e.startsWith(`<${t}>`))}function Ee(e){if(!e.includes(`<source_contexts>`))return e;let t=e.replace(/^\s*<source_contexts>[\s\S]*?<\/source_contexts>\s*/u,``).trimStart();return t.match(/^<user_message>\r?\n([\s\S]*)\r?\n<\/user_message>\s*$/u)?.[1]??t}function De(e){let t=e,n=we(t.trimStart(),`xopc_task_execution`);n!==null&&Te(n)&&(t=n),t=Ee(t);let r=t,i=!1;for(t=t.trimStart();;){let e=Ce.find(e=>t.startsWith(`<${e}>`));if(!e)break;let n=we(t,e);if(n===null){t=r,i=!1;break}t=n,i=!0}return i&&!Se.test(t)&&(t=r),t.replace(Se,``)}function Oe(e){return!e.includes(`[media attached:`)&&!e.includes(`xopc-media-uri:`)?e:e.replace(/\s*\[media attached:[^\]]+\]\s*\r?\nxopc-media-uri:[^\r\n]+\r?\n\s*xopc-media-path:[^\r\n]+(?:\r?\n\s*Use the read_media tool[^\r\n]*)?/g,``).replace(/\s*\[media attached:[^\]]+\]\s*/g,` `).replace(/\s*xopc-media-uri:[^\r\n]+/g,``).replace(/\s*xopc-media-path:[^\r\n]+/g,``).replace(/\s*Use the read_media tool[^\r\n]*/g,``).replace(/\n{3,}/g,`
2
2
 
3
3
  `).trim()}var ke=`@xopc-ref:`,Ae=`[A-Za-z0-9_-]{1,64}`,je=RegExp(`${ke}(${Ae})`,`g`);function Me(e){if(!RegExp(`^${Ae}$`).test(e))throw Error(`Invalid context reference id`);return`${ke}${e}`}function Ne(){return new RegExp(je.source,`g`)}function Pe(e){let t=[],n=Ne(),r=0,i;for(;(i=n.exec(e))!==null;)i.index>r&&t.push({type:`text`,text:e.slice(r,i.index)}),t.push({type:`context_ref`,refId:i[1]??``}),r=i.index+i[0].length;return t.length===0?null:(r<e.length&&t.push({type:`text`,text:e.slice(r)}),{version:1,parts:t})}function Fe(e){return e.parts.flatMap(e=>e.type===`context_ref`?[e.refId]:[])}function Ie(e,t){return e.parts.map(e=>{if(e.type===`text`)return e.text;let n=t(e.refId)?.trim();return n?`@${n}`:``}).join(``)}function Le(e){return e.parts.map(e=>e.type===`text`?e.text:Me(e.refId)).join(``)}function Re(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.version!==1||!Array.isArray(t.parts)?!1:t.parts.every(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.type===`text`?typeof t.text==`string`:t.type===`context_ref`&&typeof t.refId==`string`&&RegExp(`^${Ae}$`).test(t.refId)})}var ze=8e3,Be=g({interactionMode:h([`quick`,`compose`]).optional(),choiceDetails:p(g({id:f().min(1).max(160),label:f().trim().min(1).max(1e3),description:f().max(2e3).optional()}).strict()).min(2).max(10).optional(),recommendedChoiceId:f().min(1).max(160).optional(),approval:g({operation:f().min(1).max(1e3),target:f().max(2e3).optional(),impact:f().max(4e3).optional(),argumentsPreview:c(f(),l()).optional()}).strict().optional()}),Ve=g({response:g({choiceId:f().min(1).max(160).optional(),text:f().trim().max(ze).optional()}).strict().optional(),decision:h([`approve`,`deny`]).optional()}).strict();Ve.extend({action:h([`answer`,`agent_decide`,`cancel`]),expectedVersion:d().int().positive(),idempotencyKey:f().trim().min(1).max(256)}).strict();function He(e){let t=Be.safeParse(e);return t.success?t.data:{}}function Ue(e,t){let n=Ve.parse(t);if(e.kind===`approval`){if(n.response||!n.decision)throw Error(`An explicit approval decision is required`);return{answer:n.decision,decision:n.decision}}if(n.decision||!n.response)throw Error(`A structured response is required`);let r=n.response.choiceId?e.choiceDetails?.find(e=>e.id===n.response.choiceId):void 0;if(n.response.choiceId&&!r)throw Error(`Unknown clarification choice`);let i=n.response.text?.trim()??``;if(!r&&!i)throw Error(`Answer is required`);return{answer:r&&i?`Choice: ${r.label}\nAdditional information: ${i}`:r?.label??i,response:{...r?{choiceId:r.id}:{},...i?{text:i}:{}}}}var We=g({version:m(1),deliveryId:f().min(1),taskId:f().min(1),taskRunId:f().min(1),taskTitle:f().min(1).max(500),conversationId:f().min(1),originTranscriptId:f().min(1),requestInputId:f().optional(),assignmentEpoch:d().int().nonnegative(),resultRevision:d().int().positive().optional(),previousResultId:f().optional(),contractVersion:d().int().positive().optional(),instructionSequence:d().int().nonnegative().optional(),adoption:p(g({entryId:f(),sequence:d().int(),status:h([`applied`,`partially_applied`,`not_applied`,`superseded`]),verification:h([`passed`,`failed`,`unverified`]),claimIds:p(f()),note:f()})).optional(),outcome:v,text:f().optional(),createdAt:d()});function Ge(e){let t=We.safeParse(e);return t.success?t.data:void 0}var Ke=g({outreachId:f().uuid(),reasonKind:h([`follow_up`,`discussion`,`change`,`prepared`]),authority:h([`user_explicit`,`inferred`])}).strict();g({version:m(1),outreachId:f().uuid(),threadId:f().uuid(),conversationId:f().uuid(),originTranscriptId:f().min(1),text:f().trim().min(1).max(12e3),provenance:Ke,createdAt:d().int().nonnegative()}).strict();var qe=g({revision:d().int().positive().default(1),mode:h([`off`,`follow_up`,`balanced`]).default(`balanced`),timezone:f().max(100).default(`Asia/Shanghai`).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Invalid timezone`),quietStart:d().int().min(0).max(23).default(22),quietEnd:d().int().min(0).max(23).default(8),dailyMessages:d().int().min(0).max(10).default(2),dailyModelCalls:d().int().min(0).max(100).default(12)}).strict();g({idempotencyKey:f().min(1).max(200),kind:h([`helpful`,`irrelevant`,`stop`,`defer`,`adjust`]),scope:h([`message`,`thread`]).default(`message`),until:d().int().positive().optional(),preparation:h([`brief`,`thorough`]).optional()}).strict().superRefine((e,t)=>{e.kind===`defer`&&!e.until&&t.addIssue({code:`custom`,message:`A defer time is required`}),e.kind===`adjust`&&!e.preparation&&t.addIssue({code:`custom`,message:`A preparation preference is required`}),(e.kind===`stop`||e.kind===`adjust`)&&e.scope!==`thread`&&t.addIssue({code:`custom`,message:`A lasting change requires thread scope`})}),g({versionId:f().uuid(),revision:d().int().positive(),idempotencyKey:f().min(1).max(200)}).strict();var Je=g({preparation:h([`brief`,`thorough`]).nullable(),versions:p(g({id:f().uuid(),revision:d().int().positive(),kind:h([`stop`,`defer`,`adjust`,`rollback`]),createdAt:d(),preparation:h([`brief`,`thorough`]).nullable()}))});g({id:f().uuid(),subject:f(),summary:f(),status:h([`candidate`,`completed`,`expired`]),confidence:d().min(0).max(1),independentStatements:d().int(),independentDays:d().int(),lastSupportedAt:d(),expiresAt:d(),sources:p(g({entryId:f(),excerpt:f(),observedAt:d()}))});var Ye=g({provenance:Ke,thread:g({id:f(),subject:f(),status:f(),revision:d(),nextCheckAt:d().nullable()}),whyNow:f(),sources:p(g({conversationId:f(),transcriptId:f(),entryId:f(),excerpt:f()})),sourcesAvailable:u(),strategy:Je.optional()});function Xe(e){return typeof e==`object`&&!!e&&`role`in e}function Ze(e){if(!e||typeof e!=`object`)return!1;let t=e.type;return t===`tool_use`||t===`tool_call`||t===`toolCall`}function Qe(e){return typeof e==`object`&&!!e}function $e(e){return typeof e.id==`string`&&e.id.length>0?e.id:crypto.randomUUID()}function et(e){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}}function tt(e){return et(e.args??e.arguments??e.input??e.function?.arguments)??{}}function nt(e){if(typeof e==`string`){let t=Date.parse(e);return Number.isNaN(t)?Date.now():t}return Date.now()}function rt(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`)return;let t=Date.parse(e);return Number.isNaN(t)?void 0:t}function it(e){if(Array.isArray(e))return e.map(e=>at(e))}function at(e){if(!e||typeof e!=`object`)return{name:`file`,mimeType:`application/octet-stream`};let t=e,n=ot(t.uri),r=st(t.name),i=ct(t.mimeType,r),a=typeof t.type==`string`?t.type:void 0,o=a===`photo`||a===`image`||i.startsWith(`image/`)?`image`:a===`voice`||a===`audio`||i.startsWith(`audio/`)?`voice`:a;return{id:typeof t.id==`string`?t.id:void 0,name:r,mimeType:i,type:o,size:typeof t.size==`number`?t.size:void 0,uri:n,bucket:typeof t.bucket==`string`?t.bucket:void 0,path:typeof t.path==`string`?t.path:void 0}}function ot(e){return typeof e==`string`&&e.trim().startsWith(`media://`)?e.trim():void 0}function st(e){return typeof e==`string`&&e.trim().length>0?e.trim():`file`}function ct(e,t){if(typeof e==`string`&&e.trim().length>0){let t=e.trim();if(t.toLowerCase().split(`;`)[0]?.trim()!==`application/octet-stream`)return t}return pe(t)??`application/octet-stream`}function lt(e){let t=e.uri?.trim();return t?`uri:${t}`:e.id?`id:${e.id}`:`name:${e.name??`file`}|${e.mimeType??``}`}function ut(e){if(!e?.length)return;let t=[],n=new Set;for(let r of e){let e=lt(r);n.has(e)||(n.add(e),t.push(r))}return t.length?t:void 0}var dt=`[Startup context loaded by runtime]`,ft=`...[additional startup memory truncated]...`,pt=`END_QUOTED_NOTES`;function mt(...e){return e.filter(e=>e.length>0).join(`
4
4
 
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{g as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./download-Dk-ZjtO6.js";import{t as o}from"./folder-open-CyzJ19I9.js";import{t as s}from"./plus-Q2yW6OE7.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./messages-DBvKzlCl.js";import{t as u}from"./cn-0WouolD0.js";import{a as d,c as f,n as p,r as m}from"./locale-store-Jnhw2WMv.js";import{a as h,n as g,o as _,r as ee,s as v,t as te}from"./dist-BGTk37IG.js";import{a as y,c as b,f as ne,n as x,o as S,p as C,r as w,s as T,t as E}from"./session-api-CAKgrbgz.js";import{i as D}from"./vendor-swr-BIWyz7Rc.js";import{n as O,r as k}from"./gateway-config-swr-DAir1JsW.js";import{n as A,t as j}from"./registry-api-BbUEMGcj.js";import{$d as M,$i as N,$l as P,$t as F,Af as I,Ao as L,Fc as R,Fu as z,G as B,Ic as V,Lu as re,No as ie,Qt as ae,Rc as H,Rs as U,Wc as W,Wd as oe,ad as se,do as ce,ds as G,eo as le,fs as K,is as ue,jl as de,kf as fe,nd as pe,no as me,rd as he,ru as ge,so as _e,to as ve,uo as ye,vs as be,vu as xe,ys as Se,yu as Ce,zd as we}from"./index-DvKDT-RQ.js";import{t as q}from"./number-input-DDeqHK-G.js";import{n as Te,r as Ee}from"./settings-page-layout-Dx5S-Msc.js";import{n as De,t as J}from"./settings-form-section-BfBBJlr-.js";import{n as Oe,t as Y}from"./use-autosave-BElgnGMt.js";import{t as ke}from"./settings-advanced-gate-jbVx8gcF.js";var X=e(t(),1),Ae=n(),Z=r();function je(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 Me(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`).format(e)}function Ne(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function Pe(e){let t=(0,Ae.c)(124),{session:n,variant:r,labels:i,sessionAgentId:o,sessionAgentAvatar:s,onOpen:c,onAction:d}=e,f;t[0]!==i.unnamedSession||t[1]!==n.name?(f=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=f):f=t[2];let m=f,h=p(Re),g;t[3]!==h||t[4]!==n?(g=ce(n,l(h).sidebar.sessionFilters),t[3]=h,t[4]=n,t[5]=g):g=t[5];let _=g,ee;t[6]===n.name?ee=t[7]:(ee=n.name?.trim(),t[6]=n.name,t[7]=ee);let v=!!ee,te=n.status===`archived`,y=n.status===`pinned`,b=n.usage,ne;t[8]!==i.costUnknown||t[9]!==i.noUsage||t[10]!==b?(ne=b?.calls?b.costCompleteness===`unknown`?i.costUnknown:`${b.costCompleteness===`partial`?`≥ `:`≈ `}${Ne(b.knownCostUsd)}`:i.noUsage,t[8]=i.costUnknown,t[9]=i.noUsage,t[10]=b,t[11]=ne):ne=t[11];let x=ne,S=b?.calls?b.costCompleteness===`partial`?i.costPartial:b.costCompleteness===`unknown`?i.costUnknown:i.cost:i.noUsage,C=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,w;t[12]===C?w=t[13]:(w=u(`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`,C),t[12]=C,t[13]=w);let T;t[14]===c?T=t[15]:(T=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[14]=c,t[15]=T);let E=r===`list`&&`sm:py-3`,D;t[16]===E?D=t[17]:(D=u(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,E),t[16]=E,t[17]=D);let O;t[18]===n?O=t[19]:(O=(0,Z.jsx)(ye,{sourceChannel:n.sourceChannel,session:n,className:`size-3.5`}),t[18]=n,t[19]=O);let k;t[20]===_?k=t[21]:(k=(0,Z.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:_}),t[20]=_,t[21]=k);let A;t[22]!==O||t[23]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[O,k]}),t[22]=O,t[23]=k,t[24]=A):A=t[24];let j;t[25]===y?j=t[26]:(j=y?(0,Z.jsx)(Ce,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[25]=y,t[26]=j);let M;t[27]===n.updatedAt?M=t[28]:(M=je(n.updatedAt),t[27]=n.updatedAt,t[28]=M);let N;t[29]===M?N=t[30]:(N=(0,Z.jsx)(`span`,{children:M}),t[29]=M,t[30]=N);let P;t[31]!==j||t[32]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[j,N]}),t[31]=j,t[32]=N,t[33]=P):P=t[33];let F;t[34]!==A||t[35]!==P||t[36]!==D?(F=(0,Z.jsxs)(`div`,{className:D,children:[A,P]}),t[34]=A,t[35]=P,t[36]=D,t[37]=F):F=t[37];let L=r===`list`&&`sm:py-3`,z;t[38]===L?z=t[39]:(z=u(`min-w-0 flex-1 px-3 py-2`,L),t[38]=L,t[39]=z);let B=r===`list`&&`sm:items-start`,V;t[40]===B?V=t[41]:(V=u(`flex gap-3`,B),t[40]=B,t[41]=V);let ae;t[42]!==s||t[43]!==o?(ae=(0,Z.jsx)(ie,{agentId:o,avatar:s,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[42]=s,t[43]=o,t[44]=ae):ae=t[44];let H;t[45]===m?H=t[46]:(H=(0,Z.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:m,children:m}),t[45]=m,t[46]=H);let U;t[47]!==n.key||t[48]!==v?(U=v?(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[47]=n.key,t[48]=v,t[49]=U):U=t[49];let W;t[50]!==H||t[51]!==U?(W=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[H,U]}),t[50]=H,t[51]=U,t[52]=W):W=t[52];let se;t[53]!==V||t[54]!==ae||t[55]!==W?(se=(0,Z.jsxs)(`div`,{className:V,children:[ae,W]}),t[53]=V,t[54]=ae,t[55]=W,t[56]=se):se=t[56];let G;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(re,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[57]=G):G=t[57];let le;t[58]===n.messageCount?le=t[59]:(le=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[G,n.messageCount]}),t[58]=n.messageCount,t[59]=le);let K;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(we,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[60]=K):K=t[60];let ue=b?.totalTokens??0,pe;t[61]!==h||t[62]!==ue?(pe=Me(ue,h),t[61]=h,t[62]=ue,t[63]=pe):pe=t[63];let me;t[64]!==i.tokens||t[65]!==pe?(me=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[K,pe,` `,i.tokens]}),t[64]=i.tokens,t[65]=pe,t[66]=me):me=t[66];let he;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(oe,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[67]=he):he=t[67];let ge;t[68]!==x||t[69]!==S?(ge=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:S,children:[he,x]}),t[68]=x,t[69]=S,t[70]=ge):ge=t[70];let _e;t[71]!==le||t[72]!==me||t[73]!==ge?(_e=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[le,me,ge]}),t[71]=le,t[72]=me,t[73]=ge,t[74]=_e):_e=t[74];let ve;t[75]===n.tags?ve=t[76]:(ve=n.tags.length>0?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Le),n.tags.length>3?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[75]=n.tags,t[76]=ve);let be;t[77]!==z||t[78]!==se||t[79]!==_e||t[80]!==ve?(be=(0,Z.jsxs)(`div`,{className:z,children:[se,_e,ve]}),t[77]=z,t[78]=se,t[79]=_e,t[80]=ve,t[81]=be):be=t[81];let Se;t[82]===d?Se=t[83]:(Se=()=>d(`continue`),t[82]=d,t[83]=Se);let q;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(re,{className:`size-4`,strokeWidth:1.75}),t[84]=q):q=t[84];let Te;t[85]!==i.continueChat||t[86]!==Se?(Te=(0,Z.jsx)(`button`,{type:`button`,className:R,title:i.continueChat,"aria-label":i.continueChat,onClick:Se,children:q}),t[85]=i.continueChat,t[86]=Se,t[87]=Te):Te=t[87];let Ee;t[88]!==te||t[89]!==i.archive||t[90]!==i.unarchive||t[91]!==d?(Ee=te?(0,Z.jsx)(`button`,{type:`button`,className:R,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>d(`unarchive`),children:(0,Z.jsx)(I,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:R,title:i.archive,"aria-label":i.archive,onClick:()=>d(`archive`),children:(0,Z.jsx)(fe,{className:`size-4`,strokeWidth:1.75})}),t[88]=te,t[89]=i.archive,t[90]=i.unarchive,t[91]=d,t[92]=Ee):Ee=t[92];let De;t[93]!==y||t[94]!==i.pin||t[95]!==i.unpin||t[96]!==d?(De=y?(0,Z.jsx)(`button`,{type:`button`,className:R,title:i.unpin,"aria-label":i.unpin,onClick:()=>d(`unpin`),children:(0,Z.jsx)(xe,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:R,title:i.pin,"aria-label":i.pin,onClick:()=>d(`pin`),children:(0,Z.jsx)(Ce,{className:`size-4`,strokeWidth:1.75})}),t[93]=y,t[94]=i.pin,t[95]=i.unpin,t[96]=d,t[97]=De):De=t[97];let J;t[98]===d?J=t[99]:(J=()=>d(`export`),t[98]=d,t[99]=J);let Oe;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(a,{className:`size-4`,strokeWidth:1.75}),t[100]=Oe):Oe=t[100];let Y;t[101]!==i.export||t[102]!==J?(Y=(0,Z.jsx)(`button`,{type:`button`,className:R,title:i.export,"aria-label":i.export,onClick:J,children:Oe}),t[101]=i.export,t[102]=J,t[103]=Y):Y=t[103];let ke;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(ke=u(R,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[104]=ke):ke=t[104];let X;t[105]===d?X=t[106]:(X=()=>d(`delete`),t[105]=d,t[106]=X);let Pe;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,Z.jsx)(de,{className:`size-4`,strokeWidth:1.75}),t[107]=Pe):Pe=t[107];let ze;t[108]!==i.delete||t[109]!==X?(ze=(0,Z.jsx)(`button`,{type:`button`,className:ke,title:i.delete,"aria-label":i.delete,onClick:X,children:Pe}),t[108]=i.delete,t[109]=X,t[110]=ze):ze=t[110];let Be;t[111]!==Te||t[112]!==Ee||t[113]!==De||t[114]!==Y||t[115]!==ze?(Be=(0,Z.jsxs)(`div`,{role:`group`,className:`m-1 mt-0 flex flex-wrap items-center gap-0.5 rounded-lg bg-surface-hover/35 p-1.5`,onClick:Ie,onKeyDown:Fe,children:[Te,Ee,De,Y,ze]}),t[111]=Te,t[112]=Ee,t[113]=De,t[114]=Y,t[115]=ze,t[116]=Be):Be=t[116];let Ve;return t[117]!==c||t[118]!==F||t[119]!==be||t[120]!==Be||t[121]!==w||t[122]!==T?(Ve=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,className:w,onClick:c,onKeyDown:T,children:[F,be,Be]}),t[117]=c,t[118]=F,t[119]=be,t[120]=Be,t[121]=w,t[122]=T,t[123]=Ve):Ve=t[123],Ve}function Fe(e){return e.stopPropagation()}function Ie(e){return e.stopPropagation()}function Le(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 Re(e){return e.language}function ze(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function Be(e,t){return t.find(t=>t.id===e)?.avatar}var Ve={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:16e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function He(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ue(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 We(e){let t=He(e)?e:{},n=He(t.userContext)?t.userContext:{},r=He(n.contextPlanning)?n.contextPlanning:{},i=He(r.compaction)?r.compaction:{},a=Ve,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:Ue(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 Ge(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function Ke(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function qe(e){await d(m(`/api/config`),{method:`PATCH`,body:JSON.stringify(Ke(e))}),await O()}var Je=128e3,Ye={balanced:Ve,preserve:{...Ve,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Ve,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Xe=le();function Ze(){return u(`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`,U,`dark:border-edge`)}function Qe(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function $e(e){let t=Qe(e);for(let[e,n]of Object.entries(Ye))if(t===Qe(n))return e;return`custom`}function et(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,Ae.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=Ze(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Z.jsx)(q,{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 tt(e){let t=(0,Ae.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=u(`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 d;t[4]!==i||t[5]!==a||t[6]!==l?(d=(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]=d):d=t[7];let f;t[8]===n?f=t[9]:(f=(0,Z.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=f);let p;t[10]===r?p=t[11]:(p=(0,Z.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(`span`,{children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==c||t[16]!==d||t[17]!==m?(h=(0,Z.jsxs)(`label`,{className:c,children:[d,m]}),t[15]=c,t[16]=d,t[17]=m,t[18]=h):h=t[18],h}function nt({hasToken:e}){let t=l(p(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=k(e),{data:i=[],isLoading:a}=D(e?j:null,A,{revalidateOnFocus:!1}),o=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:We(n.payload.config),[n]),[d,f]=(0,X.useReducer)(Xe,{form:null,baseline:null}),[m,h]=(0,X.useState)(``),g=(0,X.useRef)(!1),_=(0,X.useRef)(d.form);_.current=d.form;let ee=(0,X.useRef)(null);ve({enabled:e,parsed:o,dirty:g.current,trackedParsedRef:ee,dispatch:f,onResetDirty:()=>{g.current=!1}});let v=d.form,te=d.baseline,y=!!(v&&te&&JSON.stringify(v)!==JSON.stringify(te)),b=(0,X.useCallback)(e=>{g.current=!0,f({type:`patch`,patch:e})},[]),ne=(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]),x=Y({value:v,dirty:y,onSave:(0,X.useCallback)(async e=>{try{await qe(e),f({type:`saved`,value:e}),g.current=!!(_.current&&JSON.stringify(_.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=Ge(e);return n?t.invalidValue.replace(`{{field}}`,ne(n)):null}});if(!e||!v)return r?(0,Z.jsx)(J,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(H,{className:`h-5 w-48`}),(0,Z.jsx)(H,{className:`h-20 w-full rounded-xl`}),(0,Z.jsx)(H,{className:`h-36 w-full rounded-xl`})]})}):null;let S=$e(v),C=Math.max(0,Je-v.reserveTokens),w=Math.min(Math.floor(Je*v.triggerThreshold),C),T=Math.min(100,w/Je*100),E=Math.min(100,C/Je*100),O=v.model?i.find(e=>e.id===v.model):void 0,M=O?.contextWindow&&v.summaryChunkTokens+v.summaryMaxTokens+4096>O.contextWindow,P=v.keepRecentTokens+v.reserveTokens>w,F=Math.round(v.summaryTimeoutMs*(v.summaryRetries+1)/1e3),I=e=>{let t=Ye[e];b({...t,...v.model?{model:v.model}:{model:void 0},postCompactionSections:v.postCompactionSections})},L={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},R=()=>{let e=m.trim();!e||v.postCompactionSections.includes(e)||v.postCompactionSections.length>=12||(b({postCompactionSections:[...v.postCompactionSections,e]}),h(``))};return(0,Z.jsxs)(J,{onBlurCapture:x.onBlurCapture,children:[(0,Z.jsx)(De,{icon:z,title:t.title,subtitle:t.hint,trailing:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(Oe,{status:x.status,error:x.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:v.enabled,onChange:e=>b({enabled:e.target.checked})}),v.enabled?t.enabled:t.disabled]})]})}),x.error?(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:x.error}):null,v.enabled?null:(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Z.jsxs)(`fieldset`,{disabled:!v.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})]}),S===`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":S===e,className:u(`rounded-xl bg-surface-base/55 px-3 py-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,V.transition,V.focusRingPanel,S===e?`bg-accent-soft text-accent-fg shadow-surface`:`text-fg hover:bg-surface-hover`),onClick:()=>I(e),children:[(0,Z.jsx)(`span`,{className:`block text-sm font-medium`,children:L[e].title}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:L[e].hint})]},e))})]}),(0,Z.jsxs)(B,{title:t.advancedTitle,summary:S===`custom`?t.presetCustom:t.presetHint,children:[(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,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:et(w)})]}),(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:`${T}%`}})})]}),(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:et(C)})]}),(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:`${E}%`}})})]})]}),(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((v.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>b({triggerThreshold:e/100})}),(0,Z.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,et(v.reserveTokens)),value:v.reserveTokens,min:1024,step:1024,onChange:e=>b({reserveTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:v.recentTurnsPreserve,min:1,max:12,onChange:e=>b({recentTurnsPreserve:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,et(v.keepRecentTokens)),value:v.keepRecentTokens,min:1e3,step:1e3,onChange:e=>b({keepRecentTokens:Math.floor(e)})})]}),P?(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):null,(0,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)(N,{value:v.model??``,disabled:!v.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=>b({model:e})}),v.model?(0,Z.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>b({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)(tt,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:v.qualityGuard,onChange:e=>b({qualityGuard:e})}),(0,Z.jsx)(tt,{label:t.gapAudit,hint:t.gapAuditHint,checked:v.gapAudit,onChange:e=>b({gapAudit:e})})]}),v.qualityGuard?null:(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning})]}),(0,Z.jsx)(ke,{children:(0,Z.jsxs)(`div`,{className:`space-y-5 rounded-xl bg-surface-base/45 p-4`,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:v.minMessagesBeforeCompact,min:2,onChange:e=>b({minMessagesBeforeCompact:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((v.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>b({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Z.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:v.summaryMaxTokens,min:256,step:256,onChange:e=>b({summaryMaxTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:v.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>b({summaryChunkTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(F)),value:v.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>b({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Z.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:v.summaryRetries,min:0,max:5,onChange:e=>b({summaryRetries:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:v.minToolResultKeepChars,min:200,step:100,onChange:e=>b({minToolResultKeepChars:Math.floor(e)})})]}),M?(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,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}),v.postCompactionSections.length>0?(0,Z.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:v.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:u(`text-fg-muted hover:text-fg`,V.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>b({postCompactionSections:v.postCompactionSections.filter(t=>t!==e)}),children:(0,Z.jsx)(c,{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:Ze(),value:m,maxLength:120,disabled:v.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),R())}}),(0,Z.jsxs)(W,{type:`button`,variant:`secondary`,disabled:!m.trim()||v.postCompactionSections.length>=12,onClick:R,children:[(0,Z.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function rt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function it(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function at(e){let t=rt(e)?e:{},n=rt(t.session)?t.session:{},r=rt(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:it(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function ot(e){await d(m(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),O()}function st(){return u(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,U,`dark:border-edge`)}var ct=le();function lt({hasToken:e}){let t=l(p(e=>e.language)).sessions.config,{data:n,isLoading:r}=k(e),i=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:at(n.payload.config),[n]),[a,o]=(0,X.useReducer)(ct,{form:null,baseline:null}),s=a.form,c=a.baseline,u=(0,X.useRef)(!1),d=(0,X.useRef)(s);d.current=s;let f=(0,X.useRef)(null);ve({enabled:e,parsed:i,dirty:u.current,trackedParsedRef:f,dispatch:o,onResetDirty:()=>{u.current=!1}});let m=!!(s&&c&&JSON.stringify(s)!==JSON.stringify(c)),h=(0,X.useCallback)(e=>{u.current=!0,o({type:`patch`,patch:e})},[]),g=Y({value:s,dirty:m,onSave:(0,X.useCallback)(async e=>{try{await ot(e),o({type:`saved`,value:e}),u.current=!!(d.current&&JSON.stringify(d.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!s?r?(0,Z.jsx)(J,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(H,{className:`h-5 w-40`}),(0,Z.jsx)(H,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Z.jsxs)(J,{onBlurCapture:g.onBlurCapture,children:[(0,Z.jsx)(De,{icon:we,title:t.title,subtitle:t.hint,trailing:(0,Z.jsx)(Oe,{status:g.status,error:g.error})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(B,{title:t.dmScope,summary:s.dmScope,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)(G,{className:st(),value:s.dmScope,onChange:e=>h({dmScope:e.target.value}),children:[(0,Z.jsx)(K,{value:`main`,children:t.dmScopeMain}),(0,Z.jsx)(K,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Z.jsx)(K,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Z.jsx)(K,{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)(q,{allowEmpty:!0,type:`number`,min:0,className:st(),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.jsx)(B,{title:t.maxEntries,summary:s.maxEntries??t.unsetPlaceholder,children:(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)(q,{allowEmpty:!0,type:`number`,min:1,className:st(),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 ut(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function dt(e){let t=(0,Ae.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:l,onArchive:d,onUnarchive:f,onPin:p,onUnpin:m,onExport:y,onDelete:b}=e,ne=i?.status===`archived`,x=i?.status===`pinned`,S;t[0]===l?S=t[1]:(S=e=>!e&&l(),t[0]=l,t[1]=S);let C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(h,{className:u(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Se)}),t[2]=C):C=t[2];let w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=u(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,be,`dark:border-edge`),t[3]=w):w=t[3];let T;t[4]!==i||t[5]!==o||t[6]!==a?(T=i&&a?(0,Z.jsx)(ie,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=o,t[6]=a,t[7]=T):T=t[7];let E;t[8]!==s.unnamedSession||t[9]!==i?.name?(E=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=E):E=t[10];let D;t[11]===E?D=t[12]:(D=(0,Z.jsx)(v,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:E}),t[11]=E,t[12]=D);let O;t[13]!==T||t[14]!==D?(O=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[T,D]}),t[13]=T,t[14]=D,t[15]=O):O=t[15];let k;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(c,{className:`size-5`,strokeWidth:1.75}),t[16]=k):k=t[16];let A;t[17]===s.close?A=t[18]:(A=(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:k})}),t[17]=s.close,t[18]=A);let j;t[19]!==O||t[20]!==A?(j=(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:[O,A]}),t[19]=O,t[20]=A,t[21]=j):j=t[21];let M;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(M=r?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.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:s.detailMessages}),(0,Z.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(ft)})]}):null,t[22]=s.detailLoading,t[23]=s.detailMessages,t[24]=r,t[25]=i,t[26]=M):M=t[26];let N;t[27]===M?N=t[28]:(N=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:M}),t[27]=M,t[28]=N);let P;t[29]!==s.detailExport||t[30]!==y?(P=(0,Z.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:y,children:s.detailExport}),t[29]=s.detailExport,t[30]=y,t[31]=P):P=t[31];let F;t[32]!==ne||t[33]!==s.archive||t[34]!==s.unarchive||t[35]!==d||t[36]!==f?(F=ne?(0,Z.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:f,children:s.unarchive}):(0,Z.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:d,children:s.archive}),t[32]=ne,t[33]=s.archive,t[34]=s.unarchive,t[35]=d,t[36]=f,t[37]=F):F=t[37];let I;t[38]!==x||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==p||t[42]!==m?(I=x?(0,Z.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:m,children:s.unpin}):(0,Z.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:p,children:s.pin}),t[38]=x,t[39]=s.pin,t[40]=s.unpin,t[41]=p,t[42]=m,t[43]=I):I=t[43];let L;t[44]!==s.delete||t[45]!==b?(L=(0,Z.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:b,children:s.delete}),t[44]=s.delete,t[45]=b,t[46]=L):L=t[46];let R;t[47]!==P||t[48]!==F||t[49]!==I||t[50]!==L?(R=(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:[P,F,I,L]})}),t[47]=P,t[48]=F,t[49]=I,t[50]=L,t[51]=R):R=t[51];let z;t[52]!==j||t[53]!==N||t[54]!==R?(z=(0,Z.jsxs)(_,{children:[C,(0,Z.jsxs)(ee,{className:w,"aria-describedby":void 0,children:[j,N,R]})]}),t[52]=j,t[53]=N,t[54]=R,t[55]=z):z=t[55];let B;return t[56]!==n||t[57]!==S||t[58]!==z?(B=(0,Z.jsx)(te,{open:n,onOpenChange:S,children:z}),t[56]=n,t[57]=S,t[58]=z,t[59]=B):B=t[59],B}function ft(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:ut(e.content)})]},`${e.timestamp??``}-${e.role}-${ut(e.content).slice(0,24)}`)}var pt=20;function mt(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ht=new Set([`all`,`active`,`pinned`,`archived`]),gt=new Set([`grid`,`list`]),_t=[`sessions`,`settings`];function vt(e){return e&&_t.includes(e)?e:`sessions`}function yt(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function bt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function xt(e){let t=(0,Ae.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=_t.map(e=>({id:e,label:yt(n,e),icon:e===`sessions`?se:P})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Z.jsx)(ue,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function St(e){let t=(0,Ae.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-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,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:yt(n,r)}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:bt(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 Ct(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ht.has(t)?t:`all`,viewMode:gt.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function wt(){let e=l(p(e=>e.language)),t=e.sessions,n=f(e=>e.conversationId),r=!!n,{data:a,mutate:s}=D(r?[`gateway-chat-agents`,n]:null,_e,{revalidateOnFocus:!1}),c=a?.defaultId??`main`,d=a?.items??[],[m,g]=i(),O=vt(m.get(`tab`)),k=(0,X.useCallback)(e=>{let t=new URLSearchParams(m);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),g(t,{replace:!0})},[m,g]),[A,j]=(0,X.useReducer)(me,m,Ct),{searchInput:N,debouncedSearch:P,statusFilter:I,viewMode:R,channelFilter:z,sessions:B,loading:re,error:ie,hasMore:H,stats:U,detailOpen:oe,detailLoading:ce,detailSession:G,confirmOpen:le,confirmKey:K}=A;(0,X.useEffect)(()=>{let e=setTimeout(()=>{let e=N.trim();P!==e&&j({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[N,P]);let ue=m.toString(),de=(0,X.useRef)(ue);if(de.current!==ue){de.current=ue;let e=m.get(`q`)??``,t=m.get(`status`),n=m.get(`view`),r=(m.get(`channel`)??``).trim(),i=ht.has(t)?t:`all`,a=gt.has(n)?n:`grid`,o=e.trim();j({type:`patch`,patch:{...N===e?{}:{searchInput:e},...P===o?{}:{debouncedSearch:o},...I===i?{}:{statusFilter:i},...R===a?{}:{viewMode:a},...z===r?{}:{channelFilter:r}}})}(0,X.useEffect)(()=>{let e=new URLSearchParams(m),t=P.trim();t?e.set(`q`,t):e.delete(`q`),I===`all`?e.delete(`status`):e.set(`status`,I),R===`grid`?e.delete(`view`):e.set(`view`,R),z?e.set(`channel`,z):e.delete(`channel`),e.toString()!==m.toString()&&g(e,{replace:!0})},[P,m,g,I,R,z]),(0,X.useEffect)(()=>{if(!r||O!==`sessions`)return;let e=!1;return(async()=>{j({type:`patch`,patch:{loading:!0,error:null}});try{let t=await T({limit:pt,offset:0,...P?{search:P}:{},...I===`all`?{}:{status:I},...z?{channel:z}:{}});if(e)return;j({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||j({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||j({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,O,P,I,z,t.loadError]),(0,X.useEffect)(()=>{!r||O!==`sessions`||S().then(e=>j({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,O]),(0,X.useEffect)(()=>{if(!r||O!==`sessions`)return;let e=()=>void s();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,O,s]),(0,X.useEffect)(()=>{if(!r||O!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||j({type:`patch`,patch:{sessions:B.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,O,B,G]);let ve=(0,X.useCallback)(async()=>{if(!(!r||re||!H)){j({type:`patch`,patch:{loading:!0,error:null}});try{let e=await T({limit:pt,offset:B.length,...P?{search:P}:{},...I===`all`?{}:{status:I},...z?{channel:z}:{}});j({type:`patch`,patch:{sessions:[...B,...e.items],hasMore:e.hasMore}})}catch(e){j({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{j({type:`patch`,patch:{loading:!1}})}}},[r,re,H,B.length,P,I,z,t.loadError]),ye=(0,X.useCallback)((e,t)=>{j({type:`patch`,patch:{sessions:B.map(n=>n.key===e?{...n,status:t}:n),detailSession:G&&G.key===e?{...G,status:t}:G}})},[B,G]),xe=(0,X.useCallback)(async e=>{j({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{j({type:`patch`,patch:{detailSession:await y(e)}})}catch{j({type:`patch`,patch:{detailOpen:!1}})}finally{j({type:`patch`,patch:{detailLoading:!1}})}},[]),we=e=>{xe(e)},q=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e},bubbles:!0}));return}if(t===`delete`){j({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await E(e),ye(e,`archived`);break;case`unarchive`:await ne(e),ye(e,`active`);break;case`pin`:await b(e),ye(e,`pinned`);break;case`unpin`:await C(e),ye(e,`active`);break;case`export`:{let t=await w(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}S().then(e=>j({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},De=async e=>{try{await x(e),j({type:`patch`,patch:{sessions:B.filter(t=>t.key!==e),detailSession:G?.key===e?null:G,...G?.key===e?{detailOpen:!1}:{}}}),S().then(e=>j({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},J={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,tokens:t.tokens,cost:t.cost,costPartial:t.costPartial,costUnknown:t.costUnknown,noUsage:t.noUsage,unnamedSession:e.chat.newSession},Oe={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},Y=[{key:`all`,label:t.filterAll,icon:se},{key:`active`,label:t.filterActive,icon:M},{key:`pinned`,label:t.filterPinned,icon:Ce},{key:`archived`,label:t.filterArchived,icon:fe}],ke=(()=>{let e=Object.entries(U?.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)(Ee,{gap:`gap-6`,children:[(0,Z.jsx)(Te,{title:t.title}),(0,Z.jsx)(xt,{s:t,activeTab:O,onChange:k}),(0,Z.jsx)(St,{s:t,id:`settings`,activeTab:O,plain:!0,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(nt,{hasToken:r}),(0,Z.jsx)(lt,{hasToken:r})]})}),(0,Z.jsxs)(St,{s:t,id:`sessions`,activeTab:O,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)(L,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.tabsSessions,indicatorClassName:`rounded-xl bg-accent-soft`,children:Y.map(({key:e,label:t,icon:n})=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":I===e,onClick:()=>j({type:`patch`,patch:{statusFilter:e}}),className:u(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,V.transition,V.focusRingPanel,I===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 min-h-11 w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base focus-within:ring-2 focus-within:ring-accent px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Z.jsx)(ge,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:N,onChange:e=>j({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,"data-debounced-query":P||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-base sm:text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Z.jsxs)(L,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":t.filterChannelLabel,indicatorClassName:`rounded-xl bg-accent-soft`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":!z,onClick:()=>j({type:`patch`,patch:{channelFilter:``}}),className:u(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,V.transition,V.focusRingPanel,z?`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}),ke.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":z===e,onClick:()=>j({type:`patch`,patch:{channelFilter:e}}),className:u(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,V.transition,V.focusRingPanel,z===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,U?.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:U.byChannel[e]})]},e))]}),U?(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[U.totalSessions,t.totalSessions],[U.activeSessions,t.activeSessions],[U.pinnedSessions,t.pinnedSessions],[U.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,ie?(0,Z.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,children:ie}):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:mt(t.sessionCount,{count:B.length})}),(0,Z.jsxs)(L,{className:F,role:`group`,"aria-label":t.layoutToggleGroup,indicatorClassName:`rounded-pill bg-surface-panel shadow-sm dark:ring-1 dark:ring-edge-strong/40`,children:[(0,Z.jsx)(W,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":R===`grid`,onClick:()=>j({type:`patch`,patch:{viewMode:`grid`}}),className:u(ae,`size-7 p-0`,R===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,R===`grid`&&`text-accent-fg`),children:(0,Z.jsx)(he,{className:`size-3.5`,strokeWidth:1.5})}),(0,Z.jsx)(W,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":R===`list`,onClick:()=>j({type:`patch`,patch:{viewMode:`list`}}),className:u(ae,`size-9 p-0`,R===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,R===`list`&&`text-accent-fg`),children:(0,Z.jsx)(pe,{className:`size-3.5`,strokeWidth:1.5})})]})]}),re&&B.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))}):B.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)(o,{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)(W,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:u(`grid min-w-0 gap-3`,R===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":P||void 0,children:B.map(e=>{let t=ze(e,c);return(0,Z.jsx)(Pe,{session:e,variant:R,labels:J,sessionAgentId:t,sessionAgentAvatar:Be(t,d),onOpen:()=>we(e.key),onAction:t=>void q(e.key,t)},e.key)})}),H?(0,Z.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Z.jsx)(W,{type:`button`,variant:`secondary`,disabled:re,onClick:()=>void ve(),children:t.loadMore})}):null]})]})]}),(0,Z.jsx)(dt,{open:oe,loading:ce,session:G,sessionAgentId:G?ze(G,c):void 0,sessionAgentAvatar:G?Be(ze(G,c),d):void 0,labels:Oe,onClose:()=>{j({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>G&&void q(G.key,`archive`),onUnarchive:()=>G&&void q(G.key,`unarchive`),onPin:()=>G&&void q(G.key,`pin`),onUnpin:()=>G&&void q(G.key,`unpin`),onExport:()=>G&&void q(G.key,`export`),onDelete:()=>G&&j({type:`patch`,patch:{confirmKey:G.key,confirmOpen:!0}})}),(0,Z.jsx)(te,{open:le,onOpenChange:e=>j({type:`patch`,patch:{confirmOpen:e}}),children:(0,Z.jsxs)(_,{children:[(0,Z.jsx)(h,{className:u(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Se)}),(0,Z.jsxs)(ee,{className:u(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`,be),children:[(0,Z.jsx)(v,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:K?mt(t.deleteSessionMessage,{name:B.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)(W,{type:`button`,variant:`secondary`,onClick:()=>j({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Z.jsx)(W,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{K&&De(K),j({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{wt as SessionsPage};
@@ -0,0 +1 @@
1
+ import{Hn as e}from"./index-DvKDT-RQ.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import{Ic as r,bu as i}from"./index-Dsp_gNdl.js";var a=e();function o(){return`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`}var s=t();function c(e){let t=(0,a.c)(7),{children:r,className:i,id:c,onBlurCapture:l}=e,u;t[0]===i?u=t[1]:(u=n(o(),i),t[0]=i,t[1]=u);let d;return t[2]!==r||t[3]!==c||t[4]!==l||t[5]!==u?(d=(0,s.jsx)(`section`,{id:c,className:u,onBlurCapture:l,children:r}),t[2]=r,t[3]=c,t[4]=l,t[5]=u,t[6]=d):d=t[6],d}var l=`mt-0.5 flex size-7 shrink-0 items-center justify-center text-fg-muted transition-colors`;function u(e){let t=(0,a.c)(27),{icon:o,title:c,subtitle:u,trailing:d,titleAccessory:f,className:p,iconInteractive:m,iconLeading:h}=e,g;t[0]===o?g=t[1]:(g=(0,s.jsx)(o,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=o,t[1]=g);let _=h??g,v,y;if(t[2]!==p||t[3]!==m||t[4]!==h||t[5]!==_){let e=h?n(`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel p-0 ring-1 ring-inset ring-edge-subtle transition-[box-shadow] hover:ring-accent/40 dark:ring-edge-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,r.press):n(l,`hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,r.press),a=!!(m&&h);t[8]===p?v=t[9]:(v=n(`mb-4 flex items-start gap-2.5`,p),t[8]=p,t[9]=v),y=m?a?(0,s.jsxs)(`span`,{className:`relative shrink-0`,children:[(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:n(`touch-target`,e),children:_}),(0,s.jsx)(`span`,{className:`pointer-events-none absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-md border border-edge bg-surface-panel text-fg-muted shadow-sm dark:border-edge dark:bg-surface-base`,"aria-hidden":!0,children:(0,s.jsx)(i,{className:`size-2.5`,strokeWidth:2.25})})]}):(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:n(`touch-target`,e),children:_}):(0,s.jsx)(`div`,{className:n(h?`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel ring-1 ring-inset ring-edge-subtle dark:ring-edge-subtle`:l),"aria-hidden":!h,children:_}),t[2]=p,t[3]=m,t[4]=h,t[5]=_,t[6]=v,t[7]=y}else v=t[6],y=t[7];let b;t[10]===c?b=t[11]:(b=(0,s.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c}),t[10]=c,t[11]=b);let x;t[12]!==b||t[13]!==f?(x=(0,s.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[b,f]}),t[12]=b,t[13]=f,t[14]=x):x=t[14];let S;t[15]===u?S=t[16]:(S=u?(0,s.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:u}):null,t[15]=u,t[16]=S);let C;t[17]!==x||t[18]!==S?(C=(0,s.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]}),t[17]=x,t[18]=S,t[19]=C):C=t[19];let w;t[20]===d?w=t[21]:(w=d?(0,s.jsx)(`div`,{className:`shrink-0`,children:d}):null,t[20]=d,t[21]=w);let T;return t[22]!==v||t[23]!==y||t[24]!==C||t[25]!==w?(T=(0,s.jsxs)(`div`,{className:v,children:[y,C,w]}),t[22]=v,t[23]=y,t[24]=C,t[25]=w,t[26]=T):T=t[26],T}export{u as n,o as r,c as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import{Ic as r,xu as i}from"./index-DvKDT-RQ.js";var a=e();function o(){return`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`}var s=t();function c(e){let t=(0,a.c)(7),{children:r,className:i,id:c,onBlurCapture:l}=e,u;t[0]===i?u=t[1]:(u=n(o(),i),t[0]=i,t[1]=u);let d;return t[2]!==r||t[3]!==c||t[4]!==l||t[5]!==u?(d=(0,s.jsx)(`section`,{id:c,className:u,onBlurCapture:l,children:r}),t[2]=r,t[3]=c,t[4]=l,t[5]=u,t[6]=d):d=t[6],d}var l=`mt-0.5 flex size-7 shrink-0 items-center justify-center text-fg-muted transition-colors`;function u(e){let t=(0,a.c)(27),{icon:o,title:c,subtitle:u,trailing:d,titleAccessory:f,className:p,iconInteractive:m,iconLeading:h}=e,g;t[0]===o?g=t[1]:(g=(0,s.jsx)(o,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=o,t[1]=g);let _=h??g,v,y;if(t[2]!==p||t[3]!==m||t[4]!==h||t[5]!==_){let e=h?n(`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel p-0 ring-1 ring-inset ring-edge-subtle transition-[box-shadow] hover:ring-accent/40 dark:ring-edge-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,r.press):n(l,`hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,r.press),a=!!(m&&h);t[8]===p?v=t[9]:(v=n(`mb-4 flex items-start gap-2.5`,p),t[8]=p,t[9]=v),y=m?a?(0,s.jsxs)(`span`,{className:`relative shrink-0`,children:[(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:n(`touch-target`,e),children:_}),(0,s.jsx)(`span`,{className:`pointer-events-none absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-md border border-edge bg-surface-panel text-fg-muted shadow-sm dark:border-edge dark:bg-surface-base`,"aria-hidden":!0,children:(0,s.jsx)(i,{className:`size-2.5`,strokeWidth:2.25})})]}):(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:n(`touch-target`,e),children:_}):(0,s.jsx)(`div`,{className:n(h?`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel ring-1 ring-inset ring-edge-subtle dark:ring-edge-subtle`:l),"aria-hidden":!h,children:_}),t[2]=p,t[3]=m,t[4]=h,t[5]=_,t[6]=v,t[7]=y}else v=t[6],y=t[7];let b;t[10]===c?b=t[11]:(b=(0,s.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c}),t[10]=c,t[11]=b);let x;t[12]!==b||t[13]!==f?(x=(0,s.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[b,f]}),t[12]=b,t[13]=f,t[14]=x):x=t[14];let S;t[15]===u?S=t[16]:(S=u?(0,s.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:u}):null,t[15]=u,t[16]=S);let C;t[17]!==x||t[18]!==S?(C=(0,s.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]}),t[17]=x,t[18]=S,t[19]=C):C=t[19];let w;t[20]===d?w=t[21]:(w=d?(0,s.jsx)(`div`,{className:`shrink-0`,children:d}):null,t[20]=d,t[21]=w);let T;return t[22]!==v||t[23]!==y||t[24]!==C||t[25]!==w?(T=(0,s.jsxs)(`div`,{className:v,children:[y,C,w]}),t[22]=v,t[23]=y,t[24]=C,t[25]=w,t[26]=T):T=t[26],T}export{u as n,o as r,c as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i,r as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./messages-DPxcWxfD.js";import{n as s}from"./locale-store-Djl2FW6_.js";import{$o as c,Jo as l,Ko as u,Qo as d,Xo as f,Yo as p,Zo as m,es as h,ns as g,qo as _,rs as v,ts as y}from"./index-Dsp_gNdl.js";var b=n(),x=e(t(),1),S=r(),C=[`overview`,`appearance`,`keyboard-shortcuts`,`system`,`desktop-pet`,`desktop-app`,`agent-defaults`,`gateway`,`runtimes`,`devices`,`remote-access`,`shares`],w=(0,x.lazy)(()=>y().then(e=>({default:e.SetupStatusPanel}))),T=(0,x.lazy)(()=>l().then(e=>({default:e.AppearanceSettingsPanel}))),E=(0,x.lazy)(()=>d().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),D=(0,x.lazy)(()=>v().then(e=>({default:e.SystemSettingsPanel}))),O=(0,x.lazy)(()=>p().then(e=>({default:e.DesktopPetSettings}))),k=(0,x.lazy)(()=>_().then(e=>({default:e.AppManagementSettingsPanel}))),A=(0,x.lazy)(()=>m().then(e=>({default:e.GatewaySettingsPanel}))),j=(0,x.lazy)(()=>h().then(e=>({default:e.RuntimeToolsSettingsPanel}))),M=(0,x.lazy)(()=>c().then(e=>({default:e.RemoteAccessHub}))),N=(0,x.lazy)(()=>g().then(e=>({default:e.SharesSettingsPanel}))),P=(0,x.lazy)(()=>u().then(e=>({default:e.AgentDefaultsSettingsPanel}))),F=(0,x.lazy)(()=>f().then(e=>({default:e.EndpointToolsManagementSettings})));function I(){let e=(0,b.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,S.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,S.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,S.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,S.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function L(e){return(0,S.jsx)(x.Suspense,{fallback:(0,S.jsx)(I,{}),children:(0,S.jsx)(e,{})})}function R(){let e=(0,b.c)(27),{section:t}=i(),n=s(z),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let i=o(n);if(!t||!C.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,S.jsx)(a,{to:`/settings/overview`,replace:!0}),e[7]=t):t=e[7],d=t;break bb0}let s=t;if(s===`overview`){let t;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(w),e[8]=t):t=e[8],d=t;break bb0}let f=i.settingsSections[s];if(s===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(T),e[9]=t):t=e[9],d=t;break bb0}if(s===`keyboard-shortcuts`){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(E),e[10]=t):t=e[10],d=t;break bb0}if(s===`system`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(D),e[11]=t):t=e[11],d=t;break bb0}if(s===`desktop-pet`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(O),e[12]=t):t=e[12],d=t;break bb0}if(s===`desktop-app`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(k),e[13]=t):t=e[13],d=t;break bb0}if(s===`agent-defaults`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(P),e[14]=t):t=e[14],d=t;break bb0}if(s===`gateway`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(A),e[15]=t):t=e[15],d=t;break bb0}if(s===`runtimes`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(j),e[16]=t):t=e[16],d=t;break bb0}if(s===`devices`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(F),e[17]=t):t=e[17],d=t;break bb0}if(s===`remote-access`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(M),e[18]=t):t=e[18],d=t;break bb0}if(s===`shares`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(N),e[19]=t):t=e[19],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,S.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=i.settingsPage.comingSoon.replace(`{{title}}`,f)}e[0]=n,e[1]=t,e[2]=r,e[3]=c,e[4]=l,e[5]=u,e[6]=d}else r=e[2],c=e[3],l=e[4],u=e[5],d=e[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;e[20]!==r||e[21]!==c?(f=(0,S.jsx)(`p`,{className:r,children:c}),e[20]=r,e[21]=c,e[22]=f):f=e[22];let p;return e[23]!==l||e[24]!==u||e[25]!==f?(p=(0,S.jsxs)(`div`,{className:l,children:[u,f]}),e[23]=l,e[24]=u,e[25]=f,e[26]=p):p=e[26],p}function z(e){return e.language}export{R as SettingsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i,r as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./messages-DBvKzlCl.js";import{n as s}from"./locale-store-Jnhw2WMv.js";import{$o as c,Jo as l,Ko as u,Qo as d,Xo as f,Yo as p,Zo as m,es as h,ns as g,qo as _,rs as v,ts as y}from"./index-DvKDT-RQ.js";var b=n(),x=e(t(),1),S=r(),C=[`overview`,`appearance`,`keyboard-shortcuts`,`system`,`desktop-pet`,`desktop-app`,`agent-defaults`,`gateway`,`runtimes`,`devices`,`remote-access`,`shares`],w=(0,x.lazy)(()=>y().then(e=>({default:e.SetupStatusPanel}))),T=(0,x.lazy)(()=>l().then(e=>({default:e.AppearanceSettingsPanel}))),E=(0,x.lazy)(()=>d().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),D=(0,x.lazy)(()=>v().then(e=>({default:e.SystemSettingsPanel}))),O=(0,x.lazy)(()=>p().then(e=>({default:e.DesktopPetSettings}))),k=(0,x.lazy)(()=>_().then(e=>({default:e.AppManagementSettingsPanel}))),A=(0,x.lazy)(()=>m().then(e=>({default:e.GatewaySettingsPanel}))),j=(0,x.lazy)(()=>h().then(e=>({default:e.RuntimeToolsSettingsPanel}))),M=(0,x.lazy)(()=>c().then(e=>({default:e.RemoteAccessHub}))),N=(0,x.lazy)(()=>g().then(e=>({default:e.SharesSettingsPanel}))),P=(0,x.lazy)(()=>u().then(e=>({default:e.AgentDefaultsSettingsPanel}))),F=(0,x.lazy)(()=>f().then(e=>({default:e.EndpointToolsManagementSettings})));function I(){let e=(0,b.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,S.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,S.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,S.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,S.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function L(e){return(0,S.jsx)(x.Suspense,{fallback:(0,S.jsx)(I,{}),children:(0,S.jsx)(e,{})})}function R(){let e=(0,b.c)(27),{section:t}=i(),n=s(z),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let i=o(n);if(!t||!C.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,S.jsx)(a,{to:`/settings/overview`,replace:!0}),e[7]=t):t=e[7],d=t;break bb0}let s=t;if(s===`overview`){let t;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(w),e[8]=t):t=e[8],d=t;break bb0}let f=i.settingsSections[s];if(s===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(T),e[9]=t):t=e[9],d=t;break bb0}if(s===`keyboard-shortcuts`){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(E),e[10]=t):t=e[10],d=t;break bb0}if(s===`system`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(D),e[11]=t):t=e[11],d=t;break bb0}if(s===`desktop-pet`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(O),e[12]=t):t=e[12],d=t;break bb0}if(s===`desktop-app`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(k),e[13]=t):t=e[13],d=t;break bb0}if(s===`agent-defaults`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(P),e[14]=t):t=e[14],d=t;break bb0}if(s===`gateway`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(A),e[15]=t):t=e[15],d=t;break bb0}if(s===`runtimes`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(j),e[16]=t):t=e[16],d=t;break bb0}if(s===`devices`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(F),e[17]=t):t=e[17],d=t;break bb0}if(s===`remote-access`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(M),e[18]=t):t=e[18],d=t;break bb0}if(s===`shares`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(N),e[19]=t):t=e[19],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,S.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=i.settingsPage.comingSoon.replace(`{{title}}`,f)}e[0]=n,e[1]=t,e[2]=r,e[3]=c,e[4]=l,e[5]=u,e[6]=d}else r=e[2],c=e[3],l=e[4],u=e[5],d=e[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;e[20]!==r||e[21]!==c?(f=(0,S.jsx)(`p`,{className:r,children:c}),e[20]=r,e[21]=c,e[22]=f):f=e[22];let p;return e[23]!==l||e[24]!==u||e[25]!==f?(p=(0,S.jsxs)(`div`,{className:l,children:[u,f]}),e[23]=l,e[24]=u,e[25]=f,e[26]=p):p=e[26],p}function z(e){return e.language}export{R as SettingsPage};