@xopcai/xopc 0.0.404 → 0.0.406

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 (172) 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/{agent-avatar-dicebear-CdwFK70g.js → agent-avatar-dicebear-BE3ci_lj.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BMj9HwIQ.js → agent-defaults-settings-panel-DzDaum4Y.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-hrm6V8Dp.js → agents-BfC3FYYe.js} +3 -3
  6. package/dist/gateway/static/root/assets/{app-management-settings-panel-Rg9jOmoj.js → app-management-settings-panel-BDbJKxa-.js} +1 -1
  7. package/dist/gateway/static/root/assets/{appearance-settings-S3yp0GUO.js → appearance-settings-CEOOrVYb.js} +1 -1
  8. package/dist/gateway/static/root/assets/{apps-page-ChrJSB_2.js → apps-page-CpoG_3PG.js} +1 -1
  9. package/dist/gateway/static/root/assets/{archive-plugin-J7hwA5cs.js → archive-plugin-B7pzPErg.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automations-page-Cesz1cjw.js → automations-page-CcQjEiqk.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-workspace-DdopDyED.js → automations-workspace-BVTP3pzt.js} +1 -1
  12. package/dist/gateway/static/root/assets/{binary-plugins-Bg4Se8Kg.js → binary-plugins-D5kTu6gH.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-Bw1sO9YH.js → block-editor-CnW6rF_e.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-automation-inputs-Y46Mf8aY.js → browser-automation-inputs-CAcUtInP.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-automations-page-BcNjBdFQ.js → browser-automations-page-DT7-lnPN.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-settings-page-ByeqxrSF.js → browser-settings-page-ByK8znt2.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capabilities-CIv3LUQk.js → capabilities-Dl3LttAm.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capabilities-page-BUTQSo3A.js → capabilities-page-C8tv6M_O.js} +2 -2
  19. package/dist/gateway/static/root/assets/{capabilities-settings-panel-B-Uwmjbo.js → capabilities-settings-panel-OVLgL6yL.js} +1 -1
  20. package/dist/gateway/static/root/assets/{capability-header-actions-BGGJKzPL.js → capability-header-actions-jztljvVW.js} +1 -1
  21. package/dist/gateway/static/root/assets/{channels-z6iuM4HE.js → channels-D8BKMMPW.js} +1 -1
  22. package/dist/gateway/static/root/assets/{chat-terminal-dock-oMmP0flJ.js → chat-terminal-dock-BVlFOKJj.js} +1 -1
  23. package/dist/gateway/static/root/assets/{computer-settings-page-CERhSG5W.js → computer-settings-page-CvQgrTwb.js} +1 -1
  24. package/dist/gateway/static/root/assets/{connector-service-page-DyW3mLTh.js → connector-service-page-BNcTUa99.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connectors-page-CdMwhiio.js → connectors-page-CWlLRQpK.js} +1 -1
  26. package/dist/gateway/static/root/assets/{date-picker-CO3Jhdzg.js → date-picker-BKUmdSp7.js} +1 -1
  27. package/dist/gateway/static/root/assets/{dependency-picker-DbyMpo5J.js → dependency-picker-BarQvwoO.js} +1 -1
  28. package/dist/gateway/static/root/assets/{desktop-pet-DJ9OAPJs.js → desktop-pet-IvADYxyi.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-settings-CNrNXWlk.js → desktop-pet-settings-y6WzhGEK.js} +1 -1
  30. package/dist/gateway/static/root/assets/{device-pairing-wizard-TzK-VCuf.js → device-pairing-wizard-D3IUZ8xW.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-BmFgRA8G.js → directory-picker-path-field-DnEvwMTm.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-debug-page-C3ZpHHYc.js → extension-debug-page-CCvuK1m0.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-page-gfOwpT2R.js → extension-page-DegRwY3R.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-settings-page-BS7cDqZJ.js → extension-settings-page-B8UQgGgZ.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-settings-UB6hyqcj.js → gateway-settings-DlLyLsXY.js} +1 -1
  36. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-BRfDRn2k.js → highlighted-body-KQOG7T2V-MjAoJQJX.js} +1 -1
  37. package/dist/gateway/static/root/assets/{home-page-DBUnR1DO.js → home-page-DAYtNK3o.js} +1 -1
  38. package/dist/gateway/static/root/assets/{image-generation-api-BoMWmqwF.js → image-generation-api-SQDixWjO.js} +1 -1
  39. package/dist/gateway/static/root/assets/{imports-page-CPiPsiEP.js → imports-page-1ZId0Ng0.js} +1 -1
  40. package/dist/gateway/static/root/assets/{index-DmURUvvA.js → index-K2cy4f-3.js} +116 -116
  41. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D9y8h4dR.js → keyboard-shortcuts-settings-yMwBt1Sv.js} +1 -1
  42. package/dist/gateway/static/root/assets/{local-app-workbench-page-DoAmV6on.js → local-app-workbench-page-a7J0NPIs.js} +1 -1
  43. package/dist/gateway/static/root/assets/{local-apps-page-CE6Ag8oQ.js → local-apps-page-CF6_kS9C.js} +1 -1
  44. package/dist/gateway/static/root/assets/{logs-page-DFysUb2k.js → logs-page-C8y5yhoM.js} +1 -1
  45. package/dist/gateway/static/root/assets/{management-settings-CmXPsu0I.js → management-settings-C7dL_jNu.js} +1 -1
  46. package/dist/gateway/static/root/assets/{media-plugins-DvfdiczR.js → media-plugins-UYX1YivF.js} +1 -1
  47. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-7zpLTDLZ.js +1 -0
  48. package/dist/gateway/static/root/assets/{note-detail-panel-BpddDFQt.js → note-detail-panel-Bxm523Up.js} +3 -3
  49. package/dist/gateway/static/root/assets/note-image-lightbox-B7ARnjnB.js +1 -0
  50. package/dist/gateway/static/root/assets/{notes-page-DQ4KZsWt.js → notes-page-BOeS2v6x.js} +1 -1
  51. package/dist/gateway/static/root/assets/{page-context-capture-button-BcxVEGa2.js → page-context-capture-button-DOrPS73o.js} +1 -1
  52. package/dist/gateway/static/root/assets/{personal-page-CCQDxb7E.js → personal-page-BujiHops.js} +1 -1
  53. package/dist/gateway/static/root/assets/{plugin-details-dialog-CGFQ_-bG.js → plugin-details-dialog-XOzQrJQN.js} +1 -1
  54. package/dist/gateway/static/root/assets/{plugin-presentation-DF1gfuGf.js → plugin-presentation-CPEwVLd4.js} +1 -1
  55. package/dist/gateway/static/root/assets/{preview-open-alternatives-CXjjpXVx.js → preview-open-alternatives-BP9C0kH3.js} +1 -1
  56. package/dist/gateway/static/root/assets/{product-open-page-DqiyvM4c.js → product-open-page-D151rJVy.js} +1 -1
  57. package/dist/gateway/static/root/assets/{product-preview-content-f7Q4giA3.js → product-preview-content-CAo0XpP-.js} +1 -1
  58. package/dist/gateway/static/root/assets/project-detail-page-CxB_kF0F.js +1 -0
  59. package/dist/gateway/static/root/assets/{projects-page-DO_pIhy-.js → projects-page-Dvu_3c2g.js} +1 -1
  60. package/dist/gateway/static/root/assets/{remote-access-hub-BFtELmg0.js → remote-access-hub-CbzBV_BL.js} +1 -1
  61. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-B9Beu-oK.js → runtime-tools-settings-panel-DyLxlqWV.js} +1 -1
  62. package/dist/gateway/static/root/assets/{schema-form-ZAX7C5uI.js → schema-form-ClP4uPSj.js} +1 -1
  63. package/dist/gateway/static/root/assets/{session-manager-BUMUjup5.js → session-manager-DMDBMYfh.js} +2 -2
  64. package/dist/gateway/static/root/assets/{sessions-page-D27knqOl.js → sessions-page-CvfoPeM6.js} +1 -1
  65. package/dist/gateway/static/root/assets/settings-advanced-gate-BOkrHL8q.js +1 -0
  66. package/dist/gateway/static/root/assets/{settings-form-section-BTUFu5KS.js → settings-form-section-B4NShgv-.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-page-YFr6zzh7.js → settings-page-C54bw5J9.js} +1 -1
  68. package/dist/gateway/static/root/assets/{setup-status-panel-C5Jszsd1.js → setup-status-panel-BVKQ2inq.js} +1 -1
  69. package/dist/gateway/static/root/assets/{share-preview-page-CsfrvY_G.js → share-preview-page-BxN9t3MD.js} +1 -1
  70. package/dist/gateway/static/root/assets/{shares-settings-BW6BNot0.js → shares-settings-BOa9NAUc.js} +1 -1
  71. package/dist/gateway/static/root/assets/{skill-api-o3HSgF_K.js → skill-api-E0E-MH1S.js} +1 -1
  72. package/dist/gateway/static/root/assets/{skill-reload-api-BJsPnE87.js → skill-reload-api-DEN6tOwG.js} +1 -1
  73. package/dist/gateway/static/root/assets/{skills-page-Kuf2t7MG.js → skills-page-CeNVBQG9.js} +1 -1
  74. package/dist/gateway/static/root/assets/{style-DOz6lLJB.js → style-Bs9x3WBj.js} +1 -1
  75. package/dist/gateway/static/root/assets/{system-settings-panel-B69rR6vw.js → system-settings-panel-DpQPaJId.js} +1 -1
  76. package/dist/gateway/static/root/assets/task-detail-page-DzK53B5p.js +2 -0
  77. package/dist/gateway/static/root/assets/{task-expandable-content-BZCJqajv.js → task-expandable-content-BoGtWYbk.js} +1 -1
  78. package/dist/gateway/static/root/assets/{tasks-PuIUgF9L.js → tasks-B4bZpO6O.js} +1 -1
  79. package/dist/gateway/static/root/assets/{tracing-settings-page-BIq3Ayeg.js → tracing-settings-page-BUUnZfZW.js} +1 -1
  80. package/dist/gateway/static/root/assets/{tunnel-api-V9pJ8fUo.js → tunnel-api-3GopOQ_S.js} +1 -1
  81. package/dist/gateway/static/root/assets/{usage-page-DZdpti28.js → usage-page-B8j47CWQ.js} +1 -1
  82. package/dist/gateway/static/root/assets/{use-autosave-BnMIUc_5.js → use-autosave-CYIuWnRn.js} +1 -1
  83. package/dist/gateway/static/root/assets/{user-model-page-BEgJ97hp.js → user-model-page-DxcH74eP.js} +1 -1
  84. package/dist/gateway/static/root/assets/{voice-api-key-field-1h6fMaZL.js → voice-api-key-field-BN37Lklj.js} +1 -1
  85. package/dist/gateway/static/root/assets/{work-discovery-overlay-CVNqSNz8.js → work-discovery-overlay-C_bcAAX6.js} +1 -1
  86. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Dq63AthQ.js → workflow-run-setup-panel-B5oKCzTn.js} +1 -1
  87. package/dist/gateway/static/root/assets/{workflows-page-CfA1iwZu.js → workflows-page-Bo5b5t_9.js} +1 -1
  88. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BsW2acj1.js → xopc-cloud-account-card-DGGi4zVC.js} +1 -1
  89. package/dist/gateway/static/root/index.html +4 -4
  90. package/dist/package.js +1 -1
  91. package/dist/packages/gateway-contract/src/tasks.js +27 -8
  92. package/dist/src/agent/agent-manager.js +1 -1
  93. package/dist/src/agent/background-review/run-background-review.js +1 -1
  94. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  95. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  96. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  97. package/dist/src/agent/service.js +1 -1
  98. package/dist/src/agent/skills/index.js +1 -1
  99. package/dist/src/agent/skills/managed-store.js +1 -1
  100. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  101. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  102. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  103. package/dist/src/agent-catalog/capabilities.js +2 -2
  104. package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +1 -1
  105. package/dist/src/agent-catalog/repository.js +1 -1
  106. package/dist/src/automations/capabilities/drafts.js +1 -1
  107. package/dist/src/automations/capabilities/write.d.ts +14 -0
  108. package/dist/src/automations/domain/validation.d.ts +28 -0
  109. package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -1
  110. package/dist/src/bootstrap/application-state.js +1 -1
  111. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  112. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  113. package/dist/src/capabilities/runtime/product.js +1 -1
  114. package/dist/src/cli/commands/agents.js +1 -1
  115. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  116. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  117. package/dist/src/cli/commands/extension.js +1 -1
  118. package/dist/src/cli/commands/models.js +1 -1
  119. package/dist/src/cli/commands/onboard/model.js +1 -1
  120. package/dist/src/cli/commands/onboard.js +1 -1
  121. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  122. package/dist/src/config/agent-profile.js +1 -1
  123. package/dist/src/execution-environments/local-worktree-manager.js +1 -1
  124. package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
  125. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  126. package/dist/src/extensions/update.js +1 -1
  127. package/dist/src/gateway/agents-admin.js +2 -2
  128. package/dist/src/gateway/hono/routes/agents.js +1 -1
  129. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  130. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  131. package/dist/src/gateway/hono/routes/config.js +1 -1
  132. package/dist/src/gateway/hono/routes/notes.js +2 -2
  133. package/dist/src/gateway/hono/routes/projects.js +2 -2
  134. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  135. package/dist/src/gateway/hono/routes/tasks.js +3 -2
  136. package/dist/src/gateway/image-generation-setup.js +1 -1
  137. package/dist/src/gateway/service/config-coordinator.js +1 -1
  138. package/dist/src/gateway/service/run-gateway-agent.js +1 -0
  139. package/dist/src/gateway/service.js +6 -6
  140. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  141. package/dist/src/home-intelligence/host.js +2 -2
  142. package/dist/src/imports/importService.js +1 -1
  143. package/dist/src/infra/update-runner.js +1 -1
  144. package/dist/src/local-apps/service.js +1 -1
  145. package/dist/src/personal-agent/service.js +1 -1
  146. package/dist/src/providers/prompt-cache-lifecycle.d.ts +1 -1
  147. package/dist/src/providers/prompt-cache-lifecycle.js +1 -1
  148. package/dist/src/runtime-tools/archive.js +1 -1
  149. package/dist/src/storage/sqlite/migrations/258_task_phase_changes.sql +20 -0
  150. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  151. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  152. package/dist/src/storage/sqlite/schema.js +1 -1
  153. package/dist/src/tasks/capabilities/read.js +3 -2
  154. package/dist/src/tasks/capabilities/write.js +3 -3
  155. package/dist/src/tasks/task-application-service.d.ts +2 -1
  156. package/dist/src/tasks/task-application-service.js +80 -12
  157. package/dist/src/tasks/task-collaboration-delivery.js +2 -1
  158. package/dist/src/tasks/task-context-assembler.js +2 -1
  159. package/dist/src/tasks/task-read-model-projector.js +13 -5
  160. package/dist/src/tasks/task-repository.d.ts +11 -1
  161. package/dist/src/tasks/task-repository.js +42 -7
  162. package/dist/src/tasks/task-run-coordinator.d.ts +2 -0
  163. package/dist/src/tasks/task-run-coordinator.js +26 -17
  164. package/dist/src/tasks/task-run-repository.js +5 -2
  165. package/dist/src/tui/backends/embedded-backend.js +1 -1
  166. package/dist/src/voice/realtime/persona-context.js +1 -1
  167. package/package.json +4 -4
  168. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-SuiLTd5Y.js +0 -1
  169. package/dist/gateway/static/root/assets/note-image-lightbox-CMLVzPsQ.js +0 -1
  170. package/dist/gateway/static/root/assets/project-detail-page-PBK7vXK5.js +0 -1
  171. package/dist/gateway/static/root/assets/settings-advanced-gate-CDzdr1zW.js +0 -1
  172. package/dist/gateway/static/root/assets/task-detail-page-DOb97OLI.js +0 -2
