@xopcai/xopc 0.0.170 → 0.0.172

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 (242) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-CkUp1qvf.js → activity-store-C3Y-bESI.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DDuem4HM.js → agent-avatar-dicebear-CPyev9P7.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-Bf_kK2Ay.js +2 -0
  6. package/dist/gateway/static/root/assets/{api-BnuPQhJW.js → api-B7qEr_Rw.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-DdZw8Hi1.js → app-management-settings-panel-Br_9-7fs.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-BN8Vk2bX.js → appearance-settings-uyLcRPai.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-DXFCP5-1.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-C82MaDQj.js → archive-plugin-B19REnR5.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-uilrwSdW.js → attachment-load-DLWCC4Yi.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automation-suggestion-card-CkDZjAmy.js → automation-suggestion-card-ky5S5lly.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-page-D8pT1o2O.js +6 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-B7NTL0_T.js → binary-plugins-CtPEzLlo.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-D_LDNlB-.js → block-editor-CQVR4Xij.js} +32 -32
  16. package/dist/gateway/static/root/assets/browser-settings-page-Bav_skKN.js +8 -0
  17. package/dist/gateway/static/root/assets/{browser-workflow-inputs-UFVUzn4v.js → browser-workflow-inputs-CimCGbhq.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-workflows-page-CGgC0N92.js → browser-workflows-page-DewuCw3p.js} +2 -2
  19. package/dist/gateway/static/root/assets/capabilities-settings-panel-BHaYYo9E.js +7 -0
  20. package/dist/gateway/static/root/assets/{capability-presets-api-DUIorGUd.js → capability-presets-api-B5RTs-Az.js} +1 -1
  21. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-PTz00nR4.js → capability-presets-settings-panel-BgchTh81.js} +1 -1
  22. package/dist/gateway/static/root/assets/{channel-recipient-api-BYwSB8c6.js → channel-recipient-api-Czu0YzIZ.js} +1 -1
  23. package/dist/gateway/static/root/assets/channels-settings-BP0e62wt.js +1 -0
  24. package/dist/gateway/static/root/assets/channels-status-swr-DBWKfeGe.js +1 -0
  25. package/dist/gateway/static/root/assets/connector-logo-Di3gnR_D.js +1 -0
  26. package/dist/gateway/static/root/assets/connectors-page-CC5kh0de.js +2 -0
  27. package/dist/gateway/static/root/assets/{desktop-pet-CkT98fPT.js → desktop-pet-D-ZUNHhn.js} +1 -1
  28. package/dist/gateway/static/root/assets/{desktop-pet-settings-DkbIzdA3.js → desktop-pet-settings-C3L6AI8_.js} +1 -1
  29. package/dist/gateway/static/root/assets/{directory-picker-path-field-dBQvj1sG.js → directory-picker-path-field-Dvq4iG6P.js} +1 -1
  30. package/dist/gateway/static/root/assets/dreaming-settings-D9i54kWO.js +3 -0
  31. package/dist/gateway/static/root/assets/{extension-debug-page-BfxoIiNo.js → extension-debug-page-BecQjU0J.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-page-EIJ3wIb7.js → extension-page-BeVkPSm-.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-settings-page-DBBec51N.js → extension-settings-page-DMoo2mKx.js} +1 -1
  34. package/dist/gateway/static/root/assets/{gateway-config-api-4_u53Ufq.js → gateway-config-api-Bthb3_6v.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-settings-v9kJM59H.js → gateway-settings-Bh8nPvJQ.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-startup-retry-CXITih5d.js → gateway-startup-retry-D3USVm9D.js} +1 -1
  37. package/dist/gateway/static/root/assets/goal-create-dialog-Dp0AyDHI.js +1 -0
  38. package/dist/gateway/static/root/assets/goal-detail-page-CNt7nrdS.js +4 -0
  39. package/dist/gateway/static/root/assets/{goals-config-api-D54YQPon.js → goals-config-api-C_2QWBtb.js} +1 -1
  40. package/dist/gateway/static/root/assets/goals-page-Bm_NZFiZ.js +2 -0
  41. package/dist/gateway/static/root/assets/{goals-settings-DDezXaVi.js → goals-settings-DhL643tc.js} +1 -1
  42. package/dist/gateway/static/root/assets/{heartbeat-settings-CRsIUeZN.js → heartbeat-settings-COVFwp7C.js} +1 -1
  43. package/dist/gateway/static/root/assets/{image-generation-api-CY6cQUHL.js → image-generation-api-BNQlnwpU.js} +1 -1
  44. package/dist/gateway/static/root/assets/index-C_XSKOH6.css +1 -0
  45. package/dist/gateway/static/root/assets/{index-Dfq2laZe.js → index-DUasAutC.js} +67 -67
  46. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D9k7EDdY.js → keyboard-shortcuts-settings-DfdJRJVy.js} +1 -1
  47. package/dist/gateway/static/root/assets/local-app-workbench-page-DZwkD1co.js +2 -0
  48. package/dist/gateway/static/root/assets/{local-apps-page-DbaiBolh.js → local-apps-page-BvCPOgoi.js} +1 -1
  49. package/dist/gateway/static/root/assets/{locale-store-Dqp9H2Uf.js → locale-store-BP0vD37A.js} +1 -1
  50. package/dist/gateway/static/root/assets/{logs-page-DoCY0Mm9.js → logs-page-dNL0Y1dA.js} +3 -3
  51. package/dist/gateway/static/root/assets/{markdown-split-BGlQR-Be.js → markdown-split-YO1rDk9m.js} +1 -1
  52. package/dist/gateway/static/root/assets/{media-plugins-BpaeV6f_.js → media-plugins-CU_RRf-q.js} +1 -1
  53. package/dist/gateway/static/root/assets/messages-BWtP5TFz.js +3 -0
  54. package/dist/gateway/static/root/assets/{notes-page-Cd2HpciM.js → notes-page-CeFiOK3S.js} +1 -1
  55. package/dist/gateway/static/root/assets/notes-workbench-B8MKxpZb.js +4 -0
  56. package/dist/gateway/static/root/assets/{page-tabs-DyimBUp_.js → page-tabs-tiHmRJUA.js} +1 -1
  57. package/dist/gateway/static/root/assets/{preview-open-alternatives-BKZulEYr.js → preview-open-alternatives-CU6XgaCz.js} +1 -1
  58. package/dist/gateway/static/root/assets/{product-open-page-Bjz9BxBY.js → product-open-page-Dn4_qor4.js} +1 -1
  59. package/dist/gateway/static/root/assets/project-detail-page-CWBuuX-S.js +1 -0
  60. package/dist/gateway/static/root/assets/projects-page-BJSsLsXH.js +1 -0
  61. package/dist/gateway/static/root/assets/remote-access-hub-DXJDb8vB.js +1 -0
  62. package/dist/gateway/static/root/assets/{save-bar-controls-BPTqb2_r.js → save-bar-controls-edDUIbXo.js} +1 -1
  63. package/dist/gateway/static/root/assets/{schedule-field-YN0D81Dk.js → schedule-field-DqJO_5Yb.js} +1 -1
  64. package/dist/gateway/static/root/assets/{schema-form-BmY5PSS2.js → schema-form-CMh0jzy5.js} +1 -1
  65. package/dist/gateway/static/root/assets/sessions-page-DeHpWgxM.js +1 -0
  66. package/dist/gateway/static/root/assets/settings-advanced-gate-Cf-TEYUd.js +1 -0
  67. package/dist/gateway/static/root/assets/{settings-form-section-B-RhgD_p.js → settings-form-section-Bb0Bc3nJ.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DkPupX2B.js → settings-loading-skeleton-DQhADvz1.js} +1 -1
  69. package/dist/gateway/static/root/assets/{settings-page-2QBMvaxj.js → settings-page-b0M5HukN.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-page-layout-CtrW-LD6.js → settings-page-layout-hvjtIjvh.js} +1 -1
  71. package/dist/gateway/static/root/assets/setup-status-panel-BFyfed_g.js +1 -0
  72. package/dist/gateway/static/root/assets/{share-preview-page-BezIW1n9.js → share-preview-page-rbeaOpTg.js} +1 -1
  73. package/dist/gateway/static/root/assets/shares-settings-CYnH9sTt.js +1 -0
  74. package/dist/gateway/static/root/assets/skill-reload-api-Cr8_m-jS.js +1 -0
  75. package/dist/gateway/static/root/assets/skills-page-Chtc1xDO.js +2 -0
  76. package/dist/gateway/static/root/assets/{system-settings-panel-WAFhKyAu.js → system-settings-panel-BHo_hgnL.js} +1 -1
  77. package/dist/gateway/static/root/assets/{theme-store-BiC0gIBa.js → theme-store-C3KnnjcU.js} +1 -1
  78. package/dist/gateway/static/root/assets/time-picker-D-G-uwVJ.js +1 -0
  79. package/dist/gateway/static/root/assets/{typed-models-lib-WAQO3F_8.js → typed-models-lib-DtRnG-YI.js} +1 -1
  80. package/dist/gateway/static/root/assets/{use-channel-catalog-CKlfsSeU.js → use-channel-catalog-CWWItX2g.js} +1 -1
  81. package/dist/gateway/static/root/assets/user-context-page-D7qMR26X.js +1 -0
  82. package/dist/gateway/static/root/assets/{voice-api-key-field-BAFHF0_v.js → voice-api-key-field-BTnltQHZ.js} +1 -1
  83. package/dist/gateway/static/root/assets/work-discovery-page-CpqFZze9.js +1 -0
  84. package/dist/gateway/static/root/assets/work-item-detail-page-t4dXpGC0.js +1 -0
  85. package/dist/gateway/static/root/assets/work-page-BXwDKiMZ.js +1 -0
  86. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-1OP4HyvS.js → workflow-run-setup-panel-D7vKChFZ.js} +2 -2
  87. package/dist/gateway/static/root/assets/workflows-page-Bos9HyqT.js +11 -0
  88. package/dist/gateway/static/root/index.html +7 -7
  89. package/dist/package.js +1 -1
  90. package/dist/src/agent/embedded/run-for-session.js +71 -24
  91. package/dist/src/agent/embedded/run-turn.js +68 -4
  92. package/dist/src/agent/inbound/inbound-loop.d.ts +0 -2
  93. package/dist/src/agent/inbound/inbound-loop.js +0 -2
  94. package/dist/src/agent/memory/builtin-provider.js +4 -4
  95. package/dist/src/agent/memory/compaction-planner.d.ts +16 -0
  96. package/dist/src/agent/memory/compaction-planner.js +152 -0
  97. package/dist/src/agent/memory/compaction-policy.d.ts +10 -0
  98. package/dist/src/agent/memory/compaction-policy.js +24 -0
  99. package/dist/src/agent/memory/compaction.d.ts +21 -22
  100. package/dist/src/agent/memory/compaction.js +220 -194
  101. package/dist/src/agent/memory/context-budget.d.ts +40 -0
  102. package/dist/src/agent/memory/context-budget.js +106 -0
  103. package/dist/src/agent/memory/manager.d.ts +4 -1
  104. package/dist/src/agent/memory/manager.js +8 -3
  105. package/dist/src/agent/memory/understanding/service.d.ts +2 -0
  106. package/dist/src/agent/memory/understanding/service.js +11 -9
  107. package/dist/src/agent/orchestration/context-overflow.d.ts +1 -0
  108. package/dist/src/agent/orchestration/context-overflow.js +19 -0
  109. package/dist/src/agent/orchestration/loop-guard.js +13 -9
  110. package/dist/src/agent/reply/post-compaction-context.d.ts +4 -0
  111. package/dist/src/agent/reply/post-compaction-context.js +5 -3
  112. package/dist/src/agent/service/process-direct-one-shot.js +1 -2
  113. package/dist/src/agent/service/process-direct-streaming.js +1 -2
  114. package/dist/src/agent/service.d.ts +1 -2
  115. package/dist/src/agent/service.js +16 -44
  116. package/dist/src/agent/session/session-inspector.js +10 -2
  117. package/dist/src/automations/domain/validation.d.ts +8 -8
  118. package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
  119. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  120. package/dist/src/config/schema.d.ts +17 -1
  121. package/dist/src/connectors/composio-sessions.d.ts +1 -0
  122. package/dist/src/connectors/composio-sessions.js +14 -5
  123. package/dist/src/connectors/composio-triggers.d.ts +1 -1
  124. package/dist/src/connectors/composio-triggers.js +4 -3
  125. package/dist/src/connectors/composio.js +1 -0
  126. package/dist/src/connectors/{connector-memory-sync.d.ts → connected-source-ingestion.d.ts} +11 -4
  127. package/dist/src/connectors/{connector-memory-sync.js → connected-source-ingestion.js} +49 -101
  128. package/dist/src/connectors/connected-source-normalizers.d.ts +15 -0
  129. package/dist/src/connectors/connected-source-normalizers.js +186 -0
  130. package/dist/src/connectors/connector-identity.d.ts +2 -0
  131. package/dist/src/connectors/connector-identity.js +29 -0
  132. package/dist/src/connectors/learning-coordinator.d.ts +25 -0
  133. package/dist/src/connectors/learning-coordinator.js +214 -0
  134. package/dist/src/connectors/learning-recipes.d.ts +22 -0
  135. package/dist/src/connectors/learning-recipes.js +121 -0
  136. package/dist/src/connectors/runtime-status.d.ts +1 -8
  137. package/dist/src/connectors/runtime-status.js +4 -29
  138. package/dist/src/gateway/hono/lib/config-payload.d.ts +23 -0
  139. package/dist/src/gateway/hono/lib/config-payload.js +3 -0
  140. package/dist/src/gateway/hono/routes/config-patch/misc.d.ts +1 -1
  141. package/dist/src/gateway/hono/routes/config-patch/misc.js +28 -0
  142. package/dist/src/gateway/hono/routes/connectors.js +76 -118
  143. package/dist/src/gateway/hono/routes/models.js +24 -0
  144. package/dist/src/gateway/hono/routes/public-gateway.js +3 -2
  145. package/dist/src/gateway/hono/routes/sessions.js +17 -42
  146. package/dist/src/gateway/hono/routes/you.js +86 -5
  147. package/dist/src/gateway/service/sessions-api.d.ts +2 -3
  148. package/dist/src/gateway/service/sessions-api.js +4 -7
  149. package/dist/src/gateway/service.d.ts +5 -2
  150. package/dist/src/gateway/service.js +16 -11
  151. package/dist/src/knowledge/connected-understanding-pipeline.d.ts +19 -0
  152. package/dist/src/knowledge/connected-understanding-pipeline.js +268 -0
  153. package/dist/src/knowledge/index.d.ts +1 -0
  154. package/dist/src/knowledge/index.js +2 -1
  155. package/dist/src/knowledge/ingestion-service.d.ts +6 -4
  156. package/dist/src/knowledge/ingestion-service.js +13 -10
  157. package/dist/src/knowledge/local-folder-adapter.js +1 -0
  158. package/dist/src/knowledge/people-graph.js +43 -110
  159. package/dist/src/knowledge/types.d.ts +3 -0
  160. package/dist/src/providers/xopc-cloud-account-service.d.ts +40 -0
  161. package/dist/src/providers/xopc-cloud-account-service.js +65 -0
  162. package/dist/src/session/index.d.ts +1 -2
  163. package/dist/src/session/index.js +1 -2
  164. package/dist/src/session/init-session-turn.d.ts +0 -1
  165. package/dist/src/session/init-session-turn.js +1 -2
  166. package/dist/src/session/manager.d.ts +11 -17
  167. package/dist/src/session/manager.js +11 -14
  168. package/dist/src/session/session-context-for-llm.d.ts +19 -1
  169. package/dist/src/session/session-context-for-llm.js +87 -129
  170. package/dist/src/session/store.d.ts +28 -23
  171. package/dist/src/session/store.js +94 -83
  172. package/dist/src/session/transcript-format.d.ts +2 -8
  173. package/dist/src/session/types.d.ts +8 -6
  174. package/dist/src/session/user-round-delete.d.ts +3 -6
  175. package/dist/src/session/user-round-delete.js +12 -16
  176. package/dist/src/storage/sqlite/connector-learning-repository.d.ts +47 -0
  177. package/dist/src/storage/sqlite/connector-learning-repository.js +110 -0
  178. package/dist/src/storage/sqlite/index.d.ts +4 -2
  179. package/dist/src/storage/sqlite/index.js +5 -3
  180. package/dist/src/storage/sqlite/knowledge-repository.d.ts +4 -2
  181. package/dist/src/storage/sqlite/knowledge-repository.js +24 -13
  182. package/dist/src/storage/sqlite/migrations/060_remove_runtime_transcript_messages.sql +45 -0
  183. package/dist/src/storage/sqlite/migrations/061_drop_compaction_checkpoints.sql +2 -0
  184. package/dist/src/storage/sqlite/migrations/062_connector_learning_jobs.sql +27 -0
  185. package/dist/src/storage/sqlite/migrations/063_knowledge_collection_scopes.sql +14 -0
  186. package/dist/src/storage/sqlite/migrations/064_user_claims.sql +60 -0
  187. package/dist/src/storage/sqlite/migrations/065_knowledge_item_scope_identity.sql +116 -0
  188. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  189. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  190. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  191. package/dist/src/storage/sqlite/schema.js +1 -1
  192. package/dist/src/storage/sqlite/schema.sql +0 -19
  193. package/dist/src/storage/sqlite/transcript-repository.d.ts +6 -11
  194. package/dist/src/storage/sqlite/transcript-repository.js +90 -84
  195. package/dist/src/storage/sqlite/user-claims-repository.d.ts +101 -0
  196. package/dist/src/storage/sqlite/user-claims-repository.js +241 -0
  197. package/dist/src/user-context/config.d.ts +67 -2
  198. package/dist/src/user-context/config.js +36 -3
  199. package/dist/src/user-context/projection.d.ts +36 -1
  200. package/dist/src/user-context/projection.js +84 -6
  201. package/dist/src/work-discovery/service.js +1 -0
  202. package/package.json +1 -1
  203. package/dist/gateway/static/root/assets/agents-BiaQhiQp.js +0 -2
  204. package/dist/gateway/static/root/assets/apps-page-CuL8Q4yF.js +0 -1
  205. package/dist/gateway/static/root/assets/automations-page-TZOluRNp.js +0 -6
  206. package/dist/gateway/static/root/assets/browser-settings-page-C-l6O68Z.js +0 -8
  207. package/dist/gateway/static/root/assets/capabilities-settings-panel-BW8c0xPp.js +0 -7
  208. package/dist/gateway/static/root/assets/channels-settings-h9CsE0GT.js +0 -1
  209. package/dist/gateway/static/root/assets/channels-status-swr-C058Mcfr.js +0 -1
  210. package/dist/gateway/static/root/assets/connector-logo-CsbegNqi.js +0 -1
  211. package/dist/gateway/static/root/assets/connectors-page-BWALafGW.js +0 -2
  212. package/dist/gateway/static/root/assets/dreaming-settings-DkdnKMZx.js +0 -3
  213. package/dist/gateway/static/root/assets/goal-create-dialog-y2Y3p7_k.js +0 -1
  214. package/dist/gateway/static/root/assets/goal-detail-page-DuzL-alv.js +0 -4
  215. package/dist/gateway/static/root/assets/goals-page-OeLtfKI2.js +0 -2
  216. package/dist/gateway/static/root/assets/index-o4uaOGKT.css +0 -1
  217. package/dist/gateway/static/root/assets/local-app-workbench-page-3ssYIEK6.js +0 -2
  218. package/dist/gateway/static/root/assets/messages-KEk-hTFt.js +0 -3
  219. package/dist/gateway/static/root/assets/notes-workbench-CatZNAPc.js +0 -4
  220. package/dist/gateway/static/root/assets/project-detail-page-DJUOgqm4.js +0 -1
  221. package/dist/gateway/static/root/assets/projects-page-BQQAD_nu.js +0 -1
  222. package/dist/gateway/static/root/assets/remote-access-hub-fIGXTTnA.js +0 -1
  223. package/dist/gateway/static/root/assets/sessions-page-BuU-8FCe.js +0 -1
  224. package/dist/gateway/static/root/assets/settings-advanced-gate-DlKoeZm3.js +0 -1
  225. package/dist/gateway/static/root/assets/setup-status-panel-BSUcDFnb.js +0 -1
  226. package/dist/gateway/static/root/assets/shares-settings-Bk2-SwGJ.js +0 -1
  227. package/dist/gateway/static/root/assets/skill-reload-api-e_Fx1kVC.js +0 -1
  228. package/dist/gateway/static/root/assets/skills-page-D_cCADfj.js +0 -2
  229. package/dist/gateway/static/root/assets/time-picker-fqRXpNJV.js +0 -1
  230. package/dist/gateway/static/root/assets/user-context-page-9Ov4htPW.js +0 -1
  231. package/dist/gateway/static/root/assets/work-discovery-page-DGN2FxWv.js +0 -1
  232. package/dist/gateway/static/root/assets/work-item-detail-page-HmyWSgUo.js +0 -1
  233. package/dist/gateway/static/root/assets/work-page-D3iKVjFq.js +0 -1
  234. package/dist/gateway/static/root/assets/workflows-page-B5L4SFw4.js +0 -11
  235. package/dist/src/agent/lifecycle/handlers/compaction.d.ts +0 -13
  236. package/dist/src/agent/lifecycle/handlers/compaction.js +0 -18
  237. package/dist/src/connectors/memory-sync-coordinator.d.ts +0 -28
  238. package/dist/src/connectors/memory-sync-coordinator.js +0 -162
  239. package/dist/src/connectors/memory-sync-profile.d.ts +0 -13
  240. package/dist/src/connectors/memory-sync-profile.js +0 -73
  241. package/dist/src/session/compaction-checkpoints.d.ts +0 -8
  242. package/dist/src/session/compaction-checkpoints.js +0 -19
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jszip.min-DT31yWkU.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
2
- 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"./preload-helper-zJ_50EbN.js";import{c as a,f as o,l as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./circle-alert-BEjgurr2.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./messages-KEk-hTFt.js";import{l as d,n as f,o as p,r as m}from"./locale-store-Dqp9H2Uf.js";import{t as h}from"./config-reload-event-Bjh2zoKp.js";import{$r as g,Ds as _,Gi as v,Go as y,Is as b,Jo as x,Js as S,Kl as C,Nc as w,Ns as T,Qr as E,To as D,Uo as O,Wl as k,Wo as A,Yo as j,Ys as M,_u as N,aa as P,ac as F,as as I,bl as L,hu as R,qi as z,qo as ee,rl as B,vu as V,wo as H,yc as U}from"./index-Dfq2laZe.js";import{t as W}from"./page-tabs-DyimBUp_.js";import{t as te}from"./skill-reload-api-e_Fx1kVC.js";var ne=n(),G=e(t(),1),K=r(),re=(0,G.memo)(function(e){let t=(0,ne.c)(23),{loading:n,onReloadClick:r,searchQuery:i,setSearchQuery:a,mainTab:o,sk:s,setPendingFile:c,setInstallOpen:l}=e,u;t[0]!==n||t[1]!==r||t[2]!==s.reloadDiskAria||t[3]!==s.reloadRuntime?(u=(0,K.jsx)(P,{className:`size-9 shrink-0 p-0`,loading:n,label:s.reloadDiskAria,title:s.reloadRuntime,onClick:r}),t[0]=n,t[1]=r,t[2]=s.reloadDiskAria,t[3]=s.reloadRuntime,t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(U,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[5]=d):d=t[5];let f;t[6]===a?f=t[7]:(f=e=>a(e.target.value),t[6]=a,t[7]=f);let p=o===`marketplace`?s.marketplaceSearchPackages:s.searchPlaceholder,m;t[8]!==i||t[9]!==f||t[10]!==p?(m=(0,K.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[d,(0,K.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:f,placeholder:p,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[8]=i,t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]!==l||t[13]!==c?(h=()=>{c(null),l(!0)},t[12]=l,t[13]=c,t[14]=h):h=t[14];let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,K.jsx)(w,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[15]=g):g=t[15];let _;t[16]!==s.installCta||t[17]!==h?(_=(0,K.jsxs)(T,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,onClick:h,children:[g,s.installCta]}),t[16]=s.installCta,t[17]=h,t[18]=_):_=t[18];let v;return t[19]!==u||t[20]!==m||t[21]!==_?(v=(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[u,m,_]}),t[19]=u,t[20]=m,t[21]=_,t[22]=v):v=t[22],v}),q=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function J(){let e=(0,ne.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(`div`,{className:l(`h-4 min-w-0 flex-1`,q)}),e[0]=t):t=e[0];let n,r,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[t,(0,K.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,K.jsx)(`div`,{className:l(`size-8 shrink-0 rounded-lg`,q)}),(0,K.jsx)(`div`,{className:l(`h-8 w-[4.5rem] shrink-0 rounded-lg`,q)})]})]}),r=(0,K.jsx)(`div`,{className:l(`h-3 w-full`,q)}),i=(0,K.jsx)(`div`,{className:l(`h-3 w-[92%]`,q)}),e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(`div`,{className:`flex h-full min-h-[10.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[n,r,i,(0,K.jsxs)(`div`,{className:`mt-auto space-y-1 pt-0.5`,children:[(0,K.jsx)(`div`,{className:l(`h-3 w-full`,q)}),(0,K.jsx)(`div`,{className:l(`h-2.5 w-4/5`,q)})]})]})})}),e[4]=a):a=e[4],a}function Y(){let e=(0,ne.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(J,{}),e[0]=t):t=e[0],t}var X=new Set([`installed`,`marketplace`]),Z=new Set([`all`,`builtin`,`installed`,`global`,`workspace`,`extra`]),ie=new Set([`all`,`enabled`,`disabled`]),ae=`mprov`,oe=[`s0`,`s1`,`s2`,`s3`,`s4`,`s5`],se=[`business`,`creative`,`documents`,`engineering`,`tools`];function ce(e){let t=(0,ne.c)(27),{sk:n,loading:r,catalog:i,filteredCatalog:a,builtinCategories:o,builtinCategoryFilter:s,setBuiltinCategoryFilter:u,catalogDisplayRows:d,catalogStatusFilter:f,resolveSkillEnabled:p,categoryLabel:m,sourceLabel:h,openSkillDetail:g,onSkillToggle:v,onUseSkillInChat:y,usingSkillInChatName:b,togglingSkillName:x}=e;if(r){let e=n.loading,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=oe.map(le),t[0]=r):r=t[0];let i;return t[1]===n.loading?i=t[2]:(i=(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":e,children:r}),t[1]=n.loading,t[2]=i),i}if(i.length===0){let e;return t[3]===n.empty?e=t[4]:(e=(0,K.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:n.empty}),t[3]=n.empty,t[4]=e),e}if(a.length===0){let e;return t[5]===n.noSearchResults?e=t[6]:(e=(0,K.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:n.noSearchResults}),t[5]=n.noSearchResults,t[6]=e),e}let S;t[7]!==o||t[8]!==s||t[9]!==m||t[10]!==u||t[11]!==n?(S=o.length>1?(0,K.jsx)(W,{items:[{id:``,label:n.marketplaceCategoryAll},...o.map(e=>({id:e,label:m(e),title:m(e)}))],activeTab:s,onChange:u,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-builtin-category-tab`,className:`gap-2 pt-0.5 [scrollbar-width:thin]`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):null,t[7]=o,t[8]=s,t[9]=m,t[10]=u,t[11]=n,t[12]=S):S=t[12];let C;t[13]!==d||t[14]!==f||t[15]!==v||t[16]!==y||t[17]!==g||t[18]!==p||t[19]!==n||t[20]!==h||t[21]!==x||t[22]!==b?(C=d.length===0?(0,K.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:f===`disabled`?n.noDisabledSkills:n.noSearchResults}):(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:d.map(e=>{let t=p(e);return(0,K.jsxs)(`article`,{className:l(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors`,t?`hover:bg-surface-hover`:`bg-amber-50/30 hover:bg-amber-50/50 dark:bg-amber-950/20`),children:[(0,K.jsx)(`button`,{type:`button`,className:l(`flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,_.focusRingPanel),"aria-labelledby":`catalog-skill-title-${e.directoryId}`,onClick:()=>void g(e),children:(0,K.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsx)(`h3`,{id:`catalog-skill-title-${e.directoryId}`,className:`min-w-0 flex-1 truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),(0,K.jsxs)(`span`,{className:l(`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium`,t?`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`border-amber-500/30 bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:[t?(0,K.jsx)(R,{className:`size-3`,"aria-hidden":!0}):(0,K.jsx)(c,{className:`size-3`,"aria-hidden":!0}),t?n.statusEnabled:n.statusDisabled]})]}),(0,K.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,K.jsx)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:h(e.source)}),e.managed?(0,K.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[n.col.managed,`: `,n.yes]}):null,e.hub?(0,K.jsxs)(`span`,{className:`max-w-full break-all rounded-md bg-surface-hover/60 px-2 py-0.5 font-mono text-[10px] leading-snug dark:bg-surface-active/50 line-clamp-2`,title:`${e.hub.source}${e.hub.ref?`\nref: ${e.hub.ref}`:``}\nupdated: ${e.hub.updatedAt}`,children:[n.hubRemote,` ·`,` `,e.hub.kind===`git`?n.hubKindGit:n.hubKindArchive,` ·`,` `,e.hub.source.length>48?`${e.hub.source.slice(0,48)}…`:e.hub.source]}):null]})]})})}),(0,K.jsx)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:t?(0,K.jsx)(T,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:b===e.name||x===e.name,onClick:()=>void y({name:e.name,source:`catalog`}),children:b===e.name?n.previewUseInChatBusy:n.previewUseInChat}):(0,K.jsx)(T,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:x===e.name,onClick:()=>void v(e.name,!0),children:x===e.name?n.uploading:n.detailModalEnable})})]},`${e.directoryId}-${e.path}`)})}),t[13]=d,t[14]=f,t[15]=v,t[16]=y,t[17]=g,t[18]=p,t[19]=n,t[20]=h,t[21]=x,t[22]=b,t[23]=C):C=t[23];let w;return t[24]!==S||t[25]!==C?(w=(0,K.jsxs)(K.Fragment,{children:[S,C]}),t[24]=S,t[25]=C,t[26]=w):w=t[26],w}function le(e){return(0,K.jsx)(Y,{},e)}var ue=`https://skillhub.cn`,de=`https://clawhub.ai`;function fe(e){let t=e.trim();return t?`${ue}/skills/${encodeURIComponent(t)}`:null}function Q(e){let t=e.trim();return t?`${de}/${encodeURIComponent(t)}`:null}function pe(e,t){return e===`skillhub`?fe(t):e===`clawhub`?Q(t):null}function me(e,t){return t===`store`?e.name.trim()||e.id:e.id.trim()||e.name}function he(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function ge(e){let t=[e.kind];return e.label?.trim()&&t.push(e.label.trim()),e.package?.trim()&&t.push(e.package.trim()),e.formula?.trim()&&t.push(e.formula.trim()),e.module?.trim()&&t.push(e.module.trim()),e.url?.trim()&&t.push(e.url.trim()),t.join(` · `)}function _e(e){return{...e,enabled:e.enabled??!0,disableModelInvocation:e.disableModelInvocation??!1}}function ve(e){let t=(0,ne.c)(32),{sk:n,confirmOpen:r,setConfirmOpen:i,confirmId:a,setConfirmId:o,runDelete:s}=e,c;t[0]!==o||t[1]!==i?(c=e=>{i(e),e||o(null)},t[0]=o,t[1]=i,t[2]=c):c=t[2];let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsx)(ee,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[3]=l):l=t[3];let u;t[4]===n.deleteTitle?u=t[5]:(u=(0,K.jsx)(j,{className:`text-base font-semibold text-fg`,children:n.deleteTitle}),t[4]=n.deleteTitle,t[5]=u);let d;t[6]!==a||t[7]!==n.deleteMessage?(d=a?he(n.deleteMessage,{id:a}):``,t[6]=a,t[7]=n.deleteMessage,t[8]=d):d=t[8];let f;t[9]===d?f=t[10]:(f=(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:d}),t[9]=d,t[10]=f);let p;t[11]===i?p=t[12]:(p=()=>i(!1),t[11]=i,t[12]=p);let m;t[13]!==n.cancel||t[14]!==p?(m=(0,K.jsx)(T,{type:`button`,variant:`secondary`,onClick:p,children:n.cancel}),t[13]=n.cancel,t[14]=p,t[15]=m):m=t[15];let h;t[16]===s?h=t[17]:(h=()=>void s(),t[16]=s,t[17]=h);let g;t[18]!==n.deleteConfirm||t[19]!==h?(g=(0,K.jsx)(T,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:h,children:n.deleteConfirm}),t[18]=n.deleteConfirm,t[19]=h,t[20]=g):g=t[20];let _;t[21]!==m||t[22]!==g?(_=(0,K.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[m,g]}),t[21]=m,t[22]=g,t[23]=_):_=t[23];let v;t[24]!==_||t[25]!==u||t[26]!==f?(v=(0,K.jsxs)(x,{children:[l,(0,K.jsxs)(y,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,children:[u,f,_]})]}),t[24]=_,t[25]=u,t[26]=f,t[27]=v):v=t[27];let b;return t[28]!==r||t[29]!==c||t[30]!==v?(b=(0,K.jsx)(O,{open:r,onOpenChange:c,children:v}),t[28]=r,t[29]=c,t[30]=v,t[31]=b):b=t[31],b}var ye=[{light:`bg-sky-100 text-sky-800`,dark:`dark:bg-sky-950/55 dark:text-sky-200`},{light:`bg-violet-100 text-violet-800`,dark:`dark:bg-violet-950/55 dark:text-violet-200`},{light:`bg-emerald-100 text-emerald-800`,dark:`dark:bg-emerald-950/55 dark:text-emerald-200`},{light:`bg-orange-100 text-orange-800`,dark:`dark:bg-orange-950/55 dark:text-orange-200`},{light:`bg-rose-100 text-rose-800`,dark:`dark:bg-rose-950/55 dark:text-rose-200`},{light:`bg-amber-100 text-amber-900`,dark:`dark:bg-amber-950/55 dark:text-amber-200`},{light:`bg-cyan-100 text-cyan-800`,dark:`dark:bg-cyan-950/55 dark:text-cyan-200`},{light:`bg-indigo-100 text-indigo-800`,dark:`dark:bg-indigo-950/55 dark:text-indigo-200`},{light:`bg-fuchsia-100 text-fuchsia-800`,dark:`dark:bg-fuchsia-950/55 dark:text-fuchsia-200`},{light:`bg-teal-100 text-teal-800`,dark:`dark:bg-teal-950/55 dark:text-teal-200`}];function be(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n)|0;return Math.abs(t)}function xe(e){let t=e.trim();if(!t)return`?`;let n=t.match(/[\p{L}\p{N}]/u);return n?n[0].toLocaleUpperCase(`en-US`):t[0]}function Se(e){let t=(0,ne.c)(9),{name:n,className:r}=e,i;t[0]===n?i=t[1]:(i=xe(n),t[0]=n,t[1]=i);let a=i,o=ye[be(n)%ye.length],s;t[2]!==r||t[3]!==o.dark||t[4]!==o.light?(s=l(`flex size-11 shrink-0 items-center justify-center rounded-xl font-semibold tracking-tight shadow-surface`,`text-[1.05rem] ring-1 ring-inset ring-black/[0.06] dark:ring-white/[0.1]`,`transition-[transform,box-shadow] duration-200 ease-out group-hover:ring-black/[0.1] dark:group-hover:ring-white/[0.14]`,`group-hover:-translate-y-px`,o.light,o.dark,r),t[2]=r,t[3]=o.dark,t[4]=o.light,t[5]=s):s=t[5];let c;return t[6]!==a||t[7]!==s?(c=(0,K.jsx)(`div`,{className:s,"aria-hidden":!0,children:a}),t[6]=a,t[7]=s,t[8]=c):c=t[8],c}function Ce(e){let t=(0,ne.c)(7),{label:n,children:r}=e;if(r==null||r===!1)return null;let i;t[0]===n?i=t[1]:(i=(0,K.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,K.jsx)(`div`,{className:`mt-1.5 min-w-0 text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,K.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3 dark:border-edge/60`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function we(e){let t=(0,ne.c)(118),{preview:n,sk:r}=e,i=n.metadata,a=n.toolConditions,o=!!a&&(a.requiresTools.length>0||a.requiresToolsets.length>0||a.fallbackForTools.length>0||a.fallbackForToolsets.length>0),s=i.requires,c=s&&((s.bins?.length??0)>0||(s.env?.length??0)>0||(s.anyBins?.length??0)>0),u,d,f,p,m,h,g,_,v,y,b,x,S,C,w;if(t[0]!==a||t[1]!==c||t[2]!==o||t[3]!==i.emoji||t[4]!==i.homepage||t[5]!==i.install||t[6]!==i.os||t[7]!==n.description||t[8]!==n.disableModelInvocation||t[9]!==n.requiredEnvVarNames||t[10]!==s||t[11]!==r.detailEnvVarsLabel||t[12]!==r.detailHomepageLabel||t[13]!==r.detailInstallLabel||t[14]!==r.detailNotInjectedNote||t[15]!==r.detailPlatformsLabel||t[16]!==r.detailRequiresAnyBins||t[17]!==r.detailRequiresBins||t[18]!==r.detailRequiresEnv||t[19]!==r.detailRequiresLabel||t[20]!==r.detailSummaryHeading||t[21]!==r.detailToolGatingLabel||t[22]!==r.detailToolsFallbackList||t[23]!==r.detailToolsRequiresList||t[24]!==r.detailToolsetsFallbackList||t[25]!==r.detailToolsetsRequiresList){let e=i.install?.filter(De)??[],T=n.requiredEnvVarNames?.filter(Ee)??[];g=`space-y-6`,m=`skill-detail-summary-heading`,t[41]===r.detailSummaryHeading?h=t[42]:(h=(0,K.jsx)(`h3`,{id:`skill-detail-summary-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:r.detailSummaryHeading}),t[41]=r.detailSummaryHeading,t[42]=h),v=`rounded-xl border border-edge bg-surface-base px-4 py-3 dark:bg-surface-hover/25`,t[43]===i.emoji?y=t[44]:(y=i.emoji?.trim()?(0,K.jsx)(`p`,{className:`text-2xl leading-none`,"aria-hidden":!0,children:i.emoji.trim()}):null,t[43]=i.emoji,t[44]=y);let E;t[45]===i.emoji?E=t[46]:(E=i.emoji?.trim()?`mt-2`:``,t[45]=i.emoji,t[46]=E);let D;t[47]===E?D=t[48]:(D=l(`text-sm leading-relaxed text-fg`,E),t[47]=E,t[48]=D),t[49]!==n.description||t[50]!==D?(b=(0,K.jsx)(`p`,{className:D,children:n.description}),t[49]=n.description,t[50]=D,t[51]=b):b=t[51],t[52]!==n.disableModelInvocation||t[53]!==r.detailNotInjectedNote?(x=n.disableModelInvocation?(0,K.jsx)(`p`,{className:`mt-3 rounded-lg border border-amber-200/80 bg-amber-50/90 px-3 py-2 text-xs leading-snug text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100`,children:r.detailNotInjectedNote}):null,t[52]=n.disableModelInvocation,t[53]=r.detailNotInjectedNote,t[54]=x):x=t[54];let O;t[55]===i.homepage?O=t[56]:(O=i.homepage?.trim()?(0,K.jsx)(`a`,{href:i.homepage.trim(),target:`_blank`,rel:`noopener noreferrer`,className:`break-all text-accent underline-offset-2 hover:underline`,children:i.homepage.trim()}):null,t[55]=i.homepage,t[56]=O),t[57]!==r.detailHomepageLabel||t[58]!==O?(S=(0,K.jsx)(Ce,{label:r.detailHomepageLabel,children:O}),t[57]=r.detailHomepageLabel,t[58]=O,t[59]=S):S=t[59];let k;t[60]===i.os?k=t[61]:(k=i.os&&i.os.length>0?(0,K.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:i.os.join(`, `)}):null,t[60]=i.os,t[61]=k),t[62]!==r.detailPlatformsLabel||t[63]!==k?(C=(0,K.jsx)(Ce,{label:r.detailPlatformsLabel,children:k}),t[62]=r.detailPlatformsLabel,t[63]=k,t[64]=C):C=t[64];let A;t[65]!==c||t[66]!==s||t[67]!==r.detailRequiresAnyBins||t[68]!==r.detailRequiresBins||t[69]!==r.detailRequiresEnv?(A=c&&s?(0,K.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[s.bins&&s.bins.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresBins,`: `]}),s.bins.join(`, `)]}):null,s.env&&s.env.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresEnv,`: `]}),(0,K.jsx)(`span`,{className:`font-mono text-xs`,children:s.env.join(`, `)})]}):null,s.anyBins&&s.anyBins.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresAnyBins,`: `]}),s.anyBins.join(`, `)]}):null]}):null,t[65]=c,t[66]=s,t[67]=r.detailRequiresAnyBins,t[68]=r.detailRequiresBins,t[69]=r.detailRequiresEnv,t[70]=A):A=t[70],t[71]!==r.detailRequiresLabel||t[72]!==A?(w=(0,K.jsx)(Ce,{label:r.detailRequiresLabel,children:A}),t[71]=r.detailRequiresLabel,t[72]=A,t[73]=w):w=t[73];let j=e.length>0?(0,K.jsx)(`ul`,{className:`list-inside list-decimal space-y-1.5 text-sm text-fg-muted`,children:e.map(Te)}):null;t[74]!==r.detailInstallLabel||t[75]!==j?(f=(0,K.jsx)(Ce,{label:r.detailInstallLabel,children:j}),t[74]=r.detailInstallLabel,t[75]=j,t[76]=f):f=t[76];let M;t[77]!==a||t[78]!==o||t[79]!==r.detailToolsFallbackList||t[80]!==r.detailToolsRequiresList||t[81]!==r.detailToolsetsFallbackList||t[82]!==r.detailToolsetsRequiresList?(M=o&&a?(0,K.jsxs)(`ul`,{className:`mt-1 space-y-2 text-sm text-fg-muted`,children:[a.requiresTools.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsRequiresList,`: `]}),a.requiresTools.join(`, `)]}):null,a.requiresToolsets.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsRequiresList,`: `]}),a.requiresToolsets.join(`, `)]}):null,a.fallbackForTools.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsFallbackList,`: `]}),a.fallbackForTools.join(`, `)]}):null,a.fallbackForToolsets.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsFallbackList,`: `]}),a.fallbackForToolsets.join(`, `)]}):null]}):null,t[77]=a,t[78]=o,t[79]=r.detailToolsFallbackList,t[80]=r.detailToolsRequiresList,t[81]=r.detailToolsetsFallbackList,t[82]=r.detailToolsetsRequiresList,t[83]=M):M=t[83],t[84]!==r.detailToolGatingLabel||t[85]!==M?(p=(0,K.jsx)(Ce,{label:r.detailToolGatingLabel,children:M}),t[84]=r.detailToolGatingLabel,t[85]=M,t[86]=p):p=t[86],u=Ce,d=r.detailEnvVarsLabel,_=T.length>0?(0,K.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:T.join(`, `)}):null,t[0]=a,t[1]=c,t[2]=o,t[3]=i.emoji,t[4]=i.homepage,t[5]=i.install,t[6]=i.os,t[7]=n.description,t[8]=n.disableModelInvocation,t[9]=n.requiredEnvVarNames,t[10]=s,t[11]=r.detailEnvVarsLabel,t[12]=r.detailHomepageLabel,t[13]=r.detailInstallLabel,t[14]=r.detailNotInjectedNote,t[15]=r.detailPlatformsLabel,t[16]=r.detailRequiresAnyBins,t[17]=r.detailRequiresBins,t[18]=r.detailRequiresEnv,t[19]=r.detailRequiresLabel,t[20]=r.detailSummaryHeading,t[21]=r.detailToolGatingLabel,t[22]=r.detailToolsFallbackList,t[23]=r.detailToolsRequiresList,t[24]=r.detailToolsetsFallbackList,t[25]=r.detailToolsetsRequiresList,t[26]=u,t[27]=d,t[28]=f,t[29]=p,t[30]=m,t[31]=h,t[32]=g,t[33]=_,t[34]=v,t[35]=y,t[36]=b,t[37]=x,t[38]=S,t[39]=C,t[40]=w}else u=t[26],d=t[27],f=t[28],p=t[29],m=t[30],h=t[31],g=t[32],_=t[33],v=t[34],y=t[35],b=t[36],x=t[37],S=t[38],C=t[39],w=t[40];let T;t[87]!==u||t[88]!==d||t[89]!==_?(T=(0,K.jsx)(u,{label:d,children:_}),t[87]=u,t[88]=d,t[89]=_,t[90]=T):T=t[90];let E;t[91]!==f||t[92]!==p||t[93]!==T||t[94]!==v||t[95]!==y||t[96]!==b||t[97]!==x||t[98]!==S||t[99]!==C||t[100]!==w?(E=(0,K.jsxs)(`div`,{className:v,children:[y,b,x,S,C,w,f,p,T]}),t[91]=f,t[92]=p,t[93]=T,t[94]=v,t[95]=y,t[96]=b,t[97]=x,t[98]=S,t[99]=C,t[100]=w,t[101]=E):E=t[101];let D;t[102]!==m||t[103]!==h||t[104]!==E?(D=(0,K.jsxs)(`section`,{"aria-labelledby":m,children:[h,E]}),t[102]=m,t[103]=h,t[104]=E,t[105]=D):D=t[105];let O;t[106]===r.detailInstructionsHeading?O=t[107]:(O=(0,K.jsx)(`h3`,{id:`skill-detail-instructions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:r.detailInstructionsHeading}),t[106]=r.detailInstructionsHeading,t[107]=O);let k;t[108]!==n.bodyMarkdown||t[109]!==r.detailNoInstructionsBody?(k=n.bodyMarkdown.trim()?(0,K.jsx)(`div`,{className:`markdown-content min-w-0 break-words`,children:(0,K.jsx)(z,{content:n.bodyMarkdown})}):(0,K.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:r.detailNoInstructionsBody}),t[108]=n.bodyMarkdown,t[109]=r.detailNoInstructionsBody,t[110]=k):k=t[110];let A;t[111]!==O||t[112]!==k?(A=(0,K.jsxs)(`section`,{"aria-labelledby":`skill-detail-instructions-heading`,children:[O,k]}),t[111]=O,t[112]=k,t[113]=A):A=t[113];let j;return t[114]!==g||t[115]!==D||t[116]!==A?(j=(0,K.jsxs)(`div`,{className:g,children:[D,A]}),t[114]=g,t[115]=D,t[116]=A,t[117]=j):j=t[117],j}function Te(e,t){return(0,K.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:(0,K.jsx)(`span`,{className:`text-fg`,children:ge(e)})},e.id||`${e.kind}-${t}`)}function Ee(e){return e.trim()}function De(e){return e&&typeof e.kind==`string`}var Oe=[{id:`s0`,width:`w-[92%]`},{id:`s1`,width:`w-full`},{id:`s2`,width:`w-4/5`},{id:`s3`,width:`w-[92%]`},{id:`s4`,width:`w-full`},{id:`s5`,width:`w-4/5`},{id:`s6`,width:`w-[92%]`},{id:`s7`,width:`w-full`},{id:`s8`,width:`w-4/5`},{id:`s9`,width:`w-[92%]`}];function ke(e){let t=(0,ne.c)(81),{sk:n,detailOpen:r,setDetailOpen:i,detailSource:a,setDetailSource:o,detailTitle:s,setDetailTitle:c,detailCatalogPreview:u,setDetailCatalogPreview:d,detailMarketplacePreview:f,setDetailMarketplacePreview:p,detailLoading:m,detailError:h,setDetailError:g,detailEnabled:v,detailDirectoryId:w,detailManaged:E,detailExternalUrl:D,usingSkillInChatName:k,installingMarketName:N,togglingSkillName:P,isSkillInstalledByName:F,onUseSkillInChat:I,onMarketInstall:R,onSkillToggle:z,setConfirmId:B,setConfirmOpen:V}=e,H;t[0]!==d||t[1]!==g||t[2]!==p||t[3]!==i||t[4]!==o||t[5]!==c?(H=e=>{i(e),e||(o(`catalog`),d(null),p(null),g(null),c(``))},t[0]=d,t[1]=g,t[2]=p,t[3]=i,t[4]=o,t[5]=c,t[6]=H):H=t[6];let U;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,K.jsx)(ee,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[7]=U):U=t[7];let W;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(W=l(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(88vh,44rem)] max-h-[min(92vh,56rem)] w-[min(100%-2rem,min(92vw,56rem))]`,`-translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),t[8]=W):W=t[8];let te=s||`?`,G;t[9]===te?G=t[10]:(G=(0,K.jsx)(Se,{name:te}),t[9]=te,t[10]=G);let re=s||`—`,q;t[11]===re?q=t[12]:(q=(0,K.jsx)(j,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:re}),t[11]=re,t[12]=q);let J;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(J=l(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,_.focusRingPanel),t[13]=J):J=t[13];let Y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,K.jsx)(b,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[14]=Y):Y=t[14];let X;t[15]===n.detailCloseAria?X=t[16]:(X=(0,K.jsx)(A,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,className:J,"aria-label":n.detailCloseAria,children:Y})}),t[15]=n.detailCloseAria,t[16]=X);let Z;t[17]!==G||t[18]!==q||t[19]!==X?(Z=(0,K.jsxs)(`div`,{className:`group flex min-h-[3.25rem] shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[G,q,X]}),t[17]=G,t[18]=q,t[19]=X,t[20]=Z):Z=t[20];let ie;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,K.jsx)(L,{className:`mt-0.5 size-4 shrink-0 text-blue-600 dark:text-blue-400`,strokeWidth:1.75,"aria-hidden":!0}),t[21]=ie):ie=t[21];let ae=a===`store`&&f?n.detailModalBanner:a===`store`?n.detailModalBannerStore:n.detailModalBanner,oe;t[22]===ae?oe=t[23]:(oe=(0,K.jsxs)(`div`,{className:`flex min-h-[3.25rem] shrink-0 items-start gap-2 border-b border-blue-200/80 bg-blue-50/95 px-4 py-2.5 text-sm text-fg dark:border-blue-900/50 dark:bg-blue-950/45`,children:[ie,(0,K.jsx)(`p`,{className:`min-w-0 leading-relaxed`,children:ae})]}),t[22]=ae,t[23]=oe);let se;t[24]!==u||t[25]!==v||t[26]!==h||t[27]!==m||t[28]!==f||t[29]!==a||t[30]!==n?(se=(0,K.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto p-4`,children:m?(0,K.jsx)(`div`,{className:`flex h-full min-h-[14rem] flex-col gap-2.5 py-1`,"aria-busy":`true`,"aria-label":n.loading,children:Oe.map(Ae)}):h?(0,K.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:h}):a===`catalog`&&u?(0,K.jsxs)(K.Fragment,{children:[v?null:(0,K.jsxs)(`div`,{className:`mb-4 flex items-start gap-2 rounded-xl border border-amber-200 bg-amber-50 px-3 py-2.5 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-100`,children:[(0,K.jsx)(S,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-300`,strokeWidth:1.75,"aria-hidden":!0}),(0,K.jsx)(`p`,{className:`leading-relaxed`,children:n.detailDisabledNotice})]}),(0,K.jsx)(we,{preview:u,sk:n})]}):a===`store`&&f?(0,K.jsx)(we,{preview:f,sk:n}):(0,K.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:n.detailLoadFailed})}),t[24]=u,t[25]=v,t[26]=h,t[27]=m,t[28]=f,t[29]=a,t[30]=n,t[31]=se):se=t[31];let ce;t[32]!==D||t[33]!==a||t[34]!==n.marketplaceOpenExternal||t[35]!==n.marketplaceOpenExternalAria?(ce=a===`store`&&D?(0,K.jsxs)(`a`,{href:D,target:`_blank`,rel:`noopener noreferrer`,className:l(`inline-flex h-9 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 text-sm font-medium text-fg-muted`,`hover:bg-surface-hover hover:text-fg dark:border-edge`,_.focusRingPanel),"aria-label":n.marketplaceOpenExternalAria,title:n.marketplaceOpenExternal,children:[(0,K.jsx)(C,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,K.jsx)(`span`,{children:n.marketplaceOpenExternal})]}):null,t[32]=D,t[33]=a,t[34]=n.marketplaceOpenExternal,t[35]=n.marketplaceOpenExternalAria,t[36]=ce):ce=t[36];let le;t[37]!==w||t[38]!==E||t[39]!==a||t[40]!==B||t[41]!==V||t[42]!==n.delete?(le=a===`catalog`&&E&&w?(0,K.jsxs)(T,{type:`button`,variant:`ghost`,className:`gap-1.5 text-red-600 hover:bg-red-50 hover:text-red-700 dark:text-red-400 dark:hover:bg-red-950/40 dark:hover:text-red-300`,onClick:()=>{B(w),V(!0)},children:[(0,K.jsx)(M,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),n.delete]}):null,t[37]=w,t[38]=E,t[39]=a,t[40]=B,t[41]=V,t[42]=n.delete,t[43]=le):le=t[43];let ue;t[44]!==ce||t[45]!==le?(ue=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ce,le]}),t[44]=ce,t[45]=le,t[46]=ue):ue=t[46];let de;t[47]!==v||t[48]!==m||t[49]!==a||t[50]!==s||t[51]!==N||t[52]!==F||t[53]!==R||t[54]!==z||t[55]!==I||t[56]!==i||t[57]!==n.cancel||t[58]!==n.detailModalDisable||t[59]!==n.detailModalEnable||t[60]!==n.marketplaceInstall||t[61]!==n.marketplaceReinstall||t[62]!==n.previewUseInChat||t[63]!==n.previewUseInChatBusy||t[64]!==n.uploading||t[65]!==n.useRequiresEnabled||t[66]!==P||t[67]!==k?(de=(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:a===`store`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(T,{type:`button`,variant:`ghost`,onClick:()=>i(!1),children:n.cancel}),(0,K.jsx)(T,{type:`button`,variant:`secondary`,disabled:!s||m||k===s||N===s,onClick:()=>void I(),children:k===s?n.previewUseInChatBusy:n.previewUseInChat}),(0,K.jsx)(T,{type:`button`,variant:F(s)?`secondary`:`primary`,disabled:!s||N===s,onClick:()=>{s&&R(s,{useDetailProvider:!0})},children:N===s?n.uploading:F(s)?n.marketplaceReinstall:n.marketplaceInstall})]}):(0,K.jsxs)(K.Fragment,{children:[v?(0,K.jsx)(T,{type:`button`,variant:`secondary`,disabled:!s||P===s,onClick:()=>{s&&z(s,!1)},children:P===s?n.uploading:n.detailModalDisable}):(0,K.jsx)(T,{type:`button`,variant:`primary`,disabled:!s||P===s,onClick:()=>{s&&z(s,!0)},children:P===s?n.uploading:n.detailModalEnable}),(0,K.jsx)(T,{type:`button`,variant:`secondary`,disabled:!s||!v||m||k===s||P===s,title:v?void 0:n.useRequiresEnabled,onClick:()=>void I(),children:k===s?n.previewUseInChatBusy:n.previewUseInChat})]})}),t[47]=v,t[48]=m,t[49]=a,t[50]=s,t[51]=N,t[52]=F,t[53]=R,t[54]=z,t[55]=I,t[56]=i,t[57]=n.cancel,t[58]=n.detailModalDisable,t[59]=n.detailModalEnable,t[60]=n.marketplaceInstall,t[61]=n.marketplaceReinstall,t[62]=n.previewUseInChat,t[63]=n.previewUseInChatBusy,t[64]=n.uploading,t[65]=n.useRequiresEnabled,t[66]=P,t[67]=k,t[68]=de):de=t[68];let fe;t[69]!==ue||t[70]!==de?(fe=(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-t border-edge px-4 py-3`,children:[ue,de]}),t[69]=ue,t[70]=de,t[71]=fe):fe=t[71];let Q;t[72]!==Z||t[73]!==oe||t[74]!==se||t[75]!==fe?(Q=(0,K.jsxs)(x,{children:[U,(0,K.jsxs)(y,{className:W,children:[Z,oe,se,fe]})]}),t[72]=Z,t[73]=oe,t[74]=se,t[75]=fe,t[76]=Q):Q=t[76];let pe;return t[77]!==r||t[78]!==H||t[79]!==Q?(pe=(0,K.jsx)(O,{open:r,onOpenChange:H,children:Q}),t[77]=r,t[78]=H,t[79]=Q,t[80]=pe):pe=t[80],pe}function Ae(e){return(0,K.jsx)(`div`,{className:l(`h-4 animate-pulse rounded-md bg-surface-hover dark:bg-surface-active/50`,e.width)},e.id)}function je(e){let t=(0,ne.c)(67),{sk:n,installOpen:r,setInstallOpen:i,pendingFile:a,setPendingFile:o,dropActive:s,setDropActive:c,uploading:u,onModalDragOver:d,onModalDragLeave:f,onModalDrop:p,onFileInputChange:m,onInstallSubmit:h}=e,g;t[0]!==c||t[1]!==i||t[2]!==o?(g=e=>{i(e),e||(o(null),c(!1))},t[0]=c,t[1]=i,t[2]=o,t[3]=g):g=t[3];let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,K.jsx)(ee,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[4]=v):v=t[4];let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=l(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] max-h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 overflow-y-auto`,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-float dark:border-edge`),t[5]=S):S=t[5];let C;t[6]===n.installModalTitle?C=t[7]:(C=(0,K.jsx)(j,{className:`text-base font-semibold text-fg`,children:n.installModalTitle}),t[6]=n.installModalTitle,t[7]=C);let w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=l(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,_.focusRingPanel),t[8]=w):w=t[8];let T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,K.jsx)(b,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=T):T=t[9];let E;t[10]===n.installClose?E=t[11]:(E=(0,K.jsx)(`span`,{className:`sr-only`,children:n.installClose}),t[10]=n.installClose,t[11]=E);let D;t[12]!==n.installClose||t[13]!==E?(D=(0,K.jsx)(A,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:w,"aria-label":n.installClose,children:[T,E]})}),t[12]=n.installClose,t[13]=E,t[14]=D):D=t[14];let M;t[15]!==C||t[16]!==D?(M=(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[C,D]}),t[15]=C,t[16]=D,t[17]=M):M=t[17];let N=s?`border-accent bg-accent-soft/60 dark:bg-blue-950/40`:`border-edge bg-surface-base dark:bg-surface-hover/30`,P;t[18]===N?P=t[19]:(P=l(`mt-4 flex min-h-[11rem] cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed px-6 py-12 text-center transition-colors`,N),t[18]=N,t[19]=P);let F;t[20]!==m||t[21]!==n.installModalDropHint||t[22]!==u?(F=(0,K.jsx)(`input`,{type:`file`,accept:`.zip,.md,application/zip,text/markdown`,className:`sr-only`,"aria-label":n.installModalDropHint,disabled:u,onChange:m}),t[20]=m,t[21]=n.installModalDropHint,t[22]=u,t[23]=F):F=t[23];let I;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,K.jsx)(k,{className:`size-12 text-fg-subtle`,strokeWidth:1.25,"aria-hidden":!0}),t[24]=I):I=t[24];let L;t[25]===n.installModalDropHint?L=t[26]:(L=(0,K.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.installModalDropHint}),t[25]=n.installModalDropHint,t[26]=L);let R;t[27]===a?R=t[28]:(R=a?(0,K.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:a.name}):null,t[27]=a,t[28]=R);let z;t[29]!==f||t[30]!==d||t[31]!==p||t[32]!==P||t[33]!==F||t[34]!==L||t[35]!==R?(z=(0,K.jsxs)(`label`,{className:P,onDragLeave:f,onDragOver:d,onDrop:p,children:[F,I,L,R]}),t[29]=f,t[30]=d,t[31]=p,t[32]=P,t[33]=F,t[34]=L,t[35]=R,t[36]=z):z=t[36];let B;t[37]===n.installModalReqTitle?B=t[38]:(B=(0,K.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.installModalReqTitle}),t[37]=n.installModalReqTitle,t[38]=B);let V;t[39]===n.installModalReq1?V=t[40]:(V=(0,K.jsx)(`li`,{children:n.installModalReq1}),t[39]=n.installModalReq1,t[40]=V);let H;t[41]===n.installModalReq2?H=t[42]:(H=(0,K.jsx)(`li`,{children:n.installModalReq2}),t[41]=n.installModalReq2,t[42]=H);let U;t[43]!==V||t[44]!==H?(U=(0,K.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[V,H]}),t[43]=V,t[44]=H,t[45]=U):U=t[45];let W;t[46]!==B||t[47]!==U?(W=(0,K.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[B,U]}),t[46]=B,t[47]=U,t[48]=W):W=t[48];let te=!a||u,G=!a||u?`cursor-not-allowed bg-surface-active text-fg-disabled`:`bg-accent text-white hover:bg-accent-hover`,re;t[49]===G?re=t[50]:(re=l(`mt-6 flex w-full items-center justify-center rounded-xl py-3 text-sm font-semibold`,`transition-colors`,G,_.focusRingPanel),t[49]=G,t[50]=re);let q;t[51]===h?q=t[52]:(q=()=>void h(),t[51]=h,t[52]=q);let J=u?n.uploading:n.installAction,Y;t[53]!==te||t[54]!==re||t[55]!==q||t[56]!==J?(Y=(0,K.jsx)(`button`,{type:`button`,disabled:te,className:re,onClick:q,children:J}),t[53]=te,t[54]=re,t[55]=q,t[56]=J,t[57]=Y):Y=t[57];let X;t[58]!==z||t[59]!==W||t[60]!==Y||t[61]!==M?(X=(0,K.jsxs)(x,{children:[v,(0,K.jsxs)(y,{className:S,children:[M,z,W,Y]})]}),t[58]=z,t[59]=W,t[60]=Y,t[61]=M,t[62]=X):X=t[62];let Z;return t[63]!==r||t[64]!==g||t[65]!==X?(Z=(0,K.jsx)(O,{open:r,onOpenChange:g,children:X}),t[63]=r,t[64]=g,t[65]=X,t[66]=Z):Z=t[66],Z}function Me(e){let t=(0,ne.c)(66),{sk:n,mpCategories:r,mpCategoriesLoading:i,mpCategoriesError:a,mpPayload:o,mpLoading:s,mpError:c,marketCategoryId:u,setMarketCategoryId:d,marketPage:f,setMarketPage:p,isSkillInstalledByName:m,openMarketplaceDetail:h,onMarketInstall:g,installingMarketName:v,onUseSkillInChat:y,usingSkillInChatName:b,searchInputActive:x,searchQuery:S,setSearchQuery:C,registeredProviders:w,marketBrowseProvider:E,setMarketBrowseProvider:D}=e,O=!x,k,A,j;if(t[0]!==v||t[1]!==m||t[2]!==E||t[3]!==u||t[4]!==f||t[5]!==r||t[6]!==a||t[7]!==i||t[8]!==c||t[9]!==s||t[10]!==o||t[11]!==g||t[12]!==y||t[13]!==h||t[14]!==w||t[15]!==x||t[16]!==S||t[17]!==D||t[18]!==d||t[19]!==p||t[20]!==C||t[21]!==O||t[22]!==n.loading||t[23]!==n.marketplaceAuthor||t[24]!==n.marketplaceCategoriesAria||t[25]!==n.marketplaceCategoryAll||t[26]!==n.marketplaceDownloads||t[27]!==n.marketplaceEmpty||t[28]!==n.marketplaceEmptySearch||t[29]!==n.marketplaceEmptySearchClear||t[30]!==n.marketplaceEmptySearchTryProvider||t[31]!==n.marketplaceInstall||t[32]!==n.marketplaceInstalled||t[33]!==n.marketplacePageNext||t[34]!==n.marketplacePagePrev||t[35]!==n.marketplacePageStatus||t[36]!==n.marketplaceVersion||t[37]!==n.previewUseInChat||t[38]!==n.previewUseInChatBusy||t[39]!==n.uploading||t[40]!==b){let e;t[44]===E?e=t[45]:(e=e=>e.id!==E,t[44]=E,t[45]=e);let M=w.filter(e),P=S.trim(),I;t[46]===n.marketplaceCategoryAll?I=t[47]:(I={id:``,label:n.marketplaceCategoryAll},t[46]=n.marketplaceCategoryAll,t[47]=I);let L;t[48]!==r||t[49]!==I?(L=[I,...r.map(Ie)],t[48]=r,t[49]=I,t[50]=L):L=t[50];let z=L;t[51]!==z||t[52]!==u||t[53]!==r.length||t[54]!==i||t[55]!==d||t[56]!==O||t[57]!==n.marketplaceCategoriesAria?(k=O?r.length>0?(0,K.jsx)(W,{items:z,activeTab:u,onChange:d,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-marketplace-category-tab`,className:`min-h-[2.75rem] items-center gap-2 pt-0.5 [scrollbar-width:thin]`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):i?(0,K.jsx)(`div`,{className:`-mx-1 flex min-h-[2.75rem] items-center gap-2 overflow-x-auto px-1 pb-1 pt-0.5 [scrollbar-width:thin]`,"aria-hidden":!0,children:[`p0`,`p1`,`p2`,`p3`,`p4`].map(Fe)}):null:null,t[51]=z,t[52]=u,t[53]=r.length,t[54]=i,t[55]=d,t[56]=O,t[57]=n.marketplaceCategoriesAria,t[58]=k):k=t[58],t[59]!==a||t[60]!==O?(A=O&&a?(0,K.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:a}):null,t[59]=a,t[60]=O,t[61]=A):A=t[61],j=!o&&!c?(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":n.loading,children:oe.map(Pe)}):c&&!o?(0,K.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:c}):o?(0,K.jsxs)(`div`,{className:`relative`,children:[s?(0,K.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":n.loading,children:(0,K.jsx)(B,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,o.items.length===0?(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-3 rounded-2xl border border-dashed border-edge py-12 text-center text-sm text-fg-muted`,children:[(0,K.jsx)(`p`,{className:`px-4`,children:x&&P?he(n.marketplaceEmptySearch,{query:P}):n.marketplaceEmpty}),x?(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[M.map(e=>(0,K.jsx)(T,{type:`button`,variant:`secondary`,className:`h-8 px-3 text-xs`,onClick:()=>D(e.id),children:he(n.marketplaceEmptySearchTryProvider,{provider:e.displayName})},e.id)),(0,K.jsx)(T,{type:`button`,variant:`ghost`,className:`h-8 px-3 text-xs`,onClick:()=>C(``),children:n.marketplaceEmptySearchClear})]}):null]}):(0,K.jsx)(`div`,{className:l(`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,s&&`pointer-events-none opacity-[0.52] motion-reduce:opacity-100`),children:o.items.map(e=>{let t=me(e,e.providerId??E),r=m(t);return(0,K.jsxs)(`article`,{className:l(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-colors hover:bg-surface-hover`),children:[(0,K.jsx)(`button`,{type:`button`,className:l(`flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,_.focusRingPanel),"aria-labelledby":`mp-skill-title-${e.id}`,onClick:()=>void h(t,e.name,e.providerId??void 0),children:(0,K.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsx)(`h3`,{id:`mp-skill-title-${e.id}`,className:`min-w-0 flex-1 truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),r?(0,K.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,K.jsx)(R,{className:`size-3`,"aria-hidden":!0}),n.marketplaceInstalled]}):null]}),(0,K.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,K.jsxs)(`div`,{className:`mt-auto min-h-[2.625rem] space-y-1 text-[11px] leading-snug text-fg-muted`,children:[(0,K.jsxs)(`p`,{className:`line-clamp-1`,title:`${n.marketplaceAuthor}: ${e.author.username} · ${n.marketplaceDownloads}: ${e.downloads}${e.stars!=null&&e.stars>0?` · ★${e.stars}`:``}${r?` · ${n.marketplaceInstalled}`:``}`,children:[(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:n.marketplaceAuthor}),` `,(0,K.jsx)(`span`,{className:`text-fg`,children:e.author.username}),(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,K.jsxs)(`span`,{children:[n.marketplaceDownloads,`: `,e.downloads]}),e.stars!=null&&e.stars>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-fg-muted`,children:[(0,K.jsx)(F,{className:`size-3 shrink-0 text-amber-600 dark:text-amber-400`,strokeWidth:2,"aria-hidden":!0}),e.stars]})]}):null]}),e.latestVersion?(0,K.jsxs)(`p`,{className:`line-clamp-1 min-h-[1.125rem] font-mono text-[10px] text-fg-subtle`,title:`${n.marketplaceVersion}: ${e.latestVersion}`,children:[n.marketplaceVersion,`: `,e.latestVersion]}):null]})]})})}),(0,K.jsx)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:r?(0,K.jsx)(T,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:s||b===t,onClick:()=>void y({name:t,source:`store`,providerOverride:e.providerId??null}),children:b===t?n.previewUseInChatBusy:n.previewUseInChat}):(0,K.jsx)(T,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:s||v===t,onClick:()=>void g(t,{providerOverride:e.providerId??null}),children:v===t?n.uploading:n.marketplaceInstall})})]},e.id)})}),o.items.length>0?(0,K.jsxs)(`div`,{className:`mt-3 flex flex-col items-center justify-between gap-3 sm:flex-row`,children:[(0,K.jsx)(`p`,{className:`text-center text-xs text-fg-muted sm:text-left`,children:he(n.marketplacePageStatus,{page:o.meta.page,totalPages:o.meta.totalPages,total:o.meta.total})}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsxs)(T,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:s||f<=1,"aria-label":n.marketplacePagePrev,onClick:()=>p(Ne),children:[(0,K.jsx)(V,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:n.marketplacePagePrev})]}),(0,K.jsxs)(T,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:s||f>=o.meta.totalPages,"aria-label":n.marketplacePageNext,onClick:()=>p(e=>Math.min(o.meta.totalPages,e+1)),children:[(0,K.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:n.marketplacePageNext}),(0,K.jsx)(N,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})]})]})]}):null]}):null,t[0]=v,t[1]=m,t[2]=E,t[3]=u,t[4]=f,t[5]=r,t[6]=a,t[7]=i,t[8]=c,t[9]=s,t[10]=o,t[11]=g,t[12]=y,t[13]=h,t[14]=w,t[15]=x,t[16]=S,t[17]=D,t[18]=d,t[19]=p,t[20]=C,t[21]=O,t[22]=n.loading,t[23]=n.marketplaceAuthor,t[24]=n.marketplaceCategoriesAria,t[25]=n.marketplaceCategoryAll,t[26]=n.marketplaceDownloads,t[27]=n.marketplaceEmpty,t[28]=n.marketplaceEmptySearch,t[29]=n.marketplaceEmptySearchClear,t[30]=n.marketplaceEmptySearchTryProvider,t[31]=n.marketplaceInstall,t[32]=n.marketplaceInstalled,t[33]=n.marketplacePageNext,t[34]=n.marketplacePagePrev,t[35]=n.marketplacePageStatus,t[36]=n.marketplaceVersion,t[37]=n.previewUseInChat,t[38]=n.previewUseInChatBusy,t[39]=n.uploading,t[40]=b,t[41]=k,t[42]=A,t[43]=j}else k=t[41],A=t[42],j=t[43];let M;return t[62]!==k||t[63]!==A||t[64]!==j?(M=(0,K.jsxs)(K.Fragment,{children:[k,A,j]}),t[62]=k,t[63]=A,t[64]=j,t[65]=M):M=t[65],M}function Ne(e){return Math.max(1,e-1)}function Pe(e){return(0,K.jsx)(J,{},e)}function Fe(e){return(0,K.jsx)(`div`,{className:`h-8 w-[4.5rem] shrink-0 animate-pulse rounded-full bg-surface-hover motion-reduce:animate-none dark:bg-surface-active/50`},e)}function Ie(e){return{id:e.id,label:e.label,title:e.label}}function Le(e){let t=(0,ne.c)(118),{vm:n}=e,{sk:r,hasToken:i,error:a,actionFeedback:o,skillDiagnostics:s,mainTab:c,setMainTab:u,sourceFilter:d,setSourceFilter:f,builtinTabStats:p,userTabStats:m,catalogDisabledCount:h,catalogStatusFilter:g,setCatalogStatusFilter:_,marketSort:v,setMarketSort:y,marketBrowseProvider:b,setMarketBrowseProvider:x,registeredProviders:S,inSettingsShell:C,searchInputActive:w,resultTab:T,setResultTab:E,aggregatedTabCounts:D,aggregatedProviderStatus:O}=n;if(!i){let e;t[0]===n?e=t[1]:(e=(0,K.jsx)(Ue,{vm:n}),t[0]=n,t[1]=e);let i;t[2]===r.needToken?i=t[3]:(i=(0,K.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:r.needToken}),t[2]=r.needToken,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,K.jsxs)(K.Fragment,{children:[e,i]}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}let k=p.total+m.total,A=p.enabled+m.enabled,j=p.total+m.total-p.enabled-m.enabled,M;t[7]!==k||t[8]!==A||t[9]!==j||t[10]!==m.total?(M={total:k,ready:A,needsAttention:j,added:m.total},t[7]=k,t[8]=A,t[9]=j,t[10]=m.total,t[11]=M):M=t[11];let N=M,P;t[12]!==N.total||t[13]!==r.tabInstalled?(P={id:`installed`,label:r.tabInstalled,count:N.total},t[12]=N.total,t[13]=r.tabInstalled,t[14]=P):P=t[14];let F;t[15]===r.tabDiscover?F=t[16]:(F={id:`marketplace`,label:r.tabDiscover},t[15]=r.tabDiscover,t[16]=F);let L;t[17]!==P||t[18]!==F?(L=[P,F],t[17]=P,t[18]=F,t[19]=L):L=t[19];let R=L,z;t[20]===S?z=t[21]:(z=[`all`,...S.map(He)],t[20]=S,t[21]=z);let ee=z,B;t[22]!==O||t[23]!==D||t[24]!==S||t[25]!==r.marketplaceLoadFailed||t[26]!==r.marketplaceResultsTabAll||t[27]!==ee?(B=ee.map(e=>{let t=e===`all`?r.marketplaceResultsTabAll:S.find(t=>t.id===e)?.displayName??e,n=D[e]??0,i=e===`all`?null:O[e];return{id:e,label:t,title:i===`error`?`${t} · ${r.marketplaceLoadFailed}`:void 0,suffix:i===`loading`?(0,K.jsx)(`span`,{className:`inline-block size-1.5 animate-pulse rounded-full bg-fg-muted/60 motion-reduce:animate-none`,"aria-hidden":!0}):i===`error`?(0,K.jsx)(`span`,{className:`inline-block size-1.5 rounded-full bg-red-500`,"aria-hidden":!0}):(0,K.jsx)(`span`,{className:`tabular-nums opacity-70`,children:n})}}),t[22]=O,t[23]=D,t[24]=S,t[25]=r.marketplaceLoadFailed,t[26]=r.marketplaceResultsTabAll,t[27]=ee,t[28]=B):B=t[28];let V=B,H;t[29]===n?H=t[30]:(H=(0,K.jsx)(Ue,{vm:n}),t[29]=n,t[30]=H);let U;t[31]!==o||t[32]!==a?(U=o?(0,K.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:l(`rounded-xl border px-3 py-2 text-sm`,o.kind===`success`?`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200`:`border-red-200 bg-red-50 text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`),children:o.message}):a?(0,K.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:a}):null,t[31]=o,t[32]=a,t[33]=U):U=t[33];let te;t[34]!==r.diagnosticsHint||t[35]!==r.diagnosticsTitle||t[36]!==s?(te=s.length>0?(0,K.jsxs)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-200`,role:`status`,children:[(0,K.jsx)(`div`,{className:`font-medium`,children:he(r.diagnosticsTitle,{count:s.length})}),(0,K.jsx)(`p`,{className:`mt-1 text-xs opacity-80`,children:r.diagnosticsHint}),(0,K.jsx)(`ul`,{className:`mt-1 space-y-1`,children:s.slice(0,3).map(Ve)})]}):null,t[34]=r.diagnosticsHint,t[35]=r.diagnosticsTitle,t[36]=s,t[37]=te):te=t[37];let G;t[38]!==C||t[39]!==n.loading||t[40]!==n.mainTab||t[41]!==n.onReloadClick||t[42]!==n.searchQuery||t[43]!==n.setInstallOpen||t[44]!==n.setPendingFile||t[45]!==n.setSearchQuery||t[46]!==n.sk?(G=C?(0,K.jsx)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4 dark:border-edge-subtle sm:flex-row sm:flex-wrap sm:items-center sm:justify-end`,children:(0,K.jsx)(re,{loading:n.loading,onReloadClick:n.onReloadClick,searchQuery:n.searchQuery,setSearchQuery:n.setSearchQuery,mainTab:n.mainTab,sk:n.sk,setPendingFile:n.setPendingFile,setInstallOpen:n.setInstallOpen})}):null,t[38]=C,t[39]=n.loading,t[40]=n.mainTab,t[41]=n.onReloadClick,t[42]=n.searchQuery,t[43]=n.setInstallOpen,t[44]=n.setPendingFile,t[45]=n.setSearchQuery,t[46]=n.sk,t[47]=G):G=t[47];let q;t[48]!==c||t[49]!==R||t[50]!==u||t[51]!==r.skillsNavAria?(q=(0,K.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,K.jsx)(W,{items:R,activeTab:c,onChange:u,ariaLabel:r.skillsNavAria,tabIdPrefix:`skills-tab`,panelIdPrefix:`skills-panel`,className:`flex-wrap`})}),t[48]=c,t[49]=R,t[50]=u,t[51]=r.skillsNavAria,t[52]=q):q=t[52];let J;t[53]!==h||t[54]!==g||t[55]!==N.added||t[56]!==N.needsAttention||t[57]!==N.ready||t[58]!==c||t[59]!==b||t[60]!==v||t[61]!==S||t[62]!==T||t[63]!==V||t[64]!==w||t[65]!==_||t[66]!==x||t[67]!==y||t[68]!==E||t[69]!==f||t[70]!==r.discoverHeading||t[71]!==r.discoverHint||t[72]!==r.filterAll||t[73]!==r.filterDisabledOnly||t[74]!==r.filterEnabled||t[75]!==r.filterExtra||t[76]!==r.filterGlobal||t[77]!==r.filterInstalled||t[78]!==r.filterWorkspace||t[79]!==r.installedHeading||t[80]!==r.installedHint||t[81]!==r.marketplaceBrowseSwitchAria||t[82]!==r.marketplaceResultsTabsAria||t[83]!==r.marketplaceSortDownloads||t[84]!==r.marketplaceSortLabel||t[85]!==r.marketplaceSortNewest||t[86]!==r.sourceFilterAria||t[87]!==r.statusFilterAria||t[88]!==r.summaryAdded||t[89]!==r.summaryNeedsAttention||t[90]!==r.summaryReady||t[91]!==r.tabBuiltin||t[92]!==d?(J=c===`installed`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h2`,{className:`text-balance text-sm font-semibold text-fg`,children:r.installedHeading}),(0,K.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:r.installedHint})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:[(0,K.jsx)(I,{value:d,placeholder:r.filterAll,ariaLabel:r.sourceFilterAria,options:[{value:`all`,label:r.filterAll},{value:`builtin`,label:r.tabBuiltin},{value:`installed`,label:r.filterInstalled},{value:`workspace`,label:r.filterWorkspace},{value:`global`,label:r.filterGlobal},{value:`extra`,label:r.filterExtra}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>f(e)}),(0,K.jsx)(I,{value:g,placeholder:r.filterAll,ariaLabel:r.statusFilterAria,options:[{value:`all`,label:r.filterAll},{value:`enabled`,label:r.filterEnabled},{value:`disabled`,label:he(r.filterDisabledOnly,{count:h})}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>_(e)})]})]}),(0,K.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,"aria-label":r.installedHeading,children:[(0,K.jsxs)(`button`,{type:`button`,className:l(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,g===`enabled`&&`border-emerald-500/40 bg-emerald-500/5`),"aria-pressed":g===`enabled`,onClick:()=>_(Be),children:[(0,K.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-success`,children:N.ready}),(0,K.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryReady})]}),(0,K.jsxs)(`button`,{type:`button`,className:l(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,g===`disabled`&&`border-amber-500/50 bg-amber-500/5`),"aria-pressed":g===`disabled`,onClick:()=>_($),children:[(0,K.jsx)(`div`,{className:l(`text-xl font-semibold tabular-nums`,N.needsAttention>0?`text-warning`:`text-fg`),children:N.needsAttention}),(0,K.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryNeedsAttention})]}),(0,K.jsxs)(`button`,{type:`button`,className:l(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,d===`installed`&&`border-accent/40 bg-accent/5`),"aria-pressed":d===`installed`,onClick:()=>f(ze),children:[(0,K.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-fg`,children:N.added}),(0,K.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryAdded})]})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h2`,{className:`text-balance text-sm font-semibold text-fg`,children:r.discoverHeading}),(0,K.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:r.discoverHint})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:[w?null:(0,K.jsx)(I,{value:b??``,placeholder:r.marketplaceBrowseSwitchAria,ariaLabel:r.marketplaceBrowseSwitchAria,options:S.map(Re),allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:x}),(0,K.jsx)(I,{value:v,placeholder:r.marketplaceSortLabel,ariaLabel:r.marketplaceSortLabel,options:[{value:`downloads`,label:r.marketplaceSortDownloads},{value:`newest`,label:r.marketplaceSortNewest}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>y(e)})]})]}),w?(0,K.jsx)(W,{items:V,activeTab:T,onChange:E,ariaLabel:r.marketplaceResultsTabsAria,tabIdPrefix:`skills-marketplace-results-tab`,panelIdPrefix:`skills-marketplace-results-panel`,className:`min-h-9 gap-1 overflow-x-auto rounded-lg border border-edge bg-surface-panel p-0.5 shadow-surface`,buttonClassName:`rounded-md px-2.5 py-1.5 text-xs`,selectedClassName:`bg-fg text-surface-panel dark:bg-fg dark:text-surface-base`,unselectedClassName:`text-fg-muted hover:text-fg`}):null]}),t[53]=h,t[54]=g,t[55]=N.added,t[56]=N.needsAttention,t[57]=N.ready,t[58]=c,t[59]=b,t[60]=v,t[61]=S,t[62]=T,t[63]=V,t[64]=w,t[65]=_,t[66]=x,t[67]=y,t[68]=E,t[69]=f,t[70]=r.discoverHeading,t[71]=r.discoverHint,t[72]=r.filterAll,t[73]=r.filterDisabledOnly,t[74]=r.filterEnabled,t[75]=r.filterExtra,t[76]=r.filterGlobal,t[77]=r.filterInstalled,t[78]=r.filterWorkspace,t[79]=r.installedHeading,t[80]=r.installedHint,t[81]=r.marketplaceBrowseSwitchAria,t[82]=r.marketplaceResultsTabsAria,t[83]=r.marketplaceSortDownloads,t[84]=r.marketplaceSortLabel,t[85]=r.marketplaceSortNewest,t[86]=r.sourceFilterAria,t[87]=r.statusFilterAria,t[88]=r.summaryAdded,t[89]=r.summaryNeedsAttention,t[90]=r.summaryReady,t[91]=r.tabBuiltin,t[92]=d,t[93]=J):J=t[93];let Y;t[94]!==c||t[95]!==n?(Y=c===`marketplace`?(0,K.jsx)(Me,{...n}):(0,K.jsx)(ce,{...n}),t[94]=c,t[95]=n,t[96]=Y):Y=t[96];let X;t[97]!==q||t[98]!==J||t[99]!==Y?(X=(0,K.jsxs)(`section`,{className:`flex flex-col gap-5`,children:[q,J,Y]}),t[97]=q,t[98]=J,t[99]=Y,t[100]=X):X=t[100];let Z;t[101]!==U||t[102]!==te||t[103]!==G||t[104]!==X?(Z=(0,K.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[U,te,G,X]}),t[101]=U,t[102]=te,t[103]=G,t[104]=X,t[105]=Z):Z=t[105];let ie,ae,oe;t[106]===n?(ie=t[107],ae=t[108],oe=t[109]):(ie=(0,K.jsx)(ke,{...n}),ae=(0,K.jsx)(je,{...n}),oe=(0,K.jsx)(ve,{...n}),t[106]=n,t[107]=ie,t[108]=ae,t[109]=oe);let se;t[110]!==Z||t[111]!==ie||t[112]!==ae||t[113]!==oe?(se=(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[Z,ie,ae,oe]}),t[110]=Z,t[111]=ie,t[112]=ae,t[113]=oe,t[114]=se):se=t[114];let le;return t[115]!==H||t[116]!==se?(le=(0,K.jsxs)(K.Fragment,{children:[H,se]}),t[115]=H,t[116]=se,t[117]=le):le=t[117],le}function Re(e){return{value:e.id,label:e.displayName}}function ze(e){return e===`installed`?`all`:`installed`}function $(e){return e===`disabled`?`all`:`disabled`}function Be(e){return e===`enabled`?`all`:`enabled`}function Ve(e,t){return(0,K.jsxs)(`li`,{className:`truncate`,children:[e.type,`: `,e.message]},`${e.path??e.skillName??`diagnostic`}-${t}`)}function He(e){return e.id}function Ue(e){let t=(0,ne.c)(17),{vm:n}=e,{sk:r,hasToken:i,loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,setPendingFile:u,setInstallOpen:d,inSettingsShell:f}=n,p=D(Ge),m=D(We),h;t[0]!==a||t[1]!==l||t[2]!==o||t[3]!==s||t[4]!==d||t[5]!==u||t[6]!==c||t[7]!==r?(h=(0,K.jsx)(re,{loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,sk:r,setPendingFile:u,setInstallOpen:d}),t[0]=a,t[1]=l,t[2]=o,t[3]=s,t[4]=d,t[5]=u,t[6]=c,t[7]=r,t[8]=h):h=t[8];let g=h,_,v;return t[9]!==m||t[10]!==i||t[11]!==f||t[12]!==p||t[13]!==r.title||t[14]!==g?(_=()=>!i||f?(m(),()=>m()):(p({startExtra:null,main:(0,K.jsx)(`div`,{className:`min-w-0`,children:(0,K.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title})}),end:g}),()=>m()),v=[m,i,f,p,g,r.title],t[9]=m,t[10]=i,t[11]=f,t[12]=p,t[13]=r.title,t[14]=g,t[15]=_,t[16]=v):(_=t[15],v=t[16]),(0,G.useLayoutEffect)(_,v),null}function We(e){return e.clearPageHeader}function Ge(e){return e.setPageHeader}async function Ke(e,t){let n=new FormData;n.append(`file`,e),t.skillId&&n.append(`skillId`,t.skillId),t.overwrite&&n.append(`overwrite`,`true`),n.append(`target`,t.target??`workspace`);let r=d.getState().token,i=new Headers;r&&i.set(`Authorization`,`Bearer ${r}`);let a=await fetch(m(`/api/skills/upload`),{method:`POST`,headers:i,body:n});a.status===401&&d.getState().onUnauthorized();let o=await a.json().catch(()=>({}));if(!a.ok)throw Error(o.error||`HTTP ${a.status}`);if(!o.payload?.skillId)throw Error(`Invalid response`);return o.payload}async function qe(e,t){let n=t?`?target=${encodeURIComponent(t)}`:``,r=await p(m(`/api/skills/${encodeURIComponent(e)}${n}`),{method:`DELETE`});if(!r.ok)throw Error(await g(r))}async function Je(e,t){let n=await p(m(`/api/skills/enabled`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skillName:e,enabled:t})});if(!n.ok)throw Error(await g(n))}function Ye(e,t){t?.trim()&&e.set(`provider`,t.trim())}async function Xe(e){let t=new URLSearchParams;Ye(t,e?.provider);let n=t.toString(),r=await p(m(`/api/skills/marketplace/categories${n?`?${n}`:``}`),{cache:`no-store`});if(!r.ok)throw Error(await g(r));let i=await r.json();if(!i.payload||!Array.isArray(i.payload.items))throw Error(`Invalid response`);return{items:i.payload.items}}async function Ze(e){let t=new URLSearchParams;e.q?.trim()&&t.set(`q`,e.q.trim()),e.page!=null&&t.set(`page`,String(e.page)),e.pageSize!=null&&t.set(`pageSize`,String(e.pageSize)),e.sort&&t.set(`sort`,e.sort),e.category?.trim()&&t.set(`category`,e.category.trim()),Ye(t,e.provider);let n=t.toString(),r=await p(m(`/api/skills/marketplace${n?`?${n}`:``}`),{cache:`no-store`,signal:e.signal});if(!r.ok)throw Error(await g(r));let i=await r.json();if(!i.payload?.items||!i.payload.meta)throw Error(`Invalid response`);return i.payload}async function Qe(e,t){let n=encodeURIComponent(e),r=new URLSearchParams;Ye(r,t?.provider);let i=r.toString(),a=await p(m(`/api/skills/marketplace/packages/${n}${i?`?${i}`:``}`),{cache:`no-store`});if(!a.ok)throw Error(await g(a));let o=(await a.json()).payload;if(!o?.name||!o.skillDocPreview||typeof o.skillDocPreview.name!=`string`||typeof o.skillDocPreview.description!=`string`||typeof o.skillDocPreview.bodyMarkdown!=`string`||typeof o.skillDocPreview.disableModelInvocation!=`boolean`||!o.skillDocPreview.metadata||typeof o.skillDocPreview.metadata!=`object`||typeof o.skillDocPreview.metadata.name!=`string`||typeof o.skillDocPreview.metadata.description!=`string`)throw Error(`Invalid response`);return o}async function $e(e){let t=await p(m(`/api/skills/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:`workspace`,...e})});if(!t.ok)throw Error(await g(t));let n=await t.json();if(!n.payload?.skillId)throw Error(n.error||`Invalid response`);return n.payload}async function et(e){let t=await p(m(`/api/skills/${encodeURIComponent(e)}/content`),{cache:`no-store`});if(!t.ok)throw Error(await g(t));let n=(await t.json()).payload;if(!n||typeof n.name!=`string`||typeof n.description!=`string`||typeof n.bodyMarkdown!=`string`||typeof n.disableModelInvocation!=`boolean`||!n.metadata||typeof n.metadata!=`object`||typeof n.metadata.name!=`string`||typeof n.metadata.description!=`string`)throw Error(`Invalid response`);return n}async function tt(){let e=await p(m(`/api/skills/marketplace/provider`),{cache:`no-store`});if(!e.ok)throw Error(await g(e));let t=await e.json();if(!t.payload?.provider)throw Error(`Invalid response`);return t.payload}async function nt(){let e=await p(m(`/api/skills/marketplace/providers`),{cache:`no-store`});if(!e.ok)throw Error(await g(e));let t=await e.json();if(!t.payload?.providers)throw Error(`Invalid response`);return t.payload}async function rt(t){let n=t.name.toLowerCase();if(n.endsWith(`.zip`))return t;if(n.endsWith(`skill.md`)){let n=(await i(async()=>{let{default:t}=await import(`./jszip.min-DT31yWkU.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([0,1]))).default,r=new n;r.file(`SKILL.md`,await t.arrayBuffer());let a=await r.generateAsync({type:`blob`,compression:`DEFLATE`}),o=t.name.replace(/\.md$/i,``).replace(/\s+/g,`-`)||`skill`;return new File([a],`${o}.zip`,{type:`application/zip`})}throw Error(`invalid`)}function it(){let e=u(f(e=>e.language)).skills,t=!!d(e=>e.token),n=s(),[r,i]=o(),c=r.get(`mprov`)?.trim()||null,[l,p]=(0,G.useState)(!1),[m,g]=(0,G.useState)(null),[_,y]=(0,G.useState)(!1),b=r.get(`q`)??``,x=r.get(`tab`),S=r.get(`source`),C=r.get(`status`),w=X.has(x)?x:`installed`,T=x===`builtin`?`builtin`:x===`user`?`installed`:null,D=Z.has(S)?S:T??`all`,O=ie.has(C)?C:`all`,[k,A]=(0,G.useState)(b),[j]=v(k,250),M=j.trim(),N=k.trim().length>0,P=M.length>0,[F,I]=(0,G.useState)(null),[L,R]=(0,G.useState)(w),[z,ee]=(0,G.useState)(D),[B,V]=(0,G.useState)(``),[U,W]=(0,G.useState)(O),[ne,K]=(0,G.useState)(!1),[re,q]=(0,G.useState)(null),[J,Y]=(0,G.useState)(!1),[oe,ce]=(0,G.useState)(!1),[le,ue]=(0,G.useState)(null),[de,fe]=(0,G.useState)(null),[Q,me]=(0,G.useState)({}),[he,ge]=(0,G.useState)(!1),[ve,ye]=(0,G.useState)(`catalog`),[be,xe]=(0,G.useState)(``),[Se,Ce]=(0,G.useState)(null),[we,Te]=(0,G.useState)(null),[Ee,De]=(0,G.useState)(!1),[Oe,ke]=(0,G.useState)(null),[Ae,je]=(0,G.useState)(`downloads`),[Me,Ne]=(0,G.useState)(1),[Pe,Fe]=(0,G.useState)(null),[Ie,Le]=(0,G.useState)(null),[Re,ze]=(0,G.useState)(``),[$,Be]=(0,G.useState)(()=>c),[Ve,He]=(0,G.useState)(0),[Ue,We]=(0,G.useState)(0),[Ge,Ye]=(0,G.useState)([]),it=(0,G.useRef)(null),at=(0,G.useRef)(c),ot=(0,G.useRef)(null),st=(0,G.useRef)(``),ct=(0,G.useRef)(null),lt=(0,G.useRef)(!1),[ut,dt]=(0,G.useState)({query:``,byProvider:{}}),[ft,pt]=(0,G.useState)(`all`),mt=(0,G.useRef)(0),ht=(0,G.useRef)(M);ht.current!==M&&(ht.current=M,pt(e=>e===`all`?e:`all`));let gt=H(()=>E().then(e=>(Ye(e.diagnostics??[]),e.catalog.map(_e))),[t,Ue],{enabled:t,initial:[],errorData:[]}),{data:_t,loading:vt,setData:yt}=gt,bt=H(async()=>{try{let{providers:e,current:t}=await nt();return{providers:e.map(e=>({id:e.id,displayName:e.displayName})),current:t}}catch{try{return{providers:[],current:(await tt()).provider}}catch{return{providers:[],current:`store`}}}},[t,Ve],{enabled:t,initial:{providers:[],current:null}}),xt=l||vt,St=bt.data.providers;(0,G.useEffect)(()=>{let e=e=>{if(h(e.detail)===`skills`){if(lt.current){lt.current=!1;return}We(e=>e+1)}else He(e=>e+1)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[]);let Ct=r.toString(),wt=(0,G.useRef)(Ct);if(wt.current!==Ct){wt.current=Ct;let e=r.get(`q`)??``,t=r.get(`tab`),n=r.get(`source`),i=r.get(`status`),a=X.has(t)?t:`installed`,o=t===`builtin`?`builtin`:t===`user`?`installed`:null,s=Z.has(n)?n:o??`all`,c=ie.has(i)?i:`all`;A(t=>t===e?t:e),R(e=>e===a?e:a),ee(e=>e===s?e:s),W(e=>e===c?e:c);let l=r.get(`mcat`)??``;ze(a===`marketplace`?e=>e===l?e:l:``)}let Tt=(0,G.useRef)(t);!t&&Tt.current&&(Be(null),it.current=null),Tt.current=t,t&&c&&at.current!==c&&(at.current=c,Be(c)),t&&c==null&&bt.data.current&&bt.data.current!==ot.current&&(ot.current=bt.data.current,Be(e=>e??bt.data.current));let Et=`${M}|${Ae}|${L}|${Re}|${$??``}|${ft}`;st.current!==Et&&(st.current=Et,Ne(1)),L===`marketplace`&&$&&ct.current!=null&&ct.current!==$&&ze(``),ct.current=$;let Dt=H(()=>Ze({page:Me,pageSize:20,sort:Ae,category:Re.trim()||void 0,provider:$}),[t,L,Re,Me,Ae,P,$],{enabled:t&&L===`marketplace`&&!!$&&!P,initial:null,errorData:null});(0,G.useEffect)(()=>{if(!t||!P||L!==`marketplace`||St.length===0)return;let n=++mt.current,r={};for(let e of St)r[e.id]={status:`loading`,rows:[]};dt({query:M,byProvider:r});let i=[],a=[];for(let t of St){let r=new AbortController;i.push(r);let o=window.setTimeout(()=>{r.abort(new DOMException(`Adapter timed out`,`TimeoutError`))},8e3);a.push(o),Ze({provider:t.id,q:M,page:1,pageSize:40,sort:Ae,signal:r.signal}).then(e=>{if(window.clearTimeout(o),n!==mt.current)return;let r=e.items.map(e=>({...e,providerId:t.id}));dt(e=>({...e,byProvider:{...e.byProvider,[t.id]:{status:`ok`,rows:r}}}))}).catch(r=>{if(window.clearTimeout(o),n!==mt.current)return;let i=r instanceof DOMException&&(r.name===`TimeoutError`||r.name===`AbortError`)?e.marketplaceLoadFailed:r instanceof Error?r.message:e.marketplaceLoadFailed;dt(e=>({...e,byProvider:{...e.byProvider,[t.id]:{status:`error`,rows:[],error:i}}}))})}return()=>{for(let e of a)window.clearTimeout(e);for(let e of i)e.abort()}},[t,L,P,M,St,Ae,e.marketplaceLoadFailed]);let Ot=H(()=>Xe({provider:$}).then(e=>e.items),[t,L,$],{enabled:t&&L===`marketplace`&&!!$,initial:[],errorData:[]}),kt=(0,G.useMemo)(()=>{if(!P||ut.query!==M)return[];let e=St.map(e=>({id:e.id,rows:[...ut.byProvider[e.id]?.rows??[]]})),t=[];for(;e.some(e=>e.rows.length>0);)for(let n of e)n.rows.length>0&&t.push(n.rows.shift());let n=new Map;for(let e of t){let t=[(e.id??``).toLowerCase().trim(),(e.name??``).toLowerCase().trim(),(e.author?.username??``).toLowerCase().trim()].join(`|`),r=n.get(t);if(!r){n.set(t,{...e,additionalSources:[]});continue}if(e.providerId&&e.providerId!==r.providerId){let t=r.additionalSources??[];t.some(t=>t.providerId===e.providerId)||(t.push({providerId:e.providerId,sourceLabel:e.sourceLabel}),r.additionalSources=t)}}return Array.from(n.values())},[P,M,ut,St]),At=(0,G.useMemo)(()=>{if(!P)return{};let e={all:kt.length};for(let t of St)e[t.id]=kt.filter(e=>e.providerId===t.id||(e.additionalSources??[]).some(e=>e.providerId===t.id)).length;return e},[P,kt,St]),jt=(0,G.useMemo)(()=>P?ft===`all`?kt:kt.filter(e=>e.providerId===ft||(e.additionalSources??[]).some(e=>e.providerId===ft)):[],[P,kt,ft]),Mt=(0,G.useMemo)(()=>{if(!P)return{};let e={};for(let t of St)e[t.id]=ut.byProvider[t.id]?.status??`loading`;return e},[P,ut,St]),Nt=(0,G.useMemo)(()=>Object.values(Mt).some(e=>e===`loading`),[Mt]),Pt=(0,G.useMemo)(()=>{if(!P)return!1;let e=Object.values(Mt);return e.length>0&&e.every(e=>e===`error`)},[P,Mt]),Ft=(0,G.useMemo)(()=>{if(!P||kt.length===0&&Nt)return null;let e=jt.length,t=(Me-1)*20;return{items:jt.slice(t,t+20),meta:{page:Me,pageSize:20,total:e,totalPages:Math.max(1,Math.ceil(e/20))},provider:ft}},[P,kt,Nt,jt,Me,ft]),It=L===`marketplace`?N?P?Ft:null:Dt.data:null,Lt=L===`marketplace`?N?P?Nt:!0:Dt.loading:!1,Rt=P?Pt?e.marketplaceLoadFailed:null:Dt.error instanceof Error?Dt.error.message:Dt.error?e.marketplaceLoadFailed:null,zt=L===`marketplace`?Ot.data:[],Bt=L===`marketplace`?Ot.loading:!1,Vt=Ot.error instanceof Error?Ot.error.message:Ot.error?e.marketplaceCategoriesFailed:null;Re.trim()&&zt.length>0&&!zt.some(e=>e.id===Re)&&ze(``);let Ht=(0,G.useCallback)(async t=>{let n=t?.silent===!0;n||p(!0),g(null);try{let e=await E();return Ye(e.diagnostics??[]),yt(e.catalog.map(_e)),{ok:!0}}catch(t){let n=t instanceof Error?t.message:e.loadFailed;return g(n),{ok:!1,message:n}}finally{n||p(!1)}},[yt,e.loadFailed]),Ut=!l&&gt.error?gt.error instanceof Error?gt.error.message:e.loadFailed:null,Wt=m??Ut;(0,G.useEffect)(()=>{i(e=>{let t=new URLSearchParams(e);return M?t.set(`q`,M):t.delete(`q`),L===`marketplace`?t.set(`tab`,L):t.delete(`tab`),z===`all`?t.delete(`source`):t.set(`source`,z),L===`installed`&&U!==`all`?t.set(`status`,U):t.delete(`status`),L===`marketplace`&&Re.trim()?t.set(`mcat`,Re.trim()):t.delete(`mcat`),L===`marketplace`&&$?t.set(ae,$):t.delete(ae),t.toString()===e.toString()?e:t},{replace:!0})},[L,Re,$,M,U,i,z]);let Gt=(0,G.useCallback)((e,t,n=5e3)=>{I({kind:e,message:t}),window.setTimeout(()=>I(null),n)},[]),Kt=(0,G.useCallback)(t=>{let n=t.availability;if(!n)return e.installSuccess;let r=n.skillName||n.skillId;if(!n.loaded)return`Skill "${r}" installed, but it was not loaded. Check skill diagnostics.`;if(n.diagnostics.length>0)return`Skill "${r}" installed with ${n.diagnostics.length} diagnostic(s).`;if(n.enabled===!1)return`Skill "${r}" installed but disabled. Enable it before use.`;if(n.availableForDefaultAgent===!1){let e=n.unavailableReason||`unavailable`;return`Skill "${r}" installed but unavailable for agent "${n.defaultAgentId}" (${e}).`}return`Skill "${r}" installed and ready.`},[e.installSuccess]),qt=(0,G.useCallback)(async t=>{ye(`catalog`),ge(!0),xe(t.name),Ce(null),Te(null),ke(null),De(!0);try{let e=await et(t.name);Ce(e),xe(e.name)}catch(t){Ce(null),ke(t instanceof Error?t.message:e.detailLoadFailed)}finally{De(!1)}},[e.detailLoadFailed]),Jt=(0,G.useCallback)(async t=>{let n=t.trim();if(n){ye(`catalog`),ge(!0),xe(n),Ce(null),Te(null),ke(null),De(!0);try{let e=await et(n);Ce(e),xe(e.name)}catch(t){Ce(null),ke(t instanceof Error?t.message:e.detailLoadFailed)}finally{De(!1)}}},[e.detailLoadFailed]),Yt=(0,G.useCallback)(async(t,n,r)=>{let i=r?.trim()||$;if(i){it.current=i,ye(`store`),ge(!0),xe(n?.trim()||t),Ce(null),Te(null),ke(null),De(!0);try{let e=await Qe(t,{provider:i});xe(e.name),Te(e.skillDocPreview)}catch(t){Te(null),ke(t instanceof Error?t.message:e.detailLoadFailed)}finally{De(!1)}}},[$,e.detailLoadFailed]),Xt=(0,G.useCallback)(async(t,n)=>{fe(t),me(e=>({...e,[t]:n})),I(null);try{return await Je(t,n),await Ht({silent:!0}),!0}catch(n){return me(e=>{let{[t]:n,...r}=e;return r}),Gt(`error`,n instanceof Error?n.message:e.skillToggleFailed),!1}finally{fe(null),me(e=>{let{[t]:n,...r}=e;return r})}},[Ht,Gt,e.skillToggleFailed]),Zt=(0,G.useCallback)(async()=>{I(null),p(!0),g(null);try{await te()}catch(t){g(t instanceof Error?t.message:e.reloadFailed),p(!1);return}await Ht()},[Ht,e.reloadFailed]),Qt=(0,G.useMemo)(()=>{let e=k.trim().toLowerCase();return e?_t.filter(t=>[t.name,t.description,t.directoryId,t.path,t.source,t.hub?.source,t.hub?.ref].filter(Boolean).join(` `).toLowerCase().includes(e)):_t},[_t,k]),$t=(0,G.useMemo)(()=>{let e=_t.filter(e=>e.source===`builtin`);return{total:e.length,enabled:e.filter(e=>Q[e.name]??e.enabled).length}},[_t,Q]),en=(0,G.useMemo)(()=>{let e=_t.filter(e=>e.source!==`builtin`);return{total:e.length,enabled:e.filter(e=>Q[e.name]??e.enabled).length}},[_t,Q]),tn=(0,G.useMemo)(()=>be?_t.find(e=>e.name===be):void 0,[_t,be]),nn=tn==null?!0:Q[be]??tn.enabled,rn=tn?.directoryId??null,an=tn?.managed??!1,on=(0,G.useMemo)(()=>ve!==`store`||!be?null:pe(it.current??$,be),[ve,be,$]),sn=(0,G.useMemo)(()=>{let e=Qt;return L===`installed`&&z!==`all`&&(e=z===`installed`?e.filter(e=>e.source!==`builtin`):e.filter(e=>e.source===z)),e},[Qt,L,z]),cn=(0,G.useMemo)(()=>{let e=new Set,t=[];for(let n of sn){let r=n.category;!r||e.has(r)||(e.add(r),t.push(r))}return t.sort((e,t)=>{let n=se.indexOf(e),r=se.indexOf(t);return n>=0&&r>=0?n-r:n>=0?-1:r>=0?1:e.localeCompare(t)})},[sn]),ln=(0,G.useCallback)(t=>e.categoryLabel?.[t]||t,[e.categoryLabel]),un=(0,G.useMemo)(()=>B?sn.filter(e=>e.category===B):sn,[sn,B]);(0,G.useEffect)(()=>{V(``)},[z]);let dn=(0,G.useCallback)(e=>Q[e.name]??e.enabled,[Q]),fn=(0,G.useMemo)(()=>un.filter(e=>!dn(e)).length,[un,dn]),pn=(0,G.useMemo)(()=>{let e=un;return U===`disabled`&&(e=e.filter(e=>!dn(e))),U===`enabled`&&(e=e.filter(e=>dn(e))),[...e].toSorted((e,t)=>{let n=dn(e);return n===dn(t)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})},[un,U,dn]),mn=async t=>{I(null),y(!0),g(null);try{let n;try{n=await rt(t)}catch{g(e.invalidFile),Gt(`error`,e.invalidFile);return}let r=await Ke(n,{overwrite:!0});lt.current=!0,await Ht(),Gt(`success`,Kt(r)),K(!1),q(null),R(`installed`),ee(`installed`),await Jt(r.availability?.skillName||r.skillId)}catch(t){g(t instanceof Error?t.message:e.uploadFailed),Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{y(!1)}},hn=()=>{re&&mn(re)},gn=e=>{let t=e.target.files?.[0];e.target.value=``,t&&q(t)},_n=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.types.includes(`Files`)&&(Y(!0),e.dataTransfer.dropEffect=`copy`)},vn=e=>{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||Y(!1)},yn=e=>{e.preventDefault(),e.stopPropagation(),Y(!1);let t=e.dataTransfer?.files?.[0];t&&q(t)},bn=t=>{switch(t){case`builtin`:return e.source.builtin;case`workspace`:return e.source.workspace;case`global`:return e.source.global;case`extra`:return e.source.extra;default:return t}},xn=async()=>{let t=le,n=he&&ve===`catalog`&&rn===t;if(ce(!1),ue(null),t){I(null);try{await qe(t),lt.current=!0,await Ht(),n&&(ge(!1),ye(`catalog`),xe(``),Ce(null),Te(null),ke(null))}catch(t){g(t instanceof Error?t.message:e.deleteFailed)}}},Sn=(0,G.useCallback)(e=>_t.some(t=>t.name===e),[_t]),Cn=(0,G.useCallback)(async t=>{let r=(t?.name??be).trim();if(!r)return;let i=t?.source??ve;if(i===`catalog`){let e=_t.find(e=>e.name===r);if(e&&!(Q[e.name]??e.enabled))return}I(null);let a=i===`store`&&!Sn(r);Le(r);try{if(a){let e=t?.providerOverride?.trim()||it.current||$;await $e({name:r,overwrite:!1,...e?{provider:e}:{}}),lt.current=!0,await Ht({silent:!0})}ge(!1),n(`/chat/new?skill=${encodeURIComponent(r)}`)}catch(t){Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{Le(null)}},[_t,be,ve,Q,Sn,Ht,n,Gt,e.uploadFailed,$]),wn=(0,G.useCallback)(async(t,n)=>{let r=Sn(t);if(!(r&&!window.confirm(e.marketplaceReinstallConfirm))){I(null),Fe(t);try{let e=n?.providerOverride?.trim()||(n?.useDetailProvider?it.current??$:$),i=await $e({name:t,overwrite:r,...e?{provider:e}:{}});lt.current=!0,await Ht({silent:!0}),Gt(`success`,Kt(i)),R(`installed`),ee(`installed`),await Jt(i.availability?.skillName||i.skillId||t)}catch(t){Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{Fe(null)}}},[Sn,Kt,Ht,$,Jt,Gt,e.marketplaceReinstallConfirm,e.uploadFailed]),{pathname:Tn}=a();return{sk:e,hasToken:t,catalog:_t,loading:xt,error:Wt,uploading:_,searchQuery:k,setSearchQuery:A,actionFeedback:F,skillDiagnostics:Ge,mainTab:L,setMainTab:R,sourceFilter:z,setSourceFilter:ee,builtinCategoryFilter:B,setBuiltinCategoryFilter:V,installOpen:ne,setInstallOpen:K,pendingFile:re,setPendingFile:q,dropActive:J,setDropActive:Y,confirmOpen:oe,setConfirmOpen:ce,confirmId:le,setConfirmId:ue,togglingSkillName:de,enabledOverride:Q,detailOpen:he,setDetailOpen:ge,detailSource:ve,setDetailSource:ye,detailTitle:be,setDetailTitle:xe,detailCatalogPreview:Se,setDetailCatalogPreview:Ce,detailMarketplacePreview:we,setDetailMarketplacePreview:Te,detailLoading:Ee,detailError:Oe,setDetailError:ke,marketSort:Ae,setMarketSort:je,marketPage:Me,setMarketPage:Ne,mpLoading:Lt,mpError:Rt,mpPayload:It,searchActive:P,searchInputActive:N,resultTab:ft,setResultTab:pt,aggregatedTabCounts:At,aggregatedProviderStatus:Mt,aggregatedAllFailed:Pt,installingMarketName:Pe,usingSkillInChatName:Ie,onUseSkillInChat:Cn,marketCategoryId:Re,setMarketCategoryId:ze,mpCategories:zt,mpCategoriesError:Vt,mpCategoriesLoading:Bt,marketBrowseProvider:$,setMarketBrowseProvider:Be,registeredProviders:St,builtinTabStats:$t,userTabStats:en,detailEnabled:nn,detailDirectoryId:rn,detailManaged:an,detailExternalUrl:on,filteredCatalog:sn,builtinCategories:cn,categoryFilteredCatalog:un,catalogDisplayRows:pn,catalogDisabledCount:fn,catalogStatusFilter:U,setCatalogStatusFilter:W,resolveSkillEnabled:dn,inSettingsShell:Tn.startsWith(`/settings/`),categoryLabel:ln,onReloadClick:Zt,openSkillDetail:qt,openMarketplaceDetail:Yt,onSkillToggle:Xt,onInstallSubmit:hn,onFileInputChange:gn,onModalDragOver:_n,onModalDragLeave:vn,onModalDrop:yn,sourceLabel:bn,runDelete:xn,onMarketInstall:wn,isSkillInstalledByName:Sn}}function at(){let e=(0,ne.c)(2),t=it(),n;return e[0]===t?n=e[1]:(n=(0,K.jsx)(Le,{vm:t}),e[0]=t,e[1]=n),n}export{at as SkillsPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./cn-JdwAhgNB.js";import{Is as ee,au as o,bs as s,ds as te,fs as ne,hs as re,us as ie,ys as ae}from"./index-Dfq2laZe.js";var oe=n(),c=e(t(),1),l=r(),se=Array.from({length:24},(e,t)=>t);function ce(e){let t=/^(\d{2}):(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return n>23||r>59?null:{hour:n,minute:r}}function le(){let e=new Date;return{hour:e.getHours(),minute:e.getMinutes()}}function u(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function d(e){let t=(0,oe.c)(80),{value:n,onChange:r,disabled:d,allowEmpty:fe,clearLabel:f,ariaLabel:p,ariaLabelledBy:pe,className:me,triggerClassName:he,id:ge,name:m,minuteStep:_e}=e,h=fe===void 0?!1:fe,ve=_e===void 0?1:_e,g=ce(n),ye=g??le(),[be,xe]=(0,c.useState)(!1),[_,Se]=(0,c.useState)(ye.hour),[v,Ce]=(0,c.useState)(ye.minute),y=(0,c.useRef)([]),we=(0,c.useRef)([]),Te=ie(),Ee=te(),De=Te==="default"?re:ne(Te),Oe=Math.max(1,Math.min(60,Math.round(ve))),ke=Array.from({length:Math.ceil(60/Oe)},(e,t)=>t*Oe).filter(de),b;t[0]===r?b=t[1]:(b=(e,t,n)=>{let i=n===void 0?!1:n;Se(e),Ce(t),r(u(e,t)),i&&xe(!1)},t[0]=r,t[1]=b);let x=b,Ae=ue,S;t[2]===me?S=t[3]:(S=a(`relative min-w-0`,me),t[2]=me,t[3]=S);let C=s,w;t[4]===n?w=t[5]:(w=e=>{if(e){let e=ce(n)??le();Se(e.hour),Ce(e.minute)}xe(e)},t[4]=n,t[5]=w);let T=h&&n&&`pr-9`,E=d&&`cursor-not-allowed opacity-50 hover:border-edge`,D;t[6]!==T||t[7]!==E||t[8]!==he?(D=a(`box-border flex h-10 w-full min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 text-left text-sm text-fg`,`transition-colors hover:border-edge-strong focus-visible:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/20`,T,E,he),t[6]=T,t[7]=E,t[8]=he,t[9]=D):D=t[9];let O;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,l.jsx)(o,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`}),t[10]=O):O=t[10];let k=!g&&`text-fg-subtle`,A;t[11]===k?A=t[12]:(A=a(`tabular-nums`,k),t[11]=k,t[12]=A);let j=g?u(g.hour,g.minute):`--:--`,M;t[13]!==A||t[14]!==j?(M=(0,l.jsx)(`span`,{className:A,children:j}),t[13]=A,t[14]=j,t[15]=M):M=t[15];let N;t[16]!==p||t[17]!==pe||t[18]!==d||t[19]!==ge||t[20]!==M||t[21]!==D?(N=(0,l.jsx)(ae,{asChild:!0,children:(0,l.jsxs)(`button`,{id:ge,type:`button`,disabled:d,"aria-label":p,"aria-labelledby":pe,"aria-haspopup":`listbox`,className:D,children:[O,M]})}),t[16]=p,t[17]=pe,t[18]=d,t[19]=ge,t[20]=M,t[21]=D,t[22]=N):N=t[22];let P=s,F=Ee??void 0,I=s,je=a(De,`w-[18rem] overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`),Me=e=>{e.preventDefault(),requestAnimationFrame(()=>y.current[_]?.focus())},L;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,l.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`}),t[23]=L):L=t[23];let Ne=p??`HH:mm`,R;t[24]===Ne?R=t[25]:(R=(0,l.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[L,Ne]}),t[24]=Ne,t[25]=R);let z;t[26]!==_||t[27]!==v?(z=u(_,v),t[26]=_,t[27]=v,t[28]=z):z=t[28];let B;t[29]===z?B=t[30]:(B=(0,l.jsx)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-fg`,children:z}),t[29]=z,t[30]=B);let V;t[31]!==R||t[32]!==B?(V=(0,l.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle bg-surface-subtle px-3 py-2.5`,children:[R,B]}),t[31]=R,t[32]=B,t[33]=V):V=t[33];let H;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,l.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`HH`}),t[34]=H):H=t[34];let Pe=`${p??`HH:mm`} HH`,Fe=se.map((e,t)=>(0,l.jsx)(`button`,{ref:e=>{y.current[t]=e},type:`button`,role:`option`,"aria-selected":_===e,tabIndex:_===e?0:-1,className:a(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,_===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>x(e,v),onKeyDown:e=>Ae(e,se,_,e=>x(e,v),y),children:String(e).padStart(2,`0`)},e)),U;t[35]!==Pe||t[36]!==Fe?(U=(0,l.jsxs)(`div`,{className:`pr-2`,children:[H,(0,l.jsx)(`div`,{role:`listbox`,"aria-label":Pe,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Fe})]}),t[35]=Pe,t[36]=Fe,t[37]=U):U=t[37];let W;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,l.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`MM`}),t[38]=W):W=t[38];let Ie=`${p??`HH:mm`} MM`,Le=ke.map((e,t)=>(0,l.jsxs)(`button`,{ref:e=>{we.current[t]=e},type:`button`,role:`option`,"aria-selected":v===e,tabIndex:v===e?0:-1,className:a(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,v===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>x(_,e,!0),onKeyDown:e=>Ae(e,ke,v,e=>x(_,e),we),children:[(0,l.jsx)(i,{className:a(`absolute left-0.5 size-3`,v!==e&&`invisible`),"aria-hidden":`true`}),String(e).padStart(2,`0`)]},e)),G;t[39]!==Ie||t[40]!==Le?(G=(0,l.jsx)(`div`,{role:`listbox`,"aria-label":Ie,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Le}),t[39]=Ie,t[40]=Le,t[41]=G):G=t[41];let K;t[42]!==W||t[43]!==G?(K=(0,l.jsxs)(`div`,{className:`pl-2`,children:[W,G]}),t[42]=W,t[43]=G,t[44]=K):K=t[44];let q;t[45]!==U||t[46]!==K?(q=(0,l.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-edge-subtle p-2`,children:[U,K]}),t[45]=U,t[46]=K,t[47]=q):q=t[47];let J;t[48]!==I.Content||t[49]!==je||t[50]!==Me||t[51]!==V||t[52]!==q?(J=(0,l.jsxs)(I.Content,{side:`bottom`,align:`start`,sideOffset:6,collisionPadding:12,className:je,onOpenAutoFocus:Me,children:[V,q]}),t[48]=I.Content,t[49]=je,t[50]=Me,t[51]=V,t[52]=q,t[53]=J):J=t[53];let Y;t[54]!==P.Portal||t[55]!==F||t[56]!==J?(Y=(0,l.jsx)(P.Portal,{container:F,children:J}),t[54]=P.Portal,t[55]=F,t[56]=J,t[57]=Y):Y=t[57];let X;t[58]!==be||t[59]!==N||t[60]!==Y||t[61]!==C.Root||t[62]!==w?(X=(0,l.jsxs)(C.Root,{open:be,onOpenChange:w,children:[N,Y]}),t[58]=be,t[59]=N,t[60]=Y,t[61]=C.Root,t[62]=w,t[63]=X):X=t[63];let Z;t[64]!==h||t[65]!==p||t[66]!==f||t[67]!==d||t[68]!==r||t[69]!==n?(Z=h&&n?(0,l.jsx)(`button`,{type:`button`,disabled:d,"aria-label":f??p,title:f,className:`absolute right-1.5 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30 disabled:pointer-events-none`,onClick:()=>r(``),children:(0,l.jsx)(ee,{className:`size-3.5`,"aria-hidden":`true`})}):null,t[64]=h,t[65]=p,t[66]=f,t[67]=d,t[68]=r,t[69]=n,t[70]=Z):Z=t[70];let Q;t[71]!==d||t[72]!==m||t[73]!==n?(Q=m?(0,l.jsx)(`input`,{type:`hidden`,name:m,value:n,disabled:d}):null,t[71]=d,t[72]=m,t[73]=n,t[74]=Q):Q=t[74];let $;return t[75]!==S||t[76]!==X||t[77]!==Z||t[78]!==Q?($=(0,l.jsxs)(`div`,{className:S,children:[X,Z,Q]}),t[75]=S,t[76]=X,t[77]=Z,t[78]=Q,t[79]=$):$=t[79],$}function ue(e,t,n,r,i){let a=null,ee=Math.max(0,t.indexOf(n));if((e.key===`ArrowDown`||e.key===`ArrowRight`)&&(a=(ee+1)%t.length),(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(a=(ee-1+t.length)%t.length),e.key===`Home`&&(a=0),e.key===`End`&&(a=t.length-1),a===null)return;e.preventDefault();let o=t[a];r(o),i.current?.[a]?.focus()}function de(e){return e<60}export{d as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,l as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-KEk-hTFt.js";import{n as l}from"./locale-store-Dqp9H2Uf.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$s as d,$t as f,Cu as p,Dl as m,Ds as h,Go as g,Gs as _,Gt as v,Ht as y,Is as b,Jo as x,Jt as S,Ko as C,Ks as w,Kt as T,Nc as E,Ns as D,Ou as O,Qt as k,Tl as A,To as j,Uo as M,Ut as N,Vs as P,Wo as F,Wt as I,Xl as L,Xt as R,Yo as z,Ys as B,Yt as V,Zl as H,Zo as U,Zt as W,_u as G,an as ee,cn as te,cs as K,en as ne,fl as re,fn as ie,fu as ae,hn as oe,in as se,lc as q,ln as ce,mn as le,ms as J,nn as ue,on as de,os as fe,pc as pe,ps as me,qo as he,qt as ge,rn as _e,ro as ve,sn as ye,tn as be,tr as xe,un as Se,uu as Ce,vt as we,zc as Te}from"./index-Dfq2laZe.js";import{t as Ee}from"./page-tabs-DyimBUp_.js";import{t as De}from"./time-picker-fqRXpNJV.js";import{t as Oe}from"./connector-logo-CsbegNqi.js";var Y=n(),X=e(t(),1),Z=r();function ke(e){let t=(0,Y.c)(104),{value:n,onChange:r,labels:i,language:a,inputClassName:o}=e,c;t[0]===n.timezone?c=t[1]:(c=()=>le.some(e=>e.value===n.timezone)?``:n.timezone,t[0]=n.timezone,t[1]=c);let[l,u]=(0,X.useState)(c),d;t[2]===n.timezone?d=t[3]:(d=()=>!!n.timezone&&!le.some(e=>e.value===n.timezone),t[2]=n.timezone,t[3]=d);let[f,p]=(0,X.useState)(d),m;t[4]===n.pronouns?m=t[5]:(m=()=>!!n.pronouns&&!ie.some(e=>e.value===n.pronouns),t[4]=n.pronouns,t[5]=m);let[g,_]=(0,X.useState)(m),v;bb0:{if(f){v=`__custom__`;break bb0}v=le.some(e=>e.value===n.timezone)?n.timezone:`__custom__`}let y=v,b;t[6]!==r||t[7]!==n?(b=e=>r({...n,...e}),t[6]=r,t[7]=n,t[8]=b):b=t[8];let x=b,S;t[9]===a?S=t[10]:(S=(e,t)=>a===`zh`?t:e,t[9]=a,t[10]=S);let C=S,w;t[11]===i.callName?w=t[12]:(w=(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:i.callName}),t[11]=i.callName,t[12]=w);let T;t[13]===x?T=t[14]:(T=e=>x({callName:e.target.value}),t[13]=x,t[14]=T);let E;t[15]!==o||t[16]!==i.callNamePlaceholder||t[17]!==T||t[18]!==n.callName?(E=(0,Z.jsx)(`input`,{className:o,value:n.callName,onChange:T,placeholder:i.callNamePlaceholder,autoComplete:`off`}),t[15]=o,t[16]=i.callNamePlaceholder,t[17]=T,t[18]=n.callName,t[19]=E):E=t[19];let D;t[20]!==w||t[21]!==E?(D=(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[w,E]}),t[20]=w,t[21]=E,t[22]=D):D=t[22];let O;t[23]===i.pronouns?O=t[24]:(O=(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:i.pronouns}),t[23]=i.pronouns,t[24]=O);let k=g?`__custom__`:n.pronouns,A;t[25]!==x||t[26]!==n.pronouns?(A=e=>{if(e.target.value===`__custom__`){_(!0),ie.some(e=>e.value===n.pronouns)&&x({pronouns:``});return}_(!1),x({pronouns:e.target.value})},t[25]=x,t[26]=n.pronouns,t[27]=A):A=t[27];let j;t[28]===i.pronounsPlaceholder?j=t[29]:(j=(0,Z.jsx)(K,{value:``,children:i.pronounsPlaceholder}),t[28]=i.pronounsPlaceholder,t[29]=j);let M;t[30]===C?M=t[31]:(M=ie.map(e=>(0,Z.jsx)(K,{value:e.value,children:C(e.labelEn,e.labelZh)},e.value)),t[30]=C,t[31]=M);let N;t[32]===i.custom?N=t[33]:(N=(0,Z.jsx)(K,{value:`__custom__`,children:i.custom}),t[32]=i.custom,t[33]=N);let P;t[34]!==o||t[35]!==k||t[36]!==A||t[37]!==j||t[38]!==M||t[39]!==N?(P=(0,Z.jsxs)(fe,{className:o,value:k,onChange:A,children:[j,M,N]}),t[34]=o,t[35]=k,t[36]=A,t[37]=j,t[38]=M,t[39]=N,t[40]=P):P=t[40];let F;t[41]!==o||t[42]!==i.pronounsPlaceholder||t[43]!==g||t[44]!==x||t[45]!==n.pronouns?(F=g?(0,Z.jsx)(`input`,{className:s(o,`mt-1 text-xs`),value:n.pronouns,onChange:e=>x({pronouns:e.target.value}),placeholder:i.pronounsPlaceholder,autoComplete:`off`}):null,t[41]=o,t[42]=i.pronounsPlaceholder,t[43]=g,t[44]=x,t[45]=n.pronouns,t[46]=F):F=t[46];let I;t[47]!==O||t[48]!==P||t[49]!==F?(I=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[O,P,F]}),t[47]=O,t[48]=P,t[49]=F,t[50]=I):I=t[50];let L;t[51]===i.timezone?L=t[52]:(L=(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[51]=i.timezone,t[52]=L);let R;t[53]===o?R=t[54]:(R=s(o,`min-w-0 flex-1`),t[53]=o,t[54]=R);let z;t[55]===x?z=t[56]:(z=e=>{if(e.target.value===`__custom__`){p(!0);return}p(!1),u(``),x({timezone:e.target.value})},t[55]=x,t[56]=z);let B;t[57]===C?B=t[58]:(B=le.map(e=>(0,Z.jsx)(K,{value:e.value,children:C(e.labelEn,e.labelZh)},e.value)),t[57]=C,t[58]=B);let V;t[59]===i.timezoneCustom?V=t[60]:(V=(0,Z.jsx)(K,{value:`__custom__`,children:i.timezoneCustom}),t[59]=i.timezoneCustom,t[60]=V);let H;t[61]!==R||t[62]!==z||t[63]!==B||t[64]!==V||t[65]!==y?(H=(0,Z.jsxs)(fe,{className:R,value:y,onChange:z,children:[B,V]}),t[61]=R,t[62]=z,t[63]=B,t[64]=V,t[65]=y,t[66]=H):H=t[66];let U;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(U=s(`shrink-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,h.press),t[67]=U):U=t[67];let W;t[68]===x?W=t[69]:(W=()=>{let e=oe();if(!e)return;let t=le.some(t=>t.value===e);p(!t),u(t?``:e),x({timezone:e})},t[68]=x,t[69]=W);let G;t[70]!==i.timezoneDetect||t[71]!==W?(G=(0,Z.jsx)(`button`,{type:`button`,className:U,onClick:W,children:i.timezoneDetect}),t[70]=i.timezoneDetect,t[71]=W,t[72]=G):G=t[72];let ee;t[73]!==H||t[74]!==G?(ee=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[H,G]}),t[73]=H,t[74]=G,t[75]=ee):ee=t[75];let te;t[76]!==l||t[77]!==o||t[78]!==f||t[79]!==x?(te=f?(0,Z.jsx)(`input`,{className:s(o,`mt-1 font-mono text-xs`),value:l,onChange:e=>{u(e.target.value),x({timezone:e.target.value})},placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null,t[76]=l,t[77]=o,t[78]=f,t[79]=x,t[80]=te):te=t[80];let ne;t[81]!==L||t[82]!==ee||t[83]!==te?(ne=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[L,ee,te]}),t[81]=L,t[82]=ee,t[83]=te,t[84]=ne):ne=t[84];let re;t[85]===i.notes?re=t[86]:(re=(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:i.notes}),t[85]=i.notes,t[86]=re);let ae;t[87]===o?ae=t[88]:(ae=s(o,`min-h-28 resize-y text-sm leading-relaxed`),t[87]=o,t[88]=ae);let se;t[89]===x?se=t[90]:(se=e=>x({notes:e.target.value}),t[89]=x,t[90]=se);let q;t[91]!==i.notesPlaceholder||t[92]!==ae||t[93]!==se||t[94]!==n.notes?(q=(0,Z.jsx)(`textarea`,{className:ae,value:n.notes,onChange:se,placeholder:i.notesPlaceholder,rows:5,spellCheck:!0}),t[91]=i.notesPlaceholder,t[92]=ae,t[93]=se,t[94]=n.notes,t[95]=q):q=t[95];let ce;t[96]!==re||t[97]!==q?(ce=(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[re,q]}),t[96]=re,t[97]=q,t[98]=ce):ce=t[98];let J;return t[99]!==D||t[100]!==I||t[101]!==ne||t[102]!==ce?(J=(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[D,I,ne,ce]}),t[99]=D,t[100]=I,t[101]=ne,t[102]=ce,t[103]=J):J=t[103],J}var Ae={"composio-gmail":`gmail`,"composio-googledrive":`google-drive`,"composio-notion":`notion`,"composio-slack":`slack`,memory:`memory`};function je(e){if(e.branding?.logoUrl)return e.branding;let t=Ae[e.id];return t?{...e.branding,logoUrl:`/connector-icons/${t}.svg`}:e.branding}function Me(e){let t=(0,Y.c)(57),{open:n,t:r,onOpenChange:i,onNavigate:a}=e,o;t[0]!==r.helpLearningBody||t[1]!==r.helpLearningTitle?(o={icon:p,title:r.helpLearningTitle,body:r.helpLearningBody},t[0]=r.helpLearningBody,t[1]=r.helpLearningTitle,t[2]=o):o=t[2];let c;t[3]!==r.helpSharingBody||t[4]!==r.helpSharingTitle?(c={icon:P,title:r.helpSharingTitle,body:r.helpSharingBody},t[3]=r.helpSharingBody,t[4]=r.helpSharingTitle,t[5]=c):c=t[5];let l;t[6]!==r.helpSourcesBody||t[7]!==r.helpSourcesTitle?(l={icon:H,title:r.helpSourcesTitle,body:r.helpSourcesBody},t[6]=r.helpSourcesBody,t[7]=r.helpSourcesTitle,t[8]=l):l=t[8];let u;t[9]!==r.helpControlBody||t[10]!==r.helpControlTitle?(u={icon:pe,title:r.helpControlTitle,body:r.helpControlBody},t[9]=r.helpControlBody,t[10]=r.helpControlTitle,t[11]=u):u=t[11];let d;t[12]!==o||t[13]!==c||t[14]!==l||t[15]!==u?(d=[o,c,l,u],t[12]=o,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16];let f=d,m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(he,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,J)}),t[17]=m):m=t[17];let h;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(h=s(`fixed right-3 top-1/2 flex h-[min(44rem,calc(100dvh-1.5rem))] w-[min(30rem,calc(100vw-1.5rem))] -translate-y-1/2 flex-col overflow-hidden`,me,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`),t[18]=h):h=t[18];let _;t[19]===r.helpTitle?_=t[20]:(_=(0,Z.jsx)(z,{className:`text-base font-semibold text-fg`,children:r.helpTitle}),t[19]=r.helpTitle,t[20]=_);let v;t[21]===r.helpSubtitle?v=t[22]:(v=(0,Z.jsx)(C,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.helpSubtitle}),t[21]=r.helpSubtitle,t[22]=v);let y;t[23]!==_||t[24]!==v?(y=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[_,v]}),t[23]=_,t[24]=v,t[25]=y):y=t[25];let S;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(b,{className:`size-4`,"aria-hidden":!0}),t[26]=S):S=t[26];let w;t[27]===r.close?w=t[28]:(w=(0,Z.jsx)(F,{asChild:!0,children:(0,Z.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":r.close,children:S})}),t[27]=r.close,t[28]=w);let T;t[29]!==y||t[30]!==w?(T=(0,Z.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[y,w]}),t[29]=y,t[30]=w,t[31]=T):T=t[31];let E;t[32]===f?E=t[33]:(E=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-2`,children:f.map(Ne)}),t[32]=f,t[33]=E);let O;t[34]!==a||t[35]!==i?(O=()=>{i(!1),a(`sources`)},t[34]=a,t[35]=i,t[36]=O):O=t[36];let k;t[37]!==r.tabs.sources||t[38]!==O?(k=(0,Z.jsx)(D,{type:`button`,variant:`ghost`,onClick:O,children:r.tabs.sources}),t[37]=r.tabs.sources,t[38]=O,t[39]=k):k=t[39];let A;t[40]!==a||t[41]!==i?(A=()=>{i(!1),a(`controls`)},t[40]=a,t[41]=i,t[42]=A):A=t[42];let j;t[43]!==r.openPrivacyControls||t[44]!==A?(j=(0,Z.jsx)(D,{type:`button`,variant:`secondary`,onClick:A,children:r.openPrivacyControls}),t[43]=r.openPrivacyControls,t[44]=A,t[45]=j):j=t[45];let N;t[46]!==k||t[47]!==j?(N=(0,Z.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[k,j]}),t[46]=k,t[47]=j,t[48]=N):N=t[48];let I;t[49]!==T||t[50]!==E||t[51]!==N?(I=(0,Z.jsxs)(x,{children:[m,(0,Z.jsxs)(g,{className:h,children:[T,E,N]})]}),t[49]=T,t[50]=E,t[51]=N,t[52]=I):I=t[52];let L;return t[53]!==i||t[54]!==n||t[55]!==I?(L=(0,Z.jsx)(M,{open:n,onOpenChange:i,children:I}),t[53]=i,t[54]=n,t[55]=I,t[56]=L):L=t[56],L}function Ne(e){let{icon:t,title:n,body:r}=e;return(0,Z.jsxs)(`section`,{className:`flex gap-3 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,Z.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-muted text-fg-muted`,children:(0,Z.jsx)(t,{className:`size-4`,"aria-hidden":!0})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r})]})]},n)}function Pe(e){let t=(0,Y.c)(33),{source:n,language:r,busy:i,onOpenChange:a,onConfirm:o}=e,l=c(r).you,[u,d]=(0,X.useState)(!1),f=n?.accountLabel??(n?.accountCount&&n.accountCount>1&&n.accountOrdinal?l.sourceAccountFallback.replace(`{{index}}`,String(n.accountOrdinal)).replace(`{{count}}`,String(n.accountCount)):void 0),p,m;t[0]===n?(p=t[1],m=t[2]):(p=()=>{n&&d(!1)},m=[n],t[0]=n,t[1]=p,t[2]=m),(0,X.useEffect)(p,m);let h;t[3]!==i||t[4]!==a?(h=e=>!i&&a(e),t[3]=i,t[4]=a,t[5]=h):h=t[5];let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(he,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[6]=_):_=t[6];let v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(b,{className:`size-4`,"aria-hidden":!0}),t[7]=v):v=t[7];let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>d(!1),t[8]=y):y=t[8];let S=u?`border-edge-subtle hover:bg-surface-hover`:`border-accent/40 bg-accent-soft/35`,T;t[9]===S?T=t[10]:(T=s(`flex w-full items-start gap-3 rounded-xl border p-4 text-left`,S),t[9]=S,t[10]=T);let E;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(H,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[11]=E):E=t[11];let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>d(!0),t[12]=O):O=t[12];let k=u?`border-danger/40 bg-danger-soft`:`border-edge-subtle hover:bg-surface-hover`,A;t[13]===k?A=t[14]:(A=s(`flex w-full items-start gap-3 rounded-xl border p-4 text-left disabled:cursor-not-allowed disabled:opacity-55`,k),t[13]=k,t[14]=A);let j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(B,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),t[15]=j):j=t[15];let N=l.disconnectDeleteBody.replace(`{{count}}`,String(n?.derivedUnderstandingCount??0)),P;t[16]===N?P=t[17]:(P=(0,Z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:N}),t[16]=N,t[17]=P);let I;t[18]!==i||t[19]!==l.cancel?(I=(0,Z.jsx)(F,{asChild:!0,children:(0,Z.jsx)(D,{type:`button`,variant:`ghost`,disabled:i,children:l.cancel})}),t[18]=i,t[19]=l.cancel,t[20]=I):I=t[20];let L=u?`border-danger/35 text-danger hover:bg-danger-soft`:void 0,R;t[21]!==u||t[22]!==o?(R=()=>o(u),t[21]=u,t[22]=o,t[23]=R):R=t[23];let V;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[24]=V):V=t[24];let U=i?l.disconnecting:l.disconnectAction,W;t[25]!==i||t[26]!==L||t[27]!==R||t[28]!==U?(W=(0,Z.jsxs)(D,{type:`button`,variant:`secondary`,className:L,disabled:i,onClick:R,children:[V,U]}),t[25]=i,t[26]=L,t[27]=R,t[28]=U,t[29]=W):W=t[29];let G;return t[30]!==I||t[31]!==W?(G=(0,Z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:[I,W]}),t[30]=I,t[31]=W,t[32]=G):G=t[32],(0,Z.jsx)(M,{open:n!==null,onOpenChange:h,children:(0,Z.jsxs)(x,{children:[_,(0,Z.jsxs)(g,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(31rem,calc(100dvh-2rem))] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(z,{className:`text-base font-semibold text-fg`,children:l.disconnectTitle}),(0,Z.jsx)(C,{className:`mt-1 text-sm text-fg-muted`,children:l.disconnectBody.replace(`{{source}}`,n?.displayName??``)})]}),(0,Z.jsx)(F,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":l.cancel,disabled:i,children:v})})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-5`,children:[(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs leading-5 text-fg-muted`,children:[f?(0,Z.jsx)(`p`,{className:`font-medium text-fg`,children:l.disconnectAccount.replace(`{{account}}`,f)}):null,(0,Z.jsx)(`p`,{children:l.disconnectImpact.replace(`{{items}}`,String(n?.knowledgeItemCount??0)).replace(`{{understandings}}`,String(n?.derivedUnderstandingCount??0))})]}),(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":!u,onClick:y,className:T,children:[E,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectKeepTitle}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:l.disconnectKeepBody})]})]}),(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":u,onClick:O,disabled:!n?.derivedUnderstandingCount,className:A,children:[j,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectDeleteTitle}),P]})]})]}),G]})]})})}var Fe=new Set([`overview`,`profile`,`understanding`,`sources`,`controls`]),Ie=[`collaboration`,`priorities`,`boundaries`,`people`,`current`,`basics`],Le=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/50 focus:ring-2 focus:ring-accent/20`;function Re(e,t){return e.replace(`{{count}}`,String(t))}function ze(e){let t=(0,Y.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`span`,{className:`inline-flex rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function Be(e,t){let n=Date.parse(e);return Number.isFinite(n)?we(n,t):e}function Ve(e){return e===`review`?`understanding`:e===`privacy`?`controls`:e&&Fe.has(e)?e:`overview`}function He(){let e=(0,Y.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(ve,{className:`h-24 rounded-2xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[t,(0,Z.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,Z.jsx)(ve,{className:`h-64 rounded-2xl`}),(0,Z.jsx)(ve,{className:`h-64 rounded-2xl`})]})]}),e[1]=n):n=e[1],n}function Ue(e,t){return e.origin===`connected_source`?t.origins.connected_source.replace(`{{source}}`,e.sourceName):t.origins[e.origin]}function We(e){let t=(0,Y.c)(19),{item:n,language:r,t:i,busy:a,onConfirm:c,onReject:l,onUpdate:u,onForget:d}=e,[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(n.statement),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(!1),x=n.status!==`active`,S=x?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,C;t[0]===S?C=t[1]:(C=s(`rounded-xl border p-3.5`,S),t[0]=S,t[1]=C);let w;t[2]!==a||t[3]!==m||t[4]!==f||t[5]!==g||t[6]!==v||t[7]!==n||t[8]!==r||t[9]!==x||t[10]!==c||t[11]!==d||t[12]!==l||t[13]!==u||t[14]!==i?(w=f?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`textarea`,{className:s(Le,`min-h-20 resize-y`),value:m,onChange:e=>h(e.target.value),placeholder:i.updatePlaceholder}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>{h(n.statement),p(!1)},children:i.cancel}),(0,Z.jsx)(D,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:a||!m.trim(),onClick:()=>{u(m.trim()),p(!1)},children:i.save})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Z.jsx)(q,{className:`size-3 text-accent`,"aria-hidden":!0}),Ue(n,i)]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.stability[n.stability]}),n.evidenceCount>1?(0,Z.jsx)(`span`,{children:Re(i.evidenceCount,n.evidenceCount)}):null,n.latestEvidenceAt?(0,Z.jsx)(`span`,{children:i.observedAt.replace(`{{time}}`,Be(n.latestEvidenceAt,r))}):null]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[x?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:c,children:[(0,Z.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,Z.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:l,children:[(0,Z.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,(0,Z.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>p(!0),children:[(0,Z.jsx)(Te,{className:`size-3.5`,"aria-hidden":!0}),i.change]}),(0,Z.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:v,onClick:()=>{if(g){_(null);return}y(!0),V(n.id).then(e=>_(e.history)).finally(()=>y(!1))},children:[(0,Z.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),i.history]}),(0,Z.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:d,children:[(0,Z.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),i.forget]})]})]}),(0,Z.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer font-medium text-fg-muted`,children:i.viewEvidence}),(0,Z.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),(0,Z.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourceName})]}),n.sourcePath?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidencePath}),(0,Z.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourcePath})]}):null,(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceUpdated}),(0,Z.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Be(n.updatedAt,r)})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSupport}),(0,Z.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Re(i.evidenceCount,n.evidenceCount)})]}),n.confidence===void 0?null:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),(0,Z.jsxs)(`dd`,{className:`mt-0.5 text-fg-muted`,children:[Math.round(n.confidence*100),`%`]})]}),n.validTo?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceValidUntil}),(0,Z.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Be(n.validTo,r)})]}):null,n.expiresAt?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceExpires}),(0,Z.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Be(n.expiresAt,r)})]}):null]})]}),g?(0,Z.jsxs)(`div`,{className:`mt-2 space-y-2 border-t border-edge pt-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.historyTitle}),g.map(e=>(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-xs`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 text-fg-muted`,children:e.statement}),(0,Z.jsx)(`span`,{className:`shrink-0 text-fg-subtle`,children:Be(e.updatedAt,r)})]},e.id))]}):null]}),t[2]=a,t[3]=m,t[4]=f,t[5]=g,t[6]=v,t[7]=n,t[8]=r,t[9]=x,t[10]=c,t[11]=d,t[12]=l,t[13]=u,t[14]=i,t[15]=w):w=t[15];let T;return t[16]!==C||t[17]!==w?(T=(0,Z.jsx)(`article`,{className:C,children:w}),t[16]=C,t[17]=w,t[18]=T):T=t[18],T}function Ge(e){let t=(0,Y.c)(84),{source:n,language:r,t:i,onConfigure:a,onDisconnect:o}=e,c=n.installed?n.enabled?i.connected:i.paused:i.available,l;t[0]!==n.accountCount||t[1]!==n.accountLabel||t[2]!==n.accountOrdinal||t[3]!==i.sourceAccountFallback?(l=n.accountLabel??(n.accountCount&&n.accountCount>1&&n.accountOrdinal?i.sourceAccountFallback.replace(`{{index}}`,String(n.accountOrdinal)).replace(`{{count}}`,String(n.accountCount)):void 0),t[0]=n.accountCount,t[1]=n.accountLabel,t[2]=n.accountOrdinal,t[3]=i.sourceAccountFallback,t[4]=l):l=t[4];let u=l,d;t[5]!==n.lastHealthStatus||t[6]!==i.healthIssue||t[7]!==i.healthOk||t[8]!==i.sourceHealth?(d=n.lastHealthStatus?i.sourceHealth.replace(`{{status}}`,n.lastHealthStatus===`ok`?i.healthOk:i.healthIssue):null,t[5]=n.lastHealthStatus,t[6]=i.healthIssue,t[7]=i.healthOk,t[8]=i.sourceHealth,t[9]=d):d=t[9];let f=d,p=`${i.manageSources}: ${n.displayName}`,m;t[10]===a?m=t[11]:(m=e=>{e.target===e.currentTarget&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),a()))},t[10]=a,t[11]=m);let h=n.displayName,g;t[12]===n?g=t[13]:(g=je(n),t[12]=n,t[13]=g);let _;t[14]!==n.displayName||t[15]!==g?(_=(0,Z.jsx)(Oe,{connector:{displayName:h,branding:g},size:`sm`}),t[14]=n.displayName,t[15]=g,t[16]=_):_=t[16];let v;t[17]===n.displayName?v=t[18]:(v=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.displayName}),t[17]=n.displayName,t[18]=v);let y;t[19]===u?y=t[20]:(y=u?(0,Z.jsx)(`p`,{className:`mt-0.5 truncate text-xs font-medium text-fg-muted`,children:u}):null,t[19]=u,t[20]=y);let b;t[21]===n.description?b=t[22]:(b=(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.description}),t[21]=n.description,t[22]=b);let x;t[23]!==b||t[24]!==v||t[25]!==y?(x=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[v,y,b]}),t[23]=b,t[24]=v,t[25]=y,t[26]=x):x=t[26];let S;t[27]!==x||t[28]!==_?(S=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[_,x]}),t[27]=x,t[28]=_,t[29]=S):S=t[29];let C=n.installed&&n.enabled?`bg-success-soft text-fg`:`bg-surface-hover text-fg-muted`,w;t[30]===C?w=t[31]:(w=s(`shrink-0 rounded-full px-2 py-1 text-[11px] font-medium`,C),t[30]=C,t[31]=w);let T;t[32]!==c||t[33]!==w?(T=(0,Z.jsx)(`span`,{className:w,children:c}),t[32]=c,t[33]=w,t[34]=T):T=t[34];let E;t[35]!==S||t[36]!==T?(E=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[S,T]}),t[35]=S,t[36]=T,t[37]=E):E=t[37];let O;t[38]!==n.access.context||t[39]!==i.sourceContext?(O=n.access.context?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceContext}):null,t[38]=n.access.context,t[39]=i.sourceContext,t[40]=O):O=t[40];let k;t[41]!==n.access.memory||t[42]!==i.sourceMemory?(k=n.access.memory?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceMemory}):null,t[41]=n.access.memory,t[42]=i.sourceMemory,t[43]=k):k=t[43];let A;t[44]!==n.access.read||t[45]!==i.sourceRead?(A=n.access.read?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceRead}):null,t[44]=n.access.read,t[45]=i.sourceRead,t[46]=A):A=t[46];let j;t[47]!==n.access.write||t[48]!==i.sourceWrite?(j=n.access.write?(0,Z.jsx)(`span`,{className:`rounded-full bg-warning-soft px-2 py-0.5 text-fg`,children:i.sourceWrite}):null,t[47]=n.access.write,t[48]=i.sourceWrite,t[49]=j):j=t[49];let M;t[50]!==O||t[51]!==k||t[52]!==A||t[53]!==j?(M=(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[O,k,A,j]}),t[50]=O,t[51]=k,t[52]=A,t[53]=j,t[54]=M):M=t[54];let N;t[55]!==f||t[56]!==r||t[57]!==n.derivedUnderstandingCount||t[58]!==n.installed||t[59]!==n.knowledgeItemCount||t[60]!==n.lastActivityAt||t[61]!==n.lastSyncAt||t[62]!==n.lastSyncError||t[63]!==n.lastSyncStatus||t[64]!==i.sourceDerivedCount||t[65]!==i.sourceKnowledgeCount||t[66]!==i.sourceLastSync||t[67]!==i.sourceLastUsed||t[68]!==i.sourceNeverUsed||t[69]!==i.sourceSyncFailed?(N=n.installed?(0,Z.jsxs)(`div`,{className:`mt-3 space-y-1 border-t border-edge-subtle pt-3 text-xs text-fg-muted`,children:[f?(0,Z.jsx)(`p`,{children:f}):null,(0,Z.jsx)(`p`,{children:n.lastActivityAt?i.sourceLastUsed.replace(`{{time}}`,Be(n.lastActivityAt,r)):i.sourceNeverUsed}),n.lastSyncAt?(0,Z.jsx)(`p`,{children:i.sourceLastSync.replace(`{{time}}`,Be(n.lastSyncAt,r))}):null,n.lastSyncStatus===`failed`&&n.lastSyncError?(0,Z.jsx)(`p`,{className:`text-danger`,children:i.sourceSyncFailed.replace(`{{error}}`,n.lastSyncError)}):null,(0,Z.jsx)(`p`,{children:i.sourceKnowledgeCount.replace(`{{count}}`,String(n.knowledgeItemCount))}),(0,Z.jsx)(`p`,{children:i.sourceDerivedCount.replace(`{{count}}`,String(n.derivedUnderstandingCount))})]}):null,t[55]=f,t[56]=r,t[57]=n.derivedUnderstandingCount,t[58]=n.installed,t[59]=n.knowledgeItemCount,t[60]=n.lastActivityAt,t[61]=n.lastSyncAt,t[62]=n.lastSyncError,t[63]=n.lastSyncStatus,t[64]=i.sourceDerivedCount,t[65]=i.sourceKnowledgeCount,t[66]=i.sourceLastSync,t[67]=i.sourceLastUsed,t[68]=i.sourceNeverUsed,t[69]=i.sourceSyncFailed,t[70]=N):N=t[70];let P;t[71]!==o||t[72]!==n.installed||t[73]!==n.instanceId||t[74]!==i.disconnect?(P=n.installed&&n.instanceId?(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,Z.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-danger hover:bg-danger-soft hover:text-danger`,onClick:e=>{e.stopPropagation(),o()},children:i.disconnect})}):null,t[71]=o,t[72]=n.installed,t[73]=n.instanceId,t[74]=i.disconnect,t[75]=P):P=t[75];let F;return t[76]!==a||t[77]!==E||t[78]!==M||t[79]!==N||t[80]!==P||t[81]!==p||t[82]!==m?(F=(0,Z.jsxs)(`article`,{role:`button`,tabIndex:0,"aria-label":p,className:`cursor-pointer rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:border-accent/30 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:a,onKeyDown:m,children:[E,M,N,P]}),t[76]=a,t[77]=E,t[78]=M,t[79]=N,t[80]=P,t[81]=p,t[82]=m,t[83]=F):F=t[83],F}function Ke(e){let t=(0,Y.c)(70),{playbook:n,busy:r,t:i,onToggleGroup:a,onCreate:o,onUpdate:c,onDelete:l,onRollback:u}=e,[d,f]=(0,X.useState)(``),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(``),_=n.enabled?`border-edge-subtle bg-surface-panel`:`border-edge-subtle bg-surface-muted`,v;t[0]===_?v=t[1]:(v=s(`rounded-xl border p-4`,_),t[0]=_,t[1]=v);let y=i.playbookNames[n.id],b;t[2]===y?b=t[3]:(b=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:y}),t[2]=y,t[3]=b);let x;t[4]!==n.rules||t[5]!==i.playbookRuleCount?(x=Re(i.playbookRuleCount,n.rules.filter(Ye).length),t[4]=n.rules,t[5]=i.playbookRuleCount,t[6]=x):x=t[6];let S;t[7]===x?S=t[8]:(S=(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:x}),t[7]=x,t[8]=S);let C;t[9]!==b||t[10]!==S?(C=(0,Z.jsxs)(`div`,{children:[b,S]}),t[9]=b,t[10]=S,t[11]=C):C=t[11];let w=n.enabled?i.pausePlaybook:i.resumePlaybook,T;t[12]!==r||t[13]!==a||t[14]!==w?(T=(0,Z.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:r,onClick:a,children:w}),t[12]=r,t[13]=a,t[14]=w,t[15]=T):T=t[15];let E;t[16]!==C||t[17]!==T?(E=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[C,T]}),t[16]=C,t[17]=T,t[18]=E):E=t[18];let O;t[19]!==r||t[20]!==p||t[21]!==h||t[22]!==l||t[23]!==u||t[24]!==c||t[25]!==n.rules||t[26]!==i.cancel||t[27]!==i.deleteRule||t[28]!==i.disableRule||t[29]!==i.edit||t[30]!==i.enableRule||t[31]!==i.moveDown||t[32]!==i.moveUp||t[33]!==i.rollbackRule||t[34]!==i.ruleChannelContext||t[35]!==i.ruleContextAny||t[36]!==i.ruleHistory||t[37]!==i.ruleSupportContext||t[38]!==i.ruleSupportNeeds||t[39]!==i.save?(O=n.rules.map((e,t)=>(0,Z.jsx)(`li`,{className:s(`rounded-lg border border-edge-subtle p-2.5`,!e.enabled&&`opacity-60`),children:p===e.id?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`textarea`,{className:s(Le,`min-h-16 resize-y`),value:h,onChange:e=>g(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,Z.jsx)(D,{type:`button`,variant:`ghost`,className:`h-7 px-2`,onClick:()=>m(null),children:i.cancel}),(0,Z.jsx)(D,{type:`button`,variant:`primary`,className:`h-7 px-2`,disabled:!h.trim(),onClick:()=>{c(e.id,{statement:h.trim()}),m(null)},children:i.save})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:e.statement}),(0,Z.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-1`,children:[(0,Z.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleSupportContext,(0,Z.jsxs)(fe,{value:e.context.supportNeed??``,disabled:r,onChange:t=>c(e.id,{context:{supportNeed:t.target.value||null}}),children:[(0,Z.jsx)(K,{value:``,children:i.ruleContextAny}),[`listen`,`clarify`,`advise`,`act`,`unknown`].map(e=>(0,Z.jsx)(K,{value:e,children:i.ruleSupportNeeds[e]},e))]})]}),(0,Z.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleChannelContext,(0,Z.jsxs)(fe,{value:e.context.channel??``,disabled:r,onChange:t=>c(e.id,{context:{channel:t.target.value||null}}),children:[(0,Z.jsx)(K,{value:``,children:i.ruleContextAny}),[`webchat`,`telegram`,`weixin`,`feishu`,`cli`].map(Je)]})]})]}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1`,children:[(0,Z.jsx)(D,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===0,onClick:()=>c(e.id,{order:n.rules[t-1].order-1}),children:i.moveUp}),(0,Z.jsx)(D,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===n.rules.length-1,onClick:()=>c(e.id,{order:n.rules[t+1].order+1}),children:i.moveDown}),(0,Z.jsx)(D,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>c(e.id,{enabled:!e.enabled}),children:e.enabled?i.disableRule:i.enableRule}),(0,Z.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>{m(e.id),g(e.statement)},children:[(0,Z.jsx)(Te,{className:`size-3`,"aria-hidden":!0}),i.edit]}),(0,Z.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-7 px-2 text-danger`,disabled:r,onClick:()=>l(e.id),children:[(0,Z.jsx)(B,{className:`size-3`,"aria-hidden":!0}),i.deleteRule]})]}),e.versions.length>1?(0,Z.jsxs)(`details`,{className:`mt-2 border-t border-edge-subtle pt-2`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer text-[11px] text-fg-subtle`,children:i.ruleHistory}),(0,Z.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.versions.filter(qe).map(t=>(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2 text-[11px]`,children:[(0,Z.jsx)(`p`,{className:`line-clamp-2 text-fg-muted`,children:t.statement}),(0,Z.jsx)(D,{type:`button`,variant:`ghost`,className:`h-7 shrink-0 px-2`,disabled:r,onClick:()=>u(e.id,t.id),children:i.rollbackRule})]},t.id))})]}):null]})},e.id)),t[19]=r,t[20]=p,t[21]=h,t[22]=l,t[23]=u,t[24]=c,t[25]=n.rules,t[26]=i.cancel,t[27]=i.deleteRule,t[28]=i.disableRule,t[29]=i.edit,t[30]=i.enableRule,t[31]=i.moveDown,t[32]=i.moveUp,t[33]=i.rollbackRule,t[34]=i.ruleChannelContext,t[35]=i.ruleContextAny,t[36]=i.ruleHistory,t[37]=i.ruleSupportContext,t[38]=i.ruleSupportNeeds,t[39]=i.save,t[40]=O):O=t[40];let k;t[41]===O?k=t[42]:(k=(0,Z.jsx)(`ul`,{className:`mt-3 space-y-2`,children:O}),t[41]=O,t[42]=k);let A;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>f(e.target.value),t[43]=A):A=t[43];let j;t[44]!==d||t[45]!==i.newRulePlaceholder?(j=(0,Z.jsx)(`input`,{className:Le,value:d,onChange:A,placeholder:i.newRulePlaceholder}),t[44]=d,t[45]=i.newRulePlaceholder,t[46]=j):j=t[46];let M;t[47]!==r||t[48]!==d?(M=r||!d.trim(),t[47]=r,t[48]=d,t[49]=M):M=t[49];let N;t[50]!==d||t[51]!==o?(N=()=>{o(d.trim()),f(``)},t[50]=d,t[51]=o,t[52]=N):N=t[52];let P;t[53]!==i.addRule||t[54]!==M||t[55]!==N?(P=(0,Z.jsx)(D,{type:`button`,variant:`secondary`,disabled:M,onClick:N,children:i.addRule}),t[53]=i.addRule,t[54]=M,t[55]=N,t[56]=P):P=t[56];let F;t[57]!==j||t[58]!==P?(F=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[j,P]}),t[57]=j,t[58]=P,t[59]=F):F=t[59];let I=i.playbookRuleExamples[n.id],L;t[60]===I?L=t[61]:(L=(0,Z.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-5 text-fg-subtle`,children:I}),t[60]=I,t[61]=L);let R;t[62]!==F||t[63]!==L?(R=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[F,L]}),t[62]=F,t[63]=L,t[64]=R):R=t[64];let z;return t[65]!==E||t[66]!==k||t[67]!==v||t[68]!==R?(z=(0,Z.jsxs)(`article`,{className:v,children:[E,k,R]}),t[65]=E,t[66]=k,t[67]=v,t[68]=R,t[69]=z):z=t[69],z}function qe(e){return!e.current}function Je(e){return(0,Z.jsx)(K,{value:e,children:e},e)}function Ye(e){return e.enabled}function Xe(e){let t=(0,Y.c)(46),{suggestion:n,draft:r,busy:i,onDraftChange:a,onSave:o,onLater:c,t:l}=e,u;t[0]!==n||t[1]!==l.meetSuggestedTitle||t[2]!==l.meetTitle?(u=n?l.meetSuggestedTitle.replace(`{{name}}`,n.value):l.meetTitle,t[0]=n,t[1]=l.meetSuggestedTitle,t[2]=l.meetTitle,t[3]=u):u=t[3];let d;t[4]===u?d=t[5]:(d=(0,Z.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-fg`,children:u}),t[4]=u,t[5]=d);let f=n?l.meetSuggestedBody:l.meetBody,p;t[6]===f?p=t[7]:(p=(0,Z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:f}),t[6]=f,t[7]=p);let m;t[8]===l.callName?m=t[9]:(m=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`you-call-name`,children:l.callName}),t[8]=l.callName,t[9]=m);let h;t[10]===a?h=t[11]:(h=e=>a(e.target.value),t[10]=a,t[11]=h);let g;t[12]!==i||t[13]!==r||t[14]!==o?(g=e=>{e.key===`Enter`&&r.trim()&&!i&&o()},t[12]=i,t[13]=r,t[14]=o,t[15]=g):g=t[15];let _=l.meetPlaceholder,v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=s(Le,`h-10 flex-1 bg-surface-base/90`),t[16]=v):v=t[16];let y;t[17]!==r||t[18]!==l.meetPlaceholder||t[19]!==h||t[20]!==g?(y=(0,Z.jsx)(`input`,{id:`you-call-name`,value:r,maxLength:80,onChange:h,onKeyDown:g,placeholder:_,className:v}),t[17]=r,t[18]=l.meetPlaceholder,t[19]=h,t[20]=g,t[21]=y):y=t[21];let b;t[22]!==i||t[23]!==r?(b=i||!r.trim(),t[22]=i,t[23]=r,t[24]=b):b=t[24];let x=i?l.meetSaving:l.meetSave,S;t[25]!==o||t[26]!==b||t[27]!==x?(S=(0,Z.jsx)(D,{type:`button`,variant:`primary`,className:`h-10 shrink-0`,disabled:b,onClick:o,children:x}),t[25]=o,t[26]=b,t[27]=x,t[28]=S):S=t[28];let C;t[29]!==y||t[30]!==S||t[31]!==m?(C=(0,Z.jsxs)(`div`,{className:`mt-5 flex max-w-xl flex-col gap-2 sm:flex-row`,children:[m,y,S]}),t[29]=y,t[30]=S,t[31]=m,t[32]=C):C=t[32];let w;t[33]!==n||t[34]!==l.meetSource?(w=n?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-start gap-1.5 text-xs leading-5 text-fg-subtle`,children:[(0,Z.jsx)(pe,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:l.meetSource})]}):null,t[33]=n,t[34]=l.meetSource,t[35]=w):w=t[35];let T;t[36]!==i||t[37]!==c||t[38]!==l.meetLater?(T=(0,Z.jsx)(`button`,{type:`button`,disabled:i,className:`mt-3 text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:c,children:l.meetLater}),t[36]=i,t[37]=c,t[38]=l.meetLater,t[39]=T):T=t[39];let E;return t[40]!==C||t[41]!==w||t[42]!==T||t[43]!==d||t[44]!==p?(E=(0,Z.jsx)(`section`,{className:`relative overflow-hidden rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/80 via-surface-panel to-surface-panel p-5 sm:p-6`,children:(0,Z.jsxs)(`div`,{className:`relative max-w-2xl`,children:[d,p,C,w,T]})}),t[40]=C,t[41]=w,t[42]=T,t[43]=d,t[44]=p,t[45]=E):E=t[45],E}function Ze(){let e=l(e=>e.language),t=c(e).you,n=a(),[r,h]=i(),g=Ve(r.get(`tab`)),b=j(e=>e.setPageHeader),x=j(e=>e.clearPageHeader),{data:C,error:w,isLoading:A,mutate:M}=u(`/api/you`,R),[P,F]=(0,X.useState)(null),[z,B]=(0,X.useState)(!1),[V,ie]=(0,X.useState)(``),[q,le]=(0,X.useState)(`preference`),[J,me]=(0,X.useState)(null),[he,ve]=(0,X.useState)(!1),[we,Oe]=(0,X.useState)(null),[Y,Ae]=(0,X.useState)(!1),[je,Ne]=(0,X.useState)(``),[Fe,qe]=(0,X.useState)(!1),[Je,Ye]=(0,X.useState)(null),[Ze,Qe]=(0,X.useState)(!1),[$e,et]=(0,X.useState)(!1),[tt,nt]=(0,X.useState)(!1),[rt,it]=(0,X.useState)(null),[at,ot]=(0,X.useState)(!1),[st,ct]=(0,X.useState)(null),[lt,ut]=(0,X.useState)(null),[dt,ft]=(0,X.useState)(!1),[pt,mt]=(0,X.useState)(null),ht=(0,X.useRef)(null),gt=(0,X.useRef)(null),Q=C?.profile??{callName:``,pronouns:``,timezone:``,notes:``},_t=(0,X.useMemo)(()=>C?.understanding.filter(e=>e.status===`active`)??[],[C]),vt=(0,X.useMemo)(()=>C?.understanding.filter(e=>e.status!==`active`)??[],[C]),yt=(0,X.useMemo)(()=>new Map(Ie.map(e=>[e,_t.filter(t=>t.facet===e)])),[_t]),bt=Je??C?.controls??null,xt=C?.sources.filter(e=>e.installed&&e.enabled)??[],St=xt.filter(e=>[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status));async function Ct(e){if(!(!C||tt)){nt(!0);try{let t=await ee(e);await M({...C,relationship:t.relationship},{revalidate:!1})}catch{U({type:`error`,title:t.supportModeTitle,message:t.saveError})}finally{nt(!1)}}}let $=(e,t)=>{let n=new URLSearchParams(r);e===`overview`?n.delete(`tab`):n.set(`tab`,e),t?n.set(`status`,t):n.delete(`status`),h(n,{replace:!0})},wt=e=>{let t=new URLSearchParams({connector:e.id});e.instanceId&&t.set(`instance`,e.instanceId),n(`/connectors?${t.toString()}`)};(0,X.useLayoutEffect)(()=>(b({startExtra:null,main:(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.subtitle})]}),end:(0,Z.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2.5 text-xs`,onClick:()=>ot(!0),children:[(0,Z.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),t.howItWorks]})}),()=>x()),[x,b,t.howItWorks,t.subtitle,t.title]),(0,X.useEffect)(()=>{!C||C.profile.callName||Ne(C.profileSetup.callNameSuggestion?.value??``)},[C,C?.profile.callName,C?.profileSetup.callNameSuggestion?.id]);async function Tt(e,n,r){F(e.id);try{let t=await de(e.id,{action:n,content:r});await M(r=>r&&{...r,understanding:n===`reject`?r.understanding.filter(t=>t.id!==e.id):r.understanding.map(n=>n.id===e.id?t:n)},{revalidate:!1}),M()}catch{U({type:`error`,title:t.title,message:t.saveError})}finally{F(null)}}async function Et(e,n){F(`consent:${e}`);try{await v(e,n),await M(),U({type:`success`,title:t.title,message:t.saved})}catch{U({type:`error`,title:t.title,message:t.saveError})}finally{F(null)}}async function Dt(){let e=V.trim();if(e){F(`understanding:new`);try{await I({content:e,kind:q}),ie(``),B(!1),await M(),U({type:`success`,title:t.understandingTitle,message:t.saved})}catch{U({type:`error`,title:t.understandingTitle,message:t.saveError})}finally{F(null)}}}async function Ot(){if(vt.length){F(`understanding:batch`);try{await y(vt.map(e=>e.id),`confirm`),await M()}catch{U({type:`error`,title:t.reviewTitle,message:t.saveError})}finally{F(null)}}}async function kt(e,n){F(`conflict:${e}`);try{await f(e,n),await M()}catch{U({type:`error`,title:t.conflictsTitle,message:t.saveError})}finally{F(null)}}async function At(e){F(`grant:${e}`);try{await ne(e),await M()}catch{U({type:`error`,title:t.grantsTitle,message:t.saveError})}finally{F(null)}}async function jt(r,i){F(`insight:${r.id}`);try{let t=await _e(r.id,{action:i,uiLocale:e});await M(),i===`apply`&&t.href&&n(t.href)}catch{U({type:`error`,title:t.insightsTitle,message:t.saveError})}finally{F(null)}}async function Mt(e){F(`playbook:${e.id}`);try{await ue(e.id,!e.enabled),await M()}catch{U({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{F(null)}}async function Nt(e,n){F(`playbook:${e}`);try{await n(),await M()}catch{U({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{F(null)}}async function Pt(){if(J){F(J.id);try{await W(J.id);let e=J.id;me(null),await M(t=>t&&{...t,understanding:t.understanding.filter(t=>t.id!==e)},{revalidate:!1}),M()}catch{U({type:`error`,title:t.title,message:t.saveError})}finally{F(null)}}}async function Ft(){if(we){Ae(!0);try{let e=await te(we);ve(!1),Oe(null),await M(t=>t&&{...t,...e},{revalidate:!1})}catch{U({type:`error`,title:t.title,message:t.saveError})}finally{Ae(!1)}}}async function It(){let e=je.trim();if(!(!e||Fe)){qe(!0);try{let t=await te({callName:e,timezone:Q.timezone||oe()});await M(e=>e&&{...e,...t},{revalidate:!1})}catch{U({type:`error`,title:t.title,message:t.saveError})}finally{qe(!1)}}}async function Lt(){if(!Fe){qe(!0);try{let e=await ce(`snooze`);await M(t=>t&&{...t,profileSetup:e.profileSetup},{revalidate:!1})}catch{U({type:`error`,title:t.title,message:t.saveError})}finally{qe(!1)}}}function Rt(){Oe(Q),ve(!0),$(`profile`),requestAnimationFrame(()=>ht.current?.scrollIntoView({behavior:`smooth`,block:`start`}))}function zt(e){le(e),B(!0),$(`understanding`)}async function Bt(){if(bt){Qe(!0);try{Ye(await ye(bt)),await M(),U({type:`success`,title:t.title,message:t.saved})}catch{U({type:`error`,title:t.title,message:t.saveError})}finally{Qe(!1)}}}async function Vt(e){if(!($e||e===C?.trust.defaultActionLevel)){et(!0);try{let t=await Se(e);await M(e=>e&&{...e,trust:t},{revalidate:!1})}catch{U({type:`error`,title:t.trustTitle,message:t.saveError})}finally{et(!1),it(null)}}}async function Ht(e){if(!(!lt?.instanceId||dt)){ft(!0);try{let n=await ge(lt.instanceId,e);ut(null),await M(),U({type:`success`,title:t.sourcesTitle,message:e?t.disconnectDeleted.replace(`{{count}}`,String(n.deletedUnderstandingCount)):t.disconnectSuccess})}catch{U({type:`error`,title:t.sourcesTitle,message:t.saveError})}finally{ft(!1)}}}async function Ut(){if(!pt){mt(`export`);try{let e=await S(),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`xopc-about-you-${e.exportedAt.slice(0,10)}.json`,n.click(),URL.revokeObjectURL(t)}catch{U({type:`error`,title:t.transferTitle,message:t.saveError})}finally{mt(null)}}}async function Wt(e){if(!(!e||pt)){mt(`import`);try{if(e.size>2*1024*1024)throw Error(`file too large`);let n=await k(JSON.parse(await e.text()));await M(),$(`understanding`,`review`),U({type:`success`,title:t.transferTitle,message:t.importSuccess.replace(`{{count}}`,String(n.importedCount)).replace(`{{skipped}}`,String(n.skippedCount))})}catch{U({type:`error`,title:t.transferTitle,message:t.importError})}finally{gt.current&&(gt.current.value=``),ct(null),mt(null)}}}function Gt(){ct(null),gt.current&&(gt.current.value=``)}return(0,Z.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(Ee,{items:[{id:`overview`,label:t.tabs.overview,icon:m},{id:`profile`,label:t.tabs.profile,icon:Ce},{id:`understanding`,label:t.tabs.understanding,icon:p,count:vt.length||void 0},{id:`sources`,label:t.tabs.sources,icon:H},{id:`controls`,label:t.tabs.controls,icon:pe}],activeTab:g,onChange:$,ariaLabel:t.title,tabIdPrefix:`you-tab`,panelIdPrefix:`you-panel`,className:`pr-8 sm:pr-1`,buttonClassName:`px-2.5 sm:px-3`}),(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-y-1 right-0 w-8 bg-gradient-to-l from-surface-panel to-transparent sm:hidden`,"aria-hidden":!0})]}),A?(0,Z.jsx)(He,{}):w||!C?(0,Z.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t.loadError}):null,C&&g===`overview`?(0,Z.jsxs)(`div`,{id:`you-panel-overview`,role:`tabpanel`,"aria-labelledby":`you-tab-overview`,className:`space-y-4`,children:[!Q.callName&&C.profileSetup.shouldPrompt?(0,Z.jsx)(Xe,{suggestion:C.profileSetup.callNameSuggestion,draft:je,busy:Fe,onDraftChange:Ne,onSave:()=>void It(),onLater:()=>void Lt(),t}):null,vt.length>0||St.length>0||!Q.callName?(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-warning/25 bg-warning-soft/35 p-5`,children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.attentionTitle}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[vt.length>0?(0,Z.jsxs)(D,{type:`button`,variant:`secondary`,onClick:()=>$(`understanding`,`review`),children:[Re(t.reviewCount,vt.length),(0,Z.jsx)(G,{className:`size-4`,"aria-hidden":!0})]}):null,St.length>0?(0,Z.jsxs)(D,{type:`button`,variant:`secondary`,onClick:()=>$(`sources`),children:[Re(t.sourceIssues,St.length),(0,Z.jsx)(G,{className:`size-4`,"aria-hidden":!0})]}):null,Q.callName?null:(0,Z.jsxs)(D,{type:`button`,variant:`secondary`,onClick:Rt,children:[t.completeProfile,(0,Z.jsx)(G,{className:`size-4`,"aria-hidden":!0})]})]})]}):null,(0,Z.jsx)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-4`,children:(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>$(`understanding`),children:[(0,Z.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:_t.length}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.knownSummary})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>$(`sources`),children:[(0,Z.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:xt.length}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.connectedSources})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>$(`understanding`,`review`),children:[(0,Z.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:vt.length}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.waitingReview})]})]})}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(m,{className:`size-4 text-accent`,"aria-hidden":!0}),t.supportModeTitle]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.supportModeHint})]}),(0,Z.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,children:t.supportModeTitle}),(0,Z.jsx)(fe,{value:C.relationship.supportMode,disabled:tt,onChange:e=>void Ct({supportMode:e.target.value}),children:Object.entries(t.supportModes).map(([e,t])=>(0,Z.jsx)(K,{value:e,children:t},e))})]})]}),(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 border-t border-edge-subtle pt-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,Z.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:C.relationship.proactiveEnabled,disabled:tt,onChange:e=>void Ct({proactiveEnabled:e.target.checked})}),t.proactiveEnabled]}),(0,Z.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,Z.jsx)(De,{value:C.relationship.quietStart??``,disabled:tt,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietStart,onChange:e=>void Ct({quietStart:e||null})})]}),(0,Z.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,Z.jsx)(De,{value:C.relationship.quietEnd??``,disabled:tt,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietEnd,onChange:e=>void Ct({quietEnd:e||null})})]}),(0,Z.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.blockedTopics,(0,Z.jsx)(`input`,{className:Le,defaultValue:C.relationship.blockedTopics.join(`, `),disabled:tt,onBlur:e=>void Ct({blockedTopics:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})})]})]})]}),C.insights.length>0?(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-accent/15 bg-surface-base p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(re,{className:`size-4 text-accent`,"aria-hidden":!0}),t.insightsTitle]}),(0,Z.jsx)(ze,{children:t.confirmedContextBadge})]}),(0,Z.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-2`,children:C.insights.map(e=>(0,Z.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.insight}),(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:e.evidenceCount>1?Re(t.insightEvidence,e.evidenceCount):t.insightReason}),(0,Z.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,Z.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:P===`insight:${e.id}`,onClick:()=>void jt(e,`dismiss`),children:t.notNow}),(0,Z.jsx)(D,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:P===`insight:${e.id}`,onClick:()=>void jt(e,`apply`),children:t.insightActions[e.action]})]})]},e.id))})]}):null,(0,Z.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(Ce,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.profileHint})]}),(0,Z.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>$(`profile`),children:(0,Z.jsx)(G,{className:`size-4`,"aria-hidden":!0})})]}),(0,Z.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,Z.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Q.callName||`—`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,Z.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Q.timezone||`—`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,Z.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Q.pronouns||`—`})]}),Q.notes?(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,Z.jsx)(`dd`,{className:`mt-1 line-clamp-2 text-sm leading-6 text-fg`,children:Q.notes})]}):null]})]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(p,{className:`size-4 text-accent`,"aria-hidden":!0}),t.understandingTitle]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.understandingHint})]}),(0,Z.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>$(`understanding`),children:(0,Z.jsx)(G,{className:`size-4`,"aria-hidden":!0})})]}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[_t.slice(0,4).map(e=>(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5 text-sm leading-5 text-fg`,children:e.statement},e.id)),_t.length===0?(0,Z.jsx)(`p`,{className:`py-5 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]})]})]})]}):null,C&&g===`profile`?(0,Z.jsxs)(`div`,{id:`you-panel-profile`,role:`tabpanel`,"aria-labelledby":`you-tab-profile`,className:`space-y-5`,children:[(0,Z.jsxs)(`section`,{ref:ht,id:`you-profile-card`,className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Z.jsx)(Ce,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,Z.jsx)(ze,{children:t.onlyYouEditBadge})]}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.profileHint})]}),he?null:(0,Z.jsxs)(D,{type:`button`,variant:`secondary`,onClick:Rt,children:[(0,Z.jsx)(Te,{className:`size-3.5`,"aria-hidden":!0}),t.edit]})]}),he&&we?(0,Z.jsxs)(`div`,{className:`mt-5`,children:[(0,Z.jsx)(ke,{value:we,onChange:Oe,language:e,inputClassName:Le,labels:{callName:t.callName,callNamePlaceholder:t.meetPlaceholder,pronouns:t.pronouns,pronounsPlaceholder:t.pronounsPlaceholder,timezone:t.timezone,timezoneCustom:t.timezoneCustom,timezoneDetect:t.timezoneDetect,custom:t.custom,notes:t.notes,notesPlaceholder:t.notesPlaceholder}}),(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(D,{type:`button`,variant:`ghost`,onClick:()=>{ve(!1),Oe(null)},children:t.cancel}),(0,Z.jsx)(D,{type:`button`,variant:`primary`,disabled:Y,onClick:()=>void Ft(),children:Y?t.saving:t.save})]})]}):(0,Z.jsxs)(`dl`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,Z.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Q.callName||`—`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,Z.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Q.timezone||`—`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,Z.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Q.pronouns||`—`})]}),(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,Z.jsx)(`dd`,{className:`mt-1 whitespace-pre-wrap text-sm leading-6 text-fg`,children:Q.notes||`—`})]})]})]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.structuredContextTitle}),(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-3`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-4 text-left hover:border-accent/30 hover:bg-surface-hover`,onClick:()=>zt(`preference`),children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addPreference}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addPreferenceHint})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-4 text-left hover:border-accent/30 hover:bg-surface-hover`,onClick:()=>zt(`boundary`),children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addBoundary}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addBoundaryHint})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-4 text-left hover:border-accent/30 hover:bg-surface-hover`,onClick:()=>zt(`current_state`),children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addCurrentFocus}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addCurrentFocusHint})]})]})]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Z.jsx)(O,{className:`size-4 text-accent`,"aria-hidden":!0}),t.playbooksTitle]}),(0,Z.jsx)(ze,{children:t.affectsAgentsBadge})]}),C.playbooks.length>0?(0,Z.jsx)(`div`,{className:`mt-4 grid gap-3 xl:grid-cols-3`,children:C.playbooks.map(e=>(0,Z.jsx)(Ke,{playbook:e,busy:P===`playbook:${e.id}`,t,onToggleGroup:()=>void Mt(e),onCreate:t=>void Nt(e.id,()=>N(e.id,t,(e.rules.at(-1)?.order??0)+10)),onUpdate:(t,n)=>void Nt(e.id,()=>se(e.id,t,n)),onDelete:t=>void Nt(e.id,()=>T(e.id,t)),onRollback:(t,n)=>void Nt(e.id,()=>be(e.id,t,n))},e.id))}):(0,Z.jsx)(`p`,{className:`mt-4 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.emptyPlaybooks})]})]}):null,C&&g===`understanding`?(0,Z.jsxs)(`div`,{id:`you-panel-understanding`,role:`tabpanel`,"aria-labelledby":`you-tab-understanding`,className:`space-y-6`,children:[(0,Z.jsxs)(`section`,{className:`border-b border-edge pb-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.addUnderstanding}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.addUnderstandingHint})]}),z?null:(0,Z.jsxs)(D,{type:`button`,variant:`secondary`,onClick:()=>B(!0),children:[(0,Z.jsx)(E,{className:`size-4`,"aria-hidden":!0}),t.add]})]}),z?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-xl border border-edge bg-surface-panel p-3`,children:[(0,Z.jsx)(`textarea`,{className:s(Le,`min-h-24 resize-y`),value:V,onChange:e=>ie(e.target.value),placeholder:t.understandingPlaceholder}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end justify-between gap-3`,children:[(0,Z.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[t.understandingKind,(0,Z.jsx)(fe,{value:q,onChange:e=>le(e.target.value),children:Object.entries(t.understandingKinds).map(([e,t])=>(0,Z.jsx)(K,{value:e,children:t},e))})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(D,{type:`button`,variant:`ghost`,onClick:()=>{B(!1),ie(``)},children:t.cancel}),(0,Z.jsx)(D,{type:`button`,variant:`primary`,disabled:!V.trim()||P===`understanding:new`,onClick:()=>void Dt(),children:t.add})]})]})]}):null]}),C.conflictGroups.some(e=>e.unresolved)?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.conflictsTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.conflictsHint}),(0,Z.jsx)(`div`,{className:`mt-3 space-y-3`,children:C.conflictGroups.filter(e=>e.unresolved).map(n=>(0,Z.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-xl border border-warning/35 bg-warning-soft/25`,children:n.records.filter(e=>e.storedStatus!==`archived`&&e.storedStatus!==`rejected`).map(r=>(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:r.statement}),(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[Ue(r,t),` · `,Be(r.updatedAt,e)]})]}),(0,Z.jsx)(D,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2.5`,disabled:P===`conflict:${n.id}`,onClick:()=>void kt(n.id,r.id),children:t.useThis})]},r.id))},n.id))})]}):null,C.consentRequests.length>0?(0,Z.jsxs)(`section`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.consentTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.consentHint})]}),C.consentRequests.map(e=>(0,Z.jsxs)(`article`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/20 p-4`,children:[(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.consentPurpose.replace(`{{purpose}}`,e.purpose)}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,Z.jsx)(D,{type:`button`,variant:`ghost`,disabled:P===`consent:${e.id}`,onClick:()=>void Et(e.id,`deny`),children:t.consentDeny}),(0,Z.jsx)(D,{type:`button`,variant:`secondary`,disabled:P===`consent:${e.id}`,onClick:()=>void Et(e.id,`once`),children:t.consentOnce}),(0,Z.jsx)(D,{type:`button`,variant:`secondary`,disabled:P===`consent:${e.id}`,onClick:()=>void Et(e.id,`session`),children:t.consentSession}),(0,Z.jsx)(D,{type:`button`,variant:`primary`,disabled:P===`consent:${e.id}`,onClick:()=>void Et(e.id,`always`),children:t.consentAlways})]})]},e.id))]}):null,vt.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.reviewTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.reviewHint})]}),(0,Z.jsx)(D,{type:`button`,variant:`secondary`,disabled:P===`understanding:batch`,onClick:()=>void Ot(),children:t.reviewAll})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:vt.map(n=>(0,Z.jsx)(We,{item:n,language:e,t,busy:P===n.id,onConfirm:()=>void Tt(n,`confirm`),onReject:()=>void Tt(n,`reject`),onUpdate:e=>void Tt(n,`update`,e),onForget:()=>me(n)},n.id))})]}):_t.length>0?(0,Z.jsxs)(`div`,{className:`rounded-2xl border border-success/20 bg-success-soft p-6 text-center`,children:[(0,Z.jsx)(o,{className:`mx-auto size-5 text-success`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`mt-2 text-sm font-semibold text-fg`,children:t.nothingToReview}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.nothingToReviewHint})]}):null,Ie.map(n=>{let r=yt.get(n)??[];return r.length===0?null:(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.facets[n]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:r.map(n=>(0,Z.jsx)(We,{item:n,language:e,t,busy:P===n.id,onConfirm:()=>void Tt(n,`confirm`),onReject:()=>void Tt(n,`reject`),onUpdate:e=>void Tt(n,`update`,e),onForget:()=>me(n)},n.id))})]},n)}),C.understanding.length===0?(0,Z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]}):null,C&&g===`sources`?(0,Z.jsxs)(`div`,{id:`you-panel-sources`,role:`tabpanel`,"aria-labelledby":`you-tab-sources`,className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.sourcesTitle}),(0,Z.jsx)(ze,{children:t.personalContextBadge})]})}),(0,Z.jsxs)(D,{type:`button`,variant:`primary`,onClick:()=>n(`/connectors?tab=connected&personalContext=1`),children:[t.manageSources,(0,Z.jsx)(G,{className:`size-4`,"aria-hidden":!0})]})]}),C.sourceRecommendations.length>0?(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-accent/20 bg-accent-soft/25 p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(d,{className:`size-4 text-accent`,"aria-hidden":!0}),t.recommendationsTitle]}),(0,Z.jsx)(ze,{children:t.permissionsBeforeConnectBadge})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2 lg:grid-cols-3`,children:C.sourceRecommendations.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:border-accent/30 hover:bg-surface-hover`,onClick:()=>wt({id:e.sourceId}),children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:e.sourceName}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.recommendationReason.replace(`{{goal}}`,e.goalTitle)})]},e.sourceId))})]}):null,(0,Z.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:C.sources.map(n=>(0,Z.jsx)(Ge,{source:n,language:e,t,onConfigure:()=>wt(n),onDisconnect:()=>ut(n)},`${n.id}:${n.instanceId??`catalog`}`))}),C.sources.length===0?(0,Z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.noSources}):null]}):null,C&&g===`controls`&&bt?(0,Z.jsxs)(`div`,{id:`you-panel-controls`,role:`tabpanel`,"aria-labelledby":`you-tab-controls`,className:`space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-2`,children:[(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.controlTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.controlHint}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3 rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.learningMode,(0,Z.jsx)(fe,{value:bt.mode,onChange:e=>Ye({...bt,mode:e.target.value}),children:Object.entries(t.learningModes).map(([e,t])=>(0,Z.jsx)(K,{value:e,children:t},e))})]}),(0,Z.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.sensitive,(0,Z.jsx)(fe,{value:bt.sensitiveWritePolicy,onChange:e=>Ye({...bt,sensitiveWritePolicy:e.target.value}),children:Object.entries(t.sensitiveOptions).map(([e,t])=>(0,Z.jsx)(K,{value:e,children:t},e))}),(0,Z.jsx)(`span`,{className:`font-normal leading-5 text-fg-subtle`,children:t.sensitiveOptionHints[bt.sensitiveWritePolicy]})]}),(0,Z.jsx)(`div`,{className:`flex justify-end pt-2`,children:(0,Z.jsx)(D,{type:`button`,variant:`primary`,disabled:Ze,onClick:()=>void Bt(),children:Ze?t.saving:t.save})})]})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.trustTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.trustHint}),(0,Z.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:C.trust.levels.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":e===C.trust.defaultActionLevel,disabled:$e,onClick:()=>{e!==C.trust.defaultActionLevel&&(e===`auto`?it(e):Vt(e))},className:s(`rounded-xl border p-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-70`,e===C.trust.defaultActionLevel?`border-accent/35 bg-accent-soft/35`:`border-edge-subtle bg-surface-panel hover:border-accent/25 hover:bg-surface-hover`),children:[(0,Z.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:t.trustLevels[e]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustLevelHints[e]}),e===C.trust.defaultActionLevel?(0,Z.jsx)(`span`,{className:`mt-2 inline-block rounded-full bg-accent-soft px-2 py-0.5 text-[11px] text-accent-fg`,children:t.defaultTrust}):null]},e))})]})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.grantsTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.grantsHint}),C.referenceGrants.length>0?(0,Z.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:C.referenceGrants.map(n=>(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`p`,{className:`truncate text-sm text-fg`,children:n.statement}),(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[n.grantScope?t.grantScopes[n.grantScope]:``,n.expiresAt?` · ${Be(n.expiresAt,e)}`:``]})]}),(0,Z.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2.5`,disabled:P===`grant:${n.id}`,onClick:()=>void At(n.id),children:t.revoke})]},n.id))}):(0,Z.jsx)(`p`,{className:`mt-3 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.noGrants})]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.transferTitle}),(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,Z.jsxs)(D,{type:`button`,variant:`secondary`,disabled:pt!==null,onClick:()=>void Ut(),children:[(0,Z.jsx)(L,{className:`size-4`,"aria-hidden":!0}),pt===`export`?t.exporting:t.exportAction]}),(0,Z.jsxs)(D,{type:`button`,variant:`secondary`,disabled:pt!==null,onClick:()=>gt.current?.click(),children:[(0,Z.jsx)(_,{className:`size-4`,"aria-hidden":!0}),pt===`import`?t.importing:t.importAction]}),(0,Z.jsx)(`input`,{ref:gt,type:`file`,accept:`application/json,.json`,className:`sr-only`,onChange:e=>ct(e.target.files?.[0]??null)})]})]})]}):null,(0,Z.jsx)(xe,{open:J!==null,title:t.forgetTitle,description:t.forgetBody,confirmLabel:t.forget,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void Pt(),onCancel:()=>me(null)}),(0,Z.jsx)(xe,{open:rt===`auto`,title:t.autoConfirmTitle,description:t.autoConfirmBody,confirmLabel:t.autoConfirmAction,cancelLabel:t.cancel,onConfirm:()=>void Vt(`auto`),onCancel:()=>it(null)}),(0,Z.jsx)(xe,{open:st!==null,title:t.importConfirmTitle,description:t.importConfirmBody.replace(`{{name}}`,st?.name??``),confirmLabel:t.importConfirmAction,cancelLabel:t.cancel,onConfirm:()=>{let e=st;ct(null),Wt(e)},onCancel:Gt}),(0,Z.jsx)(Pe,{source:lt,language:e,busy:dt,onOpenChange:e=>{e||ut(null)},onConfirm:e=>void Ht(e)}),(0,Z.jsx)(Me,{open:at,t,onOpenChange:ot,onNavigate:$})]})}export{Ze as UserContextPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./messages-KEk-hTFt.js";import{n as ee}from"./locale-store-Dqp9H2Uf.js";import{Ao as te,At as ne,Bl as re,Bo as s,Do as ie,Eo as c,Gl as ae,Ho as oe,Il as l,Io as se,Is as ce,Lo as le,Ml as ue,Mo as de,No as u,Ns as d,Oo as fe,Po as pe,Ps as me,Pt as he,Ro as ge,Vo as _e,_u as f,au as ve,ko as ye,pc as p,rl as m,ro as h,yu as be,zo as xe}from"./index-Dfq2laZe.js";var g=e(t(),1),_=new Set([`completed`,`failed`,`canceled`]);function Se(){return new Promise(e=>window.setTimeout(e,1200))}async function Ce(e,t){let n=[],r=t.wait??Se;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!_.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var v=n(),we=[`folder_structure`,`recent_progress`,`next_steps`];function y(e){return e instanceof Error?e.message:String(e)}function b(){let e=ee(e=>e.language),t=o(e).onboarding.workDiscovery,n=o(e).chat.workingDirectory,_=i(),[Se]=r(),b=Se.get(`new`)===`1`,[x,S]=(0,g.useState)(`loading`),[C,w]=(0,g.useState)(null),[T,E]=(0,g.useState)(null),[D,O]=(0,g.useState)(!1),[k,A]=(0,g.useState)(null),[Te,j]=(0,g.useState)(!1),[M,N]=(0,g.useState)(``),[P,F]=(0,g.useState)(!1),[I,L]=(0,g.useState)(()=>new Set),[R,z]=(0,g.useState)(!1),[B,Ee]=(0,g.useState)([]),[V,De]=(0,g.useState)(()=>new Set),[Oe,H]=(0,g.useState)([]),[ke,Ae]=(0,g.useState)(!1),[U,W]=(0,g.useState)({current:0,total:0}),G=(0,g.useRef)(!1),K=(0,g.useCallback)(e=>{c.getState().updateDirectoryRun(e),E(e),e.status===`completed`?(L(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),S(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?S(`error`):S(`running`)},[]),je=async()=>{O(!0),A(null);try{let e=await ye();if(!e.length){A(t.noCandidates);return}Ee(e),De(new Set([e[0].rootPath])),S(`candidates`)}catch(e){A(y(e))}finally{O(!1)}},Me=e=>{De(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ne=(0,g.useCallback)((e,t,n)=>{c.getState().updateDirectoryRun(e),E(e),W({current:t+1,total:n}),H(n=>{let r=[...n];return r[t]=e,r}),S(`running`)},[]),Pe=(0,g.useCallback)(e=>{H(t=>t.map(t=>t?.id===e.id?e:t))},[]),Fe=async()=>{let e=B.filter(e=>V.has(e.rootPath));if(!e.length)return;O(!0),A(null),H([]),W({current:1,total:e.length}),Ae(!0),G.current=!1;let n=!1;try{let r=await Ce(e,{grantDirectory:pe,startRun:xe,fetchRun:u,shouldStop:()=>G.current,onRun:(e,t,r)=>{Ne(e,t,r),n||(n=!0,c.getState().scanPersonalContext(e.id))},onError:(n,r,i)=>{W({current:i+1,total:e.length}),A(t.folderAnalysisFailed.replace(`{{folder}}`,r.displayName).replace(`{{error}}`,y(n)))}});if(G.current)return;let i=r.find(e=>e.status===`completed`)??r.at(-1);i?K(i):S(`candidates`)}catch(e){A(y(e)),S(`candidates`)}finally{Ae(!1),O(!1)}},q=he({onPicked:(0,g.useCallback)(async e=>{O(!0),A(null);try{w(await se(e)),S(`consent`)}catch(e){A(y(e)),S(`intro`)}finally{O(!1)}},[])});(0,g.useEffect)(()=>{let e=!1;return de().then(async({enabled:t,state:n})=>{if(!e){if(!t){_(`/chat`,{replace:!0});return}if(!b&&n.activeRunId)try{let t=await u(n.activeRunId);e||K(t);return}catch{}e||S(`intro`)}}).catch(t=>{e||(A(y(t)),S(`intro`))}),()=>{e=!0}},[K,_,b]),(0,g.useEffect)(()=>{if(!T||x!==`running`||ke)return;let e=!1,t=async()=>{try{let t=await u(T.id);e||K(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===T.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[K,ke,x,T]);let J=async()=>{O(!0);try{await te()}finally{_(`/chat`,{replace:!0})}},Ie=async()=>{if(C){O(!0),A(null),H([]),W({current:0,total:0});try{await pe(C.canonicalRootPath);let e=await xe(C.canonicalRootPath);K(e),c.getState().scanPersonalContext(e.id)}catch(e){A(y(e)),S(`consent`)}finally{O(!1)}}},Y=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;_(`/chat/${encodeURIComponent(e)}${n}`)},Le=e=>{E(e),z(!1),j(!1),F(!1),L(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?S(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?S(`error`):S(`running`)},Re=async()=>{T&&(G.current=!0,K(await fe(T.id)))},X=async(t,n)=>{if(!T)return;await ge(T.id,t.id).catch(()=>{});let r=n?`${e===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${t.actionPrompt}`:t.actionPrompt;Y(T.sessionKey,r)},ze=async()=>{if(T){O(!0),A(null);try{let e=T.result?.profileCandidates??[],t=e.length>0?await _e(T.id,e.map(e=>({id:e.id,status:I.has(e.id)?`accepted`:`rejected`}))):T;await Promise.all((t.result?.workThreads??[]).filter(e=>e.userStatus===`unreviewed`).map(e=>oe(e.id,{decision:`confirmed`})));let n=await s(t.id,`confirmed`);E(n),Pe(n),S(`recommendation`)}catch(e){A(y(e))}finally{O(!1)}}},Z=async e=>{if(!(!T||!M.trim())){O(!0),A(null);try{let t=T.result?.workThreads?.find(e=>e.horizon===`current`)??T.result?.workThreads?.[0];t&&await oe(t.id,{decision:`corrected`,correctedSummary:M.trim()});let n=await s(T.id,e,M.trim());E(n),Y(n.sessionKey,M.trim())}catch(e){A(y(e)),O(!1)}}},Be=async()=>{if(T){O(!0);try{Y((await s(T.id,`dismissed`)).sessionKey)}catch(e){A(y(e)),O(!1)}}},Ve=async()=>{let e=T?.result?.workThreads?.find(e=>e.horizon===`current`)??T?.result?.workThreads?.[0];if(e){O(!0),A(null);try{await ie(e.id),z(!0)}catch(e){A(y(e))}finally{O(!1)}}},Q=T?.result?.suggestions.find(e=>e.id===T.result?.primarySuggestionId)??T?.result?.suggestions[0],He=T?.result?.suggestions.filter(e=>e.id!==Q?.id)??[],Ue=e=>e===`command`?t.riskCommand:e===`file_write`?t.riskFileWrite:t.riskAnalysis,We=Oe.filter(e=>e?.status===`completed`),$=We.length>1?(0,v.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,v.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:t.analysisResults}),(0,v.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:We.map(e=>{let t=B.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,v.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===T?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>Le(e),children:t},e.id)})})]}):null;return(0,v.jsxs)(`div`,{className:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,v.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[(0,v.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,v.jsx)(me,{className:`size-11`})}),x===`loading`?(0,v.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,v.jsx)(h,{className:`mx-auto h-8 w-64`}),(0,v.jsx)(h,{className:`mx-auto h-4 w-full max-w-lg`}),(0,v.jsx)(h,{className:`mx-auto size-4/5 max-w-md`}),(0,v.jsx)(h,{className:`mt-8 h-12 w-full rounded-xl`})]}):null,x===`intro`?(0,v.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,v.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,v.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.title}),(0,v.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:t.subtitle})]}),(0,v.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[(0,v.jsxs)(d,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void je(),disabled:D||q.picking,children:[D?(0,v.jsx)(m,{className:`size-4 animate-spin`}):(0,v.jsx)(p,{className:`size-4`}),t.quickScan]}),(0,v.jsxs)(d,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:q.pick,disabled:D||q.picking,children:[q.picking?(0,v.jsx)(m,{className:`size-4 animate-spin`}):(0,v.jsx)(l,{className:`size-4`}),t.chooseFolderManually]}),(0,v.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,v.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,v.jsx)(`span`,{children:t.quickScanNote})]}),k?(0,v.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:k}):null]}),(0,v.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void J(),disabled:D,children:t.skip})]}):null,x===`candidates`?(0,v.jsxs)(`section`,{"aria-labelledby":`work-discovery-candidates-title`,children:[(0,v.jsxs)(`div`,{className:`text-center`,children:[(0,v.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.candidatesTitle}),(0,v.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.candidatesSubtitle})]}),(0,v.jsx)(`div`,{className:`mt-7 space-y-2`,children:B.map((e,n)=>{let r=V.has(e.rootPath);return(0,v.jsxs)(`button`,{type:`button`,"aria-pressed":r,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${r?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Me(e.rootPath),children:[(0,v.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${r?`border-accent bg-accent text-white`:`border-edge bg-surface-base text-transparent`}`,children:(0,v.jsx)(a,{className:`size-3.5`})}),(0,v.jsx)(l,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,v.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,v.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),n===0?(0,v.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:t.recommendedCandidate}):null]}),(0,v.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,v.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,v.jsx)(`span`,{children:e.projectKind===`coding`?t.codingProject:e.projectKind===`general`?t.generalProject:t.unknownProject}),e.branch?(0,v.jsx)(`span`,{children:t.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,v.jsx)(`span`,{children:t.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,v.jsxs)(`div`,{className:`mt-5 flex items-start gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,v.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,v.jsx)(`span`,{children:t.multiFolderPrivacyNote})]}),k?(0,v.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:k}):null,(0,v.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,v.jsxs)(d,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:D||V.size===0,onClick:()=>void Fe(),children:[D?(0,v.jsx)(m,{className:`mr-2 size-4 animate-spin`}):null,t.analyzeSelected.replace(`{{count}}`,String(V.size))]}),(0,v.jsx)(d,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:D,onClick:q.pick,children:t.chooseFolderManually})]}),(0,v.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>S(`intro`),children:t.back})]}):null,x===`consent`&&C?(0,v.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,v.jsxs)(`div`,{className:`text-center`,children:[(0,v.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.selectedTitle}),(0,v.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.selectedSubtitle})]}),(0,v.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,v.jsx)(l,{className:`size-5 shrink-0 text-accent-fg`}),(0,v.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,v.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:C.displayName}),(0,v.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:C.canonicalRootPath})]}),(0,v.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:C.projectKind===`coding`?t.codingProject:C.projectKind===`general`?t.generalProject:t.unknownProject})]}),(0,v.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.localFingerprint}),(0,v.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:C.fingerprint.branch?t.branchValue.replace(`{{branch}}`,C.fingerprint.branch):t.noGitBranch})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.recentActivity}),(0,v.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:t.changedFiles.replace(`{{count}}`,String(C.fingerprint.changedFileCount))})]}),C.fingerprint.recentAreas.length>0?(0,v.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,v.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.recentAreas}),(0,v.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:C.fingerprint.recentAreas.map(e=>(0,v.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,v.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,v.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,v.jsx)(re,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.willRead}),(0,v.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.willReadValue})]})]}),(0,v.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,v.jsx)(ce,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.willIgnore}),(0,v.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.willIgnoreValue})]})]}),(0,v.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,v.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,v.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:C.remoteModel?t.providerDisclosure.replace(`{{provider}}`,C.provider):t.localDisclosure})]})]})]}),k?(0,v.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:k}):null,(0,v.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,v.jsxs)(d,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:D,onClick:()=>void Ie(),children:[D?(0,v.jsx)(m,{className:`mr-2 size-4 animate-spin`}):null,t.startAnalysis]}),(0,v.jsx)(d,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:D,onClick:q.pick,children:t.changeFolder})]}),(0,v.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void J(),children:t.skip})]}):null,x===`running`&&T?(0,v.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,v.jsxs)(`div`,{className:`text-center`,children:[(0,v.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.analyzingTitle}),(0,v.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.analyzingSubtitle}),U.total>1?(0,v.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:t.analyzingFolderProgress.replace(`{{current}}`,String(U.current)).replace(`{{total}}`,String(U.total))}):null]}),(0,v.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:we.map((e,n)=>{let r=Math.max(0,we.indexOf(T.stage??`folder_structure`)),i=n<r,o=n===r;return(0,v.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,v.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${i?`bg-accent text-white`:o?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:i?(0,v.jsx)(a,{className:`size-4`}):o?(0,v.jsx)(m,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,v.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,v.jsx)(`span`,{className:o||i?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:t.stages[e]})]},e)})}),(0,v.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:T.rootPath}),(0,v.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,v.jsx)(d,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>_(`/chat`),children:t.continueInBackground}),(0,v.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void Re(),children:t.cancelAnalysis})]})]}):null,x===`recognition`&&T?.result?(0,v.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,v.jsxs)(`div`,{className:`text-center`,children:[(0,v.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:t.recognitionEyebrow}),(0,v.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:T.result.lowConfidence?t.lowConfidenceTitle:t.recognitionTitle})]}),$,(0,v.jsxs)(`div`,{className:`mt-7 rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/45 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,v.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:T.result.projectSummary}),(0,v.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:T.result.currentState}),!T.result.lowConfidence&&Q?.evidence.length?(0,v.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:Q.evidence.slice(0,3).map((e,t)=>(0,v.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,v.jsx)(ue,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,v.jsxs)(`span`,{children:[e.path?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${Q.id}-recognition-${t}`))}):null]}),T.result.workThreads?.length?(0,v.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,v.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.workThreadsTitle}),(0,v.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.workThreadsSubtitle}),(0,v.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:T.result.workThreads.map(e=>(0,v.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:e.horizon===`current`?t.workThreadCurrent:e.horizon===`ongoing`?t.workThreadOngoing:t.workThreadLongTerm}),(0,v.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,v.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,T.result.profileCandidates?.length?(0,v.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,v.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.profileCandidatesTitle}),(0,v.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.profileCandidatesSubtitle}),(0,v.jsx)(`div`,{className:`mt-3 space-y-2`,children:T.result.profileCandidates.map(e=>(0,v.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,v.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:I.has(e.id),onChange:()=>L(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,v.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,T.result.lowConfidence?(0,v.jsxs)(`div`,{className:`mt-5`,children:[(0,v.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:T.result.contextQuestion}),(0,v.jsx)(`textarea`,{value:M,onChange:e=>N(e.target.value),placeholder:t.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,v.jsx)(d,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:D||!M.trim(),onClick:()=>void Z(`different_goal`),children:t.continueWithCorrection})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,v.jsxs)(d,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:D,onClick:()=>void ze(),children:[D?(0,v.jsx)(m,{className:`size-4 animate-spin`}):(0,v.jsx)(a,{className:`size-4`}),t.confirmUnderstanding]}),(0,v.jsx)(d,{variant:`secondary`,className:`h-11 flex-1`,disabled:D,onClick:()=>j(e=>!e),children:t.notQuiteRight})]}),Te?(0,v.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,v.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:t.correctionLabel}),(0,v.jsx)(`textarea`,{id:`work-discovery-correction`,value:M,onChange:e=>N(e.target.value),placeholder:t.correctionPlaceholder,className:`mt-2 min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,v.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,v.jsx)(d,{variant:`ghost`,disabled:D||!M.trim(),onClick:()=>void Z(`different_goal`),children:t.differentGoal}),(0,v.jsx)(d,{variant:`primary`,disabled:D||!M.trim(),onClick:()=>void Z(`corrected`),children:t.useCorrection})]})]}):null]}),k?(0,v.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:k}):null,(0,v.jsx)(`button`,{type:`button`,disabled:D,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void Be(),children:t.openConversation})]}):null,x===`recommendation`&&T?.result&&Q?(0,v.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,v.jsxs)(`div`,{className:`text-center`,children:[(0,v.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:t.understandingConfirmed}),(0,v.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:t.primaryRecommendationTitle})]}),$,(0,v.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,v.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,v.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,v.jsx)(f,{className:`size-5`})}),(0,v.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,v.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:Q.title}),(0,v.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Q.rationale}),(0,v.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,v.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:[(0,v.jsx)(ve,{className:`size-3.5`}),t.estimatedMinutes.replace(`{{count}}`,String(Q.estimatedMinutes))]}),(0,v.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ue(Q.risk)})]}),(0,v.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,v.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.expectedOutcome}),(0,v.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:Q.expectedOutcome})]}),(0,v.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,v.jsx)(d,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:t.startRecommendedAction}),(0,v.jsx)(d,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void X(Q,!0),children:t.explainFirst})]})]})]})}),T.result.workThreads?.length?(0,v.jsx)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:(0,v.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,v.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:R?(0,v.jsx)(a,{className:`size-4`}):(0,v.jsx)(ae,{className:`size-4`})}),(0,v.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,v.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:R?t.focusTrialActive:t.focusTrialTitle}),(0,v.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:R?t.focusTrialActiveDescription:t.focusTrialDescription}),R?null:(0,v.jsxs)(d,{className:`mt-3 h-9`,variant:`secondary`,disabled:D,onClick:()=>void Ve(),children:[D?(0,v.jsx)(m,{className:`size-4 animate-spin`}):(0,v.jsx)(ae,{className:`size-4`}),t.activateFocusTrial]})]})]})}):null,He.length>0?(0,v.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,v.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>F(e=>!e),children:[t.otherDirections,(0,v.jsx)(be,{className:`size-4 transition-transform ${P?`rotate-180`:``}`})]}),P?(0,v.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:He.map(e=>(0,v.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void X(e,!0),children:[(0,v.jsx)(f,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,v.jsxs)(`span`,{children:[(0,v.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,v.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedOutcome})]})]},e.id))}):null]}):null,(0,v.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,v.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(T.sessionKey),children:t.doSomethingElse}),(0,v.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{j(!0),S(`recognition`)},children:t.correctUnderstanding})]})]}):null,x===`error`&&T?(0,v.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,v.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,v.jsx)(ce,{className:`size-5`})}),(0,v.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:t.errorTitle}),(0,v.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:T.errorMessage}),(0,v.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,v.jsx)(d,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void le(T.id).then(K),children:t.retry}),(0,v.jsx)(d,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{E(null),w(null),S(`intro`)},children:t.chooseDifferent})]}),(0,v.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(T.sessionKey),children:t.openConversation})]}):null]}),q.hasNativePicker?null:(0,v.jsx)(ne,{open:q.modalOpen,onOpenChange:q.setModalOpen,initialAbsolutePath:C?.canonicalRootPath,onConfirm:q.confirmPick,wd:n})]})}export{b as WorkDiscoveryPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-KEk-hTFt.js";import{n as ee}from"./locale-store-Dqp9H2Uf.js";import{$s as l,A as te,Bl as u,Ec as ne,Fa as re,Fu as d,Hc as f,Kl as ie,Ml as ae,Nc as oe,Ns as p,Qc as m,Su as h,Tc as g,To as _,Xl as se,Ys as ce,a as le,cs as v,f as ue,hu as de,l as fe,m as pe,o as y,os as me,p as b,s as he,u as x,vt as S}from"./index-Dfq2laZe.js";var C=n(),w=e(t(),1),T=r();function ge(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function E(e){return e?S(new Date(e)):``}function _e(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function ve(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:e.kind===`note`?`/notes/${encodeURIComponent(e.targetId)}`:`#`}function D(e){let t=(0,C.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,T.jsx)(`dt`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a=r||`-`,o;t[2]===a?o=t[3]:(o=(0,T.jsx)(`dd`,{className:`min-w-0 break-words text-sm text-fg`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,T.jsxs)(`div`,{className:`grid gap-1`,children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function ye(e){let t=(0,C.c)(9),{events:n,t:r}=e;if(!n.length){let e;return t[0]===r.detail.noActivity?e=t[1]:(e=(0,T.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:r.detail.noActivity}),t[0]=r.detail.noActivity,t[1]=e),e}let i;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,T.jsx)(`article`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r.eventTypes[e.type]??e.type}),(0,T.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:E(e.createdAt)})]})},e.id),t[5]=r,t[6]=e),i=n.map(e),t[2]=n,t[3]=r,t[4]=i}else i=t[4];let a;return t[7]===i?a=t[8]:(a=(0,T.jsx)(`div`,{className:`grid gap-3`,children:i}),t[7]=i,t[8]=a),a}function O(e){return new Set(e.toLowerCase().split(/[^a-z0-9\u4e00-\u9fff]+/).filter(e=>e.length>=2))}function k(e,t,n){let r=t?.projectKind,i=[e.title,e.description,e.nextAction,e.blockedReason,e.status,e.priority,t?.name,t?.description,r].filter(Boolean).join(` `),a=[n.title,n.description,n.metadata.whenToUse,...n.metadata.tags??[]].filter(Boolean).join(` `),o=O(i),s=0;for(let e of O(a))o.has(e)&&(s+=3);let c=a.toLowerCase();return(e.status===`blocked`||e.status===`needs_input`)&&/debug|diagnos|review|audit|fix|检查|排查|修复/.test(c)&&(s+=8),e.status===`in_review`&&/review|audit|check|验收|评审|检查/.test(c)&&(s+=6),e.attachments?.length&&/analy|extract|summar|review|整理|分析|总结/.test(c)&&(s+=5),r===`coding`&&/code|repo|test|pr|review|代码|仓库|测试/.test(c)&&(s+=5),s}function A(e,t,n){return[...n].sort((n,r)=>k(e,t,r)-k(e,t,n)||n.title.localeCompare(r.title))}function j(){let{workItemId:e=``}=i(),t=a(),n=c(ee(e=>e.language)).projectDetailPage.workItems,[r,S]=(0,w.useState)(null),[C,O]=(0,w.useState)(null),[j,M]=(0,w.useState)([]),[N,be]=(0,w.useState)([]),[P,F]=(0,w.useState)(``),[I,L]=(0,w.useState)(``),[R,z]=(0,w.useState)(!0),[B,V]=(0,w.useState)(!1),[H,U]=(0,w.useState)(null),W=(0,w.useRef)(null),G=_(e=>e.setPageHeader),K=_(e=>e.clearPageHeader),q=(0,w.useMemo)(()=>r?`/projects/${encodeURIComponent(r.projectId)}/work-items`:`/projects`,[r]),J=(0,w.useCallback)(async()=>{if(e){z(!0),U(null);try{let[t,n]=await Promise.all([fe(e),x(e).catch(()=>({events:[]}))]);S(t.item),L(t.item.nextAction||t.item.title),M(n.events);let[r,i]=await Promise.all([re(t.item.projectId).catch(()=>null),te().catch(()=>[])]),a=A(t.item,r,i);O(r),be(a),F(e=>e||a[0]?.id||``)}catch(e){U(e instanceof Error?e.message:String(e))}finally{z(!1)}}},[e]);(0,w.useEffect)(()=>{J()},[J]);let Y=(0,w.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await ue(r.id);S(e.item),t(`/chat/${encodeURIComponent(e.session.key)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),X=(0,w.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await le(r.id);S(e.item),t(`/goals/${encodeURIComponent(e.goal.id)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),Z=(0,w.useCallback)(async e=>{M((await x(e).catch(()=>({events:[]}))).events)},[]),xe=(0,w.useCallback)(async()=>{if(!(!r||!P)){V(!0),U(null);try{let e=await b(r.id,{definitionId:P,goal:I.trim()||r.nextAction||r.title});S(e.item),await Z(e.item.id),t(`/workflows?run=${encodeURIComponent(e.runId)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t,Z,P,I]),Se=(0,w.useCallback)(async e=>{if(!(!r||!e.length)){V(!0),U(null);try{let t=await pe(r.id,e);S(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),Ce=(0,w.useCallback)(async e=>{if(r){V(!0),U(null);try{let t=await y(r.id,e.id);S(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),we=(0,w.useCallback)(async e=>{if(r){U(null);try{await he(r.id,e)}catch(e){U(e instanceof Error?e.message:String(e))}}},[r]),Q=(0,w.useMemo)(()=>r?N.filter(e=>k(r,C,e)>0).slice(0,3):[],[r,C,N]),$=(0,w.useMemo)(()=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void J(),children:[(0,T.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden sm:inline`,children:n.refreshShort})]}),r?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(p,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.startChat})]}),(0,T.jsxs)(p,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.createGoal})]})]}):null]}),[B,X,Y,r,J,n.detail.createGoal,n.detail.startChat,n.refreshShort]);return(0,w.useLayoutEffect)(()=>(G({startExtra:(0,T.jsx)(o,{to:q,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":C?.name?n.detail.backToProject.replace(`{{name}}`,C.name):n.detail.backToProjects,children:(0,T.jsx)(d,{className:`size-4`,"aria-hidden":!0})}),main:(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(h,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,T.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r?.title??(R?n.detail.loading:n.detail.notFound)})]}),r?(0,T.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[n.statuses[r.status],` · `,n.priorities[r.priority],` · `,C?.name||r.projectId,` · `,n.updated,`: `,E(r.updatedAt)]}):null]}),end:$}),()=>K()),[K,$,r,R,C?.name,q,G,n,C]),R?(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,T.jsx)(`div`,{className:`h-8 w-40 animate-pulse rounded-md bg-surface-hover`}),(0,T.jsx)(`div`,{className:`mt-5 h-44 animate-pulse rounded-xl bg-surface-hover`})]}):H||!r?(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,children:[(0,T.jsxs)(o,{to:`/projects`,className:`inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,T.jsx)(d,{className:`size-4`,"aria-hidden":!0}),n.detail.backToProjects]}),(0,T.jsx)(`div`,{className:`mt-5 rounded-lg border border-danger/30 bg-danger-soft px-4 py-3 text-sm text-danger`,children:H||n.detail.notFound})]}):(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface sm:px-5`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(h,{className:`size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,T.jsx)(`h1`,{className:`min-w-0 break-words text-lg font-semibold leading-7 text-fg`,children:r.title})]}),(0,T.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs`,children:[(0,T.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 font-medium`,ge(r.status)),children:n.statuses[r.status]}),(0,T.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.priorities[r.priority]}),r.archivedAt?(0,T.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.detail.archived}):null]})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,T.jsxs)(p,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startChat]}),(0,T.jsxs)(p,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),n.detail.createGoal]})]})]}),(0,T.jsxs)(`dl`,{className:`mt-5 grid gap-4 border-t border-edge pt-4 sm:grid-cols-2`,children:[(0,T.jsx)(D,{label:n.create.descriptionLabel,value:r.description||n.detail.noDescription}),(0,T.jsx)(D,{label:n.nextAction,value:r.nextAction||n.noNextAction}),(0,T.jsx)(D,{label:n.blockedReason,value:r.blockedReason||n.detail.noBlockedReason}),(0,T.jsx)(D,{label:n.updated,value:E(r.updatedAt)})]})]}),(0,T.jsxs)(`div`,{className:`mt-4 grid min-h-0 gap-4 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,T.jsxs)(`section`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,T.jsx)(u,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.activity})]}),(0,T.jsx)(ye,{events:j,t:n})]}),(0,T.jsxs)(`aside`,{className:`grid content-start gap-4`,children:[(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,T.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,T.jsx)(ae,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`truncate`,children:n.detail.workflowTitle})]})}),(0,T.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.detail.workflowHint}),(0,T.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,T.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowTemplate,(0,T.jsxs)(me,{className:`h-9 rounded-md border border-edge bg-surface-base px-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:P,disabled:B||N.length===0,onChange:e=>F(e.target.value),children:[N.length===0?(0,T.jsx)(v,{value:``,children:n.detail.noWorkflowTemplates}):null,N.map(e=>(0,T.jsx)(v,{value:e.id,children:e.title},e.id))]})]}),Q.length?(0,T.jsxs)(`div`,{className:`grid gap-1`,children:[(0,T.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n.detail.recommendedWorkflows}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Q.map(e=>(0,T.jsx)(`button`,{type:`button`,className:s(`min-w-0 rounded-md border px-2 py-1 text-left text-xs transition-colors`,P===e.id?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),disabled:B,onClick:()=>F(e.id),children:(0,T.jsx)(`span`,{className:`block max-w-48 truncate`,children:e.title})},e.id))})]}):null,(0,T.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowGoal,(0,T.jsx)(`textarea`,{className:`min-h-20 resize-y rounded-md border border-edge bg-surface-base p-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:I,disabled:B,onChange:e=>L(e.target.value)})]}),(0,T.jsxs)(p,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3 text-xs`,disabled:B||!P,onClick:xe,children:[(0,T.jsx)(g,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startWorkflow]}),N.length?null:(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.detail.noWorkflowTemplates})]})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,T.jsx)(f,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`truncate`,children:n.attachments.title})]}),(0,T.jsxs)(p,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:()=>W.current?.click(),children:[(0,T.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),n.attachments.add]}),(0,T.jsx)(`input`,{ref:W,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{Se(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),(0,T.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.attachments?.length?r.attachments.map(e=>(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-base p-2 text-sm`,children:[(0,T.jsx)(u,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`div`,{className:`truncate font-medium text-fg`,children:e.fileName}),(0,T.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[e.mimeType,` · `,_e(e.size)]})]}),(0,T.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:n.attachments.download,"aria-label":n.attachments.download,disabled:B,onClick:()=>void we(e),children:(0,T.jsx)(se,{className:`size-3.5`,"aria-hidden":!0})}),(0,T.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:n.attachments.remove,"aria-label":n.attachments.remove,disabled:B,onClick:()=>void Ce(e),children:(0,T.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0})})]},e.id)):(0,T.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.attachments.empty})})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.links}),(0,T.jsx)(`div`,{className:`mt-3 grid gap-1 text-sm`,children:r.links?.length?r.links.map(e=>(0,T.jsxs)(o,{to:ve(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,T.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,T.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[n.linkKinds[e.kind],(0,T.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,T.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.detail.noLinks})})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.project}),(0,T.jsxs)(o,{to:q,className:`mt-2 inline-flex min-w-0 items-center gap-2 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,T.jsx)(de,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:C?.name||r.projectId})]})]})]})]})]})}export{j as WorkItemDetailPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./circle-alert-BEjgurr2.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-KEk-hTFt.js";import{n as u,o as d,r as f,s as p}from"./locale-store-Dqp9H2Uf.js";import{n as m}from"./activity-store-CkUp1qvf.js";import{Bu as h,Do as g,Fo as _,Gl as v,Go as y,Is as ee,Jo as b,Js as x,Ko as S,Ll as C,Na as w,Nc as T,Ns as E,Pu as D,To as O,Uo as k,Va as A,Wo as j,Yo as M,Ys as N,_u as P,au as te,bl as F,bu as ne,el as re,hu as I,jo as L,lc as ie,qo as ae,rl as R,ro as z,tt as oe,vt as se,yc as ce}from"./index-Dfq2laZe.js";var B=e(t(),1),V=n();function H(e){try{return decodeURIComponent(e).trim()||null}catch{return null}}function U(e){if(!e)return null;let t=e.split(/[?#]/,1)[0],n=/^\/goals\/([^/]+)\/?$/.exec(t);if(n){let e=H(n[1]);return e?{kind:`goal`,id:e}:null}let r=/^\/chat\/([^/]+)\/?$/.exec(t);if(r){let e=H(r[1]);return!e||e===`new`?null:{kind:`session`,id:e}}return null}async function W(e,t){let n=e.kind===`goal`?`/api/goals/${encodeURIComponent(e.id)}`:`/api/sessions/${encodeURIComponent(e.id)}?limit=1`;try{return(await d(f(n),{signal:t})).status===404?`missing`:`available`}catch(e){if(t?.aborted)throw e;return`available`}}var G=r(),K=3,le={info:{Icon:F,className:`text-accent-fg bg-accent-soft`},success:{Icon:I,className:`text-success bg-success-soft`},warning:{Icon:x,className:`text-warning bg-warning-soft`},error:{Icon:s,className:`text-danger bg-danger-soft`}};function q(e,t){let n=Math.max(0,Math.round((Date.now()-e)/1e3));if(n<60)return t===`zh`?`刚刚`:`Just now`;let r=Math.round(n/60);if(r<60)return t===`zh`?`${r} 分钟前`:`${r}m ago`;let i=Math.round(r/60);if(i<24)return t===`zh`?`${i} 小时前`:`${i}h ago`;let a=Math.round(i/24);return t===`zh`?`${a} 天前`:`${a}d ago`}function J(e){let t=(0,V.c)(55),{item:n,targetAvailability:r}=e,i=u(X),o;t[0]===i?o=t[1]:(o=l(i),t[0]=i,t[1]=o);let s=o.projectsPage.workHome,d=m(Y),{Icon:f,className:p}=le[n.tone],h;t[2]===p?h=t[3]:(h=c(`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg`,p),t[2]=p,t[3]=h);let g;t[4]!==f||t[5]!==n.status?(g=n.status===`running`?(0,G.jsx)(R,{className:`size-3.5 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,G.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[4]=f,t[5]=n.status,t[6]=g):g=t[6];let _;t[7]!==h||t[8]!==g?(_=(0,G.jsx)(`div`,{className:h,children:g}),t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]===n.title?v=t[11]:(v=(0,G.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=v);let y;t[12]!==s.activityUnread||t[13]!==n.read?(y=n.read?null:(0,G.jsx)(`span`,{className:`mt-1.5 size-1.5 shrink-0 rounded-full bg-accent`,"aria-label":s.activityUnread}),t[12]=s.activityUnread,t[13]=n.read,t[14]=y):y=t[14];let b;t[15]!==v||t[16]!==y?(b=(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[v,y]}),t[15]=v,t[16]=y,t[17]=b):b=t[17];let x;t[18]===n.message?x=t[19]:(x=n.message?(0,G.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.message}):null,t[18]=n.message,t[19]=x);let S;t[20]===n.source?S=t[21]:(S=n.source?(0,G.jsx)(`span`,{className:`max-w-48 truncate`,children:n.source}):null,t[20]=n.source,t[21]=S);let C;t[22]!==n.updatedAt||t[23]!==i?(C=q(n.updatedAt,i),t[22]=n.updatedAt,t[23]=i,t[24]=C):C=t[24];let w;t[25]===C?w=t[26]:(w=(0,G.jsx)(`span`,{children:C}),t[25]=C,t[26]=w);let T;t[27]===n.occurrences?T=t[28]:(T=n.occurrences>1?(0,G.jsxs)(`span`,{children:[`×`,n.occurrences]}):null,t[27]=n.occurrences,t[28]=T);let E;t[29]!==s.activityCheckingRelated||t[30]!==s.activityRelatedMissing||t[31]!==s.activityViewRelated||t[32]!==n.href||t[33]!==r?(E=n.href&&r===`available`?(0,G.jsxs)(a,{to:n.href,className:`inline-flex items-center gap-0.5 font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[s.activityViewRelated,(0,G.jsx)(P,{className:`size-3`,"aria-hidden":!0})]}):n.href&&r===`checking`?(0,G.jsx)(z,{className:`h-3 w-20 rounded`,"aria-label":s.activityCheckingRelated}):n.href&&r===`missing`?(0,G.jsx)(`span`,{className:`font-medium text-fg-subtle`,role:`status`,children:s.activityRelatedMissing}):null,t[29]=s.activityCheckingRelated,t[30]=s.activityRelatedMissing,t[31]=s.activityViewRelated,t[32]=n.href,t[33]=r,t[34]=E):E=t[34];let D;t[35]!==w||t[36]!==T||t[37]!==E||t[38]!==S?(D=(0,G.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] text-fg-subtle`,children:[S,w,T,E]}),t[35]=w,t[36]=T,t[37]=E,t[38]=S,t[39]=D):D=t[39];let O;t[40]!==D||t[41]!==b||t[42]!==x?(O=(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,x,D]}),t[40]=D,t[41]=b,t[42]=x,t[43]=O):O=t[43];let k;t[44]!==n.id||t[45]!==d?(k=()=>d(n.id),t[44]=n.id,t[45]=d,t[46]=k):k=t[46];let A;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,G.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),t[47]=A):A=t[47];let j;t[48]!==s.activityRemove||t[49]!==k?(j=(0,G.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-hover hover:text-fg group-hover:opacity-100 focus:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":s.activityRemove,onClick:k,children:A}),t[48]=s.activityRemove,t[49]=k,t[50]=j):j=t[50];let M;return t[51]!==O||t[52]!==j||t[53]!==_?(M=(0,G.jsxs)(`article`,{className:`group flex items-start gap-3 border-t border-edge-subtle px-1 py-3 first:border-t-0`,children:[_,O,j]}),t[51]=O,t[52]=j,t[53]=_,t[54]=M):M=t[54],M}function Y(e){return e.remove}function X(e){return e.language}function ue(){let e=(0,V.c)(12),t=l(u(ve)).projectsPage.workHome,n=m(_e),r=m(ge),i=m(he),[a,s]=(0,B.useState)(!1),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},e[0]=c):c=e[0];let[d,f]=(0,B.useState)(c),p;e[1]===n?p=e[2]:(p=n.filter(me),e[1]=n,e[2]=p);let g=p.length,_;e[3]===n?_=e[4]:(_=n.filter(pe),e[3]=n,e[4]=_);let v=_.length,y;e[5]!==a||e[6]!==n?(y=a?n:n.slice(0,K),e[5]=a,e[6]=n,e[7]=y):y=e[7];let ee=y,b,x;e[8]===n?(b=e[9],x=e[10]):(b=()=>{let e=new AbortController,t=new Map(n.flatMap(fe));return f(Object.fromEntries([...t.keys()].map($))),Promise.all([...t].map(async t=>{let[n,r]=t,i=await W(r,e.signal);e.signal.aborted||f(e=>({...e,[n]:i}))})).catch(de),()=>e.abort()},x=[n],e[8]=n,e[9]=b,e[10]=x),(0,B.useEffect)(b,x);let S;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,G.jsx)(h,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),e[11]=S):S=e[11],(0,G.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,"aria-labelledby":`workbench-activity-title`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsx)(`div`,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[S,(0,G.jsx)(`h2`,{id:`workbench-activity-title`,className:`text-sm font-semibold text-fg`,children:t.activityTitle}),g>0?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:[(0,G.jsx)(R,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),g,` `,t.running]}):v>0?(0,G.jsxs)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[v,` `,t.activityNew]}):null]})}),a&&n.length>0?(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v>0?(0,G.jsxs)(E,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:r,children:[(0,G.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),t.activityMarkRead]}):null,n.some(Q)?(0,G.jsxs)(E,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-fg-muted`,onClick:i,children:[(0,G.jsx)(N,{className:`size-3.5`,"aria-hidden":!0}),t.activityClearFinished]}):null]}):null]}),n.length>0?(0,G.jsxs)(`div`,{className:`mt-3 px-1`,children:[ee.map(e=>(0,G.jsx)(J,{item:e,targetAvailability:e.href&&U(e.href)?d[e.href]??`checking`:`available`},e.id)),n.length>K?(0,G.jsx)(`div`,{className:`border-t border-edge-subtle py-2 text-center`,children:(0,G.jsx)(E,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>s(Z),children:a?t.activityShowLess:t.activityShowAll.replace(`{{count}}`,String(n.length))})}):null]}):(0,G.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-sm text-fg-muted`,children:[(0,G.jsx)(te,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,G.jsx)(`p`,{children:t.activityEmpty})]})]})}function Z(e){return!e}function Q(e){return e.status===`done`}function de(){}function $(e){return[e,`checking`]}function fe(e){let t=U(e.href);return e.href&&t?[[e.href,t]]:[]}function pe(e){return!e.read}function me(e){return e.status===`running`}function he(e){return e.clearFinished}function ge(e){return e.markAllRead}function _e(e){return e.items}function ve(e){return e.language}function ye(e){return p(f(`/api/home${e?`?locale=${encodeURIComponent(e)}`:``}`))}function be(e,t){return p(f(`/api/proactive/insights/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({status:t})})}function xe(e){return p(f(`/api/proactive/insights/${encodeURIComponent(e)}/approve`),{method:`POST`})}function Se(e,t){return p(f(`/api/focuses/${encodeURIComponent(e)}/calendar/${encodeURIComponent(t)}/prepare`),{method:`POST`})}function Ce(e,t){return p(f(`/api/home/decisions/respond`),{method:`POST`,body:JSON.stringify({...e,decision:t})})}function we(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Te(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:se(n)}function Ee(e){let t=(0,V.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,G.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function De(){let e=(0,V.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,G.jsx)(z,{className:`h-20 rounded-2xl`}),(0,G.jsx)(z,{className:`h-72 rounded-2xl`}),(0,G.jsx)(z,{className:`h-44 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Oe(e){let t=(0,V.c)(19),{item:n,statusLabel:r}=e,i=`/work-items/${encodeURIComponent(n.id)}`,o;t[0]===n.title?o=t[1]:(o=(0,G.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=o);let s;t[2]===n.projectName?s=t[3]:(s=(0,G.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.projectName}),t[2]=n.projectName,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,G.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:r}),t[7]=r,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;t[12]!==n.blockedReason||t[13]!==n.nextAction?(d=n.blockedReason||n.nextAction?(0,G.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.blockedReason||n.nextAction}):null,t[12]=n.blockedReason,t[13]=n.nextAction,t[14]=d):d=t[14];let f;return t[15]!==i||t[16]!==u||t[17]!==d?(f=(0,G.jsxs)(a,{to:i,className:`group block rounded-lg px-1 py-2.5 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,d]}),t[15]=i,t[16]=u,t[17]=d,t[18]=f):f=t[18],f}function ke(e){let t=(0,V.c)(27),{item:n,kindLabel:r,reasonLabel:i,approveLabel:o,denyLabel:s,busy:c,onRespond:l}=e,u;t[0]===n.title?u=t[1]:(u=(0,G.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=u);let d=n.projectName||r,f;t[2]===d?f=t[3]:(f=(0,G.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==u||t[5]!==f?(p=(0,G.jsxs)(`div`,{className:`min-w-0`,children:[u,f]}),t[4]=u,t[5]=f,t[6]=p):p=t[6];let m;t[7]===i?m=t[8]:(m=(0,G.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[p,m]}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===n.detail?g=t[13]:(g=n.detail?(0,G.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.detail}):null,t[12]=n.detail,t[13]=g);let _;t[14]!==n.href||t[15]!==h||t[16]!==g?(_=(0,G.jsxs)(a,{to:n.href,className:`group block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[h,g]}),t[14]=n.href,t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]!==o||t[19]!==c||t[20]!==s||t[21]!==n.response||t[22]!==l?(v=n.response?(0,G.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-warning/20 pt-3`,children:[(0,G.jsx)(E,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`deny`),children:s}),(0,G.jsx)(E,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`approve`),children:o})]}):null,t[18]=o,t[19]=c,t[20]=s,t[21]=n.response,t[22]=l,t[23]=v):v=t[23];let y;return t[24]!==_||t[25]!==v?(y=(0,G.jsxs)(`article`,{className:`rounded-xl border border-warning/35 bg-warning-soft/25 p-3.5 transition-colors hover:bg-warning-soft/40`,children:[_,v]}),t[24]=_,t[25]=v,t[26]=y):y=t[26],y}function Ae(e){let t=(0,V.c)(19),{project:n,openLabel:r,noDescription:i}=e,o=`/projects/${encodeURIComponent(n.id)}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(C,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===n.name?c=t[2]:(c=(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[s,(0,G.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.name})]}),t[1]=n.name,t[2]=c);let l;t[3]===r?l=t[4]:(l=(0,G.jsx)(D,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-label":r}),t[3]=r,t[4]=l);let u;t[5]!==c||t[6]!==l?(u=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d=n.description||n.brief||i,f;t[8]===d?f=t[9]:(f=(0,G.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-5 text-fg-muted`,children:d}),t[8]=d,t[9]=f);let p=n.lastActiveAt??n.updatedAt,m;t[10]===p?m=t[11]:(m=Te(p,``),t[10]=p,t[11]=m);let h;t[12]===m?h=t[13]:(h=(0,G.jsx)(`p`,{className:`mt-auto pt-3 text-[11px] text-fg-subtle`,children:m}),t[12]=m,t[13]=h);let g;return t[14]!==o||t[15]!==h||t[16]!==u||t[17]!==f?(g=(0,G.jsxs)(a,{to:o,className:`group flex min-h-32 flex-col rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,f,h]}),t[14]=o,t[15]=h,t[16]=u,t[17]=f,t[18]=g):g=t[18],g}function je(){let e=u(e=>e.language),t=l(e),n=t.projectsPage,r=i(),o=O(e=>e.setPageHeader),c=O(e=>e.clearPageHeader),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)([]),[h,x]=(0,B.useState)([]),[C,D]=(0,B.useState)(!0),[N,P]=(0,B.useState)(null),[F,I]=(0,B.useState)(null),[R,z]=(0,B.useState)(``),[se,V]=(0,B.useState)(!1),[H,U]=(0,B.useState)(``),[W,K]=(0,B.useState)(!1),[le,q]=(0,B.useState)(null),[J,Y]=(0,B.useState)(null),[X,Z]=(0,B.useState)(null),Q=(0,B.useCallback)(async()=>{D(!0),P(null);try{let[t,n,r]=await Promise.all([ye(e),A({limit:100,sortBy:`updatedAt`,sortOrder:`desc`}),L()]);f(t),m(n.items),x(r)}catch(e){P(e instanceof Error?e.message:String(e))}finally{D(!1)}},[e]);(0,B.useEffect)(()=>{Q()},[Q]);let de=(0,B.useMemo)(()=>{let e=R.trim().toLocaleLowerCase(),t=p.filter(e=>e.status!==`archived`);return e?t.filter(t=>[t.name,t.description,t.brief].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e))):t.slice(0,6)},[p,R]),$=(0,B.useMemo)(()=>d?.decisions??[],[d]),fe=(0,B.useMemo)(()=>d?.work.current.filter(e=>e.status!==`needs_input`&&e.status!==`in_review`&&e.status!==`blocked`).slice(0,10)??[],[d]),pe=(0,B.useCallback)(async t=>{t.preventDefault();let n=H.trim();if(!(!n||W)){K(!0),I(null);try{let t=await w({outcome:n,uiLocale:e});U(``),V(!1),r(`/projects/${encodeURIComponent(t.project.id)}`)}catch(e){I(e instanceof Error?e.message:String(e))}finally{K(!1)}}},[W,e,r,H]),me=(0,B.useMemo)(()=>(0,G.jsxs)(E,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>V(!0),children:[(0,G.jsx)(T,{className:`size-4`,"aria-hidden":!0}),n.workHome.newWork]}),[n.workHome.newWork]),he=(0,B.useCallback)(async(e,t)=>{if(e.response){q(e.id),P(null);try{await Ce(e.response,t),await Q()}catch(e){P(e instanceof Error?e.message:String(e))}finally{q(null)}}},[Q]),ge=(0,B.useCallback)(async(e,t)=>{Y(e.id),P(null);try{let n=e.watches.find(e=>e.kind===t&&e.status===`active`);n?await _(e.id,n.id):await g(e.id,t),x(await L())}catch(e){P(e instanceof Error?e.message:String(e))}finally{Y(null)}},[]),_e=(0,B.useCallback)(async(e,t)=>{Z(e),P(null);try{t===`approved`?await xe(e):await be(e,`dismissed`),f(t=>t&&{...t,proactiveInsights:t.proactiveInsights.filter(t=>t.id!==e)})}catch(e){P(e instanceof Error?e.message:String(e))}finally{Z(null)}},[]),ve=(0,B.useCallback)(async(e,t)=>{Y(e),P(null);try{await Se(e,t),x(await L())}catch(e){P(e instanceof Error?e.message:String(e))}finally{Y(null)}},[]);return(0,B.useLayoutEffect)(()=>(o({startExtra:null,main:(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,G.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.workHome.subtitle})]}),end:me}),()=>c()),[c,me,o,n.title,n.workHome.subtitle]),(0,G.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[1200px] flex-1 flex-col gap-7 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,G.jsx)(k,{open:se,onOpenChange:e=>{!e&&W||(V(e),e||I(null))},children:(0,G.jsxs)(b,{children:[(0,G.jsx)(ae,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,G.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,G.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(M,{className:`text-base font-semibold text-fg`,children:n.workHome.delegateTitle}),(0,G.jsx)(S,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:n.workHome.delegateDescription})]}),(0,G.jsx)(j,{asChild:!0,children:(0,G.jsx)(E,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,disabled:W,children:(0,G.jsx)(ee,{className:`size-4`,"aria-hidden":!0})})})]}),(0,G.jsxs)(`form`,{onSubmit:pe,className:`flex min-h-0 flex-1 flex-col`,children:[(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,children:[(0,G.jsx)(`label`,{htmlFor:`new-work-outcome`,className:`mb-2 shrink-0 text-sm font-medium text-fg`,children:n.workHome.outcomeLabel}),(0,G.jsx)(`textarea`,{id:`new-work-outcome`,className:`min-h-32 w-full flex-1 resize-none rounded-xl border border-edge bg-surface-base p-3 text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,value:H,onChange:e=>U(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},placeholder:n.workHome.outcomePlaceholder,maxLength:12e3,disabled:W,autoFocus:!0}),(0,G.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,G.jsx)(`span`,{children:n.workHome.submitShortcut}),(0,G.jsxs)(`span`,{className:`tabular-nums`,children:[H.length.toLocaleString(),` / `,12e3.toLocaleString()]})]}),F?(0,G.jsx)(`p`,{className:`mt-3 rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:F}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,G.jsx)(j,{asChild:!0,children:(0,G.jsx)(E,{type:`button`,variant:`ghost`,disabled:W,children:n.cancel})}),(0,G.jsxs)(E,{type:`submit`,variant:`primary`,className:`min-w-32`,disabled:W||!H.trim(),children:[(0,G.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),W?n.workHome.delegating:n.workHome.delegate]})]})]})]})]})}),N?(0,G.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`,children:[(0,G.jsx)(`span`,{children:N}),(0,G.jsx)(E,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:n.workHome.retry})]}):null,C?(0,G.jsx)(De,{}):d?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`section`,{className:`border-b border-edge-subtle pb-5`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:n.workHome.briefingTitle}),(0,G.jsx)(`h2`,{className:`mt-1 text-xl font-semibold tracking-tight text-fg`,children:d.decisions.length>0?we(n.workHome.todaySummary,{attention:d.decisions.length,moving:d.briefing.progress.movingCount}):we(n.workHome.todaySummaryClear,{moving:d.briefing.progress.movingCount})}),d.briefing.summary?(0,G.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-fg-muted`,children:d.briefing.summary}):null]}),d.proactiveInsights.length>0?(0,G.jsxs)(`section`,{className:`rounded-2xl border border-accent/20 bg-accent-soft/20 p-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(ie,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,G.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.insightsTitle}),(0,G.jsx)(Ee,{children:n.workHome.insightsBadge})]}),(0,G.jsx)(`div`,{className:`mt-4 space-y-3`,children:d.proactiveInsights.map(e=>(0,G.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,G.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.summary}),(0,G.jsxs)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:[(0,G.jsxs)(`span`,{className:`font-medium text-fg`,children:[n.workHome.whyItMatters,`: `]}),e.whyItMatters]}),(0,G.jsxs)(`p`,{className:`mt-2 rounded-lg bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:[(0,G.jsxs)(`span`,{className:`font-medium text-fg`,children:[n.workHome.suggestedNext,`: `]}),e.nextAction]}),(0,G.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:e.evidence.map((e,t)=>(0,G.jsxs)(`span`,{className:`rounded-full border border-edge-subtle px-2 py-1 text-[11px] text-fg-subtle`,children:[e.label,e.source?` · ${e.source}`:``]},`${e.label}-${t}`))}),(0,G.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-edge-subtle pt-3`,children:[(0,G.jsx)(E,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:X===e.id,onClick:()=>void _e(e.id,`dismissed`),children:n.workHome.dismissInsight}),(0,G.jsx)(E,{type:`button`,variant:`primary`,className:`h-8 px-2 text-xs`,disabled:X===e.id,onClick:()=>void _e(e.id,`approved`),children:n.workHome.investigateInsight})]})]},e.id))})]}):null,d.calendarSignals.length>0?(0,G.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(ne,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,G.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.relatedCalendarTitle}),(0,G.jsx)(Ee,{children:n.workHome.relatedCalendarBadge})]}),(0,G.jsx)(`div`,{className:`mt-4 divide-y divide-edge-subtle`,children:d.calendarSignals.map(e=>(0,G.jsxs)(`article`,{className:`flex flex-col gap-3 py-3 first:pt-0 last:pb-0 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.focusTitle,` · `,Te(e.startsAt,``)]})]}),(0,G.jsx)(E,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2 text-xs`,disabled:J===e.focusId,onClick:()=>void ve(e.focusId,e.id),children:J===e.focusId?n.workHome.focusWatchUpdating:n.workHome.prepareForEvent})]},e.id))})]}):null,h.length>0?(0,G.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(v,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,G.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.focusesTitle}),(0,G.jsx)(Ee,{children:n.workHome.focusesBadge})]}),(0,G.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2`,children:h.slice(0,6).map(e=>{let t=e.watches.some(e=>e.kind===`progress`&&e.status===`active`),r=e.watches.some(e=>e.kind===`intelligence`&&e.status===`active`),i=t||r;return(0,G.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,G.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.summary})]}),(0,G.jsx)(`span`,{className:`mt-0.5 size-2 shrink-0 rounded-full ${i?`bg-success`:`bg-fg-subtle/40`}`,"aria-hidden":!0})]}),e.blockedReason||e.nextAction?(0,G.jsx)(`p`,{className:`mt-3 line-clamp-2 border-t border-edge-subtle pt-3 text-xs leading-5 text-fg-muted`,children:e.blockedReason||e.nextAction}):null,(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:i?n.workHome.focusWatchActive:n.workHome.focusWatchInactive}),(0,G.jsxs)(`div`,{className:`flex gap-1`,children:[(0,G.jsx)(E,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:J===e.id,onClick:()=>void ge(e,`progress`),children:J===e.id?n.workHome.focusWatchUpdating:t?n.workHome.pauseProgressWatch:n.workHome.startFocusWatch}),(0,G.jsx)(E,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:J===e.id,onClick:()=>void ge(e,`intelligence`),children:J===e.id?n.workHome.focusWatchUpdating:r?n.workHome.pauseNewsWatch:n.workHome.startNewsWatch})]})]})]},e.id)})})]}):null,d.work.current.length===0&&d.workflowRuns.active.length===0&&d.decisions.length===0&&d.upcomingAutomations.length===0&&h.length===0?(0,G.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,G.jsx)(re,{className:`mx-auto size-6 text-accent`,"aria-hidden":!0}),(0,G.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.workHome.emptyTitle}),(0,G.jsx)(`p`,{className:`mx-auto mt-1 max-w-lg text-sm leading-6 text-fg-muted`,children:n.workHome.emptyBody}),(0,G.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,G.jsx)(E,{type:`button`,variant:`primary`,onClick:()=>r(`/chat/new`),children:n.workHome.startChat}),(0,G.jsx)(E,{type:`button`,variant:`secondary`,onClick:()=>V(!0),children:n.workHome.startLongWork})]})]}):null,(0,G.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 space-y-6`,children:[$.length>0?(0,G.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(s,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,G.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.needsYou})]}),(0,G.jsx)(`div`,{className:`mt-4 space-y-2`,children:$.map(e=>(0,G.jsx)(ke,{item:e,kindLabel:n.workHome.decisionKinds[e.kind],reasonLabel:n.workHome.decisionReasons[e.reason],approveLabel:n.workHome.approve,denyLabel:n.workHome.deny,busy:le===e.id,onRespond:t=>void he(e,t)},e.id))})]}):(0,G.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,G.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full bg-success-soft text-xs text-success`,"aria-hidden":!0,children:`✓`}),n.workHome.nothingNeedsYou]}),(0,G.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(te,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,G.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.continueTitle})]}),(0,G.jsxs)(`div`,{className:`mt-4 divide-y divide-edge-subtle px-1`,children:[d.workflowRuns.active.map(e=>(0,G.jsxs)(a,{to:oe(e.id),className:`flex items-center justify-between gap-3 rounded-lg px-2 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-accent`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.title})]}),(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.workHome.running})]},e.id)),fe.map(e=>(0,G.jsx)(`div`,{className:`py-1`,children:(0,G.jsx)(Oe,{item:e,statusLabel:t.projectDetailPage.workItems.statuses[e.status]})},e.id)),d.workflowRuns.active.length===0&&fe.length===0?(0,G.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:n.workHome.noCurrentWork}):null]})]})]}),(0,G.jsxs)(`aside`,{className:`min-w-0 space-y-4`,"aria-label":n.workHome.nowTitle,children:[(0,G.jsx)(`div`,{className:`px-1`,children:(0,G.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.nowTitle})}),d.upcomingAutomations.length>0?(0,G.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ne,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.workHome.scheduled})]}),(0,G.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle`,children:d.upcomingAutomations.slice(0,3).map(e=>(0,G.jsxs)(a,{to:`/automations`,className:`flex items-center justify-between gap-3 rounded-lg px-1 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.name||e.action}),(0,G.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:Te(e.nextRunAt,n.never)})]},e.id))})]}):null,(0,G.jsx)(ue,{}),d.briefing.wins.length>0?(0,G.jsxs)(a,{to:d.briefing.wins[0].href,className:`flex items-center justify-between gap-3 rounded-xl px-2 py-2 text-sm text-fg-muted hover:bg-surface-hover/55 hover:text-fg`,children:[(0,G.jsx)(`span`,{children:we(n.workHome.completedSummary,{count:d.briefing.wins.length})}),(0,G.jsxs)(`span`,{className:`shrink-0 text-xs font-medium text-accent`,children:[n.workHome.viewLatestResult,` →`]})]}):null]})]})]}):null,(0,G.jsxs)(`section`,{className:`border-t border-edge-subtle pt-7`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.workHome.spacesTitle}),(0,G.jsx)(a,{to:`/projects`,className:`text-xs font-medium text-accent hover:underline`,children:n.management.viewAll})]}),p.filter(e=>e.status!==`archived`).length>6?(0,G.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,G.jsxs)(`label`,{className:`relative block min-w-0`,children:[(0,G.jsx)(ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,G.jsx)(`input`,{className:`h-9 w-52 rounded-lg border border-edge bg-surface-panel pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:R,onChange:e=>z(e.target.value),placeholder:n.searchPlaceholder,"aria-label":n.searchPlaceholder})]})}):null,(0,G.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:de.map(e=>(0,G.jsx)(Ae,{project:e,openLabel:n.workHome.openSpace,noDescription:n.noDescription},e.id))}),!C&&de.length===0?(0,G.jsx)(`p`,{className:`py-8 text-center text-sm text-fg-muted`,children:n.workHome.noSpaces}):null]})]})}export{je as WorkPage};