@xopcai/xopc 0.0.340 → 0.0.341

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 (110) 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-CZsW4B_4.js → agent-avatar-dicebear-BLPcg31f.js} +1 -1
  4. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C6lTld5j.js +1 -0
  5. package/dist/gateway/static/root/assets/{agent-plugin-dialog-DPil7wFb.js → agent-plugin-dialog-C4tkmkNX.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agents-DXcxDhxl.js → agents-CfnoU72e.js} +3 -3
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-B6_Ocd3H.js → app-management-settings-panel-D1t5R8Nw.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-CYk3wLnQ.js → appearance-settings-AEXbf39m.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-DOteYBc9.js → apps-page-BBlltMmy.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-Cq8nfXI4.js → archive-plugin-Dn0-Buj5.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-D3dSY_dy.js → automations-page-BSra2qfj.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-workspace-DuULlur3.js → automations-workspace-wN4UZK_t.js} +1 -1
  13. package/dist/gateway/static/root/assets/{binary-plugins-BKqt6Et6.js → binary-plugins-Dot1Il-Y.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-H3ijAjys.js → block-editor-CDcC8LCq.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-automations-page-CjIhwapc.js → browser-automations-page-CAUS0Ri8.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-settings-page-DvMsxdHZ.js → browser-settings-page-DXgm5Ckn.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capabilities-page-CM55DJos.js → capabilities-page-CADE2fFw.js} +2 -2
  18. package/dist/gateway/static/root/assets/{capabilities-settings-panel-3kh-Ox8d.js → capabilities-settings-panel-BVA9R5lZ.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capability-header-actions-DRdadVwO.js → capability-header-actions-BJNo9stz.js} +1 -1
  20. package/dist/gateway/static/root/assets/{channels-BU6w4j04.js → channels-Do21a722.js} +1 -1
  21. package/dist/gateway/static/root/assets/{chat-terminal-dock-bMULpQTT.js → chat-terminal-dock-kdmj_0as.js} +1 -1
  22. package/dist/gateway/static/root/assets/computer-settings-page-0eV1PD7w.js +1 -0
  23. package/dist/gateway/static/root/assets/{connector-service-page-f6kDBxXv.js → connector-service-page-CfoHye-I.js} +1 -1
  24. package/dist/gateway/static/root/assets/{connectors-page-BZ2oIRzn.js → connectors-page-Db1Y7qF-.js} +1 -1
  25. package/dist/gateway/static/root/assets/{date-picker-BxODmHib.js → date-picker-Cos4-ejW.js} +1 -1
  26. package/dist/gateway/static/root/assets/{dependency-picker-BNPg7CKM.js → dependency-picker-BPwj_jHy.js} +1 -1
  27. package/dist/gateway/static/root/assets/{desktop-pet-I6v0yXqp.js → desktop-pet-DEuqqeV7.js} +1 -1
  28. package/dist/gateway/static/root/assets/{desktop-pet-settings-tSuk-nRY.js → desktop-pet-settings-CjBMcLuI.js} +1 -1
  29. package/dist/gateway/static/root/assets/{device-pairing-wizard-Dka3NDC5.js → device-pairing-wizard-BsqwXeyv.js} +1 -1
  30. package/dist/gateway/static/root/assets/{directory-picker-path-field-BvrnQNVH.js → directory-picker-path-field-CcGJupzB.js} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-debug-page-BU56INhZ.js → extension-debug-page-BK0gkhEA.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-page-DQu5R6aV.js → extension-page-BjfzKvd3.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-settings-page-oL7xkRyC.js → extension-settings-page-xqe5mUAc.js} +1 -1
  34. package/dist/gateway/static/root/assets/{gateway-settings-Kp84CfNh.js → gateway-settings-C07o7J3o.js} +1 -1
  35. package/dist/gateway/static/root/assets/{home-page-CtjDNSNA.js → home-page-a92Q8Na2.js} +1 -1
  36. package/dist/gateway/static/root/assets/{imports-page-CKj_w0ri.js → imports-page-BMiS5gUB.js} +1 -1
  37. package/dist/gateway/static/root/assets/index-CJRGgrw3.js +106 -0
  38. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BUqFy1Mk.js → keyboard-shortcuts-settings-BTOmULWn.js} +1 -1
  39. package/dist/gateway/static/root/assets/{local-app-workbench-page-Uo5UKdF8.js → local-app-workbench-page-EwMSmvUp.js} +1 -1
  40. package/dist/gateway/static/root/assets/{local-apps-page-DoxtxoTl.js → local-apps-page-gicbE8bt.js} +1 -1
  41. package/dist/gateway/static/root/assets/{logs-page-NHrVWElJ.js → logs-page-BBxTvrXn.js} +1 -1
  42. package/dist/gateway/static/root/assets/{management-settings-BDnKvfCl.js → management-settings-CcEPCLdK.js} +1 -1
  43. package/dist/gateway/static/root/assets/{media-plugins-Gt-PA4Fe.js → media-plugins-1hJztT1f.js} +1 -1
  44. package/dist/gateway/static/root/assets/{note-detail-panel-ddFcoIGv.js → note-detail-panel-LcJBf6gK.js} +3 -3
  45. package/dist/gateway/static/root/assets/{notes-page-DHY9KaXz.js → notes-page-BaTCRZLb.js} +1 -1
  46. package/dist/gateway/static/root/assets/{page-context-capture-button-CZ-NyERX.js → page-context-capture-button-yJUYnJxT.js} +1 -1
  47. package/dist/gateway/static/root/assets/{page-tabs-7u-lmA1o.js → page-tabs-BM7TwlkM.js} +1 -1
  48. package/dist/gateway/static/root/assets/{preview-open-alternatives-Bolgk7cf.js → preview-open-alternatives-C8ewCNje.js} +1 -1
  49. package/dist/gateway/static/root/assets/{product-open-page-CJEViLcx.js → product-open-page-CRx7HKvw.js} +1 -1
  50. package/dist/gateway/static/root/assets/{project-detail-page-BcikJ4wu.js → project-detail-page-CSh8kKw8.js} +1 -1
  51. package/dist/gateway/static/root/assets/{projects-page-DFZXCRc2.js → projects-page-DYwOgWaC.js} +1 -1
  52. package/dist/gateway/static/root/assets/{remote-access-hub-Dr2FLBo-.js → remote-access-hub-B8ApF5IX.js} +1 -1
  53. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BKus_7qQ.js → runtime-tools-settings-panel-DOB15s5m.js} +1 -1
  54. package/dist/gateway/static/root/assets/{scenes-page-Sp5hozOY.js → scenes-page-DqhxjqAy.js} +1 -1
  55. package/dist/gateway/static/root/assets/{schema-form-DvkI2pYT.js → schema-form-DchPlBrp.js} +1 -1
  56. package/dist/gateway/static/root/assets/{sessions-page-Cm4j_l7t.js → sessions-page-BcnoQbIP.js} +1 -1
  57. package/dist/gateway/static/root/assets/settings-advanced-gate-Cedcl54F.js +1 -0
  58. package/dist/gateway/static/root/assets/{settings-form-section-BzC6oYCR.js → settings-form-section-UlkZDGLU.js} +1 -1
  59. package/dist/gateway/static/root/assets/{settings-page-DpEe6N0D.js → settings-page-PYnr6mlX.js} +1 -1
  60. package/dist/gateway/static/root/assets/{setup-status-panel-CfuLya7v.js → setup-status-panel-xp2jQuPa.js} +1 -1
  61. package/dist/gateway/static/root/assets/{share-preview-page-DAE82vq9.js → share-preview-page-B0jqVHIE.js} +1 -1
  62. package/dist/gateway/static/root/assets/{shares-settings-Bqkvdt3m.js → shares-settings-BnRfPQfC.js} +1 -1
  63. package/dist/gateway/static/root/assets/{skill-api-DkZFVXn8.js → skill-api-DgwnV477.js} +1 -1
  64. package/dist/gateway/static/root/assets/{skill-reload-api-rA2myUNh.js → skill-reload-api-zai_s2F8.js} +1 -1
  65. package/dist/gateway/static/root/assets/{skills-page-CrTKXe6r.js → skills-page-BYAE6Al2.js} +1 -1
  66. package/dist/gateway/static/root/assets/{system-settings-panel-BWVB47be.js → system-settings-panel-eEK7Mm70.js} +1 -1
  67. package/dist/gateway/static/root/assets/{task-detail-page-DcsgbSjp.js → task-detail-page-BK82L-MC.js} +1 -1
  68. package/dist/gateway/static/root/assets/{tunnel-api-D1I9v9nz.js → tunnel-api-Cty9Iw8k.js} +1 -1
  69. package/dist/gateway/static/root/assets/{usage-page-DyKTK2iS.js → usage-page-C3ZO6KNv.js} +1 -1
  70. package/dist/gateway/static/root/assets/{use-autosave-G5bltEoh.js → use-autosave-EEUVQbRp.js} +1 -1
  71. package/dist/gateway/static/root/assets/{user-model-page-7tObyrXy.js → user-model-page-CT_RNLbB.js} +1 -1
  72. package/dist/gateway/static/root/assets/{voice-api-key-field-C2Q5SXkb.js → voice-api-key-field-DTmACeYO.js} +1 -1
  73. package/dist/gateway/static/root/assets/{work-discovery-overlay-J-w4XEEK.js → work-discovery-overlay-C9guuKGB.js} +1 -1
  74. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CmZCSCBe.js → workflow-run-setup-panel-BjGFnWIF.js} +1 -1
  75. package/dist/gateway/static/root/assets/{workflows-page-DcXyKH2p.js → workflows-page-B1uzFMKj.js} +1 -1
  76. package/dist/gateway/static/root/index.html +1 -1
  77. package/dist/package.js +1 -1
  78. package/dist/src/agent/agent-manager.js +3 -3
  79. package/dist/src/agent/background-review/run-background-review.js +1 -1
  80. package/dist/src/agent/embedded/current-turn-images.d.ts +4 -0
  81. package/dist/src/agent/embedded/current-turn-images.js +22 -0
  82. package/dist/src/agent/embedded/model-runtime.js +1 -1
  83. package/dist/src/agent/embedded/run-for-session.js +1 -1
  84. package/dist/src/agent/embedded/run-turn.js +15 -3
  85. package/dist/src/agent/image/tool-model-config.js +1 -1
  86. package/dist/src/agent/service.js +2 -2
  87. package/dist/src/agent/session/session-inspector.js +1 -1
  88. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  89. package/dist/src/ai-assist/text-assist.js +1 -1
  90. package/dist/src/auth/credentials.js +1 -1
  91. package/dist/src/auth/sync-provider-auth.js +1 -1
  92. package/dist/src/cli/commands/doctor/checks/provider-auth.js +2 -2
  93. package/dist/src/computer/runtime.js +1 -1
  94. package/dist/src/config/index.js +2 -2
  95. package/dist/src/gateway/hono/routes/models.js +1 -1
  96. package/dist/src/gateway/service.js +2 -2
  97. package/dist/src/home-intelligence/generator.js +1 -1
  98. package/dist/src/notes/service.js +1 -1
  99. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  100. package/dist/src/providers/index.js +2 -2
  101. package/dist/src/providers/register-runtime-providers.js +1 -1
  102. package/dist/src/tui/tui.js +1 -1
  103. package/dist/src/voice/realtime/omniEngine.js +8 -6
  104. package/dist/src/work-discovery/service.js +2 -2
  105. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  106. package/package.json +4 -4
  107. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C_56_X-e.js +0 -1
  108. package/dist/gateway/static/root/assets/computer-settings-page-T4wZrdXv.js +0 -1
  109. package/dist/gateway/static/root/assets/index-b_BtpHlo.js +0 -106
  110. package/dist/gateway/static/root/assets/settings-advanced-gate-CpD6cRcO.js +0 -1