@@ -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{d as i,f as a,g as o,t as s}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as c}from"./ellipsis-0k4rZLoy.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./markdown-view-CthsQiiO.js";import{t as d}from"./plus-Q2yW6OE7.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-Bwv-AOYl.js";import{t as m}from"./cn-0WouolD0.js";import{c as h,i as g,n as _,r as v}from"./locale-store-D5h-Ha6-.js";import{a as y,i as b,o as x,r as S,s as C,t as w}from"./dist-BGTk37IG.js";import{a as T,i as E}from"./vendor-swr-BIWyz7Rc.js";import{o as D}from"./gateway-realtime-SBtdXzco.js";import{$l as O,Af as k,Au as A,Bo as j,Go as M,Ho as N,Ic as P,Ju as F,Kc as I,Ml as L,Nl as R,Rc as z,Vo as B,ar as V,er as H,is as ee,jo as U,lf as W,no as G,nr as te,rr as ne,tr as K,tu as q,yf as J,zo as Y}from"./index-DmURUvvA.js";import{n as X,t as Z}from"./capability-links-DzQWK1Fh.js";import{n as re,t as ie}from"./capability-header-actions-BGGJKzPL.js";import{t as ae}from"./capability-icon-DVoZxEgW.js";import{i as oe,n as se,r as ce,t as le}from"./plugin-presentation-DF1gfuGf.js";var ue=n(),de=`grid auto-rows-fr grid-cols-[repeat(auto-fill,minmax(min(100%,18rem),1fr))] items-stretch gap-4`,fe=`relative h-full min-w-0 rounded-xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover/30`,pe=`absolute inset-0 cursor-pointer rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,Q=e(t(),1);function me(e){return e===`builtin`||e===`user`?e:`marketplace`}async function he(e=``){let t=await g(v(`/api/marketplace${e.trim()?`?q=${encodeURIComponent(e.trim())}`:``}`),{cache:`no-store`});if(!t.ok)throw Error(await ge(t));let n=await t.json();if(!n.ok||!Array.isArray(n.extensions))throw Error(n.error??`Invalid response`);return n.extensions}async function ge(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 _e(e){let t=await g(v(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await ge(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function ve(e){let t=await g(v(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await ge(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function ye(e){let t=await g(v(`/api/extensions/${encodeURIComponent(e.extensionId.trim())}/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e.enabled})});if(!t.ok)throw Error(await ge(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function be(e){let t=await g(v(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await ge(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var $=r();function xe(e,t){let n=e.find(e=>e.id===t||e.pluginId===t||e.provenance?.packageName===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Se={debounced:``,detailPkg:null,quickInstallPkg:null,rowBusy:null,actionError:null,restartHint:null};function Ce({className:e,query:t}){let n=a(),r=i(),o=_(e=>e.language),s=p(o).extensionsPage,c=h(e=>!!e.conversationId),l=Y(),{mutate:u}=T(),[d,f]=(0,Q.useReducer)(G,Se),{debounced:g,detailPkg:v,quickInstallPkg:y,rowBusy:b,actionError:x,restartHint:S}=d,C=c?`marketplace-${g}`:null;(0,Q.useEffect)(()=>{let e=window.setTimeout(()=>f({type:`patch`,patch:{debounced:t.trim()}}),300);return()=>window.clearTimeout(e)},[t]);let{data:w,isLoading:O,error:k}=E(C,()=>he(g),{revalidateOnFocus:!1}),j=(0,Q.useCallback)(()=>{u(`gateway-extensions-list`),D()},[u]),M=(0,Q.useCallback)(async(e,t)=>{f({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await ve({name:e,overwrite:t});j(),n.requiresGatewayRestart&&f({type:`patch`,patch:{restartHint:s.marketplaceRestartHint}})}catch(e){throw f({type:`patch`,patch:{actionError:e instanceof Error?e.message:s.marketplaceInstallFailed}}),e}finally{f({type:`patch`,patch:{rowBusy:null}})}},[s.marketplaceInstallFailed,s.marketplaceRestartHint,j]),N=(0,Q.useCallback)(async e=>{f({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let t=await be(e);j(),t.requiresGatewayRestart&&f({type:`patch`,patch:{restartHint:s.marketplaceRestartHint}})}catch(e){throw f({type:`patch`,patch:{actionError:e instanceof Error?e.message:s.marketplaceUninstallFailed}}),e}finally{f({type:`patch`,patch:{rowBusy:null}})}},[s.marketplaceRestartHint,s.marketplaceUninstallFailed,j]),P=w??[];return(0,$.jsxs)(`div`,{className:m(`flex flex-col gap-4`,e),children:[k?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:k instanceof Error?k.message:s.marketplaceLoadFailed}):null,x?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:x}):null,S?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:S}):null,O&&!w?(0,$.jsx)(`ul`,{className:de,"aria-label":s.marketplaceLoading,children:[0,1,2,3,4,5].map(e=>(0,$.jsxs)(`li`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(z,{className:`size-10 shrink-0 rounded-xl`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,$.jsx)(z,{className:`h-5 w-full`}),(0,$.jsx)(z,{className:`h-3 w-2/3`})]}),(0,$.jsx)(z,{className:`h-9 w-16 shrink-0 rounded-lg`})]}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,$.jsx)(z,{className:`h-4 w-full`}),(0,$.jsx)(z,{className:`h-4 w-full`}),(0,$.jsx)(z,{className:`h-4 w-2/3`})]})]},e))}):(0,$.jsx)(`ul`,{className:de,children:P.length===0?(0,$.jsx)(`li`,{className:`col-span-full text-sm text-fg-muted`,children:s.marketplaceEmpty}):P.map(e=>{let t=xe(l,e.id),i=b===e.id,a=l.find(t=>t.pluginId===e.id||t.provenance?.packageName===e.id),c=e.localizations?.[o.startsWith(`zh`)?`zh-CN`:`en`],u=c?.displayName??e.name,d=c?.description??e.description;return(0,$.jsxs)(`li`,{className:fe,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`${u}, ${s.marketplaceDetailTitle}`,onClick:()=>a?.pluginId?n(Z(a.pluginId,`installed`,!1,r.pathname+r.search)):f({type:`patch`,patch:{detailPkg:e.id}}),className:pe}),(0,$.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-3`,children:[(0,$.jsx)(ae,{iconUrl:e.branding?.iconUrl,fallback:A}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-1.5`,children:[(0,$.jsx)(`h3`,{className:`line-clamp-2 break-words font-semibold leading-snug text-fg`,title:u,children:u}),e.verified?(0,$.jsx)(W,{className:`mt-0.5 size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null]}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-subtle`,children:[e.version?(0,$.jsxs)(`span`,{children:[`v`,e.version]}):null,t===`user`?(0,$.jsx)(`span`,{className:a&&ce(a)?`text-amber-700 dark:text-amber-400`:`text-fg-muted`,children:a&&ce(a)?o.startsWith(`zh`)?`需要授权`:`Authorization required`:s.marketplaceInstalled}):null]})]}),(0,$.jsx)(`div`,{role:`group`,className:`pointer-events-auto relative z-10 flex max-w-[45%] shrink-0 items-start`,children:t===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:s.marketplaceBuiltin}):t===`user`?(0,$.jsx)($.Fragment,{children:e.packageType===`plugin`?(0,$.jsx)(`button`,{type:`button`,onClick:()=>a?.pluginId&&le(a)?n(X(u,o.startsWith(`zh`))):a?.pluginId?n(Z(a.pluginId,`installed`,ce(a),r.pathname+r.search)):f({type:`patch`,patch:{detailPkg:e.id,quickInstallPkg:null}}),className:m(`inline-flex items-center justify-center 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`),children:a&&ce(a)?o.startsWith(`zh`)?`去授权`:`Connect account`:a&&le(a)?o.startsWith(`zh`)?`开始使用`:`Start using`:o.startsWith(`zh`)?`管理插件`:`Manage plugin`}):(0,$.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(s.marketplaceUninstallConfirm)&&N(e.id).catch(()=>{})},className:m(`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,$.jsx)(F,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(R,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),s.marketplaceUninstall]})}):(0,$.jsx)(`button`,{type:`button`,onClick:()=>f({type:`patch`,patch:e.packageType===`plugin`?{detailPkg:e.id,quickInstallPkg:e.id}:{detailPkg:e.id,quickInstallPkg:null}}),className:m(`inline-flex min-w-16 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:e.packageType===`plugin`?o.startsWith(`zh`)?`安装`:`Install`:s.marketplaceReview})})]}),d?(0,$.jsx)(`p`,{className:`pointer-events-none relative mt-3 line-clamp-3 text-sm leading-relaxed text-fg-muted`,children:d}):null,(e.categories?.length??0)>0?(0,$.jsx)(`div`,{className:`pointer-events-none relative mt-3 flex flex-wrap gap-1.5`,children:e.categories?.map(e=>(0,$.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-edge px-2 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]},e.id)})}),v?(0,$.jsx)(we,{packageName:v,autoInstall:y===v,copy:s,extensions:l,onClose:()=>f({type:`patch`,patch:{detailPkg:null,quickInstallPkg:null}}),onInstall:M,onUninstall:N}):null]})}function we(e){let t=(0,ue.c)(98),{packageName:n,autoInstall:r,copy:i,extensions:a,onClose:o,onInstall:c,onUninstall:l}=e,[d,p]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=h(ke)?`ext-mp-detail-${n}`:null,b;t[0]===n?b=t[1]:(b=async()=>_e(n),t[0]=n,t[1]=b);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},t[2]=T):T=t[2];let{data:D,error:A,isLoading:j}=E(v,b,T),M;t[3]!==a||t[4]!==n?(M=xe(a,n),t[3]=a,t[4]=n,t[5]=M):M=t[5];let N=M,P=N===`user`,I=D?.manifest?.permissions,B,V,H,ee,U,W,G,te,ne,K,q,J;if(t[6]!==r||t[7]!==i||t[8]!==D||t[9]!==A||t[10]!==a||t[11]!==N||t[12]!==j||t[13]!==o||t[14]!==n||t[15]!==I||t[16]!==g){W=Symbol.for(`react.early_return_sentinel`);bb0:{let e=I&&typeof I==`object`&&!Array.isArray(I)?Object.entries(I):[],s;t[29]!==i||t[30]!==D?(s=D?.readme?.trim()||(D?.description?.trim()?`### ${D.name}\n\n${D.description}`:`*${i.marketplaceNoReadme}*`),t[29]=i,t[30]=D,t[31]=s):s=t[31];let c=s;if(D?.format===`agent-plugin`){let e;if(t[32]!==D||t[33]!==a||t[34]!==n){let r;t[36]!==D||t[37]!==n?(r=e=>e.provenance?.packageName===n||e.pluginId===D.manifest?.name,t[36]=D,t[37]=n,t[38]=r):r=t[38],e=a.find(r),t[32]=D,t[33]=a,t[34]=n,t[35]=e}else e=t[35];let i=`store:${n}`,s;t[39]!==r||t[40]!==D||t[41]!==o||t[42]!==e||t[43]!==i?(s=(0,$.jsx)(oe,{extension:e,initialSource:i,marketplace:D,autoInstall:r,onClose:o}),t[39]=r,t[40]=D,t[41]=o,t[42]=e,t[43]=i,t[44]=s):s=t[44],W=s;break bb0}H=w,ee=!0,t[45]===o?U=t[46]:(U=e=>!e&&o(),t[45]=o,t[46]=U),V=x,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[47]=J):J=t[47],B=S,ne=`xopc-dialog-content 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-overlay`,K=Oe;let l;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(k,{className:`size-5`}),t[48]=l):l=t[48];let d;t[49]!==i.detailBack||t[50]!==o?(d=(0,$.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":i.detailBack,children:l}),t[49]=i.detailBack,t[50]=o,t[51]=d):d=t[51];let p;t[52]===i.marketplaceDetailTitle?p=t[53]:(p=(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:i.marketplaceDetailTitle}),t[52]=i.marketplaceDetailTitle,t[53]=p);let m;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(f,{className:`size-5`}),t[54]=m):m=t[54];let h;t[55]!==i.detailClose||t[56]!==o?(h=(0,$.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":i.detailClose,children:m}),t[55]=i.detailClose,t[56]=o,t[57]=h):h=t[57],t[58]!==d||t[59]!==p||t[60]!==h?(q=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[d,p,h]}),t[58]=d,t[59]=p,t[60]=h,t[61]=q):q=t[61],G=`min-h-0 flex-1 overflow-y-auto p-5`,te=j&&!D?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":i.marketplaceLoading,children:[(0,$.jsx)(z,{className:`h-6 w-48`}),(0,$.jsx)(z,{className:`h-4 w-28`}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(z,{className:`h-12`}),(0,$.jsx)(z,{className:`h-12`})]}),(0,$.jsx)(z,{className:`h-28 w-full`}),(0,$.jsx)(z,{className:`h-36 w-full`})]}):A?(0,$.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,$.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:i.marketplaceDetailLoadFailed}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:A instanceof Error?A.message:i.marketplaceLoadFailed})]}):D?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:D.name}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:D.id})}),(0,$.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceAuthor}),(0,$.jsx)(`dd`,{children:D.author.username})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceVersion}),(0,$.jsx)(`dd`,{children:D.latestVersion.version})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDownloads}),(0,$.jsx)(`dd`,{children:D.downloads})]})]}),N===`bundled`?null:(0,$.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[D.installability.available?(0,$.jsx)(O,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,$.jsx)(L,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:D.installability.available?i.marketplaceRiskTitle:i.marketplaceUnavailableTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:D.installability.available?i.marketplaceCodeRisk:D.installability.reason??i.marketplaceUnavailableBody})]})]}),D.installability.available?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceIntegrity}),(0,$.jsx)(`dd`,{children:i.marketplaceIntegrityVerified})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDependencies}),(0,$.jsx)(`dd`,{children:D.packageSummary?.dependencyCount??0})]})]}),(0,$.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i.marketplacePermissions}),e.length>0?(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(De)}):(0,$.jsx)(`p`,{className:`mt-1`,children:i.marketplacePermissionsNone})]}),(D.packageSummary?.lifecycleScripts.length??0)>0?(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[i.marketplaceLifecycleScripts,`: `,D.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,$.jsx)(`span`,{children:i.marketplaceRiskConfirm})]})]}):null]}),D.readme?.trim()?(0,$.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:i.marketplaceDetailReadmeHeading}):null,(0,$.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,$.jsx)(u,{content:c})})]}):null}t[6]=r,t[7]=i,t[8]=D,t[9]=A,t[10]=a,t[11]=N,t[12]=j,t[13]=o,t[14]=n,t[15]=I,t[16]=g,t[17]=B,t[18]=V,t[19]=H,t[20]=ee,t[21]=U,t[22]=W,t[23]=G,t[24]=te,t[25]=ne,t[26]=K,t[27]=q,t[28]=J}else B=t[17],V=t[18],H=t[19],ee=t[20],U=t[21],W=t[22],G=t[23],te=t[24],ne=t[25],K=t[26],q=t[27],J=t[28];if(W!==Symbol.for(`react.early_return_sentinel`))return W;let Y;t[62]!==G||t[63]!==te?(Y=(0,$.jsx)(`div`,{className:G,children:te}),t[62]=G,t[63]=te,t[64]=Y):Y=t[64];let X;t[65]!==d||t[66]!==i.marketplaceBuiltinGoBuiltin||t[67]!==i.marketplaceBuiltinManageHint||t[68]!==i.marketplaceInstall||t[69]!==i.marketplaceReinstall||t[70]!==i.marketplaceReinstallConfirm||t[71]!==i.marketplaceUninstall||t[72]!==i.marketplaceUninstallConfirm||t[73]!==D||t[74]!==N||t[75]!==o||t[76]!==c||t[77]!==l||t[78]!==n||t[79]!==g||t[80]!==P?(X=D?(0,$.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:N===`bundled`?(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:i.marketplaceBuiltinManageHint}),(0,$.jsx)(s,{to:`/capabilities/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:i.marketplaceBuiltinGoBuiltin})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,disabled:d||!D.installability.available||!g,onClick:()=>{P&&!window.confirm(i.marketplaceReinstallConfirm)||(p(!0),c(n,P).catch(Ee).finally(()=>p(!1)))},className:m(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-on-accent 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,$.jsx)(F,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,P?i.marketplaceReinstall:i.marketplaceInstall]}),P?(0,$.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(i.marketplaceUninstallConfirm)&&(p(!0),l(n).then(()=>o()).catch(Te).finally(()=>p(!1)))},className:m(`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,$.jsx)(R,{className:`size-4 shrink-0`,"aria-hidden":!0}),i.marketplaceUninstall]}):null]})}):null,t[65]=d,t[66]=i.marketplaceBuiltinGoBuiltin,t[67]=i.marketplaceBuiltinManageHint,t[68]=i.marketplaceInstall,t[69]=i.marketplaceReinstall,t[70]=i.marketplaceReinstallConfirm,t[71]=i.marketplaceUninstall,t[72]=i.marketplaceUninstallConfirm,t[73]=D,t[74]=N,t[75]=o,t[76]=c,t[77]=l,t[78]=n,t[79]=g,t[80]=P,t[81]=X):X=t[81];let Z;t[82]!==B||t[83]!==Y||t[84]!==X||t[85]!==ne||t[86]!==K||t[87]!==q?(Z=(0,$.jsxs)(B,{className:ne,onOpenAutoFocus:K,children:[q,Y,X]}),t[82]=B,t[83]=Y,t[84]=X,t[85]=ne,t[86]=K,t[87]=q,t[88]=Z):Z=t[88];let re;t[89]!==V||t[90]!==Z||t[91]!==J?(re=(0,$.jsxs)(V,{children:[J,Z]}),t[89]=V,t[90]=Z,t[91]=J,t[92]=re):re=t[92];let ie;return t[93]!==H||t[94]!==ee||t[95]!==U||t[96]!==re?(ie=(0,$.jsx)(H,{defaultOpen:ee,onOpenChange:U,children:re}),t[93]=H,t[94]=ee,t[95]=U,t[96]=re,t[97]=ie):ie=t[97],ie}function Te(){}function Ee(){}function De(e){let[t,n]=e;return(0,$.jsxs)(`li`,{className:`break-words`,children:[(0,$.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function Oe(e){return e.preventDefault()}function ke(e){return!!e.conversationId}function Ae({embedded:e=!1,onHeaderActionChange:t}){let n=a(),r=i(),l=_(e=>e.language),u=p(l),f=M(e=>e.setPageHeader),h=M(e=>e.clearPageHeader),g=Y(),v=j(),[y,b]=o(),x=me(y.get(`tab`)??(g.some(e=>e.source!==`bundled`)?`user`:null)),S=(0,Q.useRef)(!1),C=y.get(`q`)??``,[w,T]=(0,Q.useState)(x),[E,D]=(0,Q.useState)(C),[O,k]=(0,Q.useState)(null),[A,N]=(0,Q.useState)(!1),F=y.toString(),L=(0,Q.useRef)(F);if(L.current!==F){L.current=F;let e=me(y.get(`tab`)),t=y.get(`q`)??``;T(t=>t===e?t:e),D(e=>e===t?e:t)}(0,Q.useEffect)(()=>{b(e=>{let t=new URLSearchParams(e),n=E.trim();return n?t.set(`q`,n):t.delete(`q`),w===`marketplace`?t.delete(`tab`):t.set(`tab`,w),t.toString()===e.toString()?e:t},{replace:!0})},[w,E,b]);let R=(0,Q.useMemo)(()=>g.filter(e=>e.source===`bundled`),[g]),z=(0,Q.useMemo)(()=>g.filter(e=>e.source!==`bundled`),[g]);(0,Q.useEffect)(()=>{v||S.current||(S.current=!0,!y.has(`tab`)&&z.length&&T(`user`))},[v,y,z.length]);let B=w===`builtin`?R:z,U=(0,Q.useMemo)(()=>{let e=E.trim().toLowerCase(),t=B;return e&&(t=t.filter(t=>(t.name??``).toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e))),t.toSorted((e,t)=>e.hasUi===t.hasUi?(e.name||e.id).localeCompare(t.name||t.id,l):e.hasUi?-1:1)},[B,E,l]);(0,Q.useEffect)(()=>{k(e=>{if(!e)return e;let t=g.find(t=>t.id===e.id);return t?je(e)===je(t)&&e.active===t.active&&JSON.stringify(e)===JSON.stringify(t)?e:t:null})},[g]);let W=(0,Q.useMemo)(()=>({searchLabel:w===`marketplace`?u.extensionsPage.marketplaceSearchPlaceholder:u.extensionsPage.searchPlaceholder,search:(0,$.jsx)(re,{value:E,onChange:D,placeholder:w===`marketplace`?u.extensionsPage.marketplaceSearchPlaceholder:u.extensionsPage.searchPlaceholder}),overflow:(0,$.jsxs)(ne,{children:[(0,$.jsx)(V,{asChild:!0,children:(0,$.jsx)(I,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":u.capabilitiesHub.moreActions,title:u.capabilitiesHub.moreActions,children:(0,$.jsx)(c,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(te,{children:(0,$.jsxs)(H,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,$.jsxs)(K,{className:m(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,P.transition),onSelect:()=>N(!0),children:[(0,$.jsx)(d,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),l.startsWith(`zh`)?`安装插件`:`Install plugin`]}),(0,$.jsx)(K,{asChild:!0,children:(0,$.jsxs)(s,{to:`/local-apps`,className:m(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,P.transition),children:[(0,$.jsx)(J,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),u.extensionsPage.openLocalApps]})})]})})]}),primary:(0,$.jsx)(I,{asChild:!0,variant:`primary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(s,{to:`/local-apps/new`,"aria-label":u.extensionsPage.createLocalApp,children:[(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:u.extensionsPage.createLocalApp})]})})}),[l,u.capabilitiesHub.moreActions,u.extensionsPage,w,E]);(0,Q.useLayoutEffect)(()=>e?(t?.(W),()=>t?.(null)):(f({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:u.extensionsPage.title})}),end:(0,$.jsx)(ie,{contribution:W})}),()=>h()),[h,e,W,u.extensionsPage.title,t,f]);let G=[{id:`user`,label:u.extensionsPage.tabUser,count:v?void 0:z.length},{id:`marketplace`,label:u.extensionsPage.tabMarketplace},{id:`builtin`,label:u.extensionsPage.tabBuiltin,count:v?void 0:R.length}];return(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:m(`mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8`,`pb-7 pt-3 lg:pb-9 lg:pt-4`),children:[(0,$.jsx)(`div`,{className:`mb-6 border-b border-edge-subtle pb-3`,children:(0,$.jsx)(ee,{items:G,activeTab:w,onChange:T,ariaLabel:u.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`})}),w===`marketplace`?(0,$.jsx)(Ce,{query:E}):v?(0,$.jsx)(Re,{}):w===`builtin`&&R.length===0?(0,$.jsx)(Be,{message:u.extensionsPage.emptyBuiltin}):w===`user`&&z.length===0?(0,$.jsx)(Be,{message:u.extensionsPage.emptyUser}):U.length===0?(0,$.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:u.extensionsPage.noSearchResults}):(0,$.jsx)(`div`,{className:de,children:U.map(e=>(0,$.jsx)(Pe,{extension:e,copy:u.extensionsPage,onOpen:()=>e.pluginId?n(Z(e.pluginId,`installed`,!1,r.pathname+r.search)):k(e)},e.id))})]}),O?O.format===`agent-plugin`?(0,$.jsx)(oe,{extension:O,onClose:()=>k(null)},O.id):(0,$.jsx)(Ie,{extension:O,copy:u.extensionsPage,onClose:()=>k(null)},O.id):null,A?(0,$.jsx)(oe,{onClose:()=>N(!1)}):null]})}function je(e){return e.activationEligible??e.active}function Me(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function Ne(e,t){let n=je(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function Pe(e){let t=(0,ue.c)(56),{extension:n,copy:r,onOpen:o}=e,s=_(Fe),c,l;t[0]!==n||t[1]!==s?(l=s.startsWith(`zh`),c=se(n,l),t[0]=n,t[1]=s,t[2]=c,t[3]=l):(c=t[2],l=t[3]);let u=c,d;t[4]===n?d=t[5]:(d=ce(n),t[4]=n,t[5]=d);let f=d,p=n.localizations?.[l?`zh-CN`:`en`]?.description??n.description,m=a(),h=i(),g;t[6]===n?g=t[7]:(g=!!n.pluginId&&le(n),t[6]=n,t[7]=g);let v=g,y=f?l?`去授权`:`Connect account`:v?l?`开始使用`:`Start using`:l?`管理插件`:`Manage plugin`,b;t[8]!==v||t[9]!==n.pluginId||t[10]!==h||t[11]!==u||t[12]!==m||t[13]!==f||t[14]!==o||t[15]!==l?(b=()=>{v?m(X(u,l)):f&&n.pluginId?m(Z(n.pluginId,`installed`,!0,h.pathname+h.search)):o()},t[8]=v,t[9]=n.pluginId,t[10]=h,t[11]=u,t[12]=m,t[13]=f,t[14]=o,t[15]=l,t[16]=b):b=t[16];let x=b,S=`${u}, ${r.marketplaceDetailTitle}`,C;t[17]!==o||t[18]!==S?(C=(0,$.jsx)(`button`,{type:`button`,"aria-label":S,onClick:o,className:pe}),t[17]=o,t[18]=S,t[19]=C):C=t[19];let w=n.branding?.iconUrl,T;t[20]===w?T=t[21]:(T=(0,$.jsx)(ae,{iconUrl:w,fallback:J}),t[20]=w,t[21]=T);let E;t[22]===u?E=t[23]:(E=(0,$.jsx)(`h2`,{className:`line-clamp-2 break-words font-semibold leading-snug text-fg`,title:u,children:u}),t[22]=u,t[23]=E);let D;t[24]===n.provenance?.publisherVerification?D=t[25]:(D=n.provenance?.publisherVerification===`verified`?(0,$.jsx)(W,{className:`mt-0.5 size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,t[24]=n.provenance?.publisherVerification,t[25]=D);let O;t[26]!==E||t[27]!==D?(O=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-1.5`,children:[E,D]}),t[26]=E,t[27]=D,t[28]=O):O=t[28];let k;t[29]===n.version?k=t[30]:(k=n.version?(0,$.jsxs)(`span`,{children:[`v`,n.version]}):null,t[29]=n.version,t[30]=k);let A=f?`text-amber-700 dark:text-amber-400`:`text-fg-muted`,j=f?l?`需要授权`:`Authorization required`:je(n)?r.statusEnabled:r.runStateOff,M;t[31]!==A||t[32]!==j?(M=(0,$.jsx)(`span`,{className:A,children:j}),t[31]=A,t[32]=j,t[33]=M):M=t[33];let N;t[34]!==k||t[35]!==M?(N=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-subtle`,children:[k,M]}),t[34]=k,t[35]=M,t[36]=N):N=t[36];let P;t[37]!==O||t[38]!==N?(P=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[O,N]}),t[37]=O,t[38]=N,t[39]=P):P=t[39];let F;t[40]!==y||t[41]!==x?(F=(0,$.jsx)(`div`,{className:`pointer-events-auto relative z-10 flex max-w-[45%] shrink-0 items-start`,children:(0,$.jsx)(`button`,{type:`button`,onClick:x,className:`inline-flex items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg transition-colors hover:bg-surface-hover active:scale-[0.98] active:bg-surface-hover/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:y})}),t[40]=y,t[41]=x,t[42]=F):F=t[42];let I;t[43]!==P||t[44]!==F||t[45]!==T?(I=(0,$.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-3`,children:[T,P,F]}),t[43]=P,t[44]=F,t[45]=T,t[46]=I):I=t[46];let L;t[47]!==r.cardNoDescription||t[48]!==p?(L=p?.trim()||r.cardNoDescription,t[47]=r.cardNoDescription,t[48]=p,t[49]=L):L=t[49];let R;t[50]===L?R=t[51]:(R=(0,$.jsx)(`p`,{className:`pointer-events-none relative mt-3 line-clamp-3 text-sm leading-relaxed text-fg-muted`,children:L}),t[50]=L,t[51]=R);let z;return t[52]!==I||t[53]!==R||t[54]!==C?(z=(0,$.jsxs)(`article`,{className:fe,children:[C,I,R]}),t[52]=I,t[53]=R,t[54]=C,t[55]=z):z=t[55],z}function Fe(e){return e.language}function Ie({extension:e,copy:t,onClose:n}){let{mutate:r}=T(),[i,a]=(0,Q.useState)(null),[o,c]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),p=e.activationEligible===!0,h=(0,Q.useCallback)(async()=>{c(null),d(!1),a(`toggle`);try{let{requiresGatewayRestart:t}=await ye({extensionId:e.id,enabled:!p});await r(`gateway-extensions-list`),D(),d(t)}catch(e){c(e instanceof Error?e.message:t.extensionToggleFailed)}finally{a(null)}},[p,t.extensionToggleFailed,e.id,r]),g=(0,Q.useCallback)(async()=>{if(!(e.source===`bundled`||!window.confirm(t.extensionUninstallConfirm))){c(null),d(!1),a(`uninstall`);try{await be(e.id),await r(`gateway-extensions-list`),D(),n()}catch(e){c(e instanceof Error?e.message:t.marketplaceUninstallFailed),a(null)}}},[t.extensionUninstallConfirm,t.marketplaceUninstallFailed,e.id,e.source,r,n]),_=e.ui?.contributions?.pages??[],v=e.ui?.contributions?.settingsPanels??[],E=e.ui?.contributions?.chatWidgets??[],O=_.find(e=>e.showInNav)??_[0],A=v[0],j=O?U(e.id,O):null,M=A?`/settings/ext/${e.id}/${A.id}`:e.hasConfigSchema||B(e)?`/settings/ext/${e.id}`:null;return(0,$.jsx)(w,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,$.jsxs)(x,{children:[(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,$.jsxs)(S,{className:`xopc-dialog-content 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-overlay`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,$.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,$.jsx)(k,{className:`size-5`})}),(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,$.jsxs)(b,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,$.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,$.jsx)(f,{className:`size-5`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,$.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,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,Me(e,t)]}),e.version?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,$.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:Ne(e,t)}),e.source===`bundled`?(0,$.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}):null,(0,$.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,$.jsx)(I,{type:`button`,variant:`secondary`,disabled:i!==null,onClick:()=>void h(),className:`shrink-0 py-1.5 text-xs`,children:i===`toggle`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(F,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):p?t.builtinToggleDisable:t.builtinToggleEnable})]}),o?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:o}):null,u?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null,e.source===`bundled`?null:(0,$.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,$.jsxs)(I,{type:`button`,variant:`ghost`,disabled:i!==null,onClick:()=>void g(),className:`text-danger hover:bg-danger-soft hover:text-danger`,children:[i===`uninstall`?(0,$.jsx)(F,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(R,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceUninstall]})})]}),e.hasUi&&(_.length>0||v.length>0||E.length>0)?(0,$.jsxs)(`section`,{className:`mt-8`,children:[(0,$.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,$.jsx)(Le,{template:t.badgePages,count:_.length,hidden:_.length===0}),(0,$.jsx)(Le,{template:t.badgeSettings,count:v.length,hidden:v.length===0}),(0,$.jsx)(Le,{template:t.badgeWidgets,count:E.length,hidden:E.length===0})]})]}):null,N(e)&&(j||M)?(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[j?(0,$.jsxs)(s,{to:j,onClick:n,className:m(`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,$.jsx)(l,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,M?(0,$.jsxs)(s,{to:M,onClick:n,className:m(`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,$.jsx)(q,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,$.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function Le(e){let t=(0,ue.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,$.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 Re(){let e=(0,ue.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:de,"aria-busy":`true`,children:Array.from({length:6},ze)}),e[0]=t):t=e[0],t}function ze(e,t){return(0,$.jsx)(z,{className:`h-32 rounded-xl`},t)}function Be(e){let t=(0,ue.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.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,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{Ae as ExtensionsPage};
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,f as a,g as o,t as s}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as c}from"./ellipsis-0k4rZLoy.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./markdown-view-CthsQiiO.js";import{t as d}from"./plus-Q2yW6OE7.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-Bwv-AOYl.js";import{t as m}from"./cn-0WouolD0.js";import{c as h,i as g,n as _,r as v}from"./locale-store-D5h-Ha6-.js";import{a as y,i as b,o as x,r as S,s as C,t as w}from"./dist-BGTk37IG.js";import{a as T,i as E}from"./vendor-swr-BIWyz7Rc.js";import{o as D}from"./gateway-realtime-SBtdXzco.js";import{$l as O,Af as k,Au as A,Bo as j,Go as M,Ho as N,Ic as P,Ju as F,Kc as I,Ml as L,Nl as R,Rc as z,Vo as B,ar as V,er as H,is as ee,jo as U,lf as W,no as G,nr as te,rr as ne,tr as K,tu as q,yf as J,zo as Y}from"./index-K2cy4f-3.js";import{n as X,t as Z}from"./capability-links-DzQWK1Fh.js";import{n as re,t as ie}from"./capability-header-actions-jztljvVW.js";import{t as ae}from"./capability-icon-DVoZxEgW.js";import{i as oe,n as se,r as ce,t as le}from"./plugin-presentation-CPEwVLd4.js";var ue=n(),de=`grid auto-rows-fr grid-cols-[repeat(auto-fill,minmax(min(100%,18rem),1fr))] items-stretch gap-4`,fe=`relative h-full min-w-0 rounded-xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover/30`,pe=`absolute inset-0 cursor-pointer rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,Q=e(t(),1);function me(e){return e===`builtin`||e===`user`?e:`marketplace`}async function he(e=``){let t=await g(v(`/api/marketplace${e.trim()?`?q=${encodeURIComponent(e.trim())}`:``}`),{cache:`no-store`});if(!t.ok)throw Error(await ge(t));let n=await t.json();if(!n.ok||!Array.isArray(n.extensions))throw Error(n.error??`Invalid response`);return n.extensions}async function ge(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 _e(e){let t=await g(v(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await ge(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function ve(e){let t=await g(v(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await ge(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function ye(e){let t=await g(v(`/api/extensions/${encodeURIComponent(e.extensionId.trim())}/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e.enabled})});if(!t.ok)throw Error(await ge(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function be(e){let t=await g(v(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await ge(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var $=r();function xe(e,t){let n=e.find(e=>e.id===t||e.pluginId===t||e.provenance?.packageName===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Se={debounced:``,detailPkg:null,quickInstallPkg:null,rowBusy:null,actionError:null,restartHint:null};function Ce({className:e,query:t}){let n=a(),r=i(),o=_(e=>e.language),s=p(o).extensionsPage,c=h(e=>!!e.conversationId),l=Y(),{mutate:u}=T(),[d,f]=(0,Q.useReducer)(G,Se),{debounced:g,detailPkg:v,quickInstallPkg:y,rowBusy:b,actionError:x,restartHint:S}=d,C=c?`marketplace-${g}`:null;(0,Q.useEffect)(()=>{let e=window.setTimeout(()=>f({type:`patch`,patch:{debounced:t.trim()}}),300);return()=>window.clearTimeout(e)},[t]);let{data:w,isLoading:O,error:k}=E(C,()=>he(g),{revalidateOnFocus:!1}),j=(0,Q.useCallback)(()=>{u(`gateway-extensions-list`),D()},[u]),M=(0,Q.useCallback)(async(e,t)=>{f({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await ve({name:e,overwrite:t});j(),n.requiresGatewayRestart&&f({type:`patch`,patch:{restartHint:s.marketplaceRestartHint}})}catch(e){throw f({type:`patch`,patch:{actionError:e instanceof Error?e.message:s.marketplaceInstallFailed}}),e}finally{f({type:`patch`,patch:{rowBusy:null}})}},[s.marketplaceInstallFailed,s.marketplaceRestartHint,j]),N=(0,Q.useCallback)(async e=>{f({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let t=await be(e);j(),t.requiresGatewayRestart&&f({type:`patch`,patch:{restartHint:s.marketplaceRestartHint}})}catch(e){throw f({type:`patch`,patch:{actionError:e instanceof Error?e.message:s.marketplaceUninstallFailed}}),e}finally{f({type:`patch`,patch:{rowBusy:null}})}},[s.marketplaceRestartHint,s.marketplaceUninstallFailed,j]),P=w??[];return(0,$.jsxs)(`div`,{className:m(`flex flex-col gap-4`,e),children:[k?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:k instanceof Error?k.message:s.marketplaceLoadFailed}):null,x?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:x}):null,S?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:S}):null,O&&!w?(0,$.jsx)(`ul`,{className:de,"aria-label":s.marketplaceLoading,children:[0,1,2,3,4,5].map(e=>(0,$.jsxs)(`li`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(z,{className:`size-10 shrink-0 rounded-xl`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,$.jsx)(z,{className:`h-5 w-full`}),(0,$.jsx)(z,{className:`h-3 w-2/3`})]}),(0,$.jsx)(z,{className:`h-9 w-16 shrink-0 rounded-lg`})]}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,$.jsx)(z,{className:`h-4 w-full`}),(0,$.jsx)(z,{className:`h-4 w-full`}),(0,$.jsx)(z,{className:`h-4 w-2/3`})]})]},e))}):(0,$.jsx)(`ul`,{className:de,children:P.length===0?(0,$.jsx)(`li`,{className:`col-span-full text-sm text-fg-muted`,children:s.marketplaceEmpty}):P.map(e=>{let t=xe(l,e.id),i=b===e.id,a=l.find(t=>t.pluginId===e.id||t.provenance?.packageName===e.id),c=e.localizations?.[o.startsWith(`zh`)?`zh-CN`:`en`],u=c?.displayName??e.name,d=c?.description??e.description;return(0,$.jsxs)(`li`,{className:fe,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`${u}, ${s.marketplaceDetailTitle}`,onClick:()=>a?.pluginId?n(Z(a.pluginId,`installed`,!1,r.pathname+r.search)):f({type:`patch`,patch:{detailPkg:e.id}}),className:pe}),(0,$.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-3`,children:[(0,$.jsx)(ae,{iconUrl:e.branding?.iconUrl,fallback:A}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-1.5`,children:[(0,$.jsx)(`h3`,{className:`line-clamp-2 break-words font-semibold leading-snug text-fg`,title:u,children:u}),e.verified?(0,$.jsx)(W,{className:`mt-0.5 size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null]}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-subtle`,children:[e.version?(0,$.jsxs)(`span`,{children:[`v`,e.version]}):null,t===`user`?(0,$.jsx)(`span`,{className:a&&ce(a)?`text-amber-700 dark:text-amber-400`:`text-fg-muted`,children:a&&ce(a)?o.startsWith(`zh`)?`需要授权`:`Authorization required`:s.marketplaceInstalled}):null]})]}),(0,$.jsx)(`div`,{role:`group`,className:`pointer-events-auto relative z-10 flex max-w-[45%] shrink-0 items-start`,children:t===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:s.marketplaceBuiltin}):t===`user`?(0,$.jsx)($.Fragment,{children:e.packageType===`plugin`?(0,$.jsx)(`button`,{type:`button`,onClick:()=>a?.pluginId&&le(a)?n(X(u,o.startsWith(`zh`))):a?.pluginId?n(Z(a.pluginId,`installed`,ce(a),r.pathname+r.search)):f({type:`patch`,patch:{detailPkg:e.id,quickInstallPkg:null}}),className:m(`inline-flex items-center justify-center 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`),children:a&&ce(a)?o.startsWith(`zh`)?`去授权`:`Connect account`:a&&le(a)?o.startsWith(`zh`)?`开始使用`:`Start using`:o.startsWith(`zh`)?`管理插件`:`Manage plugin`}):(0,$.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(s.marketplaceUninstallConfirm)&&N(e.id).catch(()=>{})},className:m(`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,$.jsx)(F,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(R,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),s.marketplaceUninstall]})}):(0,$.jsx)(`button`,{type:`button`,onClick:()=>f({type:`patch`,patch:e.packageType===`plugin`?{detailPkg:e.id,quickInstallPkg:e.id}:{detailPkg:e.id,quickInstallPkg:null}}),className:m(`inline-flex min-w-16 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:e.packageType===`plugin`?o.startsWith(`zh`)?`安装`:`Install`:s.marketplaceReview})})]}),d?(0,$.jsx)(`p`,{className:`pointer-events-none relative mt-3 line-clamp-3 text-sm leading-relaxed text-fg-muted`,children:d}):null,(e.categories?.length??0)>0?(0,$.jsx)(`div`,{className:`pointer-events-none relative mt-3 flex flex-wrap gap-1.5`,children:e.categories?.map(e=>(0,$.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-edge px-2 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]},e.id)})}),v?(0,$.jsx)(we,{packageName:v,autoInstall:y===v,copy:s,extensions:l,onClose:()=>f({type:`patch`,patch:{detailPkg:null,quickInstallPkg:null}}),onInstall:M,onUninstall:N}):null]})}function we(e){let t=(0,ue.c)(98),{packageName:n,autoInstall:r,copy:i,extensions:a,onClose:o,onInstall:c,onUninstall:l}=e,[d,p]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=h(ke)?`ext-mp-detail-${n}`:null,b;t[0]===n?b=t[1]:(b=async()=>_e(n),t[0]=n,t[1]=b);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},t[2]=T):T=t[2];let{data:D,error:A,isLoading:j}=E(v,b,T),M;t[3]!==a||t[4]!==n?(M=xe(a,n),t[3]=a,t[4]=n,t[5]=M):M=t[5];let N=M,P=N===`user`,I=D?.manifest?.permissions,B,V,H,ee,U,W,G,te,ne,K,q,J;if(t[6]!==r||t[7]!==i||t[8]!==D||t[9]!==A||t[10]!==a||t[11]!==N||t[12]!==j||t[13]!==o||t[14]!==n||t[15]!==I||t[16]!==g){W=Symbol.for(`react.early_return_sentinel`);bb0:{let e=I&&typeof I==`object`&&!Array.isArray(I)?Object.entries(I):[],s;t[29]!==i||t[30]!==D?(s=D?.readme?.trim()||(D?.description?.trim()?`### ${D.name}\n\n${D.description}`:`*${i.marketplaceNoReadme}*`),t[29]=i,t[30]=D,t[31]=s):s=t[31];let c=s;if(D?.format===`agent-plugin`){let e;if(t[32]!==D||t[33]!==a||t[34]!==n){let r;t[36]!==D||t[37]!==n?(r=e=>e.provenance?.packageName===n||e.pluginId===D.manifest?.name,t[36]=D,t[37]=n,t[38]=r):r=t[38],e=a.find(r),t[32]=D,t[33]=a,t[34]=n,t[35]=e}else e=t[35];let i=`store:${n}`,s;t[39]!==r||t[40]!==D||t[41]!==o||t[42]!==e||t[43]!==i?(s=(0,$.jsx)(oe,{extension:e,initialSource:i,marketplace:D,autoInstall:r,onClose:o}),t[39]=r,t[40]=D,t[41]=o,t[42]=e,t[43]=i,t[44]=s):s=t[44],W=s;break bb0}H=w,ee=!0,t[45]===o?U=t[46]:(U=e=>!e&&o(),t[45]=o,t[46]=U),V=x,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[47]=J):J=t[47],B=S,ne=`xopc-dialog-content 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-overlay`,K=Oe;let l;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(k,{className:`size-5`}),t[48]=l):l=t[48];let d;t[49]!==i.detailBack||t[50]!==o?(d=(0,$.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":i.detailBack,children:l}),t[49]=i.detailBack,t[50]=o,t[51]=d):d=t[51];let p;t[52]===i.marketplaceDetailTitle?p=t[53]:(p=(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:i.marketplaceDetailTitle}),t[52]=i.marketplaceDetailTitle,t[53]=p);let m;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(f,{className:`size-5`}),t[54]=m):m=t[54];let h;t[55]!==i.detailClose||t[56]!==o?(h=(0,$.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":i.detailClose,children:m}),t[55]=i.detailClose,t[56]=o,t[57]=h):h=t[57],t[58]!==d||t[59]!==p||t[60]!==h?(q=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[d,p,h]}),t[58]=d,t[59]=p,t[60]=h,t[61]=q):q=t[61],G=`min-h-0 flex-1 overflow-y-auto p-5`,te=j&&!D?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":i.marketplaceLoading,children:[(0,$.jsx)(z,{className:`h-6 w-48`}),(0,$.jsx)(z,{className:`h-4 w-28`}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(z,{className:`h-12`}),(0,$.jsx)(z,{className:`h-12`})]}),(0,$.jsx)(z,{className:`h-28 w-full`}),(0,$.jsx)(z,{className:`h-36 w-full`})]}):A?(0,$.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,$.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:i.marketplaceDetailLoadFailed}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:A instanceof Error?A.message:i.marketplaceLoadFailed})]}):D?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:D.name}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:D.id})}),(0,$.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceAuthor}),(0,$.jsx)(`dd`,{children:D.author.username})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceVersion}),(0,$.jsx)(`dd`,{children:D.latestVersion.version})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDownloads}),(0,$.jsx)(`dd`,{children:D.downloads})]})]}),N===`bundled`?null:(0,$.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[D.installability.available?(0,$.jsx)(O,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,$.jsx)(L,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:D.installability.available?i.marketplaceRiskTitle:i.marketplaceUnavailableTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:D.installability.available?i.marketplaceCodeRisk:D.installability.reason??i.marketplaceUnavailableBody})]})]}),D.installability.available?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceIntegrity}),(0,$.jsx)(`dd`,{children:i.marketplaceIntegrityVerified})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDependencies}),(0,$.jsx)(`dd`,{children:D.packageSummary?.dependencyCount??0})]})]}),(0,$.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i.marketplacePermissions}),e.length>0?(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(De)}):(0,$.jsx)(`p`,{className:`mt-1`,children:i.marketplacePermissionsNone})]}),(D.packageSummary?.lifecycleScripts.length??0)>0?(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[i.marketplaceLifecycleScripts,`: `,D.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,$.jsx)(`span`,{children:i.marketplaceRiskConfirm})]})]}):null]}),D.readme?.trim()?(0,$.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:i.marketplaceDetailReadmeHeading}):null,(0,$.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,$.jsx)(u,{content:c})})]}):null}t[6]=r,t[7]=i,t[8]=D,t[9]=A,t[10]=a,t[11]=N,t[12]=j,t[13]=o,t[14]=n,t[15]=I,t[16]=g,t[17]=B,t[18]=V,t[19]=H,t[20]=ee,t[21]=U,t[22]=W,t[23]=G,t[24]=te,t[25]=ne,t[26]=K,t[27]=q,t[28]=J}else B=t[17],V=t[18],H=t[19],ee=t[20],U=t[21],W=t[22],G=t[23],te=t[24],ne=t[25],K=t[26],q=t[27],J=t[28];if(W!==Symbol.for(`react.early_return_sentinel`))return W;let Y;t[62]!==G||t[63]!==te?(Y=(0,$.jsx)(`div`,{className:G,children:te}),t[62]=G,t[63]=te,t[64]=Y):Y=t[64];let X;t[65]!==d||t[66]!==i.marketplaceBuiltinGoBuiltin||t[67]!==i.marketplaceBuiltinManageHint||t[68]!==i.marketplaceInstall||t[69]!==i.marketplaceReinstall||t[70]!==i.marketplaceReinstallConfirm||t[71]!==i.marketplaceUninstall||t[72]!==i.marketplaceUninstallConfirm||t[73]!==D||t[74]!==N||t[75]!==o||t[76]!==c||t[77]!==l||t[78]!==n||t[79]!==g||t[80]!==P?(X=D?(0,$.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:N===`bundled`?(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:i.marketplaceBuiltinManageHint}),(0,$.jsx)(s,{to:`/capabilities/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:i.marketplaceBuiltinGoBuiltin})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,disabled:d||!D.installability.available||!g,onClick:()=>{P&&!window.confirm(i.marketplaceReinstallConfirm)||(p(!0),c(n,P).catch(Ee).finally(()=>p(!1)))},className:m(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-on-accent 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,$.jsx)(F,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,P?i.marketplaceReinstall:i.marketplaceInstall]}),P?(0,$.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(i.marketplaceUninstallConfirm)&&(p(!0),l(n).then(()=>o()).catch(Te).finally(()=>p(!1)))},className:m(`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,$.jsx)(R,{className:`size-4 shrink-0`,"aria-hidden":!0}),i.marketplaceUninstall]}):null]})}):null,t[65]=d,t[66]=i.marketplaceBuiltinGoBuiltin,t[67]=i.marketplaceBuiltinManageHint,t[68]=i.marketplaceInstall,t[69]=i.marketplaceReinstall,t[70]=i.marketplaceReinstallConfirm,t[71]=i.marketplaceUninstall,t[72]=i.marketplaceUninstallConfirm,t[73]=D,t[74]=N,t[75]=o,t[76]=c,t[77]=l,t[78]=n,t[79]=g,t[80]=P,t[81]=X):X=t[81];let Z;t[82]!==B||t[83]!==Y||t[84]!==X||t[85]!==ne||t[86]!==K||t[87]!==q?(Z=(0,$.jsxs)(B,{className:ne,onOpenAutoFocus:K,children:[q,Y,X]}),t[82]=B,t[83]=Y,t[84]=X,t[85]=ne,t[86]=K,t[87]=q,t[88]=Z):Z=t[88];let re;t[89]!==V||t[90]!==Z||t[91]!==J?(re=(0,$.jsxs)(V,{children:[J,Z]}),t[89]=V,t[90]=Z,t[91]=J,t[92]=re):re=t[92];let ie;return t[93]!==H||t[94]!==ee||t[95]!==U||t[96]!==re?(ie=(0,$.jsx)(H,{defaultOpen:ee,onOpenChange:U,children:re}),t[93]=H,t[94]=ee,t[95]=U,t[96]=re,t[97]=ie):ie=t[97],ie}function Te(){}function Ee(){}function De(e){let[t,n]=e;return(0,$.jsxs)(`li`,{className:`break-words`,children:[(0,$.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function Oe(e){return e.preventDefault()}function ke(e){return!!e.conversationId}function Ae({embedded:e=!1,onHeaderActionChange:t}){let n=a(),r=i(),l=_(e=>e.language),u=p(l),f=M(e=>e.setPageHeader),h=M(e=>e.clearPageHeader),g=Y(),v=j(),[y,b]=o(),x=me(y.get(`tab`)??(g.some(e=>e.source!==`bundled`)?`user`:null)),S=(0,Q.useRef)(!1),C=y.get(`q`)??``,[w,T]=(0,Q.useState)(x),[E,D]=(0,Q.useState)(C),[O,k]=(0,Q.useState)(null),[A,N]=(0,Q.useState)(!1),F=y.toString(),L=(0,Q.useRef)(F);if(L.current!==F){L.current=F;let e=me(y.get(`tab`)),t=y.get(`q`)??``;T(t=>t===e?t:e),D(e=>e===t?e:t)}(0,Q.useEffect)(()=>{b(e=>{let t=new URLSearchParams(e),n=E.trim();return n?t.set(`q`,n):t.delete(`q`),w===`marketplace`?t.delete(`tab`):t.set(`tab`,w),t.toString()===e.toString()?e:t},{replace:!0})},[w,E,b]);let R=(0,Q.useMemo)(()=>g.filter(e=>e.source===`bundled`),[g]),z=(0,Q.useMemo)(()=>g.filter(e=>e.source!==`bundled`),[g]);(0,Q.useEffect)(()=>{v||S.current||(S.current=!0,!y.has(`tab`)&&z.length&&T(`user`))},[v,y,z.length]);let B=w===`builtin`?R:z,U=(0,Q.useMemo)(()=>{let e=E.trim().toLowerCase(),t=B;return e&&(t=t.filter(t=>(t.name??``).toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e))),t.toSorted((e,t)=>e.hasUi===t.hasUi?(e.name||e.id).localeCompare(t.name||t.id,l):e.hasUi?-1:1)},[B,E,l]);(0,Q.useEffect)(()=>{k(e=>{if(!e)return e;let t=g.find(t=>t.id===e.id);return t?je(e)===je(t)&&e.active===t.active&&JSON.stringify(e)===JSON.stringify(t)?e:t:null})},[g]);let W=(0,Q.useMemo)(()=>({searchLabel:w===`marketplace`?u.extensionsPage.marketplaceSearchPlaceholder:u.extensionsPage.searchPlaceholder,search:(0,$.jsx)(re,{value:E,onChange:D,placeholder:w===`marketplace`?u.extensionsPage.marketplaceSearchPlaceholder:u.extensionsPage.searchPlaceholder}),overflow:(0,$.jsxs)(ne,{children:[(0,$.jsx)(V,{asChild:!0,children:(0,$.jsx)(I,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":u.capabilitiesHub.moreActions,title:u.capabilitiesHub.moreActions,children:(0,$.jsx)(c,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(te,{children:(0,$.jsxs)(H,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,$.jsxs)(K,{className:m(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,P.transition),onSelect:()=>N(!0),children:[(0,$.jsx)(d,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),l.startsWith(`zh`)?`安装插件`:`Install plugin`]}),(0,$.jsx)(K,{asChild:!0,children:(0,$.jsxs)(s,{to:`/local-apps`,className:m(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,P.transition),children:[(0,$.jsx)(J,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),u.extensionsPage.openLocalApps]})})]})})]}),primary:(0,$.jsx)(I,{asChild:!0,variant:`primary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(s,{to:`/local-apps/new`,"aria-label":u.extensionsPage.createLocalApp,children:[(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:u.extensionsPage.createLocalApp})]})})}),[l,u.capabilitiesHub.moreActions,u.extensionsPage,w,E]);(0,Q.useLayoutEffect)(()=>e?(t?.(W),()=>t?.(null)):(f({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:u.extensionsPage.title})}),end:(0,$.jsx)(ie,{contribution:W})}),()=>h()),[h,e,W,u.extensionsPage.title,t,f]);let G=[{id:`user`,label:u.extensionsPage.tabUser,count:v?void 0:z.length},{id:`marketplace`,label:u.extensionsPage.tabMarketplace},{id:`builtin`,label:u.extensionsPage.tabBuiltin,count:v?void 0:R.length}];return(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:m(`mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8`,`pb-7 pt-3 lg:pb-9 lg:pt-4`),children:[(0,$.jsx)(`div`,{className:`mb-6 border-b border-edge-subtle pb-3`,children:(0,$.jsx)(ee,{items:G,activeTab:w,onChange:T,ariaLabel:u.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`})}),w===`marketplace`?(0,$.jsx)(Ce,{query:E}):v?(0,$.jsx)(Re,{}):w===`builtin`&&R.length===0?(0,$.jsx)(Be,{message:u.extensionsPage.emptyBuiltin}):w===`user`&&z.length===0?(0,$.jsx)(Be,{message:u.extensionsPage.emptyUser}):U.length===0?(0,$.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:u.extensionsPage.noSearchResults}):(0,$.jsx)(`div`,{className:de,children:U.map(e=>(0,$.jsx)(Pe,{extension:e,copy:u.extensionsPage,onOpen:()=>e.pluginId?n(Z(e.pluginId,`installed`,!1,r.pathname+r.search)):k(e)},e.id))})]}),O?O.format===`agent-plugin`?(0,$.jsx)(oe,{extension:O,onClose:()=>k(null)},O.id):(0,$.jsx)(Ie,{extension:O,copy:u.extensionsPage,onClose:()=>k(null)},O.id):null,A?(0,$.jsx)(oe,{onClose:()=>N(!1)}):null]})}function je(e){return e.activationEligible??e.active}function Me(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function Ne(e,t){let n=je(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function Pe(e){let t=(0,ue.c)(56),{extension:n,copy:r,onOpen:o}=e,s=_(Fe),c,l;t[0]!==n||t[1]!==s?(l=s.startsWith(`zh`),c=se(n,l),t[0]=n,t[1]=s,t[2]=c,t[3]=l):(c=t[2],l=t[3]);let u=c,d;t[4]===n?d=t[5]:(d=ce(n),t[4]=n,t[5]=d);let f=d,p=n.localizations?.[l?`zh-CN`:`en`]?.description??n.description,m=a(),h=i(),g;t[6]===n?g=t[7]:(g=!!n.pluginId&&le(n),t[6]=n,t[7]=g);let v=g,y=f?l?`去授权`:`Connect account`:v?l?`开始使用`:`Start using`:l?`管理插件`:`Manage plugin`,b;t[8]!==v||t[9]!==n.pluginId||t[10]!==h||t[11]!==u||t[12]!==m||t[13]!==f||t[14]!==o||t[15]!==l?(b=()=>{v?m(X(u,l)):f&&n.pluginId?m(Z(n.pluginId,`installed`,!0,h.pathname+h.search)):o()},t[8]=v,t[9]=n.pluginId,t[10]=h,t[11]=u,t[12]=m,t[13]=f,t[14]=o,t[15]=l,t[16]=b):b=t[16];let x=b,S=`${u}, ${r.marketplaceDetailTitle}`,C;t[17]!==o||t[18]!==S?(C=(0,$.jsx)(`button`,{type:`button`,"aria-label":S,onClick:o,className:pe}),t[17]=o,t[18]=S,t[19]=C):C=t[19];let w=n.branding?.iconUrl,T;t[20]===w?T=t[21]:(T=(0,$.jsx)(ae,{iconUrl:w,fallback:J}),t[20]=w,t[21]=T);let E;t[22]===u?E=t[23]:(E=(0,$.jsx)(`h2`,{className:`line-clamp-2 break-words font-semibold leading-snug text-fg`,title:u,children:u}),t[22]=u,t[23]=E);let D;t[24]===n.provenance?.publisherVerification?D=t[25]:(D=n.provenance?.publisherVerification===`verified`?(0,$.jsx)(W,{className:`mt-0.5 size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,t[24]=n.provenance?.publisherVerification,t[25]=D);let O;t[26]!==E||t[27]!==D?(O=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-1.5`,children:[E,D]}),t[26]=E,t[27]=D,t[28]=O):O=t[28];let k;t[29]===n.version?k=t[30]:(k=n.version?(0,$.jsxs)(`span`,{children:[`v`,n.version]}):null,t[29]=n.version,t[30]=k);let A=f?`text-amber-700 dark:text-amber-400`:`text-fg-muted`,j=f?l?`需要授权`:`Authorization required`:je(n)?r.statusEnabled:r.runStateOff,M;t[31]!==A||t[32]!==j?(M=(0,$.jsx)(`span`,{className:A,children:j}),t[31]=A,t[32]=j,t[33]=M):M=t[33];let N;t[34]!==k||t[35]!==M?(N=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-subtle`,children:[k,M]}),t[34]=k,t[35]=M,t[36]=N):N=t[36];let P;t[37]!==O||t[38]!==N?(P=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[O,N]}),t[37]=O,t[38]=N,t[39]=P):P=t[39];let F;t[40]!==y||t[41]!==x?(F=(0,$.jsx)(`div`,{className:`pointer-events-auto relative z-10 flex max-w-[45%] shrink-0 items-start`,children:(0,$.jsx)(`button`,{type:`button`,onClick:x,className:`inline-flex items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg transition-colors hover:bg-surface-hover active:scale-[0.98] active:bg-surface-hover/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:y})}),t[40]=y,t[41]=x,t[42]=F):F=t[42];let I;t[43]!==P||t[44]!==F||t[45]!==T?(I=(0,$.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-3`,children:[T,P,F]}),t[43]=P,t[44]=F,t[45]=T,t[46]=I):I=t[46];let L;t[47]!==r.cardNoDescription||t[48]!==p?(L=p?.trim()||r.cardNoDescription,t[47]=r.cardNoDescription,t[48]=p,t[49]=L):L=t[49];let R;t[50]===L?R=t[51]:(R=(0,$.jsx)(`p`,{className:`pointer-events-none relative mt-3 line-clamp-3 text-sm leading-relaxed text-fg-muted`,children:L}),t[50]=L,t[51]=R);let z;return t[52]!==I||t[53]!==R||t[54]!==C?(z=(0,$.jsxs)(`article`,{className:fe,children:[C,I,R]}),t[52]=I,t[53]=R,t[54]=C,t[55]=z):z=t[55],z}function Fe(e){return e.language}function Ie({extension:e,copy:t,onClose:n}){let{mutate:r}=T(),[i,a]=(0,Q.useState)(null),[o,c]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),p=e.activationEligible===!0,h=(0,Q.useCallback)(async()=>{c(null),d(!1),a(`toggle`);try{let{requiresGatewayRestart:t}=await ye({extensionId:e.id,enabled:!p});await r(`gateway-extensions-list`),D(),d(t)}catch(e){c(e instanceof Error?e.message:t.extensionToggleFailed)}finally{a(null)}},[p,t.extensionToggleFailed,e.id,r]),g=(0,Q.useCallback)(async()=>{if(!(e.source===`bundled`||!window.confirm(t.extensionUninstallConfirm))){c(null),d(!1),a(`uninstall`);try{await be(e.id),await r(`gateway-extensions-list`),D(),n()}catch(e){c(e instanceof Error?e.message:t.marketplaceUninstallFailed),a(null)}}},[t.extensionUninstallConfirm,t.marketplaceUninstallFailed,e.id,e.source,r,n]),_=e.ui?.contributions?.pages??[],v=e.ui?.contributions?.settingsPanels??[],E=e.ui?.contributions?.chatWidgets??[],O=_.find(e=>e.showInNav)??_[0],A=v[0],j=O?U(e.id,O):null,M=A?`/settings/ext/${e.id}/${A.id}`:e.hasConfigSchema||B(e)?`/settings/ext/${e.id}`:null;return(0,$.jsx)(w,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,$.jsxs)(x,{children:[(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,$.jsxs)(S,{className:`xopc-dialog-content 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-overlay`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,$.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,$.jsx)(k,{className:`size-5`})}),(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,$.jsxs)(b,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,$.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,$.jsx)(f,{className:`size-5`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,$.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,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,Me(e,t)]}),e.version?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,$.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:Ne(e,t)}),e.source===`bundled`?(0,$.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}):null,(0,$.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,$.jsx)(I,{type:`button`,variant:`secondary`,disabled:i!==null,onClick:()=>void h(),className:`shrink-0 py-1.5 text-xs`,children:i===`toggle`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(F,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):p?t.builtinToggleDisable:t.builtinToggleEnable})]}),o?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:o}):null,u?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null,e.source===`bundled`?null:(0,$.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,$.jsxs)(I,{type:`button`,variant:`ghost`,disabled:i!==null,onClick:()=>void g(),className:`text-danger hover:bg-danger-soft hover:text-danger`,children:[i===`uninstall`?(0,$.jsx)(F,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(R,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceUninstall]})})]}),e.hasUi&&(_.length>0||v.length>0||E.length>0)?(0,$.jsxs)(`section`,{className:`mt-8`,children:[(0,$.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,$.jsx)(Le,{template:t.badgePages,count:_.length,hidden:_.length===0}),(0,$.jsx)(Le,{template:t.badgeSettings,count:v.length,hidden:v.length===0}),(0,$.jsx)(Le,{template:t.badgeWidgets,count:E.length,hidden:E.length===0})]})]}):null,N(e)&&(j||M)?(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[j?(0,$.jsxs)(s,{to:j,onClick:n,className:m(`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,$.jsx)(l,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,M?(0,$.jsxs)(s,{to:M,onClick:n,className:m(`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,$.jsx)(q,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,$.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function Le(e){let t=(0,ue.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,$.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 Re(){let e=(0,ue.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:de,"aria-busy":`true`,children:Array.from({length:6},ze)}),e[0]=t):t=e[0],t}function ze(e,t){return(0,$.jsx)(z,{className:`h-32 rounded-xl`},t)}function Be(e){let t=(0,ue.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.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,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{Ae 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-Bwv-AOYl.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-CXjjpXVx.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-Bwv-AOYl.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-BP9C0kH3.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 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./automations-workspace-DdopDyED.js";var r=e(),i=t();function a(){let e=(0,r.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsx)(n,{}),e[0]=t):t=e[0],t}export{a as AutomationsPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./automations-workspace-BVTP3pzt.js";var r=e(),i=t();function a(){let e=(0,r.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsx)(n,{}),e[0]=t):t=e[0],t}export{a as AutomationsPage};