@xopcai/xopc 0.0.393 → 0.0.395
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-1AF2KGju.js → agent-avatar-dicebear-BRtkz-ZU.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Dqg2NOn-.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-cjJXJj_3.js → agent-plugin-dialog-CKK95Jmr.js} +1 -1
- package/dist/gateway/static/root/assets/agents-0zgLsfVA.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-B5aykqg_.js → agents-admin-api-BjGOUrAf.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B_MFhXXU.js → app-management-settings-panel-BZS8FvoL.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-TYGidVnd.js → appearance-settings-RxXMAxiB.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-mGU9WLjP.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BrFfEp0u.js → archive-plugin-DEnHq3OR.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-B7OofUPF.js → automations-page-BwkugzB8.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-K8aDhoYt.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BfAWnYG8.js → binary-plugins-NWeXhh1k.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-_Y-QwZ-3.js → block-editor-D_bKN3BN.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-DH9QHI9m.js → browser-automation-inputs-vtPkXfJ8.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-DBPbwOG8.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-VBZDYoXD.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-pt2M56-E.js → capabilities-CTfLd_UE.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-CQsGp9Sx.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C_OMsW_8.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-CFVx3iaZ.js → capability-header-actions-CMJXWq8a.js} +1 -1
- package/dist/gateway/static/root/assets/channels-C_TVCc1N.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D3GuiG3N.js → chat-terminal-dock-9YRAokOl.js} +16 -16
- package/dist/gateway/static/root/assets/computer-settings-page-BPYAZ4ks.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-CDyCHkpK.js → connector-service-page-B81cEAEX.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-C0NvAP2V.js +1 -0
- package/dist/gateway/static/root/assets/date-picker-BvKP4P3n.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-BVJh9sYc.js → dependency-picker-TvrNaf8y.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Q52A8vjp.js → desktop-pet-De-_QNSD.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CZr1CXxu.js → desktop-pet-settings-CRSRTIwT.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-D_WWTsze.js → device-pairing-wizard-DnyJ8Bja.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-C6cUgrvg.js → directory-picker-path-field-DOPXwYNR.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DyyfC4gA.js → extension-debug-page-DzXvpUwj.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Dho9o3ZZ.js → extension-page-C0S1zNeP.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CdnIGyCH.js → extension-settings-page-C3Z7bFjy.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BEePO3Wl.js → gateway-config-swr-Di9g6pE8.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-Dng_VOvI.js → gateway-realtime-2-o7qk92.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DQ6-whg-.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-Btc2wTQe.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CDCiy7Cd.js → gateway-startup-retry-BCUswcVy.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-BNpj_mIM.js → highlighted-body-KQOG7T2V-BFYBbh1P.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-C5sLR47Q.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-DwkO2y46.js → image-generation-api-Vqcyqnzb.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BrYvomnU.js → imports-page-BJGHrzhX.js} +1 -1
- package/dist/gateway/static/root/assets/index-BNRLzxpH.js +260 -0
- package/dist/gateway/static/root/assets/index-zIgp-ZTu.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BveDYfYk.js → keyboard-shortcuts-settings-BQkQoPmm.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DbxLz9Ms.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-B1a69mlV.js → local-apps-page-CaatwSrK.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-CYEDUPH7.js → local-session-drafts-BjwlkAKA.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CE7L6MlS.js → locale-store-Djl2FW6_.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-3Wo4Lmts.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-BHlbM8IM.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-PrKvVpRh.js → markdown-view-DyO7Q0Ms.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CR1fp6IL.js → media-plugins-Cq1uLrd8.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-XhlIBp5t.js +1 -0
- package/dist/gateway/static/root/assets/{messages-CaeL_miw.js → messages-DPxcWxfD.js} +2 -2
- package/dist/gateway/static/root/assets/note-detail-panel-MjKND8HC.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-Cv040hVD.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-Cn_WK68Y.js → page-context-capture-button-Cp71nTq2.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-CyEUWV2n.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-3NbiWGRG.js → preview-open-alternatives-gzCecXc4.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-KKE5-V8k.js → product-open-page-CWFT7VuQ.js} +1 -1
- package/dist/gateway/static/root/assets/product-preview-content-Dh111Kca.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-CyhyZiTi.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-QUdyJino.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BO2Ck3aA.js → registry-api-BwR2CiR5.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Cd8P0Dxs.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-B1sb8nlw.js → runtime-tools-api-C_VOMhLI.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-W0X_Fy7b.js → runtime-tools-settings-panel-bTjVfYm5.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DNM2Zdyr.js → schema-form-BGOzfVyj.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-CaAUJvu1.js → session-api-DbNNQps9.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-DoFTlgNz.js → session-manager-DfVviLTK.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BGMemJF6.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BiySFw1N.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DCSHPFAN.js → settings-form-section-Bqm1IKvR.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B18UbbaJ.js → settings-page-CniJVL-o.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-JPs4-QRw.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BLnS3hoH.js → share-preview-page-BnDGFgBR.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Cgp5BuLt.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-CcYGkRPL.js → skill-api-CFdrz6tl.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Cy5jVfms.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CxaA3P5E.js +2 -0
- package/dist/gateway/static/root/assets/sliding-indicator-hwz0sx3h.js +1 -0
- package/dist/gateway/static/root/assets/{style-BQqU-1pP.js → style-C_MAnir7.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-C974myUM.js → system-settings-panel-BjnIlilP.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-Bg79rPnF.js +2 -0
- package/dist/gateway/static/root/assets/{task-expandable-content-DTEVoNrM.js → task-expandable-content-D3i_51Oc.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-BCI0tUbe.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-DWyI3uA3.js → tunnel-api-0knnta9z.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-D5aT1eie.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-CY0YuljR.js → use-autosave-Ds_mbAfe.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-D7L0-pDt.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BNG4ixJE.js → voice-api-key-field-CPoGdarN.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-D0Wscn9W.js → voice-config-api-Ceo_hqZC.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CohIoAre.js → work-discovery-overlay-CWNguy2Z.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BcDMFfkT.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-BwZB-s4N.js +6 -0
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-C_COnY_B.js → xopc-cloud-account-card-DlKr98VO.js} +1 -1
- package/dist/gateway/static/root/index.html +16 -15
- package/dist/package.js +1 -1
- package/dist/src/agent/coding/run-verification.js +4 -4
- package/dist/src/agent/embedded/agent-profile-context.js +10 -4
- package/dist/src/agent/tools/exec-command.d.ts +2 -0
- package/dist/src/agent/tools/exec-command.js +45 -1
- package/dist/src/config/models-json.d.ts +16 -16
- package/dist/src/providers/cloud-thinking.d.ts +3 -0
- package/dist/src/providers/cloud-thinking.js +13 -0
- package/dist/src/providers/model-registry.js +3 -0
- package/dist/src/providers/register-runtime-providers.js +3 -0
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CPJr7NRR.js +0 -1
- package/dist/gateway/static/root/assets/agents-DW3TlnIg.js +0 -77
- package/dist/gateway/static/root/assets/apps-page-DOkyvOF0.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-DIod-bfm.js +0 -6
- package/dist/gateway/static/root/assets/browser-automations-page-B_SnD9B0.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-BPlqYpMM.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-BtzZvMIK.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-WzoG3oBb.js +0 -8
- package/dist/gateway/static/root/assets/channels-BXA55GY2.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-CIbHDlp8.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DA2b6cJu.js +0 -1
- package/dist/gateway/static/root/assets/date-picker-C424c_g9.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DtlBf7oH.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-D0KSQRNZ.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CH_A0W29.js +0 -2
- package/dist/gateway/static/root/assets/index-CKdOZoVu.js +0 -260
- package/dist/gateway/static/root/assets/index-Rxjt-jc3.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CcIi1BhT.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-Us1jv3C4.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-C9RAM7-s.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DQdcaMiu.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-Q4yRx9iZ.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-C9qu16IN.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-DrP6hEcg.js +0 -1
- package/dist/gateway/static/root/assets/product-preview-content-BM0oqNxi.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-CPZrwf8n.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-Besfx_07.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CTDghL5L.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-Dxtablvd.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-C7zklouD.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-JoSfluza.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DcIuPJK3.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-PnUZjoPK.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-D3JAw62U.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-CiljFekC.js +0 -2
- package/dist/gateway/static/root/assets/tracing-settings-page-DEE75MUn.js +0 -1
- package/dist/gateway/static/root/assets/usage-page-DJYvbxk7.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-eHZJD6Fw.js +0 -2
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BXI8eyYh.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-CVti0u-l.js +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./circle-check-C23XjkUj.js";import{t as i}from"./download-Dk-ZjtO6.js";import{t as a}from"./messages-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./circle-check-C23XjkUj.js";import{t as i}from"./download-Dk-ZjtO6.js";import{t as a}from"./messages-DPxcWxfD.js";import{n as o,r as s}from"./locale-store-Djl2FW6_.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{On as l,Wc as u,Xa as d,ds as f,fs as p,of as m,ou as h}from"./index-BNRLzxpH.js";import{n as g,r as _}from"./settings-page-layout-Dx5S-Msc.js";import{t as v}from"./settings-advanced-gate-BiySFw1N.js";import{i as y,n as b,r as x}from"./runtime-tools-api-C_VOMhLI.js";var S=e(t(),1);function C(e){return e?.trim()||void 0}function w(e,t,n){return e?.state===`ready`?C(t)!==C(n):!0}var T=n(),E=[`node`,`python`,`uv`];function D(){let e=a(o(e=>e.language)).runtimeToolsSettings,{data:t,error:n,isLoading:C,mutate:D}=c(s(`/api/runtime-tools`)),[O,k]=(0,S.useState)(null),[A,j]=(0,S.useState)(!1),[M,N]=(0,S.useState)(!1),[P,F]=(0,S.useState)({}),[I,L]=(0,S.useState)({}),[R,z]=(0,S.useState)(null),B=Object.values(P).some(Boolean);if((0,S.useEffect)(()=>{t?.payload.config&&k(structuredClone(t.payload.config))},[t?.payload.config]),n)return(0,T.jsxs)(_,{children:[(0,T.jsx)(g,{title:e.title,subtitle:e.loadError}),(0,T.jsx)(u,{onClick:()=>void D(),children:e.refresh})]});if(C||!O)return(0,T.jsx)(_,{children:(0,T.jsx)(l,{sections:3})});let V=new Map(t?.payload.statuses.map(e=>[e.runtime,e])),H=(e,t)=>k(n=>n&&{...n,[e]:{...n[e],...t}}),U=async()=>{j(!0),z(null);try{await y(O),await D()}catch(e){z(e instanceof Error?e.message:String(e))}finally{j(!1)}},W=async(e,t)=>{F(t=>({...t,[e]:!0})),z(null);try{await y(O),await x({runtime:e,action:t,version:e===`uv`?O.uv.version:O[e].version,onProgress:t=>L(n=>({...n,[e]:t}))}),await D()}catch(e){z(e instanceof Error?e.message:String(e))}finally{F(t=>({...t,[e]:!1}))}},G=async()=>{N(!0),z(null);try{await b(),await D()}catch(e){z(e instanceof Error?e.message:String(e))}finally{N(!1)}};return(0,T.jsxs)(_,{gap:`gap-6`,children:[(0,T.jsx)(g,{title:e.title,actions:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(d,{className:`size-9 shrink-0 p-0`,disabled:B,label:e.refresh,onClick:async()=>{await D()}}),(0,T.jsx)(u,{onClick:()=>void G(),disabled:M||B,children:M?e.pruning:e.prune}),(0,T.jsx)(u,{variant:`primary`,onClick:()=>void U(),disabled:A||B,children:A?e.saving:e.save})]})}),R?(0,T.jsx)(`div`,{className:`rounded-xl bg-danger/10 px-4 py-3 text-sm text-danger`,children:R}):null,(0,T.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:(0,T.jsxs)(`label`,{className:`flex items-center justify-between gap-4`,children:[(0,T.jsxs)(`span`,{children:[(0,T.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.enabled}),(0,T.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.enabledHint})]}),(0,T.jsx)(`input`,{type:`checkbox`,checked:O.enabled,onChange:e=>k({...O,enabled:e.target.checked}),className:`size-4 accent-accent`})]})}),(0,T.jsx)(v,{children:(0,T.jsxs)(`section`,{className:`grid gap-4 rounded-xl bg-surface-hover/20 p-4 md:grid-cols-2`,children:[(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.downloadSource,(0,T.jsxs)(f,{value:O.download.source,onChange:e=>k({...O,download:{...O.download,source:e.target.value}}),children:[(0,T.jsx)(p,{value:`auto`,children:e.downloadSources.auto}),(0,T.jsx)(p,{value:`website-only`,children:e.downloadSources.websiteOnly}),(0,T.jsx)(p,{value:`direct-only`,children:e.downloadSources.directOnly})]})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.gatewayBaseUrl,(0,T.jsx)(`input`,{value:O.download.gatewayBaseUrl,disabled:O.download.source===`direct-only`,onChange:e=>k({...O,download:{...O.download,gatewayBaseUrl:e.target.value}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong disabled:opacity-50`})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.offlineBundle,(0,T.jsx)(`input`,{value:O.download.bundleDir??``,placeholder:e.offlineBundlePlaceholder,onChange:e=>k({...O,download:{...O.download,bundleDir:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.proxy,(0,T.jsx)(`input`,{value:O.download.proxy??``,placeholder:`http://127.0.0.1:7890`,onChange:e=>k({...O,download:{...O.download,proxy:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]})]})}),(0,T.jsx)(`div`,{className:`flex flex-col gap-4`,children:E.map(n=>{let a=V.get(n),o=a?.state===`ready`,s=I[n],c=n===`uv`?O.uv:O[n],l=n===`uv`?t?.payload.config.uv:t?.payload.config[n],d=P[n]===!0,g=w(a,c.version,l?.version);return(0,T.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-5 rounded-xl bg-surface-base/55 p-5 sm:p-6`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e.runtimeNames[n]}),(0,T.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:a?.message??e.unknown})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o?(0,T.jsx)(r,{className:`size-5 shrink-0 text-success`}):(0,T.jsx)(m,{className:`size-5 shrink-0 text-warning`}),(0,T.jsx)(`input`,{type:`checkbox`,"aria-label":`${e.runtimeNames[n]} ${e.enabled}`,checked:c.enabled,onChange:e=>{n===`uv`?k({...O,uv:{...O.uv,enabled:e.target.checked}}):H(n,{enabled:e.target.checked})},className:`size-4 accent-accent`})]})]}),(0,T.jsxs)(`div`,{className:n===`uv`?`grid gap-4 md:grid-cols-[minmax(16rem,28rem)]`:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:[(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.version,(0,T.jsx)(`input`,{value:c.version??``,placeholder:a?.requestedVersion,onChange:e=>{let t=e.target.value||void 0;n===`uv`?k({...O,uv:{...O.uv,version:t}}):H(n,{version:t})},className:`h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),n===`uv`?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.sourcePolicy,(0,T.jsxs)(f,{value:O[n].preference,onChange:e=>H(n,{preference:e.target.value}),children:[(0,T.jsx)(p,{value:`managed-first`,children:e.preferences.managedFirst}),(0,T.jsx)(p,{value:`system-first`,children:e.preferences.systemFirst}),(0,T.jsx)(p,{value:`managed-only`,children:e.preferences.managedOnly}),(0,T.jsx)(p,{value:`system-only`,children:e.preferences.systemOnly})]})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.provisionPolicy,(0,T.jsxs)(f,{value:O[n].provision,onChange:e=>H(n,{provision:e.target.value}),children:[(0,T.jsx)(p,{value:`eager`,children:e.provisions.eager}),(0,T.jsx)(p,{value:`on-demand`,children:e.provisions.onDemand}),(0,T.jsx)(p,{value:`disabled`,children:e.provisions.disabled})]})]})]})]}),s&&d?(0,T.jsxs)(`div`,{className:`rounded-lg bg-accent-soft px-3 py-2 text-xs text-accent-fg`,children:[s.message,s.totalBytes&&s.downloadedBytes?` · ${Math.round(s.downloadedBytes/s.totalBytes*100)}%`:``]}):null,(0,T.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[g?(0,T.jsxs)(u,{variant:`primary`,disabled:!O.enabled||!c.enabled||d,onClick:()=>void W(n,`install`),children:[(0,T.jsx)(i,{className:`size-4`}),d?e.working:e.install]}):(0,T.jsxs)(`span`,{className:`inline-flex h-9 items-center gap-2 px-1 text-sm text-success`,children:[(0,T.jsx)(r,{className:`size-4`}),e.installed]}),a?.repairable?(0,T.jsxs)(u,{disabled:!O.enabled||!c.enabled||d,onClick:()=>void W(n,`repair`),children:[(0,T.jsx)(h,{className:`size-4`}),e.repair]}):null]}),(0,T.jsx)(v,{children:a?.resolved?.executable?(0,T.jsx)(`code`,{className:`break-all text-[11px] text-fg-subtle`,children:a.resolved.executable}):null})]})]},n)})})]})}export{D as RuntimeToolsSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-0WouolD0.js";import{Os as i,js as a,ls as o,us as s}from"./index-CKdOZoVu.js";import{t as c}from"./number-input-DDeqHK-G.js";var l=t();e();var u=n();function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function p(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function m(e){return e[`x-hidden`]===!0}function h(e){let t=e.properties;if(!d(t))return[];let n=[];for(let[e,r]of Object.entries(t))d(r)&&(m(r)||n.push({key:e,sub:r,order:f(r),group:p(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function g(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function _(e){let t=(0,l.c)(38),{name:n,s:r,value:s,onChange:c,disabled:d}=e,f=typeof r.description==`string`?r.description:void 0,p=(typeof r[`x-placeholder`]==`string`?r[`x-placeholder`]:null)||f,m=r.format;if(Array.isArray(r.enum)&&r.enum.every(y)){let e;t[0]===f?e=t[1]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let i;t[2]===c?i=t[3]:(i=e=>c(e.target.value),t[2]=c,t[3]=i);let a;t[4]===r.enum?a=t[5]:(a=r.enum.map(v),t[4]=r.enum,t[5]=a);let l;t[6]!==d||t[7]!==n||t[8]!==i||t[9]!==a||t[10]!==s?(l=(0,u.jsx)(o,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:s,disabled:d,onChange:i,children:a}),t[6]=d,t[7]=n,t[8]=i,t[9]=a,t[10]=s,t[11]=l):l=t[11];let p;return t[12]!==e||t[13]!==l?(p=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,l]}),t[12]=e,t[13]=l,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==c||t[19]!==p||t[20]!==s?(n=(0,u.jsx)(a,{value:s,onChange:c,placeholder:p,labels:i,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=c,t[19]=p,t[20]=s,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===c?g=t[28]:(g=e=>c(e.target.value),t[27]=c,t[28]=g);let _;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==s?(_=(0,u.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:s,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=s,t[34]=_):_=t[34];let b;return t[35]!==h||t[36]!==_?(b=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,_]}),t[35]=h,t[36]=_,t[37]=b):b=t[37],b}function v(e){return(0,u.jsx)(s,{value:e,children:e},e)}function y(e){return typeof e==`string`}function b(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let d=Number.isFinite(r)?r:0,f;t[2]===i?f=t[3]:(f=e=>i(Number(e.target.value)),t[2]=i,t[3]=f);let p;t[4]!==a||t[5]!==d||t[6]!==f?(p=(0,u.jsx)(c,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:d,disabled:a,onChange:f}),t[4]=a,t[5]=d,t[6]=f,t[7]=p):p=t[7];let m;return t[8]!==s||t[9]!==p?(m=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,p]}),t[8]=s,t[9]=p,t[10]=m):m=t[10],m}function x(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),c;t[0]===i?c=t[1]:(c=e=>i(e.target.checked),t[0]=i,t[1]=c);let d;t[2]!==a||t[3]!==c||t[4]!==r?(d=(0,u.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:c}),t[2]=a,t[3]=c,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,u.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,u.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function S(e){let t=(0,l.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,c=n.items,f=d(c)?c.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,u.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,u.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,u.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,u.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,u.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function C(e){let t=(0,l.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,c=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(c===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let l;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(l=(0,u.jsx)(x,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=l):l=t[9];let d;return t[10]!==e||t[11]!==l?(d=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,l]}),t[10]=e,t[11]=l,t[12]=d):d=t[12],d}if(c===`number`||c===`integer`){let e;t[13]===f?e=t[14]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,u.jsx)(b,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(c===`string`){let e;t[23]===f?e=t[24]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,u.jsx)(_,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let l;return t[31]!==e||t[32]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=l):l=t[33],l}if(c===`array`){let e=r.items,n=d(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(w)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,u.jsx)(S,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let l;return t[44]!==e||t[45]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=l):l=t[46],l}}if(c===`object`){let e;t[47]===i?e=t[48]:(e=d(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let l;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(l=(0,u.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,u.jsx)(T,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=l):l=t[56];let p;return t[57]!==c||t[58]!==l?(p=(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,l]}),t[57]=c,t[58]=l,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==c||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof c==`string`?c:void 0)??`${f}: unsupported field type${typeof c==`string`?` (${c})`:``}`,t[60]=s,t[61]=c,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function w(e){return typeof e==`string`||typeof e==`number`}function T(e){let t=(0,l.c)(28),{schema:n,values:i,onChange:a,disabled:o,className:s,labels:c}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=h(n),t[1]=n,t[2]=e),p=e}let m=p,_;bb1:{if(m.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===m?e=t[5]:(e=g(m),t[4]=m,t[5]=e),_=e}let v=_,y;t[6]!==a||t[7]!==i?(y=(e,t)=>{a({...i,[e]:t})},t[6]=a,t[7]=i,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!d(n.properties)||m.length===0)return null;let x,S;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==c||t[13]!==b||t[14]!==i){let e=Array.from(v.keys()).sort(E);t[17]===s?x=t[18]:(x=r(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==c||t[22]!==b||t[23]!==i?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,u.jsx)(C,{k:e.key,sub:e.sub,value:i[e.key],onValue:t=>b(e.key,t),disabled:f,labels:c},e.key));return e===``?(0,u.jsx)(`div`,{children:t},`default`):(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,u.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=c,t[22]=b,t[23]=i,t[24]=n):n=t[24],S=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=c,t[13]=b,t[14]=i,t[15]=x,t[16]=S}else x=t[15],S=t[16];let w;return t[25]!==x||t[26]!==S?(w=(0,u.jsx)(`div`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=w):w=t[27],w}function E(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{T as t};
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-0WouolD0.js";import{As as i,Ns as a,ds as o,fs as s}from"./index-BNRLzxpH.js";import{t as c}from"./number-input-DDeqHK-G.js";var l=t();e();var u=n();function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function p(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function m(e){return e[`x-hidden`]===!0}function h(e){let t=e.properties;if(!d(t))return[];let n=[];for(let[e,r]of Object.entries(t))d(r)&&(m(r)||n.push({key:e,sub:r,order:f(r),group:p(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function g(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function _(e){let t=(0,l.c)(38),{name:n,s:r,value:s,onChange:c,disabled:d}=e,f=typeof r.description==`string`?r.description:void 0,p=(typeof r[`x-placeholder`]==`string`?r[`x-placeholder`]:null)||f,m=r.format;if(Array.isArray(r.enum)&&r.enum.every(y)){let e;t[0]===f?e=t[1]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let i;t[2]===c?i=t[3]:(i=e=>c(e.target.value),t[2]=c,t[3]=i);let a;t[4]===r.enum?a=t[5]:(a=r.enum.map(v),t[4]=r.enum,t[5]=a);let l;t[6]!==d||t[7]!==n||t[8]!==i||t[9]!==a||t[10]!==s?(l=(0,u.jsx)(o,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:s,disabled:d,onChange:i,children:a}),t[6]=d,t[7]=n,t[8]=i,t[9]=a,t[10]=s,t[11]=l):l=t[11];let p;return t[12]!==e||t[13]!==l?(p=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,l]}),t[12]=e,t[13]=l,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==c||t[19]!==p||t[20]!==s?(n=(0,u.jsx)(a,{value:s,onChange:c,placeholder:p,labels:i,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=c,t[19]=p,t[20]=s,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===c?g=t[28]:(g=e=>c(e.target.value),t[27]=c,t[28]=g);let _;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==s?(_=(0,u.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:s,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=s,t[34]=_):_=t[34];let b;return t[35]!==h||t[36]!==_?(b=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,_]}),t[35]=h,t[36]=_,t[37]=b):b=t[37],b}function v(e){return(0,u.jsx)(s,{value:e,children:e},e)}function y(e){return typeof e==`string`}function b(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let d=Number.isFinite(r)?r:0,f;t[2]===i?f=t[3]:(f=e=>i(Number(e.target.value)),t[2]=i,t[3]=f);let p;t[4]!==a||t[5]!==d||t[6]!==f?(p=(0,u.jsx)(c,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:d,disabled:a,onChange:f}),t[4]=a,t[5]=d,t[6]=f,t[7]=p):p=t[7];let m;return t[8]!==s||t[9]!==p?(m=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,p]}),t[8]=s,t[9]=p,t[10]=m):m=t[10],m}function x(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),c;t[0]===i?c=t[1]:(c=e=>i(e.target.checked),t[0]=i,t[1]=c);let d;t[2]!==a||t[3]!==c||t[4]!==r?(d=(0,u.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:c}),t[2]=a,t[3]=c,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,u.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,u.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function S(e){let t=(0,l.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,c=n.items,f=d(c)?c.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,u.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,u.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,u.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,u.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,u.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function C(e){let t=(0,l.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,c=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(c===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let l;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(l=(0,u.jsx)(x,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=l):l=t[9];let d;return t[10]!==e||t[11]!==l?(d=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,l]}),t[10]=e,t[11]=l,t[12]=d):d=t[12],d}if(c===`number`||c===`integer`){let e;t[13]===f?e=t[14]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,u.jsx)(b,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(c===`string`){let e;t[23]===f?e=t[24]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,u.jsx)(_,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let l;return t[31]!==e||t[32]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=l):l=t[33],l}if(c===`array`){let e=r.items,n=d(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(w)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,u.jsx)(S,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let l;return t[44]!==e||t[45]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=l):l=t[46],l}}if(c===`object`){let e;t[47]===i?e=t[48]:(e=d(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let l;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(l=(0,u.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,u.jsx)(T,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=l):l=t[56];let p;return t[57]!==c||t[58]!==l?(p=(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,l]}),t[57]=c,t[58]=l,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==c||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof c==`string`?c:void 0)??`${f}: unsupported field type${typeof c==`string`?` (${c})`:``}`,t[60]=s,t[61]=c,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function w(e){return typeof e==`string`||typeof e==`number`}function T(e){let t=(0,l.c)(28),{schema:n,values:i,onChange:a,disabled:o,className:s,labels:c}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=h(n),t[1]=n,t[2]=e),p=e}let m=p,_;bb1:{if(m.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===m?e=t[5]:(e=g(m),t[4]=m,t[5]=e),_=e}let v=_,y;t[6]!==a||t[7]!==i?(y=(e,t)=>{a({...i,[e]:t})},t[6]=a,t[7]=i,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!d(n.properties)||m.length===0)return null;let x,S;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==c||t[13]!==b||t[14]!==i){let e=Array.from(v.keys()).sort(E);t[17]===s?x=t[18]:(x=r(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==c||t[22]!==b||t[23]!==i?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,u.jsx)(C,{k:e.key,sub:e.sub,value:i[e.key],onValue:t=>b(e.key,t),disabled:f,labels:c},e.key));return e===``?(0,u.jsx)(`div`,{children:t},`default`):(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,u.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=c,t[22]=b,t[23]=i,t[24]=n):n=t[24],S=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=c,t[13]=b,t[14]=i,t[15]=x,t[16]=S}else x=t[15],S=t[16];let w;return t[25]!==x||t[26]!==S?(w=(0,u.jsx)(`div`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=w):w=t[27],w}function E(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{T as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,r as t}from"./locale-store-
|
|
1
|
+
import{a as e,r as t}from"./locale-store-Djl2FW6_.js";import{d as n,g as r,h as i,i as a,l as o,p as s,r as c,s as l,t as u,u as d,v as f}from"./schemas-CObaziC7.js";import{t as p}from"./gateway-startup-retry-BCUswcVy.js";var m=f().transform(e=>e.toLowerCase()).brand(),h=s().trim().regex(/^[a-z0-9][a-z0-9._-]{0,127}$/i).brand(),g=u([`active`,`idle`,`archived`,`pinned`]),_=d({agentId:s().optional(),source:s().optional(),accountId:s().optional(),peerKind:s().optional(),peerId:s().optional(),threadId:s().optional(),scopeId:s().optional()}).passthrough();d({agentId:s().optional(),projectId:s().optional(),key:s(),transcriptId:h.optional(),name:s().optional(),title:s().optional(),displayName:s().optional(),messageCount:o(),updatedAt:s(),sourceChannel:s().optional(),status:g.optional(),usage:d({calls:o().int().nonnegative(),unknownCostCalls:o().int().nonnegative(),totalTokens:o().int().nonnegative(),knownCostUsd:s(),costCompleteness:u([`complete`,`partial`,`unknown`])}).optional(),routing:_.optional()}).passthrough();var v=d({items:c(r()),total:o(),limit:o(),offset:o(),hasMore:a()}),y=d({role:s(),content:r(),timestamp:i([s(),o()]).optional()}).passthrough(),b=d({key:s(),messages:c(y)}).passthrough(),x=d({session:b}),ee=d({session:d({key:s(),transcriptId:h.optional(),messages:c(y),name:s().optional(),status:g.optional(),sourceChannel:s().optional(),sourceChatId:s().optional(),projectId:s().optional(),customData:n(s(),r()).optional(),routing:_.optional()}).passthrough(),pagination:d({total:o(),limit:o(),offset:o(),hasMore:a(),before:s().optional(),nextBeforeCursor:s().optional(),revision:o().int().nonnegative().optional()}).passthrough()}).passthrough(),S=d({ok:l(!0),conversationId:f(),rowCount:o().int().nonnegative(),lastTurnId:s().min(1),session:b}).passthrough(),C=d({ok:a().optional(),payload:d({active:a(),runId:s().optional()}).passthrough().optional()}).passthrough(),w=d({ok:a().optional(),error:s().optional()}).passthrough(),T=w.extend({renamed:a().optional()}),E=w.extend({reset:a().optional(),transcriptId:h.optional(),previousTranscriptId:s().optional(),session:r().optional()}),D=d({totalSessions:o(),activeSessions:o(),archivedSessions:o(),pinnedSessions:o(),totalMessages:o(),totalTokens:o(),oldestSession:s().optional(),newestSession:s().optional(),byChannel:n(s(),o())}).passthrough();d({ok:a(),payload:d({conversationId:f(),transcriptId:h,session:r()}).passthrough().optional(),error:s().optional()}).passthrough();var O=d({ok:l(!0),projects:d({items:c(d({project:r(),sessions:c(r()),sessionTotal:o(),sessionHasMore:a()}).passthrough()),total:o(),limit:o(),offset:o(),hasMore:a()}),inbox:v,pinned:c(r()).default([]),layouts:n(s(),d({itemIds:c(s()),revision:o().int().nonnegative()})).default({}),childrenByConversationId:n(s(),d({total:o(),activeCount:o(),items:c(d({taskId:s(),title:s(),phase:s(),runStatus:s().optional(),activeConversationId:s().optional()}))})).default({})}).passthrough();function k(e){return x.parse(e)}function A(e){return ee.parse(e)}function j(e){return S.parse(e)}function M(e){return C.parse(e)}function N(e){return w.parse(e)}function P(e){return T.parse(e)}function F(e){return E.parse(e)}function I(e){return D.parse(e)}function L(e){return O.parse(e)}function R(e){let t=M(e).payload,n=typeof t?.runId==`string`?t.runId.trim():``;return!t?.active||!n?{active:!1}:{active:!0,runId:n}}function z(e){let t=new URLSearchParams;if(!e)return``;e.status&&t.set(`status`,e.status),e.search&&t.set(`search`,e.search),e.channel&&t.set(`channel`,e.channel),e.sources?.length&&t.set(`sources`,e.sources.join(`,`)),e.purposes?.length&&t.set(`purposes`,e.purposes.join(`,`)),e.activity&&t.set(`activity`,e.activity),e.agentId&&t.set(`agentId`,e.agentId),e.excludeArchived&&t.set(`excludeArchived`,`true`),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.updatedAfter!=null&&t.set(`updatedAfter`,String(e.updatedAfter)),e.includePinned&&t.set(`includePinned`,`true`),e.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId),e.rootConversationsOnly&&t.set(`rootConversationsOnly`,`true`),e.sessionTypes?.length&&t.set(`types`,e.sessionTypes.join(`,`)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}function B(e,t){let n=[];t?.includeTranscript&&n.push(`transcript`),t?.includeTranscriptRows&&n.push(`transcriptRows`);let r=n.length?`?include=${n.join(`,`)}`:``;return`/api/sessions/${encodeURIComponent(e)}${r}`}function V(e){return`/api/sessions/${encodeURIComponent(e)}/fork-at-turn`}function te(e,t){let n=new URLSearchParams;n.set(`limit`,String(t?.limit??50));let r=t?.before?.trim();return r?n.set(`before`,r):t?.offset!=null&&n.set(`offset`,String(t.offset)),`/api/sessions/${encodeURIComponent(e)}/history?${n.toString()}`}function H(e){return`/api/sessions/${encodeURIComponent(e)}/run`}function U(){return`/api/sessions/stats`}function W(e){let t=new URLSearchParams;e?.projectLimit!=null&&t.set(`projectLimit`,String(e.projectLimit)),e?.projectOffset!=null&&t.set(`projectOffset`,String(e.projectOffset)),e?.sessionPreviewLimit!=null&&t.set(`sessionPreviewLimit`,String(e.sessionPreviewLimit)),e?.inboxLimit!=null&&t.set(`inboxLimit`,String(e.inboxLimit)),e?.inboxOffset!=null&&t.set(`inboxOffset`,String(e.inboxOffset)),e?.staleDays!=null&&t.set(`staleDays`,String(e.staleDays)),e?.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId);let n=t.toString();return`/api/sidebar/chat-list${n?`?${n}`:``}`}function G(e){return`/api/sidebar/layouts/${encodeURIComponent(e)}`}function K(e,t){let n=encodeURIComponent(e);return t===`delete`?`/api/sessions/${n}`:`/api/sessions/${n}/${t}`}function q(e){return e?JSON.stringify({status:e.status,search:e.search,channel:e.channel,sources:e.sources,purposes:e.purposes,activity:e.activity,agentId:e.agentId,excludeArchived:e.excludeArchived,projectId:e.projectId,unassigned:e.unassigned,updatedAfter:e.updatedAfter,includePinned:e.includePinned,includeConversationId:e.includeConversationId,sessionTypes:e.sessionTypes,sortBy:e.sortBy,sortOrder:e.sortOrder,limit:e.limit,offset:e.offset}):`default`}var J=new Map;async function Y(e){let n=q(e),r=J.get(n);if(r)return r;let i=t(`/api/sessions${z(e)}`),a=(async()=>{let e=await p(i);if(!e.ok){let t=await e.json().catch(()=>({})),n=typeof t.error==`string`?t.error:t.error?.message;throw Error(n??`HTTP ${e.status}`)}return await e.json()})().finally(()=>{J.delete(n)});return J.set(n,a),a}async function X(n){return L(await e(t(W(n))))}async function Z(n){let r=await e(t(G(n.containerId)),{method:`PUT`,body:JSON.stringify({itemIds:n.itemIds,expectedRevision:n.expectedRevision})});if(!r.ok||!r.layout)throw Error(r.error??`Failed to save sidebar order`);return r.layout}async function Q(){return I(await e(t(U())))}async function ne(n,r){let i=k(await e(t(B(n,r))));if(!i.session)throw Error(`Session not found`);return i.session}async function re(n){let r=await e(t(`/api/sessions/resolve`),{method:`POST`,body:JSON.stringify(n)});if(!r.ok||!r.payload)throw Error(r.error??`Session not found`);return r.payload}async function ie(n){N(await e(t(K(n,`delete`)),{method:`DELETE`}))}async function ae(n,r){return{renamed:P(await e(t(K(n,`rename`)),{method:`POST`,body:JSON.stringify({name:r})})).renamed===!0}}async function oe(n){N(await e(t(K(n,`archive`)),{method:`POST`}))}async function $(n){N(await e(t(K(n,`unarchive`)),{method:`POST`}))}async function se(n){N(await e(t(K(n,`pin`)),{method:`POST`}))}async function ce(n){N(await e(t(K(n,`unpin`)),{method:`POST`}))}async function le(n){return(await e(t(`/api/sessions/${encodeURIComponent(n)}/export?format=json`))).content}export{R as _,ne as a,F as b,se as c,Z as d,$ as f,H as g,te as h,X as i,ae as l,V as m,ie as n,Q as o,ce as p,le as r,Y as s,oe as t,re as u,j as v,m as x,A as y};
|
package/dist/gateway/static/root/assets/{session-manager-DoFTlgNz.js → session-manager-DfVviLTK.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./messages-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./messages-DPxcWxfD.js";import{c as n,i as r,n as i,p as a,r as o,u as s}from"./locale-store-Djl2FW6_.js";import{d as c,g as l,i as u,l as d,p as f,r as p,s as m,t as h,u as g}from"./schemas-CObaziC7.js";import{i as _,n as v}from"./constants-DeXt1mV-.js";import{_ as ee,b as y,g as b,h as x,m as S,s as C,v as w,y as te}from"./session-api-DbNNQps9.js";import{_ as ne,a as T,c as re,d as ie,f as ae,i as oe,l as E,o as se,p as ce,r as le,s as ue,t as de,u as fe}from"./local-session-drafts-BjwlkAKA.js";import{t as D}from"./tool-activity-BtJkgjFf.js";import{a as pe}from"./attachment-utils-core-BIOUBrpT.js";import{a as me}from"./gateway-realtime-2-o7qk92.js";import{t as he}from"./gateway-startup-retry-BCUswcVy.js";import{n as ge}from"./registry-api-BwR2CiR5.js";import{a as _e}from"./agents-admin-api-BjGOUrAf.js";var ve=[0,500,1500],ye=1e4;function be(e){let t=[e.content,e.thinking??null,e.attachments??null,e.contextRefs??null,e.browserContexts??null];e.appContext!==void 0&&t.push(e.appContext);let n=JSON.stringify(t),r=2166136261,i=5381;for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);r^=t,r=Math.imul(r,16777619),i=Math.imul(i,33)^t}return`${n.length.toString(36)}:${(r>>>0).toString(36)}:${(i>>>0).toString(36)}`}function xe(e){return e===408||e===429||e>=500}var Se=/^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}[^\]]*\]\s*/u,Ce=[`user-profile`,`active-focuses`,`collaboration-contract`,`user-context`];function we(e,t){let n=`<${t}>`;if(!e.startsWith(n))return null;let r=`</${t}>`,i=e.indexOf(r,n.length);return i<0?null:e.slice(i+r.length).trimStart()}function Te(e){return Se.test(e)||e.startsWith(`<source_contexts>`)||Ce.some(t=>e.startsWith(`<${t}>`))}function Ee(e){if(!e.includes(`<source_contexts>`))return e;let t=e.replace(/^\s*<source_contexts>[\s\S]*?<\/source_contexts>\s*/u,``).trimStart();return t.match(/^<user_message>\r?\n([\s\S]*)\r?\n<\/user_message>\s*$/u)?.[1]??t}function De(e){let t=e,n=we(t.trimStart(),`xopc_task_execution`);n!==null&&Te(n)&&(t=n),t=Ee(t);let r=t,i=!1;for(t=t.trimStart();;){let e=Ce.find(e=>t.startsWith(`<${e}>`));if(!e)break;let n=we(t,e);if(n===null){t=r,i=!1;break}t=n,i=!0}return i&&!Se.test(t)&&(t=r),t.replace(Se,``)}function Oe(e){return!e.includes(`[media attached:`)&&!e.includes(`xopc-media-uri:`)?e:e.replace(/\s*\[media attached:[^\]]+\]\s*\r?\nxopc-media-uri:[^\r\n]+\r?\n\s*xopc-media-path:[^\r\n]+(?:\r?\n\s*Use the read_media tool[^\r\n]*)?/g,``).replace(/\s*\[media attached:[^\]]+\]\s*/g,` `).replace(/\s*xopc-media-uri:[^\r\n]+/g,``).replace(/\s*xopc-media-path:[^\r\n]+/g,``).replace(/\s*Use the read_media tool[^\r\n]*/g,``).replace(/\n{3,}/g,`
|
|
2
2
|
|
|
3
3
|
`).trim()}var ke=`@xopc-ref:`,Ae=`[A-Za-z0-9_-]{1,64}`,je=RegExp(`${ke}(${Ae})`,`g`);function Me(e){if(!RegExp(`^${Ae}$`).test(e))throw Error(`Invalid context reference id`);return`${ke}${e}`}function Ne(){return new RegExp(je.source,`g`)}function Pe(e){let t=[],n=Ne(),r=0,i;for(;(i=n.exec(e))!==null;)i.index>r&&t.push({type:`text`,text:e.slice(r,i.index)}),t.push({type:`context_ref`,refId:i[1]??``}),r=i.index+i[0].length;return t.length===0?null:(r<e.length&&t.push({type:`text`,text:e.slice(r)}),{version:1,parts:t})}function Fe(e){return e.parts.flatMap(e=>e.type===`context_ref`?[e.refId]:[])}function Ie(e,t){return e.parts.map(e=>{if(e.type===`text`)return e.text;let n=t(e.refId)?.trim();return n?`@${n}`:``}).join(``)}function Le(e){return e.parts.map(e=>e.type===`text`?e.text:Me(e.refId)).join(``)}function Re(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.version!==1||!Array.isArray(t.parts)?!1:t.parts.every(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.type===`text`?typeof t.text==`string`:t.type===`context_ref`&&typeof t.refId==`string`&&RegExp(`^${Ae}$`).test(t.refId)})}var ze=8e3,Be=g({interactionMode:h([`quick`,`compose`]).optional(),choiceDetails:p(g({id:f().min(1).max(160),label:f().trim().min(1).max(1e3),description:f().max(2e3).optional()}).strict()).min(2).max(10).optional(),recommendedChoiceId:f().min(1).max(160).optional(),approval:g({operation:f().min(1).max(1e3),target:f().max(2e3).optional(),impact:f().max(4e3).optional(),argumentsPreview:c(f(),l()).optional()}).strict().optional()}),Ve=g({response:g({choiceId:f().min(1).max(160).optional(),text:f().trim().max(ze).optional()}).strict().optional(),decision:h([`approve`,`deny`]).optional()}).strict();Ve.extend({action:h([`answer`,`agent_decide`,`cancel`]),expectedVersion:d().int().positive(),idempotencyKey:f().trim().min(1).max(256)}).strict();function He(e){let t=Be.safeParse(e);return t.success?t.data:{}}function Ue(e,t){let n=Ve.parse(t);if(e.kind===`approval`){if(n.response||!n.decision)throw Error(`An explicit approval decision is required`);return{answer:n.decision,decision:n.decision}}if(n.decision||!n.response)throw Error(`A structured response is required`);let r=n.response.choiceId?e.choiceDetails?.find(e=>e.id===n.response.choiceId):void 0;if(n.response.choiceId&&!r)throw Error(`Unknown clarification choice`);let i=n.response.text?.trim()??``;if(!r&&!i)throw Error(`Answer is required`);return{answer:r&&i?`Choice: ${r.label}\nAdditional information: ${i}`:r?.label??i,response:{...r?{choiceId:r.id}:{},...i?{text:i}:{}}}}var We=g({version:m(1),deliveryId:f().min(1),taskId:f().min(1),taskRunId:f().min(1),taskTitle:f().min(1).max(500),conversationId:f().min(1),originTranscriptId:f().min(1),requestInputId:f().optional(),assignmentEpoch:d().int().nonnegative(),resultRevision:d().int().positive().optional(),previousResultId:f().optional(),contractVersion:d().int().positive().optional(),instructionSequence:d().int().nonnegative().optional(),adoption:p(g({entryId:f(),sequence:d().int(),status:h([`applied`,`partially_applied`,`not_applied`,`superseded`]),verification:h([`passed`,`failed`,`unverified`]),claimIds:p(f()),note:f()})).optional(),outcome:v,text:f().optional(),createdAt:d()});function Ge(e){let t=We.safeParse(e);return t.success?t.data:void 0}var Ke=g({outreachId:f().uuid(),reasonKind:h([`follow_up`,`discussion`,`change`,`prepared`]),authority:h([`user_explicit`,`inferred`])}).strict();g({version:m(1),outreachId:f().uuid(),threadId:f().uuid(),conversationId:f().uuid(),originTranscriptId:f().min(1),text:f().trim().min(1).max(12e3),provenance:Ke,createdAt:d().int().nonnegative()}).strict();var qe=g({revision:d().int().positive().default(1),mode:h([`off`,`follow_up`,`balanced`]).default(`balanced`),timezone:f().max(100).default(`Asia/Shanghai`).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Invalid timezone`),quietStart:d().int().min(0).max(23).default(22),quietEnd:d().int().min(0).max(23).default(8),dailyMessages:d().int().min(0).max(10).default(2),dailyModelCalls:d().int().min(0).max(100).default(12)}).strict();g({idempotencyKey:f().min(1).max(200),kind:h([`helpful`,`irrelevant`,`stop`,`defer`,`adjust`]),scope:h([`message`,`thread`]).default(`message`),until:d().int().positive().optional(),preparation:h([`brief`,`thorough`]).optional()}).strict().superRefine((e,t)=>{e.kind===`defer`&&!e.until&&t.addIssue({code:`custom`,message:`A defer time is required`}),e.kind===`adjust`&&!e.preparation&&t.addIssue({code:`custom`,message:`A preparation preference is required`}),(e.kind===`stop`||e.kind===`adjust`)&&e.scope!==`thread`&&t.addIssue({code:`custom`,message:`A lasting change requires thread scope`})}),g({versionId:f().uuid(),revision:d().int().positive(),idempotencyKey:f().min(1).max(200)}).strict();var Je=g({preparation:h([`brief`,`thorough`]).nullable(),versions:p(g({id:f().uuid(),revision:d().int().positive(),kind:h([`stop`,`defer`,`adjust`,`rollback`]),createdAt:d(),preparation:h([`brief`,`thorough`]).nullable()}))});g({id:f().uuid(),subject:f(),summary:f(),status:h([`candidate`,`completed`,`expired`]),confidence:d().min(0).max(1),independentStatements:d().int(),independentDays:d().int(),lastSupportedAt:d(),expiresAt:d(),sources:p(g({entryId:f(),excerpt:f(),observedAt:d()}))});var Ye=g({provenance:Ke,thread:g({id:f(),subject:f(),status:f(),revision:d(),nextCheckAt:d().nullable()}),whyNow:f(),sources:p(g({conversationId:f(),transcriptId:f(),entryId:f(),excerpt:f()})),sourcesAvailable:u(),strategy:Je.optional()});function Xe(e){return typeof e==`object`&&!!e&&`role`in e}function Ze(e){if(!e||typeof e!=`object`)return!1;let t=e.type;return t===`tool_use`||t===`tool_call`||t===`toolCall`}function Qe(e){return typeof e==`object`&&!!e}function $e(e){return typeof e.id==`string`&&e.id.length>0?e.id:crypto.randomUUID()}function et(e){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}}function tt(e){return et(e.args??e.arguments??e.input??e.function?.arguments)??{}}function nt(e){if(typeof e==`string`){let t=Date.parse(e);return Number.isNaN(t)?Date.now():t}return Date.now()}function rt(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`)return;let t=Date.parse(e);return Number.isNaN(t)?void 0:t}function it(e){if(Array.isArray(e))return e.map(e=>at(e))}function at(e){if(!e||typeof e!=`object`)return{name:`file`,mimeType:`application/octet-stream`};let t=e,n=ot(t.uri),r=st(t.name),i=ct(t.mimeType,r),a=typeof t.type==`string`?t.type:void 0,o=a===`photo`||a===`image`||i.startsWith(`image/`)?`image`:a===`voice`||a===`audio`||i.startsWith(`audio/`)?`voice`:a;return{id:typeof t.id==`string`?t.id:void 0,name:r,mimeType:i,type:o,size:typeof t.size==`number`?t.size:void 0,uri:n,bucket:typeof t.bucket==`string`?t.bucket:void 0,path:typeof t.path==`string`?t.path:void 0}}function ot(e){return typeof e==`string`&&e.trim().startsWith(`media://`)?e.trim():void 0}function st(e){return typeof e==`string`&&e.trim().length>0?e.trim():`file`}function ct(e,t){if(typeof e==`string`&&e.trim().length>0){let t=e.trim();if(t.toLowerCase().split(`;`)[0]?.trim()!==`application/octet-stream`)return t}return pe(t)??`application/octet-stream`}function lt(e){let t=e.uri?.trim();return t?`uri:${t}`:e.id?`id:${e.id}`:`name:${e.name??`file`}|${e.mimeType??``}`}function ut(e){if(!e?.length)return;let t=[],n=new Set;for(let r of e){let e=lt(r);n.has(e)||(n.add(e),t.push(r))}return t.length?t:void 0}var dt=`[Startup context loaded by runtime]`,ft=`...[additional startup memory truncated]...`,pt=`END_QUOTED_NOTES`;function mt(...e){return e.filter(e=>e.length>0).join(`
|
|
4
4
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{g as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./download-Dk-ZjtO6.js";import{t as o}from"./folder-open-CyzJ19I9.js";import{t as s}from"./plus-Q2yW6OE7.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./messages-DPxcWxfD.js";import{t as u}from"./cn-0WouolD0.js";import{a as d,c as f,n as p,r as m}from"./locale-store-Djl2FW6_.js";import{a as h,n as g,o as _,r as ee,s as v,t as te}from"./dist-BGTk37IG.js";import{a as y,c as b,f as ne,n as x,o as S,p as C,r as w,s as T,t as E}from"./session-api-DbNNQps9.js";import{i as D}from"./vendor-swr-BIWyz7Rc.js";import{n as O,r as k}from"./gateway-config-swr-Di9g6pE8.js";import{n as A,t as j}from"./registry-api-BwR2CiR5.js";import{$i as M,$t as N,Al as P,Ao as F,Fc as I,G as L,Ic as R,Iu as z,No as B,Of as re,Pu as V,Qd as ie,Ql as ae,Qt as oe,Rc as H,Rd as U,Rs as se,Ud as ce,Wc as W,_u as G,do as le,ds as K,eo as ue,fs as q,id as de,is as fe,kf as pe,nd as me,no as he,nu as ge,so as _e,td as ve,to as ye,uo as be,vs as xe,vu as Se,ys as Ce}from"./index-BNRLzxpH.js";import{t as J}from"./number-input-DDeqHK-G.js";import{n as we,r as Te}from"./settings-page-layout-Dx5S-Msc.js";import{n as Ee,t as Y}from"./settings-form-section-Bqm1IKvR.js";import{n as De,t as Oe}from"./use-autosave-Ds_mbAfe.js";import{t as ke}from"./settings-advanced-gate-BiySFw1N.js";var X=e(t(),1),Ae=n(),Z=r();function je(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function Me(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`).format(e)}function Ne(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function Pe(e){let t=(0,Ae.c)(124),{session:n,variant:r,labels:i,sessionAgentId:o,sessionAgentAvatar:s,onOpen:c,onAction:d}=e,f;t[0]!==i.unnamedSession||t[1]!==n.name?(f=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=f):f=t[2];let m=f,h=p(Re),g;t[3]!==h||t[4]!==n?(g=le(n,l(h).sidebar.sessionFilters),t[3]=h,t[4]=n,t[5]=g):g=t[5];let _=g,ee;t[6]===n.name?ee=t[7]:(ee=n.name?.trim(),t[6]=n.name,t[7]=ee);let v=!!ee,te=n.status===`archived`,y=n.status===`pinned`,b=n.usage,ne;t[8]!==i.costUnknown||t[9]!==i.noUsage||t[10]!==b?(ne=b?.calls?b.costCompleteness===`unknown`?i.costUnknown:`${b.costCompleteness===`partial`?`≥ `:`≈ `}${Ne(b.knownCostUsd)}`:i.noUsage,t[8]=i.costUnknown,t[9]=i.noUsage,t[10]=b,t[11]=ne):ne=t[11];let x=ne,S=b?.calls?b.costCompleteness===`partial`?i.costPartial:b.costCompleteness===`unknown`?i.costUnknown:i.cost:i.noUsage,C=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,w;t[12]===C?w=t[13]:(w=u(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,C),t[12]=C,t[13]=w);let T;t[14]===c?T=t[15]:(T=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[14]=c,t[15]=T);let E=r===`list`&&`sm:py-3`,D;t[16]===E?D=t[17]:(D=u(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,E),t[16]=E,t[17]=D);let O;t[18]===n?O=t[19]:(O=(0,Z.jsx)(be,{sourceChannel:n.sourceChannel,session:n,className:`size-3.5`}),t[18]=n,t[19]=O);let k;t[20]===_?k=t[21]:(k=(0,Z.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:_}),t[20]=_,t[21]=k);let A;t[22]!==O||t[23]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[O,k]}),t[22]=O,t[23]=k,t[24]=A):A=t[24];let j;t[25]===y?j=t[26]:(j=y?(0,Z.jsx)(Se,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[25]=y,t[26]=j);let M;t[27]===n.updatedAt?M=t[28]:(M=je(n.updatedAt),t[27]=n.updatedAt,t[28]=M);let N;t[29]===M?N=t[30]:(N=(0,Z.jsx)(`span`,{children:M}),t[29]=M,t[30]=N);let F;t[31]!==j||t[32]!==N?(F=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[j,N]}),t[31]=j,t[32]=N,t[33]=F):F=t[33];let L;t[34]!==A||t[35]!==F||t[36]!==D?(L=(0,Z.jsxs)(`div`,{className:D,children:[A,F]}),t[34]=A,t[35]=F,t[36]=D,t[37]=L):L=t[37];let R=r===`list`&&`sm:py-3`,V;t[38]===R?V=t[39]:(V=u(`min-w-0 flex-1 px-3 py-2`,R),t[38]=R,t[39]=V);let ie=r===`list`&&`sm:items-start`,ae;t[40]===ie?ae=t[41]:(ae=u(`flex gap-3`,ie),t[40]=ie,t[41]=ae);let oe;t[42]!==s||t[43]!==o?(oe=(0,Z.jsx)(B,{agentId:o,avatar:s,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[42]=s,t[43]=o,t[44]=oe):oe=t[44];let H;t[45]===m?H=t[46]:(H=(0,Z.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:m,children:m}),t[45]=m,t[46]=H);let se;t[47]!==n.key||t[48]!==v?(se=v?(0,Z.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[47]=n.key,t[48]=v,t[49]=se):se=t[49];let W;t[50]!==H||t[51]!==se?(W=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[H,se]}),t[50]=H,t[51]=se,t[52]=W):W=t[52];let K;t[53]!==ae||t[54]!==oe||t[55]!==W?(K=(0,Z.jsxs)(`div`,{className:ae,children:[oe,W]}),t[53]=ae,t[54]=oe,t[55]=W,t[56]=K):K=t[56];let ue;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(z,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[57]=ue):ue=t[57];let q;t[58]===n.messageCount?q=t[59]:(q=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[ue,n.messageCount]}),t[58]=n.messageCount,t[59]=q);let de;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(U,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[60]=de):de=t[60];let fe=b?.totalTokens??0,me;t[61]!==h||t[62]!==fe?(me=Me(fe,h),t[61]=h,t[62]=fe,t[63]=me):me=t[63];let he;t[64]!==i.tokens||t[65]!==me?(he=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[de,me,` `,i.tokens]}),t[64]=i.tokens,t[65]=me,t[66]=he):he=t[66];let ge;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(ce,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[67]=ge):ge=t[67];let _e;t[68]!==x||t[69]!==S?(_e=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:S,children:[ge,x]}),t[68]=x,t[69]=S,t[70]=_e):_e=t[70];let ve;t[71]!==q||t[72]!==he||t[73]!==_e?(ve=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[q,he,_e]}),t[71]=q,t[72]=he,t[73]=_e,t[74]=ve):ve=t[74];let ye;t[75]===n.tags?ye=t[76]:(ye=n.tags.length>0?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Le),n.tags.length>3?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[75]=n.tags,t[76]=ye);let xe;t[77]!==V||t[78]!==K||t[79]!==ve||t[80]!==ye?(xe=(0,Z.jsxs)(`div`,{className:V,children:[K,ve,ye]}),t[77]=V,t[78]=K,t[79]=ve,t[80]=ye,t[81]=xe):xe=t[81];let Ce;t[82]===d?Ce=t[83]:(Ce=()=>d(`continue`),t[82]=d,t[83]=Ce);let J;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(z,{className:`size-4`,strokeWidth:1.75}),t[84]=J):J=t[84];let we;t[85]!==i.continueChat||t[86]!==Ce?(we=(0,Z.jsx)(`button`,{type:`button`,className:I,title:i.continueChat,"aria-label":i.continueChat,onClick:Ce,children:J}),t[85]=i.continueChat,t[86]=Ce,t[87]=we):we=t[87];let Te;t[88]!==te||t[89]!==i.archive||t[90]!==i.unarchive||t[91]!==d?(Te=te?(0,Z.jsx)(`button`,{type:`button`,className:I,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>d(`unarchive`),children:(0,Z.jsx)(pe,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:I,title:i.archive,"aria-label":i.archive,onClick:()=>d(`archive`),children:(0,Z.jsx)(re,{className:`size-4`,strokeWidth:1.75})}),t[88]=te,t[89]=i.archive,t[90]=i.unarchive,t[91]=d,t[92]=Te):Te=t[92];let Ee;t[93]!==y||t[94]!==i.pin||t[95]!==i.unpin||t[96]!==d?(Ee=y?(0,Z.jsx)(`button`,{type:`button`,className:I,title:i.unpin,"aria-label":i.unpin,onClick:()=>d(`unpin`),children:(0,Z.jsx)(G,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:I,title:i.pin,"aria-label":i.pin,onClick:()=>d(`pin`),children:(0,Z.jsx)(Se,{className:`size-4`,strokeWidth:1.75})}),t[93]=y,t[94]=i.pin,t[95]=i.unpin,t[96]=d,t[97]=Ee):Ee=t[97];let Y;t[98]===d?Y=t[99]:(Y=()=>d(`export`),t[98]=d,t[99]=Y);let De;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(a,{className:`size-4`,strokeWidth:1.75}),t[100]=De):De=t[100];let Oe;t[101]!==i.export||t[102]!==Y?(Oe=(0,Z.jsx)(`button`,{type:`button`,className:I,title:i.export,"aria-label":i.export,onClick:Y,children:De}),t[101]=i.export,t[102]=Y,t[103]=Oe):Oe=t[103];let ke;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(ke=u(I,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[104]=ke):ke=t[104];let X;t[105]===d?X=t[106]:(X=()=>d(`delete`),t[105]=d,t[106]=X);let Pe;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,Z.jsx)(P,{className:`size-4`,strokeWidth:1.75}),t[107]=Pe):Pe=t[107];let ze;t[108]!==i.delete||t[109]!==X?(ze=(0,Z.jsx)(`button`,{type:`button`,className:ke,title:i.delete,"aria-label":i.delete,onClick:X,children:Pe}),t[108]=i.delete,t[109]=X,t[110]=ze):ze=t[110];let Be;t[111]!==we||t[112]!==Te||t[113]!==Ee||t[114]!==Oe||t[115]!==ze?(Be=(0,Z.jsxs)(`div`,{role:`group`,className:`m-1 mt-0 flex flex-wrap items-center gap-0.5 rounded-lg bg-surface-hover/35 p-1.5`,onClick:Ie,onKeyDown:Fe,children:[we,Te,Ee,Oe,ze]}),t[111]=we,t[112]=Te,t[113]=Ee,t[114]=Oe,t[115]=ze,t[116]=Be):Be=t[116];let Ve;return t[117]!==c||t[118]!==L||t[119]!==xe||t[120]!==Be||t[121]!==w||t[122]!==T?(Ve=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,className:w,onClick:c,onKeyDown:T,children:[L,xe,Be]}),t[117]=c,t[118]=L,t[119]=xe,t[120]=Be,t[121]=w,t[122]=T,t[123]=Ve):Ve=t[123],Ve}function Fe(e){return e.stopPropagation()}function Ie(e){return e.stopPropagation()}function Le(e){return(0,Z.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function Re(e){return e.language}function ze(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function Be(e,t){return t.find(t=>t.id===e)?.avatar}var Ve={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:16e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function He(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ue(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Q(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function We(e){let t=He(e)?e:{},n=He(t.userContext)?t.userContext:{},r=He(n.contextPlanning)?n.contextPlanning:{},i=He(r.compaction)?r.compaction:{},a=Ve,o=typeof i.model==`string`&&i.model.trim()?i.model.trim():void 0,s=Array.isArray(i.postCompactionSections)&&i.postCompactionSections.length<=12&&i.postCompactionSections.every(e=>typeof e==`string`&&e.trim())?[...new Set(i.postCompactionSections.map(e=>e.trim()))]:[...a.postCompactionSections];return{enabled:typeof i.enabled==`boolean`?i.enabled:a.enabled,triggerThreshold:Ue(i.triggerThreshold,a.triggerThreshold,.1,.98),reserveTokens:Q(i.reserveTokens,a.reserveTokens,1024),minMessagesBeforeCompact:Q(i.minMessagesBeforeCompact,a.minMessagesBeforeCompact,2),keepRecentTokens:Q(i.keepRecentTokens,a.keepRecentTokens,1e3),recentTurnsPreserve:Q(i.recentTurnsPreserve,a.recentTurnsPreserve,1,12),summaryMaxTokens:Q(i.summaryMaxTokens,a.summaryMaxTokens,256),summaryChunkTokens:Q(i.summaryChunkTokens,a.summaryChunkTokens,1e3),summaryTimeoutMs:Q(i.summaryTimeoutMs,a.summaryTimeoutMs,1e3,6e5),summaryRetries:Q(i.summaryRetries,a.summaryRetries,0,5),qualityGuard:typeof i.qualityGuard==`boolean`?i.qualityGuard:a.qualityGuard,gapAudit:typeof i.gapAudit==`boolean`?i.gapAudit:a.gapAudit,...o?{model:o}:{},minToolResultKeepChars:Q(i.minToolResultKeepChars,a.minToolResultKeepChars,200),maxActiveTranscriptBytes:Q(i.maxActiveTranscriptBytes,a.maxActiveTranscriptBytes,64e3),postCompactionSections:s}}function Ge(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function Ke(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function qe(e){await d(m(`/api/config`),{method:`PATCH`,body:JSON.stringify(Ke(e))}),await O()}var Je=128e3,Ye={balanced:Ve,preserve:{...Ve,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Ve,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Xe=ue();function Ze(){return u(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg disabled:cursor-not-allowed disabled:opacity-55`,se,`dark:border-edge`)}function Qe(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function $e(e){let t=Qe(e);for(let[e,n]of Object.entries(Ye))if(t===Qe(n))return e;return`custom`}function et(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,Ae.c)(20),{id:n,label:r,hint:i,value:a,min:o,max:s,step:c,disabled:l,onChange:u}=e,d=c===void 0?1:c,f;t[0]!==n||t[1]!==r?(f=(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=Ze(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Z.jsx)(J,{id:n,type:`number`,min:o,max:s,step:d,disabled:l,className:p,value:a,onChange:m}),t[6]=l,t[7]=n,t[8]=s,t[9]=o,t[10]=d,t[11]=m,t[12]=a,t[13]=h):h=t[13];let g;t[14]===i?g=t[15]:(g=i?(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}):null,t[14]=i,t[15]=g);let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function tt(e){let t=(0,Ae.c)(19),{label:n,hint:r,checked:i,disabled:a,onChange:o}=e,s=a?`cursor-not-allowed opacity-55`:`cursor-pointer`,c;t[0]===s?c=t[1]:(c=u(`flex items-start gap-2 text-sm text-fg`,s),t[0]=s,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>o(e.target.checked),t[2]=o,t[3]=l);let d;t[4]!==i||t[5]!==a||t[6]!==l?(d=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:a,onChange:l}),t[4]=i,t[5]=a,t[6]=l,t[7]=d):d=t[7];let f;t[8]===n?f=t[9]:(f=(0,Z.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=f);let p;t[10]===r?p=t[11]:(p=(0,Z.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(`span`,{children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==c||t[16]!==d||t[17]!==m?(h=(0,Z.jsxs)(`label`,{className:c,children:[d,m]}),t[15]=c,t[16]=d,t[17]=m,t[18]=h):h=t[18],h}function nt({hasToken:e}){let t=l(p(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=k(e),{data:i=[],isLoading:a}=D(e?j:null,A,{revalidateOnFocus:!1}),o=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:We(n.payload.config),[n]),[d,f]=(0,X.useReducer)(Xe,{form:null,baseline:null}),[m,h]=(0,X.useState)(``),g=(0,X.useRef)(!1),_=(0,X.useRef)(d.form);_.current=d.form;let ee=(0,X.useRef)(null);ye({enabled:e,parsed:o,dirty:g.current,trackedParsedRef:ee,dispatch:f,onResetDirty:()=>{g.current=!1}});let v=d.form,te=d.baseline,y=!!(v&&te&&JSON.stringify(v)!==JSON.stringify(te)),b=(0,X.useCallback)(e=>{g.current=!0,f({type:`patch`,patch:e})},[]),ne=(0,X.useCallback)(e=>({enabled:t.enabled,triggerThreshold:t.triggerThreshold,reserveTokens:t.reserveTokens,minMessagesBeforeCompact:t.minMessagesBeforeCompact,keepRecentTokens:t.keepRecentTokens,recentTurnsPreserve:t.recentTurnsPreserve,summaryMaxTokens:t.summaryMaxTokens,summaryChunkTokens:t.summaryChunkTokens,summaryTimeoutMs:t.summaryTimeoutSeconds,summaryRetries:t.summaryRetries,qualityGuard:t.qualityGuard,gapAudit:t.gapAudit,model:t.summaryModel,minToolResultKeepChars:t.minToolResultKeepChars,maxActiveTranscriptBytes:t.maxActiveTranscriptMb,postCompactionSections:t.postCompactionSections})[e],[t]),x=Oe({value:v,dirty:y,onSave:(0,X.useCallback)(async e=>{try{await qe(e),f({type:`saved`,value:e}),g.current=!!(_.current&&JSON.stringify(_.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=Ge(e);return n?t.invalidValue.replace(`{{field}}`,ne(n)):null}});if(!e||!v)return r?(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(H,{className:`h-5 w-48`}),(0,Z.jsx)(H,{className:`h-20 w-full rounded-xl`}),(0,Z.jsx)(H,{className:`h-36 w-full rounded-xl`})]})}):null;let S=$e(v),C=Math.max(0,Je-v.reserveTokens),w=Math.min(Math.floor(Je*v.triggerThreshold),C),T=Math.min(100,w/Je*100),E=Math.min(100,C/Je*100),O=v.model?i.find(e=>e.id===v.model):void 0,N=O?.contextWindow&&v.summaryChunkTokens+v.summaryMaxTokens+4096>O.contextWindow,P=v.keepRecentTokens+v.reserveTokens>w,F=Math.round(v.summaryTimeoutMs*(v.summaryRetries+1)/1e3),I=e=>{let t=Ye[e];b({...t,...v.model?{model:v.model}:{model:void 0},postCompactionSections:v.postCompactionSections})},z={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},B=()=>{let e=m.trim();!e||v.postCompactionSections.includes(e)||v.postCompactionSections.length>=12||(b({postCompactionSections:[...v.postCompactionSections,e]}),h(``))};return(0,Z.jsxs)(Y,{onBlurCapture:x.onBlurCapture,children:[(0,Z.jsx)(Ee,{icon:V,title:t.title,subtitle:t.hint,trailing:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(De,{status:x.status,error:x.error}),(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:v.enabled,onChange:e=>b({enabled:e.target.checked})}),v.enabled?t.enabled:t.disabled]})]})}),x.error?(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:x.error}):null,v.enabled?null:(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Z.jsxs)(`fieldset`,{disabled:!v.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),S===`custom`?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":S===e,className:u(`rounded-xl bg-surface-base/55 px-3 py-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,R.transition,R.focusRingPanel,S===e?`bg-accent-soft text-accent-fg shadow-surface`:`text-fg hover:bg-surface-hover`),onClick:()=>I(e),children:[(0,Z.jsx)(`span`,{className:`block text-sm font-medium`,children:z[e].title}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:z[e].hint})]},e))})]}),(0,Z.jsxs)(L,{title:t.advancedTitle,summary:S===`custom`?t.presetCustom:t.presetHint,children:[(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.compactionTrigger}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:et(w)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${T}%`}})})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.hardInputLimit}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:et(C)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${E}%`}})})]})]}),(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((v.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>b({triggerThreshold:e/100})}),(0,Z.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,et(v.reserveTokens)),value:v.reserveTokens,min:1024,step:1024,onChange:e=>b({reserveTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:v.recentTurnsPreserve,min:1,max:12,onChange:e=>b({recentTurnsPreserve:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,et(v.keepRecentTokens)),value:v.keepRecentTokens,min:1e3,step:1e3,onChange:e=>b({keepRecentTokens:Math.floor(e)})})]}),P?(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):null,(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Z.jsx)(M,{value:v.model??``,disabled:!v.enabled,placeholder:t.summaryModelInherited,searchPlaceholder:t.summaryModelSearch,noMatches:t.summaryModelNoMatches,models:i,modelsLoading:a,className:`min-w-0 flex-1 justify-between`,contentAlign:`start`,showProviderSettingsFooter:!0,onChange:e=>b({model:e})}),v.model?(0,Z.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>b({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Z.jsx)(tt,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:v.qualityGuard,onChange:e=>b({qualityGuard:e})}),(0,Z.jsx)(tt,{label:t.gapAudit,hint:t.gapAuditHint,checked:v.gapAudit,onChange:e=>b({gapAudit:e})})]}),v.qualityGuard?null:(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning})]}),(0,Z.jsx)(ke,{children:(0,Z.jsxs)(`div`,{className:`space-y-5 rounded-xl bg-surface-base/45 p-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:v.minMessagesBeforeCompact,min:2,onChange:e=>b({minMessagesBeforeCompact:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((v.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>b({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Z.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:v.summaryMaxTokens,min:256,step:256,onChange:e=>b({summaryMaxTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:v.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>b({summaryChunkTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(F)),value:v.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>b({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Z.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:v.summaryRetries,min:0,max:5,onChange:e=>b({summaryRetries:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:v.minToolResultKeepChars,min:200,step:100,onChange:e=>b({minToolResultKeepChars:Math.floor(e)})})]}),N?(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),v.postCompactionSections.length>0?(0,Z.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:v.postCompactionSections.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs text-fg`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:u(`text-fg-muted hover:text-fg`,R.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>b({postCompactionSections:v.postCompactionSections.filter(t=>t!==e)}),children:(0,Z.jsx)(c,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Z.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Z.jsx)(`input`,{className:Ze(),value:m,maxLength:120,disabled:v.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),B())}}),(0,Z.jsxs)(W,{type:`button`,variant:`secondary`,disabled:!m.trim()||v.postCompactionSections.length>=12,onClick:B,children:[(0,Z.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function rt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function it(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function at(e){let t=rt(e)?e:{},n=rt(t.session)?t.session:{},r=rt(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:it(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function ot(e){await d(m(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),O()}function st(){return u(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,se,`dark:border-edge`)}var ct=ue();function lt({hasToken:e}){let t=l(p(e=>e.language)).sessions.config,{data:n,isLoading:r}=k(e),i=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:at(n.payload.config),[n]),[a,o]=(0,X.useReducer)(ct,{form:null,baseline:null}),s=a.form,c=a.baseline,u=(0,X.useRef)(!1),d=(0,X.useRef)(s);d.current=s;let f=(0,X.useRef)(null);ye({enabled:e,parsed:i,dirty:u.current,trackedParsedRef:f,dispatch:o,onResetDirty:()=>{u.current=!1}});let m=!!(s&&c&&JSON.stringify(s)!==JSON.stringify(c)),h=(0,X.useCallback)(e=>{u.current=!0,o({type:`patch`,patch:e})},[]),g=Oe({value:s,dirty:m,onSave:(0,X.useCallback)(async e=>{try{await ot(e),o({type:`saved`,value:e}),u.current=!!(d.current&&JSON.stringify(d.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!s?r?(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(H,{className:`h-5 w-40`}),(0,Z.jsx)(H,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Z.jsxs)(Y,{onBlurCapture:g.onBlurCapture,children:[(0,Z.jsx)(Ee,{icon:U,title:t.title,subtitle:t.hint,trailing:(0,Z.jsx)(De,{status:g.status,error:g.error})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(L,{title:t.dmScope,summary:s.dmScope,children:(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Z.jsxs)(K,{className:st(),value:s.dmScope,onChange:e=>h({dmScope:e.target.value}),children:[(0,Z.jsx)(q,{value:`main`,children:t.dmScopeMain}),(0,Z.jsx)(q,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Z.jsx)(q,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Z.jsx)(q,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Z.jsx)(J,{allowEmpty:!0,type:`number`,min:0,className:st(),value:s.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Z.jsx)(L,{title:t.maxEntries,summary:s.maxEntries??t.unsetPlaceholder,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Z.jsx)(J,{allowEmpty:!0,type:`number`,min:1,className:st(),value:s.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})})]})]})}function ut(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function dt(e){let t=(0,Ae.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:l,onArchive:d,onUnarchive:f,onPin:p,onUnpin:m,onExport:y,onDelete:b}=e,ne=i?.status===`archived`,x=i?.status===`pinned`,S;t[0]===l?S=t[1]:(S=e=>!e&&l(),t[0]=l,t[1]=S);let C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(h,{className:u(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Ce)}),t[2]=C):C=t[2];let w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=u(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,xe,`dark:border-edge`),t[3]=w):w=t[3];let T;t[4]!==i||t[5]!==o||t[6]!==a?(T=i&&a?(0,Z.jsx)(B,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=o,t[6]=a,t[7]=T):T=t[7];let E;t[8]!==s.unnamedSession||t[9]!==i?.name?(E=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=E):E=t[10];let D;t[11]===E?D=t[12]:(D=(0,Z.jsx)(v,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:E}),t[11]=E,t[12]=D);let O;t[13]!==T||t[14]!==D?(O=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[T,D]}),t[13]=T,t[14]=D,t[15]=O):O=t[15];let k;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(c,{className:`size-5`,strokeWidth:1.75}),t[16]=k):k=t[16];let A;t[17]===s.close?A=t[18]:(A=(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:k})}),t[17]=s.close,t[18]=A);let j;t[19]!==O||t[20]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[O,A]}),t[19]=O,t[20]=A,t[21]=j):j=t[21];let M;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(M=r?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.detailLoading}):i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Z.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Z.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Z.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:s.detailMessages}),(0,Z.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(ft)})]}):null,t[22]=s.detailLoading,t[23]=s.detailMessages,t[24]=r,t[25]=i,t[26]=M):M=t[26];let N;t[27]===M?N=t[28]:(N=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:M}),t[27]=M,t[28]=N);let P;t[29]!==s.detailExport||t[30]!==y?(P=(0,Z.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:y,children:s.detailExport}),t[29]=s.detailExport,t[30]=y,t[31]=P):P=t[31];let F;t[32]!==ne||t[33]!==s.archive||t[34]!==s.unarchive||t[35]!==d||t[36]!==f?(F=ne?(0,Z.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:f,children:s.unarchive}):(0,Z.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:d,children:s.archive}),t[32]=ne,t[33]=s.archive,t[34]=s.unarchive,t[35]=d,t[36]=f,t[37]=F):F=t[37];let I;t[38]!==x||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==p||t[42]!==m?(I=x?(0,Z.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:m,children:s.unpin}):(0,Z.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:p,children:s.pin}),t[38]=x,t[39]=s.pin,t[40]=s.unpin,t[41]=p,t[42]=m,t[43]=I):I=t[43];let L;t[44]!==s.delete||t[45]!==b?(L=(0,Z.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:b,children:s.delete}),t[44]=s.delete,t[45]=b,t[46]=L):L=t[46];let R;t[47]!==P||t[48]!==F||t[49]!==I||t[50]!==L?(R=(0,Z.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[P,F,I,L]})}),t[47]=P,t[48]=F,t[49]=I,t[50]=L,t[51]=R):R=t[51];let z;t[52]!==j||t[53]!==N||t[54]!==R?(z=(0,Z.jsxs)(_,{children:[C,(0,Z.jsxs)(ee,{className:w,"aria-describedby":void 0,children:[j,N,R]})]}),t[52]=j,t[53]=N,t[54]=R,t[55]=z):z=t[55];let re;return t[56]!==n||t[57]!==S||t[58]!==z?(re=(0,Z.jsx)(te,{open:n,onOpenChange:S,children:z}),t[56]=n,t[57]=S,t[58]=z,t[59]=re):re=t[59],re}function ft(e){return(0,Z.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Z.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Z.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:ut(e.content)})]},`${e.timestamp??``}-${e.role}-${ut(e.content).slice(0,24)}`)}var pt=20;function mt(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ht=new Set([`all`,`active`,`pinned`,`archived`]),gt=new Set([`grid`,`list`]),_t=[`sessions`,`settings`];function vt(e){return e&&_t.includes(e)?e:`sessions`}function yt(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function bt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function xt(e){let t=(0,Ae.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=_t.map(e=>({id:e,label:yt(n,e),icon:e===`sessions`?de:ae})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Z.jsx)(fe,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function St(e){let t=(0,Ae.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a===void 0?!1:a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mb-5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:yt(n,r)}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:bt(n,r)})]}),(0,Z.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Z.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function Ct(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ht.has(t)?t:`all`,viewMode:gt.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function wt(){let e=l(p(e=>e.language)),t=e.sessions,n=f(e=>e.conversationId),r=!!n,{data:a,mutate:s}=D(r?[`gateway-chat-agents`,n]:null,_e,{revalidateOnFocus:!1}),c=a?.defaultId??`main`,d=a?.items??[],[m,g]=i(),O=vt(m.get(`tab`)),k=(0,X.useCallback)(e=>{let t=new URLSearchParams(m);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),g(t,{replace:!0})},[m,g]),[A,j]=(0,X.useReducer)(he,m,Ct),{searchInput:M,debouncedSearch:P,statusFilter:I,viewMode:L,channelFilter:z,sessions:B,loading:V,error:ae,hasMore:H,stats:U,detailOpen:se,detailLoading:ce,detailSession:G,confirmOpen:le,confirmKey:K}=A;(0,X.useEffect)(()=>{let e=setTimeout(()=>{let e=M.trim();P!==e&&j({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[M,P]);let ue=m.toString(),q=(0,X.useRef)(ue);if(q.current!==ue){q.current=ue;let e=m.get(`q`)??``,t=m.get(`status`),n=m.get(`view`),r=(m.get(`channel`)??``).trim(),i=ht.has(t)?t:`all`,a=gt.has(n)?n:`grid`,o=e.trim();j({type:`patch`,patch:{...M===e?{}:{searchInput:e},...P===o?{}:{debouncedSearch:o},...I===i?{}:{statusFilter:i},...L===a?{}:{viewMode:a},...z===r?{}:{channelFilter:r}}})}(0,X.useEffect)(()=>{let e=new URLSearchParams(m),t=P.trim();t?e.set(`q`,t):e.delete(`q`),I===`all`?e.delete(`status`):e.set(`status`,I),L===`grid`?e.delete(`view`):e.set(`view`,L),z?e.set(`channel`,z):e.delete(`channel`),e.toString()!==m.toString()&&g(e,{replace:!0})},[P,m,g,I,L,z]),(0,X.useEffect)(()=>{if(!r||O!==`sessions`)return;let e=!1;return(async()=>{j({type:`patch`,patch:{loading:!0,error:null}});try{let t=await T({limit:pt,offset:0,...P?{search:P}:{},...I===`all`?{}:{status:I},...z?{channel:z}:{}});if(e)return;j({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||j({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||j({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,O,P,I,z,t.loadError]),(0,X.useEffect)(()=>{!r||O!==`sessions`||S().then(e=>j({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,O]),(0,X.useEffect)(()=>{if(!r||O!==`sessions`)return;let e=()=>void s();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,O,s]),(0,X.useEffect)(()=>{if(!r||O!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||j({type:`patch`,patch:{sessions:B.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:G&&G.key===t.key?{...G,name:t.name}:G}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,O,B,G]);let fe=(0,X.useCallback)(async()=>{if(!(!r||V||!H)){j({type:`patch`,patch:{loading:!0,error:null}});try{let e=await T({limit:pt,offset:B.length,...P?{search:P}:{},...I===`all`?{}:{status:I},...z?{channel:z}:{}});j({type:`patch`,patch:{sessions:[...B,...e.items],hasMore:e.hasMore}})}catch(e){j({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{j({type:`patch`,patch:{loading:!1}})}}},[r,V,H,B.length,P,I,z,t.loadError]),pe=(0,X.useCallback)((e,t)=>{j({type:`patch`,patch:{sessions:B.map(n=>n.key===e?{...n,status:t}:n),detailSession:G&&G.key===e?{...G,status:t}:G}})},[B,G]),ye=(0,X.useCallback)(async e=>{j({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{j({type:`patch`,patch:{detailSession:await y(e)}})}catch{j({type:`patch`,patch:{detailOpen:!1}})}finally{j({type:`patch`,patch:{detailLoading:!1}})}},[]),be=e=>{ye(e)},J=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e},bubbles:!0}));return}if(t===`delete`){j({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await E(e),pe(e,`archived`);break;case`unarchive`:await ne(e),pe(e,`active`);break;case`pin`:await b(e),pe(e,`pinned`);break;case`unpin`:await C(e),pe(e,`active`);break;case`export`:{let t=await w(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}S().then(e=>j({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Ee=async e=>{try{await x(e),j({type:`patch`,patch:{sessions:B.filter(t=>t.key!==e),detailSession:G?.key===e?null:G,...G?.key===e?{detailOpen:!1}:{}}}),S().then(e=>j({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Y={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,tokens:t.tokens,cost:t.cost,costPartial:t.costPartial,costUnknown:t.costUnknown,noUsage:t.noUsage,unnamedSession:e.chat.newSession},De={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},Oe=[{key:`all`,label:t.filterAll,icon:de},{key:`active`,label:t.filterActive,icon:ie},{key:`pinned`,label:t.filterPinned,icon:Se},{key:`archived`,label:t.filterArchived,icon:re}],ke=(()=>{let e=Object.entries(U?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Z.jsxs)(Te,{gap:`gap-6`,children:[(0,Z.jsx)(we,{title:t.title}),(0,Z.jsx)(xt,{s:t,activeTab:O,onChange:k}),(0,Z.jsx)(St,{s:t,id:`settings`,activeTab:O,plain:!0,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(nt,{hasToken:r}),(0,Z.jsx)(lt,{hasToken:r})]})}),(0,Z.jsxs)(St,{s:t,id:`sessions`,activeTab:O,plain:!0,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Z.jsx)(F,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.tabsSessions,indicatorClassName:`rounded-xl bg-accent-soft`,children:Oe.map(({key:e,label:t,icon:n})=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":I===e,onClick:()=>j({type:`patch`,patch:{statusFilter:e}}),className:u(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,R.transition,R.focusRingPanel,I===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Z.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Z.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base focus-within:ring-2 focus-within:ring-accent px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Z.jsx)(ge,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:M,onChange:e=>j({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,"data-debounced-query":P||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-base sm:text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Z.jsxs)(F,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":t.filterChannelLabel,indicatorClassName:`rounded-xl bg-accent-soft`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":!z,onClick:()=>j({type:`patch`,patch:{channelFilter:``}}),className:u(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,R.transition,R.focusRingPanel,z?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),ke.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":z===e,onClick:()=>j({type:`patch`,patch:{channelFilter:e}}),className:u(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,R.transition,R.focusRingPanel,z===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,U?.byChannel?.[e]==null?null:(0,Z.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:U.byChannel[e]})]},e))]}),U?(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[U.totalSessions,t.totalSessions],[U.activeSessions,t.activeSessions],[U.pinnedSessions,t.pinnedSessions],[U.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Z.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Z.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,ae?(0,Z.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,children:ae}):null,(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:mt(t.sessionCount,{count:B.length})}),(0,Z.jsxs)(F,{className:N,role:`group`,"aria-label":t.layoutToggleGroup,indicatorClassName:`rounded-pill bg-surface-panel shadow-sm dark:ring-1 dark:ring-edge-strong/40`,children:[(0,Z.jsx)(W,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":L===`grid`,onClick:()=>j({type:`patch`,patch:{viewMode:`grid`}}),className:u(oe,`size-7 p-0`,L===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,L===`grid`&&`text-accent-fg`),children:(0,Z.jsx)(me,{className:`size-3.5`,strokeWidth:1.5})}),(0,Z.jsx)(W,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":L===`list`,onClick:()=>j({type:`patch`,patch:{viewMode:`list`}}),className:u(oe,`size-9 p-0`,L===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,L===`list`&&`text-accent-fg`),children:(0,Z.jsx)(ve,{className:`size-3.5`,strokeWidth:1.5})})]})]}),V&&B.length===0?(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Z.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):B.length===0?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Z.jsx)(o,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Z.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Z.jsx)(W,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:u(`grid min-w-0 gap-3`,L===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":P||void 0,children:B.map(e=>{let t=ze(e,c);return(0,Z.jsx)(Pe,{session:e,variant:L,labels:Y,sessionAgentId:t,sessionAgentAvatar:Be(t,d),onOpen:()=>be(e.key),onAction:t=>void J(e.key,t)},e.key)})}),H?(0,Z.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Z.jsx)(W,{type:`button`,variant:`secondary`,disabled:V,onClick:()=>void fe(),children:t.loadMore})}):null]})]})]}),(0,Z.jsx)(dt,{open:se,loading:ce,session:G,sessionAgentId:G?ze(G,c):void 0,sessionAgentAvatar:G?Be(ze(G,c),d):void 0,labels:De,onClose:()=>{j({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>G&&void J(G.key,`archive`),onUnarchive:()=>G&&void J(G.key,`unarchive`),onPin:()=>G&&void J(G.key,`pin`),onUnpin:()=>G&&void J(G.key,`unpin`),onExport:()=>G&&void J(G.key,`export`),onDelete:()=>G&&j({type:`patch`,patch:{confirmKey:G.key,confirmOpen:!0}})}),(0,Z.jsx)(te,{open:le,onOpenChange:e=>j({type:`patch`,patch:{confirmOpen:e}}),children:(0,Z.jsxs)(_,{children:[(0,Z.jsx)(h,{className:u(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Ce)}),(0,Z.jsxs)(ee,{className:u(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`,xe),children:[(0,Z.jsx)(v,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:K?mt(t.deleteSessionMessage,{name:B.find(e=>e.key===K)?.name?.trim()||e.chat.newSession}):``}),(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>j({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Z.jsx)(W,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{K&&Ee(K),j({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Z.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{wt as SessionsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Hn as e}from"./index-BNRLzxpH.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import{
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import{Ic as r,bu as i}from"./index-BNRLzxpH.js";var a=e();function o(){return`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`}var s=t();function c(e){let t=(0,a.c)(7),{children:r,className:i,id:c,onBlurCapture:l}=e,u;t[0]===i?u=t[1]:(u=n(o(),i),t[0]=i,t[1]=u);let d;return t[2]!==r||t[3]!==c||t[4]!==l||t[5]!==u?(d=(0,s.jsx)(`section`,{id:c,className:u,onBlurCapture:l,children:r}),t[2]=r,t[3]=c,t[4]=l,t[5]=u,t[6]=d):d=t[6],d}var l=`mt-0.5 flex size-7 shrink-0 items-center justify-center text-fg-muted transition-colors`;function u(e){let t=(0,a.c)(27),{icon:o,title:c,subtitle:u,trailing:d,titleAccessory:f,className:p,iconInteractive:m,iconLeading:h}=e,g;t[0]===o?g=t[1]:(g=(0,s.jsx)(o,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=o,t[1]=g);let _=h??g,v,y;if(t[2]!==p||t[3]!==m||t[4]!==h||t[5]!==_){let e=h?n(`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel p-0 ring-1 ring-inset ring-edge-subtle transition-[box-shadow] hover:ring-accent/40 dark:ring-edge-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,r.press):n(l,`hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,r.press),a=!!(m&&h);t[8]===p?v=t[9]:(v=n(`mb-4 flex items-start gap-2.5`,p),t[8]=p,t[9]=v),y=m?a?(0,s.jsxs)(`span`,{className:`relative shrink-0`,children:[(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:n(`touch-target`,e),children:_}),(0,s.jsx)(`span`,{className:`pointer-events-none absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-md border border-edge bg-surface-panel text-fg-muted shadow-sm dark:border-edge dark:bg-surface-base`,"aria-hidden":!0,children:(0,s.jsx)(i,{className:`size-2.5`,strokeWidth:2.25})})]}):(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:n(`touch-target`,e),children:_}):(0,s.jsx)(`div`,{className:n(h?`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel ring-1 ring-inset ring-edge-subtle dark:ring-edge-subtle`:l),"aria-hidden":!h,children:_}),t[2]=p,t[3]=m,t[4]=h,t[5]=_,t[6]=v,t[7]=y}else v=t[6],y=t[7];let b;t[10]===c?b=t[11]:(b=(0,s.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c}),t[10]=c,t[11]=b);let x;t[12]!==b||t[13]!==f?(x=(0,s.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[b,f]}),t[12]=b,t[13]=f,t[14]=x):x=t[14];let S;t[15]===u?S=t[16]:(S=u?(0,s.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:u}):null,t[15]=u,t[16]=S);let C;t[17]!==x||t[18]!==S?(C=(0,s.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]}),t[17]=x,t[18]=S,t[19]=C):C=t[19];let w;t[20]===d?w=t[21]:(w=d?(0,s.jsx)(`div`,{className:`shrink-0`,children:d}):null,t[20]=d,t[21]=w);let T;return t[22]!==v||t[23]!==y||t[24]!==C||t[25]!==w?(T=(0,s.jsxs)(`div`,{className:v,children:[y,C,w]}),t[22]=v,t[23]=y,t[24]=C,t[25]=w,t[26]=T):T=t[26],T}export{u as n,o as r,c as t};
|
package/dist/gateway/static/root/assets/{settings-page-B18UbbaJ.js → settings-page-CniJVL-o.js}
RENAMED
|
@@ -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{m as i,r as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./messages-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i,r as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./messages-DPxcWxfD.js";import{n as s}from"./locale-store-Djl2FW6_.js";import{$o as c,Jo as l,Ko as u,Qo as d,Xo as f,Yo as p,Zo as m,es as h,ns as g,qo as _,rs as v,ts as y}from"./index-BNRLzxpH.js";var b=n(),x=e(t(),1),S=r(),C=[`overview`,`appearance`,`keyboard-shortcuts`,`system`,`desktop-pet`,`desktop-app`,`agent-defaults`,`gateway`,`runtimes`,`devices`,`remote-access`,`shares`],w=(0,x.lazy)(()=>y().then(e=>({default:e.SetupStatusPanel}))),T=(0,x.lazy)(()=>l().then(e=>({default:e.AppearanceSettingsPanel}))),E=(0,x.lazy)(()=>d().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),D=(0,x.lazy)(()=>v().then(e=>({default:e.SystemSettingsPanel}))),O=(0,x.lazy)(()=>p().then(e=>({default:e.DesktopPetSettings}))),k=(0,x.lazy)(()=>_().then(e=>({default:e.AppManagementSettingsPanel}))),A=(0,x.lazy)(()=>m().then(e=>({default:e.GatewaySettingsPanel}))),j=(0,x.lazy)(()=>h().then(e=>({default:e.RuntimeToolsSettingsPanel}))),M=(0,x.lazy)(()=>c().then(e=>({default:e.RemoteAccessHub}))),N=(0,x.lazy)(()=>g().then(e=>({default:e.SharesSettingsPanel}))),P=(0,x.lazy)(()=>u().then(e=>({default:e.AgentDefaultsSettingsPanel}))),F=(0,x.lazy)(()=>f().then(e=>({default:e.EndpointToolsManagementSettings})));function I(){let e=(0,b.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,S.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,S.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,S.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,S.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function L(e){return(0,S.jsx)(x.Suspense,{fallback:(0,S.jsx)(I,{}),children:(0,S.jsx)(e,{})})}function R(){let e=(0,b.c)(27),{section:t}=i(),n=s(z),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let i=o(n);if(!t||!C.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,S.jsx)(a,{to:`/settings/overview`,replace:!0}),e[7]=t):t=e[7],d=t;break bb0}let s=t;if(s===`overview`){let t;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(w),e[8]=t):t=e[8],d=t;break bb0}let f=i.settingsSections[s];if(s===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(T),e[9]=t):t=e[9],d=t;break bb0}if(s===`keyboard-shortcuts`){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(E),e[10]=t):t=e[10],d=t;break bb0}if(s===`system`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(D),e[11]=t):t=e[11],d=t;break bb0}if(s===`desktop-pet`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(O),e[12]=t):t=e[12],d=t;break bb0}if(s===`desktop-app`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(k),e[13]=t):t=e[13],d=t;break bb0}if(s===`agent-defaults`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(P),e[14]=t):t=e[14],d=t;break bb0}if(s===`gateway`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(A),e[15]=t):t=e[15],d=t;break bb0}if(s===`runtimes`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(j),e[16]=t):t=e[16],d=t;break bb0}if(s===`devices`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(F),e[17]=t):t=e[17],d=t;break bb0}if(s===`remote-access`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(M),e[18]=t):t=e[18],d=t;break bb0}if(s===`shares`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=L(N),e[19]=t):t=e[19],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,S.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=i.settingsPage.comingSoon.replace(`{{title}}`,f)}e[0]=n,e[1]=t,e[2]=r,e[3]=c,e[4]=l,e[5]=u,e[6]=d}else r=e[2],c=e[3],l=e[4],u=e[5],d=e[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;e[20]!==r||e[21]!==c?(f=(0,S.jsx)(`p`,{className:r,children:c}),e[20]=r,e[21]=c,e[22]=f):f=e[22];let p;return e[23]!==l||e[24]!==u||e[25]!==f?(p=(0,S.jsxs)(`div`,{className:l,children:[u,f]}),e[23]=l,e[24]=u,e[25]=f,e[26]=p):p=e[26],p}function z(e){return e.language}export{R as SettingsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./messages-DPxcWxfD.js";import{t as s}from"./cn-0WouolD0.js";import{a as c,c as l,n as u,r as d}from"./locale-store-Djl2FW6_.js";import{i as f}from"./vendor-swr-BIWyz7Rc.js";import{r as p}from"./gateway-config-swr-Di9g6pE8.js";import{n as m}from"./gateway-realtime-store-DQ6-whg-.js";import{n as h,t as g}from"./registry-api-BwR2CiR5.js";import{$d as _,Af as v,Ic as y,On as b,Ps as x,Qd as S,Rc as C,Wc as w,Wt as T,Wu as E,kl as D,ld as O,os as k,ra as A,sf as j,su as M,zl as N}from"./index-BNRLzxpH.js";import{n as P,r as F}from"./settings-page-layout-Dx5S-Msc.js";import{n as I,t as L}from"./settings-form-section-Bqm1IKvR.js";import{t as R}from"./settings-advanced-gate-BiySFw1N.js";import{r as z,t as ee}from"./runtime-tools-api-C_VOMhLI.js";var B=n(),V=e(t(),1),H=r();function U(){let e=u(e=>e.language)===`zh`,t=o(e?`zh`:`en`).runtimeToolsSettings,{data:n,error:r,mutate:i}=f(d(`/api/runtime-tools`),ee),[a,s]=(0,V.useState)(),[c,l]=(0,V.useState)(),p=n?.payload.statuses??[],m=p.some(e=>![`ready`,`disabled`,`unsupported`].includes(e.state));async function h(t,r){s(t),l(void 0);try{await z({runtime:t,action:r?`repair`:`install`,version:n?.payload.config[t].version,onProgress:e=>l(e.message)}),await i(),l(e?`操作完成,已刷新执行环境状态。`:`Completed and refreshed environment status.`)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(void 0)}}return(0,H.jsxs)(`details`,{open:m||void 0,className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[e?`执行环境状态`:`Execution environment status`,n?` · ${p.filter(e=>e.state===`ready`).length}/${p.length}`:``]}),r?(0,H.jsxs)(`div`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:[t.loadError,(0,H.jsx)(w,{variant:`ghost`,onClick:()=>void i(),children:t.refresh})]}):n?(0,H.jsx)(`div`,{className:`mt-3 space-y-3`,children:p.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-sm text-fg`,children:t.runtimeNames[e.runtime]}),(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.message})]}),n.payload.config.enabled&&n.payload.config[e.runtime].enabled&&![`ready`,`disabled`,`unsupported`,`installing`].includes(e.state)?(0,H.jsx)(w,{disabled:!!a,onClick:()=>void h(e.runtime,e.repairable),children:a===e.runtime?t.working:e.repairable?t.repair:t.install}):null]},e.runtime))}):(0,H.jsx)(C,{className:`mt-3 h-20`}),c?(0,H.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-fg-muted`,children:c}):null]})}function W(e){if(!e||typeof e!=`object`)return 0;let t=e.providers;return!t||typeof t!=`object`||Array.isArray(t)?0:Object.values(t).filter(e=>typeof e==`string`&&x(e)).length}function G(e){if(!e||typeof e!=`object`)return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.defaults,r=n&&typeof n==`object`&&!Array.isArray(n)?n.models:void 0;if(!r||typeof r!=`object`||Array.isArray(r))return``;let i=r.chat;if(!i||typeof i!=`object`||Array.isArray(i))return``;let a=i.primary;return typeof a==`string`?a.trim():``}function K(e){if(!e||typeof e!=`object`)return!1;let t=e.channels;return!t||typeof t!=`object`||Array.isArray(t)?!1:Object.values(t).some(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(`configured`in t||`config`in t||`schema`in t||`uiHints`in t){if(t.configured===!0)return!0;let e=t.config;if(!e||typeof e!=`object`||Array.isArray(e))return!1;let n=e;return n.enabled===!0||Object.keys(n).length>0}return t.enabled===!0||Object.keys(t).length>0})}function q(e){if(!e||typeof e!=`object`)return{enabled:!1,driverKind:`extension`};let t=e.browser;if(!t||typeof t!=`object`||Array.isArray(t))return{enabled:!1,driverKind:`extension`};let n=t,r=n.driver&&typeof n.driver==`object`&&!Array.isArray(n.driver)?n.driver:void 0;return{enabled:n.enabled===!0,driverKind:typeof r?.kind==`string`&&r.kind.trim()?r.kind.trim():`extension`}}function J(e){return e?`pass`:`fail`}function te(e){if(e===`tool-runtimes`)return`/settings/runtimes`;if(e===`provider-auth`)return`/settings/capabilities/models`;if(e===`config-health`)return`/settings/gateway`;if(e===`state-integrity`||e===`workspace-status`)return`/capabilities/agents`;if(e===`database-schema`||e===`session-integrity`)return`/settings/sessions`;if(e===`channel-config`||e===`channel-pairing-pending`||e.startsWith(`channel:`))return`/capabilities/channels`;if(e===`security-audit`||e===`gateway-service`||e===`gateway-health`)return`/settings/gateway`;if(e===`version-check`)return`/settings/desktop-app`}function Y(e){return{fail:4,warn:3,skip:2,pass:1}[e]}function X(e,t){let n=e.match(/^Run(?::|\s)(.*)$/i);if(n?.[1])return t.runCommand(n[1].trim());let r=e.match(/^Install(?::|\s)(.*)$/i);if(r?.[1])return t.installCommand(r[1].trim());let i=e.match(/^Start(?::|\s)(.*)$/i);return i?.[1]?t.startCommand(i[1].trim()):e}function Z(e,t){if(!t)return e;let n=e.message;if(e.id===`tool-runtimes`){let r=e.message.match(/^(.*) runtime is not installed\.$/),i=e.message.match(/^(.*) runtime installation is invalid\.$/);r?.[1]?n=t.runtimeMissing(r[1]):i?.[1]&&(n=t.runtimeInvalid(i[1]))}else if(e.id===`gateway-service`)if(e.message===`Gateway is not installed as a system service.`)n=t.gatewayNotInstalled;else{let r=e.message.match(/^Service backend unavailable: (.*)$/),i=e.message.match(/^Gateway service is installed but not running \(status: (.*)\)\.$/);r?.[1]?n=t.gatewayUnavailable(r[1]):i?.[1]&&(n=t.gatewayNotRunning(i[1]))}else e.id===`provider-auth`&&e.message===`No API keys detected for configured providers.`&&(n=t.providerAuthMissing);return{...e,label:t.labels[e.id]??e.label,message:n,hints:e.hints.map(e=>X(e,t))}}function ne(e,t){return e.filter(e=>e.status===`fail`||e.status===`warn`).map(e=>{let n=Z(e,t);return{id:n.id,label:n.label,status:n.status,message:n.message,hints:n.hints,path:te(n.id),source:`doctor`}}).toSorted((e,t)=>Y(t.status)-Y(e.status)||e.label.localeCompare(t.label))}function re(e){let t=new Map(e.doctorChecks.map(e=>[e.id,e])),n=[];for(let r of[`security-audit`,`channel-config`,`channel-pairing-pending`,`gateway-health`]){let i=t.get(r);if(i){let t=Z(i,e.copy);n.push({id:t.id,label:t.label,status:t.status,message:t.message,path:te(t.id)})}}if(e.logsHealth){let t=e.logsHealth.stats?.errorsLast24h??0;n.push({id:`logs-health`,label:e.copy?.labels[`logs-health`]??`Logs`,status:e.logsHealth.shuttingDown||t>0?`warn`:`pass`,message:e.copy?e.logsHealth.shuttingDown?e.copy.logsShuttingDown:t>0?e.copy.logsErrors(t):e.copy.logsHealthy:e.logsHealth.shuttingDown?`Logger is shutting down.`:t>0?`${t} error(s) in the last 24 hours.`:`Log system is healthy.`,path:`/settings/logs`})}for(let t of e.browserDiagnostics??[]){let r=t.message;if(e.copy){r={"Local Chromium is installed.":e.copy.chromiumInstalled,"Local Chromium is not installed.":e.copy.chromiumNotInstalled,"Chrome extension bridge is connected.":e.copy.extensionConnected,"Chrome extension needs refresh.":e.copy.extensionNeedsRefresh,"Chrome extension is installed but not connected.":e.copy.extensionNotConnected,"Chrome extension is not installed.":e.copy.extensionNotInstalled}[t.message]??t.message;let n=t.message.match(/^Browser driver "(.*)" is configured\.$/);n?.[1]&&(r=e.copy.browserDriverConfigured(n[1]))}n.push({...t,label:e.copy?.labels[t.id]??t.label,message:r})}return n}function ie(e){let t=W(e.config),n=e.providerMeta?.configured??t,r=e.providerMeta?.total??0,i=n>0||t>0,a=G(e.config),o=a.length>0,s=e.hasToken&&e.realtimeConnected,c=K(e.config),l=e.skillCount>0,u=(e.doctorChecks??[]).filter(t=>!e.isElectron||t.id!==`gateway-service`),d=ne(u,e.labels.diagnostics),f=[{id:`gateway`,done:s,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline},{id:`provider`,done:i,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing},{id:`defaultModel`,done:o,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing},{id:`channel`,done:c,optional:!0,detail:c?e.labels.channelConfigured:e.labels.channelMissing},{id:`skill`,done:l,optional:!0,detail:l?e.labels.skillsConfigured(e.skillCount):e.labels.skillsMissing}],p=f.filter(e=>!e.optional).every(e=>e.done),m=f.every(e=>e.done),h=[{id:`gateway`,status:J(s),title:`Gateway`,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline,path:`/settings/gateway`},{id:`provider`,status:J(i),title:`Model provider`,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing,path:`/settings/capabilities/models`},{id:`defaultModel`,status:J(o),title:`Default model`,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing,path:`/settings/capabilities/models`},{id:`ready`,status:p?`pass`:`fail`,title:`Chat readiness`,detail:p?e.labels.readyToChat:e.labels.modelMissing,path:`/chat`}],g=d.some(e=>e.status===`fail`),_=d.some(e=>e.status===`warn`),v=g?`blocked`:_?`attention`:p?`ready`:`setup`,y=re({doctorChecks:u,logsHealth:e.logsHealth,browserDiagnostics:e.browserDiagnostics,copy:e.labels.diagnostics});return{gatewayConnected:s,providerConfigured:i,providerCount:t,providerMetaConfigured:n,providerMetaTotal:r,defaultModel:a,defaultModelConfigured:o,channelConfigured:c,skillInstalled:l,skillCount:e.skillCount,checklist:f,readiness:h,issues:d,healthTier:v,diagnosticSignals:y,requiredComplete:p,allComplete:m}}function ae(e){return q(e)}function oe(e){return!e.id||!e.label||!e.status||!e.message||![`pass`,`warn`,`fail`,`skip`].includes(e.status)?null:{id:e.id,label:e.label,status:e.status,message:e.message,hints:Array.isArray(e.hints)?e.hints.filter(e=>typeof e==`string`):[],fixed:e.fixed===!0,findings:Array.isArray(e.findings)?e.findings:void 0}}function se(){return d(`/api/doctor`)}async function ce(){return((await c(se())).checks??[]).map(oe).filter(e=>e!==null)}function le(){return d(`/api/logs/health`)}async function ue(){return c(le())}function Q(e){return e?`pass`:`warn`}function de(e){return e?.enabled?[`setup-browser-diagnostics`,e]:null}async function fe(e){if(!e.enabled)return[];if(e.driverKind===`playwright`){let e=await c(d(`/api/browser/playwright/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-playwright`,label:`Browser: Playwright`,status:Q(t),message:t?`Local Chromium is installed.`:e.payload?.reason??`Local Chromium is not installed.`,path:`/settings/agent-browser`}]}if(e.driverKind===`extension`){let e=await c(d(`/api/browser/extension-status?probe=true`)),t=e.artifacts?.installed===!0,n=e.connected===!0,r=e.artifacts?.needsRefresh===!0||e.artifacts?.needsChromeReload===!0;return[{id:`browser-extension`,label:`Browser: Chrome extension`,status:n?`pass`:`warn`,message:n?`Chrome extension bridge is connected.`:t?r?`Chrome extension needs refresh.`:`Chrome extension is installed but not connected.`:`Chrome extension is not installed.`,path:`/settings/agent-browser`}]}return[{id:`browser-playwright`,label:`Browser`,status:`skip`,message:`Browser driver "${e.driverKind}" is configured.`,path:`/settings/agent-browser`}]}function $(){let e=(0,B.c)(95),t=l(ve),n=u(_e),r;e[0]===n?r=e[1]:(r=o(n),e[0]=n,e[1]=r);let i=r,a=i.setupStatus.labels,s=i.setupStatus.diagnostics,c=m(ge),{data:d,error:_,isLoading:v,mutate:y}=p(!!t),b;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(b={revalidateOnFocus:!1},e[2]=b):b=e[2];let{data:x,error:S,isLoading:C,mutate:w}=f(t?`setup-checklist-skills`:null,he,b),E;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(E={revalidateOnFocus:!1},e[3]=E):E=e[3];let{data:D,error:O,isLoading:A,mutate:j}=f(t?`setup-checklist-provider-meta`:null,T,E),M;e[4]===t?M=e[5]:(M=t?se():null,e[4]=t,e[5]=M);let N;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(N={revalidateOnFocus:!1},e[6]=N):N=e[6];let{data:P,error:F,isLoading:I,mutate:L}=f(M,ce,N),R;e[7]===t?R=e[8]:(R=t?le():null,e[7]=t,e[8]=R);let z;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(z={revalidateOnFocus:!1},e[9]=z):z=e[9];let{data:ee,isLoading:V,mutate:H}=f(R,ue,z);d?.payload?.config;let U=d?.payload?.config,W;e[10]===U?W=e[11]:(W=ae(U),e[10]=U,e[11]=W);let G=t?W:null,K;e[12]===G?K=e[13]:(K=de(G),e[12]=G,e[13]=K);let q;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(q={revalidateOnFocus:!1},e[14]=q):q=e[14];let{data:J,isLoading:te,mutate:Y}=f(K,me,q),X;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(X={revalidateOnFocus:!1},e[15]=X):X=e[15],f(t?g:null,h,X);let Z=!t||!v&&!C&&!A&&!I&&!V&&!te,ne=!!(_||S||O||F),re;bb0:{if(!t||!Z){re=null;break bb0}let n=x?.catalog?.length??0,r;if(e[16]!==J||e[17]!==d?.payload?.config||e[18]!==s.browserDriverConfigured||e[19]!==s.chromiumInstalled||e[20]!==s.chromiumNotInstalled||e[21]!==s.extensionConnected||e[22]!==s.extensionNeedsRefresh||e[23]!==s.extensionNotConnected||e[24]!==s.extensionNotInstalled||e[25]!==s.gatewayNotInstalled||e[26]!==s.gatewayNotRunning||e[27]!==s.gatewayUnavailable||e[28]!==s.installCommand||e[29]!==s.labels||e[30]!==s.logsErrors||e[31]!==s.logsHealthy||e[32]!==s.logsShuttingDown||e[33]!==s.providerAuthMissing||e[34]!==s.runCommand||e[35]!==s.runtimeInvalid||e[36]!==s.runtimeMissing||e[37]!==s.startCommand||e[38]!==P||e[39]!==a.channelConfigured||e[40]!==a.channelMissing||e[41]!==a.gatewayOffline||e[42]!==a.gatewayOnline||e[43]!==a.modelConfigured||e[44]!==a.modelMissing||e[45]!==a.providersConfigured||e[46]!==a.providersMetaReady||e[47]!==a.providersMissing||e[48]!==a.skillsConfigured||e[49]!==a.skillsMissing||e[50]!==ee||e[51]!==i.setupStatus.requiredCompleteMessage||e[52]!==D||e[53]!==c||e[54]!==n||e[55]!==t){let o=D?.filter(pe).length??0,l=D?.length??0,u;e[57]===a.providersConfigured?u=e[58]:(u=e=>a.providersConfigured.replace(`{{count}}`,String(e)),e[57]=a.providersConfigured,e[58]=u);let f;e[59]===a.providersMetaReady?f=e[60]:(f=(e,t)=>a.providersMetaReady.replace(`{{configured}}`,String(e)).replace(`{{total}}`,String(t)),e[59]=a.providersMetaReady,e[60]=f);let p;e[61]===a.modelConfigured?p=e[62]:(p=e=>a.modelConfigured.replace(`{{model}}`,e),e[61]=a.modelConfigured,e[62]=p);let m;e[63]===a.skillsConfigured?m=e[64]:(m=e=>a.skillsConfigured.replace(`{{count}}`,String(e)),e[63]=a.skillsConfigured,e[64]=m);let h;e[65]===s.runtimeMissing?h=e[66]:(h=e=>s.runtimeMissing.replace(`{{runtimes}}`,e),e[65]=s.runtimeMissing,e[66]=h);let g;e[67]===s.runtimeInvalid?g=e[68]:(g=e=>s.runtimeInvalid.replace(`{{runtimes}}`,e),e[67]=s.runtimeInvalid,e[68]=g);let _;e[69]===s.gatewayUnavailable?_=e[70]:(_=e=>s.gatewayUnavailable.replace(`{{detail}}`,e),e[69]=s.gatewayUnavailable,e[70]=_);let v;e[71]===s.gatewayNotRunning?v=e[72]:(v=e=>s.gatewayNotRunning.replace(`{{status}}`,e),e[71]=s.gatewayNotRunning,e[72]=v);let y;e[73]===s.runCommand?y=e[74]:(y=e=>s.runCommand.replace(`{{command}}`,e),e[73]=s.runCommand,e[74]=y);let b;e[75]===s.installCommand?b=e[76]:(b=e=>s.installCommand.replace(`{{command}}`,e),e[75]=s.installCommand,e[76]=b);let x;e[77]===s.startCommand?x=e[78]:(x=e=>s.startCommand.replace(`{{command}}`,e),e[77]=s.startCommand,e[78]=x);let S;e[79]===s.logsErrors?S=e[80]:(S=e=>s.logsErrors.replace(`{{count}}`,String(e)),e[79]=s.logsErrors,e[80]=S);let C;e[81]===s.browserDriverConfigured?C=e[82]:(C=e=>s.browserDriverConfigured.replace(`{{driver}}`,e),e[81]=s.browserDriverConfigured,e[82]=C),r=ie({isElectron:k(),hasToken:!!t,realtimeConnected:c,config:d?.payload?.config,skillCount:n,providerMeta:l>0?{configured:o,total:l}:null,doctorChecks:P,logsHealth:ee,browserDiagnostics:J,labels:{gatewayOnline:a.gatewayOnline,gatewayOffline:a.gatewayOffline,providersConfigured:u,providersMetaReady:f,providersMissing:a.providersMissing,modelConfigured:p,modelMissing:a.modelMissing,channelConfigured:a.channelConfigured,channelMissing:a.channelMissing,skillsConfigured:m,skillsMissing:a.skillsMissing,readyToChat:i.setupStatus.requiredCompleteMessage,diagnostics:{labels:s.labels,runtimeMissing:h,runtimeInvalid:g,gatewayNotInstalled:s.gatewayNotInstalled,gatewayUnavailable:_,gatewayNotRunning:v,providerAuthMissing:s.providerAuthMissing,runCommand:y,installCommand:b,startCommand:x,logsHealthy:s.logsHealthy,logsShuttingDown:s.logsShuttingDown,logsErrors:S,chromiumInstalled:s.chromiumInstalled,chromiumNotInstalled:s.chromiumNotInstalled,extensionConnected:s.extensionConnected,extensionNeedsRefresh:s.extensionNeedsRefresh,extensionNotConnected:s.extensionNotConnected,extensionNotInstalled:s.extensionNotInstalled,browserDriverConfigured:C}}}),e[16]=J,e[17]=d?.payload?.config,e[18]=s.browserDriverConfigured,e[19]=s.chromiumInstalled,e[20]=s.chromiumNotInstalled,e[21]=s.extensionConnected,e[22]=s.extensionNeedsRefresh,e[23]=s.extensionNotConnected,e[24]=s.extensionNotInstalled,e[25]=s.gatewayNotInstalled,e[26]=s.gatewayNotRunning,e[27]=s.gatewayUnavailable,e[28]=s.installCommand,e[29]=s.labels,e[30]=s.logsErrors,e[31]=s.logsHealthy,e[32]=s.logsShuttingDown,e[33]=s.providerAuthMissing,e[34]=s.runCommand,e[35]=s.runtimeInvalid,e[36]=s.runtimeMissing,e[37]=s.startCommand,e[38]=P,e[39]=a.channelConfigured,e[40]=a.channelMissing,e[41]=a.gatewayOffline,e[42]=a.gatewayOnline,e[43]=a.modelConfigured,e[44]=a.modelMissing,e[45]=a.providersConfigured,e[46]=a.providersMetaReady,e[47]=a.providersMissing,e[48]=a.skillsConfigured,e[49]=a.skillsMissing,e[50]=ee,e[51]=i.setupStatus.requiredCompleteMessage,e[52]=D,e[53]=c,e[54]=n,e[55]=t,e[56]=r}else r=e[56];re=r}let oe=re,Q;e[83]!==Y||e[84]!==y||e[85]!==L||e[86]!==H||e[87]!==j||e[88]!==w?(Q=async()=>{await Promise.all([y(),w(),j(),L(),H(),Y()])},e[83]=Y,e[84]=y,e[85]=L,e[86]=H,e[87]=j,e[88]=w,e[89]=Q):Q=e[89];let fe=Q,$;return e[90]!==ne||e[91]!==Z||e[92]!==fe||e[93]!==oe?($={ready:Z,error:ne,snapshot:oe,refresh:fe},e[90]=ne,e[91]=Z,e[92]=fe,e[93]=oe,e[94]=$):$=e[94],$}function pe(e){return e.configured}function me(e){let[,t]=e;return fe(t)}function he(){return A()}function ge(e){return e.connectionState===`connected`}function _e(e){return e.language}function ve(e){return e.conversationId}function ye(e){return e===`pass`?`bg-success-soft text-success`:e===`warn`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`fail`?`bg-red-500/10 text-red-700 dark:text-red-300`:`bg-surface-hover text-fg-muted`}function be(e){return e===`pass`?a:e===`warn`?D:e===`fail`?_:O}function xe(e,t){return e===`blocked`?{icon:_,className:`bg-red-500/10 text-red-950 dark:text-red-100`,title:t.health.blockedTitle,body:t.health.blockedBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`attention`?{icon:D,className:`bg-amber-500/10 text-amber-950 dark:text-amber-100`,title:t.health.attentionTitle,body:t.health.attentionBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`setup`?{icon:S,className:`bg-surface-hover/50 text-fg`,title:t.health.setupTitle,body:t.health.setupBody,action:t.health.continueSetup,targetId:`next-steps`}:{icon:a,className:`bg-success-soft text-success`,title:t.health.readyTitle,body:t.health.readyBody,action:t.health.startChat,actionPath:`/chat`}}function Se(e){let t=(0,B.c)(46),{tier:n,issueCount:r,onRunDoctor:a,ready:c,doctorRunning:l,doctorRunState:d}=e,f=u(Ce),p,m,h,g,_,v,b,x,S;if(t[0]!==r||t[1]!==f||t[2]!==n){m=o(f).setupStatus;let e=xe(n,m),a=e.icon,c=`targetId`in e&&typeof e.targetId==`string`?e.targetId:null,l=`actionPath`in e&&typeof e.actionPath==`string`?e.actionPath:`/chat`;p=c?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(c)?.scrollIntoView({block:`start`,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}),className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,H.jsx)(j,{className:`size-4`,"aria-hidden":!0})]}):(0,H.jsxs)(i,{to:l,className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,H.jsx)(j,{className:`size-4`,"aria-hidden":!0})]}),S=s(`rounded-xl p-4`,e.className),x=`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,v=`flex min-w-0 gap-3`,b=(0,H.jsx)(a,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),h=`min-w-0`,g=(0,H.jsx)(`h2`,{className:`text-base font-semibold`,children:e.title}),_=r>0?(0,H.jsx)(`p`,{className:`mt-1 text-sm opacity-80`,children:m.health.issueCount.replace(`{{count}}`,String(r))}):null,t[0]=r,t[1]=f,t[2]=n,t[3]=p,t[4]=m,t[5]=h,t[6]=g,t[7]=_,t[8]=v,t[9]=b,t[10]=x,t[11]=S}else p=t[3],m=t[4],h=t[5],g=t[6],_=t[7],v=t[8],b=t[9],x=t[10],S=t[11];let C;t[12]!==h||t[13]!==g||t[14]!==_?(C=(0,H.jsxs)(`div`,{className:h,children:[g,_]}),t[12]=h,t[13]=g,t[14]=_,t[15]=C):C=t[15];let w;t[16]!==v||t[17]!==b||t[18]!==C?(w=(0,H.jsxs)(`div`,{className:v,children:[b,C]}),t[16]=v,t[17]=b,t[18]=C,t[19]=w):w=t[19];let T;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(T=s(`inline-flex items-center gap-2 rounded-lg bg-surface-base/70 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`,y.press),t[20]=T):T=t[20];let D=!c||l,O;t[21]===l?O=t[22]:(O=l?(0,H.jsx)(E,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,H.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t[21]=l,t[22]=O);let k=l?m.health.runDoctorRunning:m.health.runDoctor,A;t[23]!==l||t[24]!==a||t[25]!==D||t[26]!==O||t[27]!==k?(A=(0,H.jsxs)(`button`,{type:`button`,className:T,onClick:a,disabled:D,"aria-busy":l,children:[O,k]}),t[23]=l,t[24]=a,t[25]=D,t[26]=O,t[27]=k,t[28]=A):A=t[28];let N;t[29]!==p||t[30]!==A?(N=(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[p,A]}),t[29]=p,t[30]=A,t[31]=N):N=t[31];let P;t[32]!==N||t[33]!==x||t[34]!==w?(P=(0,H.jsxs)(`div`,{className:x,children:[w,N]}),t[32]=N,t[33]=x,t[34]=w,t[35]=P):P=t[35];let F;t[36]!==d||t[37]!==l||t[38]!==m.health.doctorCompleteMessage||t[39]!==m.health.doctorFailedMessage||t[40]!==m.health.doctorRunningMessage?(F=l||d!==`idle`?(0,H.jsx)(`p`,{className:`mt-3 text-xs opacity-75`,role:`status`,"aria-live":`polite`,children:l?m.health.doctorRunningMessage:d===`success`?m.health.doctorCompleteMessage:m.health.doctorFailedMessage}):null,t[36]=d,t[37]=l,t[38]=m.health.doctorCompleteMessage,t[39]=m.health.doctorFailedMessage,t[40]=m.health.doctorRunningMessage,t[41]=F):F=t[41];let I;return t[42]!==P||t[43]!==F||t[44]!==S?(I=(0,H.jsxs)(`section`,{className:S,children:[P,F]}),t[42]=P,t[43]=F,t[44]=S,t[45]=I):I=t[45],I}function Ce(e){return e.language}function we(e){let t=(0,B.c)(26),{issue:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=be(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,H.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=s);let c;t[4]===n.label?c=t[5]:(c=(0,H.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:n.label}),t[4]=n.label,t[5]=c);let l;t[6]===n.message?l=t[7]:(l=(0,H.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=l);let u;t[8]===n.hints[0]?u=t[9]:(u=n.hints[0]?(0,H.jsx)(`span`,{className:`mt-1 block truncate text-xs text-fg-subtle`,children:n.hints[0]}):null,t[8]=n.hints[0],t[9]=u);let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]!==r||t[15]!==n.path?(f=n.path?(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg`,children:[r,(0,H.jsx)(j,{className:`size-4`,"aria-hidden":!0})]}):null,t[14]=r,t[15]=n.path,t[16]=f):f=t[16];let p;t[17]!==s||t[18]!==d||t[19]!==f?(p=(0,H.jsxs)(H.Fragment,{children:[s,d,f]}),t[17]=s,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m=p;if(n.path){let e;return t[21]!==m||t[22]!==n.path?(e=(0,H.jsx)(i,{to:n.path,className:`flex items-start gap-3 px-1 py-3 hover:bg-surface-hover/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:m}),t[21]=m,t[22]=n.path,t[23]=e):e=t[23],e}let h;return t[24]===m?h=t[25]:(h=(0,H.jsx)(`div`,{className:`flex items-start gap-3 px-1 py-3`,children:m}),t[24]=m,t[25]=h),h}function Te(e){let t=(0,B.c)(27),{item:n,labels:r}=e,a;t[0]===n.status?a=t[1]:(a=be(n.status),t[0]=n.status,t[1]=a);let o=a,c=r[n.id]??n.title,l;t[2]===n.status?l=t[3]:(l=s(`flex size-7 shrink-0 items-center justify-center rounded-full`,ye(n.status)),t[2]=n.status,t[3]=l);let u;t[4]===o?u=t[5]:(u=(0,H.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t[4]=o,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,H.jsx)(`span`,{className:l,children:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]===c?f=t[10]:(f=(0,H.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:c}),t[9]=c,t[10]=f);let p;t[11]===n.detail?p=t[12]:(p=(0,H.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.detail}),t[11]=n.detail,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===n.path?h=t[17]:(h=n.path?(0,H.jsx)(j,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[16]=n.path,t[17]=h);let g;t[18]!==d||t[19]!==m||t[20]!==h?(g=(0,H.jsxs)(H.Fragment,{children:[d,m,h]}),t[18]=d,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _=g;if(n.path){let e;return t[22]!==_||t[23]!==n.path?(e=(0,H.jsx)(i,{to:n.path,className:`flex items-center gap-3 rounded-lg p-3 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:_}),t[22]=_,t[23]=n.path,t[24]=e):e=t[24],e}let v;return t[25]===_?v=t[26]:(v=(0,H.jsx)(`div`,{className:`flex items-center gap-3 rounded-lg p-3`,children:_}),t[25]=_,t[26]=v),v}function Ee(e){let t=(0,B.c)(23),{signal:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=be(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,H.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=s);let c;t[4]===n.label?c=t[5]:(c=(0,H.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.label}),t[4]=n.label,t[5]=c);let l;t[6]===n.message?l=t[7]:(l=(0,H.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=l);let u;t[8]!==c||t[9]!==l?(u=(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==r||t[12]!==n.path?(d=n.path?(0,H.jsx)(`span`,{className:`sr-only`,children:r}):null,t[11]=r,t[12]=n.path,t[13]=d):d=t[13];let f;t[14]!==s||t[15]!==u||t[16]!==d?(f=(0,H.jsxs)(H.Fragment,{children:[s,u,d]}),t[14]=s,t[15]=u,t[16]=d,t[17]=f):f=t[17];let p=f;if(n.path){let e;return t[18]!==p||t[19]!==n.path?(e=(0,H.jsx)(i,{to:n.path,className:`flex min-w-0 items-start gap-2 px-1 py-3 hover:bg-surface-hover/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:p}),t[18]=p,t[19]=n.path,t[20]=e):e=t[20],e}let m;return t[21]===p?m=t[22]:(m=(0,H.jsx)(`div`,{className:`flex min-w-0 items-start gap-2 px-1 py-3`,children:p}),t[21]=p,t[22]=m),m}function De(){let e=o(u(e=>e.language)).setupStatus,{ready:t,error:n,snapshot:r,refresh:i}=$(),[a,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(`idle`),d=r?.diagnosticSignals.filter(e=>e.status===`fail`||e.status===`warn`)??[],f=async()=>{if(!(a||!t)){s(!0),l(`idle`);try{await i(),l(`success`)}catch{l(`error`)}finally{s(!1)}}};return(0,H.jsxs)(F,{gap:`gap-6`,children:[(0,H.jsx)(P,{title:e.title}),n?(0,H.jsx)(`p`,{className:`rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-950/30 dark:text-red-300`,children:e.loadError}):null,!t||!r?(0,H.jsx)(b,{sections:2}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Se,{tier:r.healthTier,issueCount:r.issues.length,ready:t,onRunDoctor:()=>void f(),doctorRunning:a,doctorRunState:c}),(0,H.jsxs)(L,{id:`next-steps`,children:[(0,H.jsx)(I,{icon:r.issues.length?D:v,title:e.nextStepsTitle}),r.issues.length?(0,H.jsx)(`div`,{className:`mt-3 flex flex-col gap-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45 [&>*]:px-3`,children:r.issues.slice(0,8).map(t=>(0,H.jsx)(we,{issue:t,fixLabel:e.fixIssue},`${t.source}:${t.id}`))}):(0,H.jsx)(`div`,{className:`mt-3 flex flex-col gap-1 [&>*]:bg-surface-base/45`,children:r.readiness.map(t=>(0,H.jsx)(Te,{item:t,labels:e.readinessLabels},t.id))})]}),(0,H.jsx)(U,{}),(0,H.jsx)(R,{children:(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:N,title:e.diagnosticsTitle}),d.length?(0,H.jsx)(`div`,{className:`mt-3 flex flex-col gap-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45 [&>*]:px-3`,children:d.map(t=>(0,H.jsx)(Ee,{signal:t,fixLabel:e.fixIssue},t.id))}):(0,H.jsx)(`p`,{className:`mt-3 py-2 text-sm text-fg-muted`,children:r.diagnosticSignals.length?e.diagnosticsAllClear:e.diagnosticsEmpty})]})})]})]})}export{De as SetupStatusPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-Db4nTY5N.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/pdf-runtime-DU_sMPjG.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{m as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./markdown-view-PrKvVpRh.js";import{t as s}from"./messages-CaeL_miw.js";import{t as c}from"./cn-0WouolD0.js";import{n as l,r as u}from"./locale-store-CE7L6MlS.js";import{t as d}from"./copy-to-clipboard-HOJ79TWv.js";import{t as f}from"./attachment-utils-core-BIOUBrpT.js";import{Ba as p,Fc as m,Ic as h,Lc as g,Ra as _,Va as v,Ys as y,oa as b,sa as x}from"./index-CKdOZoVu.js";var S=e(t(),1),C=n(),w=/^ {0,3}\[([^\]]+)\]:\s*<?(https?:\/\/[^\s>]+)>?(?:\s+.*)?$/gim,T=/!\[([^\]]*)\]\(\s*<?(https?:\/\/[^\s)>]+)>?(?:\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*\)/gi,E=/!\[([^\]]*)\]\[([^\]]+)\]/g;function D(e,t){let n=new Map;for(let t of e.matchAll(w))n.set(O(t[1]??``),t[2]??``);return e.replace(T,(e,n,r)=>`[${n.trim()||t}](${r})`).replace(E,(e,r,i)=>{let a=n.get(O(i));return a?`[${r.trim()||t}](${a})`:e})}function O(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}var k=r();function A(e){return(0,k.jsx)(m,{source:e.source,incomplete:!e.closed,streaming:!1,copy:!0})}function j(){return{textContent:null,binaryBuffer:null,extractedText:null,extractedTextTruncated:!1}}function M(e){let t=(0,C.c)(30),{subtitle:n,openInlineUrl:r,landingUrl:i,...a}=e,{expanded:o,setExpanded:l}=b(),u=s(a.language),f;t[0]===u?f=t[1]:(f=async()=>{let e=await d(window.location.href);y(e?`success`:`warning`,e?u.sharesSettings.copied:u.clipboard.copyFailed)},t[0]=u,t[1]=f);let p=f,m=o&&`fixed inset-0 z-[65] h-[100dvh] max-w-none`,h;t[2]===m?h=t[3]:(h=c(`mx-auto flex h-full min-h-0 w-full max-w-[var(--max-width-app-main)] flex-col bg-surface-panel`,m),t[2]=m,t[3]=h);let g;t[4]!==l||t[5]!==a.loadError||t[6]!==a.loading?(g=!a.loading&&!a.loadError?()=>l(N):void 0,t[4]=l,t[5]=a.loadError,t[6]=a.loading,t[7]=g):g=t[7];let _;t[8]===i?_=t[9]:(_=()=>window.location.assign(i),t[8]=i,t[9]=_);let v;t[10]===p?v=t[11]:(v=()=>void p(),t[10]=p,t[11]=v);let S=a.loading||!!a.loadError,w;t[12]!==v||t[13]!==S?(w={onClick:v,disabled:S},t[12]=v,t[13]=S,t[14]=w):w=t[14];let T;t[15]===r?T=t[16]:(T={href:r},t[15]=r,t[16]=T);let E;t[17]!==o||t[18]!==n||t[19]!==g||t[20]!==_||t[21]!==w||t[22]!==T?(E={subtitle:n,expanded:o,onToggleExpanded:g,onClose:_,share:w,openInBrowser:T},t[17]=o,t[18]=n,t[19]=g,t[20]=_,t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==a||t[25]!==E?(D=(0,k.jsx)(x,{...a,header:E}),t[24]=a,t[25]=E,t[26]=D):D=t[26];let O;return t[27]!==D||t[28]!==h?(O=(0,k.jsx)(`div`,{className:h,children:D}),t[27]=D,t[28]=h,t[29]=O):O=t[29],O}function N(e){return!e}function P(){let{token:e}=a(),t=l(e=>e.language),n=t===`zh`?L:R,[r,s]=(0,S.useState)(null),[c,d]=(0,S.useState)(j),[m,y]=(0,S.useState)(!0),[b,x]=(0,S.useState)(null),[C,w]=(0,S.useState)(null),[T,E]=(0,S.useState)(null),O=(0,S.useMemo)(()=>{if(!r||!e||r.kind!==`file`)return null;let t=p(r.fileName,r.mimeType);return{id:`share:${e}:${r.fileName}`,context:`share`,fileName:r.fileName,mimeType:t,size:r.fileSize,type:_(r.fileName,t),source:{kind:`share`,token:e}}},[r,e]);(0,S.useEffect)(()=>{if(!e){x(n.invalidLink),y(!1);return}let t=!1;return(async()=>{try{y(!0),x(null),d(j()),w(null),E(null);let r=await fetch(u(`/s/${encodeURIComponent(e)}/meta`));if(!r.ok){t||x(r.status===404?n.notFound:n.expired);return}let a=await r.json();if(t)return;if(s(a),!a.valid){x(n.expired);return}if(a.kind===`note`||a.kind===`session`){let r=await fetch(u(`/s/${encodeURIComponent(e)}/view`),{method:`POST`});if(!r.ok){x(r.status===404?n.notFound:n.expired);return}let i=await r.json();!t&&i.payload?.kind===`note`&&w(i.payload),!t&&i.payload?.kind===`session`&&E(i.payload);return}if(a.kind!==`file`)return;let o=p(a.fileName,a.mimeType),c=_(a.fileName,o),l=v(c),m=u(`/s/${encodeURIComponent(e)}?inline=1`);if(l===`text`){if(a.fileSize>5242880){x(n.tooLarge);return}let e=await fetch(m);if(!e.ok){x(n.expired);return}let r=await e.text();t||d({...j(),textContent:r});return}if(l===`binary`){if(a.fileSize>33554432){x(n.tooLarge);return}let e=await fetch(m);if(!e.ok){x(n.expired);return}let r=await e.arrayBuffer();if(t)return;if(c===`pptx`){let{processPptx:e}=await i(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-Db4nTY5N.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:t}=await e(r,a.fileName),n=t.length>f;d({textContent:null,binaryBuffer:r,extractedText:n?t.slice(0,f):t,extractedTextTruncated:n});return}d({...j(),binaryBuffer:r})}}catch(e){t||x(e instanceof Error?e.message:String(e))}finally{t||y(!1)}})(),()=>{t=!0}},[e,n.expired,n.invalidLink,n.notFound,n.tooLarge]);let N=e?u(`/s/${encodeURIComponent(e)}?dl=1`):`#`,P=e?u(`/s/${encodeURIComponent(e)}?inline=1`):`#`;return O&&r&&e?(0,k.jsx)(M,{language:t,descriptor:O,loading:m,loadError:b,textContent:c.textContent,binaryBuffer:c.binaryBuffer,extractedText:c.extractedText,extractedTextTruncated:c.extractedTextTruncated,subtitle:(0,k.jsxs)(`span`,{className:`truncate`,children:[I(r.fileSize),` · `,n.expiresAt,` `,new Date(r.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),openInlineUrl:P,landingUrl:u(`/s/${encodeURIComponent(e)}`),actions:{onDownload:()=>{window.location.href=N},canDownload:!m&&!b}}):(0,k.jsx)(g,{children:(0,k.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-surface-base`,children:[(0,k.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-edge px-4`,children:[(0,k.jsx)(`span`,{className:`text-lg`,"aria-hidden":!0,children:`#`}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,k.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,title:r.fileName,children:r.fileName}):m?(0,k.jsx)(h,{className:`h-4 w-48 max-w-full`}):(0,k.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:n.error}),r?(0,k.jsxs)(`div`,{className:`truncate text-xs text-fg-muted`,children:[I(r.fileSize),` · `,n.expiresAt,` `,new Date(r.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}):null]})]}),(0,k.jsx)(`main`,{className:`flex min-h-0 w-full flex-1 flex-col overflow-y-auto overscroll-contain px-3 py-6 sm:px-5 xl:px-6`,children:m?(0,k.jsxs)(`div`,{className:`flex min-h-[70vh] flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,k.jsx)(h,{className:`h-5 w-56 max-w-full`}),(0,k.jsxs)(`div`,{className:`mt-5 grid gap-3`,children:[(0,k.jsx)(h,{className:`h-4 w-full`}),(0,k.jsx)(h,{className:`h-4 w-11/12`}),(0,k.jsx)(h,{className:`h-4 w-10/12`}),(0,k.jsx)(h,{className:`h-4 w-3/4`})]}),(0,k.jsx)(h,{className:`mt-6 min-h-0 flex-1 rounded-lg`})]}):b?(0,k.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg`,children:[(0,k.jsx)(`p`,{className:`font-medium`,children:n.error}),(0,k.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:b})]}):r?.kind===`directory`?(0,k.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg-muted`,children:n.directoryHint}):r?.kind===`note`&&C?(0,k.jsxs)(`article`,{className:`mx-auto w-full max-w-3xl rounded-xl border border-edge-subtle bg-surface-panel px-6 py-8 shadow-surface sm:px-10 sm:py-10`,children:[(0,k.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-fg`,children:C.title}),(0,k.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.sharedAt,` `,new Date(C.snapshotAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`),` · `,n.expiresAt,` `,new Date(C.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),C.description?(0,k.jsx)(`p`,{className:`mt-5 rounded-lg bg-surface-inset px-4 py-3 text-sm leading-6 text-fg-muted`,children:C.description}):null,(0,k.jsx)(o,{content:D(C.markdown,n.remoteImageBlocked),className:`mt-8`,renderChart:A}),(0,k.jsx)(`footer`,{className:`mt-10 border-t border-edge-subtle pt-4 text-center text-xs text-fg-subtle`,children:n.sharedVia})]}):r?.kind===`session`&&T?(0,k.jsxs)(`article`,{className:`mx-auto w-full max-w-4xl rounded-xl border border-edge-subtle bg-surface-panel px-4 py-7 shadow-surface sm:px-8 sm:py-9`,children:[(0,k.jsxs)(`header`,{className:`mx-auto max-w-3xl border-b border-edge-subtle pb-5`,children:[(0,k.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight text-fg sm:text-3xl`,children:T.title}),(0,k.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.sharedAt,` `,new Date(T.snapshotAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`),` · `,n.expiresAt,` `,new Date(T.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),T.description?(0,k.jsx)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:T.description}):null]}),(0,k.jsxs)(`div`,{className:`mx-auto mt-6 max-w-3xl space-y-5`,children:[T.messages.map(e=>(0,k.jsxs)(`section`,{className:e.role===`user`?`ml-auto max-w-[85%]`:`mr-auto max-w-full`,children:[(0,k.jsx)(`div`,{className:`mb-1 text-xs font-medium text-fg-subtle`,children:e.role===`user`?n.you:n.assistant}),(0,k.jsxs)(`div`,{className:e.role===`user`?`rounded-2xl bg-surface-inset px-4 py-3`:`px-1 py-1`,children:[(0,k.jsx)(o,{content:D(e.markdown,n.remoteImageBlocked),renderChart:A}),T.attachments.filter(t=>e.attachmentIds.includes(t.id)).map(e=>(0,k.jsx)(F,{attachment:e},e.id)),T.toolActivities.filter(t=>t.messageId===e.id).map(e=>(0,k.jsxs)(`div`,{className:`mt-2 inline-flex items-center gap-1.5 rounded-md border border-edge-subtle px-2 py-1 text-xs text-fg-muted`,children:[(0,k.jsx)(`span`,{children:e.toolName}),(0,k.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,k.jsx)(`span`,{children:e.status===`completed`?n.toolCompleted:n.toolFailed})]},e.id))]})]},e.id)),T.toolActivities.filter(e=>!e.messageId).map(e=>(0,k.jsxs)(`div`,{className:`text-center text-xs text-fg-muted`,children:[e.toolName,` · `,e.status===`completed`?n.toolCompleted:n.toolFailed]},e.id))]}),(0,k.jsx)(`footer`,{className:`mx-auto mt-10 max-w-3xl border-t border-edge-subtle pt-4 text-center text-xs text-fg-subtle`,children:n.sharedVia})]}):null})]})})}function F(e){let t=(0,C.c)(15),{attachment:n}=e;if(n.mimeType.startsWith(`image/`)){let e;return t[0]!==n.fileName||t[1]!==n.url?(e=(0,k.jsx)(`img`,{src:n.url,alt:n.fileName,loading:`lazy`,className:`mt-3 max-h-[28rem] max-w-full rounded-lg border border-edge-subtle object-contain`}),t[0]=n.fileName,t[1]=n.url,t[2]=e):e=t[2],e}if(n.mimeType.startsWith(`audio/`)){let e;return t[3]===n.url?e=t[4]:(e=(0,k.jsx)(`audio`,{src:n.url,controls:!0,preload:`none`,className:`mt-3 max-w-full`}),t[3]=n.url,t[4]=e),e}let r=n.url,i;t[5]===n.fileName?i=t[6]:(i=(0,k.jsx)(`span`,{className:`min-w-0 truncate`,children:n.fileName}),t[5]=n.fileName,t[6]=i);let a;t[7]===n.size?a=t[8]:(a=I(n.size),t[7]=n.size,t[8]=a);let o;t[9]===a?o=t[10]:(o=(0,k.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:a}),t[9]=a,t[10]=o);let s;return t[11]!==n.url||t[12]!==i||t[13]!==o?(s=(0,k.jsxs)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,className:`mt-3 flex items-center justify-between gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:[i,o]}),t[11]=n.url,t[12]=i,t[13]=o,t[14]=s):s=t[14],s}function I(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}var L={error:`加载失败`,expired:`链接已失效`,notFound:`链接不存在`,invalidLink:`链接无效`,expiresAt:`有效期至`,directoryHint:`目录分享请使用主页面浏览。`,tooLarge:`文件过大,无法在线预览,请下载查看。`,sharedAt:`分享于`,sharedVia:`通过 xopc 分享`,you:`你`,assistant:`助手`,toolCompleted:`已完成`,toolFailed:`失败`,remoteImageBlocked:`远程图片(点击打开)`},R={error:`Failed to load`,expired:`Link no longer valid`,notFound:`Link not found`,invalidLink:`Invalid link`,expiresAt:`Expires`,directoryHint:`Directory shares are browsed from the main page.`,tooLarge:`This file is too large to preview here. Please download it instead.`,sharedAt:`Shared`,sharedVia:`Shared via xopc`,you:`You`,assistant:`Assistant`,toolCompleted:`completed`,toolFailed:`failed`,remoteImageBlocked:`Remote image (open manually)`};export{P as SharePreviewPage};
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{m as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./markdown-view-DyO7Q0Ms.js";import{t as s}from"./messages-DPxcWxfD.js";import{t as c}from"./cn-0WouolD0.js";import{n as l,r as u}from"./locale-store-Djl2FW6_.js";import{t as d}from"./copy-to-clipboard-HOJ79TWv.js";import{t as f}from"./attachment-utils-core-BIOUBrpT.js";import{Ha as p,Lc as m,Rc as h,Va as g,Zs as _,ca as v,sa as y,za as b,zc as x}from"./index-BNRLzxpH.js";var S=e(t(),1),C=n(),w=/^ {0,3}\[([^\]]+)\]:\s*<?(https?:\/\/[^\s>]+)>?(?:\s+.*)?$/gim,T=/!\[([^\]]*)\]\(\s*<?(https?:\/\/[^\s)>]+)>?(?:\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*\)/gi,E=/!\[([^\]]*)\]\[([^\]]+)\]/g;function D(e,t){let n=new Map;for(let t of e.matchAll(w))n.set(O(t[1]??``),t[2]??``);return e.replace(T,(e,n,r)=>`[${n.trim()||t}](${r})`).replace(E,(e,r,i)=>{let a=n.get(O(i));return a?`[${r.trim()||t}](${a})`:e})}function O(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}var k=r();function A(e){return(0,k.jsx)(m,{source:e.source,incomplete:!e.closed,streaming:!1,copy:!0})}function j(){return{textContent:null,binaryBuffer:null,extractedText:null,extractedTextTruncated:!1}}function M(e){let t=(0,C.c)(30),{subtitle:n,openInlineUrl:r,landingUrl:i,...a}=e,{expanded:o,setExpanded:l}=y(),u=s(a.language),f;t[0]===u?f=t[1]:(f=async()=>{let e=await d(window.location.href);_(e?`success`:`warning`,e?u.sharesSettings.copied:u.clipboard.copyFailed)},t[0]=u,t[1]=f);let p=f,m=o&&`fixed inset-0 z-[65] h-[100dvh] max-w-none`,h;t[2]===m?h=t[3]:(h=c(`mx-auto flex h-full min-h-0 w-full max-w-[var(--max-width-app-main)] flex-col bg-surface-panel`,m),t[2]=m,t[3]=h);let g;t[4]!==l||t[5]!==a.loadError||t[6]!==a.loading?(g=!a.loading&&!a.loadError?()=>l(N):void 0,t[4]=l,t[5]=a.loadError,t[6]=a.loading,t[7]=g):g=t[7];let b;t[8]===i?b=t[9]:(b=()=>window.location.assign(i),t[8]=i,t[9]=b);let x;t[10]===p?x=t[11]:(x=()=>void p(),t[10]=p,t[11]=x);let S=a.loading||!!a.loadError,w;t[12]!==x||t[13]!==S?(w={onClick:x,disabled:S},t[12]=x,t[13]=S,t[14]=w):w=t[14];let T;t[15]===r?T=t[16]:(T={href:r},t[15]=r,t[16]=T);let E;t[17]!==o||t[18]!==n||t[19]!==g||t[20]!==b||t[21]!==w||t[22]!==T?(E={subtitle:n,expanded:o,onToggleExpanded:g,onClose:b,share:w,openInBrowser:T},t[17]=o,t[18]=n,t[19]=g,t[20]=b,t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==a||t[25]!==E?(D=(0,k.jsx)(v,{...a,header:E}),t[24]=a,t[25]=E,t[26]=D):D=t[26];let O;return t[27]!==D||t[28]!==h?(O=(0,k.jsx)(`div`,{className:h,children:D}),t[27]=D,t[28]=h,t[29]=O):O=t[29],O}function N(e){return!e}function P(){let{token:e}=a(),t=l(e=>e.language),n=t===`zh`?L:R,[r,s]=(0,S.useState)(null),[c,d]=(0,S.useState)(j),[m,_]=(0,S.useState)(!0),[v,y]=(0,S.useState)(null),[C,w]=(0,S.useState)(null),[T,E]=(0,S.useState)(null),O=(0,S.useMemo)(()=>{if(!r||!e||r.kind!==`file`)return null;let t=g(r.fileName,r.mimeType);return{id:`share:${e}:${r.fileName}`,context:`share`,fileName:r.fileName,mimeType:t,size:r.fileSize,type:b(r.fileName,t),source:{kind:`share`,token:e}}},[r,e]);(0,S.useEffect)(()=>{if(!e){y(n.invalidLink),_(!1);return}let t=!1;return(async()=>{try{_(!0),y(null),d(j()),w(null),E(null);let r=await fetch(u(`/s/${encodeURIComponent(e)}/meta`));if(!r.ok){t||y(r.status===404?n.notFound:n.expired);return}let a=await r.json();if(t)return;if(s(a),!a.valid){y(n.expired);return}if(a.kind===`note`||a.kind===`session`){let r=await fetch(u(`/s/${encodeURIComponent(e)}/view`),{method:`POST`});if(!r.ok){y(r.status===404?n.notFound:n.expired);return}let i=await r.json();!t&&i.payload?.kind===`note`&&w(i.payload),!t&&i.payload?.kind===`session`&&E(i.payload);return}if(a.kind!==`file`)return;let o=g(a.fileName,a.mimeType),c=b(a.fileName,o),l=p(c),m=u(`/s/${encodeURIComponent(e)}?inline=1`);if(l===`text`){if(a.fileSize>5242880){y(n.tooLarge);return}let e=await fetch(m);if(!e.ok){y(n.expired);return}let r=await e.text();t||d({...j(),textContent:r});return}if(l===`binary`){if(a.fileSize>33554432){y(n.tooLarge);return}let e=await fetch(m);if(!e.ok){y(n.expired);return}let r=await e.arrayBuffer();if(t)return;if(c===`pptx`){let{processPptx:e}=await i(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-Db4nTY5N.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:t}=await e(r,a.fileName),n=t.length>f;d({textContent:null,binaryBuffer:r,extractedText:n?t.slice(0,f):t,extractedTextTruncated:n});return}d({...j(),binaryBuffer:r})}}catch(e){t||y(e instanceof Error?e.message:String(e))}finally{t||_(!1)}})(),()=>{t=!0}},[e,n.expired,n.invalidLink,n.notFound,n.tooLarge]);let N=e?u(`/s/${encodeURIComponent(e)}?dl=1`):`#`,P=e?u(`/s/${encodeURIComponent(e)}?inline=1`):`#`;return O&&r&&e?(0,k.jsx)(M,{language:t,descriptor:O,loading:m,loadError:v,textContent:c.textContent,binaryBuffer:c.binaryBuffer,extractedText:c.extractedText,extractedTextTruncated:c.extractedTextTruncated,subtitle:(0,k.jsxs)(`span`,{className:`truncate`,children:[I(r.fileSize),` · `,n.expiresAt,` `,new Date(r.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),openInlineUrl:P,landingUrl:u(`/s/${encodeURIComponent(e)}`),actions:{onDownload:()=>{window.location.href=N},canDownload:!m&&!v}}):(0,k.jsx)(x,{children:(0,k.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-surface-base`,children:[(0,k.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-edge px-4`,children:[(0,k.jsx)(`span`,{className:`text-lg`,"aria-hidden":!0,children:`#`}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,k.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,title:r.fileName,children:r.fileName}):m?(0,k.jsx)(h,{className:`h-4 w-48 max-w-full`}):(0,k.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:n.error}),r?(0,k.jsxs)(`div`,{className:`truncate text-xs text-fg-muted`,children:[I(r.fileSize),` · `,n.expiresAt,` `,new Date(r.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}):null]})]}),(0,k.jsx)(`main`,{className:`flex min-h-0 w-full flex-1 flex-col overflow-y-auto overscroll-contain px-3 py-6 sm:px-5 xl:px-6`,children:m?(0,k.jsxs)(`div`,{className:`flex min-h-[70vh] flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,k.jsx)(h,{className:`h-5 w-56 max-w-full`}),(0,k.jsxs)(`div`,{className:`mt-5 grid gap-3`,children:[(0,k.jsx)(h,{className:`h-4 w-full`}),(0,k.jsx)(h,{className:`h-4 w-11/12`}),(0,k.jsx)(h,{className:`h-4 w-10/12`}),(0,k.jsx)(h,{className:`h-4 w-3/4`})]}),(0,k.jsx)(h,{className:`mt-6 min-h-0 flex-1 rounded-lg`})]}):v?(0,k.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg`,children:[(0,k.jsx)(`p`,{className:`font-medium`,children:n.error}),(0,k.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:v})]}):r?.kind===`directory`?(0,k.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg-muted`,children:n.directoryHint}):r?.kind===`note`&&C?(0,k.jsxs)(`article`,{className:`mx-auto w-full max-w-3xl rounded-xl border border-edge-subtle bg-surface-panel px-6 py-8 shadow-surface sm:px-10 sm:py-10`,children:[(0,k.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-fg`,children:C.title}),(0,k.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.sharedAt,` `,new Date(C.snapshotAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`),` · `,n.expiresAt,` `,new Date(C.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),C.description?(0,k.jsx)(`p`,{className:`mt-5 rounded-lg bg-surface-inset px-4 py-3 text-sm leading-6 text-fg-muted`,children:C.description}):null,(0,k.jsx)(o,{content:D(C.markdown,n.remoteImageBlocked),className:`mt-8`,renderChart:A}),(0,k.jsx)(`footer`,{className:`mt-10 border-t border-edge-subtle pt-4 text-center text-xs text-fg-subtle`,children:n.sharedVia})]}):r?.kind===`session`&&T?(0,k.jsxs)(`article`,{className:`mx-auto w-full max-w-4xl rounded-xl border border-edge-subtle bg-surface-panel px-4 py-7 shadow-surface sm:px-8 sm:py-9`,children:[(0,k.jsxs)(`header`,{className:`mx-auto max-w-3xl border-b border-edge-subtle pb-5`,children:[(0,k.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight text-fg sm:text-3xl`,children:T.title}),(0,k.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.sharedAt,` `,new Date(T.snapshotAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`),` · `,n.expiresAt,` `,new Date(T.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),T.description?(0,k.jsx)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:T.description}):null]}),(0,k.jsxs)(`div`,{className:`mx-auto mt-6 max-w-3xl space-y-5`,children:[T.messages.map(e=>(0,k.jsxs)(`section`,{className:e.role===`user`?`ml-auto max-w-[85%]`:`mr-auto max-w-full`,children:[(0,k.jsx)(`div`,{className:`mb-1 text-xs font-medium text-fg-subtle`,children:e.role===`user`?n.you:n.assistant}),(0,k.jsxs)(`div`,{className:e.role===`user`?`rounded-2xl bg-surface-inset px-4 py-3`:`px-1 py-1`,children:[(0,k.jsx)(o,{content:D(e.markdown,n.remoteImageBlocked),renderChart:A}),T.attachments.filter(t=>e.attachmentIds.includes(t.id)).map(e=>(0,k.jsx)(F,{attachment:e},e.id)),T.toolActivities.filter(t=>t.messageId===e.id).map(e=>(0,k.jsxs)(`div`,{className:`mt-2 inline-flex items-center gap-1.5 rounded-md border border-edge-subtle px-2 py-1 text-xs text-fg-muted`,children:[(0,k.jsx)(`span`,{children:e.toolName}),(0,k.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,k.jsx)(`span`,{children:e.status===`completed`?n.toolCompleted:n.toolFailed})]},e.id))]})]},e.id)),T.toolActivities.filter(e=>!e.messageId).map(e=>(0,k.jsxs)(`div`,{className:`text-center text-xs text-fg-muted`,children:[e.toolName,` · `,e.status===`completed`?n.toolCompleted:n.toolFailed]},e.id))]}),(0,k.jsx)(`footer`,{className:`mx-auto mt-10 max-w-3xl border-t border-edge-subtle pt-4 text-center text-xs text-fg-subtle`,children:n.sharedVia})]}):null})]})})}function F(e){let t=(0,C.c)(15),{attachment:n}=e;if(n.mimeType.startsWith(`image/`)){let e;return t[0]!==n.fileName||t[1]!==n.url?(e=(0,k.jsx)(`img`,{src:n.url,alt:n.fileName,loading:`lazy`,className:`mt-3 max-h-[28rem] max-w-full rounded-lg border border-edge-subtle object-contain`}),t[0]=n.fileName,t[1]=n.url,t[2]=e):e=t[2],e}if(n.mimeType.startsWith(`audio/`)){let e;return t[3]===n.url?e=t[4]:(e=(0,k.jsx)(`audio`,{src:n.url,controls:!0,preload:`none`,className:`mt-3 max-w-full`}),t[3]=n.url,t[4]=e),e}let r=n.url,i;t[5]===n.fileName?i=t[6]:(i=(0,k.jsx)(`span`,{className:`min-w-0 truncate`,children:n.fileName}),t[5]=n.fileName,t[6]=i);let a;t[7]===n.size?a=t[8]:(a=I(n.size),t[7]=n.size,t[8]=a);let o;t[9]===a?o=t[10]:(o=(0,k.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:a}),t[9]=a,t[10]=o);let s;return t[11]!==n.url||t[12]!==i||t[13]!==o?(s=(0,k.jsxs)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,className:`mt-3 flex items-center justify-between gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:[i,o]}),t[11]=n.url,t[12]=i,t[13]=o,t[14]=s):s=t[14],s}function I(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}var L={error:`加载失败`,expired:`链接已失效`,notFound:`链接不存在`,invalidLink:`链接无效`,expiresAt:`有效期至`,directoryHint:`目录分享请使用主页面浏览。`,tooLarge:`文件过大,无法在线预览,请下载查看。`,sharedAt:`分享于`,sharedVia:`通过 xopc 分享`,you:`你`,assistant:`助手`,toolCompleted:`已完成`,toolFailed:`失败`,remoteImageBlocked:`远程图片(点击打开)`},R={error:`Failed to load`,expired:`Link no longer valid`,notFound:`Link not found`,invalidLink:`Invalid link`,expiresAt:`Expires`,directoryHint:`Directory shares are browsed from the main page.`,tooLarge:`This file is too large to preview here. Please download it instead.`,sharedAt:`Shared`,sharedVia:`Shared via xopc`,you:`You`,assistant:`Assistant`,toolCompleted:`completed`,toolFailed:`failed`,remoteImageBlocked:`Remote image (open manually)`};export{P as SharePreviewPage};
|