@intent-hq/web 2.361.2 → 2.361.3
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/package.json +1 -1
- package/web/app/immutable/chunks/-5BGDZDk.js +32 -0
- package/web/app/immutable/chunks/{CGINFMqT.js → -HqAs4SX.js} +1 -1
- package/web/app/immutable/chunks/{D5kZvSPC.js → -kGF-zOh.js} +1 -1
- package/web/app/immutable/chunks/{6d4Jv8Hz.js → 0PJnSjrq.js} +2 -2
- package/web/app/immutable/chunks/{DC3pczce.js → 6XxQdgFC.js} +1 -1
- package/web/app/immutable/chunks/{D1FSU9Gk.js → 9b_Os5fY.js} +1 -1
- package/web/app/immutable/chunks/{As8lK70V.js → 9n20zLe0.js} +1 -1
- package/web/app/immutable/chunks/{CpY-WDD9.js → B0Zr6q55.js} +1 -1
- package/web/app/immutable/chunks/{7tcI69cn.js → B2IYt4Eb.js} +1 -1
- package/web/app/immutable/chunks/{dGnsWF4N.js → B4M3z6rE.js} +1 -1
- package/web/app/immutable/chunks/{BGOuxFsr.js → B5oNMyyY.js} +1 -1
- package/web/app/immutable/chunks/{DOjUJ8i8.js → B61qyrBq.js} +1 -1
- package/web/app/immutable/chunks/{AxCVH26S.js → B8p2cYc_.js} +1 -1
- package/web/app/immutable/chunks/{B2ns9OTA.js → B9WaAaiK.js} +1 -1
- package/web/app/immutable/chunks/{8HLudOb-.js → BA6gfA7a.js} +1 -1
- package/web/app/immutable/chunks/{Cq8fk3CH.js → BA8yVm-p.js} +1 -1
- package/web/app/immutable/chunks/{Bx_nP_MK.js → BC8in_Uv.js} +1 -1
- package/web/app/immutable/chunks/{C_z20mJT.js → BCfq8Fz_.js} +1 -1
- package/web/app/immutable/chunks/{DsCJG1hb.js → BD7zp6rB.js} +1 -1
- package/web/app/immutable/chunks/{B4kCZd9W.js → BDJ7r_mr.js} +1 -1
- package/web/app/immutable/chunks/{CjorBqRt.js → BDk-prCr.js} +1 -1
- package/web/app/immutable/chunks/{BeLtysng.js → BFfD2hCV.js} +1 -1
- package/web/app/immutable/chunks/{buVzC4lf.js → BN7DTISb.js} +1 -1
- package/web/app/immutable/chunks/{QWfAA7k-.js → BPsUIxHc.js} +1 -1
- package/web/app/immutable/chunks/{DAwOD17b.js → BQQo4uEb.js} +1 -1
- package/web/app/immutable/chunks/{CpHAR9_T.js → BRMpz8OI.js} +1 -1
- package/web/app/immutable/chunks/{DHbwKi-E.js → BX7U0hos.js} +2 -2
- package/web/app/immutable/chunks/{BOSMtVmb.js → BXV9Yk-8.js} +1 -1
- package/web/app/immutable/chunks/{1EW4b83o.js → BZgSCYyO.js} +1 -1
- package/web/app/immutable/chunks/{DlBKZ9jQ.js → B_VZNBPj.js} +2 -2
- package/web/app/immutable/chunks/BaGrEyO7.js +1 -0
- package/web/app/immutable/chunks/{BTR14c-t.js → BbUJvzh9.js} +3 -3
- package/web/app/immutable/chunks/{CsqD9xz6.js → BcLoDKLg.js} +2 -2
- package/web/app/immutable/chunks/{CkVsI2Jc.js → BdJDtk-i.js} +1 -1
- package/web/app/immutable/chunks/BeF36lmB.js +3 -0
- package/web/app/immutable/chunks/{Bhx5E4sN.js → BjEuTkmJ.js} +1 -1
- package/web/app/immutable/chunks/{B5Pg9_MZ.js → BlL4snZb.js} +1 -1
- package/web/app/immutable/chunks/{CuGN_Lgy.js → Bm01ytIS.js} +1 -1
- package/web/app/immutable/chunks/{Byj6QL5F.js → BmYxgQYl.js} +1 -1
- package/web/app/immutable/chunks/{cU6Fqv3g.js → Br2374tC.js} +1 -1
- package/web/app/immutable/chunks/{C9otdzZM.js → BrNYPcY3.js} +4 -4
- package/web/app/immutable/chunks/{P-joxIX5.js → BuqbrxB1.js} +1 -1
- package/web/app/immutable/chunks/{52-_4pXR.js → BwKqt4sw.js} +1 -1
- package/web/app/immutable/chunks/{BKw6wLyE.js → Byrb39B5.js} +1 -1
- package/web/app/immutable/chunks/{Cb4s3Dt_.js → C-pqKaCQ.js} +4 -4
- package/web/app/immutable/chunks/{c1DCm8IK.js → C0Be7Tc_.js} +1 -1
- package/web/app/immutable/chunks/{t94_2IkW.js → C4WAGAfI.js} +1 -1
- package/web/app/immutable/chunks/{DVlYg0SZ.js → C6jHCE8G.js} +4 -4
- package/web/app/immutable/chunks/{OiHDtgNp.js → CAi2riH4.js} +1 -1
- package/web/app/immutable/chunks/{DHBQy6St.js → CHFWhULQ.js} +1 -1
- package/web/app/immutable/chunks/{D00mCTUs.js → CI9dMB_b.js} +2 -2
- package/web/app/immutable/chunks/{B9tRD7MQ.js → CIrv4K8l.js} +1 -1
- package/web/app/immutable/chunks/{DaHbZjgp.js → CK3bnTgZ.js} +1 -1
- package/web/app/immutable/chunks/{C4qqiNcA.js → CNDY58le.js} +6 -6
- package/web/app/immutable/chunks/{Bt_RDNlI.js → CNIxi0ch.js} +1 -1
- package/web/app/immutable/chunks/{R1d5Y9eD.js → CP5zM-2z.js} +1 -1
- package/web/app/immutable/chunks/CPk-Lh5Y.js +1 -0
- package/web/app/immutable/chunks/{BAgFsuQz.js → CPzeiVDF.js} +1 -1
- package/web/app/immutable/chunks/{aCDFJfWo.js → CRxUemhR.js} +1 -1
- package/web/app/immutable/chunks/{BbIMIfqX.js → CRynRlXQ.js} +1 -1
- package/web/app/immutable/chunks/{CuoerPJp.js → CSWdbNcY.js} +3 -3
- package/web/app/immutable/chunks/{BG8JSmc7.js → CTU9yjO5.js} +1 -1
- package/web/app/immutable/chunks/{dxPehZVa.js → CWVUBnHm.js} +2 -2
- package/web/app/immutable/chunks/CX5tClKW.js +4 -0
- package/web/app/immutable/chunks/{aokikQw5.js → CY8ea6Mz.js} +13 -13
- package/web/app/immutable/chunks/{B07OdpUU.js → C_5bSDGn.js} +3 -3
- package/web/app/immutable/chunks/{DkgfeEA0.js → C_gwhAv1.js} +1 -1
- package/web/app/immutable/chunks/{CvPVdUUZ.js → CaOJIXi2.js} +1 -1
- package/web/app/immutable/chunks/{BPRz9VyT.js → CaculjlW.js} +1 -1
- package/web/app/immutable/chunks/{CJHViisg.js → CbLPH1Om.js} +5 -5
- package/web/app/immutable/chunks/{Bl2aLOn5.js → CcTYYBo3.js} +1 -1
- package/web/app/immutable/chunks/{CgS1Dv_8.js → CiTbcBZ_.js} +1 -1
- package/web/app/immutable/chunks/{CmVyGqNV.js → Ck96vbIn.js} +2 -2
- package/web/app/immutable/chunks/{C3L3GwMq.js → CkoKtsiL.js} +1 -1
- package/web/app/immutable/chunks/{Wz08guGa.js → Cl9ySU-o.js} +1 -1
- package/web/app/immutable/chunks/{DPfWnZYT.js → ClV-2Tgv.js} +1 -1
- package/web/app/immutable/chunks/{BXId-8a9.js → Clj6cYni.js} +1 -1
- package/web/app/immutable/chunks/{DuTju9rc.js → CniyFe5S.js} +1 -1
- package/web/app/immutable/chunks/{tSlfPnTD.js → CplYX6wM.js} +1 -1
- package/web/app/immutable/chunks/{Ds8ezw9K.js → CrU71cWX.js} +1 -1
- package/web/app/immutable/chunks/CtJsKX7p.js +3 -0
- package/web/app/immutable/chunks/{DwHEsGP4.js → CvCk2zex.js} +1 -1
- package/web/app/immutable/chunks/{5NiJCy7J.js → Cy8IOKwI.js} +1 -1
- package/web/app/immutable/chunks/{CcZqxMtd.js → Cyj5BnLo.js} +1 -1
- package/web/app/immutable/chunks/{CssvkQD7.js → D-xbpOd2.js} +1 -1
- package/web/app/immutable/chunks/{Dtqu7Pxg.js → D1Wd78Sv.js} +1 -1
- package/web/app/immutable/chunks/{BD9wTbmm.js → D3w04cnk.js} +1 -1
- package/web/app/immutable/chunks/{BLFlTVjy.js → D4aqkbtK.js} +4 -4
- package/web/app/immutable/chunks/{DzmdzUVi.js → D6DFaBwR.js} +1 -1
- package/web/app/immutable/chunks/{BpL3mTkL.js → D6YJZGmY.js} +1 -1
- package/web/app/immutable/chunks/{yTlZ1Sih.js → D8uhGa69.js} +1 -1
- package/web/app/immutable/chunks/{DXcrfgZH.js → D9NfptXn.js} +2 -2
- package/web/app/immutable/chunks/{BMYcVUUM.js → DDJAluQE.js} +8 -8
- package/web/app/immutable/chunks/{DjKDfA1m.js → DEfsd-IM.js} +2 -2
- package/web/app/immutable/chunks/{BskEvHZa.js → DEiYC7jA.js} +1 -1
- package/web/app/immutable/chunks/{B9pYL5w0.js → DFF9Hi9i.js} +3 -3
- package/web/app/immutable/chunks/{Db7PzaF_.js → DFNcX1C0.js} +1 -1
- package/web/app/immutable/chunks/{DyIRpoZq.js → DFYGtkP8.js} +1 -1
- package/web/app/immutable/chunks/{BG4tBRsm.js → DLtObTR3.js} +1 -1
- package/web/app/immutable/chunks/{D9H2UCuG.js → DN_KP1eV.js} +1 -1
- package/web/app/immutable/chunks/{kbpbXlKS.js → DOT4zZfJ.js} +1 -1
- package/web/app/immutable/chunks/{B1Tr5BPZ.js → DPb0TtQV.js} +1 -1
- package/web/app/immutable/chunks/{CytLF-ur.js → DPn3lPe4.js} +6 -6
- package/web/app/immutable/chunks/{YhYmjxML.js → DVuhBCLV.js} +1 -1
- package/web/app/immutable/chunks/{D0VMf2Fp.js → DW97_Hl4.js} +3 -3
- package/web/app/immutable/chunks/{-7du9lfn.js → DWAdterl.js} +1 -1
- package/web/app/immutable/chunks/{TaZ6zGN1.js → DXQV6z-q.js} +1 -1
- package/web/app/immutable/chunks/{Vfi0Dmt8.js → DXZSO_Pq.js} +1 -1
- package/web/app/immutable/chunks/{Big1YQpq.js → DYQPit--.js} +1 -1
- package/web/app/immutable/chunks/{DXXjnBc_.js → DbaAc_-Q.js} +1 -1
- package/web/app/immutable/chunks/{CvH6beJr.js → DjOZegwv.js} +2 -2
- package/web/app/immutable/chunks/{CVOsommd.js → DjVOU0sF.js} +2 -2
- package/web/app/immutable/chunks/{MzfVdJbX.js → DjXnrfed.js} +1 -1
- package/web/app/immutable/chunks/{Tqm9-f9l.js → DjYh06U7.js} +1 -1
- package/web/app/immutable/chunks/{rUCEwUE_.js → DlrcSqxf.js} +1 -1
- package/web/app/immutable/chunks/{D3rVaYU0.js → Dm-oOl0S.js} +2 -2
- package/web/app/immutable/chunks/{BKHUH54N.js → DmVQU-Au.js} +1 -1
- package/web/app/immutable/chunks/{sLpI8Vr2.js → DuAq2d-z.js} +1 -1
- package/web/app/immutable/chunks/{W67SWYQh.js → DvFk8gJm.js} +1 -1
- package/web/app/immutable/chunks/{96DwTK9j.js → F-reQTNB.js} +2 -2
- package/web/app/immutable/chunks/{BQKRBk9B.js → KEUh5hD5.js} +1 -1
- package/web/app/immutable/chunks/{D0g6v2_u.js → KGxZpRD9.js} +1 -1
- package/web/app/immutable/chunks/R437Q8zA.js +1 -0
- package/web/app/immutable/chunks/{5u3dQlae.js → RgHRltXX.js} +1 -1
- package/web/app/immutable/chunks/{DkNdI_Wp.js → SLOyQ3jf.js} +1 -1
- package/web/app/immutable/chunks/{CNUg0Cs8.js → U3T1b0A0.js} +6 -6
- package/web/app/immutable/chunks/{CO15VKbw.js → U_l2ralE.js} +6 -6
- package/web/app/immutable/chunks/{C1wjuTFV.js → XQIQgSrx.js} +1 -1
- package/web/app/immutable/chunks/{DQTzZEWU.js → ZRRp1hhY.js} +2 -2
- package/web/app/immutable/chunks/{Ch9oF0ek.js → a3nqHBzJ.js} +1 -1
- package/web/app/immutable/chunks/{Bl0Adq86.js → bPNHL4zz.js} +1 -1
- package/web/app/immutable/chunks/{B0JbhmMb.js → bXhYFuj1.js} +1 -1
- package/web/app/immutable/chunks/{ivBdCvd6.js → bbt-Xoef.js} +7 -7
- package/web/app/immutable/chunks/{Bgk8kfr8.js → bwHjDwdJ.js} +1 -1
- package/web/app/immutable/chunks/{CpBPE3-0.js → cGac-dAI.js} +1 -1
- package/web/app/immutable/chunks/{Bya2sQrR.js → eq9tvf9b.js} +1 -1
- package/web/app/immutable/chunks/{DD4-FHBp.js → gddqvxSN.js} +1 -1
- package/web/app/immutable/chunks/{D4LnecGU.js → iJ9AQT8V.js} +2 -2
- package/web/app/immutable/chunks/{CyQJi5fM.js → oaLXPqeM.js} +1 -1
- package/web/app/immutable/chunks/{CrLichOk.js → rTvMsiiT.js} +1 -1
- package/web/app/immutable/chunks/{CkuFMgpI.js → sr1p2voA.js} +1 -1
- package/web/app/immutable/chunks/{C5cRG0yV.js → t63qkPWO.js} +3 -3
- package/web/app/immutable/chunks/{C-Qm3bfA.js → tQrId4UU.js} +1 -1
- package/web/app/immutable/chunks/xCRj0TCH.js +176 -0
- package/web/app/immutable/chunks/{T_1hfFnC.js → xUNvQVfC.js} +2 -2
- package/web/app/immutable/chunks/{BSM5O6JV.js → yetPhaeQ.js} +1 -1
- package/web/app/immutable/entry/{app.CYYj7JvH.js → app.DAdpRY1S.js} +2 -2
- package/web/app/immutable/entry/start.C3GynpgH.js +1 -0
- package/web/app/immutable/nodes/{0.vJoG8nTo.js → 0.DQlRpqsp.js} +1 -1
- package/web/app/immutable/nodes/{1.Di6AbyQm.js → 1.C5UPpIV8.js} +1 -1
- package/web/app/immutable/nodes/{10.BkazfxT8.js → 10.q4ZZkPo0.js} +4 -4
- package/web/app/immutable/nodes/{11.Ck_7PTgk.js → 11.Bzf2tPWN.js} +1 -1
- package/web/app/immutable/nodes/{15.DWwqZzAg.js → 15.DLDKAp8B.js} +1 -1
- package/web/app/immutable/nodes/{19.CjDPuA-n.js → 19.BYPJywV2.js} +2 -2
- package/web/app/immutable/nodes/{2.B7bl9OWL.js → 2.ByiO--8z.js} +12 -12
- package/web/app/immutable/nodes/{20.tmuZaULh.js → 20.BztXJVwA.js} +1 -1
- package/web/app/immutable/nodes/{3.CY1Mye6q.js → 3.lFs0YjGZ.js} +1 -1
- package/web/app/immutable/nodes/{4.sNrk6dxf.js → 4.e6azWsLT.js} +1 -1
- package/web/app/immutable/nodes/{5.BrOibHKo.js → 5.Bq1EvpM9.js} +1 -1
- package/web/app/immutable/nodes/{6.BVYLHxv3.js → 6.Bs908U_Q.js} +1 -1
- package/web/app/immutable/nodes/{7.BZ0ZLzU_.js → 7.kb8QHtK2.js} +1 -1
- package/web/app/immutable/nodes/{8.BNlg4qDc.js → 8.CQyVjnar.js} +1 -1
- package/web/app/immutable/nodes/{9.C8X38wWW.js → 9.CfGq7FRR.js} +4 -4
- package/web/app/version.json +1 -1
- package/web/index.html +9 -9
- package/web/app/immutable/chunks/0_7FQkiC.js +0 -1
- package/web/app/immutable/chunks/BEyxbMng.js +0 -18
- package/web/app/immutable/chunks/CeFme0q3.js +0 -1
- package/web/app/immutable/chunks/Cq0xvhw9.js +0 -3
- package/web/app/immutable/chunks/DWWTsFh-.js +0 -190
- package/web/app/immutable/chunks/DvCS4TTw.js +0 -1
- package/web/app/immutable/chunks/lZNvj_WH.js +0 -4
- package/web/app/immutable/chunks/yAiwGS7g.js +0 -3
- package/web/app/immutable/entry/start.BH_-Ros5.js +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/
|
|
2
|
-
var Ct=Object.defineProperty;var Dt=(e,t,n)=>t in e?Ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pe=(e,t,n)=>Dt(e,typeof t!="symbol"?t+"":t,n);import{IX as A,i as be,nK as R,w9 as Rt,B$ as Ge,wb as xt,Dc as Ye,cE as Pt,cF as Bt,nL as Je,nx as Ot,e as ke,fM as $t,l_ as Lt,cM as Ut}from"./BkzMrEqG.js";import{B as Nt,O as Ht,dH as Be,cG as pe,ds as Ft,al as Kt,b1 as Xe,z as Wt,dT as jt}from"./BEyxbMng.js";import{e as qt,b as ae,F as Vt,y as re,_ as ve,G as zt,C as Gt,W as Qe,v as Yt,u as Jt,M as Xt}from"./Bd1FsnP3.js";import{D as Oe,a as Qt,d as Zt}from"./CQcEqK4G.js";import{l as en,o as tn,g as Ze,r as nn,m as an,D as rn}from"./C2-RFhPx.js";import{e as sn}from"./CbSeeP7P.js";import{z as et,N as on}from"./DWPd-rzt.js";import{f as cn}from"./BnSNaeNS.js";import{bm as b,_ as fe}from"./AeC4KVgG.js";import{aa as tt,aB as se,J as he,a as nt,n as at,cS as rt,e as st,aI as it,M as ln,ac as dn,aV as $e,d as le,C as un,cT as mn,U as pn,a6 as fn,aJ as hn,b_ as gn}from"./B0JbhmMb.js";import{W as yn,L as wn,w as bn,R as kn,M as vn,h as _n}from"./jhNNYE0v.js";import{l as q,i as Sn,n as Mn}from"./DWUO9rBe.js";import{x as An,J as In,ai as Tn,ar as En}from"./D0VMf2Fp.js";import{a as Le,b as Cn,g as Dn}from"./DypB-Dwi.js";import{m as Rn}from"./dxPehZVa.js";import{C as xn}from"./B5aYN90J.js";import{i as Pn}from"./T_1hfFnC.js";import{o as $,e as Bn,l as V,s as E,n as ce,b as On,d as $n,c as Ln}from"./CIyUrgF0.js";const Dr=A.createSelector((e,t)=>e.unreadTracking.dividerSessionByAgentId[t]??null),Rr=A.createSelector(e=>e.unreadTracking.currentlyViewedAgentId),xr=A.createSelector(e=>{const t=[];for(const s of Object.values(e.panelLayout.byWorkspaceId))for(const i of Object.values(s.panels))for(const o of i.tabs)o.type==="agent"&&o.agentId&&t.push(o.agentId);const n=Object.keys(e.unreadTracking.dividerSessionByAgentId),a=new Set(e.agentSessions.agentIdsByWorkspace[be]??[]);return{chiefCardVisible:e.sidebarNav.panelItem==="chief",chiefSessionAgentIds:n.filter(s=>a.has(s)),dividerSessionAgentIds:n,openAgentTabIds:t}});function Pr(e,t){if(e)return e.model}function Un({messages:e,pendingInitialPrompt:t,pendingContextReferenceCount:n=0}){return e.length>0||!!t||n>0}function Br({session:e,messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a=0}){return!(e?Nt(e):!1)&&!Un({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a})}function Or(e){return Ht(e.messageMetadata)}function Nn(e){return{id:e.id,appMessageId:e.appMessageId,role:"user",timestamp:new Date(e.createdAt??0).toISOString(),contentBlocks:[...e.content?[{type:"text",text:e.content}]:[],...e.imageBlocks??[],...e.fileBlocks??[]],metadata:e.messageMetadata,...e.author!==void 0?{author:e.author}:{}}}function $r(e){return Nn({...e,createdAt:Date.parse(e.queuedAt)})}const Hn=8*1024*1024,Fn=3*1024*1024;function Kn(e){return Math.ceil(Math.max(0,e)/3)*4}function Wn(e){const t=e.promptBase64Bytes;return e.mimeType==="image/jpeg"&&Number.isSafeInteger(e.size)&&e.size>0&&e.size<=Fn&&typeof t=="number"&&t===Kn(e.size)?t:null}async function ot(e,t,n,a,r=()=>{}){const s=()=>{if(!a())throw new Error("media-send-retired")};if(s(),r("overlay-render"),!n.exportMedia)throw new Error("media-export-unavailable");const i=en(e.source,e.saved);if(i.length>1e4)throw new Error("media-animation-layer-limit");const o=[];for(const c of i)s(),o.push({...c,png:await tn(e.source,e.saved,c.atMs)});s(),r("export");const l=await n.exportMedia({outputVersion:qt,jobId:t,media:e,layers:o});if(s(),!l.ok)throw new Error(["media-export-failed",l.error].filter(Boolean).join(":"));return{jobId:t,value:l.value}}const _e={CLIPBOARD_WRITE:"dock-media:clipboard-write",CLIPBOARD_READ:"dock-media:clipboard-read",MENU:"dock-media:menu"};function Ue(e,t){return Math.max(0,(e.pausedAt??t)-e.startedAt-(e.pausedMs??0))}function ge(e,t){if(!t?.startsWith(".intent/attachments/"))return;const n=t.split("/").map(encodeURIComponent).join("/"),a=tt(`intent://local/file/${n}`,e);return a?.kind==="video"?a.url:void 0}function jn(e){const t=e.video==="full"?b.dock_captureEditor_videoFull_label():b.dock_captureEditor_videoHighlights_label(),n=e.voice==="audio"?b.dock_captureEditor_voiceAudio_label():e.voice==="transcript"?b.dock_captureEditor_voiceTranscript_label():b.dock_captureEditor_voiceOff_summary();return`${t} · ${n}`}function qn(e,t,n,a){if(a?.error==="permission")return a.kind==="pick"?"accessibility":"screen";if(e==="permission"||t==="permission")return"screen";if(n?.startsWith("microphone-permission"))return"microphone";if(n?.startsWith("speech-permission"))return"speech"}const j=cn;function Lr(e){const{view:t,items:n,local:a,labels:r,copy:s}=e,i=t.speech.error??t.speech.capability?.reason??null,o=qn(t.captureError,t.clips.find(g=>g.status==="failed"&&g.error==="permission")?.error??null,i,t.annotationIssue),l=t.annotationIssue?.error==="unavailable"?s?.annotationUnavailable:void 0,c=t.annotationIssue,d=t.captureError==="permission",u=c?.error==="permission"&&c.kind!=="pick",h=c?.error==="permission"&&c.kind==="pick",p=i?.startsWith("speech-permission")?"speech":i?.startsWith("microphone-permission")||i==="permission"?"microphone":void 0,m={},y={},f=(g,D,U)=>{m[g]=D,U&&(y[g]=U)};s&&(d&&(f("capture",s.permission,"screen"),t.recording||f("record",s.permission,"screen")),u&&!t.annotating&&f("annotate",s.permission,"screen"),h&&(f("pick",s.accessibilityPermission,"accessibility"),t.tool==="pick"&&!t.annotating&&f("annotate",s.accessibilityPermission,"accessibility")),p&&!t.dictation&&f("mic",(i&&r.speechError?.(i))??s.speechPermission,p));const k=g=>{const D=y[g];D&&e.actions.onOpenSettings(D)},v=new Set(t.evidenceOwnedItemIds),I=t.clips.find(g=>g.status==="recording"),S=t.clips.length>=ae.clips,_=t.capabilities,B=t.speech.available,C=new Set(t.clips.filter(g=>g.status==="recording"||g.status==="placing"||!!g.media).flatMap(g=>g.captureHistory?.map(D=>D.image.id)??[])),P=[...t.tiles.filter(({image:g,marks:D})=>!!g.media||g.source!=="annotate"||!C.has(g.id)||D.some(({mark:U})=>!U.clipId)).map(({image:g,marks:D})=>({kind:"image",id:g.contextItemId,url:a.previews[g.id]??"",markCount:D.length,owner:"evidence",...a.previews[g.id]?{}:{status:"placing"}})),...t.clips.filter(g=>!g.discarding).map(g=>({kind:"clip",id:g.contextItemId??g.id,duration:j(g.status==="recording"?Ue(g,a.now):g.durationMs),recording:g.status==="recording",...g.media?.saved?{summary:jn(g.media.saved)}:{},...g.status==="ready"&&ge(e.workspaceId,g.path)?{url:ge(e.workspaceId,g.path)}:{},owner:"evidence",...g.status==="placing"?{status:"placing"}:{},...g.status==="failed"?{status:"failed",...g.error==="limit"?{error:b.dock_composer_clipTooLarge_error()}:{}}:{}})),...n.filter(g=>!v.has(g.id)).map(g=>({...g.imageData&&g.imageMimeType?{kind:"image",id:g.id,url:`data:${g.imageMimeType};base64,${g.imageData}`,markCount:0,file:{name:g.label,imageData:g.imageData,imageMimeType:g.imageMimeType}}:{kind:"file",id:g.id,name:g.label},owner:"attachment",...g.placementStatus==="placing"?{status:"placing"}:{},...g.placementStatus==="failed"?{status:"failed",error:g.placementError}:{}}))];return{mediaStatus:t.recording?{kind:"recording",label:r.recording}:t.dictation?{kind:"listening",label:r.listening}:t.annotating?{kind:"annotating",label:r.annotating}:void 0,...o?{settingsPane:o}:{},...l?{annotationNotice:l}:{},labels:r,attachments:P,...s?{placeholder:t.dictation?"":s.idle}:{},state:{captureRevision:t.captureAccepted,capturePending:t.capturePending,captureDisabled:!_.capture||t.captureDisabled,...t.captureDisabled?{captureTooltip:r.captureLimit}:{},captureMode:t.evidence?.annotation?"fullscreen":t.captureMode,captureModesAvailable:!!_.captureModes&&!t.evidence?.annotation,annotationActive:t.annotating,tool:t.tool,toolUsed:t.toolUsed,annotationDisabled:!_.annotate,recording:t.recording&&!I?.discarding,recordingDisabled:!!I?.discarding||!t.recording&&(!_.record||S),...S&&!t.recording?{recordingTooltip:r.clipLimit}:{},recordingTime:j(I?Ue(I,a.now):0),dictating:!!t.dictation,dictationPending:t.speech.pending||t.dictation?.status==="transcribing",dictationDisabled:!B&&!t.dictation&&!m.mic,...t.speech.error&&r.speechError?{dictationTooltip:r.speechError(t.speech.error)}:{},dictationTime:t.dictation?j(a.now-t.dictation.startedAt):j(0),inputLevels:t.speech.levels,...Object.keys(m).length?{alerts:m}:{}},...e.actions,...t.fileAttachmentsEnabled===!1?{onEdit:void 0}:{},onAlert:k,beforeSubmit:e.beforeSubmit}}const Se=()=>globalThis.electronAPI,Vn=["image/png","image/jpeg","image/webp"],Ne=e=>Vn.includes(e??"")?e:null;function He(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a+=1)n[a]=t.charCodeAt(a);return n}async function Ur(e,t){const{view:n,items:a,previews:r}=t,s=n.tiles.find(({image:c})=>c.id===e||c.contextItemId===e);if(s){const c=a.find(p=>p.id===s.image.contextItemId),d=s.image.media;if(s.image.mediaError)return null;if(d?.saved){if(!t.createSavedPreviewUrl||!t.revokeUrl)return null;const p={...d,saved:d.saved},m=await t.createSavedPreviewUrl(t.workspaceId,p);try{const y=await t.fetchBytes(m),f=p.saved.crop;return{kind:"image",name:c?.label||"screenshot.png",mimeType:"image/png",bytes:y,intent:{pixels:{mimeType:"image/png",width:Math.max(1,Math.round(f?.w??p.source.width)),height:Math.max(1,Math.round(f?.h??p.source.height)),displayScale:s.image.displayScale,capturedAt:s.image.capturedAt},raw:y,marks:[]}}}finally{t.revokeUrl(m)}}const u=Ne(c?.imageMimeType),h=r[s.image.id];return!c?.imageData||!u||!h?null:{kind:"image",name:c.label||"screenshot.png",mimeType:"image/png",bytes:await t.fetchBytes(h),intent:{pixels:{mimeType:u,width:s.image.width,height:s.image.height,displayScale:s.image.displayScale,capturedAt:s.image.capturedAt,...s.image.hash?{hash:s.image.hash}:{}},raw:He(c.imageData),marks:s.marks.map(({mark:p})=>({tool:p.tool,geometry:p.geometry,bounds:p.bounds,element:p.element}))}}}const i=n.clips.find(c=>c.id===e||c.contextItemId===e);if(i){const c=i.status==="ready"?ge(t.workspaceId,i.path):null;if(!c)return null;const d=a.find(h=>h.id===i.contextItemId),u=await t.fetchBytes(c);if(!Gn(u))throw new Error("Not a recording file");return{kind:"clip",name:d?.label||`recording-${i.id.slice(0,8)}.mp4`,mimeType:d?.attachmentMimeType||"video/mp4",bytes:u,durationMs:i.durationMs,hasMicAudio:i.hasMicAudio}}const o=a.find(c=>c.id===e),l=Ne(o?.imageMimeType);return o?.imageData&&l?{kind:"image",name:o.label||"image",mimeType:l,bytes:He(o.imageData)}:null}async function zn(e){const t=await fetch(e);if(!t.ok)throw new Error(`Media request failed (${t.status})`);const n=new Uint8Array(await t.arrayBuffer()),a=Number(t.headers.get("content-length")??Number.NaN);if(n.byteLength===0||Number.isFinite(a)&&a!==n.byteLength)throw new Error("Media response was incomplete");return n}function Gn(e){return e.byteLength>8&&String.fromCharCode(...e.subarray(4,8))==="ftyp"}async function Nr(e){try{return(await Se()?.invoke(_e.CLIPBOARD_WRITE,e))?.ok===!0}catch{return!1}}async function Yn(){try{return await Se()?.invoke(_e.CLIPBOARD_READ,{})??null}catch{return null}}async function Hr(e){try{const t=await Se()?.invoke(_e.MENU,{canCut:e});return t?.action==="copy"||t?.action==="cut"?t.action:null}catch{return null}}const Fe=new WeakSet;async function Jn(e,t){const[n]=e;if(e.length!==1||!n||n.size!==t.size)return!1;try{const a=await crypto.subtle.digest("SHA-256",await n.arrayBuffer());return Array.from(new Uint8Array(a),s=>s.toString(16).padStart(2,"0")).join("")===t.sha256}catch{return!1}}function Fr(e,{onIntentMedia:t,isCurrent:n,read:a=Yn}){const r=e.clipboardData;if(Fe.has(e)||!r||r.files.length===0)return!1;const s=e.target,i=Array.from(r.files),o=r.types.filter(l=>l!=="Files").map(l=>[l,r.getData(l)]);return e.preventDefault(),e.stopImmediatePropagation(),a().catch(()=>null).then(async l=>{if(!n())return;if(l&&await Jn(i,l)){n()&&t(l);return}if(!n()||!(s instanceof Node)||!s.isConnected)return;const c=new DataTransfer;for(const u of i)c.items.add(u);for(const[u,h]of o)c.setData(u,h);const d=new ClipboardEvent("paste",{clipboardData:c,bubbles:!0,cancelable:!0});Fe.add(d),s.dispatchEvent(d)}),!0}function Xn(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);return n}function Qn(e){let t="";for(let a=0;a<e.length;a+=32768)t+=String.fromCharCode(...e.subarray(a,a+32768));return btoa(t)}function ct(e){let t=0;return e.endsWith("==")?t=2:e.endsWith("=")&&(t=1),Math.floor(e.length*3/4)-t}async function Zn(e){const t=await crypto.subtle.digest("SHA-256",e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));return Array.from(new Uint8Array(t)).map(n=>n.toString(16).padStart(2,"0")).join("")}const lt={placeAttachment:it,beginAttachmentUpload:st,sendAttachmentUploadChunk:rt,commitAttachmentUpload:at,abortAttachmentUpload:nt,getAttachmentInfo:he,mintIdempotencyKey:se};async function Me(e,t,n,a=lt){const{idempotencyKey:r}=n,s={...r!==void 0?{idempotencyKey:r}:{},...n.rawScreenshot!==void 0?{rawScreenshot:n.rawScreenshot}:{}},i=async m=>mn(m,r)?$e(e,r,a.getAttachmentInfo):void 0;if(ct(n.data)<=ln)try{return await a.placeAttachment(e,t,{data:n.data,mimeType:n.mimeType,...s})}catch(m){const y=await i(m);if(y)return y;throw m}const o=Xn(n.data),l=await Zn(o);let c,d;try{({uploadId:c,maxChunkBytes:d}=await a.beginAttachmentUpload(e,t,o.byteLength,l,{mimeType:n.mimeType,...s}))}catch(m){if(r!==void 0&&dn(m)){const y=await $e(e,r,a.getAttachmentInfo);if(y)return y}throw m}const u=Math.min(pn,d),h=Math.ceil(o.byteLength/u);let p=!1;try{for(let m=0;m<h;m++){const y=o.subarray(m*u,(m+1)*u);await a.sendAttachmentUploadChunk(c,m,Qn(y),e)}return p=!0,await a.commitAttachmentUpload(c,e)}catch(m){const y=p?await i(m):void 0;if(y)return y;throw await a.abortAttachmentUpload(c,e).catch(()=>{}),m}}function ea(e,t){return fn(e,`image-${Date.now()}-${t+1}`)}class Ae extends Error{constructor(n,a){super(n);Pe(this,"retryBlocks");this.name="ImagePlacementError",this.retryBlocks=a}}function ta(e,t){return e instanceof Ae?e.retryBlocks:t}async function na(e,t,n=lt,a=()=>!0){const r=l=>(...c)=>(le(a),l(...c));n={placeAttachment:r(n.placeAttachment),beginAttachmentUpload:r(n.beginAttachmentUpload),sendAttachmentUploadChunk:r(n.sendAttachmentUploadChunk),commitAttachmentUpload:r(n.commitAttachmentUpload),abortAttachmentUpload:r(n.abortAttachmentUpload),getAttachmentInfo:r(n.getAttachmentInfo),mintIdempotencyKey:r(n.mintIdempotencyKey)};const s=[],i=[],o=[];for(let l=0;l<t.length;l++){le(a);const c=t[l];if("attachmentId"in c&&c.attachmentId){const p={type:"image",attachmentId:c.attachmentId,...c.mimeType?{mimeType:c.mimeType}:{}};s.push(p),i.push(p);continue}const d=c,u=d.placementFileName??ea(d.mimeType,l),h=n.mintIdempotencyKey(d.placementIdempotencyKey);try{const p=await Me(e,u,{data:d.data,mimeType:d.mimeType,...h!==void 0?{idempotencyKey:h}:{}},n),m={type:"image",attachmentId:p.attachmentId,...p.mimeType??d.mimeType?{mimeType:p.mimeType??d.mimeType}:{}};s.push(m),i.push(m)}catch(p){const m=un(p);o.push(m?`${u} (${m})`:u),i.push(h!==void 0?{...d,placementIdempotencyKey:h,placementFileName:u}:d)}}if(o.length>0)throw new Ae(b.chat_imagePlacement_failed_error({names:o.join(", ")}),i);return le(a),s}const Kr=Object.freeze(Object.defineProperty({__proto__:null,ImagePlacementError:Ae,base64DecodedBytes:ct,imageRetryBlocks:ta,placeImageAttachment:Me,toImageReferenceBlocks:na},Symbol.toStringTag,{value:"Module"}));function dt(){try{return yn()}catch{return null}}function aa(){return{backendId:A.state.connections.windowBackendId??null,generation:A.state.daemonHealth.connectionGeneration,transport:dt()}}class Ie extends Error{constructor(){super("dock-evidence-backend-changed")}}function N(e,t){return async(...n)=>{e();const a=await t(...n);return e(),a}}const H={current:e=>dt()===e.transport&&A.state.daemonHealth.connectionGeneration===e.generation&&(A.state.connections.windowBackendId??null)===e.backendId,capabilities:()=>wn(),placeImage:(e,t,n,a)=>Me(e,t,n,{placeAttachment:N(a,it),beginAttachmentUpload:N(a,st),sendAttachmentUploadChunk:N(a,rt),commitAttachmentUpload:N(a,at),abortAttachmentUpload:N(a,nt),getAttachmentInfo:N(a,he),mintIdempotencyKey:se}),lookup:(e,t)=>he({workspaceId:e,idempotencyKey:t}),mintKey:se};function G(e){return H.current(e)}function ra(e,t){const n=A.state.dockConversation;return{generation:n.generation,authority:n.authority,clearRevision:R(n.drafts,Vt(e,t))?.clearRevision??0,binding:aa()}}function Wr(e,t,n){const a=ra(e,t);return a.generation===n.generation&&a.authority===n.authority&&a.clearRevision===n.clearRevision&&G(n.binding)}function ut(e,t){return()=>{if(!e.current(t))throw new Ie}}const mt=Object.freeze({rawRetention:!1,chiefAttachments:!1});function jr(e){return e!==mt}const de=new Map;function pt(e,t=H){const n=`${e.backendId}:${e.generation}`;let a=de.get(n);if(!a){const r=ut(t,e);a=(async()=>{r();const i=await t.capabilities();r();const o=i?.server?.capabilities;if(!o||typeof o!="object")throw new Error("unobserved");return{rawRetention:o.rawScreenshotRetention===1,chiefAttachments:o.chiefAttachments===1}})().catch(()=>(de.delete(n),mt)),de.set(n,a)}return a}class Z extends Error{constructor(t){super(`dock-raw-retention-contract:${t}`),this.reason=t}}function ft(e){const{rpcCode:t,code:n}=e??{};return t===-32602||n==="INVALID_PARAMS"}function sa(e){const t=String(e?.message??"");return ft(e)&&(t.includes("rawScreenshotExpired:")||/expired at .*not renewable/i.test(t))}function ia(e,t,n){const a=e.rawScreenshot;if(!a||a.compositeAttachmentId!==t)return null;const r=Date.parse(a.expiresAt);return Number.isFinite(r)?a.expired||r<=n?"expired":{attachmentId:e.attachmentId,expiresAt:a.expiresAt}:null}function Ke(e){return{ok:!0,path:e.path,fileName:e.fileName,size:e.size,attachmentId:e.attachmentId,...e.mimeType?{mimeType:e.mimeType}:{},uploadedAt:e.uploadedAt,replayed:!0,...e.rawScreenshot?{rawScreenshot:e.rawScreenshot}:{}}}class oa extends Error{constructor(t,n){super("dock-evidence-placement-failed"),this.imageId=t,this.failure=n}}const We=e=>e.split("/")[1]?.replace("jpeg","jpg")||"png";async function ca(e){const t=e.api??H,n=e.now??Date.now,a=ut(t,e.binding);a();const r=await pt(e.binding,t);a();const s=r.rawRetention&&(e.workspaceId!==be||r.chiefAttachments),i=[];for(const o of e.images){const l=e.records[o.image.id];let c=l&&l.signature===o.signature&&l.workspaceId===e.workspaceId&&l.backendId===e.binding.backendId?l:{imageId:o.image.id,signature:o.signature,workspaceId:e.workspaceId,backendId:e.binding.backendId,compositeKey:null,rawKey:null,composite:null,raw:null,rawSettled:!1};const d=u=>{c=u,e.onRecord(u)};try{if(!c.composite){const h=c.compositeKey,p=t.mintKey(h??void 0)??null;p!==c.compositeKey&&d({...c,compositeKey:p});let m;h&&p===h&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a()),m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}.${We(o.composite.mimeType)}`,{data:o.composite.base64,mimeType:o.composite.mimeType,...p?{idempotencyKey:p}:{}},a),a()),d({...c,composite:{attachmentId:m.attachmentId,mimeType:m.mimeType??o.composite.mimeType}})}const u=c.composite.attachmentId;if(s&&o.raw&&!c.raw&&!c.rawSettled){const h=c.rawKey,p=t.mintKey(h??void 0);if(p){p!==c.rawKey&&d({...c,rawKey:p});let m;h&&p===h&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a());try{m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}-original.${We(o.raw.mimeType)}`,{data:o.raw.base64,mimeType:o.raw.mimeType,idempotencyKey:p,rawScreenshot:{compositeAttachmentId:u}},a),a());const y=ia(m,u,n());if(y==="expired")d({...c,rawSettled:!0});else if(y)d({...c,raw:y});else throw new Z("echo")}catch(y){if(sa(y))d({...c,rawSettled:!0});else throw y instanceof Z?y:ft(y)?new Z("refused"):y}}else throw new Z("unkeyed")}}catch(u){throw u instanceof Ie?u:new oa(o.image.id,u)}i.push(c)}return i}async function qr(e,t,n,a){const r=()=>{if(!H.current(a))throw new Ie};r();const s=await H.placeImage(e,t,{...n,idempotencyKey:H.mintKey()},r);return r(),s}const la=new Set(["invalid-saved-edit","media-send-retired","transcript-unavailable","transcript-pending","invalid-edit","stale-source","legacy-baked-marks","timing-unavailable","audio-unavailable","media-source-unavailable","media-export-unavailable","media-animation-layer-limit","media-export-failed","legacy-original-unavailable","capture-render-unavailable","capture-blur-unavailable","stale-source-pixels","not-a-screenshot","not-admitted","unavailable","dock-evidence-missing-pixels","draft-restore-failed","image-budget-exceeded"]),da=new Set(["unavailable","permission","failed","busy","cancelled","limit"]);class O extends Error{constructor(t,n){super(n),this.stage=t,this.code=n,this.name="DockSendError"}}function ie(e){const t=e instanceof Error?e.message:typeof e=="string"?e:"";if(t.length>64)return"unclassified";const[n,...a]=t.split(":");return!la.has(n)||a.length>2?"unclassified":n!=="media-export-failed"?a.length?"unclassified":n:[n,...a.map(r=>da.has(r)?r:"other")].join(":")}function Vr(e,t){return e instanceof O?{stage:e.stage,code:ie(e.code)}:{stage:t,code:ie(e)}}function F(e){if(!e||e.source.kind!=="recording")return!1;const t=e.source,n=e.saved??re(t,t.capturedMarks??[],e.transcript);if(n.video!=="full"||n.voice!=="audio"||n.crop||n.blurRegions.length||n.blurStrokes?.length)return!1;const a=ve(n,t,e.transcript);return t.visuals==="clean"?!a.errors.length&&!a.muted&&n.cuts.length===0&&!n.marks.some(r=>r.included)&&a.marks.length===0&&a.transcript===null&&a.kept.length===1&&a.kept[0].startMs===0&&a.kept[0].endMs===t.durationMs&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs===t.durationMs:!a.errors.length&&!a.muted&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs>=t.durationMs}async function ua(e,t,n,a,r,s){const i={images:{},files:[],frames:[],framePromptBytes:[],metadata:[]};let o="validate";try{const l=()=>{if(!r()||!G(n))throw new Error("media-send-retired")};for(const c of[...t.images,...t.clips]){if(o="validate",s?.stage(o),c.mediaError)throw new Error("invalid-saved-edit");if(!c.media||F(c.media))continue;l();const d=structuredClone(c.media),u=d.source;let h=d.saved??re(u,u.capturedMarks??[],d.transcript),p=crypto.randomUUID();try{if(u.kind==="recording"&&h.voice==="transcript"&&d.transcript?.status!=="ready"){if(o="transcribe",s?.stage(o),!a?.transcribeMedia)throw new Error("transcript-unavailable");const f=await a.transcribeMedia({jobId:p,media:d});if(l(),!f.ok)throw new Error("transcript-unavailable");d.transcript=f.value,d.saved||(h=re(u,u.capturedMarks??[],d.transcript))}o="plan",s?.stage(o);const m=ve(h,u,d.transcript);if(m.errors.length)throw new Error(m.errors[0]);const y={id:c.id,kind:u.kind,video:h.video,voice:h.voice,transcript:m.transcript,batches:u.batches,marks:m.marks.map(({n:f,mark:k,frameAtMs:v})=>({n:f,id:k.id,at_ms:v,kind:k.kind,label:k.label,note:k.note,context:k.context,geometry:k.geometry}))};if(u.kind==="screenshot"){o="screenshot-source",s?.stage(o);const f=u.path.split("/").map(encodeURIComponent).join("/"),k=tt(`intent://local/file/${f}`,e);if(!k||k.kind!=="image")throw new Error("media-source-unavailable");const v=await zn(k.url);l();const I={base64:Ze(v.buffer.slice(v.byteOffset,v.byteOffset+v.byteLength)),mimeType:/\.jpe?g$/i.test(u.path)?"image/jpeg":/\.webp$/i.test(u.path)?"image/webp":"image/png"};o="screenshot-render",s?.stage(o),i.images[c.id]=await nn(u,h,I),l()}else{if(!m.clips.length){y.video_attachment_id=null,y.frames=[],y.kept_ms=[],i.metadata.push(y);continue}const f={...d,saved:h};let k=await a?.takePreparedRecording?.(f);if(k&&(p=k.jobId),l(),!k){if(!a)throw new Error("media-export-unavailable");k=await ot(f,p,a,()=>r()&&G(n),S=>{o=S,s?.stage(S),S==="export"&&s?.exportAttempt(p)})}p=k.jobId,o="placement",s?.stage(o);const v=[k.value.video,...k.value.frames],I=[];for(let S=0;S<v.length;S++){l();const _=v[S],B=`capture-${c.id.slice(0,12)}-${S}.${S===0?"mp4":_.mimeType==="image/jpeg"?"jpg":"png"}`,C=await hn(e,B,{sourcePath:_.sourcePath,mimeType:_.mimeType,idempotencyKey:se()},void 0,void 0,()=>r()&&G(n));l(),S===0?i.files.push({type:"file",attachmentId:C.attachmentId,fileName:B,mimeType:C.mimeType??_.mimeType,size:C.size}):(i.frames.push({type:"image",attachmentId:C.attachmentId,mimeType:_.mimeType==="image/jpeg"?"image/jpeg":"image/png"}),i.framePromptBytes.push(Wn(_))),I.push(C.attachmentId)}y.video_attachment_id=I[0],y.frames=k.value.frames.map((S,_)=>({mark_id:S.markId,attachment_id:I[_+1]})),y.kept_ms=m.clips}i.metadata.push(y)}finally{s?.stage("release"),await a?.releaseMediaJob?.(p).catch(()=>{})}}return i}catch(l){throw l instanceof O?l:new O(o,ie(l))}}const ue=1568,ma=.85;async function pa(e,t){const n=Math.round(e.length*3/4/1024),a=await fa(e,t),{width:r,height:s}=a,i=r>ue||s>ue;let o=r,l=s;if(i){const f=ue/Math.max(r,s);o=Math.round(r*f),l=Math.round(s*f)}const c=new OffscreenCanvas(o,l),d=c.getContext("2d");if(!d)throw new Error("Failed to get 2D canvas context for image resize");d.drawImage(a,0,0,o,l);let u=t;ha(d,o,l)||(u="image/jpeg");const h=await c.convertToBlob({type:u,quality:u==="image/jpeg"?ma:void 0}),p=h.type||u,m=await ga(h),y=Math.round(m.length*3/4/1024);return console.debug(`[image-resize] ${r}×${s} → ${o}×${l} | ${t} → ${p} | ${n} KB → ${y} KB`),{base64:m,mimeType:p}}async function fa(e,t){const n=atob(e),a=new Uint8Array(n.length);for(let s=0;s<n.length;s++)a[s]=n.charCodeAt(s);const r=new Blob([a],{type:t});return createImageBitmap(r)}function ha(e,t,n){const r=e.getImageData(0,0,t,n).data;for(let s=3;s<r.length;s+=4)if(r[s]<255)return!0;return!1}async function ga(e){const t=await e.arrayBuffer(),n=new Uint8Array(t);let a="";for(let r=0;r<n.length;r++)a+=String.fromCharCode(n[r]);return btoa(a)}const T={...Oe,badge:Oe.badgeRadius*2};function ya(e,t,n=1,a=0){const r=Math.max(1,e.displayScale)*n,s=[],i=o=>o*n;for(const{n:o,mark:l}of t){const c=l.geometry;if(c.kind==="rect")s.push({kind:"rect",x:i(c.x),y:i(c.y),w:i(c.w),h:i(c.h),width:T.stroke*r});else if(c.kind==="path")s.push({kind:"path",points:c.points.map(m=>({x:i(m.x),y:i(m.y)})),width:T.pen*r});else{const m={x:i(c.from.x),y:i(c.from.y)},y={x:i(c.to.x),y:i(c.to.y)};s.push({kind:"arrow",from:m,to:y,head:_a(m,y,T.arrowHead*r),width:T.stroke*r})}if(!T.showNumbers)continue;const d=Math.max(a,T.badge/2*r),u=i(l.bounds.x+l.bounds.w),h=i(l.bounds.y),p=Zt({x:i(l.bounds.x),y:h,w:u-i(l.bounds.x),h:i(l.bounds.h)},{x:0,y:0,w:i(e.width),h:i(e.height)},r,d);s.push({kind:"badge",...p,radius:d,label:String(o),font:d*T.badgeTextScale})}return s}function wa(e,t){"letterSpacing"in e&&(e.letterSpacing="0px"),"wordSpacing"in e&&(e.wordSpacing="0px");const n=(a,r,s)=>{e.strokeStyle=T.halo,e.lineWidth=a+T.haloWidth*r,s(),e.strokeStyle=T.accent,e.lineWidth=a,s()};e.strokeStyle=T.accent,e.lineCap="round",e.lineJoin="round";for(const a of t)if(a.kind==="rect")n(a.width,a.width/T.stroke,()=>e.strokeRect(a.x,a.y,a.w,a.h));else if(a.kind==="path"||a.kind==="arrow"){e.lineWidth=a.width,e.beginPath();const r=a.kind==="path"?a.points:[a.from,a.to];a.kind==="arrow"&&r.forEach((i,o)=>o?e.lineTo(i.x,i.y):e.moveTo(i.x,i.y)),a.kind==="arrow"&&(e.moveTo(a.head.left.x,a.head.left.y),e.lineTo(a.to.x,a.to.y),e.lineTo(a.head.right.x,a.head.right.y));const s=a.kind==="path"?new Path2D(Qt(a.points)):null;n(a.width,a.width/(a.kind==="path"?T.pen:T.stroke),()=>s?e.stroke(s):e.stroke())}else e.fillStyle=T.paper,e.beginPath(),e.arc(a.x,a.y,a.radius,0,Math.PI*2),e.closePath(),e.fill(),e.strokeStyle=T.accent,e.lineWidth=T.badgeOutline*a.radius/T.badgeRadius,e.stroke(),e.fillStyle=T.ink,e.font=`600 ${a.font}px ${T.badgeFontFamily}`,e.textAlign="center",e.textBaseline="middle",e.fillText(a.label,a.x,a.y)}async function ba(e,t){const n=Uint8Array.from(atob(e),a=>a.charCodeAt(0));return createImageBitmap(new Blob([n],{type:t}))}async function ka(e){const t=await e.convertToBlob({type:"image/png"});return Ze(await t.arrayBuffer())}async function ht(e,t,n,a,r=0){await an();const s=await ba(e.base64,e.mimeType);try{const i=Math.min(1,a/Math.max(t.width,t.height)),o=new OffscreenCanvas(Math.max(1,Math.round(t.width*i)),Math.max(1,Math.round(t.height*i))),l=o.getContext("2d");if(!l)throw new Error("dock-evidence-canvas-unavailable");return l.drawImage(s,0,0,o.width,o.height),wa(l,ya(t,n,i,r)),o}finally{s.close()}}async function va(e,t,n){const a=await ht(e,t,n,Math.max(t.width,t.height));return pa(await ka(a),"image/png")}async function zr(e,t,n,a=384){const r=await ht(e,t,n,a,a/32);return URL.createObjectURL(await r.convertToBlob({type:"image/png"}))}function _a(e,t,n=T.arrowHead){const a=Math.atan2(t.y-e.y,t.x-e.x),r=T.arrowSpread;return{left:{x:t.x-n*Math.cos(a-r),y:t.y-n*Math.sin(a-r)},right:{x:t.x-n*Math.cos(a+r),y:t.y-n*Math.sin(a+r)}}}function Gr(e,t){const n=zt(t??void 0),a=new Set(t?.clips.filter(r=>!!r.media&&!F(r.media)).map(r=>r.contextItemId));return e.filter(r=>!n.has(r.id)&&!a.has(r.id))}async function Yr({workspaceId:e,agentId:t,evidence:n,clickedItems:a,sendItems:r,clickedPayload:s,binding:i,service:o,current:l,onRecord:c,timing:d}){const u=()=>{if(!l()||!G(i))throw new O("validate","media-send-retired")};if(u(),n?.images.some(w=>w.mediaError)||n?.clips.some(w=>w.mediaError))throw new O("validate","invalid-saved-edit");const h=w=>!!w.media&&!F(w.media),p=n?{workspaceId:e,agentId:t,appUrl:`intent://local/workspace/${encodeURIComponent(e)}`,clipAttachmentIds:Object.fromEntries(n.clips.map(w=>[w.id,a.find(M=>M.id===w.contextItemId)?.attachmentId??null]))}:null;for(const w of n?.clips??[]){if(!w.media||!F(w.media))continue;const M=a.find(X=>X.id===w.contextItemId);if(!M||M.attachmentId!==w.media.source.attachmentId||M.path!==w.media.source.path||M.placementStatus!==void 0&&M.placementStatus!=="placed")throw new O("validate","legacy-original-unavailable")}const m=n?await ua(e,n,i,o,l,d):{images:{},files:[],frames:[],framePromptBytes:[],metadata:[]},y=new Set(n?.clips.filter(w=>h(w)||!!w.media&&F(w.media)).map(w=>w.id)),f=new Set(n?.clips.filter(w=>y.has(w.id)).flatMap(w=>(w.captureHistory??[]).map(M=>M.image.id))),k=(n?.images??[]).filter(w=>w.source!=="annotate"||!!w.media||!f.has(w.id)||n.marks.some(M=>M.imageId===w.id&&!(M.clipId&&y.has(M.clipId))));d?.stage("burn");let v=[];try{v=n?await Sa({...n,images:k},a,m.images):[]}catch(w){throw new O("burn",ie(w))}if(m.framePromptBytes.reduce((w,M)=>w+(M??0),0)>Hn)throw new O("validate","image-budget-exceeded");const S=new Set(n?.images.filter(w=>w.media).map(w=>w.id)),_=n?{...n,images:k.map(w=>m.images[w.id]?{...w,width:m.images[w.id].width,height:m.images[w.id].height}:w),clips:n.clips.filter(w=>!h(w)),marks:n.marks.filter(w=>!S.has(w.imageId)&&!n.clips.some(M=>h(M)&&M.id===w.clipId))}:null;u();const B=m.metadata.some(w=>typeof w.transcript=="string"&&w.transcript.trim());if(!s.text.trim()&&!r.length&&!s.workspaceContextStr?.trim()&&!v.length&&!m.files.length&&!m.frames.length&&!s.imageBlocks?.length&&!s.fileBlocks?.length&&!B)return null;let C=v,P=null;d?.stage("placement");const xe=n?await pt(i):null;if(u(),n&&(e!==be||xe?.chiefAttachments)){const w=await ca({workspaceId:e,binding:i,images:k.map((M,X)=>{const Q=a.find(Et=>Et.id===M.contextItemId);return{image:M,signature:Gt(n,M.id),composite:{base64:v[X].data,mimeType:v[X].mimeType},raw:!M.media&&Q?.imageData&&Q.imageMimeType?{base64:Q.imageData,mimeType:Q.imageMimeType}:null}}),records:n?.placements??{},onRecord:c});u(),C=w.map(M=>({type:"image",attachmentId:M.composite.attachmentId,mimeType:M.composite.mimeType})),P=Object.fromEntries(w.map(M=>[M.imageId,{attachmentId:M.composite.attachmentId,raw:M.raw}]))}const g=new Map(n?Qe(n).map(({n:w,mark:M})=>[M.id,w]):[]),D=p&&P?{...p,imageAttachments:P,markNumbers:g}:p&&{...p,markNumbers:g},U=n&&D?{...s,imageBlocks:[...C,...m.frames,...s.imageBlocks??[]],fileBlocks:[...s.fileBlocks??[],...m.files],workspaceContextStr:[Jt(_,D),m.metadata.length?`[Edited capture outputs]
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/SLOyQ3jf.js","/app/immutable/chunks/BbV7MtxC.js","/app/immutable/chunks/DWPd-rzt.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/AeC4KVgG.js","/app/immutable/chunks/CJxGDkBm.js","/app/immutable/chunks/k2awEenT.js","/app/immutable/chunks/DrHJ7oPv.js","/app/immutable/chunks/Dp2nUoTL.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/DJM6amHV.js","/app/immutable/chunks/NtFyWdpR.js","/app/immutable/chunks/CswzK9Go.js","/app/immutable/chunks/jhNNYE0v.js","/app/immutable/chunks/Cwla-sl1.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/ZcoUa9Jg.js","/app/immutable/chunks/HftJbvyF.js","/app/immutable/chunks/DWUO9rBe.js","/app/immutable/chunks/BNODdf6r.js","/app/immutable/chunks/BkzMrEqG.js","/app/immutable/chunks/PVXvIyE8.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/Bd1FsnP3.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/DJfJ5NWH.js","/app/immutable/chunks/Ci7mS1ie.js","/app/immutable/chunks/DsyH2ZOJ.js","/app/immutable/chunks/BoIfXiRv.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.B1j5oT2y.css","/app/immutable/chunks/-5BGDZDk.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/Dz2z231n.js","/app/immutable/chunks/CbSeeP7P.js","/app/immutable/chunks/DTWXK3Yd.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/F-reQTNB.js","/app/immutable/chunks/DKwAaLwd.js","/app/immutable/chunks/CWVUBnHm.js","/app/immutable/chunks/DwQfkcIA.js","/app/immutable/chunks/CAYSf4zc.js","/app/immutable/chunks/CZ-8NDq0.js","/app/immutable/chunks/CP5zM-2z.js","/app/immutable/chunks/B5aYN90J.js","/app/immutable/chunks/Bqk0L-NS.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/EjOa78um.js","/app/immutable/chunks/CD7PpB6R.js","/app/immutable/chunks/BV4GrhSx.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Ct=Object.defineProperty;var Dt=(e,t,n)=>t in e?Ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pe=(e,t,n)=>Dt(e,typeof t!="symbol"?t+"":t,n);import{IX as A,i as be,nK as R,w9 as Rt,B$ as Ge,wb as xt,Dc as Je,cE as Pt,cF as Bt,nL as Ye,nx as Ot,e as ke,fM as $t,l_ as Lt,cM as Ut}from"./BkzMrEqG.js";import{J as Nt,Z as Ht,dS as Be,cR as pe,dD as Ft,aw as Kt,bc as Xe,I as Wt,e3 as jt}from"./-5BGDZDk.js";import{e as qt,b as ae,F as Vt,y as re,_ as ve,G as zt,C as Gt,W as Qe,v as Jt,u as Yt,M as Xt}from"./Bd1FsnP3.js";import{D as Oe,a as Qt,d as Zt}from"./CQcEqK4G.js";import{l as en,o as tn,g as Ze,r as nn,m as an,D as rn}from"./C2-RFhPx.js";import{e as sn}from"./CbSeeP7P.js";import{z as et,N as on}from"./DWPd-rzt.js";import{f as cn}from"./BnSNaeNS.js";import{bm as b,_ as fe}from"./AeC4KVgG.js";import{aa as tt,aB as se,J as he,a as nt,n as at,cS as rt,e as st,aI as it,M as ln,ac as dn,aV as $e,d as le,C as un,cT as mn,U as pn,a6 as fn,aJ as hn,b_ as gn}from"./bXhYFuj1.js";import{W as yn,L as wn,w as bn,R as kn,M as vn,h as _n}from"./jhNNYE0v.js";import{l as q,i as Sn,n as Mn}from"./DWUO9rBe.js";import{x as An,J as In,ai as Tn,ar as En}from"./DW97_Hl4.js";import{a as Le,b as Cn,g as Dn}from"./DypB-Dwi.js";import{m as Rn}from"./CWVUBnHm.js";import{C as xn}from"./B5aYN90J.js";import{i as Pn}from"./xUNvQVfC.js";import{o as $,e as Bn,l as V,s as E,n as ce,b as On,d as $n,c as Ln}from"./CIyUrgF0.js";const Dr=A.createSelector((e,t)=>e.unreadTracking.dividerSessionByAgentId[t]??null),Rr=A.createSelector(e=>e.unreadTracking.currentlyViewedAgentId),xr=A.createSelector(e=>{const t=[];for(const s of Object.values(e.panelLayout.byWorkspaceId))for(const i of Object.values(s.panels))for(const o of i.tabs)o.type==="agent"&&o.agentId&&t.push(o.agentId);const n=Object.keys(e.unreadTracking.dividerSessionByAgentId),a=new Set(e.agentSessions.agentIdsByWorkspace[be]??[]);return{chiefCardVisible:e.sidebarNav.panelItem==="chief",chiefSessionAgentIds:n.filter(s=>a.has(s)),dividerSessionAgentIds:n,openAgentTabIds:t}});function Pr(e,t){if(e)return e.model}function Un({messages:e,pendingInitialPrompt:t,pendingContextReferenceCount:n=0}){return e.length>0||!!t||n>0}function Br({session:e,messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a=0}){return!(e?Nt(e):!1)&&!Un({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a})}function Or(e){return Ht(e.messageMetadata)}function Nn(e){return{id:e.id,appMessageId:e.appMessageId,role:"user",timestamp:new Date(e.createdAt??0).toISOString(),contentBlocks:[...e.content?[{type:"text",text:e.content}]:[],...e.imageBlocks??[],...e.fileBlocks??[]],metadata:e.messageMetadata,...e.author!==void 0?{author:e.author}:{}}}function $r(e){return Nn({...e,createdAt:Date.parse(e.queuedAt)})}const Hn=8*1024*1024,Fn=3*1024*1024;function Kn(e){return Math.ceil(Math.max(0,e)/3)*4}function Wn(e){const t=e.promptBase64Bytes;return e.mimeType==="image/jpeg"&&Number.isSafeInteger(e.size)&&e.size>0&&e.size<=Fn&&typeof t=="number"&&t===Kn(e.size)?t:null}async function ot(e,t,n,a,r=()=>{}){const s=()=>{if(!a())throw new Error("media-send-retired")};if(s(),r("overlay-render"),!n.exportMedia)throw new Error("media-export-unavailable");const i=en(e.source,e.saved);if(i.length>1e4)throw new Error("media-animation-layer-limit");const o=[];for(const c of i)s(),o.push({...c,png:await tn(e.source,e.saved,c.atMs)});s(),r("export");const l=await n.exportMedia({outputVersion:qt,jobId:t,media:e,layers:o});if(s(),!l.ok)throw new Error(["media-export-failed",l.error].filter(Boolean).join(":"));return{jobId:t,value:l.value}}const _e={CLIPBOARD_WRITE:"dock-media:clipboard-write",CLIPBOARD_READ:"dock-media:clipboard-read",MENU:"dock-media:menu"};function Ue(e,t){return Math.max(0,(e.pausedAt??t)-e.startedAt-(e.pausedMs??0))}function ge(e,t){if(!t?.startsWith(".intent/attachments/"))return;const n=t.split("/").map(encodeURIComponent).join("/"),a=tt(`intent://local/file/${n}`,e);return a?.kind==="video"?a.url:void 0}function jn(e){const t=e.video==="full"?b.dock_captureEditor_videoFull_label():b.dock_captureEditor_videoHighlights_label(),n=e.voice==="audio"?b.dock_captureEditor_voiceAudio_label():e.voice==="transcript"?b.dock_captureEditor_voiceTranscript_label():b.dock_captureEditor_voiceOff_summary();return`${t} · ${n}`}function qn(e,t,n,a){if(a?.error==="permission")return a.kind==="pick"?"accessibility":"screen";if(e==="permission"||t==="permission")return"screen";if(n?.startsWith("microphone-permission"))return"microphone";if(n?.startsWith("speech-permission"))return"speech"}const j=cn;function Lr(e){const{view:t,items:n,local:a,labels:r,copy:s}=e,i=t.speech.error??t.speech.capability?.reason??null,o=qn(t.captureError,t.clips.find(g=>g.status==="failed"&&g.error==="permission")?.error??null,i,t.annotationIssue),l=t.annotationIssue?.error==="unavailable"?s?.annotationUnavailable:void 0,c=t.annotationIssue,d=t.captureError==="permission",u=c?.error==="permission"&&c.kind!=="pick",h=c?.error==="permission"&&c.kind==="pick",p=i?.startsWith("speech-permission")?"speech":i?.startsWith("microphone-permission")||i==="permission"?"microphone":void 0,m={},y={},f=(g,D,U)=>{m[g]=D,U&&(y[g]=U)};s&&(d&&(f("capture",s.permission,"screen"),t.recording||f("record",s.permission,"screen")),u&&!t.annotating&&f("annotate",s.permission,"screen"),h&&(f("pick",s.accessibilityPermission,"accessibility"),t.tool==="pick"&&!t.annotating&&f("annotate",s.accessibilityPermission,"accessibility")),p&&!t.dictation&&f("mic",(i&&r.speechError?.(i))??s.speechPermission,p));const k=g=>{const D=y[g];D&&e.actions.onOpenSettings(D)},v=new Set(t.evidenceOwnedItemIds),I=t.clips.find(g=>g.status==="recording"),S=t.clips.length>=ae.clips,_=t.capabilities,B=t.speech.available,C=new Set(t.clips.filter(g=>g.status==="recording"||g.status==="placing"||!!g.media).flatMap(g=>g.captureHistory?.map(D=>D.image.id)??[])),P=[...t.tiles.filter(({image:g,marks:D})=>!!g.media||g.source!=="annotate"||!C.has(g.id)||D.some(({mark:U})=>!U.clipId)).map(({image:g,marks:D})=>({kind:"image",id:g.contextItemId,url:a.previews[g.id]??"",markCount:D.length,owner:"evidence",...a.previews[g.id]?{}:{status:"placing"}})),...t.clips.filter(g=>!g.discarding).map(g=>({kind:"clip",id:g.contextItemId??g.id,duration:j(g.status==="recording"?Ue(g,a.now):g.durationMs),recording:g.status==="recording",...g.media?.saved?{summary:jn(g.media.saved)}:{},...g.status==="ready"&&ge(e.workspaceId,g.path)?{url:ge(e.workspaceId,g.path)}:{},owner:"evidence",...g.status==="placing"?{status:"placing"}:{},...g.status==="failed"?{status:"failed",...g.error==="limit"?{error:b.dock_composer_clipTooLarge_error()}:{}}:{}})),...n.filter(g=>!v.has(g.id)).map(g=>({...g.imageData&&g.imageMimeType?{kind:"image",id:g.id,url:`data:${g.imageMimeType};base64,${g.imageData}`,markCount:0,file:{name:g.label,imageData:g.imageData,imageMimeType:g.imageMimeType}}:{kind:"file",id:g.id,name:g.label},owner:"attachment",...g.placementStatus==="placing"?{status:"placing"}:{},...g.placementStatus==="failed"?{status:"failed",error:g.placementError}:{}}))];return{mediaStatus:t.recording?{kind:"recording",label:r.recording}:t.dictation?{kind:"listening",label:r.listening}:t.annotating?{kind:"annotating",label:r.annotating}:void 0,...o?{settingsPane:o}:{},...l?{annotationNotice:l}:{},labels:r,attachments:P,...s?{placeholder:t.dictation?"":s.idle}:{},state:{captureRevision:t.captureAccepted,capturePending:t.capturePending,captureDisabled:!_.capture||t.captureDisabled,...t.captureDisabled?{captureTooltip:r.captureLimit}:{},captureMode:t.evidence?.annotation?"fullscreen":t.captureMode,captureModesAvailable:!!_.captureModes&&!t.evidence?.annotation,annotationActive:t.annotating,tool:t.tool,toolUsed:t.toolUsed,annotationDisabled:!_.annotate,recording:t.recording&&!I?.discarding,recordingDisabled:!!I?.discarding||!t.recording&&(!_.record||S),...S&&!t.recording?{recordingTooltip:r.clipLimit}:{},recordingTime:j(I?Ue(I,a.now):0),dictating:!!t.dictation,dictationPending:t.speech.pending||t.dictation?.status==="transcribing",dictationDisabled:!B&&!t.dictation&&!m.mic,...t.speech.error&&r.speechError?{dictationTooltip:r.speechError(t.speech.error)}:{},dictationTime:t.dictation?j(a.now-t.dictation.startedAt):j(0),inputLevels:t.speech.levels,...Object.keys(m).length?{alerts:m}:{}},...e.actions,...t.fileAttachmentsEnabled===!1?{onEdit:void 0}:{},onAlert:k,beforeSubmit:e.beforeSubmit}}const Se=()=>globalThis.electronAPI,Vn=["image/png","image/jpeg","image/webp"],Ne=e=>Vn.includes(e??"")?e:null;function He(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a+=1)n[a]=t.charCodeAt(a);return n}async function Ur(e,t){const{view:n,items:a,previews:r}=t,s=n.tiles.find(({image:c})=>c.id===e||c.contextItemId===e);if(s){const c=a.find(p=>p.id===s.image.contextItemId),d=s.image.media;if(s.image.mediaError)return null;if(d?.saved){if(!t.createSavedPreviewUrl||!t.revokeUrl)return null;const p={...d,saved:d.saved},m=await t.createSavedPreviewUrl(t.workspaceId,p);try{const y=await t.fetchBytes(m),f=p.saved.crop;return{kind:"image",name:c?.label||"screenshot.png",mimeType:"image/png",bytes:y,intent:{pixels:{mimeType:"image/png",width:Math.max(1,Math.round(f?.w??p.source.width)),height:Math.max(1,Math.round(f?.h??p.source.height)),displayScale:s.image.displayScale,capturedAt:s.image.capturedAt},raw:y,marks:[]}}}finally{t.revokeUrl(m)}}const u=Ne(c?.imageMimeType),h=r[s.image.id];return!c?.imageData||!u||!h?null:{kind:"image",name:c.label||"screenshot.png",mimeType:"image/png",bytes:await t.fetchBytes(h),intent:{pixels:{mimeType:u,width:s.image.width,height:s.image.height,displayScale:s.image.displayScale,capturedAt:s.image.capturedAt,...s.image.hash?{hash:s.image.hash}:{}},raw:He(c.imageData),marks:s.marks.map(({mark:p})=>({tool:p.tool,geometry:p.geometry,bounds:p.bounds,element:p.element}))}}}const i=n.clips.find(c=>c.id===e||c.contextItemId===e);if(i){const c=i.status==="ready"?ge(t.workspaceId,i.path):null;if(!c)return null;const d=a.find(h=>h.id===i.contextItemId),u=await t.fetchBytes(c);if(!Gn(u))throw new Error("Not a recording file");return{kind:"clip",name:d?.label||`recording-${i.id.slice(0,8)}.mp4`,mimeType:d?.attachmentMimeType||"video/mp4",bytes:u,durationMs:i.durationMs,hasMicAudio:i.hasMicAudio}}const o=a.find(c=>c.id===e),l=Ne(o?.imageMimeType);return o?.imageData&&l?{kind:"image",name:o.label||"image",mimeType:l,bytes:He(o.imageData)}:null}async function zn(e){const t=await fetch(e);if(!t.ok)throw new Error(`Media request failed (${t.status})`);const n=new Uint8Array(await t.arrayBuffer()),a=Number(t.headers.get("content-length")??Number.NaN);if(n.byteLength===0||Number.isFinite(a)&&a!==n.byteLength)throw new Error("Media response was incomplete");return n}function Gn(e){return e.byteLength>8&&String.fromCharCode(...e.subarray(4,8))==="ftyp"}async function Nr(e){try{return(await Se()?.invoke(_e.CLIPBOARD_WRITE,e))?.ok===!0}catch{return!1}}async function Jn(){try{return await Se()?.invoke(_e.CLIPBOARD_READ,{})??null}catch{return null}}async function Hr(e){try{const t=await Se()?.invoke(_e.MENU,{canCut:e});return t?.action==="copy"||t?.action==="cut"?t.action:null}catch{return null}}const Fe=new WeakSet;async function Yn(e,t){const[n]=e;if(e.length!==1||!n||n.size!==t.size)return!1;try{const a=await crypto.subtle.digest("SHA-256",await n.arrayBuffer());return Array.from(new Uint8Array(a),s=>s.toString(16).padStart(2,"0")).join("")===t.sha256}catch{return!1}}function Fr(e,{onIntentMedia:t,isCurrent:n,read:a=Jn}){const r=e.clipboardData;if(Fe.has(e)||!r||r.files.length===0)return!1;const s=e.target,i=Array.from(r.files),o=r.types.filter(l=>l!=="Files").map(l=>[l,r.getData(l)]);return e.preventDefault(),e.stopImmediatePropagation(),a().catch(()=>null).then(async l=>{if(!n())return;if(l&&await Yn(i,l)){n()&&t(l);return}if(!n()||!(s instanceof Node)||!s.isConnected)return;const c=new DataTransfer;for(const u of i)c.items.add(u);for(const[u,h]of o)c.setData(u,h);const d=new ClipboardEvent("paste",{clipboardData:c,bubbles:!0,cancelable:!0});Fe.add(d),s.dispatchEvent(d)}),!0}function Xn(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);return n}function Qn(e){let t="";for(let a=0;a<e.length;a+=32768)t+=String.fromCharCode(...e.subarray(a,a+32768));return btoa(t)}function ct(e){let t=0;return e.endsWith("==")?t=2:e.endsWith("=")&&(t=1),Math.floor(e.length*3/4)-t}async function Zn(e){const t=await crypto.subtle.digest("SHA-256",e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));return Array.from(new Uint8Array(t)).map(n=>n.toString(16).padStart(2,"0")).join("")}const lt={placeAttachment:it,beginAttachmentUpload:st,sendAttachmentUploadChunk:rt,commitAttachmentUpload:at,abortAttachmentUpload:nt,getAttachmentInfo:he,mintIdempotencyKey:se};async function Me(e,t,n,a=lt){const{idempotencyKey:r}=n,s={...r!==void 0?{idempotencyKey:r}:{},...n.rawScreenshot!==void 0?{rawScreenshot:n.rawScreenshot}:{}},i=async m=>mn(m,r)?$e(e,r,a.getAttachmentInfo):void 0;if(ct(n.data)<=ln)try{return await a.placeAttachment(e,t,{data:n.data,mimeType:n.mimeType,...s})}catch(m){const y=await i(m);if(y)return y;throw m}const o=Xn(n.data),l=await Zn(o);let c,d;try{({uploadId:c,maxChunkBytes:d}=await a.beginAttachmentUpload(e,t,o.byteLength,l,{mimeType:n.mimeType,...s}))}catch(m){if(r!==void 0&&dn(m)){const y=await $e(e,r,a.getAttachmentInfo);if(y)return y}throw m}const u=Math.min(pn,d),h=Math.ceil(o.byteLength/u);let p=!1;try{for(let m=0;m<h;m++){const y=o.subarray(m*u,(m+1)*u);await a.sendAttachmentUploadChunk(c,m,Qn(y),e)}return p=!0,await a.commitAttachmentUpload(c,e)}catch(m){const y=p?await i(m):void 0;if(y)return y;throw await a.abortAttachmentUpload(c,e).catch(()=>{}),m}}function ea(e,t){return fn(e,`image-${Date.now()}-${t+1}`)}class Ae extends Error{constructor(n,a){super(n);Pe(this,"retryBlocks");this.name="ImagePlacementError",this.retryBlocks=a}}function ta(e,t){return e instanceof Ae?e.retryBlocks:t}async function na(e,t,n=lt,a=()=>!0){const r=l=>(...c)=>(le(a),l(...c));n={placeAttachment:r(n.placeAttachment),beginAttachmentUpload:r(n.beginAttachmentUpload),sendAttachmentUploadChunk:r(n.sendAttachmentUploadChunk),commitAttachmentUpload:r(n.commitAttachmentUpload),abortAttachmentUpload:r(n.abortAttachmentUpload),getAttachmentInfo:r(n.getAttachmentInfo),mintIdempotencyKey:r(n.mintIdempotencyKey)};const s=[],i=[],o=[];for(let l=0;l<t.length;l++){le(a);const c=t[l];if("attachmentId"in c&&c.attachmentId){const p={type:"image",attachmentId:c.attachmentId,...c.mimeType?{mimeType:c.mimeType}:{}};s.push(p),i.push(p);continue}const d=c,u=d.placementFileName??ea(d.mimeType,l),h=n.mintIdempotencyKey(d.placementIdempotencyKey);try{const p=await Me(e,u,{data:d.data,mimeType:d.mimeType,...h!==void 0?{idempotencyKey:h}:{}},n),m={type:"image",attachmentId:p.attachmentId,...p.mimeType??d.mimeType?{mimeType:p.mimeType??d.mimeType}:{}};s.push(m),i.push(m)}catch(p){const m=un(p);o.push(m?`${u} (${m})`:u),i.push(h!==void 0?{...d,placementIdempotencyKey:h,placementFileName:u}:d)}}if(o.length>0)throw new Ae(b.chat_imagePlacement_failed_error({names:o.join(", ")}),i);return le(a),s}const Kr=Object.freeze(Object.defineProperty({__proto__:null,ImagePlacementError:Ae,base64DecodedBytes:ct,imageRetryBlocks:ta,placeImageAttachment:Me,toImageReferenceBlocks:na},Symbol.toStringTag,{value:"Module"}));function dt(){try{return yn()}catch{return null}}function aa(){return{backendId:A.state.connections.windowBackendId??null,generation:A.state.daemonHealth.connectionGeneration,transport:dt()}}class Ie extends Error{constructor(){super("dock-evidence-backend-changed")}}function N(e,t){return async(...n)=>{e();const a=await t(...n);return e(),a}}const H={current:e=>dt()===e.transport&&A.state.daemonHealth.connectionGeneration===e.generation&&(A.state.connections.windowBackendId??null)===e.backendId,capabilities:()=>wn(),placeImage:(e,t,n,a)=>Me(e,t,n,{placeAttachment:N(a,it),beginAttachmentUpload:N(a,st),sendAttachmentUploadChunk:N(a,rt),commitAttachmentUpload:N(a,at),abortAttachmentUpload:N(a,nt),getAttachmentInfo:N(a,he),mintIdempotencyKey:se}),lookup:(e,t)=>he({workspaceId:e,idempotencyKey:t}),mintKey:se};function G(e){return H.current(e)}function ra(e,t){const n=A.state.dockConversation;return{generation:n.generation,authority:n.authority,clearRevision:R(n.drafts,Vt(e,t))?.clearRevision??0,binding:aa()}}function Wr(e,t,n){const a=ra(e,t);return a.generation===n.generation&&a.authority===n.authority&&a.clearRevision===n.clearRevision&&G(n.binding)}function ut(e,t){return()=>{if(!e.current(t))throw new Ie}}const mt=Object.freeze({rawRetention:!1,chiefAttachments:!1});function jr(e){return e!==mt}const de=new Map;function pt(e,t=H){const n=`${e.backendId}:${e.generation}`;let a=de.get(n);if(!a){const r=ut(t,e);a=(async()=>{r();const i=await t.capabilities();r();const o=i?.server?.capabilities;if(!o||typeof o!="object")throw new Error("unobserved");return{rawRetention:o.rawScreenshotRetention===1,chiefAttachments:o.chiefAttachments===1}})().catch(()=>(de.delete(n),mt)),de.set(n,a)}return a}class Z extends Error{constructor(t){super(`dock-raw-retention-contract:${t}`),this.reason=t}}function ft(e){const{rpcCode:t,code:n}=e??{};return t===-32602||n==="INVALID_PARAMS"}function sa(e){const t=String(e?.message??"");return ft(e)&&(t.includes("rawScreenshotExpired:")||/expired at .*not renewable/i.test(t))}function ia(e,t,n){const a=e.rawScreenshot;if(!a||a.compositeAttachmentId!==t)return null;const r=Date.parse(a.expiresAt);return Number.isFinite(r)?a.expired||r<=n?"expired":{attachmentId:e.attachmentId,expiresAt:a.expiresAt}:null}function Ke(e){return{ok:!0,path:e.path,fileName:e.fileName,size:e.size,attachmentId:e.attachmentId,...e.mimeType?{mimeType:e.mimeType}:{},uploadedAt:e.uploadedAt,replayed:!0,...e.rawScreenshot?{rawScreenshot:e.rawScreenshot}:{}}}class oa extends Error{constructor(t,n){super("dock-evidence-placement-failed"),this.imageId=t,this.failure=n}}const We=e=>e.split("/")[1]?.replace("jpeg","jpg")||"png";async function ca(e){const t=e.api??H,n=e.now??Date.now,a=ut(t,e.binding);a();const r=await pt(e.binding,t);a();const s=r.rawRetention&&(e.workspaceId!==be||r.chiefAttachments),i=[];for(const o of e.images){const l=e.records[o.image.id];let c=l&&l.signature===o.signature&&l.workspaceId===e.workspaceId&&l.backendId===e.binding.backendId?l:{imageId:o.image.id,signature:o.signature,workspaceId:e.workspaceId,backendId:e.binding.backendId,compositeKey:null,rawKey:null,composite:null,raw:null,rawSettled:!1};const d=u=>{c=u,e.onRecord(u)};try{if(!c.composite){const h=c.compositeKey,p=t.mintKey(h??void 0)??null;p!==c.compositeKey&&d({...c,compositeKey:p});let m;h&&p===h&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a()),m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}.${We(o.composite.mimeType)}`,{data:o.composite.base64,mimeType:o.composite.mimeType,...p?{idempotencyKey:p}:{}},a),a()),d({...c,composite:{attachmentId:m.attachmentId,mimeType:m.mimeType??o.composite.mimeType}})}const u=c.composite.attachmentId;if(s&&o.raw&&!c.raw&&!c.rawSettled){const h=c.rawKey,p=t.mintKey(h??void 0);if(p){p!==c.rawKey&&d({...c,rawKey:p});let m;h&&p===h&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a());try{m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}-original.${We(o.raw.mimeType)}`,{data:o.raw.base64,mimeType:o.raw.mimeType,idempotencyKey:p,rawScreenshot:{compositeAttachmentId:u}},a),a());const y=ia(m,u,n());if(y==="expired")d({...c,rawSettled:!0});else if(y)d({...c,raw:y});else throw new Z("echo")}catch(y){if(sa(y))d({...c,rawSettled:!0});else throw y instanceof Z?y:ft(y)?new Z("refused"):y}}else throw new Z("unkeyed")}}catch(u){throw u instanceof Ie?u:new oa(o.image.id,u)}i.push(c)}return i}async function qr(e,t,n,a){const r=()=>{if(!H.current(a))throw new Ie};r();const s=await H.placeImage(e,t,{...n,idempotencyKey:H.mintKey()},r);return r(),s}const la=new Set(["invalid-saved-edit","media-send-retired","transcript-unavailable","transcript-pending","invalid-edit","stale-source","legacy-baked-marks","timing-unavailable","audio-unavailable","media-source-unavailable","media-export-unavailable","media-animation-layer-limit","media-export-failed","legacy-original-unavailable","capture-render-unavailable","capture-blur-unavailable","stale-source-pixels","not-a-screenshot","not-admitted","unavailable","dock-evidence-missing-pixels","draft-restore-failed","image-budget-exceeded"]),da=new Set(["unavailable","permission","failed","busy","cancelled","limit"]);class O extends Error{constructor(t,n){super(n),this.stage=t,this.code=n,this.name="DockSendError"}}function ie(e){const t=e instanceof Error?e.message:typeof e=="string"?e:"";if(t.length>64)return"unclassified";const[n,...a]=t.split(":");return!la.has(n)||a.length>2?"unclassified":n!=="media-export-failed"?a.length?"unclassified":n:[n,...a.map(r=>da.has(r)?r:"other")].join(":")}function Vr(e,t){return e instanceof O?{stage:e.stage,code:ie(e.code)}:{stage:t,code:ie(e)}}function F(e){if(!e||e.source.kind!=="recording")return!1;const t=e.source,n=e.saved??re(t,t.capturedMarks??[],e.transcript);if(n.video!=="full"||n.voice!=="audio"||n.crop||n.blurRegions.length||n.blurStrokes?.length)return!1;const a=ve(n,t,e.transcript);return t.visuals==="clean"?!a.errors.length&&!a.muted&&n.cuts.length===0&&!n.marks.some(r=>r.included)&&a.marks.length===0&&a.transcript===null&&a.kept.length===1&&a.kept[0].startMs===0&&a.kept[0].endMs===t.durationMs&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs===t.durationMs:!a.errors.length&&!a.muted&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs>=t.durationMs}async function ua(e,t,n,a,r,s){const i={images:{},files:[],frames:[],framePromptBytes:[],metadata:[]};let o="validate";try{const l=()=>{if(!r()||!G(n))throw new Error("media-send-retired")};for(const c of[...t.images,...t.clips]){if(o="validate",s?.stage(o),c.mediaError)throw new Error("invalid-saved-edit");if(!c.media||F(c.media))continue;l();const d=structuredClone(c.media),u=d.source;let h=d.saved??re(u,u.capturedMarks??[],d.transcript),p=crypto.randomUUID();try{if(u.kind==="recording"&&h.voice==="transcript"&&d.transcript?.status!=="ready"){if(o="transcribe",s?.stage(o),!a?.transcribeMedia)throw new Error("transcript-unavailable");const f=await a.transcribeMedia({jobId:p,media:d});if(l(),!f.ok)throw new Error("transcript-unavailable");d.transcript=f.value,d.saved||(h=re(u,u.capturedMarks??[],d.transcript))}o="plan",s?.stage(o);const m=ve(h,u,d.transcript);if(m.errors.length)throw new Error(m.errors[0]);const y={id:c.id,kind:u.kind,video:h.video,voice:h.voice,transcript:m.transcript,batches:u.batches,marks:m.marks.map(({n:f,mark:k,frameAtMs:v})=>({n:f,id:k.id,at_ms:v,kind:k.kind,label:k.label,note:k.note,context:k.context,geometry:k.geometry}))};if(u.kind==="screenshot"){o="screenshot-source",s?.stage(o);const f=u.path.split("/").map(encodeURIComponent).join("/"),k=tt(`intent://local/file/${f}`,e);if(!k||k.kind!=="image")throw new Error("media-source-unavailable");const v=await zn(k.url);l();const I={base64:Ze(v.buffer.slice(v.byteOffset,v.byteOffset+v.byteLength)),mimeType:/\.jpe?g$/i.test(u.path)?"image/jpeg":/\.webp$/i.test(u.path)?"image/webp":"image/png"};o="screenshot-render",s?.stage(o),i.images[c.id]=await nn(u,h,I),l()}else{if(!m.clips.length){y.video_attachment_id=null,y.frames=[],y.kept_ms=[],i.metadata.push(y);continue}const f={...d,saved:h};let k=await a?.takePreparedRecording?.(f);if(k&&(p=k.jobId),l(),!k){if(!a)throw new Error("media-export-unavailable");k=await ot(f,p,a,()=>r()&&G(n),S=>{o=S,s?.stage(S),S==="export"&&s?.exportAttempt(p)})}p=k.jobId,o="placement",s?.stage(o);const v=[k.value.video,...k.value.frames],I=[];for(let S=0;S<v.length;S++){l();const _=v[S],B=`capture-${c.id.slice(0,12)}-${S}.${S===0?"mp4":_.mimeType==="image/jpeg"?"jpg":"png"}`,C=await hn(e,B,{sourcePath:_.sourcePath,mimeType:_.mimeType,idempotencyKey:se()},void 0,void 0,()=>r()&&G(n));l(),S===0?i.files.push({type:"file",attachmentId:C.attachmentId,fileName:B,mimeType:C.mimeType??_.mimeType,size:C.size}):(i.frames.push({type:"image",attachmentId:C.attachmentId,mimeType:_.mimeType==="image/jpeg"?"image/jpeg":"image/png"}),i.framePromptBytes.push(Wn(_))),I.push(C.attachmentId)}y.video_attachment_id=I[0],y.frames=k.value.frames.map((S,_)=>({mark_id:S.markId,attachment_id:I[_+1]})),y.kept_ms=m.clips}i.metadata.push(y)}finally{s?.stage("release"),await a?.releaseMediaJob?.(p).catch(()=>{})}}return i}catch(l){throw l instanceof O?l:new O(o,ie(l))}}const ue=1568,ma=.85;async function pa(e,t){const n=Math.round(e.length*3/4/1024),a=await fa(e,t),{width:r,height:s}=a,i=r>ue||s>ue;let o=r,l=s;if(i){const f=ue/Math.max(r,s);o=Math.round(r*f),l=Math.round(s*f)}const c=new OffscreenCanvas(o,l),d=c.getContext("2d");if(!d)throw new Error("Failed to get 2D canvas context for image resize");d.drawImage(a,0,0,o,l);let u=t;ha(d,o,l)||(u="image/jpeg");const h=await c.convertToBlob({type:u,quality:u==="image/jpeg"?ma:void 0}),p=h.type||u,m=await ga(h),y=Math.round(m.length*3/4/1024);return console.debug(`[image-resize] ${r}×${s} → ${o}×${l} | ${t} → ${p} | ${n} KB → ${y} KB`),{base64:m,mimeType:p}}async function fa(e,t){const n=atob(e),a=new Uint8Array(n.length);for(let s=0;s<n.length;s++)a[s]=n.charCodeAt(s);const r=new Blob([a],{type:t});return createImageBitmap(r)}function ha(e,t,n){const r=e.getImageData(0,0,t,n).data;for(let s=3;s<r.length;s+=4)if(r[s]<255)return!0;return!1}async function ga(e){const t=await e.arrayBuffer(),n=new Uint8Array(t);let a="";for(let r=0;r<n.length;r++)a+=String.fromCharCode(n[r]);return btoa(a)}const T={...Oe,badge:Oe.badgeRadius*2};function ya(e,t,n=1,a=0){const r=Math.max(1,e.displayScale)*n,s=[],i=o=>o*n;for(const{n:o,mark:l}of t){const c=l.geometry;if(c.kind==="rect")s.push({kind:"rect",x:i(c.x),y:i(c.y),w:i(c.w),h:i(c.h),width:T.stroke*r});else if(c.kind==="path")s.push({kind:"path",points:c.points.map(m=>({x:i(m.x),y:i(m.y)})),width:T.pen*r});else{const m={x:i(c.from.x),y:i(c.from.y)},y={x:i(c.to.x),y:i(c.to.y)};s.push({kind:"arrow",from:m,to:y,head:_a(m,y,T.arrowHead*r),width:T.stroke*r})}if(!T.showNumbers)continue;const d=Math.max(a,T.badge/2*r),u=i(l.bounds.x+l.bounds.w),h=i(l.bounds.y),p=Zt({x:i(l.bounds.x),y:h,w:u-i(l.bounds.x),h:i(l.bounds.h)},{x:0,y:0,w:i(e.width),h:i(e.height)},r,d);s.push({kind:"badge",...p,radius:d,label:String(o),font:d*T.badgeTextScale})}return s}function wa(e,t){"letterSpacing"in e&&(e.letterSpacing="0px"),"wordSpacing"in e&&(e.wordSpacing="0px");const n=(a,r,s)=>{e.strokeStyle=T.halo,e.lineWidth=a+T.haloWidth*r,s(),e.strokeStyle=T.accent,e.lineWidth=a,s()};e.strokeStyle=T.accent,e.lineCap="round",e.lineJoin="round";for(const a of t)if(a.kind==="rect")n(a.width,a.width/T.stroke,()=>e.strokeRect(a.x,a.y,a.w,a.h));else if(a.kind==="path"||a.kind==="arrow"){e.lineWidth=a.width,e.beginPath();const r=a.kind==="path"?a.points:[a.from,a.to];a.kind==="arrow"&&r.forEach((i,o)=>o?e.lineTo(i.x,i.y):e.moveTo(i.x,i.y)),a.kind==="arrow"&&(e.moveTo(a.head.left.x,a.head.left.y),e.lineTo(a.to.x,a.to.y),e.lineTo(a.head.right.x,a.head.right.y));const s=a.kind==="path"?new Path2D(Qt(a.points)):null;n(a.width,a.width/(a.kind==="path"?T.pen:T.stroke),()=>s?e.stroke(s):e.stroke())}else e.fillStyle=T.paper,e.beginPath(),e.arc(a.x,a.y,a.radius,0,Math.PI*2),e.closePath(),e.fill(),e.strokeStyle=T.accent,e.lineWidth=T.badgeOutline*a.radius/T.badgeRadius,e.stroke(),e.fillStyle=T.ink,e.font=`600 ${a.font}px ${T.badgeFontFamily}`,e.textAlign="center",e.textBaseline="middle",e.fillText(a.label,a.x,a.y)}async function ba(e,t){const n=Uint8Array.from(atob(e),a=>a.charCodeAt(0));return createImageBitmap(new Blob([n],{type:t}))}async function ka(e){const t=await e.convertToBlob({type:"image/png"});return Ze(await t.arrayBuffer())}async function ht(e,t,n,a,r=0){await an();const s=await ba(e.base64,e.mimeType);try{const i=Math.min(1,a/Math.max(t.width,t.height)),o=new OffscreenCanvas(Math.max(1,Math.round(t.width*i)),Math.max(1,Math.round(t.height*i))),l=o.getContext("2d");if(!l)throw new Error("dock-evidence-canvas-unavailable");return l.drawImage(s,0,0,o.width,o.height),wa(l,ya(t,n,i,r)),o}finally{s.close()}}async function va(e,t,n){const a=await ht(e,t,n,Math.max(t.width,t.height));return pa(await ka(a),"image/png")}async function zr(e,t,n,a=384){const r=await ht(e,t,n,a,a/32);return URL.createObjectURL(await r.convertToBlob({type:"image/png"}))}function _a(e,t,n=T.arrowHead){const a=Math.atan2(t.y-e.y,t.x-e.x),r=T.arrowSpread;return{left:{x:t.x-n*Math.cos(a-r),y:t.y-n*Math.sin(a-r)},right:{x:t.x-n*Math.cos(a+r),y:t.y-n*Math.sin(a+r)}}}function Gr(e,t){const n=zt(t??void 0),a=new Set(t?.clips.filter(r=>!!r.media&&!F(r.media)).map(r=>r.contextItemId));return e.filter(r=>!n.has(r.id)&&!a.has(r.id))}async function Jr({workspaceId:e,agentId:t,evidence:n,clickedItems:a,sendItems:r,clickedPayload:s,binding:i,service:o,current:l,onRecord:c,timing:d}){const u=()=>{if(!l()||!G(i))throw new O("validate","media-send-retired")};if(u(),n?.images.some(w=>w.mediaError)||n?.clips.some(w=>w.mediaError))throw new O("validate","invalid-saved-edit");const h=w=>!!w.media&&!F(w.media),p=n?{workspaceId:e,agentId:t,appUrl:`intent://local/workspace/${encodeURIComponent(e)}`,clipAttachmentIds:Object.fromEntries(n.clips.map(w=>[w.id,a.find(M=>M.id===w.contextItemId)?.attachmentId??null]))}:null;for(const w of n?.clips??[]){if(!w.media||!F(w.media))continue;const M=a.find(X=>X.id===w.contextItemId);if(!M||M.attachmentId!==w.media.source.attachmentId||M.path!==w.media.source.path||M.placementStatus!==void 0&&M.placementStatus!=="placed")throw new O("validate","legacy-original-unavailable")}const m=n?await ua(e,n,i,o,l,d):{images:{},files:[],frames:[],framePromptBytes:[],metadata:[]},y=new Set(n?.clips.filter(w=>h(w)||!!w.media&&F(w.media)).map(w=>w.id)),f=new Set(n?.clips.filter(w=>y.has(w.id)).flatMap(w=>(w.captureHistory??[]).map(M=>M.image.id))),k=(n?.images??[]).filter(w=>w.source!=="annotate"||!!w.media||!f.has(w.id)||n.marks.some(M=>M.imageId===w.id&&!(M.clipId&&y.has(M.clipId))));d?.stage("burn");let v=[];try{v=n?await Sa({...n,images:k},a,m.images):[]}catch(w){throw new O("burn",ie(w))}if(m.framePromptBytes.reduce((w,M)=>w+(M??0),0)>Hn)throw new O("validate","image-budget-exceeded");const S=new Set(n?.images.filter(w=>w.media).map(w=>w.id)),_=n?{...n,images:k.map(w=>m.images[w.id]?{...w,width:m.images[w.id].width,height:m.images[w.id].height}:w),clips:n.clips.filter(w=>!h(w)),marks:n.marks.filter(w=>!S.has(w.imageId)&&!n.clips.some(M=>h(M)&&M.id===w.clipId))}:null;u();const B=m.metadata.some(w=>typeof w.transcript=="string"&&w.transcript.trim());if(!s.text.trim()&&!r.length&&!s.workspaceContextStr?.trim()&&!v.length&&!m.files.length&&!m.frames.length&&!s.imageBlocks?.length&&!s.fileBlocks?.length&&!B)return null;let C=v,P=null;d?.stage("placement");const xe=n?await pt(i):null;if(u(),n&&(e!==be||xe?.chiefAttachments)){const w=await ca({workspaceId:e,binding:i,images:k.map((M,X)=>{const Q=a.find(Et=>Et.id===M.contextItemId);return{image:M,signature:Gt(n,M.id),composite:{base64:v[X].data,mimeType:v[X].mimeType},raw:!M.media&&Q?.imageData&&Q.imageMimeType?{base64:Q.imageData,mimeType:Q.imageMimeType}:null}}),records:n?.placements??{},onRecord:c});u(),C=w.map(M=>({type:"image",attachmentId:M.composite.attachmentId,mimeType:M.composite.mimeType})),P=Object.fromEntries(w.map(M=>[M.imageId,{attachmentId:M.composite.attachmentId,raw:M.raw}]))}const g=new Map(n?Qe(n).map(({n:w,mark:M})=>[M.id,w]):[]),D=p&&P?{...p,imageAttachments:P,markNumbers:g}:p&&{...p,markNumbers:g},U=n&&D?{...s,imageBlocks:[...C,...m.frames,...s.imageBlocks??[]],fileBlocks:[...s.fileBlocks??[],...m.files],workspaceContextStr:[Yt(_,D),m.metadata.length?`[Edited capture outputs]
|
|
3
3
|
${JSON.stringify(m.metadata)}`:"",s.workspaceContextStr].filter(Boolean).join(`
|
|
4
4
|
|
|
5
|
-
`),messageMetadata:{...s.messageMetadata,...
|
|
5
|
+
`),messageMetadata:{...s.messageMetadata,...Jt(_,D),edited_captures:m.metadata}}:s;return u(),U}async function Sa(e,t,n={}){const a=Qe(e);return Promise.all(e.images.map(async r=>{if(n[r.id])return{type:"image",...n[r.id]};const s=t.find(o=>o.id===r.contextItemId);if(!s?.imageData||!s.imageMimeType)throw new Error("dock-evidence-missing-pixels");const i=await va({base64:s.imageData,mimeType:s.imageMimeType},r,a.filter(({mark:o})=>o.imageId===r.id));return{type:"image",data:i.base64,mimeType:i.mimeType}}))}function Ma(){return et()}function Yr(e){const{clip:t}=e;if(t.status!=="ready"||!t.path)return null;const n=e.marks.filter(s=>s.clipId===t.id&&typeof s.clipMs=="number").sort((s,i)=>s.clipMs-i.clipMs).map(s=>({id:s.id,tool:s.tool,atMs:s.clipMs,...s.element?.name?{label:s.element.name.slice(0,200)}:{}})),a=Xt(e.evidence??void 0,t.id),r=a?t.media:void 0;return{kind:"recording",workspaceId:e.workspaceId,agentId:e.agentId,attachmentId:a?.attachmentId??t.id,sourceRevision:a?`${a.id}:${a.revision}`:t.path,attachmentPath:t.path,title:"",durationMs:t.durationMs,marks:n,provenance:a?{...a.audio==="unknown"?{}:{hasMicAudio:a.audio==="available"},visuals:a.visuals}:{hasMicAudio:t.hasMicAudio,visuals:n.length>0?"baked-marks":"clean"},...a&&r?{source:a,saved:r.saved??null,transcript:r.transcript??null}:{}}}async function Xr(e){if(!Ma())return{ok:!1,error:"unavailable"};try{return await sn().invoke(rn.OPEN,e)??{ok:!1,error:"unavailable"}}catch{return{ok:!1,error:"transport"}}}function Qr(e){let t=null,n=null;const a=o=>e.releaseMediaJob?.(o).catch(()=>{});function r(){const o=t;t=null,!(!o||o.taken||o.stopped)&&(o.stopped=!0,clearTimeout(o.timer),a(o.id))}function s(o,l,c){if(t?.key===o||n===o||(r(),n=null,!e.adoptMediaJob||!e.exportMedia||!c()||F(l)))return;const d=structuredClone(l),u=d.saved??re(d.source,d.source.capturedMarks??[],d.transcript),h=ve(u,d.source,d.transcript);if(d.source.kind!=="recording"||d.source.visuals!=="clean"||h.errors.length||!h.clips.length||u.voice==="transcript"&&d.transcript?.status!=="ready")return;const p={...d,saved:u},m=crypto.randomUUID(),y={key:o,mediaKey:JSON.stringify(p),id:m,current:c,taken:!1,stopped:!1,settled:!1,failed:!1,timer:setTimeout(()=>{t===y&&(n=o,r())},3e4),result:Promise.resolve({error:new Error("not-started")})};t=y,y.result=ot(p,m,e,()=>!y.stopped&&y.current()).then(async f=>y.stopped||!y.current()?(await a(m),{error:new Error("media-send-retired")}):{value:f},async f=>(y.failed=!0,t===y&&(n=o),await a(m),{error:f})).finally(()=>{y.settled=!0})}async function i(o,l,c){const d=t;if(!d||d.key!==o||d.mediaKey!==JSON.stringify(l)||d.stopped||d.taken||!c())return null;if(d.failed&&d.settled)return r(),null;d.taken=!0,d.current=c,clearTimeout(d.timer),t=null;const u=await d.result;if("error"in u)throw u.error;try{if(!c())throw new Error("media-send-retired");const h=await e.adoptMediaJob?.(d.id);if(!c())throw new Error("media-send-retired");return!h?.ok||!h.value?(await a(d.id),null):u.value}catch(h){throw await a(d.id),h}}return{warm:s,take:i,cancel:r}}function Zr(e={}){const t=a=>on(a,typeof e=="function"?e():e),n=a=>bn(t(a));return{actionHints:{get capture(){return{label:b.dock_composer_screenshotAction_label(),shortcut:t("dock.capture")}},get record(){return{label:b.ui_shortcuts_dockRecord_label(),shortcut:t("dock.record")}},get dictate(){return{label:b.dock_shortcut_dictate_label()}}},get capture(){return b.dock_composer_capture_tooltip({shortcut:n("dock.capture")})},captureMode:{get window(){return b.dock_composer_captureWindow_tooltip({shortcut:n("dock.capture")})},get region(){return b.dock_composer_captureRegion_tooltip({shortcut:n("dock.capture")})}},captureModes:{fullscreen:b.dock_composer_captureFullscreen_label(),window:b.dock_composer_captureWindow_label(),region:b.dock_composer_captureRegion_label()},captureOptions:b.dock_composer_captureModes_ariaLabel(),captureLimit:b.dock_composer_captureLimit_tooltip(),clipLimit:b.dock_composer_clipLimit_tooltip({limit:q(ae.clips)}),get record(){return b.dock_composer_record_tooltip({shortcut:n("dock.record")})},stopRecording:b.dock_composer_stopRecording_tooltip(),annotationTools:b.annotation_toolbar_ariaLabel(),annotateCurrent:a=>b.dock_composer_annotate_ariaLabel({tool:a}),tools:{pick:b.dock_composer_pick_label(),box:b.dock_composer_box_label(),pen:b.dock_composer_pen_label(),arrow:b.annotation_arrow_label()},get dictate(){return b.dock_shortcut_dictate_label()},stopDictating:b.dock_composer_stopDictating_tooltip(),annotating:b.dock_composer_annotating_status(),listening:b.dock_composer_listening_status(),recording:b.dock_composer_recording_status(),markUp:b.dock_composer_markUp_label(),remove:b.chat_contextChip_remove_label(),play:b.dock_composer_play_label(),edit:b.dock_composer_edit_label(),done:b.dock_composer_done_label(),attachments:b.context_attachments_title_label(),retry:b.chat_shared_retry_label(),attachmentPending:b.dock_composer_attachmentPending_status(),attachmentFailed:b.dock_composer_attachmentFailed_error(),image:a=>b.dock_composer_image_ariaLabel({n:q(a)}),clip:a=>b.dock_composer_clip_ariaLabel({duration:a}),recordingReference:(a,r)=>r?b.dock_composer_recordingEnd_chip({n:q(a)}):b.dock_composer_recordingStart_chip({n:q(a)}),speechError:a=>a.includes("permission")?b.dock_composer_speechPermission_error():["unsupported-platform","helper-missing","recognizer-unavailable","locale-unsupported","assets-unavailable","unavailable"].includes(a)?b.dock_composer_speechUnavailable_error():b.dock_composer_speechFailed_error()}}function es(e,t){return{enabled:e,limit:ae.files,excludedIds:t,unavailableMessage:b.dock_composer_filesUnavailable_error(),limitMessage:b.dock_composer_fileLimit_error({limit:q(ae.files)})}}function Aa(e){try{return new URL(e.pageUrl).hostname||e.pageUrl}catch{return e.pageUrl}}function ts(e,t){return e.targetAgentId===t}function ns(e){const t=e.element,n=e.viewport,a=Aa(e),r=t?`<${t.tagName.toLowerCase()}> · ${a}`:e.title||a,s=["<browser-element-capture>",`Page URL: ${e.pageUrl}`,`Page title: ${e.title}`,...t?[`DOM path: ${t.domPath}`,`CSS selector: ${t.selector}`,`Text snippet: ${t.textSnippet}`,...t.sourceRef?[`Source ref: ${t.sourceRef}`]:[],...n?[`Viewport: ${n.width}×${n.height}`]:[],`Element bounds: ${t.rect.width}×${t.rect.height} at (${t.rect.x}, ${t.rect.y})`]:[],"</browser-element-capture>"].join(`
|
|
6
6
|
`);return[{id:`${e.id}-image`,type:"file",label:r,imageData:e.image.data,imageMimeType:e.image.mimeType},{id:`${e.id}-context`,type:"selection",label:r,content:s}]}function Ia(e,t){const n=t.filter(a=>a.type==="selection").flatMap(a=>a.content?.trim()?[a.content.trim()]:[]);return[e.trim(),...n].filter(Boolean).join(`
|
|
7
7
|
`)}function Ta(e){const t=e.filter(a=>(a.imageData||a.attachmentId)&&a.imageMimeType).map(a=>a.attachmentId?{type:"image",attachmentId:a.attachmentId,...a.imageMimeType.includes("/")?{mimeType:a.imageMimeType}:{}}:{type:"image",data:a.imageData,mimeType:a.imageMimeType,...a.placementFileName?{placementFileName:a.placementFileName}:{}}),n=e.filter(a=>a.attachmentId&&!a.imageMimeType).map(a=>({type:"file",attachmentId:a.attachmentId,fileName:a.label,...a.attachmentMimeType?{mimeType:a.attachmentMimeType}:{},...a.attachmentSize!==void 0?{size:a.attachmentSize}:{}}));return{imageBlocks:t,fileBlocks:n}}function Ea(e=[],t=[],n=[]){const a=[];for(const r of t)r.type==="file"&&r.filePath?a.push(`[Currently viewing file: ${r.filePath}]`):r.type==="diff"&&r.filePath?a.push(`[Currently viewing diff for: ${r.filePath}]`):r.type==="note"&&r.noteId?a.push(`[Currently viewing note: "${r.label}" (ID: ${r.noteId}). Read it with ws.note.read("${r.noteId}").]`):r.type==="spec"?a.push("[Currently viewing: Spec]"):r.type==="browser"&&r.browserUrl&&a.push(`[Currently viewing browser: ${r.browserUrl}]`);for(const r of n){const s=r.text.trim(),i=s.length>500?s.substring(0,500)+"...":s,o=r.sourceLabel?` from ${r.sourceLabel}`:"";a.push(`[Selected text${o}:
|
|
8
8
|
\`\`\`
|
|
9
9
|
${i}
|
|
10
10
|
\`\`\`]`)}return Ia(a.join(`
|
|
11
|
-
`),e)}function as(e,t,n){if(e==="suggested-prompt")return{fields:{},hasAttachments:!1,cleanup:{clearInput:!1,followBottom:!0,historyText:null}};const a=n(),{imageBlocks:r,fileBlocks:s}=Ta(a.contextItems);return{fields:{contextItems:a.contextItems,workspaceContextStr:Ea(a.contextItems,a.checkedPanels,a.checkedSelections),noteIds:a.noteIds,...r.length>0?{imageBlocks:r}:{},...s.length>0?{fileBlocks:s}:{},...a.pickedMentions?{messageMetadata:a.pickedMentions}:{}},hasAttachments:r.length>0||s.length>0,cleanup:{clearInput:!0,followBottom:!0,historyText:t}}}const Ca="chat-read:",K=new Map,ye=new Set;function rs(e,t){let n=K.get(e);n||(n=new Set,K.set(e,n)),n.add(t)}function ss(e,t){const n=K.get(e);if(!(!n||!n.delete(t))&&n.size===0){K.delete(e);for(const a of[...ye])a(e)}}function is(e){return ye.add(e),()=>ye.delete(e)}function os(e){return K.has(e)}function cs(e){const t=K.get(e);if(!t)return!1;for(const n of t)if(!n.startsWith(Ca))return!0;return!1}function Da(e,t,n){const a=e.state.pendingSubmissions.byAgentId[t.agentId];if(!a||!Ge(a.scope,t))return null;const r={...structuredClone(n),id:crypto.randomUUID(),createdAt:Date.now()};e.dispatch(xt(t,r));const s=e.state.pendingSubmissions.byAgentId[t.agentId];return s&&R(s.submissions,r.id)?r:null}function Ra(e,t,n,a,r){const s=Be.select(e.state,n),i=pe.select(e.state)?.principal.id,o=Le(e.state);if(!s||!i||!o)return null;const l=An(t,n),c={agentId:t,workspaceId:n,principalId:i,participation:s,authority:o,owner:l.key,lifetime:e.state.pendingSubmissions.byAgentId[t]?.scope.lifetime??crypto.randomUUID()},d=()=>l.isCurrent(e.state.agentSessions?.byAgentId[t]?.workspaceId)&&Be.select(e.state,n)===s&&pe.select(e.state)?.principal.id===i&&Le(e.state)===o;if(!d())return null;e.dispatch(Rt(c,a,Ft.select(e.state,n)));const u=Da(e,c,r);return u?{scope:c,submission:u,isCurrent:()=>{const h=e.state.pendingSubmissions.byAgentId[t];return d()&&!!h&&Ge(h.scope,c)&&(!!R(h.operations,u.id)||!!R(h.submissions,u.id))}}:null}function we(e,t,n){if(!n.text.trim()&&!n.imageBlocks?.length&&!n.fileBlocks?.length)return null;const a=n.userAppMessageId??In();return Ra(e,t,n.wsId,pe.select(e.state)?.capabilities.submissionCorrelation,{content:n.text.trim(),appMessageId:a,destination:!n.forceSubmit&&Kt.select(e.state,t)?"queue":"conversation",contextItems:n.contextItems,imageBlocks:n.imageBlocks,fileBlocks:n.fileBlocks,messageMetadata:n.messageMetadata})}function xa(e,t,n){const a=we(e,t,n);return a?(e.dispatch(Ye(t,{...n,userAppMessageId:a.submission.appMessageId,submission:{scope:a.scope,id:a.submission.id}})),!0):!1}async function Pa(e,t,n,a){const r=n.submission;if(!r)return"legacy";const s=r.reference,i=()=>s.scope.agentId===e&&s.scope.workspaceId===t&&Xe.select(A.state,e)===n?gn.select(A.state,s.scope):void 0,o=i();if(!o)return null;if(!o.supported)return"legacy";const l={wsId:t,text:n.text,imageBlocks:n.options?.imageBlocks,fileBlocks:n.options?.fileBlocks,noteIds:n.options?.noteIds,messageMetadata:n.options?.messageMetadata,model:a??n.options?.model};if(r.outcome==="rejected"){const p=R(o.tombstones,s.id);return R(o.submissions,s.id)||p&&p.reason!=="rejected"?null:we(A,e,l)}if(r.outcome==="accepted")return we(A,e,l);await Promise.all([Tn(e,t).catch(()=>{}),En(e,t).catch(()=>{})]);const c=i();if(!c||R(c.submissions,s.id)?.status!=="uncertain")return null;const{notify:d}=await fe(async()=>{const{notify:p}=await import("./DkNdI_Wp.js").then(m=>m.t);return{notify:p}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45]),import.meta.url);if(i()!==c)return null;let u=!1;const h=()=>{u=!0};return d.warning(b.agent_chatSend_uncertainRetry_description(),{key:`submission-retry:${t}:${e}:${s.id}`,duration:Number.POSITIVE_INFINITY,action:{label:b.agent_chatSend_resend_label(),onClick:()=>{if(u)return;u=!0;const p=i();!p||p.generation!==c.generation||p.submissions!==c.submissions||p.observationVersion!==c.observationVersion||R(p.submissions,s.id)?.status!=="uncertain"||xa(A,e,l)}},cancel:{label:b.chat_richInput_cancel_label(),onClick:h},onDismiss:h}),null}async function ls(e,t,n){const a=Xe.select(A.state,e),r=a?.submission?await Pa(e,t,a,n):"legacy";if(r){if(r==="legacy"){await A.dispatch(n===void 0?Pt(e,t):Bt(e,t,n));return}!r.isCurrent()||!a||A.dispatch(Ye(e,{wsId:t,text:a.text,imageBlocks:a.options?.imageBlocks,fileBlocks:a.options?.fileBlocks,noteIds:a.options?.noteIds,messageMetadata:a.options?.messageMetadata,model:n??a.options?.model,userAppMessageId:r.submission.appMessageId,submission:{scope:r.scope,id:r.submission.id}}))}}const ds=A.createSelector((e,t)=>{const n=R(e.chatDrafts.owners,t);return n?{restore:n.restore,saves:Je(n.saves),shared:n.restore?e.chatDrafts.shared[JSON.stringify([n.restore.workspaceId,n.restore.agentId])]:void 0}:void 0});function Ba(e,t){return t.workspaceId===e&&!t.retiredAt&&!t.pendingDeleteAt&&t.status!==ke.Deleted&&!t.notificationsMuted&&$t(t)==="topLevel"}function Oa(e){const t=e.metadata?.pendingQuestionsMessageId;return typeof t=="string"&&t.length>0&&!Rn(e.metadata,t)?t:null}function $a(e){return e.status===ke.Error&&!Wt(jt(e))}function us(e,t){return t.filter(n=>Ba(e,n)).flatMap(n=>{const a=Ot(n),r=Oa(n),s=n.status===ke.Error;if(!a&&!r&&!s)return[];const i=a?.timestamp??(s?n.stopReasonTimestamp:void 0);return[{agentId:n.id,agentName:n.name,kind:a?.kind??(s?"failed":"question"),reason:a?.reason,timestamp:i&&Number.isFinite(Date.parse(i))?i:void 0,questionMessageId:r,canRetry:$a(n)}]})}function ms(e){return e.displayStatus==="failed"?"failed":e.displayStatus==="blocked"?"blocked":e.attention==="review_required"?"review":e.displayStatus==="needs_attention"?"question":e.activity==="agent_running"||e.displayStatus==="in_progress"?"running":e.scriptsRunning===!0?"scripts_running":e.backgroundTasksRunning===!0?"background_tasks_running":e.displayStatus==="pr_ready"?"pr_ready":e.displayStatus==="pr_merged"?"merged":e.displayStatus==="complete"?"complete":e.attention==="unread"?"unread":e.displayStatus==="pr_open"||e.displayStatus==="pr_queued"?e.displayStatus:"idle"}function ps(e){const t=e.kind==="prs"?e.organization?.trim().toLowerCase():void 0;return{key:JSON.stringify([e.kind,e.workspaceId,t||null,[...new Set((t?[]:e.repositories).map(n=>JSON.stringify([n.key,n.owner,n.name])))].sort()]),hasGitHubRepositories:!!t||e.repositories.some(n=>!!n.owner),hasLocalRepositories:!t&&e.repositories.some(n=>!n.owner)}}function Te(e){const t=kn(e);if(t?.kind!=="pr"||!Number.isSafeInteger(t.number)||t.number<=0)return null;const n=t.owner.toLowerCase(),a=t.repo.toLowerCase();return{owner:n,repo:a,number:t.number,id:`${n}/${a}#${t.number}`,url:`https://github.com/${n}/${a}/pull/${t.number}`}}function fs(e,t,n,a){const r=e.filter(s=>a?a.includes(s.id):n?s.repositoryOwner?.toLowerCase()===n.toLowerCase():t.some(i=>i.owner?.toLowerCase()===s.repositoryOwner?.toLowerCase()&&i.name.toLowerCase()===s.repositoryName?.toLowerCase()));return[...new Map(r.flatMap(s=>[...(s.pullRequests??[]).map(i=>i.url),s.activePullRequest?.url,s.prUrl]).flatMap(s=>{const i=s?Te(s):null;return i?[[i.id,{owner:i.owner,repo:i.repo,number:i.number}]]:[]})).values()].sort((s,i)=>`${s.owner}/${s.repo}#${s.number}`.localeCompare(`${i.owner}/${i.repo}#${i.number}`))}function hs(e,t){const[n]=t;return t.length!==1||e.owner?.toLowerCase()!==n?.owner?.toLowerCase()||e.repo?.toLowerCase()!==n?.name.toLowerCase()}const gs=A.createSelector(e=>e.homeIntegrations),ys=A.createSelector(e=>{const t=e.homeIntegrations;return!t.linkedItems||!Object.keys(t.linkedItems).length?t:{...t,items:[...new Map([...Object.values(t.linkedItems),...t.items].map(n=>[n.id,n])).values()].sort((n,a)=>(a.updatedAt??"").localeCompare(n.updatedAt??""))}}),gt=A.createSelector(e=>Je(e.workspace.workspaces).flatMap(t=>[...(t.pullRequests??[]).map(n=>n.url),t.activePullRequest?.url,t.prUrl].filter(n=>!!n).map(n=>({url:Te(n)?.url??n.replace(/\/$/,"").toLowerCase(),workspaceId:t.id,name:t.title||t.id})))),ws=A.createSelector(e=>{const t=e.homeIntegrations.detail?.url,n=t?Te(t)?.url??t.replace(/\/$/,"").toLowerCase():void 0;return gt.select(e).find(a=>a.url===n)??null}),bs=A.createSelector(e=>gt.select(e).map(t=>t.url));let ee=null;function ks(e){return ee=e,()=>{ee===e&&(ee=null)}}function vs(){return ee}function _s(e){return[...e.groups.length>0?e.groups.filter(n=>n.expanded).flatMap(n=>n.items):e.workspaces,...e.asideExpanded?e.aside:[]].map(n=>n.id)}function Ss(e,t,n){if(e.length===0)return null;const a=t===null?-1:e.indexOf(t);return a===-1?e[0]:e[a+(n==="clockwise"?1:-1)]??null}let te=null;function Ms(e){return te=e,()=>{te===e&&(te=null)}}function As(){return te}function Is(e){return Mn(e)}function La(e){return Sn(e)}function Ua(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function me(e){if(e.length===0)return[];const t=[];let n=null;for(const a of e){const r=a.timestamp?typeof a.timestamp=="string"?new Date(a.timestamp):a.timestamp:new Date;(!n||!Ua(n.date,r))&&(n={date:r,label:La(r),messages:[]},t.push(n)),n.messages.push(a)}return t}function Ts(e){const t=new Map;return e.map(({date:n})=>{const a=`${n.getFullYear()}-${n.getMonth()+1}-${n.getDate()}`,r=t.get(a)??0;return t.set(a,r+1),r===0?a:`${a}#${r}`})}function Es(e,t){const n=new Map;let a=t?null:void 0;for(const r of e.groups)for(const s of r.messages)a!==void 0&&n.set(s.id,a),s.role==="user"&&!Pn(s)&&(a=s);return n}function Na(e){return`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`}function je(e,t){const n=new Map;return e.map(a=>{const r=`${t}-${Na(a.date)}`,s=(n.get(r)??0)+1;return n.set(r,s),{...a,groupKey:s===1?r:`${r}-${s}`}})}function Ha(e,t){if(e.length===0||t.length===0)return e;const n=new Set(t.map(s=>s.id)),a=new Set(t.map(s=>s.appMessageId).filter(s=>typeof s=="string"&&s.length>0)),r=e.filter(s=>!n.has(s.id)&&!(typeof s.appMessageId=="string"&&s.appMessageId.length>0&&a.has(s.appMessageId)));return r.length===e.length?e:r}function Cs(e,t,n){return e=Ha(e,t),e.length===0?{groups:me(t),detached:!1,hiddenTail:[]}:n?{groups:je(me(e),"h"),detached:!0,hiddenTail:t}:{groups:je(me([...e,...t]),"d"),detached:!1,hiddenTail:[]}}function Ds(e){const{scrollTop:t,threshold:n,fetching:a,exhausted:r,historyCount:s,tailCount:i,tailTruncated:o,totalMessages:l,spacerAbove:c=0}=e;return t>n+c||a||r?!1:s>0||o||l>i+s}const Rs=300;function xs(e){const{fetching:t,chainEvaluationPending:n,visible:a,hideArmed:r}=e;return t||n?a&&!r?"none":"show":a&&!r?"arm-hide":"none"}const qe=24,Fa=320;function Ee(e){return Number.isFinite(e)?Math.min(Fa,Math.max(qe,e)):qe}const Ka=.2,Wa=.12;function ja(e,t,n=Ka){const a=Ee(t);return e===null||!Number.isFinite(e)?a:e+n*(a-e)}function Ps(e,t){const n=Ee(t??Number.NaN);return{above:Math.round(Math.max(0,e.above)*n),below:Math.round(Math.max(0,e.below)*n)}}function Bs(e){const{totalMessages:t,residentCount:n,exhausted:a,residentContentHeight:r,currentSpacerHeight:s,viewportHeight:i}=e;let o=e.rowHeightEma;n>0&&r>0&&(o=ja(o,r/n));const l=e.unloadedRows??t-n,d=a||t<=0||n<=0||l<=0||o===null?0:Math.round(l*o),u=Math.abs(d-s);return u===0?{spacerHeight:s,rowHeightEma:o,applied:!1,scrollTopDelta:0}:d===0||s===0||u>s*Wa||i>0&&u>i?{spacerHeight:d,rowHeightEma:o,applied:!0,scrollTopDelta:d-s}:{spacerHeight:s,rowHeightEma:o,applied:!1,scrollTopDelta:0}}const qa=xn,Va=2;function Os(e){const{scrollTop:t,spacerAboveHeight:n,rowHeightEstimate:a,pageSize:r=qa,nearPages:s=Va}=e;if(n<=0||t>=n)return"serial";const i=Ee(a??Number.NaN);return(n-Math.max(0,t))/i>s*r?"seek":"serial"}const yt=200,za=1;function $s(e,t,n=yt){const a=t.timestamp-n;return[...e.filter(r=>r.timestamp>=a),t]}function Ls(e){const{samples:t,viewportHeight:n,windowMs:a=yt,viewportFactor:r=za}=e;if(n<=0||t.length<2)return"gentle";const s=t[t.length-1].timestamp-a,i=t.filter(l=>l.timestamp>=s);if(i.length<2)return"gentle";let o=0;for(let l=1;l<i.length;l+=1)o+=Math.abs(i[l].scrollTop-i[l-1].scrollTop);return o>n*r?"rapid":"gentle"}function Us(e){const{scrollTop:t,spacerAboveHeight:n,unloadedRowsAbove:a}=e;if(a<=0||n<=0)return 0;const r=Math.min(1,Math.max(0,t/n));return Math.min(a-1,Math.max(0,Math.floor(r*a)))}function Ns(e){const{totalMessages:t,residentCount:n,exhausted:a,startOrdinalEstimate:r,detachedFromTail:s}=e,i=Math.max(0,t-n);if(!s)return{above:a?0:i,below:0};const o=Math.max(0,e.hiddenTailCount??0);if(a)return{above:0,below:i+o};if(r!==null){const c=Math.min(i,Math.max(0,Math.round(r)));return{above:c,below:i-c+o}}const l=Math.min(i,Math.max(0,Math.round(e.holeRowsEstimate??0)));return{above:i-l,below:l+o}}function Hs(e){const{exhausted:t,historyCount:n,tailCount:a,tailTruncated:r,totalMessages:s}=e;return t?!0:n>0?!1:!r&&s<=a}const Ga="intent.drafts.sync",Ya="intent.drafts.changed",Ja=$({id:E(),type:E(),label:E(),description:E().optional(),content:E().optional(),path:E().optional(),imageData:E().optional(),imageMimeType:E().optional(),attachmentId:E().optional(),attachmentMimeType:E().optional(),attachmentSize:ce().optional(),sourcePath:E().optional(),placementStatus:V("failed").optional(),screen:Bn().optional()}),wt=$({text:E(),attachments:On(Ja)}),z={provenance:E().min(1),workspaceId:E().min(1),agentId:E().min(1)},ne={lifetime:E(),revision:ce().int().nonnegative()};$n("kind",[$({...z,kind:V("read")}),$({...z,...ne,kind:V("edit"),origin:E().min(1),sequence:ce().int().positive(),snapshot:wt}),$({...z,...ne,kind:V("flush")}),$({...z,...ne,kind:V("clear"),origin:E().min(1)})]);const bt=$({...z,...ne,origin:E(),sequence:ce().int().nonnegative(),snapshot:wt}),Xa=$({accepted:Ln(),draft:bt});function Qa(e,t,n=t){const a=new Map,r=new Set,s=crypto.randomUUID();let i=0,o=!1;const l=()=>{const f=t();if(o||!f)throw new Error("draft-authority-unavailable");return f},c=()=>{const f=n();if(!f||o)throw new Error("draft-authority-unavailable");return()=>{if(o||n()!==f)throw new Error("draft-authority-changed")}},d=(f,k,v)=>{const I=JSON.stringify([f,k,v]);let S=a.get(I);return S||(S={dirty:0},a.set(I,S)),S},u=(f,k)=>{if(o||f.provenance!==t())return;const v=d(f.provenance,f.workspaceId,f.agentId);if(!(v.value?.lifetime===f.lifetime&&v.value.revision>f.revision)&&(v.value=f,k&&v.dirty===0))for(const I of r)I(f)},h=e.subscribe(f=>{const k=bt.safeParse(f);k.success&&u(k.data,!0)}),p=async(f,k)=>{k();const v=Xa.parse(await e.request(f));if(k(),f.provenance!==l()||v.draft.provenance!==f.provenance)throw new Error("draft-authority-changed");if(!v.accepted)throw u(v.draft,!1),new Error("draft-changed-in-another-editor");return v.draft},m=async(f,k)=>{const v=l(),I=c(),S=d(v,f,k);S.tail&&await S.tail;const _=await p({kind:"read",provenance:v,workspaceId:f,agentId:k},I);return u(_,!1),_},y=(f,k,v)=>{const I=l(),S=c(),_=d(I,f,k),B=_.tail??(_.value?Promise.resolve(_.value):p({kind:"read",provenance:I,workspaceId:f,agentId:k},S));_.dirty+=1;const C=B.then(P=>p(v(P),S));return _.tail=C,C.then(P=>{_.dirty-=1,_.tail===C&&(_.tail=void 0),u(P,!0)},()=>{_.dirty-=1,_.tail===C&&(_.tail=void 0)}),C};return{authority:()=>o?null:n(),read:m,async edit(f,k,v,I){const S=++i;return y(k,v,_=>({kind:"edit",provenance:_.provenance,workspaceId:k,agentId:v,lifetime:_.lifetime,revision:_.revision,origin:f,sequence:S,snapshot:I}))},async flush(f,k){const v=l(),I=c(),S=d(v,f,k),_=await(S.tail??(S.value?Promise.resolve(S.value):m(f,k)));await p({kind:"flush",provenance:v,workspaceId:f,agentId:k,lifetime:_.lifetime,revision:_.revision},I)},async clear(f,k){await y(f,k,v=>({kind:"clear",provenance:v.provenance,workspaceId:f,agentId:k,lifetime:v.lifetime,revision:v.revision,origin:s}))},subscribe(f){return r.add(f),()=>{r.delete(f)}},dispose(){o=!0,h(),r.clear(),a.clear()}}}let L=null;async function Fs(e,t,n,a,r){const s=L;if(!s)throw new Error("draft-shared-transport-unavailable");const i=()=>{if(L!==s||s.authority()!==r)throw new Error("draft-authority-changed")};i(),await s.edit(e,t,n,a),i(),await s.flush(t,n),i()}async function Ks(e,t){await Promise.resolve(),L&&await L.flush(e,t)}function Ws(){if(!et())return null;const e=Qa({request:n=>_n(Ga,n),subscribe:n=>vn(a=>{a.method===Ya&&n(a.params)})},()=>Cn(A.state),()=>Dn(A.state));L=e;const t=e.dispose;return e.dispose=()=>{L===e&&(L=null),t()},e}const kt=new Map;function vt(e,t){return`${e}\0${t}`}function js(e,t){return kt.get(vt(e,t))}function qs(e,t,n){kt.set(vt(e,t),n)}const Vs=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?R(a.userMessageIndexes,n):void 0}),zs=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?R(a.retryAgents,n):void 0});function Za(e){e=Math.max(0,e);const t=Math.floor(e/1e3);if(t<10){const s=e/1e3,i=s.toFixed(1);return i.endsWith(".0")?`${Math.round(s)}s`:`${i}s`}if(t<60)return`${t}s`;const n=Math.floor(t/3600),a=Math.floor(t%3600/60),r=t%60;return n>0?`${n}h ${a}m ${r}s`:`${a}m ${r}s`}function Gs(e){return Za(Math.max(1e3,Math.round(e/1e3)*1e3))}const er=new Set(["launch","init","session-create","session-load","prompt"]),tr=new Set(["tool-call","tool-waiting"]);function nr(e){let t=null;for(const n of e)(!t||n.timestamp>=t.timestamp)&&(t=n);return t}function Ys(e){return e&&er.has(e)?"pulse":e&&tr.has(e)?"twist":"bloom"}const _t="stalled";function Js(e,t){const n=nr(e);return!n||n.phase!==_t||typeof t=="number"&&t>n.timestamp?null:n}function Xs(e){let t=null;for(const n of e)n.phase!==_t&&(!t||n.timestamp>=t.timestamp)&&(t=n);return t}const Ve={get title(){return b.chat_streamingStatus_sessionCorrupted_title()},get message(){return b.chat_streamingStatus_sessionCorrupted_message()}},ar=/^session\/[a-z_]+(?: failed)?:\s*/i;function rr(e){const n=(e.split(`
|
|
12
|
-
`).map(a=>a.trim()).find(Boolean)??"").replace(ar,"");return n.charAt(0).toUpperCase()+n.slice(1)}function Qs(e,t){return e?t===!0?{corrupted:!0,title:Ve.title,message:Ve.message,detail:e}:{corrupted:!1,title:b.chat_streamingStatus_responseFailed_label(),message:rr(e),detail:null}:null}const Zs=A.createSelector((e,t)=>R(e.questionUi.consumers,t)),sr=3e4,
|
|
11
|
+
`),e)}function as(e,t,n){if(e==="suggested-prompt")return{fields:{},hasAttachments:!1,cleanup:{clearInput:!1,followBottom:!0,historyText:null}};const a=n(),{imageBlocks:r,fileBlocks:s}=Ta(a.contextItems);return{fields:{contextItems:a.contextItems,workspaceContextStr:Ea(a.contextItems,a.checkedPanels,a.checkedSelections),noteIds:a.noteIds,...r.length>0?{imageBlocks:r}:{},...s.length>0?{fileBlocks:s}:{},...a.pickedMentions?{messageMetadata:a.pickedMentions}:{}},hasAttachments:r.length>0||s.length>0,cleanup:{clearInput:!0,followBottom:!0,historyText:t}}}const Ca="chat-read:",K=new Map,ye=new Set;function rs(e,t){let n=K.get(e);n||(n=new Set,K.set(e,n)),n.add(t)}function ss(e,t){const n=K.get(e);if(!(!n||!n.delete(t))&&n.size===0){K.delete(e);for(const a of[...ye])a(e)}}function is(e){return ye.add(e),()=>ye.delete(e)}function os(e){return K.has(e)}function cs(e){const t=K.get(e);if(!t)return!1;for(const n of t)if(!n.startsWith(Ca))return!0;return!1}function Da(e,t,n){const a=e.state.pendingSubmissions.byAgentId[t.agentId];if(!a||!Ge(a.scope,t))return null;const r={...structuredClone(n),id:crypto.randomUUID(),createdAt:Date.now()};e.dispatch(xt(t,r));const s=e.state.pendingSubmissions.byAgentId[t.agentId];return s&&R(s.submissions,r.id)?r:null}function Ra(e,t,n,a,r){const s=Be.select(e.state,n),i=pe.select(e.state)?.principal.id,o=Le(e.state);if(!s||!i||!o)return null;const l=An(t,n),c={agentId:t,workspaceId:n,principalId:i,participation:s,authority:o,owner:l.key,lifetime:e.state.pendingSubmissions.byAgentId[t]?.scope.lifetime??crypto.randomUUID()},d=()=>l.isCurrent(e.state.agentSessions?.byAgentId[t]?.workspaceId)&&Be.select(e.state,n)===s&&pe.select(e.state)?.principal.id===i&&Le(e.state)===o;if(!d())return null;e.dispatch(Rt(c,a,Ft.select(e.state,n)));const u=Da(e,c,r);return u?{scope:c,submission:u,isCurrent:()=>{const h=e.state.pendingSubmissions.byAgentId[t];return d()&&!!h&&Ge(h.scope,c)&&(!!R(h.operations,u.id)||!!R(h.submissions,u.id))}}:null}function we(e,t,n){if(!n.text.trim()&&!n.imageBlocks?.length&&!n.fileBlocks?.length)return null;const a=n.userAppMessageId??In();return Ra(e,t,n.wsId,pe.select(e.state)?.capabilities.submissionCorrelation,{content:n.text.trim(),appMessageId:a,destination:!n.forceSubmit&&Kt.select(e.state,t)?"queue":"conversation",contextItems:n.contextItems,imageBlocks:n.imageBlocks,fileBlocks:n.fileBlocks,messageMetadata:n.messageMetadata})}function xa(e,t,n){const a=we(e,t,n);return a?(e.dispatch(Je(t,{...n,userAppMessageId:a.submission.appMessageId,submission:{scope:a.scope,id:a.submission.id}})),!0):!1}async function Pa(e,t,n,a){const r=n.submission;if(!r)return"legacy";const s=r.reference,i=()=>s.scope.agentId===e&&s.scope.workspaceId===t&&Xe.select(A.state,e)===n?gn.select(A.state,s.scope):void 0,o=i();if(!o)return null;if(!o.supported)return"legacy";const l={wsId:t,text:n.text,imageBlocks:n.options?.imageBlocks,fileBlocks:n.options?.fileBlocks,noteIds:n.options?.noteIds,messageMetadata:n.options?.messageMetadata,model:a??n.options?.model};if(r.outcome==="rejected"){const p=R(o.tombstones,s.id);return R(o.submissions,s.id)||p&&p.reason!=="rejected"?null:we(A,e,l)}if(r.outcome==="accepted")return we(A,e,l);await Promise.all([Tn(e,t).catch(()=>{}),En(e,t).catch(()=>{})]);const c=i();if(!c||R(c.submissions,s.id)?.status!=="uncertain")return null;const{notify:d}=await fe(async()=>{const{notify:p}=await import("./SLOyQ3jf.js").then(m=>m.t);return{notify:p}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45]),import.meta.url);if(i()!==c)return null;let u=!1;const h=()=>{u=!0};return d.warning(b.agent_chatSend_uncertainRetry_description(),{key:`submission-retry:${t}:${e}:${s.id}`,duration:Number.POSITIVE_INFINITY,action:{label:b.agent_chatSend_resend_label(),onClick:()=>{if(u)return;u=!0;const p=i();!p||p.generation!==c.generation||p.submissions!==c.submissions||p.observationVersion!==c.observationVersion||R(p.submissions,s.id)?.status!=="uncertain"||xa(A,e,l)}},cancel:{label:b.chat_richInput_cancel_label(),onClick:h},onDismiss:h}),null}async function ls(e,t,n){const a=Xe.select(A.state,e),r=a?.submission?await Pa(e,t,a,n):"legacy";if(r){if(r==="legacy"){await A.dispatch(n===void 0?Pt(e,t):Bt(e,t,n));return}!r.isCurrent()||!a||A.dispatch(Je(e,{wsId:t,text:a.text,imageBlocks:a.options?.imageBlocks,fileBlocks:a.options?.fileBlocks,noteIds:a.options?.noteIds,messageMetadata:a.options?.messageMetadata,model:n??a.options?.model,userAppMessageId:r.submission.appMessageId,submission:{scope:r.scope,id:r.submission.id}}))}}const ds=A.createSelector((e,t)=>{const n=R(e.chatDrafts.owners,t);return n?{restore:n.restore,saves:Ye(n.saves),shared:n.restore?e.chatDrafts.shared[JSON.stringify([n.restore.workspaceId,n.restore.agentId])]:void 0}:void 0});function Ba(e,t){return t.workspaceId===e&&!t.retiredAt&&!t.pendingDeleteAt&&t.status!==ke.Deleted&&!t.notificationsMuted&&$t(t)==="topLevel"}function Oa(e){const t=e.metadata?.pendingQuestionsMessageId;return typeof t=="string"&&t.length>0&&!Rn(e.metadata,t)?t:null}function $a(e){return e.status===ke.Error&&!Wt(jt(e))}function us(e,t){return t.filter(n=>Ba(e,n)).flatMap(n=>{const a=Ot(n),r=Oa(n),s=n.status===ke.Error;if(!a&&!r&&!s)return[];const i=a?.timestamp??(s?n.stopReasonTimestamp:void 0);return[{agentId:n.id,agentName:n.name,kind:a?.kind??(s?"failed":"question"),reason:a?.reason,timestamp:i&&Number.isFinite(Date.parse(i))?i:void 0,questionMessageId:r,canRetry:$a(n)}]})}function ms(e){return e.displayStatus==="failed"?"failed":e.displayStatus==="blocked"?"blocked":e.attention==="review_required"?"review":e.displayStatus==="needs_attention"?"question":e.activity==="agent_running"||e.displayStatus==="in_progress"?"running":e.scriptsRunning===!0?"scripts_running":e.backgroundTasksRunning===!0?"background_tasks_running":e.displayStatus==="pr_ready"?"pr_ready":e.displayStatus==="pr_merged"?"merged":e.displayStatus==="complete"?"complete":e.attention==="unread"?"unread":e.displayStatus==="pr_open"||e.displayStatus==="pr_queued"?e.displayStatus:"idle"}function ps(e){const t=e.kind==="prs"?e.organization?.trim().toLowerCase():void 0;return{key:JSON.stringify([e.kind,e.workspaceId,t||null,[...new Set((t?[]:e.repositories).map(n=>JSON.stringify([n.key,n.owner,n.name])))].sort()]),hasGitHubRepositories:!!t||e.repositories.some(n=>!!n.owner),hasLocalRepositories:!t&&e.repositories.some(n=>!n.owner)}}function Te(e){const t=kn(e);if(t?.kind!=="pr"||!Number.isSafeInteger(t.number)||t.number<=0)return null;const n=t.owner.toLowerCase(),a=t.repo.toLowerCase();return{owner:n,repo:a,number:t.number,id:`${n}/${a}#${t.number}`,url:`https://github.com/${n}/${a}/pull/${t.number}`}}function fs(e,t,n,a){const r=e.filter(s=>a?a.includes(s.id):n?s.repositoryOwner?.toLowerCase()===n.toLowerCase():t.some(i=>i.owner?.toLowerCase()===s.repositoryOwner?.toLowerCase()&&i.name.toLowerCase()===s.repositoryName?.toLowerCase()));return[...new Map(r.flatMap(s=>[...(s.pullRequests??[]).map(i=>i.url),s.activePullRequest?.url,s.prUrl]).flatMap(s=>{const i=s?Te(s):null;return i?[[i.id,{owner:i.owner,repo:i.repo,number:i.number}]]:[]})).values()].sort((s,i)=>`${s.owner}/${s.repo}#${s.number}`.localeCompare(`${i.owner}/${i.repo}#${i.number}`))}function hs(e,t){const[n]=t;return t.length!==1||e.owner?.toLowerCase()!==n?.owner?.toLowerCase()||e.repo?.toLowerCase()!==n?.name.toLowerCase()}const gs=A.createSelector(e=>e.homeIntegrations),ys=A.createSelector(e=>{const t=e.homeIntegrations;return!t.linkedItems||!Object.keys(t.linkedItems).length?t:{...t,items:[...new Map([...Object.values(t.linkedItems),...t.items].map(n=>[n.id,n])).values()].sort((n,a)=>(a.updatedAt??"").localeCompare(n.updatedAt??""))}}),gt=A.createSelector(e=>Ye(e.workspace.workspaces).flatMap(t=>[...(t.pullRequests??[]).map(n=>n.url),t.activePullRequest?.url,t.prUrl].filter(n=>!!n).map(n=>({url:Te(n)?.url??n.replace(/\/$/,"").toLowerCase(),workspaceId:t.id,name:t.title||t.id})))),ws=A.createSelector(e=>{const t=e.homeIntegrations.detail?.url,n=t?Te(t)?.url??t.replace(/\/$/,"").toLowerCase():void 0;return gt.select(e).find(a=>a.url===n)??null}),bs=A.createSelector(e=>gt.select(e).map(t=>t.url));let ee=null;function ks(e){return ee=e,()=>{ee===e&&(ee=null)}}function vs(){return ee}function _s(e){return[...e.groups.length>0?e.groups.filter(n=>n.expanded).flatMap(n=>n.items):e.workspaces,...e.asideExpanded?e.aside:[]].map(n=>n.id)}function Ss(e,t,n){if(e.length===0)return null;const a=t===null?-1:e.indexOf(t);return a===-1?e[0]:e[a+(n==="clockwise"?1:-1)]??null}let te=null;function Ms(e){return te=e,()=>{te===e&&(te=null)}}function As(){return te}function Is(e){return Mn(e)}function La(e){return Sn(e)}function Ua(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function me(e){if(e.length===0)return[];const t=[];let n=null;for(const a of e){const r=a.timestamp?typeof a.timestamp=="string"?new Date(a.timestamp):a.timestamp:new Date;(!n||!Ua(n.date,r))&&(n={date:r,label:La(r),messages:[]},t.push(n)),n.messages.push(a)}return t}function Ts(e){const t=new Map;return e.map(({date:n})=>{const a=`${n.getFullYear()}-${n.getMonth()+1}-${n.getDate()}`,r=t.get(a)??0;return t.set(a,r+1),r===0?a:`${a}#${r}`})}function Es(e,t){const n=new Map;let a=t?null:void 0;for(const r of e.groups)for(const s of r.messages)a!==void 0&&n.set(s.id,a),s.role==="user"&&!Pn(s)&&(a=s);return n}function Na(e){return`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`}function je(e,t){const n=new Map;return e.map(a=>{const r=`${t}-${Na(a.date)}`,s=(n.get(r)??0)+1;return n.set(r,s),{...a,groupKey:s===1?r:`${r}-${s}`}})}function Ha(e,t){if(e.length===0||t.length===0)return e;const n=new Set(t.map(s=>s.id)),a=new Set(t.map(s=>s.appMessageId).filter(s=>typeof s=="string"&&s.length>0)),r=e.filter(s=>!n.has(s.id)&&!(typeof s.appMessageId=="string"&&s.appMessageId.length>0&&a.has(s.appMessageId)));return r.length===e.length?e:r}function Cs(e,t,n){return e=Ha(e,t),e.length===0?{groups:me(t),detached:!1,hiddenTail:[]}:n?{groups:je(me(e),"h"),detached:!0,hiddenTail:t}:{groups:je(me([...e,...t]),"d"),detached:!1,hiddenTail:[]}}function Ds(e){const{scrollTop:t,threshold:n,fetching:a,exhausted:r,historyCount:s,tailCount:i,tailTruncated:o,totalMessages:l,spacerAbove:c=0}=e;return t>n+c||a||r?!1:s>0||o||l>i+s}const Rs=300;function xs(e){const{fetching:t,chainEvaluationPending:n,visible:a,hideArmed:r}=e;return t||n?a&&!r?"none":"show":a&&!r?"arm-hide":"none"}const qe=24,Fa=320;function Ee(e){return Number.isFinite(e)?Math.min(Fa,Math.max(qe,e)):qe}const Ka=.2,Wa=.12;function ja(e,t,n=Ka){const a=Ee(t);return e===null||!Number.isFinite(e)?a:e+n*(a-e)}function Ps(e,t){const n=Ee(t??Number.NaN);return{above:Math.round(Math.max(0,e.above)*n),below:Math.round(Math.max(0,e.below)*n)}}function Bs(e){const{totalMessages:t,residentCount:n,exhausted:a,residentContentHeight:r,currentSpacerHeight:s,viewportHeight:i}=e;let o=e.rowHeightEma;n>0&&r>0&&(o=ja(o,r/n));const l=e.unloadedRows??t-n,d=a||t<=0||n<=0||l<=0||o===null?0:Math.round(l*o),u=Math.abs(d-s);return u===0?{spacerHeight:s,rowHeightEma:o,applied:!1,scrollTopDelta:0}:d===0||s===0||u>s*Wa||i>0&&u>i?{spacerHeight:d,rowHeightEma:o,applied:!0,scrollTopDelta:d-s}:{spacerHeight:s,rowHeightEma:o,applied:!1,scrollTopDelta:0}}const qa=xn,Va=2;function Os(e){const{scrollTop:t,spacerAboveHeight:n,rowHeightEstimate:a,pageSize:r=qa,nearPages:s=Va}=e;if(n<=0||t>=n)return"serial";const i=Ee(a??Number.NaN);return(n-Math.max(0,t))/i>s*r?"seek":"serial"}const yt=200,za=1;function $s(e,t,n=yt){const a=t.timestamp-n;return[...e.filter(r=>r.timestamp>=a),t]}function Ls(e){const{samples:t,viewportHeight:n,windowMs:a=yt,viewportFactor:r=za}=e;if(n<=0||t.length<2)return"gentle";const s=t[t.length-1].timestamp-a,i=t.filter(l=>l.timestamp>=s);if(i.length<2)return"gentle";let o=0;for(let l=1;l<i.length;l+=1)o+=Math.abs(i[l].scrollTop-i[l-1].scrollTop);return o>n*r?"rapid":"gentle"}function Us(e){const{scrollTop:t,spacerAboveHeight:n,unloadedRowsAbove:a}=e;if(a<=0||n<=0)return 0;const r=Math.min(1,Math.max(0,t/n));return Math.min(a-1,Math.max(0,Math.floor(r*a)))}function Ns(e){const{totalMessages:t,residentCount:n,exhausted:a,startOrdinalEstimate:r,detachedFromTail:s}=e,i=Math.max(0,t-n);if(!s)return{above:a?0:i,below:0};const o=Math.max(0,e.hiddenTailCount??0);if(a)return{above:0,below:i+o};if(r!==null){const c=Math.min(i,Math.max(0,Math.round(r)));return{above:c,below:i-c+o}}const l=Math.min(i,Math.max(0,Math.round(e.holeRowsEstimate??0)));return{above:i-l,below:l+o}}function Hs(e){const{exhausted:t,historyCount:n,tailCount:a,tailTruncated:r,totalMessages:s}=e;return t?!0:n>0?!1:!r&&s<=a}const Ga="intent.drafts.sync",Ja="intent.drafts.changed",Ya=$({id:E(),type:E(),label:E(),description:E().optional(),content:E().optional(),path:E().optional(),imageData:E().optional(),imageMimeType:E().optional(),attachmentId:E().optional(),attachmentMimeType:E().optional(),attachmentSize:ce().optional(),sourcePath:E().optional(),placementStatus:V("failed").optional(),screen:Bn().optional()}),wt=$({text:E(),attachments:On(Ya)}),z={provenance:E().min(1),workspaceId:E().min(1),agentId:E().min(1)},ne={lifetime:E(),revision:ce().int().nonnegative()};$n("kind",[$({...z,kind:V("read")}),$({...z,...ne,kind:V("edit"),origin:E().min(1),sequence:ce().int().positive(),snapshot:wt}),$({...z,...ne,kind:V("flush")}),$({...z,...ne,kind:V("clear"),origin:E().min(1)})]);const bt=$({...z,...ne,origin:E(),sequence:ce().int().nonnegative(),snapshot:wt}),Xa=$({accepted:Ln(),draft:bt});function Qa(e,t,n=t){const a=new Map,r=new Set,s=crypto.randomUUID();let i=0,o=!1;const l=()=>{const f=t();if(o||!f)throw new Error("draft-authority-unavailable");return f},c=()=>{const f=n();if(!f||o)throw new Error("draft-authority-unavailable");return()=>{if(o||n()!==f)throw new Error("draft-authority-changed")}},d=(f,k,v)=>{const I=JSON.stringify([f,k,v]);let S=a.get(I);return S||(S={dirty:0},a.set(I,S)),S},u=(f,k)=>{if(o||f.provenance!==t())return;const v=d(f.provenance,f.workspaceId,f.agentId);if(!(v.value?.lifetime===f.lifetime&&v.value.revision>f.revision)&&(v.value=f,k&&v.dirty===0))for(const I of r)I(f)},h=e.subscribe(f=>{const k=bt.safeParse(f);k.success&&u(k.data,!0)}),p=async(f,k)=>{k();const v=Xa.parse(await e.request(f));if(k(),f.provenance!==l()||v.draft.provenance!==f.provenance)throw new Error("draft-authority-changed");if(!v.accepted)throw u(v.draft,!1),new Error("draft-changed-in-another-editor");return v.draft},m=async(f,k)=>{const v=l(),I=c(),S=d(v,f,k);S.tail&&await S.tail;const _=await p({kind:"read",provenance:v,workspaceId:f,agentId:k},I);return u(_,!1),_},y=(f,k,v)=>{const I=l(),S=c(),_=d(I,f,k),B=_.tail??(_.value?Promise.resolve(_.value):p({kind:"read",provenance:I,workspaceId:f,agentId:k},S));_.dirty+=1;const C=B.then(P=>p(v(P),S));return _.tail=C,C.then(P=>{_.dirty-=1,_.tail===C&&(_.tail=void 0),u(P,!0)},()=>{_.dirty-=1,_.tail===C&&(_.tail=void 0)}),C};return{authority:()=>o?null:n(),read:m,async edit(f,k,v,I){const S=++i;return y(k,v,_=>({kind:"edit",provenance:_.provenance,workspaceId:k,agentId:v,lifetime:_.lifetime,revision:_.revision,origin:f,sequence:S,snapshot:I}))},async flush(f,k){const v=l(),I=c(),S=d(v,f,k),_=await(S.tail??(S.value?Promise.resolve(S.value):m(f,k)));await p({kind:"flush",provenance:v,workspaceId:f,agentId:k,lifetime:_.lifetime,revision:_.revision},I)},async clear(f,k){await y(f,k,v=>({kind:"clear",provenance:v.provenance,workspaceId:f,agentId:k,lifetime:v.lifetime,revision:v.revision,origin:s}))},subscribe(f){return r.add(f),()=>{r.delete(f)}},dispose(){o=!0,h(),r.clear(),a.clear()}}}let L=null;async function Fs(e,t,n,a,r){const s=L;if(!s)throw new Error("draft-shared-transport-unavailable");const i=()=>{if(L!==s||s.authority()!==r)throw new Error("draft-authority-changed")};i(),await s.edit(e,t,n,a),i(),await s.flush(t,n),i()}async function Ks(e,t){await Promise.resolve(),L&&await L.flush(e,t)}function Ws(){if(!et())return null;const e=Qa({request:n=>_n(Ga,n),subscribe:n=>vn(a=>{a.method===Ja&&n(a.params)})},()=>Cn(A.state),()=>Dn(A.state));L=e;const t=e.dispose;return e.dispose=()=>{L===e&&(L=null),t()},e}const kt=new Map;function vt(e,t){return`${e}\0${t}`}function js(e,t){return kt.get(vt(e,t))}function qs(e,t,n){kt.set(vt(e,t),n)}const Vs=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?R(a.userMessageIndexes,n):void 0}),zs=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?R(a.retryAgents,n):void 0});function Za(e){e=Math.max(0,e);const t=Math.floor(e/1e3);if(t<10){const s=e/1e3,i=s.toFixed(1);return i.endsWith(".0")?`${Math.round(s)}s`:`${i}s`}if(t<60)return`${t}s`;const n=Math.floor(t/3600),a=Math.floor(t%3600/60),r=t%60;return n>0?`${n}h ${a}m ${r}s`:`${a}m ${r}s`}function Gs(e){return Za(Math.max(1e3,Math.round(e/1e3)*1e3))}const er=new Set(["launch","init","session-create","session-load","prompt"]),tr=new Set(["tool-call","tool-waiting"]);function nr(e){let t=null;for(const n of e)(!t||n.timestamp>=t.timestamp)&&(t=n);return t}function Js(e){return e&&er.has(e)?"pulse":e&&tr.has(e)?"twist":"bloom"}const _t="stalled";function Ys(e,t){const n=nr(e);return!n||n.phase!==_t||typeof t=="number"&&t>n.timestamp?null:n}function Xs(e){let t=null;for(const n of e)n.phase!==_t&&(!t||n.timestamp>=t.timestamp)&&(t=n);return t}const Ve={get title(){return b.chat_streamingStatus_sessionCorrupted_title()},get message(){return b.chat_streamingStatus_sessionCorrupted_message()}},ar=/^session\/[a-z_]+(?: failed)?:\s*/i;function rr(e){const n=(e.split(`
|
|
12
|
+
`).map(a=>a.trim()).find(Boolean)??"").replace(ar,"");return n.charAt(0).toUpperCase()+n.slice(1)}function Qs(e,t){return e?t===!0?{corrupted:!0,title:Ve.title,message:Ve.message,detail:e}:{corrupted:!1,title:b.chat_streamingStatus_responseFailed_label(),message:rr(e),detail:null}:null}const Zs=A.createSelector((e,t)=>R(e.questionUi.consumers,t)),sr=3e4,J=new Map;function ei(e,t){const n=J.get(e);n&&clearTimeout(n.timer);const a=setTimeout(()=>J.delete(e),sr);J.set(e,{value:t,timer:a})}function ti(e){const t=J.get(e);if(t)return clearTimeout(t.timer),J.delete(e),t.value}const St=A.createSelector((e,t,n)=>e.agentWorkers?.byKey[Ut(t,n)]??Lt),ir=A.createSelector((e,t,n)=>{const a=St.select(e,t,n);return a.status==="unsupported"?[]:(a.snapshot?.workers??[]).filter(r=>r.status==="running"||r.status==="unknown")}),ni=A.createSelector((e,t,n)=>{const a=St.select(e,t,n);return a.status==="failed"?!0:a.status!=="ready"||!a.snapshot?!1:a.snapshot.truncated?!0:a.snapshot.support.status!=="supported"&&ir.select(e,t,n).length>0}),or=1e3,Mt={requireViewedAndFocused:!0,requireAssistantTail:!0},Y=new Map,x=new Map;let W=null;function Ce(e){(e===void 0||W===e)&&(W=null)}const cr=200;function lr(e,t){if(x.delete(e),x.set(e,t),x.size>cr){const n=x.keys().next().value;n!==void 0&&x.delete(n)}}function At(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(!n.isStreaming&&typeof n.id=="string"&&n.id.length>0)return n}return null}function ai(e){return At(e)?.id??null}function ri(e){De(e,{requireViewedAndFocused:!0})}function si(e){De(e,{requireViewedAndFocused:!1})}function ii(e){Ce(),De(e,Mt)}function oi(e){W===e&&(Y.has(e)||(W=null,Re(e,Mt)))}function ci(e){for(const t of e)typeof t!="string"||t.length===0||(It(t),Ce(t),Re(t,{requireViewedAndFocused:!1}))}function It(e){const t=Y.get(e);t&&(clearTimeout(t.timer),Y.delete(e))}function De(e,t){It(e),Ce(e);const n=setTimeout(()=>{Y.delete(e),Re(e,t)},or);Y.set(e,{timer:n,gates:t})}let ze=null;function dr(){return ze??=Promise.all([fe(()=>import("./Bqk0L-NS.js"),__vite__mapDeps([46,21,22,5,23,24,3,8,4,25,15,2,47,48]),import.meta.url),fe(()=>import("./CD7PpB6R.js").then(e=>e.o),__vite__mapDeps([49,45,4,5,21,22,23,24,3,8,25,15,2,13,14,7,9,16,37,36,50,33,42]),import.meta.url)]).then(([e,t])=>({appStore:e.store,appClient:t.appClient})),ze}async function Re(e,t){let n=null;try{const{appStore:a,appClient:r}=await dr(),s=a.state;if(t.requireViewedAndFocused&&(s.unreadTracking?.currentlyViewedAgentId!==e||typeof document<"u"&&!document.hasFocus()))return;const i=s.agentSessions?.byAgentId[e];if(!i)return;const o=typeof i.workspaceId=="string"?i.workspaceId:"";if(o.length===0)return;if(t.requireAssistantTail&&s.chatState?.byAgentId[e]?.initialHistoryPending){W=e;return}const l=At(i.messages??[]);if(!l){t.requireAssistantTail&&(W=e);return}if(t.requireAssistantTail&&l.role!=="assistant")return;const c=l.id;if(x.get(e)===c)return;lr(e,c),n=c,!(await r.agents.markSeen({workspaceId:o,agentId:e,messageId:c})).success&&x.get(e)===n&&x.delete(e)}catch{n!==null&&x.get(e)===n&&x.delete(e)}}const oe=new Map;function Tt(e,t){return`${e}\0${t}`}function li(e,t){return oe.get(Tt(e,t))}function di(e,t,n){oe.set(Tt(e,t),n)}function ui(e){if(e.length===0)return;const t=new Set(e);for(const n of[...oe.keys()]){const a=n.slice(n.indexOf("\0")+1);t.has(a)&&oe.delete(n)}}export{_s as $,Ur as A,Yr as B,Vr as C,O as D,Ha as E,Gr as F,Ta as G,Ca as H,zn as I,Ks as J,Gs as K,Is as L,or as M,Ys as N,Rs as O,li as P,js as Q,yt as R,As as S,us as T,vs as U,qe as V,ms as W,Xs as X,Js as Y,os as Z,cs as _,rs as a,Kr as a0,ta as a1,Es as a2,Fr as a3,Hs as a4,G as a5,jr as a6,Wr as a7,Or as a8,Us as a9,St as aA,ni as aB,ds as aC,Rr as aD,xr as aE,Dr as aF,gs as aG,ws as aH,ys as aI,bs as aJ,gt as aK,Zs as aL,zs as aM,Vs as aN,di as aO,qs as aP,Ds as aQ,Hr as aR,hs as aS,Ns as aT,ei as aU,Ss as aV,xa as aW,ti as aX,na as aY,Nr as aZ,ci as aa,oi as ab,ri as ac,si as ad,ii as ae,ai as af,xs as ag,is as ah,Xr as ai,Nn as aj,Fs as ak,qr as al,as as am,Jr as an,Pa as ao,pt as ap,$r as aq,Ms as ar,Bs as as,ks as at,ss as au,Ce as av,ls as aw,Pr as ax,Ps as ay,ir as az,we as b,$s as c,ts as d,ns as e,Ts as f,Lr as g,Ea as h,Br as i,ra as j,aa as k,Ls as l,Os as m,ui as n,fs as o,Cs as p,es as q,Zr as r,zr as s,Ws as t,Qr as u,Qs as v,ps as w,Ma as x,ge as y,jn as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./CJxGDkBm.js";import{p as r}from"./
|
|
1
|
+
import"./CJxGDkBm.js";import{p as r}from"./DPn3lPe4.js";const t={get error(){return r.error},get params(){return r.params},get state(){return r.state},get status(){return r.status},get url(){return r.url}},s=t;export{s as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a,aW as o}from"./
|
|
1
|
+
import{b as a,aW as o}from"./BrNYPcY3.js";var g=a((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/
|
|
2
|
-
import{bm as c,_ as p}from"./AeC4KVgG.js";import{m as k}from"./BbV7MtxC.js";import"./CJxGDkBm.js";import"./DrHJ7oPv.js";import"./Dp2nUoTL.js";import{Q as A}from"./jhNNYE0v.js";import"./ChTqQfQN.js";import"./BNODdf6r.js";import{i as L,IX as d,vq as g,vs as v}from"./BkzMrEqG.js";import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/BA8yVm-p.js","/app/immutable/chunks/B5aYN90J.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/CD7PpB6R.js","/app/immutable/chunks/AeC4KVgG.js","/app/immutable/chunks/CJxGDkBm.js","/app/immutable/chunks/BkzMrEqG.js","/app/immutable/chunks/PVXvIyE8.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/Bd1FsnP3.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/Dp2nUoTL.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/chunks/DWPd-rzt.js","/app/immutable/chunks/jhNNYE0v.js","/app/immutable/chunks/Cwla-sl1.js","/app/immutable/chunks/DrHJ7oPv.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/DTWXK3Yd.js","/app/immutable/chunks/BV4GrhSx.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/CAYSf4zc.js","/app/immutable/chunks/-5BGDZDk.js","/app/immutable/chunks/Ci7mS1ie.js","/app/immutable/chunks/ZcoUa9Jg.js","/app/immutable/chunks/k2awEenT.js","/app/immutable/chunks/CswzK9Go.js","/app/immutable/chunks/Dz2z231n.js","/app/immutable/chunks/DWUO9rBe.js","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/F-reQTNB.js","/app/immutable/chunks/DKwAaLwd.js","/app/immutable/chunks/9b_Os5fY.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{bm as c,_ as p}from"./AeC4KVgG.js";import{m as k}from"./BbV7MtxC.js";import"./CJxGDkBm.js";import"./DrHJ7oPv.js";import"./Dp2nUoTL.js";import{Q as A}from"./jhNNYE0v.js";import"./ChTqQfQN.js";import"./BNODdf6r.js";import{i as L,IX as d,vq as g,vs as v}from"./BkzMrEqG.js";import{a9 as R}from"./-5BGDZDk.js";import{selectCurrentWorkspaceTabId as P}from"./DwQfkcIA.js";const F="intent://local/note/{note-id}",S="intent://local/{workspace-id}/note/{note-id}";function f(){return c.ui_linkHandler_invalidFormat_error({shortFormat:F,longFormat:S})}class u extends Error{constructor(r){super(r),this.name="NotFoundError"}}function W(e){try{const r=new URL(e.replace("intent://","http://")),t=r.hostname,n=r.pathname.replace(/^\/+/,"").split("/").filter(l=>l.length>0),a=e.replace("intent://","").split(/[?#]/)[0].split("/").slice(1);if(!t||n.length<2)return{type:"unknown",orgId:t||"",resourceId:"",valid:!1,error:f()};let o,s,i,_,w;if(a[0]==="workspace"&&(a.length===2||a.length===3&&a[2]==="")){const l=O(a[1]);if(!l)return{type:"unknown",orgId:t,resourceId:"",valid:!1,error:f()};o=l,s="workspace",i=l}else if(a[0]==="file")s="file",i=m(a.slice(1));else if(a.length>=3&&I(a[0])&&a[1]==="file")o=a[0],s="file",i=m(a.slice(2));else if(a.length===5&&a[1]==="agent"&&a[3]==="message"&&I(a[0])&&I(a[2])&&I(a[4])&&n.length===5&&n[1]==="agent"&&n[3]==="message")o=n[0],s="message",_=n[2],i=n[4];else if(n[0]==="note"||n[0]==="task")s=n[0],i=n[1];else if(n.length>=3&&(n[1]==="note"||n[1]==="task"))o=n[0],s=n[1],i=n[2];else return{type:"unknown",orgId:t,resourceId:"",valid:!1,error:f()};if(!i||i.trim().length===0)return{type:"unknown",orgId:t,resourceId:"",valid:!1,error:c.ui_linkHandler_emptyResourceId_error()};if(s==="note"||s==="task")return{type:s,orgId:t,workspaceId:o,resourceId:i,valid:!0};if(s==="file"){const l=/^#L\d+(?:-\d+|C\d+)?$/.test(r.hash)?r.hash:"",E=a.slice(o?2:1).join("/"),h=A(E+l);return i=m(h.path.split("/")),w=h.line,H(i)?{type:"file",orgId:t,workspaceId:o,resourceId:i,...w!==void 0?{line:w}:{},valid:!0}:{type:"unknown",orgId:t,workspaceId:o,resourceId:"",valid:!1,error:c.ui_linkHandler_invalidFilePath_error()}}return s==="workspace"&&o?{type:"workspace",orgId:t,workspaceId:o,resourceId:i,valid:!0}:s==="message"&&o&&_?{type:"message",orgId:t,workspaceId:o,resourceId:i,agentId:_,valid:!0}:{type:"unknown",orgId:t,workspaceId:o,resourceId:i,valid:!1,error:c.ui_linkHandler_unknownResourceType_error({type:s})}}catch(r){return{type:"unknown",orgId:"",resourceId:"",valid:!1,error:r instanceof Error?r.message:c.ui_linkHandler_parseFailed_error()}}}function m(e){return e.map(r=>decodeURIComponent(r)).join("/")}function H(e){return/^[A-Za-z]:/.test(e)?!1:e.split(/[\\/]/).every(t=>t.length>0&&t!=="."&&t!=="..")}const j=new Set([L,"new"]);function O(e){if(e===void 0||!I(e))return null;const r=decodeURIComponent(e);return j.has(r)?null:r}function I(e){let r;try{r=decodeURIComponent(e)}catch{return!1}return r.length>0&&r!=="."&&r!==".."&&!/[\\/]/.test(r)}async function T(e,r={}){if(!e.startsWith("intent://"))return!1;const t=W(e);if(!t.valid)return k.error(c.ui_linkHandler_invalidLink_title(),{description:t.error||c.ui_linkHandler_invalidLink_description()}),!0;try{switch(t.type){case"note":case"task":await N(t,r);break;case"file":await b(t,r);break;case"workspace":await C(t.resourceId);break;case"message":{const{openMessage:n}=await p(async()=>{const{openMessage:a}=await import("./BA8yVm-p.js");return{openMessage:a}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34]),import.meta.url);await n({workspaceId:t.workspaceId,agentId:t.agentId,messageId:t.resourceId});break}default:k.error(c.ui_linkHandler_unsupportedLink_title(),{description:c.ui_linkHandler_unsupportedLink_description({type:t.type})})}}catch(n){n instanceof u?k.error(c.ui_linkHandler_notFound_title(),{description:n.message}):k.error(c.ui_linkHandler_navigationFailed_title(),{description:n instanceof Error?n.message:c.ui_linkHandler_unknownError_label()})}return!0}function Z(e,r){return R(e,r)}function $(){return async(e,r,t)=>{const a=t.target.closest("a");return a?.href?.startsWith("intent://")?(t.preventDefault(),await T(a.href)):!1}}async function C(e){const{appClient:r}=await p(async()=>{const{appClient:a}=await import("./CD7PpB6R.js").then(o=>o.o);return{appClient:a}},__vite__mapDeps([3,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2,20,21,22,23]),import.meta.url);if(!await r.workspaces.get(e).catch(()=>null))throw new u(c.workspace_loader_notFound_title());const{openAndShowWorkspace:n}=await p(async()=>{const{openAndShowWorkspace:a}=await import("./9b_Os5fY.js").then(o=>o.s);return{openAndShowWorkspace:a}},__vite__mapDeps([34,7,5,6,8,9,10,11,4,12,13,14,32,33]),import.meta.url);await n(e)}async function N(e,r){const t=r.workspaceId??P.select(d.state)??void 0;if(e.workspaceId){const a=!t||e.workspaceId!==t;if(!await y(e.workspaceId,e.resourceId))throw new u(c.ui_linkHandler_noteNotFound_error({noteId:e.resourceId,workspaceId:e.workspaceId}));if(a){const{openAndShowWorkspace:s}=await p(async()=>{const{openAndShowWorkspace:i}=await import("./9b_Os5fY.js").then(_=>_.s);return{openAndShowWorkspace:i}},__vite__mapDeps([34,7,5,6,8,9,10,11,4,12,13,14,32,33]),import.meta.url);await s(e.workspaceId,{query:{note:e.resourceId}})}else d.dispatch(v(e.workspaceId,e.resourceId,{openInAdjacentPanel:r.openInAdjacentPanel??!1,openInNewAdjacentPanel:r.openInNewAdjacentPanel??!1,sourcePanelId:r.sourcePanelId}));return}if(!t)throw new u(c.ui_linkHandler_noSpaceOpen_error());if(!await y(t,e.resourceId))throw new u(c.ui_linkHandler_noteNotFoundCurrent_error({noteId:e.resourceId}));d.dispatch(v(t,e.resourceId,{openInAdjacentPanel:r.openInAdjacentPanel??!1,openInNewAdjacentPanel:r.openInNewAdjacentPanel??!1,sourcePanelId:r.sourcePanelId}))}async function b(e,r){const t=r.workspaceId??P.select(d.state)??void 0;if(e.workspaceId){const n=!t||e.workspaceId!==t;if(n){const{openAndShowWorkspace:a}=await p(async()=>{const{openAndShowWorkspace:o}=await import("./9b_Os5fY.js").then(s=>s.s);return{openAndShowWorkspace:o}},__vite__mapDeps([34,7,5,6,8,9,10,11,4,12,13,14,32,33]),import.meta.url);if(!await a(e.workspaceId))return}d.dispatch(g(e.workspaceId,e.resourceId,{filePathIsLiteral:!0,...e.line!==void 0?{line:e.line}:{},openInAdjacentPanel:n?!1:r.openInAdjacentPanel??!1,sourcePanelId:n?void 0:r.sourcePanelId}));return}if(!t)throw new u(c.ui_linkHandler_noSpaceOpen_error());d.dispatch(g(t,e.resourceId,{filePathIsLiteral:!0,...e.line!==void 0?{line:e.line}:{},openInAdjacentPanel:r.openInAdjacentPanel??!1,sourcePanelId:r.sourcePanelId}))}async function y(e,r){try{const{backendRequest:t}=await p(async()=>{const{backendRequest:o}=await import("./jhNNYE0v.js").then(s=>s.j);return{backendRequest:o}},__vite__mapDeps([15,4,5,14,10,16,13,17,11,18,19]),import.meta.url),n=await t("note.get",{workspaceId:e,noteId:r}),a=n&&typeof n=="object"&&"note"in n?n.note:n;return a!=null&&typeof a=="object"}catch{return!1}}export{u as NotFoundError,$ as createIntentLinkClickHandler,Z as generateNoteLink,T as handleIntentLink,W as parseIntentLink};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{L as jt,t as Ze}from"./
|
|
1
|
+
import{L as jt,t as Ze}from"./t63qkPWO.js";import{V as Ut}from"./C-pqKaCQ.js";import{bI as Mt,aD as s,aG as zt,bH as Ie,bV as Me,bs as dt,ca as _t,c0 as Ht,a5 as j,bS as u,bl as F,bA as U,b_ as v,bO as l,aw as qt,W as n,bn as pt,c9 as y,aA as T,aB as N,b$ as L,bf as ee,a7 as $,ay as w,be as De,am as Fe,ax as Ee}from"./CJxGDkBm.js";import{t as vt,bo as O,bm as _,bw as ut,b as ct,bs as et,bq as Kt}from"./AeC4KVgG.js";import{i as I}from"./k2awEenT.js";import{s as je,f as Ue,g as Be}from"./DrHJ7oPv.js";import{b as Yt}from"./NtFyWdpR.js";import{A as Gt,c as Vt}from"./BjEuTkmJ.js";import{k as tt}from"./HftJbvyF.js";import{s as at}from"./Dp2nUoTL.js";import{n as se,b as rt,j as ge}from"./DsyH2ZOJ.js";import{F as $t,bn as Jt,aM as Xt,cJ as Qt,cm as Zt}from"./Ci7mS1ie.js";import{m as ea}from"./BbV7MtxC.js";import{f as Le}from"./DJM6amHV.js";import"./jhNNYE0v.js";import"./ChTqQfQN.js";import"./BNODdf6r.js";import"./BkzMrEqG.js";import{q as ta,h as aa,S as ra}from"./DFF9Hi9i.js";import{O as We}from"./-HqAs4SX.js";import{bd as na,D as sa,p as oa}from"./SLOyQ3jf.js";import{d as ia}from"./DvFk8gJm.js";import{s as la,f as da,c as nt}from"./CcWzFbOm.js";function tr(M){let b=0,E=!1;function Q(x){E!==x&&(E=x,M.onDragChange(x))}function Z(){b=0,Q(!1)}function J(x){return M.isEnabled&&!M.isEnabled()?!1:jt(x)}return{handleDragEnter(x){J(x)&&(x.preventDefault(),b++,Q(!0))},handleDragLeave(x){J(x)&&(x.preventDefault(),b=Math.max(0,b-1),b===0&&Q(!1))},handleDragOver(x){J(x)&&x.preventDefault()},handleDrop(x){if(!J(x))return;x.preventDefault(),Z();const G=Ut(x.dataTransfer);(G.files.length>0||G.folderFiles.length>0)&&M.onDrop(G)},reset:Z}}const gt=Symbol("panel-file-drop-context");function ar(){let M=Me(null);const b={register(E){Ie(M,E)},unregister(E){s(M)===E&&Ie(M,null)}};return Mt(gt,b),{context:b,handler:{get current(){return s(M)}}}}function rr(){return zt(gt)??null}var _a=N('<p class="type-caption text-subtle"> </p>'),pa=N('<div class="space-y-1" data-remote-setup-log=""><!> <pre role="log" tabindex="0"> </pre></div>');function va(M,b){if(new.target)return vt({component:va,...M});dt(b,!0);let E=O(b,"machine",7),Q=O(b,"output",7),Z=O(b,"truncated",7,!1);const J=y(()=>Gt({chunks:[{text:Q()??"",timestamp:""}]}).join(`
|
|
2
2
|
`));let x=Me(null),G=!0;function V(){s(x)&&(G=s(x).scrollHeight-s(x).scrollTop-s(x).clientHeight<8)}_t(()=>{s(J),!(!s(x)||!G)&&Ht().then(()=>{s(x)&&(s(x).scrollTop=s(x).scrollHeight)})});var oe={get machine(){return E()},set machine(R){E(R),T()},get output(){return Q()},set output(R){Q(R),T()},get truncated(){return Z()},set truncated(R=!1){Z(R),T()},$set:ut,$on:(R,X)=>ct(b,R,X)},H=pa(),te=j(H);{var ae=R=>{var X=_a(),W=F(X,!0);v(re=>l(W,re),[()=>_.remoteAgent_setup_outputTruncated()]),n(R,X)};I(te,R=>{Z()&&R(ae)})}var K=u(te,2),pe=F(K,!0);return Yt(K,R=>Ie(x,R),()=>s(x)),U(H),v((R,X)=>{je(K,"aria-label",R),Ue(K,1,`max-h-60 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/60 px-3 py-2 font-mono text-xs ${s(J)?"text-foreground":"text-subtle"} focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`),l(pe,X)},[()=>_.remoteAgent_setup_outputLabel({machine:E()}),()=>s(J)||_.remoteAgent_setup_noOutput()]),qt("scroll",K,V),n(M,H),pt(oe)}var ua=N('<span class="inline-flex items-center gap-1.5 svelte-enden2"> </span>'),ca=N('<h3 class="text-lg font-semibold tracking-[-0.016em] transition-colors duration-spring-slow ease-spring-slow motion-reduce:transition-none svelte-enden2"><!></h3>'),ga=N('<span class="inline-block col-span-1 row-span-1 svelte-enden2"> </span>'),fa=N('<span class="text-sm font-mono text-muted-foreground tabular-nums svelte-enden2"><span class="inline-grid *:[grid-area:1/1] svelte-enden2"><!></span> </span>'),ma=N('<div class="absolute inset-0 left-5 svelte-enden2"><!></div>'),st=N('<div class="svelte-enden2"><!></div>'),ba=N('<div class="relative flex items-start overflow-hidden rounded-md py-0.75 text-base leading-relaxed svelte-enden2"><!> <span data-testid="workspace-setup-step-icon"><!></span> <div class="setup-step-content min-w-0 text-muted-foreground font-normal leading-snug relative z-10 svelte-enden2" data-testid="workspace-setup-step-content"><!></div></div>'),xa=N('<div class="mt-1 text-xs tabular-nums svelte-enden2" data-testid="setup-card-progress-transfer"> </div>'),ha=N('<span data-testid="setup-card-progress-label" class="svelte-enden2"> </span> <div class="mt-1 h-[2px] w-full max-w-64 rounded-full bg-secondary overflow-hidden svelte-enden2"><div class="h-full bg-foreground/60 transition-[width] duration-spring-slow ease-spring-slow motion-reduce:transition-none svelte-enden2" role="progressbar" aria-valuemin="0" aria-valuemax="100" data-testid="setup-card-progress-bar"></div></div> <!>',1),fe=N(" <!>",1),Ca=N('<span data-testid="setup-card-plain-folder" class="svelte-enden2"> <!> </span>'),wa=N(' <code class="text-sm bg-secondary py-1 px-1.5 svelte-enden2"> </code> <!>',1),ot=N(" <!> <!>",1),Sa=N(' <span class="svelte-enden2"> </span> ',1),ya=N(' <span class="svelte-enden2"> </span> <!>',1),ka=N('<span class="underline underline-offset-2 svelte-enden2"> </span><span class="whitespace-nowrap svelte-enden2"><span class="underline underline-offset-2 svelte-enden2"> </span><span class="setup-reference-punctuation svelte-enden2" aria-hidden="true"> </span></span>',1),Pa=N("<!> ",1),it=N('<span class="svelte-enden2"> </span>'),_e=N(" <!> ",1),Da=N('<pre class="text-xs text-muted-foreground font-mono leading-snug line-clamp-2 whitespace-pre-wrap svelte-enden2"> </pre>'),lt=N('<span class="text-xs text-muted-foreground opacity-50 svelte-enden2"> </span>'),Ia=N(" <!> <!> ",1),Na=N('<p class="text-xs text-muted-foreground leading-snug svelte-enden2"> </p>'),Ta=N('<div><div class="flex items-baseline gap-2.5 pt-3 pb-2 svelte-enden2"><div class="inline-grid *:[grid-area:1/1] svelte-enden2"><!></div> <!></div> <div class="space-y-0.5 pb-4 svelte-enden2"><!> <!> <!> <!></div></div>');function Oa(M,b){if(new.target)return vt({component:Oa,...M});dt(b,!0);const E=()=>et(ft,"$progressEntry$",Z),Q=()=>et(mt,"$specialists$",Z),[Z,J]=Kt();let x=O(b,"repoName",7),G=O(b,"repoPath",7),V=O(b,"worktreePath",7),oe=O(b,"workspaceId",7),H=O(b,"branch",7),te=O(b,"baseRef",7,"origin/main"),ae=O(b,"projectType",7),K=O(b,"setupScriptStatus",7),pe=O(b,"setupScriptContent",7),R=O(b,"onFocusSetupTerminal",7),X=O(b,"specialistName",7),W=O(b,"specialistId",7),re=O(b,"hasPrompt",7,!0),ve=O(b,"repoStatus",7,"pending"),me=O(b,"branchStatus",7,"pending"),be=O(b,"agentStatus",7,"pending"),ie=O(b,"skipIsolation",7,!1),ue=O(b,"plainFolder",7,!1),Ne=O(b,"progressId",7);const ft=la(Ne()??""),mt=na();let xe=Me(0);_t(()=>{const d=Math.min(E()?.percent??0,100);d>s(xe)&&Ie(xe,d,!0)});const bt=y(()=>E()?.sawFrame===!0),ze=y(()=>E()?.transfer?Vt(E().transfer):null),xt=y(()=>te().replace(/^[^/]+\//,"")),Te=y(()=>W()?oa(W()):void 0),ht=y(()=>W()?Q().find(d=>d.id===W()):void 0),Ct=y(()=>s(ht)?.name||s(Te)?.name||X()),He=y(()=>W()==="spec-writer"||W()===sa),qe=y(()=>{const d=ue()?[ve()]:[ve(),me()];return K()&&d.push(K()),d.push(be()),d}),Oe=y(()=>s(qe).length),Ke=y(()=>s(qe).filter(d=>d==="done").length),Ye=y(()=>Math.min(s(Ke)+1,s(Oe))),ye=y(()=>s(Ke)===s(Oe)),Ge=y(()=>s(ye)?_.onboarding_setupCard_ready_title():_.onboarding_setupCard_settingUp_title());function wt(d,B){navigator.clipboard.writeText(d),ea.success(_.onboarding_setupCard_copied_label({label:B}))}function Ae(d){return d.replace(/^\/Users\/[^/]+/,"~")}function St(){W()&&ia({specialist:W(),hash:"specialists"})}var yt={get repoName(){return x()},set repoName(d){x(d),T()},get repoPath(){return G()},set repoPath(d){G(d),T()},get worktreePath(){return V()},set worktreePath(d){V(d),T()},get workspaceId(){return oe()},set workspaceId(d){oe(d),T()},get branch(){return H()},set branch(d){H(d),T()},get baseRef(){return te()},set baseRef(d="origin/main"){te(d),T()},get projectType(){return ae()},set projectType(d){ae(d),T()},get setupScriptStatus(){return K()},set setupScriptStatus(d){K(d),T()},get setupScriptContent(){return pe()},set setupScriptContent(d){pe(d),T()},get onFocusSetupTerminal(){return R()},set onFocusSetupTerminal(d){R(d),T()},get specialistName(){return X()},set specialistName(d){X(d),T()},get specialistId(){return W()},set specialistId(d){W(d),T()},get hasPrompt(){return re()},set hasPrompt(d=!0){re(d),T()},get repoStatus(){return ve()},set repoStatus(d="pending"){ve(d),T()},get branchStatus(){return me()},set branchStatus(d="pending"){me(d),T()},get agentStatus(){return be()},set agentStatus(d="pending"){be(d),T()},get skipIsolation(){return ie()},set skipIsolation(d=!1){ie(d),T()},get plainFolder(){return ue()},set plainFolder(d=!1){ue(d),T()},get progressId(){return Ne()},set progressId(d){Ne(d),T()},$set:ut,$on:(d,B)=>ct(b,d,B)},ke=Ta(),Pe=j(ke);Be(Pe,"",{},{"padding-inline":"var(--operational-row-inline-padding)"});var Re=j(Pe),kt=j(Re);tt(kt,()=>s(ye),d=>{var B=ca(),le=j(B);{var he=Y=>{var z=ua(),we=F(z,!0);v(()=>l(we,s(Ge))),n(Y,z)},Ce=Y=>{var z=L();v(()=>l(z,s(Ge))),n(Y,z)};I(le,Y=>{s(ye)?Y(he):Y(Ce,-1)})}U(B),se(1,B,()=>rt,()=>({tier:"slow",distance:3})),se(2,B,()=>rt,()=>({tier:"slow",distance:3})),n(d,B)}),U(Re);var Pt=u(Re,2);{var Dt=d=>{var B=fa(),le=j(B),he=j(le);tt(he,()=>s(Ye),Y=>{var z=ga(),we=F(z,!0);v(()=>l(we,s(Ye))),se(1,z,()=>ge,()=>({axis:"y",tier:"slow"})),n(Y,z)}),U(le);var Ce=u(le);U(B),v(()=>l(Ce,`/${s(Oe)??""}`)),n(d,B)};I(Pt,d=>{s(ye)||d(Dt)})}U(Pe);var Ve=u(Pe,2);{const d=(f,h=ee,P=ee,D=ee,S=ee,C=ee)=>{var o=ba();Be(o,"",{},{gap:"0.25rem","padding-inline":"var(--operational-row-inline-padding)"});var t=j(o);{var e=m=>{var k=ma(),A=j(k);ra(A,{}),U(k),n(m,k)};I(t,m=>{h()==="active"&&m(e)})}var a=u(t,2),r=j(a);$t(r,{get icon(){return P()},size:14,get class(){return D()}}),U(a);var i=u(a,2),c=j(i);{var g=m=>{var k=st(),A=j(k);at(A,S),U(k),se(1,k,()=>ge,()=>({axis:"y",tier:"moderate"})),se(2,k,()=>ge,()=>({axis:"y",tier:"moderate"})),n(m,k)},p=m=>{var k=st(),A=j(k);at(A,C),U(k),se(1,k,()=>ge,()=>({axis:"y",tier:"moderate"})),se(2,k,()=>ge,()=>({axis:"y",tier:"moderate"})),n(m,k)};I(c,m=>{h()==="active"?m(g):m(p,-1)})}U(i),U(o),v(()=>Ue(a,1,`${aa} relative z-10 mt-1 flex size-4 shrink-0 items-center justify-start`,"svelte-enden2")),se(3,o,()=>ge,()=>({tier:"slow"})),n(f,o)},B=(f,h)=>{let P=Fe(()=>Ee(h?.(),""));var D=$(),S=w(D);{var C=t=>{{let e=y(()=>_.onboarding_setupCard_originalFolder_label());z(t,x,()=>s(e),G,()=>s(P))}},o=t=>{var e=L();v(()=>l(e,`${x()??""}${s(P)??""}`)),n(t,e)};I(S,t=>{G()?t(C):t(o,-1)})}n(f,D)},le=f=>{var h=$(),P=w(h);{var D=o=>{var t=ha(),e=w(t),a=F(e,!0),r=u(e,2),i=F(r),c=u(r,2);{var g=p=>{var m=xa(),k=F(m,!0);v(()=>l(k,s(ze))),n(p,m)};I(c,p=>{s(ze)&&p(g)})}v((p,m)=>{l(a,p),Be(i,`width: ${s(xe)??""}%`),je(i,"aria-label",m),je(i,"aria-valuenow",s(xe))},[()=>_.workspace_compactInitializer_progressWithPercent_label({label:nt(E()),percent:da(s(xe))}),()=>nt(E())]),n(o,t)},S=o=>{var t=fe(),e=w(t),a=u(e);{let r=y(()=>_.onboarding_setupCard_opening_after());B(a,()=>s(r))}v(r=>l(e,`${r??""} `),[()=>_.onboarding_setupCard_opening_before()]),n(o,t)},C=o=>{var t=fe(),e=w(t),a=u(e);B(a),v(r=>l(e,`${r??""} `),[()=>_.onboarding_setupCard_creatingIsolatedCopy_before()]),n(o,t)};I(P,o=>{s(bt)&&E()?o(D):ie()||ue()?o(S,1):o(C,-1)})}n(f,h)},he=f=>{var h=$(),P=w(h);{var D=o=>{const t=y(()=>V()||G());var e=Ca(),a=j(e),r=u(a);{var i=p=>{We(p,{get filePath(){return s(t)},get workspaceId(){return oe()},isDirectory:!0,variant:"sidebar",compact:!0,inline:!0,class:"setup-path",children:(m,k)=>{{let A=y(()=>Ae(s(t)));Y(m,()=>s(A),()=>".")}},$$slots:{default:!0}})},c=p=>{var m=L();v(()=>l(m,`${x()??""}.`)),n(p,m)};I(r,p=>{s(t)?p(i):p(c,-1)})}var g=u(r);U(e),v((p,m)=>{l(a,`${p??""} `),l(g,` ${m??""}`)},[()=>_.onboarding_setupCard_workingInFolder_before(),()=>_.onboarding_setupCard_plainFolderInPlace_label()]),n(o,e)},S=o=>{var t=wa(),e=w(t),a=u(e),r=F(a,!0),i=u(a,2);{var c=p=>{var m=fe(),k=w(m),A=u(k);We(A,{get filePath(){return V()},get workspaceId(){return oe()},isDirectory:!0,variant:"sidebar",compact:!0,inline:!0,class:"setup-path",children:(q,de)=>{{let ne=y(()=>Ae(V()));Y(q,()=>s(ne),()=>".")}},$$slots:{default:!0}}),v(q=>l(k,` ${q??""} `),[()=>_.onboarding_setupCard_at_label()]),n(p,m)},g=p=>{var m=L(".");n(p,m)};I(i,p=>{V()?p(c):p(g,-1)})}v(p=>{l(e,`${p??""} `),l(r,s(xt))},[()=>_.onboarding_setupCard_workingDirectlyOn_before()]),n(o,t)},C=o=>{var t=ot(),e=w(t),a=u(e);B(a);var r=u(a,2);{var i=g=>{var p=fe(),m=w(p),k=u(m);We(k,{get filePath(){return V()},get workspaceId(){return oe()},isDirectory:!0,variant:"sidebar",compact:!0,inline:!0,class:"setup-path",children:(A,q)=>{{let de=y(()=>Ae(V()));Y(A,()=>s(de),()=>".")}},$$slots:{default:!0}}),v(A=>l(m,` ${A??""} `),[()=>_.onboarding_setupCard_at_label()]),n(g,p)},c=g=>{var p=L(".");n(g,p)};I(r,g=>{V()?g(i):g(c,-1)})}v(g=>l(e,`${g??""} `),[()=>_.onboarding_setupCard_createdIsolatedCopy_before()]),n(o,t)};I(P,o=>{ue()?o(D):ie()?o(S,1):o(C,-1)})}n(f,h)},Ce=f=>{var h=$(),P=w(h);{var D=o=>{var t=$(),e=w(t);{var a=i=>{var c=Sa(),g=w(c),p=u(g),m=F(p,!0),k=u(p,1,!0);v((A,q)=>{l(g,`${A??""} `),l(m,H()),l(k,q)},[()=>_.onboarding_setupCard_workingOnBranchNamed_before(),()=>_.onboarding_setupCard_workingOnBranchActive_after()]),n(i,c)},r=i=>{var c=L();v(g=>l(c,g),[()=>_.onboarding_setupCard_workingOnBranch_label()]),n(i,c)};I(e,i=>{H()?i(a):i(r,-1)})}n(o,t)},S=o=>{var t=ya(),e=w(t),a=u(e),r=F(a,!0),i=u(a),c=u(i);{let g=y(()=>_.onboarding_setupCard_baseRef_label()),p=y(()=>_.onboarding_setupCard_creatingBranch_after());z(c,te,()=>s(g),()=>{},()=>s(p))}v((g,p)=>{l(e,`${g??""} `),l(r,H()),l(i,` ${p??""} `)},[()=>_.onboarding_setupCard_creatingBranch_before(),()=>_.onboarding_setupCard_creatingBranch_middle()]),n(o,t)},C=o=>{var t=L();v(e=>l(t,e),[()=>_.onboarding_setupCard_creatingBranchNoName_label()]),n(o,t)};I(P,o=>{ie()?o(D):H()?o(S,1):o(C,-1)})}n(f,h)},Y=(f,h=ee,P)=>{let D=Fe(()=>Ee(P?.(),""));const S=y(()=>Array.from(h()));var C=ka(),o=w(C),t=F(o,!0),e=u(o),a=j(e),r=F(a,!0),i=u(a),c=F(i,!0);U(e),v((g,p)=>{l(t,g),l(r,p),l(c,s(D))},[()=>s(S).slice(0,-1).join(""),()=>s(S).at(-1)??""]),n(f,C)},z=(f,h=ee,P=ee,D=ee,S)=>{let C=Fe(()=>Ee(S?.(),""));const o=y(()=>s(C).match(/^\p{P}+/u)?.[0]??"");var t=Pa(),e=w(t);Le(e,{variant:"plain",wrapContent:!1,class:"setup-inline-link cursor-pointer hover:text-foreground transition-colors",onclick:()=>wt(D()??h(),P()),children:(r,i)=>{Y(r,h,()=>s(o))},$$slots:{default:!0}});var a=u(e,1,!0);v(r=>l(a,r),[()=>s(C).slice(s(o).length)]),n(f,t)},we=f=>{var h=$(),P=w(h);{var D=o=>{var t=$(),e=w(t);{var a=i=>{var c=fe(),g=w(c),p=u(g);{let m=y(()=>_.onboarding_setupCard_branchName_label()),k=y(()=>_.onboarding_setupCard_workingOnBranchDone_after());z(p,H,()=>s(m),()=>{},()=>s(k))}v(m=>l(g,`${m??""} `),[()=>_.onboarding_setupCard_workingOnBranchNamed_before()]),n(i,c)},r=i=>{var c=L();v(g=>l(c,g),[()=>_.onboarding_setupCard_workingDirectlyOnBranch_label()]),n(i,c)};I(e,i=>{H()?i(a):i(r,-1)})}n(o,t)},S=o=>{var t=ot(),e=w(t),a=u(e);{let i=y(()=>_.onboarding_setupCard_branchName_label()),c=y(()=>_.onboarding_setupCard_workingInNewBranch_middle());z(a,H,()=>s(i),()=>{},()=>s(c))}var r=u(a,2);{let i=y(()=>_.onboarding_setupCard_baseRef_label()),c=y(()=>_.onboarding_setupCard_workingInNewBranch_after());z(r,te,()=>s(i),()=>{},()=>s(c))}v(i=>l(e,`${i??""} `),[()=>_.onboarding_setupCard_workingInNewBranch_before()]),n(o,t)},C=o=>{var t=L();v(e=>l(t,e),[()=>_.onboarding_setupCard_branchCreated_label()]),n(o,t)};I(P,o=>{ie()?o(D):H()?o(S,1):o(C,-1)})}n(f,h)},Ft=f=>{De();var h=_e(),P=w(h),D=u(P);{var S=t=>{var e=it(),a=F(e,!0);v(()=>l(a,ae())),n(t,e)},C=t=>{var e=L();v(a=>l(e,a),[()=>_.onboarding_setupCard_project_label()]),n(t,e)};I(D,t=>{ae()?t(S):t(C,-1)})}var o=u(D);v((t,e)=>{l(P,`${t??""} `),l(o,` ${e??""}`)},[()=>_.onboarding_setupCard_runningSetup_before(),()=>_.onboarding_setupCard_runningSetup_after()]),n(f,h)},Et=f=>{De();var h=Ia(),P=w(h),D=u(P);{var S=r=>{var i=it(),c=F(i,!0);v(()=>l(c,ae())),n(r,i)},C=r=>{var i=L();v(c=>l(i,c),[()=>_.onboarding_setupCard_project_label()]),n(r,i)};I(D,r=>{ae()?r(S):r(C,-1)})}var o=u(D),t=u(o);{var e=r=>{var i=fe(),c=w(i),g=u(c);Ze(g,{class:"inline",side:"bottom",align:"start",interactive:!0,maxWidth:"22rem",delayDuration:300,trigger:A=>{Le(A,{variant:"plain",wrapContent:!1,class:"setup-inline-link underline underline-offset-2 cursor-pointer hover:text-foreground transition-colors",get onclick(){return R()},children:(q,de)=>{De();var ne=L();v(Se=>l(ne,Se),[()=>_.onboarding_setupCard_terminalTab_label()]),n(q,ne)},$$slots:{default:!0}})},content:A=>{var q=$(),de=w(q);{var ne=Se=>{var Qe=Da(),Wt=F(Qe,!0);v(()=>l(Wt,pe())),n(Se,Qe)};I(de,Se=>{pe()&&Se(ne)})}n(A,q)},footer:A=>{var q=lt(),de=F(q,!0);v(ne=>l(de,ne),[()=>_.onboarding_setupCard_openTerminal_footer()]),n(A,q)},$$slots:{trigger:!0,content:!0,footer:!0}}),v(p=>l(c,` ${p??""} `),[()=>_.onboarding_setupCard_ranSetupIn_middle()]),n(r,i)};I(t,r=>{R()&&r(e)})}var a=u(t,1,!0);v((r,i,c)=>{l(P,`${r??""} `),l(o,` ${i??""}`),l(a,c)},[()=>_.onboarding_setupCard_ranSetup_before(),()=>_.onboarding_setupCard_ranSetup_middle(),()=>_.onboarding_setupCard_ranSetup_after()]),n(f,h)},ce=f=>{Ze(f,{class:"inline",side:"bottom",align:"start",interactive:!0,maxWidth:"22rem",delayDuration:300,trigger:S=>{Le(S,{variant:"plain",wrapContent:!1,class:"setup-inline-link underline underline-offset-2 cursor-pointer hover:text-foreground transition-colors",onclick:St,children:(C,o)=>{De();var t=L();v(()=>l(t,s(Ct))),n(C,t)},$$slots:{default:!0}})},content:S=>{var C=$(),o=w(C);{var t=e=>{var a=Na(),r=F(a,!0);v(()=>l(r,s(Te).description)),n(e,a)};I(o,e=>{s(Te)&&e(t)})}n(S,C)},footer:S=>{var C=lt(),o=F(C,!0);v(t=>l(o,t),[()=>_.onboarding_setupCard_editInSettings_footer()]),n(S,C)},$$slots:{trigger:!0,content:!0,footer:!0}})},Bt=f=>{var h=$(),P=w(h);{var D=e=>{var a=_e(),r=w(a),i=u(r);ce(i);var c=u(i);v((g,p)=>{l(r,`${g??""} `),l(c,` ${p??""}`)},[()=>_.onboarding_setupCard_agentReadyNamed_before(),()=>_.onboarding_setupCard_agentReadyNamed_after()]),n(e,a)},S=e=>{var a=L();v(r=>l(a,r),[()=>_.onboarding_setupCard_agentReady_label()]),n(e,a)},C=e=>{var a=_e(),r=w(a),i=u(r);ce(i);var c=u(i);v((g,p)=>{l(r,`${g??""} `),l(c,` ${p??""}`)},[()=>_.onboarding_setupCard_specStartingUp_before(),()=>_.onboarding_setupCard_specStartingUp_after()]),n(e,a)},o=e=>{var a=_e(),r=w(a),i=u(r);ce(i);var c=u(i);v((g,p)=>{l(r,`${g??""} `),l(c,` ${p??""}`)},[()=>_.onboarding_setupCard_startingUpNamed_before(),()=>_.onboarding_setupCard_startingUpNamed_after()]),n(e,a)},t=e=>{var a=L();v(r=>l(a,r),[()=>_.onboarding_setupCard_startingUp_label()]),n(e,a)};I(P,e=>{!re()&&W()?e(D):re()?s(He)?e(C,2):W()?e(o,3):e(t,-1):e(S,1)})}n(f,h)},Lt=f=>{var h=$(),P=w(h);{var D=e=>{var a=_e(),r=w(a),i=u(r);ce(i);var c=u(i);v((g,p)=>{l(r,`${g??""} `),l(c,` ${p??""}`)},[()=>_.onboarding_setupCard_agentReadyNamed_before(),()=>_.onboarding_setupCard_agentReadyNamed_after()]),n(e,a)},S=e=>{var a=L();v(r=>l(a,r),[()=>_.onboarding_setupCard_agentReady_label()]),n(e,a)},C=e=>{var a=_e(),r=w(a),i=u(r);ce(i);var c=u(i);v((g,p)=>{l(r,`${g??""} `),l(c,` ${p??""}`)},[()=>_.onboarding_setupCard_specDone_before(),()=>_.onboarding_setupCard_specDone_after()]),n(e,a)},o=e=>{var a=_e(),r=w(a),i=u(r);ce(i);var c=u(i);v((g,p)=>{l(r,`${g??""} `),l(c,` ${p??""}`)},[()=>_.onboarding_setupCard_agentDoneNamed_before(),()=>_.onboarding_setupCard_agentDoneNamed_after()]),n(e,a)},t=e=>{var a=L();v(r=>l(a,r),[()=>_.onboarding_setupCard_agentOrienting_label()]),n(e,a)};I(P,e=>{!re()&&W()?e(D):re()?s(He)?e(C,2):W()?e(o,3):e(t,-1):e(S,1)})}n(f,h)};var $e=j(Ve);{var It=f=>{d(f,ve,()=>Jt,()=>"-ml-px transform scale-[0.98]",()=>le,()=>he)};I($e,f=>{ve()!=="pending"&&f(It)})}var Je=u($e,2);{var Nt=f=>{d(f,me,()=>Xt,()=>"",()=>Ce,()=>we)};I(Je,f=>{me()!=="pending"&&!ie()&&!ue()&&f(Nt)})}var Xe=u(Je,2);{var Tt=f=>{d(f,K,()=>Qt,()=>"ml-[0.5px]",()=>Ft,()=>Et)};I(Xe,f=>{K()&&K()!=="pending"&&f(Tt)})}var Ot=u(Xe,2);{var At=f=>{d(f,be,()=>Zt,()=>"ml-[-0.5px]",()=>Bt,()=>Lt)};I(Ot,f=>{be()!=="pending"&&f(At)})}U(Ve)}U(ke),v(()=>Ue(ke,1,`${ta} w-full overflow-hidden transition-all duration-spring-slow ease-spring-slow motion-reduce:transition-none`,"svelte-enden2")),n(M,ke);var Rt=pt(yt);return J(),Rt}export{va as R,Oa as W,ar as a,tr as c,rr as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as t}from"./YqTahsxp.js";import{IX as r}from"./BkzMrEqG.js";import{aH as o}from"./
|
|
1
|
+
import{g as t}from"./YqTahsxp.js";import{IX as r}from"./BkzMrEqG.js";import{aH as o}from"./CWVUBnHm.js";function l(e){return!e||t().status!=="connected"?null:o.select(r.state,e)}export{l as resolveConnectedWorkspaceKeySlot};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bn as h,e as p}from"./BkzMrEqG.js";import{S as b,U as g}from"./
|
|
1
|
+
import{bn as h,e as p}from"./BkzMrEqG.js";import{S as b,U as g}from"./KEUh5hD5.js";import{h as c}from"./PVXvIyE8.js";function k(e){switch(e?.state){case"pending":return{phase:"preparing"};case"running":return{phase:"runningSetup"};case"failed":{const t=e.error?.startsWith("node-setup-timeout")===!0;return e.exitCode===void 0&&!e.startedAt&&!t?{phase:"openFailed",error:e.error?.trim()||null}:{phase:"setupFailed",exitCode:e.exitCode??null,timedOut:t,error:e.exitCode===void 0&&!t&&e.error?.trim()||null}}default:return null}}function w(e){switch(e){case"attached":return"attached";case"detached":return"detached";case"moving":return"moving";case"starting":return"starting";default:return"unknown"}}function l(e){const t=e?.home;if(!t)return null;const n=w(t.state),o=n==="starting",a=n==="detached"||n==="moving",i=n==="attached"?k(t.setup):null,m=i?i.phase==="openFailed"||i.phase==="setupFailed"?"setupFailed":"opening":null,f=n==="attached"?m??(t.backupWarning===!0?"backupWarning":null):a?n:null;return{name:t.name,state:t.state,starting:o,unknownState:n==="unknown",unavailable:n!=="attached",lastBackupAt:t.lastBackupAt??null,banner:f,marker:a?n:null,canWait:n==="detached",canMove:n!=="moving",moveWarning:n==="detached",setup:i}}const I=12e3,v={workspaceId:null,generation:0,usableSince:null,waited:!1};function B(e,t){if(!t.loaded)return e;const n=e.workspaceId===t.workspaceId?e:{...v,workspaceId:t.workspaceId,generation:e.generation};return t.unavailable?n.waited?n:n.usableSince===null||t.now-n.usableSince<=I?{...n,usableSince:null,waited:!0}:n:n.waited?{...n,generation:t.contentLoaded?n.generation:n.generation+1,usableSince:t.now,waited:!1}:n.usableSince===null?{...n,usableSince:t.now}:n}const r="agent:",s="machine:",d="cloud:";function u(e){return"agentId"in e?`${r}${e.agentId}`:e.kind==="machine"?`${s}${e.nodeId}`:`${d}${e.cloudMachineId}`}function R(e){const t=n=>e.startsWith(n)?e.slice(n.length):"";return t(r)?{agentId:t(r)}:t(s)?{kind:"machine",nodeId:t(s)}:t(d)?{kind:"cloud",cloudMachineId:t(d)}:null}function S(e){return!e.nodeId||e.placementError||e.status===p.Deleted||e.retiredAt?!1:e.nodeState===void 0||e.nodeState==="ready"}function O({agents:e,machineRows:t}){const n=e.filter(S).map(a=>({key:u({agentId:String(a.id)}),kind:"agent",label:a.name,machineName:a.nodeName?.trim()||void 0,nodeId:a.nodeId,platform:null,disabled:!1})),o=t.filter(a=>a.id!==b).map(a=>{const i=g(a.id);return{key:u(i?{kind:"cloud",cloudMachineId:i}:{kind:"machine",nodeId:a.id}),kind:i?"cloud":"machine",label:a.label,platform:a.platform,disabled:a.disabled,...a.reason?{reason:a.reason}:{}}});return[...n,...o]}const E=new Set(["homes-unsupported","home-moving","home-target-unavailable","machine-update-required"]);function _(e){if(!e||typeof e!="object")return null;const{rpcCode:t,data:n}=e;if(t===-32003)return"forbidden";const o=n?.code;return typeof o=="string"&&E.has(o)?o:null}function C(e){if(!e||typeof e!="object")return null;const{rpcCode:t,data:n}=e;if(t!==-32603||!n||typeof n!="object")return null;const o=n;return o.code!=="home-unavailable"?null:{name:typeof o.name=="string"?o.name:"",lastBackupAt:typeof o.lastBackupAt=="string"?o.lastBackupAt:null,state:o.starting===!0?"starting":o.moving===!0?"moving":"detached"}}function H(e){const t={homeId:"",name:e.name,state:e.state,since:"",...e.lastBackupAt?{lastBackupAt:e.lastBackupAt}:{}};return{...l({home:t}),canWait:!1}}const T=new Set(["file","diff","terminal","changes","local-changes","code-review","chat-changes","activity-changes"]);function A(e){return T.has(e)}function F(e){return e.type==="terminal"&&e.scriptId?!1:A(e.type)}function q(e,t){return t&&e?.status!==h.Retired&&l(e)?.canMove===!0}const N=c("tabWindow/openTabInOwnWindowRequested"),D=c("tabWindow/moveTabBackRequested"),$=c("tabWindow/closeTabWindowTabRequested");export{u as a,C as b,$ as c,F as d,O as e,D as f,H as h,v as i,q as m,B as n,N as o,R as p,_ as s,l as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IX as o,m6 as C,nK as E,no as L,J0 as W}from"./BkzMrEqG.js";import{w as z}from"./PVXvIyE8.js";import{
|
|
1
|
+
import{IX as o,m6 as C,nK as E,no as L,J0 as W}from"./BkzMrEqG.js";import{w as z}from"./PVXvIyE8.js";import{dD as H,dH as f}from"./-5BGDZDk.js";const a=o.createSelector((t,e)=>t.fileExplorer.byWorkspaceId[e]??C),G=o.createSelector((t,e,s)=>{const n=E(t.fileExplorer.searches,s);return n?.workspaceId===e?n:void 0}),K=o.createSelector((t,e)=>{const s=a.select(t,e);return s.rootPath?E(s.nodes,s.rootPath)??null:null}),M=o.createSelector((t,e)=>a.select(t,e).nodes.map),R=o.createSelector((t,e)=>a.select(t,e).isLoading),q=o.createSelector((t,e)=>a.select(t,e).isInitialized),B=o.createSelector((t,e)=>a.select(t,e).error),J=o.createSelector((t,e)=>a.select(t,e).fileCount),O=o.createSelector((t,e)=>a.select(t,e).gitStatus),g=o.createSelector((t,e)=>{const s=H.select(t,e);return s?.worktreePath||s?.repositoryPath||s?.path||""}),V=o.createSelector((t,e)=>{const s=a.select(t,e);return{workspacePath:g.select(t,e),currentWorkspacePath:s.workspacePath,isLoading:s.isLoading,isInitialized:s.isInitialized}});o.createSelector((t,e)=>e?{wsId:e,workspacePath:g.select(t,e),workspaceEnvironmentConfig:f.select(t,e)}:{wsId:null,workspacePath:"",workspaceEnvironmentConfig:void 0});const X=o.createSelector((t,e,s)=>a.select(t,e).expandedPaths.includes(s)),A=o.createSelector((t,e,s)=>a.select(t,e).loadingPaths.includes(s)),Q=o.createSelector((t,e)=>{const s=a.select(t,e);return s.expandedPaths.some(n=>n!==s.workspacePath)}),T=o.createSelector((t,e)=>{const s=g.select(t,e);if(!s)return!1;const n=a.select(t,e),p=f.select(t,e);return n.workspacePath!==s?!0:n.isLoading?!1:n.isInitialized?p?.type==="remote"&&!n.isRemoteInitialized:!0}),F=new WeakMap,U=o.createSelector((t,e)=>{const s=a.select(t,e);if(!s.rootPath)return[];const n=E(s.nodes,s.rootPath);if(!n)return[];const p=new Set(s.expandedPaths),y=new Set(s.loadingPaths),I=L(s.nodes,n.children,p,y),{agentFileEdits:v,workspacePath:P,gitStatus:S}=s,x=new Set;for(const r of Object.keys(S)){const i=r.split("/");for(let l=1;l<i.length;l++)x.add(i.slice(0,l).join("/"))}return I.map(r=>{let i=r.node.path;if(P){const w=W(r.node.path,P);w!==r.node.path&&(i=w)}const l=r.node.type==="file",c=v[i],d=l?S[i]:void 0,h=!l&&x.has(i),k={isExpanded:r.isExpanded,isLoading:r.isLoading,agentEdits:c&&c.length>0?c:void 0,gitStatus:d,directoryHasChanges:h,displayPath:r.displayPath,compactedExpandedPathsKey:r.compactedExpandedPaths?.join("\0"),depth:r.depth},u=F.get(r.node);if(u&&z(u.inputs,k))return u.result;const m=c&&c.length>0||d!==void 0||h?{node:r.node,depth:r.depth,displayPath:r.displayPath,...r.compactedExpandedPaths?{compactedExpandedPaths:r.compactedExpandedPaths}:{},isExpanded:r.isExpanded,isLoading:r.isLoading,...c&&c.length>0?{agentEdits:c}:{},...d!==void 0?{gitStatus:d}:{},...h?{directoryHasChanges:!0}:{}}:r;return F.set(r.node,{inputs:k,result:m}),m})});export{B as a,J as b,O as c,V as d,q as e,R as f,M as g,K as h,G as i,a as j,U as k,Q as l,X as m,A as n,T as o,g as s};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{I as W}from"./
|
|
1
|
+
import{I as W}from"./BCfq8Fz_.js";import{p as X}from"./BQQo4uEb.js";import{b0 as z,a_ as G,aZ as Y,Y as P,U as F,V as Z,b as g,q as N,ay as A,aX as q,B as U,W as E,r as j,aV as J,a0 as K,O as Q,aO as ee}from"./BrNYPcY3.js";import{p as te}from"./CfNfee-Y.js";var L=/[─━│┃└┗├┣]/,D=/[└┗├┣]/,ne=/[─━]/,V=/^[\s│┃]+$/,T=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,$=/^\s*%%/,re=" ";function _(n){return n.some(t=>L.test(t))}g(_,"isBoxDrawingFormat");function M(n){for(const t of n){const e=D.exec(t);if(e?.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function S(n,t){return n.replace(/\bline\s+(\d+)\b/gi,(e,r)=>{const s=parseInt(r,10),i=t.get(s);return i?`line ${i}`:e})}g(S,"remapErrorLines");function R(n){const t=n.split(`
|
|
2
2
|
`),e=new Map;let r=-1;for(const[p,c]of t.entries())if(c.trim()==="treeView-beta"){r=p;break}if(r===-1)return{text:n,lineMap:e};const s=[];for(let p=r+1;p<t.length;p++){const c=t[p];c.trim()===""||$.test(c)||T.test(c)||V.test(c)||s.push(c.replace(/\t/g," "))}if(!_(s))return{text:n,lineMap:e};const i=M(s),o=[];let a=0;for(let p=0;p<=r;p++)o.push(t[p]),a++,e.set(a,p+1);for(let p=r+1;p<t.length;p++){const c=t[p],d=c.trim(),h=p+1;if(d===""){o.push(c),a++,e.set(a,h);continue}if($.test(c)){o.push(c),a++,e.set(a,h);continue}if(T.test(c)){o.push(c),a++,e.set(a,h);continue}if(V.test(c))continue;const l=c.replace(/\t/g," "),w=D.exec(l);if(w?.index!==void 0){const f=w.index,m=Math.round(f/i)+1;let u=f+1;for(;u<l.length&&ne.test(l[u]);)u++;for(;u<l.length&&l[u]===" ";)u++;const v=l.slice(u).trimEnd();if(!v)throw new Error(`Line ${h}: Empty node — expected a filename or directory name after the box-drawing prefix`);const O=re.repeat(m);o.push(O+v),a++,e.set(a,h)}else{if(/^[\s─━│┃└┗├┣]+$/.test(l))continue;if(L.test(l))o.push(c),a++,e.set(a,h);else{if(/^\s+/.test(l))throw new Error(`Line ${h}: Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.`);o.push(c),a++,e.set(a,h)}}}return{text:o.join(`
|
|
3
3
|
`),lineMap:e}}g(R,"preprocessBoxDrawing");var x=new W(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),ie=g(()=>{x.reset(),j()},"clear"),oe=g(()=>x.records.stack[0],"getRoot"),se=g(()=>x.records.cnt,"getCount"),ae=Q.treeView,ce=g(()=>N(ae,E().treeView),"getConfig"),le=g((n,t,e,r,s,i)=>{for(;n<=x.records.stack[x.records.stack.length-1].level;)x.records.stack.pop();const o={id:x.records.cnt++,level:n,name:t,nodeType:e,icon:s,cssClass:r,description:i,children:[]};x.records.stack[x.records.stack.length-1].children.push(o),x.records.stack.push(o)},"addNode"),de={clear:ie,addNode:le,getRoot:oe,getCount:se,getConfig:ce,getAccTitle:Z,getAccDescription:F,getDiagramTitle:P,setAccDescription:Y,setAccTitle:G,setDiagramTitle:z},I=de,he=g(n=>{X(n,I);for(const t of n.nodes){const e=typeof t.indent=="number"?t.indent:0;let r=t.name;const s=r.endsWith("/");s&&(r=r.slice(0,-1));const i=s?"directory":"file",o=t.classAnnotation||void 0,a=t.iconAnnotation,p=a!==void 0?a||"none":void 0,c=t.descAnnotation||void 0,d=c?J(c,E()):void 0;I.addNode(e,r,i,o,p,d)}},"populate"),pe={parse:g(async n=>{const{text:t,lineMap:e}=R(n);try{const r=await te("treeView",t);A.debug(r),he(r)}catch(r){throw e.size>0&&r instanceof Error&&(r.message=S(r.message,e)),r}},"parse")},b={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:'<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>'},file:{body:'<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>'}}};function H(n,t){const e=t?.filenameIcons?.[n];if(e)return e;const r=n.lastIndexOf(".");if(r>0){const s=n.substring(r).toLowerCase(),i=t?.extensionIcons;return i?.[s]??i?.[s.slice(1)]}}g(H,"detectIcon");function C(n,t){return n.includes(":")?n:n in b.icons||!t?`${b.prefix}:${n}`:`${t}:${n}`}g(C,"qualifyIcon");function B(n,t){if(n.icon!=="none"){if(n.icon)return C(n.icon,t.defaultIconPack);if(t.showIcons){if(n.nodeType==="file"){const e=H(n.name,t);if(e==="none")return;if(e)return C(e,t.defaultIconPack)}return`${b.prefix}:${n.nodeType==="directory"?"folder":"file"}`}}}g(B,"getNodeIcon");ee([{name:b.prefix,icons:b}]);var y=14,ge=4,fe=16,ue=g(async(n,t)=>{const e=[],r=g(i=>{const o=B(i,t);o&&e.push({icon:o,node:i}),i.children.forEach(r)},"collect");r(n);const s=await Promise.all(e.map(async({icon:i,node:o})=>({id:o.id,svg:await K(i,{height:y,width:y})})));return new Map(s.map(({id:i,svg:o})=>[i,o]))},"resolveNodeIcons"),we=g((n,t,e,r,s,i)=>{const o=r.append("g");let a="treeView-node-label";e.nodeType==="directory"&&(a+=" treeView-node-dir"),e.cssClass&&(a+=` ${e.cssClass}`);const p=y+ge,c=B(e,s),d=c!==void 0;c&&o.append("g").attr("class","treeView-node-icon").attr("transform",`translate(${n+s.paddingX}, ${t+s.paddingY})`).html(i.get(e.id)??"");const h=o.append("text").text(e.name).attr("dominant-baseline","middle").attr("class",a),{height:l,width:w}=h.node().getBBox(),f=l+s.paddingY*2,m=n+s.paddingX+(d?p:0);h.attr("x",m),h.attr("y",t+f/2);const u=m+w,v=w+s.paddingX*2+(d?p:0);return e.BBox={x:n,y:t,width:v,height:f},e.cssClass?.split(/\s+/).includes("highlight")&&o.insert("rect",":first-child").attr("x",n).attr("y",t+1).attr("width",0).attr("height",f-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:e,nodeGroup:o,labelRightEdge:u,centerY:t+f/2}},"positionLabel"),k=g((n,t,e,r,s,i)=>n.append("line").attr("x1",t).attr("y1",e).attr("x2",r).attr("y2",s).attr("stroke-width",i).attr("class","treeView-node-line"),"positionLine"),me=g((n,t,e,r)=>{let s=0,i=0;const o=[],a=g((d,h,l,w)=>{const f=w*(l.rowIndent+l.paddingX),m=we(f,s,h,d,l,r);o.push(m);const{height:u,width:v}=h.BBox;k(d,f-l.rowIndent,s+u/2,f,s+u/2,l.lineThickness),i=Math.max(i,f+v),s+=u},"drawNode"),p=g((d,h=0)=>{a(n,d,e,h),d.children.forEach(m=>{p(m,h+1)});const{x:l,y:w,height:f}=d.BBox;if(d.children.length){const{y:m,height:u}=d.children[d.children.length-1].BBox;k(n,l+e.paddingX,w+f,l+e.paddingX,m+u/2+e.lineThickness/2,e.lineThickness)}},"processNode");p(t);const c=o.filter(d=>d.node.description);if(c.length>0){const h=Math.max(...o.map(l=>l.labelRightEdge))+fe;for(const l of c){const f=l.nodeGroup.append("text").text(l.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",h).attr("y",l.centerY).node().getBBox();i=Math.max(i,h+f.width+e.paddingX)}}for(const d of o)if(d.node.cssClass?.split(/\s+/).includes("highlight")){const h=d.nodeGroup.select(".treeView-highlight-bg");if(!h.empty()){const l=i-d.node.BBox.x+8;h.attr("width",l),i=Math.max(i,d.node.BBox.x+l+2)}}return{totalHeight:s,totalWidth:i}},"drawTree"),xe=g(async(n,t,e,r)=>{A.debug(`Rendering treeView diagram
|
|
4
4
|
`+n);const s=r.db,i=s.getRoot(),o=s.getConfig(),a=q(t),p=a.append("g");p.attr("class","tree-view");const c=await ue(i,o),{totalHeight:d,totalWidth:h}=me(p,i,o,c);a.attr("viewBox",`-${o.lineThickness/2} 0 ${h} ${d}`),U(a,d,h,o.useMaxWidth)},"draw"),ve={draw:xe},be=ve,Ie={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},Ce=g(({treeView:n})=>{const{labelFontSize:t,labelColor:e,lineColor:r,iconColor:s,descriptionColor:i,highlightBg:o,highlightStroke:a}=N(Ie,n);return`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as n}from"./
|
|
1
|
+
import{g as p,r as u,d as n}from"./CRxUemhR.js";import{p as f}from"./BQQo4uEb.js";import{b as a,ay as o}from"./BrNYPcY3.js";import{M as c,c as d}from"./CfNfee-Y.js";var v=d().RailroadAbnf.parser.LangiumParser,i=a(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=a(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=a(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=a(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=a(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=a(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=a(e=>{f(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(P(r)))},"populateDb"),R={parse:a(e=>{n.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:n}},w={parser:R,db:n,renderer:u,styles:p};export{w as diagram};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as e,ay as s,aX as o,B as i}from"./
|
|
1
|
+
import{b as e,ay as s,aX as o,B as i}from"./BrNYPcY3.js";import{p as g}from"./CfNfee-Y.js";var p={parse:e(async r=>{const a=await g("info",r);s.debug(a)},"parse")},v={version:"12.3.0"},d=e(()=>v.version,"getVersion"),m={getVersion:d},c=e((r,a,n)=>{s.debug(`rendering info diagram
|
|
2
2
|
`+r);const t=o(a);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${n}`)},"draw"),f={draw:c},b={parser:p,db:m,renderer:f};export{b as diagram};
|