@xopcai/xopc 0.0.145 → 0.0.146
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BEUxdhZx.js → agent-avatar-dicebear-gBVDdd-Q.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-1bpT0xRO.js → agents-BLp5ItD3.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CRHSZJWi.js → app-management-settings-panel-Dd5dmRWY.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BunADYJb.js → appearance-settings-D89pY61C.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Cc4JgVUQ.js → apps-page-CgOy905b.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-B6vTkH2A.js → archive-plugin-BZj1tk3p.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BjZXzaNv.js → attachment-load-18eo6l3m.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-ZDA-Stg1.js → automation-suggestion-card-F1g3MckR.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-mb0fdVpq.js → automations-page-Bdj0A_IC.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DYZfLvPz.js → binary-plugins-jOYMquLP.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C3MUlYC9.js → block-editor-CD77nXJU.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-Bb0xhaMN.js → browser-settings-page-D73ClpC2.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-BV76yN9a.js → capability-presets-api-DZwIrY_P.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-CUcGKZqC.js → capability-presets-settings-panel-Dw2uinRX.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-BlSDMGdy.js → channels-settings-g9TZdnQh.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-logo-BVFNT2zW.js → connector-logo-g9f07qO6.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-CMgAFGvb.js → connectors-page-CJLsXBB0.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-_jUmoXd3.js → desktop-pet-DwPVWi3D.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DwGOy4AQ.js → desktop-pet-settings-Dm1N7RRX.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-akvF0F-u.js → directory-picker-path-field-hZghTKie.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-BLetQiYY.js → dreaming-settings-B_LcHWcv.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-Cof2ncxE.js → extension-debug-page-BqguEetG.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CwWktRNz.js → extension-page-otKJCjKP.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CuggWOIl.js → extension-settings-page-ifHzMfT-.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-B7sxIbza.js → gateway-config-api-BQX5GGl2.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DIv0eKMf.js → gateway-settings-BfXo0j0O.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-C4Kw0mfS.js → goal-create-dialog-C_Qw_QgW.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-BMmzYpZL.js → goal-detail-page-BnUrr9_O.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-B0jm5JaA.js → goals-config-api-DQJ5mBXB.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-CGeT77PC.js → goals-page-BgDCoiG0.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-N5_iL7es.js → goals-settings-CQX8zWKe.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-XzH3lbRR.js → heartbeat-settings-yy_Pt_24.js} +1 -1
- package/dist/gateway/static/root/assets/{index-I-ZCenVw.js → index-BJGusbyV.js} +6 -6
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-D1rVyDdf.js +1 -0
- package/dist/gateway/static/root/assets/{logs-page-BSh1t8cD.js → logs-page-C35Xa_mx.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-5rJx5flj.js → markdown-split-BYasrWPk.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DYXccwAd.js → media-plugins--cJpmHc2.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-panel-BNpTenAI.js → models-hub-panel-CqehWxbT.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BgLyndCO.js → notes-page-Digm3EgB.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-teklkhcE.js → notes-workbench-CCuL7qlg.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-6Al9_sGz.js → page-tabs-CGVMJEW0.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cm3G72Hv.js → preview-open-alternatives-BBAkU4xW.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-CCB_dKoh.js → project-detail-page-DTWPEtSE.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-VOAFAHYj.js → projects-page-NnJpsIAD.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-USYu64Ru.js → remote-access-hub-wbk1GCvg.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-BYtfzu_F.js → save-bar-controls-D4B469dh.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-CvIRc6yK.js → schedule-field-Vy4OjH0i.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CQuKx0n7.js → schema-form-CPYzgmby.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-oGC8O5h_.js → sessions-page-Do0ZNuqM.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-HeYP_JCr.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-CF3HHM-t.js → settings-collapsible-section-BB5y9vwh.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-CwWjoRN6.js → settings-form-section-BfzJkVHd.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-aUFmJa13.js → settings-loading-skeleton-DM8iH25s.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B2UUU9TF.js → settings-page-h5Alz_fA.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DqpbTWqI.js → settings-page-layout-DjbdpK2j.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-Ck9keROI.js → setup-status-panel-bjbH7U6x.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BOhlPsS1.js → share-preview-page-DxozU_zz.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-BYLsCuqj.js → shares-settings-Cl_bE9gQ.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-BNHUyVML.js → skill-reload-api-DcqbKYgB.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-CpXbQH4n.js → skills-page-D_Xkjxtr.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CWxSvuwD.js → system-settings-panel-DNi9Ofuj.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-qROAvqTw.js → typed-models-lib-B6Nw3iFM.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-DbNEK4Yp.js → user-context-page-BtU2sQoK.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-fields-editor-CWxc0ghP.js → user-profile-fields-editor-DVBShNYF.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-DW-Up6vt.js → user-profile-settings-panel-CC0sf3vS.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-D53uRXVr.js → utils-DnsuE4YP.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-Cs7MOrg0.js → voice-api-key-field-BIcSMf0O.js} +1 -1
- package/dist/gateway/static/root/assets/{work-item-detail-page-D1ziG1Pp.js → work-item-detail-page-ChCKymS7.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D_x9ELJp.js → workflow-run-setup-panel-DXc_pbVG.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DHGV_n6i.js → workflows-page-CheHRVox.js} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -1
- package/dist/src/agent/memory/dreaming/config.js +1 -1
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/package.json +2 -1
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-x_v0nrIi.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D4rP66R1.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{l as i,t as a,u as o}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as s}from"./cn-BQ_8x0bT.js";import{t as c}from"./check-BODqo66o.js";import{t as l}from"./circle-alert-RzVebuX2.js";import{t as u}from"./copy-to-clipboard-HOJ79TWv.js";import{t as d}from"./messages-Cb1VMeqP.js";import{n as f,o as p,r as m}from"./locale-store-CiM-D9jA.js";import{Aa as h,As as g,Ba as _,Bi as v,Ca as y,Cc as b,Da as x,Do as S,Ea as C,Fi as w,Fo as T,Hi as E,Ii as D,Io as O,Kc as k,Kl as A,La as j,Lc as M,Li as N,Ln as P,Ls as F,Mn as I,Mo as L,Na as R,Ni as z,No as B,Oa as ee,Oc as V,Pa as te,Pi as ne,Po as re,Ps as H,Qo as ie,Qs as ae,Ri as oe,Sa as se,Ta as ce,Tl as le,To as ue,Tr as de,Ui as fe,Ul as pe,Vi as me,Xc as he,Yo as U,Ys as ge,Zc as W,Zo as _e,Zs as ve,_a as ye,_o as be,a as xe,at as Se,ba as Ce,c as we,d as Te,da as Ee,do as De,f as Oe,fa as ke,fc as Ae,fo as je,go as Me,gt as Ne,h as Pe,ha as Fe,ho as Ie,i as Le,il as Re,ka as ze,kl as Be,lo as Ve,m as He,ma as Ue,mo as We,ms as Ge,mt as Ke,nc as qe,nl as Je,o as Ye,pa as Xe,pl as Ze,po as Qe,qc as $e,qs as et,rt as G,s as tt,sl as nt,tc as rt,tl as it,u as at,ui as ot,us as st,vr as ct,wa as lt,x as ut,xa as dt,xs as ft,ya as pt,yt as mt,z as ht,zi as gt,zs as _t}from"./index-I-ZCenVw.js";import{t as vt}from"./notes-workbench-teklkhcE.js";import{t as yt}from"./page-tabs-6Al9_sGz.js";import{t as bt}from"./directory-picker-path-field-akvF0F-u.js";import{t as xt}from"./goals-config-api-B0jm5JaA.js";import{n as St,t as Ct}from"./goal-create-dialog-C4Kw0mfS.js";var K=n(),q=e(t(),1),J=r(),wt=`application/x-xopc-work-item`,Tt=[`backlog`,`todo`,`in_progress`,`blocked`,`needs_input`,`in_review`,`done`],Et=[`low`,`normal`,`high`,`urgent`];function Dt(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 Ot(e){return e?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):``}function kt(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 At(e){return`${e.name}:${e.size}:${e.lastModified}`}function jt(e,t){return z(e,t)!==`unsupported`}function Mt(e,t){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:t===`image`||t===`audio`||t===`video`?t:`document`}function Nt(e,t){return{id:e.id,name:e.fileName,type:Mt(e.mimeType,e.type),mimeType:e.mimeType,size:e.size,...t?{content:t,preview:e.mimeType.startsWith(`image/`)?t:void 0}:{}}}async function Pt(e,t){let n=w(e.name||`upload`,e.type||`application/octet-stream`),r=R(await e.arrayBuffer());return{id:t,name:e.name||`upload`,type:Mt(n),mimeType:n,size:e.size,content:r,preview:n.startsWith(`image/`)?r:void 0}}function Ft(e){let t=(0,K.c)(3),[n,r]=(0,q.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,q.useEffect)(i,a),n}function It(e,t){let n=(0,K.c)(5),[r,i]=(0,q.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(Pe(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,q.useEffect)(a,o),r}function Lt(e){let t=(0,K.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)(W,{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 Rt(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 zt(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}function Bt(e,t){return e.nextAction||e.blockedReason||e.description||t.noNextAction}function Vt(e){let t=(0,K.c)(63),{item:n,dragging:r,onOpen:i,onToggleDone:o,onDragStart:c,onDragEnd:l,t:u}=e,d=n.status===`done`,f;t[0]!==n||t[1]!==c?(f=e=>c(n,e),t[0]=n,t[1]=c,t[2]=f):f=t[2];let p=u.dragToUpdate,m=r&&`opacity-50`,h;t[3]===m?h=t[4]:(h=s(`flex min-h-24 w-full min-w-0 max-w-full cursor-grab flex-col overflow-hidden rounded-lg bg-surface-panel px-3 py-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]:(_=s(`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]!==o?(b=()=>o(n),t[7]=n,t[8]=o,t[9]=b):b=t[9];let x;t[10]===d?x=t[11]:(x=d?(0,J.jsx)(le,{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=Bt(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=s(`rounded-full px-2 py-0.5 text-[11px] font-medium`,Dt(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)(qe,{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)(it,{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)(a,{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]!==l||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:l,title:p,className:h,children:[O,z]}),t[56]=l,t[57]=u.dragToUpdate,t[58]=f,t[59]=O,t[60]=z,t[61]=h,t[62]=B):B=t[62],B}function Ht(){let e=(0,K.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 Ut(e){let t=(0,K.c)(44),{file:n,index:r,busy:i,previewBusy:a,t:o,onOpen:c,onRemove:l}=e,u,d,f,p;t[0]===n?(u=t[1],d=t[2],f=t[3],p=t[4]):(u=w(n.name||`upload`,n.type||`application/octet-stream`),d=jt(n.name||`upload`,u),f=Ft,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,_;t[5]!==n||t[6]!==c?(_=()=>c(n),t[5]=n,t[6]=c,t[7]=_):_=t[7];let v;t[8]!==u||t[9]!==d||t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==m?(v=(0,J.jsx)(Lt,{name:h,mimeType:u,thumbnailUrl:m,previewable:d,disabled:g,onOpen:_}),t[8]=u,t[9]=d,t[10]=h,t[11]=g,t[12]=_,t[13]=m,t[14]=v):v=t[14];let y=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`,b;t[15]===y?b=t[16]:(b=s(`min-w-0 flex-1 text-left`,y),t[15]=y,t[16]=b);let x=!d||i||a,S;t[17]!==n||t[18]!==c?(S=()=>c(n),t[17]=n,t[18]=c,t[19]=S):S=t[19];let C=n.name||`upload`,T;t[20]===C?T=t[21]:(T=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:C}),t[20]=C,t[21]=T);let E;t[22]===n.size?E=t[23]:(E=kt(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]!==S||t[27]!==T||t[28]!==D||t[29]!==b||t[30]!==x?(O=(0,J.jsxs)(`button`,{type:`button`,className:b,disabled:x,onClick:S,children:[T,D]}),t[26]=S,t[27]=T,t[28]=D,t[29]=b,t[30]=x,t[31]=O):O=t[31];let k;t[32]!==r||t[33]!==l?(k=()=>l(r),t[32]=r,t[33]=l,t[34]=k):k=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(ie,{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]!==v?(M=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 py-2 text-sm`,children:[v,O,j]}),t[40]=O,t[41]=j,t[42]=v,t[43]=M):M=t[43],M}function Wt(e){let t=(0,K.c)(56),{item:n,attachment:r,busy:i,previewBusy:a,t:o,onOpen:c,onDownload:l,onRemove:u}=e,d;t[0]!==r.fileName||t[1]!==r.mimeType?(d=jt(r.fileName,r.mimeType),t[0]=r.fileName,t[1]=r.mimeType,t[2]=d):d=t[2];let f=d,p=It(n.id,r),m=i||a,h;t[3]!==r||t[4]!==n||t[5]!==c?(h=()=>c(n,r),t[3]=r,t[4]=n,t[5]=c,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)(Lt,{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=s(`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]!==c?(b=()=>c(n,r),t[16]=r,t[17]=n,t[18]=c,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=kt(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]!==l?(E=()=>l(n,r),t[33]=r,t[34]=n,t[35]=l,t[36]=E):E=t[36];let D;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,J.jsx)(Re,{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)(st,{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 px-2 py-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 Gt({mode:e,item:t,pendingFiles:n,busy:r,t:i,onPendingFilesChange:a,onUpload:o,onRemove:c,onDownload:l,onPreviewError:u}){let d=(0,q.useRef)(null),[f,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),S=p(e=>e.token),C=t?.attachments??[];function w(r){if(!r.length)return;if(e===`detail`&&t){o(t,r);return}let i=new Set(n.map(At)),s=[...n];for(let e of r){let t=At(e);i.has(t)||(i.add(t),s.push(e))}a(s)}function T(e){a(n.filter((t,n)=>n!==e))}async function E(e){let t=At(e);x(`pending:${t}`);try{y(await Pt(e,`pending:${t}`)),_(!0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{x(null)}}async function D(e,t){x(`saved:${t.id}`);try{let n=await m(Pe(e.id,t.id));if(!n.ok)throw Error(`HTTP ${n.status}`);y(Nt(t,R(await n.arrayBuffer()))),_(!0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{x(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:s(`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,f&&`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),w(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)(qe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate`,children:i.attachments.title})]}),(0,J.jsxs)(U,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:r,onClick:()=>d.current?.click(),children:[(0,J.jsx)(et,{className:`size-3.5`,"aria-hidden":!0}),i.attachments.add]}),(0,J.jsx)(`input`,{ref:d,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{w(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)(Ut,{file:e,index:t,busy:r,previewBusy:b===`pending:${At(e)}`,t:i,onOpen:e=>void E(e),onRemove:T},At(e)))}):null,t&&C.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:C.map(e=>(0,J.jsx)(Wt,{item:t,attachment:e,busy:r,previewBusy:b===`saved:${e.id}`,t:i,onOpen:(e,t)=>void D(e,t),onDownload:l,onRemove:c},e.id))}):null,!n.length&&!C.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:S,layerClassName:`z-[100]`,onClose:()=>{_(!1),y(null)}})]})}function Kt(e){let t=(0,K.c)(170),{mode:n,item:r,initialStatus:i,events:o,busy:c,error:l,notice:u,t:d,onClose:f,onCreate:p,onSave:m,onStartChat:h,onCreateGoal:g,onAddAttachments:_,onRemoveAttachment:v,onDownloadAttachment:y,onPreviewError:b}=e,x=n!==null,[C,w]=(0,q.useState)(``),[T,E]=(0,q.useState)(``),[D,O]=(0,q.useState)(`todo`),[k,A]=(0,q.useState)(`normal`),[j,M]=(0,q.useState)(``),[N,P]=(0,q.useState)(``),F;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(F=[],t[0]=F):F=t[0];let[I,L]=(0,q.useState)(F),R,z;t[1]!==i||t[2]!==r||t[3]!==n?(R=()=>{if(n===`create`){w(``),E(``),O(i),A(`normal`),M(``),P(``),L([]);return}n===`detail`&&r&&(w(r.title),E(r.description??``),O(r.status),A(r.priority),M(r.nextAction??``),P(r.blockedReason??``),L([]))},z=[i,r,n],t[1]=i,t[2]=r,t[3]=n,t[4]=R,t[5]=z):(R=t[4],z=t[5]),(0,q.useEffect)(R,z);let B;t[6]!==N||t[7]!==T||t[8]!==r||t[9]!==n||t[10]!==j||t[11]!==p||t[12]!==m||t[13]!==I||t[14]!==k||t[15]!==D||t[16]!==C?(B=function(e){e.preventDefault();let t=C.trim();if(t){if(n===`create`){p({title:t,description:T.trim()||void 0,priority:k,status:D,nextAction:j.trim()||void 0,blockedReason:N.trim()||void 0,attachments:I});return}r&&m(r,{title:t,description:T.trim()||null,status:D,priority:k,nextAction:j.trim()||null,blockedReason:N.trim()||null})}},t[6]=N,t[7]=T,t[8]=r,t[9]=n,t[10]=j,t[11]=p,t[12]=m,t[13]=I,t[14]=k,t[15]=D,t[16]=C,t[17]=B):B=t[17];let ee=B,V;t[18]===f?V=t[19]:(V=e=>!e&&f(),t[18]=f,t[19]=V);let te;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,J.jsx)(Ie,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[20]=te):te=t[20];let ne=n===`create`?d.create.title:r?.title||d.title,re;t[21]===ne?re=t[22]:(re=(0,J.jsx)(be,{className:`truncate text-base font-semibold text-fg`,children:ne}),t[21]=ne,t[22]=re);let H;t[23]===d.detail.description?H=t[24]:(H=(0,J.jsx)(We,{className:`mt-1 text-sm text-fg-muted`,children:d.detail.description}),t[23]=d.detail.description,t[24]=H);let ae;t[25]!==re||t[26]!==H?(ae=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[re,H]}),t[25]=re,t[26]=H,t[27]=ae):ae=t[27];let oe;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,J.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),t[28]=oe):oe=t[28];let se;t[29]===c?se=t[30]:(se=(0,J.jsx)(je,{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:c,children:oe})}),t[29]=c,t[30]=se);let ce;t[31]!==ae||t[32]!==se?(ce=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[ae,se]}),t[31]=ae,t[32]=se,t[33]=ce):ce=t[33];let de;t[34]===l?de=t[35]:(de=l?(0,J.jsx)(`div`,{className:`rounded-lg border border-danger/30 bg-danger-soft px-3 py-2 text-sm text-danger`,children:l}):null,t[34]=l,t[35]=de);let fe;t[36]!==l||t[37]!==u?(fe=!l&&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)(le,{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]=l,t[37]=u,t[38]=fe):fe=t[38];let pe;t[39]===d.create.titleLabel?pe=t[40]:(pe=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.titleLabel}),t[39]=d.create.titleLabel,t[40]=pe);let me;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(me=e=>w(e.target.value),t[41]=me):me=t[41];let he=n===`create`,ge;t[42]!==he||t[43]!==C?(ge=(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:C,onChange:me,autoFocus:he}),t[42]=he,t[43]=C,t[44]=ge):ge=t[44];let W;t[45]!==pe||t[46]!==ge?(W=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[pe,ge]}),t[45]=pe,t[46]=ge,t[47]=W):W=t[47];let _e;t[48]===d.detail.status?_e=t[49]:(_e=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.detail.status}),t[48]=d.detail.status,t[49]=_e);let ve;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>O(e.target.value),t[50]=ve):ve=t[50];let ye;t[51]===d.statuses?ye=t[52]:(ye=Tt.map(e=>(0,J.jsx)(S,{value:e,children:d.statuses[e]},e)),t[51]=d.statuses,t[52]=ye);let xe;t[53]!==D||t[54]!==ye?(xe=(0,J.jsx)(ue,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:D,onChange:ve,children:ye}),t[53]=D,t[54]=ye,t[55]=xe):xe=t[55];let Se;t[56]!==_e||t[57]!==xe?(Se=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[_e,xe]}),t[56]=_e,t[57]=xe,t[58]=Se):Se=t[58];let Ce;t[59]===d.create.priorityLabel?Ce=t[60]:(Ce=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.priorityLabel}),t[59]=d.create.priorityLabel,t[60]=Ce);let we;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(we=e=>A(e.target.value),t[61]=we):we=t[61];let Te;t[62]===d.priorities?Te=t[63]:(Te=Et.map(e=>(0,J.jsx)(S,{value:e,children:d.priorities[e]},e)),t[62]=d.priorities,t[63]=Te);let Ee;t[64]!==k||t[65]!==Te?(Ee=(0,J.jsx)(ue,{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:we,children:Te}),t[64]=k,t[65]=Te,t[66]=Ee):Ee=t[66];let Oe;t[67]!==Ce||t[68]!==Ee?(Oe=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ce,Ee]}),t[67]=Ce,t[68]=Ee,t[69]=Oe):Oe=t[69];let ke;t[70]!==Se||t[71]!==Oe?(ke=(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Se,Oe]}),t[70]=Se,t[71]=Oe,t[72]=ke):ke=t[72];let Ne;t[73]===d.create.descriptionLabel?Ne=t[74]:(Ne=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.descriptionLabel}),t[73]=d.create.descriptionLabel,t[74]=Ne);let Pe;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=e=>E(e.target.value),t[75]=Pe):Pe=t[75];let Fe;t[76]===T?Fe=t[77]:(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:T,onChange:Pe}),t[76]=T,t[77]=Fe);let Le;t[78]!==Ne||t[79]!==Fe?(Le=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ne,Fe]}),t[78]=Ne,t[79]=Fe,t[80]=Le):Le=t[80];let Re;t[81]!==c||t[82]!==r||t[83]!==n||t[84]!==_||t[85]!==y||t[86]!==b||t[87]!==v||t[88]!==I||t[89]!==d?(Re=(0,J.jsx)(Gt,{mode:n,item:r,pendingFiles:I,busy:c,t:d,onPendingFilesChange:L,onUpload:_,onRemove:v,onDownload:y,onPreviewError:b}),t[81]=c,t[82]=r,t[83]=n,t[84]=_,t[85]=y,t[86]=b,t[87]=v,t[88]=I,t[89]=d,t[90]=Re):Re=t[90];let ze;t[91]!==N||t[92]!==n||t[93]!==j||t[94]!==D||t[95]!==d.blockedReason||t[96]!==d.nextAction?(ze=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:j,onChange:e=>M(e.target.value)})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:s(`font-medium`,D===`blocked`||D===`needs_input`?`text-red-700 dark:text-red-300`:`text-fg-muted`),children:d.blockedReason}),(0,J.jsx)(`textarea`,{className:s(`min-h-20 rounded-lg border bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,D===`blocked`||D===`needs_input`?`border-red-500/40`:`border-edge`),value:N,onChange:e=>P(e.target.value)})]})]}):null,t[91]=N,t[92]=n,t[93]=j,t[94]=D,t[95]=d.blockedReason,t[96]=d.nextAction,t[97]=ze):ze=t[97];let Be;t[98]!==de||t[99]!==fe||t[100]!==W||t[101]!==ke||t[102]!==Le||t[103]!==Re||t[104]!==ze?(Be=(0,J.jsxs)(`div`,{className:`grid content-start gap-4`,children:[de,fe,W,ke,Le,Re,ze]}),t[98]=de,t[99]=fe,t[100]=W,t[101]=ke,t[102]=Le,t[103]=Re,t[104]=ze,t[105]=Be):Be=t[105];let Ve;t[106]!==c||t[107]!==r||t[108]!==n||t[109]!==g||t[110]!==h||t[111]!==d.detail.actions||t[112]!==d.detail.createGoal||t[113]!==d.detail.openItem||t[114]!==d.detail.startChat?(Ve=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)(U,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:c,onClick:()=>h(r),children:[(0,J.jsx)(Ae,{className:`size-4`,"aria-hidden":!0}),d.detail.startChat]}),(0,J.jsxs)(U,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:c,onClick:()=>g(r),children:[(0,J.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}),d.detail.createGoal]}),(0,J.jsx)(U,{asChild:!0,variant:`secondary`,className:`justify-start rounded-lg`,children:(0,J.jsxs)(a,{to:`/work-items/${encodeURIComponent(r.id)}`,children:[(0,J.jsx)(it,{className:`size-4`,"aria-hidden":!0}),d.detail.openItem]})})]})]}):null,t[106]=c,t[107]=r,t[108]=n,t[109]=g,t[110]=h,t[111]=d.detail.actions,t[112]=d.detail.createGoal,t[113]=d.detail.openItem,t[114]=d.detail.startChat,t[115]=Ve):Ve=t[115];let He;t[116]===d.detail.links?He=t[117]:(He=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.links}),t[116]=d.detail.links,t[117]=He);let Ue;t[118]!==r||t[119]!==d.detail.noLinks||t[120]!==d.linkKinds?(Ue=r?.links?.length?r.links.slice(0,6).map(e=>(0,J.jsxs)(a,{to:Rt(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)(it,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.detail.noLinks}),t[118]=r,t[119]=d.detail.noLinks,t[120]=d.linkKinds,t[121]=Ue):Ue=t[121];let Ke;t[122]===Ue?Ke=t[123]:(Ke=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2 text-sm`,children:Ue}),t[122]=Ue,t[123]=Ke);let qe;t[124]!==He||t[125]!==Ke?(qe=(0,J.jsxs)(`section`,{children:[He,Ke]}),t[124]=He,t[125]=Ke,t[126]=qe):qe=t[126];let Je;t[127]===d.detail.activity?Je=t[128]:(Je=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.activity}),t[127]=d.detail.activity,t[128]=Je);let Ye;t[129]!==o||t[130]!==d.detail.noActivity||t[131]!==d.eventTypes?(Ye=o.length?o.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:Ot(e.createdAt)})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.detail.noActivity}),t[129]=o,t[130]=d.detail.noActivity,t[131]=d.eventTypes,t[132]=Ye):Ye=t[132];let Xe;t[133]===Ye?Xe=t[134]:(Xe=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2`,children:Ye}),t[133]=Ye,t[134]=Xe);let Ze;t[135]!==Je||t[136]!==Xe?(Ze=(0,J.jsxs)(`section`,{children:[Je,Xe]}),t[135]=Je,t[136]=Xe,t[137]=Ze):Ze=t[137];let $e;t[138]!==Ve||t[139]!==qe||t[140]!==Ze?($e=(0,J.jsxs)(`aside`,{className:`grid content-start gap-5`,children:[Ve,qe,Ze]}),t[138]=Ve,t[139]=qe,t[140]=Ze,t[141]=$e):$e=t[141];let G;t[142]!==Be||t[143]!==$e?(G=(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:[Be,$e]}),t[142]=Be,t[143]=$e,t[144]=G):G=t[144];let tt;t[145]!==c||t[146]!==f||t[147]!==d.create.cancel?(tt=(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:f,disabled:c,children:d.create.cancel}),t[145]=c,t[146]=f,t[147]=d.create.cancel,t[148]=tt):tt=t[148];let nt;t[149]!==c||t[150]!==C?(nt=c||!C.trim(),t[149]=c,t[150]=C,t[151]=nt):nt=t[151];let rt;t[152]===n?rt=t[153]:(rt=n===`create`?(0,J.jsx)(et,{className:`size-4`,"aria-hidden":!0}):null,t[152]=n,t[153]=rt);let at=n===`create`?d.create.submit:d.detail.save,ot;t[154]!==nt||t[155]!==rt||t[156]!==at?(ot=(0,J.jsxs)(U,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:nt,children:[rt,at]}),t[154]=nt,t[155]=rt,t[156]=at,t[157]=ot):ot=t[157];let st;t[158]!==tt||t[159]!==ot?(st=(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[tt,ot]}),t[158]=tt,t[159]=ot,t[160]=st):st=t[160];let ct;t[161]!==ee||t[162]!==ce||t[163]!==G||t[164]!==st?(ct=(0,J.jsxs)(Me,{children:[te,(0,J.jsx)(Qe,{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:ee,className:`flex min-h-0 flex-1 flex-col`,children:[ce,G,st]})})]}),t[161]=ee,t[162]=ce,t[163]=G,t[164]=st,t[165]=ct):ct=t[165];let lt;return t[166]!==x||t[167]!==V||t[168]!==ct?(lt=(0,J.jsx)(De,{open:x,onOpenChange:V,children:ct}),t[166]=x,t[167]=V,t[168]=ct,t[169]=lt):lt=t[169],lt}function qt({projectId:e,createRequestKey:t=0}){let n=i(),r=d(f(e=>e.language)).projectDetailPage.workItems,a=(0,q.useRef)(null),o=(0,q.useRef)(null),[c,l]=(0,q.useState)([]),[u,p]=(0,q.useState)(!0),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(null),[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(`todo`),[M,N]=(0,q.useState)(null),[P,F]=(0,q.useState)([]),I=(0,q.useCallback)(async(t=`replace`,n=0)=>{p(!0),h(null);try{let r=await we(e,{limit:100,offset:n});l(e=>t===`append`?[...e,...r.items]:r.items),D(r.hasMore)}catch(e){h(e instanceof Error?e.message:String(e))}finally{p(!1)}},[e]);(0,q.useEffect)(()=>{I(`replace`,0)},[I]),(0,q.useEffect)(()=>{t&&(N(null),F([]),h(null),_(null),j(`todo`),k(!0))},[t]);let L=(0,q.useMemo)(()=>Tt.map(e=>({status:e,title:r.statuses[e],items:c.filter(t=>t.status===e)})),[c,r.statuses]),R=(0,q.useCallback)(e=>{l(t=>t.map(t=>t.id===e.id?e:t)),N(t=>t?.id===e.id?e:t)},[]),z=(0,q.useCallback)(async(e,t)=>{y(!0),h(null),_(null);try{let n=await Te(e.id,t);n.item.archivedAt?(l(e=>e.filter(e=>e.id!==n.item.id)),N(null)):(R(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,R]),B=(0,q.useCallback)(async e=>{N(e),F([]),h(null),_(null);let t=await at(e.id).catch(()=>null);t&&F(t.events)},[]),ee=(0,q.useCallback)(async t=>{y(!0),h(null),_(null);try{let n=await Le(e,t);l(e=>[n.item,...e]),k(!1),N(n.item),F((await at(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]),V=(0,q.useCallback)(async(e,t)=>{if(t.length){y(!0),h(null),_(null);try{let n=await He(e.id,t);R(n.item),F((await at(n.item.id).catch(()=>({events:[]}))).events)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}}},[R]),te=(0,q.useCallback)(async(e,t)=>{y(!0),h(null),_(null);try{let n=await Ye(e.id,t.id);R(n.item),F((await at(n.item.id).catch(()=>({events:[]}))).events)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[R]),ne=(0,q.useCallback)(async(e,t)=>{h(null),_(null);try{await tt(e.id,t)}catch(e){h(e instanceof Error?e.message:String(e))}},[]),re=(0,q.useCallback)(async e=>{y(!0),h(null),_(null);try{let t=await Oe(e.id);R(t.item),await B(t.item),n(`/chat/${encodeURIComponent(t.session.key)}`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[n,B,R]),H=(0,q.useCallback)(async e=>{y(!0),h(null),_(null);try{let t=await xe(e.id);R(t.item),await B(t.item),n(`/goals/${encodeURIComponent(t.goal.id)}`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[n,B,R]),ie=(0,q.useCallback)((e,t)=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(wt,e.id),x(e.id)},[]),ae=(0,q.useCallback)((e,t)=>{t.preventDefault();let n=t.dataTransfer.getData(wt)||b;C(null),x(null);let r=c.find(e=>e.id===n);!r||r.status===e||z(r,{status:e})},[b,c,z]),oe=(0,q.useCallback)(e=>{z(e,{status:e.status===`done`?`todo`:`done`})},[z]),se=(0,q.useCallback)(e=>{N(null),F([]),h(null),_(null),j(e),k(!0)},[]),ce=(0,q.useCallback)(e=>{let t=o.current;!t||t.pointerId!==e.pointerId||(o.current=null,T(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),le=(0,q.useCallback)(e=>{if(e.button!==0||b||zt(e.target))return;let t=a.current;t&&(o.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[b]),ue=(0,q.useCallback)(e=>{let t=o.current,n=a.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,T(!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:a,className:s(`min-h-0 flex-1 overflow-x-auto rounded-lg px-2 py-2 transition-opacity`,u&&`opacity-60`,w?`cursor-grabbing select-none`:`cursor-grab`),"aria-label":r.boardAria,"aria-busy":u,onPointerDown:le,onPointerMove:ue,onPointerUp:ce,onPointerCancel:ce,onLostPointerCapture:e=>{o.current?.pointerId===e.pointerId&&(o.current=null,T(!1))},children:(0,J.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:L.map(e=>(0,J.jsxs)(`section`,{className:s(`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`,S===e.status&&`bg-surface-active`),"aria-label":e.title,onDragOver:t=>{b&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,C(e.status))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||C(null)},onDrop:t=>ae(e.status,t),children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 px-3 py-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)(Je,{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)(Vt,{item:e,dragging:b===e.id,onOpen:B,onToggleDone:oe,onDragStart:ie,onDragEnd:()=>{x(null),C(null)},t:r},e.id)):u?(0,J.jsxs)(`div`,{className:`grid gap-2 animate-pulse motion-reduce:animate-none`,children:[(0,J.jsx)(Ht,{}),(0,J.jsx)(Ht,{})]}):(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:()=>se(e.status),children:(0,J.jsx)(et,{className:`size-4`,"aria-hidden":!0})})]})]},e.status))})}),!u&&E?(0,J.jsx)(U,{type:`button`,variant:`secondary`,className:`justify-self-center`,onClick:()=>void I(`append`,c.length),children:r.loadMore}):null,(0,J.jsx)(Kt,{mode:O?`create`:M?`detail`:null,item:M,initialStatus:A,events:P,busy:v,error:m,notice:g,t:r,onClose:()=>{k(!1),N(null),F([]),h(null),_(null)},onCreate:ee,onSave:(e,t)=>void z(e,t),onStartChat:re,onCreateGoal:H,onAddAttachments:(e,t)=>void V(e,t),onRemoveAttachment:(e,t)=>void te(e,t),onDownloadAttachment:(e,t)=>void ne(e,t),onPreviewError:e=>{_(null),h(e)}})]})}var Jt=[{id:`overview`,icon:V},{id:`work-items`,icon:b},{id:`sessions`,icon:Ae},{id:`goals`,icon:Ge},{id:`workflows`,icon:ge},{id:`files`,icon:k},{id:`activity`,icon:M},{id:`automations`,icon:_e},{id:`notes`,icon:he},{id:`settings`,icon:g}],Yt=new Set(Jt.map(e=>e.id)),Xt=`xopc.projectFiles.panelWidthPx`,Zt=320,Qt=220,$t=560;function en(e){return Math.min($t,Math.max(Qt,Math.round(e)))}function tn(){try{let e=window.localStorage.getItem(Xt);if(e==null)return Zt;let t=Number.parseInt(e,10);return Number.isFinite(t)?en(t):Zt}catch{return Zt}}function nn(e){try{window.localStorage.setItem(Xt,String(en(e)))}catch{}}function rn(e){return!!(e&&Yt.has(e))}function an(e){return e===`overview`?`overview`:e===`work-items`||e===`goals`||e===`workflows`||e===`automations`?`work`:`context`}function on(e){return e===`work`?`work-items`:e===`context`?`files`:`overview`}function sn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function cn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(n)}function ln(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 un(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 dn(e){let t=(0,K.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 fn(e=!1){return s(`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 pn(e){let t=(0,K.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 c=a&&`font-mono text-xs`,l;t[2]===c?l=t[3]:(l=s(`mt-1 min-w-0 truncate text-sm text-fg`,c),t[2]=c,t[3]=l);let u;t[4]!==l||t[5]!==r?(u=(0,J.jsx)(`div`,{className:l,title:r,children:r}),t[4]=l,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 hn(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function gn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function _n(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function vn(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 yn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function bn(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 xn(e){let t=e.sourceChannel?.trim();if(t)return Sn(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 Sn(r||``)}function Sn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Cn(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 wn(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 Tn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Tn(e.children,t,n)}:e)}function En({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)([e]),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),[_,v]=(0,q.useState)(null),[y,b]=(0,q.useState)(!1),[x,S]=(0,q.useState)(`new`),[C,w]=(0,q.useState)(``),[E,D]=(0,q.useState)(``),[A,j]=(0,q.useState)(!1),[M,N]=(0,q.useState)(null),[P,F]=(0,q.useState)(null),I=(0,q.useCallback)(async()=>{h(!0),v(null);try{let t=await lt({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){v(e instanceof Error?e.message:String(e))}finally{h(!1)}},[e]);(0,q.useEffect)(()=>{d(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,q.useEffect)(()=>{o&&I()},[I,o]);let L=(0,q.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)=>hn(t)-hn(e))},[e.id,u,f]),R=e=>t.statuses[e.status]??e.status,z=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,ee=e=>{S(e),w(``),D(``),N(null),b(!0),l(!1)},V=(0,q.useCallback)(async(e={})=>{let t=E.trim(),n=C.trim()||(x===`directory`?gn(t):``);if(n){j(!0),N(null),F(null);try{let r=await ke({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});b(!1),w(``),D(``),d(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=_n(e);t?(F(t),b(!1)):N(e instanceof Error?e.message:String(e))}finally{j(!1)}}},[x,C,a,E]),te=(0,q.useCallback)(e=>{e.preventDefault(),V()},[V]),ne=(0,q.useCallback)(()=>{V({createWorkspaceRoot:!0})},[V]),ie=(0,q.useCallback)(()=>{F(null),b(!0)},[]),ae=e=>{D(e),x===`directory`&&!C.trim()&&w(gn(e))},oe=(e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:s(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md px-2 py-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:()=>{l(!1),t||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,J.jsx)(c,{className:s(`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:z(e)})]}),(0,J.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,ln(e.status)),children:R(e)})]},e.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(T,{open:o,onOpenChange:l,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`group -ml-2 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:s(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,ln(e.status)),children:R(e)})]}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:z(e)})]}),(0,J.jsx)(Be,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,J.jsx)(re,{children:(0,J.jsxs)(B,{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)(H,{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}),oe(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}),_?(0,J.jsx)(`div`,{className:`px-2 py-2 text-xs text-red-600 dark:text-red-400`,children:_}):null,m&&L.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!m&&L.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,L.map(e=>oe(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:()=>ee(`new`),children:[(0,J.jsx)(et,{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:()=>ee(`directory`),children:[(0,J.jsx)(k,{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:()=>{l(!1),a(`/projects`)},children:[(0,J.jsx)(g,{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)(De,{open:y,onOpenChange:e=>!A&&b(e),children:(0,J.jsxs)(Me,{children:[(0,J.jsx)(Ie,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(Qe,{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)(be,{className:`text-base font-semibold text-fg`,children:x===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,J.jsx)(We,{className:`mt-1 text-sm text-fg-muted`,children:x===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,J.jsxs)(`form`,{onSubmit:te,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:[M?(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:M}):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:C,onChange:e=>w(e.target.value),placeholder:`xopc`,autoFocus:!0})]}),(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)(bt,{value:E,onChange:ae,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)(je,{asChild:!0,children:(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:A,children:n.cancel})}),(0,J.jsxs)(U,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:A||!(C.trim()||x===`directory`&&gn(E)),children:[(0,J.jsx)(et,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,J.jsx)(De,{open:!!P,onOpenChange:e=>{e||F(null)},children:(0,J.jsxs)(Me,{children:[(0,J.jsx)(Ie,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(Qe,{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)(be,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,J.jsx)(We,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:P?sn(n.workspaceMissingDescription,{workspace:P}):null})]}),P?(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)(k,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:P})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ie,disabled:A,children:n.workspaceMissingBack}),(0,J.jsxs)(U,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ne,disabled:A,children:[(0,J.jsx)($e,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Dn(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),c=d(f(e=>e.language)),p=c.chat.workingDirectory,m=c.projectDetailPage,g=c.projectsPage,w=Ve(e=>e.setPageHeader),M=Ve(e=>e.clearPageHeader),[R,le]=(0,q.useState)(null),[W,xe]=(0,q.useState)(null),[we,Te]=(0,q.useState)([]),[Oe,ke]=(0,q.useState)(``),[Pe,Le]=(0,q.useState)([]),[Re,He]=(0,q.useState)([]),[Ge,qe]=(0,q.useState)([]),[Je,Ye]=(0,q.useState)([]),[G,tt]=(0,q.useState)([]),[it,at]=(0,q.useState)(!1),[lt,K]=(0,q.useState)(null),[wt,Tt]=(0,q.useState)([]),[Et,Dt]=(0,q.useState)(0),[Ot,kt]=(0,q.useState)(!1),[At,jt]=(0,q.useState)(!1),[Mt,Nt]=(0,q.useState)(!1),[Pt,Ft]=(0,q.useState)([]),It=(0,q.useRef)(new Set),[Lt,Rt]=(0,q.useState)(null),[zt,Bt]=(0,q.useState)(tn),[Vt,Ht]=(0,q.useState)(!1),[Ut,Wt]=(0,q.useState)(!1),[Gt,Kt]=(0,q.useState)(``),[Yt,Xt]=(0,q.useState)([]),[Zt,Qt]=(0,q.useState)(!1),[$t,mn]=(0,q.useState)(null),[hn,gn]=(0,q.useState)(!1),[Sn,Dn]=(0,q.useState)(null),[On,kn]=(0,q.useState)([]),[Y,An]=(0,q.useState)(``),[jn,Mn]=(0,q.useState)(!0),[Nn,Pn]=(0,q.useState)(!1),[Fn,In]=(0,q.useState)(!1),[Ln,Rn]=(0,q.useState)(null),[zn,Bn]=(0,q.useState)(!1),[X,Vn]=(0,q.useState)(`fixed`),[Hn,Un]=(0,q.useState)(``),[Wn,Gn]=(0,q.useState)(null),[Kn,qn]=(0,q.useState)(!1),[Jn,Yn]=(0,q.useState)(!1),[Xn,Zn]=(0,q.useState)(0),[Qn,$n]=(0,q.useState)(!1),[er,tr]=(0,q.useState)(null),[nr,rr]=(0,q.useState)(!1),[ir,ar]=(0,q.useState)(!1),[or,sr]=(0,q.useState)(!1),[cr,Z]=(0,q.useState)(null),[lr,ur]=(0,q.useState)({defaultAgentId:``,agents:[],models:[],checklistDecomposePolicy:`empty_only`}),[dr,fr]=(0,q.useState)({title:``,reason:``}),[Q,pr]=(0,q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),mr=`overview`,$=n?`notes`:rn(t)?t:mr,hr=(0,q.useCallback)(t=>{e&&r(`/projects/${encodeURIComponent(e)}/${t}`)},[r,e]),gr=(0,q.useCallback)(t=>e?`/projects/${encodeURIComponent(e)}/${t}`:`/projects`,[e]),_r=(0,q.useCallback)(e=>{let t=gr(`goals`);return`/goals/${encodeURIComponent(e)}?returnTo=${encodeURIComponent(t)}`},[gr]),vr=(0,q.useCallback)(t=>{e&&r(gr(t),{replace:!0})},[r,e,gr]),yr=(0,q.useCallback)((e,t)=>{vr(e),r(t)},[r,vr]),br=(0,q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||vr(e)},[vr]),xr=(0,q.useCallback)(e=>e.startsWith(`/goals/`)?`goals`:e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/workflows`)?`workflows`:e.startsWith(`/automations`)?`automations`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,q.useEffect)(()=>{!e||!t||rn(t)||r(`/projects/${encodeURIComponent(e)}/${mr}`,{replace:!0})},[mr,r,e,t]),(0,q.useEffect)(()=>{if(!e)return;let t=!1;return Mn(!0),Z(null),Promise.all([se(e),y(e),dt(e),de().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;let a=e.project;le(a),xe(e),Te(n),Le(r),kn(i?.agents??[]),An(a.defaultAgentId??``),pr({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||Mn(!1)}),()=>{t=!0}},[e]),(0,q.useEffect)(()=>{let e=!1;async function t(){let[t,n,r]=await Promise.allSettled([de(),I(),j()]);e||ur(e=>{let i=t.status===`fulfilled`?t.value.defaultId:e.defaultAgentId,a=R?.defaultAgentId||Y||i,o=t.status===`fulfilled`?t.value.agents:e.agents,s=n.status===`fulfilled`?n.value:e.models,c=r.status===`fulfilled`?xt(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}},[R?.defaultAgentId,Y]);let Sr=(0,q.useCallback)(async()=>{if(R){$n(!0),Z(null);try{let[e,t]=await Promise.all([Ke(),Ne(100,{ownerAgentId:Y||void 0,projectId:R.id})]);He(e),qe(t)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{$n(!1)}}},[R,Y]);(0,q.useEffect)(()=>{R&&Sr()},[R,Sr]);let Cr=(0,q.useCallback)(async()=>{if(R){at(!0),Z(null);try{let[e,t]=await Promise.all([ut.list({projectId:R.id}),ut.runs(50,void 0,{projectId:R.id})]);Ye(e.automations),tt(t.runs)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{at(!1)}}},[R]);(0,q.useEffect)(()=>{$===`automations`&&Cr()},[Cr,$]);let wr=(0,q.useCallback)(async()=>{if(R){kt(!0),Z(null);try{let e=await pt(R.id,{includeRelated:At,limit:100});Tt(e.items),Dt(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{kt(!1)}}},[R,At]);(0,q.useEffect)(()=>{$===`activity`&&wr()},[wr,$]);let Tr=(0,q.useCallback)(async e=>{K(`run:${e.id}`),Z(null);try{await ut.runNow(e.id),await Cr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{K(null)}},[Cr]),Er=(0,q.useCallback)(async e=>{K(`toggle:${e.id}`),Z(null);try{e.enabled?await ut.pause(e.id):await ut.resume(e.id),await Cr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{K(null)}},[Cr]),Dr=(0,q.useCallback)(async()=>{if(!R?.effectiveWorkspaceRoot?.trim()){Ft([]),It.current.clear(),Dn(null);return}gn(!0),Dn(null),It.current.clear();try{Ft(wn((await Ce(R.id,``)).entries)),It.current.add(``)}catch(e){Ft([]),It.current.clear(),Dn(e instanceof Error?e.message:String(e))}finally{gn(!1)}},[R]),Or=(0,q.useCallback)(async e=>{if(!(!R?.effectiveWorkspaceRoot?.trim()||It.current.has(e))){It.current.add(e),Dn(null);try{let t=await Ce(R.id,e);Ft(n=>Tn(n,e,wn(t.entries)))}catch(t){It.current.delete(e),Dn(t instanceof Error?t.message:String(t))}}},[R]);(0,q.useEffect)(()=>{$===`files`&&Dr()},[Dr,$]);let kr=Gt.trim();(0,q.useEffect)(()=>{if($!==`files`||!R||!Ut||!kr){Xt([]),Qt(!1),mn(null);return}let e=!1;Qt(!0),mn(null),Xt([]);let t=window.setTimeout(()=>{ee(R.id,kr,50).then(t=>{e||Xt(t)}).catch(t=>{e||mn(t instanceof Error?t.message:String(t))}).finally(()=>{e||Qt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[kr,R,Ut,$]);let Ar=(0,q.useCallback)(async()=>{if(R){Yn(!0),Z(null);try{let e=await Fe(R.id);yr(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Yn(!1)}}},[yr,R]),jr=(0,q.useCallback)(()=>{hr(`work-items`),Zn(e=>e+1)},[hr]),Mr=(0,q.useCallback)(async()=>{if(!R)return;let[e,t]=await Promise.all([se(R.id),dt(R.id)]);xe(e),le(e.project),Le(t)},[R]),Nr=(0,q.useCallback)(async e=>{if(!R||!e.title.trim())return;let t=Number.parseInt(e.maxTurns,10),n=e.deadline?new Date(e.deadline).getTime():void 0;rr(!0),Z(null);try{await Ue(R.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:St(e.evidencePlan),criteria:St(e.checklist)}}),sr(!1),hr(`goals`),await Mr()}catch(e){throw Z(e instanceof Error?e.message:String(e)),e}finally{rr(!1)}},[hr,R,Mr]),Pr=(0,q.useCallback)(async e=>{if(e.preventDefault(),!(!R||!dr.title.trim())){ar(!0),Z(null);try{await Xe(R.id,{title:dr.title.trim(),reason:dr.reason.trim()||void 0}),fr({title:``,reason:``}),await Mr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ar(!1)}}},[dr.reason,dr.title,R,Mr]),Fr=(0,q.useCallback)(async e=>{if(R){tr(`retry:${e.id}`),Z(null);try{let t=await mt(e.id,{ownerAgentId:Y||e.metadata?.agentId,projectId:e.metadata?.projectId||R.id});await Sr(),yr(`workflows`,ht(t.runId,{ownerAgentId:Y||e.metadata?.agentId||R.defaultAgentId}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{tr(null)}}},[yr,R,Sr,Y]),Ir=(0,q.useCallback)(async e=>{tr(`cancel:${e.id}`),Z(null);try{await Se(e.id,{ownerAgentId:Y||e.metadata?.agentId}),await Sr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{tr(null)}},[Sr,Y]),Lr=(0,q.useMemo)(()=>(0,J.jsx)(a,{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)(pe,{className:`size-4`,"aria-hidden":!0})}),[m.backToProjects]),Rr=(0,q.useMemo)(()=>R?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(U,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:jr,children:[(0,J.jsx)(et,{className:`size-4`,"aria-hidden":!0}),m.workItems.create.header]}),(0,J.jsxs)(U,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void Ar(),disabled:Jn,children:[(0,J.jsx)(Ae,{className:`size-4`,"aria-hidden":!0}),m.common.newChat]})]}):null,[jr,m.common.newChat,m.workItems.create.header,R,Ar,Jn]);(0,q.useLayoutEffect)(()=>(w({startExtra:Lr,main:R?(0,J.jsx)(En,{currentProject:R,pm:m,projectsText:g,wd:p}):(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:Rr}),()=>M()),[M,Rr,Lr,m,R,g,w,p]);function zr(e){le(t=>t?{...t,...e}:null),xe(t=>t?{...t,project:{...t.project,...e}}:null),An(e.defaultAgentId??``),pr(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 Br(){if(!(!R||!Q.name.trim())){Pn(!0),Z(null),Rn(null);try{zr(await h(R.id,{name:Q.name.trim(),status:Q.status,description:Q.description,defaultAgentId:Q.defaultAgentId,brief:Q.brief,instructions:Q.instructions}))}catch(e){let t=_n(e);t?Rn(t):Z(e instanceof Error?e.message:String(e))}finally{Pn(!1)}}}function Vr(e){e.preventDefault(),Br()}let Hr=(0,q.useCallback)(()=>{if(!R)return;let e=R.workspaceRoot?.trim()??``;Vn(e?`fixed`:`follow`),Un(e||R.effectiveWorkspaceRoot||``),Bn(!0)},[R]);async function Ur(e={}){if(!R)return;let t=X===`fixed`?Hn.trim():``;if(!(X===`fixed`&&!t)){Pn(!0),Z(null),Rn(null);try{zr(await h(R.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}})),Bn(!1),Rn(null)}catch(e){let t=_n(e);t?(Rn(t),Bn(!1)):Z(e instanceof Error?e.message:String(e))}finally{Pn(!1)}}}async function Wr(){if(!(!R||Wn)){Gn(`pin`),Z(null);try{zr(R.pinnedAt?await ze(R.id):await ce(R.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Gn(null)}}}async function Gr(){if(!(!R||Wn)){Gn(`archive`),Z(null);try{zr(R.status===`archived`?await C(R.id):await Ee(R.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Gn(null)}}}async function Kr(){if(R){qn(!0),Z(null);try{await ye(R.id),In(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{qn(!1)}}}async function qr(){if(!(!R||Mt)){Nt(!0),Z(null);try{await x(R.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Nt(!1)}}}let Jr=(0,q.useCallback)(e=>{Rt(e)},[]),Yr=(0,q.useCallback)((e,t)=>{t||Rt(e)},[]),Xr=(0,q.useCallback)(async(e,t,n)=>{let r=R?.id;if(r)switch(e){case`preview`:t.isDirectory||Rt(t.path);break;case`download`:if(t.isDirectory)return;try{let e=ne(t.path);if(D(z(e))!==`text`){let n=await gt(t.path,{projectId:r}),i=te(e)??`application/octet-stream`;N(e,await n.arrayBuffer(),i)}else{let{content:n}=await v(t.path,{projectId:r});oe(e,n)}}catch(e){fe(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await u(t.absolutePath??t.path)&&fe(`success`,c.workspace.pathCopied,void 0,{duration:2500})}catch{fe(`warning`,c.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}},[c.clipboard.copyFailed,c.workspace.pathCopied,R?.id]),Zr=(0,q.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),Ht(!0);let r=e.clientX,i=zt,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=en(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ht(!1),Bt(c),nn(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)},[zt]);if((0,q.useEffect)(()=>{$!==`files`&&Rt(null)},[e,$]),jn)return(0,J.jsx)(`main`,{className:`w-full flex-1 px-3 py-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:m.loading});if(!R)return(0,J.jsxs)(`main`,{className:`w-full flex-1 px-3 py-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(a,{to:`/projects`,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,J.jsx)(pe,{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:cr||m.notFound})]});let Qr=W?.recentSessions.length?W.recentSessions:R.recentSessions,$r=W?.attentionItems??[],ei=e=>m.statuses[e]??e,ti=e=>sn(m.common.messages,{count:e}),ni=Oe.trim().toLowerCase(),ri=ni?we.filter(e=>{let t=cn(e.updatedAt),n=e.routing?.agentId||e.agentId||m.common.agent,r=e.name?.trim()||m.sessions.fallbackTitle,i=ti(e.messageCount??0),a=xn(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(ni)}):we,ii=we.length>0&&ri.length===0,ai=On.find(e=>e.id===Q.defaultAgentId)?.name||Q.defaultAgentId||m.settings.globalDefaultAgent,oi=On.find(e=>e.id===Q.defaultAgentId),si=R.workspaceRoot?.trim()||``,ci=R.status===`archived`,li=!!R.pinnedAt,ui=!si,di=si||oi?.workspace||R.effectiveWorkspaceRoot||m.common.defaultWorkspace,fi=X===`fixed`?Hn.trim()||m.settings.workspacePlaceholder:oi?.workspace||R.effectiveWorkspaceRoot||m.common.defaultWorkspace,pi=(X===`fixed`?Hn.trim():``)!==si&&(X===`follow`||!!Hn.trim()),mi=[{id:`overview`,icon:V,label:m.surfaceTabs.overview},{id:`work`,icon:b,label:m.surfaceTabs.work},{id:`context`,icon:k,label:m.surfaceTabs.context}],hi=Jt.filter(e=>e.id!==`overview`&&e.id!==`work-items`&&e.id!==`files`);async function gi(){if(!di)return;let e=await u(di);fe(e?`success`:`warning`,e?c.workspace.pathCopied:c.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function _i(){Rn(null),Bn(!0)}return(0,J.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden px-3 py-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)(yt,{items:mi,activeTab:an($),onChange:e=>hr(on(e)),ariaLabel:m.navAria,tabIdPrefix:`project-surface-tab`,className:`min-w-0 flex-1`}),(0,J.jsxs)(T,{children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsxs)(U,{type:`button`,variant:hi.some(e=>e.id===$)?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,children:[m.surfaceTabs.details,(0,J.jsx)(Be,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,J.jsx)(re,{children:(0,J.jsx)(B,{align:`end`,sideOffset:6,className:`z-[70] w-48 rounded-xl border border-edge bg-surface-panel p-1.5 shadow-float`,children:hi.map(e=>{let t=e.icon,n=e.id===`work-items`?m.workItems.tab:m.tabs[e.id];return(0,J.jsx)(L,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:s(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm hover:bg-surface-hover`,$===e.id?`bg-accent-soft text-accent-fg`:`text-fg-muted`),onClick:()=>hr(e.id),children:[(0,J.jsx)(t,{className:`size-4`,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:n})]})},e.id)})})})]})]}),cr?(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:cr}):null,(0,J.jsxs)(`div`,{className:s(`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-surface-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:W?.digest?.summary||W?.recommendedAction||R.description||R.brief||m.overview.directionFallback}),W?.digest?.nextAction?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:sn(m.overview.recommendedNext,{action:W.digest.nextAction})}):null]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,J.jsxs)(U,{type:`button`,variant:`secondary`,onClick:()=>void qr(),disabled:Mt,children:[(0,J.jsx)(F,{className:`size-4`,"aria-hidden":!0}),Mt?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)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>sr(!0),children:[(0,J.jsx)(et,{className:`size-4`,"aria-hidden":!0}),m.overview.goal]})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:W?.nextActions.length?W.nextActions.map(e=>(0,J.jsxs)(a,{to:_r(e.goalId),onClick:br(`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:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,ln(e.status)),children:ei(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}),$r.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-3`,children:$r.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)(l,{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?` · ${ei(e.status)}`:``]})]});return e.href?(0,J.jsx)(a,{to:e.href,onClick:br(xr(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:Pr,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:dr.title,onChange:e=>fr(t=>({...t,title:e.target.value})),placeholder:m.overview.blockerTitlePlaceholder}),(0,J.jsx)(U,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:ir||!dr.title.trim(),"aria-label":ir?m.overview.addingBlocker:m.overview.addBlocker,title:ir?m.overview.addingBlocker:m.overview.addBlocker,children:(0,J.jsx)(et,{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)(Ze,{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:()=>hr(`sessions`),children:m.common.viewAll})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Qr.length?Qr.map(e=>(0,J.jsxs)(a,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:br(`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:cn(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.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-work`,children:[(0,J.jsxs)(`div`,{className:`mb-3 flex shrink-0 flex-wrap items-center justify-between gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-3 py-2`,children:[(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.surfaceTabs.workHint}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[`goals`,`workflows`,`automations`].map(e=>(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,onClick:()=>hr(e),children:m.tabs[e]},e))})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,J.jsx)(qt,{projectId:R.id,createRequestKey:Xn})})]}):null,$===`workflows`?(0,J.jsxs)(`section`,{id:`project-panel-workflows`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-work`,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)(U,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Sr(),disabled:Qn,children:[(0,J.jsx)(_t,{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:Qn&&Ge.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.workflows.loadingRuns}):Ge.length?Ge.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:()=>yr(`workflows`,ht(e.id,{ownerAgentId:Y||e.metadata?.agentId||R.defaultAgentId})),children:e.title||e.definitionId}),(0,J.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,un(e.status)),children:ei(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:sn(m.workflows.runMeta,{definitionId:e.definitionId,done:e.metrics.doneAgentCount,total:e.metrics.agentCount,time:cn(e.createdAtMs)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>yr(`workflows`,ht(e.id,{ownerAgentId:Y||e.metadata?.agentId||R.defaultAgentId})),children:m.common.open}),n?(0,J.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:er===`retry:${e.id}`,onClick:()=>void Fr(e),children:[(0,J.jsx)(_t,{className:`size-3.5`,"aria-hidden":!0}),m.common.retry]}):null,t?(0,J.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:er===`cancel:${e.id}`,onClick:()=>void Ir(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:Re.length?Re.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(R.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)(ge,{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-surface-tab-work`,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)(U,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Cr(),disabled:it,children:[(0,J.jsx)(_t,{className:`size-4`,"aria-hidden":!0}),m.common.refresh]}),(0,J.jsxs)(U,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>yr(`automations`,`/automations?projectId=${encodeURIComponent(R.id)}&action=create`),children:[(0,J.jsx)(et,{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:it&&Je.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.automations.loading}):Je.length?Je.map(e=>{let t=G.find(t=>t.automationId===e.id),n=e.state.runningRunId?G.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:()=>yr(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,J.jsx)(`span`,{className:s(`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:sn(m.common.lastRun,{trigger:e.trigger.kind,action:e.action.kind,time:t?cn(t.createdAtMs):m.common.never})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:lt===`run:${e.id}`||!!n,onClick:()=>void Tr(e),children:[(0,J.jsx)(ge,{className:`size-3.5`,"aria-hidden":!0}),m.automations.run]}),(0,J.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:lt===`toggle:${e.id}`,onClick:()=>void Er(e),children:[e.enabled?(0,J.jsx)(rt,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(ge,{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)(U,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>yr(`automations`,`/automations?projectId=${encodeURIComponent(R.id)}&action=create`),children:[(0,J.jsx)(_e,{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:G.length?G.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:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,un(e.status)),children:ei(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:cn(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:R.workspaceRoot||R.effectiveWorkspaceRoot||m.common.defaultWorkspace})]})]})]}):null,$===`notes`?(0,J.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,J.jsx)(vt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(R.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,listTag:`project:${R.id}`,captureTags:[`project:${R.id}`,R.slug],listTitle:m.notes.title,listDescription:m.notes.hint,emptyText:m.notes.emptyTitle,emptyDescription:m.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${R.id}`})}):null,$===`files`?(0,J.jsxs)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,className:`flex h-full min-h-[28rem] flex-col gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-start justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 max-w-3xl`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.surfaceTabs.contextTitle}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:R.brief||R.instructions||R.description||m.surfaceTabs.contextFallback})]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,children:[`sessions`,`notes`,`settings`].map(e=>(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,onClick:()=>hr(e),children:m.tabs[e]},e))})]}),(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:R.effectiveWorkspaceRoot?(0,J.jsxs)(`div`,{"data-project-files-grid":!0,className:s(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Vt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${zt}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)(ot,{workspacePath:di}),(0,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,className:s(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Ut&&`bg-surface-hover text-fg`),onClick:()=>Wt(!0),"aria-label":m.files.search,title:m.files.search,"aria-pressed":Ut,children:(0,J.jsx)(H,{className:`size-3.5`,"aria-hidden":!0})}),(0,J.jsx)(E,{className:`size-7 shrink-0 rounded-md p-0`,loading:hn,label:c.cron.refresh,onClick:()=>void Dr()})]})]}),Ut?(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)(H,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`text`,role:`searchbox`,value:Gt,onChange:e=>Kt(e.target.value),placeholder:m.files.searchPlaceholder,"aria-label":m.files.searchPlaceholder,autoFocus:!0,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:()=>{Kt(``),Wt(!1)},children:(0,J.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Sn?(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:Sn}):null,kr?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Zt?(0,J.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,J.jsx)(_,{className:`h-11 w-full`}),(0,J.jsx)(_,{className:`h-11 w-full`}),(0,J.jsx)(_,{className:`h-11 w-full`})]}):$t?(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[c.workspace.loadError,`: `,$t]}):Yt.length===0?(0,J.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:m.files.noSearchResults}):Yt.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:s(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Lt===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Rt(e.path),title:e.path,children:[(0,J.jsx)(he,{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))}):hn&&Pt.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.files.loading}):(0,J.jsx)(me,{tree:Pt,selectedPath:Lt,onSelectFile:Jr,onSelectEntry:Yr,onExpandDir:e=>void Or(e),onAction:Xr,actionLabels:{preview:c.workspace.preview,download:c.workspace.download,copyPath:c.workspace.copyPath,openDefault:c.workspace.openSystemApp,openWith:c.workspace.openWith,revealInFolder:c.workspace.revealInFolder,recommendedApps:c.workspace.recommendedApps},emptyHint:m.files.emptyDirectory})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":m.files.resizeHandle,className:s(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Vt&&`bg-surface-hover`),onPointerDown:Zr,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:Lt?(0,J.jsx)(P,{filePath:Lt,projectId:R.id,onClose:()=>Rt(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)(k,{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)(U,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>hr(`settings`),children:m.files.openSettings})})]})})]}):null,$===`sessions`?(0,J.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,className:`grid min-h-full content-start gap-3`,children:[we.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)(H,{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:Oe,onChange:e=>ke(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`}),Oe?(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:()=>ke(``),children:(0,J.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,ri.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:ri.map(e=>{let t=cn(e.updatedAt),n=e.routing?.agentId||e.agentId||m.common.agent,r=xn(e),i=e.name?.trim()||m.sessions.fallbackTitle,o=ti(e.messageCount??0);return(0,J.jsxs)(a,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:br(`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)(Ae,{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:o})]}),t?(0,J.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[m.sessions.updated,`: `,t]}):null]})]},e.key)})}):ii?(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-surface-tab-work`,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)(U,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3`,disabled:nr,onClick:()=>sr(!0),children:[(0,J.jsx)(et,{className:`size-4`,"aria-hidden":!0}),m.goals.new]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Pe.length?Pe.map(e=>(0,J.jsxs)(a,{to:_r(e.id),onClick:br(`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:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,ln(e.status)),children:ei(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-surface-tab-context`,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:sn(m.activity.count,{count:Et})})]}),(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:At,onChange:e=>jt(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),m.activity.includeRelated]}),(0,J.jsxs)(U,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void wr(),disabled:Ot,children:[(0,J.jsx)(_t,{className:s(`size-4`,Ot&&`animate-spin`),"aria-hidden":!0}),m.common.refresh]})]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Ot&&wt.length===0?(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:m.activity.loading}):wt.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:wt.map(e=>{let t=m.activity.types[e.type]??e.type,n=m.activity.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Cn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===R.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,`: `,yn(e)]})]}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:cn(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,`: `,vn(e)]}),(0,J.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[m.activity.source,`: `,bn(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-surface-tab-context`,onSubmit:Vr,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.contextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.contextHint})]}),(0,J.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,ln(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)(pn,{label:m.settings.workspaceRoot,value:di,mono:!0}),(0,J.jsx)(pn,{label:m.settings.defaultAgent,value:ai}),(0,J.jsx)(pn,{label:m.settings.pinState,value:li?m.settings.pinned:m.settings.notPinned}),(0,J.jsx)(pn,{label:m.settings.createdAt,value:cn(R.createdAt)||m.common.never}),(0,J.jsx)(pn,{label:m.settings.updatedAt,value:cn(R.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)(dn,{label:m.settings.name,children:(0,J.jsx)(`input`,{className:fn(),value:Q.name,onChange:e=>pr(t=>({...t,name:e.target.value}))})}),(0,J.jsx)(dn,{label:m.settings.defaultAgent,children:(0,J.jsxs)(ue,{className:fn(),value:Q.defaultAgentId,onChange:e=>pr(t=>({...t,defaultAgentId:e.target.value})),children:[(0,J.jsx)(S,{value:``,children:m.settings.globalDefaultAgent}),On.map(e=>(0,J.jsx)(S,{value:e.id,children:ct(e,c.agentsSettings)},e.id))]})}),(0,J.jsx)(dn,{label:m.settings.status,children:ci?(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)(ue,{className:fn(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>pr(t=>({...t,status:e.target.value})),children:[(0,J.jsx)(S,{value:`active`,children:m.settings.statuses.active}),(0,J.jsx)(S,{value:`paused`,children:m.settings.statuses.paused})]})}),(0,J.jsx)(dn,{label:m.settings.description,hint:m.settings.descriptionHint,children:(0,J.jsx)(`textarea`,{className:fn(!0),value:Q.description,onChange:e=>pr(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 px-3 py-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:ui?m.settings.workspaceModeFollow:m.settings.workspaceModeFixed})}),(0,J.jsx)(`div`,{className:`mt-2 break-all font-mono text-xs leading-5 text-fg`,title:di,children:di})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,J.jsxs)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void gi(),children:[(0,J.jsx)(nt,{className:`size-4`,"aria-hidden":!0}),m.settings.copyWorkspacePath]}),(0,J.jsx)(ot,{workspacePath:di}),(0,J.jsxs)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Hr,children:[(0,J.jsx)($e,{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.agentContextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.agentContextHint})]}),(0,J.jsx)(dn,{label:m.settings.brief,hint:m.settings.briefHint,children:(0,J.jsx)(`textarea`,{className:fn(!0),value:Q.brief,onChange:e=>pr(t=>({...t,brief:e.target.value}))})}),(0,J.jsx)(dn,{label:m.settings.instructions,hint:m.settings.instructionsHint,children:(0,J.jsx)(`textarea`,{className:fn(!0),value:Q.instructions,onChange:e=>pr(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 px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:li?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)(U,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:Wn===`pin`,onClick:()=>void Wr(),children:[li?(0,J.jsx)(ve,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),li?m.settings.unpinProject:m.settings.pinProject]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:ci?m.settings.restoreTitle:m.settings.archiveTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:ci?m.settings.restoreHint:m.settings.archiveHint})]}),(0,J.jsxs)(U,{type:`button`,variant:ci?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:Wn===`archive`,onClick:()=>void Gr(),children:[ci?(0,J.jsx)(_t,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(A,{className:`size-4`,"aria-hidden":!0}),ci?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)(U,{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:()=>In(!0),children:[(0,J.jsx)(st,{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)(U,{type:`submit`,variant:`primary`,disabled:Nn||!Q.name.trim(),children:[(0,J.jsx)(F,{className:`size-4`,"aria-hidden":!0}),m.common.save]})})]}):null]}),(0,J.jsx)(De,{open:Fn,onOpenChange:e=>{Kn||In(e)},children:(0,J.jsxs)(Me,{children:[(0,J.jsx)(Ie,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(Qe,{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)(l,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(be,{className:`text-base font-semibold text-fg`,children:m.settings.deleteConfirmTitle}),(0,J.jsx)(We,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:R?sn(m.settings.deleteConfirm,{name:R.name}):m.settings.deleteConfirmFallback})]})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,J.jsx)(je,{asChild:!0,children:(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Kn,children:m.common.cancel})}),(0,J.jsxs)(U,{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:Kn||!R,onClick:()=>void Kr(),children:[(0,J.jsx)(st,{className:`size-4`,"aria-hidden":!0}),m.settings.deleteConfirmAction]})]})]})]})}),(0,J.jsx)(De,{open:zn,onOpenChange:e=>{Nn||Bn(e)},children:(0,J.jsxs)(Me,{children:[(0,J.jsx)(Ie,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(Qe,{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)(be,{className:`text-base font-semibold text-fg`,children:m.settings.workspaceMigrationTitle}),(0,J.jsx)(We,{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:s(`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:()=>Vn(`fixed`),disabled:Nn}),(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:s(`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:()=>Vn(`follow`),disabled:Nn}),(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)(bt,{value:Hn,onChange:Un,disabled:Nn,wd:p,placeholder:m.settings.workspacePlaceholder,inputClassName:fn(),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:sn(m.settings.workspaceCurrent,{workspace:fi})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(je,{asChild:!0,children:(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Nn,children:m.common.cancel})}),(0,J.jsxs)(U,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Nn||!pi,onClick:()=>void Ur(),children:[(0,J.jsx)($e,{className:`size-4`,"aria-hidden":!0}),m.settings.workspaceMigrationConfirm]})]})]})]})}),(0,J.jsx)(De,{open:!!Ln,onOpenChange:e=>{e||Rn(null)},children:(0,J.jsxs)(Me,{children:[(0,J.jsx)(Ie,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(Qe,{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)(be,{className:`text-base font-semibold text-fg`,children:m.settings.workspaceMissingTitle}),(0,J.jsx)(We,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Ln?sn(m.settings.workspaceMissingDescription,{workspace:Ln}):null})]}),Ln?(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)(k,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:Ln})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:_i,disabled:Nn,children:m.settings.workspaceMissingBack}),(0,J.jsxs)(U,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Ur({createWorkspaceRoot:!0}),disabled:Nn,children:[(0,J.jsx)($e,{className:`size-4`,"aria-hidden":!0}),m.settings.workspaceMissingCreate]})]})]})]})}),(0,J.jsx)(Ct,{open:or,t:c.goalsPage,chat:c.chat,busy:nr,options:lr,onClose:()=>!nr&&sr(!1),onCreate:Nr})]})}export{Dn 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{l as i,t as a,u as o}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as s}from"./cn-BQ_8x0bT.js";import{t as c}from"./check-BODqo66o.js";import{t as l}from"./circle-alert-RzVebuX2.js";import{t as u}from"./copy-to-clipboard-HOJ79TWv.js";import{t as d}from"./messages-Cb1VMeqP.js";import{n as f,o as p,r as m}from"./locale-store-CiM-D9jA.js";import{Aa as h,As as g,Ba as _,Bi as v,Ca as y,Cc as b,Da as x,Do as S,Ea as C,Fi as w,Fo as T,Hi as E,Ii as D,Io as O,Kc as k,Kl as A,La as j,Lc as M,Li as N,Ln as P,Ls as F,Mn as I,Mo as L,Na as R,Ni as z,No as B,Oa as ee,Oc as V,Pa as te,Pi as ne,Po as re,Ps as H,Qo as ie,Qs as ae,Ri as oe,Sa as se,Ta as ce,Tl as le,To as ue,Tr as de,Ui as fe,Ul as pe,Vi as me,Xc as he,Yo as U,Ys as ge,Zc as W,Zo as _e,Zs as ve,_a as ye,_o as be,a as xe,at as Se,ba as Ce,c as we,d as Te,da as Ee,do as De,f as Oe,fa as ke,fc as Ae,fo as je,go as Me,gt as Ne,h as Pe,ha as Fe,ho as Ie,i as Le,il as Re,ka as ze,kl as Be,lo as Ve,m as He,ma as Ue,mo as We,ms as Ge,mt as Ke,nc as qe,nl as Je,o as Ye,pa as Xe,pl as Ze,po as Qe,qc as $e,qs as et,rt as G,s as tt,sl as nt,tc as rt,tl as it,u as at,ui as ot,us as st,vr as ct,wa as lt,x as ut,xa as dt,xs as ft,ya as pt,yt as mt,z as ht,zi as gt,zs as _t}from"./index-BJGusbyV.js";import{t as vt}from"./notes-workbench-CCuL7qlg.js";import{t as yt}from"./page-tabs-CGVMJEW0.js";import{t as bt}from"./directory-picker-path-field-hZghTKie.js";import{t as xt}from"./goals-config-api-DQJ5mBXB.js";import{n as St,t as Ct}from"./goal-create-dialog-C_Qw_QgW.js";var K=n(),q=e(t(),1),J=r(),wt=`application/x-xopc-work-item`,Tt=[`backlog`,`todo`,`in_progress`,`blocked`,`needs_input`,`in_review`,`done`],Et=[`low`,`normal`,`high`,`urgent`];function Dt(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 Ot(e){return e?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):``}function kt(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 At(e){return`${e.name}:${e.size}:${e.lastModified}`}function jt(e,t){return z(e,t)!==`unsupported`}function Mt(e,t){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:t===`image`||t===`audio`||t===`video`?t:`document`}function Nt(e,t){return{id:e.id,name:e.fileName,type:Mt(e.mimeType,e.type),mimeType:e.mimeType,size:e.size,...t?{content:t,preview:e.mimeType.startsWith(`image/`)?t:void 0}:{}}}async function Pt(e,t){let n=w(e.name||`upload`,e.type||`application/octet-stream`),r=R(await e.arrayBuffer());return{id:t,name:e.name||`upload`,type:Mt(n),mimeType:n,size:e.size,content:r,preview:n.startsWith(`image/`)?r:void 0}}function Ft(e){let t=(0,K.c)(3),[n,r]=(0,q.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,q.useEffect)(i,a),n}function It(e,t){let n=(0,K.c)(5),[r,i]=(0,q.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(Pe(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,q.useEffect)(a,o),r}function Lt(e){let t=(0,K.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)(W,{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 Rt(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 zt(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}function Bt(e,t){return e.nextAction||e.blockedReason||e.description||t.noNextAction}function Vt(e){let t=(0,K.c)(63),{item:n,dragging:r,onOpen:i,onToggleDone:o,onDragStart:c,onDragEnd:l,t:u}=e,d=n.status===`done`,f;t[0]!==n||t[1]!==c?(f=e=>c(n,e),t[0]=n,t[1]=c,t[2]=f):f=t[2];let p=u.dragToUpdate,m=r&&`opacity-50`,h;t[3]===m?h=t[4]:(h=s(`flex min-h-24 w-full min-w-0 max-w-full cursor-grab flex-col overflow-hidden rounded-lg bg-surface-panel px-3 py-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]:(_=s(`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]!==o?(b=()=>o(n),t[7]=n,t[8]=o,t[9]=b):b=t[9];let x;t[10]===d?x=t[11]:(x=d?(0,J.jsx)(le,{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=Bt(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=s(`rounded-full px-2 py-0.5 text-[11px] font-medium`,Dt(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)(qe,{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)(it,{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)(a,{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]!==l||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:l,title:p,className:h,children:[O,z]}),t[56]=l,t[57]=u.dragToUpdate,t[58]=f,t[59]=O,t[60]=z,t[61]=h,t[62]=B):B=t[62],B}function Ht(){let e=(0,K.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 Ut(e){let t=(0,K.c)(44),{file:n,index:r,busy:i,previewBusy:a,t:o,onOpen:c,onRemove:l}=e,u,d,f,p;t[0]===n?(u=t[1],d=t[2],f=t[3],p=t[4]):(u=w(n.name||`upload`,n.type||`application/octet-stream`),d=jt(n.name||`upload`,u),f=Ft,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,_;t[5]!==n||t[6]!==c?(_=()=>c(n),t[5]=n,t[6]=c,t[7]=_):_=t[7];let v;t[8]!==u||t[9]!==d||t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==m?(v=(0,J.jsx)(Lt,{name:h,mimeType:u,thumbnailUrl:m,previewable:d,disabled:g,onOpen:_}),t[8]=u,t[9]=d,t[10]=h,t[11]=g,t[12]=_,t[13]=m,t[14]=v):v=t[14];let y=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`,b;t[15]===y?b=t[16]:(b=s(`min-w-0 flex-1 text-left`,y),t[15]=y,t[16]=b);let x=!d||i||a,S;t[17]!==n||t[18]!==c?(S=()=>c(n),t[17]=n,t[18]=c,t[19]=S):S=t[19];let C=n.name||`upload`,T;t[20]===C?T=t[21]:(T=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:C}),t[20]=C,t[21]=T);let E;t[22]===n.size?E=t[23]:(E=kt(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]!==S||t[27]!==T||t[28]!==D||t[29]!==b||t[30]!==x?(O=(0,J.jsxs)(`button`,{type:`button`,className:b,disabled:x,onClick:S,children:[T,D]}),t[26]=S,t[27]=T,t[28]=D,t[29]=b,t[30]=x,t[31]=O):O=t[31];let k;t[32]!==r||t[33]!==l?(k=()=>l(r),t[32]=r,t[33]=l,t[34]=k):k=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(ie,{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]!==v?(M=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 py-2 text-sm`,children:[v,O,j]}),t[40]=O,t[41]=j,t[42]=v,t[43]=M):M=t[43],M}function Wt(e){let t=(0,K.c)(56),{item:n,attachment:r,busy:i,previewBusy:a,t:o,onOpen:c,onDownload:l,onRemove:u}=e,d;t[0]!==r.fileName||t[1]!==r.mimeType?(d=jt(r.fileName,r.mimeType),t[0]=r.fileName,t[1]=r.mimeType,t[2]=d):d=t[2];let f=d,p=It(n.id,r),m=i||a,h;t[3]!==r||t[4]!==n||t[5]!==c?(h=()=>c(n,r),t[3]=r,t[4]=n,t[5]=c,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)(Lt,{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=s(`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]!==c?(b=()=>c(n,r),t[16]=r,t[17]=n,t[18]=c,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=kt(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]!==l?(E=()=>l(n,r),t[33]=r,t[34]=n,t[35]=l,t[36]=E):E=t[36];let D;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,J.jsx)(Re,{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)(st,{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 px-2 py-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 Gt({mode:e,item:t,pendingFiles:n,busy:r,t:i,onPendingFilesChange:a,onUpload:o,onRemove:c,onDownload:l,onPreviewError:u}){let d=(0,q.useRef)(null),[f,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),S=p(e=>e.token),C=t?.attachments??[];function w(r){if(!r.length)return;if(e===`detail`&&t){o(t,r);return}let i=new Set(n.map(At)),s=[...n];for(let e of r){let t=At(e);i.has(t)||(i.add(t),s.push(e))}a(s)}function T(e){a(n.filter((t,n)=>n!==e))}async function E(e){let t=At(e);x(`pending:${t}`);try{y(await Pt(e,`pending:${t}`)),_(!0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{x(null)}}async function D(e,t){x(`saved:${t.id}`);try{let n=await m(Pe(e.id,t.id));if(!n.ok)throw Error(`HTTP ${n.status}`);y(Nt(t,R(await n.arrayBuffer()))),_(!0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{x(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:s(`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,f&&`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),w(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)(qe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate`,children:i.attachments.title})]}),(0,J.jsxs)(U,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:r,onClick:()=>d.current?.click(),children:[(0,J.jsx)(et,{className:`size-3.5`,"aria-hidden":!0}),i.attachments.add]}),(0,J.jsx)(`input`,{ref:d,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{w(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)(Ut,{file:e,index:t,busy:r,previewBusy:b===`pending:${At(e)}`,t:i,onOpen:e=>void E(e),onRemove:T},At(e)))}):null,t&&C.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:C.map(e=>(0,J.jsx)(Wt,{item:t,attachment:e,busy:r,previewBusy:b===`saved:${e.id}`,t:i,onOpen:(e,t)=>void D(e,t),onDownload:l,onRemove:c},e.id))}):null,!n.length&&!C.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:S,layerClassName:`z-[100]`,onClose:()=>{_(!1),y(null)}})]})}function Kt(e){let t=(0,K.c)(170),{mode:n,item:r,initialStatus:i,events:o,busy:c,error:l,notice:u,t:d,onClose:f,onCreate:p,onSave:m,onStartChat:h,onCreateGoal:g,onAddAttachments:_,onRemoveAttachment:v,onDownloadAttachment:y,onPreviewError:b}=e,x=n!==null,[C,w]=(0,q.useState)(``),[T,E]=(0,q.useState)(``),[D,O]=(0,q.useState)(`todo`),[k,A]=(0,q.useState)(`normal`),[j,M]=(0,q.useState)(``),[N,P]=(0,q.useState)(``),F;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(F=[],t[0]=F):F=t[0];let[I,L]=(0,q.useState)(F),R,z;t[1]!==i||t[2]!==r||t[3]!==n?(R=()=>{if(n===`create`){w(``),E(``),O(i),A(`normal`),M(``),P(``),L([]);return}n===`detail`&&r&&(w(r.title),E(r.description??``),O(r.status),A(r.priority),M(r.nextAction??``),P(r.blockedReason??``),L([]))},z=[i,r,n],t[1]=i,t[2]=r,t[3]=n,t[4]=R,t[5]=z):(R=t[4],z=t[5]),(0,q.useEffect)(R,z);let B;t[6]!==N||t[7]!==T||t[8]!==r||t[9]!==n||t[10]!==j||t[11]!==p||t[12]!==m||t[13]!==I||t[14]!==k||t[15]!==D||t[16]!==C?(B=function(e){e.preventDefault();let t=C.trim();if(t){if(n===`create`){p({title:t,description:T.trim()||void 0,priority:k,status:D,nextAction:j.trim()||void 0,blockedReason:N.trim()||void 0,attachments:I});return}r&&m(r,{title:t,description:T.trim()||null,status:D,priority:k,nextAction:j.trim()||null,blockedReason:N.trim()||null})}},t[6]=N,t[7]=T,t[8]=r,t[9]=n,t[10]=j,t[11]=p,t[12]=m,t[13]=I,t[14]=k,t[15]=D,t[16]=C,t[17]=B):B=t[17];let ee=B,V;t[18]===f?V=t[19]:(V=e=>!e&&f(),t[18]=f,t[19]=V);let te;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,J.jsx)(Ie,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[20]=te):te=t[20];let ne=n===`create`?d.create.title:r?.title||d.title,re;t[21]===ne?re=t[22]:(re=(0,J.jsx)(be,{className:`truncate text-base font-semibold text-fg`,children:ne}),t[21]=ne,t[22]=re);let H;t[23]===d.detail.description?H=t[24]:(H=(0,J.jsx)(We,{className:`mt-1 text-sm text-fg-muted`,children:d.detail.description}),t[23]=d.detail.description,t[24]=H);let ae;t[25]!==re||t[26]!==H?(ae=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[re,H]}),t[25]=re,t[26]=H,t[27]=ae):ae=t[27];let oe;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,J.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),t[28]=oe):oe=t[28];let se;t[29]===c?se=t[30]:(se=(0,J.jsx)(je,{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:c,children:oe})}),t[29]=c,t[30]=se);let ce;t[31]!==ae||t[32]!==se?(ce=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[ae,se]}),t[31]=ae,t[32]=se,t[33]=ce):ce=t[33];let de;t[34]===l?de=t[35]:(de=l?(0,J.jsx)(`div`,{className:`rounded-lg border border-danger/30 bg-danger-soft px-3 py-2 text-sm text-danger`,children:l}):null,t[34]=l,t[35]=de);let fe;t[36]!==l||t[37]!==u?(fe=!l&&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)(le,{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]=l,t[37]=u,t[38]=fe):fe=t[38];let pe;t[39]===d.create.titleLabel?pe=t[40]:(pe=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.titleLabel}),t[39]=d.create.titleLabel,t[40]=pe);let me;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(me=e=>w(e.target.value),t[41]=me):me=t[41];let he=n===`create`,ge;t[42]!==he||t[43]!==C?(ge=(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:C,onChange:me,autoFocus:he}),t[42]=he,t[43]=C,t[44]=ge):ge=t[44];let W;t[45]!==pe||t[46]!==ge?(W=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[pe,ge]}),t[45]=pe,t[46]=ge,t[47]=W):W=t[47];let _e;t[48]===d.detail.status?_e=t[49]:(_e=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.detail.status}),t[48]=d.detail.status,t[49]=_e);let ve;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>O(e.target.value),t[50]=ve):ve=t[50];let ye;t[51]===d.statuses?ye=t[52]:(ye=Tt.map(e=>(0,J.jsx)(S,{value:e,children:d.statuses[e]},e)),t[51]=d.statuses,t[52]=ye);let xe;t[53]!==D||t[54]!==ye?(xe=(0,J.jsx)(ue,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:D,onChange:ve,children:ye}),t[53]=D,t[54]=ye,t[55]=xe):xe=t[55];let Se;t[56]!==_e||t[57]!==xe?(Se=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[_e,xe]}),t[56]=_e,t[57]=xe,t[58]=Se):Se=t[58];let Ce;t[59]===d.create.priorityLabel?Ce=t[60]:(Ce=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.priorityLabel}),t[59]=d.create.priorityLabel,t[60]=Ce);let we;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(we=e=>A(e.target.value),t[61]=we):we=t[61];let Te;t[62]===d.priorities?Te=t[63]:(Te=Et.map(e=>(0,J.jsx)(S,{value:e,children:d.priorities[e]},e)),t[62]=d.priorities,t[63]=Te);let Ee;t[64]!==k||t[65]!==Te?(Ee=(0,J.jsx)(ue,{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:we,children:Te}),t[64]=k,t[65]=Te,t[66]=Ee):Ee=t[66];let Oe;t[67]!==Ce||t[68]!==Ee?(Oe=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ce,Ee]}),t[67]=Ce,t[68]=Ee,t[69]=Oe):Oe=t[69];let ke;t[70]!==Se||t[71]!==Oe?(ke=(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Se,Oe]}),t[70]=Se,t[71]=Oe,t[72]=ke):ke=t[72];let Ne;t[73]===d.create.descriptionLabel?Ne=t[74]:(Ne=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.descriptionLabel}),t[73]=d.create.descriptionLabel,t[74]=Ne);let Pe;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=e=>E(e.target.value),t[75]=Pe):Pe=t[75];let Fe;t[76]===T?Fe=t[77]:(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:T,onChange:Pe}),t[76]=T,t[77]=Fe);let Le;t[78]!==Ne||t[79]!==Fe?(Le=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ne,Fe]}),t[78]=Ne,t[79]=Fe,t[80]=Le):Le=t[80];let Re;t[81]!==c||t[82]!==r||t[83]!==n||t[84]!==_||t[85]!==y||t[86]!==b||t[87]!==v||t[88]!==I||t[89]!==d?(Re=(0,J.jsx)(Gt,{mode:n,item:r,pendingFiles:I,busy:c,t:d,onPendingFilesChange:L,onUpload:_,onRemove:v,onDownload:y,onPreviewError:b}),t[81]=c,t[82]=r,t[83]=n,t[84]=_,t[85]=y,t[86]=b,t[87]=v,t[88]=I,t[89]=d,t[90]=Re):Re=t[90];let ze;t[91]!==N||t[92]!==n||t[93]!==j||t[94]!==D||t[95]!==d.blockedReason||t[96]!==d.nextAction?(ze=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:j,onChange:e=>M(e.target.value)})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:s(`font-medium`,D===`blocked`||D===`needs_input`?`text-red-700 dark:text-red-300`:`text-fg-muted`),children:d.blockedReason}),(0,J.jsx)(`textarea`,{className:s(`min-h-20 rounded-lg border bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,D===`blocked`||D===`needs_input`?`border-red-500/40`:`border-edge`),value:N,onChange:e=>P(e.target.value)})]})]}):null,t[91]=N,t[92]=n,t[93]=j,t[94]=D,t[95]=d.blockedReason,t[96]=d.nextAction,t[97]=ze):ze=t[97];let Be;t[98]!==de||t[99]!==fe||t[100]!==W||t[101]!==ke||t[102]!==Le||t[103]!==Re||t[104]!==ze?(Be=(0,J.jsxs)(`div`,{className:`grid content-start gap-4`,children:[de,fe,W,ke,Le,Re,ze]}),t[98]=de,t[99]=fe,t[100]=W,t[101]=ke,t[102]=Le,t[103]=Re,t[104]=ze,t[105]=Be):Be=t[105];let Ve;t[106]!==c||t[107]!==r||t[108]!==n||t[109]!==g||t[110]!==h||t[111]!==d.detail.actions||t[112]!==d.detail.createGoal||t[113]!==d.detail.openItem||t[114]!==d.detail.startChat?(Ve=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)(U,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:c,onClick:()=>h(r),children:[(0,J.jsx)(Ae,{className:`size-4`,"aria-hidden":!0}),d.detail.startChat]}),(0,J.jsxs)(U,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:c,onClick:()=>g(r),children:[(0,J.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}),d.detail.createGoal]}),(0,J.jsx)(U,{asChild:!0,variant:`secondary`,className:`justify-start rounded-lg`,children:(0,J.jsxs)(a,{to:`/work-items/${encodeURIComponent(r.id)}`,children:[(0,J.jsx)(it,{className:`size-4`,"aria-hidden":!0}),d.detail.openItem]})})]})]}):null,t[106]=c,t[107]=r,t[108]=n,t[109]=g,t[110]=h,t[111]=d.detail.actions,t[112]=d.detail.createGoal,t[113]=d.detail.openItem,t[114]=d.detail.startChat,t[115]=Ve):Ve=t[115];let He;t[116]===d.detail.links?He=t[117]:(He=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.links}),t[116]=d.detail.links,t[117]=He);let Ue;t[118]!==r||t[119]!==d.detail.noLinks||t[120]!==d.linkKinds?(Ue=r?.links?.length?r.links.slice(0,6).map(e=>(0,J.jsxs)(a,{to:Rt(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)(it,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.detail.noLinks}),t[118]=r,t[119]=d.detail.noLinks,t[120]=d.linkKinds,t[121]=Ue):Ue=t[121];let Ke;t[122]===Ue?Ke=t[123]:(Ke=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2 text-sm`,children:Ue}),t[122]=Ue,t[123]=Ke);let qe;t[124]!==He||t[125]!==Ke?(qe=(0,J.jsxs)(`section`,{children:[He,Ke]}),t[124]=He,t[125]=Ke,t[126]=qe):qe=t[126];let Je;t[127]===d.detail.activity?Je=t[128]:(Je=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.activity}),t[127]=d.detail.activity,t[128]=Je);let Ye;t[129]!==o||t[130]!==d.detail.noActivity||t[131]!==d.eventTypes?(Ye=o.length?o.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:Ot(e.createdAt)})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.detail.noActivity}),t[129]=o,t[130]=d.detail.noActivity,t[131]=d.eventTypes,t[132]=Ye):Ye=t[132];let Xe;t[133]===Ye?Xe=t[134]:(Xe=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2`,children:Ye}),t[133]=Ye,t[134]=Xe);let Ze;t[135]!==Je||t[136]!==Xe?(Ze=(0,J.jsxs)(`section`,{children:[Je,Xe]}),t[135]=Je,t[136]=Xe,t[137]=Ze):Ze=t[137];let $e;t[138]!==Ve||t[139]!==qe||t[140]!==Ze?($e=(0,J.jsxs)(`aside`,{className:`grid content-start gap-5`,children:[Ve,qe,Ze]}),t[138]=Ve,t[139]=qe,t[140]=Ze,t[141]=$e):$e=t[141];let G;t[142]!==Be||t[143]!==$e?(G=(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:[Be,$e]}),t[142]=Be,t[143]=$e,t[144]=G):G=t[144];let tt;t[145]!==c||t[146]!==f||t[147]!==d.create.cancel?(tt=(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:f,disabled:c,children:d.create.cancel}),t[145]=c,t[146]=f,t[147]=d.create.cancel,t[148]=tt):tt=t[148];let nt;t[149]!==c||t[150]!==C?(nt=c||!C.trim(),t[149]=c,t[150]=C,t[151]=nt):nt=t[151];let rt;t[152]===n?rt=t[153]:(rt=n===`create`?(0,J.jsx)(et,{className:`size-4`,"aria-hidden":!0}):null,t[152]=n,t[153]=rt);let at=n===`create`?d.create.submit:d.detail.save,ot;t[154]!==nt||t[155]!==rt||t[156]!==at?(ot=(0,J.jsxs)(U,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:nt,children:[rt,at]}),t[154]=nt,t[155]=rt,t[156]=at,t[157]=ot):ot=t[157];let st;t[158]!==tt||t[159]!==ot?(st=(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[tt,ot]}),t[158]=tt,t[159]=ot,t[160]=st):st=t[160];let ct;t[161]!==ee||t[162]!==ce||t[163]!==G||t[164]!==st?(ct=(0,J.jsxs)(Me,{children:[te,(0,J.jsx)(Qe,{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:ee,className:`flex min-h-0 flex-1 flex-col`,children:[ce,G,st]})})]}),t[161]=ee,t[162]=ce,t[163]=G,t[164]=st,t[165]=ct):ct=t[165];let lt;return t[166]!==x||t[167]!==V||t[168]!==ct?(lt=(0,J.jsx)(De,{open:x,onOpenChange:V,children:ct}),t[166]=x,t[167]=V,t[168]=ct,t[169]=lt):lt=t[169],lt}function qt({projectId:e,createRequestKey:t=0}){let n=i(),r=d(f(e=>e.language)).projectDetailPage.workItems,a=(0,q.useRef)(null),o=(0,q.useRef)(null),[c,l]=(0,q.useState)([]),[u,p]=(0,q.useState)(!0),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(null),[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(`todo`),[M,N]=(0,q.useState)(null),[P,F]=(0,q.useState)([]),I=(0,q.useCallback)(async(t=`replace`,n=0)=>{p(!0),h(null);try{let r=await we(e,{limit:100,offset:n});l(e=>t===`append`?[...e,...r.items]:r.items),D(r.hasMore)}catch(e){h(e instanceof Error?e.message:String(e))}finally{p(!1)}},[e]);(0,q.useEffect)(()=>{I(`replace`,0)},[I]),(0,q.useEffect)(()=>{t&&(N(null),F([]),h(null),_(null),j(`todo`),k(!0))},[t]);let L=(0,q.useMemo)(()=>Tt.map(e=>({status:e,title:r.statuses[e],items:c.filter(t=>t.status===e)})),[c,r.statuses]),R=(0,q.useCallback)(e=>{l(t=>t.map(t=>t.id===e.id?e:t)),N(t=>t?.id===e.id?e:t)},[]),z=(0,q.useCallback)(async(e,t)=>{y(!0),h(null),_(null);try{let n=await Te(e.id,t);n.item.archivedAt?(l(e=>e.filter(e=>e.id!==n.item.id)),N(null)):(R(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,R]),B=(0,q.useCallback)(async e=>{N(e),F([]),h(null),_(null);let t=await at(e.id).catch(()=>null);t&&F(t.events)},[]),ee=(0,q.useCallback)(async t=>{y(!0),h(null),_(null);try{let n=await Le(e,t);l(e=>[n.item,...e]),k(!1),N(n.item),F((await at(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]),V=(0,q.useCallback)(async(e,t)=>{if(t.length){y(!0),h(null),_(null);try{let n=await He(e.id,t);R(n.item),F((await at(n.item.id).catch(()=>({events:[]}))).events)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}}},[R]),te=(0,q.useCallback)(async(e,t)=>{y(!0),h(null),_(null);try{let n=await Ye(e.id,t.id);R(n.item),F((await at(n.item.id).catch(()=>({events:[]}))).events)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[R]),ne=(0,q.useCallback)(async(e,t)=>{h(null),_(null);try{await tt(e.id,t)}catch(e){h(e instanceof Error?e.message:String(e))}},[]),re=(0,q.useCallback)(async e=>{y(!0),h(null),_(null);try{let t=await Oe(e.id);R(t.item),await B(t.item),n(`/chat/${encodeURIComponent(t.session.key)}`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[n,B,R]),H=(0,q.useCallback)(async e=>{y(!0),h(null),_(null);try{let t=await xe(e.id);R(t.item),await B(t.item),n(`/goals/${encodeURIComponent(t.goal.id)}`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[n,B,R]),ie=(0,q.useCallback)((e,t)=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(wt,e.id),x(e.id)},[]),ae=(0,q.useCallback)((e,t)=>{t.preventDefault();let n=t.dataTransfer.getData(wt)||b;C(null),x(null);let r=c.find(e=>e.id===n);!r||r.status===e||z(r,{status:e})},[b,c,z]),oe=(0,q.useCallback)(e=>{z(e,{status:e.status===`done`?`todo`:`done`})},[z]),se=(0,q.useCallback)(e=>{N(null),F([]),h(null),_(null),j(e),k(!0)},[]),ce=(0,q.useCallback)(e=>{let t=o.current;!t||t.pointerId!==e.pointerId||(o.current=null,T(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),le=(0,q.useCallback)(e=>{if(e.button!==0||b||zt(e.target))return;let t=a.current;t&&(o.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[b]),ue=(0,q.useCallback)(e=>{let t=o.current,n=a.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,T(!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:a,className:s(`min-h-0 flex-1 overflow-x-auto rounded-lg px-2 py-2 transition-opacity`,u&&`opacity-60`,w?`cursor-grabbing select-none`:`cursor-grab`),"aria-label":r.boardAria,"aria-busy":u,onPointerDown:le,onPointerMove:ue,onPointerUp:ce,onPointerCancel:ce,onLostPointerCapture:e=>{o.current?.pointerId===e.pointerId&&(o.current=null,T(!1))},children:(0,J.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:L.map(e=>(0,J.jsxs)(`section`,{className:s(`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`,S===e.status&&`bg-surface-active`),"aria-label":e.title,onDragOver:t=>{b&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,C(e.status))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||C(null)},onDrop:t=>ae(e.status,t),children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 px-3 py-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)(Je,{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)(Vt,{item:e,dragging:b===e.id,onOpen:B,onToggleDone:oe,onDragStart:ie,onDragEnd:()=>{x(null),C(null)},t:r},e.id)):u?(0,J.jsxs)(`div`,{className:`grid gap-2 animate-pulse motion-reduce:animate-none`,children:[(0,J.jsx)(Ht,{}),(0,J.jsx)(Ht,{})]}):(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:()=>se(e.status),children:(0,J.jsx)(et,{className:`size-4`,"aria-hidden":!0})})]})]},e.status))})}),!u&&E?(0,J.jsx)(U,{type:`button`,variant:`secondary`,className:`justify-self-center`,onClick:()=>void I(`append`,c.length),children:r.loadMore}):null,(0,J.jsx)(Kt,{mode:O?`create`:M?`detail`:null,item:M,initialStatus:A,events:P,busy:v,error:m,notice:g,t:r,onClose:()=>{k(!1),N(null),F([]),h(null),_(null)},onCreate:ee,onSave:(e,t)=>void z(e,t),onStartChat:re,onCreateGoal:H,onAddAttachments:(e,t)=>void V(e,t),onRemoveAttachment:(e,t)=>void te(e,t),onDownloadAttachment:(e,t)=>void ne(e,t),onPreviewError:e=>{_(null),h(e)}})]})}var Jt=[{id:`overview`,icon:V},{id:`work-items`,icon:b},{id:`sessions`,icon:Ae},{id:`goals`,icon:Ge},{id:`workflows`,icon:ge},{id:`files`,icon:k},{id:`activity`,icon:M},{id:`automations`,icon:_e},{id:`notes`,icon:he},{id:`settings`,icon:g}],Yt=new Set(Jt.map(e=>e.id)),Xt=`xopc.projectFiles.panelWidthPx`,Zt=320,Qt=220,$t=560;function en(e){return Math.min($t,Math.max(Qt,Math.round(e)))}function tn(){try{let e=window.localStorage.getItem(Xt);if(e==null)return Zt;let t=Number.parseInt(e,10);return Number.isFinite(t)?en(t):Zt}catch{return Zt}}function nn(e){try{window.localStorage.setItem(Xt,String(en(e)))}catch{}}function rn(e){return!!(e&&Yt.has(e))}function an(e){return e===`overview`?`overview`:e===`work-items`||e===`goals`||e===`workflows`||e===`automations`?`work`:`context`}function on(e){return e===`work`?`work-items`:e===`context`?`files`:`overview`}function sn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function cn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(n)}function ln(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 un(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 dn(e){let t=(0,K.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 fn(e=!1){return s(`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 pn(e){let t=(0,K.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 c=a&&`font-mono text-xs`,l;t[2]===c?l=t[3]:(l=s(`mt-1 min-w-0 truncate text-sm text-fg`,c),t[2]=c,t[3]=l);let u;t[4]!==l||t[5]!==r?(u=(0,J.jsx)(`div`,{className:l,title:r,children:r}),t[4]=l,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 hn(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function gn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function _n(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function vn(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 yn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function bn(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 xn(e){let t=e.sourceChannel?.trim();if(t)return Sn(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 Sn(r||``)}function Sn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Cn(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 wn(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 Tn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Tn(e.children,t,n)}:e)}function En({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)([e]),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),[_,v]=(0,q.useState)(null),[y,b]=(0,q.useState)(!1),[x,S]=(0,q.useState)(`new`),[C,w]=(0,q.useState)(``),[E,D]=(0,q.useState)(``),[A,j]=(0,q.useState)(!1),[M,N]=(0,q.useState)(null),[P,F]=(0,q.useState)(null),I=(0,q.useCallback)(async()=>{h(!0),v(null);try{let t=await lt({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){v(e instanceof Error?e.message:String(e))}finally{h(!1)}},[e]);(0,q.useEffect)(()=>{d(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,q.useEffect)(()=>{o&&I()},[I,o]);let L=(0,q.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)=>hn(t)-hn(e))},[e.id,u,f]),R=e=>t.statuses[e.status]??e.status,z=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,ee=e=>{S(e),w(``),D(``),N(null),b(!0),l(!1)},V=(0,q.useCallback)(async(e={})=>{let t=E.trim(),n=C.trim()||(x===`directory`?gn(t):``);if(n){j(!0),N(null),F(null);try{let r=await ke({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});b(!1),w(``),D(``),d(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=_n(e);t?(F(t),b(!1)):N(e instanceof Error?e.message:String(e))}finally{j(!1)}}},[x,C,a,E]),te=(0,q.useCallback)(e=>{e.preventDefault(),V()},[V]),ne=(0,q.useCallback)(()=>{V({createWorkspaceRoot:!0})},[V]),ie=(0,q.useCallback)(()=>{F(null),b(!0)},[]),ae=e=>{D(e),x===`directory`&&!C.trim()&&w(gn(e))},oe=(e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:s(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md px-2 py-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:()=>{l(!1),t||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,J.jsx)(c,{className:s(`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:z(e)})]}),(0,J.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,ln(e.status)),children:R(e)})]},e.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(T,{open:o,onOpenChange:l,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`group -ml-2 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:s(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,ln(e.status)),children:R(e)})]}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:z(e)})]}),(0,J.jsx)(Be,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,J.jsx)(re,{children:(0,J.jsxs)(B,{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)(H,{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}),oe(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}),_?(0,J.jsx)(`div`,{className:`px-2 py-2 text-xs text-red-600 dark:text-red-400`,children:_}):null,m&&L.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!m&&L.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,L.map(e=>oe(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:()=>ee(`new`),children:[(0,J.jsx)(et,{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:()=>ee(`directory`),children:[(0,J.jsx)(k,{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:()=>{l(!1),a(`/projects`)},children:[(0,J.jsx)(g,{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)(De,{open:y,onOpenChange:e=>!A&&b(e),children:(0,J.jsxs)(Me,{children:[(0,J.jsx)(Ie,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(Qe,{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)(be,{className:`text-base font-semibold text-fg`,children:x===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,J.jsx)(We,{className:`mt-1 text-sm text-fg-muted`,children:x===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,J.jsxs)(`form`,{onSubmit:te,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:[M?(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:M}):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:C,onChange:e=>w(e.target.value),placeholder:`xopc`,autoFocus:!0})]}),(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)(bt,{value:E,onChange:ae,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)(je,{asChild:!0,children:(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:A,children:n.cancel})}),(0,J.jsxs)(U,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:A||!(C.trim()||x===`directory`&&gn(E)),children:[(0,J.jsx)(et,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,J.jsx)(De,{open:!!P,onOpenChange:e=>{e||F(null)},children:(0,J.jsxs)(Me,{children:[(0,J.jsx)(Ie,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(Qe,{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)(be,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,J.jsx)(We,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:P?sn(n.workspaceMissingDescription,{workspace:P}):null})]}),P?(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)(k,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:P})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ie,disabled:A,children:n.workspaceMissingBack}),(0,J.jsxs)(U,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ne,disabled:A,children:[(0,J.jsx)($e,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Dn(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),c=d(f(e=>e.language)),p=c.chat.workingDirectory,m=c.projectDetailPage,g=c.projectsPage,w=Ve(e=>e.setPageHeader),M=Ve(e=>e.clearPageHeader),[R,le]=(0,q.useState)(null),[W,xe]=(0,q.useState)(null),[we,Te]=(0,q.useState)([]),[Oe,ke]=(0,q.useState)(``),[Pe,Le]=(0,q.useState)([]),[Re,He]=(0,q.useState)([]),[Ge,qe]=(0,q.useState)([]),[Je,Ye]=(0,q.useState)([]),[G,tt]=(0,q.useState)([]),[it,at]=(0,q.useState)(!1),[lt,K]=(0,q.useState)(null),[wt,Tt]=(0,q.useState)([]),[Et,Dt]=(0,q.useState)(0),[Ot,kt]=(0,q.useState)(!1),[At,jt]=(0,q.useState)(!1),[Mt,Nt]=(0,q.useState)(!1),[Pt,Ft]=(0,q.useState)([]),It=(0,q.useRef)(new Set),[Lt,Rt]=(0,q.useState)(null),[zt,Bt]=(0,q.useState)(tn),[Vt,Ht]=(0,q.useState)(!1),[Ut,Wt]=(0,q.useState)(!1),[Gt,Kt]=(0,q.useState)(``),[Yt,Xt]=(0,q.useState)([]),[Zt,Qt]=(0,q.useState)(!1),[$t,mn]=(0,q.useState)(null),[hn,gn]=(0,q.useState)(!1),[Sn,Dn]=(0,q.useState)(null),[On,kn]=(0,q.useState)([]),[Y,An]=(0,q.useState)(``),[jn,Mn]=(0,q.useState)(!0),[Nn,Pn]=(0,q.useState)(!1),[Fn,In]=(0,q.useState)(!1),[Ln,Rn]=(0,q.useState)(null),[zn,Bn]=(0,q.useState)(!1),[X,Vn]=(0,q.useState)(`fixed`),[Hn,Un]=(0,q.useState)(``),[Wn,Gn]=(0,q.useState)(null),[Kn,qn]=(0,q.useState)(!1),[Jn,Yn]=(0,q.useState)(!1),[Xn,Zn]=(0,q.useState)(0),[Qn,$n]=(0,q.useState)(!1),[er,tr]=(0,q.useState)(null),[nr,rr]=(0,q.useState)(!1),[ir,ar]=(0,q.useState)(!1),[or,sr]=(0,q.useState)(!1),[cr,Z]=(0,q.useState)(null),[lr,ur]=(0,q.useState)({defaultAgentId:``,agents:[],models:[],checklistDecomposePolicy:`empty_only`}),[dr,fr]=(0,q.useState)({title:``,reason:``}),[Q,pr]=(0,q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),mr=`overview`,$=n?`notes`:rn(t)?t:mr,hr=(0,q.useCallback)(t=>{e&&r(`/projects/${encodeURIComponent(e)}/${t}`)},[r,e]),gr=(0,q.useCallback)(t=>e?`/projects/${encodeURIComponent(e)}/${t}`:`/projects`,[e]),_r=(0,q.useCallback)(e=>{let t=gr(`goals`);return`/goals/${encodeURIComponent(e)}?returnTo=${encodeURIComponent(t)}`},[gr]),vr=(0,q.useCallback)(t=>{e&&r(gr(t),{replace:!0})},[r,e,gr]),yr=(0,q.useCallback)((e,t)=>{vr(e),r(t)},[r,vr]),br=(0,q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||vr(e)},[vr]),xr=(0,q.useCallback)(e=>e.startsWith(`/goals/`)?`goals`:e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/workflows`)?`workflows`:e.startsWith(`/automations`)?`automations`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,q.useEffect)(()=>{!e||!t||rn(t)||r(`/projects/${encodeURIComponent(e)}/${mr}`,{replace:!0})},[mr,r,e,t]),(0,q.useEffect)(()=>{if(!e)return;let t=!1;return Mn(!0),Z(null),Promise.all([se(e),y(e),dt(e),de().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;let a=e.project;le(a),xe(e),Te(n),Le(r),kn(i?.agents??[]),An(a.defaultAgentId??``),pr({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||Mn(!1)}),()=>{t=!0}},[e]),(0,q.useEffect)(()=>{let e=!1;async function t(){let[t,n,r]=await Promise.allSettled([de(),I(),j()]);e||ur(e=>{let i=t.status===`fulfilled`?t.value.defaultId:e.defaultAgentId,a=R?.defaultAgentId||Y||i,o=t.status===`fulfilled`?t.value.agents:e.agents,s=n.status===`fulfilled`?n.value:e.models,c=r.status===`fulfilled`?xt(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}},[R?.defaultAgentId,Y]);let Sr=(0,q.useCallback)(async()=>{if(R){$n(!0),Z(null);try{let[e,t]=await Promise.all([Ke(),Ne(100,{ownerAgentId:Y||void 0,projectId:R.id})]);He(e),qe(t)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{$n(!1)}}},[R,Y]);(0,q.useEffect)(()=>{R&&Sr()},[R,Sr]);let Cr=(0,q.useCallback)(async()=>{if(R){at(!0),Z(null);try{let[e,t]=await Promise.all([ut.list({projectId:R.id}),ut.runs(50,void 0,{projectId:R.id})]);Ye(e.automations),tt(t.runs)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{at(!1)}}},[R]);(0,q.useEffect)(()=>{$===`automations`&&Cr()},[Cr,$]);let wr=(0,q.useCallback)(async()=>{if(R){kt(!0),Z(null);try{let e=await pt(R.id,{includeRelated:At,limit:100});Tt(e.items),Dt(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{kt(!1)}}},[R,At]);(0,q.useEffect)(()=>{$===`activity`&&wr()},[wr,$]);let Tr=(0,q.useCallback)(async e=>{K(`run:${e.id}`),Z(null);try{await ut.runNow(e.id),await Cr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{K(null)}},[Cr]),Er=(0,q.useCallback)(async e=>{K(`toggle:${e.id}`),Z(null);try{e.enabled?await ut.pause(e.id):await ut.resume(e.id),await Cr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{K(null)}},[Cr]),Dr=(0,q.useCallback)(async()=>{if(!R?.effectiveWorkspaceRoot?.trim()){Ft([]),It.current.clear(),Dn(null);return}gn(!0),Dn(null),It.current.clear();try{Ft(wn((await Ce(R.id,``)).entries)),It.current.add(``)}catch(e){Ft([]),It.current.clear(),Dn(e instanceof Error?e.message:String(e))}finally{gn(!1)}},[R]),Or=(0,q.useCallback)(async e=>{if(!(!R?.effectiveWorkspaceRoot?.trim()||It.current.has(e))){It.current.add(e),Dn(null);try{let t=await Ce(R.id,e);Ft(n=>Tn(n,e,wn(t.entries)))}catch(t){It.current.delete(e),Dn(t instanceof Error?t.message:String(t))}}},[R]);(0,q.useEffect)(()=>{$===`files`&&Dr()},[Dr,$]);let kr=Gt.trim();(0,q.useEffect)(()=>{if($!==`files`||!R||!Ut||!kr){Xt([]),Qt(!1),mn(null);return}let e=!1;Qt(!0),mn(null),Xt([]);let t=window.setTimeout(()=>{ee(R.id,kr,50).then(t=>{e||Xt(t)}).catch(t=>{e||mn(t instanceof Error?t.message:String(t))}).finally(()=>{e||Qt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[kr,R,Ut,$]);let Ar=(0,q.useCallback)(async()=>{if(R){Yn(!0),Z(null);try{let e=await Fe(R.id);yr(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Yn(!1)}}},[yr,R]),jr=(0,q.useCallback)(()=>{hr(`work-items`),Zn(e=>e+1)},[hr]),Mr=(0,q.useCallback)(async()=>{if(!R)return;let[e,t]=await Promise.all([se(R.id),dt(R.id)]);xe(e),le(e.project),Le(t)},[R]),Nr=(0,q.useCallback)(async e=>{if(!R||!e.title.trim())return;let t=Number.parseInt(e.maxTurns,10),n=e.deadline?new Date(e.deadline).getTime():void 0;rr(!0),Z(null);try{await Ue(R.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:St(e.evidencePlan),criteria:St(e.checklist)}}),sr(!1),hr(`goals`),await Mr()}catch(e){throw Z(e instanceof Error?e.message:String(e)),e}finally{rr(!1)}},[hr,R,Mr]),Pr=(0,q.useCallback)(async e=>{if(e.preventDefault(),!(!R||!dr.title.trim())){ar(!0),Z(null);try{await Xe(R.id,{title:dr.title.trim(),reason:dr.reason.trim()||void 0}),fr({title:``,reason:``}),await Mr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ar(!1)}}},[dr.reason,dr.title,R,Mr]),Fr=(0,q.useCallback)(async e=>{if(R){tr(`retry:${e.id}`),Z(null);try{let t=await mt(e.id,{ownerAgentId:Y||e.metadata?.agentId,projectId:e.metadata?.projectId||R.id});await Sr(),yr(`workflows`,ht(t.runId,{ownerAgentId:Y||e.metadata?.agentId||R.defaultAgentId}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{tr(null)}}},[yr,R,Sr,Y]),Ir=(0,q.useCallback)(async e=>{tr(`cancel:${e.id}`),Z(null);try{await Se(e.id,{ownerAgentId:Y||e.metadata?.agentId}),await Sr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{tr(null)}},[Sr,Y]),Lr=(0,q.useMemo)(()=>(0,J.jsx)(a,{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)(pe,{className:`size-4`,"aria-hidden":!0})}),[m.backToProjects]),Rr=(0,q.useMemo)(()=>R?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(U,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:jr,children:[(0,J.jsx)(et,{className:`size-4`,"aria-hidden":!0}),m.workItems.create.header]}),(0,J.jsxs)(U,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void Ar(),disabled:Jn,children:[(0,J.jsx)(Ae,{className:`size-4`,"aria-hidden":!0}),m.common.newChat]})]}):null,[jr,m.common.newChat,m.workItems.create.header,R,Ar,Jn]);(0,q.useLayoutEffect)(()=>(w({startExtra:Lr,main:R?(0,J.jsx)(En,{currentProject:R,pm:m,projectsText:g,wd:p}):(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:Rr}),()=>M()),[M,Rr,Lr,m,R,g,w,p]);function zr(e){le(t=>t?{...t,...e}:null),xe(t=>t?{...t,project:{...t.project,...e}}:null),An(e.defaultAgentId??``),pr(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 Br(){if(!(!R||!Q.name.trim())){Pn(!0),Z(null),Rn(null);try{zr(await h(R.id,{name:Q.name.trim(),status:Q.status,description:Q.description,defaultAgentId:Q.defaultAgentId,brief:Q.brief,instructions:Q.instructions}))}catch(e){let t=_n(e);t?Rn(t):Z(e instanceof Error?e.message:String(e))}finally{Pn(!1)}}}function Vr(e){e.preventDefault(),Br()}let Hr=(0,q.useCallback)(()=>{if(!R)return;let e=R.workspaceRoot?.trim()??``;Vn(e?`fixed`:`follow`),Un(e||R.effectiveWorkspaceRoot||``),Bn(!0)},[R]);async function Ur(e={}){if(!R)return;let t=X===`fixed`?Hn.trim():``;if(!(X===`fixed`&&!t)){Pn(!0),Z(null),Rn(null);try{zr(await h(R.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}})),Bn(!1),Rn(null)}catch(e){let t=_n(e);t?(Rn(t),Bn(!1)):Z(e instanceof Error?e.message:String(e))}finally{Pn(!1)}}}async function Wr(){if(!(!R||Wn)){Gn(`pin`),Z(null);try{zr(R.pinnedAt?await ze(R.id):await ce(R.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Gn(null)}}}async function Gr(){if(!(!R||Wn)){Gn(`archive`),Z(null);try{zr(R.status===`archived`?await C(R.id):await Ee(R.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Gn(null)}}}async function Kr(){if(R){qn(!0),Z(null);try{await ye(R.id),In(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{qn(!1)}}}async function qr(){if(!(!R||Mt)){Nt(!0),Z(null);try{await x(R.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Nt(!1)}}}let Jr=(0,q.useCallback)(e=>{Rt(e)},[]),Yr=(0,q.useCallback)((e,t)=>{t||Rt(e)},[]),Xr=(0,q.useCallback)(async(e,t,n)=>{let r=R?.id;if(r)switch(e){case`preview`:t.isDirectory||Rt(t.path);break;case`download`:if(t.isDirectory)return;try{let e=ne(t.path);if(D(z(e))!==`text`){let n=await gt(t.path,{projectId:r}),i=te(e)??`application/octet-stream`;N(e,await n.arrayBuffer(),i)}else{let{content:n}=await v(t.path,{projectId:r});oe(e,n)}}catch(e){fe(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await u(t.absolutePath??t.path)&&fe(`success`,c.workspace.pathCopied,void 0,{duration:2500})}catch{fe(`warning`,c.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}},[c.clipboard.copyFailed,c.workspace.pathCopied,R?.id]),Zr=(0,q.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),Ht(!0);let r=e.clientX,i=zt,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=en(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ht(!1),Bt(c),nn(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)},[zt]);if((0,q.useEffect)(()=>{$!==`files`&&Rt(null)},[e,$]),jn)return(0,J.jsx)(`main`,{className:`w-full flex-1 px-3 py-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:m.loading});if(!R)return(0,J.jsxs)(`main`,{className:`w-full flex-1 px-3 py-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(a,{to:`/projects`,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,J.jsx)(pe,{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:cr||m.notFound})]});let Qr=W?.recentSessions.length?W.recentSessions:R.recentSessions,$r=W?.attentionItems??[],ei=e=>m.statuses[e]??e,ti=e=>sn(m.common.messages,{count:e}),ni=Oe.trim().toLowerCase(),ri=ni?we.filter(e=>{let t=cn(e.updatedAt),n=e.routing?.agentId||e.agentId||m.common.agent,r=e.name?.trim()||m.sessions.fallbackTitle,i=ti(e.messageCount??0),a=xn(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(ni)}):we,ii=we.length>0&&ri.length===0,ai=On.find(e=>e.id===Q.defaultAgentId)?.name||Q.defaultAgentId||m.settings.globalDefaultAgent,oi=On.find(e=>e.id===Q.defaultAgentId),si=R.workspaceRoot?.trim()||``,ci=R.status===`archived`,li=!!R.pinnedAt,ui=!si,di=si||oi?.workspace||R.effectiveWorkspaceRoot||m.common.defaultWorkspace,fi=X===`fixed`?Hn.trim()||m.settings.workspacePlaceholder:oi?.workspace||R.effectiveWorkspaceRoot||m.common.defaultWorkspace,pi=(X===`fixed`?Hn.trim():``)!==si&&(X===`follow`||!!Hn.trim()),mi=[{id:`overview`,icon:V,label:m.surfaceTabs.overview},{id:`work`,icon:b,label:m.surfaceTabs.work},{id:`context`,icon:k,label:m.surfaceTabs.context}],hi=Jt.filter(e=>e.id!==`overview`&&e.id!==`work-items`&&e.id!==`files`);async function gi(){if(!di)return;let e=await u(di);fe(e?`success`:`warning`,e?c.workspace.pathCopied:c.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function _i(){Rn(null),Bn(!0)}return(0,J.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden px-3 py-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)(yt,{items:mi,activeTab:an($),onChange:e=>hr(on(e)),ariaLabel:m.navAria,tabIdPrefix:`project-surface-tab`,className:`min-w-0 flex-1`}),(0,J.jsxs)(T,{children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsxs)(U,{type:`button`,variant:hi.some(e=>e.id===$)?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,children:[m.surfaceTabs.details,(0,J.jsx)(Be,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,J.jsx)(re,{children:(0,J.jsx)(B,{align:`end`,sideOffset:6,className:`z-[70] w-48 rounded-xl border border-edge bg-surface-panel p-1.5 shadow-float`,children:hi.map(e=>{let t=e.icon,n=e.id===`work-items`?m.workItems.tab:m.tabs[e.id];return(0,J.jsx)(L,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:s(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm hover:bg-surface-hover`,$===e.id?`bg-accent-soft text-accent-fg`:`text-fg-muted`),onClick:()=>hr(e.id),children:[(0,J.jsx)(t,{className:`size-4`,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:n})]})},e.id)})})})]})]}),cr?(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:cr}):null,(0,J.jsxs)(`div`,{className:s(`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-surface-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:W?.digest?.summary||W?.recommendedAction||R.description||R.brief||m.overview.directionFallback}),W?.digest?.nextAction?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:sn(m.overview.recommendedNext,{action:W.digest.nextAction})}):null]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,J.jsxs)(U,{type:`button`,variant:`secondary`,onClick:()=>void qr(),disabled:Mt,children:[(0,J.jsx)(F,{className:`size-4`,"aria-hidden":!0}),Mt?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)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>sr(!0),children:[(0,J.jsx)(et,{className:`size-4`,"aria-hidden":!0}),m.overview.goal]})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:W?.nextActions.length?W.nextActions.map(e=>(0,J.jsxs)(a,{to:_r(e.goalId),onClick:br(`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:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,ln(e.status)),children:ei(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}),$r.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-3`,children:$r.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)(l,{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?` · ${ei(e.status)}`:``]})]});return e.href?(0,J.jsx)(a,{to:e.href,onClick:br(xr(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:Pr,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:dr.title,onChange:e=>fr(t=>({...t,title:e.target.value})),placeholder:m.overview.blockerTitlePlaceholder}),(0,J.jsx)(U,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:ir||!dr.title.trim(),"aria-label":ir?m.overview.addingBlocker:m.overview.addBlocker,title:ir?m.overview.addingBlocker:m.overview.addBlocker,children:(0,J.jsx)(et,{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)(Ze,{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:()=>hr(`sessions`),children:m.common.viewAll})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Qr.length?Qr.map(e=>(0,J.jsxs)(a,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:br(`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:cn(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.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-work`,children:[(0,J.jsxs)(`div`,{className:`mb-3 flex shrink-0 flex-wrap items-center justify-between gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-3 py-2`,children:[(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.surfaceTabs.workHint}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[`goals`,`workflows`,`automations`].map(e=>(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,onClick:()=>hr(e),children:m.tabs[e]},e))})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,J.jsx)(qt,{projectId:R.id,createRequestKey:Xn})})]}):null,$===`workflows`?(0,J.jsxs)(`section`,{id:`project-panel-workflows`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-work`,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)(U,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Sr(),disabled:Qn,children:[(0,J.jsx)(_t,{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:Qn&&Ge.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.workflows.loadingRuns}):Ge.length?Ge.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:()=>yr(`workflows`,ht(e.id,{ownerAgentId:Y||e.metadata?.agentId||R.defaultAgentId})),children:e.title||e.definitionId}),(0,J.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,un(e.status)),children:ei(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:sn(m.workflows.runMeta,{definitionId:e.definitionId,done:e.metrics.doneAgentCount,total:e.metrics.agentCount,time:cn(e.createdAtMs)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>yr(`workflows`,ht(e.id,{ownerAgentId:Y||e.metadata?.agentId||R.defaultAgentId})),children:m.common.open}),n?(0,J.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:er===`retry:${e.id}`,onClick:()=>void Fr(e),children:[(0,J.jsx)(_t,{className:`size-3.5`,"aria-hidden":!0}),m.common.retry]}):null,t?(0,J.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:er===`cancel:${e.id}`,onClick:()=>void Ir(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:Re.length?Re.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(R.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)(ge,{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-surface-tab-work`,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)(U,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Cr(),disabled:it,children:[(0,J.jsx)(_t,{className:`size-4`,"aria-hidden":!0}),m.common.refresh]}),(0,J.jsxs)(U,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>yr(`automations`,`/automations?projectId=${encodeURIComponent(R.id)}&action=create`),children:[(0,J.jsx)(et,{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:it&&Je.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.automations.loading}):Je.length?Je.map(e=>{let t=G.find(t=>t.automationId===e.id),n=e.state.runningRunId?G.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:()=>yr(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,J.jsx)(`span`,{className:s(`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:sn(m.common.lastRun,{trigger:e.trigger.kind,action:e.action.kind,time:t?cn(t.createdAtMs):m.common.never})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:lt===`run:${e.id}`||!!n,onClick:()=>void Tr(e),children:[(0,J.jsx)(ge,{className:`size-3.5`,"aria-hidden":!0}),m.automations.run]}),(0,J.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:lt===`toggle:${e.id}`,onClick:()=>void Er(e),children:[e.enabled?(0,J.jsx)(rt,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(ge,{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)(U,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>yr(`automations`,`/automations?projectId=${encodeURIComponent(R.id)}&action=create`),children:[(0,J.jsx)(_e,{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:G.length?G.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:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,un(e.status)),children:ei(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:cn(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:R.workspaceRoot||R.effectiveWorkspaceRoot||m.common.defaultWorkspace})]})]})]}):null,$===`notes`?(0,J.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,J.jsx)(vt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(R.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,listTag:`project:${R.id}`,captureTags:[`project:${R.id}`,R.slug],listTitle:m.notes.title,listDescription:m.notes.hint,emptyText:m.notes.emptyTitle,emptyDescription:m.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${R.id}`})}):null,$===`files`?(0,J.jsxs)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,className:`flex h-full min-h-[28rem] flex-col gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-start justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 max-w-3xl`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.surfaceTabs.contextTitle}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:R.brief||R.instructions||R.description||m.surfaceTabs.contextFallback})]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,children:[`sessions`,`notes`,`settings`].map(e=>(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,onClick:()=>hr(e),children:m.tabs[e]},e))})]}),(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:R.effectiveWorkspaceRoot?(0,J.jsxs)(`div`,{"data-project-files-grid":!0,className:s(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Vt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${zt}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)(ot,{workspacePath:di}),(0,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,className:s(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Ut&&`bg-surface-hover text-fg`),onClick:()=>Wt(!0),"aria-label":m.files.search,title:m.files.search,"aria-pressed":Ut,children:(0,J.jsx)(H,{className:`size-3.5`,"aria-hidden":!0})}),(0,J.jsx)(E,{className:`size-7 shrink-0 rounded-md p-0`,loading:hn,label:c.cron.refresh,onClick:()=>void Dr()})]})]}),Ut?(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)(H,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`text`,role:`searchbox`,value:Gt,onChange:e=>Kt(e.target.value),placeholder:m.files.searchPlaceholder,"aria-label":m.files.searchPlaceholder,autoFocus:!0,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:()=>{Kt(``),Wt(!1)},children:(0,J.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Sn?(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:Sn}):null,kr?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Zt?(0,J.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,J.jsx)(_,{className:`h-11 w-full`}),(0,J.jsx)(_,{className:`h-11 w-full`}),(0,J.jsx)(_,{className:`h-11 w-full`})]}):$t?(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[c.workspace.loadError,`: `,$t]}):Yt.length===0?(0,J.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:m.files.noSearchResults}):Yt.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:s(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Lt===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Rt(e.path),title:e.path,children:[(0,J.jsx)(he,{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))}):hn&&Pt.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.files.loading}):(0,J.jsx)(me,{tree:Pt,selectedPath:Lt,onSelectFile:Jr,onSelectEntry:Yr,onExpandDir:e=>void Or(e),onAction:Xr,actionLabels:{preview:c.workspace.preview,download:c.workspace.download,copyPath:c.workspace.copyPath,openDefault:c.workspace.openSystemApp,openWith:c.workspace.openWith,revealInFolder:c.workspace.revealInFolder,recommendedApps:c.workspace.recommendedApps},emptyHint:m.files.emptyDirectory})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":m.files.resizeHandle,className:s(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Vt&&`bg-surface-hover`),onPointerDown:Zr,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:Lt?(0,J.jsx)(P,{filePath:Lt,projectId:R.id,onClose:()=>Rt(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)(k,{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)(U,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>hr(`settings`),children:m.files.openSettings})})]})})]}):null,$===`sessions`?(0,J.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,className:`grid min-h-full content-start gap-3`,children:[we.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)(H,{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:Oe,onChange:e=>ke(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`}),Oe?(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:()=>ke(``),children:(0,J.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,ri.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:ri.map(e=>{let t=cn(e.updatedAt),n=e.routing?.agentId||e.agentId||m.common.agent,r=xn(e),i=e.name?.trim()||m.sessions.fallbackTitle,o=ti(e.messageCount??0);return(0,J.jsxs)(a,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:br(`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)(Ae,{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:o})]}),t?(0,J.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[m.sessions.updated,`: `,t]}):null]})]},e.key)})}):ii?(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-surface-tab-work`,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)(U,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3`,disabled:nr,onClick:()=>sr(!0),children:[(0,J.jsx)(et,{className:`size-4`,"aria-hidden":!0}),m.goals.new]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Pe.length?Pe.map(e=>(0,J.jsxs)(a,{to:_r(e.id),onClick:br(`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:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,ln(e.status)),children:ei(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-surface-tab-context`,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:sn(m.activity.count,{count:Et})})]}),(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:At,onChange:e=>jt(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),m.activity.includeRelated]}),(0,J.jsxs)(U,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void wr(),disabled:Ot,children:[(0,J.jsx)(_t,{className:s(`size-4`,Ot&&`animate-spin`),"aria-hidden":!0}),m.common.refresh]})]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Ot&&wt.length===0?(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:m.activity.loading}):wt.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:wt.map(e=>{let t=m.activity.types[e.type]??e.type,n=m.activity.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Cn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===R.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,`: `,yn(e)]})]}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:cn(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,`: `,vn(e)]}),(0,J.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[m.activity.source,`: `,bn(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-surface-tab-context`,onSubmit:Vr,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.contextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.contextHint})]}),(0,J.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,ln(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)(pn,{label:m.settings.workspaceRoot,value:di,mono:!0}),(0,J.jsx)(pn,{label:m.settings.defaultAgent,value:ai}),(0,J.jsx)(pn,{label:m.settings.pinState,value:li?m.settings.pinned:m.settings.notPinned}),(0,J.jsx)(pn,{label:m.settings.createdAt,value:cn(R.createdAt)||m.common.never}),(0,J.jsx)(pn,{label:m.settings.updatedAt,value:cn(R.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)(dn,{label:m.settings.name,children:(0,J.jsx)(`input`,{className:fn(),value:Q.name,onChange:e=>pr(t=>({...t,name:e.target.value}))})}),(0,J.jsx)(dn,{label:m.settings.defaultAgent,children:(0,J.jsxs)(ue,{className:fn(),value:Q.defaultAgentId,onChange:e=>pr(t=>({...t,defaultAgentId:e.target.value})),children:[(0,J.jsx)(S,{value:``,children:m.settings.globalDefaultAgent}),On.map(e=>(0,J.jsx)(S,{value:e.id,children:ct(e,c.agentsSettings)},e.id))]})}),(0,J.jsx)(dn,{label:m.settings.status,children:ci?(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)(ue,{className:fn(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>pr(t=>({...t,status:e.target.value})),children:[(0,J.jsx)(S,{value:`active`,children:m.settings.statuses.active}),(0,J.jsx)(S,{value:`paused`,children:m.settings.statuses.paused})]})}),(0,J.jsx)(dn,{label:m.settings.description,hint:m.settings.descriptionHint,children:(0,J.jsx)(`textarea`,{className:fn(!0),value:Q.description,onChange:e=>pr(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 px-3 py-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:ui?m.settings.workspaceModeFollow:m.settings.workspaceModeFixed})}),(0,J.jsx)(`div`,{className:`mt-2 break-all font-mono text-xs leading-5 text-fg`,title:di,children:di})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,J.jsxs)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void gi(),children:[(0,J.jsx)(nt,{className:`size-4`,"aria-hidden":!0}),m.settings.copyWorkspacePath]}),(0,J.jsx)(ot,{workspacePath:di}),(0,J.jsxs)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Hr,children:[(0,J.jsx)($e,{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.agentContextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.agentContextHint})]}),(0,J.jsx)(dn,{label:m.settings.brief,hint:m.settings.briefHint,children:(0,J.jsx)(`textarea`,{className:fn(!0),value:Q.brief,onChange:e=>pr(t=>({...t,brief:e.target.value}))})}),(0,J.jsx)(dn,{label:m.settings.instructions,hint:m.settings.instructionsHint,children:(0,J.jsx)(`textarea`,{className:fn(!0),value:Q.instructions,onChange:e=>pr(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 px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:li?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)(U,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:Wn===`pin`,onClick:()=>void Wr(),children:[li?(0,J.jsx)(ve,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),li?m.settings.unpinProject:m.settings.pinProject]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:ci?m.settings.restoreTitle:m.settings.archiveTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:ci?m.settings.restoreHint:m.settings.archiveHint})]}),(0,J.jsxs)(U,{type:`button`,variant:ci?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:Wn===`archive`,onClick:()=>void Gr(),children:[ci?(0,J.jsx)(_t,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(A,{className:`size-4`,"aria-hidden":!0}),ci?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)(U,{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:()=>In(!0),children:[(0,J.jsx)(st,{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)(U,{type:`submit`,variant:`primary`,disabled:Nn||!Q.name.trim(),children:[(0,J.jsx)(F,{className:`size-4`,"aria-hidden":!0}),m.common.save]})})]}):null]}),(0,J.jsx)(De,{open:Fn,onOpenChange:e=>{Kn||In(e)},children:(0,J.jsxs)(Me,{children:[(0,J.jsx)(Ie,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(Qe,{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)(l,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(be,{className:`text-base font-semibold text-fg`,children:m.settings.deleteConfirmTitle}),(0,J.jsx)(We,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:R?sn(m.settings.deleteConfirm,{name:R.name}):m.settings.deleteConfirmFallback})]})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,J.jsx)(je,{asChild:!0,children:(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Kn,children:m.common.cancel})}),(0,J.jsxs)(U,{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:Kn||!R,onClick:()=>void Kr(),children:[(0,J.jsx)(st,{className:`size-4`,"aria-hidden":!0}),m.settings.deleteConfirmAction]})]})]})]})}),(0,J.jsx)(De,{open:zn,onOpenChange:e=>{Nn||Bn(e)},children:(0,J.jsxs)(Me,{children:[(0,J.jsx)(Ie,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(Qe,{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)(be,{className:`text-base font-semibold text-fg`,children:m.settings.workspaceMigrationTitle}),(0,J.jsx)(We,{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:s(`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:()=>Vn(`fixed`),disabled:Nn}),(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:s(`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:()=>Vn(`follow`),disabled:Nn}),(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)(bt,{value:Hn,onChange:Un,disabled:Nn,wd:p,placeholder:m.settings.workspacePlaceholder,inputClassName:fn(),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:sn(m.settings.workspaceCurrent,{workspace:fi})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(je,{asChild:!0,children:(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Nn,children:m.common.cancel})}),(0,J.jsxs)(U,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Nn||!pi,onClick:()=>void Ur(),children:[(0,J.jsx)($e,{className:`size-4`,"aria-hidden":!0}),m.settings.workspaceMigrationConfirm]})]})]})]})}),(0,J.jsx)(De,{open:!!Ln,onOpenChange:e=>{e||Rn(null)},children:(0,J.jsxs)(Me,{children:[(0,J.jsx)(Ie,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(Qe,{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)(be,{className:`text-base font-semibold text-fg`,children:m.settings.workspaceMissingTitle}),(0,J.jsx)(We,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Ln?sn(m.settings.workspaceMissingDescription,{workspace:Ln}):null})]}),Ln?(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)(k,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:Ln})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:_i,disabled:Nn,children:m.settings.workspaceMissingBack}),(0,J.jsxs)(U,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Ur({createWorkspaceRoot:!0}),disabled:Nn,children:[(0,J.jsx)($e,{className:`size-4`,"aria-hidden":!0}),m.settings.workspaceMissingCreate]})]})]})]})}),(0,J.jsx)(Ct,{open:or,t:c.goalsPage,chat:c.chat,busy:nr,options:lr,onClose:()=>!nr&&sr(!1),onCreate:Nr})]})}export{Dn as ProjectDetailPage};
|