@xopcai/xopc 0.0.272 → 0.0.274
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/README.md +1 -5
- package/README.zh-CN.md +1 -5
- package/dist/browser-ext/dist/assets/{auth-C1QI-uMG.js → auth-O8RiOF3l.js} +265 -100
- package/dist/browser-ext/dist/background.js +1 -22
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +68 -36
- package/dist/browser-ext/manifest.json +1 -12
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-DffqjeqQ.js → activity-store-SJZ5fS17.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Cwj4HCYY.js → agent-avatar-dicebear-BckaANxj.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-6CLfLxVc.js → agent-defaults-settings-panel-B8eyC6K1.js} +1 -1
- package/dist/gateway/static/root/assets/agents-CSWj_yo1.js +1 -0
- package/dist/gateway/static/root/assets/{api-CGLdye4i.js → api-CnJAVHBu.js} +1 -1
- package/dist/gateway/static/root/assets/app-link-BiBXVEvp.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BLujSbaw.js → app-management-settings-panel-DY-Zbgmt.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BXMcueb8.js → appearance-settings-CoJR7ZRl.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BEgy4hY3.js → apps-page-CSMvkuot.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-D4bUampf.js → archive-plugin-BwAlRT53.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-load-R835uxgL.js +1 -0
- package/dist/gateway/static/root/assets/{attachment-preview-renderer-BDTD8YUe.js → attachment-preview-renderer-CfEDFYPE.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-process-heavy-C5CqLCsX.js +5 -0
- package/dist/gateway/static/root/assets/{automations-page-dQyolNmy.js → automations-page-BEZy0P_u.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CpaI13J7.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-bbvp81h2.js → binary-plugins-CESFx3yb.js} +2 -2
- package/dist/gateway/static/root/assets/{block-editor-C8e6Wri4.js → block-editor-DDJcf2wR.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-oJWJtQa6.js → browser-automation-inputs-DGCqIPXT.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CAcJQSjN.js → browser-automations-page-BH4lSfr5.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CbTooPd2.js +8 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C4LZWHhv.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-BAljmSa7.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-CfOPNnVr.js → channels-status-swr-BTT2sIGg.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-9ZOl92kh.js → chat-terminal-dock-D8U97O95.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-CVRMjNNr.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-Dj6FRLF9.js → date-picker-7sDSMswL.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-D1q89tVc.js → dependency-picker-DMIC86ZW.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DfqZBvhp.js → desktop-pet-BtdiY5jK.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-HCEh2MOm.js → desktop-pet-settings-D_B8azDH.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-Dmh3Nh4d.js +1 -0
- package/dist/gateway/static/root/assets/excel-worksheet-utils-DpdB-DjU.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-C8cAWVoK.js → extension-debug-page-CoFKb01d.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-5N87Vaym.js → extension-page-CEkNsCAY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-D85SAUFP.js → extension-settings-page-Bi2R8P5j.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BjsDnB_n.js → gateway-config-swr-cd8owslz.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-q9p3sduo.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BIf0eLWX.js → gateway-startup-retry-CVTa5HSS.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-BpDWGE1a.js → heartbeat-settings-DQtelFiU.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-COpGnTFZ.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-1m8xTVS_.js → image-generation-api-DtMRG1oF.js} +1 -1
- package/dist/gateway/static/root/assets/{index-C6PmD0cK.js → index-SxqsTD4i.js} +35 -35
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Byy8mCSq.js → keyboard-shortcuts-settings-BuYmZS1K.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DV_17Zxc.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BPo0wBgM.js → local-apps-page-CExnZyGZ.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CRNble2Z.js → locale-store-BkJ7g35d.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-X5FdLlXK.js → logs-page-CA5ArMoN.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-1UiJPrkX.js +1 -0
- package/dist/gateway/static/root/assets/markdown-view-B2IR4E2r.js +201 -0
- package/dist/gateway/static/root/assets/{media-plugins-Bzka9qXu.js → media-plugins-nNFOk9HL.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-DH_HCgmw.js → messages-BGc-OJWg.js} +2 -2
- package/dist/gateway/static/root/assets/note-detail-panel-B5OQ0fBY.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-CVPPMVDl.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-Ys0p65Lt.js → page-tabs-CRombigq.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-iknB5xEp.js → preview-open-alternatives-Bcuj43lk.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-card-BPZDgNNR.js → proactive-card-Cb3Xeoyx.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-CxdZR-p2.js → proactive-page-TbF9KVpm.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-W1o3f-kz.js → product-open-page-DsQcgZkI.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-B9OQ2l9x.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DCqSTNkY.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-DmYFpjsH.js → registry-api-CTq8EECj.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-d9Fg70gX.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DP1XyYO8.js → runtime-tools-settings-panel-BudlvBu-.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BMYKdzsH.js → schema-form-Ch3MEX4h.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-D8RiQ-ag.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DVH_l6Hr.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-2LGjz7bu.js → settings-form-section-CIA1AA-A.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-7DjpC9_C.js → settings-page-B0Khoduh.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-Dj9jFWJt.js → setup-status-panel-COJFl4N_.js} +1 -1
- package/dist/gateway/static/root/assets/share-preview-page-Cj9XWg-X.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-_OuE6A0G.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BM4Ezjbx.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-DNEScMZH.js → skills-page-Dyh1kf9t.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-q88l65YU.js → skills-page.utils-DsQZkMti.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-8NIssGKj.js → system-settings-panel-BSho_Tpk.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-B5HWM12k.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-BXZG3S25.js → theme-store-mV6Cm2vj.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-CWsRPM84.js → tunnel-api-4DUHxSQG.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BwQuoTQU.js → use-autosave-BG8Yx7hj.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-IjVyv5jj.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-Bd03Ic0s.js → voice-api-key-field-DYXwDhHq.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-gggUp3u9.js → voice-config-api-D3DdcH4H.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DF8PR_pK.js → work-discovery-overlay-CQqjzaRo.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BiAAWlir.js → workflow-run-setup-panel-C5H-Fd-U.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-D1hMyPsY.js +6 -0
- package/dist/gateway/static/root/index.html +10 -9
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/device-pairing.js +41 -2
- package/dist/src/agent/service.js +20 -16
- package/dist/src/browser/native-messaging-host.d.ts +1 -1
- package/dist/src/browser/native-messaging-host.js +3 -2
- package/dist/src/browser/providers/browser-ext-install.d.ts +6 -0
- package/dist/src/browser/providers/browser-ext-install.js +16 -1
- package/dist/src/cli/commands/gateway/run-foreground.js +8 -5
- package/dist/src/cli/commands/gateway/service.js +4 -3
- package/dist/src/cli/commands/gateway/token.js +28 -1
- package/dist/src/gateway/device-routes.js +4 -3
- package/dist/src/gateway/hono/app.js +5 -2
- package/dist/src/gateway/hono/routes/agent-stream.js +1 -1
- package/dist/src/gateway/hono/routes/browser.js +26 -0
- package/dist/src/gateway/hono/routes/device-pairing-approval.d.ts +9 -2
- package/dist/src/gateway/hono/routes/device-pairing-approval.js +50 -10
- package/dist/src/gateway/hono/routes/devices.d.ts +2 -1
- package/dist/src/gateway/hono/routes/devices.js +33 -16
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/side-chats.js +1 -1
- package/dist/src/gateway/hono/routes/tunnel.js +34 -2
- package/dist/src/gateway/rate-limit/buckets.js +2 -1
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/storage/sqlite/device-pairing-approval.js +4 -4
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/tunnel/xopc-cloud-registration.d.ts +5 -0
- package/dist/src/tunnel/xopc-cloud-registration.js +17 -11
- package/package.json +3 -3
- package/dist/browser-ext/dist/pairing-handoff.js +0 -51
- package/dist/gateway/static/root/assets/agents-B6mu64fY.js +0 -1
- package/dist/gateway/static/root/assets/attachment-load-CBGNA2Ys.js +0 -2
- package/dist/gateway/static/root/assets/attachment-process-heavy-B2_kr5EA.js +0 -11
- package/dist/gateway/static/root/assets/automations-workspace-DxRFrmrV.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-TLAlqcPo.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-z-K_jrZz.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-Dzrk33aB.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-B1dIoRNi.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-CPth92s6.js +0 -1
- package/dist/gateway/static/root/assets/excel-worksheet-utils-EyvwNT4X.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-Dqx8PmcT.js +0 -1
- package/dist/gateway/static/root/assets/home-page-DJaqpC8-.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-l2AEiG2C.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-DT6NoIjm.js +0 -1
- package/dist/gateway/static/root/assets/markdown-view-AglreSOj.js +0 -201
- package/dist/gateway/static/root/assets/note-detail-panel-BUJPoaGZ.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BwFpWRuo.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-BU1RKAcy.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-z0X0tL8G.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-NNTut2I8.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-B6SsHlz5.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BQu8bAcN.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-BxYdSi8c.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-CMqE0KuK.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BXqSJymN.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-L6dp9v2y.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-D4BucMrZ.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-DryKUMfA.js +0 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-Dz_Qis2R.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}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{n as r,r as i}from"./popover-select-Dz_Qis2R.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./messages-BGc-OJWg.js";import{a as c,i as l,n as u,r as d}from"./locale-store-BkJ7g35d.js";import{i as f}from"./vendor-swr-BIWyz7Rc.js";import{t as p}from"./button-B11EPpor.js";import{_c as m,su as h,vc as g}from"./index-SxqsTD4i.js";import{n as _,r as v}from"./settings-page-layout-DYelDcMV.js";import{n as y}from"./settings-loading-skeleton-CAmWMaOT.js";import{t as b}from"./settings-advanced-gate-DVH_l6Hr.js";var x=e(t(),1);async function S(e){await c(d(`/api/runtime-tools/config`),{method:`PATCH`,body:JSON.stringify(e)})}async function C(){return(await c(d(`/api/runtime-tools/prune`),{method:`POST`})).payload}async function w(e){let t=await l(d(`/api/runtime-tools/${e.runtime}/${e.action}/stream`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify({version:e.version})});if(!t.ok||!t.body)throw Error(`HTTP ${t.status}`);let n=t.body.getReader(),r=new TextDecoder,i=``,a=!1;try{for(;!a;){let{done:t,value:o}=await n.read();if(t)break;i+=r.decode(o,{stream:!0}).replace(/\r\n/g,`
|
|
2
2
|
`);let s=i.split(`
|
|
3
3
|
|
|
4
4
|
`);i=s.pop()??``;for(let t of s){let n=``,r=``;for(let e of t.split(`
|
|
5
|
-
`))e.startsWith(`event:`)&&(n=e.slice(6).trim()),e.startsWith(`data:`)&&(r+=e.slice(5).trimStart());if(!r)continue;let i=JSON.parse(r);if(n===`progress`&&e.onProgress(i),n===`result`&&(a=!0,!i.ok))throw Error(i.message??`${e.action} failed`)}}}finally{n.releaseLock()}if(!a)throw Error(`Runtime operation ended without a result`)}var T=n(),E=[`node`,`python`,`uv`];function D(){let e=s(u(e=>e.language)).runtimeToolsSettings,{data:t,error:n,isLoading:c,mutate:l}=f(d(`/api/runtime-tools`)),[D,O]=(0,x.useState)(null),[k,A]=(0,x.useState)(!1),[j,M]=(0,x.useState)(!1),[N,P]=(0,x.useState)(null),[F,I]=(0,x.useState)({}),[L,R]=(0,x.useState)(null);if((0,x.useEffect)(()=>{t?.payload.config&&O(structuredClone(t.payload.config))},[t?.payload.config]),n)return(0,T.jsxs)(v,{children:[(0,T.jsx)(_,{title:e.title,subtitle:e.loadError}),(0,T.jsx)(p,{onClick:()=>void l(),children:e.refresh})]});if(c||!D)return(0,T.jsx)(v,{children:(0,T.jsx)(y,{sections:3})});let z=new Map(t?.payload.statuses.map(e=>[e.runtime,e])),B=(e,t)=>O(n=>n&&{...n,[e]:{...n[e],...t}}),V=async()=>{A(!0),R(null);try{await S(D),await l()}catch(e){R(e instanceof Error?e.message:String(e))}finally{A(!1)}},H=async(e,t)=>{P(e),R(null);try{await S(D),await w({runtime:e,action:t,version:e===`uv`?D.uv.version:D[e].version,onProgress:t=>I(n=>({...n,[e]:t}))}),await l()}catch(e){R(e instanceof Error?e.message:String(e))}finally{P(null)}},U=async()=>{M(!0),R(null);try{await C(),await l()}catch(e){R(e instanceof Error?e.message:String(e))}finally{M(!1)}};return(0,T.jsxs)(v,{gap:`gap-6`,children:[(0,T.jsx)(_,{title:e.title,actions:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(p,{onClick:()=>void l(),disabled:N!==null,children:[(0,T.jsx)(
|
|
5
|
+
`))e.startsWith(`event:`)&&(n=e.slice(6).trim()),e.startsWith(`data:`)&&(r+=e.slice(5).trimStart());if(!r)continue;let i=JSON.parse(r);if(n===`progress`&&e.onProgress(i),n===`result`&&(a=!0,!i.ok))throw Error(i.message??`${e.action} failed`)}}}finally{n.releaseLock()}if(!a)throw Error(`Runtime operation ended without a result`)}var T=n(),E=[`node`,`python`,`uv`];function D(){let e=s(u(e=>e.language)).runtimeToolsSettings,{data:t,error:n,isLoading:c,mutate:l}=f(d(`/api/runtime-tools`)),[D,O]=(0,x.useState)(null),[k,A]=(0,x.useState)(!1),[j,M]=(0,x.useState)(!1),[N,P]=(0,x.useState)(null),[F,I]=(0,x.useState)({}),[L,R]=(0,x.useState)(null);if((0,x.useEffect)(()=>{t?.payload.config&&O(structuredClone(t.payload.config))},[t?.payload.config]),n)return(0,T.jsxs)(v,{children:[(0,T.jsx)(_,{title:e.title,subtitle:e.loadError}),(0,T.jsx)(p,{onClick:()=>void l(),children:e.refresh})]});if(c||!D)return(0,T.jsx)(v,{children:(0,T.jsx)(y,{sections:3})});let z=new Map(t?.payload.statuses.map(e=>[e.runtime,e])),B=(e,t)=>O(n=>n&&{...n,[e]:{...n[e],...t}}),V=async()=>{A(!0),R(null);try{await S(D),await l()}catch(e){R(e instanceof Error?e.message:String(e))}finally{A(!1)}},H=async(e,t)=>{P(e),R(null);try{await S(D),await w({runtime:e,action:t,version:e===`uv`?D.uv.version:D[e].version,onProgress:t=>I(n=>({...n,[e]:t}))}),await l()}catch(e){R(e instanceof Error?e.message:String(e))}finally{P(null)}},U=async()=>{M(!0),R(null);try{await C(),await l()}catch(e){R(e instanceof Error?e.message:String(e))}finally{M(!1)}};return(0,T.jsxs)(v,{gap:`gap-6`,children:[(0,T.jsx)(_,{title:e.title,actions:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(p,{onClick:()=>void l(),disabled:N!==null,children:[(0,T.jsx)(g,{className:`size-4`}),e.refresh]}),(0,T.jsx)(p,{onClick:()=>void U(),disabled:j||N!==null,children:j?e.pruning:e.prune}),(0,T.jsx)(p,{variant:`primary`,onClick:()=>void V(),disabled:k||N!==null,children:k?e.saving:e.save})]})}),L?(0,T.jsx)(`div`,{className:`rounded-xl border border-danger/30 bg-danger/10 px-4 py-3 text-sm text-danger`,children:L}):null,(0,T.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-subtle 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:D.enabled,onChange:e=>O({...D,enabled:e.target.checked}),className:`size-4 accent-accent`})]})}),(0,T.jsx)(b,{children:(0,T.jsxs)(`section`,{className:`grid gap-4 rounded-xl border border-edge bg-surface-subtle 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)(r,{value:D.download.source,onChange:e=>O({...D,download:{...D.download,source:e.target.value}}),children:[(0,T.jsx)(i,{value:`auto`,children:e.downloadSources.auto}),(0,T.jsx)(i,{value:`website-only`,children:e.downloadSources.websiteOnly}),(0,T.jsx)(i,{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:D.download.gatewayBaseUrl,disabled:D.download.source===`direct-only`,onChange:e=>O({...D,download:{...D.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:D.download.bundleDir??``,placeholder:e.offlineBundlePlaceholder,onChange:e=>O({...D,download:{...D.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:D.download.proxy??``,placeholder:`http://127.0.0.1:7890`,onChange:e=>O({...D,download:{...D.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:`grid gap-4 xl:grid-cols-3`,children:E.map(t=>{let n=z.get(t),s=n?.state===`ready`,c=F[t],l=t===`uv`?D.uv:D[t];return(0,T.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-4 rounded-xl border border-edge bg-surface-panel p-4`,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[t]}),(0,T.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:n?.message??e.unknown})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s?(0,T.jsx)(a,{className:`size-5 shrink-0 text-success`}):(0,T.jsx)(h,{className:`size-5 shrink-0 text-warning`}),(0,T.jsx)(`input`,{type:`checkbox`,"aria-label":`${e.runtimeNames[t]} ${e.enabled}`,checked:l.enabled,onChange:e=>{t===`uv`?O({...D,uv:{...D.uv,enabled:e.target.checked}}):B(t,{enabled:e.target.checked})},className:`size-4 accent-accent`})]})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.version,(0,T.jsx)(`input`,{value:l.version??``,placeholder:n?.requestedVersion,onChange:e=>{let n=e.target.value||void 0;t===`uv`?O({...D,uv:{...D.uv,version:n}}):B(t,{version:n})},className:`h-10 w-full rounded-lg border border-edge bg-surface-subtle px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),t===`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)(r,{value:D[t].preference,onChange:e=>B(t,{preference:e.target.value}),children:[(0,T.jsx)(i,{value:`managed-first`,children:e.preferences.managedFirst}),(0,T.jsx)(i,{value:`system-first`,children:e.preferences.systemFirst}),(0,T.jsx)(i,{value:`managed-only`,children:e.preferences.managedOnly}),(0,T.jsx)(i,{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)(r,{value:D[t].provision,onChange:e=>B(t,{provision:e.target.value}),children:[(0,T.jsx)(i,{value:`eager`,children:e.provisions.eager}),(0,T.jsx)(i,{value:`on-demand`,children:e.provisions.onDemand}),(0,T.jsx)(i,{value:`disabled`,children:e.provisions.disabled})]})]})]}),c&&N===t?(0,T.jsxs)(`div`,{className:`rounded-lg bg-accent-soft px-3 py-2 text-xs text-accent-fg`,children:[c.message,c.totalBytes&&c.downloadedBytes?` · ${Math.round(c.downloadedBytes/c.totalBytes*100)}%`:``]}):null,(0,T.jsxs)(`div`,{className:`mt-auto flex gap-2`,children:[(0,T.jsxs)(p,{variant:`primary`,disabled:!D.enabled||!l.enabled||N!==null,onClick:()=>void H(t,`install`),children:[(0,T.jsx)(o,{className:`size-4`}),N===t?e.working:e.install]}),n?.repairable?(0,T.jsxs)(p,{disabled:!D.enabled||!l.enabled||N!==null,onClick:()=>void H(t,`repair`),children:[(0,T.jsx)(m,{className:`size-4`}),e.repair]}):null]}),(0,T.jsx)(b,{children:n?.resolved?.executable?(0,T.jsx)(`code`,{className:`break-all text-[11px] text-fg-subtle`,children:n.resolved.executable}):null})]},t)})})]})}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{n as r,r as i}from"./popover-select-Dz_Qis2R.js";import{t as a}from"./cn-JdwAhgNB.js";import{ho as o,vo as s}from"./index-C6PmD0cK.js";var c=t();e();var l=n();function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function f(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function p(e){return e[`x-hidden`]===!0}function m(e){let t=e.properties;if(!u(t))return[];let n=[];for(let[e,r]of Object.entries(t))u(r)&&(p(r)||n.push({key:e,sub:r,order:d(r),group:f(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function h(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 g(e){let t=(0,c.c)(38),{name:n,s:i,value:a,onChange:u,disabled:d}=e,f=typeof i.description==`string`?i.description:void 0,p=(typeof i[`x-placeholder`]==`string`?i[`x-placeholder`]:null)||f,m=i.format;if(Array.isArray(i.enum)&&i.enum.every(v)){let e;t[0]===f?e=t[1]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let o;t[2]===u?o=t[3]:(o=e=>u(e.target.value),t[2]=u,t[3]=o);let s;t[4]===i.enum?s=t[5]:(s=i.enum.map(_),t[4]=i.enum,t[5]=s);let c;t[6]!==d||t[7]!==n||t[8]!==o||t[9]!==s||t[10]!==a?(c=(0,l.jsx)(r,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:a,disabled:d,onChange:o,children:s}),t[6]=d,t[7]=n,t[8]=o,t[9]=s,t[10]=a,t[11]=c):c=t[11];let p;return t[12]!==e||t[13]!==c?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,c]}),t[12]=e,t[13]=c,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==u||t[19]!==p||t[20]!==a?(n=(0,l.jsx)(s,{value:a,onChange:u,placeholder:p,labels:o,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]=u,t[19]=p,t[20]=a,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,l.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,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===u?g=t[28]:(g=e=>u(e.target.value),t[27]=u,t[28]=g);let y;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==a?(y=(0,l.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:a,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=a,t[34]=y):y=t[34];let b;return t[35]!==h||t[36]!==y?(b=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,y]}),t[35]=h,t[36]=y,t[37]=b):b=t[37],b}function _(e){return(0,l.jsx)(i,{value:e,children:e},e)}function v(e){return typeof e==`string`}function y(e){let t=(0,c.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,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let u=Number.isFinite(r)?r:0,d;t[2]===i?d=t[3]:(d=e=>i(Number(e.target.value)),t[2]=i,t[3]=d);let f;t[4]!==a||t[5]!==u||t[6]!==d?(f=(0,l.jsx)(`input`,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:u,disabled:a,onChange:d}),t[4]=a,t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==s||t[9]!==f?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,f]}),t[8]=s,t[9]=f,t[10]=p):p=t[10],p}function b(e){let t=(0,c.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`),u;t[0]===i?u=t[1]:(u=e=>i(e.target.checked),t[0]=i,t[1]=u);let d;t[2]!==a||t[3]!==u||t[4]!==r?(d=(0,l.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:u}),t[2]=a,t[3]=u,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,l.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,l.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 x(e){let t=(0,c.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,d=n.items,f=u(d)?d.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,l.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,l.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,l.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,l.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,l.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,l.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,l.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 S(e){let t=(0,c.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,d=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(d===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,l.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 u;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(u=(0,l.jsx)(b,{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]=u):u=t[9];let d;return t[10]!==e||t[11]!==u?(d=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[10]=e,t[11]=u,t[12]=d):d=t[12],d}if(d===`number`||d===`integer`){let e;t[13]===f?e=t[14]:(e=(0,l.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,l.jsx)(y,{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,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(d===`string`){let e;t[23]===f?e=t[24]:(e=(0,l.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,l.jsx)(g,{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 u;return t[31]!==e||t[32]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=u):u=t[33],u}if(d===`array`){let e=r.items,n=u(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,l.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(C)?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,l.jsx)(x,{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 u;return t[44]!==e||t[45]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=u):u=t[46],u}}if(d===`object`){let e;t[47]===i?e=t[48]:(e=u(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,l.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 d;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(d=(0,l.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,l.jsx)(w,{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]=d):d=t[56];let p;return t[57]!==c||t[58]!==d?(p=(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,d]}),t[57]=c,t[58]=d,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==d||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof d==`string`?d:void 0)??`${f}: unsupported field type${typeof d==`string`?` (${d})`:``}`,t[60]=s,t[61]=d,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){let t=(0,c.c)(28),{schema:n,values:r,onChange:i,disabled:o,className:s,labels:d}=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=m(n),t[1]=n,t[2]=e),p=e}let g=p,_;bb1:{if(g.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]===g?e=t[5]:(e=h(g),t[4]=g,t[5]=e),_=e}let v=_,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!u(n.properties)||g.length===0)return null;let x,C;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==d||t[13]!==b||t[14]!==r){let e=Array.from(v.keys()).sort(T);t[17]===s?x=t[18]:(x=a(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==d||t[22]!==b||t[23]!==r?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,l.jsx)(S,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:f,labels:d},e.key));return e===``?(0,l.jsx)(`div`,{children:t},`default`):(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,l.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,l.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=d,t[22]=b,t[23]=r,t[24]=n):n=t[24],C=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=d,t[13]=b,t[14]=r,t[15]=x,t[16]=C}else x=t[15],C=t[16];let w;return t[25]!==x||t[26]!==C?(w=(0,l.jsx)(`div`,{className:x,children:C}),t[25]=x,t[26]=C,t[27]=w):w=t[27],w}function T(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{w as t};
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-Dz_Qis2R.js";import{t as a}from"./cn-JdwAhgNB.js";import{go as o,po as s}from"./index-SxqsTD4i.js";var c=t();e();var l=n();function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function f(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function p(e){return e[`x-hidden`]===!0}function m(e){let t=e.properties;if(!u(t))return[];let n=[];for(let[e,r]of Object.entries(t))u(r)&&(p(r)||n.push({key:e,sub:r,order:d(r),group:f(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function h(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 g(e){let t=(0,c.c)(38),{name:n,s:i,value:a,onChange:u,disabled:d}=e,f=typeof i.description==`string`?i.description:void 0,p=(typeof i[`x-placeholder`]==`string`?i[`x-placeholder`]:null)||f,m=i.format;if(Array.isArray(i.enum)&&i.enum.every(v)){let e;t[0]===f?e=t[1]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let o;t[2]===u?o=t[3]:(o=e=>u(e.target.value),t[2]=u,t[3]=o);let s;t[4]===i.enum?s=t[5]:(s=i.enum.map(_),t[4]=i.enum,t[5]=s);let c;t[6]!==d||t[7]!==n||t[8]!==o||t[9]!==s||t[10]!==a?(c=(0,l.jsx)(r,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:a,disabled:d,onChange:o,children:s}),t[6]=d,t[7]=n,t[8]=o,t[9]=s,t[10]=a,t[11]=c):c=t[11];let p;return t[12]!==e||t[13]!==c?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,c]}),t[12]=e,t[13]=c,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==u||t[19]!==p||t[20]!==a?(n=(0,l.jsx)(o,{value:a,onChange:u,placeholder:p,labels:s,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]=u,t[19]=p,t[20]=a,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,l.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,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===u?g=t[28]:(g=e=>u(e.target.value),t[27]=u,t[28]=g);let y;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==a?(y=(0,l.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:a,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=a,t[34]=y):y=t[34];let b;return t[35]!==h||t[36]!==y?(b=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,y]}),t[35]=h,t[36]=y,t[37]=b):b=t[37],b}function _(e){return(0,l.jsx)(i,{value:e,children:e},e)}function v(e){return typeof e==`string`}function y(e){let t=(0,c.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,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let u=Number.isFinite(r)?r:0,d;t[2]===i?d=t[3]:(d=e=>i(Number(e.target.value)),t[2]=i,t[3]=d);let f;t[4]!==a||t[5]!==u||t[6]!==d?(f=(0,l.jsx)(`input`,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:u,disabled:a,onChange:d}),t[4]=a,t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==s||t[9]!==f?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,f]}),t[8]=s,t[9]=f,t[10]=p):p=t[10],p}function b(e){let t=(0,c.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`),u;t[0]===i?u=t[1]:(u=e=>i(e.target.checked),t[0]=i,t[1]=u);let d;t[2]!==a||t[3]!==u||t[4]!==r?(d=(0,l.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:u}),t[2]=a,t[3]=u,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,l.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,l.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 x(e){let t=(0,c.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,d=n.items,f=u(d)?d.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,l.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,l.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,l.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,l.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,l.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,l.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,l.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 S(e){let t=(0,c.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,d=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(d===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,l.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 u;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(u=(0,l.jsx)(b,{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]=u):u=t[9];let d;return t[10]!==e||t[11]!==u?(d=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[10]=e,t[11]=u,t[12]=d):d=t[12],d}if(d===`number`||d===`integer`){let e;t[13]===f?e=t[14]:(e=(0,l.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,l.jsx)(y,{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,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(d===`string`){let e;t[23]===f?e=t[24]:(e=(0,l.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,l.jsx)(g,{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 u;return t[31]!==e||t[32]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=u):u=t[33],u}if(d===`array`){let e=r.items,n=u(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,l.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(C)?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,l.jsx)(x,{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 u;return t[44]!==e||t[45]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=u):u=t[46],u}}if(d===`object`){let e;t[47]===i?e=t[48]:(e=u(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,l.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 d;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(d=(0,l.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,l.jsx)(w,{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]=d):d=t[56];let p;return t[57]!==c||t[58]!==d?(p=(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,d]}),t[57]=c,t[58]=d,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==d||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof d==`string`?d:void 0)??`${f}: unsupported field type${typeof d==`string`?` (${d})`:``}`,t[60]=s,t[61]=d,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){let t=(0,c.c)(28),{schema:n,values:r,onChange:i,disabled:o,className:s,labels:d}=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=m(n),t[1]=n,t[2]=e),p=e}let g=p,_;bb1:{if(g.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]===g?e=t[5]:(e=h(g),t[4]=g,t[5]=e),_=e}let v=_,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!u(n.properties)||g.length===0)return null;let x,C;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==d||t[13]!==b||t[14]!==r){let e=Array.from(v.keys()).sort(T);t[17]===s?x=t[18]:(x=a(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==d||t[22]!==b||t[23]!==r?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,l.jsx)(S,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:f,labels:d},e.key));return e===``?(0,l.jsx)(`div`,{children:t},`default`):(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,l.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,l.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=d,t[22]=b,t[23]=r,t[24]=n):n=t[24],C=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=d,t[13]=b,t[14]=r,t[15]=x,t[16]=C}else x=t[15],C=t[16];let w;return t[25]!==x||t[26]!==C?(w=(0,l.jsx)(`div`,{className:x,children:C}),t[25]=x,t[26]=C,t[27]=w):w=t[27],w}function T(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{w as t};
|
|
@@ -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{h as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a,n as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{n as d,r as f}from"./popover-select-Dz_Qis2R.js";import{t as p}from"./download-Dk-ZjtO6.js";import{t as m}from"./message-square-fVE7Ghj1.js";import{t as h}from"./plus-Q2yW6OE7.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./messages-BGc-OJWg.js";import{a as v,c as ee,n as te,r as y}from"./locale-store-BkJ7g35d.js";import{t as b}from"./cn-JdwAhgNB.js";import{i as ne}from"./vendor-swr-BIWyz7Rc.js";import{t as x}from"./button-B11EPpor.js";import{n as S,r as C}from"./gateway-config-swr-cd8owslz.js";import{t as w}from"./skeleton-BwbyijEw.js";import{i as T,o as E}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as D,t as O}from"./registry-api-CTq8EECj.js";import{Au as k,Hl as A,Hs as j,Ji as M,Oc as N,Ol as P,P as re,Rt as F,So as I,Vc as L,Yi as R,aa as z,ai as B,al as V,ca as H,cl as U,cs as ie,da as ae,eu as oe,fa as se,ha as ce,ia as le,js as ue,ju as de,kc as fe,la as pe,lc as me,ls as W,ma as he,oa as ge,ol as _e,pc as ve,qi as G,ra as ye,sa as be,ua as K,zt as xe}from"./index-SxqsTD4i.js";import{n as Se,t as q}from"./settings-form-section-CIA1AA-A.js";import{n as J,t as Y}from"./use-autosave-BG8Yx7hj.js";import{t as Ce}from"./page-tabs-CRombigq.js";import{t as we}from"./settings-advanced-gate-DVH_l6Hr.js";var X=e(t(),1),Te=n(),Z=r();function Ee(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 De(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Oe(e){let t=(0,Te.c)(113),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:s,onAction:c}=e,l;t[0]!==i.unnamedSession||t[1]!==n.name?(l=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=l):l=t[2];let u=l,d=te(Me),f;t[3]!==d||t[4]!==n?(f=z(n,_(d).sidebar.sessionFilters),t[3]=d,t[4]=n,t[5]=f):f=t[5];let h=f,g;t[6]===n.name?g=t[7]:(g=n.name?.trim(),t[6]=n.name,t[7]=g);let v=!!g,ee=n.status===`archived`,y=n.status===`pinned`,ne=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,x;t[8]===ne?x=t[9]:(x=b(`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`,ne),t[8]=ne,t[9]=x);let S;t[10]===s?S=t[11]:(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())},t[10]=s,t[11]=S);let C=r===`list`&&`sm:py-3`,w;t[12]===C?w=t[13]:(w=b(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,C),t[12]=C,t[13]=w);let T;t[14]===n?T=t[15]:(T=(0,Z.jsx)(le,{sourceChannel:n.sourceChannel,session:n,className:`size-3.5`}),t[14]=n,t[15]=T);let E;t[16]===h?E=t[17]:(E=(0,Z.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:h}),t[16]=h,t[17]=E);let D;t[18]!==E||t[19]!==T?(D=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[T,E]}),t[18]=E,t[19]=T,t[20]=D):D=t[20];let O;t[21]===y?O=t[22]:(O=y?(0,Z.jsx)(fe,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[21]=y,t[22]=O);let A;t[23]===n.updatedAt?A=t[24]:(A=Ee(n.updatedAt),t[23]=n.updatedAt,t[24]=A);let M;t[25]===A?M=t[26]:(M=(0,Z.jsx)(`span`,{children:A}),t[25]=A,t[26]=M);let P;t[27]!==O||t[28]!==M?(P=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[O,M]}),t[27]=O,t[28]=M,t[29]=P):P=t[29];let F;t[30]!==D||t[31]!==P||t[32]!==w?(F=(0,Z.jsxs)(`div`,{className:w,children:[D,P]}),t[30]=D,t[31]=P,t[32]=w,t[33]=F):F=t[33];let I=r===`list`&&`sm:py-3`,L;t[34]===I?L=t[35]:(L=b(`min-w-0 flex-1 px-3 py-2`,I),t[34]=I,t[35]=L);let R=r===`list`&&`sm:items-start`,B;t[36]===R?B=t[37]:(B=b(`flex gap-3`,R),t[36]=R,t[37]=B);let V;t[38]!==o||t[39]!==a?(V=(0,Z.jsx)(re,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[38]=o,t[39]=a,t[40]=V):V=t[40];let H;t[41]===u?H=t[42]:(H=(0,Z.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:u,children:u}),t[41]=u,t[42]=H);let U;t[43]!==n.key||t[44]!==v?(U=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[43]=n.key,t[44]=v,t[45]=U):U=t[45];let ae;t[46]!==H||t[47]!==U?(ae=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[H,U]}),t[46]=H,t[47]=U,t[48]=ae):ae=t[48];let oe;t[49]!==B||t[50]!==V||t[51]!==ae?(oe=(0,Z.jsxs)(`div`,{className:B,children:[V,ae]}),t[49]=B,t[50]=V,t[51]=ae,t[52]=oe):oe=t[52];let se;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(m,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[53]=se):se=t[53];let ce;t[54]===n.messageCount?ce=t[55]:(ce=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[se,n.messageCount]}),t[54]=n.messageCount,t[55]=ce);let pe;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(ue,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[56]=pe):pe=t[56];let me;t[57]===n.estimatedTokens?me=t[58]:(me=De(n.estimatedTokens),t[57]=n.estimatedTokens,t[58]=me);let W;t[59]===me?W=t[60]:(W=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[pe,me]}),t[59]=me,t[60]=W);let he;t[61]!==ce||t[62]!==W?(he=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[ce,W]}),t[61]=ce,t[62]=W,t[63]=he):he=t[63];let ge;t[64]===n.tags?ge=t[65]:(ge=n.tags.length>0?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(je),n.tags.length>3?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[64]=n.tags,t[65]=ge);let _e;t[66]!==L||t[67]!==oe||t[68]!==he||t[69]!==ge?(_e=(0,Z.jsxs)(`div`,{className:L,children:[oe,he,ge]}),t[66]=L,t[67]=oe,t[68]=he,t[69]=ge,t[70]=_e):_e=t[70];let ve;t[71]===c?ve=t[72]:(ve=()=>c(`continue`),t[71]=c,t[72]=ve);let G;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(m,{className:`size-4`,strokeWidth:1.75}),t[73]=G):G=t[73];let ye;t[74]!==i.continueChat||t[75]!==ve?(ye=(0,Z.jsx)(`button`,{type:`button`,className:ie,title:i.continueChat,"aria-label":i.continueChat,onClick:ve,children:G}),t[74]=i.continueChat,t[75]=ve,t[76]=ye):ye=t[76];let be;t[77]!==ee||t[78]!==i.archive||t[79]!==i.unarchive||t[80]!==c?(be=ee?(0,Z.jsx)(`button`,{type:`button`,className:ie,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>c(`unarchive`),children:(0,Z.jsx)(de,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:ie,title:i.archive,"aria-label":i.archive,onClick:()=>c(`archive`),children:(0,Z.jsx)(k,{className:`size-4`,strokeWidth:1.75})}),t[77]=ee,t[78]=i.archive,t[79]=i.unarchive,t[80]=c,t[81]=be):be=t[81];let K;t[82]!==y||t[83]!==i.pin||t[84]!==i.unpin||t[85]!==c?(K=y?(0,Z.jsx)(`button`,{type:`button`,className:ie,title:i.unpin,"aria-label":i.unpin,onClick:()=>c(`unpin`),children:(0,Z.jsx)(N,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:ie,title:i.pin,"aria-label":i.pin,onClick:()=>c(`pin`),children:(0,Z.jsx)(fe,{className:`size-4`,strokeWidth:1.75})}),t[82]=y,t[83]=i.pin,t[84]=i.unpin,t[85]=c,t[86]=K):K=t[86];let xe;t[87]===c?xe=t[88]:(xe=()=>c(`export`),t[87]=c,t[88]=xe);let Se;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(p,{className:`size-4`,strokeWidth:1.75}),t[89]=Se):Se=t[89];let q;t[90]!==i.export||t[91]!==xe?(q=(0,Z.jsx)(`button`,{type:`button`,className:ie,title:i.export,"aria-label":i.export,onClick:xe,children:Se}),t[90]=i.export,t[91]=xe,t[92]=q):q=t[92];let J;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(J=b(ie,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[93]=J):J=t[93];let Y;t[94]===c?Y=t[95]:(Y=()=>c(`delete`),t[94]=c,t[95]=Y);let Ce;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(j,{className:`size-4`,strokeWidth:1.75}),t[96]=Ce):Ce=t[96];let we;t[97]!==i.delete||t[98]!==Y?(we=(0,Z.jsx)(`button`,{type:`button`,className:J,title:i.delete,"aria-label":i.delete,onClick:Y,children:Ce}),t[97]=i.delete,t[98]=Y,t[99]=we):we=t[99];let X;t[100]!==ye||t[101]!==be||t[102]!==K||t[103]!==q||t[104]!==we?(X=(0,Z.jsxs)(`div`,{role:`group`,className:`flex flex-wrap items-center gap-0.5 border-t border-edge-subtle/80 bg-surface-hover/25 p-2 dark:border-edge-subtle`,onClick:Ae,onKeyDown:ke,children:[ye,be,K,q,we]}),t[100]=ye,t[101]=be,t[102]=K,t[103]=q,t[104]=we,t[105]=X):X=t[105];let Oe;return t[106]!==s||t[107]!==F||t[108]!==_e||t[109]!==X||t[110]!==x||t[111]!==S?(Oe=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,className:x,onClick:s,onKeyDown:S,children:[F,_e,X]}),t[106]=s,t[107]=F,t[108]=_e,t[109]=X,t[110]=x,t[111]=S,t[112]=Oe):Oe=t[112],Oe}function ke(e){return e.stopPropagation()}function Ae(e){return e.stopPropagation()}function je(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 Me(e){return e.language}function Ne(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function Pe(e,t){return t.find(t=>t.id===e)?.avatar}var Fe={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:8e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function Ie(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Le(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 Re(e){let t=Ie(e)?e:{},n=Ie(t.userContext)?t.userContext:{},r=Ie(n.contextPlanning)?n.contextPlanning:{},i=Ie(r.compaction)?r.compaction:{},a=Fe,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:Le(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 ze(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 Be(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function Ve(e){await v(y(`/api/config`),{method:`PATCH`,body:JSON.stringify(Be(e))}),await S()}var He=128e3,Ue={balanced:Fe,preserve:{...Fe,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Fe,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},We=G();function Ge(){return b(`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`,I,`dark:border-edge`)}function Ke(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function qe(e){let t=Ke(e);for(let[e,n]of Object.entries(Ue))if(t===Ke(n))return e;return`custom`}function Je(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,Te.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=Ge(),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)(`input`,{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 Ye(e){let t=(0,Te.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=b(`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 u;t[4]!==i||t[5]!==a||t[6]!==l?(u=(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]=u):u=t[7];let d;t[8]===n?d=t[9]:(d=(0,Z.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=d);let f;t[10]===r?f=t[11]:(f=(0,Z.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=f);let p;t[12]!==d||t[13]!==f?(p=(0,Z.jsxs)(`span`,{children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;return t[15]!==c||t[16]!==u||t[17]!==p?(m=(0,Z.jsxs)(`label`,{className:c,children:[u,p]}),t[15]=c,t[16]=u,t[17]=p,t[18]=m):m=t[18],m}function Xe({hasToken:e}){let t=_(te(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=C(e),{data:i=[],isLoading:a}=ne(e?O:null,D,{revalidateOnFocus:!1}),o=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:Re(n.payload.config),[n]),[s,c]=(0,X.useReducer)(We,{form:null,baseline:null}),[l,u]=(0,X.useState)(``),d=(0,X.useRef)(!1),f=(0,X.useRef)(s.form);f.current=s.form;let p=(0,X.useRef)(null);M({enabled:e,parsed:o,dirty:d.current,trackedParsedRef:p,dispatch:c,onResetDirty:()=>{d.current=!1}});let m=s.form,v=s.baseline,ee=!!(m&&v&&JSON.stringify(m)!==JSON.stringify(v)),y=(0,X.useCallback)(e=>{d.current=!0,c({type:`patch`,patch:e})},[]),S=(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]),T=Y({value:m,dirty:ee,onSave:(0,X.useCallback)(async e=>{try{await Ve(e),c({type:`saved`,value:e}),d.current=!!(f.current&&JSON.stringify(f.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=ze(e);return n?t.invalidValue.replace(`{{field}}`,S(n)):null}});if(!e||!m)return r?(0,Z.jsx)(q,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(w,{className:`h-5 w-48`}),(0,Z.jsx)(w,{className:`h-20 w-full rounded-xl`}),(0,Z.jsx)(w,{className:`h-36 w-full rounded-xl`})]})}):null;let E=qe(m),k=Math.max(0,He-m.reserveTokens),A=Math.min(Math.floor(He*m.triggerThreshold),k),j=Math.min(100,A/He*100),N=Math.min(100,k/He*100),P=m.model?i.find(e=>e.id===m.model):void 0,re=P?.contextWindow&&m.summaryChunkTokens+m.summaryMaxTokens+4096>P.contextWindow,F=m.keepRecentTokens+m.reserveTokens>A,I=Math.round(m.summaryTimeoutMs*(m.summaryRetries+1)/1e3),R=e=>{let t=Ue[e];y({...t,...m.model?{model:m.model}:{model:void 0},postCompactionSections:m.postCompactionSections})},z={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},V=()=>{let e=l.trim();!e||m.postCompactionSections.includes(e)||m.postCompactionSections.length>=12||(y({postCompactionSections:[...m.postCompactionSections,e]}),u(``))};return(0,Z.jsxs)(q,{onBlurCapture:T.onBlurCapture,children:[(0,Z.jsx)(Se,{icon:L,title:t.title,subtitle:t.hint,trailing:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(J,{status:T.status,error:T.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:m.enabled,onChange:e=>y({enabled:e.target.checked})}),m.enabled?t.enabled:t.disabled]})]})}),T.error?(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:T.error}):null,m.enabled?null:(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Z.jsxs)(`fieldset`,{disabled:!m.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})]}),E===`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":E===e,className:b(`rounded-xl border px-3 py-3 text-left`,W.transition,W.focusRingPanel,E===e?`border-accent/50 bg-accent-soft text-accent-fg`:`border-edge bg-surface-panel text-fg hover:bg-surface-hover`),onClick:()=>R(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)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-hover/35 p-4 dark:border-edge`,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:Je(A)})]}),(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:`${j}%`}})})]}),(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:Je(k)})]}),(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:`${N}%`}})})]})]}),(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((m.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>y({triggerThreshold:e/100})}),(0,Z.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,Je(m.reserveTokens)),value:m.reserveTokens,min:1024,step:1024,onChange:e=>y({reserveTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:m.recentTurnsPreserve,min:1,max:12,onChange:e=>y({recentTurnsPreserve:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,Je(m.keepRecentTokens)),value:m.keepRecentTokens,min:1e3,step:1e3,onChange:e=>y({keepRecentTokens:Math.floor(e)})})]}),F?(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 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)(B,{value:m.model??``,disabled:!m.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=>y({model:e})}),m.model?(0,Z.jsx)(x,{type:`button`,variant:`secondary`,onClick:()=>y({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)(Ye,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:m.qualityGuard,onChange:e=>y({qualityGuard:e})}),(0,Z.jsx)(Ye,{label:t.gapAudit,hint:t.gapAuditHint,checked:m.gapAudit,onChange:e=>y({gapAudit:e})})]}),m.qualityGuard?null:(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning}),(0,Z.jsx)(we,{children:(0,Z.jsxs)(`div`,{className:`space-y-5 border-t border-edge pt-5`,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:m.minMessagesBeforeCompact,min:2,onChange:e=>y({minMessagesBeforeCompact:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((m.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>y({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Z.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:m.summaryMaxTokens,min:256,step:256,onChange:e=>y({summaryMaxTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:m.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>y({summaryChunkTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(I)),value:m.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>y({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Z.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:m.summaryRetries,min:0,max:5,onChange:e=>y({summaryRetries:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:m.minToolResultKeepChars,min:200,step:100,onChange:e=>y({minToolResultKeepChars:Math.floor(e)})})]}),re?(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Z.jsxs)(`div`,{className:`border-t border-edge pt-5`,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}),m.postCompactionSections.length>0?(0,Z.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:m.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:b(`text-fg-muted hover:text-fg`,W.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>y({postCompactionSections:m.postCompactionSections.filter(t=>t!==e)}),children:(0,Z.jsx)(g,{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:Ge(),value:l,maxLength:120,disabled:m.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),V())}}),(0,Z.jsxs)(x,{type:`button`,variant:`secondary`,disabled:!l.trim()||m.postCompactionSections.length>=12,onClick:V,children:[(0,Z.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function Ze(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Qe(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function $e(e){let t=Ze(e)?e:{},n=Ze(t.session)?t.session:{},r=Ze(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:Qe(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function et(e){await v(y(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),S()}function tt(){return b(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,I,`dark:border-edge`)}var nt=G();function rt({hasToken:e}){let t=_(te(e=>e.language)).sessions.config,{data:n,isLoading:r}=C(e),i=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:$e(n.payload.config),[n]),[a,o]=(0,X.useReducer)(nt,{form:null,baseline:null}),s=a.form,c=a.baseline,l=(0,X.useRef)(!1),u=(0,X.useRef)(s);u.current=s;let p=(0,X.useRef)(null);M({enabled:e,parsed:i,dirty:l.current,trackedParsedRef:p,dispatch:o,onResetDirty:()=>{l.current=!1}});let m=!!(s&&c&&JSON.stringify(s)!==JSON.stringify(c)),h=(0,X.useCallback)(e=>{l.current=!0,o({type:`patch`,patch:e})},[]),g=Y({value:s,dirty:m,onSave:(0,X.useCallback)(async e=>{try{await et(e),o({type:`saved`,value:e}),l.current=!!(u.current&&JSON.stringify(u.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!s?r?(0,Z.jsx)(q,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(w,{className:`h-5 w-40`}),(0,Z.jsx)(w,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Z.jsxs)(q,{onBlurCapture:g.onBlurCapture,children:[(0,Z.jsx)(Se,{icon:A,title:t.title,subtitle:t.hint,trailing:(0,Z.jsx)(J,{status:g.status,error:g.error})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,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)(d,{className:tt(),value:s.dmScope,onChange:e=>h({dmScope:e.target.value}),children:[(0,Z.jsx)(f,{value:`main`,children:t.dmScopeMain}),(0,Z.jsx)(f,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Z.jsx)(f,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Z.jsx)(f,{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)(`input`,{type:`number`,min:0,className:tt(),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.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Z.jsx)(`input`,{type:`number`,min:1,className:tt(),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 it(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 at(e){let t=(0,Te.c)(60),{open:n,loading:r,session:i,sessionAgentId:d,sessionAgentAvatar:f,labels:p,onClose:m,onArchive:h,onUnarchive:_,onPin:v,onUnpin:ee,onExport:te,onDelete:y}=e,ne=i?.status===`archived`,S=i?.status===`pinned`,C;t[0]===m?C=t[1]:(C=e=>!e&&m(),t[0]=m,t[1]=C);let w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(a,{className:b(`xopc-dialog-overlay fixed inset-0 bg-scrim`,E)}),t[2]=w):w=t[2];let D;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=b(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,T,`dark:border-edge`),t[3]=D):D=t[3];let O;t[4]!==i||t[5]!==f||t[6]!==d?(O=i&&d?(0,Z.jsx)(re,{agentId:d,avatar:f,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=f,t[6]=d,t[7]=O):O=t[7];let k;t[8]!==p.unnamedSession||t[9]!==i?.name?(k=i?.name?.trim()||p.unnamedSession,t[8]=p.unnamedSession,t[9]=i?.name,t[10]=k):k=t[10];let A;t[11]===k?A=t[12]:(A=(0,Z.jsx)(l,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:k}),t[11]=k,t[12]=A);let j;t[13]!==O||t[14]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[O,A]}),t[13]=O,t[14]=A,t[15]=j):j=t[15];let M;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(g,{className:`size-5`,strokeWidth:1.75}),t[16]=M):M=t[16];let N;t[17]===p.close?N=t[18]:(N=(0,Z.jsx)(o,{asChild:!0,children:(0,Z.jsx)(x,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":p.close,children:M})}),t[17]=p.close,t[18]=N);let P;t[19]!==j||t[20]!==N?(P=(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:[j,N]}),t[19]=j,t[20]=N,t[21]=P):P=t[21];let F;t[22]!==p.detailLoading||t[23]!==p.detailMessages||t[24]!==r||t[25]!==i?(F=r?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p.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:p.detailMessages}),(0,Z.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(ot)})]}):null,t[22]=p.detailLoading,t[23]=p.detailMessages,t[24]=r,t[25]=i,t[26]=F):F=t[26];let I;t[27]===F?I=t[28]:(I=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:F}),t[27]=F,t[28]=I);let L;t[29]!==p.detailExport||t[30]!==te?(L=(0,Z.jsx)(x,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:te,children:p.detailExport}),t[29]=p.detailExport,t[30]=te,t[31]=L):L=t[31];let R;t[32]!==ne||t[33]!==p.archive||t[34]!==p.unarchive||t[35]!==h||t[36]!==_?(R=ne?(0,Z.jsx)(x,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:_,children:p.unarchive}):(0,Z.jsx)(x,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:h,children:p.archive}),t[32]=ne,t[33]=p.archive,t[34]=p.unarchive,t[35]=h,t[36]=_,t[37]=R):R=t[37];let z;t[38]!==S||t[39]!==p.pin||t[40]!==p.unpin||t[41]!==v||t[42]!==ee?(z=S?(0,Z.jsx)(x,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:ee,children:p.unpin}):(0,Z.jsx)(x,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:v,children:p.pin}),t[38]=S,t[39]=p.pin,t[40]=p.unpin,t[41]=v,t[42]=ee,t[43]=z):z=t[43];let B;t[44]!==p.delete||t[45]!==y?(B=(0,Z.jsx)(x,{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:y,children:p.delete}),t[44]=p.delete,t[45]=y,t[46]=B):B=t[46];let V;t[47]!==L||t[48]!==R||t[49]!==z||t[50]!==B?(V=(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:[L,R,z,B]})}),t[47]=L,t[48]=R,t[49]=z,t[50]=B,t[51]=V):V=t[51];let H;t[52]!==P||t[53]!==I||t[54]!==V?(H=(0,Z.jsxs)(s,{children:[w,(0,Z.jsxs)(c,{className:D,"aria-describedby":void 0,children:[P,I,V]})]}),t[52]=P,t[53]=I,t[54]=V,t[55]=H):H=t[55];let U;return t[56]!==n||t[57]!==C||t[58]!==H?(U=(0,Z.jsx)(u,{open:n,onOpenChange:C,children:H}),t[56]=n,t[57]=C,t[58]=H,t[59]=U):U=t[59],U}function ot(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:it(e.content)})]},`${e.timestamp??``}-${e.role}-${it(e.content).slice(0,24)}`)}var st=20;function ct(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var lt=new Set([`all`,`active`,`pinned`,`archived`]),ut=new Set([`grid`,`list`]),dt=[`sessions`,`settings`];function ft(e){return e&&dt.includes(e)?e:`sessions`}function pt(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function mt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function ht(e){let t=(0,Te.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=dt.map(e=>({id:e,label:pt(n,e),icon:e===`sessions`?U:me})),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)(Ce,{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 gt(e){let t=(0,Te.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-2xl bg-surface-base 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:pt(n,r)}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:mt(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 _t(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:lt.has(t)?t:`all`,viewMode:ut.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 vt(){let e=_(te(e=>e.language)),t=e.sessions,n=ee(e=>e.sessionKey),r=!!n,{data:o,mutate:d}=ne(r?[`gateway-chat-agents`,n]:null,ye,{revalidateOnFocus:!1}),f=o?.defaultId??`main`,p=o?.items??[],[m,h]=i(),g=ft(m.get(`tab`)),v=(0,X.useCallback)(e=>{let t=new URLSearchParams(m);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),h(t,{replace:!0})},[m,h]),[y,S]=(0,X.useReducer)(R,m,_t),{searchInput:C,debouncedSearch:w,statusFilter:D,viewMode:O,channelFilter:A,sessions:j,loading:M,error:N,hasMore:re,stats:I,detailOpen:L,detailLoading:z,detailSession:B,confirmOpen:ie,confirmKey:le}=y;(0,X.useEffect)(()=>{let e=setTimeout(()=>{let e=C.trim();w!==e&&S({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[C,w]);let ue=m.toString(),de=(0,X.useRef)(ue);if(de.current!==ue){de.current=ue;let e=m.get(`q`)??``,t=m.get(`status`),n=m.get(`view`),r=(m.get(`channel`)??``).trim(),i=lt.has(t)?t:`all`,a=ut.has(n)?n:`grid`,o=e.trim();S({type:`patch`,patch:{...C===e?{}:{searchInput:e},...w===o?{}:{debouncedSearch:o},...D===i?{}:{statusFilter:i},...O===a?{}:{viewMode:a},...A===r?{}:{channelFilter:r}}})}(0,X.useEffect)(()=>{let e=new URLSearchParams(m),t=w.trim();t?e.set(`q`,t):e.delete(`q`),D===`all`?e.delete(`status`):e.set(`status`,D),O===`grid`?e.delete(`view`):e.set(`view`,O),A?e.set(`channel`,A):e.delete(`channel`),e.toString()!==m.toString()&&h(e,{replace:!0})},[w,m,h,D,O,A]),(0,X.useEffect)(()=>{if(!r||g!==`sessions`)return;let e=!1;return(async()=>{S({type:`patch`,patch:{loading:!0,error:null}});try{let t=await ae({limit:st,offset:0,...w?{search:w}:{},...D===`all`?{}:{status:D},...A?{channel:A}:{}});if(e)return;S({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||S({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||S({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,g,w,D,A,t.loadError]),(0,X.useEffect)(()=>{!r||g!==`sessions`||K().then(e=>S({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,g]),(0,X.useEffect)(()=>{if(!r||g!==`sessions`)return;let e=()=>void d();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,g,d]),(0,X.useEffect)(()=>{if(!r||g!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||S({type:`patch`,patch:{sessions:j.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:B&&B.key===t.key?{...B,name:t.name}:B}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,g,j,B]);let me=(0,X.useCallback)(async()=>{if(!(!r||M||!re)){S({type:`patch`,patch:{loading:!0,error:null}});try{let e=await ae({limit:st,offset:j.length,...w?{search:w}:{},...D===`all`?{}:{status:D},...A?{channel:A}:{}});S({type:`patch`,patch:{sessions:[...j,...e.items],hasMore:e.hasMore}})}catch(e){S({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{S({type:`patch`,patch:{loading:!1}})}}},[r,M,re,j.length,w,D,A,t.loadError]),G=(0,X.useCallback)((e,t)=>{S({type:`patch`,patch:{sessions:j.map(n=>n.key===e?{...n,status:t}:n),detailSession:B&&B.key===e?{...B,status:t}:B}})},[j,B]),Se=(0,X.useCallback)(async e=>{S({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{S({type:`patch`,patch:{detailSession:await pe(e)}})}catch{S({type:`patch`,patch:{detailOpen:!1}})}finally{S({type:`patch`,patch:{detailLoading:!1}})}},[]),q=e=>{Se(e)},J=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:e},bubbles:!0}));return}if(t===`delete`){S({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await ge(e),G(e,`archived`);break;case`unarchive`:await he(e),G(e,`active`);break;case`pin`:await se(e),G(e,`pinned`);break;case`unpin`:await ce(e),G(e,`active`);break;case`export`:{let t=await H(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}K().then(e=>S({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Y=async e=>{try{await be(e),S({type:`patch`,patch:{sessions:j.filter(t=>t.key!==e),detailSession:B?.key===e?null:B,...B?.key===e?{detailOpen:!1}:{}}}),K().then(e=>S({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Ce={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,unnamedSession:e.chat.newSession},we={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},Te=[{key:`all`,label:t.filterAll,icon:U},{key:`active`,label:t.filterActive,icon:oe},{key:`pinned`,label:t.filterPinned,icon:fe},{key:`archived`,label:t.filterArchived,icon:k}],Ee=(()=>{let e=Object.entries(I?.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)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,Z.jsx)(`header`,{className:`flex flex-col gap-2`,children:(0,Z.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:t.title})}),(0,Z.jsx)(ht,{s:t,activeTab:g,onChange:v}),(0,Z.jsx)(gt,{s:t,id:`settings`,activeTab:g,plain:!0,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(Xe,{hasToken:r}),(0,Z.jsx)(rt,{hasToken:r})]})}),(0,Z.jsxs)(gt,{s:t,id:`sessions`,activeTab:g,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)(`div`,{className:`flex flex-wrap gap-2`,children:Te.map(({key:e,label:t,icon:n})=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":D===e,onClick:()=>S({type:`patch`,patch:{statusFilter:e}}),className:b(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,W.transition,W.focusRingPanel,D===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 w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Z.jsx)(ve,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:C,onChange:e=>S({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"data-debounced-query":w||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":!A,onClick:()=>S({type:`patch`,patch:{channelFilter:``}}),className:b(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,W.transition,W.focusRingPanel,A?`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}),Ee.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":A===e,onClick:()=>S({type:`patch`,patch:{channelFilter:e}}),className:b(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,W.transition,W.focusRingPanel,A===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,I?.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:I.byChannel[e]})]},e))]}),I?(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[I.totalSessions,t.totalSessions],[I.activeSessions,t.activeSessions],[I.pinnedSessions,t.pinnedSessions],[I.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,N?(0,Z.jsx)(`div`,{className:`rounded-lg border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,children:N}):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:ct(t.sessionCount,{count:j.length})}),(0,Z.jsxs)(`div`,{className:xe,role:`group`,"aria-label":t.layoutToggleGroup,children:[(0,Z.jsx)(x,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":O===`grid`,onClick:()=>S({type:`patch`,patch:{viewMode:`grid`}}),className:b(F,`size-7 p-0`,O===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,O===`grid`&&`text-accent-fg`),children:(0,Z.jsx)(_e,{className:`size-3.5`,strokeWidth:1.5})}),(0,Z.jsx)(x,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":O===`list`,onClick:()=>S({type:`patch`,patch:{viewMode:`list`}}),className:b(F,`size-9 p-0`,O===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,O===`list`&&`text-accent-fg`),children:(0,Z.jsx)(V,{className:`size-3.5`,strokeWidth:1.5})})]})]}),M&&j.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))}):j.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)(P,{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)(x,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:b(`grid min-w-0 gap-3`,O===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":w||void 0,children:j.map(e=>{let t=Ne(e,f);return(0,Z.jsx)(Oe,{session:e,variant:O,labels:Ce,sessionAgentId:t,sessionAgentAvatar:Pe(t,p),onOpen:()=>q(e.key),onAction:t=>void J(e.key,t)},e.key)})}),re?(0,Z.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Z.jsx)(x,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>void me(),children:t.loadMore})}):null]})]})]}),(0,Z.jsx)(at,{open:L,loading:z,session:B,sessionAgentId:B?Ne(B,f):void 0,sessionAgentAvatar:B?Pe(Ne(B,f),p):void 0,labels:we,onClose:()=>{S({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>B&&void J(B.key,`archive`),onUnarchive:()=>B&&void J(B.key,`unarchive`),onPin:()=>B&&void J(B.key,`pin`),onUnpin:()=>B&&void J(B.key,`unpin`),onExport:()=>B&&void J(B.key,`export`),onDelete:()=>B&&S({type:`patch`,patch:{confirmKey:B.key,confirmOpen:!0}})}),(0,Z.jsx)(u,{open:ie,onOpenChange:e=>S({type:`patch`,patch:{confirmOpen:e}}),children:(0,Z.jsxs)(s,{children:[(0,Z.jsx)(a,{className:b(`xopc-dialog-overlay fixed inset-0 bg-scrim`,E)}),(0,Z.jsxs)(c,{className:b(`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-panel p-4 shadow-popover dark:border-edge`,T),children:[(0,Z.jsx)(l,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:le?ct(t.deleteSessionMessage,{name:j.find(e=>e.key===le)?.name?.trim()||e.chat.newSession}):``}),(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(x,{type:`button`,variant:`secondary`,onClick:()=>S({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Z.jsx)(x,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{le&&Y(le),S({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{vt as SessionsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{mn as e}from"./index-SxqsTD4i.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-JdwAhgNB.js";import{
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{Ac as r,ls as i}from"./index-SxqsTD4i.js";var a=e();function o(){return`rounded-2xl border border-edge-subtle bg-surface-base 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=`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted transition-colors dark:bg-surface-hover/70`;function u(e){let t=(0,a.c)(29),{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;t[2]===h?v=t[3]:(v=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`,i.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`,i.press),t[2]=h,t[3]=v);let y=v,b=!!(m&&h),x;t[4]===p?x=t[5]:(x=n(`mb-5 flex items-start gap-3`,p),t[4]=p,t[5]=x);let S;t[6]!==m||t[7]!==h||t[8]!==_||t[9]!==y||t[10]!==b?(S=m?b?(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:y,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)(r,{className:`size-2.5`,strokeWidth:2.25})})]}):(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:y,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[6]=m,t[7]=h,t[8]=_,t[9]=y,t[10]=b,t[11]=S):S=t[11];let C;t[12]===c?C=t[13]:(C=(0,s.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c}),t[12]=c,t[13]=C);let w;t[14]!==C||t[15]!==f?(w=(0,s.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[C,f]}),t[14]=C,t[15]=f,t[16]=w):w=t[16];let T;t[17]===u?T=t[18]:(T=u?(0,s.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:u}):null,t[17]=u,t[18]=T);let E;t[19]!==w||t[20]!==T?(E=(0,s.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,T]}),t[19]=w,t[20]=T,t[21]=E):E=t[21];let D;t[22]===d?D=t[23]:(D=d?(0,s.jsx)(`div`,{className:`shrink-0`,children:d}):null,t[22]=d,t[23]=D);let O;return t[24]!==x||t[25]!==S||t[26]!==E||t[27]!==D?(O=(0,s.jsxs)(`div`,{className:x,children:[S,E,D]}),t[24]=x,t[25]=S,t[26]=E,t[27]=D,t[28]=O):O=t[28],O}export{u as n,o as r,c as t};
|
package/dist/gateway/static/root/assets/{settings-page-7DjpC9_C.js → settings-page-B0Khoduh.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{p as i,r as a}from"./chunk-KS7C4IRE-Cq1tE_3b.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{p as i,r as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./messages-BGc-OJWg.js";import{n as s}from"./locale-store-BkJ7g35d.js";import{$a as c,Ja as l,Ka as u,Qa as d,Xa as f,Ya as p,Za as m,eo as h,io as g,no as _,qa as v,ro as y,to as b}from"./index-SxqsTD4i.js";var x=n(),S=e(t(),1),C=r(),w=[`overview`,`appearance`,`keyboard-shortcuts`,`system`,`desktop-pet`,`desktop-app`,`agent-defaults`,`gateway`,`runtimes`,`devices`,`heartbeat`,`remote-access`,`shares`],T=(0,S.lazy)(()=>_().then(e=>({default:e.SetupStatusPanel}))),E=(0,S.lazy)(()=>l().then(e=>({default:e.AppearanceSettingsPanel}))),D=(0,S.lazy)(()=>c().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),O=(0,S.lazy)(()=>g().then(e=>({default:e.SystemSettingsPanel}))),k=(0,S.lazy)(()=>p().then(e=>({default:e.DesktopPetSettings}))),A=(0,S.lazy)(()=>v().then(e=>({default:e.AppManagementSettingsPanel}))),j=(0,S.lazy)(()=>m().then(e=>({default:e.GatewaySettingsPanel}))),M=(0,S.lazy)(()=>b().then(e=>({default:e.RuntimeToolsSettingsPanel}))),N=(0,S.lazy)(()=>d().then(e=>({default:e.HeartbeatSettingsPanel}))),P=(0,S.lazy)(()=>h().then(e=>({default:e.RemoteAccessHub}))),F=(0,S.lazy)(()=>y().then(e=>({default:e.SharesSettingsPanel}))),I=(0,S.lazy)(()=>u().then(e=>({default:e.AgentDefaultsSettingsPanel}))),L=(0,S.lazy)(()=>f().then(e=>({default:e.EndpointToolsManagementSettings})));function R(){let e=(0,x.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,C.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function z(e){return(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(R,{}),children:(0,C.jsx)(e,{})})}function B(){let e=(0,x.c)(28),{section:t}=i(),n=s(V),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||!w.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.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=z(T),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=z(E),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=z(D),e[10]=t):t=e[10],d=t;break bb0}if(s===`system`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(O),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=z(k),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=z(A),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=z(I),e[14]=t):t=e[14],d=t;break bb0}if(s===`gateway`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(j),e[15]=t):t=e[15],d=t;break bb0}if(s===`runtimes`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(M),e[16]=t):t=e[16],d=t;break bb0}if(s===`devices`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(L),e[17]=t):t=e[17],d=t;break bb0}if(s===`heartbeat`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(N),e[18]=t):t=e[18],d=t;break bb0}if(s===`remote-access`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(P),e[19]=t):t=e[19],d=t;break bb0}if(s===`shares`){let t;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(F),e[20]=t):t=e[20],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,C.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[21]!==r||e[22]!==c?(f=(0,C.jsx)(`p`,{className:r,children:c}),e[21]=r,e[22]=c,e[23]=f):f=e[23];let p;return e[24]!==l||e[25]!==u||e[26]!==f?(p=(0,C.jsxs)(`div`,{className:l,children:[u,f]}),e[24]=l,e[25]=u,e[26]=f,e[27]=p):p=e[27],p}function V(e){return e.language}export{B as SettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./messages-DH_HCgmw.js";import{a as c,c as l,n as u,r as d}from"./locale-store-CRNble2Z.js";import{t as f}from"./cn-JdwAhgNB.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{r as m}from"./gateway-config-swr-BjsDnB_n.js";import{n as h,t as g}from"./registry-api-DmYFpjsH.js";import{Dt as _,Ka as v,Nu as y,Qs as b,Us as x,bc as S,dn as C,ds as ee,lu as w,ml as T,nu as E,tu as D,yo as O}from"./index-C6PmD0cK.js";import{n as k,r as A}from"./settings-page-layout-DYelDcMV.js";import{n as j,t as M}from"./settings-form-section-2LGjz7bu.js";import{n as N}from"./settings-loading-skeleton-CAmWMaOT.js";import{t as P}from"./settings-advanced-gate-BQu8bAcN.js";var F=e(t(),1),I=n();function L(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`&&O(e)).length}function R(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 te(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 ne(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 z(e){return e?`pass`:`fail`}function B(e){if(e===`provider-auth`)return`/settings/capabilities/models`;if(e===`config-health`)return`/settings/gateway`;if(e===`state-integrity`||e===`workspace-status`)return`/agents`;if(e===`database-schema`||e===`session-integrity`)return`/settings/sessions`;if(e===`channel-config`||e===`channel-pairing-pending`||e.startsWith(`channel:`))return`/channels`;if(e===`security-audit`||e===`gateway-service`||e===`gateway-health`)return`/settings/gateway`;if(e===`version-check`)return`/settings/desktop-app`}function V(e){return{fail:4,warn:3,skip:2,pass:1}[e]}function H(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 U(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=>H(e,t))}}function W(e,t){return e.filter(e=>e.status===`fail`||e.status===`warn`).map(e=>{let n=U(e,t);return{id:n.id,label:n.label,status:n.status,message:n.message,hints:n.hints,path:B(n.id),source:`doctor`}}).toSorted((e,t)=>V(t.status)-V(e.status)||e.label.localeCompare(t.label))}function G(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=U(i,e.copy);n.push({id:t.id,label:t.label,status:t.status,message:t.message,path:B(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 re(e){let t=L(e.config),n=e.providerMeta?.configured??t,r=e.providerMeta?.total??0,i=n>0||t>0,a=R(e.config),o=a.length>0,s=e.hasToken&&e.realtimeConnected,c=te(e.config),l=e.skillCount>0,u=e.doctorChecks??[],d=W(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:z(s),title:`Gateway`,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline,path:`/settings/gateway`},{id:`provider`,status:z(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:z(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=G({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 ie(e){return ne(e)}function ae(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 oe(){return d(`/api/doctor`)}async function se(){return((await c(oe())).checks??[]).map(ae).filter(e=>e!==null)}function ce(){return d(`/api/logs/health`)}async function le(){return c(ce())}function K(e){return e?`pass`:`warn`}function ue(e){return e?.enabled?[`setup-browser-diagnostics`,e]:null}async function q(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:K(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 J(){let e=(0,I.c)(95),t=l(ge),n=u(he),r;e[0]===n?r=e[1]:(r=s(n),e[0]=n,e[1]=r);let i=r,a=i.setupStatus.labels,o=i.setupStatus.diagnostics,c=v(me),{data:d,error:f,isLoading:y,mutate:b}=m(!!t),x;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(x={revalidateOnFocus:!1},e[2]=x):x=e[2];let{data:S,error:C,isLoading:ee,mutate:w}=p(t?`setup-checklist-skills`:null,pe,x),T;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},e[3]=T):T=e[3];let{data:E,error:D,isLoading:O,mutate:k}=p(t?`setup-checklist-provider-meta`:null,_,T),A;e[4]===t?A=e[5]:(A=t?oe():null,e[4]=t,e[5]=A);let j;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(j={revalidateOnFocus:!1},e[6]=j):j=e[6];let{data:M,error:N,isLoading:P,mutate:F}=p(A,se,j),L;e[7]===t?L=e[8]:(L=t?ce():null,e[7]=t,e[8]=L);let R;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(R={revalidateOnFocus:!1},e[9]=R):R=e[9];let{data:te,isLoading:ne,mutate:z}=p(L,le,R);d?.payload?.config;let B=d?.payload?.config,V;e[10]===B?V=e[11]:(V=ie(B),e[10]=B,e[11]=V);let H=t?V:null,U;e[12]===H?U=e[13]:(U=ue(H),e[12]=H,e[13]=U);let W;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(W={revalidateOnFocus:!1},e[14]=W):W=e[14];let{data:G,isLoading:ae,mutate:K}=p(U,fe,W),q;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(q={revalidateOnFocus:!1},e[15]=q):q=e[15],p(t?g:null,h,q);let J=!t||!y&&!ee&&!O&&!P&&!ne&&!ae,Y=!!(f||C||D||N),X;bb0:{if(!t||!J){X=null;break bb0}let n=S?.catalog?.length??0,r;if(e[16]!==G||e[17]!==d?.payload?.config||e[18]!==o.browserDriverConfigured||e[19]!==o.chromiumInstalled||e[20]!==o.chromiumNotInstalled||e[21]!==o.extensionConnected||e[22]!==o.extensionNeedsRefresh||e[23]!==o.extensionNotConnected||e[24]!==o.extensionNotInstalled||e[25]!==o.gatewayNotInstalled||e[26]!==o.gatewayNotRunning||e[27]!==o.gatewayUnavailable||e[28]!==o.installCommand||e[29]!==o.labels||e[30]!==o.logsErrors||e[31]!==o.logsHealthy||e[32]!==o.logsShuttingDown||e[33]!==o.providerAuthMissing||e[34]!==o.runCommand||e[35]!==o.runtimeInvalid||e[36]!==o.runtimeMissing||e[37]!==o.startCommand||e[38]!==M||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]!==te||e[51]!==i.setupStatus.requiredCompleteMessage||e[52]!==E||e[53]!==c||e[54]!==n||e[55]!==t){let s=E?.filter(de).length??0,l=E?.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]===o.runtimeMissing?h=e[66]:(h=e=>o.runtimeMissing.replace(`{{runtimes}}`,e),e[65]=o.runtimeMissing,e[66]=h);let g;e[67]===o.runtimeInvalid?g=e[68]:(g=e=>o.runtimeInvalid.replace(`{{runtimes}}`,e),e[67]=o.runtimeInvalid,e[68]=g);let _;e[69]===o.gatewayUnavailable?_=e[70]:(_=e=>o.gatewayUnavailable.replace(`{{detail}}`,e),e[69]=o.gatewayUnavailable,e[70]=_);let v;e[71]===o.gatewayNotRunning?v=e[72]:(v=e=>o.gatewayNotRunning.replace(`{{status}}`,e),e[71]=o.gatewayNotRunning,e[72]=v);let y;e[73]===o.runCommand?y=e[74]:(y=e=>o.runCommand.replace(`{{command}}`,e),e[73]=o.runCommand,e[74]=y);let b;e[75]===o.installCommand?b=e[76]:(b=e=>o.installCommand.replace(`{{command}}`,e),e[75]=o.installCommand,e[76]=b);let x;e[77]===o.startCommand?x=e[78]:(x=e=>o.startCommand.replace(`{{command}}`,e),e[77]=o.startCommand,e[78]=x);let S;e[79]===o.logsErrors?S=e[80]:(S=e=>o.logsErrors.replace(`{{count}}`,String(e)),e[79]=o.logsErrors,e[80]=S);let C;e[81]===o.browserDriverConfigured?C=e[82]:(C=e=>o.browserDriverConfigured.replace(`{{driver}}`,e),e[81]=o.browserDriverConfigured,e[82]=C),r=re({hasToken:!!t,realtimeConnected:c,config:d?.payload?.config,skillCount:n,providerMeta:l>0?{configured:s,total:l}:null,doctorChecks:M,logsHealth:te,browserDiagnostics:G,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:o.labels,runtimeMissing:h,runtimeInvalid:g,gatewayNotInstalled:o.gatewayNotInstalled,gatewayUnavailable:_,gatewayNotRunning:v,providerAuthMissing:o.providerAuthMissing,runCommand:y,installCommand:b,startCommand:x,logsHealthy:o.logsHealthy,logsShuttingDown:o.logsShuttingDown,logsErrors:S,chromiumInstalled:o.chromiumInstalled,chromiumNotInstalled:o.chromiumNotInstalled,extensionConnected:o.extensionConnected,extensionNeedsRefresh:o.extensionNeedsRefresh,extensionNotConnected:o.extensionNotConnected,extensionNotInstalled:o.extensionNotInstalled,browserDriverConfigured:C}}}),e[16]=G,e[17]=d?.payload?.config,e[18]=o.browserDriverConfigured,e[19]=o.chromiumInstalled,e[20]=o.chromiumNotInstalled,e[21]=o.extensionConnected,e[22]=o.extensionNeedsRefresh,e[23]=o.extensionNotConnected,e[24]=o.extensionNotInstalled,e[25]=o.gatewayNotInstalled,e[26]=o.gatewayNotRunning,e[27]=o.gatewayUnavailable,e[28]=o.installCommand,e[29]=o.labels,e[30]=o.logsErrors,e[31]=o.logsHealthy,e[32]=o.logsShuttingDown,e[33]=o.providerAuthMissing,e[34]=o.runCommand,e[35]=o.runtimeInvalid,e[36]=o.runtimeMissing,e[37]=o.startCommand,e[38]=M,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]=te,e[51]=i.setupStatus.requiredCompleteMessage,e[52]=E,e[53]=c,e[54]=n,e[55]=t,e[56]=r}else r=e[56];X=r}let Z=X,Q;e[83]!==K||e[84]!==b||e[85]!==F||e[86]!==z||e[87]!==k||e[88]!==w?(Q=async()=>{await Promise.all([b(),w(),k(),F(),z(),K()])},e[83]=K,e[84]=b,e[85]=F,e[86]=z,e[87]=k,e[88]=w,e[89]=Q):Q=e[89];let _e=Q,$;return e[90]!==Y||e[91]!==J||e[92]!==_e||e[93]!==Z?($={ready:J,error:Y,snapshot:Z,refresh:_e},e[90]=Y,e[91]=J,e[92]=_e,e[93]=Z,e[94]=$):$=e[94],$}function de(e){return e.configured}function fe(e){let[,t]=e;return q(t)}function pe(){return C()}function me(e){return e.connectionState===`connected`}function he(e){return e.language}function ge(e){return e.sessionKey}var Y=r();function X(e){return e===`pass`?`border-success/30 bg-success-soft text-success`:e===`warn`?`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`fail`?`border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge bg-surface-hover text-fg-muted`}function Z(e){return e===`pass`?a:e===`warn`?x:e===`fail`?E:T}function Q(e,t){return e===`blocked`?{icon:E,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:x,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:D,className:`bg-surface-base text-fg shadow-surface`,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 _e(e){let t=(0,I.c)(46),{tier:n,issueCount:r,onRunDoctor:a,ready:c,doctorRunning:l,doctorRunState:d}=e,p=u($),m,h,g,_,v,y,b,x,C;if(t[0]!==r||t[1]!==p||t[2]!==n){h=s(p).setupStatus;let e=Q(n,h),a=e.icon,o=`targetId`in e&&typeof e.targetId==`string`?e.targetId:null,c=`actionPath`in e&&typeof e.actionPath==`string`?e.actionPath:`/chat`;m=o?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(o)?.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,Y.jsx)(w,{className:`size-4`,"aria-hidden":!0})]}):(0,Y.jsxs)(i,{to:c,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,Y.jsx)(w,{className:`size-4`,"aria-hidden":!0})]}),C=f(`rounded-xl p-4`,e.className),x=`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,y=`flex min-w-0 gap-3`,b=(0,Y.jsx)(a,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),g=`min-w-0`,_=(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:e.title}),v=r>0?(0,Y.jsx)(`p`,{className:`mt-1 text-sm opacity-80`,children:h.health.issueCount.replace(`{{count}}`,String(r))}):null,t[0]=r,t[1]=p,t[2]=n,t[3]=m,t[4]=h,t[5]=g,t[6]=_,t[7]=v,t[8]=y,t[9]=b,t[10]=x,t[11]=C}else m=t[3],h=t[4],g=t[5],_=t[6],v=t[7],y=t[8],b=t[9],x=t[10],C=t[11];let T;t[12]!==g||t[13]!==_||t[14]!==v?(T=(0,Y.jsxs)(`div`,{className:g,children:[_,v]}),t[12]=g,t[13]=_,t[14]=v,t[15]=T):T=t[15];let E;t[16]!==y||t[17]!==b||t[18]!==T?(E=(0,Y.jsxs)(`div`,{className:y,children:[b,T]}),t[16]=y,t[17]=b,t[18]=T,t[19]=E):E=t[19];let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=f(`inline-flex items-center gap-2 rounded-lg border border-edge bg-surface-base 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`,ee.press),t[20]=D):D=t[20];let O=!c||l,k;t[21]===l?k=t[22]:(k=l?(0,Y.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(S,{className:`size-4`,"aria-hidden":!0}),t[21]=l,t[22]=k);let A=l?h.health.runDoctorRunning:h.health.runDoctor,j;t[23]!==l||t[24]!==a||t[25]!==O||t[26]!==k||t[27]!==A?(j=(0,Y.jsxs)(`button`,{type:`button`,className:D,onClick:a,disabled:O,"aria-busy":l,children:[k,A]}),t[23]=l,t[24]=a,t[25]=O,t[26]=k,t[27]=A,t[28]=j):j=t[28];let M;t[29]!==m||t[30]!==j?(M=(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[m,j]}),t[29]=m,t[30]=j,t[31]=M):M=t[31];let N;t[32]!==M||t[33]!==x||t[34]!==E?(N=(0,Y.jsxs)(`div`,{className:x,children:[E,M]}),t[32]=M,t[33]=x,t[34]=E,t[35]=N):N=t[35];let P;t[36]!==d||t[37]!==l||t[38]!==h.health.doctorCompleteMessage||t[39]!==h.health.doctorFailedMessage||t[40]!==h.health.doctorRunningMessage?(P=l||d!==`idle`?(0,Y.jsx)(`p`,{className:`mt-3 text-xs opacity-75`,role:`status`,"aria-live":`polite`,children:l?h.health.doctorRunningMessage:d===`success`?h.health.doctorCompleteMessage:h.health.doctorFailedMessage}):null,t[36]=d,t[37]=l,t[38]=h.health.doctorCompleteMessage,t[39]=h.health.doctorFailedMessage,t[40]=h.health.doctorRunningMessage,t[41]=P):P=t[41];let F;return t[42]!==N||t[43]!==P||t[44]!==C?(F=(0,Y.jsxs)(`section`,{className:C,children:[N,P]}),t[42]=N,t[43]=P,t[44]=C,t[45]=F):F=t[45],F}function $(e){return e.language}function ve(e){let t=(0,I.c)(26),{issue:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,Y.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,Y.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,Y.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,Y.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,Y.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,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg`,children:[r,(0,Y.jsx)(w,{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,Y.jsxs)(Y.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,Y.jsx)(i,{to:n.path,className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface hover:bg-surface-hover/60 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,Y.jsx)(`div`,{className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`,children:m}),t[24]=m,t[25]=h),h}function ye(e){let t=(0,I.c)(27),{item:n,labels:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,s=r[n.id]??n.title,c;t[2]===n.status?c=t[3]:(c=f(`flex size-7 shrink-0 items-center justify-center rounded-full border`,X(n.status)),t[2]=n.status,t[3]=c);let l;t[4]===o?l=t[5]:(l=(0,Y.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t[4]=o,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Y.jsx)(`span`,{className:c,children:l}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===s?d=t[10]:(d=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:s}),t[9]=s,t[10]=d);let p;t[11]===n.detail?p=t[12]:(p=(0,Y.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]!==d||t[14]!==p?(m=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,p]}),t[13]=d,t[14]=p,t[15]=m):m=t[15];let h;t[16]===n.path?h=t[17]:(h=n.path?(0,Y.jsx)(w,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[16]=n.path,t[17]=h);let g;t[18]!==u||t[19]!==m||t[20]!==h?(g=(0,Y.jsxs)(Y.Fragment,{children:[u,m,h]}),t[18]=u,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,Y.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,Y.jsx)(`div`,{className:`flex items-center gap-3 rounded-lg p-3`,children:_}),t[25]=_,t[26]=v),v}function be(e){let t=(0,I.c)(23),{signal:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,Y.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,Y.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,Y.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,Y.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,Y.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,Y.jsxs)(Y.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,Y.jsx)(i,{to:n.path,className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface hover:bg-surface-hover/60 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,Y.jsx)(`div`,{className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:p}),t[21]=p,t[22]=m),m}function xe(){let e=s(u(e=>e.language)).setupStatus,{ready:t,error:n,snapshot:r,refresh:i}=J(),[a,o]=(0,F.useState)(!1),[c,l]=(0,F.useState)(`idle`),d=r?.diagnosticSignals.filter(e=>e.status===`fail`||e.status===`warn`)??[],f=async()=>{if(!(a||!t)){o(!0),l(`idle`);try{await i(),l(`success`)}catch{l(`error`)}finally{o(!1)}}};return(0,Y.jsxs)(A,{gap:`gap-6`,children:[(0,Y.jsx)(k,{title:e.title}),n?(0,Y.jsx)(`p`,{className:`rounded-xl border border-red-300/40 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300`,children:e.loadError}):null,!t||!r?(0,Y.jsx)(N,{sections:2}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(_e,{tier:r.healthTier,issueCount:r.issues.length,ready:t,onRunDoctor:()=>void f(),doctorRunning:a,doctorRunState:c}),(0,Y.jsxs)(M,{id:`next-steps`,children:[(0,Y.jsx)(j,{icon:r.issues.length?x:y,title:e.nextStepsTitle}),r.issues.length?(0,Y.jsx)(`div`,{className:`mt-4 flex flex-col gap-2`,children:r.issues.slice(0,8).map(t=>(0,Y.jsx)(ve,{issue:t,fixLabel:e.fixIssue},`${t.source}:${t.id}`))}):(0,Y.jsx)(`div`,{className:`mt-4 rounded-lg bg-surface-panel/80 shadow-surface`,children:r.readiness.map(t=>(0,Y.jsx)(ye,{item:t,labels:e.readinessLabels},t.id))})]}),(0,Y.jsx)(P,{children:(0,Y.jsxs)(M,{children:[(0,Y.jsx)(j,{icon:b,title:e.diagnosticsTitle}),d.length?(0,Y.jsx)(`div`,{className:`mt-4 grid gap-2 md:grid-cols-2`,children:d.map(t=>(0,Y.jsx)(be,{signal:t,fixLabel:e.fixIssue},t.id))}):(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-panel/80 p-3 text-sm text-fg-muted shadow-surface`,children:r.diagnosticSignals.length?e.diagnosticsAllClear:e.diagnosticsEmpty})]})})]})]})}export{xe as SetupStatusPanel};
|
|
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-Cq1tE_3b.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./messages-BGc-OJWg.js";import{a as c,c as l,n as u,r as d}from"./locale-store-BkJ7g35d.js";import{t as f}from"./cn-JdwAhgNB.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{r as m}from"./gateway-config-swr-cd8owslz.js";import{n as h,t as g}from"./registry-api-CTq8EECj.js";import{Dt as _,Mu as v,Vs as y,Wa as b,Xs as x,_o as S,cu as C,dn as w,eu as T,ls as E,pl as D,tu as O,vc as ee}from"./index-SxqsTD4i.js";import{n as k,r as A}from"./settings-page-layout-DYelDcMV.js";import{n as j,t as M}from"./settings-form-section-CIA1AA-A.js";import{n as N}from"./settings-loading-skeleton-CAmWMaOT.js";import{t as P}from"./settings-advanced-gate-DVH_l6Hr.js";var F=e(t(),1),I=n();function L(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`&&S(e)).length}function R(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 te(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 ne(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 z(e){return e?`pass`:`fail`}function B(e){if(e===`provider-auth`)return`/settings/capabilities/models`;if(e===`config-health`)return`/settings/gateway`;if(e===`state-integrity`||e===`workspace-status`)return`/agents`;if(e===`database-schema`||e===`session-integrity`)return`/settings/sessions`;if(e===`channel-config`||e===`channel-pairing-pending`||e.startsWith(`channel:`))return`/channels`;if(e===`security-audit`||e===`gateway-service`||e===`gateway-health`)return`/settings/gateway`;if(e===`version-check`)return`/settings/desktop-app`}function V(e){return{fail:4,warn:3,skip:2,pass:1}[e]}function H(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 U(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=>H(e,t))}}function W(e,t){return e.filter(e=>e.status===`fail`||e.status===`warn`).map(e=>{let n=U(e,t);return{id:n.id,label:n.label,status:n.status,message:n.message,hints:n.hints,path:B(n.id),source:`doctor`}}).toSorted((e,t)=>V(t.status)-V(e.status)||e.label.localeCompare(t.label))}function G(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=U(i,e.copy);n.push({id:t.id,label:t.label,status:t.status,message:t.message,path:B(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 re(e){let t=L(e.config),n=e.providerMeta?.configured??t,r=e.providerMeta?.total??0,i=n>0||t>0,a=R(e.config),o=a.length>0,s=e.hasToken&&e.realtimeConnected,c=te(e.config),l=e.skillCount>0,u=e.doctorChecks??[],d=W(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:z(s),title:`Gateway`,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline,path:`/settings/gateway`},{id:`provider`,status:z(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:z(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=G({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 ie(e){return ne(e)}function ae(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 oe(){return d(`/api/doctor`)}async function se(){return((await c(oe())).checks??[]).map(ae).filter(e=>e!==null)}function ce(){return d(`/api/logs/health`)}async function le(){return c(ce())}function K(e){return e?`pass`:`warn`}function ue(e){return e?.enabled?[`setup-browser-diagnostics`,e]:null}async function q(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:K(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 J(){let e=(0,I.c)(95),t=l(ge),n=u(he),r;e[0]===n?r=e[1]:(r=s(n),e[0]=n,e[1]=r);let i=r,a=i.setupStatus.labels,o=i.setupStatus.diagnostics,c=b(me),{data:d,error:f,isLoading:v,mutate:y}=m(!!t),x;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(x={revalidateOnFocus:!1},e[2]=x):x=e[2];let{data:S,error:C,isLoading:w,mutate:T}=p(t?`setup-checklist-skills`:null,pe,x),E;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(E={revalidateOnFocus:!1},e[3]=E):E=e[3];let{data:D,error:O,isLoading:ee,mutate:k}=p(t?`setup-checklist-provider-meta`:null,_,E),A;e[4]===t?A=e[5]:(A=t?oe():null,e[4]=t,e[5]=A);let j;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(j={revalidateOnFocus:!1},e[6]=j):j=e[6];let{data:M,error:N,isLoading:P,mutate:F}=p(A,se,j),L;e[7]===t?L=e[8]:(L=t?ce():null,e[7]=t,e[8]=L);let R;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(R={revalidateOnFocus:!1},e[9]=R):R=e[9];let{data:te,isLoading:ne,mutate:z}=p(L,le,R);d?.payload?.config;let B=d?.payload?.config,V;e[10]===B?V=e[11]:(V=ie(B),e[10]=B,e[11]=V);let H=t?V:null,U;e[12]===H?U=e[13]:(U=ue(H),e[12]=H,e[13]=U);let W;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(W={revalidateOnFocus:!1},e[14]=W):W=e[14];let{data:G,isLoading:ae,mutate:K}=p(U,fe,W),q;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(q={revalidateOnFocus:!1},e[15]=q):q=e[15],p(t?g:null,h,q);let J=!t||!v&&!w&&!ee&&!P&&!ne&&!ae,Y=!!(f||C||O||N),X;bb0:{if(!t||!J){X=null;break bb0}let n=S?.catalog?.length??0,r;if(e[16]!==G||e[17]!==d?.payload?.config||e[18]!==o.browserDriverConfigured||e[19]!==o.chromiumInstalled||e[20]!==o.chromiumNotInstalled||e[21]!==o.extensionConnected||e[22]!==o.extensionNeedsRefresh||e[23]!==o.extensionNotConnected||e[24]!==o.extensionNotInstalled||e[25]!==o.gatewayNotInstalled||e[26]!==o.gatewayNotRunning||e[27]!==o.gatewayUnavailable||e[28]!==o.installCommand||e[29]!==o.labels||e[30]!==o.logsErrors||e[31]!==o.logsHealthy||e[32]!==o.logsShuttingDown||e[33]!==o.providerAuthMissing||e[34]!==o.runCommand||e[35]!==o.runtimeInvalid||e[36]!==o.runtimeMissing||e[37]!==o.startCommand||e[38]!==M||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]!==te||e[51]!==i.setupStatus.requiredCompleteMessage||e[52]!==D||e[53]!==c||e[54]!==n||e[55]!==t){let s=D?.filter(de).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]===o.runtimeMissing?h=e[66]:(h=e=>o.runtimeMissing.replace(`{{runtimes}}`,e),e[65]=o.runtimeMissing,e[66]=h);let g;e[67]===o.runtimeInvalid?g=e[68]:(g=e=>o.runtimeInvalid.replace(`{{runtimes}}`,e),e[67]=o.runtimeInvalid,e[68]=g);let _;e[69]===o.gatewayUnavailable?_=e[70]:(_=e=>o.gatewayUnavailable.replace(`{{detail}}`,e),e[69]=o.gatewayUnavailable,e[70]=_);let v;e[71]===o.gatewayNotRunning?v=e[72]:(v=e=>o.gatewayNotRunning.replace(`{{status}}`,e),e[71]=o.gatewayNotRunning,e[72]=v);let y;e[73]===o.runCommand?y=e[74]:(y=e=>o.runCommand.replace(`{{command}}`,e),e[73]=o.runCommand,e[74]=y);let b;e[75]===o.installCommand?b=e[76]:(b=e=>o.installCommand.replace(`{{command}}`,e),e[75]=o.installCommand,e[76]=b);let x;e[77]===o.startCommand?x=e[78]:(x=e=>o.startCommand.replace(`{{command}}`,e),e[77]=o.startCommand,e[78]=x);let S;e[79]===o.logsErrors?S=e[80]:(S=e=>o.logsErrors.replace(`{{count}}`,String(e)),e[79]=o.logsErrors,e[80]=S);let C;e[81]===o.browserDriverConfigured?C=e[82]:(C=e=>o.browserDriverConfigured.replace(`{{driver}}`,e),e[81]=o.browserDriverConfigured,e[82]=C),r=re({hasToken:!!t,realtimeConnected:c,config:d?.payload?.config,skillCount:n,providerMeta:l>0?{configured:s,total:l}:null,doctorChecks:M,logsHealth:te,browserDiagnostics:G,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:o.labels,runtimeMissing:h,runtimeInvalid:g,gatewayNotInstalled:o.gatewayNotInstalled,gatewayUnavailable:_,gatewayNotRunning:v,providerAuthMissing:o.providerAuthMissing,runCommand:y,installCommand:b,startCommand:x,logsHealthy:o.logsHealthy,logsShuttingDown:o.logsShuttingDown,logsErrors:S,chromiumInstalled:o.chromiumInstalled,chromiumNotInstalled:o.chromiumNotInstalled,extensionConnected:o.extensionConnected,extensionNeedsRefresh:o.extensionNeedsRefresh,extensionNotConnected:o.extensionNotConnected,extensionNotInstalled:o.extensionNotInstalled,browserDriverConfigured:C}}}),e[16]=G,e[17]=d?.payload?.config,e[18]=o.browserDriverConfigured,e[19]=o.chromiumInstalled,e[20]=o.chromiumNotInstalled,e[21]=o.extensionConnected,e[22]=o.extensionNeedsRefresh,e[23]=o.extensionNotConnected,e[24]=o.extensionNotInstalled,e[25]=o.gatewayNotInstalled,e[26]=o.gatewayNotRunning,e[27]=o.gatewayUnavailable,e[28]=o.installCommand,e[29]=o.labels,e[30]=o.logsErrors,e[31]=o.logsHealthy,e[32]=o.logsShuttingDown,e[33]=o.providerAuthMissing,e[34]=o.runCommand,e[35]=o.runtimeInvalid,e[36]=o.runtimeMissing,e[37]=o.startCommand,e[38]=M,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]=te,e[51]=i.setupStatus.requiredCompleteMessage,e[52]=D,e[53]=c,e[54]=n,e[55]=t,e[56]=r}else r=e[56];X=r}let Z=X,Q;e[83]!==K||e[84]!==y||e[85]!==F||e[86]!==z||e[87]!==k||e[88]!==T?(Q=async()=>{await Promise.all([y(),T(),k(),F(),z(),K()])},e[83]=K,e[84]=y,e[85]=F,e[86]=z,e[87]=k,e[88]=T,e[89]=Q):Q=e[89];let _e=Q,$;return e[90]!==Y||e[91]!==J||e[92]!==_e||e[93]!==Z?($={ready:J,error:Y,snapshot:Z,refresh:_e},e[90]=Y,e[91]=J,e[92]=_e,e[93]=Z,e[94]=$):$=e[94],$}function de(e){return e.configured}function fe(e){let[,t]=e;return q(t)}function pe(){return w()}function me(e){return e.connectionState===`connected`}function he(e){return e.language}function ge(e){return e.sessionKey}var Y=r();function X(e){return e===`pass`?`border-success/30 bg-success-soft text-success`:e===`warn`?`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`fail`?`border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge bg-surface-hover text-fg-muted`}function Z(e){return e===`pass`?a:e===`warn`?y:e===`fail`?O:D}function Q(e,t){return e===`blocked`?{icon:O,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:y,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:T,className:`bg-surface-base text-fg shadow-surface`,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 _e(e){let t=(0,I.c)(46),{tier:n,issueCount:r,onRunDoctor:a,ready:c,doctorRunning:l,doctorRunState:d}=e,p=u($),m,h,g,_,v,y,b,x,S;if(t[0]!==r||t[1]!==p||t[2]!==n){h=s(p).setupStatus;let e=Q(n,h),a=e.icon,o=`targetId`in e&&typeof e.targetId==`string`?e.targetId:null,c=`actionPath`in e&&typeof e.actionPath==`string`?e.actionPath:`/chat`;m=o?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(o)?.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,Y.jsx)(C,{className:`size-4`,"aria-hidden":!0})]}):(0,Y.jsxs)(i,{to:c,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,Y.jsx)(C,{className:`size-4`,"aria-hidden":!0})]}),S=f(`rounded-xl p-4`,e.className),x=`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,y=`flex min-w-0 gap-3`,b=(0,Y.jsx)(a,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),g=`min-w-0`,_=(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:e.title}),v=r>0?(0,Y.jsx)(`p`,{className:`mt-1 text-sm opacity-80`,children:h.health.issueCount.replace(`{{count}}`,String(r))}):null,t[0]=r,t[1]=p,t[2]=n,t[3]=m,t[4]=h,t[5]=g,t[6]=_,t[7]=v,t[8]=y,t[9]=b,t[10]=x,t[11]=S}else m=t[3],h=t[4],g=t[5],_=t[6],v=t[7],y=t[8],b=t[9],x=t[10],S=t[11];let w;t[12]!==g||t[13]!==_||t[14]!==v?(w=(0,Y.jsxs)(`div`,{className:g,children:[_,v]}),t[12]=g,t[13]=_,t[14]=v,t[15]=w):w=t[15];let T;t[16]!==y||t[17]!==b||t[18]!==w?(T=(0,Y.jsxs)(`div`,{className:y,children:[b,w]}),t[16]=y,t[17]=b,t[18]=w,t[19]=T):T=t[19];let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=f(`inline-flex items-center gap-2 rounded-lg border border-edge bg-surface-base 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`,E.press),t[20]=D):D=t[20];let O=!c||l,k;t[21]===l?k=t[22]:(k=l?(0,Y.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[21]=l,t[22]=k);let A=l?h.health.runDoctorRunning:h.health.runDoctor,j;t[23]!==l||t[24]!==a||t[25]!==O||t[26]!==k||t[27]!==A?(j=(0,Y.jsxs)(`button`,{type:`button`,className:D,onClick:a,disabled:O,"aria-busy":l,children:[k,A]}),t[23]=l,t[24]=a,t[25]=O,t[26]=k,t[27]=A,t[28]=j):j=t[28];let M;t[29]!==m||t[30]!==j?(M=(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[m,j]}),t[29]=m,t[30]=j,t[31]=M):M=t[31];let N;t[32]!==M||t[33]!==x||t[34]!==T?(N=(0,Y.jsxs)(`div`,{className:x,children:[T,M]}),t[32]=M,t[33]=x,t[34]=T,t[35]=N):N=t[35];let P;t[36]!==d||t[37]!==l||t[38]!==h.health.doctorCompleteMessage||t[39]!==h.health.doctorFailedMessage||t[40]!==h.health.doctorRunningMessage?(P=l||d!==`idle`?(0,Y.jsx)(`p`,{className:`mt-3 text-xs opacity-75`,role:`status`,"aria-live":`polite`,children:l?h.health.doctorRunningMessage:d===`success`?h.health.doctorCompleteMessage:h.health.doctorFailedMessage}):null,t[36]=d,t[37]=l,t[38]=h.health.doctorCompleteMessage,t[39]=h.health.doctorFailedMessage,t[40]=h.health.doctorRunningMessage,t[41]=P):P=t[41];let F;return t[42]!==N||t[43]!==P||t[44]!==S?(F=(0,Y.jsxs)(`section`,{className:S,children:[N,P]}),t[42]=N,t[43]=P,t[44]=S,t[45]=F):F=t[45],F}function $(e){return e.language}function ve(e){let t=(0,I.c)(26),{issue:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,Y.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,Y.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,Y.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,Y.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,Y.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,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg`,children:[r,(0,Y.jsx)(C,{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,Y.jsxs)(Y.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,Y.jsx)(i,{to:n.path,className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface hover:bg-surface-hover/60 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,Y.jsx)(`div`,{className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`,children:m}),t[24]=m,t[25]=h),h}function ye(e){let t=(0,I.c)(27),{item:n,labels:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,s=r[n.id]??n.title,c;t[2]===n.status?c=t[3]:(c=f(`flex size-7 shrink-0 items-center justify-center rounded-full border`,X(n.status)),t[2]=n.status,t[3]=c);let l;t[4]===o?l=t[5]:(l=(0,Y.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t[4]=o,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Y.jsx)(`span`,{className:c,children:l}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===s?d=t[10]:(d=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:s}),t[9]=s,t[10]=d);let p;t[11]===n.detail?p=t[12]:(p=(0,Y.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]!==d||t[14]!==p?(m=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,p]}),t[13]=d,t[14]=p,t[15]=m):m=t[15];let h;t[16]===n.path?h=t[17]:(h=n.path?(0,Y.jsx)(C,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[16]=n.path,t[17]=h);let g;t[18]!==u||t[19]!==m||t[20]!==h?(g=(0,Y.jsxs)(Y.Fragment,{children:[u,m,h]}),t[18]=u,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,Y.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,Y.jsx)(`div`,{className:`flex items-center gap-3 rounded-lg p-3`,children:_}),t[25]=_,t[26]=v),v}function be(e){let t=(0,I.c)(23),{signal:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,Y.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,Y.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,Y.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,Y.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,Y.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,Y.jsxs)(Y.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,Y.jsx)(i,{to:n.path,className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface hover:bg-surface-hover/60 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,Y.jsx)(`div`,{className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:p}),t[21]=p,t[22]=m),m}function xe(){let e=s(u(e=>e.language)).setupStatus,{ready:t,error:n,snapshot:r,refresh:i}=J(),[a,o]=(0,F.useState)(!1),[c,l]=(0,F.useState)(`idle`),d=r?.diagnosticSignals.filter(e=>e.status===`fail`||e.status===`warn`)??[],f=async()=>{if(!(a||!t)){o(!0),l(`idle`);try{await i(),l(`success`)}catch{l(`error`)}finally{o(!1)}}};return(0,Y.jsxs)(A,{gap:`gap-6`,children:[(0,Y.jsx)(k,{title:e.title}),n?(0,Y.jsx)(`p`,{className:`rounded-xl border border-red-300/40 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300`,children:e.loadError}):null,!t||!r?(0,Y.jsx)(N,{sections:2}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(_e,{tier:r.healthTier,issueCount:r.issues.length,ready:t,onRunDoctor:()=>void f(),doctorRunning:a,doctorRunState:c}),(0,Y.jsxs)(M,{id:`next-steps`,children:[(0,Y.jsx)(j,{icon:r.issues.length?y:v,title:e.nextStepsTitle}),r.issues.length?(0,Y.jsx)(`div`,{className:`mt-4 flex flex-col gap-2`,children:r.issues.slice(0,8).map(t=>(0,Y.jsx)(ve,{issue:t,fixLabel:e.fixIssue},`${t.source}:${t.id}`))}):(0,Y.jsx)(`div`,{className:`mt-4 rounded-lg bg-surface-panel/80 shadow-surface`,children:r.readiness.map(t=>(0,Y.jsx)(ye,{item:t,labels:e.readinessLabels},t.id))})]}),(0,Y.jsx)(P,{children:(0,Y.jsxs)(M,{children:[(0,Y.jsx)(j,{icon:x,title:e.diagnosticsTitle}),d.length?(0,Y.jsx)(`div`,{className:`mt-4 grid gap-2 md:grid-cols-2`,children:d.map(t=>(0,Y.jsx)(be,{signal:t,fixLabel:e.fixIssue},t.id))}):(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-panel/80 p-3 text-sm text-fg-muted shadow-surface`,children:r.diagnosticSignals.length?e.diagnosticsAllClear:e.diagnosticsEmpty})]})})]})]})}export{xe as SetupStatusPanel};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-C5CqLCsX.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.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{p as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./markdown-view-B2IR4E2r.js";import{t as s}from"./copy-to-clipboard-HOJ79TWv.js";import{t as c}from"./messages-BGc-OJWg.js";import{n as l,r as u}from"./locale-store-BkJ7g35d.js";import{t as d}from"./cn-JdwAhgNB.js";import{t as f}from"./skeleton-BwbyijEw.js";import{Fi as p,Ii as m,Kr as h,Ni as g,Qi as _,jo as v,qr as y}from"./index-SxqsTD4i.js";var b=e(t(),1),x=n(),S=/^ {0,3}\[([^\]]+)\]:\s*<?(https?:\/\/[^\s>]+)>?(?:\s+.*)?$/gim,C=/!\[([^\]]*)\]\(\s*<?(https?:\/\/[^\s)>]+)>?(?:\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*\)/gi,w=/!\[([^\]]*)\]\[([^\]]+)\]/g;function T(e,t){let n=new Map;for(let t of e.matchAll(S))n.set(E(t[1]??``),t[2]??``);return e.replace(C,(e,n,r)=>`[${n.trim()||t}](${r})`).replace(w,(e,r,i)=>{let a=n.get(E(i));return a?`[${r.trim()||t}](${a})`:e})}function E(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}var D=r();function O(){return{textContent:null,binaryBuffer:null,extractedText:null,extractedTextTruncated:!1}}function k(e){let t=(0,x.c)(30),{subtitle:n,openInlineUrl:r,landingUrl:i,...a}=e,{expanded:o,setExpanded:l}=h(),u=c(a.language),f;t[0]===u?f=t[1]:(f=async()=>{let e=await s(window.location.href);v(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`,g;t[2]===m?g=t[3]:(g=d(`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]=g);let _;t[4]!==l||t[5]!==a.loadError||t[6]!==a.loading?(_=!a.loading&&!a.loadError?()=>l(A):void 0,t[4]=l,t[5]=a.loadError,t[6]=a.loading,t[7]=_):_=t[7];let b;t[8]===i?b=t[9]:(b=()=>window.location.assign(i),t[8]=i,t[9]=b);let S;t[10]===p?S=t[11]:(S=()=>void p(),t[10]=p,t[11]=S);let C=a.loading||!!a.loadError,w;t[12]!==S||t[13]!==C?(w={onClick:S,disabled:C},t[12]=S,t[13]=C,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]!==_||t[20]!==b||t[21]!==w||t[22]!==T?(E={subtitle:n,expanded:o,onToggleExpanded:_,onClose:b,share:w,openInBrowser:T},t[17]=o,t[18]=n,t[19]=_,t[20]=b,t[21]=w,t[22]=T,t[23]=E):E=t[23];let O;t[24]!==a||t[25]!==E?(O=(0,D.jsx)(y,{...a,header:E}),t[24]=a,t[25]=E,t[26]=O):O=t[26];let k;return t[27]!==O||t[28]!==g?(k=(0,D.jsx)(`div`,{className:g,children:O}),t[27]=O,t[28]=g,t[29]=k):k=t[29],k}function A(e){return!e}function j(){let{token:e}=a(),t=l(e=>e.language),n=t===`zh`?P:F,[r,s]=(0,b.useState)(null),[c,d]=(0,b.useState)(O),[h,v]=(0,b.useState)(!0),[y,x]=(0,b.useState)(null),[S,C]=(0,b.useState)(null),[w,E]=(0,b.useState)(null),A=(0,b.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:g(r.fileName,t),source:{kind:`share`,token:e}}},[r,e]);(0,b.useEffect)(()=>{if(!e){x(n.invalidLink),v(!1);return}let t=!1;return(async()=>{try{v(!0),x(null),d(O()),C(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`&&C(i.payload),!t&&i.payload?.kind===`session`&&E(i.payload);return}if(a.kind!==`file`)return;let o=p(a.fileName,a.mimeType),c=g(a.fileName,o),l=m(c),f=u(`/s/${encodeURIComponent(e)}?inline=1`);if(l===`text`){if(a.fileSize>5242880){x(n.tooLarge);return}let e=await fetch(f);if(!e.ok){x(n.expired);return}let r=await e.text();t||d({...O(),textContent:r});return}if(l===`binary`){if(a.fileSize>33554432){x(n.tooLarge);return}let e=await fetch(f);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-C5CqLCsX.js`);return{processPptx:e}},__vite__mapDeps([0,1,2])),{extractedText:t}=await e(r,a.fileName),n=t.length>_;d({textContent:null,binaryBuffer:r,extractedText:n?t.slice(0,_):t,extractedTextTruncated:n});return}d({...O(),binaryBuffer:r})}}catch(e){t||x(e instanceof Error?e.message:String(e))}finally{t||v(!1)}})(),()=>{t=!0}},[e,n.expired,n.invalidLink,n.notFound,n.tooLarge]);let j=e?u(`/s/${encodeURIComponent(e)}?dl=1`):`#`,I=e?u(`/s/${encodeURIComponent(e)}?inline=1`):`#`;return A&&r&&e?(0,D.jsx)(k,{language:t,descriptor:A,loading:h,loadError:y,textContent:c.textContent,binaryBuffer:c.binaryBuffer,extractedText:c.extractedText,extractedTextTruncated:c.extractedTextTruncated,subtitle:(0,D.jsxs)(`span`,{className:`truncate`,children:[N(r.fileSize),` · `,n.expiresAt,` `,new Date(r.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),openInlineUrl:I,landingUrl:u(`/s/${encodeURIComponent(e)}`),actions:{onDownload:()=>{window.location.href=j},canDownload:!h&&!y}}):(0,D.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-surface-base`,children:[(0,D.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-edge px-4`,children:[(0,D.jsx)(`span`,{className:`text-lg`,"aria-hidden":!0,children:`#`}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,D.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,title:r.fileName,children:r.fileName}):h?(0,D.jsx)(f,{className:`h-4 w-48 max-w-full`}):(0,D.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:n.error}),r?(0,D.jsxs)(`div`,{className:`truncate text-xs text-fg-muted`,children:[N(r.fileSize),` · `,n.expiresAt,` `,new Date(r.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}):null]})]}),(0,D.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:h?(0,D.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,D.jsx)(f,{className:`h-5 w-56 max-w-full`}),(0,D.jsxs)(`div`,{className:`mt-5 grid gap-3`,children:[(0,D.jsx)(f,{className:`h-4 w-full`}),(0,D.jsx)(f,{className:`h-4 w-11/12`}),(0,D.jsx)(f,{className:`h-4 w-10/12`}),(0,D.jsx)(f,{className:`h-4 w-3/4`})]}),(0,D.jsx)(f,{className:`mt-6 min-h-0 flex-1 rounded-lg`})]}):y?(0,D.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg`,children:[(0,D.jsx)(`p`,{className:`font-medium`,children:n.error}),(0,D.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:y})]}):r?.kind===`directory`?(0,D.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg-muted`,children:n.directoryHint}):r?.kind===`note`&&S?(0,D.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,D.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-fg`,children:S.title}),(0,D.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.sharedAt,` `,new Date(S.snapshotAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`),` · `,n.expiresAt,` `,new Date(S.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),S.description?(0,D.jsx)(`p`,{className:`mt-5 rounded-lg bg-surface-subtle px-4 py-3 text-sm leading-6 text-fg-muted`,children:S.description}):null,(0,D.jsx)(o,{content:T(S.markdown,n.remoteImageBlocked),className:`mt-8`}),(0,D.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`&&w?(0,D.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,D.jsxs)(`header`,{className:`mx-auto max-w-3xl border-b border-edge-subtle pb-5`,children:[(0,D.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight text-fg sm:text-3xl`,children:w.title}),(0,D.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.sharedAt,` `,new Date(w.snapshotAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`),` · `,n.expiresAt,` `,new Date(w.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),w.description?(0,D.jsx)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:w.description}):null]}),(0,D.jsxs)(`div`,{className:`mx-auto mt-6 max-w-3xl space-y-5`,children:[w.messages.map(e=>(0,D.jsxs)(`section`,{className:e.role===`user`?`ml-auto max-w-[85%]`:`mr-auto max-w-full`,children:[(0,D.jsx)(`div`,{className:`mb-1 text-xs font-medium text-fg-subtle`,children:e.role===`user`?n.you:n.assistant}),(0,D.jsxs)(`div`,{className:e.role===`user`?`rounded-2xl bg-surface-subtle px-4 py-3`:`px-1 py-1`,children:[(0,D.jsx)(o,{content:T(e.markdown,n.remoteImageBlocked)}),w.attachments.filter(t=>e.attachmentIds.includes(t.id)).map(e=>(0,D.jsx)(M,{attachment:e},e.id)),w.toolActivities.filter(t=>t.messageId===e.id).map(e=>(0,D.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,D.jsx)(`span`,{children:e.toolName}),(0,D.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,D.jsx)(`span`,{children:e.status===`completed`?n.toolCompleted:n.toolFailed})]},e.id))]})]},e.id)),w.toolActivities.filter(e=>!e.messageId).map(e=>(0,D.jsxs)(`div`,{className:`text-center text-xs text-fg-muted`,children:[e.toolName,` · `,e.status===`completed`?n.toolCompleted:n.toolFailed]},e.id))]}),(0,D.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 M(e){let t=(0,x.c)(15),{attachment:n}=e;if(n.mimeType.startsWith(`image/`)){let e;return t[0]!==n.fileName||t[1]!==n.url?(e=(0,D.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,D.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,D.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=N(n.size),t[7]=n.size,t[8]=a);let o;t[9]===a?o=t[10]:(o=(0,D.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,D.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 N(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 P={error:`加载失败`,expired:`链接已失效`,notFound:`链接不存在`,invalidLink:`链接无效`,expiresAt:`有效期至`,directoryHint:`目录分享请使用主页面浏览。`,tooLarge:`文件过大,无法在线预览,请下载查看。`,sharedAt:`分享于`,sharedVia:`通过 xopc 分享`,you:`你`,assistant:`助手`,toolCompleted:`已完成`,toolFailed:`失败`,remoteImageBlocked:`远程图片(点击打开)`},F={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{j as SharePreviewPage};
|
|
@@ -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{h as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a,n as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{t as d}from"./check-DUBLcKHA.js";import{n as f,r as p}from"./popover-select-Dz_Qis2R.js";import{t as m}from"./copy-Dv6d4Dvw.js";import{t as h}from"./loader-circle-CifKLtgG.js";import{t as g}from"./message-square-fVE7Ghj1.js";import{t as _}from"./plus-Q2yW6OE7.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./copy-to-clipboard-HOJ79TWv.js";import{t as b}from"./messages-BGc-OJWg.js";import{a as x,c as S,n as C,r as w}from"./locale-store-BkJ7g35d.js";import{t as T}from"./cn-JdwAhgNB.js";import{i as ee}from"./vendor-swr-BIWyz7Rc.js";import{t as E}from"./button-B11EPpor.js";import{n as D,r as O}from"./gateway-config-swr-cd8owslz.js";import{t as k}from"./skeleton-BwbyijEw.js";import{Ci as A,Di as j,Ei as M,Gi as N,Hs as P,Nl as F,Oi as I,Ol as L,Si as te,So as R,Ti as z,Ui as B,Xl as V,Yi as H,Yl as U,Ys as W,_i as G,an as ne,bi as re,cn as ie,fi as ae,gi as oe,hi as se,ki as ce,mi as le,ui as ue,uu as de,vc as fe,wi as pe,yi as me,yl as he,yt as ge}from"./index-SxqsTD4i.js";import{n as _e,r as ve,t as ye}from"./settings-page-layout-DYelDcMV.js";import{t as K}from"./settings-form-section-CIA1AA-A.js";import{t as be}from"./settings-loading-skeleton-CAmWMaOT.js";import{t as q}from"./page-tabs-CRombigq.js";var J=e(t(),1),xe=n(),Y={enabled:!0,defaultTtlHours:24,maxTtlDays:30,maxActiveShares:500,maxFileSizeMb:500,directoryMaxFolderSizeMb:2048,directoryMaxFileCount:1e4,inlinePreviewMimes:[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`application/pdf`,`text/html`,`text/markdown`,`text/plain`,`application/json`],noteEnabled:!0,noteMaxTotalSizeMb:250,noteMaxAttachmentCount:50,siteEnabled:!0,siteDefaultTtlHours:24,siteMaxTtlDays:30,maxActiveSites:50,siteMaxRootDirSizeMb:1024,siteMaxFileCount:2e4};function Se(){return structuredClone(Y)}var X=36e5,Z=864e5,Q=1048576;function Ce(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function we(e,t=32){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function Te(e){let t=Ce(e)?e:{},n=Ce(t.gateway)?t.gateway:{},r=Ce(n.share)?n.share:{},i=Ce(r.directory)?r.directory:{},a=Ce(r.note)?r.note:{},o=Ce(n.siteShare)?n.siteShare:{},s=Ce(o.static)?o.static:{},c=typeof r.defaultTtlMs==`number`&&Number.isFinite(r.defaultTtlMs)?Math.floor(r.defaultTtlMs):Y.defaultTtlHours*X,l=typeof r.maxTtlMs==`number`&&Number.isFinite(r.maxTtlMs)?Math.floor(r.maxTtlMs):Y.maxTtlDays*Z,u=typeof r.maxFileSize==`number`&&Number.isFinite(r.maxFileSize)?Math.floor(r.maxFileSize):Y.maxFileSizeMb*Q,d=typeof i.maxFolderSize==`number`&&Number.isFinite(i.maxFolderSize)?Math.floor(i.maxFolderSize):Y.directoryMaxFolderSizeMb*Q,f=typeof o.defaultTtlMs==`number`&&Number.isFinite(o.defaultTtlMs)?Math.floor(o.defaultTtlMs):Y.siteDefaultTtlHours*X,p=typeof o.maxTtlMs==`number`&&Number.isFinite(o.maxTtlMs)?Math.floor(o.maxTtlMs):Y.siteMaxTtlDays*Z,m=typeof s.maxRootDirSize==`number`&&Number.isFinite(s.maxRootDirSize)?Math.floor(s.maxRootDirSize):Y.siteMaxRootDirSizeMb*Q,h=typeof a.maxTotalSize==`number`&&Number.isFinite(a.maxTotalSize)?Math.floor(a.maxTotalSize):Y.noteMaxTotalSizeMb*Q;return{enabled:r.enabled!==!1,defaultTtlHours:Math.max(1,Math.round(c/X)),maxTtlDays:Math.max(1,Math.round(l/Z)),maxActiveShares:typeof r.maxActiveShares==`number`&&Number.isFinite(r.maxActiveShares)?Math.max(1,Math.min(1e4,Math.floor(r.maxActiveShares))):Y.maxActiveShares,maxFileSizeMb:Math.max(1,Math.round(u/Q)),directoryMaxFolderSizeMb:Math.max(1,Math.round(d/Q)),directoryMaxFileCount:typeof i.maxFileCount==`number`&&Number.isFinite(i.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(i.maxFileCount))):Y.directoryMaxFileCount,inlinePreviewMimes:we(r.inlinePreviewMimes,32).length?we(r.inlinePreviewMimes,32):[...Y.inlinePreviewMimes],noteEnabled:a.enabled!==!1,noteMaxTotalSizeMb:Math.max(1,Math.round(h/Q)),noteMaxAttachmentCount:typeof a.maxAttachmentCount==`number`&&Number.isFinite(a.maxAttachmentCount)?Math.max(0,Math.min(500,Math.floor(a.maxAttachmentCount))):Y.noteMaxAttachmentCount,siteEnabled:o.enabled!==!1,siteDefaultTtlHours:Math.max(1,Math.round(f/X)),siteMaxTtlDays:Math.max(1,Math.round(p/Z)),maxActiveSites:typeof o.maxActiveSites==`number`&&Number.isFinite(o.maxActiveSites)?Math.max(1,Math.min(1e3,Math.floor(o.maxActiveSites))):Y.maxActiveSites,siteMaxRootDirSizeMb:Math.max(1,Math.round(m/Q)),siteMaxFileCount:typeof s.maxFileCount==`number`&&Number.isFinite(s.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(s.maxFileCount))):Y.siteMaxFileCount}}function Ee(e){let t=e.defaultTtlHours*X,n=e.maxTtlDays*Z,r=e.siteDefaultTtlHours*X,i=e.siteMaxTtlDays*Z;return t<6e4||t>6048e5?`Default share TTL must be between 1 minute and 7 days.`:n<6e4||n>2592e6?`Maximum share TTL must be between 1 minute and 30 days.`:t>n?`Default TTL cannot exceed maximum TTL.`:e.maxActiveShares<1||e.maxActiveShares>1e4?`Maximum active shares must be between 1 and 10,000.`:e.maxActiveSites<1||e.maxActiveSites>1e3?`Maximum active site shares must be between 1 and 1,000.`:e.maxFileSizeMb<1||e.maxFileSizeMb>10240?`Maximum file size must be between 1 MB and 10 GB.`:e.directoryMaxFolderSizeMb<1||e.directoryMaxFolderSizeMb>10240?`Maximum folder size must be between 1 MB and 10 GB.`:e.directoryMaxFileCount<1||e.directoryMaxFileCount>1e5?`Maximum directory file count must be between 1 and 100,000.`:e.noteMaxTotalSizeMb<1||e.noteMaxTotalSizeMb>2048?`Maximum Note snapshot size must be between 1 MB and 2 GB.`:e.noteMaxAttachmentCount<0||e.noteMaxAttachmentCount>500?`Maximum Note attachment count must be between 0 and 500.`:r<6e4||r>6048e5?`Default site share TTL must be between 1 minute and 7 days.`:i<6e4||i>2592e6?`Maximum site share TTL must be between 1 minute and 30 days.`:r>i?`Default site TTL cannot exceed maximum site TTL.`:e.siteMaxRootDirSizeMb<1||e.siteMaxRootDirSizeMb>10240?`Maximum static site size must be between 1 MB and 10 GB.`:e.siteMaxFileCount<1||e.siteMaxFileCount>1e5?`Maximum static site file count must be between 1 and 100,000.`:null}async function De(e){let t=Ee(e);if(t)throw Error(t);await x(w(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{share:{enabled:e.enabled,defaultTtlMs:e.defaultTtlHours*X,maxTtlMs:e.maxTtlDays*Z,maxActiveShares:e.maxActiveShares,maxFileSize:e.maxFileSizeMb*Q,inlinePreviewMimes:e.inlinePreviewMimes,directory:{maxFolderSize:e.directoryMaxFolderSizeMb*Q,maxFileCount:e.directoryMaxFileCount},note:{enabled:e.noteEnabled,maxTotalSize:e.noteMaxTotalSizeMb*Q,maxAttachmentCount:e.noteMaxAttachmentCount}},siteShare:{enabled:e.siteEnabled,defaultTtlMs:e.siteDefaultTtlHours*X,maxTtlMs:e.siteMaxTtlDays*Z,maxActiveSites:e.maxActiveSites,static:{maxRootDirSize:e.siteMaxRootDirSizeMb*Q,maxFileCount:e.siteMaxFileCount}}}})}),D()}var $=r();function Oe(){return T(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,R,`dark:border-edge`)}function ke({hasToken:e}){let t=b(C(e=>e.language)).sharesSettings,{data:n,isLoading:r}=O(e),i=(0,J.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(Te(n.payload.config)),[n]),a=(0,J.useRef)(!1),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(!1),m=o??i,h=i,g=(0,J.useMemo)(()=>!m||!h?!1:JSON.stringify(m)!==JSON.stringify(h),[m,h]),_=(0,J.useCallback)(e=>{a.current=!0,s(t=>{let n=t??h;return n?{...n,...e}:null})},[h]),v=(0,J.useCallback)(async()=>{if(!(!m||c)){l(!0),d(null),p(!1);try{await De(m),a.current=!1,s(null),p(!0),window.setTimeout(()=>p(!1),2500)}catch(e){d(e instanceof Error?e.message:t.policySaveError)}finally{l(!1)}}},[m,c,t.policySaveError]),y=(0,J.useCallback)(()=>{a.current=!1,s(null),d(null),p(!1)},[]);return!e||!m?r?(0,$.jsx)(K,{children:(0,$.jsx)(be,{rows:2})}):null:(0,$.jsxs)(K,{children:[(0,$.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.policyTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.policyHint})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[f?(0,$.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.policySaved}):null,(0,$.jsx)(E,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>_(Se()),children:t.policyUseRecommended}),(0,$.jsx)(E,{type:`button`,variant:`secondary`,disabled:!g||c,onClick:y,children:t.policyDiscard}),(0,$.jsx)(E,{type:`button`,variant:`primary`,disabled:!g||c,onClick:()=>void v(),children:c?t.policySaving:t.policySave})]})]}),g?(0,$.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:t.policyUnsaved}):null,u?(0,$.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:u}):null,(0,$.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:t.policyRestartHint}),(0,$.jsx)(Ae,{t,form:m,onChange:_})]})}function Ae(e){let t=(0,xe.c)(189),{t:n,form:r,onChange:i}=e,a;t[0]===n.policyFileSection?a=t[1]:(a=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyFileSection}),t[0]=n.policyFileSection,t[1]=a);let o;t[2]===n.policyFileSectionHint?o=t[3]:(o=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyFileSectionHint}),t[2]=n.policyFileSectionHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,$.jsxs)(`div`,{className:`mb-4`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.policyEnabled||t[13]!==l?(u=(0,$.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.policyEnabled]}),t[12]=n.policyEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({defaultTtlHours:e}),t[15]=i,t[16]=f);let p;t[17]!==r.defaultTtlHours||t[18]!==n.policyDefaultTtlHint||t[19]!==n.policyDefaultTtlHours||t[20]!==d||t[21]!==f?(p=(0,$.jsx)(je,{id:`share-default-ttl-hours`,label:n.policyDefaultTtlHours,hint:n.policyDefaultTtlHint,value:r.defaultTtlHours,min:1,max:168,disabled:d,onChange:f}),t[17]=r.defaultTtlHours,t[18]=n.policyDefaultTtlHint,t[19]=n.policyDefaultTtlHours,t[20]=d,t[21]=f,t[22]=p):p=t[22];let m=!r.enabled,h;t[23]===i?h=t[24]:(h=e=>i({maxTtlDays:e}),t[23]=i,t[24]=h);let g;t[25]!==r.maxTtlDays||t[26]!==n.policyMaxTtlDays||t[27]!==n.policyMaxTtlHint||t[28]!==m||t[29]!==h?(g=(0,$.jsx)(je,{id:`share-max-ttl-days`,label:n.policyMaxTtlDays,hint:n.policyMaxTtlHint,value:r.maxTtlDays,min:1,max:30,disabled:m,onChange:h}),t[25]=r.maxTtlDays,t[26]=n.policyMaxTtlDays,t[27]=n.policyMaxTtlHint,t[28]=m,t[29]=h,t[30]=g):g=t[30];let _=!r.enabled,v;t[31]===i?v=t[32]:(v=e=>i({maxActiveShares:e}),t[31]=i,t[32]=v);let y;t[33]!==r.maxActiveShares||t[34]!==n.policyMaxActiveShares||t[35]!==n.policyMaxActiveSharesHint||t[36]!==_||t[37]!==v?(y=(0,$.jsx)(je,{id:`share-max-active`,label:n.policyMaxActiveShares,hint:n.policyMaxActiveSharesHint,value:r.maxActiveShares,min:1,max:1e4,disabled:_,onChange:v}),t[33]=r.maxActiveShares,t[34]=n.policyMaxActiveShares,t[35]=n.policyMaxActiveSharesHint,t[36]=_,t[37]=v,t[38]=y):y=t[38];let b=!r.enabled,x;t[39]===i?x=t[40]:(x=e=>i({maxFileSizeMb:e}),t[39]=i,t[40]=x);let S;t[41]!==r.maxFileSizeMb||t[42]!==n.policyMaxFileSizeHint||t[43]!==n.policyMaxFileSizeMb||t[44]!==b||t[45]!==x?(S=(0,$.jsx)(je,{id:`share-max-file-mb`,label:n.policyMaxFileSizeMb,hint:n.policyMaxFileSizeHint,value:r.maxFileSizeMb,min:1,max:10240,disabled:b,onChange:x}),t[41]=r.maxFileSizeMb,t[42]=n.policyMaxFileSizeHint,t[43]=n.policyMaxFileSizeMb,t[44]=b,t[45]=x,t[46]=S):S=t[46];let C=!r.enabled,w;t[47]===i?w=t[48]:(w=e=>i({directoryMaxFolderSizeMb:e}),t[47]=i,t[48]=w);let T;t[49]!==r.directoryMaxFolderSizeMb||t[50]!==n.policyDirectoryMaxFolderSizeHint||t[51]!==n.policyDirectoryMaxFolderSizeMb||t[52]!==C||t[53]!==w?(T=(0,$.jsx)(je,{id:`share-directory-max-size-mb`,label:n.policyDirectoryMaxFolderSizeMb,hint:n.policyDirectoryMaxFolderSizeHint,value:r.directoryMaxFolderSizeMb,min:1,max:10240,disabled:C,onChange:w}),t[49]=r.directoryMaxFolderSizeMb,t[50]=n.policyDirectoryMaxFolderSizeHint,t[51]=n.policyDirectoryMaxFolderSizeMb,t[52]=C,t[53]=w,t[54]=T):T=t[54];let ee=!r.enabled,E;t[55]===i?E=t[56]:(E=e=>i({directoryMaxFileCount:e}),t[55]=i,t[56]=E);let D;t[57]!==r.directoryMaxFileCount||t[58]!==n.policyDirectoryMaxFileCount||t[59]!==n.policyDirectoryMaxFileCountHint||t[60]!==ee||t[61]!==E?(D=(0,$.jsx)(je,{id:`share-directory-max-files`,label:n.policyDirectoryMaxFileCount,hint:n.policyDirectoryMaxFileCountHint,value:r.directoryMaxFileCount,min:1,max:1e5,disabled:ee,onChange:E}),t[57]=r.directoryMaxFileCount,t[58]=n.policyDirectoryMaxFileCount,t[59]=n.policyDirectoryMaxFileCountHint,t[60]=ee,t[61]=E,t[62]=D):D=t[62];let O;t[63]!==g||t[64]!==y||t[65]!==S||t[66]!==T||t[67]!==D||t[68]!==p?(O=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[p,g,y,S,T,D]}),t[63]=g,t[64]=y,t[65]=S,t[66]=T,t[67]=D,t[68]=p,t[69]=O):O=t[69];let k=!r.enabled,A;t[70]===i?A=t[71]:(A=e=>i({inlinePreviewMimes:e}),t[70]=i,t[71]=A);let j;t[72]!==r.inlinePreviewMimes||t[73]!==n||t[74]!==k||t[75]!==A?(j=(0,$.jsx)(Me,{t:n,values:r.inlinePreviewMimes,disabled:k,onChange:A}),t[72]=r.inlinePreviewMimes,t[73]=n,t[74]=k,t[75]=A,t[76]=j):j=t[76];let M;t[77]!==O||t[78]!==j||t[79]!==s||t[80]!==u?(M=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[s,u,O,j]}),t[77]=O,t[78]=j,t[79]=s,t[80]=u,t[81]=M):M=t[81];let N;t[82]===n.policyNoteSection?N=t[83]:(N=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyNoteSection}),t[82]=n.policyNoteSection,t[83]=N);let P;t[84]===n.policyNoteSectionHint?P=t[85]:(P=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyNoteSectionHint}),t[84]=n.policyNoteSectionHint,t[85]=P);let F;t[86]!==N||t[87]!==P?(F=(0,$.jsxs)(`div`,{className:`mb-4`,children:[N,P]}),t[86]=N,t[87]=P,t[88]=F):F=t[88];let I;t[89]===i?I=t[90]:(I=e=>i({noteEnabled:e.target.checked}),t[89]=i,t[90]=I);let L;t[91]!==r.noteEnabled||t[92]!==I?(L=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.noteEnabled,onChange:I}),t[91]=r.noteEnabled,t[92]=I,t[93]=L):L=t[93];let te;t[94]!==n.policyNoteEnabled||t[95]!==L?(te=(0,$.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[L,n.policyNoteEnabled]}),t[94]=n.policyNoteEnabled,t[95]=L,t[96]=te):te=t[96];let R=!r.enabled||!r.noteEnabled,z;t[97]===i?z=t[98]:(z=e=>i({noteMaxTotalSizeMb:e}),t[97]=i,t[98]=z);let B;t[99]!==r.noteMaxTotalSizeMb||t[100]!==n.policyNoteMaxTotalSizeHint||t[101]!==n.policyNoteMaxTotalSizeMb||t[102]!==R||t[103]!==z?(B=(0,$.jsx)(je,{id:`share-note-max-size-mb`,label:n.policyNoteMaxTotalSizeMb,hint:n.policyNoteMaxTotalSizeHint,value:r.noteMaxTotalSizeMb,min:1,max:2048,disabled:R,onChange:z}),t[99]=r.noteMaxTotalSizeMb,t[100]=n.policyNoteMaxTotalSizeHint,t[101]=n.policyNoteMaxTotalSizeMb,t[102]=R,t[103]=z,t[104]=B):B=t[104];let V=!r.enabled||!r.noteEnabled,H;t[105]===i?H=t[106]:(H=e=>i({noteMaxAttachmentCount:e}),t[105]=i,t[106]=H);let U;t[107]!==r.noteMaxAttachmentCount||t[108]!==n.policyNoteMaxAttachmentCount||t[109]!==n.policyNoteMaxAttachmentCountHint||t[110]!==V||t[111]!==H?(U=(0,$.jsx)(je,{id:`share-note-max-attachments`,label:n.policyNoteMaxAttachmentCount,hint:n.policyNoteMaxAttachmentCountHint,value:r.noteMaxAttachmentCount,min:0,max:500,disabled:V,onChange:H}),t[107]=r.noteMaxAttachmentCount,t[108]=n.policyNoteMaxAttachmentCount,t[109]=n.policyNoteMaxAttachmentCountHint,t[110]=V,t[111]=H,t[112]=U):U=t[112];let W;t[113]!==B||t[114]!==U?(W=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[B,U]}),t[113]=B,t[114]=U,t[115]=W):W=t[115];let G;t[116]!==F||t[117]!==te||t[118]!==W?(G=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[F,te,W]}),t[116]=F,t[117]=te,t[118]=W,t[119]=G):G=t[119];let ne;t[120]===n.policySiteSection?ne=t[121]:(ne=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policySiteSection}),t[120]=n.policySiteSection,t[121]=ne);let re;t[122]===n.policySiteSectionHint?re=t[123]:(re=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policySiteSectionHint}),t[122]=n.policySiteSectionHint,t[123]=re);let ie;t[124]!==ne||t[125]!==re?(ie=(0,$.jsxs)(`div`,{className:`mb-4`,children:[ne,re]}),t[124]=ne,t[125]=re,t[126]=ie):ie=t[126];let ae;t[127]===i?ae=t[128]:(ae=e=>i({siteEnabled:e.target.checked}),t[127]=i,t[128]=ae);let oe;t[129]!==r.siteEnabled||t[130]!==ae?(oe=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.siteEnabled,onChange:ae}),t[129]=r.siteEnabled,t[130]=ae,t[131]=oe):oe=t[131];let se;t[132]!==n.policySiteEnabled||t[133]!==oe?(se=(0,$.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[oe,n.policySiteEnabled]}),t[132]=n.policySiteEnabled,t[133]=oe,t[134]=se):se=t[134];let ce=!r.siteEnabled,le;t[135]===i?le=t[136]:(le=e=>i({siteDefaultTtlHours:e}),t[135]=i,t[136]=le);let ue;t[137]!==r.siteDefaultTtlHours||t[138]!==n.policySiteDefaultTtlHint||t[139]!==n.policySiteDefaultTtlHours||t[140]!==ce||t[141]!==le?(ue=(0,$.jsx)(je,{id:`site-share-default-ttl-hours`,label:n.policySiteDefaultTtlHours,hint:n.policySiteDefaultTtlHint,value:r.siteDefaultTtlHours,min:1,max:168,disabled:ce,onChange:le}),t[137]=r.siteDefaultTtlHours,t[138]=n.policySiteDefaultTtlHint,t[139]=n.policySiteDefaultTtlHours,t[140]=ce,t[141]=le,t[142]=ue):ue=t[142];let de=!r.siteEnabled,fe;t[143]===i?fe=t[144]:(fe=e=>i({siteMaxTtlDays:e}),t[143]=i,t[144]=fe);let pe;t[145]!==r.siteMaxTtlDays||t[146]!==n.policySiteMaxTtlDays||t[147]!==n.policySiteMaxTtlHint||t[148]!==de||t[149]!==fe?(pe=(0,$.jsx)(je,{id:`site-share-max-ttl-days`,label:n.policySiteMaxTtlDays,hint:n.policySiteMaxTtlHint,value:r.siteMaxTtlDays,min:1,max:30,disabled:de,onChange:fe}),t[145]=r.siteMaxTtlDays,t[146]=n.policySiteMaxTtlDays,t[147]=n.policySiteMaxTtlHint,t[148]=de,t[149]=fe,t[150]=pe):pe=t[150];let me=!r.siteEnabled,he;t[151]===i?he=t[152]:(he=e=>i({maxActiveSites:e}),t[151]=i,t[152]=he);let ge;t[153]!==r.maxActiveSites||t[154]!==n.policyMaxActiveSites||t[155]!==n.policyMaxActiveSitesHint||t[156]!==me||t[157]!==he?(ge=(0,$.jsx)(je,{id:`site-share-max-active`,label:n.policyMaxActiveSites,hint:n.policyMaxActiveSitesHint,value:r.maxActiveSites,min:1,max:1e3,disabled:me,onChange:he}),t[153]=r.maxActiveSites,t[154]=n.policyMaxActiveSites,t[155]=n.policyMaxActiveSitesHint,t[156]=me,t[157]=he,t[158]=ge):ge=t[158];let _e=!r.siteEnabled,ve;t[159]===i?ve=t[160]:(ve=e=>i({siteMaxRootDirSizeMb:e}),t[159]=i,t[160]=ve);let ye;t[161]!==r.siteMaxRootDirSizeMb||t[162]!==n.policySiteMaxRootDirSizeHint||t[163]!==n.policySiteMaxRootDirSizeMb||t[164]!==_e||t[165]!==ve?(ye=(0,$.jsx)(je,{id:`site-share-max-root-size-mb`,label:n.policySiteMaxRootDirSizeMb,hint:n.policySiteMaxRootDirSizeHint,value:r.siteMaxRootDirSizeMb,min:1,max:10240,disabled:_e,onChange:ve}),t[161]=r.siteMaxRootDirSizeMb,t[162]=n.policySiteMaxRootDirSizeHint,t[163]=n.policySiteMaxRootDirSizeMb,t[164]=_e,t[165]=ve,t[166]=ye):ye=t[166];let K=!r.siteEnabled,be;t[167]===i?be=t[168]:(be=e=>i({siteMaxFileCount:e}),t[167]=i,t[168]=be);let q;t[169]!==r.siteMaxFileCount||t[170]!==n.policySiteMaxFileCount||t[171]!==n.policySiteMaxFileCountHint||t[172]!==K||t[173]!==be?(q=(0,$.jsx)(je,{id:`site-share-max-files`,label:n.policySiteMaxFileCount,hint:n.policySiteMaxFileCountHint,value:r.siteMaxFileCount,min:1,max:1e5,disabled:K,onChange:be}),t[169]=r.siteMaxFileCount,t[170]=n.policySiteMaxFileCount,t[171]=n.policySiteMaxFileCountHint,t[172]=K,t[173]=be,t[174]=q):q=t[174];let J;t[175]!==ue||t[176]!==pe||t[177]!==ge||t[178]!==ye||t[179]!==q?(J=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ue,pe,ge,ye,q]}),t[175]=ue,t[176]=pe,t[177]=ge,t[178]=ye,t[179]=q,t[180]=J):J=t[180];let Y;t[181]!==ie||t[182]!==se||t[183]!==J?(Y=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[ie,se,J]}),t[181]=ie,t[182]=se,t[183]=J,t[184]=Y):Y=t[184];let Se;return t[185]!==M||t[186]!==G||t[187]!==Y?(Se=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[M,G,Y]}),t[185]=M,t[186]=G,t[187]=Y,t[188]=Se):Se=t[188],Se}function je(e){let t=(0,xe.c)(21),{id:n,label:r,hint:i,value:a,min:o,max:s,disabled:c,onChange:l}=e,u;t[0]!==n||t[1]!==r?(u=(0,$.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=u):u=t[2];let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=T(Oe(),`max-w-xs font-mono text-xs`),t[3]=d):d=t[3];let f;t[4]!==s||t[5]!==o||t[6]!==l?(f=e=>{let t=Number(e.target.value);Number.isFinite(t)&&l(Math.max(o,Math.min(s,Math.floor(t))))},t[4]=s,t[5]=o,t[6]=l,t[7]=f):f=t[7];let p;t[8]!==c||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==f||t[13]!==a?(p=(0,$.jsx)(`input`,{id:n,type:`number`,min:o,max:s,disabled:c,className:d,value:a,onChange:f}),t[8]=c,t[9]=n,t[10]=s,t[11]=o,t[12]=f,t[13]=a,t[14]=p):p=t[14];let m;t[15]===i?m=t[16]:(m=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[15]=i,t[16]=m);let h;return t[17]!==u||t[18]!==p||t[19]!==m?(h=(0,$.jsxs)(`div`,{children:[u,p,m]}),t[17]=u,t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function Me(e){let t=(0,xe.c)(25),{t:n,values:r,disabled:i,onChange:a}=e,o;t[0]!==a||t[1]!==r?(o=e=>{let t=e.trim();!t||r.includes(t)||r.length>=32||a([...r,t])},t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]===n.policyInlinePreviewMimes?c=t[4]:(c=(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.policyInlinePreviewMimes}),t[3]=n.policyInlinePreviewMimes,t[4]=c);let l;t[5]===n.policyInlinePreviewMimesHint?l=t[6]:(l=(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.policyInlinePreviewMimesHint}),t[5]=n.policyInlinePreviewMimesHint,t[6]=l);let u;t[7]!==i||t[8]!==a||t[9]!==r?(u=r.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,i?null:(0,$.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,"aria-label":`Remove ${e}`,onClick:()=>a(r.filter(t=>t!==e)),children:`×`})]},e)),t[7]=i,t[8]=a,t[9]=r,t[10]=u):u=t[10];let d;t[11]===u?d=t[12]:(d=(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u}),t[11]=u,t[12]=d);let f;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(f=T(Oe(),`font-mono text-xs`),t[13]=f):f=t[13];let p=i||r.length>=32,m;t[14]===s?m=t[15]:(m=e=>{e.key===`Enter`&&(e.preventDefault(),s(e.target.value),e.target.value=``)},t[14]=s,t[15]=m);let h;t[16]!==n.policyMimePlaceholder||t[17]!==p||t[18]!==m?(h=(0,$.jsx)(`input`,{className:f,placeholder:n.policyMimePlaceholder,disabled:p,onKeyDown:m}),t[16]=n.policyMimePlaceholder,t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;return t[20]!==c||t[21]!==l||t[22]!==d||t[23]!==h?(g=(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-4`,children:[c,l,d,h]}),t[20]=c,t[21]=l,t[22]=d,t[23]=h,t[24]=g):g=t[24],g}function Ne(e){let t=(0,xe.c)(70),{open:n,onOpenChange:r,onConfirm:i,initialPath:d,selectKind:m,sessionKey:g,agentId:_}=e,y=m===void 0?`any`:m,x=b(C(Ie)),w=x.workspace,D=x.sharesSettings,O=ue(Fe),{data:k}=ee(S(Pe)?`picker-agents-list`:null,ie),A;bb0:{let e;t[0]===_?e=t[1]:(e=_?.trim(),t[0]=_,t[1]=e);let n=e;if(n){A=n;break bb0}let r;t[2]===O?r=t[3]:(r=O.trim(),t[2]=O,t[3]=r);let i=r;if(i){A=i;break bb0}if(k?.defaultId){A=k.defaultId;break bb0}if(k?.agents?.[0]?.id){A=k.agents[0].id;break bb0}A=``}let j=A,[M,N]=(0,J.useState)(j),P,F;t[4]===j?(P=t[5],F=t[6]):(P=()=>{N(j)},F=[j],t[4]=j,t[5]=P,t[6]=F),(0,J.useEffect)(P,F);let{tree:I,loading:te,error:R,loadRoot:z,loadChildren:V,reset:H}=ae(M,g??null),U;t[7]===d?U=t[8]:(U=d?{path:d,isDirectory:!1}:null,t[7]=d,t[8]=U);let[W,G]=(0,J.useState)(U),re;t[9]!==d||t[10]!==z||t[11]!==n||t[12]!==H||t[13]!==G?(re=()=>{if(!n){H(),G(d?{path:d,isDirectory:!1}:null);return}z()},t[9]=d,t[10]=z,t[11]=n,t[12]=H,t[13]=G,t[14]=re):re=t[14];let oe;t[15]!==d||t[16]!==z||t[17]!==n||t[18]!==M||t[19]!==H||t[20]!==g?(oe=[n,M,g,z,H,d],t[15]=d,t[16]=z,t[17]=n,t[18]=M,t[19]=H,t[20]=g,t[21]=oe):oe=t[21],(0,J.useEffect)(re,oe);let se;t[22]===V?se=t[23]:(se=e=>{V(e)},t[22]=V,t[23]=se);let ce=se,le=W!==null&&(y===`any`||y===`file`&&!W.isDirectory||y===`directory`&&W.isDirectory),de;bb1:{if(!W){de=D.pickerHintNone;break bb1}if(y===`file`&&W.isDirectory){de=D.pickerHintNeedsFile;break bb1}if(y===`directory`&&!W.isDirectory){de=D.pickerHintNeedsDirectory;break bb1}de=`${W.isDirectory?`📁`:`📄`} ${W.path}`}let pe=de,me=k?.agents??[],he;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,$.jsx)(a,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[24]=he):he=t[24];let ge;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ge=T(`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2`,`flex h-[min(28rem,calc(100vh-3rem))] flex-col overflow-hidden rounded-lg border border-edge bg-surface-panel shadow-popover outline-none`),t[25]=ge):ge=t[25];let _e;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,$.jsx)(L,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[26]=_e):_e=t[26];let ve=x.cron.refresh,ye=x.cron.refresh,K;t[27]===z?K=t[28]:(K=()=>void z(),t[27]=z,t[28]=K);let be=te&&`animate-spin`,q;t[29]===be?q=t[30]:(q=T(`size-4`,be),t[29]=be,t[30]=q);let Y;t[31]===q?Y=t[32]:(Y=(0,$.jsx)(fe,{className:q,"aria-hidden":!0}),t[31]=q,t[32]=Y);let Se;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,$.jsx)(v,{className:`size-4`}),t[33]=Se):Se=t[33];let X;t[34]!==R||t[35]!==w.loadError?(X=R?(0,$.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[w.loadError,`: `,R]}):null,t[34]=R,t[35]=w.loadError,t[36]=X):X=t[36];let Z;t[37]!==ce||t[38]!==te||t[39]!==W?.path||t[40]!==G||t[41]!==w.emptyDir||t[42]!==w.title||t[43]!==I?(Z=te&&I.length===0?(0,$.jsxs)(`p`,{className:`flex shrink-0 items-center gap-2 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(h,{className:`size-4 animate-spin`}),w.title,`…`]}):(0,$.jsx)(B,{tree:I,selectedPath:W?.path??null,onSelectFile:e=>G({path:e,isDirectory:!1}),onSelectEntry:(e,t)=>G({path:e,isDirectory:t}),onExpandDir:ce,onAction:void 0,emptyHint:w.emptyDir}),t[37]=ce,t[38]=te,t[39]=W?.path,t[40]=G,t[41]=w.emptyDir,t[42]=w.title,t[43]=I,t[44]=Z):Z=t[44];let Q;t[45]!==X||t[46]!==Z?(Q=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[X,Z]}),t[45]=X,t[46]=Z,t[47]=Q):Q=t[47];let Ce;t[48]===pe?Ce=t[49]:(Ce=(0,$.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:pe}),t[48]=pe,t[49]=Ce);let we;t[50]===r?we=t[51]:(we=()=>r(!1),t[50]=r,t[51]=we);let Te;t[52]!==D.cancel||t[53]!==we?(Te=(0,$.jsx)(E,{type:`button`,variant:`ghost`,onClick:we,children:D.cancel}),t[52]=D.cancel,t[53]=we,t[54]=Te):Te=t[54];let Ee=!le,De;t[55]!==i||t[56]!==r||t[57]!==M||t[58]!==W?(De=()=>{W&&(i({...W,agentId:M}),r(!1))},t[55]=i,t[56]=r,t[57]=M,t[58]=W,t[59]=De):De=t[59];let Oe;t[60]!==D.pickerConfirm||t[61]!==Ee||t[62]!==De?(Oe=(0,$.jsx)(E,{type:`button`,disabled:Ee,onClick:De,children:D.pickerConfirm}),t[60]=D.pickerConfirm,t[61]=Ee,t[62]=De,t[63]=Oe):Oe=t[63];let ke;t[64]!==Te||t[65]!==Oe?(ke=(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[Te,Oe]}),t[64]=Te,t[65]=Oe,t[66]=ke):ke=t[66];let Ae;return t[67]!==Ce||t[68]!==ke?(Ae=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[Ce,ke]}),t[67]=Ce,t[68]=ke,t[69]=Ae):Ae=t[69],(0,$.jsx)(u,{open:n,onOpenChange:r,children:(0,$.jsxs)(s,{children:[he,(0,$.jsxs)(c,{className:ge,children:[(0,$.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4`,children:[_e,(0,$.jsx)(l,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:D.pickerTitle}),(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,title:ve,"aria-label":ye,disabled:te,onClick:K,children:Y}),(0,$.jsx)(o,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":w.close,children:Se})})]}),me.length>0?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-edge px-4 py-2`,children:[(0,$.jsx)(`label`,{className:`text-xs text-fg-muted`,htmlFor:`picker-agent-select`,children:D.pickerAgentLabel}),(0,$.jsx)(f,{id:`picker-agent-select`,className:`min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-2 py-1 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:M,onChange:e=>{N(e.target.value),G(null)},children:me.map(e=>(0,$.jsxs)(p,{value:e.id,children:[ne(e,x.agentsSettings),e.id===k?.defaultId?` ★`:``]},e.id))})]}):null,Q,Ae]})]})})}function Pe(e){return e.sessionKey}function Fe(e){return e.agentId}function Ie(e){return e.language}var Le=[`shares`,`policy`];function Re(e){let t=(e??``).trim();return Le.includes(t)?t:`shares`}function ze(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Be(e,t){let n=new Date(e).getTime()-Date.now(),r=Math.abs(n),i=n<0;if(r<6e4)return t===`zh`?`刚刚`:`just now`;let a=Math.floor(r/6e4);if(a<60){let e=t===`zh`?`${a} 分钟`:`${a}m`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let o=Math.floor(a/60);if(o<24){let e=t===`zh`?`${o} 小时`:`${o}h`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let s=Math.floor(o/24),c=t===`zh`?`${s} 天`:`${s}d`;return i?t===`zh`?`${c}前`:`${c} ago`:c}var Ve=[{value:36e5,key:`1h`},{value:216e5,key:`6h`},{value:864e5,key:`24h`},{value:2592e5,key:`3d`},{value:6048e5,key:`7d`},{value:2592e6,key:`30d`}];function He(){let e=(0,xe.c)(23),t=C(We),n=b(t).sharesSettings,r=!!S(Ue),[a,o]=i(),s;e[0]===a?s=e[1]:(s=Re(a.get(`tab`)),e[0]=a,e[1]=s);let c=s,l;e[2]===o?l=e[3]:(l=e=>{o(t=>{let n=new URLSearchParams(t);return e===`shares`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[2]=o,e[3]=l);let u=l;if(!r)return(0,$.jsx)(ve,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let d={shares:n.tabShares,policy:n.tabPolicy},f=Le.map(e=>({id:e,label:d[e]})),p;e[4]===n.title?p=e[5]:(p=(0,$.jsx)(_e,{title:n.title}),e[4]=n.title,e[5]=p);let m;e[6]!==c||e[7]!==u||e[8]!==n.tabsAria||e[9]!==f?(m=(0,$.jsx)(q,{items:f,activeTab:c,onChange:u,ariaLabel:n.tabsAria,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`}),e[6]=c,e[7]=u,e[8]=n.tabsAria,e[9]=f,e[10]=m):m=e[10];let h;e[11]!==c||e[12]!==r||e[13]!==t||e[14]!==n?(h=c===`shares`?(0,$.jsx)(Ge,{t:n,language:t}):(0,$.jsx)(ke,{hasToken:r}),e[11]=c,e[12]=r,e[13]=t,e[14]=n,e[15]=h):h=e[15];let g;e[16]!==c||e[17]!==h?(g=(0,$.jsx)(ye,{id:c,activeTab:c,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`,showHeading:!1,children:h}),e[16]=c,e[17]=h,e[18]=g):g=e[18];let _;return e[19]!==p||e[20]!==m||e[21]!==g?(_=(0,$.jsxs)(ve,{children:[p,m,g]}),e[19]=p,e[20]=m,e[21]=g,e[22]=_):_=e[22],_}function Ue(e){return e.sessionKey}function We(e){return e.language}function Ge(e){let t=(0,xe.c)(79),{t:n,language:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={refreshInterval:3e4},t[0]=i):i=t[0];let{data:a,error:o,isLoading:s,mutate:c}=ee(`shares-list`,te,i),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:3e4},t[1]=l):l=t[1];let u=ee(`hosted-publications-list`,re,l),d;t[2]===a?.payload?.shares?d=t[3]:(d=a?.payload?.shares??[],t[2]=a?.payload?.shares,t[3]=d);let f=d,[p,m]=(0,J.useState)(!1),h;bb0:{if(p){h=f;break bb0}let e;t[4]===f?e=t[5]:(e=f.filter(Xe),t[4]=f,t[5]=e),h=e}let g=h,_;t[6]===f?_=t[7]:(_=f.filter(Ye),t[6]=f,t[7]=_);let v=_.length,y;t[8]===f?y=t[9]:(y=f.filter(Je),t[8]=f,t[9]=y);let b=y.length,x;t[10]===c?x=t[11]:(x=()=>void c(),t[10]=c,t[11]=x);let S;t[12]!==n||t[13]!==x?(S=(0,$.jsx)(nt,{t:n,onCreated:x}),t[12]=n,t[13]=x,t[14]=S):S=t[14];let C=u.data?.connected===!0,w=u.data?.publishingAllowed===!0,D;t[15]===u?D=t[16]:(D=()=>void u.mutate(),t[15]=u,t[16]=D);let O;t[17]!==r||t[18]!==w||t[19]!==D||t[20]!==C?(O=(0,$.jsx)(Ze,{language:r,connected:C,publishingAllowed:w,onCreated:D}),t[17]=r,t[18]=w,t[19]=D,t[20]=C,t[21]=O):O=t[21];let k=p?n.allSharesTitle:n.listTitle,A;t[22]===v?A=t[23]:(A=v>0&&(0,$.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:[`(`,v,`)`]}),t[22]=v,t[23]=A);let j;t[24]!==k||t[25]!==A?(j=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[k,A]}),t[24]=k,t[25]=A,t[26]=j):j=t[26];let M;t[27]===c?M=t[28]:(M=()=>void c(),t[27]=c,t[28]=M);let N=s&&`animate-spin`,P;t[29]===N?P=t[30]:(P=T(`size-3.5`,N),t[29]=N,t[30]=P);let F;t[31]===P?F=t[32]:(F=(0,$.jsx)(fe,{className:P}),t[31]=P,t[32]=F);let I;t[33]!==s||t[34]!==M||t[35]!==F?(I=(0,$.jsx)(E,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:M,disabled:s,children:F}),t[33]=s,t[34]=M,t[35]=F,t[36]=I):I=t[36];let L;t[37]!==b||t[38]!==p||t[39]!==n.hideExpired||t[40]!==n.showExpired?(L=b>0&&(0,$.jsx)(`button`,{type:`button`,className:`text-xs text-accent hover:underline`,onClick:()=>m(qe),children:p?n.hideExpired:n.showExpired}),t[37]=b,t[38]=p,t[39]=n.hideExpired,t[40]=n.showExpired,t[41]=L):L=t[41];let R;t[42]!==I||t[43]!==L?(R=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[I,L]}),t[42]=I,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==j||t[46]!==R?(z=(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[j,R]}),t[45]=j,t[46]=R,t[47]=z):z=t[47];let B;t[48]!==a||t[49]!==o||t[50]!==g||t[51]!==s||t[52]!==r||t[53]!==c||t[54]!==n?(B=s&&!a?(0,$.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:4}).map(Ke)}):o?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-red-600 dark:text-red-400`,children:[(0,$.jsx)(`span`,{children:n.error}),(0,$.jsx)(E,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>void c(),children:n.retry})]}):g.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.emptyState}):(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:g.map(e=>(0,$.jsx)(it,{share:e,t:n,language:r,onRevoked:()=>void c(),onExtended:()=>void c()},e.id))}),t[48]=a,t[49]=o,t[50]=g,t[51]=s,t[52]=r,t[53]=c,t[54]=n,t[55]=B):B=t[55];let V;t[56]!==b||t[57]!==c||t[58]!==p||t[59]!==n?(V=b>0&&p&&(0,$.jsx)(at,{t:n,onCleaned:()=>void c()}),t[56]=b,t[57]=c,t[58]=p,t[59]=n,t[60]=V):V=t[60];let H;t[61]!==z||t[62]!==B||t[63]!==V?(H=(0,$.jsxs)(K,{children:[z,B,V]}),t[61]=z,t[62]=B,t[63]=V,t[64]=H):H=t[64];let U;t[65]===u?U=t[66]:(U=()=>void u.mutate(),t[65]=u,t[66]=U);let W;t[67]!==u.data||t[68]!==u.error||t[69]!==u.isLoading||t[70]!==r||t[71]!==n||t[72]!==U?(W=(0,$.jsx)(Qe,{data:u.data,error:u.error,isLoading:u.isLoading,language:r,t:n,onChanged:U}),t[67]=u.data,t[68]=u.error,t[69]=u.isLoading,t[70]=r,t[71]=n,t[72]=U,t[73]=W):W=t[73];let G;return t[74]!==O||t[75]!==H||t[76]!==W||t[77]!==S?(G=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[S,O,H,W]}),t[74]=O,t[75]=H,t[76]=W,t[77]=S,t[78]=G):G=t[78],G}function Ke(e,t){return(0,$.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(k,{className:`h-4 w-2/3`}),(0,$.jsx)(k,{className:`mt-2 h-3 w-1/2`})]}),(0,$.jsx)(k,{className:`h-7 w-20 rounded-md`})]})},t)}function qe(e){return!e}function Je(e){return e.expired||e.revoked}function Ye(e){return!e.expired&&!e.revoked}function Xe(e){return!e.expired&&!e.revoked}function Ze({language:e,connected:t,publishingAllowed:n,onCreated:r}){let i=e===`zh`,[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,m]=(0,J.useState)(!1),[g,_]=(0,J.useState)(``),[v,b]=(0,J.useState)(6048e5),[x,S]=(0,J.useState)(!1),[C,w]=(0,J.useState)(null),[T,ee]=(0,J.useState)(null),D=async()=>{if(a.trim()){S(!0),ee(null);try{w(await se({path:a.trim(),title:g.trim()||void 0,ttlMs:v,spaFallback:!0,...s?{agentId:s}:{}})),r()}catch(e){ee(e instanceof Error?e.message:String(e))}finally{S(!1)}}};return(0,$.jsxs)(K,{children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(U,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i?`发布静态网站`:`Publish static website`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:i?`把工作区内的 HTML 文件,或包含 index.html 的网站目录,发布到隔离的托管域名。`:`Publish an HTML file or a website directory containing index.html to the isolated hosted origin.`}),t&&!n?(0,$.jsx)(`p`,{className:`mt-3 rounded-md border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning`,children:i?`管理员已暂停你的公网分享能力。已有远端链接当前不可访问;你仍可在下方撤销它们。`:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but you can still revoke them below.`}):null,(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-[1fr_12rem]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`input`,{value:a,onChange:e=>{o(e.target.value),u(!1),w(null)},placeholder:i?`选择 HTML 文件或网站目录`:`Select an HTML file or website directory`,className:`h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent`}),(0,$.jsxs)(E,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>m(!0),children:[a&&!l?(0,$.jsx)(F,{className:`size-4`}):(0,$.jsx)(L,{className:`size-4`}),a?i?`更换`:`Change`:i?`选择`:`Browse`]})]}),(0,$.jsxs)(f,{value:String(v),onChange:e=>b(Number(e.target.value)),children:[(0,$.jsx)(p,{value:`86400000`,children:i?`24 小时`:`24 hours`}),(0,$.jsx)(p,{value:`604800000`,children:i?`7 天`:`7 days`}),(0,$.jsx)(p,{value:`2592000000`,children:i?`30 天`:`30 days`})]}),(0,$.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),placeholder:i?`网站标题(可选)`:`Site title (optional)`,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent sm:col-span-2`})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,$.jsxs)(E,{type:`button`,onClick:()=>void D(),disabled:!a.trim()||x||!t||!n,children:[x?(0,$.jsx)(h,{className:`size-4 animate-spin`}):(0,$.jsx)(U,{className:`size-4`}),x?i?`发布中…`:`Publishing…`:i?`发布网站`:`Publish site`]}),C?(0,$.jsxs)(`button`,{type:`button`,className:`min-w-0 truncate text-xs text-accent hover:underline`,onClick:()=>void y(C.shareUrl),children:[C.shareUrl,` · `,C.fileCount,` `,i?`个文件`:`files`,` · `,ze(C.totalBytes)]}):null]}),T?(0,$.jsx)(`p`,{className:`mt-3 text-xs text-danger`,children:T}):null]})]}),(0,$.jsx)(Ne,{open:d,onOpenChange:m,initialPath:a||void 0,agentId:s||void 0,selectKind:`any`,onConfirm:e=>{o(e.path),c(e.agentId),u(e.isDirectory),w(null),ee(null)}})]})}function Qe(e){let t=(0,xe.c)(18),{data:n,error:r,isLoading:i,language:a,t:o,onChanged:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(U,{className:`size-4 text-accent`,"aria-hidden":!0}),t[0]=c):c=t[0];let l;t[1]===o.hostedTitle?l=t[2]:(l=(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[c,o.hostedTitle]}),t[1]=o.hostedTitle,t[2]=l);let u;t[3]===o.hostedHint?u=t[4]:(u=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:o.hostedHint}),t[3]=o.hostedHint,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,$.jsx)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:(0,$.jsxs)(`div`,{children:[l,u]})}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;t[8]!==n||t[9]!==r||t[10]!==i||t[11]!==a||t[12]!==s||t[13]!==o?(f=i&&!n?(0,$.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:2}).map($e)}):r?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o.error}):n?.connected?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[n.publishingAllowed?null:(0,$.jsx)(`p`,{className:`rounded-md border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning`,children:a===`zh`?`管理员已暂停公网分享。已有托管链接当前不可访问,也不能更新;撤销操作仍然可用。`:`An administrator has paused public sharing. Existing hosted links are unavailable and cannot be updated; revocation remains available.`}),n.publications.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.hostedEmpty}):(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.publications.map(e=>(0,$.jsx)(et,{publication:e,language:a,t:o,publishingAllowed:n.publishingAllowed,onChanged:s},e.id))})]}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.hostedDisconnected}),(0,$.jsx)(ge,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:s})]}),t[8]=n,t[9]=r,t[10]=i,t[11]=a,t[12]=s,t[13]=o,t[14]=f):f=t[14];let p;return t[15]!==d||t[16]!==f?(p=(0,$.jsxs)(K,{children:[d,f]}),t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function $e(e,t){return(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(k,{className:`h-4 w-2/3`}),(0,$.jsx)(k,{className:`mt-2 h-3 w-1/2`})]},t)}function et({publication:e,language:t,t:n,publishingAllowed:r,onChanged:i}){let[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),[f,p]=(0,J.useState)(!1),[_,v]=(0,J.useState)(!1),b=Date.now()>=new Date(e.expiresAt).getTime(),x=e.status===`active`&&!b,S=e.status===`revoked`?n.statusRevoked:b?n.statusExpired:e.status===`staging`?t===`zh`?`准备中`:`Staging`:n.statusActive,C=e.kind===`note_document`?W:e.kind===`static_site`?U:g,w=e.kind===`note_document`?t===`zh`?`笔记文档`:`Note document`:e.kind===`static_site`?t===`zh`?`静态网站`:`Static website`:t===`zh`?`会话快照`:`Conversation snapshot`,ee=(0,J.useCallback)(async()=>{e.shareUrl&&await y(e.shareUrl)&&(u(!0),window.setTimeout(()=>u(!1),2e3))},[e.shareUrl]),D=(0,J.useCallback)(async()=>{o(!1),c(!0);try{await pe(e.id),i()}catch{}finally{c(!1)}},[e.id,i]),O=(0,J.useCallback)(async()=>{if(!(!e.revision||e.revision<=1)){p(!0);try{let t=(await me(e.id)).find(t=>t.revision<e.revision);if(!t)return;await M(e.id,e.revision,t.revision),i()}catch{}finally{p(!1)}}},[e.id,e.revision,i]),k=(0,J.useCallback)(async()=>{v(!0);try{await A(e.id),i()}catch{}finally{v(!1)}},[e.id,i]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-panel/80 px-3 py-2.5`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(C,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:T(`text-xs font-medium`,x?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`),children:S})]}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[w,` · `,n.hostedRevision,` `,e.revision??`—`,` · `,e.managedFromThisDevice?n.hostedThisDevice:n.hostedOtherDevice]}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,$.jsxs)(`span`,{children:[t===`zh`?`浏览`:`Views`,`: `,e.viewCount,e.maxViews===null?``:` / ${e.maxViews}`]}),(0,$.jsx)(`span`,{children:b?n.statusExpired:Be(e.expiresAt,t)}),e.description?(0,$.jsx)(`span`,{className:`italic`,children:e.description}):null]})]}),x?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.shareUrl?(0,$.jsx)(E,{type:`button`,variant:`ghost`,className:`px-2 py-1`,disabled:!r,title:n.copyUrl,onClick:()=>void ee(),children:l?(0,$.jsx)(d,{className:`size-3.5 text-emerald-500`}):(0,$.jsx)(m,{className:`size-3.5`})}):null,(e.revision??0)>1?(0,$.jsx)(E,{type:`button`,variant:`ghost`,className:`px-2 py-1`,disabled:f||!r,onClick:()=>void O(),title:t===`zh`?`回滚上一版本`:`Roll back one revision`,children:f?(0,$.jsx)(h,{className:`size-3.5 animate-spin`}):(0,$.jsx)(he,{className:`size-3.5`})}):null,e.kind===`static_site`&&e.managedFromThisDevice?(0,$.jsx)(E,{type:`button`,variant:`ghost`,className:`px-2 py-1`,disabled:_||!r,onClick:()=>void k(),title:t===`zh`?`发布工作区中的最新版本`:`Publish latest workspace version`,children:(0,$.jsx)(fe,{className:T(`size-3.5`,_&&`animate-spin`)})}):null,(0,$.jsx)(E,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,disabled:s,onClick:()=>o(!0),children:s?(0,$.jsx)(h,{className:`size-3.5 animate-spin`}):(0,$.jsx)(P,{className:`size-3.5`})})]}):null]})}),(0,$.jsx)(N,{open:a,title:n.revokeConfirmTitle,description:n.revokeConfirmBody,confirmLabel:n.revokeConfirmLabel,cancelLabel:n.cancel,destructive:!0,onConfirm:()=>void D(),onCancel:()=>o(!1)})]})}var tt={expanded:!0,path:``,isDirectory:!1,agentId:``,ttlMs:864e5,maxViews:null,description:``,directoryMode:`browse`,creating:!1,result:null,errorMsg:null,resultDialogOpen:!1,pickerOpen:!1};function nt({t:e,onCreated:t}){let[n,r]=(0,J.useReducer)(H,tt),{expanded:i,path:a,isDirectory:o,agentId:s,ttlMs:c,maxViews:l,description:u,directoryMode:d,creating:m,result:g,errorMsg:v,resultDialogOpen:y,pickerOpen:b}=n,x=(0,J.useCallback)(async()=>{if(a.trim()){r({type:`patch`,patch:{creating:!0,errorMsg:null,result:null}});try{r({type:`patch`,patch:{result:(await oe({path:a.trim(),ttlMs:c,maxViews:l,description:u.trim()||void 0,...s?{agentId:s}:{},...o?{kind:`directory`,directoryMode:d}:{}})).payload,resultDialogOpen:!0}}),t()}catch(e){r({type:`patch`,patch:{errorMsg:e instanceof Error?e.message:String(e)}})}finally{r({type:`patch`,patch:{creating:!1}})}}},[a,o,s,c,l,u,d,t]),S=(0,J.useCallback)(()=>{r({type:`patch`,patch:{path:``,isDirectory:!1,agentId:``,description:``,maxViews:null,ttlMs:864e5,directoryMode:`browse`,result:null,errorMsg:null}})},[]);return i?(0,$.jsxs)(K,{children:[(0,$.jsx)(`h2`,{className:`mb-1 text-sm font-semibold text-fg`,children:e.createTitle}),(0,$.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:e.createHint}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.pathLabel}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:T(`flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm`,a?`text-fg`:`text-fg-subtle`),children:a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:o?`📁`:`📄`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:a,children:a})]}):(0,$.jsx)(`span`,{className:`truncate`,children:e.pathPlaceholder})}),(0,$.jsxs)(E,{type:`button`,variant:`ghost`,onClick:()=>r({type:`patch`,patch:{pickerOpen:!0}}),children:[(0,$.jsx)(F,{className:`size-4`}),a?e.pathBrowseChange:e.pathBrowse]})]})]}),o?(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.directoryModeLabel}),(0,$.jsxs)(f,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:d,onChange:e=>r({type:`patch`,patch:{directoryMode:e.target.value===`zip-only`?`zip-only`:`browse`}}),children:[(0,$.jsx)(p,{value:`browse`,children:e.directoryModeBrowse}),(0,$.jsx)(p,{value:`zip-only`,children:e.directoryModeZipOnly})]})]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.ttlLabel}),(0,$.jsx)(f,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:c,onChange:e=>r({type:`patch`,patch:{ttlMs:Number(e.target.value)}}),children:Ve.map(t=>(0,$.jsx)(p,{value:t.value,children:e.ttlOptions[t.key]},t.key))})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.maxViewsLabel}),(0,$.jsxs)(f,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:l??`unlimited`,onChange:e=>r({type:`patch`,patch:{maxViews:e.target.value===`unlimited`?null:Number(e.target.value)}}),children:[(0,$.jsx)(p,{value:`unlimited`,children:e.maxViewsUnlimited}),(0,$.jsx)(p,{value:`1`,children:`1`}),(0,$.jsx)(p,{value:`5`,children:`5`}),(0,$.jsx)(p,{value:`10`,children:`10`}),(0,$.jsx)(p,{value:`50`,children:`50`}),(0,$.jsx)(p,{value:`100`,children:`100`})]})]})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.descriptionLabel}),(0,$.jsx)(`input`,{type:`text`,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:outline-none focus:ring-2 focus:ring-accent`,placeholder:e.descriptionPlaceholder,value:u,onChange:e=>r({type:`patch`,patch:{description:e.target.value}})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,$.jsxs)(E,{type:`button`,disabled:m||!a.trim(),onClick:()=>void x(),children:[m?(0,$.jsx)(h,{className:`size-4 animate-spin`}):(0,$.jsx)(_,{className:`size-4`}),m?e.creating:e.createButton]}),(0,$.jsx)(E,{type:`button`,variant:`ghost`,onClick:()=>{S(),r({type:`patch`,patch:{expanded:!1}})},children:e.cancel})]}),v&&(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:v})]}),(0,$.jsx)(I,{open:y,onOpenChange:e=>{r({type:`patch`,patch:{resultDialogOpen:e,...e?{}:{result:null}}})},result:g}),(0,$.jsx)(Ne,{open:b,onOpenChange:e=>r({type:`patch`,patch:{pickerOpen:e}}),initialPath:a||void 0,selectKind:`any`,onConfirm:e=>r({type:`patch`,patch:{path:e.path,isDirectory:e.isDirectory,agentId:e.agentId,directoryMode:`browse`}})})]}):(0,$.jsxs)(E,{type:`button`,onClick:()=>r({type:`patch`,patch:{expanded:!0}}),className:`self-start`,children:[(0,$.jsx)(_,{className:`size-4`}),e.createTitle]})}var rt={revokeOpen:!1,revoking:!1,linksOpen:!1,urlCopied:!1,copyFailed:!1,extending:!1};function it({share:e,t,language:n,onRevoked:r,onExtended:i}){let[a,o]=(0,J.useReducer)(H,rt),{revokeOpen:s,revoking:c,linksOpen:l,urlCopied:u,copyFailed:f,extending:p}=a,_=!e.expired&&!e.revoked,v=e.revoked?t.statusRevoked:e.expired?t.statusExpired:t.statusActive,b=e.revoked?`text-red-600 dark:text-red-400`:e.expired?`text-fg-subtle`:`text-emerald-600 dark:text-emerald-400`,x=(0,J.useCallback)(async()=>{o({type:`patch`,patch:{revokeOpen:!1,revoking:!0}});try{await z(e.id),r()}catch{}finally{o({type:`patch`,patch:{revoking:!1}})}},[e.id,r]),S=(0,J.useCallback)(async()=>{if(o({type:`patch`,patch:{linksOpen:!0,copyFailed:!1}}),!await y(e.shareUrl)){o({type:`patch`,patch:{copyFailed:!0}}),window.setTimeout(()=>o({type:`patch`,patch:{copyFailed:!1}}),2500);return}o({type:`patch`,patch:{urlCopied:!0}}),window.setTimeout(()=>o({type:`patch`,patch:{urlCopied:!1}}),2e3)},[e.shareUrl]),C=(0,J.useCallback)(async()=>{o({type:`patch`,patch:{extending:!0}});try{await G(e.id,864e5),i()}catch{}finally{o({type:`patch`,patch:{extending:!1}})}},[e.id,i]),w=`share-links-${e.id}`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:T(`flex min-w-0 flex-1 items-start gap-3 rounded-md text-left`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),"aria-expanded":l,"aria-controls":w,onClick:()=>o({type:`patch`,patch:{linksOpen:!l}}),children:[(0,$.jsx)(de,{className:T(`mt-0.5 size-4 shrink-0 text-fg-muted transition-transform`,l?`rotate-0`:`-rotate-90`),"aria-hidden":!0}),e.kind===`note`?(0,$.jsx)(W,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):e.kind===`session`?(0,$.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):(0,$.jsx)(F,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:T(`text-xs font-medium`,b),children:v})]}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.kind===`note`?n===`zh`?`笔记快照 · 版本 ${e.snapshotRevision??1}`:`Note snapshot · revision ${e.snapshotRevision??1}`:e.kind===`session`?n===`zh`?`会话快照 · ${e.messageCount??0} 条消息 · 版本 ${e.snapshotRevision??1}`:`Conversation snapshot · ${e.messageCount??0} messages · revision ${e.snapshotRevision??1}`:e.workspaceRelativePath}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:ze(e.fileSize)}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(V,{className:`size-3`}),e.expired?n===`zh`?`已过期`:`expired`:Be(e.expiresAt,n)]}),(0,$.jsxs)(`span`,{children:[t.views,`: `,e.downloadCount,e.maxViews!==null&&` ${t.viewsOf} ${e.maxViews}`]}),e.description&&(0,$.jsx)(`span`,{className:`italic text-fg-subtle`,children:e.description})]})]})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:_&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(E,{type:`button`,variant:`ghost`,className:`px-2 py-1`,title:t.copyUrl,onClick:()=>void S(),children:u?(0,$.jsx)(d,{className:`size-3.5 text-emerald-500`}):(0,$.jsx)(m,{className:`size-3.5`})}),(0,$.jsx)(E,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:()=>void C(),disabled:p,title:t.extend,children:p?(0,$.jsx)(h,{className:`size-3.5 animate-spin`}):(0,$.jsx)(V,{className:`size-3.5`})}),(0,$.jsx)(E,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,onClick:()=>o({type:`patch`,patch:{revokeOpen:!0}}),disabled:c,children:c?(0,$.jsx)(h,{className:`size-3.5 animate-spin`}):(0,$.jsx)(P,{className:`size-3.5`})})]})})]}),_&&l?(0,$.jsxs)(`div`,{id:w,className:`mt-3 bg-surface-base/45 py-3 pl-7 pr-3`,children:[(0,$.jsx)(ce,{shareUrl:e.shareUrl,lanUrl:e.lanUrl,reachability:e.reachability,compact:!0}),f?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:t.copyFailed}):null,(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsx)(j,{reachability:e.reachability})})]}):null]}),(0,$.jsx)(N,{open:s,title:t.revokeConfirmTitle,description:t.revokeConfirmBody,confirmLabel:t.revokeConfirmLabel,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void x(),onCancel:()=>o({type:`patch`,patch:{revokeOpen:!1}})})]})}function at({t:e,onCleaned:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(!1),o=(0,J.useCallback)(async()=>{r(!1),a(!0);try{await le(),t()}catch{}finally{a(!1)}},[t]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(E,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>r(!0),className:`border-danger/40 px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:[i?(0,$.jsx)(h,{className:`size-3.5 animate-spin`}):(0,$.jsx)(P,{className:`size-3.5`}),e.cleanExpired]})}),(0,$.jsx)(N,{open:n,title:e.cleanExpiredConfirmTitle,description:e.cleanExpiredConfirmBody,confirmLabel:e.cleanExpiredConfirmLabel,cancelLabel:e.cancel,destructive:!0,onConfirm:()=>void o(),onCancel:()=>r(!1)})]})}export{He as SharesSettingsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{i as t,r as n}from"./locale-store-BkJ7g35d.js";import{fn as r}from"./index-SxqsTD4i.js";var i=e({reloadSkills:()=>a});async function a(){let e=await t(n(`/api/skills/reload`),{method:`POST`});if(!e.ok)throw Error(await r(e))}export{i as n,a as t};
|