@xopcai/xopc 0.0.201 → 0.0.203
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-DOhnAQOQ.js → activity-store-SZAay-ze.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D8Cw0Mve.js → agent-avatar-dicebear-DPLJtxoS.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DyjRuuRa.js +68 -0
- package/dist/gateway/static/root/assets/{api-E9Bk-Idp.js → api-C1cSt2ru.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BubrReXg.js → app-management-settings-panel-B3PCMqor.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BY5Az2p4.js → appearance-settings-txSx3REK.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BEhBaooZ.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BY8843mB.js → archive-plugin-B2VVc17j.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DG45KScf.js → attachment-load-Crk7x8qR.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BUC6FL6O.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DGIF2ZAv.js → binary-plugins-CLlJsq5D.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C1Qktr1g.js → block-editor-cJ5lVNAG.js} +46 -46
- package/dist/gateway/static/root/assets/browser-settings-page-Bq2m4VpX.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-D_jnndyz.js → browser-workflow-inputs-WRiFG88u.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-DyIRvPaq.js → browser-workflows-page-BHLdVoOC.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BiQbVvYU.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api--tz0mGLY.js → capability-presets-api-DmElfgC9.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-CYlZQpLY.js +3 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-CkOKF9nc.js → channel-recipient-api-BUEOtPft.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DlDiCMhO.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-Dm_-934M.js +1 -0
- package/dist/gateway/static/root/assets/{connectors-api-FBOe9SWC.js → connectors-api-BCdn44_o.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-Ce-eaPHw.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-D2hF3t68.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-Dtn7e6TW.js → date-picker-Dvjoq2mB.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-zv1OIhk3.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-DJZhKLTb.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-FDmaty3P.js → desktop-pet-settings-B3ubM-eY.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-X2e8xn8j.js → directory-picker-path-field-BZEJIWOT.js} +1 -1
- package/dist/gateway/static/root/assets/download-Dk-ZjtO6.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-Dx4MBfga.js → extension-debug-page-Bvq3E1A1.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Bf_FEDhM.js → extension-page-CuCJjWNm.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CrOgZxkf.js → extension-settings-page-CpTk_ajr.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CZ4r-7qT.js → gateway-config-api-C2yM6qj7.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-Cv2ywpdb.js → gateway-config-swr-CN-JHMAh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DpWmVi0w.js → gateway-settings-COwi--2Q.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-undf-k5g.js → gateway-startup-retry-Dq1RyCjz.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-DSQZhSvT.js → heartbeat-settings-Dc6H4VGF.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BB3RGxwm.js +3 -0
- package/dist/gateway/static/root/assets/index-CPTLS-Zn.js +85 -0
- package/dist/gateway/static/root/assets/index-Dm-cvIpl.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Bc3Quw42.js → keyboard-shortcuts-settings-cue30Z5p.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DfO6FOB9.js +2 -0
- package/dist/gateway/static/root/assets/local-apps-page-DKQSCsa0.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-CnamlR07.js → locale-store-81Gv0wwo.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DODbODyl.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-CJmcaVje.js → management-settings--4H26QR-.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-AcuFp0TH.js → markdown-split-BTvpyjAi.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-B12xeflb.css +1 -0
- package/dist/gateway/static/root/assets/markdown-view-B4iBrVWK.js +69 -0
- package/dist/gateway/static/root/assets/{media-plugins-BvFgsiJL.js → media-plugins-DrejWl8t.js} +1 -1
- package/dist/gateway/static/root/assets/messages-ELK_1h2D.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-IW7IQ9nJ.js → notes-page-DfSzeQKd.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DxL4GhwV.js +4 -0
- package/dist/gateway/static/root/assets/plus-Q2yW6OE7.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-yjh1_7K3.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-CWEzLykF.js → product-open-page-DopWBJLa.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Bl3LJHZB.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DStOErTC.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-C_hh9ztK.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DAohEZrX.js → runtime-tools-settings-panel-_dHhbYV2.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-C_OBW8A5.js → schema-form-DZhORvJZ.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DDY21KYw.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BJrHIcw8.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-C7w2WS-A.js → settings-form-section-Du5eAgFS.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-zwibve4m.js → settings-loading-skeleton-DWS27sv1.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B9W03dSW.js → settings-page-DPD0MwoN.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CnXN4LH_.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-D6HmH2ga.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-U3lvtO3Y.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-B6GiZgZU.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-XVO7d3fh.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-D9QT5cxj.js → skills-page.utils-DwxIpWrI.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-c1HVtv1Y.js → system-settings-panel-BmKbxR8_.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DA6ItYrc.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-BDyUTObE.js → theme-store-hOF81tUQ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-D6UkH_Ga.js → use-autosave-GJfDpf66.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-CQ1QrRE6.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BOxkKbGh.js → voice-api-key-field-B0zve9EE.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-DrIbHnBz.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-CQW8pPec.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-ZA3bP65I.js → workflow-run-setup-panel-D-_zQxim.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-O21l_f5c.js +5 -0
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-BcyiDXU3.js → working-directory-picker-modal-5xYx48tV.js} +1 -1
- package/dist/gateway/static/root/assets/x-B_N4OPjy.js +1 -0
- package/dist/gateway/static/root/index.html +19 -14
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +2 -1
- package/dist/src/agent/embedded/run-for-session.js +3 -2
- package/dist/src/agent/embedded/run-turn.js +29 -16
- package/dist/src/agent/embedded/types.d.ts +2 -2
- package/dist/src/agent/embedded/xopc-stream-bridge.d.ts +2 -1
- package/dist/src/agent/embedded/xopc-stream-bridge.js +2 -2
- package/dist/src/agent/memory/context-budget.d.ts +6 -1
- package/dist/src/agent/memory/context-budget.js +94 -2
- package/dist/src/agent/prompt/cache-boundary.d.ts +2 -0
- package/dist/src/agent/prompt/cache-boundary.js +10 -1
- package/dist/src/agent/prompt/sections/project-context.d.ts +1 -4
- package/dist/src/agent/prompt/sections/project-context.js +6 -13
- package/dist/src/agent/prompt/service-prompt-builder.js +2 -1
- package/dist/src/agent/prompt/system-prompt.d.ts +1 -3
- package/dist/src/agent/prompt/system-prompt.js +6 -15
- package/dist/src/agent/tools/cache-stability.d.ts +3 -0
- package/dist/src/agent/tools/cache-stability.js +19 -0
- package/dist/src/agent/tools/factory.js +2 -1
- package/dist/src/agent-manifest/schema.d.ts +40 -20
- package/dist/src/agent-manifest/schema.js +4 -5
- package/dist/src/config/schema.d.ts +40 -20
- package/dist/src/extensions/types/providers.d.ts +0 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +4 -1
- package/dist/src/gateway/hono/oauth-async.d.ts +1 -0
- package/dist/src/gateway/hono/oauth-async.js +14 -2
- package/dist/src/providers/extension-stream-bridge.js +0 -2
- package/dist/src/providers/google-managed-prompt-cache.d.ts +14 -0
- package/dist/src/providers/google-managed-prompt-cache.js +125 -0
- package/dist/src/providers/prompt-cache-fingerprint.d.ts +4 -0
- package/dist/src/providers/prompt-cache-fingerprint.js +44 -0
- package/dist/src/providers/prompt-cache-lifecycle.d.ts +9 -0
- package/dist/src/providers/prompt-cache-lifecycle.js +31 -0
- package/dist/src/providers/prompt-cache-observability.d.ts +20 -0
- package/dist/src/providers/prompt-cache-observability.js +44 -0
- package/dist/src/providers/prompt-cache-payload.d.ts +10 -3
- package/dist/src/providers/prompt-cache-payload.js +204 -31
- package/dist/src/providers/prompt-cache-plan.d.ts +15 -0
- package/dist/src/providers/prompt-cache-plan.js +29 -0
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-ANavi648.js +0 -68
- package/dist/gateway/static/root/assets/apps-page-CFh9MBxc.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-751CeNI3.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CGAWs-TT.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CghUK68J.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-XsTfkvUn.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-DkoAZZMe.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DNDvMWpl.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-e4vekkAu.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-Q4QaYjpI.js +0 -2
- package/dist/gateway/static/root/assets/dependency-picker-Br6nPaM6.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-DzTM6aH8.js +0 -1
- package/dist/gateway/static/root/assets/home-page-L0uHiu0T.js +0 -3
- package/dist/gateway/static/root/assets/index-Bp8I_eX4.css +0 -1
- package/dist/gateway/static/root/assets/index-DRrjYYzZ.js +0 -152
- package/dist/gateway/static/root/assets/local-app-workbench-page-Copi3sdP.js +0 -2
- package/dist/gateway/static/root/assets/local-apps-page-CP9X_vtz.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-DMKq6e29.js +0 -2
- package/dist/gateway/static/root/assets/messages-D7kOD_o_.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-Zb8U0anO.js +0 -4
- package/dist/gateway/static/root/assets/preview-open-alternatives-C-b34dgQ.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-BuIbLnan.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BwUfRqNV.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BTaXxcEi.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BnHoTCD3.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BTB_fxjt.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C8Hec2Af.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-6e3ks2be.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-Bwc5HfLI.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-D7kunhqy.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-WgkaNzpc.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-CjP-6WVU.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-D8ZhPDNF.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-Dd19yK9t.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-DUkdJl1e.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-C2b5W5bw.js +0 -5
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jszip.min-DT31yWkU.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{c as a,f as o,l as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./popover-select-BzdnTy3h.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{t as d}from"./cn-JdwAhgNB.js";import{t as f}from"./button-CSEbl4zT.js";import{n as p}from"./interaction-BmQogeqz.js";import{t as m}from"./messages-D7kOD_o_.js";import{l as h,n as g}from"./locale-store-CnamlR07.js";import{a as _,n as v,o as y,r as b,s as x,t as S}from"./dist-BPoKqzeH.js";import{t as C}from"./config-reload-event-Bjh2zoKp.js";import{Ac as w,Dl as T,Gn as E,Ns as D,Ol as O,Ri as k,Si as A,Tl as j,Ua as M,Wa as N,Ws as P,Yo as F,cs as I,el as L,kl as R,ls as z,vs as B,wi as V}from"./index-DRrjYYzZ.js";import{t as H}from"./page-tabs-BaEQMYm_.js";import{t as U}from"./skill-reload-api-D7kunhqy.js";import{_ as W,a as G,c as ee,d as K,f as q,g as J,h as te,i as ne,l as re,m as ie,n as ae,o as oe,p as se,r as Y,s as ce,t as le,u as ue}from"./skills-page.utils-D9QT5cxj.js";var X=n(),Z=e(t(),1),Q=r(),de=(0,Z.memo)(function(e){let t=(0,X.c)(23),{loading:n,onReloadClick:r,searchQuery:i,setSearchQuery:a,mainTab:o,sk:s,setPendingFile:c,setInstallOpen:l}=e,u;t[0]!==n||t[1]!==r||t[2]!==s.reloadDiskAria||t[3]!==s.reloadRuntime?(u=(0,Q.jsx)(k,{className:`size-9 shrink-0 p-0`,loading:n,label:s.reloadDiskAria,title:s.reloadRuntime,onClick:r}),t[0]=n,t[1]=r,t[2]=s.reloadDiskAria,t[3]=s.reloadRuntime,t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(D,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[5]=d):d=t[5];let p;t[6]===a?p=t[7]:(p=e=>a(e.target.value),t[6]=a,t[7]=p);let m=o===`marketplace`?s.marketplaceSearchPackages:s.searchPlaceholder,h;t[8]!==i||t[9]!==p||t[10]!==m?(h=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[d,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:p,placeholder:m,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[8]=i,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==l||t[13]!==c?(g=()=>{c(null),l(!0)},t[12]=l,t[13]=c,t[14]=g):g=t[14];let _;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(P,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[15]=_):_=t[15];let v;t[16]!==s.installCta||t[17]!==g?(v=(0,Q.jsxs)(f,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,onClick:g,children:[_,s.installCta]}),t[16]=s.installCta,t[17]=g,t[18]=v):v=t[18];let y;return t[19]!==u||t[20]!==h||t[21]!==v?(y=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[u,h,v]}),t[19]=u,t[20]=h,t[21]=v,t[22]=y):y=t[22],y}),fe=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function pe(){let e=(0,X.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:d(`h-4 min-w-0 flex-1`,fe)}),e[0]=t):t=e[0];let n,r,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[t,(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,Q.jsx)(`div`,{className:d(`size-8 shrink-0 rounded-lg`,fe)}),(0,Q.jsx)(`div`,{className:d(`h-8 w-[4.5rem] shrink-0 rounded-lg`,fe)})]})]}),r=(0,Q.jsx)(`div`,{className:d(`h-3 w-full`,fe)}),i=(0,Q.jsx)(`div`,{className:d(`h-3 w-[92%]`,fe)}),e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`div`,{className:`flex h-full min-h-[10.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[n,r,i,(0,Q.jsxs)(`div`,{className:`mt-auto space-y-1 pt-0.5`,children:[(0,Q.jsx)(`div`,{className:d(`h-3 w-full`,fe)}),(0,Q.jsx)(`div`,{className:d(`h-2.5 w-4/5`,fe)})]})]})})}),e[4]=a):a=e[4],a}function me(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(pe,{}),e[0]=t):t=e[0],t}var he=new Set([`installed`,`marketplace`]),ge=new Set([`all`,`builtin`,`installed`,`global`,`workspace`,`extra`]),_e=new Set([`all`,`enabled`,`disabled`]),ve=`mprov`,ye=[`s0`,`s1`,`s2`,`s3`,`s4`,`s5`],be=[`business`,`creative`,`documents`,`engineering`,`tools`];function xe(e){let t=(0,X.c)(27),{sk:n,loading:r,catalog:i,filteredCatalog:a,builtinCategories:o,builtinCategoryFilter:s,setBuiltinCategoryFilter:c,catalogDisplayRows:l,catalogStatusFilter:u,resolveSkillEnabled:m,categoryLabel:h,sourceLabel:g,openSkillDetail:_,onSkillToggle:v,onUseSkillInChat:y,usingSkillInChatName:b,togglingSkillName:x}=e;if(r){let e=n.loading,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=ye.map(Se),t[0]=r):r=t[0];let i;return t[1]===n.loading?i=t[2]:(i=(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":e,children:r}),t[1]=n.loading,t[2]=i),i}if(i.length===0){let e;return t[3]===n.empty?e=t[4]:(e=(0,Q.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:n.empty}),t[3]=n.empty,t[4]=e),e}if(a.length===0){let e;return t[5]===n.noSearchResults?e=t[6]:(e=(0,Q.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:n.noSearchResults}),t[5]=n.noSearchResults,t[6]=e),e}let S;t[7]!==o||t[8]!==s||t[9]!==h||t[10]!==c||t[11]!==n?(S=o.length>1?(0,Q.jsx)(H,{items:[{id:``,label:n.marketplaceCategoryAll},...o.map(e=>({id:e,label:h(e),title:h(e)}))],activeTab:s,onChange:c,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-builtin-category-tab`,className:`gap-2 pt-0.5 [scrollbar-width:thin]`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):null,t[7]=o,t[8]=s,t[9]=h,t[10]=c,t[11]=n,t[12]=S):S=t[12];let C;t[13]!==l||t[14]!==u||t[15]!==v||t[16]!==y||t[17]!==_||t[18]!==m||t[19]!==n||t[20]!==g||t[21]!==x||t[22]!==b?(C=l.length===0?(0,Q.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:u===`disabled`?n.noDisabledSkills:n.noSearchResults}):(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:l.map(e=>{let t=m(e);return(0,Q.jsxs)(`article`,{className:d(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors`,t?`hover:bg-surface-hover`:`bg-amber-50/30 hover:bg-amber-50/50 dark:bg-amber-950/20`),children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:d(`min-w-0 flex-1 cursor-pointer rounded-lg text-left outline-none`,p.focusRingPanel),"aria-labelledby":`catalog-skill-title-${e.directoryId}`,onClick:()=>void _(e),children:(0,Q.jsx)(`h3`,{id:`catalog-skill-title-${e.directoryId}`,className:`truncate text-[15px] font-semibold leading-8 tracking-tight text-fg`,children:e.name})}),t?(0,Q.jsx)(f,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:b===e.name||x===e.name,onClick:()=>void y({name:e.name,source:`catalog`}),children:b===e.name?n.previewUseInChatBusy:n.previewUseInChat}):(0,Q.jsx)(f,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:x===e.name,onClick:()=>void v(e.name,!0),children:x===e.name?n.uploading:n.detailModalEnable})]}),(0,Q.jsx)(`button`,{type:`button`,className:d(`mt-2 flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,p.focusRingPanel),"aria-labelledby":`catalog-skill-title-${e.directoryId}`,onClick:()=>void _(e),children:(0,Q.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:g(e)}),(0,Q.jsxs)(`span`,{className:d(`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 font-medium`,t?`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`border-amber-500/30 bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:[t?(0,Q.jsx)(j,{className:`size-3`,"aria-hidden":!0}):(0,Q.jsx)(T,{className:`size-3`,"aria-hidden":!0}),t?n.statusEnabled:n.statusDisabled]}),e.managed?(0,Q.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[n.col.managed,`: `,n.yes]}):null,e.hub?(0,Q.jsxs)(`span`,{className:`max-w-full break-all rounded-md bg-surface-hover/60 px-2 py-0.5 font-mono text-[10px] leading-snug dark:bg-surface-active/50 line-clamp-2`,title:`${e.hub.source}${e.hub.ref?`\nref: ${e.hub.ref}`:``}\nupdated: ${e.hub.updatedAt}`,children:[n.hubRemote,` ·`,` `,e.hub.kind===`git`?n.hubKindGit:n.hubKindArchive,` ·`,` `,e.hub.source.length>48?`${e.hub.source.slice(0,48)}…`:e.hub.source]}):null]})]})})})]},`${e.directoryId}-${e.path}`)})}),t[13]=l,t[14]=u,t[15]=v,t[16]=y,t[17]=_,t[18]=m,t[19]=n,t[20]=g,t[21]=x,t[22]=b,t[23]=C):C=t[23];let w;return t[24]!==S||t[25]!==C?(w=(0,Q.jsxs)(Q.Fragment,{children:[S,C]}),t[24]=S,t[25]=C,t[26]=w):w=t[26],w}function Se(e){return(0,Q.jsx)(me,{},e)}function Ce(e){let t=(0,X.c)(32),{sk:n,confirmOpen:r,setConfirmOpen:i,confirmId:a,setConfirmId:o,runDelete:s}=e,c;t[0]!==o||t[1]!==i?(c=e=>{i(e),e||o(null)},t[0]=o,t[1]=i,t[2]=c):c=t[2];let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[3]=l):l=t[3];let u;t[4]===n.deleteTitle?u=t[5]:(u=(0,Q.jsx)(x,{className:`text-base font-semibold text-fg`,children:n.deleteTitle}),t[4]=n.deleteTitle,t[5]=u);let d;t[6]!==a||t[7]!==n.deleteMessage?(d=a?Y(n.deleteMessage,{id:a}):``,t[6]=a,t[7]=n.deleteMessage,t[8]=d):d=t[8];let p;t[9]===d?p=t[10]:(p=(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:d}),t[9]=d,t[10]=p);let m;t[11]===i?m=t[12]:(m=()=>i(!1),t[11]=i,t[12]=m);let h;t[13]!==n.cancel||t[14]!==m?(h=(0,Q.jsx)(f,{type:`button`,variant:`secondary`,onClick:m,children:n.cancel}),t[13]=n.cancel,t[14]=m,t[15]=h):h=t[15];let g;t[16]===s?g=t[17]:(g=()=>void s(),t[16]=s,t[17]=g);let v;t[18]!==n.deleteConfirm||t[19]!==g?(v=(0,Q.jsx)(f,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:g,children:n.deleteConfirm}),t[18]=n.deleteConfirm,t[19]=g,t[20]=v):v=t[20];let C;t[21]!==h||t[22]!==v?(C=(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[h,v]}),t[21]=h,t[22]=v,t[23]=C):C=t[23];let w;t[24]!==C||t[25]!==u||t[26]!==p?(w=(0,Q.jsxs)(y,{children:[l,(0,Q.jsxs)(b,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] 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`,children:[u,p,C]})]}),t[24]=C,t[25]=u,t[26]=p,t[27]=w):w=t[27];let T;return t[28]!==r||t[29]!==c||t[30]!==w?(T=(0,Q.jsx)(S,{open:r,onOpenChange:c,children:w}),t[28]=r,t[29]=c,t[30]=w,t[31]=T):T=t[31],T}function we(e){let t=(0,X.c)(7),{label:n,children:r}=e;if(r==null||r===!1)return null;let i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Q.jsx)(`div`,{className:`mt-1.5 min-w-0 text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3 dark:border-edge/60`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Te(e){let t=(0,X.c)(118),{preview:n,sk:r}=e,i=n.metadata,a=n.toolConditions,o=!!a&&(a.requiresTools.length>0||a.requiresToolsets.length>0||a.fallbackForTools.length>0||a.fallbackForToolsets.length>0),s=i.requires,c=s&&((s.bins?.length??0)>0||(s.env?.length??0)>0||(s.anyBins?.length??0)>0),l,u,f,p,m,h,g,_,v,y,b,x,S,C,w;if(t[0]!==a||t[1]!==c||t[2]!==o||t[3]!==i.emoji||t[4]!==i.homepage||t[5]!==i.install||t[6]!==i.os||t[7]!==n.description||t[8]!==n.disableModelInvocation||t[9]!==n.requiredEnvVarNames||t[10]!==s||t[11]!==r.detailEnvVarsLabel||t[12]!==r.detailHomepageLabel||t[13]!==r.detailInstallLabel||t[14]!==r.detailNotInjectedNote||t[15]!==r.detailPlatformsLabel||t[16]!==r.detailRequiresAnyBins||t[17]!==r.detailRequiresBins||t[18]!==r.detailRequiresEnv||t[19]!==r.detailRequiresLabel||t[20]!==r.detailSummaryHeading||t[21]!==r.detailToolGatingLabel||t[22]!==r.detailToolsFallbackList||t[23]!==r.detailToolsRequiresList||t[24]!==r.detailToolsetsFallbackList||t[25]!==r.detailToolsetsRequiresList){let e=i.install?.filter(Oe)??[],T=n.requiredEnvVarNames?.filter(De)??[];g=`space-y-6`,m=`skill-detail-summary-heading`,t[41]===r.detailSummaryHeading?h=t[42]:(h=(0,Q.jsx)(`h3`,{id:`skill-detail-summary-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:r.detailSummaryHeading}),t[41]=r.detailSummaryHeading,t[42]=h),v=`rounded-xl border border-edge bg-surface-base px-4 py-3 dark:bg-surface-hover/25`,t[43]===i.emoji?y=t[44]:(y=i.emoji?.trim()?(0,Q.jsx)(`p`,{className:`text-2xl leading-none`,"aria-hidden":!0,children:i.emoji.trim()}):null,t[43]=i.emoji,t[44]=y);let E;t[45]===i.emoji?E=t[46]:(E=i.emoji?.trim()?`mt-2`:``,t[45]=i.emoji,t[46]=E);let D;t[47]===E?D=t[48]:(D=d(`text-sm leading-relaxed text-fg`,E),t[47]=E,t[48]=D),t[49]!==n.description||t[50]!==D?(b=(0,Q.jsx)(`p`,{className:D,children:n.description}),t[49]=n.description,t[50]=D,t[51]=b):b=t[51],t[52]!==n.disableModelInvocation||t[53]!==r.detailNotInjectedNote?(x=n.disableModelInvocation?(0,Q.jsx)(`p`,{className:`mt-3 rounded-lg border border-amber-200/80 bg-amber-50/90 px-3 py-2 text-xs leading-snug text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100`,children:r.detailNotInjectedNote}):null,t[52]=n.disableModelInvocation,t[53]=r.detailNotInjectedNote,t[54]=x):x=t[54];let O;t[55]===i.homepage?O=t[56]:(O=i.homepage?.trim()?(0,Q.jsx)(`a`,{href:i.homepage.trim(),target:`_blank`,rel:`noopener noreferrer`,className:`break-all text-accent underline-offset-2 hover:underline`,children:i.homepage.trim()}):null,t[55]=i.homepage,t[56]=O),t[57]!==r.detailHomepageLabel||t[58]!==O?(S=(0,Q.jsx)(we,{label:r.detailHomepageLabel,children:O}),t[57]=r.detailHomepageLabel,t[58]=O,t[59]=S):S=t[59];let k;t[60]===i.os?k=t[61]:(k=i.os&&i.os.length>0?(0,Q.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:i.os.join(`, `)}):null,t[60]=i.os,t[61]=k),t[62]!==r.detailPlatformsLabel||t[63]!==k?(C=(0,Q.jsx)(we,{label:r.detailPlatformsLabel,children:k}),t[62]=r.detailPlatformsLabel,t[63]=k,t[64]=C):C=t[64];let A;t[65]!==c||t[66]!==s||t[67]!==r.detailRequiresAnyBins||t[68]!==r.detailRequiresBins||t[69]!==r.detailRequiresEnv?(A=c&&s?(0,Q.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[s.bins&&s.bins.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresBins,`: `]}),s.bins.join(`, `)]}):null,s.env&&s.env.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresEnv,`: `]}),(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:s.env.join(`, `)})]}):null,s.anyBins&&s.anyBins.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresAnyBins,`: `]}),s.anyBins.join(`, `)]}):null]}):null,t[65]=c,t[66]=s,t[67]=r.detailRequiresAnyBins,t[68]=r.detailRequiresBins,t[69]=r.detailRequiresEnv,t[70]=A):A=t[70],t[71]!==r.detailRequiresLabel||t[72]!==A?(w=(0,Q.jsx)(we,{label:r.detailRequiresLabel,children:A}),t[71]=r.detailRequiresLabel,t[72]=A,t[73]=w):w=t[73];let j=e.length>0?(0,Q.jsx)(`ul`,{className:`list-inside list-decimal space-y-1.5 text-sm text-fg-muted`,children:e.map(Ee)}):null;t[74]!==r.detailInstallLabel||t[75]!==j?(f=(0,Q.jsx)(we,{label:r.detailInstallLabel,children:j}),t[74]=r.detailInstallLabel,t[75]=j,t[76]=f):f=t[76];let M;t[77]!==a||t[78]!==o||t[79]!==r.detailToolsFallbackList||t[80]!==r.detailToolsRequiresList||t[81]!==r.detailToolsetsFallbackList||t[82]!==r.detailToolsetsRequiresList?(M=o&&a?(0,Q.jsxs)(`ul`,{className:`mt-1 space-y-2 text-sm text-fg-muted`,children:[a.requiresTools.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsRequiresList,`: `]}),a.requiresTools.join(`, `)]}):null,a.requiresToolsets.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsRequiresList,`: `]}),a.requiresToolsets.join(`, `)]}):null,a.fallbackForTools.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsFallbackList,`: `]}),a.fallbackForTools.join(`, `)]}):null,a.fallbackForToolsets.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsFallbackList,`: `]}),a.fallbackForToolsets.join(`, `)]}):null]}):null,t[77]=a,t[78]=o,t[79]=r.detailToolsFallbackList,t[80]=r.detailToolsRequiresList,t[81]=r.detailToolsetsFallbackList,t[82]=r.detailToolsetsRequiresList,t[83]=M):M=t[83],t[84]!==r.detailToolGatingLabel||t[85]!==M?(p=(0,Q.jsx)(we,{label:r.detailToolGatingLabel,children:M}),t[84]=r.detailToolGatingLabel,t[85]=M,t[86]=p):p=t[86],l=we,u=r.detailEnvVarsLabel,_=T.length>0?(0,Q.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:T.join(`, `)}):null,t[0]=a,t[1]=c,t[2]=o,t[3]=i.emoji,t[4]=i.homepage,t[5]=i.install,t[6]=i.os,t[7]=n.description,t[8]=n.disableModelInvocation,t[9]=n.requiredEnvVarNames,t[10]=s,t[11]=r.detailEnvVarsLabel,t[12]=r.detailHomepageLabel,t[13]=r.detailInstallLabel,t[14]=r.detailNotInjectedNote,t[15]=r.detailPlatformsLabel,t[16]=r.detailRequiresAnyBins,t[17]=r.detailRequiresBins,t[18]=r.detailRequiresEnv,t[19]=r.detailRequiresLabel,t[20]=r.detailSummaryHeading,t[21]=r.detailToolGatingLabel,t[22]=r.detailToolsFallbackList,t[23]=r.detailToolsRequiresList,t[24]=r.detailToolsetsFallbackList,t[25]=r.detailToolsetsRequiresList,t[26]=l,t[27]=u,t[28]=f,t[29]=p,t[30]=m,t[31]=h,t[32]=g,t[33]=_,t[34]=v,t[35]=y,t[36]=b,t[37]=x,t[38]=S,t[39]=C,t[40]=w}else l=t[26],u=t[27],f=t[28],p=t[29],m=t[30],h=t[31],g=t[32],_=t[33],v=t[34],y=t[35],b=t[36],x=t[37],S=t[38],C=t[39],w=t[40];let T;t[87]!==l||t[88]!==u||t[89]!==_?(T=(0,Q.jsx)(l,{label:u,children:_}),t[87]=l,t[88]=u,t[89]=_,t[90]=T):T=t[90];let E;t[91]!==f||t[92]!==p||t[93]!==T||t[94]!==v||t[95]!==y||t[96]!==b||t[97]!==x||t[98]!==S||t[99]!==C||t[100]!==w?(E=(0,Q.jsxs)(`div`,{className:v,children:[y,b,x,S,C,w,f,p,T]}),t[91]=f,t[92]=p,t[93]=T,t[94]=v,t[95]=y,t[96]=b,t[97]=x,t[98]=S,t[99]=C,t[100]=w,t[101]=E):E=t[101];let D;t[102]!==m||t[103]!==h||t[104]!==E?(D=(0,Q.jsxs)(`section`,{"aria-labelledby":m,children:[h,E]}),t[102]=m,t[103]=h,t[104]=E,t[105]=D):D=t[105];let O;t[106]===r.detailInstructionsHeading?O=t[107]:(O=(0,Q.jsx)(`h3`,{id:`skill-detail-instructions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:r.detailInstructionsHeading}),t[106]=r.detailInstructionsHeading,t[107]=O);let k;t[108]!==n.bodyMarkdown||t[109]!==r.detailNoInstructionsBody?(k=n.bodyMarkdown.trim()?(0,Q.jsx)(`div`,{className:`markdown-content min-w-0 break-words`,children:(0,Q.jsx)(V,{content:n.bodyMarkdown})}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:r.detailNoInstructionsBody}),t[108]=n.bodyMarkdown,t[109]=r.detailNoInstructionsBody,t[110]=k):k=t[110];let A;t[111]!==O||t[112]!==k?(A=(0,Q.jsxs)(`section`,{"aria-labelledby":`skill-detail-instructions-heading`,children:[O,k]}),t[111]=O,t[112]=k,t[113]=A):A=t[113];let j;return t[114]!==g||t[115]!==D||t[116]!==A?(j=(0,Q.jsxs)(`div`,{className:g,children:[D,A]}),t[114]=g,t[115]=D,t[116]=A,t[117]=j):j=t[117],j}function Ee(e,t){return(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:(0,Q.jsx)(`span`,{className:`text-fg`,children:ae(e)})},e.id||`${e.kind}-${t}`)}function De(e){return e.trim()}function Oe(e){return e&&typeof e.kind==`string`}var ke=[{id:`s0`,width:`w-[92%]`},{id:`s1`,width:`w-full`},{id:`s2`,width:`w-4/5`},{id:`s3`,width:`w-[92%]`},{id:`s4`,width:`w-full`},{id:`s5`,width:`w-4/5`},{id:`s6`,width:`w-[92%]`},{id:`s7`,width:`w-full`},{id:`s8`,width:`w-4/5`},{id:`s9`,width:`w-[92%]`}];function Ae(e){let t=(0,X.c)(81),{sk:n,detailOpen:r,setDetailOpen:i,detailSource:a,setDetailSource:o,detailTitle:s,setDetailTitle:c,detailCatalogPreview:u,setDetailCatalogPreview:m,detailMarketplacePreview:h,setDetailMarketplacePreview:g,detailLoading:C,detailError:T,setDetailError:E,detailEnabled:D,detailDirectoryId:O,detailManaged:k,detailExternalUrl:A,usingSkillInChatName:j,installingMarketName:M,togglingSkillName:N,isSkillInstalledByName:P,onUseSkillInChat:L,onMarketInstall:R,onSkillToggle:B,setConfirmId:V,setConfirmOpen:H}=e,U;t[0]!==m||t[1]!==E||t[2]!==g||t[3]!==i||t[4]!==o||t[5]!==c?(U=e=>{i(e),e||(o(`catalog`),m(null),g(null),E(null),c(``))},t[0]=m,t[1]=E,t[2]=g,t[3]=i,t[4]=o,t[5]=c,t[6]=U):U=t[6];let W;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[7]=W):W=t[7];let G;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(G=d(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(88vh,44rem)] max-h-[min(92vh,56rem)] w-[min(100%-2rem,min(92vw,56rem))]`,`-translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),t[8]=G):G=t[8];let ee=s||`?`,K;t[9]===ee?K=t[10]:(K=(0,Q.jsx)(ce,{name:ee}),t[9]=ee,t[10]=K);let q=s||`—`,J;t[11]===q?J=t[12]:(J=(0,Q.jsx)(x,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:q}),t[11]=q,t[12]=J);let te;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(te=d(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,p.focusRingPanel),t[13]=te):te=t[13];let ne;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(F,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[14]=ne):ne=t[14];let re;t[15]===n.detailCloseAria?re=t[16]:(re=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:te,"aria-label":n.detailCloseAria,children:ne})}),t[15]=n.detailCloseAria,t[16]=re);let ie;t[17]!==K||t[18]!==J||t[19]!==re?(ie=(0,Q.jsxs)(`div`,{className:`group flex min-h-[3.25rem] shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[K,J,re]}),t[17]=K,t[18]=J,t[19]=re,t[20]=ie):ie=t[20];let ae;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-blue-600 dark:text-blue-400`,strokeWidth:1.75,"aria-hidden":!0}),t[21]=ae):ae=t[21];let oe=a===`store`&&h?n.detailModalBanner:a===`store`?n.detailModalBannerStore:n.detailModalBanner,se;t[22]===oe?se=t[23]:(se=(0,Q.jsxs)(`div`,{className:`flex min-h-[3.25rem] shrink-0 items-start gap-2 border-b border-blue-200/80 bg-blue-50/95 px-4 py-2.5 text-sm text-fg dark:border-blue-900/50 dark:bg-blue-950/45`,children:[ae,(0,Q.jsx)(`p`,{className:`min-w-0 leading-relaxed`,children:oe})]}),t[22]=oe,t[23]=se);let Y;t[24]!==u||t[25]!==D||t[26]!==T||t[27]!==C||t[28]!==h||t[29]!==a||t[30]!==n?(Y=(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto p-4`,children:C?(0,Q.jsx)(`div`,{className:`flex h-full min-h-[14rem] flex-col gap-2.5 py-1`,"aria-busy":`true`,"aria-label":n.loading,children:ke.map(je)}):T?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:T}):a===`catalog`&&u?(0,Q.jsxs)(Q.Fragment,{children:[D?null:(0,Q.jsxs)(`div`,{className:`mb-4 flex items-start gap-2 rounded-xl border border-amber-200 bg-amber-50 px-3 py-2.5 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-100`,children:[(0,Q.jsx)(I,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-300`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`leading-relaxed`,children:n.detailDisabledNotice})]}),(0,Q.jsx)(Te,{preview:u,sk:n})]}):a===`store`&&h?(0,Q.jsx)(Te,{preview:h,sk:n}):(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:n.detailLoadFailed})}),t[24]=u,t[25]=D,t[26]=T,t[27]=C,t[28]=h,t[29]=a,t[30]=n,t[31]=Y):Y=t[31];let le;t[32]!==A||t[33]!==a||t[34]!==n.marketplaceOpenExternal||t[35]!==n.marketplaceOpenExternalAria?(le=a===`store`&&A?(0,Q.jsxs)(`a`,{href:A,target:`_blank`,rel:`noopener noreferrer`,className:d(`inline-flex h-9 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 text-sm font-medium text-fg-muted`,`hover:bg-surface-hover hover:text-fg dark:border-edge`,p.focusRingPanel),"aria-label":n.marketplaceOpenExternalAria,title:n.marketplaceOpenExternal,children:[(0,Q.jsx)(l,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:n.marketplaceOpenExternal})]}):null,t[32]=A,t[33]=a,t[34]=n.marketplaceOpenExternal,t[35]=n.marketplaceOpenExternalAria,t[36]=le):le=t[36];let ue;t[37]!==O||t[38]!==k||t[39]!==a||t[40]!==V||t[41]!==H||t[42]!==n.delete?(ue=a===`catalog`&&k&&O?(0,Q.jsxs)(f,{type:`button`,variant:`ghost`,className:`gap-1.5 text-red-600 hover:bg-red-50 hover:text-red-700 dark:text-red-400 dark:hover:bg-red-950/40 dark:hover:text-red-300`,onClick:()=>{V(O),H(!0)},children:[(0,Q.jsx)(z,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),n.delete]}):null,t[37]=O,t[38]=k,t[39]=a,t[40]=V,t[41]=H,t[42]=n.delete,t[43]=ue):ue=t[43];let Z;t[44]!==le||t[45]!==ue?(Z=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[le,ue]}),t[44]=le,t[45]=ue,t[46]=Z):Z=t[46];let de;t[47]!==D||t[48]!==C||t[49]!==a||t[50]!==s||t[51]!==M||t[52]!==P||t[53]!==R||t[54]!==B||t[55]!==L||t[56]!==i||t[57]!==n.cancel||t[58]!==n.detailModalDisable||t[59]!==n.detailModalEnable||t[60]!==n.marketplaceInstall||t[61]!==n.marketplaceReinstall||t[62]!==n.previewUseInChat||t[63]!==n.previewUseInChatBusy||t[64]!==n.uploading||t[65]!==n.useRequiresEnabled||t[66]!==N||t[67]!==j?(de=(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:a===`store`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(f,{type:`button`,variant:`ghost`,onClick:()=>i(!1),children:n.cancel}),(0,Q.jsx)(f,{type:`button`,variant:`secondary`,disabled:!s||C||j===s||M===s,onClick:()=>void L(),children:j===s?n.previewUseInChatBusy:n.previewUseInChat}),(0,Q.jsx)(f,{type:`button`,variant:P(s)?`secondary`:`primary`,disabled:!s||M===s,onClick:()=>{s&&R(s,{useDetailProvider:!0})},children:M===s?n.uploading:P(s)?n.marketplaceReinstall:n.marketplaceInstall})]}):(0,Q.jsxs)(Q.Fragment,{children:[D?(0,Q.jsx)(f,{type:`button`,variant:`secondary`,disabled:!s||N===s,onClick:()=>{s&&B(s,!1)},children:N===s?n.uploading:n.detailModalDisable}):(0,Q.jsx)(f,{type:`button`,variant:`primary`,disabled:!s||N===s,onClick:()=>{s&&B(s,!0)},children:N===s?n.uploading:n.detailModalEnable}),(0,Q.jsx)(f,{type:`button`,variant:`secondary`,disabled:!s||!D||C||j===s||N===s,title:D?void 0:n.useRequiresEnabled,onClick:()=>void L(),children:j===s?n.previewUseInChatBusy:n.previewUseInChat})]})}),t[47]=D,t[48]=C,t[49]=a,t[50]=s,t[51]=M,t[52]=P,t[53]=R,t[54]=B,t[55]=L,t[56]=i,t[57]=n.cancel,t[58]=n.detailModalDisable,t[59]=n.detailModalEnable,t[60]=n.marketplaceInstall,t[61]=n.marketplaceReinstall,t[62]=n.previewUseInChat,t[63]=n.previewUseInChatBusy,t[64]=n.uploading,t[65]=n.useRequiresEnabled,t[66]=N,t[67]=j,t[68]=de):de=t[68];let fe;t[69]!==Z||t[70]!==de?(fe=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-t border-edge px-4 py-3`,children:[Z,de]}),t[69]=Z,t[70]=de,t[71]=fe):fe=t[71];let pe;t[72]!==ie||t[73]!==se||t[74]!==Y||t[75]!==fe?(pe=(0,Q.jsxs)(y,{children:[W,(0,Q.jsxs)(b,{className:G,children:[ie,se,Y,fe]})]}),t[72]=ie,t[73]=se,t[74]=Y,t[75]=fe,t[76]=pe):pe=t[76];let me;return t[77]!==r||t[78]!==U||t[79]!==pe?(me=(0,Q.jsx)(S,{open:r,onOpenChange:U,children:pe}),t[77]=r,t[78]=U,t[79]=pe,t[80]=me):me=t[80],me}function je(e){return(0,Q.jsx)(`div`,{className:d(`h-4 animate-pulse rounded-md bg-surface-hover dark:bg-surface-active/50`,e.width)},e.id)}function Me(e){let t=(0,X.c)(67),{sk:n,installOpen:r,setInstallOpen:i,pendingFile:a,setPendingFile:o,dropActive:s,setDropActive:c,uploading:l,onModalDragOver:u,onModalDragLeave:f,onModalDrop:m,onFileInputChange:h,onInstallSubmit:g}=e,C;t[0]!==c||t[1]!==i||t[2]!==o?(C=e=>{i(e),e||(o(null),c(!1))},t[0]=c,t[1]=i,t[2]=o,t[3]=C):C=t[3];let w;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[4]=w):w=t[4];let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=d(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] max-h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 overflow-y-auto`,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-float dark:border-edge`),t[5]=T):T=t[5];let E;t[6]===n.installModalTitle?E=t[7]:(E=(0,Q.jsx)(x,{className:`text-base font-semibold text-fg`,children:n.installModalTitle}),t[6]=n.installModalTitle,t[7]=E);let D;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(D=d(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,p.focusRingPanel),t[8]=D):D=t[8];let O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(F,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=O):O=t[9];let k;t[10]===n.installClose?k=t[11]:(k=(0,Q.jsx)(`span`,{className:`sr-only`,children:n.installClose}),t[10]=n.installClose,t[11]=k);let A;t[12]!==n.installClose||t[13]!==k?(A=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:D,"aria-label":n.installClose,children:[O,k]})}),t[12]=n.installClose,t[13]=k,t[14]=A):A=t[14];let j;t[15]!==E||t[16]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[E,A]}),t[15]=E,t[16]=A,t[17]=j):j=t[17];let M=s?`border-accent bg-accent-soft/60 dark:bg-blue-950/40`:`border-edge bg-surface-base dark:bg-surface-hover/30`,N;t[18]===M?N=t[19]:(N=d(`mt-4 flex min-h-[11rem] cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed px-6 py-12 text-center transition-colors`,M),t[18]=M,t[19]=N);let P;t[20]!==h||t[21]!==n.installModalDropHint||t[22]!==l?(P=(0,Q.jsx)(`input`,{type:`file`,accept:`.zip,.md,application/zip,text/markdown`,className:`sr-only`,"aria-label":n.installModalDropHint,disabled:l,onChange:h}),t[20]=h,t[21]=n.installModalDropHint,t[22]=l,t[23]=P):P=t[23];let I;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(L,{className:`size-12 text-fg-subtle`,strokeWidth:1.25,"aria-hidden":!0}),t[24]=I):I=t[24];let R;t[25]===n.installModalDropHint?R=t[26]:(R=(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.installModalDropHint}),t[25]=n.installModalDropHint,t[26]=R);let z;t[27]===a?z=t[28]:(z=a?(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:a.name}):null,t[27]=a,t[28]=z);let B;t[29]!==f||t[30]!==u||t[31]!==m||t[32]!==N||t[33]!==P||t[34]!==R||t[35]!==z?(B=(0,Q.jsxs)(`label`,{className:N,onDragLeave:f,onDragOver:u,onDrop:m,children:[P,I,R,z]}),t[29]=f,t[30]=u,t[31]=m,t[32]=N,t[33]=P,t[34]=R,t[35]=z,t[36]=B):B=t[36];let V;t[37]===n.installModalReqTitle?V=t[38]:(V=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.installModalReqTitle}),t[37]=n.installModalReqTitle,t[38]=V);let H;t[39]===n.installModalReq1?H=t[40]:(H=(0,Q.jsx)(`li`,{children:n.installModalReq1}),t[39]=n.installModalReq1,t[40]=H);let U;t[41]===n.installModalReq2?U=t[42]:(U=(0,Q.jsx)(`li`,{children:n.installModalReq2}),t[41]=n.installModalReq2,t[42]=U);let W;t[43]!==H||t[44]!==U?(W=(0,Q.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[H,U]}),t[43]=H,t[44]=U,t[45]=W):W=t[45];let G;t[46]!==V||t[47]!==W?(G=(0,Q.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[V,W]}),t[46]=V,t[47]=W,t[48]=G):G=t[48];let ee=!a||l,K=!a||l?`cursor-not-allowed bg-surface-active text-fg-disabled`:`bg-accent text-white hover:bg-accent-hover`,q;t[49]===K?q=t[50]:(q=d(`mt-6 flex w-full items-center justify-center rounded-xl py-3 text-sm font-semibold`,`transition-colors`,K,p.focusRingPanel),t[49]=K,t[50]=q);let J;t[51]===g?J=t[52]:(J=()=>void g(),t[51]=g,t[52]=J);let te=l?n.uploading:n.installAction,ne;t[53]!==ee||t[54]!==q||t[55]!==J||t[56]!==te?(ne=(0,Q.jsx)(`button`,{type:`button`,disabled:ee,className:q,onClick:J,children:te}),t[53]=ee,t[54]=q,t[55]=J,t[56]=te,t[57]=ne):ne=t[57];let re;t[58]!==B||t[59]!==G||t[60]!==ne||t[61]!==j?(re=(0,Q.jsxs)(y,{children:[w,(0,Q.jsxs)(b,{className:T,children:[j,B,G,ne]})]}),t[58]=B,t[59]=G,t[60]=ne,t[61]=j,t[62]=re):re=t[62];let ie;return t[63]!==r||t[64]!==C||t[65]!==re?(ie=(0,Q.jsx)(S,{open:r,onOpenChange:C,children:re}),t[63]=r,t[64]=C,t[65]=re,t[66]=ie):ie=t[66],ie}function Ne(e){let t=(0,X.c)(68),{sk:n,mpCategories:r,mpCategoriesLoading:i,mpCategoriesError:a,mpPayload:o,mpLoading:s,mpError:c,marketCategoryId:l,setMarketCategoryId:m,marketPage:h,setMarketPage:g,isSkillInstalledByName:_,openMarketplaceDetail:v,onMarketInstall:y,installingMarketName:b,onUseSkillInChat:x,usingSkillInChatName:S,searchInputActive:C,searchQuery:w,setSearchQuery:T,registeredProviders:E,marketBrowseProvider:D,setMarketBrowseProvider:k}=e,A=!C,M,N,P;if(t[0]!==b||t[1]!==_||t[2]!==D||t[3]!==l||t[4]!==h||t[5]!==r||t[6]!==a||t[7]!==i||t[8]!==c||t[9]!==s||t[10]!==o||t[11]!==y||t[12]!==x||t[13]!==v||t[14]!==E||t[15]!==C||t[16]!==w||t[17]!==k||t[18]!==m||t[19]!==g||t[20]!==T||t[21]!==A||t[22]!==n.loading||t[23]!==n.marketplaceAuthor||t[24]!==n.marketplaceCategoriesAria||t[25]!==n.marketplaceCategoryAll||t[26]!==n.marketplaceDownloads||t[27]!==n.marketplaceEmpty||t[28]!==n.marketplaceEmptySearch||t[29]!==n.marketplaceEmptySearchClear||t[30]!==n.marketplaceEmptySearchTryProvider||t[31]!==n.marketplaceInstall||t[32]!==n.marketplaceInstalled||t[33]!==n.marketplacePageNext||t[34]!==n.marketplacePagePrev||t[35]!==n.marketplacePageStatus||t[36]!==n.marketplaceVersion||t[37]!==n.previewUseInChat||t[38]!==n.previewUseInChatBusy||t[39]!==n.uploading||t[40]!==S){let e;t[44]===D?e=t[45]:(e=e=>e.id!==D,t[44]=D,t[45]=e);let F=E.filter(e),I=w.trim(),L;t[46]===n.marketplaceCategoryAll?L=t[47]:(L={id:``,label:n.marketplaceCategoryAll},t[46]=n.marketplaceCategoryAll,t[47]=L);let z;t[48]!==r||t[49]!==L?(z=[L,...r.map(Re)],t[48]=r,t[49]=L,t[50]=z):z=t[50];let V=z,U;t[51]===r?U=t[52]:(U=new Map(r.map(Le)),t[51]=r,t[52]=U);let W=U;t[53]!==V||t[54]!==l||t[55]!==r.length||t[56]!==i||t[57]!==m||t[58]!==A||t[59]!==n.marketplaceCategoriesAria?(M=A?r.length>0?(0,Q.jsx)(H,{items:V,activeTab:l,onChange:m,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-marketplace-category-tab`,className:`min-h-[2.75rem] items-center gap-2 pt-0.5 [scrollbar-width:thin]`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):i?(0,Q.jsx)(`div`,{className:`-mx-1 flex min-h-[2.75rem] items-center gap-2 overflow-x-auto px-1 pb-1 pt-0.5 [scrollbar-width:thin]`,"aria-hidden":!0,children:[`p0`,`p1`,`p2`,`p3`,`p4`].map(Ie)}):null:null,t[53]=V,t[54]=l,t[55]=r.length,t[56]=i,t[57]=m,t[58]=A,t[59]=n.marketplaceCategoriesAria,t[60]=M):M=t[60],t[61]!==a||t[62]!==A?(N=A&&a?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:a}):null,t[61]=a,t[62]=A,t[63]=N):N=t[63],P=!o&&!c?(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":n.loading,children:ye.map(Fe)}):c&&!o?(0,Q.jsx)(`div`,{className:`rounded-xl 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`,role:`alert`,children:c}):o?(0,Q.jsxs)(`div`,{className:`relative`,children:[s?(0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":n.loading,children:(0,Q.jsx)(u,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,o.items.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 rounded-2xl border border-dashed border-edge py-12 text-center text-sm text-fg-muted`,children:[(0,Q.jsx)(`p`,{className:`px-4`,children:C&&I?Y(n.marketplaceEmptySearch,{query:I}):n.marketplaceEmpty}),C?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[F.map(e=>(0,Q.jsx)(f,{type:`button`,variant:`secondary`,className:`h-8 px-3 text-xs`,onClick:()=>k(e.id),children:Y(n.marketplaceEmptySearchTryProvider,{provider:e.displayName})},e.id)),(0,Q.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 px-3 text-xs`,onClick:()=>T(``),children:n.marketplaceEmptySearchClear})]}):null]}):(0,Q.jsx)(`div`,{className:d(`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,s&&`pointer-events-none opacity-[0.52] motion-reduce:opacity-100`),children:o.items.map(e=>{let t=ne(e,e.providerId??D),r=_(t),i=e.category??e.categories?.[0],a=i?W.get(i)??i:null;return(0,Q.jsxs)(`article`,{className:d(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-colors hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:d(`min-w-0 flex-1 rounded-lg text-left outline-none`,p.focusRingPanel),onClick:()=>void v(t,e.name,e.providerId??void 0),children:(0,Q.jsx)(`h3`,{id:`mp-skill-title-${e.id}`,className:`truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name})}),r?(0,Q.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,Q.jsx)(j,{className:`size-3`,"aria-hidden":!0}),n.marketplaceInstalled]}):(0,Q.jsx)(f,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:s||b===t,onClick:()=>void y(t,{providerOverride:e.providerId??null}),children:b===t?n.uploading:n.marketplaceInstall})]}),(0,Q.jsx)(`button`,{type:`button`,className:d(`mt-2 flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,p.focusRingPanel),"aria-labelledby":`mp-skill-title-${e.id}`,onClick:()=>void v(t,e.name,e.providerId??void 0),children:(0,Q.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),a?(0,Q.jsx)(`span`,{className:`w-fit max-w-full truncate rounded-full bg-surface-subtle px-2 py-0.5 text-[10px] font-medium text-fg-muted`,children:a}):null,(0,Q.jsxs)(`div`,{className:`mt-auto min-h-[2.625rem] space-y-1 text-[11px] leading-snug text-fg-muted`,children:[(0,Q.jsxs)(`p`,{className:`line-clamp-1`,title:`${n.marketplaceAuthor}: ${e.author.username} · ${n.marketplaceDownloads}: ${e.downloads}${e.stars!=null&&e.stars>0?` · ★${e.stars}`:``}${r?` · ${n.marketplaceInstalled}`:``}`,children:[(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:n.marketplaceAuthor}),` `,(0,Q.jsx)(`span`,{className:`text-fg`,children:e.author.username}),(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,Q.jsxs)(`span`,{children:[n.marketplaceDownloads,`: `,e.downloads]}),e.stars!=null&&e.stars>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-fg-muted`,children:[(0,Q.jsx)(B,{className:`size-3 shrink-0 text-amber-600 dark:text-amber-400`,strokeWidth:2,"aria-hidden":!0}),e.stars]})]}):null]}),e.latestVersion?(0,Q.jsxs)(`p`,{className:`line-clamp-1 min-h-[1.125rem] font-mono text-[10px] text-fg-subtle`,title:`${n.marketplaceVersion}: ${e.latestVersion}`,children:[n.marketplaceVersion,`: `,e.latestVersion]}):null]})]})})}),r?(0,Q.jsx)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:(0,Q.jsx)(f,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:s||S===t,onClick:()=>void x({name:t,source:`store`,providerOverride:e.providerId??null}),children:S===t?n.previewUseInChatBusy:n.previewUseInChat})}):null]},e.id)})}),o.items.length>0?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col items-center justify-between gap-3 sm:flex-row`,children:[(0,Q.jsx)(`p`,{className:`text-center text-xs text-fg-muted sm:text-left`,children:Y(n.marketplacePageStatus,{page:o.meta.page,totalPages:o.meta.totalPages,total:o.meta.total})}),o.meta.totalPages>1?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:s||h<=1,"aria-label":n.marketplacePagePrev,onClick:()=>g(Pe),children:[(0,Q.jsx)(R,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:n.marketplacePagePrev})]}),(0,Q.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:s||h>=o.meta.totalPages,"aria-label":n.marketplacePageNext,onClick:()=>g(e=>Math.min(o.meta.totalPages,e+1)),children:[(0,Q.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:n.marketplacePageNext}),(0,Q.jsx)(O,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})]})]}):null]}):null]}):null,t[0]=b,t[1]=_,t[2]=D,t[3]=l,t[4]=h,t[5]=r,t[6]=a,t[7]=i,t[8]=c,t[9]=s,t[10]=o,t[11]=y,t[12]=x,t[13]=v,t[14]=E,t[15]=C,t[16]=w,t[17]=k,t[18]=m,t[19]=g,t[20]=T,t[21]=A,t[22]=n.loading,t[23]=n.marketplaceAuthor,t[24]=n.marketplaceCategoriesAria,t[25]=n.marketplaceCategoryAll,t[26]=n.marketplaceDownloads,t[27]=n.marketplaceEmpty,t[28]=n.marketplaceEmptySearch,t[29]=n.marketplaceEmptySearchClear,t[30]=n.marketplaceEmptySearchTryProvider,t[31]=n.marketplaceInstall,t[32]=n.marketplaceInstalled,t[33]=n.marketplacePageNext,t[34]=n.marketplacePagePrev,t[35]=n.marketplacePageStatus,t[36]=n.marketplaceVersion,t[37]=n.previewUseInChat,t[38]=n.previewUseInChatBusy,t[39]=n.uploading,t[40]=S,t[41]=M,t[42]=N,t[43]=P}else M=t[41],N=t[42],P=t[43];let F;return t[64]!==M||t[65]!==N||t[66]!==P?(F=(0,Q.jsxs)(Q.Fragment,{children:[M,N,P]}),t[64]=M,t[65]=N,t[66]=P,t[67]=F):F=t[67],F}function Pe(e){return Math.max(1,e-1)}function Fe(e){return(0,Q.jsx)(pe,{},e)}function Ie(e){return(0,Q.jsx)(`div`,{className:`h-8 w-[4.5rem] shrink-0 animate-pulse rounded-full bg-surface-hover motion-reduce:animate-none dark:bg-surface-active/50`},e)}function Le(e){return[e.id,e.label]}function Re(e){return{id:e.id,label:e.label,title:e.label}}function ze(e){let t=(0,X.c)(130),{vm:n}=e,{sk:r,hasToken:i,error:a,actionFeedback:o,skillDiagnostics:s,mainTab:l,setMainTab:u,sourceFilter:f,setSourceFilter:p,builtinTabStats:m,userTabStats:h,catalogDisabledCount:g,catalogStatusFilter:_,setCatalogStatusFilter:v,marketSort:y,setMarketSort:b,marketBrowseProvider:x,setMarketBrowseProvider:S,registeredProviders:C,inSettingsShell:w,searchInputActive:T,resultTab:E,setResultTab:D,aggregatedTabCounts:O,aggregatedProviderStatus:k}=n,A,j,M,N,P,F,I,L;if(t[0]!==o||t[1]!==k||t[2]!==O||t[3]!==m||t[4]!==a||t[5]!==i||t[6]!==C||t[7]!==r.diagnosticsHint||t[8]!==r.diagnosticsTitle||t[9]!==r.marketplaceLoadFailed||t[10]!==r.marketplaceResultsTabAll||t[11]!==r.needToken||t[12]!==r.tabDiscover||t[13]!==r.tabInstalled||t[14]!==s||t[15]!==h||t[16]!==n){L=Symbol.for(`react.early_return_sentinel`);bb0:{let e=le(s);if(!i){let e;t[25]===n?e=t[26]:(e=(0,Q.jsx)(Ue,{vm:n}),t[25]=n,t[26]=e);let i;t[27]===r.needToken?i=t[28]:(i=(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:r.needToken}),t[27]=r.needToken,t[28]=i);let a;t[29]!==e||t[30]!==i?(a=(0,Q.jsxs)(Q.Fragment,{children:[e,i]}),t[29]=e,t[30]=i,t[31]=a):a=t[31],L=a;break bb0}let c=m.total+h.total,l;t[32]!==c||t[33]!==r.tabInstalled?(l={id:`installed`,label:r.tabInstalled,count:c},t[32]=c,t[33]=r.tabInstalled,t[34]=l):l=t[34];let u;t[35]===r.tabDiscover?u=t[36]:(u={id:`marketplace`,label:r.tabDiscover},t[35]=r.tabDiscover,t[36]=u);let f;t[37]!==l||t[38]!==u?(f=[l,u],t[37]=l,t[38]=u,t[39]=f):f=t[39],A=f;let p;t[40]===C?p=t[41]:(p=[`all`,...C.map(He)],t[40]=C,t[41]=p);let g=p,_;t[42]!==k||t[43]!==O||t[44]!==C||t[45]!==r.marketplaceLoadFailed||t[46]!==r.marketplaceResultsTabAll||t[47]!==g?(_=g.map(e=>{let t=e===`all`?r.marketplaceResultsTabAll:C.find(t=>t.id===e)?.displayName??e,n=O[e]??0,i=e===`all`?null:k[e];return{id:e,label:t,title:i===`error`?`${t} · ${r.marketplaceLoadFailed}`:void 0,suffix:i===`loading`?(0,Q.jsx)(`span`,{className:`inline-block size-1.5 animate-pulse rounded-full bg-fg-muted/60 motion-reduce:animate-none`,"aria-hidden":!0}):i===`error`?(0,Q.jsx)(`span`,{className:`inline-block size-1.5 rounded-full bg-red-500`,"aria-hidden":!0}):(0,Q.jsx)(`span`,{className:`tabular-nums opacity-70`,children:n})}}),t[42]=k,t[43]=O,t[44]=C,t[45]=r.marketplaceLoadFailed,t[46]=r.marketplaceResultsTabAll,t[47]=g,t[48]=_):_=t[48],j=_,t[49]===n?I=t[50]:(I=(0,Q.jsx)(Ue,{vm:n}),t[49]=n,t[50]=I),F=`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,M=`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,t[51]!==o||t[52]!==a?(N=o?(0,Q.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:d(`rounded-xl border px-3 py-2 text-sm`,o.kind===`success`?`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200`:`border-red-200 bg-red-50 text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`),children:o.message}):a?(0,Q.jsx)(`div`,{className:`rounded-xl 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`,role:`alert`,children:a}):null,t[51]=o,t[52]=a,t[53]=N):N=t[53],P=e.length>0?(0,Q.jsxs)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-200`,role:`status`,children:[(0,Q.jsx)(`div`,{className:`font-medium`,children:Y(r.diagnosticsTitle,{count:e.length})}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs opacity-80`,children:r.diagnosticsHint}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.slice(0,3).map(Ve)})]}):null}t[0]=o,t[1]=k,t[2]=O,t[3]=m,t[4]=a,t[5]=i,t[6]=C,t[7]=r.diagnosticsHint,t[8]=r.diagnosticsTitle,t[9]=r.marketplaceLoadFailed,t[10]=r.marketplaceResultsTabAll,t[11]=r.needToken,t[12]=r.tabDiscover,t[13]=r.tabInstalled,t[14]=s,t[15]=h,t[16]=n,t[17]=A,t[18]=j,t[19]=M,t[20]=N,t[21]=P,t[22]=F,t[23]=I,t[24]=L}else A=t[17],j=t[18],M=t[19],N=t[20],P=t[21],F=t[22],I=t[23],L=t[24];if(L!==Symbol.for(`react.early_return_sentinel`))return L;let R;t[54]!==w||t[55]!==n.loading||t[56]!==n.mainTab||t[57]!==n.onReloadClick||t[58]!==n.searchQuery||t[59]!==n.setInstallOpen||t[60]!==n.setPendingFile||t[61]!==n.setSearchQuery||t[62]!==n.sk?(R=w?(0,Q.jsx)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4 dark:border-edge-subtle sm:flex-row sm:flex-wrap sm:items-center sm:justify-end`,children:(0,Q.jsx)(de,{loading:n.loading,onReloadClick:n.onReloadClick,searchQuery:n.searchQuery,setSearchQuery:n.setSearchQuery,mainTab:n.mainTab,sk:n.sk,setPendingFile:n.setPendingFile,setInstallOpen:n.setInstallOpen})}):null,t[54]=w,t[55]=n.loading,t[56]=n.mainTab,t[57]=n.onReloadClick,t[58]=n.searchQuery,t[59]=n.setInstallOpen,t[60]=n.setPendingFile,t[61]=n.setSearchQuery,t[62]=n.sk,t[63]=R):R=t[63];let z;t[64]!==l||t[65]!==A||t[66]!==u||t[67]!==r.skillsNavAria?(z=(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,Q.jsx)(H,{items:A,activeTab:l,onChange:u,ariaLabel:r.skillsNavAria,tabIdPrefix:`skills-tab`,panelIdPrefix:`skills-panel`,className:`flex-wrap`})}),t[64]=l,t[65]=A,t[66]=u,t[67]=r.skillsNavAria,t[68]=z):z=t[68];let B;t[69]!==g||t[70]!==_||t[71]!==l||t[72]!==x||t[73]!==y||t[74]!==C||t[75]!==E||t[76]!==j||t[77]!==T||t[78]!==v||t[79]!==S||t[80]!==b||t[81]!==D||t[82]!==p||t[83]!==r.discoverHeading||t[84]!==r.discoverHint||t[85]!==r.filterAll||t[86]!==r.filterDisabledOnly||t[87]!==r.filterEnabled||t[88]!==r.filterExtra||t[89]!==r.filterGlobal||t[90]!==r.filterInstalled||t[91]!==r.filterWorkspace||t[92]!==r.installedHeading||t[93]!==r.installedHint||t[94]!==r.marketplaceBrowseSwitchAria||t[95]!==r.marketplaceResultsTabsAria||t[96]!==r.marketplaceSortDownloads||t[97]!==r.marketplaceSortLabel||t[98]!==r.marketplaceSortNewest||t[99]!==r.sourceFilterAria||t[100]!==r.statusFilterAria||t[101]!==r.tabBuiltin||t[102]!==f?(B=l===`installed`?(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-balance text-sm font-semibold text-fg`,children:r.installedHeading}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:r.installedHint})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:[(0,Q.jsx)(c,{value:f,placeholder:r.filterAll,ariaLabel:r.sourceFilterAria,options:[{value:`all`,label:r.filterAll},{value:`builtin`,label:r.tabBuiltin},{value:`installed`,label:r.filterInstalled},{value:`workspace`,label:r.filterWorkspace},{value:`global`,label:r.filterGlobal},{value:`extra`,label:r.filterExtra}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>p(e)}),(0,Q.jsx)(c,{value:_,placeholder:r.filterAll,ariaLabel:r.statusFilterAria,options:[{value:`all`,label:r.filterAll},{value:`enabled`,label:r.filterEnabled},{value:`disabled`,label:Y(r.filterDisabledOnly,{count:g})}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>v(e)})]})]})}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-balance text-sm font-semibold text-fg`,children:r.discoverHeading}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:r.discoverHint})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:[T?null:(0,Q.jsx)(c,{value:x??``,placeholder:r.marketplaceBrowseSwitchAria,ariaLabel:r.marketplaceBrowseSwitchAria,options:C.map(Be),allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:S}),(0,Q.jsx)(c,{value:y,placeholder:r.marketplaceSortLabel,ariaLabel:r.marketplaceSortLabel,options:[{value:`downloads`,label:r.marketplaceSortDownloads},{value:`newest`,label:r.marketplaceSortNewest}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>b(e)})]})]}),T?(0,Q.jsx)(H,{items:j,activeTab:E,onChange:D,ariaLabel:r.marketplaceResultsTabsAria,tabIdPrefix:`skills-marketplace-results-tab`,panelIdPrefix:`skills-marketplace-results-panel`,className:`min-h-9 gap-1 overflow-x-auto rounded-lg border border-edge bg-surface-panel p-0.5 shadow-surface`,buttonClassName:`rounded-md px-2.5 py-1.5 text-xs`,selectedClassName:`bg-fg text-surface-panel dark:bg-fg dark:text-surface-base`,unselectedClassName:`text-fg-muted hover:text-fg`}):null]}),t[69]=g,t[70]=_,t[71]=l,t[72]=x,t[73]=y,t[74]=C,t[75]=E,t[76]=j,t[77]=T,t[78]=v,t[79]=S,t[80]=b,t[81]=D,t[82]=p,t[83]=r.discoverHeading,t[84]=r.discoverHint,t[85]=r.filterAll,t[86]=r.filterDisabledOnly,t[87]=r.filterEnabled,t[88]=r.filterExtra,t[89]=r.filterGlobal,t[90]=r.filterInstalled,t[91]=r.filterWorkspace,t[92]=r.installedHeading,t[93]=r.installedHint,t[94]=r.marketplaceBrowseSwitchAria,t[95]=r.marketplaceResultsTabsAria,t[96]=r.marketplaceSortDownloads,t[97]=r.marketplaceSortLabel,t[98]=r.marketplaceSortNewest,t[99]=r.sourceFilterAria,t[100]=r.statusFilterAria,t[101]=r.tabBuiltin,t[102]=f,t[103]=B):B=t[103];let V;t[104]!==l||t[105]!==n?(V=l===`marketplace`?(0,Q.jsx)(Ne,{...n}):(0,Q.jsx)(xe,{...n}),t[104]=l,t[105]=n,t[106]=V):V=t[106];let U;t[107]!==V||t[108]!==z||t[109]!==B?(U=(0,Q.jsxs)(`section`,{className:`flex flex-col gap-5`,children:[z,B,V]}),t[107]=V,t[108]=z,t[109]=B,t[110]=U):U=t[110];let W;t[111]!==M||t[112]!==U||t[113]!==N||t[114]!==P||t[115]!==R?(W=(0,Q.jsxs)(`div`,{className:M,children:[N,P,R,U]}),t[111]=M,t[112]=U,t[113]=N,t[114]=P,t[115]=R,t[116]=W):W=t[116];let G,ee,K;t[117]===n?(G=t[118],ee=t[119],K=t[120]):(G=(0,Q.jsx)(Ae,{...n}),ee=(0,Q.jsx)(Me,{...n}),K=(0,Q.jsx)(Ce,{...n}),t[117]=n,t[118]=G,t[119]=ee,t[120]=K);let q;t[121]!==W||t[122]!==G||t[123]!==ee||t[124]!==K||t[125]!==F?(q=(0,Q.jsxs)(`div`,{className:F,children:[W,G,ee,K]}),t[121]=W,t[122]=G,t[123]=ee,t[124]=K,t[125]=F,t[126]=q):q=t[126];let J;return t[127]!==q||t[128]!==I?(J=(0,Q.jsxs)(Q.Fragment,{children:[I,q]}),t[127]=q,t[128]=I,t[129]=J):J=t[129],J}function Be(e){return{value:e.id,label:e.displayName}}function Ve(e,t){return(0,Q.jsxs)(`li`,{className:`truncate`,children:[e.type,`: `,e.message]},`${e.path??e.skillName??`diagnostic`}-${t}`)}function He(e){return e.id}function Ue(e){let t=(0,X.c)(17),{vm:n}=e,{sk:r,hasToken:i,loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,setPendingFile:u,setInstallOpen:d,inSettingsShell:f}=n,p=N(Ge),m=N(We),h;t[0]!==a||t[1]!==l||t[2]!==o||t[3]!==s||t[4]!==d||t[5]!==u||t[6]!==c||t[7]!==r?(h=(0,Q.jsx)(de,{loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,sk:r,setPendingFile:u,setInstallOpen:d}),t[0]=a,t[1]=l,t[2]=o,t[3]=s,t[4]=d,t[5]=u,t[6]=c,t[7]=r,t[8]=h):h=t[8];let g=h,_,v;return t[9]!==m||t[10]!==i||t[11]!==f||t[12]!==p||t[13]!==r.title||t[14]!==g?(_=()=>!i||f?(m(),()=>m()):(p({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title})}),end:g}),()=>m()),v=[m,i,f,p,g,r.title],t[9]=m,t[10]=i,t[11]=f,t[12]=p,t[13]=r.title,t[14]=g,t[15]=_,t[16]=v):(_=t[15],v=t[16]),(0,Z.useLayoutEffect)(_,v),null}function We(e){return e.clearPageHeader}function Ge(e){return e.setPageHeader}async function Ke(t){let n=t.name.toLowerCase();if(n.endsWith(`.zip`))return t;if(n.endsWith(`skill.md`)){let n=(await i(async()=>{let{default:t}=await import(`./jszip.min-DT31yWkU.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([0,1]))).default,r=new n;r.file(`SKILL.md`,await t.arrayBuffer());let a=await r.generateAsync({type:`blob`,compression:`DEFLATE`}),o=t.name.replace(/\.md$/i,``).replace(/\s+/g,`-`)||`skill`;return new File([a],`${o}.zip`,{type:`application/zip`})}throw Error(`invalid`)}function qe(){let e=g(e=>e.language),t=m(e).skills,n=!!h(e=>e.token),r=s(),[i,c]=o(),l=i.get(`mprov`)?.trim()||null,[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),y=i.get(`q`)??``,b=i.get(`tab`),x=i.get(`source`),S=i.get(`status`),w=he.has(b)?b:`installed`,T=b===`builtin`?`builtin`:b===`user`?`installed`:null,D=ge.has(x)?x:T??`all`,O=_e.has(S)?S:`all`,[k,j]=(0,Z.useState)(y),[N]=A(k,250),P=N.trim(),F=k.trim().length>0,I=P.length>0,[L,R]=(0,Z.useState)(null),[z,B]=(0,Z.useState)(w),[V,H]=(0,Z.useState)(D),[ne,ae]=(0,Z.useState)(``),[Y,ce]=(0,Z.useState)(O),[le,X]=(0,Z.useState)(!1),[Q,de]=(0,Z.useState)(null),[fe,pe]=(0,Z.useState)(!1),[me,ye]=(0,Z.useState)(!1),[xe,Se]=(0,Z.useState)(null),[Ce,we]=(0,Z.useState)(null),[Te,Ee]=(0,Z.useState)({}),[De,Oe]=(0,Z.useState)(!1),[ke,Ae]=(0,Z.useState)(`catalog`),[je,Me]=(0,Z.useState)(``),[Ne,Pe]=(0,Z.useState)(null),[Fe,Ie]=(0,Z.useState)(null),[Le,Re]=(0,Z.useState)(!1),[ze,Be]=(0,Z.useState)(null),[Ve,He]=(0,Z.useState)(`downloads`),[Ue,We]=(0,Z.useState)(1),[Ge,qe]=(0,Z.useState)(null),[Je,Ye]=(0,Z.useState)(null),[Xe,Ze]=(0,Z.useState)(``),[$,Qe]=(0,Z.useState)(()=>l),[$e,et]=(0,Z.useState)(0),[tt,nt]=(0,Z.useState)(0),[rt,it]=(0,Z.useState)([]),at=(0,Z.useRef)(null),ot=(0,Z.useRef)(l),st=(0,Z.useRef)(null),ct=(0,Z.useRef)(``),lt=(0,Z.useRef)(null),ut=(0,Z.useRef)(!1),[dt,ft]=(0,Z.useState)({query:``,byProvider:{}}),[pt,mt]=(0,Z.useState)(`all`),ht=(0,Z.useRef)(0),gt=(0,Z.useRef)(P);gt.current!==P&&(gt.current=P,mt(e=>e===`all`?e:`all`));let _t=M(()=>E().then(e=>(it(e.diagnostics??[]),e.catalog.map(oe))),[n,tt],{enabled:n,initial:[],errorData:[]}),{data:vt,loading:yt,setData:bt}=_t,xt=M(async()=>{try{let{providers:e,current:t}=await q();return{providers:e.map(e=>({id:e.id,displayName:e.displayName})),current:t}}catch{try{return{providers:[],current:(await K()).provider}}catch{return{providers:[],current:`store`}}}},[n,$e],{enabled:n,initial:{providers:[],current:null}}),St=u||yt,Ct=xt.data.providers;(0,Z.useEffect)(()=>{let e=e=>{if(C(e.detail)===`skills`){if(ut.current){ut.current=!1;return}nt(e=>e+1)}else et(e=>e+1)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[]);let wt=i.toString(),Tt=(0,Z.useRef)(wt);if(Tt.current!==wt){Tt.current=wt;let e=i.get(`q`)??``,t=i.get(`tab`),n=i.get(`source`),r=i.get(`status`),a=he.has(t)?t:`installed`,o=t===`builtin`?`builtin`:t===`user`?`installed`:null,s=ge.has(n)?n:o??`all`,c=_e.has(r)?r:`all`;j(t=>t===e?t:e),B(e=>e===a?e:a),H(e=>e===s?e:s),ce(e=>e===c?e:c);let l=i.get(`mcat`)??``;Ze(a===`marketplace`?e=>e===l?e:l:``)}let Et=(0,Z.useRef)(n);!n&&Et.current&&(Qe(null),at.current=null),Et.current=n,n&&l&&ot.current!==l&&(ot.current=l,Qe(l)),n&&l==null&&xt.data.current&&xt.data.current!==st.current&&(st.current=xt.data.current,Qe(e=>e??xt.data.current));let Dt=`${P}|${Ve}|${z}|${Xe}|${$??``}|${pt}`;ct.current!==Dt&&(ct.current=Dt,We(1)),z===`marketplace`&&$&<.current!=null&<.current!==$&&Ze(``),lt.current=$;let Ot=M(()=>se({page:Ue,pageSize:20,sort:Ve,category:Xe.trim()||void 0,provider:$}),[n,z,Xe,Ue,Ve,I,$],{enabled:n&&z===`marketplace`&&!!$&&!I,initial:null,errorData:null});(0,Z.useEffect)(()=>{if(!n||!I||z!==`marketplace`||Ct.length===0)return;let e=++ht.current,r={};for(let e of Ct)r[e.id]={status:`loading`,rows:[]};ft({query:P,byProvider:r});let i=[],a=[];for(let n of Ct){let r=new AbortController;i.push(r);let o=window.setTimeout(()=>{r.abort(new DOMException(`Adapter timed out`,`TimeoutError`))},8e3);a.push(o),se({provider:n.id,q:P,page:1,pageSize:40,sort:Ve,signal:r.signal}).then(t=>{if(window.clearTimeout(o),e!==ht.current)return;let r=t.items.map(e=>({...e,providerId:n.id}));ft(e=>({...e,byProvider:{...e.byProvider,[n.id]:{status:`ok`,rows:r}}}))}).catch(r=>{if(window.clearTimeout(o),e!==ht.current)return;let i=r instanceof DOMException&&(r.name===`TimeoutError`||r.name===`AbortError`)?t.marketplaceLoadFailed:r instanceof Error?r.message:t.marketplaceLoadFailed;ft(e=>({...e,byProvider:{...e.byProvider,[n.id]:{status:`error`,rows:[],error:i}}}))})}return()=>{for(let e of a)window.clearTimeout(e);for(let e of i)e.abort()}},[n,z,I,P,Ct,Ve,t.marketplaceLoadFailed]);let kt=M(()=>re({provider:$,locale:e}).then(e=>e.items),[n,z,$,e],{enabled:n&&z===`marketplace`&&!!$,initial:[],errorData:[]}),At=(0,Z.useMemo)(()=>{if(!I||dt.query!==P)return[];let e=Ct.map(e=>({id:e.id,rows:[...dt.byProvider[e.id]?.rows??[]]})),t=[];for(;e.some(e=>e.rows.length>0);)for(let n of e)n.rows.length>0&&t.push(n.rows.shift());let n=new Map;for(let e of t){let t=[(e.id??``).toLowerCase().trim(),(e.name??``).toLowerCase().trim(),(e.author?.username??``).toLowerCase().trim()].join(`|`),r=n.get(t);if(!r){n.set(t,{...e,additionalSources:[]});continue}if(e.providerId&&e.providerId!==r.providerId){let t=r.additionalSources??[];t.some(t=>t.providerId===e.providerId)||(t.push({providerId:e.providerId,sourceLabel:e.sourceLabel}),r.additionalSources=t)}}return Array.from(n.values())},[I,P,dt,Ct]),jt=(0,Z.useMemo)(()=>{if(!I)return{};let e={all:At.length};for(let t of Ct)e[t.id]=At.filter(e=>e.providerId===t.id||(e.additionalSources??[]).some(e=>e.providerId===t.id)).length;return e},[I,At,Ct]),Mt=(0,Z.useMemo)(()=>I?pt===`all`?At:At.filter(e=>e.providerId===pt||(e.additionalSources??[]).some(e=>e.providerId===pt)):[],[I,At,pt]),Nt=(0,Z.useMemo)(()=>{if(!I)return{};let e={};for(let t of Ct)e[t.id]=dt.byProvider[t.id]?.status??`loading`;return e},[I,dt,Ct]),Pt=(0,Z.useMemo)(()=>Object.values(Nt).some(e=>e===`loading`),[Nt]),Ft=(0,Z.useMemo)(()=>{if(!I)return!1;let e=Object.values(Nt);return e.length>0&&e.every(e=>e===`error`)},[I,Nt]),It=(0,Z.useMemo)(()=>{if(!I||At.length===0&&Pt)return null;let e=Mt.length,t=(Ue-1)*20;return{items:Mt.slice(t,t+20),meta:{page:Ue,pageSize:20,total:e,totalPages:Math.max(1,Math.ceil(e/20))},provider:pt}},[I,At,Pt,Mt,Ue,pt]),Lt=z===`marketplace`?F?I?It:null:Ot.data:null,Rt=z===`marketplace`?F?I?Pt:!0:Ot.loading:!1,zt=I?Ft?t.marketplaceLoadFailed:null:Ot.error instanceof Error?Ot.error.message:Ot.error?t.marketplaceLoadFailed:null,Bt=z===`marketplace`?kt.data:[],Vt=z===`marketplace`?kt.loading:!1,Ht=kt.error instanceof Error?kt.error.message:kt.error?t.marketplaceCategoriesFailed:null;Xe.trim()&&Bt.length>0&&!Bt.some(e=>e.id===Xe)&&Ze(``);let Ut=(0,Z.useCallback)(async e=>{let n=e?.silent===!0;n||d(!0),p(null);try{let e=await E();return it(e.diagnostics??[]),bt(e.catalog.map(oe)),{ok:!0}}catch(e){let n=e instanceof Error?e.message:t.loadFailed;return p(n),{ok:!1,message:n}}finally{n||d(!1)}},[bt,t.loadFailed]),Wt=!u&&_t.error?_t.error instanceof Error?_t.error.message:t.loadFailed:null,Gt=f??Wt;(0,Z.useEffect)(()=>{c(e=>{let t=new URLSearchParams(e);return P?t.set(`q`,P):t.delete(`q`),z===`marketplace`?t.set(`tab`,z):t.delete(`tab`),V===`all`?t.delete(`source`):t.set(`source`,V),z===`installed`&&Y!==`all`?t.set(`status`,Y):t.delete(`status`),z===`marketplace`&&Xe.trim()?t.set(`mcat`,Xe.trim()):t.delete(`mcat`),z===`marketplace`&&$?t.set(ve,$):t.delete(ve),t.toString()===e.toString()?e:t},{replace:!0})},[z,Xe,$,P,Y,c,V]);let Kt=(0,Z.useCallback)((e,t,n=5e3)=>{R({kind:e,message:t}),window.setTimeout(()=>R(null),n)},[]),qt=(0,Z.useCallback)(e=>{let n=e.availability;if(!n)return t.installSuccess;let r=n.skillName||n.skillId;if(!n.loaded)return`Skill "${r}" installed, but it was not loaded. Check skill diagnostics.`;if(n.diagnostics.length>0)return`Skill "${r}" installed with ${n.diagnostics.length} diagnostic(s).`;if(n.enabled===!1)return`Skill "${r}" installed but disabled. Enable it before use.`;if(n.availableForDefaultAgent===!1){let e=n.unavailableReason||`unavailable`;return`Skill "${r}" installed but unavailable for agent "${n.defaultAgentId}" (${e}).`}return`Skill "${r}" installed and ready.`},[t.installSuccess]),Jt=(0,Z.useCallback)(async e=>{Ae(`catalog`),Oe(!0),Me(e.name),Pe(null),Ie(null),Be(null),Re(!0);try{let t=await ie(e.name);Pe(t),Me(t.name)}catch(e){Pe(null),Be(e instanceof Error?e.message:t.detailLoadFailed)}finally{Re(!1)}},[t.detailLoadFailed]),Yt=(0,Z.useCallback)(async e=>{let n=e.trim();if(n){Ae(`catalog`),Oe(!0),Me(n),Pe(null),Ie(null),Be(null),Re(!0);try{let e=await ie(n);Pe(e),Me(e.name)}catch(e){Pe(null),Be(e instanceof Error?e.message:t.detailLoadFailed)}finally{Re(!1)}}},[t.detailLoadFailed]),Xt=(0,Z.useCallback)(async(e,n,r)=>{let i=r?.trim()||$;if(i){at.current=i,Ae(`store`),Oe(!0),Me(n?.trim()||e),Pe(null),Ie(null),Be(null),Re(!0);try{let t=await ue(e,{provider:i});Me(t.name),Ie(t.skillDocPreview)}catch(e){Ie(null),Be(e instanceof Error?e.message:t.detailLoadFailed)}finally{Re(!1)}}},[$,t.detailLoadFailed]),Zt=(0,Z.useCallback)(async(e,n)=>{we(e),Ee(t=>({...t,[e]:n})),R(null);try{return await J(e,n),await Ut({silent:!0}),!0}catch(n){return Ee(t=>{let{[e]:n,...r}=t;return r}),Kt(`error`,n instanceof Error?n.message:t.skillToggleFailed),!1}finally{we(null),Ee(t=>{let{[e]:n,...r}=t;return r})}},[Ut,Kt,t.skillToggleFailed]),Qt=(0,Z.useCallback)(async()=>{R(null),d(!0),p(null);try{await U()}catch(e){p(e instanceof Error?e.message:t.reloadFailed),d(!1);return}await Ut()},[Ut,t.reloadFailed]),$t=(0,Z.useMemo)(()=>{let e=k.trim().toLowerCase();return e?vt.filter(t=>[t.name,t.description,t.directoryId,t.path,t.source,t.hub?.source,t.hub?.ref].filter(Boolean).join(` `).toLowerCase().includes(e)):vt},[vt,k]),en=(0,Z.useMemo)(()=>{let e=vt.filter(e=>e.source===`builtin`);return{total:e.length,enabled:e.filter(e=>Te[e.name]??e.enabled).length}},[vt,Te]),tn=(0,Z.useMemo)(()=>{let e=vt.filter(e=>e.source!==`builtin`);return{total:e.length,enabled:e.filter(e=>Te[e.name]??e.enabled).length}},[vt,Te]),nn=(0,Z.useMemo)(()=>je?vt.find(e=>e.name===je):void 0,[vt,je]),rn=nn==null?!0:Te[je]??nn.enabled,an=nn?.directoryId??null,on=nn?.managed??!1,sn=(0,Z.useMemo)(()=>ke!==`store`||!je?null:G(at.current??$,je),[ke,je,$]),cn=(0,Z.useMemo)(()=>{let e=$t;return z===`installed`&&V!==`all`&&(e=V===`installed`?e.filter(e=>e.source!==`builtin`):e.filter(e=>e.source===V)),e},[$t,z,V]),ln=(0,Z.useMemo)(()=>{let e=new Set,t=[];for(let n of cn){let r=n.category;!r||e.has(r)||(e.add(r),t.push(r))}return t.sort((e,t)=>{let n=be.indexOf(e),r=be.indexOf(t);return n>=0&&r>=0?n-r:n>=0?-1:r>=0?1:e.localeCompare(t)})},[cn]),un=(0,Z.useCallback)(e=>t.categoryLabel?.[e]||e,[t.categoryLabel]),dn=(0,Z.useMemo)(()=>ne?cn.filter(e=>e.category===ne):cn,[cn,ne]);(0,Z.useEffect)(()=>{ae(``)},[V]);let fn=(0,Z.useCallback)(e=>Te[e.name]??e.enabled,[Te]),pn=(0,Z.useMemo)(()=>dn.filter(e=>!fn(e)).length,[dn,fn]),mn=(0,Z.useMemo)(()=>{let e=dn;return Y===`disabled`&&(e=e.filter(e=>!fn(e))),Y===`enabled`&&(e=e.filter(e=>fn(e))),[...e].toSorted((e,t)=>{let n=fn(e);return n===fn(t)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})},[dn,Y,fn]),hn=async e=>{R(null),v(!0),p(null);try{let n;try{n=await Ke(e)}catch{p(t.invalidFile),Kt(`error`,t.invalidFile);return}let r=await W(n,{overwrite:!0});ut.current=!0,await Ut(),Kt(`success`,qt(r)),X(!1),de(null),B(`installed`),H(`installed`),await Yt(r.availability?.skillName||r.skillId)}catch(e){p(e instanceof Error?e.message:t.uploadFailed),Kt(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{v(!1)}},gn=()=>{Q&&hn(Q)},_n=e=>{let t=e.target.files?.[0];e.target.value=``,t&&de(t)},vn=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.types.includes(`Files`)&&(pe(!0),e.dataTransfer.dropEffect=`copy`)},yn=e=>{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||pe(!1)},bn=e=>{e.preventDefault(),e.stopPropagation(),pe(!1);let t=e.dataTransfer?.files?.[0];t&&de(t)},xn=e=>{if(e.origin===`agents-global`)return t.source.agentsGlobal;if(e.origin===`agents-workspace`)return t.source.agentsWorkspace;switch(e.source){case`builtin`:return t.source.builtin;case`workspace`:return t.source.workspace;case`global`:return t.source.global;case`extra`:return t.source.extra;default:return e.source}},Sn=async()=>{let e=xe,n=De&&ke===`catalog`&&an===e;if(ye(!1),Se(null),e){R(null);try{await ee(e),ut.current=!0,await Ut(),n&&(Oe(!1),Ae(`catalog`),Me(``),Pe(null),Ie(null),Be(null))}catch(e){p(e instanceof Error?e.message:t.deleteFailed)}}},Cn=(0,Z.useCallback)(e=>vt.some(t=>t.name===e),[vt]),wn=(0,Z.useCallback)(async e=>{let n=(e?.name??je).trim();if(!n)return;let i=e?.source??ke;if(i===`catalog`){let e=vt.find(e=>e.name===n);if(e&&!(Te[e.name]??e.enabled))return}R(null);let a=i===`store`&&!Cn(n);Ye(n);try{if(a){let t=e?.providerOverride?.trim()||at.current||$;await te({name:n,overwrite:!1,...t?{provider:t}:{}}),ut.current=!0,await Ut({silent:!0})}Oe(!1),r(`/chat/new?skill=${encodeURIComponent(n)}`)}catch(e){Kt(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{Ye(null)}},[vt,je,ke,Te,Cn,Ut,r,Kt,t.uploadFailed,$]),Tn=(0,Z.useCallback)(async(e,n)=>{let r=Cn(e);if(!(r&&!window.confirm(t.marketplaceReinstallConfirm))){R(null),qe(e);try{let t=n?.providerOverride?.trim()||(n?.useDetailProvider?at.current??$:$),i=await te({name:e,overwrite:r,...t?{provider:t}:{}});ut.current=!0,await Ut({silent:!0}),Kt(`success`,qt(i)),B(`installed`),H(`installed`),await Yt(i.availability?.skillName||i.skillId||e)}catch(e){Kt(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{qe(null)}}},[Cn,qt,Ut,$,Yt,Kt,t.marketplaceReinstallConfirm,t.uploadFailed]),{pathname:En}=a();return{sk:t,hasToken:n,catalog:vt,loading:St,error:Gt,uploading:_,searchQuery:k,setSearchQuery:j,actionFeedback:L,skillDiagnostics:rt,mainTab:z,setMainTab:B,sourceFilter:V,setSourceFilter:H,builtinCategoryFilter:ne,setBuiltinCategoryFilter:ae,installOpen:le,setInstallOpen:X,pendingFile:Q,setPendingFile:de,dropActive:fe,setDropActive:pe,confirmOpen:me,setConfirmOpen:ye,confirmId:xe,setConfirmId:Se,togglingSkillName:Ce,enabledOverride:Te,detailOpen:De,setDetailOpen:Oe,detailSource:ke,setDetailSource:Ae,detailTitle:je,setDetailTitle:Me,detailCatalogPreview:Ne,setDetailCatalogPreview:Pe,detailMarketplacePreview:Fe,setDetailMarketplacePreview:Ie,detailLoading:Le,detailError:ze,setDetailError:Be,marketSort:Ve,setMarketSort:He,marketPage:Ue,setMarketPage:We,mpLoading:Rt,mpError:zt,mpPayload:Lt,searchActive:I,searchInputActive:F,resultTab:pt,setResultTab:mt,aggregatedTabCounts:jt,aggregatedProviderStatus:Nt,aggregatedAllFailed:Ft,installingMarketName:Ge,usingSkillInChatName:Je,onUseSkillInChat:wn,marketCategoryId:Xe,setMarketCategoryId:Ze,mpCategories:Bt,mpCategoriesError:Ht,mpCategoriesLoading:Vt,marketBrowseProvider:$,setMarketBrowseProvider:Qe,registeredProviders:Ct,builtinTabStats:en,userTabStats:tn,detailEnabled:rn,detailDirectoryId:an,detailManaged:on,detailExternalUrl:sn,filteredCatalog:cn,builtinCategories:ln,categoryFilteredCatalog:dn,catalogDisplayRows:mn,catalogDisabledCount:pn,catalogStatusFilter:Y,setCatalogStatusFilter:ce,resolveSkillEnabled:fn,inSettingsShell:En.startsWith(`/settings/`),categoryLabel:un,onReloadClick:Qt,openSkillDetail:Jt,openMarketplaceDetail:Xt,onSkillToggle:Zt,onInstallSubmit:gn,onFileInputChange:_n,onModalDragOver:vn,onModalDragLeave:yn,onModalDrop:bn,sourceLabel:xn,runDelete:Sn,onMarketInstall:Tn,isSkillInstalledByName:Cn}}function Je(){let e=(0,X.c)(2),t=qe(),n;return e[0]===t?n=e[1]:(n=(0,Q.jsx)(ze,{vm:t}),e[0]=t,e[1]=n),n}export{Je as SkillsPage};
|
|
@@ -1 +0,0 @@
|
|
|
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,f as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as s,r as c}from"./popover-select-BzdnTy3h.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./cn-JdwAhgNB.js";import{t as d}from"./button-CSEbl4zT.js";import{l as f,n as ee}from"./locale-store-CnamlR07.js";import{i as te,n as p,o as ne,r as re,s as m,t as ie}from"./dist-BPoKqzeH.js";import{A as ae,Ei as h,Gt as g,H as _,K as oe,Ks as v,Kt as y,M as b,Ma as se,Na as x,Qi as ce,Qs as S,R as le,Ti as C,Tl as w,W as T,Wa as E,Yo as D,Zr as O,_l as k,ci as A,dr as j,fr as M,gr as ue,ha as de,lc as fe,mr as pe,n as me,nl as he,pr as ge,q as _e,qc as ve,ql as ye,qt as be,si as N,vl as P}from"./index-DRrjYYzZ.js";import{t as xe}from"./date-picker-Dtn7e6TW.js";import{t as Se}from"./dependency-picker-Br6nPaM6.js";var F=e(t(),1),I=n();function Ce(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function we(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}var L=r();function Te(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Ee(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,L.jsx)(x,{className:`h-32 rounded-2xl`}),(0,L.jsx)(x,{className:`h-52 rounded-2xl`}),(0,L.jsx)(x,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function De(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Oe(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var ke=`xopc.taskDetail.chatPanelPercent`,R=42;function Ae(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?R:Math.min(r,Math.max(n,e))}function je(){try{let e=Number(window.localStorage.getItem(ke));return Number.isFinite(e)&&e>=30&&e<=60?e:R}catch{return R}}function Me(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`paused`:e.operationalState}function z(e){let t=(0,I.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,L.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,L.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,L.jsx)(t===`passed`?w:t===`failed`?P:k,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,L.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,L.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function Ne({taskId:e,presentation:t,backgroundPath:n}){let[r]=a(),i=ee(e=>e.language),te=f(e=>e.token),p=(0,F.useMemo)(()=>_e(i),[i]),ne=E(e=>e.setPageHeader),re=E(e=>e.clearPageHeader),{data:m,error:ie,mutate:x,lastChange:D,conversationLoading:k,conversationError:A}=ae(e),[be,N]=(0,F.useState)(null),[P,I]=(0,F.useState)(!1),[Ne,B]=(0,F.useState)([]),[V,Pe]=(0,F.useState)(null),[Fe,Ie]=(0,F.useState)([]),[Le,H]=(0,F.useState)(!1),[Re,U]=(0,F.useState)(``),[ze,W]=(0,F.useState)(!1),[G,Be]=(0,F.useState)(``),[K,Ve]=(0,F.useState)(je),[He,Ue]=(0,F.useState)(!1),We=(0,F.useRef)(null),Ge=(0,F.useRef)(!1),Ke=(0,F.useRef)(!1),qe=(0,F.useRef)(``),Je=(0,F.useRef)(null),Ye=(0,F.useRef)(null),Xe=(0,F.useRef)(null),[Ze,q]=(0,F.useState)(null),[Qe,$e]=(0,F.useState)(null),et=m?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,tt=(0,F.useMemo)(()=>C(r.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[r]);(0,F.useEffect)(()=>{N(null),q(null),H(!1),W(!1),$e(null)},[e]),(0,F.useEffect)(()=>{let e=!0;return se().then(t=>{e&&Ie(t.items)}).catch(()=>void 0),()=>{e=!1}},[te]),(0,F.useEffect)(()=>{if(!D||D.source===`user`)return;$e(D);let e=window.setTimeout(()=>$e(null),3500);return()=>window.clearTimeout(e)},[D]),(0,F.useEffect)(()=>{let t=m?.task.projectId,n=m?.dependencies??[];if(!t){Xe.current=null,Pe(null),B(n);return}Xe.current!==t&&(Xe.current=t,Pe(null));let r=!0;return de(t).then(t=>{if(!r)return;Pe(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});B([...i.values()])}).catch(()=>{r&&B(n)}),()=>{r=!1}},[et,m?.task.projectId,e]);let J=async t=>{if(m){I(!0),N(null);try{await x(await b(e,t,m.task.version),{revalidate:!1})}catch{N(p.actionFailed)}finally{I(!1)}}},Y=async t=>{if(!m)return!1;I(!0),N(null);try{return await x(T(e,t,m.task.version),{optimisticData:we(m,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return N(p.actionFailed),!1}finally{I(!1)}},nt=async()=>{if(!m)return;if(Ge.current){Ge.current=!1;return}let e=Re.trim(),t=Je.current;if(Ce(t,m.task.version,m.task.title,e)){q(`title`);return}if(!e||e===m.task.title){U(m.task.title),H(!1);return}await Y({title:e})&&(q(null),H(!1))},rt=async()=>{if(!m)return;if(Ke.current){Ke.current=!1;return}let e=G.trim(),t=Ye.current;if(Ce(t,m.task.version,m.task.body??``,e)){q(`description`);return}if(G===qe.current||e===(m.task.body??``).trim()){W(!1);return}await Y({body:e||null})&&(q(null),W(!1))},it=async e=>{if(!(!m||e===m.task.phase)){if(m.task.phase===`closed`){await J({type:`reopen`,phase:e===`closed`?`ready`:e});return}if(e===`closed`){await J({type:`close`,resolution:`done`});return}await J({type:`move`,phase:e})}},X=(0,F.useCallback)(e=>{Ve(e);try{window.localStorage.setItem(ke,String(e))}catch{}},[]),at=(0,F.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=We.current?.clientWidth??0;X(Ae(e.key===`Home`?R:K+(e.key===`ArrowLeft`?2:-2),t))},[K,X]),ot=(0,F.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=We.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),Ue(!0);let i=K,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Ae((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}Ue(!1),X(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[K,X]),st=async t=>{if(m){I(!0),N(null);try{await x(await oe(e,t,m.task.version),{revalidate:!1})}catch{N(p.dependencyUpdateFailed)}finally{I(!1)}}},ct=async t=>{if(!(!m||!t||t===m.conversation.currentExecutorAgentId)){I(!0),N(null);try{await x(await le(e,t,m.task.version),{revalidate:!1})}catch{N(p.actionFailed)}finally{I(!1)}}};if((0,F.useLayoutEffect)(()=>{if(t!==`modal`)return ne({startExtra:(0,L.jsx)(o,{to:tt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":p.backToWork,children:(0,L.jsx)(ye,{className:`size-4`})}),main:m?(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:V?`${V} / ${p.taskLabel}`:p.taskLabel}),(0,L.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p.detailStatuses[Me(m)]})]}):null,end:null}),re},[re,p.backToWork,p.detailStatuses,p.taskLabel,m,t,V,tt,ne]),ie&&!m)return(0,L.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:p.taskNotFound});if(!m)return(0,L.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,L.jsx)(Ee,{})});let lt=m.waits[0],ut=lt?.kind===`paused`?lt:void 0,Z=m.receipts[0],dt=p.detailStatuses[Me(m)],ft=p.detailStatusDescriptions[Me(m)],pt=m.task.body?.trim()||m.task.contract?.objective.trim(),mt=new Map(Z?.verification.checks.map(e=>[e.criterion,e.status])),ht=m.allowedCommands.includes(`mark_ready`),gt=m.allowedCommands.includes(`start`),_t=m.allowedCommands.includes(`add_wait`),vt=m.task.phase===`review`&&m.allowedCommands.includes(`close`),yt=m.allowedCommands.includes(`reopen`),bt=m.conversation.activeSessionKey,Q=m.conversation.currentExecutorAgentId??m.task.delegateAgentId??m.task.ownerId,xt=Fe.find(e=>e.id===Q),St=m.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Ct=m.task.contract?.acceptanceCriteria??[],wt=Ct.filter(e=>mt.get(e)===`passed`).length,Tt=m.task.contract?.expectedOutputs??[],Et=m.task.contract?.constraints??[],Dt=m.task.contract?.approvalRequired??[],Ot=m.task.contract?.assumptions??[],kt=m.task.contract?.risks??[],$=(...e)=>!!Qe?.changedFields.some(t=>e.includes(t)),At=e=>t===`modal`&&n?y(n,e):h(`/tasks/${e}`,tt),jt=m.allowedCommands.includes(`move`),Mt=e=>e!==m.task.phase&&(e===`closed`?!vt:m.task.phase===`closed`?!yt:!jt),Nt=(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[ht?(0,L.jsxs)(d,{variant:`primary`,disabled:P,onClick:()=>void J({type:`mark_ready`}),children:[(0,L.jsx)(v,{className:`size-4`}),p.scheduleTask]}):null,ut?(0,L.jsxs)(d,{variant:`primary`,disabled:P,onClick:()=>void J({type:`resolve_wait`,waitId:ut.id}),children:[(0,L.jsx)(v,{className:`size-4`}),p.resumeTask]}):null,!lt&>&&Q?(0,L.jsxs)(d,{variant:`primary`,disabled:P,onClick:()=>void J({type:`start`,executor:{kind:`agent`,agentId:Q}}),children:[(0,L.jsx)(v,{className:`size-4`}),p.runTask]}):null,vt?(0,L.jsxs)(d,{variant:`primary`,disabled:P,onClick:()=>void J({type:`close`,resolution:`done`}),children:[(0,L.jsx)(w,{className:`size-4`}),p.approveTask]}):null,yt?(0,L.jsxs)(d,{variant:`primary`,disabled:P,onClick:()=>void J({type:`reopen`,phase:`ready`}),children:[(0,L.jsx)(v,{className:`size-4`}),p.reopenTask]}):null,!lt&&_t?(0,L.jsxs)(d,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:P,onClick:()=>void J({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,L.jsx)(S,{className:`size-4`}),p.pauseTask]}):null,m.task.phase===`closed`?null:(0,L.jsxs)(pe,{children:[(0,L.jsx)(ue,{asChild:!0,children:(0,L.jsx)(d,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:P,"aria-label":p.moreActions,children:(0,L.jsx)(he,{className:`size-4`,"aria-hidden":!0})})}),(0,L.jsx)(ge,{children:(0,L.jsx)(j,{align:`end`,sideOffset:6,className:`z-[100] min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,L.jsx)(M,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void J({type:`close`,resolution:`cancelled`}),children:p.cancelTask})})})]})]});return(0,L.jsxs)(`div`,{ref:We,className:`${t===`modal`?`flex h-full min-h-0 flex-col lg:flex-row`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden lg:flex-row`} ${He?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${K}%`},children:[(0,L.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,L.jsxs)(`header`,{className:u(`px-4 pb-5`,$(`title`)&&`task-detail-live-update`),children:[(0,L.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[V?(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,L.jsx)(ve,{className:`size-3.5`,"aria-hidden":!0}),V]}):null,(0,L.jsx)(`span`,{children:`/`}),(0,L.jsx)(`span`,{children:p.taskLabel}),Qe?(0,L.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:Qe.source===`agent`?i===`zh`?`Agent 刚刚更新`:`Updated by Agent`:i===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Le?(0,L.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:Re,onChange:e=>U(e.target.value),onBlur:()=>void nt(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Ge.current=!0,U(m.task.title),H(!1),queueMicrotask(()=>{Ge.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,L.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{Je.current={value:m.task.title,version:m.task.version},q(null),U(m.task.title),H(!0)},children:(0,L.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:m.task.title})}),Ze===`title`?(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,L.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,L.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{U(m.task.title),q(null),H(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,L.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({title:Re.trim()}).then(e=>{e&&(q(null),H(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),be?(0,L.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:be}):null]}),(0,L.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,L.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,L.jsxs)(`section`,{className:u(`rounded-xl bg-surface-panel p-4`,$(`body`)&&`task-detail-live-update`),children:[(0,L.jsx)(`h2`,{className:`font-medium text-fg`,children:p.taskDescription}),ze?(0,L.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:G,onChange:e=>Be(e.target.value),onBlur:()=>void rt(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Ke.current=!0,Be(m.task.body??m.task.contract?.objective??``),W(!1),queueMicrotask(()=>{Ke.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,L.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=m.task.body??m.task.contract?.objective??``;qe.current=e,Ye.current={value:m.task.body??``,version:m.task.version},q(null),Be(e),W(!0)},children:(0,L.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:pt&&pt!==m.task.title?pt:p.noTaskDescription})}),Ze===`description`?(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,L.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,L.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Be(m.task.body??``),q(null),W(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,L.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({body:G.trim()||null}).then(e=>{e&&(q(null),W(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),m.attention.length>0?(0,L.jsxs)(`section`,{className:u(`rounded-xl bg-warning/10 p-4`,$(`attention`)&&`task-detail-live-update`),children:[(0,L.jsx)(`h3`,{className:`font-medium text-fg`,children:St?p.needsAttention:p.waitingStatus}),(0,L.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:m.attention.map((e,t)=>(0,L.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,L.jsxs)(`section`,{className:u(`rounded-xl bg-surface-panel p-4`,$(`contract`)&&`task-detail-live-update`),children:[(0,L.jsx)(`h2`,{className:`font-medium text-fg`,children:p.taskDefinition}),(0,L.jsxs)(`div`,{className:`mt-5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:p.successDefinition}),Ct.length>0?(0,L.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:p.criteriaProgress.replace(`{{verified}}`,String(wt)).replace(`{{total}}`,String(Ct.length))}):null]}),(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(z,{items:Ct,empty:p.noDefinition,verificationByCriterion:mt})})]}),Tt.length>0?(0,L.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:p.expectedOutputs}),(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(z,{items:Tt,empty:p.noDefinition})})]}):null,Et.length>0?(0,L.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:p.constraints}),(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(z,{items:Et,empty:p.noDefinition})})]}):null,Dt.length>0?(0,L.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:p.approvalRequired}),(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(z,{items:Dt,empty:p.noDefinition})})]}):null,Ot.length>0?(0,L.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:p.contextAssumptions}),(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(z,{items:Ot,empty:p.noDefinition})})]}):null,kt.length>0?(0,L.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:p.contextRisks}),(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(z,{items:kt,empty:p.noDefinition})})]}):null]}),Z?(0,L.jsxs)(`section`,{className:u(`rounded-xl bg-surface-panel p-4`,$(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`font-medium text-fg`,children:p.latestResult}),(0,L.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg`,children:Z.summary})]}),(0,L.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[p.receiptStatuses[Z.status],` · `,p.verificationStatuses[Z.verification.status]]})]}),Z.remainingWork.length>0?(0,L.jsxs)(`div`,{className:`mt-4`,children:[(0,L.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:p.remainingWork}),(0,L.jsx)(`div`,{className:`mt-2`,children:(0,L.jsx)(z,{items:Z.remainingWork,empty:p.noRemainingWork})})]}):null,Z.nextAction?(0,L.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,L.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:p.nextAction}),(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Z.nextAction})]}):null,(0,L.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(d,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void _(Z.runId,`helpful`),children:p.doneWell}),(0,L.jsx)(d,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void _(Z.runId,`not_helpful`),children:p.needsFix}),Z.evidence.filter(e=>e.uri).map(e=>(0,L.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,L.jsx)(l,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),m.receipts.length>1?(0,L.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:p.executionHistory.replace(`{{count}}`,String(m.receipts.length-1))}),(0,L.jsx)(`div`,{className:`mt-3 space-y-3`,children:m.receipts.slice(1).map(e=>(0,L.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,L.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,L.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:p.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,m.context.length>0?(0,L.jsxs)(`section`,{className:u(`rounded-xl bg-surface-panel p-4`,$(`context`)&&`task-detail-live-update`),children:[(0,L.jsx)(`h2`,{className:`font-medium text-fg`,children:p.contextUsed}),(0,L.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:m.context.map(e=>(0,L.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[p.contextRoleLabels[e.role],` · `,p.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,L.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,L.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,L.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,L.jsxs)(`section`,{className:u(`rounded-xl bg-surface-subtle p-4`,$(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,L.jsx)(`h2`,{className:`font-medium text-fg`,children:p.taskProperties}),(0,L.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,L.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[(0,L.jsx)(`span`,{children:p.taskPhase}),(0,L.jsx)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:m.task.phase,disabled:P,onChange:e=>void it(e.target.value),children:[`backlog`,`ready`,`active`,`review`,`closed`].map(e=>(0,L.jsx)(c,{value:e,disabled:Mt(e),children:Te(e,i)},e))})]}),(0,L.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[(0,L.jsx)(`span`,{children:p.priority}),(0,L.jsx)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:m.task.priority,disabled:P,onChange:e=>void Y({priority:e.target.value}),children:[`low`,`normal`,`high`,`critical`].map(e=>(0,L.jsx)(c,{value:e,children:p.priorityLabels[e]},e))})]}),(0,L.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[(0,L.jsx)(`span`,{children:p.dueDate}),(0,L.jsx)(xe,{disabled:P,value:De(m.task.dueAt),onChange:e=>void Y({dueAt:Oe(e)}),ariaLabel:p.dueDate})]}),(0,L.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[(0,L.jsx)(`span`,{children:p.executorLabel}),(0,L.jsxs)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:m.conversation.currentExecutorAgentId??``,disabled:P,onChange:e=>void ct(e.target.value),children:[(0,L.jsx)(c,{value:``,disabled:!0,children:p.unassigned}),Fe.map(e=>(0,L.jsx)(c,{value:e.id,children:e.name||e.id},e.id))]})]}),V?(0,L.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,L.jsx)(`span`,{children:p.projectLabel}),(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,L.jsx)(ve,{className:`size-3.5`}),V]})]}):null]}),(0,L.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,L.jsx)(`p`,{children:dt}),(0,L.jsx)(`p`,{children:ft}),(0,L.jsx)(`p`,{className:`mt-2`,children:p.updatedAt.replace(`{{date}}`,O(m.task.updatedAt,i))})]})]}),(0,L.jsxs)(`section`,{className:u(`rounded-xl bg-surface-panel p-4`,$(`dependencies`)&&`task-detail-live-update`),children:[(0,L.jsx)(`h2`,{className:`font-medium text-fg`,children:p.taskRelations}),(0,L.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:p.dependencies}),(0,L.jsx)(Se,{borderless:!0,candidates:Ne,selectedIds:m.dependencies.map(e=>e.id),disabled:P,onChange:e=>void st(e),labels:{link:p.linkDependencies,linked:p.linkedDependencies,searchPlaceholder:p.dependencySearchPlaceholder,noMatches:p.noDependencyMatches,noCandidates:p.noDependencyCandidates,remove:p.removeDependency}})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:p.dependents}),m.dependents.length>0?(0,L.jsx)(`div`,{className:`space-y-1.5`,children:m.dependents.map(e=>(0,L.jsx)(o,{to:At(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,L.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:p.noDependents})]})]})]})]})]})]}),(0,L.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":i===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(K),tabIndex:0,onPointerDown:ot,onKeyDown:at,onDoubleClick:()=>X(R),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${He?`bg-surface-hover`:``}`,children:(0,L.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,L.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,L.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,L.jsx)(`div`,{className:`min-w-0`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Q?(0,L.jsx)(ce,{agentId:Q,avatar:xt?.avatar,size:28,className:`shrink-0`}):null,(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:i===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,L.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[xt?.name??Q??p.unassigned,` · `,dt]})]})]})}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[Nt,bt?(0,L.jsx)(d,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,L.jsxs)(o,{to:g(e),children:[(0,L.jsx)(l,{className:`size-3.5`}),i===`zh`?`全屏`:`Full screen`]})}):null]})]}),bt?(0,L.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,L.jsx)(me,{embedded:!0,sessionKey:bt,taskId:e})}):k?(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,L.jsxs)(`div`,{className:`max-w-xs`,children:[(0,L.jsx)(fe,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,L.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):A?(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,L.jsxs)(`div`,{className:`max-w-xs`,children:[(0,L.jsx)(fe,{className:`mx-auto size-8 text-danger`}),(0,L.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,L.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:A instanceof Error?A.message:String(A)})]})}):(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,L.jsxs)(`div`,{className:`max-w-xs`,children:[(0,L.jsx)(fe,{className:`mx-auto size-8 text-fg-subtle`}),(0,L.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,L.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:i===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]})]})}function B(){let e=(0,I.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,L.jsx)(Ne,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function V(e){let t=(0,I.c)(43),{taskId:n,backgroundPath:r,onClose:i}=e,a=ee(ze),o=A(U),s=A(Re),c=A(H),l=N(Le),u=N(Ie),d=o?s:0,f;t[0]!==i||t[1]!==u?(f=e=>{e||(u(null),i())},t[0]=i,t[1]=u,t[2]=f):f=t[2];let ae=a===`zh`?`关闭任务详情`:`Close task details`,h;t[3]!==i||t[4]!==u?(h=()=>{u(null),i()},t[3]=i,t[4]=u,t[5]=h):h=t[5];let g;t[6]!==ae||t[7]!==h?(g=(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":ae,onClick:h}),t[6]=ae,t[7]=h,t[8]=g):g=t[8];let _=o?`true`:`false`,oe=`${d/2}px`,v=`${d}px`,y;t[9]!==oe||t[10]!==v?(y={"--task-detail-workspace-offset":oe,"--task-detail-workspace-width":v},t[9]=oe,t[10]=v,t[11]=y):y=t[11];let b=y,se=a===`zh`?`任务详情`:`Task details`,x;t[12]===se?x=t[13]:(x=(0,L.jsx)(m,{className:`font-medium text-fg`,children:se}),t[12]=se,t[13]=x);let ce=a===`zh`?`查看并操作任务详情`:`View and manage task details`,S;t[14]===ce?S=t[15]:(S=(0,L.jsx)(te,{className:`sr-only`,children:ce}),t[14]=ce,t[15]=S);let le=a===`zh`?`关闭任务详情`:`Close task details`,C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,L.jsx)(D,{className:`size-4`,"aria-hidden":!0}),t[16]=C):C=t[16];let w;t[17]===le?w=t[18]:(w=(0,L.jsx)(p,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":le,children:C}),t[17]=le,t[18]=w);let T;t[19]!==x||t[20]!==S||t[21]!==w?(T=(0,L.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[x,S,w]}),t[19]=x,t[20]=S,t[21]=w,t[22]=T):T=t[22];let E;t[23]!==r||t[24]!==n?(E=(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,L.jsx)(Ne,{taskId:n,presentation:`modal`,backgroundPath:r})}),t[23]=r,t[24]=n,t[25]=E):E=t[25];let O;t[26]!==T||t[27]!==E||t[28]!==_||t[29]!==b?(O=(0,L.jsxs)(re,{className:`task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl bg-surface-base shadow-float focus:outline-none`,"data-workspace-panel-open":_,style:b,onEscapeKeyDown:Fe,onInteractOutside:Pe,children:[T,E]}),t[26]=T,t[27]=E,t[28]=_,t[29]=b,t[30]=O):O=t[30];let k;t[31]!==l||t[32]!==o||t[33]!==s||t[34]!==c?(k=l?(0,L.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:o?s:0},children:(0,L.jsx)(be,{allowOutsideChat:!0,sessionKey:c??void 0})}):null,t[31]=l,t[32]=o,t[33]=s,t[34]=c,t[35]=k):k=t[35];let j;t[36]!==O||t[37]!==k||t[38]!==g?(j=(0,L.jsxs)(ne,{children:[g,O,k]}),t[36]=O,t[37]=k,t[38]=g,t[39]=j):j=t[39];let M;return t[40]!==f||t[41]!==j?(M=(0,L.jsx)(ie,{modal:!1,open:!0,onOpenChange:f,children:j}),t[40]=f,t[41]=j,t[42]=M):M=t[42],M}function Pe(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Fe(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function Ie(e){return e.setPath}function Le(e){return e.path}function H(e){return e.sessionKeyOverride}function Re(e){return e.widthPx}function U(e){return e.open}function ze(e){return e.language}export{V as TaskDetailModal,B as TaskDetailPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./button-CSEbl4zT.js";import{n as d}from"./locale-store-CnamlR07.js";import{a as f,i as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BPoKqzeH.js";import{i as y}from"./vendor-swr-BIWyz7Rc.js";import{Ds as b,Na as x,Nl as S,Ol as C,Pl as w,Vc as T,Wa as E,Ws as D,Xs as O,Yo as k,_o as A,ao as j,bo as M,co as N,do as P,fo as F,go as I,ho as L,ic as R,io as z,lo as B,ls as V,mo as H,ol as U,oo as W,po as G,so as K,uo as q,vo as J,yl as Y,yo as X}from"./index-DRrjYYzZ.js";import{n as ee,t as te}from"./use-autosave-D6UkH_Ga.js";import{t as ne}from"./page-tabs-BaEQMYm_.js";import{F as re,a as ie,i as ae}from"./connectors-api-FBOe9SWC.js";var Z=n(),Q=e(t(),1),$=r(),oe=new Set([`profile`,`understanding`,`collaboration`,`sources`,`dreaming`,`privacy`]),se=`w-full rounded-xl border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/60 focus:ring-2 focus:ring-accent/20`,ce={en:{title:`About You`,subtitle:`What xopc knows, why it knows it, and how it should work with you.`,profile:`Profile`,understanding:`Understanding`,collaboration:`Working agreement`,sources:`Sources`,dreaming:`Background review`,privacy:`Privacy`,profileHint:`Facts you provide directly. These are available across conversations.`,done:`Done`,required:`This field cannot be empty.`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: product designer, founder, or engineer`,primaryGoal:`What are you mainly trying to achieve?`,primaryGoalPlaceholder:`The outcome you want xopc to optimize for`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,detect:`Use this device`,understoodHint:`Reviewable beliefs learned from your conversations and work. Inferences stay pending until confirmed.`,addUnderstanding:`Add understanding`,statement:`What should xopc understand?`,kind:`Type`,add:`Add`,cancel:`Cancel`,active:`Active`,review:`Needs review`,confirm:`Confirm`,reject:`Wrong`,edit:`Edit`,delete:`Delete`,confirmDelete:`Delete now`,rulesHint:`Explicit instructions for how xopc should collaborate with you. Rules outrank inferred understanding.`,addRule:`Add rule`,ruleStatement:`How should xopc work with you?`,category:`Category`,disable:`Disable`,enable:`Enable`,emptyUnderstanding:`Nothing here yet. Tell xopc something explicitly, or confirm a suggestion after it learns one.`,qualityTitle:`Learning quality`,qualityActive:`Confirmed`,qualityPending:`Pending review`,qualityAcceptance:`30-day acceptance`,qualityRecall:`Helpful recall`,qualityNoData:`Not enough feedback yet`,emptyRules:`No working agreements yet.`,sourceExplicit:`You said this directly`,sourceInferred:`Inferred — may be wrong`,sourceObserved:`Observed across prior work`,sourcesHint:`Review every granted source, its access mode, retention, and last collection. Revoking stops future learning.`,manageSources:`Connect another source`,authorizedSources:`Authorized sources`,connectorsTitle:`Connectors`,openConnector:`Open connector`,noSources:`No sources are authorized.`,noConnectors:`No connectors are installed.`,connected:`Connected`,unavailable:`Needs attention`,revoke:`Revoke source`,revokeHint:`Revoke this source and remove its derived understanding`,confirmRevoke:`Confirm revoke`,revoking:`Revoking…`,revokeDone:`Source revoked and derived understanding removed.`,refresh:`Update`,refreshing:`Updating…`,refreshStarted:`Update started.`,actionFailed:`Action failed`,once:`One-time`,continuous:`Continuous`,localOnly:`Local only`,derivedOnly:`Derived understanding only`,focuses:`Current focuses`,focusHint:`Candidate focuses never activate until you confirm them.`,activate:`Activate`,pause:`Pause`,complete:`Complete`,noFocuses:`No focus candidates yet.`,focusCandidate:`Suggested`,focusActive:`Active`,focusPaused:`Paused`,focusCompleted:`Completed`,confidence:`Confidence`,confidenceHigh:`High`,confidenceMedium:`Medium`,confidenceLow:`Low`,dreamingHint:`A deterministic daily review checks expiry, contradictory evidence, and corroborated candidates. It never auto-activates an inference.`,mode:`Background review`,on:`On — propose for review`,off:`Off`,reviewTime:`Daily review time`,evidenceThreshold:`Supporting evidence required`,scanLimit:`Maximum items per run`,lastRun:`Last review`,neverRun:`Not run yet`,runCompleted:`Completed`,runFailed:`Failed`,runRunning:`Running`,runItems:`items`,privacyHint:`Choose how generic memory providers handle sensitive content. Structured user understanding applies stricter rules of its own.`,sensitivePolicy:`Sensitive memory writes`,policyDeny:`Do not store`,policyConfirm:`Ask before storing`,policyAllow:`Store when relevant`,privacyWarning:`Secret and regulated content is never stored as structured user understanding, regardless of this setting.`,error:`Could not load your context.`,retry:`Try again`},zh:{title:`关于你`,subtitle:`清楚查看 xopc 知道什么、为什么知道,以及应该如何与你协作。`,profile:`个人资料`,understanding:`对你的理解`,collaboration:`协作约定`,sources:`数据来源`,dreaming:`后台复核`,privacy:`隐私`,profileHint:`由你直接提供的事实,会在不同对话中使用。`,done:`完成`,required:`此项不能为空。`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:产品设计师、创业者、工程师`,primaryGoal:`你目前最想达成什么?`,primaryGoalPlaceholder:`希望 xopc 优先帮助你实现的结果`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,detect:`使用本机时区`,understoodHint:`从对话和工作中形成、可复核的理解。推断内容在你确认前保持待审核。`,addUnderstanding:`添加理解`,statement:`希望 xopc 了解什么?`,kind:`类型`,add:`添加`,cancel:`取消`,active:`使用中`,review:`待审核`,confirm:`确认`,reject:`不正确`,edit:`编辑`,delete:`删除`,confirmDelete:`确认删除`,rulesHint:`你明确设定的协作方式。协作约定的优先级高于推断出的理解。`,addRule:`添加约定`,ruleStatement:`希望 xopc 如何与你协作?`,category:`类别`,disable:`停用`,enable:`启用`,emptyUnderstanding:`还没有内容。你可以直接告诉 xopc,或在它学到建议后进行确认。`,emptyRules:`还没有协作约定。`,qualityTitle:`学习质量`,qualityActive:`已确认`,qualityPending:`待审核`,qualityAcceptance:`30 天采纳率`,qualityRecall:`有效召回`,qualityNoData:`反馈数据还不足`,sourceExplicit:`由你直接告知`,sourceInferred:`推断内容,可能有误`,sourceObserved:`从过往工作中观察到`,sourcesHint:`查看每项授权的访问方式、保留策略和最近采集时间;撤销后将停止后续学习。`,manageSources:`连接其他来源`,authorizedSources:`已授权数据来源`,connectorsTitle:`连接器`,openConnector:`打开连接器`,noSources:`尚未授权任何来源。`,noConnectors:`尚未安装连接器。`,connected:`已连接`,unavailable:`需要处理`,revoke:`撤销来源`,revokeHint:`撤销此来源并删除由它产生的理解`,confirmRevoke:`确认撤销`,revoking:`正在撤销…`,revokeDone:`已撤销来源并删除派生理解。`,refresh:`更新`,refreshing:`正在更新…`,refreshStarted:`更新任务已开始。`,actionFailed:`操作失败`,once:`仅一次`,continuous:`持续更新`,localOnly:`仅本地处理`,derivedOnly:`仅保留派生理解`,focuses:`当前关注`,focusHint:`候选关注不会自动生效,只有你确认后才会启用。`,activate:`启用`,pause:`暂停`,complete:`完成`,noFocuses:`还没有候选关注。`,focusCandidate:`待确认`,focusActive:`进行中`,focusPaused:`已暂停`,focusCompleted:`已完成`,confidence:`置信度`,confidenceHigh:`高`,confidenceMedium:`中`,confidenceLow:`低`,dreamingHint:`每天进行一次确定性复核,检查过期、矛盾证据和得到佐证的候选理解;推断内容不会自动生效。`,mode:`后台复核`,on:`开启并生成待审核项`,off:`关闭`,reviewTime:`每日复核时间`,evidenceThreshold:`所需支持证据数`,scanLimit:`每次最多检查`,lastRun:`最近一次复核`,neverRun:`尚未运行`,runCompleted:`已完成`,runFailed:`失败`,runRunning:`运行中`,runItems:`项`,privacyHint:`选择通用记忆服务如何处理敏感内容;结构化用户理解有独立且更严格的规则。`,sensitivePolicy:`敏感记忆写入`,policyDeny:`不保存`,policyConfirm:`保存前询问`,policyAllow:`相关时允许保存`,privacyWarning:`无论这里如何设置,秘密和受监管内容都不会保存为结构化用户理解。`,error:`无法加载用户上下文。`,retry:`重试`}},le={preference:{en:`Preference`,zh:`偏好`},boundary:{en:`Boundary`,zh:`边界`},relationship:{en:`Relationship`,zh:`关系`},routine:{en:`Routine`,zh:`习惯`},current_state:{en:`Current state`,zh:`当前状态`},long_term_goal:{en:`Long-term goal`,zh:`长期目标`},project_context:{en:`Project context`,zh:`项目背景`},task_lesson:{en:`Task lesson`,zh:`任务经验`},derived_insight:{en:`Insight`,zh:`洞察`}},ue={communication:{en:`Communication`,zh:`沟通`},execution:{en:`Execution`,zh:`执行`},boundary:{en:`Boundary`,zh:`边界`},routine:{en:`Routine`,zh:`习惯`},proactive:{en:`Proactive help`,zh:`主动协助`}};function de(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:n}),t[0]=n,t[1]=r),r}function fe(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-10 text-center text-sm text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function pe(e){let t=(0,Z.c)(33),{open:n,onOpenChange:r,title:i,description:a,submitLabel:o,cancelLabel:s,submitDisabled:c,onSubmit:l,children:d}=e,y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(f,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=y):y=t[0];let b;t[1]===i?b=t[2]:(b=(0,$.jsx)(_,{className:`text-base font-semibold text-fg`,children:i}),t[1]=i,t[2]=b);let x;t[3]===a?x=t[4]:(x=(0,$.jsx)(p,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a}),t[3]=a,t[4]=x);let S;t[5]!==b||t[6]!==x?(S=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[b,x]}),t[5]=b,t[6]=x,t[7]=S):S=t[7];let C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(k,{className:`size-4`}),t[8]=C):C=t[8];let w;t[9]===s?w=t[10]:(w=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(u,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":s,children:C})}),t[9]=s,t[10]=w);let T;t[11]!==S||t[12]!==w?(T=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[S,w]}),t[11]=S,t[12]=w,t[13]=T):T=t[13];let E;t[14]===d?E=t[15]:(E=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:d}),t[14]=d,t[15]=E);let D;t[16]===s?D=t[17]:(D=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(u,{type:`button`,children:s})}),t[16]=s,t[17]=D);let O;t[18]!==c||t[19]!==o?(O=(0,$.jsx)(u,{type:`submit`,variant:`primary`,disabled:c,children:o}),t[18]=c,t[19]=o,t[20]=O):O=t[20];let A;t[21]!==O||t[22]!==D?(A=(0,$.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[D,O]}),t[21]=O,t[22]=D,t[23]=A):A=t[23];let j;t[24]!==l||t[25]!==A||t[26]!==T||t[27]!==E?(j=(0,$.jsxs)(h,{children:[y,(0,$.jsx)(g,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(30rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:l,children:[T,E,A]})})]}),t[24]=l,t[25]=A,t[26]=T,t[27]=E,t[28]=j):j=t[28];let M;return t[29]!==r||t[30]!==n||t[31]!==j?(M=(0,$.jsx)(v,{open:n,onOpenChange:r,children:j}),t[29]=r,t[30]=n,t[31]=j,t[32]=M):M=t[32],M}function me(e){return JSON.stringify(e)}function he(e){let t=(0,Z.c)(10),[n,r]=(0,Q.useState)(e),i;t[0]===e?i=t[1]:(i=me(e),t[0]=e,t[1]=i);let a=(0,Q.useRef)(i),o;t[2]===e?o=t[3]:(o=me(e),t[2]=e,t[3]=o);let s=o,c,l;t[4]!==e||t[5]!==s?(c=()=>{if(s===a.current)return;let t=a.current;a.current=s,r(n=>me(n)===t?e:n)},l=[e,s],t[4]=e,t[5]=s,t[6]=c,t[7]=l):(c=t[6],l=t[7]),(0,Q.useEffect)(c,l);let u;return t[8]===n?u=t[9]:(u=[n,r],t[8]=n,t[9]=u),u}function ge(e){return{callName:e.callName,role:e.role,primaryGoal:e.primaryGoal,pronouns:e.pronouns,timezone:e.timezone,locale:e.locale}}function _e(){let e=(0,Z.c)(87),t=d(xe),n=ce[t],[r,a]=i(),o;if(e[0]!==r){let t=r.get(`tab`);o=t&&oe.has(t)?t:`profile`,e[0]=r,e[1]=o}else o=e[1];let s=o,c=E(be),l=E(ye),{data:u,error:f,isLoading:p,mutate:m}=y(`/api/you`,P),h;e[2]!==l||e[3]!==c||e[4]!==n.subtitle||e[5]!==n.title?(h=()=>(c({startExtra:null,main:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:n.subtitle})]}),end:null}),l),e[2]=l,e[3]=c,e[4]=n.subtitle,e[5]=n.title,e[6]=h):h=e[6];let g;if(e[7]!==l||e[8]!==c||e[9]!==n?(g=[l,c,n],e[7]=l,e[8]=c,e[9]=n,e[10]=g):g=e[10],(0,Q.useEffect)(h,g),p){let t;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-6`,children:[(0,$.jsx)(x,{className:`h-10 w-96 max-w-full`}),(0,$.jsx)(x,{className:`h-72 rounded-2xl`})]}),e[11]=t):t=e[11],t}if(f||!u){let t;e[12]===m?t=e[13]:(t=()=>void m(),e[12]=m,e[13]=t);let r;e[14]!==n.retry||e[15]!==t?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:t,children:n.retry}),e[14]=n.retry,e[15]=t,e[16]=r):r=e[16];let i;return e[17]!==n.error||e[18]!==r?(i=(0,$.jsx)(`div`,{className:`p-6`,children:(0,$.jsxs)(fe,{children:[n.error,` `,r]})}),e[17]=n.error,e[18]=r,e[19]=i):i=e[19],i}let _=n.title,v;e[20]===a?v=e[21]:(v=e=>a({tab:e}),e[20]=a,e[21]=v);let C;e[22]===n.profile?C=e[23]:(C={id:`profile`,label:n.profile,icon:Y},e[22]=n.profile,e[23]=C);let D;e[24]!==u.understandings.length||e[25]!==n.understanding?(D={id:`understanding`,label:n.understanding,icon:w,count:u.understandings.length},e[24]=u.understandings.length,e[25]=n.understanding,e[26]=D):D=e[26];let O=n.collaboration,k;e[27]===u.rules?k=e[28]:(k=u.rules.filter(ve),e[27]=u.rules,e[28]=k);let A;e[29]!==n.collaboration||e[30]!==k.length?(A={id:`collaboration`,label:O,icon:T,count:k.length},e[29]=n.collaboration,e[30]=k.length,e[31]=A):A=e[31];let j;e[32]===n.sources?j=e[33]:(j={id:`sources`,label:n.sources,icon:S},e[32]=n.sources,e[33]=j);let M;e[34]===n.dreaming?M=e[35]:(M={id:`dreaming`,label:n.dreaming,icon:R},e[34]=n.dreaming,e[35]=M);let N;e[36]===n.privacy?N=e[37]:(N={id:`privacy`,label:n.privacy,icon:b},e[36]=n.privacy,e[37]=N);let F;e[38]!==j||e[39]!==M||e[40]!==N||e[41]!==C||e[42]!==D||e[43]!==A?(F=[C,D,A,j,M,N],e[38]=j,e[39]=M,e[40]=N,e[41]=C,e[42]=D,e[43]=A,e[44]=F):F=e[44];let I;e[45]!==n.title||e[46]!==F||e[47]!==v||e[48]!==s?(I=(0,$.jsx)(ne,{ariaLabel:_,activeTab:s,onChange:v,items:F}),e[45]=n.title,e[46]=F,e[47]=v,e[48]=s,e[49]=I):I=e[49];let L;e[50]!==u.profile||e[51]!==t||e[52]!==m||e[53]!==n||e[54]!==s?(L=s===`profile`?(0,$.jsx)(Se,{profile:u.profile,language:t,t:n,onChanged:e=>m(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[50]=u.profile,e[51]=t,e[52]=m,e[53]=n,e[54]=s,e[55]=L):L=e[55];let z;e[56]!==u.quality||e[57]!==u.understandings||e[58]!==t||e[59]!==m||e[60]!==n||e[61]!==s?(z=s===`understanding`?(0,$.jsx)(we,{items:u.understandings,quality:u.quality,language:t,t:n,onChanged:e=>e?m(t=>t&&{...t,understandings:t.understandings.map(t=>t.id===e.id?e:t)},{revalidate:!0}):m()}):null,e[56]=u.quality,e[57]=u.understandings,e[58]=t,e[59]=m,e[60]=n,e[61]=s,e[62]=z):z=e[62];let B;e[63]!==u.rules||e[64]!==t||e[65]!==m||e[66]!==n||e[67]!==s?(B=s===`collaboration`?(0,$.jsx)(Me,{rules:u.rules,language:t,t:n,onChanged:()=>m()}):null,e[63]=u.rules,e[64]=t,e[65]=m,e[66]=n,e[67]=s,e[68]=B):B=e[68];let V;e[69]!==n||e[70]!==s?(V=s===`sources`?(0,$.jsx)(Fe,{t:n}):null,e[69]=n,e[70]=s,e[71]=V):V=e[71];let H;e[72]!==u.consolidation?.lastRun||e[73]!==n||e[74]!==s?(H=s===`dreaming`?(0,$.jsx)(Ie,{lastRun:u.consolidation?.lastRun??null,t:n}):null,e[72]=u.consolidation?.lastRun,e[73]=n,e[74]=s,e[75]=H):H=e[75];let U;e[76]!==n||e[77]!==s?(U=s===`privacy`?(0,$.jsx)(Re,{t:n}):null,e[76]=n,e[77]=s,e[78]=U):U=e[78];let W;return e[79]!==I||e[80]!==L||e[81]!==z||e[82]!==B||e[83]!==V||e[84]!==H||e[85]!==U?(W=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl space-y-5 p-4 sm:p-6`,children:[I,L,z,B,V,H,U]}),e[79]=I,e[80]=L,e[81]=z,e[82]=B,e[83]=V,e[84]=H,e[85]=U,e[86]=W):W=e[86],W}function ve(e){return e.status===`active`}function ye(e){return e.clearPageHeader}function be(e){return e.setPageHeader}function xe(e){return e.language}function Se(e){let t=(0,Z.c)(78),{profile:n,language:r,t:i,onChanged:a}=e,o;t[0]===n?o=t[1]:(o=ge(n),t[0]=n,t[1]=o);let s=o,[c,l]=he(s),d;t[2]===c?d=t[3]:(d=me(c),t[2]=c,t[3]=d);let f;t[4]===s?f=t[5]:(f=me(s),t[4]=s,t[5]=f);let p=d!==f,m;t[6]!==a||t[7]!==n?(m=async e=>{await a((await M({...e,accessibility:n.accessibility})).profile)},t[6]=a,t[7]=n,t[8]=m):m=t[8];let h;t[9]!==c||t[10]!==p||t[11]!==m?(h={value:c,dirty:p,delayMs:500,onSave:m},t[9]=c,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g=te(h),_;t[13]!==c||t[14]!==l?(_=(e,t,n)=>(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,$.jsx)(`input`,{className:se,placeholder:n,value:c[e],onChange:t=>l(n=>({...n,[e]:t.target.value}))})]}),t[13]=c,t[14]=l,t[15]=_):_=t[15];let v=_,y=g.onBlurCapture,b;t[16]===i.profileHint?b=t[17]:(b=(0,$.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-fg-muted`,children:i.profileHint}),t[16]=i.profileHint,t[17]=b);let x;t[18]!==v||t[19]!==i.callName||t[20]!==i.callNamePlaceholder?(x=v(`callName`,i.callName,i.callNamePlaceholder),t[18]=v,t[19]=i.callName,t[20]=i.callNamePlaceholder,t[21]=x):x=t[21];let S;t[22]!==v||t[23]!==i.role||t[24]!==i.rolePlaceholder?(S=v(`role`,i.role,i.rolePlaceholder),t[22]=v,t[23]=i.role,t[24]=i.rolePlaceholder,t[25]=S):S=t[25];let C;t[26]===i.primaryGoal?C=t[27]:(C=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.primaryGoal}),t[26]=i.primaryGoal,t[27]=C);let w;t[28]===l?w=t[29]:(w=e=>l(t=>({...t,primaryGoal:e.target.value})),t[28]=l,t[29]=w);let T;t[30]!==c.primaryGoal||t[31]!==i.primaryGoalPlaceholder||t[32]!==w?(T=(0,$.jsx)(`textarea`,{className:se,rows:3,placeholder:i.primaryGoalPlaceholder,value:c.primaryGoal,onChange:w}),t[30]=c.primaryGoal,t[31]=i.primaryGoalPlaceholder,t[32]=w,t[33]=T):T=t[33];let E;t[34]!==C||t[35]!==T?(E=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[C,T]}),t[34]=C,t[35]=T,t[36]=E):E=t[36];let D;t[37]!==v||t[38]!==r||t[39]!==i.pronouns||t[40]!==i.pronounsPlaceholder?(D=r===`en`?v(`pronouns`,i.pronouns,i.pronounsPlaceholder):null,t[37]=v,t[38]=r,t[39]=i.pronouns,t[40]=i.pronounsPlaceholder,t[41]=D):D=t[41];let O;t[42]===i.timezone?O=t[43]:(O=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[42]=i.timezone,t[43]=O);let k;t[44]===l?k=t[45]:(k=e=>l(t=>({...t,timezone:e.target.value})),t[44]=l,t[45]=k);let A;t[46]!==c.timezone||t[47]!==k?(A=(0,$.jsx)(`input`,{className:`${se} min-w-0 flex-1`,value:c.timezone,onChange:k}),t[46]=c.timezone,t[47]=k,t[48]=A):A=t[48];let j;t[49]===l?j=t[50]:(j=()=>l(Ce),t[49]=l,t[50]=j);let N;t[51]!==i.detect||t[52]!==j?(N=(0,$.jsx)(u,{className:`shrink-0 whitespace-nowrap`,onClick:j,children:i.detect}),t[51]=i.detect,t[52]=j,t[53]=N):N=t[53];let P;t[54]!==A||t[55]!==N?(P=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[A,N]}),t[54]=A,t[55]=N,t[56]=P):P=t[56];let F;t[57]!==O||t[58]!==P?(F=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[O,P]}),t[57]=O,t[58]=P,t[59]=F):F=t[59];let I;t[60]!==v||t[61]!==i.locale?(I=v(`locale`,i.locale),t[60]=v,t[61]=i.locale,t[62]=I):I=t[62];let L;t[63]!==x||t[64]!==S||t[65]!==E||t[66]!==D||t[67]!==F||t[68]!==I?(L=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[x,S,E,D,F,I]}),t[63]=x,t[64]=S,t[65]=E,t[66]=D,t[67]=F,t[68]=I,t[69]=L):L=t[69];let R;t[70]!==g.error||t[71]!==g.status?(R=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ee,{status:g.status,error:g.error})}),t[70]=g.error,t[71]=g.status,t[72]=R):R=t[72];let z;return t[73]!==g.onBlurCapture||t[74]!==L||t[75]!==R||t[76]!==b?(z=(0,$.jsx)(de,{children:(0,$.jsxs)(`div`,{onBlurCapture:y,children:[b,L,R]})}),t[73]=g.onBlurCapture,t[74]=L,t[75]=R,t[76]=b,t[77]=z):z=t[77],z}function Ce(e){return{...e,timezone:B()}}function we(e){let t=(0,Z.c)(78),{items:n,quality:r,language:i,t:a,onChanged:c}=e,[l,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(`preference`),g;t[0]===n?g=t[1]:(g=n.filter(Ee),t[0]=n,t[1]=g);let _=g,v;t[2]===n?v=t[3]:(v=n.filter(Te),t[2]=n,t[3]=v);let y=v,b;t[4]!==m||t[5]!==c||t[6]!==f?(b=async e=>{e.preventDefault(),f.trim()&&(await j({statement:f,kind:m}),p(``),d(!1),await c())},t[4]=m,t[5]=c,t[6]=f,t[7]=b):b=t[7];let x=b,S;t[8]===a.understoodHint?S=t[9]:(S=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:a.understoodHint}),t[8]=a.understoodHint,t[9]=S);let C,w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>d(!0),w=(0,$.jsx)(D,{className:`size-4`}),t[10]=C,t[11]=w):(C=t[10],w=t[11]);let T;t[12]===a.addUnderstanding?T=t[13]:(T=(0,$.jsxs)(u,{variant:`primary`,onClick:C,children:[w,a.addUnderstanding]}),t[12]=a.addUnderstanding,t[13]=T);let E;t[14]!==S||t[15]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[S,T]}),t[14]=S,t[15]=T,t[16]=E):E=t[16];let O=a.addUnderstanding,k=a.understoodHint,A=a.add,M=a.cancel,N;t[17]===f?N=t[18]:(N=f.trim(),t[17]=f,t[18]=N);let P=!N,F;t[19]===a.statement?F=t[20]:(F=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.statement}),t[19]=a.statement,t[20]=F);let I;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>p(e.target.value),t[21]=I):I=t[21];let L;t[22]!==f||t[23]!==a.statement?(L=(0,$.jsx)(`textarea`,{autoFocus:!0,className:se,rows:4,placeholder:a.statement,value:f,onChange:I}),t[22]=f,t[23]=a.statement,t[24]=L):L=t[24];let R;t[25]!==F||t[26]!==L?(R=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[F,L]}),t[25]=F,t[26]=L,t[27]=R):R=t[27];let z;t[28]===a.kind?z=t[29]:(z=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.kind}),t[28]=a.kind,t[29]=z);let B,V;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>h(e.target.value),V=Object.entries(le),t[30]=B,t[31]=V):(B=t[30],V=t[31]);let H;t[32]===i?H=t[33]:(H=V.map(e=>{let[t,n]=e;return(0,$.jsx)(s,{value:t,children:n[i]},t)}),t[32]=i,t[33]=H);let U;t[34]!==m||t[35]!==H?(U=(0,$.jsx)(o,{value:m,onChange:B,children:H}),t[34]=m,t[35]=H,t[36]=U):U=t[36];let W;t[37]!==z||t[38]!==U?(W=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[z,U]}),t[37]=z,t[38]=U,t[39]=W):W=t[39];let G;t[40]!==l||t[41]!==x||t[42]!==a.add||t[43]!==a.addUnderstanding||t[44]!==a.cancel||t[45]!==a.understoodHint||t[46]!==P||t[47]!==R||t[48]!==W?(G=(0,$.jsxs)(pe,{open:l,onOpenChange:d,title:O,description:k,submitLabel:A,cancelLabel:M,submitDisabled:P,onSubmit:x,children:[R,W]}),t[40]=l,t[41]=x,t[42]=a.add,t[43]=a.addUnderstanding,t[44]=a.cancel,t[45]=a.understoodHint,t[46]=P,t[47]=R,t[48]=W,t[49]=G):G=t[49];let K;t[50]!==r||t[51]!==a?(K=(0,$.jsx)(De,{quality:r,t:a}),t[50]=r,t[51]=a,t[52]=K):K=t[52];let q;t[53]===a?q=t[54]:(q=(0,$.jsx)(Ae,{t:a}),t[53]=a,t[54]=q);let J;t[55]!==i||t[56]!==c||t[57]!==y||t[58]!==a?(J=y.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.review,` · `,y.length]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:y.map(e=>(0,$.jsx)(ke,{item:e,language:i,t:a,onChanged:c},e.id))})]}):null,t[55]=i,t[56]=c,t[57]=y,t[58]=a,t[59]=J):J=t[59];let Y;t[60]!==_.length||t[61]!==a.active?(Y=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.active,` · `,_.length]}),t[60]=_.length,t[61]=a.active,t[62]=Y):Y=t[62];let X;t[63]!==_||t[64]!==i||t[65]!==c||t[66]!==a?(X=_.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:_.map(e=>(0,$.jsx)(ke,{item:e,language:i,t:a,onChanged:c},e.id))}):(0,$.jsx)(fe,{children:a.emptyUnderstanding}),t[63]=_,t[64]=i,t[65]=c,t[66]=a,t[67]=X):X=t[67];let ee;t[68]!==Y||t[69]!==X?(ee=(0,$.jsxs)(`section`,{className:`space-y-2`,children:[Y,X]}),t[68]=Y,t[69]=X,t[70]=ee):ee=t[70];let te;return t[71]!==G||t[72]!==K||t[73]!==q||t[74]!==J||t[75]!==ee||t[76]!==E?(te=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[E,G,K,q,J,ee]}),t[71]=G,t[72]=K,t[73]=q,t[74]=J,t[75]=ee,t[76]=E,t[77]=te):te=t[77],te}function Te(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function Ee(e){return e.status===`active`}function De(e){let t=(0,Z.c)(32),{quality:n,t:r}=e,i;t[0]===r.qualityNoData?i=t[1]:(i=e=>e==null?r.qualityNoData:`${Math.round(e*100)}%`,t[0]=r.qualityNoData,t[1]=i);let a=i,o=r.qualityActive,s=String(n.records.active),c;t[2]!==r.qualityActive||t[3]!==s?(c=[o,s],t[2]=r.qualityActive,t[3]=s,t[4]=c):c=t[4];let l=r.qualityPending,u=String(n.records.candidate+n.records.needsReview),d;t[5]!==r.qualityPending||t[6]!==u?(d=[l,u],t[5]=r.qualityPending,t[6]=u,t[7]=d):d=t[7];let f=r.qualityAcceptance,p;t[8]!==n.decisions.acceptanceRate||t[9]!==a?(p=a(n.decisions.acceptanceRate),t[8]=n.decisions.acceptanceRate,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==r.qualityAcceptance||t[12]!==p?(m=[f,p],t[11]=r.qualityAcceptance,t[12]=p,t[13]=m):m=t[13];let h=r.qualityRecall,g;t[14]!==n.recall.helpfulRate||t[15]!==a?(g=a(n.recall.helpfulRate),t[14]=n.recall.helpfulRate,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==r.qualityRecall||t[18]!==g?(_=[h,g],t[17]=r.qualityRecall,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==m||t[21]!==_||t[22]!==c||t[23]!==d?(v=[c,d,m,_],t[20]=m,t[21]=_,t[22]=c,t[23]=d,t[24]=v):v=t[24];let y=v,b;t[25]===r.qualityTitle?b=t[26]:(b=(0,$.jsx)(`h2`,{className:`text-xs font-medium text-fg-muted`,children:r.qualityTitle}),t[25]=r.qualityTitle,t[26]=b);let x;t[27]===y?x=t[28]:(x=y.map(Oe),t[27]=y,t[28]=x);let S;return t[29]!==b||t[30]!==x?(S=(0,$.jsxs)(`section`,{className:`flex flex-wrap items-center gap-x-5 gap-y-2 rounded-xl bg-surface-muted px-3 py-2.5`,children:[b,x]}),t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function Oe(e){let[t,n]=e;return(0,$.jsxs)(`div`,{className:`flex items-baseline gap-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-fg-subtle`,children:t}),(0,$.jsx)(`span`,{className:`font-semibold text-fg`,children:n})]},t)}function ke(e){let t=(0,Z.c)(60),{item:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[d,f]=he(n.statement),p=d!==n.statement,m;t[0]===i.required?m=t[1]:(m=e=>e.trim()?null:i.required,t[0]=i.required,t[1]=m);let h;t[2]!==n.id||t[3]!==a?(h=async e=>{await a((await A(n.id,{statement:e})).understanding)},t[2]=n.id,t[3]=a,t[4]=h):h=t[4];let g;t[5]!==d||t[6]!==o||t[7]!==p||t[8]!==m||t[9]!==h?(g={value:d,dirty:p,enabled:o,delayMs:500,validate:m,onSave:h},t[5]=d,t[6]=o,t[7]=p,t[8]=m,t[9]=h,t[10]=g):g=t[10];let _=te(g),v;t[11]!==d||t[12]!==o||t[13]!==f?(v=o?(0,$.jsx)(`textarea`,{autoFocus:!0,className:se,value:d,onChange:e=>f(e.target.value),rows:3}):(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:d}),t[11]=d,t[12]=o,t[13]=f,t[14]=v):v=t[14];let y=le[n.kind][r],b;t[15]===y?b=t[16]:(b=(0,$.jsx)(`span`,{children:y}),t[15]=y,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`span`,{children:`·`}),t[17]=x):x=t[17];let S=n.explicitness===`explicit`?i.sourceExplicit:n.explicitness===`observed`?i.sourceObserved:i.sourceInferred,C;t[18]===S?C=t[19]:(C=(0,$.jsx)(`span`,{children:S}),t[18]=S,t[19]=C);let w;t[20]!==C||t[21]!==b?(w=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[b,x,C]}),t[20]=C,t[21]=b,t[22]=w):w=t[22];let T;t[23]!==w||t[24]!==v?(T=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,w]}),t[23]=w,t[24]=v,t[25]=T):T=t[25];let E;t[26]!==_||t[27]!==o||t[28]!==i.done||t[29]!==i.edit?(E=o?(0,$.jsx)(u,{variant:`ghost`,onClick:()=>{_.flush(),s(!1)},children:i.done}):(0,$.jsxs)(u,{variant:`ghost`,onClick:()=>s(!0),children:[(0,$.jsx)(O,{className:`size-3.5`}),i.edit]}),t[26]=_,t[27]=o,t[28]=i.done,t[29]=i.edit,t[30]=E):E=t[30];let D;t[31]!==n.id||t[32]!==n.status||t[33]!==a||t[34]!==i.confirm||t[35]!==i.reject?(D=n.status===`active`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(u,{variant:`primary`,onClick:async()=>{await a((await A(n.id,{status:`active`})).understanding)},children:i.confirm}),(0,$.jsx)(u,{onClick:async()=>{await a((await A(n.id,{status:`rejected`})).understanding)},children:i.reject})]}),t[31]=n.id,t[32]=n.status,t[33]=a,t[34]=i.confirm,t[35]=i.reject,t[36]=D):D=t[36];let k;t[37]!==c||t[38]!==n.id||t[39]!==a?(k=async()=>{if(!c){l(!0);return}await K(n.id),l(!1),await a()},t[37]=c,t[38]=n.id,t[39]=a,t[40]=k):k=t[40];let j;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(V,{className:`size-3.5`}),t[41]=j):j=t[41];let M=c?i.confirmDelete:i.delete,N;t[42]!==k||t[43]!==M?(N=(0,$.jsxs)(u,{variant:`ghost`,className:`text-danger`,onClick:k,children:[j,M]}),t[42]=k,t[43]=M,t[44]=N):N=t[44];let P;t[45]!==E||t[46]!==D||t[47]!==N?(P=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[E,D,N]}),t[45]=E,t[46]=D,t[47]=N,t[48]=P):P=t[48];let F;t[49]!==T||t[50]!==P?(F=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:gap-4`,children:[T,P]}),t[49]=T,t[50]=P,t[51]=F):F=t[51];let I;t[52]!==_.error||t[53]!==_.status||t[54]!==o?(I=o||_.status!==`idle`?(0,$.jsx)(ee,{className:`mt-2`,status:_.status,error:_.error}):null,t[52]=_.error,t[53]=_.status,t[54]=o,t[55]=I):I=t[55];let L;return t[56]!==_.onBlurCapture||t[57]!==F||t[58]!==I?(L=(0,$.jsx)(`article`,{className:`px-4 py-3 sm:px-5`,children:(0,$.jsxs)(`div`,{onBlurCapture:_.onBlurCapture,children:[F,I]})}),t[56]=_.onBlurCapture,t[57]=F,t[58]=I,t[59]=L):L=t[59],L}function Ae(e){let t=(0,Z.c)(35),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=y(`you-focuses`,G),[s,c]=(0,Q.useState)(null);if(a){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(x,{className:`h-40 rounded-2xl`}),t[0]=e):e=t[0],e}if(i){let e;return t[1]===n.error?e=t[2]:(e=(0,$.jsx)(fe,{children:n.error}),t[1]=n.error,t[2]=e),e}let l;if(t[3]!==r||t[4]!==s||t[5]!==o||t[6]!==n.activate||t[7]!==n.complete||t[8]!==n.confidence||t[9]!==n.confidenceHigh||t[10]!==n.confidenceLow||t[11]!==n.confidenceMedium||t[12]!==n.confirmDelete||t[13]!==n.delete||t[14]!==n.focusActive||t[15]!==n.focusCandidate||t[16]!==n.focusCompleted||t[17]!==n.focusHint||t[18]!==n.focusPaused||t[19]!==n.focuses||t[20]!==n.noFocuses||t[21]!==n.pause||t[22]!==n.reject){let e=(r??[]).filter(je),i;t[24]!==n.focusActive||t[25]!==n.focusCandidate||t[26]!==n.focusCompleted||t[27]!==n.focusPaused?(i=e=>e===`candidate`?n.focusCandidate:e===`active`?n.focusActive:e===`paused`?n.focusPaused:n.focusCompleted,t[24]=n.focusActive,t[25]=n.focusCandidate,t[26]=n.focusCompleted,t[27]=n.focusPaused,t[28]=i):i=t[28];let a=i,d;t[29]!==n.confidenceHigh||t[30]!==n.confidenceLow||t[31]!==n.confidenceMedium?(d=e=>e>=.85?n.confidenceHigh:e>=.65?n.confidenceMedium:n.confidenceLow,t[29]=n.confidenceHigh,t[30]=n.confidenceLow,t[31]=n.confidenceMedium,t[32]=d):d=t[32];let f=d,p;t[33]===n.focusHint?p=t[34]:(p=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.focusHint}),t[33]=n.focusHint,t[34]=p),l=(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[n.focuses,` · `,e.length]}),p]}),e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:a(e.status)}),(0,$.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[n.confidence,` · `,f(e.confidence)]})]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:e.summary})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1 sm:justify-end`,children:[e.status===`active`?(0,$.jsx)(u,{onClick:async()=>{await X(e.id,`paused`),await o()},children:n.pause}):(0,$.jsx)(u,{variant:`primary`,onClick:async()=>{await X(e.id,`active`),await o()},children:n.activate}),(0,$.jsx)(u,{variant:`ghost`,onClick:async()=>{await X(e.id,`completed`),await o()},children:n.complete}),e.status===`candidate`?(0,$.jsx)(u,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await X(e.id,`rejected`),await o()},children:n.reject}):null,(0,$.jsxs)(u,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(s!==e.id){c(e.id);return}await N(e.id),c(null),await o()},children:[(0,$.jsx)(V,{className:`size-3.5`}),s===e.id?n.confirmDelete:n.delete]})]})]},e.id))}):(0,$.jsx)(fe,{children:n.noFocuses})]}),t[3]=r,t[4]=s,t[5]=o,t[6]=n.activate,t[7]=n.complete,t[8]=n.confidence,t[9]=n.confidenceHigh,t[10]=n.confidenceLow,t[11]=n.confidenceMedium,t[12]=n.confirmDelete,t[13]=n.delete,t[14]=n.focusActive,t[15]=n.focusCandidate,t[16]=n.focusCompleted,t[17]=n.focusHint,t[18]=n.focusPaused,t[19]=n.focuses,t[20]=n.noFocuses,t[21]=n.pause,t[22]=n.reject,t[23]=l}else l=t[23];return l}function je(e){return e.status!==`rejected`}function Me(e){let t=(0,Z.c)(80),{rules:n,language:r,t:i,onChanged:a}=e,[c,l]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(`communication`),[h,g]=(0,Q.useState)(null),_,v,y,b,x,S;if(t[0]!==c||t[1]!==p||t[2]!==h||t[3]!==r||t[4]!==a||t[5]!==n||t[6]!==d||t[7]!==i.add||t[8]!==i.addRule||t[9]!==i.cancel||t[10]!==i.category||t[11]!==i.collaboration||t[12]!==i.confirmDelete||t[13]!==i.delete||t[14]!==i.disable||t[15]!==i.emptyRules||t[16]!==i.enable||t[17]!==i.ruleStatement||t[18]!==i.rulesHint){let e=n.filter(Ne),C;t[25]!==p||t[26]!==a||t[27]!==d?(C=async e=>{e.preventDefault(),d.trim()&&(await z({statement:d,category:p}),f(``),l(!1),await a())},t[25]=p,t[26]=a,t[27]=d,t[28]=C):C=t[28];let w=C;b=`space-y-5`;let T;t[29]===i.rulesHint?T=t[30]:(T=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[29]=i.rulesHint,t[30]=T);let E,O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>l(!0),E=(0,$.jsx)(D,{className:`size-4`}),t[31]=E,t[32]=O):(E=t[31],O=t[32]);let k;t[33]===i.addRule?k=t[34]:(k=(0,$.jsxs)(u,{variant:`primary`,onClick:O,children:[E,i.addRule]}),t[33]=i.addRule,t[34]=k),t[35]!==k||t[36]!==T?(x=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[T,k]}),t[35]=k,t[36]=T,t[37]=x):x=t[37];let A=i.addRule,j=i.rulesHint,M=i.add,N=i.cancel,P;t[38]===d?P=t[39]:(P=d.trim(),t[38]=d,t[39]=P);let F=!P,L;t[40]===i.ruleStatement?L=t[41]:(L=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.ruleStatement}),t[40]=i.ruleStatement,t[41]=L);let R;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>f(e.target.value),t[42]=R):R=t[42];let B;t[43]!==d||t[44]!==i.ruleStatement?(B=(0,$.jsx)(`textarea`,{autoFocus:!0,className:se,rows:4,placeholder:i.ruleStatement,value:d,onChange:R}),t[43]=d,t[44]=i.ruleStatement,t[45]=B):B=t[45];let H;t[46]!==L||t[47]!==B?(H=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[L,B]}),t[46]=L,t[47]=B,t[48]=H):H=t[48];let U;t[49]===i.category?U=t[50]:(U=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.category}),t[49]=i.category,t[50]=U);let G,K;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>m(e.target.value),K=Object.entries(ue),t[51]=G,t[52]=K):(G=t[51],K=t[52]);let q;t[53]===r?q=t[54]:(q=K.map(e=>{let[t,n]=e;return(0,$.jsx)(s,{value:t,children:n[r]},t)}),t[53]=r,t[54]=q);let J;t[55]!==p||t[56]!==q?(J=(0,$.jsx)(o,{value:p,onChange:G,children:q}),t[55]=p,t[56]=q,t[57]=J):J=t[57];let Y;t[58]!==U||t[59]!==J?(Y=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[U,J]}),t[58]=U,t[59]=J,t[60]=Y):Y=t[60],t[61]!==c||t[62]!==w||t[63]!==i.add||t[64]!==i.addRule||t[65]!==i.cancel||t[66]!==i.rulesHint||t[67]!==F||t[68]!==H||t[69]!==Y?(S=(0,$.jsxs)(pe,{open:c,onOpenChange:l,title:A,description:j,submitLabel:M,cancelLabel:N,submitDisabled:F,onSubmit:w,children:[H,Y]}),t[61]=c,t[62]=w,t[63]=i.add,t[64]=i.addRule,t[65]=i.cancel,t[66]=i.rulesHint,t[67]=F,t[68]=H,t[69]=Y,t[70]=S):S=t[70],_=`space-y-2`,v=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.collaboration,` · `,e.length]}),y=e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-2 px-4 py-3 sm:flex-row sm:items-start sm:gap-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 ${e.status===`disabled`?`text-fg-subtle line-through`:`text-fg`}`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:ue[e.category][r]}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[`P`,e.priority]}),e.status===`disabled`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:i.disable})]}):null]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[(0,$.jsx)(u,{variant:`ghost`,onClick:async()=>{await I(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,$.jsxs)(u,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(h!==e.id){g(e.id);return}await W(e.id),g(null),await a()},children:[(0,$.jsx)(V,{className:`size-3.5`}),h===e.id?i.confirmDelete:i.delete]})]})]},e.id))}):(0,$.jsx)(fe,{children:i.emptyRules}),t[0]=c,t[1]=p,t[2]=h,t[3]=r,t[4]=a,t[5]=n,t[6]=d,t[7]=i.add,t[8]=i.addRule,t[9]=i.cancel,t[10]=i.category,t[11]=i.collaboration,t[12]=i.confirmDelete,t[13]=i.delete,t[14]=i.disable,t[15]=i.emptyRules,t[16]=i.enable,t[17]=i.ruleStatement,t[18]=i.rulesHint,t[19]=_,t[20]=v,t[21]=y,t[22]=b,t[23]=x,t[24]=S}else _=t[19],v=t[20],y=t[21],b=t[22],x=t[23],S=t[24];let C;t[71]!==_||t[72]!==v||t[73]!==y?(C=(0,$.jsxs)(`section`,{className:_,children:[v,y]}),t[71]=_,t[72]=v,t[73]=y,t[74]=C):C=t[74];let w;return t[75]!==b||t[76]!==x||t[77]!==S||t[78]!==C?(w=(0,$.jsxs)(`div`,{className:b,children:[x,S,C]}),t[75]=b,t[76]=x,t[77]=S,t[78]=C,t[79]=w):w=t[79],w}function Ne(e){return e.status!==`archived`}async function Pe(){let[e,t,n]=await Promise.all([q(),ie(),ae()]);return{grants:e,connectors:t,catalog:n}}function Fe({t:e}){let{data:t,error:n,isLoading:r,mutate:i}=y(`you-understanding-sources`,Pe),[o,s]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null);if(r)return(0,$.jsx)(x,{className:`h-64 rounded-2xl`});if(n)return(0,$.jsxs)(fe,{children:[e.error,` `,(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:()=>void i(),children:e.retry})]});let h=t?.grants??[],g=t?.connectors??[],_=new Map((t?.catalog??[]).map(e=>[e.id,e])),v=e=>{let t=e.displayName.trim().toLocaleLowerCase(),n=g.find(e=>e.displayName.trim().toLocaleLowerCase()===t);return n?_.get(n.connectorId):[..._.values()].find(n=>n.displayName.trim().toLocaleLowerCase()===t||e.sourceKey.toLocaleLowerCase().includes(n.id.toLocaleLowerCase()))},b=t=>`${e.actionFailed}: ${t instanceof Error?t.message:String(t)}`,S=async t=>{m(null),f(null),s({grantId:t.id,kind:`refresh`});try{await H(t.id),await i().catch(()=>void 0),m({tone:`success`,message:`${t.displayName}: ${e.refreshStarted}`})}catch(e){m({tone:`error`,message:b(e)})}finally{s(null)}},w=async t=>{if(d!==t.id){f(t.id),m(null);return}s({grantId:t.id,kind:`revoke`});try{await L(t.id),await i().catch(()=>void 0),f(null),m({tone:`success`,message:`${t.displayName}: ${e.revokeDone}`})}catch(e){m({tone:`error`,message:b(e)})}finally{s(null)}};return(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:e.sourcesHint}),(0,$.jsx)(u,{asChild:!0,variant:`primary`,children:(0,$.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[e.manageSources,(0,$.jsx)(c,{className:`size-4`})]})})]}),p?(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`rounded-xl px-3 py-2 text-sm ${p.tone===`success`?`bg-success-soft text-success`:`bg-danger/10 text-danger`}`,children:p.message}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.authorizedSources,` · `,h.length]}),h.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:h.map(t=>{let n=v(t);return(0,$.jsxs)(`article`,{className:`flex min-h-28 items-start gap-3 rounded-2xl border border-edge bg-surface-panel p-4`,children:[n?(0,$.jsx)(re,{connector:n,size:`sm`}):(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base`,children:(0,$.jsx)(U,{className:`size-4 text-fg-muted`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:[t.accessMode===`continuous`?e.continuous:e.once,` · `,t.processingPolicy===`local_only`?e.localOnly:t.retentionPolicy===`derived_only`?e.derivedOnly:t.retentionPolicy]}),t.lastCollectedAt?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:new Date(t.lastCollectedAt).toLocaleString()}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:[t.accessMode===`continuous`?(0,$.jsx)(u,{variant:`ghost`,disabled:o!==null,"aria-busy":o?.grantId===t.id&&o.kind===`refresh`,onClick:()=>void S(t),children:o?.grantId===t.id&&o.kind===`refresh`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.refreshing]}):e.refresh}):null,(0,$.jsx)(u,{variant:`ghost`,className:`text-danger`,title:e.revokeHint,"aria-label":`${e.revoke}: ${t.displayName}`,disabled:o!==null,"aria-busy":o?.grantId===t.id&&o.kind===`revoke`,onClick:()=>void w(t),children:o?.grantId===t.id&&o.kind===`revoke`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.revoking]}):d===t.id?e.confirmRevoke:e.revoke})]})]},t.id)})}):(0,$.jsx)(fe,{children:e.noSources})]}),(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.connectorsTitle,` · `,g.length]}),g.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:g.map(t=>{let n=t.enabled&&(t.status===`connected`||t.connectionStatus===`connected`||t.authStatus===`connected`),r=_.get(t.connectorId);return(0,$.jsxs)(a,{to:`/connectors?tab=connected&instance=${encodeURIComponent(t.instanceId)}`,"aria-label":`${e.openConnector}: ${t.displayName}`,className:`group flex min-h-24 items-center gap-3 rounded-2xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,$.jsx)(re,{connector:r??{displayName:t.displayName}}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:t.connectorId})]}),(0,$.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-1 text-xs ${n?`bg-success-soft text-success`:`bg-warning-soft text-warning`}`,children:n?e.connected:e.unavailable}),(0,$.jsx)(C,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},t.instanceId)})}):(0,$.jsx)(fe,{children:e.noConnectors})]})]})}function Ie(e){let t=(0,Z.c)(112),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:c,mutate:l}=y(`you-context-settings`,F),d=i?.dreaming??null,[f,p]=he(d),m;t[0]!==f||t[1]!==d?(m=f&&d&&me(f)!==me(d),t[0]=f,t[1]=d,t[2]=m):m=t[2];let h=!!m,g;t[3]===l?g=t[4]:(g=async e=>{await J({dreaming:e}),await l()},t[3]=l,t[4]=g);let _;t[5]!==f||t[6]!==h||t[7]!==g?(_={value:f,dirty:h,delayMs:500,onSave:g},t[5]=f,t[6]=h,t[7]=g,t[8]=_):_=t[8];let v=te(_);if(a){let e;t[9]===l?e=t[10]:(e=()=>void l(),t[9]=l,t[10]=e);let n;t[11]!==r.retry||t[12]!==e?(n=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:r.retry}),t[11]=r.retry,t[12]=e,t[13]=n):n=t[13];let i;return t[14]!==r.error||t[15]!==n?(i=(0,$.jsxs)(fe,{children:[r.error,` `,n]}),t[14]=r.error,t[15]=n,t[16]=i):i=t[16],i}if(c||!f){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(x,{className:`h-72 rounded-2xl`}),t[17]=e):e=t[17],e}let b=n?.status===`completed`?r.runCompleted:n?.status===`failed`?r.runFailed:r.runRunning,S;t[18]===r.dreamingHint?S=t[19]:(S=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:r.dreamingHint}),t[18]=r.dreamingHint,t[19]=S);let C=v.onBlurCapture,w;t[20]===r.mode?w=t[21]:(w=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.mode}),t[20]=r.mode,t[21]=w);let T;t[22]===p?T=t[23]:(T=e=>p(t=>t&&{...t,mode:e.target.value}),t[22]=p,t[23]=T);let E;t[24]===r.on?E=t[25]:(E=(0,$.jsx)(s,{value:`review`,children:r.on}),t[24]=r.on,t[25]=E);let D;t[26]===r.off?D=t[27]:(D=(0,$.jsx)(s,{value:`off`,children:r.off}),t[26]=r.off,t[27]=D);let O;t[28]!==f.mode||t[29]!==D||t[30]!==T||t[31]!==E?(O=(0,$.jsxs)(o,{value:f.mode,onChange:T,children:[E,D]}),t[28]=f.mode,t[29]=D,t[30]=T,t[31]=E,t[32]=O):O=t[32];let k;t[33]!==O||t[34]!==w?(k=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[w,O]}),t[33]=O,t[34]=w,t[35]=k):k=t[35];let A;t[36]===r.reviewTime?A=t[37]:(A=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=A);let j;t[38]===p?j=t[39]:(j=e=>p(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=p,t[39]=j);let M;t[40]!==f.schedule.time||t[41]!==j?(M=(0,$.jsx)(`input`,{type:`time`,className:se,value:f.schedule.time,onChange:j}),t[40]=f.schedule.time,t[41]=j,t[42]=M):M=t[42];let N;t[43]!==A||t[44]!==M?(N=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[A,M]}),t[43]=A,t[44]=M,t[45]=N):N=t[45];let P;t[46]===r.timezone?P=t[47]:(P=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=P);let I=f.timezone??``,L;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(L=B(),t[48]=L):L=t[48];let R;t[49]===p?R=t[50]:(R=e=>p(t=>t&&{...t,timezone:e.target.value||void 0}),t[49]=p,t[50]=R);let z;t[51]!==I||t[52]!==R?(z=(0,$.jsx)(`input`,{className:`${se} min-w-0 flex-1`,value:I,placeholder:L,onChange:R}),t[51]=I,t[52]=R,t[53]=z):z=t[53];let V;t[54]===p?V=t[55]:(V=()=>p(Le),t[54]=p,t[55]=V);let H;t[56]!==r.detect||t[57]!==V?(H=(0,$.jsx)(u,{className:`shrink-0 whitespace-nowrap`,onClick:V,children:r.detect}),t[56]=r.detect,t[57]=V,t[58]=H):H=t[58];let U;t[59]!==z||t[60]!==H?(U=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[z,H]}),t[59]=z,t[60]=H,t[61]=U):U=t[61];let W;t[62]!==P||t[63]!==U?(W=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[P,U]}),t[62]=P,t[63]=U,t[64]=W):W=t[64];let G;t[65]===r.evidenceThreshold?G=t[66]:(G=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.evidenceThreshold}),t[65]=r.evidenceThreshold,t[66]=G);let K;t[67]===p?K=t[68]:(K=e=>p(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[67]=p,t[68]=K);let q;t[69]!==f.minEvidenceSources||t[70]!==K?(q=(0,$.jsx)(`input`,{type:`number`,min:2,max:10,className:se,value:f.minEvidenceSources,onChange:K}),t[69]=f.minEvidenceSources,t[70]=K,t[71]=q):q=t[71];let Y;t[72]!==G||t[73]!==q?(Y=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[G,q]}),t[72]=G,t[73]=q,t[74]=Y):Y=t[74];let X;t[75]===r.scanLimit?X=t[76]:(X=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.scanLimit}),t[75]=r.scanLimit,t[76]=X);let ne;t[77]===p?ne=t[78]:(ne=e=>p(t=>t&&{...t,limit:Number(e.target.value)}),t[77]=p,t[78]=ne);let re;t[79]!==f.limit||t[80]!==ne?(re=(0,$.jsx)(`input`,{type:`number`,min:1,max:2e3,className:se,value:f.limit,onChange:ne}),t[79]=f.limit,t[80]=ne,t[81]=re):re=t[81];let ie;t[82]!==X||t[83]!==re?(ie=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[X,re]}),t[82]=X,t[83]=re,t[84]=ie):ie=t[84];let ae;t[85]!==k||t[86]!==N||t[87]!==W||t[88]!==Y||t[89]!==ie?(ae=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[k,N,W,Y,ie]}),t[85]=k,t[86]=N,t[87]=W,t[88]=Y,t[89]=ie,t[90]=ae):ae=t[90];let Q;t[91]!==v.error||t[92]!==v.status?(Q=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ee,{status:v.status,error:v.error})}),t[91]=v.error,t[92]=v.status,t[93]=Q):Q=t[93];let oe;t[94]!==v.onBlurCapture||t[95]!==ae||t[96]!==Q?(oe=(0,$.jsx)(de,{children:(0,$.jsxs)(`div`,{onBlurCapture:C,children:[ae,Q]})}),t[94]=v.onBlurCapture,t[95]=ae,t[96]=Q,t[97]=oe):oe=t[97];let ce;t[98]===r.lastRun?ce=t[99]:(ce=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[98]=r.lastRun,t[99]=ce);let le;t[100]!==n||t[101]!==b||t[102]!==r.neverRun||t[103]!==r.runItems?(le=n?(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{children:b}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`time`,{children:new Date(n.startedAt).toLocaleString()}),typeof n.metrics.scanned==`number`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[String(n.metrics.scanned),` `,r.runItems]})]}):null]}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.neverRun}),t[100]=n,t[101]=b,t[102]=r.neverRun,t[103]=r.runItems,t[104]=le):le=t[104];let ue;t[105]!==ce||t[106]!==le?(ue=(0,$.jsxs)(de,{children:[ce,le]}),t[105]=ce,t[106]=le,t[107]=ue):ue=t[107];let pe;return t[108]!==oe||t[109]!==ue||t[110]!==S?(pe=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[S,oe,ue]}),t[108]=oe,t[109]=ue,t[110]=S,t[111]=pe):pe=t[111],pe}function Le(e){return e&&{...e,timezone:B()}}function Re(e){let t=(0,Z.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:c}=y(`you-context-settings`,F),l=r?.privacy.sensitiveWritePolicy??null,[u,d]=he(l),f=!!(u&&l&&u!==l),p;t[0]===c?p=t[1]:(p=async e=>{await J({privacy:{sensitiveWritePolicy:e}}),await c()},t[0]=c,t[1]=p);let m;t[2]!==u||t[3]!==f||t[4]!==p?(m={value:u,dirty:f,delayMs:350,onSave:p},t[2]=u,t[3]=f,t[4]=p,t[5]=m):m=t[5];let h=te(m);if(i){let e;t[6]===c?e=t[7]:(e=()=>void c(),t[6]=c,t[7]=e);let r;t[8]!==n.retry||t[9]!==e?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[8]=n.retry,t[9]=e,t[10]=r):r=t[10];let i;return t[11]!==n.error||t[12]!==r?(i=(0,$.jsxs)(fe,{children:[n.error,` `,r]}),t[11]=n.error,t[12]=r,t[13]=i):i=t[13],i}if(a||!u){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(x,{className:`h-56 rounded-2xl`}),t[14]=e):e=t[14],e}let g;t[15]===n.privacyHint?g=t[16]:(g=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=g);let _;t[17]===n.sensitivePolicy?_=t[18]:(_=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=_);let v;t[19]===d?v=t[20]:(v=e=>d(e.target.value),t[19]=d,t[20]=v);let b;t[21]===n.policyDeny?b=t[22]:(b=(0,$.jsx)(s,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=b);let S;t[23]===n.policyConfirm?S=t[24]:(S=(0,$.jsx)(s,{value:`confirm`,children:n.policyConfirm}),t[23]=n.policyConfirm,t[24]=S);let C;t[25]===n.policyAllow?C=t[26]:(C=(0,$.jsx)(s,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=C);let w;t[27]!==u||t[28]!==v||t[29]!==b||t[30]!==S||t[31]!==C?(w=(0,$.jsxs)(o,{value:u,onChange:v,children:[b,S,C]}),t[27]=u,t[28]=v,t[29]=b,t[30]=S,t[31]=C,t[32]=w):w=t[32];let T;t[33]!==w||t[34]!==_?(T=(0,$.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[_,w]}),t[33]=w,t[34]=_,t[35]=T):T=t[35];let E;t[36]===n.privacyWarning?E=t[37]:(E=(0,$.jsx)(`p`,{className:`mt-3 max-w-2xl text-xs leading-5 text-fg-subtle`,children:n.privacyWarning}),t[36]=n.privacyWarning,t[37]=E);let D;t[38]!==h.error||t[39]!==h.status?(D=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ee,{status:h.status,error:h.error})}),t[38]=h.error,t[39]=h.status,t[40]=D):D=t[40];let O;t[41]!==h.onBlurCapture||t[42]!==T||t[43]!==E||t[44]!==D?(O=(0,$.jsx)(de,{children:(0,$.jsxs)(`div`,{onBlurCapture:h.onBlurCapture,children:[T,E,D]})}),t[41]=h.onBlurCapture,t[42]=T,t[43]=E,t[44]=D,t[45]=O):O=t[45];let k;return t[46]!==O||t[47]!==g?(k=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[g,O]}),t[46]=O,t[47]=g,t[48]=k):k=t[48],k}export{_e as UserContextPage};
|
|
@@ -1 +0,0 @@
|
|
|
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"./button-CSEbl4zT.js";import{t as a}from"./messages-D7kOD_o_.js";import{n as o}from"./locale-store-CnamlR07.js";import{a as s,i as c,o as l,r as u,s as d,t as f}from"./dist-BPoKqzeH.js";import{Ga as p,Yo as m,qo as h}from"./index-DRrjYYzZ.js";import{WorkDiscoveryPage as g}from"./work-discovery-page-DUkdJl1e.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=o(C),w=p(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=a(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(s,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(h,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(d,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(c,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(i,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(g,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(l,{children:[z,(0,y.jsx)(u,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(f,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./check-DUBLcKHA.js";import{n as o,t as ee}from"./working-directory-picker-modal-BcyiDXU3.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as te}from"./cn-JdwAhgNB.js";import{t as c}from"./button-CSEbl4zT.js";import{t as l}from"./messages-D7kOD_o_.js";import{n as ne}from"./locale-store-CnamlR07.js";import{$a as re,Al as ie,Ds as u,Ga as d,Hc as ae,Ja as oe,Ka as se,Kc as f,Na as p,Ol as m,Qa as ce,Xa as h,Ya as le,Yo as g,Za as _,Zc as ue,eo as de,ml as fe,no as v,qa as pe,qo as me,ro as he,to as ge}from"./index-DRrjYYzZ.js";var y=e(t(),1),b=new Set([`completed`,`failed`,`canceled`]);function _e(){return new Promise(e=>window.setTimeout(e,1200))}async function ve(e,t){let n=[],r=t.wait??_e;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!b.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var x=new Set([`local-recent-files`,`chromium-bookmarks`,`apple-notes`,`apple-calendar`,`apple-reminders`]);function ye(e){return new Set(e.filter(e=>e.availability===`available`&&x.has(e.id)).map(e=>e.id))}var S=n(),be=[`folder_structure`,`recent_progress`,`next_steps`];function C(e){return e instanceof Error?e.message:String(e)}function xe({embedded:e=!1,onRequestClose:t}={}){let n=ne(e=>e.language),b=l(n).onboarding.workDiscovery,_e=l(n).chat.workingDirectory,x=i(),[xe]=r(),Se=e||xe.get(`new`)===`1`,[w,T]=(0,y.useState)(`loading`),[E,D]=(0,y.useState)(null),[O,k]=(0,y.useState)(null),[A,j]=(0,y.useState)(!1),[M,N]=(0,y.useState)(null),[Ce,P]=(0,y.useState)(!1),[F,I]=(0,y.useState)(``),[L,R]=(0,y.useState)(!1),[we,z]=(0,y.useState)(()=>new Set),[B,Te]=(0,y.useState)([]),[V,Ee]=(0,y.useState)(()=>new Set),[De,H]=(0,y.useState)([]),[Oe,ke]=(0,y.useState)(!1),[U,W]=(0,y.useState)({current:0,total:0}),[Ae,je]=(0,y.useState)([]),[G,Me]=(0,y.useState)(()=>new Set),K=(0,y.useRef)(!1),Ne=e=>{Me(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,y.useEffect)(()=>{let e=!1;return window.electronAPI?.understandingSources?.catalog().then(t=>{e||(je(t),Me(ye(t)))}),()=>{e=!0}},[]);let q=(0,y.useCallback)(e=>{d.getState().updateDirectoryRun(e),k(e),e.status===`completed`?(z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),T(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?T(`error`):T(`running`)},[]),Pe=async()=>{j(!0),N(null);try{let e=await pe();if(!e.length){N(b.noCandidates);return}Te(e),Ee(new Set([e[0].rootPath])),T(`candidates`)}catch(e){N(C(e))}finally{j(!1)}},Fe=e=>{Ee(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ie=(0,y.useCallback)((e,t,n)=>{d.getState().updateDirectoryRun(e),k(e),W({current:t+1,total:n}),H(n=>{let r=[...n];return r[t]=e,r}),T(`running`)},[]),Le=(0,y.useCallback)(e=>{H(t=>t.map(t=>t?.id===e.id?e:t))},[]),Re=async()=>{let e=B.filter(e=>V.has(e.rootPath));if(!e.length)return;j(!0),N(null),H([]),W({current:1,total:e.length}),ke(!0),K.current=!1;let t=!1;try{let n=await ve(e,{grantDirectory:_,startRun:ge,fetchRun:h,shouldStop:()=>K.current,onRun:(e,n,r)=>{Ie(e,n,r),t||(t=!0,d.getState().collectSources(e.id,[...G]))},onError:(t,n,r)=>{W({current:r+1,total:e.length}),N(b.folderAnalysisFailed.replace(`{{folder}}`,n.displayName).replace(`{{error}}`,C(t)))}});if(K.current)return;let r=n.find(e=>e.status===`completed`)??n.at(-1);r?q(r):T(`candidates`)}catch(e){N(C(e)),T(`candidates`)}finally{ke(!1),j(!1)}},J=o({onPicked:(0,y.useCallback)(async e=>{j(!0),N(null);try{D(await ce(e)),T(`consent`)}catch(e){N(C(e)),T(`intro`)}finally{j(!1)}},[])});(0,y.useEffect)(()=>{let e=!1;return le().then(async({enabled:n,state:r})=>{if(!e){if(!n){t?t():x(`/chat`,{replace:!0});return}if(!Se&&r.activeRunId)try{let t=await h(r.activeRunId);e||q(t);return}catch{}e||T(`intro`)}}).catch(t=>{e||(N(C(t)),T(`intro`))}),()=>{e=!0}},[q,x,t,Se]),(0,y.useEffect)(()=>{if(!O||w!==`running`||Oe)return;let e=!1,t=async()=>{try{let t=await h(O.id);e||q(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===O.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[q,Oe,w,O]);let ze=async()=>{j(!0);try{await oe()}finally{t?t():x(`/chat`,{replace:!0})}},Be=async()=>{if(E){j(!0),N(null),H([]),W({current:0,total:0});try{await _(E.canonicalRootPath);let e=await ge(E.canonicalRootPath);q(e),d.getState().collectSources(e.id,[...G])}catch(e){N(C(e)),T(`consent`)}finally{j(!1)}}},Y=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;x(`/chat/${encodeURIComponent(e)}${n}`)},Ve=e=>{k(e),P(!1),R(!1),z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?T(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?T(`error`):T(`running`)},He=async()=>{O&&(K.current=!0,q(await se(O.id)))},X=async(e,t)=>{if(!O)return;await de(O.id,e.id).catch(()=>{});let r=t?`${n===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${e.actionPrompt}`:e.actionPrompt;Y(O.sessionKey,r)},Ue=async()=>{if(O){j(!0),N(null);try{let e=O.result?.profileCandidates??[],t=await v((e.length>0?await he(O.id,e.map(e=>({id:e.id,status:we.has(e.id)?`accepted`:`rejected`}))):O).id,`confirmed`);k(t),Le(t),T(`recommendation`)}catch(e){N(C(e))}finally{j(!1)}}},Z=async e=>{if(!(!O||!F.trim())){j(!0),N(null);try{let t=await v(O.id,e,F.trim());k(t),Y(t.sessionKey,F.trim())}catch(e){N(C(e)),j(!1)}}},We=async()=>{if(O){j(!0);try{Y((await v(O.id,`dismissed`)).sessionKey)}catch(e){N(C(e)),j(!1)}}},Q=O?.result?.suggestions.find(e=>e.id===O.result?.primarySuggestionId)??O?.result?.suggestions[0],Ge=O?.result?.suggestions.filter(e=>e.id!==Q?.id)??[],Ke=e=>e===`command`?b.riskCommand:e===`file_write`?b.riskFileWrite:b.riskAnalysis,qe=De.filter(e=>e?.status===`completed`),Je=e&&w===`candidates`,$=qe.length>1?(0,S.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,S.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:b.analysisResults}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:qe.map(e=>{let t=B.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,S.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===O?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>Ve(e),children:t},e.id)})})]}):null;return(0,S.jsxs)(`div`,{className:e?`flex h-full min-h-0 flex-1 flex-col overflow-hidden bg-surface-base`:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,S.jsxs)(`main`,{className:e?`mx-auto flex h-full min-h-0 w-full max-w-[40rem] flex-1 flex-col px-5 py-7 sm:px-8 sm:py-9 ${Je?`overflow-hidden`:`overflow-y-auto [scrollbar-gutter:stable]`}`:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[e?null:(0,S.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,S.jsx)(me,{className:`size-11`})}),w===`loading`?(0,S.jsxs)(`div`,{className:`mx-auto flex min-h-[26rem] w-full max-w-md flex-col items-center`,"aria-busy":!0,children:[(0,S.jsx)(p,{className:`h-8 w-64 max-w-full`}),(0,S.jsx)(p,{className:`mt-4 h-4 w-full max-w-sm`}),(0,S.jsx)(p,{className:`mt-2 h-4 w-4/5 max-w-xs`}),(0,S.jsx)(p,{className:`mt-10 h-12 w-full rounded-xl`}),(0,S.jsx)(p,{className:`mt-3 h-11 w-full rounded-xl`}),(0,S.jsx)(p,{className:`mt-5 h-4 w-3/5 max-w-56`})]}):null,w===`intro`?(0,S.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,S.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,S.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:b.title}),(0,S.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:b.subtitle})]}),(0,S.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[Ae.length?(0,S.jsxs)(`div`,{className:`mb-5 rounded-xl border border-edge bg-surface-panel p-3 text-left`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.localSourcesTitle}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:b.localSourcesSubtitle}),(0,S.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Ae.map(e=>{let t=G.has(e.id);return(0,S.jsxs)(`button`,{type:`button`,className:te(`flex min-h-16 flex-col items-center justify-center gap-1 rounded-lg border px-2 py-2 text-xs font-medium transition-colors`,t?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":t,onClick:()=>Ne(e.id),children:[(0,S.jsx)(`span`,{className:te(`flex size-4 items-center justify-center rounded-full border`,t?`border-accent bg-accent text-white`:`border-edge`),children:t?(0,S.jsx)(a,{className:`size-3`,"aria-hidden":!0}):null}),e.displayName]},e.id)})})]}):null,(0,S.jsxs)(c,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void Pe(),disabled:A||J.picking,children:[A?(0,S.jsx)(s,{className:`size-4 animate-spin`}):(0,S.jsx)(u,{className:`size-4`}),b.quickScan]}),(0,S.jsxs)(c,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:J.pick,disabled:A||J.picking,children:[J.picking?(0,S.jsx)(s,{className:`size-4 animate-spin`}):(0,S.jsx)(f,{className:`size-4`}),b.chooseFolderManually]}),(0,S.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,S.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,S.jsx)(`span`,{children:b.quickScanNote})]}),(0,S.jsx)(`button`,{type:`button`,className:`mt-4 text-sm font-medium text-accent-fg hover:underline`,onClick:()=>x(`/connectors?understanding=1&returnTo=%2Fonboarding%2Fworkspace`),children:b.connectCloudSource}),M?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:M}):null]}),(0,S.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void ze(),disabled:A,children:b.skip})]}):null,w===`candidates`?(0,S.jsxs)(`section`,{className:e?`flex h-full min-h-0 flex-col`:void 0,"aria-labelledby":`work-discovery-candidates-title`,children:[(0,S.jsxs)(`div`,{className:e?`shrink-0 text-center`:`text-center`,children:[(0,S.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:b.candidatesTitle}),(0,S.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:b.candidatesSubtitle})]}),(0,S.jsx)(`div`,{className:e?`mt-5 min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1 [scrollbar-gutter:stable]`:`mt-7 space-y-2`,children:B.map((e,t)=>{let n=V.has(e.rootPath);return(0,S.jsxs)(`button`,{type:`button`,"aria-pressed":n,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${n?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Fe(e.rootPath),children:[(0,S.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${n?`border-accent bg-accent text-white`:`border-edge bg-surface-base text-transparent`}`,children:(0,S.jsx)(a,{className:`size-3.5`})}),(0,S.jsx)(f,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),t===0?(0,S.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:b.recommendedCandidate}):null]}),(0,S.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,S.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,S.jsx)(`span`,{children:e.projectKind===`coding`?b.codingProject:e.projectKind===`general`?b.generalProject:b.unknownProject}),e.branch?(0,S.jsx)(`span`,{children:b.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,S.jsx)(`span`,{children:b.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,S.jsxs)(`div`,{className:e?`shrink-0 border-t border-edge-subtle pt-4`:void 0,children:[(0,S.jsxs)(`div`,{className:`${e?``:`mt-5 `}flex items-start gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,S.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,S.jsx)(`span`,{children:b.multiFolderPrivacyNote})]}),M?(0,S.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:M}):null,(0,S.jsxs)(`div`,{className:`${e?`mt-4`:`mt-7`} flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,S.jsxs)(c,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:A||V.size===0,onClick:()=>void Re(),children:[A?(0,S.jsx)(s,{className:`mr-2 size-4 animate-spin`}):null,b.analyzeSelected.replace(`{{count}}`,String(V.size))]}),(0,S.jsx)(c,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:A,onClick:J.pick,children:b.chooseFolderManually})]}),(0,S.jsx)(`button`,{type:`button`,className:`${e?`mt-3`:`mt-6`} mx-auto block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>T(`intro`),children:b.back})]})]}):null,w===`consent`&&E?(0,S.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:b.selectedTitle}),(0,S.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:b.selectedSubtitle})]}),(0,S.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,S.jsx)(f,{className:`size-5 shrink-0 text-accent-fg`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:E.displayName}),(0,S.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:E.canonicalRootPath})]}),(0,S.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:E.projectKind===`coding`?b.codingProject:E.projectKind===`general`?b.generalProject:b.unknownProject})]}),(0,S.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:b.localFingerprint}),(0,S.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:E.fingerprint.branch?b.branchValue.replace(`{{branch}}`,E.fingerprint.branch):b.noGitBranch})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:b.recentActivity}),(0,S.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:b.changedFiles.replace(`{{count}}`,String(E.fingerprint.changedFileCount))})]}),E.fingerprint.recentAreas.length>0?(0,S.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:b.recentAreas}),(0,S.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:E.fingerprint.recentAreas.map(e=>(0,S.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,S.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,S.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,S.jsx)(ue,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.willRead}),(0,S.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.willReadValue})]})]}),(0,S.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,S.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.willIgnore}),(0,S.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.willIgnoreValue})]})]}),(0,S.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,S.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,S.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:E.remoteModel?b.providerDisclosure.replace(`{{provider}}`,E.provider):b.localDisclosure})]})]})]}),M?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:M}):null,(0,S.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,S.jsxs)(c,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:A,onClick:()=>void Be(),children:[A?(0,S.jsx)(s,{className:`mr-2 size-4 animate-spin`}):null,b.startAnalysis]}),(0,S.jsx)(c,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:A,onClick:J.pick,children:b.changeFolder})]}),(0,S.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void ze(),children:b.skip})]}):null,w===`running`&&O?(0,S.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:b.analyzingTitle}),(0,S.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:b.analyzingSubtitle}),U.total>1?(0,S.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:b.analyzingFolderProgress.replace(`{{current}}`,String(U.current)).replace(`{{total}}`,String(U.total))}):null]}),(0,S.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:be.map((e,t)=>{let n=Math.max(0,be.indexOf(O.stage??`folder_structure`)),r=t<n,i=t===n;return(0,S.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,S.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${r?`bg-accent text-white`:i?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:r?(0,S.jsx)(a,{className:`size-4`}):i?(0,S.jsx)(s,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,S.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,S.jsx)(`span`,{className:i||r?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:b.stages[e]})]},e)})}),(0,S.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:O.rootPath}),(0,S.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,S.jsx)(c,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>x(`/chat`),children:b.continueInBackground}),(0,S.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void He(),children:b.cancelAnalysis})]})]}):null,w===`recognition`&&O?.result?(0,S.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:b.recognitionEyebrow}),(0,S.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:O.result.lowConfidence?b.lowConfidenceTitle:b.recognitionTitle})]}),$,(0,S.jsxs)(`div`,{className:`mt-7 rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/45 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,S.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:O.result.projectSummary}),(0,S.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:O.result.currentState}),!O.result.lowConfidence&&Q?.evidence.length?(0,S.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:Q.evidence.slice(0,3).map((e,t)=>(0,S.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,S.jsx)(ae,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,S.jsxs)(`span`,{children:[e.path?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${Q.id}-recognition-${t}`))}):null]}),O.result.workThreads?.length?(0,S.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.workThreadsTitle}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:b.workThreadsSubtitle}),(0,S.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:O.result.workThreads.map(e=>(0,S.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:e.horizon===`current`?b.workThreadCurrent:e.horizon===`ongoing`?b.workThreadOngoing:b.workThreadLongTerm}),(0,S.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,S.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,O.result.profileCandidates?.length?(0,S.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.profileCandidatesTitle}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:b.profileCandidatesSubtitle}),(0,S.jsx)(`div`,{className:`mt-3 space-y-2`,children:O.result.profileCandidates.map(e=>(0,S.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,S.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:we.has(e.id),onChange:()=>z(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,S.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,O.result.lowConfidence?(0,S.jsxs)(`div`,{className:`mt-5`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:O.result.contextQuestion}),(0,S.jsx)(`textarea`,{value:F,onChange:e=>I(e.target.value),placeholder:b.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,S.jsx)(c,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:A||!F.trim(),onClick:()=>void Z(`different_goal`),children:b.continueWithCorrection})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,S.jsxs)(c,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:A,onClick:()=>void Ue(),children:[A?(0,S.jsx)(s,{className:`size-4 animate-spin`}):(0,S.jsx)(a,{className:`size-4`}),b.confirmUnderstanding]}),(0,S.jsx)(c,{variant:`secondary`,className:`h-11 flex-1`,disabled:A,onClick:()=>P(e=>!e),children:b.notQuiteRight})]}),Ce?(0,S.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,S.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:b.correctionLabel}),(0,S.jsx)(`textarea`,{id:`work-discovery-correction`,value:F,onChange:e=>I(e.target.value),placeholder:b.correctionPlaceholder,className:`mt-2 min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,S.jsx)(c,{variant:`ghost`,disabled:A||!F.trim(),onClick:()=>void Z(`different_goal`),children:b.differentGoal}),(0,S.jsx)(c,{variant:`primary`,disabled:A||!F.trim(),onClick:()=>void Z(`corrected`),children:b.useCorrection})]})]}):null]}),M?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:M}):null,(0,S.jsx)(`button`,{type:`button`,disabled:A,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void We(),children:b.openConversation})]}):null,w===`recommendation`&&O?.result&&Q?(0,S.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:b.understandingConfirmed}),(0,S.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:b.primaryRecommendationTitle})]}),$,(0,S.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,S.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,S.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,S.jsx)(m,{className:`size-5`})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:Q.title}),(0,S.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Q.rationale}),(0,S.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:[(0,S.jsx)(fe,{className:`size-3.5`}),b.estimatedMinutes.replace(`{{count}}`,String(Q.estimatedMinutes))]}),(0,S.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ke(Q.risk)})]}),(0,S.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:b.expectedTask}),(0,S.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:Q.expectedTask})]}),(0,S.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,S.jsx)(c,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:b.startRecommendedAction}),(0,S.jsx)(c,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void X(Q,!0),children:b.explainFirst})]})]})]})}),Ge.length>0?(0,S.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>R(e=>!e),children:[b.otherDirections,(0,S.jsx)(ie,{className:`size-4 transition-transform ${L?`rotate-180`:``}`})]}),L?(0,S.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:Ge.map(e=>(0,S.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void X(e,!0),children:[(0,S.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,S.jsxs)(`span`,{children:[(0,S.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,S.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedTask})]})]},e.id))}):null]}):null,(0,S.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,S.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(O.sessionKey),children:b.doSomethingElse}),(0,S.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{P(!0),T(`recognition`)},children:b.correctUnderstanding})]})]}):null,w===`error`&&O?(0,S.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,S.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,S.jsx)(g,{className:`size-5`})}),(0,S.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:b.errorTitle}),(0,S.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:O.errorMessage}),(0,S.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,S.jsx)(c,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void re(O.id).then(q),children:b.retry}),(0,S.jsx)(c,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{k(null),D(null),T(`intro`)},children:b.chooseDifferent})]}),(0,S.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(O.sessionKey),children:b.openConversation})]}):null]}),J.hasNativePicker?null:(0,S.jsx)(ee,{open:J.modalOpen,onOpenChange:J.setModalOpen,initialAbsolutePath:E?.canonicalRootPath,onConfirm:J.confirmPick,wd:_e})]})}export{xe as WorkDiscoveryPage};
|