@xopcai/xopc 0.0.177 → 0.0.178
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-Wu2ikfbM.js → activity-store-BzGX__8I.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0_biISn.js → agent-avatar-dicebear-BzxntcaZ.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-TpIpJk59.js → agents-DC9F12Kw.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DljBt-N5.js → api-hi6f2Xtp.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CKoZRi7Y.js → app-management-settings-panel-fTY1F7ac.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DOdXhNDo.js → appearance-settings-BZ-IxQfB.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Cxbn5hy8.js → apps-page-5bKr05Fa.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-D18gyP76.js → archive-plugin-ZSLLG8wB.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CZh9fc8u.js → attachment-load-D4YktqIF.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-DKrVoiiK.js → automation-suggestion-card-B7mxFRtf.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DYv16QMU.js → automations-page-Dg6dmt5g.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DdSyGL6M.js → binary-plugins-BIkPxfxj.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BOpNApiX.js → block-editor-Q3v_YQom.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-DlcqaGu1.js → browser-settings-page-BHoo6Rpq.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-C0SnSj_R.js → browser-workflow-inputs-M5lTEW1I.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CzlzH7HA.js → browser-workflows-page-B3T1KYk4.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-QPX4wsGZ.js → capabilities-settings-panel-BlsqN8Fu.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-RM6S7ES5.js → capability-presets-api-DE09c0VB.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-DmCeusO8.js → capability-presets-settings-panel-DJeT8_B4.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-B4sha-30.js → channel-recipient-api-CFR5FBfS.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-HcKoP1wm.js → channels-settings-C4VVjYEm.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-vdf8kB16.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-BPsKIyoM.js → connector-logo-B1mD-3pM.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-DwbThFvd.js → connectors-page-DNcrDThX.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DjL1GWON.js → desktop-pet-B1urphOZ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-u_abAXh7.js → desktop-pet-settings-DTL6J3EP.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BoZGualI.js → directory-picker-path-field-BYQJ2XUS.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-s3gn3f9h.js → dreaming-settings-BXcb8fwx.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DIbMngCF.js → extension-debug-page-O1Xu1r4Q.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D94f2bWQ.js → extension-page-C2Jraq8l.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-B7TI13ex.js → extension-settings-page-DcXQDTpG.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-Do77rV8R.js → gateway-config-api-DmPIZrvg.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-Dt1PNJmb.js → gateway-settings-DmObBx9b.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-WaXTw3fi.js → gateway-startup-retry-BZEkOdPm.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-DEiOOLGU.js → goal-create-dialog-BRhmmBe9.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-C1Qj4o1K.js → goal-detail-page-C1k7_s_O.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-BL0fAEns.js → goals-config-api-Fwu1wjEP.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-qJDcEDzc.js → goals-page-hOu9uA3q.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-DV3ZlrdI.js → goals-settings-DY-JjvHz.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-C3kzg6ai.js → heartbeat-settings-BtKu2NWT.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-BgISY8i-.js → image-generation-api-05Gg8wsU.js} +1 -1
- package/dist/gateway/static/root/assets/{index-C1h0zkNo.js → index-C0CGebQ1.js} +7 -7
- package/dist/gateway/static/root/assets/index-eqq25gvV.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-0KSmaPu0.js → keyboard-shortcuts-settings-CfmDR9Sc.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DcD4mVId.js → local-app-workbench-page-EjsNT7nJ.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BMrU8u7w.js → local-apps-page-Df8BW1A_.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DVGhFXRz.js → locale-store-CTwSy7yW.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CW5m9Cov.js → logs-page-Dswjlraa.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BVqbtN9o.js → markdown-split-B3FvKbaP.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Dr_wtkNJ.js → media-plugins-DsjrvvB6.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DP6tPKk-.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-BWZRXsq6.js → notes-page-tuzIwy3c.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-DdnwNz9x.js → notes-workbench-DSh3-hMY.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-DWWgy0bF.js → page-tabs-ke9s4nYi.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Bnfs93ZP.js → preview-open-alternatives-Cp1eI4S9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BR7QFmT-.js → product-open-page-dXQCMAtH.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-B8GeS4dl.js → project-detail-page-D0QPRHR_.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DOeu1Hk_.js → projects-page-CI5Vz62F.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-De94rxnE.js → remote-access-hub-S1jpzBS5.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-BzS-rRTP.js → save-bar-controls-Bl30zjHc.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-Cl2IIDAN.js → schedule-field-DqhmXQKo.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BjKjp5eZ.js → schema-form-DkUCy6vf.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-A7p8G0OJ.js → sessions-page-CTm66k7h.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CU52AUVD.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BSDNBfHn.js → settings-form-section-C6ZbNpdy.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BD4peoAv.js → settings-loading-skeleton-Bk58_cr7.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-S-P3U7at.js → settings-page-k8iE_NdX.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BQTLh-86.js → settings-page-layout-DgFSya2e.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-W3p6kNyA.js → setup-status-panel-B_KDlyZA.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DQjMxyvw.js → share-preview-page-CV7nL_J9.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-Xo3N99PO.js → shares-settings-DK6XK95e.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Bvv_u4ii.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-C019Ml5q.js → skills-page-BGHvVbay.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-CXnpudm6.js → skills-page.utils-kahBIHg0.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BhFwdYJP.js → system-settings-panel-JV3-MG5F.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DQI-HPL-.js → theme-store-DFLyzoLO.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-C0DCya4U.js → time-picker-XwpxdZFr.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-C-M3Fv2N.js → typed-models-lib-60Aqo-UJ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-Bndq4y4I.js → use-channel-catalog-CnTkHDnw.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-fYBzpus-.js → user-context-page-DBCMk-Vn.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-p_g4UI1-.js → voice-api-key-field-CNa8qUgS.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-DI0gCZRw.js → work-discovery-page-C1UIdsCl.js} +1 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DEAQepB8.js +1 -0
- package/dist/gateway/static/root/assets/{work-page-Z-nUaS_n.js → work-page-D5qYmCTq.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CHEXVvhH.js → workflow-run-setup-panel-yV_x595t.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-BDfwnM-Y.js → workflows-page-yrK17ZZ5.js} +1 -1
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +3 -0
- package/dist/src/agent/embedded/run-for-session.js +18 -5
- package/dist/src/agent/embedded/run-turn.js +6 -3
- package/dist/src/agent/embedded/types.d.ts +2 -0
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/connectors/composio-sessions.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/routes/browser-install.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/providers/provider-auth-service.js +3 -0
- package/dist/src/providers/register-bundled-oauth-flows.d.ts +2 -0
- package/dist/src/providers/register-bundled-oauth-flows.js +16 -0
- package/dist/src/session/store.d.ts +2 -0
- package/dist/src/session/store.js +30 -0
- package/package.json +3 -11
- package/dist/gateway/static/root/assets/channels-status-swr-D3xr2enH.js +0 -1
- package/dist/gateway/static/root/assets/index-Da36E3WH.css +0 -1
- package/dist/gateway/static/root/assets/messages-r8L6Ur3A.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-BsGzjmqx.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-ByPEG5t1.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DnBRP2wI.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./circle-alert-BEjgurr2.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./copy-to-clipboard-HOJ79TWv.js";import{t as d}from"./messages-r8L6Ur3A.js";import{l as f,n as p,o as m,r as h,s as g}from"./locale-store-DVGhFXRz.js";import{$i as _,$s as v,A as y,Aa as b,Ac as x,Al as S,As as C,Ba as w,Bo as T,C as E,Cl as D,F as O,Fc as k,Ga as A,Gl as j,Go as M,Gr as N,Ha as P,Ho as F,Hs as I,Ia as L,Iu as R,Jl as z,Ka as B,Ks as V,La as H,Ll as U,M as ee,Ma as te,Mc as W,Ml as ne,Ms as re,Na as ie,Nl as ae,Ns as oe,Nu as se,Oi as ce,Ot as G,Pa as le,Pc as ue,Qi as de,Qn as fe,Ra as pe,Rc as me,Rl as he,Rr as ge,To as _e,Ua as ve,Uo as ye,Va as be,Vo as xe,Wa as Se,Wl as Ce,Wo as we,Xa as Te,Xc as Ee,Xs as De,Za as Oe,Zi as ke,Zl as Ae,_u as je,a as Me,aa as Ne,c as Pe,cl as Fe,d as Ie,ea as Le,eo as Re,f as ze,fc as Be,fs as Ve,gc as He,gs as Ue,gu as We,h as Ge,hs as Ke,hu as qe,i as Je,ia as Ye,is as Xe,ja as Ze,ka as Qe,m as $e,ml as et,ms as tt,na as nt,ns as rt,nu as it,o as at,oa as ot,oc as st,ps as ct,pu as lt,qa as ut,ra as dt,rc as ft,ro as pt,rr as mt,s as ht,sa as gt,ta as _t,tt as vt,u as yt,vt as bt,x as xt,xc as St,yc as Ct,za as wt,zc as Tt,zo as Et}from"./index-C1h0zkNo.js";import{t as Dt}from"./notes-workbench-DdnwNz9x.js";import{t as Ot}from"./page-tabs-DWWgy0bF.js";import{t as kt}from"./directory-picker-path-field-BoZGualI.js";import{t as At}from"./goals-config-api-BL0fAEns.js";import{n as jt,t as Mt}from"./goal-create-dialog-DEiOOLGU.js";import{f as Nt,o as Pt,r as Ft}from"./skills-page.utils-CXnpudm6.js";var K=e(t(),1),q=n();function It(e){return g(h(`/api/projects/${encodeURIComponent(e)}/skills`))}function Lt(e,t){return g(h(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Rt(e,t){let n=new FormData;return n.set(`file`,t),g(h(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function zt(e,t,n={}){return g(h(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Bt(e,t){return g(h(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Vt(e,t){return g(h(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var J=r();function Ht({projectId:e,copy:t}){let[n,r]=(0,K.useState)([]),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(!0),[c,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(``),[p,m]=(0,K.useState)(null),[h,g]=(0,K.useState)(null),[_,y]=(0,K.useState)(``),[b,w]=(0,K.useState)(1),[E,D]=(0,K.useState)(null),[O,k]=(0,K.useState)(!1),[A,j]=(0,K.useState)(``),[N,P]=(0,K.useState)(``),F=(0,K.useRef)(null),L=(0,K.useCallback)(async()=>{s(!0),f(``);try{let t=await It(e);r(t.items),a(t.skillsRoot)}catch(e){f(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e]);(0,K.useEffect)(()=>{L()},[L]),(0,K.useEffect)(()=>{if(p!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{k(!0),j(``),Nt({q:_,page:b,pageSize:8,sort:`downloads`,signal:e.signal}).then(D).catch(t=>{e.signal.aborted||j(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||k(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[p,b,_]);async function B(e){u(!0),f(``);try{await e(),m(null),P(``),await L()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}async function H(t){f(``);try{g((await Lt(e,t)).skill)}catch(e){f(e instanceof Error?e.message:String(e))}}async function U(n){if(window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){u(!0);try{await Vt(e,n.id),await L()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}}return(0,J.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,J.jsxs)(Ke,{children:[(0,J.jsx)(Ue,{asChild:!0,children:(0,J.jsxs)(C,{type:`button`,children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),t.add,(0,J.jsx)(je,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,J.jsx)(tt,{children:(0,J.jsxs)(ct,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,J.jsx)(Ut,{icon:v,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>m(`marketplace`)}),(0,J.jsx)(Ut,{icon:S,title:t.source,hint:t.sourceHint,onClick:()=>m(`source`)}),(0,J.jsx)(Ut,{icon:I,title:t.upload,hint:t.uploadHint,onClick:()=>F.current?.click()})]})})]}),(0,J.jsx)(`input`,{ref:F,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&B(()=>Rt(e,n)),t.target.value=``}})]}),i?(0,J.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs text-fg-subtle`,children:[t.path,`: `,i]}):null]}),d?(0,J.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:d}):null,o?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,J.jsx)(pt,{className:`h-36 rounded-lg`},e))}):n.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:n.map(e=>(0,J.jsxs)(`article`,{className:`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(R,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,J.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.id}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void H(e.id),children:[(0,J.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0}),t.view]}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:c,onClick:()=>void U(e),children:[(0,J.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}),t.remove]})]})]},e.id))}):(0,J.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),(0,J.jsx)(Et,{open:p!==null,onOpenChange:e=>{e||m(null)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-50 bg-black/45`}),(0,J.jsxs)(xe,{className:l(`fixed left-1/2 top-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,p===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:p===`marketplace`?t.marketplace:t.source}),(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,J.jsx)(oe,{className:`size-4`})})})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:p===`marketplace`?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,J.jsxs)(`div`,{className:`relative mt-3`,children:[(0,J.jsx)(He,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:_,onChange:e=>{y(e.target.value),w(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),A?(0,J.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:A}):null,O&&!E?(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,J.jsx)(pt,{className:`h-32 rounded-lg`},e))}):E?.items.length?(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:E.items.map(r=>{let i=r.providerId??E.provider,a=Ft(r,i),o=n.some(e=>e.id===r.id||e.id===a||e.name===r.name);return(0,J.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,J.jsx)(Pt,{name:r.name,className:`size-10`}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,J.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,J.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,J.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,J.jsx)(C,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:c||o,onClick:()=>void B(()=>zt(e,a,{provider:i})),children:o?t.marketplaceInstalled:c?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):O?null:(0,J.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),E&&E.meta.totalPages>1?(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(E.meta.page)).replace(`{{total}}`,String(E.meta.totalPages))}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:O||b<=1,onClick:()=>w(e=>Math.max(1,e-1)),children:[(0,J.jsx)(We,{className:`size-4`}),t.marketplacePrevious]}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:O||b>=E.meta.totalPages,onClick:()=>w(e=>e+1),children:[t.marketplaceNext,(0,J.jsx)(qe,{className:`size-4`})]})]})]}):null]}):(0,J.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,J.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:N,onChange:e=>P(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,J.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`secondary`,children:t.close})}),(0,J.jsx)(C,{type:`button`,disabled:c||!N.trim(),onClick:()=>void B(()=>Bt(e,N.trim())),children:c?t.installing:t.install})]})]})})]})]})}),(0,J.jsx)(Et,{open:!!h,onOpenChange:e=>{e||g(null)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-50 bg-black/45`}),(0,J.jsxs)(xe,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:h?.name}),(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,J.jsx)(oe,{className:`size-4`})})})]}),(0,J.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:h?.bodyMarkdown})]})]})})]})}function Ut(e){let t=(0,q.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,J.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,J.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,J.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,J.jsx)(Ve,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}var Wt=`application/x-xopc-work-item`,Gt=[`backlog`,`todo`,`in_progress`,`blocked`,`needs_input`,`in_review`,`done`],Kt=[`low`,`normal`,`high`,`urgent`];function qt(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function Jt(e){return e?bt(new Date(e)):``}function Yt(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function Xt(e){return`${e.name}:${e.size}:${e.lastModified}`}function Zt(e,t){return ke(e,t)!==`unsupported`}function Qt(e,t){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:t===`image`||t===`audio`||t===`video`?t:`document`}function $t(e,t){return{id:e.id,name:e.fileName,type:Qt(e.mimeType,e.type),mimeType:e.mimeType,size:e.size,...t?{content:t,preview:e.mimeType.startsWith(`image/`)?t:void 0}:{}}}async function en(e,t){let n=_(e.name||`upload`,e.type||`application/octet-stream`),r=Te(await e.arrayBuffer());return{id:t,name:e.name||`upload`,type:Qt(n),mimeType:n,size:e.size,content:r,preview:n.startsWith(`image/`)?r:void 0}}function tn(e){let t=(0,q.c)(3),[n,r]=(0,K.useState)(``),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(``);return}let t=URL.createObjectURL(e);return r(t),()=>URL.revokeObjectURL(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,K.useEffect)(i,a),n}function nn(e,t){let n=(0,q.c)(5),[r,i]=(0,K.useState)(``),a,o;return n[0]!==t.id||n[1]!==t.mimeType||n[2]!==e?(a=()=>{if(!e||!t.mimeType.startsWith(`image/`)){i(``);return}let n=!1,r=``;return(async()=>{let a=await m(Ge(e,t.id));if(!a.ok||n)return;let o=await a.blob();n||(r=URL.createObjectURL(o),i(r))})().catch(()=>{n||i(``)}),()=>{n=!0,r&&URL.revokeObjectURL(r)}},o=[t.id,t.mimeType,e],n[0]=t.id,n[1]=t.mimeType,n[2]=e,n[3]=a,n[4]=o):(a=n[3],o=n[4]),(0,K.useEffect)(a,o),r}function rn(e){let t=(0,q.c)(11),{name:n,mimeType:r,thumbnailUrl:i,previewable:a,disabled:o,onOpen:s}=e,c;t[0]===r?c=t[1]:(c=r.startsWith(`image/`),t[0]=r,t[1]=c);let l=c,u;t[2]!==l||t[3]!==n||t[4]!==i?(u=l&&i?(0,J.jsx)(`img`,{src:i,alt:n,className:`size-10 rounded-md object-cover`}):(0,J.jsx)(`span`,{className:`inline-flex size-10 items-center justify-center rounded-md border border-edge bg-surface-muted`,children:(0,J.jsx)(he,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),t[2]=l,t[3]=n,t[4]=i,t[5]=u):u=t[5];let d=u;if(!a)return d;let f;return t[6]!==d||t[7]!==o||t[8]!==n||t[9]!==s?(f=(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel disabled:cursor-wait disabled:opacity-70`,title:n,"aria-label":n,disabled:o,onClick:s,children:d}),t[6]=d,t[7]=o,t[8]=n,t[9]=s,t[10]=f):f=t[10],f}function Y(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:`#`}function an(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}function on(e,t){return e.nextAction||e.blockedReason||e.description||t.noNextAction}function sn(e){let t=(0,q.c)(63),{item:n,dragging:r,onOpen:i,onToggleDone:a,onDragStart:s,onDragEnd:c,t:u}=e,d=n.status===`done`,f;t[0]!==n||t[1]!==s?(f=e=>s(n,e),t[0]=n,t[1]=s,t[2]=f):f=t[2];let p=u.dragToUpdate,m=r&&`opacity-50`,h;t[3]===m?h=t[4]:(h=l(`flex min-h-24 w-full min-w-0 max-w-full cursor-grab flex-col overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors hover:bg-surface-hover active:cursor-grabbing`,m),t[3]=m,t[4]=h);let g=d?`border-success bg-success text-white`:`border-edge bg-surface-base hover:border-accent/50`,_;t[5]===g?_=t[6]:(_=l(`mt-0.5 inline-flex size-3.5 shrink-0 items-center justify-center rounded border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,g),t[5]=g,t[6]=_);let v=d?u.markTodo:u.markDone,y=d?u.markTodo:u.markDone,b;t[7]!==n||t[8]!==a?(b=()=>a(n),t[7]=n,t[8]=a,t[9]=b):b=t[9];let x;t[10]===d?x=t[11]:(x=d?(0,J.jsx)(lt,{className:`size-3`,"aria-hidden":!0}):null,t[10]=d,t[11]=x);let S;t[12]!==x||t[13]!==_||t[14]!==v||t[15]!==y||t[16]!==b?(S=(0,J.jsx)(`button`,{type:`button`,className:_,"aria-label":v,title:y,onClick:b,children:x}),t[12]=x,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=S):S=t[17];let C;t[18]!==n||t[19]!==i?(C=()=>i(n),t[18]=n,t[19]=i,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=(0,J.jsx)(`h4`,{className:`min-w-0 flex-1 basis-0 text-sm font-medium leading-5 text-fg line-clamp-2`,children:n.title}),t[21]=n.title,t[22]=w);let T;t[23]!==n||t[24]!==u?(T=on(n,u),t[23]=n,t[24]=u,t[25]=T):T=t[25];let E;t[26]===T?E=t[27]:(E=(0,J.jsx)(`p`,{className:`mt-2 max-w-full break-words text-xs leading-5 text-fg-muted line-clamp-1`,children:T}),t[26]=T,t[27]=E);let D;t[28]!==C||t[29]!==w||t[30]!==E?(D=(0,J.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:C,children:[w,E]}),t[28]=C,t[29]=w,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==S||t[33]!==D?(O=(0,J.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-start gap-2`,children:[S,D]}),t[32]=S,t[33]=D,t[34]=O):O=t[34];let k;t[35]===n.status?k=t[36]:(k=l(`rounded-full px-2 py-0.5 text-[11px] font-medium`,qt(n.status)),t[35]=n.status,t[36]=k);let A=u.statuses[n.status],j;t[37]!==k||t[38]!==A?(j=(0,J.jsx)(`span`,{className:k,children:A}),t[37]=k,t[38]=A,t[39]=j):j=t[39];let M=u.priorities[n.priority],N;t[40]===M?N=t[41]:(N=(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:M}),t[40]=M,t[41]=N);let P;t[42]===n.attachments?P=t[43]:(P=n.attachments?.length?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:[(0,J.jsx)(Tt,{className:`size-3`,"aria-hidden":!0}),n.attachments.length]}):null,t[42]=n.attachments,t[43]=P);let F;t[44]===n.links?F=t[45]:(F=n.links?.length?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:n.links.length}):null,t[44]=n.links,t[45]=F);let I=`/work-items/${encodeURIComponent(n.id)}`,L;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,J.jsx)(Ce,{className:`size-3`,"aria-hidden":!0}),t[46]=L):L=t[46];let R;t[47]!==u.detail.openItem||t[48]!==I?(R=(0,J.jsxs)(o,{to:I,className:`ml-auto inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium text-accent hover:bg-accent-soft hover:text-accent-fg`,children:[u.detail.openItem,L]}),t[47]=u.detail.openItem,t[48]=I,t[49]=R):R=t[49];let z;t[50]!==j||t[51]!==N||t[52]!==P||t[53]!==F||t[54]!==R?(z=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[j,N,P,F,R]}),t[50]=j,t[51]=N,t[52]=P,t[53]=F,t[54]=R,t[55]=z):z=t[55];let B;return t[56]!==c||t[57]!==u.dragToUpdate||t[58]!==f||t[59]!==O||t[60]!==z||t[61]!==h?(B=(0,J.jsxs)(`article`,{draggable:!0,onDragStart:f,onDragEnd:c,title:p,className:h,children:[O,z]}),t[56]=c,t[57]=u.dragToUpdate,t[58]=f,t[59]=O,t[60]=z,t[61]=h,t[62]=B):B=t[62],B}function cn(){let e=(0,q.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`size-3.5 shrink-0 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-3 w-36 rounded bg-surface-muted`})]}),n=(0,J.jsx)(`div`,{className:`mt-3 h-3 w-48 rounded bg-surface-muted`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsxs)(`article`,{className:`flex h-24 w-full min-w-0 max-w-full flex-col overflow-hidden rounded-lg bg-surface-panel px-3 pt-3 pb-0 shadow-surface`,children:[t,n,(0,J.jsxs)(`div`,{className:`mt-3 flex gap-1.5`,children:[(0,J.jsx)(`div`,{className:`h-5 w-16 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-5 w-10 rounded-full bg-surface-muted`})]})]}),e[2]=r):r=e[2],r}function ln(e){let t=(0,q.c)(44),{file:n,index:r,busy:i,previewBusy:a,t:o,onOpen:s,onRemove:c}=e,u,d,f,p;t[0]===n?(u=t[1],d=t[2],f=t[3],p=t[4]):(u=_(n.name||`upload`,n.type||`application/octet-stream`),d=Zt(n.name||`upload`,u),f=tn,p=u.startsWith(`image/`)?n:null,t[0]=n,t[1]=u,t[2]=d,t[3]=f,t[4]=p);let m=f(p),h=n.name||`upload`,g=i||a,v;t[5]!==n||t[6]!==s?(v=()=>s(n),t[5]=n,t[6]=s,t[7]=v):v=t[7];let y;t[8]!==u||t[9]!==d||t[10]!==h||t[11]!==g||t[12]!==v||t[13]!==m?(y=(0,J.jsx)(rn,{name:h,mimeType:u,thumbnailUrl:m,previewable:d,disabled:g,onOpen:v}),t[8]=u,t[9]=d,t[10]=h,t[11]=g,t[12]=v,t[13]=m,t[14]=y):y=t[14];let b=d?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,x;t[15]===b?x=t[16]:(x=l(`min-w-0 flex-1 text-left`,b),t[15]=b,t[16]=x);let S=!d||i||a,C;t[17]!==n||t[18]!==s?(C=()=>s(n),t[17]=n,t[18]=s,t[19]=C):C=t[19];let w=n.name||`upload`,T;t[20]===w?T=t[21]:(T=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:w}),t[20]=w,t[21]=T);let E;t[22]===n.size?E=t[23]:(E=Yt(n.size),t[22]=n.size,t[23]=E);let D;t[24]===E?D=t[25]:(D=(0,J.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:E}),t[24]=E,t[25]=D);let O;t[26]!==C||t[27]!==T||t[28]!==D||t[29]!==x||t[30]!==S?(O=(0,J.jsxs)(`button`,{type:`button`,className:x,disabled:S,onClick:C,children:[T,D]}),t[26]=C,t[27]=T,t[28]=D,t[29]=x,t[30]=S,t[31]=O):O=t[31];let k;t[32]!==r||t[33]!==c?(k=()=>c(r),t[32]=r,t[33]=c,t[34]=k):k=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),t[35]=A):A=t[35];let j;t[36]!==i||t[37]!==o.attachments.remove||t[38]!==k?(j=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:o.attachments.remove,"aria-label":o.attachments.remove,disabled:i,onClick:k,children:A}),t[36]=i,t[37]=o.attachments.remove,t[38]=k,t[39]=j):j=t[39];let M;return t[40]!==O||t[41]!==j||t[42]!==y?(M=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel p-2 text-sm`,children:[y,O,j]}),t[40]=O,t[41]=j,t[42]=y,t[43]=M):M=t[43],M}function un(e){let t=(0,q.c)(56),{item:n,attachment:r,busy:i,previewBusy:a,t:o,onOpen:s,onDownload:c,onRemove:u}=e,d;t[0]!==r.fileName||t[1]!==r.mimeType?(d=Zt(r.fileName,r.mimeType),t[0]=r.fileName,t[1]=r.mimeType,t[2]=d):d=t[2];let f=d,p=nn(n.id,r),m=i||a,h;t[3]!==r||t[4]!==n||t[5]!==s?(h=()=>s(n,r),t[3]=r,t[4]=n,t[5]=s,t[6]=h):h=t[6];let g;t[7]!==r.fileName||t[8]!==r.mimeType||t[9]!==f||t[10]!==m||t[11]!==h||t[12]!==p?(g=(0,J.jsx)(rn,{name:r.fileName,mimeType:r.mimeType,thumbnailUrl:p,previewable:f,disabled:m,onOpen:h}),t[7]=r.fileName,t[8]=r.mimeType,t[9]=f,t[10]=m,t[11]=h,t[12]=p,t[13]=g):g=t[13];let _=f?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,v;t[14]===_?v=t[15]:(v=l(`min-w-0 flex-1 text-left`,_),t[14]=_,t[15]=v);let y=!f||i||a,b;t[16]!==r||t[17]!==n||t[18]!==s?(b=()=>s(n,r),t[16]=r,t[17]=n,t[18]=s,t[19]=b):b=t[19];let x;t[20]===r.fileName?x=t[21]:(x=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:r.fileName}),t[20]=r.fileName,t[21]=x);let S=r.mimeType,C;t[22]===r.size?C=t[23]:(C=Yt(r.size),t[22]=r.size,t[23]=C);let w;t[24]!==r.mimeType||t[25]!==C?(w=(0,J.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[S,` · `,C]}),t[24]=r.mimeType,t[25]=C,t[26]=w):w=t[26];let T;t[27]!==w||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==x?(T=(0,J.jsxs)(`button`,{type:`button`,className:v,disabled:y,onClick:b,children:[x,w]}),t[27]=w,t[28]=v,t[29]=y,t[30]=b,t[31]=x,t[32]=T):T=t[32];let E;t[33]!==r||t[34]!==n||t[35]!==c?(E=()=>c(n,r),t[33]=r,t[34]=n,t[35]=c,t[36]=E):E=t[36];let D;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,J.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),t[37]=D):D=t[37];let O;t[38]!==i||t[39]!==o.attachments.download||t[40]!==E?(O=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:o.attachments.download,"aria-label":o.attachments.download,disabled:i,onClick:E,children:D}),t[38]=i,t[39]=o.attachments.download,t[40]=E,t[41]=O):O=t[41];let k;t[42]!==r||t[43]!==n||t[44]!==u?(k=()=>u(n,r),t[42]=r,t[43]=n,t[44]=u,t[45]=k):k=t[45];let A;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}),t[46]=A):A=t[46];let j;t[47]!==i||t[48]!==o.attachments.remove||t[49]!==k?(j=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:o.attachments.remove,"aria-label":o.attachments.remove,disabled:i,onClick:k,children:A}),t[47]=i,t[48]=o.attachments.remove,t[49]=k,t[50]=j):j=t[50];let M;return t[51]!==T||t[52]!==O||t[53]!==j||t[54]!==g?(M=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel p-2 text-sm`,children:[g,T,O,j]}),t[51]=T,t[52]=O,t[53]=j,t[54]=g,t[55]=M):M=t[55],M}function dn({mode:e,item:t,pendingFiles:n,busy:r,t:i,onPendingFilesChange:a,onUpload:o,onRemove:s,onDownload:c,onPreviewError:u}){let d=(0,K.useRef)(null),[p,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(!1),[v,y]=(0,K.useState)(null),[b,S]=(0,K.useState)(null),w=f(e=>e.token),T=t?.attachments??[];function E(r){if(!r.length)return;if(e===`detail`&&t){o(t,r);return}let i=new Set(n.map(Xt)),s=[...n];for(let e of r){let t=Xt(e);i.has(t)||(i.add(t),s.push(e))}a(s)}function D(e){a(n.filter((t,n)=>n!==e))}async function O(e){let t=Xt(e);S(`pending:${t}`);try{y(await en(e,`pending:${t}`)),_(!0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{S(null)}}async function k(e,t){S(`saved:${t.id}`);try{let n=await m(Ge(e.id,t.id));if(!n.ok)throw Error(`HTTP ${n.status}`);y($t(t,Te(await n.arrayBuffer()))),_(!0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{S(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:l(`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,p&&`border-accent bg-accent-soft/40`),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||h(!1)},onDrop:e=>{e.preventDefault(),h(!1),E(Array.from(e.dataTransfer.files))},children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`h3`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,J.jsx)(Tt,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate`,children:i.attachments.title})]}),(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:r,onClick:()=>d.current?.click(),children:[(0,J.jsx)(x,{className:`size-3.5`,"aria-hidden":!0}),i.attachments.add]}),(0,J.jsx)(`input`,{ref:d,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{E(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),n.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:n.map((e,t)=>(0,J.jsx)(ln,{file:e,index:t,busy:r,previewBusy:b===`pending:${Xt(e)}`,t:i,onOpen:e=>void O(e),onRemove:D},Xt(e)))}):null,t&&T.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:T.map(e=>(0,J.jsx)(un,{item:t,attachment:e,busy:r,previewBusy:b===`saved:${e.id}`,t:i,onOpen:(e,t)=>void k(e,t),onDownload:c,onRemove:s},e.id))}):null,!n.length&&!T.length?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i.attachments.empty}):null]}),(0,J.jsx)(G,{open:g,attachment:v,authToken:w,layerClassName:`z-[100]`,onClose:()=>{_(!1),y(null)}})]})}function fn(e){let t=(0,q.c)(169),{mode:n,item:r,initialStatus:i,events:a,busy:s,error:c,notice:u,t:d,onClose:f,onCreate:p,onSave:m,onStartChat:h,onCreateGoal:g,onAddAttachments:_,onRemoveAttachment:v,onDownloadAttachment:y,onPreviewError:b}=e,S=n!==null,[w,E]=(0,K.useState)(``),[D,O]=(0,K.useState)(``),[k,A]=(0,K.useState)(`todo`),[j,N]=(0,K.useState)(`normal`),[P,I]=(0,K.useState)(``),[L,R]=(0,K.useState)(``),z;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(z=[],t[0]=z):z=t[0];let[B,V]=(0,K.useState)(z),H,U;t[1]!==i||t[2]!==r||t[3]!==n?(H=()=>{if(n===`create`){E(``),O(``),A(i),N(`normal`),I(``),R(``),V([]);return}n===`detail`&&r&&(E(r.title),O(r.description??``),A(r.status),N(r.priority),I(r.nextAction??``),R(r.blockedReason??``),V([]))},U=[i,r,n],t[1]=i,t[2]=r,t[3]=n,t[4]=H,t[5]=U):(H=t[4],U=t[5]),(0,K.useEffect)(H,U);let ee;t[6]!==L||t[7]!==D||t[8]!==r||t[9]!==n||t[10]!==P||t[11]!==p||t[12]!==m||t[13]!==B||t[14]!==j||t[15]!==k||t[16]!==w?(ee=function(e){e.preventDefault();let t=w.trim();if(t){if(n===`create`){p({title:t,description:D.trim()||void 0,priority:j,status:k,nextAction:P.trim()||void 0,blockedReason:L.trim()||void 0,attachments:B});return}r&&m(r,{title:t,description:D.trim()||null,status:k,priority:j,nextAction:P.trim()||null,blockedReason:L.trim()||null})}},t[6]=L,t[7]=D,t[8]=r,t[9]=n,t[10]=P,t[11]=p,t[12]=m,t[13]=B,t[14]=j,t[15]=k,t[16]=w,t[17]=ee):ee=t[17];let te=ee,W;t[18]===f?W=t[19]:(W=e=>!e&&f(),t[18]=f,t[19]=W);let ne;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[20]=ne):ne=t[20];let re=n===`create`?d.create.title:r?.title||d.title,ie;t[21]===re?ie=t[22]:(ie=(0,J.jsx)(M,{className:`truncate text-base font-semibold text-fg`,children:re}),t[21]=re,t[22]=ie);let ae;t[23]===d.detail.description?ae=t[24]:(ae=(0,J.jsx)(F,{className:`mt-1 text-sm text-fg-muted`,children:d.detail.description}),t[23]=d.detail.description,t[24]=ae);let se;t[25]!==ie||t[26]!==ae?(se=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[ie,ae]}),t[25]=ie,t[26]=ae,t[27]=se):se=t[27];let ce;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,J.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),t[28]=ce):ce=t[28];let G;t[29]===s?G=t[30]:(G=(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,disabled:s,children:ce})}),t[29]=s,t[30]=G);let le;t[31]!==se||t[32]!==G?(le=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[se,G]}),t[31]=se,t[32]=G,t[33]=le):le=t[33];let ue;t[34]===c?ue=t[35]:(ue=c?(0,J.jsx)(`div`,{className:`rounded-lg border border-danger/30 bg-danger-soft px-3 py-2 text-sm text-danger`,children:c}):null,t[34]=c,t[35]=ue);let de;t[36]!==c||t[37]!==u?(de=!c&&u?(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-success/30 bg-success-soft px-3 py-2 text-sm text-fg`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(lt,{className:`mt-0.5 size-4 shrink-0 text-success`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`font-medium text-success`,children:u.title}),(0,J.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:u.message})]})]}):null,t[36]=c,t[37]=u,t[38]=de):de=t[38];let fe;t[39]===d.create.titleLabel?fe=t[40]:(fe=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.titleLabel}),t[39]=d.create.titleLabel,t[40]=fe);let pe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(pe=e=>E(e.target.value),t[41]=pe):pe=t[41];let me;t[42]===w?me=t[43]:(me=(0,J.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:w,onChange:pe}),t[42]=w,t[43]=me);let he;t[44]!==fe||t[45]!==me?(he=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[fe,me]}),t[44]=fe,t[45]=me,t[46]=he):he=t[46];let ge;t[47]===d.detail.status?ge=t[48]:(ge=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.detail.status}),t[47]=d.detail.status,t[48]=ge);let _e;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>A(e.target.value),t[49]=_e):_e=t[49];let ve;t[50]===d.statuses?ve=t[51]:(ve=Gt.map(e=>(0,J.jsx)(Xe,{value:e,children:d.statuses[e]},e)),t[50]=d.statuses,t[51]=ve);let be;t[52]!==k||t[53]!==ve?(be=(0,J.jsx)(rt,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:k,onChange:_e,children:ve}),t[52]=k,t[53]=ve,t[54]=be):be=t[54];let Se;t[55]!==ge||t[56]!==be?(Se=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[ge,be]}),t[55]=ge,t[56]=be,t[57]=Se):Se=t[57];let Te;t[58]===d.create.priorityLabel?Te=t[59]:(Te=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.priorityLabel}),t[58]=d.create.priorityLabel,t[59]=Te);let Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=e=>N(e.target.value),t[60]=Oe):Oe=t[60];let ke;t[61]===d.priorities?ke=t[62]:(ke=Kt.map(e=>(0,J.jsx)(Xe,{value:e,children:d.priorities[e]},e)),t[61]=d.priorities,t[62]=ke);let Ae;t[63]!==j||t[64]!==ke?(Ae=(0,J.jsx)(rt,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:j,onChange:Oe,children:ke}),t[63]=j,t[64]=ke,t[65]=Ae):Ae=t[65];let je;t[66]!==Te||t[67]!==Ae?(je=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Te,Ae]}),t[66]=Te,t[67]=Ae,t[68]=je):je=t[68];let Me;t[69]!==Se||t[70]!==je?(Me=(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Se,je]}),t[69]=Se,t[70]=je,t[71]=Me):Me=t[71];let Ne;t[72]===d.create.descriptionLabel?Ne=t[73]:(Ne=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.descriptionLabel}),t[72]=d.create.descriptionLabel,t[73]=Ne);let Pe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=e=>O(e.target.value),t[74]=Pe):Pe=t[74];let Fe;t[75]===D?Fe=t[76]:(Fe=(0,J.jsx)(`textarea`,{className:`min-h-28 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:D,onChange:Pe}),t[75]=D,t[76]=Fe);let Ie;t[77]!==Ne||t[78]!==Fe?(Ie=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ne,Fe]}),t[77]=Ne,t[78]=Fe,t[79]=Ie):Ie=t[79];let Le;t[80]!==s||t[81]!==r||t[82]!==n||t[83]!==_||t[84]!==y||t[85]!==b||t[86]!==v||t[87]!==B||t[88]!==d?(Le=(0,J.jsx)(dn,{mode:n,item:r,pendingFiles:B,busy:s,t:d,onPendingFilesChange:V,onUpload:_,onRemove:v,onDownload:y,onPreviewError:b}),t[80]=s,t[81]=r,t[82]=n,t[83]=_,t[84]=y,t[85]=b,t[86]=v,t[87]=B,t[88]=d,t[89]=Le):Le=t[89];let Re;t[90]!==L||t[91]!==n||t[92]!==P||t[93]!==k||t[94]!==d.blockedReason||t[95]!==d.nextAction?(Re=n===`detail`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.nextAction}),(0,J.jsx)(`textarea`,{className:`min-h-20 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:P,onChange:e=>I(e.target.value)})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:l(`font-medium`,k===`blocked`||k===`needs_input`?`text-red-700 dark:text-red-300`:`text-fg-muted`),children:d.blockedReason}),(0,J.jsx)(`textarea`,{className:l(`min-h-20 rounded-lg border bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,k===`blocked`||k===`needs_input`?`border-red-500/40`:`border-edge`),value:L,onChange:e=>R(e.target.value)})]})]}):null,t[90]=L,t[91]=n,t[92]=P,t[93]=k,t[94]=d.blockedReason,t[95]=d.nextAction,t[96]=Re):Re=t[96];let ze;t[97]!==ue||t[98]!==de||t[99]!==he||t[100]!==Me||t[101]!==Ie||t[102]!==Le||t[103]!==Re?(ze=(0,J.jsxs)(`div`,{className:`grid content-start gap-4`,children:[ue,de,he,Me,Ie,Le,Re]}),t[97]=ue,t[98]=de,t[99]=he,t[100]=Me,t[101]=Ie,t[102]=Le,t[103]=Re,t[104]=ze):ze=t[104];let Be;t[105]!==s||t[106]!==r||t[107]!==n||t[108]!==g||t[109]!==h||t[110]!==d.detail.actions||t[111]!==d.detail.createGoal||t[112]!==d.detail.openItem||t[113]!==d.detail.startChat?(Be=n===`detail`&&r?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.actions}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>h(r),children:[(0,J.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),d.detail.startChat]}),(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>g(r),children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),d.detail.createGoal]}),(0,J.jsx)(C,{asChild:!0,variant:`secondary`,className:`justify-start rounded-lg`,children:(0,J.jsxs)(o,{to:`/work-items/${encodeURIComponent(r.id)}`,children:[(0,J.jsx)(Ce,{className:`size-4`,"aria-hidden":!0}),d.detail.openItem]})})]})]}):null,t[105]=s,t[106]=r,t[107]=n,t[108]=g,t[109]=h,t[110]=d.detail.actions,t[111]=d.detail.createGoal,t[112]=d.detail.openItem,t[113]=d.detail.startChat,t[114]=Be):Be=t[114];let Ve;t[115]===d.detail.links?Ve=t[116]:(Ve=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.links}),t[115]=d.detail.links,t[116]=Ve);let He;t[117]!==r||t[118]!==d.detail.noLinks||t[119]!==d.linkKinds?(He=r?.links?.length?r.links.slice(0,6).map(e=>(0,J.jsxs)(o,{to:Y(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[d.linkKinds[e.kind],(0,J.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.detail.noLinks}),t[117]=r,t[118]=d.detail.noLinks,t[119]=d.linkKinds,t[120]=He):He=t[120];let Ue;t[121]===He?Ue=t[122]:(Ue=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2 text-sm`,children:He}),t[121]=He,t[122]=Ue);let We;t[123]!==Ve||t[124]!==Ue?(We=(0,J.jsxs)(`section`,{children:[Ve,Ue]}),t[123]=Ve,t[124]=Ue,t[125]=We):We=t[125];let Ge;t[126]===d.detail.activity?Ge=t[127]:(Ge=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.activity}),t[126]=d.detail.activity,t[127]=Ge);let Ke;t[128]!==a||t[129]!==d.detail.noActivity||t[130]!==d.eventTypes?(Ke=a.length?a.slice(0,5).map(e=>(0,J.jsxs)(`div`,{className:`text-sm`,children:[(0,J.jsx)(`div`,{className:`font-medium text-fg`,children:d.eventTypes[e.type]??e.type}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:Jt(e.createdAt)})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.detail.noActivity}),t[128]=a,t[129]=d.detail.noActivity,t[130]=d.eventTypes,t[131]=Ke):Ke=t[131];let qe;t[132]===Ke?qe=t[133]:(qe=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2`,children:Ke}),t[132]=Ke,t[133]=qe);let Je;t[134]!==Ge||t[135]!==qe?(Je=(0,J.jsxs)(`section`,{children:[Ge,qe]}),t[134]=Ge,t[135]=qe,t[136]=Je):Je=t[136];let Ye;t[137]!==Be||t[138]!==We||t[139]!==Je?(Ye=(0,J.jsxs)(`aside`,{className:`grid content-start gap-5`,children:[Be,We,Je]}),t[137]=Be,t[138]=We,t[139]=Je,t[140]=Ye):Ye=t[140];let Ze;t[141]!==ze||t[142]!==Ye?(Ze=(0,J.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-6 overflow-y-auto px-5 py-4 lg:grid-cols-[minmax(0,1fr)_16rem]`,children:[ze,Ye]}),t[141]=ze,t[142]=Ye,t[143]=Ze):Ze=t[143];let Qe;t[144]!==s||t[145]!==f||t[146]!==d.create.cancel?(Qe=(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:f,disabled:s,children:d.create.cancel}),t[144]=s,t[145]=f,t[146]=d.create.cancel,t[147]=Qe):Qe=t[147];let $e;t[148]!==s||t[149]!==w?($e=s||!w.trim(),t[148]=s,t[149]=w,t[150]=$e):$e=t[150];let et;t[151]===n?et=t[152]:(et=n===`create`?(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}):null,t[151]=n,t[152]=et);let tt=n===`create`?d.create.submit:d.detail.save,nt;t[153]!==$e||t[154]!==et||t[155]!==tt?(nt=(0,J.jsxs)(C,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:$e,children:[et,tt]}),t[153]=$e,t[154]=et,t[155]=tt,t[156]=nt):nt=t[156];let it;t[157]!==Qe||t[158]!==nt?(it=(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[Qe,nt]}),t[157]=Qe,t[158]=nt,t[159]=it):it=t[159];let at;t[160]!==te||t[161]!==le||t[162]!==Ze||t[163]!==it?(at=(0,J.jsxs)(we,{children:[ne,(0,J.jsx)(xe,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(86dvh,48rem)] w-[min(60rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:(0,J.jsxs)(`form`,{onSubmit:te,className:`flex min-h-0 flex-1 flex-col`,children:[le,Ze,it]})})]}),t[160]=te,t[161]=le,t[162]=Ze,t[163]=it,t[164]=at):at=t[164];let ot;return t[165]!==S||t[166]!==W||t[167]!==at?(ot=(0,J.jsx)(Et,{open:S,onOpenChange:W,children:at}),t[165]=S,t[166]=W,t[167]=at,t[168]=ot):ot=t[168],ot}function pn({projectId:e,createRequestKey:t=0}){let n=a(),r=d(p(e=>e.language)).projectDetailPage.workItems,i=(0,K.useRef)(null),o=(0,K.useRef)(null),[s,c]=(0,K.useState)([]),[u,f]=(0,K.useState)(!0),[m,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(null),[v,y]=(0,K.useState)(!1),[b,S]=(0,K.useState)(null),[w,T]=(0,K.useState)(null),[E,D]=(0,K.useState)(!1),[O,k]=(0,K.useState)(!1),[A,M]=(0,K.useState)(!1),[N,P]=(0,K.useState)(`todo`),[F,I]=(0,K.useState)(null),[L,R]=(0,K.useState)([]),z=(0,K.useCallback)(async(t=`replace`,n=0)=>{f(!0),h(null);try{let r=await Pe(e,{limit:100,offset:n});c(e=>t===`append`?[...e,...r.items]:r.items),k(r.hasMore)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}},[e]);(0,K.useEffect)(()=>{z(`replace`,0)},[z]),(0,K.useEffect)(()=>{t&&(I(null),R([]),h(null),_(null),P(`todo`),M(!0))},[t]);let B=(0,K.useMemo)(()=>Gt.map(e=>({status:e,title:r.statuses[e],items:s.filter(t=>t.status===e)})),[s,r.statuses]),V=(0,K.useCallback)(e=>{c(t=>t.map(t=>t.id===e.id?e:t)),I(t=>t?.id===e.id?e:t)},[]),H=(0,K.useCallback)(async(e,t)=>{y(!0),h(null),_(null);try{let n=await Ie(e.id,t);n.item.archivedAt?(c(e=>e.filter(e=>e.id!==n.item.id)),I(null)):(V(n.item),_({title:r.feedback.savedTitle,message:r.feedback.savedNext}))}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[r.feedback.savedNext,r.feedback.savedTitle,V]),U=(0,K.useCallback)(async e=>{I(e),R([]),h(null),_(null);let t=await yt(e.id).catch(()=>null);t&&R(t.events)},[]),ee=(0,K.useCallback)(async t=>{y(!0),h(null),_(null);try{let n=await Je(e,t);c(e=>[n.item,...e]),M(!1),I(n.item),R((await yt(n.item.id).catch(()=>({events:[]}))).events),_({title:r.feedback.createdTitle,message:r.feedback.createdNext})}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[e,r.feedback.createdNext,r.feedback.createdTitle]),te=(0,K.useCallback)(async(e,t)=>{if(t.length){y(!0),h(null),_(null);try{let n=await $e(e.id,t);V(n.item),R((await yt(n.item.id).catch(()=>({events:[]}))).events)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}}},[V]),W=(0,K.useCallback)(async(e,t)=>{y(!0),h(null),_(null);try{let n=await at(e.id,t.id);V(n.item),R((await yt(n.item.id).catch(()=>({events:[]}))).events)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[V]),ne=(0,K.useCallback)(async(e,t)=>{h(null),_(null);try{await ht(e.id,t)}catch(e){h(e instanceof Error?e.message:String(e))}},[]),re=(0,K.useCallback)(async e=>{y(!0),h(null),_(null);try{let t=await ze(e.id);V(t.item),await U(t.item),n(`/chat/${encodeURIComponent(t.session.key)}`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[n,U,V]),ie=(0,K.useCallback)(async e=>{y(!0),h(null),_(null);try{let t=await Me(e.id);V(t.item),await U(t.item),n(`/goals/${encodeURIComponent(t.goal.id)}`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[n,U,V]),ae=(0,K.useCallback)((e,t)=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(Wt,e.id),S(e.id)},[]),oe=(0,K.useCallback)((e,t)=>{t.preventDefault();let n=t.dataTransfer.getData(Wt)||b;T(null),S(null);let r=s.find(e=>e.id===n);!r||r.status===e||H(r,{status:e})},[b,s,H]),se=(0,K.useCallback)(e=>{H(e,{status:e.status===`done`?`todo`:`done`})},[H]),ce=(0,K.useCallback)(e=>{I(null),R([]),h(null),_(null),P(e),M(!0)},[]),G=(0,K.useCallback)(e=>{let t=o.current;!t||t.pointerId!==e.pointerId||(o.current=null,D(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),le=(0,K.useCallback)(e=>{if(e.button!==0||b||an(e.target))return;let t=i.current;t&&(o.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[b]),ue=(0,K.useCallback)(e=>{let t=o.current,n=i.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,D(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,J.jsxs)(`section`,{id:`project-panel-work-items`,role:`tabpanel`,"aria-labelledby":`project-tab-work-items`,className:`flex h-full min-h-0 flex-col`,children:[m?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:m}):null,(0,J.jsx)(`section`,{ref:i,className:l(`min-h-0 flex-1 overflow-x-auto rounded-lg p-2 transition-opacity`,u&&`opacity-60`,E?`cursor-grabbing select-none`:`cursor-grab`),"aria-label":r.boardAria,"aria-busy":u,onPointerDown:le,onPointerMove:ue,onPointerUp:G,onPointerCancel:G,onLostPointerCapture:e=>{o.current?.pointerId===e.pointerId&&(o.current=null,D(!1))},children:(0,J.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:B.map(e=>(0,J.jsxs)(`section`,{className:l(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`,w===e.status&&`bg-surface-active`),"aria-label":e.title,onDragOver:t=>{b&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,T(e.status))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||T(null)},onDrop:t=>oe(e.status,t),children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:e.items.length})]}),(0,J.jsx)(j,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]}),(0,J.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[e.items.length?e.items.map(e=>(0,J.jsx)(sn,{item:e,dragging:b===e.id,onOpen:U,onToggleDone:se,onDragStart:ae,onDragEnd:()=>{S(null),T(null)},t:r},e.id)):u?(0,J.jsxs)(`div`,{className:`grid gap-2 animate-pulse motion-reduce:animate-none`,children:[(0,J.jsx)(cn,{}),(0,J.jsx)(cn,{})]}):(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:r.emptyColumn}),u?null:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-full items-center justify-center rounded-lg bg-surface-panel/85 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-muted`,"aria-label":r.create.addToColumn.replace(`{{status}}`,e.title),title:r.create.addToColumn.replace(`{{status}}`,e.title),onClick:()=>ce(e.status),children:(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0})})]})]},e.status))})}),!u&&O?(0,J.jsx)(C,{type:`button`,variant:`secondary`,className:`justify-self-center`,onClick:()=>void z(`append`,s.length),children:r.loadMore}):null,(0,J.jsx)(fn,{mode:A?`create`:F?`detail`:null,item:F,initialStatus:N,events:L,busy:v,error:m,notice:g,t:r,onClose:()=>{M(!1),I(null),R([]),h(null),_(null)},onCreate:ee,onSave:(e,t)=>void H(e,t),onStartChat:re,onCreateGoal:ie,onAddAttachments:(e,t)=>void te(e,t),onRemoveAttachment:(e,t)=>void W(e,t),onDownloadAttachment:(e,t)=>void ne(e,t),onPreviewError:e=>{_(null),h(e)}})]})}var mn=[{id:`overview`,icon:et},{id:`work-items`,icon:Fe},{id:`sessions`,icon:Ee},{id:`goals`,icon:De},{id:`workflows`,icon:W},{id:`files`,icon:ne},{id:`activity`,icon:D},{id:`automations`,icon:re},{id:`notes`,icon:U},{id:`skills`,icon:st},{id:`settings`,icon:Be}],hn=new Set([`work-items`,`goals`,`workflows`,`automations`]),gn=new Set(mn.map(e=>e.id)),X=`xopc.projectFiles.panelWidthPx`,_n=320,vn=220,yn=560;function bn(e){return Math.min(yn,Math.max(vn,Math.round(e)))}function xn(){try{let e=window.localStorage.getItem(X);if(e==null)return _n;let t=Number.parseInt(e,10);return Number.isFinite(t)?bn(t):_n}catch{return _n}}function Sn(e){try{window.localStorage.setItem(X,String(bn(e)))}catch{}}function Cn(e){return!!(e&&gn.has(e))}function wn(e){return hn.has(e)}function Tn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function En(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):bt(n)}function Dn(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function On(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`||e===`cancelled`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function kn(e){let t=(0,q.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,J.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function An(e=!1){return l(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function jn(e){let t=(0,q.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,J.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=l(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let u;t[4]!==c||t[5]!==r?(u=(0,J.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=u):u=t[6];let d;return t[7]!==o||t[8]!==u?(d=(0,J.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,u]}),t[7]=o,t[8]=u,t[9]=d):d=t[9],d}function Mn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function Nn(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Pn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Fn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function In(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.sessionKey?t.sessionKey:t.kind}function Ln(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Rn(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function zn(e){let t=e.sourceChannel?.trim();if(t)return Bn(t);let n=e.key.split(`:`).filter(Boolean),r=(n[0]?.toLowerCase()===`agent`?n.slice(2).join(`:`):e.key).split(`:`)[0]?.split(/[-_]/)[0]?.trim();return Bn(r||``)}function Bn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Vn(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function Hn(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function Un(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Un(e.children,t,n)}:e)}function Wn({currentProject:e,pm:t,projectsText:n,wd:r}){let i=a(),[o,c]=(0,K.useState)(!1),[u,d]=(0,K.useState)([e]),[f,p]=(0,K.useState)(``),[m,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(null),[v,y]=(0,K.useState)(!1),[S,w]=(0,K.useState)(`new`),[E,D]=(0,K.useState)(``),[O,k]=(0,K.useState)(``),[A,j]=(0,K.useState)(!1),[N,P]=(0,K.useState)(null),[I,L]=(0,K.useState)(null),R=(0,K.useCallback)(async()=>{h(!0),_(null);try{let t=await be({limit:100});d(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}},[e]);(0,K.useEffect)(()=>{d(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,K.useEffect)(()=>{o&&R()},[R,o]);let z=(0,K.useMemo)(()=>{let t=f.trim().toLowerCase().split(/\s+/).filter(Boolean);return u.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=Mn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>Nn(t)-Nn(e))},[e.id,u,f]),B=e=>t.statuses[e.status]??e.status,V=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,H=e=>{w(e),D(``),k(``),P(null),y(!0),c(!1)},U=(0,K.useCallback)(async(e={})=>{let t=O.trim(),n=E.trim()||(S===`directory`?Pn(t):``);if(n){j(!0),P(null),L(null);try{let r=await b({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});y(!1),D(``),k(``),d(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=Fn(e);t?(L(t),y(!1)):P(e instanceof Error?e.message:String(e))}finally{j(!1)}}},[S,E,i,O]),ee=(0,K.useCallback)(e=>{e.preventDefault(),U()},[U]),te=(0,K.useCallback)(()=>{U({createWorkspaceRoot:!0})},[U]),W=(0,K.useCallback)(()=>{L(null),y(!0)},[]),re=e=>{k(e),S===`directory`&&!E.trim()&&D(Pn(e))},ie=(e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:l(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{c(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,J.jsx)(s,{className:l(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:V(e)})]}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Dn(e.status)),children:B(e)})]},e.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Ke,{open:o,onOpenChange:c,children:[(0,J.jsx)(Ue,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Dn(e.status)),children:B(e)})]}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:V(e)})]}),(0,J.jsx)(je,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,J.jsx)(tt,{children:(0,J.jsxs)(ct,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,J.jsxs)(`label`,{className:`relative block`,children:[(0,J.jsx)(He,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:f,onChange:e=>p(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,J.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ie(e,!0),(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),g?(0,J.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:g}):null,m&&z.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!m&&z.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,z.map(e=>ie(e,!1))]}),(0,J.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>H(`new`),children:[(0,J.jsx)(x,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>H(`directory`),children:[(0,J.jsx)(ne,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{c(!1),i(`/projects`)},children:[(0,J.jsx)(Be,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,J.jsx)(Et,{open:v,onOpenChange:e=>!A&&y(e),children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:S===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm text-fg-muted`,children:S===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,J.jsxs)(`form`,{onSubmit:ee,className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[N?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:N}):null,(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,J.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:E,onChange:e=>D(e.target.value),placeholder:`xopc`})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,J.jsx)(kt,{value:O,onChange:re,disabled:A,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,J.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:A,children:n.cancel})}),(0,J.jsxs)(C,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:A||!(E.trim()||S===`directory`&&Pn(O)),children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,J.jsx)(Et,{open:!!I,onOpenChange:e=>{e||L(null)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:I?Tn(n.workspaceMissingDescription,{workspace:I}):null})]}),I?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(ne,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:I})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:W,disabled:A,children:n.workspaceMissingBack}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:te,disabled:A,children:[(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Gn(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=a(),s=d(p(e=>e.language)),f=s.chat.workingDirectory,m=s.projectDetailPage,h=s.projectsPage,g=_e(e=>e.setPageHeader),_=_e(e=>e.clearPageHeader),[v,b]=(0,K.useState)(null),[S,j]=(0,K.useState)(null),[I,z]=(0,K.useState)([]),[G,he]=(0,K.useState)(``),[be,Ce]=(0,K.useState)([]),[Te,je]=(0,K.useState)([]),[Me,Pe]=(0,K.useState)([]),[Ie,ze]=(0,K.useState)([]),[Ve,Ue]=(0,K.useState)([]),[We,Ge]=(0,K.useState)(!1),[Ke,qe]=(0,K.useState)(null),[Je,$e]=(0,K.useState)([]),[tt,at]=(0,K.useState)(0),[ct,lt]=(0,K.useState)(!1),[ht,yt]=(0,K.useState)(!1),[bt,Tt]=(0,K.useState)(!1),[Nt,Pt]=(0,K.useState)([]),Ft=(0,K.useRef)(new Set),[q,It]=(0,K.useState)(null),[Lt,Rt]=(0,K.useState)(xn),[zt,Bt]=(0,K.useState)(!1),[Vt,Ut]=(0,K.useState)(!1),[Wt,Gt]=(0,K.useState)(``),[Kt,qt]=(0,K.useState)([]),[Jt,Yt]=(0,K.useState)(!1),[Xt,Zt]=(0,K.useState)(null),[Qt,$t]=(0,K.useState)(!1),[en,tn]=(0,K.useState)(null),[nn,rn]=(0,K.useState)([]),[Y,an]=(0,K.useState)(``),[on,sn]=(0,K.useState)(!0),[cn,ln]=(0,K.useState)(!1),[un,dn]=(0,K.useState)(!1),[fn,mn]=(0,K.useState)(null),[hn,gn]=(0,K.useState)(!1),[X,_n]=(0,K.useState)(`fixed`),[vn,yn]=(0,K.useState)(``),[Mn,Nn]=(0,K.useState)(null),[Pn,Bn]=(0,K.useState)(!1),[Gn,Kn]=(0,K.useState)(!1),[qn,Jn]=(0,K.useState)(0),[Yn,Xn]=(0,K.useState)(!1),[Zn,Qn]=(0,K.useState)(null),[$n,er]=(0,K.useState)(!1),[tr,nr]=(0,K.useState)(!1),[rr,ir]=(0,K.useState)(!1),[ar,Z]=(0,K.useState)(null),[or,sr]=(0,K.useState)({defaultAgentId:``,agents:[],models:[],checklistDecomposePolicy:`empty_only`}),[cr,lr]=(0,K.useState)({title:``,reason:``}),[Q,ur]=(0,K.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),dr=`overview`,$=n?`notes`:Cn(t)?t:dr,fr=(0,K.useCallback)(t=>{e&&r(`/projects/${encodeURIComponent(e)}/${t}`)},[r,e]),pr=(0,K.useCallback)(t=>e?`/projects/${encodeURIComponent(e)}/${t}`:`/projects`,[e]),mr=(0,K.useCallback)(e=>{let t=pr(`goals`);return`/goals/${encodeURIComponent(e)}?returnTo=${encodeURIComponent(t)}`},[pr]),hr=(0,K.useCallback)(t=>{e&&r(pr(t),{replace:!0})},[r,e,pr]),gr=(0,K.useCallback)((e,t)=>{hr(e),r(t)},[r,hr]),_r=(0,K.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||hr(e)},[hr]),vr=(0,K.useCallback)(e=>e.startsWith(`/goals/`)?`goals`:e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/workflows`)?`workflows`:e.startsWith(`/automations`)?`automations`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,K.useEffect)(()=>{!e||!t||Cn(t)||r(`/projects/${encodeURIComponent(e)}/${dr}`,{replace:!0})},[dr,r,e,t]),(0,K.useEffect)(()=>{if(!e)return;let t=!1;return sn(!0),Z(null),Promise.all([wt(e),w(e),pe(e),N().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;let a=e.project;b(a),j(e),z(n),Ce(r),rn(i?.agents??[]),an(a.defaultAgentId??``),ur({name:a.name,description:a.description??``,status:a.status,defaultAgentId:a.defaultAgentId??``,workspaceRoot:a.workspaceRoot??``,brief:a.brief??``,instructions:a.instructions??``})}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||sn(!1)}),()=>{t=!0}},[e]),(0,K.useEffect)(()=>{let e=!1;async function t(){let[t,n,r]=await Promise.allSettled([N(),fe(),Re()]);e||sr(e=>{let i=t.status===`fulfilled`?t.value.defaultId:e.defaultAgentId,a=v?.defaultAgentId||Y||i,o=t.status===`fulfilled`?t.value.agents:e.agents,s=n.status===`fulfilled`?n.value:e.models,c=r.status===`fulfilled`?At(r.value.payload?.config).checklistDecomposePolicy:e.checklistDecomposePolicy;return{defaultAgentId:a,agents:o.length?o:[{id:a||`main`,workspace:``,profileDir:``,typedModels:{defaultRole:`deep`,preset:[],effective:[]},extends:[],isDefault:!0,skills:{preset:[]},tools:{presetDenied:[],entryDisable:[],effectiveDisable:[]}}],models:s,checklistDecomposePolicy:c}})}return t(),()=>{e=!0}},[v?.defaultAgentId,Y]);let yr=(0,K.useCallback)(async()=>{if(v){Xn(!0),Z(null);try{let[e,t]=await Promise.all([y(),ee(100,{ownerAgentId:Y||void 0,projectId:v.id})]);je(e),Pe(t)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Xn(!1)}}},[v,Y]);(0,K.useEffect)(()=>{v&&yr()},[v,yr]);let br=(0,K.useCallback)(async()=>{if(v){Ge(!0),Z(null);try{let[e,t]=await Promise.all([xt.list({projectId:v.id}),xt.runs(50,void 0,{projectId:v.id})]);ze(e.automations),Ue(t.runs)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ge(!1)}}},[v]);(0,K.useEffect)(()=>{$===`automations`&&br()},[br,$]);let xr=(0,K.useCallback)(async()=>{if(v){lt(!0),Z(null);try{let e=await L(v.id,{includeRelated:ht,limit:100});$e(e.items),at(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{lt(!1)}}},[v,ht]);(0,K.useEffect)(()=>{$===`activity`&&xr()},[xr,$]);let Sr=(0,K.useCallback)(async e=>{qe(`run:${e.id}`),Z(null);try{await xt.runNow(e.id),await br()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{qe(null)}},[br]),Cr=(0,K.useCallback)(async e=>{qe(`toggle:${e.id}`),Z(null);try{e.enabled?await xt.pause(e.id):await xt.resume(e.id),await br()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{qe(null)}},[br]),wr=(0,K.useCallback)(async()=>{if(!v?.effectiveWorkspaceRoot?.trim()){Pt([]),Ft.current.clear(),tn(null);return}$t(!0),tn(null),Ft.current.clear();try{Pt(Hn((await H(v.id,``)).entries)),Ft.current.add(``)}catch(e){Pt([]),Ft.current.clear(),tn(e instanceof Error?e.message:String(e))}finally{$t(!1)}},[v]),Tr=(0,K.useCallback)(async e=>{if(!(!v?.effectiveWorkspaceRoot?.trim()||Ft.current.has(e))){Ft.current.add(e),tn(null);try{let t=await H(v.id,e);Pt(n=>Un(n,e,Hn(t.entries)))}catch(t){Ft.current.delete(e),tn(t instanceof Error?t.message:String(t))}}},[v]);(0,K.useEffect)(()=>{$===`files`&&wr()},[wr,$]);let Er=Wt.trim();(0,K.useEffect)(()=>{if($!==`files`||!v||!Vt||!Er){qt([]),Yt(!1),Zt(null);return}let e=!1;Yt(!0),Zt(null),qt([]);let t=window.setTimeout(()=>{A(v.id,Er,50).then(t=>{e||qt(t)}).catch(t=>{e||Zt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Yt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[Er,v,Vt,$]);let Dr=(0,K.useCallback)(async()=>{if(v){Kn(!0),Z(null);try{let e=await ie(v.id);gr(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Kn(!1)}}},[gr,v]),Or=(0,K.useCallback)(()=>{fr(`work-items`),Jn(e=>e+1)},[fr]),kr=(0,K.useCallback)(async()=>{if(!v)return;let[e,t]=await Promise.all([wt(v.id),pe(v.id)]);j(e),b(e.project),Ce(t)},[v]),Ar=(0,K.useCallback)(async e=>{if(!v||!e.title.trim())return;let t=Number.parseInt(e.maxTurns,10),n=e.deadline?new Date(e.deadline).getTime():void 0;er(!0),Z(null);try{await te(v.id,{title:e.title.trim(),description:e.description.trim()||void 0,attachments:e.attachments.length?e.attachments:void 0,priority:e.priority,deadlineAt:Number.isFinite(n)?n:void 0,maxTurns:Number.isFinite(t)?t:void 0,agentId:e.agentId.trim()||void 0,judgeModelRef:e.judgeModelRef.trim()||void 0,contract:{objective:e.objective.trim()||e.title.trim(),scopeBoundary:e.scopeBoundary.trim()||void 0,evidencePlan:jt(e.evidencePlan),criteria:jt(e.checklist)}}),ir(!1),fr(`goals`),await kr()}catch(e){throw Z(e instanceof Error?e.message:String(e)),e}finally{er(!1)}},[fr,v,kr]),jr=(0,K.useCallback)(async e=>{if(e.preventDefault(),!(!v||!cr.title.trim())){nr(!0),Z(null);try{await Ze(v.id,{title:cr.title.trim(),reason:cr.reason.trim()||void 0}),lr({title:``,reason:``}),await kr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{nr(!1)}}},[cr.reason,cr.title,v,kr]),Mr=(0,K.useCallback)(async e=>{if(v){Qn(`retry:${e.id}`),Z(null);try{let t=await O(e.id,{ownerAgentId:Y||e.metadata?.agentId,projectId:e.metadata?.projectId||v.id});await yr(),gr(`workflows`,vt(t.runId,{ownerAgentId:Y||e.metadata?.agentId||v.defaultAgentId}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Qn(null)}}},[gr,v,yr,Y]),Nr=(0,K.useCallback)(async e=>{Qn(`cancel:${e.id}`),Z(null);try{await E(e.id,{ownerAgentId:Y||e.metadata?.agentId}),await yr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Qn(null)}},[yr,Y]),Pr=(0,K.useMemo)(()=>(0,J.jsx)(o,{to:`/projects`,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":m.backToProjects,children:(0,J.jsx)(se,{className:`size-4`,"aria-hidden":!0})}),[m.backToProjects]),Fr=(0,K.useMemo)(()=>v?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(C,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Or,children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),m.workItems.create.header]}),(0,J.jsxs)(C,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void Dr(),disabled:Gn,children:[(0,J.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),m.common.newChat]})]}):null,[Or,m.common.newChat,m.workItems.create.header,v,Dr,Gn]);(0,K.useLayoutEffect)(()=>(g({startExtra:Pr,main:v?(0,J.jsx)(Wn,{currentProject:v,pm:m,projectsText:h,wd:f}):(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:m.fallbackTitle}),(0,J.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:m.fallbackContext})]}),end:Fr}),()=>_()),[_,Fr,Pr,m,v,h,g,f]);function Ir(e){b(t=>t?{...t,...e}:null),j(t=>t?{...t,project:{...t.project,...e}}:null),an(e.defaultAgentId??``),ur(t=>({...t,name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``})),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function Lr(){if(!(!v||!Q.name.trim())){ln(!0),Z(null),mn(null);try{Ir(await ut(v.id,{name:Q.name.trim(),status:Q.status,description:Q.description,defaultAgentId:Q.defaultAgentId,brief:Q.brief,instructions:Q.instructions}))}catch(e){let t=Fn(e);t?mn(t):Z(e instanceof Error?e.message:String(e))}finally{ln(!1)}}}function Rr(e){e.preventDefault(),Lr()}let zr=(0,K.useCallback)(()=>{if(!v)return;let e=v.workspaceRoot?.trim()??``;_n(e?`fixed`:`follow`),yn(e||v.effectiveWorkspaceRoot||``),gn(!0)},[v]);async function Br(e={}){if(!v)return;let t=X===`fixed`?vn.trim():``;if(!(X===`fixed`&&!t)){ln(!0),Z(null),mn(null);try{Ir(await ut(v.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}})),gn(!1),mn(null)}catch(e){let t=Fn(e);t?(mn(t),gn(!1)):Z(e instanceof Error?e.message:String(e))}finally{ln(!1)}}}async function Vr(){if(!(!v||Mn)){Nn(`pin`),Z(null);try{Ir(v.pinnedAt?await B(v.id):await P(v.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Nn(null)}}}async function Hr(){if(!(!v||Mn)){Nn(`archive`),Z(null);try{Ir(v.status===`archived`?await ve(v.id):await Qe(v.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Nn(null)}}}async function Ur(){if(v){Bn(!0),Z(null);try{await le(v.id),dn(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Bn(!1)}}}async function Wr(){if(!(!v||bt)){Tt(!0),Z(null);try{await Se(v.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Tt(!1)}}}let Gr=(0,K.useCallback)(e=>{It(e)},[]),Kr=(0,K.useCallback)((e,t)=>{t||It(e)},[]),qr=(0,K.useCallback)(async(e,t,n)=>{let r=v?.id;if(r)switch(e){case`preview`:t.isDirectory||It(t.path);break;case`download`:if(t.isDirectory)return;try{let e=de(t.path);if(Le(ke(e))!==`text`){let n=await dt(t.path,{projectId:r}),i=Oe(e)??`application/octet-stream`;_t(e,await n.arrayBuffer(),i)}else{let{content:n}=await Ye(t.path,{projectId:r});nt(e,n)}}catch(e){gt(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await u(t.absolutePath??t.path)&>(`success`,s.workspace.pathCopied,void 0,{duration:2500})}catch{gt(`warning`,s.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:if(!t.absolutePath||!window.electronAPI?.shell?.openPath)return;await window.electronAPI.shell.openPath(t.absolutePath);break;case`openWith`:if(!t.absolutePath||!window.electronAPI?.shell?.chooseAppAndOpenPath)return;await window.electronAPI.shell.chooseAppAndOpenPath(t.absolutePath);break;case`openWithApp`:if(!t.absolutePath||!n||!window.electronAPI?.shell?.openPathWithApp)return;await window.electronAPI.shell.openPathWithApp(t.absolutePath,n);break;case`revealInFolder`:if(!t.absolutePath||!window.electronAPI?.shell?.showItemInFolder)return;await window.electronAPI.shell.showItemInFolder(t.absolutePath);break;default:break}},[s.clipboard.copyFailed,s.workspace.pathCopied,v?.id]),Jr=(0,K.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),Bt(!0);let r=e.clientX,i=Lt,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=bn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Bt(!1),Rt(c),Sn(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[Lt]);if((0,K.useEffect)(()=>{$!==`files`&&It(null)},[e,$]),on)return(0,J.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:m.loading});if(!v)return(0,J.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(o,{to:`/projects`,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,J.jsx)(se,{className:`size-4`,"aria-hidden":!0}),m.backToProjects]}),(0,J.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:ar||m.notFound})]});let Yr=S?.recentSessions.length?S.recentSessions:v.recentSessions,Xr=S?.attentionItems??[],Zr=e=>m.statuses[e]??e,Qr=e=>Tn(m.common.messages,{count:e}),$r=G.trim().toLowerCase(),ei=$r?I.filter(e=>{let t=En(e.updatedAt),n=e.routing?.agentId||e.agentId||m.common.agent,r=e.name?.trim()||m.sessions.fallbackTitle,i=Qr(e.messageCount??0),a=zn(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes($r)}):I,ti=I.length>0&&ei.length===0,ni=nn.find(e=>e.id===Q.defaultAgentId)?.name||Q.defaultAgentId||m.settings.globalDefaultAgent,ri=nn.find(e=>e.id===Q.defaultAgentId),ii=v.workspaceRoot?.trim()||``,ai=v.status===`archived`,oi=!!v.pinnedAt,si=!ii,ci=ii||ri?.workspace||v.effectiveWorkspaceRoot||m.common.defaultWorkspace,li=X===`fixed`?vn.trim()||m.settings.workspacePlaceholder:ri?.workspace||v.effectiveWorkspaceRoot||m.common.defaultWorkspace,ui=(X===`fixed`?vn.trim():``)!==ii&&(X===`follow`||!!vn.trim()),di=[{id:`overview`,icon:et,label:m.tabs.overview},{id:`work`,icon:Fe,label:m.tabs.work},{id:`files`,icon:ne,label:m.tabs.files},{id:`notes`,icon:U,label:m.tabs.notes},{id:`skills`,icon:st,label:m.tabs.skills},{id:`sessions`,icon:Ee,label:m.tabs.sessions},{id:`activity`,icon:D,label:m.tabs.activity}],fi=[{id:`work-items`,icon:Fe,label:m.tabs.workItems},{id:`goals`,icon:De,label:m.tabs.goals},{id:`workflows`,icon:W,label:m.tabs.workflows},{id:`automations`,icon:re,label:m.tabs.automations}],pi=wn($)?`work`:$;async function mi(){if(!ci)return;let e=await u(ci);gt(e?`success`:`warning`,e?s.workspace.pathCopied:s.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function hi(){mn(null),gn(!0)}return(0,J.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,J.jsx)(Ot,{items:di,activeTab:pi,onChange:e=>fr(e===`work`?`work-items`:e),ariaLabel:m.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,J.jsxs)(C,{id:`project-primary-tab-settings`,type:`button`,variant:$===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":$===`settings`?`page`:void 0,onClick:()=>fr(`settings`),children:[(0,J.jsx)(Be,{className:`size-4`,"aria-hidden":!0}),m.tabs.settings]})]}),ar?(0,J.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:ar}):null,wn($)?(0,J.jsx)(`div`,{className:`mt-3 shrink-0 rounded-xl border border-edge-subtle bg-surface-panel px-2 py-1 shadow-surface`,children:(0,J.jsx)(Ot,{items:fi,activeTab:$,onChange:fr,ariaLabel:m.workNavAria,tabIdPrefix:`project-work-tab`,panelIdPrefix:`project-panel`,buttonClassName:`h-8 px-2.5 py-1.5 text-xs`})}):null,(0,J.jsxs)(`div`,{className:l(`mt-3 min-h-0 flex-1`,$===`work-items`?`-mx-3 -mb-3 overflow-hidden sm:-mx-5 sm:-mb-4 xl:-mx-6`:$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,J.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.overview.directionTitle}),(0,J.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:S?.digest?.summary||S?.recommendedAction||v.description||v.brief||m.overview.directionFallback}),S?.digest?.nextAction?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:Tn(m.overview.recommendedNext,{action:S.digest.nextAction})}):null]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,J.jsxs)(C,{type:`button`,variant:`secondary`,onClick:()=>void Wr(),disabled:bt,children:[(0,J.jsx)(Ct,{className:`size-4`,"aria-hidden":!0}),bt?m.overview.savingDigest:m.overview.saveDigest]})})]})}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.overview.nextActions}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>ir(!0),children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),m.overview.goal]})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:S?.nextActions.length?S.nextActions.map(e=>(0,J.jsxs)(o,{to:mr(e.goalId),onClick:_r(`goals`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,Dn(e.status)),children:Zr(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.nextAction})]},e.goalId)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.overview.noNextActions})})]})]}),(0,J.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.overview.attention}),Xr.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Xr.map(e=>{let t=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(c,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,J.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[m.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Zr(e.status)}`:``]})]});return e.href?(0,J.jsx)(o,{to:e.href,onClick:_r(vr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,J.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:m.overview.noBlockedGoals}),(0,J.jsxs)(`form`,{onSubmit:jr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,J.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:cr.title,onChange:e=>lr(t=>({...t,title:e.target.value})),placeholder:m.overview.blockerTitlePlaceholder}),(0,J.jsx)(C,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:tr||!cr.title.trim(),"aria-label":tr?m.overview.addingBlocker:m.overview.addBlocker,title:tr?m.overview.addingBlocker:m.overview.addBlocker,children:(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(it,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:m.overview.recentSessions})]}),(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>fr(`sessions`),children:m.common.viewAll})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Yr.length?Yr.map(e=>(0,J.jsxs)(o,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:_r(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:En(e.updatedAt)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||m.common.agent})]},e.key)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.overview.noSessions})})]})]})]}):null,$===`work-items`?(0,J.jsx)(`section`,{id:`project-panel-work-items`,className:`flex h-full min-h-0 flex-col`,role:`tabpanel`,"aria-labelledby":`project-work-tab-work-items`,children:(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,J.jsx)(pn,{projectId:v.id,createRequestKey:qn})})}):null,$===`workflows`?(0,J.jsxs)(`section`,{id:`project-panel-workflows`,role:`tabpanel`,"aria-labelledby":`project-work-tab-workflows`,className:`grid h-full min-h-[28rem] gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsx)(`div`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.workflows.runsTitle}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.workflows.runsHint})]}),(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void yr(),disabled:Yn,children:[(0,J.jsx)(St,{className:`size-4`,"aria-hidden":!0}),m.common.refresh]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:Yn&&Me.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.workflows.loadingRuns}):Me.length?Me.map(e=>{let t=e.status===`queued`||e.status===`running`,n=e.status===`failed`||e.status===`timeout`||e.status===`cancelled`;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>gr(`workflows`,vt(e.id,{ownerAgentId:Y||e.metadata?.agentId||v.defaultAgentId})),children:e.title||e.definitionId}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,On(e.status)),children:Zr(e.status)})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:Tn(m.workflows.runMeta,{definitionId:e.definitionId,done:e.metrics.doneAgentCount,total:e.metrics.agentCount,time:En(e.createdAtMs)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>gr(`workflows`,vt(e.id,{ownerAgentId:Y||e.metadata?.agentId||v.defaultAgentId})),children:m.common.open}),n?(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Zn===`retry:${e.id}`,onClick:()=>void Mr(e),children:[(0,J.jsx)(St,{className:`size-3.5`,"aria-hidden":!0}),m.common.retry]}):null,t?(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Zn===`cancel:${e.id}`,onClick:()=>void Nr(e),children:[(0,J.jsx)(ft,{className:`size-3.5`,"aria-hidden":!0}),m.common.cancel]}):null]})]})]},e.id)}):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.workflows.emptyRuns})})]})}),(0,J.jsx)(`aside`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.workflows.startTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:m.workflows.startHint})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,J.jsx)(`div`,{className:`grid gap-2`,children:Te.length?Te.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`grid gap-1 rounded-md bg-surface-base p-3 text-left hover:bg-surface-hover focus:outline-none focus:ring-2 focus:ring-accent/30`,onClick:()=>r(`/workflows/${e.id}?projectId=${encodeURIComponent(v.id)}${Y?`&agentId=${encodeURIComponent(Y)}`:``}`),children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,J.jsx)(W,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}),(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.metadata.whenToUse||e.name})]},e.id)):(0,J.jsx)(`div`,{className:`px-1 py-3 text-sm text-fg-muted`,children:m.workflows.emptyDefinitions})})})]})})]}):null,$===`automations`?(0,J.jsxs)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-work-tab-automations`,className:`grid h-full min-h-[28rem] overflow-hidden gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.automations.title}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.automations.hint})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void br(),disabled:We,children:[(0,J.jsx)(St,{className:`size-4`,"aria-hidden":!0}),m.common.refresh]}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>gr(`automations`,`/automations?projectId=${encodeURIComponent(v.id)}&action=create`),children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),m.common.new]})]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:We&&Ie.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.automations.loading}):Ie.length?Ie.map(e=>{let t=Ve.find(t=>t.automationId===e.id),n=e.state.runningRunId?Ve.find(t=>t.id===e.state.runningRunId):null;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>gr(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?m.automations.enabled:m.automations.paused})]}),(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:Tn(m.common.lastRun,{trigger:e.trigger.kind,action:e.action.kind,time:t?En(t.createdAtMs):m.common.never})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Ke===`run:${e.id}`||!!n,onClick:()=>void Sr(e),children:[(0,J.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),m.automations.run]}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Ke===`toggle:${e.id}`,onClick:()=>void Cr(e),children:[e.enabled?(0,J.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?m.automations.pause:m.automations.resume]})]})]})]},e.id)}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-6 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:m.automations.empty}),(0,J.jsx)(`div`,{children:(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>gr(`automations`,`/automations?projectId=${encodeURIComponent(v.id)}&action=create`),children:[(0,J.jsx)(re,{className:`size-4`,"aria-hidden":!0}),m.automations.create]})})]})})]}),(0,J.jsxs)(`aside`,{className:`grid min-h-0 min-w-0 content-start gap-4 overflow-y-auto pr-1 [scrollbar-gutter:stable]`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.automations.recentRuns})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Ve.length?Ve.slice(0,8).map(e=>(0,J.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.automationName}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,On(e.status)),children:Zr(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:En(e.createdAtMs)})]},e.id)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.automations.emptyRuns})})]}),(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.automations.contextTitle}),(0,J.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:m.automations.contextHint}),(0,J.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:v.workspaceRoot||v.effectiveWorkspaceRoot||m.common.defaultWorkspace})]})]})]}):null,$===`notes`?(0,J.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,J.jsx)(Dt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(v.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,listTag:`project:${v.id}`,captureTags:[`project:${v.id}`,v.slug],listTitle:m.notes.title,listDescription:m.notes.hint,emptyText:m.notes.emptyTitle,emptyDescription:m.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${v.id}`})}):null,$===`skills`?(0,J.jsx)(Ht,{projectId:v.id,copy:m.skills}):null,$===`files`?(0,J.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:v.effectiveWorkspaceRoot?(0,J.jsxs)(`div`,{"data-project-files-grid":!0,className:l(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,zt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Lt}px`},children:[(0,J.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,J.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,J.jsx)(ce,{workspacePath:ci}),(0,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,className:l(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Vt&&`bg-surface-hover text-fg`),onClick:()=>Ut(!0),"aria-label":m.files.search,title:m.files.search,"aria-pressed":Vt,children:(0,J.jsx)(He,{className:`size-3.5`,"aria-hidden":!0})}),(0,J.jsx)(ot,{className:`size-7 shrink-0 rounded-md p-0`,loading:Qt,label:s.cron.refresh,onClick:()=>void wr()})]})]}),Vt?(0,J.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,J.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,J.jsx)(He,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`text`,role:`searchbox`,value:Wt,onChange:e=>Gt(e.target.value),placeholder:m.files.searchPlaceholder,"aria-label":m.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,J.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":m.files.clearSearch,title:m.files.clearSearch,onClick:()=>{Gt(``),Ut(!1)},children:(0,J.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,en?(0,J.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:en}):null,Er?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Jt?(0,J.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,J.jsx)(pt,{className:`h-11 w-full`}),(0,J.jsx)(pt,{className:`h-11 w-full`}),(0,J.jsx)(pt,{className:`h-11 w-full`})]}):Xt?(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[s.workspace.loadError,`: `,Xt]}):Kt.length===0?(0,J.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:m.files.noSearchResults}):Kt.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:l(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,q===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>It(e.path),title:e.path,children:[(0,J.jsx)(U,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Qt&&Nt.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.files.loading}):(0,J.jsx)(Ne,{tree:Nt,selectedPath:q,onSelectFile:Gr,onSelectEntry:Kr,onExpandDir:e=>void Tr(e),onAction:qr,actionLabels:{preview:s.workspace.preview,download:s.workspace.download,copyPath:s.workspace.copyPath,openDefault:s.workspace.openSystemApp,openWith:s.workspace.openWith,revealInFolder:s.workspace.revealInFolder,recommendedApps:s.workspace.recommendedApps},emptyHint:m.files.emptyDirectory})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":m.files.resizeHandle,className:l(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,zt&&`bg-surface-hover`),onPointerDown:Jr,children:(0,J.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:q?(0,J.jsx)(mt,{filePath:q,projectId:v.id,agentId:v.defaultAgentId||Y||void 0,onClose:()=>It(null)}):(0,J.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,J.jsxs)(`div`,{className:`max-w-sm`,children:[(0,J.jsx)(ne,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:m.files.previewEmptyTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.files.previewEmptyDescription})]})})})]}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:m.files.needWorkspace}),(0,J.jsx)(`div`,{children:(0,J.jsx)(C,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>fr(`settings`),children:m.files.openSettings})})]})})}):null,$===`sessions`?(0,J.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[I.length?(0,J.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,J.jsx)(He,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:G,onChange:e=>he(e.currentTarget.value),placeholder:m.sessions.searchPlaceholder,"aria-label":m.sessions.searchPlaceholder,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`}),G?(0,J.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":m.sessions.clearSearch,onClick:()=>he(``),children:(0,J.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,ei.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:ei.map(e=>{let t=En(e.updatedAt),n=e.routing?.agentId||e.agentId||m.common.agent,r=zn(e),i=e.name?.trim()||m.sessions.fallbackTitle,a=Qr(e.messageCount??0);return(0,J.jsxs)(o,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:_r(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,J.jsx)(Ee,{className:`size-4`,"aria-hidden":!0})}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,J.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,J.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[m.sessions.agent,`: `,n]}),(0,J.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,J.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[m.sessions.updated,`: `,t]}):null]})]},e.key)})}):ti?(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:m.sessions.noMatches})}):(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:m.sessions.emptyTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:m.sessions.emptyDescription})]})})]}):null,$===`goals`?(0,J.jsxs)(`section`,{id:`project-panel-goals`,role:`tabpanel`,"aria-labelledby":`project-work-tab-goals`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.goals.title})}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3`,disabled:$n,onClick:()=>ir(!0),children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),m.goals.new]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:be.length?be.map(e=>(0,J.jsxs)(o,{to:mr(e.id),onClick:_r(`goals`),className:`grid gap-1 border-b border-edge px-4 py-3 last:border-b-0 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,Dn(e.status)),children:Zr(e.status)})]}),(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e.nextAction||e.description||m.goals.noNextAction})]},e.id)):(0,J.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:m.goals.empty})})]}):null,$===`activity`?(0,J.jsxs)(`section`,{id:`project-panel-activity`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-activity`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.activity.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Tn(m.activity.count,{count:tt})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:ht,onChange:e=>yt(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),m.activity.includeRelated]}),(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void xr(),disabled:ct,children:[(0,J.jsx)(St,{className:l(`size-4`,ct&&`animate-spin`),"aria-hidden":!0}),m.common.refresh]})]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:ct&&Je.length===0?(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:m.activity.loading}):Je.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Je.map(e=>{let t=m.activity.types[e.type]??e.type,n=m.activity.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Vn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===v.id);return(0,J.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:m.activity.related}):null]}),(0,J.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Ln(e)]})]}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:En(e.createdAt)})]}),r?(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,J.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[m.activity.actor,`: `,In(e)]}),(0,J.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[m.activity.source,`: `,Rn(e)]})]})]},e.id)})}):(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:m.activity.empty})})]}):null,$===`settings`?(0,J.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:Rr,className:`grid min-h-full content-start gap-4`,children:[(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.summaryTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.summaryHint})]}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,Dn(Q.status)),children:m.settings.statuses[Q.status]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-5`,children:[(0,J.jsx)(jn,{label:m.settings.workspaceRoot,value:ci,mono:!0}),(0,J.jsx)(jn,{label:m.settings.defaultAgent,value:ni}),(0,J.jsx)(jn,{label:m.settings.pinState,value:oi?m.settings.pinned:m.settings.notPinned}),(0,J.jsx)(jn,{label:m.settings.createdAt,value:En(v.createdAt)||m.common.never}),(0,J.jsx)(jn,{label:m.settings.updatedAt,value:En(v.updatedAt)||m.common.never})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.detailsTitle})}),(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,J.jsx)(kn,{label:m.settings.name,children:(0,J.jsx)(`input`,{className:An(),value:Q.name,onChange:e=>ur(t=>({...t,name:e.target.value}))})}),(0,J.jsx)(kn,{label:m.settings.defaultAgent,children:(0,J.jsxs)(rt,{className:An(),value:Q.defaultAgentId,onChange:e=>ur(t=>({...t,defaultAgentId:e.target.value})),children:[(0,J.jsx)(Xe,{value:``,children:m.settings.globalDefaultAgent}),nn.map(e=>(0,J.jsx)(Xe,{value:e.id,children:ge(e,s.agentsSettings)},e.id))]})}),(0,J.jsx)(kn,{label:m.settings.status,children:ai?(0,J.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:m.settings.statuses.archived}):(0,J.jsxs)(rt,{className:An(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>ur(t=>({...t,status:e.target.value})),children:[(0,J.jsx)(Xe,{value:`active`,children:m.settings.statuses.active}),(0,J.jsx)(Xe,{value:`paused`,children:m.settings.statuses.paused})]})}),(0,J.jsx)(kn,{label:m.settings.description,hint:m.settings.descriptionHint,children:(0,J.jsx)(`textarea`,{className:An(!0),value:Q.description,onChange:e=>ur(t=>({...t,description:e.target.value}))})})]})]}),(0,J.jsx)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:m.settings.workspaceRoot}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,J.jsx)(`span`,{className:`rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:si?m.settings.workspaceModeFollow:m.settings.workspaceModeFixed})}),(0,J.jsx)(`div`,{className:`mt-2 break-all font-mono text-xs leading-5 text-fg`,title:ci,children:ci})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void mi(),children:[(0,J.jsx)(Ae,{className:`size-4`,"aria-hidden":!0}),m.settings.copyWorkspacePath]}),(0,J.jsx)(ce,{workspacePath:ci}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:zr,children:[(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),m.settings.migrateWorkspace]})]})]}),(0,J.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceMigrationHint})]})]})}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.projectGuidanceTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.projectGuidanceHint})]}),(0,J.jsx)(kn,{label:m.settings.brief,hint:m.settings.briefHint,children:(0,J.jsx)(`textarea`,{className:An(!0),value:Q.brief,onChange:e=>ur(t=>({...t,brief:e.target.value}))})}),(0,J.jsx)(kn,{label:m.settings.instructions,hint:m.settings.instructionsHint,children:(0,J.jsx)(`textarea`,{className:An(!0),value:Q.instructions,onChange:e=>ur(t=>({...t,instructions:e.target.value}))})})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.managementTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.managementHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:oi?m.settings.pinnedTitle:m.settings.pinTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:m.settings.pinHint})]}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:Mn===`pin`,onClick:()=>void Vr(),children:[oi?(0,J.jsx)(ue,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(k,{className:`size-4`,"aria-hidden":!0}),oi?m.settings.unpinProject:m.settings.pinProject]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:ai?m.settings.restoreTitle:m.settings.archiveTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:ai?m.settings.restoreHint:m.settings.archiveHint})]}),(0,J.jsxs)(C,{type:`button`,variant:ai?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:Mn===`archive`,onClick:()=>void Hr(),children:[ai?(0,J.jsx)(St,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(R,{className:`size-4`,"aria-hidden":!0}),ai?m.settings.restoreProject:m.settings.archiveProject]})]})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:m.settings.dangerTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-red-700/80 dark:text-red-200/80`,children:m.settings.dangerHint})]}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>dn(!0),children:[(0,J.jsx)(V,{className:`size-4`,"aria-hidden":!0}),m.settings.deleteConfirmAction]})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge pt-4`,children:(0,J.jsxs)(C,{type:`submit`,variant:`primary`,disabled:cn||!Q.name.trim(),children:[(0,J.jsx)(Ct,{className:`size-4`,"aria-hidden":!0}),m.common.save]})})]}):null]}),(0,J.jsx)(Et,{open:un,onOpenChange:e=>{Pn||dn(e)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,J.jsx)(c,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:m.settings.deleteConfirmTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v?Tn(m.settings.deleteConfirm,{name:v.name}):m.settings.deleteConfirmFallback})]})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Pn,children:m.common.cancel})}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:Pn||!v,onClick:()=>void Ur(),children:[(0,J.jsx)(V,{className:`size-4`,"aria-hidden":!0}),m.settings.deleteConfirmAction]})]})]})]})}),(0,J.jsx)(Et,{open:hn,onOpenChange:e=>{cn||gn(e)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:m.settings.workspaceMigrationTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.workspaceMigrationDescription})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:m.settings.workspaceMode}),(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:l(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,X===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:X===`fixed`,onChange:()=>_n(`fixed`),disabled:cn}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:m.settings.workspaceModeFixed}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceMigrationFixedHint})]})]}),(0,J.jsxs)(`label`,{className:l(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,X===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:X===`follow`,onChange:()=>_n(`follow`),disabled:cn}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:m.settings.workspaceModeFollow}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceHint})]})]})]})]}),X===`fixed`?(0,J.jsx)(kt,{value:vn,onChange:yn,disabled:cn,wd:f,placeholder:m.settings.workspacePlaceholder,inputClassName:An(),autoFocus:!0}):null,(0,J.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:m.settings.workspaceMigrationImpact}),(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:Tn(m.settings.workspaceCurrent,{workspace:li})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:cn,children:m.common.cancel})}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:cn||!ui,onClick:()=>void Br(),children:[(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),m.settings.workspaceMigrationConfirm]})]})]})]})}),(0,J.jsx)(Et,{open:!!fn,onOpenChange:e=>{e||mn(null)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:m.settings.workspaceMissingTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:fn?Tn(m.settings.workspaceMissingDescription,{workspace:fn}):null})]}),fn?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(ne,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:fn})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:hi,disabled:cn,children:m.settings.workspaceMissingBack}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Br({createWorkspaceRoot:!0}),disabled:cn,children:[(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),m.settings.workspaceMissingCreate]})]})]})]})}),(0,J.jsx)(Mt,{open:rr,t:s.goalsPage,chat:s.chat,busy:$n,options:or,onClose:()=>!$n&&ir(!1),onCreate:Ar})]})}export{Gn as ProjectDetailPage};
|
|
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,l as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./circle-alert-BEjgurr2.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./copy-to-clipboard-HOJ79TWv.js";import{t as d}from"./messages-DP6tPKk-.js";import{l as f,n as p,o as m,r as h,s as g}from"./locale-store-CTwSy7yW.js";import{$i as _,$s as v,A as y,Aa as b,Ac as x,Al as S,As as C,Ba as w,Bo as T,C as E,Cl as D,F as O,Fc as k,Ga as A,Gl as j,Go as M,Gr as N,Ha as P,Ho as F,Hs as I,Ia as L,Iu as R,Jl as z,Ka as B,Ks as V,La as H,Ll as U,M as ee,Ma as te,Mc as W,Ml as ne,Ms as re,Na as ie,Nl as ae,Ns as oe,Nu as se,Oi as ce,Ot as G,Pa as le,Pc as ue,Qi as de,Qn as fe,Ra as pe,Rc as me,Rl as he,Rr as ge,To as _e,Ua as ve,Uo as ye,Va as be,Vo as xe,Wa as Se,Wl as Ce,Wo as we,Xa as Te,Xc as Ee,Xs as De,Za as Oe,Zi as ke,Zl as Ae,_u as je,a as Me,aa as Ne,c as Pe,cl as Fe,d as Ie,ea as Le,eo as Re,f as ze,fc as Be,fs as Ve,gc as He,gs as Ue,gu as We,h as Ge,hs as Ke,hu as qe,i as Je,ia as Ye,is as Xe,ja as Ze,ka as Qe,m as $e,ml as et,ms as tt,na as nt,ns as rt,nu as it,o as at,oa as ot,oc as st,ps as ct,pu as lt,qa as ut,ra as dt,rc as ft,ro as pt,rr as mt,s as ht,sa as gt,ta as _t,tt as vt,u as yt,vt as bt,x as xt,xc as St,yc as Ct,za as wt,zc as Tt,zo as Et}from"./index-C0CGebQ1.js";import{t as Dt}from"./notes-workbench-DSh3-hMY.js";import{t as Ot}from"./page-tabs-ke9s4nYi.js";import{t as kt}from"./directory-picker-path-field-BYQJ2XUS.js";import{t as At}from"./goals-config-api-Fwu1wjEP.js";import{n as jt,t as Mt}from"./goal-create-dialog-BRhmmBe9.js";import{f as Nt,o as Pt,r as Ft}from"./skills-page.utils-kahBIHg0.js";var K=e(t(),1),q=n();function It(e){return g(h(`/api/projects/${encodeURIComponent(e)}/skills`))}function Lt(e,t){return g(h(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Rt(e,t){let n=new FormData;return n.set(`file`,t),g(h(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function zt(e,t,n={}){return g(h(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Bt(e,t){return g(h(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Vt(e,t){return g(h(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var J=r();function Ht({projectId:e,copy:t}){let[n,r]=(0,K.useState)([]),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(!0),[c,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(``),[p,m]=(0,K.useState)(null),[h,g]=(0,K.useState)(null),[_,y]=(0,K.useState)(``),[b,w]=(0,K.useState)(1),[E,D]=(0,K.useState)(null),[O,k]=(0,K.useState)(!1),[A,j]=(0,K.useState)(``),[N,P]=(0,K.useState)(``),F=(0,K.useRef)(null),L=(0,K.useCallback)(async()=>{s(!0),f(``);try{let t=await It(e);r(t.items),a(t.skillsRoot)}catch(e){f(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e]);(0,K.useEffect)(()=>{L()},[L]),(0,K.useEffect)(()=>{if(p!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{k(!0),j(``),Nt({q:_,page:b,pageSize:8,sort:`downloads`,signal:e.signal}).then(D).catch(t=>{e.signal.aborted||j(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||k(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[p,b,_]);async function B(e){u(!0),f(``);try{await e(),m(null),P(``),await L()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}async function H(t){f(``);try{g((await Lt(e,t)).skill)}catch(e){f(e instanceof Error?e.message:String(e))}}async function U(n){if(window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){u(!0);try{await Vt(e,n.id),await L()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}}return(0,J.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,J.jsxs)(Ke,{children:[(0,J.jsx)(Ue,{asChild:!0,children:(0,J.jsxs)(C,{type:`button`,children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),t.add,(0,J.jsx)(je,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,J.jsx)(tt,{children:(0,J.jsxs)(ct,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,J.jsx)(Ut,{icon:v,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>m(`marketplace`)}),(0,J.jsx)(Ut,{icon:S,title:t.source,hint:t.sourceHint,onClick:()=>m(`source`)}),(0,J.jsx)(Ut,{icon:I,title:t.upload,hint:t.uploadHint,onClick:()=>F.current?.click()})]})})]}),(0,J.jsx)(`input`,{ref:F,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&B(()=>Rt(e,n)),t.target.value=``}})]}),i?(0,J.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs text-fg-subtle`,children:[t.path,`: `,i]}):null]}),d?(0,J.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:d}):null,o?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,J.jsx)(pt,{className:`h-36 rounded-lg`},e))}):n.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:n.map(e=>(0,J.jsxs)(`article`,{className:`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(R,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,J.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.id}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void H(e.id),children:[(0,J.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0}),t.view]}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:c,onClick:()=>void U(e),children:[(0,J.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}),t.remove]})]})]},e.id))}):(0,J.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),(0,J.jsx)(Et,{open:p!==null,onOpenChange:e=>{e||m(null)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-50 bg-black/45`}),(0,J.jsxs)(xe,{className:l(`fixed left-1/2 top-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,p===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:p===`marketplace`?t.marketplace:t.source}),(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,J.jsx)(oe,{className:`size-4`})})})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:p===`marketplace`?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,J.jsxs)(`div`,{className:`relative mt-3`,children:[(0,J.jsx)(He,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:_,onChange:e=>{y(e.target.value),w(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),A?(0,J.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:A}):null,O&&!E?(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,J.jsx)(pt,{className:`h-32 rounded-lg`},e))}):E?.items.length?(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:E.items.map(r=>{let i=r.providerId??E.provider,a=Ft(r,i),o=n.some(e=>e.id===r.id||e.id===a||e.name===r.name);return(0,J.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,J.jsx)(Pt,{name:r.name,className:`size-10`}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,J.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,J.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,J.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,J.jsx)(C,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:c||o,onClick:()=>void B(()=>zt(e,a,{provider:i})),children:o?t.marketplaceInstalled:c?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):O?null:(0,J.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),E&&E.meta.totalPages>1?(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(E.meta.page)).replace(`{{total}}`,String(E.meta.totalPages))}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:O||b<=1,onClick:()=>w(e=>Math.max(1,e-1)),children:[(0,J.jsx)(We,{className:`size-4`}),t.marketplacePrevious]}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:O||b>=E.meta.totalPages,onClick:()=>w(e=>e+1),children:[t.marketplaceNext,(0,J.jsx)(qe,{className:`size-4`})]})]})]}):null]}):(0,J.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,J.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:N,onChange:e=>P(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,J.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`secondary`,children:t.close})}),(0,J.jsx)(C,{type:`button`,disabled:c||!N.trim(),onClick:()=>void B(()=>Bt(e,N.trim())),children:c?t.installing:t.install})]})]})})]})]})}),(0,J.jsx)(Et,{open:!!h,onOpenChange:e=>{e||g(null)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-50 bg-black/45`}),(0,J.jsxs)(xe,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:h?.name}),(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,J.jsx)(oe,{className:`size-4`})})})]}),(0,J.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:h?.bodyMarkdown})]})]})})]})}function Ut(e){let t=(0,q.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,J.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,J.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,J.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,J.jsx)(Ve,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}var Wt=`application/x-xopc-work-item`,Gt=[`backlog`,`todo`,`in_progress`,`blocked`,`needs_input`,`in_review`,`done`],Kt=[`low`,`normal`,`high`,`urgent`];function qt(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function Jt(e){return e?bt(new Date(e)):``}function Yt(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function Xt(e){return`${e.name}:${e.size}:${e.lastModified}`}function Zt(e,t){return ke(e,t)!==`unsupported`}function Qt(e,t){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:t===`image`||t===`audio`||t===`video`?t:`document`}function $t(e,t){return{id:e.id,name:e.fileName,type:Qt(e.mimeType,e.type),mimeType:e.mimeType,size:e.size,...t?{content:t,preview:e.mimeType.startsWith(`image/`)?t:void 0}:{}}}async function en(e,t){let n=_(e.name||`upload`,e.type||`application/octet-stream`),r=Te(await e.arrayBuffer());return{id:t,name:e.name||`upload`,type:Qt(n),mimeType:n,size:e.size,content:r,preview:n.startsWith(`image/`)?r:void 0}}function tn(e){let t=(0,q.c)(3),[n,r]=(0,K.useState)(``),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(``);return}let t=URL.createObjectURL(e);return r(t),()=>URL.revokeObjectURL(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,K.useEffect)(i,a),n}function nn(e,t){let n=(0,q.c)(5),[r,i]=(0,K.useState)(``),a,o;return n[0]!==t.id||n[1]!==t.mimeType||n[2]!==e?(a=()=>{if(!e||!t.mimeType.startsWith(`image/`)){i(``);return}let n=!1,r=``;return(async()=>{let a=await m(Ge(e,t.id));if(!a.ok||n)return;let o=await a.blob();n||(r=URL.createObjectURL(o),i(r))})().catch(()=>{n||i(``)}),()=>{n=!0,r&&URL.revokeObjectURL(r)}},o=[t.id,t.mimeType,e],n[0]=t.id,n[1]=t.mimeType,n[2]=e,n[3]=a,n[4]=o):(a=n[3],o=n[4]),(0,K.useEffect)(a,o),r}function rn(e){let t=(0,q.c)(11),{name:n,mimeType:r,thumbnailUrl:i,previewable:a,disabled:o,onOpen:s}=e,c;t[0]===r?c=t[1]:(c=r.startsWith(`image/`),t[0]=r,t[1]=c);let l=c,u;t[2]!==l||t[3]!==n||t[4]!==i?(u=l&&i?(0,J.jsx)(`img`,{src:i,alt:n,className:`size-10 rounded-md object-cover`}):(0,J.jsx)(`span`,{className:`inline-flex size-10 items-center justify-center rounded-md border border-edge bg-surface-muted`,children:(0,J.jsx)(he,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),t[2]=l,t[3]=n,t[4]=i,t[5]=u):u=t[5];let d=u;if(!a)return d;let f;return t[6]!==d||t[7]!==o||t[8]!==n||t[9]!==s?(f=(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel disabled:cursor-wait disabled:opacity-70`,title:n,"aria-label":n,disabled:o,onClick:s,children:d}),t[6]=d,t[7]=o,t[8]=n,t[9]=s,t[10]=f):f=t[10],f}function Y(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:`#`}function an(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}function on(e,t){return e.nextAction||e.blockedReason||e.description||t.noNextAction}function sn(e){let t=(0,q.c)(63),{item:n,dragging:r,onOpen:i,onToggleDone:a,onDragStart:s,onDragEnd:c,t:u}=e,d=n.status===`done`,f;t[0]!==n||t[1]!==s?(f=e=>s(n,e),t[0]=n,t[1]=s,t[2]=f):f=t[2];let p=u.dragToUpdate,m=r&&`opacity-50`,h;t[3]===m?h=t[4]:(h=l(`flex min-h-24 w-full min-w-0 max-w-full cursor-grab flex-col overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors hover:bg-surface-hover active:cursor-grabbing`,m),t[3]=m,t[4]=h);let g=d?`border-success bg-success text-white`:`border-edge bg-surface-base hover:border-accent/50`,_;t[5]===g?_=t[6]:(_=l(`mt-0.5 inline-flex size-3.5 shrink-0 items-center justify-center rounded border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,g),t[5]=g,t[6]=_);let v=d?u.markTodo:u.markDone,y=d?u.markTodo:u.markDone,b;t[7]!==n||t[8]!==a?(b=()=>a(n),t[7]=n,t[8]=a,t[9]=b):b=t[9];let x;t[10]===d?x=t[11]:(x=d?(0,J.jsx)(lt,{className:`size-3`,"aria-hidden":!0}):null,t[10]=d,t[11]=x);let S;t[12]!==x||t[13]!==_||t[14]!==v||t[15]!==y||t[16]!==b?(S=(0,J.jsx)(`button`,{type:`button`,className:_,"aria-label":v,title:y,onClick:b,children:x}),t[12]=x,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=S):S=t[17];let C;t[18]!==n||t[19]!==i?(C=()=>i(n),t[18]=n,t[19]=i,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=(0,J.jsx)(`h4`,{className:`min-w-0 flex-1 basis-0 text-sm font-medium leading-5 text-fg line-clamp-2`,children:n.title}),t[21]=n.title,t[22]=w);let T;t[23]!==n||t[24]!==u?(T=on(n,u),t[23]=n,t[24]=u,t[25]=T):T=t[25];let E;t[26]===T?E=t[27]:(E=(0,J.jsx)(`p`,{className:`mt-2 max-w-full break-words text-xs leading-5 text-fg-muted line-clamp-1`,children:T}),t[26]=T,t[27]=E);let D;t[28]!==C||t[29]!==w||t[30]!==E?(D=(0,J.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:C,children:[w,E]}),t[28]=C,t[29]=w,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==S||t[33]!==D?(O=(0,J.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-start gap-2`,children:[S,D]}),t[32]=S,t[33]=D,t[34]=O):O=t[34];let k;t[35]===n.status?k=t[36]:(k=l(`rounded-full px-2 py-0.5 text-[11px] font-medium`,qt(n.status)),t[35]=n.status,t[36]=k);let A=u.statuses[n.status],j;t[37]!==k||t[38]!==A?(j=(0,J.jsx)(`span`,{className:k,children:A}),t[37]=k,t[38]=A,t[39]=j):j=t[39];let M=u.priorities[n.priority],N;t[40]===M?N=t[41]:(N=(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:M}),t[40]=M,t[41]=N);let P;t[42]===n.attachments?P=t[43]:(P=n.attachments?.length?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:[(0,J.jsx)(Tt,{className:`size-3`,"aria-hidden":!0}),n.attachments.length]}):null,t[42]=n.attachments,t[43]=P);let F;t[44]===n.links?F=t[45]:(F=n.links?.length?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:n.links.length}):null,t[44]=n.links,t[45]=F);let I=`/work-items/${encodeURIComponent(n.id)}`,L;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,J.jsx)(Ce,{className:`size-3`,"aria-hidden":!0}),t[46]=L):L=t[46];let R;t[47]!==u.detail.openItem||t[48]!==I?(R=(0,J.jsxs)(o,{to:I,className:`ml-auto inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium text-accent hover:bg-accent-soft hover:text-accent-fg`,children:[u.detail.openItem,L]}),t[47]=u.detail.openItem,t[48]=I,t[49]=R):R=t[49];let z;t[50]!==j||t[51]!==N||t[52]!==P||t[53]!==F||t[54]!==R?(z=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[j,N,P,F,R]}),t[50]=j,t[51]=N,t[52]=P,t[53]=F,t[54]=R,t[55]=z):z=t[55];let B;return t[56]!==c||t[57]!==u.dragToUpdate||t[58]!==f||t[59]!==O||t[60]!==z||t[61]!==h?(B=(0,J.jsxs)(`article`,{draggable:!0,onDragStart:f,onDragEnd:c,title:p,className:h,children:[O,z]}),t[56]=c,t[57]=u.dragToUpdate,t[58]=f,t[59]=O,t[60]=z,t[61]=h,t[62]=B):B=t[62],B}function cn(){let e=(0,q.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`size-3.5 shrink-0 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-3 w-36 rounded bg-surface-muted`})]}),n=(0,J.jsx)(`div`,{className:`mt-3 h-3 w-48 rounded bg-surface-muted`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsxs)(`article`,{className:`flex h-24 w-full min-w-0 max-w-full flex-col overflow-hidden rounded-lg bg-surface-panel px-3 pt-3 pb-0 shadow-surface`,children:[t,n,(0,J.jsxs)(`div`,{className:`mt-3 flex gap-1.5`,children:[(0,J.jsx)(`div`,{className:`h-5 w-16 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-5 w-10 rounded-full bg-surface-muted`})]})]}),e[2]=r):r=e[2],r}function ln(e){let t=(0,q.c)(44),{file:n,index:r,busy:i,previewBusy:a,t:o,onOpen:s,onRemove:c}=e,u,d,f,p;t[0]===n?(u=t[1],d=t[2],f=t[3],p=t[4]):(u=_(n.name||`upload`,n.type||`application/octet-stream`),d=Zt(n.name||`upload`,u),f=tn,p=u.startsWith(`image/`)?n:null,t[0]=n,t[1]=u,t[2]=d,t[3]=f,t[4]=p);let m=f(p),h=n.name||`upload`,g=i||a,v;t[5]!==n||t[6]!==s?(v=()=>s(n),t[5]=n,t[6]=s,t[7]=v):v=t[7];let y;t[8]!==u||t[9]!==d||t[10]!==h||t[11]!==g||t[12]!==v||t[13]!==m?(y=(0,J.jsx)(rn,{name:h,mimeType:u,thumbnailUrl:m,previewable:d,disabled:g,onOpen:v}),t[8]=u,t[9]=d,t[10]=h,t[11]=g,t[12]=v,t[13]=m,t[14]=y):y=t[14];let b=d?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,x;t[15]===b?x=t[16]:(x=l(`min-w-0 flex-1 text-left`,b),t[15]=b,t[16]=x);let S=!d||i||a,C;t[17]!==n||t[18]!==s?(C=()=>s(n),t[17]=n,t[18]=s,t[19]=C):C=t[19];let w=n.name||`upload`,T;t[20]===w?T=t[21]:(T=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:w}),t[20]=w,t[21]=T);let E;t[22]===n.size?E=t[23]:(E=Yt(n.size),t[22]=n.size,t[23]=E);let D;t[24]===E?D=t[25]:(D=(0,J.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:E}),t[24]=E,t[25]=D);let O;t[26]!==C||t[27]!==T||t[28]!==D||t[29]!==x||t[30]!==S?(O=(0,J.jsxs)(`button`,{type:`button`,className:x,disabled:S,onClick:C,children:[T,D]}),t[26]=C,t[27]=T,t[28]=D,t[29]=x,t[30]=S,t[31]=O):O=t[31];let k;t[32]!==r||t[33]!==c?(k=()=>c(r),t[32]=r,t[33]=c,t[34]=k):k=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),t[35]=A):A=t[35];let j;t[36]!==i||t[37]!==o.attachments.remove||t[38]!==k?(j=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:o.attachments.remove,"aria-label":o.attachments.remove,disabled:i,onClick:k,children:A}),t[36]=i,t[37]=o.attachments.remove,t[38]=k,t[39]=j):j=t[39];let M;return t[40]!==O||t[41]!==j||t[42]!==y?(M=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel p-2 text-sm`,children:[y,O,j]}),t[40]=O,t[41]=j,t[42]=y,t[43]=M):M=t[43],M}function un(e){let t=(0,q.c)(56),{item:n,attachment:r,busy:i,previewBusy:a,t:o,onOpen:s,onDownload:c,onRemove:u}=e,d;t[0]!==r.fileName||t[1]!==r.mimeType?(d=Zt(r.fileName,r.mimeType),t[0]=r.fileName,t[1]=r.mimeType,t[2]=d):d=t[2];let f=d,p=nn(n.id,r),m=i||a,h;t[3]!==r||t[4]!==n||t[5]!==s?(h=()=>s(n,r),t[3]=r,t[4]=n,t[5]=s,t[6]=h):h=t[6];let g;t[7]!==r.fileName||t[8]!==r.mimeType||t[9]!==f||t[10]!==m||t[11]!==h||t[12]!==p?(g=(0,J.jsx)(rn,{name:r.fileName,mimeType:r.mimeType,thumbnailUrl:p,previewable:f,disabled:m,onOpen:h}),t[7]=r.fileName,t[8]=r.mimeType,t[9]=f,t[10]=m,t[11]=h,t[12]=p,t[13]=g):g=t[13];let _=f?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,v;t[14]===_?v=t[15]:(v=l(`min-w-0 flex-1 text-left`,_),t[14]=_,t[15]=v);let y=!f||i||a,b;t[16]!==r||t[17]!==n||t[18]!==s?(b=()=>s(n,r),t[16]=r,t[17]=n,t[18]=s,t[19]=b):b=t[19];let x;t[20]===r.fileName?x=t[21]:(x=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:r.fileName}),t[20]=r.fileName,t[21]=x);let S=r.mimeType,C;t[22]===r.size?C=t[23]:(C=Yt(r.size),t[22]=r.size,t[23]=C);let w;t[24]!==r.mimeType||t[25]!==C?(w=(0,J.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[S,` · `,C]}),t[24]=r.mimeType,t[25]=C,t[26]=w):w=t[26];let T;t[27]!==w||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==x?(T=(0,J.jsxs)(`button`,{type:`button`,className:v,disabled:y,onClick:b,children:[x,w]}),t[27]=w,t[28]=v,t[29]=y,t[30]=b,t[31]=x,t[32]=T):T=t[32];let E;t[33]!==r||t[34]!==n||t[35]!==c?(E=()=>c(n,r),t[33]=r,t[34]=n,t[35]=c,t[36]=E):E=t[36];let D;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,J.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),t[37]=D):D=t[37];let O;t[38]!==i||t[39]!==o.attachments.download||t[40]!==E?(O=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:o.attachments.download,"aria-label":o.attachments.download,disabled:i,onClick:E,children:D}),t[38]=i,t[39]=o.attachments.download,t[40]=E,t[41]=O):O=t[41];let k;t[42]!==r||t[43]!==n||t[44]!==u?(k=()=>u(n,r),t[42]=r,t[43]=n,t[44]=u,t[45]=k):k=t[45];let A;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}),t[46]=A):A=t[46];let j;t[47]!==i||t[48]!==o.attachments.remove||t[49]!==k?(j=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:o.attachments.remove,"aria-label":o.attachments.remove,disabled:i,onClick:k,children:A}),t[47]=i,t[48]=o.attachments.remove,t[49]=k,t[50]=j):j=t[50];let M;return t[51]!==T||t[52]!==O||t[53]!==j||t[54]!==g?(M=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel p-2 text-sm`,children:[g,T,O,j]}),t[51]=T,t[52]=O,t[53]=j,t[54]=g,t[55]=M):M=t[55],M}function dn({mode:e,item:t,pendingFiles:n,busy:r,t:i,onPendingFilesChange:a,onUpload:o,onRemove:s,onDownload:c,onPreviewError:u}){let d=(0,K.useRef)(null),[p,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(!1),[v,y]=(0,K.useState)(null),[b,S]=(0,K.useState)(null),w=f(e=>e.token),T=t?.attachments??[];function E(r){if(!r.length)return;if(e===`detail`&&t){o(t,r);return}let i=new Set(n.map(Xt)),s=[...n];for(let e of r){let t=Xt(e);i.has(t)||(i.add(t),s.push(e))}a(s)}function D(e){a(n.filter((t,n)=>n!==e))}async function O(e){let t=Xt(e);S(`pending:${t}`);try{y(await en(e,`pending:${t}`)),_(!0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{S(null)}}async function k(e,t){S(`saved:${t.id}`);try{let n=await m(Ge(e.id,t.id));if(!n.ok)throw Error(`HTTP ${n.status}`);y($t(t,Te(await n.arrayBuffer()))),_(!0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{S(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:l(`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,p&&`border-accent bg-accent-soft/40`),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||h(!1)},onDrop:e=>{e.preventDefault(),h(!1),E(Array.from(e.dataTransfer.files))},children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`h3`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,J.jsx)(Tt,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate`,children:i.attachments.title})]}),(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:r,onClick:()=>d.current?.click(),children:[(0,J.jsx)(x,{className:`size-3.5`,"aria-hidden":!0}),i.attachments.add]}),(0,J.jsx)(`input`,{ref:d,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{E(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),n.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:n.map((e,t)=>(0,J.jsx)(ln,{file:e,index:t,busy:r,previewBusy:b===`pending:${Xt(e)}`,t:i,onOpen:e=>void O(e),onRemove:D},Xt(e)))}):null,t&&T.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:T.map(e=>(0,J.jsx)(un,{item:t,attachment:e,busy:r,previewBusy:b===`saved:${e.id}`,t:i,onOpen:(e,t)=>void k(e,t),onDownload:c,onRemove:s},e.id))}):null,!n.length&&!T.length?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i.attachments.empty}):null]}),(0,J.jsx)(G,{open:g,attachment:v,authToken:w,layerClassName:`z-[100]`,onClose:()=>{_(!1),y(null)}})]})}function fn(e){let t=(0,q.c)(169),{mode:n,item:r,initialStatus:i,events:a,busy:s,error:c,notice:u,t:d,onClose:f,onCreate:p,onSave:m,onStartChat:h,onCreateGoal:g,onAddAttachments:_,onRemoveAttachment:v,onDownloadAttachment:y,onPreviewError:b}=e,S=n!==null,[w,E]=(0,K.useState)(``),[D,O]=(0,K.useState)(``),[k,A]=(0,K.useState)(`todo`),[j,N]=(0,K.useState)(`normal`),[P,I]=(0,K.useState)(``),[L,R]=(0,K.useState)(``),z;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(z=[],t[0]=z):z=t[0];let[B,V]=(0,K.useState)(z),H,U;t[1]!==i||t[2]!==r||t[3]!==n?(H=()=>{if(n===`create`){E(``),O(``),A(i),N(`normal`),I(``),R(``),V([]);return}n===`detail`&&r&&(E(r.title),O(r.description??``),A(r.status),N(r.priority),I(r.nextAction??``),R(r.blockedReason??``),V([]))},U=[i,r,n],t[1]=i,t[2]=r,t[3]=n,t[4]=H,t[5]=U):(H=t[4],U=t[5]),(0,K.useEffect)(H,U);let ee;t[6]!==L||t[7]!==D||t[8]!==r||t[9]!==n||t[10]!==P||t[11]!==p||t[12]!==m||t[13]!==B||t[14]!==j||t[15]!==k||t[16]!==w?(ee=function(e){e.preventDefault();let t=w.trim();if(t){if(n===`create`){p({title:t,description:D.trim()||void 0,priority:j,status:k,nextAction:P.trim()||void 0,blockedReason:L.trim()||void 0,attachments:B});return}r&&m(r,{title:t,description:D.trim()||null,status:k,priority:j,nextAction:P.trim()||null,blockedReason:L.trim()||null})}},t[6]=L,t[7]=D,t[8]=r,t[9]=n,t[10]=P,t[11]=p,t[12]=m,t[13]=B,t[14]=j,t[15]=k,t[16]=w,t[17]=ee):ee=t[17];let te=ee,W;t[18]===f?W=t[19]:(W=e=>!e&&f(),t[18]=f,t[19]=W);let ne;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[20]=ne):ne=t[20];let re=n===`create`?d.create.title:r?.title||d.title,ie;t[21]===re?ie=t[22]:(ie=(0,J.jsx)(M,{className:`truncate text-base font-semibold text-fg`,children:re}),t[21]=re,t[22]=ie);let ae;t[23]===d.detail.description?ae=t[24]:(ae=(0,J.jsx)(F,{className:`mt-1 text-sm text-fg-muted`,children:d.detail.description}),t[23]=d.detail.description,t[24]=ae);let se;t[25]!==ie||t[26]!==ae?(se=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[ie,ae]}),t[25]=ie,t[26]=ae,t[27]=se):se=t[27];let ce;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,J.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),t[28]=ce):ce=t[28];let G;t[29]===s?G=t[30]:(G=(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,disabled:s,children:ce})}),t[29]=s,t[30]=G);let le;t[31]!==se||t[32]!==G?(le=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[se,G]}),t[31]=se,t[32]=G,t[33]=le):le=t[33];let ue;t[34]===c?ue=t[35]:(ue=c?(0,J.jsx)(`div`,{className:`rounded-lg border border-danger/30 bg-danger-soft px-3 py-2 text-sm text-danger`,children:c}):null,t[34]=c,t[35]=ue);let de;t[36]!==c||t[37]!==u?(de=!c&&u?(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-success/30 bg-success-soft px-3 py-2 text-sm text-fg`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(lt,{className:`mt-0.5 size-4 shrink-0 text-success`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`font-medium text-success`,children:u.title}),(0,J.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:u.message})]})]}):null,t[36]=c,t[37]=u,t[38]=de):de=t[38];let fe;t[39]===d.create.titleLabel?fe=t[40]:(fe=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.titleLabel}),t[39]=d.create.titleLabel,t[40]=fe);let pe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(pe=e=>E(e.target.value),t[41]=pe):pe=t[41];let me;t[42]===w?me=t[43]:(me=(0,J.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:w,onChange:pe}),t[42]=w,t[43]=me);let he;t[44]!==fe||t[45]!==me?(he=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[fe,me]}),t[44]=fe,t[45]=me,t[46]=he):he=t[46];let ge;t[47]===d.detail.status?ge=t[48]:(ge=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.detail.status}),t[47]=d.detail.status,t[48]=ge);let _e;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>A(e.target.value),t[49]=_e):_e=t[49];let ve;t[50]===d.statuses?ve=t[51]:(ve=Gt.map(e=>(0,J.jsx)(Xe,{value:e,children:d.statuses[e]},e)),t[50]=d.statuses,t[51]=ve);let be;t[52]!==k||t[53]!==ve?(be=(0,J.jsx)(rt,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:k,onChange:_e,children:ve}),t[52]=k,t[53]=ve,t[54]=be):be=t[54];let Se;t[55]!==ge||t[56]!==be?(Se=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[ge,be]}),t[55]=ge,t[56]=be,t[57]=Se):Se=t[57];let Te;t[58]===d.create.priorityLabel?Te=t[59]:(Te=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.priorityLabel}),t[58]=d.create.priorityLabel,t[59]=Te);let Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=e=>N(e.target.value),t[60]=Oe):Oe=t[60];let ke;t[61]===d.priorities?ke=t[62]:(ke=Kt.map(e=>(0,J.jsx)(Xe,{value:e,children:d.priorities[e]},e)),t[61]=d.priorities,t[62]=ke);let Ae;t[63]!==j||t[64]!==ke?(Ae=(0,J.jsx)(rt,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:j,onChange:Oe,children:ke}),t[63]=j,t[64]=ke,t[65]=Ae):Ae=t[65];let je;t[66]!==Te||t[67]!==Ae?(je=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Te,Ae]}),t[66]=Te,t[67]=Ae,t[68]=je):je=t[68];let Me;t[69]!==Se||t[70]!==je?(Me=(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Se,je]}),t[69]=Se,t[70]=je,t[71]=Me):Me=t[71];let Ne;t[72]===d.create.descriptionLabel?Ne=t[73]:(Ne=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.descriptionLabel}),t[72]=d.create.descriptionLabel,t[73]=Ne);let Pe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=e=>O(e.target.value),t[74]=Pe):Pe=t[74];let Fe;t[75]===D?Fe=t[76]:(Fe=(0,J.jsx)(`textarea`,{className:`min-h-28 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:D,onChange:Pe}),t[75]=D,t[76]=Fe);let Ie;t[77]!==Ne||t[78]!==Fe?(Ie=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ne,Fe]}),t[77]=Ne,t[78]=Fe,t[79]=Ie):Ie=t[79];let Le;t[80]!==s||t[81]!==r||t[82]!==n||t[83]!==_||t[84]!==y||t[85]!==b||t[86]!==v||t[87]!==B||t[88]!==d?(Le=(0,J.jsx)(dn,{mode:n,item:r,pendingFiles:B,busy:s,t:d,onPendingFilesChange:V,onUpload:_,onRemove:v,onDownload:y,onPreviewError:b}),t[80]=s,t[81]=r,t[82]=n,t[83]=_,t[84]=y,t[85]=b,t[86]=v,t[87]=B,t[88]=d,t[89]=Le):Le=t[89];let Re;t[90]!==L||t[91]!==n||t[92]!==P||t[93]!==k||t[94]!==d.blockedReason||t[95]!==d.nextAction?(Re=n===`detail`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.nextAction}),(0,J.jsx)(`textarea`,{className:`min-h-20 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:P,onChange:e=>I(e.target.value)})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:l(`font-medium`,k===`blocked`||k===`needs_input`?`text-red-700 dark:text-red-300`:`text-fg-muted`),children:d.blockedReason}),(0,J.jsx)(`textarea`,{className:l(`min-h-20 rounded-lg border bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,k===`blocked`||k===`needs_input`?`border-red-500/40`:`border-edge`),value:L,onChange:e=>R(e.target.value)})]})]}):null,t[90]=L,t[91]=n,t[92]=P,t[93]=k,t[94]=d.blockedReason,t[95]=d.nextAction,t[96]=Re):Re=t[96];let ze;t[97]!==ue||t[98]!==de||t[99]!==he||t[100]!==Me||t[101]!==Ie||t[102]!==Le||t[103]!==Re?(ze=(0,J.jsxs)(`div`,{className:`grid content-start gap-4`,children:[ue,de,he,Me,Ie,Le,Re]}),t[97]=ue,t[98]=de,t[99]=he,t[100]=Me,t[101]=Ie,t[102]=Le,t[103]=Re,t[104]=ze):ze=t[104];let Be;t[105]!==s||t[106]!==r||t[107]!==n||t[108]!==g||t[109]!==h||t[110]!==d.detail.actions||t[111]!==d.detail.createGoal||t[112]!==d.detail.openItem||t[113]!==d.detail.startChat?(Be=n===`detail`&&r?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.actions}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>h(r),children:[(0,J.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),d.detail.startChat]}),(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>g(r),children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),d.detail.createGoal]}),(0,J.jsx)(C,{asChild:!0,variant:`secondary`,className:`justify-start rounded-lg`,children:(0,J.jsxs)(o,{to:`/work-items/${encodeURIComponent(r.id)}`,children:[(0,J.jsx)(Ce,{className:`size-4`,"aria-hidden":!0}),d.detail.openItem]})})]})]}):null,t[105]=s,t[106]=r,t[107]=n,t[108]=g,t[109]=h,t[110]=d.detail.actions,t[111]=d.detail.createGoal,t[112]=d.detail.openItem,t[113]=d.detail.startChat,t[114]=Be):Be=t[114];let Ve;t[115]===d.detail.links?Ve=t[116]:(Ve=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.links}),t[115]=d.detail.links,t[116]=Ve);let He;t[117]!==r||t[118]!==d.detail.noLinks||t[119]!==d.linkKinds?(He=r?.links?.length?r.links.slice(0,6).map(e=>(0,J.jsxs)(o,{to:Y(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[d.linkKinds[e.kind],(0,J.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.detail.noLinks}),t[117]=r,t[118]=d.detail.noLinks,t[119]=d.linkKinds,t[120]=He):He=t[120];let Ue;t[121]===He?Ue=t[122]:(Ue=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2 text-sm`,children:He}),t[121]=He,t[122]=Ue);let We;t[123]!==Ve||t[124]!==Ue?(We=(0,J.jsxs)(`section`,{children:[Ve,Ue]}),t[123]=Ve,t[124]=Ue,t[125]=We):We=t[125];let Ge;t[126]===d.detail.activity?Ge=t[127]:(Ge=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.activity}),t[126]=d.detail.activity,t[127]=Ge);let Ke;t[128]!==a||t[129]!==d.detail.noActivity||t[130]!==d.eventTypes?(Ke=a.length?a.slice(0,5).map(e=>(0,J.jsxs)(`div`,{className:`text-sm`,children:[(0,J.jsx)(`div`,{className:`font-medium text-fg`,children:d.eventTypes[e.type]??e.type}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:Jt(e.createdAt)})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.detail.noActivity}),t[128]=a,t[129]=d.detail.noActivity,t[130]=d.eventTypes,t[131]=Ke):Ke=t[131];let qe;t[132]===Ke?qe=t[133]:(qe=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2`,children:Ke}),t[132]=Ke,t[133]=qe);let Je;t[134]!==Ge||t[135]!==qe?(Je=(0,J.jsxs)(`section`,{children:[Ge,qe]}),t[134]=Ge,t[135]=qe,t[136]=Je):Je=t[136];let Ye;t[137]!==Be||t[138]!==We||t[139]!==Je?(Ye=(0,J.jsxs)(`aside`,{className:`grid content-start gap-5`,children:[Be,We,Je]}),t[137]=Be,t[138]=We,t[139]=Je,t[140]=Ye):Ye=t[140];let Ze;t[141]!==ze||t[142]!==Ye?(Ze=(0,J.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-6 overflow-y-auto px-5 py-4 lg:grid-cols-[minmax(0,1fr)_16rem]`,children:[ze,Ye]}),t[141]=ze,t[142]=Ye,t[143]=Ze):Ze=t[143];let Qe;t[144]!==s||t[145]!==f||t[146]!==d.create.cancel?(Qe=(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:f,disabled:s,children:d.create.cancel}),t[144]=s,t[145]=f,t[146]=d.create.cancel,t[147]=Qe):Qe=t[147];let $e;t[148]!==s||t[149]!==w?($e=s||!w.trim(),t[148]=s,t[149]=w,t[150]=$e):$e=t[150];let et;t[151]===n?et=t[152]:(et=n===`create`?(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}):null,t[151]=n,t[152]=et);let tt=n===`create`?d.create.submit:d.detail.save,nt;t[153]!==$e||t[154]!==et||t[155]!==tt?(nt=(0,J.jsxs)(C,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:$e,children:[et,tt]}),t[153]=$e,t[154]=et,t[155]=tt,t[156]=nt):nt=t[156];let it;t[157]!==Qe||t[158]!==nt?(it=(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[Qe,nt]}),t[157]=Qe,t[158]=nt,t[159]=it):it=t[159];let at;t[160]!==te||t[161]!==le||t[162]!==Ze||t[163]!==it?(at=(0,J.jsxs)(we,{children:[ne,(0,J.jsx)(xe,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(86dvh,48rem)] w-[min(60rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:(0,J.jsxs)(`form`,{onSubmit:te,className:`flex min-h-0 flex-1 flex-col`,children:[le,Ze,it]})})]}),t[160]=te,t[161]=le,t[162]=Ze,t[163]=it,t[164]=at):at=t[164];let ot;return t[165]!==S||t[166]!==W||t[167]!==at?(ot=(0,J.jsx)(Et,{open:S,onOpenChange:W,children:at}),t[165]=S,t[166]=W,t[167]=at,t[168]=ot):ot=t[168],ot}function pn({projectId:e,createRequestKey:t=0}){let n=a(),r=d(p(e=>e.language)).projectDetailPage.workItems,i=(0,K.useRef)(null),o=(0,K.useRef)(null),[s,c]=(0,K.useState)([]),[u,f]=(0,K.useState)(!0),[m,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(null),[v,y]=(0,K.useState)(!1),[b,S]=(0,K.useState)(null),[w,T]=(0,K.useState)(null),[E,D]=(0,K.useState)(!1),[O,k]=(0,K.useState)(!1),[A,M]=(0,K.useState)(!1),[N,P]=(0,K.useState)(`todo`),[F,I]=(0,K.useState)(null),[L,R]=(0,K.useState)([]),z=(0,K.useCallback)(async(t=`replace`,n=0)=>{f(!0),h(null);try{let r=await Pe(e,{limit:100,offset:n});c(e=>t===`append`?[...e,...r.items]:r.items),k(r.hasMore)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}},[e]);(0,K.useEffect)(()=>{z(`replace`,0)},[z]),(0,K.useEffect)(()=>{t&&(I(null),R([]),h(null),_(null),P(`todo`),M(!0))},[t]);let B=(0,K.useMemo)(()=>Gt.map(e=>({status:e,title:r.statuses[e],items:s.filter(t=>t.status===e)})),[s,r.statuses]),V=(0,K.useCallback)(e=>{c(t=>t.map(t=>t.id===e.id?e:t)),I(t=>t?.id===e.id?e:t)},[]),H=(0,K.useCallback)(async(e,t)=>{y(!0),h(null),_(null);try{let n=await Ie(e.id,t);n.item.archivedAt?(c(e=>e.filter(e=>e.id!==n.item.id)),I(null)):(V(n.item),_({title:r.feedback.savedTitle,message:r.feedback.savedNext}))}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[r.feedback.savedNext,r.feedback.savedTitle,V]),U=(0,K.useCallback)(async e=>{I(e),R([]),h(null),_(null);let t=await yt(e.id).catch(()=>null);t&&R(t.events)},[]),ee=(0,K.useCallback)(async t=>{y(!0),h(null),_(null);try{let n=await Je(e,t);c(e=>[n.item,...e]),M(!1),I(n.item),R((await yt(n.item.id).catch(()=>({events:[]}))).events),_({title:r.feedback.createdTitle,message:r.feedback.createdNext})}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[e,r.feedback.createdNext,r.feedback.createdTitle]),te=(0,K.useCallback)(async(e,t)=>{if(t.length){y(!0),h(null),_(null);try{let n=await $e(e.id,t);V(n.item),R((await yt(n.item.id).catch(()=>({events:[]}))).events)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}}},[V]),W=(0,K.useCallback)(async(e,t)=>{y(!0),h(null),_(null);try{let n=await at(e.id,t.id);V(n.item),R((await yt(n.item.id).catch(()=>({events:[]}))).events)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[V]),ne=(0,K.useCallback)(async(e,t)=>{h(null),_(null);try{await ht(e.id,t)}catch(e){h(e instanceof Error?e.message:String(e))}},[]),re=(0,K.useCallback)(async e=>{y(!0),h(null),_(null);try{let t=await ze(e.id);V(t.item),await U(t.item),n(`/chat/${encodeURIComponent(t.session.key)}`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[n,U,V]),ie=(0,K.useCallback)(async e=>{y(!0),h(null),_(null);try{let t=await Me(e.id);V(t.item),await U(t.item),n(`/goals/${encodeURIComponent(t.goal.id)}`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[n,U,V]),ae=(0,K.useCallback)((e,t)=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(Wt,e.id),S(e.id)},[]),oe=(0,K.useCallback)((e,t)=>{t.preventDefault();let n=t.dataTransfer.getData(Wt)||b;T(null),S(null);let r=s.find(e=>e.id===n);!r||r.status===e||H(r,{status:e})},[b,s,H]),se=(0,K.useCallback)(e=>{H(e,{status:e.status===`done`?`todo`:`done`})},[H]),ce=(0,K.useCallback)(e=>{I(null),R([]),h(null),_(null),P(e),M(!0)},[]),G=(0,K.useCallback)(e=>{let t=o.current;!t||t.pointerId!==e.pointerId||(o.current=null,D(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),le=(0,K.useCallback)(e=>{if(e.button!==0||b||an(e.target))return;let t=i.current;t&&(o.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[b]),ue=(0,K.useCallback)(e=>{let t=o.current,n=i.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,D(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,J.jsxs)(`section`,{id:`project-panel-work-items`,role:`tabpanel`,"aria-labelledby":`project-tab-work-items`,className:`flex h-full min-h-0 flex-col`,children:[m?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:m}):null,(0,J.jsx)(`section`,{ref:i,className:l(`min-h-0 flex-1 overflow-x-auto rounded-lg p-2 transition-opacity`,u&&`opacity-60`,E?`cursor-grabbing select-none`:`cursor-grab`),"aria-label":r.boardAria,"aria-busy":u,onPointerDown:le,onPointerMove:ue,onPointerUp:G,onPointerCancel:G,onLostPointerCapture:e=>{o.current?.pointerId===e.pointerId&&(o.current=null,D(!1))},children:(0,J.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:B.map(e=>(0,J.jsxs)(`section`,{className:l(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`,w===e.status&&`bg-surface-active`),"aria-label":e.title,onDragOver:t=>{b&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,T(e.status))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||T(null)},onDrop:t=>oe(e.status,t),children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:e.items.length})]}),(0,J.jsx)(j,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]}),(0,J.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[e.items.length?e.items.map(e=>(0,J.jsx)(sn,{item:e,dragging:b===e.id,onOpen:U,onToggleDone:se,onDragStart:ae,onDragEnd:()=>{S(null),T(null)},t:r},e.id)):u?(0,J.jsxs)(`div`,{className:`grid gap-2 animate-pulse motion-reduce:animate-none`,children:[(0,J.jsx)(cn,{}),(0,J.jsx)(cn,{})]}):(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:r.emptyColumn}),u?null:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-full items-center justify-center rounded-lg bg-surface-panel/85 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-muted`,"aria-label":r.create.addToColumn.replace(`{{status}}`,e.title),title:r.create.addToColumn.replace(`{{status}}`,e.title),onClick:()=>ce(e.status),children:(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0})})]})]},e.status))})}),!u&&O?(0,J.jsx)(C,{type:`button`,variant:`secondary`,className:`justify-self-center`,onClick:()=>void z(`append`,s.length),children:r.loadMore}):null,(0,J.jsx)(fn,{mode:A?`create`:F?`detail`:null,item:F,initialStatus:N,events:L,busy:v,error:m,notice:g,t:r,onClose:()=>{M(!1),I(null),R([]),h(null),_(null)},onCreate:ee,onSave:(e,t)=>void H(e,t),onStartChat:re,onCreateGoal:ie,onAddAttachments:(e,t)=>void te(e,t),onRemoveAttachment:(e,t)=>void W(e,t),onDownloadAttachment:(e,t)=>void ne(e,t),onPreviewError:e=>{_(null),h(e)}})]})}var mn=[{id:`overview`,icon:et},{id:`work-items`,icon:Fe},{id:`sessions`,icon:Ee},{id:`goals`,icon:De},{id:`workflows`,icon:W},{id:`files`,icon:ne},{id:`activity`,icon:D},{id:`automations`,icon:re},{id:`notes`,icon:U},{id:`skills`,icon:st},{id:`settings`,icon:Be}],hn=new Set([`work-items`,`goals`,`workflows`,`automations`]),gn=new Set(mn.map(e=>e.id)),X=`xopc.projectFiles.panelWidthPx`,_n=320,vn=220,yn=560;function bn(e){return Math.min(yn,Math.max(vn,Math.round(e)))}function xn(){try{let e=window.localStorage.getItem(X);if(e==null)return _n;let t=Number.parseInt(e,10);return Number.isFinite(t)?bn(t):_n}catch{return _n}}function Sn(e){try{window.localStorage.setItem(X,String(bn(e)))}catch{}}function Cn(e){return!!(e&&gn.has(e))}function wn(e){return hn.has(e)}function Tn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function En(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):bt(n)}function Dn(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function On(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`||e===`cancelled`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function kn(e){let t=(0,q.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,J.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function An(e=!1){return l(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function jn(e){let t=(0,q.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,J.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=l(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let u;t[4]!==c||t[5]!==r?(u=(0,J.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=u):u=t[6];let d;return t[7]!==o||t[8]!==u?(d=(0,J.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,u]}),t[7]=o,t[8]=u,t[9]=d):d=t[9],d}function Mn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function Nn(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Pn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Fn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function In(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.sessionKey?t.sessionKey:t.kind}function Ln(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Rn(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function zn(e){let t=e.sourceChannel?.trim();if(t)return Bn(t);let n=e.key.split(`:`).filter(Boolean),r=(n[0]?.toLowerCase()===`agent`?n.slice(2).join(`:`):e.key).split(`:`)[0]?.split(/[-_]/)[0]?.trim();return Bn(r||``)}function Bn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Vn(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function Hn(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function Un(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Un(e.children,t,n)}:e)}function Wn({currentProject:e,pm:t,projectsText:n,wd:r}){let i=a(),[o,c]=(0,K.useState)(!1),[u,d]=(0,K.useState)([e]),[f,p]=(0,K.useState)(``),[m,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(null),[v,y]=(0,K.useState)(!1),[S,w]=(0,K.useState)(`new`),[E,D]=(0,K.useState)(``),[O,k]=(0,K.useState)(``),[A,j]=(0,K.useState)(!1),[N,P]=(0,K.useState)(null),[I,L]=(0,K.useState)(null),R=(0,K.useCallback)(async()=>{h(!0),_(null);try{let t=await be({limit:100});d(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}},[e]);(0,K.useEffect)(()=>{d(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,K.useEffect)(()=>{o&&R()},[R,o]);let z=(0,K.useMemo)(()=>{let t=f.trim().toLowerCase().split(/\s+/).filter(Boolean);return u.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=Mn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>Nn(t)-Nn(e))},[e.id,u,f]),B=e=>t.statuses[e.status]??e.status,V=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,H=e=>{w(e),D(``),k(``),P(null),y(!0),c(!1)},U=(0,K.useCallback)(async(e={})=>{let t=O.trim(),n=E.trim()||(S===`directory`?Pn(t):``);if(n){j(!0),P(null),L(null);try{let r=await b({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});y(!1),D(``),k(``),d(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=Fn(e);t?(L(t),y(!1)):P(e instanceof Error?e.message:String(e))}finally{j(!1)}}},[S,E,i,O]),ee=(0,K.useCallback)(e=>{e.preventDefault(),U()},[U]),te=(0,K.useCallback)(()=>{U({createWorkspaceRoot:!0})},[U]),W=(0,K.useCallback)(()=>{L(null),y(!0)},[]),re=e=>{k(e),S===`directory`&&!E.trim()&&D(Pn(e))},ie=(e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:l(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{c(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,J.jsx)(s,{className:l(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:V(e)})]}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Dn(e.status)),children:B(e)})]},e.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Ke,{open:o,onOpenChange:c,children:[(0,J.jsx)(Ue,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Dn(e.status)),children:B(e)})]}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:V(e)})]}),(0,J.jsx)(je,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,J.jsx)(tt,{children:(0,J.jsxs)(ct,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,J.jsxs)(`label`,{className:`relative block`,children:[(0,J.jsx)(He,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:f,onChange:e=>p(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,J.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ie(e,!0),(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),g?(0,J.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:g}):null,m&&z.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!m&&z.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,z.map(e=>ie(e,!1))]}),(0,J.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>H(`new`),children:[(0,J.jsx)(x,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>H(`directory`),children:[(0,J.jsx)(ne,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{c(!1),i(`/projects`)},children:[(0,J.jsx)(Be,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,J.jsx)(Et,{open:v,onOpenChange:e=>!A&&y(e),children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:S===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm text-fg-muted`,children:S===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,J.jsxs)(`form`,{onSubmit:ee,className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[N?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:N}):null,(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,J.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:E,onChange:e=>D(e.target.value),placeholder:`xopc`})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,J.jsx)(kt,{value:O,onChange:re,disabled:A,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,J.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:A,children:n.cancel})}),(0,J.jsxs)(C,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:A||!(E.trim()||S===`directory`&&Pn(O)),children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,J.jsx)(Et,{open:!!I,onOpenChange:e=>{e||L(null)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:I?Tn(n.workspaceMissingDescription,{workspace:I}):null})]}),I?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(ne,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:I})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:W,disabled:A,children:n.workspaceMissingBack}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:te,disabled:A,children:[(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Gn(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=a(),s=d(p(e=>e.language)),f=s.chat.workingDirectory,m=s.projectDetailPage,h=s.projectsPage,g=_e(e=>e.setPageHeader),_=_e(e=>e.clearPageHeader),[v,b]=(0,K.useState)(null),[S,j]=(0,K.useState)(null),[I,z]=(0,K.useState)([]),[G,he]=(0,K.useState)(``),[be,Ce]=(0,K.useState)([]),[Te,je]=(0,K.useState)([]),[Me,Pe]=(0,K.useState)([]),[Ie,ze]=(0,K.useState)([]),[Ve,Ue]=(0,K.useState)([]),[We,Ge]=(0,K.useState)(!1),[Ke,qe]=(0,K.useState)(null),[Je,$e]=(0,K.useState)([]),[tt,at]=(0,K.useState)(0),[ct,lt]=(0,K.useState)(!1),[ht,yt]=(0,K.useState)(!1),[bt,Tt]=(0,K.useState)(!1),[Nt,Pt]=(0,K.useState)([]),Ft=(0,K.useRef)(new Set),[q,It]=(0,K.useState)(null),[Lt,Rt]=(0,K.useState)(xn),[zt,Bt]=(0,K.useState)(!1),[Vt,Ut]=(0,K.useState)(!1),[Wt,Gt]=(0,K.useState)(``),[Kt,qt]=(0,K.useState)([]),[Jt,Yt]=(0,K.useState)(!1),[Xt,Zt]=(0,K.useState)(null),[Qt,$t]=(0,K.useState)(!1),[en,tn]=(0,K.useState)(null),[nn,rn]=(0,K.useState)([]),[Y,an]=(0,K.useState)(``),[on,sn]=(0,K.useState)(!0),[cn,ln]=(0,K.useState)(!1),[un,dn]=(0,K.useState)(!1),[fn,mn]=(0,K.useState)(null),[hn,gn]=(0,K.useState)(!1),[X,_n]=(0,K.useState)(`fixed`),[vn,yn]=(0,K.useState)(``),[Mn,Nn]=(0,K.useState)(null),[Pn,Bn]=(0,K.useState)(!1),[Gn,Kn]=(0,K.useState)(!1),[qn,Jn]=(0,K.useState)(0),[Yn,Xn]=(0,K.useState)(!1),[Zn,Qn]=(0,K.useState)(null),[$n,er]=(0,K.useState)(!1),[tr,nr]=(0,K.useState)(!1),[rr,ir]=(0,K.useState)(!1),[ar,Z]=(0,K.useState)(null),[or,sr]=(0,K.useState)({defaultAgentId:``,agents:[],models:[],checklistDecomposePolicy:`empty_only`}),[cr,lr]=(0,K.useState)({title:``,reason:``}),[Q,ur]=(0,K.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),dr=`overview`,$=n?`notes`:Cn(t)?t:dr,fr=(0,K.useCallback)(t=>{e&&r(`/projects/${encodeURIComponent(e)}/${t}`)},[r,e]),pr=(0,K.useCallback)(t=>e?`/projects/${encodeURIComponent(e)}/${t}`:`/projects`,[e]),mr=(0,K.useCallback)(e=>{let t=pr(`goals`);return`/goals/${encodeURIComponent(e)}?returnTo=${encodeURIComponent(t)}`},[pr]),hr=(0,K.useCallback)(t=>{e&&r(pr(t),{replace:!0})},[r,e,pr]),gr=(0,K.useCallback)((e,t)=>{hr(e),r(t)},[r,hr]),_r=(0,K.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||hr(e)},[hr]),vr=(0,K.useCallback)(e=>e.startsWith(`/goals/`)?`goals`:e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/workflows`)?`workflows`:e.startsWith(`/automations`)?`automations`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,K.useEffect)(()=>{!e||!t||Cn(t)||r(`/projects/${encodeURIComponent(e)}/${dr}`,{replace:!0})},[dr,r,e,t]),(0,K.useEffect)(()=>{if(!e)return;let t=!1;return sn(!0),Z(null),Promise.all([wt(e),w(e),pe(e),N().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;let a=e.project;b(a),j(e),z(n),Ce(r),rn(i?.agents??[]),an(a.defaultAgentId??``),ur({name:a.name,description:a.description??``,status:a.status,defaultAgentId:a.defaultAgentId??``,workspaceRoot:a.workspaceRoot??``,brief:a.brief??``,instructions:a.instructions??``})}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||sn(!1)}),()=>{t=!0}},[e]),(0,K.useEffect)(()=>{let e=!1;async function t(){let[t,n,r]=await Promise.allSettled([N(),fe(),Re()]);e||sr(e=>{let i=t.status===`fulfilled`?t.value.defaultId:e.defaultAgentId,a=v?.defaultAgentId||Y||i,o=t.status===`fulfilled`?t.value.agents:e.agents,s=n.status===`fulfilled`?n.value:e.models,c=r.status===`fulfilled`?At(r.value.payload?.config).checklistDecomposePolicy:e.checklistDecomposePolicy;return{defaultAgentId:a,agents:o.length?o:[{id:a||`main`,workspace:``,profileDir:``,typedModels:{defaultRole:`deep`,preset:[],effective:[]},extends:[],isDefault:!0,skills:{preset:[]},tools:{presetDenied:[],entryDisable:[],effectiveDisable:[]}}],models:s,checklistDecomposePolicy:c}})}return t(),()=>{e=!0}},[v?.defaultAgentId,Y]);let yr=(0,K.useCallback)(async()=>{if(v){Xn(!0),Z(null);try{let[e,t]=await Promise.all([y(),ee(100,{ownerAgentId:Y||void 0,projectId:v.id})]);je(e),Pe(t)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Xn(!1)}}},[v,Y]);(0,K.useEffect)(()=>{v&&yr()},[v,yr]);let br=(0,K.useCallback)(async()=>{if(v){Ge(!0),Z(null);try{let[e,t]=await Promise.all([xt.list({projectId:v.id}),xt.runs(50,void 0,{projectId:v.id})]);ze(e.automations),Ue(t.runs)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ge(!1)}}},[v]);(0,K.useEffect)(()=>{$===`automations`&&br()},[br,$]);let xr=(0,K.useCallback)(async()=>{if(v){lt(!0),Z(null);try{let e=await L(v.id,{includeRelated:ht,limit:100});$e(e.items),at(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{lt(!1)}}},[v,ht]);(0,K.useEffect)(()=>{$===`activity`&&xr()},[xr,$]);let Sr=(0,K.useCallback)(async e=>{qe(`run:${e.id}`),Z(null);try{await xt.runNow(e.id),await br()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{qe(null)}},[br]),Cr=(0,K.useCallback)(async e=>{qe(`toggle:${e.id}`),Z(null);try{e.enabled?await xt.pause(e.id):await xt.resume(e.id),await br()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{qe(null)}},[br]),wr=(0,K.useCallback)(async()=>{if(!v?.effectiveWorkspaceRoot?.trim()){Pt([]),Ft.current.clear(),tn(null);return}$t(!0),tn(null),Ft.current.clear();try{Pt(Hn((await H(v.id,``)).entries)),Ft.current.add(``)}catch(e){Pt([]),Ft.current.clear(),tn(e instanceof Error?e.message:String(e))}finally{$t(!1)}},[v]),Tr=(0,K.useCallback)(async e=>{if(!(!v?.effectiveWorkspaceRoot?.trim()||Ft.current.has(e))){Ft.current.add(e),tn(null);try{let t=await H(v.id,e);Pt(n=>Un(n,e,Hn(t.entries)))}catch(t){Ft.current.delete(e),tn(t instanceof Error?t.message:String(t))}}},[v]);(0,K.useEffect)(()=>{$===`files`&&wr()},[wr,$]);let Er=Wt.trim();(0,K.useEffect)(()=>{if($!==`files`||!v||!Vt||!Er){qt([]),Yt(!1),Zt(null);return}let e=!1;Yt(!0),Zt(null),qt([]);let t=window.setTimeout(()=>{A(v.id,Er,50).then(t=>{e||qt(t)}).catch(t=>{e||Zt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Yt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[Er,v,Vt,$]);let Dr=(0,K.useCallback)(async()=>{if(v){Kn(!0),Z(null);try{let e=await ie(v.id);gr(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Kn(!1)}}},[gr,v]),Or=(0,K.useCallback)(()=>{fr(`work-items`),Jn(e=>e+1)},[fr]),kr=(0,K.useCallback)(async()=>{if(!v)return;let[e,t]=await Promise.all([wt(v.id),pe(v.id)]);j(e),b(e.project),Ce(t)},[v]),Ar=(0,K.useCallback)(async e=>{if(!v||!e.title.trim())return;let t=Number.parseInt(e.maxTurns,10),n=e.deadline?new Date(e.deadline).getTime():void 0;er(!0),Z(null);try{await te(v.id,{title:e.title.trim(),description:e.description.trim()||void 0,attachments:e.attachments.length?e.attachments:void 0,priority:e.priority,deadlineAt:Number.isFinite(n)?n:void 0,maxTurns:Number.isFinite(t)?t:void 0,agentId:e.agentId.trim()||void 0,judgeModelRef:e.judgeModelRef.trim()||void 0,contract:{objective:e.objective.trim()||e.title.trim(),scopeBoundary:e.scopeBoundary.trim()||void 0,evidencePlan:jt(e.evidencePlan),criteria:jt(e.checklist)}}),ir(!1),fr(`goals`),await kr()}catch(e){throw Z(e instanceof Error?e.message:String(e)),e}finally{er(!1)}},[fr,v,kr]),jr=(0,K.useCallback)(async e=>{if(e.preventDefault(),!(!v||!cr.title.trim())){nr(!0),Z(null);try{await Ze(v.id,{title:cr.title.trim(),reason:cr.reason.trim()||void 0}),lr({title:``,reason:``}),await kr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{nr(!1)}}},[cr.reason,cr.title,v,kr]),Mr=(0,K.useCallback)(async e=>{if(v){Qn(`retry:${e.id}`),Z(null);try{let t=await O(e.id,{ownerAgentId:Y||e.metadata?.agentId,projectId:e.metadata?.projectId||v.id});await yr(),gr(`workflows`,vt(t.runId,{ownerAgentId:Y||e.metadata?.agentId||v.defaultAgentId}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Qn(null)}}},[gr,v,yr,Y]),Nr=(0,K.useCallback)(async e=>{Qn(`cancel:${e.id}`),Z(null);try{await E(e.id,{ownerAgentId:Y||e.metadata?.agentId}),await yr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Qn(null)}},[yr,Y]),Pr=(0,K.useMemo)(()=>(0,J.jsx)(o,{to:`/projects`,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":m.backToProjects,children:(0,J.jsx)(se,{className:`size-4`,"aria-hidden":!0})}),[m.backToProjects]),Fr=(0,K.useMemo)(()=>v?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(C,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Or,children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),m.workItems.create.header]}),(0,J.jsxs)(C,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void Dr(),disabled:Gn,children:[(0,J.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),m.common.newChat]})]}):null,[Or,m.common.newChat,m.workItems.create.header,v,Dr,Gn]);(0,K.useLayoutEffect)(()=>(g({startExtra:Pr,main:v?(0,J.jsx)(Wn,{currentProject:v,pm:m,projectsText:h,wd:f}):(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:m.fallbackTitle}),(0,J.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:m.fallbackContext})]}),end:Fr}),()=>_()),[_,Fr,Pr,m,v,h,g,f]);function Ir(e){b(t=>t?{...t,...e}:null),j(t=>t?{...t,project:{...t.project,...e}}:null),an(e.defaultAgentId??``),ur(t=>({...t,name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``})),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function Lr(){if(!(!v||!Q.name.trim())){ln(!0),Z(null),mn(null);try{Ir(await ut(v.id,{name:Q.name.trim(),status:Q.status,description:Q.description,defaultAgentId:Q.defaultAgentId,brief:Q.brief,instructions:Q.instructions}))}catch(e){let t=Fn(e);t?mn(t):Z(e instanceof Error?e.message:String(e))}finally{ln(!1)}}}function Rr(e){e.preventDefault(),Lr()}let zr=(0,K.useCallback)(()=>{if(!v)return;let e=v.workspaceRoot?.trim()??``;_n(e?`fixed`:`follow`),yn(e||v.effectiveWorkspaceRoot||``),gn(!0)},[v]);async function Br(e={}){if(!v)return;let t=X===`fixed`?vn.trim():``;if(!(X===`fixed`&&!t)){ln(!0),Z(null),mn(null);try{Ir(await ut(v.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}})),gn(!1),mn(null)}catch(e){let t=Fn(e);t?(mn(t),gn(!1)):Z(e instanceof Error?e.message:String(e))}finally{ln(!1)}}}async function Vr(){if(!(!v||Mn)){Nn(`pin`),Z(null);try{Ir(v.pinnedAt?await B(v.id):await P(v.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Nn(null)}}}async function Hr(){if(!(!v||Mn)){Nn(`archive`),Z(null);try{Ir(v.status===`archived`?await ve(v.id):await Qe(v.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Nn(null)}}}async function Ur(){if(v){Bn(!0),Z(null);try{await le(v.id),dn(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Bn(!1)}}}async function Wr(){if(!(!v||bt)){Tt(!0),Z(null);try{await Se(v.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Tt(!1)}}}let Gr=(0,K.useCallback)(e=>{It(e)},[]),Kr=(0,K.useCallback)((e,t)=>{t||It(e)},[]),qr=(0,K.useCallback)(async(e,t,n)=>{let r=v?.id;if(r)switch(e){case`preview`:t.isDirectory||It(t.path);break;case`download`:if(t.isDirectory)return;try{let e=de(t.path);if(Le(ke(e))!==`text`){let n=await dt(t.path,{projectId:r}),i=Oe(e)??`application/octet-stream`;_t(e,await n.arrayBuffer(),i)}else{let{content:n}=await Ye(t.path,{projectId:r});nt(e,n)}}catch(e){gt(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await u(t.absolutePath??t.path)&>(`success`,s.workspace.pathCopied,void 0,{duration:2500})}catch{gt(`warning`,s.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:if(!t.absolutePath||!window.electronAPI?.shell?.openPath)return;await window.electronAPI.shell.openPath(t.absolutePath);break;case`openWith`:if(!t.absolutePath||!window.electronAPI?.shell?.chooseAppAndOpenPath)return;await window.electronAPI.shell.chooseAppAndOpenPath(t.absolutePath);break;case`openWithApp`:if(!t.absolutePath||!n||!window.electronAPI?.shell?.openPathWithApp)return;await window.electronAPI.shell.openPathWithApp(t.absolutePath,n);break;case`revealInFolder`:if(!t.absolutePath||!window.electronAPI?.shell?.showItemInFolder)return;await window.electronAPI.shell.showItemInFolder(t.absolutePath);break;default:break}},[s.clipboard.copyFailed,s.workspace.pathCopied,v?.id]),Jr=(0,K.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),Bt(!0);let r=e.clientX,i=Lt,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=bn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Bt(!1),Rt(c),Sn(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[Lt]);if((0,K.useEffect)(()=>{$!==`files`&&It(null)},[e,$]),on)return(0,J.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:m.loading});if(!v)return(0,J.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(o,{to:`/projects`,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,J.jsx)(se,{className:`size-4`,"aria-hidden":!0}),m.backToProjects]}),(0,J.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:ar||m.notFound})]});let Yr=S?.recentSessions.length?S.recentSessions:v.recentSessions,Xr=S?.attentionItems??[],Zr=e=>m.statuses[e]??e,Qr=e=>Tn(m.common.messages,{count:e}),$r=G.trim().toLowerCase(),ei=$r?I.filter(e=>{let t=En(e.updatedAt),n=e.routing?.agentId||e.agentId||m.common.agent,r=e.name?.trim()||m.sessions.fallbackTitle,i=Qr(e.messageCount??0),a=zn(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes($r)}):I,ti=I.length>0&&ei.length===0,ni=nn.find(e=>e.id===Q.defaultAgentId)?.name||Q.defaultAgentId||m.settings.globalDefaultAgent,ri=nn.find(e=>e.id===Q.defaultAgentId),ii=v.workspaceRoot?.trim()||``,ai=v.status===`archived`,oi=!!v.pinnedAt,si=!ii,ci=ii||ri?.workspace||v.effectiveWorkspaceRoot||m.common.defaultWorkspace,li=X===`fixed`?vn.trim()||m.settings.workspacePlaceholder:ri?.workspace||v.effectiveWorkspaceRoot||m.common.defaultWorkspace,ui=(X===`fixed`?vn.trim():``)!==ii&&(X===`follow`||!!vn.trim()),di=[{id:`overview`,icon:et,label:m.tabs.overview},{id:`work`,icon:Fe,label:m.tabs.work},{id:`files`,icon:ne,label:m.tabs.files},{id:`notes`,icon:U,label:m.tabs.notes},{id:`skills`,icon:st,label:m.tabs.skills},{id:`sessions`,icon:Ee,label:m.tabs.sessions},{id:`activity`,icon:D,label:m.tabs.activity}],fi=[{id:`work-items`,icon:Fe,label:m.tabs.workItems},{id:`goals`,icon:De,label:m.tabs.goals},{id:`workflows`,icon:W,label:m.tabs.workflows},{id:`automations`,icon:re,label:m.tabs.automations}],pi=wn($)?`work`:$;async function mi(){if(!ci)return;let e=await u(ci);gt(e?`success`:`warning`,e?s.workspace.pathCopied:s.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function hi(){mn(null),gn(!0)}return(0,J.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,J.jsx)(Ot,{items:di,activeTab:pi,onChange:e=>fr(e===`work`?`work-items`:e),ariaLabel:m.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,J.jsxs)(C,{id:`project-primary-tab-settings`,type:`button`,variant:$===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":$===`settings`?`page`:void 0,onClick:()=>fr(`settings`),children:[(0,J.jsx)(Be,{className:`size-4`,"aria-hidden":!0}),m.tabs.settings]})]}),ar?(0,J.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:ar}):null,wn($)?(0,J.jsx)(`div`,{className:`mt-3 shrink-0 rounded-xl border border-edge-subtle bg-surface-panel px-2 py-1 shadow-surface`,children:(0,J.jsx)(Ot,{items:fi,activeTab:$,onChange:fr,ariaLabel:m.workNavAria,tabIdPrefix:`project-work-tab`,panelIdPrefix:`project-panel`,buttonClassName:`h-8 px-2.5 py-1.5 text-xs`})}):null,(0,J.jsxs)(`div`,{className:l(`mt-3 min-h-0 flex-1`,$===`work-items`?`-mx-3 -mb-3 overflow-hidden sm:-mx-5 sm:-mb-4 xl:-mx-6`:$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,J.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.overview.directionTitle}),(0,J.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:S?.digest?.summary||S?.recommendedAction||v.description||v.brief||m.overview.directionFallback}),S?.digest?.nextAction?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:Tn(m.overview.recommendedNext,{action:S.digest.nextAction})}):null]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,J.jsxs)(C,{type:`button`,variant:`secondary`,onClick:()=>void Wr(),disabled:bt,children:[(0,J.jsx)(Ct,{className:`size-4`,"aria-hidden":!0}),bt?m.overview.savingDigest:m.overview.saveDigest]})})]})}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.overview.nextActions}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>ir(!0),children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),m.overview.goal]})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:S?.nextActions.length?S.nextActions.map(e=>(0,J.jsxs)(o,{to:mr(e.goalId),onClick:_r(`goals`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,Dn(e.status)),children:Zr(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.nextAction})]},e.goalId)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.overview.noNextActions})})]})]}),(0,J.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.overview.attention}),Xr.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Xr.map(e=>{let t=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(c,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,J.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[m.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Zr(e.status)}`:``]})]});return e.href?(0,J.jsx)(o,{to:e.href,onClick:_r(vr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,J.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:m.overview.noBlockedGoals}),(0,J.jsxs)(`form`,{onSubmit:jr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,J.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:cr.title,onChange:e=>lr(t=>({...t,title:e.target.value})),placeholder:m.overview.blockerTitlePlaceholder}),(0,J.jsx)(C,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:tr||!cr.title.trim(),"aria-label":tr?m.overview.addingBlocker:m.overview.addBlocker,title:tr?m.overview.addingBlocker:m.overview.addBlocker,children:(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(it,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:m.overview.recentSessions})]}),(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>fr(`sessions`),children:m.common.viewAll})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Yr.length?Yr.map(e=>(0,J.jsxs)(o,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:_r(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:En(e.updatedAt)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||m.common.agent})]},e.key)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.overview.noSessions})})]})]})]}):null,$===`work-items`?(0,J.jsx)(`section`,{id:`project-panel-work-items`,className:`flex h-full min-h-0 flex-col`,role:`tabpanel`,"aria-labelledby":`project-work-tab-work-items`,children:(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,J.jsx)(pn,{projectId:v.id,createRequestKey:qn})})}):null,$===`workflows`?(0,J.jsxs)(`section`,{id:`project-panel-workflows`,role:`tabpanel`,"aria-labelledby":`project-work-tab-workflows`,className:`grid h-full min-h-[28rem] gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsx)(`div`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.workflows.runsTitle}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.workflows.runsHint})]}),(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void yr(),disabled:Yn,children:[(0,J.jsx)(St,{className:`size-4`,"aria-hidden":!0}),m.common.refresh]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:Yn&&Me.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.workflows.loadingRuns}):Me.length?Me.map(e=>{let t=e.status===`queued`||e.status===`running`,n=e.status===`failed`||e.status===`timeout`||e.status===`cancelled`;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>gr(`workflows`,vt(e.id,{ownerAgentId:Y||e.metadata?.agentId||v.defaultAgentId})),children:e.title||e.definitionId}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,On(e.status)),children:Zr(e.status)})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:Tn(m.workflows.runMeta,{definitionId:e.definitionId,done:e.metrics.doneAgentCount,total:e.metrics.agentCount,time:En(e.createdAtMs)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>gr(`workflows`,vt(e.id,{ownerAgentId:Y||e.metadata?.agentId||v.defaultAgentId})),children:m.common.open}),n?(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Zn===`retry:${e.id}`,onClick:()=>void Mr(e),children:[(0,J.jsx)(St,{className:`size-3.5`,"aria-hidden":!0}),m.common.retry]}):null,t?(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Zn===`cancel:${e.id}`,onClick:()=>void Nr(e),children:[(0,J.jsx)(ft,{className:`size-3.5`,"aria-hidden":!0}),m.common.cancel]}):null]})]})]},e.id)}):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.workflows.emptyRuns})})]})}),(0,J.jsx)(`aside`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.workflows.startTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:m.workflows.startHint})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,J.jsx)(`div`,{className:`grid gap-2`,children:Te.length?Te.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`grid gap-1 rounded-md bg-surface-base p-3 text-left hover:bg-surface-hover focus:outline-none focus:ring-2 focus:ring-accent/30`,onClick:()=>r(`/workflows/${e.id}?projectId=${encodeURIComponent(v.id)}${Y?`&agentId=${encodeURIComponent(Y)}`:``}`),children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,J.jsx)(W,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}),(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.metadata.whenToUse||e.name})]},e.id)):(0,J.jsx)(`div`,{className:`px-1 py-3 text-sm text-fg-muted`,children:m.workflows.emptyDefinitions})})})]})})]}):null,$===`automations`?(0,J.jsxs)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-work-tab-automations`,className:`grid h-full min-h-[28rem] overflow-hidden gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.automations.title}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.automations.hint})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void br(),disabled:We,children:[(0,J.jsx)(St,{className:`size-4`,"aria-hidden":!0}),m.common.refresh]}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>gr(`automations`,`/automations?projectId=${encodeURIComponent(v.id)}&action=create`),children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),m.common.new]})]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:We&&Ie.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.automations.loading}):Ie.length?Ie.map(e=>{let t=Ve.find(t=>t.automationId===e.id),n=e.state.runningRunId?Ve.find(t=>t.id===e.state.runningRunId):null;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>gr(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?m.automations.enabled:m.automations.paused})]}),(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:Tn(m.common.lastRun,{trigger:e.trigger.kind,action:e.action.kind,time:t?En(t.createdAtMs):m.common.never})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Ke===`run:${e.id}`||!!n,onClick:()=>void Sr(e),children:[(0,J.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),m.automations.run]}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Ke===`toggle:${e.id}`,onClick:()=>void Cr(e),children:[e.enabled?(0,J.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?m.automations.pause:m.automations.resume]})]})]})]},e.id)}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-6 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:m.automations.empty}),(0,J.jsx)(`div`,{children:(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>gr(`automations`,`/automations?projectId=${encodeURIComponent(v.id)}&action=create`),children:[(0,J.jsx)(re,{className:`size-4`,"aria-hidden":!0}),m.automations.create]})})]})})]}),(0,J.jsxs)(`aside`,{className:`grid min-h-0 min-w-0 content-start gap-4 overflow-y-auto pr-1 [scrollbar-gutter:stable]`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.automations.recentRuns})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Ve.length?Ve.slice(0,8).map(e=>(0,J.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.automationName}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,On(e.status)),children:Zr(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:En(e.createdAtMs)})]},e.id)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.automations.emptyRuns})})]}),(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.automations.contextTitle}),(0,J.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:m.automations.contextHint}),(0,J.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:v.workspaceRoot||v.effectiveWorkspaceRoot||m.common.defaultWorkspace})]})]})]}):null,$===`notes`?(0,J.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,J.jsx)(Dt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(v.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,listTag:`project:${v.id}`,captureTags:[`project:${v.id}`,v.slug],listTitle:m.notes.title,listDescription:m.notes.hint,emptyText:m.notes.emptyTitle,emptyDescription:m.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${v.id}`})}):null,$===`skills`?(0,J.jsx)(Ht,{projectId:v.id,copy:m.skills}):null,$===`files`?(0,J.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:v.effectiveWorkspaceRoot?(0,J.jsxs)(`div`,{"data-project-files-grid":!0,className:l(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,zt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Lt}px`},children:[(0,J.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,J.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,J.jsx)(ce,{workspacePath:ci}),(0,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,className:l(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Vt&&`bg-surface-hover text-fg`),onClick:()=>Ut(!0),"aria-label":m.files.search,title:m.files.search,"aria-pressed":Vt,children:(0,J.jsx)(He,{className:`size-3.5`,"aria-hidden":!0})}),(0,J.jsx)(ot,{className:`size-7 shrink-0 rounded-md p-0`,loading:Qt,label:s.cron.refresh,onClick:()=>void wr()})]})]}),Vt?(0,J.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,J.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,J.jsx)(He,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`text`,role:`searchbox`,value:Wt,onChange:e=>Gt(e.target.value),placeholder:m.files.searchPlaceholder,"aria-label":m.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,J.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":m.files.clearSearch,title:m.files.clearSearch,onClick:()=>{Gt(``),Ut(!1)},children:(0,J.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,en?(0,J.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:en}):null,Er?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Jt?(0,J.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,J.jsx)(pt,{className:`h-11 w-full`}),(0,J.jsx)(pt,{className:`h-11 w-full`}),(0,J.jsx)(pt,{className:`h-11 w-full`})]}):Xt?(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[s.workspace.loadError,`: `,Xt]}):Kt.length===0?(0,J.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:m.files.noSearchResults}):Kt.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:l(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,q===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>It(e.path),title:e.path,children:[(0,J.jsx)(U,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Qt&&Nt.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.files.loading}):(0,J.jsx)(Ne,{tree:Nt,selectedPath:q,onSelectFile:Gr,onSelectEntry:Kr,onExpandDir:e=>void Tr(e),onAction:qr,actionLabels:{preview:s.workspace.preview,download:s.workspace.download,copyPath:s.workspace.copyPath,openDefault:s.workspace.openSystemApp,openWith:s.workspace.openWith,revealInFolder:s.workspace.revealInFolder,recommendedApps:s.workspace.recommendedApps},emptyHint:m.files.emptyDirectory})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":m.files.resizeHandle,className:l(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,zt&&`bg-surface-hover`),onPointerDown:Jr,children:(0,J.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:q?(0,J.jsx)(mt,{filePath:q,projectId:v.id,agentId:v.defaultAgentId||Y||void 0,onClose:()=>It(null)}):(0,J.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,J.jsxs)(`div`,{className:`max-w-sm`,children:[(0,J.jsx)(ne,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:m.files.previewEmptyTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.files.previewEmptyDescription})]})})})]}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:m.files.needWorkspace}),(0,J.jsx)(`div`,{children:(0,J.jsx)(C,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>fr(`settings`),children:m.files.openSettings})})]})})}):null,$===`sessions`?(0,J.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[I.length?(0,J.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,J.jsx)(He,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:G,onChange:e=>he(e.currentTarget.value),placeholder:m.sessions.searchPlaceholder,"aria-label":m.sessions.searchPlaceholder,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`}),G?(0,J.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":m.sessions.clearSearch,onClick:()=>he(``),children:(0,J.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,ei.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:ei.map(e=>{let t=En(e.updatedAt),n=e.routing?.agentId||e.agentId||m.common.agent,r=zn(e),i=e.name?.trim()||m.sessions.fallbackTitle,a=Qr(e.messageCount??0);return(0,J.jsxs)(o,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:_r(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,J.jsx)(Ee,{className:`size-4`,"aria-hidden":!0})}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,J.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,J.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[m.sessions.agent,`: `,n]}),(0,J.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,J.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[m.sessions.updated,`: `,t]}):null]})]},e.key)})}):ti?(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:m.sessions.noMatches})}):(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:m.sessions.emptyTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:m.sessions.emptyDescription})]})})]}):null,$===`goals`?(0,J.jsxs)(`section`,{id:`project-panel-goals`,role:`tabpanel`,"aria-labelledby":`project-work-tab-goals`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.goals.title})}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3`,disabled:$n,onClick:()=>ir(!0),children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),m.goals.new]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:be.length?be.map(e=>(0,J.jsxs)(o,{to:mr(e.id),onClick:_r(`goals`),className:`grid gap-1 border-b border-edge px-4 py-3 last:border-b-0 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,Dn(e.status)),children:Zr(e.status)})]}),(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e.nextAction||e.description||m.goals.noNextAction})]},e.id)):(0,J.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:m.goals.empty})})]}):null,$===`activity`?(0,J.jsxs)(`section`,{id:`project-panel-activity`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-activity`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.activity.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Tn(m.activity.count,{count:tt})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:ht,onChange:e=>yt(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),m.activity.includeRelated]}),(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void xr(),disabled:ct,children:[(0,J.jsx)(St,{className:l(`size-4`,ct&&`animate-spin`),"aria-hidden":!0}),m.common.refresh]})]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:ct&&Je.length===0?(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:m.activity.loading}):Je.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Je.map(e=>{let t=m.activity.types[e.type]??e.type,n=m.activity.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Vn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===v.id);return(0,J.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:m.activity.related}):null]}),(0,J.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Ln(e)]})]}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:En(e.createdAt)})]}),r?(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,J.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[m.activity.actor,`: `,In(e)]}),(0,J.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[m.activity.source,`: `,Rn(e)]})]})]},e.id)})}):(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:m.activity.empty})})]}):null,$===`settings`?(0,J.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:Rr,className:`grid min-h-full content-start gap-4`,children:[(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.summaryTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.summaryHint})]}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,Dn(Q.status)),children:m.settings.statuses[Q.status]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-5`,children:[(0,J.jsx)(jn,{label:m.settings.workspaceRoot,value:ci,mono:!0}),(0,J.jsx)(jn,{label:m.settings.defaultAgent,value:ni}),(0,J.jsx)(jn,{label:m.settings.pinState,value:oi?m.settings.pinned:m.settings.notPinned}),(0,J.jsx)(jn,{label:m.settings.createdAt,value:En(v.createdAt)||m.common.never}),(0,J.jsx)(jn,{label:m.settings.updatedAt,value:En(v.updatedAt)||m.common.never})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.detailsTitle})}),(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,J.jsx)(kn,{label:m.settings.name,children:(0,J.jsx)(`input`,{className:An(),value:Q.name,onChange:e=>ur(t=>({...t,name:e.target.value}))})}),(0,J.jsx)(kn,{label:m.settings.defaultAgent,children:(0,J.jsxs)(rt,{className:An(),value:Q.defaultAgentId,onChange:e=>ur(t=>({...t,defaultAgentId:e.target.value})),children:[(0,J.jsx)(Xe,{value:``,children:m.settings.globalDefaultAgent}),nn.map(e=>(0,J.jsx)(Xe,{value:e.id,children:ge(e,s.agentsSettings)},e.id))]})}),(0,J.jsx)(kn,{label:m.settings.status,children:ai?(0,J.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:m.settings.statuses.archived}):(0,J.jsxs)(rt,{className:An(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>ur(t=>({...t,status:e.target.value})),children:[(0,J.jsx)(Xe,{value:`active`,children:m.settings.statuses.active}),(0,J.jsx)(Xe,{value:`paused`,children:m.settings.statuses.paused})]})}),(0,J.jsx)(kn,{label:m.settings.description,hint:m.settings.descriptionHint,children:(0,J.jsx)(`textarea`,{className:An(!0),value:Q.description,onChange:e=>ur(t=>({...t,description:e.target.value}))})})]})]}),(0,J.jsx)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:m.settings.workspaceRoot}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,J.jsx)(`span`,{className:`rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:si?m.settings.workspaceModeFollow:m.settings.workspaceModeFixed})}),(0,J.jsx)(`div`,{className:`mt-2 break-all font-mono text-xs leading-5 text-fg`,title:ci,children:ci})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void mi(),children:[(0,J.jsx)(Ae,{className:`size-4`,"aria-hidden":!0}),m.settings.copyWorkspacePath]}),(0,J.jsx)(ce,{workspacePath:ci}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:zr,children:[(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),m.settings.migrateWorkspace]})]})]}),(0,J.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceMigrationHint})]})]})}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.projectGuidanceTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.projectGuidanceHint})]}),(0,J.jsx)(kn,{label:m.settings.brief,hint:m.settings.briefHint,children:(0,J.jsx)(`textarea`,{className:An(!0),value:Q.brief,onChange:e=>ur(t=>({...t,brief:e.target.value}))})}),(0,J.jsx)(kn,{label:m.settings.instructions,hint:m.settings.instructionsHint,children:(0,J.jsx)(`textarea`,{className:An(!0),value:Q.instructions,onChange:e=>ur(t=>({...t,instructions:e.target.value}))})})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.managementTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.managementHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:oi?m.settings.pinnedTitle:m.settings.pinTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:m.settings.pinHint})]}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:Mn===`pin`,onClick:()=>void Vr(),children:[oi?(0,J.jsx)(ue,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(k,{className:`size-4`,"aria-hidden":!0}),oi?m.settings.unpinProject:m.settings.pinProject]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:ai?m.settings.restoreTitle:m.settings.archiveTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:ai?m.settings.restoreHint:m.settings.archiveHint})]}),(0,J.jsxs)(C,{type:`button`,variant:ai?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:Mn===`archive`,onClick:()=>void Hr(),children:[ai?(0,J.jsx)(St,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(R,{className:`size-4`,"aria-hidden":!0}),ai?m.settings.restoreProject:m.settings.archiveProject]})]})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:m.settings.dangerTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-red-700/80 dark:text-red-200/80`,children:m.settings.dangerHint})]}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>dn(!0),children:[(0,J.jsx)(V,{className:`size-4`,"aria-hidden":!0}),m.settings.deleteConfirmAction]})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge pt-4`,children:(0,J.jsxs)(C,{type:`submit`,variant:`primary`,disabled:cn||!Q.name.trim(),children:[(0,J.jsx)(Ct,{className:`size-4`,"aria-hidden":!0}),m.common.save]})})]}):null]}),(0,J.jsx)(Et,{open:un,onOpenChange:e=>{Pn||dn(e)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,J.jsx)(c,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:m.settings.deleteConfirmTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v?Tn(m.settings.deleteConfirm,{name:v.name}):m.settings.deleteConfirmFallback})]})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Pn,children:m.common.cancel})}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:Pn||!v,onClick:()=>void Ur(),children:[(0,J.jsx)(V,{className:`size-4`,"aria-hidden":!0}),m.settings.deleteConfirmAction]})]})]})]})}),(0,J.jsx)(Et,{open:hn,onOpenChange:e=>{cn||gn(e)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:m.settings.workspaceMigrationTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.workspaceMigrationDescription})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:m.settings.workspaceMode}),(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:l(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,X===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:X===`fixed`,onChange:()=>_n(`fixed`),disabled:cn}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:m.settings.workspaceModeFixed}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceMigrationFixedHint})]})]}),(0,J.jsxs)(`label`,{className:l(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,X===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:X===`follow`,onChange:()=>_n(`follow`),disabled:cn}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:m.settings.workspaceModeFollow}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceHint})]})]})]})]}),X===`fixed`?(0,J.jsx)(kt,{value:vn,onChange:yn,disabled:cn,wd:f,placeholder:m.settings.workspacePlaceholder,inputClassName:An(),autoFocus:!0}):null,(0,J.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:m.settings.workspaceMigrationImpact}),(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:Tn(m.settings.workspaceCurrent,{workspace:li})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:cn,children:m.common.cancel})}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:cn||!ui,onClick:()=>void Br(),children:[(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),m.settings.workspaceMigrationConfirm]})]})]})]})}),(0,J.jsx)(Et,{open:!!fn,onOpenChange:e=>{e||mn(null)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:m.settings.workspaceMissingTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:fn?Tn(m.settings.workspaceMissingDescription,{workspace:fn}):null})]}),fn?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(ne,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:fn})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:hi,disabled:cn,children:m.settings.workspaceMissingBack}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Br({createWorkspaceRoot:!0}),disabled:cn,children:[(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),m.settings.workspaceMissingCreate]})]})]})]})}),(0,J.jsx)(Mt,{open:rr,t:s.goalsPage,chat:s.chat,busy:$n,options:or,onClose:()=>!$n&&ir(!1),onCreate:Ar})]})}export{Gn as ProjectDetailPage};
|