@@ -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"./copy-Dv6d4Dvw.js";import{t as a}from"./messages-DvcSrOiI.js";import{t as o}from"./cn-JdwAhgNB.js";import{a as s,n as c,r as l}from"./locale-store-GbEE8D1I.js";import{a as u,i as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{t as g}from"./copy-to-clipboard-HOJ79TWv.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-CS04eWY9.js";import{t as y}from"./skeleton-BwbyijEw.js";import{i as b,o as x}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as S}from"./electron-env-Dit0bHgy.js";import{Os as C,Ta as w,ol as T}from"./index-b_BtpHlo.js";import{n as E,r as D}from"./settings-page-layout-X1x-2Cp9.js";import{r as O,t as k}from"./settings-form-section-BzC6oYCR.js";import{t as A}from"./settings-loading-skeleton-CAmWMaOT.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,M.useReducer)(w,L),{info:s,loadError:c,actionError:l,copiedField:_,clearDialogOpen:y,clearConfirmChecked:S,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:O,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await g(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:O});n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(A,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=S&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(k,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(T,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:o(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:o(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:o(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,C.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:o(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,C.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(h,{open:y,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(f,{children:[(0,N.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,x)}),(0,N.jsxs)(p,{className:o(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:S,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:o(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(h,{open:D,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(f,{children:[(0,N.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,x)}),(0,N.jsxs)(p,{className:o(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:O,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),O?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await s(l(`/api/migrations/status`))).payload}async function B(){await s(l(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=_(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":`true`,children:[(0,N.jsx)(y,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(y,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),f=u.filter(e=>e.safety===`auto`&&e.status===`planned`),p=d.length>0||u.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:p?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(f.length))})]}),f.length>0&&!p?(0,N.jsx)(v,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=c(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,o=typeof window<`u`?window.electronAPI?.system:void 0;if(!S()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=O(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let s;e[18]===i.title?s=e[19]:(s=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=s);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:o,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==s||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[s,l,u]}),e[24]=s,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./copy-Dv6d4Dvw.js";import{t as a}from"./messages-DvcSrOiI.js";import{t as o}from"./cn-JdwAhgNB.js";import{a as s,n as c,r as l}from"./locale-store-GbEE8D1I.js";import{a as u,i as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{t as g}from"./copy-to-clipboard-HOJ79TWv.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-CS04eWY9.js";import{t as y}from"./skeleton-BwbyijEw.js";import{i as b,o as x}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as S}from"./electron-env-Dit0bHgy.js";import{Os as C,Ta as w,ol as T}from"./index-CJRGgrw3.js";import{n as E,r as D}from"./settings-page-layout-X1x-2Cp9.js";import{r as O,t as k}from"./settings-form-section-UlkZDGLU.js";import{t as A}from"./settings-loading-skeleton-CAmWMaOT.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,M.useReducer)(w,L),{info:s,loadError:c,actionError:l,copiedField:_,clearDialogOpen:y,clearConfirmChecked:S,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:O,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await g(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:O});n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(A,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=S&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(k,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(T,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:o(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:o(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:o(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,C.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:o(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,C.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(h,{open:y,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(f,{children:[(0,N.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,x)}),(0,N.jsxs)(p,{className:o(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:S,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:o(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(h,{open:D,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(f,{children:[(0,N.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,x)}),(0,N.jsxs)(p,{className:o(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:O,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),O?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await s(l(`/api/migrations/status`))).payload}async function B(){await s(l(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=_(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":`true`,children:[(0,N.jsx)(y,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(y,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),f=u.filter(e=>e.safety===`auto`&&e.status===`planned`),p=d.length>0||u.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:p?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(f.length))})]}),f.length>0&&!p?(0,N.jsx)(v,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=c(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,o=typeof window<`u`?window.electronAPI?.system:void 0;if(!S()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=O(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let s;e[18]===i.title?s=e[19]:(s=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=s);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:o,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==s||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[s,l,u]}),e[24]=s,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-0p9PIHRy.js";import{t as o}from"./messages-DvcSrOiI.js";import{t as s}from"./cn-JdwAhgNB.js";import{a as c,n as l,r as u}from"./locale-store-GbEE8D1I.js";import{n as d,r as f}from"./gateway-config-swr-BdBCP9uF.js";import{t as p}from"./skeleton-BwbyijEw.js";import{Co as m,Os as h,So as g,vi as _}from"./index-b_BtpHlo.js";import{n as v,r as y}from"./settings-page-layout-X1x-2Cp9.js";import{t as b}from"./settings-advanced-gate-CpD6cRcO.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await c(u(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await d()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:a}=e,o;t[0]===a?o=t[1]:(o=s(`min-w-0`,a),t[0]=a,t[1]=o);let c;t[2]===n?c=t[3]:(c=n?(0,E.jsx)(`h2`,{className:`mb-2 px-1 text-xs font-medium text-fg-muted`,children:n}):null,t[2]=n,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:i}),t[4]=i,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,E.jsx)(`p`,{className:`mt-2 px-1 text-xs leading-5 text-fg-subtle`,children:r}):null,t[6]=r,t[7]=u);let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,E.jsxs)(`section`,{className:o,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}},porcelain:{light:{canvas:`#f6f0e7`,panel:`#fffcf7`,accent:`#985d4d`,fg:`#352e2a`,muted:`#e8d9cf`},dark:{canvas:`#211c19`,panel:`#2b2420`,accent:`#d4a08c`,fg:`#f3eae1`,muted:`#493a32`}},dawn:{light:{canvas:`#accdec`,panel:`#f8fbff`,accent:`#34363a`,fg:`#262626`,muted:`#e7ebf4`},dark:{canvas:`#172433`,panel:`#253342`,accent:`#d9dde2`,fg:`#f3f6fa`,muted:`#415264`}}};function k(e){let t=(0,S.c)(23),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c={backgroundColor:r},t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[4]=i,t[5]=l);let u;t[6]===a?u=t[7]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[6]=a,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===o?f=t[12]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[11]=o,t[12]=f);let p;t[13]===o?p=t[14]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[13]=o,t[14]=p);let m;t[15]!==c||t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm p-1`,style:c,children:[d,f,p]}),t[15]=c,t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==s||t[21]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[20]=s,t[21]=m,t[22]=h):h=t[22],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`porcelain`,labelKey:`colorSchemePorcelain`},{value:`dawn`,labelKey:`colorSchemeDawn`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(13),t=l(F),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=m(P),a=m(N),c;e[2]===r.colorSchemeTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`min-w-0`,children:(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.colorSchemeTitle})}),e[2]=r.colorSchemeTitle,e[3]=c);let u;e[4]!==r||e[5]!==i||e[6]!==a?(u=j.map(e=>{let{value:t,labelKey:n}=e,o=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:()=>a(t),className:s(`flex flex-col gap-2 rounded-xl bg-surface-hover/25 p-2.5 text-left transition-[background-color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,h.pressCard,o?`bg-surface-active shadow-surface`:`hover:bg-surface-hover/60`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:s(`text-xs font-medium leading-none`,o?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=i,e[6]=a,e[7]=u):u=e[7];let d;e[8]===u?d=e[9]:(d=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-5`,children:u}),e[8]=u,e[9]=d);let f;return e[10]!==c||e[11]!==d?(f=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[c,d]}),e[10]=c,e[11]=d,e[12]=f):f=e[12],f}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(28),t=l(L),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:c,isLoading:u}=f(!0),d=c?.payload?.config,m;e[2]===d?m=e[3]:(m=w(d),e[2]=d,e[3]=m);let h=m,[g,_]=(0,x.useState)(h),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===h?(D=e[5],O=e[6]):(D=()=>_(h),O=[h],e[4]=h,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`min-w-0 text-sm font-medium text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]!==r.activityDetailLevels||e[12]!==A||e[13]!==u||e[14]!==g||e[15]!==v?(M=u?(0,E.jsx)(p,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(i,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(a,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(a,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(a,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=u,e[14]=g,e[15]=v,e[16]=M):M=e[16];let N;e[17]!==j||e[18]!==M?(N=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[j,M]}),e[17]=j,e[18]=M,e[19]=N):N=e[19];let P;e[20]!==r.activityDetailSaveError||e[21]!==r.activityDetailSaving||e[22]!==b||e[23]!==v?(P=b||v?(0,E.jsx)(`p`,{className:s(`text-xs`,b?`text-red-600 dark:text-red-400`:`text-fg-subtle`),children:b?r.activityDetailSaveError:r.activityDetailSaving}):null,e[20]=r.activityDetailSaveError,e[21]=r.activityDetailSaving,e[22]=b,e[23]=v,e[24]=P):P=e[24];let F;return e[25]!==N||e[26]!==P?(F=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3.5 sm:px-5 sm:py-4`,children:[N,P]}),e[25]=N,e[26]=P,e[27]=F):F=e[27],F}function L(e){return e.language}function R(){let e=(0,S.c)(17),t=l(V),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=_(B),a=_(z),s;e[2]===r.showRawToolDataTitle?s=e[3]:(s=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=s);let c;e[4]===r.showRawToolDataDescription?c=e[5]:(c=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=c);let u;e[6]!==s||e[7]!==c?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),e[6]=s,e[7]=c,e[8]=u):u=e[8];let d;e[9]===a?d=e[10]:(d=e=>a(e.target.checked),e[9]=a,e[10]=d);let f;e[11]!==i||e[12]!==d?(f=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f?(p=(0,E.jsx)(`div`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[u,f]})}),e[14]=u,e[15]=f,e[16]=p):p=e[16],p}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(12),t=l(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]===r.pageTitle?i=e[3]:(i=(0,E.jsx)(v,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=i);let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,E.jsx)(D,{children:(0,E.jsx)(g,{variant:`page`,sections:[`language`]})}),e[4]=a):a=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,E.jsxs)(D,{children:[(0,E.jsx)(g,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=s):s=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,E.jsx)(R,{}),e[6]=c):c=e[6];let u;e[7]===r.developerGroupTitle?u=e[8]:(u=(0,E.jsx)(b,{children:(0,E.jsx)(D,{title:r.developerGroupTitle,children:c})}),e[7]=r.developerGroupTitle,e[8]=u);let d;return e[9]!==i||e[10]!==u?(d=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,a,s,u]}),e[9]=i,e[10]=u,e[11]=d):d=e[11],d}function U(e){return e.language}export{H as AppearanceSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-0p9PIHRy.js";import{t as o}from"./messages-DvcSrOiI.js";import{t as s}from"./cn-JdwAhgNB.js";import{a as c,n as l,r as u}from"./locale-store-GbEE8D1I.js";import{n as d,r as f}from"./gateway-config-swr-BdBCP9uF.js";import{t as p}from"./skeleton-BwbyijEw.js";import{Co as m,Os as h,So as g,vi as _}from"./index-CJRGgrw3.js";import{n as v,r as y}from"./settings-page-layout-X1x-2Cp9.js";import{t as b}from"./settings-advanced-gate-Cedcl54F.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await c(u(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await d()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:a}=e,o;t[0]===a?o=t[1]:(o=s(`min-w-0`,a),t[0]=a,t[1]=o);let c;t[2]===n?c=t[3]:(c=n?(0,E.jsx)(`h2`,{className:`mb-2 px-1 text-xs font-medium text-fg-muted`,children:n}):null,t[2]=n,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:i}),t[4]=i,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,E.jsx)(`p`,{className:`mt-2 px-1 text-xs leading-5 text-fg-subtle`,children:r}):null,t[6]=r,t[7]=u);let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,E.jsxs)(`section`,{className:o,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}},porcelain:{light:{canvas:`#f6f0e7`,panel:`#fffcf7`,accent:`#985d4d`,fg:`#352e2a`,muted:`#e8d9cf`},dark:{canvas:`#211c19`,panel:`#2b2420`,accent:`#d4a08c`,fg:`#f3eae1`,muted:`#493a32`}},dawn:{light:{canvas:`#accdec`,panel:`#f8fbff`,accent:`#34363a`,fg:`#262626`,muted:`#e7ebf4`},dark:{canvas:`#172433`,panel:`#253342`,accent:`#d9dde2`,fg:`#f3f6fa`,muted:`#415264`}}};function k(e){let t=(0,S.c)(23),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c={backgroundColor:r},t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[4]=i,t[5]=l);let u;t[6]===a?u=t[7]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[6]=a,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===o?f=t[12]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[11]=o,t[12]=f);let p;t[13]===o?p=t[14]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[13]=o,t[14]=p);let m;t[15]!==c||t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm p-1`,style:c,children:[d,f,p]}),t[15]=c,t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==s||t[21]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[20]=s,t[21]=m,t[22]=h):h=t[22],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`porcelain`,labelKey:`colorSchemePorcelain`},{value:`dawn`,labelKey:`colorSchemeDawn`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(13),t=l(F),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=m(P),a=m(N),c;e[2]===r.colorSchemeTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`min-w-0`,children:(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.colorSchemeTitle})}),e[2]=r.colorSchemeTitle,e[3]=c);let u;e[4]!==r||e[5]!==i||e[6]!==a?(u=j.map(e=>{let{value:t,labelKey:n}=e,o=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:()=>a(t),className:s(`flex flex-col gap-2 rounded-xl bg-surface-hover/25 p-2.5 text-left transition-[background-color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,h.pressCard,o?`bg-surface-active shadow-surface`:`hover:bg-surface-hover/60`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:s(`text-xs font-medium leading-none`,o?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=i,e[6]=a,e[7]=u):u=e[7];let d;e[8]===u?d=e[9]:(d=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-5`,children:u}),e[8]=u,e[9]=d);let f;return e[10]!==c||e[11]!==d?(f=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[c,d]}),e[10]=c,e[11]=d,e[12]=f):f=e[12],f}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(28),t=l(L),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:c,isLoading:u}=f(!0),d=c?.payload?.config,m;e[2]===d?m=e[3]:(m=w(d),e[2]=d,e[3]=m);let h=m,[g,_]=(0,x.useState)(h),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===h?(D=e[5],O=e[6]):(D=()=>_(h),O=[h],e[4]=h,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`min-w-0 text-sm font-medium text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]!==r.activityDetailLevels||e[12]!==A||e[13]!==u||e[14]!==g||e[15]!==v?(M=u?(0,E.jsx)(p,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(i,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(a,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(a,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(a,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=u,e[14]=g,e[15]=v,e[16]=M):M=e[16];let N;e[17]!==j||e[18]!==M?(N=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[j,M]}),e[17]=j,e[18]=M,e[19]=N):N=e[19];let P;e[20]!==r.activityDetailSaveError||e[21]!==r.activityDetailSaving||e[22]!==b||e[23]!==v?(P=b||v?(0,E.jsx)(`p`,{className:s(`text-xs`,b?`text-red-600 dark:text-red-400`:`text-fg-subtle`),children:b?r.activityDetailSaveError:r.activityDetailSaving}):null,e[20]=r.activityDetailSaveError,e[21]=r.activityDetailSaving,e[22]=b,e[23]=v,e[24]=P):P=e[24];let F;return e[25]!==N||e[26]!==P?(F=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3.5 sm:px-5 sm:py-4`,children:[N,P]}),e[25]=N,e[26]=P,e[27]=F):F=e[27],F}function L(e){return e.language}function R(){let e=(0,S.c)(17),t=l(V),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=_(B),a=_(z),s;e[2]===r.showRawToolDataTitle?s=e[3]:(s=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=s);let c;e[4]===r.showRawToolDataDescription?c=e[5]:(c=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=c);let u;e[6]!==s||e[7]!==c?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),e[6]=s,e[7]=c,e[8]=u):u=e[8];let d;e[9]===a?d=e[10]:(d=e=>a(e.target.checked),e[9]=a,e[10]=d);let f;e[11]!==i||e[12]!==d?(f=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f?(p=(0,E.jsx)(`div`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[u,f]})}),e[14]=u,e[15]=f,e[16]=p):p=e[16],p}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(12),t=l(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]===r.pageTitle?i=e[3]:(i=(0,E.jsx)(v,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=i);let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,E.jsx)(D,{children:(0,E.jsx)(g,{variant:`page`,sections:[`language`]})}),e[4]=a):a=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,E.jsxs)(D,{children:[(0,E.jsx)(g,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=s):s=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,E.jsx)(R,{}),e[6]=c):c=e[6];let u;e[7]===r.developerGroupTitle?u=e[8]:(u=(0,E.jsx)(b,{children:(0,E.jsx)(D,{title:r.developerGroupTitle,children:c})}),e[7]=r.developerGroupTitle,e[8]=u);let d;return e[9]!==i||e[10]!==u?(d=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,a,s,u]}),e[9]=i,e[10]=u,e[11]=d):d=e[11],d}function U(e){return e.language}export{H as AppearanceSettingsPanel};
@@ -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{g as i,t as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./ellipsis-0k4rZLoy.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./markdown-view-DtEVIWB3.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{t as d}from"./plus-Q2yW6OE7.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-DvcSrOiI.js";import{t as m}from"./cn-JdwAhgNB.js";import{c as h,i as g,n as _,r as v}from"./locale-store-GbEE8D1I.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{t as D}from"./button-CS04eWY9.js";import{o as O}from"./gateway-realtime-MiR9DJIf.js";import{t as k}from"./skeleton-BwbyijEw.js";import{Bn as A,Fc as j,Fn as M,In as N,Ln as P,Nc as ee,Os as F,Pu as I,Rn as L,Ta as R,Wu as z,_o as B,do as V,fc as te,fo as H,ho as U,mo as W,ol as G,pc as ne,po as K,td as re}from"./index-b_BtpHlo.js";import{n as q,t as J}from"./capability-header-actions-DRdadVwO.js";import{t as Y}from"./page-tabs-7u-lmA1o.js";import{t as ie}from"./agent-plugin-dialog-DPil7wFb.js";import{t as X}from"./capability-icon-BYm2-nS-.js";var Z=e(t(),1),ae=n();function Q(e){return e===`builtin`||e===`user`?e:`marketplace`}async function oe(e=``){let t=await g(v(`/api/marketplace${e.trim()?`?q=${encodeURIComponent(e.trim())}`:``}`),{cache:`no-store`});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!Array.isArray(n.extensions))throw Error(n.error??`Invalid response`);return n.extensions}async function se(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 ce(e){let t=await g(v(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function le(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 se(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function ue(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 se(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function de(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 se(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var $=r();function fe(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var pe={debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function me({className:e,query:t}){let n=p(_(e=>e.language)).extensionsPage,r=h(e=>!!e.conversationId),i=H(),{mutate:a}=T(),[o,s]=(0,Z.useReducer)(R,pe),{debounced:c,detailPkg:l,rowBusy:d,actionError:f,restartHint:g}=o,v=r?`marketplace-${c}`:null;(0,Z.useEffect)(()=>{let e=window.setTimeout(()=>s({type:`patch`,patch:{debounced:t.trim()}}),300);return()=>window.clearTimeout(e)},[t]);let{data:y,isLoading:b,error:x}=E(v,()=>oe(c),{revalidateOnFocus:!1}),S=(0,Z.useCallback)(()=>{a(`gateway-extensions-list`),O()},[a]),C=(0,Z.useCallback)(async(e,t)=>{s({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await le({name:e,overwrite:t});S(),r.requiresGatewayRestart&&s({type:`patch`,patch:{restartHint:n.marketplaceRestartHint}})}catch(e){throw s({type:`patch`,patch:{actionError:e instanceof Error?e.message:n.marketplaceInstallFailed}}),e}finally{s({type:`patch`,patch:{rowBusy:null}})}},[n.marketplaceInstallFailed,n.marketplaceRestartHint,S]),w=(0,Z.useCallback)(async e=>{s({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let t=await de(e);S(),t.requiresGatewayRestart&&s({type:`patch`,patch:{restartHint:n.marketplaceRestartHint}})}catch(e){throw s({type:`patch`,patch:{actionError:e instanceof Error?e.message:n.marketplaceUninstallFailed}}),e}finally{s({type:`patch`,patch:{rowBusy:null}})}},[n.marketplaceRestartHint,n.marketplaceUninstallFailed,S]),D=y??[];return(0,$.jsxs)(`div`,{className:m(`flex flex-col gap-4`,e),children:[x?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:x instanceof Error?x.message:n.marketplaceLoadFailed}):null,f?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}):null,g?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:g}):null,b&&!y?(0,$.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":n.marketplaceLoading,children:[0,1,2].map(e=>(0,$.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,$.jsx)(k,{className:`h-5 w-40`}),(0,$.jsx)(k,{className:`h-4 w-full max-w-xl`}),(0,$.jsx)(k,{className:`h-4 w-2/3 max-w-md`})]}),(0,$.jsx)(k,{className:`h-8 w-20`})]})},e))}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-3`,children:D.length===0?(0,$.jsx)(`li`,{className:`text-sm text-fg-muted`,children:n.marketplaceEmpty}):D.map(e=>{let t=fe(i,e.id),r=d===e.id;return(0,$.jsx)(`li`,{className:`list-none`,children:(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${n.marketplaceDetailTitle}`,onClick:()=>s({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),s({type:`patch`,patch:{detailPkg:e.id}}))},className:m(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,$.jsx)(X,{iconUrl:e.branding?.iconUrl,fallback:G}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,$.jsx)(I,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,$.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,$.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,$.jsx)(G,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,$.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:t===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:n.marketplaceBuiltin}):t===`user`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:n.marketplaceInstalled}),(0,$.jsxs)(`button`,{type:`button`,disabled:r,onClick:()=>{window.confirm(n.marketplaceUninstallConfirm)&&w(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:[r?(0,$.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(ne,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),n.marketplaceUninstall]})]}):(0,$.jsx)(`button`,{type:`button`,onClick:()=>s({type:`patch`,patch:{detailPkg:e.id}}),className:m(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:n.marketplaceReview})})]})},e.id)})}),l?(0,$.jsx)(he,{packageName:l,copy:n,extensions:i,onClose:()=>s({type:`patch`,patch:{detailPkg:null}}),onInstall:C,onUninstall:w}):null]})}function he(e){let t=(0,ae.c)(93),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:s,onUninstall:c}=e,[d,p]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(!1),v=h(be)?`ext-mp-detail-${n}`:null,b;t[0]===n?b=t[1]:(b=async()=>ce(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:O,isLoading:A}=E(v,b,T),j;t[3]!==i||t[4]!==n?(j=fe(i,n),t[3]=i,t[4]=n,t[5]=j):j=t[5];let M=j,N=M===`user`,P=D?.manifest?.permissions,F,I,L,R,z,B,V,H,U,W,G,K;if(t[6]!==r||t[7]!==D||t[8]!==O||t[9]!==i||t[10]!==M||t[11]!==A||t[12]!==o||t[13]!==n||t[14]!==P||t[15]!==g){B=Symbol.for(`react.early_return_sentinel`);bb0:{let e=P&&typeof P==`object`&&!Array.isArray(P)?Object.entries(P):[],a;t[28]!==r||t[29]!==D?(a=D?.readme?.trim()||(D?.description?.trim()?`### ${D.name}\n\n${D.description}`:`*${r.marketplaceNoReadme}*`),t[28]=r,t[29]=D,t[30]=a):a=t[30];let s=a;if(D?.format===`agent-plugin`){let e;if(t[31]!==D||t[32]!==i){let n;t[34]===D?n=t[35]:(n=e=>e.pluginId===D.manifest?.name,t[34]=D,t[35]=n),e=i.find(n),t[31]=D,t[32]=i,t[33]=e}else e=t[33];let r=`store:${n}`,a;t[36]!==o||t[37]!==e||t[38]!==r?(a=(0,$.jsx)(ie,{extension:e,initialSource:r,onClose:o}),t[36]=o,t[37]=e,t[38]=r,t[39]=a):a=t[39],B=a;break bb0}L=w,R=!0,t[40]===o?z=t[41]:(z=e=>!e&&o(),t[40]=o,t[41]=z),I=x,t[42]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[42]=K):K=t[42],F=S,U=`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`,W=ye;let c;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(re,{className:`size-5`}),t[43]=c):c=t[43];let u;t[44]!==r.detailBack||t[45]!==o?(u=(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":r.detailBack,children:c}),t[44]=r.detailBack,t[45]=o,t[46]=u):u=t[46];let d;t[47]===r.marketplaceDetailTitle?d=t[48]:(d=(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[47]=r.marketplaceDetailTitle,t[48]=d);let p;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(f,{className:`size-5`}),t[49]=p):p=t[49];let m;t[50]!==r.detailClose||t[51]!==o?(m=(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":r.detailClose,children:p}),t[50]=r.detailClose,t[51]=o,t[52]=m):m=t[52],t[53]!==u||t[54]!==d||t[55]!==m?(G=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[u,d,m]}),t[53]=u,t[54]=d,t[55]=m,t[56]=G):G=t[56],V=`min-h-0 flex-1 overflow-y-auto p-5`,H=A&&!D?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,$.jsx)(k,{className:`h-6 w-48`}),(0,$.jsx)(k,{className:`h-4 w-28`}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(k,{className:`h-12`}),(0,$.jsx)(k,{className:`h-12`})]}),(0,$.jsx)(k,{className:`h-28 w-full`}),(0,$.jsx)(k,{className:`h-36 w-full`})]}):O?(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:r.marketplaceDetailLoadFailed}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:O instanceof Error?O.message:r.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:r.marketplaceAuthor}),(0,$.jsx)(`dd`,{children:D.author.username})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,$.jsx)(`dd`,{children:D.latestVersion.version})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,$.jsx)(`dd`,{children:D.downloads})]})]}),M===`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)(ee,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,$.jsx)(te,{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?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:D.installability.available?r.marketplaceCodeRisk:D.installability.reason??r.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:r.marketplaceIntegrity}),(0,$.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:r.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:r.marketplacePermissions}),e.length>0?(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ve)}):(0,$.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(D.packageSummary?.lifecycleScripts.length??0)>0?(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.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:r.marketplaceRiskConfirm})]})]}):null]}),D.readme?.trim()?(0,$.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,$.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,$.jsx)(l,{content:s})})]}):null}t[6]=r,t[7]=D,t[8]=O,t[9]=i,t[10]=M,t[11]=A,t[12]=o,t[13]=n,t[14]=P,t[15]=g,t[16]=F,t[17]=I,t[18]=L,t[19]=R,t[20]=z,t[21]=B,t[22]=V,t[23]=H,t[24]=U,t[25]=W,t[26]=G,t[27]=K}else F=t[16],I=t[17],L=t[18],R=t[19],z=t[20],B=t[21],V=t[22],H=t[23],U=t[24],W=t[25],G=t[26],K=t[27];if(B!==Symbol.for(`react.early_return_sentinel`))return B;let q;t[57]!==V||t[58]!==H?(q=(0,$.jsx)(`div`,{className:V,children:H}),t[57]=V,t[58]=H,t[59]=q):q=t[59];let J;t[60]!==d||t[61]!==r.marketplaceBuiltinGoBuiltin||t[62]!==r.marketplaceBuiltinManageHint||t[63]!==r.marketplaceInstall||t[64]!==r.marketplaceReinstall||t[65]!==r.marketplaceReinstallConfirm||t[66]!==r.marketplaceUninstall||t[67]!==r.marketplaceUninstallConfirm||t[68]!==D||t[69]!==M||t[70]!==o||t[71]!==s||t[72]!==c||t[73]!==n||t[74]!==g||t[75]!==N?(J=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:M===`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:r.marketplaceBuiltinManageHint}),(0,$.jsx)(a,{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:r.marketplaceBuiltinGoBuiltin})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,disabled:d||!D.installability.available||!g,onClick:()=>{N&&!window.confirm(r.marketplaceReinstallConfirm)||(p(!0),s(n,N).catch(_e).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)(u,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,N?r.marketplaceReinstall:r.marketplaceInstall]}),N?(0,$.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(p(!0),c(n).then(()=>o()).catch(ge).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)(ne,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[60]=d,t[61]=r.marketplaceBuiltinGoBuiltin,t[62]=r.marketplaceBuiltinManageHint,t[63]=r.marketplaceInstall,t[64]=r.marketplaceReinstall,t[65]=r.marketplaceReinstallConfirm,t[66]=r.marketplaceUninstall,t[67]=r.marketplaceUninstallConfirm,t[68]=D,t[69]=M,t[70]=o,t[71]=s,t[72]=c,t[73]=n,t[74]=g,t[75]=N,t[76]=J):J=t[76];let Y;t[77]!==F||t[78]!==q||t[79]!==J||t[80]!==U||t[81]!==W||t[82]!==G?(Y=(0,$.jsxs)(F,{className:U,onOpenAutoFocus:W,children:[G,q,J]}),t[77]=F,t[78]=q,t[79]=J,t[80]=U,t[81]=W,t[82]=G,t[83]=Y):Y=t[83];let X;t[84]!==I||t[85]!==Y||t[86]!==K?(X=(0,$.jsxs)(I,{children:[K,Y]}),t[84]=I,t[85]=Y,t[86]=K,t[87]=X):X=t[87];let Q;return t[88]!==L||t[89]!==R||t[90]!==z||t[91]!==X?(Q=(0,$.jsx)(L,{defaultOpen:R,onOpenChange:z,children:X}),t[88]=L,t[89]=R,t[90]=z,t[91]=X,t[92]=Q):Q=t[92],Q}function ge(){}function _e(){}function ve(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 ye(e){return e.preventDefault()}function be(e){return!!e.conversationId}function xe({embedded:e=!1,onHeaderActionChange:t}){let n=_(e=>e.language),r=p(n),o=B(e=>e.setPageHeader),c=B(e=>e.clearPageHeader),l=H(),u=K(),[f,h]=i(),g=Q(f.get(`tab`)),v=f.get(`q`)??``,[y,b]=(0,Z.useState)(g),[x,S]=(0,Z.useState)(v),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(!1),O=f.toString(),k=(0,Z.useRef)(O);if(k.current!==O){k.current=O;let e=Q(f.get(`tab`)),t=f.get(`q`)??``;b(t=>t===e?t:e),S(e=>e===t?e:t)}(0,Z.useEffect)(()=>{h(e=>{let t=new URLSearchParams(e),n=x.trim();return n?t.set(`q`,n):t.delete(`q`),y===`marketplace`?t.delete(`tab`):t.set(`tab`,y),t.toString()===e.toString()?e:t},{replace:!0})},[y,x,h]);let j=(0,Z.useMemo)(()=>l.filter(e=>e.source===`bundled`),[l]),ee=(0,Z.useMemo)(()=>l.filter(e=>e.source!==`bundled`),[l]),I=y===`builtin`?j:ee,R=(0,Z.useMemo)(()=>{let e=x.trim().toLowerCase(),t=I;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,n):e.hasUi?-1:1)},[I,x,n]);(0,Z.useEffect)(()=>{w(e=>{if(!e)return e;let t=l.find(t=>t.id===e.id);return t?Se(e)===Se(t)&&e.active===t.active&&JSON.stringify(e)===JSON.stringify(t)?e:t:null})},[l]);let V=(0,Z.useMemo)(()=>({searchLabel:y===`marketplace`?r.extensionsPage.marketplaceSearchPlaceholder:r.extensionsPage.searchPlaceholder,search:(0,$.jsx)(q,{value:x,onChange:S,placeholder:y===`marketplace`?r.extensionsPage.marketplaceSearchPlaceholder:r.extensionsPage.searchPlaceholder}),overflow:(0,$.jsxs)(L,{children:[(0,$.jsx)(A,{asChild:!0,children:(0,$.jsx)(D,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":r.capabilitiesHub.moreActions,title:r.capabilitiesHub.moreActions,children:(0,$.jsx)(s,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(P,{children:(0,$.jsxs)(M,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,$.jsxs)(N,{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`,F.transition),onSelect:()=>E(!0),children:[(0,$.jsx)(d,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),n.startsWith(`zh`)?`安装插件`:`Install plugin`]}),(0,$.jsx)(N,{asChild:!0,children:(0,$.jsxs)(a,{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`,F.transition),children:[(0,$.jsx)(z,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r.extensionsPage.openLocalApps]})})]})})]}),primary:(0,$.jsx)(D,{asChild:!0,variant:`primary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(a,{to:`/local-apps/new`,"aria-label":r.extensionsPage.createLocalApp,children:[(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:r.extensionsPage.createLocalApp})]})})}),[n,r.capabilitiesHub.moreActions,r.extensionsPage,y,x]);if((0,Z.useLayoutEffect)(()=>e?(t?.(V),()=>t?.(null)):(o({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:r.extensionsPage.title})}),end:(0,$.jsx)(J,{contribution:V})}),()=>c()),[c,e,V,r.extensionsPage.title,t,o]),u&&y!==`marketplace`)return(0,$.jsx)(ke,{});let te=[{id:`marketplace`,label:r.extensionsPage.tabMarketplace},{id:`builtin`,label:r.extensionsPage.tabBuiltin,count:j.length},{id:`user`,label:r.extensionsPage.tabUser,count:ee.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`,e?`pb-7 pt-3 lg:pb-9 lg:pt-4`:`py-7 lg:py-9`),children:[(0,$.jsx)(`div`,{className:`mb-6 border-b border-edge-subtle pb-3`,children:(0,$.jsx)(Y,{items:te,activeTab:y,onChange:b,ariaLabel:r.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`})}),y===`marketplace`?(0,$.jsx)(me,{query:x}):y===`builtin`&&j.length===0?(0,$.jsx)(je,{message:r.extensionsPage.emptyBuiltin}):y===`user`&&ee.length===0?(0,$.jsx)(je,{message:r.extensionsPage.emptyUser}):R.length===0?(0,$.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:r.extensionsPage.noSearchResults}):(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:R.map(e=>(0,$.jsx)(Ee,{extension:e,copy:r.extensionsPage,showSourceBadge:y===`user`,onOpen:()=>w(e)},e.id))})]}),C?C.format===`agent-plugin`?(0,$.jsx)(ie,{extension:C,onClose:()=>w(null)},C.id):(0,$.jsx)(De,{extension:C,copy:r.extensionsPage,onClose:()=>w(null)},C.id):null,T?(0,$.jsx)(ie,{onClose:()=>E(!1)}):null]})}function Se(e){return e.activationEligible??e.active}function Ce(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function we(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function Te(e,t){let n=Se(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function Ee(e){let t=(0,ae.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,s;t[0]===n?s=t[1]:(s=Se(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=m(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=u):u=t[2];let f=n.name||n.id,p;t[3]===f?p=t[4]:(p=f.charAt(0).toUpperCase(),t[3]=f,t[4]=p);let h;t[5]===p?h=t[6]:(h=(0,$.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:p}),t[5]=p,t[6]=h);let g;t[7]===n.name?g=t[8]:(g=(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=g);let _;t[9]===n.version?_=t[10]:(_=n.version?(0,$.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=_);let v;t[11]!==g||t[12]!==_?(v=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==r.statusEnabled||t[15]!==c?(y=c?(0,$.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,$.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,$.jsx)(d,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==r.cardNoDescription||t[21]!==n.description?(x=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=x):x=t[22];let S;t[23]===x?S=t[24]:(S=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:x}),t[23]=x,t[24]=S);let C=n.format===`agent-plugin`?`Agent Plugin`:n.hasUi?r.badgeKindUi:r.badgeKindBackend,w;t[25]!==C||t[26]!==l?(w=(0,$.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:C}),t[25]=C,t[26]=l,t[27]=w):w=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,$.jsx)(`span`,{title:Ce(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:we(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=T):T=t[31];let E;t[32]!==w||t[33]!==T?(E=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[w,T]}),t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==b||t[36]!==S||t[37]!==E?(D=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,S,E]}),t[35]=b,t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==h?(O=(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[h,D]}),t[39]=D,t[40]=h,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,$.jsx)(`button`,{type:`button`,onClick:a,className:u,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function De({extension:e,copy:t,onClose:n}){let{mutate:r}=T(),[i,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(null),[d,p]=(0,Z.useState)(!1),h=e.activationEligible===!0,g=(0,Z.useCallback)(async()=>{l(null),p(!1),o(`toggle`);try{let{requiresGatewayRestart:t}=await ue({extensionId:e.id,enabled:!h});await r(`gateway-extensions-list`),O(),p(t)}catch(e){l(e instanceof Error?e.message:t.extensionToggleFailed)}finally{o(null)}},[h,t.extensionToggleFailed,e.id,r]),_=(0,Z.useCallback)(async()=>{if(!(e.source===`bundled`||!window.confirm(t.extensionUninstallConfirm))){l(null),p(!1),o(`uninstall`);try{await de(e.id),await r(`gateway-extensions-list`),O(),n()}catch(e){l(e instanceof Error?e.message:t.marketplaceUninstallFailed),o(null)}}},[t.extensionUninstallConfirm,t.marketplaceUninstallFailed,e.id,e.source,r,n]),v=e.ui?.contributions?.pages??[],E=e.ui?.contributions?.settingsPanels??[],k=e.ui?.contributions?.chatWidgets??[],A=v.find(e=>e.showInNav)??v[0],M=E[0],N=A?V(e.id,A):null,P=M?`/settings/ext/${e.id}/${M.id}`:e.hasConfigSchema||W(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)(re,{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,` `,Ce(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:Te(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)(D,{type:`button`,variant:`secondary`,disabled:i!==null,onClick:()=>void g(),className:`shrink-0 py-1.5 text-xs`,children:i===`toggle`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(u,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):h?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,d?(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)(D,{type:`button`,variant:`ghost`,disabled:i!==null,onClick:()=>void _(),className:`text-danger hover:bg-danger-soft hover:text-danger`,children:[i===`uninstall`?(0,$.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceUninstall]})})]}),e.hasUi&&(v.length>0||E.length>0||k.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)(Oe,{template:t.badgePages,count:v.length,hidden:v.length===0}),(0,$.jsx)(Oe,{template:t.badgeSettings,count:E.length,hidden:E.length===0}),(0,$.jsx)(Oe,{template:t.badgeWidgets,count:k.length,hidden:k.length===0})]})]}):null,U(e)&&(N||P)?(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[N?(0,$.jsxs)(a,{to:N,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)(c,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,P?(0,$.jsxs)(a,{to:P,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)(j,{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 Oe(e){let t=(0,ae.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 ke(){let e=(0,ae.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,$.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,$.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,$.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(Ae)})]})}),e[4]=a):a=e[4],a}function Ae(e){return(0,$.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function je(e){let t=(0,ae.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{xe 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{g as i,t as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./ellipsis-0k4rZLoy.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./markdown-view-DtEVIWB3.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{t as d}from"./plus-Q2yW6OE7.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-DvcSrOiI.js";import{t as m}from"./cn-JdwAhgNB.js";import{c as h,i as g,n as _,r as v}from"./locale-store-GbEE8D1I.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{t as D}from"./button-CS04eWY9.js";import{o as O}from"./gateway-realtime-MiR9DJIf.js";import{t as k}from"./skeleton-BwbyijEw.js";import{Bn as A,Fc as j,Fn as M,In as N,Ln as P,Nc as ee,Os as F,Pu as I,Rn as L,Ta as R,Wu as z,_o as B,do as V,fc as te,fo as H,ho as U,mo as W,ol as G,pc as ne,po as K,td as re}from"./index-CJRGgrw3.js";import{n as q,t as J}from"./capability-header-actions-BJNo9stz.js";import{t as Y}from"./page-tabs-BM7TwlkM.js";import{t as ie}from"./agent-plugin-dialog-C4tkmkNX.js";import{t as X}from"./capability-icon-BYm2-nS-.js";var Z=e(t(),1),ae=n();function Q(e){return e===`builtin`||e===`user`?e:`marketplace`}async function oe(e=``){let t=await g(v(`/api/marketplace${e.trim()?`?q=${encodeURIComponent(e.trim())}`:``}`),{cache:`no-store`});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!Array.isArray(n.extensions))throw Error(n.error??`Invalid response`);return n.extensions}async function se(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 ce(e){let t=await g(v(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function le(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 se(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function ue(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 se(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function de(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 se(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var $=r();function fe(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var pe={debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function me({className:e,query:t}){let n=p(_(e=>e.language)).extensionsPage,r=h(e=>!!e.conversationId),i=H(),{mutate:a}=T(),[o,s]=(0,Z.useReducer)(R,pe),{debounced:c,detailPkg:l,rowBusy:d,actionError:f,restartHint:g}=o,v=r?`marketplace-${c}`:null;(0,Z.useEffect)(()=>{let e=window.setTimeout(()=>s({type:`patch`,patch:{debounced:t.trim()}}),300);return()=>window.clearTimeout(e)},[t]);let{data:y,isLoading:b,error:x}=E(v,()=>oe(c),{revalidateOnFocus:!1}),S=(0,Z.useCallback)(()=>{a(`gateway-extensions-list`),O()},[a]),C=(0,Z.useCallback)(async(e,t)=>{s({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await le({name:e,overwrite:t});S(),r.requiresGatewayRestart&&s({type:`patch`,patch:{restartHint:n.marketplaceRestartHint}})}catch(e){throw s({type:`patch`,patch:{actionError:e instanceof Error?e.message:n.marketplaceInstallFailed}}),e}finally{s({type:`patch`,patch:{rowBusy:null}})}},[n.marketplaceInstallFailed,n.marketplaceRestartHint,S]),w=(0,Z.useCallback)(async e=>{s({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let t=await de(e);S(),t.requiresGatewayRestart&&s({type:`patch`,patch:{restartHint:n.marketplaceRestartHint}})}catch(e){throw s({type:`patch`,patch:{actionError:e instanceof Error?e.message:n.marketplaceUninstallFailed}}),e}finally{s({type:`patch`,patch:{rowBusy:null}})}},[n.marketplaceRestartHint,n.marketplaceUninstallFailed,S]),D=y??[];return(0,$.jsxs)(`div`,{className:m(`flex flex-col gap-4`,e),children:[x?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:x instanceof Error?x.message:n.marketplaceLoadFailed}):null,f?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}):null,g?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:g}):null,b&&!y?(0,$.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":n.marketplaceLoading,children:[0,1,2].map(e=>(0,$.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,$.jsx)(k,{className:`h-5 w-40`}),(0,$.jsx)(k,{className:`h-4 w-full max-w-xl`}),(0,$.jsx)(k,{className:`h-4 w-2/3 max-w-md`})]}),(0,$.jsx)(k,{className:`h-8 w-20`})]})},e))}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-3`,children:D.length===0?(0,$.jsx)(`li`,{className:`text-sm text-fg-muted`,children:n.marketplaceEmpty}):D.map(e=>{let t=fe(i,e.id),r=d===e.id;return(0,$.jsx)(`li`,{className:`list-none`,children:(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${n.marketplaceDetailTitle}`,onClick:()=>s({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),s({type:`patch`,patch:{detailPkg:e.id}}))},className:m(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,$.jsx)(X,{iconUrl:e.branding?.iconUrl,fallback:G}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,$.jsx)(I,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,$.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,$.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,$.jsx)(G,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,$.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:t===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:n.marketplaceBuiltin}):t===`user`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:n.marketplaceInstalled}),(0,$.jsxs)(`button`,{type:`button`,disabled:r,onClick:()=>{window.confirm(n.marketplaceUninstallConfirm)&&w(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:[r?(0,$.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(ne,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),n.marketplaceUninstall]})]}):(0,$.jsx)(`button`,{type:`button`,onClick:()=>s({type:`patch`,patch:{detailPkg:e.id}}),className:m(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:n.marketplaceReview})})]})},e.id)})}),l?(0,$.jsx)(he,{packageName:l,copy:n,extensions:i,onClose:()=>s({type:`patch`,patch:{detailPkg:null}}),onInstall:C,onUninstall:w}):null]})}function he(e){let t=(0,ae.c)(93),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:s,onUninstall:c}=e,[d,p]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(!1),v=h(be)?`ext-mp-detail-${n}`:null,b;t[0]===n?b=t[1]:(b=async()=>ce(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:O,isLoading:A}=E(v,b,T),j;t[3]!==i||t[4]!==n?(j=fe(i,n),t[3]=i,t[4]=n,t[5]=j):j=t[5];let M=j,N=M===`user`,P=D?.manifest?.permissions,F,I,L,R,z,B,V,H,U,W,G,K;if(t[6]!==r||t[7]!==D||t[8]!==O||t[9]!==i||t[10]!==M||t[11]!==A||t[12]!==o||t[13]!==n||t[14]!==P||t[15]!==g){B=Symbol.for(`react.early_return_sentinel`);bb0:{let e=P&&typeof P==`object`&&!Array.isArray(P)?Object.entries(P):[],a;t[28]!==r||t[29]!==D?(a=D?.readme?.trim()||(D?.description?.trim()?`### ${D.name}\n\n${D.description}`:`*${r.marketplaceNoReadme}*`),t[28]=r,t[29]=D,t[30]=a):a=t[30];let s=a;if(D?.format===`agent-plugin`){let e;if(t[31]!==D||t[32]!==i){let n;t[34]===D?n=t[35]:(n=e=>e.pluginId===D.manifest?.name,t[34]=D,t[35]=n),e=i.find(n),t[31]=D,t[32]=i,t[33]=e}else e=t[33];let r=`store:${n}`,a;t[36]!==o||t[37]!==e||t[38]!==r?(a=(0,$.jsx)(ie,{extension:e,initialSource:r,onClose:o}),t[36]=o,t[37]=e,t[38]=r,t[39]=a):a=t[39],B=a;break bb0}L=w,R=!0,t[40]===o?z=t[41]:(z=e=>!e&&o(),t[40]=o,t[41]=z),I=x,t[42]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[42]=K):K=t[42],F=S,U=`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`,W=ye;let c;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(re,{className:`size-5`}),t[43]=c):c=t[43];let u;t[44]!==r.detailBack||t[45]!==o?(u=(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":r.detailBack,children:c}),t[44]=r.detailBack,t[45]=o,t[46]=u):u=t[46];let d;t[47]===r.marketplaceDetailTitle?d=t[48]:(d=(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[47]=r.marketplaceDetailTitle,t[48]=d);let p;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(f,{className:`size-5`}),t[49]=p):p=t[49];let m;t[50]!==r.detailClose||t[51]!==o?(m=(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":r.detailClose,children:p}),t[50]=r.detailClose,t[51]=o,t[52]=m):m=t[52],t[53]!==u||t[54]!==d||t[55]!==m?(G=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[u,d,m]}),t[53]=u,t[54]=d,t[55]=m,t[56]=G):G=t[56],V=`min-h-0 flex-1 overflow-y-auto p-5`,H=A&&!D?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,$.jsx)(k,{className:`h-6 w-48`}),(0,$.jsx)(k,{className:`h-4 w-28`}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(k,{className:`h-12`}),(0,$.jsx)(k,{className:`h-12`})]}),(0,$.jsx)(k,{className:`h-28 w-full`}),(0,$.jsx)(k,{className:`h-36 w-full`})]}):O?(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:r.marketplaceDetailLoadFailed}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:O instanceof Error?O.message:r.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:r.marketplaceAuthor}),(0,$.jsx)(`dd`,{children:D.author.username})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,$.jsx)(`dd`,{children:D.latestVersion.version})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,$.jsx)(`dd`,{children:D.downloads})]})]}),M===`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)(ee,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,$.jsx)(te,{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?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:D.installability.available?r.marketplaceCodeRisk:D.installability.reason??r.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:r.marketplaceIntegrity}),(0,$.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:r.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:r.marketplacePermissions}),e.length>0?(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ve)}):(0,$.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(D.packageSummary?.lifecycleScripts.length??0)>0?(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.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:r.marketplaceRiskConfirm})]})]}):null]}),D.readme?.trim()?(0,$.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,$.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,$.jsx)(l,{content:s})})]}):null}t[6]=r,t[7]=D,t[8]=O,t[9]=i,t[10]=M,t[11]=A,t[12]=o,t[13]=n,t[14]=P,t[15]=g,t[16]=F,t[17]=I,t[18]=L,t[19]=R,t[20]=z,t[21]=B,t[22]=V,t[23]=H,t[24]=U,t[25]=W,t[26]=G,t[27]=K}else F=t[16],I=t[17],L=t[18],R=t[19],z=t[20],B=t[21],V=t[22],H=t[23],U=t[24],W=t[25],G=t[26],K=t[27];if(B!==Symbol.for(`react.early_return_sentinel`))return B;let q;t[57]!==V||t[58]!==H?(q=(0,$.jsx)(`div`,{className:V,children:H}),t[57]=V,t[58]=H,t[59]=q):q=t[59];let J;t[60]!==d||t[61]!==r.marketplaceBuiltinGoBuiltin||t[62]!==r.marketplaceBuiltinManageHint||t[63]!==r.marketplaceInstall||t[64]!==r.marketplaceReinstall||t[65]!==r.marketplaceReinstallConfirm||t[66]!==r.marketplaceUninstall||t[67]!==r.marketplaceUninstallConfirm||t[68]!==D||t[69]!==M||t[70]!==o||t[71]!==s||t[72]!==c||t[73]!==n||t[74]!==g||t[75]!==N?(J=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:M===`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:r.marketplaceBuiltinManageHint}),(0,$.jsx)(a,{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:r.marketplaceBuiltinGoBuiltin})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,disabled:d||!D.installability.available||!g,onClick:()=>{N&&!window.confirm(r.marketplaceReinstallConfirm)||(p(!0),s(n,N).catch(_e).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)(u,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,N?r.marketplaceReinstall:r.marketplaceInstall]}),N?(0,$.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(p(!0),c(n).then(()=>o()).catch(ge).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)(ne,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[60]=d,t[61]=r.marketplaceBuiltinGoBuiltin,t[62]=r.marketplaceBuiltinManageHint,t[63]=r.marketplaceInstall,t[64]=r.marketplaceReinstall,t[65]=r.marketplaceReinstallConfirm,t[66]=r.marketplaceUninstall,t[67]=r.marketplaceUninstallConfirm,t[68]=D,t[69]=M,t[70]=o,t[71]=s,t[72]=c,t[73]=n,t[74]=g,t[75]=N,t[76]=J):J=t[76];let Y;t[77]!==F||t[78]!==q||t[79]!==J||t[80]!==U||t[81]!==W||t[82]!==G?(Y=(0,$.jsxs)(F,{className:U,onOpenAutoFocus:W,children:[G,q,J]}),t[77]=F,t[78]=q,t[79]=J,t[80]=U,t[81]=W,t[82]=G,t[83]=Y):Y=t[83];let X;t[84]!==I||t[85]!==Y||t[86]!==K?(X=(0,$.jsxs)(I,{children:[K,Y]}),t[84]=I,t[85]=Y,t[86]=K,t[87]=X):X=t[87];let Q;return t[88]!==L||t[89]!==R||t[90]!==z||t[91]!==X?(Q=(0,$.jsx)(L,{defaultOpen:R,onOpenChange:z,children:X}),t[88]=L,t[89]=R,t[90]=z,t[91]=X,t[92]=Q):Q=t[92],Q}function ge(){}function _e(){}function ve(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 ye(e){return e.preventDefault()}function be(e){return!!e.conversationId}function xe({embedded:e=!1,onHeaderActionChange:t}){let n=_(e=>e.language),r=p(n),o=B(e=>e.setPageHeader),c=B(e=>e.clearPageHeader),l=H(),u=K(),[f,h]=i(),g=Q(f.get(`tab`)),v=f.get(`q`)??``,[y,b]=(0,Z.useState)(g),[x,S]=(0,Z.useState)(v),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(!1),O=f.toString(),k=(0,Z.useRef)(O);if(k.current!==O){k.current=O;let e=Q(f.get(`tab`)),t=f.get(`q`)??``;b(t=>t===e?t:e),S(e=>e===t?e:t)}(0,Z.useEffect)(()=>{h(e=>{let t=new URLSearchParams(e),n=x.trim();return n?t.set(`q`,n):t.delete(`q`),y===`marketplace`?t.delete(`tab`):t.set(`tab`,y),t.toString()===e.toString()?e:t},{replace:!0})},[y,x,h]);let j=(0,Z.useMemo)(()=>l.filter(e=>e.source===`bundled`),[l]),ee=(0,Z.useMemo)(()=>l.filter(e=>e.source!==`bundled`),[l]),I=y===`builtin`?j:ee,R=(0,Z.useMemo)(()=>{let e=x.trim().toLowerCase(),t=I;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,n):e.hasUi?-1:1)},[I,x,n]);(0,Z.useEffect)(()=>{w(e=>{if(!e)return e;let t=l.find(t=>t.id===e.id);return t?Se(e)===Se(t)&&e.active===t.active&&JSON.stringify(e)===JSON.stringify(t)?e:t:null})},[l]);let V=(0,Z.useMemo)(()=>({searchLabel:y===`marketplace`?r.extensionsPage.marketplaceSearchPlaceholder:r.extensionsPage.searchPlaceholder,search:(0,$.jsx)(q,{value:x,onChange:S,placeholder:y===`marketplace`?r.extensionsPage.marketplaceSearchPlaceholder:r.extensionsPage.searchPlaceholder}),overflow:(0,$.jsxs)(L,{children:[(0,$.jsx)(A,{asChild:!0,children:(0,$.jsx)(D,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":r.capabilitiesHub.moreActions,title:r.capabilitiesHub.moreActions,children:(0,$.jsx)(s,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(P,{children:(0,$.jsxs)(M,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,$.jsxs)(N,{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`,F.transition),onSelect:()=>E(!0),children:[(0,$.jsx)(d,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),n.startsWith(`zh`)?`安装插件`:`Install plugin`]}),(0,$.jsx)(N,{asChild:!0,children:(0,$.jsxs)(a,{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`,F.transition),children:[(0,$.jsx)(z,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r.extensionsPage.openLocalApps]})})]})})]}),primary:(0,$.jsx)(D,{asChild:!0,variant:`primary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(a,{to:`/local-apps/new`,"aria-label":r.extensionsPage.createLocalApp,children:[(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:r.extensionsPage.createLocalApp})]})})}),[n,r.capabilitiesHub.moreActions,r.extensionsPage,y,x]);if((0,Z.useLayoutEffect)(()=>e?(t?.(V),()=>t?.(null)):(o({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:r.extensionsPage.title})}),end:(0,$.jsx)(J,{contribution:V})}),()=>c()),[c,e,V,r.extensionsPage.title,t,o]),u&&y!==`marketplace`)return(0,$.jsx)(ke,{});let te=[{id:`marketplace`,label:r.extensionsPage.tabMarketplace},{id:`builtin`,label:r.extensionsPage.tabBuiltin,count:j.length},{id:`user`,label:r.extensionsPage.tabUser,count:ee.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`,e?`pb-7 pt-3 lg:pb-9 lg:pt-4`:`py-7 lg:py-9`),children:[(0,$.jsx)(`div`,{className:`mb-6 border-b border-edge-subtle pb-3`,children:(0,$.jsx)(Y,{items:te,activeTab:y,onChange:b,ariaLabel:r.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`})}),y===`marketplace`?(0,$.jsx)(me,{query:x}):y===`builtin`&&j.length===0?(0,$.jsx)(je,{message:r.extensionsPage.emptyBuiltin}):y===`user`&&ee.length===0?(0,$.jsx)(je,{message:r.extensionsPage.emptyUser}):R.length===0?(0,$.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:r.extensionsPage.noSearchResults}):(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:R.map(e=>(0,$.jsx)(Ee,{extension:e,copy:r.extensionsPage,showSourceBadge:y===`user`,onOpen:()=>w(e)},e.id))})]}),C?C.format===`agent-plugin`?(0,$.jsx)(ie,{extension:C,onClose:()=>w(null)},C.id):(0,$.jsx)(De,{extension:C,copy:r.extensionsPage,onClose:()=>w(null)},C.id):null,T?(0,$.jsx)(ie,{onClose:()=>E(!1)}):null]})}function Se(e){return e.activationEligible??e.active}function Ce(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function we(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function Te(e,t){let n=Se(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function Ee(e){let t=(0,ae.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,s;t[0]===n?s=t[1]:(s=Se(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=m(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=u):u=t[2];let f=n.name||n.id,p;t[3]===f?p=t[4]:(p=f.charAt(0).toUpperCase(),t[3]=f,t[4]=p);let h;t[5]===p?h=t[6]:(h=(0,$.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:p}),t[5]=p,t[6]=h);let g;t[7]===n.name?g=t[8]:(g=(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=g);let _;t[9]===n.version?_=t[10]:(_=n.version?(0,$.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=_);let v;t[11]!==g||t[12]!==_?(v=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==r.statusEnabled||t[15]!==c?(y=c?(0,$.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,$.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,$.jsx)(d,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==r.cardNoDescription||t[21]!==n.description?(x=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=x):x=t[22];let S;t[23]===x?S=t[24]:(S=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:x}),t[23]=x,t[24]=S);let C=n.format===`agent-plugin`?`Agent Plugin`:n.hasUi?r.badgeKindUi:r.badgeKindBackend,w;t[25]!==C||t[26]!==l?(w=(0,$.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:C}),t[25]=C,t[26]=l,t[27]=w):w=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,$.jsx)(`span`,{title:Ce(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:we(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=T):T=t[31];let E;t[32]!==w||t[33]!==T?(E=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[w,T]}),t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==b||t[36]!==S||t[37]!==E?(D=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,S,E]}),t[35]=b,t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==h?(O=(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[h,D]}),t[39]=D,t[40]=h,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,$.jsx)(`button`,{type:`button`,onClick:a,className:u,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function De({extension:e,copy:t,onClose:n}){let{mutate:r}=T(),[i,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(null),[d,p]=(0,Z.useState)(!1),h=e.activationEligible===!0,g=(0,Z.useCallback)(async()=>{l(null),p(!1),o(`toggle`);try{let{requiresGatewayRestart:t}=await ue({extensionId:e.id,enabled:!h});await r(`gateway-extensions-list`),O(),p(t)}catch(e){l(e instanceof Error?e.message:t.extensionToggleFailed)}finally{o(null)}},[h,t.extensionToggleFailed,e.id,r]),_=(0,Z.useCallback)(async()=>{if(!(e.source===`bundled`||!window.confirm(t.extensionUninstallConfirm))){l(null),p(!1),o(`uninstall`);try{await de(e.id),await r(`gateway-extensions-list`),O(),n()}catch(e){l(e instanceof Error?e.message:t.marketplaceUninstallFailed),o(null)}}},[t.extensionUninstallConfirm,t.marketplaceUninstallFailed,e.id,e.source,r,n]),v=e.ui?.contributions?.pages??[],E=e.ui?.contributions?.settingsPanels??[],k=e.ui?.contributions?.chatWidgets??[],A=v.find(e=>e.showInNav)??v[0],M=E[0],N=A?V(e.id,A):null,P=M?`/settings/ext/${e.id}/${M.id}`:e.hasConfigSchema||W(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)(re,{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,` `,Ce(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:Te(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)(D,{type:`button`,variant:`secondary`,disabled:i!==null,onClick:()=>void g(),className:`shrink-0 py-1.5 text-xs`,children:i===`toggle`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(u,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):h?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,d?(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)(D,{type:`button`,variant:`ghost`,disabled:i!==null,onClick:()=>void _(),className:`text-danger hover:bg-danger-soft hover:text-danger`,children:[i===`uninstall`?(0,$.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceUninstall]})})]}),e.hasUi&&(v.length>0||E.length>0||k.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)(Oe,{template:t.badgePages,count:v.length,hidden:v.length===0}),(0,$.jsx)(Oe,{template:t.badgeSettings,count:E.length,hidden:E.length===0}),(0,$.jsx)(Oe,{template:t.badgeWidgets,count:k.length,hidden:k.length===0})]})]}):null,U(e)&&(N||P)?(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[N?(0,$.jsxs)(a,{to:N,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)(c,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,P?(0,$.jsxs)(a,{to:P,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)(j,{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 Oe(e){let t=(0,ae.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 ke(){let e=(0,ae.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,$.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,$.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,$.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(Ae)})]})}),e[4]=a):a=e[4],a}function Ae(e){return(0,$.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function je(e){let t=(0,ae.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{xe 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-DvcSrOiI.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-Bolgk7cf.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-DvcSrOiI.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-C8ewCNje.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-DuULlur3.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-wN4UZK_t.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};