@xopcai/xopc 0.0.159 → 0.0.161

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 (215) 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/{action-boundary-settings-panel-CaRK2vIy.js → action-boundary-settings-panel-BIVBUiNT.js} +1 -1
  4. package/dist/gateway/static/root/assets/activity-store-o7GRljfD.js +1 -0
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BeVf03hx.js → agent-avatar-dicebear-9R3szLMc.js} +1 -1
  6. package/dist/gateway/static/root/assets/agents-_qbUaYbs.js +2 -0
  7. package/dist/gateway/static/root/assets/{api-BjcBIV2O.js → api-jSTqFMq9.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-BG2ulMYw.js → app-management-settings-panel-D81cyE76.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-0Kjenr2T.js → appearance-settings-Ct6bZQCV.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-0sPqD0FK.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-ChiNnH1e.js → archive-plugin-CfD7AZKn.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-pbBlQR-g.js → attachment-load-CP_Gaxt3.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automation-suggestion-card-CTZDOyDy.js → automation-suggestion-card-BGKM_NDZ.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-page-BxWBuBsE.js +6 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-BeZGzpGF.js → binary-plugins-IPr2EVnS.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-BnDmhN5Z.js → block-editor-B6aHEGA6.js} +3 -3
  17. package/dist/gateway/static/root/assets/browser-settings-page-C499b9AH.js +8 -0
  18. package/dist/gateway/static/root/assets/{capability-presets-api-Ii36j_7v.js → capability-presets-api-CCX9-LjU.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-Cl3dw4yh.js → capability-presets-settings-panel-Dva9SiPK.js} +2 -2
  20. package/dist/gateway/static/root/assets/{channel-recipient-api-CFqrSi5K.js → channel-recipient-api-MmLMLDWf.js} +1 -1
  21. package/dist/gateway/static/root/assets/channels-settings-DNAU7u9o.js +1 -0
  22. package/dist/gateway/static/root/assets/channels-status-swr-CIOH7tgn.js +1 -0
  23. package/dist/gateway/static/root/assets/check-DUBLcKHA.js +1 -0
  24. package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +1 -0
  25. package/dist/gateway/static/root/assets/cn-JdwAhgNB.js +1 -0
  26. package/dist/gateway/static/root/assets/{connector-logo-CiLxuZ8S.js → connector-logo-BbjzIs87.js} +1 -1
  27. package/dist/gateway/static/root/assets/connectors-page-TwiBp8vY.js +2 -0
  28. package/dist/gateway/static/root/assets/createLucideIcon-DPHK1VkS.js +1 -0
  29. package/dist/gateway/static/root/assets/desktop-pet-CYH5ZSXy.js +1 -0
  30. package/dist/gateway/static/root/assets/desktop-pet-settings-DQLqGLc0.js +1 -0
  31. package/dist/gateway/static/root/assets/desktop-pet-sprite-DTqXSpqf.js +1 -0
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-CC2VL5Mc.js → directory-picker-path-field-ClsiXhmz.js} +1 -1
  33. package/dist/gateway/static/root/assets/{dreaming-settings-KY7ZfVsy.js → dreaming-settings-CjMPPdzg.js} +3 -3
  34. package/dist/gateway/static/root/assets/{extension-debug-page-C8KBeucs.js → extension-debug-page-57eizjhB.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-page-CV-5Kcyk.js → extension-page-CsbSb3u1.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-settings-page-DvUtDrAu.js → extension-settings-page-DKA9-lyP.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-api-DXfVeJLc.js → gateway-config-api-DIPJuzBZ.js} +1 -1
  38. package/dist/gateway/static/root/assets/gateway-settings-CDLqAQY7.js +1 -0
  39. package/dist/gateway/static/root/assets/{gateway-startup-retry-cxQ94qMm.js → gateway-startup-retry-DrfSJtvT.js} +1 -1
  40. package/dist/gateway/static/root/assets/goal-create-dialog-Q3B0E-0s.js +1 -0
  41. package/dist/gateway/static/root/assets/goal-detail-page-C5VAK04G.js +4 -0
  42. package/dist/gateway/static/root/assets/{goals-config-api-P8VhLqYF.js → goals-config-api-lGC10UkU.js} +1 -1
  43. package/dist/gateway/static/root/assets/goals-page-BJb-5IYw.js +2 -0
  44. package/dist/gateway/static/root/assets/{goals-settings-DHXyaH_O.js → goals-settings-BWq0pdrA.js} +1 -1
  45. package/dist/gateway/static/root/assets/{heartbeat-settings-CNckP_Dv.js → heartbeat-settings-D4o8BJVv.js} +1 -1
  46. package/dist/gateway/static/root/assets/index-CkUHH170.css +1 -0
  47. package/dist/gateway/static/root/assets/index-vq_cJZJC.js +199 -0
  48. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-jXmv1RVX.js → keyboard-shortcuts-settings-6T2QYehS.js} +1 -1
  49. package/dist/gateway/static/root/assets/local-app-workbench-page-euH17Kvb.js +2 -0
  50. package/dist/gateway/static/root/assets/{local-apps-page-Cs5LKjtc.js → local-apps-page-DCjg2K9f.js} +1 -1
  51. package/dist/gateway/static/root/assets/{locale-store-C_M71MK9.js → locale-store-Dar-xqQr.js} +1 -1
  52. package/dist/gateway/static/root/assets/logs-page-CyYCBqym.js +7 -0
  53. package/dist/gateway/static/root/assets/{markdown-split-BFqeSNte.js → markdown-split-rt1XO43g.js} +1 -1
  54. package/dist/gateway/static/root/assets/{media-plugins-Cc8379gq.js → media-plugins-Bwo8CJuh.js} +1 -1
  55. package/dist/gateway/static/root/assets/messages-CxySDn9d.js +5 -0
  56. package/dist/gateway/static/root/assets/models-hub-panel-DObxxjc9.js +2 -0
  57. package/dist/gateway/static/root/assets/{notes-page-DlGU4ipo.js → notes-page-Dp-pkX7d.js} +1 -1
  58. package/dist/gateway/static/root/assets/notes-workbench-CCb4RXcZ.js +4 -0
  59. package/dist/gateway/static/root/assets/{page-tabs-kFOswGlG.js → page-tabs-CzZ4iKOb.js} +1 -1
  60. package/dist/gateway/static/root/assets/{preview-open-alternatives-CvjuvABg.js → preview-open-alternatives-3E_Qa-58.js} +1 -1
  61. package/dist/gateway/static/root/assets/product-delivery-BTRT9kCS.js +1 -0
  62. package/dist/gateway/static/root/assets/product-open-page-B2T48Sbt.js +1 -0
  63. package/dist/gateway/static/root/assets/project-detail-page-BvEcriRC.js +1 -0
  64. package/dist/gateway/static/root/assets/projects-page-B_e79MRJ.js +1 -0
  65. package/dist/gateway/static/root/assets/remote-access-hub-DGcqnYfR.js +1 -0
  66. package/dist/gateway/static/root/assets/{save-bar-controls-DwrD7ODx.js → save-bar-controls-CkeKasGm.js} +1 -1
  67. package/dist/gateway/static/root/assets/{schedule-field-Ba4WzTmE.js → schedule-field-TkqUL3wm.js} +1 -1
  68. package/dist/gateway/static/root/assets/{schema-form-DvydL8eF.js → schema-form-DC-iU5IG.js} +1 -1
  69. package/dist/gateway/static/root/assets/sessions-page-DQZhrDJ8.js +1 -0
  70. package/dist/gateway/static/root/assets/settings-advanced-gate-BkdeN99Y.js +1 -0
  71. package/dist/gateway/static/root/assets/{settings-collapsible-section-LaQqGGej.js → settings-collapsible-section-Dpqth3oA.js} +1 -1
  72. package/dist/gateway/static/root/assets/{settings-form-section-DruI__qO.js → settings-form-section-CNqF6IwY.js} +1 -1
  73. package/dist/gateway/static/root/assets/{settings-loading-skeleton-UvA-eDhF.js → settings-loading-skeleton-DkvwitK_.js} +1 -1
  74. package/dist/gateway/static/root/assets/{settings-page-layout-DG-XMIPu.js → settings-page-layout-DWvNgISx.js} +1 -1
  75. package/dist/gateway/static/root/assets/{settings-page-5oCGSebm.js → settings-page-qPG7I2zd.js} +1 -1
  76. package/dist/gateway/static/root/assets/setup-status-panel-lwRAh9aw.js +1 -0
  77. package/dist/gateway/static/root/assets/{share-preview-page-FLVeTrRt.js → share-preview-page-DGpSPW-n.js} +1 -1
  78. package/dist/gateway/static/root/assets/shares-settings-BGj9IVUr.js +1 -0
  79. package/dist/gateway/static/root/assets/skill-reload-api-B2UBAs5U.js +1 -0
  80. package/dist/gateway/static/root/assets/skills-page-DdjzFZ8I.js +2 -0
  81. package/dist/gateway/static/root/assets/{system-settings-panel-CeK93xVi.js → system-settings-panel-8TxxSbUw.js} +1 -1
  82. package/dist/gateway/static/root/assets/{theme-store-C8ohIHhw.js → theme-store-B5FzMWOx.js} +1 -1
  83. package/dist/gateway/static/root/assets/{typed-models-lib-D1Lr2gG0.js → typed-models-lib-DEGtSA5h.js} +1 -1
  84. package/dist/gateway/static/root/assets/{use-channel-catalog-BWzou5ar.js → use-channel-catalog-BDU6FneG.js} +1 -1
  85. package/dist/gateway/static/root/assets/user-context-page-BTTZpAGV.js +1 -0
  86. package/dist/gateway/static/root/assets/voice-api-key-field-DuDQd-WU.js +1 -0
  87. package/dist/gateway/static/root/assets/work-discovery-page-BUVkVCsW.js +1 -0
  88. package/dist/gateway/static/root/assets/work-item-detail-page-DeEPPu4n.js +1 -0
  89. package/dist/gateway/static/root/assets/work-page-DQNUyTUq.js +1 -0
  90. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Bynqe4kV.js → workflow-run-setup-panel-Cwi8Pz7n.js} +2 -2
  91. package/dist/gateway/static/root/assets/workflows-page-BIy4wrzO.js +11 -0
  92. package/dist/gateway/static/root/index.html +12 -10
  93. package/dist/package.js +1 -1
  94. package/dist/src/automations/service/action-executor.js +1 -1
  95. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  96. package/dist/src/config/agent-profile.js +1 -1
  97. package/dist/src/gateway/agents-admin.js +1 -1
  98. package/dist/src/gateway/chat-stream/mapper.d.ts +1 -0
  99. package/dist/src/gateway/chat-stream/mapper.js +43 -7
  100. package/dist/src/gateway/hono/routes/home.js +15 -2
  101. package/dist/src/gateway/hono/routes/work-discovery.js +451 -0
  102. package/dist/src/gateway/hono/sse.d.ts +2 -0
  103. package/dist/src/gateway/hono/sse.js +10 -3
  104. package/dist/src/gateway/run-loop.js +17 -7
  105. package/dist/src/gateway/server.d.ts +1 -0
  106. package/dist/src/gateway/server.js +9 -0
  107. package/dist/src/gateway/service.d.ts +2 -0
  108. package/dist/src/gateway/service.js +27 -2
  109. package/dist/src/local-apps/preview-runtime-bridge.d.ts +1 -1
  110. package/dist/src/local-apps/preview-runtime-bridge.js +14 -11
  111. package/dist/src/mobile/notification-service.js +1 -0
  112. package/dist/src/pets/factory.js +23 -26
  113. package/dist/src/pets/manifest.d.ts +2 -1
  114. package/dist/src/pets/manifest.js +15 -8
  115. package/dist/src/pets/validator.js +8 -3
  116. package/dist/src/proactive/calendar-signals.d.ts +4 -0
  117. package/dist/src/proactive/calendar-signals.js +120 -0
  118. package/dist/src/proactive/focus-service.d.ts +62 -0
  119. package/dist/src/proactive/focus-service.js +173 -0
  120. package/dist/src/proactive/index.d.ts +7 -0
  121. package/dist/src/proactive/index.js +7 -0
  122. package/dist/src/proactive/insight-repository.d.ts +19 -0
  123. package/dist/src/proactive/insight-repository.js +106 -0
  124. package/dist/src/proactive/run-processor.d.ts +19 -0
  125. package/dist/src/proactive/run-processor.js +125 -0
  126. package/dist/src/proactive/trial-expiry-reconciler.d.ts +5 -0
  127. package/dist/src/proactive/trial-expiry-reconciler.js +30 -0
  128. package/dist/src/proactive/types.d.ts +64 -0
  129. package/dist/src/proactive/types.js +1 -0
  130. package/dist/src/proactive/watch-repository.d.ts +28 -0
  131. package/dist/src/proactive/watch-repository.js +129 -0
  132. package/dist/src/storage/sqlite/knowledge-repository.d.ts +1 -0
  133. package/dist/src/storage/sqlite/knowledge-repository.js +4 -0
  134. package/dist/src/storage/sqlite/migrations/047_work_discovery_sources.sql +16 -0
  135. package/dist/src/storage/sqlite/migrations/048_work_understanding_investigations.sql +40 -0
  136. package/dist/src/storage/sqlite/migrations/049_work_understanding_threads.sql +52 -0
  137. package/dist/src/storage/sqlite/migrations/050_work_discovery_source_refreshes.sql +15 -0
  138. package/dist/src/storage/sqlite/migrations/051_focus_watches.sql +26 -0
  139. package/dist/src/storage/sqlite/migrations/052_proactive_insights.sql +25 -0
  140. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  141. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  142. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  143. package/dist/src/storage/sqlite/schema.js +1 -1
  144. package/dist/src/work-discovery/analyzer.d.ts +12 -1
  145. package/dist/src/work-discovery/analyzer.js +126 -7
  146. package/dist/src/work-discovery/candidate-discovery.d.ts +17 -0
  147. package/dist/src/work-discovery/candidate-discovery.js +279 -0
  148. package/dist/src/work-discovery/evaluation.d.ts +11 -0
  149. package/dist/src/work-discovery/evaluation.js +17 -0
  150. package/dist/src/work-discovery/governance.d.ts +25 -0
  151. package/dist/src/work-discovery/governance.js +96 -0
  152. package/dist/src/work-discovery/incremental-repository.d.ts +13 -0
  153. package/dist/src/work-discovery/incremental-repository.js +55 -0
  154. package/dist/src/work-discovery/incremental.d.ts +2 -0
  155. package/dist/src/work-discovery/incremental.js +7 -0
  156. package/dist/src/work-discovery/index.d.ts +10 -0
  157. package/dist/src/work-discovery/index.js +13 -3
  158. package/dist/src/work-discovery/investigation-repository.d.ts +16 -0
  159. package/dist/src/work-discovery/investigation-repository.js +122 -0
  160. package/dist/src/work-discovery/investigator.d.ts +55 -0
  161. package/dist/src/work-discovery/investigator.js +358 -0
  162. package/dist/src/work-discovery/probe.d.ts +22 -0
  163. package/dist/src/work-discovery/probe.js +88 -1
  164. package/dist/src/work-discovery/service.d.ts +110 -1
  165. package/dist/src/work-discovery/service.js +578 -8
  166. package/dist/src/work-discovery/source-repository.d.ts +13 -0
  167. package/dist/src/work-discovery/source-repository.js +72 -0
  168. package/dist/src/work-discovery/thread-repository.d.ts +34 -0
  169. package/dist/src/work-discovery/thread-repository.js +112 -0
  170. package/dist/src/work-discovery/thread-service.d.ts +8 -0
  171. package/dist/src/work-discovery/thread-service.js +104 -0
  172. package/dist/src/work-discovery/types.d.ts +145 -0
  173. package/package.json +1 -1
  174. package/skills/creative/hatch-pet/SKILL.md +2 -2
  175. package/dist/gateway/static/root/assets/activity-store-C-57rvkX.js +0 -1
  176. package/dist/gateway/static/root/assets/agents-P05C4A-3.js +0 -2
  177. package/dist/gateway/static/root/assets/apps-page-DANGrBpN.js +0 -1
  178. package/dist/gateway/static/root/assets/automations-page-BXfGL_cm.js +0 -6
  179. package/dist/gateway/static/root/assets/browser-settings-page-534luV0B.js +0 -8
  180. package/dist/gateway/static/root/assets/channels-settings-M91zFJVi.js +0 -1
  181. package/dist/gateway/static/root/assets/channels-status-swr-vooEF4lG.js +0 -1
  182. package/dist/gateway/static/root/assets/check-BODqo66o.js +0 -1
  183. package/dist/gateway/static/root/assets/circle-alert-RzVebuX2.js +0 -1
  184. package/dist/gateway/static/root/assets/cn-BQ_8x0bT.js +0 -1
  185. package/dist/gateway/static/root/assets/connectors-page-CV5UulW6.js +0 -2
  186. package/dist/gateway/static/root/assets/desktop-pet-Cil2eSpW.js +0 -1
  187. package/dist/gateway/static/root/assets/desktop-pet-settings-DwsC6l5F.js +0 -1
  188. package/dist/gateway/static/root/assets/desktop-pet-sprite-DqZ6fbIj.js +0 -1
  189. package/dist/gateway/static/root/assets/gateway-settings-BpJ0v56l.js +0 -1
  190. package/dist/gateway/static/root/assets/goal-create-dialog-lMHD-2CX.js +0 -1
  191. package/dist/gateway/static/root/assets/goal-detail-page-yPmF-G7b.js +0 -4
  192. package/dist/gateway/static/root/assets/goals-page-BHTCKobG.js +0 -2
  193. package/dist/gateway/static/root/assets/index-BgZhEOkN.css +0 -1
  194. package/dist/gateway/static/root/assets/index-BuqGh2SW.js +0 -193
  195. package/dist/gateway/static/root/assets/local-app-workbench-page-zpp_wciE.js +0 -2
  196. package/dist/gateway/static/root/assets/logs-page-B4CRYqYR.js +0 -7
  197. package/dist/gateway/static/root/assets/messages-BuT0SR1R.js +0 -5
  198. package/dist/gateway/static/root/assets/models-hub-panel-1hdoAoB_.js +0 -2
  199. package/dist/gateway/static/root/assets/notes-workbench-DQEAZTA5.js +0 -4
  200. package/dist/gateway/static/root/assets/project-detail-page-Bp9bC7A6.js +0 -1
  201. package/dist/gateway/static/root/assets/projects-page-RNorFXTw.js +0 -1
  202. package/dist/gateway/static/root/assets/remote-access-hub-BqRTcM_6.js +0 -1
  203. package/dist/gateway/static/root/assets/sessions-page-B2EfW1cm.js +0 -1
  204. package/dist/gateway/static/root/assets/settings-advanced-gate-CklL85T4.js +0 -1
  205. package/dist/gateway/static/root/assets/setup-status-panel-D3my1HgB.js +0 -1
  206. package/dist/gateway/static/root/assets/shares-settings-DVxgjrsP.js +0 -1
  207. package/dist/gateway/static/root/assets/skill-reload-api-Bcu58ZaF.js +0 -1
  208. package/dist/gateway/static/root/assets/skills-page-CDd-84FE.js +0 -2
  209. package/dist/gateway/static/root/assets/sliding-segmented-uWmrxE3P.js +0 -1
  210. package/dist/gateway/static/root/assets/user-context-page-1OyJnTyR.js +0 -1
  211. package/dist/gateway/static/root/assets/voice-api-key-field-B2ncRwHS.js +0 -1
  212. package/dist/gateway/static/root/assets/work-discovery-page-BZlY4PZL.js +0 -1
  213. package/dist/gateway/static/root/assets/work-item-detail-page-DPXMrneY.js +0 -1
  214. package/dist/gateway/static/root/assets/work-page-CTERoqyv.js +0 -1
  215. package/dist/gateway/static/root/assets/workflows-page-CLgsnqFQ.js +0 -11
