@xopcai/xopc 0.0.165 → 0.0.166

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 (134) 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-CKVX2TyD.js → agent-avatar-dicebear-Tr2hgn4j.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agents-F8749KZ_.js → agents-DZ69tC4K.js} +1 -1
  5. package/dist/gateway/static/root/assets/{app-management-settings-panel-ClToHdDF.js → app-management-settings-panel-D7Nrbhez.js} +1 -1
  6. package/dist/gateway/static/root/assets/{appearance-settings-Ci2jWAkQ.js → appearance-settings-DNNbABFj.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-DCow0nte.js → apps-page-0zXIeywq.js} +1 -1
  8. package/dist/gateway/static/root/assets/{archive-plugin-CKv5A1_M.js → archive-plugin-CizqFy4G.js} +1 -1
  9. package/dist/gateway/static/root/assets/{attachment-load-LgoN-Vwo.js → attachment-load-DU8KjTua.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automation-suggestion-card-BwnZqDQE.js → automation-suggestion-card-3pqyIveW.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-DWWHMqCZ.js → automations-page-DSz3xDsi.js} +1 -1
  12. package/dist/gateway/static/root/assets/{binary-plugins-WwMRnBdP.js → binary-plugins-CipUnsOr.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-CThEfJSn.js → block-editor-XoEq6qiv.js} +3 -3
  14. package/dist/gateway/static/root/assets/{browser-settings-page-7x8rKLOl.js → browser-settings-page-COYvq3y5.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-workflow-inputs-DCj9DG0A.js → browser-workflow-inputs-DRH995XI.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-workflows-page-C1k2vHLV.js → browser-workflows-page-65edjhpz.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capabilities-settings-panel-DIwGIpuS.js → capabilities-settings-panel-LOQyfdsM.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capability-presets-api-C_NVbV7o.js → capability-presets-api-XL4h7dCK.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-DBdvIcV0.js → capability-presets-settings-panel-KPJFkt1h.js} +1 -1
  20. package/dist/gateway/static/root/assets/{channels-settings-DU93p9RZ.js → channels-settings-D8nH0mve.js} +1 -1
  21. package/dist/gateway/static/root/assets/{connector-logo-au5xzRMl.js → connector-logo-n4Hg41iD.js} +1 -1
  22. package/dist/gateway/static/root/assets/{connectors-page-B9sD56hT.js → connectors-page-jvRWZn3Y.js} +1 -1
  23. package/dist/gateway/static/root/assets/{desktop-pet-CaTO9bAV.js → desktop-pet-D4OzBOwm.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-settings-CORq2BIE.js → desktop-pet-settings-CDGezbaf.js} +1 -1
  25. package/dist/gateway/static/root/assets/{directory-picker-path-field-Daf0tqrN.js → directory-picker-path-field-DmL4AUXQ.js} +1 -1
  26. package/dist/gateway/static/root/assets/{dreaming-settings-CJqJpvgc.js → dreaming-settings-ClUcBKnd.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-debug-page-0XmiUqsm.js → extension-debug-page-DsV_KUDM.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-page-C_9HSvyu.js → extension-page-DJv_G1jY.js} +1 -1
  29. package/dist/gateway/static/root/assets/{extension-settings-page-DcmUCmOu.js → extension-settings-page-DUAlJ4CU.js} +1 -1
  30. package/dist/gateway/static/root/assets/{gateway-config-api-CZqfsxJf.js → gateway-config-api-SVYgzqv7.js} +1 -1
  31. package/dist/gateway/static/root/assets/{gateway-settings-CzX8TVmO.js → gateway-settings-YL6f2C_F.js} +1 -1
  32. package/dist/gateway/static/root/assets/{goal-create-dialog-Dbj_sgV-.js → goal-create-dialog-CJJe-4Co.js} +1 -1
  33. package/dist/gateway/static/root/assets/{goal-detail-page-BdkiZwW-.js → goal-detail-page-Da9VMWRd.js} +1 -1
  34. package/dist/gateway/static/root/assets/{goals-config-api-Cvlq3jyf.js → goals-config-api-st_Itxa9.js} +1 -1
  35. package/dist/gateway/static/root/assets/{goals-page-BD9ztXNA.js → goals-page-B6pC7PYZ.js} +1 -1
  36. package/dist/gateway/static/root/assets/{goals-settings-CSGvHJDi.js → goals-settings-BEZePZ5m.js} +1 -1
  37. package/dist/gateway/static/root/assets/{heartbeat-settings-BvXA7oNN.js → heartbeat-settings-DpeD9GQ9.js} +1 -1
  38. package/dist/gateway/static/root/assets/{index-CfOzvGDb.js → index-BhQMnKH1.js} +6 -6
  39. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-xb6mna1C.js → keyboard-shortcuts-settings-fhssr2-J.js} +1 -1
  40. package/dist/gateway/static/root/assets/{local-app-workbench-page-DH4nglP_.js → local-app-workbench-page-Ctia6lSG.js} +1 -1
  41. package/dist/gateway/static/root/assets/{local-apps-page-BScdXqMo.js → local-apps-page-DWF9rpWQ.js} +1 -1
  42. package/dist/gateway/static/root/assets/{logs-page-BBpAWjyF.js → logs-page-D3gL6vHX.js} +1 -1
  43. package/dist/gateway/static/root/assets/{markdown-split-8hnAS25m.js → markdown-split-BuduJ0Ev.js} +1 -1
  44. package/dist/gateway/static/root/assets/{media-plugins-DzlHseMD.js → media-plugins-CLASZjhT.js} +1 -1
  45. package/dist/gateway/static/root/assets/{notes-page-DbDHFPiI.js → notes-page-ve3XiBDF.js} +1 -1
  46. package/dist/gateway/static/root/assets/{notes-workbench-B-A9whbg.js → notes-workbench-oHU532lp.js} +2 -2
  47. package/dist/gateway/static/root/assets/{page-tabs-CXJiygUJ.js → page-tabs-DU85jn98.js} +1 -1
  48. package/dist/gateway/static/root/assets/{preview-open-alternatives-Cq6aue5a.js → preview-open-alternatives-CtchTuRQ.js} +1 -1
  49. package/dist/gateway/static/root/assets/{product-open-page-nP8vuNlJ.js → product-open-page-DFT6Fx6y.js} +1 -1
  50. package/dist/gateway/static/root/assets/{project-detail-page-BXrscUbq.js → project-detail-page-Ceu0NoC1.js} +1 -1
  51. package/dist/gateway/static/root/assets/{projects-page-m0EKUeaY.js → projects-page-CdpqOmO8.js} +1 -1
  52. package/dist/gateway/static/root/assets/{remote-access-hub-B16uQSY5.js → remote-access-hub-D1NKLyiR.js} +1 -1
  53. package/dist/gateway/static/root/assets/{save-bar-controls-BPgnLY1p.js → save-bar-controls-CmcrHpMc.js} +1 -1
  54. package/dist/gateway/static/root/assets/{schedule-field-rHWpueWl.js → schedule-field-DmIkP6JV.js} +1 -1
  55. package/dist/gateway/static/root/assets/{schema-form-CHKIUrzk.js → schema-form-Dkk9blN0.js} +1 -1
  56. package/dist/gateway/static/root/assets/{sessions-page-C5_qtznc.js → sessions-page-CMj_JaOk.js} +1 -1
  57. package/dist/gateway/static/root/assets/settings-advanced-gate-DR9Q2ZyF.js +1 -0
  58. package/dist/gateway/static/root/assets/{settings-form-section-CR4J0N4X.js → settings-form-section-CuQzWvg5.js} +1 -1
  59. package/dist/gateway/static/root/assets/{settings-loading-skeleton-B8v-lHKT.js → settings-loading-skeleton-C5FNbyej.js} +1 -1
  60. package/dist/gateway/static/root/assets/{settings-page-BcLf8Rd5.js → settings-page-a-A2yTGE.js} +1 -1
  61. package/dist/gateway/static/root/assets/{settings-page-layout-Co31Becn.js → settings-page-layout-MuXpamWD.js} +1 -1
  62. package/dist/gateway/static/root/assets/{setup-status-panel-BFLA1Fsj.js → setup-status-panel-BUdh8FKY.js} +1 -1
  63. package/dist/gateway/static/root/assets/{share-preview-page-B5vMe8DY.js → share-preview-page-BfzzmTgg.js} +1 -1
  64. package/dist/gateway/static/root/assets/{shares-settings-DL2tKPq6.js → shares-settings-8a9qnLF8.js} +1 -1
  65. package/dist/gateway/static/root/assets/{skill-reload-api-C8jkuLob.js → skill-reload-api-da5gLCer.js} +1 -1
  66. package/dist/gateway/static/root/assets/{skills-page-DAOZXlp5.js → skills-page-CmHj-CKY.js} +1 -1
  67. package/dist/gateway/static/root/assets/{system-settings-panel-CHt3FXI8.js → system-settings-panel-CyhRkWMi.js} +1 -1
  68. package/dist/gateway/static/root/assets/{time-picker-C9Rr1IUV.js → time-picker-WEPp3HrB.js} +1 -1
  69. package/dist/gateway/static/root/assets/{typed-models-lib-QMF30Yvh.js → typed-models-lib-Bi1uoxFR.js} +1 -1
  70. package/dist/gateway/static/root/assets/{user-context-page-D6EEhj-e.js → user-context-page-BObEyiim.js} +1 -1
  71. package/dist/gateway/static/root/assets/{voice-api-key-field-Gjjs3qih.js → voice-api-key-field-Gvgodhec.js} +1 -1
  72. package/dist/gateway/static/root/assets/{work-discovery-page-CDnL9daG.js → work-discovery-page-BHnjvGH1.js} +1 -1
  73. package/dist/gateway/static/root/assets/{work-item-detail-page-BCoT4p1E.js → work-item-detail-page-CQ8ybkxx.js} +1 -1
  74. package/dist/gateway/static/root/assets/{work-page-l8h2Y50w.js → work-page-D_U_En23.js} +1 -1
  75. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DnOfronD.js → workflow-run-setup-panel-B-Sk6gFn.js} +1 -1
  76. package/dist/gateway/static/root/assets/{workflows-page-IVbQ83CW.js → workflows-page-DT0pzfkz.js} +1 -1
  77. package/dist/gateway/static/root/index.html +1 -1
  78. package/dist/package.js +1 -1
  79. package/dist/src/agent/agent-manager.js +3 -3
  80. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
  81. package/dist/src/agent/embedded/model-runtime.js +1 -1
  82. package/dist/src/agent/goals/post-turn.js +1 -1
  83. package/dist/src/agent/image/tool-model-config.js +1 -1
  84. package/dist/src/agent/ipc/inbox.js +1 -1
  85. package/dist/src/agent/memory/dreaming/config.js +1 -1
  86. package/dist/src/agent/service.js +2 -2
  87. package/dist/src/agent/skills/hub-lock.js +1 -1
  88. package/dist/src/agent-runtime/index.js +1 -1
  89. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  90. package/dist/src/auth/credentials.js +2 -2
  91. package/dist/src/auth/profiles/store.js +1 -1
  92. package/dist/src/auth/sync-provider-auth.js +2 -2
  93. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  94. package/dist/src/cli/commands/connectors.js +1 -1
  95. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  96. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  97. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  98. package/dist/src/cli/commands/models.js +1 -1
  99. package/dist/src/cli/commands/update.js +1 -1
  100. package/dist/src/config/agent-profile.js +1 -1
  101. package/dist/src/config/index.js +4 -4
  102. package/dist/src/config/loader.js +1 -1
  103. package/dist/src/config/models-json.js +1 -1
  104. package/dist/src/connectors/connector-memory-sync.js +1 -1
  105. package/dist/src/connectors/health.js +1 -1
  106. package/dist/src/extensions/lockfile.js +1 -1
  107. package/dist/src/gateway/agents-admin.js +2 -2
  108. package/dist/src/gateway/file-path-classifier.js +1 -1
  109. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  110. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  111. package/dist/src/gateway/hono/routes/models.js +1 -1
  112. package/dist/src/gateway/hono/routes/update.js +2 -2
  113. package/dist/src/gateway/hono/routes/workflows.js +1 -1
  114. package/dist/src/gateway/index.js +1 -1
  115. package/dist/src/gateway/run-loop.js +1 -1
  116. package/dist/src/gateway/service/config-coordinator.js +1 -1
  117. package/dist/src/gateway/service.js +4 -4
  118. package/dist/src/goals/goal-workflow-judge.js +1 -1
  119. package/dist/src/infra/gateway-processes.js +1 -1
  120. package/dist/src/infra/update-restart.js +1 -1
  121. package/dist/src/infra/update-runner.js +2 -2
  122. package/dist/src/infra/update-startup.js +1 -1
  123. package/dist/src/mcp/channel-bridge.js +1 -1
  124. package/dist/src/notes/service.js +1 -1
  125. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  126. package/dist/src/providers/index.js +7 -4
  127. package/dist/src/providers/model-ref.d.ts +6 -0
  128. package/dist/src/providers/model-ref.js +15 -0
  129. package/dist/src/providers/model-registry.js +6 -3
  130. package/dist/src/tui/tui-startup-resources.js +2 -2
  131. package/dist/src/tui/tui.js +1 -1
  132. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  133. package/package.json +1 -1
  134. package/dist/gateway/static/root/assets/settings-advanced-gate-DQlbm1mA.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"./cn-JdwAhgNB.js";import{t as a}from"./copy-to-clipboard-HOJ79TWv.js";import{t as o}from"./messages-C96Zjb0V.js";import{n as s,r as c,s as l}from"./locale-store-C_ax27uc.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$l as d,Ds as f,Go as p,Jo as m,Ko as h,Ns as g,Nt as _,Uo as v,Wc as y,Xo as b,Yo as x,ms as S,ps as C,qo as w,ro as T}from"./index-CfOzvGDb.js";import{n as E,r as D}from"./settings-page-layout-Co31Becn.js";import{t as O}from"./settings-loading-skeleton-B8v-lHKT.js";import{r as k,t as A}from"./settings-form-section-CR4J0N4X.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,o]=(0,M.useReducer)(_,L),{info:s,loadError:c,actionError:l,copiedField:u,clearDialogOpen:b,clearConfirmChecked:T,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await a(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(O,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=T&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(y,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,f.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(d,{className:`size-3`,"aria-hidden":!0}),u===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,f.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(d,{className:`size-3`,"aria-hidden":!0}),u===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,f.press),onClick:()=>{o({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),onClick:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(v,{open:b,onOpenChange:e=>{e||o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(m,{children:[(0,N.jsx)(w,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,C,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(x,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(h,{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:T,onChange:e=>o({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>o({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(g,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(g,{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)(v,{open:D,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(m,{children:[(0,N.jsx)(w,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,C,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(x,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(h,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>o({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(g,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(g,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await l(c(`/api/migrations/status`))).payload}async function B(){await l(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=u(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(T,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(T,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let d=t?.items??[],f=d.filter(e=>e.status===`conflict`||e.status===`error`),p=d.filter(e=>e.safety===`auto`&&e.status===`planned`),m=f.length>0||d.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:d.length===0?e.upToDate:m?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(p.length))})]}),p.length>0&&!m?(0,N.jsx)(g,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),d.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=s(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!b()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=c);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./copy-to-clipboard-HOJ79TWv.js";import{t as o}from"./messages-C96Zjb0V.js";import{n as s,r as c,s as l}from"./locale-store-C_ax27uc.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$l as d,Ds as f,Go as p,Jo as m,Ko as h,Ns as g,Nt as _,Uo as v,Wc as y,Xo as b,Yo as x,ms as S,ps as C,qo as w,ro as T}from"./index-BhQMnKH1.js";import{n as E,r as D}from"./settings-page-layout-MuXpamWD.js";import{t as O}from"./settings-loading-skeleton-C5FNbyej.js";import{r as k,t as A}from"./settings-form-section-CuQzWvg5.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,o]=(0,M.useReducer)(_,L),{info:s,loadError:c,actionError:l,copiedField:u,clearDialogOpen:b,clearConfirmChecked:T,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await a(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(O,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=T&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(y,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,f.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(d,{className:`size-3`,"aria-hidden":!0}),u===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,f.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(d,{className:`size-3`,"aria-hidden":!0}),u===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,f.press),onClick:()=>{o({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),onClick:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(v,{open:b,onOpenChange:e=>{e||o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(m,{children:[(0,N.jsx)(w,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,C,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(x,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(h,{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:T,onChange:e=>o({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>o({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(g,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(g,{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)(v,{open:D,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(m,{children:[(0,N.jsx)(w,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,C,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(x,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(h,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>o({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(g,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(g,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await l(c(`/api/migrations/status`))).payload}async function B(){await l(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=u(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(T,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(T,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let d=t?.items??[],f=d.filter(e=>e.status===`conflict`||e.status===`error`),p=d.filter(e=>e.safety===`auto`&&e.status===`planned`),m=f.length>0||d.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:d.length===0?e.upToDate:m?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(p.length))})]}),p.length>0&&!m?(0,N.jsx)(g,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),d.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=s(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!b()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=c);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{t as r}from"./messages-C96Zjb0V.js";import{n as i}from"./locale-store-C_ax27uc.js";import{i as a}from"./theme-store-D37XLD_C.js";import{Ds as o,Dt as s,is as c}from"./index-CfOzvGDb.js";import{n as l,r as u}from"./settings-page-layout-Co31Becn.js";import{t as d}from"./settings-advanced-gate-DQlbm1mA.js";var f=e(),p=t();function m(){return n(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var h={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function g(e){let t=(0,f.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,p.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,p.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let m;t[12]===o?m=t[13]:(m=(0,p.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=m);let h;t[14]===o?h=t[15]:(h=(0,p.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=h);let g;t[16]!==c||t[17]!==d||t[18]!==m||t[19]!==h?(g=(0,p.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,m,h]}),t[16]=c,t[17]=d,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==s||t[22]!==g?(_=(0,p.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:g}),t[21]=s,t[22]=g,t[23]=_):_=t[23],_}function _(e){let t=(0,f.c)(8),{scheme:n}=e,{light:r,dark:i}=h[n],a;t[0]===r?a=t[1]:(a=(0,p.jsx)(g,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,p.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,p.jsx)(g,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,p.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var v=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function y(){let e=(0,f.c)(18),t=i(S),s;e[0]===t?s=e[1]:(s=r(t),e[0]=t,e[1]=s);let c=s.appearanceSettings,l=a(x),u=a(b),d;e[2]===c.colorSchemeTitle?d=e[3]:(d=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:c.colorSchemeTitle}),e[2]=c.colorSchemeTitle,e[3]=d);let m;e[4]===c.colorSchemeDescription?m=e[5]:(m=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:c.colorSchemeDescription}),e[4]=c.colorSchemeDescription,e[5]=m);let h;e[6]!==d||e[7]!==m?(h=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),e[6]=d,e[7]=m,e[8]=h):h=e[8];let g;e[9]!==c||e[10]!==l||e[11]!==u?(g=v.map(e=>{let{value:t,labelKey:r}=e,i=l===t;return(0,p.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>u(t),className:n(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,o.pressCard,i?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,p.jsx)(_,{scheme:t}),(0,p.jsx)(`span`,{className:n(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:c[r]})]},t)}),e[9]=c,e[10]=l,e[11]=u,e[12]=g):g=e[12];let y;e[13]===g?y=e[14]:(y=(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:g}),e[13]=g,e[14]=y);let C;return e[15]!==h||e[16]!==y?(C=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 p-3.5 sm:py-4`,children:[h,y]}),e[15]=h,e[16]=y,e[17]=C):C=e[17],C}function b(e){return e.setColorScheme}function x(e){return e.colorScheme}function S(e){return e.language}function C(){let e=(0,f.c)(27),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o=s(T),c=s(w),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let u;e[4]===a.developerGroupDescription?u=e[5]:(u=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=u);let d;e[6]!==l||e[7]!==u?(d=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[l,u]}),e[6]=l,e[7]=u,e[8]=d):d=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,p.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===c?_=e[17]:(_=e=>c(e.target.checked),e[16]=c,e[17]=_);let v;e[18]!==o||e[19]!==_?(v=(0,p.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:o,onChange:_}),e[18]=o,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==d||e[25]!==y?(b=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,y]}),e[24]=d,e[25]=y,e[26]=b):b=e[26],b}function w(e){return e.setShowRawToolData}function T(e){return e.showRawToolData}function E(e){return e.language}function D(){let e=(0,f.c)(29),t=i(O),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o;e[2]!==a.pageTitle||e[3]!==a.subtitle?(o=(0,p.jsx)(l,{title:a.pageTitle,subtitle:a.subtitle}),e[2]=a.pageTitle,e[3]=a.subtitle,e[4]=o):o=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=m(),e[5]=s):s=e[5];let h;e[6]===a.languageTitle?h=e[7]:(h=(0,p.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:a.languageTitle}),e[6]=a.languageTitle,e[7]=h);let g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,p.jsx)(c,{variant:`page`,sections:[`language`]}),e[8]=g):g=e[8];let _;e[9]===h?_=e[10]:(_=(0,p.jsxs)(`section`,{className:s,"aria-labelledby":`pref-language-heading`,children:[h,g]}),e[9]=h,e[10]=_);let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=m(),e[11]=v):v=e[11];let b;e[12]===a.themeTitle?b=e[13]:(b=(0,p.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:a.themeTitle}),e[12]=a.themeTitle,e[13]=b);let x,S;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,p.jsx)(c,{variant:`page`,sections:[`theme`,`font`]}),S=(0,p.jsx)(y,{}),e[14]=x,e[15]=S):(x=e[14],S=e[15]);let w;e[16]===b?w=e[17]:(w=(0,p.jsxs)(`section`,{className:v,"aria-labelledby":`pref-appearance-heading`,children:[b,x,S]}),e[16]=b,e[17]=w);let T;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(),e[18]=T):T=e[18];let E;e[19]===a.developerGroupTitle?E=e[20]:(E=(0,p.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:a.developerGroupTitle}),e[19]=a.developerGroupTitle,e[20]=E);let D;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,p.jsx)(C,{}),e[21]=D):D=e[21];let k;e[22]===E?k=e[23]:(k=(0,p.jsx)(d,{children:(0,p.jsxs)(`section`,{className:T,"aria-labelledby":`pref-developer-heading`,children:[E,D]})}),e[22]=E,e[23]=k);let A;return e[24]!==o||e[25]!==w||e[26]!==k||e[27]!==_?(A=(0,p.jsxs)(u,{gap:`gap-6`,children:[o,_,w,k]}),e[24]=o,e[25]=w,e[26]=k,e[27]=_,e[28]=A):A=e[28],A}function O(e){return e.language}export{D as AppearanceSettingsPanel};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{t as r}from"./messages-C96Zjb0V.js";import{n as i}from"./locale-store-C_ax27uc.js";import{i as a}from"./theme-store-D37XLD_C.js";import{Ds as o,Dt as s,is as c}from"./index-BhQMnKH1.js";import{n as l,r as u}from"./settings-page-layout-MuXpamWD.js";import{t as d}from"./settings-advanced-gate-DR9Q2ZyF.js";var f=e(),p=t();function m(){return n(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var h={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function g(e){let t=(0,f.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,p.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,p.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let m;t[12]===o?m=t[13]:(m=(0,p.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=m);let h;t[14]===o?h=t[15]:(h=(0,p.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=h);let g;t[16]!==c||t[17]!==d||t[18]!==m||t[19]!==h?(g=(0,p.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,m,h]}),t[16]=c,t[17]=d,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==s||t[22]!==g?(_=(0,p.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:g}),t[21]=s,t[22]=g,t[23]=_):_=t[23],_}function _(e){let t=(0,f.c)(8),{scheme:n}=e,{light:r,dark:i}=h[n],a;t[0]===r?a=t[1]:(a=(0,p.jsx)(g,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,p.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,p.jsx)(g,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,p.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var v=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function y(){let e=(0,f.c)(18),t=i(S),s;e[0]===t?s=e[1]:(s=r(t),e[0]=t,e[1]=s);let c=s.appearanceSettings,l=a(x),u=a(b),d;e[2]===c.colorSchemeTitle?d=e[3]:(d=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:c.colorSchemeTitle}),e[2]=c.colorSchemeTitle,e[3]=d);let m;e[4]===c.colorSchemeDescription?m=e[5]:(m=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:c.colorSchemeDescription}),e[4]=c.colorSchemeDescription,e[5]=m);let h;e[6]!==d||e[7]!==m?(h=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),e[6]=d,e[7]=m,e[8]=h):h=e[8];let g;e[9]!==c||e[10]!==l||e[11]!==u?(g=v.map(e=>{let{value:t,labelKey:r}=e,i=l===t;return(0,p.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>u(t),className:n(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,o.pressCard,i?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,p.jsx)(_,{scheme:t}),(0,p.jsx)(`span`,{className:n(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:c[r]})]},t)}),e[9]=c,e[10]=l,e[11]=u,e[12]=g):g=e[12];let y;e[13]===g?y=e[14]:(y=(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:g}),e[13]=g,e[14]=y);let C;return e[15]!==h||e[16]!==y?(C=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 p-3.5 sm:py-4`,children:[h,y]}),e[15]=h,e[16]=y,e[17]=C):C=e[17],C}function b(e){return e.setColorScheme}function x(e){return e.colorScheme}function S(e){return e.language}function C(){let e=(0,f.c)(27),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o=s(T),c=s(w),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let u;e[4]===a.developerGroupDescription?u=e[5]:(u=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=u);let d;e[6]!==l||e[7]!==u?(d=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[l,u]}),e[6]=l,e[7]=u,e[8]=d):d=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,p.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===c?_=e[17]:(_=e=>c(e.target.checked),e[16]=c,e[17]=_);let v;e[18]!==o||e[19]!==_?(v=(0,p.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:o,onChange:_}),e[18]=o,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==d||e[25]!==y?(b=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,y]}),e[24]=d,e[25]=y,e[26]=b):b=e[26],b}function w(e){return e.setShowRawToolData}function T(e){return e.showRawToolData}function E(e){return e.language}function D(){let e=(0,f.c)(29),t=i(O),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o;e[2]!==a.pageTitle||e[3]!==a.subtitle?(o=(0,p.jsx)(l,{title:a.pageTitle,subtitle:a.subtitle}),e[2]=a.pageTitle,e[3]=a.subtitle,e[4]=o):o=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=m(),e[5]=s):s=e[5];let h;e[6]===a.languageTitle?h=e[7]:(h=(0,p.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:a.languageTitle}),e[6]=a.languageTitle,e[7]=h);let g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,p.jsx)(c,{variant:`page`,sections:[`language`]}),e[8]=g):g=e[8];let _;e[9]===h?_=e[10]:(_=(0,p.jsxs)(`section`,{className:s,"aria-labelledby":`pref-language-heading`,children:[h,g]}),e[9]=h,e[10]=_);let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=m(),e[11]=v):v=e[11];let b;e[12]===a.themeTitle?b=e[13]:(b=(0,p.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:a.themeTitle}),e[12]=a.themeTitle,e[13]=b);let x,S;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,p.jsx)(c,{variant:`page`,sections:[`theme`,`font`]}),S=(0,p.jsx)(y,{}),e[14]=x,e[15]=S):(x=e[14],S=e[15]);let w;e[16]===b?w=e[17]:(w=(0,p.jsxs)(`section`,{className:v,"aria-labelledby":`pref-appearance-heading`,children:[b,x,S]}),e[16]=b,e[17]=w);let T;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(),e[18]=T):T=e[18];let E;e[19]===a.developerGroupTitle?E=e[20]:(E=(0,p.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:a.developerGroupTitle}),e[19]=a.developerGroupTitle,e[20]=E);let D;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,p.jsx)(C,{}),e[21]=D):D=e[21];let k;e[22]===E?k=e[23]:(k=(0,p.jsx)(d,{children:(0,p.jsxs)(`section`,{className:T,"aria-labelledby":`pref-developer-heading`,children:[E,D]})}),e[22]=E,e[23]=k);let A;return e[24]!==o||e[25]!==w||e[26]!==k||e[27]!==_?(A=(0,p.jsxs)(u,{gap:`gap-6`,children:[o,_,w,k]}),e[24]=o,e[25]=w,e[26]=k,e[27]=_,e[28]=A):A=e[28],A}function O(e){return e.language}export{D as AppearanceSettingsPanel};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,t as a}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-C96Zjb0V.js";import{l,n as u,o as d,r as f,s as p}from"./locale-store-C_ax27uc.js";import{a as m,i as h}from"./vendor-swr-BIWyz7Rc.js";import{Fr as g,Fu as _,Go as v,Is as y,Jo as b,Js as x,Kl as S,Ko as C,Nc as w,Ns as T,Nt as E,To as D,Tu as O,Uo as k,Wc as A,Yo as j,Ys as M,ao as N,co as P,gu as F,hc as I,lo as L,oo as R,pc as ee,qi as te,qo as ne,rl as re,ro as z,so as B,yc as V}from"./index-CfOzvGDb.js";import{t as H}from"./page-tabs-CXJiygUJ.js";var U=e(t(),1),W=n();function G(e){return e===`builtin`||e===`user`?e:`marketplace`}async function K(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ie(e){let t=await d(f(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await d(f(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await d(f(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function Y(e){let t=await d(f(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var X=r();function ae(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function Q({className:e}){let t=c(u(e=>e.language)).extensionsPage,n=l(e=>!!e.token),r=R(),{mutate:i}=m(),[a,o]=(0,U.useReducer)(E,Z),{q:d,debounced:_,detailPkg:v,rowBusy:y,actionError:b,restartHint:x}=a,S=n?`marketplace-${_}`:null;(0,U.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:d.trim()}}),300);return()=>window.clearTimeout(e)},[d]);let{data:C,isLoading:w,error:T}=h(S,async()=>p(_.length>0?f(`/api/marketplace?q=${encodeURIComponent(_)}`):f(`/api/marketplace`)),{revalidateOnFocus:!1}),D=(0,U.useCallback)(()=>{i(`gateway-extensions-list`),g()},[i]),O=(0,U.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await q({name:e,overwrite:n});D(),r.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,D]),k=(0,U.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await Y(e);D(),n.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,D]),j=C?.extensions??[];return(0,X.jsxs)(`div`,{className:s(`flex flex-col gap-4`,e),children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(V,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:d,onChange:e=>o({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),T?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:T instanceof Error?T.message:t.marketplaceLoadFailed}):null,b?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:b}):null,x?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:x}):null,w&&!C?(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,X.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,X.jsx)(z,{className:`h-5 w-40`}),(0,X.jsx)(z,{className:`h-4 w-full max-w-xl`}),(0,X.jsx)(z,{className:`h-4 w-2/3 max-w-md`})]}),(0,X.jsx)(z,{className:`h-8 w-20`})]})},e))}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,children:j.length===0?(0,X.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):j.map(e=>{let n=ae(r,e.id),i=y===e.id;return(0,X.jsx)(`li`,{className:`list-none`,children:(0,X.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o({type:`patch`,patch:{detailPkg:e.id}}))},className:s(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,X.jsx)(F,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,X.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,X.jsx)(A,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,X.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,X.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&k(e.id).catch(()=>{})},className:s(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,X.jsx)(re,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(M,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,X.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:s(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:t.marketplaceReview})})]})},e.id)})}),v?(0,X.jsx)($,{packageName:v,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:O,onUninstall:k}):null]})}function $(e){let t=(0,W.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:c,onUninstall:u}=e,[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),g=l(ue)?`ext-mp-detail-${n}`:null,S;t[0]===n?S=t[1]:(S=async()=>ie(n),t[0]=n,t[1]=S);let C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},t[2]=C):C=t[2];let{data:w,error:T,isLoading:E}=h(g,S,C),D;t[3]!==i||t[4]!==n?(D=ae(i,n),t[3]=i,t[4]=n,t[5]=D):D=t[5];let O=D,A=O===`user`,N=w?.manifest?.permissions,P,F,I,L,R,B,V,H,G,K,q;if(t[6]!==r.detailBack||t[7]!==r.detailClose||t[8]!==r.marketplaceAuthor||t[9]!==r.marketplaceCodeRisk||t[10]!==r.marketplaceDependencies||t[11]!==r.marketplaceDetailLoadFailed||t[12]!==r.marketplaceDetailReadmeHeading||t[13]!==r.marketplaceDetailTitle||t[14]!==r.marketplaceDownloads||t[15]!==r.marketplaceIntegrity||t[16]!==r.marketplaceIntegrityVerified||t[17]!==r.marketplaceLifecycleScripts||t[18]!==r.marketplaceLoadFailed||t[19]!==r.marketplaceLoading||t[20]!==r.marketplaceNoReadme||t[21]!==r.marketplacePermissions||t[22]!==r.marketplacePermissionsNone||t[23]!==r.marketplaceRiskConfirm||t[24]!==r.marketplaceRiskTitle||t[25]!==r.marketplaceUnavailableBody||t[26]!==r.marketplaceUnavailableTitle||t[27]!==r.marketplaceVersion||t[28]!==w||t[29]!==T||t[30]!==O||t[31]!==E||t[32]!==o||t[33]!==N||t[34]!==p){let e=N&&typeof N==`object`&&!Array.isArray(N)?Object.entries(N):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==w?(n=w?.readme?.trim()||(w?.description?.trim()?`### ${w.name}\n\n${w.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=w,t[48]=n):n=t[48];let i=n;I=k,L=!0,t[49]===o?R=t[50]:(R=e=>!e&&o(),t[49]=o,t[50]=R),F=b,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(ne,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=q):q=t[51],P=v,H=`fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,G=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(_,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,X.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:a}),t[53]=r.detailBack,t[54]=o,t[55]=s):s=t[55];let c;t[56]===r.marketplaceDetailTitle?c=t[57]:(c=(0,X.jsx)(j,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=c);let l;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(y,{className:`size-5`}),t[58]=l):l=t[58];let u;t[59]!==r.detailClose||t[60]!==o?(u=(0,X.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:l}),t[59]=r.detailClose,t[60]=o,t[61]=u):u=t[61],t[62]!==s||t[63]!==c||t[64]!==u?(K=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,c,u]}),t[62]=s,t[63]=c,t[64]=u,t[65]=K):K=t[65],B=`min-h-0 flex-1 overflow-y-auto p-5`,V=E&&!w?(0,X.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,X.jsx)(z,{className:`h-6 w-48`}),(0,X.jsx)(z,{className:`h-4 w-28`}),(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)(z,{className:`h-12`}),(0,X.jsx)(z,{className:`h-12`})]}),(0,X.jsx)(z,{className:`h-28 w-full`}),(0,X.jsx)(z,{className:`h-36 w-full`})]}):T?(0,X.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,X.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,X.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:T instanceof Error?T.message:r.marketplaceLoadFailed})]}):w?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:w.name}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:w.id})}),(0,X.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,X.jsx)(`dd`,{children:w.author.username})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,X.jsx)(`dd`,{children:w.latestVersion.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,X.jsx)(`dd`,{children:w.downloads})]})]}),O===`bundled`?null:(0,X.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[w.installability.available?(0,X.jsx)(ee,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,X.jsx)(x,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:w.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:w.installability.available?r.marketplaceCodeRisk:w.installability.reason??r.marketplaceUnavailableBody})]})]}),w.installability.available?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,X.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,X.jsx)(`dd`,{children:w.packageSummary?.dependencyCount??0})]})]}),(0,X.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,X.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,X.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(w.packageSummary?.lifecycleScripts.length??0)>0?(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,w.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,X.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),w.readme?.trim()?(0,X.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,X.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,X.jsx)(te,{content:i})})]}):null,t[6]=r.detailBack,t[7]=r.detailClose,t[8]=r.marketplaceAuthor,t[9]=r.marketplaceCodeRisk,t[10]=r.marketplaceDependencies,t[11]=r.marketplaceDetailLoadFailed,t[12]=r.marketplaceDetailReadmeHeading,t[13]=r.marketplaceDetailTitle,t[14]=r.marketplaceDownloads,t[15]=r.marketplaceIntegrity,t[16]=r.marketplaceIntegrityVerified,t[17]=r.marketplaceLifecycleScripts,t[18]=r.marketplaceLoadFailed,t[19]=r.marketplaceLoading,t[20]=r.marketplaceNoReadme,t[21]=r.marketplacePermissions,t[22]=r.marketplacePermissionsNone,t[23]=r.marketplaceRiskConfirm,t[24]=r.marketplaceRiskTitle,t[25]=r.marketplaceUnavailableBody,t[26]=r.marketplaceUnavailableTitle,t[27]=r.marketplaceVersion,t[28]=w,t[29]=T,t[30]=O,t[31]=E,t[32]=o,t[33]=N,t[34]=p,t[35]=P,t[36]=F,t[37]=I,t[38]=L,t[39]=R,t[40]=B,t[41]=V,t[42]=H,t[43]=G,t[44]=K,t[45]=q}else P=t[35],F=t[36],I=t[37],L=t[38],R=t[39],B=t[40],V=t[41],H=t[42],G=t[43],K=t[44],q=t[45];let J;t[66]!==B||t[67]!==V?(J=(0,X.jsx)(`div`,{className:B,children:V}),t[66]=B,t[67]=V,t[68]=J):J=t[68];let Y;t[69]!==d||t[70]!==r.marketplaceBuiltinGoBuiltin||t[71]!==r.marketplaceBuiltinManageHint||t[72]!==r.marketplaceInstall||t[73]!==r.marketplaceReinstall||t[74]!==r.marketplaceReinstallConfirm||t[75]!==r.marketplaceUninstall||t[76]!==r.marketplaceUninstallConfirm||t[77]!==w||t[78]!==O||t[79]!==o||t[80]!==c||t[81]!==u||t[82]!==n||t[83]!==p||t[84]!==A?(Y=w?(0,X.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:O===`bundled`?(0,X.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,X.jsx)(a,{to:`/extensions?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,disabled:d||!w.installability.available||!p,onClick:()=>{A&&!window.confirm(r.marketplaceReinstallConfirm)||(f(!0),c(n,A).catch(se).finally(()=>f(!1)))},className:s(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[d?(0,X.jsx)(re,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,A?r.marketplaceReinstall:r.marketplaceInstall]}),A?(0,X.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(f(!0),u(n).then(()=>o()).catch(oe).finally(()=>f(!1)))},className:s(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,X.jsx)(M,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=d,t[70]=r.marketplaceBuiltinGoBuiltin,t[71]=r.marketplaceBuiltinManageHint,t[72]=r.marketplaceInstall,t[73]=r.marketplaceReinstall,t[74]=r.marketplaceReinstallConfirm,t[75]=r.marketplaceUninstall,t[76]=r.marketplaceUninstallConfirm,t[77]=w,t[78]=O,t[79]=o,t[80]=c,t[81]=u,t[82]=n,t[83]=p,t[84]=A,t[85]=Y):Y=t[85];let Z;t[86]!==P||t[87]!==J||t[88]!==Y||t[89]!==H||t[90]!==G||t[91]!==K?(Z=(0,X.jsxs)(P,{className:H,onOpenAutoFocus:G,children:[K,J,Y]}),t[86]=P,t[87]=J,t[88]=Y,t[89]=H,t[90]=G,t[91]=K,t[92]=Z):Z=t[92];let Q;t[93]!==F||t[94]!==Z||t[95]!==q?(Q=(0,X.jsxs)(F,{children:[q,Z]}),t[93]=F,t[94]=Z,t[95]=q,t[96]=Q):Q=t[96];let $;return t[97]!==I||t[98]!==L||t[99]!==R||t[100]!==Q?($=(0,X.jsx)(I,{defaultOpen:L,onOpenChange:R,children:Q}),t[97]=I,t[98]=L,t[99]=R,t[100]=Q,t[101]=$):$=t[101],$}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,X.jsxs)(`li`,{className:`break-words`,children:[(0,X.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.token}function de(){let e=u(e=>e.language),t=c(e),n=D(e=>e.setPageHeader),r=D(e=>e.clearPageHeader),o=R(),s=B(),[l,d]=i(),f=G(l.get(`tab`)),p=l.get(`q`)??``,[m,h]=(0,U.useState)(f),[g,_]=(0,U.useState)(p),[v,y]=(0,U.useState)(null),b=l.toString(),x=(0,U.useRef)(b);if(x.current!==b){x.current=b;let e=G(l.get(`tab`)),t=l.get(`q`)??``;h(t=>t===e?t:e),_(e=>e===t?e:t)}(0,U.useEffect)(()=>{d(e=>{let t=new URLSearchParams(e),n=g.trim();return n?t.set(`q`,n):t.delete(`q`),m===`marketplace`?t.delete(`tab`):t.set(`tab`,m),t.toString()===e.toString()?e:t},{replace:!0})},[m,g,d]);let S=(0,U.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),C=(0,U.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),E=m===`builtin`?S:C,k=(0,U.useMemo)(()=>{let t=g.trim().toLowerCase(),n=E;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[E,g,e]);if((0,U.useEffect)(()=>{y(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?fe(e)===fe(t)&&e.active===t.active?e:t:null})},[o]),(0,U.useLayoutEffect)(()=>(n({startExtra:null,main:(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(T,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,X.jsx)(O,{className:`size-4`}),(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,X.jsx)(T,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps/new`,children:[(0,X.jsx)(w,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&m!==`marketplace`)return(0,X.jsx)(ye,{});let A=m!==`marketplace`&&E.length>0;return(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,X.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,X.jsx)(H,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:S.length},{id:`user`,label:t.extensionsPage.tabUser,count:C.length}],activeTab:m,onChange:h,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),A?(0,X.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,X.jsx)(V,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:g,onChange:e=>_(e.target.value),placeholder:t.extensionsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),m===`marketplace`?(0,X.jsx)(Q,{}):m===`builtin`&&S.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):m===`user`&&C.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyUser}):k.length===0?(0,X.jsx)(`p`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-8 text-center text-sm text-fg-muted shadow-surface sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:k.map(e=>(0,X.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:m===`user`,onOpen:()=>y(e)},e.id))})]}),v?(0,X.jsx)(_e,{extension:v,copy:t.extensionsPage,onClose:()=>y(null)},v.id):null]})}function fe(e){return e.activationEligible??e.active}function pe(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function me(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function he(e,t){let n=fe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function ge(e){let t=(0,W.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,c;t[0]===n?c=t[1]:(c=fe(n),t[0]=n,t[1]=c);let l=c,u=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=s(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=d):d=t[2];let f=n.name||n.id,p;t[3]===f?p=t[4]:(p=f.charAt(0).toUpperCase(),t[3]=f,t[4]=p);let m;t[5]===p?m=t[6]:(m=(0,X.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:p}),t[5]=p,t[6]=m);let h;t[7]===n.name?h=t[8]:(h=(0,X.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=h);let g;t[9]===n.version?g=t[10]:(g=n.version?(0,X.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=g);let _;t[11]!==h||t[12]!==g?(_=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==r.statusEnabled||t[15]!==l?(v=l?(0,X.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,X.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,X.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,X.jsx)(w,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=l,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,X.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==u?(C=(0,X.jsx)(`span`,{title:u,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=u,t[27]=C):C=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,X.jsx)(`span`,{title:pe(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:me(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=T):T=t[31];let E;t[32]!==C||t[33]!==T?(E=(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,T]}),t[32]=C,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==y||t[36]!==x||t[37]!==E?(D=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,E]}),t[35]=y,t[36]=x,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==m?(O=(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[m,D]}),t[39]=D,t[40]=m,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,X.jsx)(`button`,{type:`button`,onClick:a,className:d,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function _e({extension:e,copy:t,onClose:n}){let{mutate:r}=m(),[i,o]=(0,U.useState)(!1),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(!1),f=e.activationEligible===!0,p=(0,U.useCallback)(async()=>{if(e.source===`bundled`){l(null),d(!1),o(!0);try{let{requiresGatewayRestart:t}=await J({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),g(),d(t)}catch(e){l(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),h=e.ui?.contributions?.pages??[],x=e.ui?.contributions?.settingsPanels??[],w=e.ui?.contributions?.chatWidgets??[],E=e.ui?.contributions?.sidebarPanels??[],D=h.find(e=>e.showInNav)??h[0],O=x[0],A=D?N(e.id,D):null,M=O?`/settings/ext/${e.id}/${O.id}`:e.hasConfigSchema||P(e)?`/settings/ext/${e.id}`:null;return(0,X.jsx)(k,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(b,{children:[(0,X.jsx)(ne,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,X.jsxs)(v,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,X.jsx)(_,{className:`size-5`})}),(0,X.jsx)(j,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,X.jsxs)(C,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,X.jsx)(y,{className:`size-5`})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,X.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,X.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,X.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,X.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,X.jsx)(T,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void p(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(re,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),c?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:c}):null,u?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,X.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(h.length>0||x.length>0||w.length>0)?(0,X.jsxs)(`section`,{className:`mt-8`,children:[(0,X.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,X.jsx)(ve,{template:t.badgePages,count:h.length,hidden:h.length===0}),(0,X.jsx)(ve,{template:t.badgeSettings,count:x.length,hidden:x.length===0}),(0,X.jsx)(ve,{template:t.badgeWidgets,count:w.length,hidden:w.length===0}),(0,X.jsx)(ve,{template:t.badgeSidebar,count:E.length,hidden:E.length===0})]})]}):null,L(e)&&(A||M)?(0,X.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[A?(0,X.jsxs)(a,{to:A,onClick:n,className:s(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,X.jsx)(S,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,M?(0,X.jsxs)(a,{to:M,onClick:n,className:s(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,X.jsx)(I,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,X.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,W.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,X.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function ye(){let e=(0,W.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,X.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,X.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,X.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(be)})]})}),e[4]=a):a=e[4],a}function be(e){return(0,X.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function xe(e){let t=(0,W.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{de as ExtensionsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,t as a}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-C96Zjb0V.js";import{l,n as u,o as d,r as f,s as p}from"./locale-store-C_ax27uc.js";import{a as m,i as h}from"./vendor-swr-BIWyz7Rc.js";import{Fr as g,Fu as _,Go as v,Is as y,Jo as b,Js as x,Kl as S,Ko as C,Nc as w,Ns as T,Nt as E,To as D,Tu as O,Uo as k,Wc as A,Yo as j,Ys as M,ao as N,co as P,gu as F,hc as I,lo as L,oo as R,pc as ee,qi as te,qo as ne,rl as re,ro as z,so as B,yc as V}from"./index-BhQMnKH1.js";import{t as H}from"./page-tabs-DU85jn98.js";var U=e(t(),1),W=n();function G(e){return e===`builtin`||e===`user`?e:`marketplace`}async function K(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ie(e){let t=await d(f(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await d(f(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await d(f(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function Y(e){let t=await d(f(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var X=r();function ae(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function Q({className:e}){let t=c(u(e=>e.language)).extensionsPage,n=l(e=>!!e.token),r=R(),{mutate:i}=m(),[a,o]=(0,U.useReducer)(E,Z),{q:d,debounced:_,detailPkg:v,rowBusy:y,actionError:b,restartHint:x}=a,S=n?`marketplace-${_}`:null;(0,U.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:d.trim()}}),300);return()=>window.clearTimeout(e)},[d]);let{data:C,isLoading:w,error:T}=h(S,async()=>p(_.length>0?f(`/api/marketplace?q=${encodeURIComponent(_)}`):f(`/api/marketplace`)),{revalidateOnFocus:!1}),D=(0,U.useCallback)(()=>{i(`gateway-extensions-list`),g()},[i]),O=(0,U.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await q({name:e,overwrite:n});D(),r.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,D]),k=(0,U.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await Y(e);D(),n.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,D]),j=C?.extensions??[];return(0,X.jsxs)(`div`,{className:s(`flex flex-col gap-4`,e),children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(V,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:d,onChange:e=>o({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),T?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:T instanceof Error?T.message:t.marketplaceLoadFailed}):null,b?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:b}):null,x?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:x}):null,w&&!C?(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,X.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,X.jsx)(z,{className:`h-5 w-40`}),(0,X.jsx)(z,{className:`h-4 w-full max-w-xl`}),(0,X.jsx)(z,{className:`h-4 w-2/3 max-w-md`})]}),(0,X.jsx)(z,{className:`h-8 w-20`})]})},e))}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,children:j.length===0?(0,X.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):j.map(e=>{let n=ae(r,e.id),i=y===e.id;return(0,X.jsx)(`li`,{className:`list-none`,children:(0,X.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o({type:`patch`,patch:{detailPkg:e.id}}))},className:s(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,X.jsx)(F,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,X.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,X.jsx)(A,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,X.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,X.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&k(e.id).catch(()=>{})},className:s(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,X.jsx)(re,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(M,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,X.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:s(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:t.marketplaceReview})})]})},e.id)})}),v?(0,X.jsx)($,{packageName:v,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:O,onUninstall:k}):null]})}function $(e){let t=(0,W.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:c,onUninstall:u}=e,[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),g=l(ue)?`ext-mp-detail-${n}`:null,S;t[0]===n?S=t[1]:(S=async()=>ie(n),t[0]=n,t[1]=S);let C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},t[2]=C):C=t[2];let{data:w,error:T,isLoading:E}=h(g,S,C),D;t[3]!==i||t[4]!==n?(D=ae(i,n),t[3]=i,t[4]=n,t[5]=D):D=t[5];let O=D,A=O===`user`,N=w?.manifest?.permissions,P,F,I,L,R,B,V,H,G,K,q;if(t[6]!==r.detailBack||t[7]!==r.detailClose||t[8]!==r.marketplaceAuthor||t[9]!==r.marketplaceCodeRisk||t[10]!==r.marketplaceDependencies||t[11]!==r.marketplaceDetailLoadFailed||t[12]!==r.marketplaceDetailReadmeHeading||t[13]!==r.marketplaceDetailTitle||t[14]!==r.marketplaceDownloads||t[15]!==r.marketplaceIntegrity||t[16]!==r.marketplaceIntegrityVerified||t[17]!==r.marketplaceLifecycleScripts||t[18]!==r.marketplaceLoadFailed||t[19]!==r.marketplaceLoading||t[20]!==r.marketplaceNoReadme||t[21]!==r.marketplacePermissions||t[22]!==r.marketplacePermissionsNone||t[23]!==r.marketplaceRiskConfirm||t[24]!==r.marketplaceRiskTitle||t[25]!==r.marketplaceUnavailableBody||t[26]!==r.marketplaceUnavailableTitle||t[27]!==r.marketplaceVersion||t[28]!==w||t[29]!==T||t[30]!==O||t[31]!==E||t[32]!==o||t[33]!==N||t[34]!==p){let e=N&&typeof N==`object`&&!Array.isArray(N)?Object.entries(N):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==w?(n=w?.readme?.trim()||(w?.description?.trim()?`### ${w.name}\n\n${w.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=w,t[48]=n):n=t[48];let i=n;I=k,L=!0,t[49]===o?R=t[50]:(R=e=>!e&&o(),t[49]=o,t[50]=R),F=b,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(ne,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=q):q=t[51],P=v,H=`fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,G=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(_,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,X.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:a}),t[53]=r.detailBack,t[54]=o,t[55]=s):s=t[55];let c;t[56]===r.marketplaceDetailTitle?c=t[57]:(c=(0,X.jsx)(j,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=c);let l;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(y,{className:`size-5`}),t[58]=l):l=t[58];let u;t[59]!==r.detailClose||t[60]!==o?(u=(0,X.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:l}),t[59]=r.detailClose,t[60]=o,t[61]=u):u=t[61],t[62]!==s||t[63]!==c||t[64]!==u?(K=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,c,u]}),t[62]=s,t[63]=c,t[64]=u,t[65]=K):K=t[65],B=`min-h-0 flex-1 overflow-y-auto p-5`,V=E&&!w?(0,X.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,X.jsx)(z,{className:`h-6 w-48`}),(0,X.jsx)(z,{className:`h-4 w-28`}),(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)(z,{className:`h-12`}),(0,X.jsx)(z,{className:`h-12`})]}),(0,X.jsx)(z,{className:`h-28 w-full`}),(0,X.jsx)(z,{className:`h-36 w-full`})]}):T?(0,X.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,X.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,X.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:T instanceof Error?T.message:r.marketplaceLoadFailed})]}):w?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:w.name}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:w.id})}),(0,X.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,X.jsx)(`dd`,{children:w.author.username})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,X.jsx)(`dd`,{children:w.latestVersion.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,X.jsx)(`dd`,{children:w.downloads})]})]}),O===`bundled`?null:(0,X.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[w.installability.available?(0,X.jsx)(ee,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,X.jsx)(x,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:w.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:w.installability.available?r.marketplaceCodeRisk:w.installability.reason??r.marketplaceUnavailableBody})]})]}),w.installability.available?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,X.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,X.jsx)(`dd`,{children:w.packageSummary?.dependencyCount??0})]})]}),(0,X.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,X.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,X.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(w.packageSummary?.lifecycleScripts.length??0)>0?(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,w.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,X.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),w.readme?.trim()?(0,X.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,X.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,X.jsx)(te,{content:i})})]}):null,t[6]=r.detailBack,t[7]=r.detailClose,t[8]=r.marketplaceAuthor,t[9]=r.marketplaceCodeRisk,t[10]=r.marketplaceDependencies,t[11]=r.marketplaceDetailLoadFailed,t[12]=r.marketplaceDetailReadmeHeading,t[13]=r.marketplaceDetailTitle,t[14]=r.marketplaceDownloads,t[15]=r.marketplaceIntegrity,t[16]=r.marketplaceIntegrityVerified,t[17]=r.marketplaceLifecycleScripts,t[18]=r.marketplaceLoadFailed,t[19]=r.marketplaceLoading,t[20]=r.marketplaceNoReadme,t[21]=r.marketplacePermissions,t[22]=r.marketplacePermissionsNone,t[23]=r.marketplaceRiskConfirm,t[24]=r.marketplaceRiskTitle,t[25]=r.marketplaceUnavailableBody,t[26]=r.marketplaceUnavailableTitle,t[27]=r.marketplaceVersion,t[28]=w,t[29]=T,t[30]=O,t[31]=E,t[32]=o,t[33]=N,t[34]=p,t[35]=P,t[36]=F,t[37]=I,t[38]=L,t[39]=R,t[40]=B,t[41]=V,t[42]=H,t[43]=G,t[44]=K,t[45]=q}else P=t[35],F=t[36],I=t[37],L=t[38],R=t[39],B=t[40],V=t[41],H=t[42],G=t[43],K=t[44],q=t[45];let J;t[66]!==B||t[67]!==V?(J=(0,X.jsx)(`div`,{className:B,children:V}),t[66]=B,t[67]=V,t[68]=J):J=t[68];let Y;t[69]!==d||t[70]!==r.marketplaceBuiltinGoBuiltin||t[71]!==r.marketplaceBuiltinManageHint||t[72]!==r.marketplaceInstall||t[73]!==r.marketplaceReinstall||t[74]!==r.marketplaceReinstallConfirm||t[75]!==r.marketplaceUninstall||t[76]!==r.marketplaceUninstallConfirm||t[77]!==w||t[78]!==O||t[79]!==o||t[80]!==c||t[81]!==u||t[82]!==n||t[83]!==p||t[84]!==A?(Y=w?(0,X.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:O===`bundled`?(0,X.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,X.jsx)(a,{to:`/extensions?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,disabled:d||!w.installability.available||!p,onClick:()=>{A&&!window.confirm(r.marketplaceReinstallConfirm)||(f(!0),c(n,A).catch(se).finally(()=>f(!1)))},className:s(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[d?(0,X.jsx)(re,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,A?r.marketplaceReinstall:r.marketplaceInstall]}),A?(0,X.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(f(!0),u(n).then(()=>o()).catch(oe).finally(()=>f(!1)))},className:s(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,X.jsx)(M,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=d,t[70]=r.marketplaceBuiltinGoBuiltin,t[71]=r.marketplaceBuiltinManageHint,t[72]=r.marketplaceInstall,t[73]=r.marketplaceReinstall,t[74]=r.marketplaceReinstallConfirm,t[75]=r.marketplaceUninstall,t[76]=r.marketplaceUninstallConfirm,t[77]=w,t[78]=O,t[79]=o,t[80]=c,t[81]=u,t[82]=n,t[83]=p,t[84]=A,t[85]=Y):Y=t[85];let Z;t[86]!==P||t[87]!==J||t[88]!==Y||t[89]!==H||t[90]!==G||t[91]!==K?(Z=(0,X.jsxs)(P,{className:H,onOpenAutoFocus:G,children:[K,J,Y]}),t[86]=P,t[87]=J,t[88]=Y,t[89]=H,t[90]=G,t[91]=K,t[92]=Z):Z=t[92];let Q;t[93]!==F||t[94]!==Z||t[95]!==q?(Q=(0,X.jsxs)(F,{children:[q,Z]}),t[93]=F,t[94]=Z,t[95]=q,t[96]=Q):Q=t[96];let $;return t[97]!==I||t[98]!==L||t[99]!==R||t[100]!==Q?($=(0,X.jsx)(I,{defaultOpen:L,onOpenChange:R,children:Q}),t[97]=I,t[98]=L,t[99]=R,t[100]=Q,t[101]=$):$=t[101],$}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,X.jsxs)(`li`,{className:`break-words`,children:[(0,X.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.token}function de(){let e=u(e=>e.language),t=c(e),n=D(e=>e.setPageHeader),r=D(e=>e.clearPageHeader),o=R(),s=B(),[l,d]=i(),f=G(l.get(`tab`)),p=l.get(`q`)??``,[m,h]=(0,U.useState)(f),[g,_]=(0,U.useState)(p),[v,y]=(0,U.useState)(null),b=l.toString(),x=(0,U.useRef)(b);if(x.current!==b){x.current=b;let e=G(l.get(`tab`)),t=l.get(`q`)??``;h(t=>t===e?t:e),_(e=>e===t?e:t)}(0,U.useEffect)(()=>{d(e=>{let t=new URLSearchParams(e),n=g.trim();return n?t.set(`q`,n):t.delete(`q`),m===`marketplace`?t.delete(`tab`):t.set(`tab`,m),t.toString()===e.toString()?e:t},{replace:!0})},[m,g,d]);let S=(0,U.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),C=(0,U.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),E=m===`builtin`?S:C,k=(0,U.useMemo)(()=>{let t=g.trim().toLowerCase(),n=E;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[E,g,e]);if((0,U.useEffect)(()=>{y(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?fe(e)===fe(t)&&e.active===t.active?e:t:null})},[o]),(0,U.useLayoutEffect)(()=>(n({startExtra:null,main:(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(T,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,X.jsx)(O,{className:`size-4`}),(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,X.jsx)(T,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps/new`,children:[(0,X.jsx)(w,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&m!==`marketplace`)return(0,X.jsx)(ye,{});let A=m!==`marketplace`&&E.length>0;return(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,X.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,X.jsx)(H,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:S.length},{id:`user`,label:t.extensionsPage.tabUser,count:C.length}],activeTab:m,onChange:h,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),A?(0,X.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,X.jsx)(V,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:g,onChange:e=>_(e.target.value),placeholder:t.extensionsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),m===`marketplace`?(0,X.jsx)(Q,{}):m===`builtin`&&S.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):m===`user`&&C.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyUser}):k.length===0?(0,X.jsx)(`p`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-8 text-center text-sm text-fg-muted shadow-surface sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:k.map(e=>(0,X.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:m===`user`,onOpen:()=>y(e)},e.id))})]}),v?(0,X.jsx)(_e,{extension:v,copy:t.extensionsPage,onClose:()=>y(null)},v.id):null]})}function fe(e){return e.activationEligible??e.active}function pe(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function me(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function he(e,t){let n=fe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function ge(e){let t=(0,W.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,c;t[0]===n?c=t[1]:(c=fe(n),t[0]=n,t[1]=c);let l=c,u=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=s(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=d):d=t[2];let f=n.name||n.id,p;t[3]===f?p=t[4]:(p=f.charAt(0).toUpperCase(),t[3]=f,t[4]=p);let m;t[5]===p?m=t[6]:(m=(0,X.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:p}),t[5]=p,t[6]=m);let h;t[7]===n.name?h=t[8]:(h=(0,X.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=h);let g;t[9]===n.version?g=t[10]:(g=n.version?(0,X.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=g);let _;t[11]!==h||t[12]!==g?(_=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==r.statusEnabled||t[15]!==l?(v=l?(0,X.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,X.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,X.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,X.jsx)(w,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=l,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,X.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==u?(C=(0,X.jsx)(`span`,{title:u,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=u,t[27]=C):C=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,X.jsx)(`span`,{title:pe(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:me(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=T):T=t[31];let E;t[32]!==C||t[33]!==T?(E=(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,T]}),t[32]=C,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==y||t[36]!==x||t[37]!==E?(D=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,E]}),t[35]=y,t[36]=x,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==m?(O=(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[m,D]}),t[39]=D,t[40]=m,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,X.jsx)(`button`,{type:`button`,onClick:a,className:d,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function _e({extension:e,copy:t,onClose:n}){let{mutate:r}=m(),[i,o]=(0,U.useState)(!1),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(!1),f=e.activationEligible===!0,p=(0,U.useCallback)(async()=>{if(e.source===`bundled`){l(null),d(!1),o(!0);try{let{requiresGatewayRestart:t}=await J({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),g(),d(t)}catch(e){l(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),h=e.ui?.contributions?.pages??[],x=e.ui?.contributions?.settingsPanels??[],w=e.ui?.contributions?.chatWidgets??[],E=e.ui?.contributions?.sidebarPanels??[],D=h.find(e=>e.showInNav)??h[0],O=x[0],A=D?N(e.id,D):null,M=O?`/settings/ext/${e.id}/${O.id}`:e.hasConfigSchema||P(e)?`/settings/ext/${e.id}`:null;return(0,X.jsx)(k,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(b,{children:[(0,X.jsx)(ne,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,X.jsxs)(v,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,X.jsx)(_,{className:`size-5`})}),(0,X.jsx)(j,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,X.jsxs)(C,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,X.jsx)(y,{className:`size-5`})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,X.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,X.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,X.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,X.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,X.jsx)(T,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void p(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(re,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),c?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:c}):null,u?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,X.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(h.length>0||x.length>0||w.length>0)?(0,X.jsxs)(`section`,{className:`mt-8`,children:[(0,X.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,X.jsx)(ve,{template:t.badgePages,count:h.length,hidden:h.length===0}),(0,X.jsx)(ve,{template:t.badgeSettings,count:x.length,hidden:x.length===0}),(0,X.jsx)(ve,{template:t.badgeWidgets,count:w.length,hidden:w.length===0}),(0,X.jsx)(ve,{template:t.badgeSidebar,count:E.length,hidden:E.length===0})]})]}):null,L(e)&&(A||M)?(0,X.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[A?(0,X.jsxs)(a,{to:A,onClick:n,className:s(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,X.jsx)(S,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,M?(0,X.jsxs)(a,{to:M,onClick:n,className:s(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,X.jsx)(I,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,X.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,W.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,X.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function ye(){let e=(0,W.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,X.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,X.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,X.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(be)})]})}),e[4]=a):a=e[4],a}function be(e){return(0,X.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function xe(e){let t=(0,W.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{de as ExtensionsPage};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-C96Zjb0V.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-Cq6aue5a.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-C96Zjb0V.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-CtchTuRQ.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-RnGYy9bC.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-zJ_50EbN.js";import{Qa as t}from"./index-CfOzvGDb.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if(o===`application/pdf`||a.toLowerCase().endsWith(`.pdf`)){let{processPdf:t}=await e(async()=>{let{processPdf:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPdf:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n,preview:r}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/pdf`,size:s,content:d,extractedText:n,preview:r}}if(o===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||a.toLowerCase().endsWith(`.docx`)){let{processDocx:t}=await e(async()=>{let{processDocx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processDocx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,size:s,content:d,extractedText:n}}if(o===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||a.toLowerCase().endsWith(`.pptx`)){let{processPptx:t}=await e(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,size:s,content:d,extractedText:n}}if([`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-excel`].includes(o)||a.toLowerCase().endsWith(`.xlsx`)||a.toLowerCase().endsWith(`.xls`)){let{processExcel:t}=await e(async()=>{let{processExcel:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processExcel:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:o&&o.startsWith(`application/vnd`)?o:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,size:s,content:d,extractedText:n}}if(o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}throw Error(`Unsupported file type: ${o}`)}export{n as loadAttachment};
2
+ import{t as e}from"./preload-helper-zJ_50EbN.js";import{Qa as t}from"./index-BhQMnKH1.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if(o===`application/pdf`||a.toLowerCase().endsWith(`.pdf`)){let{processPdf:t}=await e(async()=>{let{processPdf:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPdf:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n,preview:r}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/pdf`,size:s,content:d,extractedText:n,preview:r}}if(o===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||a.toLowerCase().endsWith(`.docx`)){let{processDocx:t}=await e(async()=>{let{processDocx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processDocx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,size:s,content:d,extractedText:n}}if(o===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||a.toLowerCase().endsWith(`.pptx`)){let{processPptx:t}=await e(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,size:s,content:d,extractedText:n}}if([`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-excel`].includes(o)||a.toLowerCase().endsWith(`.xlsx`)||a.toLowerCase().endsWith(`.xls`)){let{processExcel:t}=await e(async()=>{let{processExcel:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processExcel:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:o&&o.startsWith(`application/vnd`)?o:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,size:s,content:d,extractedText:n}}if(o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}throw Error(`Unsupported file type: ${o}`)}export{n as loadAttachment};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{l as n}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as r}from"./cn-JdwAhgNB.js";import{t as i}from"./messages-C96Zjb0V.js";import{n as a}from"./locale-store-C_ax27uc.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{Ns as s,b as c,fl as l,hu as u,lc as d,v as f,x as p,y as m}from"./index-CfOzvGDb.js";var h=e(),g=t();function _(e){let t=(0,h.c)(45),{title:p,description:_,prompt:x,coverage:S,className:C,variant:w}=e,T=w===void 0?`card`:w,E=a(b),D=i(E).automations.suggestions,O=i(E).automations,k=n(),A;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(A={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=A):A=t[0];let{data:j}=o(S?`automation-suggestion-coverage`:null,y,A),M=S?j?.automations.find(e=>c(e,S)):void 0,N=M?f(M,O):[];if(T===`titleAction`){if(M){let e;t[1]===C?e=t[2]:(e=r(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,C),t[1]=C,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,g.jsx)(u,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let i;return t[4]===k?i=t[5]:(i=()=>k(`/automations`),t[4]=k,t[5]=i),(0,g.jsxs)(`section`,{className:e,children:[n,(0,g.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:D.coveredTitle}),(0,g.jsx)(s,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:i,children:D.manage})]})}let e;t[6]===C?e=t[7]:(e=r(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,C),t[6]=C,t[7]=e);let n;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,g.jsx)(l,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=n):n=t[8];let i;t[9]!==_||t[10]!==p?(i=(0,g.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:_,children:p}),t[9]=_,t[10]=p,t[11]=i):i=t[11];let a;t[12]!==k||t[13]!==x?(a=()=>{k(`/automations?${new URLSearchParams({draft:x,autogenerate:`1`}).toString()}`)},t[12]=k,t[13]=x,t[14]=a):a=t[14];let o;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,g.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),t[15]=o):o=t[15],(0,g.jsxs)(`section`,{className:e,children:[n,i,(0,g.jsxs)(s,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:a,children:[o,D.create]})]})}if(M){let e;t[16]===C?e=t[17]:(e=r(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,C),t[16]=C,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,g.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let i;t[19]===k?i=t[20]:(i=()=>k(`/automations`),t[19]=k,t[20]=i);let a;return t[21]!==D||t[22]!==i?(a=(0,g.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,g.jsx)(s,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:i,children:D.manage})}),t[21]=D,t[22]=i,t[23]=a):a=t[23],(0,g.jsxs)(`section`,{className:e,children:[(0,g.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,g.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:D.coveredTitle}),(0,g.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:m(D.coveredDescription,{name:M.name})})]})]}),(0,g.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,g.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:O.explain.whyCovered}),(0,g.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:N.map(v)})]}),a]})}let P;t[24]===C?P=t[25]:(P=r(`rounded-lg bg-surface-panel p-3 shadow-surface`,C),t[24]=C,t[25]=P);let F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,g.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=F):F=t[26];let I;t[27]===p?I=t[28]:(I=(0,g.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:p}),t[27]=p,t[28]=I);let L;t[29]===_?L=t[30]:(L=(0,g.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:_}),t[29]=_,t[30]=L);let R;t[31]!==I||t[32]!==L?(R=(0,g.jsxs)(`div`,{className:`flex items-start gap-2`,children:[F,(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[I,L]})]}),t[31]=I,t[32]=L,t[33]=R):R=t[33];let z;t[34]!==k||t[35]!==x?(z=()=>{k(`/automations?${new URLSearchParams({draft:x,autogenerate:`1`}).toString()}`)},t[34]=k,t[35]=x,t[36]=z):z=t[36];let B;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,g.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),t[37]=B):B=t[37];let V;t[38]!==D.create||t[39]!==z?(V=(0,g.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,g.jsxs)(s,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:z,children:[B,D.create]})}),t[38]=D.create,t[39]=z,t[40]=V):V=t[40];let H;return t[41]!==V||t[42]!==P||t[43]!==R?(H=(0,g.jsxs)(`section`,{className:P,children:[R,V]}),t[41]=V,t[42]=P,t[43]=R,t[44]=H):H=t[44],H}function v(e){return(0,g.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function y(){return p.list()}function b(e){return e.language}export{_ as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{l as n}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as r}from"./cn-JdwAhgNB.js";import{t as i}from"./messages-C96Zjb0V.js";import{n as a}from"./locale-store-C_ax27uc.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{Ns as s,b as c,fl as l,hu as u,lc as d,v as f,x as p,y as m}from"./index-BhQMnKH1.js";var h=e(),g=t();function _(e){let t=(0,h.c)(45),{title:p,description:_,prompt:x,coverage:S,className:C,variant:w}=e,T=w===void 0?`card`:w,E=a(b),D=i(E).automations.suggestions,O=i(E).automations,k=n(),A;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(A={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=A):A=t[0];let{data:j}=o(S?`automation-suggestion-coverage`:null,y,A),M=S?j?.automations.find(e=>c(e,S)):void 0,N=M?f(M,O):[];if(T===`titleAction`){if(M){let e;t[1]===C?e=t[2]:(e=r(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,C),t[1]=C,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,g.jsx)(u,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let i;return t[4]===k?i=t[5]:(i=()=>k(`/automations`),t[4]=k,t[5]=i),(0,g.jsxs)(`section`,{className:e,children:[n,(0,g.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:D.coveredTitle}),(0,g.jsx)(s,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:i,children:D.manage})]})}let e;t[6]===C?e=t[7]:(e=r(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,C),t[6]=C,t[7]=e);let n;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,g.jsx)(l,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=n):n=t[8];let i;t[9]!==_||t[10]!==p?(i=(0,g.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:_,children:p}),t[9]=_,t[10]=p,t[11]=i):i=t[11];let a;t[12]!==k||t[13]!==x?(a=()=>{k(`/automations?${new URLSearchParams({draft:x,autogenerate:`1`}).toString()}`)},t[12]=k,t[13]=x,t[14]=a):a=t[14];let o;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,g.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),t[15]=o):o=t[15],(0,g.jsxs)(`section`,{className:e,children:[n,i,(0,g.jsxs)(s,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:a,children:[o,D.create]})]})}if(M){let e;t[16]===C?e=t[17]:(e=r(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,C),t[16]=C,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,g.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let i;t[19]===k?i=t[20]:(i=()=>k(`/automations`),t[19]=k,t[20]=i);let a;return t[21]!==D||t[22]!==i?(a=(0,g.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,g.jsx)(s,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:i,children:D.manage})}),t[21]=D,t[22]=i,t[23]=a):a=t[23],(0,g.jsxs)(`section`,{className:e,children:[(0,g.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,g.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:D.coveredTitle}),(0,g.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:m(D.coveredDescription,{name:M.name})})]})]}),(0,g.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,g.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:O.explain.whyCovered}),(0,g.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:N.map(v)})]}),a]})}let P;t[24]===C?P=t[25]:(P=r(`rounded-lg bg-surface-panel p-3 shadow-surface`,C),t[24]=C,t[25]=P);let F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,g.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=F):F=t[26];let I;t[27]===p?I=t[28]:(I=(0,g.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:p}),t[27]=p,t[28]=I);let L;t[29]===_?L=t[30]:(L=(0,g.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:_}),t[29]=_,t[30]=L);let R;t[31]!==I||t[32]!==L?(R=(0,g.jsxs)(`div`,{className:`flex items-start gap-2`,children:[F,(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[I,L]})]}),t[31]=I,t[32]=L,t[33]=R):R=t[33];let z;t[34]!==k||t[35]!==x?(z=()=>{k(`/automations?${new URLSearchParams({draft:x,autogenerate:`1`}).toString()}`)},t[34]=k,t[35]=x,t[36]=z):z=t[36];let B;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,g.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),t[37]=B):B=t[37];let V;t[38]!==D.create||t[39]!==z?(V=(0,g.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,g.jsxs)(s,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:z,children:[B,D.create]})}),t[38]=D.create,t[39]=z,t[40]=V):V=t[40];let H;return t[41]!==V||t[42]!==P||t[43]!==R?(H=(0,g.jsxs)(`section`,{className:P,children:[R,V]}),t[41]=V,t[42]=P,t[43]=R,t[44]=H):H=t[44],H}function v(e){return(0,g.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function y(){return p.list()}function b(e){return e.language}export{_ as t};