@xopcai/xopc 0.0.148 → 0.0.149
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-B5h0UGWn.js → activity-store-B4s0ipx2.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Dy5VvLUq.js → agent-avatar-dicebear-BSccACje.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DZDOcgz5.js +2 -0
- package/dist/gateway/static/root/assets/{api-B3J2AmQW.js → api-BMdUsNCV.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BbSLDubO.js → app-management-settings-panel-DrLGhYkI.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-D9wK0UKA.js → appearance-settings-BNasnY9D.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Cmr-Hvm9.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DaDK-FYa.js → archive-plugin-BQ17IK9x.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CKiBdU_s.js → attachment-load-HXvgWHXu.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-8Qbnxq-p.js → automation-suggestion-card-CjIWpsch.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-TWgUAI8t.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-ByZbwN2A.js → binary-plugins-DifWJzNZ.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DGaI2ucU.js → block-editor-DtRzIkPU.js} +4 -4
- package/dist/gateway/static/root/assets/browser-settings-page-DBsFItW_.js +8 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-DaPf3b5d.js → capability-presets-api-DazKjWW1.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-C0iHFbY9.js → capability-presets-settings-panel-Cvrw4fD1.js} +2 -2
- package/dist/gateway/static/root/assets/{channel-recipient-api-DrbkoYyF.js → channel-recipient-api-Bea6if_6.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BBkzrBYy.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-CuU6ez3y.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-CiHea96v.js → connector-logo-BjbYbJjQ.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DLsZCAw7.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-DzdsBRdD.js → desktop-pet-C6V-PHwi.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-B-URlTdB.js → desktop-pet-settings-5Fcz47XQ.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-g_N_ROC-.js → directory-picker-path-field-C8zZNUzC.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-DnEe0Mxg.js → dreaming-settings-gJSw7Adk.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-DPkoOQED.js → extension-debug-page-DFE5ADJ0.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Cf_gDelx.js → extension-page-CfR-aW8G.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-YlXpJV9k.js → extension-settings-page-CFIEbs2L.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-BxHgXB-I.js → gateway-config-api-B6M_ra8U.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BrxzyVW2.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-ChI88pp7.js → gateway-startup-retry-DNA3OOzV.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-ClzciTH5.js → goal-create-dialog-DRVRLc5Z.js} +1 -1
- package/dist/gateway/static/root/assets/goal-detail-page-8F7NElzP.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-NoJKU8UZ.js → goals-config-api-D88opgcs.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-BaoLiV8G.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-kQ1pBOM9.js → goals-settings-D07UL8Jo.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-C6jSQCXQ.js → heartbeat-settings-YCSNOcXC.js} +1 -1
- package/dist/gateway/static/root/assets/{index-twNrYC3D.js → index-CH7XN6KY.js} +63 -63
- package/dist/gateway/static/root/assets/index-Dfnl9tp_.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CIQ6wLqH.js → keyboard-shortcuts-settings-BHnh5OoY.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Boe8n4zH.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BO6odwNn.js → local-apps-page-CKvtLzsF.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BP67jtYG.js → locale-store-BneNAR8R.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Cb4Uptct.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-DbJZwtmM.js → markdown-split-BVSFG99p.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-B0WH561o.js → media-plugins-DdOjIVk3.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-BIsSVgW7.js → messages-t1yPaVCt.js} +4 -4
- package/dist/gateway/static/root/assets/models-hub-panel-CNiUKZUV.js +2 -0
- package/dist/gateway/static/root/assets/{notes-page-B72S7M1Z.js → notes-page-ZbLR3awn.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-C9__VkD6.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-LjSEtOvG.js → page-tabs-DMlQERNg.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cn8Jp9jw.js → preview-open-alternatives-CbiJRPxK.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CZhuB5kO.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BOq4WVdR.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BxGq0ebQ.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-BDUPII5R.js → save-bar-controls-BZTj3hxl.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-B1NY9MNs.js → schedule-field-CxYDObjT.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CnsFMun1.js → schema-form-CBbXgpKQ.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-B6gSU_Au.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DwuBL834.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-D9jJ6KlR.js → settings-collapsible-section-BySKZ8rp.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-36IjMuUY.js → settings-form-section-CjINay6t.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DyYMmawg.js → settings-loading-skeleton-vitElc-n.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-yv4TeHfF.js → settings-page-BNrVwuL7.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BAP5LguT.js → settings-page-layout-HdlQOOqp.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BJeA4mmk.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BBxZ9lX5.js → share-preview-page-DC-eQONB.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DB2KYA2_.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DQtZiejw.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-Pm0fNe_p.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-B3ceUo4i.js → system-settings-panel-CVa90q2f.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-_efiWyB8.js → theme-store-D1cOpgsy.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-Dp1PvxGZ.js → typed-models-lib-DIKF9vpz.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-XHelnCa_.js → use-channel-catalog-DnvpI0Ys.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-DnLqQyRG.js +1 -0
- package/dist/gateway/static/root/assets/{user-profile-fields-editor-nOOg0uBi.js → user-profile-fields-editor-y8gTmkPX.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-9fBPCoA9.js → user-profile-settings-panel-C3pvqe28.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-3AORlPIm.js → utils-BK2vwu_3.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-BiFIIWC4.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-D2-_bC0J.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-B0FPG4eJ.js +1 -0
- package/dist/gateway/static/root/assets/work-page-BDeVxts_.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BPzS67fU.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-xPhmrRLs.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/routes/work-discovery.js +32 -0
- package/dist/src/gateway/hono/routes/work-discovery.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/046_work_discovery_feedback.sql +13 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/work-discovery/analyzer.js +23 -4
- package/dist/src/work-discovery/analyzer.js.map +1 -1
- package/dist/src/work-discovery/index.js +2 -2
- package/dist/src/work-discovery/probe.d.ts +6 -0
- package/dist/src/work-discovery/probe.js +12 -1
- package/dist/src/work-discovery/probe.js.map +1 -1
- package/dist/src/work-discovery/repository.d.ts +7 -1
- package/dist/src/work-discovery/repository.js +35 -2
- package/dist/src/work-discovery/repository.js.map +1 -1
- package/dist/src/work-discovery/service.d.ts +6 -1
- package/dist/src/work-discovery/service.js +64 -5
- package/dist/src/work-discovery/service.js.map +1 -1
- package/dist/src/work-discovery/types.d.ts +21 -0
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agents-Ci1U96gj.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-Z6cQTPS6.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-D7HmeFdr.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BZ25v96s.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-Bc7FVeqs.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-P3J5voxb.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-oi41mE3U.js +0 -2
- package/dist/gateway/static/root/assets/gateway-settings-CGphLe9T.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-CyaLkWhd.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-C-srWhsP.js +0 -2
- package/dist/gateway/static/root/assets/index-DktduA8Z.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DcaqgchY.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-B_13EkK7.js +0 -7
- package/dist/gateway/static/root/assets/models-hub-panel-DkCTjUj_.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-CfWQczho.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-BWOTQX4M.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-C81dHQ5i.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-U1FQUBtJ.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-t6DzYLpM.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DggKrWED.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DncjFopP.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Brx1LsY9.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-C_sLcSxh.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BPzqM78D.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-Dg_4sJJz.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-Bc-xxEHw.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-CCMe2E98.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-CnVze8sW.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-DUKlCVcY.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-1Hh-__Ur.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-BQ_8x0bT.js";import{Ko as i,Wo as a,as as o,ns as s}from"./index-twNrYC3D.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:r,value:i,onChange:u,disabled:d}=e,f=typeof r.description==`string`?r.description:void 0,p=(typeof r[`x-placeholder`]==`string`?r[`x-placeholder`]:null)||f,m=r.format;if(Array.isArray(r.enum)&&r.enum.every(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]===r.enum?s=t[5]:(s=r.enum.map(_),t[4]=r.enum,t[5]=s);let c;t[6]!==d||t[7]!==n||t[8]!==o||t[9]!==s||t[10]!==i?(c=(0,l.jsx)(a,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:i,disabled:d,onChange:o,children:s}),t[6]=d,t[7]=n,t[8]=o,t[9]=s,t[10]=i,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]!==i?(n=(0,l.jsx)(o,{value:i,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]=i,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]!==i?(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:i,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=i,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:i,onChange:a,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]!==a||t[7]!==i?(y=(e,t)=>{a({...i,[e]:t})},t[6]=a,t[7]=i,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!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]!==i){let e=Array.from(v.keys()).sort(T);t[17]===s?x=t[18]:(x=r(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==d||t[22]!==b||t[23]!==i?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,l.jsx)(S,{k:e.key,sub:e.sub,value:i[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]=i,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]=i,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{t as r}from"./cn-BQ_8x0bT.js";import{Go as i,os as a,qo as o,rs as s}from"./index-CH7XN6KY.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:r,value:o,onChange:u,disabled:d}=e,f=typeof r.description==`string`?r.description:void 0,p=(typeof r[`x-placeholder`]==`string`?r[`x-placeholder`]:null)||f,m=r.format;if(Array.isArray(r.enum)&&r.enum.every(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 a;t[2]===u?a=t[3]:(a=e=>u(e.target.value),t[2]=u,t[3]=a);let s;t[4]===r.enum?s=t[5]:(s=r.enum.map(_),t[4]=r.enum,t[5]=s);let c;t[6]!==d||t[7]!==n||t[8]!==a||t[9]!==s||t[10]!==o?(c=(0,l.jsx)(i,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:o,disabled:d,onChange:a,children:s}),t[6]=d,t[7]=n,t[8]=a,t[9]=s,t[10]=o,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]!==o?(n=(0,l.jsx)(a,{value:o,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]=o,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]!==o?(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:o,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=o,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)(o,{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:i,onChange:a,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]!==a||t[7]!==i?(y=(e,t)=>{a({...i,[e]:t})},t[6]=a,t[7]=i,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!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]!==i){let e=Array.from(v.keys()).sort(T);t[17]===s?x=t[18]:(x=r(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==d||t[22]!==b||t[23]!==i?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,l.jsx)(S,{k:e.key,sub:e.sub,value:i[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]=i,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]=i,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{d as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./messages-t1yPaVCt.js";import{d as s,i as c,n as l,o as u}from"./locale-store-BneNAR8R.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$c as f,Ao as p,Dt as m,Fo as h,Go as g,Ml as _,Nc as v,No as y,Ot as ee,Po as b,Ul as x,Xc as S,Xo as C,Yo as te,Zc as w,Zs as T,_a as E,ba as D,bc as O,bu as k,cs as A,da as j,fa as M,ha as N,hs as P,io as F,jl as I,jo as ne,js as L,ko as re,kt as R,la as z,ls as B,ma as V,ms as H,pa as U,qo as W,ro as G,tc as ie,to as ae,ua as oe,va as se,vl as ce,vs as le,xa as ue,ya as K,yc as q,ys as de,yu as fe,zc as pe}from"./index-CH7XN6KY.js";import{n as J,t as Y}from"./settings-form-section-CjINay6t.js";import{t as X}from"./page-tabs-DMlQERNg.js";import{n as me,r as he}from"./segmented-styles-BL8oLBEp.js";var Z=e(t(),1),ge=n(),Q=r();function _e(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 ve(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function ye(e){let t=(0,ge.c)(105),{session:n,variant:r,labels:i,sessionAgentId:o,sessionAgentAvatar:s,onOpen:c,onAction:l}=e,u;t[0]!==i.unnamedSession||t[1]!==n.name?(u=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=u):u=t[2];let d=u,f;t[3]===n.name?f=t[4]:(f=n.name?.trim(),t[3]=n.name,t[4]=f);let p=!!f,m=n.status===`archived`,h=n.status===`pinned`,g=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,_;t[5]===g?_=t[6]:(_=a(`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`,g),t[5]=g,t[6]=_);let y;t[7]===c?y=t[8]:(y=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[7]=c,t[8]=y);let ee=r===`list`&&`sm:py-3`,b;t[9]===ee?b=t[10]:(b=a(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,ee),t[9]=ee,t[10]=b);let x;t[11]===n.sourceChannel?x=t[12]:(x=(0,Q.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,Q.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:n.sourceChannel})}),t[11]=n.sourceChannel,t[12]=x);let S;t[13]===h?S=t[14]:(S=h?(0,Q.jsx)(O,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[13]=h,t[14]=S);let C;t[15]===n.updatedAt?C=t[16]:(C=_e(n.updatedAt),t[15]=n.updatedAt,t[16]=C);let te;t[17]===C?te=t[18]:(te=(0,Q.jsx)(`span`,{children:C}),t[17]=C,t[18]=te);let w;t[19]!==te||t[20]!==S?(w=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[S,te]}),t[19]=te,t[20]=S,t[21]=w):w=t[21];let T;t[22]!==w||t[23]!==b||t[24]!==x?(T=(0,Q.jsxs)(`div`,{className:b,children:[x,w]}),t[22]=w,t[23]=b,t[24]=x,t[25]=T):T=t[25];let E=r===`list`&&`sm:py-3`,D;t[26]===E?D=t[27]:(D=a(`min-w-0 flex-1 px-3 py-2`,E),t[26]=E,t[27]=D);let j=r===`list`&&`sm:items-start`,M;t[28]===j?M=t[29]:(M=a(`flex gap-3`,j),t[28]=j,t[29]=M);let N;t[30]!==s||t[31]!==o?(N=(0,Q.jsx)(ue,{agentId:o,avatar:s,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[30]=s,t[31]=o,t[32]=N):N=t[32];let P;t[33]===d?P=t[34]:(P=(0,Q.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:d,children:d}),t[33]=d,t[34]=P);let F;t[35]!==n.key||t[36]!==p?(F=p?(0,Q.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[35]=n.key,t[36]=p,t[37]=F):F=t[37];let ne;t[38]!==P||t[39]!==F?(ne=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[P,F]}),t[38]=P,t[39]=F,t[40]=ne):ne=t[40];let re;t[41]!==M||t[42]!==N||t[43]!==ne?(re=(0,Q.jsxs)(`div`,{className:M,children:[N,ne]}),t[41]=M,t[42]=N,t[43]=ne,t[44]=re):re=t[44];let R;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(v,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[45]=R):R=t[45];let z;t[46]===n.messageCount?z=t[47]:(z=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[R,n.messageCount]}),t[46]=n.messageCount,t[47]=z);let B;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(le,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[48]=B):B=t[48];let V;t[49]===n.estimatedTokens?V=t[50]:(V=ve(n.estimatedTokens),t[49]=n.estimatedTokens,t[50]=V);let H;t[51]===V?H=t[52]:(H=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[B,V]}),t[51]=V,t[52]=H);let U;t[53]!==z||t[54]!==H?(U=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[z,H]}),t[53]=z,t[54]=H,t[55]=U):U=t[55];let W;t[56]===n.tags?W=t[57]:(W=n.tags.length>0?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Se),n.tags.length>3?(0,Q.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[56]=n.tags,t[57]=W);let G;t[58]!==D||t[59]!==re||t[60]!==U||t[61]!==W?(G=(0,Q.jsxs)(`div`,{className:D,children:[re,U,W]}),t[58]=D,t[59]=re,t[60]=U,t[61]=W,t[62]=G):G=t[62];let ie;t[63]===l?ie=t[64]:(ie=()=>l(`continue`),t[63]=l,t[64]=ie);let ae;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(v,{className:`size-4`,strokeWidth:1.75}),t[65]=ae):ae=t[65];let oe;t[66]!==i.continueChat||t[67]!==ie?(oe=(0,Q.jsx)(`button`,{type:`button`,className:A,title:i.continueChat,"aria-label":i.continueChat,onClick:ie,children:ae}),t[66]=i.continueChat,t[67]=ie,t[68]=oe):oe=t[68];let se;t[69]!==m||t[70]!==i.archive||t[71]!==i.unarchive||t[72]!==l?(se=m?(0,Q.jsx)(`button`,{type:`button`,className:A,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>l(`unarchive`),children:(0,Q.jsx)(k,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:A,title:i.archive,"aria-label":i.archive,onClick:()=>l(`archive`),children:(0,Q.jsx)(fe,{className:`size-4`,strokeWidth:1.75})}),t[69]=m,t[70]=i.archive,t[71]=i.unarchive,t[72]=l,t[73]=se):se=t[73];let ce;t[74]!==h||t[75]!==i.pin||t[76]!==i.unpin||t[77]!==l?(ce=h?(0,Q.jsx)(`button`,{type:`button`,className:A,title:i.unpin,"aria-label":i.unpin,onClick:()=>l(`unpin`),children:(0,Q.jsx)(q,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:A,title:i.pin,"aria-label":i.pin,onClick:()=>l(`pin`),children:(0,Q.jsx)(O,{className:`size-4`,strokeWidth:1.75})}),t[74]=h,t[75]=i.pin,t[76]=i.unpin,t[77]=l,t[78]=ce):ce=t[78];let K;t[79]===l?K=t[80]:(K=()=>l(`export`),t[79]=l,t[80]=K);let de;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Q.jsx)(I,{className:`size-4`,strokeWidth:1.75}),t[81]=de):de=t[81];let pe;t[82]!==i.export||t[83]!==K?(pe=(0,Q.jsx)(`button`,{type:`button`,className:A,title:i.export,"aria-label":i.export,onClick:K,children:de}),t[82]=i.export,t[83]=K,t[84]=pe):pe=t[84];let J;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(J=a(A,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[85]=J):J=t[85];let Y;t[86]===l?Y=t[87]:(Y=()=>l(`delete`),t[86]=l,t[87]=Y);let X;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Q.jsx)(L,{className:`size-4`,strokeWidth:1.75}),t[88]=X):X=t[88];let me;t[89]!==i.delete||t[90]!==Y?(me=(0,Q.jsx)(`button`,{type:`button`,className:J,title:i.delete,"aria-label":i.delete,onClick:Y,children:X}),t[89]=i.delete,t[90]=Y,t[91]=me):me=t[91];let he;t[92]!==oe||t[93]!==se||t[94]!==ce||t[95]!==pe||t[96]!==me?(he=(0,Q.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:xe,onKeyDown:be,children:[oe,se,ce,pe,me]}),t[92]=oe,t[93]=se,t[94]=ce,t[95]=pe,t[96]=me,t[97]=he):he=t[97];let Z;return t[98]!==c||t[99]!==T||t[100]!==G||t[101]!==_||t[102]!==he||t[103]!==y?(Z=(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,className:_,onClick:c,onKeyDown:y,children:[T,G,he]}),t[98]=c,t[99]=T,t[100]=G,t[101]=_,t[102]=he,t[103]=y,t[104]=Z):Z=t[104],Z}function be(e){return e.stopPropagation()}function xe(e){return e.stopPropagation()}function Se(e){return(0,Q.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 $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ce(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function we(e){let t=$(e)?e:{},n=$(t.session)?t.session:{},r=$(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:Ce(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function Te(e){await c(s(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),G()}function Ee(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,H,`dark:border-edge`)}var De=m();function Oe({hasToken:e}){let t=o(l(e=>e.language)).sessions.config,{data:n,isLoading:r}=F(e),i=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:we(n.payload.config),[n]),[a,s]=(0,Z.useReducer)(De,{form:null,baseline:null}),c=a.form,u=a.baseline,[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),h=(0,Z.useRef)(!1),v=(0,Z.useRef)(null);ee({enabled:e,parsed:i,dirty:h.current,trackedParsedRef:v,dispatch:s,onResetDirty:()=>{h.current=!1}});let y=c&&u&&JSON.stringify(c)!==JSON.stringify(u),b=(0,Z.useCallback)(e=>{h.current=!0,s({type:`patch`,patch:e})},[]);return!e||!c?r?(0,Q.jsx)(Y,{children:(0,Q.jsx)(pe,{className:`size-4 animate-spin text-fg-muted`})}):null:(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(J,{icon:_,title:t.title,subtitle:t.hint}),(0,Q.jsxs)(`div`,{className:`mb-4 flex justify-end gap-2`,children:[(0,Q.jsx)(P,{type:`button`,variant:`secondary`,disabled:!y||d,onClick:()=>s({type:`discard`}),children:t.discard}),(0,Q.jsx)(P,{type:`button`,variant:`primary`,disabled:!y||d,onClick:()=>{(async()=>{f(!0),m(null);try{await Te(c),h.current=!1,s({type:`saved`,value:c})}catch(e){m(e instanceof Error?e.message:t.saveError)}finally{f(!1)}})()},children:d?t.saving:t.save})]}),p?(0,Q.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:p}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Q.jsxs)(g,{className:Ee(),value:c.dmScope,onChange:e=>b({dmScope:e.target.value}),children:[(0,Q.jsx)(W,{value:`main`,children:t.dmScopeMain}),(0,Q.jsx)(W,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Q.jsx)(W,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Q.jsx)(W,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Q.jsx)(`input`,{type:`number`,min:0,className:Ee(),value:c.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();b({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Q.jsx)(`input`,{type:`number`,min:1,className:Ee(),value:c.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();b({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})]})]})}function ke(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 Ae(e){let t=(0,ge.c)(60),{open:n,loading:r,session:i,sessionAgentId:o,sessionAgentAvatar:s,labels:c,onClose:l,onArchive:u,onUnarchive:d,onPin:f,onUnpin:m,onExport:g,onDelete:_}=e,v=i?.status===`archived`,ee=i?.status===`pinned`,x;t[0]===l?x=t[1]:(x=e=>!e&&l(),t[0]=l,t[1]=x);let S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(y,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[2]=S):S=t[2];let w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=a(`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`,te,`dark:border-edge`),t[3]=w):w=t[3];let T;t[4]!==i||t[5]!==s||t[6]!==o?(T=i&&o?(0,Q.jsx)(ue,{agentId:o,avatar:s,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=s,t[6]=o,t[7]=T):T=t[7];let E;t[8]!==c.unnamedSession||t[9]!==i?.name?(E=i?.name?.trim()||c.unnamedSession,t[8]=c.unnamedSession,t[9]=i?.name,t[10]=E):E=t[10];let D;t[11]===E?D=t[12]:(D=(0,Q.jsx)(h,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:E}),t[11]=E,t[12]=D);let O;t[13]!==T||t[14]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[T,D]}),t[13]=T,t[14]=D,t[15]=O):O=t[15];let k;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(de,{className:`size-5`,strokeWidth:1.75}),t[16]=k):k=t[16];let A;t[17]===c.close?A=t[18]:(A=(0,Q.jsx)(p,{asChild:!0,children:(0,Q.jsx)(P,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":c.close,children:k})}),t[17]=c.close,t[18]=A);let j;t[19]!==O||t[20]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[O,A]}),t[19]=O,t[20]=A,t[21]=j):j=t[21];let M;t[22]!==c.detailLoading||t[23]!==c.detailMessages||t[24]!==r||t[25]!==i?(M=r?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.detailLoading}):i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Q.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Q.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:c.detailMessages}),(0,Q.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(je)})]}):null,t[22]=c.detailLoading,t[23]=c.detailMessages,t[24]=r,t[25]=i,t[26]=M):M=t[26];let N;t[27]===M?N=t[28]:(N=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:M}),t[27]=M,t[28]=N);let F;t[29]!==c.detailExport||t[30]!==g?(F=(0,Q.jsx)(P,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:g,children:c.detailExport}),t[29]=c.detailExport,t[30]=g,t[31]=F):F=t[31];let I;t[32]!==v||t[33]!==c.archive||t[34]!==c.unarchive||t[35]!==u||t[36]!==d?(I=v?(0,Q.jsx)(P,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:d,children:c.unarchive}):(0,Q.jsx)(P,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:u,children:c.archive}),t[32]=v,t[33]=c.archive,t[34]=c.unarchive,t[35]=u,t[36]=d,t[37]=I):I=t[37];let L;t[38]!==ee||t[39]!==c.pin||t[40]!==c.unpin||t[41]!==f||t[42]!==m?(L=ee?(0,Q.jsx)(P,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:m,children:c.unpin}):(0,Q.jsx)(P,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:f,children:c.pin}),t[38]=ee,t[39]=c.pin,t[40]=c.unpin,t[41]=f,t[42]=m,t[43]=L):L=t[43];let R;t[44]!==c.delete||t[45]!==_?(R=(0,Q.jsx)(P,{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:_,children:c.delete}),t[44]=c.delete,t[45]=_,t[46]=R):R=t[46];let z;t[47]!==F||t[48]!==I||t[49]!==L||t[50]!==R?(z=(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[F,I,L,R]})}),t[47]=F,t[48]=I,t[49]=L,t[50]=R,t[51]=z):z=t[51];let B;t[52]!==j||t[53]!==N||t[54]!==z?(B=(0,Q.jsxs)(b,{children:[S,(0,Q.jsxs)(ne,{className:w,"aria-describedby":void 0,children:[j,N,z]})]}),t[52]=j,t[53]=N,t[54]=z,t[55]=B):B=t[55];let V;return t[56]!==n||t[57]!==x||t[58]!==B?(V=(0,Q.jsx)(re,{open:n,onOpenChange:x,children:B}),t[56]=n,t[57]=x,t[58]=B,t[59]=V):V=t[59],V}function je(e){return(0,Q.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Q.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:ke(e.content)})]},`${e.timestamp??``}-${e.role}-${ke(e.content).slice(0,24)}`)}var Me=20;function Ne(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var Pe=new Set([`all`,`active`,`pinned`,`archived`]),Fe=new Set([`grid`,`list`]),Ie=[`sessions`,`settings`];function Le(e){return e&&Ie.includes(e)?e:`sessions`}function Re(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function ze(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function Be(e){let t=(0,ge.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=Ie.map(e=>({id:e,label:Re(n,e),icon:e===`sessions`?f:T})),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,Q.jsx)(X,{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 Ve(e){let t=(0,ge.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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-5`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:Re(n,r)}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:ze(n,r)})]}),(0,Q.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,Q.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 He(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:Pe.has(t)?t:`all`,viewMode:Fe.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 Ue(){let e=o(l(e=>e.language)),t=e.sessions,n=u(e=>e.token),r=!!n,{data:s,mutate:c}=d(r?[`gateway-chat-agents`,n]:null,ae,{revalidateOnFocus:!1}),p=s?.defaultId??`main`,m=s?.items??[],[g,_]=i(),v=Le(g.get(`tab`)),ee=(0,Z.useCallback)(e=>{let t=new URLSearchParams(g);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),_(t,{replace:!0})},[g,_]),[T,k]=(0,Z.useReducer)(R,g,He),{searchInput:A,debouncedSearch:F,statusFilter:I,viewMode:L,channelFilter:H,sessions:W,loading:G,error:le,hasMore:ue,stats:q,detailOpen:de,detailLoading:pe,detailSession:J,confirmOpen:Y,confirmKey:X}=T;(0,Z.useEffect)(()=>{let e=setTimeout(()=>{let e=A.trim();F!==e&&k({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[A,F]);let ge=g.toString(),_e=(0,Z.useRef)(ge);if(_e.current!==ge){_e.current=ge;let e=g.get(`q`)??``,t=g.get(`status`),n=g.get(`view`),r=(g.get(`channel`)??``).trim(),i=Pe.has(t)?t:`all`,a=Fe.has(n)?n:`grid`,o=e.trim();k({type:`patch`,patch:{...A===e?{}:{searchInput:e},...F===o?{}:{debouncedSearch:o},...I===i?{}:{statusFilter:i},...L===a?{}:{viewMode:a},...H===r?{}:{channelFilter:r}}})}(0,Z.useEffect)(()=>{let e=new URLSearchParams(g),t=F.trim();t?e.set(`q`,t):e.delete(`q`),I===`all`?e.delete(`status`):e.set(`status`,I),L===`grid`?e.delete(`view`):e.set(`view`,L),H?e.set(`channel`,H):e.delete(`channel`),e.toString()!==g.toString()&&_(e,{replace:!0})},[F,g,_,I,L,H]),(0,Z.useEffect)(()=>{if(!r||v!==`sessions`)return;let e=!1;return(async()=>{k({type:`patch`,patch:{loading:!0,error:null}});try{let t=await V({limit:Me,offset:0,...F?{search:F}:{},...I===`all`?{}:{status:I},...H?{channel:H}:{}});if(e)return;k({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||k({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||k({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,v,F,I,H,t.loadError]),(0,Z.useEffect)(()=>{!r||v!==`sessions`||U().then(e=>k({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,v]),(0,Z.useEffect)(()=>{if(!r||v!==`sessions`)return;let e=()=>void c();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,v,c]),(0,Z.useEffect)(()=>{if(!r||v!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||k({type:`patch`,patch:{sessions:W.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:J&&J.key===t.key?{...J,name:t.name}:J}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,v,W,J]);let ve=(0,Z.useCallback)(async()=>{if(!(!r||G||!ue)){k({type:`patch`,patch:{loading:!0,error:null}});try{let e=await V({limit:Me,offset:W.length,...F?{search:F}:{},...I===`all`?{}:{status:I},...H?{channel:H}:{}});k({type:`patch`,patch:{sessions:[...W,...e.items],hasMore:e.hasMore}})}catch(e){k({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{k({type:`patch`,patch:{loading:!1}})}}},[r,G,ue,W.length,F,I,H,t.loadError]),be=(0,Z.useCallback)((e,t)=>{k({type:`patch`,patch:{sessions:W.map(n=>n.key===e?{...n,status:t}:n),detailSession:J&&J.key===e?{...J,status:t}:J}})},[W,J]),xe=(0,Z.useCallback)(async e=>{k({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{k({type:`patch`,patch:{detailSession:await M(e)}})}catch{k({type:`patch`,patch:{detailOpen:!1}})}finally{k({type:`patch`,patch:{detailLoading:!1}})}},[]),Se=e=>{xe(e)},$=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:e},bubbles:!0}));return}if(t===`delete`){k({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await z(e),be(e,`archived`);break;case`unarchive`:await E(e),be(e,`active`);break;case`pin`:await N(e),be(e,`pinned`);break;case`unpin`:await se(e),be(e,`active`);break;case`export`:{let t=await j(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}U().then(e=>k({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Ce=async e=>{try{await oe(e),k({type:`patch`,patch:{sessions:W.filter(t=>t.key!==e),detailSession:J?.key===e?null:J,...J?.key===e?{detailOpen:!1}:{}}}),U().then(e=>k({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},we={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},Te={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},Ee=[{key:`all`,label:t.filterAll,icon:f},{key:`active`,label:t.filterActive,icon:x},{key:`pinned`,label:t.filterPinned,icon:O},{key:`archived`,label:t.filterArchived,icon:fe}],De=(()=>{let e=Object.entries(q?.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,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,Q.jsx)(`header`,{className:`flex flex-col gap-2`,children:(0,Q.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:t.title})}),(0,Q.jsx)(Be,{s:t,activeTab:v,onChange:ee}),(0,Q.jsx)(Ve,{s:t,id:`settings`,activeTab:v,plain:!0,children:(0,Q.jsx)(Oe,{hasToken:r})}),(0,Q.jsxs)(Ve,{s:t,id:`sessions`,activeTab:v,plain:!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ee.map(({key:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":I===e,onClick:()=>k({type:`patch`,patch:{statusFilter:e}}),className:a(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,B.transition,B.focusRingPanel,I===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Q.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,Q.jsx)(ie,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:A,onChange:e=>k({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"data-debounced-query":F||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,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":!H,onClick:()=>k({type:`patch`,patch:{channelFilter:``}}),className:a(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,B.transition,B.focusRingPanel,H?`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}),De.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":H===e,onClick:()=>k({type:`patch`,patch:{channelFilter:e}}),className:a(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,B.transition,B.focusRingPanel,H===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,q?.byChannel?.[e]==null?null:(0,Q.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:q.byChannel[e]})]},e))]}),q?(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[q.totalSessions,t.totalSessions],[q.activeSessions,t.activeSessions],[q.pinnedSessions,t.pinnedSessions],[q.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Q.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,le?(0,Q.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:le}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:Ne(t.sessionCount,{count:W.length})}),(0,Q.jsxs)(`div`,{className:he,role:`group`,"aria-label":t.layoutToggleGroup,children:[(0,Q.jsx)(P,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":L===`grid`,onClick:()=>k({type:`patch`,patch:{viewMode:`grid`}}),className:a(me,`size-7 p-0`,L===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,L===`grid`&&`text-accent-fg`),children:(0,Q.jsx)(w,{className:`size-3.5`,strokeWidth:1.5})}),(0,Q.jsx)(P,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":L===`list`,onClick:()=>k({type:`patch`,patch:{viewMode:`list`}}),className:a(me,`size-9 p-0`,L===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,L===`list`&&`text-accent-fg`),children:(0,Q.jsx)(S,{className:`size-3.5`,strokeWidth:1.5})})]})]}),G&&W.length===0?(0,Q.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,Q.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):W.length===0?(0,Q.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,Q.jsx)(ce,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Q.jsx)(P,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:a(`grid min-w-0 gap-3`,L===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":F||void 0,children:W.map(e=>{let t=D(e,p);return(0,Q.jsx)(ye,{session:e,variant:L,labels:we,sessionAgentId:t,sessionAgentAvatar:K(t,m),onOpen:()=>Se(e.key),onAction:t=>void $(e.key,t)},e.key)})}),ue?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(P,{type:`button`,variant:`secondary`,disabled:G,onClick:()=>void ve(),children:t.loadMore})}):null]})]})]}),(0,Q.jsx)(Ae,{open:de,loading:pe,session:J,sessionAgentId:J?D(J,p):void 0,sessionAgentAvatar:J?K(D(J,p),m):void 0,labels:Te,onClose:()=>{k({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>J&&void $(J.key,`archive`),onUnarchive:()=>J&&void $(J.key,`unarchive`),onPin:()=>J&&void $(J.key,`pin`),onUnpin:()=>J&&void $(J.key,`unpin`),onExport:()=>J&&void $(J.key,`export`),onDelete:()=>J&&k({type:`patch`,patch:{confirmKey:J.key,confirmOpen:!0}})}),(0,Q.jsx)(re,{open:Y,onOpenChange:e=>k({type:`patch`,patch:{confirmOpen:e}}),children:(0,Q.jsxs)(b,{children:[(0,Q.jsx)(y,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),(0,Q.jsxs)(ne,{className:a(`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`,te),children:[(0,Q.jsx)(h,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:X?Ne(t.deleteSessionMessage,{name:W.find(e=>e.key===X)?.name?.trim()||e.chat.newSession}):``}),(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(P,{type:`button`,variant:`secondary`,onClick:()=>k({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Q.jsx)(P,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{X&&Ce(X),k({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Q.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{Ue as SessionsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ri as e}from"./index-CH7XN6KY.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{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{tu as a}from"./index-CH7XN6KY.js";import{t as o}from"./settings-advanced-gate-DwuBL834.js";var s=n(),c=e(t(),1),l=r();function u(e){let t=(0,s.c)(26),{showLabel:n,hideLabel:r,icon:u,hint:d,children:f,className:p,defaultOpen:m,advancedOnly:h}=e,g=h===void 0?!1:h,[_,v]=(0,c.useState)(m??!1),y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>v(e.currentTarget.open),t[0]=y):y=t[0];let b;t[1]===p?b=t[2]:(b=i(`group rounded-2xl bg-surface-base open:pb-1`,p),t[1]=p,t[2]=b);let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,l.jsx)(a,{className:`size-4 shrink-0 text-fg-muted transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[3]=x):x=t[3];let S;t[4]===u?S=t[5]:(S=u?(0,l.jsx)(u,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[4]=u,t[5]=S);let C;t[6]===n?C=t[7]:(C=(0,l.jsx)(`span`,{className:`group-open:hidden`,children:n}),t[6]=n,t[7]=C);let w;t[8]===r?w=t[9]:(w=(0,l.jsx)(`span`,{className:`hidden group-open:inline`,children:r}),t[8]=r,t[9]=w);let T;t[10]!==S||t[11]!==C||t[12]!==w?(T=(0,l.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-2xl px-4 py-3.5 text-sm font-medium text-fg transition-colors hover:text-fg group-open:rounded-b-none [&::-webkit-details-marker]:hidden`,children:[x,S,C,w]}),t[10]=S,t[11]=C,t[12]=w,t[13]=T):T=t[13];let E;t[14]===d?E=t[15]:(E=d?(0,l.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:d}):null,t[14]=d,t[15]=E);let D;t[16]!==f||t[17]!==E?(D=(0,l.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[E,f]}),t[16]=f,t[17]=E,t[18]=D):D=t[18];let O;t[19]!==_||t[20]!==D||t[21]!==b||t[22]!==T?(O=(0,l.jsxs)(`details`,{open:_,onToggle:y,className:b,children:[T,D]}),t[19]=_,t[20]=D,t[21]=b,t[22]=T,t[23]=O):O=t[23];let k=O;if(g){let e;return t[24]===k?e=t[25]:(e=(0,l.jsx)(o,{children:k}),t[24]=k,t[25]=e),e}return k}export{u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{ls as r,xc as i}from"./index-CH7XN6KY.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)(6),{children:r,className:i,id:c}=e,l;t[0]===i?l=t[1]:(l=n(o(),i),t[0]=i,t[1]=l);let u;return t[2]!==r||t[3]!==c||t[4]!==l?(u=(0,s.jsx)(`section`,{id:c,className:l,children:r}),t[2]=r,t[3]=c,t[4]=l,t[5]=u):u=t[5],u}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`,r.press):n(l,`hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,r.press),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)(i,{className:`size-2.5`,strokeWidth:2.25})})]}):(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className: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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{ao as n}from"./index-CH7XN6KY.js";var r=e(),i=t();function a(e){let t=(0,r.c)(3),{sections:a}=e,s=a===void 0?2:a,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(n,{className:`h-6 w-48 max-w-full`}),(0,i.jsx)(n,{className:`h-4 w-80 max-w-full`})]}),t[0]=c):c=t[0];let l;return t[1]===s?l=t[2]:(l=(0,i.jsxs)(`div`,{className:`flex flex-col gap-6`,"aria-busy":`true`,children:[c,Array.from({length:s}).map(o)]}),t[1]=s,t[2]=l),l}function o(e,t){return(0,i.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,i.jsx)(n,{className:`h-5 w-40 max-w-full`}),(0,i.jsx)(n,{className:`mt-2 h-4 w-72 max-w-full`}),(0,i.jsx)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:Array.from({length:4}).map(s)})]},t)}function s(e,t){return(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(n,{className:`h-3 w-24`}),(0,i.jsx)(n,{className:`h-10 w-full rounded-lg`})]},t)}function c(e){let t=(0,r.c)(2),{rows:n}=e,a=n===void 0?3:n,o;return t[0]===a?o=t[1]:(o=(0,i.jsx)(`div`,{className:`flex flex-col gap-3`,"aria-busy":`true`,children:Array.from({length:a}).map(l)}),t[0]=a,t[1]=o),o}function l(e,t){return(0,i.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,i.jsx)(n,{className:`h-4 w-40 max-w-full`}),(0,i.jsx)(n,{className:`mt-2 h-3 w-64 max-w-full`})]},t)}function u(e){let t=(0,r.c)(2),{rows:n}=e,a=n===void 0?3:n,o;return t[0]===a?o=t[1]:(o=(0,i.jsx)(`div`,{className:`flex flex-col gap-2.5`,"aria-busy":`true`,children:Array.from({length:a}).map(d)}),t[0]=a,t[1]=o),o}function d(e,t){return(0,i.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,i.jsx)(n,{className:`h-4 w-48 max-w-full`}),(0,i.jsx)(n,{className:`mt-2 h-3 w-72 max-w-full`})]},t)}export{a as n,c as r,u as t};
|
package/dist/gateway/static/root/assets/{settings-page-yv4TeHfF.js → settings-page-BNrVwuL7.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{r as i,u as a}from"./chunk-QUQL4437-DXsxWP7r.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{r as i,u as a}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as o}from"./messages-t1yPaVCt.js";import{n as s}from"./locale-store-BneNAR8R.js";import{Co as c,Eo as l,So as u,To as d,_o as f,bo as p,fo as m,go as h,ho as g,mo as _,po as v,vo as y,wo as b,xo as x,yo as S}from"./index-CH7XN6KY.js";var C=n(),w=e(t(),1),T=r(),E=[`overview`,`appearance`,`keyboard-shortcuts`,`user-profile`,`system`,`desktop-pet`,`desktop-app`,`credentials`,`capability-presets`,`gateway`,`heartbeat`,`remote-access`,`shares`,`goals`,`dreams`],D=(0,w.lazy)(()=>c().then(e=>({default:e.SetupStatusPanel}))),O=(0,w.lazy)(()=>v().then(e=>({default:e.AppearanceSettingsPanel}))),k=(0,w.lazy)(()=>p().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),A=(0,w.lazy)(()=>l().then(e=>({default:e.UserProfileSettingsPanel}))),j=(0,w.lazy)(()=>d().then(e=>({default:e.SystemSettingsPanel}))),M=(0,w.lazy)(()=>g().then(e=>({default:e.DesktopPetSettings}))),N=(0,w.lazy)(()=>m().then(e=>({default:e.AppManagementSettingsPanel}))),P=(0,w.lazy)(()=>x().then(e=>({default:e.ModelsHubPanel}))),F=(0,w.lazy)(()=>f().then(e=>({default:e.GatewaySettingsPanel}))),I=(0,w.lazy)(()=>S().then(e=>({default:e.HeartbeatSettingsPanel}))),L=(0,w.lazy)(()=>u().then(e=>({default:e.RemoteAccessHub}))),R=(0,w.lazy)(()=>b().then(e=>({default:e.SharesSettingsPanel}))),z=(0,w.lazy)(()=>h().then(e=>({default:e.DreamingSettingsPanel}))),B=(0,w.lazy)(()=>y().then(e=>({default:e.GoalsSettingsPanel}))),V=(0,w.lazy)(()=>_().then(e=>({default:e.CapabilityPresetsSettingsPanel})));function H(){let e=(0,C.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,T.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,T.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,T.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,T.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function U(e){return(0,T.jsx)(w.Suspense,{fallback:(0,T.jsx)(H,{}),children:(0,T.jsx)(e,{})})}function W(){let e=(0,C.c)(30),{section:t}=a(),n=s(G),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let a=o(n);if(!t||!E.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,T.jsx)(i,{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=U(D),e[8]=t):t=e[8],d=t;break bb0}let f=a.settingsSections[s];if(s===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=U(O),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=U(k),e[10]=t):t=e[10],d=t;break bb0}if(s===`user-profile`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=U(A),e[11]=t):t=e[11],d=t;break bb0}if(s===`system`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=U(j),e[12]=t):t=e[12],d=t;break bb0}if(s===`desktop-pet`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=U(M),e[13]=t):t=e[13],d=t;break bb0}if(s===`desktop-app`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=U(N),e[14]=t):t=e[14],d=t;break bb0}if(s===`credentials`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=U(P),e[15]=t):t=e[15],d=t;break bb0}if(s===`capability-presets`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=U(V),e[16]=t):t=e[16],d=t;break bb0}if(s===`gateway`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=U(F),e[17]=t):t=e[17],d=t;break bb0}if(s===`heartbeat`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=U(I),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=U(L),e[19]=t):t=e[19],d=t;break bb0}if(s===`shares`){let t;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=U(R),e[20]=t):t=e[20],d=t;break bb0}if(s===`dreams`){let t;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(t=U(z),e[21]=t):t=e[21],d=t;break bb0}if(s===`goals`){let t;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(t=U(B),e[22]=t):t=e[22],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,T.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=a.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[23]!==r||e[24]!==c?(f=(0,T.jsx)(`p`,{className:r,children:c}),e[23]=r,e[24]=c,e[25]=f):f=e[25];let p;return e[26]!==l||e[27]!==u||e[28]!==f?(p=(0,T.jsxs)(`div`,{className:l,children:[u,f]}),e[26]=l,e[27]=u,e[28]=f,e[29]=p):p=e[29],p}function G(e){return e.language}export{W as SettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{Ol as r}from"./index-CH7XN6KY.js";var i=e(),a=t();function o(e){let t=(0,i.c)(14),r,o,s,c,l;t[0]===e?(r=t[1],o=t[2],s=t[3],c=t[4],l=t[5]):({children:r,className:o,gap:c,padding:l,...s}=e,t[0]=e,t[1]=r,t[2]=o,t[3]=s,t[4]=c,t[5]=l);let u=c===void 0?`gap-4`:c,d=l===void 0?`px-3 py-6 sm:px-5 xl:px-6`:l,f;t[6]!==o||t[7]!==u||t[8]!==d?(f=n(`flex min-h-full w-full flex-col bg-surface-panel`,u,d,o),t[6]=o,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;return t[10]!==r||t[11]!==s||t[12]!==f?(p=(0,a.jsx)(`div`,{className:f,...s,children:r}),t[10]=r,t[11]=s,t[12]=f,t[13]=p):p=t[13],p}function s(e){let t=(0,i.c)(20),{title:o,subtitle:s,docsLink:c,docsLabel:l,meta:u,actions:d,className:f}=e,p;t[0]===f?p=t[1]:(p=n(`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,f),t[0]=f,t[1]=p);let m;t[2]===o?m=t[3]:(m=(0,a.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:o}),t[2]=o,t[3]=m);let h;t[4]===s?h=t[5]:(h=s?(0,a.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:s}):null,t[4]=s,t[5]=h);let g;t[6]!==l||t[7]!==c?(g=c&&l?(0,a.jsxs)(`a`,{href:c,target:`_blank`,rel:`noreferrer`,className:`mt-1 inline-flex items-center gap-1 text-sm text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[l,(0,a.jsx)(r,{className:`size-3.5`,"aria-hidden":!0})]}):null,t[6]=l,t[7]=c,t[8]=g):g=t[8];let _;t[9]!==u||t[10]!==m||t[11]!==h||t[12]!==g?(_=(0,a.jsxs)(`div`,{className:`min-w-0`,children:[m,h,g,u]}),t[9]=u,t[10]=m,t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]===d?v=t[15]:(v=d?(0,a.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2`,children:d}):null,t[14]=d,t[15]=v);let y;return t[16]!==p||t[17]!==_||t[18]!==v?(y=(0,a.jsxs)(`header`,{className:p,children:[_,v]}),t[16]=p,t[17]=_,t[18]=v,t[19]=y):y=t[19],y}function c(e){let t=(0,i.c)(13),{id:r,activeTab:o,tabIdPrefix:s,panelIdPrefix:c,title:l,hint:u,showHeading:d,framed:f,children:p,className:m}=e,h=d===void 0?!0:d,g=f===void 0?!0:f;if(o!==r)return null;let _=`${c}-${r}`,v=`${s}-${r}`,y=g&&`rounded-2xl border border-edge-subtle bg-surface-base px-4 py-5 sm:px-5`,b;t[0]!==m||t[1]!==y?(b=n(`min-w-0`,y,m),t[0]=m,t[1]=y,t[2]=b):b=t[2];let x;t[3]!==u||t[4]!==h||t[5]!==l?(x=h&&(l||u)?(0,a.jsxs)(`div`,{className:`mb-5`,children:[l?(0,a.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:l}):null,u?(0,a.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:u}):null]}):null,t[3]=u,t[4]=h,t[5]=l,t[6]=x):x=t[6];let S;return t[7]!==p||t[8]!==_||t[9]!==v||t[10]!==b||t[11]!==x?(S=(0,a.jsxs)(`section`,{id:_,role:`tabpanel`,"aria-labelledby":v,className:b,children:[x,p]}),t[7]=p,t[8]=_,t[9]=v,t[10]=b,t[11]=x,t[12]=S):S=t[12],S}export{s as n,c as r,o 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{t as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./messages-t1yPaVCt.js";import{d as s,i as c,n as l,o as u}from"./locale-store-BneNAR8R.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$l as f,As as p,Bs as m,Hn as h,Ul as g,Wl as _,Xn as v,Zl as y,Zn as b,cc as ee,ei as x,io as S,ls as C,nl as w,rr as T,ss as E,xu as D,zc as O}from"./index-CH7XN6KY.js";import{n as k,t as A}from"./settings-page-layout-HdlQOOqp.js";import{n as j}from"./settings-loading-skeleton-vitElc-n.js";import{n as M,t as N}from"./settings-form-section-CjINay6t.js";var P=e(t(),1),F=n();function I(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`&&E(e)).length}function L(e){if(!e||typeof e!=`object`)return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t,r=typeof n.defaultPreset==`string`&&n.defaultPreset.trim()?n.defaultPreset.trim():`default`,i=n.capabilityPresets,a=i&&typeof i==`object`&&!Array.isArray(i)?i[r]:void 0,o=a&&typeof a==`object`&&!Array.isArray(a)?a.models:void 0;if(!o||typeof o!=`object`||Array.isArray(o))return``;let s=o,c=s.roles;if(!c||typeof c!=`object`||Array.isArray(c))return``;let l=c,u=typeof s.defaultRole==`string`&&s.defaultRole.trim()?s.defaultRole.trim():Object.keys(l)[0],d=u?l[u]:void 0;if(!d||typeof d!=`object`||Array.isArray(d))return``;let f=d.model;return typeof f==`string`?f.trim():``}function R(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 z(e){if(!e||typeof e!=`object`)return{enabled:!1,backend:`extension`};let t=e.browser;if(!t||typeof t!=`object`||Array.isArray(t))return{enabled:!1,backend:`extension`};let n=t;return{enabled:n.enabled===!0,backend:typeof n.backend==`string`&&n.backend.trim()?n.backend.trim():`extension`}}function B(e){return e?`pass`:`fail`}function V(e){if(e===`provider-auth`)return`/settings/credentials`;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 H(e){return{fail:4,warn:3,skip:2,pass:1}[e]}function te(e){return e.filter(e=>e.status===`fail`||e.status===`warn`).map(e=>({id:e.id,label:e.label,status:e.status,message:e.message,hints:e.hints,path:V(e.id),source:`doctor`})).toSorted((e,t)=>H(t.status)-H(e.status)||e.label.localeCompare(t.label))}function U(e){let t=new Map(e.doctorChecks.map(e=>[e.id,e])),n=[];for(let e of[`security-audit`,`channel-config`,`channel-pairing-pending`,`gateway-health`]){let r=t.get(e);r&&n.push({id:r.id,label:r.label,status:r.status,message:r.message,path:V(r.id)})}if(e.logsHealth){let t=e.logsHealth.stats?.errorsLast24h??0;n.push({id:`logs-health`,label:`Logs`,status:e.logsHealth.shuttingDown||t>0?`warn`:`pass`,message: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??[])n.push(t);return n}function ne(e){let t=I(e.config),n=e.providerMeta?.configured??t,r=e.providerMeta?.total??0,i=n>0||t>0,a=L(e.config),o=a.length>0,s=e.hasToken&&e.sseConnected,c=R(e.config),l=e.skillCount>0,u=e.doctorChecks??[],d=te(u),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:B(s),title:`Gateway`,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline,path:`/settings/gateway`},{id:`provider`,status:B(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/credentials`},{id:`defaultModel`,status:B(o),title:`Default model`,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing,path:`/settings/credentials?tab=services`},{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=U({doctorChecks:u,logsHealth:e.logsHealth,browserDiagnostics:e.browserDiagnostics});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 re(e){return z(e)}function W(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 ie(){return s(`/api/doctor`)}async function ae(){return((await c(ie())).checks??[]).map(W).filter(e=>e!==null)}function oe(){return s(`/api/logs/health`)}async function se(){return c(oe())}function G(e){return e?`pass`:`warn`}function K(e){return`/settings/agent-browser?tab=${encodeURIComponent(e)}`}function ce(e){return e?.enabled?[`setup-browser-diagnostics`,e]:null}async function le(e){if(!e.enabled)return[];if(e.backend===`local`){let e=await c(s(`/api/browser/playwright/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-playwright`,label:`Browser: Playwright`,status:G(t),message:t?`Local Chromium is installed.`:e.payload?.reason??`Local Chromium is not installed.`,path:K(`local`)}]}if(e.backend===`cloakbrowser`){let e=await c(s(`/api/browser/cloakbrowser/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-cloakbrowser`,label:`Browser: CloakBrowser`,status:G(t),message:t?`CloakBrowser ${e.payload?.version??``}`.trim():`CloakBrowser is not installed.`,path:K(`cloakbrowser`)}]}if(e.backend===`extension`){let e=await c(s(`/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:K(`extension`)}]}return[{id:`browser-playwright`,label:`Browser`,status:`skip`,message:`Browser backend "${e.backend}" is not checked on this overview.`,path:K(e.backend||`overview`)}]}function q(){let e=(0,F.c)(57),t=u(he),n=l(me),r;e[0]===n?r=e[1]:(r=o(n),e[0]=n,e[1]=r);let i=r,a=i.setupStatus.labels,s=T(pe),{data:c,error:f,isLoading:p,mutate:m}=S(!!t),g;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},e[2]=g):g=e[2];let{data:_,error:y,isLoading:ee,mutate:x}=d(t?`setup-checklist-skills`:null,fe,g),C;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},e[3]=C):C=e[3];let{data:w,error:E,isLoading:D,mutate:O}=d(t?`setup-checklist-provider-meta`:null,h,C),k;e[4]===t?k=e[5]:(k=t?ie():null,e[4]=t,e[5]=k);let A;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(A={revalidateOnFocus:!1},e[6]=A):A=e[6];let{data:j,error:M,isLoading:N,mutate:P}=d(k,ae,A),I;e[7]===t?I=e[8]:(I=t?oe():null,e[7]=t,e[8]=I);let L;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(L={revalidateOnFocus:!1},e[9]=L):L=e[9];let{data:R,isLoading:z,mutate:B}=d(I,se,L);c?.payload?.config;let V=c?.payload?.config,H;e[10]===V?H=e[11]:(H=re(V),e[10]=V,e[11]=H);let te=t?H:null,U;e[12]===te?U=e[13]:(U=ce(te),e[12]=te,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:K,mutate:le}=d(U,de,W),q;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(q={revalidateOnFocus:!1},e[15]=q):q=e[15],d(t?v:null,b,q);let J=!t||!p&&!ee&&!D&&!N&&!z&&!K,Y=!!(f||y||E||M),X;bb0:{if(!t||!J){X=null;break bb0}let n=_?.catalog?.length??0,r;if(e[16]!==G||e[17]!==c?.payload?.config||e[18]!==j||e[19]!==a.channelConfigured||e[20]!==a.channelMissing||e[21]!==a.gatewayOffline||e[22]!==a.gatewayOnline||e[23]!==a.modelConfigured||e[24]!==a.modelMissing||e[25]!==a.providersConfigured||e[26]!==a.providersMetaReady||e[27]!==a.providersMissing||e[28]!==a.skillsConfigured||e[29]!==a.skillsMissing||e[30]!==R||e[31]!==i.setupStatus.requiredCompleteMessage||e[32]!==w||e[33]!==n||e[34]!==s||e[35]!==t){let o=w?.filter(ue).length??0,l=w?.length??0,u;e[37]===a.providersConfigured?u=e[38]:(u=e=>a.providersConfigured.replace(`{{count}}`,String(e)),e[37]=a.providersConfigured,e[38]=u);let d;e[39]===a.providersMetaReady?d=e[40]:(d=(e,t)=>a.providersMetaReady.replace(`{{configured}}`,String(e)).replace(`{{total}}`,String(t)),e[39]=a.providersMetaReady,e[40]=d);let f;e[41]===a.modelConfigured?f=e[42]:(f=e=>a.modelConfigured.replace(`{{model}}`,e),e[41]=a.modelConfigured,e[42]=f);let p;e[43]===a.skillsConfigured?p=e[44]:(p=e=>a.skillsConfigured.replace(`{{count}}`,String(e)),e[43]=a.skillsConfigured,e[44]=p),r=ne({hasToken:!!t,sseConnected:s,config:c?.payload?.config,skillCount:n,providerMeta:l>0?{configured:o,total:l}:null,doctorChecks:j,logsHealth:R,browserDiagnostics:G,labels:{gatewayOnline:a.gatewayOnline,gatewayOffline:a.gatewayOffline,providersConfigured:u,providersMetaReady:d,providersMissing:a.providersMissing,modelConfigured:f,modelMissing:a.modelMissing,channelConfigured:a.channelConfigured,channelMissing:a.channelMissing,skillsConfigured:p,skillsMissing:a.skillsMissing,readyToChat:i.setupStatus.requiredCompleteMessage}}),e[16]=G,e[17]=c?.payload?.config,e[18]=j,e[19]=a.channelConfigured,e[20]=a.channelMissing,e[21]=a.gatewayOffline,e[22]=a.gatewayOnline,e[23]=a.modelConfigured,e[24]=a.modelMissing,e[25]=a.providersConfigured,e[26]=a.providersMetaReady,e[27]=a.providersMissing,e[28]=a.skillsConfigured,e[29]=a.skillsMissing,e[30]=R,e[31]=i.setupStatus.requiredCompleteMessage,e[32]=w,e[33]=n,e[34]=s,e[35]=t,e[36]=r}else r=e[36];X=r}let Z=X,Q;e[45]!==le||e[46]!==m||e[47]!==P||e[48]!==B||e[49]!==O||e[50]!==x?(Q=async()=>{await Promise.all([m(),x(),O(),P(),B(),le()])},e[45]=le,e[46]=m,e[47]=P,e[48]=B,e[49]=O,e[50]=x,e[51]=Q):Q=e[51];let ge=Q,$;return e[52]!==Y||e[53]!==J||e[54]!==ge||e[55]!==Z?($={ready:J,error:Y,snapshot:Z,refresh:ge},e[52]=Y,e[53]=J,e[54]=ge,e[55]=Z,e[56]=$):$=e[56],$}function ue(e){return e.configured}function de(e){let[,t]=e;return le(t)}function fe(){return x()}function pe(e){return e.connectionState===`connected`}function me(e){return e.language}function he(e){return e.token}var J=r();function Y(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 X(e){return e===`pass`?y:e===`warn`?p:e===`fail`?_:w}function Z(e,t){return e===`blocked`?{icon:_,className:`bg-red-500/10 text-red-950 dark:text-red-100`,title:t.health.blockedTitle,body:t.health.blockedBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`attention`?{icon:p,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:g,className:`bg-surface-base text-fg shadow-surface`,title:t.health.setupTitle,body:t.health.setupBody,action:t.health.continueSetup,targetId:`next-steps`}:{icon:y,className:`bg-success-soft text-success`,title:t.health.readyTitle,body:t.health.readyBody,action:t.health.startChat,actionPath:`/chat`}}function Q(e){let t=(0,F.c)(48),{tier:n,issueCount:r,onRunDoctor:s,ready:c,doctorRunning:u,doctorRunState:d}=e,p=l(ge),m,h,g,_,v,y,b,x,S,w,T;if(t[0]!==r||t[1]!==p||t[2]!==n){h=o(p).setupStatus;let e=Z(n,h),s=e.icon,c=`targetId`in e&&typeof e.targetId==`string`?e.targetId:null,l=`actionPath`in e&&typeof e.actionPath==`string`?e.actionPath:`/chat`;m=c?(0,J.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(c)?.scrollIntoView({block:`start`,behavior:`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,J.jsx)(f,{className:`size-4`,"aria-hidden":!0})]}):(0,J.jsxs)(i,{to:l,className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,J.jsx)(f,{className:`size-4`,"aria-hidden":!0})]}),T=a(`rounded-xl px-4 py-4`,e.className),w=`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,x=`flex min-w-0 gap-3`,S=(0,J.jsx)(s,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),v=`min-w-0`,y=(0,J.jsx)(`h2`,{className:`text-base font-semibold`,children:e.title}),b=(0,J.jsx)(`p`,{className:`mt-1 text-sm opacity-85`,children:e.body}),g=`mt-2 text-xs opacity-75`,_=h.health.issueCount.replace(`{{count}}`,String(r)),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,t[12]=w,t[13]=T}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],w=t[12],T=t[13];let E;t[14]!==g||t[15]!==_?(E=(0,J.jsx)(`p`,{className:g,children:_}),t[14]=g,t[15]=_,t[16]=E):E=t[16];let D;t[17]!==E||t[18]!==v||t[19]!==y||t[20]!==b?(D=(0,J.jsxs)(`div`,{className:v,children:[y,b,E]}),t[17]=E,t[18]=v,t[19]=y,t[20]=b,t[21]=D):D=t[21];let k;t[22]!==D||t[23]!==x||t[24]!==S?(k=(0,J.jsxs)(`div`,{className:x,children:[S,D]}),t[22]=D,t[23]=x,t[24]=S,t[25]=k):k=t[25];let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=a(`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`,C.press),t[26]=A):A=t[26];let j=!c||u,M;t[27]===u?M=t[28]:(M=u?(0,J.jsx)(O,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[27]=u,t[28]=M);let N=u?h.health.runDoctorRunning:h.health.runDoctor,P;t[29]!==u||t[30]!==s||t[31]!==j||t[32]!==M||t[33]!==N?(P=(0,J.jsxs)(`button`,{type:`button`,className:A,onClick:s,disabled:j,"aria-busy":u,children:[M,N]}),t[29]=u,t[30]=s,t[31]=j,t[32]=M,t[33]=N,t[34]=P):P=t[34];let I;t[35]!==m||t[36]!==P?(I=(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[m,P]}),t[35]=m,t[36]=P,t[37]=I):I=t[37];let L;t[38]!==k||t[39]!==I||t[40]!==w?(L=(0,J.jsxs)(`div`,{className:w,children:[k,I]}),t[38]=k,t[39]=I,t[40]=w,t[41]=L):L=t[41];let R=u?h.health.doctorRunningMessage:d===`success`?h.health.doctorCompleteMessage:d===`error`?h.health.doctorFailedMessage:h.health.doctorIdleMessage,z;t[42]===R?z=t[43]:(z=(0,J.jsx)(`p`,{className:`mt-3 text-xs opacity-75`,role:`status`,"aria-live":`polite`,children:R}),t[42]=R,t[43]=z);let B;return t[44]!==L||t[45]!==z||t[46]!==T?(B=(0,J.jsxs)(`section`,{className:T,children:[L,z]}),t[44]=L,t[45]=z,t[46]=T,t[47]=B):B=t[47],B}function ge(e){return e.language}function $(e){let t=(0,F.c)(34),{issue:n,fixLabel:r}=e,o;t[0]===n.status?o=t[1]:(o=X(n.status),t[0]=n.status,t[1]=o);let s=o,c;t[2]===s?c=t[3]:(c=(0,J.jsx)(s,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=s,t[3]=c);let l;t[4]===n.label?l=t[5]:(l=(0,J.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:n.label}),t[4]=n.label,t[5]=l);let u;t[6]===n.status?u=t[7]:(u=a(`rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase`,Y(n.status)),t[6]=n.status,t[7]=u);let d;t[8]!==n.status||t[9]!==u?(d=(0,J.jsx)(`span`,{className:u,children:n.status}),t[8]=n.status,t[9]=u,t[10]=d):d=t[10];let p;t[11]!==l||t[12]!==d?(p=(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[l,d]}),t[11]=l,t[12]=d,t[13]=p):p=t[13];let m;t[14]===n.message?m=t[15]:(m=(0,J.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:n.message}),t[14]=n.message,t[15]=m);let h;t[16]===n.hints[0]?h=t[17]:(h=n.hints[0]?(0,J.jsx)(`span`,{className:`mt-1 block truncate text-xs text-fg-subtle`,children:n.hints[0]}):null,t[16]=n.hints[0],t[17]=h);let g;t[18]!==p||t[19]!==m||t[20]!==h?(g=(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[p,m,h]}),t[18]=p,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _;t[22]!==r||t[23]!==n.path?(_=n.path?(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg`,children:[r,(0,J.jsx)(f,{className:`size-4`,"aria-hidden":!0})]}):null,t[22]=r,t[23]=n.path,t[24]=_):_=t[24];let v;t[25]!==_||t[26]!==c||t[27]!==g?(v=(0,J.jsxs)(J.Fragment,{children:[c,g,_]}),t[25]=_,t[26]=c,t[27]=g,t[28]=v):v=t[28];let y=v;if(n.path){let e;return t[29]!==y||t[30]!==n.path?(e=(0,J.jsx)(i,{to:n.path,className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 px-3 py-3 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:y}),t[29]=y,t[30]=n.path,t[31]=e):e=t[31],e}let b;return t[32]===y?b=t[33]:(b=(0,J.jsx)(`div`,{className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 px-3 py-3 shadow-surface`,children:y}),t[32]=y,t[33]=b),b}function _e(e){let t=(0,F.c)(27),{item:n,labels:r}=e,o;t[0]===n.status?o=t[1]:(o=X(n.status),t[0]=n.status,t[1]=o);let s=o,c=r[n.id]??n.title,l;t[2]===n.status?l=t[3]:(l=a(`flex size-7 shrink-0 items-center justify-center rounded-full border`,Y(n.status)),t[2]=n.status,t[3]=l);let u;t[4]===s?u=t[5]:(u=(0,J.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[4]=s,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,J.jsx)(`span`,{className:l,children:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let p;t[9]===c?p=t[10]:(p=(0,J.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:c}),t[9]=c,t[10]=p);let m;t[11]===n.detail?m=t[12]:(m=(0,J.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.detail}),t[11]=n.detail,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[p,m]}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;t[16]===n.path?g=t[17]:(g=n.path?(0,J.jsx)(f,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[16]=n.path,t[17]=g);let _;t[18]!==d||t[19]!==h||t[20]!==g?(_=(0,J.jsxs)(J.Fragment,{children:[d,h,g]}),t[18]=d,t[19]=h,t[20]=g,t[21]=_):_=t[21];let v=_;if(n.path){let e;return t[22]!==v||t[23]!==n.path?(e=(0,J.jsx)(i,{to:n.path,className:`flex items-center gap-3 rounded-lg px-3 py-3 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:v}),t[22]=v,t[23]=n.path,t[24]=e):e=t[24],e}let y;return t[25]===v?y=t[26]:(y=(0,J.jsx)(`div`,{className:`flex items-center gap-3 rounded-lg px-3 py-3`,children:v}),t[25]=v,t[26]=y),y}function ve(e){let t=(0,F.c)(29),{signal:n,fixLabel:r}=e,o;t[0]===n.status?o=t[1]:(o=X(n.status),t[0]=n.status,t[1]=o);let s=o,c;t[2]===s?c=t[3]:(c=(0,J.jsx)(s,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=s,t[3]=c);let l;t[4]===n.label?l=t[5]:(l=(0,J.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.label}),t[4]=n.label,t[5]=l);let u;t[6]===n.message?u=t[7]:(u=(0,J.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===n.status?f=t[12]:(f=a(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase`,Y(n.status)),t[11]=n.status,t[12]=f);let p;t[13]!==n.status||t[14]!==f?(p=(0,J.jsx)(`span`,{className:f,children:n.status}),t[13]=n.status,t[14]=f,t[15]=p):p=t[15];let m;t[16]!==r||t[17]!==n.path?(m=n.path?(0,J.jsx)(`span`,{className:`sr-only`,children:r}):null,t[16]=r,t[17]=n.path,t[18]=m):m=t[18];let h;t[19]!==c||t[20]!==d||t[21]!==p||t[22]!==m?(h=(0,J.jsxs)(J.Fragment,{children:[c,d,p,m]}),t[19]=c,t[20]=d,t[21]=p,t[22]=m,t[23]=h):h=t[23];let g=h;if(n.path){let e;return t[24]!==g||t[25]!==n.path?(e=(0,J.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:g}),t[24]=g,t[25]=n.path,t[26]=e):e=t[26],e}let _;return t[27]===g?_=t[28]:(_=(0,J.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:g}),t[27]=g,t[28]=_),_}function ye(){let e=o(l(e=>e.language)).setupStatus,{ready:t,error:n,snapshot:r,refresh:i}=q(),[s,c]=(0,P.useState)(!1),[u,d]=(0,P.useState)(`idle`),f=r?.diagnosticSignals.filter(e=>e.status===`fail`||e.status===`warn`)??[],h=async()=>{if(!(s||!t)){c(!0),d(`idle`);try{await i(),d(`success`)}catch{d(`error`)}finally{c(!1)}}};return(0,J.jsxs)(A,{gap:`gap-6`,children:[(0,J.jsx)(k,{title:e.title,subtitle:e.subtitle,actions:(0,J.jsxs)(`button`,{type:`button`,className:a(`inline-flex shrink-0 items-center gap-2 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,C.press),onClick:()=>void h(),disabled:!t||s,"aria-busy":s,children:[(0,J.jsx)(ee,{className:a(`size-4`,(!t||s)&&`animate-spin`),"aria-hidden":!0}),s?e.health.runDoctorRunning:e.refresh]})}),n?(0,J.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,J.jsx)(j,{sections:2}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{tier:r.healthTier,issueCount:r.issues.length,ready:t,onRunDoctor:()=>void h(),doctorRunning:s,doctorRunState:u}),(0,J.jsxs)(N,{id:`next-steps`,children:[(0,J.jsx)(M,{icon:r.issues.length?p:D,title:e.nextStepsTitle,subtitle:r.issues.length?e.nextStepsIssuesSubtitle:e.nextStepsReadySubtitle}),r.issues.length?(0,J.jsx)(`div`,{className:`mt-4 flex flex-col gap-2`,children:r.issues.slice(0,8).map(t=>(0,J.jsx)($,{issue:t,fixLabel:e.fixIssue},`${t.source}:${t.id}`))}):(0,J.jsx)(`div`,{className:`mt-4 rounded-lg bg-surface-panel/80 shadow-surface`,children:r.readiness.map(t=>(0,J.jsx)(_e,{item:t,labels:e.readinessLabels},t.id))})]}),(0,J.jsxs)(N,{children:[(0,J.jsx)(M,{icon:m,title:e.diagnosticsTitle,subtitle:e.diagnosticsSubtitle}),f.length?(0,J.jsx)(`div`,{className:`mt-4 grid gap-2 md:grid-cols-2`,children:f.map(t=>(0,J.jsx)(ve,{signal:t,fixLabel:e.fixIssue},t.id))}):(0,J.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-panel/80 px-3 py-3 text-sm text-fg-muted shadow-surface`,children:r.diagnosticSignals.length?e.diagnosticsAllClear:e.diagnosticsEmpty})]})]})]})}export{ye as SetupStatusPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-RnGYy9bC.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./preload-helper-zJ_50EbN.js";import{u as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{d as a,n as o}from"./locale-store-
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./preload-helper-zJ_50EbN.js";import{u as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{d as a,n as o}from"./locale-store-BneNAR8R.js";import{Ji as s,Ol as c,Qi as l,Za as u,ao as d,ea as f,jl as p,ta as m}from"./index-CH7XN6KY.js";var h=e(t(),1),g=n();function _(){return{textContent:null,binaryBuffer:null,extractedText:null,extractedTextTruncated:!1}}function v(){let{token:e}=i(),t=o(e=>e.language),n=t===`zh`?b:x,[v,S]=(0,h.useState)(null),[C,w]=(0,h.useState)(_),[T,E]=(0,h.useState)(!0),[D,O]=(0,h.useState)(null),k=(0,h.useMemo)(()=>{if(!v||!e||v.kind!==`file`)return null;let t=f(v.fileName,v.mimeType);return{id:`share:${e}:${v.fileName}`,context:`share`,fileName:v.fileName,mimeType:t,size:v.fileSize,type:l(v.fileName,t),source:{kind:`share`,token:e}}},[v,e]);(0,h.useEffect)(()=>{if(!e){O(n.invalidLink),E(!1);return}let t=!1;return(async()=>{try{E(!0),O(null),w(_());let i=await fetch(a(`/s/${encodeURIComponent(e)}/meta`));if(!i.ok){t||O(i.status===404?n.notFound:n.expired);return}let o=await i.json();if(t)return;if(S(o),!o.valid){O(n.expired);return}if(o.kind!==`file`)return;let s=f(o.fileName,o.mimeType),c=l(o.fileName,s),d=m(c),p=a(`/s/${encodeURIComponent(e)}?inline=1`);if(d===`text`){if(o.fileSize>5242880){O(n.tooLarge);return}let e=await fetch(p);if(!e.ok){O(n.expired);return}let r=await e.text();t||w({..._(),textContent:r});return}if(d===`binary`){if(o.fileSize>33554432){O(n.tooLarge);return}let e=await fetch(p);if(!e.ok){O(n.expired);return}let i=await e.arrayBuffer();if(t)return;if(c===`pptx`){let{processPptx:e}=await r(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:t}=await e(i,o.fileName),n=t.length>u;w({textContent:null,binaryBuffer:i,extractedText:n?t.slice(0,u):t,extractedTextTruncated:n});return}w({..._(),binaryBuffer:i})}}catch(e){t||O(e instanceof Error?e.message:String(e))}finally{t||E(!1)}})(),()=>{t=!0}},[e,n.expired,n.invalidLink,n.notFound,n.tooLarge]);let A=e?a(`/s/${encodeURIComponent(e)}?dl=1`):`#`,j=e?a(`/s/${encodeURIComponent(e)}?inline=1`):`#`;return(0,g.jsxs)(`div`,{className:`flex min-h-screen flex-col bg-surface-base`,children:[(0,g.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-edge px-4`,children:[(0,g.jsx)(`span`,{className:`text-lg`,"aria-hidden":!0,children:`#`}),(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v?(0,g.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,title:v.fileName,children:v.fileName}):T?(0,g.jsx)(d,{className:`h-4 w-48 max-w-full`}):(0,g.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:n.error}),v?(0,g.jsxs)(`div`,{className:`truncate text-xs text-fg-muted`,children:[y(v.fileSize),` · `,n.expiresAt,` `,new Date(v.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}):null]}),v?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`a`,{href:j,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,children:[(0,g.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),n.openInline]}),(0,g.jsxs)(`a`,{href:A,className:`inline-flex items-center gap-1 rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-white hover:opacity-90`,download:v.fileName,children:[(0,g.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),n.download]})]}):null]}),(0,g.jsx)(`main`,{className:`flex min-h-0 w-full flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,children:T?(0,g.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,g.jsx)(d,{className:`h-5 w-56 max-w-full`}),(0,g.jsxs)(`div`,{className:`mt-5 grid gap-3`,children:[(0,g.jsx)(d,{className:`h-4 w-full`}),(0,g.jsx)(d,{className:`h-4 w-11/12`}),(0,g.jsx)(d,{className:`h-4 w-10/12`}),(0,g.jsx)(d,{className:`h-4 w-3/4`})]}),(0,g.jsx)(d,{className:`mt-6 min-h-0 flex-1 rounded-lg`})]}):D?(0,g.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg`,children:[(0,g.jsx)(`p`,{className:`font-medium`,children:n.error}),(0,g.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:D})]}):v?.kind===`directory`?(0,g.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg-muted`,children:n.directoryHint}):k?(0,g.jsx)(`div`,{className:`flex min-h-[70vh] flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,g.jsx)(s,{language:t,descriptor:k,loading:!1,loadError:null,textContent:C.textContent,binaryBuffer:C.binaryBuffer,extractedText:C.extractedText,extractedTextTruncated:C.extractedTextTruncated,actions:{onDownload:()=>{window.location.href=A},canDownload:!0}})}):null})]})}function y(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 b={error:`加载失败`,expired:`链接已失效`,notFound:`链接不存在`,invalidLink:`链接无效`,expiresAt:`有效期至`,download:`下载`,openInline:`在新窗口打开`,directoryHint:`目录分享请使用主页面浏览。`,tooLarge:`文件过大,无法在线预览,请下载查看。`},x={error:`Failed to load`,expired:`Link no longer valid`,notFound:`Link not found`,invalidLink:`Invalid link`,expiresAt:`Expires`,download:`Download`,openInline:`Open raw`,directoryHint:`Directory shares are browsed from the main page.`,tooLarge:`This file is too large to preview here. Please download it instead.`};export{v 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{d as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./check-BODqo66o.js";import{t as s}from"./copy-to-clipboard-HOJ79TWv.js";import{t as c}from"./messages-t1yPaVCt.js";import{d as l,i as u,n as d,o as f}from"./locale-store-BneNAR8R.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{Ai as m,Ao as h,Fi as g,Fo as _,Go as v,Ii as y,Li as b,Lr as x,Mi as S,Ni as C,No as w,Oi as T,Pi as E,Pl as D,Po as ee,Ri as O,Sl as k,Wr as A,ao as j,cc as te,hc as M,hs as N,io as P,ji as F,jo as I,js as L,ko as ne,kt as re,ms as R,oa as ie,qo as z,ro as ae,tr as B,tu as oe,vl as se,ys as ce,zc as le,zl as V}from"./index-CH7XN6KY.js";import{n as H,r as ue,t as de}from"./settings-page-layout-HdlQOOqp.js";import{t as U}from"./settings-form-section-CjINay6t.js";import{t as fe}from"./page-tabs-DMlQERNg.js";var W=e(t(),1),pe=n(),G={enabled:!0,defaultTtlHours:24,maxTtlDays:7,maxActiveShares:100,maxActiveSites:5,maxFileSizeMb:100,inlinePreviewMimes:[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`application/pdf`,`text/html`,`text/markdown`,`text/plain`,`application/json`]},K=36e5,q=864e5,me=1048576;function J(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function he(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 ge(e){let t=J(e)?e:{},n=J(t.gateway)?t.gateway:{},r=J(n.share)?n.share:{},i=J(n.siteShare)?n.siteShare:{},a=typeof r.defaultTtlMs==`number`&&Number.isFinite(r.defaultTtlMs)?Math.floor(r.defaultTtlMs):G.defaultTtlHours*K,o=typeof r.maxTtlMs==`number`&&Number.isFinite(r.maxTtlMs)?Math.floor(r.maxTtlMs):G.maxTtlDays*q,s=typeof r.maxFileSize==`number`&&Number.isFinite(r.maxFileSize)?Math.floor(r.maxFileSize):G.maxFileSizeMb*me;return{enabled:r.enabled!==!1,defaultTtlHours:Math.max(1,Math.round(a/K)),maxTtlDays:Math.max(1,Math.round(o/q)),maxActiveShares:typeof r.maxActiveShares==`number`&&Number.isFinite(r.maxActiveShares)?Math.max(1,Math.min(1e4,Math.floor(r.maxActiveShares))):G.maxActiveShares,maxActiveSites:typeof i.maxActiveSites==`number`&&Number.isFinite(i.maxActiveSites)?Math.max(1,Math.min(1e3,Math.floor(i.maxActiveSites))):G.maxActiveSites,maxFileSizeMb:Math.max(1,Math.round(s/me)),inlinePreviewMimes:he(r.inlinePreviewMimes,32).length?he(r.inlinePreviewMimes,32):[...G.inlinePreviewMimes]}}function _e(e){let t=e.defaultTtlHours*K,n=e.maxTtlDays*q;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.`:null}async function ve(e){let t=_e(e);if(t)throw Error(t);await u(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{share:{enabled:e.enabled,defaultTtlMs:e.defaultTtlHours*K,maxTtlMs:e.maxTtlDays*q,maxActiveShares:e.maxActiveShares,maxFileSize:e.maxFileSizeMb*me,inlinePreviewMimes:e.inlinePreviewMimes},siteShare:{maxActiveSites:e.maxActiveSites}}})}),ae()}var Y=r();function ye(){return a(`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 be({hasToken:e}){let t=c(d(e=>e.language)).sharesSettings,{data:n,isLoading:r}=P(e),i=(0,W.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(ge(n.payload.config)),[n]),a=(0,W.useRef)(!1),[o,s]=(0,W.useState)(null),[l,u]=(0,W.useState)(!1),[f,p]=(0,W.useState)(null),[m,h]=(0,W.useState)(!1),g=o??i,_=i,v=(0,W.useMemo)(()=>!g||!_?!1:JSON.stringify(g)!==JSON.stringify(_),[g,_]),y=(0,W.useCallback)(e=>{a.current=!0,s(t=>{let n=t??_;return n?{...n,...e}:null})},[_]),b=(0,W.useCallback)(async()=>{if(!(!g||l)){u(!0),p(null),h(!1);try{await ve(g),a.current=!1,s(null),h(!0),window.setTimeout(()=>h(!1),2500)}catch(e){p(e instanceof Error?e.message:t.policySaveError)}finally{u(!1)}}},[g,l,t.policySaveError]),x=(0,W.useCallback)(()=>{a.current=!1,s(null),p(null),h(!1)},[]);return!e||!g?r?(0,Y.jsx)(U,{children:(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(le,{className:`size-4 animate-spin`}),t.policyLoading]})}):null:(0,Y.jsxs)(U,{children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.policyTitle}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.policyHint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[m?(0,Y.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.policySaved}):null,(0,Y.jsx)(N,{type:`button`,variant:`secondary`,disabled:!v||l,onClick:x,children:t.policyDiscard}),(0,Y.jsx)(N,{type:`button`,variant:`primary`,disabled:!v||l,onClick:()=>void b(),children:l?t.policySaving:t.policySave})]})]}),v?(0,Y.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:t.policyUnsaved}):null,f?(0,Y.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:f}):null,(0,Y.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:t.policyRestartHint}),(0,Y.jsx)(X,{t,form:g,onChange:y})]})}function X(e){let t=(0,pe.c)(64),{t:n,form:r,onChange:i}=e,a;t[0]===i?a=t[1]:(a=e=>i({enabled:e.target.checked}),t[0]=i,t[1]=a);let o;t[2]!==r.enabled||t[3]!==a?(o=(0,Y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:a}),t[2]=r.enabled,t[3]=a,t[4]=o):o=t[4];let s;t[5]!==n.policyEnabled||t[6]!==o?(s=(0,Y.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[o,n.policyEnabled]}),t[5]=n.policyEnabled,t[6]=o,t[7]=s):s=t[7];let c=!r.enabled,l;t[8]===i?l=t[9]:(l=e=>i({defaultTtlHours:e}),t[8]=i,t[9]=l);let u;t[10]!==r.defaultTtlHours||t[11]!==n.policyDefaultTtlHint||t[12]!==n.policyDefaultTtlHours||t[13]!==c||t[14]!==l?(u=(0,Y.jsx)(Z,{id:`share-default-ttl-hours`,label:n.policyDefaultTtlHours,hint:n.policyDefaultTtlHint,value:r.defaultTtlHours,min:1,max:168,disabled:c,onChange:l}),t[10]=r.defaultTtlHours,t[11]=n.policyDefaultTtlHint,t[12]=n.policyDefaultTtlHours,t[13]=c,t[14]=l,t[15]=u):u=t[15];let d=!r.enabled,f;t[16]===i?f=t[17]:(f=e=>i({maxTtlDays:e}),t[16]=i,t[17]=f);let p;t[18]!==r.maxTtlDays||t[19]!==n.policyMaxTtlDays||t[20]!==n.policyMaxTtlHint||t[21]!==d||t[22]!==f?(p=(0,Y.jsx)(Z,{id:`share-max-ttl-days`,label:n.policyMaxTtlDays,hint:n.policyMaxTtlHint,value:r.maxTtlDays,min:1,max:30,disabled:d,onChange:f}),t[18]=r.maxTtlDays,t[19]=n.policyMaxTtlDays,t[20]=n.policyMaxTtlHint,t[21]=d,t[22]=f,t[23]=p):p=t[23];let m=!r.enabled,h;t[24]===i?h=t[25]:(h=e=>i({maxActiveShares:e}),t[24]=i,t[25]=h);let g;t[26]!==r.maxActiveShares||t[27]!==n.policyMaxActiveShares||t[28]!==n.policyMaxActiveSharesHint||t[29]!==m||t[30]!==h?(g=(0,Y.jsx)(Z,{id:`share-max-active`,label:n.policyMaxActiveShares,hint:n.policyMaxActiveSharesHint,value:r.maxActiveShares,min:1,max:1e4,disabled:m,onChange:h}),t[26]=r.maxActiveShares,t[27]=n.policyMaxActiveShares,t[28]=n.policyMaxActiveSharesHint,t[29]=m,t[30]=h,t[31]=g):g=t[31];let _;t[32]===i?_=t[33]:(_=e=>i({maxActiveSites:e}),t[32]=i,t[33]=_);let v;t[34]!==r.maxActiveSites||t[35]!==n.policyMaxActiveSites||t[36]!==n.policyMaxActiveSitesHint||t[37]!==_?(v=(0,Y.jsx)(Z,{id:`site-share-max-active`,label:n.policyMaxActiveSites,hint:n.policyMaxActiveSitesHint,value:r.maxActiveSites,min:1,max:1e3,onChange:_}),t[34]=r.maxActiveSites,t[35]=n.policyMaxActiveSites,t[36]=n.policyMaxActiveSitesHint,t[37]=_,t[38]=v):v=t[38];let y=!r.enabled,b;t[39]===i?b=t[40]:(b=e=>i({maxFileSizeMb:e}),t[39]=i,t[40]=b);let x;t[41]!==r.maxFileSizeMb||t[42]!==n.policyMaxFileSizeHint||t[43]!==n.policyMaxFileSizeMb||t[44]!==y||t[45]!==b?(x=(0,Y.jsx)(Z,{id:`share-max-file-mb`,label:n.policyMaxFileSizeMb,hint:n.policyMaxFileSizeHint,value:r.maxFileSizeMb,min:1,max:10240,disabled:y,onChange:b}),t[41]=r.maxFileSizeMb,t[42]=n.policyMaxFileSizeHint,t[43]=n.policyMaxFileSizeMb,t[44]=y,t[45]=b,t[46]=x):x=t[46];let S;t[47]!==g||t[48]!==v||t[49]!==x||t[50]!==u||t[51]!==p?(S=(0,Y.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[u,p,g,v,x]}),t[47]=g,t[48]=v,t[49]=x,t[50]=u,t[51]=p,t[52]=S):S=t[52];let C=!r.enabled,w;t[53]===i?w=t[54]:(w=e=>i({inlinePreviewMimes:e}),t[53]=i,t[54]=w);let T;t[55]!==r.inlinePreviewMimes||t[56]!==n||t[57]!==C||t[58]!==w?(T=(0,Y.jsx)(xe,{t:n,values:r.inlinePreviewMimes,disabled:C,onChange:w}),t[55]=r.inlinePreviewMimes,t[56]=n,t[57]=C,t[58]=w,t[59]=T):T=t[59];let E;return t[60]!==S||t[61]!==T||t[62]!==s?(E=(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[s,S,T]}),t[60]=S,t[61]=T,t[62]=s,t[63]=E):E=t[63],E}function Z(e){let t=(0,pe.c)(21),{id:n,label:r,hint:i,value:o,min:s,max:c,disabled:l,onChange:u}=e,d;t[0]!==n||t[1]!==r?(d=(0,Y.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=d):d=t[2];let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=a(ye(),`max-w-xs font-mono text-xs`),t[3]=f):f=t[3];let p;t[4]!==c||t[5]!==s||t[6]!==u?(p=e=>{let t=Number(e.target.value);Number.isFinite(t)&&u(Math.max(s,Math.min(c,Math.floor(t))))},t[4]=c,t[5]=s,t[6]=u,t[7]=p):p=t[7];let m;t[8]!==l||t[9]!==n||t[10]!==c||t[11]!==s||t[12]!==p||t[13]!==o?(m=(0,Y.jsx)(`input`,{id:n,type:`number`,min:s,max:c,disabled:l,className:f,value:o,onChange:p}),t[8]=l,t[9]=n,t[10]=c,t[11]=s,t[12]=p,t[13]=o,t[14]=m):m=t[14];let h;t[15]===i?h=t[16]:(h=(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[15]=i,t[16]=h);let g;return t[17]!==d||t[18]!==m||t[19]!==h?(g=(0,Y.jsxs)(`div`,{children:[d,m,h]}),t[17]=d,t[18]=m,t[19]=h,t[20]=g):g=t[20],g}function xe(e){let t=(0,pe.c)(25),{t:n,values:r,disabled:i,onChange:o}=e,s;t[0]!==o||t[1]!==r?(s=e=>{let t=e.trim();!t||r.includes(t)||r.length>=32||o([...r,t])},t[0]=o,t[1]=r,t[2]=s):s=t[2];let c=s,l;t[3]===n.policyInlinePreviewMimes?l=t[4]:(l=(0,Y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.policyInlinePreviewMimes}),t[3]=n.policyInlinePreviewMimes,t[4]=l);let u;t[5]===n.policyInlinePreviewMimesHint?u=t[6]:(u=(0,Y.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.policyInlinePreviewMimesHint}),t[5]=n.policyInlinePreviewMimesHint,t[6]=u);let d;t[7]!==i||t[8]!==o||t[9]!==r?(d=r.map(e=>(0,Y.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,Y.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,"aria-label":`Remove ${e}`,onClick:()=>o(r.filter(t=>t!==e)),children:`×`})]},e)),t[7]=i,t[8]=o,t[9]=r,t[10]=d):d=t[10];let f;t[11]===d?f=t[12]:(f=(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d}),t[11]=d,t[12]=f);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=a(ye(),`font-mono text-xs`),t[13]=p):p=t[13];let m=i||r.length>=32,h;t[14]===c?h=t[15]:(h=e=>{e.key===`Enter`&&(e.preventDefault(),c(e.target.value),e.target.value=``)},t[14]=c,t[15]=h);let g;t[16]!==n.policyMimePlaceholder||t[17]!==m||t[18]!==h?(g=(0,Y.jsx)(`input`,{className:p,placeholder:n.policyMimePlaceholder,disabled:m,onKeyDown:h}),t[16]=n.policyMimePlaceholder,t[17]=m,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==l||t[21]!==u||t[22]!==f||t[23]!==g?(_=(0,Y.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-4`,children:[l,u,f,g]}),t[20]=l,t[21]=u,t[22]=f,t[23]=g,t[24]=_):_=t[24],_}function Q(e){let t=(0,pe.c)(70),{open:n,onOpenChange:r,onConfirm:i,initialPath:o,selectKind:s,sessionKey:l,agentId:u}=e,g=s===void 0?`any`:s,y=c(d(we)),b=y.workspace,S=y.sharesSettings,C=T(Ce),{data:E}=p(f(Se)?`picker-agents-list`:null,A),D;bb0:{let e;t[0]===u?e=t[1]:(e=u?.trim(),t[0]=u,t[1]=e);let n=e;if(n){D=n;break bb0}let r;t[2]===C?r=t[3]:(r=C.trim(),t[2]=C,t[3]=r);let i=r;if(i){D=i;break bb0}if(E?.defaultId){D=E.defaultId;break bb0}if(E?.agents?.[0]?.id){D=E.agents[0].id;break bb0}D=``}let O=D,[k,j]=(0,W.useState)(O),M,P;t[4]===O?(M=t[5],P=t[6]):(M=()=>{j(O)},P=[O],t[4]=O,t[5]=M,t[6]=P),(0,W.useEffect)(M,P);let{tree:F,loading:L,error:re,loadRoot:R,loadChildren:ae,reset:B}=m(k,l??null),oe;t[7]===o?oe=t[8]:(oe=o?{path:o,isDirectory:!1}:null,t[7]=o,t[8]=oe);let[V,H]=(0,W.useState)(oe),ue;t[9]!==o||t[10]!==R||t[11]!==n||t[12]!==B||t[13]!==H?(ue=()=>{if(!n){B(),H(o?{path:o,isDirectory:!1}:null);return}R()},t[9]=o,t[10]=R,t[11]=n,t[12]=B,t[13]=H,t[14]=ue):ue=t[14];let de;t[15]!==o||t[16]!==R||t[17]!==n||t[18]!==k||t[19]!==B||t[20]!==l?(de=[n,k,l,R,B,o],t[15]=o,t[16]=R,t[17]=n,t[18]=k,t[19]=B,t[20]=l,t[21]=de):de=t[21],(0,W.useEffect)(ue,de);let U;t[22]===ae?U=t[23]:(U=e=>{ae(e)},t[22]=ae,t[23]=U);let fe=U,G=V!==null&&(g===`any`||g===`file`&&!V.isDirectory||g===`directory`&&V.isDirectory),K;bb1:{if(!V){K=S.pickerHintNone;break bb1}if(g===`file`&&V.isDirectory){K=S.pickerHintNeedsFile;break bb1}if(g===`directory`&&!V.isDirectory){K=S.pickerHintNeedsDirectory;break bb1}K=`${V.isDirectory?`📁`:`📄`} ${V.path}`}let q=K,me=E?.agents??[],J;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Y.jsx)(w,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[24]=J):J=t[24];let he;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(he=a(`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]=he):he=t[25];let ge;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Y.jsx)(se,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[26]=ge):ge=t[26];let _e=y.cron.refresh,ve=y.cron.refresh,ye;t[27]===R?ye=t[28]:(ye=()=>void R(),t[27]=R,t[28]=ye);let be=L&&`animate-spin`,X;t[29]===be?X=t[30]:(X=a(`size-4`,be),t[29]=be,t[30]=X);let Z;t[31]===X?Z=t[32]:(Z=(0,Y.jsx)(te,{className:X,"aria-hidden":!0}),t[31]=X,t[32]=Z);let xe;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Y.jsx)(ce,{className:`size-4`}),t[33]=xe):xe=t[33];let Q;t[34]!==re||t[35]!==b.loadError?(Q=re?(0,Y.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[b.loadError,`: `,re]}):null,t[34]=re,t[35]=b.loadError,t[36]=Q):Q=t[36];let $;t[37]!==fe||t[38]!==L||t[39]!==V?.path||t[40]!==H||t[41]!==b.emptyDir||t[42]!==b.title||t[43]!==F?($=L&&F.length===0?(0,Y.jsxs)(`p`,{className:`flex shrink-0 items-center gap-2 px-4 py-3 text-sm text-fg-muted`,children:[(0,Y.jsx)(le,{className:`size-4 animate-spin`}),b.title,`…`]}):(0,Y.jsx)(ie,{tree:F,selectedPath:V?.path??null,onSelectFile:e=>H({path:e,isDirectory:!1}),onSelectEntry:(e,t)=>H({path:e,isDirectory:t}),onExpandDir:fe,onAction:void 0,emptyHint:b.emptyDir}),t[37]=fe,t[38]=L,t[39]=V?.path,t[40]=H,t[41]=b.emptyDir,t[42]=b.title,t[43]=F,t[44]=$):$=t[44];let Te;t[45]!==Q||t[46]!==$?(Te=(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[Q,$]}),t[45]=Q,t[46]=$,t[47]=Te):Te=t[47];let Ee;t[48]===q?Ee=t[49]:(Ee=(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:q}),t[48]=q,t[49]=Ee);let De;t[50]===r?De=t[51]:(De=()=>r(!1),t[50]=r,t[51]=De);let Oe;t[52]!==S.cancel||t[53]!==De?(Oe=(0,Y.jsx)(N,{type:`button`,variant:`ghost`,onClick:De,children:S.cancel}),t[52]=S.cancel,t[53]=De,t[54]=Oe):Oe=t[54];let ke=!G,Ae;t[55]!==i||t[56]!==r||t[57]!==k||t[58]!==V?(Ae=()=>{V&&(i({...V,agentId:k}),r(!1))},t[55]=i,t[56]=r,t[57]=k,t[58]=V,t[59]=Ae):Ae=t[59];let je;t[60]!==S.pickerConfirm||t[61]!==ke||t[62]!==Ae?(je=(0,Y.jsx)(N,{type:`button`,disabled:ke,onClick:Ae,children:S.pickerConfirm}),t[60]=S.pickerConfirm,t[61]=ke,t[62]=Ae,t[63]=je):je=t[63];let Me;t[64]!==Oe||t[65]!==je?(Me=(0,Y.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[Oe,je]}),t[64]=Oe,t[65]=je,t[66]=Me):Me=t[66];let Ne;return t[67]!==Ee||t[68]!==Me?(Ne=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[Ee,Me]}),t[67]=Ee,t[68]=Me,t[69]=Ne):Ne=t[69],(0,Y.jsx)(ne,{open:n,onOpenChange:r,children:(0,Y.jsxs)(ee,{children:[J,(0,Y.jsxs)(I,{className:he,children:[(0,Y.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4`,children:[ge,(0,Y.jsx)(_,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:S.pickerTitle}),(0,Y.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:_e,"aria-label":ve,disabled:L,onClick:ye,children:Z}),(0,Y.jsx)(h,{asChild:!0,children:(0,Y.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":b.close,children:xe})})]}),me.length>0?(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-edge px-4 py-2`,children:[(0,Y.jsx)(`label`,{className:`text-xs text-fg-muted`,htmlFor:`picker-agent-select`,children:S.pickerAgentLabel}),(0,Y.jsx)(v,{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:k,onChange:e=>{j(e.target.value),H(null)},children:me.map(e=>(0,Y.jsxs)(z,{value:e.id,children:[x(e,y.agentsSettings),e.id===E?.defaultId?` ★`:``]},e.id))})]}):null,Te,Ne]})]})})}function Se(e){return e.token}function Ce(e){return e.agentId}function we(e){return e.language}var $=[`shares`,`policy`];function Te(e){let t=(e??``).trim();return $.includes(t)?t:`shares`}function Ee(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 De(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 Oe=[{value:36e5,key:`1h`},{value:216e5,key:`6h`},{value:864e5,key:`24h`},{value:2592e5,key:`3d`},{value:6048e5,key:`7d`}];function ke(){let e=(0,pe.c)(24),t=d(je),n=c(t).sharesSettings,r=!!f(Ae),[a,o]=i(),s;e[0]===a?s=e[1]:(s=Te(a.get(`tab`)),e[0]=a,e[1]=s);let l=s,u;e[2]===o?u=e[3]:(u=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]=u);let p=u;if(!r)return(0,Y.jsx)(de,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let m={shares:n.tabShares,policy:n.tabPolicy},h=$.map(e=>({id:e,label:m[e]})),g;e[4]!==n.subtitle||e[5]!==n.title?(g=(0,Y.jsx)(H,{title:n.title,subtitle:n.subtitle}),e[4]=n.subtitle,e[5]=n.title,e[6]=g):g=e[6];let _;e[7]!==l||e[8]!==p||e[9]!==n.tabsAria||e[10]!==h?(_=(0,Y.jsx)(fe,{items:h,activeTab:l,onChange:p,ariaLabel:n.tabsAria,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`}),e[7]=l,e[8]=p,e[9]=n.tabsAria,e[10]=h,e[11]=_):_=e[11];let v;e[12]!==l||e[13]!==r||e[14]!==t||e[15]!==n?(v=l===`shares`?(0,Y.jsx)(Me,{t:n,language:t}):(0,Y.jsx)(be,{hasToken:r}),e[12]=l,e[13]=r,e[14]=t,e[15]=n,e[16]=v):v=e[16];let y;e[17]!==l||e[18]!==v?(y=(0,Y.jsx)(ue,{id:l,activeTab:l,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`,showHeading:!1,children:v}),e[17]=l,e[18]=v,e[19]=y):y=e[19];let b;return e[20]!==g||e[21]!==_||e[22]!==y?(b=(0,Y.jsxs)(de,{children:[g,_,y]}),e[20]=g,e[21]=_,e[22]=y,e[23]=b):b=e[23],b}function Ae(e){return e.token}function je(e){return e.language}function Me(e){let t=(0,pe.c)(60),{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:o,error:s,isLoading:c,mutate:l}=p(`shares-list`,E,i),u;t[1]===o?.payload?.shares?u=t[2]:(u=o?.payload?.shares??[],t[1]=o?.payload?.shares,t[2]=u);let d=u,[f,m]=(0,W.useState)(!1),h;bb0:{if(f){h=d;break bb0}let e;t[3]===d?e=t[4]:(e=d.filter(Le),t[3]=d,t[4]=e),h=e}let g=h,_;t[5]===d?_=t[6]:(_=d.filter(Ie),t[5]=d,t[6]=_);let v=_.length,y;t[7]===d?y=t[8]:(y=d.filter(Fe),t[7]=d,t[8]=y);let b=y.length,x;t[9]===l?x=t[10]:(x=()=>void l(),t[9]=l,t[10]=x);let S;t[11]!==n||t[12]!==x?(S=(0,Y.jsx)(ze,{t:n,onCreated:x}),t[11]=n,t[12]=x,t[13]=S):S=t[13];let C=f?n.allSharesTitle:n.listTitle,w;t[14]===v?w=t[15]:(w=v>0&&(0,Y.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:[`(`,v,`)`]}),t[14]=v,t[15]=w);let T;t[16]!==C||t[17]!==w?(T=(0,Y.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[C,w]}),t[16]=C,t[17]=w,t[18]=T):T=t[18];let D;t[19]===l?D=t[20]:(D=()=>void l(),t[19]=l,t[20]=D);let ee=c&&`animate-spin`,O;t[21]===ee?O=t[22]:(O=a(`size-3.5`,ee),t[21]=ee,t[22]=O);let k;t[23]===O?k=t[24]:(k=(0,Y.jsx)(te,{className:O}),t[23]=O,t[24]=k);let A;t[25]!==c||t[26]!==D||t[27]!==k?(A=(0,Y.jsx)(N,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:D,disabled:c,children:k}),t[25]=c,t[26]=D,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==b||t[30]!==f||t[31]!==n.hideExpired||t[32]!==n.showExpired?(j=b>0&&(0,Y.jsx)(`button`,{type:`button`,className:`text-xs text-accent hover:underline`,onClick:()=>m(Pe),children:f?n.hideExpired:n.showExpired}),t[29]=b,t[30]=f,t[31]=n.hideExpired,t[32]=n.showExpired,t[33]=j):j=t[33];let M;t[34]!==A||t[35]!==j?(M=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,j]}),t[34]=A,t[35]=j,t[36]=M):M=t[36];let P;t[37]!==T||t[38]!==M?(P=(0,Y.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[T,M]}),t[37]=T,t[38]=M,t[39]=P):P=t[39];let F;t[40]!==o||t[41]!==s||t[42]!==g||t[43]!==c||t[44]!==r||t[45]!==l||t[46]!==n?(F=c&&!o?(0,Y.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:4}).map(Ne)}):s?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-red-600 dark:text-red-400`,children:[(0,Y.jsx)(`span`,{children:n.error}),(0,Y.jsx)(N,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>void l(),children:n.retry})]}):g.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.emptyState}):(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:g.map(e=>(0,Y.jsx)(Ve,{share:e,t:n,language:r,onRevoked:()=>void l(),onExtended:()=>void l()},e.id))}),t[40]=o,t[41]=s,t[42]=g,t[43]=c,t[44]=r,t[45]=l,t[46]=n,t[47]=F):F=t[47];let I;t[48]!==b||t[49]!==l||t[50]!==f||t[51]!==n?(I=b>0&&f&&(0,Y.jsx)(He,{t:n,onCleaned:()=>void l()}),t[48]=b,t[49]=l,t[50]=f,t[51]=n,t[52]=I):I=t[52];let L;t[53]!==P||t[54]!==F||t[55]!==I?(L=(0,Y.jsxs)(U,{children:[P,F,I]}),t[53]=P,t[54]=F,t[55]=I,t[56]=L):L=t[56];let ne;return t[57]!==L||t[58]!==S?(ne=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[S,L]}),t[57]=L,t[58]=S,t[59]=ne):ne=t[59],ne}function Ne(e,t){return(0,Y.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(j,{className:`h-4 w-2/3`}),(0,Y.jsx)(j,{className:`mt-2 h-3 w-1/2`})]}),(0,Y.jsx)(j,{className:`h-7 w-20 rounded-md`})]})},t)}function Pe(e){return!e}function Fe(e){return e.expired||e.revoked}function Ie(e){return!e.expired&&!e.revoked}function Le(e){return!e.expired&&!e.revoked}var Re={expanded:!0,path:``,isDirectory:!1,agentId:``,ttlMs:864e5,maxViews:null,description:``,directoryMode:`browse`,creating:!1,result:null,errorMsg:null,resultDialogOpen:!1,pickerOpen:!1};function ze({t:e,onCreated:t}){let[n,r]=(0,W.useReducer)(re,Re),{expanded:i,path:o,isDirectory:s,agentId:c,ttlMs:l,maxViews:u,description:d,directoryMode:f,creating:p,result:m,errorMsg:h,resultDialogOpen:g,pickerOpen:_}=n,y=(0,W.useCallback)(async()=>{if(o.trim()){r({type:`patch`,patch:{creating:!0,errorMsg:null,result:null}});try{r({type:`patch`,patch:{result:(await S({path:o.trim(),ttlMs:l,maxViews:u,description:d.trim()||void 0,...c?{agentId:c}:{},...s?{kind:`directory`,directoryMode:f}:{}})).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}})}}},[o,s,c,l,u,d,f,t]),x=(0,W.useCallback)(()=>{r({type:`patch`,patch:{path:``,isDirectory:!1,agentId:``,description:``,maxViews:null,ttlMs:864e5,directoryMode:`browse`,result:null,errorMsg:null}})},[]);return i?(0,Y.jsxs)(U,{children:[(0,Y.jsx)(`h2`,{className:`mb-1 text-sm font-semibold text-fg`,children:e.createTitle}),(0,Y.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:e.createHint}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.pathLabel}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`div`,{className:a(`flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm`,o?`text-fg`:`text-fg-subtle`),children:o?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,children:s?`📁`:`📄`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:o,children:o})]}):(0,Y.jsx)(`span`,{className:`truncate`,children:e.pathPlaceholder})}),(0,Y.jsxs)(N,{type:`button`,variant:`ghost`,onClick:()=>r({type:`patch`,patch:{pickerOpen:!0}}),children:[(0,Y.jsx)(k,{className:`size-4`}),o?e.pathBrowseChange:e.pathBrowse]})]})]}),s?(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.directoryModeLabel}),(0,Y.jsxs)(v,{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:f,onChange:e=>r({type:`patch`,patch:{directoryMode:e.target.value===`zip-only`?`zip-only`:`browse`}}),children:[(0,Y.jsx)(z,{value:`browse`,children:e.directoryModeBrowse}),(0,Y.jsx)(z,{value:`zip-only`,children:e.directoryModeZipOnly})]})]}):null,(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.ttlLabel}),(0,Y.jsx)(v,{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,onChange:e=>r({type:`patch`,patch:{ttlMs:Number(e.target.value)}}),children:Oe.map(t=>(0,Y.jsx)(z,{value:t.value,children:e.ttlOptions[t.key]},t.key))})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.maxViewsLabel}),(0,Y.jsxs)(v,{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:u??`unlimited`,onChange:e=>r({type:`patch`,patch:{maxViews:e.target.value===`unlimited`?null:Number(e.target.value)}}),children:[(0,Y.jsx)(z,{value:`unlimited`,children:e.maxViewsUnlimited}),(0,Y.jsx)(z,{value:`1`,children:`1`}),(0,Y.jsx)(z,{value:`5`,children:`5`}),(0,Y.jsx)(z,{value:`10`,children:`10`}),(0,Y.jsx)(z,{value:`50`,children:`50`}),(0,Y.jsx)(z,{value:`100`,children:`100`})]})]})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.descriptionLabel}),(0,Y.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:d,onChange:e=>r({type:`patch`,patch:{description:e.target.value}})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,Y.jsxs)(N,{type:`button`,disabled:p||!o.trim(),onClick:()=>void y(),children:[p?(0,Y.jsx)(le,{className:`size-4 animate-spin`}):(0,Y.jsx)(M,{className:`size-4`}),p?e.creating:e.createButton]}),(0,Y.jsx)(N,{type:`button`,variant:`ghost`,onClick:()=>{x(),r({type:`patch`,patch:{expanded:!1}})},children:e.cancel})]}),h&&(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:h})]}),(0,Y.jsx)(b,{open:g,onOpenChange:e=>{r({type:`patch`,patch:{resultDialogOpen:e,...e?{}:{result:null}}})},result:m}),(0,Y.jsx)(Q,{open:_,onOpenChange:e=>r({type:`patch`,patch:{pickerOpen:e}}),initialPath:o||void 0,selectKind:`any`,onConfirm:e=>r({type:`patch`,patch:{path:e.path,isDirectory:e.isDirectory,agentId:e.agentId,directoryMode:`browse`}})})]}):(0,Y.jsxs)(N,{type:`button`,onClick:()=>r({type:`patch`,patch:{expanded:!0}}),className:`self-start`,children:[(0,Y.jsx)(M,{className:`size-4`}),e.createTitle]})}var Be={revokeOpen:!1,revoking:!1,linksOpen:!1,urlCopied:!1,copyFailed:!1,extending:!1};function Ve({share:e,t,language:n,onRevoked:r,onExtended:i}){let[c,l]=(0,W.useReducer)(re,Be),{revokeOpen:u,revoking:d,linksOpen:f,urlCopied:p,copyFailed:m,extending:h}=c,_=!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,W.useCallback)(async()=>{l({type:`patch`,patch:{revokeOpen:!1,revoking:!0}});try{await g(e.id),r()}catch{}finally{l({type:`patch`,patch:{revoking:!1}})}},[e.id,r]),S=(0,W.useCallback)(async()=>{if(l({type:`patch`,patch:{linksOpen:!0,copyFailed:!1}}),!await s(e.shareUrl)){l({type:`patch`,patch:{copyFailed:!0}}),window.setTimeout(()=>l({type:`patch`,patch:{copyFailed:!1}}),2500);return}l({type:`patch`,patch:{urlCopied:!0}}),window.setTimeout(()=>l({type:`patch`,patch:{urlCopied:!1}}),2e3)},[e.shareUrl]),w=(0,W.useCallback)(async()=>{l({type:`patch`,patch:{extending:!0}});try{await C(e.id,864e5),i()}catch{}finally{l({type:`patch`,patch:{extending:!1}})}},[e.id,i]),T=`share-links-${e.id}`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:a(`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":f,"aria-controls":T,onClick:()=>l({type:`patch`,patch:{linksOpen:!f}}),children:[(0,Y.jsx)(oe,{className:a(`mt-0.5 size-4 shrink-0 text-fg-muted transition-transform`,f?`rotate-0`:`-rotate-90`),"aria-hidden":!0}),(0,Y.jsx)(k,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.fileName}),(0,Y.jsx)(`span`,{className:a(`text-xs font-medium`,b),children:v})]}),(0,Y.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.workspaceRelativePath}),(0,Y.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,Y.jsx)(`span`,{children:Ee(e.fileSize)}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(V,{className:`size-3`}),e.expired?n===`zh`?`已过期`:`expired`:De(e.expiresAt,n)]}),(0,Y.jsxs)(`span`,{children:[t.views,`: `,e.downloadCount,e.maxViews!==null&&` ${t.viewsOf} ${e.maxViews}`]}),e.description&&(0,Y.jsx)(`span`,{className:`italic text-fg-subtle`,children:e.description})]})]})]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:_&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(N,{type:`button`,variant:`ghost`,className:`px-2 py-1`,title:t.copyUrl,onClick:()=>void S(),children:p?(0,Y.jsx)(o,{className:`size-3.5 text-emerald-500`}):(0,Y.jsx)(D,{className:`size-3.5`})}),(0,Y.jsx)(N,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:()=>void w(),disabled:h,title:t.extend,children:h?(0,Y.jsx)(le,{className:`size-3.5 animate-spin`}):(0,Y.jsx)(V,{className:`size-3.5`})}),(0,Y.jsx)(N,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,onClick:()=>l({type:`patch`,patch:{revokeOpen:!0}}),disabled:d,children:d?(0,Y.jsx)(le,{className:`size-3.5 animate-spin`}):(0,Y.jsx)(L,{className:`size-3.5`})})]})})]}),_&&f?(0,Y.jsxs)(`div`,{id:T,className:`mt-3 bg-surface-base/45 py-3 pl-7 pr-3`,children:[(0,Y.jsx)(O,{shareUrl:e.shareUrl,lanUrl:e.lanUrl,reachability:e.reachability,compact:!0}),m?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:t.copyFailed}):null,(0,Y.jsx)(`div`,{className:`mt-2`,children:(0,Y.jsx)(y,{reachability:e.reachability})})]}):null]}),(0,Y.jsx)(B,{open:u,title:t.revokeConfirmTitle,description:t.revokeConfirmBody,confirmLabel:t.revokeConfirmLabel,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void x(),onCancel:()=>l({type:`patch`,patch:{revokeOpen:!1}})})]})}function He({t:e,onCleaned:t}){let[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(!1),o=(0,W.useCallback)(async()=>{r(!1),a(!0);try{await F(),t()}catch{}finally{a(!1)}},[t]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Y.jsxs)(N,{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,Y.jsx)(le,{className:`size-3.5 animate-spin`}):(0,Y.jsx)(L,{className:`size-3.5`}),e.cleanExpired]})}),(0,Y.jsx)(B,{open:n,title:e.cleanExpiredConfirmTitle,description:e.cleanExpiredConfirmBody,confirmLabel:e.cleanExpiredConfirmLabel,cancelLabel:e.cancel,destructive:!0,onConfirm:()=>void o(),onCancel:()=>r(!1)})]})}export{ke as SharesSettingsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{d as t,r as n}from"./locale-store-BneNAR8R.js";import{ti as r}from"./index-CH7XN6KY.js";var i=e({reloadSkills:()=>a});async function a(){let e=await n(t(`/api/skills/reload`),{method:`POST`});if(!e.ok)throw Error(await r(e))}export{i as n,a as t};
|