@@ -0,0 +1,2 @@
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,u as s}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-CxySDn9d.js";import{l as u,n as d}from"./locale-store-Dar-xqQr.js";import{i as f}from"./theme-store-B5FzMWOx.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{$c as m,$o as h,Ar as g,Bi as _,Bo as v,Br as y,C as b,Cu as x,Dl as S,Es as C,Fi as w,Fl as T,Fr as E,Ho as D,Hr as O,Ii as k,Ir as A,It as j,Li as M,Lr as N,Ls as P,Mi as F,Ml as I,Mr as L,Ni as R,Nr as ee,Ns as te,Oc as ne,Pi as re,Pl as z,Pr as B,Ps as V,Qs as ie,Ro as ae,Rr as H,Rs as U,Rt as W,Sc as G,Sl as K,Ss as q,Ts as oe,Uo as se,Ur as ce,Va as le,Vc as ue,Vo as de,Vr as fe,Wo as pe,Wr as me,Xa as J,Xs as he,Ya as ge,Yo as _e,_a as ve,_n as ye,ac as be,as as xe,ba as Se,bo as Ce,bs as we,bu as Te,cc as Ee,cs as Y,dn as De,du as Oe,ec as ke,el as Ae,fa as je,ga as Me,gn as Ne,gs as Pe,gu as Fe,ha as Ie,hc as Le,hs as Re,is as ze,ji as Be,jr as Ve,js as He,kr as Ue,ls as We,lu as X,ma as Ge,mu as Ke,n as qe,ns as Je,ol as Ye,os as Xe,pa as Ze,pn as Qe,r as $e,rs as et,ss as tt,ts as nt,va as rt,vn as it,w as at,xs as ot,ya as st,yc as ct,yo as lt,zo as ut,zr as dt}from"./index-vq_cJZJC.js";import{t as ft}from"./markdown-editor-BvUebh3C.js";import{n as pt,r as mt}from"./settings-page-layout-DWvNgISx.js";import{r as ht,t as gt}from"./settings-loading-skeleton-DkvwitK_.js";import{n as _t,t as vt}from"./settings-form-section-CNqF6IwY.js";import{t as yt}from"./page-tabs-CzZ4iKOb.js";import{n as bt}from"./agent-avatar-dicebear-9R3szLMc.js";import{a as xt,o as St,r as Ct,s as wt}from"./capability-presets-api-CCX9-LjU.js";import{a as Tt,i as Et,n as Dt,o as Ot,t as kt}from"./typed-models-lib-DEGtSA5h.js";import{n as At,r as jt,t as Mt}from"./channel-recipient-api-MmLMLDWf.js";import{t as Nt}from"./directory-picker-path-field-ClsiXhmz.js";var Z=n(),Q=r();function Pt(e){let t=(0,Z.c)(40),{open:n,onOpenChange:r,busy:i,deletePurge:a,deleteTarget:o,deleteConfirmText:s,onDeleteConfirmTextChange:l,onConfirm:u,onCancel:d,a:f}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(D,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=t[0];let m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=c(`fixed left-1/2 top-1/2 z-[81] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),t[1]=m):m=t[1];let h=a?f.purgeDisk:f.removeFromConfig,g;t[2]===h?g=t[3]:(g=(0,Q.jsx)(pe,{className:`text-base font-semibold text-fg`,children:h}),t[2]=h,t[3]=g);let _=a?f.confirmDeletePurge:f.confirmDelete,y;t[4]===_?y=t[5]:(y=(0,Q.jsx)(de,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:_}),t[4]=_,t[5]=y);let b;t[6]!==f.purgeConfirmHint||t[7]!==f.purgeConfirmLabel||t[8]!==f.purgeConfirmPlaceholder||t[9]!==s||t[10]!==a||t[11]!==o||t[12]!==l?(b=a&&o?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:f.purgeConfirmLabel}),(0,Q.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:c(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:f.purgeConfirmPlaceholder.replace(`{{agentId}}`,o.id),value:s,onChange:e=>l(e.target.value)}),(0,Q.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:f.purgeConfirmHint.replace(`{{agentId}}`,o.id)})]}):null,t[6]=f.purgeConfirmHint,t[7]=f.purgeConfirmLabel,t[8]=f.purgeConfirmPlaceholder,t[9]=s,t[10]=a,t[11]=o,t[12]=l,t[13]=b):b=t[13];let x;t[14]!==f.createModalCancel||t[15]!==i||t[16]!==d?(x=(0,Q.jsx)(q,{type:`button`,variant:`ghost`,disabled:i,onClick:d,children:f.createModalCancel}),t[14]=f.createModalCancel,t[15]=i,t[16]=d,t[17]=x):x=t[17];let S=a?`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`:void 0,C;t[18]!==i||t[19]!==s||t[20]!==a||t[21]!==o?(C=i||!o||a&&s.trim().toLowerCase()!==o.id.toLowerCase(),t[18]=i,t[19]=s,t[20]=a,t[21]=o,t[22]=C):C=t[22];let w=a?f.purgeDisk:f.removeFromConfig,T;t[23]!==u||t[24]!==C||t[25]!==w||t[26]!==S?(T=(0,Q.jsx)(q,{type:`button`,variant:`secondary`,className:S,disabled:C,onClick:u,children:w}),t[23]=u,t[24]=C,t[25]=w,t[26]=S,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==x?(E=(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[x,T]}),t[28]=T,t[29]=x,t[30]=E):E=t[30];let O;t[31]!==E||t[32]!==g||t[33]!==y||t[34]!==b?(O=(0,Q.jsxs)(se,{children:[p,(0,Q.jsxs)(v,{className:m,onOpenAutoFocus:Ft,children:[g,y,b,E]})]}),t[31]=E,t[32]=g,t[33]=y,t[34]=b,t[35]=O):O=t[35];let k;return t[36]!==r||t[37]!==n||t[38]!==O?(k=(0,Q.jsx)(ae,{open:n,onOpenChange:r,children:O}),t[36]=r,t[37]=n,t[38]=O,t[39]=k):k=t[39],k}function Ft(e){return e.preventDefault()}var $=e(t(),1),It=[{id:`overview`,labelKey:`navOverview`,icon:K},{id:`profile`,labelKey:`navProfile`,icon:ie},{id:`capabilities`,labelKey:`navCapabilities`,icon:Ke},{id:`runtime`,labelKey:`navRuntime`,icon:be},{id:`connections`,labelKey:`navConnections`,icon:X},{id:`advanced`,labelKey:`navAdvanced`,icon:ke},{id:`dangerZone`,labelKey:`navDangerZone`,icon:P}];function Lt(e){let t=(0,Z.c)(11),{a:n,panel:r,onPanelChange:i}=e,a;t[0]!==i||t[1]!==r?(a=(e,t,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:c(`flex w-auto shrink-0 items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors sm:w-full`,Pe.press,r===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Q.jsx)(n,{className:`size-4 shrink-0 opacity-90`,strokeWidth:2,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]},e),t[0]=i,t[1]=r,t[2]=a):a=t[2];let o=a,s=n.editorNavAria,l;t[3]!==n||t[4]!==o?(l=It.map(e=>{let{id:t,labelKey:r,icon:i}=e;return o(t,n[r],i)}),t[3]=n,t[4]=o,t[5]=l):l=t[5];let u;t[6]===l?u=t[7]:(u=(0,Q.jsx)(`div`,{className:`flex gap-1 pb-1 sm:flex-col sm:gap-0.5 sm:pb-0`,children:l}),t[6]=l,t[7]=u);let d;return t[8]!==n.editorNavAria||t[9]!==u?(d=(0,Q.jsx)(`nav`,{className:`w-full overflow-x-auto sm:overflow-visible`,"aria-label":s,children:u}),t[8]=n.editorNavAria,t[9]=u,t[10]=d):d=t[10],d}function Rt(e){let t=(0,Z.c)(45),{open:n,onOpenChange:r,a:i,title:a,subtitle:o,panel:s,onPanelChange:l,onFooterSave:u,footerSaveDisabled:d,footerSavedFlash:f,showFooter:p,busy:m,children:h}=e,g=p===void 0?!0:p,[_,y]=(0,$.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(D,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ze)}),t[0]=b):b=t[0];let x;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(x=c(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,et,`inset-4 h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] min-h-0`,`sm:inset-auto sm:left-1/2 sm:top-1/2 sm:h-[min(88vh,48rem)] sm:max-h-[min(88vh,48rem)] sm:min-h-[32rem] sm:w-[min(100%-2rem,58rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=x):x=t[1];let S;t[2]===a?S=t[3]:(S=(0,Q.jsx)(pe,{className:`text-base font-semibold leading-snug text-fg`,children:a}),t[2]=a,t[3]=S);let C;t[4]===o?C=t[5]:(C=(0,Q.jsx)(de,{className:`mt-1 font-mono text-xs text-fg-muted`,children:o}),t[4]=o,t[5]=C);let w;t[6]!==S||t[7]!==C?(w=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[S,C]}),t[6]=S,t[7]=C,t[8]=w):w=t[8];let T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=c(Re,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=T):T=t[9];let E;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),t[10]=E):E=t[10];let O;t[11]===i.closeDialogAria?O=t[12]:(O=(0,Q.jsx)(ut,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:T,"aria-label":i.closeDialogAria,children:E})}),t[11]=i.closeDialogAria,t[12]=O);let k;t[13]!==w||t[14]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-edge-subtle px-4 pb-3 pt-4 dark:border-edge`,children:[w,O]}),t[13]=w,t[14]=O,t[15]=k):k=t[15];let A;t[16]!==i||t[17]!==l||t[18]!==s?(A=(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-4 py-3 dark:border-edge sm:flex sm:w-56 sm:shrink-0 sm:flex-col sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-0 sm:py-4 sm:pl-4 sm:pr-3`,children:(0,Q.jsx)(Lt,{a:i,panel:s,onPanelChange:l})}),t[16]=i,t[17]=l,t[18]=s,t[19]=A):A=t[19];let j;t[20]===h?j=t[21]:(j=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:h}),t[20]=h,t[21]=j);let M;t[22]!==i.footerSaveNotApplicable||t[23]!==i.personaSaved||t[24]!==i.save||t[25]!==m||t[26]!==d||t[27]!==f||t[28]!==u||t[29]!==g?(M=g?(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-t border-edge-subtle px-4 py-3 dark:border-edge sm:flex-row sm:items-center sm:justify-end sm:gap-3`,children:[f?(0,Q.jsxs)(`p`,{className:`order-2 text-center text-xs font-medium text-green-600 sm:order-1 sm:mr-auto sm:text-left dark:text-green-400`,children:[`✓ `,i.personaSaved]}):d?(0,Q.jsx)(`p`,{className:`order-2 text-center text-xs text-fg-muted sm:order-1 sm:mr-auto sm:text-left`,children:i.footerSaveNotApplicable}):null,(0,Q.jsx)(q,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:m||d,onClick:()=>void u(),children:i.save})]}):null,t[22]=i.footerSaveNotApplicable,t[23]=i.personaSaved,t[24]=i.save,t[25]=m,t[26]=d,t[27]=f,t[28]=u,t[29]=g,t[30]=M):M=t[30];let N;t[31]!==j||t[32]!==M?(N=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[j,M]}),t[31]=j,t[32]=M,t[33]=N):N=t[33];let P;t[34]!==A||t[35]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[A,N]}),t[34]=A,t[35]=N,t[36]=P):P=t[36];let F;t[37]!==_||t[38]!==P||t[39]!==k?(F=(0,Q.jsxs)(se,{children:[b,(0,Q.jsx)(v,{ref:y,className:x,onOpenAutoFocus:zt,children:(0,Q.jsxs)(Je,{layer:`modal`,portalContainer:_,children:[k,P]})})]}),t[37]=_,t[38]=P,t[39]=k,t[40]=F):F=t[40];let I;return t[41]!==r||t[42]!==n||t[43]!==F?(I=(0,Q.jsx)(ae,{open:n,onOpenChange:r,children:F}),t[41]=r,t[42]=n,t[43]=F,t[44]=I):I=t[44],I}function zt(e){return e.preventDefault()}function Bt(e){let t=(0,Z.c)(28),{label:n,mode:r,value:i,inheritedFrom:a,inheritLabel:o,overrideLabel:s,onClick:l}=e,u;t[0]===n?u=t[1]:(u=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=u);let d=i||`—`,f;t[2]===d?f=t[3]:(f=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==a||t[5]!==r?(p=r===`inherit`&&a?(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:a}):null,t[4]=a,t[5]=r,t[6]=p):p=t[6];let m;t[7]!==u||t[8]!==f||t[9]!==p?(m=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[u,f,p]}),t[7]=u,t[8]=f,t[9]=p,t[10]=m):m=t[10];let h=r===`inherit`?`bg-surface-hover text-fg-muted`:`bg-accent-soft text-accent-fg`,g;t[11]===h?g=t[12]:(g=c(`mt-2 inline-flex shrink-0 self-start rounded-full px-2.5 py-0.5 text-xs font-medium sm:mt-0`,h),t[11]=h,t[12]=g);let _=r===`inherit`?o:s,v;t[13]!==g||t[14]!==_?(v=(0,Q.jsx)(`span`,{className:g,children:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==m||t[17]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[m,v]}),t[16]=m,t[17]=v,t[18]=y):y=t[18];let b=y,x=l?`w-full text-left transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 active:scale-[0.995] motion-reduce:active:scale-100`:void 0,S;t[19]===x?S=t[20]:(S=c(`flex flex-col gap-1 rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,x),t[19]=x,t[20]=S);let C=S;if(l){let e;return t[21]!==C||t[22]!==b||t[23]!==l?(e=(0,Q.jsx)(`button`,{type:`button`,className:C,onClick:l,children:b}),t[21]=C,t[22]=b,t[23]=l,t[24]=e):e=t[24],e}let w;return t[25]!==C||t[26]!==b?(w=(0,Q.jsx)(`div`,{className:C,children:b}),t[25]=C,t[26]=b,t[27]=w):w=t[27],w}function Vt(e){let t=(0,Z.c)(38),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditModelStrategy:s,onEditWorkspace:c}=e,l=n.inheritance,u;t[0]===a?u=t[1]:(u=a.trim(),t[0]=a,t[1]=u);let d=!u,f;t[2]!==o||t[3]!==i?(f=!o.trim()||i.trim().length>0&&o.trim()===i.trim(),t[2]=o,t[3]=i,t[4]=f):f=t[4];let p=f,m=d?r||l.unset:a,h=p?i||l.unset:o,g;t[5]!==l.subtitle||t[6]!==l.title?(g=(0,Q.jsx)(_t,{icon:Ae,title:l.title,subtitle:l.subtitle}),t[5]=l.subtitle,t[6]=l.title,t[7]=g):g=t[7];let _=d?`inherit`:`override`,v;t[8]!==r||t[9]!==l.inheritsValue||t[10]!==d?(v=d&&r?l.inheritsValue.replace(`{{value}}`,r):void 0,t[8]=r,t[9]=l.inheritsValue,t[10]=d,t[11]=v):v=t[11];let y;t[12]!==m||t[13]!==l.badgeInherit||t[14]!==l.badgeOverride||t[15]!==l.modelLabel||t[16]!==s||t[17]!==_||t[18]!==v?(y=(0,Q.jsx)(Bt,{label:l.modelLabel,mode:_,value:m,inheritedFrom:v,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:s}),t[12]=m,t[13]=l.badgeInherit,t[14]=l.badgeOverride,t[15]=l.modelLabel,t[16]=s,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b=p?`inherit`:`override`,x;t[20]!==i||t[21]!==l.inheritsValue||t[22]!==p?(x=p&&i?l.inheritsValue.replace(`{{value}}`,i):void 0,t[20]=i,t[21]=l.inheritsValue,t[22]=p,t[23]=x):x=t[23];let S;t[24]!==h||t[25]!==l.badgeInherit||t[26]!==l.badgeOverride||t[27]!==l.workspaceLabel||t[28]!==c||t[29]!==b||t[30]!==x?(S=(0,Q.jsx)(Bt,{label:l.workspaceLabel,mode:b,value:h,inheritedFrom:x,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:c}),t[24]=h,t[25]=l.badgeInherit,t[26]=l.badgeOverride,t[27]=l.workspaceLabel,t[28]=c,t[29]=b,t[30]=x,t[31]=S):S=t[31];let C;t[32]!==y||t[33]!==S?(C=(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[y,S]}),t[32]=y,t[33]=S,t[34]=C):C=t[34];let w;return t[35]!==g||t[36]!==C?(w=(0,Q.jsxs)(vt,{children:[g,C]}),t[35]=g,t[36]=C,t[37]=w):w=t[37],w}function Ht(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function Ut(e){let t=(0,Z.c)(5),{source:n}=e,r;if(t[0]!==n){let e=n.startsWith(`preset:`),i=n.startsWith(`agent:`);r=c(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e&&`bg-accent/10 text-accent`,i&&`bg-surface-base text-fg-muted`,!e&&!i&&`bg-surface-panel text-fg-subtle`),t[0]=n,t[1]=r}else r=t[1];let i;return t[2]!==n||t[3]!==r?(i=(0,Q.jsx)(`span`,{className:r,children:n}),t[2]=n,t[3]=r,t[4]=i):i=t[4],i}function Wt(e){let t=(0,Z.c)(13),n;t[0]===e.name?n=t[1]:(n=(0,Q.jsx)(`div`,{className:`min-w-0 truncate font-mono text-xs font-medium text-fg`,children:e.name}),t[0]=e.name,t[1]=n);let r=e.monoValue&&`font-mono text-xs`,i;t[2]===r?i=t[3]:(i=c(`min-w-0 truncate text-sm text-fg`,r),t[2]=r,t[3]=i);let a;t[4]!==e.value||t[5]!==i?(a=(0,Q.jsx)(`div`,{className:i,children:e.value}),t[4]=e.value,t[5]=i,t[6]=a):a=t[6];let o;t[7]===e.source?o=t[8]:(o=(0,Q.jsx)(Ut,{source:e.source}),t[7]=e.source,t[8]=o);let s;return t[9]!==n||t[10]!==a||t[11]!==o?(s=(0,Q.jsxs)(`div`,{className:`grid gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface sm:grid-cols-[minmax(0,10rem)_minmax(0,1fr)_auto] sm:items-center`,children:[n,a,o]}),t[9]=n,t[10]=a,t[11]=o,t[12]=s):s=t[12],s}function Gt(e,t){return e&&e.length>0?e.join(`, `):t}function Kt(e){let t=(0,Z.c)(29),{a:n,selected:r}=e,i;t[0]===r.id?i=t[1]:(i=r.id?[`agent-effective-manifest`,r.id]:null,t[0]=r.id,t[1]=i);let a;t[2]===r.id?a=t[3]:(a=()=>A(r.id),t[2]=r.id,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[4]=o):o=t[4];let{data:s,error:c,isLoading:l}=p(i,a,o),u=s?.manifest,d;t[5]!==s?.presetChain||t[6]!==u?.extends?(d=s?.presetChain??u?.extends??[],t[5]=s?.presetChain,t[6]=u?.extends,t[7]=d):d=t[7];let f=d,h;if(t[8]!==n.effectiveBoundariesTitle||t[9]!==n.effectiveEmpty||t[10]!==n.effectiveError||t[11]!==n.effectiveHint||t[12]!==n.effectiveLoading||t[13]!==n.effectiveModelsTitle||t[14]!==n.effectiveNoPresets||t[15]!==n.effectiveNoToolPolicies||t[16]!==n.effectivePresetChain||t[17]!==n.effectiveSkillsTitle||t[18]!==n.effectiveTitle||t[19]!==n.effectiveToolsTitle||t[20]!==s?.sources||t[21]!==c||t[22]!==l||t[23]!==u||t[24]!==f){let e=s?.sources??{},r=Object.entries(u?.models?.roles??{}).sort(Jt),i=Object.entries(u?.tools?.builtin??{}).sort(qt),a=u?.skills,o=u?.boundaries,d;t[26]!==n.effectiveHint||t[27]!==n.effectiveTitle?(d=(0,Q.jsx)(_t,{icon:m,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[26]=n.effectiveHint,t[27]=n.effectiveTitle,t[28]=d):d=t[28],h=(0,Q.jsxs)(vt,{children:[d,l?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveLoading}):c?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:c instanceof Error?c.message:n.effectiveError}):u?(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectivePresetChain}),(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 text-sm text-fg shadow-surface`,children:f.length?f.join(` -> `):n.effectiveNoPresets})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveModelsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Wt,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:Ht(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)(Wt,{name:n,value:r.model,monoValue:!0,source:Ht(e,[`models.roles.${n}.model`,`models.roles.${n}`])},n)})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveToolsTitle}),i.length>0?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map(t=>{let[n,r]=t;return(0,Q.jsx)(Wt,{name:n,value:r.mode,source:Ht(e,[`tools.builtin.${n}.mode`,`tools.builtin.${n}`])},n)})}):(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel/60 px-3 py-2 text-sm text-fg-muted shadow-surface`,children:n.effectiveNoToolPolicies})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveSkillsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Wt,{name:`mode`,value:a?.mode??`all`,source:Ht(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)(Wt,{name:`allow`,value:Gt(a.allow,`—`),source:Ht(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)(Wt,{name:`deny`,value:Gt(a.deny,`—`),source:Ht(e,[`skills.deny`,`skills`])}):null]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveBoundariesTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Wt,{name:`requiresConfirmation`,value:Gt(o?.requiresConfirmation,`—`),source:Ht(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)(Wt,{name:`forbidden`,value:Gt(o?.forbidden,`—`),source:Ht(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)(Wt,{name:`escalation`,value:Gt(o?.escalation,`—`),source:Ht(e,[`boundaries.escalation`,`boundaries`])})]})]})]})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveEmpty})]}),t[8]=n.effectiveBoundariesTitle,t[9]=n.effectiveEmpty,t[10]=n.effectiveError,t[11]=n.effectiveHint,t[12]=n.effectiveLoading,t[13]=n.effectiveModelsTitle,t[14]=n.effectiveNoPresets,t[15]=n.effectiveNoToolPolicies,t[16]=n.effectivePresetChain,t[17]=n.effectiveSkillsTitle,t[18]=n.effectiveTitle,t[19]=n.effectiveToolsTitle,t[20]=s?.sources,t[21]=c,t[22]=l,t[23]=u,t[24]=f,t[25]=h}else h=t[25];return h}function qt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Jt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Yt(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1`,children:(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-5 pb-6`,children:n})}),t[0]=n,t[1]=r),r}function Xt(e){let t=(0,Z.c)(4),{active:n,children:r,onClick:i}=e,a=n?`rounded-md bg-accent-soft px-3 py-1.5 text-sm font-medium text-accent-fg`:`rounded-md px-3 py-1.5 text-sm font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,Q.jsx)(`button`,{type:`button`,onClick:i,className:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function Zt(e){let t=(0,Z.c)(41),{a:n,selected:r,busy:i,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}=e,[p,m]=(0,$.useState)(`sources`),h=p===`sources`,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>m(`sources`),t[0]=g):g=t[0];let _;t[1]!==n.configSubtabSources||t[2]!==h?(_=(0,Q.jsx)(Xt,{active:h,onClick:g,children:n.configSubtabSources}),t[1]=n.configSubtabSources,t[2]=h,t[3]=_):_=t[3];let v=p===`shared`,y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>m(`shared`),t[4]=y):y=t[4];let b;t[5]!==n.configSubtabShared||t[6]!==v?(b=(0,Q.jsx)(Xt,{active:v,onClick:y,children:n.configSubtabShared}),t[5]=n.configSubtabShared,t[6]=v,t[7]=b):b=t[7];let x=p===`effective`,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>m(`effective`),t[8]=S):S=t[8];let C;t[9]!==n.configSubtabEffective||t[10]!==x?(C=(0,Q.jsx)(Xt,{active:x,onClick:S,children:n.configSubtabEffective}),t[9]=n.configSubtabEffective,t[10]=x,t[11]=C):C=t[11];let w;t[12]!==_||t[13]!==b||t[14]!==C?(w=(0,Q.jsx)(`div`,{className:`shrink-0 rounded-lg border border-edge bg-surface-panel p-1`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[_,b,C]})}),t[12]=_,t[13]=b,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==n||t[17]!==s||t[18]!==c||t[19]!==a||t[20]!==o||t[21]!==p?(T=p===`sources`?(0,Q.jsx)(Qt,{a:n,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c}):null,t[16]=n,t[17]=s,t[18]=c,t[19]=a,t[20]=o,t[21]=p,t[22]=T):T=t[22];let E;t[23]!==n||t[24]!==i||t[25]!==l||t[26]!==u||t[27]!==f||t[28]!==d||t[29]!==r||t[30]!==p?(E=p===`shared`?(0,Q.jsx)($t,{a:n,selected:r,busy:i,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}):null,t[23]=n,t[24]=i,t[25]=l,t[26]=u,t[27]=f,t[28]=d,t[29]=r,t[30]=p,t[31]=E):E=t[31];let D;t[32]!==n||t[33]!==r||t[34]!==p?(D=p===`effective`?(0,Q.jsx)(nn,{a:n,selected:r}):null,t[32]=n,t[33]=r,t[34]=p,t[35]=D):D=t[35];let O;return t[36]!==w||t[37]!==T||t[38]!==E||t[39]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[w,T,E,D]}),t[36]=w,t[37]=T,t[38]=E,t[39]=D,t[40]=O):O=t[40],O}function Qt(e){let t=(0,Z.c)(7),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s}=e,c;return t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==r||t[4]!==i||t[5]!==s?(c=(0,Q.jsx)(Yt,{children:(0,Q.jsx)(Vt,{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s})}),t[0]=n,t[1]=a,t[2]=o,t[3]=r,t[4]=i,t[5]=s,t[6]=c):c=t[6],c}function $t(e){let t=(0,Z.c)(72),{a:n,selected:r,busy:i,capabilityPresets:a,defaultPresetId:o,onUpdateAgentExtends:s,onOpenCapabilityPreset:c}=e,l=o===void 0?`default`:o,u;t[0]===a?u=t[1]:(u=new Map(a.map(tn)),t[0]=a,t[1]=u);let d=u,f;t[2]!==n.capabilityPresetsGlobalDefault||t[3]!==n.capabilityPresetsGlobalDefaultHint||t[4]!==l||t[5]!==d?(f=d.get(l)??{id:l,name:n.capabilityPresetsGlobalDefault,description:n.capabilityPresetsGlobalDefaultHint},t[2]=n.capabilityPresetsGlobalDefault,t[3]=n.capabilityPresetsGlobalDefaultHint,t[4]=l,t[5]=d,t[6]=f):f=t[6];let p=f,m,g,_,v,y;if(t[7]!==n.capabilityPresetAdd||t[8]!==n.capabilityPresetMoveDown||t[9]!==n.capabilityPresetMoveUp||t[10]!==n.capabilityPresetRemove||t[11]!==n.capabilityPresetsEmptyAdditional||t[12]!==n.capabilityPresetsGlobalDefault||t[13]!==n.capabilityPresetsGlobalDefaultHint||t[14]!==n.capabilityPresetsHint||t[15]!==n.capabilityPresetsManage||t[16]!==n.capabilityPresetsTitle||t[17]!==i||t[18]!==a||t[19]!==l||t[20]!==p.description||t[21]!==p.id||t[22]!==p.name||t[23]!==c||t[24]!==s||t[25]!==d||t[26]!==r.extends){let e;t[32]===l?e=t[33]:(e=e=>e!==l,t[32]=l,t[33]=e);let o=r.extends.filter(e),u=a.map(en).filter(e=>e!==l&&!o.includes(e)),f=u[0]??``;g=Yt,m=vt;let b;t[34]===c?b=t[35]:(b=()=>c(``),t[34]=c,t[35]=b);let S;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),t[36]=S):S=t[36];let C;t[37]!==n.capabilityPresetsManage||t[38]!==i||t[39]!==b?(C=(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:i,onClick:b,children:[S,n.capabilityPresetsManage]}),t[37]=n.capabilityPresetsManage,t[38]=i,t[39]=b,t[40]=C):C=t[40],t[41]!==n.capabilityPresetsHint||t[42]!==n.capabilityPresetsTitle||t[43]!==C?(_=(0,Q.jsx)(_t,{icon:ie,title:n.capabilityPresetsTitle,subtitle:n.capabilityPresetsHint,trailing:C}),t[41]=n.capabilityPresetsHint,t[42]=n.capabilityPresetsTitle,t[43]=C,t[44]=_):_=t[44];let w;t[45]!==p.id||t[46]!==c?(w=()=>c(p.id),t[45]=p.id,t[46]=c,t[47]=w):w=t[47];let E=p.name||n.capabilityPresetsGlobalDefault,D;t[48]===E?D=t[49]:(D=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:E}),t[48]=E,t[49]=D);let O;t[50]===n.capabilityPresetsGlobalDefault?O=t[51]:(O=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:n.capabilityPresetsGlobalDefault}),t[50]=n.capabilityPresetsGlobalDefault,t[51]=O);let k;t[52]!==D||t[53]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[D,O]}),t[52]=D,t[53]=O,t[54]=k):k=t[54];let A;t[55]===p.id?A=t[56]:(A=(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:p.id}),t[55]=p.id,t[56]=A);let j=p.description||n.capabilityPresetsGlobalDefaultHint,M;t[57]===j?M=t[58]:(M=(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:j}),t[57]=j,t[58]=M);let N;t[59]!==w||t[60]!==k||t[61]!==A||t[62]!==M?(N=(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-accent-soft/20 px-3 py-2 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:w,children:[k,A,M]})}),t[59]=w,t[60]=k,t[61]=A,t[62]=M,t[63]=N):N=t[63],v=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[N,o.length>0?o.map((e,t)=>{let r=d.get(e);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>c(e),children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:r?.name??e}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:e}),r?.description?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:r.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,Q.jsx)(q,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===0,"aria-label":n.capabilityPresetMoveUp,onClick:()=>{let e=[...o],[n,r]=[e[t],e[t-1]];e[t-1]=n,e[t]=r,s(e)},children:(0,Q.jsx)(Te,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(q,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===o.length-1,"aria-label":n.capabilityPresetMoveDown,onClick:()=>{let e=[...o],[n,r]=[e[t+1],e[t]];e[t]=n,e[t+1]=r,s(e)},children:(0,Q.jsx)(x,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(q,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i,"aria-label":n.capabilityPresetRemove,onClick:()=>s(o.filter(t=>t!==e)),children:(0,Q.jsx)(U,{className:`size-3.5`,"aria-hidden":!0})})]})]},e)}):(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/60 p-3 text-sm text-fg-muted shadow-surface`,children:n.capabilityPresetsEmptyAdditional})]}),y=u.length>0?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,Q.jsx)(h,{className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:border-edge-strong focus:outline-none`,disabled:i,defaultValue:f,children:u.map(e=>(0,Q.jsx)(nt,{value:e,children:d.get(e)?.name??e},e))}),(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,disabled:i||!f,onClick:e=>{let t=e.currentTarget.parentElement?.querySelector(`select`)?.value||f;t&&s([...o,t])},children:[(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0}),n.capabilityPresetAdd]})]}):null,t[7]=n.capabilityPresetAdd,t[8]=n.capabilityPresetMoveDown,t[9]=n.capabilityPresetMoveUp,t[10]=n.capabilityPresetRemove,t[11]=n.capabilityPresetsEmptyAdditional,t[12]=n.capabilityPresetsGlobalDefault,t[13]=n.capabilityPresetsGlobalDefaultHint,t[14]=n.capabilityPresetsHint,t[15]=n.capabilityPresetsManage,t[16]=n.capabilityPresetsTitle,t[17]=i,t[18]=a,t[19]=l,t[20]=p.description,t[21]=p.id,t[22]=p.name,t[23]=c,t[24]=s,t[25]=d,t[26]=r.extends,t[27]=m,t[28]=g,t[29]=_,t[30]=v,t[31]=y}else m=t[27],g=t[28],_=t[29],v=t[30],y=t[31];let b;t[64]!==m||t[65]!==_||t[66]!==v||t[67]!==y?(b=(0,Q.jsxs)(m,{children:[_,v,y]}),t[64]=m,t[65]=_,t[66]=v,t[67]=y,t[68]=b):b=t[68];let S;return t[69]!==g||t[70]!==b?(S=(0,Q.jsx)(g,{children:b}),t[69]=g,t[70]=b,t[71]=S):S=t[71],S}function en(e){return e.id}function tn(e){return[e.id,e]}function nn(e){let t=(0,Z.c)(3),{a:n,selected:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(Yt,{children:(0,Q.jsx)(Kt,{a:n,selected:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function rn(e){let t=(0,Z.c)(10),{a:n,selected:r,busy:i,onDelete:a}=e,o;return t[0]!==n.dangerZoneBody||t[1]!==n.dangerZoneHint||t[2]!==n.dangerZoneMainUnavailable||t[3]!==n.dangerZoneTitle||t[4]!==n.purgeDisk||t[5]!==n.removeFromConfig||t[6]!==i||t[7]!==a||t[8]!==r.id?(o=(0,Q.jsx)(Yt,{children:r.id===`main`?(0,Q.jsx)(vt,{children:(0,Q.jsx)(_t,{icon:P,title:n.dangerZoneTitle,subtitle:n.dangerZoneMainUnavailable})}):(0,Q.jsxs)(vt,{className:`border border-red-200/70 bg-red-50/60 dark:border-red-900/50 dark:bg-red-950/25`,children:[(0,Q.jsx)(_t,{icon:P,title:n.dangerZoneTitle,subtitle:n.dangerZoneHint}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`max-w-xl text-sm text-red-800 dark:text-red-200`,children:n.dangerZoneBody}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void a(!1),children:[(0,Q.jsx)(U,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(q,{type:`button`,variant:`secondary`,className:`border-red-200 text-red-700 hover:bg-red-100 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/50`,disabled:i,onClick:()=>void a(!0),children:n.purgeDisk})]})]})]})}),t[0]=n.dangerZoneBody,t[1]=n.dangerZoneHint,t[2]=n.dangerZoneMainUnavailable,t[3]=n.dangerZoneTitle,t[4]=n.purgeDisk,t[5]=n.removeFromConfig,t[6]=i,t[7]=a,t[8]=r.id,t[9]=o):o=t[9],o}function an(){return c(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,ot,`dark:border-edge`)}function on(e){return[e.channel,e.accountId,e.peerKind,e.peerId].filter(e=>typeof e==`string`&&e.length>0).join(` · `)||e.channel}function sn(e,t,n,r){let i=e.trim(),a=t.trim();if(a)return{channel:i,peerId:a};if(n!=null){let e=r[n];if(!e)return{channel:i};let t={channel:i};e.accountId?.trim()&&(t.accountId=e.accountId.trim()),e.peerKind?.trim()&&(t.peerKind=e.peerKind.trim());let a=e.peerId?.trim()||e.chatId?.trim();return a&&(t.peerId=a),t}return{channel:i}}function cn(e){let t=(0,Z.c)(31),{a:n,filesLoading:r,files:i,activeFile:a,setActiveFile:o,filesViewMode:s,setFilesViewMode:l,fileDraft:u,setFileDraft:d,fileSaving:p,profileFileLoading:m,profileEditorNonce:h,onTryInChat:g}=e,v=f(ln),y;t[0]!==n.missing||t[1]!==i?.files?(y=i?.files.map(e=>({id:e.name,label:e.missing?`${e.name} (${n.missing})`:e.name,title:e.name}))??[],t[0]=n.missing,t[1]=i?.files,t[2]=y):y=t[2];let b=y,x;t[3]===n.filesHint?x=t[4]:(x=(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[3]=n.filesHint,t[4]=x);let S;t[5]!==n.filesAutoSaveHint||t[6]!==n.filesEmpty||t[7]!==n.filesMarkdownEdit||t[8]!==n.filesMarkdownPreview||t[9]!==n.filesNavAria||t[10]!==n.filesSavingStatus||t[11]!==n.pickFile||t[12]!==n.tryInChat||t[13]!==a||t[14]!==u||t[15]!==p||t[16]!==b||t[17]!==i||t[18]!==r||t[19]!==s||t[20]!==v||t[21]!==g||t[22]!==h||t[23]!==m||t[24]!==o||t[25]!==d||t[26]!==l?(S=r?(0,Q.jsx)(gt,{rows:3}):i?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,Q.jsx)(yt,{items:b,activeTab:a??``,onChange:o,ariaLabel:n.filesNavAria,tabIdPrefix:`agent-files-tab`,panelIdPrefix:`agent-files-panel`,className:`shrink-0 flex-wrap`,buttonClassName:`font-mono text-xs whitespace-nowrap`}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden`,children:a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-panel p-0.5`,role:`group`,"aria-label":`${n.filesMarkdownEdit} / ${n.filesMarkdownPreview}`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:c(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Pe.press,s===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`edit`),children:[(0,Q.jsx)(he,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownEdit]}),(0,Q.jsxs)(`button`,{type:`button`,className:c(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Pe.press,s===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`preview`),children:[(0,Q.jsx)(z,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownPreview]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[p?(0,Q.jsx)(`span`,{children:n.filesSavingStatus}):null,(0,Q.jsx)(`span`,{children:n.filesAutoSaveHint}),g?(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:g,children:[(0,Q.jsx)(ue,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),s===`edit`?(0,Q.jsx)(`div`,{className:c(an(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(ft,{initialContent:u,onChange:d,isDark:v,className:`min-h-0 flex-1`},`${a??`file`}-${h}`)}):(0,Q.jsx)(`div`,{className:c(an(),`min-h-0 flex-1 overflow-y-auto text-sm`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(_,{content:u,className:`text-sm`})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.pickFile})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesEmpty}),t[5]=n.filesAutoSaveHint,t[6]=n.filesEmpty,t[7]=n.filesMarkdownEdit,t[8]=n.filesMarkdownPreview,t[9]=n.filesNavAria,t[10]=n.filesSavingStatus,t[11]=n.pickFile,t[12]=n.tryInChat,t[13]=a,t[14]=u,t[15]=p,t[16]=b,t[17]=i,t[18]=r,t[19]=s,t[20]=v,t[21]=g,t[22]=h,t[23]=m,t[24]=o,t[25]=d,t[26]=l,t[27]=S):S=t[27];let C;return t[28]!==x||t[29]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[x,S]}),t[28]=x,t[29]=S,t[30]=C):C=t[30],C}function ln(e){return e.resolved===`dark`}function un(e){let t=(0,Z.c)(44),[n,r]=(0,$.useState)(`files`),{a:i}=e,a;t[0]===i.advancedHint?a=t[1]:(a=(0,Q.jsx)(`p`,{className:`mb-3 max-w-[70ch] text-sm leading-6 text-fg-muted`,children:i.advancedHint}),t[0]=i.advancedHint,t[1]=a);let o;t[2]===i.advancedFilesTab?o=t[3]:(o={id:`files`,label:i.advancedFilesTab,icon:I},t[2]=i.advancedFilesTab,t[3]=o);let s;t[4]===i.advancedConfigTab?s=t[5]:(s={id:`config`,label:i.advancedConfigTab,icon:ke},t[4]=i.advancedConfigTab,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=[o,s],t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]!==i.advancedNavAria||t[10]!==n||t[11]!==c?(l=(0,Q.jsx)(yt,{items:c,activeTab:n,onChange:r,ariaLabel:i.advancedNavAria,tabIdPrefix:`agent-advanced-tab`,panelIdPrefix:`agent-advanced-panel`}),t[9]=i.advancedNavAria,t[10]=n,t[11]=c,t[12]=l):l=t[12];let u;t[13]!==a||t[14]!==l?(u=(0,Q.jsxs)(`div`,{className:`shrink-0`,children:[a,l]}),t[13]=a,t[14]=l,t[15]=u):u=t[15];let d;t[16]!==i||t[17]!==n||t[18]!==e.activeFile||t[19]!==e.agentModel||t[20]!==e.agentWorkspace||t[21]!==e.busy||t[22]!==e.capabilityPresets||t[23]!==e.defaultModel||t[24]!==e.defaultPresetId||t[25]!==e.defaultWorkspace||t[26]!==e.fileDraft||t[27]!==e.fileSaving||t[28]!==e.files||t[29]!==e.filesLoading||t[30]!==e.filesViewMode||t[31]!==e.onOpenCapabilityPreset||t[32]!==e.onTryInChat||t[33]!==e.onUpdateAgentExtends||t[34]!==e.profileEditorNonce||t[35]!==e.profileFileLoading||t[36]!==e.selected||t[37]!==e.setActiveFile||t[38]!==e.setFileDraft||t[39]!==e.setFilesViewMode?(d=n===`files`?(0,Q.jsx)(cn,{a:i,filesLoading:e.filesLoading,files:e.files,activeFile:e.activeFile,setActiveFile:e.setActiveFile,filesViewMode:e.filesViewMode,setFilesViewMode:e.setFilesViewMode,fileDraft:e.fileDraft,setFileDraft:e.setFileDraft,fileSaving:e.fileSaving,profileFileLoading:e.profileFileLoading,profileEditorNonce:e.profileEditorNonce,onTryInChat:e.onTryInChat}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,Q.jsx)(`p`,{className:`shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 text-xs leading-5 text-fg-muted`,children:i.advancedRuntimeCoverageHint}),(0,Q.jsx)(Zt,{a:i,selected:e.selected,busy:e.busy,defaultModel:e.defaultModel,defaultWorkspace:e.defaultWorkspace,agentModel:e.agentModel,agentWorkspace:e.agentWorkspace,capabilityPresets:e.capabilityPresets,defaultPresetId:e.defaultPresetId,onUpdateAgentExtends:e.onUpdateAgentExtends,onOpenCapabilityPreset:e.onOpenCapabilityPreset})]}),t[16]=i,t[17]=n,t[18]=e.activeFile,t[19]=e.agentModel,t[20]=e.agentWorkspace,t[21]=e.busy,t[22]=e.capabilityPresets,t[23]=e.defaultModel,t[24]=e.defaultPresetId,t[25]=e.defaultWorkspace,t[26]=e.fileDraft,t[27]=e.fileSaving,t[28]=e.files,t[29]=e.filesLoading,t[30]=e.filesViewMode,t[31]=e.onOpenCapabilityPreset,t[32]=e.onTryInChat,t[33]=e.onUpdateAgentExtends,t[34]=e.profileEditorNonce,t[35]=e.profileFileLoading,t[36]=e.selected,t[37]=e.setActiveFile,t[38]=e.setFileDraft,t[39]=e.setFilesViewMode,t[40]=d):d=t[40];let f;return t[41]!==u||t[42]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[u,d]}),t[41]=u,t[42]=d,t[43]=f):f=t[43],f}function dn(e){let t=(0,Z.c)(65),{a:n,selected:r,busy:i,skillsCatalogLoading:a,catalogForPick:s,skillsInherit:l,setSkillsInherit:u,skillsPick:d,setSkillsPick:f,onSaveSkills:p,hideInlineSave:m}=e,h;t[0]===r.skills.effectiveAllowlist?h=t[1]:(h=function(e){let t=r.skills.effectiveAllowlist;return t===void 0?!0:t.length===0?!1:t.includes(e)},t[0]=r.skills.effectiveAllowlist,t[1]=h);let g=h,_;t[2]!==s||t[3]!==r.skills.effectiveAllowlist?(_=function(){let e=r.skills.effectiveAllowlist;return e===void 0?new Set(s.map(fn)):new Set(e)},t[2]=s,t[3]=r.skills.effectiveAllowlist,t[4]=_):_=t[4];let v=_,y;t[5]!==n.skillsHint||t[6]!==n.skillsTitle?(y=(0,Q.jsx)(_t,{className:`shrink-0`,icon:Fe,title:n.skillsTitle,subtitle:n.skillsHint}),t[5]=n.skillsHint,t[6]=n.skillsTitle,t[7]=y):y=t[7];let b;t[8]===u?b=t[9]:(b=()=>u(!0),t[8]=u,t[9]=b);let x;t[10]!==n.skillsInherit||t[11]!==i||t[12]!==b?(x=(0,Q.jsx)(q,{type:`button`,variant:`secondary`,disabled:i,onClick:b,children:n.skillsInherit}),t[10]=n.skillsInherit,t[11]=i,t[12]=b,t[13]=x):x=t[13];let S;t[14]!==v||t[15]!==u||t[16]!==f?(S=()=>{u(!1),f(v())},t[14]=v,t[15]=u,t[16]=f,t[17]=S):S=t[17];let C;t[18]!==n.skillsCustomize||t[19]!==i||t[20]!==S?(C=(0,Q.jsx)(q,{type:`button`,variant:`secondary`,disabled:i,onClick:S,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=i,t[20]=S,t[21]=C):C=t[21];let w;t[22]!==x||t[23]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[x,C]}),t[22]=x,t[23]=C,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=_e(`skills`),t[25]=T):T=t[25];let E;t[26]===n.skillsLibraryLink?E=t[27]:(E=(0,Q.jsx)(o,{to:T,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[26]=n.skillsLibraryLink,t[27]=E);let D;t[28]!==w||t[29]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[w,E]}),t[28]=w,t[29]=E,t[30]=D):D=t[30];let O;t[31]===r.skills.preset?O=t[32]:(O=r.skills.preset.length?r.skills.preset.join(`, `):`—`,t[31]=r.skills.preset,t[32]=O);let k;t[33]!==n.skillsPresetLabel||t[34]!==O?(k=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsPresetLabel,` `,O]}),t[33]=n.skillsPresetLabel,t[34]=O,t[35]=k):k=t[35];let A;t[36]!==n.skillsInherit||t[37]!==r.skills.effectiveAllowlist||t[38]!==l?(A=r.skills.effectiveAllowlist?.length?r.skills.effectiveAllowlist.join(`, `):l?n.skillsInherit:`—`,t[36]=n.skillsInherit,t[37]=r.skills.effectiveAllowlist,t[38]=l,t[39]=A):A=t[39];let j;t[40]!==n.skillsEffectiveLabel||t[41]!==A?(j=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,A]}),t[40]=n.skillsEffectiveLabel,t[41]=A,t[42]=j):j=t[42];let M;t[43]!==n.skillsEmptyCatalog||t[44]!==n.skillsNoDescription||t[45]!==i||t[46]!==s||t[47]!==g||t[48]!==f||t[49]!==a||t[50]!==l||t[51]!==d?(M=a?(0,Q.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(ht,{rows:4})}):s.length===0?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsEmptyCatalog}):(0,Q.jsx)(`div`,{className:c(`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,l&&`opacity-50`),children:(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:s.map(e=>{let t=e.name||e.directoryId,r=l?g(t):d.has(t),a=typeof e.description==`string`?e.description.trim():``,o=a||n.skillsNoDescription;return(0,Q.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl bg-surface-panel/70 px-3 shadow-surface`,children:(0,Q.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:r,disabled:l||i,onChange:()=>{f(e=>{let n=new Set(e);return r?n.delete(t):n.add(t),n})},"aria-label":t}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,Q.jsx)(`p`,{className:c(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!a&&`italic text-fg-subtle`),title:o,children:o})]})]})},t)})})}),t[43]=n.skillsEmptyCatalog,t[44]=n.skillsNoDescription,t[45]=i,t[46]=s,t[47]=g,t[48]=f,t[49]=a,t[50]=l,t[51]=d,t[52]=M):M=t[52];let N;t[53]!==n.skillsSave||t[54]!==i||t[55]!==m||t[56]!==p?(N=m?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(q,{type:`button`,disabled:i,onClick:()=>void p(),children:n.skillsSave})}),t[53]=n.skillsSave,t[54]=i,t[55]=m,t[56]=p,t[57]=N):N=t[57];let P;return t[58]!==D||t[59]!==k||t[60]!==j||t[61]!==M||t[62]!==N||t[63]!==y?(P=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[y,D,k,j,M,N]}),t[58]=D,t[59]=k,t[60]=j,t[61]=M,t[62]=N,t[63]=y,t[64]=P):P=t[64],P}function fn(e){return e.name||e.directoryId}var pn=[`write_file`,`apply_patch`,`exec_command`],mn=[`exec_command`,`image_generate`,`extensions`],hn=[`send_message`,`send_media`];function gn(e){let t=(0,Z.c)(87),{mode:n,builtinToolIds:r,loading:i,disableSet:a,onDisableSetChange:o,defaultsDisableSet:s,unknownDisabledIds:l,getToolDescription:u,getGroupTitle:d,labels:f,quickActionsDisabled:p}=e,m;t[0]===l?m=t[1]:(m=l===void 0?[]:l,t[0]=l,t[1]=m);let h=m,g=p===void 0?!1:p,_;t[2]===r?_=t[3]:(_=new Set(r),t[2]=r,t[3]=_);let v=_,y;t[4]===s?y=t[5]:(y=s??new Set,t[4]=s,t[5]=y);let b=y,x;t[6]!==b||t[7]!==a||t[8]!==n||t[9]!==o?(x=(e,t)=>{if(n===`agentEntry`&&t&&b.has(e))return;let r=new Set(a);t?r.delete(e):r.add(e),o(r)},t[6]=b,t[7]=a,t[8]=n,t[9]=o,t[10]=x):x=t[10];let S=x,C;t[11]!==v||t[12]!==o?(C=e=>{let t=new Set;for(let n of e)v.has(n)&&t.add(n);o(t)},t[11]=v,t[12]=o,t[13]=C):C=t[13];let w=C,T;t[14]===o?T=t[15]:(T=()=>{o(new Set)},t[14]=o,t[15]=T);let E=T,D;t[16]!==r||t[17]!==o||t[18]!==h?(D=()=>{o(new Set([...r,...h]))},t[16]=r,t[17]=o,t[18]=h,t[19]=D):D=t[19];let O=D,k;t[20]===r?k=t[21]:(k=wt(r),t[20]=r,t[21]=k);let A=k,j;if(t[22]!==v||t[23]!==A||t[24]!==n||t[25]!==h){if(j=[],n===`defaults`&&h.length>0){let e;t[27]===h?e=t[28]:(e=h.toSorted(vn),t[27]=h,t[28]=e);let n;t[29]===e?n=t[30]:(n={key:`unknown`,ids:e},t[29]=e,t[30]=n),j.push(n)}for(let e of St){let t=e.toolIds.filter(e=>v.has(e));t.length>0&&j.push({key:e.key,ids:[...t]})}if(A.length>0){let e;t[31]===A?e=t[32]:(e={key:`misc`,ids:A},t[31]=A,t[32]=e),j.push(e)}t[22]=v,t[23]=A,t[24]=n,t[25]=h,t[26]=j}else j=t[26];let M=j,N=M.some(_n),P=g||i,F;t[33]===f.quickActionsLabel?F=t[34]:(F=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:f.quickActionsLabel}),t[33]=f.quickActionsLabel,t[34]=F);let I=P||r.length===0&&h.length===0,L;t[35]!==E||t[36]!==f.quickEnableAll||t[37]!==I?(L=(0,Q.jsx)(q,{type:`button`,variant:`secondary`,className:Ot,disabled:I,onClick:E,children:f.quickEnableAll}),t[35]=E,t[36]=f.quickEnableAll,t[37]=I,t[38]=L):L=t[38];let R=P||r.length===0&&h.length===0,ee;t[39]!==O||t[40]!==f.quickDisableAll||t[41]!==R?(ee=(0,Q.jsx)(q,{type:`button`,variant:`secondary`,className:Ot,disabled:R,onClick:O,children:f.quickDisableAll}),t[39]=O,t[40]=f.quickDisableAll,t[41]=R,t[42]=ee):ee=t[42];let te=P||r.length===0,ne;t[43]===w?ne=t[44]:(ne=()=>w(pn),t[43]=w,t[44]=ne);let re;t[45]!==f.quickReadOnlyWorkspace||t[46]!==te||t[47]!==ne?(re=(0,Q.jsx)(q,{type:`button`,variant:`secondary`,className:Ot,disabled:te,onClick:ne,children:f.quickReadOnlyWorkspace}),t[45]=f.quickReadOnlyWorkspace,t[46]=te,t[47]=ne,t[48]=re):re=t[48];let z=P||r.length===0,B;t[49]===w?B=t[50]:(B=()=>w(mn),t[49]=w,t[50]=B);let V;t[51]!==f.quickHighRiskOff||t[52]!==z||t[53]!==B?(V=(0,Q.jsx)(q,{type:`button`,variant:`secondary`,className:Ot,disabled:z,onClick:B,children:f.quickHighRiskOff}),t[51]=f.quickHighRiskOff,t[52]=z,t[53]=B,t[54]=V):V=t[54];let ie=P||r.length===0,ae;t[55]===w?ae=t[56]:(ae=()=>w(hn),t[55]=w,t[56]=ae);let H;t[57]!==f.quickNoOutbound||t[58]!==ie||t[59]!==ae?(H=(0,Q.jsx)(q,{type:`button`,variant:`secondary`,className:Ot,disabled:ie,onClick:ae,children:f.quickNoOutbound}),t[57]=f.quickNoOutbound,t[58]=ie,t[59]=ae,t[60]=H):H=t[60];let U;t[61]!==L||t[62]!==ee||t[63]!==re||t[64]!==V||t[65]!==H?(U=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[L,ee,re,V,H]}),t[61]=L,t[62]=ee,t[63]=re,t[64]=V,t[65]=H,t[66]=U):U=t[66];let W;t[67]!==F||t[68]!==U?(W=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[F,U]}),t[67]=F,t[68]=U,t[69]=W):W=t[69];let G;t[70]!==b||t[71]!==a||t[72]!==d||t[73]!==u||t[74]!==M||t[75]!==N||t[76]!==f.emptyBuiltin||t[77]!==f.lockedByDefaults||t[78]!==f.notInBuiltin||t[79]!==i||t[80]!==n||t[81]!==P||t[82]!==S?(G=i?(0,Q.jsx)(ht,{rows:4}):N?(0,Q.jsx)(`div`,{className:`max-h-[min(50vh,22rem)] overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-5 pr-1`,children:M.map(e=>{let{key:t,ids:r}=e;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:d(t)}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:r.map(e=>{let r=n===`defaults`&&t===`unknown`,i=n===`agentEntry`&&b.has(e),o=a.has(e),s=i?!1:!o,l=u(e);return(0,Q.jsx)(`li`,{className:c(`rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,r&&`bg-surface-panel/50`,i&&`opacity-60`),children:(0,Q.jsxs)(`label`,{className:c(`flex gap-3 text-sm`,i?`cursor-not-allowed`:`cursor-pointer`),children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0 rounded border-edge`,checked:s,disabled:i||P,onChange:()=>S(e,!s)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs font-medium text-fg`,children:e}),r?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.notInBuiltin,`)`]}):null,i?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.lockedByDefaults,`)`]}):null]}),l?(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:l}):null]})]})},e)})})]},t)})})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.emptyBuiltin}),t[70]=b,t[71]=a,t[72]=d,t[73]=u,t[74]=M,t[75]=N,t[76]=f.emptyBuiltin,t[77]=f.lockedByDefaults,t[78]=f.notInBuiltin,t[79]=i,t[80]=n,t[81]=P,t[82]=S,t[83]=G):G=t[83];let K;return t[84]!==W||t[85]!==G?(K=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[W,G]}),t[84]=W,t[85]=G,t[86]=K):K=t[86],K}function _n(e){return e.ids.length>0}function vn(e,t){return e.localeCompare(t)}function yn(e){let t=(0,Z.c)(51),{a:n,data:r,selected:i,busy:a,toolEntryDisable:o,setToolEntryDisable:s,onSaveTools:c,onClearToolsEntry:u,hideInlineSave:f}=e,p=d(xn),m;t[0]===p?m=t[1]:(m=l(p),t[0]=p,t[1]=m);let h=m.agentSettings.advanced,g;t[2]===i.tools.presetDenied?g=t[3]:(g=new Set(i.tools.presetDenied.flatMap(bn)),t[2]=i.tools.presetDenied,t[3]=g);let _=g,v;t[4]===s?v=t[5]:(v=e=>{s(e)},t[4]=s,t[5]=v);let y=v,b=n.toolsDisableGroups,x;t[6]===b?x=t[7]:(x=e=>b[e],t[6]=b,t[7]=x);let S=x,w;t[8]===n.toolDescriptions?w=t[9]:(w=e=>e in n.toolDescriptions?n.toolDescriptions[e]:``,t[8]=n.toolDescriptions,t[9]=w);let T=w,E;t[10]!==n.toolsHint||t[11]!==n.toolsTitle?(E=(0,Q.jsx)(_t,{className:`shrink-0`,icon:C,title:n.toolsTitle,subtitle:n.toolsHint}),t[10]=n.toolsHint,t[11]=n.toolsTitle,t[12]=E):E=t[12];let D;t[13]!==n.toolsLockedByPreset||t[14]!==h.toolsDisableEmptyBuiltin||t[15]!==h.toolsDisableLoadingBuiltin||t[16]!==h.toolsDisableNotInBuiltin||t[17]!==h.toolsDisableQuickActionsLabel||t[18]!==h.toolsDisableQuickDisableAll||t[19]!==h.toolsDisableQuickEnableAll||t[20]!==h.toolsDisableQuickHighRiskOff||t[21]!==h.toolsDisableQuickNoOutbound||t[22]!==h.toolsDisableQuickReadOnlyWorkspace?(D={loadingBuiltin:h.toolsDisableLoadingBuiltin,emptyBuiltin:h.toolsDisableEmptyBuiltin,quickActionsLabel:h.toolsDisableQuickActionsLabel,quickEnableAll:h.toolsDisableQuickEnableAll,quickDisableAll:h.toolsDisableQuickDisableAll,quickReadOnlyWorkspace:h.toolsDisableQuickReadOnlyWorkspace,quickHighRiskOff:h.toolsDisableQuickHighRiskOff,quickNoOutbound:h.toolsDisableQuickNoOutbound,notInBuiltin:h.toolsDisableNotInBuiltin,lockedByDefaults:n.toolsLockedByPreset},t[13]=n.toolsLockedByPreset,t[14]=h.toolsDisableEmptyBuiltin,t[15]=h.toolsDisableLoadingBuiltin,t[16]=h.toolsDisableNotInBuiltin,t[17]=h.toolsDisableQuickActionsLabel,t[18]=h.toolsDisableQuickDisableAll,t[19]=h.toolsDisableQuickEnableAll,t[20]=h.toolsDisableQuickHighRiskOff,t[21]=h.toolsDisableQuickNoOutbound,t[22]=h.toolsDisableQuickReadOnlyWorkspace,t[23]=D):D=t[23];let O;t[24]!==a||t[25]!==r.builtinToolIds||t[26]!==S||t[27]!==T||t[28]!==y||t[29]!==_||t[30]!==D||t[31]!==o?(O=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(gn,{mode:`agentEntry`,builtinToolIds:r.builtinToolIds,loading:!1,disableSet:o,onDisableSetChange:y,defaultsDisableSet:_,getToolDescription:T,getGroupTitle:S,quickActionsDisabled:a,labels:D})}),t[24]=a,t[25]=r.builtinToolIds,t[26]=S,t[27]=T,t[28]=y,t[29]=_,t[30]=D,t[31]=o,t[32]=O):O=t[32];let k;t[33]!==n.toolsSave||t[34]!==a||t[35]!==f||t[36]!==c?(k=f?null:(0,Q.jsx)(q,{type:`button`,disabled:a,onClick:()=>void c(),children:n.toolsSave}),t[33]=n.toolsSave,t[34]=a,t[35]=f,t[36]=c,t[37]=k):k=t[37];let A;t[38]===u?A=t[39]:(A=()=>void u(),t[38]=u,t[39]=A);let j;t[40]!==n.toolsClearEntry||t[41]!==a||t[42]!==A?(j=(0,Q.jsx)(q,{type:`button`,variant:`secondary`,disabled:a,onClick:A,children:n.toolsClearEntry}),t[40]=n.toolsClearEntry,t[41]=a,t[42]=A,t[43]=j):j=t[43];let M;t[44]!==j||t[45]!==k?(M=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[k,j]}),t[44]=j,t[45]=k,t[46]=M):M=t[46];let N;return t[47]!==M||t[48]!==E||t[49]!==O?(N=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[E,O,M]}),t[47]=M,t[48]=E,t[49]=O,t[50]=N):N=t[50],N}function bn(e){let t=String(e).trim();return t?[t]:[]}function xn(e){return e.language}function Sn(e){let t=(0,Z.c)(36),[n,r]=(0,$.useState)(`tools`),{a:i}=e,a;t[0]===i.capabilitiesHint?a=t[1]:(a=(0,Q.jsx)(`p`,{className:`mb-3 max-w-[70ch] text-sm leading-6 text-fg-muted`,children:i.capabilitiesHint}),t[0]=i.capabilitiesHint,t[1]=a);let o;t[2]===i.capabilitiesToolsTab?o=t[3]:(o={id:`tools`,label:i.capabilitiesToolsTab,icon:C},t[2]=i.capabilitiesToolsTab,t[3]=o);let s;t[4]===i.capabilitiesSkillsTab?s=t[5]:(s={id:`skills`,label:i.capabilitiesSkillsTab,icon:ct},t[4]=i.capabilitiesSkillsTab,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=[o,s],t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]!==i.capabilitiesNavAria||t[10]!==n||t[11]!==c?(l=(0,Q.jsx)(yt,{items:c,activeTab:n,onChange:r,ariaLabel:i.capabilitiesNavAria,tabIdPrefix:`agent-capabilities-tab`,panelIdPrefix:`agent-capabilities-panel`}),t[9]=i.capabilitiesNavAria,t[10]=n,t[11]=c,t[12]=l):l=t[12];let u;t[13]!==a||t[14]!==l?(u=(0,Q.jsxs)(`div`,{className:`shrink-0`,children:[a,l]}),t[13]=a,t[14]=l,t[15]=u):u=t[15];let d;t[16]!==i||t[17]!==n||t[18]!==e.busy||t[19]!==e.catalogForPick||t[20]!==e.data||t[21]!==e.onClearToolsEntry||t[22]!==e.onSaveSkills||t[23]!==e.onSaveTools||t[24]!==e.selected||t[25]!==e.setSkillsInherit||t[26]!==e.setSkillsPick||t[27]!==e.setToolEntryDisable||t[28]!==e.skillsCatalogLoading||t[29]!==e.skillsInherit||t[30]!==e.skillsPick||t[31]!==e.toolEntryDisable?(d=n===`tools`?(0,Q.jsx)(yn,{a:i,data:e.data,selected:e.selected,busy:e.busy,toolEntryDisable:e.toolEntryDisable,setToolEntryDisable:e.setToolEntryDisable,onSaveTools:e.onSaveTools,onClearToolsEntry:e.onClearToolsEntry}):(0,Q.jsx)(dn,{a:i,selected:e.selected,busy:e.busy,skillsCatalogLoading:e.skillsCatalogLoading,catalogForPick:e.catalogForPick,skillsInherit:e.skillsInherit,setSkillsInherit:e.setSkillsInherit,skillsPick:e.skillsPick,setSkillsPick:e.setSkillsPick,onSaveSkills:e.onSaveSkills}),t[16]=i,t[17]=n,t[18]=e.busy,t[19]=e.catalogForPick,t[20]=e.data,t[21]=e.onClearToolsEntry,t[22]=e.onSaveSkills,t[23]=e.onSaveTools,t[24]=e.selected,t[25]=e.setSkillsInherit,t[26]=e.setSkillsPick,t[27]=e.setToolEntryDisable,t[28]=e.skillsCatalogLoading,t[29]=e.skillsInherit,t[30]=e.skillsPick,t[31]=e.toolEntryDisable,t[32]=d):d=t[32];let f;return t[33]!==u||t[34]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[u,d]}),t[33]=u,t[34]=d,t[35]=f):f=t[35],f}var Cn=c(we,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function wn(e){let t=(0,Z.c)(59),{a:n,busy:r,bindingsLoading:i,agentBindings:a,onRemoveBinding:o,onAddBinding:s,channelStatuses:l,channelsStatusLoading:u,useManualChannel:d,newBindChannel:f,setNewBindChannel:p,bindSessionChats:m,sessionsLoading:g,newBindSessionIdx:_,setNewBindSessionIdx:v,newBindCustomPeer:y,setNewBindCustomPeer:b,onRefreshSessions:x,lastActiveLabels:S,selectRecipient:C}=e,w=!u&&(d||l.length>0),T;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(T=(0,Q.jsx)(_t,{className:`shrink-0`,icon:Ae,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=T):T=t[2];let E;t[3]!==n.channelsNone||t[4]!==n.removeBinding||t[5]!==a||t[6]!==i||t[7]!==r||t[8]!==o?(E=i?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,"aria-busy":`true`,children:Array.from({length:2}).map(Tn)}):a.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsNone}):(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:a.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:on(e.match)}),(0,Q.jsx)(q,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void o(e),children:n.removeBinding})]},`${e.match.channel}-${on(e.match)}`))}),t[3]=n.channelsNone,t[4]=n.removeBinding,t[5]=a,t[6]=i,t[7]=r,t[8]=o,t[9]=E):E=t[9];let D;t[10]!==n.channelLabel||t[11]!==n.channelsDisabledSuffix||t[12]!==n.channelsManualChannelHint||t[13]!==l||t[14]!==u||t[15]!==f||t[16]!==p||t[17]!==b||t[18]!==v||t[19]!==d?(D=u?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(J,{className:`h-4 w-24`}),(0,Q.jsx)(J,{className:`h-10 w-full rounded-lg`})]}):d?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(`input`,{className:an(),value:f,onChange:e=>p(e.target.value),placeholder:`telegram`,autoComplete:`off`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsManualChannelHint})]}):(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(h,{className:c(an(),`py-2`),value:f,onChange:e=>{p(e.target.value),v(null),b(``)},children:l.map(e=>(0,Q.jsxs)(nt,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:n.channelsDisabledSuffix]},e.name))})]}),t[10]=n.channelLabel,t[11]=n.channelsDisabledSuffix,t[12]=n.channelsManualChannelHint,t[13]=l,t[14]=u,t[15]=f,t[16]=p,t[17]=b,t[18]=v,t[19]=d,t[20]=D):D=t[20];let O;t[21]!==n.channelsCustomPeerHint||t[22]!==n.channelsCustomPeerPlaceholder||t[23]!==n.channelsNoSessionsHint||t[24]!==n.channelsPeerAny||t[25]!==n.channelsPeerFromSessions||t[26]!==n.channelsRefreshSessions||t[27]!==n.channelsRefreshSessionsHint||t[28]!==n.channelsSessionLabel||t[29]!==n.peerIdLabel||t[30]!==m||t[31]!==r||t[32]!==S||t[33]!==f||t[34]!==y||t[35]!==_||t[36]!==x||t[37]!==C||t[38]!==g||t[39]!==b||t[40]!==v||t[41]!==w?(O=w&&f.trim()?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsSessionLabel}),(0,Q.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||g||!f.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>x(),children:[(0,Q.jsx)(Le,{className:c(`size-3.5`,g&&`animate-spin`),strokeWidth:1.75}),n.channelsRefreshSessions]})]}),g&&m.length===0?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(J,{className:`h-4 w-32`}),(0,Q.jsx)(J,{className:`h-10 w-full rounded-lg`})]}):null,(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsPeerFromSessions}),(0,Q.jsxs)(h,{className:c(an(),`py-2`),value:_==null?``:String(_),disabled:r||!f.trim()||!!y.trim(),onChange:e=>{let t=e.target.value;v(t===``?null:Number(t))},children:[(0,Q.jsx)(nt,{value:``,children:n.channelsPeerAny}),m.map((e,t)=>(0,Q.jsx)(nt,{value:String(t),children:Mt(e,S)},`${e.channel}-${e.chatId}`))]})]}),m.length===0&&f.trim()&&!g?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsNoSessionsHint}):null,(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.peerIdLabel}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,Q.jsx)(`input`,{type:`text`,className:c(an(),`min-w-0 w-full sm:flex-1`),value:y,onChange:e=>{b(e.target.value),e.target.value.trim()&&v(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,Q.jsxs)(h,{className:Cn,value:y,onChange:e=>{let t=e.target.value;b(t||``),v(null)},children:[(0,Q.jsx)(nt,{value:``,children:C}),m.map(e=>(0,Q.jsx)(nt,{value:e.chatId,children:Mt(e,S)},`${e.channel}-${e.chatId}`))]})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsCustomPeerHint})]})]}):null,t[21]=n.channelsCustomPeerHint,t[22]=n.channelsCustomPeerPlaceholder,t[23]=n.channelsNoSessionsHint,t[24]=n.channelsPeerAny,t[25]=n.channelsPeerFromSessions,t[26]=n.channelsRefreshSessions,t[27]=n.channelsRefreshSessionsHint,t[28]=n.channelsSessionLabel,t[29]=n.peerIdLabel,t[30]=m,t[31]=r,t[32]=S,t[33]=f,t[34]=y,t[35]=_,t[36]=x,t[37]=C,t[38]=g,t[39]=b,t[40]=v,t[41]=w,t[42]=O):O=t[42];let k;t[43]!==r||t[44]!==u||t[45]!==f?(k=r||!f.trim()||u,t[43]=r,t[44]=u,t[45]=f,t[46]=k):k=t[46];let A;t[47]!==n.addBinding||t[48]!==k?(A=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(q,{type:`submit`,disabled:k,children:n.addBinding})}),t[47]=n.addBinding,t[48]=k,t[49]=A):A=t[49];let j;t[50]!==s||t[51]!==D||t[52]!==O||t[53]!==A?(j=(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:s,children:[D,O,A]}),t[50]=s,t[51]=D,t[52]=O,t[53]=A,t[54]=j):j=t[54];let M;return t[55]!==T||t[56]!==E||t[57]!==j?(M=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[T,E,j]}),t[55]=T,t[56]=E,t[57]=j,t[58]=M):M=t[58],M}function Tn(e,t){return(0,Q.jsx)(J,{className:`h-10 rounded-lg`},t)}function En(e,t){switch(e){case`adventurer`:return t.avatarStyleAdventurer;case`bottts`:return t.avatarStyleRobot;case`lorelei`:return t.avatarStyleLorelei;case`thumbs`:return t.avatarStyleThumbs;case`fun-emoji`:return t.avatarStyleFunEmoji;default:return e}}function Dn(e){let{agentId:t,value:n,onChange:r,a:i,id:a}=e,o=(0,$.useRef)(null),[s,l]=(0,$.useState)(!1),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=(0,$.useMemo)(()=>{let e=st(n.trim());return e&&rt(e.styleId)?e.styleId:Ie[0]??`adventurer`},[n]),h=(0,$.useCallback)(async(e,n)=>{try{await L(t)}catch{}r(ve(e,n)),p(!1)},[t,r]),g=(0,$.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){d(null),l(!0);try{await me(t,n),Se(t),r(Me)}catch(e){let t=e instanceof Error?e.message:``;d(t===`avatar_too_large`?i.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?i.avatarInvalidImage:i.avatarUploadFailed)}finally{l(!1)}}},[i,t,r]),_=(e,t)=>{let r=st(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,Q.jsxs)(`div`,{...a?{id:a}:{},className:`flex flex-col gap-3 sm:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:i.avatarPickerTitle}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{ref:o,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void g(e)}),(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,className:`gap-1.5 px-2.5 py-1.5 text-xs`,disabled:s,onClick:()=>o.current?.click(),children:[(0,Q.jsx)(V,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),s?i.avatarUploading:i.avatarUploadCustom]})]})]}),u?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:u}):null,(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ie.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void h(e,Ge[0]??t),className:c(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,Pe.press,m===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:En(e,i)},e))}),(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/50 p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Ge.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:c(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,Pe.press,_(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:bt(m,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)(Y,{open:f,onOpenChange:p,children:[(0,Q.jsx)(We,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:c(`flex size-12 shrink-0 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`,Pe.press),children:i.avatarMore})}),(0,Q.jsx)(tt,{children:(0,Q.jsxs)(Xe,{className:`z-[80] max-h-72 w-[min(22rem,calc(100vw-2rem))] overflow-y-auto rounded-xl border border-edge-subtle bg-surface-panel p-3 shadow-lg`,sideOffset:6,align:`end`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:En(m,i)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ze.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:c(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,Pe.press,_(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:bt(m,e,88),alt:``,width:40,height:40,className:`size-10 rounded-full object-cover`,draggable:!1})},e))})]})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i.personaAvatar}),(0,Q.jsx)(je,{agentId:t,avatar:n,size:40}),n.trim()&&!st(n.trim())&&n.trim()!==`xopc:custom`?(0,Q.jsx)(`span`,{className:`truncate font-mono text-[10px] text-fg-muted`,title:n,children:n}):null]})]})]})}function On(e){let t=(0,Z.c)(180),{a:n,selected:r,busy:i,editName:a,setEditName:s,editDescription:l,setEditDescription:u,profileMarkdownLoading:p,profileDraft:m,updateIdentity:g,handleSoulTemplateChange:y,handleSoulContentChange:b,setAvatarDialogOpen:x,toggleSoulPreviewMode:S}=e,C=d(jn),w=f(An),E;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=an(),t[0]=E):E=t[0];let O=E,k;t[1]===C?k=t[2]:(k=(e,t)=>C===`zh`?t:e,t[1]=C,t[2]=k);let A=k;if(!r){let e;return t[3]===n.selectAgentHint?e=t[4]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[3]=n.selectAgentHint,t[4]=e),e}if(p||!m){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(gt,{rows:4}),t[5]=e):e=t[5],e}let j=m.identity,M=m.soulTemplate,N=m.soulCustomContent,P=m.soulEditorNonce,F=m.soulPreviewMode,I=m.avatarDialogOpen,L;t[6]!==j.avatar||t[7]!==r.id?(L=(0,Q.jsx)(je,{agentId:r.id,avatar:j.avatar,size:36,className:`size-9 rounded-lg`}),t[6]=j.avatar,t[7]=r.id,t[8]=L):L=t[8];let R;t[9]===x?R=t[10]:(R=()=>x(!0),t[9]=x,t[10]=R);let ee;t[11]!==n.avatarOpenSettingsAria||t[12]!==R?(ee={onClick:R,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[11]=n.avatarOpenSettingsAria,t[12]=R,t[13]=ee):ee=t[13];let te;t[14]!==n.personaSectionIdentity||t[15]!==n.personaSectionIdentityHint||t[16]!==L||t[17]!==ee?(te=(0,Q.jsx)(_t,{icon:ie,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:L,iconInteractive:ee}),t[14]=n.personaSectionIdentity,t[15]=n.personaSectionIdentityHint,t[16]=L,t[17]=ee,t[18]=te):te=t[18];let re;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(D,{className:c(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,ze)}),t[19]=re):re=t[19];let B;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(B=c(`fixed left-1/2 top-1/2 w-[min(calc(100vw-2rem),26rem)] max-h-[min(90dvh,36rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,et),t[20]=B):B=t[20];let V;t[21]===n.avatarPickerTitle?V=t[22]:(V=(0,Q.jsx)(pe,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[21]=n.avatarPickerTitle,t[22]=V);let H;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(H=c(Re,`shrink-0 p-1.5 hover:bg-surface-base`),t[23]=H):H=t[23];let U;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),t[24]=U):U=t[24];let W;t[25]===n.closeDialogAria?W=t[26]:(W=(0,Q.jsx)(ut,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:H,"aria-label":n.closeDialogAria,children:U})}),t[25]=n.closeDialogAria,t[26]=W);let G;t[27]!==W||t[28]!==V?(G=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[V,W]}),t[27]=W,t[28]=V,t[29]=G):G=t[29];let K;t[30]===n.avatarRowHint?K=t[31]:(K=(0,Q.jsx)(de,{className:`sr-only`,children:n.avatarRowHint}),t[30]=n.avatarRowHint,t[31]=K);let q;t[32]===g?q=t[33]:(q=e=>g({avatar:e}),t[32]=g,t[33]=q);let ce;t[34]!==n||t[35]!==j.avatar||t[36]!==r.id||t[37]!==q?(ce=(0,Q.jsx)(Dn,{agentId:r.id,value:j.avatar,onChange:q,a:n}),t[34]=n,t[35]=j.avatar,t[36]=r.id,t[37]=q,t[38]=ce):ce=t[38];let le;t[39]!==G||t[40]!==K||t[41]!==ce?(le=(0,Q.jsxs)(se,{children:[re,(0,Q.jsxs)(v,{className:B,onOpenAutoFocus:kn,children:[G,K,ce]})]}),t[39]=G,t[40]=K,t[41]=ce,t[42]=le):le=t[42];let ue;t[43]!==I||t[44]!==x||t[45]!==le?(ue=(0,Q.jsx)(ae,{open:I,onOpenChange:x,children:le}),t[43]=I,t[44]=x,t[45]=le,t[46]=ue):ue=t[46];let fe;t[47]===n.displayName?fe=t[48]:(fe=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[47]=n.displayName,t[48]=fe);let me;t[49]!==s||t[50]!==g?(me=e=>{s(e.target.value),g({name:e.target.value})},t[49]=s,t[50]=g,t[51]=me):me=t[51];let J;t[52]!==n.personaNamePlaceholder||t[53]!==a||t[54]!==me?(J=(0,Q.jsx)(`input`,{className:O,value:a,onChange:me,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[52]=n.personaNamePlaceholder,t[53]=a,t[54]=me,t[55]=J):J=t[55];let he;t[56]!==fe||t[57]!==J?(he=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[fe,J]}),t[56]=fe,t[57]=J,t[58]=he):he=t[58];let ge;t[59]===n.personaEmoji?ge=t[60]:(ge=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[59]=n.personaEmoji,t[60]=ge);let _e;t[61]===g?_e=t[62]:(_e=e=>g({emoji:e.target.value}),t[61]=g,t[62]=_e);let ve;t[63]!==n.personaEmojiPlaceholder||t[64]!==j.emoji||t[65]!==_e?(ve=(0,Q.jsx)(`input`,{className:O,value:j.emoji,onChange:_e,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[63]=n.personaEmojiPlaceholder,t[64]=j.emoji,t[65]=_e,t[66]=ve):ve=t[66];let ye;t[67]!==ge||t[68]!==ve?(ye=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[ge,ve]}),t[67]=ge,t[68]=ve,t[69]=ye):ye=t[69];let be;t[70]===n.agentDescription?be=t[71]:(be=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[70]=n.agentDescription,t[71]=be);let xe;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(xe=c(O,`min-h-16 resize-y text-sm leading-relaxed`),t[72]=xe):xe=t[72];let Se;t[73]!==u||t[74]!==g?(Se=e=>{u(e.target.value),g({description:e.target.value})},t[73]=u,t[74]=g,t[75]=Se):Se=t[75];let Ce;t[76]!==n.agentDescriptionPlaceholder||t[77]!==l||t[78]!==Se?(Ce=(0,Q.jsx)(`textarea`,{className:xe,value:l,onChange:Se,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[76]=n.agentDescriptionPlaceholder,t[77]=l,t[78]=Se,t[79]=Ce):Ce=t[79];let we;t[80]!==be||t[81]!==Ce?(we=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[be,Ce]}),t[80]=be,t[81]=Ce,t[82]=we):we=t[82];let Te;t[83]===n.personaCreature?Te=t[84]:(Te=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[83]=n.personaCreature,t[84]=Te);let Ee=De.some(e=>e.value===j.creature)?j.creature:`__custom__`,Y;t[85]===g?Y=t[86]:(Y=e=>{if(e.target.value===`__custom__`){g({creature:``});return}g({creature:e.target.value})},t[85]=g,t[86]=Y);let ke;t[87]===A?ke=t[88]:(ke=De.map(e=>(0,Q.jsx)(nt,{value:e.value,children:A(e.labelEn,e.labelZh)},e.value)),t[87]=A,t[88]=ke);let Ae;t[89]===A?Ae=t[90]:(Ae=A(`Custom…`,`自定义…`),t[89]=A,t[90]=Ae);let Me;t[91]===Ae?Me=t[92]:(Me=(0,Q.jsx)(nt,{value:`__custom__`,children:Ae}),t[91]=Ae,t[92]=Me);let Ne;t[93]!==Ee||t[94]!==Y||t[95]!==ke||t[96]!==Me?(Ne=(0,Q.jsxs)(h,{className:O,value:Ee,onChange:Y,children:[ke,Me]}),t[93]=Ee,t[94]=Y,t[95]=ke,t[96]=Me,t[97]=Ne):Ne=t[97];let Pe;t[98]!==n.personaCreaturePlaceholder||t[99]!==j.creature||t[100]!==g?(Pe=De.some(e=>e.value===j.creature)?null:(0,Q.jsx)(`input`,{className:c(O,`mt-1 text-xs`),value:j.creature,onChange:e=>g({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[98]=n.personaCreaturePlaceholder,t[99]=j.creature,t[100]=g,t[101]=Pe):Pe=t[101];let Fe;t[102]!==Te||t[103]!==Ne||t[104]!==Pe?(Fe=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[Te,Ne,Pe]}),t[102]=Te,t[103]=Ne,t[104]=Pe,t[105]=Fe):Fe=t[105];let Ie;t[106]!==he||t[107]!==ye||t[108]!==we||t[109]!==Fe?(Ie=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[he,ye,we,Fe]}),t[106]=he,t[107]=ye,t[108]=we,t[109]=Fe,t[110]=Ie):Ie=t[110];let Le;t[111]!==ue||t[112]!==Ie||t[113]!==te?(Le=(0,Q.jsxs)(vt,{children:[te,ue,Ie]}),t[111]=ue,t[112]=Ie,t[113]=te,t[114]=Le):Le=t[114];let Be;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Q.jsx)(Oe,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[115]=Be):Be=t[115];let Ve;t[116]===n.sharedUserContextTitle?Ve=t[117]:(Ve=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.sharedUserContextTitle}),t[116]=n.sharedUserContextTitle,t[117]=Ve);let Ue;t[118]===n.sharedUserContextHint?Ue=t[119]:(Ue=(0,Q.jsx)(`p`,{className:`mt-0.5 max-w-[68ch] text-xs leading-5 text-fg-muted`,children:n.sharedUserContextHint}),t[118]=n.sharedUserContextHint,t[119]=Ue);let We;t[120]!==Ve||t[121]!==Ue?(We=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[Ve,Ue]}),t[120]=Ve,t[121]=Ue,t[122]=We):We=t[122];let X;t[123]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Q.jsx)(T,{className:`size-3`,"aria-hidden":!0}),t[123]=X):X=t[123];let Ge;t[124]===n.sharedUserContextLink?Ge=t[125]:(Ge=(0,Q.jsxs)(o,{to:`/you`,className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.sharedUserContextLink,X]}),t[124]=n.sharedUserContextLink,t[125]=Ge);let Ke;t[126]!==We||t[127]!==Ge?(Ke=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[Be,We,Ge]}),t[126]=We,t[127]=Ge,t[128]=Ke):Ke=t[128];let qe;t[129]!==n.personaSectionSoul||t[130]!==n.personaSectionSoulHint?(qe=(0,Q.jsx)(_t,{icon:He,title:n.personaSectionSoul,subtitle:n.personaSectionSoulHint}),t[129]=n.personaSectionSoul,t[130]=n.personaSectionSoulHint,t[131]=qe):qe=t[131];let Je;t[132]===n.personaSoulTemplate?Je=t[133]:(Je=(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulTemplate}),t[132]=n.personaSoulTemplate,t[133]=Je);let Ye;t[134]===y?Ye=t[135]:(Ye=e=>y(e.target.value),t[134]=y,t[135]=Ye);let Xe;t[136]===A?Xe=t[137]:(Xe=Qe.map(e=>(0,Q.jsxs)(nt,{value:e.id,children:[e.emoji,` `,A(e.labelEn,e.labelZh)]},e.id)),t[136]=A,t[137]=Xe);let Ze;t[138]!==i||t[139]!==M||t[140]!==Ye||t[141]!==Xe?(Ze=(0,Q.jsx)(h,{className:O,value:M,onChange:Ye,disabled:i,children:Xe}),t[138]=i,t[139]=M,t[140]=Ye,t[141]=Xe,t[142]=Ze):Ze=t[142];let $e;t[143]===n.personaTemplateHint?$e=t[144]:($e=(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:n.personaTemplateHint}),t[143]=n.personaTemplateHint,t[144]=$e);let tt;t[145]!==Je||t[146]!==Ze||t[147]!==$e?(tt=(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:max-w-sm`,children:[Je,Ze,$e]}),t[145]=Je,t[146]=Ze,t[147]=$e,t[148]=tt):tt=t[148];let rt;t[149]===n.personaBehaviorEditorLabel?rt=t[150]:(rt=(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaBehaviorEditorLabel}),t[149]=n.personaBehaviorEditorLabel,t[150]=rt);let it;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(it=c(Re,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),t[151]=it):it=t[151];let at=F?n.personaSoulEdit:n.personaSoulPreview,ot=F?n.personaSoulEdit:n.personaSoulPreview,st;t[152]===F?st=t[153]:(st=F?(0,Q.jsx)(ne,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(z,{className:`size-4`,"aria-hidden":!0}),t[152]=F,t[153]=st);let ct;t[154]!==at||t[155]!==ot||t[156]!==st||t[157]!==S?(ct=(0,Q.jsx)(`button`,{type:`button`,className:it,title:at,"aria-label":ot,onClick:S,children:st}),t[154]=at,t[155]=ot,t[156]=st,t[157]=S,t[158]=ct):ct=t[158];let lt;t[159]!==rt||t[160]!==ct?(lt=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[rt,ct]}),t[159]=rt,t[160]=ct,t[161]=lt):lt=t[161];let dt;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(dt=c(O,`flex min-h-64 flex-col overflow-hidden p-0`),t[162]=dt):dt=t[162];let pt;t[163]!==b||t[164]!==w||t[165]!==N||t[166]!==P||t[167]!==F?(pt=(0,Q.jsx)(`div`,{className:dt,children:F?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(_,{content:N})}):(0,Q.jsx)(ft,{initialContent:N,onChange:b,isDark:w,className:`min-h-0 flex-1`},`soul-${P}`)}),t[163]=b,t[164]=w,t[165]=N,t[166]=P,t[167]=F,t[168]=pt):pt=t[168];let mt;t[169]!==lt||t[170]!==pt?(mt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[lt,pt]}),t[169]=lt,t[170]=pt,t[171]=mt):mt=t[171];let ht;t[172]!==qe||t[173]!==tt||t[174]!==mt?(ht=(0,Q.jsxs)(vt,{children:[qe,tt,mt]}),t[172]=qe,t[173]=tt,t[174]=mt,t[175]=ht):ht=t[175];let yt;return t[176]!==Le||t[177]!==Ke||t[178]!==ht?(yt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[Le,Ke,ht]}),t[176]=Le,t[177]=Ke,t[178]=ht,t[179]=yt):yt=t[179],yt}function kn(e){return e.preventDefault()}function An(e){return e.resolved===`dark`}function jn(e){return e.language}function Mn(e){let t=(0,Z.c)(13),{label:n,value:r,badge:i,mono:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s;t[2]===i?s=t[3]:(s=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:i}),t[2]=i,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l=a?`mt-2 truncate font-mono text-xs text-fg`:`mt-2 truncate text-sm font-medium text-fg`,u;t[7]!==l||t[8]!==r?(u=(0,Q.jsx)(`p`,{className:l,children:r}),t[7]=l,t[8]=r,t[9]=u):u=t[9];let d;return t[10]!==c||t[11]!==u?(d=(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function Nn(e){let t=(0,Z.c)(12),{icon:n,label:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.8,"aria-hidden":!0})}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:i}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Pn(e){let t=(0,Z.c)(117),{a:n,selected:r,defaultModel:i,defaultWorkspace:a,isTuiDefault:o,isTuiDefaultInherited:s,busy:c,onSetDefault:l,onSetTuiDefault:u,onTryInChat:d}=e,f;t[0]!==n||t[1]!==r?(f=g(r,n),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p=f,m;t[3]!==n||t[4]!==r?(m=Ue(r,n)||n.listNoDescription,t[3]=n,t[4]=r,t[5]=m):m=t[5];let h=m,_;t[6]!==n.listUnsetValue||t[7]!==i||t[8]!==r.model?.primary?(_=r.model?.primary?.trim()||i||n.listUnsetValue,t[6]=n.listUnsetValue,t[7]=i,t[8]=r.model?.primary,t[9]=_):_=t[9];let v=_,y;t[10]!==n.listUnsetValue||t[11]!==a||t[12]!==r.workspace?(y=r.workspace?.trim()||a||n.listUnsetValue,t[10]=n.listUnsetValue,t[11]=a,t[12]=r.workspace,t[13]=y):y=t[13];let b=y,x=r.model?.primary?.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,S=r.workspace?.trim()&&r.workspace.trim()!==a.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,w=r.tools.effectiveDisable.length,T=r.skills.effectiveAllowlist?.length,E;t[14]!==r.avatar||t[15]!==r.id?(E=(0,Q.jsx)(`div`,{className:`flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base ring-1 ring-edge-subtle/50`,children:(0,Q.jsx)(je,{agentId:r.id,avatar:r.avatar,size:56,className:`size-full`})}),t[14]=r.avatar,t[15]=r.id,t[16]=E):E=t[16];let D;t[17]===p?D=t[18]:(D=(0,Q.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:p}),t[17]=p,t[18]=D);let O;t[19]!==n.globalDefaultBadge||t[20]!==r.isDefault?(O=r.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,t[19]=n.globalDefaultBadge,t[20]=r.isDefault,t[21]=O):O=t[21];let k;t[22]!==n.tuiDefaultBadge||t[23]!==n.tuiDefaultInheritedBadge||t[24]!==o||t[25]!==s?(k=o?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:s?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null,t[22]=n.tuiDefaultBadge,t[23]=n.tuiDefaultInheritedBadge,t[24]=o,t[25]=s,t[26]=k):k=t[26];let A;t[27]!==D||t[28]!==O||t[29]!==k?(A=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[D,O,k]}),t[27]=D,t[28]=O,t[29]=k,t[30]=A):A=t[30];let j;t[31]===r.id?j=t[32]:(j=(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r.id}),t[31]=r.id,t[32]=j);let M;t[33]!==j||t[34]!==A?(M=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[A,j]}),t[33]=j,t[34]=A,t[35]=M):M=t[35];let N;t[36]!==M||t[37]!==E?(N=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[E,M]}),t[36]=M,t[37]=E,t[38]=N):N=t[38];let P;t[39]!==n.tryInChat||t[40]!==c||t[41]!==d?(P=d?(0,Q.jsxs)(q,{type:`button`,disabled:c,onClick:d,children:[(0,Q.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),n.tryInChat]}):null,t[39]=n.tryInChat,t[40]=c,t[41]=d,t[42]=P):P=t[42];let F;t[43]!==n.setDefault||t[44]!==c||t[45]!==l||t[46]!==r.isDefault?(F=r.isDefault?null:(0,Q.jsx)(q,{type:`button`,variant:`secondary`,disabled:c,onClick:l,children:n.setDefault}),t[43]=n.setDefault,t[44]=c,t[45]=l,t[46]=r.isDefault,t[47]=F):F=t[47];let I;t[48]!==n.setTuiDefault||t[49]!==c||t[50]!==o||t[51]!==u?(I=o?null:(0,Q.jsx)(q,{type:`button`,variant:`secondary`,disabled:c,onClick:u,children:n.setTuiDefault}),t[48]=n.setTuiDefault,t[49]=c,t[50]=o,t[51]=u,t[52]=I):I=t[52];let L;t[53]!==P||t[54]!==F||t[55]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[P,F,I]}),t[53]=P,t[54]=F,t[55]=I,t[56]=L):L=t[56];let R;t[57]!==N||t[58]!==L?(R=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[N,L]}),t[57]=N,t[58]=L,t[59]=R):R=t[59];let ee;t[60]===h?ee=t[61]:(ee=(0,Q.jsx)(`p`,{className:`w-full text-sm leading-6 text-fg-muted`,children:h}),t[60]=h,t[61]=ee);let te;t[62]!==R||t[63]!==ee?(te=(0,Q.jsx)(vt,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[R,ee]})}),t[62]=R,t[63]=ee,t[64]=te):te=t[64];let ne;t[65]!==n.overviewRuntimeHint||t[66]!==n.overviewRuntimeTitle?(ne=(0,Q.jsx)(_t,{icon:ie,title:n.overviewRuntimeTitle,subtitle:n.overviewRuntimeHint}),t[65]=n.overviewRuntimeHint,t[66]=n.overviewRuntimeTitle,t[67]=ne):ne=t[67];let re;t[68]!==n.modelPrimary||t[69]!==x||t[70]!==v?(re=(0,Q.jsx)(Mn,{label:n.modelPrimary,value:v,badge:x,mono:!0}),t[68]=n.modelPrimary,t[69]=x,t[70]=v,t[71]=re):re=t[71];let z;t[72]!==n.workspacePath||t[73]!==S||t[74]!==b?(z=(0,Q.jsx)(Mn,{label:n.workspacePath,value:b,badge:S,mono:!0}),t[72]=n.workspacePath,t[73]=S,t[74]=b,t[75]=z):z=t[75];let B;t[76]!==re||t[77]!==z?(B=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[re,z]}),t[76]=re,t[77]=z,t[78]=B):B=t[78];let V;t[79]!==ne||t[80]!==B?(V=(0,Q.jsxs)(vt,{children:[ne,B]}),t[79]=ne,t[80]=B,t[81]=V):V=t[81];let ae;t[82]!==n.overviewCapabilitiesHint||t[83]!==n.overviewCapabilitiesTitle?(ae=(0,Q.jsx)(_t,{icon:Ke,title:n.overviewCapabilitiesTitle,subtitle:n.overviewCapabilitiesHint}),t[82]=n.overviewCapabilitiesHint,t[83]=n.overviewCapabilitiesTitle,t[84]=ae):ae=t[84];let H;t[85]!==n.listToolsAllEnabled||t[86]!==n.listToolsDisabledCount||t[87]!==w?(H=w>0?n.listToolsDisabledCount.replace(`{{count}}`,String(w)):n.listToolsAllEnabled,t[85]=n.listToolsAllEnabled,t[86]=n.listToolsDisabledCount,t[87]=w,t[88]=H):H=t[88];let U;t[89]!==n.listToolsLabel||t[90]!==H?(U=(0,Q.jsx)(Nn,{icon:C,label:n.listToolsLabel,value:H}),t[89]=n.listToolsLabel,t[90]=H,t[91]=U):U=t[91];let W;t[92]!==n.listInheritedValue||t[93]!==n.listSkillsCount||t[94]!==T?(W=T?n.listSkillsCount.replace(`{{count}}`,String(T)):n.listInheritedValue,t[92]=n.listInheritedValue,t[93]=n.listSkillsCount,t[94]=T,t[95]=W):W=t[95];let G;t[96]!==n.listSkillsLabel||t[97]!==W?(G=(0,Q.jsx)(Nn,{icon:ie,label:n.listSkillsLabel,value:W}),t[96]=n.listSkillsLabel,t[97]=W,t[98]=G):G=t[98];let K;t[99]!==n.connectionsTitle||t[100]!==n.overviewConnectionsManaged?(K=(0,Q.jsx)(Nn,{icon:X,label:n.connectionsTitle,value:n.overviewConnectionsManaged}),t[99]=n.connectionsTitle,t[100]=n.overviewConnectionsManaged,t[101]=K):K=t[101];let oe;t[102]!==n.overviewSharedMemoryLabel||t[103]!==n.overviewSharedMemoryValue?(oe=(0,Q.jsx)(Nn,{icon:Oe,label:n.overviewSharedMemoryLabel,value:n.overviewSharedMemoryValue}),t[102]=n.overviewSharedMemoryLabel,t[103]=n.overviewSharedMemoryValue,t[104]=oe):oe=t[104];let se;t[105]!==U||t[106]!==G||t[107]!==K||t[108]!==oe?(se=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[U,G,K,oe]}),t[105]=U,t[106]=G,t[107]=K,t[108]=oe,t[109]=se):se=t[109];let ce;t[110]!==ae||t[111]!==se?(ce=(0,Q.jsxs)(vt,{children:[ae,se]}),t[110]=ae,t[111]=se,t[112]=ce):ce=t[112];let le;return t[113]!==te||t[114]!==V||t[115]!==ce?(le=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto`,children:[te,V,ce]}),t[113]=te,t[114]=V,t[115]=ce,t[116]=le):le=t[116],le}function Fn(e){let t=(0,Z.c)(68),{a:n,chat:r,selected:i,busy:a,modelRows:o,setModelRows:s,onSaveModels:c,onClearModelsEntry:l,hideInlineSave:u}=e,d;t[0]!==n.modelsTabHint||t[1]!==n.modelsTabTitle?(d=(0,Q.jsx)(_t,{className:`shrink-0`,icon:Ye,title:n.modelsTabTitle,subtitle:n.modelsTabHint}),t[0]=n.modelsTabHint,t[1]=n.modelsTabTitle,t[2]=d):d=t[2];let f;t[3]===n.modelsPresetLabel?f=t[4]:(f=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsPresetLabel}),t[3]=n.modelsPresetLabel,t[4]=f);let p;t[5]===i.typedModels.preset?p=t[6]:(p=Dt(i.typedModels.preset),t[5]=i.typedModels.preset,t[6]=p);let m;t[7]!==f||t[8]!==p?(m=(0,Q.jsxs)(`div`,{children:[f,` `,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===n.modelsEffectiveLabel?h=t[11]:(h=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsEffectiveLabel}),t[10]=n.modelsEffectiveLabel,t[11]=h);let g;t[12]===i.typedModels.effective?g=t[13]:(g=Dt(i.typedModels.effective),t[12]=i.typedModels.effective,t[13]=g);let _;t[14]!==h||t[15]!==g?(_=(0,Q.jsxs)(`div`,{children:[h,` `,g]}),t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==m||t[18]!==_?(v=(0,Q.jsxs)(`div`,{className:`mb-4 grid gap-2 rounded-lg bg-surface-panel/60 p-3 text-xs text-fg-muted shadow-surface`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==n.addTypedModel||t[21]!==n.addTypedModelPurpose||t[22]!==n.removeTypedModel||t[23]!==n.typedModelAddFallback||t[24]!==n.typedModelCustomTitle||t[25]!==n.typedModelDefaultBadge||t[26]!==n.typedModelDescriptionLabel||t[27]!==n.typedModelDescriptionPlaceholder||t[28]!==n.typedModelFallbackEmptyHint||t[29]!==n.typedModelFallbackModelsLabel||t[30]!==n.typedModelFallbackPlaceholder||t[31]!==n.typedModelIdLabel||t[32]!==n.typedModelIdPlaceholder||t[33]!==n.typedModelNoCustomRoles||t[34]!==n.typedModelPrimaryModelLabel||t[35]!==n.typedModelRecommendedTitle||t[36]!==n.typedModelRemoveFallback||t[37]!==n.typedModelRoleDescriptions||t[38]!==n.typedModelRoleNames||t[39]!==n.typedModelVisionAutoHint||t[40]!==n.typedModelVisionBadge?(y={id:n.typedModelIdLabel,description:n.typedModelDescriptionLabel,primaryModel:n.typedModelPrimaryModelLabel,fallbackModels:n.typedModelFallbackModelsLabel,addFallback:n.typedModelAddFallback,removeFallback:n.typedModelRemoveFallback,fallbackPlaceholder:n.typedModelFallbackPlaceholder,fallbackEmptyHint:n.typedModelFallbackEmptyHint,add:n.addTypedModel,remove:n.removeTypedModel,recommendedTitle:n.typedModelRecommendedTitle,customTitle:n.typedModelCustomTitle,defaultBadge:n.typedModelDefaultBadge,visionBadge:n.typedModelVisionBadge,visionAutoHint:n.typedModelVisionAutoHint,addPurpose:n.addTypedModelPurpose,noCustomRoles:n.typedModelNoCustomRoles,idPlaceholder:n.typedModelIdPlaceholder,descriptionPlaceholder:n.typedModelDescriptionPlaceholder,roleNames:n.typedModelRoleNames,roleDescriptions:n.typedModelRoleDescriptions},t[20]=n.addTypedModel,t[21]=n.addTypedModelPurpose,t[22]=n.removeTypedModel,t[23]=n.typedModelAddFallback,t[24]=n.typedModelCustomTitle,t[25]=n.typedModelDefaultBadge,t[26]=n.typedModelDescriptionLabel,t[27]=n.typedModelDescriptionPlaceholder,t[28]=n.typedModelFallbackEmptyHint,t[29]=n.typedModelFallbackModelsLabel,t[30]=n.typedModelFallbackPlaceholder,t[31]=n.typedModelIdLabel,t[32]=n.typedModelIdPlaceholder,t[33]=n.typedModelNoCustomRoles,t[34]=n.typedModelPrimaryModelLabel,t[35]=n.typedModelRecommendedTitle,t[36]=n.typedModelRemoveFallback,t[37]=n.typedModelRoleDescriptions,t[38]=n.typedModelRoleNames,t[39]=n.typedModelVisionAutoHint,t[40]=n.typedModelVisionBadge,t[41]=y):y=t[41];let b;t[42]!==a||t[43]!==r||t[44]!==o||t[45]!==i.typedModels.defaultRole||t[46]!==s||t[47]!==y?(b=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(xt,{rows:o,onChange:s,disabled:a,defaultRole:i.typedModels.defaultRole,chat:r,labels:y})}),t[42]=a,t[43]=r,t[44]=o,t[45]=i.typedModels.defaultRole,t[46]=s,t[47]=y,t[48]=b):b=t[48];let x;t[49]!==n.modelsSave||t[50]!==a||t[51]!==u||t[52]!==c?(x=u?null:(0,Q.jsx)(q,{type:`button`,disabled:a,onClick:()=>void c(),children:n.modelsSave}),t[49]=n.modelsSave,t[50]=a,t[51]=u,t[52]=c,t[53]=x):x=t[53];let S;t[54]===l?S=t[55]:(S=()=>void l(),t[54]=l,t[55]=S);let C;t[56]!==n.modelsResetInherit||t[57]!==a||t[58]!==S?(C=(0,Q.jsx)(q,{type:`button`,variant:`secondary`,disabled:a,onClick:S,children:n.modelsResetInherit}),t[56]=n.modelsResetInherit,t[57]=a,t[58]=S,t[59]=C):C=t[59];let w;t[60]!==x||t[61]!==C?(w=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[x,C]}),t[60]=x,t[61]=C,t[62]=w):w=t[62];let T;return t[63]!==d||t[64]!==w||t[65]!==v||t[66]!==b?(T=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[d,v,b,w]}),t[63]=d,t[64]=w,t[65]=v,t[66]=b,t[67]=T):T=t[67],T}function In(e){let t=(0,Z.c)(29),{a:n,chat:r,selected:i,busy:a,editWorkspace:o,setEditWorkspace:s,modelRows:l,setModelRows:u,onSaveModels:d,onClearModelsEntry:f}=e,p;t[0]!==n.runtimeWorkspaceHint||t[1]!==n.runtimeWorkspaceTitle?(p=(0,Q.jsx)(_t,{icon:S,title:n.runtimeWorkspaceTitle,subtitle:n.runtimeWorkspaceHint}),t[0]=n.runtimeWorkspaceHint,t[1]=n.runtimeWorkspaceTitle,t[2]=p):p=t[2];let m;t[3]===n.workspacePath?m=t[4]:(m=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[3]=n.workspacePath,t[4]=m);let h=r.workingDirectory,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=c(an(),`font-mono text-xs`),t[5]=g):g=t[5];let _;t[6]!==a||t[7]!==r.workingDirectory||t[8]!==o||t[9]!==s?(_=(0,Q.jsx)(Nt,{value:o,onChange:s,disabled:a,wd:h,inputClassName:g}),t[6]=a,t[7]=r.workingDirectory,t[8]=o,t[9]=s,t[10]=_):_=t[10];let v;t[11]!==m||t[12]!==_?(v=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[m,_]}),t[11]=m,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==p||t[15]!==v?(y=(0,Q.jsxs)(vt,{children:[p,v]}),t[14]=p,t[15]=v,t[16]=y):y=t[16];let b;t[17]!==n||t[18]!==a||t[19]!==r||t[20]!==l||t[21]!==f||t[22]!==d||t[23]!==i||t[24]!==u?(b=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(Fn,{a:n,chat:r,selected:i,busy:a,modelRows:l,setModelRows:u,onSaveModels:d,onClearModelsEntry:f,hideInlineSave:!0})}),t[17]=n,t[18]=a,t[19]=r,t[20]=l,t[21]=f,t[22]=d,t[23]=i,t[24]=u,t[25]=b):b=t[25];let x;return t[26]!==y||t[27]!==b?(x=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[y,b]}),t[26]=y,t[27]=b,t[28]=x):x=t[28],x}function Ln(e){let t=(0,Z.c)(107),{a:n,chat:r,cCron:i,selected:a,panel:o,data:s,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,defaultModel:g,defaultWorkspace:_,onSetDefault:v,onSetTuiDefault:y,isTuiDefault:b,isTuiDefaultInherited:x,onDelete:S,capabilityPresets:C,defaultPresetId:w,onUpdateAgentExtends:T,onOpenCapabilityPreset:E,overviewProfile:D,filesLoading:O,files:k,activeFile:A,setActiveFile:j,filesViewMode:M,setFilesViewMode:N,fileDraft:P,setFileDraft:F,fileSaving:I,profileFileLoading:L,profileEditorNonce:R,toolEntryDisable:ee,setToolEntryDisable:te,onSaveTools:ne,onClearToolsEntry:re,modelRows:z,setModelRows:B,onSaveModels:V,onClearModelsEntry:ie,skillsCatalogLoading:ae,catalogForPick:H,skillsInherit:U,setSkillsInherit:W,skillsPick:G,setSkillsPick:K,onSaveSkills:q,bindingsLoading:oe,agentBindings:se,bindChannelStatuses:ce,bindChannelsLoading:le,useManualChannel:ue,newBindChannel:de,setNewBindChannel:fe,bindSessionChats:pe,bindSessionsLoading:me,newBindSessionIdx:J,setNewBindSessionIdx:he,newBindCustomPeer:ge,setNewBindCustomPeer:_e,refreshBindSessions:ve,onRemoveBinding:ye,onAddBinding:be,onTryInChat:xe}=e;if(!a){let e;return t[0]===n.selectAgentHint?e=t[1]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[0]=n.selectAgentHint,t[1]=e),e}if(o===`overview`){let e;return t[2]!==n||t[3]!==c||t[4]!==g||t[5]!==_||t[6]!==b||t[7]!==x||t[8]!==v||t[9]!==y||t[10]!==xe||t[11]!==a?(e=(0,Q.jsx)(Pn,{a:n,selected:a,defaultModel:g,defaultWorkspace:_,isTuiDefault:b,isTuiDefaultInherited:x,busy:c,onSetDefault:v,onSetTuiDefault:y,onTryInChat:xe}),t[2]=n,t[3]=c,t[4]=g,t[5]=_,t[6]=b,t[7]=x,t[8]=v,t[9]=y,t[10]=xe,t[11]=a,t[12]=e):e=t[12],e}if(o===`profile`){let e;return t[13]!==n||t[14]!==c||t[15]!==d||t[16]!==l||t[17]!==D.draft||t[18]!==D.handleSoulContentChange||t[19]!==D.handleSoulTemplateChange||t[20]!==D.profileMarkdownLoading||t[21]!==D.setAvatarDialogOpen||t[22]!==D.toggleSoulPreviewMode||t[23]!==D.updateIdentity||t[24]!==a||t[25]!==f||t[26]!==u?(e=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Q.jsx)(On,{a:n,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,profileMarkdownLoading:D.profileMarkdownLoading,profileDraft:D.draft,updateIdentity:D.updateIdentity,handleSoulTemplateChange:D.handleSoulTemplateChange,handleSoulContentChange:D.handleSoulContentChange,setAvatarDialogOpen:D.setAvatarDialogOpen,toggleSoulPreviewMode:D.toggleSoulPreviewMode})}),t[13]=n,t[14]=c,t[15]=d,t[16]=l,t[17]=D.draft,t[18]=D.handleSoulContentChange,t[19]=D.handleSoulTemplateChange,t[20]=D.profileMarkdownLoading,t[21]=D.setAvatarDialogOpen,t[22]=D.toggleSoulPreviewMode,t[23]=D.updateIdentity,t[24]=a,t[25]=f,t[26]=u,t[27]=e):e=t[27],e}if(o===`capabilities`){let e;return t[28]!==n||t[29]!==c||t[30]!==H||t[31]!==s||t[32]!==re||t[33]!==q||t[34]!==ne||t[35]!==a||t[36]!==W||t[37]!==K||t[38]!==te||t[39]!==ae||t[40]!==U||t[41]!==G||t[42]!==ee?(e=(0,Q.jsx)(Sn,{a:n,data:s,selected:a,busy:c,toolEntryDisable:ee,setToolEntryDisable:te,onSaveTools:ne,onClearToolsEntry:re,skillsCatalogLoading:ae,catalogForPick:H,skillsInherit:U,setSkillsInherit:W,skillsPick:G,setSkillsPick:K,onSaveSkills:q}),t[28]=n,t[29]=c,t[30]=H,t[31]=s,t[32]=re,t[33]=q,t[34]=ne,t[35]=a,t[36]=W,t[37]=K,t[38]=te,t[39]=ae,t[40]=U,t[41]=G,t[42]=ee,t[43]=e):e=t[43],e}if(o===`runtime`){let e;return t[44]!==n||t[45]!==c||t[46]!==r||t[47]!==p||t[48]!==z||t[49]!==ie||t[50]!==V||t[51]!==a||t[52]!==m||t[53]!==B?(e=(0,Q.jsx)(In,{a:n,chat:r,selected:a,busy:c,editWorkspace:p,setEditWorkspace:m,modelRows:z,setModelRows:B,onSaveModels:V,onClearModelsEntry:ie}),t[44]=n,t[45]=c,t[46]=r,t[47]=p,t[48]=z,t[49]=ie,t[50]=V,t[51]=a,t[52]=m,t[53]=B,t[54]=e):e=t[54],e}if(o===`connections`){let e;return t[55]!==n||t[56]!==se||t[57]!==ce||t[58]!==le||t[59]!==pe||t[60]!==me||t[61]!==oe||t[62]!==c||t[63]!==i.lastActiveLabels||t[64]!==i.selectRecipient||t[65]!==de||t[66]!==ge||t[67]!==J||t[68]!==be||t[69]!==ye||t[70]!==ve||t[71]!==fe||t[72]!==_e||t[73]!==he||t[74]!==ue?(e=(0,Q.jsx)(wn,{a:n,busy:c,bindingsLoading:oe,agentBindings:se,channelStatuses:ce,channelsStatusLoading:le,useManualChannel:ue,newBindChannel:de,setNewBindChannel:fe,bindSessionChats:pe,sessionsLoading:me,newBindSessionIdx:J,setNewBindSessionIdx:he,newBindCustomPeer:ge,setNewBindCustomPeer:_e,onRefreshSessions:ve,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:ye,onAddBinding:be}),t[55]=n,t[56]=se,t[57]=ce,t[58]=le,t[59]=pe,t[60]=me,t[61]=oe,t[62]=c,t[63]=i.lastActiveLabels,t[64]=i.selectRecipient,t[65]=de,t[66]=ge,t[67]=J,t[68]=be,t[69]=ye,t[70]=ve,t[71]=fe,t[72]=_e,t[73]=he,t[74]=ue,t[75]=e):e=t[75],e}if(o===`advanced`){let e;return t[76]!==n||t[77]!==A||t[78]!==c||t[79]!==C||t[80]!==g||t[81]!==w||t[82]!==_||t[83]!==h||t[84]!==p||t[85]!==P||t[86]!==I||t[87]!==k||t[88]!==O||t[89]!==M||t[90]!==E||t[91]!==xe||t[92]!==T||t[93]!==R||t[94]!==L||t[95]!==a||t[96]!==j||t[97]!==F||t[98]!==N?(e=(0,Q.jsx)(un,{a:n,selected:a,busy:c,defaultModel:g,defaultWorkspace:_,agentModel:h,agentWorkspace:p,capabilityPresets:C,defaultPresetId:w,onUpdateAgentExtends:T,onOpenCapabilityPreset:E,filesLoading:O,files:k,activeFile:A,setActiveFile:j,filesViewMode:M,setFilesViewMode:N,fileDraft:P,setFileDraft:F,fileSaving:I,profileFileLoading:L,profileEditorNonce:R,onTryInChat:xe}),t[76]=n,t[77]=A,t[78]=c,t[79]=C,t[80]=g,t[81]=w,t[82]=_,t[83]=h,t[84]=p,t[85]=P,t[86]=I,t[87]=k,t[88]=O,t[89]=M,t[90]=E,t[91]=xe,t[92]=T,t[93]=R,t[94]=L,t[95]=a,t[96]=j,t[97]=F,t[98]=N,t[99]=e):e=t[99],e}if(o===`dangerZone`){let e;return t[100]!==n||t[101]!==c||t[102]!==S||t[103]!==a?(e=(0,Q.jsx)(rn,{a:n,selected:a,busy:c,onDelete:S}),t[100]=n,t[101]=c,t[102]=S,t[103]=a,t[104]=e):e=t[104],e}let Se;return t[105]===n.selectAgentHint?Se=t[106]:(Se=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[105]=n.selectAgentHint,t[106]=Se),Se}function Rn(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=g(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=Ue(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function zn(e,t){return e.replace(`{{count}}`,String(t))}function Bn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?zn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?zn(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function Vn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?zn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?zn(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function Hn(e){let t=(0,Z.c)(11),{text:n,children:r,className:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=(0,Q.jsx)(k,{asChild:!0,children:(0,Q.jsx)(`span`,{className:i,title:n,children:r})}),t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=c(`max-w-[min(28rem,calc(100vw-2rem))] rounded-lg border border-edge bg-surface-panel px-2.5 py-2`,`text-left text-xs leading-snug text-fg shadow-popover`,xe),t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(Be,{className:`fill-surface-panel`}),t[5]=s):s=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(R,{children:(0,Q.jsxs)(F,{side:`top`,align:`start`,sideOffset:6,className:o,children:[n,s]})}),t[6]=n,t[7]=l);let u;return t[8]!==a||t[9]!==l?(u=(0,Q.jsx)(re,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(w,{children:[a,l]})}),t[8]=a,t[9]=l,t[10]=u):u=t[10],u}function Un(e){let t=(0,Z.c)(34),{a:n,agents:r,defaultAgentId:i,tuiDefaultAgentId:a,tuiDefaultInherited:o,searchQuery:s,onOpenAgent:l,onChatWithAgent:u,busy:d}=e,f,p,m,h,_;if(t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==i||t[4]!==u||t[5]!==l||t[6]!==s||t[7]!==a||t[8]!==o){_=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Rn(r,s,n),v=r.length>0&&e.length===0&&s.trim().length>0;if(r.length===0){let e;t[14]===n.listNoAgentsYet?e=t[15]:(e=(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listNoAgentsYet}),t[14]=n.listNoAgentsYet,t[15]=e),_=e;break bb0}m=`flex flex-col gap-4`,t[16]!==n||t[17]!==v?(h=v?(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listEmpty}):null,t[16]=n,t[17]=v,t[18]=h):h=t[18],f=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`;let y;t[19]!==n||t[20]!==d||t[21]!==i||t[22]!==u||t[23]!==l||t[24]!==a||t[25]!==o?(y=e=>{let t=g(e,n),r=e.id,s=Ue(e,n),f=Bn(e,n),p=Vn(e,n),m=e.id===i||e.isDefault,h=e.id===a,_=h&&o,v=h&&!o;return(0,Q.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Q.jsxs)(`article`,{role:`button`,tabIndex:d?-1:0,"aria-disabled":d,"aria-label":`${t} ${r}`,onClick:()=>{d||l(e.id)},onKeyDown:t=>{d||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.id))},className:c(`flex min-h-[15.5rem] cursor-pointer flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-[background-color,transform,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/45`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`aria-disabled:pointer-events-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60`,Pe.pressCard),children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3 text-left`,children:[(0,Q.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base text-fg ring-1 ring-edge-subtle/40`,"aria-hidden":!0,children:(0,Q.jsx)(je,{agentId:e.id,avatar:e.avatar,size:48,className:`size-full`})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,title:r,children:r})]})]}),(0,Q.jsxs)(`div`,{className:`flex max-w-[9rem] shrink-0 flex-wrap justify-end gap-1.5`,children:[m?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,v?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultBadge}):null,_?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultInheritedBadge}):null,!m&&!h?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:n.listCustomBadge}):null]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 min-h-[6.25rem] text-left`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,Q.jsx)(`p`,{className:c(`line-clamp-2 text-sm leading-5`,s?`text-fg`:`text-fg-muted`),title:s||void 0,children:s||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:f,children:p.map(Wn)})]}),(0,Q.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,disabled:d,onClick:t=>{t.stopPropagation(),u(e.id)},className:`w-full rounded-2xl py-2.5`,children:[(0,Q.jsx)(ue,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[19]=n,t[20]=d,t[21]=i,t[22]=u,t[23]=l,t[24]=a,t[25]=o,t[26]=y):y=t[26],p=e.map(y)}t[0]=n,t[1]=r,t[2]=d,t[3]=i,t[4]=u,t[5]=l,t[6]=s,t[7]=a,t[8]=o,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=_}else f=t[9],p=t[10],m=t[11],h=t[12],_=t[13];if(_!==Symbol.for(`react.early_return_sentinel`))return _;let v;t[27]!==f||t[28]!==p?(v=(0,Q.jsx)(`ul`,{className:f,children:p}),t[27]=f,t[28]=p,t[29]=v):v=t[29];let y;return t[30]!==m||t[31]!==h||t[32]!==v?(y=(0,Q.jsxs)(`div`,{className:m,children:[h,v]}),t[30]=m,t[31]=h,t[32]=v,t[33]=y):y=t[33],y}function Wn(e){return(0,Q.jsx)(Hn,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Gn(e){let t=(0,Z.c)(163),{open:n,onOpenChange:r,a:i,chat:a,busy:o,modalError:s,profileLanguageLabel:l,createDisplayName:u,setCreateDisplayName:d,createAgentId:f,setCreateAgentId:p,createDescription:m,setCreateDescription:_,createWorkspace:y,setCreateWorkspace:b,createModel:x,setCreateModel:S,onCreate:C,onSuggestWorkspace:w,agents:T,duplicateSourceId:E,onSelectDuplicateSource:O,capabilityPlans:k,defaultPresetId:A,selectedCapabilityPlanIds:M,onSelectedCapabilityPlanIdsChange:N}=e,[P,F]=(0,$.useState)(null),I;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(D,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ze)}),t[0]=I):I=t[0];let L;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(L=c(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(90vh,680px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 flex-col`,et,`overflow-hidden rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=L):L=t[1];let R;t[2]===i.addAgent?R=t[3]:(R=(0,Q.jsx)(pe,{className:`text-base font-semibold text-fg`,children:i.addAgent}),t[2]=i.addAgent,t[3]=R);let ee;t[4]===i.addAgentHint?ee=t[5]:(ee=(0,Q.jsx)(de,{className:`mt-0.5 text-xs text-fg-muted`,children:i.addAgentHint}),t[4]=i.addAgentHint,t[5]=ee);let ne;t[6]!==R||t[7]!==ee?(ne=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[R,ee]}),t[6]=R,t[7]=ee,t[8]=ne):ne=t[8];let re;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(re=c(Re,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=re):re=t[9];let z;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),t[10]=z):z=t[10];let B;t[11]===i.closeDialogAria?B=t[12]:(B=(0,Q.jsx)(ut,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:re,"aria-label":i.closeDialogAria,children:z})}),t[11]=i.closeDialogAria,t[12]=B);let V;t[13]!==ne||t[14]!==B?(V=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[ne,B]}),t[13]=ne,t[14]=B,t[15]=V):V=t[15];let ie;t[16]!==i||t[17]!==T||t[18]!==E||t[19]!==O?(ie=T.length>0?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.copyFromExistingAgent}),(0,Q.jsxs)(h,{className:c(an(),`bg-surface-panel`),value:E??``,onChange:e=>O(e.target.value||null),children:[(0,Q.jsx)(nt,{value:``,children:i.copyFromExistingAgentNone}),T.map(e=>(0,Q.jsxs)(nt,{value:e.id,children:[g(e,i),` · `,e.id]},e.id))]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i.duplicateAgentHint})]}):null,t[16]=i,t[17]=T,t[18]=E,t[19]=O,t[20]=ie):ie=t[20];let H;t[21]===i.createCapabilityPlansTitle?H=t[22]:(H=(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:i.createCapabilityPlansTitle}),t[21]=i.createCapabilityPlansTitle,t[22]=H);let U;t[23]===i.createCapabilityPlansHint?U=t[24]:(U=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:i.createCapabilityPlansHint}),t[23]=i.createCapabilityPlansHint,t[24]=U);let W;t[25]!==i.capabilityPresetsGlobalDefault||t[26]!==k||t[27]!==A?(W=k.find(e=>e.id===A)?.name??i.capabilityPresetsGlobalDefault,t[25]=i.capabilityPresetsGlobalDefault,t[26]=k,t[27]=A,t[28]=W):W=t[28];let G;t[29]===W?G=t[30]:(G=(0,Q.jsx)(`div`,{className:`mt-2 rounded-md bg-accent/5 px-2.5 py-2 text-xs text-fg-muted`,children:W}),t[29]=W,t[30]=G);let K;if(t[31]!==o||t[32]!==k||t[33]!==A||t[34]!==N||t[35]!==M){let e;t[37]===A?e=t[38]:(e=e=>e.id!==A,t[37]=A,t[38]=e);let n;t[39]!==o||t[40]!==N||t[41]!==M?(n=e=>{let t=M.includes(e.id);return(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md bg-surface-panel px-2.5 py-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 shrink-0 rounded border-edge`,checked:t,disabled:o,onChange:()=>N(t?M.filter(t=>t!==e.id):[...M,e.id])}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`mt-0.5 line-clamp-2 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)},t[39]=o,t[40]=N,t[41]=M,t[42]=n):n=t[42],K=k.filter(e).map(n),t[31]=o,t[32]=k,t[33]=A,t[34]=N,t[35]=M,t[36]=K}else K=t[36];let ce;t[43]===K?ce=t[44]:(ce=(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:K}),t[43]=K,t[44]=ce);let le;t[45]!==H||t[46]!==U||t[47]!==G||t[48]!==ce?(le=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-3 dark:border-edge`,children:[H,U,G,ce]}),t[45]=H,t[46]=U,t[47]=G,t[48]=ce,t[49]=le):le=t[49];let ue;t[50]===s?ue=t[51]:(ue=s?(0,Q.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:s}):null,t[50]=s,t[51]=ue);let fe;t[52]!==i.newAgentLabel||t[53]!==l?(fe=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[i.newAgentLabel,` (`,l,`)`]}),t[52]=i.newAgentLabel,t[53]=l,t[54]=fe):fe=t[54];let me;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(me=an(),t[55]=me):me=t[55];let J;t[56]===d?J=t[57]:(J=e=>d(e.target.value),t[56]=d,t[57]=J);let he;t[58]===w?he=t[59]:(he=()=>w(),t[58]=w,t[59]=he);let ge;t[60]!==u||t[61]!==J||t[62]!==he?(ge=(0,Q.jsx)(`input`,{className:me,value:u,onChange:J,onBlur:he,required:!0,autoComplete:`off`}),t[60]=u,t[61]=J,t[62]=he,t[63]=ge):ge=t[63];let _e;t[64]!==fe||t[65]!==ge?(_e=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[fe,ge]}),t[64]=fe,t[65]=ge,t[66]=_e):_e=t[66];let ve;t[67]===i.newAgentIdOptional?ve=t[68]:(ve=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.newAgentIdOptional}),t[67]=i.newAgentIdOptional,t[68]=ve);let ye;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(ye=c(an(),`font-mono text-xs`),t[69]=ye):ye=t[69];let be;t[70]===p?be=t[71]:(be=e=>p(e.target.value),t[70]=p,t[71]=be);let xe;t[72]===w?xe=t[73]:(xe=()=>w(),t[72]=w,t[73]=xe);let Se;t[74]!==i.newAgentIdPlaceholder||t[75]!==i.newAgentIdRules||t[76]!==f||t[77]!==be||t[78]!==xe?(Se=(0,Q.jsx)(`input`,{className:ye,value:f,onChange:be,onBlur:xe,placeholder:i.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:i.newAgentIdRules}),t[74]=i.newAgentIdPlaceholder,t[75]=i.newAgentIdRules,t[76]=f,t[77]=be,t[78]=xe,t[79]=Se):Se=t[79];let Ce;t[80]===i.newAgentIdRules?Ce=t[81]:(Ce=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i.newAgentIdRules}),t[80]=i.newAgentIdRules,t[81]=Ce);let we;t[82]!==ve||t[83]!==Se||t[84]!==Ce?(we=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ve,Se,Ce]}),t[82]=ve,t[83]=Se,t[84]=Ce,t[85]=we):we=t[85];let Te;t[86]!==i.agentDescription||t[87]!==l?(Te=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[i.agentDescription,` (`,l,`)`]}),t[86]=i.agentDescription,t[87]=l,t[88]=Te):Te=t[88];let Ee;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=c(an(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[89]=Ee):Ee=t[89];let Y;t[90]===_?Y=t[91]:(Y=e=>_(e.target.value),t[90]=_,t[91]=Y);let De;t[92]!==i.agentDescriptionPlaceholder||t[93]!==m||t[94]!==Y?(De=(0,Q.jsx)(`textarea`,{className:Ee,value:m,onChange:Y,placeholder:i.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[92]=i.agentDescriptionPlaceholder,t[93]=m,t[94]=Y,t[95]=De):De=t[95];let Oe;t[96]!==Te||t[97]!==De?(Oe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[Te,De]}),t[96]=Te,t[97]=De,t[98]=Oe):Oe=t[98];let ke;t[99]===i.newWorkspace?ke=t[100]:(ke=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.newWorkspace}),t[99]=i.newWorkspace,t[100]=ke);let Ae;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=c(an(),`font-mono text-xs`),t[101]=Ae):Ae=t[101];let je;t[102]===b?je=t[103]:(je=e=>b(e.target.value),t[102]=b,t[103]=je);let Me;t[104]!==y||t[105]!==je?(Me=(0,Q.jsx)(`input`,{className:Ae,value:y,onChange:je,required:!0,autoComplete:`off`}),t[104]=y,t[105]=je,t[106]=Me):Me=t[106];let Ne;t[107]!==ke||t[108]!==Me?(Ne=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ke,Me]}),t[107]=ke,t[108]=Me,t[109]=Ne):Ne=t[109];let Pe;t[110]===i.newModelOptional?Pe=t[111]:(Pe=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.newModelOptional}),t[110]=i.newModelOptional,t[111]=Pe);let Fe;t[112]===S?Fe=t[113]:(Fe=e=>S(e),t[112]=S,t[113]=Fe);let Ie;t[114]!==o||t[115]!==a.modelNoMatches||t[116]!==a.modelPlaceholder||t[117]!==a.modelSearchPlaceholder||t[118]!==x||t[119]!==Fe?(Ie=(0,Q.jsx)(j,{className:`min-w-0 flex-1`,value:x,disabled:o,placeholder:a.modelPlaceholder,searchPlaceholder:a.modelSearchPlaceholder,noMatches:a.modelNoMatches,onChange:Fe}),t[114]=o,t[115]=a.modelNoMatches,t[116]=a.modelPlaceholder,t[117]=a.modelSearchPlaceholder,t[118]=x,t[119]=Fe,t[120]=Ie):Ie=t[120];let Le;t[121]!==i.modelClear||t[122]!==o||t[123]!==x||t[124]!==S?(Le=x.trim()?(0,Q.jsx)(q,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:o,onClick:()=>S(``),children:i.modelClear}):null,t[121]=i.modelClear,t[122]=o,t[123]=x,t[124]=S,t[125]=Le):Le=t[125];let Be;t[126]!==Ie||t[127]!==Le?(Be=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[Ie,Le]}),t[126]=Ie,t[127]=Le,t[128]=Be):Be=t[128];let Ve;t[129]!==Pe||t[130]!==Be?(Ve=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[Pe,Be]}),t[129]=Pe,t[130]=Be,t[131]=Ve):Ve=t[131];let He;t[132]!==le||t[133]!==ue||t[134]!==_e||t[135]!==we||t[136]!==Oe||t[137]!==Ne||t[138]!==Ve||t[139]!==ie?(He=(0,Q.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-y-auto pr-1`,children:[ie,le,ue,_e,we,Oe,Ne,Ve]}),t[132]=le,t[133]=ue,t[134]=_e,t[135]=we,t[136]=Oe,t[137]=Ne,t[138]=Ve,t[139]=ie,t[140]=He):He=t[140];let Ue;t[141]!==i.createModalCancel||t[142]!==o?(Ue=(0,Q.jsx)(ut,{asChild:!0,children:(0,Q.jsx)(q,{type:`button`,variant:`secondary`,disabled:o,children:i.createModalCancel})}),t[141]=i.createModalCancel,t[142]=o,t[143]=Ue):Ue=t[143];let We;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Q.jsx)(te,{className:`mr-1 size-4`,"aria-hidden":!0}),t[144]=We):We=t[144];let X;t[145]!==i.create||t[146]!==o?(X=(0,Q.jsxs)(q,{type:`submit`,disabled:o,children:[We,i.create]}),t[145]=i.create,t[146]=o,t[147]=X):X=t[147];let Ge;t[148]!==Ue||t[149]!==X?(Ge=(0,Q.jsxs)(`div`,{className:`mt-3 flex shrink-0 justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Ue,X]}),t[148]=Ue,t[149]=X,t[150]=Ge):Ge=t[150];let Ke;t[151]!==C||t[152]!==He||t[153]!==Ge?(Ke=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:C,children:[He,Ge]}),t[151]=C,t[152]=He,t[153]=Ge,t[154]=Ke):Ke=t[154];let qe;t[155]!==P||t[156]!==Ke||t[157]!==V?(qe=(0,Q.jsxs)(se,{children:[I,(0,Q.jsx)(v,{ref:F,className:L,onOpenAutoFocus:Kn,children:(0,Q.jsxs)(Je,{layer:`modal`,portalContainer:P,children:[V,Ke]})})]}),t[155]=P,t[156]=Ke,t[157]=V,t[158]=qe):qe=t[158];let Ye;return t[159]!==r||t[160]!==n||t[161]!==qe?(Ye=(0,Q.jsx)(ae,{open:n,onOpenChange:r,children:qe}),t[159]=r,t[160]=n,t[161]=qe,t[162]=Ye):Ye=t[162],Ye}function Kn(e){return e.preventDefault()}var qn=`~/.xopc/workspace`;function Jn(e){let t=e.trim();return t?`${qn}/${b(t)}`:``}function Yn(e){let t=(0,Z.c)(18),{a:n,busy:r,listSearchQuery:i,onListSearchQueryChange:a,onAddAgent:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(Ee,{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[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e.target.value),t[1]=a,t[2]=c);let l;t[3]!==n.listSearchPlaceholder||t[4]!==i||t[5]!==c?(l=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill bg-surface-panel py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[s,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:c,placeholder:n.listSearchPlaceholder,autoComplete:`off`,spellCheck:!1,"aria-label":n.listSearchPlaceholder,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[3]=n.listSearchPlaceholder,t[4]=i,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=()=>o(),t[7]=o,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(G,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=d):d=t[9];let f;t[10]!==n.addAgent||t[11]!==n.addAgentAria||t[12]!==r||t[13]!==u?(f=(0,Q.jsxs)(q,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":n.addAgentAria,disabled:r,onClick:u,children:[d,n.addAgent]}),t[10]=n.addAgent,t[11]=n.addAgentAria,t[12]=r,t[13]=u,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function Xn(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function Zn(e){let{agentId:t,enabled:n,saveRef:r}=e,i=lt(async()=>{if(!t)return null;let[e,n]=await Promise.all([B(t,`IDENTITY.md`).catch(()=>``),B(t,`SOUL.md`).catch(()=>``)]),r=ye(e);return{identity:r,soulTemplate:Ne(n),soulCustomContent:n,identityBaseline:JSON.stringify(r),soulBaseline:n}},[t],{enabled:n&&!!t,initial:null,errorData:null}),a=i.data,o=i.loading,s=(0,$.useRef)(!1),[c,l]=(0,$.useState)(null),u=t??``,d=(0,$.useRef)(u);d.current!==u&&(d.current=u,s.current=!1,l(null));let f=c??(a?Xn(a):null),p=(0,$.useMemo)(()=>f?JSON.stringify(f.identity)!==f.identityBaseline||f.soulCustomContent!==f.soulBaseline:!1,[f]),m=(0,$.useRef)(t);m.current=t;let h=(0,$.useCallback)(e=>{s.current=!0,l(t=>{let n=t??(a?Xn(a):null);return n?e(n):null})},[a]),g=(0,$.useCallback)(e=>{h(t=>({...t,identity:{...t.identity,...e}}))},[h]),_=(0,$.useCallback)(e=>{h(t=>{if(e===`custom`)return{...t,soulTemplate:`custom`};let n=Qe.find(t=>t.id===e);return n?.content?{...t,soulTemplate:e,soulCustomContent:n.content,soulEditorNonce:t.soulEditorNonce+1}:{...t,soulTemplate:e}})},[h]),v=(0,$.useCallback)(e=>{h(t=>({...t,soulCustomContent:e,soulTemplate:`custom`}))},[h]),y=(0,$.useCallback)(e=>{h(t=>({...t,avatarDialogOpen:e}))},[h]),b=(0,$.useCallback)(()=>{h(e=>({...e,soulPreviewMode:!e.soulPreviewMode}))},[h]),x=(0,$.useCallback)(async()=>{let e=m.current;!e||!f||(await Promise.all([O(e,`IDENTITY.md`,it(f.identity)),O(e,`SOUL.md`,f.soulCustomContent)]),s.current=!1,l(e=>{let t=e??f;return{...t,identityBaseline:JSON.stringify(t.identity),soulBaseline:t.soulCustomContent}}))},[f]);return(0,$.useLayoutEffect)(()=>{if(r)return r.current=x,()=>{r.current=null}},[x,r]),{profileMarkdownLoading:o,draft:f,dirty:p,updateIdentity:g,handleSoulTemplateChange:_,handleSoulContentChange:v,setAvatarDialogOpen:y,toggleSoulPreviewMode:b}}var Qn={draft:``,editorNonce:0,loadedKey:``};function $n(e,t){switch(t.type){case`load`:return{draft:t.content,editorNonce:e.editorNonce+1,loadedKey:t.key};case`setDraft`:return{...e,draft:t.value};case`clear`:return{draft:``,editorNonce:e.editorNonce,loadedKey:``};case`resetViewMode`:return e}}function er(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=lt(()=>n?E(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`advanced`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,f]=(0,$.useState)(null),[p,m]=(0,$.useReducer)($n,Qn),[h,g]=(0,$.useState)(!1),[_,v]=(0,$.useState)(`edit`),y=(0,$.useRef)(n);(0,$.useEffect)(()=>{n!==y.current&&(y.current=n,f(null))},[n]),(0,$.useEffect)(()=>{if(c&&c.files.length>0&&!d){let e=c.files.find(e=>e.name===`AGENTS.md`);f(e?e.name:c.files[0].name)}},[c,d]);let b=p.draft,x=p.editorNonce,S=(0,$.useRef)(b);S.current=b;let C=(0,$.useRef)(n);C.current=n;let w=(0,$.useRef)(d);w.current=d;let T=(0,$.useRef)(null),D=(0,$.useRef)(``),k=(0,$.useRef)(``),A=(0,$.useRef)(``),j=(0,$.useRef)(()=>{}),N=lt(()=>d&&n?B(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),P=N.loading,F=M(async()=>{let e=C.current,t=w.current;if(!e||!t||`${e}:${t}`!==D.current)return;let n=S.current;if(n!==k.current){g(!0),o(null);try{await O(e,t,n),k.current=n,l(n=>!n||n.agentId!==e?n:{...n,files:n.files.map(e=>e.name===t?{...e,missing:!1}:e)})}catch(e){o(e instanceof Error?e.message:a)}finally{g(!1)}}},800);j.current=F.flush,(0,$.useEffect)(()=>()=>{j.current()},[]);let I=(0,$.useRef)(t);I.current!==t&&(I.current===`advanced`&&j.current(),I.current=t);let L=d&&n?`${n}:${d}`:``;(0,$.useEffect)(()=>{L!==A.current&&(j.current(),A.current=L)},[L]),(0,$.useEffect)(()=>{if(!L){m({type:`clear`});return}P||(D.current=L,k.current=N.data,m({type:`load`,key:L,content:N.data}))},[L,P,N.data]);let R=(0,$.useRef)({activeFile:d,selectedId:n});return(R.current.activeFile!==d||R.current.selectedId!==n)&&(R.current={activeFile:d,selectedId:n},v(`edit`)),{files:c,setFiles:l,filesLoading:u,activeFile:d,setActiveFile:(0,$.useCallback)(e=>{j.current(),f(e)},[]),fileDraft:b,setFileDraft:(0,$.useCallback)(e=>{m({type:`setDraft`,value:typeof e==`function`?e(S.current):e}),F()},[F]),fileSaving:h,filesViewMode:_,setFilesViewMode:v,profileFileLoading:P,profileEditorNonce:x,overviewSaveProfileMarkdownRef:T,saveProfileMarkdownDebounced:F}}function tr(e){let{panel:t,hasToken:n,bindingsFromConfig:r,gatewayCfgLoading:i,selected:a,saveErrorMessage:o,setBusy:s,setError:c}=e,l=(0,$.useRef)(!1),[u,d]=(0,$.useState)(null),f=(0,$.useRef)(r);t===`connections`&&n&&!l.current&&f.current!==r&&(f.current=r,d(r));let p=u??r,m=t===`connections`&&n,h=lt(()=>At(),[t,n],{enabled:m,initial:[],errorData:[]}),g=h.data,_=h.loading,v=(0,$.useMemo)(()=>_||g.length===0?``:g[0]?.name??``,[g,_]),[b,x]=(0,$.useState)(``),S=(0,$.useRef)(v);t===`connections`&&!_&&v&&S.current!==v&&(!b||!g.some(e=>e.name===b))&&(S.current=v,x(v)),S.current=v;let C=b.trim(),w=m&&C.length>0,T=lt(()=>jt(C),[t,n,C],{enabled:w,initial:[],errorData:[]}),E=T.data,D=T.loading,O=T.setData,[k,A]=(0,$.useState)(null),[j,M]=(0,$.useState)(``),N=(0,$.useRef)(C);N.current!==C&&(N.current=C,A(null));let P=(0,$.useMemo)(()=>a?p.filter(e=>e.agentId.toLowerCase()===a.id.toLowerCase()):[],[p,a?.id]),F=(0,$.useCallback)(()=>{let e=b.trim();e&&jt(e).then(e=>{O(e),A(t=>t!=null&&t<e.length?t:null)}).catch(()=>{O([]),A(null)})},[b,O]),I=!_&&g.length===0,L=t===`connections`&&n&&i,R=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await y(t),l.current=!0,d(t)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,o,s,c]);return{agentBindings:P,allBindings:p,bindChannelStatuses:g,bindChannelsLoading:_,bindSessionChats:E,bindSessionsLoading:D,bindingsLoading:L,newBindChannel:b,setNewBindChannel:x,newBindSessionIdx:k,setNewBindSessionIdx:A,newBindCustomPeer:j,setNewBindCustomPeer:M,onAddBinding:(0,$.useCallback)(async e=>{if(e.preventDefault(),!a||!b.trim())return;let t=sn(b,j,k,E),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await y(n),l.current=!0,d(n),A(null),M(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,E,b,j,k,o,a,s,c]),onRemoveBinding:R,refreshBindSessions:F,useManualChannel:I}}function nr(e,t){let n=(0,Z.c)(16),[r,i]=(0,$.useState)(0),a,o;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=e=>{let t=e.detail;t&&typeof t==`object`&&`section`in t&&t.section===`skills`&&i(ar)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},o=[],n[0]=a,n[1]=o):(a=n[0],o=n[1]),(0,$.useEffect)(a,o);let s;n[2]!==r||n[3]!==e||n[4]!==t?(s=[e,t,r],n[2]=r,n[3]=e,n[4]=t,n[5]=s):s=n[5];let c=e&&t,l;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],n[6]=l):l=n[6];let u;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],n[7]=u):u=n[7];let d;n[8]===c?d=n[9]:(d={enabled:c,initial:l,errorData:u},n[8]=c,n[9]=d);let{data:f,loading:p}=lt(ir,s,d),m;n[10]===f?m=n[11]:(m=f.filter(rr),n[10]=f,n[11]=m);let h=m,g;return n[12]!==h||n[13]!==f||n[14]!==p?(g={catalogForPick:h,skillCatalog:f,skillsCatalogLoading:p},n[12]=h,n[13]=f,n[14]=p,n[15]=g):g=n[15],g}function rr(e){return e.enabled!==!1}function ir(){return H()}function ar(e){return e+1}function or(e){return nr(e.panel===`capabilities`,e.hasToken)}function sr(e){return new Set(e.tools.entryDisable)}function cr(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function lr(e){let{panel:t,selected:n}=e,r=`${t}:${n?.id??``}`,i=(0,$.useRef)(r),[a,o]=(0,$.useState)(()=>new Set),[s,c]=(0,$.useState)(()=>new Set),[l,u]=(0,$.useState)(!0),[d,f]=(0,$.useState)(()=>[]),[p,m]=(0,$.useState)(!1);if(i.current!==r){if(i.current=r,n&&t===`capabilities`){o(sr(n));let e=cr(n);u(e.inherit),c(e.pick)}n&&t===`runtime`&&(f(Et(n.typedModels.effective)),m(!1))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:e=>{m(!1),f(e)},replaceModelRows:f,modelsResetRequested:p,setModelsResetRequested:m}}function ur(e){let t=Et(e.typedModels.preset);return t.some(t=>t.id===e.typedModels.defaultRole)?t:Et(e.typedModels.effective)}function dr(e){return Object.fromEntries(Array.from(e).map(e=>e.trim()).filter(Boolean).toSorted((e,t)=>e.localeCompare(t)).map(e=>[e,{mode:`deny`}]))}function fr(){let e=d(e=>e.language),t=l(e),n=t.agentsSettings,[r,o]=(0,$.useState)(!1),[c,f]=(0,$.useState)(null),[m,h]=(0,$.useState)(!1),[_,v]=(0,$.useState)(``),y=t.cron,b=t.chat,x=!!u(e=>e.token),[S,C]=i(),w=a(),{agentId:T}=s(),E=Ce(e=>e.setPageHeader),D=Ce(e=>e.clearPageHeader),{data:O,error:k,isLoading:A,mutate:j}=p(x?`settings-gateway-agents`:null,N,{revalidateOnFocus:!1}),{data:M,mutate:P}=p(x?`settings-capability-presets`:null,Ct,{revalidateOnFocus:!1}),F=ge(x),{data:I}=F,L=(0,$.useMemo)(()=>dt(I?.payload?.config??{}),[I]),R=O??null,te=(0,$.useMemo)(()=>R?R.agents.find(e=>e.id===R.defaultId)??R.agents[0]??null:null,[R]),ne=!!(x&&A),[re,z]=(0,$.useState)(null),B=k instanceof Error?k.message:k?n.loadError:null,V=re??B,[ie,ae]=(0,$.useState)(null),[H,U]=(0,$.useState)(`overview`),[G,K]=(0,$.useState)(``),[q,oe]=(0,$.useState)(``),[se,ue]=(0,$.useState)(``),[de,pe]=(0,$.useState)(``),[me,J]=(0,$.useState)(``),[he,_e]=(0,$.useState)(null),[ve,ye]=(0,$.useState)(!1),be=(0,$.useRef)(``),[xe,Se]=(0,$.useState)(null),[we,Te]=(0,$.useState)([]),[Ee,Y]=(0,$.useState)(!1),[De,Oe]=(0,$.useState)(``),[ke,Ae]=(0,$.useState)(``),[je,Me]=(0,$.useState)(``),[Ne,Pe]=(0,$.useState)(``),[Fe,Ie]=(0,$.useState)(``),[Le,Re]=(0,$.useState)(``),ze=(0,$.useRef)(null),[Be,He]=(0,$.useState)(!1),We=(0,$.useRef)({data:null,routeAgentId:void 0});R&&(R!==We.current.data||T!==We.current.routeAgentId)&&(We.current={data:R,routeAgentId:T},T&&R.agents.some(e=>e.id===T)?ae(T):ae(e=>e&&R.agents.some(t=>t.id===e)?e:R.defaultId)),(0,$.useEffect)(()=>{!R||!T||R.agents.some(e=>e.id===T)||w(qe,{replace:!0})},[R,T,w]),(0,$.useEffect)(()=>{T&&U(`overview`)},[T]),(0,$.useEffect)(()=>{S.get(`panel`)===`defaults`&&w(T?$e(T):qe,{replace:!0,state:{[W]:T?$e(T):qe}})},[S,T,w]),(0,$.useEffect)(()=>{if(S.get(`focus`)!==`avatar`||!T||(U(`profile`),ne||!R?.agents.some(e=>e.id===T)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),C(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[S,T,ne,R,C]);let X=(0,$.useMemo)(()=>R?.agents.find(e=>e.id===ie)??null,[R,ie]),Ge=(0,$.useMemo)(()=>{let e=I?.payload?.config;if(!e||typeof e!=`object`||Array.isArray(e))return``;let t=e.tui;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.defaultAgent;return typeof n==`string`?n.trim().toLowerCase():``},[I]),Ke=(0,$.useMemo)(()=>!R||Ge&&R.agents.some(e=>e.id===Ge)?Ge:R.defaultId||R.agents[0]?.id||Ge,[R,Ge]),Je=!!(R&&Ge&&!R.agents.some(e=>e.id===Ge));(0,$.useEffect)(()=>{Ae(Je?``:Ge)},[Ge,Je]);let Ye=(0,$.useRef)(null),Xe=X?X.id:null;X&&Ye.current!==Xe?(Ye.current=Xe,Me(X.workspace),Pe(X.model?.primary??``),Ie(g(X,l(e).agentsSettings)),Re(Ue(X,l(e).agentsSettings))):!X&&Ye.current!==null&&(Ye.current=null,Me(``),Pe(``),Ie(``),Re(``));let Ze=Zn({agentId:X?.id??null,enabled:H===`profile`&&!!X,saveRef:ze}),Qe=er({panel:H,selectedId:ie,hasToken:x,dataAgentsLength:R?.agents.length,saveErrorMessage:n.saveError,setError:z}),et=lr({panel:H,selected:X}),tt=tr({panel:H,hasToken:x,bindingsFromConfig:L,gatewayCfgLoading:I===void 0,selected:X,saveErrorMessage:n.saveError,setBusy:Y,setError:z}),nt=or({panel:H,hasToken:x}),rt=(0,$.useCallback)(()=>{let e=Jn(q.trim()||G);pe(t=>t===``||t===be.current?(be.current=e,e):t)},[q,G]),it=(0,$.useCallback)(()=>{be.current=``,K(``),oe(``),ue(``),pe(``),J(``),_e(null),Se(null),Te([]),ye(!0)},[]),ot=(0,$.useCallback)(e=>{let t=new Set(R?.agents.map(e=>e.id.toLowerCase())??[]),r=e.trim();if(!t.has(r.toLowerCase()))return r;let i=`${r}${n.duplicateIdSuffix}`;if(!t.has(i.toLowerCase()))return i;for(let e=2;e<1e3;e+=1){let n=`${i}-${e}`;if(!t.has(n.toLowerCase()))return n}return i},[n.duplicateIdSuffix,R]),st=(0,$.useCallback)(e=>{if(Se(e),!e){Te([]);return}let t=R?.agents.find(t=>t.id===e);if(!t)return;let r=t.name?.trim()??t.id,i=n.duplicateName.replace(`{{name}}`,r),a=ot(t.id),o=t.description??``;be.current=``,K(i),oe(a),ue(o),pe(t.workspace),J(t.model?.primary??``),Te([...t.extends]),_e(null)},[n.duplicateName,R,ot]),ct=(0,$.useCallback)(e=>{st(e),ye(!0)},[st]),lt=(0,$.useMemo)(()=>(0,Q.jsx)(Yn,{a:n,busy:Ee,listSearchQuery:De,onListSearchQueryChange:Oe,onAddAgent:()=>it()}),[n,Ee,De,it]);(0,$.useLayoutEffect)(()=>x?(E({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title})}),end:lt}),()=>D()):(D(),()=>D()),[n.title,lt,D,x,E]);async function ut(t){t.preventDefault();let r=G.trim();if(!r)return;let i=at(q,r);if(i.ok===!1){_e(i.error);return}let a=de.trim()||Jn(q.trim()||r);if(a){Y(!0),_e(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${se.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
2
+ `),{createdAgentId:n,...i}=await Ve({workspace:a,...q.trim()?{id:q.trim()}:{},...me.trim()?{models:{defaultRole:`deep`,roles:{deep:{model:me.trim()}}}}:{},profileFiles:{"IDENTITY.md":t},...xe?{cloneFrom:xe}:{},extends:we});j(i,{revalidate:!1}),K(``),oe(``),ue(``),pe(``),J(``),_e(null),ye(!1),ae(n),w($e(n))}catch(e){_e(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function ft(e){Y(!0),z(null);try{j(await ce(e.id,{setDefault:!0}),{revalidate:!1}),ae(e.id)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function pt(){let e=ke.trim().toLowerCase();if(e&&!R?.agents.some(t=>t.id===e)){z(n.tuiDefaultAgentInvalid);return}Y(!0),z(null);try{await fe(e||null),await F.mutate()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function mt(e){Y(!0),z(null);try{await fe(e.id),Ae(e.id),await F.mutate()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function ht(){Y(!0),z(null);try{await fe(null),Ae(``),await F.mutate()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function gt(e,t){Y(!0),z(null);try{let n=await ee(e.id,t);j(n,{revalidate:!1}),ae(n.defaultId),U(`overview`),T===e.id&&w(qe,{replace:!0}),o(!1),f(null),v(``)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}function _t(e,t){e.id!==`main`&&(f(e),h(t),v(``),o(!0))}async function vt(){if(X){Y(!0),z(null);try{j(await ce(X.id,{tools:{builtin:dr(et.toolEntryDisable)}}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function yt(){if(X){Y(!0),z(null);try{j(await ce(X.id,{tools:null}),{revalidate:!1}),et.setToolEntryDisable(new Set)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function bt(){if(!X)return;let e=Tt(et.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e){z(e);return}Y(!0),z(null);try{j(await ce(X.id,{models:{roles:kt(et.modelRows)?.roles??{}}}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function xt(){if(!X)return!1;let e=Tt(et.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e)return z(e),!1;Y(!0),z(null);try{let e=kt(Et(X.typedModels.effective))?.roles??{},t=kt(et.modelRows)?.roles??{},n=JSON.stringify(t)!==JSON.stringify(e);return j(await ce(X.id,{workspace:je.trim()||void 0,...et.modelsResetRequested?{models:null}:n?{models:{roles:t}}:{}}),{revalidate:!1}),et.setModelsResetRequested(!1),!0}catch(e){return z(e instanceof Error?e.message:n.saveError),!1}finally{Y(!1)}}function St(){if(!X)return;let e=ur(X);z(null),et.replaceModelRows(e),et.setModelsResetRequested(!0)}async function wt(){if(X){Y(!0),z(null);try{j(await ce(X.id,{skills:et.skillsInherit?null:[...et.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function Dt(e){if(X){Y(!0),z(null);try{j(await ce(X.id,{extends:e}),{revalidate:!1}),P()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}let Ot=H!==`profile`&&H!==`runtime`,At=(()=>{if(!X||H!==`runtime`)return!1;let e=kt(Et(X.typedModels.effective))?.roles??{},t=kt(et.modelRows)?.roles??{};return et.modelsResetRequested||je.trim()!==X.workspace||JSON.stringify(t)!==JSON.stringify(e)})(),jt=(()=>{if(Ot||!X)return!1;switch(H){case`profile`:return Ze.dirty;case`runtime`:return At;default:return!0}})(),Mt=Ot||!jt;function Nt(){He(!0),setTimeout(()=>He(!1),2e3)}async function Z(){switch(H){case`profile`:Y(!0),z(null);try{return await(ze.current?.()??Promise.resolve()),await j(),Nt(),!0}catch(e){return z(e instanceof Error?e.message:n.saveError),!1}finally{Y(!1)}case`runtime`:return await xt()?(Nt(),!0):!1;default:return!0}}function Pt(e){e||w(qe)}let Ft=X?Fe.trim()||g(X,n):T??``,It=X?.id??T??``,Lt=(0,$.useCallback)(async()=>{if(X&&await Z()){Qe.saveProfileMarkdownDebounced.flush();try{globalThis.localStorage?.setItem(le,X.id)}catch{}w(`/chat/new`,{state:{agentId:X.id,fromAgentEditor:!0}})}},[X,Z,Qe.saveProfileMarkdownDebounced,w]),Rt={a:n,chat:b,cCron:y,selected:X,panel:H,data:R,busy:Ee,editName:Fe,setEditName:Ie,editDescription:Le,setEditDescription:Re,editWorkspace:je,setEditWorkspace:Me,editModel:Ne,defaultModel:te?.model?.primary??``,defaultWorkspace:te?.workspace??``,onSetDefault:()=>{X&&ft(X)},onSetTuiDefault:()=>{X&&mt(X)},isTuiDefault:!!(X&&X.id===Ke),isTuiDefaultInherited:!!(X&&X.id===Ke&&(!Ge||Je)),onDelete:e=>{X&&_t(X,e)},onTryInChat:()=>void Lt(),capabilityPresets:M?.presets??[],defaultPresetId:M?.defaultPresetId,onUpdateAgentExtends:e=>void Dt(e),onOpenCapabilityPreset:e=>{w(e?`/settings/capability-presets?preset=${encodeURIComponent(e)}`:`/settings/capability-presets`)},overviewProfile:Ze,filesLoading:Qe.filesLoading,files:Qe.files,activeFile:Qe.activeFile,setActiveFile:Qe.setActiveFile,filesViewMode:Qe.filesViewMode,setFilesViewMode:Qe.setFilesViewMode,fileDraft:Qe.fileDraft,setFileDraft:Qe.setFileDraft,fileSaving:Qe.fileSaving,profileFileLoading:Qe.profileFileLoading,profileEditorNonce:Qe.profileEditorNonce,toolEntryDisable:et.toolEntryDisable,setToolEntryDisable:et.setToolEntryDisable,onSaveTools:()=>void vt(),onClearToolsEntry:()=>void yt(),modelRows:et.modelRows,setModelRows:et.setModelRows,onSaveModels:()=>void bt(),onClearModelsEntry:St,skillsCatalogLoading:nt.skillsCatalogLoading,catalogForPick:nt.catalogForPick,skillsInherit:et.skillsInherit,setSkillsInherit:et.setSkillsInherit,skillsPick:et.skillsPick,setSkillsPick:et.setSkillsPick,onSaveSkills:()=>void wt(),bindingsLoading:tt.bindingsLoading,agentBindings:tt.agentBindings,bindChannelStatuses:tt.bindChannelStatuses,bindChannelsLoading:tt.bindChannelsLoading,useManualChannel:tt.useManualChannel,newBindChannel:tt.newBindChannel,setNewBindChannel:tt.setNewBindChannel,bindSessionChats:tt.bindSessionChats,bindSessionsLoading:tt.bindSessionsLoading,newBindSessionIdx:tt.newBindSessionIdx,setNewBindSessionIdx:tt.setNewBindSessionIdx,newBindCustomPeer:tt.newBindCustomPeer,setNewBindCustomPeer:tt.setNewBindCustomPeer,refreshBindSessions:tt.refreshBindSessions,onRemoveBinding:e=>void tt.onRemoveBinding(e),onAddBinding:tt.onAddBinding};return{hasToken:x,a:n,chat:b,language:e,data:R,savedTuiDefaultAgentId:Ge,effectiveTuiDefaultAgentId:Ke,tuiDefaultAgentDraft:ke,setTuiDefaultAgentDraft:Ae,tuiDefaultAgentUnavailable:Je,onSaveTuiDefaultAgent:pt,onSetTuiDefaultAgent:mt,onClearTuiDefaultAgent:ht,onSetDefaultAgent:ft,loading:ne,displayError:V,navigate:w,routeAgentId:T,busy:Ee,listSearchQuery:De,openAddAgentModal:it,openDuplicateAgentModal:ct,duplicateSourceId:xe,createPresetIds:we,setCreatePresetIds:Te,onSelectDuplicateSource:st,panel:H,setPanel:U,modalTitle:Ft,modalSubtitle:It,footerSaveDisabled:Mt,savedFlash:Be,handleModalFooterSave:Z,onAgentModalOpenChange:Pt,addAgentModalOpen:ve,setAddAgentModalOpen:ye,createWorkspaceSuggestedRef:be,createModalError:he,setCreateModalError:_e,createDisplayName:G,setCreateDisplayName:K,createAgentId:q,setCreateAgentId:oe,createDescription:se,setCreateDescription:ue,createWorkspace:de,setCreateWorkspace:pe,createModel:me,setCreateModel:J,onCreate:ut,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:rt,deleteDialogOpen:r,setDeleteDialogOpen:o,deletePurge:m,deleteTarget:c,setDeleteTarget:f,deleteConfirmText:_,setDeleteConfirmText:v,performDelete:gt,editorPanelProps:Rt}}function pr(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(J,{className:`h-5 w-40`}),(0,Q.jsx)(J,{className:`h-3 w-64 max-w-full`})]}),(0,Q.jsx)(J,{className:`h-9 w-28 rounded-lg`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:[t,(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Array.from({length:6}).map(mr)})]}),e[1]=n):n=e[1],n}function mr(e,t){return(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(J,{className:`size-11 rounded-xl`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(J,{className:`h-4 w-2/3`}),(0,Q.jsx)(J,{className:`mt-2 h-3 w-24`})]})]}),(0,Q.jsx)(J,{className:`mt-4 h-3 w-full`}),(0,Q.jsx)(J,{className:`mt-2 h-3 w-4/5`}),(0,Q.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Q.jsx)(J,{className:`h-6 w-16 rounded-full`}),(0,Q.jsx)(J,{className:`h-6 w-20 rounded-full`})]})]},t)}function hr(){let e=fr();return e.hasToken?(0,Q.jsxs)(mt,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,className:`min-h-full bg-surface-panel`,children:[(0,Q.jsx)(pt,{title:e.a.title,subtitle:e.a.subtitle,actions:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,onClick:()=>e.navigate(`/settings/capability-presets`),children:[(0,Q.jsx)(Ye,{className:`size-4`,"aria-hidden":!0}),e.a.capabilityPresetsManage]}),(0,Q.jsxs)(q,{type:`button`,onClick:e.openAddAgentModal,disabled:e.busy,children:[(0,Q.jsx)(te,{className:`size-4`,"aria-hidden":!0}),e.a.addAgent]})]})}),e.displayError?(0,Q.jsx)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 shadow-surface dark:text-red-300`,children:e.displayError}):null,e.loading?(0,Q.jsx)(pr,{}):e.data?(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Q.jsx)(Un,{a:e.a,agents:e.data.agents,defaultAgentId:e.data.defaultId,tuiDefaultAgentId:e.effectiveTuiDefaultAgentId,tuiDefaultInherited:!e.savedTuiDefaultAgentId||e.tuiDefaultAgentUnavailable,searchQuery:e.listSearchQuery,onOpenAgent:t=>e.navigate($e(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(le,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},busy:e.busy})}):null,e.routeAgentId&&e.hasToken?(0,Q.jsx)(Rt,{open:!!e.routeAgentId,onOpenChange:e.onAgentModalOpenChange,a:e.a,title:e.modalTitle,subtitle:e.modalSubtitle,panel:e.panel,onPanelChange:e.setPanel,onFooterSave:()=>void e.handleModalFooterSave(),footerSaveDisabled:e.footerSaveDisabled,footerSavedFlash:e.savedFlash,showFooter:e.panel===`profile`||e.panel===`runtime`,busy:e.busy,children:e.loading||!e.data?(0,Q.jsx)(pr,{}):(0,Q.jsx)(Ln,{...e.editorPanelProps})}):null,(0,Q.jsx)(Gn,{open:e.addAgentModalOpen,onOpenChange:t=>{e.setAddAgentModalOpen(t),t||(e.createWorkspaceSuggestedRef.current=``,e.setCreateDisplayName(``),e.setCreateAgentId(``),e.setCreateDescription(``),e.setCreateWorkspace(``),e.setCreateModel(``),e.setCreateModalError(null),e.onSelectDuplicateSource(null),e.setCreatePresetIds([]))},a:e.a,chat:e.chat,busy:e.busy,modalError:e.createModalError,profileLanguageLabel:e.currentLanguageLabel,createDisplayName:e.createDisplayName,setCreateDisplayName:e.setCreateDisplayName,createAgentId:e.createAgentId,setCreateAgentId:e.setCreateAgentId,createDescription:e.createDescription,setCreateDescription:e.setCreateDescription,createWorkspace:e.createWorkspace,setCreateWorkspace:e.setCreateWorkspace,createModel:e.createModel,setCreateModel:e.setCreateModel,onCreate:e.onCreate,onSuggestWorkspace:()=>e.applyCreateWorkspaceSuggestion(),agents:e.data?.agents??[],duplicateSourceId:e.duplicateSourceId,onSelectDuplicateSource:e.onSelectDuplicateSource,capabilityPlans:e.editorPanelProps.capabilityPresets,defaultPresetId:e.editorPanelProps.defaultPresetId??`default`,selectedCapabilityPlanIds:e.createPresetIds,onSelectedCapabilityPlanIdsChange:e.setCreatePresetIds}),(0,Q.jsx)(Pt,{open:e.deleteDialogOpen,onOpenChange:t=>{e.setDeleteDialogOpen(t),t||(e.setDeleteTarget(null),e.setDeleteConfirmText(``))},busy:e.busy,deletePurge:e.deletePurge,deleteTarget:e.deleteTarget,deleteConfirmText:e.deleteConfirmText,onDeleteConfirmTextChange:e.setDeleteConfirmText,onConfirm:()=>{e.deleteTarget&&e.performDelete(e.deleteTarget,e.deletePurge)},onCancel:()=>e.setDeleteDialogOpen(!1),a:e.a})]}):(0,Q.jsxs)(mt,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,className:`min-h-full bg-surface-panel`,children:[(0,Q.jsx)(pt,{title:e.a.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]})}export{hr as AgentsSettingsPanel};
@@ -1 +1 @@
1
- import{r as e,s as t}from"./locale-store-C_M71MK9.js";async function n(){return(await t(e(`/api/local-apps`))).apps}async function r(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}`))).app}async function i(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/validate`),{method:`POST`})).validation}async function a(n,r,i){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/acceptance-runs`),{method:`POST`,body:JSON.stringify({sourceHash:r,...i})})).acceptance}async function o(n){return(await t(e(`/api/local-apps`),{method:`POST`,body:JSON.stringify(n)})).app}async function s(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`POST`})).app}async function c(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/releases/${encodeURIComponent(r)}/rollback`),{method:`POST`})).app}async function l(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/${r?`enable`:`disable`}`),{method:`POST`})).app}async function u(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`DELETE`})).app}export{a,u as c,n as i,i as l,r as n,c as o,s as r,l as s,o as t};
1
+ import{r as e,s as t}from"./locale-store-Dar-xqQr.js";async function n(){return(await t(e(`/api/local-apps`))).apps}async function r(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}`))).app}async function i(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/validate`),{method:`POST`})).validation}async function a(n,r,i){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/acceptance-runs`),{method:`POST`,body:JSON.stringify({sourceHash:r,...i})})).acceptance}async function o(n){return(await t(e(`/api/local-apps`),{method:`POST`,body:JSON.stringify(n)})).app}async function s(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`POST`})).app}async function c(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/releases/${encodeURIComponent(r)}/rollback`),{method:`POST`})).app}async function l(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/${r?`enable`:`disable`}`),{method:`POST`})).app}async function u(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`DELETE`})).app}export{a,u as c,n as i,i as l,r as n,c as o,s as r,l as s,o as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./copy-to-clipboard-HOJ79TWv.js";import{t as o}from"./messages-BuT0SR1R.js";import{n as s,r as c,s as l}from"./locale-store-C_M71MK9.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{Ec as d,Fo as f,Lo as p,Mo as m,No as h,Nt as g,Pl as _,Po as v,Xo as y,Yo as b,ao as x,cs as S,jo as C,ko as w,ms as T}from"./index-BuqGh2SW.js";import{n as E,r as D}from"./settings-page-layout-DG-XMIPu.js";import{t as O}from"./settings-loading-skeleton-UvA-eDhF.js";import{r as k,t as A}from"./settings-form-section-DruI__qO.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,o]=(0,M.useReducer)(g,L),{info:s,loadError:c,actionError:l,copiedField:u,clearDialogOpen:p,clearConfirmChecked:x,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await a(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(O,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=x&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(d,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,S.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(_,{className:`size-3`,"aria-hidden":!0}),u===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,S.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(_,{className:`size-3`,"aria-hidden":!0}),u===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,S.press),onClick:()=>{o({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,S.press),onClick:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(w,{open:p,onOpenChange:e=>{e||o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(v,{children:[(0,N.jsx)(h,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,y)}),(0,N.jsxs)(C,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(f,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(m,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:x,onChange:e=>o({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>o({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(T,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(T,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(w,{open:D,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(v,{children:[(0,N.jsx)(h,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,y)}),(0,N.jsxs)(C,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(f,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(m,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>o({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(T,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(T,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await l(c(`/api/migrations/status`))).payload}async function B(){await l(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=u(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(x,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(x,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let d=t?.items??[],f=d.filter(e=>e.status===`conflict`||e.status===`error`),p=d.filter(e=>e.safety===`auto`&&e.status===`planned`),m=f.length>0||d.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:d.length===0?e.upToDate:m?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(p.length))})]}),p.length>0&&!m?(0,N.jsx)(T,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),d.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=s(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!p()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=c);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
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"./cn-JdwAhgNB.js";import{t as a}from"./copy-to-clipboard-HOJ79TWv.js";import{t as o}from"./messages-CxySDn9d.js";import{n as s,r as c,s as l}from"./locale-store-Dar-xqQr.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{Bo as d,Go as f,Ho as p,Nc as m,Nt as h,Ro as g,Ss as _,Uo as v,Vl as y,Vo as b,Wo as x,Xa as S,gs as C,is as w,rs as T}from"./index-vq_cJZJC.js";import{n as E,r as D}from"./settings-page-layout-DWvNgISx.js";import{t as O}from"./settings-loading-skeleton-DkvwitK_.js";import{r as k,t as A}from"./settings-form-section-CNqF6IwY.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,o]=(0,M.useReducer)(h,L),{info:s,loadError:c,actionError:l,copiedField:u,clearDialogOpen:f,clearConfirmChecked:S,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await a(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(O,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=S&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(m,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(y,{className:`size-3`,"aria-hidden":!0}),u===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(y,{className:`size-3`,"aria-hidden":!0}),u===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,C.press),onClick:()=>{o({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,C.press),onClick:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(g,{open:f,onOpenChange:e=>{e||o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(v,{children:[(0,N.jsx)(p,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,w)}),(0,N.jsxs)(d,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,T,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(x,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(b,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:S,onChange:e=>o({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>o({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(_,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(_,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(g,{open:D,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(v,{children:[(0,N.jsx)(p,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,w)}),(0,N.jsxs)(d,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,T,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(x,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(b,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>o({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(_,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(_,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await l(c(`/api/migrations/status`))).payload}async function B(){await l(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=u(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(S,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(S,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let d=t?.items??[],f=d.filter(e=>e.status===`conflict`||e.status===`error`),p=d.filter(e=>e.safety===`auto`&&e.status===`planned`),m=f.length>0||d.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:d.length===0?e.upToDate:m?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(p.length))})]}),p.length>0&&!m?(0,N.jsx)(_,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),d.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=s(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!f()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=c);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{t as r}from"./messages-BuT0SR1R.js";import{n as i}from"./locale-store-C_M71MK9.js";import{i as a}from"./theme-store-C8ohIHhw.js";import{Uo as o,cs as s,lt as c}from"./index-BuqGh2SW.js";import{n as l,r as u}from"./settings-page-layout-DG-XMIPu.js";import{t as d}from"./settings-advanced-gate-CklL85T4.js";var f=e(),p=t();function m(){return n(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var h={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function g(e){let t=(0,f.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,p.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,p.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let m;t[12]===o?m=t[13]:(m=(0,p.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=m);let h;t[14]===o?h=t[15]:(h=(0,p.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=h);let g;t[16]!==c||t[17]!==d||t[18]!==m||t[19]!==h?(g=(0,p.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,m,h]}),t[16]=c,t[17]=d,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==s||t[22]!==g?(_=(0,p.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:g}),t[21]=s,t[22]=g,t[23]=_):_=t[23],_}function _(e){let t=(0,f.c)(8),{scheme:n}=e,{light:r,dark:i}=h[n],a;t[0]===r?a=t[1]:(a=(0,p.jsx)(g,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,p.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,p.jsx)(g,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,p.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var v=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function y(){let e=(0,f.c)(18),t=i(S),o;e[0]===t?o=e[1]:(o=r(t),e[0]=t,e[1]=o);let c=o.appearanceSettings,l=a(x),u=a(b),d;e[2]===c.colorSchemeTitle?d=e[3]:(d=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:c.colorSchemeTitle}),e[2]=c.colorSchemeTitle,e[3]=d);let m;e[4]===c.colorSchemeDescription?m=e[5]:(m=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:c.colorSchemeDescription}),e[4]=c.colorSchemeDescription,e[5]=m);let h;e[6]!==d||e[7]!==m?(h=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),e[6]=d,e[7]=m,e[8]=h):h=e[8];let g;e[9]!==c||e[10]!==l||e[11]!==u?(g=v.map(e=>{let{value:t,labelKey:r}=e,i=l===t;return(0,p.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>u(t),className:n(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,s.pressCard,i?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,p.jsx)(_,{scheme:t}),(0,p.jsx)(`span`,{className:n(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:c[r]})]},t)}),e[9]=c,e[10]=l,e[11]=u,e[12]=g):g=e[12];let y;e[13]===g?y=e[14]:(y=(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:g}),e[13]=g,e[14]=y);let C;return e[15]!==h||e[16]!==y?(C=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 p-3.5 sm:py-4`,children:[h,y]}),e[15]=h,e[16]=y,e[17]=C):C=e[17],C}function b(e){return e.setColorScheme}function x(e){return e.colorScheme}function S(e){return e.language}function C(){let e=(0,f.c)(27),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o=c(T),s=c(w),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let u;e[4]===a.developerGroupDescription?u=e[5]:(u=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=u);let d;e[6]!==l||e[7]!==u?(d=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[l,u]}),e[6]=l,e[7]=u,e[8]=d):d=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,p.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===s?_=e[17]:(_=e=>s(e.target.checked),e[16]=s,e[17]=_);let v;e[18]!==o||e[19]!==_?(v=(0,p.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:o,onChange:_}),e[18]=o,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==d||e[25]!==y?(b=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,y]}),e[24]=d,e[25]=y,e[26]=b):b=e[26],b}function w(e){return e.setShowRawToolData}function T(e){return e.showRawToolData}function E(e){return e.language}function D(){let e=(0,f.c)(29),t=i(O),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,s;e[2]!==a.pageTitle||e[3]!==a.subtitle?(s=(0,p.jsx)(l,{title:a.pageTitle,subtitle:a.subtitle}),e[2]=a.pageTitle,e[3]=a.subtitle,e[4]=s):s=e[4];let c;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=m(),e[5]=c):c=e[5];let h;e[6]===a.languageTitle?h=e[7]:(h=(0,p.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:a.languageTitle}),e[6]=a.languageTitle,e[7]=h);let g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,p.jsx)(o,{variant:`page`,sections:[`language`]}),e[8]=g):g=e[8];let _;e[9]===h?_=e[10]:(_=(0,p.jsxs)(`section`,{className:c,"aria-labelledby":`pref-language-heading`,children:[h,g]}),e[9]=h,e[10]=_);let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=m(),e[11]=v):v=e[11];let b;e[12]===a.themeTitle?b=e[13]:(b=(0,p.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:a.themeTitle}),e[12]=a.themeTitle,e[13]=b);let x,S;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,p.jsx)(o,{variant:`page`,sections:[`theme`,`font`]}),S=(0,p.jsx)(y,{}),e[14]=x,e[15]=S):(x=e[14],S=e[15]);let w;e[16]===b?w=e[17]:(w=(0,p.jsxs)(`section`,{className:v,"aria-labelledby":`pref-appearance-heading`,children:[b,x,S]}),e[16]=b,e[17]=w);let T;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(),e[18]=T):T=e[18];let E;e[19]===a.developerGroupTitle?E=e[20]:(E=(0,p.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:a.developerGroupTitle}),e[19]=a.developerGroupTitle,e[20]=E);let D;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,p.jsx)(C,{}),e[21]=D):D=e[21];let k;e[22]===E?k=e[23]:(k=(0,p.jsx)(d,{children:(0,p.jsxs)(`section`,{className:T,"aria-labelledby":`pref-developer-heading`,children:[E,D]})}),e[22]=E,e[23]=k);let A;return e[24]!==s||e[25]!==w||e[26]!==k||e[27]!==_?(A=(0,p.jsxs)(u,{gap:`gap-6`,children:[s,_,w,k]}),e[24]=s,e[25]=w,e[26]=k,e[27]=_,e[28]=A):A=e[28],A}function O(e){return e.language}export{D as AppearanceSettingsPanel};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{t as r}from"./messages-CxySDn9d.js";import{n as i}from"./locale-store-Dar-xqQr.js";import{i as a}from"./theme-store-B5FzMWOx.js";import{Zo as o,gs as s,lt as c}from"./index-vq_cJZJC.js";import{n as l,r as u}from"./settings-page-layout-DWvNgISx.js";import{t as d}from"./settings-advanced-gate-BkdeN99Y.js";var f=e(),p=t();function m(){return n(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var h={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function g(e){let t=(0,f.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,p.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,p.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let m;t[12]===o?m=t[13]:(m=(0,p.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=m);let h;t[14]===o?h=t[15]:(h=(0,p.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=h);let g;t[16]!==c||t[17]!==d||t[18]!==m||t[19]!==h?(g=(0,p.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,m,h]}),t[16]=c,t[17]=d,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==s||t[22]!==g?(_=(0,p.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:g}),t[21]=s,t[22]=g,t[23]=_):_=t[23],_}function _(e){let t=(0,f.c)(8),{scheme:n}=e,{light:r,dark:i}=h[n],a;t[0]===r?a=t[1]:(a=(0,p.jsx)(g,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,p.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,p.jsx)(g,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,p.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var v=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function y(){let e=(0,f.c)(18),t=i(S),o;e[0]===t?o=e[1]:(o=r(t),e[0]=t,e[1]=o);let c=o.appearanceSettings,l=a(x),u=a(b),d;e[2]===c.colorSchemeTitle?d=e[3]:(d=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:c.colorSchemeTitle}),e[2]=c.colorSchemeTitle,e[3]=d);let m;e[4]===c.colorSchemeDescription?m=e[5]:(m=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:c.colorSchemeDescription}),e[4]=c.colorSchemeDescription,e[5]=m);let h;e[6]!==d||e[7]!==m?(h=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),e[6]=d,e[7]=m,e[8]=h):h=e[8];let g;e[9]!==c||e[10]!==l||e[11]!==u?(g=v.map(e=>{let{value:t,labelKey:r}=e,i=l===t;return(0,p.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>u(t),className:n(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,s.pressCard,i?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,p.jsx)(_,{scheme:t}),(0,p.jsx)(`span`,{className:n(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:c[r]})]},t)}),e[9]=c,e[10]=l,e[11]=u,e[12]=g):g=e[12];let y;e[13]===g?y=e[14]:(y=(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:g}),e[13]=g,e[14]=y);let C;return e[15]!==h||e[16]!==y?(C=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 p-3.5 sm:py-4`,children:[h,y]}),e[15]=h,e[16]=y,e[17]=C):C=e[17],C}function b(e){return e.setColorScheme}function x(e){return e.colorScheme}function S(e){return e.language}function C(){let e=(0,f.c)(27),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o=c(T),s=c(w),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let u;e[4]===a.developerGroupDescription?u=e[5]:(u=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=u);let d;e[6]!==l||e[7]!==u?(d=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[l,u]}),e[6]=l,e[7]=u,e[8]=d):d=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,p.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===s?_=e[17]:(_=e=>s(e.target.checked),e[16]=s,e[17]=_);let v;e[18]!==o||e[19]!==_?(v=(0,p.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:o,onChange:_}),e[18]=o,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==d||e[25]!==y?(b=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,y]}),e[24]=d,e[25]=y,e[26]=b):b=e[26],b}function w(e){return e.setShowRawToolData}function T(e){return e.showRawToolData}function E(e){return e.language}function D(){let e=(0,f.c)(29),t=i(O),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,s;e[2]!==a.pageTitle||e[3]!==a.subtitle?(s=(0,p.jsx)(l,{title:a.pageTitle,subtitle:a.subtitle}),e[2]=a.pageTitle,e[3]=a.subtitle,e[4]=s):s=e[4];let c;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=m(),e[5]=c):c=e[5];let h;e[6]===a.languageTitle?h=e[7]:(h=(0,p.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:a.languageTitle}),e[6]=a.languageTitle,e[7]=h);let g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,p.jsx)(o,{variant:`page`,sections:[`language`]}),e[8]=g):g=e[8];let _;e[9]===h?_=e[10]:(_=(0,p.jsxs)(`section`,{className:c,"aria-labelledby":`pref-language-heading`,children:[h,g]}),e[9]=h,e[10]=_);let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=m(),e[11]=v):v=e[11];let b;e[12]===a.themeTitle?b=e[13]:(b=(0,p.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:a.themeTitle}),e[12]=a.themeTitle,e[13]=b);let x,S;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,p.jsx)(o,{variant:`page`,sections:[`theme`,`font`]}),S=(0,p.jsx)(y,{}),e[14]=x,e[15]=S):(x=e[14],S=e[15]);let w;e[16]===b?w=e[17]:(w=(0,p.jsxs)(`section`,{className:v,"aria-labelledby":`pref-appearance-heading`,children:[b,x,S]}),e[16]=b,e[17]=w);let T;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(),e[18]=T):T=e[18];let E;e[19]===a.developerGroupTitle?E=e[20]:(E=(0,p.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:a.developerGroupTitle}),e[19]=a.developerGroupTitle,e[20]=E);let D;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,p.jsx)(C,{}),e[21]=D):D=e[21];let k;e[22]===E?k=e[23]:(k=(0,p.jsx)(d,{children:(0,p.jsxs)(`section`,{className:T,"aria-labelledby":`pref-developer-heading`,children:[E,D]})}),e[22]=E,e[23]=k);let A;return e[24]!==s||e[25]!==w||e[26]!==k||e[27]!==_?(A=(0,p.jsxs)(u,{gap:`gap-6`,children:[s,_,w,k]}),e[24]=s,e[25]=w,e[26]=k,e[27]=_,e[28]=A):A=e[28],A}function O(e){return e.language}export{D as AppearanceSettingsPanel};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,t as a}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-CxySDn9d.js";import{l,n as u,o as d,r as f,s as p}from"./locale-store-Dar-xqQr.js";import{a as m,i as h}from"./vendor-swr-BIWyz7Rc.js";import{$a as g,Bi as _,Bo as v,Fl as y,Ho as b,Kc as x,Ls as S,Nc as C,Nt as w,Or as T,Qa as E,Ro as D,Rs as O,Sc as k,Ss as A,Su as j,Ts as ee,Uo as te,Vo as M,Wo as ne,Xa as N,bo as P,cc as F,eo as I,ic as L,iu as R,nc as re,no as z,pu as B,to as V}from"./index-vq_cJZJC.js";import{t as H}from"./page-tabs-CzZ4iKOb.js";var U=e(t(),1),W=n();function G(e){return e===`builtin`||e===`user`?e:`marketplace`}async function K(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ie(e){let t=await d(f(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await d(f(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await d(f(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function Y(e){let t=await d(f(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var X=r();function ae(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function Q({className:e}){let t=c(u(e=>e.language)).extensionsPage,n=l(e=>!!e.token),r=g(),{mutate:i}=m(),[a,o]=(0,U.useReducer)(w,Z),{q:d,debounced:_,detailPkg:v,rowBusy:y,actionError:b,restartHint:S}=a,E=n?`marketplace-${_}`:null;(0,U.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:d.trim()}}),300);return()=>window.clearTimeout(e)},[d]);let{data:D,isLoading:k,error:A}=h(E,async()=>p(_.length>0?f(`/api/marketplace?q=${encodeURIComponent(_)}`):f(`/api/marketplace`)),{revalidateOnFocus:!1}),j=(0,U.useCallback)(()=>{i(`gateway-extensions-list`),T()},[i]),ee=(0,U.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await q({name:e,overwrite:n});j(),r.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,j]),te=(0,U.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await Y(e);j(),n.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,j]),M=D?.extensions??[];return(0,X.jsxs)(`div`,{className:s(`flex flex-col gap-4`,e),children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(F,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:d,onChange:e=>o({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),A?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:A instanceof Error?A.message:t.marketplaceLoadFailed}):null,b?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:b}):null,S?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:S}):null,k&&!D?(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,X.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,X.jsx)(N,{className:`h-5 w-40`}),(0,X.jsx)(N,{className:`h-4 w-full max-w-xl`}),(0,X.jsx)(N,{className:`h-4 w-2/3 max-w-md`})]}),(0,X.jsx)(N,{className:`h-8 w-20`})]})},e))}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,children:M.length===0?(0,X.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):M.map(e=>{let n=ae(r,e.id),i=y===e.id;return(0,X.jsx)(`li`,{className:`list-none`,children:(0,X.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o({type:`patch`,patch:{detailPkg:e.id}}))},className:s(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,X.jsx)(R,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,X.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,X.jsx)(C,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,X.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,X.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&te(e.id).catch(()=>{})},className:s(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,X.jsx)(x,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(O,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,X.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:s(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:t.marketplaceReview})})]})},e.id)})}),v?(0,X.jsx)($,{packageName:v,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:ee,onUninstall:te}):null]})}function $(e){let t=(0,W.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:c,onUninstall:u}=e,[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),g=l(ue)?`ext-mp-detail-${n}`:null,y;t[0]===n?y=t[1]:(y=async()=>ie(n),t[0]=n,t[1]=y);let C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},t[2]=C):C=t[2];let{data:w,error:T,isLoading:E}=h(g,y,C),k;t[3]!==i||t[4]!==n?(k=ae(i,n),t[3]=i,t[4]=n,t[5]=k):k=t[5];let A=k,M=A===`user`,P=w?.manifest?.permissions,F,I,L,R,z,B,V,H,G,K,q;if(t[6]!==r.detailBack||t[7]!==r.detailClose||t[8]!==r.marketplaceAuthor||t[9]!==r.marketplaceCodeRisk||t[10]!==r.marketplaceDependencies||t[11]!==r.marketplaceDetailLoadFailed||t[12]!==r.marketplaceDetailReadmeHeading||t[13]!==r.marketplaceDetailTitle||t[14]!==r.marketplaceDownloads||t[15]!==r.marketplaceIntegrity||t[16]!==r.marketplaceIntegrityVerified||t[17]!==r.marketplaceLifecycleScripts||t[18]!==r.marketplaceLoadFailed||t[19]!==r.marketplaceLoading||t[20]!==r.marketplaceNoReadme||t[21]!==r.marketplacePermissions||t[22]!==r.marketplacePermissionsNone||t[23]!==r.marketplaceRiskConfirm||t[24]!==r.marketplaceRiskTitle||t[25]!==r.marketplaceUnavailableBody||t[26]!==r.marketplaceUnavailableTitle||t[27]!==r.marketplaceVersion||t[28]!==w||t[29]!==T||t[30]!==A||t[31]!==E||t[32]!==o||t[33]!==P||t[34]!==p){let e=P&&typeof P==`object`&&!Array.isArray(P)?Object.entries(P):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==w?(n=w?.readme?.trim()||(w?.description?.trim()?`### ${w.name}\n\n${w.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=w,t[48]=n):n=t[48];let i=n;L=D,R=!0,t[49]===o?z=t[50]:(z=e=>!e&&o(),t[49]=o,t[50]=z),I=te,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(b,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=q):q=t[51],F=v,H=`fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,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-elevated`,G=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(j,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,X.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:a}),t[53]=r.detailBack,t[54]=o,t[55]=s):s=t[55];let c;t[56]===r.marketplaceDetailTitle?c=t[57]:(c=(0,X.jsx)(ne,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=c);let l;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(ee,{className:`size-5`}),t[58]=l):l=t[58];let u;t[59]!==r.detailClose||t[60]!==o?(u=(0,X.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:l}),t[59]=r.detailClose,t[60]=o,t[61]=u):u=t[61],t[62]!==s||t[63]!==c||t[64]!==u?(K=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,c,u]}),t[62]=s,t[63]=c,t[64]=u,t[65]=K):K=t[65],B=`min-h-0 flex-1 overflow-y-auto p-5`,V=E&&!w?(0,X.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,X.jsx)(N,{className:`h-6 w-48`}),(0,X.jsx)(N,{className:`h-4 w-28`}),(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)(N,{className:`h-12`}),(0,X.jsx)(N,{className:`h-12`})]}),(0,X.jsx)(N,{className:`h-28 w-full`}),(0,X.jsx)(N,{className:`h-36 w-full`})]}):T?(0,X.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,X.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,X.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:T instanceof Error?T.message:r.marketplaceLoadFailed})]}):w?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:w.name}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:w.id})}),(0,X.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,X.jsx)(`dd`,{children:w.author.username})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,X.jsx)(`dd`,{children:w.latestVersion.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,X.jsx)(`dd`,{children:w.downloads})]})]}),A===`bundled`?null:(0,X.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[w.installability.available?(0,X.jsx)(re,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,X.jsx)(S,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:w.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:w.installability.available?r.marketplaceCodeRisk:w.installability.reason??r.marketplaceUnavailableBody})]})]}),w.installability.available?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,X.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,X.jsx)(`dd`,{children:w.packageSummary?.dependencyCount??0})]})]}),(0,X.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,X.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,X.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(w.packageSummary?.lifecycleScripts.length??0)>0?(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,w.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,X.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),w.readme?.trim()?(0,X.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,X.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,X.jsx)(_,{content:i})})]}):null,t[6]=r.detailBack,t[7]=r.detailClose,t[8]=r.marketplaceAuthor,t[9]=r.marketplaceCodeRisk,t[10]=r.marketplaceDependencies,t[11]=r.marketplaceDetailLoadFailed,t[12]=r.marketplaceDetailReadmeHeading,t[13]=r.marketplaceDetailTitle,t[14]=r.marketplaceDownloads,t[15]=r.marketplaceIntegrity,t[16]=r.marketplaceIntegrityVerified,t[17]=r.marketplaceLifecycleScripts,t[18]=r.marketplaceLoadFailed,t[19]=r.marketplaceLoading,t[20]=r.marketplaceNoReadme,t[21]=r.marketplacePermissions,t[22]=r.marketplacePermissionsNone,t[23]=r.marketplaceRiskConfirm,t[24]=r.marketplaceRiskTitle,t[25]=r.marketplaceUnavailableBody,t[26]=r.marketplaceUnavailableTitle,t[27]=r.marketplaceVersion,t[28]=w,t[29]=T,t[30]=A,t[31]=E,t[32]=o,t[33]=P,t[34]=p,t[35]=F,t[36]=I,t[37]=L,t[38]=R,t[39]=z,t[40]=B,t[41]=V,t[42]=H,t[43]=G,t[44]=K,t[45]=q}else F=t[35],I=t[36],L=t[37],R=t[38],z=t[39],B=t[40],V=t[41],H=t[42],G=t[43],K=t[44],q=t[45];let J;t[66]!==B||t[67]!==V?(J=(0,X.jsx)(`div`,{className:B,children:V}),t[66]=B,t[67]=V,t[68]=J):J=t[68];let Y;t[69]!==d||t[70]!==r.marketplaceBuiltinGoBuiltin||t[71]!==r.marketplaceBuiltinManageHint||t[72]!==r.marketplaceInstall||t[73]!==r.marketplaceReinstall||t[74]!==r.marketplaceReinstallConfirm||t[75]!==r.marketplaceUninstall||t[76]!==r.marketplaceUninstallConfirm||t[77]!==w||t[78]!==A||t[79]!==o||t[80]!==c||t[81]!==u||t[82]!==n||t[83]!==p||t[84]!==M?(Y=w?(0,X.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:A===`bundled`?(0,X.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,X.jsx)(a,{to:`/extensions?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,disabled:d||!w.installability.available||!p,onClick:()=>{M&&!window.confirm(r.marketplaceReinstallConfirm)||(f(!0),c(n,M).catch(se).finally(()=>f(!1)))},className:s(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[d?(0,X.jsx)(x,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,M?r.marketplaceReinstall:r.marketplaceInstall]}),M?(0,X.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(f(!0),u(n).then(()=>o()).catch(oe).finally(()=>f(!1)))},className:s(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,X.jsx)(O,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=d,t[70]=r.marketplaceBuiltinGoBuiltin,t[71]=r.marketplaceBuiltinManageHint,t[72]=r.marketplaceInstall,t[73]=r.marketplaceReinstall,t[74]=r.marketplaceReinstallConfirm,t[75]=r.marketplaceUninstall,t[76]=r.marketplaceUninstallConfirm,t[77]=w,t[78]=A,t[79]=o,t[80]=c,t[81]=u,t[82]=n,t[83]=p,t[84]=M,t[85]=Y):Y=t[85];let Z;t[86]!==F||t[87]!==J||t[88]!==Y||t[89]!==H||t[90]!==G||t[91]!==K?(Z=(0,X.jsxs)(F,{className:H,onOpenAutoFocus:G,children:[K,J,Y]}),t[86]=F,t[87]=J,t[88]=Y,t[89]=H,t[90]=G,t[91]=K,t[92]=Z):Z=t[92];let Q;t[93]!==I||t[94]!==Z||t[95]!==q?(Q=(0,X.jsxs)(I,{children:[q,Z]}),t[93]=I,t[94]=Z,t[95]=q,t[96]=Q):Q=t[96];let $;return t[97]!==L||t[98]!==R||t[99]!==z||t[100]!==Q?($=(0,X.jsx)(L,{defaultOpen:R,onOpenChange:z,children:Q}),t[97]=L,t[98]=R,t[99]=z,t[100]=Q,t[101]=$):$=t[101],$}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,X.jsxs)(`li`,{className:`break-words`,children:[(0,X.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.token}function de(){let e=u(e=>e.language),t=c(e),n=P(e=>e.setPageHeader),r=P(e=>e.clearPageHeader),o=g(),s=I(),[l,d]=i(),f=G(l.get(`tab`)),p=l.get(`q`)??``,[m,h]=(0,U.useState)(f),[_,v]=(0,U.useState)(p),[y,b]=(0,U.useState)(null),x=l.toString(),S=(0,U.useRef)(x);if(S.current!==x){S.current=x;let e=G(l.get(`tab`)),t=l.get(`q`)??``;h(t=>t===e?t:e),v(e=>e===t?e:t)}(0,U.useEffect)(()=>{d(e=>{let t=new URLSearchParams(e),n=_.trim();return n?t.set(`q`,n):t.delete(`q`),m===`marketplace`?t.delete(`tab`):t.set(`tab`,m),t.toString()===e.toString()?e:t},{replace:!0})},[m,_,d]);let C=(0,U.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),w=(0,U.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),T=m===`builtin`?C:w,E=(0,U.useMemo)(()=>{let t=_.trim().toLowerCase(),n=T;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[T,_,e]);if((0,U.useEffect)(()=>{b(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?fe(e)===fe(t)&&e.active===t.active?e:t:null})},[o]),(0,U.useLayoutEffect)(()=>(n({startExtra:null,main:(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(A,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,X.jsx)(B,{className:`size-4`}),(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,X.jsx)(A,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps/new`,children:[(0,X.jsx)(k,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&m!==`marketplace`)return(0,X.jsx)(ye,{});let D=m!==`marketplace`&&T.length>0;return(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,X.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,X.jsx)(H,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:C.length},{id:`user`,label:t.extensionsPage.tabUser,count:w.length}],activeTab:m,onChange:h,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),D?(0,X.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,X.jsx)(F,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:_,onChange:e=>v(e.target.value),placeholder:t.extensionsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),m===`marketplace`?(0,X.jsx)(Q,{}):m===`builtin`&&C.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):m===`user`&&w.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyUser}):E.length===0?(0,X.jsx)(`p`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-8 text-center text-sm text-fg-muted shadow-surface sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:E.map(e=>(0,X.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:m===`user`,onOpen:()=>b(e)},e.id))})]}),y?(0,X.jsx)(_e,{extension:y,copy:t.extensionsPage,onClose:()=>b(null)},y.id):null]})}function fe(e){return e.activationEligible??e.active}function pe(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function me(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function he(e,t){let n=fe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function ge(e){let t=(0,W.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,c;t[0]===n?c=t[1]:(c=fe(n),t[0]=n,t[1]=c);let l=c,u=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=s(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=d):d=t[2];let f=n.name||n.id,p;t[3]===f?p=t[4]:(p=f.charAt(0).toUpperCase(),t[3]=f,t[4]=p);let m;t[5]===p?m=t[6]:(m=(0,X.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:p}),t[5]=p,t[6]=m);let h;t[7]===n.name?h=t[8]:(h=(0,X.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=h);let g;t[9]===n.version?g=t[10]:(g=n.version?(0,X.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=g);let _;t[11]!==h||t[12]!==g?(_=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==r.statusEnabled||t[15]!==l?(v=l?(0,X.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,X.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,X.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,X.jsx)(k,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=l,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,X.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==u?(C=(0,X.jsx)(`span`,{title:u,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=u,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==n||t[30]!==i?(w=n.source===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,X.jsx)(`span`,{title:pe(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:me(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=w):w=t[31];let T;t[32]!==C||t[33]!==w?(T=(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,w]}),t[32]=C,t[33]=w,t[34]=T):T=t[34];let E;t[35]!==y||t[36]!==x||t[37]!==T?(E=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,T]}),t[35]=y,t[36]=x,t[37]=T,t[38]=E):E=t[38];let D;t[39]!==E||t[40]!==m?(D=(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[m,E]}),t[39]=E,t[40]=m,t[41]=D):D=t[41];let O;return t[42]!==a||t[43]!==D?(O=(0,X.jsx)(`button`,{type:`button`,onClick:a,className:d,children:D}),t[42]=a,t[43]=D,t[44]=O):O=t[44],O}function _e({extension:e,copy:t,onClose:n}){let{mutate:r}=m(),[i,o]=(0,U.useState)(!1),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(!1),f=e.activationEligible===!0,p=(0,U.useCallback)(async()=>{if(e.source===`bundled`){l(null),d(!1),o(!0);try{let{requiresGatewayRestart:t}=await J({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),T(),d(t)}catch(e){l(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),h=e.ui?.contributions?.pages??[],g=e.ui?.contributions?.settingsPanels??[],_=e.ui?.contributions?.chatWidgets??[],S=e.ui?.contributions?.sidebarPanels??[],C=h.find(e=>e.showInNav)??h[0],w=g[0],O=C?E(e.id,C):null,k=w?`/settings/ext/${e.id}/${w.id}`:e.hasConfigSchema||V(e)?`/settings/ext/${e.id}`:null;return(0,X.jsx)(D,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(te,{children:[(0,X.jsx)(b,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,X.jsxs)(v,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,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-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,X.jsx)(j,{className:`size-5`})}),(0,X.jsx)(ne,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,X.jsxs)(M,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,X.jsx)(ee,{className:`size-5`})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,X.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,X.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,X.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,X.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,X.jsx)(A,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void p(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(x,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),c?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:c}):null,u?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,X.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(h.length>0||g.length>0||_.length>0)?(0,X.jsxs)(`section`,{className:`mt-8`,children:[(0,X.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,X.jsx)(ve,{template:t.badgePages,count:h.length,hidden:h.length===0}),(0,X.jsx)(ve,{template:t.badgeSettings,count:g.length,hidden:g.length===0}),(0,X.jsx)(ve,{template:t.badgeWidgets,count:_.length,hidden:_.length===0}),(0,X.jsx)(ve,{template:t.badgeSidebar,count:S.length,hidden:S.length===0})]})]}):null,z(e)&&(O||k)?(0,X.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[O?(0,X.jsxs)(a,{to:O,onClick:n,className:s(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,X.jsx)(y,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,k?(0,X.jsxs)(a,{to:k,onClick:n,className:s(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,X.jsx)(L,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,X.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,W.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,X.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function ye(){let e=(0,W.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,X.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,X.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,X.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(be)})]})}),e[4]=a):a=e[4],a}function be(e){return(0,X.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function xe(e){let t=(0,W.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{de as ExtensionsPage};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-BuT0SR1R.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-CvjuvABg.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
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"./messages-CxySDn9d.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-3E_Qa-58.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-RnGYy9bC.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-zJ_50EbN.js";import{eo as t}from"./index-BuqGh2SW.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if(o===`application/pdf`||a.toLowerCase().endsWith(`.pdf`)){let{processPdf:t}=await e(async()=>{let{processPdf:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPdf:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n,preview:r}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/pdf`,size:s,content:d,extractedText:n,preview:r}}if(o===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||a.toLowerCase().endsWith(`.docx`)){let{processDocx:t}=await e(async()=>{let{processDocx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processDocx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,size:s,content:d,extractedText:n}}if(o===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||a.toLowerCase().endsWith(`.pptx`)){let{processPptx:t}=await e(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,size:s,content:d,extractedText:n}}if([`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-excel`].includes(o)||a.toLowerCase().endsWith(`.xlsx`)||a.toLowerCase().endsWith(`.xls`)){let{processExcel:t}=await e(async()=>{let{processExcel:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processExcel:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:o&&o.startsWith(`application/vnd`)?o:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,size:s,content:d,extractedText:n}}if(o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}throw Error(`Unsupported file type: ${o}`)}export{n as loadAttachment};
2
+ import{t as e}from"./preload-helper-zJ_50EbN.js";import{Ga as t}from"./index-vq_cJZJC.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if(o===`application/pdf`||a.toLowerCase().endsWith(`.pdf`)){let{processPdf:t}=await e(async()=>{let{processPdf:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPdf:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n,preview:r}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/pdf`,size:s,content:d,extractedText:n,preview:r}}if(o===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||a.toLowerCase().endsWith(`.docx`)){let{processDocx:t}=await e(async()=>{let{processDocx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processDocx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,size:s,content:d,extractedText:n}}if(o===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||a.toLowerCase().endsWith(`.pptx`)){let{processPptx:t}=await e(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,size:s,content:d,extractedText:n}}if([`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-excel`].includes(o)||a.toLowerCase().endsWith(`.xlsx`)||a.toLowerCase().endsWith(`.xls`)){let{processExcel:t}=await e(async()=>{let{processExcel:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processExcel:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:o&&o.startsWith(`application/vnd`)?o:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,size:s,content:d,extractedText:n}}if(o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}throw Error(`Unsupported file type: ${o}`)}export{n as loadAttachment};